diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8a0d659..3accbe2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,7 +34,7 @@ jobs: id: set-matrix run: | # List of all available parsers - ALL_PARSERS="redshift" + ALL_PARSERS="redshift postgresql" # Add more parsers here as they are added to the repository # ALL_PARSERS="redshift mysql postgresql" @@ -101,3 +101,15 @@ jobs: # sort: cut into columns by delimiter ' ' (single space) and sort by column 3 (test time in seconds) as numeric type in reverse order (largest comes first) # awk: accumulate sum by test time in seconds run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}' + + all-tests-passed: + runs-on: ubuntu-latest + # This job needs both detect-changes and go-tests + needs: [detect-changes, go-tests] + # This condition is key: + # - Run if no files were changed (the 'go-tests' job was skipped). + # - Or run if the 'go-tests' job (the whole matrix) succeeded. + if: success() || needs.detect-changes.outputs.any_changed == 'false' + steps: + - name: Report overall status + run: echo "All required tests passed or no changes were detected." \ No newline at end of file diff --git a/postgresql/Makefile b/postgresql/Makefile new file mode 100644 index 0000000..dc60e73 --- /dev/null +++ b/postgresql/Makefile @@ -0,0 +1,7 @@ +all: build test + +build: + antlr -Dlanguage=Go -package postgresql -visitor -o . PostgreSQLLexer.g4 PostgreSQLParser.g4 + +test: + go test -v -run TestPostgreSQLParser \ No newline at end of file diff --git a/postgresql/PostgreSQLLexer.g4 b/postgresql/PostgreSQLLexer.g4 new file mode 100755 index 0000000..2351c04 --- /dev/null +++ b/postgresql/PostgreSQLLexer.g4 @@ -0,0 +1,3065 @@ +/* +based on +https://github.com/tunnelvisionlabs/antlr4-grammar-postgresql/blob/master/src/com/tunnelvisionlabs/postgresql/PostgreSqlLexer.g4 +*/ + +/* + * [The "MIT license"] + * Copyright (C) 2014 Sam Harwell, Tunnel Vision Laboratories, LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * 1. The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * 2. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * 3. Except as contained in this notice, the name of Tunnel Vision + * Laboratories, LLC. shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without prior + * written authorization from Tunnel Vision Laboratories, LLC. + */ +lexer grammar PostgreSQLLexer; +/* Reference: + * http://www.postgresql.org/docs/9.3/static/sql-syntax-lexical.html + */ + +options { + superClass = PostgreSQLLexerBase; + caseInsensitive = true; +} + +@ header +{ +} +@ members +{ +/* This field stores the tags which are used to detect the end of a dollar-quoted string literal. + */ +} +// + +// SPECIAL CHARACTERS (4.1.4) + +// + +// Note that Asterisk is a valid operator, but does not have the type Operator due to its syntactic use in locations + +// that are not expressions. + +Dollar + : '$' + ; + +OPEN_PAREN + : '(' + ; + +CLOSE_PAREN + : ')' + ; + +OPEN_BRACKET + : '[' + ; + +CLOSE_BRACKET + : ']' + ; + +COMMA + : ',' + ; + +SEMI + : ';' + ; + +COLON + : ':' + ; + +STAR + : '*' + ; + +EQUAL + : '=' + ; + +DOT + : '.' + ; + //NamedArgument : ':='; + +PLUS + : '+' + ; + +MINUS + : '-' + ; + +SLASH + : '/' + ; + +CARET + : '^' + ; + +LT + : '<' + ; + +GT + : '>' + ; + +LESS_LESS + : '<<' + ; + +GREATER_GREATER + : '>>' + ; + +COLON_EQUALS + : ':=' + ; + +LESS_EQUALS + : '<=' + ; + +EQUALS_GREATER + : '=>' + ; + +GREATER_EQUALS + : '>=' + ; + +DOT_DOT + : '..' + ; + +NOT_EQUALS + : '<>' + ; + +TYPECAST + : '::' + ; + +PERCENT + : '%' + ; + +PARAM + : '$' ([0-9])+ + ; + // + + // OPERATORS (4.1.3) + + // + + // this rule does not allow + or - at the end of a multi-character operator + +Operator + : ((OperatorCharacter | ('+' | '-' + {p.checkLA('-')}?)+ (OperatorCharacter | '/' + {p.checkLA('*')}?) | '/' + {p.checkLA('*')}?)+ | // special handling for the single-character operators + and - + [+-]) + //TODO somehow rewrite this part without using Actions + + { + l.HandleLessLessGreaterGreater(); + } + ; +/* This rule handles operators which end with + or -, and sets the token type to Operator. It is comprised of four + * parts, in order: + * + * 1. A prefix, which does not contain a character from the required set which allows + or - to appear at the end of + * the operator. + * 2. A character from the required set which allows + or - to appear at the end of the operator. + * 3. An optional sub-token which takes the form of an operator which does not include a + or - at the end of the + * sub-token. + * 4. A suffix sequence of + and - characters. + */ + + +OperatorEndingWithPlusMinus + : (OperatorCharacterNotAllowPlusMinusAtEnd | '-' + {p.checkLA('-')}? | '/' + {p.checkLA('*')}?)* OperatorCharacterAllowPlusMinusAtEnd Operator? ('+' | '-' + {p.checkLA('-')}?)+ -> type (Operator) + ; + // Each of the following fragment rules omits the +, -, and / characters, which must always be handled in a special way + + // by the operator rules above. + +fragment OperatorCharacter + : [*<>=~!@%^&|`?#] + ; + // these are the operator characters that don't count towards one ending with + or - + +fragment OperatorCharacterNotAllowPlusMinusAtEnd + : [*<>=+] + ; + // an operator may end with + or - if it contains one of these characters + +fragment OperatorCharacterAllowPlusMinusAtEnd + : [~!@%^&|`?#] + ; + // + + // KEYWORDS (Appendix C) + + // + + // + + // reserved keywords + + // + +ALL + : 'ALL' + ; + +ANALYSE + : 'ANALYSE' + ; + +ANALYZE + : 'ANALYZE' + ; + +AND + : 'AND' + ; + +ANY + : 'ANY' + ; + +ARRAY + : 'ARRAY' + ; + +AS + : 'AS' + ; + +ASC + : 'ASC' + ; + +ASYMMETRIC + : 'ASYMMETRIC' + ; + +BOTH + : 'BOTH' + ; + +CASE + : 'CASE' + ; + +CAST + : 'CAST' + ; + +CHECK + : 'CHECK' + ; + +COLLATE + : 'COLLATE' + ; + +COLUMN + : 'COLUMN' + ; + +CONSTRAINT + : 'CONSTRAINT' + ; + +CREATE + : 'CREATE' + ; + +CURRENT_CATALOG + : 'CURRENT_CATALOG' + ; + +CURRENT_DATE + : 'CURRENT_DATE' + ; + +CURRENT_ROLE + : 'CURRENT_ROLE' + ; + +CURRENT_TIME + : 'CURRENT_TIME' + ; + +CURRENT_TIMESTAMP + : 'CURRENT_TIMESTAMP' + ; + +CURRENT_USER + : 'CURRENT_USER' + ; + +DEFAULT + : 'DEFAULT' + ; + +DEFERRABLE + : 'DEFERRABLE' + ; + +DESC + : 'DESC' + ; + +DISTINCT + : 'DISTINCT' + ; + +DO + : 'DO' + ; + +ELSE + : 'ELSE' + ; + +EXCEPT + : 'EXCEPT' + ; + +FALSE_P + : 'FALSE' + ; + +FETCH + : 'FETCH' + ; + +FOR + : 'FOR' + ; + +FOREIGN + : 'FOREIGN' + ; + +FROM + : 'FROM' + ; + +GRANT + : 'GRANT' + ; + +GROUP_P + : 'GROUP' + ; + +HAVING + : 'HAVING' + ; + +IN_P + : 'IN' + ; + +INITIALLY + : 'INITIALLY' + ; + +INTERSECT + : 'INTERSECT' + ; + +INTO + : 'INTO' + ; + +LATERAL_P + : 'LATERAL' + ; + +LEADING + : 'LEADING' + ; + +LIMIT + : 'LIMIT' + ; + +LOCALTIME + : 'LOCALTIME' + ; + +LOCALTIMESTAMP + : 'LOCALTIMESTAMP' + ; + +NOT + : 'NOT' + ; + +NULL_P + : 'NULL' + ; + +OFFSET + : 'OFFSET' + ; + +ON + : 'ON' + ; + +ONLY + : 'ONLY' + ; + +OR + : 'OR' + ; + +ORDER + : 'ORDER' + ; + +PLACING + : 'PLACING' + ; + +PRIMARY + : 'PRIMARY' + ; + +REFERENCES + : 'REFERENCES' + ; + +RETURNING + : 'RETURNING' + ; + +SELECT + : 'SELECT' + ; + +SESSION_USER + : 'SESSION_USER' + ; + +SOME + : 'SOME' + ; + +SYMMETRIC + : 'SYMMETRIC' + ; + +TABLE + : 'TABLE' + ; + +THEN + : 'THEN' + ; + +TO + : 'TO' + ; + +TRAILING + : 'TRAILING' + ; + +TRUE_P + : 'TRUE' + ; + +UNION + : 'UNION' + ; + +UNIQUE + : 'UNIQUE' + ; + +USER + : 'USER' + ; + +USING + : 'USING' + ; + +VARIADIC + : 'VARIADIC' + ; + +WHEN + : 'WHEN' + ; + +WHERE + : 'WHERE' + ; + +WINDOW + : 'WINDOW' + ; + +WITH + : 'WITH' + ; + + // + + // reserved keywords (can be function or type) + + // + +AUTHORIZATION + : 'AUTHORIZATION' + ; + +BINARY + : 'BINARY' + ; + +COLLATION + : 'COLLATION' + ; + +CONCURRENTLY + : 'CONCURRENTLY' + ; + +CROSS + : 'CROSS' + ; + +CURRENT_SCHEMA + : 'CURRENT_SCHEMA' + ; + +FREEZE + : 'FREEZE' + ; + +FULL + : 'FULL' + ; + +ILIKE + : 'ILIKE' + ; + +INNER_P + : 'INNER' + ; + +IS + : 'IS' + ; + +ISNULL + : 'ISNULL' + ; + +JOIN + : 'JOIN' + ; + +LEFT + : 'LEFT' + ; + +LIKE + : 'LIKE' + ; + +NATURAL + : 'NATURAL' + ; + +NOTNULL + : 'NOTNULL' + ; + +OUTER_P + : 'OUTER' + ; + +OVER + : 'OVER' + ; + +OVERLAPS + : 'OVERLAPS' + ; + +RIGHT + : 'RIGHT' + ; + +SIMILAR + : 'SIMILAR' + ; + +VERBOSE + : 'VERBOSE' + ; + // + + // non-reserved keywords + + // + +ABORT_P + : 'ABORT' + ; + +ABSOLUTE_P + : 'ABSOLUTE' + ; + +ACCESS + : 'ACCESS' + ; + +ACTION + : 'ACTION' + ; + +ADD_P + : 'ADD' + ; + +ADMIN + : 'ADMIN' + ; + +AFTER + : 'AFTER' + ; + +AGGREGATE + : 'AGGREGATE' + ; + +ALSO + : 'ALSO' + ; + +ALTER + : 'ALTER' + ; + +ALWAYS + : 'ALWAYS' + ; + +ASSERTION + : 'ASSERTION' + ; + +ASSIGNMENT + : 'ASSIGNMENT' + ; + +AT + : 'AT' + ; + +ATTRIBUTE + : 'ATTRIBUTE' + ; + +BACKWARD + : 'BACKWARD' + ; + +BEFORE + : 'BEFORE' + ; + +BEGIN_P + : 'BEGIN' + ; + +BY + : 'BY' + ; + +CACHE + : 'CACHE' + ; + +CALLED + : 'CALLED' + ; + +CASCADE + : 'CASCADE' + ; + +CASCADED + : 'CASCADED' + ; + +CATALOG + : 'CATALOG' + ; + +CHAIN + : 'CHAIN' + ; + +CHARACTERISTICS + : 'CHARACTERISTICS' + ; + +CHECKPOINT + : 'CHECKPOINT' + ; + +CLASS + : 'CLASS' + ; + +CLOSE + : 'CLOSE' + ; + +CLUSTER + : 'CLUSTER' + ; + +COMMENT + : 'COMMENT' + ; + +COMMENTS + : 'COMMENTS' + ; + +COMMIT + : 'COMMIT' + ; + +COMMITTED + : 'COMMITTED' + ; + +CONFIGURATION + : 'CONFIGURATION' + ; + +CONNECTION + : 'CONNECTION' + ; + +CONSTRAINTS + : 'CONSTRAINTS' + ; + +CONTENT_P + : 'CONTENT' + ; + +CONTINUE_P + : 'CONTINUE' + ; + +CONVERSION_P + : 'CONVERSION' + ; + +COPY + : 'COPY' + ; + +COST + : 'COST' + ; + +CSV + : 'CSV' + ; + +CURSOR + : 'CURSOR' + ; + +CYCLE + : 'CYCLE' + ; + +DATA_P + : 'DATA' + ; + +DATABASE + : 'DATABASE' + ; + +DAY_P + : 'DAY' + ; + +DEALLOCATE + : 'DEALLOCATE' + ; + +DECLARE + : 'DECLARE' + ; + +DEFAULTS + : 'DEFAULTS' + ; + +DEFERRED + : 'DEFERRED' + ; + +DEFINER + : 'DEFINER' + ; + +DELETE_P + : 'DELETE' + ; + +DELIMITER + : 'DELIMITER' + ; + +DELIMITERS + : 'DELIMITERS' + ; + +DICTIONARY + : 'DICTIONARY' + ; + +DISABLE_P + : 'DISABLE' + ; + +DISCARD + : 'DISCARD' + ; + +DOCUMENT_P + : 'DOCUMENT' + ; + +DOMAIN_P + : 'DOMAIN' + ; + +DOUBLE_P + : 'DOUBLE' + ; + +DROP + : 'DROP' + ; + +EACH + : 'EACH' + ; + +ENABLE_P + : 'ENABLE' + ; + +ENCODING + : 'ENCODING' + ; + +ENCRYPTED + : 'ENCRYPTED' + ; + +ENUM_P + : 'ENUM' + ; + +ESCAPE + : 'ESCAPE' + ; + +EVENT + : 'EVENT' + ; + +EXCLUDE + : 'EXCLUDE' + ; + +EXCLUDING + : 'EXCLUDING' + ; + +EXCLUSIVE + : 'EXCLUSIVE' + ; + +EXECUTE + : 'EXECUTE' + ; + +EXPLAIN + : 'EXPLAIN' + ; + +EXTENSION + : 'EXTENSION' + ; + +EXTERNAL + : 'EXTERNAL' + ; + +FAMILY + : 'FAMILY' + ; + +FIRST_P + : 'FIRST' + ; + +FOLLOWING + : 'FOLLOWING' + ; + +FORCE + : 'FORCE' + ; + +FORWARD + : 'FORWARD' + ; + +FUNCTION + : 'FUNCTION' + ; + +FUNCTIONS + : 'FUNCTIONS' + ; + +GLOBAL + : 'GLOBAL' + ; + +GRANTED + : 'GRANTED' + ; + +HANDLER + : 'HANDLER' + ; + +HEADER_P + : 'HEADER' + ; + +HOLD + : 'HOLD' + ; + +HOUR_P + : 'HOUR' + ; + +IDENTITY_P + : 'IDENTITY' + ; + +IF_P + : 'IF' + ; + +IMMEDIATE + : 'IMMEDIATE' + ; + +IMMUTABLE + : 'IMMUTABLE' + ; + +IMPLICIT_P + : 'IMPLICIT' + ; + +INCLUDING + : 'INCLUDING' + ; + +INCREMENT + : 'INCREMENT' + ; + +INDEX + : 'INDEX' + ; + +INDEXES + : 'INDEXES' + ; + +INHERIT + : 'INHERIT' + ; + +INHERITS + : 'INHERITS' + ; + +INLINE_P + : 'INLINE' + ; + +INSENSITIVE + : 'INSENSITIVE' + ; + +INSERT + : 'INSERT' + ; + +INSTEAD + : 'INSTEAD' + ; + +INVOKER + : 'INVOKER' + ; + +ISOLATION + : 'ISOLATION' + ; + +KEY + : 'KEY' + ; + +LABEL + : 'LABEL' + ; + +LANGUAGE + : 'LANGUAGE' + ; + +LARGE_P + : 'LARGE' + ; + +LAST_P + : 'LAST' + ; + //LC_COLLATE : 'LC'_'COLLATE; + + //LC_CTYPE : 'LC'_'CTYPE; + +LEAKPROOF + : 'LEAKPROOF' + ; + +LEVEL + : 'LEVEL' + ; + +LISTEN + : 'LISTEN' + ; + +LOAD + : 'LOAD' + ; + +LOCAL + : 'LOCAL' + ; + +LOCATION + : 'LOCATION' + ; + +LOCK_P + : 'LOCK' + ; + +MAPPING + : 'MAPPING' + ; + +MATCH + : 'MATCH' + ; + +MATCHED + : 'MATCHED' + ; + +MATERIALIZED + : 'MATERIALIZED' + ; + +MAXVALUE + : 'MAXVALUE' + ; + +MERGE + : 'MERGE' + ; + +MINUTE_P + : 'MINUTE' + ; + +MINVALUE + : 'MINVALUE' + ; + +MODE + : 'MODE' + ; + +MONTH_P + : 'MONTH' + ; + +MOVE + : 'MOVE' + ; + +NAME_P + : 'NAME' + ; + +NAMES + : 'NAMES' + ; + +NEXT + : 'NEXT' + ; + +NO + : 'NO' + ; + +NOTHING + : 'NOTHING' + ; + +NOTIFY + : 'NOTIFY' + ; + +NOWAIT + : 'NOWAIT' + ; + +NULLS_P + : 'NULLS' + ; + +OBJECT_P + : 'OBJECT' + ; + +OF + : 'OF' + ; + +OFF + : 'OFF' + ; + +OIDS + : 'OIDS' + ; + +OPERATOR + : 'OPERATOR' + ; + +OPTION + : 'OPTION' + ; + +OPTIONS + : 'OPTIONS' + ; + +OWNED + : 'OWNED' + ; + +OWNER + : 'OWNER' + ; + +PARSER + : 'PARSER' + ; + +PARTIAL + : 'PARTIAL' + ; + +PARTITION + : 'PARTITION' + ; + +PASSING + : 'PASSING' + ; + +PASSWORD + : 'PASSWORD' + ; + +PLANS + : 'PLANS' + ; + +PRECEDING + : 'PRECEDING' + ; + +PREPARE + : 'PREPARE' + ; + +PREPARED + : 'PREPARED' + ; + +PRESERVE + : 'PRESERVE' + ; + +PRIOR + : 'PRIOR' + ; + +PRIVILEGES + : 'PRIVILEGES' + ; + +PROCEDURAL + : 'PROCEDURAL' + ; + +PROCEDURE + : 'PROCEDURE' + ; + +PROGRAM + : 'PROGRAM' + ; + +QUOTE + : 'QUOTE' + ; + +RANGE + : 'RANGE' + ; + +READ + : 'READ' + ; + +REASSIGN + : 'REASSIGN' + ; + +RECHECK + : 'RECHECK' + ; + +RECURSIVE + : 'RECURSIVE' + ; + +REF + : 'REF' + ; + +REFRESH + : 'REFRESH' + ; + +REINDEX + : 'REINDEX' + ; + +RELATIVE_P + : 'RELATIVE' + ; + +RELEASE + : 'RELEASE' + ; + +RENAME + : 'RENAME' + ; + +REPEATABLE + : 'REPEATABLE' + ; + +REPLACE + : 'REPLACE' + ; + +REPLICA + : 'REPLICA' + ; + +RESET + : 'RESET' + ; + +RESTART + : 'RESTART' + ; + +RESTRICT + : 'RESTRICT' + ; + +RETURNS + : 'RETURNS' + ; + +REVOKE + : 'REVOKE' + ; + +ROLE + : 'ROLE' + ; + +ROLLBACK + : 'ROLLBACK' + ; + +ROWS + : 'ROWS' + ; + +RULE + : 'RULE' + ; + +SAVEPOINT + : 'SAVEPOINT' + ; + +SCHEMA + : 'SCHEMA' + ; + +SCROLL + : 'SCROLL' + ; + +SEARCH + : 'SEARCH' + ; + +SECOND_P + : 'SECOND' + ; + +SECURITY + : 'SECURITY' + ; + +SEQUENCE + : 'SEQUENCE' + ; + +SEQUENCES + : 'SEQUENCES' + ; + +SERIALIZABLE + : 'SERIALIZABLE' + ; + +SERVER + : 'SERVER' + ; + +SESSION + : 'SESSION' + ; + +SET + : 'SET' + ; + +SHARE + : 'SHARE' + ; + +SHOW + : 'SHOW' + ; + +SIMPLE + : 'SIMPLE' + ; + +SNAPSHOT + : 'SNAPSHOT' + ; + +STABLE + : 'STABLE' + ; + +STANDALONE_P + : 'STANDALONE' + ; + +START + : 'START' + ; + +STATEMENT + : 'STATEMENT' + ; + +STATISTICS + : 'STATISTICS' + ; + +STDIN + : 'STDIN' + ; + +STDOUT + : 'STDOUT' + ; + +STORAGE + : 'STORAGE' + ; + +STRICT_P + : 'STRICT' + ; + +STRIP_P + : 'STRIP' + ; + +SYSID + : 'SYSID' + ; + +SYSTEM_P + : 'SYSTEM' + ; + +TABLES + : 'TABLES' + ; + +TABLESPACE + : 'TABLESPACE' + ; + +TEMP + : 'TEMP' + ; + +TEMPLATE + : 'TEMPLATE' + ; + +TEMPORARY + : 'TEMPORARY' + ; + +TEXT_P + : 'TEXT' + ; + +TRANSACTION + : 'TRANSACTION' + ; + +TRIGGER + : 'TRIGGER' + ; + +TRUNCATE + : 'TRUNCATE' + ; + +TRUSTED + : 'TRUSTED' + ; + +TYPE_P + : 'TYPE' + ; + +TYPES_P + : 'TYPES' + ; + +UNBOUNDED + : 'UNBOUNDED' + ; + +UNCOMMITTED + : 'UNCOMMITTED' + ; + +UNENCRYPTED + : 'UNENCRYPTED' + ; + +UNKNOWN + : 'UNKNOWN' + ; + +UNLISTEN + : 'UNLISTEN' + ; + +UNLOGGED + : 'UNLOGGED' + ; + +UNTIL + : 'UNTIL' + ; + +UPDATE + : 'UPDATE' + ; + +VACUUM + : 'VACUUM' + ; + +VALID + : 'VALID' + ; + +VALIDATE + : 'VALIDATE' + ; + +VALIDATOR + : 'VALIDATOR' + ; + //VALUE : 'VALUE; + +VARYING + : 'VARYING' + ; + +VERSION_P + : 'VERSION' + ; + +VIEW + : 'VIEW' + ; + +VOLATILE + : 'VOLATILE' + ; + +WHITESPACE_P + : 'WHITESPACE' + ; + +WITHOUT + : 'WITHOUT' + ; + +WORK + : 'WORK' + ; + +WRAPPER + : 'WRAPPER' + ; + +WRITE + : 'WRITE' + ; + +XML_P + : 'XML' + ; + +YEAR_P + : 'YEAR' + ; + +YES_P + : 'YES' + ; + +ZONE + : 'ZONE' + ; + // + + // non-reserved keywords (can not be function or type) + + // + +ATOMIC_P + : 'ATOMIC' + ; + +BETWEEN + : 'BETWEEN' + ; + +BIGINT + : 'BIGINT' + ; + +BIT + : 'BIT' + ; + +BOOLEAN_P + : 'BOOLEAN' + ; + +CHAR_P + : 'CHAR' + ; + +CHARACTER + : 'CHARACTER' + ; + +COALESCE + : 'COALESCE' + ; + +DEC + : 'DEC' + ; + +DECIMAL_P + : 'DECIMAL' + ; + +EXISTS + : 'EXISTS' + ; + +EXTRACT + : 'EXTRACT' + ; + +FLOAT_P + : 'FLOAT' + ; + +GREATEST + : 'GREATEST' + ; + +INOUT + : 'INOUT' + ; + +INT_P + : 'INT' + ; + +INTEGER + : 'INTEGER' + ; + +INTERVAL + : 'INTERVAL' + ; + +LEAST + : 'LEAST' + ; + +NATIONAL + : 'NATIONAL' + ; + +NCHAR + : 'NCHAR' + ; + +NONE + : 'NONE' + ; + +NULLIF + : 'NULLIF' + ; + +NUMERIC + : 'NUMERIC' + ; + +OVERLAY + : 'OVERLAY' + ; + +PARAMETER + : 'PARAMETER' + ; + +POSITION + : 'POSITION' + ; + +PRECISION + : 'PRECISION' + ; + +REAL + : 'REAL' + ; + +ROW + : 'ROW' + ; + +SETOF + : 'SETOF' + ; + +SMALLINT + : 'SMALLINT' + ; + +SUBSTRING + : 'SUBSTRING' + ; + +TIME + : 'TIME' + ; + +TIMESTAMP + : 'TIMESTAMP' + ; + +TREAT + : 'TREAT' + ; + +TRIM + : 'TRIM' + ; + +VALUES + : 'VALUES' + ; + +VARCHAR + : 'VARCHAR' + ; + +XMLATTRIBUTES + : 'XMLATTRIBUTES' + ; + +XMLCOMMENT + : 'XMLCOMMENT' + ; + +XMLAGG + : 'XMLAGG' + ; + +XML_IS_WELL_FORMED + : 'XML_IS_WELL_FORMED' + ; + +XML_IS_WELL_FORMED_DOCUMENT + : 'XML_IS_WELL_FORMED_DOCUMENT' + ; + +XML_IS_WELL_FORMED_CONTENT + : 'XML_IS_WELL_FORMED_CONTENT' + ; + +XPATH + : 'XPATH' + ; + +XPATH_EXISTS + : 'XPATH_EXISTS' + ; + +XMLCONCAT + : 'XMLCONCAT' + ; + +XMLELEMENT + : 'XMLELEMENT' + ; + +XMLEXISTS + : 'XMLEXISTS' + ; + +XMLFOREST + : 'XMLFOREST' + ; + +XMLPARSE + : 'XMLPARSE' + ; + +XMLPI + : 'XMLPI' + ; + +XMLROOT + : 'XMLROOT' + ; + +XMLSERIALIZE + : 'XMLSERIALIZE' + ; + //MISSED + +CALL + : 'CALL' + ; + +CURRENT_P + : 'CURRENT' + ; + +ATTACH + : 'ATTACH' + ; + +DETACH + : 'DETACH' + ; + +EXPRESSION + : 'EXPRESSION' + ; + +GENERATED + : 'GENERATED' + ; + +LOGGED + : 'LOGGED' + ; + +STORED + : 'STORED' + ; + +INCLUDE + : 'INCLUDE' + ; + +ROUTINE + : 'ROUTINE' + ; + +TRANSFORM + : 'TRANSFORM' + ; + +IMPORT_P + : 'IMPORT' + ; + +POLICY + : 'POLICY' + ; + +METHOD + : 'METHOD' + ; + +REFERENCING + : 'REFERENCING' + ; + +NEW + : 'NEW' + ; + +OLD + : 'OLD' + ; + +VALUE_P + : 'VALUE' + ; + +SUBSCRIPTION + : 'SUBSCRIPTION' + ; + +PUBLICATION + : 'PUBLICATION' + ; + +OUT_P + : 'OUT' + ; + +END_P + : 'END' + ; + +ROUTINES + : 'ROUTINES' + ; + +SCHEMAS + : 'SCHEMAS' + ; + +PROCEDURES + : 'PROCEDURES' + ; + +INPUT_P + : 'INPUT' + ; + +SUPPORT + : 'SUPPORT' + ; + +PARALLEL + : 'PARALLEL' + ; + +SQL_P + : 'SQL' + ; + +DEPENDS + : 'DEPENDS' + ; + +OVERRIDING + : 'OVERRIDING' + ; + +CONFLICT + : 'CONFLICT' + ; + +SKIP_P + : 'SKIP' + ; + +LOCKED + : 'LOCKED' + ; + +TIES + : 'TIES' + ; + +ROLLUP + : 'ROLLUP' + ; + +CUBE + : 'CUBE' + ; + +GROUPING + : 'GROUPING' + ; + +SETS + : 'SETS' + ; + +TABLESAMPLE + : 'TABLESAMPLE' + ; + +ORDINALITY + : 'ORDINALITY' + ; + +XMLTABLE + : 'XMLTABLE' + ; + +COLUMNS + : 'COLUMNS' + ; + +XMLNAMESPACES + : 'XMLNAMESPACES' + ; + +ROWTYPE + : 'ROWTYPE' + ; + +NORMALIZED + : 'NORMALIZED' + ; + +WITHIN + : 'WITHIN' + ; + +FILTER + : 'FILTER' + ; + +GROUPS + : 'GROUPS' + ; + +OTHERS + : 'OTHERS' + ; + +NFC + : 'NFC' + ; + +NFD + : 'NFD' + ; + +NFKC + : 'NFKC' + ; + +NFKD + : 'NFKD' + ; + +UESCAPE + : 'UESCAPE' + ; + +VIEWS + : 'VIEWS' + ; + +NORMALIZE + : 'NORMALIZE' + ; + +DUMP + : 'DUMP' + ; + +PRINT_STRICT_PARAMS + : 'PRINT_STRICT_PARAMS' + ; + +VARIABLE_CONFLICT + : 'VARIABLE_CONFLICT' + ; + +ERROR + : 'ERROR' + ; + +USE_VARIABLE + : 'USE_VARIABLE' + ; + +USE_COLUMN + : 'USE_COLUMN' + ; + +ALIAS + : 'ALIAS' + ; + +CONSTANT + : 'CONSTANT' + ; + +PERFORM + : 'PERFORM' + ; + +GET + : 'GET' + ; + +DIAGNOSTICS + : 'DIAGNOSTICS' + ; + +STACKED + : 'STACKED' + ; + +ELSIF + : 'ELSIF' + ; + +WHILE + : 'WHILE' + ; + +REVERSE + : 'REVERSE' + ; + +FOREACH + : 'FOREACH' + ; + +SLICE + : 'SLICE' + ; + +EXIT + : 'EXIT' + ; + +RETURN + : 'RETURN' + ; + +QUERY + : 'QUERY' + ; + +RAISE + : 'RAISE' + ; + +SQLSTATE + : 'SQLSTATE' + ; + +DEBUG + : 'DEBUG' + ; + +LOG + : 'LOG' + ; + +INFO + : 'INFO' + ; + +NOTICE + : 'NOTICE' + ; + +WARNING + : 'WARNING' + ; + +EXCEPTION + : 'EXCEPTION' + ; + +ASSERT + : 'ASSERT' + ; + +LOOP + : 'LOOP' + ; + +OPEN + : 'OPEN' + ; + // + + // IDENTIFIERS (4.1.1) + + // + +ABS + : 'ABS' + ; + +CBRT + : 'CBRT' + ; + +CEIL + : 'CEIL' + ; + +CEILING + : 'CEILING' + ; + +DEGREES + : 'DEGREES' + ; + +DIV + : 'DIV' + ; + +EXP + : 'EXP' + ; + +FACTORIAL + : 'FACTORIAL' + ; + +FLOOR + : 'FLOOR' + ; + +GCD + : 'GCD' + ; + +LCM + : 'LCM' + ; + +LN + : 'LN' + ; + +LOG10 + : 'LOG10' + ; + +MIN_SCALE + : 'MIN_SCALE' + ; + +MOD + : 'MOD' + ; + +PI + : 'PI' + ; + +POWER + : 'POWER' + ; + +RADIANS + : 'RADIANS' + ; + +ROUND + : 'ROUND' + ; + +SCALE + : 'SCALE' + ; + +SIGN + : 'SIGN' + ; + +SQRT + : 'SQRT' + ; + +TRIM_SCALE + : 'TRIM_SCALE' + ; + +TRUNC + : 'TRUNC' + ; + +WIDTH_BUCKET + : 'WIDTH_BUCKET' + ; + +RANDOM + : 'RANDOM' + ; + +SETSEED + : 'SETSEED' + ; + +ACOS + : 'ACOS' + ; + +ACOSD + : 'ACOSD' + ; + +ASIN + : 'ASIN' + ; + +ASIND + : 'ASIND' + ; + +ATAN + : 'ATAN' + ; + +ATAND + : 'ATAND' + ; + +ATAN2 + : 'ATAN2' + ; + +ATAN2D + : 'ATAN2D' + ; + +COS + : 'COS' + ; + +COSD + : 'COSD' + ; + +COT + : 'COT' + ; + +COTD + : 'COTD' + ; + +SIN + : 'SIN' + ; + +SIND + : 'SIND' + ; + +TAN + : 'TAN' + ; + +TAND + : 'TAND' + ; + +SINH + : 'SINH' + ; + +COSH + : 'COSH' + ; + +TANH + : 'TANH' + ; + +ASINH + : 'ASINH' + ; + +ACOSH + : 'ACOSH' + ; + +ATANH + : 'ATANH' + ; + +BIT_LENGTH + : 'BIT_LENGTH' + ; + +CHAR_LENGTH + : 'CHAR_LENGTH' + ; + +CHARACTER_LENGTH + : 'CHARACTER_LENGTH' + ; + +LOWER + : 'LOWER' + ; + +OCTET_LENGTH + : 'OCTET_LENGTH' + ; + +UPPER + : 'UPPER' + ; + +ASCII + : 'ASCII' + ; + +BTRIM + : 'BTRIM' + ; + +CHR + : 'CHR' + ; + +CONCAT + : 'CONCAT' + ; + +CONCAT_WS + : 'CONCAT_WS' + ; + +FORMAT + : 'FORMAT' + ; + +INITCAP + : 'INITCAP' + ; + +LENGTH + : 'LENGTH' + ; + +LPAD + : 'LPAD' + ; + +LTRIM + : 'LTRIM' + ; + +MD5 + : 'MD5' + ; + +PARSE_IDENT + : 'PARSE_IDENT' + ; + +PG_CLIENT_ENCODING + : 'PG_CLIENT_ENCODING' + ; + +QUOTE_IDENT + : 'QUOTE_IDENT' + ; + +QUOTE_LITERAL + : 'QUOTE_LITERAL' + ; + +QUOTE_NULLABLE + : 'QUOTE_NULLABLE' + ; + +REGEXP_COUNT + : 'REGEXP_COUNT' + ; + +REGEXP_INSTR + : 'REGEXP_INSTR' + ; + +REGEXP_LIKE + : 'REGEXP_LIKE' + ; + +REGEXP_MATCH + : 'REGEXP_MATCH' + ; + +REGEXP_MATCHES + : 'REGEXP_MATCHES' + ; + +REGEXP_REPLACE + : 'REGEXP_REPLACE' + ; + +REGEXP_SPLIT_TO_ARRAY + : 'REGEXP_SPLIT_TO_ARRAY' + ; + +REGEXP_SPLIT_TO_TABLE + : 'REGEXP_SPLIT_TO_TABLE' + ; + +REGEXP_SUBSTR + : 'REGEXP_SUBSTR' + ; + +REPEAT + : 'REPEAT' + ; + +RPAD + : 'RPAD' + ; + +RTRIM + : 'RTRIM' + ; + +SPLIT_PART + : 'SPLIT_PART' + ; + +STARTS_WITH + : 'STARTS_WITH' + ; + +STRING_TO_ARRAY + : 'STRING_TO_ARRAY' + ; + +STRING_TO_TABLE + : 'STRING_TO_TABLE' + ; + +STRPOS + : 'STRPOS' + ; + +SUBSTR + : 'SUBSTR' + ; + +TO_ASCII + : 'TO_ASCII' + ; + +TO_HEX + : 'TO_HEX' + ; + +TRANSLATE + : 'TRANSLATE' + ; + +UNISTR + : 'UNISTR' + ; + +AGE + : 'AGE' + ; + +CLOCK_TIMESTAMP + : 'CLOCK_TIMESTAMP' + ; + +DATE_BIN + : 'DATE_BIN' + ; + +DATE_PART + : 'DATE_PART' + ; + +DATE_TRUNC + : 'DATE_TRUNC' + ; + +ISFINITE + : 'ISFINITE' + ; + +JUSTIFY_DAYS + : 'JUSTIFY_DAYS' + ; + +JUSTIFY_HOURS + : 'JUSTIFY_HOURS' + ; + +JUSTIFY_INTERVAL + : 'JUSTIFY_INTERVAL' + ; + +MAKE_DATE + : 'MAKE_DATE' + ; + +MAKE_INTERVAL + : 'MAKE_INTERVAL' + ; + +MAKE_TIME + : 'MAKE_TIME' + ; + +MAKE_TIMESTAMP + : 'MAKE_TIMESTAMP' + ; + +MAKE_TIMESTAMPTZ + : 'MAKE_TIMESTAMPTZ' + ; + +NOW + : 'NOW' + ; + +STATEMENT_TIMESTAMP + : 'STATEMENT_TIMESTAMP' + ; + +TIMEOFDAY + : 'TIMEOFDAY' + ; + +TRANSACTION_TIMESTAMP + : 'TRANSACTION_TIMESTAMP' + ; + +TO_TIMESTAMP + : 'TO_TIMESTAMP' + ; + +TO_CHAR + : 'TO_CHAR' + ; + +TO_DATE + : 'TO_DATE' + ; + +TO_NUMBER + : 'TO_NUMBER' + ; + +ENCODE + : 'ENCODE' + ; + +DISTKEY + : 'DISTKEY' + ; + +SORTKEY + : 'SORTKEY' + ; + +CASE_SENSITIVE + : 'CASE_SENSITIVE' + ; + +CASE_INSENSITIVE + : 'CASE_INSENSITIVE' + ; + +Identifier + : IdentifierStartChar IdentifierChar* + ; + +fragment IdentifierStartChar options { caseInsensitive=false; } + : // these are the valid identifier start characters below 0x7F + [a-zA-Z_] + | // these are the valid characters from 0x80 to 0xFF + [\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF] + | // these are the letters above 0xFF which only need a single UTF-16 code unit + [\u0100-\uD7FF\uE000-\uFFFF] + {p.charIsLetter()}? + | // letters which require multiple UTF-16 code units + [\uD800-\uDBFF] [\uDC00-\uDFFF] + { p.CheckIfUtf32Letter() }? + + ; + +fragment IdentifierChar + : StrictIdentifierChar + | '$' + ; + +fragment StrictIdentifierChar + : IdentifierStartChar + | [0-9] + ; +/* Quoted Identifiers + * + * These are divided into four separate tokens, allowing distinction of valid quoted identifiers from invalid quoted + * identifiers without sacrificing the ability of the lexer to reliably recover from lexical errors in the input. + */ + + +QuotedIdentifier + : UnterminatedQuotedIdentifier '"' + ; + // This is a quoted identifier which only contains valid characters but is not terminated + +UnterminatedQuotedIdentifier + : '"' ('""' | ~ [\u0000"])* + ; + // This is a quoted identifier which is terminated but contains a \u0000 character + +InvalidQuotedIdentifier + : InvalidUnterminatedQuotedIdentifier '"' + ; + // This is a quoted identifier which is unterminated and contains a \u0000 character + +InvalidUnterminatedQuotedIdentifier + : '"' ('""' | ~ '"')* + ; +/* Unicode Quoted Identifiers + * + * These are divided into four separate tokens, allowing distinction of valid Unicode quoted identifiers from invalid + * Unicode quoted identifiers without sacrificing the ability of the lexer to reliably recover from lexical errors in + * the input. Note that escape sequences are never checked as part of this determination due to the ability of users + * to change the escape character with a UESCAPE clause following the Unicode quoted identifier. + * + * TODO: these rules assume "" is still a valid escape sequence within a Unicode quoted identifier. + */ + + +UnicodeQuotedIdentifier + : 'U' '&' QuotedIdentifier + ; + // This is a Unicode quoted identifier which only contains valid characters but is not terminated + +UnterminatedUnicodeQuotedIdentifier + : 'U' '&' UnterminatedQuotedIdentifier + ; + // This is a Unicode quoted identifier which is terminated but contains a \u0000 character + +InvalidUnicodeQuotedIdentifier + : 'U' '&' InvalidQuotedIdentifier + ; + // This is a Unicode quoted identifier which is unterminated and contains a \u0000 character + +InvalidUnterminatedUnicodeQuotedIdentifier + : 'U' '&' InvalidUnterminatedQuotedIdentifier + ; + // + + // CONSTANTS (4.1.2) + + // + + // String Constants (4.1.2.1) + +StringConstant + : UnterminatedStringConstant '\'' + ; + +UnterminatedStringConstant + : '\'' ('\'\'' | ~ '\'')* + ; + // String Constants with C-style Escapes (4.1.2.2) + +BeginEscapeStringConstant + : 'E' '\'' -> more , pushMode (EscapeStringConstantMode) + ; + // String Constants with Unicode Escapes (4.1.2.3) + + // + + // Note that escape sequences are never checked as part of this token due to the ability of users to change the escape + + // character with a UESCAPE clause following the Unicode string constant. + + // + + // TODO: these rules assume '' is still a valid escape sequence within a Unicode string constant. + +UnicodeEscapeStringConstant + : UnterminatedUnicodeEscapeStringConstant '\'' + ; + +UnterminatedUnicodeEscapeStringConstant + : 'U' '&' UnterminatedStringConstant + ; + // Dollar-quoted String Constants (4.1.2.4) + +BeginDollarStringConstant + : '$' Tag? '$' + {l.pushTag();} -> pushMode (DollarQuotedStringMode) + ; +/* "The tag, if any, of a dollar-quoted string follows the same rules as an + * unquoted identifier, except that it cannot contain a dollar sign." + */ + + +fragment Tag + : IdentifierStartChar StrictIdentifierChar* + ; + // Bit-strings Constants (4.1.2.5) + +BinaryStringConstant + : UnterminatedBinaryStringConstant '\'' + ; + +UnterminatedBinaryStringConstant + : 'B' '\'' [01]* + ; + +InvalidBinaryStringConstant + : InvalidUnterminatedBinaryStringConstant '\'' + ; + +InvalidUnterminatedBinaryStringConstant + : 'B' UnterminatedStringConstant + ; + +HexadecimalStringConstant + : UnterminatedHexadecimalStringConstant '\'' + ; + +UnterminatedHexadecimalStringConstant + : 'X' '\'' [0-9A-F]* + ; + +InvalidHexadecimalStringConstant + : InvalidUnterminatedHexadecimalStringConstant '\'' + ; + +InvalidUnterminatedHexadecimalStringConstant + : 'X' UnterminatedStringConstant + ; + // Numeric Constants (4.1.2.6) + +Integral + : Digits + ; + +NumericFail + : Digits '..' + {l.HandleNumericFail();} + ; + +Numeric + : Digits '.' Digits? /*? replaced with + to solve problem with DOT_DOT .. but this surely must be rewriten */ + + ('E' [+-]? Digits)? + | '.' Digits ('E' [+-]? Digits)? + | Digits 'E' [+-]? Digits + ; + +fragment Digits + : [0-9]+ + ; + +PLSQLVARIABLENAME + : ':' [A-Z_] [A-Z_0-9$]* + ; + +PLSQLIDENTIFIER + : ':"' ('\\' . | '""' | ~ ('"' | '\\'))* '"' + ; + // + + // WHITESPACE (4.1) + + // + +Whitespace + : [ \t] -> channel (HIDDEN) + ; + +Newline + : ('\r' '\n'? | '\n') -> channel (HIDDEN) + ; + // + + // COMMENTS (4.1.5) + + // + +LineComment + : '--' ~ [\r\n]* -> channel (HIDDEN) + ; + +BlockComment + : ('/*' ('/'* BlockComment | ~ [/*] | '/'+ ~ [/*] | '*'+ ~ [/*])* '*'* '*/') -> channel (HIDDEN) + ; + +UnterminatedBlockComment + : '/*' ('/'* BlockComment | // these characters are not part of special sequences in a block comment + ~ [/*] | // handle / or * characters which are not part of /* or */ and do not appear at the end of the file + ('/'+ ~ [/*] | '*'+ ~ [/*]))* + // Handle the case of / or * characters at the end of the file, or a nested unterminated block comment + ('/'+ | '*'+ | '/'* UnterminatedBlockComment)? + // Optional assertion to make sure this rule is working as intended + + { + l.UnterminatedBlockCommentDebugAssert(); + } + ; + // + + // META-COMMANDS + + // + + // http://www.postgresql.org/docs/9.3/static/app-psql.html + +MetaCommand + : '\\' (~ [\r\n\\"] | '"' ~ [\r\n"]* '"')* ('"' ~ [\r\n"]*)? + ; + +EndMetaCommand + : '\\\\' + ; + // + + // ERROR + + // + + // Any character which does not match one of the above rules will appear in the token stream as an ErrorCharacter token. + + // This ensures the lexer itself will never encounter a syntax error, so all error handling may be performed by the + + // parser. + +ErrorCharacter + : . + ; + +mode EscapeStringConstantMode; +EscapeStringConstant + : EscapeStringText '\'' -> mode (AfterEscapeStringConstantMode) + ; + +UnterminatedEscapeStringConstant + : EscapeStringText + // Handle a final unmatched \ character appearing at the end of the file + '\\'? EOF + ; + +fragment EscapeStringText options { caseInsensitive=false; } + : ('\'\'' | '\\' ( // two-digit hex escapes are still valid when treated as single-digit escapes + 'x' [0-9a-fA-F] | + 'u' [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] | + 'U' [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] | // Any character other than the Unicode escapes can follow a backslash. Some have special meaning, + // but that doesn't affect the syntax. + ~ [xuU]) | ~ ['\\])* + ; + +InvalidEscapeStringConstant + : InvalidEscapeStringText '\'' -> mode (AfterEscapeStringConstantMode) + ; + +InvalidUnterminatedEscapeStringConstant + : InvalidEscapeStringText + // Handle a final unmatched \ character appearing at the end of the file + '\\'? EOF + ; + +fragment InvalidEscapeStringText + : ('\'\'' | '\\' . | ~ ['\\])* + ; + +mode AfterEscapeStringConstantMode; +AfterEscapeStringConstantMode_Whitespace + : Whitespace -> type (Whitespace) , channel (HIDDEN) + ; + +AfterEscapeStringConstantMode_Newline + : Newline -> type (Newline) , channel (HIDDEN) , mode (AfterEscapeStringConstantWithNewlineMode) + ; + +AfterEscapeStringConstantMode_NotContinued + : + {} // intentionally empty + -> skip , popMode + ; + +mode AfterEscapeStringConstantWithNewlineMode; +AfterEscapeStringConstantWithNewlineMode_Whitespace + : Whitespace -> type (Whitespace) , channel (HIDDEN) + ; + +AfterEscapeStringConstantWithNewlineMode_Newline + : Newline -> type (Newline) , channel (HIDDEN) + ; + +AfterEscapeStringConstantWithNewlineMode_Continued + : '\'' -> more , mode (EscapeStringConstantMode) + ; + +AfterEscapeStringConstantWithNewlineMode_NotContinued + : + {} // intentionally empty + -> skip , popMode + ; + +mode DollarQuotedStringMode; +DollarText + : ~ '$'+ + //| '$'([0-9])+ + | // this alternative improves the efficiency of handling $ characters within a dollar-quoted string which are + + // not part of the ending tag. + '$' ~ '$'* + ; + +EndDollarStringConstant + : ('$' Tag? '$') + {p.isTag()}? + {l.popTag();} -> popMode + ; diff --git a/postgresql/PostgreSQLLexer.interp b/postgresql/PostgreSQLLexer.interp new file mode 100644 index 0000000..0080192 --- /dev/null +++ b/postgresql/PostgreSQLLexer.interp @@ -0,0 +1,2095 @@ +token literal names: +null +'$' +'(' +')' +'[' +']' +',' +';' +':' +'*' +'=' +'.' +'+' +'-' +'/' +'^' +'<' +'>' +'<<' +'>>' +':=' +'<=' +'=>' +'>=' +'..' +'<>' +'::' +'%' +null +null +'ALL' +'ANALYSE' +'ANALYZE' +'AND' +'ANY' +'ARRAY' +'AS' +'ASC' +'ASYMMETRIC' +'BOTH' +'CASE' +'CAST' +'CHECK' +'COLLATE' +'COLUMN' +'CONSTRAINT' +'CREATE' +'CURRENT_CATALOG' +'CURRENT_DATE' +'CURRENT_ROLE' +'CURRENT_TIME' +'CURRENT_TIMESTAMP' +'CURRENT_USER' +'DEFAULT' +'DEFERRABLE' +'DESC' +'DISTINCT' +'DO' +'ELSE' +'EXCEPT' +'FALSE' +'FETCH' +'FOR' +'FOREIGN' +'FROM' +'GRANT' +'GROUP' +'HAVING' +'IN' +'INITIALLY' +'INTERSECT' +'INTO' +'LATERAL' +'LEADING' +'LIMIT' +'LOCALTIME' +'LOCALTIMESTAMP' +'NOT' +'NULL' +'OFFSET' +'ON' +'ONLY' +'OR' +'ORDER' +'PLACING' +'PRIMARY' +'REFERENCES' +'RETURNING' +'SELECT' +'SESSION_USER' +'SOME' +'SYMMETRIC' +'TABLE' +'THEN' +'TO' +'TRAILING' +'TRUE' +'UNION' +'UNIQUE' +'USER' +'USING' +'VARIADIC' +'WHEN' +'WHERE' +'WINDOW' +'WITH' +'AUTHORIZATION' +'BINARY' +'COLLATION' +'CONCURRENTLY' +'CROSS' +'CURRENT_SCHEMA' +'FREEZE' +'FULL' +'ILIKE' +'INNER' +'IS' +'ISNULL' +'JOIN' +'LEFT' +'LIKE' +'NATURAL' +'NOTNULL' +'OUTER' +'OVER' +'OVERLAPS' +'RIGHT' +'SIMILAR' +'VERBOSE' +'ABORT' +'ABSOLUTE' +'ACCESS' +'ACTION' +'ADD' +'ADMIN' +'AFTER' +'AGGREGATE' +'ALSO' +'ALTER' +'ALWAYS' +'ASSERTION' +'ASSIGNMENT' +'AT' +'ATTRIBUTE' +'BACKWARD' +'BEFORE' +'BEGIN' +'BY' +'CACHE' +'CALLED' +'CASCADE' +'CASCADED' +'CATALOG' +'CHAIN' +'CHARACTERISTICS' +'CHECKPOINT' +'CLASS' +'CLOSE' +'CLUSTER' +'COMMENT' +'COMMENTS' +'COMMIT' +'COMMITTED' +'CONFIGURATION' +'CONNECTION' +'CONSTRAINTS' +'CONTENT' +'CONTINUE' +'CONVERSION' +'COPY' +'COST' +'CSV' +'CURSOR' +'CYCLE' +'DATA' +'DATABASE' +'DAY' +'DEALLOCATE' +'DECLARE' +'DEFAULTS' +'DEFERRED' +'DEFINER' +'DELETE' +'DELIMITER' +'DELIMITERS' +'DICTIONARY' +'DISABLE' +'DISCARD' +'DOCUMENT' +'DOMAIN' +'DOUBLE' +'DROP' +'EACH' +'ENABLE' +'ENCODING' +'ENCRYPTED' +'ENUM' +'ESCAPE' +'EVENT' +'EXCLUDE' +'EXCLUDING' +'EXCLUSIVE' +'EXECUTE' +'EXPLAIN' +'EXTENSION' +'EXTERNAL' +'FAMILY' +'FIRST' +'FOLLOWING' +'FORCE' +'FORWARD' +'FUNCTION' +'FUNCTIONS' +'GLOBAL' +'GRANTED' +'HANDLER' +'HEADER' +'HOLD' +'HOUR' +'IDENTITY' +'IF' +'IMMEDIATE' +'IMMUTABLE' +'IMPLICIT' +'INCLUDING' +'INCREMENT' +'INDEX' +'INDEXES' +'INHERIT' +'INHERITS' +'INLINE' +'INSENSITIVE' +'INSERT' +'INSTEAD' +'INVOKER' +'ISOLATION' +'KEY' +'LABEL' +'LANGUAGE' +'LARGE' +'LAST' +'LEAKPROOF' +'LEVEL' +'LISTEN' +'LOAD' +'LOCAL' +'LOCATION' +'LOCK' +'MAPPING' +'MATCH' +'MATCHED' +'MATERIALIZED' +'MAXVALUE' +'MERGE' +'MINUTE' +'MINVALUE' +'MODE' +'MONTH' +'MOVE' +'NAME' +'NAMES' +'NEXT' +'NO' +'NOTHING' +'NOTIFY' +'NOWAIT' +'NULLS' +'OBJECT' +'OF' +'OFF' +'OIDS' +'OPERATOR' +'OPTION' +'OPTIONS' +'OWNED' +'OWNER' +'PARSER' +'PARTIAL' +'PARTITION' +'PASSING' +'PASSWORD' +'PLANS' +'PRECEDING' +'PREPARE' +'PREPARED' +'PRESERVE' +'PRIOR' +'PRIVILEGES' +'PROCEDURAL' +'PROCEDURE' +'PROGRAM' +'QUOTE' +'RANGE' +'READ' +'REASSIGN' +'RECHECK' +'RECURSIVE' +'REF' +'REFRESH' +'REINDEX' +'RELATIVE' +'RELEASE' +'RENAME' +'REPEATABLE' +'REPLACE' +'REPLICA' +'RESET' +'RESTART' +'RESTRICT' +'RETURNS' +'REVOKE' +'ROLE' +'ROLLBACK' +'ROWS' +'RULE' +'SAVEPOINT' +'SCHEMA' +'SCROLL' +'SEARCH' +'SECOND' +'SECURITY' +'SEQUENCE' +'SEQUENCES' +'SERIALIZABLE' +'SERVER' +'SESSION' +'SET' +'SHARE' +'SHOW' +'SIMPLE' +'SNAPSHOT' +'STABLE' +'STANDALONE' +'START' +'STATEMENT' +'STATISTICS' +'STDIN' +'STDOUT' +'STORAGE' +'STRICT' +'STRIP' +'SYSID' +'SYSTEM' +'TABLES' +'TABLESPACE' +'TEMP' +'TEMPLATE' +'TEMPORARY' +'TEXT' +'TRANSACTION' +'TRIGGER' +'TRUNCATE' +'TRUSTED' +'TYPE' +'TYPES' +'UNBOUNDED' +'UNCOMMITTED' +'UNENCRYPTED' +'UNKNOWN' +'UNLISTEN' +'UNLOGGED' +'UNTIL' +'UPDATE' +'VACUUM' +'VALID' +'VALIDATE' +'VALIDATOR' +'VARYING' +'VERSION' +'VIEW' +'VOLATILE' +'WHITESPACE' +'WITHOUT' +'WORK' +'WRAPPER' +'WRITE' +'XML' +'YEAR' +'YES' +'ZONE' +'ATOMIC' +'BETWEEN' +'BIGINT' +'BIT' +'BOOLEAN' +'CHAR' +'CHARACTER' +'COALESCE' +'DEC' +'DECIMAL' +'EXISTS' +'EXTRACT' +'FLOAT' +'GREATEST' +'INOUT' +'INT' +'INTEGER' +'INTERVAL' +'LEAST' +'NATIONAL' +'NCHAR' +'NONE' +'NULLIF' +'NUMERIC' +'OVERLAY' +'PARAMETER' +'POSITION' +'PRECISION' +'REAL' +'ROW' +'SETOF' +'SMALLINT' +'SUBSTRING' +'TIME' +'TIMESTAMP' +'TREAT' +'TRIM' +'VALUES' +'VARCHAR' +'XMLATTRIBUTES' +'XMLCOMMENT' +'XMLAGG' +'XML_IS_WELL_FORMED' +'XML_IS_WELL_FORMED_DOCUMENT' +'XML_IS_WELL_FORMED_CONTENT' +'XPATH' +'XPATH_EXISTS' +'XMLCONCAT' +'XMLELEMENT' +'XMLEXISTS' +'XMLFOREST' +'XMLPARSE' +'XMLPI' +'XMLROOT' +'XMLSERIALIZE' +'CALL' +'CURRENT' +'ATTACH' +'DETACH' +'EXPRESSION' +'GENERATED' +'LOGGED' +'STORED' +'INCLUDE' +'ROUTINE' +'TRANSFORM' +'IMPORT' +'POLICY' +'METHOD' +'REFERENCING' +'NEW' +'OLD' +'VALUE' +'SUBSCRIPTION' +'PUBLICATION' +'OUT' +'END' +'ROUTINES' +'SCHEMAS' +'PROCEDURES' +'INPUT' +'SUPPORT' +'PARALLEL' +'SQL' +'DEPENDS' +'OVERRIDING' +'CONFLICT' +'SKIP' +'LOCKED' +'TIES' +'ROLLUP' +'CUBE' +'GROUPING' +'SETS' +'TABLESAMPLE' +'ORDINALITY' +'XMLTABLE' +'COLUMNS' +'XMLNAMESPACES' +'ROWTYPE' +'NORMALIZED' +'WITHIN' +'FILTER' +'GROUPS' +'OTHERS' +'NFC' +'NFD' +'NFKC' +'NFKD' +'UESCAPE' +'VIEWS' +'NORMALIZE' +'DUMP' +'PRINT_STRICT_PARAMS' +'VARIABLE_CONFLICT' +'ERROR' +'USE_VARIABLE' +'USE_COLUMN' +'ALIAS' +'CONSTANT' +'PERFORM' +'GET' +'DIAGNOSTICS' +'STACKED' +'ELSIF' +'WHILE' +'REVERSE' +'FOREACH' +'SLICE' +'EXIT' +'RETURN' +'QUERY' +'RAISE' +'SQLSTATE' +'DEBUG' +'LOG' +'INFO' +'NOTICE' +'WARNING' +'EXCEPTION' +'ASSERT' +'LOOP' +'OPEN' +'ABS' +'CBRT' +'CEIL' +'CEILING' +'DEGREES' +'DIV' +'EXP' +'FACTORIAL' +'FLOOR' +'GCD' +'LCM' +'LN' +'LOG10' +'MIN_SCALE' +'MOD' +'PI' +'POWER' +'RADIANS' +'ROUND' +'SCALE' +'SIGN' +'SQRT' +'TRIM_SCALE' +'TRUNC' +'WIDTH_BUCKET' +'RANDOM' +'SETSEED' +'ACOS' +'ACOSD' +'ASIN' +'ASIND' +'ATAN' +'ATAND' +'ATAN2' +'ATAN2D' +'COS' +'COSD' +'COT' +'COTD' +'SIN' +'SIND' +'TAN' +'TAND' +'SINH' +'COSH' +'TANH' +'ASINH' +'ACOSH' +'ATANH' +'BIT_LENGTH' +'CHAR_LENGTH' +'CHARACTER_LENGTH' +'LOWER' +'OCTET_LENGTH' +'UPPER' +'ASCII' +'BTRIM' +'CHR' +'CONCAT' +'CONCAT_WS' +'FORMAT' +'INITCAP' +'LENGTH' +'LPAD' +'LTRIM' +'MD5' +'PARSE_IDENT' +'PG_CLIENT_ENCODING' +'QUOTE_IDENT' +'QUOTE_LITERAL' +'QUOTE_NULLABLE' +'REGEXP_COUNT' +'REGEXP_INSTR' +'REGEXP_LIKE' +'REGEXP_MATCH' +'REGEXP_MATCHES' +'REGEXP_REPLACE' +'REGEXP_SPLIT_TO_ARRAY' +'REGEXP_SPLIT_TO_TABLE' +'REGEXP_SUBSTR' +'REPEAT' +'RPAD' +'RTRIM' +'SPLIT_PART' +'STARTS_WITH' +'STRING_TO_ARRAY' +'STRING_TO_TABLE' +'STRPOS' +'SUBSTR' +'TO_ASCII' +'TO_HEX' +'TRANSLATE' +'UNISTR' +'AGE' +'CLOCK_TIMESTAMP' +'DATE_BIN' +'DATE_PART' +'DATE_TRUNC' +'ISFINITE' +'JUSTIFY_DAYS' +'JUSTIFY_HOURS' +'JUSTIFY_INTERVAL' +'MAKE_DATE' +'MAKE_INTERVAL' +'MAKE_TIME' +'MAKE_TIMESTAMP' +'MAKE_TIMESTAMPTZ' +'NOW' +'STATEMENT_TIMESTAMP' +'TIMEOFDAY' +'TRANSACTION_TIMESTAMP' +'TO_TIMESTAMP' +'TO_CHAR' +'TO_DATE' +'TO_NUMBER' +'ENCODE' +'DISTKEY' +'SORTKEY' +'CASE_SENSITIVE' +'CASE_INSENSITIVE' +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +'\\\\' +null +null +null +null +null +null +null +null +null +'\'' + +token symbolic names: +null +Dollar +OPEN_PAREN +CLOSE_PAREN +OPEN_BRACKET +CLOSE_BRACKET +COMMA +SEMI +COLON +STAR +EQUAL +DOT +PLUS +MINUS +SLASH +CARET +LT +GT +LESS_LESS +GREATER_GREATER +COLON_EQUALS +LESS_EQUALS +EQUALS_GREATER +GREATER_EQUALS +DOT_DOT +NOT_EQUALS +TYPECAST +PERCENT +PARAM +Operator +ALL +ANALYSE +ANALYZE +AND +ANY +ARRAY +AS +ASC +ASYMMETRIC +BOTH +CASE +CAST +CHECK +COLLATE +COLUMN +CONSTRAINT +CREATE +CURRENT_CATALOG +CURRENT_DATE +CURRENT_ROLE +CURRENT_TIME +CURRENT_TIMESTAMP +CURRENT_USER +DEFAULT +DEFERRABLE +DESC +DISTINCT +DO +ELSE +EXCEPT +FALSE_P +FETCH +FOR +FOREIGN +FROM +GRANT +GROUP_P +HAVING +IN_P +INITIALLY +INTERSECT +INTO +LATERAL_P +LEADING +LIMIT +LOCALTIME +LOCALTIMESTAMP +NOT +NULL_P +OFFSET +ON +ONLY +OR +ORDER +PLACING +PRIMARY +REFERENCES +RETURNING +SELECT +SESSION_USER +SOME +SYMMETRIC +TABLE +THEN +TO +TRAILING +TRUE_P +UNION +UNIQUE +USER +USING +VARIADIC +WHEN +WHERE +WINDOW +WITH +AUTHORIZATION +BINARY +COLLATION +CONCURRENTLY +CROSS +CURRENT_SCHEMA +FREEZE +FULL +ILIKE +INNER_P +IS +ISNULL +JOIN +LEFT +LIKE +NATURAL +NOTNULL +OUTER_P +OVER +OVERLAPS +RIGHT +SIMILAR +VERBOSE +ABORT_P +ABSOLUTE_P +ACCESS +ACTION +ADD_P +ADMIN +AFTER +AGGREGATE +ALSO +ALTER +ALWAYS +ASSERTION +ASSIGNMENT +AT +ATTRIBUTE +BACKWARD +BEFORE +BEGIN_P +BY +CACHE +CALLED +CASCADE +CASCADED +CATALOG +CHAIN +CHARACTERISTICS +CHECKPOINT +CLASS +CLOSE +CLUSTER +COMMENT +COMMENTS +COMMIT +COMMITTED +CONFIGURATION +CONNECTION +CONSTRAINTS +CONTENT_P +CONTINUE_P +CONVERSION_P +COPY +COST +CSV +CURSOR +CYCLE +DATA_P +DATABASE +DAY_P +DEALLOCATE +DECLARE +DEFAULTS +DEFERRED +DEFINER +DELETE_P +DELIMITER +DELIMITERS +DICTIONARY +DISABLE_P +DISCARD +DOCUMENT_P +DOMAIN_P +DOUBLE_P +DROP +EACH +ENABLE_P +ENCODING +ENCRYPTED +ENUM_P +ESCAPE +EVENT +EXCLUDE +EXCLUDING +EXCLUSIVE +EXECUTE +EXPLAIN +EXTENSION +EXTERNAL +FAMILY +FIRST_P +FOLLOWING +FORCE +FORWARD +FUNCTION +FUNCTIONS +GLOBAL +GRANTED +HANDLER +HEADER_P +HOLD +HOUR_P +IDENTITY_P +IF_P +IMMEDIATE +IMMUTABLE +IMPLICIT_P +INCLUDING +INCREMENT +INDEX +INDEXES +INHERIT +INHERITS +INLINE_P +INSENSITIVE +INSERT +INSTEAD +INVOKER +ISOLATION +KEY +LABEL +LANGUAGE +LARGE_P +LAST_P +LEAKPROOF +LEVEL +LISTEN +LOAD +LOCAL +LOCATION +LOCK_P +MAPPING +MATCH +MATCHED +MATERIALIZED +MAXVALUE +MERGE +MINUTE_P +MINVALUE +MODE +MONTH_P +MOVE +NAME_P +NAMES +NEXT +NO +NOTHING +NOTIFY +NOWAIT +NULLS_P +OBJECT_P +OF +OFF +OIDS +OPERATOR +OPTION +OPTIONS +OWNED +OWNER +PARSER +PARTIAL +PARTITION +PASSING +PASSWORD +PLANS +PRECEDING +PREPARE +PREPARED +PRESERVE +PRIOR +PRIVILEGES +PROCEDURAL +PROCEDURE +PROGRAM +QUOTE +RANGE +READ +REASSIGN +RECHECK +RECURSIVE +REF +REFRESH +REINDEX +RELATIVE_P +RELEASE +RENAME +REPEATABLE +REPLACE +REPLICA +RESET +RESTART +RESTRICT +RETURNS +REVOKE +ROLE +ROLLBACK +ROWS +RULE +SAVEPOINT +SCHEMA +SCROLL +SEARCH +SECOND_P +SECURITY +SEQUENCE +SEQUENCES +SERIALIZABLE +SERVER +SESSION +SET +SHARE +SHOW +SIMPLE +SNAPSHOT +STABLE +STANDALONE_P +START +STATEMENT +STATISTICS +STDIN +STDOUT +STORAGE +STRICT_P +STRIP_P +SYSID +SYSTEM_P +TABLES +TABLESPACE +TEMP +TEMPLATE +TEMPORARY +TEXT_P +TRANSACTION +TRIGGER +TRUNCATE +TRUSTED +TYPE_P +TYPES_P +UNBOUNDED +UNCOMMITTED +UNENCRYPTED +UNKNOWN +UNLISTEN +UNLOGGED +UNTIL +UPDATE +VACUUM +VALID +VALIDATE +VALIDATOR +VARYING +VERSION_P +VIEW +VOLATILE +WHITESPACE_P +WITHOUT +WORK +WRAPPER +WRITE +XML_P +YEAR_P +YES_P +ZONE +ATOMIC_P +BETWEEN +BIGINT +BIT +BOOLEAN_P +CHAR_P +CHARACTER +COALESCE +DEC +DECIMAL_P +EXISTS +EXTRACT +FLOAT_P +GREATEST +INOUT +INT_P +INTEGER +INTERVAL +LEAST +NATIONAL +NCHAR +NONE +NULLIF +NUMERIC +OVERLAY +PARAMETER +POSITION +PRECISION +REAL +ROW +SETOF +SMALLINT +SUBSTRING +TIME +TIMESTAMP +TREAT +TRIM +VALUES +VARCHAR +XMLATTRIBUTES +XMLCOMMENT +XMLAGG +XML_IS_WELL_FORMED +XML_IS_WELL_FORMED_DOCUMENT +XML_IS_WELL_FORMED_CONTENT +XPATH +XPATH_EXISTS +XMLCONCAT +XMLELEMENT +XMLEXISTS +XMLFOREST +XMLPARSE +XMLPI +XMLROOT +XMLSERIALIZE +CALL +CURRENT_P +ATTACH +DETACH +EXPRESSION +GENERATED +LOGGED +STORED +INCLUDE +ROUTINE +TRANSFORM +IMPORT_P +POLICY +METHOD +REFERENCING +NEW +OLD +VALUE_P +SUBSCRIPTION +PUBLICATION +OUT_P +END_P +ROUTINES +SCHEMAS +PROCEDURES +INPUT_P +SUPPORT +PARALLEL +SQL_P +DEPENDS +OVERRIDING +CONFLICT +SKIP_P +LOCKED +TIES +ROLLUP +CUBE +GROUPING +SETS +TABLESAMPLE +ORDINALITY +XMLTABLE +COLUMNS +XMLNAMESPACES +ROWTYPE +NORMALIZED +WITHIN +FILTER +GROUPS +OTHERS +NFC +NFD +NFKC +NFKD +UESCAPE +VIEWS +NORMALIZE +DUMP +PRINT_STRICT_PARAMS +VARIABLE_CONFLICT +ERROR +USE_VARIABLE +USE_COLUMN +ALIAS +CONSTANT +PERFORM +GET +DIAGNOSTICS +STACKED +ELSIF +WHILE +REVERSE +FOREACH +SLICE +EXIT +RETURN +QUERY +RAISE +SQLSTATE +DEBUG +LOG +INFO +NOTICE +WARNING +EXCEPTION +ASSERT +LOOP +OPEN +ABS +CBRT +CEIL +CEILING +DEGREES +DIV +EXP +FACTORIAL +FLOOR +GCD +LCM +LN +LOG10 +MIN_SCALE +MOD +PI +POWER +RADIANS +ROUND +SCALE +SIGN +SQRT +TRIM_SCALE +TRUNC +WIDTH_BUCKET +RANDOM +SETSEED +ACOS +ACOSD +ASIN +ASIND +ATAN +ATAND +ATAN2 +ATAN2D +COS +COSD +COT +COTD +SIN +SIND +TAN +TAND +SINH +COSH +TANH +ASINH +ACOSH +ATANH +BIT_LENGTH +CHAR_LENGTH +CHARACTER_LENGTH +LOWER +OCTET_LENGTH +UPPER +ASCII +BTRIM +CHR +CONCAT +CONCAT_WS +FORMAT +INITCAP +LENGTH +LPAD +LTRIM +MD5 +PARSE_IDENT +PG_CLIENT_ENCODING +QUOTE_IDENT +QUOTE_LITERAL +QUOTE_NULLABLE +REGEXP_COUNT +REGEXP_INSTR +REGEXP_LIKE +REGEXP_MATCH +REGEXP_MATCHES +REGEXP_REPLACE +REGEXP_SPLIT_TO_ARRAY +REGEXP_SPLIT_TO_TABLE +REGEXP_SUBSTR +REPEAT +RPAD +RTRIM +SPLIT_PART +STARTS_WITH +STRING_TO_ARRAY +STRING_TO_TABLE +STRPOS +SUBSTR +TO_ASCII +TO_HEX +TRANSLATE +UNISTR +AGE +CLOCK_TIMESTAMP +DATE_BIN +DATE_PART +DATE_TRUNC +ISFINITE +JUSTIFY_DAYS +JUSTIFY_HOURS +JUSTIFY_INTERVAL +MAKE_DATE +MAKE_INTERVAL +MAKE_TIME +MAKE_TIMESTAMP +MAKE_TIMESTAMPTZ +NOW +STATEMENT_TIMESTAMP +TIMEOFDAY +TRANSACTION_TIMESTAMP +TO_TIMESTAMP +TO_CHAR +TO_DATE +TO_NUMBER +ENCODE +DISTKEY +SORTKEY +CASE_SENSITIVE +CASE_INSENSITIVE +Identifier +QuotedIdentifier +UnterminatedQuotedIdentifier +InvalidQuotedIdentifier +InvalidUnterminatedQuotedIdentifier +UnicodeQuotedIdentifier +UnterminatedUnicodeQuotedIdentifier +InvalidUnicodeQuotedIdentifier +InvalidUnterminatedUnicodeQuotedIdentifier +StringConstant +UnterminatedStringConstant +UnicodeEscapeStringConstant +UnterminatedUnicodeEscapeStringConstant +BeginDollarStringConstant +BinaryStringConstant +UnterminatedBinaryStringConstant +InvalidBinaryStringConstant +InvalidUnterminatedBinaryStringConstant +HexadecimalStringConstant +UnterminatedHexadecimalStringConstant +InvalidHexadecimalStringConstant +InvalidUnterminatedHexadecimalStringConstant +Integral +NumericFail +Numeric +PLSQLVARIABLENAME +PLSQLIDENTIFIER +Whitespace +Newline +LineComment +BlockComment +UnterminatedBlockComment +MetaCommand +EndMetaCommand +ErrorCharacter +EscapeStringConstant +UnterminatedEscapeStringConstant +InvalidEscapeStringConstant +InvalidUnterminatedEscapeStringConstant +AfterEscapeStringConstantMode_NotContinued +AfterEscapeStringConstantWithNewlineMode_NotContinued +DollarText +EndDollarStringConstant +AfterEscapeStringConstantWithNewlineMode_Continued + +rule names: +Dollar +OPEN_PAREN +CLOSE_PAREN +OPEN_BRACKET +CLOSE_BRACKET +COMMA +SEMI +COLON +STAR +EQUAL +DOT +PLUS +MINUS +SLASH +CARET +LT +GT +LESS_LESS +GREATER_GREATER +COLON_EQUALS +LESS_EQUALS +EQUALS_GREATER +GREATER_EQUALS +DOT_DOT +NOT_EQUALS +TYPECAST +PERCENT +PARAM +Operator +OperatorEndingWithPlusMinus +OperatorCharacter +OperatorCharacterNotAllowPlusMinusAtEnd +OperatorCharacterAllowPlusMinusAtEnd +ALL +ANALYSE +ANALYZE +AND +ANY +ARRAY +AS +ASC +ASYMMETRIC +BOTH +CASE +CAST +CHECK +COLLATE +COLUMN +CONSTRAINT +CREATE +CURRENT_CATALOG +CURRENT_DATE +CURRENT_ROLE +CURRENT_TIME +CURRENT_TIMESTAMP +CURRENT_USER +DEFAULT +DEFERRABLE +DESC +DISTINCT +DO +ELSE +EXCEPT +FALSE_P +FETCH +FOR +FOREIGN +FROM +GRANT +GROUP_P +HAVING +IN_P +INITIALLY +INTERSECT +INTO +LATERAL_P +LEADING +LIMIT +LOCALTIME +LOCALTIMESTAMP +NOT +NULL_P +OFFSET +ON +ONLY +OR +ORDER +PLACING +PRIMARY +REFERENCES +RETURNING +SELECT +SESSION_USER +SOME +SYMMETRIC +TABLE +THEN +TO +TRAILING +TRUE_P +UNION +UNIQUE +USER +USING +VARIADIC +WHEN +WHERE +WINDOW +WITH +AUTHORIZATION +BINARY +COLLATION +CONCURRENTLY +CROSS +CURRENT_SCHEMA +FREEZE +FULL +ILIKE +INNER_P +IS +ISNULL +JOIN +LEFT +LIKE +NATURAL +NOTNULL +OUTER_P +OVER +OVERLAPS +RIGHT +SIMILAR +VERBOSE +ABORT_P +ABSOLUTE_P +ACCESS +ACTION +ADD_P +ADMIN +AFTER +AGGREGATE +ALSO +ALTER +ALWAYS +ASSERTION +ASSIGNMENT +AT +ATTRIBUTE +BACKWARD +BEFORE +BEGIN_P +BY +CACHE +CALLED +CASCADE +CASCADED +CATALOG +CHAIN +CHARACTERISTICS +CHECKPOINT +CLASS +CLOSE +CLUSTER +COMMENT +COMMENTS +COMMIT +COMMITTED +CONFIGURATION +CONNECTION +CONSTRAINTS +CONTENT_P +CONTINUE_P +CONVERSION_P +COPY +COST +CSV +CURSOR +CYCLE +DATA_P +DATABASE +DAY_P +DEALLOCATE +DECLARE +DEFAULTS +DEFERRED +DEFINER +DELETE_P +DELIMITER +DELIMITERS +DICTIONARY +DISABLE_P +DISCARD +DOCUMENT_P +DOMAIN_P +DOUBLE_P +DROP +EACH +ENABLE_P +ENCODING +ENCRYPTED +ENUM_P +ESCAPE +EVENT +EXCLUDE +EXCLUDING +EXCLUSIVE +EXECUTE +EXPLAIN +EXTENSION +EXTERNAL +FAMILY +FIRST_P +FOLLOWING +FORCE +FORWARD +FUNCTION +FUNCTIONS +GLOBAL +GRANTED +HANDLER +HEADER_P +HOLD +HOUR_P +IDENTITY_P +IF_P +IMMEDIATE +IMMUTABLE +IMPLICIT_P +INCLUDING +INCREMENT +INDEX +INDEXES +INHERIT +INHERITS +INLINE_P +INSENSITIVE +INSERT +INSTEAD +INVOKER +ISOLATION +KEY +LABEL +LANGUAGE +LARGE_P +LAST_P +LEAKPROOF +LEVEL +LISTEN +LOAD +LOCAL +LOCATION +LOCK_P +MAPPING +MATCH +MATCHED +MATERIALIZED +MAXVALUE +MERGE +MINUTE_P +MINVALUE +MODE +MONTH_P +MOVE +NAME_P +NAMES +NEXT +NO +NOTHING +NOTIFY +NOWAIT +NULLS_P +OBJECT_P +OF +OFF +OIDS +OPERATOR +OPTION +OPTIONS +OWNED +OWNER +PARSER +PARTIAL +PARTITION +PASSING +PASSWORD +PLANS +PRECEDING +PREPARE +PREPARED +PRESERVE +PRIOR +PRIVILEGES +PROCEDURAL +PROCEDURE +PROGRAM +QUOTE +RANGE +READ +REASSIGN +RECHECK +RECURSIVE +REF +REFRESH +REINDEX +RELATIVE_P +RELEASE +RENAME +REPEATABLE +REPLACE +REPLICA +RESET +RESTART +RESTRICT +RETURNS +REVOKE +ROLE +ROLLBACK +ROWS +RULE +SAVEPOINT +SCHEMA +SCROLL +SEARCH +SECOND_P +SECURITY +SEQUENCE +SEQUENCES +SERIALIZABLE +SERVER +SESSION +SET +SHARE +SHOW +SIMPLE +SNAPSHOT +STABLE +STANDALONE_P +START +STATEMENT +STATISTICS +STDIN +STDOUT +STORAGE +STRICT_P +STRIP_P +SYSID +SYSTEM_P +TABLES +TABLESPACE +TEMP +TEMPLATE +TEMPORARY +TEXT_P +TRANSACTION +TRIGGER +TRUNCATE +TRUSTED +TYPE_P +TYPES_P +UNBOUNDED +UNCOMMITTED +UNENCRYPTED +UNKNOWN +UNLISTEN +UNLOGGED +UNTIL +UPDATE +VACUUM +VALID +VALIDATE +VALIDATOR +VARYING +VERSION_P +VIEW +VOLATILE +WHITESPACE_P +WITHOUT +WORK +WRAPPER +WRITE +XML_P +YEAR_P +YES_P +ZONE +ATOMIC_P +BETWEEN +BIGINT +BIT +BOOLEAN_P +CHAR_P +CHARACTER +COALESCE +DEC +DECIMAL_P +EXISTS +EXTRACT +FLOAT_P +GREATEST +INOUT +INT_P +INTEGER +INTERVAL +LEAST +NATIONAL +NCHAR +NONE +NULLIF +NUMERIC +OVERLAY +PARAMETER +POSITION +PRECISION +REAL +ROW +SETOF +SMALLINT +SUBSTRING +TIME +TIMESTAMP +TREAT +TRIM +VALUES +VARCHAR +XMLATTRIBUTES +XMLCOMMENT +XMLAGG +XML_IS_WELL_FORMED +XML_IS_WELL_FORMED_DOCUMENT +XML_IS_WELL_FORMED_CONTENT +XPATH +XPATH_EXISTS +XMLCONCAT +XMLELEMENT +XMLEXISTS +XMLFOREST +XMLPARSE +XMLPI +XMLROOT +XMLSERIALIZE +CALL +CURRENT_P +ATTACH +DETACH +EXPRESSION +GENERATED +LOGGED +STORED +INCLUDE +ROUTINE +TRANSFORM +IMPORT_P +POLICY +METHOD +REFERENCING +NEW +OLD +VALUE_P +SUBSCRIPTION +PUBLICATION +OUT_P +END_P +ROUTINES +SCHEMAS +PROCEDURES +INPUT_P +SUPPORT +PARALLEL +SQL_P +DEPENDS +OVERRIDING +CONFLICT +SKIP_P +LOCKED +TIES +ROLLUP +CUBE +GROUPING +SETS +TABLESAMPLE +ORDINALITY +XMLTABLE +COLUMNS +XMLNAMESPACES +ROWTYPE +NORMALIZED +WITHIN +FILTER +GROUPS +OTHERS +NFC +NFD +NFKC +NFKD +UESCAPE +VIEWS +NORMALIZE +DUMP +PRINT_STRICT_PARAMS +VARIABLE_CONFLICT +ERROR +USE_VARIABLE +USE_COLUMN +ALIAS +CONSTANT +PERFORM +GET +DIAGNOSTICS +STACKED +ELSIF +WHILE +REVERSE +FOREACH +SLICE +EXIT +RETURN +QUERY +RAISE +SQLSTATE +DEBUG +LOG +INFO +NOTICE +WARNING +EXCEPTION +ASSERT +LOOP +OPEN +ABS +CBRT +CEIL +CEILING +DEGREES +DIV +EXP +FACTORIAL +FLOOR +GCD +LCM +LN +LOG10 +MIN_SCALE +MOD +PI +POWER +RADIANS +ROUND +SCALE +SIGN +SQRT +TRIM_SCALE +TRUNC +WIDTH_BUCKET +RANDOM +SETSEED +ACOS +ACOSD +ASIN +ASIND +ATAN +ATAND +ATAN2 +ATAN2D +COS +COSD +COT +COTD +SIN +SIND +TAN +TAND +SINH +COSH +TANH +ASINH +ACOSH +ATANH +BIT_LENGTH +CHAR_LENGTH +CHARACTER_LENGTH +LOWER +OCTET_LENGTH +UPPER +ASCII +BTRIM +CHR +CONCAT +CONCAT_WS +FORMAT +INITCAP +LENGTH +LPAD +LTRIM +MD5 +PARSE_IDENT +PG_CLIENT_ENCODING +QUOTE_IDENT +QUOTE_LITERAL +QUOTE_NULLABLE +REGEXP_COUNT +REGEXP_INSTR +REGEXP_LIKE +REGEXP_MATCH +REGEXP_MATCHES +REGEXP_REPLACE +REGEXP_SPLIT_TO_ARRAY +REGEXP_SPLIT_TO_TABLE +REGEXP_SUBSTR +REPEAT +RPAD +RTRIM +SPLIT_PART +STARTS_WITH +STRING_TO_ARRAY +STRING_TO_TABLE +STRPOS +SUBSTR +TO_ASCII +TO_HEX +TRANSLATE +UNISTR +AGE +CLOCK_TIMESTAMP +DATE_BIN +DATE_PART +DATE_TRUNC +ISFINITE +JUSTIFY_DAYS +JUSTIFY_HOURS +JUSTIFY_INTERVAL +MAKE_DATE +MAKE_INTERVAL +MAKE_TIME +MAKE_TIMESTAMP +MAKE_TIMESTAMPTZ +NOW +STATEMENT_TIMESTAMP +TIMEOFDAY +TRANSACTION_TIMESTAMP +TO_TIMESTAMP +TO_CHAR +TO_DATE +TO_NUMBER +ENCODE +DISTKEY +SORTKEY +CASE_SENSITIVE +CASE_INSENSITIVE +Identifier +IdentifierStartChar +IdentifierChar +StrictIdentifierChar +QuotedIdentifier +UnterminatedQuotedIdentifier +InvalidQuotedIdentifier +InvalidUnterminatedQuotedIdentifier +UnicodeQuotedIdentifier +UnterminatedUnicodeQuotedIdentifier +InvalidUnicodeQuotedIdentifier +InvalidUnterminatedUnicodeQuotedIdentifier +StringConstant +UnterminatedStringConstant +BeginEscapeStringConstant +UnicodeEscapeStringConstant +UnterminatedUnicodeEscapeStringConstant +BeginDollarStringConstant +Tag +BinaryStringConstant +UnterminatedBinaryStringConstant +InvalidBinaryStringConstant +InvalidUnterminatedBinaryStringConstant +HexadecimalStringConstant +UnterminatedHexadecimalStringConstant +InvalidHexadecimalStringConstant +InvalidUnterminatedHexadecimalStringConstant +Integral +NumericFail +Numeric +Digits +PLSQLVARIABLENAME +PLSQLIDENTIFIER +Whitespace +Newline +LineComment +BlockComment +UnterminatedBlockComment +MetaCommand +EndMetaCommand +ErrorCharacter +EscapeStringConstant +UnterminatedEscapeStringConstant +EscapeStringText +InvalidEscapeStringConstant +InvalidUnterminatedEscapeStringConstant +InvalidEscapeStringText +AfterEscapeStringConstantMode_Whitespace +AfterEscapeStringConstantMode_Newline +AfterEscapeStringConstantMode_NotContinued +AfterEscapeStringConstantWithNewlineMode_Whitespace +AfterEscapeStringConstantWithNewlineMode_Newline +AfterEscapeStringConstantWithNewlineMode_Continued +AfterEscapeStringConstantWithNewlineMode_NotContinued +DollarText +EndDollarStringConstant + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE +EscapeStringConstantMode +AfterEscapeStringConstantMode +AfterEscapeStringConstantWithNewlineMode +DollarQuotedStringMode + +atn: +[4, 0, 686, 6874, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, 2, 221, 7, 221, 2, 222, 7, 222, 2, 223, 7, 223, 2, 224, 7, 224, 2, 225, 7, 225, 2, 226, 7, 226, 2, 227, 7, 227, 2, 228, 7, 228, 2, 229, 7, 229, 2, 230, 7, 230, 2, 231, 7, 231, 2, 232, 7, 232, 2, 233, 7, 233, 2, 234, 7, 234, 2, 235, 7, 235, 2, 236, 7, 236, 2, 237, 7, 237, 2, 238, 7, 238, 2, 239, 7, 239, 2, 240, 7, 240, 2, 241, 7, 241, 2, 242, 7, 242, 2, 243, 7, 243, 2, 244, 7, 244, 2, 245, 7, 245, 2, 246, 7, 246, 2, 247, 7, 247, 2, 248, 7, 248, 2, 249, 7, 249, 2, 250, 7, 250, 2, 251, 7, 251, 2, 252, 7, 252, 2, 253, 7, 253, 2, 254, 7, 254, 2, 255, 7, 255, 2, 256, 7, 256, 2, 257, 7, 257, 2, 258, 7, 258, 2, 259, 7, 259, 2, 260, 7, 260, 2, 261, 7, 261, 2, 262, 7, 262, 2, 263, 7, 263, 2, 264, 7, 264, 2, 265, 7, 265, 2, 266, 7, 266, 2, 267, 7, 267, 2, 268, 7, 268, 2, 269, 7, 269, 2, 270, 7, 270, 2, 271, 7, 271, 2, 272, 7, 272, 2, 273, 7, 273, 2, 274, 7, 274, 2, 275, 7, 275, 2, 276, 7, 276, 2, 277, 7, 277, 2, 278, 7, 278, 2, 279, 7, 279, 2, 280, 7, 280, 2, 281, 7, 281, 2, 282, 7, 282, 2, 283, 7, 283, 2, 284, 7, 284, 2, 285, 7, 285, 2, 286, 7, 286, 2, 287, 7, 287, 2, 288, 7, 288, 2, 289, 7, 289, 2, 290, 7, 290, 2, 291, 7, 291, 2, 292, 7, 292, 2, 293, 7, 293, 2, 294, 7, 294, 2, 295, 7, 295, 2, 296, 7, 296, 2, 297, 7, 297, 2, 298, 7, 298, 2, 299, 7, 299, 2, 300, 7, 300, 2, 301, 7, 301, 2, 302, 7, 302, 2, 303, 7, 303, 2, 304, 7, 304, 2, 305, 7, 305, 2, 306, 7, 306, 2, 307, 7, 307, 2, 308, 7, 308, 2, 309, 7, 309, 2, 310, 7, 310, 2, 311, 7, 311, 2, 312, 7, 312, 2, 313, 7, 313, 2, 314, 7, 314, 2, 315, 7, 315, 2, 316, 7, 316, 2, 317, 7, 317, 2, 318, 7, 318, 2, 319, 7, 319, 2, 320, 7, 320, 2, 321, 7, 321, 2, 322, 7, 322, 2, 323, 7, 323, 2, 324, 7, 324, 2, 325, 7, 325, 2, 326, 7, 326, 2, 327, 7, 327, 2, 328, 7, 328, 2, 329, 7, 329, 2, 330, 7, 330, 2, 331, 7, 331, 2, 332, 7, 332, 2, 333, 7, 333, 2, 334, 7, 334, 2, 335, 7, 335, 2, 336, 7, 336, 2, 337, 7, 337, 2, 338, 7, 338, 2, 339, 7, 339, 2, 340, 7, 340, 2, 341, 7, 341, 2, 342, 7, 342, 2, 343, 7, 343, 2, 344, 7, 344, 2, 345, 7, 345, 2, 346, 7, 346, 2, 347, 7, 347, 2, 348, 7, 348, 2, 349, 7, 349, 2, 350, 7, 350, 2, 351, 7, 351, 2, 352, 7, 352, 2, 353, 7, 353, 2, 354, 7, 354, 2, 355, 7, 355, 2, 356, 7, 356, 2, 357, 7, 357, 2, 358, 7, 358, 2, 359, 7, 359, 2, 360, 7, 360, 2, 361, 7, 361, 2, 362, 7, 362, 2, 363, 7, 363, 2, 364, 7, 364, 2, 365, 7, 365, 2, 366, 7, 366, 2, 367, 7, 367, 2, 368, 7, 368, 2, 369, 7, 369, 2, 370, 7, 370, 2, 371, 7, 371, 2, 372, 7, 372, 2, 373, 7, 373, 2, 374, 7, 374, 2, 375, 7, 375, 2, 376, 7, 376, 2, 377, 7, 377, 2, 378, 7, 378, 2, 379, 7, 379, 2, 380, 7, 380, 2, 381, 7, 381, 2, 382, 7, 382, 2, 383, 7, 383, 2, 384, 7, 384, 2, 385, 7, 385, 2, 386, 7, 386, 2, 387, 7, 387, 2, 388, 7, 388, 2, 389, 7, 389, 2, 390, 7, 390, 2, 391, 7, 391, 2, 392, 7, 392, 2, 393, 7, 393, 2, 394, 7, 394, 2, 395, 7, 395, 2, 396, 7, 396, 2, 397, 7, 397, 2, 398, 7, 398, 2, 399, 7, 399, 2, 400, 7, 400, 2, 401, 7, 401, 2, 402, 7, 402, 2, 403, 7, 403, 2, 404, 7, 404, 2, 405, 7, 405, 2, 406, 7, 406, 2, 407, 7, 407, 2, 408, 7, 408, 2, 409, 7, 409, 2, 410, 7, 410, 2, 411, 7, 411, 2, 412, 7, 412, 2, 413, 7, 413, 2, 414, 7, 414, 2, 415, 7, 415, 2, 416, 7, 416, 2, 417, 7, 417, 2, 418, 7, 418, 2, 419, 7, 419, 2, 420, 7, 420, 2, 421, 7, 421, 2, 422, 7, 422, 2, 423, 7, 423, 2, 424, 7, 424, 2, 425, 7, 425, 2, 426, 7, 426, 2, 427, 7, 427, 2, 428, 7, 428, 2, 429, 7, 429, 2, 430, 7, 430, 2, 431, 7, 431, 2, 432, 7, 432, 2, 433, 7, 433, 2, 434, 7, 434, 2, 435, 7, 435, 2, 436, 7, 436, 2, 437, 7, 437, 2, 438, 7, 438, 2, 439, 7, 439, 2, 440, 7, 440, 2, 441, 7, 441, 2, 442, 7, 442, 2, 443, 7, 443, 2, 444, 7, 444, 2, 445, 7, 445, 2, 446, 7, 446, 2, 447, 7, 447, 2, 448, 7, 448, 2, 449, 7, 449, 2, 450, 7, 450, 2, 451, 7, 451, 2, 452, 7, 452, 2, 453, 7, 453, 2, 454, 7, 454, 2, 455, 7, 455, 2, 456, 7, 456, 2, 457, 7, 457, 2, 458, 7, 458, 2, 459, 7, 459, 2, 460, 7, 460, 2, 461, 7, 461, 2, 462, 7, 462, 2, 463, 7, 463, 2, 464, 7, 464, 2, 465, 7, 465, 2, 466, 7, 466, 2, 467, 7, 467, 2, 468, 7, 468, 2, 469, 7, 469, 2, 470, 7, 470, 2, 471, 7, 471, 2, 472, 7, 472, 2, 473, 7, 473, 2, 474, 7, 474, 2, 475, 7, 475, 2, 476, 7, 476, 2, 477, 7, 477, 2, 478, 7, 478, 2, 479, 7, 479, 2, 480, 7, 480, 2, 481, 7, 481, 2, 482, 7, 482, 2, 483, 7, 483, 2, 484, 7, 484, 2, 485, 7, 485, 2, 486, 7, 486, 2, 487, 7, 487, 2, 488, 7, 488, 2, 489, 7, 489, 2, 490, 7, 490, 2, 491, 7, 491, 2, 492, 7, 492, 2, 493, 7, 493, 2, 494, 7, 494, 2, 495, 7, 495, 2, 496, 7, 496, 2, 497, 7, 497, 2, 498, 7, 498, 2, 499, 7, 499, 2, 500, 7, 500, 2, 501, 7, 501, 2, 502, 7, 502, 2, 503, 7, 503, 2, 504, 7, 504, 2, 505, 7, 505, 2, 506, 7, 506, 2, 507, 7, 507, 2, 508, 7, 508, 2, 509, 7, 509, 2, 510, 7, 510, 2, 511, 7, 511, 2, 512, 7, 512, 2, 513, 7, 513, 2, 514, 7, 514, 2, 515, 7, 515, 2, 516, 7, 516, 2, 517, 7, 517, 2, 518, 7, 518, 2, 519, 7, 519, 2, 520, 7, 520, 2, 521, 7, 521, 2, 522, 7, 522, 2, 523, 7, 523, 2, 524, 7, 524, 2, 525, 7, 525, 2, 526, 7, 526, 2, 527, 7, 527, 2, 528, 7, 528, 2, 529, 7, 529, 2, 530, 7, 530, 2, 531, 7, 531, 2, 532, 7, 532, 2, 533, 7, 533, 2, 534, 7, 534, 2, 535, 7, 535, 2, 536, 7, 536, 2, 537, 7, 537, 2, 538, 7, 538, 2, 539, 7, 539, 2, 540, 7, 540, 2, 541, 7, 541, 2, 542, 7, 542, 2, 543, 7, 543, 2, 544, 7, 544, 2, 545, 7, 545, 2, 546, 7, 546, 2, 547, 7, 547, 2, 548, 7, 548, 2, 549, 7, 549, 2, 550, 7, 550, 2, 551, 7, 551, 2, 552, 7, 552, 2, 553, 7, 553, 2, 554, 7, 554, 2, 555, 7, 555, 2, 556, 7, 556, 2, 557, 7, 557, 2, 558, 7, 558, 2, 559, 7, 559, 2, 560, 7, 560, 2, 561, 7, 561, 2, 562, 7, 562, 2, 563, 7, 563, 2, 564, 7, 564, 2, 565, 7, 565, 2, 566, 7, 566, 2, 567, 7, 567, 2, 568, 7, 568, 2, 569, 7, 569, 2, 570, 7, 570, 2, 571, 7, 571, 2, 572, 7, 572, 2, 573, 7, 573, 2, 574, 7, 574, 2, 575, 7, 575, 2, 576, 7, 576, 2, 577, 7, 577, 2, 578, 7, 578, 2, 579, 7, 579, 2, 580, 7, 580, 2, 581, 7, 581, 2, 582, 7, 582, 2, 583, 7, 583, 2, 584, 7, 584, 2, 585, 7, 585, 2, 586, 7, 586, 2, 587, 7, 587, 2, 588, 7, 588, 2, 589, 7, 589, 2, 590, 7, 590, 2, 591, 7, 591, 2, 592, 7, 592, 2, 593, 7, 593, 2, 594, 7, 594, 2, 595, 7, 595, 2, 596, 7, 596, 2, 597, 7, 597, 2, 598, 7, 598, 2, 599, 7, 599, 2, 600, 7, 600, 2, 601, 7, 601, 2, 602, 7, 602, 2, 603, 7, 603, 2, 604, 7, 604, 2, 605, 7, 605, 2, 606, 7, 606, 2, 607, 7, 607, 2, 608, 7, 608, 2, 609, 7, 609, 2, 610, 7, 610, 2, 611, 7, 611, 2, 612, 7, 612, 2, 613, 7, 613, 2, 614, 7, 614, 2, 615, 7, 615, 2, 616, 7, 616, 2, 617, 7, 617, 2, 618, 7, 618, 2, 619, 7, 619, 2, 620, 7, 620, 2, 621, 7, 621, 2, 622, 7, 622, 2, 623, 7, 623, 2, 624, 7, 624, 2, 625, 7, 625, 2, 626, 7, 626, 2, 627, 7, 627, 2, 628, 7, 628, 2, 629, 7, 629, 2, 630, 7, 630, 2, 631, 7, 631, 2, 632, 7, 632, 2, 633, 7, 633, 2, 634, 7, 634, 2, 635, 7, 635, 2, 636, 7, 636, 2, 637, 7, 637, 2, 638, 7, 638, 2, 639, 7, 639, 2, 640, 7, 640, 2, 641, 7, 641, 2, 642, 7, 642, 2, 643, 7, 643, 2, 644, 7, 644, 2, 645, 7, 645, 2, 646, 7, 646, 2, 647, 7, 647, 2, 648, 7, 648, 2, 649, 7, 649, 2, 650, 7, 650, 2, 651, 7, 651, 2, 652, 7, 652, 2, 653, 7, 653, 2, 654, 7, 654, 2, 655, 7, 655, 2, 656, 7, 656, 2, 657, 7, 657, 2, 658, 7, 658, 2, 659, 7, 659, 2, 660, 7, 660, 2, 661, 7, 661, 2, 662, 7, 662, 2, 663, 7, 663, 2, 664, 7, 664, 2, 665, 7, 665, 2, 666, 7, 666, 2, 667, 7, 667, 2, 668, 7, 668, 2, 669, 7, 669, 2, 670, 7, 670, 2, 671, 7, 671, 2, 672, 7, 672, 2, 673, 7, 673, 2, 674, 7, 674, 2, 675, 7, 675, 2, 676, 7, 676, 2, 677, 7, 677, 2, 678, 7, 678, 2, 679, 7, 679, 2, 680, 7, 680, 2, 681, 7, 681, 2, 682, 7, 682, 2, 683, 7, 683, 2, 684, 7, 684, 2, 685, 7, 685, 2, 686, 7, 686, 2, 687, 7, 687, 2, 688, 7, 688, 2, 689, 7, 689, 2, 690, 7, 690, 2, 691, 7, 691, 2, 692, 7, 692, 2, 693, 7, 693, 2, 694, 7, 694, 2, 695, 7, 695, 2, 696, 7, 696, 2, 697, 7, 697, 2, 698, 7, 698, 2, 699, 7, 699, 2, 700, 7, 700, 2, 701, 7, 701, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 4, 27, 1475, 8, 27, 11, 27, 12, 27, 1476, 1, 28, 1, 28, 1, 28, 1, 28, 4, 28, 1483, 8, 28, 11, 28, 12, 28, 1484, 1, 28, 1, 28, 1, 28, 3, 28, 1490, 8, 28, 1, 28, 1, 28, 4, 28, 1494, 8, 28, 11, 28, 12, 28, 1495, 1, 28, 3, 28, 1499, 8, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 5, 29, 1508, 8, 29, 10, 29, 12, 29, 1511, 9, 29, 1, 29, 1, 29, 3, 29, 1515, 8, 29, 1, 29, 1, 29, 1, 29, 4, 29, 1520, 8, 29, 11, 29, 12, 29, 1521, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 106, 1, 106, 1, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 179, 1, 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 190, 1, 190, 1, 190, 1, 190, 1, 190, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 200, 1, 200, 1, 200, 1, 200, 1, 200, 1, 200, 1, 200, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 206, 1, 206, 1, 206, 1, 206, 1, 206, 1, 206, 1, 206, 1, 206, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 209, 1, 209, 1, 209, 1, 209, 1, 209, 1, 209, 1, 209, 1, 210, 1, 210, 1, 210, 1, 210, 1, 210, 1, 210, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 212, 1, 212, 1, 212, 1, 212, 1, 212, 1, 212, 1, 213, 1, 213, 1, 213, 1, 213, 1, 213, 1, 213, 1, 213, 1, 213, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 216, 1, 216, 1, 216, 1, 216, 1, 216, 1, 216, 1, 216, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 218, 1, 218, 1, 218, 1, 218, 1, 218, 1, 218, 1, 218, 1, 218, 1, 219, 1, 219, 1, 219, 1, 219, 1, 219, 1, 219, 1, 219, 1, 220, 1, 220, 1, 220, 1, 220, 1, 220, 1, 221, 1, 221, 1, 221, 1, 221, 1, 221, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 223, 1, 223, 1, 223, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 229, 1, 229, 1, 229, 1, 229, 1, 229, 1, 229, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 233, 1, 233, 1, 233, 1, 233, 1, 233, 1, 233, 1, 233, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 236, 1, 236, 1, 236, 1, 236, 1, 236, 1, 236, 1, 236, 1, 236, 1, 237, 1, 237, 1, 237, 1, 237, 1, 237, 1, 237, 1, 237, 1, 237, 1, 238, 1, 238, 1, 238, 1, 238, 1, 238, 1, 238, 1, 238, 1, 238, 1, 238, 1, 238, 1, 239, 1, 239, 1, 239, 1, 239, 1, 240, 1, 240, 1, 240, 1, 240, 1, 240, 1, 240, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 242, 1, 242, 1, 242, 1, 242, 1, 242, 1, 242, 1, 243, 1, 243, 1, 243, 1, 243, 1, 243, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 246, 1, 246, 1, 246, 1, 246, 1, 246, 1, 246, 1, 246, 1, 247, 1, 247, 1, 247, 1, 247, 1, 247, 1, 248, 1, 248, 1, 248, 1, 248, 1, 248, 1, 248, 1, 249, 1, 249, 1, 249, 1, 249, 1, 249, 1, 249, 1, 249, 1, 249, 1, 249, 1, 250, 1, 250, 1, 250, 1, 250, 1, 250, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 252, 1, 252, 1, 252, 1, 252, 1, 252, 1, 252, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 256, 1, 256, 1, 256, 1, 256, 1, 256, 1, 256, 1, 257, 1, 257, 1, 257, 1, 257, 1, 257, 1, 257, 1, 257, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 260, 1, 260, 1, 260, 1, 260, 1, 260, 1, 260, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 1, 262, 1, 262, 1, 262, 1, 262, 1, 262, 1, 263, 1, 263, 1, 263, 1, 263, 1, 263, 1, 263, 1, 264, 1, 264, 1, 264, 1, 264, 1, 264, 1, 265, 1, 265, 1, 265, 1, 266, 1, 266, 1, 266, 1, 266, 1, 266, 1, 266, 1, 266, 1, 266, 1, 267, 1, 267, 1, 267, 1, 267, 1, 267, 1, 267, 1, 267, 1, 268, 1, 268, 1, 268, 1, 268, 1, 268, 1, 268, 1, 268, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 270, 1, 270, 1, 270, 1, 270, 1, 270, 1, 270, 1, 270, 1, 271, 1, 271, 1, 271, 1, 272, 1, 272, 1, 272, 1, 272, 1, 273, 1, 273, 1, 273, 1, 273, 1, 273, 1, 274, 1, 274, 1, 274, 1, 274, 1, 274, 1, 274, 1, 274, 1, 274, 1, 274, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 276, 1, 276, 1, 276, 1, 276, 1, 276, 1, 276, 1, 276, 1, 276, 1, 277, 1, 277, 1, 277, 1, 277, 1, 277, 1, 277, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 281, 1, 281, 1, 281, 1, 281, 1, 281, 1, 281, 1, 281, 1, 281, 1, 281, 1, 281, 1, 282, 1, 282, 1, 282, 1, 282, 1, 282, 1, 282, 1, 282, 1, 282, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 284, 1, 284, 1, 284, 1, 284, 1, 284, 1, 284, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 286, 1, 286, 1, 286, 1, 286, 1, 286, 1, 286, 1, 286, 1, 286, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, 289, 1, 289, 1, 289, 1, 289, 1, 289, 1, 289, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, 1, 294, 1, 294, 1, 294, 1, 294, 1, 294, 1, 294, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, 298, 1, 298, 1, 298, 1, 298, 1, 298, 1, 298, 1, 298, 1, 298, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 300, 1, 300, 1, 300, 1, 300, 1, 301, 1, 301, 1, 301, 1, 301, 1, 301, 1, 301, 1, 301, 1, 301, 1, 302, 1, 302, 1, 302, 1, 302, 1, 302, 1, 302, 1, 302, 1, 302, 1, 303, 1, 303, 1, 303, 1, 303, 1, 303, 1, 303, 1, 303, 1, 303, 1, 303, 1, 304, 1, 304, 1, 304, 1, 304, 1, 304, 1, 304, 1, 304, 1, 304, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 307, 1, 307, 1, 307, 1, 307, 1, 307, 1, 307, 1, 307, 1, 307, 1, 308, 1, 308, 1, 308, 1, 308, 1, 308, 1, 308, 1, 308, 1, 308, 1, 309, 1, 309, 1, 309, 1, 309, 1, 309, 1, 309, 1, 310, 1, 310, 1, 310, 1, 310, 1, 310, 1, 310, 1, 310, 1, 310, 1, 311, 1, 311, 1, 311, 1, 311, 1, 311, 1, 311, 1, 311, 1, 311, 1, 311, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 313, 1, 313, 1, 313, 1, 313, 1, 313, 1, 313, 1, 313, 1, 314, 1, 314, 1, 314, 1, 314, 1, 314, 1, 315, 1, 315, 1, 315, 1, 315, 1, 315, 1, 315, 1, 315, 1, 315, 1, 315, 1, 316, 1, 316, 1, 316, 1, 316, 1, 316, 1, 317, 1, 317, 1, 317, 1, 317, 1, 317, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 319, 1, 319, 1, 319, 1, 319, 1, 319, 1, 319, 1, 319, 1, 320, 1, 320, 1, 320, 1, 320, 1, 320, 1, 320, 1, 320, 1, 321, 1, 321, 1, 321, 1, 321, 1, 321, 1, 321, 1, 321, 1, 322, 1, 322, 1, 322, 1, 322, 1, 322, 1, 322, 1, 322, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 328, 1, 328, 1, 328, 1, 328, 1, 328, 1, 328, 1, 328, 1, 328, 1, 329, 1, 329, 1, 329, 1, 329, 1, 330, 1, 330, 1, 330, 1, 330, 1, 330, 1, 330, 1, 331, 1, 331, 1, 331, 1, 331, 1, 331, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 334, 1, 334, 1, 334, 1, 334, 1, 334, 1, 334, 1, 334, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 336, 1, 336, 1, 336, 1, 336, 1, 336, 1, 336, 1, 337, 1, 337, 1, 337, 1, 337, 1, 337, 1, 337, 1, 337, 1, 337, 1, 337, 1, 337, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 339, 1, 339, 1, 339, 1, 339, 1, 339, 1, 339, 1, 340, 1, 340, 1, 340, 1, 340, 1, 340, 1, 340, 1, 340, 1, 341, 1, 341, 1, 341, 1, 341, 1, 341, 1, 341, 1, 341, 1, 341, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 343, 1, 343, 1, 343, 1, 343, 1, 343, 1, 343, 1, 344, 1, 344, 1, 344, 1, 344, 1, 344, 1, 344, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 346, 1, 346, 1, 346, 1, 346, 1, 346, 1, 346, 1, 346, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 348, 1, 348, 1, 348, 1, 348, 1, 348, 1, 349, 1, 349, 1, 349, 1, 349, 1, 349, 1, 349, 1, 349, 1, 349, 1, 349, 1, 350, 1, 350, 1, 350, 1, 350, 1, 350, 1, 350, 1, 350, 1, 350, 1, 350, 1, 350, 1, 351, 1, 351, 1, 351, 1, 351, 1, 351, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 353, 1, 353, 1, 353, 1, 353, 1, 353, 1, 353, 1, 353, 1, 353, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 355, 1, 355, 1, 355, 1, 355, 1, 355, 1, 355, 1, 355, 1, 355, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 361, 1, 361, 1, 361, 1, 361, 1, 361, 1, 361, 1, 361, 1, 361, 1, 362, 1, 362, 1, 362, 1, 362, 1, 362, 1, 362, 1, 362, 1, 362, 1, 362, 1, 363, 1, 363, 1, 363, 1, 363, 1, 363, 1, 363, 1, 363, 1, 363, 1, 363, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 366, 1, 366, 1, 366, 1, 366, 1, 366, 1, 366, 1, 366, 1, 367, 1, 367, 1, 367, 1, 367, 1, 367, 1, 367, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 372, 1, 372, 1, 372, 1, 372, 1, 372, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 378, 1, 378, 1, 378, 1, 378, 1, 378, 1, 378, 1, 379, 1, 379, 1, 379, 1, 379, 1, 380, 1, 380, 1, 380, 1, 380, 1, 380, 1, 381, 1, 381, 1, 381, 1, 381, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 1, 383, 1, 383, 1, 383, 1, 383, 1, 383, 1, 383, 1, 383, 1, 384, 1, 384, 1, 384, 1, 384, 1, 384, 1, 384, 1, 384, 1, 384, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 386, 1, 386, 1, 386, 1, 386, 1, 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 388, 1, 388, 1, 388, 1, 388, 1, 388, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 1, 391, 1, 391, 1, 391, 1, 391, 1, 392, 1, 392, 1, 392, 1, 392, 1, 392, 1, 392, 1, 392, 1, 392, 1, 393, 1, 393, 1, 393, 1, 393, 1, 393, 1, 393, 1, 393, 1, 394, 1, 394, 1, 394, 1, 394, 1, 394, 1, 394, 1, 394, 1, 394, 1, 395, 1, 395, 1, 395, 1, 395, 1, 395, 1, 395, 1, 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 397, 1, 397, 1, 397, 1, 397, 1, 397, 1, 397, 1, 398, 1, 398, 1, 398, 1, 398, 1, 399, 1, 399, 1, 399, 1, 399, 1, 399, 1, 399, 1, 399, 1, 399, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 401, 1, 401, 1, 401, 1, 401, 1, 401, 1, 401, 1, 402, 1, 402, 1, 402, 1, 402, 1, 402, 1, 402, 1, 402, 1, 402, 1, 402, 1, 403, 1, 403, 1, 403, 1, 403, 1, 403, 1, 403, 1, 404, 1, 404, 1, 404, 1, 404, 1, 404, 1, 405, 1, 405, 1, 405, 1, 405, 1, 405, 1, 405, 1, 405, 1, 406, 1, 406, 1, 406, 1, 406, 1, 406, 1, 406, 1, 406, 1, 406, 1, 407, 1, 407, 1, 407, 1, 407, 1, 407, 1, 407, 1, 407, 1, 407, 1, 408, 1, 408, 1, 408, 1, 408, 1, 408, 1, 408, 1, 408, 1, 408, 1, 408, 1, 408, 1, 409, 1, 409, 1, 409, 1, 409, 1, 409, 1, 409, 1, 409, 1, 409, 1, 409, 1, 410, 1, 410, 1, 410, 1, 410, 1, 410, 1, 410, 1, 410, 1, 410, 1, 410, 1, 410, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, 1, 412, 1, 412, 1, 412, 1, 412, 1, 413, 1, 413, 1, 413, 1, 413, 1, 413, 1, 413, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, 416, 1, 416, 1, 416, 1, 416, 1, 416, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 418, 1, 418, 1, 418, 1, 418, 1, 418, 1, 418, 1, 419, 1, 419, 1, 419, 1, 419, 1, 419, 1, 420, 1, 420, 1, 420, 1, 420, 1, 420, 1, 420, 1, 420, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 428, 1, 428, 1, 428, 1, 428, 1, 428, 1, 428, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, 434, 1, 434, 1, 434, 1, 434, 1, 434, 1, 434, 1, 434, 1, 434, 1, 434, 1, 435, 1, 435, 1, 435, 1, 435, 1, 435, 1, 435, 1, 436, 1, 436, 1, 436, 1, 436, 1, 436, 1, 436, 1, 436, 1, 436, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 438, 1, 438, 1, 438, 1, 438, 1, 438, 1, 439, 1, 439, 1, 439, 1, 439, 1, 439, 1, 439, 1, 439, 1, 439, 1, 440, 1, 440, 1, 440, 1, 440, 1, 440, 1, 440, 1, 440, 1, 441, 1, 441, 1, 441, 1, 441, 1, 441, 1, 441, 1, 441, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 443, 1, 443, 1, 443, 1, 443, 1, 443, 1, 443, 1, 443, 1, 443, 1, 443, 1, 443, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 446, 1, 446, 1, 446, 1, 446, 1, 446, 1, 446, 1, 446, 1, 446, 1, 447, 1, 447, 1, 447, 1, 447, 1, 447, 1, 447, 1, 447, 1, 447, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 449, 1, 449, 1, 449, 1, 449, 1, 449, 1, 449, 1, 449, 1, 450, 1, 450, 1, 450, 1, 450, 1, 450, 1, 450, 1, 450, 1, 451, 1, 451, 1, 451, 1, 451, 1, 451, 1, 451, 1, 451, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 453, 1, 453, 1, 453, 1, 453, 1, 454, 1, 454, 1, 454, 1, 454, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 458, 1, 458, 1, 458, 1, 458, 1, 459, 1, 459, 1, 459, 1, 459, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 461, 1, 461, 1, 461, 1, 461, 1, 461, 1, 461, 1, 461, 1, 461, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 463, 1, 463, 1, 463, 1, 463, 1, 463, 1, 463, 1, 464, 1, 464, 1, 464, 1, 464, 1, 464, 1, 464, 1, 464, 1, 464, 1, 465, 1, 465, 1, 465, 1, 465, 1, 465, 1, 465, 1, 465, 1, 465, 1, 465, 1, 466, 1, 466, 1, 466, 1, 466, 1, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 469, 1, 469, 1, 469, 1, 469, 1, 469, 1, 469, 1, 469, 1, 469, 1, 469, 1, 470, 1, 470, 1, 470, 1, 470, 1, 470, 1, 471, 1, 471, 1, 471, 1, 471, 1, 471, 1, 471, 1, 471, 1, 472, 1, 472, 1, 472, 1, 472, 1, 472, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 474, 1, 474, 1, 474, 1, 474, 1, 474, 1, 475, 1, 475, 1, 475, 1, 475, 1, 475, 1, 475, 1, 475, 1, 475, 1, 475, 1, 476, 1, 476, 1, 476, 1, 476, 1, 476, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 479, 1, 479, 1, 479, 1, 479, 1, 479, 1, 479, 1, 479, 1, 479, 1, 479, 1, 480, 1, 480, 1, 480, 1, 480, 1, 480, 1, 480, 1, 480, 1, 480, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 482, 1, 482, 1, 482, 1, 482, 1, 482, 1, 482, 1, 482, 1, 482, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 484, 1, 484, 1, 484, 1, 484, 1, 484, 1, 484, 1, 484, 1, 485, 1, 485, 1, 485, 1, 485, 1, 485, 1, 485, 1, 485, 1, 486, 1, 486, 1, 486, 1, 486, 1, 486, 1, 486, 1, 486, 1, 487, 1, 487, 1, 487, 1, 487, 1, 487, 1, 487, 1, 487, 1, 488, 1, 488, 1, 488, 1, 488, 1, 489, 1, 489, 1, 489, 1, 489, 1, 490, 1, 490, 1, 490, 1, 490, 1, 490, 1, 491, 1, 491, 1, 491, 1, 491, 1, 491, 1, 492, 1, 492, 1, 492, 1, 492, 1, 492, 1, 492, 1, 492, 1, 492, 1, 493, 1, 493, 1, 493, 1, 493, 1, 493, 1, 493, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 495, 1, 495, 1, 495, 1, 495, 1, 495, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 498, 1, 498, 1, 498, 1, 498, 1, 498, 1, 498, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 501, 1, 501, 1, 501, 1, 501, 1, 501, 1, 501, 1, 502, 1, 502, 1, 502, 1, 502, 1, 502, 1, 502, 1, 502, 1, 502, 1, 502, 1, 503, 1, 503, 1, 503, 1, 503, 1, 503, 1, 503, 1, 503, 1, 503, 1, 504, 1, 504, 1, 504, 1, 504, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 506, 1, 506, 1, 506, 1, 506, 1, 506, 1, 506, 1, 506, 1, 506, 1, 507, 1, 507, 1, 507, 1, 507, 1, 507, 1, 507, 1, 508, 1, 508, 1, 508, 1, 508, 1, 508, 1, 508, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 510, 1, 510, 1, 510, 1, 510, 1, 510, 1, 510, 1, 510, 1, 510, 1, 511, 1, 511, 1, 511, 1, 511, 1, 511, 1, 511, 1, 512, 1, 512, 1, 512, 1, 512, 1, 512, 1, 513, 1, 513, 1, 513, 1, 513, 1, 513, 1, 513, 1, 513, 1, 514, 1, 514, 1, 514, 1, 514, 1, 514, 1, 514, 1, 515, 1, 515, 1, 515, 1, 515, 1, 515, 1, 515, 1, 516, 1, 516, 1, 516, 1, 516, 1, 516, 1, 516, 1, 516, 1, 516, 1, 516, 1, 517, 1, 517, 1, 517, 1, 517, 1, 517, 1, 517, 1, 518, 1, 518, 1, 518, 1, 518, 1, 519, 1, 519, 1, 519, 1, 519, 1, 519, 1, 520, 1, 520, 1, 520, 1, 520, 1, 520, 1, 520, 1, 520, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 523, 1, 523, 1, 523, 1, 523, 1, 523, 1, 523, 1, 523, 1, 524, 1, 524, 1, 524, 1, 524, 1, 524, 1, 525, 1, 525, 1, 525, 1, 525, 1, 525, 1, 526, 1, 526, 1, 526, 1, 526, 1, 527, 1, 527, 1, 527, 1, 527, 1, 527, 1, 528, 1, 528, 1, 528, 1, 528, 1, 528, 1, 529, 1, 529, 1, 529, 1, 529, 1, 529, 1, 529, 1, 529, 1, 529, 1, 530, 1, 530, 1, 530, 1, 530, 1, 530, 1, 530, 1, 530, 1, 530, 1, 531, 1, 531, 1, 531, 1, 531, 1, 532, 1, 532, 1, 532, 1, 532, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 1, 535, 1, 535, 1, 535, 1, 535, 1, 536, 1, 536, 1, 536, 1, 536, 1, 537, 1, 537, 1, 537, 1, 538, 1, 538, 1, 538, 1, 538, 1, 538, 1, 538, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 540, 1, 540, 1, 540, 1, 540, 1, 541, 1, 541, 1, 541, 1, 542, 1, 542, 1, 542, 1, 542, 1, 542, 1, 542, 1, 543, 1, 543, 1, 543, 1, 543, 1, 543, 1, 543, 1, 543, 1, 543, 1, 544, 1, 544, 1, 544, 1, 544, 1, 544, 1, 544, 1, 545, 1, 545, 1, 545, 1, 545, 1, 545, 1, 545, 1, 546, 1, 546, 1, 546, 1, 546, 1, 546, 1, 547, 1, 547, 1, 547, 1, 547, 1, 547, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 549, 1, 549, 1, 549, 1, 549, 1, 549, 1, 549, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 551, 1, 551, 1, 551, 1, 551, 1, 551, 1, 551, 1, 551, 1, 552, 1, 552, 1, 552, 1, 552, 1, 552, 1, 552, 1, 552, 1, 552, 1, 553, 1, 553, 1, 553, 1, 553, 1, 553, 1, 554, 1, 554, 1, 554, 1, 554, 1, 554, 1, 554, 1, 555, 1, 555, 1, 555, 1, 555, 1, 555, 1, 556, 1, 556, 1, 556, 1, 556, 1, 556, 1, 556, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 558, 1, 558, 1, 558, 1, 558, 1, 558, 1, 558, 1, 559, 1, 559, 1, 559, 1, 559, 1, 559, 1, 559, 1, 560, 1, 560, 1, 560, 1, 560, 1, 560, 1, 560, 1, 560, 1, 561, 1, 561, 1, 561, 1, 561, 1, 562, 1, 562, 1, 562, 1, 562, 1, 562, 1, 563, 1, 563, 1, 563, 1, 563, 1, 564, 1, 564, 1, 564, 1, 564, 1, 564, 1, 565, 1, 565, 1, 565, 1, 565, 1, 566, 1, 566, 1, 566, 1, 566, 1, 566, 1, 567, 1, 567, 1, 567, 1, 567, 1, 568, 1, 568, 1, 568, 1, 568, 1, 568, 1, 569, 1, 569, 1, 569, 1, 569, 1, 569, 1, 570, 1, 570, 1, 570, 1, 570, 1, 570, 1, 571, 1, 571, 1, 571, 1, 571, 1, 571, 1, 572, 1, 572, 1, 572, 1, 572, 1, 572, 1, 572, 1, 573, 1, 573, 1, 573, 1, 573, 1, 573, 1, 573, 1, 574, 1, 574, 1, 574, 1, 574, 1, 574, 1, 574, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 578, 1, 578, 1, 578, 1, 578, 1, 578, 1, 578, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 580, 1, 580, 1, 580, 1, 580, 1, 580, 1, 580, 1, 581, 1, 581, 1, 581, 1, 581, 1, 581, 1, 581, 1, 582, 1, 582, 1, 582, 1, 582, 1, 582, 1, 582, 1, 583, 1, 583, 1, 583, 1, 583, 1, 584, 1, 584, 1, 584, 1, 584, 1, 584, 1, 584, 1, 584, 1, 585, 1, 585, 1, 585, 1, 585, 1, 585, 1, 585, 1, 585, 1, 585, 1, 585, 1, 585, 1, 586, 1, 586, 1, 586, 1, 586, 1, 586, 1, 586, 1, 586, 1, 587, 1, 587, 1, 587, 1, 587, 1, 587, 1, 587, 1, 587, 1, 587, 1, 588, 1, 588, 1, 588, 1, 588, 1, 588, 1, 588, 1, 588, 1, 589, 1, 589, 1, 589, 1, 589, 1, 589, 1, 590, 1, 590, 1, 590, 1, 590, 1, 590, 1, 590, 1, 591, 1, 591, 1, 591, 1, 591, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 606, 1, 606, 1, 606, 1, 606, 1, 606, 1, 606, 1, 606, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 614, 1, 614, 1, 614, 1, 614, 1, 614, 1, 614, 1, 614, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 616, 1, 616, 1, 616, 1, 616, 1, 616, 1, 616, 1, 616, 1, 617, 1, 617, 1, 617, 1, 617, 1, 617, 1, 617, 1, 617, 1, 617, 1, 617, 1, 617, 1, 618, 1, 618, 1, 618, 1, 618, 1, 618, 1, 618, 1, 618, 1, 619, 1, 619, 1, 619, 1, 619, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 622, 1, 622, 1, 622, 1, 622, 1, 622, 1, 622, 1, 622, 1, 622, 1, 622, 1, 622, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 630, 1, 630, 1, 630, 1, 630, 1, 630, 1, 630, 1, 630, 1, 630, 1, 630, 1, 630, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 633, 1, 633, 1, 633, 1, 633, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 638, 1, 638, 1, 638, 1, 638, 1, 638, 1, 638, 1, 638, 1, 638, 1, 639, 1, 639, 1, 639, 1, 639, 1, 639, 1, 639, 1, 639, 1, 639, 1, 640, 1, 640, 1, 640, 1, 640, 1, 640, 1, 640, 1, 640, 1, 640, 1, 640, 1, 640, 1, 641, 1, 641, 1, 641, 1, 641, 1, 641, 1, 641, 1, 641, 1, 642, 1, 642, 1, 642, 1, 642, 1, 642, 1, 642, 1, 642, 1, 642, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 646, 1, 646, 5, 646, 6409, 8, 646, 10, 646, 12, 646, 6412, 9, 646, 1, 647, 1, 647, 1, 647, 1, 647, 1, 647, 1, 647, 3, 647, 6420, 8, 647, 1, 648, 1, 648, 3, 648, 6424, 8, 648, 1, 649, 1, 649, 3, 649, 6428, 8, 649, 1, 650, 1, 650, 1, 650, 1, 651, 1, 651, 1, 651, 1, 651, 5, 651, 6437, 8, 651, 10, 651, 12, 651, 6440, 9, 651, 1, 652, 1, 652, 1, 652, 1, 653, 1, 653, 1, 653, 1, 653, 5, 653, 6449, 8, 653, 10, 653, 12, 653, 6452, 9, 653, 1, 654, 1, 654, 1, 654, 1, 654, 1, 655, 1, 655, 1, 655, 1, 655, 1, 656, 1, 656, 1, 656, 1, 656, 1, 657, 1, 657, 1, 657, 1, 657, 1, 658, 1, 658, 1, 658, 1, 659, 1, 659, 1, 659, 1, 659, 5, 659, 6477, 8, 659, 10, 659, 12, 659, 6480, 9, 659, 1, 660, 1, 660, 1, 660, 1, 660, 1, 660, 1, 660, 1, 661, 1, 661, 1, 661, 1, 662, 1, 662, 1, 662, 1, 662, 1, 663, 1, 663, 3, 663, 6497, 8, 663, 1, 663, 1, 663, 1, 663, 1, 663, 1, 663, 1, 664, 1, 664, 5, 664, 6506, 8, 664, 10, 664, 12, 664, 6509, 9, 664, 1, 665, 1, 665, 1, 665, 1, 666, 1, 666, 1, 666, 5, 666, 6517, 8, 666, 10, 666, 12, 666, 6520, 9, 666, 1, 667, 1, 667, 1, 667, 1, 668, 1, 668, 1, 668, 1, 669, 1, 669, 1, 669, 1, 670, 1, 670, 1, 670, 5, 670, 6534, 8, 670, 10, 670, 12, 670, 6537, 9, 670, 1, 671, 1, 671, 1, 671, 1, 672, 1, 672, 1, 672, 1, 673, 1, 673, 1, 674, 1, 674, 1, 674, 1, 674, 1, 674, 1, 674, 1, 675, 1, 675, 1, 675, 3, 675, 6556, 8, 675, 1, 675, 1, 675, 3, 675, 6560, 8, 675, 1, 675, 3, 675, 6563, 8, 675, 1, 675, 1, 675, 1, 675, 1, 675, 3, 675, 6569, 8, 675, 1, 675, 3, 675, 6572, 8, 675, 1, 675, 1, 675, 1, 675, 3, 675, 6577, 8, 675, 1, 675, 1, 675, 3, 675, 6581, 8, 675, 1, 676, 4, 676, 6584, 8, 676, 11, 676, 12, 676, 6585, 1, 677, 1, 677, 1, 677, 5, 677, 6591, 8, 677, 10, 677, 12, 677, 6594, 9, 677, 1, 678, 1, 678, 1, 678, 1, 678, 1, 678, 1, 678, 1, 678, 1, 678, 5, 678, 6604, 8, 678, 10, 678, 12, 678, 6607, 9, 678, 1, 678, 1, 678, 1, 679, 1, 679, 1, 679, 1, 679, 1, 680, 1, 680, 3, 680, 6617, 8, 680, 1, 680, 3, 680, 6620, 8, 680, 1, 680, 1, 680, 1, 681, 1, 681, 1, 681, 1, 681, 5, 681, 6628, 8, 681, 10, 681, 12, 681, 6631, 9, 681, 1, 681, 1, 681, 1, 682, 1, 682, 1, 682, 1, 682, 5, 682, 6639, 8, 682, 10, 682, 12, 682, 6642, 9, 682, 1, 682, 1, 682, 1, 682, 4, 682, 6647, 8, 682, 11, 682, 12, 682, 6648, 1, 682, 1, 682, 4, 682, 6653, 8, 682, 11, 682, 12, 682, 6654, 1, 682, 5, 682, 6658, 8, 682, 10, 682, 12, 682, 6661, 9, 682, 1, 682, 5, 682, 6664, 8, 682, 10, 682, 12, 682, 6667, 9, 682, 1, 682, 1, 682, 1, 682, 1, 682, 1, 682, 1, 683, 1, 683, 1, 683, 1, 683, 5, 683, 6678, 8, 683, 10, 683, 12, 683, 6681, 9, 683, 1, 683, 1, 683, 1, 683, 4, 683, 6686, 8, 683, 11, 683, 12, 683, 6687, 1, 683, 1, 683, 4, 683, 6692, 8, 683, 11, 683, 12, 683, 6693, 1, 683, 3, 683, 6697, 8, 683, 5, 683, 6699, 8, 683, 10, 683, 12, 683, 6702, 9, 683, 1, 683, 4, 683, 6705, 8, 683, 11, 683, 12, 683, 6706, 1, 683, 4, 683, 6710, 8, 683, 11, 683, 12, 683, 6711, 1, 683, 5, 683, 6715, 8, 683, 10, 683, 12, 683, 6718, 9, 683, 1, 683, 3, 683, 6721, 8, 683, 1, 683, 1, 683, 1, 684, 1, 684, 1, 684, 1, 684, 5, 684, 6729, 8, 684, 10, 684, 12, 684, 6732, 9, 684, 1, 684, 5, 684, 6735, 8, 684, 10, 684, 12, 684, 6738, 9, 684, 1, 684, 1, 684, 5, 684, 6742, 8, 684, 10, 684, 12, 684, 6745, 9, 684, 3, 684, 6747, 8, 684, 1, 685, 1, 685, 1, 685, 1, 686, 1, 686, 1, 687, 1, 687, 1, 687, 1, 687, 1, 687, 1, 688, 1, 688, 3, 688, 6761, 8, 688, 1, 688, 1, 688, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 3, 689, 6785, 8, 689, 1, 689, 5, 689, 6788, 8, 689, 10, 689, 12, 689, 6791, 9, 689, 1, 690, 1, 690, 1, 690, 1, 690, 1, 690, 1, 691, 1, 691, 3, 691, 6800, 8, 691, 1, 691, 1, 691, 1, 692, 1, 692, 1, 692, 1, 692, 1, 692, 5, 692, 6809, 8, 692, 10, 692, 12, 692, 6812, 9, 692, 1, 693, 1, 693, 1, 693, 1, 693, 1, 693, 1, 694, 1, 694, 1, 694, 1, 694, 1, 694, 1, 694, 1, 695, 1, 695, 1, 695, 1, 695, 1, 695, 1, 696, 1, 696, 1, 696, 1, 696, 1, 696, 1, 697, 1, 697, 1, 697, 1, 697, 1, 697, 1, 698, 1, 698, 1, 698, 1, 698, 1, 698, 1, 699, 1, 699, 1, 699, 1, 699, 1, 699, 1, 700, 4, 700, 6851, 8, 700, 11, 700, 12, 700, 6852, 1, 700, 1, 700, 5, 700, 6857, 8, 700, 10, 700, 12, 700, 6860, 9, 700, 3, 700, 6862, 8, 700, 1, 701, 1, 701, 3, 701, 6866, 8, 701, 1, 701, 1, 701, 1, 701, 1, 701, 1, 701, 1, 701, 1, 701, 0, 0, 702, 5, 1, 7, 2, 9, 3, 11, 4, 13, 5, 15, 6, 17, 7, 19, 8, 21, 9, 23, 10, 25, 11, 27, 12, 29, 13, 31, 14, 33, 15, 35, 16, 37, 17, 39, 18, 41, 19, 43, 20, 45, 21, 47, 22, 49, 23, 51, 24, 53, 25, 55, 26, 57, 27, 59, 28, 61, 29, 63, 0, 65, 0, 67, 0, 69, 0, 71, 30, 73, 31, 75, 32, 77, 33, 79, 34, 81, 35, 83, 36, 85, 37, 87, 38, 89, 39, 91, 40, 93, 41, 95, 42, 97, 43, 99, 44, 101, 45, 103, 46, 105, 47, 107, 48, 109, 49, 111, 50, 113, 51, 115, 52, 117, 53, 119, 54, 121, 55, 123, 56, 125, 57, 127, 58, 129, 59, 131, 60, 133, 61, 135, 62, 137, 63, 139, 64, 141, 65, 143, 66, 145, 67, 147, 68, 149, 69, 151, 70, 153, 71, 155, 72, 157, 73, 159, 74, 161, 75, 163, 76, 165, 77, 167, 78, 169, 79, 171, 80, 173, 81, 175, 82, 177, 83, 179, 84, 181, 85, 183, 86, 185, 87, 187, 88, 189, 89, 191, 90, 193, 91, 195, 92, 197, 93, 199, 94, 201, 95, 203, 96, 205, 97, 207, 98, 209, 99, 211, 100, 213, 101, 215, 102, 217, 103, 219, 104, 221, 105, 223, 106, 225, 107, 227, 108, 229, 109, 231, 110, 233, 111, 235, 112, 237, 113, 239, 114, 241, 115, 243, 116, 245, 117, 247, 118, 249, 119, 251, 120, 253, 121, 255, 122, 257, 123, 259, 124, 261, 125, 263, 126, 265, 127, 267, 128, 269, 129, 271, 130, 273, 131, 275, 132, 277, 133, 279, 134, 281, 135, 283, 136, 285, 137, 287, 138, 289, 139, 291, 140, 293, 141, 295, 142, 297, 143, 299, 144, 301, 145, 303, 146, 305, 147, 307, 148, 309, 149, 311, 150, 313, 151, 315, 152, 317, 153, 319, 154, 321, 155, 323, 156, 325, 157, 327, 158, 329, 159, 331, 160, 333, 161, 335, 162, 337, 163, 339, 164, 341, 165, 343, 166, 345, 167, 347, 168, 349, 169, 351, 170, 353, 171, 355, 172, 357, 173, 359, 174, 361, 175, 363, 176, 365, 177, 367, 178, 369, 179, 371, 180, 373, 181, 375, 182, 377, 183, 379, 184, 381, 185, 383, 186, 385, 187, 387, 188, 389, 189, 391, 190, 393, 191, 395, 192, 397, 193, 399, 194, 401, 195, 403, 196, 405, 197, 407, 198, 409, 199, 411, 200, 413, 201, 415, 202, 417, 203, 419, 204, 421, 205, 423, 206, 425, 207, 427, 208, 429, 209, 431, 210, 433, 211, 435, 212, 437, 213, 439, 214, 441, 215, 443, 216, 445, 217, 447, 218, 449, 219, 451, 220, 453, 221, 455, 222, 457, 223, 459, 224, 461, 225, 463, 226, 465, 227, 467, 228, 469, 229, 471, 230, 473, 231, 475, 232, 477, 233, 479, 234, 481, 235, 483, 236, 485, 237, 487, 238, 489, 239, 491, 240, 493, 241, 495, 242, 497, 243, 499, 244, 501, 245, 503, 246, 505, 247, 507, 248, 509, 249, 511, 250, 513, 251, 515, 252, 517, 253, 519, 254, 521, 255, 523, 256, 525, 257, 527, 258, 529, 259, 531, 260, 533, 261, 535, 262, 537, 263, 539, 264, 541, 265, 543, 266, 545, 267, 547, 268, 549, 269, 551, 270, 553, 271, 555, 272, 557, 273, 559, 274, 561, 275, 563, 276, 565, 277, 567, 278, 569, 279, 571, 280, 573, 281, 575, 282, 577, 283, 579, 284, 581, 285, 583, 286, 585, 287, 587, 288, 589, 289, 591, 290, 593, 291, 595, 292, 597, 293, 599, 294, 601, 295, 603, 296, 605, 297, 607, 298, 609, 299, 611, 300, 613, 301, 615, 302, 617, 303, 619, 304, 621, 305, 623, 306, 625, 307, 627, 308, 629, 309, 631, 310, 633, 311, 635, 312, 637, 313, 639, 314, 641, 315, 643, 316, 645, 317, 647, 318, 649, 319, 651, 320, 653, 321, 655, 322, 657, 323, 659, 324, 661, 325, 663, 326, 665, 327, 667, 328, 669, 329, 671, 330, 673, 331, 675, 332, 677, 333, 679, 334, 681, 335, 683, 336, 685, 337, 687, 338, 689, 339, 691, 340, 693, 341, 695, 342, 697, 343, 699, 344, 701, 345, 703, 346, 705, 347, 707, 348, 709, 349, 711, 350, 713, 351, 715, 352, 717, 353, 719, 354, 721, 355, 723, 356, 725, 357, 727, 358, 729, 359, 731, 360, 733, 361, 735, 362, 737, 363, 739, 364, 741, 365, 743, 366, 745, 367, 747, 368, 749, 369, 751, 370, 753, 371, 755, 372, 757, 373, 759, 374, 761, 375, 763, 376, 765, 377, 767, 378, 769, 379, 771, 380, 773, 381, 775, 382, 777, 383, 779, 384, 781, 385, 783, 386, 785, 387, 787, 388, 789, 389, 791, 390, 793, 391, 795, 392, 797, 393, 799, 394, 801, 395, 803, 396, 805, 397, 807, 398, 809, 399, 811, 400, 813, 401, 815, 402, 817, 403, 819, 404, 821, 405, 823, 406, 825, 407, 827, 408, 829, 409, 831, 410, 833, 411, 835, 412, 837, 413, 839, 414, 841, 415, 843, 416, 845, 417, 847, 418, 849, 419, 851, 420, 853, 421, 855, 422, 857, 423, 859, 424, 861, 425, 863, 426, 865, 427, 867, 428, 869, 429, 871, 430, 873, 431, 875, 432, 877, 433, 879, 434, 881, 435, 883, 436, 885, 437, 887, 438, 889, 439, 891, 440, 893, 441, 895, 442, 897, 443, 899, 444, 901, 445, 903, 446, 905, 447, 907, 448, 909, 449, 911, 450, 913, 451, 915, 452, 917, 453, 919, 454, 921, 455, 923, 456, 925, 457, 927, 458, 929, 459, 931, 460, 933, 461, 935, 462, 937, 463, 939, 464, 941, 465, 943, 466, 945, 467, 947, 468, 949, 469, 951, 470, 953, 471, 955, 472, 957, 473, 959, 474, 961, 475, 963, 476, 965, 477, 967, 478, 969, 479, 971, 480, 973, 481, 975, 482, 977, 483, 979, 484, 981, 485, 983, 486, 985, 487, 987, 488, 989, 489, 991, 490, 993, 491, 995, 492, 997, 493, 999, 494, 1001, 495, 1003, 496, 1005, 497, 1007, 498, 1009, 499, 1011, 500, 1013, 501, 1015, 502, 1017, 503, 1019, 504, 1021, 505, 1023, 506, 1025, 507, 1027, 508, 1029, 509, 1031, 510, 1033, 511, 1035, 512, 1037, 513, 1039, 514, 1041, 515, 1043, 516, 1045, 517, 1047, 518, 1049, 519, 1051, 520, 1053, 521, 1055, 522, 1057, 523, 1059, 524, 1061, 525, 1063, 526, 1065, 527, 1067, 528, 1069, 529, 1071, 530, 1073, 531, 1075, 532, 1077, 533, 1079, 534, 1081, 535, 1083, 536, 1085, 537, 1087, 538, 1089, 539, 1091, 540, 1093, 541, 1095, 542, 1097, 543, 1099, 544, 1101, 545, 1103, 546, 1105, 547, 1107, 548, 1109, 549, 1111, 550, 1113, 551, 1115, 552, 1117, 553, 1119, 554, 1121, 555, 1123, 556, 1125, 557, 1127, 558, 1129, 559, 1131, 560, 1133, 561, 1135, 562, 1137, 563, 1139, 564, 1141, 565, 1143, 566, 1145, 567, 1147, 568, 1149, 569, 1151, 570, 1153, 571, 1155, 572, 1157, 573, 1159, 574, 1161, 575, 1163, 576, 1165, 577, 1167, 578, 1169, 579, 1171, 580, 1173, 581, 1175, 582, 1177, 583, 1179, 584, 1181, 585, 1183, 586, 1185, 587, 1187, 588, 1189, 589, 1191, 590, 1193, 591, 1195, 592, 1197, 593, 1199, 594, 1201, 595, 1203, 596, 1205, 597, 1207, 598, 1209, 599, 1211, 600, 1213, 601, 1215, 602, 1217, 603, 1219, 604, 1221, 605, 1223, 606, 1225, 607, 1227, 608, 1229, 609, 1231, 610, 1233, 611, 1235, 612, 1237, 613, 1239, 614, 1241, 615, 1243, 616, 1245, 617, 1247, 618, 1249, 619, 1251, 620, 1253, 621, 1255, 622, 1257, 623, 1259, 624, 1261, 625, 1263, 626, 1265, 627, 1267, 628, 1269, 629, 1271, 630, 1273, 631, 1275, 632, 1277, 633, 1279, 634, 1281, 635, 1283, 636, 1285, 637, 1287, 638, 1289, 639, 1291, 640, 1293, 641, 1295, 642, 1297, 643, 1299, 0, 1301, 0, 1303, 0, 1305, 644, 1307, 645, 1309, 646, 1311, 647, 1313, 648, 1315, 649, 1317, 650, 1319, 651, 1321, 652, 1323, 653, 1325, 0, 1327, 654, 1329, 655, 1331, 656, 1333, 0, 1335, 657, 1337, 658, 1339, 659, 1341, 660, 1343, 661, 1345, 662, 1347, 663, 1349, 664, 1351, 665, 1353, 666, 1355, 667, 1357, 0, 1359, 668, 1361, 669, 1363, 670, 1365, 671, 1367, 672, 1369, 673, 1371, 674, 1373, 675, 1375, 676, 1377, 677, 1379, 678, 1381, 679, 1383, 0, 1385, 680, 1387, 681, 1389, 0, 1391, 0, 1393, 0, 1395, 682, 1397, 0, 1399, 0, 1401, 686, 1403, 683, 1405, 684, 1407, 685, 5, 0, 1, 2, 3, 4, 51, 1, 0, 48, 57, 2, 0, 43, 43, 45, 45, 9, 0, 33, 33, 35, 35, 37, 38, 42, 42, 60, 64, 94, 94, 96, 96, 124, 124, 126, 126, 2, 0, 42, 43, 60, 62, 8, 0, 33, 33, 35, 35, 37, 38, 63, 64, 94, 94, 96, 96, 124, 124, 126, 126, 2, 0, 65, 65, 97, 97, 2, 0, 76, 76, 108, 108, 2, 0, 78, 78, 110, 110, 2, 0, 89, 89, 121, 121, 2, 0, 83, 83, 115, 115, 2, 0, 69, 69, 101, 101, 2, 0, 90, 90, 122, 122, 2, 0, 68, 68, 100, 100, 2, 0, 82, 82, 114, 114, 2, 0, 67, 67, 99, 99, 2, 0, 77, 77, 109, 109, 2, 0, 84, 84, 116, 116, 2, 0, 73, 73, 105, 105, 2, 0, 66, 66, 98, 98, 2, 0, 79, 79, 111, 111, 2, 0, 72, 72, 104, 104, 2, 0, 75, 75, 107, 107, 2, 0, 85, 85, 117, 117, 2, 0, 71, 71, 103, 103, 2, 0, 80, 80, 112, 112, 2, 0, 70, 70, 102, 102, 2, 0, 88, 88, 120, 120, 2, 0, 86, 86, 118, 118, 2, 0, 81, 81, 113, 113, 2, 0, 87, 87, 119, 119, 2, 0, 74, 74, 106, 106, 9, 0, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 255, 2, 0, 256, 55295, 57344, 65535, 1, 0, 55296, 56319, 1, 0, 56320, 57343, 2, 0, 0, 0, 34, 34, 1, 0, 34, 34, 1, 0, 39, 39, 1, 0, 48, 49, 3, 0, 48, 57, 65, 70, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 5, 0, 36, 36, 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 34, 34, 92, 92, 2, 0, 9, 9, 32, 32, 2, 0, 10, 10, 13, 13, 2, 0, 42, 42, 47, 47, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 3, 0, 10, 10, 13, 13, 34, 34, 3, 0, 85, 85, 117, 117, 120, 120, 2, 0, 39, 39, 92, 92, 1, 0, 36, 36, 6945, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, 0, 271, 1, 0, 0, 0, 0, 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, 0, 0, 0, 0, 279, 1, 0, 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, 285, 1, 0, 0, 0, 0, 287, 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, 0, 0, 0, 293, 1, 0, 0, 0, 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, 1, 0, 0, 0, 0, 301, 1, 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, 0, 307, 1, 0, 0, 0, 0, 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, 0, 0, 0, 0, 315, 1, 0, 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, 321, 1, 0, 0, 0, 0, 323, 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, 0, 0, 0, 329, 1, 0, 0, 0, 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, 1, 0, 0, 0, 0, 337, 1, 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, 0, 343, 1, 0, 0, 0, 0, 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, 0, 0, 0, 0, 351, 1, 0, 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, 357, 1, 0, 0, 0, 0, 359, 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, 0, 0, 0, 365, 1, 0, 0, 0, 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, 1, 0, 0, 0, 0, 373, 1, 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, 0, 379, 1, 0, 0, 0, 0, 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, 0, 0, 0, 0, 387, 1, 0, 0, 0, 0, 389, 1, 0, 0, 0, 0, 391, 1, 0, 0, 0, 0, 393, 1, 0, 0, 0, 0, 395, 1, 0, 0, 0, 0, 397, 1, 0, 0, 0, 0, 399, 1, 0, 0, 0, 0, 401, 1, 0, 0, 0, 0, 403, 1, 0, 0, 0, 0, 405, 1, 0, 0, 0, 0, 407, 1, 0, 0, 0, 0, 409, 1, 0, 0, 0, 0, 411, 1, 0, 0, 0, 0, 413, 1, 0, 0, 0, 0, 415, 1, 0, 0, 0, 0, 417, 1, 0, 0, 0, 0, 419, 1, 0, 0, 0, 0, 421, 1, 0, 0, 0, 0, 423, 1, 0, 0, 0, 0, 425, 1, 0, 0, 0, 0, 427, 1, 0, 0, 0, 0, 429, 1, 0, 0, 0, 0, 431, 1, 0, 0, 0, 0, 433, 1, 0, 0, 0, 0, 435, 1, 0, 0, 0, 0, 437, 1, 0, 0, 0, 0, 439, 1, 0, 0, 0, 0, 441, 1, 0, 0, 0, 0, 443, 1, 0, 0, 0, 0, 445, 1, 0, 0, 0, 0, 447, 1, 0, 0, 0, 0, 449, 1, 0, 0, 0, 0, 451, 1, 0, 0, 0, 0, 453, 1, 0, 0, 0, 0, 455, 1, 0, 0, 0, 0, 457, 1, 0, 0, 0, 0, 459, 1, 0, 0, 0, 0, 461, 1, 0, 0, 0, 0, 463, 1, 0, 0, 0, 0, 465, 1, 0, 0, 0, 0, 467, 1, 0, 0, 0, 0, 469, 1, 0, 0, 0, 0, 471, 1, 0, 0, 0, 0, 473, 1, 0, 0, 0, 0, 475, 1, 0, 0, 0, 0, 477, 1, 0, 0, 0, 0, 479, 1, 0, 0, 0, 0, 481, 1, 0, 0, 0, 0, 483, 1, 0, 0, 0, 0, 485, 1, 0, 0, 0, 0, 487, 1, 0, 0, 0, 0, 489, 1, 0, 0, 0, 0, 491, 1, 0, 0, 0, 0, 493, 1, 0, 0, 0, 0, 495, 1, 0, 0, 0, 0, 497, 1, 0, 0, 0, 0, 499, 1, 0, 0, 0, 0, 501, 1, 0, 0, 0, 0, 503, 1, 0, 0, 0, 0, 505, 1, 0, 0, 0, 0, 507, 1, 0, 0, 0, 0, 509, 1, 0, 0, 0, 0, 511, 1, 0, 0, 0, 0, 513, 1, 0, 0, 0, 0, 515, 1, 0, 0, 0, 0, 517, 1, 0, 0, 0, 0, 519, 1, 0, 0, 0, 0, 521, 1, 0, 0, 0, 0, 523, 1, 0, 0, 0, 0, 525, 1, 0, 0, 0, 0, 527, 1, 0, 0, 0, 0, 529, 1, 0, 0, 0, 0, 531, 1, 0, 0, 0, 0, 533, 1, 0, 0, 0, 0, 535, 1, 0, 0, 0, 0, 537, 1, 0, 0, 0, 0, 539, 1, 0, 0, 0, 0, 541, 1, 0, 0, 0, 0, 543, 1, 0, 0, 0, 0, 545, 1, 0, 0, 0, 0, 547, 1, 0, 0, 0, 0, 549, 1, 0, 0, 0, 0, 551, 1, 0, 0, 0, 0, 553, 1, 0, 0, 0, 0, 555, 1, 0, 0, 0, 0, 557, 1, 0, 0, 0, 0, 559, 1, 0, 0, 0, 0, 561, 1, 0, 0, 0, 0, 563, 1, 0, 0, 0, 0, 565, 1, 0, 0, 0, 0, 567, 1, 0, 0, 0, 0, 569, 1, 0, 0, 0, 0, 571, 1, 0, 0, 0, 0, 573, 1, 0, 0, 0, 0, 575, 1, 0, 0, 0, 0, 577, 1, 0, 0, 0, 0, 579, 1, 0, 0, 0, 0, 581, 1, 0, 0, 0, 0, 583, 1, 0, 0, 0, 0, 585, 1, 0, 0, 0, 0, 587, 1, 0, 0, 0, 0, 589, 1, 0, 0, 0, 0, 591, 1, 0, 0, 0, 0, 593, 1, 0, 0, 0, 0, 595, 1, 0, 0, 0, 0, 597, 1, 0, 0, 0, 0, 599, 1, 0, 0, 0, 0, 601, 1, 0, 0, 0, 0, 603, 1, 0, 0, 0, 0, 605, 1, 0, 0, 0, 0, 607, 1, 0, 0, 0, 0, 609, 1, 0, 0, 0, 0, 611, 1, 0, 0, 0, 0, 613, 1, 0, 0, 0, 0, 615, 1, 0, 0, 0, 0, 617, 1, 0, 0, 0, 0, 619, 1, 0, 0, 0, 0, 621, 1, 0, 0, 0, 0, 623, 1, 0, 0, 0, 0, 625, 1, 0, 0, 0, 0, 627, 1, 0, 0, 0, 0, 629, 1, 0, 0, 0, 0, 631, 1, 0, 0, 0, 0, 633, 1, 0, 0, 0, 0, 635, 1, 0, 0, 0, 0, 637, 1, 0, 0, 0, 0, 639, 1, 0, 0, 0, 0, 641, 1, 0, 0, 0, 0, 643, 1, 0, 0, 0, 0, 645, 1, 0, 0, 0, 0, 647, 1, 0, 0, 0, 0, 649, 1, 0, 0, 0, 0, 651, 1, 0, 0, 0, 0, 653, 1, 0, 0, 0, 0, 655, 1, 0, 0, 0, 0, 657, 1, 0, 0, 0, 0, 659, 1, 0, 0, 0, 0, 661, 1, 0, 0, 0, 0, 663, 1, 0, 0, 0, 0, 665, 1, 0, 0, 0, 0, 667, 1, 0, 0, 0, 0, 669, 1, 0, 0, 0, 0, 671, 1, 0, 0, 0, 0, 673, 1, 0, 0, 0, 0, 675, 1, 0, 0, 0, 0, 677, 1, 0, 0, 0, 0, 679, 1, 0, 0, 0, 0, 681, 1, 0, 0, 0, 0, 683, 1, 0, 0, 0, 0, 685, 1, 0, 0, 0, 0, 687, 1, 0, 0, 0, 0, 689, 1, 0, 0, 0, 0, 691, 1, 0, 0, 0, 0, 693, 1, 0, 0, 0, 0, 695, 1, 0, 0, 0, 0, 697, 1, 0, 0, 0, 0, 699, 1, 0, 0, 0, 0, 701, 1, 0, 0, 0, 0, 703, 1, 0, 0, 0, 0, 705, 1, 0, 0, 0, 0, 707, 1, 0, 0, 0, 0, 709, 1, 0, 0, 0, 0, 711, 1, 0, 0, 0, 0, 713, 1, 0, 0, 0, 0, 715, 1, 0, 0, 0, 0, 717, 1, 0, 0, 0, 0, 719, 1, 0, 0, 0, 0, 721, 1, 0, 0, 0, 0, 723, 1, 0, 0, 0, 0, 725, 1, 0, 0, 0, 0, 727, 1, 0, 0, 0, 0, 729, 1, 0, 0, 0, 0, 731, 1, 0, 0, 0, 0, 733, 1, 0, 0, 0, 0, 735, 1, 0, 0, 0, 0, 737, 1, 0, 0, 0, 0, 739, 1, 0, 0, 0, 0, 741, 1, 0, 0, 0, 0, 743, 1, 0, 0, 0, 0, 745, 1, 0, 0, 0, 0, 747, 1, 0, 0, 0, 0, 749, 1, 0, 0, 0, 0, 751, 1, 0, 0, 0, 0, 753, 1, 0, 0, 0, 0, 755, 1, 0, 0, 0, 0, 757, 1, 0, 0, 0, 0, 759, 1, 0, 0, 0, 0, 761, 1, 0, 0, 0, 0, 763, 1, 0, 0, 0, 0, 765, 1, 0, 0, 0, 0, 767, 1, 0, 0, 0, 0, 769, 1, 0, 0, 0, 0, 771, 1, 0, 0, 0, 0, 773, 1, 0, 0, 0, 0, 775, 1, 0, 0, 0, 0, 777, 1, 0, 0, 0, 0, 779, 1, 0, 0, 0, 0, 781, 1, 0, 0, 0, 0, 783, 1, 0, 0, 0, 0, 785, 1, 0, 0, 0, 0, 787, 1, 0, 0, 0, 0, 789, 1, 0, 0, 0, 0, 791, 1, 0, 0, 0, 0, 793, 1, 0, 0, 0, 0, 795, 1, 0, 0, 0, 0, 797, 1, 0, 0, 0, 0, 799, 1, 0, 0, 0, 0, 801, 1, 0, 0, 0, 0, 803, 1, 0, 0, 0, 0, 805, 1, 0, 0, 0, 0, 807, 1, 0, 0, 0, 0, 809, 1, 0, 0, 0, 0, 811, 1, 0, 0, 0, 0, 813, 1, 0, 0, 0, 0, 815, 1, 0, 0, 0, 0, 817, 1, 0, 0, 0, 0, 819, 1, 0, 0, 0, 0, 821, 1, 0, 0, 0, 0, 823, 1, 0, 0, 0, 0, 825, 1, 0, 0, 0, 0, 827, 1, 0, 0, 0, 0, 829, 1, 0, 0, 0, 0, 831, 1, 0, 0, 0, 0, 833, 1, 0, 0, 0, 0, 835, 1, 0, 0, 0, 0, 837, 1, 0, 0, 0, 0, 839, 1, 0, 0, 0, 0, 841, 1, 0, 0, 0, 0, 843, 1, 0, 0, 0, 0, 845, 1, 0, 0, 0, 0, 847, 1, 0, 0, 0, 0, 849, 1, 0, 0, 0, 0, 851, 1, 0, 0, 0, 0, 853, 1, 0, 0, 0, 0, 855, 1, 0, 0, 0, 0, 857, 1, 0, 0, 0, 0, 859, 1, 0, 0, 0, 0, 861, 1, 0, 0, 0, 0, 863, 1, 0, 0, 0, 0, 865, 1, 0, 0, 0, 0, 867, 1, 0, 0, 0, 0, 869, 1, 0, 0, 0, 0, 871, 1, 0, 0, 0, 0, 873, 1, 0, 0, 0, 0, 875, 1, 0, 0, 0, 0, 877, 1, 0, 0, 0, 0, 879, 1, 0, 0, 0, 0, 881, 1, 0, 0, 0, 0, 883, 1, 0, 0, 0, 0, 885, 1, 0, 0, 0, 0, 887, 1, 0, 0, 0, 0, 889, 1, 0, 0, 0, 0, 891, 1, 0, 0, 0, 0, 893, 1, 0, 0, 0, 0, 895, 1, 0, 0, 0, 0, 897, 1, 0, 0, 0, 0, 899, 1, 0, 0, 0, 0, 901, 1, 0, 0, 0, 0, 903, 1, 0, 0, 0, 0, 905, 1, 0, 0, 0, 0, 907, 1, 0, 0, 0, 0, 909, 1, 0, 0, 0, 0, 911, 1, 0, 0, 0, 0, 913, 1, 0, 0, 0, 0, 915, 1, 0, 0, 0, 0, 917, 1, 0, 0, 0, 0, 919, 1, 0, 0, 0, 0, 921, 1, 0, 0, 0, 0, 923, 1, 0, 0, 0, 0, 925, 1, 0, 0, 0, 0, 927, 1, 0, 0, 0, 0, 929, 1, 0, 0, 0, 0, 931, 1, 0, 0, 0, 0, 933, 1, 0, 0, 0, 0, 935, 1, 0, 0, 0, 0, 937, 1, 0, 0, 0, 0, 939, 1, 0, 0, 0, 0, 941, 1, 0, 0, 0, 0, 943, 1, 0, 0, 0, 0, 945, 1, 0, 0, 0, 0, 947, 1, 0, 0, 0, 0, 949, 1, 0, 0, 0, 0, 951, 1, 0, 0, 0, 0, 953, 1, 0, 0, 0, 0, 955, 1, 0, 0, 0, 0, 957, 1, 0, 0, 0, 0, 959, 1, 0, 0, 0, 0, 961, 1, 0, 0, 0, 0, 963, 1, 0, 0, 0, 0, 965, 1, 0, 0, 0, 0, 967, 1, 0, 0, 0, 0, 969, 1, 0, 0, 0, 0, 971, 1, 0, 0, 0, 0, 973, 1, 0, 0, 0, 0, 975, 1, 0, 0, 0, 0, 977, 1, 0, 0, 0, 0, 979, 1, 0, 0, 0, 0, 981, 1, 0, 0, 0, 0, 983, 1, 0, 0, 0, 0, 985, 1, 0, 0, 0, 0, 987, 1, 0, 0, 0, 0, 989, 1, 0, 0, 0, 0, 991, 1, 0, 0, 0, 0, 993, 1, 0, 0, 0, 0, 995, 1, 0, 0, 0, 0, 997, 1, 0, 0, 0, 0, 999, 1, 0, 0, 0, 0, 1001, 1, 0, 0, 0, 0, 1003, 1, 0, 0, 0, 0, 1005, 1, 0, 0, 0, 0, 1007, 1, 0, 0, 0, 0, 1009, 1, 0, 0, 0, 0, 1011, 1, 0, 0, 0, 0, 1013, 1, 0, 0, 0, 0, 1015, 1, 0, 0, 0, 0, 1017, 1, 0, 0, 0, 0, 1019, 1, 0, 0, 0, 0, 1021, 1, 0, 0, 0, 0, 1023, 1, 0, 0, 0, 0, 1025, 1, 0, 0, 0, 0, 1027, 1, 0, 0, 0, 0, 1029, 1, 0, 0, 0, 0, 1031, 1, 0, 0, 0, 0, 1033, 1, 0, 0, 0, 0, 1035, 1, 0, 0, 0, 0, 1037, 1, 0, 0, 0, 0, 1039, 1, 0, 0, 0, 0, 1041, 1, 0, 0, 0, 0, 1043, 1, 0, 0, 0, 0, 1045, 1, 0, 0, 0, 0, 1047, 1, 0, 0, 0, 0, 1049, 1, 0, 0, 0, 0, 1051, 1, 0, 0, 0, 0, 1053, 1, 0, 0, 0, 0, 1055, 1, 0, 0, 0, 0, 1057, 1, 0, 0, 0, 0, 1059, 1, 0, 0, 0, 0, 1061, 1, 0, 0, 0, 0, 1063, 1, 0, 0, 0, 0, 1065, 1, 0, 0, 0, 0, 1067, 1, 0, 0, 0, 0, 1069, 1, 0, 0, 0, 0, 1071, 1, 0, 0, 0, 0, 1073, 1, 0, 0, 0, 0, 1075, 1, 0, 0, 0, 0, 1077, 1, 0, 0, 0, 0, 1079, 1, 0, 0, 0, 0, 1081, 1, 0, 0, 0, 0, 1083, 1, 0, 0, 0, 0, 1085, 1, 0, 0, 0, 0, 1087, 1, 0, 0, 0, 0, 1089, 1, 0, 0, 0, 0, 1091, 1, 0, 0, 0, 0, 1093, 1, 0, 0, 0, 0, 1095, 1, 0, 0, 0, 0, 1097, 1, 0, 0, 0, 0, 1099, 1, 0, 0, 0, 0, 1101, 1, 0, 0, 0, 0, 1103, 1, 0, 0, 0, 0, 1105, 1, 0, 0, 0, 0, 1107, 1, 0, 0, 0, 0, 1109, 1, 0, 0, 0, 0, 1111, 1, 0, 0, 0, 0, 1113, 1, 0, 0, 0, 0, 1115, 1, 0, 0, 0, 0, 1117, 1, 0, 0, 0, 0, 1119, 1, 0, 0, 0, 0, 1121, 1, 0, 0, 0, 0, 1123, 1, 0, 0, 0, 0, 1125, 1, 0, 0, 0, 0, 1127, 1, 0, 0, 0, 0, 1129, 1, 0, 0, 0, 0, 1131, 1, 0, 0, 0, 0, 1133, 1, 0, 0, 0, 0, 1135, 1, 0, 0, 0, 0, 1137, 1, 0, 0, 0, 0, 1139, 1, 0, 0, 0, 0, 1141, 1, 0, 0, 0, 0, 1143, 1, 0, 0, 0, 0, 1145, 1, 0, 0, 0, 0, 1147, 1, 0, 0, 0, 0, 1149, 1, 0, 0, 0, 0, 1151, 1, 0, 0, 0, 0, 1153, 1, 0, 0, 0, 0, 1155, 1, 0, 0, 0, 0, 1157, 1, 0, 0, 0, 0, 1159, 1, 0, 0, 0, 0, 1161, 1, 0, 0, 0, 0, 1163, 1, 0, 0, 0, 0, 1165, 1, 0, 0, 0, 0, 1167, 1, 0, 0, 0, 0, 1169, 1, 0, 0, 0, 0, 1171, 1, 0, 0, 0, 0, 1173, 1, 0, 0, 0, 0, 1175, 1, 0, 0, 0, 0, 1177, 1, 0, 0, 0, 0, 1179, 1, 0, 0, 0, 0, 1181, 1, 0, 0, 0, 0, 1183, 1, 0, 0, 0, 0, 1185, 1, 0, 0, 0, 0, 1187, 1, 0, 0, 0, 0, 1189, 1, 0, 0, 0, 0, 1191, 1, 0, 0, 0, 0, 1193, 1, 0, 0, 0, 0, 1195, 1, 0, 0, 0, 0, 1197, 1, 0, 0, 0, 0, 1199, 1, 0, 0, 0, 0, 1201, 1, 0, 0, 0, 0, 1203, 1, 0, 0, 0, 0, 1205, 1, 0, 0, 0, 0, 1207, 1, 0, 0, 0, 0, 1209, 1, 0, 0, 0, 0, 1211, 1, 0, 0, 0, 0, 1213, 1, 0, 0, 0, 0, 1215, 1, 0, 0, 0, 0, 1217, 1, 0, 0, 0, 0, 1219, 1, 0, 0, 0, 0, 1221, 1, 0, 0, 0, 0, 1223, 1, 0, 0, 0, 0, 1225, 1, 0, 0, 0, 0, 1227, 1, 0, 0, 0, 0, 1229, 1, 0, 0, 0, 0, 1231, 1, 0, 0, 0, 0, 1233, 1, 0, 0, 0, 0, 1235, 1, 0, 0, 0, 0, 1237, 1, 0, 0, 0, 0, 1239, 1, 0, 0, 0, 0, 1241, 1, 0, 0, 0, 0, 1243, 1, 0, 0, 0, 0, 1245, 1, 0, 0, 0, 0, 1247, 1, 0, 0, 0, 0, 1249, 1, 0, 0, 0, 0, 1251, 1, 0, 0, 0, 0, 1253, 1, 0, 0, 0, 0, 1255, 1, 0, 0, 0, 0, 1257, 1, 0, 0, 0, 0, 1259, 1, 0, 0, 0, 0, 1261, 1, 0, 0, 0, 0, 1263, 1, 0, 0, 0, 0, 1265, 1, 0, 0, 0, 0, 1267, 1, 0, 0, 0, 0, 1269, 1, 0, 0, 0, 0, 1271, 1, 0, 0, 0, 0, 1273, 1, 0, 0, 0, 0, 1275, 1, 0, 0, 0, 0, 1277, 1, 0, 0, 0, 0, 1279, 1, 0, 0, 0, 0, 1281, 1, 0, 0, 0, 0, 1283, 1, 0, 0, 0, 0, 1285, 1, 0, 0, 0, 0, 1287, 1, 0, 0, 0, 0, 1289, 1, 0, 0, 0, 0, 1291, 1, 0, 0, 0, 0, 1293, 1, 0, 0, 0, 0, 1295, 1, 0, 0, 0, 0, 1297, 1, 0, 0, 0, 0, 1305, 1, 0, 0, 0, 0, 1307, 1, 0, 0, 0, 0, 1309, 1, 0, 0, 0, 0, 1311, 1, 0, 0, 0, 0, 1313, 1, 0, 0, 0, 0, 1315, 1, 0, 0, 0, 0, 1317, 1, 0, 0, 0, 0, 1319, 1, 0, 0, 0, 0, 1321, 1, 0, 0, 0, 0, 1323, 1, 0, 0, 0, 0, 1325, 1, 0, 0, 0, 0, 1327, 1, 0, 0, 0, 0, 1329, 1, 0, 0, 0, 0, 1331, 1, 0, 0, 0, 0, 1335, 1, 0, 0, 0, 0, 1337, 1, 0, 0, 0, 0, 1339, 1, 0, 0, 0, 0, 1341, 1, 0, 0, 0, 0, 1343, 1, 0, 0, 0, 0, 1345, 1, 0, 0, 0, 0, 1347, 1, 0, 0, 0, 0, 1349, 1, 0, 0, 0, 0, 1351, 1, 0, 0, 0, 0, 1353, 1, 0, 0, 0, 0, 1355, 1, 0, 0, 0, 0, 1359, 1, 0, 0, 0, 0, 1361, 1, 0, 0, 0, 0, 1363, 1, 0, 0, 0, 0, 1365, 1, 0, 0, 0, 0, 1367, 1, 0, 0, 0, 0, 1369, 1, 0, 0, 0, 0, 1371, 1, 0, 0, 0, 0, 1373, 1, 0, 0, 0, 0, 1375, 1, 0, 0, 0, 0, 1377, 1, 0, 0, 0, 1, 1379, 1, 0, 0, 0, 1, 1381, 1, 0, 0, 0, 1, 1385, 1, 0, 0, 0, 1, 1387, 1, 0, 0, 0, 2, 1391, 1, 0, 0, 0, 2, 1393, 1, 0, 0, 0, 2, 1395, 1, 0, 0, 0, 3, 1397, 1, 0, 0, 0, 3, 1399, 1, 0, 0, 0, 3, 1401, 1, 0, 0, 0, 3, 1403, 1, 0, 0, 0, 4, 1405, 1, 0, 0, 0, 4, 1407, 1, 0, 0, 0, 5, 1409, 1, 0, 0, 0, 7, 1411, 1, 0, 0, 0, 9, 1413, 1, 0, 0, 0, 11, 1415, 1, 0, 0, 0, 13, 1417, 1, 0, 0, 0, 15, 1419, 1, 0, 0, 0, 17, 1421, 1, 0, 0, 0, 19, 1423, 1, 0, 0, 0, 21, 1425, 1, 0, 0, 0, 23, 1427, 1, 0, 0, 0, 25, 1429, 1, 0, 0, 0, 27, 1431, 1, 0, 0, 0, 29, 1433, 1, 0, 0, 0, 31, 1435, 1, 0, 0, 0, 33, 1437, 1, 0, 0, 0, 35, 1439, 1, 0, 0, 0, 37, 1441, 1, 0, 0, 0, 39, 1443, 1, 0, 0, 0, 41, 1446, 1, 0, 0, 0, 43, 1449, 1, 0, 0, 0, 45, 1452, 1, 0, 0, 0, 47, 1455, 1, 0, 0, 0, 49, 1458, 1, 0, 0, 0, 51, 1461, 1, 0, 0, 0, 53, 1464, 1, 0, 0, 0, 55, 1467, 1, 0, 0, 0, 57, 1470, 1, 0, 0, 0, 59, 1472, 1, 0, 0, 0, 61, 1498, 1, 0, 0, 0, 63, 1509, 1, 0, 0, 0, 65, 1525, 1, 0, 0, 0, 67, 1527, 1, 0, 0, 0, 69, 1529, 1, 0, 0, 0, 71, 1531, 1, 0, 0, 0, 73, 1535, 1, 0, 0, 0, 75, 1543, 1, 0, 0, 0, 77, 1551, 1, 0, 0, 0, 79, 1555, 1, 0, 0, 0, 81, 1559, 1, 0, 0, 0, 83, 1565, 1, 0, 0, 0, 85, 1568, 1, 0, 0, 0, 87, 1572, 1, 0, 0, 0, 89, 1583, 1, 0, 0, 0, 91, 1588, 1, 0, 0, 0, 93, 1593, 1, 0, 0, 0, 95, 1598, 1, 0, 0, 0, 97, 1604, 1, 0, 0, 0, 99, 1612, 1, 0, 0, 0, 101, 1619, 1, 0, 0, 0, 103, 1630, 1, 0, 0, 0, 105, 1637, 1, 0, 0, 0, 107, 1653, 1, 0, 0, 0, 109, 1666, 1, 0, 0, 0, 111, 1679, 1, 0, 0, 0, 113, 1692, 1, 0, 0, 0, 115, 1710, 1, 0, 0, 0, 117, 1723, 1, 0, 0, 0, 119, 1731, 1, 0, 0, 0, 121, 1742, 1, 0, 0, 0, 123, 1747, 1, 0, 0, 0, 125, 1756, 1, 0, 0, 0, 127, 1759, 1, 0, 0, 0, 129, 1764, 1, 0, 0, 0, 131, 1771, 1, 0, 0, 0, 133, 1777, 1, 0, 0, 0, 135, 1783, 1, 0, 0, 0, 137, 1787, 1, 0, 0, 0, 139, 1795, 1, 0, 0, 0, 141, 1800, 1, 0, 0, 0, 143, 1806, 1, 0, 0, 0, 145, 1812, 1, 0, 0, 0, 147, 1819, 1, 0, 0, 0, 149, 1822, 1, 0, 0, 0, 151, 1832, 1, 0, 0, 0, 153, 1842, 1, 0, 0, 0, 155, 1847, 1, 0, 0, 0, 157, 1855, 1, 0, 0, 0, 159, 1863, 1, 0, 0, 0, 161, 1869, 1, 0, 0, 0, 163, 1879, 1, 0, 0, 0, 165, 1894, 1, 0, 0, 0, 167, 1898, 1, 0, 0, 0, 169, 1903, 1, 0, 0, 0, 171, 1910, 1, 0, 0, 0, 173, 1913, 1, 0, 0, 0, 175, 1918, 1, 0, 0, 0, 177, 1921, 1, 0, 0, 0, 179, 1927, 1, 0, 0, 0, 181, 1935, 1, 0, 0, 0, 183, 1943, 1, 0, 0, 0, 185, 1954, 1, 0, 0, 0, 187, 1964, 1, 0, 0, 0, 189, 1971, 1, 0, 0, 0, 191, 1984, 1, 0, 0, 0, 193, 1989, 1, 0, 0, 0, 195, 1999, 1, 0, 0, 0, 197, 2005, 1, 0, 0, 0, 199, 2010, 1, 0, 0, 0, 201, 2013, 1, 0, 0, 0, 203, 2022, 1, 0, 0, 0, 205, 2027, 1, 0, 0, 0, 207, 2033, 1, 0, 0, 0, 209, 2040, 1, 0, 0, 0, 211, 2045, 1, 0, 0, 0, 213, 2051, 1, 0, 0, 0, 215, 2060, 1, 0, 0, 0, 217, 2065, 1, 0, 0, 0, 219, 2071, 1, 0, 0, 0, 221, 2078, 1, 0, 0, 0, 223, 2083, 1, 0, 0, 0, 225, 2097, 1, 0, 0, 0, 227, 2104, 1, 0, 0, 0, 229, 2114, 1, 0, 0, 0, 231, 2127, 1, 0, 0, 0, 233, 2133, 1, 0, 0, 0, 235, 2148, 1, 0, 0, 0, 237, 2155, 1, 0, 0, 0, 239, 2160, 1, 0, 0, 0, 241, 2166, 1, 0, 0, 0, 243, 2172, 1, 0, 0, 0, 245, 2175, 1, 0, 0, 0, 247, 2182, 1, 0, 0, 0, 249, 2187, 1, 0, 0, 0, 251, 2192, 1, 0, 0, 0, 253, 2197, 1, 0, 0, 0, 255, 2205, 1, 0, 0, 0, 257, 2213, 1, 0, 0, 0, 259, 2219, 1, 0, 0, 0, 261, 2224, 1, 0, 0, 0, 263, 2233, 1, 0, 0, 0, 265, 2239, 1, 0, 0, 0, 267, 2247, 1, 0, 0, 0, 269, 2255, 1, 0, 0, 0, 271, 2261, 1, 0, 0, 0, 273, 2270, 1, 0, 0, 0, 275, 2277, 1, 0, 0, 0, 277, 2284, 1, 0, 0, 0, 279, 2288, 1, 0, 0, 0, 281, 2294, 1, 0, 0, 0, 283, 2300, 1, 0, 0, 0, 285, 2310, 1, 0, 0, 0, 287, 2315, 1, 0, 0, 0, 289, 2321, 1, 0, 0, 0, 291, 2328, 1, 0, 0, 0, 293, 2338, 1, 0, 0, 0, 295, 2349, 1, 0, 0, 0, 297, 2352, 1, 0, 0, 0, 299, 2362, 1, 0, 0, 0, 301, 2371, 1, 0, 0, 0, 303, 2378, 1, 0, 0, 0, 305, 2384, 1, 0, 0, 0, 307, 2387, 1, 0, 0, 0, 309, 2393, 1, 0, 0, 0, 311, 2400, 1, 0, 0, 0, 313, 2408, 1, 0, 0, 0, 315, 2417, 1, 0, 0, 0, 317, 2425, 1, 0, 0, 0, 319, 2431, 1, 0, 0, 0, 321, 2447, 1, 0, 0, 0, 323, 2458, 1, 0, 0, 0, 325, 2464, 1, 0, 0, 0, 327, 2470, 1, 0, 0, 0, 329, 2478, 1, 0, 0, 0, 331, 2486, 1, 0, 0, 0, 333, 2495, 1, 0, 0, 0, 335, 2502, 1, 0, 0, 0, 337, 2512, 1, 0, 0, 0, 339, 2526, 1, 0, 0, 0, 341, 2537, 1, 0, 0, 0, 343, 2549, 1, 0, 0, 0, 345, 2557, 1, 0, 0, 0, 347, 2566, 1, 0, 0, 0, 349, 2577, 1, 0, 0, 0, 351, 2582, 1, 0, 0, 0, 353, 2587, 1, 0, 0, 0, 355, 2591, 1, 0, 0, 0, 357, 2598, 1, 0, 0, 0, 359, 2604, 1, 0, 0, 0, 361, 2609, 1, 0, 0, 0, 363, 2618, 1, 0, 0, 0, 365, 2622, 1, 0, 0, 0, 367, 2633, 1, 0, 0, 0, 369, 2641, 1, 0, 0, 0, 371, 2650, 1, 0, 0, 0, 373, 2659, 1, 0, 0, 0, 375, 2667, 1, 0, 0, 0, 377, 2674, 1, 0, 0, 0, 379, 2684, 1, 0, 0, 0, 381, 2695, 1, 0, 0, 0, 383, 2706, 1, 0, 0, 0, 385, 2714, 1, 0, 0, 0, 387, 2722, 1, 0, 0, 0, 389, 2731, 1, 0, 0, 0, 391, 2738, 1, 0, 0, 0, 393, 2745, 1, 0, 0, 0, 395, 2750, 1, 0, 0, 0, 397, 2755, 1, 0, 0, 0, 399, 2762, 1, 0, 0, 0, 401, 2771, 1, 0, 0, 0, 403, 2781, 1, 0, 0, 0, 405, 2786, 1, 0, 0, 0, 407, 2793, 1, 0, 0, 0, 409, 2799, 1, 0, 0, 0, 411, 2807, 1, 0, 0, 0, 413, 2817, 1, 0, 0, 0, 415, 2827, 1, 0, 0, 0, 417, 2835, 1, 0, 0, 0, 419, 2843, 1, 0, 0, 0, 421, 2853, 1, 0, 0, 0, 423, 2862, 1, 0, 0, 0, 425, 2869, 1, 0, 0, 0, 427, 2875, 1, 0, 0, 0, 429, 2885, 1, 0, 0, 0, 431, 2891, 1, 0, 0, 0, 433, 2899, 1, 0, 0, 0, 435, 2908, 1, 0, 0, 0, 437, 2918, 1, 0, 0, 0, 439, 2925, 1, 0, 0, 0, 441, 2933, 1, 0, 0, 0, 443, 2941, 1, 0, 0, 0, 445, 2948, 1, 0, 0, 0, 447, 2953, 1, 0, 0, 0, 449, 2958, 1, 0, 0, 0, 451, 2967, 1, 0, 0, 0, 453, 2970, 1, 0, 0, 0, 455, 2980, 1, 0, 0, 0, 457, 2990, 1, 0, 0, 0, 459, 2999, 1, 0, 0, 0, 461, 3009, 1, 0, 0, 0, 463, 3019, 1, 0, 0, 0, 465, 3025, 1, 0, 0, 0, 467, 3033, 1, 0, 0, 0, 469, 3041, 1, 0, 0, 0, 471, 3050, 1, 0, 0, 0, 473, 3057, 1, 0, 0, 0, 475, 3069, 1, 0, 0, 0, 477, 3076, 1, 0, 0, 0, 479, 3084, 1, 0, 0, 0, 481, 3092, 1, 0, 0, 0, 483, 3102, 1, 0, 0, 0, 485, 3106, 1, 0, 0, 0, 487, 3112, 1, 0, 0, 0, 489, 3121, 1, 0, 0, 0, 491, 3127, 1, 0, 0, 0, 493, 3132, 1, 0, 0, 0, 495, 3142, 1, 0, 0, 0, 497, 3148, 1, 0, 0, 0, 499, 3155, 1, 0, 0, 0, 501, 3160, 1, 0, 0, 0, 503, 3166, 1, 0, 0, 0, 505, 3175, 1, 0, 0, 0, 507, 3180, 1, 0, 0, 0, 509, 3188, 1, 0, 0, 0, 511, 3194, 1, 0, 0, 0, 513, 3202, 1, 0, 0, 0, 515, 3215, 1, 0, 0, 0, 517, 3224, 1, 0, 0, 0, 519, 3230, 1, 0, 0, 0, 521, 3237, 1, 0, 0, 0, 523, 3246, 1, 0, 0, 0, 525, 3251, 1, 0, 0, 0, 527, 3257, 1, 0, 0, 0, 529, 3262, 1, 0, 0, 0, 531, 3267, 1, 0, 0, 0, 533, 3273, 1, 0, 0, 0, 535, 3278, 1, 0, 0, 0, 537, 3281, 1, 0, 0, 0, 539, 3289, 1, 0, 0, 0, 541, 3296, 1, 0, 0, 0, 543, 3303, 1, 0, 0, 0, 545, 3309, 1, 0, 0, 0, 547, 3316, 1, 0, 0, 0, 549, 3319, 1, 0, 0, 0, 551, 3323, 1, 0, 0, 0, 553, 3328, 1, 0, 0, 0, 555, 3337, 1, 0, 0, 0, 557, 3344, 1, 0, 0, 0, 559, 3352, 1, 0, 0, 0, 561, 3358, 1, 0, 0, 0, 563, 3364, 1, 0, 0, 0, 565, 3371, 1, 0, 0, 0, 567, 3379, 1, 0, 0, 0, 569, 3389, 1, 0, 0, 0, 571, 3397, 1, 0, 0, 0, 573, 3406, 1, 0, 0, 0, 575, 3412, 1, 0, 0, 0, 577, 3422, 1, 0, 0, 0, 579, 3430, 1, 0, 0, 0, 581, 3439, 1, 0, 0, 0, 583, 3448, 1, 0, 0, 0, 585, 3454, 1, 0, 0, 0, 587, 3465, 1, 0, 0, 0, 589, 3476, 1, 0, 0, 0, 591, 3486, 1, 0, 0, 0, 593, 3494, 1, 0, 0, 0, 595, 3500, 1, 0, 0, 0, 597, 3506, 1, 0, 0, 0, 599, 3511, 1, 0, 0, 0, 601, 3520, 1, 0, 0, 0, 603, 3528, 1, 0, 0, 0, 605, 3538, 1, 0, 0, 0, 607, 3542, 1, 0, 0, 0, 609, 3550, 1, 0, 0, 0, 611, 3558, 1, 0, 0, 0, 613, 3567, 1, 0, 0, 0, 615, 3575, 1, 0, 0, 0, 617, 3582, 1, 0, 0, 0, 619, 3593, 1, 0, 0, 0, 621, 3601, 1, 0, 0, 0, 623, 3609, 1, 0, 0, 0, 625, 3615, 1, 0, 0, 0, 627, 3623, 1, 0, 0, 0, 629, 3632, 1, 0, 0, 0, 631, 3640, 1, 0, 0, 0, 633, 3647, 1, 0, 0, 0, 635, 3652, 1, 0, 0, 0, 637, 3661, 1, 0, 0, 0, 639, 3666, 1, 0, 0, 0, 641, 3671, 1, 0, 0, 0, 643, 3681, 1, 0, 0, 0, 645, 3688, 1, 0, 0, 0, 647, 3695, 1, 0, 0, 0, 649, 3702, 1, 0, 0, 0, 651, 3709, 1, 0, 0, 0, 653, 3718, 1, 0, 0, 0, 655, 3727, 1, 0, 0, 0, 657, 3737, 1, 0, 0, 0, 659, 3750, 1, 0, 0, 0, 661, 3757, 1, 0, 0, 0, 663, 3765, 1, 0, 0, 0, 665, 3769, 1, 0, 0, 0, 667, 3775, 1, 0, 0, 0, 669, 3780, 1, 0, 0, 0, 671, 3787, 1, 0, 0, 0, 673, 3796, 1, 0, 0, 0, 675, 3803, 1, 0, 0, 0, 677, 3814, 1, 0, 0, 0, 679, 3820, 1, 0, 0, 0, 681, 3830, 1, 0, 0, 0, 683, 3841, 1, 0, 0, 0, 685, 3847, 1, 0, 0, 0, 687, 3854, 1, 0, 0, 0, 689, 3862, 1, 0, 0, 0, 691, 3869, 1, 0, 0, 0, 693, 3875, 1, 0, 0, 0, 695, 3881, 1, 0, 0, 0, 697, 3888, 1, 0, 0, 0, 699, 3895, 1, 0, 0, 0, 701, 3906, 1, 0, 0, 0, 703, 3911, 1, 0, 0, 0, 705, 3920, 1, 0, 0, 0, 707, 3930, 1, 0, 0, 0, 709, 3935, 1, 0, 0, 0, 711, 3947, 1, 0, 0, 0, 713, 3955, 1, 0, 0, 0, 715, 3964, 1, 0, 0, 0, 717, 3972, 1, 0, 0, 0, 719, 3977, 1, 0, 0, 0, 721, 3983, 1, 0, 0, 0, 723, 3993, 1, 0, 0, 0, 725, 4005, 1, 0, 0, 0, 727, 4017, 1, 0, 0, 0, 729, 4025, 1, 0, 0, 0, 731, 4034, 1, 0, 0, 0, 733, 4043, 1, 0, 0, 0, 735, 4049, 1, 0, 0, 0, 737, 4056, 1, 0, 0, 0, 739, 4063, 1, 0, 0, 0, 741, 4069, 1, 0, 0, 0, 743, 4078, 1, 0, 0, 0, 745, 4088, 1, 0, 0, 0, 747, 4096, 1, 0, 0, 0, 749, 4104, 1, 0, 0, 0, 751, 4109, 1, 0, 0, 0, 753, 4118, 1, 0, 0, 0, 755, 4129, 1, 0, 0, 0, 757, 4137, 1, 0, 0, 0, 759, 4142, 1, 0, 0, 0, 761, 4150, 1, 0, 0, 0, 763, 4156, 1, 0, 0, 0, 765, 4160, 1, 0, 0, 0, 767, 4165, 1, 0, 0, 0, 769, 4169, 1, 0, 0, 0, 771, 4174, 1, 0, 0, 0, 773, 4181, 1, 0, 0, 0, 775, 4189, 1, 0, 0, 0, 777, 4196, 1, 0, 0, 0, 779, 4200, 1, 0, 0, 0, 781, 4208, 1, 0, 0, 0, 783, 4213, 1, 0, 0, 0, 785, 4223, 1, 0, 0, 0, 787, 4232, 1, 0, 0, 0, 789, 4236, 1, 0, 0, 0, 791, 4244, 1, 0, 0, 0, 793, 4251, 1, 0, 0, 0, 795, 4259, 1, 0, 0, 0, 797, 4265, 1, 0, 0, 0, 799, 4274, 1, 0, 0, 0, 801, 4280, 1, 0, 0, 0, 803, 4284, 1, 0, 0, 0, 805, 4292, 1, 0, 0, 0, 807, 4301, 1, 0, 0, 0, 809, 4307, 1, 0, 0, 0, 811, 4316, 1, 0, 0, 0, 813, 4322, 1, 0, 0, 0, 815, 4327, 1, 0, 0, 0, 817, 4334, 1, 0, 0, 0, 819, 4342, 1, 0, 0, 0, 821, 4350, 1, 0, 0, 0, 823, 4360, 1, 0, 0, 0, 825, 4369, 1, 0, 0, 0, 827, 4379, 1, 0, 0, 0, 829, 4384, 1, 0, 0, 0, 831, 4388, 1, 0, 0, 0, 833, 4394, 1, 0, 0, 0, 835, 4403, 1, 0, 0, 0, 837, 4413, 1, 0, 0, 0, 839, 4418, 1, 0, 0, 0, 841, 4428, 1, 0, 0, 0, 843, 4434, 1, 0, 0, 0, 845, 4439, 1, 0, 0, 0, 847, 4446, 1, 0, 0, 0, 849, 4454, 1, 0, 0, 0, 851, 4468, 1, 0, 0, 0, 853, 4479, 1, 0, 0, 0, 855, 4486, 1, 0, 0, 0, 857, 4505, 1, 0, 0, 0, 859, 4533, 1, 0, 0, 0, 861, 4560, 1, 0, 0, 0, 863, 4566, 1, 0, 0, 0, 865, 4579, 1, 0, 0, 0, 867, 4589, 1, 0, 0, 0, 869, 4600, 1, 0, 0, 0, 871, 4610, 1, 0, 0, 0, 873, 4620, 1, 0, 0, 0, 875, 4629, 1, 0, 0, 0, 877, 4635, 1, 0, 0, 0, 879, 4643, 1, 0, 0, 0, 881, 4656, 1, 0, 0, 0, 883, 4661, 1, 0, 0, 0, 885, 4669, 1, 0, 0, 0, 887, 4676, 1, 0, 0, 0, 889, 4683, 1, 0, 0, 0, 891, 4694, 1, 0, 0, 0, 893, 4704, 1, 0, 0, 0, 895, 4711, 1, 0, 0, 0, 897, 4718, 1, 0, 0, 0, 899, 4726, 1, 0, 0, 0, 901, 4734, 1, 0, 0, 0, 903, 4744, 1, 0, 0, 0, 905, 4751, 1, 0, 0, 0, 907, 4758, 1, 0, 0, 0, 909, 4765, 1, 0, 0, 0, 911, 4777, 1, 0, 0, 0, 913, 4781, 1, 0, 0, 0, 915, 4785, 1, 0, 0, 0, 917, 4791, 1, 0, 0, 0, 919, 4804, 1, 0, 0, 0, 921, 4816, 1, 0, 0, 0, 923, 4820, 1, 0, 0, 0, 925, 4824, 1, 0, 0, 0, 927, 4833, 1, 0, 0, 0, 929, 4841, 1, 0, 0, 0, 931, 4852, 1, 0, 0, 0, 933, 4858, 1, 0, 0, 0, 935, 4866, 1, 0, 0, 0, 937, 4875, 1, 0, 0, 0, 939, 4879, 1, 0, 0, 0, 941, 4887, 1, 0, 0, 0, 943, 4898, 1, 0, 0, 0, 945, 4907, 1, 0, 0, 0, 947, 4912, 1, 0, 0, 0, 949, 4919, 1, 0, 0, 0, 951, 4924, 1, 0, 0, 0, 953, 4931, 1, 0, 0, 0, 955, 4936, 1, 0, 0, 0, 957, 4945, 1, 0, 0, 0, 959, 4950, 1, 0, 0, 0, 961, 4962, 1, 0, 0, 0, 963, 4973, 1, 0, 0, 0, 965, 4982, 1, 0, 0, 0, 967, 4990, 1, 0, 0, 0, 969, 5004, 1, 0, 0, 0, 971, 5012, 1, 0, 0, 0, 973, 5023, 1, 0, 0, 0, 975, 5030, 1, 0, 0, 0, 977, 5037, 1, 0, 0, 0, 979, 5044, 1, 0, 0, 0, 981, 5051, 1, 0, 0, 0, 983, 5055, 1, 0, 0, 0, 985, 5059, 1, 0, 0, 0, 987, 5064, 1, 0, 0, 0, 989, 5069, 1, 0, 0, 0, 991, 5077, 1, 0, 0, 0, 993, 5083, 1, 0, 0, 0, 995, 5093, 1, 0, 0, 0, 997, 5098, 1, 0, 0, 0, 999, 5118, 1, 0, 0, 0, 1001, 5136, 1, 0, 0, 0, 1003, 5142, 1, 0, 0, 0, 1005, 5155, 1, 0, 0, 0, 1007, 5166, 1, 0, 0, 0, 1009, 5172, 1, 0, 0, 0, 1011, 5181, 1, 0, 0, 0, 1013, 5189, 1, 0, 0, 0, 1015, 5193, 1, 0, 0, 0, 1017, 5205, 1, 0, 0, 0, 1019, 5213, 1, 0, 0, 0, 1021, 5219, 1, 0, 0, 0, 1023, 5225, 1, 0, 0, 0, 1025, 5233, 1, 0, 0, 0, 1027, 5241, 1, 0, 0, 0, 1029, 5247, 1, 0, 0, 0, 1031, 5252, 1, 0, 0, 0, 1033, 5259, 1, 0, 0, 0, 1035, 5265, 1, 0, 0, 0, 1037, 5271, 1, 0, 0, 0, 1039, 5280, 1, 0, 0, 0, 1041, 5286, 1, 0, 0, 0, 1043, 5290, 1, 0, 0, 0, 1045, 5295, 1, 0, 0, 0, 1047, 5302, 1, 0, 0, 0, 1049, 5310, 1, 0, 0, 0, 1051, 5320, 1, 0, 0, 0, 1053, 5327, 1, 0, 0, 0, 1055, 5332, 1, 0, 0, 0, 1057, 5337, 1, 0, 0, 0, 1059, 5341, 1, 0, 0, 0, 1061, 5346, 1, 0, 0, 0, 1063, 5351, 1, 0, 0, 0, 1065, 5359, 1, 0, 0, 0, 1067, 5367, 1, 0, 0, 0, 1069, 5371, 1, 0, 0, 0, 1071, 5375, 1, 0, 0, 0, 1073, 5385, 1, 0, 0, 0, 1075, 5391, 1, 0, 0, 0, 1077, 5395, 1, 0, 0, 0, 1079, 5399, 1, 0, 0, 0, 1081, 5402, 1, 0, 0, 0, 1083, 5408, 1, 0, 0, 0, 1085, 5418, 1, 0, 0, 0, 1087, 5422, 1, 0, 0, 0, 1089, 5425, 1, 0, 0, 0, 1091, 5431, 1, 0, 0, 0, 1093, 5439, 1, 0, 0, 0, 1095, 5445, 1, 0, 0, 0, 1097, 5451, 1, 0, 0, 0, 1099, 5456, 1, 0, 0, 0, 1101, 5461, 1, 0, 0, 0, 1103, 5472, 1, 0, 0, 0, 1105, 5478, 1, 0, 0, 0, 1107, 5491, 1, 0, 0, 0, 1109, 5498, 1, 0, 0, 0, 1111, 5506, 1, 0, 0, 0, 1113, 5511, 1, 0, 0, 0, 1115, 5517, 1, 0, 0, 0, 1117, 5522, 1, 0, 0, 0, 1119, 5528, 1, 0, 0, 0, 1121, 5533, 1, 0, 0, 0, 1123, 5539, 1, 0, 0, 0, 1125, 5545, 1, 0, 0, 0, 1127, 5552, 1, 0, 0, 0, 1129, 5556, 1, 0, 0, 0, 1131, 5561, 1, 0, 0, 0, 1133, 5565, 1, 0, 0, 0, 1135, 5570, 1, 0, 0, 0, 1137, 5574, 1, 0, 0, 0, 1139, 5579, 1, 0, 0, 0, 1141, 5583, 1, 0, 0, 0, 1143, 5588, 1, 0, 0, 0, 1145, 5593, 1, 0, 0, 0, 1147, 5598, 1, 0, 0, 0, 1149, 5603, 1, 0, 0, 0, 1151, 5609, 1, 0, 0, 0, 1153, 5615, 1, 0, 0, 0, 1155, 5621, 1, 0, 0, 0, 1157, 5632, 1, 0, 0, 0, 1159, 5644, 1, 0, 0, 0, 1161, 5661, 1, 0, 0, 0, 1163, 5667, 1, 0, 0, 0, 1165, 5680, 1, 0, 0, 0, 1167, 5686, 1, 0, 0, 0, 1169, 5692, 1, 0, 0, 0, 1171, 5698, 1, 0, 0, 0, 1173, 5702, 1, 0, 0, 0, 1175, 5709, 1, 0, 0, 0, 1177, 5719, 1, 0, 0, 0, 1179, 5726, 1, 0, 0, 0, 1181, 5734, 1, 0, 0, 0, 1183, 5741, 1, 0, 0, 0, 1185, 5746, 1, 0, 0, 0, 1187, 5752, 1, 0, 0, 0, 1189, 5756, 1, 0, 0, 0, 1191, 5768, 1, 0, 0, 0, 1193, 5787, 1, 0, 0, 0, 1195, 5799, 1, 0, 0, 0, 1197, 5813, 1, 0, 0, 0, 1199, 5828, 1, 0, 0, 0, 1201, 5841, 1, 0, 0, 0, 1203, 5854, 1, 0, 0, 0, 1205, 5866, 1, 0, 0, 0, 1207, 5879, 1, 0, 0, 0, 1209, 5894, 1, 0, 0, 0, 1211, 5909, 1, 0, 0, 0, 1213, 5931, 1, 0, 0, 0, 1215, 5953, 1, 0, 0, 0, 1217, 5967, 1, 0, 0, 0, 1219, 5974, 1, 0, 0, 0, 1221, 5979, 1, 0, 0, 0, 1223, 5985, 1, 0, 0, 0, 1225, 5996, 1, 0, 0, 0, 1227, 6008, 1, 0, 0, 0, 1229, 6024, 1, 0, 0, 0, 1231, 6040, 1, 0, 0, 0, 1233, 6047, 1, 0, 0, 0, 1235, 6054, 1, 0, 0, 0, 1237, 6063, 1, 0, 0, 0, 1239, 6070, 1, 0, 0, 0, 1241, 6080, 1, 0, 0, 0, 1243, 6087, 1, 0, 0, 0, 1245, 6091, 1, 0, 0, 0, 1247, 6107, 1, 0, 0, 0, 1249, 6116, 1, 0, 0, 0, 1251, 6126, 1, 0, 0, 0, 1253, 6137, 1, 0, 0, 0, 1255, 6146, 1, 0, 0, 0, 1257, 6159, 1, 0, 0, 0, 1259, 6173, 1, 0, 0, 0, 1261, 6190, 1, 0, 0, 0, 1263, 6200, 1, 0, 0, 0, 1265, 6214, 1, 0, 0, 0, 1267, 6224, 1, 0, 0, 0, 1269, 6239, 1, 0, 0, 0, 1271, 6256, 1, 0, 0, 0, 1273, 6260, 1, 0, 0, 0, 1275, 6280, 1, 0, 0, 0, 1277, 6290, 1, 0, 0, 0, 1279, 6312, 1, 0, 0, 0, 1281, 6325, 1, 0, 0, 0, 1283, 6333, 1, 0, 0, 0, 1285, 6341, 1, 0, 0, 0, 1287, 6351, 1, 0, 0, 0, 1289, 6358, 1, 0, 0, 0, 1291, 6366, 1, 0, 0, 0, 1293, 6374, 1, 0, 0, 0, 1295, 6389, 1, 0, 0, 0, 1297, 6406, 1, 0, 0, 0, 1299, 6419, 1, 0, 0, 0, 1301, 6423, 1, 0, 0, 0, 1303, 6427, 1, 0, 0, 0, 1305, 6429, 1, 0, 0, 0, 1307, 6432, 1, 0, 0, 0, 1309, 6441, 1, 0, 0, 0, 1311, 6444, 1, 0, 0, 0, 1313, 6453, 1, 0, 0, 0, 1315, 6457, 1, 0, 0, 0, 1317, 6461, 1, 0, 0, 0, 1319, 6465, 1, 0, 0, 0, 1321, 6469, 1, 0, 0, 0, 1323, 6472, 1, 0, 0, 0, 1325, 6481, 1, 0, 0, 0, 1327, 6487, 1, 0, 0, 0, 1329, 6490, 1, 0, 0, 0, 1331, 6494, 1, 0, 0, 0, 1333, 6503, 1, 0, 0, 0, 1335, 6510, 1, 0, 0, 0, 1337, 6513, 1, 0, 0, 0, 1339, 6521, 1, 0, 0, 0, 1341, 6524, 1, 0, 0, 0, 1343, 6527, 1, 0, 0, 0, 1345, 6530, 1, 0, 0, 0, 1347, 6538, 1, 0, 0, 0, 1349, 6541, 1, 0, 0, 0, 1351, 6544, 1, 0, 0, 0, 1353, 6546, 1, 0, 0, 0, 1355, 6580, 1, 0, 0, 0, 1357, 6583, 1, 0, 0, 0, 1359, 6587, 1, 0, 0, 0, 1361, 6595, 1, 0, 0, 0, 1363, 6610, 1, 0, 0, 0, 1365, 6619, 1, 0, 0, 0, 1367, 6623, 1, 0, 0, 0, 1369, 6634, 1, 0, 0, 0, 1371, 6673, 1, 0, 0, 0, 1373, 6724, 1, 0, 0, 0, 1375, 6748, 1, 0, 0, 0, 1377, 6751, 1, 0, 0, 0, 1379, 6753, 1, 0, 0, 0, 1381, 6758, 1, 0, 0, 0, 1383, 6789, 1, 0, 0, 0, 1385, 6792, 1, 0, 0, 0, 1387, 6797, 1, 0, 0, 0, 1389, 6810, 1, 0, 0, 0, 1391, 6813, 1, 0, 0, 0, 1393, 6818, 1, 0, 0, 0, 1395, 6824, 1, 0, 0, 0, 1397, 6829, 1, 0, 0, 0, 1399, 6834, 1, 0, 0, 0, 1401, 6839, 1, 0, 0, 0, 1403, 6844, 1, 0, 0, 0, 1405, 6861, 1, 0, 0, 0, 1407, 6863, 1, 0, 0, 0, 1409, 1410, 5, 36, 0, 0, 1410, 6, 1, 0, 0, 0, 1411, 1412, 5, 40, 0, 0, 1412, 8, 1, 0, 0, 0, 1413, 1414, 5, 41, 0, 0, 1414, 10, 1, 0, 0, 0, 1415, 1416, 5, 91, 0, 0, 1416, 12, 1, 0, 0, 0, 1417, 1418, 5, 93, 0, 0, 1418, 14, 1, 0, 0, 0, 1419, 1420, 5, 44, 0, 0, 1420, 16, 1, 0, 0, 0, 1421, 1422, 5, 59, 0, 0, 1422, 18, 1, 0, 0, 0, 1423, 1424, 5, 58, 0, 0, 1424, 20, 1, 0, 0, 0, 1425, 1426, 5, 42, 0, 0, 1426, 22, 1, 0, 0, 0, 1427, 1428, 5, 61, 0, 0, 1428, 24, 1, 0, 0, 0, 1429, 1430, 5, 46, 0, 0, 1430, 26, 1, 0, 0, 0, 1431, 1432, 5, 43, 0, 0, 1432, 28, 1, 0, 0, 0, 1433, 1434, 5, 45, 0, 0, 1434, 30, 1, 0, 0, 0, 1435, 1436, 5, 47, 0, 0, 1436, 32, 1, 0, 0, 0, 1437, 1438, 5, 94, 0, 0, 1438, 34, 1, 0, 0, 0, 1439, 1440, 5, 60, 0, 0, 1440, 36, 1, 0, 0, 0, 1441, 1442, 5, 62, 0, 0, 1442, 38, 1, 0, 0, 0, 1443, 1444, 5, 60, 0, 0, 1444, 1445, 5, 60, 0, 0, 1445, 40, 1, 0, 0, 0, 1446, 1447, 5, 62, 0, 0, 1447, 1448, 5, 62, 0, 0, 1448, 42, 1, 0, 0, 0, 1449, 1450, 5, 58, 0, 0, 1450, 1451, 5, 61, 0, 0, 1451, 44, 1, 0, 0, 0, 1452, 1453, 5, 60, 0, 0, 1453, 1454, 5, 61, 0, 0, 1454, 46, 1, 0, 0, 0, 1455, 1456, 5, 61, 0, 0, 1456, 1457, 5, 62, 0, 0, 1457, 48, 1, 0, 0, 0, 1458, 1459, 5, 62, 0, 0, 1459, 1460, 5, 61, 0, 0, 1460, 50, 1, 0, 0, 0, 1461, 1462, 5, 46, 0, 0, 1462, 1463, 5, 46, 0, 0, 1463, 52, 1, 0, 0, 0, 1464, 1465, 5, 60, 0, 0, 1465, 1466, 5, 62, 0, 0, 1466, 54, 1, 0, 0, 0, 1467, 1468, 5, 58, 0, 0, 1468, 1469, 5, 58, 0, 0, 1469, 56, 1, 0, 0, 0, 1470, 1471, 5, 37, 0, 0, 1471, 58, 1, 0, 0, 0, 1472, 1474, 5, 36, 0, 0, 1473, 1475, 7, 0, 0, 0, 1474, 1473, 1, 0, 0, 0, 1475, 1476, 1, 0, 0, 0, 1476, 1474, 1, 0, 0, 0, 1476, 1477, 1, 0, 0, 0, 1477, 60, 1, 0, 0, 0, 1478, 1494, 3, 65, 30, 0, 1479, 1483, 5, 43, 0, 0, 1480, 1481, 5, 45, 0, 0, 1481, 1483, 4, 28, 0, 0, 1482, 1479, 1, 0, 0, 0, 1482, 1480, 1, 0, 0, 0, 1483, 1484, 1, 0, 0, 0, 1484, 1482, 1, 0, 0, 0, 1484, 1485, 1, 0, 0, 0, 1485, 1489, 1, 0, 0, 0, 1486, 1490, 3, 65, 30, 0, 1487, 1488, 5, 47, 0, 0, 1488, 1490, 4, 28, 1, 0, 1489, 1486, 1, 0, 0, 0, 1489, 1487, 1, 0, 0, 0, 1490, 1494, 1, 0, 0, 0, 1491, 1492, 5, 47, 0, 0, 1492, 1494, 4, 28, 2, 0, 1493, 1478, 1, 0, 0, 0, 1493, 1482, 1, 0, 0, 0, 1493, 1491, 1, 0, 0, 0, 1494, 1495, 1, 0, 0, 0, 1495, 1493, 1, 0, 0, 0, 1495, 1496, 1, 0, 0, 0, 1496, 1499, 1, 0, 0, 0, 1497, 1499, 7, 1, 0, 0, 1498, 1493, 1, 0, 0, 0, 1498, 1497, 1, 0, 0, 0, 1499, 1500, 1, 0, 0, 0, 1500, 1501, 6, 28, 0, 0, 1501, 62, 1, 0, 0, 0, 1502, 1508, 3, 67, 31, 0, 1503, 1504, 5, 45, 0, 0, 1504, 1508, 4, 29, 3, 0, 1505, 1506, 5, 47, 0, 0, 1506, 1508, 4, 29, 4, 0, 1507, 1502, 1, 0, 0, 0, 1507, 1503, 1, 0, 0, 0, 1507, 1505, 1, 0, 0, 0, 1508, 1511, 1, 0, 0, 0, 1509, 1507, 1, 0, 0, 0, 1509, 1510, 1, 0, 0, 0, 1510, 1512, 1, 0, 0, 0, 1511, 1509, 1, 0, 0, 0, 1512, 1514, 3, 69, 32, 0, 1513, 1515, 3, 61, 28, 0, 1514, 1513, 1, 0, 0, 0, 1514, 1515, 1, 0, 0, 0, 1515, 1519, 1, 0, 0, 0, 1516, 1520, 5, 43, 0, 0, 1517, 1518, 5, 45, 0, 0, 1518, 1520, 4, 29, 5, 0, 1519, 1516, 1, 0, 0, 0, 1519, 1517, 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1519, 1, 0, 0, 0, 1521, 1522, 1, 0, 0, 0, 1522, 1523, 1, 0, 0, 0, 1523, 1524, 6, 29, 1, 0, 1524, 64, 1, 0, 0, 0, 1525, 1526, 7, 2, 0, 0, 1526, 66, 1, 0, 0, 0, 1527, 1528, 7, 3, 0, 0, 1528, 68, 1, 0, 0, 0, 1529, 1530, 7, 4, 0, 0, 1530, 70, 1, 0, 0, 0, 1531, 1532, 7, 5, 0, 0, 1532, 1533, 7, 6, 0, 0, 1533, 1534, 7, 6, 0, 0, 1534, 72, 1, 0, 0, 0, 1535, 1536, 7, 5, 0, 0, 1536, 1537, 7, 7, 0, 0, 1537, 1538, 7, 5, 0, 0, 1538, 1539, 7, 6, 0, 0, 1539, 1540, 7, 8, 0, 0, 1540, 1541, 7, 9, 0, 0, 1541, 1542, 7, 10, 0, 0, 1542, 74, 1, 0, 0, 0, 1543, 1544, 7, 5, 0, 0, 1544, 1545, 7, 7, 0, 0, 1545, 1546, 7, 5, 0, 0, 1546, 1547, 7, 6, 0, 0, 1547, 1548, 7, 8, 0, 0, 1548, 1549, 7, 11, 0, 0, 1549, 1550, 7, 10, 0, 0, 1550, 76, 1, 0, 0, 0, 1551, 1552, 7, 5, 0, 0, 1552, 1553, 7, 7, 0, 0, 1553, 1554, 7, 12, 0, 0, 1554, 78, 1, 0, 0, 0, 1555, 1556, 7, 5, 0, 0, 1556, 1557, 7, 7, 0, 0, 1557, 1558, 7, 8, 0, 0, 1558, 80, 1, 0, 0, 0, 1559, 1560, 7, 5, 0, 0, 1560, 1561, 7, 13, 0, 0, 1561, 1562, 7, 13, 0, 0, 1562, 1563, 7, 5, 0, 0, 1563, 1564, 7, 8, 0, 0, 1564, 82, 1, 0, 0, 0, 1565, 1566, 7, 5, 0, 0, 1566, 1567, 7, 9, 0, 0, 1567, 84, 1, 0, 0, 0, 1568, 1569, 7, 5, 0, 0, 1569, 1570, 7, 9, 0, 0, 1570, 1571, 7, 14, 0, 0, 1571, 86, 1, 0, 0, 0, 1572, 1573, 7, 5, 0, 0, 1573, 1574, 7, 9, 0, 0, 1574, 1575, 7, 8, 0, 0, 1575, 1576, 7, 15, 0, 0, 1576, 1577, 7, 15, 0, 0, 1577, 1578, 7, 10, 0, 0, 1578, 1579, 7, 16, 0, 0, 1579, 1580, 7, 13, 0, 0, 1580, 1581, 7, 17, 0, 0, 1581, 1582, 7, 14, 0, 0, 1582, 88, 1, 0, 0, 0, 1583, 1584, 7, 18, 0, 0, 1584, 1585, 7, 19, 0, 0, 1585, 1586, 7, 16, 0, 0, 1586, 1587, 7, 20, 0, 0, 1587, 90, 1, 0, 0, 0, 1588, 1589, 7, 14, 0, 0, 1589, 1590, 7, 5, 0, 0, 1590, 1591, 7, 9, 0, 0, 1591, 1592, 7, 10, 0, 0, 1592, 92, 1, 0, 0, 0, 1593, 1594, 7, 14, 0, 0, 1594, 1595, 7, 5, 0, 0, 1595, 1596, 7, 9, 0, 0, 1596, 1597, 7, 16, 0, 0, 1597, 94, 1, 0, 0, 0, 1598, 1599, 7, 14, 0, 0, 1599, 1600, 7, 20, 0, 0, 1600, 1601, 7, 10, 0, 0, 1601, 1602, 7, 14, 0, 0, 1602, 1603, 7, 21, 0, 0, 1603, 96, 1, 0, 0, 0, 1604, 1605, 7, 14, 0, 0, 1605, 1606, 7, 19, 0, 0, 1606, 1607, 7, 6, 0, 0, 1607, 1608, 7, 6, 0, 0, 1608, 1609, 7, 5, 0, 0, 1609, 1610, 7, 16, 0, 0, 1610, 1611, 7, 10, 0, 0, 1611, 98, 1, 0, 0, 0, 1612, 1613, 7, 14, 0, 0, 1613, 1614, 7, 19, 0, 0, 1614, 1615, 7, 6, 0, 0, 1615, 1616, 7, 22, 0, 0, 1616, 1617, 7, 15, 0, 0, 1617, 1618, 7, 7, 0, 0, 1618, 100, 1, 0, 0, 0, 1619, 1620, 7, 14, 0, 0, 1620, 1621, 7, 19, 0, 0, 1621, 1622, 7, 7, 0, 0, 1622, 1623, 7, 9, 0, 0, 1623, 1624, 7, 16, 0, 0, 1624, 1625, 7, 13, 0, 0, 1625, 1626, 7, 5, 0, 0, 1626, 1627, 7, 17, 0, 0, 1627, 1628, 7, 7, 0, 0, 1628, 1629, 7, 16, 0, 0, 1629, 102, 1, 0, 0, 0, 1630, 1631, 7, 14, 0, 0, 1631, 1632, 7, 13, 0, 0, 1632, 1633, 7, 10, 0, 0, 1633, 1634, 7, 5, 0, 0, 1634, 1635, 7, 16, 0, 0, 1635, 1636, 7, 10, 0, 0, 1636, 104, 1, 0, 0, 0, 1637, 1638, 7, 14, 0, 0, 1638, 1639, 7, 22, 0, 0, 1639, 1640, 7, 13, 0, 0, 1640, 1641, 7, 13, 0, 0, 1641, 1642, 7, 10, 0, 0, 1642, 1643, 7, 7, 0, 0, 1643, 1644, 7, 16, 0, 0, 1644, 1645, 5, 95, 0, 0, 1645, 1646, 7, 14, 0, 0, 1646, 1647, 7, 5, 0, 0, 1647, 1648, 7, 16, 0, 0, 1648, 1649, 7, 5, 0, 0, 1649, 1650, 7, 6, 0, 0, 1650, 1651, 7, 19, 0, 0, 1651, 1652, 7, 23, 0, 0, 1652, 106, 1, 0, 0, 0, 1653, 1654, 7, 14, 0, 0, 1654, 1655, 7, 22, 0, 0, 1655, 1656, 7, 13, 0, 0, 1656, 1657, 7, 13, 0, 0, 1657, 1658, 7, 10, 0, 0, 1658, 1659, 7, 7, 0, 0, 1659, 1660, 7, 16, 0, 0, 1660, 1661, 5, 95, 0, 0, 1661, 1662, 7, 12, 0, 0, 1662, 1663, 7, 5, 0, 0, 1663, 1664, 7, 16, 0, 0, 1664, 1665, 7, 10, 0, 0, 1665, 108, 1, 0, 0, 0, 1666, 1667, 7, 14, 0, 0, 1667, 1668, 7, 22, 0, 0, 1668, 1669, 7, 13, 0, 0, 1669, 1670, 7, 13, 0, 0, 1670, 1671, 7, 10, 0, 0, 1671, 1672, 7, 7, 0, 0, 1672, 1673, 7, 16, 0, 0, 1673, 1674, 5, 95, 0, 0, 1674, 1675, 7, 13, 0, 0, 1675, 1676, 7, 19, 0, 0, 1676, 1677, 7, 6, 0, 0, 1677, 1678, 7, 10, 0, 0, 1678, 110, 1, 0, 0, 0, 1679, 1680, 7, 14, 0, 0, 1680, 1681, 7, 22, 0, 0, 1681, 1682, 7, 13, 0, 0, 1682, 1683, 7, 13, 0, 0, 1683, 1684, 7, 10, 0, 0, 1684, 1685, 7, 7, 0, 0, 1685, 1686, 7, 16, 0, 0, 1686, 1687, 5, 95, 0, 0, 1687, 1688, 7, 16, 0, 0, 1688, 1689, 7, 17, 0, 0, 1689, 1690, 7, 15, 0, 0, 1690, 1691, 7, 10, 0, 0, 1691, 112, 1, 0, 0, 0, 1692, 1693, 7, 14, 0, 0, 1693, 1694, 7, 22, 0, 0, 1694, 1695, 7, 13, 0, 0, 1695, 1696, 7, 13, 0, 0, 1696, 1697, 7, 10, 0, 0, 1697, 1698, 7, 7, 0, 0, 1698, 1699, 7, 16, 0, 0, 1699, 1700, 5, 95, 0, 0, 1700, 1701, 7, 16, 0, 0, 1701, 1702, 7, 17, 0, 0, 1702, 1703, 7, 15, 0, 0, 1703, 1704, 7, 10, 0, 0, 1704, 1705, 7, 9, 0, 0, 1705, 1706, 7, 16, 0, 0, 1706, 1707, 7, 5, 0, 0, 1707, 1708, 7, 15, 0, 0, 1708, 1709, 7, 24, 0, 0, 1709, 114, 1, 0, 0, 0, 1710, 1711, 7, 14, 0, 0, 1711, 1712, 7, 22, 0, 0, 1712, 1713, 7, 13, 0, 0, 1713, 1714, 7, 13, 0, 0, 1714, 1715, 7, 10, 0, 0, 1715, 1716, 7, 7, 0, 0, 1716, 1717, 7, 16, 0, 0, 1717, 1718, 5, 95, 0, 0, 1718, 1719, 7, 22, 0, 0, 1719, 1720, 7, 9, 0, 0, 1720, 1721, 7, 10, 0, 0, 1721, 1722, 7, 13, 0, 0, 1722, 116, 1, 0, 0, 0, 1723, 1724, 7, 12, 0, 0, 1724, 1725, 7, 10, 0, 0, 1725, 1726, 7, 25, 0, 0, 1726, 1727, 7, 5, 0, 0, 1727, 1728, 7, 22, 0, 0, 1728, 1729, 7, 6, 0, 0, 1729, 1730, 7, 16, 0, 0, 1730, 118, 1, 0, 0, 0, 1731, 1732, 7, 12, 0, 0, 1732, 1733, 7, 10, 0, 0, 1733, 1734, 7, 25, 0, 0, 1734, 1735, 7, 10, 0, 0, 1735, 1736, 7, 13, 0, 0, 1736, 1737, 7, 13, 0, 0, 1737, 1738, 7, 5, 0, 0, 1738, 1739, 7, 18, 0, 0, 1739, 1740, 7, 6, 0, 0, 1740, 1741, 7, 10, 0, 0, 1741, 120, 1, 0, 0, 0, 1742, 1743, 7, 12, 0, 0, 1743, 1744, 7, 10, 0, 0, 1744, 1745, 7, 9, 0, 0, 1745, 1746, 7, 14, 0, 0, 1746, 122, 1, 0, 0, 0, 1747, 1748, 7, 12, 0, 0, 1748, 1749, 7, 17, 0, 0, 1749, 1750, 7, 9, 0, 0, 1750, 1751, 7, 16, 0, 0, 1751, 1752, 7, 17, 0, 0, 1752, 1753, 7, 7, 0, 0, 1753, 1754, 7, 14, 0, 0, 1754, 1755, 7, 16, 0, 0, 1755, 124, 1, 0, 0, 0, 1756, 1757, 7, 12, 0, 0, 1757, 1758, 7, 19, 0, 0, 1758, 126, 1, 0, 0, 0, 1759, 1760, 7, 10, 0, 0, 1760, 1761, 7, 6, 0, 0, 1761, 1762, 7, 9, 0, 0, 1762, 1763, 7, 10, 0, 0, 1763, 128, 1, 0, 0, 0, 1764, 1765, 7, 10, 0, 0, 1765, 1766, 7, 26, 0, 0, 1766, 1767, 7, 14, 0, 0, 1767, 1768, 7, 10, 0, 0, 1768, 1769, 7, 24, 0, 0, 1769, 1770, 7, 16, 0, 0, 1770, 130, 1, 0, 0, 0, 1771, 1772, 7, 25, 0, 0, 1772, 1773, 7, 5, 0, 0, 1773, 1774, 7, 6, 0, 0, 1774, 1775, 7, 9, 0, 0, 1775, 1776, 7, 10, 0, 0, 1776, 132, 1, 0, 0, 0, 1777, 1778, 7, 25, 0, 0, 1778, 1779, 7, 10, 0, 0, 1779, 1780, 7, 16, 0, 0, 1780, 1781, 7, 14, 0, 0, 1781, 1782, 7, 20, 0, 0, 1782, 134, 1, 0, 0, 0, 1783, 1784, 7, 25, 0, 0, 1784, 1785, 7, 19, 0, 0, 1785, 1786, 7, 13, 0, 0, 1786, 136, 1, 0, 0, 0, 1787, 1788, 7, 25, 0, 0, 1788, 1789, 7, 19, 0, 0, 1789, 1790, 7, 13, 0, 0, 1790, 1791, 7, 10, 0, 0, 1791, 1792, 7, 17, 0, 0, 1792, 1793, 7, 23, 0, 0, 1793, 1794, 7, 7, 0, 0, 1794, 138, 1, 0, 0, 0, 1795, 1796, 7, 25, 0, 0, 1796, 1797, 7, 13, 0, 0, 1797, 1798, 7, 19, 0, 0, 1798, 1799, 7, 15, 0, 0, 1799, 140, 1, 0, 0, 0, 1800, 1801, 7, 23, 0, 0, 1801, 1802, 7, 13, 0, 0, 1802, 1803, 7, 5, 0, 0, 1803, 1804, 7, 7, 0, 0, 1804, 1805, 7, 16, 0, 0, 1805, 142, 1, 0, 0, 0, 1806, 1807, 7, 23, 0, 0, 1807, 1808, 7, 13, 0, 0, 1808, 1809, 7, 19, 0, 0, 1809, 1810, 7, 22, 0, 0, 1810, 1811, 7, 24, 0, 0, 1811, 144, 1, 0, 0, 0, 1812, 1813, 7, 20, 0, 0, 1813, 1814, 7, 5, 0, 0, 1814, 1815, 7, 27, 0, 0, 1815, 1816, 7, 17, 0, 0, 1816, 1817, 7, 7, 0, 0, 1817, 1818, 7, 23, 0, 0, 1818, 146, 1, 0, 0, 0, 1819, 1820, 7, 17, 0, 0, 1820, 1821, 7, 7, 0, 0, 1821, 148, 1, 0, 0, 0, 1822, 1823, 7, 17, 0, 0, 1823, 1824, 7, 7, 0, 0, 1824, 1825, 7, 17, 0, 0, 1825, 1826, 7, 16, 0, 0, 1826, 1827, 7, 17, 0, 0, 1827, 1828, 7, 5, 0, 0, 1828, 1829, 7, 6, 0, 0, 1829, 1830, 7, 6, 0, 0, 1830, 1831, 7, 8, 0, 0, 1831, 150, 1, 0, 0, 0, 1832, 1833, 7, 17, 0, 0, 1833, 1834, 7, 7, 0, 0, 1834, 1835, 7, 16, 0, 0, 1835, 1836, 7, 10, 0, 0, 1836, 1837, 7, 13, 0, 0, 1837, 1838, 7, 9, 0, 0, 1838, 1839, 7, 10, 0, 0, 1839, 1840, 7, 14, 0, 0, 1840, 1841, 7, 16, 0, 0, 1841, 152, 1, 0, 0, 0, 1842, 1843, 7, 17, 0, 0, 1843, 1844, 7, 7, 0, 0, 1844, 1845, 7, 16, 0, 0, 1845, 1846, 7, 19, 0, 0, 1846, 154, 1, 0, 0, 0, 1847, 1848, 7, 6, 0, 0, 1848, 1849, 7, 5, 0, 0, 1849, 1850, 7, 16, 0, 0, 1850, 1851, 7, 10, 0, 0, 1851, 1852, 7, 13, 0, 0, 1852, 1853, 7, 5, 0, 0, 1853, 1854, 7, 6, 0, 0, 1854, 156, 1, 0, 0, 0, 1855, 1856, 7, 6, 0, 0, 1856, 1857, 7, 10, 0, 0, 1857, 1858, 7, 5, 0, 0, 1858, 1859, 7, 12, 0, 0, 1859, 1860, 7, 17, 0, 0, 1860, 1861, 7, 7, 0, 0, 1861, 1862, 7, 23, 0, 0, 1862, 158, 1, 0, 0, 0, 1863, 1864, 7, 6, 0, 0, 1864, 1865, 7, 17, 0, 0, 1865, 1866, 7, 15, 0, 0, 1866, 1867, 7, 17, 0, 0, 1867, 1868, 7, 16, 0, 0, 1868, 160, 1, 0, 0, 0, 1869, 1870, 7, 6, 0, 0, 1870, 1871, 7, 19, 0, 0, 1871, 1872, 7, 14, 0, 0, 1872, 1873, 7, 5, 0, 0, 1873, 1874, 7, 6, 0, 0, 1874, 1875, 7, 16, 0, 0, 1875, 1876, 7, 17, 0, 0, 1876, 1877, 7, 15, 0, 0, 1877, 1878, 7, 10, 0, 0, 1878, 162, 1, 0, 0, 0, 1879, 1880, 7, 6, 0, 0, 1880, 1881, 7, 19, 0, 0, 1881, 1882, 7, 14, 0, 0, 1882, 1883, 7, 5, 0, 0, 1883, 1884, 7, 6, 0, 0, 1884, 1885, 7, 16, 0, 0, 1885, 1886, 7, 17, 0, 0, 1886, 1887, 7, 15, 0, 0, 1887, 1888, 7, 10, 0, 0, 1888, 1889, 7, 9, 0, 0, 1889, 1890, 7, 16, 0, 0, 1890, 1891, 7, 5, 0, 0, 1891, 1892, 7, 15, 0, 0, 1892, 1893, 7, 24, 0, 0, 1893, 164, 1, 0, 0, 0, 1894, 1895, 7, 7, 0, 0, 1895, 1896, 7, 19, 0, 0, 1896, 1897, 7, 16, 0, 0, 1897, 166, 1, 0, 0, 0, 1898, 1899, 7, 7, 0, 0, 1899, 1900, 7, 22, 0, 0, 1900, 1901, 7, 6, 0, 0, 1901, 1902, 7, 6, 0, 0, 1902, 168, 1, 0, 0, 0, 1903, 1904, 7, 19, 0, 0, 1904, 1905, 7, 25, 0, 0, 1905, 1906, 7, 25, 0, 0, 1906, 1907, 7, 9, 0, 0, 1907, 1908, 7, 10, 0, 0, 1908, 1909, 7, 16, 0, 0, 1909, 170, 1, 0, 0, 0, 1910, 1911, 7, 19, 0, 0, 1911, 1912, 7, 7, 0, 0, 1912, 172, 1, 0, 0, 0, 1913, 1914, 7, 19, 0, 0, 1914, 1915, 7, 7, 0, 0, 1915, 1916, 7, 6, 0, 0, 1916, 1917, 7, 8, 0, 0, 1917, 174, 1, 0, 0, 0, 1918, 1919, 7, 19, 0, 0, 1919, 1920, 7, 13, 0, 0, 1920, 176, 1, 0, 0, 0, 1921, 1922, 7, 19, 0, 0, 1922, 1923, 7, 13, 0, 0, 1923, 1924, 7, 12, 0, 0, 1924, 1925, 7, 10, 0, 0, 1925, 1926, 7, 13, 0, 0, 1926, 178, 1, 0, 0, 0, 1927, 1928, 7, 24, 0, 0, 1928, 1929, 7, 6, 0, 0, 1929, 1930, 7, 5, 0, 0, 1930, 1931, 7, 14, 0, 0, 1931, 1932, 7, 17, 0, 0, 1932, 1933, 7, 7, 0, 0, 1933, 1934, 7, 23, 0, 0, 1934, 180, 1, 0, 0, 0, 1935, 1936, 7, 24, 0, 0, 1936, 1937, 7, 13, 0, 0, 1937, 1938, 7, 17, 0, 0, 1938, 1939, 7, 15, 0, 0, 1939, 1940, 7, 5, 0, 0, 1940, 1941, 7, 13, 0, 0, 1941, 1942, 7, 8, 0, 0, 1942, 182, 1, 0, 0, 0, 1943, 1944, 7, 13, 0, 0, 1944, 1945, 7, 10, 0, 0, 1945, 1946, 7, 25, 0, 0, 1946, 1947, 7, 10, 0, 0, 1947, 1948, 7, 13, 0, 0, 1948, 1949, 7, 10, 0, 0, 1949, 1950, 7, 7, 0, 0, 1950, 1951, 7, 14, 0, 0, 1951, 1952, 7, 10, 0, 0, 1952, 1953, 7, 9, 0, 0, 1953, 184, 1, 0, 0, 0, 1954, 1955, 7, 13, 0, 0, 1955, 1956, 7, 10, 0, 0, 1956, 1957, 7, 16, 0, 0, 1957, 1958, 7, 22, 0, 0, 1958, 1959, 7, 13, 0, 0, 1959, 1960, 7, 7, 0, 0, 1960, 1961, 7, 17, 0, 0, 1961, 1962, 7, 7, 0, 0, 1962, 1963, 7, 23, 0, 0, 1963, 186, 1, 0, 0, 0, 1964, 1965, 7, 9, 0, 0, 1965, 1966, 7, 10, 0, 0, 1966, 1967, 7, 6, 0, 0, 1967, 1968, 7, 10, 0, 0, 1968, 1969, 7, 14, 0, 0, 1969, 1970, 7, 16, 0, 0, 1970, 188, 1, 0, 0, 0, 1971, 1972, 7, 9, 0, 0, 1972, 1973, 7, 10, 0, 0, 1973, 1974, 7, 9, 0, 0, 1974, 1975, 7, 9, 0, 0, 1975, 1976, 7, 17, 0, 0, 1976, 1977, 7, 19, 0, 0, 1977, 1978, 7, 7, 0, 0, 1978, 1979, 5, 95, 0, 0, 1979, 1980, 7, 22, 0, 0, 1980, 1981, 7, 9, 0, 0, 1981, 1982, 7, 10, 0, 0, 1982, 1983, 7, 13, 0, 0, 1983, 190, 1, 0, 0, 0, 1984, 1985, 7, 9, 0, 0, 1985, 1986, 7, 19, 0, 0, 1986, 1987, 7, 15, 0, 0, 1987, 1988, 7, 10, 0, 0, 1988, 192, 1, 0, 0, 0, 1989, 1990, 7, 9, 0, 0, 1990, 1991, 7, 8, 0, 0, 1991, 1992, 7, 15, 0, 0, 1992, 1993, 7, 15, 0, 0, 1993, 1994, 7, 10, 0, 0, 1994, 1995, 7, 16, 0, 0, 1995, 1996, 7, 13, 0, 0, 1996, 1997, 7, 17, 0, 0, 1997, 1998, 7, 14, 0, 0, 1998, 194, 1, 0, 0, 0, 1999, 2000, 7, 16, 0, 0, 2000, 2001, 7, 5, 0, 0, 2001, 2002, 7, 18, 0, 0, 2002, 2003, 7, 6, 0, 0, 2003, 2004, 7, 10, 0, 0, 2004, 196, 1, 0, 0, 0, 2005, 2006, 7, 16, 0, 0, 2006, 2007, 7, 20, 0, 0, 2007, 2008, 7, 10, 0, 0, 2008, 2009, 7, 7, 0, 0, 2009, 198, 1, 0, 0, 0, 2010, 2011, 7, 16, 0, 0, 2011, 2012, 7, 19, 0, 0, 2012, 200, 1, 0, 0, 0, 2013, 2014, 7, 16, 0, 0, 2014, 2015, 7, 13, 0, 0, 2015, 2016, 7, 5, 0, 0, 2016, 2017, 7, 17, 0, 0, 2017, 2018, 7, 6, 0, 0, 2018, 2019, 7, 17, 0, 0, 2019, 2020, 7, 7, 0, 0, 2020, 2021, 7, 23, 0, 0, 2021, 202, 1, 0, 0, 0, 2022, 2023, 7, 16, 0, 0, 2023, 2024, 7, 13, 0, 0, 2024, 2025, 7, 22, 0, 0, 2025, 2026, 7, 10, 0, 0, 2026, 204, 1, 0, 0, 0, 2027, 2028, 7, 22, 0, 0, 2028, 2029, 7, 7, 0, 0, 2029, 2030, 7, 17, 0, 0, 2030, 2031, 7, 19, 0, 0, 2031, 2032, 7, 7, 0, 0, 2032, 206, 1, 0, 0, 0, 2033, 2034, 7, 22, 0, 0, 2034, 2035, 7, 7, 0, 0, 2035, 2036, 7, 17, 0, 0, 2036, 2037, 7, 28, 0, 0, 2037, 2038, 7, 22, 0, 0, 2038, 2039, 7, 10, 0, 0, 2039, 208, 1, 0, 0, 0, 2040, 2041, 7, 22, 0, 0, 2041, 2042, 7, 9, 0, 0, 2042, 2043, 7, 10, 0, 0, 2043, 2044, 7, 13, 0, 0, 2044, 210, 1, 0, 0, 0, 2045, 2046, 7, 22, 0, 0, 2046, 2047, 7, 9, 0, 0, 2047, 2048, 7, 17, 0, 0, 2048, 2049, 7, 7, 0, 0, 2049, 2050, 7, 23, 0, 0, 2050, 212, 1, 0, 0, 0, 2051, 2052, 7, 27, 0, 0, 2052, 2053, 7, 5, 0, 0, 2053, 2054, 7, 13, 0, 0, 2054, 2055, 7, 17, 0, 0, 2055, 2056, 7, 5, 0, 0, 2056, 2057, 7, 12, 0, 0, 2057, 2058, 7, 17, 0, 0, 2058, 2059, 7, 14, 0, 0, 2059, 214, 1, 0, 0, 0, 2060, 2061, 7, 29, 0, 0, 2061, 2062, 7, 20, 0, 0, 2062, 2063, 7, 10, 0, 0, 2063, 2064, 7, 7, 0, 0, 2064, 216, 1, 0, 0, 0, 2065, 2066, 7, 29, 0, 0, 2066, 2067, 7, 20, 0, 0, 2067, 2068, 7, 10, 0, 0, 2068, 2069, 7, 13, 0, 0, 2069, 2070, 7, 10, 0, 0, 2070, 218, 1, 0, 0, 0, 2071, 2072, 7, 29, 0, 0, 2072, 2073, 7, 17, 0, 0, 2073, 2074, 7, 7, 0, 0, 2074, 2075, 7, 12, 0, 0, 2075, 2076, 7, 19, 0, 0, 2076, 2077, 7, 29, 0, 0, 2077, 220, 1, 0, 0, 0, 2078, 2079, 7, 29, 0, 0, 2079, 2080, 7, 17, 0, 0, 2080, 2081, 7, 16, 0, 0, 2081, 2082, 7, 20, 0, 0, 2082, 222, 1, 0, 0, 0, 2083, 2084, 7, 5, 0, 0, 2084, 2085, 7, 22, 0, 0, 2085, 2086, 7, 16, 0, 0, 2086, 2087, 7, 20, 0, 0, 2087, 2088, 7, 19, 0, 0, 2088, 2089, 7, 13, 0, 0, 2089, 2090, 7, 17, 0, 0, 2090, 2091, 7, 11, 0, 0, 2091, 2092, 7, 5, 0, 0, 2092, 2093, 7, 16, 0, 0, 2093, 2094, 7, 17, 0, 0, 2094, 2095, 7, 19, 0, 0, 2095, 2096, 7, 7, 0, 0, 2096, 224, 1, 0, 0, 0, 2097, 2098, 7, 18, 0, 0, 2098, 2099, 7, 17, 0, 0, 2099, 2100, 7, 7, 0, 0, 2100, 2101, 7, 5, 0, 0, 2101, 2102, 7, 13, 0, 0, 2102, 2103, 7, 8, 0, 0, 2103, 226, 1, 0, 0, 0, 2104, 2105, 7, 14, 0, 0, 2105, 2106, 7, 19, 0, 0, 2106, 2107, 7, 6, 0, 0, 2107, 2108, 7, 6, 0, 0, 2108, 2109, 7, 5, 0, 0, 2109, 2110, 7, 16, 0, 0, 2110, 2111, 7, 17, 0, 0, 2111, 2112, 7, 19, 0, 0, 2112, 2113, 7, 7, 0, 0, 2113, 228, 1, 0, 0, 0, 2114, 2115, 7, 14, 0, 0, 2115, 2116, 7, 19, 0, 0, 2116, 2117, 7, 7, 0, 0, 2117, 2118, 7, 14, 0, 0, 2118, 2119, 7, 22, 0, 0, 2119, 2120, 7, 13, 0, 0, 2120, 2121, 7, 13, 0, 0, 2121, 2122, 7, 10, 0, 0, 2122, 2123, 7, 7, 0, 0, 2123, 2124, 7, 16, 0, 0, 2124, 2125, 7, 6, 0, 0, 2125, 2126, 7, 8, 0, 0, 2126, 230, 1, 0, 0, 0, 2127, 2128, 7, 14, 0, 0, 2128, 2129, 7, 13, 0, 0, 2129, 2130, 7, 19, 0, 0, 2130, 2131, 7, 9, 0, 0, 2131, 2132, 7, 9, 0, 0, 2132, 232, 1, 0, 0, 0, 2133, 2134, 7, 14, 0, 0, 2134, 2135, 7, 22, 0, 0, 2135, 2136, 7, 13, 0, 0, 2136, 2137, 7, 13, 0, 0, 2137, 2138, 7, 10, 0, 0, 2138, 2139, 7, 7, 0, 0, 2139, 2140, 7, 16, 0, 0, 2140, 2141, 5, 95, 0, 0, 2141, 2142, 7, 9, 0, 0, 2142, 2143, 7, 14, 0, 0, 2143, 2144, 7, 20, 0, 0, 2144, 2145, 7, 10, 0, 0, 2145, 2146, 7, 15, 0, 0, 2146, 2147, 7, 5, 0, 0, 2147, 234, 1, 0, 0, 0, 2148, 2149, 7, 25, 0, 0, 2149, 2150, 7, 13, 0, 0, 2150, 2151, 7, 10, 0, 0, 2151, 2152, 7, 10, 0, 0, 2152, 2153, 7, 11, 0, 0, 2153, 2154, 7, 10, 0, 0, 2154, 236, 1, 0, 0, 0, 2155, 2156, 7, 25, 0, 0, 2156, 2157, 7, 22, 0, 0, 2157, 2158, 7, 6, 0, 0, 2158, 2159, 7, 6, 0, 0, 2159, 238, 1, 0, 0, 0, 2160, 2161, 7, 17, 0, 0, 2161, 2162, 7, 6, 0, 0, 2162, 2163, 7, 17, 0, 0, 2163, 2164, 7, 21, 0, 0, 2164, 2165, 7, 10, 0, 0, 2165, 240, 1, 0, 0, 0, 2166, 2167, 7, 17, 0, 0, 2167, 2168, 7, 7, 0, 0, 2168, 2169, 7, 7, 0, 0, 2169, 2170, 7, 10, 0, 0, 2170, 2171, 7, 13, 0, 0, 2171, 242, 1, 0, 0, 0, 2172, 2173, 7, 17, 0, 0, 2173, 2174, 7, 9, 0, 0, 2174, 244, 1, 0, 0, 0, 2175, 2176, 7, 17, 0, 0, 2176, 2177, 7, 9, 0, 0, 2177, 2178, 7, 7, 0, 0, 2178, 2179, 7, 22, 0, 0, 2179, 2180, 7, 6, 0, 0, 2180, 2181, 7, 6, 0, 0, 2181, 246, 1, 0, 0, 0, 2182, 2183, 7, 30, 0, 0, 2183, 2184, 7, 19, 0, 0, 2184, 2185, 7, 17, 0, 0, 2185, 2186, 7, 7, 0, 0, 2186, 248, 1, 0, 0, 0, 2187, 2188, 7, 6, 0, 0, 2188, 2189, 7, 10, 0, 0, 2189, 2190, 7, 25, 0, 0, 2190, 2191, 7, 16, 0, 0, 2191, 250, 1, 0, 0, 0, 2192, 2193, 7, 6, 0, 0, 2193, 2194, 7, 17, 0, 0, 2194, 2195, 7, 21, 0, 0, 2195, 2196, 7, 10, 0, 0, 2196, 252, 1, 0, 0, 0, 2197, 2198, 7, 7, 0, 0, 2198, 2199, 7, 5, 0, 0, 2199, 2200, 7, 16, 0, 0, 2200, 2201, 7, 22, 0, 0, 2201, 2202, 7, 13, 0, 0, 2202, 2203, 7, 5, 0, 0, 2203, 2204, 7, 6, 0, 0, 2204, 254, 1, 0, 0, 0, 2205, 2206, 7, 7, 0, 0, 2206, 2207, 7, 19, 0, 0, 2207, 2208, 7, 16, 0, 0, 2208, 2209, 7, 7, 0, 0, 2209, 2210, 7, 22, 0, 0, 2210, 2211, 7, 6, 0, 0, 2211, 2212, 7, 6, 0, 0, 2212, 256, 1, 0, 0, 0, 2213, 2214, 7, 19, 0, 0, 2214, 2215, 7, 22, 0, 0, 2215, 2216, 7, 16, 0, 0, 2216, 2217, 7, 10, 0, 0, 2217, 2218, 7, 13, 0, 0, 2218, 258, 1, 0, 0, 0, 2219, 2220, 7, 19, 0, 0, 2220, 2221, 7, 27, 0, 0, 2221, 2222, 7, 10, 0, 0, 2222, 2223, 7, 13, 0, 0, 2223, 260, 1, 0, 0, 0, 2224, 2225, 7, 19, 0, 0, 2225, 2226, 7, 27, 0, 0, 2226, 2227, 7, 10, 0, 0, 2227, 2228, 7, 13, 0, 0, 2228, 2229, 7, 6, 0, 0, 2229, 2230, 7, 5, 0, 0, 2230, 2231, 7, 24, 0, 0, 2231, 2232, 7, 9, 0, 0, 2232, 262, 1, 0, 0, 0, 2233, 2234, 7, 13, 0, 0, 2234, 2235, 7, 17, 0, 0, 2235, 2236, 7, 23, 0, 0, 2236, 2237, 7, 20, 0, 0, 2237, 2238, 7, 16, 0, 0, 2238, 264, 1, 0, 0, 0, 2239, 2240, 7, 9, 0, 0, 2240, 2241, 7, 17, 0, 0, 2241, 2242, 7, 15, 0, 0, 2242, 2243, 7, 17, 0, 0, 2243, 2244, 7, 6, 0, 0, 2244, 2245, 7, 5, 0, 0, 2245, 2246, 7, 13, 0, 0, 2246, 266, 1, 0, 0, 0, 2247, 2248, 7, 27, 0, 0, 2248, 2249, 7, 10, 0, 0, 2249, 2250, 7, 13, 0, 0, 2250, 2251, 7, 18, 0, 0, 2251, 2252, 7, 19, 0, 0, 2252, 2253, 7, 9, 0, 0, 2253, 2254, 7, 10, 0, 0, 2254, 268, 1, 0, 0, 0, 2255, 2256, 7, 5, 0, 0, 2256, 2257, 7, 18, 0, 0, 2257, 2258, 7, 19, 0, 0, 2258, 2259, 7, 13, 0, 0, 2259, 2260, 7, 16, 0, 0, 2260, 270, 1, 0, 0, 0, 2261, 2262, 7, 5, 0, 0, 2262, 2263, 7, 18, 0, 0, 2263, 2264, 7, 9, 0, 0, 2264, 2265, 7, 19, 0, 0, 2265, 2266, 7, 6, 0, 0, 2266, 2267, 7, 22, 0, 0, 2267, 2268, 7, 16, 0, 0, 2268, 2269, 7, 10, 0, 0, 2269, 272, 1, 0, 0, 0, 2270, 2271, 7, 5, 0, 0, 2271, 2272, 7, 14, 0, 0, 2272, 2273, 7, 14, 0, 0, 2273, 2274, 7, 10, 0, 0, 2274, 2275, 7, 9, 0, 0, 2275, 2276, 7, 9, 0, 0, 2276, 274, 1, 0, 0, 0, 2277, 2278, 7, 5, 0, 0, 2278, 2279, 7, 14, 0, 0, 2279, 2280, 7, 16, 0, 0, 2280, 2281, 7, 17, 0, 0, 2281, 2282, 7, 19, 0, 0, 2282, 2283, 7, 7, 0, 0, 2283, 276, 1, 0, 0, 0, 2284, 2285, 7, 5, 0, 0, 2285, 2286, 7, 12, 0, 0, 2286, 2287, 7, 12, 0, 0, 2287, 278, 1, 0, 0, 0, 2288, 2289, 7, 5, 0, 0, 2289, 2290, 7, 12, 0, 0, 2290, 2291, 7, 15, 0, 0, 2291, 2292, 7, 17, 0, 0, 2292, 2293, 7, 7, 0, 0, 2293, 280, 1, 0, 0, 0, 2294, 2295, 7, 5, 0, 0, 2295, 2296, 7, 25, 0, 0, 2296, 2297, 7, 16, 0, 0, 2297, 2298, 7, 10, 0, 0, 2298, 2299, 7, 13, 0, 0, 2299, 282, 1, 0, 0, 0, 2300, 2301, 7, 5, 0, 0, 2301, 2302, 7, 23, 0, 0, 2302, 2303, 7, 23, 0, 0, 2303, 2304, 7, 13, 0, 0, 2304, 2305, 7, 10, 0, 0, 2305, 2306, 7, 23, 0, 0, 2306, 2307, 7, 5, 0, 0, 2307, 2308, 7, 16, 0, 0, 2308, 2309, 7, 10, 0, 0, 2309, 284, 1, 0, 0, 0, 2310, 2311, 7, 5, 0, 0, 2311, 2312, 7, 6, 0, 0, 2312, 2313, 7, 9, 0, 0, 2313, 2314, 7, 19, 0, 0, 2314, 286, 1, 0, 0, 0, 2315, 2316, 7, 5, 0, 0, 2316, 2317, 7, 6, 0, 0, 2317, 2318, 7, 16, 0, 0, 2318, 2319, 7, 10, 0, 0, 2319, 2320, 7, 13, 0, 0, 2320, 288, 1, 0, 0, 0, 2321, 2322, 7, 5, 0, 0, 2322, 2323, 7, 6, 0, 0, 2323, 2324, 7, 29, 0, 0, 2324, 2325, 7, 5, 0, 0, 2325, 2326, 7, 8, 0, 0, 2326, 2327, 7, 9, 0, 0, 2327, 290, 1, 0, 0, 0, 2328, 2329, 7, 5, 0, 0, 2329, 2330, 7, 9, 0, 0, 2330, 2331, 7, 9, 0, 0, 2331, 2332, 7, 10, 0, 0, 2332, 2333, 7, 13, 0, 0, 2333, 2334, 7, 16, 0, 0, 2334, 2335, 7, 17, 0, 0, 2335, 2336, 7, 19, 0, 0, 2336, 2337, 7, 7, 0, 0, 2337, 292, 1, 0, 0, 0, 2338, 2339, 7, 5, 0, 0, 2339, 2340, 7, 9, 0, 0, 2340, 2341, 7, 9, 0, 0, 2341, 2342, 7, 17, 0, 0, 2342, 2343, 7, 23, 0, 0, 2343, 2344, 7, 7, 0, 0, 2344, 2345, 7, 15, 0, 0, 2345, 2346, 7, 10, 0, 0, 2346, 2347, 7, 7, 0, 0, 2347, 2348, 7, 16, 0, 0, 2348, 294, 1, 0, 0, 0, 2349, 2350, 7, 5, 0, 0, 2350, 2351, 7, 16, 0, 0, 2351, 296, 1, 0, 0, 0, 2352, 2353, 7, 5, 0, 0, 2353, 2354, 7, 16, 0, 0, 2354, 2355, 7, 16, 0, 0, 2355, 2356, 7, 13, 0, 0, 2356, 2357, 7, 17, 0, 0, 2357, 2358, 7, 18, 0, 0, 2358, 2359, 7, 22, 0, 0, 2359, 2360, 7, 16, 0, 0, 2360, 2361, 7, 10, 0, 0, 2361, 298, 1, 0, 0, 0, 2362, 2363, 7, 18, 0, 0, 2363, 2364, 7, 5, 0, 0, 2364, 2365, 7, 14, 0, 0, 2365, 2366, 7, 21, 0, 0, 2366, 2367, 7, 29, 0, 0, 2367, 2368, 7, 5, 0, 0, 2368, 2369, 7, 13, 0, 0, 2369, 2370, 7, 12, 0, 0, 2370, 300, 1, 0, 0, 0, 2371, 2372, 7, 18, 0, 0, 2372, 2373, 7, 10, 0, 0, 2373, 2374, 7, 25, 0, 0, 2374, 2375, 7, 19, 0, 0, 2375, 2376, 7, 13, 0, 0, 2376, 2377, 7, 10, 0, 0, 2377, 302, 1, 0, 0, 0, 2378, 2379, 7, 18, 0, 0, 2379, 2380, 7, 10, 0, 0, 2380, 2381, 7, 23, 0, 0, 2381, 2382, 7, 17, 0, 0, 2382, 2383, 7, 7, 0, 0, 2383, 304, 1, 0, 0, 0, 2384, 2385, 7, 18, 0, 0, 2385, 2386, 7, 8, 0, 0, 2386, 306, 1, 0, 0, 0, 2387, 2388, 7, 14, 0, 0, 2388, 2389, 7, 5, 0, 0, 2389, 2390, 7, 14, 0, 0, 2390, 2391, 7, 20, 0, 0, 2391, 2392, 7, 10, 0, 0, 2392, 308, 1, 0, 0, 0, 2393, 2394, 7, 14, 0, 0, 2394, 2395, 7, 5, 0, 0, 2395, 2396, 7, 6, 0, 0, 2396, 2397, 7, 6, 0, 0, 2397, 2398, 7, 10, 0, 0, 2398, 2399, 7, 12, 0, 0, 2399, 310, 1, 0, 0, 0, 2400, 2401, 7, 14, 0, 0, 2401, 2402, 7, 5, 0, 0, 2402, 2403, 7, 9, 0, 0, 2403, 2404, 7, 14, 0, 0, 2404, 2405, 7, 5, 0, 0, 2405, 2406, 7, 12, 0, 0, 2406, 2407, 7, 10, 0, 0, 2407, 312, 1, 0, 0, 0, 2408, 2409, 7, 14, 0, 0, 2409, 2410, 7, 5, 0, 0, 2410, 2411, 7, 9, 0, 0, 2411, 2412, 7, 14, 0, 0, 2412, 2413, 7, 5, 0, 0, 2413, 2414, 7, 12, 0, 0, 2414, 2415, 7, 10, 0, 0, 2415, 2416, 7, 12, 0, 0, 2416, 314, 1, 0, 0, 0, 2417, 2418, 7, 14, 0, 0, 2418, 2419, 7, 5, 0, 0, 2419, 2420, 7, 16, 0, 0, 2420, 2421, 7, 5, 0, 0, 2421, 2422, 7, 6, 0, 0, 2422, 2423, 7, 19, 0, 0, 2423, 2424, 7, 23, 0, 0, 2424, 316, 1, 0, 0, 0, 2425, 2426, 7, 14, 0, 0, 2426, 2427, 7, 20, 0, 0, 2427, 2428, 7, 5, 0, 0, 2428, 2429, 7, 17, 0, 0, 2429, 2430, 7, 7, 0, 0, 2430, 318, 1, 0, 0, 0, 2431, 2432, 7, 14, 0, 0, 2432, 2433, 7, 20, 0, 0, 2433, 2434, 7, 5, 0, 0, 2434, 2435, 7, 13, 0, 0, 2435, 2436, 7, 5, 0, 0, 2436, 2437, 7, 14, 0, 0, 2437, 2438, 7, 16, 0, 0, 2438, 2439, 7, 10, 0, 0, 2439, 2440, 7, 13, 0, 0, 2440, 2441, 7, 17, 0, 0, 2441, 2442, 7, 9, 0, 0, 2442, 2443, 7, 16, 0, 0, 2443, 2444, 7, 17, 0, 0, 2444, 2445, 7, 14, 0, 0, 2445, 2446, 7, 9, 0, 0, 2446, 320, 1, 0, 0, 0, 2447, 2448, 7, 14, 0, 0, 2448, 2449, 7, 20, 0, 0, 2449, 2450, 7, 10, 0, 0, 2450, 2451, 7, 14, 0, 0, 2451, 2452, 7, 21, 0, 0, 2452, 2453, 7, 24, 0, 0, 2453, 2454, 7, 19, 0, 0, 2454, 2455, 7, 17, 0, 0, 2455, 2456, 7, 7, 0, 0, 2456, 2457, 7, 16, 0, 0, 2457, 322, 1, 0, 0, 0, 2458, 2459, 7, 14, 0, 0, 2459, 2460, 7, 6, 0, 0, 2460, 2461, 7, 5, 0, 0, 2461, 2462, 7, 9, 0, 0, 2462, 2463, 7, 9, 0, 0, 2463, 324, 1, 0, 0, 0, 2464, 2465, 7, 14, 0, 0, 2465, 2466, 7, 6, 0, 0, 2466, 2467, 7, 19, 0, 0, 2467, 2468, 7, 9, 0, 0, 2468, 2469, 7, 10, 0, 0, 2469, 326, 1, 0, 0, 0, 2470, 2471, 7, 14, 0, 0, 2471, 2472, 7, 6, 0, 0, 2472, 2473, 7, 22, 0, 0, 2473, 2474, 7, 9, 0, 0, 2474, 2475, 7, 16, 0, 0, 2475, 2476, 7, 10, 0, 0, 2476, 2477, 7, 13, 0, 0, 2477, 328, 1, 0, 0, 0, 2478, 2479, 7, 14, 0, 0, 2479, 2480, 7, 19, 0, 0, 2480, 2481, 7, 15, 0, 0, 2481, 2482, 7, 15, 0, 0, 2482, 2483, 7, 10, 0, 0, 2483, 2484, 7, 7, 0, 0, 2484, 2485, 7, 16, 0, 0, 2485, 330, 1, 0, 0, 0, 2486, 2487, 7, 14, 0, 0, 2487, 2488, 7, 19, 0, 0, 2488, 2489, 7, 15, 0, 0, 2489, 2490, 7, 15, 0, 0, 2490, 2491, 7, 10, 0, 0, 2491, 2492, 7, 7, 0, 0, 2492, 2493, 7, 16, 0, 0, 2493, 2494, 7, 9, 0, 0, 2494, 332, 1, 0, 0, 0, 2495, 2496, 7, 14, 0, 0, 2496, 2497, 7, 19, 0, 0, 2497, 2498, 7, 15, 0, 0, 2498, 2499, 7, 15, 0, 0, 2499, 2500, 7, 17, 0, 0, 2500, 2501, 7, 16, 0, 0, 2501, 334, 1, 0, 0, 0, 2502, 2503, 7, 14, 0, 0, 2503, 2504, 7, 19, 0, 0, 2504, 2505, 7, 15, 0, 0, 2505, 2506, 7, 15, 0, 0, 2506, 2507, 7, 17, 0, 0, 2507, 2508, 7, 16, 0, 0, 2508, 2509, 7, 16, 0, 0, 2509, 2510, 7, 10, 0, 0, 2510, 2511, 7, 12, 0, 0, 2511, 336, 1, 0, 0, 0, 2512, 2513, 7, 14, 0, 0, 2513, 2514, 7, 19, 0, 0, 2514, 2515, 7, 7, 0, 0, 2515, 2516, 7, 25, 0, 0, 2516, 2517, 7, 17, 0, 0, 2517, 2518, 7, 23, 0, 0, 2518, 2519, 7, 22, 0, 0, 2519, 2520, 7, 13, 0, 0, 2520, 2521, 7, 5, 0, 0, 2521, 2522, 7, 16, 0, 0, 2522, 2523, 7, 17, 0, 0, 2523, 2524, 7, 19, 0, 0, 2524, 2525, 7, 7, 0, 0, 2525, 338, 1, 0, 0, 0, 2526, 2527, 7, 14, 0, 0, 2527, 2528, 7, 19, 0, 0, 2528, 2529, 7, 7, 0, 0, 2529, 2530, 7, 7, 0, 0, 2530, 2531, 7, 10, 0, 0, 2531, 2532, 7, 14, 0, 0, 2532, 2533, 7, 16, 0, 0, 2533, 2534, 7, 17, 0, 0, 2534, 2535, 7, 19, 0, 0, 2535, 2536, 7, 7, 0, 0, 2536, 340, 1, 0, 0, 0, 2537, 2538, 7, 14, 0, 0, 2538, 2539, 7, 19, 0, 0, 2539, 2540, 7, 7, 0, 0, 2540, 2541, 7, 9, 0, 0, 2541, 2542, 7, 16, 0, 0, 2542, 2543, 7, 13, 0, 0, 2543, 2544, 7, 5, 0, 0, 2544, 2545, 7, 17, 0, 0, 2545, 2546, 7, 7, 0, 0, 2546, 2547, 7, 16, 0, 0, 2547, 2548, 7, 9, 0, 0, 2548, 342, 1, 0, 0, 0, 2549, 2550, 7, 14, 0, 0, 2550, 2551, 7, 19, 0, 0, 2551, 2552, 7, 7, 0, 0, 2552, 2553, 7, 16, 0, 0, 2553, 2554, 7, 10, 0, 0, 2554, 2555, 7, 7, 0, 0, 2555, 2556, 7, 16, 0, 0, 2556, 344, 1, 0, 0, 0, 2557, 2558, 7, 14, 0, 0, 2558, 2559, 7, 19, 0, 0, 2559, 2560, 7, 7, 0, 0, 2560, 2561, 7, 16, 0, 0, 2561, 2562, 7, 17, 0, 0, 2562, 2563, 7, 7, 0, 0, 2563, 2564, 7, 22, 0, 0, 2564, 2565, 7, 10, 0, 0, 2565, 346, 1, 0, 0, 0, 2566, 2567, 7, 14, 0, 0, 2567, 2568, 7, 19, 0, 0, 2568, 2569, 7, 7, 0, 0, 2569, 2570, 7, 27, 0, 0, 2570, 2571, 7, 10, 0, 0, 2571, 2572, 7, 13, 0, 0, 2572, 2573, 7, 9, 0, 0, 2573, 2574, 7, 17, 0, 0, 2574, 2575, 7, 19, 0, 0, 2575, 2576, 7, 7, 0, 0, 2576, 348, 1, 0, 0, 0, 2577, 2578, 7, 14, 0, 0, 2578, 2579, 7, 19, 0, 0, 2579, 2580, 7, 24, 0, 0, 2580, 2581, 7, 8, 0, 0, 2581, 350, 1, 0, 0, 0, 2582, 2583, 7, 14, 0, 0, 2583, 2584, 7, 19, 0, 0, 2584, 2585, 7, 9, 0, 0, 2585, 2586, 7, 16, 0, 0, 2586, 352, 1, 0, 0, 0, 2587, 2588, 7, 14, 0, 0, 2588, 2589, 7, 9, 0, 0, 2589, 2590, 7, 27, 0, 0, 2590, 354, 1, 0, 0, 0, 2591, 2592, 7, 14, 0, 0, 2592, 2593, 7, 22, 0, 0, 2593, 2594, 7, 13, 0, 0, 2594, 2595, 7, 9, 0, 0, 2595, 2596, 7, 19, 0, 0, 2596, 2597, 7, 13, 0, 0, 2597, 356, 1, 0, 0, 0, 2598, 2599, 7, 14, 0, 0, 2599, 2600, 7, 8, 0, 0, 2600, 2601, 7, 14, 0, 0, 2601, 2602, 7, 6, 0, 0, 2602, 2603, 7, 10, 0, 0, 2603, 358, 1, 0, 0, 0, 2604, 2605, 7, 12, 0, 0, 2605, 2606, 7, 5, 0, 0, 2606, 2607, 7, 16, 0, 0, 2607, 2608, 7, 5, 0, 0, 2608, 360, 1, 0, 0, 0, 2609, 2610, 7, 12, 0, 0, 2610, 2611, 7, 5, 0, 0, 2611, 2612, 7, 16, 0, 0, 2612, 2613, 7, 5, 0, 0, 2613, 2614, 7, 18, 0, 0, 2614, 2615, 7, 5, 0, 0, 2615, 2616, 7, 9, 0, 0, 2616, 2617, 7, 10, 0, 0, 2617, 362, 1, 0, 0, 0, 2618, 2619, 7, 12, 0, 0, 2619, 2620, 7, 5, 0, 0, 2620, 2621, 7, 8, 0, 0, 2621, 364, 1, 0, 0, 0, 2622, 2623, 7, 12, 0, 0, 2623, 2624, 7, 10, 0, 0, 2624, 2625, 7, 5, 0, 0, 2625, 2626, 7, 6, 0, 0, 2626, 2627, 7, 6, 0, 0, 2627, 2628, 7, 19, 0, 0, 2628, 2629, 7, 14, 0, 0, 2629, 2630, 7, 5, 0, 0, 2630, 2631, 7, 16, 0, 0, 2631, 2632, 7, 10, 0, 0, 2632, 366, 1, 0, 0, 0, 2633, 2634, 7, 12, 0, 0, 2634, 2635, 7, 10, 0, 0, 2635, 2636, 7, 14, 0, 0, 2636, 2637, 7, 6, 0, 0, 2637, 2638, 7, 5, 0, 0, 2638, 2639, 7, 13, 0, 0, 2639, 2640, 7, 10, 0, 0, 2640, 368, 1, 0, 0, 0, 2641, 2642, 7, 12, 0, 0, 2642, 2643, 7, 10, 0, 0, 2643, 2644, 7, 25, 0, 0, 2644, 2645, 7, 5, 0, 0, 2645, 2646, 7, 22, 0, 0, 2646, 2647, 7, 6, 0, 0, 2647, 2648, 7, 16, 0, 0, 2648, 2649, 7, 9, 0, 0, 2649, 370, 1, 0, 0, 0, 2650, 2651, 7, 12, 0, 0, 2651, 2652, 7, 10, 0, 0, 2652, 2653, 7, 25, 0, 0, 2653, 2654, 7, 10, 0, 0, 2654, 2655, 7, 13, 0, 0, 2655, 2656, 7, 13, 0, 0, 2656, 2657, 7, 10, 0, 0, 2657, 2658, 7, 12, 0, 0, 2658, 372, 1, 0, 0, 0, 2659, 2660, 7, 12, 0, 0, 2660, 2661, 7, 10, 0, 0, 2661, 2662, 7, 25, 0, 0, 2662, 2663, 7, 17, 0, 0, 2663, 2664, 7, 7, 0, 0, 2664, 2665, 7, 10, 0, 0, 2665, 2666, 7, 13, 0, 0, 2666, 374, 1, 0, 0, 0, 2667, 2668, 7, 12, 0, 0, 2668, 2669, 7, 10, 0, 0, 2669, 2670, 7, 6, 0, 0, 2670, 2671, 7, 10, 0, 0, 2671, 2672, 7, 16, 0, 0, 2672, 2673, 7, 10, 0, 0, 2673, 376, 1, 0, 0, 0, 2674, 2675, 7, 12, 0, 0, 2675, 2676, 7, 10, 0, 0, 2676, 2677, 7, 6, 0, 0, 2677, 2678, 7, 17, 0, 0, 2678, 2679, 7, 15, 0, 0, 2679, 2680, 7, 17, 0, 0, 2680, 2681, 7, 16, 0, 0, 2681, 2682, 7, 10, 0, 0, 2682, 2683, 7, 13, 0, 0, 2683, 378, 1, 0, 0, 0, 2684, 2685, 7, 12, 0, 0, 2685, 2686, 7, 10, 0, 0, 2686, 2687, 7, 6, 0, 0, 2687, 2688, 7, 17, 0, 0, 2688, 2689, 7, 15, 0, 0, 2689, 2690, 7, 17, 0, 0, 2690, 2691, 7, 16, 0, 0, 2691, 2692, 7, 10, 0, 0, 2692, 2693, 7, 13, 0, 0, 2693, 2694, 7, 9, 0, 0, 2694, 380, 1, 0, 0, 0, 2695, 2696, 7, 12, 0, 0, 2696, 2697, 7, 17, 0, 0, 2697, 2698, 7, 14, 0, 0, 2698, 2699, 7, 16, 0, 0, 2699, 2700, 7, 17, 0, 0, 2700, 2701, 7, 19, 0, 0, 2701, 2702, 7, 7, 0, 0, 2702, 2703, 7, 5, 0, 0, 2703, 2704, 7, 13, 0, 0, 2704, 2705, 7, 8, 0, 0, 2705, 382, 1, 0, 0, 0, 2706, 2707, 7, 12, 0, 0, 2707, 2708, 7, 17, 0, 0, 2708, 2709, 7, 9, 0, 0, 2709, 2710, 7, 5, 0, 0, 2710, 2711, 7, 18, 0, 0, 2711, 2712, 7, 6, 0, 0, 2712, 2713, 7, 10, 0, 0, 2713, 384, 1, 0, 0, 0, 2714, 2715, 7, 12, 0, 0, 2715, 2716, 7, 17, 0, 0, 2716, 2717, 7, 9, 0, 0, 2717, 2718, 7, 14, 0, 0, 2718, 2719, 7, 5, 0, 0, 2719, 2720, 7, 13, 0, 0, 2720, 2721, 7, 12, 0, 0, 2721, 386, 1, 0, 0, 0, 2722, 2723, 7, 12, 0, 0, 2723, 2724, 7, 19, 0, 0, 2724, 2725, 7, 14, 0, 0, 2725, 2726, 7, 22, 0, 0, 2726, 2727, 7, 15, 0, 0, 2727, 2728, 7, 10, 0, 0, 2728, 2729, 7, 7, 0, 0, 2729, 2730, 7, 16, 0, 0, 2730, 388, 1, 0, 0, 0, 2731, 2732, 7, 12, 0, 0, 2732, 2733, 7, 19, 0, 0, 2733, 2734, 7, 15, 0, 0, 2734, 2735, 7, 5, 0, 0, 2735, 2736, 7, 17, 0, 0, 2736, 2737, 7, 7, 0, 0, 2737, 390, 1, 0, 0, 0, 2738, 2739, 7, 12, 0, 0, 2739, 2740, 7, 19, 0, 0, 2740, 2741, 7, 22, 0, 0, 2741, 2742, 7, 18, 0, 0, 2742, 2743, 7, 6, 0, 0, 2743, 2744, 7, 10, 0, 0, 2744, 392, 1, 0, 0, 0, 2745, 2746, 7, 12, 0, 0, 2746, 2747, 7, 13, 0, 0, 2747, 2748, 7, 19, 0, 0, 2748, 2749, 7, 24, 0, 0, 2749, 394, 1, 0, 0, 0, 2750, 2751, 7, 10, 0, 0, 2751, 2752, 7, 5, 0, 0, 2752, 2753, 7, 14, 0, 0, 2753, 2754, 7, 20, 0, 0, 2754, 396, 1, 0, 0, 0, 2755, 2756, 7, 10, 0, 0, 2756, 2757, 7, 7, 0, 0, 2757, 2758, 7, 5, 0, 0, 2758, 2759, 7, 18, 0, 0, 2759, 2760, 7, 6, 0, 0, 2760, 2761, 7, 10, 0, 0, 2761, 398, 1, 0, 0, 0, 2762, 2763, 7, 10, 0, 0, 2763, 2764, 7, 7, 0, 0, 2764, 2765, 7, 14, 0, 0, 2765, 2766, 7, 19, 0, 0, 2766, 2767, 7, 12, 0, 0, 2767, 2768, 7, 17, 0, 0, 2768, 2769, 7, 7, 0, 0, 2769, 2770, 7, 23, 0, 0, 2770, 400, 1, 0, 0, 0, 2771, 2772, 7, 10, 0, 0, 2772, 2773, 7, 7, 0, 0, 2773, 2774, 7, 14, 0, 0, 2774, 2775, 7, 13, 0, 0, 2775, 2776, 7, 8, 0, 0, 2776, 2777, 7, 24, 0, 0, 2777, 2778, 7, 16, 0, 0, 2778, 2779, 7, 10, 0, 0, 2779, 2780, 7, 12, 0, 0, 2780, 402, 1, 0, 0, 0, 2781, 2782, 7, 10, 0, 0, 2782, 2783, 7, 7, 0, 0, 2783, 2784, 7, 22, 0, 0, 2784, 2785, 7, 15, 0, 0, 2785, 404, 1, 0, 0, 0, 2786, 2787, 7, 10, 0, 0, 2787, 2788, 7, 9, 0, 0, 2788, 2789, 7, 14, 0, 0, 2789, 2790, 7, 5, 0, 0, 2790, 2791, 7, 24, 0, 0, 2791, 2792, 7, 10, 0, 0, 2792, 406, 1, 0, 0, 0, 2793, 2794, 7, 10, 0, 0, 2794, 2795, 7, 27, 0, 0, 2795, 2796, 7, 10, 0, 0, 2796, 2797, 7, 7, 0, 0, 2797, 2798, 7, 16, 0, 0, 2798, 408, 1, 0, 0, 0, 2799, 2800, 7, 10, 0, 0, 2800, 2801, 7, 26, 0, 0, 2801, 2802, 7, 14, 0, 0, 2802, 2803, 7, 6, 0, 0, 2803, 2804, 7, 22, 0, 0, 2804, 2805, 7, 12, 0, 0, 2805, 2806, 7, 10, 0, 0, 2806, 410, 1, 0, 0, 0, 2807, 2808, 7, 10, 0, 0, 2808, 2809, 7, 26, 0, 0, 2809, 2810, 7, 14, 0, 0, 2810, 2811, 7, 6, 0, 0, 2811, 2812, 7, 22, 0, 0, 2812, 2813, 7, 12, 0, 0, 2813, 2814, 7, 17, 0, 0, 2814, 2815, 7, 7, 0, 0, 2815, 2816, 7, 23, 0, 0, 2816, 412, 1, 0, 0, 0, 2817, 2818, 7, 10, 0, 0, 2818, 2819, 7, 26, 0, 0, 2819, 2820, 7, 14, 0, 0, 2820, 2821, 7, 6, 0, 0, 2821, 2822, 7, 22, 0, 0, 2822, 2823, 7, 9, 0, 0, 2823, 2824, 7, 17, 0, 0, 2824, 2825, 7, 27, 0, 0, 2825, 2826, 7, 10, 0, 0, 2826, 414, 1, 0, 0, 0, 2827, 2828, 7, 10, 0, 0, 2828, 2829, 7, 26, 0, 0, 2829, 2830, 7, 10, 0, 0, 2830, 2831, 7, 14, 0, 0, 2831, 2832, 7, 22, 0, 0, 2832, 2833, 7, 16, 0, 0, 2833, 2834, 7, 10, 0, 0, 2834, 416, 1, 0, 0, 0, 2835, 2836, 7, 10, 0, 0, 2836, 2837, 7, 26, 0, 0, 2837, 2838, 7, 24, 0, 0, 2838, 2839, 7, 6, 0, 0, 2839, 2840, 7, 5, 0, 0, 2840, 2841, 7, 17, 0, 0, 2841, 2842, 7, 7, 0, 0, 2842, 418, 1, 0, 0, 0, 2843, 2844, 7, 10, 0, 0, 2844, 2845, 7, 26, 0, 0, 2845, 2846, 7, 16, 0, 0, 2846, 2847, 7, 10, 0, 0, 2847, 2848, 7, 7, 0, 0, 2848, 2849, 7, 9, 0, 0, 2849, 2850, 7, 17, 0, 0, 2850, 2851, 7, 19, 0, 0, 2851, 2852, 7, 7, 0, 0, 2852, 420, 1, 0, 0, 0, 2853, 2854, 7, 10, 0, 0, 2854, 2855, 7, 26, 0, 0, 2855, 2856, 7, 16, 0, 0, 2856, 2857, 7, 10, 0, 0, 2857, 2858, 7, 13, 0, 0, 2858, 2859, 7, 7, 0, 0, 2859, 2860, 7, 5, 0, 0, 2860, 2861, 7, 6, 0, 0, 2861, 422, 1, 0, 0, 0, 2862, 2863, 7, 25, 0, 0, 2863, 2864, 7, 5, 0, 0, 2864, 2865, 7, 15, 0, 0, 2865, 2866, 7, 17, 0, 0, 2866, 2867, 7, 6, 0, 0, 2867, 2868, 7, 8, 0, 0, 2868, 424, 1, 0, 0, 0, 2869, 2870, 7, 25, 0, 0, 2870, 2871, 7, 17, 0, 0, 2871, 2872, 7, 13, 0, 0, 2872, 2873, 7, 9, 0, 0, 2873, 2874, 7, 16, 0, 0, 2874, 426, 1, 0, 0, 0, 2875, 2876, 7, 25, 0, 0, 2876, 2877, 7, 19, 0, 0, 2877, 2878, 7, 6, 0, 0, 2878, 2879, 7, 6, 0, 0, 2879, 2880, 7, 19, 0, 0, 2880, 2881, 7, 29, 0, 0, 2881, 2882, 7, 17, 0, 0, 2882, 2883, 7, 7, 0, 0, 2883, 2884, 7, 23, 0, 0, 2884, 428, 1, 0, 0, 0, 2885, 2886, 7, 25, 0, 0, 2886, 2887, 7, 19, 0, 0, 2887, 2888, 7, 13, 0, 0, 2888, 2889, 7, 14, 0, 0, 2889, 2890, 7, 10, 0, 0, 2890, 430, 1, 0, 0, 0, 2891, 2892, 7, 25, 0, 0, 2892, 2893, 7, 19, 0, 0, 2893, 2894, 7, 13, 0, 0, 2894, 2895, 7, 29, 0, 0, 2895, 2896, 7, 5, 0, 0, 2896, 2897, 7, 13, 0, 0, 2897, 2898, 7, 12, 0, 0, 2898, 432, 1, 0, 0, 0, 2899, 2900, 7, 25, 0, 0, 2900, 2901, 7, 22, 0, 0, 2901, 2902, 7, 7, 0, 0, 2902, 2903, 7, 14, 0, 0, 2903, 2904, 7, 16, 0, 0, 2904, 2905, 7, 17, 0, 0, 2905, 2906, 7, 19, 0, 0, 2906, 2907, 7, 7, 0, 0, 2907, 434, 1, 0, 0, 0, 2908, 2909, 7, 25, 0, 0, 2909, 2910, 7, 22, 0, 0, 2910, 2911, 7, 7, 0, 0, 2911, 2912, 7, 14, 0, 0, 2912, 2913, 7, 16, 0, 0, 2913, 2914, 7, 17, 0, 0, 2914, 2915, 7, 19, 0, 0, 2915, 2916, 7, 7, 0, 0, 2916, 2917, 7, 9, 0, 0, 2917, 436, 1, 0, 0, 0, 2918, 2919, 7, 23, 0, 0, 2919, 2920, 7, 6, 0, 0, 2920, 2921, 7, 19, 0, 0, 2921, 2922, 7, 18, 0, 0, 2922, 2923, 7, 5, 0, 0, 2923, 2924, 7, 6, 0, 0, 2924, 438, 1, 0, 0, 0, 2925, 2926, 7, 23, 0, 0, 2926, 2927, 7, 13, 0, 0, 2927, 2928, 7, 5, 0, 0, 2928, 2929, 7, 7, 0, 0, 2929, 2930, 7, 16, 0, 0, 2930, 2931, 7, 10, 0, 0, 2931, 2932, 7, 12, 0, 0, 2932, 440, 1, 0, 0, 0, 2933, 2934, 7, 20, 0, 0, 2934, 2935, 7, 5, 0, 0, 2935, 2936, 7, 7, 0, 0, 2936, 2937, 7, 12, 0, 0, 2937, 2938, 7, 6, 0, 0, 2938, 2939, 7, 10, 0, 0, 2939, 2940, 7, 13, 0, 0, 2940, 442, 1, 0, 0, 0, 2941, 2942, 7, 20, 0, 0, 2942, 2943, 7, 10, 0, 0, 2943, 2944, 7, 5, 0, 0, 2944, 2945, 7, 12, 0, 0, 2945, 2946, 7, 10, 0, 0, 2946, 2947, 7, 13, 0, 0, 2947, 444, 1, 0, 0, 0, 2948, 2949, 7, 20, 0, 0, 2949, 2950, 7, 19, 0, 0, 2950, 2951, 7, 6, 0, 0, 2951, 2952, 7, 12, 0, 0, 2952, 446, 1, 0, 0, 0, 2953, 2954, 7, 20, 0, 0, 2954, 2955, 7, 19, 0, 0, 2955, 2956, 7, 22, 0, 0, 2956, 2957, 7, 13, 0, 0, 2957, 448, 1, 0, 0, 0, 2958, 2959, 7, 17, 0, 0, 2959, 2960, 7, 12, 0, 0, 2960, 2961, 7, 10, 0, 0, 2961, 2962, 7, 7, 0, 0, 2962, 2963, 7, 16, 0, 0, 2963, 2964, 7, 17, 0, 0, 2964, 2965, 7, 16, 0, 0, 2965, 2966, 7, 8, 0, 0, 2966, 450, 1, 0, 0, 0, 2967, 2968, 7, 17, 0, 0, 2968, 2969, 7, 25, 0, 0, 2969, 452, 1, 0, 0, 0, 2970, 2971, 7, 17, 0, 0, 2971, 2972, 7, 15, 0, 0, 2972, 2973, 7, 15, 0, 0, 2973, 2974, 7, 10, 0, 0, 2974, 2975, 7, 12, 0, 0, 2975, 2976, 7, 17, 0, 0, 2976, 2977, 7, 5, 0, 0, 2977, 2978, 7, 16, 0, 0, 2978, 2979, 7, 10, 0, 0, 2979, 454, 1, 0, 0, 0, 2980, 2981, 7, 17, 0, 0, 2981, 2982, 7, 15, 0, 0, 2982, 2983, 7, 15, 0, 0, 2983, 2984, 7, 22, 0, 0, 2984, 2985, 7, 16, 0, 0, 2985, 2986, 7, 5, 0, 0, 2986, 2987, 7, 18, 0, 0, 2987, 2988, 7, 6, 0, 0, 2988, 2989, 7, 10, 0, 0, 2989, 456, 1, 0, 0, 0, 2990, 2991, 7, 17, 0, 0, 2991, 2992, 7, 15, 0, 0, 2992, 2993, 7, 24, 0, 0, 2993, 2994, 7, 6, 0, 0, 2994, 2995, 7, 17, 0, 0, 2995, 2996, 7, 14, 0, 0, 2996, 2997, 7, 17, 0, 0, 2997, 2998, 7, 16, 0, 0, 2998, 458, 1, 0, 0, 0, 2999, 3000, 7, 17, 0, 0, 3000, 3001, 7, 7, 0, 0, 3001, 3002, 7, 14, 0, 0, 3002, 3003, 7, 6, 0, 0, 3003, 3004, 7, 22, 0, 0, 3004, 3005, 7, 12, 0, 0, 3005, 3006, 7, 17, 0, 0, 3006, 3007, 7, 7, 0, 0, 3007, 3008, 7, 23, 0, 0, 3008, 460, 1, 0, 0, 0, 3009, 3010, 7, 17, 0, 0, 3010, 3011, 7, 7, 0, 0, 3011, 3012, 7, 14, 0, 0, 3012, 3013, 7, 13, 0, 0, 3013, 3014, 7, 10, 0, 0, 3014, 3015, 7, 15, 0, 0, 3015, 3016, 7, 10, 0, 0, 3016, 3017, 7, 7, 0, 0, 3017, 3018, 7, 16, 0, 0, 3018, 462, 1, 0, 0, 0, 3019, 3020, 7, 17, 0, 0, 3020, 3021, 7, 7, 0, 0, 3021, 3022, 7, 12, 0, 0, 3022, 3023, 7, 10, 0, 0, 3023, 3024, 7, 26, 0, 0, 3024, 464, 1, 0, 0, 0, 3025, 3026, 7, 17, 0, 0, 3026, 3027, 7, 7, 0, 0, 3027, 3028, 7, 12, 0, 0, 3028, 3029, 7, 10, 0, 0, 3029, 3030, 7, 26, 0, 0, 3030, 3031, 7, 10, 0, 0, 3031, 3032, 7, 9, 0, 0, 3032, 466, 1, 0, 0, 0, 3033, 3034, 7, 17, 0, 0, 3034, 3035, 7, 7, 0, 0, 3035, 3036, 7, 20, 0, 0, 3036, 3037, 7, 10, 0, 0, 3037, 3038, 7, 13, 0, 0, 3038, 3039, 7, 17, 0, 0, 3039, 3040, 7, 16, 0, 0, 3040, 468, 1, 0, 0, 0, 3041, 3042, 7, 17, 0, 0, 3042, 3043, 7, 7, 0, 0, 3043, 3044, 7, 20, 0, 0, 3044, 3045, 7, 10, 0, 0, 3045, 3046, 7, 13, 0, 0, 3046, 3047, 7, 17, 0, 0, 3047, 3048, 7, 16, 0, 0, 3048, 3049, 7, 9, 0, 0, 3049, 470, 1, 0, 0, 0, 3050, 3051, 7, 17, 0, 0, 3051, 3052, 7, 7, 0, 0, 3052, 3053, 7, 6, 0, 0, 3053, 3054, 7, 17, 0, 0, 3054, 3055, 7, 7, 0, 0, 3055, 3056, 7, 10, 0, 0, 3056, 472, 1, 0, 0, 0, 3057, 3058, 7, 17, 0, 0, 3058, 3059, 7, 7, 0, 0, 3059, 3060, 7, 9, 0, 0, 3060, 3061, 7, 10, 0, 0, 3061, 3062, 7, 7, 0, 0, 3062, 3063, 7, 9, 0, 0, 3063, 3064, 7, 17, 0, 0, 3064, 3065, 7, 16, 0, 0, 3065, 3066, 7, 17, 0, 0, 3066, 3067, 7, 27, 0, 0, 3067, 3068, 7, 10, 0, 0, 3068, 474, 1, 0, 0, 0, 3069, 3070, 7, 17, 0, 0, 3070, 3071, 7, 7, 0, 0, 3071, 3072, 7, 9, 0, 0, 3072, 3073, 7, 10, 0, 0, 3073, 3074, 7, 13, 0, 0, 3074, 3075, 7, 16, 0, 0, 3075, 476, 1, 0, 0, 0, 3076, 3077, 7, 17, 0, 0, 3077, 3078, 7, 7, 0, 0, 3078, 3079, 7, 9, 0, 0, 3079, 3080, 7, 16, 0, 0, 3080, 3081, 7, 10, 0, 0, 3081, 3082, 7, 5, 0, 0, 3082, 3083, 7, 12, 0, 0, 3083, 478, 1, 0, 0, 0, 3084, 3085, 7, 17, 0, 0, 3085, 3086, 7, 7, 0, 0, 3086, 3087, 7, 27, 0, 0, 3087, 3088, 7, 19, 0, 0, 3088, 3089, 7, 21, 0, 0, 3089, 3090, 7, 10, 0, 0, 3090, 3091, 7, 13, 0, 0, 3091, 480, 1, 0, 0, 0, 3092, 3093, 7, 17, 0, 0, 3093, 3094, 7, 9, 0, 0, 3094, 3095, 7, 19, 0, 0, 3095, 3096, 7, 6, 0, 0, 3096, 3097, 7, 5, 0, 0, 3097, 3098, 7, 16, 0, 0, 3098, 3099, 7, 17, 0, 0, 3099, 3100, 7, 19, 0, 0, 3100, 3101, 7, 7, 0, 0, 3101, 482, 1, 0, 0, 0, 3102, 3103, 7, 21, 0, 0, 3103, 3104, 7, 10, 0, 0, 3104, 3105, 7, 8, 0, 0, 3105, 484, 1, 0, 0, 0, 3106, 3107, 7, 6, 0, 0, 3107, 3108, 7, 5, 0, 0, 3108, 3109, 7, 18, 0, 0, 3109, 3110, 7, 10, 0, 0, 3110, 3111, 7, 6, 0, 0, 3111, 486, 1, 0, 0, 0, 3112, 3113, 7, 6, 0, 0, 3113, 3114, 7, 5, 0, 0, 3114, 3115, 7, 7, 0, 0, 3115, 3116, 7, 23, 0, 0, 3116, 3117, 7, 22, 0, 0, 3117, 3118, 7, 5, 0, 0, 3118, 3119, 7, 23, 0, 0, 3119, 3120, 7, 10, 0, 0, 3120, 488, 1, 0, 0, 0, 3121, 3122, 7, 6, 0, 0, 3122, 3123, 7, 5, 0, 0, 3123, 3124, 7, 13, 0, 0, 3124, 3125, 7, 23, 0, 0, 3125, 3126, 7, 10, 0, 0, 3126, 490, 1, 0, 0, 0, 3127, 3128, 7, 6, 0, 0, 3128, 3129, 7, 5, 0, 0, 3129, 3130, 7, 9, 0, 0, 3130, 3131, 7, 16, 0, 0, 3131, 492, 1, 0, 0, 0, 3132, 3133, 7, 6, 0, 0, 3133, 3134, 7, 10, 0, 0, 3134, 3135, 7, 5, 0, 0, 3135, 3136, 7, 21, 0, 0, 3136, 3137, 7, 24, 0, 0, 3137, 3138, 7, 13, 0, 0, 3138, 3139, 7, 19, 0, 0, 3139, 3140, 7, 19, 0, 0, 3140, 3141, 7, 25, 0, 0, 3141, 494, 1, 0, 0, 0, 3142, 3143, 7, 6, 0, 0, 3143, 3144, 7, 10, 0, 0, 3144, 3145, 7, 27, 0, 0, 3145, 3146, 7, 10, 0, 0, 3146, 3147, 7, 6, 0, 0, 3147, 496, 1, 0, 0, 0, 3148, 3149, 7, 6, 0, 0, 3149, 3150, 7, 17, 0, 0, 3150, 3151, 7, 9, 0, 0, 3151, 3152, 7, 16, 0, 0, 3152, 3153, 7, 10, 0, 0, 3153, 3154, 7, 7, 0, 0, 3154, 498, 1, 0, 0, 0, 3155, 3156, 7, 6, 0, 0, 3156, 3157, 7, 19, 0, 0, 3157, 3158, 7, 5, 0, 0, 3158, 3159, 7, 12, 0, 0, 3159, 500, 1, 0, 0, 0, 3160, 3161, 7, 6, 0, 0, 3161, 3162, 7, 19, 0, 0, 3162, 3163, 7, 14, 0, 0, 3163, 3164, 7, 5, 0, 0, 3164, 3165, 7, 6, 0, 0, 3165, 502, 1, 0, 0, 0, 3166, 3167, 7, 6, 0, 0, 3167, 3168, 7, 19, 0, 0, 3168, 3169, 7, 14, 0, 0, 3169, 3170, 7, 5, 0, 0, 3170, 3171, 7, 16, 0, 0, 3171, 3172, 7, 17, 0, 0, 3172, 3173, 7, 19, 0, 0, 3173, 3174, 7, 7, 0, 0, 3174, 504, 1, 0, 0, 0, 3175, 3176, 7, 6, 0, 0, 3176, 3177, 7, 19, 0, 0, 3177, 3178, 7, 14, 0, 0, 3178, 3179, 7, 21, 0, 0, 3179, 506, 1, 0, 0, 0, 3180, 3181, 7, 15, 0, 0, 3181, 3182, 7, 5, 0, 0, 3182, 3183, 7, 24, 0, 0, 3183, 3184, 7, 24, 0, 0, 3184, 3185, 7, 17, 0, 0, 3185, 3186, 7, 7, 0, 0, 3186, 3187, 7, 23, 0, 0, 3187, 508, 1, 0, 0, 0, 3188, 3189, 7, 15, 0, 0, 3189, 3190, 7, 5, 0, 0, 3190, 3191, 7, 16, 0, 0, 3191, 3192, 7, 14, 0, 0, 3192, 3193, 7, 20, 0, 0, 3193, 510, 1, 0, 0, 0, 3194, 3195, 7, 15, 0, 0, 3195, 3196, 7, 5, 0, 0, 3196, 3197, 7, 16, 0, 0, 3197, 3198, 7, 14, 0, 0, 3198, 3199, 7, 20, 0, 0, 3199, 3200, 7, 10, 0, 0, 3200, 3201, 7, 12, 0, 0, 3201, 512, 1, 0, 0, 0, 3202, 3203, 7, 15, 0, 0, 3203, 3204, 7, 5, 0, 0, 3204, 3205, 7, 16, 0, 0, 3205, 3206, 7, 10, 0, 0, 3206, 3207, 7, 13, 0, 0, 3207, 3208, 7, 17, 0, 0, 3208, 3209, 7, 5, 0, 0, 3209, 3210, 7, 6, 0, 0, 3210, 3211, 7, 17, 0, 0, 3211, 3212, 7, 11, 0, 0, 3212, 3213, 7, 10, 0, 0, 3213, 3214, 7, 12, 0, 0, 3214, 514, 1, 0, 0, 0, 3215, 3216, 7, 15, 0, 0, 3216, 3217, 7, 5, 0, 0, 3217, 3218, 7, 26, 0, 0, 3218, 3219, 7, 27, 0, 0, 3219, 3220, 7, 5, 0, 0, 3220, 3221, 7, 6, 0, 0, 3221, 3222, 7, 22, 0, 0, 3222, 3223, 7, 10, 0, 0, 3223, 516, 1, 0, 0, 0, 3224, 3225, 7, 15, 0, 0, 3225, 3226, 7, 10, 0, 0, 3226, 3227, 7, 13, 0, 0, 3227, 3228, 7, 23, 0, 0, 3228, 3229, 7, 10, 0, 0, 3229, 518, 1, 0, 0, 0, 3230, 3231, 7, 15, 0, 0, 3231, 3232, 7, 17, 0, 0, 3232, 3233, 7, 7, 0, 0, 3233, 3234, 7, 22, 0, 0, 3234, 3235, 7, 16, 0, 0, 3235, 3236, 7, 10, 0, 0, 3236, 520, 1, 0, 0, 0, 3237, 3238, 7, 15, 0, 0, 3238, 3239, 7, 17, 0, 0, 3239, 3240, 7, 7, 0, 0, 3240, 3241, 7, 27, 0, 0, 3241, 3242, 7, 5, 0, 0, 3242, 3243, 7, 6, 0, 0, 3243, 3244, 7, 22, 0, 0, 3244, 3245, 7, 10, 0, 0, 3245, 522, 1, 0, 0, 0, 3246, 3247, 7, 15, 0, 0, 3247, 3248, 7, 19, 0, 0, 3248, 3249, 7, 12, 0, 0, 3249, 3250, 7, 10, 0, 0, 3250, 524, 1, 0, 0, 0, 3251, 3252, 7, 15, 0, 0, 3252, 3253, 7, 19, 0, 0, 3253, 3254, 7, 7, 0, 0, 3254, 3255, 7, 16, 0, 0, 3255, 3256, 7, 20, 0, 0, 3256, 526, 1, 0, 0, 0, 3257, 3258, 7, 15, 0, 0, 3258, 3259, 7, 19, 0, 0, 3259, 3260, 7, 27, 0, 0, 3260, 3261, 7, 10, 0, 0, 3261, 528, 1, 0, 0, 0, 3262, 3263, 7, 7, 0, 0, 3263, 3264, 7, 5, 0, 0, 3264, 3265, 7, 15, 0, 0, 3265, 3266, 7, 10, 0, 0, 3266, 530, 1, 0, 0, 0, 3267, 3268, 7, 7, 0, 0, 3268, 3269, 7, 5, 0, 0, 3269, 3270, 7, 15, 0, 0, 3270, 3271, 7, 10, 0, 0, 3271, 3272, 7, 9, 0, 0, 3272, 532, 1, 0, 0, 0, 3273, 3274, 7, 7, 0, 0, 3274, 3275, 7, 10, 0, 0, 3275, 3276, 7, 26, 0, 0, 3276, 3277, 7, 16, 0, 0, 3277, 534, 1, 0, 0, 0, 3278, 3279, 7, 7, 0, 0, 3279, 3280, 7, 19, 0, 0, 3280, 536, 1, 0, 0, 0, 3281, 3282, 7, 7, 0, 0, 3282, 3283, 7, 19, 0, 0, 3283, 3284, 7, 16, 0, 0, 3284, 3285, 7, 20, 0, 0, 3285, 3286, 7, 17, 0, 0, 3286, 3287, 7, 7, 0, 0, 3287, 3288, 7, 23, 0, 0, 3288, 538, 1, 0, 0, 0, 3289, 3290, 7, 7, 0, 0, 3290, 3291, 7, 19, 0, 0, 3291, 3292, 7, 16, 0, 0, 3292, 3293, 7, 17, 0, 0, 3293, 3294, 7, 25, 0, 0, 3294, 3295, 7, 8, 0, 0, 3295, 540, 1, 0, 0, 0, 3296, 3297, 7, 7, 0, 0, 3297, 3298, 7, 19, 0, 0, 3298, 3299, 7, 29, 0, 0, 3299, 3300, 7, 5, 0, 0, 3300, 3301, 7, 17, 0, 0, 3301, 3302, 7, 16, 0, 0, 3302, 542, 1, 0, 0, 0, 3303, 3304, 7, 7, 0, 0, 3304, 3305, 7, 22, 0, 0, 3305, 3306, 7, 6, 0, 0, 3306, 3307, 7, 6, 0, 0, 3307, 3308, 7, 9, 0, 0, 3308, 544, 1, 0, 0, 0, 3309, 3310, 7, 19, 0, 0, 3310, 3311, 7, 18, 0, 0, 3311, 3312, 7, 30, 0, 0, 3312, 3313, 7, 10, 0, 0, 3313, 3314, 7, 14, 0, 0, 3314, 3315, 7, 16, 0, 0, 3315, 546, 1, 0, 0, 0, 3316, 3317, 7, 19, 0, 0, 3317, 3318, 7, 25, 0, 0, 3318, 548, 1, 0, 0, 0, 3319, 3320, 7, 19, 0, 0, 3320, 3321, 7, 25, 0, 0, 3321, 3322, 7, 25, 0, 0, 3322, 550, 1, 0, 0, 0, 3323, 3324, 7, 19, 0, 0, 3324, 3325, 7, 17, 0, 0, 3325, 3326, 7, 12, 0, 0, 3326, 3327, 7, 9, 0, 0, 3327, 552, 1, 0, 0, 0, 3328, 3329, 7, 19, 0, 0, 3329, 3330, 7, 24, 0, 0, 3330, 3331, 7, 10, 0, 0, 3331, 3332, 7, 13, 0, 0, 3332, 3333, 7, 5, 0, 0, 3333, 3334, 7, 16, 0, 0, 3334, 3335, 7, 19, 0, 0, 3335, 3336, 7, 13, 0, 0, 3336, 554, 1, 0, 0, 0, 3337, 3338, 7, 19, 0, 0, 3338, 3339, 7, 24, 0, 0, 3339, 3340, 7, 16, 0, 0, 3340, 3341, 7, 17, 0, 0, 3341, 3342, 7, 19, 0, 0, 3342, 3343, 7, 7, 0, 0, 3343, 556, 1, 0, 0, 0, 3344, 3345, 7, 19, 0, 0, 3345, 3346, 7, 24, 0, 0, 3346, 3347, 7, 16, 0, 0, 3347, 3348, 7, 17, 0, 0, 3348, 3349, 7, 19, 0, 0, 3349, 3350, 7, 7, 0, 0, 3350, 3351, 7, 9, 0, 0, 3351, 558, 1, 0, 0, 0, 3352, 3353, 7, 19, 0, 0, 3353, 3354, 7, 29, 0, 0, 3354, 3355, 7, 7, 0, 0, 3355, 3356, 7, 10, 0, 0, 3356, 3357, 7, 12, 0, 0, 3357, 560, 1, 0, 0, 0, 3358, 3359, 7, 19, 0, 0, 3359, 3360, 7, 29, 0, 0, 3360, 3361, 7, 7, 0, 0, 3361, 3362, 7, 10, 0, 0, 3362, 3363, 7, 13, 0, 0, 3363, 562, 1, 0, 0, 0, 3364, 3365, 7, 24, 0, 0, 3365, 3366, 7, 5, 0, 0, 3366, 3367, 7, 13, 0, 0, 3367, 3368, 7, 9, 0, 0, 3368, 3369, 7, 10, 0, 0, 3369, 3370, 7, 13, 0, 0, 3370, 564, 1, 0, 0, 0, 3371, 3372, 7, 24, 0, 0, 3372, 3373, 7, 5, 0, 0, 3373, 3374, 7, 13, 0, 0, 3374, 3375, 7, 16, 0, 0, 3375, 3376, 7, 17, 0, 0, 3376, 3377, 7, 5, 0, 0, 3377, 3378, 7, 6, 0, 0, 3378, 566, 1, 0, 0, 0, 3379, 3380, 7, 24, 0, 0, 3380, 3381, 7, 5, 0, 0, 3381, 3382, 7, 13, 0, 0, 3382, 3383, 7, 16, 0, 0, 3383, 3384, 7, 17, 0, 0, 3384, 3385, 7, 16, 0, 0, 3385, 3386, 7, 17, 0, 0, 3386, 3387, 7, 19, 0, 0, 3387, 3388, 7, 7, 0, 0, 3388, 568, 1, 0, 0, 0, 3389, 3390, 7, 24, 0, 0, 3390, 3391, 7, 5, 0, 0, 3391, 3392, 7, 9, 0, 0, 3392, 3393, 7, 9, 0, 0, 3393, 3394, 7, 17, 0, 0, 3394, 3395, 7, 7, 0, 0, 3395, 3396, 7, 23, 0, 0, 3396, 570, 1, 0, 0, 0, 3397, 3398, 7, 24, 0, 0, 3398, 3399, 7, 5, 0, 0, 3399, 3400, 7, 9, 0, 0, 3400, 3401, 7, 9, 0, 0, 3401, 3402, 7, 29, 0, 0, 3402, 3403, 7, 19, 0, 0, 3403, 3404, 7, 13, 0, 0, 3404, 3405, 7, 12, 0, 0, 3405, 572, 1, 0, 0, 0, 3406, 3407, 7, 24, 0, 0, 3407, 3408, 7, 6, 0, 0, 3408, 3409, 7, 5, 0, 0, 3409, 3410, 7, 7, 0, 0, 3410, 3411, 7, 9, 0, 0, 3411, 574, 1, 0, 0, 0, 3412, 3413, 7, 24, 0, 0, 3413, 3414, 7, 13, 0, 0, 3414, 3415, 7, 10, 0, 0, 3415, 3416, 7, 14, 0, 0, 3416, 3417, 7, 10, 0, 0, 3417, 3418, 7, 12, 0, 0, 3418, 3419, 7, 17, 0, 0, 3419, 3420, 7, 7, 0, 0, 3420, 3421, 7, 23, 0, 0, 3421, 576, 1, 0, 0, 0, 3422, 3423, 7, 24, 0, 0, 3423, 3424, 7, 13, 0, 0, 3424, 3425, 7, 10, 0, 0, 3425, 3426, 7, 24, 0, 0, 3426, 3427, 7, 5, 0, 0, 3427, 3428, 7, 13, 0, 0, 3428, 3429, 7, 10, 0, 0, 3429, 578, 1, 0, 0, 0, 3430, 3431, 7, 24, 0, 0, 3431, 3432, 7, 13, 0, 0, 3432, 3433, 7, 10, 0, 0, 3433, 3434, 7, 24, 0, 0, 3434, 3435, 7, 5, 0, 0, 3435, 3436, 7, 13, 0, 0, 3436, 3437, 7, 10, 0, 0, 3437, 3438, 7, 12, 0, 0, 3438, 580, 1, 0, 0, 0, 3439, 3440, 7, 24, 0, 0, 3440, 3441, 7, 13, 0, 0, 3441, 3442, 7, 10, 0, 0, 3442, 3443, 7, 9, 0, 0, 3443, 3444, 7, 10, 0, 0, 3444, 3445, 7, 13, 0, 0, 3445, 3446, 7, 27, 0, 0, 3446, 3447, 7, 10, 0, 0, 3447, 582, 1, 0, 0, 0, 3448, 3449, 7, 24, 0, 0, 3449, 3450, 7, 13, 0, 0, 3450, 3451, 7, 17, 0, 0, 3451, 3452, 7, 19, 0, 0, 3452, 3453, 7, 13, 0, 0, 3453, 584, 1, 0, 0, 0, 3454, 3455, 7, 24, 0, 0, 3455, 3456, 7, 13, 0, 0, 3456, 3457, 7, 17, 0, 0, 3457, 3458, 7, 27, 0, 0, 3458, 3459, 7, 17, 0, 0, 3459, 3460, 7, 6, 0, 0, 3460, 3461, 7, 10, 0, 0, 3461, 3462, 7, 23, 0, 0, 3462, 3463, 7, 10, 0, 0, 3463, 3464, 7, 9, 0, 0, 3464, 586, 1, 0, 0, 0, 3465, 3466, 7, 24, 0, 0, 3466, 3467, 7, 13, 0, 0, 3467, 3468, 7, 19, 0, 0, 3468, 3469, 7, 14, 0, 0, 3469, 3470, 7, 10, 0, 0, 3470, 3471, 7, 12, 0, 0, 3471, 3472, 7, 22, 0, 0, 3472, 3473, 7, 13, 0, 0, 3473, 3474, 7, 5, 0, 0, 3474, 3475, 7, 6, 0, 0, 3475, 588, 1, 0, 0, 0, 3476, 3477, 7, 24, 0, 0, 3477, 3478, 7, 13, 0, 0, 3478, 3479, 7, 19, 0, 0, 3479, 3480, 7, 14, 0, 0, 3480, 3481, 7, 10, 0, 0, 3481, 3482, 7, 12, 0, 0, 3482, 3483, 7, 22, 0, 0, 3483, 3484, 7, 13, 0, 0, 3484, 3485, 7, 10, 0, 0, 3485, 590, 1, 0, 0, 0, 3486, 3487, 7, 24, 0, 0, 3487, 3488, 7, 13, 0, 0, 3488, 3489, 7, 19, 0, 0, 3489, 3490, 7, 23, 0, 0, 3490, 3491, 7, 13, 0, 0, 3491, 3492, 7, 5, 0, 0, 3492, 3493, 7, 15, 0, 0, 3493, 592, 1, 0, 0, 0, 3494, 3495, 7, 28, 0, 0, 3495, 3496, 7, 22, 0, 0, 3496, 3497, 7, 19, 0, 0, 3497, 3498, 7, 16, 0, 0, 3498, 3499, 7, 10, 0, 0, 3499, 594, 1, 0, 0, 0, 3500, 3501, 7, 13, 0, 0, 3501, 3502, 7, 5, 0, 0, 3502, 3503, 7, 7, 0, 0, 3503, 3504, 7, 23, 0, 0, 3504, 3505, 7, 10, 0, 0, 3505, 596, 1, 0, 0, 0, 3506, 3507, 7, 13, 0, 0, 3507, 3508, 7, 10, 0, 0, 3508, 3509, 7, 5, 0, 0, 3509, 3510, 7, 12, 0, 0, 3510, 598, 1, 0, 0, 0, 3511, 3512, 7, 13, 0, 0, 3512, 3513, 7, 10, 0, 0, 3513, 3514, 7, 5, 0, 0, 3514, 3515, 7, 9, 0, 0, 3515, 3516, 7, 9, 0, 0, 3516, 3517, 7, 17, 0, 0, 3517, 3518, 7, 23, 0, 0, 3518, 3519, 7, 7, 0, 0, 3519, 600, 1, 0, 0, 0, 3520, 3521, 7, 13, 0, 0, 3521, 3522, 7, 10, 0, 0, 3522, 3523, 7, 14, 0, 0, 3523, 3524, 7, 20, 0, 0, 3524, 3525, 7, 10, 0, 0, 3525, 3526, 7, 14, 0, 0, 3526, 3527, 7, 21, 0, 0, 3527, 602, 1, 0, 0, 0, 3528, 3529, 7, 13, 0, 0, 3529, 3530, 7, 10, 0, 0, 3530, 3531, 7, 14, 0, 0, 3531, 3532, 7, 22, 0, 0, 3532, 3533, 7, 13, 0, 0, 3533, 3534, 7, 9, 0, 0, 3534, 3535, 7, 17, 0, 0, 3535, 3536, 7, 27, 0, 0, 3536, 3537, 7, 10, 0, 0, 3537, 604, 1, 0, 0, 0, 3538, 3539, 7, 13, 0, 0, 3539, 3540, 7, 10, 0, 0, 3540, 3541, 7, 25, 0, 0, 3541, 606, 1, 0, 0, 0, 3542, 3543, 7, 13, 0, 0, 3543, 3544, 7, 10, 0, 0, 3544, 3545, 7, 25, 0, 0, 3545, 3546, 7, 13, 0, 0, 3546, 3547, 7, 10, 0, 0, 3547, 3548, 7, 9, 0, 0, 3548, 3549, 7, 20, 0, 0, 3549, 608, 1, 0, 0, 0, 3550, 3551, 7, 13, 0, 0, 3551, 3552, 7, 10, 0, 0, 3552, 3553, 7, 17, 0, 0, 3553, 3554, 7, 7, 0, 0, 3554, 3555, 7, 12, 0, 0, 3555, 3556, 7, 10, 0, 0, 3556, 3557, 7, 26, 0, 0, 3557, 610, 1, 0, 0, 0, 3558, 3559, 7, 13, 0, 0, 3559, 3560, 7, 10, 0, 0, 3560, 3561, 7, 6, 0, 0, 3561, 3562, 7, 5, 0, 0, 3562, 3563, 7, 16, 0, 0, 3563, 3564, 7, 17, 0, 0, 3564, 3565, 7, 27, 0, 0, 3565, 3566, 7, 10, 0, 0, 3566, 612, 1, 0, 0, 0, 3567, 3568, 7, 13, 0, 0, 3568, 3569, 7, 10, 0, 0, 3569, 3570, 7, 6, 0, 0, 3570, 3571, 7, 10, 0, 0, 3571, 3572, 7, 5, 0, 0, 3572, 3573, 7, 9, 0, 0, 3573, 3574, 7, 10, 0, 0, 3574, 614, 1, 0, 0, 0, 3575, 3576, 7, 13, 0, 0, 3576, 3577, 7, 10, 0, 0, 3577, 3578, 7, 7, 0, 0, 3578, 3579, 7, 5, 0, 0, 3579, 3580, 7, 15, 0, 0, 3580, 3581, 7, 10, 0, 0, 3581, 616, 1, 0, 0, 0, 3582, 3583, 7, 13, 0, 0, 3583, 3584, 7, 10, 0, 0, 3584, 3585, 7, 24, 0, 0, 3585, 3586, 7, 10, 0, 0, 3586, 3587, 7, 5, 0, 0, 3587, 3588, 7, 16, 0, 0, 3588, 3589, 7, 5, 0, 0, 3589, 3590, 7, 18, 0, 0, 3590, 3591, 7, 6, 0, 0, 3591, 3592, 7, 10, 0, 0, 3592, 618, 1, 0, 0, 0, 3593, 3594, 7, 13, 0, 0, 3594, 3595, 7, 10, 0, 0, 3595, 3596, 7, 24, 0, 0, 3596, 3597, 7, 6, 0, 0, 3597, 3598, 7, 5, 0, 0, 3598, 3599, 7, 14, 0, 0, 3599, 3600, 7, 10, 0, 0, 3600, 620, 1, 0, 0, 0, 3601, 3602, 7, 13, 0, 0, 3602, 3603, 7, 10, 0, 0, 3603, 3604, 7, 24, 0, 0, 3604, 3605, 7, 6, 0, 0, 3605, 3606, 7, 17, 0, 0, 3606, 3607, 7, 14, 0, 0, 3607, 3608, 7, 5, 0, 0, 3608, 622, 1, 0, 0, 0, 3609, 3610, 7, 13, 0, 0, 3610, 3611, 7, 10, 0, 0, 3611, 3612, 7, 9, 0, 0, 3612, 3613, 7, 10, 0, 0, 3613, 3614, 7, 16, 0, 0, 3614, 624, 1, 0, 0, 0, 3615, 3616, 7, 13, 0, 0, 3616, 3617, 7, 10, 0, 0, 3617, 3618, 7, 9, 0, 0, 3618, 3619, 7, 16, 0, 0, 3619, 3620, 7, 5, 0, 0, 3620, 3621, 7, 13, 0, 0, 3621, 3622, 7, 16, 0, 0, 3622, 626, 1, 0, 0, 0, 3623, 3624, 7, 13, 0, 0, 3624, 3625, 7, 10, 0, 0, 3625, 3626, 7, 9, 0, 0, 3626, 3627, 7, 16, 0, 0, 3627, 3628, 7, 13, 0, 0, 3628, 3629, 7, 17, 0, 0, 3629, 3630, 7, 14, 0, 0, 3630, 3631, 7, 16, 0, 0, 3631, 628, 1, 0, 0, 0, 3632, 3633, 7, 13, 0, 0, 3633, 3634, 7, 10, 0, 0, 3634, 3635, 7, 16, 0, 0, 3635, 3636, 7, 22, 0, 0, 3636, 3637, 7, 13, 0, 0, 3637, 3638, 7, 7, 0, 0, 3638, 3639, 7, 9, 0, 0, 3639, 630, 1, 0, 0, 0, 3640, 3641, 7, 13, 0, 0, 3641, 3642, 7, 10, 0, 0, 3642, 3643, 7, 27, 0, 0, 3643, 3644, 7, 19, 0, 0, 3644, 3645, 7, 21, 0, 0, 3645, 3646, 7, 10, 0, 0, 3646, 632, 1, 0, 0, 0, 3647, 3648, 7, 13, 0, 0, 3648, 3649, 7, 19, 0, 0, 3649, 3650, 7, 6, 0, 0, 3650, 3651, 7, 10, 0, 0, 3651, 634, 1, 0, 0, 0, 3652, 3653, 7, 13, 0, 0, 3653, 3654, 7, 19, 0, 0, 3654, 3655, 7, 6, 0, 0, 3655, 3656, 7, 6, 0, 0, 3656, 3657, 7, 18, 0, 0, 3657, 3658, 7, 5, 0, 0, 3658, 3659, 7, 14, 0, 0, 3659, 3660, 7, 21, 0, 0, 3660, 636, 1, 0, 0, 0, 3661, 3662, 7, 13, 0, 0, 3662, 3663, 7, 19, 0, 0, 3663, 3664, 7, 29, 0, 0, 3664, 3665, 7, 9, 0, 0, 3665, 638, 1, 0, 0, 0, 3666, 3667, 7, 13, 0, 0, 3667, 3668, 7, 22, 0, 0, 3668, 3669, 7, 6, 0, 0, 3669, 3670, 7, 10, 0, 0, 3670, 640, 1, 0, 0, 0, 3671, 3672, 7, 9, 0, 0, 3672, 3673, 7, 5, 0, 0, 3673, 3674, 7, 27, 0, 0, 3674, 3675, 7, 10, 0, 0, 3675, 3676, 7, 24, 0, 0, 3676, 3677, 7, 19, 0, 0, 3677, 3678, 7, 17, 0, 0, 3678, 3679, 7, 7, 0, 0, 3679, 3680, 7, 16, 0, 0, 3680, 642, 1, 0, 0, 0, 3681, 3682, 7, 9, 0, 0, 3682, 3683, 7, 14, 0, 0, 3683, 3684, 7, 20, 0, 0, 3684, 3685, 7, 10, 0, 0, 3685, 3686, 7, 15, 0, 0, 3686, 3687, 7, 5, 0, 0, 3687, 644, 1, 0, 0, 0, 3688, 3689, 7, 9, 0, 0, 3689, 3690, 7, 14, 0, 0, 3690, 3691, 7, 13, 0, 0, 3691, 3692, 7, 19, 0, 0, 3692, 3693, 7, 6, 0, 0, 3693, 3694, 7, 6, 0, 0, 3694, 646, 1, 0, 0, 0, 3695, 3696, 7, 9, 0, 0, 3696, 3697, 7, 10, 0, 0, 3697, 3698, 7, 5, 0, 0, 3698, 3699, 7, 13, 0, 0, 3699, 3700, 7, 14, 0, 0, 3700, 3701, 7, 20, 0, 0, 3701, 648, 1, 0, 0, 0, 3702, 3703, 7, 9, 0, 0, 3703, 3704, 7, 10, 0, 0, 3704, 3705, 7, 14, 0, 0, 3705, 3706, 7, 19, 0, 0, 3706, 3707, 7, 7, 0, 0, 3707, 3708, 7, 12, 0, 0, 3708, 650, 1, 0, 0, 0, 3709, 3710, 7, 9, 0, 0, 3710, 3711, 7, 10, 0, 0, 3711, 3712, 7, 14, 0, 0, 3712, 3713, 7, 22, 0, 0, 3713, 3714, 7, 13, 0, 0, 3714, 3715, 7, 17, 0, 0, 3715, 3716, 7, 16, 0, 0, 3716, 3717, 7, 8, 0, 0, 3717, 652, 1, 0, 0, 0, 3718, 3719, 7, 9, 0, 0, 3719, 3720, 7, 10, 0, 0, 3720, 3721, 7, 28, 0, 0, 3721, 3722, 7, 22, 0, 0, 3722, 3723, 7, 10, 0, 0, 3723, 3724, 7, 7, 0, 0, 3724, 3725, 7, 14, 0, 0, 3725, 3726, 7, 10, 0, 0, 3726, 654, 1, 0, 0, 0, 3727, 3728, 7, 9, 0, 0, 3728, 3729, 7, 10, 0, 0, 3729, 3730, 7, 28, 0, 0, 3730, 3731, 7, 22, 0, 0, 3731, 3732, 7, 10, 0, 0, 3732, 3733, 7, 7, 0, 0, 3733, 3734, 7, 14, 0, 0, 3734, 3735, 7, 10, 0, 0, 3735, 3736, 7, 9, 0, 0, 3736, 656, 1, 0, 0, 0, 3737, 3738, 7, 9, 0, 0, 3738, 3739, 7, 10, 0, 0, 3739, 3740, 7, 13, 0, 0, 3740, 3741, 7, 17, 0, 0, 3741, 3742, 7, 5, 0, 0, 3742, 3743, 7, 6, 0, 0, 3743, 3744, 7, 17, 0, 0, 3744, 3745, 7, 11, 0, 0, 3745, 3746, 7, 5, 0, 0, 3746, 3747, 7, 18, 0, 0, 3747, 3748, 7, 6, 0, 0, 3748, 3749, 7, 10, 0, 0, 3749, 658, 1, 0, 0, 0, 3750, 3751, 7, 9, 0, 0, 3751, 3752, 7, 10, 0, 0, 3752, 3753, 7, 13, 0, 0, 3753, 3754, 7, 27, 0, 0, 3754, 3755, 7, 10, 0, 0, 3755, 3756, 7, 13, 0, 0, 3756, 660, 1, 0, 0, 0, 3757, 3758, 7, 9, 0, 0, 3758, 3759, 7, 10, 0, 0, 3759, 3760, 7, 9, 0, 0, 3760, 3761, 7, 9, 0, 0, 3761, 3762, 7, 17, 0, 0, 3762, 3763, 7, 19, 0, 0, 3763, 3764, 7, 7, 0, 0, 3764, 662, 1, 0, 0, 0, 3765, 3766, 7, 9, 0, 0, 3766, 3767, 7, 10, 0, 0, 3767, 3768, 7, 16, 0, 0, 3768, 664, 1, 0, 0, 0, 3769, 3770, 7, 9, 0, 0, 3770, 3771, 7, 20, 0, 0, 3771, 3772, 7, 5, 0, 0, 3772, 3773, 7, 13, 0, 0, 3773, 3774, 7, 10, 0, 0, 3774, 666, 1, 0, 0, 0, 3775, 3776, 7, 9, 0, 0, 3776, 3777, 7, 20, 0, 0, 3777, 3778, 7, 19, 0, 0, 3778, 3779, 7, 29, 0, 0, 3779, 668, 1, 0, 0, 0, 3780, 3781, 7, 9, 0, 0, 3781, 3782, 7, 17, 0, 0, 3782, 3783, 7, 15, 0, 0, 3783, 3784, 7, 24, 0, 0, 3784, 3785, 7, 6, 0, 0, 3785, 3786, 7, 10, 0, 0, 3786, 670, 1, 0, 0, 0, 3787, 3788, 7, 9, 0, 0, 3788, 3789, 7, 7, 0, 0, 3789, 3790, 7, 5, 0, 0, 3790, 3791, 7, 24, 0, 0, 3791, 3792, 7, 9, 0, 0, 3792, 3793, 7, 20, 0, 0, 3793, 3794, 7, 19, 0, 0, 3794, 3795, 7, 16, 0, 0, 3795, 672, 1, 0, 0, 0, 3796, 3797, 7, 9, 0, 0, 3797, 3798, 7, 16, 0, 0, 3798, 3799, 7, 5, 0, 0, 3799, 3800, 7, 18, 0, 0, 3800, 3801, 7, 6, 0, 0, 3801, 3802, 7, 10, 0, 0, 3802, 674, 1, 0, 0, 0, 3803, 3804, 7, 9, 0, 0, 3804, 3805, 7, 16, 0, 0, 3805, 3806, 7, 5, 0, 0, 3806, 3807, 7, 7, 0, 0, 3807, 3808, 7, 12, 0, 0, 3808, 3809, 7, 5, 0, 0, 3809, 3810, 7, 6, 0, 0, 3810, 3811, 7, 19, 0, 0, 3811, 3812, 7, 7, 0, 0, 3812, 3813, 7, 10, 0, 0, 3813, 676, 1, 0, 0, 0, 3814, 3815, 7, 9, 0, 0, 3815, 3816, 7, 16, 0, 0, 3816, 3817, 7, 5, 0, 0, 3817, 3818, 7, 13, 0, 0, 3818, 3819, 7, 16, 0, 0, 3819, 678, 1, 0, 0, 0, 3820, 3821, 7, 9, 0, 0, 3821, 3822, 7, 16, 0, 0, 3822, 3823, 7, 5, 0, 0, 3823, 3824, 7, 16, 0, 0, 3824, 3825, 7, 10, 0, 0, 3825, 3826, 7, 15, 0, 0, 3826, 3827, 7, 10, 0, 0, 3827, 3828, 7, 7, 0, 0, 3828, 3829, 7, 16, 0, 0, 3829, 680, 1, 0, 0, 0, 3830, 3831, 7, 9, 0, 0, 3831, 3832, 7, 16, 0, 0, 3832, 3833, 7, 5, 0, 0, 3833, 3834, 7, 16, 0, 0, 3834, 3835, 7, 17, 0, 0, 3835, 3836, 7, 9, 0, 0, 3836, 3837, 7, 16, 0, 0, 3837, 3838, 7, 17, 0, 0, 3838, 3839, 7, 14, 0, 0, 3839, 3840, 7, 9, 0, 0, 3840, 682, 1, 0, 0, 0, 3841, 3842, 7, 9, 0, 0, 3842, 3843, 7, 16, 0, 0, 3843, 3844, 7, 12, 0, 0, 3844, 3845, 7, 17, 0, 0, 3845, 3846, 7, 7, 0, 0, 3846, 684, 1, 0, 0, 0, 3847, 3848, 7, 9, 0, 0, 3848, 3849, 7, 16, 0, 0, 3849, 3850, 7, 12, 0, 0, 3850, 3851, 7, 19, 0, 0, 3851, 3852, 7, 22, 0, 0, 3852, 3853, 7, 16, 0, 0, 3853, 686, 1, 0, 0, 0, 3854, 3855, 7, 9, 0, 0, 3855, 3856, 7, 16, 0, 0, 3856, 3857, 7, 19, 0, 0, 3857, 3858, 7, 13, 0, 0, 3858, 3859, 7, 5, 0, 0, 3859, 3860, 7, 23, 0, 0, 3860, 3861, 7, 10, 0, 0, 3861, 688, 1, 0, 0, 0, 3862, 3863, 7, 9, 0, 0, 3863, 3864, 7, 16, 0, 0, 3864, 3865, 7, 13, 0, 0, 3865, 3866, 7, 17, 0, 0, 3866, 3867, 7, 14, 0, 0, 3867, 3868, 7, 16, 0, 0, 3868, 690, 1, 0, 0, 0, 3869, 3870, 7, 9, 0, 0, 3870, 3871, 7, 16, 0, 0, 3871, 3872, 7, 13, 0, 0, 3872, 3873, 7, 17, 0, 0, 3873, 3874, 7, 24, 0, 0, 3874, 692, 1, 0, 0, 0, 3875, 3876, 7, 9, 0, 0, 3876, 3877, 7, 8, 0, 0, 3877, 3878, 7, 9, 0, 0, 3878, 3879, 7, 17, 0, 0, 3879, 3880, 7, 12, 0, 0, 3880, 694, 1, 0, 0, 0, 3881, 3882, 7, 9, 0, 0, 3882, 3883, 7, 8, 0, 0, 3883, 3884, 7, 9, 0, 0, 3884, 3885, 7, 16, 0, 0, 3885, 3886, 7, 10, 0, 0, 3886, 3887, 7, 15, 0, 0, 3887, 696, 1, 0, 0, 0, 3888, 3889, 7, 16, 0, 0, 3889, 3890, 7, 5, 0, 0, 3890, 3891, 7, 18, 0, 0, 3891, 3892, 7, 6, 0, 0, 3892, 3893, 7, 10, 0, 0, 3893, 3894, 7, 9, 0, 0, 3894, 698, 1, 0, 0, 0, 3895, 3896, 7, 16, 0, 0, 3896, 3897, 7, 5, 0, 0, 3897, 3898, 7, 18, 0, 0, 3898, 3899, 7, 6, 0, 0, 3899, 3900, 7, 10, 0, 0, 3900, 3901, 7, 9, 0, 0, 3901, 3902, 7, 24, 0, 0, 3902, 3903, 7, 5, 0, 0, 3903, 3904, 7, 14, 0, 0, 3904, 3905, 7, 10, 0, 0, 3905, 700, 1, 0, 0, 0, 3906, 3907, 7, 16, 0, 0, 3907, 3908, 7, 10, 0, 0, 3908, 3909, 7, 15, 0, 0, 3909, 3910, 7, 24, 0, 0, 3910, 702, 1, 0, 0, 0, 3911, 3912, 7, 16, 0, 0, 3912, 3913, 7, 10, 0, 0, 3913, 3914, 7, 15, 0, 0, 3914, 3915, 7, 24, 0, 0, 3915, 3916, 7, 6, 0, 0, 3916, 3917, 7, 5, 0, 0, 3917, 3918, 7, 16, 0, 0, 3918, 3919, 7, 10, 0, 0, 3919, 704, 1, 0, 0, 0, 3920, 3921, 7, 16, 0, 0, 3921, 3922, 7, 10, 0, 0, 3922, 3923, 7, 15, 0, 0, 3923, 3924, 7, 24, 0, 0, 3924, 3925, 7, 19, 0, 0, 3925, 3926, 7, 13, 0, 0, 3926, 3927, 7, 5, 0, 0, 3927, 3928, 7, 13, 0, 0, 3928, 3929, 7, 8, 0, 0, 3929, 706, 1, 0, 0, 0, 3930, 3931, 7, 16, 0, 0, 3931, 3932, 7, 10, 0, 0, 3932, 3933, 7, 26, 0, 0, 3933, 3934, 7, 16, 0, 0, 3934, 708, 1, 0, 0, 0, 3935, 3936, 7, 16, 0, 0, 3936, 3937, 7, 13, 0, 0, 3937, 3938, 7, 5, 0, 0, 3938, 3939, 7, 7, 0, 0, 3939, 3940, 7, 9, 0, 0, 3940, 3941, 7, 5, 0, 0, 3941, 3942, 7, 14, 0, 0, 3942, 3943, 7, 16, 0, 0, 3943, 3944, 7, 17, 0, 0, 3944, 3945, 7, 19, 0, 0, 3945, 3946, 7, 7, 0, 0, 3946, 710, 1, 0, 0, 0, 3947, 3948, 7, 16, 0, 0, 3948, 3949, 7, 13, 0, 0, 3949, 3950, 7, 17, 0, 0, 3950, 3951, 7, 23, 0, 0, 3951, 3952, 7, 23, 0, 0, 3952, 3953, 7, 10, 0, 0, 3953, 3954, 7, 13, 0, 0, 3954, 712, 1, 0, 0, 0, 3955, 3956, 7, 16, 0, 0, 3956, 3957, 7, 13, 0, 0, 3957, 3958, 7, 22, 0, 0, 3958, 3959, 7, 7, 0, 0, 3959, 3960, 7, 14, 0, 0, 3960, 3961, 7, 5, 0, 0, 3961, 3962, 7, 16, 0, 0, 3962, 3963, 7, 10, 0, 0, 3963, 714, 1, 0, 0, 0, 3964, 3965, 7, 16, 0, 0, 3965, 3966, 7, 13, 0, 0, 3966, 3967, 7, 22, 0, 0, 3967, 3968, 7, 9, 0, 0, 3968, 3969, 7, 16, 0, 0, 3969, 3970, 7, 10, 0, 0, 3970, 3971, 7, 12, 0, 0, 3971, 716, 1, 0, 0, 0, 3972, 3973, 7, 16, 0, 0, 3973, 3974, 7, 8, 0, 0, 3974, 3975, 7, 24, 0, 0, 3975, 3976, 7, 10, 0, 0, 3976, 718, 1, 0, 0, 0, 3977, 3978, 7, 16, 0, 0, 3978, 3979, 7, 8, 0, 0, 3979, 3980, 7, 24, 0, 0, 3980, 3981, 7, 10, 0, 0, 3981, 3982, 7, 9, 0, 0, 3982, 720, 1, 0, 0, 0, 3983, 3984, 7, 22, 0, 0, 3984, 3985, 7, 7, 0, 0, 3985, 3986, 7, 18, 0, 0, 3986, 3987, 7, 19, 0, 0, 3987, 3988, 7, 22, 0, 0, 3988, 3989, 7, 7, 0, 0, 3989, 3990, 7, 12, 0, 0, 3990, 3991, 7, 10, 0, 0, 3991, 3992, 7, 12, 0, 0, 3992, 722, 1, 0, 0, 0, 3993, 3994, 7, 22, 0, 0, 3994, 3995, 7, 7, 0, 0, 3995, 3996, 7, 14, 0, 0, 3996, 3997, 7, 19, 0, 0, 3997, 3998, 7, 15, 0, 0, 3998, 3999, 7, 15, 0, 0, 3999, 4000, 7, 17, 0, 0, 4000, 4001, 7, 16, 0, 0, 4001, 4002, 7, 16, 0, 0, 4002, 4003, 7, 10, 0, 0, 4003, 4004, 7, 12, 0, 0, 4004, 724, 1, 0, 0, 0, 4005, 4006, 7, 22, 0, 0, 4006, 4007, 7, 7, 0, 0, 4007, 4008, 7, 10, 0, 0, 4008, 4009, 7, 7, 0, 0, 4009, 4010, 7, 14, 0, 0, 4010, 4011, 7, 13, 0, 0, 4011, 4012, 7, 8, 0, 0, 4012, 4013, 7, 24, 0, 0, 4013, 4014, 7, 16, 0, 0, 4014, 4015, 7, 10, 0, 0, 4015, 4016, 7, 12, 0, 0, 4016, 726, 1, 0, 0, 0, 4017, 4018, 7, 22, 0, 0, 4018, 4019, 7, 7, 0, 0, 4019, 4020, 7, 21, 0, 0, 4020, 4021, 7, 7, 0, 0, 4021, 4022, 7, 19, 0, 0, 4022, 4023, 7, 29, 0, 0, 4023, 4024, 7, 7, 0, 0, 4024, 728, 1, 0, 0, 0, 4025, 4026, 7, 22, 0, 0, 4026, 4027, 7, 7, 0, 0, 4027, 4028, 7, 6, 0, 0, 4028, 4029, 7, 17, 0, 0, 4029, 4030, 7, 9, 0, 0, 4030, 4031, 7, 16, 0, 0, 4031, 4032, 7, 10, 0, 0, 4032, 4033, 7, 7, 0, 0, 4033, 730, 1, 0, 0, 0, 4034, 4035, 7, 22, 0, 0, 4035, 4036, 7, 7, 0, 0, 4036, 4037, 7, 6, 0, 0, 4037, 4038, 7, 19, 0, 0, 4038, 4039, 7, 23, 0, 0, 4039, 4040, 7, 23, 0, 0, 4040, 4041, 7, 10, 0, 0, 4041, 4042, 7, 12, 0, 0, 4042, 732, 1, 0, 0, 0, 4043, 4044, 7, 22, 0, 0, 4044, 4045, 7, 7, 0, 0, 4045, 4046, 7, 16, 0, 0, 4046, 4047, 7, 17, 0, 0, 4047, 4048, 7, 6, 0, 0, 4048, 734, 1, 0, 0, 0, 4049, 4050, 7, 22, 0, 0, 4050, 4051, 7, 24, 0, 0, 4051, 4052, 7, 12, 0, 0, 4052, 4053, 7, 5, 0, 0, 4053, 4054, 7, 16, 0, 0, 4054, 4055, 7, 10, 0, 0, 4055, 736, 1, 0, 0, 0, 4056, 4057, 7, 27, 0, 0, 4057, 4058, 7, 5, 0, 0, 4058, 4059, 7, 14, 0, 0, 4059, 4060, 7, 22, 0, 0, 4060, 4061, 7, 22, 0, 0, 4061, 4062, 7, 15, 0, 0, 4062, 738, 1, 0, 0, 0, 4063, 4064, 7, 27, 0, 0, 4064, 4065, 7, 5, 0, 0, 4065, 4066, 7, 6, 0, 0, 4066, 4067, 7, 17, 0, 0, 4067, 4068, 7, 12, 0, 0, 4068, 740, 1, 0, 0, 0, 4069, 4070, 7, 27, 0, 0, 4070, 4071, 7, 5, 0, 0, 4071, 4072, 7, 6, 0, 0, 4072, 4073, 7, 17, 0, 0, 4073, 4074, 7, 12, 0, 0, 4074, 4075, 7, 5, 0, 0, 4075, 4076, 7, 16, 0, 0, 4076, 4077, 7, 10, 0, 0, 4077, 742, 1, 0, 0, 0, 4078, 4079, 7, 27, 0, 0, 4079, 4080, 7, 5, 0, 0, 4080, 4081, 7, 6, 0, 0, 4081, 4082, 7, 17, 0, 0, 4082, 4083, 7, 12, 0, 0, 4083, 4084, 7, 5, 0, 0, 4084, 4085, 7, 16, 0, 0, 4085, 4086, 7, 19, 0, 0, 4086, 4087, 7, 13, 0, 0, 4087, 744, 1, 0, 0, 0, 4088, 4089, 7, 27, 0, 0, 4089, 4090, 7, 5, 0, 0, 4090, 4091, 7, 13, 0, 0, 4091, 4092, 7, 8, 0, 0, 4092, 4093, 7, 17, 0, 0, 4093, 4094, 7, 7, 0, 0, 4094, 4095, 7, 23, 0, 0, 4095, 746, 1, 0, 0, 0, 4096, 4097, 7, 27, 0, 0, 4097, 4098, 7, 10, 0, 0, 4098, 4099, 7, 13, 0, 0, 4099, 4100, 7, 9, 0, 0, 4100, 4101, 7, 17, 0, 0, 4101, 4102, 7, 19, 0, 0, 4102, 4103, 7, 7, 0, 0, 4103, 748, 1, 0, 0, 0, 4104, 4105, 7, 27, 0, 0, 4105, 4106, 7, 17, 0, 0, 4106, 4107, 7, 10, 0, 0, 4107, 4108, 7, 29, 0, 0, 4108, 750, 1, 0, 0, 0, 4109, 4110, 7, 27, 0, 0, 4110, 4111, 7, 19, 0, 0, 4111, 4112, 7, 6, 0, 0, 4112, 4113, 7, 5, 0, 0, 4113, 4114, 7, 16, 0, 0, 4114, 4115, 7, 17, 0, 0, 4115, 4116, 7, 6, 0, 0, 4116, 4117, 7, 10, 0, 0, 4117, 752, 1, 0, 0, 0, 4118, 4119, 7, 29, 0, 0, 4119, 4120, 7, 20, 0, 0, 4120, 4121, 7, 17, 0, 0, 4121, 4122, 7, 16, 0, 0, 4122, 4123, 7, 10, 0, 0, 4123, 4124, 7, 9, 0, 0, 4124, 4125, 7, 24, 0, 0, 4125, 4126, 7, 5, 0, 0, 4126, 4127, 7, 14, 0, 0, 4127, 4128, 7, 10, 0, 0, 4128, 754, 1, 0, 0, 0, 4129, 4130, 7, 29, 0, 0, 4130, 4131, 7, 17, 0, 0, 4131, 4132, 7, 16, 0, 0, 4132, 4133, 7, 20, 0, 0, 4133, 4134, 7, 19, 0, 0, 4134, 4135, 7, 22, 0, 0, 4135, 4136, 7, 16, 0, 0, 4136, 756, 1, 0, 0, 0, 4137, 4138, 7, 29, 0, 0, 4138, 4139, 7, 19, 0, 0, 4139, 4140, 7, 13, 0, 0, 4140, 4141, 7, 21, 0, 0, 4141, 758, 1, 0, 0, 0, 4142, 4143, 7, 29, 0, 0, 4143, 4144, 7, 13, 0, 0, 4144, 4145, 7, 5, 0, 0, 4145, 4146, 7, 24, 0, 0, 4146, 4147, 7, 24, 0, 0, 4147, 4148, 7, 10, 0, 0, 4148, 4149, 7, 13, 0, 0, 4149, 760, 1, 0, 0, 0, 4150, 4151, 7, 29, 0, 0, 4151, 4152, 7, 13, 0, 0, 4152, 4153, 7, 17, 0, 0, 4153, 4154, 7, 16, 0, 0, 4154, 4155, 7, 10, 0, 0, 4155, 762, 1, 0, 0, 0, 4156, 4157, 7, 26, 0, 0, 4157, 4158, 7, 15, 0, 0, 4158, 4159, 7, 6, 0, 0, 4159, 764, 1, 0, 0, 0, 4160, 4161, 7, 8, 0, 0, 4161, 4162, 7, 10, 0, 0, 4162, 4163, 7, 5, 0, 0, 4163, 4164, 7, 13, 0, 0, 4164, 766, 1, 0, 0, 0, 4165, 4166, 7, 8, 0, 0, 4166, 4167, 7, 10, 0, 0, 4167, 4168, 7, 9, 0, 0, 4168, 768, 1, 0, 0, 0, 4169, 4170, 7, 11, 0, 0, 4170, 4171, 7, 19, 0, 0, 4171, 4172, 7, 7, 0, 0, 4172, 4173, 7, 10, 0, 0, 4173, 770, 1, 0, 0, 0, 4174, 4175, 7, 5, 0, 0, 4175, 4176, 7, 16, 0, 0, 4176, 4177, 7, 19, 0, 0, 4177, 4178, 7, 15, 0, 0, 4178, 4179, 7, 17, 0, 0, 4179, 4180, 7, 14, 0, 0, 4180, 772, 1, 0, 0, 0, 4181, 4182, 7, 18, 0, 0, 4182, 4183, 7, 10, 0, 0, 4183, 4184, 7, 16, 0, 0, 4184, 4185, 7, 29, 0, 0, 4185, 4186, 7, 10, 0, 0, 4186, 4187, 7, 10, 0, 0, 4187, 4188, 7, 7, 0, 0, 4188, 774, 1, 0, 0, 0, 4189, 4190, 7, 18, 0, 0, 4190, 4191, 7, 17, 0, 0, 4191, 4192, 7, 23, 0, 0, 4192, 4193, 7, 17, 0, 0, 4193, 4194, 7, 7, 0, 0, 4194, 4195, 7, 16, 0, 0, 4195, 776, 1, 0, 0, 0, 4196, 4197, 7, 18, 0, 0, 4197, 4198, 7, 17, 0, 0, 4198, 4199, 7, 16, 0, 0, 4199, 778, 1, 0, 0, 0, 4200, 4201, 7, 18, 0, 0, 4201, 4202, 7, 19, 0, 0, 4202, 4203, 7, 19, 0, 0, 4203, 4204, 7, 6, 0, 0, 4204, 4205, 7, 10, 0, 0, 4205, 4206, 7, 5, 0, 0, 4206, 4207, 7, 7, 0, 0, 4207, 780, 1, 0, 0, 0, 4208, 4209, 7, 14, 0, 0, 4209, 4210, 7, 20, 0, 0, 4210, 4211, 7, 5, 0, 0, 4211, 4212, 7, 13, 0, 0, 4212, 782, 1, 0, 0, 0, 4213, 4214, 7, 14, 0, 0, 4214, 4215, 7, 20, 0, 0, 4215, 4216, 7, 5, 0, 0, 4216, 4217, 7, 13, 0, 0, 4217, 4218, 7, 5, 0, 0, 4218, 4219, 7, 14, 0, 0, 4219, 4220, 7, 16, 0, 0, 4220, 4221, 7, 10, 0, 0, 4221, 4222, 7, 13, 0, 0, 4222, 784, 1, 0, 0, 0, 4223, 4224, 7, 14, 0, 0, 4224, 4225, 7, 19, 0, 0, 4225, 4226, 7, 5, 0, 0, 4226, 4227, 7, 6, 0, 0, 4227, 4228, 7, 10, 0, 0, 4228, 4229, 7, 9, 0, 0, 4229, 4230, 7, 14, 0, 0, 4230, 4231, 7, 10, 0, 0, 4231, 786, 1, 0, 0, 0, 4232, 4233, 7, 12, 0, 0, 4233, 4234, 7, 10, 0, 0, 4234, 4235, 7, 14, 0, 0, 4235, 788, 1, 0, 0, 0, 4236, 4237, 7, 12, 0, 0, 4237, 4238, 7, 10, 0, 0, 4238, 4239, 7, 14, 0, 0, 4239, 4240, 7, 17, 0, 0, 4240, 4241, 7, 15, 0, 0, 4241, 4242, 7, 5, 0, 0, 4242, 4243, 7, 6, 0, 0, 4243, 790, 1, 0, 0, 0, 4244, 4245, 7, 10, 0, 0, 4245, 4246, 7, 26, 0, 0, 4246, 4247, 7, 17, 0, 0, 4247, 4248, 7, 9, 0, 0, 4248, 4249, 7, 16, 0, 0, 4249, 4250, 7, 9, 0, 0, 4250, 792, 1, 0, 0, 0, 4251, 4252, 7, 10, 0, 0, 4252, 4253, 7, 26, 0, 0, 4253, 4254, 7, 16, 0, 0, 4254, 4255, 7, 13, 0, 0, 4255, 4256, 7, 5, 0, 0, 4256, 4257, 7, 14, 0, 0, 4257, 4258, 7, 16, 0, 0, 4258, 794, 1, 0, 0, 0, 4259, 4260, 7, 25, 0, 0, 4260, 4261, 7, 6, 0, 0, 4261, 4262, 7, 19, 0, 0, 4262, 4263, 7, 5, 0, 0, 4263, 4264, 7, 16, 0, 0, 4264, 796, 1, 0, 0, 0, 4265, 4266, 7, 23, 0, 0, 4266, 4267, 7, 13, 0, 0, 4267, 4268, 7, 10, 0, 0, 4268, 4269, 7, 5, 0, 0, 4269, 4270, 7, 16, 0, 0, 4270, 4271, 7, 10, 0, 0, 4271, 4272, 7, 9, 0, 0, 4272, 4273, 7, 16, 0, 0, 4273, 798, 1, 0, 0, 0, 4274, 4275, 7, 17, 0, 0, 4275, 4276, 7, 7, 0, 0, 4276, 4277, 7, 19, 0, 0, 4277, 4278, 7, 22, 0, 0, 4278, 4279, 7, 16, 0, 0, 4279, 800, 1, 0, 0, 0, 4280, 4281, 7, 17, 0, 0, 4281, 4282, 7, 7, 0, 0, 4282, 4283, 7, 16, 0, 0, 4283, 802, 1, 0, 0, 0, 4284, 4285, 7, 17, 0, 0, 4285, 4286, 7, 7, 0, 0, 4286, 4287, 7, 16, 0, 0, 4287, 4288, 7, 10, 0, 0, 4288, 4289, 7, 23, 0, 0, 4289, 4290, 7, 10, 0, 0, 4290, 4291, 7, 13, 0, 0, 4291, 804, 1, 0, 0, 0, 4292, 4293, 7, 17, 0, 0, 4293, 4294, 7, 7, 0, 0, 4294, 4295, 7, 16, 0, 0, 4295, 4296, 7, 10, 0, 0, 4296, 4297, 7, 13, 0, 0, 4297, 4298, 7, 27, 0, 0, 4298, 4299, 7, 5, 0, 0, 4299, 4300, 7, 6, 0, 0, 4300, 806, 1, 0, 0, 0, 4301, 4302, 7, 6, 0, 0, 4302, 4303, 7, 10, 0, 0, 4303, 4304, 7, 5, 0, 0, 4304, 4305, 7, 9, 0, 0, 4305, 4306, 7, 16, 0, 0, 4306, 808, 1, 0, 0, 0, 4307, 4308, 7, 7, 0, 0, 4308, 4309, 7, 5, 0, 0, 4309, 4310, 7, 16, 0, 0, 4310, 4311, 7, 17, 0, 0, 4311, 4312, 7, 19, 0, 0, 4312, 4313, 7, 7, 0, 0, 4313, 4314, 7, 5, 0, 0, 4314, 4315, 7, 6, 0, 0, 4315, 810, 1, 0, 0, 0, 4316, 4317, 7, 7, 0, 0, 4317, 4318, 7, 14, 0, 0, 4318, 4319, 7, 20, 0, 0, 4319, 4320, 7, 5, 0, 0, 4320, 4321, 7, 13, 0, 0, 4321, 812, 1, 0, 0, 0, 4322, 4323, 7, 7, 0, 0, 4323, 4324, 7, 19, 0, 0, 4324, 4325, 7, 7, 0, 0, 4325, 4326, 7, 10, 0, 0, 4326, 814, 1, 0, 0, 0, 4327, 4328, 7, 7, 0, 0, 4328, 4329, 7, 22, 0, 0, 4329, 4330, 7, 6, 0, 0, 4330, 4331, 7, 6, 0, 0, 4331, 4332, 7, 17, 0, 0, 4332, 4333, 7, 25, 0, 0, 4333, 816, 1, 0, 0, 0, 4334, 4335, 7, 7, 0, 0, 4335, 4336, 7, 22, 0, 0, 4336, 4337, 7, 15, 0, 0, 4337, 4338, 7, 10, 0, 0, 4338, 4339, 7, 13, 0, 0, 4339, 4340, 7, 17, 0, 0, 4340, 4341, 7, 14, 0, 0, 4341, 818, 1, 0, 0, 0, 4342, 4343, 7, 19, 0, 0, 4343, 4344, 7, 27, 0, 0, 4344, 4345, 7, 10, 0, 0, 4345, 4346, 7, 13, 0, 0, 4346, 4347, 7, 6, 0, 0, 4347, 4348, 7, 5, 0, 0, 4348, 4349, 7, 8, 0, 0, 4349, 820, 1, 0, 0, 0, 4350, 4351, 7, 24, 0, 0, 4351, 4352, 7, 5, 0, 0, 4352, 4353, 7, 13, 0, 0, 4353, 4354, 7, 5, 0, 0, 4354, 4355, 7, 15, 0, 0, 4355, 4356, 7, 10, 0, 0, 4356, 4357, 7, 16, 0, 0, 4357, 4358, 7, 10, 0, 0, 4358, 4359, 7, 13, 0, 0, 4359, 822, 1, 0, 0, 0, 4360, 4361, 7, 24, 0, 0, 4361, 4362, 7, 19, 0, 0, 4362, 4363, 7, 9, 0, 0, 4363, 4364, 7, 17, 0, 0, 4364, 4365, 7, 16, 0, 0, 4365, 4366, 7, 17, 0, 0, 4366, 4367, 7, 19, 0, 0, 4367, 4368, 7, 7, 0, 0, 4368, 824, 1, 0, 0, 0, 4369, 4370, 7, 24, 0, 0, 4370, 4371, 7, 13, 0, 0, 4371, 4372, 7, 10, 0, 0, 4372, 4373, 7, 14, 0, 0, 4373, 4374, 7, 17, 0, 0, 4374, 4375, 7, 9, 0, 0, 4375, 4376, 7, 17, 0, 0, 4376, 4377, 7, 19, 0, 0, 4377, 4378, 7, 7, 0, 0, 4378, 826, 1, 0, 0, 0, 4379, 4380, 7, 13, 0, 0, 4380, 4381, 7, 10, 0, 0, 4381, 4382, 7, 5, 0, 0, 4382, 4383, 7, 6, 0, 0, 4383, 828, 1, 0, 0, 0, 4384, 4385, 7, 13, 0, 0, 4385, 4386, 7, 19, 0, 0, 4386, 4387, 7, 29, 0, 0, 4387, 830, 1, 0, 0, 0, 4388, 4389, 7, 9, 0, 0, 4389, 4390, 7, 10, 0, 0, 4390, 4391, 7, 16, 0, 0, 4391, 4392, 7, 19, 0, 0, 4392, 4393, 7, 25, 0, 0, 4393, 832, 1, 0, 0, 0, 4394, 4395, 7, 9, 0, 0, 4395, 4396, 7, 15, 0, 0, 4396, 4397, 7, 5, 0, 0, 4397, 4398, 7, 6, 0, 0, 4398, 4399, 7, 6, 0, 0, 4399, 4400, 7, 17, 0, 0, 4400, 4401, 7, 7, 0, 0, 4401, 4402, 7, 16, 0, 0, 4402, 834, 1, 0, 0, 0, 4403, 4404, 7, 9, 0, 0, 4404, 4405, 7, 22, 0, 0, 4405, 4406, 7, 18, 0, 0, 4406, 4407, 7, 9, 0, 0, 4407, 4408, 7, 16, 0, 0, 4408, 4409, 7, 13, 0, 0, 4409, 4410, 7, 17, 0, 0, 4410, 4411, 7, 7, 0, 0, 4411, 4412, 7, 23, 0, 0, 4412, 836, 1, 0, 0, 0, 4413, 4414, 7, 16, 0, 0, 4414, 4415, 7, 17, 0, 0, 4415, 4416, 7, 15, 0, 0, 4416, 4417, 7, 10, 0, 0, 4417, 838, 1, 0, 0, 0, 4418, 4419, 7, 16, 0, 0, 4419, 4420, 7, 17, 0, 0, 4420, 4421, 7, 15, 0, 0, 4421, 4422, 7, 10, 0, 0, 4422, 4423, 7, 9, 0, 0, 4423, 4424, 7, 16, 0, 0, 4424, 4425, 7, 5, 0, 0, 4425, 4426, 7, 15, 0, 0, 4426, 4427, 7, 24, 0, 0, 4427, 840, 1, 0, 0, 0, 4428, 4429, 7, 16, 0, 0, 4429, 4430, 7, 13, 0, 0, 4430, 4431, 7, 10, 0, 0, 4431, 4432, 7, 5, 0, 0, 4432, 4433, 7, 16, 0, 0, 4433, 842, 1, 0, 0, 0, 4434, 4435, 7, 16, 0, 0, 4435, 4436, 7, 13, 0, 0, 4436, 4437, 7, 17, 0, 0, 4437, 4438, 7, 15, 0, 0, 4438, 844, 1, 0, 0, 0, 4439, 4440, 7, 27, 0, 0, 4440, 4441, 7, 5, 0, 0, 4441, 4442, 7, 6, 0, 0, 4442, 4443, 7, 22, 0, 0, 4443, 4444, 7, 10, 0, 0, 4444, 4445, 7, 9, 0, 0, 4445, 846, 1, 0, 0, 0, 4446, 4447, 7, 27, 0, 0, 4447, 4448, 7, 5, 0, 0, 4448, 4449, 7, 13, 0, 0, 4449, 4450, 7, 14, 0, 0, 4450, 4451, 7, 20, 0, 0, 4451, 4452, 7, 5, 0, 0, 4452, 4453, 7, 13, 0, 0, 4453, 848, 1, 0, 0, 0, 4454, 4455, 7, 26, 0, 0, 4455, 4456, 7, 15, 0, 0, 4456, 4457, 7, 6, 0, 0, 4457, 4458, 7, 5, 0, 0, 4458, 4459, 7, 16, 0, 0, 4459, 4460, 7, 16, 0, 0, 4460, 4461, 7, 13, 0, 0, 4461, 4462, 7, 17, 0, 0, 4462, 4463, 7, 18, 0, 0, 4463, 4464, 7, 22, 0, 0, 4464, 4465, 7, 16, 0, 0, 4465, 4466, 7, 10, 0, 0, 4466, 4467, 7, 9, 0, 0, 4467, 850, 1, 0, 0, 0, 4468, 4469, 7, 26, 0, 0, 4469, 4470, 7, 15, 0, 0, 4470, 4471, 7, 6, 0, 0, 4471, 4472, 7, 14, 0, 0, 4472, 4473, 7, 19, 0, 0, 4473, 4474, 7, 15, 0, 0, 4474, 4475, 7, 15, 0, 0, 4475, 4476, 7, 10, 0, 0, 4476, 4477, 7, 7, 0, 0, 4477, 4478, 7, 16, 0, 0, 4478, 852, 1, 0, 0, 0, 4479, 4480, 7, 26, 0, 0, 4480, 4481, 7, 15, 0, 0, 4481, 4482, 7, 6, 0, 0, 4482, 4483, 7, 5, 0, 0, 4483, 4484, 7, 23, 0, 0, 4484, 4485, 7, 23, 0, 0, 4485, 854, 1, 0, 0, 0, 4486, 4487, 7, 26, 0, 0, 4487, 4488, 7, 15, 0, 0, 4488, 4489, 7, 6, 0, 0, 4489, 4490, 5, 95, 0, 0, 4490, 4491, 7, 17, 0, 0, 4491, 4492, 7, 9, 0, 0, 4492, 4493, 5, 95, 0, 0, 4493, 4494, 7, 29, 0, 0, 4494, 4495, 7, 10, 0, 0, 4495, 4496, 7, 6, 0, 0, 4496, 4497, 7, 6, 0, 0, 4497, 4498, 5, 95, 0, 0, 4498, 4499, 7, 25, 0, 0, 4499, 4500, 7, 19, 0, 0, 4500, 4501, 7, 13, 0, 0, 4501, 4502, 7, 15, 0, 0, 4502, 4503, 7, 10, 0, 0, 4503, 4504, 7, 12, 0, 0, 4504, 856, 1, 0, 0, 0, 4505, 4506, 7, 26, 0, 0, 4506, 4507, 7, 15, 0, 0, 4507, 4508, 7, 6, 0, 0, 4508, 4509, 5, 95, 0, 0, 4509, 4510, 7, 17, 0, 0, 4510, 4511, 7, 9, 0, 0, 4511, 4512, 5, 95, 0, 0, 4512, 4513, 7, 29, 0, 0, 4513, 4514, 7, 10, 0, 0, 4514, 4515, 7, 6, 0, 0, 4515, 4516, 7, 6, 0, 0, 4516, 4517, 5, 95, 0, 0, 4517, 4518, 7, 25, 0, 0, 4518, 4519, 7, 19, 0, 0, 4519, 4520, 7, 13, 0, 0, 4520, 4521, 7, 15, 0, 0, 4521, 4522, 7, 10, 0, 0, 4522, 4523, 7, 12, 0, 0, 4523, 4524, 5, 95, 0, 0, 4524, 4525, 7, 12, 0, 0, 4525, 4526, 7, 19, 0, 0, 4526, 4527, 7, 14, 0, 0, 4527, 4528, 7, 22, 0, 0, 4528, 4529, 7, 15, 0, 0, 4529, 4530, 7, 10, 0, 0, 4530, 4531, 7, 7, 0, 0, 4531, 4532, 7, 16, 0, 0, 4532, 858, 1, 0, 0, 0, 4533, 4534, 7, 26, 0, 0, 4534, 4535, 7, 15, 0, 0, 4535, 4536, 7, 6, 0, 0, 4536, 4537, 5, 95, 0, 0, 4537, 4538, 7, 17, 0, 0, 4538, 4539, 7, 9, 0, 0, 4539, 4540, 5, 95, 0, 0, 4540, 4541, 7, 29, 0, 0, 4541, 4542, 7, 10, 0, 0, 4542, 4543, 7, 6, 0, 0, 4543, 4544, 7, 6, 0, 0, 4544, 4545, 5, 95, 0, 0, 4545, 4546, 7, 25, 0, 0, 4546, 4547, 7, 19, 0, 0, 4547, 4548, 7, 13, 0, 0, 4548, 4549, 7, 15, 0, 0, 4549, 4550, 7, 10, 0, 0, 4550, 4551, 7, 12, 0, 0, 4551, 4552, 5, 95, 0, 0, 4552, 4553, 7, 14, 0, 0, 4553, 4554, 7, 19, 0, 0, 4554, 4555, 7, 7, 0, 0, 4555, 4556, 7, 16, 0, 0, 4556, 4557, 7, 10, 0, 0, 4557, 4558, 7, 7, 0, 0, 4558, 4559, 7, 16, 0, 0, 4559, 860, 1, 0, 0, 0, 4560, 4561, 7, 26, 0, 0, 4561, 4562, 7, 24, 0, 0, 4562, 4563, 7, 5, 0, 0, 4563, 4564, 7, 16, 0, 0, 4564, 4565, 7, 20, 0, 0, 4565, 862, 1, 0, 0, 0, 4566, 4567, 7, 26, 0, 0, 4567, 4568, 7, 24, 0, 0, 4568, 4569, 7, 5, 0, 0, 4569, 4570, 7, 16, 0, 0, 4570, 4571, 7, 20, 0, 0, 4571, 4572, 5, 95, 0, 0, 4572, 4573, 7, 10, 0, 0, 4573, 4574, 7, 26, 0, 0, 4574, 4575, 7, 17, 0, 0, 4575, 4576, 7, 9, 0, 0, 4576, 4577, 7, 16, 0, 0, 4577, 4578, 7, 9, 0, 0, 4578, 864, 1, 0, 0, 0, 4579, 4580, 7, 26, 0, 0, 4580, 4581, 7, 15, 0, 0, 4581, 4582, 7, 6, 0, 0, 4582, 4583, 7, 14, 0, 0, 4583, 4584, 7, 19, 0, 0, 4584, 4585, 7, 7, 0, 0, 4585, 4586, 7, 14, 0, 0, 4586, 4587, 7, 5, 0, 0, 4587, 4588, 7, 16, 0, 0, 4588, 866, 1, 0, 0, 0, 4589, 4590, 7, 26, 0, 0, 4590, 4591, 7, 15, 0, 0, 4591, 4592, 7, 6, 0, 0, 4592, 4593, 7, 10, 0, 0, 4593, 4594, 7, 6, 0, 0, 4594, 4595, 7, 10, 0, 0, 4595, 4596, 7, 15, 0, 0, 4596, 4597, 7, 10, 0, 0, 4597, 4598, 7, 7, 0, 0, 4598, 4599, 7, 16, 0, 0, 4599, 868, 1, 0, 0, 0, 4600, 4601, 7, 26, 0, 0, 4601, 4602, 7, 15, 0, 0, 4602, 4603, 7, 6, 0, 0, 4603, 4604, 7, 10, 0, 0, 4604, 4605, 7, 26, 0, 0, 4605, 4606, 7, 17, 0, 0, 4606, 4607, 7, 9, 0, 0, 4607, 4608, 7, 16, 0, 0, 4608, 4609, 7, 9, 0, 0, 4609, 870, 1, 0, 0, 0, 4610, 4611, 7, 26, 0, 0, 4611, 4612, 7, 15, 0, 0, 4612, 4613, 7, 6, 0, 0, 4613, 4614, 7, 25, 0, 0, 4614, 4615, 7, 19, 0, 0, 4615, 4616, 7, 13, 0, 0, 4616, 4617, 7, 10, 0, 0, 4617, 4618, 7, 9, 0, 0, 4618, 4619, 7, 16, 0, 0, 4619, 872, 1, 0, 0, 0, 4620, 4621, 7, 26, 0, 0, 4621, 4622, 7, 15, 0, 0, 4622, 4623, 7, 6, 0, 0, 4623, 4624, 7, 24, 0, 0, 4624, 4625, 7, 5, 0, 0, 4625, 4626, 7, 13, 0, 0, 4626, 4627, 7, 9, 0, 0, 4627, 4628, 7, 10, 0, 0, 4628, 874, 1, 0, 0, 0, 4629, 4630, 7, 26, 0, 0, 4630, 4631, 7, 15, 0, 0, 4631, 4632, 7, 6, 0, 0, 4632, 4633, 7, 24, 0, 0, 4633, 4634, 7, 17, 0, 0, 4634, 876, 1, 0, 0, 0, 4635, 4636, 7, 26, 0, 0, 4636, 4637, 7, 15, 0, 0, 4637, 4638, 7, 6, 0, 0, 4638, 4639, 7, 13, 0, 0, 4639, 4640, 7, 19, 0, 0, 4640, 4641, 7, 19, 0, 0, 4641, 4642, 7, 16, 0, 0, 4642, 878, 1, 0, 0, 0, 4643, 4644, 7, 26, 0, 0, 4644, 4645, 7, 15, 0, 0, 4645, 4646, 7, 6, 0, 0, 4646, 4647, 7, 9, 0, 0, 4647, 4648, 7, 10, 0, 0, 4648, 4649, 7, 13, 0, 0, 4649, 4650, 7, 17, 0, 0, 4650, 4651, 7, 5, 0, 0, 4651, 4652, 7, 6, 0, 0, 4652, 4653, 7, 17, 0, 0, 4653, 4654, 7, 11, 0, 0, 4654, 4655, 7, 10, 0, 0, 4655, 880, 1, 0, 0, 0, 4656, 4657, 7, 14, 0, 0, 4657, 4658, 7, 5, 0, 0, 4658, 4659, 7, 6, 0, 0, 4659, 4660, 7, 6, 0, 0, 4660, 882, 1, 0, 0, 0, 4661, 4662, 7, 14, 0, 0, 4662, 4663, 7, 22, 0, 0, 4663, 4664, 7, 13, 0, 0, 4664, 4665, 7, 13, 0, 0, 4665, 4666, 7, 10, 0, 0, 4666, 4667, 7, 7, 0, 0, 4667, 4668, 7, 16, 0, 0, 4668, 884, 1, 0, 0, 0, 4669, 4670, 7, 5, 0, 0, 4670, 4671, 7, 16, 0, 0, 4671, 4672, 7, 16, 0, 0, 4672, 4673, 7, 5, 0, 0, 4673, 4674, 7, 14, 0, 0, 4674, 4675, 7, 20, 0, 0, 4675, 886, 1, 0, 0, 0, 4676, 4677, 7, 12, 0, 0, 4677, 4678, 7, 10, 0, 0, 4678, 4679, 7, 16, 0, 0, 4679, 4680, 7, 5, 0, 0, 4680, 4681, 7, 14, 0, 0, 4681, 4682, 7, 20, 0, 0, 4682, 888, 1, 0, 0, 0, 4683, 4684, 7, 10, 0, 0, 4684, 4685, 7, 26, 0, 0, 4685, 4686, 7, 24, 0, 0, 4686, 4687, 7, 13, 0, 0, 4687, 4688, 7, 10, 0, 0, 4688, 4689, 7, 9, 0, 0, 4689, 4690, 7, 9, 0, 0, 4690, 4691, 7, 17, 0, 0, 4691, 4692, 7, 19, 0, 0, 4692, 4693, 7, 7, 0, 0, 4693, 890, 1, 0, 0, 0, 4694, 4695, 7, 23, 0, 0, 4695, 4696, 7, 10, 0, 0, 4696, 4697, 7, 7, 0, 0, 4697, 4698, 7, 10, 0, 0, 4698, 4699, 7, 13, 0, 0, 4699, 4700, 7, 5, 0, 0, 4700, 4701, 7, 16, 0, 0, 4701, 4702, 7, 10, 0, 0, 4702, 4703, 7, 12, 0, 0, 4703, 892, 1, 0, 0, 0, 4704, 4705, 7, 6, 0, 0, 4705, 4706, 7, 19, 0, 0, 4706, 4707, 7, 23, 0, 0, 4707, 4708, 7, 23, 0, 0, 4708, 4709, 7, 10, 0, 0, 4709, 4710, 7, 12, 0, 0, 4710, 894, 1, 0, 0, 0, 4711, 4712, 7, 9, 0, 0, 4712, 4713, 7, 16, 0, 0, 4713, 4714, 7, 19, 0, 0, 4714, 4715, 7, 13, 0, 0, 4715, 4716, 7, 10, 0, 0, 4716, 4717, 7, 12, 0, 0, 4717, 896, 1, 0, 0, 0, 4718, 4719, 7, 17, 0, 0, 4719, 4720, 7, 7, 0, 0, 4720, 4721, 7, 14, 0, 0, 4721, 4722, 7, 6, 0, 0, 4722, 4723, 7, 22, 0, 0, 4723, 4724, 7, 12, 0, 0, 4724, 4725, 7, 10, 0, 0, 4725, 898, 1, 0, 0, 0, 4726, 4727, 7, 13, 0, 0, 4727, 4728, 7, 19, 0, 0, 4728, 4729, 7, 22, 0, 0, 4729, 4730, 7, 16, 0, 0, 4730, 4731, 7, 17, 0, 0, 4731, 4732, 7, 7, 0, 0, 4732, 4733, 7, 10, 0, 0, 4733, 900, 1, 0, 0, 0, 4734, 4735, 7, 16, 0, 0, 4735, 4736, 7, 13, 0, 0, 4736, 4737, 7, 5, 0, 0, 4737, 4738, 7, 7, 0, 0, 4738, 4739, 7, 9, 0, 0, 4739, 4740, 7, 25, 0, 0, 4740, 4741, 7, 19, 0, 0, 4741, 4742, 7, 13, 0, 0, 4742, 4743, 7, 15, 0, 0, 4743, 902, 1, 0, 0, 0, 4744, 4745, 7, 17, 0, 0, 4745, 4746, 7, 15, 0, 0, 4746, 4747, 7, 24, 0, 0, 4747, 4748, 7, 19, 0, 0, 4748, 4749, 7, 13, 0, 0, 4749, 4750, 7, 16, 0, 0, 4750, 904, 1, 0, 0, 0, 4751, 4752, 7, 24, 0, 0, 4752, 4753, 7, 19, 0, 0, 4753, 4754, 7, 6, 0, 0, 4754, 4755, 7, 17, 0, 0, 4755, 4756, 7, 14, 0, 0, 4756, 4757, 7, 8, 0, 0, 4757, 906, 1, 0, 0, 0, 4758, 4759, 7, 15, 0, 0, 4759, 4760, 7, 10, 0, 0, 4760, 4761, 7, 16, 0, 0, 4761, 4762, 7, 20, 0, 0, 4762, 4763, 7, 19, 0, 0, 4763, 4764, 7, 12, 0, 0, 4764, 908, 1, 0, 0, 0, 4765, 4766, 7, 13, 0, 0, 4766, 4767, 7, 10, 0, 0, 4767, 4768, 7, 25, 0, 0, 4768, 4769, 7, 10, 0, 0, 4769, 4770, 7, 13, 0, 0, 4770, 4771, 7, 10, 0, 0, 4771, 4772, 7, 7, 0, 0, 4772, 4773, 7, 14, 0, 0, 4773, 4774, 7, 17, 0, 0, 4774, 4775, 7, 7, 0, 0, 4775, 4776, 7, 23, 0, 0, 4776, 910, 1, 0, 0, 0, 4777, 4778, 7, 7, 0, 0, 4778, 4779, 7, 10, 0, 0, 4779, 4780, 7, 29, 0, 0, 4780, 912, 1, 0, 0, 0, 4781, 4782, 7, 19, 0, 0, 4782, 4783, 7, 6, 0, 0, 4783, 4784, 7, 12, 0, 0, 4784, 914, 1, 0, 0, 0, 4785, 4786, 7, 27, 0, 0, 4786, 4787, 7, 5, 0, 0, 4787, 4788, 7, 6, 0, 0, 4788, 4789, 7, 22, 0, 0, 4789, 4790, 7, 10, 0, 0, 4790, 916, 1, 0, 0, 0, 4791, 4792, 7, 9, 0, 0, 4792, 4793, 7, 22, 0, 0, 4793, 4794, 7, 18, 0, 0, 4794, 4795, 7, 9, 0, 0, 4795, 4796, 7, 14, 0, 0, 4796, 4797, 7, 13, 0, 0, 4797, 4798, 7, 17, 0, 0, 4798, 4799, 7, 24, 0, 0, 4799, 4800, 7, 16, 0, 0, 4800, 4801, 7, 17, 0, 0, 4801, 4802, 7, 19, 0, 0, 4802, 4803, 7, 7, 0, 0, 4803, 918, 1, 0, 0, 0, 4804, 4805, 7, 24, 0, 0, 4805, 4806, 7, 22, 0, 0, 4806, 4807, 7, 18, 0, 0, 4807, 4808, 7, 6, 0, 0, 4808, 4809, 7, 17, 0, 0, 4809, 4810, 7, 14, 0, 0, 4810, 4811, 7, 5, 0, 0, 4811, 4812, 7, 16, 0, 0, 4812, 4813, 7, 17, 0, 0, 4813, 4814, 7, 19, 0, 0, 4814, 4815, 7, 7, 0, 0, 4815, 920, 1, 0, 0, 0, 4816, 4817, 7, 19, 0, 0, 4817, 4818, 7, 22, 0, 0, 4818, 4819, 7, 16, 0, 0, 4819, 922, 1, 0, 0, 0, 4820, 4821, 7, 10, 0, 0, 4821, 4822, 7, 7, 0, 0, 4822, 4823, 7, 12, 0, 0, 4823, 924, 1, 0, 0, 0, 4824, 4825, 7, 13, 0, 0, 4825, 4826, 7, 19, 0, 0, 4826, 4827, 7, 22, 0, 0, 4827, 4828, 7, 16, 0, 0, 4828, 4829, 7, 17, 0, 0, 4829, 4830, 7, 7, 0, 0, 4830, 4831, 7, 10, 0, 0, 4831, 4832, 7, 9, 0, 0, 4832, 926, 1, 0, 0, 0, 4833, 4834, 7, 9, 0, 0, 4834, 4835, 7, 14, 0, 0, 4835, 4836, 7, 20, 0, 0, 4836, 4837, 7, 10, 0, 0, 4837, 4838, 7, 15, 0, 0, 4838, 4839, 7, 5, 0, 0, 4839, 4840, 7, 9, 0, 0, 4840, 928, 1, 0, 0, 0, 4841, 4842, 7, 24, 0, 0, 4842, 4843, 7, 13, 0, 0, 4843, 4844, 7, 19, 0, 0, 4844, 4845, 7, 14, 0, 0, 4845, 4846, 7, 10, 0, 0, 4846, 4847, 7, 12, 0, 0, 4847, 4848, 7, 22, 0, 0, 4848, 4849, 7, 13, 0, 0, 4849, 4850, 7, 10, 0, 0, 4850, 4851, 7, 9, 0, 0, 4851, 930, 1, 0, 0, 0, 4852, 4853, 7, 17, 0, 0, 4853, 4854, 7, 7, 0, 0, 4854, 4855, 7, 24, 0, 0, 4855, 4856, 7, 22, 0, 0, 4856, 4857, 7, 16, 0, 0, 4857, 932, 1, 0, 0, 0, 4858, 4859, 7, 9, 0, 0, 4859, 4860, 7, 22, 0, 0, 4860, 4861, 7, 24, 0, 0, 4861, 4862, 7, 24, 0, 0, 4862, 4863, 7, 19, 0, 0, 4863, 4864, 7, 13, 0, 0, 4864, 4865, 7, 16, 0, 0, 4865, 934, 1, 0, 0, 0, 4866, 4867, 7, 24, 0, 0, 4867, 4868, 7, 5, 0, 0, 4868, 4869, 7, 13, 0, 0, 4869, 4870, 7, 5, 0, 0, 4870, 4871, 7, 6, 0, 0, 4871, 4872, 7, 6, 0, 0, 4872, 4873, 7, 10, 0, 0, 4873, 4874, 7, 6, 0, 0, 4874, 936, 1, 0, 0, 0, 4875, 4876, 7, 9, 0, 0, 4876, 4877, 7, 28, 0, 0, 4877, 4878, 7, 6, 0, 0, 4878, 938, 1, 0, 0, 0, 4879, 4880, 7, 12, 0, 0, 4880, 4881, 7, 10, 0, 0, 4881, 4882, 7, 24, 0, 0, 4882, 4883, 7, 10, 0, 0, 4883, 4884, 7, 7, 0, 0, 4884, 4885, 7, 12, 0, 0, 4885, 4886, 7, 9, 0, 0, 4886, 940, 1, 0, 0, 0, 4887, 4888, 7, 19, 0, 0, 4888, 4889, 7, 27, 0, 0, 4889, 4890, 7, 10, 0, 0, 4890, 4891, 7, 13, 0, 0, 4891, 4892, 7, 13, 0, 0, 4892, 4893, 7, 17, 0, 0, 4893, 4894, 7, 12, 0, 0, 4894, 4895, 7, 17, 0, 0, 4895, 4896, 7, 7, 0, 0, 4896, 4897, 7, 23, 0, 0, 4897, 942, 1, 0, 0, 0, 4898, 4899, 7, 14, 0, 0, 4899, 4900, 7, 19, 0, 0, 4900, 4901, 7, 7, 0, 0, 4901, 4902, 7, 25, 0, 0, 4902, 4903, 7, 6, 0, 0, 4903, 4904, 7, 17, 0, 0, 4904, 4905, 7, 14, 0, 0, 4905, 4906, 7, 16, 0, 0, 4906, 944, 1, 0, 0, 0, 4907, 4908, 7, 9, 0, 0, 4908, 4909, 7, 21, 0, 0, 4909, 4910, 7, 17, 0, 0, 4910, 4911, 7, 24, 0, 0, 4911, 946, 1, 0, 0, 0, 4912, 4913, 7, 6, 0, 0, 4913, 4914, 7, 19, 0, 0, 4914, 4915, 7, 14, 0, 0, 4915, 4916, 7, 21, 0, 0, 4916, 4917, 7, 10, 0, 0, 4917, 4918, 7, 12, 0, 0, 4918, 948, 1, 0, 0, 0, 4919, 4920, 7, 16, 0, 0, 4920, 4921, 7, 17, 0, 0, 4921, 4922, 7, 10, 0, 0, 4922, 4923, 7, 9, 0, 0, 4923, 950, 1, 0, 0, 0, 4924, 4925, 7, 13, 0, 0, 4925, 4926, 7, 19, 0, 0, 4926, 4927, 7, 6, 0, 0, 4927, 4928, 7, 6, 0, 0, 4928, 4929, 7, 22, 0, 0, 4929, 4930, 7, 24, 0, 0, 4930, 952, 1, 0, 0, 0, 4931, 4932, 7, 14, 0, 0, 4932, 4933, 7, 22, 0, 0, 4933, 4934, 7, 18, 0, 0, 4934, 4935, 7, 10, 0, 0, 4935, 954, 1, 0, 0, 0, 4936, 4937, 7, 23, 0, 0, 4937, 4938, 7, 13, 0, 0, 4938, 4939, 7, 19, 0, 0, 4939, 4940, 7, 22, 0, 0, 4940, 4941, 7, 24, 0, 0, 4941, 4942, 7, 17, 0, 0, 4942, 4943, 7, 7, 0, 0, 4943, 4944, 7, 23, 0, 0, 4944, 956, 1, 0, 0, 0, 4945, 4946, 7, 9, 0, 0, 4946, 4947, 7, 10, 0, 0, 4947, 4948, 7, 16, 0, 0, 4948, 4949, 7, 9, 0, 0, 4949, 958, 1, 0, 0, 0, 4950, 4951, 7, 16, 0, 0, 4951, 4952, 7, 5, 0, 0, 4952, 4953, 7, 18, 0, 0, 4953, 4954, 7, 6, 0, 0, 4954, 4955, 7, 10, 0, 0, 4955, 4956, 7, 9, 0, 0, 4956, 4957, 7, 5, 0, 0, 4957, 4958, 7, 15, 0, 0, 4958, 4959, 7, 24, 0, 0, 4959, 4960, 7, 6, 0, 0, 4960, 4961, 7, 10, 0, 0, 4961, 960, 1, 0, 0, 0, 4962, 4963, 7, 19, 0, 0, 4963, 4964, 7, 13, 0, 0, 4964, 4965, 7, 12, 0, 0, 4965, 4966, 7, 17, 0, 0, 4966, 4967, 7, 7, 0, 0, 4967, 4968, 7, 5, 0, 0, 4968, 4969, 7, 6, 0, 0, 4969, 4970, 7, 17, 0, 0, 4970, 4971, 7, 16, 0, 0, 4971, 4972, 7, 8, 0, 0, 4972, 962, 1, 0, 0, 0, 4973, 4974, 7, 26, 0, 0, 4974, 4975, 7, 15, 0, 0, 4975, 4976, 7, 6, 0, 0, 4976, 4977, 7, 16, 0, 0, 4977, 4978, 7, 5, 0, 0, 4978, 4979, 7, 18, 0, 0, 4979, 4980, 7, 6, 0, 0, 4980, 4981, 7, 10, 0, 0, 4981, 964, 1, 0, 0, 0, 4982, 4983, 7, 14, 0, 0, 4983, 4984, 7, 19, 0, 0, 4984, 4985, 7, 6, 0, 0, 4985, 4986, 7, 22, 0, 0, 4986, 4987, 7, 15, 0, 0, 4987, 4988, 7, 7, 0, 0, 4988, 4989, 7, 9, 0, 0, 4989, 966, 1, 0, 0, 0, 4990, 4991, 7, 26, 0, 0, 4991, 4992, 7, 15, 0, 0, 4992, 4993, 7, 6, 0, 0, 4993, 4994, 7, 7, 0, 0, 4994, 4995, 7, 5, 0, 0, 4995, 4996, 7, 15, 0, 0, 4996, 4997, 7, 10, 0, 0, 4997, 4998, 7, 9, 0, 0, 4998, 4999, 7, 24, 0, 0, 4999, 5000, 7, 5, 0, 0, 5000, 5001, 7, 14, 0, 0, 5001, 5002, 7, 10, 0, 0, 5002, 5003, 7, 9, 0, 0, 5003, 968, 1, 0, 0, 0, 5004, 5005, 7, 13, 0, 0, 5005, 5006, 7, 19, 0, 0, 5006, 5007, 7, 29, 0, 0, 5007, 5008, 7, 16, 0, 0, 5008, 5009, 7, 8, 0, 0, 5009, 5010, 7, 24, 0, 0, 5010, 5011, 7, 10, 0, 0, 5011, 970, 1, 0, 0, 0, 5012, 5013, 7, 7, 0, 0, 5013, 5014, 7, 19, 0, 0, 5014, 5015, 7, 13, 0, 0, 5015, 5016, 7, 15, 0, 0, 5016, 5017, 7, 5, 0, 0, 5017, 5018, 7, 6, 0, 0, 5018, 5019, 7, 17, 0, 0, 5019, 5020, 7, 11, 0, 0, 5020, 5021, 7, 10, 0, 0, 5021, 5022, 7, 12, 0, 0, 5022, 972, 1, 0, 0, 0, 5023, 5024, 7, 29, 0, 0, 5024, 5025, 7, 17, 0, 0, 5025, 5026, 7, 16, 0, 0, 5026, 5027, 7, 20, 0, 0, 5027, 5028, 7, 17, 0, 0, 5028, 5029, 7, 7, 0, 0, 5029, 974, 1, 0, 0, 0, 5030, 5031, 7, 25, 0, 0, 5031, 5032, 7, 17, 0, 0, 5032, 5033, 7, 6, 0, 0, 5033, 5034, 7, 16, 0, 0, 5034, 5035, 7, 10, 0, 0, 5035, 5036, 7, 13, 0, 0, 5036, 976, 1, 0, 0, 0, 5037, 5038, 7, 23, 0, 0, 5038, 5039, 7, 13, 0, 0, 5039, 5040, 7, 19, 0, 0, 5040, 5041, 7, 22, 0, 0, 5041, 5042, 7, 24, 0, 0, 5042, 5043, 7, 9, 0, 0, 5043, 978, 1, 0, 0, 0, 5044, 5045, 7, 19, 0, 0, 5045, 5046, 7, 16, 0, 0, 5046, 5047, 7, 20, 0, 0, 5047, 5048, 7, 10, 0, 0, 5048, 5049, 7, 13, 0, 0, 5049, 5050, 7, 9, 0, 0, 5050, 980, 1, 0, 0, 0, 5051, 5052, 7, 7, 0, 0, 5052, 5053, 7, 25, 0, 0, 5053, 5054, 7, 14, 0, 0, 5054, 982, 1, 0, 0, 0, 5055, 5056, 7, 7, 0, 0, 5056, 5057, 7, 25, 0, 0, 5057, 5058, 7, 12, 0, 0, 5058, 984, 1, 0, 0, 0, 5059, 5060, 7, 7, 0, 0, 5060, 5061, 7, 25, 0, 0, 5061, 5062, 7, 21, 0, 0, 5062, 5063, 7, 14, 0, 0, 5063, 986, 1, 0, 0, 0, 5064, 5065, 7, 7, 0, 0, 5065, 5066, 7, 25, 0, 0, 5066, 5067, 7, 21, 0, 0, 5067, 5068, 7, 12, 0, 0, 5068, 988, 1, 0, 0, 0, 5069, 5070, 7, 22, 0, 0, 5070, 5071, 7, 10, 0, 0, 5071, 5072, 7, 9, 0, 0, 5072, 5073, 7, 14, 0, 0, 5073, 5074, 7, 5, 0, 0, 5074, 5075, 7, 24, 0, 0, 5075, 5076, 7, 10, 0, 0, 5076, 990, 1, 0, 0, 0, 5077, 5078, 7, 27, 0, 0, 5078, 5079, 7, 17, 0, 0, 5079, 5080, 7, 10, 0, 0, 5080, 5081, 7, 29, 0, 0, 5081, 5082, 7, 9, 0, 0, 5082, 992, 1, 0, 0, 0, 5083, 5084, 7, 7, 0, 0, 5084, 5085, 7, 19, 0, 0, 5085, 5086, 7, 13, 0, 0, 5086, 5087, 7, 15, 0, 0, 5087, 5088, 7, 5, 0, 0, 5088, 5089, 7, 6, 0, 0, 5089, 5090, 7, 17, 0, 0, 5090, 5091, 7, 11, 0, 0, 5091, 5092, 7, 10, 0, 0, 5092, 994, 1, 0, 0, 0, 5093, 5094, 7, 12, 0, 0, 5094, 5095, 7, 22, 0, 0, 5095, 5096, 7, 15, 0, 0, 5096, 5097, 7, 24, 0, 0, 5097, 996, 1, 0, 0, 0, 5098, 5099, 7, 24, 0, 0, 5099, 5100, 7, 13, 0, 0, 5100, 5101, 7, 17, 0, 0, 5101, 5102, 7, 7, 0, 0, 5102, 5103, 7, 16, 0, 0, 5103, 5104, 5, 95, 0, 0, 5104, 5105, 7, 9, 0, 0, 5105, 5106, 7, 16, 0, 0, 5106, 5107, 7, 13, 0, 0, 5107, 5108, 7, 17, 0, 0, 5108, 5109, 7, 14, 0, 0, 5109, 5110, 7, 16, 0, 0, 5110, 5111, 5, 95, 0, 0, 5111, 5112, 7, 24, 0, 0, 5112, 5113, 7, 5, 0, 0, 5113, 5114, 7, 13, 0, 0, 5114, 5115, 7, 5, 0, 0, 5115, 5116, 7, 15, 0, 0, 5116, 5117, 7, 9, 0, 0, 5117, 998, 1, 0, 0, 0, 5118, 5119, 7, 27, 0, 0, 5119, 5120, 7, 5, 0, 0, 5120, 5121, 7, 13, 0, 0, 5121, 5122, 7, 17, 0, 0, 5122, 5123, 7, 5, 0, 0, 5123, 5124, 7, 18, 0, 0, 5124, 5125, 7, 6, 0, 0, 5125, 5126, 7, 10, 0, 0, 5126, 5127, 5, 95, 0, 0, 5127, 5128, 7, 14, 0, 0, 5128, 5129, 7, 19, 0, 0, 5129, 5130, 7, 7, 0, 0, 5130, 5131, 7, 25, 0, 0, 5131, 5132, 7, 6, 0, 0, 5132, 5133, 7, 17, 0, 0, 5133, 5134, 7, 14, 0, 0, 5134, 5135, 7, 16, 0, 0, 5135, 1000, 1, 0, 0, 0, 5136, 5137, 7, 10, 0, 0, 5137, 5138, 7, 13, 0, 0, 5138, 5139, 7, 13, 0, 0, 5139, 5140, 7, 19, 0, 0, 5140, 5141, 7, 13, 0, 0, 5141, 1002, 1, 0, 0, 0, 5142, 5143, 7, 22, 0, 0, 5143, 5144, 7, 9, 0, 0, 5144, 5145, 7, 10, 0, 0, 5145, 5146, 5, 95, 0, 0, 5146, 5147, 7, 27, 0, 0, 5147, 5148, 7, 5, 0, 0, 5148, 5149, 7, 13, 0, 0, 5149, 5150, 7, 17, 0, 0, 5150, 5151, 7, 5, 0, 0, 5151, 5152, 7, 18, 0, 0, 5152, 5153, 7, 6, 0, 0, 5153, 5154, 7, 10, 0, 0, 5154, 1004, 1, 0, 0, 0, 5155, 5156, 7, 22, 0, 0, 5156, 5157, 7, 9, 0, 0, 5157, 5158, 7, 10, 0, 0, 5158, 5159, 5, 95, 0, 0, 5159, 5160, 7, 14, 0, 0, 5160, 5161, 7, 19, 0, 0, 5161, 5162, 7, 6, 0, 0, 5162, 5163, 7, 22, 0, 0, 5163, 5164, 7, 15, 0, 0, 5164, 5165, 7, 7, 0, 0, 5165, 1006, 1, 0, 0, 0, 5166, 5167, 7, 5, 0, 0, 5167, 5168, 7, 6, 0, 0, 5168, 5169, 7, 17, 0, 0, 5169, 5170, 7, 5, 0, 0, 5170, 5171, 7, 9, 0, 0, 5171, 1008, 1, 0, 0, 0, 5172, 5173, 7, 14, 0, 0, 5173, 5174, 7, 19, 0, 0, 5174, 5175, 7, 7, 0, 0, 5175, 5176, 7, 9, 0, 0, 5176, 5177, 7, 16, 0, 0, 5177, 5178, 7, 5, 0, 0, 5178, 5179, 7, 7, 0, 0, 5179, 5180, 7, 16, 0, 0, 5180, 1010, 1, 0, 0, 0, 5181, 5182, 7, 24, 0, 0, 5182, 5183, 7, 10, 0, 0, 5183, 5184, 7, 13, 0, 0, 5184, 5185, 7, 25, 0, 0, 5185, 5186, 7, 19, 0, 0, 5186, 5187, 7, 13, 0, 0, 5187, 5188, 7, 15, 0, 0, 5188, 1012, 1, 0, 0, 0, 5189, 5190, 7, 23, 0, 0, 5190, 5191, 7, 10, 0, 0, 5191, 5192, 7, 16, 0, 0, 5192, 1014, 1, 0, 0, 0, 5193, 5194, 7, 12, 0, 0, 5194, 5195, 7, 17, 0, 0, 5195, 5196, 7, 5, 0, 0, 5196, 5197, 7, 23, 0, 0, 5197, 5198, 7, 7, 0, 0, 5198, 5199, 7, 19, 0, 0, 5199, 5200, 7, 9, 0, 0, 5200, 5201, 7, 16, 0, 0, 5201, 5202, 7, 17, 0, 0, 5202, 5203, 7, 14, 0, 0, 5203, 5204, 7, 9, 0, 0, 5204, 1016, 1, 0, 0, 0, 5205, 5206, 7, 9, 0, 0, 5206, 5207, 7, 16, 0, 0, 5207, 5208, 7, 5, 0, 0, 5208, 5209, 7, 14, 0, 0, 5209, 5210, 7, 21, 0, 0, 5210, 5211, 7, 10, 0, 0, 5211, 5212, 7, 12, 0, 0, 5212, 1018, 1, 0, 0, 0, 5213, 5214, 7, 10, 0, 0, 5214, 5215, 7, 6, 0, 0, 5215, 5216, 7, 9, 0, 0, 5216, 5217, 7, 17, 0, 0, 5217, 5218, 7, 25, 0, 0, 5218, 1020, 1, 0, 0, 0, 5219, 5220, 7, 29, 0, 0, 5220, 5221, 7, 20, 0, 0, 5221, 5222, 7, 17, 0, 0, 5222, 5223, 7, 6, 0, 0, 5223, 5224, 7, 10, 0, 0, 5224, 1022, 1, 0, 0, 0, 5225, 5226, 7, 13, 0, 0, 5226, 5227, 7, 10, 0, 0, 5227, 5228, 7, 27, 0, 0, 5228, 5229, 7, 10, 0, 0, 5229, 5230, 7, 13, 0, 0, 5230, 5231, 7, 9, 0, 0, 5231, 5232, 7, 10, 0, 0, 5232, 1024, 1, 0, 0, 0, 5233, 5234, 7, 25, 0, 0, 5234, 5235, 7, 19, 0, 0, 5235, 5236, 7, 13, 0, 0, 5236, 5237, 7, 10, 0, 0, 5237, 5238, 7, 5, 0, 0, 5238, 5239, 7, 14, 0, 0, 5239, 5240, 7, 20, 0, 0, 5240, 1026, 1, 0, 0, 0, 5241, 5242, 7, 9, 0, 0, 5242, 5243, 7, 6, 0, 0, 5243, 5244, 7, 17, 0, 0, 5244, 5245, 7, 14, 0, 0, 5245, 5246, 7, 10, 0, 0, 5246, 1028, 1, 0, 0, 0, 5247, 5248, 7, 10, 0, 0, 5248, 5249, 7, 26, 0, 0, 5249, 5250, 7, 17, 0, 0, 5250, 5251, 7, 16, 0, 0, 5251, 1030, 1, 0, 0, 0, 5252, 5253, 7, 13, 0, 0, 5253, 5254, 7, 10, 0, 0, 5254, 5255, 7, 16, 0, 0, 5255, 5256, 7, 22, 0, 0, 5256, 5257, 7, 13, 0, 0, 5257, 5258, 7, 7, 0, 0, 5258, 1032, 1, 0, 0, 0, 5259, 5260, 7, 28, 0, 0, 5260, 5261, 7, 22, 0, 0, 5261, 5262, 7, 10, 0, 0, 5262, 5263, 7, 13, 0, 0, 5263, 5264, 7, 8, 0, 0, 5264, 1034, 1, 0, 0, 0, 5265, 5266, 7, 13, 0, 0, 5266, 5267, 7, 5, 0, 0, 5267, 5268, 7, 17, 0, 0, 5268, 5269, 7, 9, 0, 0, 5269, 5270, 7, 10, 0, 0, 5270, 1036, 1, 0, 0, 0, 5271, 5272, 7, 9, 0, 0, 5272, 5273, 7, 28, 0, 0, 5273, 5274, 7, 6, 0, 0, 5274, 5275, 7, 9, 0, 0, 5275, 5276, 7, 16, 0, 0, 5276, 5277, 7, 5, 0, 0, 5277, 5278, 7, 16, 0, 0, 5278, 5279, 7, 10, 0, 0, 5279, 1038, 1, 0, 0, 0, 5280, 5281, 7, 12, 0, 0, 5281, 5282, 7, 10, 0, 0, 5282, 5283, 7, 18, 0, 0, 5283, 5284, 7, 22, 0, 0, 5284, 5285, 7, 23, 0, 0, 5285, 1040, 1, 0, 0, 0, 5286, 5287, 7, 6, 0, 0, 5287, 5288, 7, 19, 0, 0, 5288, 5289, 7, 23, 0, 0, 5289, 1042, 1, 0, 0, 0, 5290, 5291, 7, 17, 0, 0, 5291, 5292, 7, 7, 0, 0, 5292, 5293, 7, 25, 0, 0, 5293, 5294, 7, 19, 0, 0, 5294, 1044, 1, 0, 0, 0, 5295, 5296, 7, 7, 0, 0, 5296, 5297, 7, 19, 0, 0, 5297, 5298, 7, 16, 0, 0, 5298, 5299, 7, 17, 0, 0, 5299, 5300, 7, 14, 0, 0, 5300, 5301, 7, 10, 0, 0, 5301, 1046, 1, 0, 0, 0, 5302, 5303, 7, 29, 0, 0, 5303, 5304, 7, 5, 0, 0, 5304, 5305, 7, 13, 0, 0, 5305, 5306, 7, 7, 0, 0, 5306, 5307, 7, 17, 0, 0, 5307, 5308, 7, 7, 0, 0, 5308, 5309, 7, 23, 0, 0, 5309, 1048, 1, 0, 0, 0, 5310, 5311, 7, 10, 0, 0, 5311, 5312, 7, 26, 0, 0, 5312, 5313, 7, 14, 0, 0, 5313, 5314, 7, 10, 0, 0, 5314, 5315, 7, 24, 0, 0, 5315, 5316, 7, 16, 0, 0, 5316, 5317, 7, 17, 0, 0, 5317, 5318, 7, 19, 0, 0, 5318, 5319, 7, 7, 0, 0, 5319, 1050, 1, 0, 0, 0, 5320, 5321, 7, 5, 0, 0, 5321, 5322, 7, 9, 0, 0, 5322, 5323, 7, 9, 0, 0, 5323, 5324, 7, 10, 0, 0, 5324, 5325, 7, 13, 0, 0, 5325, 5326, 7, 16, 0, 0, 5326, 1052, 1, 0, 0, 0, 5327, 5328, 7, 6, 0, 0, 5328, 5329, 7, 19, 0, 0, 5329, 5330, 7, 19, 0, 0, 5330, 5331, 7, 24, 0, 0, 5331, 1054, 1, 0, 0, 0, 5332, 5333, 7, 19, 0, 0, 5333, 5334, 7, 24, 0, 0, 5334, 5335, 7, 10, 0, 0, 5335, 5336, 7, 7, 0, 0, 5336, 1056, 1, 0, 0, 0, 5337, 5338, 7, 5, 0, 0, 5338, 5339, 7, 18, 0, 0, 5339, 5340, 7, 9, 0, 0, 5340, 1058, 1, 0, 0, 0, 5341, 5342, 7, 14, 0, 0, 5342, 5343, 7, 18, 0, 0, 5343, 5344, 7, 13, 0, 0, 5344, 5345, 7, 16, 0, 0, 5345, 1060, 1, 0, 0, 0, 5346, 5347, 7, 14, 0, 0, 5347, 5348, 7, 10, 0, 0, 5348, 5349, 7, 17, 0, 0, 5349, 5350, 7, 6, 0, 0, 5350, 1062, 1, 0, 0, 0, 5351, 5352, 7, 14, 0, 0, 5352, 5353, 7, 10, 0, 0, 5353, 5354, 7, 17, 0, 0, 5354, 5355, 7, 6, 0, 0, 5355, 5356, 7, 17, 0, 0, 5356, 5357, 7, 7, 0, 0, 5357, 5358, 7, 23, 0, 0, 5358, 1064, 1, 0, 0, 0, 5359, 5360, 7, 12, 0, 0, 5360, 5361, 7, 10, 0, 0, 5361, 5362, 7, 23, 0, 0, 5362, 5363, 7, 13, 0, 0, 5363, 5364, 7, 10, 0, 0, 5364, 5365, 7, 10, 0, 0, 5365, 5366, 7, 9, 0, 0, 5366, 1066, 1, 0, 0, 0, 5367, 5368, 7, 12, 0, 0, 5368, 5369, 7, 17, 0, 0, 5369, 5370, 7, 27, 0, 0, 5370, 1068, 1, 0, 0, 0, 5371, 5372, 7, 10, 0, 0, 5372, 5373, 7, 26, 0, 0, 5373, 5374, 7, 24, 0, 0, 5374, 1070, 1, 0, 0, 0, 5375, 5376, 7, 25, 0, 0, 5376, 5377, 7, 5, 0, 0, 5377, 5378, 7, 14, 0, 0, 5378, 5379, 7, 16, 0, 0, 5379, 5380, 7, 19, 0, 0, 5380, 5381, 7, 13, 0, 0, 5381, 5382, 7, 17, 0, 0, 5382, 5383, 7, 5, 0, 0, 5383, 5384, 7, 6, 0, 0, 5384, 1072, 1, 0, 0, 0, 5385, 5386, 7, 25, 0, 0, 5386, 5387, 7, 6, 0, 0, 5387, 5388, 7, 19, 0, 0, 5388, 5389, 7, 19, 0, 0, 5389, 5390, 7, 13, 0, 0, 5390, 1074, 1, 0, 0, 0, 5391, 5392, 7, 23, 0, 0, 5392, 5393, 7, 14, 0, 0, 5393, 5394, 7, 12, 0, 0, 5394, 1076, 1, 0, 0, 0, 5395, 5396, 7, 6, 0, 0, 5396, 5397, 7, 14, 0, 0, 5397, 5398, 7, 15, 0, 0, 5398, 1078, 1, 0, 0, 0, 5399, 5400, 7, 6, 0, 0, 5400, 5401, 7, 7, 0, 0, 5401, 1080, 1, 0, 0, 0, 5402, 5403, 7, 6, 0, 0, 5403, 5404, 7, 19, 0, 0, 5404, 5405, 7, 23, 0, 0, 5405, 5406, 5, 49, 0, 0, 5406, 5407, 5, 48, 0, 0, 5407, 1082, 1, 0, 0, 0, 5408, 5409, 7, 15, 0, 0, 5409, 5410, 7, 17, 0, 0, 5410, 5411, 7, 7, 0, 0, 5411, 5412, 5, 95, 0, 0, 5412, 5413, 7, 9, 0, 0, 5413, 5414, 7, 14, 0, 0, 5414, 5415, 7, 5, 0, 0, 5415, 5416, 7, 6, 0, 0, 5416, 5417, 7, 10, 0, 0, 5417, 1084, 1, 0, 0, 0, 5418, 5419, 7, 15, 0, 0, 5419, 5420, 7, 19, 0, 0, 5420, 5421, 7, 12, 0, 0, 5421, 1086, 1, 0, 0, 0, 5422, 5423, 7, 24, 0, 0, 5423, 5424, 7, 17, 0, 0, 5424, 1088, 1, 0, 0, 0, 5425, 5426, 7, 24, 0, 0, 5426, 5427, 7, 19, 0, 0, 5427, 5428, 7, 29, 0, 0, 5428, 5429, 7, 10, 0, 0, 5429, 5430, 7, 13, 0, 0, 5430, 1090, 1, 0, 0, 0, 5431, 5432, 7, 13, 0, 0, 5432, 5433, 7, 5, 0, 0, 5433, 5434, 7, 12, 0, 0, 5434, 5435, 7, 17, 0, 0, 5435, 5436, 7, 5, 0, 0, 5436, 5437, 7, 7, 0, 0, 5437, 5438, 7, 9, 0, 0, 5438, 1092, 1, 0, 0, 0, 5439, 5440, 7, 13, 0, 0, 5440, 5441, 7, 19, 0, 0, 5441, 5442, 7, 22, 0, 0, 5442, 5443, 7, 7, 0, 0, 5443, 5444, 7, 12, 0, 0, 5444, 1094, 1, 0, 0, 0, 5445, 5446, 7, 9, 0, 0, 5446, 5447, 7, 14, 0, 0, 5447, 5448, 7, 5, 0, 0, 5448, 5449, 7, 6, 0, 0, 5449, 5450, 7, 10, 0, 0, 5450, 1096, 1, 0, 0, 0, 5451, 5452, 7, 9, 0, 0, 5452, 5453, 7, 17, 0, 0, 5453, 5454, 7, 23, 0, 0, 5454, 5455, 7, 7, 0, 0, 5455, 1098, 1, 0, 0, 0, 5456, 5457, 7, 9, 0, 0, 5457, 5458, 7, 28, 0, 0, 5458, 5459, 7, 13, 0, 0, 5459, 5460, 7, 16, 0, 0, 5460, 1100, 1, 0, 0, 0, 5461, 5462, 7, 16, 0, 0, 5462, 5463, 7, 13, 0, 0, 5463, 5464, 7, 17, 0, 0, 5464, 5465, 7, 15, 0, 0, 5465, 5466, 5, 95, 0, 0, 5466, 5467, 7, 9, 0, 0, 5467, 5468, 7, 14, 0, 0, 5468, 5469, 7, 5, 0, 0, 5469, 5470, 7, 6, 0, 0, 5470, 5471, 7, 10, 0, 0, 5471, 1102, 1, 0, 0, 0, 5472, 5473, 7, 16, 0, 0, 5473, 5474, 7, 13, 0, 0, 5474, 5475, 7, 22, 0, 0, 5475, 5476, 7, 7, 0, 0, 5476, 5477, 7, 14, 0, 0, 5477, 1104, 1, 0, 0, 0, 5478, 5479, 7, 29, 0, 0, 5479, 5480, 7, 17, 0, 0, 5480, 5481, 7, 12, 0, 0, 5481, 5482, 7, 16, 0, 0, 5482, 5483, 7, 20, 0, 0, 5483, 5484, 5, 95, 0, 0, 5484, 5485, 7, 18, 0, 0, 5485, 5486, 7, 22, 0, 0, 5486, 5487, 7, 14, 0, 0, 5487, 5488, 7, 21, 0, 0, 5488, 5489, 7, 10, 0, 0, 5489, 5490, 7, 16, 0, 0, 5490, 1106, 1, 0, 0, 0, 5491, 5492, 7, 13, 0, 0, 5492, 5493, 7, 5, 0, 0, 5493, 5494, 7, 7, 0, 0, 5494, 5495, 7, 12, 0, 0, 5495, 5496, 7, 19, 0, 0, 5496, 5497, 7, 15, 0, 0, 5497, 1108, 1, 0, 0, 0, 5498, 5499, 7, 9, 0, 0, 5499, 5500, 7, 10, 0, 0, 5500, 5501, 7, 16, 0, 0, 5501, 5502, 7, 9, 0, 0, 5502, 5503, 7, 10, 0, 0, 5503, 5504, 7, 10, 0, 0, 5504, 5505, 7, 12, 0, 0, 5505, 1110, 1, 0, 0, 0, 5506, 5507, 7, 5, 0, 0, 5507, 5508, 7, 14, 0, 0, 5508, 5509, 7, 19, 0, 0, 5509, 5510, 7, 9, 0, 0, 5510, 1112, 1, 0, 0, 0, 5511, 5512, 7, 5, 0, 0, 5512, 5513, 7, 14, 0, 0, 5513, 5514, 7, 19, 0, 0, 5514, 5515, 7, 9, 0, 0, 5515, 5516, 7, 12, 0, 0, 5516, 1114, 1, 0, 0, 0, 5517, 5518, 7, 5, 0, 0, 5518, 5519, 7, 9, 0, 0, 5519, 5520, 7, 17, 0, 0, 5520, 5521, 7, 7, 0, 0, 5521, 1116, 1, 0, 0, 0, 5522, 5523, 7, 5, 0, 0, 5523, 5524, 7, 9, 0, 0, 5524, 5525, 7, 17, 0, 0, 5525, 5526, 7, 7, 0, 0, 5526, 5527, 7, 12, 0, 0, 5527, 1118, 1, 0, 0, 0, 5528, 5529, 7, 5, 0, 0, 5529, 5530, 7, 16, 0, 0, 5530, 5531, 7, 5, 0, 0, 5531, 5532, 7, 7, 0, 0, 5532, 1120, 1, 0, 0, 0, 5533, 5534, 7, 5, 0, 0, 5534, 5535, 7, 16, 0, 0, 5535, 5536, 7, 5, 0, 0, 5536, 5537, 7, 7, 0, 0, 5537, 5538, 7, 12, 0, 0, 5538, 1122, 1, 0, 0, 0, 5539, 5540, 7, 5, 0, 0, 5540, 5541, 7, 16, 0, 0, 5541, 5542, 7, 5, 0, 0, 5542, 5543, 7, 7, 0, 0, 5543, 5544, 5, 50, 0, 0, 5544, 1124, 1, 0, 0, 0, 5545, 5546, 7, 5, 0, 0, 5546, 5547, 7, 16, 0, 0, 5547, 5548, 7, 5, 0, 0, 5548, 5549, 7, 7, 0, 0, 5549, 5550, 5, 50, 0, 0, 5550, 5551, 7, 12, 0, 0, 5551, 1126, 1, 0, 0, 0, 5552, 5553, 7, 14, 0, 0, 5553, 5554, 7, 19, 0, 0, 5554, 5555, 7, 9, 0, 0, 5555, 1128, 1, 0, 0, 0, 5556, 5557, 7, 14, 0, 0, 5557, 5558, 7, 19, 0, 0, 5558, 5559, 7, 9, 0, 0, 5559, 5560, 7, 12, 0, 0, 5560, 1130, 1, 0, 0, 0, 5561, 5562, 7, 14, 0, 0, 5562, 5563, 7, 19, 0, 0, 5563, 5564, 7, 16, 0, 0, 5564, 1132, 1, 0, 0, 0, 5565, 5566, 7, 14, 0, 0, 5566, 5567, 7, 19, 0, 0, 5567, 5568, 7, 16, 0, 0, 5568, 5569, 7, 12, 0, 0, 5569, 1134, 1, 0, 0, 0, 5570, 5571, 7, 9, 0, 0, 5571, 5572, 7, 17, 0, 0, 5572, 5573, 7, 7, 0, 0, 5573, 1136, 1, 0, 0, 0, 5574, 5575, 7, 9, 0, 0, 5575, 5576, 7, 17, 0, 0, 5576, 5577, 7, 7, 0, 0, 5577, 5578, 7, 12, 0, 0, 5578, 1138, 1, 0, 0, 0, 5579, 5580, 7, 16, 0, 0, 5580, 5581, 7, 5, 0, 0, 5581, 5582, 7, 7, 0, 0, 5582, 1140, 1, 0, 0, 0, 5583, 5584, 7, 16, 0, 0, 5584, 5585, 7, 5, 0, 0, 5585, 5586, 7, 7, 0, 0, 5586, 5587, 7, 12, 0, 0, 5587, 1142, 1, 0, 0, 0, 5588, 5589, 7, 9, 0, 0, 5589, 5590, 7, 17, 0, 0, 5590, 5591, 7, 7, 0, 0, 5591, 5592, 7, 20, 0, 0, 5592, 1144, 1, 0, 0, 0, 5593, 5594, 7, 14, 0, 0, 5594, 5595, 7, 19, 0, 0, 5595, 5596, 7, 9, 0, 0, 5596, 5597, 7, 20, 0, 0, 5597, 1146, 1, 0, 0, 0, 5598, 5599, 7, 16, 0, 0, 5599, 5600, 7, 5, 0, 0, 5600, 5601, 7, 7, 0, 0, 5601, 5602, 7, 20, 0, 0, 5602, 1148, 1, 0, 0, 0, 5603, 5604, 7, 5, 0, 0, 5604, 5605, 7, 9, 0, 0, 5605, 5606, 7, 17, 0, 0, 5606, 5607, 7, 7, 0, 0, 5607, 5608, 7, 20, 0, 0, 5608, 1150, 1, 0, 0, 0, 5609, 5610, 7, 5, 0, 0, 5610, 5611, 7, 14, 0, 0, 5611, 5612, 7, 19, 0, 0, 5612, 5613, 7, 9, 0, 0, 5613, 5614, 7, 20, 0, 0, 5614, 1152, 1, 0, 0, 0, 5615, 5616, 7, 5, 0, 0, 5616, 5617, 7, 16, 0, 0, 5617, 5618, 7, 5, 0, 0, 5618, 5619, 7, 7, 0, 0, 5619, 5620, 7, 20, 0, 0, 5620, 1154, 1, 0, 0, 0, 5621, 5622, 7, 18, 0, 0, 5622, 5623, 7, 17, 0, 0, 5623, 5624, 7, 16, 0, 0, 5624, 5625, 5, 95, 0, 0, 5625, 5626, 7, 6, 0, 0, 5626, 5627, 7, 10, 0, 0, 5627, 5628, 7, 7, 0, 0, 5628, 5629, 7, 23, 0, 0, 5629, 5630, 7, 16, 0, 0, 5630, 5631, 7, 20, 0, 0, 5631, 1156, 1, 0, 0, 0, 5632, 5633, 7, 14, 0, 0, 5633, 5634, 7, 20, 0, 0, 5634, 5635, 7, 5, 0, 0, 5635, 5636, 7, 13, 0, 0, 5636, 5637, 5, 95, 0, 0, 5637, 5638, 7, 6, 0, 0, 5638, 5639, 7, 10, 0, 0, 5639, 5640, 7, 7, 0, 0, 5640, 5641, 7, 23, 0, 0, 5641, 5642, 7, 16, 0, 0, 5642, 5643, 7, 20, 0, 0, 5643, 1158, 1, 0, 0, 0, 5644, 5645, 7, 14, 0, 0, 5645, 5646, 7, 20, 0, 0, 5646, 5647, 7, 5, 0, 0, 5647, 5648, 7, 13, 0, 0, 5648, 5649, 7, 5, 0, 0, 5649, 5650, 7, 14, 0, 0, 5650, 5651, 7, 16, 0, 0, 5651, 5652, 7, 10, 0, 0, 5652, 5653, 7, 13, 0, 0, 5653, 5654, 5, 95, 0, 0, 5654, 5655, 7, 6, 0, 0, 5655, 5656, 7, 10, 0, 0, 5656, 5657, 7, 7, 0, 0, 5657, 5658, 7, 23, 0, 0, 5658, 5659, 7, 16, 0, 0, 5659, 5660, 7, 20, 0, 0, 5660, 1160, 1, 0, 0, 0, 5661, 5662, 7, 6, 0, 0, 5662, 5663, 7, 19, 0, 0, 5663, 5664, 7, 29, 0, 0, 5664, 5665, 7, 10, 0, 0, 5665, 5666, 7, 13, 0, 0, 5666, 1162, 1, 0, 0, 0, 5667, 5668, 7, 19, 0, 0, 5668, 5669, 7, 14, 0, 0, 5669, 5670, 7, 16, 0, 0, 5670, 5671, 7, 10, 0, 0, 5671, 5672, 7, 16, 0, 0, 5672, 5673, 5, 95, 0, 0, 5673, 5674, 7, 6, 0, 0, 5674, 5675, 7, 10, 0, 0, 5675, 5676, 7, 7, 0, 0, 5676, 5677, 7, 23, 0, 0, 5677, 5678, 7, 16, 0, 0, 5678, 5679, 7, 20, 0, 0, 5679, 1164, 1, 0, 0, 0, 5680, 5681, 7, 22, 0, 0, 5681, 5682, 7, 24, 0, 0, 5682, 5683, 7, 24, 0, 0, 5683, 5684, 7, 10, 0, 0, 5684, 5685, 7, 13, 0, 0, 5685, 1166, 1, 0, 0, 0, 5686, 5687, 7, 5, 0, 0, 5687, 5688, 7, 9, 0, 0, 5688, 5689, 7, 14, 0, 0, 5689, 5690, 7, 17, 0, 0, 5690, 5691, 7, 17, 0, 0, 5691, 1168, 1, 0, 0, 0, 5692, 5693, 7, 18, 0, 0, 5693, 5694, 7, 16, 0, 0, 5694, 5695, 7, 13, 0, 0, 5695, 5696, 7, 17, 0, 0, 5696, 5697, 7, 15, 0, 0, 5697, 1170, 1, 0, 0, 0, 5698, 5699, 7, 14, 0, 0, 5699, 5700, 7, 20, 0, 0, 5700, 5701, 7, 13, 0, 0, 5701, 1172, 1, 0, 0, 0, 5702, 5703, 7, 14, 0, 0, 5703, 5704, 7, 19, 0, 0, 5704, 5705, 7, 7, 0, 0, 5705, 5706, 7, 14, 0, 0, 5706, 5707, 7, 5, 0, 0, 5707, 5708, 7, 16, 0, 0, 5708, 1174, 1, 0, 0, 0, 5709, 5710, 7, 14, 0, 0, 5710, 5711, 7, 19, 0, 0, 5711, 5712, 7, 7, 0, 0, 5712, 5713, 7, 14, 0, 0, 5713, 5714, 7, 5, 0, 0, 5714, 5715, 7, 16, 0, 0, 5715, 5716, 5, 95, 0, 0, 5716, 5717, 7, 29, 0, 0, 5717, 5718, 7, 9, 0, 0, 5718, 1176, 1, 0, 0, 0, 5719, 5720, 7, 25, 0, 0, 5720, 5721, 7, 19, 0, 0, 5721, 5722, 7, 13, 0, 0, 5722, 5723, 7, 15, 0, 0, 5723, 5724, 7, 5, 0, 0, 5724, 5725, 7, 16, 0, 0, 5725, 1178, 1, 0, 0, 0, 5726, 5727, 7, 17, 0, 0, 5727, 5728, 7, 7, 0, 0, 5728, 5729, 7, 17, 0, 0, 5729, 5730, 7, 16, 0, 0, 5730, 5731, 7, 14, 0, 0, 5731, 5732, 7, 5, 0, 0, 5732, 5733, 7, 24, 0, 0, 5733, 1180, 1, 0, 0, 0, 5734, 5735, 7, 6, 0, 0, 5735, 5736, 7, 10, 0, 0, 5736, 5737, 7, 7, 0, 0, 5737, 5738, 7, 23, 0, 0, 5738, 5739, 7, 16, 0, 0, 5739, 5740, 7, 20, 0, 0, 5740, 1182, 1, 0, 0, 0, 5741, 5742, 7, 6, 0, 0, 5742, 5743, 7, 24, 0, 0, 5743, 5744, 7, 5, 0, 0, 5744, 5745, 7, 12, 0, 0, 5745, 1184, 1, 0, 0, 0, 5746, 5747, 7, 6, 0, 0, 5747, 5748, 7, 16, 0, 0, 5748, 5749, 7, 13, 0, 0, 5749, 5750, 7, 17, 0, 0, 5750, 5751, 7, 15, 0, 0, 5751, 1186, 1, 0, 0, 0, 5752, 5753, 7, 15, 0, 0, 5753, 5754, 7, 12, 0, 0, 5754, 5755, 5, 53, 0, 0, 5755, 1188, 1, 0, 0, 0, 5756, 5757, 7, 24, 0, 0, 5757, 5758, 7, 5, 0, 0, 5758, 5759, 7, 13, 0, 0, 5759, 5760, 7, 9, 0, 0, 5760, 5761, 7, 10, 0, 0, 5761, 5762, 5, 95, 0, 0, 5762, 5763, 7, 17, 0, 0, 5763, 5764, 7, 12, 0, 0, 5764, 5765, 7, 10, 0, 0, 5765, 5766, 7, 7, 0, 0, 5766, 5767, 7, 16, 0, 0, 5767, 1190, 1, 0, 0, 0, 5768, 5769, 7, 24, 0, 0, 5769, 5770, 7, 23, 0, 0, 5770, 5771, 5, 95, 0, 0, 5771, 5772, 7, 14, 0, 0, 5772, 5773, 7, 6, 0, 0, 5773, 5774, 7, 17, 0, 0, 5774, 5775, 7, 10, 0, 0, 5775, 5776, 7, 7, 0, 0, 5776, 5777, 7, 16, 0, 0, 5777, 5778, 5, 95, 0, 0, 5778, 5779, 7, 10, 0, 0, 5779, 5780, 7, 7, 0, 0, 5780, 5781, 7, 14, 0, 0, 5781, 5782, 7, 19, 0, 0, 5782, 5783, 7, 12, 0, 0, 5783, 5784, 7, 17, 0, 0, 5784, 5785, 7, 7, 0, 0, 5785, 5786, 7, 23, 0, 0, 5786, 1192, 1, 0, 0, 0, 5787, 5788, 7, 28, 0, 0, 5788, 5789, 7, 22, 0, 0, 5789, 5790, 7, 19, 0, 0, 5790, 5791, 7, 16, 0, 0, 5791, 5792, 7, 10, 0, 0, 5792, 5793, 5, 95, 0, 0, 5793, 5794, 7, 17, 0, 0, 5794, 5795, 7, 12, 0, 0, 5795, 5796, 7, 10, 0, 0, 5796, 5797, 7, 7, 0, 0, 5797, 5798, 7, 16, 0, 0, 5798, 1194, 1, 0, 0, 0, 5799, 5800, 7, 28, 0, 0, 5800, 5801, 7, 22, 0, 0, 5801, 5802, 7, 19, 0, 0, 5802, 5803, 7, 16, 0, 0, 5803, 5804, 7, 10, 0, 0, 5804, 5805, 5, 95, 0, 0, 5805, 5806, 7, 6, 0, 0, 5806, 5807, 7, 17, 0, 0, 5807, 5808, 7, 16, 0, 0, 5808, 5809, 7, 10, 0, 0, 5809, 5810, 7, 13, 0, 0, 5810, 5811, 7, 5, 0, 0, 5811, 5812, 7, 6, 0, 0, 5812, 1196, 1, 0, 0, 0, 5813, 5814, 7, 28, 0, 0, 5814, 5815, 7, 22, 0, 0, 5815, 5816, 7, 19, 0, 0, 5816, 5817, 7, 16, 0, 0, 5817, 5818, 7, 10, 0, 0, 5818, 5819, 5, 95, 0, 0, 5819, 5820, 7, 7, 0, 0, 5820, 5821, 7, 22, 0, 0, 5821, 5822, 7, 6, 0, 0, 5822, 5823, 7, 6, 0, 0, 5823, 5824, 7, 5, 0, 0, 5824, 5825, 7, 18, 0, 0, 5825, 5826, 7, 6, 0, 0, 5826, 5827, 7, 10, 0, 0, 5827, 1198, 1, 0, 0, 0, 5828, 5829, 7, 13, 0, 0, 5829, 5830, 7, 10, 0, 0, 5830, 5831, 7, 23, 0, 0, 5831, 5832, 7, 10, 0, 0, 5832, 5833, 7, 26, 0, 0, 5833, 5834, 7, 24, 0, 0, 5834, 5835, 5, 95, 0, 0, 5835, 5836, 7, 14, 0, 0, 5836, 5837, 7, 19, 0, 0, 5837, 5838, 7, 22, 0, 0, 5838, 5839, 7, 7, 0, 0, 5839, 5840, 7, 16, 0, 0, 5840, 1200, 1, 0, 0, 0, 5841, 5842, 7, 13, 0, 0, 5842, 5843, 7, 10, 0, 0, 5843, 5844, 7, 23, 0, 0, 5844, 5845, 7, 10, 0, 0, 5845, 5846, 7, 26, 0, 0, 5846, 5847, 7, 24, 0, 0, 5847, 5848, 5, 95, 0, 0, 5848, 5849, 7, 17, 0, 0, 5849, 5850, 7, 7, 0, 0, 5850, 5851, 7, 9, 0, 0, 5851, 5852, 7, 16, 0, 0, 5852, 5853, 7, 13, 0, 0, 5853, 1202, 1, 0, 0, 0, 5854, 5855, 7, 13, 0, 0, 5855, 5856, 7, 10, 0, 0, 5856, 5857, 7, 23, 0, 0, 5857, 5858, 7, 10, 0, 0, 5858, 5859, 7, 26, 0, 0, 5859, 5860, 7, 24, 0, 0, 5860, 5861, 5, 95, 0, 0, 5861, 5862, 7, 6, 0, 0, 5862, 5863, 7, 17, 0, 0, 5863, 5864, 7, 21, 0, 0, 5864, 5865, 7, 10, 0, 0, 5865, 1204, 1, 0, 0, 0, 5866, 5867, 7, 13, 0, 0, 5867, 5868, 7, 10, 0, 0, 5868, 5869, 7, 23, 0, 0, 5869, 5870, 7, 10, 0, 0, 5870, 5871, 7, 26, 0, 0, 5871, 5872, 7, 24, 0, 0, 5872, 5873, 5, 95, 0, 0, 5873, 5874, 7, 15, 0, 0, 5874, 5875, 7, 5, 0, 0, 5875, 5876, 7, 16, 0, 0, 5876, 5877, 7, 14, 0, 0, 5877, 5878, 7, 20, 0, 0, 5878, 1206, 1, 0, 0, 0, 5879, 5880, 7, 13, 0, 0, 5880, 5881, 7, 10, 0, 0, 5881, 5882, 7, 23, 0, 0, 5882, 5883, 7, 10, 0, 0, 5883, 5884, 7, 26, 0, 0, 5884, 5885, 7, 24, 0, 0, 5885, 5886, 5, 95, 0, 0, 5886, 5887, 7, 15, 0, 0, 5887, 5888, 7, 5, 0, 0, 5888, 5889, 7, 16, 0, 0, 5889, 5890, 7, 14, 0, 0, 5890, 5891, 7, 20, 0, 0, 5891, 5892, 7, 10, 0, 0, 5892, 5893, 7, 9, 0, 0, 5893, 1208, 1, 0, 0, 0, 5894, 5895, 7, 13, 0, 0, 5895, 5896, 7, 10, 0, 0, 5896, 5897, 7, 23, 0, 0, 5897, 5898, 7, 10, 0, 0, 5898, 5899, 7, 26, 0, 0, 5899, 5900, 7, 24, 0, 0, 5900, 5901, 5, 95, 0, 0, 5901, 5902, 7, 13, 0, 0, 5902, 5903, 7, 10, 0, 0, 5903, 5904, 7, 24, 0, 0, 5904, 5905, 7, 6, 0, 0, 5905, 5906, 7, 5, 0, 0, 5906, 5907, 7, 14, 0, 0, 5907, 5908, 7, 10, 0, 0, 5908, 1210, 1, 0, 0, 0, 5909, 5910, 7, 13, 0, 0, 5910, 5911, 7, 10, 0, 0, 5911, 5912, 7, 23, 0, 0, 5912, 5913, 7, 10, 0, 0, 5913, 5914, 7, 26, 0, 0, 5914, 5915, 7, 24, 0, 0, 5915, 5916, 5, 95, 0, 0, 5916, 5917, 7, 9, 0, 0, 5917, 5918, 7, 24, 0, 0, 5918, 5919, 7, 6, 0, 0, 5919, 5920, 7, 17, 0, 0, 5920, 5921, 7, 16, 0, 0, 5921, 5922, 5, 95, 0, 0, 5922, 5923, 7, 16, 0, 0, 5923, 5924, 7, 19, 0, 0, 5924, 5925, 5, 95, 0, 0, 5925, 5926, 7, 5, 0, 0, 5926, 5927, 7, 13, 0, 0, 5927, 5928, 7, 13, 0, 0, 5928, 5929, 7, 5, 0, 0, 5929, 5930, 7, 8, 0, 0, 5930, 1212, 1, 0, 0, 0, 5931, 5932, 7, 13, 0, 0, 5932, 5933, 7, 10, 0, 0, 5933, 5934, 7, 23, 0, 0, 5934, 5935, 7, 10, 0, 0, 5935, 5936, 7, 26, 0, 0, 5936, 5937, 7, 24, 0, 0, 5937, 5938, 5, 95, 0, 0, 5938, 5939, 7, 9, 0, 0, 5939, 5940, 7, 24, 0, 0, 5940, 5941, 7, 6, 0, 0, 5941, 5942, 7, 17, 0, 0, 5942, 5943, 7, 16, 0, 0, 5943, 5944, 5, 95, 0, 0, 5944, 5945, 7, 16, 0, 0, 5945, 5946, 7, 19, 0, 0, 5946, 5947, 5, 95, 0, 0, 5947, 5948, 7, 16, 0, 0, 5948, 5949, 7, 5, 0, 0, 5949, 5950, 7, 18, 0, 0, 5950, 5951, 7, 6, 0, 0, 5951, 5952, 7, 10, 0, 0, 5952, 1214, 1, 0, 0, 0, 5953, 5954, 7, 13, 0, 0, 5954, 5955, 7, 10, 0, 0, 5955, 5956, 7, 23, 0, 0, 5956, 5957, 7, 10, 0, 0, 5957, 5958, 7, 26, 0, 0, 5958, 5959, 7, 24, 0, 0, 5959, 5960, 5, 95, 0, 0, 5960, 5961, 7, 9, 0, 0, 5961, 5962, 7, 22, 0, 0, 5962, 5963, 7, 18, 0, 0, 5963, 5964, 7, 9, 0, 0, 5964, 5965, 7, 16, 0, 0, 5965, 5966, 7, 13, 0, 0, 5966, 1216, 1, 0, 0, 0, 5967, 5968, 7, 13, 0, 0, 5968, 5969, 7, 10, 0, 0, 5969, 5970, 7, 24, 0, 0, 5970, 5971, 7, 10, 0, 0, 5971, 5972, 7, 5, 0, 0, 5972, 5973, 7, 16, 0, 0, 5973, 1218, 1, 0, 0, 0, 5974, 5975, 7, 13, 0, 0, 5975, 5976, 7, 24, 0, 0, 5976, 5977, 7, 5, 0, 0, 5977, 5978, 7, 12, 0, 0, 5978, 1220, 1, 0, 0, 0, 5979, 5980, 7, 13, 0, 0, 5980, 5981, 7, 16, 0, 0, 5981, 5982, 7, 13, 0, 0, 5982, 5983, 7, 17, 0, 0, 5983, 5984, 7, 15, 0, 0, 5984, 1222, 1, 0, 0, 0, 5985, 5986, 7, 9, 0, 0, 5986, 5987, 7, 24, 0, 0, 5987, 5988, 7, 6, 0, 0, 5988, 5989, 7, 17, 0, 0, 5989, 5990, 7, 16, 0, 0, 5990, 5991, 5, 95, 0, 0, 5991, 5992, 7, 24, 0, 0, 5992, 5993, 7, 5, 0, 0, 5993, 5994, 7, 13, 0, 0, 5994, 5995, 7, 16, 0, 0, 5995, 1224, 1, 0, 0, 0, 5996, 5997, 7, 9, 0, 0, 5997, 5998, 7, 16, 0, 0, 5998, 5999, 7, 5, 0, 0, 5999, 6000, 7, 13, 0, 0, 6000, 6001, 7, 16, 0, 0, 6001, 6002, 7, 9, 0, 0, 6002, 6003, 5, 95, 0, 0, 6003, 6004, 7, 29, 0, 0, 6004, 6005, 7, 17, 0, 0, 6005, 6006, 7, 16, 0, 0, 6006, 6007, 7, 20, 0, 0, 6007, 1226, 1, 0, 0, 0, 6008, 6009, 7, 9, 0, 0, 6009, 6010, 7, 16, 0, 0, 6010, 6011, 7, 13, 0, 0, 6011, 6012, 7, 17, 0, 0, 6012, 6013, 7, 7, 0, 0, 6013, 6014, 7, 23, 0, 0, 6014, 6015, 5, 95, 0, 0, 6015, 6016, 7, 16, 0, 0, 6016, 6017, 7, 19, 0, 0, 6017, 6018, 5, 95, 0, 0, 6018, 6019, 7, 5, 0, 0, 6019, 6020, 7, 13, 0, 0, 6020, 6021, 7, 13, 0, 0, 6021, 6022, 7, 5, 0, 0, 6022, 6023, 7, 8, 0, 0, 6023, 1228, 1, 0, 0, 0, 6024, 6025, 7, 9, 0, 0, 6025, 6026, 7, 16, 0, 0, 6026, 6027, 7, 13, 0, 0, 6027, 6028, 7, 17, 0, 0, 6028, 6029, 7, 7, 0, 0, 6029, 6030, 7, 23, 0, 0, 6030, 6031, 5, 95, 0, 0, 6031, 6032, 7, 16, 0, 0, 6032, 6033, 7, 19, 0, 0, 6033, 6034, 5, 95, 0, 0, 6034, 6035, 7, 16, 0, 0, 6035, 6036, 7, 5, 0, 0, 6036, 6037, 7, 18, 0, 0, 6037, 6038, 7, 6, 0, 0, 6038, 6039, 7, 10, 0, 0, 6039, 1230, 1, 0, 0, 0, 6040, 6041, 7, 9, 0, 0, 6041, 6042, 7, 16, 0, 0, 6042, 6043, 7, 13, 0, 0, 6043, 6044, 7, 24, 0, 0, 6044, 6045, 7, 19, 0, 0, 6045, 6046, 7, 9, 0, 0, 6046, 1232, 1, 0, 0, 0, 6047, 6048, 7, 9, 0, 0, 6048, 6049, 7, 22, 0, 0, 6049, 6050, 7, 18, 0, 0, 6050, 6051, 7, 9, 0, 0, 6051, 6052, 7, 16, 0, 0, 6052, 6053, 7, 13, 0, 0, 6053, 1234, 1, 0, 0, 0, 6054, 6055, 7, 16, 0, 0, 6055, 6056, 7, 19, 0, 0, 6056, 6057, 5, 95, 0, 0, 6057, 6058, 7, 5, 0, 0, 6058, 6059, 7, 9, 0, 0, 6059, 6060, 7, 14, 0, 0, 6060, 6061, 7, 17, 0, 0, 6061, 6062, 7, 17, 0, 0, 6062, 1236, 1, 0, 0, 0, 6063, 6064, 7, 16, 0, 0, 6064, 6065, 7, 19, 0, 0, 6065, 6066, 5, 95, 0, 0, 6066, 6067, 7, 20, 0, 0, 6067, 6068, 7, 10, 0, 0, 6068, 6069, 7, 26, 0, 0, 6069, 1238, 1, 0, 0, 0, 6070, 6071, 7, 16, 0, 0, 6071, 6072, 7, 13, 0, 0, 6072, 6073, 7, 5, 0, 0, 6073, 6074, 7, 7, 0, 0, 6074, 6075, 7, 9, 0, 0, 6075, 6076, 7, 6, 0, 0, 6076, 6077, 7, 5, 0, 0, 6077, 6078, 7, 16, 0, 0, 6078, 6079, 7, 10, 0, 0, 6079, 1240, 1, 0, 0, 0, 6080, 6081, 7, 22, 0, 0, 6081, 6082, 7, 7, 0, 0, 6082, 6083, 7, 17, 0, 0, 6083, 6084, 7, 9, 0, 0, 6084, 6085, 7, 16, 0, 0, 6085, 6086, 7, 13, 0, 0, 6086, 1242, 1, 0, 0, 0, 6087, 6088, 7, 5, 0, 0, 6088, 6089, 7, 23, 0, 0, 6089, 6090, 7, 10, 0, 0, 6090, 1244, 1, 0, 0, 0, 6091, 6092, 7, 14, 0, 0, 6092, 6093, 7, 6, 0, 0, 6093, 6094, 7, 19, 0, 0, 6094, 6095, 7, 14, 0, 0, 6095, 6096, 7, 21, 0, 0, 6096, 6097, 5, 95, 0, 0, 6097, 6098, 7, 16, 0, 0, 6098, 6099, 7, 17, 0, 0, 6099, 6100, 7, 15, 0, 0, 6100, 6101, 7, 10, 0, 0, 6101, 6102, 7, 9, 0, 0, 6102, 6103, 7, 16, 0, 0, 6103, 6104, 7, 5, 0, 0, 6104, 6105, 7, 15, 0, 0, 6105, 6106, 7, 24, 0, 0, 6106, 1246, 1, 0, 0, 0, 6107, 6108, 7, 12, 0, 0, 6108, 6109, 7, 5, 0, 0, 6109, 6110, 7, 16, 0, 0, 6110, 6111, 7, 10, 0, 0, 6111, 6112, 5, 95, 0, 0, 6112, 6113, 7, 18, 0, 0, 6113, 6114, 7, 17, 0, 0, 6114, 6115, 7, 7, 0, 0, 6115, 1248, 1, 0, 0, 0, 6116, 6117, 7, 12, 0, 0, 6117, 6118, 7, 5, 0, 0, 6118, 6119, 7, 16, 0, 0, 6119, 6120, 7, 10, 0, 0, 6120, 6121, 5, 95, 0, 0, 6121, 6122, 7, 24, 0, 0, 6122, 6123, 7, 5, 0, 0, 6123, 6124, 7, 13, 0, 0, 6124, 6125, 7, 16, 0, 0, 6125, 1250, 1, 0, 0, 0, 6126, 6127, 7, 12, 0, 0, 6127, 6128, 7, 5, 0, 0, 6128, 6129, 7, 16, 0, 0, 6129, 6130, 7, 10, 0, 0, 6130, 6131, 5, 95, 0, 0, 6131, 6132, 7, 16, 0, 0, 6132, 6133, 7, 13, 0, 0, 6133, 6134, 7, 22, 0, 0, 6134, 6135, 7, 7, 0, 0, 6135, 6136, 7, 14, 0, 0, 6136, 1252, 1, 0, 0, 0, 6137, 6138, 7, 17, 0, 0, 6138, 6139, 7, 9, 0, 0, 6139, 6140, 7, 25, 0, 0, 6140, 6141, 7, 17, 0, 0, 6141, 6142, 7, 7, 0, 0, 6142, 6143, 7, 17, 0, 0, 6143, 6144, 7, 16, 0, 0, 6144, 6145, 7, 10, 0, 0, 6145, 1254, 1, 0, 0, 0, 6146, 6147, 7, 30, 0, 0, 6147, 6148, 7, 22, 0, 0, 6148, 6149, 7, 9, 0, 0, 6149, 6150, 7, 16, 0, 0, 6150, 6151, 7, 17, 0, 0, 6151, 6152, 7, 25, 0, 0, 6152, 6153, 7, 8, 0, 0, 6153, 6154, 5, 95, 0, 0, 6154, 6155, 7, 12, 0, 0, 6155, 6156, 7, 5, 0, 0, 6156, 6157, 7, 8, 0, 0, 6157, 6158, 7, 9, 0, 0, 6158, 1256, 1, 0, 0, 0, 6159, 6160, 7, 30, 0, 0, 6160, 6161, 7, 22, 0, 0, 6161, 6162, 7, 9, 0, 0, 6162, 6163, 7, 16, 0, 0, 6163, 6164, 7, 17, 0, 0, 6164, 6165, 7, 25, 0, 0, 6165, 6166, 7, 8, 0, 0, 6166, 6167, 5, 95, 0, 0, 6167, 6168, 7, 20, 0, 0, 6168, 6169, 7, 19, 0, 0, 6169, 6170, 7, 22, 0, 0, 6170, 6171, 7, 13, 0, 0, 6171, 6172, 7, 9, 0, 0, 6172, 1258, 1, 0, 0, 0, 6173, 6174, 7, 30, 0, 0, 6174, 6175, 7, 22, 0, 0, 6175, 6176, 7, 9, 0, 0, 6176, 6177, 7, 16, 0, 0, 6177, 6178, 7, 17, 0, 0, 6178, 6179, 7, 25, 0, 0, 6179, 6180, 7, 8, 0, 0, 6180, 6181, 5, 95, 0, 0, 6181, 6182, 7, 17, 0, 0, 6182, 6183, 7, 7, 0, 0, 6183, 6184, 7, 16, 0, 0, 6184, 6185, 7, 10, 0, 0, 6185, 6186, 7, 13, 0, 0, 6186, 6187, 7, 27, 0, 0, 6187, 6188, 7, 5, 0, 0, 6188, 6189, 7, 6, 0, 0, 6189, 1260, 1, 0, 0, 0, 6190, 6191, 7, 15, 0, 0, 6191, 6192, 7, 5, 0, 0, 6192, 6193, 7, 21, 0, 0, 6193, 6194, 7, 10, 0, 0, 6194, 6195, 5, 95, 0, 0, 6195, 6196, 7, 12, 0, 0, 6196, 6197, 7, 5, 0, 0, 6197, 6198, 7, 16, 0, 0, 6198, 6199, 7, 10, 0, 0, 6199, 1262, 1, 0, 0, 0, 6200, 6201, 7, 15, 0, 0, 6201, 6202, 7, 5, 0, 0, 6202, 6203, 7, 21, 0, 0, 6203, 6204, 7, 10, 0, 0, 6204, 6205, 5, 95, 0, 0, 6205, 6206, 7, 17, 0, 0, 6206, 6207, 7, 7, 0, 0, 6207, 6208, 7, 16, 0, 0, 6208, 6209, 7, 10, 0, 0, 6209, 6210, 7, 13, 0, 0, 6210, 6211, 7, 27, 0, 0, 6211, 6212, 7, 5, 0, 0, 6212, 6213, 7, 6, 0, 0, 6213, 1264, 1, 0, 0, 0, 6214, 6215, 7, 15, 0, 0, 6215, 6216, 7, 5, 0, 0, 6216, 6217, 7, 21, 0, 0, 6217, 6218, 7, 10, 0, 0, 6218, 6219, 5, 95, 0, 0, 6219, 6220, 7, 16, 0, 0, 6220, 6221, 7, 17, 0, 0, 6221, 6222, 7, 15, 0, 0, 6222, 6223, 7, 10, 0, 0, 6223, 1266, 1, 0, 0, 0, 6224, 6225, 7, 15, 0, 0, 6225, 6226, 7, 5, 0, 0, 6226, 6227, 7, 21, 0, 0, 6227, 6228, 7, 10, 0, 0, 6228, 6229, 5, 95, 0, 0, 6229, 6230, 7, 16, 0, 0, 6230, 6231, 7, 17, 0, 0, 6231, 6232, 7, 15, 0, 0, 6232, 6233, 7, 10, 0, 0, 6233, 6234, 7, 9, 0, 0, 6234, 6235, 7, 16, 0, 0, 6235, 6236, 7, 5, 0, 0, 6236, 6237, 7, 15, 0, 0, 6237, 6238, 7, 24, 0, 0, 6238, 1268, 1, 0, 0, 0, 6239, 6240, 7, 15, 0, 0, 6240, 6241, 7, 5, 0, 0, 6241, 6242, 7, 21, 0, 0, 6242, 6243, 7, 10, 0, 0, 6243, 6244, 5, 95, 0, 0, 6244, 6245, 7, 16, 0, 0, 6245, 6246, 7, 17, 0, 0, 6246, 6247, 7, 15, 0, 0, 6247, 6248, 7, 10, 0, 0, 6248, 6249, 7, 9, 0, 0, 6249, 6250, 7, 16, 0, 0, 6250, 6251, 7, 5, 0, 0, 6251, 6252, 7, 15, 0, 0, 6252, 6253, 7, 24, 0, 0, 6253, 6254, 7, 16, 0, 0, 6254, 6255, 7, 11, 0, 0, 6255, 1270, 1, 0, 0, 0, 6256, 6257, 7, 7, 0, 0, 6257, 6258, 7, 19, 0, 0, 6258, 6259, 7, 29, 0, 0, 6259, 1272, 1, 0, 0, 0, 6260, 6261, 7, 9, 0, 0, 6261, 6262, 7, 16, 0, 0, 6262, 6263, 7, 5, 0, 0, 6263, 6264, 7, 16, 0, 0, 6264, 6265, 7, 10, 0, 0, 6265, 6266, 7, 15, 0, 0, 6266, 6267, 7, 10, 0, 0, 6267, 6268, 7, 7, 0, 0, 6268, 6269, 7, 16, 0, 0, 6269, 6270, 5, 95, 0, 0, 6270, 6271, 7, 16, 0, 0, 6271, 6272, 7, 17, 0, 0, 6272, 6273, 7, 15, 0, 0, 6273, 6274, 7, 10, 0, 0, 6274, 6275, 7, 9, 0, 0, 6275, 6276, 7, 16, 0, 0, 6276, 6277, 7, 5, 0, 0, 6277, 6278, 7, 15, 0, 0, 6278, 6279, 7, 24, 0, 0, 6279, 1274, 1, 0, 0, 0, 6280, 6281, 7, 16, 0, 0, 6281, 6282, 7, 17, 0, 0, 6282, 6283, 7, 15, 0, 0, 6283, 6284, 7, 10, 0, 0, 6284, 6285, 7, 19, 0, 0, 6285, 6286, 7, 25, 0, 0, 6286, 6287, 7, 12, 0, 0, 6287, 6288, 7, 5, 0, 0, 6288, 6289, 7, 8, 0, 0, 6289, 1276, 1, 0, 0, 0, 6290, 6291, 7, 16, 0, 0, 6291, 6292, 7, 13, 0, 0, 6292, 6293, 7, 5, 0, 0, 6293, 6294, 7, 7, 0, 0, 6294, 6295, 7, 9, 0, 0, 6295, 6296, 7, 5, 0, 0, 6296, 6297, 7, 14, 0, 0, 6297, 6298, 7, 16, 0, 0, 6298, 6299, 7, 17, 0, 0, 6299, 6300, 7, 19, 0, 0, 6300, 6301, 7, 7, 0, 0, 6301, 6302, 5, 95, 0, 0, 6302, 6303, 7, 16, 0, 0, 6303, 6304, 7, 17, 0, 0, 6304, 6305, 7, 15, 0, 0, 6305, 6306, 7, 10, 0, 0, 6306, 6307, 7, 9, 0, 0, 6307, 6308, 7, 16, 0, 0, 6308, 6309, 7, 5, 0, 0, 6309, 6310, 7, 15, 0, 0, 6310, 6311, 7, 24, 0, 0, 6311, 1278, 1, 0, 0, 0, 6312, 6313, 7, 16, 0, 0, 6313, 6314, 7, 19, 0, 0, 6314, 6315, 5, 95, 0, 0, 6315, 6316, 7, 16, 0, 0, 6316, 6317, 7, 17, 0, 0, 6317, 6318, 7, 15, 0, 0, 6318, 6319, 7, 10, 0, 0, 6319, 6320, 7, 9, 0, 0, 6320, 6321, 7, 16, 0, 0, 6321, 6322, 7, 5, 0, 0, 6322, 6323, 7, 15, 0, 0, 6323, 6324, 7, 24, 0, 0, 6324, 1280, 1, 0, 0, 0, 6325, 6326, 7, 16, 0, 0, 6326, 6327, 7, 19, 0, 0, 6327, 6328, 5, 95, 0, 0, 6328, 6329, 7, 14, 0, 0, 6329, 6330, 7, 20, 0, 0, 6330, 6331, 7, 5, 0, 0, 6331, 6332, 7, 13, 0, 0, 6332, 1282, 1, 0, 0, 0, 6333, 6334, 7, 16, 0, 0, 6334, 6335, 7, 19, 0, 0, 6335, 6336, 5, 95, 0, 0, 6336, 6337, 7, 12, 0, 0, 6337, 6338, 7, 5, 0, 0, 6338, 6339, 7, 16, 0, 0, 6339, 6340, 7, 10, 0, 0, 6340, 1284, 1, 0, 0, 0, 6341, 6342, 7, 16, 0, 0, 6342, 6343, 7, 19, 0, 0, 6343, 6344, 5, 95, 0, 0, 6344, 6345, 7, 7, 0, 0, 6345, 6346, 7, 22, 0, 0, 6346, 6347, 7, 15, 0, 0, 6347, 6348, 7, 18, 0, 0, 6348, 6349, 7, 10, 0, 0, 6349, 6350, 7, 13, 0, 0, 6350, 1286, 1, 0, 0, 0, 6351, 6352, 7, 10, 0, 0, 6352, 6353, 7, 7, 0, 0, 6353, 6354, 7, 14, 0, 0, 6354, 6355, 7, 19, 0, 0, 6355, 6356, 7, 12, 0, 0, 6356, 6357, 7, 10, 0, 0, 6357, 1288, 1, 0, 0, 0, 6358, 6359, 7, 12, 0, 0, 6359, 6360, 7, 17, 0, 0, 6360, 6361, 7, 9, 0, 0, 6361, 6362, 7, 16, 0, 0, 6362, 6363, 7, 21, 0, 0, 6363, 6364, 7, 10, 0, 0, 6364, 6365, 7, 8, 0, 0, 6365, 1290, 1, 0, 0, 0, 6366, 6367, 7, 9, 0, 0, 6367, 6368, 7, 19, 0, 0, 6368, 6369, 7, 13, 0, 0, 6369, 6370, 7, 16, 0, 0, 6370, 6371, 7, 21, 0, 0, 6371, 6372, 7, 10, 0, 0, 6372, 6373, 7, 8, 0, 0, 6373, 1292, 1, 0, 0, 0, 6374, 6375, 7, 14, 0, 0, 6375, 6376, 7, 5, 0, 0, 6376, 6377, 7, 9, 0, 0, 6377, 6378, 7, 10, 0, 0, 6378, 6379, 5, 95, 0, 0, 6379, 6380, 7, 9, 0, 0, 6380, 6381, 7, 10, 0, 0, 6381, 6382, 7, 7, 0, 0, 6382, 6383, 7, 9, 0, 0, 6383, 6384, 7, 17, 0, 0, 6384, 6385, 7, 16, 0, 0, 6385, 6386, 7, 17, 0, 0, 6386, 6387, 7, 27, 0, 0, 6387, 6388, 7, 10, 0, 0, 6388, 1294, 1, 0, 0, 0, 6389, 6390, 7, 14, 0, 0, 6390, 6391, 7, 5, 0, 0, 6391, 6392, 7, 9, 0, 0, 6392, 6393, 7, 10, 0, 0, 6393, 6394, 5, 95, 0, 0, 6394, 6395, 7, 17, 0, 0, 6395, 6396, 7, 7, 0, 0, 6396, 6397, 7, 9, 0, 0, 6397, 6398, 7, 10, 0, 0, 6398, 6399, 7, 7, 0, 0, 6399, 6400, 7, 9, 0, 0, 6400, 6401, 7, 17, 0, 0, 6401, 6402, 7, 16, 0, 0, 6402, 6403, 7, 17, 0, 0, 6403, 6404, 7, 27, 0, 0, 6404, 6405, 7, 10, 0, 0, 6405, 1296, 1, 0, 0, 0, 6406, 6410, 3, 1299, 647, 0, 6407, 6409, 3, 1301, 648, 0, 6408, 6407, 1, 0, 0, 0, 6409, 6412, 1, 0, 0, 0, 6410, 6408, 1, 0, 0, 0, 6410, 6411, 1, 0, 0, 0, 6411, 1298, 1, 0, 0, 0, 6412, 6410, 1, 0, 0, 0, 6413, 6420, 7, 31, 0, 0, 6414, 6415, 7, 32, 0, 0, 6415, 6420, 4, 647, 6, 0, 6416, 6417, 7, 33, 0, 0, 6417, 6418, 7, 34, 0, 0, 6418, 6420, 4, 647, 7, 0, 6419, 6413, 1, 0, 0, 0, 6419, 6414, 1, 0, 0, 0, 6419, 6416, 1, 0, 0, 0, 6420, 1300, 1, 0, 0, 0, 6421, 6424, 3, 1303, 649, 0, 6422, 6424, 5, 36, 0, 0, 6423, 6421, 1, 0, 0, 0, 6423, 6422, 1, 0, 0, 0, 6424, 1302, 1, 0, 0, 0, 6425, 6428, 3, 1299, 647, 0, 6426, 6428, 7, 0, 0, 0, 6427, 6425, 1, 0, 0, 0, 6427, 6426, 1, 0, 0, 0, 6428, 1304, 1, 0, 0, 0, 6429, 6430, 3, 1307, 651, 0, 6430, 6431, 5, 34, 0, 0, 6431, 1306, 1, 0, 0, 0, 6432, 6438, 5, 34, 0, 0, 6433, 6434, 5, 34, 0, 0, 6434, 6437, 5, 34, 0, 0, 6435, 6437, 8, 35, 0, 0, 6436, 6433, 1, 0, 0, 0, 6436, 6435, 1, 0, 0, 0, 6437, 6440, 1, 0, 0, 0, 6438, 6436, 1, 0, 0, 0, 6438, 6439, 1, 0, 0, 0, 6439, 1308, 1, 0, 0, 0, 6440, 6438, 1, 0, 0, 0, 6441, 6442, 3, 1311, 653, 0, 6442, 6443, 5, 34, 0, 0, 6443, 1310, 1, 0, 0, 0, 6444, 6450, 5, 34, 0, 0, 6445, 6446, 5, 34, 0, 0, 6446, 6449, 5, 34, 0, 0, 6447, 6449, 8, 36, 0, 0, 6448, 6445, 1, 0, 0, 0, 6448, 6447, 1, 0, 0, 0, 6449, 6452, 1, 0, 0, 0, 6450, 6448, 1, 0, 0, 0, 6450, 6451, 1, 0, 0, 0, 6451, 1312, 1, 0, 0, 0, 6452, 6450, 1, 0, 0, 0, 6453, 6454, 7, 22, 0, 0, 6454, 6455, 5, 38, 0, 0, 6455, 6456, 3, 1305, 650, 0, 6456, 1314, 1, 0, 0, 0, 6457, 6458, 7, 22, 0, 0, 6458, 6459, 5, 38, 0, 0, 6459, 6460, 3, 1307, 651, 0, 6460, 1316, 1, 0, 0, 0, 6461, 6462, 7, 22, 0, 0, 6462, 6463, 5, 38, 0, 0, 6463, 6464, 3, 1309, 652, 0, 6464, 1318, 1, 0, 0, 0, 6465, 6466, 7, 22, 0, 0, 6466, 6467, 5, 38, 0, 0, 6467, 6468, 3, 1311, 653, 0, 6468, 1320, 1, 0, 0, 0, 6469, 6470, 3, 1323, 659, 0, 6470, 6471, 5, 39, 0, 0, 6471, 1322, 1, 0, 0, 0, 6472, 6478, 5, 39, 0, 0, 6473, 6474, 5, 39, 0, 0, 6474, 6477, 5, 39, 0, 0, 6475, 6477, 8, 37, 0, 0, 6476, 6473, 1, 0, 0, 0, 6476, 6475, 1, 0, 0, 0, 6477, 6480, 1, 0, 0, 0, 6478, 6476, 1, 0, 0, 0, 6478, 6479, 1, 0, 0, 0, 6479, 1324, 1, 0, 0, 0, 6480, 6478, 1, 0, 0, 0, 6481, 6482, 7, 10, 0, 0, 6482, 6483, 5, 39, 0, 0, 6483, 6484, 1, 0, 0, 0, 6484, 6485, 6, 660, 2, 0, 6485, 6486, 6, 660, 3, 0, 6486, 1326, 1, 0, 0, 0, 6487, 6488, 3, 1329, 662, 0, 6488, 6489, 5, 39, 0, 0, 6489, 1328, 1, 0, 0, 0, 6490, 6491, 7, 22, 0, 0, 6491, 6492, 5, 38, 0, 0, 6492, 6493, 3, 1323, 659, 0, 6493, 1330, 1, 0, 0, 0, 6494, 6496, 5, 36, 0, 0, 6495, 6497, 3, 1333, 664, 0, 6496, 6495, 1, 0, 0, 0, 6496, 6497, 1, 0, 0, 0, 6497, 6498, 1, 0, 0, 0, 6498, 6499, 5, 36, 0, 0, 6499, 6500, 6, 663, 4, 0, 6500, 6501, 1, 0, 0, 0, 6501, 6502, 6, 663, 5, 0, 6502, 1332, 1, 0, 0, 0, 6503, 6507, 3, 1299, 647, 0, 6504, 6506, 3, 1303, 649, 0, 6505, 6504, 1, 0, 0, 0, 6506, 6509, 1, 0, 0, 0, 6507, 6505, 1, 0, 0, 0, 6507, 6508, 1, 0, 0, 0, 6508, 1334, 1, 0, 0, 0, 6509, 6507, 1, 0, 0, 0, 6510, 6511, 3, 1337, 666, 0, 6511, 6512, 5, 39, 0, 0, 6512, 1336, 1, 0, 0, 0, 6513, 6514, 7, 18, 0, 0, 6514, 6518, 5, 39, 0, 0, 6515, 6517, 7, 38, 0, 0, 6516, 6515, 1, 0, 0, 0, 6517, 6520, 1, 0, 0, 0, 6518, 6516, 1, 0, 0, 0, 6518, 6519, 1, 0, 0, 0, 6519, 1338, 1, 0, 0, 0, 6520, 6518, 1, 0, 0, 0, 6521, 6522, 3, 1341, 668, 0, 6522, 6523, 5, 39, 0, 0, 6523, 1340, 1, 0, 0, 0, 6524, 6525, 7, 18, 0, 0, 6525, 6526, 3, 1323, 659, 0, 6526, 1342, 1, 0, 0, 0, 6527, 6528, 3, 1345, 670, 0, 6528, 6529, 5, 39, 0, 0, 6529, 1344, 1, 0, 0, 0, 6530, 6531, 7, 26, 0, 0, 6531, 6535, 5, 39, 0, 0, 6532, 6534, 7, 39, 0, 0, 6533, 6532, 1, 0, 0, 0, 6534, 6537, 1, 0, 0, 0, 6535, 6533, 1, 0, 0, 0, 6535, 6536, 1, 0, 0, 0, 6536, 1346, 1, 0, 0, 0, 6537, 6535, 1, 0, 0, 0, 6538, 6539, 3, 1349, 672, 0, 6539, 6540, 5, 39, 0, 0, 6540, 1348, 1, 0, 0, 0, 6541, 6542, 7, 26, 0, 0, 6542, 6543, 3, 1323, 659, 0, 6543, 1350, 1, 0, 0, 0, 6544, 6545, 3, 1357, 676, 0, 6545, 1352, 1, 0, 0, 0, 6546, 6547, 3, 1357, 676, 0, 6547, 6548, 5, 46, 0, 0, 6548, 6549, 5, 46, 0, 0, 6549, 6550, 1, 0, 0, 0, 6550, 6551, 6, 674, 6, 0, 6551, 1354, 1, 0, 0, 0, 6552, 6553, 3, 1357, 676, 0, 6553, 6555, 5, 46, 0, 0, 6554, 6556, 3, 1357, 676, 0, 6555, 6554, 1, 0, 0, 0, 6555, 6556, 1, 0, 0, 0, 6556, 6562, 1, 0, 0, 0, 6557, 6559, 7, 10, 0, 0, 6558, 6560, 7, 1, 0, 0, 6559, 6558, 1, 0, 0, 0, 6559, 6560, 1, 0, 0, 0, 6560, 6561, 1, 0, 0, 0, 6561, 6563, 3, 1357, 676, 0, 6562, 6557, 1, 0, 0, 0, 6562, 6563, 1, 0, 0, 0, 6563, 6581, 1, 0, 0, 0, 6564, 6565, 5, 46, 0, 0, 6565, 6571, 3, 1357, 676, 0, 6566, 6568, 7, 10, 0, 0, 6567, 6569, 7, 1, 0, 0, 6568, 6567, 1, 0, 0, 0, 6568, 6569, 1, 0, 0, 0, 6569, 6570, 1, 0, 0, 0, 6570, 6572, 3, 1357, 676, 0, 6571, 6566, 1, 0, 0, 0, 6571, 6572, 1, 0, 0, 0, 6572, 6581, 1, 0, 0, 0, 6573, 6574, 3, 1357, 676, 0, 6574, 6576, 7, 10, 0, 0, 6575, 6577, 7, 1, 0, 0, 6576, 6575, 1, 0, 0, 0, 6576, 6577, 1, 0, 0, 0, 6577, 6578, 1, 0, 0, 0, 6578, 6579, 3, 1357, 676, 0, 6579, 6581, 1, 0, 0, 0, 6580, 6552, 1, 0, 0, 0, 6580, 6564, 1, 0, 0, 0, 6580, 6573, 1, 0, 0, 0, 6581, 1356, 1, 0, 0, 0, 6582, 6584, 7, 0, 0, 0, 6583, 6582, 1, 0, 0, 0, 6584, 6585, 1, 0, 0, 0, 6585, 6583, 1, 0, 0, 0, 6585, 6586, 1, 0, 0, 0, 6586, 1358, 1, 0, 0, 0, 6587, 6588, 5, 58, 0, 0, 6588, 6592, 7, 40, 0, 0, 6589, 6591, 7, 41, 0, 0, 6590, 6589, 1, 0, 0, 0, 6591, 6594, 1, 0, 0, 0, 6592, 6590, 1, 0, 0, 0, 6592, 6593, 1, 0, 0, 0, 6593, 1360, 1, 0, 0, 0, 6594, 6592, 1, 0, 0, 0, 6595, 6596, 5, 58, 0, 0, 6596, 6597, 5, 34, 0, 0, 6597, 6605, 1, 0, 0, 0, 6598, 6599, 5, 92, 0, 0, 6599, 6604, 9, 0, 0, 0, 6600, 6601, 5, 34, 0, 0, 6601, 6604, 5, 34, 0, 0, 6602, 6604, 8, 42, 0, 0, 6603, 6598, 1, 0, 0, 0, 6603, 6600, 1, 0, 0, 0, 6603, 6602, 1, 0, 0, 0, 6604, 6607, 1, 0, 0, 0, 6605, 6603, 1, 0, 0, 0, 6605, 6606, 1, 0, 0, 0, 6606, 6608, 1, 0, 0, 0, 6607, 6605, 1, 0, 0, 0, 6608, 6609, 5, 34, 0, 0, 6609, 1362, 1, 0, 0, 0, 6610, 6611, 7, 43, 0, 0, 6611, 6612, 1, 0, 0, 0, 6612, 6613, 6, 679, 7, 0, 6613, 1364, 1, 0, 0, 0, 6614, 6616, 5, 13, 0, 0, 6615, 6617, 5, 10, 0, 0, 6616, 6615, 1, 0, 0, 0, 6616, 6617, 1, 0, 0, 0, 6617, 6620, 1, 0, 0, 0, 6618, 6620, 5, 10, 0, 0, 6619, 6614, 1, 0, 0, 0, 6619, 6618, 1, 0, 0, 0, 6620, 6621, 1, 0, 0, 0, 6621, 6622, 6, 680, 7, 0, 6622, 1366, 1, 0, 0, 0, 6623, 6624, 5, 45, 0, 0, 6624, 6625, 5, 45, 0, 0, 6625, 6629, 1, 0, 0, 0, 6626, 6628, 8, 44, 0, 0, 6627, 6626, 1, 0, 0, 0, 6628, 6631, 1, 0, 0, 0, 6629, 6627, 1, 0, 0, 0, 6629, 6630, 1, 0, 0, 0, 6630, 6632, 1, 0, 0, 0, 6631, 6629, 1, 0, 0, 0, 6632, 6633, 6, 681, 7, 0, 6633, 1368, 1, 0, 0, 0, 6634, 6635, 5, 47, 0, 0, 6635, 6636, 5, 42, 0, 0, 6636, 6659, 1, 0, 0, 0, 6637, 6639, 5, 47, 0, 0, 6638, 6637, 1, 0, 0, 0, 6639, 6642, 1, 0, 0, 0, 6640, 6638, 1, 0, 0, 0, 6640, 6641, 1, 0, 0, 0, 6641, 6643, 1, 0, 0, 0, 6642, 6640, 1, 0, 0, 0, 6643, 6658, 3, 1369, 682, 0, 6644, 6658, 8, 45, 0, 0, 6645, 6647, 5, 47, 0, 0, 6646, 6645, 1, 0, 0, 0, 6647, 6648, 1, 0, 0, 0, 6648, 6646, 1, 0, 0, 0, 6648, 6649, 1, 0, 0, 0, 6649, 6650, 1, 0, 0, 0, 6650, 6658, 8, 45, 0, 0, 6651, 6653, 5, 42, 0, 0, 6652, 6651, 1, 0, 0, 0, 6653, 6654, 1, 0, 0, 0, 6654, 6652, 1, 0, 0, 0, 6654, 6655, 1, 0, 0, 0, 6655, 6656, 1, 0, 0, 0, 6656, 6658, 8, 45, 0, 0, 6657, 6640, 1, 0, 0, 0, 6657, 6644, 1, 0, 0, 0, 6657, 6646, 1, 0, 0, 0, 6657, 6652, 1, 0, 0, 0, 6658, 6661, 1, 0, 0, 0, 6659, 6657, 1, 0, 0, 0, 6659, 6660, 1, 0, 0, 0, 6660, 6665, 1, 0, 0, 0, 6661, 6659, 1, 0, 0, 0, 6662, 6664, 5, 42, 0, 0, 6663, 6662, 1, 0, 0, 0, 6664, 6667, 1, 0, 0, 0, 6665, 6663, 1, 0, 0, 0, 6665, 6666, 1, 0, 0, 0, 6666, 6668, 1, 0, 0, 0, 6667, 6665, 1, 0, 0, 0, 6668, 6669, 5, 42, 0, 0, 6669, 6670, 5, 47, 0, 0, 6670, 6671, 1, 0, 0, 0, 6671, 6672, 6, 682, 7, 0, 6672, 1370, 1, 0, 0, 0, 6673, 6674, 5, 47, 0, 0, 6674, 6675, 5, 42, 0, 0, 6675, 6700, 1, 0, 0, 0, 6676, 6678, 5, 47, 0, 0, 6677, 6676, 1, 0, 0, 0, 6678, 6681, 1, 0, 0, 0, 6679, 6677, 1, 0, 0, 0, 6679, 6680, 1, 0, 0, 0, 6680, 6682, 1, 0, 0, 0, 6681, 6679, 1, 0, 0, 0, 6682, 6699, 3, 1369, 682, 0, 6683, 6699, 8, 45, 0, 0, 6684, 6686, 5, 47, 0, 0, 6685, 6684, 1, 0, 0, 0, 6686, 6687, 1, 0, 0, 0, 6687, 6685, 1, 0, 0, 0, 6687, 6688, 1, 0, 0, 0, 6688, 6689, 1, 0, 0, 0, 6689, 6697, 8, 45, 0, 0, 6690, 6692, 5, 42, 0, 0, 6691, 6690, 1, 0, 0, 0, 6692, 6693, 1, 0, 0, 0, 6693, 6691, 1, 0, 0, 0, 6693, 6694, 1, 0, 0, 0, 6694, 6695, 1, 0, 0, 0, 6695, 6697, 8, 45, 0, 0, 6696, 6685, 1, 0, 0, 0, 6696, 6691, 1, 0, 0, 0, 6697, 6699, 1, 0, 0, 0, 6698, 6679, 1, 0, 0, 0, 6698, 6683, 1, 0, 0, 0, 6698, 6696, 1, 0, 0, 0, 6699, 6702, 1, 0, 0, 0, 6700, 6698, 1, 0, 0, 0, 6700, 6701, 1, 0, 0, 0, 6701, 6720, 1, 0, 0, 0, 6702, 6700, 1, 0, 0, 0, 6703, 6705, 5, 47, 0, 0, 6704, 6703, 1, 0, 0, 0, 6705, 6706, 1, 0, 0, 0, 6706, 6704, 1, 0, 0, 0, 6706, 6707, 1, 0, 0, 0, 6707, 6721, 1, 0, 0, 0, 6708, 6710, 5, 42, 0, 0, 6709, 6708, 1, 0, 0, 0, 6710, 6711, 1, 0, 0, 0, 6711, 6709, 1, 0, 0, 0, 6711, 6712, 1, 0, 0, 0, 6712, 6721, 1, 0, 0, 0, 6713, 6715, 5, 47, 0, 0, 6714, 6713, 1, 0, 0, 0, 6715, 6718, 1, 0, 0, 0, 6716, 6714, 1, 0, 0, 0, 6716, 6717, 1, 0, 0, 0, 6717, 6719, 1, 0, 0, 0, 6718, 6716, 1, 0, 0, 0, 6719, 6721, 3, 1371, 683, 0, 6720, 6704, 1, 0, 0, 0, 6720, 6709, 1, 0, 0, 0, 6720, 6716, 1, 0, 0, 0, 6720, 6721, 1, 0, 0, 0, 6721, 6722, 1, 0, 0, 0, 6722, 6723, 6, 683, 8, 0, 6723, 1372, 1, 0, 0, 0, 6724, 6736, 5, 92, 0, 0, 6725, 6735, 8, 46, 0, 0, 6726, 6730, 5, 34, 0, 0, 6727, 6729, 8, 47, 0, 0, 6728, 6727, 1, 0, 0, 0, 6729, 6732, 1, 0, 0, 0, 6730, 6728, 1, 0, 0, 0, 6730, 6731, 1, 0, 0, 0, 6731, 6733, 1, 0, 0, 0, 6732, 6730, 1, 0, 0, 0, 6733, 6735, 5, 34, 0, 0, 6734, 6725, 1, 0, 0, 0, 6734, 6726, 1, 0, 0, 0, 6735, 6738, 1, 0, 0, 0, 6736, 6734, 1, 0, 0, 0, 6736, 6737, 1, 0, 0, 0, 6737, 6746, 1, 0, 0, 0, 6738, 6736, 1, 0, 0, 0, 6739, 6743, 5, 34, 0, 0, 6740, 6742, 8, 47, 0, 0, 6741, 6740, 1, 0, 0, 0, 6742, 6745, 1, 0, 0, 0, 6743, 6741, 1, 0, 0, 0, 6743, 6744, 1, 0, 0, 0, 6744, 6747, 1, 0, 0, 0, 6745, 6743, 1, 0, 0, 0, 6746, 6739, 1, 0, 0, 0, 6746, 6747, 1, 0, 0, 0, 6747, 1374, 1, 0, 0, 0, 6748, 6749, 5, 92, 0, 0, 6749, 6750, 5, 92, 0, 0, 6750, 1376, 1, 0, 0, 0, 6751, 6752, 9, 0, 0, 0, 6752, 1378, 1, 0, 0, 0, 6753, 6754, 3, 1383, 689, 0, 6754, 6755, 5, 39, 0, 0, 6755, 6756, 1, 0, 0, 0, 6756, 6757, 6, 687, 9, 0, 6757, 1380, 1, 0, 0, 0, 6758, 6760, 3, 1383, 689, 0, 6759, 6761, 5, 92, 0, 0, 6760, 6759, 1, 0, 0, 0, 6760, 6761, 1, 0, 0, 0, 6761, 6762, 1, 0, 0, 0, 6762, 6763, 5, 0, 0, 1, 6763, 1382, 1, 0, 0, 0, 6764, 6765, 5, 39, 0, 0, 6765, 6788, 5, 39, 0, 0, 6766, 6784, 5, 92, 0, 0, 6767, 6768, 5, 120, 0, 0, 6768, 6785, 7, 39, 0, 0, 6769, 6770, 5, 117, 0, 0, 6770, 6771, 7, 39, 0, 0, 6771, 6772, 7, 39, 0, 0, 6772, 6773, 7, 39, 0, 0, 6773, 6785, 7, 39, 0, 0, 6774, 6775, 5, 85, 0, 0, 6775, 6776, 7, 39, 0, 0, 6776, 6777, 7, 39, 0, 0, 6777, 6778, 7, 39, 0, 0, 6778, 6779, 7, 39, 0, 0, 6779, 6780, 7, 39, 0, 0, 6780, 6781, 7, 39, 0, 0, 6781, 6782, 7, 39, 0, 0, 6782, 6785, 7, 39, 0, 0, 6783, 6785, 8, 48, 0, 0, 6784, 6767, 1, 0, 0, 0, 6784, 6769, 1, 0, 0, 0, 6784, 6774, 1, 0, 0, 0, 6784, 6783, 1, 0, 0, 0, 6785, 6788, 1, 0, 0, 0, 6786, 6788, 8, 49, 0, 0, 6787, 6764, 1, 0, 0, 0, 6787, 6766, 1, 0, 0, 0, 6787, 6786, 1, 0, 0, 0, 6788, 6791, 1, 0, 0, 0, 6789, 6787, 1, 0, 0, 0, 6789, 6790, 1, 0, 0, 0, 6790, 1384, 1, 0, 0, 0, 6791, 6789, 1, 0, 0, 0, 6792, 6793, 3, 1389, 692, 0, 6793, 6794, 5, 39, 0, 0, 6794, 6795, 1, 0, 0, 0, 6795, 6796, 6, 690, 9, 0, 6796, 1386, 1, 0, 0, 0, 6797, 6799, 3, 1389, 692, 0, 6798, 6800, 5, 92, 0, 0, 6799, 6798, 1, 0, 0, 0, 6799, 6800, 1, 0, 0, 0, 6800, 6801, 1, 0, 0, 0, 6801, 6802, 5, 0, 0, 1, 6802, 1388, 1, 0, 0, 0, 6803, 6804, 5, 39, 0, 0, 6804, 6809, 5, 39, 0, 0, 6805, 6806, 5, 92, 0, 0, 6806, 6809, 9, 0, 0, 0, 6807, 6809, 8, 49, 0, 0, 6808, 6803, 1, 0, 0, 0, 6808, 6805, 1, 0, 0, 0, 6808, 6807, 1, 0, 0, 0, 6809, 6812, 1, 0, 0, 0, 6810, 6808, 1, 0, 0, 0, 6810, 6811, 1, 0, 0, 0, 6811, 1390, 1, 0, 0, 0, 6812, 6810, 1, 0, 0, 0, 6813, 6814, 3, 1363, 679, 0, 6814, 6815, 1, 0, 0, 0, 6815, 6816, 6, 693, 10, 0, 6816, 6817, 6, 693, 7, 0, 6817, 1392, 1, 0, 0, 0, 6818, 6819, 3, 1365, 680, 0, 6819, 6820, 1, 0, 0, 0, 6820, 6821, 6, 694, 11, 0, 6821, 6822, 6, 694, 7, 0, 6822, 6823, 6, 694, 12, 0, 6823, 1394, 1, 0, 0, 0, 6824, 6825, 6, 695, 13, 0, 6825, 6826, 1, 0, 0, 0, 6826, 6827, 6, 695, 14, 0, 6827, 6828, 6, 695, 15, 0, 6828, 1396, 1, 0, 0, 0, 6829, 6830, 3, 1363, 679, 0, 6830, 6831, 1, 0, 0, 0, 6831, 6832, 6, 696, 10, 0, 6832, 6833, 6, 696, 7, 0, 6833, 1398, 1, 0, 0, 0, 6834, 6835, 3, 1365, 680, 0, 6835, 6836, 1, 0, 0, 0, 6836, 6837, 6, 697, 11, 0, 6837, 6838, 6, 697, 7, 0, 6838, 1400, 1, 0, 0, 0, 6839, 6840, 5, 39, 0, 0, 6840, 6841, 1, 0, 0, 0, 6841, 6842, 6, 698, 2, 0, 6842, 6843, 6, 698, 16, 0, 6843, 1402, 1, 0, 0, 0, 6844, 6845, 6, 699, 17, 0, 6845, 6846, 1, 0, 0, 0, 6846, 6847, 6, 699, 14, 0, 6847, 6848, 6, 699, 15, 0, 6848, 1404, 1, 0, 0, 0, 6849, 6851, 8, 50, 0, 0, 6850, 6849, 1, 0, 0, 0, 6851, 6852, 1, 0, 0, 0, 6852, 6850, 1, 0, 0, 0, 6852, 6853, 1, 0, 0, 0, 6853, 6862, 1, 0, 0, 0, 6854, 6858, 5, 36, 0, 0, 6855, 6857, 8, 50, 0, 0, 6856, 6855, 1, 0, 0, 0, 6857, 6860, 1, 0, 0, 0, 6858, 6856, 1, 0, 0, 0, 6858, 6859, 1, 0, 0, 0, 6859, 6862, 1, 0, 0, 0, 6860, 6858, 1, 0, 0, 0, 6861, 6850, 1, 0, 0, 0, 6861, 6854, 1, 0, 0, 0, 6862, 1406, 1, 0, 0, 0, 6863, 6865, 5, 36, 0, 0, 6864, 6866, 3, 1333, 664, 0, 6865, 6864, 1, 0, 0, 0, 6865, 6866, 1, 0, 0, 0, 6866, 6867, 1, 0, 0, 0, 6867, 6868, 5, 36, 0, 0, 6868, 6869, 1, 0, 0, 0, 6869, 6870, 4, 701, 8, 0, 6870, 6871, 6, 701, 18, 0, 6871, 6872, 1, 0, 0, 0, 6872, 6873, 6, 701, 15, 0, 6873, 1408, 1, 0, 0, 0, 77, 0, 1, 2, 3, 4, 1476, 1482, 1484, 1489, 1493, 1495, 1498, 1507, 1509, 1514, 1519, 1521, 6410, 6419, 6423, 6427, 6436, 6438, 6448, 6450, 6476, 6478, 6496, 6507, 6518, 6535, 6555, 6559, 6562, 6568, 6571, 6576, 6580, 6585, 6592, 6603, 6605, 6616, 6619, 6629, 6640, 6648, 6654, 6657, 6659, 6665, 6679, 6687, 6693, 6696, 6698, 6700, 6706, 6711, 6716, 6720, 6730, 6734, 6736, 6743, 6746, 6760, 6784, 6787, 6789, 6799, 6808, 6810, 6852, 6858, 6861, 6865, 19, 1, 28, 0, 7, 29, 0, 3, 0, 0, 5, 1, 0, 1, 663, 1, 5, 4, 0, 1, 674, 2, 0, 1, 0, 1, 683, 3, 2, 2, 0, 7, 670, 0, 7, 671, 0, 2, 3, 0, 1, 695, 4, 6, 0, 0, 4, 0, 0, 2, 1, 0, 1, 699, 5, 1, 701, 6] \ No newline at end of file diff --git a/postgresql/PostgreSQLLexer.tokens b/postgresql/PostgreSQLLexer.tokens new file mode 100644 index 0000000..8dfee09 --- /dev/null +++ b/postgresql/PostgreSQLLexer.tokens @@ -0,0 +1,1328 @@ +Dollar=1 +OPEN_PAREN=2 +CLOSE_PAREN=3 +OPEN_BRACKET=4 +CLOSE_BRACKET=5 +COMMA=6 +SEMI=7 +COLON=8 +STAR=9 +EQUAL=10 +DOT=11 +PLUS=12 +MINUS=13 +SLASH=14 +CARET=15 +LT=16 +GT=17 +LESS_LESS=18 +GREATER_GREATER=19 +COLON_EQUALS=20 +LESS_EQUALS=21 +EQUALS_GREATER=22 +GREATER_EQUALS=23 +DOT_DOT=24 +NOT_EQUALS=25 +TYPECAST=26 +PERCENT=27 +PARAM=28 +Operator=29 +ALL=30 +ANALYSE=31 +ANALYZE=32 +AND=33 +ANY=34 +ARRAY=35 +AS=36 +ASC=37 +ASYMMETRIC=38 +BOTH=39 +CASE=40 +CAST=41 +CHECK=42 +COLLATE=43 +COLUMN=44 +CONSTRAINT=45 +CREATE=46 +CURRENT_CATALOG=47 +CURRENT_DATE=48 +CURRENT_ROLE=49 +CURRENT_TIME=50 +CURRENT_TIMESTAMP=51 +CURRENT_USER=52 +DEFAULT=53 +DEFERRABLE=54 +DESC=55 +DISTINCT=56 +DO=57 +ELSE=58 +EXCEPT=59 +FALSE_P=60 +FETCH=61 +FOR=62 +FOREIGN=63 +FROM=64 +GRANT=65 +GROUP_P=66 +HAVING=67 +IN_P=68 +INITIALLY=69 +INTERSECT=70 +INTO=71 +LATERAL_P=72 +LEADING=73 +LIMIT=74 +LOCALTIME=75 +LOCALTIMESTAMP=76 +NOT=77 +NULL_P=78 +OFFSET=79 +ON=80 +ONLY=81 +OR=82 +ORDER=83 +PLACING=84 +PRIMARY=85 +REFERENCES=86 +RETURNING=87 +SELECT=88 +SESSION_USER=89 +SOME=90 +SYMMETRIC=91 +TABLE=92 +THEN=93 +TO=94 +TRAILING=95 +TRUE_P=96 +UNION=97 +UNIQUE=98 +USER=99 +USING=100 +VARIADIC=101 +WHEN=102 +WHERE=103 +WINDOW=104 +WITH=105 +AUTHORIZATION=106 +BINARY=107 +COLLATION=108 +CONCURRENTLY=109 +CROSS=110 +CURRENT_SCHEMA=111 +FREEZE=112 +FULL=113 +ILIKE=114 +INNER_P=115 +IS=116 +ISNULL=117 +JOIN=118 +LEFT=119 +LIKE=120 +NATURAL=121 +NOTNULL=122 +OUTER_P=123 +OVER=124 +OVERLAPS=125 +RIGHT=126 +SIMILAR=127 +VERBOSE=128 +ABORT_P=129 +ABSOLUTE_P=130 +ACCESS=131 +ACTION=132 +ADD_P=133 +ADMIN=134 +AFTER=135 +AGGREGATE=136 +ALSO=137 +ALTER=138 +ALWAYS=139 +ASSERTION=140 +ASSIGNMENT=141 +AT=142 +ATTRIBUTE=143 +BACKWARD=144 +BEFORE=145 +BEGIN_P=146 +BY=147 +CACHE=148 +CALLED=149 +CASCADE=150 +CASCADED=151 +CATALOG=152 +CHAIN=153 +CHARACTERISTICS=154 +CHECKPOINT=155 +CLASS=156 +CLOSE=157 +CLUSTER=158 +COMMENT=159 +COMMENTS=160 +COMMIT=161 +COMMITTED=162 +CONFIGURATION=163 +CONNECTION=164 +CONSTRAINTS=165 +CONTENT_P=166 +CONTINUE_P=167 +CONVERSION_P=168 +COPY=169 +COST=170 +CSV=171 +CURSOR=172 +CYCLE=173 +DATA_P=174 +DATABASE=175 +DAY_P=176 +DEALLOCATE=177 +DECLARE=178 +DEFAULTS=179 +DEFERRED=180 +DEFINER=181 +DELETE_P=182 +DELIMITER=183 +DELIMITERS=184 +DICTIONARY=185 +DISABLE_P=186 +DISCARD=187 +DOCUMENT_P=188 +DOMAIN_P=189 +DOUBLE_P=190 +DROP=191 +EACH=192 +ENABLE_P=193 +ENCODING=194 +ENCRYPTED=195 +ENUM_P=196 +ESCAPE=197 +EVENT=198 +EXCLUDE=199 +EXCLUDING=200 +EXCLUSIVE=201 +EXECUTE=202 +EXPLAIN=203 +EXTENSION=204 +EXTERNAL=205 +FAMILY=206 +FIRST_P=207 +FOLLOWING=208 +FORCE=209 +FORWARD=210 +FUNCTION=211 +FUNCTIONS=212 +GLOBAL=213 +GRANTED=214 +HANDLER=215 +HEADER_P=216 +HOLD=217 +HOUR_P=218 +IDENTITY_P=219 +IF_P=220 +IMMEDIATE=221 +IMMUTABLE=222 +IMPLICIT_P=223 +INCLUDING=224 +INCREMENT=225 +INDEX=226 +INDEXES=227 +INHERIT=228 +INHERITS=229 +INLINE_P=230 +INSENSITIVE=231 +INSERT=232 +INSTEAD=233 +INVOKER=234 +ISOLATION=235 +KEY=236 +LABEL=237 +LANGUAGE=238 +LARGE_P=239 +LAST_P=240 +LEAKPROOF=241 +LEVEL=242 +LISTEN=243 +LOAD=244 +LOCAL=245 +LOCATION=246 +LOCK_P=247 +MAPPING=248 +MATCH=249 +MATCHED=250 +MATERIALIZED=251 +MAXVALUE=252 +MERGE=253 +MINUTE_P=254 +MINVALUE=255 +MODE=256 +MONTH_P=257 +MOVE=258 +NAME_P=259 +NAMES=260 +NEXT=261 +NO=262 +NOTHING=263 +NOTIFY=264 +NOWAIT=265 +NULLS_P=266 +OBJECT_P=267 +OF=268 +OFF=269 +OIDS=270 +OPERATOR=271 +OPTION=272 +OPTIONS=273 +OWNED=274 +OWNER=275 +PARSER=276 +PARTIAL=277 +PARTITION=278 +PASSING=279 +PASSWORD=280 +PLANS=281 +PRECEDING=282 +PREPARE=283 +PREPARED=284 +PRESERVE=285 +PRIOR=286 +PRIVILEGES=287 +PROCEDURAL=288 +PROCEDURE=289 +PROGRAM=290 +QUOTE=291 +RANGE=292 +READ=293 +REASSIGN=294 +RECHECK=295 +RECURSIVE=296 +REF=297 +REFRESH=298 +REINDEX=299 +RELATIVE_P=300 +RELEASE=301 +RENAME=302 +REPEATABLE=303 +REPLACE=304 +REPLICA=305 +RESET=306 +RESTART=307 +RESTRICT=308 +RETURNS=309 +REVOKE=310 +ROLE=311 +ROLLBACK=312 +ROWS=313 +RULE=314 +SAVEPOINT=315 +SCHEMA=316 +SCROLL=317 +SEARCH=318 +SECOND_P=319 +SECURITY=320 +SEQUENCE=321 +SEQUENCES=322 +SERIALIZABLE=323 +SERVER=324 +SESSION=325 +SET=326 +SHARE=327 +SHOW=328 +SIMPLE=329 +SNAPSHOT=330 +STABLE=331 +STANDALONE_P=332 +START=333 +STATEMENT=334 +STATISTICS=335 +STDIN=336 +STDOUT=337 +STORAGE=338 +STRICT_P=339 +STRIP_P=340 +SYSID=341 +SYSTEM_P=342 +TABLES=343 +TABLESPACE=344 +TEMP=345 +TEMPLATE=346 +TEMPORARY=347 +TEXT_P=348 +TRANSACTION=349 +TRIGGER=350 +TRUNCATE=351 +TRUSTED=352 +TYPE_P=353 +TYPES_P=354 +UNBOUNDED=355 +UNCOMMITTED=356 +UNENCRYPTED=357 +UNKNOWN=358 +UNLISTEN=359 +UNLOGGED=360 +UNTIL=361 +UPDATE=362 +VACUUM=363 +VALID=364 +VALIDATE=365 +VALIDATOR=366 +VARYING=367 +VERSION_P=368 +VIEW=369 +VOLATILE=370 +WHITESPACE_P=371 +WITHOUT=372 +WORK=373 +WRAPPER=374 +WRITE=375 +XML_P=376 +YEAR_P=377 +YES_P=378 +ZONE=379 +ATOMIC_P=380 +BETWEEN=381 +BIGINT=382 +BIT=383 +BOOLEAN_P=384 +CHAR_P=385 +CHARACTER=386 +COALESCE=387 +DEC=388 +DECIMAL_P=389 +EXISTS=390 +EXTRACT=391 +FLOAT_P=392 +GREATEST=393 +INOUT=394 +INT_P=395 +INTEGER=396 +INTERVAL=397 +LEAST=398 +NATIONAL=399 +NCHAR=400 +NONE=401 +NULLIF=402 +NUMERIC=403 +OVERLAY=404 +PARAMETER=405 +POSITION=406 +PRECISION=407 +REAL=408 +ROW=409 +SETOF=410 +SMALLINT=411 +SUBSTRING=412 +TIME=413 +TIMESTAMP=414 +TREAT=415 +TRIM=416 +VALUES=417 +VARCHAR=418 +XMLATTRIBUTES=419 +XMLCOMMENT=420 +XMLAGG=421 +XML_IS_WELL_FORMED=422 +XML_IS_WELL_FORMED_DOCUMENT=423 +XML_IS_WELL_FORMED_CONTENT=424 +XPATH=425 +XPATH_EXISTS=426 +XMLCONCAT=427 +XMLELEMENT=428 +XMLEXISTS=429 +XMLFOREST=430 +XMLPARSE=431 +XMLPI=432 +XMLROOT=433 +XMLSERIALIZE=434 +CALL=435 +CURRENT_P=436 +ATTACH=437 +DETACH=438 +EXPRESSION=439 +GENERATED=440 +LOGGED=441 +STORED=442 +INCLUDE=443 +ROUTINE=444 +TRANSFORM=445 +IMPORT_P=446 +POLICY=447 +METHOD=448 +REFERENCING=449 +NEW=450 +OLD=451 +VALUE_P=452 +SUBSCRIPTION=453 +PUBLICATION=454 +OUT_P=455 +END_P=456 +ROUTINES=457 +SCHEMAS=458 +PROCEDURES=459 +INPUT_P=460 +SUPPORT=461 +PARALLEL=462 +SQL_P=463 +DEPENDS=464 +OVERRIDING=465 +CONFLICT=466 +SKIP_P=467 +LOCKED=468 +TIES=469 +ROLLUP=470 +CUBE=471 +GROUPING=472 +SETS=473 +TABLESAMPLE=474 +ORDINALITY=475 +XMLTABLE=476 +COLUMNS=477 +XMLNAMESPACES=478 +ROWTYPE=479 +NORMALIZED=480 +WITHIN=481 +FILTER=482 +GROUPS=483 +OTHERS=484 +NFC=485 +NFD=486 +NFKC=487 +NFKD=488 +UESCAPE=489 +VIEWS=490 +NORMALIZE=491 +DUMP=492 +PRINT_STRICT_PARAMS=493 +VARIABLE_CONFLICT=494 +ERROR=495 +USE_VARIABLE=496 +USE_COLUMN=497 +ALIAS=498 +CONSTANT=499 +PERFORM=500 +GET=501 +DIAGNOSTICS=502 +STACKED=503 +ELSIF=504 +WHILE=505 +REVERSE=506 +FOREACH=507 +SLICE=508 +EXIT=509 +RETURN=510 +QUERY=511 +RAISE=512 +SQLSTATE=513 +DEBUG=514 +LOG=515 +INFO=516 +NOTICE=517 +WARNING=518 +EXCEPTION=519 +ASSERT=520 +LOOP=521 +OPEN=522 +ABS=523 +CBRT=524 +CEIL=525 +CEILING=526 +DEGREES=527 +DIV=528 +EXP=529 +FACTORIAL=530 +FLOOR=531 +GCD=532 +LCM=533 +LN=534 +LOG10=535 +MIN_SCALE=536 +MOD=537 +PI=538 +POWER=539 +RADIANS=540 +ROUND=541 +SCALE=542 +SIGN=543 +SQRT=544 +TRIM_SCALE=545 +TRUNC=546 +WIDTH_BUCKET=547 +RANDOM=548 +SETSEED=549 +ACOS=550 +ACOSD=551 +ASIN=552 +ASIND=553 +ATAN=554 +ATAND=555 +ATAN2=556 +ATAN2D=557 +COS=558 +COSD=559 +COT=560 +COTD=561 +SIN=562 +SIND=563 +TAN=564 +TAND=565 +SINH=566 +COSH=567 +TANH=568 +ASINH=569 +ACOSH=570 +ATANH=571 +BIT_LENGTH=572 +CHAR_LENGTH=573 +CHARACTER_LENGTH=574 +LOWER=575 +OCTET_LENGTH=576 +UPPER=577 +ASCII=578 +BTRIM=579 +CHR=580 +CONCAT=581 +CONCAT_WS=582 +FORMAT=583 +INITCAP=584 +LENGTH=585 +LPAD=586 +LTRIM=587 +MD5=588 +PARSE_IDENT=589 +PG_CLIENT_ENCODING=590 +QUOTE_IDENT=591 +QUOTE_LITERAL=592 +QUOTE_NULLABLE=593 +REGEXP_COUNT=594 +REGEXP_INSTR=595 +REGEXP_LIKE=596 +REGEXP_MATCH=597 +REGEXP_MATCHES=598 +REGEXP_REPLACE=599 +REGEXP_SPLIT_TO_ARRAY=600 +REGEXP_SPLIT_TO_TABLE=601 +REGEXP_SUBSTR=602 +REPEAT=603 +RPAD=604 +RTRIM=605 +SPLIT_PART=606 +STARTS_WITH=607 +STRING_TO_ARRAY=608 +STRING_TO_TABLE=609 +STRPOS=610 +SUBSTR=611 +TO_ASCII=612 +TO_HEX=613 +TRANSLATE=614 +UNISTR=615 +AGE=616 +CLOCK_TIMESTAMP=617 +DATE_BIN=618 +DATE_PART=619 +DATE_TRUNC=620 +ISFINITE=621 +JUSTIFY_DAYS=622 +JUSTIFY_HOURS=623 +JUSTIFY_INTERVAL=624 +MAKE_DATE=625 +MAKE_INTERVAL=626 +MAKE_TIME=627 +MAKE_TIMESTAMP=628 +MAKE_TIMESTAMPTZ=629 +NOW=630 +STATEMENT_TIMESTAMP=631 +TIMEOFDAY=632 +TRANSACTION_TIMESTAMP=633 +TO_TIMESTAMP=634 +TO_CHAR=635 +TO_DATE=636 +TO_NUMBER=637 +ENCODE=638 +DISTKEY=639 +SORTKEY=640 +CASE_SENSITIVE=641 +CASE_INSENSITIVE=642 +Identifier=643 +QuotedIdentifier=644 +UnterminatedQuotedIdentifier=645 +InvalidQuotedIdentifier=646 +InvalidUnterminatedQuotedIdentifier=647 +UnicodeQuotedIdentifier=648 +UnterminatedUnicodeQuotedIdentifier=649 +InvalidUnicodeQuotedIdentifier=650 +InvalidUnterminatedUnicodeQuotedIdentifier=651 +StringConstant=652 +UnterminatedStringConstant=653 +UnicodeEscapeStringConstant=654 +UnterminatedUnicodeEscapeStringConstant=655 +BeginDollarStringConstant=656 +BinaryStringConstant=657 +UnterminatedBinaryStringConstant=658 +InvalidBinaryStringConstant=659 +InvalidUnterminatedBinaryStringConstant=660 +HexadecimalStringConstant=661 +UnterminatedHexadecimalStringConstant=662 +InvalidHexadecimalStringConstant=663 +InvalidUnterminatedHexadecimalStringConstant=664 +Integral=665 +NumericFail=666 +Numeric=667 +PLSQLVARIABLENAME=668 +PLSQLIDENTIFIER=669 +Whitespace=670 +Newline=671 +LineComment=672 +BlockComment=673 +UnterminatedBlockComment=674 +MetaCommand=675 +EndMetaCommand=676 +ErrorCharacter=677 +EscapeStringConstant=678 +UnterminatedEscapeStringConstant=679 +InvalidEscapeStringConstant=680 +InvalidUnterminatedEscapeStringConstant=681 +AfterEscapeStringConstantMode_NotContinued=682 +AfterEscapeStringConstantWithNewlineMode_NotContinued=683 +DollarText=684 +EndDollarStringConstant=685 +AfterEscapeStringConstantWithNewlineMode_Continued=686 +'$'=1 +'('=2 +')'=3 +'['=4 +']'=5 +','=6 +';'=7 +':'=8 +'*'=9 +'='=10 +'.'=11 +'+'=12 +'-'=13 +'/'=14 +'^'=15 +'<'=16 +'>'=17 +'<<'=18 +'>>'=19 +':='=20 +'<='=21 +'=>'=22 +'>='=23 +'..'=24 +'<>'=25 +'::'=26 +'%'=27 +'ALL'=30 +'ANALYSE'=31 +'ANALYZE'=32 +'AND'=33 +'ANY'=34 +'ARRAY'=35 +'AS'=36 +'ASC'=37 +'ASYMMETRIC'=38 +'BOTH'=39 +'CASE'=40 +'CAST'=41 +'CHECK'=42 +'COLLATE'=43 +'COLUMN'=44 +'CONSTRAINT'=45 +'CREATE'=46 +'CURRENT_CATALOG'=47 +'CURRENT_DATE'=48 +'CURRENT_ROLE'=49 +'CURRENT_TIME'=50 +'CURRENT_TIMESTAMP'=51 +'CURRENT_USER'=52 +'DEFAULT'=53 +'DEFERRABLE'=54 +'DESC'=55 +'DISTINCT'=56 +'DO'=57 +'ELSE'=58 +'EXCEPT'=59 +'FALSE'=60 +'FETCH'=61 +'FOR'=62 +'FOREIGN'=63 +'FROM'=64 +'GRANT'=65 +'GROUP'=66 +'HAVING'=67 +'IN'=68 +'INITIALLY'=69 +'INTERSECT'=70 +'INTO'=71 +'LATERAL'=72 +'LEADING'=73 +'LIMIT'=74 +'LOCALTIME'=75 +'LOCALTIMESTAMP'=76 +'NOT'=77 +'NULL'=78 +'OFFSET'=79 +'ON'=80 +'ONLY'=81 +'OR'=82 +'ORDER'=83 +'PLACING'=84 +'PRIMARY'=85 +'REFERENCES'=86 +'RETURNING'=87 +'SELECT'=88 +'SESSION_USER'=89 +'SOME'=90 +'SYMMETRIC'=91 +'TABLE'=92 +'THEN'=93 +'TO'=94 +'TRAILING'=95 +'TRUE'=96 +'UNION'=97 +'UNIQUE'=98 +'USER'=99 +'USING'=100 +'VARIADIC'=101 +'WHEN'=102 +'WHERE'=103 +'WINDOW'=104 +'WITH'=105 +'AUTHORIZATION'=106 +'BINARY'=107 +'COLLATION'=108 +'CONCURRENTLY'=109 +'CROSS'=110 +'CURRENT_SCHEMA'=111 +'FREEZE'=112 +'FULL'=113 +'ILIKE'=114 +'INNER'=115 +'IS'=116 +'ISNULL'=117 +'JOIN'=118 +'LEFT'=119 +'LIKE'=120 +'NATURAL'=121 +'NOTNULL'=122 +'OUTER'=123 +'OVER'=124 +'OVERLAPS'=125 +'RIGHT'=126 +'SIMILAR'=127 +'VERBOSE'=128 +'ABORT'=129 +'ABSOLUTE'=130 +'ACCESS'=131 +'ACTION'=132 +'ADD'=133 +'ADMIN'=134 +'AFTER'=135 +'AGGREGATE'=136 +'ALSO'=137 +'ALTER'=138 +'ALWAYS'=139 +'ASSERTION'=140 +'ASSIGNMENT'=141 +'AT'=142 +'ATTRIBUTE'=143 +'BACKWARD'=144 +'BEFORE'=145 +'BEGIN'=146 +'BY'=147 +'CACHE'=148 +'CALLED'=149 +'CASCADE'=150 +'CASCADED'=151 +'CATALOG'=152 +'CHAIN'=153 +'CHARACTERISTICS'=154 +'CHECKPOINT'=155 +'CLASS'=156 +'CLOSE'=157 +'CLUSTER'=158 +'COMMENT'=159 +'COMMENTS'=160 +'COMMIT'=161 +'COMMITTED'=162 +'CONFIGURATION'=163 +'CONNECTION'=164 +'CONSTRAINTS'=165 +'CONTENT'=166 +'CONTINUE'=167 +'CONVERSION'=168 +'COPY'=169 +'COST'=170 +'CSV'=171 +'CURSOR'=172 +'CYCLE'=173 +'DATA'=174 +'DATABASE'=175 +'DAY'=176 +'DEALLOCATE'=177 +'DECLARE'=178 +'DEFAULTS'=179 +'DEFERRED'=180 +'DEFINER'=181 +'DELETE'=182 +'DELIMITER'=183 +'DELIMITERS'=184 +'DICTIONARY'=185 +'DISABLE'=186 +'DISCARD'=187 +'DOCUMENT'=188 +'DOMAIN'=189 +'DOUBLE'=190 +'DROP'=191 +'EACH'=192 +'ENABLE'=193 +'ENCODING'=194 +'ENCRYPTED'=195 +'ENUM'=196 +'ESCAPE'=197 +'EVENT'=198 +'EXCLUDE'=199 +'EXCLUDING'=200 +'EXCLUSIVE'=201 +'EXECUTE'=202 +'EXPLAIN'=203 +'EXTENSION'=204 +'EXTERNAL'=205 +'FAMILY'=206 +'FIRST'=207 +'FOLLOWING'=208 +'FORCE'=209 +'FORWARD'=210 +'FUNCTION'=211 +'FUNCTIONS'=212 +'GLOBAL'=213 +'GRANTED'=214 +'HANDLER'=215 +'HEADER'=216 +'HOLD'=217 +'HOUR'=218 +'IDENTITY'=219 +'IF'=220 +'IMMEDIATE'=221 +'IMMUTABLE'=222 +'IMPLICIT'=223 +'INCLUDING'=224 +'INCREMENT'=225 +'INDEX'=226 +'INDEXES'=227 +'INHERIT'=228 +'INHERITS'=229 +'INLINE'=230 +'INSENSITIVE'=231 +'INSERT'=232 +'INSTEAD'=233 +'INVOKER'=234 +'ISOLATION'=235 +'KEY'=236 +'LABEL'=237 +'LANGUAGE'=238 +'LARGE'=239 +'LAST'=240 +'LEAKPROOF'=241 +'LEVEL'=242 +'LISTEN'=243 +'LOAD'=244 +'LOCAL'=245 +'LOCATION'=246 +'LOCK'=247 +'MAPPING'=248 +'MATCH'=249 +'MATCHED'=250 +'MATERIALIZED'=251 +'MAXVALUE'=252 +'MERGE'=253 +'MINUTE'=254 +'MINVALUE'=255 +'MODE'=256 +'MONTH'=257 +'MOVE'=258 +'NAME'=259 +'NAMES'=260 +'NEXT'=261 +'NO'=262 +'NOTHING'=263 +'NOTIFY'=264 +'NOWAIT'=265 +'NULLS'=266 +'OBJECT'=267 +'OF'=268 +'OFF'=269 +'OIDS'=270 +'OPERATOR'=271 +'OPTION'=272 +'OPTIONS'=273 +'OWNED'=274 +'OWNER'=275 +'PARSER'=276 +'PARTIAL'=277 +'PARTITION'=278 +'PASSING'=279 +'PASSWORD'=280 +'PLANS'=281 +'PRECEDING'=282 +'PREPARE'=283 +'PREPARED'=284 +'PRESERVE'=285 +'PRIOR'=286 +'PRIVILEGES'=287 +'PROCEDURAL'=288 +'PROCEDURE'=289 +'PROGRAM'=290 +'QUOTE'=291 +'RANGE'=292 +'READ'=293 +'REASSIGN'=294 +'RECHECK'=295 +'RECURSIVE'=296 +'REF'=297 +'REFRESH'=298 +'REINDEX'=299 +'RELATIVE'=300 +'RELEASE'=301 +'RENAME'=302 +'REPEATABLE'=303 +'REPLACE'=304 +'REPLICA'=305 +'RESET'=306 +'RESTART'=307 +'RESTRICT'=308 +'RETURNS'=309 +'REVOKE'=310 +'ROLE'=311 +'ROLLBACK'=312 +'ROWS'=313 +'RULE'=314 +'SAVEPOINT'=315 +'SCHEMA'=316 +'SCROLL'=317 +'SEARCH'=318 +'SECOND'=319 +'SECURITY'=320 +'SEQUENCE'=321 +'SEQUENCES'=322 +'SERIALIZABLE'=323 +'SERVER'=324 +'SESSION'=325 +'SET'=326 +'SHARE'=327 +'SHOW'=328 +'SIMPLE'=329 +'SNAPSHOT'=330 +'STABLE'=331 +'STANDALONE'=332 +'START'=333 +'STATEMENT'=334 +'STATISTICS'=335 +'STDIN'=336 +'STDOUT'=337 +'STORAGE'=338 +'STRICT'=339 +'STRIP'=340 +'SYSID'=341 +'SYSTEM'=342 +'TABLES'=343 +'TABLESPACE'=344 +'TEMP'=345 +'TEMPLATE'=346 +'TEMPORARY'=347 +'TEXT'=348 +'TRANSACTION'=349 +'TRIGGER'=350 +'TRUNCATE'=351 +'TRUSTED'=352 +'TYPE'=353 +'TYPES'=354 +'UNBOUNDED'=355 +'UNCOMMITTED'=356 +'UNENCRYPTED'=357 +'UNKNOWN'=358 +'UNLISTEN'=359 +'UNLOGGED'=360 +'UNTIL'=361 +'UPDATE'=362 +'VACUUM'=363 +'VALID'=364 +'VALIDATE'=365 +'VALIDATOR'=366 +'VARYING'=367 +'VERSION'=368 +'VIEW'=369 +'VOLATILE'=370 +'WHITESPACE'=371 +'WITHOUT'=372 +'WORK'=373 +'WRAPPER'=374 +'WRITE'=375 +'XML'=376 +'YEAR'=377 +'YES'=378 +'ZONE'=379 +'ATOMIC'=380 +'BETWEEN'=381 +'BIGINT'=382 +'BIT'=383 +'BOOLEAN'=384 +'CHAR'=385 +'CHARACTER'=386 +'COALESCE'=387 +'DEC'=388 +'DECIMAL'=389 +'EXISTS'=390 +'EXTRACT'=391 +'FLOAT'=392 +'GREATEST'=393 +'INOUT'=394 +'INT'=395 +'INTEGER'=396 +'INTERVAL'=397 +'LEAST'=398 +'NATIONAL'=399 +'NCHAR'=400 +'NONE'=401 +'NULLIF'=402 +'NUMERIC'=403 +'OVERLAY'=404 +'PARAMETER'=405 +'POSITION'=406 +'PRECISION'=407 +'REAL'=408 +'ROW'=409 +'SETOF'=410 +'SMALLINT'=411 +'SUBSTRING'=412 +'TIME'=413 +'TIMESTAMP'=414 +'TREAT'=415 +'TRIM'=416 +'VALUES'=417 +'VARCHAR'=418 +'XMLATTRIBUTES'=419 +'XMLCOMMENT'=420 +'XMLAGG'=421 +'XML_IS_WELL_FORMED'=422 +'XML_IS_WELL_FORMED_DOCUMENT'=423 +'XML_IS_WELL_FORMED_CONTENT'=424 +'XPATH'=425 +'XPATH_EXISTS'=426 +'XMLCONCAT'=427 +'XMLELEMENT'=428 +'XMLEXISTS'=429 +'XMLFOREST'=430 +'XMLPARSE'=431 +'XMLPI'=432 +'XMLROOT'=433 +'XMLSERIALIZE'=434 +'CALL'=435 +'CURRENT'=436 +'ATTACH'=437 +'DETACH'=438 +'EXPRESSION'=439 +'GENERATED'=440 +'LOGGED'=441 +'STORED'=442 +'INCLUDE'=443 +'ROUTINE'=444 +'TRANSFORM'=445 +'IMPORT'=446 +'POLICY'=447 +'METHOD'=448 +'REFERENCING'=449 +'NEW'=450 +'OLD'=451 +'VALUE'=452 +'SUBSCRIPTION'=453 +'PUBLICATION'=454 +'OUT'=455 +'END'=456 +'ROUTINES'=457 +'SCHEMAS'=458 +'PROCEDURES'=459 +'INPUT'=460 +'SUPPORT'=461 +'PARALLEL'=462 +'SQL'=463 +'DEPENDS'=464 +'OVERRIDING'=465 +'CONFLICT'=466 +'SKIP'=467 +'LOCKED'=468 +'TIES'=469 +'ROLLUP'=470 +'CUBE'=471 +'GROUPING'=472 +'SETS'=473 +'TABLESAMPLE'=474 +'ORDINALITY'=475 +'XMLTABLE'=476 +'COLUMNS'=477 +'XMLNAMESPACES'=478 +'ROWTYPE'=479 +'NORMALIZED'=480 +'WITHIN'=481 +'FILTER'=482 +'GROUPS'=483 +'OTHERS'=484 +'NFC'=485 +'NFD'=486 +'NFKC'=487 +'NFKD'=488 +'UESCAPE'=489 +'VIEWS'=490 +'NORMALIZE'=491 +'DUMP'=492 +'PRINT_STRICT_PARAMS'=493 +'VARIABLE_CONFLICT'=494 +'ERROR'=495 +'USE_VARIABLE'=496 +'USE_COLUMN'=497 +'ALIAS'=498 +'CONSTANT'=499 +'PERFORM'=500 +'GET'=501 +'DIAGNOSTICS'=502 +'STACKED'=503 +'ELSIF'=504 +'WHILE'=505 +'REVERSE'=506 +'FOREACH'=507 +'SLICE'=508 +'EXIT'=509 +'RETURN'=510 +'QUERY'=511 +'RAISE'=512 +'SQLSTATE'=513 +'DEBUG'=514 +'LOG'=515 +'INFO'=516 +'NOTICE'=517 +'WARNING'=518 +'EXCEPTION'=519 +'ASSERT'=520 +'LOOP'=521 +'OPEN'=522 +'ABS'=523 +'CBRT'=524 +'CEIL'=525 +'CEILING'=526 +'DEGREES'=527 +'DIV'=528 +'EXP'=529 +'FACTORIAL'=530 +'FLOOR'=531 +'GCD'=532 +'LCM'=533 +'LN'=534 +'LOG10'=535 +'MIN_SCALE'=536 +'MOD'=537 +'PI'=538 +'POWER'=539 +'RADIANS'=540 +'ROUND'=541 +'SCALE'=542 +'SIGN'=543 +'SQRT'=544 +'TRIM_SCALE'=545 +'TRUNC'=546 +'WIDTH_BUCKET'=547 +'RANDOM'=548 +'SETSEED'=549 +'ACOS'=550 +'ACOSD'=551 +'ASIN'=552 +'ASIND'=553 +'ATAN'=554 +'ATAND'=555 +'ATAN2'=556 +'ATAN2D'=557 +'COS'=558 +'COSD'=559 +'COT'=560 +'COTD'=561 +'SIN'=562 +'SIND'=563 +'TAN'=564 +'TAND'=565 +'SINH'=566 +'COSH'=567 +'TANH'=568 +'ASINH'=569 +'ACOSH'=570 +'ATANH'=571 +'BIT_LENGTH'=572 +'CHAR_LENGTH'=573 +'CHARACTER_LENGTH'=574 +'LOWER'=575 +'OCTET_LENGTH'=576 +'UPPER'=577 +'ASCII'=578 +'BTRIM'=579 +'CHR'=580 +'CONCAT'=581 +'CONCAT_WS'=582 +'FORMAT'=583 +'INITCAP'=584 +'LENGTH'=585 +'LPAD'=586 +'LTRIM'=587 +'MD5'=588 +'PARSE_IDENT'=589 +'PG_CLIENT_ENCODING'=590 +'QUOTE_IDENT'=591 +'QUOTE_LITERAL'=592 +'QUOTE_NULLABLE'=593 +'REGEXP_COUNT'=594 +'REGEXP_INSTR'=595 +'REGEXP_LIKE'=596 +'REGEXP_MATCH'=597 +'REGEXP_MATCHES'=598 +'REGEXP_REPLACE'=599 +'REGEXP_SPLIT_TO_ARRAY'=600 +'REGEXP_SPLIT_TO_TABLE'=601 +'REGEXP_SUBSTR'=602 +'REPEAT'=603 +'RPAD'=604 +'RTRIM'=605 +'SPLIT_PART'=606 +'STARTS_WITH'=607 +'STRING_TO_ARRAY'=608 +'STRING_TO_TABLE'=609 +'STRPOS'=610 +'SUBSTR'=611 +'TO_ASCII'=612 +'TO_HEX'=613 +'TRANSLATE'=614 +'UNISTR'=615 +'AGE'=616 +'CLOCK_TIMESTAMP'=617 +'DATE_BIN'=618 +'DATE_PART'=619 +'DATE_TRUNC'=620 +'ISFINITE'=621 +'JUSTIFY_DAYS'=622 +'JUSTIFY_HOURS'=623 +'JUSTIFY_INTERVAL'=624 +'MAKE_DATE'=625 +'MAKE_INTERVAL'=626 +'MAKE_TIME'=627 +'MAKE_TIMESTAMP'=628 +'MAKE_TIMESTAMPTZ'=629 +'NOW'=630 +'STATEMENT_TIMESTAMP'=631 +'TIMEOFDAY'=632 +'TRANSACTION_TIMESTAMP'=633 +'TO_TIMESTAMP'=634 +'TO_CHAR'=635 +'TO_DATE'=636 +'TO_NUMBER'=637 +'ENCODE'=638 +'DISTKEY'=639 +'SORTKEY'=640 +'CASE_SENSITIVE'=641 +'CASE_INSENSITIVE'=642 +'\\\\'=676 +'\''=686 diff --git a/postgresql/PostgreSQLParser.g4 b/postgresql/PostgreSQLParser.g4 new file mode 100755 index 0000000..b97f5ed --- /dev/null +++ b/postgresql/PostgreSQLParser.g4 @@ -0,0 +1,5351 @@ +parser grammar PostgreSQLParser; + + +options { tokenVocab = PostgreSQLLexer; +superClass = PostgreSQLParserBase; +} + + +@header +{ +} +@members +{ +} +root + : stmtblock EOF + ; + +plsqlroot + : pl_function + ; + +stmtblock + : stmtmulti + ; + +stmtmulti + : (stmt SEMI?)* + ; + +stmt + : altereventtrigstmt + | altercollationstmt + | alterdatabasestmt + | alterdatabasesetstmt + | alterdefaultprivilegesstmt + | alterdomainstmt + | alterenumstmt + | alterextensionstmt + | alterextensioncontentsstmt + | alterfdwstmt + | alterforeignserverstmt + | alterfunctionstmt + | altergroupstmt + | alterobjectdependsstmt + | alterobjectschemastmt + | alterownerstmt + | alteroperatorstmt + | altertypestmt + | alterpolicystmt + | alterseqstmt + | altersystemstmt + | altertablestmt + | altertblspcstmt + | altercompositetypestmt + | alterpublicationstmt + | alterrolesetstmt + | alterrolestmt + | altersubscriptionstmt + | alterstatsstmt + | altertsconfigurationstmt + | altertsdictionarystmt + | alterusermappingstmt + | analyzestmt + | callstmt + | checkpointstmt + | closeportalstmt + | clusterstmt + | commentstmt + | constraintssetstmt + | copystmt + | createamstmt + | createasstmt + | createassertionstmt + | createcaststmt + | createconversionstmt + | createdomainstmt + | createextensionstmt + | createfdwstmt + | createforeignserverstmt + | createforeigntablestmt + | createfunctionstmt + | creategroupstmt + | creatematviewstmt + | createopclassstmt + | createopfamilystmt + | createpublicationstmt + | alteropfamilystmt + | createpolicystmt + | createplangstmt + | createschemastmt + | createseqstmt + | createstmt + | createsubscriptionstmt + | createstatsstmt + | createtablespacestmt + | createtransformstmt + | createtrigstmt + | createeventtrigstmt + | createrolestmt + | createuserstmt + | createusermappingstmt + | createdbstmt + | deallocatestmt + | declarecursorstmt + | definestmt + | deletestmt + | discardstmt + | dostmt + | dropcaststmt + | dropopclassstmt + | dropopfamilystmt + | dropownedstmt + | dropstmt + | dropsubscriptionstmt + | droptablespacestmt + | droptransformstmt + | droprolestmt + | dropusermappingstmt + | dropdbstmt + | executestmt + | explainstmt + | fetchstmt + | grantstmt + | grantrolestmt + | importforeignschemastmt + | indexstmt + | insertstmt + | mergestmt + | listenstmt + | refreshmatviewstmt + | loadstmt + | lockstmt + | notifystmt + | preparestmt + | reassignownedstmt + | reindexstmt + | removeaggrstmt + | removefuncstmt + | removeoperstmt + | renamestmt + | revokestmt + | revokerolestmt + | rulestmt + | seclabelstmt + | selectstmt + | transactionstmt + | truncatestmt + | unlistenstmt + | updatestmt + | vacuumstmt + | variableresetstmt + | variablesetstmt + | variableshowstmt + | viewstmt + | plsqlconsolecommand + ; + +plsqlconsolecommand + : MetaCommand EndMetaCommand? + ; + +callstmt + : CALL func_application + ; + +createrolestmt + : CREATE ROLE roleid opt_with? optrolelist + ; + +opt_with + : WITH + //| WITH_LA + ; + +optrolelist + : createoptroleelem* + ; + +alteroptrolelist + : alteroptroleelem* + ; + +alteroptroleelem + : PASSWORD (sconst | NULL_P) + | (ENCRYPTED | UNENCRYPTED) PASSWORD sconst + | INHERIT + | CONNECTION LIMIT signediconst + | VALID UNTIL sconst + | USER role_list + | identifier + ; + +createoptroleelem + : alteroptroleelem + | SYSID iconst + | ADMIN role_list + | ROLE role_list + | IN_P (ROLE | GROUP_P) role_list + ; + +createuserstmt + : CREATE USER roleid opt_with? optrolelist + ; + +alterrolestmt + : ALTER (ROLE | USER) rolespec opt_with? alteroptrolelist + ; + +opt_in_database + : IN_P DATABASE name + ; + +alterrolesetstmt + : ALTER (ROLE | USER) ALL? rolespec opt_in_database? setresetclause + ; + +droprolestmt + : DROP (ROLE | USER | GROUP_P) (IF_P EXISTS)? role_list + ; + +creategroupstmt + : CREATE GROUP_P roleid opt_with? optrolelist + ; + +altergroupstmt + : ALTER GROUP_P rolespec add_drop USER role_list + ; + +add_drop + : ADD_P + | DROP + ; + +createschemastmt + : CREATE SCHEMA (IF_P NOT EXISTS)? (optschemaname? AUTHORIZATION rolespec | colid) optschemaeltlist + ; + +optschemaname + : colid + ; + +optschemaeltlist + : schema_stmt* + ; + +schema_stmt + : createstmt + | indexstmt + | createseqstmt + | createtrigstmt + | grantstmt + | viewstmt + ; + +variablesetstmt + : SET (LOCAL | SESSION)? set_rest + ; + +set_rest + : TRANSACTION transaction_mode_list + | SESSION CHARACTERISTICS AS TRANSACTION transaction_mode_list + | set_rest_more + ; + +generic_set + : var_name (TO | EQUAL) var_list + ; + +set_rest_more + : generic_set + | var_name FROM CURRENT_P + | TIME ZONE zone_value + | CATALOG sconst + | SCHEMA sconst + | NAMES opt_encoding? + | ROLE nonreservedword_or_sconst + | SESSION AUTHORIZATION nonreservedword_or_sconst + | XML_P OPTION document_or_content + | TRANSACTION SNAPSHOT sconst + ; + +var_name + : colid (DOT colid)* + ; + +var_list + : var_value (COMMA var_value)* + ; + +var_value + : opt_boolean_or_string + | numericonly + ; + +iso_level + : READ (UNCOMMITTED | COMMITTED) + | REPEATABLE READ + | SERIALIZABLE + ; + +opt_boolean_or_string + : TRUE_P + | FALSE_P + | ON + | nonreservedword_or_sconst + ; + +zone_value + : sconst + | identifier + | constinterval sconst opt_interval? + | constinterval OPEN_PAREN iconst CLOSE_PAREN sconst + | numericonly + | DEFAULT + | LOCAL + ; + +opt_encoding + : sconst + | DEFAULT + ; + +nonreservedword_or_sconst + : nonreservedword + | sconst + ; + +variableresetstmt + : RESET reset_rest + ; + +reset_rest + : generic_reset + | TIME ZONE + | TRANSACTION ISOLATION LEVEL + | SESSION AUTHORIZATION + ; + +generic_reset + : var_name + | ALL + ; + +setresetclause + : SET set_rest + | variableresetstmt + ; + +functionsetresetclause + : SET set_rest_more + | variableresetstmt + ; + +variableshowstmt + : SHOW (var_name | TIME ZONE | TRANSACTION ISOLATION LEVEL | SESSION AUTHORIZATION | ALL) + ; + +constraintssetstmt + : SET CONSTRAINTS constraints_set_list constraints_set_mode + ; + +constraints_set_list + : ALL + | qualified_name_list + ; + +constraints_set_mode + : DEFERRED + | IMMEDIATE + ; + +checkpointstmt + : CHECKPOINT + ; + +discardstmt + : DISCARD (ALL | TEMP | TEMPORARY | PLANS | SEQUENCES) + ; + +altertablestmt + : ALTER TABLE (IF_P EXISTS)? relation_expr (alter_table_cmds | partition_cmd) + | ALTER TABLE ALL IN_P TABLESPACE name (OWNED BY role_list)? SET TABLESPACE name opt_nowait? + | ALTER INDEX (IF_P EXISTS)? qualified_name (alter_table_cmds | index_partition_cmd) + | ALTER INDEX ALL IN_P TABLESPACE name (OWNED BY role_list)? SET TABLESPACE name opt_nowait? + | ALTER SEQUENCE (IF_P EXISTS)? qualified_name alter_table_cmds + | ALTER VIEW (IF_P EXISTS)? qualified_name alter_table_cmds + | ALTER MATERIALIZED VIEW (IF_P EXISTS)? qualified_name alter_table_cmds + | ALTER MATERIALIZED VIEW ALL IN_P TABLESPACE name (OWNED BY role_list)? SET TABLESPACE name opt_nowait? + | ALTER FOREIGN TABLE (IF_P EXISTS)? relation_expr alter_table_cmds + ; + +alter_table_cmds + : alter_table_cmd (COMMA alter_table_cmd)* + ; + +partition_cmd + : ATTACH PARTITION qualified_name partitionboundspec + | DETACH PARTITION qualified_name + ; + +index_partition_cmd + : ATTACH PARTITION qualified_name + ; + +alter_table_cmd + : ADD_P columnDef + | ADD_P IF_P NOT EXISTS columnDef + | ADD_P COLUMN columnDef + | ADD_P COLUMN IF_P NOT EXISTS columnDef + | ALTER opt_column? colid alter_column_default + | ALTER opt_column? colid DROP NOT NULL_P + | ALTER opt_column? colid SET NOT NULL_P + | ALTER opt_column? colid DROP EXPRESSION + | ALTER opt_column? colid DROP EXPRESSION IF_P EXISTS + | ALTER opt_column? colid SET STATISTICS signediconst + | ALTER opt_column? iconst SET STATISTICS signediconst + | ALTER opt_column? colid SET reloptions + | ALTER opt_column? colid RESET reloptions + | ALTER opt_column? colid SET STORAGE colid + | ALTER opt_column? colid ADD_P GENERATED generated_when AS IDENTITY_P optparenthesizedseqoptlist? + | ALTER opt_column? colid alter_identity_column_option_list + | ALTER opt_column? colid DROP IDENTITY_P + | ALTER opt_column? colid DROP IDENTITY_P IF_P EXISTS + | DROP opt_column? IF_P EXISTS colid opt_drop_behavior? + | DROP opt_column? colid opt_drop_behavior? + | ALTER opt_column? colid opt_set_data? TYPE_P typename opt_collate_clause? alter_using? + | ALTER opt_column? colid alter_generic_options + | ADD_P tableconstraint + | ALTER CONSTRAINT name constraintattributespec + | VALIDATE CONSTRAINT name + | DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior? + | DROP CONSTRAINT name opt_drop_behavior? + | SET WITHOUT OIDS + | CLUSTER ON name + | SET WITHOUT CLUSTER + | SET LOGGED + | SET UNLOGGED + | ENABLE_P TRIGGER name + | ENABLE_P ALWAYS TRIGGER name + | ENABLE_P REPLICA TRIGGER name + | ENABLE_P TRIGGER ALL + | ENABLE_P TRIGGER USER + | DISABLE_P TRIGGER name + | DISABLE_P TRIGGER ALL + | DISABLE_P TRIGGER USER + | ENABLE_P RULE name + | ENABLE_P ALWAYS RULE name + | ENABLE_P REPLICA RULE name + | DISABLE_P RULE name + | INHERIT qualified_name + | NO INHERIT qualified_name + | OF any_name + | NOT OF + | OWNER TO rolespec + | SET ACCESS METHOD name + | SET TABLESPACE name + | SET reloptions + | RESET reloptions + | REPLICA IDENTITY_P replica_identity + | ENABLE_P ROW LEVEL SECURITY + | DISABLE_P ROW LEVEL SECURITY + | FORCE ROW LEVEL SECURITY + | NO FORCE ROW LEVEL SECURITY + | alter_generic_options + ; + +alter_column_default + : SET DEFAULT a_expr + | DROP DEFAULT + ; + +opt_drop_behavior + : CASCADE + | RESTRICT + ; + +opt_collate_clause + : COLLATE any_name + ; + +alter_using + : USING a_expr + ; + +replica_identity + : NOTHING + | FULL + | DEFAULT + | USING INDEX name + ; + +reloptions + : OPEN_PAREN reloption_list CLOSE_PAREN + ; + +opt_reloptions + : WITH reloptions + ; + +reloption_list + : reloption_elem (COMMA reloption_elem)* + ; + +reloption_elem + : collabel (EQUAL def_arg | DOT collabel (EQUAL def_arg)?)? + ; + +alter_identity_column_option_list + : alter_identity_column_option+ + ; + +alter_identity_column_option + : RESTART (opt_with? numericonly)? + | SET (seqoptelem | GENERATED generated_when) + ; + +partitionboundspec + : FOR VALUES WITH OPEN_PAREN hash_partbound CLOSE_PAREN + | FOR VALUES IN_P OPEN_PAREN expr_list CLOSE_PAREN + | FOR VALUES FROM OPEN_PAREN expr_list CLOSE_PAREN TO OPEN_PAREN expr_list CLOSE_PAREN + | DEFAULT + ; + +hash_partbound_elem + : nonreservedword iconst + ; + +hash_partbound + : hash_partbound_elem (COMMA hash_partbound_elem)* + ; + +altercompositetypestmt + : ALTER TYPE_P any_name alter_type_cmds + ; + +alter_type_cmds + : alter_type_cmd (COMMA alter_type_cmd)* + ; + +alter_type_cmd + : ADD_P ATTRIBUTE tablefuncelement opt_drop_behavior? + | DROP ATTRIBUTE (IF_P EXISTS)? colid opt_drop_behavior? + | ALTER ATTRIBUTE colid opt_set_data? TYPE_P typename opt_collate_clause? opt_drop_behavior? + ; + +closeportalstmt + : CLOSE (cursor_name | ALL) + ; + +copystmt + : COPY opt_binary? qualified_name opt_column_list? copy_from opt_program? copy_file_name copy_delimiter? opt_with? copy_options where_clause? + | COPY OPEN_PAREN preparablestmt CLOSE_PAREN TO opt_program? copy_file_name opt_with? copy_options + ; + +copy_from + : FROM + | TO + ; + +opt_program + : PROGRAM + ; + +copy_file_name + : sconst + | STDIN + | STDOUT + ; + +copy_options + : copy_opt_list + | OPEN_PAREN copy_generic_opt_list CLOSE_PAREN + ; + +copy_opt_list + : copy_opt_item* + ; + +copy_opt_item + : BINARY + | FREEZE + | DELIMITER opt_as? sconst + | NULL_P opt_as? sconst + | CSV + | HEADER_P + | QUOTE opt_as? sconst + | ESCAPE opt_as? sconst + | FORCE QUOTE columnlist + | FORCE QUOTE STAR + | FORCE NOT NULL_P columnlist + | FORCE NULL_P columnlist + | ENCODING sconst + ; + +opt_binary + : BINARY + ; + +copy_delimiter + : opt_using? DELIMITERS sconst + ; + +opt_using + : USING + ; + +copy_generic_opt_list + : copy_generic_opt_elem (COMMA copy_generic_opt_elem)* + ; + +copy_generic_opt_elem + : collabel copy_generic_opt_arg? + ; + +copy_generic_opt_arg + : opt_boolean_or_string + | numericonly + | STAR + | OPEN_PAREN copy_generic_opt_arg_list CLOSE_PAREN + ; + +copy_generic_opt_arg_list + : copy_generic_opt_arg_list_item (COMMA copy_generic_opt_arg_list_item)* + ; + +copy_generic_opt_arg_list_item + : opt_boolean_or_string + ; + +createstmt + : CREATE opttemp? TABLE (IF_P NOT EXISTS)? qualified_name ( + OPEN_PAREN opttableelementlist? CLOSE_PAREN optinherit? optpartitionspec? table_access_method_clause? optwith? oncommitoption? opttablespace? + | OF any_name opttypedtableelementlist? optpartitionspec? table_access_method_clause? optwith? oncommitoption? opttablespace? + | PARTITION OF qualified_name opttypedtableelementlist? partitionboundspec optpartitionspec? table_access_method_clause? optwith? oncommitoption? opttablespace? + ) + ; + +opttemp + : TEMPORARY + | TEMP + | LOCAL (TEMPORARY | TEMP) + | GLOBAL (TEMPORARY | TEMP) + | UNLOGGED + ; + +opttableelementlist + : tableelementlist + ; + +opttypedtableelementlist + : OPEN_PAREN typedtableelementlist CLOSE_PAREN + ; + +tableelementlist + : tableelement (COMMA tableelement)* + ; + +typedtableelementlist + : typedtableelement (COMMA typedtableelement)* + ; + +tableelement + : tableconstraint + | tablelikeclause + | columnDef + ; + +typedtableelement + : columnOptions + | tableconstraint + ; + +columnDef + : { $parser.Engine!=EngineRedshift }? colid typename create_generic_options? colquallist + | { $parser.Engine==EngineRedshift }? colid typename create_generic_options? rs_colattributes? colquallist + ; + +rs_colattributes + : DEFAULT b_expr + | IDENTITY_P OPEN_PAREN seed=iconst COMMA step=iconst CLOSE_PAREN + | GENERATED BY DEFAULT AS IDENTITY_P OPEN_PAREN seed=iconst COMMA step=iconst CLOSE_PAREN + | ENCODE StringConstant + | DISTKEY + | SORTKEY + | COLLATE (CASE_SENSITIVE | CASE_INSENSITIVE) + ; + +columnOptions + : colid (WITH OPTIONS)? colquallist + ; + +colquallist + : colconstraint* + ; + +colconstraint + : CONSTRAINT name colconstraintelem + | colconstraintelem + | constraintattr + | COLLATE any_name + ; + +colconstraintelem + : NOT NULL_P + | NULL_P + | UNIQUE opt_unique_null_treatment? opt_definition? optconstablespace? + | PRIMARY KEY opt_definition? optconstablespace? + | CHECK OPEN_PAREN a_expr CLOSE_PAREN opt_no_inherit? + | DEFAULT b_expr + | GENERATED generated_when AS (IDENTITY_P optparenthesizedseqoptlist? | OPEN_PAREN a_expr CLOSE_PAREN STORED) + | REFERENCES qualified_name opt_column_list? key_match? key_actions? + ; + +opt_unique_null_treatment + : NULLS_P NOT? DISTINCT + ; + +generated_when + : ALWAYS + | BY DEFAULT + ; + +constraintattr + : DEFERRABLE + | NOT DEFERRABLE + | INITIALLY (DEFERRED | IMMEDIATE) + ; + +tablelikeclause + : LIKE qualified_name tablelikeoptionlist + ; + +tablelikeoptionlist + : ((INCLUDING | EXCLUDING) tablelikeoption)* + ; + +tablelikeoption + : COMMENTS + | CONSTRAINTS + | DEFAULTS + | IDENTITY_P + | GENERATED + | INDEXES + | STATISTICS + | STORAGE + | ALL + ; + +tableconstraint + : CONSTRAINT name constraintelem + | constraintelem + ; + +constraintelem + : CHECK OPEN_PAREN a_expr CLOSE_PAREN constraintattributespec + | UNIQUE opt_unique_null_treatment? (OPEN_PAREN columnlist CLOSE_PAREN opt_c_include? opt_definition? optconstablespace? constraintattributespec | existingindex constraintattributespec) + | PRIMARY KEY (OPEN_PAREN columnlist CLOSE_PAREN opt_c_include? opt_definition? optconstablespace? constraintattributespec | existingindex constraintattributespec) + | EXCLUDE access_method_clause? OPEN_PAREN exclusionconstraintlist CLOSE_PAREN opt_c_include? opt_definition? optconstablespace? exclusionwhereclause? constraintattributespec + | FOREIGN KEY OPEN_PAREN columnlist CLOSE_PAREN REFERENCES qualified_name opt_column_list? key_match? key_actions? constraintattributespec + ; + +opt_no_inherit + : NO INHERIT + ; + +opt_column_list + : OPEN_PAREN columnlist CLOSE_PAREN + ; + +columnlist + : columnElem (COMMA columnElem)* + ; + +columnElem + : colid + ; + +opt_c_include + : INCLUDE OPEN_PAREN columnlist CLOSE_PAREN + ; + +key_match + : MATCH (FULL | PARTIAL | SIMPLE) + ; + +exclusionconstraintlist + : exclusionconstraintelem (COMMA exclusionconstraintelem)* + ; + +exclusionconstraintelem + : index_elem WITH (any_operator | OPERATOR OPEN_PAREN any_operator CLOSE_PAREN) + ; + +exclusionwhereclause + : WHERE OPEN_PAREN a_expr CLOSE_PAREN + ; + +key_actions + : key_update + | key_delete + | key_update key_delete + | key_delete key_update + ; + +key_update + : ON UPDATE key_action + ; + +key_delete + : ON DELETE_P key_action + ; + +key_action + : NO ACTION + | RESTRICT + | CASCADE + | SET (NULL_P | DEFAULT) opt_column_list? + ; + +optinherit + : INHERITS OPEN_PAREN qualified_name_list CLOSE_PAREN + ; + +optpartitionspec + : partitionspec + ; + +partitionspec + : PARTITION BY colid OPEN_PAREN part_params CLOSE_PAREN + ; + +part_params + : part_elem (COMMA part_elem)* + ; + +part_elem + : colid opt_collate? opt_class? + | func_expr_windowless opt_collate? opt_class? + | OPEN_PAREN a_expr CLOSE_PAREN opt_collate? opt_class? + ; + +table_access_method_clause + : USING name + ; + +optwith + : WITH reloptions + | WITHOUT OIDS + ; + +oncommitoption + : ON COMMIT (DROP | DELETE_P ROWS | PRESERVE ROWS) + ; + +opttablespace + : TABLESPACE name + ; + +optconstablespace + : USING INDEX TABLESPACE name + ; + +existingindex + : USING INDEX name + ; + +createstatsstmt + : CREATE STATISTICS (IF_P NOT EXISTS)? any_name opt_name_list? ON expr_list FROM from_list + ; + +alterstatsstmt + : ALTER STATISTICS (IF_P EXISTS)? any_name SET STATISTICS signediconst + ; + +createasstmt + : CREATE opttemp? TABLE (IF_P NOT EXISTS)? create_as_target AS selectstmt opt_with_data? + ; + +create_as_target + : qualified_name opt_column_list? table_access_method_clause? optwith? oncommitoption? opttablespace? + ; + +opt_with_data + : WITH (DATA_P | NO DATA_P) + ; + +creatematviewstmt + : CREATE optnolog? MATERIALIZED VIEW (IF_P NOT EXISTS)? create_mv_target AS selectstmt opt_with_data? + ; + +create_mv_target + : qualified_name opt_column_list? table_access_method_clause? opt_reloptions? opttablespace? + ; + +optnolog + : UNLOGGED + ; + +refreshmatviewstmt + : REFRESH MATERIALIZED VIEW opt_concurrently? qualified_name opt_with_data? + ; + +createseqstmt + : CREATE opttemp? SEQUENCE (IF_P NOT EXISTS)? qualified_name optseqoptlist? + ; + +alterseqstmt + : ALTER SEQUENCE (IF_P EXISTS)? qualified_name seqoptlist + ; + +optseqoptlist + : seqoptlist + ; + +optparenthesizedseqoptlist + : OPEN_PAREN seqoptlist CLOSE_PAREN + ; + +seqoptlist + : seqoptelem+ + ; + +seqoptelem + : AS simpletypename + | CACHE numericonly + | CYCLE + | INCREMENT opt_by? numericonly + | LOGGED + | MAXVALUE numericonly + | MINVALUE numericonly + | NO (MAXVALUE | MINVALUE | CYCLE) + | OWNED BY any_name + | SEQUENCE NAME_P any_name + | START opt_with? numericonly + | RESTART opt_with? numericonly? + | UNLOGGED + ; + +opt_by + : BY + ; + +numericonly + : fconst + | PLUS fconst + | MINUS fconst + | signediconst + ; + +numericonly_list + : numericonly (COMMA numericonly)* + ; + +createplangstmt + : CREATE opt_or_replace? opt_trusted? opt_procedural? LANGUAGE name (HANDLER handler_name opt_inline_handler? opt_validator?)? + ; + +opt_trusted + : TRUSTED + ; + +handler_name + : name attrs? + ; + +opt_inline_handler + : INLINE_P handler_name + ; + +validator_clause + : VALIDATOR handler_name + | NO VALIDATOR + ; + +opt_validator + : validator_clause + ; + +opt_procedural + : PROCEDURAL + ; + +createtablespacestmt + : CREATE TABLESPACE name opttablespaceowner? LOCATION sconst opt_reloptions? + ; + +opttablespaceowner + : OWNER rolespec + ; + +droptablespacestmt + : DROP TABLESPACE (IF_P EXISTS)? name + ; + +createextensionstmt + : CREATE EXTENSION (IF_P NOT EXISTS)? name opt_with? create_extension_opt_list + ; + +create_extension_opt_list + : create_extension_opt_item* + ; + +create_extension_opt_item + : SCHEMA name + | VERSION_P nonreservedword_or_sconst + | FROM nonreservedword_or_sconst + | CASCADE + ; + +alterextensionstmt + : ALTER EXTENSION name UPDATE alter_extension_opt_list + ; + +alter_extension_opt_list + : alter_extension_opt_item* + ; + +alter_extension_opt_item + : TO nonreservedword_or_sconst + ; + +alterextensioncontentsstmt + : ALTER EXTENSION name add_drop object_type_name name + | ALTER EXTENSION name add_drop object_type_any_name any_name + | ALTER EXTENSION name add_drop AGGREGATE aggregate_with_argtypes + | ALTER EXTENSION name add_drop CAST OPEN_PAREN typename AS typename CLOSE_PAREN + | ALTER EXTENSION name add_drop DOMAIN_P typename + | ALTER EXTENSION name add_drop FUNCTION function_with_argtypes + | ALTER EXTENSION name add_drop OPERATOR operator_with_argtypes + | ALTER EXTENSION name add_drop OPERATOR CLASS any_name USING name + | ALTER EXTENSION name add_drop OPERATOR FAMILY any_name USING name + | ALTER EXTENSION name add_drop PROCEDURE function_with_argtypes + | ALTER EXTENSION name add_drop ROUTINE function_with_argtypes + | ALTER EXTENSION name add_drop TRANSFORM FOR typename LANGUAGE name + | ALTER EXTENSION name add_drop TYPE_P typename + ; + +createfdwstmt + : CREATE FOREIGN DATA_P WRAPPER name opt_fdw_options? create_generic_options? + ; + +fdw_option + : HANDLER handler_name + | NO HANDLER + | VALIDATOR handler_name + | NO VALIDATOR + ; + +fdw_options + : fdw_option+ + ; + +opt_fdw_options + : fdw_options + ; + +alterfdwstmt + : ALTER FOREIGN DATA_P WRAPPER name opt_fdw_options? alter_generic_options + | ALTER FOREIGN DATA_P WRAPPER name fdw_options + ; + +create_generic_options + : OPTIONS OPEN_PAREN generic_option_list CLOSE_PAREN + ; + +generic_option_list + : generic_option_elem (COMMA generic_option_elem)* + ; + +alter_generic_options + : OPTIONS OPEN_PAREN alter_generic_option_list CLOSE_PAREN + ; + +alter_generic_option_list + : alter_generic_option_elem (COMMA alter_generic_option_elem)* + ; + +alter_generic_option_elem + : generic_option_elem + | SET generic_option_elem + | ADD_P generic_option_elem + | DROP generic_option_name + ; + +generic_option_elem + : generic_option_name generic_option_arg + ; + +generic_option_name + : collabel + ; + +generic_option_arg + : sconst + ; + +createforeignserverstmt + : CREATE SERVER name opt_type? opt_foreign_server_version? FOREIGN DATA_P WRAPPER name create_generic_options? + | CREATE SERVER IF_P NOT EXISTS name opt_type? opt_foreign_server_version? FOREIGN DATA_P WRAPPER name create_generic_options? + ; + +opt_type + : TYPE_P sconst + ; + +foreign_server_version + : VERSION_P (sconst | NULL_P) + ; + +opt_foreign_server_version + : foreign_server_version + ; + +alterforeignserverstmt + : ALTER SERVER name (alter_generic_options | foreign_server_version alter_generic_options?) + ; + +createforeigntablestmt + : CREATE FOREIGN TABLE qualified_name OPEN_PAREN opttableelementlist? CLOSE_PAREN optinherit? SERVER name create_generic_options? + | CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name OPEN_PAREN opttableelementlist? CLOSE_PAREN optinherit? SERVER name create_generic_options? + | CREATE FOREIGN TABLE qualified_name PARTITION OF qualified_name opttypedtableelementlist? partitionboundspec SERVER name create_generic_options? + | CREATE FOREIGN TABLE IF_P NOT EXISTS qualified_name PARTITION OF qualified_name opttypedtableelementlist? partitionboundspec SERVER name create_generic_options? + ; + +importforeignschemastmt + : IMPORT_P FOREIGN SCHEMA name import_qualification? FROM SERVER name INTO name create_generic_options? + ; + +import_qualification_type + : LIMIT TO + | EXCEPT + ; + +import_qualification + : import_qualification_type OPEN_PAREN relation_expr_list CLOSE_PAREN + ; + +createusermappingstmt + : CREATE USER MAPPING FOR auth_ident SERVER name create_generic_options? + | CREATE USER MAPPING IF_P NOT EXISTS FOR auth_ident SERVER name create_generic_options? + ; + +auth_ident + : rolespec + | USER + ; + +dropusermappingstmt + : DROP USER MAPPING FOR auth_ident SERVER name + | DROP USER MAPPING IF_P EXISTS FOR auth_ident SERVER name + ; + +alterusermappingstmt + : ALTER USER MAPPING FOR auth_ident SERVER name alter_generic_options + ; + +createpolicystmt + : CREATE POLICY name ON qualified_name rowsecuritydefaultpermissive? rowsecuritydefaultforcmd? rowsecuritydefaulttorole? rowsecurityoptionalexpr? rowsecurityoptionalwithcheck? + ; + +alterpolicystmt + : ALTER POLICY name ON qualified_name rowsecurityoptionaltorole? rowsecurityoptionalexpr? rowsecurityoptionalwithcheck? + ; + +rowsecurityoptionalexpr + : USING OPEN_PAREN a_expr CLOSE_PAREN + ; + +rowsecurityoptionalwithcheck + : WITH CHECK OPEN_PAREN a_expr CLOSE_PAREN + ; + +rowsecuritydefaulttorole + : TO role_list + ; + +rowsecurityoptionaltorole + : TO role_list + ; + +rowsecuritydefaultpermissive + : AS identifier + ; + +rowsecuritydefaultforcmd + : FOR row_security_cmd + ; + +row_security_cmd + : ALL + | SELECT + | INSERT + | UPDATE + | DELETE_P + ; + +createamstmt + : CREATE ACCESS METHOD name TYPE_P am_type HANDLER handler_name + ; + +am_type + : INDEX + | TABLE + ; + +createtrigstmt + : CREATE TRIGGER name triggeractiontime triggerevents ON qualified_name triggerreferencing? triggerforspec? triggerwhen? EXECUTE function_or_procedure func_name OPEN_PAREN triggerfuncargs CLOSE_PAREN + | CREATE CONSTRAINT TRIGGER name AFTER triggerevents ON qualified_name optconstrfromtable? constraintattributespec FOR EACH ROW triggerwhen? EXECUTE function_or_procedure func_name OPEN_PAREN triggerfuncargs CLOSE_PAREN + ; + +triggeractiontime + : BEFORE + | AFTER + | INSTEAD OF + ; + +triggerevents + : triggeroneevent (OR triggeroneevent)* + ; + +triggeroneevent + : INSERT + | DELETE_P + | UPDATE + | UPDATE OF columnlist + | TRUNCATE + ; + +triggerreferencing + : REFERENCING triggertransitions + ; + +triggertransitions + : triggertransition+ + ; + +triggertransition + : transitionoldornew transitionrowortable opt_as? transitionrelname + ; + +transitionoldornew + : NEW + | OLD + ; + +transitionrowortable + : TABLE + | ROW + ; + +transitionrelname + : colid + ; + +triggerforspec + : FOR triggerforopteach? triggerfortype + ; + +triggerforopteach + : EACH + ; + +triggerfortype + : ROW + | STATEMENT + ; + +triggerwhen + : WHEN OPEN_PAREN a_expr CLOSE_PAREN + ; + +function_or_procedure + : FUNCTION + | PROCEDURE + ; + +triggerfuncargs + : (triggerfuncarg |) (COMMA triggerfuncarg)* + ; + +triggerfuncarg + : iconst + | fconst + | sconst + | collabel + ; + +optconstrfromtable + : FROM qualified_name + ; + +constraintattributespec + : constraintattributeElem* + ; + +constraintattributeElem + : NOT DEFERRABLE + | DEFERRABLE + | INITIALLY IMMEDIATE + | INITIALLY DEFERRED + | NOT VALID + | NO INHERIT + ; + +createeventtrigstmt + : CREATE EVENT TRIGGER name ON collabel EXECUTE function_or_procedure func_name OPEN_PAREN CLOSE_PAREN + | CREATE EVENT TRIGGER name ON collabel WHEN event_trigger_when_list EXECUTE function_or_procedure func_name OPEN_PAREN CLOSE_PAREN + ; + +event_trigger_when_list + : event_trigger_when_item (AND event_trigger_when_item)* + ; + +event_trigger_when_item + : colid IN_P OPEN_PAREN event_trigger_value_list CLOSE_PAREN + ; + +event_trigger_value_list + : sconst (COMMA sconst)* + ; + +altereventtrigstmt + : ALTER EVENT TRIGGER name enable_trigger + ; + +enable_trigger + : ENABLE_P + | ENABLE_P REPLICA + | ENABLE_P ALWAYS + | DISABLE_P + ; + +createassertionstmt + : CREATE ASSERTION any_name CHECK OPEN_PAREN a_expr CLOSE_PAREN constraintattributespec + ; + +definestmt + : CREATE opt_or_replace? AGGREGATE func_name aggr_args definition + | CREATE opt_or_replace? AGGREGATE func_name old_aggr_definition + | CREATE OPERATOR any_operator definition + | CREATE TYPE_P any_name definition + | CREATE TYPE_P any_name + | CREATE TYPE_P any_name AS OPEN_PAREN opttablefuncelementlist? CLOSE_PAREN + | CREATE TYPE_P any_name AS ENUM_P OPEN_PAREN opt_enum_val_list? CLOSE_PAREN + | CREATE TYPE_P any_name AS RANGE definition + | CREATE TEXT_P SEARCH PARSER any_name definition + | CREATE TEXT_P SEARCH DICTIONARY any_name definition + | CREATE TEXT_P SEARCH TEMPLATE any_name definition + | CREATE TEXT_P SEARCH CONFIGURATION any_name definition + | CREATE COLLATION any_name definition + | CREATE COLLATION IF_P NOT EXISTS any_name definition + | CREATE COLLATION any_name FROM any_name + | CREATE COLLATION IF_P NOT EXISTS any_name FROM any_name + ; + +definition + : OPEN_PAREN def_list CLOSE_PAREN + ; + +def_list + : def_elem (COMMA def_elem)* + ; + +def_elem + : collabel (EQUAL def_arg)? + ; + +def_arg + : func_type + | reserved_keyword + | qual_all_op + | numericonly + | sconst + | NONE + ; + +old_aggr_definition + : OPEN_PAREN old_aggr_list CLOSE_PAREN + ; + +old_aggr_list + : old_aggr_elem (COMMA old_aggr_elem)* + ; + +old_aggr_elem + : identifier EQUAL def_arg + ; + +opt_enum_val_list + : enum_val_list + ; + +enum_val_list + : sconst (COMMA sconst)* + ; + +alterenumstmt + : ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists? sconst + | ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists? sconst BEFORE sconst + | ALTER TYPE_P any_name ADD_P VALUE_P opt_if_not_exists? sconst AFTER sconst + | ALTER TYPE_P any_name RENAME VALUE_P sconst TO sconst + ; + +opt_if_not_exists + : IF_P NOT EXISTS + ; + +createopclassstmt + : CREATE OPERATOR CLASS any_name opt_default? FOR TYPE_P typename USING name opt_opfamily? AS opclass_item_list + ; + +opclass_item_list + : opclass_item (COMMA opclass_item)* + ; + +opclass_item + : OPERATOR iconst any_operator opclass_purpose? opt_recheck? + | OPERATOR iconst operator_with_argtypes opclass_purpose? opt_recheck? + | FUNCTION iconst function_with_argtypes + | FUNCTION iconst OPEN_PAREN type_list CLOSE_PAREN function_with_argtypes + | STORAGE typename + ; + +opt_default + : DEFAULT + ; + +opt_opfamily + : FAMILY any_name + ; + +opclass_purpose + : FOR SEARCH + | FOR ORDER BY any_name + ; + +opt_recheck + : RECHECK + ; + +createopfamilystmt + : CREATE OPERATOR FAMILY any_name USING name + ; + +alteropfamilystmt + : ALTER OPERATOR FAMILY any_name USING name ADD_P opclass_item_list + | ALTER OPERATOR FAMILY any_name USING name DROP opclass_drop_list + ; + +opclass_drop_list + : opclass_drop (COMMA opclass_drop)* + ; + +opclass_drop + : OPERATOR iconst OPEN_PAREN type_list CLOSE_PAREN + | FUNCTION iconst OPEN_PAREN type_list CLOSE_PAREN + ; + +dropopclassstmt + : DROP OPERATOR CLASS any_name USING name opt_drop_behavior? + | DROP OPERATOR CLASS IF_P EXISTS any_name USING name opt_drop_behavior? + ; + +dropopfamilystmt + : DROP OPERATOR FAMILY any_name USING name opt_drop_behavior? + | DROP OPERATOR FAMILY IF_P EXISTS any_name USING name opt_drop_behavior? + ; + +dropownedstmt + : DROP OWNED BY role_list opt_drop_behavior? + ; + +reassignownedstmt + : REASSIGN OWNED BY role_list TO rolespec + ; + +dropstmt + : DROP object_type_any_name IF_P EXISTS any_name_list opt_drop_behavior? + | DROP object_type_any_name any_name_list opt_drop_behavior? + | DROP drop_type_name IF_P EXISTS name_list opt_drop_behavior? + | DROP drop_type_name name_list opt_drop_behavior? + | DROP object_type_name_on_any_name name ON any_name opt_drop_behavior? + | DROP object_type_name_on_any_name IF_P EXISTS name ON any_name opt_drop_behavior? + | DROP TYPE_P type_name_list opt_drop_behavior? + | DROP TYPE_P IF_P EXISTS type_name_list opt_drop_behavior? + | DROP DOMAIN_P type_name_list opt_drop_behavior? + | DROP DOMAIN_P IF_P EXISTS type_name_list opt_drop_behavior? + | DROP INDEX CONCURRENTLY any_name_list opt_drop_behavior? + | DROP INDEX CONCURRENTLY IF_P EXISTS any_name_list opt_drop_behavior? + ; + +object_type_any_name + : TABLE + | SEQUENCE + | VIEW + | MATERIALIZED VIEW + | INDEX + | FOREIGN TABLE + | COLLATION + | CONVERSION_P + | STATISTICS + | TEXT_P SEARCH PARSER + | TEXT_P SEARCH DICTIONARY + | TEXT_P SEARCH TEMPLATE + | TEXT_P SEARCH CONFIGURATION + ; + +object_type_name + : drop_type_name + | DATABASE + | ROLE + | SUBSCRIPTION + | TABLESPACE + ; + +drop_type_name + : ACCESS METHOD + | EVENT TRIGGER + | EXTENSION + | FOREIGN DATA_P WRAPPER + | opt_procedural? LANGUAGE + | PUBLICATION + | SCHEMA + | SERVER + ; + +object_type_name_on_any_name + : POLICY + | RULE + | TRIGGER + ; + +any_name_list + : any_name (COMMA any_name)* + ; + +any_name + : colid attrs? + ; + +attrs + :(DOT attr_name)+ + ; + +type_name_list + : typename (COMMA typename)* + ; + +truncatestmt + : TRUNCATE opt_table? relation_expr_list opt_restart_seqs? opt_drop_behavior? + ; + +opt_restart_seqs + : CONTINUE_P IDENTITY_P + | RESTART IDENTITY_P + ; + +commentstmt + : COMMENT ON object_type_any_name any_name IS comment_text + | COMMENT ON COLUMN any_name IS comment_text + | COMMENT ON object_type_name name IS comment_text + | COMMENT ON TYPE_P typename IS comment_text + | COMMENT ON DOMAIN_P typename IS comment_text + | COMMENT ON AGGREGATE aggregate_with_argtypes IS comment_text + | COMMENT ON FUNCTION function_with_argtypes IS comment_text + | COMMENT ON OPERATOR operator_with_argtypes IS comment_text + | COMMENT ON CONSTRAINT name ON any_name IS comment_text + | COMMENT ON CONSTRAINT name ON DOMAIN_P any_name IS comment_text + | COMMENT ON object_type_name_on_any_name name ON any_name IS comment_text + | COMMENT ON PROCEDURE function_with_argtypes IS comment_text + | COMMENT ON ROUTINE function_with_argtypes IS comment_text + | COMMENT ON TRANSFORM FOR typename LANGUAGE name IS comment_text + | COMMENT ON OPERATOR CLASS any_name USING name IS comment_text + | COMMENT ON OPERATOR FAMILY any_name USING name IS comment_text + | COMMENT ON LARGE_P OBJECT_P numericonly IS comment_text + | COMMENT ON CAST OPEN_PAREN typename AS typename CLOSE_PAREN IS comment_text + ; + +comment_text + : sconst + | NULL_P + ; + +seclabelstmt + : SECURITY LABEL opt_provider? ON object_type_any_name any_name IS security_label + | SECURITY LABEL opt_provider? ON COLUMN any_name IS security_label + | SECURITY LABEL opt_provider? ON object_type_name name IS security_label + | SECURITY LABEL opt_provider? ON TYPE_P typename IS security_label + | SECURITY LABEL opt_provider? ON DOMAIN_P typename IS security_label + | SECURITY LABEL opt_provider? ON AGGREGATE aggregate_with_argtypes IS security_label + | SECURITY LABEL opt_provider? ON FUNCTION function_with_argtypes IS security_label + | SECURITY LABEL opt_provider? ON LARGE_P OBJECT_P numericonly IS security_label + | SECURITY LABEL opt_provider? ON PROCEDURE function_with_argtypes IS security_label + | SECURITY LABEL opt_provider? ON ROUTINE function_with_argtypes IS security_label + ; + +opt_provider + : FOR nonreservedword_or_sconst + ; + +security_label + : sconst + | NULL_P + ; + +fetchstmt + : FETCH fetch_args + | MOVE fetch_args + ; + +fetch_args + : cursor_name + | from_in cursor_name + | NEXT opt_from_in? cursor_name + | PRIOR opt_from_in? cursor_name + | FIRST_P opt_from_in? cursor_name + | LAST_P opt_from_in? cursor_name + | ABSOLUTE_P signediconst opt_from_in? cursor_name + | RELATIVE_P signediconst opt_from_in? cursor_name + | signediconst opt_from_in? cursor_name + | ALL opt_from_in? cursor_name + | FORWARD opt_from_in? cursor_name + | FORWARD signediconst opt_from_in? cursor_name + | FORWARD ALL opt_from_in? cursor_name + | BACKWARD opt_from_in? cursor_name + | BACKWARD signediconst opt_from_in? cursor_name + | BACKWARD ALL opt_from_in? cursor_name + ; + +from_in + : FROM + | IN_P + ; + +opt_from_in + : from_in + ; + +grantstmt + : GRANT privileges ON privilege_target TO grantee_list opt_grant_grant_option? + ; + +revokestmt + : REVOKE privileges ON privilege_target FROM grantee_list opt_drop_behavior? + | REVOKE GRANT OPTION FOR privileges ON privilege_target FROM grantee_list opt_drop_behavior? + ; + +privileges + : privilege_list + | ALL + | ALL PRIVILEGES + | ALL OPEN_PAREN columnlist CLOSE_PAREN + | ALL PRIVILEGES OPEN_PAREN columnlist CLOSE_PAREN + ; + +privilege_list + : privilege (COMMA privilege)* + ; + +privilege + : SELECT opt_column_list? + | REFERENCES opt_column_list? + | CREATE opt_column_list? + | ALTER SYSTEM_P + | colid opt_column_list? + ; + +privilege_target + : qualified_name_list + | TABLE qualified_name_list + | SEQUENCE qualified_name_list + | FOREIGN DATA_P WRAPPER name_list + | FOREIGN SERVER name_list + | FUNCTION function_with_argtypes_list + | PROCEDURE function_with_argtypes_list + | ROUTINE function_with_argtypes_list + | DATABASE name_list + | DOMAIN_P any_name_list + | LANGUAGE name_list + | LARGE_P OBJECT_P numericonly_list + | PARAMETER parameter_name_list + | SCHEMA name_list + | TABLESPACE name_list + | TYPE_P any_name_list + | ALL TABLES IN_P SCHEMA name_list + | ALL SEQUENCES IN_P SCHEMA name_list + | ALL FUNCTIONS IN_P SCHEMA name_list + | ALL PROCEDURES IN_P SCHEMA name_list + | ALL ROUTINES IN_P SCHEMA name_list + ; + +parameter_name_list + : parameter_name (COMMA parameter_name)* + ; + +parameter_name + : colid (DOT colid)? + ; + +grantee_list + : grantee (COMMA grantee)* + ; + +grantee + : rolespec + | GROUP_P rolespec + ; + +opt_grant_grant_option + : WITH GRANT OPTION + ; + +grantrolestmt + : GRANT privilege_list TO role_list opt_grant_admin_option? opt_granted_by? + ; + +revokerolestmt + : REVOKE privilege_list FROM role_list opt_granted_by? opt_drop_behavior? + | REVOKE ADMIN OPTION FOR privilege_list FROM role_list opt_granted_by? opt_drop_behavior? + ; + +opt_grant_admin_option + : WITH ADMIN OPTION + ; + +opt_granted_by + : GRANTED BY rolespec + ; + +alterdefaultprivilegesstmt + : ALTER DEFAULT PRIVILEGES defacloptionlist defaclaction + ; + +defacloptionlist + : defacloption* + ; + +defacloption + : IN_P SCHEMA name_list + | FOR ROLE role_list + | FOR USER role_list + ; + +defaclaction + : GRANT privileges ON defacl_privilege_target TO grantee_list opt_grant_grant_option? + | REVOKE privileges ON defacl_privilege_target FROM grantee_list opt_drop_behavior? + | REVOKE GRANT OPTION FOR privileges ON defacl_privilege_target FROM grantee_list opt_drop_behavior? + ; + +defacl_privilege_target + : TABLES + | FUNCTIONS + | ROUTINES + | SEQUENCES + | TYPES_P + | SCHEMAS + ; + //create index + +indexstmt + : CREATE opt_unique? INDEX opt_concurrently? ((IF_P NOT EXISTS)? name)? ON relation_expr access_method_clause? OPEN_PAREN index_params CLOSE_PAREN opt_include? opt_unique_null_treatment? opt_reloptions? opttablespace? where_clause? + ; + +opt_unique + : UNIQUE + ; + +opt_concurrently + : CONCURRENTLY + ; + +opt_index_name + : name + ; + +access_method_clause + : USING name + ; + +index_params + : index_elem (COMMA index_elem)* + ; + +index_elem_options + : opt_collate? opt_class? opt_asc_desc? opt_nulls_order? + | opt_collate? any_name reloptions opt_asc_desc? opt_nulls_order? + ; + +index_elem + : colid index_elem_options + | func_expr_windowless index_elem_options + | OPEN_PAREN a_expr CLOSE_PAREN index_elem_options + ; + +opt_include + : INCLUDE OPEN_PAREN index_including_params CLOSE_PAREN + ; + +index_including_params + : index_elem (COMMA index_elem)* + ; + +opt_collate + : COLLATE any_name + ; + +opt_class + : any_name + ; + +opt_asc_desc + : ASC + | DESC + ; + //TOD NULLS_LA was used + +opt_nulls_order + : NULLS_P FIRST_P + | NULLS_P LAST_P + ; + +createfunctionstmt + : CREATE opt_or_replace? (FUNCTION | PROCEDURE) func_name func_args_with_defaults + ( + RETURNS (func_return | TABLE OPEN_PAREN table_func_column_list CLOSE_PAREN) + )? + createfunc_opt_list + ; + +opt_or_replace + : OR REPLACE + ; + +func_args + : OPEN_PAREN func_args_list? CLOSE_PAREN + ; + +func_args_list + : func_arg (COMMA func_arg)* + ; + +function_with_argtypes_list + : function_with_argtypes (COMMA function_with_argtypes)* + ; + +function_with_argtypes + : func_name func_args + | type_func_name_keyword + | colid indirection? + ; + +func_args_with_defaults + : OPEN_PAREN func_args_with_defaults_list? CLOSE_PAREN + ; + +func_args_with_defaults_list + : func_arg_with_default (COMMA func_arg_with_default)* + ; + +func_arg + : arg_class param_name? func_type + | param_name arg_class? func_type + | func_type + ; + +arg_class + : IN_P OUT_P? + | OUT_P + | INOUT + | VARIADIC + ; + +param_name + : type_function_name + | builtin_function_name + | LEFT + | RIGHT + ; + +func_return + : func_type + ; + +func_type + : typename + | SETOF? (builtin_function_name | type_function_name | LEFT | RIGHT) attrs PERCENT TYPE_P + ; + +func_arg_with_default + : func_arg ((DEFAULT | EQUAL) a_expr)? + ; + +aggr_arg + : func_arg + ; + +aggr_args + : OPEN_PAREN (STAR | aggr_args_list | ORDER BY aggr_args_list | aggr_args_list ORDER BY aggr_args_list) CLOSE_PAREN + ; + +aggr_args_list + : aggr_arg (COMMA aggr_arg)* + ; + +aggregate_with_argtypes + : func_name aggr_args + ; + +aggregate_with_argtypes_list + : aggregate_with_argtypes (COMMA aggregate_with_argtypes)* + ; + +createfunc_opt_list + : createfunc_opt_item+ + { + p.ParseRoutineBody(localctx); + } + // | createfunc_opt_list createfunc_opt_item + + ; + +common_func_opt_item + : CALLED ON NULL_P INPUT_P + | RETURNS NULL_P ON NULL_P INPUT_P + | STRICT_P + | IMMUTABLE + | STABLE + | VOLATILE + | EXTERNAL SECURITY DEFINER + | EXTERNAL SECURITY INVOKER + | SECURITY DEFINER + | SECURITY INVOKER + | LEAKPROOF + | NOT LEAKPROOF + | COST numericonly + | ROWS numericonly + | SUPPORT any_name + | functionsetresetclause + | PARALLEL colid + ; + +createfunc_opt_item + : AS func_as + | BEGIN_P ATOMIC_P stmtmulti END_P + | LANGUAGE nonreservedword_or_sconst + | TRANSFORM transform_type_list + | WINDOW + | common_func_opt_item + ; + //https://www.postgresql.org/docs/9.1/sql-createfunction.html + + // | AS 'definition' + + // | AS 'obj_file', 'link_symbol' + +func_as locals[antlr.ParserRuleContext Definition] + : + /* |AS 'definition'*/ + def = sconst + /*| AS 'obj_file', 'link_symbol'*/ + | sconst COMMA sconst + ; + +transform_type_list + :FOR TYPE_P typename (COMMA FOR TYPE_P typename)* + ; + +opt_definition + : WITH definition + ; + +table_func_column + : param_name func_type + ; + +table_func_column_list + : table_func_column (COMMA table_func_column)* + ; + +alterfunctionstmt + : ALTER (FUNCTION | PROCEDURE | ROUTINE) function_with_argtypes alterfunc_opt_list opt_restrict? + ; + +alterfunc_opt_list + : common_func_opt_item+ + ; + +opt_restrict + : RESTRICT + ; + +removefuncstmt + : DROP FUNCTION function_with_argtypes_list opt_drop_behavior? + | DROP FUNCTION IF_P EXISTS function_with_argtypes_list opt_drop_behavior? + | DROP PROCEDURE function_with_argtypes_list opt_drop_behavior? + | DROP PROCEDURE IF_P EXISTS function_with_argtypes_list opt_drop_behavior? + | DROP ROUTINE function_with_argtypes_list opt_drop_behavior? + | DROP ROUTINE IF_P EXISTS function_with_argtypes_list opt_drop_behavior? + ; + +removeaggrstmt + : DROP AGGREGATE aggregate_with_argtypes_list opt_drop_behavior? + | DROP AGGREGATE IF_P EXISTS aggregate_with_argtypes_list opt_drop_behavior? + ; + +removeoperstmt + : DROP OPERATOR operator_with_argtypes_list opt_drop_behavior? + | DROP OPERATOR IF_P EXISTS operator_with_argtypes_list opt_drop_behavior? + ; + +oper_argtypes + : OPEN_PAREN typename CLOSE_PAREN + | OPEN_PAREN typename COMMA typename CLOSE_PAREN + | OPEN_PAREN NONE COMMA typename CLOSE_PAREN + | OPEN_PAREN typename COMMA NONE CLOSE_PAREN + ; + +any_operator + : (colid DOT)* all_op + ; + +operator_with_argtypes_list + : operator_with_argtypes (COMMA operator_with_argtypes)* + ; + +operator_with_argtypes + : any_operator oper_argtypes + ; + +dostmt + : DO dostmt_opt_list + ; + +dostmt_opt_list + : dostmt_opt_item+ + ; + +dostmt_opt_item + : sconst + | LANGUAGE nonreservedword_or_sconst + ; + +createcaststmt + : CREATE CAST OPEN_PAREN typename AS typename CLOSE_PAREN WITH FUNCTION function_with_argtypes cast_context? + | CREATE CAST OPEN_PAREN typename AS typename CLOSE_PAREN WITHOUT FUNCTION cast_context? + | CREATE CAST OPEN_PAREN typename AS typename CLOSE_PAREN WITH INOUT cast_context? + ; + +cast_context + : AS IMPLICIT_P + | AS ASSIGNMENT + ; + +dropcaststmt + : DROP CAST opt_if_exists? OPEN_PAREN typename AS typename CLOSE_PAREN opt_drop_behavior? + ; + +opt_if_exists + : IF_P EXISTS + ; + +createtransformstmt + : CREATE opt_or_replace? TRANSFORM FOR typename LANGUAGE name OPEN_PAREN transform_element_list CLOSE_PAREN + ; + +transform_element_list + : FROM SQL_P WITH FUNCTION function_with_argtypes COMMA TO SQL_P WITH FUNCTION function_with_argtypes + | TO SQL_P WITH FUNCTION function_with_argtypes COMMA FROM SQL_P WITH FUNCTION function_with_argtypes + | FROM SQL_P WITH FUNCTION function_with_argtypes + | TO SQL_P WITH FUNCTION function_with_argtypes + ; + +droptransformstmt + : DROP TRANSFORM opt_if_exists? FOR typename LANGUAGE name opt_drop_behavior? + ; + +reindexstmt + : REINDEX reindex_target_type opt_concurrently? qualified_name + | REINDEX reindex_target_multitable opt_concurrently? name + | REINDEX OPEN_PAREN reindex_option_list CLOSE_PAREN reindex_target_type opt_concurrently? qualified_name + | REINDEX OPEN_PAREN reindex_option_list CLOSE_PAREN reindex_target_multitable opt_concurrently? name + ; + +reindex_target_type + : INDEX + | TABLE + | SCHEMA + | DATABASE + | SYSTEM_P + ; + +reindex_target_multitable + : SCHEMA + | SYSTEM_P + | DATABASE + ; + +reindex_option_list + : reindex_option_elem (COMMA reindex_option_elem)* + ; + +reindex_option_elem + : VERBOSE + | TABLESPACE + | CONCURRENTLY + ; + +altertblspcstmt + : ALTER TABLESPACE name SET reloptions + | ALTER TABLESPACE name RESET reloptions + ; + +renamestmt + : ALTER AGGREGATE aggregate_with_argtypes RENAME TO name + | ALTER COLLATION any_name RENAME TO name + | ALTER CONVERSION_P any_name RENAME TO name + | ALTER DATABASE name RENAME TO name + | ALTER DOMAIN_P any_name RENAME TO name + | ALTER DOMAIN_P any_name RENAME CONSTRAINT name TO name + | ALTER FOREIGN DATA_P WRAPPER name RENAME TO name + | ALTER FUNCTION function_with_argtypes RENAME TO name + | ALTER GROUP_P roleid RENAME TO roleid + | ALTER opt_procedural? LANGUAGE name RENAME TO name + | ALTER OPERATOR CLASS any_name USING name RENAME TO name + | ALTER OPERATOR FAMILY any_name USING name RENAME TO name + | ALTER POLICY name ON qualified_name RENAME TO name + | ALTER POLICY IF_P EXISTS name ON qualified_name RENAME TO name + | ALTER PROCEDURE function_with_argtypes RENAME TO name + | ALTER PUBLICATION name RENAME TO name + | ALTER ROUTINE function_with_argtypes RENAME TO name + | ALTER SCHEMA name RENAME TO name + | ALTER SERVER name RENAME TO name + | ALTER SUBSCRIPTION name RENAME TO name + | ALTER TABLE relation_expr RENAME TO name + | ALTER TABLE IF_P EXISTS relation_expr RENAME TO name + | ALTER SEQUENCE qualified_name RENAME TO name + | ALTER SEQUENCE IF_P EXISTS qualified_name RENAME TO name + | ALTER VIEW qualified_name RENAME TO name + | ALTER VIEW IF_P EXISTS qualified_name RENAME TO name + | ALTER MATERIALIZED VIEW qualified_name RENAME TO name + | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME TO name + | ALTER INDEX qualified_name RENAME TO name + | ALTER INDEX IF_P EXISTS qualified_name RENAME TO name + | ALTER FOREIGN TABLE relation_expr RENAME TO name + | ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME TO name + | ALTER TABLE relation_expr RENAME opt_column? name TO name + | ALTER TABLE IF_P EXISTS relation_expr RENAME opt_column? name TO name + | ALTER VIEW qualified_name RENAME opt_column? name TO name + | ALTER VIEW IF_P EXISTS qualified_name RENAME opt_column? name TO name + | ALTER MATERIALIZED VIEW qualified_name RENAME opt_column? name TO name + | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name RENAME opt_column? name TO name + | ALTER TABLE relation_expr RENAME CONSTRAINT name TO name + | ALTER TABLE IF_P EXISTS relation_expr RENAME CONSTRAINT name TO name + | ALTER FOREIGN TABLE relation_expr RENAME opt_column? name TO name + | ALTER FOREIGN TABLE IF_P EXISTS relation_expr RENAME opt_column? name TO name + | ALTER RULE name ON qualified_name RENAME TO name + | ALTER TRIGGER name ON qualified_name RENAME TO name + | ALTER EVENT TRIGGER name RENAME TO name + | ALTER ROLE roleid RENAME TO roleid + | ALTER USER roleid RENAME TO roleid + | ALTER TABLESPACE name RENAME TO name + | ALTER STATISTICS any_name RENAME TO name + | ALTER TEXT_P SEARCH PARSER any_name RENAME TO name + | ALTER TEXT_P SEARCH DICTIONARY any_name RENAME TO name + | ALTER TEXT_P SEARCH TEMPLATE any_name RENAME TO name + | ALTER TEXT_P SEARCH CONFIGURATION any_name RENAME TO name + | ALTER TYPE_P any_name RENAME TO name + | ALTER TYPE_P any_name RENAME ATTRIBUTE name TO name opt_drop_behavior? + ; + +opt_column + : COLUMN + ; + +opt_set_data + : SET DATA_P + ; + +alterobjectdependsstmt + : ALTER FUNCTION function_with_argtypes opt_no? DEPENDS ON EXTENSION name + | ALTER PROCEDURE function_with_argtypes opt_no? DEPENDS ON EXTENSION name + | ALTER ROUTINE function_with_argtypes opt_no? DEPENDS ON EXTENSION name + | ALTER TRIGGER name ON qualified_name opt_no? DEPENDS ON EXTENSION name + | ALTER MATERIALIZED VIEW qualified_name opt_no? DEPENDS ON EXTENSION name + | ALTER INDEX qualified_name opt_no? DEPENDS ON EXTENSION name + ; + +opt_no + : NO + ; + +alterobjectschemastmt + : ALTER AGGREGATE aggregate_with_argtypes SET SCHEMA name + | ALTER COLLATION any_name SET SCHEMA name + | ALTER CONVERSION_P any_name SET SCHEMA name + | ALTER DOMAIN_P any_name SET SCHEMA name + | ALTER EXTENSION name SET SCHEMA name + | ALTER FUNCTION function_with_argtypes SET SCHEMA name + | ALTER OPERATOR operator_with_argtypes SET SCHEMA name + | ALTER OPERATOR CLASS any_name USING name SET SCHEMA name + | ALTER OPERATOR FAMILY any_name USING name SET SCHEMA name + | ALTER PROCEDURE function_with_argtypes SET SCHEMA name + | ALTER ROUTINE function_with_argtypes SET SCHEMA name + | ALTER TABLE relation_expr SET SCHEMA name + | ALTER TABLE IF_P EXISTS relation_expr SET SCHEMA name + | ALTER STATISTICS any_name SET SCHEMA name + | ALTER TEXT_P SEARCH PARSER any_name SET SCHEMA name + | ALTER TEXT_P SEARCH DICTIONARY any_name SET SCHEMA name + | ALTER TEXT_P SEARCH TEMPLATE any_name SET SCHEMA name + | ALTER TEXT_P SEARCH CONFIGURATION any_name SET SCHEMA name + | ALTER SEQUENCE qualified_name SET SCHEMA name + | ALTER SEQUENCE IF_P EXISTS qualified_name SET SCHEMA name + | ALTER VIEW qualified_name SET SCHEMA name + | ALTER VIEW IF_P EXISTS qualified_name SET SCHEMA name + | ALTER MATERIALIZED VIEW qualified_name SET SCHEMA name + | ALTER MATERIALIZED VIEW IF_P EXISTS qualified_name SET SCHEMA name + | ALTER FOREIGN TABLE relation_expr SET SCHEMA name + | ALTER FOREIGN TABLE IF_P EXISTS relation_expr SET SCHEMA name + | ALTER TYPE_P any_name SET SCHEMA name + ; + +alteroperatorstmt + : ALTER OPERATOR operator_with_argtypes SET OPEN_PAREN operator_def_list CLOSE_PAREN + ; + +operator_def_list + : operator_def_elem (COMMA operator_def_elem)* + ; + +operator_def_elem + : collabel EQUAL NONE + | collabel EQUAL operator_def_arg + ; + +operator_def_arg + : func_type + | reserved_keyword + | qual_all_op + | numericonly + | sconst + ; + +altertypestmt + : ALTER TYPE_P any_name SET OPEN_PAREN operator_def_list CLOSE_PAREN + ; + +alterownerstmt + : ALTER AGGREGATE aggregate_with_argtypes OWNER TO rolespec + | ALTER COLLATION any_name OWNER TO rolespec + | ALTER CONVERSION_P any_name OWNER TO rolespec + | ALTER DATABASE name OWNER TO rolespec + | ALTER DOMAIN_P any_name OWNER TO rolespec + | ALTER FUNCTION function_with_argtypes OWNER TO rolespec + | ALTER opt_procedural? LANGUAGE name OWNER TO rolespec + | ALTER LARGE_P OBJECT_P numericonly OWNER TO rolespec + | ALTER OPERATOR operator_with_argtypes OWNER TO rolespec + | ALTER OPERATOR CLASS any_name USING name OWNER TO rolespec + | ALTER OPERATOR FAMILY any_name USING name OWNER TO rolespec + | ALTER PROCEDURE function_with_argtypes OWNER TO rolespec + | ALTER ROUTINE function_with_argtypes OWNER TO rolespec + | ALTER SCHEMA name OWNER TO rolespec + | ALTER TYPE_P any_name OWNER TO rolespec + | ALTER TABLESPACE name OWNER TO rolespec + | ALTER STATISTICS any_name OWNER TO rolespec + | ALTER TEXT_P SEARCH DICTIONARY any_name OWNER TO rolespec + | ALTER TEXT_P SEARCH CONFIGURATION any_name OWNER TO rolespec + | ALTER FOREIGN DATA_P WRAPPER name OWNER TO rolespec + | ALTER SERVER name OWNER TO rolespec + | ALTER EVENT TRIGGER name OWNER TO rolespec + | ALTER PUBLICATION name OWNER TO rolespec + | ALTER SUBSCRIPTION name OWNER TO rolespec + ; + +createpublicationstmt + : CREATE PUBLICATION name opt_definition? + | CREATE PUBLICATION name FOR ALL TABLES opt_definition? + | CREATE PUBLICATION name FOR pub_obj_list opt_definition? + ; + +pub_obj_list + : publication_obj_spec (COMMA publication_obj_spec)* + ; + +publication_obj_spec + : TABLE relation_expr opt_column_list? opt_where_clause? + | TABLE IN_P SCHEMA (colid | CURRENT_SCHEMA) + | colid opt_column_list? opt_where_clause? + | colid indirection opt_column_list? opt_where_clause? + | relation_expr opt_column_list? opt_where_clause? + | CURRENT_SCHEMA + ; + +opt_where_clause + : WHERE OPEN_PAREN a_expr CLOSE_PAREN + ; + +alterpublicationstmt + : ALTER PUBLICATION name SET definition + | ALTER PUBLICATION name ADD_P pub_obj_list + | ALTER PUBLICATION name SET pub_obj_list + | ALTER PUBLICATION name DROP pub_obj_list + ; + +createsubscriptionstmt + : CREATE SUBSCRIPTION name CONNECTION sconst PUBLICATION publication_name_list opt_definition? + ; + +publication_name_list + : publication_name_item (COMMA publication_name_item)* + ; + +publication_name_item + : collabel + ; + +altersubscriptionstmt + : ALTER SUBSCRIPTION name SET definition + | ALTER SUBSCRIPTION name CONNECTION sconst + | ALTER SUBSCRIPTION name REFRESH PUBLICATION opt_definition? + | ALTER SUBSCRIPTION name SET PUBLICATION publication_name_list opt_definition? + | ALTER SUBSCRIPTION name ENABLE_P + | ALTER SUBSCRIPTION name DISABLE_P + | ALTER SUBSCRIPTION name SKIP_P definition + ; + +dropsubscriptionstmt + : DROP SUBSCRIPTION name opt_drop_behavior? + | DROP SUBSCRIPTION IF_P EXISTS name opt_drop_behavior? + ; + +rulestmt + : CREATE opt_or_replace? RULE name AS ON event TO qualified_name where_clause? DO opt_instead? ruleactionlist + ; + +ruleactionlist + : NOTHING + | ruleactionstmt + | OPEN_PAREN ruleactionmulti CLOSE_PAREN + ; + +ruleactionmulti + : ruleactionstmtOrEmpty? (SEMI ruleactionstmtOrEmpty?)* + ; + +ruleactionstmt + : selectstmt + | insertstmt + | updatestmt + | deletestmt + | notifystmt + ; + +ruleactionstmtOrEmpty + : ruleactionstmt + ; + +event + : SELECT + | UPDATE + | DELETE_P + | INSERT + ; + +opt_instead + : INSTEAD + | ALSO + ; + +notifystmt + : NOTIFY colid notify_payload? + ; + +notify_payload + : COMMA sconst + ; + +listenstmt + : LISTEN colid + ; + +unlistenstmt + : UNLISTEN colid + | UNLISTEN STAR + ; + +transactionstmt + : ABORT_P opt_transaction? opt_transaction_chain? + | BEGIN_P opt_transaction? transaction_mode_list_or_empty? + | START TRANSACTION transaction_mode_list_or_empty? + | COMMIT opt_transaction? opt_transaction_chain? + | END_P opt_transaction? opt_transaction_chain? + | ROLLBACK opt_transaction? opt_transaction_chain? + | SAVEPOINT colid + | RELEASE SAVEPOINT colid + | RELEASE colid + | ROLLBACK opt_transaction? TO SAVEPOINT colid + | ROLLBACK opt_transaction? TO colid + | PREPARE TRANSACTION sconst + | COMMIT PREPARED sconst + | ROLLBACK PREPARED sconst + ; + +opt_transaction + : WORK + | TRANSACTION + ; + +transaction_mode_item + : ISOLATION LEVEL iso_level + | READ ONLY + | READ WRITE + | DEFERRABLE + | NOT DEFERRABLE + ; + +transaction_mode_list + : transaction_mode_item (COMMA? transaction_mode_item)* + ; + +transaction_mode_list_or_empty + : transaction_mode_list + ; + +opt_transaction_chain + : AND NO? CHAIN + ; + +viewstmt + : CREATE (OR REPLACE)? opttemp? + ( + VIEW qualified_name opt_column_list? opt_reloptions? + | RECURSIVE VIEW qualified_name OPEN_PAREN columnlist CLOSE_PAREN opt_reloptions? + ) + AS selectstmt opt_check_option? + ; + +opt_check_option + : WITH (CASCADED | LOCAL)? CHECK OPTION + ; + +loadstmt + : LOAD file_name + ; + +createdbstmt + : CREATE DATABASE name opt_with? createdb_opt_list? + ; + +createdb_opt_list + : createdb_opt_items + ; + +createdb_opt_items + : createdb_opt_item+ + ; + +createdb_opt_item + : createdb_opt_name opt_equal? (signediconst | opt_boolean_or_string | DEFAULT) + ; + +createdb_opt_name + : identifier + | CONNECTION LIMIT + | ENCODING + | LOCATION + | OWNER + | TABLESPACE + | TEMPLATE + ; + +opt_equal + : EQUAL + ; + +alterdatabasestmt + : ALTER DATABASE name (WITH createdb_opt_list? | createdb_opt_list? | SET TABLESPACE name | REFRESH COLLATION VERSION_P) + ; + +alterdatabasesetstmt + : ALTER DATABASE name setresetclause + ; + +dropdbstmt + : DROP DATABASE (IF_P EXISTS)? name (opt_with? OPEN_PAREN drop_option_list CLOSE_PAREN)? + ; + +drop_option_list + : drop_option (COMMA drop_option)* + ; + +drop_option + : FORCE + ; + +altercollationstmt + : ALTER COLLATION any_name REFRESH VERSION_P + ; + +altersystemstmt + : ALTER SYSTEM_P (SET | RESET) generic_set + ; + +createdomainstmt + : CREATE DOMAIN_P any_name opt_as? typename colquallist + ; + +alterdomainstmt + : ALTER DOMAIN_P any_name (alter_column_default | DROP NOT NULL_P | SET NOT NULL_P | ADD_P tableconstraint | DROP CONSTRAINT (IF_P EXISTS)? name opt_drop_behavior? | VALIDATE CONSTRAINT name) + ; + +opt_as + : AS + ; + +altertsdictionarystmt + : ALTER TEXT_P SEARCH DICTIONARY any_name definition + ; + +altertsconfigurationstmt + : ALTER TEXT_P SEARCH CONFIGURATION any_name ADD_P MAPPING FOR name_list any_with any_name_list + | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list any_with any_name_list + | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING REPLACE any_name any_with any_name + | ALTER TEXT_P SEARCH CONFIGURATION any_name ALTER MAPPING FOR name_list REPLACE any_name any_with any_name + | ALTER TEXT_P SEARCH CONFIGURATION any_name DROP MAPPING FOR name_list + | ALTER TEXT_P SEARCH CONFIGURATION any_name DROP MAPPING IF_P EXISTS FOR name_list + ; + +any_with + : WITH + //TODO + + // | WITH_LA + + ; + +createconversionstmt + : CREATE opt_default? CONVERSION_P any_name FOR sconst TO sconst FROM any_name + ; + +clusterstmt + : CLUSTER opt_verbose? qualified_name cluster_index_specification? + | CLUSTER opt_verbose? + | CLUSTER opt_verbose? name ON qualified_name + ; + +cluster_index_specification + : USING name + ; + +vacuumstmt + : VACUUM opt_full? opt_freeze? opt_verbose? opt_analyze? opt_vacuum_relation_list? + | VACUUM OPEN_PAREN vac_analyze_option_list CLOSE_PAREN opt_vacuum_relation_list? + ; + +analyzestmt + : analyze_keyword opt_verbose? opt_vacuum_relation_list? + | analyze_keyword OPEN_PAREN vac_analyze_option_list CLOSE_PAREN opt_vacuum_relation_list? + ; + +vac_analyze_option_list + : vac_analyze_option_elem (COMMA vac_analyze_option_elem)* + ; + +analyze_keyword + : ANALYZE + | ANALYSE + ; + +vac_analyze_option_elem + : vac_analyze_option_name vac_analyze_option_arg? + ; + +vac_analyze_option_name + : nonreservedword + | analyze_keyword + ; + +vac_analyze_option_arg + : opt_boolean_or_string + | numericonly + ; + +opt_analyze + : analyze_keyword + ; + +opt_verbose + : VERBOSE + ; + +opt_full + : FULL + ; + +opt_freeze + : FREEZE + ; + +opt_name_list + : OPEN_PAREN name_list CLOSE_PAREN + ; + +vacuum_relation + : qualified_name opt_name_list? + ; + +vacuum_relation_list + : vacuum_relation (COMMA vacuum_relation)* + ; + +opt_vacuum_relation_list + : vacuum_relation_list + ; + +explainstmt + : EXPLAIN explainablestmt + | EXPLAIN analyze_keyword opt_verbose? explainablestmt + | EXPLAIN VERBOSE explainablestmt + | EXPLAIN OPEN_PAREN explain_option_list CLOSE_PAREN explainablestmt + ; + +explainablestmt + : selectstmt + | insertstmt + | updatestmt + | deletestmt + | declarecursorstmt + | createasstmt + | creatematviewstmt + | refreshmatviewstmt + | executestmt + ; + +explain_option_list + : explain_option_elem (COMMA explain_option_elem)* + ; + +explain_option_elem + : explain_option_name explain_option_arg? + ; + +explain_option_name + : nonreservedword + | analyze_keyword + ; + +explain_option_arg + : opt_boolean_or_string + | numericonly + ; + +preparestmt + : PREPARE name prep_type_clause? AS preparablestmt + ; + +prep_type_clause + : OPEN_PAREN type_list CLOSE_PAREN + ; + +preparablestmt + : selectstmt + | insertstmt + | updatestmt + | deletestmt + | mergestmt + ; + +executestmt + : EXECUTE name execute_param_clause? + | CREATE opttemp? TABLE create_as_target AS EXECUTE name execute_param_clause? opt_with_data? + | CREATE opttemp? TABLE IF_P NOT EXISTS create_as_target AS EXECUTE name execute_param_clause? opt_with_data? + ; + +execute_param_clause + : OPEN_PAREN expr_list CLOSE_PAREN + ; + +deallocatestmt + : DEALLOCATE name + | DEALLOCATE PREPARE name + | DEALLOCATE ALL + | DEALLOCATE PREPARE ALL + ; + +insertstmt + : opt_with_clause? INSERT INTO insert_target insert_rest opt_on_conflict? returning_clause? + ; + +insert_target + : qualified_name (AS colid)? + ; + +insert_rest + : selectstmt + | OVERRIDING override_kind VALUE_P selectstmt + | OPEN_PAREN insert_column_list CLOSE_PAREN (OVERRIDING override_kind VALUE_P)? selectstmt + | DEFAULT VALUES + ; + +override_kind + : USER + | SYSTEM_P + ; + +insert_column_list + : insert_column_item (COMMA insert_column_item)* + ; + +insert_column_item + : colid opt_indirection + ; + +opt_on_conflict + : ON CONFLICT opt_conf_expr? DO (UPDATE SET set_clause_list where_clause? | NOTHING) + ; + +opt_conf_expr + : OPEN_PAREN index_params CLOSE_PAREN where_clause? + | ON CONSTRAINT name + ; + +returning_clause + : RETURNING target_list + ; + +// https://www.postgresql.org/docs/current/sql-merge.html +mergestmt + : with_clause? MERGE INTO ONLY? qualified_name alias_clause? USING (select_with_parens|qualified_name) alias_clause? ON a_expr + (merge_insert_clause merge_update_clause? | merge_update_clause merge_insert_clause?) merge_delete_clause? + ; + +merge_insert_clause + : WHEN NOT MATCHED (AND a_expr)? THEN? INSERT (OPEN_PAREN insert_column_list CLOSE_PAREN)? values_clause + ; + +merge_update_clause + : WHEN MATCHED (AND a_expr)? THEN? UPDATE SET set_clause_list + ; + +merge_delete_clause + : WHEN MATCHED THEN? DELETE_P + ; + +deletestmt + : opt_with_clause? DELETE_P FROM relation_expr_opt_alias using_clause? where_or_current_clause? returning_clause? + ; + +using_clause + : USING from_list + ; + +lockstmt + : LOCK_P opt_table? relation_expr_list opt_lock? opt_nowait? + ; + +opt_lock + : IN_P lock_type MODE + ; + +lock_type + : ACCESS (SHARE | EXCLUSIVE) + | ROW (SHARE | EXCLUSIVE) + | SHARE (UPDATE EXCLUSIVE | ROW EXCLUSIVE)? + | EXCLUSIVE + ; + +opt_nowait + : NOWAIT + ; + +opt_nowait_or_skip + : NOWAIT + | SKIP_P LOCKED + ; + +updatestmt + : opt_with_clause? UPDATE relation_expr_opt_alias SET set_clause_list from_clause? where_or_current_clause? returning_clause? + ; + +set_clause_list + : set_clause (COMMA set_clause)* + ; + +set_clause + : set_target EQUAL a_expr + | OPEN_PAREN set_target_list CLOSE_PAREN EQUAL a_expr + ; + +set_target + : colid opt_indirection + ; + +set_target_list + : set_target (COMMA set_target)* + ; + +declarecursorstmt + : DECLARE cursor_name cursor_options CURSOR opt_hold? FOR selectstmt + ; + +cursor_name + : name + ; + +cursor_options + : (NO SCROLL | SCROLL | BINARY | INSENSITIVE)* + ; + +opt_hold + : WITH HOLD + | WITHOUT HOLD + ; +/* +TODO: why select_with_parens alternative is needed at all? +i guess it because original byson grammar can choose selectstmt(2)->select_with_parens on only OPEN_PARENT/SELECT kewords at the begining of statement; +(select * from tab); +parse can go through selectstmt( )->select_no_parens(1)->select_clause(2)->select_with_parens(1)->select_no_parens(1)->select_clause(1)->simple_select +instead of selectstmt(1)->select_no_parens(1)->select_clause(2)->select_with_parens(1)->select_no_parens(1)->select_clause(1)->simple_select +all standard tests passed on both variants +*/ + + +selectstmt + : select_no_parens + | select_with_parens + ; + +select_with_parens + : OPEN_PAREN select_no_parens CLOSE_PAREN + | OPEN_PAREN select_with_parens CLOSE_PAREN + ; + +select_no_parens + : select_clause opt_sort_clause? (for_locking_clause opt_select_limit? | select_limit opt_for_locking_clause?)? + | with_clause select_clause opt_sort_clause? (for_locking_clause opt_select_limit? | select_limit opt_for_locking_clause?)? + ; + +select_clause + : simple_select_intersect ((UNION | EXCEPT) all_or_distinct? simple_select_intersect)* + ; + +simple_select_intersect + : simple_select_pramary (INTERSECT all_or_distinct? simple_select_pramary)* + ; + +simple_select_pramary + : ( SELECT (opt_all_clause? into_clause? opt_target_list? | distinct_clause target_list) + into_clause? + from_clause? + where_clause? + group_clause? + having_clause? + window_clause? + ) + | values_clause + | TABLE relation_expr + | select_with_parens + ; + +with_clause + : WITH RECURSIVE? cte_list + ; + +cte_list + : common_table_expr (COMMA common_table_expr)* + ; + +common_table_expr + : name opt_name_list? AS opt_materialized? OPEN_PAREN preparablestmt CLOSE_PAREN + ; + +opt_materialized + : MATERIALIZED + | NOT MATERIALIZED + ; + +opt_with_clause + : with_clause + ; + +into_clause + : INTO (opt_strict? opttempTableName | into_target) + ; + +opt_strict + : STRICT_P + ; + +opttempTableName + : (LOCAL|GLOBAL)? (TEMPORARY | TEMP) opt_table? qualified_name + | UNLOGGED opt_table? qualified_name + | TABLE qualified_name + | qualified_name + ; + +opt_table + : TABLE + ; + +all_or_distinct + : ALL + | DISTINCT + ; + +distinct_clause + : DISTINCT (ON OPEN_PAREN expr_list CLOSE_PAREN)? + ; + +opt_all_clause + : ALL + ; + +opt_sort_clause + : sort_clause + ; + +sort_clause + : ORDER BY sortby_list + ; + +sortby_list + : sortby (COMMA sortby)* + ; + +sortby + : a_expr (USING qual_all_op | opt_asc_desc?) opt_nulls_order? + ; + +select_limit + : limit_clause offset_clause? + | offset_clause limit_clause? + ; + +opt_select_limit + : select_limit + ; + +limit_clause + : LIMIT select_limit_value (COMMA select_offset_value)? + | FETCH first_or_next (select_fetch_first_value row_or_rows (ONLY | WITH TIES) | row_or_rows (ONLY | WITH TIES)) + ; + +offset_clause + : OFFSET (select_offset_value | select_fetch_first_value row_or_rows) + ; + +select_limit_value + : a_expr + | ALL + ; + +select_offset_value + : a_expr + ; + +select_fetch_first_value + : c_expr + | PLUS i_or_f_const + | MINUS i_or_f_const + ; + +i_or_f_const + : iconst + | fconst + ; + +row_or_rows + : ROW + | ROWS + ; + +first_or_next + : FIRST_P + | NEXT + ; + +group_clause + : GROUP_P BY group_by_list + ; + +group_by_list + : group_by_item (COMMA group_by_item)* + ; + +group_by_item + : a_expr + | empty_grouping_set + | cube_clause + | rollup_clause + | grouping_sets_clause + ; + +empty_grouping_set + : OPEN_PAREN CLOSE_PAREN + ; + +rollup_clause + : ROLLUP OPEN_PAREN expr_list CLOSE_PAREN + ; + +cube_clause + : CUBE OPEN_PAREN expr_list CLOSE_PAREN + ; + +grouping_sets_clause + : GROUPING SETS OPEN_PAREN group_by_list CLOSE_PAREN + ; + +having_clause + : HAVING a_expr + ; + +for_locking_clause + : for_locking_items + | FOR READ ONLY + ; + +opt_for_locking_clause + : for_locking_clause + ; + +for_locking_items + : for_locking_item+ + ; + +for_locking_item + : for_locking_strength locked_rels_list? opt_nowait_or_skip? + ; + +for_locking_strength + : FOR ((NO KEY)? UPDATE | KEY? SHARE) + ; + +locked_rels_list + : OF qualified_name_list + ; + +values_clause + : VALUES OPEN_PAREN expr_list CLOSE_PAREN (COMMA OPEN_PAREN expr_list CLOSE_PAREN)* + ; + +from_clause + : FROM from_list + ; + +from_list + : table_ref (COMMA table_ref)* + ; + +table_ref + : (relation_expr opt_alias_clause? tablesample_clause? + | func_table func_alias_clause? + | xmltable opt_alias_clause? + | select_with_parens opt_alias_clause? + | LATERAL_P ( + xmltable opt_alias_clause? + | func_table func_alias_clause? + | select_with_parens opt_alias_clause? + ) + | OPEN_PAREN table_ref ( + CROSS JOIN table_ref + | NATURAL join_type? JOIN table_ref + | join_type? JOIN table_ref join_qual + )? CLOSE_PAREN opt_alias_clause? + ) + joined_table* + ; + +joined_table + : join_type? JOIN table_ref join_qual + | CROSS JOIN table_ref + | NATURAL join_type? JOIN table_ref + ; + +alias_clause + : AS? colid (OPEN_PAREN name_list CLOSE_PAREN)? + ; + +opt_alias_clause + : table_alias_clause + ; + +table_alias_clause + : AS? table_alias (OPEN_PAREN name_list CLOSE_PAREN)? + ; + +func_alias_clause + : alias_clause + | (AS colid? | colid) OPEN_PAREN tablefuncelementlist CLOSE_PAREN + ; + +join_type + : (FULL | LEFT | RIGHT | INNER_P) OUTER_P? + ; + +join_qual + : USING OPEN_PAREN name_list CLOSE_PAREN + | ON a_expr + ; + +relation_expr + : qualified_name STAR? + | ONLY (qualified_name | OPEN_PAREN qualified_name CLOSE_PAREN) + ; + +relation_expr_list + : relation_expr (COMMA relation_expr)* + ; + +relation_expr_opt_alias + : relation_expr (AS? colid)? + ; + +tablesample_clause + : TABLESAMPLE func_name OPEN_PAREN expr_list CLOSE_PAREN opt_repeatable_clause? + ; + +opt_repeatable_clause + : REPEATABLE OPEN_PAREN a_expr CLOSE_PAREN + ; + +func_table + : func_expr_windowless opt_ordinality? + | ROWS FROM OPEN_PAREN rowsfrom_list CLOSE_PAREN opt_ordinality? + ; + +rowsfrom_item + : func_expr_windowless opt_col_def_list? + ; + +rowsfrom_list + : rowsfrom_item (COMMA rowsfrom_item)* + ; + +opt_col_def_list + : AS OPEN_PAREN tablefuncelementlist CLOSE_PAREN + ; + //TODO WITH_LA was used + +opt_ordinality + : WITH ORDINALITY + ; + +where_clause + : WHERE a_expr + ; + +where_or_current_clause + : WHERE (CURRENT_P OF cursor_name | a_expr) + ; + +opttablefuncelementlist + : tablefuncelementlist + ; + +tablefuncelementlist + : tablefuncelement (COMMA tablefuncelement)* + ; + +tablefuncelement + : colid typename opt_collate_clause? + ; + +xmltable + : XMLTABLE OPEN_PAREN (c_expr xmlexists_argument COLUMNS xmltable_column_list | XMLNAMESPACES OPEN_PAREN xml_namespace_list CLOSE_PAREN COMMA c_expr xmlexists_argument COLUMNS xmltable_column_list) CLOSE_PAREN + ; + +xmltable_column_list + : xmltable_column_el (COMMA xmltable_column_el)* + ; + +xmltable_column_el + : colid (typename xmltable_column_option_list? | FOR ORDINALITY) + ; + +xmltable_column_option_list + : xmltable_column_option_el+ + ; + +xmltable_column_option_el + : DEFAULT a_expr + | identifier a_expr + | NOT NULL_P + | NULL_P + ; + +xml_namespace_list + : xml_namespace_el (COMMA xml_namespace_el)* + ; + +xml_namespace_el + : b_expr AS collabel + | DEFAULT b_expr + ; + +typename + : SETOF? simpletypename (opt_array_bounds | ARRAY (OPEN_BRACKET iconst CLOSE_BRACKET)?) + | qualified_name PERCENT (ROWTYPE | TYPE_P) + ; + +opt_array_bounds + : (OPEN_BRACKET iconst? CLOSE_BRACKET)* + ; + +simpletypename + : generictype + | numeric + | bit + | character + | constdatetime + | constinterval (opt_interval? | OPEN_PAREN iconst CLOSE_PAREN) + ; + +consttypename + : numeric + | constbit + | constcharacter + | constdatetime + ; + +generictype + : (builtin_function_name | type_function_name | LEFT | RIGHT) attrs? opt_type_modifiers? + ; + +opt_type_modifiers + : OPEN_PAREN expr_list CLOSE_PAREN + ; + +numeric + : INT_P + | INTEGER + | SMALLINT + | BIGINT + | REAL + | FLOAT_P opt_float? + | DOUBLE_P PRECISION + | DECIMAL_P opt_type_modifiers? + | DEC opt_type_modifiers? + | NUMERIC opt_type_modifiers? + | BOOLEAN_P + ; + +opt_float + : OPEN_PAREN iconst CLOSE_PAREN + ; + //todo: merge alts + +bit + : bitwithlength + | bitwithoutlength + ; + +constbit + : bitwithlength + | bitwithoutlength + ; + +bitwithlength + : BIT opt_varying? OPEN_PAREN expr_list CLOSE_PAREN + ; + +bitwithoutlength + : BIT opt_varying? + ; + +character + : character_c (OPEN_PAREN iconst CLOSE_PAREN)? + ; + +constcharacter + : character_c (OPEN_PAREN iconst CLOSE_PAREN)? + ; + +character_c + : (CHARACTER | CHAR_P | NCHAR) opt_varying? + | VARCHAR + | NATIONAL (CHARACTER | CHAR_P) opt_varying? + ; + +opt_varying + : VARYING + ; + +constdatetime + : (TIMESTAMP | TIME) (OPEN_PAREN iconst CLOSE_PAREN)? opt_timezone? + ; + +constinterval + : INTERVAL + ; + //TODO with_la was used + +opt_timezone + : WITH TIME ZONE + | WITHOUT TIME ZONE + ; + +opt_interval + : YEAR_P + | MONTH_P + | DAY_P + | HOUR_P + | MINUTE_P + | interval_second + | YEAR_P TO MONTH_P + | DAY_P TO (HOUR_P | MINUTE_P | interval_second) + | HOUR_P TO (MINUTE_P | interval_second) + | MINUTE_P TO interval_second + ; + +interval_second + : SECOND_P (OPEN_PAREN iconst CLOSE_PAREN)? + ; + +opt_escape + : ESCAPE a_expr + ; + //precendence accroding to Table 4.2. Operator Precedence (highest to lowest) + + //https://www.postgresql.org/docs/12/sql-syntax-lexical.html#SQL-PRECEDENCE + +/* +original version of a_expr, for info + a_expr: c_expr + //:: left PostgreSQL-style typecast + | a_expr TYPECAST typename -- 1 + | a_expr COLLATE any_name -- 2 + | a_expr AT TIME ZONE a_expr-- 3 + //right unary plus, unary minus + | (PLUS| MINUS) a_expr -- 4 + //left exponentiation + | a_expr CARET a_expr -- 5 + //left multiplication, division, modulo + | a_expr (STAR | SLASH | PERCENT) a_expr -- 6 + //left addition, subtraction + | a_expr (PLUS | MINUS) a_expr -- 7 + //left all other native and user-defined operators + | a_expr qual_op a_expr -- 8 + | qual_op a_expr -- 9 + //range containment, set membership, string matching BETWEEN IN LIKE ILIKE SIMILAR + | a_expr NOT? (LIKE|ILIKE|SIMILAR TO|(BETWEEN SYMMETRIC?)) a_expr opt_escape -- 10 + //< > = <= >= <> comparison operators + | a_expr (LT | GT | EQUAL | LESS_EQUALS | GREATER_EQUALS | NOT_EQUALS) a_expr -- 11 + //IS ISNULL NOTNULL IS TRUE, IS FALSE, IS NULL, IS DISTINCT FROM, etc + | a_expr IS NOT? + ( + NULL_P + |TRUE_P + |FALSE_P + |UNKNOWN + |DISTINCT FROM a_expr + |OF OPEN_PAREN type_list CLOSE_PAREN + |DOCUMENT_P + |unicode_normal_form? NORMALIZED + ) -- 12 + | a_expr (ISNULL|NOTNULL) -- 13 + | row OVERLAPS row -- 14 + //NOT right logical negation + | NOT a_expr -- 15 + //AND left logical conjunction + | a_expr AND a_expr -- 16 + //OR left logical disjunction + | a_expr OR a_expr -- 17 + | a_expr (LESS_LESS|GREATER_GREATER) a_expr -- 18 + | a_expr qual_op -- 19 + | a_expr NOT? IN_P in_expr -- 20 + | a_expr subquery_Op sub_type (select_with_parens|OPEN_PAREN a_expr CLOSE_PAREN) -- 21 + | UNIQUE select_with_parens -- 22 + | DEFAULT -- 23 +; +*/ + + +a_expr + : a_expr_qual + ; +/*23*/ + + +/*moved to c_expr*/ + + +/*22*/ + + +/*moved to c_expr*/ + + +/*19*/ + + +a_expr_qual + : a_expr_lessless qual_op? + ; +/*18*/ + + +a_expr_lessless + : a_expr_or ((LESS_LESS | GREATER_GREATER) a_expr_or)* + ; +/*17*/ + + +a_expr_or + : a_expr_and (OR a_expr_and)* + ; +/*16*/ + +a_expr_and + : a_expr_between (AND a_expr_between)* + ; +/*21*/ + +a_expr_between + : a_expr_in (NOT? BETWEEN SYMMETRIC? a_expr_in AND a_expr_in)? + ; +/*20*/ + + +a_expr_in + : a_expr_unary_not (NOT? IN_P in_expr)? + ; +/*15*/ + + +a_expr_unary_not + : NOT? a_expr_isnull + ; +/*14*/ + + +/*moved to c_expr*/ + + +/*13*/ + + +a_expr_isnull + : a_expr_is_not (ISNULL | NOTNULL)? + ; +/*12*/ + + +a_expr_is_not + : a_expr_compare (IS NOT? (NULL_P | TRUE_P | FALSE_P | UNKNOWN | DISTINCT FROM a_expr | OF OPEN_PAREN type_list CLOSE_PAREN | DOCUMENT_P | unicode_normal_form? NORMALIZED))? + ; +/*11*/ + + +a_expr_compare + : a_expr_like ((LT | GT | EQUAL | LESS_EQUALS | GREATER_EQUALS | NOT_EQUALS) a_expr_like |subquery_Op sub_type (select_with_parens | OPEN_PAREN a_expr CLOSE_PAREN) /*21*/ + + )? + ; +/*10*/ + + +a_expr_like + : a_expr_qual_op (NOT? (LIKE | ILIKE | SIMILAR TO) a_expr_qual_op opt_escape?)? + ; +/* 8*/ + + +a_expr_qual_op + : a_expr_unary_qualop (qual_op a_expr_unary_qualop)* + ; +/* 9*/ + + +a_expr_unary_qualop + : qual_op? a_expr_add + ; +/* 7*/ + + +a_expr_add + : a_expr_mul ((MINUS | PLUS) a_expr_mul)* + ; +/* 6*/ + + +a_expr_mul + : a_expr_caret ((STAR | SLASH | PERCENT) a_expr_caret)* + ; +/* 5*/ + + +a_expr_caret + : a_expr_unary_sign (CARET a_expr)? + ; +/* 4*/ + + +a_expr_unary_sign + : (MINUS | PLUS)? a_expr_at_time_zone /* */ + + + ; +/* 3*/ + + +a_expr_at_time_zone + : a_expr_collate (AT TIME ZONE a_expr)? + ; +/* 2*/ + + +a_expr_collate + : a_expr_typecast (COLLATE any_name)? + ; +/* 1*/ + + +a_expr_typecast + : c_expr (TYPECAST typename)* + ; + +b_expr + : c_expr + | b_expr TYPECAST typename + //right unary plus, unary minus + | (PLUS | MINUS) b_expr + //^ left exponentiation + | b_expr CARET b_expr + //* / % left multiplication, division, modulo + | b_expr (STAR | SLASH | PERCENT) b_expr + //+ - left addition, subtraction + | b_expr (PLUS | MINUS) b_expr + //(any other operator) left all other native and user-defined operators + | b_expr qual_op b_expr + //< > = <= >= <> comparison operators + | b_expr (LT | GT | EQUAL | LESS_EQUALS | GREATER_EQUALS | NOT_EQUALS) b_expr + | qual_op b_expr + | b_expr qual_op + //S ISNULL NOTNULL IS TRUE, IS FALSE, IS NULL, IS DISTINCT FROM, etc + | b_expr IS NOT? (DISTINCT FROM b_expr | OF OPEN_PAREN type_list CLOSE_PAREN | DOCUMENT_P) + ; + +c_expr + : EXISTS select_with_parens # c_expr_exists + | ARRAY (select_with_parens | array_expr) # c_expr_expr + | PARAM opt_indirection # c_expr_expr + | GROUPING OPEN_PAREN expr_list CLOSE_PAREN # c_expr_expr + | /*22*/ + + UNIQUE select_with_parens # c_expr_expr + | columnref # c_expr_expr + | aexprconst # c_expr_expr + | plsqlvariablename # c_expr_expr + | OPEN_PAREN a_expr_in_parens = a_expr CLOSE_PAREN opt_indirection # c_expr_expr + | case_expr # c_expr_case + | func_expr # c_expr_expr + | select_with_parens indirection? # c_expr_expr + | explicit_row # c_expr_expr + | implicit_row # c_expr_expr + | row OVERLAPS row /* 14*/ + + # c_expr_expr + ; + +plsqlvariablename + : PLSQLVARIABLENAME + ; + +func_application + : func_name OPEN_PAREN (func_arg_list (COMMA VARIADIC func_arg_expr)? opt_sort_clause? | VARIADIC func_arg_expr opt_sort_clause? | (ALL | DISTINCT) func_arg_list opt_sort_clause? | STAR |) CLOSE_PAREN + ; + +func_expr + : func_application within_group_clause? filter_clause? over_clause? + | func_expr_common_subexpr + ; + +func_expr_windowless + : func_application + | func_expr_common_subexpr + ; + +func_expr_common_subexpr + : COLLATION FOR OPEN_PAREN a_expr CLOSE_PAREN + | CURRENT_DATE + | CURRENT_TIME (OPEN_PAREN iconst CLOSE_PAREN)? + | CURRENT_TIMESTAMP (OPEN_PAREN iconst CLOSE_PAREN)? + | LOCALTIME (OPEN_PAREN iconst CLOSE_PAREN)? + | LOCALTIMESTAMP (OPEN_PAREN iconst CLOSE_PAREN)? + | CURRENT_ROLE + | CURRENT_USER + | SESSION_USER + | USER + | CURRENT_CATALOG + | CURRENT_SCHEMA + | CAST OPEN_PAREN a_expr AS typename CLOSE_PAREN + | EXTRACT OPEN_PAREN extract_list? CLOSE_PAREN + | NORMALIZE OPEN_PAREN a_expr (COMMA unicode_normal_form)? CLOSE_PAREN + | OVERLAY OPEN_PAREN overlay_list CLOSE_PAREN + | POSITION OPEN_PAREN position_list? CLOSE_PAREN + | SUBSTRING OPEN_PAREN substr_list CLOSE_PAREN + | TREAT OPEN_PAREN a_expr AS typename CLOSE_PAREN + | TRIM OPEN_PAREN (BOTH | LEADING | TRAILING)? trim_list CLOSE_PAREN + | NULLIF OPEN_PAREN a_expr COMMA a_expr CLOSE_PAREN + | COALESCE OPEN_PAREN expr_list CLOSE_PAREN + | GREATEST OPEN_PAREN expr_list CLOSE_PAREN + | LEAST OPEN_PAREN expr_list CLOSE_PAREN + | XMLCONCAT OPEN_PAREN expr_list CLOSE_PAREN + | XMLELEMENT OPEN_PAREN NAME_P collabel (COMMA (xml_attributes | expr_list))? CLOSE_PAREN + | XMLEXISTS OPEN_PAREN c_expr xmlexists_argument CLOSE_PAREN + | XMLFOREST OPEN_PAREN xml_attribute_list CLOSE_PAREN + | XMLPARSE OPEN_PAREN document_or_content a_expr xml_whitespace_option? CLOSE_PAREN + | XMLPI OPEN_PAREN NAME_P collabel (COMMA a_expr)? CLOSE_PAREN + | XMLROOT OPEN_PAREN XML_P a_expr COMMA xml_root_version opt_xml_root_standalone? CLOSE_PAREN + | XMLSERIALIZE OPEN_PAREN document_or_content a_expr AS simpletypename CLOSE_PAREN + ; + +xml_root_version + : VERSION_P a_expr + | VERSION_P NO VALUE_P + ; + +opt_xml_root_standalone + : COMMA STANDALONE_P YES_P + | COMMA STANDALONE_P NO + | COMMA STANDALONE_P NO VALUE_P + ; + +xml_attributes + : XMLATTRIBUTES OPEN_PAREN xml_attribute_list CLOSE_PAREN + ; + +xml_attribute_list + : xml_attribute_el (COMMA xml_attribute_el)* + ; + +xml_attribute_el + : a_expr (AS collabel)? + ; + +document_or_content + : DOCUMENT_P + | CONTENT_P + ; + +xml_whitespace_option + : PRESERVE WHITESPACE_P + | STRIP_P WHITESPACE_P + ; + +xmlexists_argument + : PASSING c_expr + | PASSING c_expr xml_passing_mech + | PASSING xml_passing_mech c_expr + | PASSING xml_passing_mech c_expr xml_passing_mech + ; + +xml_passing_mech + : BY (REF | VALUE_P) + ; + +within_group_clause + : WITHIN GROUP_P OPEN_PAREN sort_clause CLOSE_PAREN + ; + +filter_clause + : FILTER OPEN_PAREN WHERE a_expr CLOSE_PAREN + ; + +window_clause + : WINDOW window_definition_list + ; + +window_definition_list + : window_definition (COMMA window_definition)* + ; + +window_definition + : colid AS window_specification + ; + +over_clause + : OVER (window_specification | colid) + ; + +window_specification + : OPEN_PAREN opt_existing_window_name? opt_partition_clause? opt_sort_clause? opt_frame_clause? CLOSE_PAREN + ; + +opt_existing_window_name + : colid + ; + +opt_partition_clause + : PARTITION BY expr_list + ; + +opt_frame_clause + : RANGE frame_extent opt_window_exclusion_clause? + | ROWS frame_extent opt_window_exclusion_clause? + | GROUPS frame_extent opt_window_exclusion_clause? + ; + +frame_extent + : frame_bound + | BETWEEN frame_bound AND frame_bound + ; + +frame_bound + : UNBOUNDED (PRECEDING | FOLLOWING) + | CURRENT_P ROW + | a_expr (PRECEDING | FOLLOWING) + ; + +opt_window_exclusion_clause + : EXCLUDE (CURRENT_P ROW | GROUP_P | TIES | NO OTHERS) + ; + +row + : ROW OPEN_PAREN expr_list? CLOSE_PAREN + | OPEN_PAREN expr_list COMMA a_expr CLOSE_PAREN + ; + +explicit_row + : ROW OPEN_PAREN expr_list? CLOSE_PAREN + ; +/* +TODO: +for some reason v1 +implicit_row: OPEN_PAREN expr_list COMMA a_expr CLOSE_PAREN; +works better than v2 +implicit_row: OPEN_PAREN expr_list CLOSE_PAREN; +while looks like they are almost the same, except v2 requieres at least 2 items in list +while v1 allows single item in list +*/ + + +implicit_row + : OPEN_PAREN expr_list COMMA a_expr CLOSE_PAREN + ; + +sub_type + : ANY + | SOME + | ALL + ; + +all_op + : Operator + | mathop + ; + +mathop + : PLUS + | MINUS + | STAR + | SLASH + | PERCENT + | CARET + | LT + | GT + | EQUAL + | LESS_EQUALS + | GREATER_EQUALS + | NOT_EQUALS + ; + +qual_op + : Operator + | OPERATOR OPEN_PAREN any_operator CLOSE_PAREN + ; + +qual_all_op + : all_op + | OPERATOR OPEN_PAREN any_operator CLOSE_PAREN + ; + +subquery_Op + : all_op + | OPERATOR OPEN_PAREN any_operator CLOSE_PAREN + | LIKE + | NOT LIKE + | ILIKE + | NOT ILIKE + ; + +expr_list + : a_expr (COMMA a_expr)* + ; + +func_arg_list + : func_arg_expr (COMMA func_arg_expr)* + ; + +func_arg_expr + : a_expr + | param_name (COLON_EQUALS | EQUALS_GREATER) a_expr + ; + +type_list + : typename (COMMA typename)* + ; + +array_expr + : OPEN_BRACKET (expr_list | array_expr_list)? CLOSE_BRACKET + ; + +array_expr_list + : array_expr (COMMA array_expr)* + ; + +extract_list + : extract_arg FROM a_expr + ; + +extract_arg + : identifier + | YEAR_P + | MONTH_P + | DAY_P + | HOUR_P + | MINUTE_P + | SECOND_P + | sconst + ; + +unicode_normal_form + : NFC + | NFD + | NFKC + | NFKD + ; + +overlay_list + : a_expr PLACING a_expr FROM a_expr (FOR a_expr)? + ; + +position_list + : b_expr IN_P b_expr + ; + +substr_list + : a_expr FROM a_expr FOR a_expr + | a_expr FOR a_expr FROM a_expr + | a_expr FROM a_expr + | a_expr FOR a_expr + | a_expr SIMILAR a_expr ESCAPE a_expr + | expr_list + ; + +trim_list + : a_expr FROM expr_list + | FROM expr_list + | expr_list + ; + +in_expr + : select_with_parens # in_expr_select + | OPEN_PAREN expr_list CLOSE_PAREN # in_expr_list + ; + +case_expr + : CASE case_arg? when_clause_list case_default? END_P + ; + +when_clause_list + : when_clause+ + ; + +when_clause + : WHEN a_expr THEN a_expr + ; + +case_default + : ELSE a_expr + ; + +case_arg + : a_expr + ; + +columnref + : colid indirection? + ; + +indirection_el + : DOT (attr_name | STAR) + | OPEN_BRACKET (a_expr | opt_slice_bound? COLON opt_slice_bound?) CLOSE_BRACKET + ; + +opt_slice_bound + : a_expr + ; + +indirection + : indirection_el+ + ; + +opt_indirection + : indirection_el* + ; + +opt_target_list + : target_list + ; + +target_list + : target_el (COMMA target_el)* + ; + +target_el + : a_expr target_alias? # target_label + | STAR # target_star + ; + +target_alias + : AS collabel + | identifier + ; + +qualified_name_list + : qualified_name (COMMA qualified_name)* + ; + +qualified_name + : colid indirection? + ; + +name_list + : name (COMMA name)* + ; + +name + : colid + ; + +attr_name + : collabel + ; + +file_name + : sconst + ; + +func_name + : builtin_function_name + | type_function_name + | colid indirection + | LEFT + | RIGHT + ; + +aexprconst + : iconst + | fconst + | sconst + | bconst + | xconst + | func_name (sconst | OPEN_PAREN func_arg_list opt_sort_clause? CLOSE_PAREN sconst) + | consttypename sconst + | constinterval (sconst opt_interval? | OPEN_PAREN iconst CLOSE_PAREN sconst) + | TRUE_P + | FALSE_P + | NULL_P + ; + +xconst + : HexadecimalStringConstant + ; + +bconst + : BinaryStringConstant + ; + +fconst + : Numeric + ; + +iconst + : Integral + ; + +sconst + : anysconst opt_uescape? + ; + +anysconst + : StringConstant + | UnicodeEscapeStringConstant + | BeginDollarStringConstant DollarText* EndDollarStringConstant + | EscapeStringConstant + ; + +opt_uescape + : UESCAPE anysconst + ; + +signediconst + : iconst + | PLUS iconst + | MINUS iconst + ; + +roleid + : rolespec + ; + +rolespec + : nonreservedword + | CURRENT_USER + | SESSION_USER + ; + +role_list + : rolespec (COMMA rolespec)* + ; + +colid + : identifier + | unreserved_keyword + | col_name_keyword + | plsql_unreserved_keyword + | LEFT + | RIGHT + ; + +table_alias + : identifier + | unreserved_keyword + | col_name_keyword + | plsql_unreserved_keyword + ; + + +type_function_name + : identifier + | unreserved_keyword + | plsql_unreserved_keyword + | type_func_name_keyword + ; + +nonreservedword + : identifier + | unreserved_keyword + | col_name_keyword + | type_func_name_keyword + ; + +collabel + : identifier + | plsql_unreserved_keyword + | unreserved_keyword + | col_name_keyword + | type_func_name_keyword + | reserved_keyword + ; + +identifier + : Identifier opt_uescape? + | QuotedIdentifier + | UnicodeQuotedIdentifier + | plsqlvariablename + | plsqlidentifier + | plsql_unreserved_keyword + ; + +plsqlidentifier + : PLSQLIDENTIFIER + ; + +unreserved_keyword + : ABORT_P + | ABSOLUTE_P + | ACCESS + | ACTION + | ADD_P + | ADMIN + | AFTER + | AGGREGATE + | ALSO + | ALTER + | ALWAYS + | ASSERTION + | ASSIGNMENT + | AT + | ATOMIC_P + | ATTACH + | ATTRIBUTE + | BACKWARD + | BEFORE + | BEGIN_P + | BY + | CACHE + | CALL + | CALLED + | CASCADE + | CASCADED + | CATALOG + | CHAIN + | CHARACTERISTICS + | CHECKPOINT + | CLASS + | CLOSE + | CLUSTER + | COLUMNS + | COMMENT + | COMMENTS + | COMMIT + | COMMITTED + | CONFIGURATION + | CONFLICT + | CONNECTION + | CONSTRAINTS + | CONTENT_P + | CONTINUE_P + | CONVERSION_P + | COPY + | COST + | CSV + | CUBE + | CURRENT_P + | CURSOR + | CYCLE + | DATA_P + | DATABASE + | DAY_P + | DEALLOCATE + | DECLARE + | DEFAULTS + | DEFERRED + | DEFINER + | DELETE_P + | DELIMITER + | DELIMITERS + | DEPENDS + | DETACH + | DICTIONARY + | DISABLE_P + | DISCARD + | DOCUMENT_P + | DOMAIN_P + | DOUBLE_P + | DROP + | EACH + | ENABLE_P + | ENCODING + | ENCRYPTED + | ENUM_P + | ESCAPE + | EVENT + | EXCLUDE + | EXCLUDING + | EXCLUSIVE + | EXECUTE + | EXPLAIN + | EXPRESSION + | EXTENSION + | EXTERNAL + | FAMILY + | FILTER + | FIRST_P + | FOLLOWING + | FORCE + | FORWARD + | FUNCTION + | FUNCTIONS + | GENERATED + | GLOBAL + | GRANTED + | GROUPS + | HANDLER + | HEADER_P + | HOLD + | HOUR_P + | IDENTITY_P + | IF_P + | IMMEDIATE + | IMMUTABLE + | IMPLICIT_P + | IMPORT_P + | INCLUDE + | INCLUDING + | INCREMENT + | INDEX + | INDEXES + | INHERIT + | INHERITS + | INLINE_P + | INPUT_P + | INSENSITIVE + | INSERT + | INSTEAD + | INVOKER + | ISOLATION + | KEY + | LABEL + | LANGUAGE + | LARGE_P + | LAST_P + | LEAKPROOF + | LEVEL + | LISTEN + | LOAD + | LOCAL + | LOCATION + | LOCK_P + | LOCKED + | LOGGED + | MAPPING + | MATCH + | MATERIALIZED + | MAXVALUE + | METHOD + | MINUTE_P + | MINVALUE + | MODE + | MONTH_P + | MOVE + | NAME_P + | NAMES + | NEW + | NEXT + | NFC + | NFD + | NFKC + | NFKD + | NO + | NORMALIZED + | NOTHING + | NOTIFY + | NOWAIT + | NULLS_P + | OBJECT_P + | OF + | OFF + | OIDS + | OLD + | OPERATOR + | OPTION + | OPTIONS + | ORDINALITY + | OTHERS + | OVER + | OVERRIDING + | OWNED + | OWNER + | PARALLEL + | PARAMETER + | PARSER + | PARTIAL + | PARTITION + | PASSING + | PASSWORD + | PLANS + | POLICY + | PRECEDING + | PREPARE + | PREPARED + | PRESERVE + | PRIOR + | PRIVILEGES + | PROCEDURAL + | PROCEDURE + | PROCEDURES + | PROGRAM + | PUBLICATION + | QUOTE + | RANGE + | READ + | REASSIGN + | RECHECK + | RECURSIVE + | REF + | REFERENCING + | REFRESH + | REINDEX + | RELATIVE_P + | RELEASE + | RENAME + | REPEATABLE + | REPLICA + | RESET + | RESTART + | RESTRICT + | RETURNS + | REVOKE + | ROLE + | ROLLBACK + | ROLLUP + | ROUTINE + | ROUTINES + | ROWS + | RULE + | SAVEPOINT + | SCHEMA + | SCHEMAS + | SCROLL + | SEARCH + | SECOND_P + | SECURITY + | SEQUENCE + | SEQUENCES + | SERIALIZABLE + | SERVER + | SESSION + | SET + | SETS + | SHARE + | SHOW + | SIMPLE + | SKIP_P + | SNAPSHOT + | SQL_P + | STABLE + | STANDALONE_P + | START + | STATEMENT + | STATISTICS + | STDIN + | STDOUT + | STORAGE + | STORED + | STRICT_P + | STRIP_P + | SUBSCRIPTION + | SUPPORT + | SYSID + | SYSTEM_P + | TABLES + | TABLESPACE + | TEMP + | TEMPLATE + | TEMPORARY + | TEXT_P + | TIES + | TRANSACTION + | TRANSFORM + | TRIGGER + | TRUNCATE + | TRUSTED + | TYPE_P + | TYPES_P + | UESCAPE + | UNBOUNDED + | UNCOMMITTED + | UNENCRYPTED + | UNKNOWN + | UNLISTEN + | UNLOGGED + | UNTIL + | UPDATE + | VACUUM + | VALID + | VALIDATE + | VALIDATOR + | VALUE_P + | VARYING + | VERSION_P + | VIEW + | VIEWS + | VOLATILE + | WHITESPACE_P + | WITHIN + | WITHOUT + | WORK + | WRAPPER + | WRITE + | XML_P + | YEAR_P + | YES_P + | ZONE + ; + +col_name_keyword + : BETWEEN + | BIGINT + | bit + | BOOLEAN_P + | CHAR_P + | character + | COALESCE + | DEC + | DECIMAL_P + | EXISTS + | EXTRACT + | FLOAT_P + | GREATEST + | GROUPING + | INOUT + | INT_P + | INTEGER + | INTERVAL + | LEAST + | NATIONAL + | NCHAR + | NONE + | NORMALIZE + | NULLIF + | numeric + | OUT_P + | OVERLAY + | POSITION + | PRECISION + | REAL + | ROW + | SETOF + | SMALLINT + | SUBSTRING + | TIME + | TIMESTAMP + | TREAT + | TRIM + | VALUES + | VARCHAR + | XMLATTRIBUTES + | XMLCONCAT + | XMLELEMENT + | XMLEXISTS + | XMLFOREST + | XMLNAMESPACES + | XMLPARSE + | XMLPI + | XMLROOT + | XMLSERIALIZE + | XMLTABLE + | builtin_function_name + ; + +type_func_name_keyword + : AUTHORIZATION + | BINARY + | COLLATION + | CONCURRENTLY + | CROSS + | CURRENT_SCHEMA + | FREEZE + | FULL + | ILIKE + | INNER_P + | IS + | ISNULL + | JOIN + | LIKE + | NATURAL + | NOTNULL + | OUTER_P + | OVERLAPS + | SIMILAR + | TABLESAMPLE + | VERBOSE + ; + +reserved_keyword + : ALL + | ANALYSE + | ANALYZE + | AND + | ANY + | ARRAY + | AS + | ASC + | ASYMMETRIC + | BOTH + | CASE + | CAST + | CHECK + | COLLATE + | COLUMN + | CONSTRAINT + | CREATE + | CURRENT_CATALOG + | CURRENT_DATE + | CURRENT_ROLE + | CURRENT_TIME + | CURRENT_TIMESTAMP + | CURRENT_USER + // | DEFAULT + | DEFERRABLE + | DESC + | DISTINCT + | DO + | ELSE + | END_P + | EXCEPT + | FALSE_P + | FETCH + | FOR + | FOREIGN + | FROM + | GRANT + | GROUP_P + | HAVING + | IN_P + | INITIALLY + | INTERSECT +/* +from pl_gram.y, line ~2982 + * Fortunately, INTO is a fully reserved word in the main grammar, so + * at least we need not worry about it appearing as an identifier. +*/ + + + // | INTO + | LATERAL_P + | LEADING + | LIMIT + | LOCALTIME + | LOCALTIMESTAMP + | NOT + | NULL_P + | OFFSET + | ON + | ONLY + | OR + | ORDER + | PLACING + | PRIMARY + | REFERENCES + | RETURNING + | SELECT + | SESSION_USER + | SOME + | SYMMETRIC + | TABLE + | THEN + | TO + | TRAILING + | TRUE_P + | UNION + | UNIQUE + | USER + | USING + | VARIADIC + | WHEN + | WHERE + | WINDOW + | WITH + ; + +builtin_function_name + : XMLCOMMENT + | XML_IS_WELL_FORMED + | XML_IS_WELL_FORMED_DOCUMENT + | XML_IS_WELL_FORMED_CONTENT + | XMLAGG + | XPATH + | XPATH_EXISTS + | ABS + | CBRT + | CEIL + | CEILING + | DEGREES + | DIV + | EXP + | FACTORIAL + | FLOOR + | GCD + | LCM + | LN + | LOG + | LOG10 + | MIN_SCALE + | MOD + | PI + | POWER + | RADIANS + | ROUND + | SCALE + | SIGN + | SQRT + | TRIM_SCALE + | TRUNC + | WIDTH_BUCKET + | RANDOM + | SETSEED + | ACOS + | ACOSD + | ACOSH + | ASIN + | ASIND + | ASINH + | ATAN + | ATAND + | ATANH + | ATAN2 + | ATAN2D + | COS + | COSD + | COSH + | COT + | COTD + | SIN + | SIND + | SINH + | TAN + | TAND + | TANH + | BIT_LENGTH + | CHAR_LENGTH + | CHARACTER_LENGTH + | LOWER + | OCTET_LENGTH + | OCTET_LENGTH + | UPPER + | ASCII + | BTRIM + | CHR + | CONCAT + | CONCAT_WS + | FORMAT + | INITCAP + | LENGTH + | LPAD + | LTRIM + | MD5 + | PARSE_IDENT + | PG_CLIENT_ENCODING + | QUOTE_IDENT + | QUOTE_LITERAL + | QUOTE_NULLABLE + | REGEXP_COUNT + | REGEXP_INSTR + | REGEXP_LIKE + | REGEXP_MATCH + | REGEXP_MATCHES + | REGEXP_REPLACE + | REGEXP_SPLIT_TO_ARRAY + | REGEXP_SPLIT_TO_TABLE + | REGEXP_SUBSTR + | REPEAT + | REPLACE + | REVERSE + | RPAD + | RTRIM + | SPLIT_PART + | STARTS_WITH + | STRING_TO_ARRAY + | STRING_TO_TABLE + | STRPOS + | SUBSTR + | TO_ASCII + | TO_HEX + | TRANSLATE + | UNISTR + | AGE + | DATE_BIN + | DATE_PART + | DATE_TRUNC + | ISFINITE + | JUSTIFY_DAYS + | JUSTIFY_HOURS + | JUSTIFY_INTERVAL + | MAKE_DATE + | MAKE_INTERVAL + | MAKE_TIME + | MAKE_TIMESTAMP + | MAKE_TIMESTAMPTZ + | CLOCK_TIMESTAMP + | NOW + | STATEMENT_TIMESTAMP + | TIMEOFDAY + | TRANSACTION_TIMESTAMP + | TO_TIMESTAMP + | JUSTIFY_INTERVAL + | JUSTIFY_INTERVAL + | TO_CHAR + | TO_DATE + | TO_NUMBER + ; + +/************************************************************************************************************************************************************/ +/*PL/SQL GRAMMAR */ + + +/*PLSQL grammar */ + + /************************************************************************************************************************************************************/ pl_function + : comp_options pl_block opt_semi? + ; + +comp_options + : comp_option* + ; + +comp_option + : sharp OPTION DUMP + | sharp PRINT_STRICT_PARAMS option_value + | sharp VARIABLE_CONFLICT ERROR + | sharp VARIABLE_CONFLICT USE_VARIABLE + | sharp VARIABLE_CONFLICT USE_COLUMN + ; + +sharp + : Operator + ; + +option_value + : sconst + | reserved_keyword + | plsql_unreserved_keyword + | unreserved_keyword + ; + +opt_semi + : SEMI + ; + // exception_sect means opt_exception_sect in original grammar, don't be confused! + +pl_block + : decl_sect BEGIN_P proc_sect exception_sect? END_P opt_label? + ; + +decl_sect + : opt_block_label? (decl_start decl_stmts?)? + ; + +decl_start + : DECLARE + ; + +decl_stmts + : decl_stmt+ + ; + +label_decl + : LESS_LESS any_identifier GREATER_GREATER + ; + +decl_stmt + : decl_statement + | DECLARE + | label_decl + ; + +decl_statement + : decl_varname + ( + ALIAS FOR decl_aliasitem + | decl_const? decl_datatype decl_collate? decl_notnull? decl_defval? + | opt_scrollable? CURSOR decl_cursor_args? decl_is_for decl_cursor_query + ) SEMI + ; + +opt_scrollable + : NO SCROLL + | SCROLL + ; + +decl_cursor_query + : selectstmt + ; + +decl_cursor_args + : OPEN_PAREN decl_cursor_arglist CLOSE_PAREN + ; + +decl_cursor_arglist + : decl_cursor_arg (COMMA decl_cursor_arg)* + ; + +decl_cursor_arg + : decl_varname decl_datatype + ; + +decl_is_for + : IS + | FOR + ; + +decl_aliasitem + : PARAM + | colid + ; + +decl_varname + : any_identifier + ; + +decl_const + : CONSTANT + ; + +decl_datatype + : typename + ; //TODO: $$ = read_datatype(yychar); + +decl_collate + : COLLATE any_name + ; + +decl_notnull + : NOT NULL_P + ; + +decl_defval + : decl_defkey sql_expression + ; + +decl_defkey + : assign_operator + | DEFAULT + ; + +assign_operator + : EQUAL + | COLON_EQUALS + ; + +proc_sect + : proc_stmt* + ; + +proc_stmt + : pl_block SEMI + | stmt_return + | stmt_raise + | stmt_assign + | stmt_if + | stmt_case + | stmt_loop + | stmt_while + | stmt_for + | stmt_foreach_a + | stmt_exit + | stmt_assert + | stmt_execsql + | stmt_dynexecute + | stmt_perform + | stmt_call + | stmt_getdiag + | stmt_open + | stmt_fetch + | stmt_move + | stmt_close + | stmt_null + | stmt_commit + | stmt_rollback + | stmt_set + ; + +stmt_perform + : PERFORM expr_until_semi SEMI + ; + +stmt_call + : CALL any_identifier OPEN_PAREN opt_expr_list? CLOSE_PAREN SEMI + | DO any_identifier OPEN_PAREN opt_expr_list? CLOSE_PAREN SEMI + ; + +opt_expr_list + : expr_list + ; + +stmt_assign + : assign_var assign_operator sql_expression SEMI + ; + +stmt_getdiag + : GET getdiag_area_opt? DIAGNOSTICS getdiag_list SEMI + ; + +getdiag_area_opt + : CURRENT_P + | STACKED + ; + +getdiag_list + : getdiag_list_item (COMMA getdiag_list_item)* + ; + +getdiag_list_item + : getdiag_target assign_operator getdiag_item + ; + +getdiag_item + : colid + ; + +getdiag_target + : assign_var + ; + +assign_var + : (any_name | PARAM) (OPEN_BRACKET expr_until_rightbracket CLOSE_BRACKET)* + ; + +stmt_if + : IF_P expr_until_then THEN proc_sect stmt_elsifs stmt_else? END_P IF_P SEMI + ; + +stmt_elsifs + : (ELSIF a_expr THEN proc_sect)* + ; + +stmt_else + : ELSE proc_sect + ; + +stmt_case + : CASE opt_expr_until_when? case_when_list opt_case_else? END_P CASE SEMI + ; + +opt_expr_until_when + : sql_expression + ; + +case_when_list + : case_when+ + ; + +case_when + : WHEN expr_list THEN proc_sect + ; + +opt_case_else + : ELSE proc_sect + ; + +stmt_loop + : opt_loop_label? loop_body + ; + +stmt_while + : opt_loop_label? WHILE expr_until_loop loop_body + ; + +stmt_for + : opt_loop_label? FOR for_control loop_body + ; + //TODO: rewrite using read_sql_expression logic? + +for_control + : for_variable IN_P + ( + cursor_name opt_cursor_parameters? + | selectstmt + | explainstmt + | EXECUTE a_expr opt_for_using_expression? + | opt_reverse? a_expr DOT_DOT a_expr opt_by_expression? + ) + ; + +opt_for_using_expression + : USING expr_list + ; + +opt_cursor_parameters + : OPEN_PAREN a_expr (COMMA a_expr)* CLOSE_PAREN + ; + +opt_reverse + : REVERSE + ; + +opt_by_expression + : BY a_expr + ; + +for_variable + : any_name_list + ; + +stmt_foreach_a + : opt_loop_label? FOREACH for_variable foreach_slice? IN_P ARRAY a_expr loop_body + ; + +foreach_slice + : SLICE iconst + ; + +stmt_exit + : exit_type opt_label? opt_exitcond? SEMI + ; + +exit_type + : EXIT + | CONTINUE_P + ; + //todo implement RETURN statement according to initial grammar line 1754 + +stmt_return + : RETURN (NEXT sql_expression | QUERY (EXECUTE a_expr opt_for_using_expression? | selectstmt) | opt_return_result?) SEMI + ; + +opt_return_result + : sql_expression + ; + //https://www.postgresql.org/docs/current/plpgsql-errors-and-messages.html + + //RAISE [ level ] 'format' [, expression [, ... ]] [ USING option = expression [, ... ] ]; + + //RAISE [ level ] condition_name [ USING option = expression [, ... ] ]; + + //RAISE [ level ] SQLSTATE 'sqlstate' [ USING option = expression [, ... ] ]; + + //RAISE [ level ] USING option = expression [, ... ]; + + //RAISE ; + +stmt_raise + : RAISE opt_stmt_raise_level? sconst opt_raise_list? opt_raise_using? SEMI + | RAISE opt_stmt_raise_level? identifier opt_raise_using? SEMI + | RAISE opt_stmt_raise_level? SQLSTATE sconst opt_raise_using? SEMI + | RAISE opt_stmt_raise_level? opt_raise_using? SEMI + | RAISE + ; + +opt_stmt_raise_level + : DEBUG + | LOG + | INFO + | NOTICE + | WARNING + | EXCEPTION + ; + +opt_raise_list + : (COMMA a_expr)+ + ; + +opt_raise_using + : USING opt_raise_using_elem_list + ; + +opt_raise_using_elem + : identifier EQUAL a_expr + ; + +opt_raise_using_elem_list + : opt_raise_using_elem (COMMA opt_raise_using_elem)* + ; + //todo imnplement + +stmt_assert + : ASSERT sql_expression opt_stmt_assert_message? SEMI + ; + +opt_stmt_assert_message + : COMMA sql_expression + ; + +loop_body + : LOOP proc_sect END_P LOOP opt_label? SEMI + ; + //TODO: looks like all other statements like INSERT/SELECT/UPDATE/DELETE are handled here; + + //pls take a look at original grammar + +stmt_execsql + : make_execsql_stmt SEMI +/*K_IMPORT + | K_INSERT + | t_word + | t_cword +*/ + + + ; + //https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-NORESULT + + //EXECUTE command-string [ INTO [STRICT] target ] [ USING expression [, ... ] ]; + +stmt_dynexecute + : EXECUTE a_expr ( +/*this is silly, but i have to time to find nice way to code */ + + opt_execute_into? opt_execute_using? | opt_execute_using? opt_execute_into? |) SEMI + ; + +opt_execute_using + : USING opt_execute_using_list + ; + +opt_execute_using_list + : a_expr (COMMA a_expr)* + ; + +opt_execute_into + : INTO STRICT_P? into_target + ; + //https://www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-OPENING + + //OPEN unbound_cursorvar [ [ NO ] SCROLL ] FOR query; + + //OPEN unbound_cursorvar [ [ NO ] SCROLL ] FOR EXECUTE query_string + + // [ USING expression [, ... ] ]; + + //OPEN bound_cursorvar [ ( [ argument_name := ] argument_value [, ...] ) ]; + +stmt_open + : OPEN + ( + cursor_variable opt_scroll_option? FOR (selectstmt | EXECUTE sql_expression opt_open_using?) + | colid (OPEN_PAREN opt_open_bound_list CLOSE_PAREN)? + ) SEMI + ; + +opt_open_bound_list_item + : colid COLON_EQUALS a_expr + | a_expr + ; + +opt_open_bound_list + : opt_open_bound_list_item (COMMA opt_open_bound_list_item)* + ; + +opt_open_using + : USING expr_list + ; + +opt_scroll_option + : opt_scroll_option_no? SCROLL + ; + +opt_scroll_option_no + : NO + ; + //https://www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-OPENING + + //FETCH [ direction { FROM | IN } ] cursor INTO target; + +stmt_fetch + : FETCH direction = opt_fetch_direction? opt_cursor_from? cursor_variable INTO into_target SEMI + ; + +into_target + : expr_list + ; + +opt_cursor_from + : FROM + | IN_P + ; + +opt_fetch_direction + : NEXT + | PRIOR + | FIRST_P + | LAST_P + | ABSOLUTE_P a_expr + | RELATIVE_P a_expr + | a_expr + | ALL + | (FORWARD | BACKWARD) (a_expr | ALL)? + ; + //https://www.postgresql.org/docs/current/plpgsql-cursors.html#PLPGSQL-CURSOR-OPENING + + //MOVE [ direction { FROM | IN } ] cursor; + +stmt_move + : MOVE opt_fetch_direction? cursor_variable SEMI + ; + +stmt_close + : CLOSE cursor_variable SEMI + ; + +stmt_null + : NULL_P SEMI + ; + +stmt_commit + : COMMIT plsql_opt_transaction_chain? SEMI + ; + +stmt_rollback + : ROLLBACK plsql_opt_transaction_chain? SEMI + ; + +plsql_opt_transaction_chain + : AND NO? CHAIN + ; + +stmt_set + : SET any_name TO DEFAULT SEMI + | RESET (any_name | ALL) SEMI + ; + +cursor_variable + : colid + | PARAM + ; + +exception_sect + : EXCEPTION proc_exceptions + ; + +proc_exceptions + : proc_exception+ + ; + +proc_exception + : WHEN proc_conditions THEN proc_sect + ; + +proc_conditions + : proc_condition (OR proc_condition)* + ; + +proc_condition + : any_identifier + | SQLSTATE sconst + ; + //expr_until_semi: + + //; + + //expr_until_rightbracket: + + //; + + //expr_until_loop: + + //; + +opt_block_label + : label_decl + ; + +opt_loop_label + : label_decl + ; + +opt_label + : any_identifier + ; + +opt_exitcond + : WHEN expr_until_semi + ; + +any_identifier + : colid + | plsql_unreserved_keyword + ; + +plsql_unreserved_keyword + : ABSOLUTE_P + | ALIAS + | AND + | ARRAY + | ASSERT + | BACKWARD + | CALL + | CHAIN + | CLOSE + | COLLATE + | COLUMN + //| COLUMN_NAME + | COMMIT + | CONSTANT + | CONSTRAINT + //| CONSTRAINT_NAME + | CONTINUE_P + | CURRENT_P + | CURSOR + //| DATATYPE + | DEBUG + | DEFAULT + //| DETAIL + | DIAGNOSTICS + | DO + | DUMP + | ELSIF + //| ERRCODE + | ERROR + | EXCEPTION + | EXIT + | FETCH + | FIRST_P + | FORWARD + | GET + //| HINT + + //| IMPORT + | INFO + | INSERT + | IS + | LAST_P + //| MESSAGE + + //| MESSAGE_TEXT + | MOVE + | NEXT + | NO + | NOTICE + | OPEN + | OPTION + | PERFORM + //| PG_CONTEXT + + //| PG_DATATYPE_NAME + + //| PG_EXCEPTION_CONTEXT + + //| PG_EXCEPTION_DETAIL + + //| PG_EXCEPTION_HINT + | PRINT_STRICT_PARAMS + | PRIOR + | QUERY + | RAISE + | RELATIVE_P + | RESET + | RETURN + //| RETURNED_SQLSTATE + | ROLLBACK + //| ROW_COUNT + | ROWTYPE + | SCHEMA + //| SCHEMA_NAME + | SCROLL + | SET + | SLICE + | SQLSTATE + | STACKED + | TABLE + //| TABLE_NAME + | TYPE_P + | USE_COLUMN + | USE_VARIABLE + | VARIABLE_CONFLICT + | WARNING + | OUTER_P + ; + +sql_expression + : opt_target_list? into_clause? from_clause? where_clause? group_clause? having_clause? window_clause? + ; + +expr_until_then + : sql_expression + ; + +expr_until_semi + : sql_expression + ; + +expr_until_rightbracket + : a_expr + ; + +expr_until_loop + : a_expr + ; + +make_execsql_stmt + : stmt opt_returning_clause_into? + ; + +opt_returning_clause_into + : INTO opt_strict? into_target + ; diff --git a/postgresql/PostgreSQLParser.interp b/postgresql/PostgreSQLParser.interp new file mode 100644 index 0000000..4e27783 --- /dev/null +++ b/postgresql/PostgreSQLParser.interp @@ -0,0 +1,2201 @@ +token literal names: +null +'$' +'(' +')' +'[' +']' +',' +';' +':' +'*' +'=' +'.' +'+' +'-' +'/' +'^' +'<' +'>' +'<<' +'>>' +':=' +'<=' +'=>' +'>=' +'..' +'<>' +'::' +'%' +null +null +'ALL' +'ANALYSE' +'ANALYZE' +'AND' +'ANY' +'ARRAY' +'AS' +'ASC' +'ASYMMETRIC' +'BOTH' +'CASE' +'CAST' +'CHECK' +'COLLATE' +'COLUMN' +'CONSTRAINT' +'CREATE' +'CURRENT_CATALOG' +'CURRENT_DATE' +'CURRENT_ROLE' +'CURRENT_TIME' +'CURRENT_TIMESTAMP' +'CURRENT_USER' +'DEFAULT' +'DEFERRABLE' +'DESC' +'DISTINCT' +'DO' +'ELSE' +'EXCEPT' +'FALSE' +'FETCH' +'FOR' +'FOREIGN' +'FROM' +'GRANT' +'GROUP' +'HAVING' +'IN' +'INITIALLY' +'INTERSECT' +'INTO' +'LATERAL' +'LEADING' +'LIMIT' +'LOCALTIME' +'LOCALTIMESTAMP' +'NOT' +'NULL' +'OFFSET' +'ON' +'ONLY' +'OR' +'ORDER' +'PLACING' +'PRIMARY' +'REFERENCES' +'RETURNING' +'SELECT' +'SESSION_USER' +'SOME' +'SYMMETRIC' +'TABLE' +'THEN' +'TO' +'TRAILING' +'TRUE' +'UNION' +'UNIQUE' +'USER' +'USING' +'VARIADIC' +'WHEN' +'WHERE' +'WINDOW' +'WITH' +'AUTHORIZATION' +'BINARY' +'COLLATION' +'CONCURRENTLY' +'CROSS' +'CURRENT_SCHEMA' +'FREEZE' +'FULL' +'ILIKE' +'INNER' +'IS' +'ISNULL' +'JOIN' +'LEFT' +'LIKE' +'NATURAL' +'NOTNULL' +'OUTER' +'OVER' +'OVERLAPS' +'RIGHT' +'SIMILAR' +'VERBOSE' +'ABORT' +'ABSOLUTE' +'ACCESS' +'ACTION' +'ADD' +'ADMIN' +'AFTER' +'AGGREGATE' +'ALSO' +'ALTER' +'ALWAYS' +'ASSERTION' +'ASSIGNMENT' +'AT' +'ATTRIBUTE' +'BACKWARD' +'BEFORE' +'BEGIN' +'BY' +'CACHE' +'CALLED' +'CASCADE' +'CASCADED' +'CATALOG' +'CHAIN' +'CHARACTERISTICS' +'CHECKPOINT' +'CLASS' +'CLOSE' +'CLUSTER' +'COMMENT' +'COMMENTS' +'COMMIT' +'COMMITTED' +'CONFIGURATION' +'CONNECTION' +'CONSTRAINTS' +'CONTENT' +'CONTINUE' +'CONVERSION' +'COPY' +'COST' +'CSV' +'CURSOR' +'CYCLE' +'DATA' +'DATABASE' +'DAY' +'DEALLOCATE' +'DECLARE' +'DEFAULTS' +'DEFERRED' +'DEFINER' +'DELETE' +'DELIMITER' +'DELIMITERS' +'DICTIONARY' +'DISABLE' +'DISCARD' +'DOCUMENT' +'DOMAIN' +'DOUBLE' +'DROP' +'EACH' +'ENABLE' +'ENCODING' +'ENCRYPTED' +'ENUM' +'ESCAPE' +'EVENT' +'EXCLUDE' +'EXCLUDING' +'EXCLUSIVE' +'EXECUTE' +'EXPLAIN' +'EXTENSION' +'EXTERNAL' +'FAMILY' +'FIRST' +'FOLLOWING' +'FORCE' +'FORWARD' +'FUNCTION' +'FUNCTIONS' +'GLOBAL' +'GRANTED' +'HANDLER' +'HEADER' +'HOLD' +'HOUR' +'IDENTITY' +'IF' +'IMMEDIATE' +'IMMUTABLE' +'IMPLICIT' +'INCLUDING' +'INCREMENT' +'INDEX' +'INDEXES' +'INHERIT' +'INHERITS' +'INLINE' +'INSENSITIVE' +'INSERT' +'INSTEAD' +'INVOKER' +'ISOLATION' +'KEY' +'LABEL' +'LANGUAGE' +'LARGE' +'LAST' +'LEAKPROOF' +'LEVEL' +'LISTEN' +'LOAD' +'LOCAL' +'LOCATION' +'LOCK' +'MAPPING' +'MATCH' +'MATCHED' +'MATERIALIZED' +'MAXVALUE' +'MERGE' +'MINUTE' +'MINVALUE' +'MODE' +'MONTH' +'MOVE' +'NAME' +'NAMES' +'NEXT' +'NO' +'NOTHING' +'NOTIFY' +'NOWAIT' +'NULLS' +'OBJECT' +'OF' +'OFF' +'OIDS' +'OPERATOR' +'OPTION' +'OPTIONS' +'OWNED' +'OWNER' +'PARSER' +'PARTIAL' +'PARTITION' +'PASSING' +'PASSWORD' +'PLANS' +'PRECEDING' +'PREPARE' +'PREPARED' +'PRESERVE' +'PRIOR' +'PRIVILEGES' +'PROCEDURAL' +'PROCEDURE' +'PROGRAM' +'QUOTE' +'RANGE' +'READ' +'REASSIGN' +'RECHECK' +'RECURSIVE' +'REF' +'REFRESH' +'REINDEX' +'RELATIVE' +'RELEASE' +'RENAME' +'REPEATABLE' +'REPLACE' +'REPLICA' +'RESET' +'RESTART' +'RESTRICT' +'RETURNS' +'REVOKE' +'ROLE' +'ROLLBACK' +'ROWS' +'RULE' +'SAVEPOINT' +'SCHEMA' +'SCROLL' +'SEARCH' +'SECOND' +'SECURITY' +'SEQUENCE' +'SEQUENCES' +'SERIALIZABLE' +'SERVER' +'SESSION' +'SET' +'SHARE' +'SHOW' +'SIMPLE' +'SNAPSHOT' +'STABLE' +'STANDALONE' +'START' +'STATEMENT' +'STATISTICS' +'STDIN' +'STDOUT' +'STORAGE' +'STRICT' +'STRIP' +'SYSID' +'SYSTEM' +'TABLES' +'TABLESPACE' +'TEMP' +'TEMPLATE' +'TEMPORARY' +'TEXT' +'TRANSACTION' +'TRIGGER' +'TRUNCATE' +'TRUSTED' +'TYPE' +'TYPES' +'UNBOUNDED' +'UNCOMMITTED' +'UNENCRYPTED' +'UNKNOWN' +'UNLISTEN' +'UNLOGGED' +'UNTIL' +'UPDATE' +'VACUUM' +'VALID' +'VALIDATE' +'VALIDATOR' +'VARYING' +'VERSION' +'VIEW' +'VOLATILE' +'WHITESPACE' +'WITHOUT' +'WORK' +'WRAPPER' +'WRITE' +'XML' +'YEAR' +'YES' +'ZONE' +'ATOMIC' +'BETWEEN' +'BIGINT' +'BIT' +'BOOLEAN' +'CHAR' +'CHARACTER' +'COALESCE' +'DEC' +'DECIMAL' +'EXISTS' +'EXTRACT' +'FLOAT' +'GREATEST' +'INOUT' +'INT' +'INTEGER' +'INTERVAL' +'LEAST' +'NATIONAL' +'NCHAR' +'NONE' +'NULLIF' +'NUMERIC' +'OVERLAY' +'PARAMETER' +'POSITION' +'PRECISION' +'REAL' +'ROW' +'SETOF' +'SMALLINT' +'SUBSTRING' +'TIME' +'TIMESTAMP' +'TREAT' +'TRIM' +'VALUES' +'VARCHAR' +'XMLATTRIBUTES' +'XMLCOMMENT' +'XMLAGG' +'XML_IS_WELL_FORMED' +'XML_IS_WELL_FORMED_DOCUMENT' +'XML_IS_WELL_FORMED_CONTENT' +'XPATH' +'XPATH_EXISTS' +'XMLCONCAT' +'XMLELEMENT' +'XMLEXISTS' +'XMLFOREST' +'XMLPARSE' +'XMLPI' +'XMLROOT' +'XMLSERIALIZE' +'CALL' +'CURRENT' +'ATTACH' +'DETACH' +'EXPRESSION' +'GENERATED' +'LOGGED' +'STORED' +'INCLUDE' +'ROUTINE' +'TRANSFORM' +'IMPORT' +'POLICY' +'METHOD' +'REFERENCING' +'NEW' +'OLD' +'VALUE' +'SUBSCRIPTION' +'PUBLICATION' +'OUT' +'END' +'ROUTINES' +'SCHEMAS' +'PROCEDURES' +'INPUT' +'SUPPORT' +'PARALLEL' +'SQL' +'DEPENDS' +'OVERRIDING' +'CONFLICT' +'SKIP' +'LOCKED' +'TIES' +'ROLLUP' +'CUBE' +'GROUPING' +'SETS' +'TABLESAMPLE' +'ORDINALITY' +'XMLTABLE' +'COLUMNS' +'XMLNAMESPACES' +'ROWTYPE' +'NORMALIZED' +'WITHIN' +'FILTER' +'GROUPS' +'OTHERS' +'NFC' +'NFD' +'NFKC' +'NFKD' +'UESCAPE' +'VIEWS' +'NORMALIZE' +'DUMP' +'PRINT_STRICT_PARAMS' +'VARIABLE_CONFLICT' +'ERROR' +'USE_VARIABLE' +'USE_COLUMN' +'ALIAS' +'CONSTANT' +'PERFORM' +'GET' +'DIAGNOSTICS' +'STACKED' +'ELSIF' +'WHILE' +'REVERSE' +'FOREACH' +'SLICE' +'EXIT' +'RETURN' +'QUERY' +'RAISE' +'SQLSTATE' +'DEBUG' +'LOG' +'INFO' +'NOTICE' +'WARNING' +'EXCEPTION' +'ASSERT' +'LOOP' +'OPEN' +'ABS' +'CBRT' +'CEIL' +'CEILING' +'DEGREES' +'DIV' +'EXP' +'FACTORIAL' +'FLOOR' +'GCD' +'LCM' +'LN' +'LOG10' +'MIN_SCALE' +'MOD' +'PI' +'POWER' +'RADIANS' +'ROUND' +'SCALE' +'SIGN' +'SQRT' +'TRIM_SCALE' +'TRUNC' +'WIDTH_BUCKET' +'RANDOM' +'SETSEED' +'ACOS' +'ACOSD' +'ASIN' +'ASIND' +'ATAN' +'ATAND' +'ATAN2' +'ATAN2D' +'COS' +'COSD' +'COT' +'COTD' +'SIN' +'SIND' +'TAN' +'TAND' +'SINH' +'COSH' +'TANH' +'ASINH' +'ACOSH' +'ATANH' +'BIT_LENGTH' +'CHAR_LENGTH' +'CHARACTER_LENGTH' +'LOWER' +'OCTET_LENGTH' +'UPPER' +'ASCII' +'BTRIM' +'CHR' +'CONCAT' +'CONCAT_WS' +'FORMAT' +'INITCAP' +'LENGTH' +'LPAD' +'LTRIM' +'MD5' +'PARSE_IDENT' +'PG_CLIENT_ENCODING' +'QUOTE_IDENT' +'QUOTE_LITERAL' +'QUOTE_NULLABLE' +'REGEXP_COUNT' +'REGEXP_INSTR' +'REGEXP_LIKE' +'REGEXP_MATCH' +'REGEXP_MATCHES' +'REGEXP_REPLACE' +'REGEXP_SPLIT_TO_ARRAY' +'REGEXP_SPLIT_TO_TABLE' +'REGEXP_SUBSTR' +'REPEAT' +'RPAD' +'RTRIM' +'SPLIT_PART' +'STARTS_WITH' +'STRING_TO_ARRAY' +'STRING_TO_TABLE' +'STRPOS' +'SUBSTR' +'TO_ASCII' +'TO_HEX' +'TRANSLATE' +'UNISTR' +'AGE' +'CLOCK_TIMESTAMP' +'DATE_BIN' +'DATE_PART' +'DATE_TRUNC' +'ISFINITE' +'JUSTIFY_DAYS' +'JUSTIFY_HOURS' +'JUSTIFY_INTERVAL' +'MAKE_DATE' +'MAKE_INTERVAL' +'MAKE_TIME' +'MAKE_TIMESTAMP' +'MAKE_TIMESTAMPTZ' +'NOW' +'STATEMENT_TIMESTAMP' +'TIMEOFDAY' +'TRANSACTION_TIMESTAMP' +'TO_TIMESTAMP' +'TO_CHAR' +'TO_DATE' +'TO_NUMBER' +'ENCODE' +'DISTKEY' +'SORTKEY' +'CASE_SENSITIVE' +'CASE_INSENSITIVE' +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +null +'\\\\' +null +null +null +null +null +null +null +null +null +'\'' + +token symbolic names: +null +Dollar +OPEN_PAREN +CLOSE_PAREN +OPEN_BRACKET +CLOSE_BRACKET +COMMA +SEMI +COLON +STAR +EQUAL +DOT +PLUS +MINUS +SLASH +CARET +LT +GT +LESS_LESS +GREATER_GREATER +COLON_EQUALS +LESS_EQUALS +EQUALS_GREATER +GREATER_EQUALS +DOT_DOT +NOT_EQUALS +TYPECAST +PERCENT +PARAM +Operator +ALL +ANALYSE +ANALYZE +AND +ANY +ARRAY +AS +ASC +ASYMMETRIC +BOTH +CASE +CAST +CHECK +COLLATE +COLUMN +CONSTRAINT +CREATE +CURRENT_CATALOG +CURRENT_DATE +CURRENT_ROLE +CURRENT_TIME +CURRENT_TIMESTAMP +CURRENT_USER +DEFAULT +DEFERRABLE +DESC +DISTINCT +DO +ELSE +EXCEPT +FALSE_P +FETCH +FOR +FOREIGN +FROM +GRANT +GROUP_P +HAVING +IN_P +INITIALLY +INTERSECT +INTO +LATERAL_P +LEADING +LIMIT +LOCALTIME +LOCALTIMESTAMP +NOT +NULL_P +OFFSET +ON +ONLY +OR +ORDER +PLACING +PRIMARY +REFERENCES +RETURNING +SELECT +SESSION_USER +SOME +SYMMETRIC +TABLE +THEN +TO +TRAILING +TRUE_P +UNION +UNIQUE +USER +USING +VARIADIC +WHEN +WHERE +WINDOW +WITH +AUTHORIZATION +BINARY +COLLATION +CONCURRENTLY +CROSS +CURRENT_SCHEMA +FREEZE +FULL +ILIKE +INNER_P +IS +ISNULL +JOIN +LEFT +LIKE +NATURAL +NOTNULL +OUTER_P +OVER +OVERLAPS +RIGHT +SIMILAR +VERBOSE +ABORT_P +ABSOLUTE_P +ACCESS +ACTION +ADD_P +ADMIN +AFTER +AGGREGATE +ALSO +ALTER +ALWAYS +ASSERTION +ASSIGNMENT +AT +ATTRIBUTE +BACKWARD +BEFORE +BEGIN_P +BY +CACHE +CALLED +CASCADE +CASCADED +CATALOG +CHAIN +CHARACTERISTICS +CHECKPOINT +CLASS +CLOSE +CLUSTER +COMMENT +COMMENTS +COMMIT +COMMITTED +CONFIGURATION +CONNECTION +CONSTRAINTS +CONTENT_P +CONTINUE_P +CONVERSION_P +COPY +COST +CSV +CURSOR +CYCLE +DATA_P +DATABASE +DAY_P +DEALLOCATE +DECLARE +DEFAULTS +DEFERRED +DEFINER +DELETE_P +DELIMITER +DELIMITERS +DICTIONARY +DISABLE_P +DISCARD +DOCUMENT_P +DOMAIN_P +DOUBLE_P +DROP +EACH +ENABLE_P +ENCODING +ENCRYPTED +ENUM_P +ESCAPE +EVENT +EXCLUDE +EXCLUDING +EXCLUSIVE +EXECUTE +EXPLAIN +EXTENSION +EXTERNAL +FAMILY +FIRST_P +FOLLOWING +FORCE +FORWARD +FUNCTION +FUNCTIONS +GLOBAL +GRANTED +HANDLER +HEADER_P +HOLD +HOUR_P +IDENTITY_P +IF_P +IMMEDIATE +IMMUTABLE +IMPLICIT_P +INCLUDING +INCREMENT +INDEX +INDEXES +INHERIT +INHERITS +INLINE_P +INSENSITIVE +INSERT +INSTEAD +INVOKER +ISOLATION +KEY +LABEL +LANGUAGE +LARGE_P +LAST_P +LEAKPROOF +LEVEL +LISTEN +LOAD +LOCAL +LOCATION +LOCK_P +MAPPING +MATCH +MATCHED +MATERIALIZED +MAXVALUE +MERGE +MINUTE_P +MINVALUE +MODE +MONTH_P +MOVE +NAME_P +NAMES +NEXT +NO +NOTHING +NOTIFY +NOWAIT +NULLS_P +OBJECT_P +OF +OFF +OIDS +OPERATOR +OPTION +OPTIONS +OWNED +OWNER +PARSER +PARTIAL +PARTITION +PASSING +PASSWORD +PLANS +PRECEDING +PREPARE +PREPARED +PRESERVE +PRIOR +PRIVILEGES +PROCEDURAL +PROCEDURE +PROGRAM +QUOTE +RANGE +READ +REASSIGN +RECHECK +RECURSIVE +REF +REFRESH +REINDEX +RELATIVE_P +RELEASE +RENAME +REPEATABLE +REPLACE +REPLICA +RESET +RESTART +RESTRICT +RETURNS +REVOKE +ROLE +ROLLBACK +ROWS +RULE +SAVEPOINT +SCHEMA +SCROLL +SEARCH +SECOND_P +SECURITY +SEQUENCE +SEQUENCES +SERIALIZABLE +SERVER +SESSION +SET +SHARE +SHOW +SIMPLE +SNAPSHOT +STABLE +STANDALONE_P +START +STATEMENT +STATISTICS +STDIN +STDOUT +STORAGE +STRICT_P +STRIP_P +SYSID +SYSTEM_P +TABLES +TABLESPACE +TEMP +TEMPLATE +TEMPORARY +TEXT_P +TRANSACTION +TRIGGER +TRUNCATE +TRUSTED +TYPE_P +TYPES_P +UNBOUNDED +UNCOMMITTED +UNENCRYPTED +UNKNOWN +UNLISTEN +UNLOGGED +UNTIL +UPDATE +VACUUM +VALID +VALIDATE +VALIDATOR +VARYING +VERSION_P +VIEW +VOLATILE +WHITESPACE_P +WITHOUT +WORK +WRAPPER +WRITE +XML_P +YEAR_P +YES_P +ZONE +ATOMIC_P +BETWEEN +BIGINT +BIT +BOOLEAN_P +CHAR_P +CHARACTER +COALESCE +DEC +DECIMAL_P +EXISTS +EXTRACT +FLOAT_P +GREATEST +INOUT +INT_P +INTEGER +INTERVAL +LEAST +NATIONAL +NCHAR +NONE +NULLIF +NUMERIC +OVERLAY +PARAMETER +POSITION +PRECISION +REAL +ROW +SETOF +SMALLINT +SUBSTRING +TIME +TIMESTAMP +TREAT +TRIM +VALUES +VARCHAR +XMLATTRIBUTES +XMLCOMMENT +XMLAGG +XML_IS_WELL_FORMED +XML_IS_WELL_FORMED_DOCUMENT +XML_IS_WELL_FORMED_CONTENT +XPATH +XPATH_EXISTS +XMLCONCAT +XMLELEMENT +XMLEXISTS +XMLFOREST +XMLPARSE +XMLPI +XMLROOT +XMLSERIALIZE +CALL +CURRENT_P +ATTACH +DETACH +EXPRESSION +GENERATED +LOGGED +STORED +INCLUDE +ROUTINE +TRANSFORM +IMPORT_P +POLICY +METHOD +REFERENCING +NEW +OLD +VALUE_P +SUBSCRIPTION +PUBLICATION +OUT_P +END_P +ROUTINES +SCHEMAS +PROCEDURES +INPUT_P +SUPPORT +PARALLEL +SQL_P +DEPENDS +OVERRIDING +CONFLICT +SKIP_P +LOCKED +TIES +ROLLUP +CUBE +GROUPING +SETS +TABLESAMPLE +ORDINALITY +XMLTABLE +COLUMNS +XMLNAMESPACES +ROWTYPE +NORMALIZED +WITHIN +FILTER +GROUPS +OTHERS +NFC +NFD +NFKC +NFKD +UESCAPE +VIEWS +NORMALIZE +DUMP +PRINT_STRICT_PARAMS +VARIABLE_CONFLICT +ERROR +USE_VARIABLE +USE_COLUMN +ALIAS +CONSTANT +PERFORM +GET +DIAGNOSTICS +STACKED +ELSIF +WHILE +REVERSE +FOREACH +SLICE +EXIT +RETURN +QUERY +RAISE +SQLSTATE +DEBUG +LOG +INFO +NOTICE +WARNING +EXCEPTION +ASSERT +LOOP +OPEN +ABS +CBRT +CEIL +CEILING +DEGREES +DIV +EXP +FACTORIAL +FLOOR +GCD +LCM +LN +LOG10 +MIN_SCALE +MOD +PI +POWER +RADIANS +ROUND +SCALE +SIGN +SQRT +TRIM_SCALE +TRUNC +WIDTH_BUCKET +RANDOM +SETSEED +ACOS +ACOSD +ASIN +ASIND +ATAN +ATAND +ATAN2 +ATAN2D +COS +COSD +COT +COTD +SIN +SIND +TAN +TAND +SINH +COSH +TANH +ASINH +ACOSH +ATANH +BIT_LENGTH +CHAR_LENGTH +CHARACTER_LENGTH +LOWER +OCTET_LENGTH +UPPER +ASCII +BTRIM +CHR +CONCAT +CONCAT_WS +FORMAT +INITCAP +LENGTH +LPAD +LTRIM +MD5 +PARSE_IDENT +PG_CLIENT_ENCODING +QUOTE_IDENT +QUOTE_LITERAL +QUOTE_NULLABLE +REGEXP_COUNT +REGEXP_INSTR +REGEXP_LIKE +REGEXP_MATCH +REGEXP_MATCHES +REGEXP_REPLACE +REGEXP_SPLIT_TO_ARRAY +REGEXP_SPLIT_TO_TABLE +REGEXP_SUBSTR +REPEAT +RPAD +RTRIM +SPLIT_PART +STARTS_WITH +STRING_TO_ARRAY +STRING_TO_TABLE +STRPOS +SUBSTR +TO_ASCII +TO_HEX +TRANSLATE +UNISTR +AGE +CLOCK_TIMESTAMP +DATE_BIN +DATE_PART +DATE_TRUNC +ISFINITE +JUSTIFY_DAYS +JUSTIFY_HOURS +JUSTIFY_INTERVAL +MAKE_DATE +MAKE_INTERVAL +MAKE_TIME +MAKE_TIMESTAMP +MAKE_TIMESTAMPTZ +NOW +STATEMENT_TIMESTAMP +TIMEOFDAY +TRANSACTION_TIMESTAMP +TO_TIMESTAMP +TO_CHAR +TO_DATE +TO_NUMBER +ENCODE +DISTKEY +SORTKEY +CASE_SENSITIVE +CASE_INSENSITIVE +Identifier +QuotedIdentifier +UnterminatedQuotedIdentifier +InvalidQuotedIdentifier +InvalidUnterminatedQuotedIdentifier +UnicodeQuotedIdentifier +UnterminatedUnicodeQuotedIdentifier +InvalidUnicodeQuotedIdentifier +InvalidUnterminatedUnicodeQuotedIdentifier +StringConstant +UnterminatedStringConstant +UnicodeEscapeStringConstant +UnterminatedUnicodeEscapeStringConstant +BeginDollarStringConstant +BinaryStringConstant +UnterminatedBinaryStringConstant +InvalidBinaryStringConstant +InvalidUnterminatedBinaryStringConstant +HexadecimalStringConstant +UnterminatedHexadecimalStringConstant +InvalidHexadecimalStringConstant +InvalidUnterminatedHexadecimalStringConstant +Integral +NumericFail +Numeric +PLSQLVARIABLENAME +PLSQLIDENTIFIER +Whitespace +Newline +LineComment +BlockComment +UnterminatedBlockComment +MetaCommand +EndMetaCommand +ErrorCharacter +EscapeStringConstant +UnterminatedEscapeStringConstant +InvalidEscapeStringConstant +InvalidUnterminatedEscapeStringConstant +AfterEscapeStringConstantMode_NotContinued +AfterEscapeStringConstantWithNewlineMode_NotContinued +DollarText +EndDollarStringConstant +AfterEscapeStringConstantWithNewlineMode_Continued + +rule names: +root +plsqlroot +stmtblock +stmtmulti +stmt +plsqlconsolecommand +callstmt +createrolestmt +opt_with +optrolelist +alteroptrolelist +alteroptroleelem +createoptroleelem +createuserstmt +alterrolestmt +opt_in_database +alterrolesetstmt +droprolestmt +creategroupstmt +altergroupstmt +add_drop +createschemastmt +optschemaname +optschemaeltlist +schema_stmt +variablesetstmt +set_rest +generic_set +set_rest_more +var_name +var_list +var_value +iso_level +opt_boolean_or_string +zone_value +opt_encoding +nonreservedword_or_sconst +variableresetstmt +reset_rest +generic_reset +setresetclause +functionsetresetclause +variableshowstmt +constraintssetstmt +constraints_set_list +constraints_set_mode +checkpointstmt +discardstmt +altertablestmt +alter_table_cmds +partition_cmd +index_partition_cmd +alter_table_cmd +alter_column_default +opt_drop_behavior +opt_collate_clause +alter_using +replica_identity +reloptions +opt_reloptions +reloption_list +reloption_elem +alter_identity_column_option_list +alter_identity_column_option +partitionboundspec +hash_partbound_elem +hash_partbound +altercompositetypestmt +alter_type_cmds +alter_type_cmd +closeportalstmt +copystmt +copy_from +opt_program +copy_file_name +copy_options +copy_opt_list +copy_opt_item +opt_binary +copy_delimiter +opt_using +copy_generic_opt_list +copy_generic_opt_elem +copy_generic_opt_arg +copy_generic_opt_arg_list +copy_generic_opt_arg_list_item +createstmt +opttemp +opttableelementlist +opttypedtableelementlist +tableelementlist +typedtableelementlist +tableelement +typedtableelement +columnDef +rs_colattributes +columnOptions +colquallist +colconstraint +colconstraintelem +opt_unique_null_treatment +generated_when +constraintattr +tablelikeclause +tablelikeoptionlist +tablelikeoption +tableconstraint +constraintelem +opt_no_inherit +opt_column_list +columnlist +columnElem +opt_c_include +key_match +exclusionconstraintlist +exclusionconstraintelem +exclusionwhereclause +key_actions +key_update +key_delete +key_action +optinherit +optpartitionspec +partitionspec +part_params +part_elem +table_access_method_clause +optwith +oncommitoption +opttablespace +optconstablespace +existingindex +createstatsstmt +alterstatsstmt +createasstmt +create_as_target +opt_with_data +creatematviewstmt +create_mv_target +optnolog +refreshmatviewstmt +createseqstmt +alterseqstmt +optseqoptlist +optparenthesizedseqoptlist +seqoptlist +seqoptelem +opt_by +numericonly +numericonly_list +createplangstmt +opt_trusted +handler_name +opt_inline_handler +validator_clause +opt_validator +opt_procedural +createtablespacestmt +opttablespaceowner +droptablespacestmt +createextensionstmt +create_extension_opt_list +create_extension_opt_item +alterextensionstmt +alter_extension_opt_list +alter_extension_opt_item +alterextensioncontentsstmt +createfdwstmt +fdw_option +fdw_options +opt_fdw_options +alterfdwstmt +create_generic_options +generic_option_list +alter_generic_options +alter_generic_option_list +alter_generic_option_elem +generic_option_elem +generic_option_name +generic_option_arg +createforeignserverstmt +opt_type +foreign_server_version +opt_foreign_server_version +alterforeignserverstmt +createforeigntablestmt +importforeignschemastmt +import_qualification_type +import_qualification +createusermappingstmt +auth_ident +dropusermappingstmt +alterusermappingstmt +createpolicystmt +alterpolicystmt +rowsecurityoptionalexpr +rowsecurityoptionalwithcheck +rowsecuritydefaulttorole +rowsecurityoptionaltorole +rowsecuritydefaultpermissive +rowsecuritydefaultforcmd +row_security_cmd +createamstmt +am_type +createtrigstmt +triggeractiontime +triggerevents +triggeroneevent +triggerreferencing +triggertransitions +triggertransition +transitionoldornew +transitionrowortable +transitionrelname +triggerforspec +triggerforopteach +triggerfortype +triggerwhen +function_or_procedure +triggerfuncargs +triggerfuncarg +optconstrfromtable +constraintattributespec +constraintattributeElem +createeventtrigstmt +event_trigger_when_list +event_trigger_when_item +event_trigger_value_list +altereventtrigstmt +enable_trigger +createassertionstmt +definestmt +definition +def_list +def_elem +def_arg +old_aggr_definition +old_aggr_list +old_aggr_elem +opt_enum_val_list +enum_val_list +alterenumstmt +opt_if_not_exists +createopclassstmt +opclass_item_list +opclass_item +opt_default +opt_opfamily +opclass_purpose +opt_recheck +createopfamilystmt +alteropfamilystmt +opclass_drop_list +opclass_drop +dropopclassstmt +dropopfamilystmt +dropownedstmt +reassignownedstmt +dropstmt +object_type_any_name +object_type_name +drop_type_name +object_type_name_on_any_name +any_name_list +any_name +attrs +type_name_list +truncatestmt +opt_restart_seqs +commentstmt +comment_text +seclabelstmt +opt_provider +security_label +fetchstmt +fetch_args +from_in +opt_from_in +grantstmt +revokestmt +privileges +privilege_list +privilege +privilege_target +parameter_name_list +parameter_name +grantee_list +grantee +opt_grant_grant_option +grantrolestmt +revokerolestmt +opt_grant_admin_option +opt_granted_by +alterdefaultprivilegesstmt +defacloptionlist +defacloption +defaclaction +defacl_privilege_target +indexstmt +opt_unique +opt_concurrently +opt_index_name +access_method_clause +index_params +index_elem_options +index_elem +opt_include +index_including_params +opt_collate +opt_class +opt_asc_desc +opt_nulls_order +createfunctionstmt +opt_or_replace +func_args +func_args_list +function_with_argtypes_list +function_with_argtypes +func_args_with_defaults +func_args_with_defaults_list +func_arg +arg_class +param_name +func_return +func_type +func_arg_with_default +aggr_arg +aggr_args +aggr_args_list +aggregate_with_argtypes +aggregate_with_argtypes_list +createfunc_opt_list +common_func_opt_item +createfunc_opt_item +func_as +transform_type_list +opt_definition +table_func_column +table_func_column_list +alterfunctionstmt +alterfunc_opt_list +opt_restrict +removefuncstmt +removeaggrstmt +removeoperstmt +oper_argtypes +any_operator +operator_with_argtypes_list +operator_with_argtypes +dostmt +dostmt_opt_list +dostmt_opt_item +createcaststmt +cast_context +dropcaststmt +opt_if_exists +createtransformstmt +transform_element_list +droptransformstmt +reindexstmt +reindex_target_type +reindex_target_multitable +reindex_option_list +reindex_option_elem +altertblspcstmt +renamestmt +opt_column +opt_set_data +alterobjectdependsstmt +opt_no +alterobjectschemastmt +alteroperatorstmt +operator_def_list +operator_def_elem +operator_def_arg +altertypestmt +alterownerstmt +createpublicationstmt +pub_obj_list +publication_obj_spec +opt_where_clause +alterpublicationstmt +createsubscriptionstmt +publication_name_list +publication_name_item +altersubscriptionstmt +dropsubscriptionstmt +rulestmt +ruleactionlist +ruleactionmulti +ruleactionstmt +ruleactionstmtOrEmpty +event +opt_instead +notifystmt +notify_payload +listenstmt +unlistenstmt +transactionstmt +opt_transaction +transaction_mode_item +transaction_mode_list +transaction_mode_list_or_empty +opt_transaction_chain +viewstmt +opt_check_option +loadstmt +createdbstmt +createdb_opt_list +createdb_opt_items +createdb_opt_item +createdb_opt_name +opt_equal +alterdatabasestmt +alterdatabasesetstmt +dropdbstmt +drop_option_list +drop_option +altercollationstmt +altersystemstmt +createdomainstmt +alterdomainstmt +opt_as +altertsdictionarystmt +altertsconfigurationstmt +any_with +createconversionstmt +clusterstmt +cluster_index_specification +vacuumstmt +analyzestmt +vac_analyze_option_list +analyze_keyword +vac_analyze_option_elem +vac_analyze_option_name +vac_analyze_option_arg +opt_analyze +opt_verbose +opt_full +opt_freeze +opt_name_list +vacuum_relation +vacuum_relation_list +opt_vacuum_relation_list +explainstmt +explainablestmt +explain_option_list +explain_option_elem +explain_option_name +explain_option_arg +preparestmt +prep_type_clause +preparablestmt +executestmt +execute_param_clause +deallocatestmt +insertstmt +insert_target +insert_rest +override_kind +insert_column_list +insert_column_item +opt_on_conflict +opt_conf_expr +returning_clause +mergestmt +merge_insert_clause +merge_update_clause +merge_delete_clause +deletestmt +using_clause +lockstmt +opt_lock +lock_type +opt_nowait +opt_nowait_or_skip +updatestmt +set_clause_list +set_clause +set_target +set_target_list +declarecursorstmt +cursor_name +cursor_options +opt_hold +selectstmt +select_with_parens +select_no_parens +select_clause +simple_select_intersect +simple_select_pramary +with_clause +cte_list +common_table_expr +opt_materialized +opt_with_clause +into_clause +opt_strict +opttempTableName +opt_table +all_or_distinct +distinct_clause +opt_all_clause +opt_sort_clause +sort_clause +sortby_list +sortby +select_limit +opt_select_limit +limit_clause +offset_clause +select_limit_value +select_offset_value +select_fetch_first_value +i_or_f_const +row_or_rows +first_or_next +group_clause +group_by_list +group_by_item +empty_grouping_set +rollup_clause +cube_clause +grouping_sets_clause +having_clause +for_locking_clause +opt_for_locking_clause +for_locking_items +for_locking_item +for_locking_strength +locked_rels_list +values_clause +from_clause +from_list +table_ref +joined_table +alias_clause +opt_alias_clause +table_alias_clause +func_alias_clause +join_type +join_qual +relation_expr +relation_expr_list +relation_expr_opt_alias +tablesample_clause +opt_repeatable_clause +func_table +rowsfrom_item +rowsfrom_list +opt_col_def_list +opt_ordinality +where_clause +where_or_current_clause +opttablefuncelementlist +tablefuncelementlist +tablefuncelement +xmltable +xmltable_column_list +xmltable_column_el +xmltable_column_option_list +xmltable_column_option_el +xml_namespace_list +xml_namespace_el +typename +opt_array_bounds +simpletypename +consttypename +generictype +opt_type_modifiers +numeric +opt_float +bit +constbit +bitwithlength +bitwithoutlength +character +constcharacter +character_c +opt_varying +constdatetime +constinterval +opt_timezone +opt_interval +interval_second +opt_escape +a_expr +a_expr_qual +a_expr_lessless +a_expr_or +a_expr_and +a_expr_between +a_expr_in +a_expr_unary_not +a_expr_isnull +a_expr_is_not +a_expr_compare +a_expr_like +a_expr_qual_op +a_expr_unary_qualop +a_expr_add +a_expr_mul +a_expr_caret +a_expr_unary_sign +a_expr_at_time_zone +a_expr_collate +a_expr_typecast +b_expr +c_expr +plsqlvariablename +func_application +func_expr +func_expr_windowless +func_expr_common_subexpr +xml_root_version +opt_xml_root_standalone +xml_attributes +xml_attribute_list +xml_attribute_el +document_or_content +xml_whitespace_option +xmlexists_argument +xml_passing_mech +within_group_clause +filter_clause +window_clause +window_definition_list +window_definition +over_clause +window_specification +opt_existing_window_name +opt_partition_clause +opt_frame_clause +frame_extent +frame_bound +opt_window_exclusion_clause +row +explicit_row +implicit_row +sub_type +all_op +mathop +qual_op +qual_all_op +subquery_Op +expr_list +func_arg_list +func_arg_expr +type_list +array_expr +array_expr_list +extract_list +extract_arg +unicode_normal_form +overlay_list +position_list +substr_list +trim_list +in_expr +case_expr +when_clause_list +when_clause +case_default +case_arg +columnref +indirection_el +opt_slice_bound +indirection +opt_indirection +opt_target_list +target_list +target_el +target_alias +qualified_name_list +qualified_name +name_list +name +attr_name +file_name +func_name +aexprconst +xconst +bconst +fconst +iconst +sconst +anysconst +opt_uescape +signediconst +roleid +rolespec +role_list +colid +table_alias +type_function_name +nonreservedword +collabel +identifier +plsqlidentifier +unreserved_keyword +col_name_keyword +type_func_name_keyword +reserved_keyword +builtin_function_name +pl_function +comp_options +comp_option +sharp +option_value +opt_semi +pl_block +decl_sect +decl_start +decl_stmts +label_decl +decl_stmt +decl_statement +opt_scrollable +decl_cursor_query +decl_cursor_args +decl_cursor_arglist +decl_cursor_arg +decl_is_for +decl_aliasitem +decl_varname +decl_const +decl_datatype +decl_collate +decl_notnull +decl_defval +decl_defkey +assign_operator +proc_sect +proc_stmt +stmt_perform +stmt_call +opt_expr_list +stmt_assign +stmt_getdiag +getdiag_area_opt +getdiag_list +getdiag_list_item +getdiag_item +getdiag_target +assign_var +stmt_if +stmt_elsifs +stmt_else +stmt_case +opt_expr_until_when +case_when_list +case_when +opt_case_else +stmt_loop +stmt_while +stmt_for +for_control +opt_for_using_expression +opt_cursor_parameters +opt_reverse +opt_by_expression +for_variable +stmt_foreach_a +foreach_slice +stmt_exit +exit_type +stmt_return +opt_return_result +stmt_raise +opt_stmt_raise_level +opt_raise_list +opt_raise_using +opt_raise_using_elem +opt_raise_using_elem_list +stmt_assert +opt_stmt_assert_message +loop_body +stmt_execsql +stmt_dynexecute +opt_execute_using +opt_execute_using_list +opt_execute_into +stmt_open +opt_open_bound_list_item +opt_open_bound_list +opt_open_using +opt_scroll_option +opt_scroll_option_no +stmt_fetch +into_target +opt_cursor_from +opt_fetch_direction +stmt_move +stmt_close +stmt_null +stmt_commit +stmt_rollback +plsql_opt_transaction_chain +stmt_set +cursor_variable +exception_sect +proc_exceptions +proc_exception +proc_conditions +proc_condition +opt_block_label +opt_loop_label +opt_label +opt_exitcond +any_identifier +plsql_unreserved_keyword +sql_expression +expr_until_then +expr_until_semi +expr_until_rightbracket +expr_until_loop +make_execsql_stmt +opt_returning_clause_into + + +atn: +[4, 1, 686, 11268, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, 2, 221, 7, 221, 2, 222, 7, 222, 2, 223, 7, 223, 2, 224, 7, 224, 2, 225, 7, 225, 2, 226, 7, 226, 2, 227, 7, 227, 2, 228, 7, 228, 2, 229, 7, 229, 2, 230, 7, 230, 2, 231, 7, 231, 2, 232, 7, 232, 2, 233, 7, 233, 2, 234, 7, 234, 2, 235, 7, 235, 2, 236, 7, 236, 2, 237, 7, 237, 2, 238, 7, 238, 2, 239, 7, 239, 2, 240, 7, 240, 2, 241, 7, 241, 2, 242, 7, 242, 2, 243, 7, 243, 2, 244, 7, 244, 2, 245, 7, 245, 2, 246, 7, 246, 2, 247, 7, 247, 2, 248, 7, 248, 2, 249, 7, 249, 2, 250, 7, 250, 2, 251, 7, 251, 2, 252, 7, 252, 2, 253, 7, 253, 2, 254, 7, 254, 2, 255, 7, 255, 2, 256, 7, 256, 2, 257, 7, 257, 2, 258, 7, 258, 2, 259, 7, 259, 2, 260, 7, 260, 2, 261, 7, 261, 2, 262, 7, 262, 2, 263, 7, 263, 2, 264, 7, 264, 2, 265, 7, 265, 2, 266, 7, 266, 2, 267, 7, 267, 2, 268, 7, 268, 2, 269, 7, 269, 2, 270, 7, 270, 2, 271, 7, 271, 2, 272, 7, 272, 2, 273, 7, 273, 2, 274, 7, 274, 2, 275, 7, 275, 2, 276, 7, 276, 2, 277, 7, 277, 2, 278, 7, 278, 2, 279, 7, 279, 2, 280, 7, 280, 2, 281, 7, 281, 2, 282, 7, 282, 2, 283, 7, 283, 2, 284, 7, 284, 2, 285, 7, 285, 2, 286, 7, 286, 2, 287, 7, 287, 2, 288, 7, 288, 2, 289, 7, 289, 2, 290, 7, 290, 2, 291, 7, 291, 2, 292, 7, 292, 2, 293, 7, 293, 2, 294, 7, 294, 2, 295, 7, 295, 2, 296, 7, 296, 2, 297, 7, 297, 2, 298, 7, 298, 2, 299, 7, 299, 2, 300, 7, 300, 2, 301, 7, 301, 2, 302, 7, 302, 2, 303, 7, 303, 2, 304, 7, 304, 2, 305, 7, 305, 2, 306, 7, 306, 2, 307, 7, 307, 2, 308, 7, 308, 2, 309, 7, 309, 2, 310, 7, 310, 2, 311, 7, 311, 2, 312, 7, 312, 2, 313, 7, 313, 2, 314, 7, 314, 2, 315, 7, 315, 2, 316, 7, 316, 2, 317, 7, 317, 2, 318, 7, 318, 2, 319, 7, 319, 2, 320, 7, 320, 2, 321, 7, 321, 2, 322, 7, 322, 2, 323, 7, 323, 2, 324, 7, 324, 2, 325, 7, 325, 2, 326, 7, 326, 2, 327, 7, 327, 2, 328, 7, 328, 2, 329, 7, 329, 2, 330, 7, 330, 2, 331, 7, 331, 2, 332, 7, 332, 2, 333, 7, 333, 2, 334, 7, 334, 2, 335, 7, 335, 2, 336, 7, 336, 2, 337, 7, 337, 2, 338, 7, 338, 2, 339, 7, 339, 2, 340, 7, 340, 2, 341, 7, 341, 2, 342, 7, 342, 2, 343, 7, 343, 2, 344, 7, 344, 2, 345, 7, 345, 2, 346, 7, 346, 2, 347, 7, 347, 2, 348, 7, 348, 2, 349, 7, 349, 2, 350, 7, 350, 2, 351, 7, 351, 2, 352, 7, 352, 2, 353, 7, 353, 2, 354, 7, 354, 2, 355, 7, 355, 2, 356, 7, 356, 2, 357, 7, 357, 2, 358, 7, 358, 2, 359, 7, 359, 2, 360, 7, 360, 2, 361, 7, 361, 2, 362, 7, 362, 2, 363, 7, 363, 2, 364, 7, 364, 2, 365, 7, 365, 2, 366, 7, 366, 2, 367, 7, 367, 2, 368, 7, 368, 2, 369, 7, 369, 2, 370, 7, 370, 2, 371, 7, 371, 2, 372, 7, 372, 2, 373, 7, 373, 2, 374, 7, 374, 2, 375, 7, 375, 2, 376, 7, 376, 2, 377, 7, 377, 2, 378, 7, 378, 2, 379, 7, 379, 2, 380, 7, 380, 2, 381, 7, 381, 2, 382, 7, 382, 2, 383, 7, 383, 2, 384, 7, 384, 2, 385, 7, 385, 2, 386, 7, 386, 2, 387, 7, 387, 2, 388, 7, 388, 2, 389, 7, 389, 2, 390, 7, 390, 2, 391, 7, 391, 2, 392, 7, 392, 2, 393, 7, 393, 2, 394, 7, 394, 2, 395, 7, 395, 2, 396, 7, 396, 2, 397, 7, 397, 2, 398, 7, 398, 2, 399, 7, 399, 2, 400, 7, 400, 2, 401, 7, 401, 2, 402, 7, 402, 2, 403, 7, 403, 2, 404, 7, 404, 2, 405, 7, 405, 2, 406, 7, 406, 2, 407, 7, 407, 2, 408, 7, 408, 2, 409, 7, 409, 2, 410, 7, 410, 2, 411, 7, 411, 2, 412, 7, 412, 2, 413, 7, 413, 2, 414, 7, 414, 2, 415, 7, 415, 2, 416, 7, 416, 2, 417, 7, 417, 2, 418, 7, 418, 2, 419, 7, 419, 2, 420, 7, 420, 2, 421, 7, 421, 2, 422, 7, 422, 2, 423, 7, 423, 2, 424, 7, 424, 2, 425, 7, 425, 2, 426, 7, 426, 2, 427, 7, 427, 2, 428, 7, 428, 2, 429, 7, 429, 2, 430, 7, 430, 2, 431, 7, 431, 2, 432, 7, 432, 2, 433, 7, 433, 2, 434, 7, 434, 2, 435, 7, 435, 2, 436, 7, 436, 2, 437, 7, 437, 2, 438, 7, 438, 2, 439, 7, 439, 2, 440, 7, 440, 2, 441, 7, 441, 2, 442, 7, 442, 2, 443, 7, 443, 2, 444, 7, 444, 2, 445, 7, 445, 2, 446, 7, 446, 2, 447, 7, 447, 2, 448, 7, 448, 2, 449, 7, 449, 2, 450, 7, 450, 2, 451, 7, 451, 2, 452, 7, 452, 2, 453, 7, 453, 2, 454, 7, 454, 2, 455, 7, 455, 2, 456, 7, 456, 2, 457, 7, 457, 2, 458, 7, 458, 2, 459, 7, 459, 2, 460, 7, 460, 2, 461, 7, 461, 2, 462, 7, 462, 2, 463, 7, 463, 2, 464, 7, 464, 2, 465, 7, 465, 2, 466, 7, 466, 2, 467, 7, 467, 2, 468, 7, 468, 2, 469, 7, 469, 2, 470, 7, 470, 2, 471, 7, 471, 2, 472, 7, 472, 2, 473, 7, 473, 2, 474, 7, 474, 2, 475, 7, 475, 2, 476, 7, 476, 2, 477, 7, 477, 2, 478, 7, 478, 2, 479, 7, 479, 2, 480, 7, 480, 2, 481, 7, 481, 2, 482, 7, 482, 2, 483, 7, 483, 2, 484, 7, 484, 2, 485, 7, 485, 2, 486, 7, 486, 2, 487, 7, 487, 2, 488, 7, 488, 2, 489, 7, 489, 2, 490, 7, 490, 2, 491, 7, 491, 2, 492, 7, 492, 2, 493, 7, 493, 2, 494, 7, 494, 2, 495, 7, 495, 2, 496, 7, 496, 2, 497, 7, 497, 2, 498, 7, 498, 2, 499, 7, 499, 2, 500, 7, 500, 2, 501, 7, 501, 2, 502, 7, 502, 2, 503, 7, 503, 2, 504, 7, 504, 2, 505, 7, 505, 2, 506, 7, 506, 2, 507, 7, 507, 2, 508, 7, 508, 2, 509, 7, 509, 2, 510, 7, 510, 2, 511, 7, 511, 2, 512, 7, 512, 2, 513, 7, 513, 2, 514, 7, 514, 2, 515, 7, 515, 2, 516, 7, 516, 2, 517, 7, 517, 2, 518, 7, 518, 2, 519, 7, 519, 2, 520, 7, 520, 2, 521, 7, 521, 2, 522, 7, 522, 2, 523, 7, 523, 2, 524, 7, 524, 2, 525, 7, 525, 2, 526, 7, 526, 2, 527, 7, 527, 2, 528, 7, 528, 2, 529, 7, 529, 2, 530, 7, 530, 2, 531, 7, 531, 2, 532, 7, 532, 2, 533, 7, 533, 2, 534, 7, 534, 2, 535, 7, 535, 2, 536, 7, 536, 2, 537, 7, 537, 2, 538, 7, 538, 2, 539, 7, 539, 2, 540, 7, 540, 2, 541, 7, 541, 2, 542, 7, 542, 2, 543, 7, 543, 2, 544, 7, 544, 2, 545, 7, 545, 2, 546, 7, 546, 2, 547, 7, 547, 2, 548, 7, 548, 2, 549, 7, 549, 2, 550, 7, 550, 2, 551, 7, 551, 2, 552, 7, 552, 2, 553, 7, 553, 2, 554, 7, 554, 2, 555, 7, 555, 2, 556, 7, 556, 2, 557, 7, 557, 2, 558, 7, 558, 2, 559, 7, 559, 2, 560, 7, 560, 2, 561, 7, 561, 2, 562, 7, 562, 2, 563, 7, 563, 2, 564, 7, 564, 2, 565, 7, 565, 2, 566, 7, 566, 2, 567, 7, 567, 2, 568, 7, 568, 2, 569, 7, 569, 2, 570, 7, 570, 2, 571, 7, 571, 2, 572, 7, 572, 2, 573, 7, 573, 2, 574, 7, 574, 2, 575, 7, 575, 2, 576, 7, 576, 2, 577, 7, 577, 2, 578, 7, 578, 2, 579, 7, 579, 2, 580, 7, 580, 2, 581, 7, 581, 2, 582, 7, 582, 2, 583, 7, 583, 2, 584, 7, 584, 2, 585, 7, 585, 2, 586, 7, 586, 2, 587, 7, 587, 2, 588, 7, 588, 2, 589, 7, 589, 2, 590, 7, 590, 2, 591, 7, 591, 2, 592, 7, 592, 2, 593, 7, 593, 2, 594, 7, 594, 2, 595, 7, 595, 2, 596, 7, 596, 2, 597, 7, 597, 2, 598, 7, 598, 2, 599, 7, 599, 2, 600, 7, 600, 2, 601, 7, 601, 2, 602, 7, 602, 2, 603, 7, 603, 2, 604, 7, 604, 2, 605, 7, 605, 2, 606, 7, 606, 2, 607, 7, 607, 2, 608, 7, 608, 2, 609, 7, 609, 2, 610, 7, 610, 2, 611, 7, 611, 2, 612, 7, 612, 2, 613, 7, 613, 2, 614, 7, 614, 2, 615, 7, 615, 2, 616, 7, 616, 2, 617, 7, 617, 2, 618, 7, 618, 2, 619, 7, 619, 2, 620, 7, 620, 2, 621, 7, 621, 2, 622, 7, 622, 2, 623, 7, 623, 2, 624, 7, 624, 2, 625, 7, 625, 2, 626, 7, 626, 2, 627, 7, 627, 2, 628, 7, 628, 2, 629, 7, 629, 2, 630, 7, 630, 2, 631, 7, 631, 2, 632, 7, 632, 2, 633, 7, 633, 2, 634, 7, 634, 2, 635, 7, 635, 2, 636, 7, 636, 2, 637, 7, 637, 2, 638, 7, 638, 2, 639, 7, 639, 2, 640, 7, 640, 2, 641, 7, 641, 2, 642, 7, 642, 2, 643, 7, 643, 2, 644, 7, 644, 2, 645, 7, 645, 2, 646, 7, 646, 2, 647, 7, 647, 2, 648, 7, 648, 2, 649, 7, 649, 2, 650, 7, 650, 2, 651, 7, 651, 2, 652, 7, 652, 2, 653, 7, 653, 2, 654, 7, 654, 2, 655, 7, 655, 2, 656, 7, 656, 2, 657, 7, 657, 2, 658, 7, 658, 2, 659, 7, 659, 2, 660, 7, 660, 2, 661, 7, 661, 2, 662, 7, 662, 2, 663, 7, 663, 2, 664, 7, 664, 2, 665, 7, 665, 2, 666, 7, 666, 2, 667, 7, 667, 2, 668, 7, 668, 2, 669, 7, 669, 2, 670, 7, 670, 2, 671, 7, 671, 2, 672, 7, 672, 2, 673, 7, 673, 2, 674, 7, 674, 2, 675, 7, 675, 2, 676, 7, 676, 2, 677, 7, 677, 2, 678, 7, 678, 2, 679, 7, 679, 2, 680, 7, 680, 2, 681, 7, 681, 2, 682, 7, 682, 2, 683, 7, 683, 2, 684, 7, 684, 2, 685, 7, 685, 2, 686, 7, 686, 2, 687, 7, 687, 2, 688, 7, 688, 2, 689, 7, 689, 2, 690, 7, 690, 2, 691, 7, 691, 2, 692, 7, 692, 2, 693, 7, 693, 2, 694, 7, 694, 2, 695, 7, 695, 2, 696, 7, 696, 2, 697, 7, 697, 2, 698, 7, 698, 2, 699, 7, 699, 2, 700, 7, 700, 2, 701, 7, 701, 2, 702, 7, 702, 2, 703, 7, 703, 2, 704, 7, 704, 2, 705, 7, 705, 2, 706, 7, 706, 2, 707, 7, 707, 2, 708, 7, 708, 2, 709, 7, 709, 2, 710, 7, 710, 2, 711, 7, 711, 2, 712, 7, 712, 2, 713, 7, 713, 2, 714, 7, 714, 2, 715, 7, 715, 2, 716, 7, 716, 2, 717, 7, 717, 2, 718, 7, 718, 2, 719, 7, 719, 2, 720, 7, 720, 2, 721, 7, 721, 2, 722, 7, 722, 2, 723, 7, 723, 2, 724, 7, 724, 2, 725, 7, 725, 2, 726, 7, 726, 2, 727, 7, 727, 2, 728, 7, 728, 2, 729, 7, 729, 2, 730, 7, 730, 2, 731, 7, 731, 2, 732, 7, 732, 2, 733, 7, 733, 2, 734, 7, 734, 2, 735, 7, 735, 2, 736, 7, 736, 2, 737, 7, 737, 2, 738, 7, 738, 2, 739, 7, 739, 2, 740, 7, 740, 2, 741, 7, 741, 2, 742, 7, 742, 2, 743, 7, 743, 2, 744, 7, 744, 2, 745, 7, 745, 2, 746, 7, 746, 2, 747, 7, 747, 2, 748, 7, 748, 2, 749, 7, 749, 2, 750, 7, 750, 2, 751, 7, 751, 2, 752, 7, 752, 2, 753, 7, 753, 2, 754, 7, 754, 2, 755, 7, 755, 2, 756, 7, 756, 2, 757, 7, 757, 2, 758, 7, 758, 2, 759, 7, 759, 2, 760, 7, 760, 2, 761, 7, 761, 2, 762, 7, 762, 2, 763, 7, 763, 2, 764, 7, 764, 2, 765, 7, 765, 2, 766, 7, 766, 2, 767, 7, 767, 2, 768, 7, 768, 2, 769, 7, 769, 2, 770, 7, 770, 2, 771, 7, 771, 2, 772, 7, 772, 2, 773, 7, 773, 2, 774, 7, 774, 2, 775, 7, 775, 2, 776, 7, 776, 2, 777, 7, 777, 2, 778, 7, 778, 2, 779, 7, 779, 2, 780, 7, 780, 2, 781, 7, 781, 2, 782, 7, 782, 2, 783, 7, 783, 2, 784, 7, 784, 2, 785, 7, 785, 2, 786, 7, 786, 2, 787, 7, 787, 2, 788, 7, 788, 2, 789, 7, 789, 2, 790, 7, 790, 2, 791, 7, 791, 2, 792, 7, 792, 2, 793, 7, 793, 2, 794, 7, 794, 2, 795, 7, 795, 2, 796, 7, 796, 2, 797, 7, 797, 2, 798, 7, 798, 2, 799, 7, 799, 2, 800, 7, 800, 2, 801, 7, 801, 2, 802, 7, 802, 2, 803, 7, 803, 2, 804, 7, 804, 2, 805, 7, 805, 2, 806, 7, 806, 2, 807, 7, 807, 2, 808, 7, 808, 2, 809, 7, 809, 2, 810, 7, 810, 2, 811, 7, 811, 2, 812, 7, 812, 2, 813, 7, 813, 2, 814, 7, 814, 2, 815, 7, 815, 2, 816, 7, 816, 2, 817, 7, 817, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 1646, 8, 3, 5, 3, 1648, 8, 3, 10, 3, 12, 3, 1651, 9, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 1778, 8, 4, 1, 5, 1, 5, 3, 5, 1782, 8, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 1791, 8, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 5, 9, 1798, 8, 9, 10, 9, 12, 9, 1801, 9, 9, 1, 10, 5, 10, 1804, 8, 10, 10, 10, 12, 10, 1807, 9, 10, 1, 11, 1, 11, 1, 11, 3, 11, 1812, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 1827, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 1839, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 1845, 8, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 1853, 8, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 3, 16, 1864, 8, 16, 1, 16, 1, 16, 3, 16, 1868, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 1876, 8, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 1884, 8, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 1902, 8, 21, 1, 21, 3, 21, 1905, 8, 21, 1, 21, 1, 21, 1, 21, 3, 21, 1910, 8, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, 5, 23, 1917, 8, 23, 10, 23, 12, 23, 1920, 9, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 1928, 8, 24, 1, 25, 1, 25, 3, 25, 1932, 8, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 1944, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 1964, 8, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 1977, 8, 28, 1, 29, 1, 29, 1, 29, 5, 29, 1982, 8, 29, 10, 29, 12, 29, 1985, 9, 29, 1, 30, 1, 30, 1, 30, 5, 30, 1990, 8, 30, 10, 30, 12, 30, 1993, 9, 30, 1, 31, 1, 31, 3, 31, 1997, 8, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 3, 32, 2004, 8, 32, 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 2010, 8, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 2017, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 2028, 8, 34, 1, 35, 1, 35, 3, 35, 2032, 8, 35, 1, 36, 1, 36, 3, 36, 2036, 8, 36, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 2049, 8, 38, 1, 39, 1, 39, 3, 39, 2053, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 2058, 8, 40, 1, 41, 1, 41, 1, 41, 3, 41, 2063, 8, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 3, 42, 2075, 8, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 3, 44, 2084, 8, 44, 1, 45, 1, 45, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2097, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2102, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2113, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2119, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2125, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2130, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2141, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2147, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2153, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2162, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2172, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2187, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2193, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2200, 8, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2205, 8, 48, 1, 49, 1, 49, 1, 49, 5, 49, 2210, 8, 49, 10, 49, 12, 49, 2213, 9, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 3, 50, 2223, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2247, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2254, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2263, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2272, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2280, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2290, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2299, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2308, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2316, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2324, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2333, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2342, 8, 52, 1, 52, 1, 52, 3, 52, 2346, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2353, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2361, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2371, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2377, 8, 52, 1, 52, 1, 52, 3, 52, 2381, 8, 52, 1, 52, 1, 52, 3, 52, 2385, 8, 52, 1, 52, 1, 52, 3, 52, 2389, 8, 52, 1, 52, 1, 52, 3, 52, 2393, 8, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2398, 8, 52, 1, 52, 3, 52, 2401, 8, 52, 1, 52, 1, 52, 3, 52, 2405, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2426, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2432, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2531, 8, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 2538, 8, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 3, 57, 2554, 8, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 5, 60, 2566, 8, 60, 10, 60, 12, 60, 2569, 9, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 3, 61, 2578, 8, 61, 3, 61, 2580, 8, 61, 1, 62, 4, 62, 2583, 8, 62, 11, 62, 12, 62, 2584, 1, 63, 1, 63, 3, 63, 2589, 8, 63, 1, 63, 3, 63, 2592, 8, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 2598, 8, 63, 3, 63, 2600, 8, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 3, 64, 2628, 8, 64, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 5, 66, 2636, 8, 66, 10, 66, 12, 66, 2639, 9, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 5, 68, 2649, 8, 68, 10, 68, 12, 68, 2652, 9, 68, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 2658, 8, 69, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 2664, 8, 69, 1, 69, 1, 69, 3, 69, 2668, 8, 69, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 2674, 8, 69, 1, 69, 1, 69, 1, 69, 3, 69, 2679, 8, 69, 1, 69, 3, 69, 2682, 8, 69, 3, 69, 2684, 8, 69, 1, 70, 1, 70, 1, 70, 3, 70, 2689, 8, 70, 1, 71, 1, 71, 3, 71, 2693, 8, 71, 1, 71, 1, 71, 3, 71, 2697, 8, 71, 1, 71, 1, 71, 3, 71, 2701, 8, 71, 1, 71, 1, 71, 3, 71, 2705, 8, 71, 1, 71, 3, 71, 2708, 8, 71, 1, 71, 1, 71, 3, 71, 2712, 8, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, 2720, 8, 71, 1, 71, 1, 71, 3, 71, 2724, 8, 71, 1, 71, 1, 71, 3, 71, 2728, 8, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 3, 74, 2737, 8, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 3, 75, 2744, 8, 75, 1, 76, 5, 76, 2747, 8, 76, 10, 76, 12, 76, 2750, 9, 76, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 2756, 8, 77, 1, 77, 1, 77, 1, 77, 3, 77, 2761, 8, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 2768, 8, 77, 1, 77, 1, 77, 1, 77, 3, 77, 2773, 8, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 2791, 8, 77, 1, 78, 1, 78, 1, 79, 3, 79, 2796, 8, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 5, 81, 2806, 8, 81, 10, 81, 12, 81, 2809, 9, 81, 1, 82, 1, 82, 3, 82, 2813, 8, 82, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 1, 83, 3, 83, 2822, 8, 83, 1, 84, 1, 84, 1, 84, 5, 84, 2827, 8, 84, 10, 84, 12, 84, 2830, 9, 84, 1, 85, 1, 85, 1, 86, 1, 86, 3, 86, 2836, 8, 86, 1, 86, 1, 86, 1, 86, 1, 86, 3, 86, 2842, 8, 86, 1, 86, 1, 86, 1, 86, 3, 86, 2847, 8, 86, 1, 86, 1, 86, 3, 86, 2851, 8, 86, 1, 86, 3, 86, 2854, 8, 86, 1, 86, 3, 86, 2857, 8, 86, 1, 86, 3, 86, 2860, 8, 86, 1, 86, 3, 86, 2863, 8, 86, 1, 86, 3, 86, 2866, 8, 86, 1, 86, 1, 86, 1, 86, 3, 86, 2871, 8, 86, 1, 86, 3, 86, 2874, 8, 86, 1, 86, 3, 86, 2877, 8, 86, 1, 86, 3, 86, 2880, 8, 86, 1, 86, 3, 86, 2883, 8, 86, 1, 86, 3, 86, 2886, 8, 86, 1, 86, 1, 86, 1, 86, 1, 86, 3, 86, 2892, 8, 86, 1, 86, 1, 86, 3, 86, 2896, 8, 86, 1, 86, 3, 86, 2899, 8, 86, 1, 86, 3, 86, 2902, 8, 86, 1, 86, 3, 86, 2905, 8, 86, 1, 86, 3, 86, 2908, 8, 86, 3, 86, 2910, 8, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 3, 87, 2919, 8, 87, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 5, 90, 2930, 8, 90, 10, 90, 12, 90, 2933, 9, 90, 1, 91, 1, 91, 1, 91, 5, 91, 2938, 8, 91, 10, 91, 12, 91, 2941, 9, 91, 1, 92, 1, 92, 1, 92, 3, 92, 2946, 8, 92, 1, 93, 1, 93, 3, 93, 2950, 8, 93, 1, 94, 1, 94, 1, 94, 1, 94, 3, 94, 2956, 8, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 3, 94, 2964, 8, 94, 1, 94, 3, 94, 2967, 8, 94, 1, 94, 1, 94, 3, 94, 2971, 8, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 3, 95, 2999, 8, 95, 1, 96, 1, 96, 1, 96, 3, 96, 3004, 8, 96, 1, 96, 1, 96, 1, 97, 5, 97, 3009, 8, 97, 10, 97, 12, 97, 3012, 9, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 3, 98, 3022, 8, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 3, 99, 3029, 8, 99, 1, 99, 3, 99, 3032, 8, 99, 1, 99, 3, 99, 3035, 8, 99, 1, 99, 1, 99, 1, 99, 3, 99, 3040, 8, 99, 1, 99, 3, 99, 3043, 8, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 3, 99, 3050, 8, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 3, 99, 3059, 8, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 3, 99, 3066, 8, 99, 1, 99, 1, 99, 1, 99, 3, 99, 3071, 8, 99, 1, 99, 3, 99, 3074, 8, 99, 1, 99, 3, 99, 3077, 8, 99, 3, 99, 3079, 8, 99, 1, 100, 1, 100, 3, 100, 3083, 8, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 3, 101, 3090, 8, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 3, 102, 3097, 8, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 5, 104, 3105, 8, 104, 10, 104, 12, 104, 3108, 9, 104, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 106, 1, 106, 3, 106, 3117, 8, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3127, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3133, 8, 107, 1, 107, 3, 107, 3136, 8, 107, 1, 107, 3, 107, 3139, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3146, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3154, 8, 107, 1, 107, 3, 107, 3157, 8, 107, 1, 107, 3, 107, 3160, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3167, 8, 107, 1, 107, 1, 107, 3, 107, 3171, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3177, 8, 107, 1, 107, 3, 107, 3180, 8, 107, 1, 107, 3, 107, 3183, 8, 107, 1, 107, 3, 107, 3186, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3198, 8, 107, 1, 107, 3, 107, 3201, 8, 107, 1, 107, 3, 107, 3204, 8, 107, 1, 107, 1, 107, 3, 107, 3208, 8, 107, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 5, 110, 3220, 8, 110, 10, 110, 12, 110, 3223, 9, 110, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 5, 114, 3238, 8, 114, 10, 114, 12, 114, 3241, 9, 114, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 3, 115, 3251, 8, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 3, 117, 3266, 8, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 3, 120, 3283, 8, 120, 3, 120, 3285, 8, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, 5, 124, 3304, 8, 124, 10, 124, 12, 124, 3307, 9, 124, 1, 125, 1, 125, 3, 125, 3311, 8, 125, 1, 125, 3, 125, 3314, 8, 125, 1, 125, 1, 125, 3, 125, 3318, 8, 125, 1, 125, 3, 125, 3321, 8, 125, 1, 125, 1, 125, 1, 125, 1, 125, 3, 125, 3327, 8, 125, 1, 125, 3, 125, 3330, 8, 125, 3, 125, 3332, 8, 125, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 3, 127, 3341, 8, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 3, 128, 3350, 8, 128, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 3, 132, 3369, 8, 132, 1, 132, 1, 132, 3, 132, 3373, 8, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 3, 133, 3384, 8, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, 3, 134, 3393, 8, 134, 1, 134, 1, 134, 1, 134, 1, 134, 3, 134, 3399, 8, 134, 1, 134, 1, 134, 1, 134, 1, 134, 3, 134, 3405, 8, 134, 1, 135, 1, 135, 3, 135, 3409, 8, 135, 1, 135, 3, 135, 3412, 8, 135, 1, 135, 3, 135, 3415, 8, 135, 1, 135, 3, 135, 3418, 8, 135, 1, 135, 3, 135, 3421, 8, 135, 1, 136, 1, 136, 1, 136, 1, 136, 3, 136, 3427, 8, 136, 1, 137, 1, 137, 3, 137, 3431, 8, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 3, 137, 3438, 8, 137, 1, 137, 1, 137, 1, 137, 1, 137, 3, 137, 3444, 8, 137, 1, 138, 1, 138, 3, 138, 3448, 8, 138, 1, 138, 3, 138, 3451, 8, 138, 1, 138, 3, 138, 3454, 8, 138, 1, 138, 3, 138, 3457, 8, 138, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, 140, 3, 140, 3465, 8, 140, 1, 140, 1, 140, 3, 140, 3469, 8, 140, 1, 141, 1, 141, 3, 141, 3473, 8, 141, 1, 141, 1, 141, 1, 141, 1, 141, 3, 141, 3479, 8, 141, 1, 141, 1, 141, 3, 141, 3483, 8, 141, 1, 142, 1, 142, 1, 142, 1, 142, 3, 142, 3489, 8, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 4, 145, 3501, 8, 145, 11, 145, 12, 145, 3502, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 3, 146, 3512, 8, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 3, 146, 3530, 8, 146, 1, 146, 1, 146, 1, 146, 3, 146, 3535, 8, 146, 1, 146, 3, 146, 3538, 8, 146, 1, 146, 3, 146, 3541, 8, 146, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 3, 148, 3551, 8, 148, 1, 149, 1, 149, 1, 149, 5, 149, 3556, 8, 149, 10, 149, 12, 149, 3559, 9, 149, 1, 150, 1, 150, 3, 150, 3563, 8, 150, 1, 150, 3, 150, 3566, 8, 150, 1, 150, 3, 150, 3569, 8, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, 3, 150, 3576, 8, 150, 1, 150, 3, 150, 3579, 8, 150, 3, 150, 3581, 8, 150, 1, 151, 1, 151, 1, 152, 1, 152, 3, 152, 3587, 8, 152, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 3, 154, 3596, 8, 154, 1, 155, 1, 155, 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 3, 157, 3606, 8, 157, 1, 157, 1, 157, 1, 157, 3, 157, 3611, 8, 157, 1, 158, 1, 158, 1, 158, 1, 159, 1, 159, 1, 159, 1, 159, 3, 159, 3620, 8, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, 160, 1, 160, 1, 160, 3, 160, 3629, 8, 160, 1, 160, 1, 160, 3, 160, 3633, 8, 160, 1, 160, 1, 160, 1, 161, 5, 161, 3638, 8, 161, 10, 161, 12, 161, 3641, 9, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 3, 162, 3650, 8, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 164, 5, 164, 3659, 8, 164, 10, 164, 12, 164, 3662, 9, 164, 1, 165, 1, 165, 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 3, 166, 3771, 8, 166, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 3, 167, 3779, 8, 167, 1, 167, 3, 167, 3782, 8, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 3, 168, 3792, 8, 168, 1, 169, 4, 169, 3795, 8, 169, 11, 169, 12, 169, 3796, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 3, 171, 3807, 8, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 3, 171, 3818, 8, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 5, 173, 3828, 8, 173, 10, 173, 12, 173, 3831, 9, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, 175, 1, 175, 5, 175, 3841, 8, 175, 10, 175, 12, 175, 3844, 9, 175, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 3, 176, 3853, 8, 176, 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 3, 180, 3866, 8, 180, 1, 180, 3, 180, 3869, 8, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 3, 180, 3876, 8, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 3, 180, 3885, 8, 180, 1, 180, 3, 180, 3888, 8, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 3, 180, 3895, 8, 180, 3, 180, 3897, 8, 180, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 3, 182, 3905, 8, 182, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 3, 184, 3915, 8, 184, 3, 184, 3917, 8, 184, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3925, 8, 185, 1, 185, 1, 185, 3, 185, 3929, 8, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3934, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3945, 8, 185, 1, 185, 1, 185, 3, 185, 3949, 8, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3954, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3964, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3970, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3983, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3989, 8, 185, 3, 185, 3991, 8, 185, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 3, 186, 3998, 8, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 3, 186, 4006, 8, 186, 1, 187, 1, 187, 1, 187, 3, 187, 4011, 8, 187, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 3, 189, 4026, 8, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 3, 189, 4039, 8, 189, 3, 189, 4041, 8, 189, 1, 190, 1, 190, 3, 190, 4045, 8, 190, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 3, 191, 4065, 8, 191, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 3, 193, 4082, 8, 193, 1, 193, 3, 193, 4085, 8, 193, 1, 193, 3, 193, 4088, 8, 193, 1, 193, 3, 193, 4091, 8, 193, 1, 193, 3, 193, 4094, 8, 193, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 3, 194, 4102, 8, 194, 1, 194, 3, 194, 4105, 8, 194, 1, 194, 3, 194, 4108, 8, 194, 1, 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 197, 1, 197, 1, 197, 1, 198, 1, 198, 1, 198, 1, 199, 1, 199, 1, 199, 1, 200, 1, 200, 1, 200, 1, 201, 1, 201, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 203, 1, 203, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 3, 204, 4154, 8, 204, 1, 204, 3, 204, 4157, 8, 204, 1, 204, 3, 204, 4160, 8, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 3, 204, 4178, 8, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 3, 204, 4185, 8, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 3, 204, 4194, 8, 204, 1, 205, 1, 205, 1, 205, 1, 205, 3, 205, 4200, 8, 205, 1, 206, 1, 206, 1, 206, 5, 206, 4205, 8, 206, 10, 206, 12, 206, 4208, 9, 206, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 3, 207, 4217, 8, 207, 1, 208, 1, 208, 1, 208, 1, 209, 4, 209, 4223, 8, 209, 11, 209, 12, 209, 4224, 1, 210, 1, 210, 1, 210, 3, 210, 4230, 8, 210, 1, 210, 1, 210, 1, 211, 1, 211, 1, 212, 1, 212, 1, 213, 1, 213, 1, 214, 1, 214, 3, 214, 4242, 8, 214, 1, 214, 1, 214, 1, 215, 1, 215, 1, 216, 1, 216, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 218, 1, 218, 1, 219, 1, 219, 3, 219, 4259, 8, 219, 1, 219, 1, 219, 5, 219, 4263, 8, 219, 10, 219, 12, 219, 4266, 9, 219, 1, 220, 1, 220, 1, 220, 1, 220, 3, 220, 4272, 8, 220, 1, 221, 1, 221, 1, 221, 1, 222, 5, 222, 4278, 8, 222, 10, 222, 12, 222, 4281, 9, 222, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 3, 223, 4294, 8, 223, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 3, 224, 4322, 8, 224, 1, 225, 1, 225, 1, 225, 5, 225, 4327, 8, 225, 10, 225, 12, 225, 4330, 9, 225, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 227, 1, 227, 1, 227, 5, 227, 4341, 8, 227, 10, 227, 12, 227, 4344, 9, 227, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 229, 1, 229, 1, 229, 1, 229, 1, 229, 1, 229, 3, 229, 4358, 8, 229, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 231, 1, 231, 3, 231, 4371, 8, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 3, 231, 4380, 8, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 3, 231, 4405, 8, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 3, 231, 4416, 8, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 3, 231, 4483, 8, 231, 1, 232, 1, 232, 1, 232, 1, 232, 1, 233, 1, 233, 1, 233, 5, 233, 4492, 8, 233, 10, 233, 12, 233, 4495, 9, 233, 1, 234, 1, 234, 1, 234, 3, 234, 4500, 8, 234, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 3, 235, 4508, 8, 235, 1, 236, 1, 236, 1, 236, 1, 236, 1, 237, 1, 237, 1, 237, 5, 237, 4517, 8, 237, 10, 237, 12, 237, 4520, 9, 237, 1, 238, 1, 238, 1, 238, 1, 238, 1, 239, 1, 239, 1, 240, 1, 240, 1, 240, 5, 240, 4531, 8, 240, 10, 240, 12, 240, 4534, 9, 240, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 3, 241, 4542, 8, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 3, 241, 4552, 8, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 3, 241, 4564, 8, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 3, 241, 4579, 8, 241, 1, 242, 1, 242, 1, 242, 1, 242, 1, 243, 1, 243, 1, 243, 1, 243, 1, 243, 3, 243, 4590, 8, 243, 1, 243, 1, 243, 1, 243, 1, 243, 1, 243, 1, 243, 3, 243, 4598, 8, 243, 1, 243, 1, 243, 1, 243, 1, 244, 1, 244, 1, 244, 5, 244, 4606, 8, 244, 10, 244, 12, 244, 4609, 9, 244, 1, 245, 1, 245, 1, 245, 1, 245, 3, 245, 4615, 8, 245, 1, 245, 3, 245, 4618, 8, 245, 1, 245, 1, 245, 1, 245, 1, 245, 3, 245, 4624, 8, 245, 1, 245, 3, 245, 4627, 8, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 3, 245, 4642, 8, 245, 1, 246, 1, 246, 1, 247, 1, 247, 1, 247, 1, 248, 1, 248, 1, 248, 1, 248, 1, 248, 1, 248, 3, 248, 4655, 8, 248, 1, 249, 1, 249, 1, 250, 1, 250, 1, 250, 1, 250, 1, 250, 1, 250, 1, 250, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 3, 251, 4684, 8, 251, 1, 252, 1, 252, 1, 252, 5, 252, 4689, 8, 252, 10, 252, 12, 252, 4692, 9, 252, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 3, 253, 4706, 8, 253, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 3, 254, 4715, 8, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 3, 254, 4726, 8, 254, 3, 254, 4728, 8, 254, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 3, 255, 4737, 8, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 3, 255, 4748, 8, 255, 3, 255, 4750, 8, 255, 1, 256, 1, 256, 1, 256, 1, 256, 1, 256, 3, 256, 4757, 8, 256, 1, 257, 1, 257, 1, 257, 1, 257, 1, 257, 1, 257, 1, 257, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4772, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4778, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4786, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4792, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4800, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4810, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4816, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4824, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4830, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4838, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4845, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4854, 8, 258, 3, 258, 4856, 8, 258, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 3, 259, 4881, 8, 259, 1, 260, 1, 260, 1, 260, 1, 260, 1, 260, 3, 260, 4888, 8, 260, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 3, 261, 4899, 8, 261, 1, 261, 1, 261, 1, 261, 1, 261, 3, 261, 4905, 8, 261, 1, 262, 1, 262, 1, 263, 1, 263, 1, 263, 5, 263, 4912, 8, 263, 10, 263, 12, 263, 4915, 9, 263, 1, 264, 1, 264, 3, 264, 4919, 8, 264, 1, 265, 1, 265, 4, 265, 4923, 8, 265, 11, 265, 12, 265, 4924, 1, 266, 1, 266, 1, 266, 5, 266, 4930, 8, 266, 10, 266, 12, 266, 4933, 9, 266, 1, 267, 1, 267, 3, 267, 4937, 8, 267, 1, 267, 1, 267, 3, 267, 4941, 8, 267, 1, 267, 3, 267, 4944, 8, 267, 1, 268, 1, 268, 1, 268, 1, 268, 3, 268, 4950, 8, 268, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 3, 269, 5099, 8, 269, 1, 270, 1, 270, 3, 270, 5103, 8, 270, 1, 271, 1, 271, 1, 271, 3, 271, 5108, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5119, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5130, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5141, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5152, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5163, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5174, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5185, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5197, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5208, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5216, 8, 271, 1, 272, 1, 272, 1, 272, 1, 273, 1, 273, 3, 273, 5223, 8, 273, 1, 274, 1, 274, 1, 274, 1, 274, 3, 274, 5229, 8, 274, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5237, 8, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5242, 8, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5247, 8, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5252, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5258, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5265, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5271, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5277, 8, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5282, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5288, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5295, 8, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5300, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5306, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5313, 8, 275, 1, 275, 3, 275, 5316, 8, 275, 1, 276, 1, 276, 1, 277, 1, 277, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 3, 278, 5329, 8, 278, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 3, 279, 5338, 8, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 3, 279, 5350, 8, 279, 3, 279, 5352, 8, 279, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 3, 280, 5369, 8, 280, 1, 281, 1, 281, 1, 281, 5, 281, 5374, 8, 281, 10, 281, 12, 281, 5377, 9, 281, 1, 282, 1, 282, 3, 282, 5381, 8, 282, 1, 282, 1, 282, 3, 282, 5385, 8, 282, 1, 282, 1, 282, 3, 282, 5389, 8, 282, 1, 282, 1, 282, 1, 282, 1, 282, 3, 282, 5395, 8, 282, 3, 282, 5397, 8, 282, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 3, 283, 5459, 8, 283, 1, 284, 1, 284, 1, 284, 5, 284, 5464, 8, 284, 10, 284, 12, 284, 5467, 9, 284, 1, 285, 1, 285, 1, 285, 3, 285, 5472, 8, 285, 1, 286, 1, 286, 1, 286, 5, 286, 5477, 8, 286, 10, 286, 12, 286, 5480, 9, 286, 1, 287, 1, 287, 1, 287, 3, 287, 5485, 8, 287, 1, 288, 1, 288, 1, 288, 1, 288, 1, 289, 1, 289, 1, 289, 1, 289, 1, 289, 3, 289, 5496, 8, 289, 1, 289, 3, 289, 5499, 8, 289, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 3, 290, 5506, 8, 290, 1, 290, 3, 290, 5509, 8, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 3, 290, 5519, 8, 290, 1, 290, 3, 290, 5522, 8, 290, 3, 290, 5524, 8, 290, 1, 291, 1, 291, 1, 291, 1, 291, 1, 292, 1, 292, 1, 292, 1, 292, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, 1, 294, 5, 294, 5541, 8, 294, 10, 294, 12, 294, 5544, 9, 294, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 3, 295, 5555, 8, 295, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 3, 296, 5564, 8, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 3, 296, 5573, 8, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 3, 296, 5585, 8, 296, 3, 296, 5587, 8, 296, 1, 297, 1, 297, 1, 298, 1, 298, 3, 298, 5593, 8, 298, 1, 298, 1, 298, 3, 298, 5597, 8, 298, 1, 298, 1, 298, 1, 298, 3, 298, 5602, 8, 298, 1, 298, 3, 298, 5605, 8, 298, 1, 298, 1, 298, 1, 298, 3, 298, 5610, 8, 298, 1, 298, 1, 298, 1, 298, 1, 298, 3, 298, 5616, 8, 298, 1, 298, 3, 298, 5619, 8, 298, 1, 298, 3, 298, 5622, 8, 298, 1, 298, 3, 298, 5625, 8, 298, 1, 298, 3, 298, 5628, 8, 298, 1, 299, 1, 299, 1, 300, 1, 300, 1, 301, 1, 301, 1, 302, 1, 302, 1, 302, 1, 303, 1, 303, 1, 303, 5, 303, 5642, 8, 303, 10, 303, 12, 303, 5645, 9, 303, 1, 304, 3, 304, 5648, 8, 304, 1, 304, 3, 304, 5651, 8, 304, 1, 304, 3, 304, 5654, 8, 304, 1, 304, 3, 304, 5657, 8, 304, 1, 304, 3, 304, 5660, 8, 304, 1, 304, 1, 304, 1, 304, 3, 304, 5665, 8, 304, 1, 304, 3, 304, 5668, 8, 304, 3, 304, 5670, 8, 304, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 3, 305, 5683, 8, 305, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 307, 1, 307, 1, 307, 5, 307, 5693, 8, 307, 10, 307, 12, 307, 5696, 9, 307, 1, 308, 1, 308, 1, 308, 1, 309, 1, 309, 1, 310, 1, 310, 1, 311, 1, 311, 1, 311, 1, 311, 3, 311, 5709, 8, 311, 1, 312, 1, 312, 3, 312, 5713, 8, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 3, 312, 5725, 8, 312, 3, 312, 5727, 8, 312, 1, 312, 1, 312, 1, 313, 1, 313, 1, 313, 1, 314, 1, 314, 3, 314, 5736, 8, 314, 1, 314, 1, 314, 1, 315, 1, 315, 1, 315, 5, 315, 5743, 8, 315, 10, 315, 12, 315, 5746, 9, 315, 1, 316, 1, 316, 1, 316, 5, 316, 5751, 8, 316, 10, 316, 12, 316, 5754, 9, 316, 1, 317, 1, 317, 1, 317, 1, 317, 1, 317, 1, 317, 3, 317, 5762, 8, 317, 3, 317, 5764, 8, 317, 1, 318, 1, 318, 3, 318, 5768, 8, 318, 1, 318, 1, 318, 1, 319, 1, 319, 1, 319, 5, 319, 5775, 8, 319, 10, 319, 12, 319, 5778, 9, 319, 1, 320, 1, 320, 3, 320, 5782, 8, 320, 1, 320, 1, 320, 1, 320, 1, 320, 3, 320, 5788, 8, 320, 1, 320, 1, 320, 1, 320, 3, 320, 5793, 8, 320, 1, 321, 1, 321, 3, 321, 5797, 8, 321, 1, 321, 1, 321, 1, 321, 3, 321, 5802, 8, 321, 1, 322, 1, 322, 1, 322, 1, 322, 3, 322, 5808, 8, 322, 1, 323, 1, 323, 1, 324, 1, 324, 3, 324, 5814, 8, 324, 1, 324, 1, 324, 1, 324, 1, 324, 3, 324, 5820, 8, 324, 1, 324, 1, 324, 1, 324, 1, 324, 3, 324, 5826, 8, 324, 1, 325, 1, 325, 1, 325, 3, 325, 5831, 8, 325, 1, 326, 1, 326, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 3, 327, 5846, 8, 327, 1, 327, 1, 327, 1, 328, 1, 328, 1, 328, 5, 328, 5853, 8, 328, 10, 328, 12, 328, 5856, 9, 328, 1, 329, 1, 329, 1, 329, 1, 330, 1, 330, 1, 330, 5, 330, 5864, 8, 330, 10, 330, 12, 330, 5867, 9, 330, 1, 331, 4, 331, 5870, 8, 331, 11, 331, 12, 331, 5871, 1, 331, 1, 331, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 3, 332, 5911, 8, 332, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 3, 333, 5926, 8, 333, 1, 334, 1, 334, 1, 334, 1, 334, 1, 334, 3, 334, 5933, 8, 334, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 5, 335, 5942, 8, 335, 10, 335, 12, 335, 5945, 9, 335, 1, 336, 1, 336, 1, 336, 1, 337, 1, 337, 1, 337, 1, 338, 1, 338, 1, 338, 5, 338, 5956, 8, 338, 10, 338, 12, 338, 5959, 9, 338, 1, 339, 1, 339, 1, 339, 1, 339, 1, 339, 3, 339, 5966, 8, 339, 1, 340, 4, 340, 5969, 8, 340, 11, 340, 12, 340, 5970, 1, 341, 1, 341, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 5979, 8, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 5987, 8, 342, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 5993, 8, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 6001, 8, 342, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 6007, 8, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 6015, 8, 342, 3, 342, 6017, 8, 342, 1, 343, 1, 343, 1, 343, 1, 343, 3, 343, 6023, 8, 343, 1, 343, 1, 343, 1, 343, 1, 343, 1, 343, 1, 343, 3, 343, 6031, 8, 343, 3, 343, 6033, 8, 343, 1, 344, 1, 344, 1, 344, 1, 344, 3, 344, 6039, 8, 344, 1, 344, 1, 344, 1, 344, 1, 344, 1, 344, 1, 344, 3, 344, 6047, 8, 344, 3, 344, 6049, 8, 344, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 3, 345, 6073, 8, 345, 1, 346, 1, 346, 1, 346, 5, 346, 6078, 8, 346, 10, 346, 12, 346, 6081, 9, 346, 1, 346, 1, 346, 1, 347, 1, 347, 1, 347, 5, 347, 6088, 8, 347, 10, 347, 12, 347, 6091, 9, 347, 1, 348, 1, 348, 1, 348, 1, 349, 1, 349, 1, 349, 1, 350, 4, 350, 6100, 8, 350, 11, 350, 12, 350, 6101, 1, 351, 1, 351, 1, 351, 3, 351, 6107, 8, 351, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 3, 352, 6120, 8, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 3, 352, 6132, 8, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 3, 352, 6144, 8, 352, 3, 352, 6146, 8, 352, 1, 353, 1, 353, 1, 353, 1, 353, 3, 353, 6152, 8, 353, 1, 354, 1, 354, 1, 354, 3, 354, 6157, 8, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 3, 354, 6165, 8, 354, 1, 355, 1, 355, 1, 355, 1, 356, 1, 356, 3, 356, 6172, 8, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 3, 357, 6217, 8, 357, 1, 358, 1, 358, 1, 358, 3, 358, 6222, 8, 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 358, 3, 358, 6229, 8, 358, 1, 359, 1, 359, 1, 359, 3, 359, 6234, 8, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 3, 359, 6241, 8, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 3, 359, 6251, 8, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 3, 359, 6261, 8, 359, 1, 359, 1, 359, 3, 359, 6265, 8, 359, 1, 360, 1, 360, 1, 361, 1, 361, 1, 362, 1, 362, 1, 362, 5, 362, 6274, 8, 362, 10, 362, 12, 362, 6277, 9, 362, 1, 363, 1, 363, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 3, 364, 6293, 8, 364, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6364, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6559, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6572, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6583, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6596, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6608, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6622, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6654, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6668, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6780, 8, 365, 3, 365, 6782, 8, 365, 1, 366, 1, 366, 1, 367, 1, 367, 1, 367, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6793, 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6804, 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6815, 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6828, 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6840, 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6851, 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6858, 8, 368, 1, 369, 1, 369, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 3, 370, 7079, 8, 370, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 372, 1, 372, 1, 372, 5, 372, 7092, 8, 372, 10, 372, 12, 372, 7095, 9, 372, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 373, 3, 373, 7105, 8, 373, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 3, 374, 7112, 8, 374, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 3, 376, 7166, 8, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 3, 376, 7307, 8, 376, 1, 377, 1, 377, 1, 377, 1, 377, 3, 377, 7313, 8, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 3, 377, 7322, 8, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 3, 377, 7330, 8, 377, 3, 377, 7332, 8, 377, 1, 378, 1, 378, 1, 378, 5, 378, 7337, 8, 378, 10, 378, 12, 378, 7340, 9, 378, 1, 379, 1, 379, 1, 379, 3, 379, 7345, 8, 379, 1, 379, 3, 379, 7348, 8, 379, 1, 379, 1, 379, 1, 379, 1, 379, 1, 379, 3, 379, 7355, 8, 379, 1, 379, 1, 379, 3, 379, 7359, 8, 379, 1, 379, 3, 379, 7362, 8, 379, 1, 379, 1, 379, 1, 379, 3, 379, 7367, 8, 379, 1, 379, 3, 379, 7370, 8, 379, 1, 379, 1, 379, 3, 379, 7374, 8, 379, 1, 379, 3, 379, 7377, 8, 379, 1, 379, 3, 379, 7380, 8, 379, 1, 380, 1, 380, 1, 380, 1, 380, 1, 380, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 3, 381, 7411, 8, 381, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 3, 382, 7421, 8, 382, 1, 383, 1, 383, 1, 383, 5, 383, 7426, 8, 383, 10, 383, 12, 383, 7429, 9, 383, 1, 384, 1, 384, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 3, 385, 7451, 8, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 3, 385, 7460, 8, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 3, 385, 7478, 8, 385, 1, 386, 1, 386, 1, 386, 1, 386, 3, 386, 7484, 8, 386, 1, 386, 1, 386, 1, 386, 1, 386, 1, 386, 1, 386, 3, 386, 7492, 8, 386, 3, 386, 7494, 8, 386, 1, 387, 1, 387, 3, 387, 7498, 8, 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 387, 3, 387, 7508, 8, 387, 1, 387, 1, 387, 3, 387, 7512, 8, 387, 1, 387, 1, 387, 1, 388, 1, 388, 1, 388, 1, 388, 1, 388, 1, 388, 3, 388, 7522, 8, 388, 1, 389, 3, 389, 7525, 8, 389, 1, 389, 1, 389, 3, 389, 7529, 8, 389, 5, 389, 7531, 8, 389, 10, 389, 12, 389, 7534, 9, 389, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 3, 390, 7541, 8, 390, 1, 391, 1, 391, 1, 392, 1, 392, 1, 393, 1, 393, 1, 394, 1, 394, 1, 394, 3, 394, 7552, 8, 394, 1, 395, 1, 395, 1, 395, 1, 396, 1, 396, 1, 396, 1, 397, 1, 397, 1, 397, 1, 397, 3, 397, 7564, 8, 397, 1, 398, 1, 398, 3, 398, 7568, 8, 398, 1, 398, 3, 398, 7571, 8, 398, 1, 398, 1, 398, 3, 398, 7575, 8, 398, 1, 398, 3, 398, 7578, 8, 398, 1, 398, 1, 398, 1, 398, 3, 398, 7583, 8, 398, 1, 398, 1, 398, 3, 398, 7587, 8, 398, 1, 398, 3, 398, 7590, 8, 398, 1, 398, 1, 398, 3, 398, 7594, 8, 398, 1, 398, 3, 398, 7597, 8, 398, 1, 398, 1, 398, 3, 398, 7601, 8, 398, 1, 398, 3, 398, 7604, 8, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 3, 398, 7615, 8, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 3, 398, 7622, 8, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 3, 398, 7635, 8, 398, 1, 399, 1, 399, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 3, 400, 7649, 8, 400, 1, 401, 1, 401, 3, 401, 7653, 8, 401, 1, 401, 5, 401, 7656, 8, 401, 10, 401, 12, 401, 7659, 9, 401, 1, 402, 1, 402, 1, 403, 1, 403, 3, 403, 7665, 8, 403, 1, 403, 1, 403, 1, 404, 1, 404, 1, 404, 3, 404, 7672, 8, 404, 1, 404, 3, 404, 7675, 8, 404, 1, 404, 1, 404, 1, 404, 3, 404, 7680, 8, 404, 1, 404, 3, 404, 7683, 8, 404, 1, 404, 1, 404, 1, 404, 1, 404, 1, 404, 1, 404, 1, 404, 3, 404, 7692, 8, 404, 3, 404, 7694, 8, 404, 1, 404, 1, 404, 1, 404, 3, 404, 7699, 8, 404, 1, 405, 1, 405, 3, 405, 7703, 8, 405, 1, 405, 1, 405, 1, 405, 1, 406, 1, 406, 1, 406, 1, 407, 1, 407, 1, 407, 1, 407, 3, 407, 7715, 8, 407, 1, 407, 3, 407, 7718, 8, 407, 1, 408, 1, 408, 1, 409, 4, 409, 7723, 8, 409, 11, 409, 12, 409, 7724, 1, 410, 1, 410, 3, 410, 7729, 8, 410, 1, 410, 1, 410, 1, 410, 3, 410, 7734, 8, 410, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, 3, 411, 7744, 8, 411, 1, 412, 1, 412, 1, 413, 1, 413, 1, 413, 1, 413, 1, 413, 3, 413, 7753, 8, 413, 1, 413, 3, 413, 7756, 8, 413, 1, 413, 1, 413, 1, 413, 1, 413, 1, 413, 1, 413, 3, 413, 7764, 8, 413, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, 415, 1, 415, 1, 415, 1, 415, 3, 415, 7775, 8, 415, 1, 415, 1, 415, 3, 415, 7779, 8, 415, 1, 415, 1, 415, 1, 415, 1, 415, 3, 415, 7785, 8, 415, 1, 416, 1, 416, 1, 416, 5, 416, 7790, 8, 416, 10, 416, 12, 416, 7793, 9, 416, 1, 417, 1, 417, 1, 418, 1, 418, 1, 418, 1, 418, 1, 418, 1, 418, 1, 419, 1, 419, 1, 419, 1, 419, 1, 419, 1, 420, 1, 420, 1, 420, 1, 420, 3, 420, 7812, 8, 420, 1, 420, 1, 420, 1, 420, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 3, 421, 7833, 8, 421, 1, 421, 1, 421, 3, 421, 7837, 8, 421, 1, 421, 1, 421, 1, 421, 3, 421, 7842, 8, 421, 1, 422, 1, 422, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 3, 424, 7925, 8, 424, 1, 425, 1, 425, 1, 426, 1, 426, 3, 426, 7931, 8, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 427, 1, 427, 3, 427, 7944, 8, 427, 1, 427, 1, 427, 3, 427, 7948, 8, 427, 1, 427, 1, 427, 3, 427, 7952, 8, 427, 1, 427, 1, 427, 3, 427, 7956, 8, 427, 1, 427, 1, 427, 1, 427, 1, 427, 3, 427, 7962, 8, 427, 1, 428, 1, 428, 1, 428, 1, 429, 1, 429, 3, 429, 7969, 8, 429, 1, 429, 3, 429, 7972, 8, 429, 1, 429, 3, 429, 7975, 8, 429, 1, 429, 3, 429, 7978, 8, 429, 1, 429, 3, 429, 7981, 8, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 3, 429, 7988, 8, 429, 3, 429, 7990, 8, 429, 1, 430, 1, 430, 3, 430, 7994, 8, 430, 1, 430, 3, 430, 7997, 8, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 3, 430, 8004, 8, 430, 3, 430, 8006, 8, 430, 1, 431, 1, 431, 1, 431, 5, 431, 8011, 8, 431, 10, 431, 12, 431, 8014, 9, 431, 1, 432, 1, 432, 1, 433, 1, 433, 3, 433, 8020, 8, 433, 1, 434, 1, 434, 3, 434, 8024, 8, 434, 1, 435, 1, 435, 3, 435, 8028, 8, 435, 1, 436, 1, 436, 1, 437, 1, 437, 1, 438, 1, 438, 1, 439, 1, 439, 1, 440, 1, 440, 1, 440, 1, 440, 1, 441, 1, 441, 3, 441, 8044, 8, 441, 1, 442, 1, 442, 1, 442, 5, 442, 8049, 8, 442, 10, 442, 12, 442, 8052, 9, 442, 1, 443, 1, 443, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 3, 444, 8061, 8, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 3, 444, 8074, 8, 444, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 3, 445, 8085, 8, 445, 1, 446, 1, 446, 1, 446, 5, 446, 8090, 8, 446, 10, 446, 12, 446, 8093, 9, 446, 1, 447, 1, 447, 3, 447, 8097, 8, 447, 1, 448, 1, 448, 3, 448, 8101, 8, 448, 1, 449, 1, 449, 3, 449, 8105, 8, 449, 1, 450, 1, 450, 1, 450, 3, 450, 8110, 8, 450, 1, 450, 1, 450, 1, 450, 1, 451, 1, 451, 1, 451, 1, 451, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 3, 452, 8124, 8, 452, 1, 453, 1, 453, 1, 453, 3, 453, 8129, 8, 453, 1, 453, 1, 453, 3, 453, 8133, 8, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 3, 453, 8141, 8, 453, 1, 453, 3, 453, 8144, 8, 453, 1, 453, 1, 453, 3, 453, 8148, 8, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 3, 453, 8159, 8, 453, 1, 453, 3, 453, 8162, 8, 453, 3, 453, 8164, 8, 453, 1, 454, 1, 454, 1, 454, 1, 454, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 3, 455, 8180, 8, 455, 1, 456, 3, 456, 8183, 8, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 3, 456, 8190, 8, 456, 1, 456, 3, 456, 8193, 8, 456, 1, 457, 1, 457, 1, 457, 3, 457, 8198, 8, 457, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 3, 458, 8213, 8, 458, 1, 458, 1, 458, 1, 458, 1, 458, 3, 458, 8219, 8, 458, 1, 459, 1, 459, 1, 460, 1, 460, 1, 460, 5, 460, 8226, 8, 460, 10, 460, 12, 460, 8229, 9, 460, 1, 461, 1, 461, 1, 461, 1, 462, 1, 462, 1, 462, 3, 462, 8237, 8, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 3, 462, 8244, 8, 462, 1, 462, 3, 462, 8247, 8, 462, 1, 463, 1, 463, 1, 463, 1, 463, 3, 463, 8253, 8, 463, 1, 463, 1, 463, 1, 463, 3, 463, 8258, 8, 463, 1, 464, 1, 464, 1, 464, 1, 465, 3, 465, 8264, 8, 465, 1, 465, 1, 465, 1, 465, 3, 465, 8269, 8, 465, 1, 465, 1, 465, 3, 465, 8273, 8, 465, 1, 465, 1, 465, 1, 465, 3, 465, 8278, 8, 465, 1, 465, 3, 465, 8281, 8, 465, 1, 465, 1, 465, 1, 465, 1, 465, 3, 465, 8287, 8, 465, 1, 465, 1, 465, 3, 465, 8291, 8, 465, 3, 465, 8293, 8, 465, 1, 465, 3, 465, 8296, 8, 465, 1, 466, 1, 466, 1, 466, 1, 466, 1, 466, 3, 466, 8303, 8, 466, 1, 466, 3, 466, 8306, 8, 466, 1, 466, 1, 466, 1, 466, 1, 466, 1, 466, 3, 466, 8313, 8, 466, 1, 466, 1, 466, 1, 467, 1, 467, 1, 467, 1, 467, 3, 467, 8321, 8, 467, 1, 467, 3, 467, 8324, 8, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, 468, 1, 468, 1, 468, 3, 468, 8333, 8, 468, 1, 468, 1, 468, 1, 469, 3, 469, 8338, 8, 469, 1, 469, 1, 469, 1, 469, 1, 469, 3, 469, 8344, 8, 469, 1, 469, 3, 469, 8347, 8, 469, 1, 469, 3, 469, 8350, 8, 469, 1, 470, 1, 470, 1, 470, 1, 471, 1, 471, 3, 471, 8357, 8, 471, 1, 471, 1, 471, 3, 471, 8361, 8, 471, 1, 471, 3, 471, 8364, 8, 471, 1, 472, 1, 472, 1, 472, 1, 472, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 3, 473, 8379, 8, 473, 1, 473, 3, 473, 8382, 8, 473, 1, 474, 1, 474, 1, 475, 1, 475, 1, 475, 3, 475, 8389, 8, 475, 1, 476, 3, 476, 8392, 8, 476, 1, 476, 1, 476, 1, 476, 1, 476, 1, 476, 3, 476, 8399, 8, 476, 1, 476, 3, 476, 8402, 8, 476, 1, 476, 3, 476, 8405, 8, 476, 1, 477, 1, 477, 1, 477, 5, 477, 8410, 8, 477, 10, 477, 12, 477, 8413, 9, 477, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 3, 478, 8425, 8, 478, 1, 479, 1, 479, 1, 479, 1, 480, 1, 480, 1, 480, 5, 480, 8433, 8, 480, 10, 480, 12, 480, 8436, 9, 480, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 3, 481, 8443, 8, 481, 1, 481, 1, 481, 1, 481, 1, 482, 1, 482, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 5, 483, 8455, 8, 483, 10, 483, 12, 483, 8458, 9, 483, 1, 484, 1, 484, 1, 484, 1, 484, 3, 484, 8464, 8, 484, 1, 485, 1, 485, 3, 485, 8468, 8, 485, 1, 486, 1, 486, 1, 486, 1, 486, 1, 486, 1, 486, 1, 486, 1, 486, 3, 486, 8478, 8, 486, 1, 487, 1, 487, 3, 487, 8482, 8, 487, 1, 487, 1, 487, 3, 487, 8486, 8, 487, 1, 487, 1, 487, 3, 487, 8490, 8, 487, 3, 487, 8492, 8, 487, 1, 487, 1, 487, 1, 487, 3, 487, 8497, 8, 487, 1, 487, 1, 487, 3, 487, 8501, 8, 487, 1, 487, 1, 487, 3, 487, 8505, 8, 487, 3, 487, 8507, 8, 487, 3, 487, 8509, 8, 487, 1, 488, 1, 488, 1, 488, 3, 488, 8514, 8, 488, 1, 488, 5, 488, 8517, 8, 488, 10, 488, 12, 488, 8520, 9, 488, 1, 489, 1, 489, 1, 489, 3, 489, 8525, 8, 489, 1, 489, 5, 489, 8528, 8, 489, 10, 489, 12, 489, 8531, 9, 489, 1, 490, 1, 490, 3, 490, 8535, 8, 490, 1, 490, 3, 490, 8538, 8, 490, 1, 490, 3, 490, 8541, 8, 490, 1, 490, 1, 490, 1, 490, 3, 490, 8546, 8, 490, 1, 490, 3, 490, 8549, 8, 490, 1, 490, 3, 490, 8552, 8, 490, 1, 490, 3, 490, 8555, 8, 490, 1, 490, 3, 490, 8558, 8, 490, 1, 490, 3, 490, 8561, 8, 490, 1, 490, 3, 490, 8564, 8, 490, 1, 490, 1, 490, 1, 490, 1, 490, 3, 490, 8570, 8, 490, 1, 491, 1, 491, 3, 491, 8574, 8, 491, 1, 491, 1, 491, 1, 492, 1, 492, 1, 492, 5, 492, 8581, 8, 492, 10, 492, 12, 492, 8584, 9, 492, 1, 493, 1, 493, 3, 493, 8588, 8, 493, 1, 493, 1, 493, 3, 493, 8592, 8, 493, 1, 493, 1, 493, 1, 493, 1, 493, 1, 494, 1, 494, 1, 494, 3, 494, 8601, 8, 494, 1, 495, 1, 495, 1, 496, 1, 496, 3, 496, 8607, 8, 496, 1, 496, 1, 496, 3, 496, 8611, 8, 496, 1, 497, 1, 497, 1, 498, 3, 498, 8616, 8, 498, 1, 498, 1, 498, 3, 498, 8620, 8, 498, 1, 498, 1, 498, 1, 498, 3, 498, 8625, 8, 498, 1, 498, 1, 498, 1, 498, 1, 498, 3, 498, 8631, 8, 498, 1, 499, 1, 499, 1, 500, 1, 500, 1, 501, 1, 501, 1, 501, 1, 501, 1, 501, 1, 501, 3, 501, 8643, 8, 501, 1, 502, 1, 502, 1, 503, 1, 503, 1, 504, 1, 504, 1, 504, 1, 504, 1, 505, 1, 505, 1, 505, 5, 505, 8656, 8, 505, 10, 505, 12, 505, 8659, 9, 505, 1, 506, 1, 506, 1, 506, 1, 506, 3, 506, 8665, 8, 506, 3, 506, 8667, 8, 506, 1, 506, 3, 506, 8670, 8, 506, 1, 507, 1, 507, 3, 507, 8674, 8, 507, 1, 507, 1, 507, 3, 507, 8678, 8, 507, 3, 507, 8680, 8, 507, 1, 508, 1, 508, 1, 509, 1, 509, 1, 509, 1, 509, 3, 509, 8688, 8, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 3, 509, 8697, 8, 509, 1, 509, 1, 509, 1, 509, 1, 509, 3, 509, 8703, 8, 509, 3, 509, 8705, 8, 509, 3, 509, 8707, 8, 509, 1, 510, 1, 510, 1, 510, 1, 510, 1, 510, 3, 510, 8714, 8, 510, 1, 511, 1, 511, 3, 511, 8718, 8, 511, 1, 512, 1, 512, 1, 513, 1, 513, 1, 513, 1, 513, 1, 513, 3, 513, 8727, 8, 513, 1, 514, 1, 514, 3, 514, 8731, 8, 514, 1, 515, 1, 515, 1, 516, 1, 516, 1, 517, 1, 517, 1, 517, 1, 517, 1, 518, 1, 518, 1, 518, 5, 518, 8744, 8, 518, 10, 518, 12, 518, 8747, 9, 518, 1, 519, 1, 519, 1, 519, 1, 519, 1, 519, 3, 519, 8754, 8, 519, 1, 520, 1, 520, 1, 520, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 523, 1, 523, 1, 523, 1, 523, 1, 523, 1, 523, 1, 524, 1, 524, 1, 524, 1, 525, 1, 525, 1, 525, 1, 525, 3, 525, 8782, 8, 525, 1, 526, 1, 526, 1, 527, 4, 527, 8787, 8, 527, 11, 527, 12, 527, 8788, 1, 528, 1, 528, 3, 528, 8793, 8, 528, 1, 528, 3, 528, 8796, 8, 528, 1, 529, 1, 529, 1, 529, 3, 529, 8801, 8, 529, 1, 529, 1, 529, 3, 529, 8805, 8, 529, 1, 529, 3, 529, 8808, 8, 529, 1, 530, 1, 530, 1, 530, 1, 531, 1, 531, 1, 531, 1, 531, 1, 531, 1, 531, 1, 531, 1, 531, 1, 531, 5, 531, 8822, 8, 531, 10, 531, 12, 531, 8825, 9, 531, 1, 532, 1, 532, 1, 532, 1, 533, 1, 533, 1, 533, 5, 533, 8833, 8, 533, 10, 533, 12, 533, 8836, 9, 533, 1, 534, 1, 534, 3, 534, 8840, 8, 534, 1, 534, 3, 534, 8843, 8, 534, 1, 534, 1, 534, 3, 534, 8847, 8, 534, 1, 534, 1, 534, 3, 534, 8851, 8, 534, 1, 534, 1, 534, 3, 534, 8855, 8, 534, 1, 534, 1, 534, 1, 534, 3, 534, 8860, 8, 534, 1, 534, 1, 534, 3, 534, 8864, 8, 534, 1, 534, 1, 534, 3, 534, 8868, 8, 534, 3, 534, 8870, 8, 534, 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 3, 534, 8879, 8, 534, 1, 534, 1, 534, 1, 534, 3, 534, 8884, 8, 534, 1, 534, 1, 534, 1, 534, 1, 534, 3, 534, 8890, 8, 534, 1, 534, 1, 534, 3, 534, 8894, 8, 534, 3, 534, 8896, 8, 534, 1, 534, 5, 534, 8899, 8, 534, 10, 534, 12, 534, 8902, 9, 534, 1, 535, 3, 535, 8905, 8, 535, 1, 535, 1, 535, 1, 535, 1, 535, 1, 535, 1, 535, 1, 535, 1, 535, 1, 535, 3, 535, 8916, 8, 535, 1, 535, 1, 535, 3, 535, 8920, 8, 535, 1, 536, 3, 536, 8923, 8, 536, 1, 536, 1, 536, 1, 536, 1, 536, 1, 536, 3, 536, 8930, 8, 536, 1, 537, 1, 537, 1, 538, 3, 538, 8935, 8, 538, 1, 538, 1, 538, 1, 538, 1, 538, 1, 538, 3, 538, 8942, 8, 538, 1, 539, 1, 539, 1, 539, 3, 539, 8947, 8, 539, 1, 539, 3, 539, 8950, 8, 539, 1, 539, 1, 539, 1, 539, 1, 539, 3, 539, 8956, 8, 539, 1, 540, 1, 540, 3, 540, 8960, 8, 540, 1, 541, 1, 541, 1, 541, 1, 541, 1, 541, 1, 541, 1, 541, 3, 541, 8969, 8, 541, 1, 542, 1, 542, 3, 542, 8973, 8, 542, 1, 542, 1, 542, 1, 542, 1, 542, 1, 542, 1, 542, 3, 542, 8981, 8, 542, 3, 542, 8983, 8, 542, 1, 543, 1, 543, 1, 543, 5, 543, 8988, 8, 543, 10, 543, 12, 543, 8991, 9, 543, 1, 544, 1, 544, 3, 544, 8995, 8, 544, 1, 544, 3, 544, 8998, 8, 544, 1, 545, 1, 545, 1, 545, 1, 545, 1, 545, 1, 545, 3, 545, 9006, 8, 545, 1, 546, 1, 546, 1, 546, 1, 546, 1, 546, 1, 547, 1, 547, 3, 547, 9015, 8, 547, 1, 547, 1, 547, 1, 547, 1, 547, 1, 547, 1, 547, 3, 547, 9023, 8, 547, 3, 547, 9025, 8, 547, 1, 548, 1, 548, 3, 548, 9029, 8, 548, 1, 549, 1, 549, 1, 549, 5, 549, 9034, 8, 549, 10, 549, 12, 549, 9037, 9, 549, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 551, 1, 551, 1, 551, 1, 552, 1, 552, 1, 552, 1, 553, 1, 553, 1, 553, 1, 553, 1, 553, 3, 553, 9055, 8, 553, 1, 554, 1, 554, 1, 555, 1, 555, 1, 555, 5, 555, 9062, 8, 555, 10, 555, 12, 555, 9065, 9, 555, 1, 556, 1, 556, 1, 556, 3, 556, 9070, 8, 556, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 3, 557, 9089, 8, 557, 1, 557, 1, 557, 1, 558, 1, 558, 1, 558, 5, 558, 9096, 8, 558, 10, 558, 12, 558, 9099, 9, 558, 1, 559, 1, 559, 1, 559, 3, 559, 9104, 8, 559, 1, 559, 1, 559, 3, 559, 9108, 8, 559, 1, 560, 4, 560, 9111, 8, 560, 11, 560, 12, 560, 9112, 1, 561, 1, 561, 1, 561, 1, 561, 1, 561, 1, 561, 1, 561, 1, 561, 3, 561, 9123, 8, 561, 1, 562, 1, 562, 1, 562, 5, 562, 9128, 8, 562, 10, 562, 12, 562, 9131, 9, 562, 1, 563, 1, 563, 1, 563, 1, 563, 1, 563, 1, 563, 3, 563, 9139, 8, 563, 1, 564, 3, 564, 9142, 8, 564, 1, 564, 1, 564, 1, 564, 1, 564, 1, 564, 1, 564, 1, 564, 3, 564, 9151, 8, 564, 3, 564, 9153, 8, 564, 1, 564, 1, 564, 1, 564, 1, 564, 3, 564, 9159, 8, 564, 1, 565, 1, 565, 3, 565, 9163, 8, 565, 1, 565, 5, 565, 9166, 8, 565, 10, 565, 12, 565, 9169, 9, 565, 1, 566, 1, 566, 1, 566, 1, 566, 1, 566, 1, 566, 1, 566, 3, 566, 9178, 8, 566, 1, 566, 1, 566, 1, 566, 1, 566, 3, 566, 9184, 8, 566, 3, 566, 9186, 8, 566, 1, 567, 1, 567, 1, 567, 1, 567, 3, 567, 9192, 8, 567, 1, 568, 1, 568, 1, 568, 1, 568, 3, 568, 9198, 8, 568, 1, 568, 3, 568, 9201, 8, 568, 1, 568, 3, 568, 9204, 8, 568, 1, 569, 1, 569, 1, 569, 1, 569, 1, 570, 1, 570, 1, 570, 1, 570, 1, 570, 1, 570, 1, 570, 3, 570, 9217, 8, 570, 1, 570, 1, 570, 1, 570, 1, 570, 3, 570, 9223, 8, 570, 1, 570, 1, 570, 3, 570, 9227, 8, 570, 1, 570, 1, 570, 3, 570, 9231, 8, 570, 1, 570, 3, 570, 9234, 8, 570, 1, 571, 1, 571, 1, 571, 1, 571, 1, 572, 1, 572, 3, 572, 9242, 8, 572, 1, 573, 1, 573, 3, 573, 9246, 8, 573, 1, 574, 1, 574, 3, 574, 9250, 8, 574, 1, 574, 1, 574, 1, 574, 1, 574, 1, 575, 1, 575, 3, 575, 9258, 8, 575, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 3, 576, 9265, 8, 576, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 3, 577, 9272, 8, 577, 1, 578, 1, 578, 3, 578, 9276, 8, 578, 1, 578, 1, 578, 1, 578, 1, 578, 3, 578, 9282, 8, 578, 3, 578, 9284, 8, 578, 1, 579, 1, 579, 1, 580, 1, 580, 1, 580, 1, 580, 1, 580, 3, 580, 9293, 8, 580, 1, 580, 3, 580, 9296, 8, 580, 1, 581, 1, 581, 1, 582, 1, 582, 1, 582, 1, 582, 1, 582, 1, 582, 3, 582, 9306, 8, 582, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 3, 583, 9322, 8, 583, 1, 583, 1, 583, 1, 583, 1, 583, 3, 583, 9328, 8, 583, 1, 583, 1, 583, 1, 583, 3, 583, 9333, 8, 583, 1, 584, 1, 584, 1, 584, 1, 584, 1, 584, 3, 584, 9340, 8, 584, 1, 585, 1, 585, 1, 585, 1, 586, 1, 586, 1, 587, 1, 587, 3, 587, 9349, 8, 587, 1, 588, 1, 588, 1, 588, 5, 588, 9354, 8, 588, 10, 588, 12, 588, 9357, 9, 588, 1, 589, 1, 589, 1, 589, 5, 589, 9362, 8, 589, 10, 589, 12, 589, 9365, 9, 589, 1, 590, 1, 590, 1, 590, 5, 590, 9370, 8, 590, 10, 590, 12, 590, 9373, 9, 590, 1, 591, 1, 591, 3, 591, 9377, 8, 591, 1, 591, 1, 591, 3, 591, 9381, 8, 591, 1, 591, 1, 591, 1, 591, 1, 591, 3, 591, 9387, 8, 591, 1, 592, 1, 592, 3, 592, 9391, 8, 592, 1, 592, 1, 592, 3, 592, 9395, 8, 592, 1, 593, 3, 593, 9398, 8, 593, 1, 593, 1, 593, 1, 594, 1, 594, 3, 594, 9404, 8, 594, 1, 595, 1, 595, 1, 595, 3, 595, 9409, 8, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 3, 595, 9425, 8, 595, 1, 595, 3, 595, 9428, 8, 595, 3, 595, 9430, 8, 595, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 3, 596, 9442, 8, 596, 3, 596, 9444, 8, 596, 1, 597, 1, 597, 3, 597, 9448, 8, 597, 1, 597, 1, 597, 1, 597, 1, 597, 3, 597, 9454, 8, 597, 1, 597, 1, 597, 3, 597, 9458, 8, 597, 3, 597, 9460, 8, 597, 1, 598, 1, 598, 1, 598, 1, 598, 5, 598, 9466, 8, 598, 10, 598, 12, 598, 9469, 9, 598, 1, 599, 3, 599, 9472, 8, 599, 1, 599, 1, 599, 1, 600, 1, 600, 1, 600, 5, 600, 9479, 8, 600, 10, 600, 12, 600, 9482, 9, 600, 1, 601, 1, 601, 1, 601, 5, 601, 9487, 8, 601, 10, 601, 12, 601, 9490, 9, 601, 1, 602, 1, 602, 1, 602, 3, 602, 9495, 8, 602, 1, 603, 3, 603, 9498, 8, 603, 1, 603, 1, 603, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 3, 604, 9507, 8, 604, 1, 605, 1, 605, 1, 605, 3, 605, 9512, 8, 605, 1, 606, 1, 606, 1, 606, 5, 606, 9517, 8, 606, 10, 606, 12, 606, 9520, 9, 606, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 3, 607, 9529, 8, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 3, 607, 9555, 8, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 3, 607, 9566, 8, 607, 5, 607, 9568, 8, 607, 10, 607, 12, 607, 9571, 9, 607, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 3, 608, 9578, 8, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 3, 608, 9601, 8, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 3, 608, 9609, 8, 608, 1, 609, 1, 609, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 3, 610, 9619, 8, 610, 1, 610, 3, 610, 9622, 8, 610, 1, 610, 1, 610, 1, 610, 3, 610, 9627, 8, 610, 1, 610, 1, 610, 1, 610, 3, 610, 9632, 8, 610, 1, 610, 1, 610, 3, 610, 9636, 8, 610, 1, 610, 1, 610, 1, 611, 1, 611, 3, 611, 9642, 8, 611, 1, 611, 3, 611, 9645, 8, 611, 1, 611, 3, 611, 9648, 8, 611, 1, 611, 3, 611, 9651, 8, 611, 1, 612, 1, 612, 3, 612, 9655, 8, 612, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9669, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9676, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9683, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9690, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9708, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9716, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9728, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9746, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9785, 8, 613, 3, 613, 9787, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9807, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9817, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9828, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9840, 8, 613, 1, 614, 1, 614, 1, 614, 1, 614, 1, 614, 3, 614, 9847, 8, 614, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 3, 615, 9859, 8, 615, 1, 616, 1, 616, 1, 616, 1, 616, 1, 616, 1, 617, 1, 617, 1, 617, 5, 617, 9869, 8, 617, 10, 617, 12, 617, 9872, 9, 617, 1, 618, 1, 618, 1, 618, 3, 618, 9877, 8, 618, 1, 619, 1, 619, 1, 620, 1, 620, 1, 620, 1, 620, 3, 620, 9885, 8, 620, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 3, 621, 9902, 8, 621, 1, 622, 1, 622, 1, 622, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 625, 1, 625, 1, 625, 1, 626, 1, 626, 1, 626, 5, 626, 9925, 8, 626, 10, 626, 12, 626, 9928, 9, 626, 1, 627, 1, 627, 1, 627, 1, 627, 1, 628, 1, 628, 1, 628, 3, 628, 9937, 8, 628, 1, 629, 1, 629, 3, 629, 9941, 8, 629, 1, 629, 3, 629, 9944, 8, 629, 1, 629, 3, 629, 9947, 8, 629, 1, 629, 3, 629, 9950, 8, 629, 1, 629, 1, 629, 1, 630, 1, 630, 1, 631, 1, 631, 1, 631, 1, 631, 1, 632, 1, 632, 1, 632, 3, 632, 9963, 8, 632, 1, 632, 1, 632, 1, 632, 3, 632, 9968, 8, 632, 1, 632, 1, 632, 1, 632, 3, 632, 9973, 8, 632, 3, 632, 9975, 8, 632, 1, 633, 1, 633, 1, 633, 1, 633, 1, 633, 1, 633, 3, 633, 9983, 8, 633, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 3, 634, 9992, 8, 634, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 3, 635, 10001, 8, 635, 1, 636, 1, 636, 1, 636, 3, 636, 10006, 8, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 3, 636, 10015, 8, 636, 1, 637, 1, 637, 1, 637, 3, 637, 10020, 8, 637, 1, 637, 1, 637, 1, 638, 1, 638, 1, 638, 1, 638, 1, 638, 1, 638, 1, 639, 1, 639, 1, 640, 1, 640, 3, 640, 10034, 8, 640, 1, 641, 1, 641, 1, 642, 1, 642, 1, 642, 1, 642, 1, 642, 1, 642, 3, 642, 10044, 8, 642, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, 3, 643, 10052, 8, 643, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 3, 644, 10066, 8, 644, 1, 645, 1, 645, 1, 645, 5, 645, 10071, 8, 645, 10, 645, 12, 645, 10074, 9, 645, 1, 646, 1, 646, 1, 646, 5, 646, 10079, 8, 646, 10, 646, 12, 646, 10082, 9, 646, 1, 647, 1, 647, 1, 647, 1, 647, 1, 647, 3, 647, 10089, 8, 647, 1, 648, 1, 648, 1, 648, 5, 648, 10094, 8, 648, 10, 648, 12, 648, 10097, 9, 648, 1, 649, 1, 649, 1, 649, 3, 649, 10102, 8, 649, 1, 649, 1, 649, 1, 650, 1, 650, 1, 650, 5, 650, 10109, 8, 650, 10, 650, 12, 650, 10112, 9, 650, 1, 651, 1, 651, 1, 651, 1, 651, 1, 652, 1, 652, 1, 652, 1, 652, 1, 652, 1, 652, 1, 652, 1, 652, 3, 652, 10126, 8, 652, 1, 653, 1, 653, 1, 654, 1, 654, 1, 654, 1, 654, 1, 654, 1, 654, 1, 654, 3, 654, 10137, 8, 654, 1, 655, 1, 655, 1, 655, 1, 655, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 3, 656, 10170, 8, 656, 1, 657, 1, 657, 1, 657, 1, 657, 1, 657, 1, 657, 1, 657, 3, 657, 10179, 8, 657, 1, 658, 1, 658, 1, 658, 1, 658, 1, 658, 3, 658, 10186, 8, 658, 1, 659, 1, 659, 3, 659, 10190, 8, 659, 1, 659, 1, 659, 3, 659, 10194, 8, 659, 1, 659, 1, 659, 1, 660, 4, 660, 10199, 8, 660, 11, 660, 12, 660, 10200, 1, 661, 1, 661, 1, 661, 1, 661, 1, 661, 1, 662, 1, 662, 1, 662, 1, 663, 1, 663, 1, 664, 1, 664, 3, 664, 10215, 8, 664, 1, 665, 1, 665, 1, 665, 3, 665, 10220, 8, 665, 1, 665, 1, 665, 1, 665, 3, 665, 10225, 8, 665, 1, 665, 1, 665, 3, 665, 10229, 8, 665, 3, 665, 10231, 8, 665, 1, 665, 3, 665, 10234, 8, 665, 1, 666, 1, 666, 1, 667, 4, 667, 10239, 8, 667, 11, 667, 12, 667, 10240, 1, 668, 5, 668, 10244, 8, 668, 10, 668, 12, 668, 10247, 9, 668, 1, 669, 1, 669, 1, 670, 1, 670, 1, 670, 5, 670, 10254, 8, 670, 10, 670, 12, 670, 10257, 9, 670, 1, 671, 1, 671, 3, 671, 10261, 8, 671, 1, 671, 3, 671, 10264, 8, 671, 1, 672, 1, 672, 1, 672, 3, 672, 10269, 8, 672, 1, 673, 1, 673, 1, 673, 5, 673, 10274, 8, 673, 10, 673, 12, 673, 10277, 9, 673, 1, 674, 1, 674, 3, 674, 10281, 8, 674, 1, 675, 1, 675, 1, 675, 5, 675, 10286, 8, 675, 10, 675, 12, 675, 10289, 9, 675, 1, 676, 1, 676, 1, 677, 1, 677, 1, 678, 1, 678, 1, 679, 1, 679, 1, 679, 1, 679, 1, 679, 1, 679, 1, 679, 3, 679, 10304, 8, 679, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 3, 680, 10316, 8, 680, 1, 680, 1, 680, 1, 680, 3, 680, 10321, 8, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 3, 680, 10329, 8, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 3, 680, 10336, 8, 680, 1, 680, 1, 680, 1, 680, 3, 680, 10341, 8, 680, 1, 681, 1, 681, 1, 682, 1, 682, 1, 683, 1, 683, 1, 684, 1, 684, 1, 685, 1, 685, 3, 685, 10353, 8, 685, 1, 686, 1, 686, 1, 686, 1, 686, 5, 686, 10359, 8, 686, 10, 686, 12, 686, 10362, 9, 686, 1, 686, 1, 686, 3, 686, 10366, 8, 686, 1, 687, 1, 687, 1, 687, 1, 688, 1, 688, 1, 688, 1, 688, 1, 688, 3, 688, 10376, 8, 688, 1, 689, 1, 689, 1, 690, 1, 690, 1, 690, 3, 690, 10383, 8, 690, 1, 691, 1, 691, 1, 691, 5, 691, 10388, 8, 691, 10, 691, 12, 691, 10391, 9, 691, 1, 692, 1, 692, 1, 692, 1, 692, 1, 692, 1, 692, 3, 692, 10399, 8, 692, 1, 693, 1, 693, 1, 693, 1, 693, 3, 693, 10405, 8, 693, 1, 694, 1, 694, 1, 694, 1, 694, 3, 694, 10411, 8, 694, 1, 695, 1, 695, 1, 695, 1, 695, 3, 695, 10417, 8, 695, 1, 696, 1, 696, 1, 696, 1, 696, 1, 696, 1, 696, 3, 696, 10425, 8, 696, 1, 697, 1, 697, 3, 697, 10429, 8, 697, 1, 697, 1, 697, 1, 697, 1, 697, 1, 697, 3, 697, 10436, 8, 697, 1, 698, 1, 698, 1, 699, 1, 699, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 3, 700, 10494, 8, 700, 1, 701, 1, 701, 1, 702, 1, 702, 1, 703, 1, 703, 1, 704, 1, 704, 1, 704, 3, 704, 10505, 8, 704, 1, 705, 5, 705, 10508, 8, 705, 10, 705, 12, 705, 10511, 9, 705, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 3, 706, 10533, 8, 706, 1, 707, 1, 707, 1, 708, 1, 708, 1, 708, 1, 708, 3, 708, 10541, 8, 708, 1, 709, 1, 709, 1, 710, 1, 710, 1, 710, 1, 710, 3, 710, 10549, 8, 710, 1, 710, 1, 710, 3, 710, 10553, 8, 710, 1, 711, 3, 711, 10556, 8, 711, 1, 711, 1, 711, 3, 711, 10560, 8, 711, 3, 711, 10562, 8, 711, 1, 712, 1, 712, 1, 713, 4, 713, 10567, 8, 713, 11, 713, 12, 713, 10568, 1, 714, 1, 714, 1, 714, 1, 714, 1, 715, 1, 715, 1, 715, 3, 715, 10578, 8, 715, 1, 716, 1, 716, 1, 716, 1, 716, 1, 716, 3, 716, 10585, 8, 716, 1, 716, 1, 716, 3, 716, 10589, 8, 716, 1, 716, 3, 716, 10592, 8, 716, 1, 716, 3, 716, 10595, 8, 716, 1, 716, 3, 716, 10598, 8, 716, 1, 716, 1, 716, 3, 716, 10602, 8, 716, 1, 716, 1, 716, 1, 716, 3, 716, 10607, 8, 716, 1, 716, 1, 716, 1, 717, 1, 717, 1, 717, 3, 717, 10614, 8, 717, 1, 718, 1, 718, 1, 719, 1, 719, 1, 719, 1, 719, 1, 720, 1, 720, 1, 720, 5, 720, 10625, 8, 720, 10, 720, 12, 720, 10628, 9, 720, 1, 721, 1, 721, 1, 721, 1, 722, 1, 722, 1, 723, 1, 723, 3, 723, 10637, 8, 723, 1, 724, 1, 724, 1, 725, 1, 725, 1, 726, 1, 726, 1, 727, 1, 727, 1, 727, 1, 728, 1, 728, 1, 728, 1, 729, 1, 729, 1, 729, 1, 730, 1, 730, 3, 730, 10656, 8, 730, 1, 731, 1, 731, 1, 732, 5, 732, 10661, 8, 732, 10, 732, 12, 732, 10664, 9, 732, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 3, 733, 10693, 8, 733, 1, 734, 1, 734, 1, 734, 1, 734, 1, 735, 1, 735, 1, 735, 1, 735, 3, 735, 10703, 8, 735, 1, 735, 1, 735, 1, 735, 1, 735, 1, 735, 1, 735, 1, 735, 3, 735, 10712, 8, 735, 1, 735, 1, 735, 1, 735, 3, 735, 10717, 8, 735, 1, 736, 1, 736, 1, 737, 1, 737, 1, 737, 1, 737, 1, 737, 1, 738, 1, 738, 3, 738, 10728, 8, 738, 1, 738, 1, 738, 1, 738, 1, 738, 1, 739, 1, 739, 1, 740, 1, 740, 1, 740, 5, 740, 10739, 8, 740, 10, 740, 12, 740, 10742, 9, 740, 1, 741, 1, 741, 1, 741, 1, 741, 1, 742, 1, 742, 1, 743, 1, 743, 1, 744, 1, 744, 3, 744, 10754, 8, 744, 1, 744, 1, 744, 1, 744, 1, 744, 5, 744, 10760, 8, 744, 10, 744, 12, 744, 10763, 9, 744, 1, 745, 1, 745, 1, 745, 1, 745, 1, 745, 1, 745, 3, 745, 10771, 8, 745, 1, 745, 1, 745, 1, 745, 1, 745, 1, 746, 1, 746, 1, 746, 1, 746, 1, 746, 5, 746, 10782, 8, 746, 10, 746, 12, 746, 10785, 9, 746, 1, 747, 1, 747, 1, 747, 1, 748, 1, 748, 3, 748, 10792, 8, 748, 1, 748, 1, 748, 3, 748, 10796, 8, 748, 1, 748, 1, 748, 1, 748, 1, 748, 1, 749, 1, 749, 1, 750, 4, 750, 10805, 8, 750, 11, 750, 12, 750, 10806, 1, 751, 1, 751, 1, 751, 1, 751, 1, 751, 1, 752, 1, 752, 1, 752, 1, 753, 3, 753, 10818, 8, 753, 1, 753, 1, 753, 1, 754, 3, 754, 10823, 8, 754, 1, 754, 1, 754, 1, 754, 1, 754, 1, 755, 3, 755, 10830, 8, 755, 1, 755, 1, 755, 1, 755, 1, 755, 1, 756, 1, 756, 1, 756, 1, 756, 3, 756, 10840, 8, 756, 1, 756, 1, 756, 1, 756, 1, 756, 1, 756, 3, 756, 10847, 8, 756, 1, 756, 3, 756, 10850, 8, 756, 1, 756, 1, 756, 1, 756, 1, 756, 3, 756, 10856, 8, 756, 3, 756, 10858, 8, 756, 1, 757, 1, 757, 1, 757, 1, 758, 1, 758, 1, 758, 1, 758, 5, 758, 10867, 8, 758, 10, 758, 12, 758, 10870, 9, 758, 1, 758, 1, 758, 1, 759, 1, 759, 1, 760, 1, 760, 1, 760, 1, 761, 1, 761, 1, 762, 3, 762, 10882, 8, 762, 1, 762, 1, 762, 1, 762, 3, 762, 10887, 8, 762, 1, 762, 1, 762, 1, 762, 1, 762, 1, 762, 1, 763, 1, 763, 1, 763, 1, 764, 1, 764, 3, 764, 10899, 8, 764, 1, 764, 3, 764, 10902, 8, 764, 1, 764, 1, 764, 1, 765, 1, 765, 1, 766, 1, 766, 1, 766, 1, 766, 1, 766, 1, 766, 1, 766, 3, 766, 10915, 8, 766, 1, 766, 3, 766, 10918, 8, 766, 1, 766, 3, 766, 10921, 8, 766, 3, 766, 10923, 8, 766, 1, 766, 1, 766, 1, 767, 1, 767, 1, 768, 1, 768, 3, 768, 10931, 8, 768, 1, 768, 1, 768, 3, 768, 10935, 8, 768, 1, 768, 3, 768, 10938, 8, 768, 1, 768, 1, 768, 1, 768, 1, 768, 3, 768, 10944, 8, 768, 1, 768, 1, 768, 3, 768, 10948, 8, 768, 1, 768, 1, 768, 1, 768, 1, 768, 3, 768, 10954, 8, 768, 1, 768, 1, 768, 1, 768, 3, 768, 10959, 8, 768, 1, 768, 1, 768, 1, 768, 1, 768, 3, 768, 10965, 8, 768, 1, 768, 3, 768, 10968, 8, 768, 1, 768, 1, 768, 3, 768, 10972, 8, 768, 1, 769, 1, 769, 1, 770, 1, 770, 4, 770, 10978, 8, 770, 11, 770, 12, 770, 10979, 1, 771, 1, 771, 1, 771, 1, 772, 1, 772, 1, 772, 1, 772, 1, 773, 1, 773, 1, 773, 5, 773, 10992, 8, 773, 10, 773, 12, 773, 10995, 9, 773, 1, 774, 1, 774, 1, 774, 3, 774, 11000, 8, 774, 1, 774, 1, 774, 1, 775, 1, 775, 1, 775, 1, 776, 1, 776, 1, 776, 1, 776, 1, 776, 3, 776, 11012, 8, 776, 1, 776, 1, 776, 1, 777, 1, 777, 1, 777, 1, 778, 1, 778, 1, 778, 3, 778, 11022, 8, 778, 1, 778, 3, 778, 11025, 8, 778, 1, 778, 3, 778, 11028, 8, 778, 1, 778, 3, 778, 11031, 8, 778, 1, 778, 3, 778, 11034, 8, 778, 1, 778, 1, 778, 1, 779, 1, 779, 1, 779, 1, 780, 1, 780, 1, 780, 5, 780, 11044, 8, 780, 10, 780, 12, 780, 11047, 9, 780, 1, 781, 1, 781, 3, 781, 11051, 8, 781, 1, 781, 1, 781, 1, 782, 1, 782, 1, 782, 3, 782, 11058, 8, 782, 1, 782, 1, 782, 1, 782, 1, 782, 1, 782, 3, 782, 11065, 8, 782, 3, 782, 11067, 8, 782, 1, 782, 1, 782, 1, 782, 1, 782, 1, 782, 3, 782, 11074, 8, 782, 3, 782, 11076, 8, 782, 1, 782, 1, 782, 1, 783, 1, 783, 1, 783, 1, 783, 1, 783, 3, 783, 11085, 8, 783, 1, 784, 1, 784, 1, 784, 5, 784, 11090, 8, 784, 10, 784, 12, 784, 11093, 9, 784, 1, 785, 1, 785, 1, 785, 1, 786, 3, 786, 11099, 8, 786, 1, 786, 1, 786, 1, 787, 1, 787, 1, 788, 1, 788, 3, 788, 11107, 8, 788, 1, 788, 3, 788, 11110, 8, 788, 1, 788, 1, 788, 1, 788, 1, 788, 1, 788, 1, 789, 1, 789, 1, 790, 1, 790, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 3, 791, 11134, 8, 791, 3, 791, 11136, 8, 791, 1, 792, 1, 792, 3, 792, 11140, 8, 792, 1, 792, 1, 792, 1, 792, 1, 793, 1, 793, 1, 793, 1, 793, 1, 794, 1, 794, 1, 794, 1, 795, 1, 795, 3, 795, 11154, 8, 795, 1, 795, 1, 795, 1, 796, 1, 796, 3, 796, 11160, 8, 796, 1, 796, 1, 796, 1, 797, 1, 797, 3, 797, 11166, 8, 797, 1, 797, 1, 797, 1, 798, 1, 798, 1, 798, 1, 798, 1, 798, 1, 798, 1, 798, 1, 798, 1, 798, 3, 798, 11179, 8, 798, 1, 798, 3, 798, 11182, 8, 798, 1, 799, 1, 799, 3, 799, 11186, 8, 799, 1, 800, 1, 800, 1, 800, 1, 801, 4, 801, 11192, 8, 801, 11, 801, 12, 801, 11193, 1, 802, 1, 802, 1, 802, 1, 802, 1, 802, 1, 803, 1, 803, 1, 803, 5, 803, 11204, 8, 803, 10, 803, 12, 803, 11207, 9, 803, 1, 804, 1, 804, 1, 804, 3, 804, 11212, 8, 804, 1, 805, 1, 805, 1, 806, 1, 806, 1, 807, 1, 807, 1, 808, 1, 808, 1, 808, 1, 809, 1, 809, 3, 809, 11225, 8, 809, 1, 810, 1, 810, 1, 811, 3, 811, 11230, 8, 811, 1, 811, 3, 811, 11233, 8, 811, 1, 811, 3, 811, 11236, 8, 811, 1, 811, 3, 811, 11239, 8, 811, 1, 811, 3, 811, 11242, 8, 811, 1, 811, 3, 811, 11245, 8, 811, 1, 811, 3, 811, 11248, 8, 811, 1, 812, 1, 812, 1, 813, 1, 813, 1, 814, 1, 814, 1, 815, 1, 815, 1, 816, 1, 816, 3, 816, 11260, 8, 816, 1, 817, 1, 817, 3, 817, 11264, 8, 817, 1, 817, 1, 817, 1, 817, 0, 1, 1214, 818, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 752, 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, 834, 836, 838, 840, 842, 844, 846, 848, 850, 852, 854, 856, 858, 860, 862, 864, 866, 868, 870, 872, 874, 876, 878, 880, 882, 884, 886, 888, 890, 892, 894, 896, 898, 900, 902, 904, 906, 908, 910, 912, 914, 916, 918, 920, 922, 924, 926, 928, 930, 932, 934, 936, 938, 940, 942, 944, 946, 948, 950, 952, 954, 956, 958, 960, 962, 964, 966, 968, 970, 972, 974, 976, 978, 980, 982, 984, 986, 988, 990, 992, 994, 996, 998, 1000, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018, 1020, 1022, 1024, 1026, 1028, 1030, 1032, 1034, 1036, 1038, 1040, 1042, 1044, 1046, 1048, 1050, 1052, 1054, 1056, 1058, 1060, 1062, 1064, 1066, 1068, 1070, 1072, 1074, 1076, 1078, 1080, 1082, 1084, 1086, 1088, 1090, 1092, 1094, 1096, 1098, 1100, 1102, 1104, 1106, 1108, 1110, 1112, 1114, 1116, 1118, 1120, 1122, 1124, 1126, 1128, 1130, 1132, 1134, 1136, 1138, 1140, 1142, 1144, 1146, 1148, 1150, 1152, 1154, 1156, 1158, 1160, 1162, 1164, 1166, 1168, 1170, 1172, 1174, 1176, 1178, 1180, 1182, 1184, 1186, 1188, 1190, 1192, 1194, 1196, 1198, 1200, 1202, 1204, 1206, 1208, 1210, 1212, 1214, 1216, 1218, 1220, 1222, 1224, 1226, 1228, 1230, 1232, 1234, 1236, 1238, 1240, 1242, 1244, 1246, 1248, 1250, 1252, 1254, 1256, 1258, 1260, 1262, 1264, 1266, 1268, 1270, 1272, 1274, 1276, 1278, 1280, 1282, 1284, 1286, 1288, 1290, 1292, 1294, 1296, 1298, 1300, 1302, 1304, 1306, 1308, 1310, 1312, 1314, 1316, 1318, 1320, 1322, 1324, 1326, 1328, 1330, 1332, 1334, 1336, 1338, 1340, 1342, 1344, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368, 1370, 1372, 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, 1394, 1396, 1398, 1400, 1402, 1404, 1406, 1408, 1410, 1412, 1414, 1416, 1418, 1420, 1422, 1424, 1426, 1428, 1430, 1432, 1434, 1436, 1438, 1440, 1442, 1444, 1446, 1448, 1450, 1452, 1454, 1456, 1458, 1460, 1462, 1464, 1466, 1468, 1470, 1472, 1474, 1476, 1478, 1480, 1482, 1484, 1486, 1488, 1490, 1492, 1494, 1496, 1498, 1500, 1502, 1504, 1506, 1508, 1510, 1512, 1514, 1516, 1518, 1520, 1522, 1524, 1526, 1528, 1530, 1532, 1534, 1536, 1538, 1540, 1542, 1544, 1546, 1548, 1550, 1552, 1554, 1556, 1558, 1560, 1562, 1564, 1566, 1568, 1570, 1572, 1574, 1576, 1578, 1580, 1582, 1584, 1586, 1588, 1590, 1592, 1594, 1596, 1598, 1600, 1602, 1604, 1606, 1608, 1610, 1612, 1614, 1616, 1618, 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 0, 76, 2, 0, 195, 195, 357, 357, 2, 0, 66, 66, 311, 311, 2, 0, 99, 99, 311, 311, 3, 0, 66, 66, 99, 99, 311, 311, 2, 0, 133, 133, 191, 191, 2, 0, 245, 245, 325, 325, 2, 0, 10, 10, 94, 94, 2, 0, 162, 162, 356, 356, 2, 0, 180, 180, 221, 221, 5, 0, 30, 30, 281, 281, 322, 322, 345, 345, 347, 347, 2, 0, 150, 150, 308, 308, 2, 0, 64, 64, 94, 94, 2, 0, 345, 345, 347, 347, 1, 0, 641, 642, 2, 0, 200, 200, 224, 224, 9, 0, 30, 30, 160, 160, 165, 165, 179, 179, 219, 219, 227, 227, 335, 335, 338, 338, 440, 440, 3, 0, 113, 113, 277, 277, 329, 329, 2, 0, 53, 53, 78, 78, 3, 0, 173, 173, 252, 252, 255, 255, 5, 0, 30, 30, 88, 88, 182, 182, 232, 232, 362, 362, 2, 0, 92, 92, 226, 226, 1, 0, 450, 451, 2, 0, 92, 92, 409, 409, 2, 0, 334, 334, 409, 409, 2, 0, 211, 211, 289, 289, 3, 0, 314, 314, 350, 350, 447, 447, 2, 0, 64, 64, 68, 68, 5, 0, 212, 212, 322, 322, 343, 343, 354, 354, 457, 458, 2, 0, 37, 37, 55, 55, 2, 0, 10, 10, 53, 53, 3, 0, 211, 211, 289, 289, 444, 444, 5, 0, 92, 92, 175, 175, 226, 226, 316, 316, 342, 342, 3, 0, 175, 175, 316, 316, 342, 342, 3, 0, 109, 109, 128, 128, 344, 344, 4, 0, 88, 88, 182, 182, 232, 232, 362, 362, 2, 0, 137, 137, 233, 233, 2, 0, 349, 349, 373, 373, 2, 0, 151, 151, 245, 245, 2, 0, 306, 306, 326, 326, 1, 0, 31, 32, 2, 0, 99, 99, 342, 342, 2, 0, 201, 201, 327, 327, 2, 0, 59, 59, 97, 97, 2, 0, 213, 213, 245, 245, 2, 0, 30, 30, 56, 56, 2, 0, 313, 313, 409, 409, 2, 0, 207, 207, 261, 261, 4, 0, 113, 113, 115, 115, 119, 119, 126, 126, 2, 0, 353, 353, 479, 479, 2, 0, 385, 386, 400, 400, 1, 0, 385, 386, 1, 0, 413, 414, 1, 0, 18, 19, 2, 0, 117, 117, 122, 122, 5, 0, 10, 10, 16, 17, 21, 21, 23, 23, 25, 25, 1, 0, 12, 13, 3, 0, 9, 9, 14, 14, 27, 27, 3, 0, 39, 39, 73, 73, 95, 95, 2, 0, 166, 166, 188, 188, 2, 0, 297, 297, 452, 452, 2, 0, 208, 208, 282, 282, 3, 0, 30, 30, 34, 34, 90, 90, 6, 0, 9, 10, 12, 17, 21, 21, 23, 23, 25, 25, 27, 27, 2, 0, 20, 20, 22, 22, 1, 0, 485, 488, 12, 0, 124, 124, 129, 249, 251, 252, 254, 303, 305, 380, 405, 405, 435, 454, 457, 471, 473, 473, 475, 475, 477, 477, 480, 490, 5, 0, 106, 118, 120, 123, 125, 125, 127, 128, 474, 474, 4, 0, 30, 52, 54, 70, 72, 105, 456, 456, 5, 0, 304, 304, 420, 426, 506, 506, 515, 515, 523, 637, 2, 0, 62, 62, 116, 116, 2, 0, 10, 10, 20, 20, 2, 0, 436, 436, 503, 503, 2, 0, 167, 167, 509, 509, 1, 0, 514, 519, 2, 0, 144, 144, 210, 210, 36, 0, 33, 33, 35, 35, 43, 45, 53, 53, 57, 57, 61, 61, 92, 92, 116, 116, 123, 123, 130, 130, 144, 144, 153, 153, 157, 157, 161, 161, 167, 167, 172, 172, 207, 207, 210, 210, 232, 232, 240, 240, 258, 258, 261, 262, 272, 272, 286, 286, 300, 300, 306, 306, 312, 312, 316, 317, 326, 326, 353, 353, 435, 436, 479, 479, 492, 504, 508, 514, 516, 520, 522, 522, 12479, 0, 1636, 1, 0, 0, 0, 2, 1639, 1, 0, 0, 0, 4, 1641, 1, 0, 0, 0, 6, 1649, 1, 0, 0, 0, 8, 1777, 1, 0, 0, 0, 10, 1779, 1, 0, 0, 0, 12, 1783, 1, 0, 0, 0, 14, 1786, 1, 0, 0, 0, 16, 1794, 1, 0, 0, 0, 18, 1799, 1, 0, 0, 0, 20, 1805, 1, 0, 0, 0, 22, 1826, 1, 0, 0, 0, 24, 1838, 1, 0, 0, 0, 26, 1840, 1, 0, 0, 0, 28, 1848, 1, 0, 0, 0, 30, 1856, 1, 0, 0, 0, 32, 1860, 1, 0, 0, 0, 34, 1871, 1, 0, 0, 0, 36, 1879, 1, 0, 0, 0, 38, 1887, 1, 0, 0, 0, 40, 1894, 1, 0, 0, 0, 42, 1896, 1, 0, 0, 0, 44, 1913, 1, 0, 0, 0, 46, 1918, 1, 0, 0, 0, 48, 1927, 1, 0, 0, 0, 50, 1929, 1, 0, 0, 0, 52, 1943, 1, 0, 0, 0, 54, 1945, 1, 0, 0, 0, 56, 1976, 1, 0, 0, 0, 58, 1978, 1, 0, 0, 0, 60, 1986, 1, 0, 0, 0, 62, 1996, 1, 0, 0, 0, 64, 2003, 1, 0, 0, 0, 66, 2009, 1, 0, 0, 0, 68, 2027, 1, 0, 0, 0, 70, 2031, 1, 0, 0, 0, 72, 2035, 1, 0, 0, 0, 74, 2037, 1, 0, 0, 0, 76, 2048, 1, 0, 0, 0, 78, 2052, 1, 0, 0, 0, 80, 2057, 1, 0, 0, 0, 82, 2062, 1, 0, 0, 0, 84, 2064, 1, 0, 0, 0, 86, 2076, 1, 0, 0, 0, 88, 2083, 1, 0, 0, 0, 90, 2085, 1, 0, 0, 0, 92, 2087, 1, 0, 0, 0, 94, 2089, 1, 0, 0, 0, 96, 2204, 1, 0, 0, 0, 98, 2206, 1, 0, 0, 0, 100, 2222, 1, 0, 0, 0, 102, 2224, 1, 0, 0, 0, 104, 2530, 1, 0, 0, 0, 106, 2537, 1, 0, 0, 0, 108, 2539, 1, 0, 0, 0, 110, 2541, 1, 0, 0, 0, 112, 2544, 1, 0, 0, 0, 114, 2553, 1, 0, 0, 0, 116, 2555, 1, 0, 0, 0, 118, 2559, 1, 0, 0, 0, 120, 2562, 1, 0, 0, 0, 122, 2570, 1, 0, 0, 0, 124, 2582, 1, 0, 0, 0, 126, 2599, 1, 0, 0, 0, 128, 2627, 1, 0, 0, 0, 130, 2629, 1, 0, 0, 0, 132, 2632, 1, 0, 0, 0, 134, 2640, 1, 0, 0, 0, 136, 2645, 1, 0, 0, 0, 138, 2683, 1, 0, 0, 0, 140, 2685, 1, 0, 0, 0, 142, 2727, 1, 0, 0, 0, 144, 2729, 1, 0, 0, 0, 146, 2731, 1, 0, 0, 0, 148, 2736, 1, 0, 0, 0, 150, 2743, 1, 0, 0, 0, 152, 2748, 1, 0, 0, 0, 154, 2790, 1, 0, 0, 0, 156, 2792, 1, 0, 0, 0, 158, 2795, 1, 0, 0, 0, 160, 2800, 1, 0, 0, 0, 162, 2802, 1, 0, 0, 0, 164, 2810, 1, 0, 0, 0, 166, 2821, 1, 0, 0, 0, 168, 2823, 1, 0, 0, 0, 170, 2831, 1, 0, 0, 0, 172, 2833, 1, 0, 0, 0, 174, 2918, 1, 0, 0, 0, 176, 2920, 1, 0, 0, 0, 178, 2922, 1, 0, 0, 0, 180, 2926, 1, 0, 0, 0, 182, 2934, 1, 0, 0, 0, 184, 2945, 1, 0, 0, 0, 186, 2949, 1, 0, 0, 0, 188, 2970, 1, 0, 0, 0, 190, 2998, 1, 0, 0, 0, 192, 3000, 1, 0, 0, 0, 194, 3010, 1, 0, 0, 0, 196, 3021, 1, 0, 0, 0, 198, 3078, 1, 0, 0, 0, 200, 3080, 1, 0, 0, 0, 202, 3089, 1, 0, 0, 0, 204, 3096, 1, 0, 0, 0, 206, 3098, 1, 0, 0, 0, 208, 3106, 1, 0, 0, 0, 210, 3109, 1, 0, 0, 0, 212, 3116, 1, 0, 0, 0, 214, 3207, 1, 0, 0, 0, 216, 3209, 1, 0, 0, 0, 218, 3212, 1, 0, 0, 0, 220, 3216, 1, 0, 0, 0, 222, 3224, 1, 0, 0, 0, 224, 3226, 1, 0, 0, 0, 226, 3231, 1, 0, 0, 0, 228, 3234, 1, 0, 0, 0, 230, 3242, 1, 0, 0, 0, 232, 3252, 1, 0, 0, 0, 234, 3265, 1, 0, 0, 0, 236, 3267, 1, 0, 0, 0, 238, 3271, 1, 0, 0, 0, 240, 3284, 1, 0, 0, 0, 242, 3286, 1, 0, 0, 0, 244, 3291, 1, 0, 0, 0, 246, 3293, 1, 0, 0, 0, 248, 3300, 1, 0, 0, 0, 250, 3331, 1, 0, 0, 0, 252, 3333, 1, 0, 0, 0, 254, 3340, 1, 0, 0, 0, 256, 3342, 1, 0, 0, 0, 258, 3351, 1, 0, 0, 0, 260, 3354, 1, 0, 0, 0, 262, 3359, 1, 0, 0, 0, 264, 3363, 1, 0, 0, 0, 266, 3379, 1, 0, 0, 0, 268, 3390, 1, 0, 0, 0, 270, 3406, 1, 0, 0, 0, 272, 3422, 1, 0, 0, 0, 274, 3428, 1, 0, 0, 0, 276, 3445, 1, 0, 0, 0, 278, 3458, 1, 0, 0, 0, 280, 3460, 1, 0, 0, 0, 282, 3470, 1, 0, 0, 0, 284, 3484, 1, 0, 0, 0, 286, 3493, 1, 0, 0, 0, 288, 3495, 1, 0, 0, 0, 290, 3500, 1, 0, 0, 0, 292, 3540, 1, 0, 0, 0, 294, 3542, 1, 0, 0, 0, 296, 3550, 1, 0, 0, 0, 298, 3552, 1, 0, 0, 0, 300, 3560, 1, 0, 0, 0, 302, 3582, 1, 0, 0, 0, 304, 3584, 1, 0, 0, 0, 306, 3588, 1, 0, 0, 0, 308, 3595, 1, 0, 0, 0, 310, 3597, 1, 0, 0, 0, 312, 3599, 1, 0, 0, 0, 314, 3601, 1, 0, 0, 0, 316, 3612, 1, 0, 0, 0, 318, 3615, 1, 0, 0, 0, 320, 3623, 1, 0, 0, 0, 322, 3639, 1, 0, 0, 0, 324, 3649, 1, 0, 0, 0, 326, 3651, 1, 0, 0, 0, 328, 3660, 1, 0, 0, 0, 330, 3663, 1, 0, 0, 0, 332, 3770, 1, 0, 0, 0, 334, 3772, 1, 0, 0, 0, 336, 3791, 1, 0, 0, 0, 338, 3794, 1, 0, 0, 0, 340, 3798, 1, 0, 0, 0, 342, 3817, 1, 0, 0, 0, 344, 3819, 1, 0, 0, 0, 346, 3824, 1, 0, 0, 0, 348, 3832, 1, 0, 0, 0, 350, 3837, 1, 0, 0, 0, 352, 3852, 1, 0, 0, 0, 354, 3854, 1, 0, 0, 0, 356, 3857, 1, 0, 0, 0, 358, 3859, 1, 0, 0, 0, 360, 3896, 1, 0, 0, 0, 362, 3898, 1, 0, 0, 0, 364, 3901, 1, 0, 0, 0, 366, 3906, 1, 0, 0, 0, 368, 3908, 1, 0, 0, 0, 370, 3990, 1, 0, 0, 0, 372, 3992, 1, 0, 0, 0, 374, 4010, 1, 0, 0, 0, 376, 4012, 1, 0, 0, 0, 378, 4040, 1, 0, 0, 0, 380, 4044, 1, 0, 0, 0, 382, 4064, 1, 0, 0, 0, 384, 4066, 1, 0, 0, 0, 386, 4075, 1, 0, 0, 0, 388, 4095, 1, 0, 0, 0, 390, 4109, 1, 0, 0, 0, 392, 4114, 1, 0, 0, 0, 394, 4120, 1, 0, 0, 0, 396, 4123, 1, 0, 0, 0, 398, 4126, 1, 0, 0, 0, 400, 4129, 1, 0, 0, 0, 402, 4132, 1, 0, 0, 0, 404, 4134, 1, 0, 0, 0, 406, 4143, 1, 0, 0, 0, 408, 4193, 1, 0, 0, 0, 410, 4199, 1, 0, 0, 0, 412, 4201, 1, 0, 0, 0, 414, 4216, 1, 0, 0, 0, 416, 4218, 1, 0, 0, 0, 418, 4222, 1, 0, 0, 0, 420, 4226, 1, 0, 0, 0, 422, 4233, 1, 0, 0, 0, 424, 4235, 1, 0, 0, 0, 426, 4237, 1, 0, 0, 0, 428, 4239, 1, 0, 0, 0, 430, 4245, 1, 0, 0, 0, 432, 4247, 1, 0, 0, 0, 434, 4249, 1, 0, 0, 0, 436, 4254, 1, 0, 0, 0, 438, 4258, 1, 0, 0, 0, 440, 4271, 1, 0, 0, 0, 442, 4273, 1, 0, 0, 0, 444, 4279, 1, 0, 0, 0, 446, 4293, 1, 0, 0, 0, 448, 4321, 1, 0, 0, 0, 450, 4323, 1, 0, 0, 0, 452, 4331, 1, 0, 0, 0, 454, 4337, 1, 0, 0, 0, 456, 4345, 1, 0, 0, 0, 458, 4357, 1, 0, 0, 0, 460, 4359, 1, 0, 0, 0, 462, 4482, 1, 0, 0, 0, 464, 4484, 1, 0, 0, 0, 466, 4488, 1, 0, 0, 0, 468, 4496, 1, 0, 0, 0, 470, 4507, 1, 0, 0, 0, 472, 4509, 1, 0, 0, 0, 474, 4513, 1, 0, 0, 0, 476, 4521, 1, 0, 0, 0, 478, 4525, 1, 0, 0, 0, 480, 4527, 1, 0, 0, 0, 482, 4578, 1, 0, 0, 0, 484, 4580, 1, 0, 0, 0, 486, 4584, 1, 0, 0, 0, 488, 4602, 1, 0, 0, 0, 490, 4641, 1, 0, 0, 0, 492, 4643, 1, 0, 0, 0, 494, 4645, 1, 0, 0, 0, 496, 4654, 1, 0, 0, 0, 498, 4656, 1, 0, 0, 0, 500, 4658, 1, 0, 0, 0, 502, 4683, 1, 0, 0, 0, 504, 4685, 1, 0, 0, 0, 506, 4705, 1, 0, 0, 0, 508, 4727, 1, 0, 0, 0, 510, 4749, 1, 0, 0, 0, 512, 4751, 1, 0, 0, 0, 514, 4758, 1, 0, 0, 0, 516, 4855, 1, 0, 0, 0, 518, 4880, 1, 0, 0, 0, 520, 4887, 1, 0, 0, 0, 522, 4904, 1, 0, 0, 0, 524, 4906, 1, 0, 0, 0, 526, 4908, 1, 0, 0, 0, 528, 4916, 1, 0, 0, 0, 530, 4922, 1, 0, 0, 0, 532, 4926, 1, 0, 0, 0, 534, 4934, 1, 0, 0, 0, 536, 4949, 1, 0, 0, 0, 538, 5098, 1, 0, 0, 0, 540, 5102, 1, 0, 0, 0, 542, 5215, 1, 0, 0, 0, 544, 5217, 1, 0, 0, 0, 546, 5222, 1, 0, 0, 0, 548, 5228, 1, 0, 0, 0, 550, 5315, 1, 0, 0, 0, 552, 5317, 1, 0, 0, 0, 554, 5319, 1, 0, 0, 0, 556, 5321, 1, 0, 0, 0, 558, 5351, 1, 0, 0, 0, 560, 5368, 1, 0, 0, 0, 562, 5370, 1, 0, 0, 0, 564, 5396, 1, 0, 0, 0, 566, 5458, 1, 0, 0, 0, 568, 5460, 1, 0, 0, 0, 570, 5468, 1, 0, 0, 0, 572, 5473, 1, 0, 0, 0, 574, 5484, 1, 0, 0, 0, 576, 5486, 1, 0, 0, 0, 578, 5490, 1, 0, 0, 0, 580, 5523, 1, 0, 0, 0, 582, 5525, 1, 0, 0, 0, 584, 5529, 1, 0, 0, 0, 586, 5533, 1, 0, 0, 0, 588, 5542, 1, 0, 0, 0, 590, 5554, 1, 0, 0, 0, 592, 5586, 1, 0, 0, 0, 594, 5588, 1, 0, 0, 0, 596, 5590, 1, 0, 0, 0, 598, 5629, 1, 0, 0, 0, 600, 5631, 1, 0, 0, 0, 602, 5633, 1, 0, 0, 0, 604, 5635, 1, 0, 0, 0, 606, 5638, 1, 0, 0, 0, 608, 5669, 1, 0, 0, 0, 610, 5682, 1, 0, 0, 0, 612, 5684, 1, 0, 0, 0, 614, 5689, 1, 0, 0, 0, 616, 5697, 1, 0, 0, 0, 618, 5700, 1, 0, 0, 0, 620, 5702, 1, 0, 0, 0, 622, 5708, 1, 0, 0, 0, 624, 5710, 1, 0, 0, 0, 626, 5730, 1, 0, 0, 0, 628, 5733, 1, 0, 0, 0, 630, 5739, 1, 0, 0, 0, 632, 5747, 1, 0, 0, 0, 634, 5763, 1, 0, 0, 0, 636, 5765, 1, 0, 0, 0, 638, 5771, 1, 0, 0, 0, 640, 5792, 1, 0, 0, 0, 642, 5801, 1, 0, 0, 0, 644, 5807, 1, 0, 0, 0, 646, 5809, 1, 0, 0, 0, 648, 5825, 1, 0, 0, 0, 650, 5827, 1, 0, 0, 0, 652, 5832, 1, 0, 0, 0, 654, 5834, 1, 0, 0, 0, 656, 5849, 1, 0, 0, 0, 658, 5857, 1, 0, 0, 0, 660, 5860, 1, 0, 0, 0, 662, 5869, 1, 0, 0, 0, 664, 5910, 1, 0, 0, 0, 666, 5925, 1, 0, 0, 0, 668, 5932, 1, 0, 0, 0, 670, 5934, 1, 0, 0, 0, 672, 5946, 1, 0, 0, 0, 674, 5949, 1, 0, 0, 0, 676, 5952, 1, 0, 0, 0, 678, 5960, 1, 0, 0, 0, 680, 5968, 1, 0, 0, 0, 682, 5972, 1, 0, 0, 0, 684, 6016, 1, 0, 0, 0, 686, 6032, 1, 0, 0, 0, 688, 6048, 1, 0, 0, 0, 690, 6072, 1, 0, 0, 0, 692, 6079, 1, 0, 0, 0, 694, 6084, 1, 0, 0, 0, 696, 6092, 1, 0, 0, 0, 698, 6095, 1, 0, 0, 0, 700, 6099, 1, 0, 0, 0, 702, 6106, 1, 0, 0, 0, 704, 6145, 1, 0, 0, 0, 706, 6151, 1, 0, 0, 0, 708, 6153, 1, 0, 0, 0, 710, 6166, 1, 0, 0, 0, 712, 6169, 1, 0, 0, 0, 714, 6216, 1, 0, 0, 0, 716, 6218, 1, 0, 0, 0, 718, 6264, 1, 0, 0, 0, 720, 6266, 1, 0, 0, 0, 722, 6268, 1, 0, 0, 0, 724, 6270, 1, 0, 0, 0, 726, 6278, 1, 0, 0, 0, 728, 6292, 1, 0, 0, 0, 730, 6781, 1, 0, 0, 0, 732, 6783, 1, 0, 0, 0, 734, 6785, 1, 0, 0, 0, 736, 6857, 1, 0, 0, 0, 738, 6859, 1, 0, 0, 0, 740, 7078, 1, 0, 0, 0, 742, 7080, 1, 0, 0, 0, 744, 7088, 1, 0, 0, 0, 746, 7104, 1, 0, 0, 0, 748, 7111, 1, 0, 0, 0, 750, 7113, 1, 0, 0, 0, 752, 7306, 1, 0, 0, 0, 754, 7331, 1, 0, 0, 0, 756, 7333, 1, 0, 0, 0, 758, 7379, 1, 0, 0, 0, 760, 7381, 1, 0, 0, 0, 762, 7410, 1, 0, 0, 0, 764, 7412, 1, 0, 0, 0, 766, 7422, 1, 0, 0, 0, 768, 7430, 1, 0, 0, 0, 770, 7477, 1, 0, 0, 0, 772, 7493, 1, 0, 0, 0, 774, 7495, 1, 0, 0, 0, 776, 7521, 1, 0, 0, 0, 778, 7524, 1, 0, 0, 0, 780, 7540, 1, 0, 0, 0, 782, 7542, 1, 0, 0, 0, 784, 7544, 1, 0, 0, 0, 786, 7546, 1, 0, 0, 0, 788, 7548, 1, 0, 0, 0, 790, 7553, 1, 0, 0, 0, 792, 7556, 1, 0, 0, 0, 794, 7563, 1, 0, 0, 0, 796, 7634, 1, 0, 0, 0, 798, 7636, 1, 0, 0, 0, 800, 7648, 1, 0, 0, 0, 802, 7650, 1, 0, 0, 0, 804, 7660, 1, 0, 0, 0, 806, 7662, 1, 0, 0, 0, 808, 7668, 1, 0, 0, 0, 810, 7700, 1, 0, 0, 0, 812, 7707, 1, 0, 0, 0, 814, 7710, 1, 0, 0, 0, 816, 7719, 1, 0, 0, 0, 818, 7722, 1, 0, 0, 0, 820, 7726, 1, 0, 0, 0, 822, 7743, 1, 0, 0, 0, 824, 7745, 1, 0, 0, 0, 826, 7747, 1, 0, 0, 0, 828, 7765, 1, 0, 0, 0, 830, 7770, 1, 0, 0, 0, 832, 7786, 1, 0, 0, 0, 834, 7794, 1, 0, 0, 0, 836, 7796, 1, 0, 0, 0, 838, 7802, 1, 0, 0, 0, 840, 7807, 1, 0, 0, 0, 842, 7816, 1, 0, 0, 0, 844, 7843, 1, 0, 0, 0, 846, 7845, 1, 0, 0, 0, 848, 7924, 1, 0, 0, 0, 850, 7926, 1, 0, 0, 0, 852, 7928, 1, 0, 0, 0, 854, 7961, 1, 0, 0, 0, 856, 7963, 1, 0, 0, 0, 858, 7989, 1, 0, 0, 0, 860, 8005, 1, 0, 0, 0, 862, 8007, 1, 0, 0, 0, 864, 8015, 1, 0, 0, 0, 866, 8017, 1, 0, 0, 0, 868, 8023, 1, 0, 0, 0, 870, 8027, 1, 0, 0, 0, 872, 8029, 1, 0, 0, 0, 874, 8031, 1, 0, 0, 0, 876, 8033, 1, 0, 0, 0, 878, 8035, 1, 0, 0, 0, 880, 8037, 1, 0, 0, 0, 882, 8041, 1, 0, 0, 0, 884, 8045, 1, 0, 0, 0, 886, 8053, 1, 0, 0, 0, 888, 8073, 1, 0, 0, 0, 890, 8084, 1, 0, 0, 0, 892, 8086, 1, 0, 0, 0, 894, 8094, 1, 0, 0, 0, 896, 8100, 1, 0, 0, 0, 898, 8104, 1, 0, 0, 0, 900, 8106, 1, 0, 0, 0, 902, 8114, 1, 0, 0, 0, 904, 8123, 1, 0, 0, 0, 906, 8163, 1, 0, 0, 0, 908, 8165, 1, 0, 0, 0, 910, 8179, 1, 0, 0, 0, 912, 8182, 1, 0, 0, 0, 914, 8194, 1, 0, 0, 0, 916, 8218, 1, 0, 0, 0, 918, 8220, 1, 0, 0, 0, 920, 8222, 1, 0, 0, 0, 922, 8230, 1, 0, 0, 0, 924, 8233, 1, 0, 0, 0, 926, 8257, 1, 0, 0, 0, 928, 8259, 1, 0, 0, 0, 930, 8263, 1, 0, 0, 0, 932, 8297, 1, 0, 0, 0, 934, 8316, 1, 0, 0, 0, 936, 8329, 1, 0, 0, 0, 938, 8337, 1, 0, 0, 0, 940, 8351, 1, 0, 0, 0, 942, 8354, 1, 0, 0, 0, 944, 8365, 1, 0, 0, 0, 946, 8381, 1, 0, 0, 0, 948, 8383, 1, 0, 0, 0, 950, 8388, 1, 0, 0, 0, 952, 8391, 1, 0, 0, 0, 954, 8406, 1, 0, 0, 0, 956, 8424, 1, 0, 0, 0, 958, 8426, 1, 0, 0, 0, 960, 8429, 1, 0, 0, 0, 962, 8437, 1, 0, 0, 0, 964, 8447, 1, 0, 0, 0, 966, 8456, 1, 0, 0, 0, 968, 8463, 1, 0, 0, 0, 970, 8467, 1, 0, 0, 0, 972, 8477, 1, 0, 0, 0, 974, 8508, 1, 0, 0, 0, 976, 8510, 1, 0, 0, 0, 978, 8521, 1, 0, 0, 0, 980, 8569, 1, 0, 0, 0, 982, 8571, 1, 0, 0, 0, 984, 8577, 1, 0, 0, 0, 986, 8585, 1, 0, 0, 0, 988, 8600, 1, 0, 0, 0, 990, 8602, 1, 0, 0, 0, 992, 8604, 1, 0, 0, 0, 994, 8612, 1, 0, 0, 0, 996, 8630, 1, 0, 0, 0, 998, 8632, 1, 0, 0, 0, 1000, 8634, 1, 0, 0, 0, 1002, 8636, 1, 0, 0, 0, 1004, 8644, 1, 0, 0, 0, 1006, 8646, 1, 0, 0, 0, 1008, 8648, 1, 0, 0, 0, 1010, 8652, 1, 0, 0, 0, 1012, 8660, 1, 0, 0, 0, 1014, 8679, 1, 0, 0, 0, 1016, 8681, 1, 0, 0, 0, 1018, 8706, 1, 0, 0, 0, 1020, 8708, 1, 0, 0, 0, 1022, 8717, 1, 0, 0, 0, 1024, 8719, 1, 0, 0, 0, 1026, 8726, 1, 0, 0, 0, 1028, 8730, 1, 0, 0, 0, 1030, 8732, 1, 0, 0, 0, 1032, 8734, 1, 0, 0, 0, 1034, 8736, 1, 0, 0, 0, 1036, 8740, 1, 0, 0, 0, 1038, 8753, 1, 0, 0, 0, 1040, 8755, 1, 0, 0, 0, 1042, 8758, 1, 0, 0, 0, 1044, 8763, 1, 0, 0, 0, 1046, 8768, 1, 0, 0, 0, 1048, 8774, 1, 0, 0, 0, 1050, 8781, 1, 0, 0, 0, 1052, 8783, 1, 0, 0, 0, 1054, 8786, 1, 0, 0, 0, 1056, 8790, 1, 0, 0, 0, 1058, 8797, 1, 0, 0, 0, 1060, 8809, 1, 0, 0, 0, 1062, 8812, 1, 0, 0, 0, 1064, 8826, 1, 0, 0, 0, 1066, 8829, 1, 0, 0, 0, 1068, 8895, 1, 0, 0, 0, 1070, 8919, 1, 0, 0, 0, 1072, 8922, 1, 0, 0, 0, 1074, 8931, 1, 0, 0, 0, 1076, 8934, 1, 0, 0, 0, 1078, 8955, 1, 0, 0, 0, 1080, 8957, 1, 0, 0, 0, 1082, 8968, 1, 0, 0, 0, 1084, 8982, 1, 0, 0, 0, 1086, 8984, 1, 0, 0, 0, 1088, 8992, 1, 0, 0, 0, 1090, 8999, 1, 0, 0, 0, 1092, 9007, 1, 0, 0, 0, 1094, 9024, 1, 0, 0, 0, 1096, 9026, 1, 0, 0, 0, 1098, 9030, 1, 0, 0, 0, 1100, 9038, 1, 0, 0, 0, 1102, 9043, 1, 0, 0, 0, 1104, 9046, 1, 0, 0, 0, 1106, 9049, 1, 0, 0, 0, 1108, 9056, 1, 0, 0, 0, 1110, 9058, 1, 0, 0, 0, 1112, 9066, 1, 0, 0, 0, 1114, 9071, 1, 0, 0, 0, 1116, 9092, 1, 0, 0, 0, 1118, 9100, 1, 0, 0, 0, 1120, 9110, 1, 0, 0, 0, 1122, 9122, 1, 0, 0, 0, 1124, 9124, 1, 0, 0, 0, 1126, 9138, 1, 0, 0, 0, 1128, 9158, 1, 0, 0, 0, 1130, 9167, 1, 0, 0, 0, 1132, 9185, 1, 0, 0, 0, 1134, 9191, 1, 0, 0, 0, 1136, 9197, 1, 0, 0, 0, 1138, 9205, 1, 0, 0, 0, 1140, 9233, 1, 0, 0, 0, 1142, 9235, 1, 0, 0, 0, 1144, 9241, 1, 0, 0, 0, 1146, 9245, 1, 0, 0, 0, 1148, 9247, 1, 0, 0, 0, 1150, 9255, 1, 0, 0, 0, 1152, 9259, 1, 0, 0, 0, 1154, 9266, 1, 0, 0, 0, 1156, 9283, 1, 0, 0, 0, 1158, 9285, 1, 0, 0, 0, 1160, 9287, 1, 0, 0, 0, 1162, 9297, 1, 0, 0, 0, 1164, 9305, 1, 0, 0, 0, 1166, 9332, 1, 0, 0, 0, 1168, 9334, 1, 0, 0, 0, 1170, 9341, 1, 0, 0, 0, 1172, 9344, 1, 0, 0, 0, 1174, 9346, 1, 0, 0, 0, 1176, 9350, 1, 0, 0, 0, 1178, 9358, 1, 0, 0, 0, 1180, 9366, 1, 0, 0, 0, 1182, 9374, 1, 0, 0, 0, 1184, 9388, 1, 0, 0, 0, 1186, 9397, 1, 0, 0, 0, 1188, 9401, 1, 0, 0, 0, 1190, 9405, 1, 0, 0, 0, 1192, 9431, 1, 0, 0, 0, 1194, 9445, 1, 0, 0, 0, 1196, 9461, 1, 0, 0, 0, 1198, 9471, 1, 0, 0, 0, 1200, 9475, 1, 0, 0, 0, 1202, 9483, 1, 0, 0, 0, 1204, 9491, 1, 0, 0, 0, 1206, 9497, 1, 0, 0, 0, 1208, 9501, 1, 0, 0, 0, 1210, 9508, 1, 0, 0, 0, 1212, 9513, 1, 0, 0, 0, 1214, 9528, 1, 0, 0, 0, 1216, 9608, 1, 0, 0, 0, 1218, 9610, 1, 0, 0, 0, 1220, 9612, 1, 0, 0, 0, 1222, 9650, 1, 0, 0, 0, 1224, 9654, 1, 0, 0, 0, 1226, 9839, 1, 0, 0, 0, 1228, 9846, 1, 0, 0, 0, 1230, 9858, 1, 0, 0, 0, 1232, 9860, 1, 0, 0, 0, 1234, 9865, 1, 0, 0, 0, 1236, 9873, 1, 0, 0, 0, 1238, 9878, 1, 0, 0, 0, 1240, 9884, 1, 0, 0, 0, 1242, 9901, 1, 0, 0, 0, 1244, 9903, 1, 0, 0, 0, 1246, 9906, 1, 0, 0, 0, 1248, 9912, 1, 0, 0, 0, 1250, 9918, 1, 0, 0, 0, 1252, 9921, 1, 0, 0, 0, 1254, 9929, 1, 0, 0, 0, 1256, 9933, 1, 0, 0, 0, 1258, 9938, 1, 0, 0, 0, 1260, 9953, 1, 0, 0, 0, 1262, 9955, 1, 0, 0, 0, 1264, 9974, 1, 0, 0, 0, 1266, 9982, 1, 0, 0, 0, 1268, 9991, 1, 0, 0, 0, 1270, 9993, 1, 0, 0, 0, 1272, 10014, 1, 0, 0, 0, 1274, 10016, 1, 0, 0, 0, 1276, 10023, 1, 0, 0, 0, 1278, 10029, 1, 0, 0, 0, 1280, 10033, 1, 0, 0, 0, 1282, 10035, 1, 0, 0, 0, 1284, 10043, 1, 0, 0, 0, 1286, 10051, 1, 0, 0, 0, 1288, 10065, 1, 0, 0, 0, 1290, 10067, 1, 0, 0, 0, 1292, 10075, 1, 0, 0, 0, 1294, 10088, 1, 0, 0, 0, 1296, 10090, 1, 0, 0, 0, 1298, 10098, 1, 0, 0, 0, 1300, 10105, 1, 0, 0, 0, 1302, 10113, 1, 0, 0, 0, 1304, 10125, 1, 0, 0, 0, 1306, 10127, 1, 0, 0, 0, 1308, 10129, 1, 0, 0, 0, 1310, 10138, 1, 0, 0, 0, 1312, 10169, 1, 0, 0, 0, 1314, 10178, 1, 0, 0, 0, 1316, 10185, 1, 0, 0, 0, 1318, 10187, 1, 0, 0, 0, 1320, 10198, 1, 0, 0, 0, 1322, 10202, 1, 0, 0, 0, 1324, 10207, 1, 0, 0, 0, 1326, 10210, 1, 0, 0, 0, 1328, 10212, 1, 0, 0, 0, 1330, 10233, 1, 0, 0, 0, 1332, 10235, 1, 0, 0, 0, 1334, 10238, 1, 0, 0, 0, 1336, 10245, 1, 0, 0, 0, 1338, 10248, 1, 0, 0, 0, 1340, 10250, 1, 0, 0, 0, 1342, 10263, 1, 0, 0, 0, 1344, 10268, 1, 0, 0, 0, 1346, 10270, 1, 0, 0, 0, 1348, 10278, 1, 0, 0, 0, 1350, 10282, 1, 0, 0, 0, 1352, 10290, 1, 0, 0, 0, 1354, 10292, 1, 0, 0, 0, 1356, 10294, 1, 0, 0, 0, 1358, 10303, 1, 0, 0, 0, 1360, 10340, 1, 0, 0, 0, 1362, 10342, 1, 0, 0, 0, 1364, 10344, 1, 0, 0, 0, 1366, 10346, 1, 0, 0, 0, 1368, 10348, 1, 0, 0, 0, 1370, 10350, 1, 0, 0, 0, 1372, 10365, 1, 0, 0, 0, 1374, 10367, 1, 0, 0, 0, 1376, 10375, 1, 0, 0, 0, 1378, 10377, 1, 0, 0, 0, 1380, 10382, 1, 0, 0, 0, 1382, 10384, 1, 0, 0, 0, 1384, 10398, 1, 0, 0, 0, 1386, 10404, 1, 0, 0, 0, 1388, 10410, 1, 0, 0, 0, 1390, 10416, 1, 0, 0, 0, 1392, 10424, 1, 0, 0, 0, 1394, 10435, 1, 0, 0, 0, 1396, 10437, 1, 0, 0, 0, 1398, 10439, 1, 0, 0, 0, 1400, 10493, 1, 0, 0, 0, 1402, 10495, 1, 0, 0, 0, 1404, 10497, 1, 0, 0, 0, 1406, 10499, 1, 0, 0, 0, 1408, 10501, 1, 0, 0, 0, 1410, 10509, 1, 0, 0, 0, 1412, 10532, 1, 0, 0, 0, 1414, 10534, 1, 0, 0, 0, 1416, 10540, 1, 0, 0, 0, 1418, 10542, 1, 0, 0, 0, 1420, 10544, 1, 0, 0, 0, 1422, 10555, 1, 0, 0, 0, 1424, 10563, 1, 0, 0, 0, 1426, 10566, 1, 0, 0, 0, 1428, 10570, 1, 0, 0, 0, 1430, 10577, 1, 0, 0, 0, 1432, 10579, 1, 0, 0, 0, 1434, 10613, 1, 0, 0, 0, 1436, 10615, 1, 0, 0, 0, 1438, 10617, 1, 0, 0, 0, 1440, 10621, 1, 0, 0, 0, 1442, 10629, 1, 0, 0, 0, 1444, 10632, 1, 0, 0, 0, 1446, 10636, 1, 0, 0, 0, 1448, 10638, 1, 0, 0, 0, 1450, 10640, 1, 0, 0, 0, 1452, 10642, 1, 0, 0, 0, 1454, 10644, 1, 0, 0, 0, 1456, 10647, 1, 0, 0, 0, 1458, 10650, 1, 0, 0, 0, 1460, 10655, 1, 0, 0, 0, 1462, 10657, 1, 0, 0, 0, 1464, 10662, 1, 0, 0, 0, 1466, 10692, 1, 0, 0, 0, 1468, 10694, 1, 0, 0, 0, 1470, 10716, 1, 0, 0, 0, 1472, 10718, 1, 0, 0, 0, 1474, 10720, 1, 0, 0, 0, 1476, 10725, 1, 0, 0, 0, 1478, 10733, 1, 0, 0, 0, 1480, 10735, 1, 0, 0, 0, 1482, 10743, 1, 0, 0, 0, 1484, 10747, 1, 0, 0, 0, 1486, 10749, 1, 0, 0, 0, 1488, 10753, 1, 0, 0, 0, 1490, 10764, 1, 0, 0, 0, 1492, 10783, 1, 0, 0, 0, 1494, 10786, 1, 0, 0, 0, 1496, 10789, 1, 0, 0, 0, 1498, 10801, 1, 0, 0, 0, 1500, 10804, 1, 0, 0, 0, 1502, 10808, 1, 0, 0, 0, 1504, 10813, 1, 0, 0, 0, 1506, 10817, 1, 0, 0, 0, 1508, 10822, 1, 0, 0, 0, 1510, 10829, 1, 0, 0, 0, 1512, 10835, 1, 0, 0, 0, 1514, 10859, 1, 0, 0, 0, 1516, 10862, 1, 0, 0, 0, 1518, 10873, 1, 0, 0, 0, 1520, 10875, 1, 0, 0, 0, 1522, 10878, 1, 0, 0, 0, 1524, 10881, 1, 0, 0, 0, 1526, 10893, 1, 0, 0, 0, 1528, 10896, 1, 0, 0, 0, 1530, 10905, 1, 0, 0, 0, 1532, 10907, 1, 0, 0, 0, 1534, 10926, 1, 0, 0, 0, 1536, 10971, 1, 0, 0, 0, 1538, 10973, 1, 0, 0, 0, 1540, 10977, 1, 0, 0, 0, 1542, 10981, 1, 0, 0, 0, 1544, 10984, 1, 0, 0, 0, 1546, 10988, 1, 0, 0, 0, 1548, 10996, 1, 0, 0, 0, 1550, 11003, 1, 0, 0, 0, 1552, 11006, 1, 0, 0, 0, 1554, 11015, 1, 0, 0, 0, 1556, 11018, 1, 0, 0, 0, 1558, 11037, 1, 0, 0, 0, 1560, 11040, 1, 0, 0, 0, 1562, 11048, 1, 0, 0, 0, 1564, 11054, 1, 0, 0, 0, 1566, 11084, 1, 0, 0, 0, 1568, 11086, 1, 0, 0, 0, 1570, 11094, 1, 0, 0, 0, 1572, 11098, 1, 0, 0, 0, 1574, 11102, 1, 0, 0, 0, 1576, 11104, 1, 0, 0, 0, 1578, 11116, 1, 0, 0, 0, 1580, 11118, 1, 0, 0, 0, 1582, 11135, 1, 0, 0, 0, 1584, 11137, 1, 0, 0, 0, 1586, 11144, 1, 0, 0, 0, 1588, 11148, 1, 0, 0, 0, 1590, 11151, 1, 0, 0, 0, 1592, 11157, 1, 0, 0, 0, 1594, 11163, 1, 0, 0, 0, 1596, 11181, 1, 0, 0, 0, 1598, 11185, 1, 0, 0, 0, 1600, 11187, 1, 0, 0, 0, 1602, 11191, 1, 0, 0, 0, 1604, 11195, 1, 0, 0, 0, 1606, 11200, 1, 0, 0, 0, 1608, 11211, 1, 0, 0, 0, 1610, 11213, 1, 0, 0, 0, 1612, 11215, 1, 0, 0, 0, 1614, 11217, 1, 0, 0, 0, 1616, 11219, 1, 0, 0, 0, 1618, 11224, 1, 0, 0, 0, 1620, 11226, 1, 0, 0, 0, 1622, 11229, 1, 0, 0, 0, 1624, 11249, 1, 0, 0, 0, 1626, 11251, 1, 0, 0, 0, 1628, 11253, 1, 0, 0, 0, 1630, 11255, 1, 0, 0, 0, 1632, 11257, 1, 0, 0, 0, 1634, 11261, 1, 0, 0, 0, 1636, 1637, 3, 4, 2, 0, 1637, 1638, 5, 0, 0, 1, 1638, 1, 1, 0, 0, 0, 1639, 1640, 3, 1408, 704, 0, 1640, 3, 1, 0, 0, 0, 1641, 1642, 3, 6, 3, 0, 1642, 5, 1, 0, 0, 0, 1643, 1645, 3, 8, 4, 0, 1644, 1646, 5, 7, 0, 0, 1645, 1644, 1, 0, 0, 0, 1645, 1646, 1, 0, 0, 0, 1646, 1648, 1, 0, 0, 0, 1647, 1643, 1, 0, 0, 0, 1648, 1651, 1, 0, 0, 0, 1649, 1647, 1, 0, 0, 0, 1649, 1650, 1, 0, 0, 0, 1650, 7, 1, 0, 0, 0, 1651, 1649, 1, 0, 0, 0, 1652, 1778, 3, 456, 228, 0, 1653, 1778, 3, 836, 418, 0, 1654, 1778, 3, 826, 413, 0, 1655, 1778, 3, 828, 414, 0, 1656, 1778, 3, 586, 293, 0, 1657, 1778, 3, 842, 421, 0, 1658, 1778, 3, 482, 241, 0, 1659, 1778, 3, 326, 163, 0, 1660, 1778, 3, 332, 166, 0, 1661, 1778, 3, 342, 171, 0, 1662, 1778, 3, 368, 184, 0, 1663, 1778, 3, 678, 339, 0, 1664, 1778, 3, 38, 19, 0, 1665, 1778, 3, 736, 368, 0, 1666, 1778, 3, 740, 370, 0, 1667, 1778, 3, 752, 376, 0, 1668, 1778, 3, 742, 371, 0, 1669, 1778, 3, 750, 375, 0, 1670, 1778, 3, 388, 194, 0, 1671, 1778, 3, 284, 142, 0, 1672, 1778, 3, 838, 419, 0, 1673, 1778, 3, 96, 48, 0, 1674, 1778, 3, 728, 364, 0, 1675, 1778, 3, 134, 67, 0, 1676, 1778, 3, 762, 381, 0, 1677, 1778, 3, 32, 16, 0, 1678, 1778, 3, 28, 14, 0, 1679, 1778, 3, 770, 385, 0, 1680, 1778, 3, 266, 133, 0, 1681, 1778, 3, 848, 424, 0, 1682, 1778, 3, 846, 423, 0, 1683, 1778, 3, 384, 192, 0, 1684, 1778, 3, 860, 430, 0, 1685, 1778, 3, 12, 6, 0, 1686, 1778, 3, 92, 46, 0, 1687, 1778, 3, 140, 70, 0, 1688, 1778, 3, 854, 427, 0, 1689, 1778, 3, 538, 269, 0, 1690, 1778, 3, 86, 43, 0, 1691, 1778, 3, 142, 71, 0, 1692, 1778, 3, 404, 202, 0, 1693, 1778, 3, 268, 134, 0, 1694, 1778, 3, 460, 230, 0, 1695, 1778, 3, 704, 352, 0, 1696, 1778, 3, 852, 426, 0, 1697, 1778, 3, 840, 420, 0, 1698, 1778, 3, 320, 160, 0, 1699, 1778, 3, 334, 167, 0, 1700, 1778, 3, 360, 180, 0, 1701, 1778, 3, 370, 185, 0, 1702, 1778, 3, 624, 312, 0, 1703, 1778, 3, 36, 18, 0, 1704, 1778, 3, 274, 137, 0, 1705, 1778, 3, 486, 243, 0, 1706, 1778, 3, 500, 250, 0, 1707, 1778, 3, 754, 377, 0, 1708, 1778, 3, 502, 251, 0, 1709, 1778, 3, 386, 193, 0, 1710, 1778, 3, 300, 150, 0, 1711, 1778, 3, 42, 21, 0, 1712, 1778, 3, 282, 141, 0, 1713, 1778, 3, 172, 86, 0, 1714, 1778, 3, 764, 382, 0, 1715, 1778, 3, 264, 132, 0, 1716, 1778, 3, 314, 157, 0, 1717, 1778, 3, 712, 356, 0, 1718, 1778, 3, 408, 204, 0, 1719, 1778, 3, 448, 224, 0, 1720, 1778, 3, 14, 7, 0, 1721, 1778, 3, 26, 13, 0, 1722, 1778, 3, 378, 189, 0, 1723, 1778, 3, 814, 407, 0, 1724, 1778, 3, 910, 455, 0, 1725, 1778, 3, 962, 481, 0, 1726, 1778, 3, 462, 231, 0, 1727, 1778, 3, 938, 469, 0, 1728, 1778, 3, 94, 47, 0, 1729, 1778, 3, 698, 349, 0, 1730, 1778, 3, 708, 354, 0, 1731, 1778, 3, 508, 254, 0, 1732, 1778, 3, 510, 255, 0, 1733, 1778, 3, 512, 256, 0, 1734, 1778, 3, 516, 258, 0, 1735, 1778, 3, 772, 386, 0, 1736, 1778, 3, 318, 159, 0, 1737, 1778, 3, 716, 358, 0, 1738, 1778, 3, 34, 17, 0, 1739, 1778, 3, 382, 191, 0, 1740, 1778, 3, 830, 415, 0, 1741, 1778, 3, 906, 453, 0, 1742, 1778, 3, 888, 444, 0, 1743, 1778, 3, 548, 274, 0, 1744, 1778, 3, 556, 278, 0, 1745, 1778, 3, 578, 289, 0, 1746, 1778, 3, 372, 186, 0, 1747, 1778, 3, 596, 298, 0, 1748, 1778, 3, 912, 456, 0, 1749, 1778, 3, 930, 465, 0, 1750, 1778, 3, 792, 396, 0, 1751, 1778, 3, 280, 140, 0, 1752, 1778, 3, 812, 406, 0, 1753, 1778, 3, 942, 471, 0, 1754, 1778, 3, 788, 394, 0, 1755, 1778, 3, 900, 450, 0, 1756, 1778, 3, 514, 257, 0, 1757, 1778, 3, 718, 359, 0, 1758, 1778, 3, 686, 343, 0, 1759, 1778, 3, 684, 342, 0, 1760, 1778, 3, 688, 344, 0, 1761, 1778, 3, 730, 365, 0, 1762, 1778, 3, 558, 279, 0, 1763, 1778, 3, 580, 290, 0, 1764, 1778, 3, 774, 387, 0, 1765, 1778, 3, 542, 271, 0, 1766, 1778, 3, 970, 485, 0, 1767, 1778, 3, 796, 398, 0, 1768, 1778, 3, 534, 267, 0, 1769, 1778, 3, 794, 397, 0, 1770, 1778, 3, 952, 476, 0, 1771, 1778, 3, 858, 429, 0, 1772, 1778, 3, 74, 37, 0, 1773, 1778, 3, 50, 25, 0, 1774, 1778, 3, 84, 42, 0, 1775, 1778, 3, 808, 404, 0, 1776, 1778, 3, 10, 5, 0, 1777, 1652, 1, 0, 0, 0, 1777, 1653, 1, 0, 0, 0, 1777, 1654, 1, 0, 0, 0, 1777, 1655, 1, 0, 0, 0, 1777, 1656, 1, 0, 0, 0, 1777, 1657, 1, 0, 0, 0, 1777, 1658, 1, 0, 0, 0, 1777, 1659, 1, 0, 0, 0, 1777, 1660, 1, 0, 0, 0, 1777, 1661, 1, 0, 0, 0, 1777, 1662, 1, 0, 0, 0, 1777, 1663, 1, 0, 0, 0, 1777, 1664, 1, 0, 0, 0, 1777, 1665, 1, 0, 0, 0, 1777, 1666, 1, 0, 0, 0, 1777, 1667, 1, 0, 0, 0, 1777, 1668, 1, 0, 0, 0, 1777, 1669, 1, 0, 0, 0, 1777, 1670, 1, 0, 0, 0, 1777, 1671, 1, 0, 0, 0, 1777, 1672, 1, 0, 0, 0, 1777, 1673, 1, 0, 0, 0, 1777, 1674, 1, 0, 0, 0, 1777, 1675, 1, 0, 0, 0, 1777, 1676, 1, 0, 0, 0, 1777, 1677, 1, 0, 0, 0, 1777, 1678, 1, 0, 0, 0, 1777, 1679, 1, 0, 0, 0, 1777, 1680, 1, 0, 0, 0, 1777, 1681, 1, 0, 0, 0, 1777, 1682, 1, 0, 0, 0, 1777, 1683, 1, 0, 0, 0, 1777, 1684, 1, 0, 0, 0, 1777, 1685, 1, 0, 0, 0, 1777, 1686, 1, 0, 0, 0, 1777, 1687, 1, 0, 0, 0, 1777, 1688, 1, 0, 0, 0, 1777, 1689, 1, 0, 0, 0, 1777, 1690, 1, 0, 0, 0, 1777, 1691, 1, 0, 0, 0, 1777, 1692, 1, 0, 0, 0, 1777, 1693, 1, 0, 0, 0, 1777, 1694, 1, 0, 0, 0, 1777, 1695, 1, 0, 0, 0, 1777, 1696, 1, 0, 0, 0, 1777, 1697, 1, 0, 0, 0, 1777, 1698, 1, 0, 0, 0, 1777, 1699, 1, 0, 0, 0, 1777, 1700, 1, 0, 0, 0, 1777, 1701, 1, 0, 0, 0, 1777, 1702, 1, 0, 0, 0, 1777, 1703, 1, 0, 0, 0, 1777, 1704, 1, 0, 0, 0, 1777, 1705, 1, 0, 0, 0, 1777, 1706, 1, 0, 0, 0, 1777, 1707, 1, 0, 0, 0, 1777, 1708, 1, 0, 0, 0, 1777, 1709, 1, 0, 0, 0, 1777, 1710, 1, 0, 0, 0, 1777, 1711, 1, 0, 0, 0, 1777, 1712, 1, 0, 0, 0, 1777, 1713, 1, 0, 0, 0, 1777, 1714, 1, 0, 0, 0, 1777, 1715, 1, 0, 0, 0, 1777, 1716, 1, 0, 0, 0, 1777, 1717, 1, 0, 0, 0, 1777, 1718, 1, 0, 0, 0, 1777, 1719, 1, 0, 0, 0, 1777, 1720, 1, 0, 0, 0, 1777, 1721, 1, 0, 0, 0, 1777, 1722, 1, 0, 0, 0, 1777, 1723, 1, 0, 0, 0, 1777, 1724, 1, 0, 0, 0, 1777, 1725, 1, 0, 0, 0, 1777, 1726, 1, 0, 0, 0, 1777, 1727, 1, 0, 0, 0, 1777, 1728, 1, 0, 0, 0, 1777, 1729, 1, 0, 0, 0, 1777, 1730, 1, 0, 0, 0, 1777, 1731, 1, 0, 0, 0, 1777, 1732, 1, 0, 0, 0, 1777, 1733, 1, 0, 0, 0, 1777, 1734, 1, 0, 0, 0, 1777, 1735, 1, 0, 0, 0, 1777, 1736, 1, 0, 0, 0, 1777, 1737, 1, 0, 0, 0, 1777, 1738, 1, 0, 0, 0, 1777, 1739, 1, 0, 0, 0, 1777, 1740, 1, 0, 0, 0, 1777, 1741, 1, 0, 0, 0, 1777, 1742, 1, 0, 0, 0, 1777, 1743, 1, 0, 0, 0, 1777, 1744, 1, 0, 0, 0, 1777, 1745, 1, 0, 0, 0, 1777, 1746, 1, 0, 0, 0, 1777, 1747, 1, 0, 0, 0, 1777, 1748, 1, 0, 0, 0, 1777, 1749, 1, 0, 0, 0, 1777, 1750, 1, 0, 0, 0, 1777, 1751, 1, 0, 0, 0, 1777, 1752, 1, 0, 0, 0, 1777, 1753, 1, 0, 0, 0, 1777, 1754, 1, 0, 0, 0, 1777, 1755, 1, 0, 0, 0, 1777, 1756, 1, 0, 0, 0, 1777, 1757, 1, 0, 0, 0, 1777, 1758, 1, 0, 0, 0, 1777, 1759, 1, 0, 0, 0, 1777, 1760, 1, 0, 0, 0, 1777, 1761, 1, 0, 0, 0, 1777, 1762, 1, 0, 0, 0, 1777, 1763, 1, 0, 0, 0, 1777, 1764, 1, 0, 0, 0, 1777, 1765, 1, 0, 0, 0, 1777, 1766, 1, 0, 0, 0, 1777, 1767, 1, 0, 0, 0, 1777, 1768, 1, 0, 0, 0, 1777, 1769, 1, 0, 0, 0, 1777, 1770, 1, 0, 0, 0, 1777, 1771, 1, 0, 0, 0, 1777, 1772, 1, 0, 0, 0, 1777, 1773, 1, 0, 0, 0, 1777, 1774, 1, 0, 0, 0, 1777, 1775, 1, 0, 0, 0, 1777, 1776, 1, 0, 0, 0, 1778, 9, 1, 0, 0, 0, 1779, 1781, 5, 675, 0, 0, 1780, 1782, 5, 676, 0, 0, 1781, 1780, 1, 0, 0, 0, 1781, 1782, 1, 0, 0, 0, 1782, 11, 1, 0, 0, 0, 1783, 1784, 5, 435, 0, 0, 1784, 1785, 3, 1220, 610, 0, 1785, 13, 1, 0, 0, 0, 1786, 1787, 5, 46, 0, 0, 1787, 1788, 5, 311, 0, 0, 1788, 1790, 3, 1378, 689, 0, 1789, 1791, 3, 16, 8, 0, 1790, 1789, 1, 0, 0, 0, 1790, 1791, 1, 0, 0, 0, 1791, 1792, 1, 0, 0, 0, 1792, 1793, 3, 18, 9, 0, 1793, 15, 1, 0, 0, 0, 1794, 1795, 5, 105, 0, 0, 1795, 17, 1, 0, 0, 0, 1796, 1798, 3, 24, 12, 0, 1797, 1796, 1, 0, 0, 0, 1798, 1801, 1, 0, 0, 0, 1799, 1797, 1, 0, 0, 0, 1799, 1800, 1, 0, 0, 0, 1800, 19, 1, 0, 0, 0, 1801, 1799, 1, 0, 0, 0, 1802, 1804, 3, 22, 11, 0, 1803, 1802, 1, 0, 0, 0, 1804, 1807, 1, 0, 0, 0, 1805, 1803, 1, 0, 0, 0, 1805, 1806, 1, 0, 0, 0, 1806, 21, 1, 0, 0, 0, 1807, 1805, 1, 0, 0, 0, 1808, 1811, 5, 280, 0, 0, 1809, 1812, 3, 1370, 685, 0, 1810, 1812, 5, 78, 0, 0, 1811, 1809, 1, 0, 0, 0, 1811, 1810, 1, 0, 0, 0, 1812, 1827, 1, 0, 0, 0, 1813, 1814, 7, 0, 0, 0, 1814, 1815, 5, 280, 0, 0, 1815, 1827, 3, 1370, 685, 0, 1816, 1827, 5, 228, 0, 0, 1817, 1818, 5, 164, 0, 0, 1818, 1819, 5, 74, 0, 0, 1819, 1827, 3, 1376, 688, 0, 1820, 1821, 5, 364, 0, 0, 1821, 1822, 5, 361, 0, 0, 1822, 1827, 3, 1370, 685, 0, 1823, 1824, 5, 99, 0, 0, 1824, 1827, 3, 1382, 691, 0, 1825, 1827, 3, 1394, 697, 0, 1826, 1808, 1, 0, 0, 0, 1826, 1813, 1, 0, 0, 0, 1826, 1816, 1, 0, 0, 0, 1826, 1817, 1, 0, 0, 0, 1826, 1820, 1, 0, 0, 0, 1826, 1823, 1, 0, 0, 0, 1826, 1825, 1, 0, 0, 0, 1827, 23, 1, 0, 0, 0, 1828, 1839, 3, 22, 11, 0, 1829, 1830, 5, 341, 0, 0, 1830, 1839, 3, 1368, 684, 0, 1831, 1832, 5, 134, 0, 0, 1832, 1839, 3, 1382, 691, 0, 1833, 1834, 5, 311, 0, 0, 1834, 1839, 3, 1382, 691, 0, 1835, 1836, 5, 68, 0, 0, 1836, 1837, 7, 1, 0, 0, 1837, 1839, 3, 1382, 691, 0, 1838, 1828, 1, 0, 0, 0, 1838, 1829, 1, 0, 0, 0, 1838, 1831, 1, 0, 0, 0, 1838, 1833, 1, 0, 0, 0, 1838, 1835, 1, 0, 0, 0, 1839, 25, 1, 0, 0, 0, 1840, 1841, 5, 46, 0, 0, 1841, 1842, 5, 99, 0, 0, 1842, 1844, 3, 1378, 689, 0, 1843, 1845, 3, 16, 8, 0, 1844, 1843, 1, 0, 0, 0, 1844, 1845, 1, 0, 0, 0, 1845, 1846, 1, 0, 0, 0, 1846, 1847, 3, 18, 9, 0, 1847, 27, 1, 0, 0, 0, 1848, 1849, 5, 138, 0, 0, 1849, 1850, 7, 2, 0, 0, 1850, 1852, 3, 1380, 690, 0, 1851, 1853, 3, 16, 8, 0, 1852, 1851, 1, 0, 0, 0, 1852, 1853, 1, 0, 0, 0, 1853, 1854, 1, 0, 0, 0, 1854, 1855, 3, 20, 10, 0, 1855, 29, 1, 0, 0, 0, 1856, 1857, 5, 68, 0, 0, 1857, 1858, 5, 175, 0, 0, 1858, 1859, 3, 1352, 676, 0, 1859, 31, 1, 0, 0, 0, 1860, 1861, 5, 138, 0, 0, 1861, 1863, 7, 2, 0, 0, 1862, 1864, 5, 30, 0, 0, 1863, 1862, 1, 0, 0, 0, 1863, 1864, 1, 0, 0, 0, 1864, 1865, 1, 0, 0, 0, 1865, 1867, 3, 1380, 690, 0, 1866, 1868, 3, 30, 15, 0, 1867, 1866, 1, 0, 0, 0, 1867, 1868, 1, 0, 0, 0, 1868, 1869, 1, 0, 0, 0, 1869, 1870, 3, 80, 40, 0, 1870, 33, 1, 0, 0, 0, 1871, 1872, 5, 191, 0, 0, 1872, 1875, 7, 3, 0, 0, 1873, 1874, 5, 220, 0, 0, 1874, 1876, 5, 390, 0, 0, 1875, 1873, 1, 0, 0, 0, 1875, 1876, 1, 0, 0, 0, 1876, 1877, 1, 0, 0, 0, 1877, 1878, 3, 1382, 691, 0, 1878, 35, 1, 0, 0, 0, 1879, 1880, 5, 46, 0, 0, 1880, 1881, 5, 66, 0, 0, 1881, 1883, 3, 1378, 689, 0, 1882, 1884, 3, 16, 8, 0, 1883, 1882, 1, 0, 0, 0, 1883, 1884, 1, 0, 0, 0, 1884, 1885, 1, 0, 0, 0, 1885, 1886, 3, 18, 9, 0, 1886, 37, 1, 0, 0, 0, 1887, 1888, 5, 138, 0, 0, 1888, 1889, 5, 66, 0, 0, 1889, 1890, 3, 1380, 690, 0, 1890, 1891, 3, 40, 20, 0, 1891, 1892, 5, 99, 0, 0, 1892, 1893, 3, 1382, 691, 0, 1893, 39, 1, 0, 0, 0, 1894, 1895, 7, 4, 0, 0, 1895, 41, 1, 0, 0, 0, 1896, 1897, 5, 46, 0, 0, 1897, 1901, 5, 316, 0, 0, 1898, 1899, 5, 220, 0, 0, 1899, 1900, 5, 77, 0, 0, 1900, 1902, 5, 390, 0, 0, 1901, 1898, 1, 0, 0, 0, 1901, 1902, 1, 0, 0, 0, 1902, 1909, 1, 0, 0, 0, 1903, 1905, 3, 44, 22, 0, 1904, 1903, 1, 0, 0, 0, 1904, 1905, 1, 0, 0, 0, 1905, 1906, 1, 0, 0, 0, 1906, 1907, 5, 106, 0, 0, 1907, 1910, 3, 1380, 690, 0, 1908, 1910, 3, 1384, 692, 0, 1909, 1904, 1, 0, 0, 0, 1909, 1908, 1, 0, 0, 0, 1910, 1911, 1, 0, 0, 0, 1911, 1912, 3, 46, 23, 0, 1912, 43, 1, 0, 0, 0, 1913, 1914, 3, 1384, 692, 0, 1914, 45, 1, 0, 0, 0, 1915, 1917, 3, 48, 24, 0, 1916, 1915, 1, 0, 0, 0, 1917, 1920, 1, 0, 0, 0, 1918, 1916, 1, 0, 0, 0, 1918, 1919, 1, 0, 0, 0, 1919, 47, 1, 0, 0, 0, 1920, 1918, 1, 0, 0, 0, 1921, 1928, 3, 172, 86, 0, 1922, 1928, 3, 596, 298, 0, 1923, 1928, 3, 282, 141, 0, 1924, 1928, 3, 408, 204, 0, 1925, 1928, 3, 556, 278, 0, 1926, 1928, 3, 808, 404, 0, 1927, 1921, 1, 0, 0, 0, 1927, 1922, 1, 0, 0, 0, 1927, 1923, 1, 0, 0, 0, 1927, 1924, 1, 0, 0, 0, 1927, 1925, 1, 0, 0, 0, 1927, 1926, 1, 0, 0, 0, 1928, 49, 1, 0, 0, 0, 1929, 1931, 5, 326, 0, 0, 1930, 1932, 7, 5, 0, 0, 1931, 1930, 1, 0, 0, 0, 1931, 1932, 1, 0, 0, 0, 1932, 1933, 1, 0, 0, 0, 1933, 1934, 3, 52, 26, 0, 1934, 51, 1, 0, 0, 0, 1935, 1936, 5, 349, 0, 0, 1936, 1944, 3, 802, 401, 0, 1937, 1938, 5, 325, 0, 0, 1938, 1939, 5, 154, 0, 0, 1939, 1940, 5, 36, 0, 0, 1940, 1941, 5, 349, 0, 0, 1941, 1944, 3, 802, 401, 0, 1942, 1944, 3, 56, 28, 0, 1943, 1935, 1, 0, 0, 0, 1943, 1937, 1, 0, 0, 0, 1943, 1942, 1, 0, 0, 0, 1944, 53, 1, 0, 0, 0, 1945, 1946, 3, 58, 29, 0, 1946, 1947, 7, 6, 0, 0, 1947, 1948, 3, 60, 30, 0, 1948, 55, 1, 0, 0, 0, 1949, 1977, 3, 54, 27, 0, 1950, 1951, 3, 58, 29, 0, 1951, 1952, 5, 64, 0, 0, 1952, 1953, 5, 436, 0, 0, 1953, 1977, 1, 0, 0, 0, 1954, 1955, 5, 413, 0, 0, 1955, 1956, 5, 379, 0, 0, 1956, 1977, 3, 68, 34, 0, 1957, 1958, 5, 152, 0, 0, 1958, 1977, 3, 1370, 685, 0, 1959, 1960, 5, 316, 0, 0, 1960, 1977, 3, 1370, 685, 0, 1961, 1963, 5, 260, 0, 0, 1962, 1964, 3, 70, 35, 0, 1963, 1962, 1, 0, 0, 0, 1963, 1964, 1, 0, 0, 0, 1964, 1977, 1, 0, 0, 0, 1965, 1966, 5, 311, 0, 0, 1966, 1977, 3, 72, 36, 0, 1967, 1968, 5, 325, 0, 0, 1968, 1969, 5, 106, 0, 0, 1969, 1977, 3, 72, 36, 0, 1970, 1971, 5, 376, 0, 0, 1971, 1972, 5, 272, 0, 0, 1972, 1977, 3, 1238, 619, 0, 1973, 1974, 5, 349, 0, 0, 1974, 1975, 5, 330, 0, 0, 1975, 1977, 3, 1370, 685, 0, 1976, 1949, 1, 0, 0, 0, 1976, 1950, 1, 0, 0, 0, 1976, 1954, 1, 0, 0, 0, 1976, 1957, 1, 0, 0, 0, 1976, 1959, 1, 0, 0, 0, 1976, 1961, 1, 0, 0, 0, 1976, 1965, 1, 0, 0, 0, 1976, 1967, 1, 0, 0, 0, 1976, 1970, 1, 0, 0, 0, 1976, 1973, 1, 0, 0, 0, 1977, 57, 1, 0, 0, 0, 1978, 1983, 3, 1384, 692, 0, 1979, 1980, 5, 11, 0, 0, 1980, 1982, 3, 1384, 692, 0, 1981, 1979, 1, 0, 0, 0, 1982, 1985, 1, 0, 0, 0, 1983, 1981, 1, 0, 0, 0, 1983, 1984, 1, 0, 0, 0, 1984, 59, 1, 0, 0, 0, 1985, 1983, 1, 0, 0, 0, 1986, 1991, 3, 62, 31, 0, 1987, 1988, 5, 6, 0, 0, 1988, 1990, 3, 62, 31, 0, 1989, 1987, 1, 0, 0, 0, 1990, 1993, 1, 0, 0, 0, 1991, 1989, 1, 0, 0, 0, 1991, 1992, 1, 0, 0, 0, 1992, 61, 1, 0, 0, 0, 1993, 1991, 1, 0, 0, 0, 1994, 1997, 3, 66, 33, 0, 1995, 1997, 3, 296, 148, 0, 1996, 1994, 1, 0, 0, 0, 1996, 1995, 1, 0, 0, 0, 1997, 63, 1, 0, 0, 0, 1998, 1999, 5, 293, 0, 0, 1999, 2004, 7, 7, 0, 0, 2000, 2001, 5, 303, 0, 0, 2001, 2004, 5, 293, 0, 0, 2002, 2004, 5, 323, 0, 0, 2003, 1998, 1, 0, 0, 0, 2003, 2000, 1, 0, 0, 0, 2003, 2002, 1, 0, 0, 0, 2004, 65, 1, 0, 0, 0, 2005, 2010, 5, 96, 0, 0, 2006, 2010, 5, 60, 0, 0, 2007, 2010, 5, 80, 0, 0, 2008, 2010, 3, 72, 36, 0, 2009, 2005, 1, 0, 0, 0, 2009, 2006, 1, 0, 0, 0, 2009, 2007, 1, 0, 0, 0, 2009, 2008, 1, 0, 0, 0, 2010, 67, 1, 0, 0, 0, 2011, 2028, 3, 1370, 685, 0, 2012, 2028, 3, 1394, 697, 0, 2013, 2014, 3, 1162, 581, 0, 2014, 2016, 3, 1370, 685, 0, 2015, 2017, 3, 1166, 583, 0, 2016, 2015, 1, 0, 0, 0, 2016, 2017, 1, 0, 0, 0, 2017, 2028, 1, 0, 0, 0, 2018, 2019, 3, 1162, 581, 0, 2019, 2020, 5, 2, 0, 0, 2020, 2021, 3, 1368, 684, 0, 2021, 2022, 5, 3, 0, 0, 2022, 2023, 3, 1370, 685, 0, 2023, 2028, 1, 0, 0, 0, 2024, 2028, 3, 296, 148, 0, 2025, 2028, 5, 53, 0, 0, 2026, 2028, 5, 245, 0, 0, 2027, 2011, 1, 0, 0, 0, 2027, 2012, 1, 0, 0, 0, 2027, 2013, 1, 0, 0, 0, 2027, 2018, 1, 0, 0, 0, 2027, 2024, 1, 0, 0, 0, 2027, 2025, 1, 0, 0, 0, 2027, 2026, 1, 0, 0, 0, 2028, 69, 1, 0, 0, 0, 2029, 2032, 3, 1370, 685, 0, 2030, 2032, 5, 53, 0, 0, 2031, 2029, 1, 0, 0, 0, 2031, 2030, 1, 0, 0, 0, 2032, 71, 1, 0, 0, 0, 2033, 2036, 3, 1390, 695, 0, 2034, 2036, 3, 1370, 685, 0, 2035, 2033, 1, 0, 0, 0, 2035, 2034, 1, 0, 0, 0, 2036, 73, 1, 0, 0, 0, 2037, 2038, 5, 306, 0, 0, 2038, 2039, 3, 76, 38, 0, 2039, 75, 1, 0, 0, 0, 2040, 2049, 3, 78, 39, 0, 2041, 2042, 5, 413, 0, 0, 2042, 2049, 5, 379, 0, 0, 2043, 2044, 5, 349, 0, 0, 2044, 2045, 5, 235, 0, 0, 2045, 2049, 5, 242, 0, 0, 2046, 2047, 5, 325, 0, 0, 2047, 2049, 5, 106, 0, 0, 2048, 2040, 1, 0, 0, 0, 2048, 2041, 1, 0, 0, 0, 2048, 2043, 1, 0, 0, 0, 2048, 2046, 1, 0, 0, 0, 2049, 77, 1, 0, 0, 0, 2050, 2053, 3, 58, 29, 0, 2051, 2053, 5, 30, 0, 0, 2052, 2050, 1, 0, 0, 0, 2052, 2051, 1, 0, 0, 0, 2053, 79, 1, 0, 0, 0, 2054, 2055, 5, 326, 0, 0, 2055, 2058, 3, 52, 26, 0, 2056, 2058, 3, 74, 37, 0, 2057, 2054, 1, 0, 0, 0, 2057, 2056, 1, 0, 0, 0, 2058, 81, 1, 0, 0, 0, 2059, 2060, 5, 326, 0, 0, 2060, 2063, 3, 56, 28, 0, 2061, 2063, 3, 74, 37, 0, 2062, 2059, 1, 0, 0, 0, 2062, 2061, 1, 0, 0, 0, 2063, 83, 1, 0, 0, 0, 2064, 2074, 5, 328, 0, 0, 2065, 2075, 3, 58, 29, 0, 2066, 2067, 5, 413, 0, 0, 2067, 2075, 5, 379, 0, 0, 2068, 2069, 5, 349, 0, 0, 2069, 2070, 5, 235, 0, 0, 2070, 2075, 5, 242, 0, 0, 2071, 2072, 5, 325, 0, 0, 2072, 2075, 5, 106, 0, 0, 2073, 2075, 5, 30, 0, 0, 2074, 2065, 1, 0, 0, 0, 2074, 2066, 1, 0, 0, 0, 2074, 2068, 1, 0, 0, 0, 2074, 2071, 1, 0, 0, 0, 2074, 2073, 1, 0, 0, 0, 2075, 85, 1, 0, 0, 0, 2076, 2077, 5, 326, 0, 0, 2077, 2078, 5, 165, 0, 0, 2078, 2079, 3, 88, 44, 0, 2079, 2080, 3, 90, 45, 0, 2080, 87, 1, 0, 0, 0, 2081, 2084, 5, 30, 0, 0, 2082, 2084, 3, 1346, 673, 0, 2083, 2081, 1, 0, 0, 0, 2083, 2082, 1, 0, 0, 0, 2084, 89, 1, 0, 0, 0, 2085, 2086, 7, 8, 0, 0, 2086, 91, 1, 0, 0, 0, 2087, 2088, 5, 155, 0, 0, 2088, 93, 1, 0, 0, 0, 2089, 2090, 5, 187, 0, 0, 2090, 2091, 7, 9, 0, 0, 2091, 95, 1, 0, 0, 0, 2092, 2093, 5, 138, 0, 0, 2093, 2096, 5, 92, 0, 0, 2094, 2095, 5, 220, 0, 0, 2095, 2097, 5, 390, 0, 0, 2096, 2094, 1, 0, 0, 0, 2096, 2097, 1, 0, 0, 0, 2097, 2098, 1, 0, 0, 0, 2098, 2101, 3, 1084, 542, 0, 2099, 2102, 3, 98, 49, 0, 2100, 2102, 3, 100, 50, 0, 2101, 2099, 1, 0, 0, 0, 2101, 2100, 1, 0, 0, 0, 2102, 2205, 1, 0, 0, 0, 2103, 2104, 5, 138, 0, 0, 2104, 2105, 5, 92, 0, 0, 2105, 2106, 5, 30, 0, 0, 2106, 2107, 5, 68, 0, 0, 2107, 2108, 5, 344, 0, 0, 2108, 2112, 3, 1352, 676, 0, 2109, 2110, 5, 274, 0, 0, 2110, 2111, 5, 147, 0, 0, 2111, 2113, 3, 1382, 691, 0, 2112, 2109, 1, 0, 0, 0, 2112, 2113, 1, 0, 0, 0, 2113, 2114, 1, 0, 0, 0, 2114, 2115, 5, 326, 0, 0, 2115, 2116, 5, 344, 0, 0, 2116, 2118, 3, 1352, 676, 0, 2117, 2119, 3, 948, 474, 0, 2118, 2117, 1, 0, 0, 0, 2118, 2119, 1, 0, 0, 0, 2119, 2205, 1, 0, 0, 0, 2120, 2121, 5, 138, 0, 0, 2121, 2124, 5, 226, 0, 0, 2122, 2123, 5, 220, 0, 0, 2123, 2125, 5, 390, 0, 0, 2124, 2122, 1, 0, 0, 0, 2124, 2125, 1, 0, 0, 0, 2125, 2126, 1, 0, 0, 0, 2126, 2129, 3, 1348, 674, 0, 2127, 2130, 3, 98, 49, 0, 2128, 2130, 3, 102, 51, 0, 2129, 2127, 1, 0, 0, 0, 2129, 2128, 1, 0, 0, 0, 2130, 2205, 1, 0, 0, 0, 2131, 2132, 5, 138, 0, 0, 2132, 2133, 5, 226, 0, 0, 2133, 2134, 5, 30, 0, 0, 2134, 2135, 5, 68, 0, 0, 2135, 2136, 5, 344, 0, 0, 2136, 2140, 3, 1352, 676, 0, 2137, 2138, 5, 274, 0, 0, 2138, 2139, 5, 147, 0, 0, 2139, 2141, 3, 1382, 691, 0, 2140, 2137, 1, 0, 0, 0, 2140, 2141, 1, 0, 0, 0, 2141, 2142, 1, 0, 0, 0, 2142, 2143, 5, 326, 0, 0, 2143, 2144, 5, 344, 0, 0, 2144, 2146, 3, 1352, 676, 0, 2145, 2147, 3, 948, 474, 0, 2146, 2145, 1, 0, 0, 0, 2146, 2147, 1, 0, 0, 0, 2147, 2205, 1, 0, 0, 0, 2148, 2149, 5, 138, 0, 0, 2149, 2152, 5, 321, 0, 0, 2150, 2151, 5, 220, 0, 0, 2151, 2153, 5, 390, 0, 0, 2152, 2150, 1, 0, 0, 0, 2152, 2153, 1, 0, 0, 0, 2153, 2154, 1, 0, 0, 0, 2154, 2155, 3, 1348, 674, 0, 2155, 2156, 3, 98, 49, 0, 2156, 2205, 1, 0, 0, 0, 2157, 2158, 5, 138, 0, 0, 2158, 2161, 5, 369, 0, 0, 2159, 2160, 5, 220, 0, 0, 2160, 2162, 5, 390, 0, 0, 2161, 2159, 1, 0, 0, 0, 2161, 2162, 1, 0, 0, 0, 2162, 2163, 1, 0, 0, 0, 2163, 2164, 3, 1348, 674, 0, 2164, 2165, 3, 98, 49, 0, 2165, 2205, 1, 0, 0, 0, 2166, 2167, 5, 138, 0, 0, 2167, 2168, 5, 251, 0, 0, 2168, 2171, 5, 369, 0, 0, 2169, 2170, 5, 220, 0, 0, 2170, 2172, 5, 390, 0, 0, 2171, 2169, 1, 0, 0, 0, 2171, 2172, 1, 0, 0, 0, 2172, 2173, 1, 0, 0, 0, 2173, 2174, 3, 1348, 674, 0, 2174, 2175, 3, 98, 49, 0, 2175, 2205, 1, 0, 0, 0, 2176, 2177, 5, 138, 0, 0, 2177, 2178, 5, 251, 0, 0, 2178, 2179, 5, 369, 0, 0, 2179, 2180, 5, 30, 0, 0, 2180, 2181, 5, 68, 0, 0, 2181, 2182, 5, 344, 0, 0, 2182, 2186, 3, 1352, 676, 0, 2183, 2184, 5, 274, 0, 0, 2184, 2185, 5, 147, 0, 0, 2185, 2187, 3, 1382, 691, 0, 2186, 2183, 1, 0, 0, 0, 2186, 2187, 1, 0, 0, 0, 2187, 2188, 1, 0, 0, 0, 2188, 2189, 5, 326, 0, 0, 2189, 2190, 5, 344, 0, 0, 2190, 2192, 3, 1352, 676, 0, 2191, 2193, 3, 948, 474, 0, 2192, 2191, 1, 0, 0, 0, 2192, 2193, 1, 0, 0, 0, 2193, 2205, 1, 0, 0, 0, 2194, 2195, 5, 138, 0, 0, 2195, 2196, 5, 63, 0, 0, 2196, 2199, 5, 92, 0, 0, 2197, 2198, 5, 220, 0, 0, 2198, 2200, 5, 390, 0, 0, 2199, 2197, 1, 0, 0, 0, 2199, 2200, 1, 0, 0, 0, 2200, 2201, 1, 0, 0, 0, 2201, 2202, 3, 1084, 542, 0, 2202, 2203, 3, 98, 49, 0, 2203, 2205, 1, 0, 0, 0, 2204, 2092, 1, 0, 0, 0, 2204, 2103, 1, 0, 0, 0, 2204, 2120, 1, 0, 0, 0, 2204, 2131, 1, 0, 0, 0, 2204, 2148, 1, 0, 0, 0, 2204, 2157, 1, 0, 0, 0, 2204, 2166, 1, 0, 0, 0, 2204, 2176, 1, 0, 0, 0, 2204, 2194, 1, 0, 0, 0, 2205, 97, 1, 0, 0, 0, 2206, 2211, 3, 104, 52, 0, 2207, 2208, 5, 6, 0, 0, 2208, 2210, 3, 104, 52, 0, 2209, 2207, 1, 0, 0, 0, 2210, 2213, 1, 0, 0, 0, 2211, 2209, 1, 0, 0, 0, 2211, 2212, 1, 0, 0, 0, 2212, 99, 1, 0, 0, 0, 2213, 2211, 1, 0, 0, 0, 2214, 2215, 5, 437, 0, 0, 2215, 2216, 5, 278, 0, 0, 2216, 2217, 3, 1348, 674, 0, 2217, 2218, 3, 128, 64, 0, 2218, 2223, 1, 0, 0, 0, 2219, 2220, 5, 438, 0, 0, 2220, 2221, 5, 278, 0, 0, 2221, 2223, 3, 1348, 674, 0, 2222, 2214, 1, 0, 0, 0, 2222, 2219, 1, 0, 0, 0, 2223, 101, 1, 0, 0, 0, 2224, 2225, 5, 437, 0, 0, 2225, 2226, 5, 278, 0, 0, 2226, 2227, 3, 1348, 674, 0, 2227, 103, 1, 0, 0, 0, 2228, 2229, 5, 133, 0, 0, 2229, 2531, 3, 188, 94, 0, 2230, 2231, 5, 133, 0, 0, 2231, 2232, 5, 220, 0, 0, 2232, 2233, 5, 77, 0, 0, 2233, 2234, 5, 390, 0, 0, 2234, 2531, 3, 188, 94, 0, 2235, 2236, 5, 133, 0, 0, 2236, 2237, 5, 44, 0, 0, 2237, 2531, 3, 188, 94, 0, 2238, 2239, 5, 133, 0, 0, 2239, 2240, 5, 44, 0, 0, 2240, 2241, 5, 220, 0, 0, 2241, 2242, 5, 77, 0, 0, 2242, 2243, 5, 390, 0, 0, 2243, 2531, 3, 188, 94, 0, 2244, 2246, 5, 138, 0, 0, 2245, 2247, 3, 732, 366, 0, 2246, 2245, 1, 0, 0, 0, 2246, 2247, 1, 0, 0, 0, 2247, 2248, 1, 0, 0, 0, 2248, 2249, 3, 1384, 692, 0, 2249, 2250, 3, 106, 53, 0, 2250, 2531, 1, 0, 0, 0, 2251, 2253, 5, 138, 0, 0, 2252, 2254, 3, 732, 366, 0, 2253, 2252, 1, 0, 0, 0, 2253, 2254, 1, 0, 0, 0, 2254, 2255, 1, 0, 0, 0, 2255, 2256, 3, 1384, 692, 0, 2256, 2257, 5, 191, 0, 0, 2257, 2258, 5, 77, 0, 0, 2258, 2259, 5, 78, 0, 0, 2259, 2531, 1, 0, 0, 0, 2260, 2262, 5, 138, 0, 0, 2261, 2263, 3, 732, 366, 0, 2262, 2261, 1, 0, 0, 0, 2262, 2263, 1, 0, 0, 0, 2263, 2264, 1, 0, 0, 0, 2264, 2265, 3, 1384, 692, 0, 2265, 2266, 5, 326, 0, 0, 2266, 2267, 5, 77, 0, 0, 2267, 2268, 5, 78, 0, 0, 2268, 2531, 1, 0, 0, 0, 2269, 2271, 5, 138, 0, 0, 2270, 2272, 3, 732, 366, 0, 2271, 2270, 1, 0, 0, 0, 2271, 2272, 1, 0, 0, 0, 2272, 2273, 1, 0, 0, 0, 2273, 2274, 3, 1384, 692, 0, 2274, 2275, 5, 191, 0, 0, 2275, 2276, 5, 439, 0, 0, 2276, 2531, 1, 0, 0, 0, 2277, 2279, 5, 138, 0, 0, 2278, 2280, 3, 732, 366, 0, 2279, 2278, 1, 0, 0, 0, 2279, 2280, 1, 0, 0, 0, 2280, 2281, 1, 0, 0, 0, 2281, 2282, 3, 1384, 692, 0, 2282, 2283, 5, 191, 0, 0, 2283, 2284, 5, 439, 0, 0, 2284, 2285, 5, 220, 0, 0, 2285, 2286, 5, 390, 0, 0, 2286, 2531, 1, 0, 0, 0, 2287, 2289, 5, 138, 0, 0, 2288, 2290, 3, 732, 366, 0, 2289, 2288, 1, 0, 0, 0, 2289, 2290, 1, 0, 0, 0, 2290, 2291, 1, 0, 0, 0, 2291, 2292, 3, 1384, 692, 0, 2292, 2293, 5, 326, 0, 0, 2293, 2294, 5, 335, 0, 0, 2294, 2295, 3, 1376, 688, 0, 2295, 2531, 1, 0, 0, 0, 2296, 2298, 5, 138, 0, 0, 2297, 2299, 3, 732, 366, 0, 2298, 2297, 1, 0, 0, 0, 2298, 2299, 1, 0, 0, 0, 2299, 2300, 1, 0, 0, 0, 2300, 2301, 3, 1368, 684, 0, 2301, 2302, 5, 326, 0, 0, 2302, 2303, 5, 335, 0, 0, 2303, 2304, 3, 1376, 688, 0, 2304, 2531, 1, 0, 0, 0, 2305, 2307, 5, 138, 0, 0, 2306, 2308, 3, 732, 366, 0, 2307, 2306, 1, 0, 0, 0, 2307, 2308, 1, 0, 0, 0, 2308, 2309, 1, 0, 0, 0, 2309, 2310, 3, 1384, 692, 0, 2310, 2311, 5, 326, 0, 0, 2311, 2312, 3, 116, 58, 0, 2312, 2531, 1, 0, 0, 0, 2313, 2315, 5, 138, 0, 0, 2314, 2316, 3, 732, 366, 0, 2315, 2314, 1, 0, 0, 0, 2315, 2316, 1, 0, 0, 0, 2316, 2317, 1, 0, 0, 0, 2317, 2318, 3, 1384, 692, 0, 2318, 2319, 5, 306, 0, 0, 2319, 2320, 3, 116, 58, 0, 2320, 2531, 1, 0, 0, 0, 2321, 2323, 5, 138, 0, 0, 2322, 2324, 3, 732, 366, 0, 2323, 2322, 1, 0, 0, 0, 2323, 2324, 1, 0, 0, 0, 2324, 2325, 1, 0, 0, 0, 2325, 2326, 3, 1384, 692, 0, 2326, 2327, 5, 326, 0, 0, 2327, 2328, 5, 338, 0, 0, 2328, 2329, 3, 1384, 692, 0, 2329, 2531, 1, 0, 0, 0, 2330, 2332, 5, 138, 0, 0, 2331, 2333, 3, 732, 366, 0, 2332, 2331, 1, 0, 0, 0, 2332, 2333, 1, 0, 0, 0, 2333, 2334, 1, 0, 0, 0, 2334, 2335, 3, 1384, 692, 0, 2335, 2336, 5, 133, 0, 0, 2336, 2337, 5, 440, 0, 0, 2337, 2338, 3, 202, 101, 0, 2338, 2339, 5, 36, 0, 0, 2339, 2341, 5, 219, 0, 0, 2340, 2342, 3, 288, 144, 0, 2341, 2340, 1, 0, 0, 0, 2341, 2342, 1, 0, 0, 0, 2342, 2531, 1, 0, 0, 0, 2343, 2345, 5, 138, 0, 0, 2344, 2346, 3, 732, 366, 0, 2345, 2344, 1, 0, 0, 0, 2345, 2346, 1, 0, 0, 0, 2346, 2347, 1, 0, 0, 0, 2347, 2348, 3, 1384, 692, 0, 2348, 2349, 3, 124, 62, 0, 2349, 2531, 1, 0, 0, 0, 2350, 2352, 5, 138, 0, 0, 2351, 2353, 3, 732, 366, 0, 2352, 2351, 1, 0, 0, 0, 2352, 2353, 1, 0, 0, 0, 2353, 2354, 1, 0, 0, 0, 2354, 2355, 3, 1384, 692, 0, 2355, 2356, 5, 191, 0, 0, 2356, 2357, 5, 219, 0, 0, 2357, 2531, 1, 0, 0, 0, 2358, 2360, 5, 138, 0, 0, 2359, 2361, 3, 732, 366, 0, 2360, 2359, 1, 0, 0, 0, 2360, 2361, 1, 0, 0, 0, 2361, 2362, 1, 0, 0, 0, 2362, 2363, 3, 1384, 692, 0, 2363, 2364, 5, 191, 0, 0, 2364, 2365, 5, 219, 0, 0, 2365, 2366, 5, 220, 0, 0, 2366, 2367, 5, 390, 0, 0, 2367, 2531, 1, 0, 0, 0, 2368, 2370, 5, 191, 0, 0, 2369, 2371, 3, 732, 366, 0, 2370, 2369, 1, 0, 0, 0, 2370, 2371, 1, 0, 0, 0, 2371, 2372, 1, 0, 0, 0, 2372, 2373, 5, 220, 0, 0, 2373, 2374, 5, 390, 0, 0, 2374, 2376, 3, 1384, 692, 0, 2375, 2377, 3, 108, 54, 0, 2376, 2375, 1, 0, 0, 0, 2376, 2377, 1, 0, 0, 0, 2377, 2531, 1, 0, 0, 0, 2378, 2380, 5, 191, 0, 0, 2379, 2381, 3, 732, 366, 0, 2380, 2379, 1, 0, 0, 0, 2380, 2381, 1, 0, 0, 0, 2381, 2382, 1, 0, 0, 0, 2382, 2384, 3, 1384, 692, 0, 2383, 2385, 3, 108, 54, 0, 2384, 2383, 1, 0, 0, 0, 2384, 2385, 1, 0, 0, 0, 2385, 2531, 1, 0, 0, 0, 2386, 2388, 5, 138, 0, 0, 2387, 2389, 3, 732, 366, 0, 2388, 2387, 1, 0, 0, 0, 2388, 2389, 1, 0, 0, 0, 2389, 2390, 1, 0, 0, 0, 2390, 2392, 3, 1384, 692, 0, 2391, 2393, 3, 734, 367, 0, 2392, 2391, 1, 0, 0, 0, 2392, 2393, 1, 0, 0, 0, 2393, 2394, 1, 0, 0, 0, 2394, 2395, 5, 353, 0, 0, 2395, 2397, 3, 1128, 564, 0, 2396, 2398, 3, 110, 55, 0, 2397, 2396, 1, 0, 0, 0, 2397, 2398, 1, 0, 0, 0, 2398, 2400, 1, 0, 0, 0, 2399, 2401, 3, 112, 56, 0, 2400, 2399, 1, 0, 0, 0, 2400, 2401, 1, 0, 0, 0, 2401, 2531, 1, 0, 0, 0, 2402, 2404, 5, 138, 0, 0, 2403, 2405, 3, 732, 366, 0, 2404, 2403, 1, 0, 0, 0, 2404, 2405, 1, 0, 0, 0, 2405, 2406, 1, 0, 0, 0, 2406, 2407, 3, 1384, 692, 0, 2407, 2408, 3, 348, 174, 0, 2408, 2531, 1, 0, 0, 0, 2409, 2410, 5, 133, 0, 0, 2410, 2531, 3, 212, 106, 0, 2411, 2412, 5, 138, 0, 0, 2412, 2413, 5, 45, 0, 0, 2413, 2414, 3, 1352, 676, 0, 2414, 2415, 3, 444, 222, 0, 2415, 2531, 1, 0, 0, 0, 2416, 2417, 5, 365, 0, 0, 2417, 2418, 5, 45, 0, 0, 2418, 2531, 3, 1352, 676, 0, 2419, 2420, 5, 191, 0, 0, 2420, 2421, 5, 45, 0, 0, 2421, 2422, 5, 220, 0, 0, 2422, 2423, 5, 390, 0, 0, 2423, 2425, 3, 1352, 676, 0, 2424, 2426, 3, 108, 54, 0, 2425, 2424, 1, 0, 0, 0, 2425, 2426, 1, 0, 0, 0, 2426, 2531, 1, 0, 0, 0, 2427, 2428, 5, 191, 0, 0, 2428, 2429, 5, 45, 0, 0, 2429, 2431, 3, 1352, 676, 0, 2430, 2432, 3, 108, 54, 0, 2431, 2430, 1, 0, 0, 0, 2431, 2432, 1, 0, 0, 0, 2432, 2531, 1, 0, 0, 0, 2433, 2434, 5, 326, 0, 0, 2434, 2435, 5, 372, 0, 0, 2435, 2531, 5, 270, 0, 0, 2436, 2437, 5, 158, 0, 0, 2437, 2438, 5, 80, 0, 0, 2438, 2531, 3, 1352, 676, 0, 2439, 2440, 5, 326, 0, 0, 2440, 2441, 5, 372, 0, 0, 2441, 2531, 5, 158, 0, 0, 2442, 2443, 5, 326, 0, 0, 2443, 2531, 5, 441, 0, 0, 2444, 2445, 5, 326, 0, 0, 2445, 2531, 5, 360, 0, 0, 2446, 2447, 5, 193, 0, 0, 2447, 2448, 5, 350, 0, 0, 2448, 2531, 3, 1352, 676, 0, 2449, 2450, 5, 193, 0, 0, 2450, 2451, 5, 139, 0, 0, 2451, 2452, 5, 350, 0, 0, 2452, 2531, 3, 1352, 676, 0, 2453, 2454, 5, 193, 0, 0, 2454, 2455, 5, 305, 0, 0, 2455, 2456, 5, 350, 0, 0, 2456, 2531, 3, 1352, 676, 0, 2457, 2458, 5, 193, 0, 0, 2458, 2459, 5, 350, 0, 0, 2459, 2531, 5, 30, 0, 0, 2460, 2461, 5, 193, 0, 0, 2461, 2462, 5, 350, 0, 0, 2462, 2531, 5, 99, 0, 0, 2463, 2464, 5, 186, 0, 0, 2464, 2465, 5, 350, 0, 0, 2465, 2531, 3, 1352, 676, 0, 2466, 2467, 5, 186, 0, 0, 2467, 2468, 5, 350, 0, 0, 2468, 2531, 5, 30, 0, 0, 2469, 2470, 5, 186, 0, 0, 2470, 2471, 5, 350, 0, 0, 2471, 2531, 5, 99, 0, 0, 2472, 2473, 5, 193, 0, 0, 2473, 2474, 5, 314, 0, 0, 2474, 2531, 3, 1352, 676, 0, 2475, 2476, 5, 193, 0, 0, 2476, 2477, 5, 139, 0, 0, 2477, 2478, 5, 314, 0, 0, 2478, 2531, 3, 1352, 676, 0, 2479, 2480, 5, 193, 0, 0, 2480, 2481, 5, 305, 0, 0, 2481, 2482, 5, 314, 0, 0, 2482, 2531, 3, 1352, 676, 0, 2483, 2484, 5, 186, 0, 0, 2484, 2485, 5, 314, 0, 0, 2485, 2531, 3, 1352, 676, 0, 2486, 2487, 5, 228, 0, 0, 2487, 2531, 3, 1348, 674, 0, 2488, 2489, 5, 262, 0, 0, 2489, 2490, 5, 228, 0, 0, 2490, 2531, 3, 1348, 674, 0, 2491, 2492, 5, 268, 0, 0, 2492, 2531, 3, 528, 264, 0, 2493, 2494, 5, 77, 0, 0, 2494, 2531, 5, 268, 0, 0, 2495, 2496, 5, 275, 0, 0, 2496, 2497, 5, 94, 0, 0, 2497, 2531, 3, 1380, 690, 0, 2498, 2499, 5, 326, 0, 0, 2499, 2500, 5, 131, 0, 0, 2500, 2501, 5, 448, 0, 0, 2501, 2531, 3, 1352, 676, 0, 2502, 2503, 5, 326, 0, 0, 2503, 2504, 5, 344, 0, 0, 2504, 2531, 3, 1352, 676, 0, 2505, 2506, 5, 326, 0, 0, 2506, 2531, 3, 116, 58, 0, 2507, 2508, 5, 306, 0, 0, 2508, 2531, 3, 116, 58, 0, 2509, 2510, 5, 305, 0, 0, 2510, 2511, 5, 219, 0, 0, 2511, 2531, 3, 114, 57, 0, 2512, 2513, 5, 193, 0, 0, 2513, 2514, 5, 409, 0, 0, 2514, 2515, 5, 242, 0, 0, 2515, 2531, 5, 320, 0, 0, 2516, 2517, 5, 186, 0, 0, 2517, 2518, 5, 409, 0, 0, 2518, 2519, 5, 242, 0, 0, 2519, 2531, 5, 320, 0, 0, 2520, 2521, 5, 209, 0, 0, 2521, 2522, 5, 409, 0, 0, 2522, 2523, 5, 242, 0, 0, 2523, 2531, 5, 320, 0, 0, 2524, 2525, 5, 262, 0, 0, 2525, 2526, 5, 209, 0, 0, 2526, 2527, 5, 409, 0, 0, 2527, 2528, 5, 242, 0, 0, 2528, 2531, 5, 320, 0, 0, 2529, 2531, 3, 348, 174, 0, 2530, 2228, 1, 0, 0, 0, 2530, 2230, 1, 0, 0, 0, 2530, 2235, 1, 0, 0, 0, 2530, 2238, 1, 0, 0, 0, 2530, 2244, 1, 0, 0, 0, 2530, 2251, 1, 0, 0, 0, 2530, 2260, 1, 0, 0, 0, 2530, 2269, 1, 0, 0, 0, 2530, 2277, 1, 0, 0, 0, 2530, 2287, 1, 0, 0, 0, 2530, 2296, 1, 0, 0, 0, 2530, 2305, 1, 0, 0, 0, 2530, 2313, 1, 0, 0, 0, 2530, 2321, 1, 0, 0, 0, 2530, 2330, 1, 0, 0, 0, 2530, 2343, 1, 0, 0, 0, 2530, 2350, 1, 0, 0, 0, 2530, 2358, 1, 0, 0, 0, 2530, 2368, 1, 0, 0, 0, 2530, 2378, 1, 0, 0, 0, 2530, 2386, 1, 0, 0, 0, 2530, 2402, 1, 0, 0, 0, 2530, 2409, 1, 0, 0, 0, 2530, 2411, 1, 0, 0, 0, 2530, 2416, 1, 0, 0, 0, 2530, 2419, 1, 0, 0, 0, 2530, 2427, 1, 0, 0, 0, 2530, 2433, 1, 0, 0, 0, 2530, 2436, 1, 0, 0, 0, 2530, 2439, 1, 0, 0, 0, 2530, 2442, 1, 0, 0, 0, 2530, 2444, 1, 0, 0, 0, 2530, 2446, 1, 0, 0, 0, 2530, 2449, 1, 0, 0, 0, 2530, 2453, 1, 0, 0, 0, 2530, 2457, 1, 0, 0, 0, 2530, 2460, 1, 0, 0, 0, 2530, 2463, 1, 0, 0, 0, 2530, 2466, 1, 0, 0, 0, 2530, 2469, 1, 0, 0, 0, 2530, 2472, 1, 0, 0, 0, 2530, 2475, 1, 0, 0, 0, 2530, 2479, 1, 0, 0, 0, 2530, 2483, 1, 0, 0, 0, 2530, 2486, 1, 0, 0, 0, 2530, 2488, 1, 0, 0, 0, 2530, 2491, 1, 0, 0, 0, 2530, 2493, 1, 0, 0, 0, 2530, 2495, 1, 0, 0, 0, 2530, 2498, 1, 0, 0, 0, 2530, 2502, 1, 0, 0, 0, 2530, 2505, 1, 0, 0, 0, 2530, 2507, 1, 0, 0, 0, 2530, 2509, 1, 0, 0, 0, 2530, 2512, 1, 0, 0, 0, 2530, 2516, 1, 0, 0, 0, 2530, 2520, 1, 0, 0, 0, 2530, 2524, 1, 0, 0, 0, 2530, 2529, 1, 0, 0, 0, 2531, 105, 1, 0, 0, 0, 2532, 2533, 5, 326, 0, 0, 2533, 2534, 5, 53, 0, 0, 2534, 2538, 3, 1172, 586, 0, 2535, 2536, 5, 191, 0, 0, 2536, 2538, 5, 53, 0, 0, 2537, 2532, 1, 0, 0, 0, 2537, 2535, 1, 0, 0, 0, 2538, 107, 1, 0, 0, 0, 2539, 2540, 7, 10, 0, 0, 2540, 109, 1, 0, 0, 0, 2541, 2542, 5, 43, 0, 0, 2542, 2543, 3, 528, 264, 0, 2543, 111, 1, 0, 0, 0, 2544, 2545, 5, 100, 0, 0, 2545, 2546, 3, 1172, 586, 0, 2546, 113, 1, 0, 0, 0, 2547, 2554, 5, 263, 0, 0, 2548, 2554, 5, 113, 0, 0, 2549, 2554, 5, 53, 0, 0, 2550, 2551, 5, 100, 0, 0, 2551, 2552, 5, 226, 0, 0, 2552, 2554, 3, 1352, 676, 0, 2553, 2547, 1, 0, 0, 0, 2553, 2548, 1, 0, 0, 0, 2553, 2549, 1, 0, 0, 0, 2553, 2550, 1, 0, 0, 0, 2554, 115, 1, 0, 0, 0, 2555, 2556, 5, 2, 0, 0, 2556, 2557, 3, 120, 60, 0, 2557, 2558, 5, 3, 0, 0, 2558, 117, 1, 0, 0, 0, 2559, 2560, 5, 105, 0, 0, 2560, 2561, 3, 116, 58, 0, 2561, 119, 1, 0, 0, 0, 2562, 2567, 3, 122, 61, 0, 2563, 2564, 5, 6, 0, 0, 2564, 2566, 3, 122, 61, 0, 2565, 2563, 1, 0, 0, 0, 2566, 2569, 1, 0, 0, 0, 2567, 2565, 1, 0, 0, 0, 2567, 2568, 1, 0, 0, 0, 2568, 121, 1, 0, 0, 0, 2569, 2567, 1, 0, 0, 0, 2570, 2579, 3, 1392, 696, 0, 2571, 2572, 5, 10, 0, 0, 2572, 2580, 3, 470, 235, 0, 2573, 2574, 5, 11, 0, 0, 2574, 2577, 3, 1392, 696, 0, 2575, 2576, 5, 10, 0, 0, 2576, 2578, 3, 470, 235, 0, 2577, 2575, 1, 0, 0, 0, 2577, 2578, 1, 0, 0, 0, 2578, 2580, 1, 0, 0, 0, 2579, 2571, 1, 0, 0, 0, 2579, 2573, 1, 0, 0, 0, 2579, 2580, 1, 0, 0, 0, 2580, 123, 1, 0, 0, 0, 2581, 2583, 3, 126, 63, 0, 2582, 2581, 1, 0, 0, 0, 2583, 2584, 1, 0, 0, 0, 2584, 2582, 1, 0, 0, 0, 2584, 2585, 1, 0, 0, 0, 2585, 125, 1, 0, 0, 0, 2586, 2591, 5, 307, 0, 0, 2587, 2589, 3, 16, 8, 0, 2588, 2587, 1, 0, 0, 0, 2588, 2589, 1, 0, 0, 0, 2589, 2590, 1, 0, 0, 0, 2590, 2592, 3, 296, 148, 0, 2591, 2588, 1, 0, 0, 0, 2591, 2592, 1, 0, 0, 0, 2592, 2600, 1, 0, 0, 0, 2593, 2597, 5, 326, 0, 0, 2594, 2598, 3, 292, 146, 0, 2595, 2596, 5, 440, 0, 0, 2596, 2598, 3, 202, 101, 0, 2597, 2594, 1, 0, 0, 0, 2597, 2595, 1, 0, 0, 0, 2598, 2600, 1, 0, 0, 0, 2599, 2586, 1, 0, 0, 0, 2599, 2593, 1, 0, 0, 0, 2600, 127, 1, 0, 0, 0, 2601, 2602, 5, 62, 0, 0, 2602, 2603, 5, 417, 0, 0, 2603, 2604, 5, 105, 0, 0, 2604, 2605, 5, 2, 0, 0, 2605, 2606, 3, 132, 66, 0, 2606, 2607, 5, 3, 0, 0, 2607, 2628, 1, 0, 0, 0, 2608, 2609, 5, 62, 0, 0, 2609, 2610, 5, 417, 0, 0, 2610, 2611, 5, 68, 0, 0, 2611, 2612, 5, 2, 0, 0, 2612, 2613, 3, 1290, 645, 0, 2613, 2614, 5, 3, 0, 0, 2614, 2628, 1, 0, 0, 0, 2615, 2616, 5, 62, 0, 0, 2616, 2617, 5, 417, 0, 0, 2617, 2618, 5, 64, 0, 0, 2618, 2619, 5, 2, 0, 0, 2619, 2620, 3, 1290, 645, 0, 2620, 2621, 5, 3, 0, 0, 2621, 2622, 5, 94, 0, 0, 2622, 2623, 5, 2, 0, 0, 2623, 2624, 3, 1290, 645, 0, 2624, 2625, 5, 3, 0, 0, 2625, 2628, 1, 0, 0, 0, 2626, 2628, 5, 53, 0, 0, 2627, 2601, 1, 0, 0, 0, 2627, 2608, 1, 0, 0, 0, 2627, 2615, 1, 0, 0, 0, 2627, 2626, 1, 0, 0, 0, 2628, 129, 1, 0, 0, 0, 2629, 2630, 3, 1390, 695, 0, 2630, 2631, 3, 1368, 684, 0, 2631, 131, 1, 0, 0, 0, 2632, 2637, 3, 130, 65, 0, 2633, 2634, 5, 6, 0, 0, 2634, 2636, 3, 130, 65, 0, 2635, 2633, 1, 0, 0, 0, 2636, 2639, 1, 0, 0, 0, 2637, 2635, 1, 0, 0, 0, 2637, 2638, 1, 0, 0, 0, 2638, 133, 1, 0, 0, 0, 2639, 2637, 1, 0, 0, 0, 2640, 2641, 5, 138, 0, 0, 2641, 2642, 5, 353, 0, 0, 2642, 2643, 3, 528, 264, 0, 2643, 2644, 3, 136, 68, 0, 2644, 135, 1, 0, 0, 0, 2645, 2650, 3, 138, 69, 0, 2646, 2647, 5, 6, 0, 0, 2647, 2649, 3, 138, 69, 0, 2648, 2646, 1, 0, 0, 0, 2649, 2652, 1, 0, 0, 0, 2650, 2648, 1, 0, 0, 0, 2650, 2651, 1, 0, 0, 0, 2651, 137, 1, 0, 0, 0, 2652, 2650, 1, 0, 0, 0, 2653, 2654, 5, 133, 0, 0, 2654, 2655, 5, 143, 0, 0, 2655, 2657, 3, 1112, 556, 0, 2656, 2658, 3, 108, 54, 0, 2657, 2656, 1, 0, 0, 0, 2657, 2658, 1, 0, 0, 0, 2658, 2684, 1, 0, 0, 0, 2659, 2660, 5, 191, 0, 0, 2660, 2663, 5, 143, 0, 0, 2661, 2662, 5, 220, 0, 0, 2662, 2664, 5, 390, 0, 0, 2663, 2661, 1, 0, 0, 0, 2663, 2664, 1, 0, 0, 0, 2664, 2665, 1, 0, 0, 0, 2665, 2667, 3, 1384, 692, 0, 2666, 2668, 3, 108, 54, 0, 2667, 2666, 1, 0, 0, 0, 2667, 2668, 1, 0, 0, 0, 2668, 2684, 1, 0, 0, 0, 2669, 2670, 5, 138, 0, 0, 2670, 2671, 5, 143, 0, 0, 2671, 2673, 3, 1384, 692, 0, 2672, 2674, 3, 734, 367, 0, 2673, 2672, 1, 0, 0, 0, 2673, 2674, 1, 0, 0, 0, 2674, 2675, 1, 0, 0, 0, 2675, 2676, 5, 353, 0, 0, 2676, 2678, 3, 1128, 564, 0, 2677, 2679, 3, 110, 55, 0, 2678, 2677, 1, 0, 0, 0, 2678, 2679, 1, 0, 0, 0, 2679, 2681, 1, 0, 0, 0, 2680, 2682, 3, 108, 54, 0, 2681, 2680, 1, 0, 0, 0, 2681, 2682, 1, 0, 0, 0, 2682, 2684, 1, 0, 0, 0, 2683, 2653, 1, 0, 0, 0, 2683, 2659, 1, 0, 0, 0, 2683, 2669, 1, 0, 0, 0, 2684, 139, 1, 0, 0, 0, 2685, 2688, 5, 157, 0, 0, 2686, 2689, 3, 964, 482, 0, 2687, 2689, 5, 30, 0, 0, 2688, 2686, 1, 0, 0, 0, 2688, 2687, 1, 0, 0, 0, 2689, 141, 1, 0, 0, 0, 2690, 2692, 5, 169, 0, 0, 2691, 2693, 3, 156, 78, 0, 2692, 2691, 1, 0, 0, 0, 2692, 2693, 1, 0, 0, 0, 2693, 2694, 1, 0, 0, 0, 2694, 2696, 3, 1348, 674, 0, 2695, 2697, 3, 218, 109, 0, 2696, 2695, 1, 0, 0, 0, 2696, 2697, 1, 0, 0, 0, 2697, 2698, 1, 0, 0, 0, 2698, 2700, 3, 144, 72, 0, 2699, 2701, 3, 146, 73, 0, 2700, 2699, 1, 0, 0, 0, 2700, 2701, 1, 0, 0, 0, 2701, 2702, 1, 0, 0, 0, 2702, 2704, 3, 148, 74, 0, 2703, 2705, 3, 158, 79, 0, 2704, 2703, 1, 0, 0, 0, 2704, 2705, 1, 0, 0, 0, 2705, 2707, 1, 0, 0, 0, 2706, 2708, 3, 16, 8, 0, 2707, 2706, 1, 0, 0, 0, 2707, 2708, 1, 0, 0, 0, 2708, 2709, 1, 0, 0, 0, 2709, 2711, 3, 150, 75, 0, 2710, 2712, 3, 1104, 552, 0, 2711, 2710, 1, 0, 0, 0, 2711, 2712, 1, 0, 0, 0, 2712, 2728, 1, 0, 0, 0, 2713, 2714, 5, 169, 0, 0, 2714, 2715, 5, 2, 0, 0, 2715, 2716, 3, 904, 452, 0, 2716, 2717, 5, 3, 0, 0, 2717, 2719, 5, 94, 0, 0, 2718, 2720, 3, 146, 73, 0, 2719, 2718, 1, 0, 0, 0, 2719, 2720, 1, 0, 0, 0, 2720, 2721, 1, 0, 0, 0, 2721, 2723, 3, 148, 74, 0, 2722, 2724, 3, 16, 8, 0, 2723, 2722, 1, 0, 0, 0, 2723, 2724, 1, 0, 0, 0, 2724, 2725, 1, 0, 0, 0, 2725, 2726, 3, 150, 75, 0, 2726, 2728, 1, 0, 0, 0, 2727, 2690, 1, 0, 0, 0, 2727, 2713, 1, 0, 0, 0, 2728, 143, 1, 0, 0, 0, 2729, 2730, 7, 11, 0, 0, 2730, 145, 1, 0, 0, 0, 2731, 2732, 5, 290, 0, 0, 2732, 147, 1, 0, 0, 0, 2733, 2737, 3, 1370, 685, 0, 2734, 2737, 5, 336, 0, 0, 2735, 2737, 5, 337, 0, 0, 2736, 2733, 1, 0, 0, 0, 2736, 2734, 1, 0, 0, 0, 2736, 2735, 1, 0, 0, 0, 2737, 149, 1, 0, 0, 0, 2738, 2744, 3, 152, 76, 0, 2739, 2740, 5, 2, 0, 0, 2740, 2741, 3, 162, 81, 0, 2741, 2742, 5, 3, 0, 0, 2742, 2744, 1, 0, 0, 0, 2743, 2738, 1, 0, 0, 0, 2743, 2739, 1, 0, 0, 0, 2744, 151, 1, 0, 0, 0, 2745, 2747, 3, 154, 77, 0, 2746, 2745, 1, 0, 0, 0, 2747, 2750, 1, 0, 0, 0, 2748, 2746, 1, 0, 0, 0, 2748, 2749, 1, 0, 0, 0, 2749, 153, 1, 0, 0, 0, 2750, 2748, 1, 0, 0, 0, 2751, 2791, 5, 107, 0, 0, 2752, 2791, 5, 112, 0, 0, 2753, 2755, 5, 183, 0, 0, 2754, 2756, 3, 844, 422, 0, 2755, 2754, 1, 0, 0, 0, 2755, 2756, 1, 0, 0, 0, 2756, 2757, 1, 0, 0, 0, 2757, 2791, 3, 1370, 685, 0, 2758, 2760, 5, 78, 0, 0, 2759, 2761, 3, 844, 422, 0, 2760, 2759, 1, 0, 0, 0, 2760, 2761, 1, 0, 0, 0, 2761, 2762, 1, 0, 0, 0, 2762, 2791, 3, 1370, 685, 0, 2763, 2791, 5, 171, 0, 0, 2764, 2791, 5, 216, 0, 0, 2765, 2767, 5, 291, 0, 0, 2766, 2768, 3, 844, 422, 0, 2767, 2766, 1, 0, 0, 0, 2767, 2768, 1, 0, 0, 0, 2768, 2769, 1, 0, 0, 0, 2769, 2791, 3, 1370, 685, 0, 2770, 2772, 5, 197, 0, 0, 2771, 2773, 3, 844, 422, 0, 2772, 2771, 1, 0, 0, 0, 2772, 2773, 1, 0, 0, 0, 2773, 2774, 1, 0, 0, 0, 2774, 2791, 3, 1370, 685, 0, 2775, 2776, 5, 209, 0, 0, 2776, 2777, 5, 291, 0, 0, 2777, 2791, 3, 220, 110, 0, 2778, 2779, 5, 209, 0, 0, 2779, 2780, 5, 291, 0, 0, 2780, 2791, 5, 9, 0, 0, 2781, 2782, 5, 209, 0, 0, 2782, 2783, 5, 77, 0, 0, 2783, 2784, 5, 78, 0, 0, 2784, 2791, 3, 220, 110, 0, 2785, 2786, 5, 209, 0, 0, 2786, 2787, 5, 78, 0, 0, 2787, 2791, 3, 220, 110, 0, 2788, 2789, 5, 194, 0, 0, 2789, 2791, 3, 1370, 685, 0, 2790, 2751, 1, 0, 0, 0, 2790, 2752, 1, 0, 0, 0, 2790, 2753, 1, 0, 0, 0, 2790, 2758, 1, 0, 0, 0, 2790, 2763, 1, 0, 0, 0, 2790, 2764, 1, 0, 0, 0, 2790, 2765, 1, 0, 0, 0, 2790, 2770, 1, 0, 0, 0, 2790, 2775, 1, 0, 0, 0, 2790, 2778, 1, 0, 0, 0, 2790, 2781, 1, 0, 0, 0, 2790, 2785, 1, 0, 0, 0, 2790, 2788, 1, 0, 0, 0, 2791, 155, 1, 0, 0, 0, 2792, 2793, 5, 107, 0, 0, 2793, 157, 1, 0, 0, 0, 2794, 2796, 3, 160, 80, 0, 2795, 2794, 1, 0, 0, 0, 2795, 2796, 1, 0, 0, 0, 2796, 2797, 1, 0, 0, 0, 2797, 2798, 5, 184, 0, 0, 2798, 2799, 3, 1370, 685, 0, 2799, 159, 1, 0, 0, 0, 2800, 2801, 5, 100, 0, 0, 2801, 161, 1, 0, 0, 0, 2802, 2807, 3, 164, 82, 0, 2803, 2804, 5, 6, 0, 0, 2804, 2806, 3, 164, 82, 0, 2805, 2803, 1, 0, 0, 0, 2806, 2809, 1, 0, 0, 0, 2807, 2805, 1, 0, 0, 0, 2807, 2808, 1, 0, 0, 0, 2808, 163, 1, 0, 0, 0, 2809, 2807, 1, 0, 0, 0, 2810, 2812, 3, 1392, 696, 0, 2811, 2813, 3, 166, 83, 0, 2812, 2811, 1, 0, 0, 0, 2812, 2813, 1, 0, 0, 0, 2813, 165, 1, 0, 0, 0, 2814, 2822, 3, 66, 33, 0, 2815, 2822, 3, 296, 148, 0, 2816, 2822, 5, 9, 0, 0, 2817, 2818, 5, 2, 0, 0, 2818, 2819, 3, 168, 84, 0, 2819, 2820, 5, 3, 0, 0, 2820, 2822, 1, 0, 0, 0, 2821, 2814, 1, 0, 0, 0, 2821, 2815, 1, 0, 0, 0, 2821, 2816, 1, 0, 0, 0, 2821, 2817, 1, 0, 0, 0, 2822, 167, 1, 0, 0, 0, 2823, 2828, 3, 170, 85, 0, 2824, 2825, 5, 6, 0, 0, 2825, 2827, 3, 170, 85, 0, 2826, 2824, 1, 0, 0, 0, 2827, 2830, 1, 0, 0, 0, 2828, 2826, 1, 0, 0, 0, 2828, 2829, 1, 0, 0, 0, 2829, 169, 1, 0, 0, 0, 2830, 2828, 1, 0, 0, 0, 2831, 2832, 3, 66, 33, 0, 2832, 171, 1, 0, 0, 0, 2833, 2835, 5, 46, 0, 0, 2834, 2836, 3, 174, 87, 0, 2835, 2834, 1, 0, 0, 0, 2835, 2836, 1, 0, 0, 0, 2836, 2837, 1, 0, 0, 0, 2837, 2841, 5, 92, 0, 0, 2838, 2839, 5, 220, 0, 0, 2839, 2840, 5, 77, 0, 0, 2840, 2842, 5, 390, 0, 0, 2841, 2838, 1, 0, 0, 0, 2841, 2842, 1, 0, 0, 0, 2842, 2843, 1, 0, 0, 0, 2843, 2909, 3, 1348, 674, 0, 2844, 2846, 5, 2, 0, 0, 2845, 2847, 3, 176, 88, 0, 2846, 2845, 1, 0, 0, 0, 2846, 2847, 1, 0, 0, 0, 2847, 2848, 1, 0, 0, 0, 2848, 2850, 5, 3, 0, 0, 2849, 2851, 3, 242, 121, 0, 2850, 2849, 1, 0, 0, 0, 2850, 2851, 1, 0, 0, 0, 2851, 2853, 1, 0, 0, 0, 2852, 2854, 3, 244, 122, 0, 2853, 2852, 1, 0, 0, 0, 2853, 2854, 1, 0, 0, 0, 2854, 2856, 1, 0, 0, 0, 2855, 2857, 3, 252, 126, 0, 2856, 2855, 1, 0, 0, 0, 2856, 2857, 1, 0, 0, 0, 2857, 2859, 1, 0, 0, 0, 2858, 2860, 3, 254, 127, 0, 2859, 2858, 1, 0, 0, 0, 2859, 2860, 1, 0, 0, 0, 2860, 2862, 1, 0, 0, 0, 2861, 2863, 3, 256, 128, 0, 2862, 2861, 1, 0, 0, 0, 2862, 2863, 1, 0, 0, 0, 2863, 2865, 1, 0, 0, 0, 2864, 2866, 3, 258, 129, 0, 2865, 2864, 1, 0, 0, 0, 2865, 2866, 1, 0, 0, 0, 2866, 2910, 1, 0, 0, 0, 2867, 2868, 5, 268, 0, 0, 2868, 2870, 3, 528, 264, 0, 2869, 2871, 3, 178, 89, 0, 2870, 2869, 1, 0, 0, 0, 2870, 2871, 1, 0, 0, 0, 2871, 2873, 1, 0, 0, 0, 2872, 2874, 3, 244, 122, 0, 2873, 2872, 1, 0, 0, 0, 2873, 2874, 1, 0, 0, 0, 2874, 2876, 1, 0, 0, 0, 2875, 2877, 3, 252, 126, 0, 2876, 2875, 1, 0, 0, 0, 2876, 2877, 1, 0, 0, 0, 2877, 2879, 1, 0, 0, 0, 2878, 2880, 3, 254, 127, 0, 2879, 2878, 1, 0, 0, 0, 2879, 2880, 1, 0, 0, 0, 2880, 2882, 1, 0, 0, 0, 2881, 2883, 3, 256, 128, 0, 2882, 2881, 1, 0, 0, 0, 2882, 2883, 1, 0, 0, 0, 2883, 2885, 1, 0, 0, 0, 2884, 2886, 3, 258, 129, 0, 2885, 2884, 1, 0, 0, 0, 2885, 2886, 1, 0, 0, 0, 2886, 2910, 1, 0, 0, 0, 2887, 2888, 5, 278, 0, 0, 2888, 2889, 5, 268, 0, 0, 2889, 2891, 3, 1348, 674, 0, 2890, 2892, 3, 178, 89, 0, 2891, 2890, 1, 0, 0, 0, 2891, 2892, 1, 0, 0, 0, 2892, 2893, 1, 0, 0, 0, 2893, 2895, 3, 128, 64, 0, 2894, 2896, 3, 244, 122, 0, 2895, 2894, 1, 0, 0, 0, 2895, 2896, 1, 0, 0, 0, 2896, 2898, 1, 0, 0, 0, 2897, 2899, 3, 252, 126, 0, 2898, 2897, 1, 0, 0, 0, 2898, 2899, 1, 0, 0, 0, 2899, 2901, 1, 0, 0, 0, 2900, 2902, 3, 254, 127, 0, 2901, 2900, 1, 0, 0, 0, 2901, 2902, 1, 0, 0, 0, 2902, 2904, 1, 0, 0, 0, 2903, 2905, 3, 256, 128, 0, 2904, 2903, 1, 0, 0, 0, 2904, 2905, 1, 0, 0, 0, 2905, 2907, 1, 0, 0, 0, 2906, 2908, 3, 258, 129, 0, 2907, 2906, 1, 0, 0, 0, 2907, 2908, 1, 0, 0, 0, 2908, 2910, 1, 0, 0, 0, 2909, 2844, 1, 0, 0, 0, 2909, 2867, 1, 0, 0, 0, 2909, 2887, 1, 0, 0, 0, 2910, 173, 1, 0, 0, 0, 2911, 2919, 5, 347, 0, 0, 2912, 2919, 5, 345, 0, 0, 2913, 2914, 5, 245, 0, 0, 2914, 2919, 7, 12, 0, 0, 2915, 2916, 5, 213, 0, 0, 2916, 2919, 7, 12, 0, 0, 2917, 2919, 5, 360, 0, 0, 2918, 2911, 1, 0, 0, 0, 2918, 2912, 1, 0, 0, 0, 2918, 2913, 1, 0, 0, 0, 2918, 2915, 1, 0, 0, 0, 2918, 2917, 1, 0, 0, 0, 2919, 175, 1, 0, 0, 0, 2920, 2921, 3, 180, 90, 0, 2921, 177, 1, 0, 0, 0, 2922, 2923, 5, 2, 0, 0, 2923, 2924, 3, 182, 91, 0, 2924, 2925, 5, 3, 0, 0, 2925, 179, 1, 0, 0, 0, 2926, 2931, 3, 184, 92, 0, 2927, 2928, 5, 6, 0, 0, 2928, 2930, 3, 184, 92, 0, 2929, 2927, 1, 0, 0, 0, 2930, 2933, 1, 0, 0, 0, 2931, 2929, 1, 0, 0, 0, 2931, 2932, 1, 0, 0, 0, 2932, 181, 1, 0, 0, 0, 2933, 2931, 1, 0, 0, 0, 2934, 2939, 3, 186, 93, 0, 2935, 2936, 5, 6, 0, 0, 2936, 2938, 3, 186, 93, 0, 2937, 2935, 1, 0, 0, 0, 2938, 2941, 1, 0, 0, 0, 2939, 2937, 1, 0, 0, 0, 2939, 2940, 1, 0, 0, 0, 2940, 183, 1, 0, 0, 0, 2941, 2939, 1, 0, 0, 0, 2942, 2946, 3, 212, 106, 0, 2943, 2946, 3, 206, 103, 0, 2944, 2946, 3, 188, 94, 0, 2945, 2942, 1, 0, 0, 0, 2945, 2943, 1, 0, 0, 0, 2945, 2944, 1, 0, 0, 0, 2946, 185, 1, 0, 0, 0, 2947, 2950, 3, 192, 96, 0, 2948, 2950, 3, 212, 106, 0, 2949, 2947, 1, 0, 0, 0, 2949, 2948, 1, 0, 0, 0, 2950, 187, 1, 0, 0, 0, 2951, 2952, 4, 94, 0, 1, 2952, 2953, 3, 1384, 692, 0, 2953, 2955, 3, 1128, 564, 0, 2954, 2956, 3, 344, 172, 0, 2955, 2954, 1, 0, 0, 0, 2955, 2956, 1, 0, 0, 0, 2956, 2957, 1, 0, 0, 0, 2957, 2958, 3, 194, 97, 0, 2958, 2971, 1, 0, 0, 0, 2959, 2960, 4, 94, 1, 1, 2960, 2961, 3, 1384, 692, 0, 2961, 2963, 3, 1128, 564, 0, 2962, 2964, 3, 344, 172, 0, 2963, 2962, 1, 0, 0, 0, 2963, 2964, 1, 0, 0, 0, 2964, 2966, 1, 0, 0, 0, 2965, 2967, 3, 190, 95, 0, 2966, 2965, 1, 0, 0, 0, 2966, 2967, 1, 0, 0, 0, 2967, 2968, 1, 0, 0, 0, 2968, 2969, 3, 194, 97, 0, 2969, 2971, 1, 0, 0, 0, 2970, 2951, 1, 0, 0, 0, 2970, 2959, 1, 0, 0, 0, 2971, 189, 1, 0, 0, 0, 2972, 2973, 5, 53, 0, 0, 2973, 2999, 3, 1214, 607, 0, 2974, 2975, 5, 219, 0, 0, 2975, 2976, 5, 2, 0, 0, 2976, 2977, 3, 1368, 684, 0, 2977, 2978, 5, 6, 0, 0, 2978, 2979, 3, 1368, 684, 0, 2979, 2980, 5, 3, 0, 0, 2980, 2999, 1, 0, 0, 0, 2981, 2982, 5, 440, 0, 0, 2982, 2983, 5, 147, 0, 0, 2983, 2984, 5, 53, 0, 0, 2984, 2985, 5, 36, 0, 0, 2985, 2986, 5, 219, 0, 0, 2986, 2987, 5, 2, 0, 0, 2987, 2988, 3, 1368, 684, 0, 2988, 2989, 5, 6, 0, 0, 2989, 2990, 3, 1368, 684, 0, 2990, 2991, 5, 3, 0, 0, 2991, 2999, 1, 0, 0, 0, 2992, 2993, 5, 638, 0, 0, 2993, 2999, 5, 652, 0, 0, 2994, 2999, 5, 639, 0, 0, 2995, 2999, 5, 640, 0, 0, 2996, 2997, 5, 43, 0, 0, 2997, 2999, 7, 13, 0, 0, 2998, 2972, 1, 0, 0, 0, 2998, 2974, 1, 0, 0, 0, 2998, 2981, 1, 0, 0, 0, 2998, 2992, 1, 0, 0, 0, 2998, 2994, 1, 0, 0, 0, 2998, 2995, 1, 0, 0, 0, 2998, 2996, 1, 0, 0, 0, 2999, 191, 1, 0, 0, 0, 3000, 3003, 3, 1384, 692, 0, 3001, 3002, 5, 105, 0, 0, 3002, 3004, 5, 273, 0, 0, 3003, 3001, 1, 0, 0, 0, 3003, 3004, 1, 0, 0, 0, 3004, 3005, 1, 0, 0, 0, 3005, 3006, 3, 194, 97, 0, 3006, 193, 1, 0, 0, 0, 3007, 3009, 3, 196, 98, 0, 3008, 3007, 1, 0, 0, 0, 3009, 3012, 1, 0, 0, 0, 3010, 3008, 1, 0, 0, 0, 3010, 3011, 1, 0, 0, 0, 3011, 195, 1, 0, 0, 0, 3012, 3010, 1, 0, 0, 0, 3013, 3014, 5, 45, 0, 0, 3014, 3015, 3, 1352, 676, 0, 3015, 3016, 3, 198, 99, 0, 3016, 3022, 1, 0, 0, 0, 3017, 3022, 3, 198, 99, 0, 3018, 3022, 3, 204, 102, 0, 3019, 3020, 5, 43, 0, 0, 3020, 3022, 3, 528, 264, 0, 3021, 3013, 1, 0, 0, 0, 3021, 3017, 1, 0, 0, 0, 3021, 3018, 1, 0, 0, 0, 3021, 3019, 1, 0, 0, 0, 3022, 197, 1, 0, 0, 0, 3023, 3024, 5, 77, 0, 0, 3024, 3079, 5, 78, 0, 0, 3025, 3079, 5, 78, 0, 0, 3026, 3028, 5, 98, 0, 0, 3027, 3029, 3, 200, 100, 0, 3028, 3027, 1, 0, 0, 0, 3028, 3029, 1, 0, 0, 0, 3029, 3031, 1, 0, 0, 0, 3030, 3032, 3, 672, 336, 0, 3031, 3030, 1, 0, 0, 0, 3031, 3032, 1, 0, 0, 0, 3032, 3034, 1, 0, 0, 0, 3033, 3035, 3, 260, 130, 0, 3034, 3033, 1, 0, 0, 0, 3034, 3035, 1, 0, 0, 0, 3035, 3079, 1, 0, 0, 0, 3036, 3037, 5, 85, 0, 0, 3037, 3039, 5, 236, 0, 0, 3038, 3040, 3, 672, 336, 0, 3039, 3038, 1, 0, 0, 0, 3039, 3040, 1, 0, 0, 0, 3040, 3042, 1, 0, 0, 0, 3041, 3043, 3, 260, 130, 0, 3042, 3041, 1, 0, 0, 0, 3042, 3043, 1, 0, 0, 0, 3043, 3079, 1, 0, 0, 0, 3044, 3045, 5, 42, 0, 0, 3045, 3046, 5, 2, 0, 0, 3046, 3047, 3, 1172, 586, 0, 3047, 3049, 5, 3, 0, 0, 3048, 3050, 3, 216, 108, 0, 3049, 3048, 1, 0, 0, 0, 3049, 3050, 1, 0, 0, 0, 3050, 3079, 1, 0, 0, 0, 3051, 3052, 5, 53, 0, 0, 3052, 3079, 3, 1214, 607, 0, 3053, 3054, 5, 440, 0, 0, 3054, 3055, 3, 202, 101, 0, 3055, 3065, 5, 36, 0, 0, 3056, 3058, 5, 219, 0, 0, 3057, 3059, 3, 288, 144, 0, 3058, 3057, 1, 0, 0, 0, 3058, 3059, 1, 0, 0, 0, 3059, 3066, 1, 0, 0, 0, 3060, 3061, 5, 2, 0, 0, 3061, 3062, 3, 1172, 586, 0, 3062, 3063, 5, 3, 0, 0, 3063, 3064, 5, 442, 0, 0, 3064, 3066, 1, 0, 0, 0, 3065, 3056, 1, 0, 0, 0, 3065, 3060, 1, 0, 0, 0, 3066, 3079, 1, 0, 0, 0, 3067, 3068, 5, 86, 0, 0, 3068, 3070, 3, 1348, 674, 0, 3069, 3071, 3, 218, 109, 0, 3070, 3069, 1, 0, 0, 0, 3070, 3071, 1, 0, 0, 0, 3071, 3073, 1, 0, 0, 0, 3072, 3074, 3, 226, 113, 0, 3073, 3072, 1, 0, 0, 0, 3073, 3074, 1, 0, 0, 0, 3074, 3076, 1, 0, 0, 0, 3075, 3077, 3, 234, 117, 0, 3076, 3075, 1, 0, 0, 0, 3076, 3077, 1, 0, 0, 0, 3077, 3079, 1, 0, 0, 0, 3078, 3023, 1, 0, 0, 0, 3078, 3025, 1, 0, 0, 0, 3078, 3026, 1, 0, 0, 0, 3078, 3036, 1, 0, 0, 0, 3078, 3044, 1, 0, 0, 0, 3078, 3051, 1, 0, 0, 0, 3078, 3053, 1, 0, 0, 0, 3078, 3067, 1, 0, 0, 0, 3079, 199, 1, 0, 0, 0, 3080, 3082, 5, 266, 0, 0, 3081, 3083, 5, 77, 0, 0, 3082, 3081, 1, 0, 0, 0, 3082, 3083, 1, 0, 0, 0, 3083, 3084, 1, 0, 0, 0, 3084, 3085, 5, 56, 0, 0, 3085, 201, 1, 0, 0, 0, 3086, 3090, 5, 139, 0, 0, 3087, 3088, 5, 147, 0, 0, 3088, 3090, 5, 53, 0, 0, 3089, 3086, 1, 0, 0, 0, 3089, 3087, 1, 0, 0, 0, 3090, 203, 1, 0, 0, 0, 3091, 3097, 5, 54, 0, 0, 3092, 3093, 5, 77, 0, 0, 3093, 3097, 5, 54, 0, 0, 3094, 3095, 5, 69, 0, 0, 3095, 3097, 7, 8, 0, 0, 3096, 3091, 1, 0, 0, 0, 3096, 3092, 1, 0, 0, 0, 3096, 3094, 1, 0, 0, 0, 3097, 205, 1, 0, 0, 0, 3098, 3099, 5, 120, 0, 0, 3099, 3100, 3, 1348, 674, 0, 3100, 3101, 3, 208, 104, 0, 3101, 207, 1, 0, 0, 0, 3102, 3103, 7, 14, 0, 0, 3103, 3105, 3, 210, 105, 0, 3104, 3102, 1, 0, 0, 0, 3105, 3108, 1, 0, 0, 0, 3106, 3104, 1, 0, 0, 0, 3106, 3107, 1, 0, 0, 0, 3107, 209, 1, 0, 0, 0, 3108, 3106, 1, 0, 0, 0, 3109, 3110, 7, 15, 0, 0, 3110, 211, 1, 0, 0, 0, 3111, 3112, 5, 45, 0, 0, 3112, 3113, 3, 1352, 676, 0, 3113, 3114, 3, 214, 107, 0, 3114, 3117, 1, 0, 0, 0, 3115, 3117, 3, 214, 107, 0, 3116, 3111, 1, 0, 0, 0, 3116, 3115, 1, 0, 0, 0, 3117, 213, 1, 0, 0, 0, 3118, 3119, 5, 42, 0, 0, 3119, 3120, 5, 2, 0, 0, 3120, 3121, 3, 1172, 586, 0, 3121, 3122, 5, 3, 0, 0, 3122, 3123, 3, 444, 222, 0, 3123, 3208, 1, 0, 0, 0, 3124, 3126, 5, 98, 0, 0, 3125, 3127, 3, 200, 100, 0, 3126, 3125, 1, 0, 0, 0, 3126, 3127, 1, 0, 0, 0, 3127, 3145, 1, 0, 0, 0, 3128, 3129, 5, 2, 0, 0, 3129, 3130, 3, 220, 110, 0, 3130, 3132, 5, 3, 0, 0, 3131, 3133, 3, 224, 112, 0, 3132, 3131, 1, 0, 0, 0, 3132, 3133, 1, 0, 0, 0, 3133, 3135, 1, 0, 0, 0, 3134, 3136, 3, 672, 336, 0, 3135, 3134, 1, 0, 0, 0, 3135, 3136, 1, 0, 0, 0, 3136, 3138, 1, 0, 0, 0, 3137, 3139, 3, 260, 130, 0, 3138, 3137, 1, 0, 0, 0, 3138, 3139, 1, 0, 0, 0, 3139, 3140, 1, 0, 0, 0, 3140, 3141, 3, 444, 222, 0, 3141, 3146, 1, 0, 0, 0, 3142, 3143, 3, 262, 131, 0, 3143, 3144, 3, 444, 222, 0, 3144, 3146, 1, 0, 0, 0, 3145, 3128, 1, 0, 0, 0, 3145, 3142, 1, 0, 0, 0, 3146, 3208, 1, 0, 0, 0, 3147, 3148, 5, 85, 0, 0, 3148, 3166, 5, 236, 0, 0, 3149, 3150, 5, 2, 0, 0, 3150, 3151, 3, 220, 110, 0, 3151, 3153, 5, 3, 0, 0, 3152, 3154, 3, 224, 112, 0, 3153, 3152, 1, 0, 0, 0, 3153, 3154, 1, 0, 0, 0, 3154, 3156, 1, 0, 0, 0, 3155, 3157, 3, 672, 336, 0, 3156, 3155, 1, 0, 0, 0, 3156, 3157, 1, 0, 0, 0, 3157, 3159, 1, 0, 0, 0, 3158, 3160, 3, 260, 130, 0, 3159, 3158, 1, 0, 0, 0, 3159, 3160, 1, 0, 0, 0, 3160, 3161, 1, 0, 0, 0, 3161, 3162, 3, 444, 222, 0, 3162, 3167, 1, 0, 0, 0, 3163, 3164, 3, 262, 131, 0, 3164, 3165, 3, 444, 222, 0, 3165, 3167, 1, 0, 0, 0, 3166, 3149, 1, 0, 0, 0, 3166, 3163, 1, 0, 0, 0, 3167, 3208, 1, 0, 0, 0, 3168, 3170, 5, 199, 0, 0, 3169, 3171, 3, 604, 302, 0, 3170, 3169, 1, 0, 0, 0, 3170, 3171, 1, 0, 0, 0, 3171, 3172, 1, 0, 0, 0, 3172, 3173, 5, 2, 0, 0, 3173, 3174, 3, 228, 114, 0, 3174, 3176, 5, 3, 0, 0, 3175, 3177, 3, 224, 112, 0, 3176, 3175, 1, 0, 0, 0, 3176, 3177, 1, 0, 0, 0, 3177, 3179, 1, 0, 0, 0, 3178, 3180, 3, 672, 336, 0, 3179, 3178, 1, 0, 0, 0, 3179, 3180, 1, 0, 0, 0, 3180, 3182, 1, 0, 0, 0, 3181, 3183, 3, 260, 130, 0, 3182, 3181, 1, 0, 0, 0, 3182, 3183, 1, 0, 0, 0, 3183, 3185, 1, 0, 0, 0, 3184, 3186, 3, 232, 116, 0, 3185, 3184, 1, 0, 0, 0, 3185, 3186, 1, 0, 0, 0, 3186, 3187, 1, 0, 0, 0, 3187, 3188, 3, 444, 222, 0, 3188, 3208, 1, 0, 0, 0, 3189, 3190, 5, 63, 0, 0, 3190, 3191, 5, 236, 0, 0, 3191, 3192, 5, 2, 0, 0, 3192, 3193, 3, 220, 110, 0, 3193, 3194, 5, 3, 0, 0, 3194, 3195, 5, 86, 0, 0, 3195, 3197, 3, 1348, 674, 0, 3196, 3198, 3, 218, 109, 0, 3197, 3196, 1, 0, 0, 0, 3197, 3198, 1, 0, 0, 0, 3198, 3200, 1, 0, 0, 0, 3199, 3201, 3, 226, 113, 0, 3200, 3199, 1, 0, 0, 0, 3200, 3201, 1, 0, 0, 0, 3201, 3203, 1, 0, 0, 0, 3202, 3204, 3, 234, 117, 0, 3203, 3202, 1, 0, 0, 0, 3203, 3204, 1, 0, 0, 0, 3204, 3205, 1, 0, 0, 0, 3205, 3206, 3, 444, 222, 0, 3206, 3208, 1, 0, 0, 0, 3207, 3118, 1, 0, 0, 0, 3207, 3124, 1, 0, 0, 0, 3207, 3147, 1, 0, 0, 0, 3207, 3168, 1, 0, 0, 0, 3207, 3189, 1, 0, 0, 0, 3208, 215, 1, 0, 0, 0, 3209, 3210, 5, 262, 0, 0, 3210, 3211, 5, 228, 0, 0, 3211, 217, 1, 0, 0, 0, 3212, 3213, 5, 2, 0, 0, 3213, 3214, 3, 220, 110, 0, 3214, 3215, 5, 3, 0, 0, 3215, 219, 1, 0, 0, 0, 3216, 3221, 3, 222, 111, 0, 3217, 3218, 5, 6, 0, 0, 3218, 3220, 3, 222, 111, 0, 3219, 3217, 1, 0, 0, 0, 3220, 3223, 1, 0, 0, 0, 3221, 3219, 1, 0, 0, 0, 3221, 3222, 1, 0, 0, 0, 3222, 221, 1, 0, 0, 0, 3223, 3221, 1, 0, 0, 0, 3224, 3225, 3, 1384, 692, 0, 3225, 223, 1, 0, 0, 0, 3226, 3227, 5, 443, 0, 0, 3227, 3228, 5, 2, 0, 0, 3228, 3229, 3, 220, 110, 0, 3229, 3230, 5, 3, 0, 0, 3230, 225, 1, 0, 0, 0, 3231, 3232, 5, 249, 0, 0, 3232, 3233, 7, 16, 0, 0, 3233, 227, 1, 0, 0, 0, 3234, 3239, 3, 230, 115, 0, 3235, 3236, 5, 6, 0, 0, 3236, 3238, 3, 230, 115, 0, 3237, 3235, 1, 0, 0, 0, 3238, 3241, 1, 0, 0, 0, 3239, 3237, 1, 0, 0, 0, 3239, 3240, 1, 0, 0, 0, 3240, 229, 1, 0, 0, 0, 3241, 3239, 1, 0, 0, 0, 3242, 3243, 3, 610, 305, 0, 3243, 3250, 5, 105, 0, 0, 3244, 3251, 3, 692, 346, 0, 3245, 3246, 5, 271, 0, 0, 3246, 3247, 5, 2, 0, 0, 3247, 3248, 3, 692, 346, 0, 3248, 3249, 5, 3, 0, 0, 3249, 3251, 1, 0, 0, 0, 3250, 3244, 1, 0, 0, 0, 3250, 3245, 1, 0, 0, 0, 3251, 231, 1, 0, 0, 0, 3252, 3253, 5, 103, 0, 0, 3253, 3254, 5, 2, 0, 0, 3254, 3255, 3, 1172, 586, 0, 3255, 3256, 5, 3, 0, 0, 3256, 233, 1, 0, 0, 0, 3257, 3266, 3, 236, 118, 0, 3258, 3266, 3, 238, 119, 0, 3259, 3260, 3, 236, 118, 0, 3260, 3261, 3, 238, 119, 0, 3261, 3266, 1, 0, 0, 0, 3262, 3263, 3, 238, 119, 0, 3263, 3264, 3, 236, 118, 0, 3264, 3266, 1, 0, 0, 0, 3265, 3257, 1, 0, 0, 0, 3265, 3258, 1, 0, 0, 0, 3265, 3259, 1, 0, 0, 0, 3265, 3262, 1, 0, 0, 0, 3266, 235, 1, 0, 0, 0, 3267, 3268, 5, 80, 0, 0, 3268, 3269, 5, 362, 0, 0, 3269, 3270, 3, 240, 120, 0, 3270, 237, 1, 0, 0, 0, 3271, 3272, 5, 80, 0, 0, 3272, 3273, 5, 182, 0, 0, 3273, 3274, 3, 240, 120, 0, 3274, 239, 1, 0, 0, 0, 3275, 3276, 5, 262, 0, 0, 3276, 3285, 5, 132, 0, 0, 3277, 3285, 5, 308, 0, 0, 3278, 3285, 5, 150, 0, 0, 3279, 3280, 5, 326, 0, 0, 3280, 3282, 7, 17, 0, 0, 3281, 3283, 3, 218, 109, 0, 3282, 3281, 1, 0, 0, 0, 3282, 3283, 1, 0, 0, 0, 3283, 3285, 1, 0, 0, 0, 3284, 3275, 1, 0, 0, 0, 3284, 3277, 1, 0, 0, 0, 3284, 3278, 1, 0, 0, 0, 3284, 3279, 1, 0, 0, 0, 3285, 241, 1, 0, 0, 0, 3286, 3287, 5, 229, 0, 0, 3287, 3288, 5, 2, 0, 0, 3288, 3289, 3, 1346, 673, 0, 3289, 3290, 5, 3, 0, 0, 3290, 243, 1, 0, 0, 0, 3291, 3292, 3, 246, 123, 0, 3292, 245, 1, 0, 0, 0, 3293, 3294, 5, 278, 0, 0, 3294, 3295, 5, 147, 0, 0, 3295, 3296, 3, 1384, 692, 0, 3296, 3297, 5, 2, 0, 0, 3297, 3298, 3, 248, 124, 0, 3298, 3299, 5, 3, 0, 0, 3299, 247, 1, 0, 0, 0, 3300, 3305, 3, 250, 125, 0, 3301, 3302, 5, 6, 0, 0, 3302, 3304, 3, 250, 125, 0, 3303, 3301, 1, 0, 0, 0, 3304, 3307, 1, 0, 0, 0, 3305, 3303, 1, 0, 0, 0, 3305, 3306, 1, 0, 0, 0, 3306, 249, 1, 0, 0, 0, 3307, 3305, 1, 0, 0, 0, 3308, 3310, 3, 1384, 692, 0, 3309, 3311, 3, 616, 308, 0, 3310, 3309, 1, 0, 0, 0, 3310, 3311, 1, 0, 0, 0, 3311, 3313, 1, 0, 0, 0, 3312, 3314, 3, 618, 309, 0, 3313, 3312, 1, 0, 0, 0, 3313, 3314, 1, 0, 0, 0, 3314, 3332, 1, 0, 0, 0, 3315, 3317, 3, 1224, 612, 0, 3316, 3318, 3, 616, 308, 0, 3317, 3316, 1, 0, 0, 0, 3317, 3318, 1, 0, 0, 0, 3318, 3320, 1, 0, 0, 0, 3319, 3321, 3, 618, 309, 0, 3320, 3319, 1, 0, 0, 0, 3320, 3321, 1, 0, 0, 0, 3321, 3332, 1, 0, 0, 0, 3322, 3323, 5, 2, 0, 0, 3323, 3324, 3, 1172, 586, 0, 3324, 3326, 5, 3, 0, 0, 3325, 3327, 3, 616, 308, 0, 3326, 3325, 1, 0, 0, 0, 3326, 3327, 1, 0, 0, 0, 3327, 3329, 1, 0, 0, 0, 3328, 3330, 3, 618, 309, 0, 3329, 3328, 1, 0, 0, 0, 3329, 3330, 1, 0, 0, 0, 3330, 3332, 1, 0, 0, 0, 3331, 3308, 1, 0, 0, 0, 3331, 3315, 1, 0, 0, 0, 3331, 3322, 1, 0, 0, 0, 3332, 251, 1, 0, 0, 0, 3333, 3334, 5, 100, 0, 0, 3334, 3335, 3, 1352, 676, 0, 3335, 253, 1, 0, 0, 0, 3336, 3337, 5, 105, 0, 0, 3337, 3341, 3, 116, 58, 0, 3338, 3339, 5, 372, 0, 0, 3339, 3341, 5, 270, 0, 0, 3340, 3336, 1, 0, 0, 0, 3340, 3338, 1, 0, 0, 0, 3341, 255, 1, 0, 0, 0, 3342, 3343, 5, 80, 0, 0, 3343, 3349, 5, 161, 0, 0, 3344, 3350, 5, 191, 0, 0, 3345, 3346, 5, 182, 0, 0, 3346, 3350, 5, 313, 0, 0, 3347, 3348, 5, 285, 0, 0, 3348, 3350, 5, 313, 0, 0, 3349, 3344, 1, 0, 0, 0, 3349, 3345, 1, 0, 0, 0, 3349, 3347, 1, 0, 0, 0, 3350, 257, 1, 0, 0, 0, 3351, 3352, 5, 344, 0, 0, 3352, 3353, 3, 1352, 676, 0, 3353, 259, 1, 0, 0, 0, 3354, 3355, 5, 100, 0, 0, 3355, 3356, 5, 226, 0, 0, 3356, 3357, 5, 344, 0, 0, 3357, 3358, 3, 1352, 676, 0, 3358, 261, 1, 0, 0, 0, 3359, 3360, 5, 100, 0, 0, 3360, 3361, 5, 226, 0, 0, 3361, 3362, 3, 1352, 676, 0, 3362, 263, 1, 0, 0, 0, 3363, 3364, 5, 46, 0, 0, 3364, 3368, 5, 335, 0, 0, 3365, 3366, 5, 220, 0, 0, 3366, 3367, 5, 77, 0, 0, 3367, 3369, 5, 390, 0, 0, 3368, 3365, 1, 0, 0, 0, 3368, 3369, 1, 0, 0, 0, 3369, 3370, 1, 0, 0, 0, 3370, 3372, 3, 528, 264, 0, 3371, 3373, 3, 880, 440, 0, 3372, 3371, 1, 0, 0, 0, 3372, 3373, 1, 0, 0, 0, 3373, 3374, 1, 0, 0, 0, 3374, 3375, 5, 80, 0, 0, 3375, 3376, 3, 1290, 645, 0, 3376, 3377, 5, 64, 0, 0, 3377, 3378, 3, 1066, 533, 0, 3378, 265, 1, 0, 0, 0, 3379, 3380, 5, 138, 0, 0, 3380, 3383, 5, 335, 0, 0, 3381, 3382, 5, 220, 0, 0, 3382, 3384, 5, 390, 0, 0, 3383, 3381, 1, 0, 0, 0, 3383, 3384, 1, 0, 0, 0, 3384, 3385, 1, 0, 0, 0, 3385, 3386, 3, 528, 264, 0, 3386, 3387, 5, 326, 0, 0, 3387, 3388, 5, 335, 0, 0, 3388, 3389, 3, 1376, 688, 0, 3389, 267, 1, 0, 0, 0, 3390, 3392, 5, 46, 0, 0, 3391, 3393, 3, 174, 87, 0, 3392, 3391, 1, 0, 0, 0, 3392, 3393, 1, 0, 0, 0, 3393, 3394, 1, 0, 0, 0, 3394, 3398, 5, 92, 0, 0, 3395, 3396, 5, 220, 0, 0, 3396, 3397, 5, 77, 0, 0, 3397, 3399, 5, 390, 0, 0, 3398, 3395, 1, 0, 0, 0, 3398, 3399, 1, 0, 0, 0, 3399, 3400, 1, 0, 0, 0, 3400, 3401, 3, 270, 135, 0, 3401, 3402, 5, 36, 0, 0, 3402, 3404, 3, 970, 485, 0, 3403, 3405, 3, 272, 136, 0, 3404, 3403, 1, 0, 0, 0, 3404, 3405, 1, 0, 0, 0, 3405, 269, 1, 0, 0, 0, 3406, 3408, 3, 1348, 674, 0, 3407, 3409, 3, 218, 109, 0, 3408, 3407, 1, 0, 0, 0, 3408, 3409, 1, 0, 0, 0, 3409, 3411, 1, 0, 0, 0, 3410, 3412, 3, 252, 126, 0, 3411, 3410, 1, 0, 0, 0, 3411, 3412, 1, 0, 0, 0, 3412, 3414, 1, 0, 0, 0, 3413, 3415, 3, 254, 127, 0, 3414, 3413, 1, 0, 0, 0, 3414, 3415, 1, 0, 0, 0, 3415, 3417, 1, 0, 0, 0, 3416, 3418, 3, 256, 128, 0, 3417, 3416, 1, 0, 0, 0, 3417, 3418, 1, 0, 0, 0, 3418, 3420, 1, 0, 0, 0, 3419, 3421, 3, 258, 129, 0, 3420, 3419, 1, 0, 0, 0, 3420, 3421, 1, 0, 0, 0, 3421, 271, 1, 0, 0, 0, 3422, 3426, 5, 105, 0, 0, 3423, 3427, 5, 174, 0, 0, 3424, 3425, 5, 262, 0, 0, 3425, 3427, 5, 174, 0, 0, 3426, 3423, 1, 0, 0, 0, 3426, 3424, 1, 0, 0, 0, 3427, 273, 1, 0, 0, 0, 3428, 3430, 5, 46, 0, 0, 3429, 3431, 3, 278, 139, 0, 3430, 3429, 1, 0, 0, 0, 3430, 3431, 1, 0, 0, 0, 3431, 3432, 1, 0, 0, 0, 3432, 3433, 5, 251, 0, 0, 3433, 3437, 5, 369, 0, 0, 3434, 3435, 5, 220, 0, 0, 3435, 3436, 5, 77, 0, 0, 3436, 3438, 5, 390, 0, 0, 3437, 3434, 1, 0, 0, 0, 3437, 3438, 1, 0, 0, 0, 3438, 3439, 1, 0, 0, 0, 3439, 3440, 3, 276, 138, 0, 3440, 3441, 5, 36, 0, 0, 3441, 3443, 3, 970, 485, 0, 3442, 3444, 3, 272, 136, 0, 3443, 3442, 1, 0, 0, 0, 3443, 3444, 1, 0, 0, 0, 3444, 275, 1, 0, 0, 0, 3445, 3447, 3, 1348, 674, 0, 3446, 3448, 3, 218, 109, 0, 3447, 3446, 1, 0, 0, 0, 3447, 3448, 1, 0, 0, 0, 3448, 3450, 1, 0, 0, 0, 3449, 3451, 3, 252, 126, 0, 3450, 3449, 1, 0, 0, 0, 3450, 3451, 1, 0, 0, 0, 3451, 3453, 1, 0, 0, 0, 3452, 3454, 3, 118, 59, 0, 3453, 3452, 1, 0, 0, 0, 3453, 3454, 1, 0, 0, 0, 3454, 3456, 1, 0, 0, 0, 3455, 3457, 3, 258, 129, 0, 3456, 3455, 1, 0, 0, 0, 3456, 3457, 1, 0, 0, 0, 3457, 277, 1, 0, 0, 0, 3458, 3459, 5, 360, 0, 0, 3459, 279, 1, 0, 0, 0, 3460, 3461, 5, 298, 0, 0, 3461, 3462, 5, 251, 0, 0, 3462, 3464, 5, 369, 0, 0, 3463, 3465, 3, 600, 300, 0, 3464, 3463, 1, 0, 0, 0, 3464, 3465, 1, 0, 0, 0, 3465, 3466, 1, 0, 0, 0, 3466, 3468, 3, 1348, 674, 0, 3467, 3469, 3, 272, 136, 0, 3468, 3467, 1, 0, 0, 0, 3468, 3469, 1, 0, 0, 0, 3469, 281, 1, 0, 0, 0, 3470, 3472, 5, 46, 0, 0, 3471, 3473, 3, 174, 87, 0, 3472, 3471, 1, 0, 0, 0, 3472, 3473, 1, 0, 0, 0, 3473, 3474, 1, 0, 0, 0, 3474, 3478, 5, 321, 0, 0, 3475, 3476, 5, 220, 0, 0, 3476, 3477, 5, 77, 0, 0, 3477, 3479, 5, 390, 0, 0, 3478, 3475, 1, 0, 0, 0, 3478, 3479, 1, 0, 0, 0, 3479, 3480, 1, 0, 0, 0, 3480, 3482, 3, 1348, 674, 0, 3481, 3483, 3, 286, 143, 0, 3482, 3481, 1, 0, 0, 0, 3482, 3483, 1, 0, 0, 0, 3483, 283, 1, 0, 0, 0, 3484, 3485, 5, 138, 0, 0, 3485, 3488, 5, 321, 0, 0, 3486, 3487, 5, 220, 0, 0, 3487, 3489, 5, 390, 0, 0, 3488, 3486, 1, 0, 0, 0, 3488, 3489, 1, 0, 0, 0, 3489, 3490, 1, 0, 0, 0, 3490, 3491, 3, 1348, 674, 0, 3491, 3492, 3, 290, 145, 0, 3492, 285, 1, 0, 0, 0, 3493, 3494, 3, 290, 145, 0, 3494, 287, 1, 0, 0, 0, 3495, 3496, 5, 2, 0, 0, 3496, 3497, 3, 290, 145, 0, 3497, 3498, 5, 3, 0, 0, 3498, 289, 1, 0, 0, 0, 3499, 3501, 3, 292, 146, 0, 3500, 3499, 1, 0, 0, 0, 3501, 3502, 1, 0, 0, 0, 3502, 3500, 1, 0, 0, 0, 3502, 3503, 1, 0, 0, 0, 3503, 291, 1, 0, 0, 0, 3504, 3505, 5, 36, 0, 0, 3505, 3541, 3, 1132, 566, 0, 3506, 3507, 5, 148, 0, 0, 3507, 3541, 3, 296, 148, 0, 3508, 3541, 5, 173, 0, 0, 3509, 3511, 5, 225, 0, 0, 3510, 3512, 3, 294, 147, 0, 3511, 3510, 1, 0, 0, 0, 3511, 3512, 1, 0, 0, 0, 3512, 3513, 1, 0, 0, 0, 3513, 3541, 3, 296, 148, 0, 3514, 3541, 5, 441, 0, 0, 3515, 3516, 5, 252, 0, 0, 3516, 3541, 3, 296, 148, 0, 3517, 3518, 5, 255, 0, 0, 3518, 3541, 3, 296, 148, 0, 3519, 3520, 5, 262, 0, 0, 3520, 3541, 7, 18, 0, 0, 3521, 3522, 5, 274, 0, 0, 3522, 3523, 5, 147, 0, 0, 3523, 3541, 3, 528, 264, 0, 3524, 3525, 5, 321, 0, 0, 3525, 3526, 5, 259, 0, 0, 3526, 3541, 3, 528, 264, 0, 3527, 3529, 5, 333, 0, 0, 3528, 3530, 3, 16, 8, 0, 3529, 3528, 1, 0, 0, 0, 3529, 3530, 1, 0, 0, 0, 3530, 3531, 1, 0, 0, 0, 3531, 3541, 3, 296, 148, 0, 3532, 3534, 5, 307, 0, 0, 3533, 3535, 3, 16, 8, 0, 3534, 3533, 1, 0, 0, 0, 3534, 3535, 1, 0, 0, 0, 3535, 3537, 1, 0, 0, 0, 3536, 3538, 3, 296, 148, 0, 3537, 3536, 1, 0, 0, 0, 3537, 3538, 1, 0, 0, 0, 3538, 3541, 1, 0, 0, 0, 3539, 3541, 5, 360, 0, 0, 3540, 3504, 1, 0, 0, 0, 3540, 3506, 1, 0, 0, 0, 3540, 3508, 1, 0, 0, 0, 3540, 3509, 1, 0, 0, 0, 3540, 3514, 1, 0, 0, 0, 3540, 3515, 1, 0, 0, 0, 3540, 3517, 1, 0, 0, 0, 3540, 3519, 1, 0, 0, 0, 3540, 3521, 1, 0, 0, 0, 3540, 3524, 1, 0, 0, 0, 3540, 3527, 1, 0, 0, 0, 3540, 3532, 1, 0, 0, 0, 3540, 3539, 1, 0, 0, 0, 3541, 293, 1, 0, 0, 0, 3542, 3543, 5, 147, 0, 0, 3543, 295, 1, 0, 0, 0, 3544, 3551, 3, 1366, 683, 0, 3545, 3546, 5, 12, 0, 0, 3546, 3551, 3, 1366, 683, 0, 3547, 3548, 5, 13, 0, 0, 3548, 3551, 3, 1366, 683, 0, 3549, 3551, 3, 1376, 688, 0, 3550, 3544, 1, 0, 0, 0, 3550, 3545, 1, 0, 0, 0, 3550, 3547, 1, 0, 0, 0, 3550, 3549, 1, 0, 0, 0, 3551, 297, 1, 0, 0, 0, 3552, 3557, 3, 296, 148, 0, 3553, 3554, 5, 6, 0, 0, 3554, 3556, 3, 296, 148, 0, 3555, 3553, 1, 0, 0, 0, 3556, 3559, 1, 0, 0, 0, 3557, 3555, 1, 0, 0, 0, 3557, 3558, 1, 0, 0, 0, 3558, 299, 1, 0, 0, 0, 3559, 3557, 1, 0, 0, 0, 3560, 3562, 5, 46, 0, 0, 3561, 3563, 3, 626, 313, 0, 3562, 3561, 1, 0, 0, 0, 3562, 3563, 1, 0, 0, 0, 3563, 3565, 1, 0, 0, 0, 3564, 3566, 3, 302, 151, 0, 3565, 3564, 1, 0, 0, 0, 3565, 3566, 1, 0, 0, 0, 3566, 3568, 1, 0, 0, 0, 3567, 3569, 3, 312, 156, 0, 3568, 3567, 1, 0, 0, 0, 3568, 3569, 1, 0, 0, 0, 3569, 3570, 1, 0, 0, 0, 3570, 3571, 5, 238, 0, 0, 3571, 3580, 3, 1352, 676, 0, 3572, 3573, 5, 215, 0, 0, 3573, 3575, 3, 304, 152, 0, 3574, 3576, 3, 306, 153, 0, 3575, 3574, 1, 0, 0, 0, 3575, 3576, 1, 0, 0, 0, 3576, 3578, 1, 0, 0, 0, 3577, 3579, 3, 310, 155, 0, 3578, 3577, 1, 0, 0, 0, 3578, 3579, 1, 0, 0, 0, 3579, 3581, 1, 0, 0, 0, 3580, 3572, 1, 0, 0, 0, 3580, 3581, 1, 0, 0, 0, 3581, 301, 1, 0, 0, 0, 3582, 3583, 5, 352, 0, 0, 3583, 303, 1, 0, 0, 0, 3584, 3586, 3, 1352, 676, 0, 3585, 3587, 3, 530, 265, 0, 3586, 3585, 1, 0, 0, 0, 3586, 3587, 1, 0, 0, 0, 3587, 305, 1, 0, 0, 0, 3588, 3589, 5, 230, 0, 0, 3589, 3590, 3, 304, 152, 0, 3590, 307, 1, 0, 0, 0, 3591, 3592, 5, 366, 0, 0, 3592, 3596, 3, 304, 152, 0, 3593, 3594, 5, 262, 0, 0, 3594, 3596, 5, 366, 0, 0, 3595, 3591, 1, 0, 0, 0, 3595, 3593, 1, 0, 0, 0, 3596, 309, 1, 0, 0, 0, 3597, 3598, 3, 308, 154, 0, 3598, 311, 1, 0, 0, 0, 3599, 3600, 5, 288, 0, 0, 3600, 313, 1, 0, 0, 0, 3601, 3602, 5, 46, 0, 0, 3602, 3603, 5, 344, 0, 0, 3603, 3605, 3, 1352, 676, 0, 3604, 3606, 3, 316, 158, 0, 3605, 3604, 1, 0, 0, 0, 3605, 3606, 1, 0, 0, 0, 3606, 3607, 1, 0, 0, 0, 3607, 3608, 5, 246, 0, 0, 3608, 3610, 3, 1370, 685, 0, 3609, 3611, 3, 118, 59, 0, 3610, 3609, 1, 0, 0, 0, 3610, 3611, 1, 0, 0, 0, 3611, 315, 1, 0, 0, 0, 3612, 3613, 5, 275, 0, 0, 3613, 3614, 3, 1380, 690, 0, 3614, 317, 1, 0, 0, 0, 3615, 3616, 5, 191, 0, 0, 3616, 3619, 5, 344, 0, 0, 3617, 3618, 5, 220, 0, 0, 3618, 3620, 5, 390, 0, 0, 3619, 3617, 1, 0, 0, 0, 3619, 3620, 1, 0, 0, 0, 3620, 3621, 1, 0, 0, 0, 3621, 3622, 3, 1352, 676, 0, 3622, 319, 1, 0, 0, 0, 3623, 3624, 5, 46, 0, 0, 3624, 3628, 5, 204, 0, 0, 3625, 3626, 5, 220, 0, 0, 3626, 3627, 5, 77, 0, 0, 3627, 3629, 5, 390, 0, 0, 3628, 3625, 1, 0, 0, 0, 3628, 3629, 1, 0, 0, 0, 3629, 3630, 1, 0, 0, 0, 3630, 3632, 3, 1352, 676, 0, 3631, 3633, 3, 16, 8, 0, 3632, 3631, 1, 0, 0, 0, 3632, 3633, 1, 0, 0, 0, 3633, 3634, 1, 0, 0, 0, 3634, 3635, 3, 322, 161, 0, 3635, 321, 1, 0, 0, 0, 3636, 3638, 3, 324, 162, 0, 3637, 3636, 1, 0, 0, 0, 3638, 3641, 1, 0, 0, 0, 3639, 3637, 1, 0, 0, 0, 3639, 3640, 1, 0, 0, 0, 3640, 323, 1, 0, 0, 0, 3641, 3639, 1, 0, 0, 0, 3642, 3643, 5, 316, 0, 0, 3643, 3650, 3, 1352, 676, 0, 3644, 3645, 5, 368, 0, 0, 3645, 3650, 3, 72, 36, 0, 3646, 3647, 5, 64, 0, 0, 3647, 3650, 3, 72, 36, 0, 3648, 3650, 5, 150, 0, 0, 3649, 3642, 1, 0, 0, 0, 3649, 3644, 1, 0, 0, 0, 3649, 3646, 1, 0, 0, 0, 3649, 3648, 1, 0, 0, 0, 3650, 325, 1, 0, 0, 0, 3651, 3652, 5, 138, 0, 0, 3652, 3653, 5, 204, 0, 0, 3653, 3654, 3, 1352, 676, 0, 3654, 3655, 5, 362, 0, 0, 3655, 3656, 3, 328, 164, 0, 3656, 327, 1, 0, 0, 0, 3657, 3659, 3, 330, 165, 0, 3658, 3657, 1, 0, 0, 0, 3659, 3662, 1, 0, 0, 0, 3660, 3658, 1, 0, 0, 0, 3660, 3661, 1, 0, 0, 0, 3661, 329, 1, 0, 0, 0, 3662, 3660, 1, 0, 0, 0, 3663, 3664, 5, 94, 0, 0, 3664, 3665, 3, 72, 36, 0, 3665, 331, 1, 0, 0, 0, 3666, 3667, 5, 138, 0, 0, 3667, 3668, 5, 204, 0, 0, 3668, 3669, 3, 1352, 676, 0, 3669, 3670, 3, 40, 20, 0, 3670, 3671, 3, 520, 260, 0, 3671, 3672, 3, 1352, 676, 0, 3672, 3771, 1, 0, 0, 0, 3673, 3674, 5, 138, 0, 0, 3674, 3675, 5, 204, 0, 0, 3675, 3676, 3, 1352, 676, 0, 3676, 3677, 3, 40, 20, 0, 3677, 3678, 3, 518, 259, 0, 3678, 3679, 3, 528, 264, 0, 3679, 3771, 1, 0, 0, 0, 3680, 3681, 5, 138, 0, 0, 3681, 3682, 5, 204, 0, 0, 3682, 3683, 3, 1352, 676, 0, 3683, 3684, 3, 40, 20, 0, 3684, 3685, 5, 136, 0, 0, 3685, 3686, 3, 658, 329, 0, 3686, 3771, 1, 0, 0, 0, 3687, 3688, 5, 138, 0, 0, 3688, 3689, 5, 204, 0, 0, 3689, 3690, 3, 1352, 676, 0, 3690, 3691, 3, 40, 20, 0, 3691, 3692, 5, 41, 0, 0, 3692, 3693, 5, 2, 0, 0, 3693, 3694, 3, 1128, 564, 0, 3694, 3695, 5, 36, 0, 0, 3695, 3696, 3, 1128, 564, 0, 3696, 3697, 5, 3, 0, 0, 3697, 3771, 1, 0, 0, 0, 3698, 3699, 5, 138, 0, 0, 3699, 3700, 5, 204, 0, 0, 3700, 3701, 3, 1352, 676, 0, 3701, 3702, 3, 40, 20, 0, 3702, 3703, 5, 189, 0, 0, 3703, 3704, 3, 1128, 564, 0, 3704, 3771, 1, 0, 0, 0, 3705, 3706, 5, 138, 0, 0, 3706, 3707, 5, 204, 0, 0, 3707, 3708, 3, 1352, 676, 0, 3708, 3709, 3, 40, 20, 0, 3709, 3710, 5, 211, 0, 0, 3710, 3711, 3, 634, 317, 0, 3711, 3771, 1, 0, 0, 0, 3712, 3713, 5, 138, 0, 0, 3713, 3714, 5, 204, 0, 0, 3714, 3715, 3, 1352, 676, 0, 3715, 3716, 3, 40, 20, 0, 3716, 3717, 5, 271, 0, 0, 3717, 3718, 3, 696, 348, 0, 3718, 3771, 1, 0, 0, 0, 3719, 3720, 5, 138, 0, 0, 3720, 3721, 5, 204, 0, 0, 3721, 3722, 3, 1352, 676, 0, 3722, 3723, 3, 40, 20, 0, 3723, 3724, 5, 271, 0, 0, 3724, 3725, 5, 156, 0, 0, 3725, 3726, 3, 528, 264, 0, 3726, 3727, 5, 100, 0, 0, 3727, 3728, 3, 1352, 676, 0, 3728, 3771, 1, 0, 0, 0, 3729, 3730, 5, 138, 0, 0, 3730, 3731, 5, 204, 0, 0, 3731, 3732, 3, 1352, 676, 0, 3732, 3733, 3, 40, 20, 0, 3733, 3734, 5, 271, 0, 0, 3734, 3735, 5, 206, 0, 0, 3735, 3736, 3, 528, 264, 0, 3736, 3737, 5, 100, 0, 0, 3737, 3738, 3, 1352, 676, 0, 3738, 3771, 1, 0, 0, 0, 3739, 3740, 5, 138, 0, 0, 3740, 3741, 5, 204, 0, 0, 3741, 3742, 3, 1352, 676, 0, 3742, 3743, 3, 40, 20, 0, 3743, 3744, 5, 289, 0, 0, 3744, 3745, 3, 634, 317, 0, 3745, 3771, 1, 0, 0, 0, 3746, 3747, 5, 138, 0, 0, 3747, 3748, 5, 204, 0, 0, 3748, 3749, 3, 1352, 676, 0, 3749, 3750, 3, 40, 20, 0, 3750, 3751, 5, 444, 0, 0, 3751, 3752, 3, 634, 317, 0, 3752, 3771, 1, 0, 0, 0, 3753, 3754, 5, 138, 0, 0, 3754, 3755, 5, 204, 0, 0, 3755, 3756, 3, 1352, 676, 0, 3756, 3757, 3, 40, 20, 0, 3757, 3758, 5, 445, 0, 0, 3758, 3759, 5, 62, 0, 0, 3759, 3760, 3, 1128, 564, 0, 3760, 3761, 5, 238, 0, 0, 3761, 3762, 3, 1352, 676, 0, 3762, 3771, 1, 0, 0, 0, 3763, 3764, 5, 138, 0, 0, 3764, 3765, 5, 204, 0, 0, 3765, 3766, 3, 1352, 676, 0, 3766, 3767, 3, 40, 20, 0, 3767, 3768, 5, 353, 0, 0, 3768, 3769, 3, 1128, 564, 0, 3769, 3771, 1, 0, 0, 0, 3770, 3666, 1, 0, 0, 0, 3770, 3673, 1, 0, 0, 0, 3770, 3680, 1, 0, 0, 0, 3770, 3687, 1, 0, 0, 0, 3770, 3698, 1, 0, 0, 0, 3770, 3705, 1, 0, 0, 0, 3770, 3712, 1, 0, 0, 0, 3770, 3719, 1, 0, 0, 0, 3770, 3729, 1, 0, 0, 0, 3770, 3739, 1, 0, 0, 0, 3770, 3746, 1, 0, 0, 0, 3770, 3753, 1, 0, 0, 0, 3770, 3763, 1, 0, 0, 0, 3771, 333, 1, 0, 0, 0, 3772, 3773, 5, 46, 0, 0, 3773, 3774, 5, 63, 0, 0, 3774, 3775, 5, 174, 0, 0, 3775, 3776, 5, 374, 0, 0, 3776, 3778, 3, 1352, 676, 0, 3777, 3779, 3, 340, 170, 0, 3778, 3777, 1, 0, 0, 0, 3778, 3779, 1, 0, 0, 0, 3779, 3781, 1, 0, 0, 0, 3780, 3782, 3, 344, 172, 0, 3781, 3780, 1, 0, 0, 0, 3781, 3782, 1, 0, 0, 0, 3782, 335, 1, 0, 0, 0, 3783, 3784, 5, 215, 0, 0, 3784, 3792, 3, 304, 152, 0, 3785, 3786, 5, 262, 0, 0, 3786, 3792, 5, 215, 0, 0, 3787, 3788, 5, 366, 0, 0, 3788, 3792, 3, 304, 152, 0, 3789, 3790, 5, 262, 0, 0, 3790, 3792, 5, 366, 0, 0, 3791, 3783, 1, 0, 0, 0, 3791, 3785, 1, 0, 0, 0, 3791, 3787, 1, 0, 0, 0, 3791, 3789, 1, 0, 0, 0, 3792, 337, 1, 0, 0, 0, 3793, 3795, 3, 336, 168, 0, 3794, 3793, 1, 0, 0, 0, 3795, 3796, 1, 0, 0, 0, 3796, 3794, 1, 0, 0, 0, 3796, 3797, 1, 0, 0, 0, 3797, 339, 1, 0, 0, 0, 3798, 3799, 3, 338, 169, 0, 3799, 341, 1, 0, 0, 0, 3800, 3801, 5, 138, 0, 0, 3801, 3802, 5, 63, 0, 0, 3802, 3803, 5, 174, 0, 0, 3803, 3804, 5, 374, 0, 0, 3804, 3806, 3, 1352, 676, 0, 3805, 3807, 3, 340, 170, 0, 3806, 3805, 1, 0, 0, 0, 3806, 3807, 1, 0, 0, 0, 3807, 3808, 1, 0, 0, 0, 3808, 3809, 3, 348, 174, 0, 3809, 3818, 1, 0, 0, 0, 3810, 3811, 5, 138, 0, 0, 3811, 3812, 5, 63, 0, 0, 3812, 3813, 5, 174, 0, 0, 3813, 3814, 5, 374, 0, 0, 3814, 3815, 3, 1352, 676, 0, 3815, 3816, 3, 338, 169, 0, 3816, 3818, 1, 0, 0, 0, 3817, 3800, 1, 0, 0, 0, 3817, 3810, 1, 0, 0, 0, 3818, 343, 1, 0, 0, 0, 3819, 3820, 5, 273, 0, 0, 3820, 3821, 5, 2, 0, 0, 3821, 3822, 3, 346, 173, 0, 3822, 3823, 5, 3, 0, 0, 3823, 345, 1, 0, 0, 0, 3824, 3829, 3, 354, 177, 0, 3825, 3826, 5, 6, 0, 0, 3826, 3828, 3, 354, 177, 0, 3827, 3825, 1, 0, 0, 0, 3828, 3831, 1, 0, 0, 0, 3829, 3827, 1, 0, 0, 0, 3829, 3830, 1, 0, 0, 0, 3830, 347, 1, 0, 0, 0, 3831, 3829, 1, 0, 0, 0, 3832, 3833, 5, 273, 0, 0, 3833, 3834, 5, 2, 0, 0, 3834, 3835, 3, 350, 175, 0, 3835, 3836, 5, 3, 0, 0, 3836, 349, 1, 0, 0, 0, 3837, 3842, 3, 352, 176, 0, 3838, 3839, 5, 6, 0, 0, 3839, 3841, 3, 352, 176, 0, 3840, 3838, 1, 0, 0, 0, 3841, 3844, 1, 0, 0, 0, 3842, 3840, 1, 0, 0, 0, 3842, 3843, 1, 0, 0, 0, 3843, 351, 1, 0, 0, 0, 3844, 3842, 1, 0, 0, 0, 3845, 3853, 3, 354, 177, 0, 3846, 3847, 5, 326, 0, 0, 3847, 3853, 3, 354, 177, 0, 3848, 3849, 5, 133, 0, 0, 3849, 3853, 3, 354, 177, 0, 3850, 3851, 5, 191, 0, 0, 3851, 3853, 3, 356, 178, 0, 3852, 3845, 1, 0, 0, 0, 3852, 3846, 1, 0, 0, 0, 3852, 3848, 1, 0, 0, 0, 3852, 3850, 1, 0, 0, 0, 3853, 353, 1, 0, 0, 0, 3854, 3855, 3, 356, 178, 0, 3855, 3856, 3, 358, 179, 0, 3856, 355, 1, 0, 0, 0, 3857, 3858, 3, 1392, 696, 0, 3858, 357, 1, 0, 0, 0, 3859, 3860, 3, 1370, 685, 0, 3860, 359, 1, 0, 0, 0, 3861, 3862, 5, 46, 0, 0, 3862, 3863, 5, 324, 0, 0, 3863, 3865, 3, 1352, 676, 0, 3864, 3866, 3, 362, 181, 0, 3865, 3864, 1, 0, 0, 0, 3865, 3866, 1, 0, 0, 0, 3866, 3868, 1, 0, 0, 0, 3867, 3869, 3, 366, 183, 0, 3868, 3867, 1, 0, 0, 0, 3868, 3869, 1, 0, 0, 0, 3869, 3870, 1, 0, 0, 0, 3870, 3871, 5, 63, 0, 0, 3871, 3872, 5, 174, 0, 0, 3872, 3873, 5, 374, 0, 0, 3873, 3875, 3, 1352, 676, 0, 3874, 3876, 3, 344, 172, 0, 3875, 3874, 1, 0, 0, 0, 3875, 3876, 1, 0, 0, 0, 3876, 3897, 1, 0, 0, 0, 3877, 3878, 5, 46, 0, 0, 3878, 3879, 5, 324, 0, 0, 3879, 3880, 5, 220, 0, 0, 3880, 3881, 5, 77, 0, 0, 3881, 3882, 5, 390, 0, 0, 3882, 3884, 3, 1352, 676, 0, 3883, 3885, 3, 362, 181, 0, 3884, 3883, 1, 0, 0, 0, 3884, 3885, 1, 0, 0, 0, 3885, 3887, 1, 0, 0, 0, 3886, 3888, 3, 366, 183, 0, 3887, 3886, 1, 0, 0, 0, 3887, 3888, 1, 0, 0, 0, 3888, 3889, 1, 0, 0, 0, 3889, 3890, 5, 63, 0, 0, 3890, 3891, 5, 174, 0, 0, 3891, 3892, 5, 374, 0, 0, 3892, 3894, 3, 1352, 676, 0, 3893, 3895, 3, 344, 172, 0, 3894, 3893, 1, 0, 0, 0, 3894, 3895, 1, 0, 0, 0, 3895, 3897, 1, 0, 0, 0, 3896, 3861, 1, 0, 0, 0, 3896, 3877, 1, 0, 0, 0, 3897, 361, 1, 0, 0, 0, 3898, 3899, 5, 353, 0, 0, 3899, 3900, 3, 1370, 685, 0, 3900, 363, 1, 0, 0, 0, 3901, 3904, 5, 368, 0, 0, 3902, 3905, 3, 1370, 685, 0, 3903, 3905, 5, 78, 0, 0, 3904, 3902, 1, 0, 0, 0, 3904, 3903, 1, 0, 0, 0, 3905, 365, 1, 0, 0, 0, 3906, 3907, 3, 364, 182, 0, 3907, 367, 1, 0, 0, 0, 3908, 3909, 5, 138, 0, 0, 3909, 3910, 5, 324, 0, 0, 3910, 3916, 3, 1352, 676, 0, 3911, 3917, 3, 348, 174, 0, 3912, 3914, 3, 364, 182, 0, 3913, 3915, 3, 348, 174, 0, 3914, 3913, 1, 0, 0, 0, 3914, 3915, 1, 0, 0, 0, 3915, 3917, 1, 0, 0, 0, 3916, 3911, 1, 0, 0, 0, 3916, 3912, 1, 0, 0, 0, 3917, 369, 1, 0, 0, 0, 3918, 3919, 5, 46, 0, 0, 3919, 3920, 5, 63, 0, 0, 3920, 3921, 5, 92, 0, 0, 3921, 3922, 3, 1348, 674, 0, 3922, 3924, 5, 2, 0, 0, 3923, 3925, 3, 176, 88, 0, 3924, 3923, 1, 0, 0, 0, 3924, 3925, 1, 0, 0, 0, 3925, 3926, 1, 0, 0, 0, 3926, 3928, 5, 3, 0, 0, 3927, 3929, 3, 242, 121, 0, 3928, 3927, 1, 0, 0, 0, 3928, 3929, 1, 0, 0, 0, 3929, 3930, 1, 0, 0, 0, 3930, 3931, 5, 324, 0, 0, 3931, 3933, 3, 1352, 676, 0, 3932, 3934, 3, 344, 172, 0, 3933, 3932, 1, 0, 0, 0, 3933, 3934, 1, 0, 0, 0, 3934, 3991, 1, 0, 0, 0, 3935, 3936, 5, 46, 0, 0, 3936, 3937, 5, 63, 0, 0, 3937, 3938, 5, 92, 0, 0, 3938, 3939, 5, 220, 0, 0, 3939, 3940, 5, 77, 0, 0, 3940, 3941, 5, 390, 0, 0, 3941, 3942, 3, 1348, 674, 0, 3942, 3944, 5, 2, 0, 0, 3943, 3945, 3, 176, 88, 0, 3944, 3943, 1, 0, 0, 0, 3944, 3945, 1, 0, 0, 0, 3945, 3946, 1, 0, 0, 0, 3946, 3948, 5, 3, 0, 0, 3947, 3949, 3, 242, 121, 0, 3948, 3947, 1, 0, 0, 0, 3948, 3949, 1, 0, 0, 0, 3949, 3950, 1, 0, 0, 0, 3950, 3951, 5, 324, 0, 0, 3951, 3953, 3, 1352, 676, 0, 3952, 3954, 3, 344, 172, 0, 3953, 3952, 1, 0, 0, 0, 3953, 3954, 1, 0, 0, 0, 3954, 3991, 1, 0, 0, 0, 3955, 3956, 5, 46, 0, 0, 3956, 3957, 5, 63, 0, 0, 3957, 3958, 5, 92, 0, 0, 3958, 3959, 3, 1348, 674, 0, 3959, 3960, 5, 278, 0, 0, 3960, 3961, 5, 268, 0, 0, 3961, 3963, 3, 1348, 674, 0, 3962, 3964, 3, 178, 89, 0, 3963, 3962, 1, 0, 0, 0, 3963, 3964, 1, 0, 0, 0, 3964, 3965, 1, 0, 0, 0, 3965, 3966, 3, 128, 64, 0, 3966, 3967, 5, 324, 0, 0, 3967, 3969, 3, 1352, 676, 0, 3968, 3970, 3, 344, 172, 0, 3969, 3968, 1, 0, 0, 0, 3969, 3970, 1, 0, 0, 0, 3970, 3991, 1, 0, 0, 0, 3971, 3972, 5, 46, 0, 0, 3972, 3973, 5, 63, 0, 0, 3973, 3974, 5, 92, 0, 0, 3974, 3975, 5, 220, 0, 0, 3975, 3976, 5, 77, 0, 0, 3976, 3977, 5, 390, 0, 0, 3977, 3978, 3, 1348, 674, 0, 3978, 3979, 5, 278, 0, 0, 3979, 3980, 5, 268, 0, 0, 3980, 3982, 3, 1348, 674, 0, 3981, 3983, 3, 178, 89, 0, 3982, 3981, 1, 0, 0, 0, 3982, 3983, 1, 0, 0, 0, 3983, 3984, 1, 0, 0, 0, 3984, 3985, 3, 128, 64, 0, 3985, 3986, 5, 324, 0, 0, 3986, 3988, 3, 1352, 676, 0, 3987, 3989, 3, 344, 172, 0, 3988, 3987, 1, 0, 0, 0, 3988, 3989, 1, 0, 0, 0, 3989, 3991, 1, 0, 0, 0, 3990, 3918, 1, 0, 0, 0, 3990, 3935, 1, 0, 0, 0, 3990, 3955, 1, 0, 0, 0, 3990, 3971, 1, 0, 0, 0, 3991, 371, 1, 0, 0, 0, 3992, 3993, 5, 446, 0, 0, 3993, 3994, 5, 63, 0, 0, 3994, 3995, 5, 316, 0, 0, 3995, 3997, 3, 1352, 676, 0, 3996, 3998, 3, 376, 188, 0, 3997, 3996, 1, 0, 0, 0, 3997, 3998, 1, 0, 0, 0, 3998, 3999, 1, 0, 0, 0, 3999, 4000, 5, 64, 0, 0, 4000, 4001, 5, 324, 0, 0, 4001, 4002, 3, 1352, 676, 0, 4002, 4003, 5, 71, 0, 0, 4003, 4005, 3, 1352, 676, 0, 4004, 4006, 3, 344, 172, 0, 4005, 4004, 1, 0, 0, 0, 4005, 4006, 1, 0, 0, 0, 4006, 373, 1, 0, 0, 0, 4007, 4008, 5, 74, 0, 0, 4008, 4011, 5, 94, 0, 0, 4009, 4011, 5, 59, 0, 0, 4010, 4007, 1, 0, 0, 0, 4010, 4009, 1, 0, 0, 0, 4011, 375, 1, 0, 0, 0, 4012, 4013, 3, 374, 187, 0, 4013, 4014, 5, 2, 0, 0, 4014, 4015, 3, 1086, 543, 0, 4015, 4016, 5, 3, 0, 0, 4016, 377, 1, 0, 0, 0, 4017, 4018, 5, 46, 0, 0, 4018, 4019, 5, 99, 0, 0, 4019, 4020, 5, 248, 0, 0, 4020, 4021, 5, 62, 0, 0, 4021, 4022, 3, 380, 190, 0, 4022, 4023, 5, 324, 0, 0, 4023, 4025, 3, 1352, 676, 0, 4024, 4026, 3, 344, 172, 0, 4025, 4024, 1, 0, 0, 0, 4025, 4026, 1, 0, 0, 0, 4026, 4041, 1, 0, 0, 0, 4027, 4028, 5, 46, 0, 0, 4028, 4029, 5, 99, 0, 0, 4029, 4030, 5, 248, 0, 0, 4030, 4031, 5, 220, 0, 0, 4031, 4032, 5, 77, 0, 0, 4032, 4033, 5, 390, 0, 0, 4033, 4034, 5, 62, 0, 0, 4034, 4035, 3, 380, 190, 0, 4035, 4036, 5, 324, 0, 0, 4036, 4038, 3, 1352, 676, 0, 4037, 4039, 3, 344, 172, 0, 4038, 4037, 1, 0, 0, 0, 4038, 4039, 1, 0, 0, 0, 4039, 4041, 1, 0, 0, 0, 4040, 4017, 1, 0, 0, 0, 4040, 4027, 1, 0, 0, 0, 4041, 379, 1, 0, 0, 0, 4042, 4045, 3, 1380, 690, 0, 4043, 4045, 5, 99, 0, 0, 4044, 4042, 1, 0, 0, 0, 4044, 4043, 1, 0, 0, 0, 4045, 381, 1, 0, 0, 0, 4046, 4047, 5, 191, 0, 0, 4047, 4048, 5, 99, 0, 0, 4048, 4049, 5, 248, 0, 0, 4049, 4050, 5, 62, 0, 0, 4050, 4051, 3, 380, 190, 0, 4051, 4052, 5, 324, 0, 0, 4052, 4053, 3, 1352, 676, 0, 4053, 4065, 1, 0, 0, 0, 4054, 4055, 5, 191, 0, 0, 4055, 4056, 5, 99, 0, 0, 4056, 4057, 5, 248, 0, 0, 4057, 4058, 5, 220, 0, 0, 4058, 4059, 5, 390, 0, 0, 4059, 4060, 5, 62, 0, 0, 4060, 4061, 3, 380, 190, 0, 4061, 4062, 5, 324, 0, 0, 4062, 4063, 3, 1352, 676, 0, 4063, 4065, 1, 0, 0, 0, 4064, 4046, 1, 0, 0, 0, 4064, 4054, 1, 0, 0, 0, 4065, 383, 1, 0, 0, 0, 4066, 4067, 5, 138, 0, 0, 4067, 4068, 5, 99, 0, 0, 4068, 4069, 5, 248, 0, 0, 4069, 4070, 5, 62, 0, 0, 4070, 4071, 3, 380, 190, 0, 4071, 4072, 5, 324, 0, 0, 4072, 4073, 3, 1352, 676, 0, 4073, 4074, 3, 348, 174, 0, 4074, 385, 1, 0, 0, 0, 4075, 4076, 5, 46, 0, 0, 4076, 4077, 5, 447, 0, 0, 4077, 4078, 3, 1352, 676, 0, 4078, 4079, 5, 80, 0, 0, 4079, 4081, 3, 1348, 674, 0, 4080, 4082, 3, 398, 199, 0, 4081, 4080, 1, 0, 0, 0, 4081, 4082, 1, 0, 0, 0, 4082, 4084, 1, 0, 0, 0, 4083, 4085, 3, 400, 200, 0, 4084, 4083, 1, 0, 0, 0, 4084, 4085, 1, 0, 0, 0, 4085, 4087, 1, 0, 0, 0, 4086, 4088, 3, 394, 197, 0, 4087, 4086, 1, 0, 0, 0, 4087, 4088, 1, 0, 0, 0, 4088, 4090, 1, 0, 0, 0, 4089, 4091, 3, 390, 195, 0, 4090, 4089, 1, 0, 0, 0, 4090, 4091, 1, 0, 0, 0, 4091, 4093, 1, 0, 0, 0, 4092, 4094, 3, 392, 196, 0, 4093, 4092, 1, 0, 0, 0, 4093, 4094, 1, 0, 0, 0, 4094, 387, 1, 0, 0, 0, 4095, 4096, 5, 138, 0, 0, 4096, 4097, 5, 447, 0, 0, 4097, 4098, 3, 1352, 676, 0, 4098, 4099, 5, 80, 0, 0, 4099, 4101, 3, 1348, 674, 0, 4100, 4102, 3, 396, 198, 0, 4101, 4100, 1, 0, 0, 0, 4101, 4102, 1, 0, 0, 0, 4102, 4104, 1, 0, 0, 0, 4103, 4105, 3, 390, 195, 0, 4104, 4103, 1, 0, 0, 0, 4104, 4105, 1, 0, 0, 0, 4105, 4107, 1, 0, 0, 0, 4106, 4108, 3, 392, 196, 0, 4107, 4106, 1, 0, 0, 0, 4107, 4108, 1, 0, 0, 0, 4108, 389, 1, 0, 0, 0, 4109, 4110, 5, 100, 0, 0, 4110, 4111, 5, 2, 0, 0, 4111, 4112, 3, 1172, 586, 0, 4112, 4113, 5, 3, 0, 0, 4113, 391, 1, 0, 0, 0, 4114, 4115, 5, 105, 0, 0, 4115, 4116, 5, 42, 0, 0, 4116, 4117, 5, 2, 0, 0, 4117, 4118, 3, 1172, 586, 0, 4118, 4119, 5, 3, 0, 0, 4119, 393, 1, 0, 0, 0, 4120, 4121, 5, 94, 0, 0, 4121, 4122, 3, 1382, 691, 0, 4122, 395, 1, 0, 0, 0, 4123, 4124, 5, 94, 0, 0, 4124, 4125, 3, 1382, 691, 0, 4125, 397, 1, 0, 0, 0, 4126, 4127, 5, 36, 0, 0, 4127, 4128, 3, 1394, 697, 0, 4128, 399, 1, 0, 0, 0, 4129, 4130, 5, 62, 0, 0, 4130, 4131, 3, 402, 201, 0, 4131, 401, 1, 0, 0, 0, 4132, 4133, 7, 19, 0, 0, 4133, 403, 1, 0, 0, 0, 4134, 4135, 5, 46, 0, 0, 4135, 4136, 5, 131, 0, 0, 4136, 4137, 5, 448, 0, 0, 4137, 4138, 3, 1352, 676, 0, 4138, 4139, 5, 353, 0, 0, 4139, 4140, 3, 406, 203, 0, 4140, 4141, 5, 215, 0, 0, 4141, 4142, 3, 304, 152, 0, 4142, 405, 1, 0, 0, 0, 4143, 4144, 7, 20, 0, 0, 4144, 407, 1, 0, 0, 0, 4145, 4146, 5, 46, 0, 0, 4146, 4147, 5, 350, 0, 0, 4147, 4148, 3, 1352, 676, 0, 4148, 4149, 3, 410, 205, 0, 4149, 4150, 3, 412, 206, 0, 4150, 4151, 5, 80, 0, 0, 4151, 4153, 3, 1348, 674, 0, 4152, 4154, 3, 416, 208, 0, 4153, 4152, 1, 0, 0, 0, 4153, 4154, 1, 0, 0, 0, 4154, 4156, 1, 0, 0, 0, 4155, 4157, 3, 428, 214, 0, 4156, 4155, 1, 0, 0, 0, 4156, 4157, 1, 0, 0, 0, 4157, 4159, 1, 0, 0, 0, 4158, 4160, 3, 434, 217, 0, 4159, 4158, 1, 0, 0, 0, 4159, 4160, 1, 0, 0, 0, 4160, 4161, 1, 0, 0, 0, 4161, 4162, 5, 202, 0, 0, 4162, 4163, 3, 436, 218, 0, 4163, 4164, 3, 1358, 679, 0, 4164, 4165, 5, 2, 0, 0, 4165, 4166, 3, 438, 219, 0, 4166, 4167, 5, 3, 0, 0, 4167, 4194, 1, 0, 0, 0, 4168, 4169, 5, 46, 0, 0, 4169, 4170, 5, 45, 0, 0, 4170, 4171, 5, 350, 0, 0, 4171, 4172, 3, 1352, 676, 0, 4172, 4173, 5, 135, 0, 0, 4173, 4174, 3, 412, 206, 0, 4174, 4175, 5, 80, 0, 0, 4175, 4177, 3, 1348, 674, 0, 4176, 4178, 3, 442, 221, 0, 4177, 4176, 1, 0, 0, 0, 4177, 4178, 1, 0, 0, 0, 4178, 4179, 1, 0, 0, 0, 4179, 4180, 3, 444, 222, 0, 4180, 4181, 5, 62, 0, 0, 4181, 4182, 5, 192, 0, 0, 4182, 4184, 5, 409, 0, 0, 4183, 4185, 3, 434, 217, 0, 4184, 4183, 1, 0, 0, 0, 4184, 4185, 1, 0, 0, 0, 4185, 4186, 1, 0, 0, 0, 4186, 4187, 5, 202, 0, 0, 4187, 4188, 3, 436, 218, 0, 4188, 4189, 3, 1358, 679, 0, 4189, 4190, 5, 2, 0, 0, 4190, 4191, 3, 438, 219, 0, 4191, 4192, 5, 3, 0, 0, 4192, 4194, 1, 0, 0, 0, 4193, 4145, 1, 0, 0, 0, 4193, 4168, 1, 0, 0, 0, 4194, 409, 1, 0, 0, 0, 4195, 4200, 5, 145, 0, 0, 4196, 4200, 5, 135, 0, 0, 4197, 4198, 5, 233, 0, 0, 4198, 4200, 5, 268, 0, 0, 4199, 4195, 1, 0, 0, 0, 4199, 4196, 1, 0, 0, 0, 4199, 4197, 1, 0, 0, 0, 4200, 411, 1, 0, 0, 0, 4201, 4206, 3, 414, 207, 0, 4202, 4203, 5, 82, 0, 0, 4203, 4205, 3, 414, 207, 0, 4204, 4202, 1, 0, 0, 0, 4205, 4208, 1, 0, 0, 0, 4206, 4204, 1, 0, 0, 0, 4206, 4207, 1, 0, 0, 0, 4207, 413, 1, 0, 0, 0, 4208, 4206, 1, 0, 0, 0, 4209, 4217, 5, 232, 0, 0, 4210, 4217, 5, 182, 0, 0, 4211, 4217, 5, 362, 0, 0, 4212, 4213, 5, 362, 0, 0, 4213, 4214, 5, 268, 0, 0, 4214, 4217, 3, 220, 110, 0, 4215, 4217, 5, 351, 0, 0, 4216, 4209, 1, 0, 0, 0, 4216, 4210, 1, 0, 0, 0, 4216, 4211, 1, 0, 0, 0, 4216, 4212, 1, 0, 0, 0, 4216, 4215, 1, 0, 0, 0, 4217, 415, 1, 0, 0, 0, 4218, 4219, 5, 449, 0, 0, 4219, 4220, 3, 418, 209, 0, 4220, 417, 1, 0, 0, 0, 4221, 4223, 3, 420, 210, 0, 4222, 4221, 1, 0, 0, 0, 4223, 4224, 1, 0, 0, 0, 4224, 4222, 1, 0, 0, 0, 4224, 4225, 1, 0, 0, 0, 4225, 419, 1, 0, 0, 0, 4226, 4227, 3, 422, 211, 0, 4227, 4229, 3, 424, 212, 0, 4228, 4230, 3, 844, 422, 0, 4229, 4228, 1, 0, 0, 0, 4229, 4230, 1, 0, 0, 0, 4230, 4231, 1, 0, 0, 0, 4231, 4232, 3, 426, 213, 0, 4232, 421, 1, 0, 0, 0, 4233, 4234, 7, 21, 0, 0, 4234, 423, 1, 0, 0, 0, 4235, 4236, 7, 22, 0, 0, 4236, 425, 1, 0, 0, 0, 4237, 4238, 3, 1384, 692, 0, 4238, 427, 1, 0, 0, 0, 4239, 4241, 5, 62, 0, 0, 4240, 4242, 3, 430, 215, 0, 4241, 4240, 1, 0, 0, 0, 4241, 4242, 1, 0, 0, 0, 4242, 4243, 1, 0, 0, 0, 4243, 4244, 3, 432, 216, 0, 4244, 429, 1, 0, 0, 0, 4245, 4246, 5, 192, 0, 0, 4246, 431, 1, 0, 0, 0, 4247, 4248, 7, 23, 0, 0, 4248, 433, 1, 0, 0, 0, 4249, 4250, 5, 102, 0, 0, 4250, 4251, 5, 2, 0, 0, 4251, 4252, 3, 1172, 586, 0, 4252, 4253, 5, 3, 0, 0, 4253, 435, 1, 0, 0, 0, 4254, 4255, 7, 24, 0, 0, 4255, 437, 1, 0, 0, 0, 4256, 4259, 3, 440, 220, 0, 4257, 4259, 1, 0, 0, 0, 4258, 4256, 1, 0, 0, 0, 4258, 4257, 1, 0, 0, 0, 4259, 4264, 1, 0, 0, 0, 4260, 4261, 5, 6, 0, 0, 4261, 4263, 3, 440, 220, 0, 4262, 4260, 1, 0, 0, 0, 4263, 4266, 1, 0, 0, 0, 4264, 4262, 1, 0, 0, 0, 4264, 4265, 1, 0, 0, 0, 4265, 439, 1, 0, 0, 0, 4266, 4264, 1, 0, 0, 0, 4267, 4272, 3, 1368, 684, 0, 4268, 4272, 3, 1366, 683, 0, 4269, 4272, 3, 1370, 685, 0, 4270, 4272, 3, 1392, 696, 0, 4271, 4267, 1, 0, 0, 0, 4271, 4268, 1, 0, 0, 0, 4271, 4269, 1, 0, 0, 0, 4271, 4270, 1, 0, 0, 0, 4272, 441, 1, 0, 0, 0, 4273, 4274, 5, 64, 0, 0, 4274, 4275, 3, 1348, 674, 0, 4275, 443, 1, 0, 0, 0, 4276, 4278, 3, 446, 223, 0, 4277, 4276, 1, 0, 0, 0, 4278, 4281, 1, 0, 0, 0, 4279, 4277, 1, 0, 0, 0, 4279, 4280, 1, 0, 0, 0, 4280, 445, 1, 0, 0, 0, 4281, 4279, 1, 0, 0, 0, 4282, 4283, 5, 77, 0, 0, 4283, 4294, 5, 54, 0, 0, 4284, 4294, 5, 54, 0, 0, 4285, 4286, 5, 69, 0, 0, 4286, 4294, 5, 221, 0, 0, 4287, 4288, 5, 69, 0, 0, 4288, 4294, 5, 180, 0, 0, 4289, 4290, 5, 77, 0, 0, 4290, 4294, 5, 364, 0, 0, 4291, 4292, 5, 262, 0, 0, 4292, 4294, 5, 228, 0, 0, 4293, 4282, 1, 0, 0, 0, 4293, 4284, 1, 0, 0, 0, 4293, 4285, 1, 0, 0, 0, 4293, 4287, 1, 0, 0, 0, 4293, 4289, 1, 0, 0, 0, 4293, 4291, 1, 0, 0, 0, 4294, 447, 1, 0, 0, 0, 4295, 4296, 5, 46, 0, 0, 4296, 4297, 5, 198, 0, 0, 4297, 4298, 5, 350, 0, 0, 4298, 4299, 3, 1352, 676, 0, 4299, 4300, 5, 80, 0, 0, 4300, 4301, 3, 1392, 696, 0, 4301, 4302, 5, 202, 0, 0, 4302, 4303, 3, 436, 218, 0, 4303, 4304, 3, 1358, 679, 0, 4304, 4305, 5, 2, 0, 0, 4305, 4306, 5, 3, 0, 0, 4306, 4322, 1, 0, 0, 0, 4307, 4308, 5, 46, 0, 0, 4308, 4309, 5, 198, 0, 0, 4309, 4310, 5, 350, 0, 0, 4310, 4311, 3, 1352, 676, 0, 4311, 4312, 5, 80, 0, 0, 4312, 4313, 3, 1392, 696, 0, 4313, 4314, 5, 102, 0, 0, 4314, 4315, 3, 450, 225, 0, 4315, 4316, 5, 202, 0, 0, 4316, 4317, 3, 436, 218, 0, 4317, 4318, 3, 1358, 679, 0, 4318, 4319, 5, 2, 0, 0, 4319, 4320, 5, 3, 0, 0, 4320, 4322, 1, 0, 0, 0, 4321, 4295, 1, 0, 0, 0, 4321, 4307, 1, 0, 0, 0, 4322, 449, 1, 0, 0, 0, 4323, 4328, 3, 452, 226, 0, 4324, 4325, 5, 33, 0, 0, 4325, 4327, 3, 452, 226, 0, 4326, 4324, 1, 0, 0, 0, 4327, 4330, 1, 0, 0, 0, 4328, 4326, 1, 0, 0, 0, 4328, 4329, 1, 0, 0, 0, 4329, 451, 1, 0, 0, 0, 4330, 4328, 1, 0, 0, 0, 4331, 4332, 3, 1384, 692, 0, 4332, 4333, 5, 68, 0, 0, 4333, 4334, 5, 2, 0, 0, 4334, 4335, 3, 454, 227, 0, 4335, 4336, 5, 3, 0, 0, 4336, 453, 1, 0, 0, 0, 4337, 4342, 3, 1370, 685, 0, 4338, 4339, 5, 6, 0, 0, 4339, 4341, 3, 1370, 685, 0, 4340, 4338, 1, 0, 0, 0, 4341, 4344, 1, 0, 0, 0, 4342, 4340, 1, 0, 0, 0, 4342, 4343, 1, 0, 0, 0, 4343, 455, 1, 0, 0, 0, 4344, 4342, 1, 0, 0, 0, 4345, 4346, 5, 138, 0, 0, 4346, 4347, 5, 198, 0, 0, 4347, 4348, 5, 350, 0, 0, 4348, 4349, 3, 1352, 676, 0, 4349, 4350, 3, 458, 229, 0, 4350, 457, 1, 0, 0, 0, 4351, 4358, 5, 193, 0, 0, 4352, 4353, 5, 193, 0, 0, 4353, 4358, 5, 305, 0, 0, 4354, 4355, 5, 193, 0, 0, 4355, 4358, 5, 139, 0, 0, 4356, 4358, 5, 186, 0, 0, 4357, 4351, 1, 0, 0, 0, 4357, 4352, 1, 0, 0, 0, 4357, 4354, 1, 0, 0, 0, 4357, 4356, 1, 0, 0, 0, 4358, 459, 1, 0, 0, 0, 4359, 4360, 5, 46, 0, 0, 4360, 4361, 5, 140, 0, 0, 4361, 4362, 3, 528, 264, 0, 4362, 4363, 5, 42, 0, 0, 4363, 4364, 5, 2, 0, 0, 4364, 4365, 3, 1172, 586, 0, 4365, 4366, 5, 3, 0, 0, 4366, 4367, 3, 444, 222, 0, 4367, 461, 1, 0, 0, 0, 4368, 4370, 5, 46, 0, 0, 4369, 4371, 3, 626, 313, 0, 4370, 4369, 1, 0, 0, 0, 4370, 4371, 1, 0, 0, 0, 4371, 4372, 1, 0, 0, 0, 4372, 4373, 5, 136, 0, 0, 4373, 4374, 3, 1358, 679, 0, 4374, 4375, 3, 654, 327, 0, 4375, 4376, 3, 464, 232, 0, 4376, 4483, 1, 0, 0, 0, 4377, 4379, 5, 46, 0, 0, 4378, 4380, 3, 626, 313, 0, 4379, 4378, 1, 0, 0, 0, 4379, 4380, 1, 0, 0, 0, 4380, 4381, 1, 0, 0, 0, 4381, 4382, 5, 136, 0, 0, 4382, 4383, 3, 1358, 679, 0, 4383, 4384, 3, 472, 236, 0, 4384, 4483, 1, 0, 0, 0, 4385, 4386, 5, 46, 0, 0, 4386, 4387, 5, 271, 0, 0, 4387, 4388, 3, 692, 346, 0, 4388, 4389, 3, 464, 232, 0, 4389, 4483, 1, 0, 0, 0, 4390, 4391, 5, 46, 0, 0, 4391, 4392, 5, 353, 0, 0, 4392, 4393, 3, 528, 264, 0, 4393, 4394, 3, 464, 232, 0, 4394, 4483, 1, 0, 0, 0, 4395, 4396, 5, 46, 0, 0, 4396, 4397, 5, 353, 0, 0, 4397, 4483, 3, 528, 264, 0, 4398, 4399, 5, 46, 0, 0, 4399, 4400, 5, 353, 0, 0, 4400, 4401, 3, 528, 264, 0, 4401, 4402, 5, 36, 0, 0, 4402, 4404, 5, 2, 0, 0, 4403, 4405, 3, 1108, 554, 0, 4404, 4403, 1, 0, 0, 0, 4404, 4405, 1, 0, 0, 0, 4405, 4406, 1, 0, 0, 0, 4406, 4407, 5, 3, 0, 0, 4407, 4483, 1, 0, 0, 0, 4408, 4409, 5, 46, 0, 0, 4409, 4410, 5, 353, 0, 0, 4410, 4411, 3, 528, 264, 0, 4411, 4412, 5, 36, 0, 0, 4412, 4413, 5, 196, 0, 0, 4413, 4415, 5, 2, 0, 0, 4414, 4416, 3, 478, 239, 0, 4415, 4414, 1, 0, 0, 0, 4415, 4416, 1, 0, 0, 0, 4416, 4417, 1, 0, 0, 0, 4417, 4418, 5, 3, 0, 0, 4418, 4483, 1, 0, 0, 0, 4419, 4420, 5, 46, 0, 0, 4420, 4421, 5, 353, 0, 0, 4421, 4422, 3, 528, 264, 0, 4422, 4423, 5, 36, 0, 0, 4423, 4424, 5, 292, 0, 0, 4424, 4425, 3, 464, 232, 0, 4425, 4483, 1, 0, 0, 0, 4426, 4427, 5, 46, 0, 0, 4427, 4428, 5, 348, 0, 0, 4428, 4429, 5, 318, 0, 0, 4429, 4430, 5, 276, 0, 0, 4430, 4431, 3, 528, 264, 0, 4431, 4432, 3, 464, 232, 0, 4432, 4483, 1, 0, 0, 0, 4433, 4434, 5, 46, 0, 0, 4434, 4435, 5, 348, 0, 0, 4435, 4436, 5, 318, 0, 0, 4436, 4437, 5, 185, 0, 0, 4437, 4438, 3, 528, 264, 0, 4438, 4439, 3, 464, 232, 0, 4439, 4483, 1, 0, 0, 0, 4440, 4441, 5, 46, 0, 0, 4441, 4442, 5, 348, 0, 0, 4442, 4443, 5, 318, 0, 0, 4443, 4444, 5, 346, 0, 0, 4444, 4445, 3, 528, 264, 0, 4445, 4446, 3, 464, 232, 0, 4446, 4483, 1, 0, 0, 0, 4447, 4448, 5, 46, 0, 0, 4448, 4449, 5, 348, 0, 0, 4449, 4450, 5, 318, 0, 0, 4450, 4451, 5, 163, 0, 0, 4451, 4452, 3, 528, 264, 0, 4452, 4453, 3, 464, 232, 0, 4453, 4483, 1, 0, 0, 0, 4454, 4455, 5, 46, 0, 0, 4455, 4456, 5, 108, 0, 0, 4456, 4457, 3, 528, 264, 0, 4457, 4458, 3, 464, 232, 0, 4458, 4483, 1, 0, 0, 0, 4459, 4460, 5, 46, 0, 0, 4460, 4461, 5, 108, 0, 0, 4461, 4462, 5, 220, 0, 0, 4462, 4463, 5, 77, 0, 0, 4463, 4464, 5, 390, 0, 0, 4464, 4465, 3, 528, 264, 0, 4465, 4466, 3, 464, 232, 0, 4466, 4483, 1, 0, 0, 0, 4467, 4468, 5, 46, 0, 0, 4468, 4469, 5, 108, 0, 0, 4469, 4470, 3, 528, 264, 0, 4470, 4471, 5, 64, 0, 0, 4471, 4472, 3, 528, 264, 0, 4472, 4483, 1, 0, 0, 0, 4473, 4474, 5, 46, 0, 0, 4474, 4475, 5, 108, 0, 0, 4475, 4476, 5, 220, 0, 0, 4476, 4477, 5, 77, 0, 0, 4477, 4478, 5, 390, 0, 0, 4478, 4479, 3, 528, 264, 0, 4479, 4480, 5, 64, 0, 0, 4480, 4481, 3, 528, 264, 0, 4481, 4483, 1, 0, 0, 0, 4482, 4368, 1, 0, 0, 0, 4482, 4377, 1, 0, 0, 0, 4482, 4385, 1, 0, 0, 0, 4482, 4390, 1, 0, 0, 0, 4482, 4395, 1, 0, 0, 0, 4482, 4398, 1, 0, 0, 0, 4482, 4408, 1, 0, 0, 0, 4482, 4419, 1, 0, 0, 0, 4482, 4426, 1, 0, 0, 0, 4482, 4433, 1, 0, 0, 0, 4482, 4440, 1, 0, 0, 0, 4482, 4447, 1, 0, 0, 0, 4482, 4454, 1, 0, 0, 0, 4482, 4459, 1, 0, 0, 0, 4482, 4467, 1, 0, 0, 0, 4482, 4473, 1, 0, 0, 0, 4483, 463, 1, 0, 0, 0, 4484, 4485, 5, 2, 0, 0, 4485, 4486, 3, 466, 233, 0, 4486, 4487, 5, 3, 0, 0, 4487, 465, 1, 0, 0, 0, 4488, 4493, 3, 468, 234, 0, 4489, 4490, 5, 6, 0, 0, 4490, 4492, 3, 468, 234, 0, 4491, 4489, 1, 0, 0, 0, 4492, 4495, 1, 0, 0, 0, 4493, 4491, 1, 0, 0, 0, 4493, 4494, 1, 0, 0, 0, 4494, 467, 1, 0, 0, 0, 4495, 4493, 1, 0, 0, 0, 4496, 4499, 3, 1392, 696, 0, 4497, 4498, 5, 10, 0, 0, 4498, 4500, 3, 470, 235, 0, 4499, 4497, 1, 0, 0, 0, 4499, 4500, 1, 0, 0, 0, 4500, 469, 1, 0, 0, 0, 4501, 4508, 3, 648, 324, 0, 4502, 4508, 3, 1404, 702, 0, 4503, 4508, 3, 1286, 643, 0, 4504, 4508, 3, 296, 148, 0, 4505, 4508, 3, 1370, 685, 0, 4506, 4508, 5, 401, 0, 0, 4507, 4501, 1, 0, 0, 0, 4507, 4502, 1, 0, 0, 0, 4507, 4503, 1, 0, 0, 0, 4507, 4504, 1, 0, 0, 0, 4507, 4505, 1, 0, 0, 0, 4507, 4506, 1, 0, 0, 0, 4508, 471, 1, 0, 0, 0, 4509, 4510, 5, 2, 0, 0, 4510, 4511, 3, 474, 237, 0, 4511, 4512, 5, 3, 0, 0, 4512, 473, 1, 0, 0, 0, 4513, 4518, 3, 476, 238, 0, 4514, 4515, 5, 6, 0, 0, 4515, 4517, 3, 476, 238, 0, 4516, 4514, 1, 0, 0, 0, 4517, 4520, 1, 0, 0, 0, 4518, 4516, 1, 0, 0, 0, 4518, 4519, 1, 0, 0, 0, 4519, 475, 1, 0, 0, 0, 4520, 4518, 1, 0, 0, 0, 4521, 4522, 3, 1394, 697, 0, 4522, 4523, 5, 10, 0, 0, 4523, 4524, 3, 470, 235, 0, 4524, 477, 1, 0, 0, 0, 4525, 4526, 3, 480, 240, 0, 4526, 479, 1, 0, 0, 0, 4527, 4532, 3, 1370, 685, 0, 4528, 4529, 5, 6, 0, 0, 4529, 4531, 3, 1370, 685, 0, 4530, 4528, 1, 0, 0, 0, 4531, 4534, 1, 0, 0, 0, 4532, 4530, 1, 0, 0, 0, 4532, 4533, 1, 0, 0, 0, 4533, 481, 1, 0, 0, 0, 4534, 4532, 1, 0, 0, 0, 4535, 4536, 5, 138, 0, 0, 4536, 4537, 5, 353, 0, 0, 4537, 4538, 3, 528, 264, 0, 4538, 4539, 5, 133, 0, 0, 4539, 4541, 5, 452, 0, 0, 4540, 4542, 3, 484, 242, 0, 4541, 4540, 1, 0, 0, 0, 4541, 4542, 1, 0, 0, 0, 4542, 4543, 1, 0, 0, 0, 4543, 4544, 3, 1370, 685, 0, 4544, 4579, 1, 0, 0, 0, 4545, 4546, 5, 138, 0, 0, 4546, 4547, 5, 353, 0, 0, 4547, 4548, 3, 528, 264, 0, 4548, 4549, 5, 133, 0, 0, 4549, 4551, 5, 452, 0, 0, 4550, 4552, 3, 484, 242, 0, 4551, 4550, 1, 0, 0, 0, 4551, 4552, 1, 0, 0, 0, 4552, 4553, 1, 0, 0, 0, 4553, 4554, 3, 1370, 685, 0, 4554, 4555, 5, 145, 0, 0, 4555, 4556, 3, 1370, 685, 0, 4556, 4579, 1, 0, 0, 0, 4557, 4558, 5, 138, 0, 0, 4558, 4559, 5, 353, 0, 0, 4559, 4560, 3, 528, 264, 0, 4560, 4561, 5, 133, 0, 0, 4561, 4563, 5, 452, 0, 0, 4562, 4564, 3, 484, 242, 0, 4563, 4562, 1, 0, 0, 0, 4563, 4564, 1, 0, 0, 0, 4564, 4565, 1, 0, 0, 0, 4565, 4566, 3, 1370, 685, 0, 4566, 4567, 5, 135, 0, 0, 4567, 4568, 3, 1370, 685, 0, 4568, 4579, 1, 0, 0, 0, 4569, 4570, 5, 138, 0, 0, 4570, 4571, 5, 353, 0, 0, 4571, 4572, 3, 528, 264, 0, 4572, 4573, 5, 302, 0, 0, 4573, 4574, 5, 452, 0, 0, 4574, 4575, 3, 1370, 685, 0, 4575, 4576, 5, 94, 0, 0, 4576, 4577, 3, 1370, 685, 0, 4577, 4579, 1, 0, 0, 0, 4578, 4535, 1, 0, 0, 0, 4578, 4545, 1, 0, 0, 0, 4578, 4557, 1, 0, 0, 0, 4578, 4569, 1, 0, 0, 0, 4579, 483, 1, 0, 0, 0, 4580, 4581, 5, 220, 0, 0, 4581, 4582, 5, 77, 0, 0, 4582, 4583, 5, 390, 0, 0, 4583, 485, 1, 0, 0, 0, 4584, 4585, 5, 46, 0, 0, 4585, 4586, 5, 271, 0, 0, 4586, 4587, 5, 156, 0, 0, 4587, 4589, 3, 528, 264, 0, 4588, 4590, 3, 492, 246, 0, 4589, 4588, 1, 0, 0, 0, 4589, 4590, 1, 0, 0, 0, 4590, 4591, 1, 0, 0, 0, 4591, 4592, 5, 62, 0, 0, 4592, 4593, 5, 353, 0, 0, 4593, 4594, 3, 1128, 564, 0, 4594, 4595, 5, 100, 0, 0, 4595, 4597, 3, 1352, 676, 0, 4596, 4598, 3, 494, 247, 0, 4597, 4596, 1, 0, 0, 0, 4597, 4598, 1, 0, 0, 0, 4598, 4599, 1, 0, 0, 0, 4599, 4600, 5, 36, 0, 0, 4600, 4601, 3, 488, 244, 0, 4601, 487, 1, 0, 0, 0, 4602, 4607, 3, 490, 245, 0, 4603, 4604, 5, 6, 0, 0, 4604, 4606, 3, 490, 245, 0, 4605, 4603, 1, 0, 0, 0, 4606, 4609, 1, 0, 0, 0, 4607, 4605, 1, 0, 0, 0, 4607, 4608, 1, 0, 0, 0, 4608, 489, 1, 0, 0, 0, 4609, 4607, 1, 0, 0, 0, 4610, 4611, 5, 271, 0, 0, 4611, 4612, 3, 1368, 684, 0, 4612, 4614, 3, 692, 346, 0, 4613, 4615, 3, 496, 248, 0, 4614, 4613, 1, 0, 0, 0, 4614, 4615, 1, 0, 0, 0, 4615, 4617, 1, 0, 0, 0, 4616, 4618, 3, 498, 249, 0, 4617, 4616, 1, 0, 0, 0, 4617, 4618, 1, 0, 0, 0, 4618, 4642, 1, 0, 0, 0, 4619, 4620, 5, 271, 0, 0, 4620, 4621, 3, 1368, 684, 0, 4621, 4623, 3, 696, 348, 0, 4622, 4624, 3, 496, 248, 0, 4623, 4622, 1, 0, 0, 0, 4623, 4624, 1, 0, 0, 0, 4624, 4626, 1, 0, 0, 0, 4625, 4627, 3, 498, 249, 0, 4626, 4625, 1, 0, 0, 0, 4626, 4627, 1, 0, 0, 0, 4627, 4642, 1, 0, 0, 0, 4628, 4629, 5, 211, 0, 0, 4629, 4630, 3, 1368, 684, 0, 4630, 4631, 3, 634, 317, 0, 4631, 4642, 1, 0, 0, 0, 4632, 4633, 5, 211, 0, 0, 4633, 4634, 3, 1368, 684, 0, 4634, 4635, 5, 2, 0, 0, 4635, 4636, 3, 1296, 648, 0, 4636, 4637, 5, 3, 0, 0, 4637, 4638, 3, 634, 317, 0, 4638, 4642, 1, 0, 0, 0, 4639, 4640, 5, 338, 0, 0, 4640, 4642, 3, 1128, 564, 0, 4641, 4610, 1, 0, 0, 0, 4641, 4619, 1, 0, 0, 0, 4641, 4628, 1, 0, 0, 0, 4641, 4632, 1, 0, 0, 0, 4641, 4639, 1, 0, 0, 0, 4642, 491, 1, 0, 0, 0, 4643, 4644, 5, 53, 0, 0, 4644, 493, 1, 0, 0, 0, 4645, 4646, 5, 206, 0, 0, 4646, 4647, 3, 528, 264, 0, 4647, 495, 1, 0, 0, 0, 4648, 4649, 5, 62, 0, 0, 4649, 4655, 5, 318, 0, 0, 4650, 4651, 5, 62, 0, 0, 4651, 4652, 5, 83, 0, 0, 4652, 4653, 5, 147, 0, 0, 4653, 4655, 3, 528, 264, 0, 4654, 4648, 1, 0, 0, 0, 4654, 4650, 1, 0, 0, 0, 4655, 497, 1, 0, 0, 0, 4656, 4657, 5, 295, 0, 0, 4657, 499, 1, 0, 0, 0, 4658, 4659, 5, 46, 0, 0, 4659, 4660, 5, 271, 0, 0, 4660, 4661, 5, 206, 0, 0, 4661, 4662, 3, 528, 264, 0, 4662, 4663, 5, 100, 0, 0, 4663, 4664, 3, 1352, 676, 0, 4664, 501, 1, 0, 0, 0, 4665, 4666, 5, 138, 0, 0, 4666, 4667, 5, 271, 0, 0, 4667, 4668, 5, 206, 0, 0, 4668, 4669, 3, 528, 264, 0, 4669, 4670, 5, 100, 0, 0, 4670, 4671, 3, 1352, 676, 0, 4671, 4672, 5, 133, 0, 0, 4672, 4673, 3, 488, 244, 0, 4673, 4684, 1, 0, 0, 0, 4674, 4675, 5, 138, 0, 0, 4675, 4676, 5, 271, 0, 0, 4676, 4677, 5, 206, 0, 0, 4677, 4678, 3, 528, 264, 0, 4678, 4679, 5, 100, 0, 0, 4679, 4680, 3, 1352, 676, 0, 4680, 4681, 5, 191, 0, 0, 4681, 4682, 3, 504, 252, 0, 4682, 4684, 1, 0, 0, 0, 4683, 4665, 1, 0, 0, 0, 4683, 4674, 1, 0, 0, 0, 4684, 503, 1, 0, 0, 0, 4685, 4690, 3, 506, 253, 0, 4686, 4687, 5, 6, 0, 0, 4687, 4689, 3, 506, 253, 0, 4688, 4686, 1, 0, 0, 0, 4689, 4692, 1, 0, 0, 0, 4690, 4688, 1, 0, 0, 0, 4690, 4691, 1, 0, 0, 0, 4691, 505, 1, 0, 0, 0, 4692, 4690, 1, 0, 0, 0, 4693, 4694, 5, 271, 0, 0, 4694, 4695, 3, 1368, 684, 0, 4695, 4696, 5, 2, 0, 0, 4696, 4697, 3, 1296, 648, 0, 4697, 4698, 5, 3, 0, 0, 4698, 4706, 1, 0, 0, 0, 4699, 4700, 5, 211, 0, 0, 4700, 4701, 3, 1368, 684, 0, 4701, 4702, 5, 2, 0, 0, 4702, 4703, 3, 1296, 648, 0, 4703, 4704, 5, 3, 0, 0, 4704, 4706, 1, 0, 0, 0, 4705, 4693, 1, 0, 0, 0, 4705, 4699, 1, 0, 0, 0, 4706, 507, 1, 0, 0, 0, 4707, 4708, 5, 191, 0, 0, 4708, 4709, 5, 271, 0, 0, 4709, 4710, 5, 156, 0, 0, 4710, 4711, 3, 528, 264, 0, 4711, 4712, 5, 100, 0, 0, 4712, 4714, 3, 1352, 676, 0, 4713, 4715, 3, 108, 54, 0, 4714, 4713, 1, 0, 0, 0, 4714, 4715, 1, 0, 0, 0, 4715, 4728, 1, 0, 0, 0, 4716, 4717, 5, 191, 0, 0, 4717, 4718, 5, 271, 0, 0, 4718, 4719, 5, 156, 0, 0, 4719, 4720, 5, 220, 0, 0, 4720, 4721, 5, 390, 0, 0, 4721, 4722, 3, 528, 264, 0, 4722, 4723, 5, 100, 0, 0, 4723, 4725, 3, 1352, 676, 0, 4724, 4726, 3, 108, 54, 0, 4725, 4724, 1, 0, 0, 0, 4725, 4726, 1, 0, 0, 0, 4726, 4728, 1, 0, 0, 0, 4727, 4707, 1, 0, 0, 0, 4727, 4716, 1, 0, 0, 0, 4728, 509, 1, 0, 0, 0, 4729, 4730, 5, 191, 0, 0, 4730, 4731, 5, 271, 0, 0, 4731, 4732, 5, 206, 0, 0, 4732, 4733, 3, 528, 264, 0, 4733, 4734, 5, 100, 0, 0, 4734, 4736, 3, 1352, 676, 0, 4735, 4737, 3, 108, 54, 0, 4736, 4735, 1, 0, 0, 0, 4736, 4737, 1, 0, 0, 0, 4737, 4750, 1, 0, 0, 0, 4738, 4739, 5, 191, 0, 0, 4739, 4740, 5, 271, 0, 0, 4740, 4741, 5, 206, 0, 0, 4741, 4742, 5, 220, 0, 0, 4742, 4743, 5, 390, 0, 0, 4743, 4744, 3, 528, 264, 0, 4744, 4745, 5, 100, 0, 0, 4745, 4747, 3, 1352, 676, 0, 4746, 4748, 3, 108, 54, 0, 4747, 4746, 1, 0, 0, 0, 4747, 4748, 1, 0, 0, 0, 4748, 4750, 1, 0, 0, 0, 4749, 4729, 1, 0, 0, 0, 4749, 4738, 1, 0, 0, 0, 4750, 511, 1, 0, 0, 0, 4751, 4752, 5, 191, 0, 0, 4752, 4753, 5, 274, 0, 0, 4753, 4754, 5, 147, 0, 0, 4754, 4756, 3, 1382, 691, 0, 4755, 4757, 3, 108, 54, 0, 4756, 4755, 1, 0, 0, 0, 4756, 4757, 1, 0, 0, 0, 4757, 513, 1, 0, 0, 0, 4758, 4759, 5, 294, 0, 0, 4759, 4760, 5, 274, 0, 0, 4760, 4761, 5, 147, 0, 0, 4761, 4762, 3, 1382, 691, 0, 4762, 4763, 5, 94, 0, 0, 4763, 4764, 3, 1380, 690, 0, 4764, 515, 1, 0, 0, 0, 4765, 4766, 5, 191, 0, 0, 4766, 4767, 3, 518, 259, 0, 4767, 4768, 5, 220, 0, 0, 4768, 4769, 5, 390, 0, 0, 4769, 4771, 3, 526, 263, 0, 4770, 4772, 3, 108, 54, 0, 4771, 4770, 1, 0, 0, 0, 4771, 4772, 1, 0, 0, 0, 4772, 4856, 1, 0, 0, 0, 4773, 4774, 5, 191, 0, 0, 4774, 4775, 3, 518, 259, 0, 4775, 4777, 3, 526, 263, 0, 4776, 4778, 3, 108, 54, 0, 4777, 4776, 1, 0, 0, 0, 4777, 4778, 1, 0, 0, 0, 4778, 4856, 1, 0, 0, 0, 4779, 4780, 5, 191, 0, 0, 4780, 4781, 3, 522, 261, 0, 4781, 4782, 5, 220, 0, 0, 4782, 4783, 5, 390, 0, 0, 4783, 4785, 3, 1350, 675, 0, 4784, 4786, 3, 108, 54, 0, 4785, 4784, 1, 0, 0, 0, 4785, 4786, 1, 0, 0, 0, 4786, 4856, 1, 0, 0, 0, 4787, 4788, 5, 191, 0, 0, 4788, 4789, 3, 522, 261, 0, 4789, 4791, 3, 1350, 675, 0, 4790, 4792, 3, 108, 54, 0, 4791, 4790, 1, 0, 0, 0, 4791, 4792, 1, 0, 0, 0, 4792, 4856, 1, 0, 0, 0, 4793, 4794, 5, 191, 0, 0, 4794, 4795, 3, 524, 262, 0, 4795, 4796, 3, 1352, 676, 0, 4796, 4797, 5, 80, 0, 0, 4797, 4799, 3, 528, 264, 0, 4798, 4800, 3, 108, 54, 0, 4799, 4798, 1, 0, 0, 0, 4799, 4800, 1, 0, 0, 0, 4800, 4856, 1, 0, 0, 0, 4801, 4802, 5, 191, 0, 0, 4802, 4803, 3, 524, 262, 0, 4803, 4804, 5, 220, 0, 0, 4804, 4805, 5, 390, 0, 0, 4805, 4806, 3, 1352, 676, 0, 4806, 4807, 5, 80, 0, 0, 4807, 4809, 3, 528, 264, 0, 4808, 4810, 3, 108, 54, 0, 4809, 4808, 1, 0, 0, 0, 4809, 4810, 1, 0, 0, 0, 4810, 4856, 1, 0, 0, 0, 4811, 4812, 5, 191, 0, 0, 4812, 4813, 5, 353, 0, 0, 4813, 4815, 3, 532, 266, 0, 4814, 4816, 3, 108, 54, 0, 4815, 4814, 1, 0, 0, 0, 4815, 4816, 1, 0, 0, 0, 4816, 4856, 1, 0, 0, 0, 4817, 4818, 5, 191, 0, 0, 4818, 4819, 5, 353, 0, 0, 4819, 4820, 5, 220, 0, 0, 4820, 4821, 5, 390, 0, 0, 4821, 4823, 3, 532, 266, 0, 4822, 4824, 3, 108, 54, 0, 4823, 4822, 1, 0, 0, 0, 4823, 4824, 1, 0, 0, 0, 4824, 4856, 1, 0, 0, 0, 4825, 4826, 5, 191, 0, 0, 4826, 4827, 5, 189, 0, 0, 4827, 4829, 3, 532, 266, 0, 4828, 4830, 3, 108, 54, 0, 4829, 4828, 1, 0, 0, 0, 4829, 4830, 1, 0, 0, 0, 4830, 4856, 1, 0, 0, 0, 4831, 4832, 5, 191, 0, 0, 4832, 4833, 5, 189, 0, 0, 4833, 4834, 5, 220, 0, 0, 4834, 4835, 5, 390, 0, 0, 4835, 4837, 3, 532, 266, 0, 4836, 4838, 3, 108, 54, 0, 4837, 4836, 1, 0, 0, 0, 4837, 4838, 1, 0, 0, 0, 4838, 4856, 1, 0, 0, 0, 4839, 4840, 5, 191, 0, 0, 4840, 4841, 5, 226, 0, 0, 4841, 4842, 5, 109, 0, 0, 4842, 4844, 3, 526, 263, 0, 4843, 4845, 3, 108, 54, 0, 4844, 4843, 1, 0, 0, 0, 4844, 4845, 1, 0, 0, 0, 4845, 4856, 1, 0, 0, 0, 4846, 4847, 5, 191, 0, 0, 4847, 4848, 5, 226, 0, 0, 4848, 4849, 5, 109, 0, 0, 4849, 4850, 5, 220, 0, 0, 4850, 4851, 5, 390, 0, 0, 4851, 4853, 3, 526, 263, 0, 4852, 4854, 3, 108, 54, 0, 4853, 4852, 1, 0, 0, 0, 4853, 4854, 1, 0, 0, 0, 4854, 4856, 1, 0, 0, 0, 4855, 4765, 1, 0, 0, 0, 4855, 4773, 1, 0, 0, 0, 4855, 4779, 1, 0, 0, 0, 4855, 4787, 1, 0, 0, 0, 4855, 4793, 1, 0, 0, 0, 4855, 4801, 1, 0, 0, 0, 4855, 4811, 1, 0, 0, 0, 4855, 4817, 1, 0, 0, 0, 4855, 4825, 1, 0, 0, 0, 4855, 4831, 1, 0, 0, 0, 4855, 4839, 1, 0, 0, 0, 4855, 4846, 1, 0, 0, 0, 4856, 517, 1, 0, 0, 0, 4857, 4881, 5, 92, 0, 0, 4858, 4881, 5, 321, 0, 0, 4859, 4881, 5, 369, 0, 0, 4860, 4861, 5, 251, 0, 0, 4861, 4881, 5, 369, 0, 0, 4862, 4881, 5, 226, 0, 0, 4863, 4864, 5, 63, 0, 0, 4864, 4881, 5, 92, 0, 0, 4865, 4881, 5, 108, 0, 0, 4866, 4881, 5, 168, 0, 0, 4867, 4881, 5, 335, 0, 0, 4868, 4869, 5, 348, 0, 0, 4869, 4870, 5, 318, 0, 0, 4870, 4881, 5, 276, 0, 0, 4871, 4872, 5, 348, 0, 0, 4872, 4873, 5, 318, 0, 0, 4873, 4881, 5, 185, 0, 0, 4874, 4875, 5, 348, 0, 0, 4875, 4876, 5, 318, 0, 0, 4876, 4881, 5, 346, 0, 0, 4877, 4878, 5, 348, 0, 0, 4878, 4879, 5, 318, 0, 0, 4879, 4881, 5, 163, 0, 0, 4880, 4857, 1, 0, 0, 0, 4880, 4858, 1, 0, 0, 0, 4880, 4859, 1, 0, 0, 0, 4880, 4860, 1, 0, 0, 0, 4880, 4862, 1, 0, 0, 0, 4880, 4863, 1, 0, 0, 0, 4880, 4865, 1, 0, 0, 0, 4880, 4866, 1, 0, 0, 0, 4880, 4867, 1, 0, 0, 0, 4880, 4868, 1, 0, 0, 0, 4880, 4871, 1, 0, 0, 0, 4880, 4874, 1, 0, 0, 0, 4880, 4877, 1, 0, 0, 0, 4881, 519, 1, 0, 0, 0, 4882, 4888, 3, 522, 261, 0, 4883, 4888, 5, 175, 0, 0, 4884, 4888, 5, 311, 0, 0, 4885, 4888, 5, 453, 0, 0, 4886, 4888, 5, 344, 0, 0, 4887, 4882, 1, 0, 0, 0, 4887, 4883, 1, 0, 0, 0, 4887, 4884, 1, 0, 0, 0, 4887, 4885, 1, 0, 0, 0, 4887, 4886, 1, 0, 0, 0, 4888, 521, 1, 0, 0, 0, 4889, 4890, 5, 131, 0, 0, 4890, 4905, 5, 448, 0, 0, 4891, 4892, 5, 198, 0, 0, 4892, 4905, 5, 350, 0, 0, 4893, 4905, 5, 204, 0, 0, 4894, 4895, 5, 63, 0, 0, 4895, 4896, 5, 174, 0, 0, 4896, 4905, 5, 374, 0, 0, 4897, 4899, 3, 312, 156, 0, 4898, 4897, 1, 0, 0, 0, 4898, 4899, 1, 0, 0, 0, 4899, 4900, 1, 0, 0, 0, 4900, 4905, 5, 238, 0, 0, 4901, 4905, 5, 454, 0, 0, 4902, 4905, 5, 316, 0, 0, 4903, 4905, 5, 324, 0, 0, 4904, 4889, 1, 0, 0, 0, 4904, 4891, 1, 0, 0, 0, 4904, 4893, 1, 0, 0, 0, 4904, 4894, 1, 0, 0, 0, 4904, 4898, 1, 0, 0, 0, 4904, 4901, 1, 0, 0, 0, 4904, 4902, 1, 0, 0, 0, 4904, 4903, 1, 0, 0, 0, 4905, 523, 1, 0, 0, 0, 4906, 4907, 7, 25, 0, 0, 4907, 525, 1, 0, 0, 0, 4908, 4913, 3, 528, 264, 0, 4909, 4910, 5, 6, 0, 0, 4910, 4912, 3, 528, 264, 0, 4911, 4909, 1, 0, 0, 0, 4912, 4915, 1, 0, 0, 0, 4913, 4911, 1, 0, 0, 0, 4913, 4914, 1, 0, 0, 0, 4914, 527, 1, 0, 0, 0, 4915, 4913, 1, 0, 0, 0, 4916, 4918, 3, 1384, 692, 0, 4917, 4919, 3, 530, 265, 0, 4918, 4917, 1, 0, 0, 0, 4918, 4919, 1, 0, 0, 0, 4919, 529, 1, 0, 0, 0, 4920, 4921, 5, 11, 0, 0, 4921, 4923, 3, 1354, 677, 0, 4922, 4920, 1, 0, 0, 0, 4923, 4924, 1, 0, 0, 0, 4924, 4922, 1, 0, 0, 0, 4924, 4925, 1, 0, 0, 0, 4925, 531, 1, 0, 0, 0, 4926, 4931, 3, 1128, 564, 0, 4927, 4928, 5, 6, 0, 0, 4928, 4930, 3, 1128, 564, 0, 4929, 4927, 1, 0, 0, 0, 4930, 4933, 1, 0, 0, 0, 4931, 4929, 1, 0, 0, 0, 4931, 4932, 1, 0, 0, 0, 4932, 533, 1, 0, 0, 0, 4933, 4931, 1, 0, 0, 0, 4934, 4936, 5, 351, 0, 0, 4935, 4937, 3, 998, 499, 0, 4936, 4935, 1, 0, 0, 0, 4936, 4937, 1, 0, 0, 0, 4937, 4938, 1, 0, 0, 0, 4938, 4940, 3, 1086, 543, 0, 4939, 4941, 3, 536, 268, 0, 4940, 4939, 1, 0, 0, 0, 4940, 4941, 1, 0, 0, 0, 4941, 4943, 1, 0, 0, 0, 4942, 4944, 3, 108, 54, 0, 4943, 4942, 1, 0, 0, 0, 4943, 4944, 1, 0, 0, 0, 4944, 535, 1, 0, 0, 0, 4945, 4946, 5, 167, 0, 0, 4946, 4950, 5, 219, 0, 0, 4947, 4948, 5, 307, 0, 0, 4948, 4950, 5, 219, 0, 0, 4949, 4945, 1, 0, 0, 0, 4949, 4947, 1, 0, 0, 0, 4950, 537, 1, 0, 0, 0, 4951, 4952, 5, 159, 0, 0, 4952, 4953, 5, 80, 0, 0, 4953, 4954, 3, 518, 259, 0, 4954, 4955, 3, 528, 264, 0, 4955, 4956, 5, 116, 0, 0, 4956, 4957, 3, 540, 270, 0, 4957, 5099, 1, 0, 0, 0, 4958, 4959, 5, 159, 0, 0, 4959, 4960, 5, 80, 0, 0, 4960, 4961, 5, 44, 0, 0, 4961, 4962, 3, 528, 264, 0, 4962, 4963, 5, 116, 0, 0, 4963, 4964, 3, 540, 270, 0, 4964, 5099, 1, 0, 0, 0, 4965, 4966, 5, 159, 0, 0, 4966, 4967, 5, 80, 0, 0, 4967, 4968, 3, 520, 260, 0, 4968, 4969, 3, 1352, 676, 0, 4969, 4970, 5, 116, 0, 0, 4970, 4971, 3, 540, 270, 0, 4971, 5099, 1, 0, 0, 0, 4972, 4973, 5, 159, 0, 0, 4973, 4974, 5, 80, 0, 0, 4974, 4975, 5, 353, 0, 0, 4975, 4976, 3, 1128, 564, 0, 4976, 4977, 5, 116, 0, 0, 4977, 4978, 3, 540, 270, 0, 4978, 5099, 1, 0, 0, 0, 4979, 4980, 5, 159, 0, 0, 4980, 4981, 5, 80, 0, 0, 4981, 4982, 5, 189, 0, 0, 4982, 4983, 3, 1128, 564, 0, 4983, 4984, 5, 116, 0, 0, 4984, 4985, 3, 540, 270, 0, 4985, 5099, 1, 0, 0, 0, 4986, 4987, 5, 159, 0, 0, 4987, 4988, 5, 80, 0, 0, 4988, 4989, 5, 136, 0, 0, 4989, 4990, 3, 658, 329, 0, 4990, 4991, 5, 116, 0, 0, 4991, 4992, 3, 540, 270, 0, 4992, 5099, 1, 0, 0, 0, 4993, 4994, 5, 159, 0, 0, 4994, 4995, 5, 80, 0, 0, 4995, 4996, 5, 211, 0, 0, 4996, 4997, 3, 634, 317, 0, 4997, 4998, 5, 116, 0, 0, 4998, 4999, 3, 540, 270, 0, 4999, 5099, 1, 0, 0, 0, 5000, 5001, 5, 159, 0, 0, 5001, 5002, 5, 80, 0, 0, 5002, 5003, 5, 271, 0, 0, 5003, 5004, 3, 696, 348, 0, 5004, 5005, 5, 116, 0, 0, 5005, 5006, 3, 540, 270, 0, 5006, 5099, 1, 0, 0, 0, 5007, 5008, 5, 159, 0, 0, 5008, 5009, 5, 80, 0, 0, 5009, 5010, 5, 45, 0, 0, 5010, 5011, 3, 1352, 676, 0, 5011, 5012, 5, 80, 0, 0, 5012, 5013, 3, 528, 264, 0, 5013, 5014, 5, 116, 0, 0, 5014, 5015, 3, 540, 270, 0, 5015, 5099, 1, 0, 0, 0, 5016, 5017, 5, 159, 0, 0, 5017, 5018, 5, 80, 0, 0, 5018, 5019, 5, 45, 0, 0, 5019, 5020, 3, 1352, 676, 0, 5020, 5021, 5, 80, 0, 0, 5021, 5022, 5, 189, 0, 0, 5022, 5023, 3, 528, 264, 0, 5023, 5024, 5, 116, 0, 0, 5024, 5025, 3, 540, 270, 0, 5025, 5099, 1, 0, 0, 0, 5026, 5027, 5, 159, 0, 0, 5027, 5028, 5, 80, 0, 0, 5028, 5029, 3, 524, 262, 0, 5029, 5030, 3, 1352, 676, 0, 5030, 5031, 5, 80, 0, 0, 5031, 5032, 3, 528, 264, 0, 5032, 5033, 5, 116, 0, 0, 5033, 5034, 3, 540, 270, 0, 5034, 5099, 1, 0, 0, 0, 5035, 5036, 5, 159, 0, 0, 5036, 5037, 5, 80, 0, 0, 5037, 5038, 5, 289, 0, 0, 5038, 5039, 3, 634, 317, 0, 5039, 5040, 5, 116, 0, 0, 5040, 5041, 3, 540, 270, 0, 5041, 5099, 1, 0, 0, 0, 5042, 5043, 5, 159, 0, 0, 5043, 5044, 5, 80, 0, 0, 5044, 5045, 5, 444, 0, 0, 5045, 5046, 3, 634, 317, 0, 5046, 5047, 5, 116, 0, 0, 5047, 5048, 3, 540, 270, 0, 5048, 5099, 1, 0, 0, 0, 5049, 5050, 5, 159, 0, 0, 5050, 5051, 5, 80, 0, 0, 5051, 5052, 5, 445, 0, 0, 5052, 5053, 5, 62, 0, 0, 5053, 5054, 3, 1128, 564, 0, 5054, 5055, 5, 238, 0, 0, 5055, 5056, 3, 1352, 676, 0, 5056, 5057, 5, 116, 0, 0, 5057, 5058, 3, 540, 270, 0, 5058, 5099, 1, 0, 0, 0, 5059, 5060, 5, 159, 0, 0, 5060, 5061, 5, 80, 0, 0, 5061, 5062, 5, 271, 0, 0, 5062, 5063, 5, 156, 0, 0, 5063, 5064, 3, 528, 264, 0, 5064, 5065, 5, 100, 0, 0, 5065, 5066, 3, 1352, 676, 0, 5066, 5067, 5, 116, 0, 0, 5067, 5068, 3, 540, 270, 0, 5068, 5099, 1, 0, 0, 0, 5069, 5070, 5, 159, 0, 0, 5070, 5071, 5, 80, 0, 0, 5071, 5072, 5, 271, 0, 0, 5072, 5073, 5, 206, 0, 0, 5073, 5074, 3, 528, 264, 0, 5074, 5075, 5, 100, 0, 0, 5075, 5076, 3, 1352, 676, 0, 5076, 5077, 5, 116, 0, 0, 5077, 5078, 3, 540, 270, 0, 5078, 5099, 1, 0, 0, 0, 5079, 5080, 5, 159, 0, 0, 5080, 5081, 5, 80, 0, 0, 5081, 5082, 5, 239, 0, 0, 5082, 5083, 5, 267, 0, 0, 5083, 5084, 3, 296, 148, 0, 5084, 5085, 5, 116, 0, 0, 5085, 5086, 3, 540, 270, 0, 5086, 5099, 1, 0, 0, 0, 5087, 5088, 5, 159, 0, 0, 5088, 5089, 5, 80, 0, 0, 5089, 5090, 5, 41, 0, 0, 5090, 5091, 5, 2, 0, 0, 5091, 5092, 3, 1128, 564, 0, 5092, 5093, 5, 36, 0, 0, 5093, 5094, 3, 1128, 564, 0, 5094, 5095, 5, 3, 0, 0, 5095, 5096, 5, 116, 0, 0, 5096, 5097, 3, 540, 270, 0, 5097, 5099, 1, 0, 0, 0, 5098, 4951, 1, 0, 0, 0, 5098, 4958, 1, 0, 0, 0, 5098, 4965, 1, 0, 0, 0, 5098, 4972, 1, 0, 0, 0, 5098, 4979, 1, 0, 0, 0, 5098, 4986, 1, 0, 0, 0, 5098, 4993, 1, 0, 0, 0, 5098, 5000, 1, 0, 0, 0, 5098, 5007, 1, 0, 0, 0, 5098, 5016, 1, 0, 0, 0, 5098, 5026, 1, 0, 0, 0, 5098, 5035, 1, 0, 0, 0, 5098, 5042, 1, 0, 0, 0, 5098, 5049, 1, 0, 0, 0, 5098, 5059, 1, 0, 0, 0, 5098, 5069, 1, 0, 0, 0, 5098, 5079, 1, 0, 0, 0, 5098, 5087, 1, 0, 0, 0, 5099, 539, 1, 0, 0, 0, 5100, 5103, 3, 1370, 685, 0, 5101, 5103, 5, 78, 0, 0, 5102, 5100, 1, 0, 0, 0, 5102, 5101, 1, 0, 0, 0, 5103, 541, 1, 0, 0, 0, 5104, 5105, 5, 320, 0, 0, 5105, 5107, 5, 237, 0, 0, 5106, 5108, 3, 544, 272, 0, 5107, 5106, 1, 0, 0, 0, 5107, 5108, 1, 0, 0, 0, 5108, 5109, 1, 0, 0, 0, 5109, 5110, 5, 80, 0, 0, 5110, 5111, 3, 518, 259, 0, 5111, 5112, 3, 528, 264, 0, 5112, 5113, 5, 116, 0, 0, 5113, 5114, 3, 546, 273, 0, 5114, 5216, 1, 0, 0, 0, 5115, 5116, 5, 320, 0, 0, 5116, 5118, 5, 237, 0, 0, 5117, 5119, 3, 544, 272, 0, 5118, 5117, 1, 0, 0, 0, 5118, 5119, 1, 0, 0, 0, 5119, 5120, 1, 0, 0, 0, 5120, 5121, 5, 80, 0, 0, 5121, 5122, 5, 44, 0, 0, 5122, 5123, 3, 528, 264, 0, 5123, 5124, 5, 116, 0, 0, 5124, 5125, 3, 546, 273, 0, 5125, 5216, 1, 0, 0, 0, 5126, 5127, 5, 320, 0, 0, 5127, 5129, 5, 237, 0, 0, 5128, 5130, 3, 544, 272, 0, 5129, 5128, 1, 0, 0, 0, 5129, 5130, 1, 0, 0, 0, 5130, 5131, 1, 0, 0, 0, 5131, 5132, 5, 80, 0, 0, 5132, 5133, 3, 520, 260, 0, 5133, 5134, 3, 1352, 676, 0, 5134, 5135, 5, 116, 0, 0, 5135, 5136, 3, 546, 273, 0, 5136, 5216, 1, 0, 0, 0, 5137, 5138, 5, 320, 0, 0, 5138, 5140, 5, 237, 0, 0, 5139, 5141, 3, 544, 272, 0, 5140, 5139, 1, 0, 0, 0, 5140, 5141, 1, 0, 0, 0, 5141, 5142, 1, 0, 0, 0, 5142, 5143, 5, 80, 0, 0, 5143, 5144, 5, 353, 0, 0, 5144, 5145, 3, 1128, 564, 0, 5145, 5146, 5, 116, 0, 0, 5146, 5147, 3, 546, 273, 0, 5147, 5216, 1, 0, 0, 0, 5148, 5149, 5, 320, 0, 0, 5149, 5151, 5, 237, 0, 0, 5150, 5152, 3, 544, 272, 0, 5151, 5150, 1, 0, 0, 0, 5151, 5152, 1, 0, 0, 0, 5152, 5153, 1, 0, 0, 0, 5153, 5154, 5, 80, 0, 0, 5154, 5155, 5, 189, 0, 0, 5155, 5156, 3, 1128, 564, 0, 5156, 5157, 5, 116, 0, 0, 5157, 5158, 3, 546, 273, 0, 5158, 5216, 1, 0, 0, 0, 5159, 5160, 5, 320, 0, 0, 5160, 5162, 5, 237, 0, 0, 5161, 5163, 3, 544, 272, 0, 5162, 5161, 1, 0, 0, 0, 5162, 5163, 1, 0, 0, 0, 5163, 5164, 1, 0, 0, 0, 5164, 5165, 5, 80, 0, 0, 5165, 5166, 5, 136, 0, 0, 5166, 5167, 3, 658, 329, 0, 5167, 5168, 5, 116, 0, 0, 5168, 5169, 3, 546, 273, 0, 5169, 5216, 1, 0, 0, 0, 5170, 5171, 5, 320, 0, 0, 5171, 5173, 5, 237, 0, 0, 5172, 5174, 3, 544, 272, 0, 5173, 5172, 1, 0, 0, 0, 5173, 5174, 1, 0, 0, 0, 5174, 5175, 1, 0, 0, 0, 5175, 5176, 5, 80, 0, 0, 5176, 5177, 5, 211, 0, 0, 5177, 5178, 3, 634, 317, 0, 5178, 5179, 5, 116, 0, 0, 5179, 5180, 3, 546, 273, 0, 5180, 5216, 1, 0, 0, 0, 5181, 5182, 5, 320, 0, 0, 5182, 5184, 5, 237, 0, 0, 5183, 5185, 3, 544, 272, 0, 5184, 5183, 1, 0, 0, 0, 5184, 5185, 1, 0, 0, 0, 5185, 5186, 1, 0, 0, 0, 5186, 5187, 5, 80, 0, 0, 5187, 5188, 5, 239, 0, 0, 5188, 5189, 5, 267, 0, 0, 5189, 5190, 3, 296, 148, 0, 5190, 5191, 5, 116, 0, 0, 5191, 5192, 3, 546, 273, 0, 5192, 5216, 1, 0, 0, 0, 5193, 5194, 5, 320, 0, 0, 5194, 5196, 5, 237, 0, 0, 5195, 5197, 3, 544, 272, 0, 5196, 5195, 1, 0, 0, 0, 5196, 5197, 1, 0, 0, 0, 5197, 5198, 1, 0, 0, 0, 5198, 5199, 5, 80, 0, 0, 5199, 5200, 5, 289, 0, 0, 5200, 5201, 3, 634, 317, 0, 5201, 5202, 5, 116, 0, 0, 5202, 5203, 3, 546, 273, 0, 5203, 5216, 1, 0, 0, 0, 5204, 5205, 5, 320, 0, 0, 5205, 5207, 5, 237, 0, 0, 5206, 5208, 3, 544, 272, 0, 5207, 5206, 1, 0, 0, 0, 5207, 5208, 1, 0, 0, 0, 5208, 5209, 1, 0, 0, 0, 5209, 5210, 5, 80, 0, 0, 5210, 5211, 5, 444, 0, 0, 5211, 5212, 3, 634, 317, 0, 5212, 5213, 5, 116, 0, 0, 5213, 5214, 3, 546, 273, 0, 5214, 5216, 1, 0, 0, 0, 5215, 5104, 1, 0, 0, 0, 5215, 5115, 1, 0, 0, 0, 5215, 5126, 1, 0, 0, 0, 5215, 5137, 1, 0, 0, 0, 5215, 5148, 1, 0, 0, 0, 5215, 5159, 1, 0, 0, 0, 5215, 5170, 1, 0, 0, 0, 5215, 5181, 1, 0, 0, 0, 5215, 5193, 1, 0, 0, 0, 5215, 5204, 1, 0, 0, 0, 5216, 543, 1, 0, 0, 0, 5217, 5218, 5, 62, 0, 0, 5218, 5219, 3, 72, 36, 0, 5219, 545, 1, 0, 0, 0, 5220, 5223, 3, 1370, 685, 0, 5221, 5223, 5, 78, 0, 0, 5222, 5220, 1, 0, 0, 0, 5222, 5221, 1, 0, 0, 0, 5223, 547, 1, 0, 0, 0, 5224, 5225, 5, 61, 0, 0, 5225, 5229, 3, 550, 275, 0, 5226, 5227, 5, 258, 0, 0, 5227, 5229, 3, 550, 275, 0, 5228, 5224, 1, 0, 0, 0, 5228, 5226, 1, 0, 0, 0, 5229, 549, 1, 0, 0, 0, 5230, 5316, 3, 964, 482, 0, 5231, 5232, 3, 552, 276, 0, 5232, 5233, 3, 964, 482, 0, 5233, 5316, 1, 0, 0, 0, 5234, 5236, 5, 261, 0, 0, 5235, 5237, 3, 554, 277, 0, 5236, 5235, 1, 0, 0, 0, 5236, 5237, 1, 0, 0, 0, 5237, 5238, 1, 0, 0, 0, 5238, 5316, 3, 964, 482, 0, 5239, 5241, 5, 286, 0, 0, 5240, 5242, 3, 554, 277, 0, 5241, 5240, 1, 0, 0, 0, 5241, 5242, 1, 0, 0, 0, 5242, 5243, 1, 0, 0, 0, 5243, 5316, 3, 964, 482, 0, 5244, 5246, 5, 207, 0, 0, 5245, 5247, 3, 554, 277, 0, 5246, 5245, 1, 0, 0, 0, 5246, 5247, 1, 0, 0, 0, 5247, 5248, 1, 0, 0, 0, 5248, 5316, 3, 964, 482, 0, 5249, 5251, 5, 240, 0, 0, 5250, 5252, 3, 554, 277, 0, 5251, 5250, 1, 0, 0, 0, 5251, 5252, 1, 0, 0, 0, 5252, 5253, 1, 0, 0, 0, 5253, 5316, 3, 964, 482, 0, 5254, 5255, 5, 130, 0, 0, 5255, 5257, 3, 1376, 688, 0, 5256, 5258, 3, 554, 277, 0, 5257, 5256, 1, 0, 0, 0, 5257, 5258, 1, 0, 0, 0, 5258, 5259, 1, 0, 0, 0, 5259, 5260, 3, 964, 482, 0, 5260, 5316, 1, 0, 0, 0, 5261, 5262, 5, 300, 0, 0, 5262, 5264, 3, 1376, 688, 0, 5263, 5265, 3, 554, 277, 0, 5264, 5263, 1, 0, 0, 0, 5264, 5265, 1, 0, 0, 0, 5265, 5266, 1, 0, 0, 0, 5266, 5267, 3, 964, 482, 0, 5267, 5316, 1, 0, 0, 0, 5268, 5270, 3, 1376, 688, 0, 5269, 5271, 3, 554, 277, 0, 5270, 5269, 1, 0, 0, 0, 5270, 5271, 1, 0, 0, 0, 5271, 5272, 1, 0, 0, 0, 5272, 5273, 3, 964, 482, 0, 5273, 5316, 1, 0, 0, 0, 5274, 5276, 5, 30, 0, 0, 5275, 5277, 3, 554, 277, 0, 5276, 5275, 1, 0, 0, 0, 5276, 5277, 1, 0, 0, 0, 5277, 5278, 1, 0, 0, 0, 5278, 5316, 3, 964, 482, 0, 5279, 5281, 5, 210, 0, 0, 5280, 5282, 3, 554, 277, 0, 5281, 5280, 1, 0, 0, 0, 5281, 5282, 1, 0, 0, 0, 5282, 5283, 1, 0, 0, 0, 5283, 5316, 3, 964, 482, 0, 5284, 5285, 5, 210, 0, 0, 5285, 5287, 3, 1376, 688, 0, 5286, 5288, 3, 554, 277, 0, 5287, 5286, 1, 0, 0, 0, 5287, 5288, 1, 0, 0, 0, 5288, 5289, 1, 0, 0, 0, 5289, 5290, 3, 964, 482, 0, 5290, 5316, 1, 0, 0, 0, 5291, 5292, 5, 210, 0, 0, 5292, 5294, 5, 30, 0, 0, 5293, 5295, 3, 554, 277, 0, 5294, 5293, 1, 0, 0, 0, 5294, 5295, 1, 0, 0, 0, 5295, 5296, 1, 0, 0, 0, 5296, 5316, 3, 964, 482, 0, 5297, 5299, 5, 144, 0, 0, 5298, 5300, 3, 554, 277, 0, 5299, 5298, 1, 0, 0, 0, 5299, 5300, 1, 0, 0, 0, 5300, 5301, 1, 0, 0, 0, 5301, 5316, 3, 964, 482, 0, 5302, 5303, 5, 144, 0, 0, 5303, 5305, 3, 1376, 688, 0, 5304, 5306, 3, 554, 277, 0, 5305, 5304, 1, 0, 0, 0, 5305, 5306, 1, 0, 0, 0, 5306, 5307, 1, 0, 0, 0, 5307, 5308, 3, 964, 482, 0, 5308, 5316, 1, 0, 0, 0, 5309, 5310, 5, 144, 0, 0, 5310, 5312, 5, 30, 0, 0, 5311, 5313, 3, 554, 277, 0, 5312, 5311, 1, 0, 0, 0, 5312, 5313, 1, 0, 0, 0, 5313, 5314, 1, 0, 0, 0, 5314, 5316, 3, 964, 482, 0, 5315, 5230, 1, 0, 0, 0, 5315, 5231, 1, 0, 0, 0, 5315, 5234, 1, 0, 0, 0, 5315, 5239, 1, 0, 0, 0, 5315, 5244, 1, 0, 0, 0, 5315, 5249, 1, 0, 0, 0, 5315, 5254, 1, 0, 0, 0, 5315, 5261, 1, 0, 0, 0, 5315, 5268, 1, 0, 0, 0, 5315, 5274, 1, 0, 0, 0, 5315, 5279, 1, 0, 0, 0, 5315, 5284, 1, 0, 0, 0, 5315, 5291, 1, 0, 0, 0, 5315, 5297, 1, 0, 0, 0, 5315, 5302, 1, 0, 0, 0, 5315, 5309, 1, 0, 0, 0, 5316, 551, 1, 0, 0, 0, 5317, 5318, 7, 26, 0, 0, 5318, 553, 1, 0, 0, 0, 5319, 5320, 3, 552, 276, 0, 5320, 555, 1, 0, 0, 0, 5321, 5322, 5, 65, 0, 0, 5322, 5323, 3, 560, 280, 0, 5323, 5324, 5, 80, 0, 0, 5324, 5325, 3, 566, 283, 0, 5325, 5326, 5, 94, 0, 0, 5326, 5328, 3, 572, 286, 0, 5327, 5329, 3, 576, 288, 0, 5328, 5327, 1, 0, 0, 0, 5328, 5329, 1, 0, 0, 0, 5329, 557, 1, 0, 0, 0, 5330, 5331, 5, 310, 0, 0, 5331, 5332, 3, 560, 280, 0, 5332, 5333, 5, 80, 0, 0, 5333, 5334, 3, 566, 283, 0, 5334, 5335, 5, 64, 0, 0, 5335, 5337, 3, 572, 286, 0, 5336, 5338, 3, 108, 54, 0, 5337, 5336, 1, 0, 0, 0, 5337, 5338, 1, 0, 0, 0, 5338, 5352, 1, 0, 0, 0, 5339, 5340, 5, 310, 0, 0, 5340, 5341, 5, 65, 0, 0, 5341, 5342, 5, 272, 0, 0, 5342, 5343, 5, 62, 0, 0, 5343, 5344, 3, 560, 280, 0, 5344, 5345, 5, 80, 0, 0, 5345, 5346, 3, 566, 283, 0, 5346, 5347, 5, 64, 0, 0, 5347, 5349, 3, 572, 286, 0, 5348, 5350, 3, 108, 54, 0, 5349, 5348, 1, 0, 0, 0, 5349, 5350, 1, 0, 0, 0, 5350, 5352, 1, 0, 0, 0, 5351, 5330, 1, 0, 0, 0, 5351, 5339, 1, 0, 0, 0, 5352, 559, 1, 0, 0, 0, 5353, 5369, 3, 562, 281, 0, 5354, 5369, 5, 30, 0, 0, 5355, 5356, 5, 30, 0, 0, 5356, 5369, 5, 287, 0, 0, 5357, 5358, 5, 30, 0, 0, 5358, 5359, 5, 2, 0, 0, 5359, 5360, 3, 220, 110, 0, 5360, 5361, 5, 3, 0, 0, 5361, 5369, 1, 0, 0, 0, 5362, 5363, 5, 30, 0, 0, 5363, 5364, 5, 287, 0, 0, 5364, 5365, 5, 2, 0, 0, 5365, 5366, 3, 220, 110, 0, 5366, 5367, 5, 3, 0, 0, 5367, 5369, 1, 0, 0, 0, 5368, 5353, 1, 0, 0, 0, 5368, 5354, 1, 0, 0, 0, 5368, 5355, 1, 0, 0, 0, 5368, 5357, 1, 0, 0, 0, 5368, 5362, 1, 0, 0, 0, 5369, 561, 1, 0, 0, 0, 5370, 5375, 3, 564, 282, 0, 5371, 5372, 5, 6, 0, 0, 5372, 5374, 3, 564, 282, 0, 5373, 5371, 1, 0, 0, 0, 5374, 5377, 1, 0, 0, 0, 5375, 5373, 1, 0, 0, 0, 5375, 5376, 1, 0, 0, 0, 5376, 563, 1, 0, 0, 0, 5377, 5375, 1, 0, 0, 0, 5378, 5380, 5, 88, 0, 0, 5379, 5381, 3, 218, 109, 0, 5380, 5379, 1, 0, 0, 0, 5380, 5381, 1, 0, 0, 0, 5381, 5397, 1, 0, 0, 0, 5382, 5384, 5, 86, 0, 0, 5383, 5385, 3, 218, 109, 0, 5384, 5383, 1, 0, 0, 0, 5384, 5385, 1, 0, 0, 0, 5385, 5397, 1, 0, 0, 0, 5386, 5388, 5, 46, 0, 0, 5387, 5389, 3, 218, 109, 0, 5388, 5387, 1, 0, 0, 0, 5388, 5389, 1, 0, 0, 0, 5389, 5397, 1, 0, 0, 0, 5390, 5391, 5, 138, 0, 0, 5391, 5397, 5, 342, 0, 0, 5392, 5394, 3, 1384, 692, 0, 5393, 5395, 3, 218, 109, 0, 5394, 5393, 1, 0, 0, 0, 5394, 5395, 1, 0, 0, 0, 5395, 5397, 1, 0, 0, 0, 5396, 5378, 1, 0, 0, 0, 5396, 5382, 1, 0, 0, 0, 5396, 5386, 1, 0, 0, 0, 5396, 5390, 1, 0, 0, 0, 5396, 5392, 1, 0, 0, 0, 5397, 565, 1, 0, 0, 0, 5398, 5459, 3, 1346, 673, 0, 5399, 5400, 5, 92, 0, 0, 5400, 5459, 3, 1346, 673, 0, 5401, 5402, 5, 321, 0, 0, 5402, 5459, 3, 1346, 673, 0, 5403, 5404, 5, 63, 0, 0, 5404, 5405, 5, 174, 0, 0, 5405, 5406, 5, 374, 0, 0, 5406, 5459, 3, 1350, 675, 0, 5407, 5408, 5, 63, 0, 0, 5408, 5409, 5, 324, 0, 0, 5409, 5459, 3, 1350, 675, 0, 5410, 5411, 5, 211, 0, 0, 5411, 5459, 3, 632, 316, 0, 5412, 5413, 5, 289, 0, 0, 5413, 5459, 3, 632, 316, 0, 5414, 5415, 5, 444, 0, 0, 5415, 5459, 3, 632, 316, 0, 5416, 5417, 5, 175, 0, 0, 5417, 5459, 3, 1350, 675, 0, 5418, 5419, 5, 189, 0, 0, 5419, 5459, 3, 526, 263, 0, 5420, 5421, 5, 238, 0, 0, 5421, 5459, 3, 1350, 675, 0, 5422, 5423, 5, 239, 0, 0, 5423, 5424, 5, 267, 0, 0, 5424, 5459, 3, 298, 149, 0, 5425, 5426, 5, 405, 0, 0, 5426, 5459, 3, 568, 284, 0, 5427, 5428, 5, 316, 0, 0, 5428, 5459, 3, 1350, 675, 0, 5429, 5430, 5, 344, 0, 0, 5430, 5459, 3, 1350, 675, 0, 5431, 5432, 5, 353, 0, 0, 5432, 5459, 3, 526, 263, 0, 5433, 5434, 5, 30, 0, 0, 5434, 5435, 5, 343, 0, 0, 5435, 5436, 5, 68, 0, 0, 5436, 5437, 5, 316, 0, 0, 5437, 5459, 3, 1350, 675, 0, 5438, 5439, 5, 30, 0, 0, 5439, 5440, 5, 322, 0, 0, 5440, 5441, 5, 68, 0, 0, 5441, 5442, 5, 316, 0, 0, 5442, 5459, 3, 1350, 675, 0, 5443, 5444, 5, 30, 0, 0, 5444, 5445, 5, 212, 0, 0, 5445, 5446, 5, 68, 0, 0, 5446, 5447, 5, 316, 0, 0, 5447, 5459, 3, 1350, 675, 0, 5448, 5449, 5, 30, 0, 0, 5449, 5450, 5, 459, 0, 0, 5450, 5451, 5, 68, 0, 0, 5451, 5452, 5, 316, 0, 0, 5452, 5459, 3, 1350, 675, 0, 5453, 5454, 5, 30, 0, 0, 5454, 5455, 5, 457, 0, 0, 5455, 5456, 5, 68, 0, 0, 5456, 5457, 5, 316, 0, 0, 5457, 5459, 3, 1350, 675, 0, 5458, 5398, 1, 0, 0, 0, 5458, 5399, 1, 0, 0, 0, 5458, 5401, 1, 0, 0, 0, 5458, 5403, 1, 0, 0, 0, 5458, 5407, 1, 0, 0, 0, 5458, 5410, 1, 0, 0, 0, 5458, 5412, 1, 0, 0, 0, 5458, 5414, 1, 0, 0, 0, 5458, 5416, 1, 0, 0, 0, 5458, 5418, 1, 0, 0, 0, 5458, 5420, 1, 0, 0, 0, 5458, 5422, 1, 0, 0, 0, 5458, 5425, 1, 0, 0, 0, 5458, 5427, 1, 0, 0, 0, 5458, 5429, 1, 0, 0, 0, 5458, 5431, 1, 0, 0, 0, 5458, 5433, 1, 0, 0, 0, 5458, 5438, 1, 0, 0, 0, 5458, 5443, 1, 0, 0, 0, 5458, 5448, 1, 0, 0, 0, 5458, 5453, 1, 0, 0, 0, 5459, 567, 1, 0, 0, 0, 5460, 5465, 3, 570, 285, 0, 5461, 5462, 5, 6, 0, 0, 5462, 5464, 3, 570, 285, 0, 5463, 5461, 1, 0, 0, 0, 5464, 5467, 1, 0, 0, 0, 5465, 5463, 1, 0, 0, 0, 5465, 5466, 1, 0, 0, 0, 5466, 569, 1, 0, 0, 0, 5467, 5465, 1, 0, 0, 0, 5468, 5471, 3, 1384, 692, 0, 5469, 5470, 5, 11, 0, 0, 5470, 5472, 3, 1384, 692, 0, 5471, 5469, 1, 0, 0, 0, 5471, 5472, 1, 0, 0, 0, 5472, 571, 1, 0, 0, 0, 5473, 5478, 3, 574, 287, 0, 5474, 5475, 5, 6, 0, 0, 5475, 5477, 3, 574, 287, 0, 5476, 5474, 1, 0, 0, 0, 5477, 5480, 1, 0, 0, 0, 5478, 5476, 1, 0, 0, 0, 5478, 5479, 1, 0, 0, 0, 5479, 573, 1, 0, 0, 0, 5480, 5478, 1, 0, 0, 0, 5481, 5485, 3, 1380, 690, 0, 5482, 5483, 5, 66, 0, 0, 5483, 5485, 3, 1380, 690, 0, 5484, 5481, 1, 0, 0, 0, 5484, 5482, 1, 0, 0, 0, 5485, 575, 1, 0, 0, 0, 5486, 5487, 5, 105, 0, 0, 5487, 5488, 5, 65, 0, 0, 5488, 5489, 5, 272, 0, 0, 5489, 577, 1, 0, 0, 0, 5490, 5491, 5, 65, 0, 0, 5491, 5492, 3, 562, 281, 0, 5492, 5493, 5, 94, 0, 0, 5493, 5495, 3, 1382, 691, 0, 5494, 5496, 3, 582, 291, 0, 5495, 5494, 1, 0, 0, 0, 5495, 5496, 1, 0, 0, 0, 5496, 5498, 1, 0, 0, 0, 5497, 5499, 3, 584, 292, 0, 5498, 5497, 1, 0, 0, 0, 5498, 5499, 1, 0, 0, 0, 5499, 579, 1, 0, 0, 0, 5500, 5501, 5, 310, 0, 0, 5501, 5502, 3, 562, 281, 0, 5502, 5503, 5, 64, 0, 0, 5503, 5505, 3, 1382, 691, 0, 5504, 5506, 3, 584, 292, 0, 5505, 5504, 1, 0, 0, 0, 5505, 5506, 1, 0, 0, 0, 5506, 5508, 1, 0, 0, 0, 5507, 5509, 3, 108, 54, 0, 5508, 5507, 1, 0, 0, 0, 5508, 5509, 1, 0, 0, 0, 5509, 5524, 1, 0, 0, 0, 5510, 5511, 5, 310, 0, 0, 5511, 5512, 5, 134, 0, 0, 5512, 5513, 5, 272, 0, 0, 5513, 5514, 5, 62, 0, 0, 5514, 5515, 3, 562, 281, 0, 5515, 5516, 5, 64, 0, 0, 5516, 5518, 3, 1382, 691, 0, 5517, 5519, 3, 584, 292, 0, 5518, 5517, 1, 0, 0, 0, 5518, 5519, 1, 0, 0, 0, 5519, 5521, 1, 0, 0, 0, 5520, 5522, 3, 108, 54, 0, 5521, 5520, 1, 0, 0, 0, 5521, 5522, 1, 0, 0, 0, 5522, 5524, 1, 0, 0, 0, 5523, 5500, 1, 0, 0, 0, 5523, 5510, 1, 0, 0, 0, 5524, 581, 1, 0, 0, 0, 5525, 5526, 5, 105, 0, 0, 5526, 5527, 5, 134, 0, 0, 5527, 5528, 5, 272, 0, 0, 5528, 583, 1, 0, 0, 0, 5529, 5530, 5, 214, 0, 0, 5530, 5531, 5, 147, 0, 0, 5531, 5532, 3, 1380, 690, 0, 5532, 585, 1, 0, 0, 0, 5533, 5534, 5, 138, 0, 0, 5534, 5535, 5, 53, 0, 0, 5535, 5536, 5, 287, 0, 0, 5536, 5537, 3, 588, 294, 0, 5537, 5538, 3, 592, 296, 0, 5538, 587, 1, 0, 0, 0, 5539, 5541, 3, 590, 295, 0, 5540, 5539, 1, 0, 0, 0, 5541, 5544, 1, 0, 0, 0, 5542, 5540, 1, 0, 0, 0, 5542, 5543, 1, 0, 0, 0, 5543, 589, 1, 0, 0, 0, 5544, 5542, 1, 0, 0, 0, 5545, 5546, 5, 68, 0, 0, 5546, 5547, 5, 316, 0, 0, 5547, 5555, 3, 1350, 675, 0, 5548, 5549, 5, 62, 0, 0, 5549, 5550, 5, 311, 0, 0, 5550, 5555, 3, 1382, 691, 0, 5551, 5552, 5, 62, 0, 0, 5552, 5553, 5, 99, 0, 0, 5553, 5555, 3, 1382, 691, 0, 5554, 5545, 1, 0, 0, 0, 5554, 5548, 1, 0, 0, 0, 5554, 5551, 1, 0, 0, 0, 5555, 591, 1, 0, 0, 0, 5556, 5557, 5, 65, 0, 0, 5557, 5558, 3, 560, 280, 0, 5558, 5559, 5, 80, 0, 0, 5559, 5560, 3, 594, 297, 0, 5560, 5561, 5, 94, 0, 0, 5561, 5563, 3, 572, 286, 0, 5562, 5564, 3, 576, 288, 0, 5563, 5562, 1, 0, 0, 0, 5563, 5564, 1, 0, 0, 0, 5564, 5587, 1, 0, 0, 0, 5565, 5566, 5, 310, 0, 0, 5566, 5567, 3, 560, 280, 0, 5567, 5568, 5, 80, 0, 0, 5568, 5569, 3, 594, 297, 0, 5569, 5570, 5, 64, 0, 0, 5570, 5572, 3, 572, 286, 0, 5571, 5573, 3, 108, 54, 0, 5572, 5571, 1, 0, 0, 0, 5572, 5573, 1, 0, 0, 0, 5573, 5587, 1, 0, 0, 0, 5574, 5575, 5, 310, 0, 0, 5575, 5576, 5, 65, 0, 0, 5576, 5577, 5, 272, 0, 0, 5577, 5578, 5, 62, 0, 0, 5578, 5579, 3, 560, 280, 0, 5579, 5580, 5, 80, 0, 0, 5580, 5581, 3, 594, 297, 0, 5581, 5582, 5, 64, 0, 0, 5582, 5584, 3, 572, 286, 0, 5583, 5585, 3, 108, 54, 0, 5584, 5583, 1, 0, 0, 0, 5584, 5585, 1, 0, 0, 0, 5585, 5587, 1, 0, 0, 0, 5586, 5556, 1, 0, 0, 0, 5586, 5565, 1, 0, 0, 0, 5586, 5574, 1, 0, 0, 0, 5587, 593, 1, 0, 0, 0, 5588, 5589, 7, 27, 0, 0, 5589, 595, 1, 0, 0, 0, 5590, 5592, 5, 46, 0, 0, 5591, 5593, 3, 598, 299, 0, 5592, 5591, 1, 0, 0, 0, 5592, 5593, 1, 0, 0, 0, 5593, 5594, 1, 0, 0, 0, 5594, 5596, 5, 226, 0, 0, 5595, 5597, 3, 600, 300, 0, 5596, 5595, 1, 0, 0, 0, 5596, 5597, 1, 0, 0, 0, 5597, 5604, 1, 0, 0, 0, 5598, 5599, 5, 220, 0, 0, 5599, 5600, 5, 77, 0, 0, 5600, 5602, 5, 390, 0, 0, 5601, 5598, 1, 0, 0, 0, 5601, 5602, 1, 0, 0, 0, 5602, 5603, 1, 0, 0, 0, 5603, 5605, 3, 1352, 676, 0, 5604, 5601, 1, 0, 0, 0, 5604, 5605, 1, 0, 0, 0, 5605, 5606, 1, 0, 0, 0, 5606, 5607, 5, 80, 0, 0, 5607, 5609, 3, 1084, 542, 0, 5608, 5610, 3, 604, 302, 0, 5609, 5608, 1, 0, 0, 0, 5609, 5610, 1, 0, 0, 0, 5610, 5611, 1, 0, 0, 0, 5611, 5612, 5, 2, 0, 0, 5612, 5613, 3, 606, 303, 0, 5613, 5615, 5, 3, 0, 0, 5614, 5616, 3, 612, 306, 0, 5615, 5614, 1, 0, 0, 0, 5615, 5616, 1, 0, 0, 0, 5616, 5618, 1, 0, 0, 0, 5617, 5619, 3, 200, 100, 0, 5618, 5617, 1, 0, 0, 0, 5618, 5619, 1, 0, 0, 0, 5619, 5621, 1, 0, 0, 0, 5620, 5622, 3, 118, 59, 0, 5621, 5620, 1, 0, 0, 0, 5621, 5622, 1, 0, 0, 0, 5622, 5624, 1, 0, 0, 0, 5623, 5625, 3, 258, 129, 0, 5624, 5623, 1, 0, 0, 0, 5624, 5625, 1, 0, 0, 0, 5625, 5627, 1, 0, 0, 0, 5626, 5628, 3, 1104, 552, 0, 5627, 5626, 1, 0, 0, 0, 5627, 5628, 1, 0, 0, 0, 5628, 597, 1, 0, 0, 0, 5629, 5630, 5, 98, 0, 0, 5630, 599, 1, 0, 0, 0, 5631, 5632, 5, 109, 0, 0, 5632, 601, 1, 0, 0, 0, 5633, 5634, 3, 1352, 676, 0, 5634, 603, 1, 0, 0, 0, 5635, 5636, 5, 100, 0, 0, 5636, 5637, 3, 1352, 676, 0, 5637, 605, 1, 0, 0, 0, 5638, 5643, 3, 610, 305, 0, 5639, 5640, 5, 6, 0, 0, 5640, 5642, 3, 610, 305, 0, 5641, 5639, 1, 0, 0, 0, 5642, 5645, 1, 0, 0, 0, 5643, 5641, 1, 0, 0, 0, 5643, 5644, 1, 0, 0, 0, 5644, 607, 1, 0, 0, 0, 5645, 5643, 1, 0, 0, 0, 5646, 5648, 3, 616, 308, 0, 5647, 5646, 1, 0, 0, 0, 5647, 5648, 1, 0, 0, 0, 5648, 5650, 1, 0, 0, 0, 5649, 5651, 3, 618, 309, 0, 5650, 5649, 1, 0, 0, 0, 5650, 5651, 1, 0, 0, 0, 5651, 5653, 1, 0, 0, 0, 5652, 5654, 3, 620, 310, 0, 5653, 5652, 1, 0, 0, 0, 5653, 5654, 1, 0, 0, 0, 5654, 5656, 1, 0, 0, 0, 5655, 5657, 3, 622, 311, 0, 5656, 5655, 1, 0, 0, 0, 5656, 5657, 1, 0, 0, 0, 5657, 5670, 1, 0, 0, 0, 5658, 5660, 3, 616, 308, 0, 5659, 5658, 1, 0, 0, 0, 5659, 5660, 1, 0, 0, 0, 5660, 5661, 1, 0, 0, 0, 5661, 5662, 3, 528, 264, 0, 5662, 5664, 3, 116, 58, 0, 5663, 5665, 3, 620, 310, 0, 5664, 5663, 1, 0, 0, 0, 5664, 5665, 1, 0, 0, 0, 5665, 5667, 1, 0, 0, 0, 5666, 5668, 3, 622, 311, 0, 5667, 5666, 1, 0, 0, 0, 5667, 5668, 1, 0, 0, 0, 5668, 5670, 1, 0, 0, 0, 5669, 5647, 1, 0, 0, 0, 5669, 5659, 1, 0, 0, 0, 5670, 609, 1, 0, 0, 0, 5671, 5672, 3, 1384, 692, 0, 5672, 5673, 3, 608, 304, 0, 5673, 5683, 1, 0, 0, 0, 5674, 5675, 3, 1224, 612, 0, 5675, 5676, 3, 608, 304, 0, 5676, 5683, 1, 0, 0, 0, 5677, 5678, 5, 2, 0, 0, 5678, 5679, 3, 1172, 586, 0, 5679, 5680, 5, 3, 0, 0, 5680, 5681, 3, 608, 304, 0, 5681, 5683, 1, 0, 0, 0, 5682, 5671, 1, 0, 0, 0, 5682, 5674, 1, 0, 0, 0, 5682, 5677, 1, 0, 0, 0, 5683, 611, 1, 0, 0, 0, 5684, 5685, 5, 443, 0, 0, 5685, 5686, 5, 2, 0, 0, 5686, 5687, 3, 614, 307, 0, 5687, 5688, 5, 3, 0, 0, 5688, 613, 1, 0, 0, 0, 5689, 5694, 3, 610, 305, 0, 5690, 5691, 5, 6, 0, 0, 5691, 5693, 3, 610, 305, 0, 5692, 5690, 1, 0, 0, 0, 5693, 5696, 1, 0, 0, 0, 5694, 5692, 1, 0, 0, 0, 5694, 5695, 1, 0, 0, 0, 5695, 615, 1, 0, 0, 0, 5696, 5694, 1, 0, 0, 0, 5697, 5698, 5, 43, 0, 0, 5698, 5699, 3, 528, 264, 0, 5699, 617, 1, 0, 0, 0, 5700, 5701, 3, 528, 264, 0, 5701, 619, 1, 0, 0, 0, 5702, 5703, 7, 28, 0, 0, 5703, 621, 1, 0, 0, 0, 5704, 5705, 5, 266, 0, 0, 5705, 5709, 5, 207, 0, 0, 5706, 5707, 5, 266, 0, 0, 5707, 5709, 5, 240, 0, 0, 5708, 5704, 1, 0, 0, 0, 5708, 5706, 1, 0, 0, 0, 5709, 623, 1, 0, 0, 0, 5710, 5712, 5, 46, 0, 0, 5711, 5713, 3, 626, 313, 0, 5712, 5711, 1, 0, 0, 0, 5712, 5713, 1, 0, 0, 0, 5713, 5714, 1, 0, 0, 0, 5714, 5715, 7, 24, 0, 0, 5715, 5716, 3, 1358, 679, 0, 5716, 5726, 3, 636, 318, 0, 5717, 5724, 5, 309, 0, 0, 5718, 5725, 3, 646, 323, 0, 5719, 5720, 5, 92, 0, 0, 5720, 5721, 5, 2, 0, 0, 5721, 5722, 3, 676, 338, 0, 5722, 5723, 5, 3, 0, 0, 5723, 5725, 1, 0, 0, 0, 5724, 5718, 1, 0, 0, 0, 5724, 5719, 1, 0, 0, 0, 5725, 5727, 1, 0, 0, 0, 5726, 5717, 1, 0, 0, 0, 5726, 5727, 1, 0, 0, 0, 5727, 5728, 1, 0, 0, 0, 5728, 5729, 3, 662, 331, 0, 5729, 625, 1, 0, 0, 0, 5730, 5731, 5, 82, 0, 0, 5731, 5732, 5, 304, 0, 0, 5732, 627, 1, 0, 0, 0, 5733, 5735, 5, 2, 0, 0, 5734, 5736, 3, 630, 315, 0, 5735, 5734, 1, 0, 0, 0, 5735, 5736, 1, 0, 0, 0, 5736, 5737, 1, 0, 0, 0, 5737, 5738, 5, 3, 0, 0, 5738, 629, 1, 0, 0, 0, 5739, 5744, 3, 640, 320, 0, 5740, 5741, 5, 6, 0, 0, 5741, 5743, 3, 640, 320, 0, 5742, 5740, 1, 0, 0, 0, 5743, 5746, 1, 0, 0, 0, 5744, 5742, 1, 0, 0, 0, 5744, 5745, 1, 0, 0, 0, 5745, 631, 1, 0, 0, 0, 5746, 5744, 1, 0, 0, 0, 5747, 5752, 3, 634, 317, 0, 5748, 5749, 5, 6, 0, 0, 5749, 5751, 3, 634, 317, 0, 5750, 5748, 1, 0, 0, 0, 5751, 5754, 1, 0, 0, 0, 5752, 5750, 1, 0, 0, 0, 5752, 5753, 1, 0, 0, 0, 5753, 633, 1, 0, 0, 0, 5754, 5752, 1, 0, 0, 0, 5755, 5756, 3, 1358, 679, 0, 5756, 5757, 3, 628, 314, 0, 5757, 5764, 1, 0, 0, 0, 5758, 5764, 3, 1402, 701, 0, 5759, 5761, 3, 1384, 692, 0, 5760, 5762, 3, 1334, 667, 0, 5761, 5760, 1, 0, 0, 0, 5761, 5762, 1, 0, 0, 0, 5762, 5764, 1, 0, 0, 0, 5763, 5755, 1, 0, 0, 0, 5763, 5758, 1, 0, 0, 0, 5763, 5759, 1, 0, 0, 0, 5764, 635, 1, 0, 0, 0, 5765, 5767, 5, 2, 0, 0, 5766, 5768, 3, 638, 319, 0, 5767, 5766, 1, 0, 0, 0, 5767, 5768, 1, 0, 0, 0, 5768, 5769, 1, 0, 0, 0, 5769, 5770, 5, 3, 0, 0, 5770, 637, 1, 0, 0, 0, 5771, 5776, 3, 650, 325, 0, 5772, 5773, 5, 6, 0, 0, 5773, 5775, 3, 650, 325, 0, 5774, 5772, 1, 0, 0, 0, 5775, 5778, 1, 0, 0, 0, 5776, 5774, 1, 0, 0, 0, 5776, 5777, 1, 0, 0, 0, 5777, 639, 1, 0, 0, 0, 5778, 5776, 1, 0, 0, 0, 5779, 5781, 3, 642, 321, 0, 5780, 5782, 3, 644, 322, 0, 5781, 5780, 1, 0, 0, 0, 5781, 5782, 1, 0, 0, 0, 5782, 5783, 1, 0, 0, 0, 5783, 5784, 3, 648, 324, 0, 5784, 5793, 1, 0, 0, 0, 5785, 5787, 3, 644, 322, 0, 5786, 5788, 3, 642, 321, 0, 5787, 5786, 1, 0, 0, 0, 5787, 5788, 1, 0, 0, 0, 5788, 5789, 1, 0, 0, 0, 5789, 5790, 3, 648, 324, 0, 5790, 5793, 1, 0, 0, 0, 5791, 5793, 3, 648, 324, 0, 5792, 5779, 1, 0, 0, 0, 5792, 5785, 1, 0, 0, 0, 5792, 5791, 1, 0, 0, 0, 5793, 641, 1, 0, 0, 0, 5794, 5796, 5, 68, 0, 0, 5795, 5797, 5, 455, 0, 0, 5796, 5795, 1, 0, 0, 0, 5796, 5797, 1, 0, 0, 0, 5797, 5802, 1, 0, 0, 0, 5798, 5802, 5, 455, 0, 0, 5799, 5802, 5, 394, 0, 0, 5800, 5802, 5, 101, 0, 0, 5801, 5794, 1, 0, 0, 0, 5801, 5798, 1, 0, 0, 0, 5801, 5799, 1, 0, 0, 0, 5801, 5800, 1, 0, 0, 0, 5802, 643, 1, 0, 0, 0, 5803, 5808, 3, 1388, 694, 0, 5804, 5808, 3, 1406, 703, 0, 5805, 5808, 5, 119, 0, 0, 5806, 5808, 5, 126, 0, 0, 5807, 5803, 1, 0, 0, 0, 5807, 5804, 1, 0, 0, 0, 5807, 5805, 1, 0, 0, 0, 5807, 5806, 1, 0, 0, 0, 5808, 645, 1, 0, 0, 0, 5809, 5810, 3, 648, 324, 0, 5810, 647, 1, 0, 0, 0, 5811, 5826, 3, 1128, 564, 0, 5812, 5814, 5, 410, 0, 0, 5813, 5812, 1, 0, 0, 0, 5813, 5814, 1, 0, 0, 0, 5814, 5819, 1, 0, 0, 0, 5815, 5820, 3, 1406, 703, 0, 5816, 5820, 3, 1388, 694, 0, 5817, 5820, 5, 119, 0, 0, 5818, 5820, 5, 126, 0, 0, 5819, 5815, 1, 0, 0, 0, 5819, 5816, 1, 0, 0, 0, 5819, 5817, 1, 0, 0, 0, 5819, 5818, 1, 0, 0, 0, 5820, 5821, 1, 0, 0, 0, 5821, 5822, 3, 530, 265, 0, 5822, 5823, 5, 27, 0, 0, 5823, 5824, 5, 353, 0, 0, 5824, 5826, 1, 0, 0, 0, 5825, 5811, 1, 0, 0, 0, 5825, 5813, 1, 0, 0, 0, 5826, 649, 1, 0, 0, 0, 5827, 5830, 3, 640, 320, 0, 5828, 5829, 7, 29, 0, 0, 5829, 5831, 3, 1172, 586, 0, 5830, 5828, 1, 0, 0, 0, 5830, 5831, 1, 0, 0, 0, 5831, 651, 1, 0, 0, 0, 5832, 5833, 3, 640, 320, 0, 5833, 653, 1, 0, 0, 0, 5834, 5845, 5, 2, 0, 0, 5835, 5846, 5, 9, 0, 0, 5836, 5846, 3, 656, 328, 0, 5837, 5838, 5, 83, 0, 0, 5838, 5839, 5, 147, 0, 0, 5839, 5846, 3, 656, 328, 0, 5840, 5841, 3, 656, 328, 0, 5841, 5842, 5, 83, 0, 0, 5842, 5843, 5, 147, 0, 0, 5843, 5844, 3, 656, 328, 0, 5844, 5846, 1, 0, 0, 0, 5845, 5835, 1, 0, 0, 0, 5845, 5836, 1, 0, 0, 0, 5845, 5837, 1, 0, 0, 0, 5845, 5840, 1, 0, 0, 0, 5846, 5847, 1, 0, 0, 0, 5847, 5848, 5, 3, 0, 0, 5848, 655, 1, 0, 0, 0, 5849, 5854, 3, 652, 326, 0, 5850, 5851, 5, 6, 0, 0, 5851, 5853, 3, 652, 326, 0, 5852, 5850, 1, 0, 0, 0, 5853, 5856, 1, 0, 0, 0, 5854, 5852, 1, 0, 0, 0, 5854, 5855, 1, 0, 0, 0, 5855, 657, 1, 0, 0, 0, 5856, 5854, 1, 0, 0, 0, 5857, 5858, 3, 1358, 679, 0, 5858, 5859, 3, 654, 327, 0, 5859, 659, 1, 0, 0, 0, 5860, 5865, 3, 658, 329, 0, 5861, 5862, 5, 6, 0, 0, 5862, 5864, 3, 658, 329, 0, 5863, 5861, 1, 0, 0, 0, 5864, 5867, 1, 0, 0, 0, 5865, 5863, 1, 0, 0, 0, 5865, 5866, 1, 0, 0, 0, 5866, 661, 1, 0, 0, 0, 5867, 5865, 1, 0, 0, 0, 5868, 5870, 3, 666, 333, 0, 5869, 5868, 1, 0, 0, 0, 5870, 5871, 1, 0, 0, 0, 5871, 5869, 1, 0, 0, 0, 5871, 5872, 1, 0, 0, 0, 5872, 5873, 1, 0, 0, 0, 5873, 5874, 6, 331, -1, 0, 5874, 663, 1, 0, 0, 0, 5875, 5876, 5, 149, 0, 0, 5876, 5877, 5, 80, 0, 0, 5877, 5878, 5, 78, 0, 0, 5878, 5911, 5, 460, 0, 0, 5879, 5880, 5, 309, 0, 0, 5880, 5881, 5, 78, 0, 0, 5881, 5882, 5, 80, 0, 0, 5882, 5883, 5, 78, 0, 0, 5883, 5911, 5, 460, 0, 0, 5884, 5911, 5, 339, 0, 0, 5885, 5911, 5, 222, 0, 0, 5886, 5911, 5, 331, 0, 0, 5887, 5911, 5, 370, 0, 0, 5888, 5889, 5, 205, 0, 0, 5889, 5890, 5, 320, 0, 0, 5890, 5911, 5, 181, 0, 0, 5891, 5892, 5, 205, 0, 0, 5892, 5893, 5, 320, 0, 0, 5893, 5911, 5, 234, 0, 0, 5894, 5895, 5, 320, 0, 0, 5895, 5911, 5, 181, 0, 0, 5896, 5897, 5, 320, 0, 0, 5897, 5911, 5, 234, 0, 0, 5898, 5911, 5, 241, 0, 0, 5899, 5900, 5, 77, 0, 0, 5900, 5911, 5, 241, 0, 0, 5901, 5902, 5, 170, 0, 0, 5902, 5911, 3, 296, 148, 0, 5903, 5904, 5, 313, 0, 0, 5904, 5911, 3, 296, 148, 0, 5905, 5906, 5, 461, 0, 0, 5906, 5911, 3, 528, 264, 0, 5907, 5911, 3, 82, 41, 0, 5908, 5909, 5, 462, 0, 0, 5909, 5911, 3, 1384, 692, 0, 5910, 5875, 1, 0, 0, 0, 5910, 5879, 1, 0, 0, 0, 5910, 5884, 1, 0, 0, 0, 5910, 5885, 1, 0, 0, 0, 5910, 5886, 1, 0, 0, 0, 5910, 5887, 1, 0, 0, 0, 5910, 5888, 1, 0, 0, 0, 5910, 5891, 1, 0, 0, 0, 5910, 5894, 1, 0, 0, 0, 5910, 5896, 1, 0, 0, 0, 5910, 5898, 1, 0, 0, 0, 5910, 5899, 1, 0, 0, 0, 5910, 5901, 1, 0, 0, 0, 5910, 5903, 1, 0, 0, 0, 5910, 5905, 1, 0, 0, 0, 5910, 5907, 1, 0, 0, 0, 5910, 5908, 1, 0, 0, 0, 5911, 665, 1, 0, 0, 0, 5912, 5913, 5, 36, 0, 0, 5913, 5926, 3, 668, 334, 0, 5914, 5915, 5, 146, 0, 0, 5915, 5916, 5, 380, 0, 0, 5916, 5917, 3, 6, 3, 0, 5917, 5918, 5, 456, 0, 0, 5918, 5926, 1, 0, 0, 0, 5919, 5920, 5, 238, 0, 0, 5920, 5926, 3, 72, 36, 0, 5921, 5922, 5, 445, 0, 0, 5922, 5926, 3, 670, 335, 0, 5923, 5926, 5, 104, 0, 0, 5924, 5926, 3, 664, 332, 0, 5925, 5912, 1, 0, 0, 0, 5925, 5914, 1, 0, 0, 0, 5925, 5919, 1, 0, 0, 0, 5925, 5921, 1, 0, 0, 0, 5925, 5923, 1, 0, 0, 0, 5925, 5924, 1, 0, 0, 0, 5926, 667, 1, 0, 0, 0, 5927, 5933, 3, 1370, 685, 0, 5928, 5929, 3, 1370, 685, 0, 5929, 5930, 5, 6, 0, 0, 5930, 5931, 3, 1370, 685, 0, 5931, 5933, 1, 0, 0, 0, 5932, 5927, 1, 0, 0, 0, 5932, 5928, 1, 0, 0, 0, 5933, 669, 1, 0, 0, 0, 5934, 5935, 5, 62, 0, 0, 5935, 5936, 5, 353, 0, 0, 5936, 5943, 3, 1128, 564, 0, 5937, 5938, 5, 6, 0, 0, 5938, 5939, 5, 62, 0, 0, 5939, 5940, 5, 353, 0, 0, 5940, 5942, 3, 1128, 564, 0, 5941, 5937, 1, 0, 0, 0, 5942, 5945, 1, 0, 0, 0, 5943, 5941, 1, 0, 0, 0, 5943, 5944, 1, 0, 0, 0, 5944, 671, 1, 0, 0, 0, 5945, 5943, 1, 0, 0, 0, 5946, 5947, 5, 105, 0, 0, 5947, 5948, 3, 464, 232, 0, 5948, 673, 1, 0, 0, 0, 5949, 5950, 3, 644, 322, 0, 5950, 5951, 3, 648, 324, 0, 5951, 675, 1, 0, 0, 0, 5952, 5957, 3, 674, 337, 0, 5953, 5954, 5, 6, 0, 0, 5954, 5956, 3, 674, 337, 0, 5955, 5953, 1, 0, 0, 0, 5956, 5959, 1, 0, 0, 0, 5957, 5955, 1, 0, 0, 0, 5957, 5958, 1, 0, 0, 0, 5958, 677, 1, 0, 0, 0, 5959, 5957, 1, 0, 0, 0, 5960, 5961, 5, 138, 0, 0, 5961, 5962, 7, 30, 0, 0, 5962, 5963, 3, 634, 317, 0, 5963, 5965, 3, 680, 340, 0, 5964, 5966, 3, 682, 341, 0, 5965, 5964, 1, 0, 0, 0, 5965, 5966, 1, 0, 0, 0, 5966, 679, 1, 0, 0, 0, 5967, 5969, 3, 664, 332, 0, 5968, 5967, 1, 0, 0, 0, 5969, 5970, 1, 0, 0, 0, 5970, 5968, 1, 0, 0, 0, 5970, 5971, 1, 0, 0, 0, 5971, 681, 1, 0, 0, 0, 5972, 5973, 5, 308, 0, 0, 5973, 683, 1, 0, 0, 0, 5974, 5975, 5, 191, 0, 0, 5975, 5976, 5, 211, 0, 0, 5976, 5978, 3, 632, 316, 0, 5977, 5979, 3, 108, 54, 0, 5978, 5977, 1, 0, 0, 0, 5978, 5979, 1, 0, 0, 0, 5979, 6017, 1, 0, 0, 0, 5980, 5981, 5, 191, 0, 0, 5981, 5982, 5, 211, 0, 0, 5982, 5983, 5, 220, 0, 0, 5983, 5984, 5, 390, 0, 0, 5984, 5986, 3, 632, 316, 0, 5985, 5987, 3, 108, 54, 0, 5986, 5985, 1, 0, 0, 0, 5986, 5987, 1, 0, 0, 0, 5987, 6017, 1, 0, 0, 0, 5988, 5989, 5, 191, 0, 0, 5989, 5990, 5, 289, 0, 0, 5990, 5992, 3, 632, 316, 0, 5991, 5993, 3, 108, 54, 0, 5992, 5991, 1, 0, 0, 0, 5992, 5993, 1, 0, 0, 0, 5993, 6017, 1, 0, 0, 0, 5994, 5995, 5, 191, 0, 0, 5995, 5996, 5, 289, 0, 0, 5996, 5997, 5, 220, 0, 0, 5997, 5998, 5, 390, 0, 0, 5998, 6000, 3, 632, 316, 0, 5999, 6001, 3, 108, 54, 0, 6000, 5999, 1, 0, 0, 0, 6000, 6001, 1, 0, 0, 0, 6001, 6017, 1, 0, 0, 0, 6002, 6003, 5, 191, 0, 0, 6003, 6004, 5, 444, 0, 0, 6004, 6006, 3, 632, 316, 0, 6005, 6007, 3, 108, 54, 0, 6006, 6005, 1, 0, 0, 0, 6006, 6007, 1, 0, 0, 0, 6007, 6017, 1, 0, 0, 0, 6008, 6009, 5, 191, 0, 0, 6009, 6010, 5, 444, 0, 0, 6010, 6011, 5, 220, 0, 0, 6011, 6012, 5, 390, 0, 0, 6012, 6014, 3, 632, 316, 0, 6013, 6015, 3, 108, 54, 0, 6014, 6013, 1, 0, 0, 0, 6014, 6015, 1, 0, 0, 0, 6015, 6017, 1, 0, 0, 0, 6016, 5974, 1, 0, 0, 0, 6016, 5980, 1, 0, 0, 0, 6016, 5988, 1, 0, 0, 0, 6016, 5994, 1, 0, 0, 0, 6016, 6002, 1, 0, 0, 0, 6016, 6008, 1, 0, 0, 0, 6017, 685, 1, 0, 0, 0, 6018, 6019, 5, 191, 0, 0, 6019, 6020, 5, 136, 0, 0, 6020, 6022, 3, 660, 330, 0, 6021, 6023, 3, 108, 54, 0, 6022, 6021, 1, 0, 0, 0, 6022, 6023, 1, 0, 0, 0, 6023, 6033, 1, 0, 0, 0, 6024, 6025, 5, 191, 0, 0, 6025, 6026, 5, 136, 0, 0, 6026, 6027, 5, 220, 0, 0, 6027, 6028, 5, 390, 0, 0, 6028, 6030, 3, 660, 330, 0, 6029, 6031, 3, 108, 54, 0, 6030, 6029, 1, 0, 0, 0, 6030, 6031, 1, 0, 0, 0, 6031, 6033, 1, 0, 0, 0, 6032, 6018, 1, 0, 0, 0, 6032, 6024, 1, 0, 0, 0, 6033, 687, 1, 0, 0, 0, 6034, 6035, 5, 191, 0, 0, 6035, 6036, 5, 271, 0, 0, 6036, 6038, 3, 694, 347, 0, 6037, 6039, 3, 108, 54, 0, 6038, 6037, 1, 0, 0, 0, 6038, 6039, 1, 0, 0, 0, 6039, 6049, 1, 0, 0, 0, 6040, 6041, 5, 191, 0, 0, 6041, 6042, 5, 271, 0, 0, 6042, 6043, 5, 220, 0, 0, 6043, 6044, 5, 390, 0, 0, 6044, 6046, 3, 694, 347, 0, 6045, 6047, 3, 108, 54, 0, 6046, 6045, 1, 0, 0, 0, 6046, 6047, 1, 0, 0, 0, 6047, 6049, 1, 0, 0, 0, 6048, 6034, 1, 0, 0, 0, 6048, 6040, 1, 0, 0, 0, 6049, 689, 1, 0, 0, 0, 6050, 6051, 5, 2, 0, 0, 6051, 6052, 3, 1128, 564, 0, 6052, 6053, 5, 3, 0, 0, 6053, 6073, 1, 0, 0, 0, 6054, 6055, 5, 2, 0, 0, 6055, 6056, 3, 1128, 564, 0, 6056, 6057, 5, 6, 0, 0, 6057, 6058, 3, 1128, 564, 0, 6058, 6059, 5, 3, 0, 0, 6059, 6073, 1, 0, 0, 0, 6060, 6061, 5, 2, 0, 0, 6061, 6062, 5, 401, 0, 0, 6062, 6063, 5, 6, 0, 0, 6063, 6064, 3, 1128, 564, 0, 6064, 6065, 5, 3, 0, 0, 6065, 6073, 1, 0, 0, 0, 6066, 6067, 5, 2, 0, 0, 6067, 6068, 3, 1128, 564, 0, 6068, 6069, 5, 6, 0, 0, 6069, 6070, 5, 401, 0, 0, 6070, 6071, 5, 3, 0, 0, 6071, 6073, 1, 0, 0, 0, 6072, 6050, 1, 0, 0, 0, 6072, 6054, 1, 0, 0, 0, 6072, 6060, 1, 0, 0, 0, 6072, 6066, 1, 0, 0, 0, 6073, 691, 1, 0, 0, 0, 6074, 6075, 3, 1384, 692, 0, 6075, 6076, 5, 11, 0, 0, 6076, 6078, 1, 0, 0, 0, 6077, 6074, 1, 0, 0, 0, 6078, 6081, 1, 0, 0, 0, 6079, 6077, 1, 0, 0, 0, 6079, 6080, 1, 0, 0, 0, 6080, 6082, 1, 0, 0, 0, 6081, 6079, 1, 0, 0, 0, 6082, 6083, 3, 1280, 640, 0, 6083, 693, 1, 0, 0, 0, 6084, 6089, 3, 696, 348, 0, 6085, 6086, 5, 6, 0, 0, 6086, 6088, 3, 696, 348, 0, 6087, 6085, 1, 0, 0, 0, 6088, 6091, 1, 0, 0, 0, 6089, 6087, 1, 0, 0, 0, 6089, 6090, 1, 0, 0, 0, 6090, 695, 1, 0, 0, 0, 6091, 6089, 1, 0, 0, 0, 6092, 6093, 3, 692, 346, 0, 6093, 6094, 3, 690, 345, 0, 6094, 697, 1, 0, 0, 0, 6095, 6096, 5, 57, 0, 0, 6096, 6097, 3, 700, 350, 0, 6097, 699, 1, 0, 0, 0, 6098, 6100, 3, 702, 351, 0, 6099, 6098, 1, 0, 0, 0, 6100, 6101, 1, 0, 0, 0, 6101, 6099, 1, 0, 0, 0, 6101, 6102, 1, 0, 0, 0, 6102, 701, 1, 0, 0, 0, 6103, 6107, 3, 1370, 685, 0, 6104, 6105, 5, 238, 0, 0, 6105, 6107, 3, 72, 36, 0, 6106, 6103, 1, 0, 0, 0, 6106, 6104, 1, 0, 0, 0, 6107, 703, 1, 0, 0, 0, 6108, 6109, 5, 46, 0, 0, 6109, 6110, 5, 41, 0, 0, 6110, 6111, 5, 2, 0, 0, 6111, 6112, 3, 1128, 564, 0, 6112, 6113, 5, 36, 0, 0, 6113, 6114, 3, 1128, 564, 0, 6114, 6115, 5, 3, 0, 0, 6115, 6116, 5, 105, 0, 0, 6116, 6117, 5, 211, 0, 0, 6117, 6119, 3, 634, 317, 0, 6118, 6120, 3, 706, 353, 0, 6119, 6118, 1, 0, 0, 0, 6119, 6120, 1, 0, 0, 0, 6120, 6146, 1, 0, 0, 0, 6121, 6122, 5, 46, 0, 0, 6122, 6123, 5, 41, 0, 0, 6123, 6124, 5, 2, 0, 0, 6124, 6125, 3, 1128, 564, 0, 6125, 6126, 5, 36, 0, 0, 6126, 6127, 3, 1128, 564, 0, 6127, 6128, 5, 3, 0, 0, 6128, 6129, 5, 372, 0, 0, 6129, 6131, 5, 211, 0, 0, 6130, 6132, 3, 706, 353, 0, 6131, 6130, 1, 0, 0, 0, 6131, 6132, 1, 0, 0, 0, 6132, 6146, 1, 0, 0, 0, 6133, 6134, 5, 46, 0, 0, 6134, 6135, 5, 41, 0, 0, 6135, 6136, 5, 2, 0, 0, 6136, 6137, 3, 1128, 564, 0, 6137, 6138, 5, 36, 0, 0, 6138, 6139, 3, 1128, 564, 0, 6139, 6140, 5, 3, 0, 0, 6140, 6141, 5, 105, 0, 0, 6141, 6143, 5, 394, 0, 0, 6142, 6144, 3, 706, 353, 0, 6143, 6142, 1, 0, 0, 0, 6143, 6144, 1, 0, 0, 0, 6144, 6146, 1, 0, 0, 0, 6145, 6108, 1, 0, 0, 0, 6145, 6121, 1, 0, 0, 0, 6145, 6133, 1, 0, 0, 0, 6146, 705, 1, 0, 0, 0, 6147, 6148, 5, 36, 0, 0, 6148, 6152, 5, 223, 0, 0, 6149, 6150, 5, 36, 0, 0, 6150, 6152, 5, 141, 0, 0, 6151, 6147, 1, 0, 0, 0, 6151, 6149, 1, 0, 0, 0, 6152, 707, 1, 0, 0, 0, 6153, 6154, 5, 191, 0, 0, 6154, 6156, 5, 41, 0, 0, 6155, 6157, 3, 710, 355, 0, 6156, 6155, 1, 0, 0, 0, 6156, 6157, 1, 0, 0, 0, 6157, 6158, 1, 0, 0, 0, 6158, 6159, 5, 2, 0, 0, 6159, 6160, 3, 1128, 564, 0, 6160, 6161, 5, 36, 0, 0, 6161, 6162, 3, 1128, 564, 0, 6162, 6164, 5, 3, 0, 0, 6163, 6165, 3, 108, 54, 0, 6164, 6163, 1, 0, 0, 0, 6164, 6165, 1, 0, 0, 0, 6165, 709, 1, 0, 0, 0, 6166, 6167, 5, 220, 0, 0, 6167, 6168, 5, 390, 0, 0, 6168, 711, 1, 0, 0, 0, 6169, 6171, 5, 46, 0, 0, 6170, 6172, 3, 626, 313, 0, 6171, 6170, 1, 0, 0, 0, 6171, 6172, 1, 0, 0, 0, 6172, 6173, 1, 0, 0, 0, 6173, 6174, 5, 445, 0, 0, 6174, 6175, 5, 62, 0, 0, 6175, 6176, 3, 1128, 564, 0, 6176, 6177, 5, 238, 0, 0, 6177, 6178, 3, 1352, 676, 0, 6178, 6179, 5, 2, 0, 0, 6179, 6180, 3, 714, 357, 0, 6180, 6181, 5, 3, 0, 0, 6181, 713, 1, 0, 0, 0, 6182, 6183, 5, 64, 0, 0, 6183, 6184, 5, 463, 0, 0, 6184, 6185, 5, 105, 0, 0, 6185, 6186, 5, 211, 0, 0, 6186, 6187, 3, 634, 317, 0, 6187, 6188, 5, 6, 0, 0, 6188, 6189, 5, 94, 0, 0, 6189, 6190, 5, 463, 0, 0, 6190, 6191, 5, 105, 0, 0, 6191, 6192, 5, 211, 0, 0, 6192, 6193, 3, 634, 317, 0, 6193, 6217, 1, 0, 0, 0, 6194, 6195, 5, 94, 0, 0, 6195, 6196, 5, 463, 0, 0, 6196, 6197, 5, 105, 0, 0, 6197, 6198, 5, 211, 0, 0, 6198, 6199, 3, 634, 317, 0, 6199, 6200, 5, 6, 0, 0, 6200, 6201, 5, 64, 0, 0, 6201, 6202, 5, 463, 0, 0, 6202, 6203, 5, 105, 0, 0, 6203, 6204, 5, 211, 0, 0, 6204, 6205, 3, 634, 317, 0, 6205, 6217, 1, 0, 0, 0, 6206, 6207, 5, 64, 0, 0, 6207, 6208, 5, 463, 0, 0, 6208, 6209, 5, 105, 0, 0, 6209, 6210, 5, 211, 0, 0, 6210, 6217, 3, 634, 317, 0, 6211, 6212, 5, 94, 0, 0, 6212, 6213, 5, 463, 0, 0, 6213, 6214, 5, 105, 0, 0, 6214, 6215, 5, 211, 0, 0, 6215, 6217, 3, 634, 317, 0, 6216, 6182, 1, 0, 0, 0, 6216, 6194, 1, 0, 0, 0, 6216, 6206, 1, 0, 0, 0, 6216, 6211, 1, 0, 0, 0, 6217, 715, 1, 0, 0, 0, 6218, 6219, 5, 191, 0, 0, 6219, 6221, 5, 445, 0, 0, 6220, 6222, 3, 710, 355, 0, 6221, 6220, 1, 0, 0, 0, 6221, 6222, 1, 0, 0, 0, 6222, 6223, 1, 0, 0, 0, 6223, 6224, 5, 62, 0, 0, 6224, 6225, 3, 1128, 564, 0, 6225, 6226, 5, 238, 0, 0, 6226, 6228, 3, 1352, 676, 0, 6227, 6229, 3, 108, 54, 0, 6228, 6227, 1, 0, 0, 0, 6228, 6229, 1, 0, 0, 0, 6229, 717, 1, 0, 0, 0, 6230, 6231, 5, 299, 0, 0, 6231, 6233, 3, 720, 360, 0, 6232, 6234, 3, 600, 300, 0, 6233, 6232, 1, 0, 0, 0, 6233, 6234, 1, 0, 0, 0, 6234, 6235, 1, 0, 0, 0, 6235, 6236, 3, 1348, 674, 0, 6236, 6265, 1, 0, 0, 0, 6237, 6238, 5, 299, 0, 0, 6238, 6240, 3, 722, 361, 0, 6239, 6241, 3, 600, 300, 0, 6240, 6239, 1, 0, 0, 0, 6240, 6241, 1, 0, 0, 0, 6241, 6242, 1, 0, 0, 0, 6242, 6243, 3, 1352, 676, 0, 6243, 6265, 1, 0, 0, 0, 6244, 6245, 5, 299, 0, 0, 6245, 6246, 5, 2, 0, 0, 6246, 6247, 3, 724, 362, 0, 6247, 6248, 5, 3, 0, 0, 6248, 6250, 3, 720, 360, 0, 6249, 6251, 3, 600, 300, 0, 6250, 6249, 1, 0, 0, 0, 6250, 6251, 1, 0, 0, 0, 6251, 6252, 1, 0, 0, 0, 6252, 6253, 3, 1348, 674, 0, 6253, 6265, 1, 0, 0, 0, 6254, 6255, 5, 299, 0, 0, 6255, 6256, 5, 2, 0, 0, 6256, 6257, 3, 724, 362, 0, 6257, 6258, 5, 3, 0, 0, 6258, 6260, 3, 722, 361, 0, 6259, 6261, 3, 600, 300, 0, 6260, 6259, 1, 0, 0, 0, 6260, 6261, 1, 0, 0, 0, 6261, 6262, 1, 0, 0, 0, 6262, 6263, 3, 1352, 676, 0, 6263, 6265, 1, 0, 0, 0, 6264, 6230, 1, 0, 0, 0, 6264, 6237, 1, 0, 0, 0, 6264, 6244, 1, 0, 0, 0, 6264, 6254, 1, 0, 0, 0, 6265, 719, 1, 0, 0, 0, 6266, 6267, 7, 31, 0, 0, 6267, 721, 1, 0, 0, 0, 6268, 6269, 7, 32, 0, 0, 6269, 723, 1, 0, 0, 0, 6270, 6275, 3, 726, 363, 0, 6271, 6272, 5, 6, 0, 0, 6272, 6274, 3, 726, 363, 0, 6273, 6271, 1, 0, 0, 0, 6274, 6277, 1, 0, 0, 0, 6275, 6273, 1, 0, 0, 0, 6275, 6276, 1, 0, 0, 0, 6276, 725, 1, 0, 0, 0, 6277, 6275, 1, 0, 0, 0, 6278, 6279, 7, 33, 0, 0, 6279, 727, 1, 0, 0, 0, 6280, 6281, 5, 138, 0, 0, 6281, 6282, 5, 344, 0, 0, 6282, 6283, 3, 1352, 676, 0, 6283, 6284, 5, 326, 0, 0, 6284, 6285, 3, 116, 58, 0, 6285, 6293, 1, 0, 0, 0, 6286, 6287, 5, 138, 0, 0, 6287, 6288, 5, 344, 0, 0, 6288, 6289, 3, 1352, 676, 0, 6289, 6290, 5, 306, 0, 0, 6290, 6291, 3, 116, 58, 0, 6291, 6293, 1, 0, 0, 0, 6292, 6280, 1, 0, 0, 0, 6292, 6286, 1, 0, 0, 0, 6293, 729, 1, 0, 0, 0, 6294, 6295, 5, 138, 0, 0, 6295, 6296, 5, 136, 0, 0, 6296, 6297, 3, 658, 329, 0, 6297, 6298, 5, 302, 0, 0, 6298, 6299, 5, 94, 0, 0, 6299, 6300, 3, 1352, 676, 0, 6300, 6782, 1, 0, 0, 0, 6301, 6302, 5, 138, 0, 0, 6302, 6303, 5, 108, 0, 0, 6303, 6304, 3, 528, 264, 0, 6304, 6305, 5, 302, 0, 0, 6305, 6306, 5, 94, 0, 0, 6306, 6307, 3, 1352, 676, 0, 6307, 6782, 1, 0, 0, 0, 6308, 6309, 5, 138, 0, 0, 6309, 6310, 5, 168, 0, 0, 6310, 6311, 3, 528, 264, 0, 6311, 6312, 5, 302, 0, 0, 6312, 6313, 5, 94, 0, 0, 6313, 6314, 3, 1352, 676, 0, 6314, 6782, 1, 0, 0, 0, 6315, 6316, 5, 138, 0, 0, 6316, 6317, 5, 175, 0, 0, 6317, 6318, 3, 1352, 676, 0, 6318, 6319, 5, 302, 0, 0, 6319, 6320, 5, 94, 0, 0, 6320, 6321, 3, 1352, 676, 0, 6321, 6782, 1, 0, 0, 0, 6322, 6323, 5, 138, 0, 0, 6323, 6324, 5, 189, 0, 0, 6324, 6325, 3, 528, 264, 0, 6325, 6326, 5, 302, 0, 0, 6326, 6327, 5, 94, 0, 0, 6327, 6328, 3, 1352, 676, 0, 6328, 6782, 1, 0, 0, 0, 6329, 6330, 5, 138, 0, 0, 6330, 6331, 5, 189, 0, 0, 6331, 6332, 3, 528, 264, 0, 6332, 6333, 5, 302, 0, 0, 6333, 6334, 5, 45, 0, 0, 6334, 6335, 3, 1352, 676, 0, 6335, 6336, 5, 94, 0, 0, 6336, 6337, 3, 1352, 676, 0, 6337, 6782, 1, 0, 0, 0, 6338, 6339, 5, 138, 0, 0, 6339, 6340, 5, 63, 0, 0, 6340, 6341, 5, 174, 0, 0, 6341, 6342, 5, 374, 0, 0, 6342, 6343, 3, 1352, 676, 0, 6343, 6344, 5, 302, 0, 0, 6344, 6345, 5, 94, 0, 0, 6345, 6346, 3, 1352, 676, 0, 6346, 6782, 1, 0, 0, 0, 6347, 6348, 5, 138, 0, 0, 6348, 6349, 5, 211, 0, 0, 6349, 6350, 3, 634, 317, 0, 6350, 6351, 5, 302, 0, 0, 6351, 6352, 5, 94, 0, 0, 6352, 6353, 3, 1352, 676, 0, 6353, 6782, 1, 0, 0, 0, 6354, 6355, 5, 138, 0, 0, 6355, 6356, 5, 66, 0, 0, 6356, 6357, 3, 1378, 689, 0, 6357, 6358, 5, 302, 0, 0, 6358, 6359, 5, 94, 0, 0, 6359, 6360, 3, 1378, 689, 0, 6360, 6782, 1, 0, 0, 0, 6361, 6363, 5, 138, 0, 0, 6362, 6364, 3, 312, 156, 0, 6363, 6362, 1, 0, 0, 0, 6363, 6364, 1, 0, 0, 0, 6364, 6365, 1, 0, 0, 0, 6365, 6366, 5, 238, 0, 0, 6366, 6367, 3, 1352, 676, 0, 6367, 6368, 5, 302, 0, 0, 6368, 6369, 5, 94, 0, 0, 6369, 6370, 3, 1352, 676, 0, 6370, 6782, 1, 0, 0, 0, 6371, 6372, 5, 138, 0, 0, 6372, 6373, 5, 271, 0, 0, 6373, 6374, 5, 156, 0, 0, 6374, 6375, 3, 528, 264, 0, 6375, 6376, 5, 100, 0, 0, 6376, 6377, 3, 1352, 676, 0, 6377, 6378, 5, 302, 0, 0, 6378, 6379, 5, 94, 0, 0, 6379, 6380, 3, 1352, 676, 0, 6380, 6782, 1, 0, 0, 0, 6381, 6382, 5, 138, 0, 0, 6382, 6383, 5, 271, 0, 0, 6383, 6384, 5, 206, 0, 0, 6384, 6385, 3, 528, 264, 0, 6385, 6386, 5, 100, 0, 0, 6386, 6387, 3, 1352, 676, 0, 6387, 6388, 5, 302, 0, 0, 6388, 6389, 5, 94, 0, 0, 6389, 6390, 3, 1352, 676, 0, 6390, 6782, 1, 0, 0, 0, 6391, 6392, 5, 138, 0, 0, 6392, 6393, 5, 447, 0, 0, 6393, 6394, 3, 1352, 676, 0, 6394, 6395, 5, 80, 0, 0, 6395, 6396, 3, 1348, 674, 0, 6396, 6397, 5, 302, 0, 0, 6397, 6398, 5, 94, 0, 0, 6398, 6399, 3, 1352, 676, 0, 6399, 6782, 1, 0, 0, 0, 6400, 6401, 5, 138, 0, 0, 6401, 6402, 5, 447, 0, 0, 6402, 6403, 5, 220, 0, 0, 6403, 6404, 5, 390, 0, 0, 6404, 6405, 3, 1352, 676, 0, 6405, 6406, 5, 80, 0, 0, 6406, 6407, 3, 1348, 674, 0, 6407, 6408, 5, 302, 0, 0, 6408, 6409, 5, 94, 0, 0, 6409, 6410, 3, 1352, 676, 0, 6410, 6782, 1, 0, 0, 0, 6411, 6412, 5, 138, 0, 0, 6412, 6413, 5, 289, 0, 0, 6413, 6414, 3, 634, 317, 0, 6414, 6415, 5, 302, 0, 0, 6415, 6416, 5, 94, 0, 0, 6416, 6417, 3, 1352, 676, 0, 6417, 6782, 1, 0, 0, 0, 6418, 6419, 5, 138, 0, 0, 6419, 6420, 5, 454, 0, 0, 6420, 6421, 3, 1352, 676, 0, 6421, 6422, 5, 302, 0, 0, 6422, 6423, 5, 94, 0, 0, 6423, 6424, 3, 1352, 676, 0, 6424, 6782, 1, 0, 0, 0, 6425, 6426, 5, 138, 0, 0, 6426, 6427, 5, 444, 0, 0, 6427, 6428, 3, 634, 317, 0, 6428, 6429, 5, 302, 0, 0, 6429, 6430, 5, 94, 0, 0, 6430, 6431, 3, 1352, 676, 0, 6431, 6782, 1, 0, 0, 0, 6432, 6433, 5, 138, 0, 0, 6433, 6434, 5, 316, 0, 0, 6434, 6435, 3, 1352, 676, 0, 6435, 6436, 5, 302, 0, 0, 6436, 6437, 5, 94, 0, 0, 6437, 6438, 3, 1352, 676, 0, 6438, 6782, 1, 0, 0, 0, 6439, 6440, 5, 138, 0, 0, 6440, 6441, 5, 324, 0, 0, 6441, 6442, 3, 1352, 676, 0, 6442, 6443, 5, 302, 0, 0, 6443, 6444, 5, 94, 0, 0, 6444, 6445, 3, 1352, 676, 0, 6445, 6782, 1, 0, 0, 0, 6446, 6447, 5, 138, 0, 0, 6447, 6448, 5, 453, 0, 0, 6448, 6449, 3, 1352, 676, 0, 6449, 6450, 5, 302, 0, 0, 6450, 6451, 5, 94, 0, 0, 6451, 6452, 3, 1352, 676, 0, 6452, 6782, 1, 0, 0, 0, 6453, 6454, 5, 138, 0, 0, 6454, 6455, 5, 92, 0, 0, 6455, 6456, 3, 1084, 542, 0, 6456, 6457, 5, 302, 0, 0, 6457, 6458, 5, 94, 0, 0, 6458, 6459, 3, 1352, 676, 0, 6459, 6782, 1, 0, 0, 0, 6460, 6461, 5, 138, 0, 0, 6461, 6462, 5, 92, 0, 0, 6462, 6463, 5, 220, 0, 0, 6463, 6464, 5, 390, 0, 0, 6464, 6465, 3, 1084, 542, 0, 6465, 6466, 5, 302, 0, 0, 6466, 6467, 5, 94, 0, 0, 6467, 6468, 3, 1352, 676, 0, 6468, 6782, 1, 0, 0, 0, 6469, 6470, 5, 138, 0, 0, 6470, 6471, 5, 321, 0, 0, 6471, 6472, 3, 1348, 674, 0, 6472, 6473, 5, 302, 0, 0, 6473, 6474, 5, 94, 0, 0, 6474, 6475, 3, 1352, 676, 0, 6475, 6782, 1, 0, 0, 0, 6476, 6477, 5, 138, 0, 0, 6477, 6478, 5, 321, 0, 0, 6478, 6479, 5, 220, 0, 0, 6479, 6480, 5, 390, 0, 0, 6480, 6481, 3, 1348, 674, 0, 6481, 6482, 5, 302, 0, 0, 6482, 6483, 5, 94, 0, 0, 6483, 6484, 3, 1352, 676, 0, 6484, 6782, 1, 0, 0, 0, 6485, 6486, 5, 138, 0, 0, 6486, 6487, 5, 369, 0, 0, 6487, 6488, 3, 1348, 674, 0, 6488, 6489, 5, 302, 0, 0, 6489, 6490, 5, 94, 0, 0, 6490, 6491, 3, 1352, 676, 0, 6491, 6782, 1, 0, 0, 0, 6492, 6493, 5, 138, 0, 0, 6493, 6494, 5, 369, 0, 0, 6494, 6495, 5, 220, 0, 0, 6495, 6496, 5, 390, 0, 0, 6496, 6497, 3, 1348, 674, 0, 6497, 6498, 5, 302, 0, 0, 6498, 6499, 5, 94, 0, 0, 6499, 6500, 3, 1352, 676, 0, 6500, 6782, 1, 0, 0, 0, 6501, 6502, 5, 138, 0, 0, 6502, 6503, 5, 251, 0, 0, 6503, 6504, 5, 369, 0, 0, 6504, 6505, 3, 1348, 674, 0, 6505, 6506, 5, 302, 0, 0, 6506, 6507, 5, 94, 0, 0, 6507, 6508, 3, 1352, 676, 0, 6508, 6782, 1, 0, 0, 0, 6509, 6510, 5, 138, 0, 0, 6510, 6511, 5, 251, 0, 0, 6511, 6512, 5, 369, 0, 0, 6512, 6513, 5, 220, 0, 0, 6513, 6514, 5, 390, 0, 0, 6514, 6515, 3, 1348, 674, 0, 6515, 6516, 5, 302, 0, 0, 6516, 6517, 5, 94, 0, 0, 6517, 6518, 3, 1352, 676, 0, 6518, 6782, 1, 0, 0, 0, 6519, 6520, 5, 138, 0, 0, 6520, 6521, 5, 226, 0, 0, 6521, 6522, 3, 1348, 674, 0, 6522, 6523, 5, 302, 0, 0, 6523, 6524, 5, 94, 0, 0, 6524, 6525, 3, 1352, 676, 0, 6525, 6782, 1, 0, 0, 0, 6526, 6527, 5, 138, 0, 0, 6527, 6528, 5, 226, 0, 0, 6528, 6529, 5, 220, 0, 0, 6529, 6530, 5, 390, 0, 0, 6530, 6531, 3, 1348, 674, 0, 6531, 6532, 5, 302, 0, 0, 6532, 6533, 5, 94, 0, 0, 6533, 6534, 3, 1352, 676, 0, 6534, 6782, 1, 0, 0, 0, 6535, 6536, 5, 138, 0, 0, 6536, 6537, 5, 63, 0, 0, 6537, 6538, 5, 92, 0, 0, 6538, 6539, 3, 1084, 542, 0, 6539, 6540, 5, 302, 0, 0, 6540, 6541, 5, 94, 0, 0, 6541, 6542, 3, 1352, 676, 0, 6542, 6782, 1, 0, 0, 0, 6543, 6544, 5, 138, 0, 0, 6544, 6545, 5, 63, 0, 0, 6545, 6546, 5, 92, 0, 0, 6546, 6547, 5, 220, 0, 0, 6547, 6548, 5, 390, 0, 0, 6548, 6549, 3, 1084, 542, 0, 6549, 6550, 5, 302, 0, 0, 6550, 6551, 5, 94, 0, 0, 6551, 6552, 3, 1352, 676, 0, 6552, 6782, 1, 0, 0, 0, 6553, 6554, 5, 138, 0, 0, 6554, 6555, 5, 92, 0, 0, 6555, 6556, 3, 1084, 542, 0, 6556, 6558, 5, 302, 0, 0, 6557, 6559, 3, 732, 366, 0, 6558, 6557, 1, 0, 0, 0, 6558, 6559, 1, 0, 0, 0, 6559, 6560, 1, 0, 0, 0, 6560, 6561, 3, 1352, 676, 0, 6561, 6562, 5, 94, 0, 0, 6562, 6563, 3, 1352, 676, 0, 6563, 6782, 1, 0, 0, 0, 6564, 6565, 5, 138, 0, 0, 6565, 6566, 5, 92, 0, 0, 6566, 6567, 5, 220, 0, 0, 6567, 6568, 5, 390, 0, 0, 6568, 6569, 3, 1084, 542, 0, 6569, 6571, 5, 302, 0, 0, 6570, 6572, 3, 732, 366, 0, 6571, 6570, 1, 0, 0, 0, 6571, 6572, 1, 0, 0, 0, 6572, 6573, 1, 0, 0, 0, 6573, 6574, 3, 1352, 676, 0, 6574, 6575, 5, 94, 0, 0, 6575, 6576, 3, 1352, 676, 0, 6576, 6782, 1, 0, 0, 0, 6577, 6578, 5, 138, 0, 0, 6578, 6579, 5, 369, 0, 0, 6579, 6580, 3, 1348, 674, 0, 6580, 6582, 5, 302, 0, 0, 6581, 6583, 3, 732, 366, 0, 6582, 6581, 1, 0, 0, 0, 6582, 6583, 1, 0, 0, 0, 6583, 6584, 1, 0, 0, 0, 6584, 6585, 3, 1352, 676, 0, 6585, 6586, 5, 94, 0, 0, 6586, 6587, 3, 1352, 676, 0, 6587, 6782, 1, 0, 0, 0, 6588, 6589, 5, 138, 0, 0, 6589, 6590, 5, 369, 0, 0, 6590, 6591, 5, 220, 0, 0, 6591, 6592, 5, 390, 0, 0, 6592, 6593, 3, 1348, 674, 0, 6593, 6595, 5, 302, 0, 0, 6594, 6596, 3, 732, 366, 0, 6595, 6594, 1, 0, 0, 0, 6595, 6596, 1, 0, 0, 0, 6596, 6597, 1, 0, 0, 0, 6597, 6598, 3, 1352, 676, 0, 6598, 6599, 5, 94, 0, 0, 6599, 6600, 3, 1352, 676, 0, 6600, 6782, 1, 0, 0, 0, 6601, 6602, 5, 138, 0, 0, 6602, 6603, 5, 251, 0, 0, 6603, 6604, 5, 369, 0, 0, 6604, 6605, 3, 1348, 674, 0, 6605, 6607, 5, 302, 0, 0, 6606, 6608, 3, 732, 366, 0, 6607, 6606, 1, 0, 0, 0, 6607, 6608, 1, 0, 0, 0, 6608, 6609, 1, 0, 0, 0, 6609, 6610, 3, 1352, 676, 0, 6610, 6611, 5, 94, 0, 0, 6611, 6612, 3, 1352, 676, 0, 6612, 6782, 1, 0, 0, 0, 6613, 6614, 5, 138, 0, 0, 6614, 6615, 5, 251, 0, 0, 6615, 6616, 5, 369, 0, 0, 6616, 6617, 5, 220, 0, 0, 6617, 6618, 5, 390, 0, 0, 6618, 6619, 3, 1348, 674, 0, 6619, 6621, 5, 302, 0, 0, 6620, 6622, 3, 732, 366, 0, 6621, 6620, 1, 0, 0, 0, 6621, 6622, 1, 0, 0, 0, 6622, 6623, 1, 0, 0, 0, 6623, 6624, 3, 1352, 676, 0, 6624, 6625, 5, 94, 0, 0, 6625, 6626, 3, 1352, 676, 0, 6626, 6782, 1, 0, 0, 0, 6627, 6628, 5, 138, 0, 0, 6628, 6629, 5, 92, 0, 0, 6629, 6630, 3, 1084, 542, 0, 6630, 6631, 5, 302, 0, 0, 6631, 6632, 5, 45, 0, 0, 6632, 6633, 3, 1352, 676, 0, 6633, 6634, 5, 94, 0, 0, 6634, 6635, 3, 1352, 676, 0, 6635, 6782, 1, 0, 0, 0, 6636, 6637, 5, 138, 0, 0, 6637, 6638, 5, 92, 0, 0, 6638, 6639, 5, 220, 0, 0, 6639, 6640, 5, 390, 0, 0, 6640, 6641, 3, 1084, 542, 0, 6641, 6642, 5, 302, 0, 0, 6642, 6643, 5, 45, 0, 0, 6643, 6644, 3, 1352, 676, 0, 6644, 6645, 5, 94, 0, 0, 6645, 6646, 3, 1352, 676, 0, 6646, 6782, 1, 0, 0, 0, 6647, 6648, 5, 138, 0, 0, 6648, 6649, 5, 63, 0, 0, 6649, 6650, 5, 92, 0, 0, 6650, 6651, 3, 1084, 542, 0, 6651, 6653, 5, 302, 0, 0, 6652, 6654, 3, 732, 366, 0, 6653, 6652, 1, 0, 0, 0, 6653, 6654, 1, 0, 0, 0, 6654, 6655, 1, 0, 0, 0, 6655, 6656, 3, 1352, 676, 0, 6656, 6657, 5, 94, 0, 0, 6657, 6658, 3, 1352, 676, 0, 6658, 6782, 1, 0, 0, 0, 6659, 6660, 5, 138, 0, 0, 6660, 6661, 5, 63, 0, 0, 6661, 6662, 5, 92, 0, 0, 6662, 6663, 5, 220, 0, 0, 6663, 6664, 5, 390, 0, 0, 6664, 6665, 3, 1084, 542, 0, 6665, 6667, 5, 302, 0, 0, 6666, 6668, 3, 732, 366, 0, 6667, 6666, 1, 0, 0, 0, 6667, 6668, 1, 0, 0, 0, 6668, 6669, 1, 0, 0, 0, 6669, 6670, 3, 1352, 676, 0, 6670, 6671, 5, 94, 0, 0, 6671, 6672, 3, 1352, 676, 0, 6672, 6782, 1, 0, 0, 0, 6673, 6674, 5, 138, 0, 0, 6674, 6675, 5, 314, 0, 0, 6675, 6676, 3, 1352, 676, 0, 6676, 6677, 5, 80, 0, 0, 6677, 6678, 3, 1348, 674, 0, 6678, 6679, 5, 302, 0, 0, 6679, 6680, 5, 94, 0, 0, 6680, 6681, 3, 1352, 676, 0, 6681, 6782, 1, 0, 0, 0, 6682, 6683, 5, 138, 0, 0, 6683, 6684, 5, 350, 0, 0, 6684, 6685, 3, 1352, 676, 0, 6685, 6686, 5, 80, 0, 0, 6686, 6687, 3, 1348, 674, 0, 6687, 6688, 5, 302, 0, 0, 6688, 6689, 5, 94, 0, 0, 6689, 6690, 3, 1352, 676, 0, 6690, 6782, 1, 0, 0, 0, 6691, 6692, 5, 138, 0, 0, 6692, 6693, 5, 198, 0, 0, 6693, 6694, 5, 350, 0, 0, 6694, 6695, 3, 1352, 676, 0, 6695, 6696, 5, 302, 0, 0, 6696, 6697, 5, 94, 0, 0, 6697, 6698, 3, 1352, 676, 0, 6698, 6782, 1, 0, 0, 0, 6699, 6700, 5, 138, 0, 0, 6700, 6701, 5, 311, 0, 0, 6701, 6702, 3, 1378, 689, 0, 6702, 6703, 5, 302, 0, 0, 6703, 6704, 5, 94, 0, 0, 6704, 6705, 3, 1378, 689, 0, 6705, 6782, 1, 0, 0, 0, 6706, 6707, 5, 138, 0, 0, 6707, 6708, 5, 99, 0, 0, 6708, 6709, 3, 1378, 689, 0, 6709, 6710, 5, 302, 0, 0, 6710, 6711, 5, 94, 0, 0, 6711, 6712, 3, 1378, 689, 0, 6712, 6782, 1, 0, 0, 0, 6713, 6714, 5, 138, 0, 0, 6714, 6715, 5, 344, 0, 0, 6715, 6716, 3, 1352, 676, 0, 6716, 6717, 5, 302, 0, 0, 6717, 6718, 5, 94, 0, 0, 6718, 6719, 3, 1352, 676, 0, 6719, 6782, 1, 0, 0, 0, 6720, 6721, 5, 138, 0, 0, 6721, 6722, 5, 335, 0, 0, 6722, 6723, 3, 528, 264, 0, 6723, 6724, 5, 302, 0, 0, 6724, 6725, 5, 94, 0, 0, 6725, 6726, 3, 1352, 676, 0, 6726, 6782, 1, 0, 0, 0, 6727, 6728, 5, 138, 0, 0, 6728, 6729, 5, 348, 0, 0, 6729, 6730, 5, 318, 0, 0, 6730, 6731, 5, 276, 0, 0, 6731, 6732, 3, 528, 264, 0, 6732, 6733, 5, 302, 0, 0, 6733, 6734, 5, 94, 0, 0, 6734, 6735, 3, 1352, 676, 0, 6735, 6782, 1, 0, 0, 0, 6736, 6737, 5, 138, 0, 0, 6737, 6738, 5, 348, 0, 0, 6738, 6739, 5, 318, 0, 0, 6739, 6740, 5, 185, 0, 0, 6740, 6741, 3, 528, 264, 0, 6741, 6742, 5, 302, 0, 0, 6742, 6743, 5, 94, 0, 0, 6743, 6744, 3, 1352, 676, 0, 6744, 6782, 1, 0, 0, 0, 6745, 6746, 5, 138, 0, 0, 6746, 6747, 5, 348, 0, 0, 6747, 6748, 5, 318, 0, 0, 6748, 6749, 5, 346, 0, 0, 6749, 6750, 3, 528, 264, 0, 6750, 6751, 5, 302, 0, 0, 6751, 6752, 5, 94, 0, 0, 6752, 6753, 3, 1352, 676, 0, 6753, 6782, 1, 0, 0, 0, 6754, 6755, 5, 138, 0, 0, 6755, 6756, 5, 348, 0, 0, 6756, 6757, 5, 318, 0, 0, 6757, 6758, 5, 163, 0, 0, 6758, 6759, 3, 528, 264, 0, 6759, 6760, 5, 302, 0, 0, 6760, 6761, 5, 94, 0, 0, 6761, 6762, 3, 1352, 676, 0, 6762, 6782, 1, 0, 0, 0, 6763, 6764, 5, 138, 0, 0, 6764, 6765, 5, 353, 0, 0, 6765, 6766, 3, 528, 264, 0, 6766, 6767, 5, 302, 0, 0, 6767, 6768, 5, 94, 0, 0, 6768, 6769, 3, 1352, 676, 0, 6769, 6782, 1, 0, 0, 0, 6770, 6771, 5, 138, 0, 0, 6771, 6772, 5, 353, 0, 0, 6772, 6773, 3, 528, 264, 0, 6773, 6774, 5, 302, 0, 0, 6774, 6775, 5, 143, 0, 0, 6775, 6776, 3, 1352, 676, 0, 6776, 6777, 5, 94, 0, 0, 6777, 6779, 3, 1352, 676, 0, 6778, 6780, 3, 108, 54, 0, 6779, 6778, 1, 0, 0, 0, 6779, 6780, 1, 0, 0, 0, 6780, 6782, 1, 0, 0, 0, 6781, 6294, 1, 0, 0, 0, 6781, 6301, 1, 0, 0, 0, 6781, 6308, 1, 0, 0, 0, 6781, 6315, 1, 0, 0, 0, 6781, 6322, 1, 0, 0, 0, 6781, 6329, 1, 0, 0, 0, 6781, 6338, 1, 0, 0, 0, 6781, 6347, 1, 0, 0, 0, 6781, 6354, 1, 0, 0, 0, 6781, 6361, 1, 0, 0, 0, 6781, 6371, 1, 0, 0, 0, 6781, 6381, 1, 0, 0, 0, 6781, 6391, 1, 0, 0, 0, 6781, 6400, 1, 0, 0, 0, 6781, 6411, 1, 0, 0, 0, 6781, 6418, 1, 0, 0, 0, 6781, 6425, 1, 0, 0, 0, 6781, 6432, 1, 0, 0, 0, 6781, 6439, 1, 0, 0, 0, 6781, 6446, 1, 0, 0, 0, 6781, 6453, 1, 0, 0, 0, 6781, 6460, 1, 0, 0, 0, 6781, 6469, 1, 0, 0, 0, 6781, 6476, 1, 0, 0, 0, 6781, 6485, 1, 0, 0, 0, 6781, 6492, 1, 0, 0, 0, 6781, 6501, 1, 0, 0, 0, 6781, 6509, 1, 0, 0, 0, 6781, 6519, 1, 0, 0, 0, 6781, 6526, 1, 0, 0, 0, 6781, 6535, 1, 0, 0, 0, 6781, 6543, 1, 0, 0, 0, 6781, 6553, 1, 0, 0, 0, 6781, 6564, 1, 0, 0, 0, 6781, 6577, 1, 0, 0, 0, 6781, 6588, 1, 0, 0, 0, 6781, 6601, 1, 0, 0, 0, 6781, 6613, 1, 0, 0, 0, 6781, 6627, 1, 0, 0, 0, 6781, 6636, 1, 0, 0, 0, 6781, 6647, 1, 0, 0, 0, 6781, 6659, 1, 0, 0, 0, 6781, 6673, 1, 0, 0, 0, 6781, 6682, 1, 0, 0, 0, 6781, 6691, 1, 0, 0, 0, 6781, 6699, 1, 0, 0, 0, 6781, 6706, 1, 0, 0, 0, 6781, 6713, 1, 0, 0, 0, 6781, 6720, 1, 0, 0, 0, 6781, 6727, 1, 0, 0, 0, 6781, 6736, 1, 0, 0, 0, 6781, 6745, 1, 0, 0, 0, 6781, 6754, 1, 0, 0, 0, 6781, 6763, 1, 0, 0, 0, 6781, 6770, 1, 0, 0, 0, 6782, 731, 1, 0, 0, 0, 6783, 6784, 5, 44, 0, 0, 6784, 733, 1, 0, 0, 0, 6785, 6786, 5, 326, 0, 0, 6786, 6787, 5, 174, 0, 0, 6787, 735, 1, 0, 0, 0, 6788, 6789, 5, 138, 0, 0, 6789, 6790, 5, 211, 0, 0, 6790, 6792, 3, 634, 317, 0, 6791, 6793, 3, 738, 369, 0, 6792, 6791, 1, 0, 0, 0, 6792, 6793, 1, 0, 0, 0, 6793, 6794, 1, 0, 0, 0, 6794, 6795, 5, 464, 0, 0, 6795, 6796, 5, 80, 0, 0, 6796, 6797, 5, 204, 0, 0, 6797, 6798, 3, 1352, 676, 0, 6798, 6858, 1, 0, 0, 0, 6799, 6800, 5, 138, 0, 0, 6800, 6801, 5, 289, 0, 0, 6801, 6803, 3, 634, 317, 0, 6802, 6804, 3, 738, 369, 0, 6803, 6802, 1, 0, 0, 0, 6803, 6804, 1, 0, 0, 0, 6804, 6805, 1, 0, 0, 0, 6805, 6806, 5, 464, 0, 0, 6806, 6807, 5, 80, 0, 0, 6807, 6808, 5, 204, 0, 0, 6808, 6809, 3, 1352, 676, 0, 6809, 6858, 1, 0, 0, 0, 6810, 6811, 5, 138, 0, 0, 6811, 6812, 5, 444, 0, 0, 6812, 6814, 3, 634, 317, 0, 6813, 6815, 3, 738, 369, 0, 6814, 6813, 1, 0, 0, 0, 6814, 6815, 1, 0, 0, 0, 6815, 6816, 1, 0, 0, 0, 6816, 6817, 5, 464, 0, 0, 6817, 6818, 5, 80, 0, 0, 6818, 6819, 5, 204, 0, 0, 6819, 6820, 3, 1352, 676, 0, 6820, 6858, 1, 0, 0, 0, 6821, 6822, 5, 138, 0, 0, 6822, 6823, 5, 350, 0, 0, 6823, 6824, 3, 1352, 676, 0, 6824, 6825, 5, 80, 0, 0, 6825, 6827, 3, 1348, 674, 0, 6826, 6828, 3, 738, 369, 0, 6827, 6826, 1, 0, 0, 0, 6827, 6828, 1, 0, 0, 0, 6828, 6829, 1, 0, 0, 0, 6829, 6830, 5, 464, 0, 0, 6830, 6831, 5, 80, 0, 0, 6831, 6832, 5, 204, 0, 0, 6832, 6833, 3, 1352, 676, 0, 6833, 6858, 1, 0, 0, 0, 6834, 6835, 5, 138, 0, 0, 6835, 6836, 5, 251, 0, 0, 6836, 6837, 5, 369, 0, 0, 6837, 6839, 3, 1348, 674, 0, 6838, 6840, 3, 738, 369, 0, 6839, 6838, 1, 0, 0, 0, 6839, 6840, 1, 0, 0, 0, 6840, 6841, 1, 0, 0, 0, 6841, 6842, 5, 464, 0, 0, 6842, 6843, 5, 80, 0, 0, 6843, 6844, 5, 204, 0, 0, 6844, 6845, 3, 1352, 676, 0, 6845, 6858, 1, 0, 0, 0, 6846, 6847, 5, 138, 0, 0, 6847, 6848, 5, 226, 0, 0, 6848, 6850, 3, 1348, 674, 0, 6849, 6851, 3, 738, 369, 0, 6850, 6849, 1, 0, 0, 0, 6850, 6851, 1, 0, 0, 0, 6851, 6852, 1, 0, 0, 0, 6852, 6853, 5, 464, 0, 0, 6853, 6854, 5, 80, 0, 0, 6854, 6855, 5, 204, 0, 0, 6855, 6856, 3, 1352, 676, 0, 6856, 6858, 1, 0, 0, 0, 6857, 6788, 1, 0, 0, 0, 6857, 6799, 1, 0, 0, 0, 6857, 6810, 1, 0, 0, 0, 6857, 6821, 1, 0, 0, 0, 6857, 6834, 1, 0, 0, 0, 6857, 6846, 1, 0, 0, 0, 6858, 737, 1, 0, 0, 0, 6859, 6860, 5, 262, 0, 0, 6860, 739, 1, 0, 0, 0, 6861, 6862, 5, 138, 0, 0, 6862, 6863, 5, 136, 0, 0, 6863, 6864, 3, 658, 329, 0, 6864, 6865, 5, 326, 0, 0, 6865, 6866, 5, 316, 0, 0, 6866, 6867, 3, 1352, 676, 0, 6867, 7079, 1, 0, 0, 0, 6868, 6869, 5, 138, 0, 0, 6869, 6870, 5, 108, 0, 0, 6870, 6871, 3, 528, 264, 0, 6871, 6872, 5, 326, 0, 0, 6872, 6873, 5, 316, 0, 0, 6873, 6874, 3, 1352, 676, 0, 6874, 7079, 1, 0, 0, 0, 6875, 6876, 5, 138, 0, 0, 6876, 6877, 5, 168, 0, 0, 6877, 6878, 3, 528, 264, 0, 6878, 6879, 5, 326, 0, 0, 6879, 6880, 5, 316, 0, 0, 6880, 6881, 3, 1352, 676, 0, 6881, 7079, 1, 0, 0, 0, 6882, 6883, 5, 138, 0, 0, 6883, 6884, 5, 189, 0, 0, 6884, 6885, 3, 528, 264, 0, 6885, 6886, 5, 326, 0, 0, 6886, 6887, 5, 316, 0, 0, 6887, 6888, 3, 1352, 676, 0, 6888, 7079, 1, 0, 0, 0, 6889, 6890, 5, 138, 0, 0, 6890, 6891, 5, 204, 0, 0, 6891, 6892, 3, 1352, 676, 0, 6892, 6893, 5, 326, 0, 0, 6893, 6894, 5, 316, 0, 0, 6894, 6895, 3, 1352, 676, 0, 6895, 7079, 1, 0, 0, 0, 6896, 6897, 5, 138, 0, 0, 6897, 6898, 5, 211, 0, 0, 6898, 6899, 3, 634, 317, 0, 6899, 6900, 5, 326, 0, 0, 6900, 6901, 5, 316, 0, 0, 6901, 6902, 3, 1352, 676, 0, 6902, 7079, 1, 0, 0, 0, 6903, 6904, 5, 138, 0, 0, 6904, 6905, 5, 271, 0, 0, 6905, 6906, 3, 696, 348, 0, 6906, 6907, 5, 326, 0, 0, 6907, 6908, 5, 316, 0, 0, 6908, 6909, 3, 1352, 676, 0, 6909, 7079, 1, 0, 0, 0, 6910, 6911, 5, 138, 0, 0, 6911, 6912, 5, 271, 0, 0, 6912, 6913, 5, 156, 0, 0, 6913, 6914, 3, 528, 264, 0, 6914, 6915, 5, 100, 0, 0, 6915, 6916, 3, 1352, 676, 0, 6916, 6917, 5, 326, 0, 0, 6917, 6918, 5, 316, 0, 0, 6918, 6919, 3, 1352, 676, 0, 6919, 7079, 1, 0, 0, 0, 6920, 6921, 5, 138, 0, 0, 6921, 6922, 5, 271, 0, 0, 6922, 6923, 5, 206, 0, 0, 6923, 6924, 3, 528, 264, 0, 6924, 6925, 5, 100, 0, 0, 6925, 6926, 3, 1352, 676, 0, 6926, 6927, 5, 326, 0, 0, 6927, 6928, 5, 316, 0, 0, 6928, 6929, 3, 1352, 676, 0, 6929, 7079, 1, 0, 0, 0, 6930, 6931, 5, 138, 0, 0, 6931, 6932, 5, 289, 0, 0, 6932, 6933, 3, 634, 317, 0, 6933, 6934, 5, 326, 0, 0, 6934, 6935, 5, 316, 0, 0, 6935, 6936, 3, 1352, 676, 0, 6936, 7079, 1, 0, 0, 0, 6937, 6938, 5, 138, 0, 0, 6938, 6939, 5, 444, 0, 0, 6939, 6940, 3, 634, 317, 0, 6940, 6941, 5, 326, 0, 0, 6941, 6942, 5, 316, 0, 0, 6942, 6943, 3, 1352, 676, 0, 6943, 7079, 1, 0, 0, 0, 6944, 6945, 5, 138, 0, 0, 6945, 6946, 5, 92, 0, 0, 6946, 6947, 3, 1084, 542, 0, 6947, 6948, 5, 326, 0, 0, 6948, 6949, 5, 316, 0, 0, 6949, 6950, 3, 1352, 676, 0, 6950, 7079, 1, 0, 0, 0, 6951, 6952, 5, 138, 0, 0, 6952, 6953, 5, 92, 0, 0, 6953, 6954, 5, 220, 0, 0, 6954, 6955, 5, 390, 0, 0, 6955, 6956, 3, 1084, 542, 0, 6956, 6957, 5, 326, 0, 0, 6957, 6958, 5, 316, 0, 0, 6958, 6959, 3, 1352, 676, 0, 6959, 7079, 1, 0, 0, 0, 6960, 6961, 5, 138, 0, 0, 6961, 6962, 5, 335, 0, 0, 6962, 6963, 3, 528, 264, 0, 6963, 6964, 5, 326, 0, 0, 6964, 6965, 5, 316, 0, 0, 6965, 6966, 3, 1352, 676, 0, 6966, 7079, 1, 0, 0, 0, 6967, 6968, 5, 138, 0, 0, 6968, 6969, 5, 348, 0, 0, 6969, 6970, 5, 318, 0, 0, 6970, 6971, 5, 276, 0, 0, 6971, 6972, 3, 528, 264, 0, 6972, 6973, 5, 326, 0, 0, 6973, 6974, 5, 316, 0, 0, 6974, 6975, 3, 1352, 676, 0, 6975, 7079, 1, 0, 0, 0, 6976, 6977, 5, 138, 0, 0, 6977, 6978, 5, 348, 0, 0, 6978, 6979, 5, 318, 0, 0, 6979, 6980, 5, 185, 0, 0, 6980, 6981, 3, 528, 264, 0, 6981, 6982, 5, 326, 0, 0, 6982, 6983, 5, 316, 0, 0, 6983, 6984, 3, 1352, 676, 0, 6984, 7079, 1, 0, 0, 0, 6985, 6986, 5, 138, 0, 0, 6986, 6987, 5, 348, 0, 0, 6987, 6988, 5, 318, 0, 0, 6988, 6989, 5, 346, 0, 0, 6989, 6990, 3, 528, 264, 0, 6990, 6991, 5, 326, 0, 0, 6991, 6992, 5, 316, 0, 0, 6992, 6993, 3, 1352, 676, 0, 6993, 7079, 1, 0, 0, 0, 6994, 6995, 5, 138, 0, 0, 6995, 6996, 5, 348, 0, 0, 6996, 6997, 5, 318, 0, 0, 6997, 6998, 5, 163, 0, 0, 6998, 6999, 3, 528, 264, 0, 6999, 7000, 5, 326, 0, 0, 7000, 7001, 5, 316, 0, 0, 7001, 7002, 3, 1352, 676, 0, 7002, 7079, 1, 0, 0, 0, 7003, 7004, 5, 138, 0, 0, 7004, 7005, 5, 321, 0, 0, 7005, 7006, 3, 1348, 674, 0, 7006, 7007, 5, 326, 0, 0, 7007, 7008, 5, 316, 0, 0, 7008, 7009, 3, 1352, 676, 0, 7009, 7079, 1, 0, 0, 0, 7010, 7011, 5, 138, 0, 0, 7011, 7012, 5, 321, 0, 0, 7012, 7013, 5, 220, 0, 0, 7013, 7014, 5, 390, 0, 0, 7014, 7015, 3, 1348, 674, 0, 7015, 7016, 5, 326, 0, 0, 7016, 7017, 5, 316, 0, 0, 7017, 7018, 3, 1352, 676, 0, 7018, 7079, 1, 0, 0, 0, 7019, 7020, 5, 138, 0, 0, 7020, 7021, 5, 369, 0, 0, 7021, 7022, 3, 1348, 674, 0, 7022, 7023, 5, 326, 0, 0, 7023, 7024, 5, 316, 0, 0, 7024, 7025, 3, 1352, 676, 0, 7025, 7079, 1, 0, 0, 0, 7026, 7027, 5, 138, 0, 0, 7027, 7028, 5, 369, 0, 0, 7028, 7029, 5, 220, 0, 0, 7029, 7030, 5, 390, 0, 0, 7030, 7031, 3, 1348, 674, 0, 7031, 7032, 5, 326, 0, 0, 7032, 7033, 5, 316, 0, 0, 7033, 7034, 3, 1352, 676, 0, 7034, 7079, 1, 0, 0, 0, 7035, 7036, 5, 138, 0, 0, 7036, 7037, 5, 251, 0, 0, 7037, 7038, 5, 369, 0, 0, 7038, 7039, 3, 1348, 674, 0, 7039, 7040, 5, 326, 0, 0, 7040, 7041, 5, 316, 0, 0, 7041, 7042, 3, 1352, 676, 0, 7042, 7079, 1, 0, 0, 0, 7043, 7044, 5, 138, 0, 0, 7044, 7045, 5, 251, 0, 0, 7045, 7046, 5, 369, 0, 0, 7046, 7047, 5, 220, 0, 0, 7047, 7048, 5, 390, 0, 0, 7048, 7049, 3, 1348, 674, 0, 7049, 7050, 5, 326, 0, 0, 7050, 7051, 5, 316, 0, 0, 7051, 7052, 3, 1352, 676, 0, 7052, 7079, 1, 0, 0, 0, 7053, 7054, 5, 138, 0, 0, 7054, 7055, 5, 63, 0, 0, 7055, 7056, 5, 92, 0, 0, 7056, 7057, 3, 1084, 542, 0, 7057, 7058, 5, 326, 0, 0, 7058, 7059, 5, 316, 0, 0, 7059, 7060, 3, 1352, 676, 0, 7060, 7079, 1, 0, 0, 0, 7061, 7062, 5, 138, 0, 0, 7062, 7063, 5, 63, 0, 0, 7063, 7064, 5, 92, 0, 0, 7064, 7065, 5, 220, 0, 0, 7065, 7066, 5, 390, 0, 0, 7066, 7067, 3, 1084, 542, 0, 7067, 7068, 5, 326, 0, 0, 7068, 7069, 5, 316, 0, 0, 7069, 7070, 3, 1352, 676, 0, 7070, 7079, 1, 0, 0, 0, 7071, 7072, 5, 138, 0, 0, 7072, 7073, 5, 353, 0, 0, 7073, 7074, 3, 528, 264, 0, 7074, 7075, 5, 326, 0, 0, 7075, 7076, 5, 316, 0, 0, 7076, 7077, 3, 1352, 676, 0, 7077, 7079, 1, 0, 0, 0, 7078, 6861, 1, 0, 0, 0, 7078, 6868, 1, 0, 0, 0, 7078, 6875, 1, 0, 0, 0, 7078, 6882, 1, 0, 0, 0, 7078, 6889, 1, 0, 0, 0, 7078, 6896, 1, 0, 0, 0, 7078, 6903, 1, 0, 0, 0, 7078, 6910, 1, 0, 0, 0, 7078, 6920, 1, 0, 0, 0, 7078, 6930, 1, 0, 0, 0, 7078, 6937, 1, 0, 0, 0, 7078, 6944, 1, 0, 0, 0, 7078, 6951, 1, 0, 0, 0, 7078, 6960, 1, 0, 0, 0, 7078, 6967, 1, 0, 0, 0, 7078, 6976, 1, 0, 0, 0, 7078, 6985, 1, 0, 0, 0, 7078, 6994, 1, 0, 0, 0, 7078, 7003, 1, 0, 0, 0, 7078, 7010, 1, 0, 0, 0, 7078, 7019, 1, 0, 0, 0, 7078, 7026, 1, 0, 0, 0, 7078, 7035, 1, 0, 0, 0, 7078, 7043, 1, 0, 0, 0, 7078, 7053, 1, 0, 0, 0, 7078, 7061, 1, 0, 0, 0, 7078, 7071, 1, 0, 0, 0, 7079, 741, 1, 0, 0, 0, 7080, 7081, 5, 138, 0, 0, 7081, 7082, 5, 271, 0, 0, 7082, 7083, 3, 696, 348, 0, 7083, 7084, 5, 326, 0, 0, 7084, 7085, 5, 2, 0, 0, 7085, 7086, 3, 744, 372, 0, 7086, 7087, 5, 3, 0, 0, 7087, 743, 1, 0, 0, 0, 7088, 7093, 3, 746, 373, 0, 7089, 7090, 5, 6, 0, 0, 7090, 7092, 3, 746, 373, 0, 7091, 7089, 1, 0, 0, 0, 7092, 7095, 1, 0, 0, 0, 7093, 7091, 1, 0, 0, 0, 7093, 7094, 1, 0, 0, 0, 7094, 745, 1, 0, 0, 0, 7095, 7093, 1, 0, 0, 0, 7096, 7097, 3, 1392, 696, 0, 7097, 7098, 5, 10, 0, 0, 7098, 7099, 5, 401, 0, 0, 7099, 7105, 1, 0, 0, 0, 7100, 7101, 3, 1392, 696, 0, 7101, 7102, 5, 10, 0, 0, 7102, 7103, 3, 748, 374, 0, 7103, 7105, 1, 0, 0, 0, 7104, 7096, 1, 0, 0, 0, 7104, 7100, 1, 0, 0, 0, 7105, 747, 1, 0, 0, 0, 7106, 7112, 3, 648, 324, 0, 7107, 7112, 3, 1404, 702, 0, 7108, 7112, 3, 1286, 643, 0, 7109, 7112, 3, 296, 148, 0, 7110, 7112, 3, 1370, 685, 0, 7111, 7106, 1, 0, 0, 0, 7111, 7107, 1, 0, 0, 0, 7111, 7108, 1, 0, 0, 0, 7111, 7109, 1, 0, 0, 0, 7111, 7110, 1, 0, 0, 0, 7112, 749, 1, 0, 0, 0, 7113, 7114, 5, 138, 0, 0, 7114, 7115, 5, 353, 0, 0, 7115, 7116, 3, 528, 264, 0, 7116, 7117, 5, 326, 0, 0, 7117, 7118, 5, 2, 0, 0, 7118, 7119, 3, 744, 372, 0, 7119, 7120, 5, 3, 0, 0, 7120, 751, 1, 0, 0, 0, 7121, 7122, 5, 138, 0, 0, 7122, 7123, 5, 136, 0, 0, 7123, 7124, 3, 658, 329, 0, 7124, 7125, 5, 275, 0, 0, 7125, 7126, 5, 94, 0, 0, 7126, 7127, 3, 1380, 690, 0, 7127, 7307, 1, 0, 0, 0, 7128, 7129, 5, 138, 0, 0, 7129, 7130, 5, 108, 0, 0, 7130, 7131, 3, 528, 264, 0, 7131, 7132, 5, 275, 0, 0, 7132, 7133, 5, 94, 0, 0, 7133, 7134, 3, 1380, 690, 0, 7134, 7307, 1, 0, 0, 0, 7135, 7136, 5, 138, 0, 0, 7136, 7137, 5, 168, 0, 0, 7137, 7138, 3, 528, 264, 0, 7138, 7139, 5, 275, 0, 0, 7139, 7140, 5, 94, 0, 0, 7140, 7141, 3, 1380, 690, 0, 7141, 7307, 1, 0, 0, 0, 7142, 7143, 5, 138, 0, 0, 7143, 7144, 5, 175, 0, 0, 7144, 7145, 3, 1352, 676, 0, 7145, 7146, 5, 275, 0, 0, 7146, 7147, 5, 94, 0, 0, 7147, 7148, 3, 1380, 690, 0, 7148, 7307, 1, 0, 0, 0, 7149, 7150, 5, 138, 0, 0, 7150, 7151, 5, 189, 0, 0, 7151, 7152, 3, 528, 264, 0, 7152, 7153, 5, 275, 0, 0, 7153, 7154, 5, 94, 0, 0, 7154, 7155, 3, 1380, 690, 0, 7155, 7307, 1, 0, 0, 0, 7156, 7157, 5, 138, 0, 0, 7157, 7158, 5, 211, 0, 0, 7158, 7159, 3, 634, 317, 0, 7159, 7160, 5, 275, 0, 0, 7160, 7161, 5, 94, 0, 0, 7161, 7162, 3, 1380, 690, 0, 7162, 7307, 1, 0, 0, 0, 7163, 7165, 5, 138, 0, 0, 7164, 7166, 3, 312, 156, 0, 7165, 7164, 1, 0, 0, 0, 7165, 7166, 1, 0, 0, 0, 7166, 7167, 1, 0, 0, 0, 7167, 7168, 5, 238, 0, 0, 7168, 7169, 3, 1352, 676, 0, 7169, 7170, 5, 275, 0, 0, 7170, 7171, 5, 94, 0, 0, 7171, 7172, 3, 1380, 690, 0, 7172, 7307, 1, 0, 0, 0, 7173, 7174, 5, 138, 0, 0, 7174, 7175, 5, 239, 0, 0, 7175, 7176, 5, 267, 0, 0, 7176, 7177, 3, 296, 148, 0, 7177, 7178, 5, 275, 0, 0, 7178, 7179, 5, 94, 0, 0, 7179, 7180, 3, 1380, 690, 0, 7180, 7307, 1, 0, 0, 0, 7181, 7182, 5, 138, 0, 0, 7182, 7183, 5, 271, 0, 0, 7183, 7184, 3, 696, 348, 0, 7184, 7185, 5, 275, 0, 0, 7185, 7186, 5, 94, 0, 0, 7186, 7187, 3, 1380, 690, 0, 7187, 7307, 1, 0, 0, 0, 7188, 7189, 5, 138, 0, 0, 7189, 7190, 5, 271, 0, 0, 7190, 7191, 5, 156, 0, 0, 7191, 7192, 3, 528, 264, 0, 7192, 7193, 5, 100, 0, 0, 7193, 7194, 3, 1352, 676, 0, 7194, 7195, 5, 275, 0, 0, 7195, 7196, 5, 94, 0, 0, 7196, 7197, 3, 1380, 690, 0, 7197, 7307, 1, 0, 0, 0, 7198, 7199, 5, 138, 0, 0, 7199, 7200, 5, 271, 0, 0, 7200, 7201, 5, 206, 0, 0, 7201, 7202, 3, 528, 264, 0, 7202, 7203, 5, 100, 0, 0, 7203, 7204, 3, 1352, 676, 0, 7204, 7205, 5, 275, 0, 0, 7205, 7206, 5, 94, 0, 0, 7206, 7207, 3, 1380, 690, 0, 7207, 7307, 1, 0, 0, 0, 7208, 7209, 5, 138, 0, 0, 7209, 7210, 5, 289, 0, 0, 7210, 7211, 3, 634, 317, 0, 7211, 7212, 5, 275, 0, 0, 7212, 7213, 5, 94, 0, 0, 7213, 7214, 3, 1380, 690, 0, 7214, 7307, 1, 0, 0, 0, 7215, 7216, 5, 138, 0, 0, 7216, 7217, 5, 444, 0, 0, 7217, 7218, 3, 634, 317, 0, 7218, 7219, 5, 275, 0, 0, 7219, 7220, 5, 94, 0, 0, 7220, 7221, 3, 1380, 690, 0, 7221, 7307, 1, 0, 0, 0, 7222, 7223, 5, 138, 0, 0, 7223, 7224, 5, 316, 0, 0, 7224, 7225, 3, 1352, 676, 0, 7225, 7226, 5, 275, 0, 0, 7226, 7227, 5, 94, 0, 0, 7227, 7228, 3, 1380, 690, 0, 7228, 7307, 1, 0, 0, 0, 7229, 7230, 5, 138, 0, 0, 7230, 7231, 5, 353, 0, 0, 7231, 7232, 3, 528, 264, 0, 7232, 7233, 5, 275, 0, 0, 7233, 7234, 5, 94, 0, 0, 7234, 7235, 3, 1380, 690, 0, 7235, 7307, 1, 0, 0, 0, 7236, 7237, 5, 138, 0, 0, 7237, 7238, 5, 344, 0, 0, 7238, 7239, 3, 1352, 676, 0, 7239, 7240, 5, 275, 0, 0, 7240, 7241, 5, 94, 0, 0, 7241, 7242, 3, 1380, 690, 0, 7242, 7307, 1, 0, 0, 0, 7243, 7244, 5, 138, 0, 0, 7244, 7245, 5, 335, 0, 0, 7245, 7246, 3, 528, 264, 0, 7246, 7247, 5, 275, 0, 0, 7247, 7248, 5, 94, 0, 0, 7248, 7249, 3, 1380, 690, 0, 7249, 7307, 1, 0, 0, 0, 7250, 7251, 5, 138, 0, 0, 7251, 7252, 5, 348, 0, 0, 7252, 7253, 5, 318, 0, 0, 7253, 7254, 5, 185, 0, 0, 7254, 7255, 3, 528, 264, 0, 7255, 7256, 5, 275, 0, 0, 7256, 7257, 5, 94, 0, 0, 7257, 7258, 3, 1380, 690, 0, 7258, 7307, 1, 0, 0, 0, 7259, 7260, 5, 138, 0, 0, 7260, 7261, 5, 348, 0, 0, 7261, 7262, 5, 318, 0, 0, 7262, 7263, 5, 163, 0, 0, 7263, 7264, 3, 528, 264, 0, 7264, 7265, 5, 275, 0, 0, 7265, 7266, 5, 94, 0, 0, 7266, 7267, 3, 1380, 690, 0, 7267, 7307, 1, 0, 0, 0, 7268, 7269, 5, 138, 0, 0, 7269, 7270, 5, 63, 0, 0, 7270, 7271, 5, 174, 0, 0, 7271, 7272, 5, 374, 0, 0, 7272, 7273, 3, 1352, 676, 0, 7273, 7274, 5, 275, 0, 0, 7274, 7275, 5, 94, 0, 0, 7275, 7276, 3, 1380, 690, 0, 7276, 7307, 1, 0, 0, 0, 7277, 7278, 5, 138, 0, 0, 7278, 7279, 5, 324, 0, 0, 7279, 7280, 3, 1352, 676, 0, 7280, 7281, 5, 275, 0, 0, 7281, 7282, 5, 94, 0, 0, 7282, 7283, 3, 1380, 690, 0, 7283, 7307, 1, 0, 0, 0, 7284, 7285, 5, 138, 0, 0, 7285, 7286, 5, 198, 0, 0, 7286, 7287, 5, 350, 0, 0, 7287, 7288, 3, 1352, 676, 0, 7288, 7289, 5, 275, 0, 0, 7289, 7290, 5, 94, 0, 0, 7290, 7291, 3, 1380, 690, 0, 7291, 7307, 1, 0, 0, 0, 7292, 7293, 5, 138, 0, 0, 7293, 7294, 5, 454, 0, 0, 7294, 7295, 3, 1352, 676, 0, 7295, 7296, 5, 275, 0, 0, 7296, 7297, 5, 94, 0, 0, 7297, 7298, 3, 1380, 690, 0, 7298, 7307, 1, 0, 0, 0, 7299, 7300, 5, 138, 0, 0, 7300, 7301, 5, 453, 0, 0, 7301, 7302, 3, 1352, 676, 0, 7302, 7303, 5, 275, 0, 0, 7303, 7304, 5, 94, 0, 0, 7304, 7305, 3, 1380, 690, 0, 7305, 7307, 1, 0, 0, 0, 7306, 7121, 1, 0, 0, 0, 7306, 7128, 1, 0, 0, 0, 7306, 7135, 1, 0, 0, 0, 7306, 7142, 1, 0, 0, 0, 7306, 7149, 1, 0, 0, 0, 7306, 7156, 1, 0, 0, 0, 7306, 7163, 1, 0, 0, 0, 7306, 7173, 1, 0, 0, 0, 7306, 7181, 1, 0, 0, 0, 7306, 7188, 1, 0, 0, 0, 7306, 7198, 1, 0, 0, 0, 7306, 7208, 1, 0, 0, 0, 7306, 7215, 1, 0, 0, 0, 7306, 7222, 1, 0, 0, 0, 7306, 7229, 1, 0, 0, 0, 7306, 7236, 1, 0, 0, 0, 7306, 7243, 1, 0, 0, 0, 7306, 7250, 1, 0, 0, 0, 7306, 7259, 1, 0, 0, 0, 7306, 7268, 1, 0, 0, 0, 7306, 7277, 1, 0, 0, 0, 7306, 7284, 1, 0, 0, 0, 7306, 7292, 1, 0, 0, 0, 7306, 7299, 1, 0, 0, 0, 7307, 753, 1, 0, 0, 0, 7308, 7309, 5, 46, 0, 0, 7309, 7310, 5, 454, 0, 0, 7310, 7312, 3, 1352, 676, 0, 7311, 7313, 3, 672, 336, 0, 7312, 7311, 1, 0, 0, 0, 7312, 7313, 1, 0, 0, 0, 7313, 7332, 1, 0, 0, 0, 7314, 7315, 5, 46, 0, 0, 7315, 7316, 5, 454, 0, 0, 7316, 7317, 3, 1352, 676, 0, 7317, 7318, 5, 62, 0, 0, 7318, 7319, 5, 30, 0, 0, 7319, 7321, 5, 343, 0, 0, 7320, 7322, 3, 672, 336, 0, 7321, 7320, 1, 0, 0, 0, 7321, 7322, 1, 0, 0, 0, 7322, 7332, 1, 0, 0, 0, 7323, 7324, 5, 46, 0, 0, 7324, 7325, 5, 454, 0, 0, 7325, 7326, 3, 1352, 676, 0, 7326, 7327, 5, 62, 0, 0, 7327, 7329, 3, 756, 378, 0, 7328, 7330, 3, 672, 336, 0, 7329, 7328, 1, 0, 0, 0, 7329, 7330, 1, 0, 0, 0, 7330, 7332, 1, 0, 0, 0, 7331, 7308, 1, 0, 0, 0, 7331, 7314, 1, 0, 0, 0, 7331, 7323, 1, 0, 0, 0, 7332, 755, 1, 0, 0, 0, 7333, 7338, 3, 758, 379, 0, 7334, 7335, 5, 6, 0, 0, 7335, 7337, 3, 758, 379, 0, 7336, 7334, 1, 0, 0, 0, 7337, 7340, 1, 0, 0, 0, 7338, 7336, 1, 0, 0, 0, 7338, 7339, 1, 0, 0, 0, 7339, 757, 1, 0, 0, 0, 7340, 7338, 1, 0, 0, 0, 7341, 7342, 5, 92, 0, 0, 7342, 7344, 3, 1084, 542, 0, 7343, 7345, 3, 218, 109, 0, 7344, 7343, 1, 0, 0, 0, 7344, 7345, 1, 0, 0, 0, 7345, 7347, 1, 0, 0, 0, 7346, 7348, 3, 760, 380, 0, 7347, 7346, 1, 0, 0, 0, 7347, 7348, 1, 0, 0, 0, 7348, 7380, 1, 0, 0, 0, 7349, 7350, 5, 92, 0, 0, 7350, 7351, 5, 68, 0, 0, 7351, 7354, 5, 316, 0, 0, 7352, 7355, 3, 1384, 692, 0, 7353, 7355, 5, 111, 0, 0, 7354, 7352, 1, 0, 0, 0, 7354, 7353, 1, 0, 0, 0, 7355, 7380, 1, 0, 0, 0, 7356, 7358, 3, 1384, 692, 0, 7357, 7359, 3, 218, 109, 0, 7358, 7357, 1, 0, 0, 0, 7358, 7359, 1, 0, 0, 0, 7359, 7361, 1, 0, 0, 0, 7360, 7362, 3, 760, 380, 0, 7361, 7360, 1, 0, 0, 0, 7361, 7362, 1, 0, 0, 0, 7362, 7380, 1, 0, 0, 0, 7363, 7364, 3, 1384, 692, 0, 7364, 7366, 3, 1334, 667, 0, 7365, 7367, 3, 218, 109, 0, 7366, 7365, 1, 0, 0, 0, 7366, 7367, 1, 0, 0, 0, 7367, 7369, 1, 0, 0, 0, 7368, 7370, 3, 760, 380, 0, 7369, 7368, 1, 0, 0, 0, 7369, 7370, 1, 0, 0, 0, 7370, 7380, 1, 0, 0, 0, 7371, 7373, 3, 1084, 542, 0, 7372, 7374, 3, 218, 109, 0, 7373, 7372, 1, 0, 0, 0, 7373, 7374, 1, 0, 0, 0, 7374, 7376, 1, 0, 0, 0, 7375, 7377, 3, 760, 380, 0, 7376, 7375, 1, 0, 0, 0, 7376, 7377, 1, 0, 0, 0, 7377, 7380, 1, 0, 0, 0, 7378, 7380, 5, 111, 0, 0, 7379, 7341, 1, 0, 0, 0, 7379, 7349, 1, 0, 0, 0, 7379, 7356, 1, 0, 0, 0, 7379, 7363, 1, 0, 0, 0, 7379, 7371, 1, 0, 0, 0, 7379, 7378, 1, 0, 0, 0, 7380, 759, 1, 0, 0, 0, 7381, 7382, 5, 103, 0, 0, 7382, 7383, 5, 2, 0, 0, 7383, 7384, 3, 1172, 586, 0, 7384, 7385, 5, 3, 0, 0, 7385, 761, 1, 0, 0, 0, 7386, 7387, 5, 138, 0, 0, 7387, 7388, 5, 454, 0, 0, 7388, 7389, 3, 1352, 676, 0, 7389, 7390, 5, 326, 0, 0, 7390, 7391, 3, 464, 232, 0, 7391, 7411, 1, 0, 0, 0, 7392, 7393, 5, 138, 0, 0, 7393, 7394, 5, 454, 0, 0, 7394, 7395, 3, 1352, 676, 0, 7395, 7396, 5, 133, 0, 0, 7396, 7397, 3, 756, 378, 0, 7397, 7411, 1, 0, 0, 0, 7398, 7399, 5, 138, 0, 0, 7399, 7400, 5, 454, 0, 0, 7400, 7401, 3, 1352, 676, 0, 7401, 7402, 5, 326, 0, 0, 7402, 7403, 3, 756, 378, 0, 7403, 7411, 1, 0, 0, 0, 7404, 7405, 5, 138, 0, 0, 7405, 7406, 5, 454, 0, 0, 7406, 7407, 3, 1352, 676, 0, 7407, 7408, 5, 191, 0, 0, 7408, 7409, 3, 756, 378, 0, 7409, 7411, 1, 0, 0, 0, 7410, 7386, 1, 0, 0, 0, 7410, 7392, 1, 0, 0, 0, 7410, 7398, 1, 0, 0, 0, 7410, 7404, 1, 0, 0, 0, 7411, 763, 1, 0, 0, 0, 7412, 7413, 5, 46, 0, 0, 7413, 7414, 5, 453, 0, 0, 7414, 7415, 3, 1352, 676, 0, 7415, 7416, 5, 164, 0, 0, 7416, 7417, 3, 1370, 685, 0, 7417, 7418, 5, 454, 0, 0, 7418, 7420, 3, 766, 383, 0, 7419, 7421, 3, 672, 336, 0, 7420, 7419, 1, 0, 0, 0, 7420, 7421, 1, 0, 0, 0, 7421, 765, 1, 0, 0, 0, 7422, 7427, 3, 768, 384, 0, 7423, 7424, 5, 6, 0, 0, 7424, 7426, 3, 768, 384, 0, 7425, 7423, 1, 0, 0, 0, 7426, 7429, 1, 0, 0, 0, 7427, 7425, 1, 0, 0, 0, 7427, 7428, 1, 0, 0, 0, 7428, 767, 1, 0, 0, 0, 7429, 7427, 1, 0, 0, 0, 7430, 7431, 3, 1392, 696, 0, 7431, 769, 1, 0, 0, 0, 7432, 7433, 5, 138, 0, 0, 7433, 7434, 5, 453, 0, 0, 7434, 7435, 3, 1352, 676, 0, 7435, 7436, 5, 326, 0, 0, 7436, 7437, 3, 464, 232, 0, 7437, 7478, 1, 0, 0, 0, 7438, 7439, 5, 138, 0, 0, 7439, 7440, 5, 453, 0, 0, 7440, 7441, 3, 1352, 676, 0, 7441, 7442, 5, 164, 0, 0, 7442, 7443, 3, 1370, 685, 0, 7443, 7478, 1, 0, 0, 0, 7444, 7445, 5, 138, 0, 0, 7445, 7446, 5, 453, 0, 0, 7446, 7447, 3, 1352, 676, 0, 7447, 7448, 5, 298, 0, 0, 7448, 7450, 5, 454, 0, 0, 7449, 7451, 3, 672, 336, 0, 7450, 7449, 1, 0, 0, 0, 7450, 7451, 1, 0, 0, 0, 7451, 7478, 1, 0, 0, 0, 7452, 7453, 5, 138, 0, 0, 7453, 7454, 5, 453, 0, 0, 7454, 7455, 3, 1352, 676, 0, 7455, 7456, 5, 326, 0, 0, 7456, 7457, 5, 454, 0, 0, 7457, 7459, 3, 766, 383, 0, 7458, 7460, 3, 672, 336, 0, 7459, 7458, 1, 0, 0, 0, 7459, 7460, 1, 0, 0, 0, 7460, 7478, 1, 0, 0, 0, 7461, 7462, 5, 138, 0, 0, 7462, 7463, 5, 453, 0, 0, 7463, 7464, 3, 1352, 676, 0, 7464, 7465, 5, 193, 0, 0, 7465, 7478, 1, 0, 0, 0, 7466, 7467, 5, 138, 0, 0, 7467, 7468, 5, 453, 0, 0, 7468, 7469, 3, 1352, 676, 0, 7469, 7470, 5, 186, 0, 0, 7470, 7478, 1, 0, 0, 0, 7471, 7472, 5, 138, 0, 0, 7472, 7473, 5, 453, 0, 0, 7473, 7474, 3, 1352, 676, 0, 7474, 7475, 5, 467, 0, 0, 7475, 7476, 3, 464, 232, 0, 7476, 7478, 1, 0, 0, 0, 7477, 7432, 1, 0, 0, 0, 7477, 7438, 1, 0, 0, 0, 7477, 7444, 1, 0, 0, 0, 7477, 7452, 1, 0, 0, 0, 7477, 7461, 1, 0, 0, 0, 7477, 7466, 1, 0, 0, 0, 7477, 7471, 1, 0, 0, 0, 7478, 771, 1, 0, 0, 0, 7479, 7480, 5, 191, 0, 0, 7480, 7481, 5, 453, 0, 0, 7481, 7483, 3, 1352, 676, 0, 7482, 7484, 3, 108, 54, 0, 7483, 7482, 1, 0, 0, 0, 7483, 7484, 1, 0, 0, 0, 7484, 7494, 1, 0, 0, 0, 7485, 7486, 5, 191, 0, 0, 7486, 7487, 5, 453, 0, 0, 7487, 7488, 5, 220, 0, 0, 7488, 7489, 5, 390, 0, 0, 7489, 7491, 3, 1352, 676, 0, 7490, 7492, 3, 108, 54, 0, 7491, 7490, 1, 0, 0, 0, 7491, 7492, 1, 0, 0, 0, 7492, 7494, 1, 0, 0, 0, 7493, 7479, 1, 0, 0, 0, 7493, 7485, 1, 0, 0, 0, 7494, 773, 1, 0, 0, 0, 7495, 7497, 5, 46, 0, 0, 7496, 7498, 3, 626, 313, 0, 7497, 7496, 1, 0, 0, 0, 7497, 7498, 1, 0, 0, 0, 7498, 7499, 1, 0, 0, 0, 7499, 7500, 5, 314, 0, 0, 7500, 7501, 3, 1352, 676, 0, 7501, 7502, 5, 36, 0, 0, 7502, 7503, 5, 80, 0, 0, 7503, 7504, 3, 784, 392, 0, 7504, 7505, 5, 94, 0, 0, 7505, 7507, 3, 1348, 674, 0, 7506, 7508, 3, 1104, 552, 0, 7507, 7506, 1, 0, 0, 0, 7507, 7508, 1, 0, 0, 0, 7508, 7509, 1, 0, 0, 0, 7509, 7511, 5, 57, 0, 0, 7510, 7512, 3, 786, 393, 0, 7511, 7510, 1, 0, 0, 0, 7511, 7512, 1, 0, 0, 0, 7512, 7513, 1, 0, 0, 0, 7513, 7514, 3, 776, 388, 0, 7514, 775, 1, 0, 0, 0, 7515, 7522, 5, 263, 0, 0, 7516, 7522, 3, 780, 390, 0, 7517, 7518, 5, 2, 0, 0, 7518, 7519, 3, 778, 389, 0, 7519, 7520, 5, 3, 0, 0, 7520, 7522, 1, 0, 0, 0, 7521, 7515, 1, 0, 0, 0, 7521, 7516, 1, 0, 0, 0, 7521, 7517, 1, 0, 0, 0, 7522, 777, 1, 0, 0, 0, 7523, 7525, 3, 782, 391, 0, 7524, 7523, 1, 0, 0, 0, 7524, 7525, 1, 0, 0, 0, 7525, 7532, 1, 0, 0, 0, 7526, 7528, 5, 7, 0, 0, 7527, 7529, 3, 782, 391, 0, 7528, 7527, 1, 0, 0, 0, 7528, 7529, 1, 0, 0, 0, 7529, 7531, 1, 0, 0, 0, 7530, 7526, 1, 0, 0, 0, 7531, 7534, 1, 0, 0, 0, 7532, 7530, 1, 0, 0, 0, 7532, 7533, 1, 0, 0, 0, 7533, 779, 1, 0, 0, 0, 7534, 7532, 1, 0, 0, 0, 7535, 7541, 3, 970, 485, 0, 7536, 7541, 3, 912, 456, 0, 7537, 7541, 3, 952, 476, 0, 7538, 7541, 3, 938, 469, 0, 7539, 7541, 3, 788, 394, 0, 7540, 7535, 1, 0, 0, 0, 7540, 7536, 1, 0, 0, 0, 7540, 7537, 1, 0, 0, 0, 7540, 7538, 1, 0, 0, 0, 7540, 7539, 1, 0, 0, 0, 7541, 781, 1, 0, 0, 0, 7542, 7543, 3, 780, 390, 0, 7543, 783, 1, 0, 0, 0, 7544, 7545, 7, 34, 0, 0, 7545, 785, 1, 0, 0, 0, 7546, 7547, 7, 35, 0, 0, 7547, 787, 1, 0, 0, 0, 7548, 7549, 5, 264, 0, 0, 7549, 7551, 3, 1384, 692, 0, 7550, 7552, 3, 790, 395, 0, 7551, 7550, 1, 0, 0, 0, 7551, 7552, 1, 0, 0, 0, 7552, 789, 1, 0, 0, 0, 7553, 7554, 5, 6, 0, 0, 7554, 7555, 3, 1370, 685, 0, 7555, 791, 1, 0, 0, 0, 7556, 7557, 5, 243, 0, 0, 7557, 7558, 3, 1384, 692, 0, 7558, 793, 1, 0, 0, 0, 7559, 7560, 5, 359, 0, 0, 7560, 7564, 3, 1384, 692, 0, 7561, 7562, 5, 359, 0, 0, 7562, 7564, 5, 9, 0, 0, 7563, 7559, 1, 0, 0, 0, 7563, 7561, 1, 0, 0, 0, 7564, 795, 1, 0, 0, 0, 7565, 7567, 5, 129, 0, 0, 7566, 7568, 3, 798, 399, 0, 7567, 7566, 1, 0, 0, 0, 7567, 7568, 1, 0, 0, 0, 7568, 7570, 1, 0, 0, 0, 7569, 7571, 3, 806, 403, 0, 7570, 7569, 1, 0, 0, 0, 7570, 7571, 1, 0, 0, 0, 7571, 7635, 1, 0, 0, 0, 7572, 7574, 5, 146, 0, 0, 7573, 7575, 3, 798, 399, 0, 7574, 7573, 1, 0, 0, 0, 7574, 7575, 1, 0, 0, 0, 7575, 7577, 1, 0, 0, 0, 7576, 7578, 3, 804, 402, 0, 7577, 7576, 1, 0, 0, 0, 7577, 7578, 1, 0, 0, 0, 7578, 7635, 1, 0, 0, 0, 7579, 7580, 5, 333, 0, 0, 7580, 7582, 5, 349, 0, 0, 7581, 7583, 3, 804, 402, 0, 7582, 7581, 1, 0, 0, 0, 7582, 7583, 1, 0, 0, 0, 7583, 7635, 1, 0, 0, 0, 7584, 7586, 5, 161, 0, 0, 7585, 7587, 3, 798, 399, 0, 7586, 7585, 1, 0, 0, 0, 7586, 7587, 1, 0, 0, 0, 7587, 7589, 1, 0, 0, 0, 7588, 7590, 3, 806, 403, 0, 7589, 7588, 1, 0, 0, 0, 7589, 7590, 1, 0, 0, 0, 7590, 7635, 1, 0, 0, 0, 7591, 7593, 5, 456, 0, 0, 7592, 7594, 3, 798, 399, 0, 7593, 7592, 1, 0, 0, 0, 7593, 7594, 1, 0, 0, 0, 7594, 7596, 1, 0, 0, 0, 7595, 7597, 3, 806, 403, 0, 7596, 7595, 1, 0, 0, 0, 7596, 7597, 1, 0, 0, 0, 7597, 7635, 1, 0, 0, 0, 7598, 7600, 5, 312, 0, 0, 7599, 7601, 3, 798, 399, 0, 7600, 7599, 1, 0, 0, 0, 7600, 7601, 1, 0, 0, 0, 7601, 7603, 1, 0, 0, 0, 7602, 7604, 3, 806, 403, 0, 7603, 7602, 1, 0, 0, 0, 7603, 7604, 1, 0, 0, 0, 7604, 7635, 1, 0, 0, 0, 7605, 7606, 5, 315, 0, 0, 7606, 7635, 3, 1384, 692, 0, 7607, 7608, 5, 301, 0, 0, 7608, 7609, 5, 315, 0, 0, 7609, 7635, 3, 1384, 692, 0, 7610, 7611, 5, 301, 0, 0, 7611, 7635, 3, 1384, 692, 0, 7612, 7614, 5, 312, 0, 0, 7613, 7615, 3, 798, 399, 0, 7614, 7613, 1, 0, 0, 0, 7614, 7615, 1, 0, 0, 0, 7615, 7616, 1, 0, 0, 0, 7616, 7617, 5, 94, 0, 0, 7617, 7618, 5, 315, 0, 0, 7618, 7635, 3, 1384, 692, 0, 7619, 7621, 5, 312, 0, 0, 7620, 7622, 3, 798, 399, 0, 7621, 7620, 1, 0, 0, 0, 7621, 7622, 1, 0, 0, 0, 7622, 7623, 1, 0, 0, 0, 7623, 7624, 5, 94, 0, 0, 7624, 7635, 3, 1384, 692, 0, 7625, 7626, 5, 283, 0, 0, 7626, 7627, 5, 349, 0, 0, 7627, 7635, 3, 1370, 685, 0, 7628, 7629, 5, 161, 0, 0, 7629, 7630, 5, 284, 0, 0, 7630, 7635, 3, 1370, 685, 0, 7631, 7632, 5, 312, 0, 0, 7632, 7633, 5, 284, 0, 0, 7633, 7635, 3, 1370, 685, 0, 7634, 7565, 1, 0, 0, 0, 7634, 7572, 1, 0, 0, 0, 7634, 7579, 1, 0, 0, 0, 7634, 7584, 1, 0, 0, 0, 7634, 7591, 1, 0, 0, 0, 7634, 7598, 1, 0, 0, 0, 7634, 7605, 1, 0, 0, 0, 7634, 7607, 1, 0, 0, 0, 7634, 7610, 1, 0, 0, 0, 7634, 7612, 1, 0, 0, 0, 7634, 7619, 1, 0, 0, 0, 7634, 7625, 1, 0, 0, 0, 7634, 7628, 1, 0, 0, 0, 7634, 7631, 1, 0, 0, 0, 7635, 797, 1, 0, 0, 0, 7636, 7637, 7, 36, 0, 0, 7637, 799, 1, 0, 0, 0, 7638, 7639, 5, 235, 0, 0, 7639, 7640, 5, 242, 0, 0, 7640, 7649, 3, 64, 32, 0, 7641, 7642, 5, 293, 0, 0, 7642, 7649, 5, 81, 0, 0, 7643, 7644, 5, 293, 0, 0, 7644, 7649, 5, 375, 0, 0, 7645, 7649, 5, 54, 0, 0, 7646, 7647, 5, 77, 0, 0, 7647, 7649, 5, 54, 0, 0, 7648, 7638, 1, 0, 0, 0, 7648, 7641, 1, 0, 0, 0, 7648, 7643, 1, 0, 0, 0, 7648, 7645, 1, 0, 0, 0, 7648, 7646, 1, 0, 0, 0, 7649, 801, 1, 0, 0, 0, 7650, 7657, 3, 800, 400, 0, 7651, 7653, 5, 6, 0, 0, 7652, 7651, 1, 0, 0, 0, 7652, 7653, 1, 0, 0, 0, 7653, 7654, 1, 0, 0, 0, 7654, 7656, 3, 800, 400, 0, 7655, 7652, 1, 0, 0, 0, 7656, 7659, 1, 0, 0, 0, 7657, 7655, 1, 0, 0, 0, 7657, 7658, 1, 0, 0, 0, 7658, 803, 1, 0, 0, 0, 7659, 7657, 1, 0, 0, 0, 7660, 7661, 3, 802, 401, 0, 7661, 805, 1, 0, 0, 0, 7662, 7664, 5, 33, 0, 0, 7663, 7665, 5, 262, 0, 0, 7664, 7663, 1, 0, 0, 0, 7664, 7665, 1, 0, 0, 0, 7665, 7666, 1, 0, 0, 0, 7666, 7667, 5, 153, 0, 0, 7667, 807, 1, 0, 0, 0, 7668, 7671, 5, 46, 0, 0, 7669, 7670, 5, 82, 0, 0, 7670, 7672, 5, 304, 0, 0, 7671, 7669, 1, 0, 0, 0, 7671, 7672, 1, 0, 0, 0, 7672, 7674, 1, 0, 0, 0, 7673, 7675, 3, 174, 87, 0, 7674, 7673, 1, 0, 0, 0, 7674, 7675, 1, 0, 0, 0, 7675, 7693, 1, 0, 0, 0, 7676, 7677, 5, 369, 0, 0, 7677, 7679, 3, 1348, 674, 0, 7678, 7680, 3, 218, 109, 0, 7679, 7678, 1, 0, 0, 0, 7679, 7680, 1, 0, 0, 0, 7680, 7682, 1, 0, 0, 0, 7681, 7683, 3, 118, 59, 0, 7682, 7681, 1, 0, 0, 0, 7682, 7683, 1, 0, 0, 0, 7683, 7694, 1, 0, 0, 0, 7684, 7685, 5, 296, 0, 0, 7685, 7686, 5, 369, 0, 0, 7686, 7687, 3, 1348, 674, 0, 7687, 7688, 5, 2, 0, 0, 7688, 7689, 3, 220, 110, 0, 7689, 7691, 5, 3, 0, 0, 7690, 7692, 3, 118, 59, 0, 7691, 7690, 1, 0, 0, 0, 7691, 7692, 1, 0, 0, 0, 7692, 7694, 1, 0, 0, 0, 7693, 7676, 1, 0, 0, 0, 7693, 7684, 1, 0, 0, 0, 7694, 7695, 1, 0, 0, 0, 7695, 7696, 5, 36, 0, 0, 7696, 7698, 3, 970, 485, 0, 7697, 7699, 3, 810, 405, 0, 7698, 7697, 1, 0, 0, 0, 7698, 7699, 1, 0, 0, 0, 7699, 809, 1, 0, 0, 0, 7700, 7702, 5, 105, 0, 0, 7701, 7703, 7, 37, 0, 0, 7702, 7701, 1, 0, 0, 0, 7702, 7703, 1, 0, 0, 0, 7703, 7704, 1, 0, 0, 0, 7704, 7705, 5, 42, 0, 0, 7705, 7706, 5, 272, 0, 0, 7706, 811, 1, 0, 0, 0, 7707, 7708, 5, 244, 0, 0, 7708, 7709, 3, 1356, 678, 0, 7709, 813, 1, 0, 0, 0, 7710, 7711, 5, 46, 0, 0, 7711, 7712, 5, 175, 0, 0, 7712, 7714, 3, 1352, 676, 0, 7713, 7715, 3, 16, 8, 0, 7714, 7713, 1, 0, 0, 0, 7714, 7715, 1, 0, 0, 0, 7715, 7717, 1, 0, 0, 0, 7716, 7718, 3, 816, 408, 0, 7717, 7716, 1, 0, 0, 0, 7717, 7718, 1, 0, 0, 0, 7718, 815, 1, 0, 0, 0, 7719, 7720, 3, 818, 409, 0, 7720, 817, 1, 0, 0, 0, 7721, 7723, 3, 820, 410, 0, 7722, 7721, 1, 0, 0, 0, 7723, 7724, 1, 0, 0, 0, 7724, 7722, 1, 0, 0, 0, 7724, 7725, 1, 0, 0, 0, 7725, 819, 1, 0, 0, 0, 7726, 7728, 3, 822, 411, 0, 7727, 7729, 3, 824, 412, 0, 7728, 7727, 1, 0, 0, 0, 7728, 7729, 1, 0, 0, 0, 7729, 7733, 1, 0, 0, 0, 7730, 7734, 3, 1376, 688, 0, 7731, 7734, 3, 66, 33, 0, 7732, 7734, 5, 53, 0, 0, 7733, 7730, 1, 0, 0, 0, 7733, 7731, 1, 0, 0, 0, 7733, 7732, 1, 0, 0, 0, 7734, 821, 1, 0, 0, 0, 7735, 7744, 3, 1394, 697, 0, 7736, 7737, 5, 164, 0, 0, 7737, 7744, 5, 74, 0, 0, 7738, 7744, 5, 194, 0, 0, 7739, 7744, 5, 246, 0, 0, 7740, 7744, 5, 275, 0, 0, 7741, 7744, 5, 344, 0, 0, 7742, 7744, 5, 346, 0, 0, 7743, 7735, 1, 0, 0, 0, 7743, 7736, 1, 0, 0, 0, 7743, 7738, 1, 0, 0, 0, 7743, 7739, 1, 0, 0, 0, 7743, 7740, 1, 0, 0, 0, 7743, 7741, 1, 0, 0, 0, 7743, 7742, 1, 0, 0, 0, 7744, 823, 1, 0, 0, 0, 7745, 7746, 5, 10, 0, 0, 7746, 825, 1, 0, 0, 0, 7747, 7748, 5, 138, 0, 0, 7748, 7749, 5, 175, 0, 0, 7749, 7763, 3, 1352, 676, 0, 7750, 7752, 5, 105, 0, 0, 7751, 7753, 3, 816, 408, 0, 7752, 7751, 1, 0, 0, 0, 7752, 7753, 1, 0, 0, 0, 7753, 7764, 1, 0, 0, 0, 7754, 7756, 3, 816, 408, 0, 7755, 7754, 1, 0, 0, 0, 7755, 7756, 1, 0, 0, 0, 7756, 7764, 1, 0, 0, 0, 7757, 7758, 5, 326, 0, 0, 7758, 7759, 5, 344, 0, 0, 7759, 7764, 3, 1352, 676, 0, 7760, 7761, 5, 298, 0, 0, 7761, 7762, 5, 108, 0, 0, 7762, 7764, 5, 368, 0, 0, 7763, 7750, 1, 0, 0, 0, 7763, 7755, 1, 0, 0, 0, 7763, 7757, 1, 0, 0, 0, 7763, 7760, 1, 0, 0, 0, 7764, 827, 1, 0, 0, 0, 7765, 7766, 5, 138, 0, 0, 7766, 7767, 5, 175, 0, 0, 7767, 7768, 3, 1352, 676, 0, 7768, 7769, 3, 80, 40, 0, 7769, 829, 1, 0, 0, 0, 7770, 7771, 5, 191, 0, 0, 7771, 7774, 5, 175, 0, 0, 7772, 7773, 5, 220, 0, 0, 7773, 7775, 5, 390, 0, 0, 7774, 7772, 1, 0, 0, 0, 7774, 7775, 1, 0, 0, 0, 7775, 7776, 1, 0, 0, 0, 7776, 7784, 3, 1352, 676, 0, 7777, 7779, 3, 16, 8, 0, 7778, 7777, 1, 0, 0, 0, 7778, 7779, 1, 0, 0, 0, 7779, 7780, 1, 0, 0, 0, 7780, 7781, 5, 2, 0, 0, 7781, 7782, 3, 832, 416, 0, 7782, 7783, 5, 3, 0, 0, 7783, 7785, 1, 0, 0, 0, 7784, 7778, 1, 0, 0, 0, 7784, 7785, 1, 0, 0, 0, 7785, 831, 1, 0, 0, 0, 7786, 7791, 3, 834, 417, 0, 7787, 7788, 5, 6, 0, 0, 7788, 7790, 3, 834, 417, 0, 7789, 7787, 1, 0, 0, 0, 7790, 7793, 1, 0, 0, 0, 7791, 7789, 1, 0, 0, 0, 7791, 7792, 1, 0, 0, 0, 7792, 833, 1, 0, 0, 0, 7793, 7791, 1, 0, 0, 0, 7794, 7795, 5, 209, 0, 0, 7795, 835, 1, 0, 0, 0, 7796, 7797, 5, 138, 0, 0, 7797, 7798, 5, 108, 0, 0, 7798, 7799, 3, 528, 264, 0, 7799, 7800, 5, 298, 0, 0, 7800, 7801, 5, 368, 0, 0, 7801, 837, 1, 0, 0, 0, 7802, 7803, 5, 138, 0, 0, 7803, 7804, 5, 342, 0, 0, 7804, 7805, 7, 38, 0, 0, 7805, 7806, 3, 54, 27, 0, 7806, 839, 1, 0, 0, 0, 7807, 7808, 5, 46, 0, 0, 7808, 7809, 5, 189, 0, 0, 7809, 7811, 3, 528, 264, 0, 7810, 7812, 3, 844, 422, 0, 7811, 7810, 1, 0, 0, 0, 7811, 7812, 1, 0, 0, 0, 7812, 7813, 1, 0, 0, 0, 7813, 7814, 3, 1128, 564, 0, 7814, 7815, 3, 194, 97, 0, 7815, 841, 1, 0, 0, 0, 7816, 7817, 5, 138, 0, 0, 7817, 7818, 5, 189, 0, 0, 7818, 7841, 3, 528, 264, 0, 7819, 7842, 3, 106, 53, 0, 7820, 7821, 5, 191, 0, 0, 7821, 7822, 5, 77, 0, 0, 7822, 7842, 5, 78, 0, 0, 7823, 7824, 5, 326, 0, 0, 7824, 7825, 5, 77, 0, 0, 7825, 7842, 5, 78, 0, 0, 7826, 7827, 5, 133, 0, 0, 7827, 7842, 3, 212, 106, 0, 7828, 7829, 5, 191, 0, 0, 7829, 7832, 5, 45, 0, 0, 7830, 7831, 5, 220, 0, 0, 7831, 7833, 5, 390, 0, 0, 7832, 7830, 1, 0, 0, 0, 7832, 7833, 1, 0, 0, 0, 7833, 7834, 1, 0, 0, 0, 7834, 7836, 3, 1352, 676, 0, 7835, 7837, 3, 108, 54, 0, 7836, 7835, 1, 0, 0, 0, 7836, 7837, 1, 0, 0, 0, 7837, 7842, 1, 0, 0, 0, 7838, 7839, 5, 365, 0, 0, 7839, 7840, 5, 45, 0, 0, 7840, 7842, 3, 1352, 676, 0, 7841, 7819, 1, 0, 0, 0, 7841, 7820, 1, 0, 0, 0, 7841, 7823, 1, 0, 0, 0, 7841, 7826, 1, 0, 0, 0, 7841, 7828, 1, 0, 0, 0, 7841, 7838, 1, 0, 0, 0, 7842, 843, 1, 0, 0, 0, 7843, 7844, 5, 36, 0, 0, 7844, 845, 1, 0, 0, 0, 7845, 7846, 5, 138, 0, 0, 7846, 7847, 5, 348, 0, 0, 7847, 7848, 5, 318, 0, 0, 7848, 7849, 5, 185, 0, 0, 7849, 7850, 3, 528, 264, 0, 7850, 7851, 3, 464, 232, 0, 7851, 847, 1, 0, 0, 0, 7852, 7853, 5, 138, 0, 0, 7853, 7854, 5, 348, 0, 0, 7854, 7855, 5, 318, 0, 0, 7855, 7856, 5, 163, 0, 0, 7856, 7857, 3, 528, 264, 0, 7857, 7858, 5, 133, 0, 0, 7858, 7859, 5, 248, 0, 0, 7859, 7860, 5, 62, 0, 0, 7860, 7861, 3, 1350, 675, 0, 7861, 7862, 3, 850, 425, 0, 7862, 7863, 3, 526, 263, 0, 7863, 7925, 1, 0, 0, 0, 7864, 7865, 5, 138, 0, 0, 7865, 7866, 5, 348, 0, 0, 7866, 7867, 5, 318, 0, 0, 7867, 7868, 5, 163, 0, 0, 7868, 7869, 3, 528, 264, 0, 7869, 7870, 5, 138, 0, 0, 7870, 7871, 5, 248, 0, 0, 7871, 7872, 5, 62, 0, 0, 7872, 7873, 3, 1350, 675, 0, 7873, 7874, 3, 850, 425, 0, 7874, 7875, 3, 526, 263, 0, 7875, 7925, 1, 0, 0, 0, 7876, 7877, 5, 138, 0, 0, 7877, 7878, 5, 348, 0, 0, 7878, 7879, 5, 318, 0, 0, 7879, 7880, 5, 163, 0, 0, 7880, 7881, 3, 528, 264, 0, 7881, 7882, 5, 138, 0, 0, 7882, 7883, 5, 248, 0, 0, 7883, 7884, 5, 304, 0, 0, 7884, 7885, 3, 528, 264, 0, 7885, 7886, 3, 850, 425, 0, 7886, 7887, 3, 528, 264, 0, 7887, 7925, 1, 0, 0, 0, 7888, 7889, 5, 138, 0, 0, 7889, 7890, 5, 348, 0, 0, 7890, 7891, 5, 318, 0, 0, 7891, 7892, 5, 163, 0, 0, 7892, 7893, 3, 528, 264, 0, 7893, 7894, 5, 138, 0, 0, 7894, 7895, 5, 248, 0, 0, 7895, 7896, 5, 62, 0, 0, 7896, 7897, 3, 1350, 675, 0, 7897, 7898, 5, 304, 0, 0, 7898, 7899, 3, 528, 264, 0, 7899, 7900, 3, 850, 425, 0, 7900, 7901, 3, 528, 264, 0, 7901, 7925, 1, 0, 0, 0, 7902, 7903, 5, 138, 0, 0, 7903, 7904, 5, 348, 0, 0, 7904, 7905, 5, 318, 0, 0, 7905, 7906, 5, 163, 0, 0, 7906, 7907, 3, 528, 264, 0, 7907, 7908, 5, 191, 0, 0, 7908, 7909, 5, 248, 0, 0, 7909, 7910, 5, 62, 0, 0, 7910, 7911, 3, 1350, 675, 0, 7911, 7925, 1, 0, 0, 0, 7912, 7913, 5, 138, 0, 0, 7913, 7914, 5, 348, 0, 0, 7914, 7915, 5, 318, 0, 0, 7915, 7916, 5, 163, 0, 0, 7916, 7917, 3, 528, 264, 0, 7917, 7918, 5, 191, 0, 0, 7918, 7919, 5, 248, 0, 0, 7919, 7920, 5, 220, 0, 0, 7920, 7921, 5, 390, 0, 0, 7921, 7922, 5, 62, 0, 0, 7922, 7923, 3, 1350, 675, 0, 7923, 7925, 1, 0, 0, 0, 7924, 7852, 1, 0, 0, 0, 7924, 7864, 1, 0, 0, 0, 7924, 7876, 1, 0, 0, 0, 7924, 7888, 1, 0, 0, 0, 7924, 7902, 1, 0, 0, 0, 7924, 7912, 1, 0, 0, 0, 7925, 849, 1, 0, 0, 0, 7926, 7927, 5, 105, 0, 0, 7927, 851, 1, 0, 0, 0, 7928, 7930, 5, 46, 0, 0, 7929, 7931, 3, 492, 246, 0, 7930, 7929, 1, 0, 0, 0, 7930, 7931, 1, 0, 0, 0, 7931, 7932, 1, 0, 0, 0, 7932, 7933, 5, 168, 0, 0, 7933, 7934, 3, 528, 264, 0, 7934, 7935, 5, 62, 0, 0, 7935, 7936, 3, 1370, 685, 0, 7936, 7937, 5, 94, 0, 0, 7937, 7938, 3, 1370, 685, 0, 7938, 7939, 5, 64, 0, 0, 7939, 7940, 3, 528, 264, 0, 7940, 853, 1, 0, 0, 0, 7941, 7943, 5, 158, 0, 0, 7942, 7944, 3, 874, 437, 0, 7943, 7942, 1, 0, 0, 0, 7943, 7944, 1, 0, 0, 0, 7944, 7945, 1, 0, 0, 0, 7945, 7947, 3, 1348, 674, 0, 7946, 7948, 3, 856, 428, 0, 7947, 7946, 1, 0, 0, 0, 7947, 7948, 1, 0, 0, 0, 7948, 7962, 1, 0, 0, 0, 7949, 7951, 5, 158, 0, 0, 7950, 7952, 3, 874, 437, 0, 7951, 7950, 1, 0, 0, 0, 7951, 7952, 1, 0, 0, 0, 7952, 7962, 1, 0, 0, 0, 7953, 7955, 5, 158, 0, 0, 7954, 7956, 3, 874, 437, 0, 7955, 7954, 1, 0, 0, 0, 7955, 7956, 1, 0, 0, 0, 7956, 7957, 1, 0, 0, 0, 7957, 7958, 3, 1352, 676, 0, 7958, 7959, 5, 80, 0, 0, 7959, 7960, 3, 1348, 674, 0, 7960, 7962, 1, 0, 0, 0, 7961, 7941, 1, 0, 0, 0, 7961, 7949, 1, 0, 0, 0, 7961, 7953, 1, 0, 0, 0, 7962, 855, 1, 0, 0, 0, 7963, 7964, 5, 100, 0, 0, 7964, 7965, 3, 1352, 676, 0, 7965, 857, 1, 0, 0, 0, 7966, 7968, 5, 363, 0, 0, 7967, 7969, 3, 876, 438, 0, 7968, 7967, 1, 0, 0, 0, 7968, 7969, 1, 0, 0, 0, 7969, 7971, 1, 0, 0, 0, 7970, 7972, 3, 878, 439, 0, 7971, 7970, 1, 0, 0, 0, 7971, 7972, 1, 0, 0, 0, 7972, 7974, 1, 0, 0, 0, 7973, 7975, 3, 874, 437, 0, 7974, 7973, 1, 0, 0, 0, 7974, 7975, 1, 0, 0, 0, 7975, 7977, 1, 0, 0, 0, 7976, 7978, 3, 872, 436, 0, 7977, 7976, 1, 0, 0, 0, 7977, 7978, 1, 0, 0, 0, 7978, 7980, 1, 0, 0, 0, 7979, 7981, 3, 886, 443, 0, 7980, 7979, 1, 0, 0, 0, 7980, 7981, 1, 0, 0, 0, 7981, 7990, 1, 0, 0, 0, 7982, 7983, 5, 363, 0, 0, 7983, 7984, 5, 2, 0, 0, 7984, 7985, 3, 862, 431, 0, 7985, 7987, 5, 3, 0, 0, 7986, 7988, 3, 886, 443, 0, 7987, 7986, 1, 0, 0, 0, 7987, 7988, 1, 0, 0, 0, 7988, 7990, 1, 0, 0, 0, 7989, 7966, 1, 0, 0, 0, 7989, 7982, 1, 0, 0, 0, 7990, 859, 1, 0, 0, 0, 7991, 7993, 3, 864, 432, 0, 7992, 7994, 3, 874, 437, 0, 7993, 7992, 1, 0, 0, 0, 7993, 7994, 1, 0, 0, 0, 7994, 7996, 1, 0, 0, 0, 7995, 7997, 3, 886, 443, 0, 7996, 7995, 1, 0, 0, 0, 7996, 7997, 1, 0, 0, 0, 7997, 8006, 1, 0, 0, 0, 7998, 7999, 3, 864, 432, 0, 7999, 8000, 5, 2, 0, 0, 8000, 8001, 3, 862, 431, 0, 8001, 8003, 5, 3, 0, 0, 8002, 8004, 3, 886, 443, 0, 8003, 8002, 1, 0, 0, 0, 8003, 8004, 1, 0, 0, 0, 8004, 8006, 1, 0, 0, 0, 8005, 7991, 1, 0, 0, 0, 8005, 7998, 1, 0, 0, 0, 8006, 861, 1, 0, 0, 0, 8007, 8012, 3, 866, 433, 0, 8008, 8009, 5, 6, 0, 0, 8009, 8011, 3, 866, 433, 0, 8010, 8008, 1, 0, 0, 0, 8011, 8014, 1, 0, 0, 0, 8012, 8010, 1, 0, 0, 0, 8012, 8013, 1, 0, 0, 0, 8013, 863, 1, 0, 0, 0, 8014, 8012, 1, 0, 0, 0, 8015, 8016, 7, 39, 0, 0, 8016, 865, 1, 0, 0, 0, 8017, 8019, 3, 868, 434, 0, 8018, 8020, 3, 870, 435, 0, 8019, 8018, 1, 0, 0, 0, 8019, 8020, 1, 0, 0, 0, 8020, 867, 1, 0, 0, 0, 8021, 8024, 3, 1390, 695, 0, 8022, 8024, 3, 864, 432, 0, 8023, 8021, 1, 0, 0, 0, 8023, 8022, 1, 0, 0, 0, 8024, 869, 1, 0, 0, 0, 8025, 8028, 3, 66, 33, 0, 8026, 8028, 3, 296, 148, 0, 8027, 8025, 1, 0, 0, 0, 8027, 8026, 1, 0, 0, 0, 8028, 871, 1, 0, 0, 0, 8029, 8030, 3, 864, 432, 0, 8030, 873, 1, 0, 0, 0, 8031, 8032, 5, 128, 0, 0, 8032, 875, 1, 0, 0, 0, 8033, 8034, 5, 113, 0, 0, 8034, 877, 1, 0, 0, 0, 8035, 8036, 5, 112, 0, 0, 8036, 879, 1, 0, 0, 0, 8037, 8038, 5, 2, 0, 0, 8038, 8039, 3, 1350, 675, 0, 8039, 8040, 5, 3, 0, 0, 8040, 881, 1, 0, 0, 0, 8041, 8043, 3, 1348, 674, 0, 8042, 8044, 3, 880, 440, 0, 8043, 8042, 1, 0, 0, 0, 8043, 8044, 1, 0, 0, 0, 8044, 883, 1, 0, 0, 0, 8045, 8050, 3, 882, 441, 0, 8046, 8047, 5, 6, 0, 0, 8047, 8049, 3, 882, 441, 0, 8048, 8046, 1, 0, 0, 0, 8049, 8052, 1, 0, 0, 0, 8050, 8048, 1, 0, 0, 0, 8050, 8051, 1, 0, 0, 0, 8051, 885, 1, 0, 0, 0, 8052, 8050, 1, 0, 0, 0, 8053, 8054, 3, 884, 442, 0, 8054, 887, 1, 0, 0, 0, 8055, 8056, 5, 203, 0, 0, 8056, 8074, 3, 890, 445, 0, 8057, 8058, 5, 203, 0, 0, 8058, 8060, 3, 864, 432, 0, 8059, 8061, 3, 874, 437, 0, 8060, 8059, 1, 0, 0, 0, 8060, 8061, 1, 0, 0, 0, 8061, 8062, 1, 0, 0, 0, 8062, 8063, 3, 890, 445, 0, 8063, 8074, 1, 0, 0, 0, 8064, 8065, 5, 203, 0, 0, 8065, 8066, 5, 128, 0, 0, 8066, 8074, 3, 890, 445, 0, 8067, 8068, 5, 203, 0, 0, 8068, 8069, 5, 2, 0, 0, 8069, 8070, 3, 892, 446, 0, 8070, 8071, 5, 3, 0, 0, 8071, 8072, 3, 890, 445, 0, 8072, 8074, 1, 0, 0, 0, 8073, 8055, 1, 0, 0, 0, 8073, 8057, 1, 0, 0, 0, 8073, 8064, 1, 0, 0, 0, 8073, 8067, 1, 0, 0, 0, 8074, 889, 1, 0, 0, 0, 8075, 8085, 3, 970, 485, 0, 8076, 8085, 3, 912, 456, 0, 8077, 8085, 3, 952, 476, 0, 8078, 8085, 3, 938, 469, 0, 8079, 8085, 3, 962, 481, 0, 8080, 8085, 3, 268, 134, 0, 8081, 8085, 3, 274, 137, 0, 8082, 8085, 3, 280, 140, 0, 8083, 8085, 3, 906, 453, 0, 8084, 8075, 1, 0, 0, 0, 8084, 8076, 1, 0, 0, 0, 8084, 8077, 1, 0, 0, 0, 8084, 8078, 1, 0, 0, 0, 8084, 8079, 1, 0, 0, 0, 8084, 8080, 1, 0, 0, 0, 8084, 8081, 1, 0, 0, 0, 8084, 8082, 1, 0, 0, 0, 8084, 8083, 1, 0, 0, 0, 8085, 891, 1, 0, 0, 0, 8086, 8091, 3, 894, 447, 0, 8087, 8088, 5, 6, 0, 0, 8088, 8090, 3, 894, 447, 0, 8089, 8087, 1, 0, 0, 0, 8090, 8093, 1, 0, 0, 0, 8091, 8089, 1, 0, 0, 0, 8091, 8092, 1, 0, 0, 0, 8092, 893, 1, 0, 0, 0, 8093, 8091, 1, 0, 0, 0, 8094, 8096, 3, 896, 448, 0, 8095, 8097, 3, 898, 449, 0, 8096, 8095, 1, 0, 0, 0, 8096, 8097, 1, 0, 0, 0, 8097, 895, 1, 0, 0, 0, 8098, 8101, 3, 1390, 695, 0, 8099, 8101, 3, 864, 432, 0, 8100, 8098, 1, 0, 0, 0, 8100, 8099, 1, 0, 0, 0, 8101, 897, 1, 0, 0, 0, 8102, 8105, 3, 66, 33, 0, 8103, 8105, 3, 296, 148, 0, 8104, 8102, 1, 0, 0, 0, 8104, 8103, 1, 0, 0, 0, 8105, 899, 1, 0, 0, 0, 8106, 8107, 5, 283, 0, 0, 8107, 8109, 3, 1352, 676, 0, 8108, 8110, 3, 902, 451, 0, 8109, 8108, 1, 0, 0, 0, 8109, 8110, 1, 0, 0, 0, 8110, 8111, 1, 0, 0, 0, 8111, 8112, 5, 36, 0, 0, 8112, 8113, 3, 904, 452, 0, 8113, 901, 1, 0, 0, 0, 8114, 8115, 5, 2, 0, 0, 8115, 8116, 3, 1296, 648, 0, 8116, 8117, 5, 3, 0, 0, 8117, 903, 1, 0, 0, 0, 8118, 8124, 3, 970, 485, 0, 8119, 8124, 3, 912, 456, 0, 8120, 8124, 3, 952, 476, 0, 8121, 8124, 3, 938, 469, 0, 8122, 8124, 3, 930, 465, 0, 8123, 8118, 1, 0, 0, 0, 8123, 8119, 1, 0, 0, 0, 8123, 8120, 1, 0, 0, 0, 8123, 8121, 1, 0, 0, 0, 8123, 8122, 1, 0, 0, 0, 8124, 905, 1, 0, 0, 0, 8125, 8126, 5, 202, 0, 0, 8126, 8128, 3, 1352, 676, 0, 8127, 8129, 3, 908, 454, 0, 8128, 8127, 1, 0, 0, 0, 8128, 8129, 1, 0, 0, 0, 8129, 8164, 1, 0, 0, 0, 8130, 8132, 5, 46, 0, 0, 8131, 8133, 3, 174, 87, 0, 8132, 8131, 1, 0, 0, 0, 8132, 8133, 1, 0, 0, 0, 8133, 8134, 1, 0, 0, 0, 8134, 8135, 5, 92, 0, 0, 8135, 8136, 3, 270, 135, 0, 8136, 8137, 5, 36, 0, 0, 8137, 8138, 5, 202, 0, 0, 8138, 8140, 3, 1352, 676, 0, 8139, 8141, 3, 908, 454, 0, 8140, 8139, 1, 0, 0, 0, 8140, 8141, 1, 0, 0, 0, 8141, 8143, 1, 0, 0, 0, 8142, 8144, 3, 272, 136, 0, 8143, 8142, 1, 0, 0, 0, 8143, 8144, 1, 0, 0, 0, 8144, 8164, 1, 0, 0, 0, 8145, 8147, 5, 46, 0, 0, 8146, 8148, 3, 174, 87, 0, 8147, 8146, 1, 0, 0, 0, 8147, 8148, 1, 0, 0, 0, 8148, 8149, 1, 0, 0, 0, 8149, 8150, 5, 92, 0, 0, 8150, 8151, 5, 220, 0, 0, 8151, 8152, 5, 77, 0, 0, 8152, 8153, 5, 390, 0, 0, 8153, 8154, 3, 270, 135, 0, 8154, 8155, 5, 36, 0, 0, 8155, 8156, 5, 202, 0, 0, 8156, 8158, 3, 1352, 676, 0, 8157, 8159, 3, 908, 454, 0, 8158, 8157, 1, 0, 0, 0, 8158, 8159, 1, 0, 0, 0, 8159, 8161, 1, 0, 0, 0, 8160, 8162, 3, 272, 136, 0, 8161, 8160, 1, 0, 0, 0, 8161, 8162, 1, 0, 0, 0, 8162, 8164, 1, 0, 0, 0, 8163, 8125, 1, 0, 0, 0, 8163, 8130, 1, 0, 0, 0, 8163, 8145, 1, 0, 0, 0, 8164, 907, 1, 0, 0, 0, 8165, 8166, 5, 2, 0, 0, 8166, 8167, 3, 1290, 645, 0, 8167, 8168, 5, 3, 0, 0, 8168, 909, 1, 0, 0, 0, 8169, 8170, 5, 177, 0, 0, 8170, 8180, 3, 1352, 676, 0, 8171, 8172, 5, 177, 0, 0, 8172, 8173, 5, 283, 0, 0, 8173, 8180, 3, 1352, 676, 0, 8174, 8175, 5, 177, 0, 0, 8175, 8180, 5, 30, 0, 0, 8176, 8177, 5, 177, 0, 0, 8177, 8178, 5, 283, 0, 0, 8178, 8180, 5, 30, 0, 0, 8179, 8169, 1, 0, 0, 0, 8179, 8171, 1, 0, 0, 0, 8179, 8174, 1, 0, 0, 0, 8179, 8176, 1, 0, 0, 0, 8180, 911, 1, 0, 0, 0, 8181, 8183, 3, 990, 495, 0, 8182, 8181, 1, 0, 0, 0, 8182, 8183, 1, 0, 0, 0, 8183, 8184, 1, 0, 0, 0, 8184, 8185, 5, 232, 0, 0, 8185, 8186, 5, 71, 0, 0, 8186, 8187, 3, 914, 457, 0, 8187, 8189, 3, 916, 458, 0, 8188, 8190, 3, 924, 462, 0, 8189, 8188, 1, 0, 0, 0, 8189, 8190, 1, 0, 0, 0, 8190, 8192, 1, 0, 0, 0, 8191, 8193, 3, 928, 464, 0, 8192, 8191, 1, 0, 0, 0, 8192, 8193, 1, 0, 0, 0, 8193, 913, 1, 0, 0, 0, 8194, 8197, 3, 1348, 674, 0, 8195, 8196, 5, 36, 0, 0, 8196, 8198, 3, 1384, 692, 0, 8197, 8195, 1, 0, 0, 0, 8197, 8198, 1, 0, 0, 0, 8198, 915, 1, 0, 0, 0, 8199, 8219, 3, 970, 485, 0, 8200, 8201, 5, 465, 0, 0, 8201, 8202, 3, 918, 459, 0, 8202, 8203, 5, 452, 0, 0, 8203, 8204, 3, 970, 485, 0, 8204, 8219, 1, 0, 0, 0, 8205, 8206, 5, 2, 0, 0, 8206, 8207, 3, 920, 460, 0, 8207, 8212, 5, 3, 0, 0, 8208, 8209, 5, 465, 0, 0, 8209, 8210, 3, 918, 459, 0, 8210, 8211, 5, 452, 0, 0, 8211, 8213, 1, 0, 0, 0, 8212, 8208, 1, 0, 0, 0, 8212, 8213, 1, 0, 0, 0, 8213, 8214, 1, 0, 0, 0, 8214, 8215, 3, 970, 485, 0, 8215, 8219, 1, 0, 0, 0, 8216, 8217, 5, 53, 0, 0, 8217, 8219, 5, 417, 0, 0, 8218, 8199, 1, 0, 0, 0, 8218, 8200, 1, 0, 0, 0, 8218, 8205, 1, 0, 0, 0, 8218, 8216, 1, 0, 0, 0, 8219, 917, 1, 0, 0, 0, 8220, 8221, 7, 40, 0, 0, 8221, 919, 1, 0, 0, 0, 8222, 8227, 3, 922, 461, 0, 8223, 8224, 5, 6, 0, 0, 8224, 8226, 3, 922, 461, 0, 8225, 8223, 1, 0, 0, 0, 8226, 8229, 1, 0, 0, 0, 8227, 8225, 1, 0, 0, 0, 8227, 8228, 1, 0, 0, 0, 8228, 921, 1, 0, 0, 0, 8229, 8227, 1, 0, 0, 0, 8230, 8231, 3, 1384, 692, 0, 8231, 8232, 3, 1336, 668, 0, 8232, 923, 1, 0, 0, 0, 8233, 8234, 5, 80, 0, 0, 8234, 8236, 5, 466, 0, 0, 8235, 8237, 3, 926, 463, 0, 8236, 8235, 1, 0, 0, 0, 8236, 8237, 1, 0, 0, 0, 8237, 8238, 1, 0, 0, 0, 8238, 8246, 5, 57, 0, 0, 8239, 8240, 5, 362, 0, 0, 8240, 8241, 5, 326, 0, 0, 8241, 8243, 3, 954, 477, 0, 8242, 8244, 3, 1104, 552, 0, 8243, 8242, 1, 0, 0, 0, 8243, 8244, 1, 0, 0, 0, 8244, 8247, 1, 0, 0, 0, 8245, 8247, 5, 263, 0, 0, 8246, 8239, 1, 0, 0, 0, 8246, 8245, 1, 0, 0, 0, 8247, 925, 1, 0, 0, 0, 8248, 8249, 5, 2, 0, 0, 8249, 8250, 3, 606, 303, 0, 8250, 8252, 5, 3, 0, 0, 8251, 8253, 3, 1104, 552, 0, 8252, 8251, 1, 0, 0, 0, 8252, 8253, 1, 0, 0, 0, 8253, 8258, 1, 0, 0, 0, 8254, 8255, 5, 80, 0, 0, 8255, 8256, 5, 45, 0, 0, 8256, 8258, 3, 1352, 676, 0, 8257, 8248, 1, 0, 0, 0, 8257, 8254, 1, 0, 0, 0, 8258, 927, 1, 0, 0, 0, 8259, 8260, 5, 87, 0, 0, 8260, 8261, 3, 1340, 670, 0, 8261, 929, 1, 0, 0, 0, 8262, 8264, 3, 982, 491, 0, 8263, 8262, 1, 0, 0, 0, 8263, 8264, 1, 0, 0, 0, 8264, 8265, 1, 0, 0, 0, 8265, 8266, 5, 253, 0, 0, 8266, 8268, 5, 71, 0, 0, 8267, 8269, 5, 81, 0, 0, 8268, 8267, 1, 0, 0, 0, 8268, 8269, 1, 0, 0, 0, 8269, 8270, 1, 0, 0, 0, 8270, 8272, 3, 1348, 674, 0, 8271, 8273, 3, 1072, 536, 0, 8272, 8271, 1, 0, 0, 0, 8272, 8273, 1, 0, 0, 0, 8273, 8274, 1, 0, 0, 0, 8274, 8277, 5, 100, 0, 0, 8275, 8278, 3, 972, 486, 0, 8276, 8278, 3, 1348, 674, 0, 8277, 8275, 1, 0, 0, 0, 8277, 8276, 1, 0, 0, 0, 8278, 8280, 1, 0, 0, 0, 8279, 8281, 3, 1072, 536, 0, 8280, 8279, 1, 0, 0, 0, 8280, 8281, 1, 0, 0, 0, 8281, 8282, 1, 0, 0, 0, 8282, 8283, 5, 80, 0, 0, 8283, 8292, 3, 1172, 586, 0, 8284, 8286, 3, 932, 466, 0, 8285, 8287, 3, 934, 467, 0, 8286, 8285, 1, 0, 0, 0, 8286, 8287, 1, 0, 0, 0, 8287, 8293, 1, 0, 0, 0, 8288, 8290, 3, 934, 467, 0, 8289, 8291, 3, 932, 466, 0, 8290, 8289, 1, 0, 0, 0, 8290, 8291, 1, 0, 0, 0, 8291, 8293, 1, 0, 0, 0, 8292, 8284, 1, 0, 0, 0, 8292, 8288, 1, 0, 0, 0, 8293, 8295, 1, 0, 0, 0, 8294, 8296, 3, 936, 468, 0, 8295, 8294, 1, 0, 0, 0, 8295, 8296, 1, 0, 0, 0, 8296, 931, 1, 0, 0, 0, 8297, 8298, 5, 102, 0, 0, 8298, 8299, 5, 77, 0, 0, 8299, 8302, 5, 250, 0, 0, 8300, 8301, 5, 33, 0, 0, 8301, 8303, 3, 1172, 586, 0, 8302, 8300, 1, 0, 0, 0, 8302, 8303, 1, 0, 0, 0, 8303, 8305, 1, 0, 0, 0, 8304, 8306, 5, 93, 0, 0, 8305, 8304, 1, 0, 0, 0, 8305, 8306, 1, 0, 0, 0, 8306, 8307, 1, 0, 0, 0, 8307, 8312, 5, 232, 0, 0, 8308, 8309, 5, 2, 0, 0, 8309, 8310, 3, 920, 460, 0, 8310, 8311, 5, 3, 0, 0, 8311, 8313, 1, 0, 0, 0, 8312, 8308, 1, 0, 0, 0, 8312, 8313, 1, 0, 0, 0, 8313, 8314, 1, 0, 0, 0, 8314, 8315, 3, 1062, 531, 0, 8315, 933, 1, 0, 0, 0, 8316, 8317, 5, 102, 0, 0, 8317, 8320, 5, 250, 0, 0, 8318, 8319, 5, 33, 0, 0, 8319, 8321, 3, 1172, 586, 0, 8320, 8318, 1, 0, 0, 0, 8320, 8321, 1, 0, 0, 0, 8321, 8323, 1, 0, 0, 0, 8322, 8324, 5, 93, 0, 0, 8323, 8322, 1, 0, 0, 0, 8323, 8324, 1, 0, 0, 0, 8324, 8325, 1, 0, 0, 0, 8325, 8326, 5, 362, 0, 0, 8326, 8327, 5, 326, 0, 0, 8327, 8328, 3, 954, 477, 0, 8328, 935, 1, 0, 0, 0, 8329, 8330, 5, 102, 0, 0, 8330, 8332, 5, 250, 0, 0, 8331, 8333, 5, 93, 0, 0, 8332, 8331, 1, 0, 0, 0, 8332, 8333, 1, 0, 0, 0, 8333, 8334, 1, 0, 0, 0, 8334, 8335, 5, 182, 0, 0, 8335, 937, 1, 0, 0, 0, 8336, 8338, 3, 990, 495, 0, 8337, 8336, 1, 0, 0, 0, 8337, 8338, 1, 0, 0, 0, 8338, 8339, 1, 0, 0, 0, 8339, 8340, 5, 182, 0, 0, 8340, 8341, 5, 64, 0, 0, 8341, 8343, 3, 1088, 544, 0, 8342, 8344, 3, 940, 470, 0, 8343, 8342, 1, 0, 0, 0, 8343, 8344, 1, 0, 0, 0, 8344, 8346, 1, 0, 0, 0, 8345, 8347, 3, 1106, 553, 0, 8346, 8345, 1, 0, 0, 0, 8346, 8347, 1, 0, 0, 0, 8347, 8349, 1, 0, 0, 0, 8348, 8350, 3, 928, 464, 0, 8349, 8348, 1, 0, 0, 0, 8349, 8350, 1, 0, 0, 0, 8350, 939, 1, 0, 0, 0, 8351, 8352, 5, 100, 0, 0, 8352, 8353, 3, 1066, 533, 0, 8353, 941, 1, 0, 0, 0, 8354, 8356, 5, 247, 0, 0, 8355, 8357, 3, 998, 499, 0, 8356, 8355, 1, 0, 0, 0, 8356, 8357, 1, 0, 0, 0, 8357, 8358, 1, 0, 0, 0, 8358, 8360, 3, 1086, 543, 0, 8359, 8361, 3, 944, 472, 0, 8360, 8359, 1, 0, 0, 0, 8360, 8361, 1, 0, 0, 0, 8361, 8363, 1, 0, 0, 0, 8362, 8364, 3, 948, 474, 0, 8363, 8362, 1, 0, 0, 0, 8363, 8364, 1, 0, 0, 0, 8364, 943, 1, 0, 0, 0, 8365, 8366, 5, 68, 0, 0, 8366, 8367, 3, 946, 473, 0, 8367, 8368, 5, 256, 0, 0, 8368, 945, 1, 0, 0, 0, 8369, 8370, 5, 131, 0, 0, 8370, 8382, 7, 41, 0, 0, 8371, 8372, 5, 409, 0, 0, 8372, 8382, 7, 41, 0, 0, 8373, 8378, 5, 327, 0, 0, 8374, 8375, 5, 362, 0, 0, 8375, 8379, 5, 201, 0, 0, 8376, 8377, 5, 409, 0, 0, 8377, 8379, 5, 201, 0, 0, 8378, 8374, 1, 0, 0, 0, 8378, 8376, 1, 0, 0, 0, 8378, 8379, 1, 0, 0, 0, 8379, 8382, 1, 0, 0, 0, 8380, 8382, 5, 201, 0, 0, 8381, 8369, 1, 0, 0, 0, 8381, 8371, 1, 0, 0, 0, 8381, 8373, 1, 0, 0, 0, 8381, 8380, 1, 0, 0, 0, 8382, 947, 1, 0, 0, 0, 8383, 8384, 5, 265, 0, 0, 8384, 949, 1, 0, 0, 0, 8385, 8389, 5, 265, 0, 0, 8386, 8387, 5, 467, 0, 0, 8387, 8389, 5, 468, 0, 0, 8388, 8385, 1, 0, 0, 0, 8388, 8386, 1, 0, 0, 0, 8389, 951, 1, 0, 0, 0, 8390, 8392, 3, 990, 495, 0, 8391, 8390, 1, 0, 0, 0, 8391, 8392, 1, 0, 0, 0, 8392, 8393, 1, 0, 0, 0, 8393, 8394, 5, 362, 0, 0, 8394, 8395, 3, 1088, 544, 0, 8395, 8396, 5, 326, 0, 0, 8396, 8398, 3, 954, 477, 0, 8397, 8399, 3, 1064, 532, 0, 8398, 8397, 1, 0, 0, 0, 8398, 8399, 1, 0, 0, 0, 8399, 8401, 1, 0, 0, 0, 8400, 8402, 3, 1106, 553, 0, 8401, 8400, 1, 0, 0, 0, 8401, 8402, 1, 0, 0, 0, 8402, 8404, 1, 0, 0, 0, 8403, 8405, 3, 928, 464, 0, 8404, 8403, 1, 0, 0, 0, 8404, 8405, 1, 0, 0, 0, 8405, 953, 1, 0, 0, 0, 8406, 8411, 3, 956, 478, 0, 8407, 8408, 5, 6, 0, 0, 8408, 8410, 3, 956, 478, 0, 8409, 8407, 1, 0, 0, 0, 8410, 8413, 1, 0, 0, 0, 8411, 8409, 1, 0, 0, 0, 8411, 8412, 1, 0, 0, 0, 8412, 955, 1, 0, 0, 0, 8413, 8411, 1, 0, 0, 0, 8414, 8415, 3, 958, 479, 0, 8415, 8416, 5, 10, 0, 0, 8416, 8417, 3, 1172, 586, 0, 8417, 8425, 1, 0, 0, 0, 8418, 8419, 5, 2, 0, 0, 8419, 8420, 3, 960, 480, 0, 8420, 8421, 5, 3, 0, 0, 8421, 8422, 5, 10, 0, 0, 8422, 8423, 3, 1172, 586, 0, 8423, 8425, 1, 0, 0, 0, 8424, 8414, 1, 0, 0, 0, 8424, 8418, 1, 0, 0, 0, 8425, 957, 1, 0, 0, 0, 8426, 8427, 3, 1384, 692, 0, 8427, 8428, 3, 1336, 668, 0, 8428, 959, 1, 0, 0, 0, 8429, 8434, 3, 958, 479, 0, 8430, 8431, 5, 6, 0, 0, 8431, 8433, 3, 958, 479, 0, 8432, 8430, 1, 0, 0, 0, 8433, 8436, 1, 0, 0, 0, 8434, 8432, 1, 0, 0, 0, 8434, 8435, 1, 0, 0, 0, 8435, 961, 1, 0, 0, 0, 8436, 8434, 1, 0, 0, 0, 8437, 8438, 5, 178, 0, 0, 8438, 8439, 3, 964, 482, 0, 8439, 8440, 3, 966, 483, 0, 8440, 8442, 5, 172, 0, 0, 8441, 8443, 3, 968, 484, 0, 8442, 8441, 1, 0, 0, 0, 8442, 8443, 1, 0, 0, 0, 8443, 8444, 1, 0, 0, 0, 8444, 8445, 5, 62, 0, 0, 8445, 8446, 3, 970, 485, 0, 8446, 963, 1, 0, 0, 0, 8447, 8448, 3, 1352, 676, 0, 8448, 965, 1, 0, 0, 0, 8449, 8450, 5, 262, 0, 0, 8450, 8455, 5, 317, 0, 0, 8451, 8455, 5, 317, 0, 0, 8452, 8455, 5, 107, 0, 0, 8453, 8455, 5, 231, 0, 0, 8454, 8449, 1, 0, 0, 0, 8454, 8451, 1, 0, 0, 0, 8454, 8452, 1, 0, 0, 0, 8454, 8453, 1, 0, 0, 0, 8455, 8458, 1, 0, 0, 0, 8456, 8454, 1, 0, 0, 0, 8456, 8457, 1, 0, 0, 0, 8457, 967, 1, 0, 0, 0, 8458, 8456, 1, 0, 0, 0, 8459, 8460, 5, 105, 0, 0, 8460, 8464, 5, 217, 0, 0, 8461, 8462, 5, 372, 0, 0, 8462, 8464, 5, 217, 0, 0, 8463, 8459, 1, 0, 0, 0, 8463, 8461, 1, 0, 0, 0, 8464, 969, 1, 0, 0, 0, 8465, 8468, 3, 974, 487, 0, 8466, 8468, 3, 972, 486, 0, 8467, 8465, 1, 0, 0, 0, 8467, 8466, 1, 0, 0, 0, 8468, 971, 1, 0, 0, 0, 8469, 8470, 5, 2, 0, 0, 8470, 8471, 3, 974, 487, 0, 8471, 8472, 5, 3, 0, 0, 8472, 8478, 1, 0, 0, 0, 8473, 8474, 5, 2, 0, 0, 8474, 8475, 3, 972, 486, 0, 8475, 8476, 5, 3, 0, 0, 8476, 8478, 1, 0, 0, 0, 8477, 8469, 1, 0, 0, 0, 8477, 8473, 1, 0, 0, 0, 8478, 973, 1, 0, 0, 0, 8479, 8481, 3, 976, 488, 0, 8480, 8482, 3, 1006, 503, 0, 8481, 8480, 1, 0, 0, 0, 8481, 8482, 1, 0, 0, 0, 8482, 8491, 1, 0, 0, 0, 8483, 8485, 3, 1050, 525, 0, 8484, 8486, 3, 1016, 508, 0, 8485, 8484, 1, 0, 0, 0, 8485, 8486, 1, 0, 0, 0, 8486, 8492, 1, 0, 0, 0, 8487, 8489, 3, 1014, 507, 0, 8488, 8490, 3, 1052, 526, 0, 8489, 8488, 1, 0, 0, 0, 8489, 8490, 1, 0, 0, 0, 8490, 8492, 1, 0, 0, 0, 8491, 8483, 1, 0, 0, 0, 8491, 8487, 1, 0, 0, 0, 8491, 8492, 1, 0, 0, 0, 8492, 8509, 1, 0, 0, 0, 8493, 8494, 3, 982, 491, 0, 8494, 8496, 3, 976, 488, 0, 8495, 8497, 3, 1006, 503, 0, 8496, 8495, 1, 0, 0, 0, 8496, 8497, 1, 0, 0, 0, 8497, 8506, 1, 0, 0, 0, 8498, 8500, 3, 1050, 525, 0, 8499, 8501, 3, 1016, 508, 0, 8500, 8499, 1, 0, 0, 0, 8500, 8501, 1, 0, 0, 0, 8501, 8507, 1, 0, 0, 0, 8502, 8504, 3, 1014, 507, 0, 8503, 8505, 3, 1052, 526, 0, 8504, 8503, 1, 0, 0, 0, 8504, 8505, 1, 0, 0, 0, 8505, 8507, 1, 0, 0, 0, 8506, 8498, 1, 0, 0, 0, 8506, 8502, 1, 0, 0, 0, 8506, 8507, 1, 0, 0, 0, 8507, 8509, 1, 0, 0, 0, 8508, 8479, 1, 0, 0, 0, 8508, 8493, 1, 0, 0, 0, 8509, 975, 1, 0, 0, 0, 8510, 8518, 3, 978, 489, 0, 8511, 8513, 7, 42, 0, 0, 8512, 8514, 3, 1000, 500, 0, 8513, 8512, 1, 0, 0, 0, 8513, 8514, 1, 0, 0, 0, 8514, 8515, 1, 0, 0, 0, 8515, 8517, 3, 978, 489, 0, 8516, 8511, 1, 0, 0, 0, 8517, 8520, 1, 0, 0, 0, 8518, 8516, 1, 0, 0, 0, 8518, 8519, 1, 0, 0, 0, 8519, 977, 1, 0, 0, 0, 8520, 8518, 1, 0, 0, 0, 8521, 8529, 3, 980, 490, 0, 8522, 8524, 5, 70, 0, 0, 8523, 8525, 3, 1000, 500, 0, 8524, 8523, 1, 0, 0, 0, 8524, 8525, 1, 0, 0, 0, 8525, 8526, 1, 0, 0, 0, 8526, 8528, 3, 980, 490, 0, 8527, 8522, 1, 0, 0, 0, 8528, 8531, 1, 0, 0, 0, 8529, 8527, 1, 0, 0, 0, 8529, 8530, 1, 0, 0, 0, 8530, 979, 1, 0, 0, 0, 8531, 8529, 1, 0, 0, 0, 8532, 8545, 5, 88, 0, 0, 8533, 8535, 3, 1004, 502, 0, 8534, 8533, 1, 0, 0, 0, 8534, 8535, 1, 0, 0, 0, 8535, 8537, 1, 0, 0, 0, 8536, 8538, 3, 992, 496, 0, 8537, 8536, 1, 0, 0, 0, 8537, 8538, 1, 0, 0, 0, 8538, 8540, 1, 0, 0, 0, 8539, 8541, 3, 1338, 669, 0, 8540, 8539, 1, 0, 0, 0, 8540, 8541, 1, 0, 0, 0, 8541, 8546, 1, 0, 0, 0, 8542, 8543, 3, 1002, 501, 0, 8543, 8544, 3, 1340, 670, 0, 8544, 8546, 1, 0, 0, 0, 8545, 8534, 1, 0, 0, 0, 8545, 8542, 1, 0, 0, 0, 8546, 8548, 1, 0, 0, 0, 8547, 8549, 3, 992, 496, 0, 8548, 8547, 1, 0, 0, 0, 8548, 8549, 1, 0, 0, 0, 8549, 8551, 1, 0, 0, 0, 8550, 8552, 3, 1064, 532, 0, 8551, 8550, 1, 0, 0, 0, 8551, 8552, 1, 0, 0, 0, 8552, 8554, 1, 0, 0, 0, 8553, 8555, 3, 1104, 552, 0, 8554, 8553, 1, 0, 0, 0, 8554, 8555, 1, 0, 0, 0, 8555, 8557, 1, 0, 0, 0, 8556, 8558, 3, 1034, 517, 0, 8557, 8556, 1, 0, 0, 0, 8557, 8558, 1, 0, 0, 0, 8558, 8560, 1, 0, 0, 0, 8559, 8561, 3, 1048, 524, 0, 8560, 8559, 1, 0, 0, 0, 8560, 8561, 1, 0, 0, 0, 8561, 8563, 1, 0, 0, 0, 8562, 8564, 3, 1250, 625, 0, 8563, 8562, 1, 0, 0, 0, 8563, 8564, 1, 0, 0, 0, 8564, 8570, 1, 0, 0, 0, 8565, 8570, 3, 1062, 531, 0, 8566, 8567, 5, 92, 0, 0, 8567, 8570, 3, 1084, 542, 0, 8568, 8570, 3, 972, 486, 0, 8569, 8532, 1, 0, 0, 0, 8569, 8565, 1, 0, 0, 0, 8569, 8566, 1, 0, 0, 0, 8569, 8568, 1, 0, 0, 0, 8570, 981, 1, 0, 0, 0, 8571, 8573, 5, 105, 0, 0, 8572, 8574, 5, 296, 0, 0, 8573, 8572, 1, 0, 0, 0, 8573, 8574, 1, 0, 0, 0, 8574, 8575, 1, 0, 0, 0, 8575, 8576, 3, 984, 492, 0, 8576, 983, 1, 0, 0, 0, 8577, 8582, 3, 986, 493, 0, 8578, 8579, 5, 6, 0, 0, 8579, 8581, 3, 986, 493, 0, 8580, 8578, 1, 0, 0, 0, 8581, 8584, 1, 0, 0, 0, 8582, 8580, 1, 0, 0, 0, 8582, 8583, 1, 0, 0, 0, 8583, 985, 1, 0, 0, 0, 8584, 8582, 1, 0, 0, 0, 8585, 8587, 3, 1352, 676, 0, 8586, 8588, 3, 880, 440, 0, 8587, 8586, 1, 0, 0, 0, 8587, 8588, 1, 0, 0, 0, 8588, 8589, 1, 0, 0, 0, 8589, 8591, 5, 36, 0, 0, 8590, 8592, 3, 988, 494, 0, 8591, 8590, 1, 0, 0, 0, 8591, 8592, 1, 0, 0, 0, 8592, 8593, 1, 0, 0, 0, 8593, 8594, 5, 2, 0, 0, 8594, 8595, 3, 904, 452, 0, 8595, 8596, 5, 3, 0, 0, 8596, 987, 1, 0, 0, 0, 8597, 8601, 5, 251, 0, 0, 8598, 8599, 5, 77, 0, 0, 8599, 8601, 5, 251, 0, 0, 8600, 8597, 1, 0, 0, 0, 8600, 8598, 1, 0, 0, 0, 8601, 989, 1, 0, 0, 0, 8602, 8603, 3, 982, 491, 0, 8603, 991, 1, 0, 0, 0, 8604, 8610, 5, 71, 0, 0, 8605, 8607, 3, 994, 497, 0, 8606, 8605, 1, 0, 0, 0, 8606, 8607, 1, 0, 0, 0, 8607, 8608, 1, 0, 0, 0, 8608, 8611, 3, 996, 498, 0, 8609, 8611, 3, 1578, 789, 0, 8610, 8606, 1, 0, 0, 0, 8610, 8609, 1, 0, 0, 0, 8611, 993, 1, 0, 0, 0, 8612, 8613, 5, 339, 0, 0, 8613, 995, 1, 0, 0, 0, 8614, 8616, 7, 43, 0, 0, 8615, 8614, 1, 0, 0, 0, 8615, 8616, 1, 0, 0, 0, 8616, 8617, 1, 0, 0, 0, 8617, 8619, 7, 12, 0, 0, 8618, 8620, 3, 998, 499, 0, 8619, 8618, 1, 0, 0, 0, 8619, 8620, 1, 0, 0, 0, 8620, 8621, 1, 0, 0, 0, 8621, 8631, 3, 1348, 674, 0, 8622, 8624, 5, 360, 0, 0, 8623, 8625, 3, 998, 499, 0, 8624, 8623, 1, 0, 0, 0, 8624, 8625, 1, 0, 0, 0, 8625, 8626, 1, 0, 0, 0, 8626, 8631, 3, 1348, 674, 0, 8627, 8628, 5, 92, 0, 0, 8628, 8631, 3, 1348, 674, 0, 8629, 8631, 3, 1348, 674, 0, 8630, 8615, 1, 0, 0, 0, 8630, 8622, 1, 0, 0, 0, 8630, 8627, 1, 0, 0, 0, 8630, 8629, 1, 0, 0, 0, 8631, 997, 1, 0, 0, 0, 8632, 8633, 5, 92, 0, 0, 8633, 999, 1, 0, 0, 0, 8634, 8635, 7, 44, 0, 0, 8635, 1001, 1, 0, 0, 0, 8636, 8642, 5, 56, 0, 0, 8637, 8638, 5, 80, 0, 0, 8638, 8639, 5, 2, 0, 0, 8639, 8640, 3, 1290, 645, 0, 8640, 8641, 5, 3, 0, 0, 8641, 8643, 1, 0, 0, 0, 8642, 8637, 1, 0, 0, 0, 8642, 8643, 1, 0, 0, 0, 8643, 1003, 1, 0, 0, 0, 8644, 8645, 5, 30, 0, 0, 8645, 1005, 1, 0, 0, 0, 8646, 8647, 3, 1008, 504, 0, 8647, 1007, 1, 0, 0, 0, 8648, 8649, 5, 83, 0, 0, 8649, 8650, 5, 147, 0, 0, 8650, 8651, 3, 1010, 505, 0, 8651, 1009, 1, 0, 0, 0, 8652, 8657, 3, 1012, 506, 0, 8653, 8654, 5, 6, 0, 0, 8654, 8656, 3, 1012, 506, 0, 8655, 8653, 1, 0, 0, 0, 8656, 8659, 1, 0, 0, 0, 8657, 8655, 1, 0, 0, 0, 8657, 8658, 1, 0, 0, 0, 8658, 1011, 1, 0, 0, 0, 8659, 8657, 1, 0, 0, 0, 8660, 8666, 3, 1172, 586, 0, 8661, 8662, 5, 100, 0, 0, 8662, 8667, 3, 1286, 643, 0, 8663, 8665, 3, 620, 310, 0, 8664, 8663, 1, 0, 0, 0, 8664, 8665, 1, 0, 0, 0, 8665, 8667, 1, 0, 0, 0, 8666, 8661, 1, 0, 0, 0, 8666, 8664, 1, 0, 0, 0, 8667, 8669, 1, 0, 0, 0, 8668, 8670, 3, 622, 311, 0, 8669, 8668, 1, 0, 0, 0, 8669, 8670, 1, 0, 0, 0, 8670, 1013, 1, 0, 0, 0, 8671, 8673, 3, 1018, 509, 0, 8672, 8674, 3, 1020, 510, 0, 8673, 8672, 1, 0, 0, 0, 8673, 8674, 1, 0, 0, 0, 8674, 8680, 1, 0, 0, 0, 8675, 8677, 3, 1020, 510, 0, 8676, 8678, 3, 1018, 509, 0, 8677, 8676, 1, 0, 0, 0, 8677, 8678, 1, 0, 0, 0, 8678, 8680, 1, 0, 0, 0, 8679, 8671, 1, 0, 0, 0, 8679, 8675, 1, 0, 0, 0, 8680, 1015, 1, 0, 0, 0, 8681, 8682, 3, 1014, 507, 0, 8682, 1017, 1, 0, 0, 0, 8683, 8684, 5, 74, 0, 0, 8684, 8687, 3, 1022, 511, 0, 8685, 8686, 5, 6, 0, 0, 8686, 8688, 3, 1024, 512, 0, 8687, 8685, 1, 0, 0, 0, 8687, 8688, 1, 0, 0, 0, 8688, 8707, 1, 0, 0, 0, 8689, 8690, 5, 61, 0, 0, 8690, 8704, 3, 1032, 516, 0, 8691, 8692, 3, 1026, 513, 0, 8692, 8696, 3, 1030, 515, 0, 8693, 8697, 5, 81, 0, 0, 8694, 8695, 5, 105, 0, 0, 8695, 8697, 5, 469, 0, 0, 8696, 8693, 1, 0, 0, 0, 8696, 8694, 1, 0, 0, 0, 8697, 8705, 1, 0, 0, 0, 8698, 8702, 3, 1030, 515, 0, 8699, 8703, 5, 81, 0, 0, 8700, 8701, 5, 105, 0, 0, 8701, 8703, 5, 469, 0, 0, 8702, 8699, 1, 0, 0, 0, 8702, 8700, 1, 0, 0, 0, 8703, 8705, 1, 0, 0, 0, 8704, 8691, 1, 0, 0, 0, 8704, 8698, 1, 0, 0, 0, 8705, 8707, 1, 0, 0, 0, 8706, 8683, 1, 0, 0, 0, 8706, 8689, 1, 0, 0, 0, 8707, 1019, 1, 0, 0, 0, 8708, 8713, 5, 79, 0, 0, 8709, 8714, 3, 1024, 512, 0, 8710, 8711, 3, 1026, 513, 0, 8711, 8712, 3, 1030, 515, 0, 8712, 8714, 1, 0, 0, 0, 8713, 8709, 1, 0, 0, 0, 8713, 8710, 1, 0, 0, 0, 8714, 1021, 1, 0, 0, 0, 8715, 8718, 3, 1172, 586, 0, 8716, 8718, 5, 30, 0, 0, 8717, 8715, 1, 0, 0, 0, 8717, 8716, 1, 0, 0, 0, 8718, 1023, 1, 0, 0, 0, 8719, 8720, 3, 1172, 586, 0, 8720, 1025, 1, 0, 0, 0, 8721, 8727, 3, 1216, 608, 0, 8722, 8723, 5, 12, 0, 0, 8723, 8727, 3, 1028, 514, 0, 8724, 8725, 5, 13, 0, 0, 8725, 8727, 3, 1028, 514, 0, 8726, 8721, 1, 0, 0, 0, 8726, 8722, 1, 0, 0, 0, 8726, 8724, 1, 0, 0, 0, 8727, 1027, 1, 0, 0, 0, 8728, 8731, 3, 1368, 684, 0, 8729, 8731, 3, 1366, 683, 0, 8730, 8728, 1, 0, 0, 0, 8730, 8729, 1, 0, 0, 0, 8731, 1029, 1, 0, 0, 0, 8732, 8733, 7, 45, 0, 0, 8733, 1031, 1, 0, 0, 0, 8734, 8735, 7, 46, 0, 0, 8735, 1033, 1, 0, 0, 0, 8736, 8737, 5, 66, 0, 0, 8737, 8738, 5, 147, 0, 0, 8738, 8739, 3, 1036, 518, 0, 8739, 1035, 1, 0, 0, 0, 8740, 8745, 3, 1038, 519, 0, 8741, 8742, 5, 6, 0, 0, 8742, 8744, 3, 1038, 519, 0, 8743, 8741, 1, 0, 0, 0, 8744, 8747, 1, 0, 0, 0, 8745, 8743, 1, 0, 0, 0, 8745, 8746, 1, 0, 0, 0, 8746, 1037, 1, 0, 0, 0, 8747, 8745, 1, 0, 0, 0, 8748, 8754, 3, 1172, 586, 0, 8749, 8754, 3, 1040, 520, 0, 8750, 8754, 3, 1044, 522, 0, 8751, 8754, 3, 1042, 521, 0, 8752, 8754, 3, 1046, 523, 0, 8753, 8748, 1, 0, 0, 0, 8753, 8749, 1, 0, 0, 0, 8753, 8750, 1, 0, 0, 0, 8753, 8751, 1, 0, 0, 0, 8753, 8752, 1, 0, 0, 0, 8754, 1039, 1, 0, 0, 0, 8755, 8756, 5, 2, 0, 0, 8756, 8757, 5, 3, 0, 0, 8757, 1041, 1, 0, 0, 0, 8758, 8759, 5, 470, 0, 0, 8759, 8760, 5, 2, 0, 0, 8760, 8761, 3, 1290, 645, 0, 8761, 8762, 5, 3, 0, 0, 8762, 1043, 1, 0, 0, 0, 8763, 8764, 5, 471, 0, 0, 8764, 8765, 5, 2, 0, 0, 8765, 8766, 3, 1290, 645, 0, 8766, 8767, 5, 3, 0, 0, 8767, 1045, 1, 0, 0, 0, 8768, 8769, 5, 472, 0, 0, 8769, 8770, 5, 473, 0, 0, 8770, 8771, 5, 2, 0, 0, 8771, 8772, 3, 1036, 518, 0, 8772, 8773, 5, 3, 0, 0, 8773, 1047, 1, 0, 0, 0, 8774, 8775, 5, 67, 0, 0, 8775, 8776, 3, 1172, 586, 0, 8776, 1049, 1, 0, 0, 0, 8777, 8782, 3, 1054, 527, 0, 8778, 8779, 5, 62, 0, 0, 8779, 8780, 5, 293, 0, 0, 8780, 8782, 5, 81, 0, 0, 8781, 8777, 1, 0, 0, 0, 8781, 8778, 1, 0, 0, 0, 8782, 1051, 1, 0, 0, 0, 8783, 8784, 3, 1050, 525, 0, 8784, 1053, 1, 0, 0, 0, 8785, 8787, 3, 1056, 528, 0, 8786, 8785, 1, 0, 0, 0, 8787, 8788, 1, 0, 0, 0, 8788, 8786, 1, 0, 0, 0, 8788, 8789, 1, 0, 0, 0, 8789, 1055, 1, 0, 0, 0, 8790, 8792, 3, 1058, 529, 0, 8791, 8793, 3, 1060, 530, 0, 8792, 8791, 1, 0, 0, 0, 8792, 8793, 1, 0, 0, 0, 8793, 8795, 1, 0, 0, 0, 8794, 8796, 3, 950, 475, 0, 8795, 8794, 1, 0, 0, 0, 8795, 8796, 1, 0, 0, 0, 8796, 1057, 1, 0, 0, 0, 8797, 8807, 5, 62, 0, 0, 8798, 8799, 5, 262, 0, 0, 8799, 8801, 5, 236, 0, 0, 8800, 8798, 1, 0, 0, 0, 8800, 8801, 1, 0, 0, 0, 8801, 8802, 1, 0, 0, 0, 8802, 8808, 5, 362, 0, 0, 8803, 8805, 5, 236, 0, 0, 8804, 8803, 1, 0, 0, 0, 8804, 8805, 1, 0, 0, 0, 8805, 8806, 1, 0, 0, 0, 8806, 8808, 5, 327, 0, 0, 8807, 8800, 1, 0, 0, 0, 8807, 8804, 1, 0, 0, 0, 8808, 1059, 1, 0, 0, 0, 8809, 8810, 5, 268, 0, 0, 8810, 8811, 3, 1346, 673, 0, 8811, 1061, 1, 0, 0, 0, 8812, 8813, 5, 417, 0, 0, 8813, 8814, 5, 2, 0, 0, 8814, 8815, 3, 1290, 645, 0, 8815, 8823, 5, 3, 0, 0, 8816, 8817, 5, 6, 0, 0, 8817, 8818, 5, 2, 0, 0, 8818, 8819, 3, 1290, 645, 0, 8819, 8820, 5, 3, 0, 0, 8820, 8822, 1, 0, 0, 0, 8821, 8816, 1, 0, 0, 0, 8822, 8825, 1, 0, 0, 0, 8823, 8821, 1, 0, 0, 0, 8823, 8824, 1, 0, 0, 0, 8824, 1063, 1, 0, 0, 0, 8825, 8823, 1, 0, 0, 0, 8826, 8827, 5, 64, 0, 0, 8827, 8828, 3, 1066, 533, 0, 8828, 1065, 1, 0, 0, 0, 8829, 8834, 3, 1068, 534, 0, 8830, 8831, 5, 6, 0, 0, 8831, 8833, 3, 1068, 534, 0, 8832, 8830, 1, 0, 0, 0, 8833, 8836, 1, 0, 0, 0, 8834, 8832, 1, 0, 0, 0, 8834, 8835, 1, 0, 0, 0, 8835, 1067, 1, 0, 0, 0, 8836, 8834, 1, 0, 0, 0, 8837, 8839, 3, 1084, 542, 0, 8838, 8840, 3, 1074, 537, 0, 8839, 8838, 1, 0, 0, 0, 8839, 8840, 1, 0, 0, 0, 8840, 8842, 1, 0, 0, 0, 8841, 8843, 3, 1090, 545, 0, 8842, 8841, 1, 0, 0, 0, 8842, 8843, 1, 0, 0, 0, 8843, 8896, 1, 0, 0, 0, 8844, 8846, 3, 1094, 547, 0, 8845, 8847, 3, 1078, 539, 0, 8846, 8845, 1, 0, 0, 0, 8846, 8847, 1, 0, 0, 0, 8847, 8896, 1, 0, 0, 0, 8848, 8850, 3, 1114, 557, 0, 8849, 8851, 3, 1074, 537, 0, 8850, 8849, 1, 0, 0, 0, 8850, 8851, 1, 0, 0, 0, 8851, 8896, 1, 0, 0, 0, 8852, 8854, 3, 972, 486, 0, 8853, 8855, 3, 1074, 537, 0, 8854, 8853, 1, 0, 0, 0, 8854, 8855, 1, 0, 0, 0, 8855, 8896, 1, 0, 0, 0, 8856, 8869, 5, 72, 0, 0, 8857, 8859, 3, 1114, 557, 0, 8858, 8860, 3, 1074, 537, 0, 8859, 8858, 1, 0, 0, 0, 8859, 8860, 1, 0, 0, 0, 8860, 8870, 1, 0, 0, 0, 8861, 8863, 3, 1094, 547, 0, 8862, 8864, 3, 1078, 539, 0, 8863, 8862, 1, 0, 0, 0, 8863, 8864, 1, 0, 0, 0, 8864, 8870, 1, 0, 0, 0, 8865, 8867, 3, 972, 486, 0, 8866, 8868, 3, 1074, 537, 0, 8867, 8866, 1, 0, 0, 0, 8867, 8868, 1, 0, 0, 0, 8868, 8870, 1, 0, 0, 0, 8869, 8857, 1, 0, 0, 0, 8869, 8861, 1, 0, 0, 0, 8869, 8865, 1, 0, 0, 0, 8870, 8896, 1, 0, 0, 0, 8871, 8872, 5, 2, 0, 0, 8872, 8889, 3, 1068, 534, 0, 8873, 8874, 5, 110, 0, 0, 8874, 8875, 5, 118, 0, 0, 8875, 8890, 3, 1068, 534, 0, 8876, 8878, 5, 121, 0, 0, 8877, 8879, 3, 1080, 540, 0, 8878, 8877, 1, 0, 0, 0, 8878, 8879, 1, 0, 0, 0, 8879, 8880, 1, 0, 0, 0, 8880, 8881, 5, 118, 0, 0, 8881, 8890, 3, 1068, 534, 0, 8882, 8884, 3, 1080, 540, 0, 8883, 8882, 1, 0, 0, 0, 8883, 8884, 1, 0, 0, 0, 8884, 8885, 1, 0, 0, 0, 8885, 8886, 5, 118, 0, 0, 8886, 8887, 3, 1068, 534, 0, 8887, 8888, 3, 1082, 541, 0, 8888, 8890, 1, 0, 0, 0, 8889, 8873, 1, 0, 0, 0, 8889, 8876, 1, 0, 0, 0, 8889, 8883, 1, 0, 0, 0, 8889, 8890, 1, 0, 0, 0, 8890, 8891, 1, 0, 0, 0, 8891, 8893, 5, 3, 0, 0, 8892, 8894, 3, 1074, 537, 0, 8893, 8892, 1, 0, 0, 0, 8893, 8894, 1, 0, 0, 0, 8894, 8896, 1, 0, 0, 0, 8895, 8837, 1, 0, 0, 0, 8895, 8844, 1, 0, 0, 0, 8895, 8848, 1, 0, 0, 0, 8895, 8852, 1, 0, 0, 0, 8895, 8856, 1, 0, 0, 0, 8895, 8871, 1, 0, 0, 0, 8896, 8900, 1, 0, 0, 0, 8897, 8899, 3, 1070, 535, 0, 8898, 8897, 1, 0, 0, 0, 8899, 8902, 1, 0, 0, 0, 8900, 8898, 1, 0, 0, 0, 8900, 8901, 1, 0, 0, 0, 8901, 1069, 1, 0, 0, 0, 8902, 8900, 1, 0, 0, 0, 8903, 8905, 3, 1080, 540, 0, 8904, 8903, 1, 0, 0, 0, 8904, 8905, 1, 0, 0, 0, 8905, 8906, 1, 0, 0, 0, 8906, 8907, 5, 118, 0, 0, 8907, 8908, 3, 1068, 534, 0, 8908, 8909, 3, 1082, 541, 0, 8909, 8920, 1, 0, 0, 0, 8910, 8911, 5, 110, 0, 0, 8911, 8912, 5, 118, 0, 0, 8912, 8920, 3, 1068, 534, 0, 8913, 8915, 5, 121, 0, 0, 8914, 8916, 3, 1080, 540, 0, 8915, 8914, 1, 0, 0, 0, 8915, 8916, 1, 0, 0, 0, 8916, 8917, 1, 0, 0, 0, 8917, 8918, 5, 118, 0, 0, 8918, 8920, 3, 1068, 534, 0, 8919, 8904, 1, 0, 0, 0, 8919, 8910, 1, 0, 0, 0, 8919, 8913, 1, 0, 0, 0, 8920, 1071, 1, 0, 0, 0, 8921, 8923, 5, 36, 0, 0, 8922, 8921, 1, 0, 0, 0, 8922, 8923, 1, 0, 0, 0, 8923, 8924, 1, 0, 0, 0, 8924, 8929, 3, 1384, 692, 0, 8925, 8926, 5, 2, 0, 0, 8926, 8927, 3, 1350, 675, 0, 8927, 8928, 5, 3, 0, 0, 8928, 8930, 1, 0, 0, 0, 8929, 8925, 1, 0, 0, 0, 8929, 8930, 1, 0, 0, 0, 8930, 1073, 1, 0, 0, 0, 8931, 8932, 3, 1076, 538, 0, 8932, 1075, 1, 0, 0, 0, 8933, 8935, 5, 36, 0, 0, 8934, 8933, 1, 0, 0, 0, 8934, 8935, 1, 0, 0, 0, 8935, 8936, 1, 0, 0, 0, 8936, 8941, 3, 1386, 693, 0, 8937, 8938, 5, 2, 0, 0, 8938, 8939, 3, 1350, 675, 0, 8939, 8940, 5, 3, 0, 0, 8940, 8942, 1, 0, 0, 0, 8941, 8937, 1, 0, 0, 0, 8941, 8942, 1, 0, 0, 0, 8942, 1077, 1, 0, 0, 0, 8943, 8956, 3, 1072, 536, 0, 8944, 8946, 5, 36, 0, 0, 8945, 8947, 3, 1384, 692, 0, 8946, 8945, 1, 0, 0, 0, 8946, 8947, 1, 0, 0, 0, 8947, 8950, 1, 0, 0, 0, 8948, 8950, 3, 1384, 692, 0, 8949, 8944, 1, 0, 0, 0, 8949, 8948, 1, 0, 0, 0, 8950, 8951, 1, 0, 0, 0, 8951, 8952, 5, 2, 0, 0, 8952, 8953, 3, 1110, 555, 0, 8953, 8954, 5, 3, 0, 0, 8954, 8956, 1, 0, 0, 0, 8955, 8943, 1, 0, 0, 0, 8955, 8949, 1, 0, 0, 0, 8956, 1079, 1, 0, 0, 0, 8957, 8959, 7, 47, 0, 0, 8958, 8960, 5, 123, 0, 0, 8959, 8958, 1, 0, 0, 0, 8959, 8960, 1, 0, 0, 0, 8960, 1081, 1, 0, 0, 0, 8961, 8962, 5, 100, 0, 0, 8962, 8963, 5, 2, 0, 0, 8963, 8964, 3, 1350, 675, 0, 8964, 8965, 5, 3, 0, 0, 8965, 8969, 1, 0, 0, 0, 8966, 8967, 5, 80, 0, 0, 8967, 8969, 3, 1172, 586, 0, 8968, 8961, 1, 0, 0, 0, 8968, 8966, 1, 0, 0, 0, 8969, 1083, 1, 0, 0, 0, 8970, 8972, 3, 1348, 674, 0, 8971, 8973, 5, 9, 0, 0, 8972, 8971, 1, 0, 0, 0, 8972, 8973, 1, 0, 0, 0, 8973, 8983, 1, 0, 0, 0, 8974, 8980, 5, 81, 0, 0, 8975, 8981, 3, 1348, 674, 0, 8976, 8977, 5, 2, 0, 0, 8977, 8978, 3, 1348, 674, 0, 8978, 8979, 5, 3, 0, 0, 8979, 8981, 1, 0, 0, 0, 8980, 8975, 1, 0, 0, 0, 8980, 8976, 1, 0, 0, 0, 8981, 8983, 1, 0, 0, 0, 8982, 8970, 1, 0, 0, 0, 8982, 8974, 1, 0, 0, 0, 8983, 1085, 1, 0, 0, 0, 8984, 8989, 3, 1084, 542, 0, 8985, 8986, 5, 6, 0, 0, 8986, 8988, 3, 1084, 542, 0, 8987, 8985, 1, 0, 0, 0, 8988, 8991, 1, 0, 0, 0, 8989, 8987, 1, 0, 0, 0, 8989, 8990, 1, 0, 0, 0, 8990, 1087, 1, 0, 0, 0, 8991, 8989, 1, 0, 0, 0, 8992, 8997, 3, 1084, 542, 0, 8993, 8995, 5, 36, 0, 0, 8994, 8993, 1, 0, 0, 0, 8994, 8995, 1, 0, 0, 0, 8995, 8996, 1, 0, 0, 0, 8996, 8998, 3, 1384, 692, 0, 8997, 8994, 1, 0, 0, 0, 8997, 8998, 1, 0, 0, 0, 8998, 1089, 1, 0, 0, 0, 8999, 9000, 5, 474, 0, 0, 9000, 9001, 3, 1358, 679, 0, 9001, 9002, 5, 2, 0, 0, 9002, 9003, 3, 1290, 645, 0, 9003, 9005, 5, 3, 0, 0, 9004, 9006, 3, 1092, 546, 0, 9005, 9004, 1, 0, 0, 0, 9005, 9006, 1, 0, 0, 0, 9006, 1091, 1, 0, 0, 0, 9007, 9008, 5, 303, 0, 0, 9008, 9009, 5, 2, 0, 0, 9009, 9010, 3, 1172, 586, 0, 9010, 9011, 5, 3, 0, 0, 9011, 1093, 1, 0, 0, 0, 9012, 9014, 3, 1224, 612, 0, 9013, 9015, 3, 1102, 551, 0, 9014, 9013, 1, 0, 0, 0, 9014, 9015, 1, 0, 0, 0, 9015, 9025, 1, 0, 0, 0, 9016, 9017, 5, 313, 0, 0, 9017, 9018, 5, 64, 0, 0, 9018, 9019, 5, 2, 0, 0, 9019, 9020, 3, 1098, 549, 0, 9020, 9022, 5, 3, 0, 0, 9021, 9023, 3, 1102, 551, 0, 9022, 9021, 1, 0, 0, 0, 9022, 9023, 1, 0, 0, 0, 9023, 9025, 1, 0, 0, 0, 9024, 9012, 1, 0, 0, 0, 9024, 9016, 1, 0, 0, 0, 9025, 1095, 1, 0, 0, 0, 9026, 9028, 3, 1224, 612, 0, 9027, 9029, 3, 1100, 550, 0, 9028, 9027, 1, 0, 0, 0, 9028, 9029, 1, 0, 0, 0, 9029, 1097, 1, 0, 0, 0, 9030, 9035, 3, 1096, 548, 0, 9031, 9032, 5, 6, 0, 0, 9032, 9034, 3, 1096, 548, 0, 9033, 9031, 1, 0, 0, 0, 9034, 9037, 1, 0, 0, 0, 9035, 9033, 1, 0, 0, 0, 9035, 9036, 1, 0, 0, 0, 9036, 1099, 1, 0, 0, 0, 9037, 9035, 1, 0, 0, 0, 9038, 9039, 5, 36, 0, 0, 9039, 9040, 5, 2, 0, 0, 9040, 9041, 3, 1110, 555, 0, 9041, 9042, 5, 3, 0, 0, 9042, 1101, 1, 0, 0, 0, 9043, 9044, 5, 105, 0, 0, 9044, 9045, 5, 475, 0, 0, 9045, 1103, 1, 0, 0, 0, 9046, 9047, 5, 103, 0, 0, 9047, 9048, 3, 1172, 586, 0, 9048, 1105, 1, 0, 0, 0, 9049, 9054, 5, 103, 0, 0, 9050, 9051, 5, 436, 0, 0, 9051, 9052, 5, 268, 0, 0, 9052, 9055, 3, 964, 482, 0, 9053, 9055, 3, 1172, 586, 0, 9054, 9050, 1, 0, 0, 0, 9054, 9053, 1, 0, 0, 0, 9055, 1107, 1, 0, 0, 0, 9056, 9057, 3, 1110, 555, 0, 9057, 1109, 1, 0, 0, 0, 9058, 9063, 3, 1112, 556, 0, 9059, 9060, 5, 6, 0, 0, 9060, 9062, 3, 1112, 556, 0, 9061, 9059, 1, 0, 0, 0, 9062, 9065, 1, 0, 0, 0, 9063, 9061, 1, 0, 0, 0, 9063, 9064, 1, 0, 0, 0, 9064, 1111, 1, 0, 0, 0, 9065, 9063, 1, 0, 0, 0, 9066, 9067, 3, 1384, 692, 0, 9067, 9069, 3, 1128, 564, 0, 9068, 9070, 3, 110, 55, 0, 9069, 9068, 1, 0, 0, 0, 9069, 9070, 1, 0, 0, 0, 9070, 1113, 1, 0, 0, 0, 9071, 9072, 5, 476, 0, 0, 9072, 9088, 5, 2, 0, 0, 9073, 9074, 3, 1216, 608, 0, 9074, 9075, 3, 1242, 621, 0, 9075, 9076, 5, 477, 0, 0, 9076, 9077, 3, 1116, 558, 0, 9077, 9089, 1, 0, 0, 0, 9078, 9079, 5, 478, 0, 0, 9079, 9080, 5, 2, 0, 0, 9080, 9081, 3, 1124, 562, 0, 9081, 9082, 5, 3, 0, 0, 9082, 9083, 5, 6, 0, 0, 9083, 9084, 3, 1216, 608, 0, 9084, 9085, 3, 1242, 621, 0, 9085, 9086, 5, 477, 0, 0, 9086, 9087, 3, 1116, 558, 0, 9087, 9089, 1, 0, 0, 0, 9088, 9073, 1, 0, 0, 0, 9088, 9078, 1, 0, 0, 0, 9089, 9090, 1, 0, 0, 0, 9090, 9091, 5, 3, 0, 0, 9091, 1115, 1, 0, 0, 0, 9092, 9097, 3, 1118, 559, 0, 9093, 9094, 5, 6, 0, 0, 9094, 9096, 3, 1118, 559, 0, 9095, 9093, 1, 0, 0, 0, 9096, 9099, 1, 0, 0, 0, 9097, 9095, 1, 0, 0, 0, 9097, 9098, 1, 0, 0, 0, 9098, 1117, 1, 0, 0, 0, 9099, 9097, 1, 0, 0, 0, 9100, 9107, 3, 1384, 692, 0, 9101, 9103, 3, 1128, 564, 0, 9102, 9104, 3, 1120, 560, 0, 9103, 9102, 1, 0, 0, 0, 9103, 9104, 1, 0, 0, 0, 9104, 9108, 1, 0, 0, 0, 9105, 9106, 5, 62, 0, 0, 9106, 9108, 5, 475, 0, 0, 9107, 9101, 1, 0, 0, 0, 9107, 9105, 1, 0, 0, 0, 9108, 1119, 1, 0, 0, 0, 9109, 9111, 3, 1122, 561, 0, 9110, 9109, 1, 0, 0, 0, 9111, 9112, 1, 0, 0, 0, 9112, 9110, 1, 0, 0, 0, 9112, 9113, 1, 0, 0, 0, 9113, 1121, 1, 0, 0, 0, 9114, 9115, 5, 53, 0, 0, 9115, 9123, 3, 1172, 586, 0, 9116, 9117, 3, 1394, 697, 0, 9117, 9118, 3, 1172, 586, 0, 9118, 9123, 1, 0, 0, 0, 9119, 9120, 5, 77, 0, 0, 9120, 9123, 5, 78, 0, 0, 9121, 9123, 5, 78, 0, 0, 9122, 9114, 1, 0, 0, 0, 9122, 9116, 1, 0, 0, 0, 9122, 9119, 1, 0, 0, 0, 9122, 9121, 1, 0, 0, 0, 9123, 1123, 1, 0, 0, 0, 9124, 9129, 3, 1126, 563, 0, 9125, 9126, 5, 6, 0, 0, 9126, 9128, 3, 1126, 563, 0, 9127, 9125, 1, 0, 0, 0, 9128, 9131, 1, 0, 0, 0, 9129, 9127, 1, 0, 0, 0, 9129, 9130, 1, 0, 0, 0, 9130, 1125, 1, 0, 0, 0, 9131, 9129, 1, 0, 0, 0, 9132, 9133, 3, 1214, 607, 0, 9133, 9134, 5, 36, 0, 0, 9134, 9135, 3, 1392, 696, 0, 9135, 9139, 1, 0, 0, 0, 9136, 9137, 5, 53, 0, 0, 9137, 9139, 3, 1214, 607, 0, 9138, 9132, 1, 0, 0, 0, 9138, 9136, 1, 0, 0, 0, 9139, 1127, 1, 0, 0, 0, 9140, 9142, 5, 410, 0, 0, 9141, 9140, 1, 0, 0, 0, 9141, 9142, 1, 0, 0, 0, 9142, 9143, 1, 0, 0, 0, 9143, 9152, 3, 1132, 566, 0, 9144, 9153, 3, 1130, 565, 0, 9145, 9150, 5, 35, 0, 0, 9146, 9147, 5, 4, 0, 0, 9147, 9148, 3, 1368, 684, 0, 9148, 9149, 5, 5, 0, 0, 9149, 9151, 1, 0, 0, 0, 9150, 9146, 1, 0, 0, 0, 9150, 9151, 1, 0, 0, 0, 9151, 9153, 1, 0, 0, 0, 9152, 9144, 1, 0, 0, 0, 9152, 9145, 1, 0, 0, 0, 9153, 9159, 1, 0, 0, 0, 9154, 9155, 3, 1348, 674, 0, 9155, 9156, 5, 27, 0, 0, 9156, 9157, 7, 48, 0, 0, 9157, 9159, 1, 0, 0, 0, 9158, 9141, 1, 0, 0, 0, 9158, 9154, 1, 0, 0, 0, 9159, 1129, 1, 0, 0, 0, 9160, 9162, 5, 4, 0, 0, 9161, 9163, 3, 1368, 684, 0, 9162, 9161, 1, 0, 0, 0, 9162, 9163, 1, 0, 0, 0, 9163, 9164, 1, 0, 0, 0, 9164, 9166, 5, 5, 0, 0, 9165, 9160, 1, 0, 0, 0, 9166, 9169, 1, 0, 0, 0, 9167, 9165, 1, 0, 0, 0, 9167, 9168, 1, 0, 0, 0, 9168, 1131, 1, 0, 0, 0, 9169, 9167, 1, 0, 0, 0, 9170, 9186, 3, 1136, 568, 0, 9171, 9186, 3, 1140, 570, 0, 9172, 9186, 3, 1144, 572, 0, 9173, 9186, 3, 1152, 576, 0, 9174, 9186, 3, 1160, 580, 0, 9175, 9183, 3, 1162, 581, 0, 9176, 9178, 3, 1166, 583, 0, 9177, 9176, 1, 0, 0, 0, 9177, 9178, 1, 0, 0, 0, 9178, 9184, 1, 0, 0, 0, 9179, 9180, 5, 2, 0, 0, 9180, 9181, 3, 1368, 684, 0, 9181, 9182, 5, 3, 0, 0, 9182, 9184, 1, 0, 0, 0, 9183, 9177, 1, 0, 0, 0, 9183, 9179, 1, 0, 0, 0, 9184, 9186, 1, 0, 0, 0, 9185, 9170, 1, 0, 0, 0, 9185, 9171, 1, 0, 0, 0, 9185, 9172, 1, 0, 0, 0, 9185, 9173, 1, 0, 0, 0, 9185, 9174, 1, 0, 0, 0, 9185, 9175, 1, 0, 0, 0, 9186, 1133, 1, 0, 0, 0, 9187, 9192, 3, 1140, 570, 0, 9188, 9192, 3, 1146, 573, 0, 9189, 9192, 3, 1154, 577, 0, 9190, 9192, 3, 1160, 580, 0, 9191, 9187, 1, 0, 0, 0, 9191, 9188, 1, 0, 0, 0, 9191, 9189, 1, 0, 0, 0, 9191, 9190, 1, 0, 0, 0, 9192, 1135, 1, 0, 0, 0, 9193, 9198, 3, 1406, 703, 0, 9194, 9198, 3, 1388, 694, 0, 9195, 9198, 5, 119, 0, 0, 9196, 9198, 5, 126, 0, 0, 9197, 9193, 1, 0, 0, 0, 9197, 9194, 1, 0, 0, 0, 9197, 9195, 1, 0, 0, 0, 9197, 9196, 1, 0, 0, 0, 9198, 9200, 1, 0, 0, 0, 9199, 9201, 3, 530, 265, 0, 9200, 9199, 1, 0, 0, 0, 9200, 9201, 1, 0, 0, 0, 9201, 9203, 1, 0, 0, 0, 9202, 9204, 3, 1138, 569, 0, 9203, 9202, 1, 0, 0, 0, 9203, 9204, 1, 0, 0, 0, 9204, 1137, 1, 0, 0, 0, 9205, 9206, 5, 2, 0, 0, 9206, 9207, 3, 1290, 645, 0, 9207, 9208, 5, 3, 0, 0, 9208, 1139, 1, 0, 0, 0, 9209, 9234, 5, 395, 0, 0, 9210, 9234, 5, 396, 0, 0, 9211, 9234, 5, 411, 0, 0, 9212, 9234, 5, 382, 0, 0, 9213, 9234, 5, 408, 0, 0, 9214, 9216, 5, 392, 0, 0, 9215, 9217, 3, 1142, 571, 0, 9216, 9215, 1, 0, 0, 0, 9216, 9217, 1, 0, 0, 0, 9217, 9234, 1, 0, 0, 0, 9218, 9219, 5, 190, 0, 0, 9219, 9234, 5, 407, 0, 0, 9220, 9222, 5, 389, 0, 0, 9221, 9223, 3, 1138, 569, 0, 9222, 9221, 1, 0, 0, 0, 9222, 9223, 1, 0, 0, 0, 9223, 9234, 1, 0, 0, 0, 9224, 9226, 5, 388, 0, 0, 9225, 9227, 3, 1138, 569, 0, 9226, 9225, 1, 0, 0, 0, 9226, 9227, 1, 0, 0, 0, 9227, 9234, 1, 0, 0, 0, 9228, 9230, 5, 403, 0, 0, 9229, 9231, 3, 1138, 569, 0, 9230, 9229, 1, 0, 0, 0, 9230, 9231, 1, 0, 0, 0, 9231, 9234, 1, 0, 0, 0, 9232, 9234, 5, 384, 0, 0, 9233, 9209, 1, 0, 0, 0, 9233, 9210, 1, 0, 0, 0, 9233, 9211, 1, 0, 0, 0, 9233, 9212, 1, 0, 0, 0, 9233, 9213, 1, 0, 0, 0, 9233, 9214, 1, 0, 0, 0, 9233, 9218, 1, 0, 0, 0, 9233, 9220, 1, 0, 0, 0, 9233, 9224, 1, 0, 0, 0, 9233, 9228, 1, 0, 0, 0, 9233, 9232, 1, 0, 0, 0, 9234, 1141, 1, 0, 0, 0, 9235, 9236, 5, 2, 0, 0, 9236, 9237, 3, 1368, 684, 0, 9237, 9238, 5, 3, 0, 0, 9238, 1143, 1, 0, 0, 0, 9239, 9242, 3, 1148, 574, 0, 9240, 9242, 3, 1150, 575, 0, 9241, 9239, 1, 0, 0, 0, 9241, 9240, 1, 0, 0, 0, 9242, 1145, 1, 0, 0, 0, 9243, 9246, 3, 1148, 574, 0, 9244, 9246, 3, 1150, 575, 0, 9245, 9243, 1, 0, 0, 0, 9245, 9244, 1, 0, 0, 0, 9246, 1147, 1, 0, 0, 0, 9247, 9249, 5, 383, 0, 0, 9248, 9250, 3, 1158, 579, 0, 9249, 9248, 1, 0, 0, 0, 9249, 9250, 1, 0, 0, 0, 9250, 9251, 1, 0, 0, 0, 9251, 9252, 5, 2, 0, 0, 9252, 9253, 3, 1290, 645, 0, 9253, 9254, 5, 3, 0, 0, 9254, 1149, 1, 0, 0, 0, 9255, 9257, 5, 383, 0, 0, 9256, 9258, 3, 1158, 579, 0, 9257, 9256, 1, 0, 0, 0, 9257, 9258, 1, 0, 0, 0, 9258, 1151, 1, 0, 0, 0, 9259, 9264, 3, 1156, 578, 0, 9260, 9261, 5, 2, 0, 0, 9261, 9262, 3, 1368, 684, 0, 9262, 9263, 5, 3, 0, 0, 9263, 9265, 1, 0, 0, 0, 9264, 9260, 1, 0, 0, 0, 9264, 9265, 1, 0, 0, 0, 9265, 1153, 1, 0, 0, 0, 9266, 9271, 3, 1156, 578, 0, 9267, 9268, 5, 2, 0, 0, 9268, 9269, 3, 1368, 684, 0, 9269, 9270, 5, 3, 0, 0, 9270, 9272, 1, 0, 0, 0, 9271, 9267, 1, 0, 0, 0, 9271, 9272, 1, 0, 0, 0, 9272, 1155, 1, 0, 0, 0, 9273, 9275, 7, 49, 0, 0, 9274, 9276, 3, 1158, 579, 0, 9275, 9274, 1, 0, 0, 0, 9275, 9276, 1, 0, 0, 0, 9276, 9284, 1, 0, 0, 0, 9277, 9284, 5, 418, 0, 0, 9278, 9279, 5, 399, 0, 0, 9279, 9281, 7, 50, 0, 0, 9280, 9282, 3, 1158, 579, 0, 9281, 9280, 1, 0, 0, 0, 9281, 9282, 1, 0, 0, 0, 9282, 9284, 1, 0, 0, 0, 9283, 9273, 1, 0, 0, 0, 9283, 9277, 1, 0, 0, 0, 9283, 9278, 1, 0, 0, 0, 9284, 1157, 1, 0, 0, 0, 9285, 9286, 5, 367, 0, 0, 9286, 1159, 1, 0, 0, 0, 9287, 9292, 7, 51, 0, 0, 9288, 9289, 5, 2, 0, 0, 9289, 9290, 3, 1368, 684, 0, 9290, 9291, 5, 3, 0, 0, 9291, 9293, 1, 0, 0, 0, 9292, 9288, 1, 0, 0, 0, 9292, 9293, 1, 0, 0, 0, 9293, 9295, 1, 0, 0, 0, 9294, 9296, 3, 1164, 582, 0, 9295, 9294, 1, 0, 0, 0, 9295, 9296, 1, 0, 0, 0, 9296, 1161, 1, 0, 0, 0, 9297, 9298, 5, 397, 0, 0, 9298, 1163, 1, 0, 0, 0, 9299, 9300, 5, 105, 0, 0, 9300, 9301, 5, 413, 0, 0, 9301, 9306, 5, 379, 0, 0, 9302, 9303, 5, 372, 0, 0, 9303, 9304, 5, 413, 0, 0, 9304, 9306, 5, 379, 0, 0, 9305, 9299, 1, 0, 0, 0, 9305, 9302, 1, 0, 0, 0, 9306, 1165, 1, 0, 0, 0, 9307, 9333, 5, 377, 0, 0, 9308, 9333, 5, 257, 0, 0, 9309, 9333, 5, 176, 0, 0, 9310, 9333, 5, 218, 0, 0, 9311, 9333, 5, 254, 0, 0, 9312, 9333, 3, 1168, 584, 0, 9313, 9314, 5, 377, 0, 0, 9314, 9315, 5, 94, 0, 0, 9315, 9333, 5, 257, 0, 0, 9316, 9317, 5, 176, 0, 0, 9317, 9321, 5, 94, 0, 0, 9318, 9322, 5, 218, 0, 0, 9319, 9322, 5, 254, 0, 0, 9320, 9322, 3, 1168, 584, 0, 9321, 9318, 1, 0, 0, 0, 9321, 9319, 1, 0, 0, 0, 9321, 9320, 1, 0, 0, 0, 9322, 9333, 1, 0, 0, 0, 9323, 9324, 5, 218, 0, 0, 9324, 9327, 5, 94, 0, 0, 9325, 9328, 5, 254, 0, 0, 9326, 9328, 3, 1168, 584, 0, 9327, 9325, 1, 0, 0, 0, 9327, 9326, 1, 0, 0, 0, 9328, 9333, 1, 0, 0, 0, 9329, 9330, 5, 254, 0, 0, 9330, 9331, 5, 94, 0, 0, 9331, 9333, 3, 1168, 584, 0, 9332, 9307, 1, 0, 0, 0, 9332, 9308, 1, 0, 0, 0, 9332, 9309, 1, 0, 0, 0, 9332, 9310, 1, 0, 0, 0, 9332, 9311, 1, 0, 0, 0, 9332, 9312, 1, 0, 0, 0, 9332, 9313, 1, 0, 0, 0, 9332, 9316, 1, 0, 0, 0, 9332, 9323, 1, 0, 0, 0, 9332, 9329, 1, 0, 0, 0, 9333, 1167, 1, 0, 0, 0, 9334, 9339, 5, 319, 0, 0, 9335, 9336, 5, 2, 0, 0, 9336, 9337, 3, 1368, 684, 0, 9337, 9338, 5, 3, 0, 0, 9338, 9340, 1, 0, 0, 0, 9339, 9335, 1, 0, 0, 0, 9339, 9340, 1, 0, 0, 0, 9340, 1169, 1, 0, 0, 0, 9341, 9342, 5, 197, 0, 0, 9342, 9343, 3, 1172, 586, 0, 9343, 1171, 1, 0, 0, 0, 9344, 9345, 3, 1174, 587, 0, 9345, 1173, 1, 0, 0, 0, 9346, 9348, 3, 1176, 588, 0, 9347, 9349, 3, 1284, 642, 0, 9348, 9347, 1, 0, 0, 0, 9348, 9349, 1, 0, 0, 0, 9349, 1175, 1, 0, 0, 0, 9350, 9355, 3, 1178, 589, 0, 9351, 9352, 7, 52, 0, 0, 9352, 9354, 3, 1178, 589, 0, 9353, 9351, 1, 0, 0, 0, 9354, 9357, 1, 0, 0, 0, 9355, 9353, 1, 0, 0, 0, 9355, 9356, 1, 0, 0, 0, 9356, 1177, 1, 0, 0, 0, 9357, 9355, 1, 0, 0, 0, 9358, 9363, 3, 1180, 590, 0, 9359, 9360, 5, 82, 0, 0, 9360, 9362, 3, 1180, 590, 0, 9361, 9359, 1, 0, 0, 0, 9362, 9365, 1, 0, 0, 0, 9363, 9361, 1, 0, 0, 0, 9363, 9364, 1, 0, 0, 0, 9364, 1179, 1, 0, 0, 0, 9365, 9363, 1, 0, 0, 0, 9366, 9371, 3, 1182, 591, 0, 9367, 9368, 5, 33, 0, 0, 9368, 9370, 3, 1182, 591, 0, 9369, 9367, 1, 0, 0, 0, 9370, 9373, 1, 0, 0, 0, 9371, 9369, 1, 0, 0, 0, 9371, 9372, 1, 0, 0, 0, 9372, 1181, 1, 0, 0, 0, 9373, 9371, 1, 0, 0, 0, 9374, 9386, 3, 1184, 592, 0, 9375, 9377, 5, 77, 0, 0, 9376, 9375, 1, 0, 0, 0, 9376, 9377, 1, 0, 0, 0, 9377, 9378, 1, 0, 0, 0, 9378, 9380, 5, 381, 0, 0, 9379, 9381, 5, 91, 0, 0, 9380, 9379, 1, 0, 0, 0, 9380, 9381, 1, 0, 0, 0, 9381, 9382, 1, 0, 0, 0, 9382, 9383, 3, 1184, 592, 0, 9383, 9384, 5, 33, 0, 0, 9384, 9385, 3, 1184, 592, 0, 9385, 9387, 1, 0, 0, 0, 9386, 9376, 1, 0, 0, 0, 9386, 9387, 1, 0, 0, 0, 9387, 1183, 1, 0, 0, 0, 9388, 9394, 3, 1186, 593, 0, 9389, 9391, 5, 77, 0, 0, 9390, 9389, 1, 0, 0, 0, 9390, 9391, 1, 0, 0, 0, 9391, 9392, 1, 0, 0, 0, 9392, 9393, 5, 68, 0, 0, 9393, 9395, 3, 1316, 658, 0, 9394, 9390, 1, 0, 0, 0, 9394, 9395, 1, 0, 0, 0, 9395, 1185, 1, 0, 0, 0, 9396, 9398, 5, 77, 0, 0, 9397, 9396, 1, 0, 0, 0, 9397, 9398, 1, 0, 0, 0, 9398, 9399, 1, 0, 0, 0, 9399, 9400, 3, 1188, 594, 0, 9400, 1187, 1, 0, 0, 0, 9401, 9403, 3, 1190, 595, 0, 9402, 9404, 7, 53, 0, 0, 9403, 9402, 1, 0, 0, 0, 9403, 9404, 1, 0, 0, 0, 9404, 1189, 1, 0, 0, 0, 9405, 9429, 3, 1192, 596, 0, 9406, 9408, 5, 116, 0, 0, 9407, 9409, 5, 77, 0, 0, 9408, 9407, 1, 0, 0, 0, 9408, 9409, 1, 0, 0, 0, 9409, 9427, 1, 0, 0, 0, 9410, 9428, 5, 78, 0, 0, 9411, 9428, 5, 96, 0, 0, 9412, 9428, 5, 60, 0, 0, 9413, 9428, 5, 358, 0, 0, 9414, 9415, 5, 56, 0, 0, 9415, 9416, 5, 64, 0, 0, 9416, 9428, 3, 1172, 586, 0, 9417, 9418, 5, 268, 0, 0, 9418, 9419, 5, 2, 0, 0, 9419, 9420, 3, 1296, 648, 0, 9420, 9421, 5, 3, 0, 0, 9421, 9428, 1, 0, 0, 0, 9422, 9428, 5, 188, 0, 0, 9423, 9425, 3, 1306, 653, 0, 9424, 9423, 1, 0, 0, 0, 9424, 9425, 1, 0, 0, 0, 9425, 9426, 1, 0, 0, 0, 9426, 9428, 5, 480, 0, 0, 9427, 9410, 1, 0, 0, 0, 9427, 9411, 1, 0, 0, 0, 9427, 9412, 1, 0, 0, 0, 9427, 9413, 1, 0, 0, 0, 9427, 9414, 1, 0, 0, 0, 9427, 9417, 1, 0, 0, 0, 9427, 9422, 1, 0, 0, 0, 9427, 9424, 1, 0, 0, 0, 9428, 9430, 1, 0, 0, 0, 9429, 9406, 1, 0, 0, 0, 9429, 9430, 1, 0, 0, 0, 9430, 1191, 1, 0, 0, 0, 9431, 9443, 3, 1194, 597, 0, 9432, 9433, 7, 54, 0, 0, 9433, 9444, 3, 1194, 597, 0, 9434, 9435, 3, 1288, 644, 0, 9435, 9441, 3, 1278, 639, 0, 9436, 9442, 3, 972, 486, 0, 9437, 9438, 5, 2, 0, 0, 9438, 9439, 3, 1172, 586, 0, 9439, 9440, 5, 3, 0, 0, 9440, 9442, 1, 0, 0, 0, 9441, 9436, 1, 0, 0, 0, 9441, 9437, 1, 0, 0, 0, 9442, 9444, 1, 0, 0, 0, 9443, 9432, 1, 0, 0, 0, 9443, 9434, 1, 0, 0, 0, 9443, 9444, 1, 0, 0, 0, 9444, 1193, 1, 0, 0, 0, 9445, 9459, 3, 1196, 598, 0, 9446, 9448, 5, 77, 0, 0, 9447, 9446, 1, 0, 0, 0, 9447, 9448, 1, 0, 0, 0, 9448, 9453, 1, 0, 0, 0, 9449, 9454, 5, 120, 0, 0, 9450, 9454, 5, 114, 0, 0, 9451, 9452, 5, 127, 0, 0, 9452, 9454, 5, 94, 0, 0, 9453, 9449, 1, 0, 0, 0, 9453, 9450, 1, 0, 0, 0, 9453, 9451, 1, 0, 0, 0, 9454, 9455, 1, 0, 0, 0, 9455, 9457, 3, 1196, 598, 0, 9456, 9458, 3, 1170, 585, 0, 9457, 9456, 1, 0, 0, 0, 9457, 9458, 1, 0, 0, 0, 9458, 9460, 1, 0, 0, 0, 9459, 9447, 1, 0, 0, 0, 9459, 9460, 1, 0, 0, 0, 9460, 1195, 1, 0, 0, 0, 9461, 9467, 3, 1198, 599, 0, 9462, 9463, 3, 1284, 642, 0, 9463, 9464, 3, 1198, 599, 0, 9464, 9466, 1, 0, 0, 0, 9465, 9462, 1, 0, 0, 0, 9466, 9469, 1, 0, 0, 0, 9467, 9465, 1, 0, 0, 0, 9467, 9468, 1, 0, 0, 0, 9468, 1197, 1, 0, 0, 0, 9469, 9467, 1, 0, 0, 0, 9470, 9472, 3, 1284, 642, 0, 9471, 9470, 1, 0, 0, 0, 9471, 9472, 1, 0, 0, 0, 9472, 9473, 1, 0, 0, 0, 9473, 9474, 3, 1200, 600, 0, 9474, 1199, 1, 0, 0, 0, 9475, 9480, 3, 1202, 601, 0, 9476, 9477, 7, 55, 0, 0, 9477, 9479, 3, 1202, 601, 0, 9478, 9476, 1, 0, 0, 0, 9479, 9482, 1, 0, 0, 0, 9480, 9478, 1, 0, 0, 0, 9480, 9481, 1, 0, 0, 0, 9481, 1201, 1, 0, 0, 0, 9482, 9480, 1, 0, 0, 0, 9483, 9488, 3, 1204, 602, 0, 9484, 9485, 7, 56, 0, 0, 9485, 9487, 3, 1204, 602, 0, 9486, 9484, 1, 0, 0, 0, 9487, 9490, 1, 0, 0, 0, 9488, 9486, 1, 0, 0, 0, 9488, 9489, 1, 0, 0, 0, 9489, 1203, 1, 0, 0, 0, 9490, 9488, 1, 0, 0, 0, 9491, 9494, 3, 1206, 603, 0, 9492, 9493, 5, 15, 0, 0, 9493, 9495, 3, 1172, 586, 0, 9494, 9492, 1, 0, 0, 0, 9494, 9495, 1, 0, 0, 0, 9495, 1205, 1, 0, 0, 0, 9496, 9498, 7, 55, 0, 0, 9497, 9496, 1, 0, 0, 0, 9497, 9498, 1, 0, 0, 0, 9498, 9499, 1, 0, 0, 0, 9499, 9500, 3, 1208, 604, 0, 9500, 1207, 1, 0, 0, 0, 9501, 9506, 3, 1210, 605, 0, 9502, 9503, 5, 142, 0, 0, 9503, 9504, 5, 413, 0, 0, 9504, 9505, 5, 379, 0, 0, 9505, 9507, 3, 1172, 586, 0, 9506, 9502, 1, 0, 0, 0, 9506, 9507, 1, 0, 0, 0, 9507, 1209, 1, 0, 0, 0, 9508, 9511, 3, 1212, 606, 0, 9509, 9510, 5, 43, 0, 0, 9510, 9512, 3, 528, 264, 0, 9511, 9509, 1, 0, 0, 0, 9511, 9512, 1, 0, 0, 0, 9512, 1211, 1, 0, 0, 0, 9513, 9518, 3, 1216, 608, 0, 9514, 9515, 5, 26, 0, 0, 9515, 9517, 3, 1128, 564, 0, 9516, 9514, 1, 0, 0, 0, 9517, 9520, 1, 0, 0, 0, 9518, 9516, 1, 0, 0, 0, 9518, 9519, 1, 0, 0, 0, 9519, 1213, 1, 0, 0, 0, 9520, 9518, 1, 0, 0, 0, 9521, 9522, 6, 607, -1, 0, 9522, 9529, 3, 1216, 608, 0, 9523, 9524, 7, 55, 0, 0, 9524, 9529, 3, 1214, 607, 9, 9525, 9526, 3, 1284, 642, 0, 9526, 9527, 3, 1214, 607, 3, 9527, 9529, 1, 0, 0, 0, 9528, 9521, 1, 0, 0, 0, 9528, 9523, 1, 0, 0, 0, 9528, 9525, 1, 0, 0, 0, 9529, 9569, 1, 0, 0, 0, 9530, 9531, 10, 8, 0, 0, 9531, 9532, 5, 15, 0, 0, 9532, 9568, 3, 1214, 607, 9, 9533, 9534, 10, 7, 0, 0, 9534, 9535, 7, 56, 0, 0, 9535, 9568, 3, 1214, 607, 8, 9536, 9537, 10, 6, 0, 0, 9537, 9538, 7, 55, 0, 0, 9538, 9568, 3, 1214, 607, 7, 9539, 9540, 10, 5, 0, 0, 9540, 9541, 3, 1284, 642, 0, 9541, 9542, 3, 1214, 607, 6, 9542, 9568, 1, 0, 0, 0, 9543, 9544, 10, 4, 0, 0, 9544, 9545, 7, 54, 0, 0, 9545, 9568, 3, 1214, 607, 5, 9546, 9547, 10, 10, 0, 0, 9547, 9548, 5, 26, 0, 0, 9548, 9568, 3, 1128, 564, 0, 9549, 9550, 10, 2, 0, 0, 9550, 9568, 3, 1284, 642, 0, 9551, 9552, 10, 1, 0, 0, 9552, 9554, 5, 116, 0, 0, 9553, 9555, 5, 77, 0, 0, 9554, 9553, 1, 0, 0, 0, 9554, 9555, 1, 0, 0, 0, 9555, 9565, 1, 0, 0, 0, 9556, 9557, 5, 56, 0, 0, 9557, 9558, 5, 64, 0, 0, 9558, 9566, 3, 1214, 607, 0, 9559, 9560, 5, 268, 0, 0, 9560, 9561, 5, 2, 0, 0, 9561, 9562, 3, 1296, 648, 0, 9562, 9563, 5, 3, 0, 0, 9563, 9566, 1, 0, 0, 0, 9564, 9566, 5, 188, 0, 0, 9565, 9556, 1, 0, 0, 0, 9565, 9559, 1, 0, 0, 0, 9565, 9564, 1, 0, 0, 0, 9566, 9568, 1, 0, 0, 0, 9567, 9530, 1, 0, 0, 0, 9567, 9533, 1, 0, 0, 0, 9567, 9536, 1, 0, 0, 0, 9567, 9539, 1, 0, 0, 0, 9567, 9543, 1, 0, 0, 0, 9567, 9546, 1, 0, 0, 0, 9567, 9549, 1, 0, 0, 0, 9567, 9551, 1, 0, 0, 0, 9568, 9571, 1, 0, 0, 0, 9569, 9567, 1, 0, 0, 0, 9569, 9570, 1, 0, 0, 0, 9570, 1215, 1, 0, 0, 0, 9571, 9569, 1, 0, 0, 0, 9572, 9573, 5, 390, 0, 0, 9573, 9609, 3, 972, 486, 0, 9574, 9577, 5, 35, 0, 0, 9575, 9578, 3, 972, 486, 0, 9576, 9578, 3, 1298, 649, 0, 9577, 9575, 1, 0, 0, 0, 9577, 9576, 1, 0, 0, 0, 9578, 9609, 1, 0, 0, 0, 9579, 9580, 5, 28, 0, 0, 9580, 9609, 3, 1336, 668, 0, 9581, 9582, 5, 472, 0, 0, 9582, 9583, 5, 2, 0, 0, 9583, 9584, 3, 1290, 645, 0, 9584, 9585, 5, 3, 0, 0, 9585, 9609, 1, 0, 0, 0, 9586, 9587, 5, 98, 0, 0, 9587, 9609, 3, 972, 486, 0, 9588, 9609, 3, 1328, 664, 0, 9589, 9609, 3, 1360, 680, 0, 9590, 9609, 3, 1218, 609, 0, 9591, 9592, 5, 2, 0, 0, 9592, 9593, 3, 1172, 586, 0, 9593, 9594, 5, 3, 0, 0, 9594, 9595, 3, 1336, 668, 0, 9595, 9609, 1, 0, 0, 0, 9596, 9609, 3, 1318, 659, 0, 9597, 9609, 3, 1222, 611, 0, 9598, 9600, 3, 972, 486, 0, 9599, 9601, 3, 1334, 667, 0, 9600, 9599, 1, 0, 0, 0, 9600, 9601, 1, 0, 0, 0, 9601, 9609, 1, 0, 0, 0, 9602, 9609, 3, 1274, 637, 0, 9603, 9609, 3, 1276, 638, 0, 9604, 9605, 3, 1272, 636, 0, 9605, 9606, 5, 125, 0, 0, 9606, 9607, 3, 1272, 636, 0, 9607, 9609, 1, 0, 0, 0, 9608, 9572, 1, 0, 0, 0, 9608, 9574, 1, 0, 0, 0, 9608, 9579, 1, 0, 0, 0, 9608, 9581, 1, 0, 0, 0, 9608, 9586, 1, 0, 0, 0, 9608, 9588, 1, 0, 0, 0, 9608, 9589, 1, 0, 0, 0, 9608, 9590, 1, 0, 0, 0, 9608, 9591, 1, 0, 0, 0, 9608, 9596, 1, 0, 0, 0, 9608, 9597, 1, 0, 0, 0, 9608, 9598, 1, 0, 0, 0, 9608, 9602, 1, 0, 0, 0, 9608, 9603, 1, 0, 0, 0, 9608, 9604, 1, 0, 0, 0, 9609, 1217, 1, 0, 0, 0, 9610, 9611, 5, 668, 0, 0, 9611, 1219, 1, 0, 0, 0, 9612, 9613, 3, 1358, 679, 0, 9613, 9635, 5, 2, 0, 0, 9614, 9618, 3, 1292, 646, 0, 9615, 9616, 5, 6, 0, 0, 9616, 9617, 5, 101, 0, 0, 9617, 9619, 3, 1294, 647, 0, 9618, 9615, 1, 0, 0, 0, 9618, 9619, 1, 0, 0, 0, 9619, 9621, 1, 0, 0, 0, 9620, 9622, 3, 1006, 503, 0, 9621, 9620, 1, 0, 0, 0, 9621, 9622, 1, 0, 0, 0, 9622, 9636, 1, 0, 0, 0, 9623, 9624, 5, 101, 0, 0, 9624, 9626, 3, 1294, 647, 0, 9625, 9627, 3, 1006, 503, 0, 9626, 9625, 1, 0, 0, 0, 9626, 9627, 1, 0, 0, 0, 9627, 9636, 1, 0, 0, 0, 9628, 9629, 7, 44, 0, 0, 9629, 9631, 3, 1292, 646, 0, 9630, 9632, 3, 1006, 503, 0, 9631, 9630, 1, 0, 0, 0, 9631, 9632, 1, 0, 0, 0, 9632, 9636, 1, 0, 0, 0, 9633, 9636, 5, 9, 0, 0, 9634, 9636, 1, 0, 0, 0, 9635, 9614, 1, 0, 0, 0, 9635, 9623, 1, 0, 0, 0, 9635, 9628, 1, 0, 0, 0, 9635, 9633, 1, 0, 0, 0, 9635, 9634, 1, 0, 0, 0, 9636, 9637, 1, 0, 0, 0, 9637, 9638, 5, 3, 0, 0, 9638, 1221, 1, 0, 0, 0, 9639, 9641, 3, 1220, 610, 0, 9640, 9642, 3, 1246, 623, 0, 9641, 9640, 1, 0, 0, 0, 9641, 9642, 1, 0, 0, 0, 9642, 9644, 1, 0, 0, 0, 9643, 9645, 3, 1248, 624, 0, 9644, 9643, 1, 0, 0, 0, 9644, 9645, 1, 0, 0, 0, 9645, 9647, 1, 0, 0, 0, 9646, 9648, 3, 1256, 628, 0, 9647, 9646, 1, 0, 0, 0, 9647, 9648, 1, 0, 0, 0, 9648, 9651, 1, 0, 0, 0, 9649, 9651, 3, 1226, 613, 0, 9650, 9639, 1, 0, 0, 0, 9650, 9649, 1, 0, 0, 0, 9651, 1223, 1, 0, 0, 0, 9652, 9655, 3, 1220, 610, 0, 9653, 9655, 3, 1226, 613, 0, 9654, 9652, 1, 0, 0, 0, 9654, 9653, 1, 0, 0, 0, 9655, 1225, 1, 0, 0, 0, 9656, 9657, 5, 108, 0, 0, 9657, 9658, 5, 62, 0, 0, 9658, 9659, 5, 2, 0, 0, 9659, 9660, 3, 1172, 586, 0, 9660, 9661, 5, 3, 0, 0, 9661, 9840, 1, 0, 0, 0, 9662, 9840, 5, 48, 0, 0, 9663, 9668, 5, 50, 0, 0, 9664, 9665, 5, 2, 0, 0, 9665, 9666, 3, 1368, 684, 0, 9666, 9667, 5, 3, 0, 0, 9667, 9669, 1, 0, 0, 0, 9668, 9664, 1, 0, 0, 0, 9668, 9669, 1, 0, 0, 0, 9669, 9840, 1, 0, 0, 0, 9670, 9675, 5, 51, 0, 0, 9671, 9672, 5, 2, 0, 0, 9672, 9673, 3, 1368, 684, 0, 9673, 9674, 5, 3, 0, 0, 9674, 9676, 1, 0, 0, 0, 9675, 9671, 1, 0, 0, 0, 9675, 9676, 1, 0, 0, 0, 9676, 9840, 1, 0, 0, 0, 9677, 9682, 5, 75, 0, 0, 9678, 9679, 5, 2, 0, 0, 9679, 9680, 3, 1368, 684, 0, 9680, 9681, 5, 3, 0, 0, 9681, 9683, 1, 0, 0, 0, 9682, 9678, 1, 0, 0, 0, 9682, 9683, 1, 0, 0, 0, 9683, 9840, 1, 0, 0, 0, 9684, 9689, 5, 76, 0, 0, 9685, 9686, 5, 2, 0, 0, 9686, 9687, 3, 1368, 684, 0, 9687, 9688, 5, 3, 0, 0, 9688, 9690, 1, 0, 0, 0, 9689, 9685, 1, 0, 0, 0, 9689, 9690, 1, 0, 0, 0, 9690, 9840, 1, 0, 0, 0, 9691, 9840, 5, 49, 0, 0, 9692, 9840, 5, 52, 0, 0, 9693, 9840, 5, 89, 0, 0, 9694, 9840, 5, 99, 0, 0, 9695, 9840, 5, 47, 0, 0, 9696, 9840, 5, 111, 0, 0, 9697, 9698, 5, 41, 0, 0, 9698, 9699, 5, 2, 0, 0, 9699, 9700, 3, 1172, 586, 0, 9700, 9701, 5, 36, 0, 0, 9701, 9702, 3, 1128, 564, 0, 9702, 9703, 5, 3, 0, 0, 9703, 9840, 1, 0, 0, 0, 9704, 9705, 5, 391, 0, 0, 9705, 9707, 5, 2, 0, 0, 9706, 9708, 3, 1302, 651, 0, 9707, 9706, 1, 0, 0, 0, 9707, 9708, 1, 0, 0, 0, 9708, 9709, 1, 0, 0, 0, 9709, 9840, 5, 3, 0, 0, 9710, 9711, 5, 491, 0, 0, 9711, 9712, 5, 2, 0, 0, 9712, 9715, 3, 1172, 586, 0, 9713, 9714, 5, 6, 0, 0, 9714, 9716, 3, 1306, 653, 0, 9715, 9713, 1, 0, 0, 0, 9715, 9716, 1, 0, 0, 0, 9716, 9717, 1, 0, 0, 0, 9717, 9718, 5, 3, 0, 0, 9718, 9840, 1, 0, 0, 0, 9719, 9720, 5, 404, 0, 0, 9720, 9721, 5, 2, 0, 0, 9721, 9722, 3, 1308, 654, 0, 9722, 9723, 5, 3, 0, 0, 9723, 9840, 1, 0, 0, 0, 9724, 9725, 5, 406, 0, 0, 9725, 9727, 5, 2, 0, 0, 9726, 9728, 3, 1310, 655, 0, 9727, 9726, 1, 0, 0, 0, 9727, 9728, 1, 0, 0, 0, 9728, 9729, 1, 0, 0, 0, 9729, 9840, 5, 3, 0, 0, 9730, 9731, 5, 412, 0, 0, 9731, 9732, 5, 2, 0, 0, 9732, 9733, 3, 1312, 656, 0, 9733, 9734, 5, 3, 0, 0, 9734, 9840, 1, 0, 0, 0, 9735, 9736, 5, 415, 0, 0, 9736, 9737, 5, 2, 0, 0, 9737, 9738, 3, 1172, 586, 0, 9738, 9739, 5, 36, 0, 0, 9739, 9740, 3, 1128, 564, 0, 9740, 9741, 5, 3, 0, 0, 9741, 9840, 1, 0, 0, 0, 9742, 9743, 5, 416, 0, 0, 9743, 9745, 5, 2, 0, 0, 9744, 9746, 7, 57, 0, 0, 9745, 9744, 1, 0, 0, 0, 9745, 9746, 1, 0, 0, 0, 9746, 9747, 1, 0, 0, 0, 9747, 9748, 3, 1314, 657, 0, 9748, 9749, 5, 3, 0, 0, 9749, 9840, 1, 0, 0, 0, 9750, 9751, 5, 402, 0, 0, 9751, 9752, 5, 2, 0, 0, 9752, 9753, 3, 1172, 586, 0, 9753, 9754, 5, 6, 0, 0, 9754, 9755, 3, 1172, 586, 0, 9755, 9756, 5, 3, 0, 0, 9756, 9840, 1, 0, 0, 0, 9757, 9758, 5, 387, 0, 0, 9758, 9759, 5, 2, 0, 0, 9759, 9760, 3, 1290, 645, 0, 9760, 9761, 5, 3, 0, 0, 9761, 9840, 1, 0, 0, 0, 9762, 9763, 5, 393, 0, 0, 9763, 9764, 5, 2, 0, 0, 9764, 9765, 3, 1290, 645, 0, 9765, 9766, 5, 3, 0, 0, 9766, 9840, 1, 0, 0, 0, 9767, 9768, 5, 398, 0, 0, 9768, 9769, 5, 2, 0, 0, 9769, 9770, 3, 1290, 645, 0, 9770, 9771, 5, 3, 0, 0, 9771, 9840, 1, 0, 0, 0, 9772, 9773, 5, 427, 0, 0, 9773, 9774, 5, 2, 0, 0, 9774, 9775, 3, 1290, 645, 0, 9775, 9776, 5, 3, 0, 0, 9776, 9840, 1, 0, 0, 0, 9777, 9778, 5, 428, 0, 0, 9778, 9779, 5, 2, 0, 0, 9779, 9780, 5, 259, 0, 0, 9780, 9786, 3, 1392, 696, 0, 9781, 9784, 5, 6, 0, 0, 9782, 9785, 3, 1232, 616, 0, 9783, 9785, 3, 1290, 645, 0, 9784, 9782, 1, 0, 0, 0, 9784, 9783, 1, 0, 0, 0, 9785, 9787, 1, 0, 0, 0, 9786, 9781, 1, 0, 0, 0, 9786, 9787, 1, 0, 0, 0, 9787, 9788, 1, 0, 0, 0, 9788, 9789, 5, 3, 0, 0, 9789, 9840, 1, 0, 0, 0, 9790, 9791, 5, 429, 0, 0, 9791, 9792, 5, 2, 0, 0, 9792, 9793, 3, 1216, 608, 0, 9793, 9794, 3, 1242, 621, 0, 9794, 9795, 5, 3, 0, 0, 9795, 9840, 1, 0, 0, 0, 9796, 9797, 5, 430, 0, 0, 9797, 9798, 5, 2, 0, 0, 9798, 9799, 3, 1234, 617, 0, 9799, 9800, 5, 3, 0, 0, 9800, 9840, 1, 0, 0, 0, 9801, 9802, 5, 431, 0, 0, 9802, 9803, 5, 2, 0, 0, 9803, 9804, 3, 1238, 619, 0, 9804, 9806, 3, 1172, 586, 0, 9805, 9807, 3, 1240, 620, 0, 9806, 9805, 1, 0, 0, 0, 9806, 9807, 1, 0, 0, 0, 9807, 9808, 1, 0, 0, 0, 9808, 9809, 5, 3, 0, 0, 9809, 9840, 1, 0, 0, 0, 9810, 9811, 5, 432, 0, 0, 9811, 9812, 5, 2, 0, 0, 9812, 9813, 5, 259, 0, 0, 9813, 9816, 3, 1392, 696, 0, 9814, 9815, 5, 6, 0, 0, 9815, 9817, 3, 1172, 586, 0, 9816, 9814, 1, 0, 0, 0, 9816, 9817, 1, 0, 0, 0, 9817, 9818, 1, 0, 0, 0, 9818, 9819, 5, 3, 0, 0, 9819, 9840, 1, 0, 0, 0, 9820, 9821, 5, 433, 0, 0, 9821, 9822, 5, 2, 0, 0, 9822, 9823, 5, 376, 0, 0, 9823, 9824, 3, 1172, 586, 0, 9824, 9825, 5, 6, 0, 0, 9825, 9827, 3, 1228, 614, 0, 9826, 9828, 3, 1230, 615, 0, 9827, 9826, 1, 0, 0, 0, 9827, 9828, 1, 0, 0, 0, 9828, 9829, 1, 0, 0, 0, 9829, 9830, 5, 3, 0, 0, 9830, 9840, 1, 0, 0, 0, 9831, 9832, 5, 434, 0, 0, 9832, 9833, 5, 2, 0, 0, 9833, 9834, 3, 1238, 619, 0, 9834, 9835, 3, 1172, 586, 0, 9835, 9836, 5, 36, 0, 0, 9836, 9837, 3, 1132, 566, 0, 9837, 9838, 5, 3, 0, 0, 9838, 9840, 1, 0, 0, 0, 9839, 9656, 1, 0, 0, 0, 9839, 9662, 1, 0, 0, 0, 9839, 9663, 1, 0, 0, 0, 9839, 9670, 1, 0, 0, 0, 9839, 9677, 1, 0, 0, 0, 9839, 9684, 1, 0, 0, 0, 9839, 9691, 1, 0, 0, 0, 9839, 9692, 1, 0, 0, 0, 9839, 9693, 1, 0, 0, 0, 9839, 9694, 1, 0, 0, 0, 9839, 9695, 1, 0, 0, 0, 9839, 9696, 1, 0, 0, 0, 9839, 9697, 1, 0, 0, 0, 9839, 9704, 1, 0, 0, 0, 9839, 9710, 1, 0, 0, 0, 9839, 9719, 1, 0, 0, 0, 9839, 9724, 1, 0, 0, 0, 9839, 9730, 1, 0, 0, 0, 9839, 9735, 1, 0, 0, 0, 9839, 9742, 1, 0, 0, 0, 9839, 9750, 1, 0, 0, 0, 9839, 9757, 1, 0, 0, 0, 9839, 9762, 1, 0, 0, 0, 9839, 9767, 1, 0, 0, 0, 9839, 9772, 1, 0, 0, 0, 9839, 9777, 1, 0, 0, 0, 9839, 9790, 1, 0, 0, 0, 9839, 9796, 1, 0, 0, 0, 9839, 9801, 1, 0, 0, 0, 9839, 9810, 1, 0, 0, 0, 9839, 9820, 1, 0, 0, 0, 9839, 9831, 1, 0, 0, 0, 9840, 1227, 1, 0, 0, 0, 9841, 9842, 5, 368, 0, 0, 9842, 9847, 3, 1172, 586, 0, 9843, 9844, 5, 368, 0, 0, 9844, 9845, 5, 262, 0, 0, 9845, 9847, 5, 452, 0, 0, 9846, 9841, 1, 0, 0, 0, 9846, 9843, 1, 0, 0, 0, 9847, 1229, 1, 0, 0, 0, 9848, 9849, 5, 6, 0, 0, 9849, 9850, 5, 332, 0, 0, 9850, 9859, 5, 378, 0, 0, 9851, 9852, 5, 6, 0, 0, 9852, 9853, 5, 332, 0, 0, 9853, 9859, 5, 262, 0, 0, 9854, 9855, 5, 6, 0, 0, 9855, 9856, 5, 332, 0, 0, 9856, 9857, 5, 262, 0, 0, 9857, 9859, 5, 452, 0, 0, 9858, 9848, 1, 0, 0, 0, 9858, 9851, 1, 0, 0, 0, 9858, 9854, 1, 0, 0, 0, 9859, 1231, 1, 0, 0, 0, 9860, 9861, 5, 419, 0, 0, 9861, 9862, 5, 2, 0, 0, 9862, 9863, 3, 1234, 617, 0, 9863, 9864, 5, 3, 0, 0, 9864, 1233, 1, 0, 0, 0, 9865, 9870, 3, 1236, 618, 0, 9866, 9867, 5, 6, 0, 0, 9867, 9869, 3, 1236, 618, 0, 9868, 9866, 1, 0, 0, 0, 9869, 9872, 1, 0, 0, 0, 9870, 9868, 1, 0, 0, 0, 9870, 9871, 1, 0, 0, 0, 9871, 1235, 1, 0, 0, 0, 9872, 9870, 1, 0, 0, 0, 9873, 9876, 3, 1172, 586, 0, 9874, 9875, 5, 36, 0, 0, 9875, 9877, 3, 1392, 696, 0, 9876, 9874, 1, 0, 0, 0, 9876, 9877, 1, 0, 0, 0, 9877, 1237, 1, 0, 0, 0, 9878, 9879, 7, 58, 0, 0, 9879, 1239, 1, 0, 0, 0, 9880, 9881, 5, 285, 0, 0, 9881, 9885, 5, 371, 0, 0, 9882, 9883, 5, 340, 0, 0, 9883, 9885, 5, 371, 0, 0, 9884, 9880, 1, 0, 0, 0, 9884, 9882, 1, 0, 0, 0, 9885, 1241, 1, 0, 0, 0, 9886, 9887, 5, 279, 0, 0, 9887, 9902, 3, 1216, 608, 0, 9888, 9889, 5, 279, 0, 0, 9889, 9890, 3, 1216, 608, 0, 9890, 9891, 3, 1244, 622, 0, 9891, 9902, 1, 0, 0, 0, 9892, 9893, 5, 279, 0, 0, 9893, 9894, 3, 1244, 622, 0, 9894, 9895, 3, 1216, 608, 0, 9895, 9902, 1, 0, 0, 0, 9896, 9897, 5, 279, 0, 0, 9897, 9898, 3, 1244, 622, 0, 9898, 9899, 3, 1216, 608, 0, 9899, 9900, 3, 1244, 622, 0, 9900, 9902, 1, 0, 0, 0, 9901, 9886, 1, 0, 0, 0, 9901, 9888, 1, 0, 0, 0, 9901, 9892, 1, 0, 0, 0, 9901, 9896, 1, 0, 0, 0, 9902, 1243, 1, 0, 0, 0, 9903, 9904, 5, 147, 0, 0, 9904, 9905, 7, 59, 0, 0, 9905, 1245, 1, 0, 0, 0, 9906, 9907, 5, 481, 0, 0, 9907, 9908, 5, 66, 0, 0, 9908, 9909, 5, 2, 0, 0, 9909, 9910, 3, 1008, 504, 0, 9910, 9911, 5, 3, 0, 0, 9911, 1247, 1, 0, 0, 0, 9912, 9913, 5, 482, 0, 0, 9913, 9914, 5, 2, 0, 0, 9914, 9915, 5, 103, 0, 0, 9915, 9916, 3, 1172, 586, 0, 9916, 9917, 5, 3, 0, 0, 9917, 1249, 1, 0, 0, 0, 9918, 9919, 5, 104, 0, 0, 9919, 9920, 3, 1252, 626, 0, 9920, 1251, 1, 0, 0, 0, 9921, 9926, 3, 1254, 627, 0, 9922, 9923, 5, 6, 0, 0, 9923, 9925, 3, 1254, 627, 0, 9924, 9922, 1, 0, 0, 0, 9925, 9928, 1, 0, 0, 0, 9926, 9924, 1, 0, 0, 0, 9926, 9927, 1, 0, 0, 0, 9927, 1253, 1, 0, 0, 0, 9928, 9926, 1, 0, 0, 0, 9929, 9930, 3, 1384, 692, 0, 9930, 9931, 5, 36, 0, 0, 9931, 9932, 3, 1258, 629, 0, 9932, 1255, 1, 0, 0, 0, 9933, 9936, 5, 124, 0, 0, 9934, 9937, 3, 1258, 629, 0, 9935, 9937, 3, 1384, 692, 0, 9936, 9934, 1, 0, 0, 0, 9936, 9935, 1, 0, 0, 0, 9937, 1257, 1, 0, 0, 0, 9938, 9940, 5, 2, 0, 0, 9939, 9941, 3, 1260, 630, 0, 9940, 9939, 1, 0, 0, 0, 9940, 9941, 1, 0, 0, 0, 9941, 9943, 1, 0, 0, 0, 9942, 9944, 3, 1262, 631, 0, 9943, 9942, 1, 0, 0, 0, 9943, 9944, 1, 0, 0, 0, 9944, 9946, 1, 0, 0, 0, 9945, 9947, 3, 1006, 503, 0, 9946, 9945, 1, 0, 0, 0, 9946, 9947, 1, 0, 0, 0, 9947, 9949, 1, 0, 0, 0, 9948, 9950, 3, 1264, 632, 0, 9949, 9948, 1, 0, 0, 0, 9949, 9950, 1, 0, 0, 0, 9950, 9951, 1, 0, 0, 0, 9951, 9952, 5, 3, 0, 0, 9952, 1259, 1, 0, 0, 0, 9953, 9954, 3, 1384, 692, 0, 9954, 1261, 1, 0, 0, 0, 9955, 9956, 5, 278, 0, 0, 9956, 9957, 5, 147, 0, 0, 9957, 9958, 3, 1290, 645, 0, 9958, 1263, 1, 0, 0, 0, 9959, 9960, 5, 292, 0, 0, 9960, 9962, 3, 1266, 633, 0, 9961, 9963, 3, 1270, 635, 0, 9962, 9961, 1, 0, 0, 0, 9962, 9963, 1, 0, 0, 0, 9963, 9975, 1, 0, 0, 0, 9964, 9965, 5, 313, 0, 0, 9965, 9967, 3, 1266, 633, 0, 9966, 9968, 3, 1270, 635, 0, 9967, 9966, 1, 0, 0, 0, 9967, 9968, 1, 0, 0, 0, 9968, 9975, 1, 0, 0, 0, 9969, 9970, 5, 483, 0, 0, 9970, 9972, 3, 1266, 633, 0, 9971, 9973, 3, 1270, 635, 0, 9972, 9971, 1, 0, 0, 0, 9972, 9973, 1, 0, 0, 0, 9973, 9975, 1, 0, 0, 0, 9974, 9959, 1, 0, 0, 0, 9974, 9964, 1, 0, 0, 0, 9974, 9969, 1, 0, 0, 0, 9975, 1265, 1, 0, 0, 0, 9976, 9983, 3, 1268, 634, 0, 9977, 9978, 5, 381, 0, 0, 9978, 9979, 3, 1268, 634, 0, 9979, 9980, 5, 33, 0, 0, 9980, 9981, 3, 1268, 634, 0, 9981, 9983, 1, 0, 0, 0, 9982, 9976, 1, 0, 0, 0, 9982, 9977, 1, 0, 0, 0, 9983, 1267, 1, 0, 0, 0, 9984, 9985, 5, 355, 0, 0, 9985, 9992, 7, 60, 0, 0, 9986, 9987, 5, 436, 0, 0, 9987, 9992, 5, 409, 0, 0, 9988, 9989, 3, 1172, 586, 0, 9989, 9990, 7, 60, 0, 0, 9990, 9992, 1, 0, 0, 0, 9991, 9984, 1, 0, 0, 0, 9991, 9986, 1, 0, 0, 0, 9991, 9988, 1, 0, 0, 0, 9992, 1269, 1, 0, 0, 0, 9993, 10000, 5, 199, 0, 0, 9994, 9995, 5, 436, 0, 0, 9995, 10001, 5, 409, 0, 0, 9996, 10001, 5, 66, 0, 0, 9997, 10001, 5, 469, 0, 0, 9998, 9999, 5, 262, 0, 0, 9999, 10001, 5, 484, 0, 0, 10000, 9994, 1, 0, 0, 0, 10000, 9996, 1, 0, 0, 0, 10000, 9997, 1, 0, 0, 0, 10000, 9998, 1, 0, 0, 0, 10001, 1271, 1, 0, 0, 0, 10002, 10003, 5, 409, 0, 0, 10003, 10005, 5, 2, 0, 0, 10004, 10006, 3, 1290, 645, 0, 10005, 10004, 1, 0, 0, 0, 10005, 10006, 1, 0, 0, 0, 10006, 10007, 1, 0, 0, 0, 10007, 10015, 5, 3, 0, 0, 10008, 10009, 5, 2, 0, 0, 10009, 10010, 3, 1290, 645, 0, 10010, 10011, 5, 6, 0, 0, 10011, 10012, 3, 1172, 586, 0, 10012, 10013, 5, 3, 0, 0, 10013, 10015, 1, 0, 0, 0, 10014, 10002, 1, 0, 0, 0, 10014, 10008, 1, 0, 0, 0, 10015, 1273, 1, 0, 0, 0, 10016, 10017, 5, 409, 0, 0, 10017, 10019, 5, 2, 0, 0, 10018, 10020, 3, 1290, 645, 0, 10019, 10018, 1, 0, 0, 0, 10019, 10020, 1, 0, 0, 0, 10020, 10021, 1, 0, 0, 0, 10021, 10022, 5, 3, 0, 0, 10022, 1275, 1, 0, 0, 0, 10023, 10024, 5, 2, 0, 0, 10024, 10025, 3, 1290, 645, 0, 10025, 10026, 5, 6, 0, 0, 10026, 10027, 3, 1172, 586, 0, 10027, 10028, 5, 3, 0, 0, 10028, 1277, 1, 0, 0, 0, 10029, 10030, 7, 61, 0, 0, 10030, 1279, 1, 0, 0, 0, 10031, 10034, 5, 29, 0, 0, 10032, 10034, 3, 1282, 641, 0, 10033, 10031, 1, 0, 0, 0, 10033, 10032, 1, 0, 0, 0, 10034, 1281, 1, 0, 0, 0, 10035, 10036, 7, 62, 0, 0, 10036, 1283, 1, 0, 0, 0, 10037, 10044, 5, 29, 0, 0, 10038, 10039, 5, 271, 0, 0, 10039, 10040, 5, 2, 0, 0, 10040, 10041, 3, 692, 346, 0, 10041, 10042, 5, 3, 0, 0, 10042, 10044, 1, 0, 0, 0, 10043, 10037, 1, 0, 0, 0, 10043, 10038, 1, 0, 0, 0, 10044, 1285, 1, 0, 0, 0, 10045, 10052, 3, 1280, 640, 0, 10046, 10047, 5, 271, 0, 0, 10047, 10048, 5, 2, 0, 0, 10048, 10049, 3, 692, 346, 0, 10049, 10050, 5, 3, 0, 0, 10050, 10052, 1, 0, 0, 0, 10051, 10045, 1, 0, 0, 0, 10051, 10046, 1, 0, 0, 0, 10052, 1287, 1, 0, 0, 0, 10053, 10066, 3, 1280, 640, 0, 10054, 10055, 5, 271, 0, 0, 10055, 10056, 5, 2, 0, 0, 10056, 10057, 3, 692, 346, 0, 10057, 10058, 5, 3, 0, 0, 10058, 10066, 1, 0, 0, 0, 10059, 10066, 5, 120, 0, 0, 10060, 10061, 5, 77, 0, 0, 10061, 10066, 5, 120, 0, 0, 10062, 10066, 5, 114, 0, 0, 10063, 10064, 5, 77, 0, 0, 10064, 10066, 5, 114, 0, 0, 10065, 10053, 1, 0, 0, 0, 10065, 10054, 1, 0, 0, 0, 10065, 10059, 1, 0, 0, 0, 10065, 10060, 1, 0, 0, 0, 10065, 10062, 1, 0, 0, 0, 10065, 10063, 1, 0, 0, 0, 10066, 1289, 1, 0, 0, 0, 10067, 10072, 3, 1172, 586, 0, 10068, 10069, 5, 6, 0, 0, 10069, 10071, 3, 1172, 586, 0, 10070, 10068, 1, 0, 0, 0, 10071, 10074, 1, 0, 0, 0, 10072, 10070, 1, 0, 0, 0, 10072, 10073, 1, 0, 0, 0, 10073, 1291, 1, 0, 0, 0, 10074, 10072, 1, 0, 0, 0, 10075, 10080, 3, 1294, 647, 0, 10076, 10077, 5, 6, 0, 0, 10077, 10079, 3, 1294, 647, 0, 10078, 10076, 1, 0, 0, 0, 10079, 10082, 1, 0, 0, 0, 10080, 10078, 1, 0, 0, 0, 10080, 10081, 1, 0, 0, 0, 10081, 1293, 1, 0, 0, 0, 10082, 10080, 1, 0, 0, 0, 10083, 10089, 3, 1172, 586, 0, 10084, 10085, 3, 644, 322, 0, 10085, 10086, 7, 63, 0, 0, 10086, 10087, 3, 1172, 586, 0, 10087, 10089, 1, 0, 0, 0, 10088, 10083, 1, 0, 0, 0, 10088, 10084, 1, 0, 0, 0, 10089, 1295, 1, 0, 0, 0, 10090, 10095, 3, 1128, 564, 0, 10091, 10092, 5, 6, 0, 0, 10092, 10094, 3, 1128, 564, 0, 10093, 10091, 1, 0, 0, 0, 10094, 10097, 1, 0, 0, 0, 10095, 10093, 1, 0, 0, 0, 10095, 10096, 1, 0, 0, 0, 10096, 1297, 1, 0, 0, 0, 10097, 10095, 1, 0, 0, 0, 10098, 10101, 5, 4, 0, 0, 10099, 10102, 3, 1290, 645, 0, 10100, 10102, 3, 1300, 650, 0, 10101, 10099, 1, 0, 0, 0, 10101, 10100, 1, 0, 0, 0, 10101, 10102, 1, 0, 0, 0, 10102, 10103, 1, 0, 0, 0, 10103, 10104, 5, 5, 0, 0, 10104, 1299, 1, 0, 0, 0, 10105, 10110, 3, 1298, 649, 0, 10106, 10107, 5, 6, 0, 0, 10107, 10109, 3, 1298, 649, 0, 10108, 10106, 1, 0, 0, 0, 10109, 10112, 1, 0, 0, 0, 10110, 10108, 1, 0, 0, 0, 10110, 10111, 1, 0, 0, 0, 10111, 1301, 1, 0, 0, 0, 10112, 10110, 1, 0, 0, 0, 10113, 10114, 3, 1304, 652, 0, 10114, 10115, 5, 64, 0, 0, 10115, 10116, 3, 1172, 586, 0, 10116, 1303, 1, 0, 0, 0, 10117, 10126, 3, 1394, 697, 0, 10118, 10126, 5, 377, 0, 0, 10119, 10126, 5, 257, 0, 0, 10120, 10126, 5, 176, 0, 0, 10121, 10126, 5, 218, 0, 0, 10122, 10126, 5, 254, 0, 0, 10123, 10126, 5, 319, 0, 0, 10124, 10126, 3, 1370, 685, 0, 10125, 10117, 1, 0, 0, 0, 10125, 10118, 1, 0, 0, 0, 10125, 10119, 1, 0, 0, 0, 10125, 10120, 1, 0, 0, 0, 10125, 10121, 1, 0, 0, 0, 10125, 10122, 1, 0, 0, 0, 10125, 10123, 1, 0, 0, 0, 10125, 10124, 1, 0, 0, 0, 10126, 1305, 1, 0, 0, 0, 10127, 10128, 7, 64, 0, 0, 10128, 1307, 1, 0, 0, 0, 10129, 10130, 3, 1172, 586, 0, 10130, 10131, 5, 84, 0, 0, 10131, 10132, 3, 1172, 586, 0, 10132, 10133, 5, 64, 0, 0, 10133, 10136, 3, 1172, 586, 0, 10134, 10135, 5, 62, 0, 0, 10135, 10137, 3, 1172, 586, 0, 10136, 10134, 1, 0, 0, 0, 10136, 10137, 1, 0, 0, 0, 10137, 1309, 1, 0, 0, 0, 10138, 10139, 3, 1214, 607, 0, 10139, 10140, 5, 68, 0, 0, 10140, 10141, 3, 1214, 607, 0, 10141, 1311, 1, 0, 0, 0, 10142, 10143, 3, 1172, 586, 0, 10143, 10144, 5, 64, 0, 0, 10144, 10145, 3, 1172, 586, 0, 10145, 10146, 5, 62, 0, 0, 10146, 10147, 3, 1172, 586, 0, 10147, 10170, 1, 0, 0, 0, 10148, 10149, 3, 1172, 586, 0, 10149, 10150, 5, 62, 0, 0, 10150, 10151, 3, 1172, 586, 0, 10151, 10152, 5, 64, 0, 0, 10152, 10153, 3, 1172, 586, 0, 10153, 10170, 1, 0, 0, 0, 10154, 10155, 3, 1172, 586, 0, 10155, 10156, 5, 64, 0, 0, 10156, 10157, 3, 1172, 586, 0, 10157, 10170, 1, 0, 0, 0, 10158, 10159, 3, 1172, 586, 0, 10159, 10160, 5, 62, 0, 0, 10160, 10161, 3, 1172, 586, 0, 10161, 10170, 1, 0, 0, 0, 10162, 10163, 3, 1172, 586, 0, 10163, 10164, 5, 127, 0, 0, 10164, 10165, 3, 1172, 586, 0, 10165, 10166, 5, 197, 0, 0, 10166, 10167, 3, 1172, 586, 0, 10167, 10170, 1, 0, 0, 0, 10168, 10170, 3, 1290, 645, 0, 10169, 10142, 1, 0, 0, 0, 10169, 10148, 1, 0, 0, 0, 10169, 10154, 1, 0, 0, 0, 10169, 10158, 1, 0, 0, 0, 10169, 10162, 1, 0, 0, 0, 10169, 10168, 1, 0, 0, 0, 10170, 1313, 1, 0, 0, 0, 10171, 10172, 3, 1172, 586, 0, 10172, 10173, 5, 64, 0, 0, 10173, 10174, 3, 1290, 645, 0, 10174, 10179, 1, 0, 0, 0, 10175, 10176, 5, 64, 0, 0, 10176, 10179, 3, 1290, 645, 0, 10177, 10179, 3, 1290, 645, 0, 10178, 10171, 1, 0, 0, 0, 10178, 10175, 1, 0, 0, 0, 10178, 10177, 1, 0, 0, 0, 10179, 1315, 1, 0, 0, 0, 10180, 10186, 3, 972, 486, 0, 10181, 10182, 5, 2, 0, 0, 10182, 10183, 3, 1290, 645, 0, 10183, 10184, 5, 3, 0, 0, 10184, 10186, 1, 0, 0, 0, 10185, 10180, 1, 0, 0, 0, 10185, 10181, 1, 0, 0, 0, 10186, 1317, 1, 0, 0, 0, 10187, 10189, 5, 40, 0, 0, 10188, 10190, 3, 1326, 663, 0, 10189, 10188, 1, 0, 0, 0, 10189, 10190, 1, 0, 0, 0, 10190, 10191, 1, 0, 0, 0, 10191, 10193, 3, 1320, 660, 0, 10192, 10194, 3, 1324, 662, 0, 10193, 10192, 1, 0, 0, 0, 10193, 10194, 1, 0, 0, 0, 10194, 10195, 1, 0, 0, 0, 10195, 10196, 5, 456, 0, 0, 10196, 1319, 1, 0, 0, 0, 10197, 10199, 3, 1322, 661, 0, 10198, 10197, 1, 0, 0, 0, 10199, 10200, 1, 0, 0, 0, 10200, 10198, 1, 0, 0, 0, 10200, 10201, 1, 0, 0, 0, 10201, 1321, 1, 0, 0, 0, 10202, 10203, 5, 102, 0, 0, 10203, 10204, 3, 1172, 586, 0, 10204, 10205, 5, 93, 0, 0, 10205, 10206, 3, 1172, 586, 0, 10206, 1323, 1, 0, 0, 0, 10207, 10208, 5, 58, 0, 0, 10208, 10209, 3, 1172, 586, 0, 10209, 1325, 1, 0, 0, 0, 10210, 10211, 3, 1172, 586, 0, 10211, 1327, 1, 0, 0, 0, 10212, 10214, 3, 1384, 692, 0, 10213, 10215, 3, 1334, 667, 0, 10214, 10213, 1, 0, 0, 0, 10214, 10215, 1, 0, 0, 0, 10215, 1329, 1, 0, 0, 0, 10216, 10219, 5, 11, 0, 0, 10217, 10220, 3, 1354, 677, 0, 10218, 10220, 5, 9, 0, 0, 10219, 10217, 1, 0, 0, 0, 10219, 10218, 1, 0, 0, 0, 10220, 10234, 1, 0, 0, 0, 10221, 10230, 5, 4, 0, 0, 10222, 10231, 3, 1172, 586, 0, 10223, 10225, 3, 1332, 666, 0, 10224, 10223, 1, 0, 0, 0, 10224, 10225, 1, 0, 0, 0, 10225, 10226, 1, 0, 0, 0, 10226, 10228, 5, 8, 0, 0, 10227, 10229, 3, 1332, 666, 0, 10228, 10227, 1, 0, 0, 0, 10228, 10229, 1, 0, 0, 0, 10229, 10231, 1, 0, 0, 0, 10230, 10222, 1, 0, 0, 0, 10230, 10224, 1, 0, 0, 0, 10231, 10232, 1, 0, 0, 0, 10232, 10234, 5, 5, 0, 0, 10233, 10216, 1, 0, 0, 0, 10233, 10221, 1, 0, 0, 0, 10234, 1331, 1, 0, 0, 0, 10235, 10236, 3, 1172, 586, 0, 10236, 1333, 1, 0, 0, 0, 10237, 10239, 3, 1330, 665, 0, 10238, 10237, 1, 0, 0, 0, 10239, 10240, 1, 0, 0, 0, 10240, 10238, 1, 0, 0, 0, 10240, 10241, 1, 0, 0, 0, 10241, 1335, 1, 0, 0, 0, 10242, 10244, 3, 1330, 665, 0, 10243, 10242, 1, 0, 0, 0, 10244, 10247, 1, 0, 0, 0, 10245, 10243, 1, 0, 0, 0, 10245, 10246, 1, 0, 0, 0, 10246, 1337, 1, 0, 0, 0, 10247, 10245, 1, 0, 0, 0, 10248, 10249, 3, 1340, 670, 0, 10249, 1339, 1, 0, 0, 0, 10250, 10255, 3, 1342, 671, 0, 10251, 10252, 5, 6, 0, 0, 10252, 10254, 3, 1342, 671, 0, 10253, 10251, 1, 0, 0, 0, 10254, 10257, 1, 0, 0, 0, 10255, 10253, 1, 0, 0, 0, 10255, 10256, 1, 0, 0, 0, 10256, 1341, 1, 0, 0, 0, 10257, 10255, 1, 0, 0, 0, 10258, 10260, 3, 1172, 586, 0, 10259, 10261, 3, 1344, 672, 0, 10260, 10259, 1, 0, 0, 0, 10260, 10261, 1, 0, 0, 0, 10261, 10264, 1, 0, 0, 0, 10262, 10264, 5, 9, 0, 0, 10263, 10258, 1, 0, 0, 0, 10263, 10262, 1, 0, 0, 0, 10264, 1343, 1, 0, 0, 0, 10265, 10266, 5, 36, 0, 0, 10266, 10269, 3, 1392, 696, 0, 10267, 10269, 3, 1394, 697, 0, 10268, 10265, 1, 0, 0, 0, 10268, 10267, 1, 0, 0, 0, 10269, 1345, 1, 0, 0, 0, 10270, 10275, 3, 1348, 674, 0, 10271, 10272, 5, 6, 0, 0, 10272, 10274, 3, 1348, 674, 0, 10273, 10271, 1, 0, 0, 0, 10274, 10277, 1, 0, 0, 0, 10275, 10273, 1, 0, 0, 0, 10275, 10276, 1, 0, 0, 0, 10276, 1347, 1, 0, 0, 0, 10277, 10275, 1, 0, 0, 0, 10278, 10280, 3, 1384, 692, 0, 10279, 10281, 3, 1334, 667, 0, 10280, 10279, 1, 0, 0, 0, 10280, 10281, 1, 0, 0, 0, 10281, 1349, 1, 0, 0, 0, 10282, 10287, 3, 1352, 676, 0, 10283, 10284, 5, 6, 0, 0, 10284, 10286, 3, 1352, 676, 0, 10285, 10283, 1, 0, 0, 0, 10286, 10289, 1, 0, 0, 0, 10287, 10285, 1, 0, 0, 0, 10287, 10288, 1, 0, 0, 0, 10288, 1351, 1, 0, 0, 0, 10289, 10287, 1, 0, 0, 0, 10290, 10291, 3, 1384, 692, 0, 10291, 1353, 1, 0, 0, 0, 10292, 10293, 3, 1392, 696, 0, 10293, 1355, 1, 0, 0, 0, 10294, 10295, 3, 1370, 685, 0, 10295, 1357, 1, 0, 0, 0, 10296, 10304, 3, 1406, 703, 0, 10297, 10304, 3, 1388, 694, 0, 10298, 10299, 3, 1384, 692, 0, 10299, 10300, 3, 1334, 667, 0, 10300, 10304, 1, 0, 0, 0, 10301, 10304, 5, 119, 0, 0, 10302, 10304, 5, 126, 0, 0, 10303, 10296, 1, 0, 0, 0, 10303, 10297, 1, 0, 0, 0, 10303, 10298, 1, 0, 0, 0, 10303, 10301, 1, 0, 0, 0, 10303, 10302, 1, 0, 0, 0, 10304, 1359, 1, 0, 0, 0, 10305, 10341, 3, 1368, 684, 0, 10306, 10341, 3, 1366, 683, 0, 10307, 10341, 3, 1370, 685, 0, 10308, 10341, 3, 1364, 682, 0, 10309, 10341, 3, 1362, 681, 0, 10310, 10320, 3, 1358, 679, 0, 10311, 10321, 3, 1370, 685, 0, 10312, 10313, 5, 2, 0, 0, 10313, 10315, 3, 1292, 646, 0, 10314, 10316, 3, 1006, 503, 0, 10315, 10314, 1, 0, 0, 0, 10315, 10316, 1, 0, 0, 0, 10316, 10317, 1, 0, 0, 0, 10317, 10318, 5, 3, 0, 0, 10318, 10319, 3, 1370, 685, 0, 10319, 10321, 1, 0, 0, 0, 10320, 10311, 1, 0, 0, 0, 10320, 10312, 1, 0, 0, 0, 10321, 10341, 1, 0, 0, 0, 10322, 10323, 3, 1134, 567, 0, 10323, 10324, 3, 1370, 685, 0, 10324, 10341, 1, 0, 0, 0, 10325, 10335, 3, 1162, 581, 0, 10326, 10328, 3, 1370, 685, 0, 10327, 10329, 3, 1166, 583, 0, 10328, 10327, 1, 0, 0, 0, 10328, 10329, 1, 0, 0, 0, 10329, 10336, 1, 0, 0, 0, 10330, 10331, 5, 2, 0, 0, 10331, 10332, 3, 1368, 684, 0, 10332, 10333, 5, 3, 0, 0, 10333, 10334, 3, 1370, 685, 0, 10334, 10336, 1, 0, 0, 0, 10335, 10326, 1, 0, 0, 0, 10335, 10330, 1, 0, 0, 0, 10336, 10341, 1, 0, 0, 0, 10337, 10341, 5, 96, 0, 0, 10338, 10341, 5, 60, 0, 0, 10339, 10341, 5, 78, 0, 0, 10340, 10305, 1, 0, 0, 0, 10340, 10306, 1, 0, 0, 0, 10340, 10307, 1, 0, 0, 0, 10340, 10308, 1, 0, 0, 0, 10340, 10309, 1, 0, 0, 0, 10340, 10310, 1, 0, 0, 0, 10340, 10322, 1, 0, 0, 0, 10340, 10325, 1, 0, 0, 0, 10340, 10337, 1, 0, 0, 0, 10340, 10338, 1, 0, 0, 0, 10340, 10339, 1, 0, 0, 0, 10341, 1361, 1, 0, 0, 0, 10342, 10343, 5, 661, 0, 0, 10343, 1363, 1, 0, 0, 0, 10344, 10345, 5, 657, 0, 0, 10345, 1365, 1, 0, 0, 0, 10346, 10347, 5, 667, 0, 0, 10347, 1367, 1, 0, 0, 0, 10348, 10349, 5, 665, 0, 0, 10349, 1369, 1, 0, 0, 0, 10350, 10352, 3, 1372, 686, 0, 10351, 10353, 3, 1374, 687, 0, 10352, 10351, 1, 0, 0, 0, 10352, 10353, 1, 0, 0, 0, 10353, 1371, 1, 0, 0, 0, 10354, 10366, 5, 652, 0, 0, 10355, 10366, 5, 654, 0, 0, 10356, 10360, 5, 656, 0, 0, 10357, 10359, 5, 684, 0, 0, 10358, 10357, 1, 0, 0, 0, 10359, 10362, 1, 0, 0, 0, 10360, 10358, 1, 0, 0, 0, 10360, 10361, 1, 0, 0, 0, 10361, 10363, 1, 0, 0, 0, 10362, 10360, 1, 0, 0, 0, 10363, 10366, 5, 685, 0, 0, 10364, 10366, 5, 678, 0, 0, 10365, 10354, 1, 0, 0, 0, 10365, 10355, 1, 0, 0, 0, 10365, 10356, 1, 0, 0, 0, 10365, 10364, 1, 0, 0, 0, 10366, 1373, 1, 0, 0, 0, 10367, 10368, 5, 489, 0, 0, 10368, 10369, 3, 1372, 686, 0, 10369, 1375, 1, 0, 0, 0, 10370, 10376, 3, 1368, 684, 0, 10371, 10372, 5, 12, 0, 0, 10372, 10376, 3, 1368, 684, 0, 10373, 10374, 5, 13, 0, 0, 10374, 10376, 3, 1368, 684, 0, 10375, 10370, 1, 0, 0, 0, 10375, 10371, 1, 0, 0, 0, 10375, 10373, 1, 0, 0, 0, 10376, 1377, 1, 0, 0, 0, 10377, 10378, 3, 1380, 690, 0, 10378, 1379, 1, 0, 0, 0, 10379, 10383, 3, 1390, 695, 0, 10380, 10383, 5, 52, 0, 0, 10381, 10383, 5, 89, 0, 0, 10382, 10379, 1, 0, 0, 0, 10382, 10380, 1, 0, 0, 0, 10382, 10381, 1, 0, 0, 0, 10383, 1381, 1, 0, 0, 0, 10384, 10389, 3, 1380, 690, 0, 10385, 10386, 5, 6, 0, 0, 10386, 10388, 3, 1380, 690, 0, 10387, 10385, 1, 0, 0, 0, 10388, 10391, 1, 0, 0, 0, 10389, 10387, 1, 0, 0, 0, 10389, 10390, 1, 0, 0, 0, 10390, 1383, 1, 0, 0, 0, 10391, 10389, 1, 0, 0, 0, 10392, 10399, 3, 1394, 697, 0, 10393, 10399, 3, 1398, 699, 0, 10394, 10399, 3, 1400, 700, 0, 10395, 10399, 3, 1620, 810, 0, 10396, 10399, 5, 119, 0, 0, 10397, 10399, 5, 126, 0, 0, 10398, 10392, 1, 0, 0, 0, 10398, 10393, 1, 0, 0, 0, 10398, 10394, 1, 0, 0, 0, 10398, 10395, 1, 0, 0, 0, 10398, 10396, 1, 0, 0, 0, 10398, 10397, 1, 0, 0, 0, 10399, 1385, 1, 0, 0, 0, 10400, 10405, 3, 1394, 697, 0, 10401, 10405, 3, 1398, 699, 0, 10402, 10405, 3, 1400, 700, 0, 10403, 10405, 3, 1620, 810, 0, 10404, 10400, 1, 0, 0, 0, 10404, 10401, 1, 0, 0, 0, 10404, 10402, 1, 0, 0, 0, 10404, 10403, 1, 0, 0, 0, 10405, 1387, 1, 0, 0, 0, 10406, 10411, 3, 1394, 697, 0, 10407, 10411, 3, 1398, 699, 0, 10408, 10411, 3, 1620, 810, 0, 10409, 10411, 3, 1402, 701, 0, 10410, 10406, 1, 0, 0, 0, 10410, 10407, 1, 0, 0, 0, 10410, 10408, 1, 0, 0, 0, 10410, 10409, 1, 0, 0, 0, 10411, 1389, 1, 0, 0, 0, 10412, 10417, 3, 1394, 697, 0, 10413, 10417, 3, 1398, 699, 0, 10414, 10417, 3, 1400, 700, 0, 10415, 10417, 3, 1402, 701, 0, 10416, 10412, 1, 0, 0, 0, 10416, 10413, 1, 0, 0, 0, 10416, 10414, 1, 0, 0, 0, 10416, 10415, 1, 0, 0, 0, 10417, 1391, 1, 0, 0, 0, 10418, 10425, 3, 1394, 697, 0, 10419, 10425, 3, 1620, 810, 0, 10420, 10425, 3, 1398, 699, 0, 10421, 10425, 3, 1400, 700, 0, 10422, 10425, 3, 1402, 701, 0, 10423, 10425, 3, 1404, 702, 0, 10424, 10418, 1, 0, 0, 0, 10424, 10419, 1, 0, 0, 0, 10424, 10420, 1, 0, 0, 0, 10424, 10421, 1, 0, 0, 0, 10424, 10422, 1, 0, 0, 0, 10424, 10423, 1, 0, 0, 0, 10425, 1393, 1, 0, 0, 0, 10426, 10428, 5, 643, 0, 0, 10427, 10429, 3, 1374, 687, 0, 10428, 10427, 1, 0, 0, 0, 10428, 10429, 1, 0, 0, 0, 10429, 10436, 1, 0, 0, 0, 10430, 10436, 5, 644, 0, 0, 10431, 10436, 5, 648, 0, 0, 10432, 10436, 3, 1218, 609, 0, 10433, 10436, 3, 1396, 698, 0, 10434, 10436, 3, 1620, 810, 0, 10435, 10426, 1, 0, 0, 0, 10435, 10430, 1, 0, 0, 0, 10435, 10431, 1, 0, 0, 0, 10435, 10432, 1, 0, 0, 0, 10435, 10433, 1, 0, 0, 0, 10435, 10434, 1, 0, 0, 0, 10436, 1395, 1, 0, 0, 0, 10437, 10438, 5, 669, 0, 0, 10438, 1397, 1, 0, 0, 0, 10439, 10440, 7, 65, 0, 0, 10440, 1399, 1, 0, 0, 0, 10441, 10494, 5, 381, 0, 0, 10442, 10494, 5, 382, 0, 0, 10443, 10494, 3, 1144, 572, 0, 10444, 10494, 5, 384, 0, 0, 10445, 10494, 5, 385, 0, 0, 10446, 10494, 3, 1152, 576, 0, 10447, 10494, 5, 387, 0, 0, 10448, 10494, 5, 388, 0, 0, 10449, 10494, 5, 389, 0, 0, 10450, 10494, 5, 390, 0, 0, 10451, 10494, 5, 391, 0, 0, 10452, 10494, 5, 392, 0, 0, 10453, 10494, 5, 393, 0, 0, 10454, 10494, 5, 472, 0, 0, 10455, 10494, 5, 394, 0, 0, 10456, 10494, 5, 395, 0, 0, 10457, 10494, 5, 396, 0, 0, 10458, 10494, 5, 397, 0, 0, 10459, 10494, 5, 398, 0, 0, 10460, 10494, 5, 399, 0, 0, 10461, 10494, 5, 400, 0, 0, 10462, 10494, 5, 401, 0, 0, 10463, 10494, 5, 491, 0, 0, 10464, 10494, 5, 402, 0, 0, 10465, 10494, 3, 1140, 570, 0, 10466, 10494, 5, 455, 0, 0, 10467, 10494, 5, 404, 0, 0, 10468, 10494, 5, 406, 0, 0, 10469, 10494, 5, 407, 0, 0, 10470, 10494, 5, 408, 0, 0, 10471, 10494, 5, 409, 0, 0, 10472, 10494, 5, 410, 0, 0, 10473, 10494, 5, 411, 0, 0, 10474, 10494, 5, 412, 0, 0, 10475, 10494, 5, 413, 0, 0, 10476, 10494, 5, 414, 0, 0, 10477, 10494, 5, 415, 0, 0, 10478, 10494, 5, 416, 0, 0, 10479, 10494, 5, 417, 0, 0, 10480, 10494, 5, 418, 0, 0, 10481, 10494, 5, 419, 0, 0, 10482, 10494, 5, 427, 0, 0, 10483, 10494, 5, 428, 0, 0, 10484, 10494, 5, 429, 0, 0, 10485, 10494, 5, 430, 0, 0, 10486, 10494, 5, 478, 0, 0, 10487, 10494, 5, 431, 0, 0, 10488, 10494, 5, 432, 0, 0, 10489, 10494, 5, 433, 0, 0, 10490, 10494, 5, 434, 0, 0, 10491, 10494, 5, 476, 0, 0, 10492, 10494, 3, 1406, 703, 0, 10493, 10441, 1, 0, 0, 0, 10493, 10442, 1, 0, 0, 0, 10493, 10443, 1, 0, 0, 0, 10493, 10444, 1, 0, 0, 0, 10493, 10445, 1, 0, 0, 0, 10493, 10446, 1, 0, 0, 0, 10493, 10447, 1, 0, 0, 0, 10493, 10448, 1, 0, 0, 0, 10493, 10449, 1, 0, 0, 0, 10493, 10450, 1, 0, 0, 0, 10493, 10451, 1, 0, 0, 0, 10493, 10452, 1, 0, 0, 0, 10493, 10453, 1, 0, 0, 0, 10493, 10454, 1, 0, 0, 0, 10493, 10455, 1, 0, 0, 0, 10493, 10456, 1, 0, 0, 0, 10493, 10457, 1, 0, 0, 0, 10493, 10458, 1, 0, 0, 0, 10493, 10459, 1, 0, 0, 0, 10493, 10460, 1, 0, 0, 0, 10493, 10461, 1, 0, 0, 0, 10493, 10462, 1, 0, 0, 0, 10493, 10463, 1, 0, 0, 0, 10493, 10464, 1, 0, 0, 0, 10493, 10465, 1, 0, 0, 0, 10493, 10466, 1, 0, 0, 0, 10493, 10467, 1, 0, 0, 0, 10493, 10468, 1, 0, 0, 0, 10493, 10469, 1, 0, 0, 0, 10493, 10470, 1, 0, 0, 0, 10493, 10471, 1, 0, 0, 0, 10493, 10472, 1, 0, 0, 0, 10493, 10473, 1, 0, 0, 0, 10493, 10474, 1, 0, 0, 0, 10493, 10475, 1, 0, 0, 0, 10493, 10476, 1, 0, 0, 0, 10493, 10477, 1, 0, 0, 0, 10493, 10478, 1, 0, 0, 0, 10493, 10479, 1, 0, 0, 0, 10493, 10480, 1, 0, 0, 0, 10493, 10481, 1, 0, 0, 0, 10493, 10482, 1, 0, 0, 0, 10493, 10483, 1, 0, 0, 0, 10493, 10484, 1, 0, 0, 0, 10493, 10485, 1, 0, 0, 0, 10493, 10486, 1, 0, 0, 0, 10493, 10487, 1, 0, 0, 0, 10493, 10488, 1, 0, 0, 0, 10493, 10489, 1, 0, 0, 0, 10493, 10490, 1, 0, 0, 0, 10493, 10491, 1, 0, 0, 0, 10493, 10492, 1, 0, 0, 0, 10494, 1401, 1, 0, 0, 0, 10495, 10496, 7, 66, 0, 0, 10496, 1403, 1, 0, 0, 0, 10497, 10498, 7, 67, 0, 0, 10498, 1405, 1, 0, 0, 0, 10499, 10500, 7, 68, 0, 0, 10500, 1407, 1, 0, 0, 0, 10501, 10502, 3, 1410, 705, 0, 10502, 10504, 3, 1420, 710, 0, 10503, 10505, 3, 1418, 709, 0, 10504, 10503, 1, 0, 0, 0, 10504, 10505, 1, 0, 0, 0, 10505, 1409, 1, 0, 0, 0, 10506, 10508, 3, 1412, 706, 0, 10507, 10506, 1, 0, 0, 0, 10508, 10511, 1, 0, 0, 0, 10509, 10507, 1, 0, 0, 0, 10509, 10510, 1, 0, 0, 0, 10510, 1411, 1, 0, 0, 0, 10511, 10509, 1, 0, 0, 0, 10512, 10513, 3, 1414, 707, 0, 10513, 10514, 5, 272, 0, 0, 10514, 10515, 5, 492, 0, 0, 10515, 10533, 1, 0, 0, 0, 10516, 10517, 3, 1414, 707, 0, 10517, 10518, 5, 493, 0, 0, 10518, 10519, 3, 1416, 708, 0, 10519, 10533, 1, 0, 0, 0, 10520, 10521, 3, 1414, 707, 0, 10521, 10522, 5, 494, 0, 0, 10522, 10523, 5, 495, 0, 0, 10523, 10533, 1, 0, 0, 0, 10524, 10525, 3, 1414, 707, 0, 10525, 10526, 5, 494, 0, 0, 10526, 10527, 5, 496, 0, 0, 10527, 10533, 1, 0, 0, 0, 10528, 10529, 3, 1414, 707, 0, 10529, 10530, 5, 494, 0, 0, 10530, 10531, 5, 497, 0, 0, 10531, 10533, 1, 0, 0, 0, 10532, 10512, 1, 0, 0, 0, 10532, 10516, 1, 0, 0, 0, 10532, 10520, 1, 0, 0, 0, 10532, 10524, 1, 0, 0, 0, 10532, 10528, 1, 0, 0, 0, 10533, 1413, 1, 0, 0, 0, 10534, 10535, 5, 29, 0, 0, 10535, 1415, 1, 0, 0, 0, 10536, 10541, 3, 1370, 685, 0, 10537, 10541, 3, 1404, 702, 0, 10538, 10541, 3, 1620, 810, 0, 10539, 10541, 3, 1398, 699, 0, 10540, 10536, 1, 0, 0, 0, 10540, 10537, 1, 0, 0, 0, 10540, 10538, 1, 0, 0, 0, 10540, 10539, 1, 0, 0, 0, 10541, 1417, 1, 0, 0, 0, 10542, 10543, 5, 7, 0, 0, 10543, 1419, 1, 0, 0, 0, 10544, 10545, 3, 1422, 711, 0, 10545, 10546, 5, 146, 0, 0, 10546, 10548, 3, 1464, 732, 0, 10547, 10549, 3, 1600, 800, 0, 10548, 10547, 1, 0, 0, 0, 10548, 10549, 1, 0, 0, 0, 10549, 10550, 1, 0, 0, 0, 10550, 10552, 5, 456, 0, 0, 10551, 10553, 3, 1614, 807, 0, 10552, 10551, 1, 0, 0, 0, 10552, 10553, 1, 0, 0, 0, 10553, 1421, 1, 0, 0, 0, 10554, 10556, 3, 1610, 805, 0, 10555, 10554, 1, 0, 0, 0, 10555, 10556, 1, 0, 0, 0, 10556, 10561, 1, 0, 0, 0, 10557, 10559, 3, 1424, 712, 0, 10558, 10560, 3, 1426, 713, 0, 10559, 10558, 1, 0, 0, 0, 10559, 10560, 1, 0, 0, 0, 10560, 10562, 1, 0, 0, 0, 10561, 10557, 1, 0, 0, 0, 10561, 10562, 1, 0, 0, 0, 10562, 1423, 1, 0, 0, 0, 10563, 10564, 5, 178, 0, 0, 10564, 1425, 1, 0, 0, 0, 10565, 10567, 3, 1430, 715, 0, 10566, 10565, 1, 0, 0, 0, 10567, 10568, 1, 0, 0, 0, 10568, 10566, 1, 0, 0, 0, 10568, 10569, 1, 0, 0, 0, 10569, 1427, 1, 0, 0, 0, 10570, 10571, 5, 18, 0, 0, 10571, 10572, 3, 1618, 809, 0, 10572, 10573, 5, 19, 0, 0, 10573, 1429, 1, 0, 0, 0, 10574, 10578, 3, 1432, 716, 0, 10575, 10578, 5, 178, 0, 0, 10576, 10578, 3, 1428, 714, 0, 10577, 10574, 1, 0, 0, 0, 10577, 10575, 1, 0, 0, 0, 10577, 10576, 1, 0, 0, 0, 10578, 1431, 1, 0, 0, 0, 10579, 10606, 3, 1448, 724, 0, 10580, 10581, 5, 498, 0, 0, 10581, 10582, 5, 62, 0, 0, 10582, 10607, 3, 1446, 723, 0, 10583, 10585, 3, 1450, 725, 0, 10584, 10583, 1, 0, 0, 0, 10584, 10585, 1, 0, 0, 0, 10585, 10586, 1, 0, 0, 0, 10586, 10588, 3, 1452, 726, 0, 10587, 10589, 3, 1454, 727, 0, 10588, 10587, 1, 0, 0, 0, 10588, 10589, 1, 0, 0, 0, 10589, 10591, 1, 0, 0, 0, 10590, 10592, 3, 1456, 728, 0, 10591, 10590, 1, 0, 0, 0, 10591, 10592, 1, 0, 0, 0, 10592, 10594, 1, 0, 0, 0, 10593, 10595, 3, 1458, 729, 0, 10594, 10593, 1, 0, 0, 0, 10594, 10595, 1, 0, 0, 0, 10595, 10607, 1, 0, 0, 0, 10596, 10598, 3, 1434, 717, 0, 10597, 10596, 1, 0, 0, 0, 10597, 10598, 1, 0, 0, 0, 10598, 10599, 1, 0, 0, 0, 10599, 10601, 5, 172, 0, 0, 10600, 10602, 3, 1438, 719, 0, 10601, 10600, 1, 0, 0, 0, 10601, 10602, 1, 0, 0, 0, 10602, 10603, 1, 0, 0, 0, 10603, 10604, 3, 1444, 722, 0, 10604, 10605, 3, 1436, 718, 0, 10605, 10607, 1, 0, 0, 0, 10606, 10580, 1, 0, 0, 0, 10606, 10584, 1, 0, 0, 0, 10606, 10597, 1, 0, 0, 0, 10607, 10608, 1, 0, 0, 0, 10608, 10609, 5, 7, 0, 0, 10609, 1433, 1, 0, 0, 0, 10610, 10611, 5, 262, 0, 0, 10611, 10614, 5, 317, 0, 0, 10612, 10614, 5, 317, 0, 0, 10613, 10610, 1, 0, 0, 0, 10613, 10612, 1, 0, 0, 0, 10614, 1435, 1, 0, 0, 0, 10615, 10616, 3, 970, 485, 0, 10616, 1437, 1, 0, 0, 0, 10617, 10618, 5, 2, 0, 0, 10618, 10619, 3, 1440, 720, 0, 10619, 10620, 5, 3, 0, 0, 10620, 1439, 1, 0, 0, 0, 10621, 10626, 3, 1442, 721, 0, 10622, 10623, 5, 6, 0, 0, 10623, 10625, 3, 1442, 721, 0, 10624, 10622, 1, 0, 0, 0, 10625, 10628, 1, 0, 0, 0, 10626, 10624, 1, 0, 0, 0, 10626, 10627, 1, 0, 0, 0, 10627, 1441, 1, 0, 0, 0, 10628, 10626, 1, 0, 0, 0, 10629, 10630, 3, 1448, 724, 0, 10630, 10631, 3, 1452, 726, 0, 10631, 1443, 1, 0, 0, 0, 10632, 10633, 7, 69, 0, 0, 10633, 1445, 1, 0, 0, 0, 10634, 10637, 5, 28, 0, 0, 10635, 10637, 3, 1384, 692, 0, 10636, 10634, 1, 0, 0, 0, 10636, 10635, 1, 0, 0, 0, 10637, 1447, 1, 0, 0, 0, 10638, 10639, 3, 1618, 809, 0, 10639, 1449, 1, 0, 0, 0, 10640, 10641, 5, 499, 0, 0, 10641, 1451, 1, 0, 0, 0, 10642, 10643, 3, 1128, 564, 0, 10643, 1453, 1, 0, 0, 0, 10644, 10645, 5, 43, 0, 0, 10645, 10646, 3, 528, 264, 0, 10646, 1455, 1, 0, 0, 0, 10647, 10648, 5, 77, 0, 0, 10648, 10649, 5, 78, 0, 0, 10649, 1457, 1, 0, 0, 0, 10650, 10651, 3, 1460, 730, 0, 10651, 10652, 3, 1622, 811, 0, 10652, 1459, 1, 0, 0, 0, 10653, 10656, 3, 1462, 731, 0, 10654, 10656, 5, 53, 0, 0, 10655, 10653, 1, 0, 0, 0, 10655, 10654, 1, 0, 0, 0, 10656, 1461, 1, 0, 0, 0, 10657, 10658, 7, 70, 0, 0, 10658, 1463, 1, 0, 0, 0, 10659, 10661, 3, 1466, 733, 0, 10660, 10659, 1, 0, 0, 0, 10661, 10664, 1, 0, 0, 0, 10662, 10660, 1, 0, 0, 0, 10662, 10663, 1, 0, 0, 0, 10663, 1465, 1, 0, 0, 0, 10664, 10662, 1, 0, 0, 0, 10665, 10666, 3, 1420, 710, 0, 10666, 10667, 5, 7, 0, 0, 10667, 10693, 1, 0, 0, 0, 10668, 10693, 3, 1532, 766, 0, 10669, 10693, 3, 1536, 768, 0, 10670, 10693, 3, 1474, 737, 0, 10671, 10693, 3, 1490, 745, 0, 10672, 10693, 3, 1496, 748, 0, 10673, 10693, 3, 1506, 753, 0, 10674, 10693, 3, 1508, 754, 0, 10675, 10693, 3, 1510, 755, 0, 10676, 10693, 3, 1524, 762, 0, 10677, 10693, 3, 1528, 764, 0, 10678, 10693, 3, 1548, 774, 0, 10679, 10693, 3, 1554, 777, 0, 10680, 10693, 3, 1556, 778, 0, 10681, 10693, 3, 1468, 734, 0, 10682, 10693, 3, 1470, 735, 0, 10683, 10693, 3, 1476, 738, 0, 10684, 10693, 3, 1564, 782, 0, 10685, 10693, 3, 1576, 788, 0, 10686, 10693, 3, 1584, 792, 0, 10687, 10693, 3, 1586, 793, 0, 10688, 10693, 3, 1588, 794, 0, 10689, 10693, 3, 1590, 795, 0, 10690, 10693, 3, 1592, 796, 0, 10691, 10693, 3, 1596, 798, 0, 10692, 10665, 1, 0, 0, 0, 10692, 10668, 1, 0, 0, 0, 10692, 10669, 1, 0, 0, 0, 10692, 10670, 1, 0, 0, 0, 10692, 10671, 1, 0, 0, 0, 10692, 10672, 1, 0, 0, 0, 10692, 10673, 1, 0, 0, 0, 10692, 10674, 1, 0, 0, 0, 10692, 10675, 1, 0, 0, 0, 10692, 10676, 1, 0, 0, 0, 10692, 10677, 1, 0, 0, 0, 10692, 10678, 1, 0, 0, 0, 10692, 10679, 1, 0, 0, 0, 10692, 10680, 1, 0, 0, 0, 10692, 10681, 1, 0, 0, 0, 10692, 10682, 1, 0, 0, 0, 10692, 10683, 1, 0, 0, 0, 10692, 10684, 1, 0, 0, 0, 10692, 10685, 1, 0, 0, 0, 10692, 10686, 1, 0, 0, 0, 10692, 10687, 1, 0, 0, 0, 10692, 10688, 1, 0, 0, 0, 10692, 10689, 1, 0, 0, 0, 10692, 10690, 1, 0, 0, 0, 10692, 10691, 1, 0, 0, 0, 10693, 1467, 1, 0, 0, 0, 10694, 10695, 5, 500, 0, 0, 10695, 10696, 3, 1626, 813, 0, 10696, 10697, 5, 7, 0, 0, 10697, 1469, 1, 0, 0, 0, 10698, 10699, 5, 435, 0, 0, 10699, 10700, 3, 1618, 809, 0, 10700, 10702, 5, 2, 0, 0, 10701, 10703, 3, 1472, 736, 0, 10702, 10701, 1, 0, 0, 0, 10702, 10703, 1, 0, 0, 0, 10703, 10704, 1, 0, 0, 0, 10704, 10705, 5, 3, 0, 0, 10705, 10706, 5, 7, 0, 0, 10706, 10717, 1, 0, 0, 0, 10707, 10708, 5, 57, 0, 0, 10708, 10709, 3, 1618, 809, 0, 10709, 10711, 5, 2, 0, 0, 10710, 10712, 3, 1472, 736, 0, 10711, 10710, 1, 0, 0, 0, 10711, 10712, 1, 0, 0, 0, 10712, 10713, 1, 0, 0, 0, 10713, 10714, 5, 3, 0, 0, 10714, 10715, 5, 7, 0, 0, 10715, 10717, 1, 0, 0, 0, 10716, 10698, 1, 0, 0, 0, 10716, 10707, 1, 0, 0, 0, 10717, 1471, 1, 0, 0, 0, 10718, 10719, 3, 1290, 645, 0, 10719, 1473, 1, 0, 0, 0, 10720, 10721, 3, 1488, 744, 0, 10721, 10722, 3, 1462, 731, 0, 10722, 10723, 3, 1622, 811, 0, 10723, 10724, 5, 7, 0, 0, 10724, 1475, 1, 0, 0, 0, 10725, 10727, 5, 501, 0, 0, 10726, 10728, 3, 1478, 739, 0, 10727, 10726, 1, 0, 0, 0, 10727, 10728, 1, 0, 0, 0, 10728, 10729, 1, 0, 0, 0, 10729, 10730, 5, 502, 0, 0, 10730, 10731, 3, 1480, 740, 0, 10731, 10732, 5, 7, 0, 0, 10732, 1477, 1, 0, 0, 0, 10733, 10734, 7, 71, 0, 0, 10734, 1479, 1, 0, 0, 0, 10735, 10740, 3, 1482, 741, 0, 10736, 10737, 5, 6, 0, 0, 10737, 10739, 3, 1482, 741, 0, 10738, 10736, 1, 0, 0, 0, 10739, 10742, 1, 0, 0, 0, 10740, 10738, 1, 0, 0, 0, 10740, 10741, 1, 0, 0, 0, 10741, 1481, 1, 0, 0, 0, 10742, 10740, 1, 0, 0, 0, 10743, 10744, 3, 1486, 743, 0, 10744, 10745, 3, 1462, 731, 0, 10745, 10746, 3, 1484, 742, 0, 10746, 1483, 1, 0, 0, 0, 10747, 10748, 3, 1384, 692, 0, 10748, 1485, 1, 0, 0, 0, 10749, 10750, 3, 1488, 744, 0, 10750, 1487, 1, 0, 0, 0, 10751, 10754, 3, 528, 264, 0, 10752, 10754, 5, 28, 0, 0, 10753, 10751, 1, 0, 0, 0, 10753, 10752, 1, 0, 0, 0, 10754, 10761, 1, 0, 0, 0, 10755, 10756, 5, 4, 0, 0, 10756, 10757, 3, 1628, 814, 0, 10757, 10758, 5, 5, 0, 0, 10758, 10760, 1, 0, 0, 0, 10759, 10755, 1, 0, 0, 0, 10760, 10763, 1, 0, 0, 0, 10761, 10759, 1, 0, 0, 0, 10761, 10762, 1, 0, 0, 0, 10762, 1489, 1, 0, 0, 0, 10763, 10761, 1, 0, 0, 0, 10764, 10765, 5, 220, 0, 0, 10765, 10766, 3, 1624, 812, 0, 10766, 10767, 5, 93, 0, 0, 10767, 10768, 3, 1464, 732, 0, 10768, 10770, 3, 1492, 746, 0, 10769, 10771, 3, 1494, 747, 0, 10770, 10769, 1, 0, 0, 0, 10770, 10771, 1, 0, 0, 0, 10771, 10772, 1, 0, 0, 0, 10772, 10773, 5, 456, 0, 0, 10773, 10774, 5, 220, 0, 0, 10774, 10775, 5, 7, 0, 0, 10775, 1491, 1, 0, 0, 0, 10776, 10777, 5, 504, 0, 0, 10777, 10778, 3, 1172, 586, 0, 10778, 10779, 5, 93, 0, 0, 10779, 10780, 3, 1464, 732, 0, 10780, 10782, 1, 0, 0, 0, 10781, 10776, 1, 0, 0, 0, 10782, 10785, 1, 0, 0, 0, 10783, 10781, 1, 0, 0, 0, 10783, 10784, 1, 0, 0, 0, 10784, 1493, 1, 0, 0, 0, 10785, 10783, 1, 0, 0, 0, 10786, 10787, 5, 58, 0, 0, 10787, 10788, 3, 1464, 732, 0, 10788, 1495, 1, 0, 0, 0, 10789, 10791, 5, 40, 0, 0, 10790, 10792, 3, 1498, 749, 0, 10791, 10790, 1, 0, 0, 0, 10791, 10792, 1, 0, 0, 0, 10792, 10793, 1, 0, 0, 0, 10793, 10795, 3, 1500, 750, 0, 10794, 10796, 3, 1504, 752, 0, 10795, 10794, 1, 0, 0, 0, 10795, 10796, 1, 0, 0, 0, 10796, 10797, 1, 0, 0, 0, 10797, 10798, 5, 456, 0, 0, 10798, 10799, 5, 40, 0, 0, 10799, 10800, 5, 7, 0, 0, 10800, 1497, 1, 0, 0, 0, 10801, 10802, 3, 1622, 811, 0, 10802, 1499, 1, 0, 0, 0, 10803, 10805, 3, 1502, 751, 0, 10804, 10803, 1, 0, 0, 0, 10805, 10806, 1, 0, 0, 0, 10806, 10804, 1, 0, 0, 0, 10806, 10807, 1, 0, 0, 0, 10807, 1501, 1, 0, 0, 0, 10808, 10809, 5, 102, 0, 0, 10809, 10810, 3, 1290, 645, 0, 10810, 10811, 5, 93, 0, 0, 10811, 10812, 3, 1464, 732, 0, 10812, 1503, 1, 0, 0, 0, 10813, 10814, 5, 58, 0, 0, 10814, 10815, 3, 1464, 732, 0, 10815, 1505, 1, 0, 0, 0, 10816, 10818, 3, 1612, 806, 0, 10817, 10816, 1, 0, 0, 0, 10817, 10818, 1, 0, 0, 0, 10818, 10819, 1, 0, 0, 0, 10819, 10820, 3, 1552, 776, 0, 10820, 1507, 1, 0, 0, 0, 10821, 10823, 3, 1612, 806, 0, 10822, 10821, 1, 0, 0, 0, 10822, 10823, 1, 0, 0, 0, 10823, 10824, 1, 0, 0, 0, 10824, 10825, 5, 505, 0, 0, 10825, 10826, 3, 1630, 815, 0, 10826, 10827, 3, 1552, 776, 0, 10827, 1509, 1, 0, 0, 0, 10828, 10830, 3, 1612, 806, 0, 10829, 10828, 1, 0, 0, 0, 10829, 10830, 1, 0, 0, 0, 10830, 10831, 1, 0, 0, 0, 10831, 10832, 5, 62, 0, 0, 10832, 10833, 3, 1512, 756, 0, 10833, 10834, 3, 1552, 776, 0, 10834, 1511, 1, 0, 0, 0, 10835, 10836, 3, 1522, 761, 0, 10836, 10857, 5, 68, 0, 0, 10837, 10839, 3, 964, 482, 0, 10838, 10840, 3, 1516, 758, 0, 10839, 10838, 1, 0, 0, 0, 10839, 10840, 1, 0, 0, 0, 10840, 10858, 1, 0, 0, 0, 10841, 10858, 3, 970, 485, 0, 10842, 10858, 3, 888, 444, 0, 10843, 10844, 5, 202, 0, 0, 10844, 10846, 3, 1172, 586, 0, 10845, 10847, 3, 1514, 757, 0, 10846, 10845, 1, 0, 0, 0, 10846, 10847, 1, 0, 0, 0, 10847, 10858, 1, 0, 0, 0, 10848, 10850, 3, 1518, 759, 0, 10849, 10848, 1, 0, 0, 0, 10849, 10850, 1, 0, 0, 0, 10850, 10851, 1, 0, 0, 0, 10851, 10852, 3, 1172, 586, 0, 10852, 10853, 5, 24, 0, 0, 10853, 10855, 3, 1172, 586, 0, 10854, 10856, 3, 1520, 760, 0, 10855, 10854, 1, 0, 0, 0, 10855, 10856, 1, 0, 0, 0, 10856, 10858, 1, 0, 0, 0, 10857, 10837, 1, 0, 0, 0, 10857, 10841, 1, 0, 0, 0, 10857, 10842, 1, 0, 0, 0, 10857, 10843, 1, 0, 0, 0, 10857, 10849, 1, 0, 0, 0, 10858, 1513, 1, 0, 0, 0, 10859, 10860, 5, 100, 0, 0, 10860, 10861, 3, 1290, 645, 0, 10861, 1515, 1, 0, 0, 0, 10862, 10863, 5, 2, 0, 0, 10863, 10868, 3, 1172, 586, 0, 10864, 10865, 5, 6, 0, 0, 10865, 10867, 3, 1172, 586, 0, 10866, 10864, 1, 0, 0, 0, 10867, 10870, 1, 0, 0, 0, 10868, 10866, 1, 0, 0, 0, 10868, 10869, 1, 0, 0, 0, 10869, 10871, 1, 0, 0, 0, 10870, 10868, 1, 0, 0, 0, 10871, 10872, 5, 3, 0, 0, 10872, 1517, 1, 0, 0, 0, 10873, 10874, 5, 506, 0, 0, 10874, 1519, 1, 0, 0, 0, 10875, 10876, 5, 147, 0, 0, 10876, 10877, 3, 1172, 586, 0, 10877, 1521, 1, 0, 0, 0, 10878, 10879, 3, 526, 263, 0, 10879, 1523, 1, 0, 0, 0, 10880, 10882, 3, 1612, 806, 0, 10881, 10880, 1, 0, 0, 0, 10881, 10882, 1, 0, 0, 0, 10882, 10883, 1, 0, 0, 0, 10883, 10884, 5, 507, 0, 0, 10884, 10886, 3, 1522, 761, 0, 10885, 10887, 3, 1526, 763, 0, 10886, 10885, 1, 0, 0, 0, 10886, 10887, 1, 0, 0, 0, 10887, 10888, 1, 0, 0, 0, 10888, 10889, 5, 68, 0, 0, 10889, 10890, 5, 35, 0, 0, 10890, 10891, 3, 1172, 586, 0, 10891, 10892, 3, 1552, 776, 0, 10892, 1525, 1, 0, 0, 0, 10893, 10894, 5, 508, 0, 0, 10894, 10895, 3, 1368, 684, 0, 10895, 1527, 1, 0, 0, 0, 10896, 10898, 3, 1530, 765, 0, 10897, 10899, 3, 1614, 807, 0, 10898, 10897, 1, 0, 0, 0, 10898, 10899, 1, 0, 0, 0, 10899, 10901, 1, 0, 0, 0, 10900, 10902, 3, 1616, 808, 0, 10901, 10900, 1, 0, 0, 0, 10901, 10902, 1, 0, 0, 0, 10902, 10903, 1, 0, 0, 0, 10903, 10904, 5, 7, 0, 0, 10904, 1529, 1, 0, 0, 0, 10905, 10906, 7, 72, 0, 0, 10906, 1531, 1, 0, 0, 0, 10907, 10922, 5, 510, 0, 0, 10908, 10909, 5, 261, 0, 0, 10909, 10923, 3, 1622, 811, 0, 10910, 10917, 5, 511, 0, 0, 10911, 10912, 5, 202, 0, 0, 10912, 10914, 3, 1172, 586, 0, 10913, 10915, 3, 1514, 757, 0, 10914, 10913, 1, 0, 0, 0, 10914, 10915, 1, 0, 0, 0, 10915, 10918, 1, 0, 0, 0, 10916, 10918, 3, 970, 485, 0, 10917, 10911, 1, 0, 0, 0, 10917, 10916, 1, 0, 0, 0, 10918, 10923, 1, 0, 0, 0, 10919, 10921, 3, 1534, 767, 0, 10920, 10919, 1, 0, 0, 0, 10920, 10921, 1, 0, 0, 0, 10921, 10923, 1, 0, 0, 0, 10922, 10908, 1, 0, 0, 0, 10922, 10910, 1, 0, 0, 0, 10922, 10920, 1, 0, 0, 0, 10923, 10924, 1, 0, 0, 0, 10924, 10925, 5, 7, 0, 0, 10925, 1533, 1, 0, 0, 0, 10926, 10927, 3, 1622, 811, 0, 10927, 1535, 1, 0, 0, 0, 10928, 10930, 5, 512, 0, 0, 10929, 10931, 3, 1538, 769, 0, 10930, 10929, 1, 0, 0, 0, 10930, 10931, 1, 0, 0, 0, 10931, 10932, 1, 0, 0, 0, 10932, 10934, 3, 1370, 685, 0, 10933, 10935, 3, 1540, 770, 0, 10934, 10933, 1, 0, 0, 0, 10934, 10935, 1, 0, 0, 0, 10935, 10937, 1, 0, 0, 0, 10936, 10938, 3, 1542, 771, 0, 10937, 10936, 1, 0, 0, 0, 10937, 10938, 1, 0, 0, 0, 10938, 10939, 1, 0, 0, 0, 10939, 10940, 5, 7, 0, 0, 10940, 10972, 1, 0, 0, 0, 10941, 10943, 5, 512, 0, 0, 10942, 10944, 3, 1538, 769, 0, 10943, 10942, 1, 0, 0, 0, 10943, 10944, 1, 0, 0, 0, 10944, 10945, 1, 0, 0, 0, 10945, 10947, 3, 1394, 697, 0, 10946, 10948, 3, 1542, 771, 0, 10947, 10946, 1, 0, 0, 0, 10947, 10948, 1, 0, 0, 0, 10948, 10949, 1, 0, 0, 0, 10949, 10950, 5, 7, 0, 0, 10950, 10972, 1, 0, 0, 0, 10951, 10953, 5, 512, 0, 0, 10952, 10954, 3, 1538, 769, 0, 10953, 10952, 1, 0, 0, 0, 10953, 10954, 1, 0, 0, 0, 10954, 10955, 1, 0, 0, 0, 10955, 10956, 5, 513, 0, 0, 10956, 10958, 3, 1370, 685, 0, 10957, 10959, 3, 1542, 771, 0, 10958, 10957, 1, 0, 0, 0, 10958, 10959, 1, 0, 0, 0, 10959, 10960, 1, 0, 0, 0, 10960, 10961, 5, 7, 0, 0, 10961, 10972, 1, 0, 0, 0, 10962, 10964, 5, 512, 0, 0, 10963, 10965, 3, 1538, 769, 0, 10964, 10963, 1, 0, 0, 0, 10964, 10965, 1, 0, 0, 0, 10965, 10967, 1, 0, 0, 0, 10966, 10968, 3, 1542, 771, 0, 10967, 10966, 1, 0, 0, 0, 10967, 10968, 1, 0, 0, 0, 10968, 10969, 1, 0, 0, 0, 10969, 10972, 5, 7, 0, 0, 10970, 10972, 5, 512, 0, 0, 10971, 10928, 1, 0, 0, 0, 10971, 10941, 1, 0, 0, 0, 10971, 10951, 1, 0, 0, 0, 10971, 10962, 1, 0, 0, 0, 10971, 10970, 1, 0, 0, 0, 10972, 1537, 1, 0, 0, 0, 10973, 10974, 7, 73, 0, 0, 10974, 1539, 1, 0, 0, 0, 10975, 10976, 5, 6, 0, 0, 10976, 10978, 3, 1172, 586, 0, 10977, 10975, 1, 0, 0, 0, 10978, 10979, 1, 0, 0, 0, 10979, 10977, 1, 0, 0, 0, 10979, 10980, 1, 0, 0, 0, 10980, 1541, 1, 0, 0, 0, 10981, 10982, 5, 100, 0, 0, 10982, 10983, 3, 1546, 773, 0, 10983, 1543, 1, 0, 0, 0, 10984, 10985, 3, 1394, 697, 0, 10985, 10986, 5, 10, 0, 0, 10986, 10987, 3, 1172, 586, 0, 10987, 1545, 1, 0, 0, 0, 10988, 10993, 3, 1544, 772, 0, 10989, 10990, 5, 6, 0, 0, 10990, 10992, 3, 1544, 772, 0, 10991, 10989, 1, 0, 0, 0, 10992, 10995, 1, 0, 0, 0, 10993, 10991, 1, 0, 0, 0, 10993, 10994, 1, 0, 0, 0, 10994, 1547, 1, 0, 0, 0, 10995, 10993, 1, 0, 0, 0, 10996, 10997, 5, 520, 0, 0, 10997, 10999, 3, 1622, 811, 0, 10998, 11000, 3, 1550, 775, 0, 10999, 10998, 1, 0, 0, 0, 10999, 11000, 1, 0, 0, 0, 11000, 11001, 1, 0, 0, 0, 11001, 11002, 5, 7, 0, 0, 11002, 1549, 1, 0, 0, 0, 11003, 11004, 5, 6, 0, 0, 11004, 11005, 3, 1622, 811, 0, 11005, 1551, 1, 0, 0, 0, 11006, 11007, 5, 521, 0, 0, 11007, 11008, 3, 1464, 732, 0, 11008, 11009, 5, 456, 0, 0, 11009, 11011, 5, 521, 0, 0, 11010, 11012, 3, 1614, 807, 0, 11011, 11010, 1, 0, 0, 0, 11011, 11012, 1, 0, 0, 0, 11012, 11013, 1, 0, 0, 0, 11013, 11014, 5, 7, 0, 0, 11014, 1553, 1, 0, 0, 0, 11015, 11016, 3, 1632, 816, 0, 11016, 11017, 5, 7, 0, 0, 11017, 1555, 1, 0, 0, 0, 11018, 11019, 5, 202, 0, 0, 11019, 11033, 3, 1172, 586, 0, 11020, 11022, 3, 1562, 781, 0, 11021, 11020, 1, 0, 0, 0, 11021, 11022, 1, 0, 0, 0, 11022, 11024, 1, 0, 0, 0, 11023, 11025, 3, 1558, 779, 0, 11024, 11023, 1, 0, 0, 0, 11024, 11025, 1, 0, 0, 0, 11025, 11034, 1, 0, 0, 0, 11026, 11028, 3, 1558, 779, 0, 11027, 11026, 1, 0, 0, 0, 11027, 11028, 1, 0, 0, 0, 11028, 11030, 1, 0, 0, 0, 11029, 11031, 3, 1562, 781, 0, 11030, 11029, 1, 0, 0, 0, 11030, 11031, 1, 0, 0, 0, 11031, 11034, 1, 0, 0, 0, 11032, 11034, 1, 0, 0, 0, 11033, 11021, 1, 0, 0, 0, 11033, 11027, 1, 0, 0, 0, 11033, 11032, 1, 0, 0, 0, 11034, 11035, 1, 0, 0, 0, 11035, 11036, 5, 7, 0, 0, 11036, 1557, 1, 0, 0, 0, 11037, 11038, 5, 100, 0, 0, 11038, 11039, 3, 1560, 780, 0, 11039, 1559, 1, 0, 0, 0, 11040, 11045, 3, 1172, 586, 0, 11041, 11042, 5, 6, 0, 0, 11042, 11044, 3, 1172, 586, 0, 11043, 11041, 1, 0, 0, 0, 11044, 11047, 1, 0, 0, 0, 11045, 11043, 1, 0, 0, 0, 11045, 11046, 1, 0, 0, 0, 11046, 1561, 1, 0, 0, 0, 11047, 11045, 1, 0, 0, 0, 11048, 11050, 5, 71, 0, 0, 11049, 11051, 5, 339, 0, 0, 11050, 11049, 1, 0, 0, 0, 11050, 11051, 1, 0, 0, 0, 11051, 11052, 1, 0, 0, 0, 11052, 11053, 3, 1578, 789, 0, 11053, 1563, 1, 0, 0, 0, 11054, 11075, 5, 522, 0, 0, 11055, 11057, 3, 1598, 799, 0, 11056, 11058, 3, 1572, 786, 0, 11057, 11056, 1, 0, 0, 0, 11057, 11058, 1, 0, 0, 0, 11058, 11059, 1, 0, 0, 0, 11059, 11066, 5, 62, 0, 0, 11060, 11067, 3, 970, 485, 0, 11061, 11062, 5, 202, 0, 0, 11062, 11064, 3, 1622, 811, 0, 11063, 11065, 3, 1570, 785, 0, 11064, 11063, 1, 0, 0, 0, 11064, 11065, 1, 0, 0, 0, 11065, 11067, 1, 0, 0, 0, 11066, 11060, 1, 0, 0, 0, 11066, 11061, 1, 0, 0, 0, 11067, 11076, 1, 0, 0, 0, 11068, 11073, 3, 1384, 692, 0, 11069, 11070, 5, 2, 0, 0, 11070, 11071, 3, 1568, 784, 0, 11071, 11072, 5, 3, 0, 0, 11072, 11074, 1, 0, 0, 0, 11073, 11069, 1, 0, 0, 0, 11073, 11074, 1, 0, 0, 0, 11074, 11076, 1, 0, 0, 0, 11075, 11055, 1, 0, 0, 0, 11075, 11068, 1, 0, 0, 0, 11076, 11077, 1, 0, 0, 0, 11077, 11078, 5, 7, 0, 0, 11078, 1565, 1, 0, 0, 0, 11079, 11080, 3, 1384, 692, 0, 11080, 11081, 5, 20, 0, 0, 11081, 11082, 3, 1172, 586, 0, 11082, 11085, 1, 0, 0, 0, 11083, 11085, 3, 1172, 586, 0, 11084, 11079, 1, 0, 0, 0, 11084, 11083, 1, 0, 0, 0, 11085, 1567, 1, 0, 0, 0, 11086, 11091, 3, 1566, 783, 0, 11087, 11088, 5, 6, 0, 0, 11088, 11090, 3, 1566, 783, 0, 11089, 11087, 1, 0, 0, 0, 11090, 11093, 1, 0, 0, 0, 11091, 11089, 1, 0, 0, 0, 11091, 11092, 1, 0, 0, 0, 11092, 1569, 1, 0, 0, 0, 11093, 11091, 1, 0, 0, 0, 11094, 11095, 5, 100, 0, 0, 11095, 11096, 3, 1290, 645, 0, 11096, 1571, 1, 0, 0, 0, 11097, 11099, 3, 1574, 787, 0, 11098, 11097, 1, 0, 0, 0, 11098, 11099, 1, 0, 0, 0, 11099, 11100, 1, 0, 0, 0, 11100, 11101, 5, 317, 0, 0, 11101, 1573, 1, 0, 0, 0, 11102, 11103, 5, 262, 0, 0, 11103, 1575, 1, 0, 0, 0, 11104, 11106, 5, 61, 0, 0, 11105, 11107, 3, 1582, 791, 0, 11106, 11105, 1, 0, 0, 0, 11106, 11107, 1, 0, 0, 0, 11107, 11109, 1, 0, 0, 0, 11108, 11110, 3, 1580, 790, 0, 11109, 11108, 1, 0, 0, 0, 11109, 11110, 1, 0, 0, 0, 11110, 11111, 1, 0, 0, 0, 11111, 11112, 3, 1598, 799, 0, 11112, 11113, 5, 71, 0, 0, 11113, 11114, 3, 1578, 789, 0, 11114, 11115, 5, 7, 0, 0, 11115, 1577, 1, 0, 0, 0, 11116, 11117, 3, 1290, 645, 0, 11117, 1579, 1, 0, 0, 0, 11118, 11119, 7, 26, 0, 0, 11119, 1581, 1, 0, 0, 0, 11120, 11136, 5, 261, 0, 0, 11121, 11136, 5, 286, 0, 0, 11122, 11136, 5, 207, 0, 0, 11123, 11136, 5, 240, 0, 0, 11124, 11125, 5, 130, 0, 0, 11125, 11136, 3, 1172, 586, 0, 11126, 11127, 5, 300, 0, 0, 11127, 11136, 3, 1172, 586, 0, 11128, 11136, 3, 1172, 586, 0, 11129, 11136, 5, 30, 0, 0, 11130, 11133, 7, 74, 0, 0, 11131, 11134, 3, 1172, 586, 0, 11132, 11134, 5, 30, 0, 0, 11133, 11131, 1, 0, 0, 0, 11133, 11132, 1, 0, 0, 0, 11133, 11134, 1, 0, 0, 0, 11134, 11136, 1, 0, 0, 0, 11135, 11120, 1, 0, 0, 0, 11135, 11121, 1, 0, 0, 0, 11135, 11122, 1, 0, 0, 0, 11135, 11123, 1, 0, 0, 0, 11135, 11124, 1, 0, 0, 0, 11135, 11126, 1, 0, 0, 0, 11135, 11128, 1, 0, 0, 0, 11135, 11129, 1, 0, 0, 0, 11135, 11130, 1, 0, 0, 0, 11136, 1583, 1, 0, 0, 0, 11137, 11139, 5, 258, 0, 0, 11138, 11140, 3, 1582, 791, 0, 11139, 11138, 1, 0, 0, 0, 11139, 11140, 1, 0, 0, 0, 11140, 11141, 1, 0, 0, 0, 11141, 11142, 3, 1598, 799, 0, 11142, 11143, 5, 7, 0, 0, 11143, 1585, 1, 0, 0, 0, 11144, 11145, 5, 157, 0, 0, 11145, 11146, 3, 1598, 799, 0, 11146, 11147, 5, 7, 0, 0, 11147, 1587, 1, 0, 0, 0, 11148, 11149, 5, 78, 0, 0, 11149, 11150, 5, 7, 0, 0, 11150, 1589, 1, 0, 0, 0, 11151, 11153, 5, 161, 0, 0, 11152, 11154, 3, 1594, 797, 0, 11153, 11152, 1, 0, 0, 0, 11153, 11154, 1, 0, 0, 0, 11154, 11155, 1, 0, 0, 0, 11155, 11156, 5, 7, 0, 0, 11156, 1591, 1, 0, 0, 0, 11157, 11159, 5, 312, 0, 0, 11158, 11160, 3, 1594, 797, 0, 11159, 11158, 1, 0, 0, 0, 11159, 11160, 1, 0, 0, 0, 11160, 11161, 1, 0, 0, 0, 11161, 11162, 5, 7, 0, 0, 11162, 1593, 1, 0, 0, 0, 11163, 11165, 5, 33, 0, 0, 11164, 11166, 5, 262, 0, 0, 11165, 11164, 1, 0, 0, 0, 11165, 11166, 1, 0, 0, 0, 11166, 11167, 1, 0, 0, 0, 11167, 11168, 5, 153, 0, 0, 11168, 1595, 1, 0, 0, 0, 11169, 11170, 5, 326, 0, 0, 11170, 11171, 3, 528, 264, 0, 11171, 11172, 5, 94, 0, 0, 11172, 11173, 5, 53, 0, 0, 11173, 11174, 5, 7, 0, 0, 11174, 11182, 1, 0, 0, 0, 11175, 11178, 5, 306, 0, 0, 11176, 11179, 3, 528, 264, 0, 11177, 11179, 5, 30, 0, 0, 11178, 11176, 1, 0, 0, 0, 11178, 11177, 1, 0, 0, 0, 11179, 11180, 1, 0, 0, 0, 11180, 11182, 5, 7, 0, 0, 11181, 11169, 1, 0, 0, 0, 11181, 11175, 1, 0, 0, 0, 11182, 1597, 1, 0, 0, 0, 11183, 11186, 3, 1384, 692, 0, 11184, 11186, 5, 28, 0, 0, 11185, 11183, 1, 0, 0, 0, 11185, 11184, 1, 0, 0, 0, 11186, 1599, 1, 0, 0, 0, 11187, 11188, 5, 519, 0, 0, 11188, 11189, 3, 1602, 801, 0, 11189, 1601, 1, 0, 0, 0, 11190, 11192, 3, 1604, 802, 0, 11191, 11190, 1, 0, 0, 0, 11192, 11193, 1, 0, 0, 0, 11193, 11191, 1, 0, 0, 0, 11193, 11194, 1, 0, 0, 0, 11194, 1603, 1, 0, 0, 0, 11195, 11196, 5, 102, 0, 0, 11196, 11197, 3, 1606, 803, 0, 11197, 11198, 5, 93, 0, 0, 11198, 11199, 3, 1464, 732, 0, 11199, 1605, 1, 0, 0, 0, 11200, 11205, 3, 1608, 804, 0, 11201, 11202, 5, 82, 0, 0, 11202, 11204, 3, 1608, 804, 0, 11203, 11201, 1, 0, 0, 0, 11204, 11207, 1, 0, 0, 0, 11205, 11203, 1, 0, 0, 0, 11205, 11206, 1, 0, 0, 0, 11206, 1607, 1, 0, 0, 0, 11207, 11205, 1, 0, 0, 0, 11208, 11212, 3, 1618, 809, 0, 11209, 11210, 5, 513, 0, 0, 11210, 11212, 3, 1370, 685, 0, 11211, 11208, 1, 0, 0, 0, 11211, 11209, 1, 0, 0, 0, 11212, 1609, 1, 0, 0, 0, 11213, 11214, 3, 1428, 714, 0, 11214, 1611, 1, 0, 0, 0, 11215, 11216, 3, 1428, 714, 0, 11216, 1613, 1, 0, 0, 0, 11217, 11218, 3, 1618, 809, 0, 11218, 1615, 1, 0, 0, 0, 11219, 11220, 5, 102, 0, 0, 11220, 11221, 3, 1626, 813, 0, 11221, 1617, 1, 0, 0, 0, 11222, 11225, 3, 1384, 692, 0, 11223, 11225, 3, 1620, 810, 0, 11224, 11222, 1, 0, 0, 0, 11224, 11223, 1, 0, 0, 0, 11225, 1619, 1, 0, 0, 0, 11226, 11227, 7, 75, 0, 0, 11227, 1621, 1, 0, 0, 0, 11228, 11230, 3, 1338, 669, 0, 11229, 11228, 1, 0, 0, 0, 11229, 11230, 1, 0, 0, 0, 11230, 11232, 1, 0, 0, 0, 11231, 11233, 3, 992, 496, 0, 11232, 11231, 1, 0, 0, 0, 11232, 11233, 1, 0, 0, 0, 11233, 11235, 1, 0, 0, 0, 11234, 11236, 3, 1064, 532, 0, 11235, 11234, 1, 0, 0, 0, 11235, 11236, 1, 0, 0, 0, 11236, 11238, 1, 0, 0, 0, 11237, 11239, 3, 1104, 552, 0, 11238, 11237, 1, 0, 0, 0, 11238, 11239, 1, 0, 0, 0, 11239, 11241, 1, 0, 0, 0, 11240, 11242, 3, 1034, 517, 0, 11241, 11240, 1, 0, 0, 0, 11241, 11242, 1, 0, 0, 0, 11242, 11244, 1, 0, 0, 0, 11243, 11245, 3, 1048, 524, 0, 11244, 11243, 1, 0, 0, 0, 11244, 11245, 1, 0, 0, 0, 11245, 11247, 1, 0, 0, 0, 11246, 11248, 3, 1250, 625, 0, 11247, 11246, 1, 0, 0, 0, 11247, 11248, 1, 0, 0, 0, 11248, 1623, 1, 0, 0, 0, 11249, 11250, 3, 1622, 811, 0, 11250, 1625, 1, 0, 0, 0, 11251, 11252, 3, 1622, 811, 0, 11252, 1627, 1, 0, 0, 0, 11253, 11254, 3, 1172, 586, 0, 11254, 1629, 1, 0, 0, 0, 11255, 11256, 3, 1172, 586, 0, 11256, 1631, 1, 0, 0, 0, 11257, 11259, 3, 8, 4, 0, 11258, 11260, 3, 1634, 817, 0, 11259, 11258, 1, 0, 0, 0, 11259, 11260, 1, 0, 0, 0, 11260, 1633, 1, 0, 0, 0, 11261, 11263, 5, 71, 0, 0, 11262, 11264, 3, 994, 497, 0, 11263, 11262, 1, 0, 0, 0, 11263, 11264, 1, 0, 0, 0, 11264, 11265, 1, 0, 0, 0, 11265, 11266, 3, 1578, 789, 0, 11266, 1635, 1, 0, 0, 0, 1119, 1645, 1649, 1777, 1781, 1790, 1799, 1805, 1811, 1826, 1838, 1844, 1852, 1863, 1867, 1875, 1883, 1901, 1904, 1909, 1918, 1927, 1931, 1943, 1963, 1976, 1983, 1991, 1996, 2003, 2009, 2016, 2027, 2031, 2035, 2048, 2052, 2057, 2062, 2074, 2083, 2096, 2101, 2112, 2118, 2124, 2129, 2140, 2146, 2152, 2161, 2171, 2186, 2192, 2199, 2204, 2211, 2222, 2246, 2253, 2262, 2271, 2279, 2289, 2298, 2307, 2315, 2323, 2332, 2341, 2345, 2352, 2360, 2370, 2376, 2380, 2384, 2388, 2392, 2397, 2400, 2404, 2425, 2431, 2530, 2537, 2553, 2567, 2577, 2579, 2584, 2588, 2591, 2597, 2599, 2627, 2637, 2650, 2657, 2663, 2667, 2673, 2678, 2681, 2683, 2688, 2692, 2696, 2700, 2704, 2707, 2711, 2719, 2723, 2727, 2736, 2743, 2748, 2755, 2760, 2767, 2772, 2790, 2795, 2807, 2812, 2821, 2828, 2835, 2841, 2846, 2850, 2853, 2856, 2859, 2862, 2865, 2870, 2873, 2876, 2879, 2882, 2885, 2891, 2895, 2898, 2901, 2904, 2907, 2909, 2918, 2931, 2939, 2945, 2949, 2955, 2963, 2966, 2970, 2998, 3003, 3010, 3021, 3028, 3031, 3034, 3039, 3042, 3049, 3058, 3065, 3070, 3073, 3076, 3078, 3082, 3089, 3096, 3106, 3116, 3126, 3132, 3135, 3138, 3145, 3153, 3156, 3159, 3166, 3170, 3176, 3179, 3182, 3185, 3197, 3200, 3203, 3207, 3221, 3239, 3250, 3265, 3282, 3284, 3305, 3310, 3313, 3317, 3320, 3326, 3329, 3331, 3340, 3349, 3368, 3372, 3383, 3392, 3398, 3404, 3408, 3411, 3414, 3417, 3420, 3426, 3430, 3437, 3443, 3447, 3450, 3453, 3456, 3464, 3468, 3472, 3478, 3482, 3488, 3502, 3511, 3529, 3534, 3537, 3540, 3550, 3557, 3562, 3565, 3568, 3575, 3578, 3580, 3586, 3595, 3605, 3610, 3619, 3628, 3632, 3639, 3649, 3660, 3770, 3778, 3781, 3791, 3796, 3806, 3817, 3829, 3842, 3852, 3865, 3868, 3875, 3884, 3887, 3894, 3896, 3904, 3914, 3916, 3924, 3928, 3933, 3944, 3948, 3953, 3963, 3969, 3982, 3988, 3990, 3997, 4005, 4010, 4025, 4038, 4040, 4044, 4064, 4081, 4084, 4087, 4090, 4093, 4101, 4104, 4107, 4153, 4156, 4159, 4177, 4184, 4193, 4199, 4206, 4216, 4224, 4229, 4241, 4258, 4264, 4271, 4279, 4293, 4321, 4328, 4342, 4357, 4370, 4379, 4404, 4415, 4482, 4493, 4499, 4507, 4518, 4532, 4541, 4551, 4563, 4578, 4589, 4597, 4607, 4614, 4617, 4623, 4626, 4641, 4654, 4683, 4690, 4705, 4714, 4725, 4727, 4736, 4747, 4749, 4756, 4771, 4777, 4785, 4791, 4799, 4809, 4815, 4823, 4829, 4837, 4844, 4853, 4855, 4880, 4887, 4898, 4904, 4913, 4918, 4924, 4931, 4936, 4940, 4943, 4949, 5098, 5102, 5107, 5118, 5129, 5140, 5151, 5162, 5173, 5184, 5196, 5207, 5215, 5222, 5228, 5236, 5241, 5246, 5251, 5257, 5264, 5270, 5276, 5281, 5287, 5294, 5299, 5305, 5312, 5315, 5328, 5337, 5349, 5351, 5368, 5375, 5380, 5384, 5388, 5394, 5396, 5458, 5465, 5471, 5478, 5484, 5495, 5498, 5505, 5508, 5518, 5521, 5523, 5542, 5554, 5563, 5572, 5584, 5586, 5592, 5596, 5601, 5604, 5609, 5615, 5618, 5621, 5624, 5627, 5643, 5647, 5650, 5653, 5656, 5659, 5664, 5667, 5669, 5682, 5694, 5708, 5712, 5724, 5726, 5735, 5744, 5752, 5761, 5763, 5767, 5776, 5781, 5787, 5792, 5796, 5801, 5807, 5813, 5819, 5825, 5830, 5845, 5854, 5865, 5871, 5910, 5925, 5932, 5943, 5957, 5965, 5970, 5978, 5986, 5992, 6000, 6006, 6014, 6016, 6022, 6030, 6032, 6038, 6046, 6048, 6072, 6079, 6089, 6101, 6106, 6119, 6131, 6143, 6145, 6151, 6156, 6164, 6171, 6216, 6221, 6228, 6233, 6240, 6250, 6260, 6264, 6275, 6292, 6363, 6558, 6571, 6582, 6595, 6607, 6621, 6653, 6667, 6779, 6781, 6792, 6803, 6814, 6827, 6839, 6850, 6857, 7078, 7093, 7104, 7111, 7165, 7306, 7312, 7321, 7329, 7331, 7338, 7344, 7347, 7354, 7358, 7361, 7366, 7369, 7373, 7376, 7379, 7410, 7420, 7427, 7450, 7459, 7477, 7483, 7491, 7493, 7497, 7507, 7511, 7521, 7524, 7528, 7532, 7540, 7551, 7563, 7567, 7570, 7574, 7577, 7582, 7586, 7589, 7593, 7596, 7600, 7603, 7614, 7621, 7634, 7648, 7652, 7657, 7664, 7671, 7674, 7679, 7682, 7691, 7693, 7698, 7702, 7714, 7717, 7724, 7728, 7733, 7743, 7752, 7755, 7763, 7774, 7778, 7784, 7791, 7811, 7832, 7836, 7841, 7924, 7930, 7943, 7947, 7951, 7955, 7961, 7968, 7971, 7974, 7977, 7980, 7987, 7989, 7993, 7996, 8003, 8005, 8012, 8019, 8023, 8027, 8043, 8050, 8060, 8073, 8084, 8091, 8096, 8100, 8104, 8109, 8123, 8128, 8132, 8140, 8143, 8147, 8158, 8161, 8163, 8179, 8182, 8189, 8192, 8197, 8212, 8218, 8227, 8236, 8243, 8246, 8252, 8257, 8263, 8268, 8272, 8277, 8280, 8286, 8290, 8292, 8295, 8302, 8305, 8312, 8320, 8323, 8332, 8337, 8343, 8346, 8349, 8356, 8360, 8363, 8378, 8381, 8388, 8391, 8398, 8401, 8404, 8411, 8424, 8434, 8442, 8454, 8456, 8463, 8467, 8477, 8481, 8485, 8489, 8491, 8496, 8500, 8504, 8506, 8508, 8513, 8518, 8524, 8529, 8534, 8537, 8540, 8545, 8548, 8551, 8554, 8557, 8560, 8563, 8569, 8573, 8582, 8587, 8591, 8600, 8606, 8610, 8615, 8619, 8624, 8630, 8642, 8657, 8664, 8666, 8669, 8673, 8677, 8679, 8687, 8696, 8702, 8704, 8706, 8713, 8717, 8726, 8730, 8745, 8753, 8781, 8788, 8792, 8795, 8800, 8804, 8807, 8823, 8834, 8839, 8842, 8846, 8850, 8854, 8859, 8863, 8867, 8869, 8878, 8883, 8889, 8893, 8895, 8900, 8904, 8915, 8919, 8922, 8929, 8934, 8941, 8946, 8949, 8955, 8959, 8968, 8972, 8980, 8982, 8989, 8994, 8997, 9005, 9014, 9022, 9024, 9028, 9035, 9054, 9063, 9069, 9088, 9097, 9103, 9107, 9112, 9122, 9129, 9138, 9141, 9150, 9152, 9158, 9162, 9167, 9177, 9183, 9185, 9191, 9197, 9200, 9203, 9216, 9222, 9226, 9230, 9233, 9241, 9245, 9249, 9257, 9264, 9271, 9275, 9281, 9283, 9292, 9295, 9305, 9321, 9327, 9332, 9339, 9348, 9355, 9363, 9371, 9376, 9380, 9386, 9390, 9394, 9397, 9403, 9408, 9424, 9427, 9429, 9441, 9443, 9447, 9453, 9457, 9459, 9467, 9471, 9480, 9488, 9494, 9497, 9506, 9511, 9518, 9528, 9554, 9565, 9567, 9569, 9577, 9600, 9608, 9618, 9621, 9626, 9631, 9635, 9641, 9644, 9647, 9650, 9654, 9668, 9675, 9682, 9689, 9707, 9715, 9727, 9745, 9784, 9786, 9806, 9816, 9827, 9839, 9846, 9858, 9870, 9876, 9884, 9901, 9926, 9936, 9940, 9943, 9946, 9949, 9962, 9967, 9972, 9974, 9982, 9991, 10000, 10005, 10014, 10019, 10033, 10043, 10051, 10065, 10072, 10080, 10088, 10095, 10101, 10110, 10125, 10136, 10169, 10178, 10185, 10189, 10193, 10200, 10214, 10219, 10224, 10228, 10230, 10233, 10240, 10245, 10255, 10260, 10263, 10268, 10275, 10280, 10287, 10303, 10315, 10320, 10328, 10335, 10340, 10352, 10360, 10365, 10375, 10382, 10389, 10398, 10404, 10410, 10416, 10424, 10428, 10435, 10493, 10504, 10509, 10532, 10540, 10548, 10552, 10555, 10559, 10561, 10568, 10577, 10584, 10588, 10591, 10594, 10597, 10601, 10606, 10613, 10626, 10636, 10655, 10662, 10692, 10702, 10711, 10716, 10727, 10740, 10753, 10761, 10770, 10783, 10791, 10795, 10806, 10817, 10822, 10829, 10839, 10846, 10849, 10855, 10857, 10868, 10881, 10886, 10898, 10901, 10914, 10917, 10920, 10922, 10930, 10934, 10937, 10943, 10947, 10953, 10958, 10964, 10967, 10971, 10979, 10993, 10999, 11011, 11021, 11024, 11027, 11030, 11033, 11045, 11050, 11057, 11064, 11066, 11073, 11075, 11084, 11091, 11098, 11106, 11109, 11133, 11135, 11139, 11153, 11159, 11165, 11178, 11181, 11185, 11193, 11205, 11211, 11224, 11229, 11232, 11235, 11238, 11241, 11244, 11247, 11259, 11263] \ No newline at end of file diff --git a/postgresql/PostgreSQLParser.tokens b/postgresql/PostgreSQLParser.tokens new file mode 100644 index 0000000..8dfee09 --- /dev/null +++ b/postgresql/PostgreSQLParser.tokens @@ -0,0 +1,1328 @@ +Dollar=1 +OPEN_PAREN=2 +CLOSE_PAREN=3 +OPEN_BRACKET=4 +CLOSE_BRACKET=5 +COMMA=6 +SEMI=7 +COLON=8 +STAR=9 +EQUAL=10 +DOT=11 +PLUS=12 +MINUS=13 +SLASH=14 +CARET=15 +LT=16 +GT=17 +LESS_LESS=18 +GREATER_GREATER=19 +COLON_EQUALS=20 +LESS_EQUALS=21 +EQUALS_GREATER=22 +GREATER_EQUALS=23 +DOT_DOT=24 +NOT_EQUALS=25 +TYPECAST=26 +PERCENT=27 +PARAM=28 +Operator=29 +ALL=30 +ANALYSE=31 +ANALYZE=32 +AND=33 +ANY=34 +ARRAY=35 +AS=36 +ASC=37 +ASYMMETRIC=38 +BOTH=39 +CASE=40 +CAST=41 +CHECK=42 +COLLATE=43 +COLUMN=44 +CONSTRAINT=45 +CREATE=46 +CURRENT_CATALOG=47 +CURRENT_DATE=48 +CURRENT_ROLE=49 +CURRENT_TIME=50 +CURRENT_TIMESTAMP=51 +CURRENT_USER=52 +DEFAULT=53 +DEFERRABLE=54 +DESC=55 +DISTINCT=56 +DO=57 +ELSE=58 +EXCEPT=59 +FALSE_P=60 +FETCH=61 +FOR=62 +FOREIGN=63 +FROM=64 +GRANT=65 +GROUP_P=66 +HAVING=67 +IN_P=68 +INITIALLY=69 +INTERSECT=70 +INTO=71 +LATERAL_P=72 +LEADING=73 +LIMIT=74 +LOCALTIME=75 +LOCALTIMESTAMP=76 +NOT=77 +NULL_P=78 +OFFSET=79 +ON=80 +ONLY=81 +OR=82 +ORDER=83 +PLACING=84 +PRIMARY=85 +REFERENCES=86 +RETURNING=87 +SELECT=88 +SESSION_USER=89 +SOME=90 +SYMMETRIC=91 +TABLE=92 +THEN=93 +TO=94 +TRAILING=95 +TRUE_P=96 +UNION=97 +UNIQUE=98 +USER=99 +USING=100 +VARIADIC=101 +WHEN=102 +WHERE=103 +WINDOW=104 +WITH=105 +AUTHORIZATION=106 +BINARY=107 +COLLATION=108 +CONCURRENTLY=109 +CROSS=110 +CURRENT_SCHEMA=111 +FREEZE=112 +FULL=113 +ILIKE=114 +INNER_P=115 +IS=116 +ISNULL=117 +JOIN=118 +LEFT=119 +LIKE=120 +NATURAL=121 +NOTNULL=122 +OUTER_P=123 +OVER=124 +OVERLAPS=125 +RIGHT=126 +SIMILAR=127 +VERBOSE=128 +ABORT_P=129 +ABSOLUTE_P=130 +ACCESS=131 +ACTION=132 +ADD_P=133 +ADMIN=134 +AFTER=135 +AGGREGATE=136 +ALSO=137 +ALTER=138 +ALWAYS=139 +ASSERTION=140 +ASSIGNMENT=141 +AT=142 +ATTRIBUTE=143 +BACKWARD=144 +BEFORE=145 +BEGIN_P=146 +BY=147 +CACHE=148 +CALLED=149 +CASCADE=150 +CASCADED=151 +CATALOG=152 +CHAIN=153 +CHARACTERISTICS=154 +CHECKPOINT=155 +CLASS=156 +CLOSE=157 +CLUSTER=158 +COMMENT=159 +COMMENTS=160 +COMMIT=161 +COMMITTED=162 +CONFIGURATION=163 +CONNECTION=164 +CONSTRAINTS=165 +CONTENT_P=166 +CONTINUE_P=167 +CONVERSION_P=168 +COPY=169 +COST=170 +CSV=171 +CURSOR=172 +CYCLE=173 +DATA_P=174 +DATABASE=175 +DAY_P=176 +DEALLOCATE=177 +DECLARE=178 +DEFAULTS=179 +DEFERRED=180 +DEFINER=181 +DELETE_P=182 +DELIMITER=183 +DELIMITERS=184 +DICTIONARY=185 +DISABLE_P=186 +DISCARD=187 +DOCUMENT_P=188 +DOMAIN_P=189 +DOUBLE_P=190 +DROP=191 +EACH=192 +ENABLE_P=193 +ENCODING=194 +ENCRYPTED=195 +ENUM_P=196 +ESCAPE=197 +EVENT=198 +EXCLUDE=199 +EXCLUDING=200 +EXCLUSIVE=201 +EXECUTE=202 +EXPLAIN=203 +EXTENSION=204 +EXTERNAL=205 +FAMILY=206 +FIRST_P=207 +FOLLOWING=208 +FORCE=209 +FORWARD=210 +FUNCTION=211 +FUNCTIONS=212 +GLOBAL=213 +GRANTED=214 +HANDLER=215 +HEADER_P=216 +HOLD=217 +HOUR_P=218 +IDENTITY_P=219 +IF_P=220 +IMMEDIATE=221 +IMMUTABLE=222 +IMPLICIT_P=223 +INCLUDING=224 +INCREMENT=225 +INDEX=226 +INDEXES=227 +INHERIT=228 +INHERITS=229 +INLINE_P=230 +INSENSITIVE=231 +INSERT=232 +INSTEAD=233 +INVOKER=234 +ISOLATION=235 +KEY=236 +LABEL=237 +LANGUAGE=238 +LARGE_P=239 +LAST_P=240 +LEAKPROOF=241 +LEVEL=242 +LISTEN=243 +LOAD=244 +LOCAL=245 +LOCATION=246 +LOCK_P=247 +MAPPING=248 +MATCH=249 +MATCHED=250 +MATERIALIZED=251 +MAXVALUE=252 +MERGE=253 +MINUTE_P=254 +MINVALUE=255 +MODE=256 +MONTH_P=257 +MOVE=258 +NAME_P=259 +NAMES=260 +NEXT=261 +NO=262 +NOTHING=263 +NOTIFY=264 +NOWAIT=265 +NULLS_P=266 +OBJECT_P=267 +OF=268 +OFF=269 +OIDS=270 +OPERATOR=271 +OPTION=272 +OPTIONS=273 +OWNED=274 +OWNER=275 +PARSER=276 +PARTIAL=277 +PARTITION=278 +PASSING=279 +PASSWORD=280 +PLANS=281 +PRECEDING=282 +PREPARE=283 +PREPARED=284 +PRESERVE=285 +PRIOR=286 +PRIVILEGES=287 +PROCEDURAL=288 +PROCEDURE=289 +PROGRAM=290 +QUOTE=291 +RANGE=292 +READ=293 +REASSIGN=294 +RECHECK=295 +RECURSIVE=296 +REF=297 +REFRESH=298 +REINDEX=299 +RELATIVE_P=300 +RELEASE=301 +RENAME=302 +REPEATABLE=303 +REPLACE=304 +REPLICA=305 +RESET=306 +RESTART=307 +RESTRICT=308 +RETURNS=309 +REVOKE=310 +ROLE=311 +ROLLBACK=312 +ROWS=313 +RULE=314 +SAVEPOINT=315 +SCHEMA=316 +SCROLL=317 +SEARCH=318 +SECOND_P=319 +SECURITY=320 +SEQUENCE=321 +SEQUENCES=322 +SERIALIZABLE=323 +SERVER=324 +SESSION=325 +SET=326 +SHARE=327 +SHOW=328 +SIMPLE=329 +SNAPSHOT=330 +STABLE=331 +STANDALONE_P=332 +START=333 +STATEMENT=334 +STATISTICS=335 +STDIN=336 +STDOUT=337 +STORAGE=338 +STRICT_P=339 +STRIP_P=340 +SYSID=341 +SYSTEM_P=342 +TABLES=343 +TABLESPACE=344 +TEMP=345 +TEMPLATE=346 +TEMPORARY=347 +TEXT_P=348 +TRANSACTION=349 +TRIGGER=350 +TRUNCATE=351 +TRUSTED=352 +TYPE_P=353 +TYPES_P=354 +UNBOUNDED=355 +UNCOMMITTED=356 +UNENCRYPTED=357 +UNKNOWN=358 +UNLISTEN=359 +UNLOGGED=360 +UNTIL=361 +UPDATE=362 +VACUUM=363 +VALID=364 +VALIDATE=365 +VALIDATOR=366 +VARYING=367 +VERSION_P=368 +VIEW=369 +VOLATILE=370 +WHITESPACE_P=371 +WITHOUT=372 +WORK=373 +WRAPPER=374 +WRITE=375 +XML_P=376 +YEAR_P=377 +YES_P=378 +ZONE=379 +ATOMIC_P=380 +BETWEEN=381 +BIGINT=382 +BIT=383 +BOOLEAN_P=384 +CHAR_P=385 +CHARACTER=386 +COALESCE=387 +DEC=388 +DECIMAL_P=389 +EXISTS=390 +EXTRACT=391 +FLOAT_P=392 +GREATEST=393 +INOUT=394 +INT_P=395 +INTEGER=396 +INTERVAL=397 +LEAST=398 +NATIONAL=399 +NCHAR=400 +NONE=401 +NULLIF=402 +NUMERIC=403 +OVERLAY=404 +PARAMETER=405 +POSITION=406 +PRECISION=407 +REAL=408 +ROW=409 +SETOF=410 +SMALLINT=411 +SUBSTRING=412 +TIME=413 +TIMESTAMP=414 +TREAT=415 +TRIM=416 +VALUES=417 +VARCHAR=418 +XMLATTRIBUTES=419 +XMLCOMMENT=420 +XMLAGG=421 +XML_IS_WELL_FORMED=422 +XML_IS_WELL_FORMED_DOCUMENT=423 +XML_IS_WELL_FORMED_CONTENT=424 +XPATH=425 +XPATH_EXISTS=426 +XMLCONCAT=427 +XMLELEMENT=428 +XMLEXISTS=429 +XMLFOREST=430 +XMLPARSE=431 +XMLPI=432 +XMLROOT=433 +XMLSERIALIZE=434 +CALL=435 +CURRENT_P=436 +ATTACH=437 +DETACH=438 +EXPRESSION=439 +GENERATED=440 +LOGGED=441 +STORED=442 +INCLUDE=443 +ROUTINE=444 +TRANSFORM=445 +IMPORT_P=446 +POLICY=447 +METHOD=448 +REFERENCING=449 +NEW=450 +OLD=451 +VALUE_P=452 +SUBSCRIPTION=453 +PUBLICATION=454 +OUT_P=455 +END_P=456 +ROUTINES=457 +SCHEMAS=458 +PROCEDURES=459 +INPUT_P=460 +SUPPORT=461 +PARALLEL=462 +SQL_P=463 +DEPENDS=464 +OVERRIDING=465 +CONFLICT=466 +SKIP_P=467 +LOCKED=468 +TIES=469 +ROLLUP=470 +CUBE=471 +GROUPING=472 +SETS=473 +TABLESAMPLE=474 +ORDINALITY=475 +XMLTABLE=476 +COLUMNS=477 +XMLNAMESPACES=478 +ROWTYPE=479 +NORMALIZED=480 +WITHIN=481 +FILTER=482 +GROUPS=483 +OTHERS=484 +NFC=485 +NFD=486 +NFKC=487 +NFKD=488 +UESCAPE=489 +VIEWS=490 +NORMALIZE=491 +DUMP=492 +PRINT_STRICT_PARAMS=493 +VARIABLE_CONFLICT=494 +ERROR=495 +USE_VARIABLE=496 +USE_COLUMN=497 +ALIAS=498 +CONSTANT=499 +PERFORM=500 +GET=501 +DIAGNOSTICS=502 +STACKED=503 +ELSIF=504 +WHILE=505 +REVERSE=506 +FOREACH=507 +SLICE=508 +EXIT=509 +RETURN=510 +QUERY=511 +RAISE=512 +SQLSTATE=513 +DEBUG=514 +LOG=515 +INFO=516 +NOTICE=517 +WARNING=518 +EXCEPTION=519 +ASSERT=520 +LOOP=521 +OPEN=522 +ABS=523 +CBRT=524 +CEIL=525 +CEILING=526 +DEGREES=527 +DIV=528 +EXP=529 +FACTORIAL=530 +FLOOR=531 +GCD=532 +LCM=533 +LN=534 +LOG10=535 +MIN_SCALE=536 +MOD=537 +PI=538 +POWER=539 +RADIANS=540 +ROUND=541 +SCALE=542 +SIGN=543 +SQRT=544 +TRIM_SCALE=545 +TRUNC=546 +WIDTH_BUCKET=547 +RANDOM=548 +SETSEED=549 +ACOS=550 +ACOSD=551 +ASIN=552 +ASIND=553 +ATAN=554 +ATAND=555 +ATAN2=556 +ATAN2D=557 +COS=558 +COSD=559 +COT=560 +COTD=561 +SIN=562 +SIND=563 +TAN=564 +TAND=565 +SINH=566 +COSH=567 +TANH=568 +ASINH=569 +ACOSH=570 +ATANH=571 +BIT_LENGTH=572 +CHAR_LENGTH=573 +CHARACTER_LENGTH=574 +LOWER=575 +OCTET_LENGTH=576 +UPPER=577 +ASCII=578 +BTRIM=579 +CHR=580 +CONCAT=581 +CONCAT_WS=582 +FORMAT=583 +INITCAP=584 +LENGTH=585 +LPAD=586 +LTRIM=587 +MD5=588 +PARSE_IDENT=589 +PG_CLIENT_ENCODING=590 +QUOTE_IDENT=591 +QUOTE_LITERAL=592 +QUOTE_NULLABLE=593 +REGEXP_COUNT=594 +REGEXP_INSTR=595 +REGEXP_LIKE=596 +REGEXP_MATCH=597 +REGEXP_MATCHES=598 +REGEXP_REPLACE=599 +REGEXP_SPLIT_TO_ARRAY=600 +REGEXP_SPLIT_TO_TABLE=601 +REGEXP_SUBSTR=602 +REPEAT=603 +RPAD=604 +RTRIM=605 +SPLIT_PART=606 +STARTS_WITH=607 +STRING_TO_ARRAY=608 +STRING_TO_TABLE=609 +STRPOS=610 +SUBSTR=611 +TO_ASCII=612 +TO_HEX=613 +TRANSLATE=614 +UNISTR=615 +AGE=616 +CLOCK_TIMESTAMP=617 +DATE_BIN=618 +DATE_PART=619 +DATE_TRUNC=620 +ISFINITE=621 +JUSTIFY_DAYS=622 +JUSTIFY_HOURS=623 +JUSTIFY_INTERVAL=624 +MAKE_DATE=625 +MAKE_INTERVAL=626 +MAKE_TIME=627 +MAKE_TIMESTAMP=628 +MAKE_TIMESTAMPTZ=629 +NOW=630 +STATEMENT_TIMESTAMP=631 +TIMEOFDAY=632 +TRANSACTION_TIMESTAMP=633 +TO_TIMESTAMP=634 +TO_CHAR=635 +TO_DATE=636 +TO_NUMBER=637 +ENCODE=638 +DISTKEY=639 +SORTKEY=640 +CASE_SENSITIVE=641 +CASE_INSENSITIVE=642 +Identifier=643 +QuotedIdentifier=644 +UnterminatedQuotedIdentifier=645 +InvalidQuotedIdentifier=646 +InvalidUnterminatedQuotedIdentifier=647 +UnicodeQuotedIdentifier=648 +UnterminatedUnicodeQuotedIdentifier=649 +InvalidUnicodeQuotedIdentifier=650 +InvalidUnterminatedUnicodeQuotedIdentifier=651 +StringConstant=652 +UnterminatedStringConstant=653 +UnicodeEscapeStringConstant=654 +UnterminatedUnicodeEscapeStringConstant=655 +BeginDollarStringConstant=656 +BinaryStringConstant=657 +UnterminatedBinaryStringConstant=658 +InvalidBinaryStringConstant=659 +InvalidUnterminatedBinaryStringConstant=660 +HexadecimalStringConstant=661 +UnterminatedHexadecimalStringConstant=662 +InvalidHexadecimalStringConstant=663 +InvalidUnterminatedHexadecimalStringConstant=664 +Integral=665 +NumericFail=666 +Numeric=667 +PLSQLVARIABLENAME=668 +PLSQLIDENTIFIER=669 +Whitespace=670 +Newline=671 +LineComment=672 +BlockComment=673 +UnterminatedBlockComment=674 +MetaCommand=675 +EndMetaCommand=676 +ErrorCharacter=677 +EscapeStringConstant=678 +UnterminatedEscapeStringConstant=679 +InvalidEscapeStringConstant=680 +InvalidUnterminatedEscapeStringConstant=681 +AfterEscapeStringConstantMode_NotContinued=682 +AfterEscapeStringConstantWithNewlineMode_NotContinued=683 +DollarText=684 +EndDollarStringConstant=685 +AfterEscapeStringConstantWithNewlineMode_Continued=686 +'$'=1 +'('=2 +')'=3 +'['=4 +']'=5 +','=6 +';'=7 +':'=8 +'*'=9 +'='=10 +'.'=11 +'+'=12 +'-'=13 +'/'=14 +'^'=15 +'<'=16 +'>'=17 +'<<'=18 +'>>'=19 +':='=20 +'<='=21 +'=>'=22 +'>='=23 +'..'=24 +'<>'=25 +'::'=26 +'%'=27 +'ALL'=30 +'ANALYSE'=31 +'ANALYZE'=32 +'AND'=33 +'ANY'=34 +'ARRAY'=35 +'AS'=36 +'ASC'=37 +'ASYMMETRIC'=38 +'BOTH'=39 +'CASE'=40 +'CAST'=41 +'CHECK'=42 +'COLLATE'=43 +'COLUMN'=44 +'CONSTRAINT'=45 +'CREATE'=46 +'CURRENT_CATALOG'=47 +'CURRENT_DATE'=48 +'CURRENT_ROLE'=49 +'CURRENT_TIME'=50 +'CURRENT_TIMESTAMP'=51 +'CURRENT_USER'=52 +'DEFAULT'=53 +'DEFERRABLE'=54 +'DESC'=55 +'DISTINCT'=56 +'DO'=57 +'ELSE'=58 +'EXCEPT'=59 +'FALSE'=60 +'FETCH'=61 +'FOR'=62 +'FOREIGN'=63 +'FROM'=64 +'GRANT'=65 +'GROUP'=66 +'HAVING'=67 +'IN'=68 +'INITIALLY'=69 +'INTERSECT'=70 +'INTO'=71 +'LATERAL'=72 +'LEADING'=73 +'LIMIT'=74 +'LOCALTIME'=75 +'LOCALTIMESTAMP'=76 +'NOT'=77 +'NULL'=78 +'OFFSET'=79 +'ON'=80 +'ONLY'=81 +'OR'=82 +'ORDER'=83 +'PLACING'=84 +'PRIMARY'=85 +'REFERENCES'=86 +'RETURNING'=87 +'SELECT'=88 +'SESSION_USER'=89 +'SOME'=90 +'SYMMETRIC'=91 +'TABLE'=92 +'THEN'=93 +'TO'=94 +'TRAILING'=95 +'TRUE'=96 +'UNION'=97 +'UNIQUE'=98 +'USER'=99 +'USING'=100 +'VARIADIC'=101 +'WHEN'=102 +'WHERE'=103 +'WINDOW'=104 +'WITH'=105 +'AUTHORIZATION'=106 +'BINARY'=107 +'COLLATION'=108 +'CONCURRENTLY'=109 +'CROSS'=110 +'CURRENT_SCHEMA'=111 +'FREEZE'=112 +'FULL'=113 +'ILIKE'=114 +'INNER'=115 +'IS'=116 +'ISNULL'=117 +'JOIN'=118 +'LEFT'=119 +'LIKE'=120 +'NATURAL'=121 +'NOTNULL'=122 +'OUTER'=123 +'OVER'=124 +'OVERLAPS'=125 +'RIGHT'=126 +'SIMILAR'=127 +'VERBOSE'=128 +'ABORT'=129 +'ABSOLUTE'=130 +'ACCESS'=131 +'ACTION'=132 +'ADD'=133 +'ADMIN'=134 +'AFTER'=135 +'AGGREGATE'=136 +'ALSO'=137 +'ALTER'=138 +'ALWAYS'=139 +'ASSERTION'=140 +'ASSIGNMENT'=141 +'AT'=142 +'ATTRIBUTE'=143 +'BACKWARD'=144 +'BEFORE'=145 +'BEGIN'=146 +'BY'=147 +'CACHE'=148 +'CALLED'=149 +'CASCADE'=150 +'CASCADED'=151 +'CATALOG'=152 +'CHAIN'=153 +'CHARACTERISTICS'=154 +'CHECKPOINT'=155 +'CLASS'=156 +'CLOSE'=157 +'CLUSTER'=158 +'COMMENT'=159 +'COMMENTS'=160 +'COMMIT'=161 +'COMMITTED'=162 +'CONFIGURATION'=163 +'CONNECTION'=164 +'CONSTRAINTS'=165 +'CONTENT'=166 +'CONTINUE'=167 +'CONVERSION'=168 +'COPY'=169 +'COST'=170 +'CSV'=171 +'CURSOR'=172 +'CYCLE'=173 +'DATA'=174 +'DATABASE'=175 +'DAY'=176 +'DEALLOCATE'=177 +'DECLARE'=178 +'DEFAULTS'=179 +'DEFERRED'=180 +'DEFINER'=181 +'DELETE'=182 +'DELIMITER'=183 +'DELIMITERS'=184 +'DICTIONARY'=185 +'DISABLE'=186 +'DISCARD'=187 +'DOCUMENT'=188 +'DOMAIN'=189 +'DOUBLE'=190 +'DROP'=191 +'EACH'=192 +'ENABLE'=193 +'ENCODING'=194 +'ENCRYPTED'=195 +'ENUM'=196 +'ESCAPE'=197 +'EVENT'=198 +'EXCLUDE'=199 +'EXCLUDING'=200 +'EXCLUSIVE'=201 +'EXECUTE'=202 +'EXPLAIN'=203 +'EXTENSION'=204 +'EXTERNAL'=205 +'FAMILY'=206 +'FIRST'=207 +'FOLLOWING'=208 +'FORCE'=209 +'FORWARD'=210 +'FUNCTION'=211 +'FUNCTIONS'=212 +'GLOBAL'=213 +'GRANTED'=214 +'HANDLER'=215 +'HEADER'=216 +'HOLD'=217 +'HOUR'=218 +'IDENTITY'=219 +'IF'=220 +'IMMEDIATE'=221 +'IMMUTABLE'=222 +'IMPLICIT'=223 +'INCLUDING'=224 +'INCREMENT'=225 +'INDEX'=226 +'INDEXES'=227 +'INHERIT'=228 +'INHERITS'=229 +'INLINE'=230 +'INSENSITIVE'=231 +'INSERT'=232 +'INSTEAD'=233 +'INVOKER'=234 +'ISOLATION'=235 +'KEY'=236 +'LABEL'=237 +'LANGUAGE'=238 +'LARGE'=239 +'LAST'=240 +'LEAKPROOF'=241 +'LEVEL'=242 +'LISTEN'=243 +'LOAD'=244 +'LOCAL'=245 +'LOCATION'=246 +'LOCK'=247 +'MAPPING'=248 +'MATCH'=249 +'MATCHED'=250 +'MATERIALIZED'=251 +'MAXVALUE'=252 +'MERGE'=253 +'MINUTE'=254 +'MINVALUE'=255 +'MODE'=256 +'MONTH'=257 +'MOVE'=258 +'NAME'=259 +'NAMES'=260 +'NEXT'=261 +'NO'=262 +'NOTHING'=263 +'NOTIFY'=264 +'NOWAIT'=265 +'NULLS'=266 +'OBJECT'=267 +'OF'=268 +'OFF'=269 +'OIDS'=270 +'OPERATOR'=271 +'OPTION'=272 +'OPTIONS'=273 +'OWNED'=274 +'OWNER'=275 +'PARSER'=276 +'PARTIAL'=277 +'PARTITION'=278 +'PASSING'=279 +'PASSWORD'=280 +'PLANS'=281 +'PRECEDING'=282 +'PREPARE'=283 +'PREPARED'=284 +'PRESERVE'=285 +'PRIOR'=286 +'PRIVILEGES'=287 +'PROCEDURAL'=288 +'PROCEDURE'=289 +'PROGRAM'=290 +'QUOTE'=291 +'RANGE'=292 +'READ'=293 +'REASSIGN'=294 +'RECHECK'=295 +'RECURSIVE'=296 +'REF'=297 +'REFRESH'=298 +'REINDEX'=299 +'RELATIVE'=300 +'RELEASE'=301 +'RENAME'=302 +'REPEATABLE'=303 +'REPLACE'=304 +'REPLICA'=305 +'RESET'=306 +'RESTART'=307 +'RESTRICT'=308 +'RETURNS'=309 +'REVOKE'=310 +'ROLE'=311 +'ROLLBACK'=312 +'ROWS'=313 +'RULE'=314 +'SAVEPOINT'=315 +'SCHEMA'=316 +'SCROLL'=317 +'SEARCH'=318 +'SECOND'=319 +'SECURITY'=320 +'SEQUENCE'=321 +'SEQUENCES'=322 +'SERIALIZABLE'=323 +'SERVER'=324 +'SESSION'=325 +'SET'=326 +'SHARE'=327 +'SHOW'=328 +'SIMPLE'=329 +'SNAPSHOT'=330 +'STABLE'=331 +'STANDALONE'=332 +'START'=333 +'STATEMENT'=334 +'STATISTICS'=335 +'STDIN'=336 +'STDOUT'=337 +'STORAGE'=338 +'STRICT'=339 +'STRIP'=340 +'SYSID'=341 +'SYSTEM'=342 +'TABLES'=343 +'TABLESPACE'=344 +'TEMP'=345 +'TEMPLATE'=346 +'TEMPORARY'=347 +'TEXT'=348 +'TRANSACTION'=349 +'TRIGGER'=350 +'TRUNCATE'=351 +'TRUSTED'=352 +'TYPE'=353 +'TYPES'=354 +'UNBOUNDED'=355 +'UNCOMMITTED'=356 +'UNENCRYPTED'=357 +'UNKNOWN'=358 +'UNLISTEN'=359 +'UNLOGGED'=360 +'UNTIL'=361 +'UPDATE'=362 +'VACUUM'=363 +'VALID'=364 +'VALIDATE'=365 +'VALIDATOR'=366 +'VARYING'=367 +'VERSION'=368 +'VIEW'=369 +'VOLATILE'=370 +'WHITESPACE'=371 +'WITHOUT'=372 +'WORK'=373 +'WRAPPER'=374 +'WRITE'=375 +'XML'=376 +'YEAR'=377 +'YES'=378 +'ZONE'=379 +'ATOMIC'=380 +'BETWEEN'=381 +'BIGINT'=382 +'BIT'=383 +'BOOLEAN'=384 +'CHAR'=385 +'CHARACTER'=386 +'COALESCE'=387 +'DEC'=388 +'DECIMAL'=389 +'EXISTS'=390 +'EXTRACT'=391 +'FLOAT'=392 +'GREATEST'=393 +'INOUT'=394 +'INT'=395 +'INTEGER'=396 +'INTERVAL'=397 +'LEAST'=398 +'NATIONAL'=399 +'NCHAR'=400 +'NONE'=401 +'NULLIF'=402 +'NUMERIC'=403 +'OVERLAY'=404 +'PARAMETER'=405 +'POSITION'=406 +'PRECISION'=407 +'REAL'=408 +'ROW'=409 +'SETOF'=410 +'SMALLINT'=411 +'SUBSTRING'=412 +'TIME'=413 +'TIMESTAMP'=414 +'TREAT'=415 +'TRIM'=416 +'VALUES'=417 +'VARCHAR'=418 +'XMLATTRIBUTES'=419 +'XMLCOMMENT'=420 +'XMLAGG'=421 +'XML_IS_WELL_FORMED'=422 +'XML_IS_WELL_FORMED_DOCUMENT'=423 +'XML_IS_WELL_FORMED_CONTENT'=424 +'XPATH'=425 +'XPATH_EXISTS'=426 +'XMLCONCAT'=427 +'XMLELEMENT'=428 +'XMLEXISTS'=429 +'XMLFOREST'=430 +'XMLPARSE'=431 +'XMLPI'=432 +'XMLROOT'=433 +'XMLSERIALIZE'=434 +'CALL'=435 +'CURRENT'=436 +'ATTACH'=437 +'DETACH'=438 +'EXPRESSION'=439 +'GENERATED'=440 +'LOGGED'=441 +'STORED'=442 +'INCLUDE'=443 +'ROUTINE'=444 +'TRANSFORM'=445 +'IMPORT'=446 +'POLICY'=447 +'METHOD'=448 +'REFERENCING'=449 +'NEW'=450 +'OLD'=451 +'VALUE'=452 +'SUBSCRIPTION'=453 +'PUBLICATION'=454 +'OUT'=455 +'END'=456 +'ROUTINES'=457 +'SCHEMAS'=458 +'PROCEDURES'=459 +'INPUT'=460 +'SUPPORT'=461 +'PARALLEL'=462 +'SQL'=463 +'DEPENDS'=464 +'OVERRIDING'=465 +'CONFLICT'=466 +'SKIP'=467 +'LOCKED'=468 +'TIES'=469 +'ROLLUP'=470 +'CUBE'=471 +'GROUPING'=472 +'SETS'=473 +'TABLESAMPLE'=474 +'ORDINALITY'=475 +'XMLTABLE'=476 +'COLUMNS'=477 +'XMLNAMESPACES'=478 +'ROWTYPE'=479 +'NORMALIZED'=480 +'WITHIN'=481 +'FILTER'=482 +'GROUPS'=483 +'OTHERS'=484 +'NFC'=485 +'NFD'=486 +'NFKC'=487 +'NFKD'=488 +'UESCAPE'=489 +'VIEWS'=490 +'NORMALIZE'=491 +'DUMP'=492 +'PRINT_STRICT_PARAMS'=493 +'VARIABLE_CONFLICT'=494 +'ERROR'=495 +'USE_VARIABLE'=496 +'USE_COLUMN'=497 +'ALIAS'=498 +'CONSTANT'=499 +'PERFORM'=500 +'GET'=501 +'DIAGNOSTICS'=502 +'STACKED'=503 +'ELSIF'=504 +'WHILE'=505 +'REVERSE'=506 +'FOREACH'=507 +'SLICE'=508 +'EXIT'=509 +'RETURN'=510 +'QUERY'=511 +'RAISE'=512 +'SQLSTATE'=513 +'DEBUG'=514 +'LOG'=515 +'INFO'=516 +'NOTICE'=517 +'WARNING'=518 +'EXCEPTION'=519 +'ASSERT'=520 +'LOOP'=521 +'OPEN'=522 +'ABS'=523 +'CBRT'=524 +'CEIL'=525 +'CEILING'=526 +'DEGREES'=527 +'DIV'=528 +'EXP'=529 +'FACTORIAL'=530 +'FLOOR'=531 +'GCD'=532 +'LCM'=533 +'LN'=534 +'LOG10'=535 +'MIN_SCALE'=536 +'MOD'=537 +'PI'=538 +'POWER'=539 +'RADIANS'=540 +'ROUND'=541 +'SCALE'=542 +'SIGN'=543 +'SQRT'=544 +'TRIM_SCALE'=545 +'TRUNC'=546 +'WIDTH_BUCKET'=547 +'RANDOM'=548 +'SETSEED'=549 +'ACOS'=550 +'ACOSD'=551 +'ASIN'=552 +'ASIND'=553 +'ATAN'=554 +'ATAND'=555 +'ATAN2'=556 +'ATAN2D'=557 +'COS'=558 +'COSD'=559 +'COT'=560 +'COTD'=561 +'SIN'=562 +'SIND'=563 +'TAN'=564 +'TAND'=565 +'SINH'=566 +'COSH'=567 +'TANH'=568 +'ASINH'=569 +'ACOSH'=570 +'ATANH'=571 +'BIT_LENGTH'=572 +'CHAR_LENGTH'=573 +'CHARACTER_LENGTH'=574 +'LOWER'=575 +'OCTET_LENGTH'=576 +'UPPER'=577 +'ASCII'=578 +'BTRIM'=579 +'CHR'=580 +'CONCAT'=581 +'CONCAT_WS'=582 +'FORMAT'=583 +'INITCAP'=584 +'LENGTH'=585 +'LPAD'=586 +'LTRIM'=587 +'MD5'=588 +'PARSE_IDENT'=589 +'PG_CLIENT_ENCODING'=590 +'QUOTE_IDENT'=591 +'QUOTE_LITERAL'=592 +'QUOTE_NULLABLE'=593 +'REGEXP_COUNT'=594 +'REGEXP_INSTR'=595 +'REGEXP_LIKE'=596 +'REGEXP_MATCH'=597 +'REGEXP_MATCHES'=598 +'REGEXP_REPLACE'=599 +'REGEXP_SPLIT_TO_ARRAY'=600 +'REGEXP_SPLIT_TO_TABLE'=601 +'REGEXP_SUBSTR'=602 +'REPEAT'=603 +'RPAD'=604 +'RTRIM'=605 +'SPLIT_PART'=606 +'STARTS_WITH'=607 +'STRING_TO_ARRAY'=608 +'STRING_TO_TABLE'=609 +'STRPOS'=610 +'SUBSTR'=611 +'TO_ASCII'=612 +'TO_HEX'=613 +'TRANSLATE'=614 +'UNISTR'=615 +'AGE'=616 +'CLOCK_TIMESTAMP'=617 +'DATE_BIN'=618 +'DATE_PART'=619 +'DATE_TRUNC'=620 +'ISFINITE'=621 +'JUSTIFY_DAYS'=622 +'JUSTIFY_HOURS'=623 +'JUSTIFY_INTERVAL'=624 +'MAKE_DATE'=625 +'MAKE_INTERVAL'=626 +'MAKE_TIME'=627 +'MAKE_TIMESTAMP'=628 +'MAKE_TIMESTAMPTZ'=629 +'NOW'=630 +'STATEMENT_TIMESTAMP'=631 +'TIMEOFDAY'=632 +'TRANSACTION_TIMESTAMP'=633 +'TO_TIMESTAMP'=634 +'TO_CHAR'=635 +'TO_DATE'=636 +'TO_NUMBER'=637 +'ENCODE'=638 +'DISTKEY'=639 +'SORTKEY'=640 +'CASE_SENSITIVE'=641 +'CASE_INSENSITIVE'=642 +'\\\\'=676 +'\''=686 diff --git a/postgresql/builtin_function.go b/postgresql/builtin_function.go new file mode 100644 index 0000000..1d3dfc1 --- /dev/null +++ b/postgresql/builtin_function.go @@ -0,0 +1,835 @@ +package postgresql + +import "sort" + +var ( + comparisonFunctions = []string{ + "num_nonnulls", + "num_nulls", + } + + mathematicalFunctions = []string{ + "abs", + "cbrt", + "ceil", + "ceiling", + "degrees", + "div", + "erf", + "erfc", + "exp", + "factorial", + "floor", + "gcd", + "lcm", + "ln", + "log", + "log10", + "min_scale", + "mod", + "pi", + "power", + "radians", + "round", + "scale", + "sign", + "sqrt", + "trim_scale", + "trunc", + "width_bucket", + "random", + "random_normal", + "setseed", + "acos", + "acosd", + "asin", + "asind", + "atan", + "atand", + "atan2", + "atan2d", + "cos", + "cosd", + "cot", + "cotd", + "sin", + "sind", + "tan", + "tand", + "sinh", + "cosh", + "tanh", + "asinh", + "acosh", + "atanh", + } + + stringFunctions = []string{ + "btrim", + "bit_length", + "char_length", + "character_length", + "lower", + "lpad", + "ltrim", + "normalize", + "octet_length", + "overlay", + "position", + "rpad", + "rtrim", + "substring", + "trim", + "upper", + "ascii", + "chr", + "concat", + "concat_ws", + "format", + "initcap", + "left", + "length", + "md5", + "parse_ident", + "pg_client_encoding", + "quote_ident", + "quote_literal", + "quote_nullable", + "regexp_count", + "regexp_instr", + "regexp_like", + "regexp_match", + "regexp_matches", + "regexp_replace", + "regexp_split_to_array", + "regexp_split_to_table", + "regexp_substr", + "repeat", + "replace", + "reverse", + "right", + "split_part", + "starts_with", + "string_to_array", + "string_to_table", + "strpos", + "substr", + "to_ascii", + "to_hex", + "translate", + "unistr", + } + + binaryStringFunctions = []string{ + "bit_length", + "btrim", + "ltrim", + "octet_length", + "overlay", + "position", + "rtrim", + "substring", + "trim", + "bit_count", + "get_bit", + "get_byte", + "length", + "md5", + "set_bit", + "set_byte", + "sha224", + "sha256", + "sha384", + "sha512", + "substr", + "convert", + "convert_from", + "convert_to", + "encode", + "decode", + } + + bitStringFunctions = []string{ + "bit_count", + "bit_length", + "length", + "octet_length", + "overlay", + "position", + "substring", + "get_bit", + "set_bit", + } + + dataTypeFormattingFunctions = []string{ + "to_char", + "to_date", + "to_number", + "to_timestamp", + } + + dateTimeFunctions = []string{ + "age", + "clock_timestamp", + "current_time", + "current_timestamp", + "date_add", + "date_bin", + "date_part", + "date_subtract", + "date_trunc", + "extract", + "isfinite", + "justify_days", + "justify_hours", + "justify_interval", + "localtime", + "localtimestamp", + "make_date", + "make_interval", + "make_time", + "make_timestamp", + "make_timestamptz", + "now", + "statement_timestamp", + "timeofday", + "transaction_timestamp", + "to_timestamp", + } + + enumSupportFunctions = []string{ + "enum_first", + "enum_last", + "enum_range", + } + + geometricFunctions = []string{ + "area", + "center", + "diagonal", + "diameter", + "height", + "isclosed", + "isopen", + "length", + "npoints", + "pclose", + "popen", + "radius", + "slope", + "width", + "box", + "bound_box", + "circle", + "line", + "lseg", + "path", + "point", + "polygon", + } + + networkAddressFunctions = []string{ + "abbrev", + "broadcast", + "family", + "host", + "hostmask", + "inet_merge", + "inet_same_family", + "masklen", + "netmask", + "network", + "set_masklen", + "text", + "trunc", + "macaddr8_set7bit", + } + + textSearchFunctions = []string{ + "array_to_tsvector", + "get_current_ts_config", + "length", + "numnode", + "plainto_tsquery", + "phraseto_tsquery", + "websearch_to_tsquery", + "querytree", + "setweight", + "strip", + "to_tsquery", + "to_tsvector", + "json_to_tsvector", + "jsonb_to_tsvector", + "ts_delete", + "ts_filter", + "ts_headline", + "ts_rank", + "ts_rank_cd", + "ts_rewrite", + "tsquery_phrase", + "tsvector_to_array", + "unnest", + "ts_debug", + "ts_lexize", + "ts_parse", + "ts_token_type", + "ts_stat", + } + + uuidFunctions = []string{ + "gen_random_uuid", + } + + xmlFunctions = []string{ + "xmlcomment", + "xmlconcat", + "xmlelement", + "xmlforest", + "xmlpi", + "xmlroot", + "xmlagg", + "XMLEXISTS", + "xml_is_well_formed", + "xml_is_well_formed_document", + "xml_is_well_formed_content", + "xpath", + "xpath_exists", + "table_to_xml", + "query_to_xml", + "cursor_to_xml", + "table_to_xmlschema", + "query_to_xmlschema", + "cursor_to_xmlschema", + "table_to_xml_and_xmlschema", + "query_to_xml_and_xmlschema", + "schema_to_xml", + "schema_to_xmlschema", + "schema_to_xml_and_xmlschema", + "database_to_xml", + "database_to_xmlschema", + "database_to_xml_and_xmlschema", + } + + jsonFunctions = []string{ + "to_json", + "to_jsonb", + "array_to_json", + "json_array", + "row_to_json", + "json_build_array", + "jsonb_build_array", + "json_build_object", + "jsonb_build_object", + "json_object", + "jsonb_object", + "json_array_elements", + "jsonb_array_elements", + "json_array_elements_text", + "jsonb_array_elements_text", + "json_array_length", + "jsonb_array_length", + "json_each", + "jsonb_each", + "json_each_text", + "jsonb_each_text", + "json_extract_path", + "jsonb_extract_path", + "json_extract_path_text", + "jsonb_extract_path_text", + "json_object_keys", + "jsonb_object_keys", + "json_populate_record", + "jsonb_populate_record", + "json_populate_recordset", + "jsonb_populate_recordset", + "json_to_record", + "jsonb_to_record", + "json_to_recordset", + "jsonb_to_recordset", + "jsonb_set", + "jsonb_set_lax", + "jsonb_insert", + "json_strip_nulls", + "jsonb_strip_nulls", + "jsonb_path_exists", + "jsonb_path_match", + "jsonb_path_query", + "jsonb_path_query_array", + "jsonb_path_query_first", + "jsonb_path_exists_tz", + "jsonb_path_match_tz", + "jsonb_path_query_tz", + "jsonb_path_query_array_tz", + "jsonb_path_query_first_tz", + "jsonb_pretty", + "json_typeof", + "jsonb_typeof", + "exists", + } + + sequenceManipulationFunctions = []string{ + "nextval", + "setval", + "currval", + "lastval", + } + + conditionalFunctions = []string{ + "COALESCE", + "NULLIF", + "GREATEST", + "LEAST", + } + + arrayFunctions = []string{ + "array_append", + "array_cat", + "array_dims", + "array_fill", + "array_length", + "array_lower", + "array_ndims", + "array_position", + "array_positions", + "array_prepend", + "array_remove", + "array_replace", + "array_sample", + "array_shuffle", + "array_to_string", + "array_upper", + "cardinality", + "trim_array", + "unnest", + } + + rangeFunctions = []string{ + "lower", + "upper", + "isempty", + "lower_inc", + "upper_inc", + "lower_inf", + "upper_inf", + "range_merge", + "multirange", + "unnest", + } + + aggregateFunctions = []string{ + "any_value", + "array_agg", + "avg", + "bit_and", + "bit_or", + "bit_xor", + "bool_and", + "bool_or", + "count", + "every", + "json_agg", + "jsonb_agg", + "json_objectagg", + "json_object_agg", + "jsonb_object_agg", + "json_object_agg_strict", + "jsonb_object_agg_strict", + "json_object_agg_unique", + "jsonb_object_agg_unique", + "json_arrayagg", + "json_object_agg_unique_strict", + "jsonb_object_agg_unique_strict", + "max", + "min", + "range_agg", + "range_intersect_agg", + "json_agg_strict", + "jsonb_agg_strict", + "string_agg", + "sum", + "xmlagg", + "corr", + "covar_pop", + "covar_samp", + "regr_avgx", + "regr_avgy", + "regr_count", + "regr_intercept", + "regr_r2", + "regr_slope", + "regr_sxx", + "regr_sxy", + "regr_syy", + "stddev", + "stddev_pop", + "stddev_samp", + "variance", + "var_pop", + "var_samp", + "mode", + "percentile_cont", + "percentile_disc", + "rank", + "dense_rank", + "percent_rank", + "cume_dist", + "GROUPING", + } + + windowFunctions = []string{ + "row_number", + "rank", + "dense_rank", + "percent_rank", + "cume_dist", + "ntile", + "lag", + "lead", + "first_value", + "last_value", + "nth_value", + } + + setReturningFunctions = []string{ + "generate_series", + "generate_subscripts", + } + + systemInformationFunctions = []string{ + "current_database", + "current_query", + "current_schema", + "current_schemas", + "inet_client_addr", + "inet_client_port", + "inet_server_addr", + "inet_server_port", + "pg_backend_pid", + "pg_blocking_pids", + "pg_conf_load_time", + "pg_current_logfile", + "pg_my_temp_schema", + "pg_is_other_temp_schema", + "pg_jit_available", + "pg_listening_channels", + "pg_notification_queue_usage", + "pg_postmaster_start_time", + "pg_safe_snapshot_blocking_pids", + "pg_trigger_depth", + "version", + "has_any_column_privilege", + "has_column_privilege", + "has_database_privilege", + "has_foreign_data_wrapper_privilege", + "has_function_privilege", + "has_language_privilege", + "has_parameter_privilege", + "has_schema_privilege", + "has_sequence_privilege", + "has_server_privilege", + "has_table_privilege", + "has_tablespace_privilege", + "has_type_privilege", + "pg_has_role", + "row_security_active", + "acldefault", + "aclexplode", + "makeaclitem", + "pg_collation_is_visible", + "pg_conversion_is_visible", + "pg_function_is_visible", + "pg_opclass_is_visible", + "pg_operator_is_visible", + "pg_opfamily_is_visible", + "pg_statistics_obj_is_visible", + "pg_table_is_visible", + "pg_ts_config_is_visible", + "pg_ts_dict_is_visible", + "pg_ts_parser_is_visible", + "pg_ts_template_is_visible", + "pg_type_is_visible", + "format_type", + "pg_char_to_encoding", + "pg_encoding_to_char", + "pg_get_catalog_foreign_keys", + "pg_get_constraintdef", + "pg_get_expr", + "pg_get_functiondef", + "pg_get_function_arguments", + "pg_get_function_identity_arguments", + "pg_get_function_result", + "pg_get_indexdef", + "pg_get_keywords", + "pg_get_partkeydef", + "pg_get_ruledef", + "pg_get_serial_sequence", + "pg_get_statisticsobjdef", + "pg_get_triggerdef", + "pg_get_userbyid", + "pg_get_viewdef", + "pg_index_column_has_property", + "pg_index_has_property", + "pg_indexam_has_property", + "pg_options_to_table", + "pg_settings_get_flags", + "pg_tablespace_databases", + "pg_tablespace_location", + "pg_typeof", + "COLLATION FOR", + "to_regclass", + "to_regcollation", + "to_regnamespace", + "to_regoper", + "to_regoperator", + "to_regproc", + "to_regprocedure", + "to_regrole", + "to_regtype", + "pg_describe_object", + "pg_identify_object", + "pg_identify_object_as_address", + "pg_get_object_address", + "col_description", + "obj_description", + "shobj_description", + "pg_input_is_valid", + "pg_input_error_info", + "pg_current_xact_id", + "pg_current_xact_id_if_assigned", + "pg_xact_status", + "pg_current_snapshot", + "pg_snapshot_xip", + "pg_snapshot_xmax", + "pg_snapshot_xmin", + "pg_visible_in_snapshot", + "txid_current", + "txid_current_if_assigned", + "txid_current_snapshot", + "txid_snapshot_xip", + "txid_snapshot_xmax", + "txid_snapshot_xmin", + "txid_visible_in_snapshot", + "txid_status", + "pg_xact_commit_timestamp", + "pg_xact_commit_timestamp_origin", + "pg_last_committed_xact", + "pg_control_checkpoint", + "pg_control_system", + "pg_control_init", + "pg_control_recovery", + } + + systemAdministrationFunctions = []string{ + "current_setting", + "set_config", + "pg_cancel_backend", + "pg_log_backend_memory_contexts", + "pg_reload_conf", + "pg_rotate_logfile", + "pg_terminate_backend", + "pg_create_restore_point", + "pg_current_wal_flush_lsn", + "pg_current_wal_insert_lsn", + "pg_current_wal_lsn", + "pg_backup_start", + "pg_backup_stop", + "pg_switch_wal", + "pg_walfile_name", + "pg_walfile_name_offset", + "pg_split_walfile_name", + "pg_wal_lsn_diff", + "pg_is_in_recovery", + "pg_last_wal_receive_lsn", + "pg_last_wal_replay_lsn", + "pg_last_xact_replay_timestamp", + "pg_get_wal_resource_managers", + "pg_is_wal_replay_paused", + "pg_get_wal_replay_pause_state", + "pg_promote", + "pg_wal_replay_pause", + "pg_wal_replay_resume", + "pg_export_snapshot", + "pg_log_standby_snapshot", + "pg_create_physical_replication_slot", + "pg_drop_replication_slot", + "pg_create_logical_replication_slot", + "pg_copy_physical_replication_slot", + "pg_copy_logical_replication_slot", + "pg_logical_slot_get_changes", + "pg_logical_slot_peek_changes", + "pg_logical_slot_get_binary_changes", + "pg_logical_slot_peek_binary_changes", + "pg_replication_slot_advance", + "pg_replication_origin_create", + "pg_replication_origin_drop", + "pg_replication_origin_oid", + "pg_replication_origin_session_setup", + "pg_replication_origin_session_reset", + "pg_replication_origin_session_is_setup", + "pg_replication_origin_session_progress", + "pg_replication_origin_xact_setup", + "pg_replication_origin_xact_reset", + "pg_replication_origin_advance", + "pg_replication_origin_progress", + "pg_logical_emit_message", + "pg_column_size", + "pg_column_compression", + "pg_database_size", + "pg_indexes_size", + "pg_relation_size", + "pg_size_bytes", + "pg_size_pretty", + "pg_table_size", + "pg_tablespace_size", + "pg_total_relation_size", + "pg_relation_filenode", + "pg_relation_filepath", + "pg_filenode_relation", + "pg_collation_actual_version", + "pg_database_collation_actual_version", + "pg_import_system_collations", + "pg_partition_tree", + "pg_partition_ancestors", + "pg_partition_root", + "brin_summarize_new_values", + "brin_summarize_range", + "brin_desummarize_range", + "gin_clean_pending_list", + "pg_ls_dir", + "pg_ls_logdir", + "pg_ls_waldir", + "pg_ls_logicalmapdir", + "pg_ls_logicalsnapdir", + "pg_ls_replslotdir", + "pg_ls_archive_statusdir", + "pg_ls_tmpdir", + "pg_read_file", + "pg_read_binary_file", + "pg_stat_file", + "pg_advisory_lock", + "pg_advisory_lock_shared", + "pg_advisory_unlock", + "pg_advisory_unlock_all", + "pg_advisory_unlock_shared", + "pg_advisory_xact_lock", + "pg_advisory_xact_lock_shared", + "pg_try_advisory_lock", + "pg_try_advisory_lock_shared", + "pg_try_advisory_xact_lock", + "pg_try_advisory_xact_lock_shared", + } + + triggerFunctions = []string{ + "suppress_redundant_updates_trigger", + "tsvector_update_trigger", + "tsvector_update_trigger_column", + } + + eventTriggerFunctions = []string{ + "pg_event_trigger_ddl_commands", + "pg_event_trigger_dropped_objects", + "pg_event_trigger_table_rewrite_oid", + "pg_event_trigger_table_rewrite_reason", + } + + statisticsFunctions = []string{ + "pg_event_trigger_table_rewrite_reason", + } + + builtinFunctions = []string{} +) + +func init() { + funcMap := make(map[string]bool) + + for _, f := range comparisonFunctions { + funcMap[f] = true + } + for _, f := range mathematicalFunctions { + funcMap[f] = true + } + for _, f := range stringFunctions { + funcMap[f] = true + } + for _, f := range binaryStringFunctions { + funcMap[f] = true + } + for _, f := range bitStringFunctions { + funcMap[f] = true + } + for _, f := range dataTypeFormattingFunctions { + funcMap[f] = true + } + for _, f := range dateTimeFunctions { + funcMap[f] = true + } + for _, f := range enumSupportFunctions { + funcMap[f] = true + } + for _, f := range geometricFunctions { + funcMap[f] = true + } + for _, f := range networkAddressFunctions { + funcMap[f] = true + } + for _, f := range textSearchFunctions { + funcMap[f] = true + } + for _, f := range uuidFunctions { + funcMap[f] = true + } + for _, f := range xmlFunctions { + funcMap[f] = true + } + for _, f := range jsonFunctions { + funcMap[f] = true + } + for _, f := range sequenceManipulationFunctions { + funcMap[f] = true + } + for _, f := range conditionalFunctions { + funcMap[f] = true + } + for _, f := range arrayFunctions { + funcMap[f] = true + } + for _, f := range rangeFunctions { + funcMap[f] = true + } + for _, f := range aggregateFunctions { + funcMap[f] = true + } + for _, f := range windowFunctions { + funcMap[f] = true + } + for _, f := range setReturningFunctions { + funcMap[f] = true + } + for _, f := range systemInformationFunctions { + funcMap[f] = true + } + for _, f := range systemAdministrationFunctions { + funcMap[f] = true + } + for _, f := range triggerFunctions { + funcMap[f] = true + } + for _, f := range eventTriggerFunctions { + funcMap[f] = true + } + for _, f := range statisticsFunctions { + funcMap[f] = true + } + + for f := range funcMap { + builtinFunctions = append(builtinFunctions, f) + } + + sort.Strings(builtinFunctions) +} + +func GetBuiltinFunctions() []string { + var result []string + result = append(result, builtinFunctions...) + return result +} diff --git a/postgresql/examples/advisory_lock.sql b/postgresql/examples/advisory_lock.sql new file mode 100644 index 0000000..57c47c0 --- /dev/null +++ b/postgresql/examples/advisory_lock.sql @@ -0,0 +1,146 @@ +-- +-- ADVISORY LOCKS +-- + +BEGIN; + +SELECT + pg_advisory_xact_lock(1), pg_advisory_xact_lock_shared(2), + pg_advisory_xact_lock(1, 1), pg_advisory_xact_lock_shared(2, 2); + +SELECT locktype, classid, objid, objsubid, mode, granted + FROM pg_locks WHERE locktype = 'advisory' + ORDER BY classid, objid, objsubid; + + +-- pg_advisory_unlock_all() shouldn't release xact locks +SELECT pg_advisory_unlock_all(); + +SELECT count(*) FROM pg_locks WHERE locktype = 'advisory'; + + +-- can't unlock xact locks +SELECT + pg_advisory_unlock(1), pg_advisory_unlock_shared(2), + pg_advisory_unlock(1, 1), pg_advisory_unlock_shared(2, 2); + + +-- automatically release xact locks at commit +COMMIT; + +SELECT count(*) FROM pg_locks WHERE locktype = 'advisory'; + + +BEGIN; + +-- holding both session and xact locks on the same objects, xact first +SELECT + pg_advisory_xact_lock(1), pg_advisory_xact_lock_shared(2), + pg_advisory_xact_lock(1, 1), pg_advisory_xact_lock_shared(2, 2); + +SELECT locktype, classid, objid, objsubid, mode, granted + FROM pg_locks WHERE locktype = 'advisory' + ORDER BY classid, objid, objsubid; + +SELECT + pg_advisory_lock(1), pg_advisory_lock_shared(2), + pg_advisory_lock(1, 1), pg_advisory_lock_shared(2, 2); + +ROLLBACK; + +SELECT locktype, classid, objid, objsubid, mode, granted + FROM pg_locks WHERE locktype = 'advisory' + ORDER BY classid, objid, objsubid; + + +-- unlocking session locks +SELECT + pg_advisory_unlock(1), pg_advisory_unlock(1), + pg_advisory_unlock_shared(2), pg_advisory_unlock_shared(2), + pg_advisory_unlock(1, 1), pg_advisory_unlock(1, 1), + pg_advisory_unlock_shared(2, 2), pg_advisory_unlock_shared(2, 2); + +SELECT count(*) FROM pg_locks WHERE locktype = 'advisory'; + + +BEGIN; + +-- holding both session and xact locks on the same objects, session first +SELECT + pg_advisory_lock(1), pg_advisory_lock_shared(2), + pg_advisory_lock(1, 1), pg_advisory_lock_shared(2, 2); + +SELECT locktype, classid, objid, objsubid, mode, granted + FROM pg_locks WHERE locktype = 'advisory' + ORDER BY classid, objid, objsubid; + +SELECT + pg_advisory_xact_lock(1), pg_advisory_xact_lock_shared(2), + pg_advisory_xact_lock(1, 1), pg_advisory_xact_lock_shared(2, 2); + +ROLLBACK; + +SELECT locktype, classid, objid, objsubid, mode, granted + FROM pg_locks WHERE locktype = 'advisory' + ORDER BY classid, objid, objsubid; + + +-- releasing all session locks +SELECT pg_advisory_unlock_all(); + +SELECT count(*) FROM pg_locks WHERE locktype = 'advisory'; + + +BEGIN; + +-- grabbing txn locks multiple times + +SELECT + pg_advisory_xact_lock(1), pg_advisory_xact_lock(1), + pg_advisory_xact_lock_shared(2), pg_advisory_xact_lock_shared(2), + pg_advisory_xact_lock(1, 1), pg_advisory_xact_lock(1, 1), + pg_advisory_xact_lock_shared(2, 2), pg_advisory_xact_lock_shared(2, 2); + +SELECT locktype, classid, objid, objsubid, mode, granted + FROM pg_locks WHERE locktype = 'advisory' + ORDER BY classid, objid, objsubid; + +COMMIT; + +SELECT count(*) FROM pg_locks WHERE locktype = 'advisory'; + +-- grabbing session locks multiple times + +SELECT + pg_advisory_lock(1), pg_advisory_lock(1), + pg_advisory_lock_shared(2), pg_advisory_lock_shared(2), + pg_advisory_lock(1, 1), pg_advisory_lock(1, 1), + pg_advisory_lock_shared(2, 2), pg_advisory_lock_shared(2, 2); + +SELECT locktype, classid, objid, objsubid, mode, granted + FROM pg_locks WHERE locktype = 'advisory' + ORDER BY classid, objid, objsubid; + +SELECT + pg_advisory_unlock(1), pg_advisory_unlock(1), + pg_advisory_unlock_shared(2), pg_advisory_unlock_shared(2), + pg_advisory_unlock(1, 1), pg_advisory_unlock(1, 1), + pg_advisory_unlock_shared(2, 2), pg_advisory_unlock_shared(2, 2); + +SELECT count(*) FROM pg_locks WHERE locktype = 'advisory'; + +-- .. and releasing them all at once + +SELECT + pg_advisory_lock(1), pg_advisory_lock(1), + pg_advisory_lock_shared(2), pg_advisory_lock_shared(2), + pg_advisory_lock(1, 1), pg_advisory_lock(1, 1), + pg_advisory_lock_shared(2, 2), pg_advisory_lock_shared(2, 2); + +SELECT locktype, classid, objid, objsubid, mode, granted + FROM pg_locks WHERE locktype = 'advisory' + ORDER BY classid, objid, objsubid; + +SELECT pg_advisory_unlock_all(); + +SELECT count(*) FROM pg_locks WHERE locktype = 'advisory'; diff --git a/postgresql/examples/aggregates.sql b/postgresql/examples/aggregates.sql new file mode 100644 index 0000000..9910287 --- /dev/null +++ b/postgresql/examples/aggregates.sql @@ -0,0 +1,1218 @@ +-- +-- AGGREGATES +-- + +-- avoid bit-exact output here because operations may not be bit-exact. +SET extra_float_digits = 0; + +SELECT avg(four) AS avg_1 FROM onek; + +SELECT avg(a) AS avg_32 FROM aggtest WHERE a < 100; + +-- In 7.1, avg(float4) is computed using float8 arithmetic. +-- Round the result to 3 digits to avoid platform-specific results. + +SELECT avg(b)::numeric(10,3) AS avg_107_943 FROM aggtest; + +SELECT avg(gpa) AS avg_3_4 FROM ONLY student; + + +SELECT sum(four) AS sum_1500 FROM onek; +SELECT sum(a) AS sum_198 FROM aggtest; +SELECT sum(b) AS avg_431_773 FROM aggtest; +SELECT sum(gpa) AS avg_6_8 FROM ONLY student; + +SELECT max(four) AS max_3 FROM onek; +SELECT max(a) AS max_100 FROM aggtest; +SELECT max(aggtest.b) AS max_324_78 FROM aggtest; +SELECT max(student.gpa) AS max_3_7 FROM student; + +SELECT stddev_pop(b) FROM aggtest; +SELECT stddev_samp(b) FROM aggtest; +SELECT var_pop(b) FROM aggtest; +SELECT var_samp(b) FROM aggtest; + +SELECT stddev_pop(b::numeric) FROM aggtest; +SELECT stddev_samp(b::numeric) FROM aggtest; +SELECT var_pop(b::numeric) FROM aggtest; +SELECT var_samp(b::numeric) FROM aggtest; + +-- population variance is defined for a single tuple, sample variance +-- is not +SELECT var_pop(1.0::float8), var_samp(2.0::float8); +SELECT stddev_pop(3.0::float8), stddev_samp(4.0::float8); +SELECT var_pop('inf'::float8), var_samp('inf'::float8); +SELECT stddev_pop('inf'::float8), stddev_samp('inf'::float8); +SELECT var_pop('nan'::float8), var_samp('nan'::float8); +SELECT stddev_pop('nan'::float8), stddev_samp('nan'::float8); +SELECT var_pop(1.0::float4), var_samp(2.0::float4); +SELECT stddev_pop(3.0::float4), stddev_samp(4.0::float4); +SELECT var_pop('inf'::float4), var_samp('inf'::float4); +SELECT stddev_pop('inf'::float4), stddev_samp('inf'::float4); +SELECT var_pop('nan'::float4), var_samp('nan'::float4); +SELECT stddev_pop('nan'::float4), stddev_samp('nan'::float4); +SELECT var_pop(1.0::numeric), var_samp(2.0::numeric); +SELECT stddev_pop(3.0::numeric), stddev_samp(4.0::numeric); +SELECT var_pop('inf'::numeric), var_samp('inf'::numeric); +SELECT stddev_pop('inf'::numeric), stddev_samp('inf'::numeric); +SELECT var_pop('nan'::numeric), var_samp('nan'::numeric); +SELECT stddev_pop('nan'::numeric), stddev_samp('nan'::numeric); + +-- verify correct results for null and NaN inputs +select sum(null::int4) from generate_series(1,3); +select sum(null::int8) from generate_series(1,3); +select sum(null::numeric) from generate_series(1,3); +select sum(null::float8) from generate_series(1,3); +select avg(null::int4) from generate_series(1,3); +select avg(null::int8) from generate_series(1,3); +select avg(null::numeric) from generate_series(1,3); +select avg(null::float8) from generate_series(1,3); +select sum('NaN'::numeric) from generate_series(1,3); +select avg('NaN'::numeric) from generate_series(1,3); + +-- verify correct results for infinite inputs +SELECT sum(x::float8), avg(x::float8), var_pop(x::float8) +FROM (VALUES ('1'), ('infinity')) v(x); +SELECT sum(x::float8), avg(x::float8), var_pop(x::float8) +FROM (VALUES ('infinity'), ('1')) v(x); +SELECT sum(x::float8), avg(x::float8), var_pop(x::float8) +FROM (VALUES ('infinity'), ('infinity')) v(x); +SELECT sum(x::float8), avg(x::float8), var_pop(x::float8) +FROM (VALUES ('-infinity'), ('infinity')) v(x); +SELECT sum(x::float8), avg(x::float8), var_pop(x::float8) +FROM (VALUES ('-infinity'), ('-infinity')) v(x); +SELECT sum(x::numeric), avg(x::numeric), var_pop(x::numeric) +FROM (VALUES ('1'), ('infinity')) v(x); +SELECT sum(x::numeric), avg(x::numeric), var_pop(x::numeric) +FROM (VALUES ('infinity'), ('1')) v(x); +SELECT sum(x::numeric), avg(x::numeric), var_pop(x::numeric) +FROM (VALUES ('infinity'), ('infinity')) v(x); +SELECT sum(x::numeric), avg(x::numeric), var_pop(x::numeric) +FROM (VALUES ('-infinity'), ('infinity')) v(x); +SELECT sum(x::numeric), avg(x::numeric), var_pop(x::numeric) +FROM (VALUES ('-infinity'), ('-infinity')) v(x); + +-- test accuracy with a large input offset +SELECT avg(x::float8), var_pop(x::float8) +FROM (VALUES (100000003), (100000004), (100000006), (100000007)) v(x); +SELECT avg(x::float8), var_pop(x::float8) +FROM (VALUES (7000000000005), (7000000000007)) v(x); + +-- SQL2003 binary aggregates +SELECT regr_count(b, a) FROM aggtest; +SELECT regr_sxx(b, a) FROM aggtest; +SELECT regr_syy(b, a) FROM aggtest; +SELECT regr_sxy(b, a) FROM aggtest; +SELECT regr_avgx(b, a), regr_avgy(b, a) FROM aggtest; +SELECT regr_r2(b, a) FROM aggtest; +SELECT regr_slope(b, a), regr_intercept(b, a) FROM aggtest; +SELECT covar_pop(b, a), covar_samp(b, a) FROM aggtest; +SELECT corr(b, a) FROM aggtest; + +-- check single-tuple behavior +SELECT covar_pop(1::float8,2::float8), covar_samp(3::float8,4::float8); +SELECT covar_pop(1::float8,'inf'::float8), covar_samp(3::float8,'inf'::float8); +SELECT covar_pop(1::float8,'nan'::float8), covar_samp(3::float8,'nan'::float8); + +-- test accum and combine functions directly +CREATE TABLE regr_test (x float8, y float8); +INSERT INTO regr_test VALUES (10,150),(20,250),(30,350),(80,540),(100,200); +SELECT count(*), sum(x), regr_sxx(y,x), sum(y),regr_syy(y,x), regr_sxy(y,x) +FROM regr_test WHERE x IN (10,20,30,80); +SELECT count(*), sum(x), regr_sxx(y,x), sum(y),regr_syy(y,x), regr_sxy(y,x) +FROM regr_test; +SELECT float8_accum('{4,140,2900}'::float8[], 100); +SELECT float8_regr_accum('{4,140,2900,1290,83075,15050}'::float8[], 200, 100); +SELECT count(*), sum(x), regr_sxx(y,x), sum(y),regr_syy(y,x), regr_sxy(y,x) +FROM regr_test WHERE x IN (10,20,30); +SELECT count(*), sum(x), regr_sxx(y,x), sum(y),regr_syy(y,x), regr_sxy(y,x) +FROM regr_test WHERE x IN (80,100); +SELECT float8_combine('{3,60,200}'::float8[], '{0,0,0}'::float8[]); +SELECT float8_combine('{0,0,0}'::float8[], '{2,180,200}'::float8[]); +SELECT float8_combine('{3,60,200}'::float8[], '{2,180,200}'::float8[]); +SELECT float8_regr_combine('{3,60,200,750,20000,2000}'::float8[], + '{0,0,0,0,0,0}'::float8[]); +SELECT float8_regr_combine('{0,0,0,0,0,0}'::float8[], + '{2,180,200,740,57800,-3400}'::float8[]); +SELECT float8_regr_combine('{3,60,200,750,20000,2000}'::float8[], + '{2,180,200,740,57800,-3400}'::float8[]); +DROP TABLE regr_test; + +-- test count, distinct +SELECT count(four) AS cnt_1000 FROM onek; +SELECT count(DISTINCT four) AS cnt_4 FROM onek; + +select ten, count(*), sum(four) from onek +group by ten order by ten; + +select ten, count(four), sum(DISTINCT four) from onek +group by ten order by ten; + +-- user-defined aggregates +SELECT newavg(four) AS avg_1 FROM onek; +SELECT newsum(four) AS sum_1500 FROM onek; +SELECT newcnt(four) AS cnt_1000 FROM onek; +SELECT newcnt(*) AS cnt_1000 FROM onek; +SELECT oldcnt(*) AS cnt_1000 FROM onek; +SELECT sum2(q1,q2) FROM int8_tbl; + +-- test for outer-level aggregates + +-- this should work +select ten, sum(distinct four) from onek a +group by ten +having exists (select 1 from onek b where sum(distinct a.four) = b.four); + +-- this should fail because subquery has an agg of its own in WHERE +select ten, sum(distinct four) from onek a +group by ten +having exists (select 1 from onek b + where sum(distinct a.four + b.four) = b.four); + +-- Test handling of sublinks within outer-level aggregates. +-- Per bug report from Daniel Grace. +select + (select max((select i.unique2 from tenk1 i where i.unique1 = o.unique1))) +from tenk1 o; + +-- Test handling of Params within aggregate arguments in hashed aggregation. +-- Per bug report from Jeevan Chalke. +explain (verbose, costs off) +select s1, s2, sm +from generate_series(1, 3) s1, + lateral (select s2, sum(s1 + s2) sm + from generate_series(1, 3) s2 group by s2) ss +order by 1, 2; +select s1, s2, sm +from generate_series(1, 3) s1, + lateral (select s2, sum(s1 + s2) sm + from generate_series(1, 3) s2 group by s2) ss +order by 1, 2; + +explain (verbose, costs off) +select array(select sum(x+y) s + from generate_series(1,3) y group by y order by s) + from generate_series(1,3) x; +select array(select sum(x+y) s + from generate_series(1,3) y group by y order by s) + from generate_series(1,3) x; + +-- +-- test for bitwise integer aggregates +-- +CREATE TEMPORARY TABLE bitwise_test( + i2 INT2, + i4 INT4, + i8 INT8, + i INTEGER, + x INT2, + y BIT(4) +); + +-- empty case +SELECT + BIT_AND(i2) AS aaa, + BIT_OR(i4) AS baaa +FROM bitwise_test; + +COPY bitwise_test FROM STDIN NULL 'null'; + +SELECT + BIT_AND(i2) AS "1", + BIT_AND(i4) AS "1", + BIT_AND(i8) AS "1", + BIT_AND(i) AS "?", + BIT_AND(x) AS "0", + BIT_AND(y) AS "0100", + + BIT_OR(i2) AS "7", + BIT_OR(i4) AS "7", + BIT_OR(i8) AS "7", + BIT_OR(i) AS "?", + BIT_OR(x) AS "7", + BIT_OR(y) AS "1101" +FROM bitwise_test; + +-- +-- test boolean aggregates +-- +-- first test all possible transition and final states + +SELECT + -- boolean and transitions + -- null because strict + booland_statefunc(NULL, NULL) IS NULL AS "t", + booland_statefunc(TRUE, NULL) IS NULL AS "t", + booland_statefunc(FALSE, NULL) IS NULL AS "t", + booland_statefunc(NULL, TRUE) IS NULL AS "t", + booland_statefunc(NULL, FALSE) IS NULL AS "t", + -- and actual computations + booland_statefunc(TRUE, TRUE) AS "t", + NOT booland_statefunc(TRUE, FALSE) AS "t", + NOT booland_statefunc(FALSE, TRUE) AS "t", + NOT booland_statefunc(FALSE, FALSE) AS "t"; + +SELECT + -- boolean or transitions + -- null because strict + boolor_statefunc(NULL, NULL) IS NULL AS "t", + boolor_statefunc(TRUE, NULL) IS NULL AS "t", + boolor_statefunc(FALSE, NULL) IS NULL AS "t", + boolor_statefunc(NULL, TRUE) IS NULL AS "t", + boolor_statefunc(NULL, FALSE) IS NULL AS "t", + -- actual computations + boolor_statefunc(TRUE, TRUE) AS "t", + boolor_statefunc(TRUE, FALSE) AS "t", + boolor_statefunc(FALSE, TRUE) AS "t", + NOT boolor_statefunc(FALSE, FALSE) AS "t"; + +CREATE TEMPORARY TABLE bool_test( + b1 BOOL, + b2 BOOL, + b3 BOOL, + b4 BOOL); + +-- empty case +SELECT + BOOL_AND(b1) AS "n", + BOOL_OR(b3) AS "n" +FROM bool_test; + +COPY bool_test FROM STDIN NULL 'null'; + +SELECT + BOOL_AND(b1) AS "f", + BOOL_AND(b2) AS "t", + BOOL_AND(b3) AS "f", + BOOL_AND(b4) AS "n", + BOOL_AND(NOT b2) AS "f", + BOOL_AND(NOT b3) AS "t" +FROM bool_test; + +SELECT + EVERY(b1) AS "f", + EVERY(b2) AS "t", + EVERY(b3) AS "f", + EVERY(b4) AS "n", + EVERY(NOT b2) AS "f", + EVERY(NOT b3) AS "t" +FROM bool_test; + +SELECT + BOOL_OR(b1) AS "t", + BOOL_OR(b2) AS "t", + BOOL_OR(b3) AS "f", + BOOL_OR(b4) AS "n", + BOOL_OR(NOT b2) AS "f", + BOOL_OR(NOT b3) AS "t" +FROM bool_test; + +-- +-- Test cases that should be optimized into indexscans instead of +-- the generic aggregate implementation. +-- + +-- Basic cases +explain (costs off) + select min(unique1) from tenk1; +select min(unique1) from tenk1; +explain (costs off) + select max(unique1) from tenk1; +select max(unique1) from tenk1; +explain (costs off) + select max(unique1) from tenk1 where unique1 < 42; +select max(unique1) from tenk1 where unique1 < 42; +explain (costs off) + select max(unique1) from tenk1 where unique1 > 42; +select max(unique1) from tenk1 where unique1 > 42; + +-- the planner may choose a generic aggregate here if parallel query is +-- enabled, since that plan will be parallel safe and the "optimized" +-- plan, which has almost identical cost, will not be. we want to test +-- the optimized plan, so temporarily disable parallel query. +begin; +set local max_parallel_workers_per_gather = 0; +explain (costs off) + select max(unique1) from tenk1 where unique1 > 42000; +select max(unique1) from tenk1 where unique1 > 42000; +rollback; + +-- multi-column index (uses tenk1_thous_tenthous) +explain (costs off) + select max(tenthous) from tenk1 where thousand = 33; +select max(tenthous) from tenk1 where thousand = 33; +explain (costs off) + select min(tenthous) from tenk1 where thousand = 33; +select min(tenthous) from tenk1 where thousand = 33; + +-- check parameter propagation into an indexscan subquery +explain (costs off) + select f1, (select min(unique1) from tenk1 where unique1 > f1) AS gt + from int4_tbl; +select f1, (select min(unique1) from tenk1 where unique1 > f1) AS gt + from int4_tbl; + +-- check some cases that were handled incorrectly in 8.3.0 +explain (costs off) + select distinct max(unique2) from tenk1; +select distinct max(unique2) from tenk1; +explain (costs off) + select max(unique2) from tenk1 order by 1; +select max(unique2) from tenk1 order by 1; +explain (costs off) + select max(unique2) from tenk1 order by max(unique2); +select max(unique2) from tenk1 order by max(unique2); +explain (costs off) + select max(unique2) from tenk1 order by max(unique2)+1; +select max(unique2) from tenk1 order by max(unique2)+1; +explain (costs off) + select max(unique2), generate_series(1,3) as g from tenk1 order by g desc; +select max(unique2), generate_series(1,3) as g from tenk1 order by g desc; + +-- interesting corner case: constant gets optimized into a seqscan +explain (costs off) + select max(100) from tenk1; +select max(100) from tenk1; + +-- try it on an inheritance tree +create table minmaxtest(f1 int); +create table minmaxtest1() inherits (minmaxtest); +create table minmaxtest2() inherits (minmaxtest); +create table minmaxtest3() inherits (minmaxtest); +create index minmaxtesti on minmaxtest(f1); +create index minmaxtest1i on minmaxtest1(f1); +create index minmaxtest2i on minmaxtest2(f1 desc); +create index minmaxtest3i on minmaxtest3(f1) where f1 is not null; + +insert into minmaxtest values(11), (12); +insert into minmaxtest1 values(13), (14); +insert into minmaxtest2 values(15), (16); +insert into minmaxtest3 values(17), (18); + +explain (costs off) + select min(f1), max(f1) from minmaxtest; +select min(f1), max(f1) from minmaxtest; + +-- DISTINCT doesn't do anything useful here, but it shouldn't fail +explain (costs off) + select distinct min(f1), max(f1) from minmaxtest; +select distinct min(f1), max(f1) from minmaxtest; + +drop table minmaxtest cascade; + +-- check for correct detection of nested-aggregate errors +select max(min(unique1)) from tenk1; +select (select max(min(unique1)) from int8_tbl) from tenk1; + +-- +-- Test removal of redundant GROUP BY columns +-- + +create temp table t1 (a int, b int, c int, d int, primary key (a, b)); +create temp table t2 (x int, y int, z int, primary key (x, y)); +create temp table t3 (a int, b int, c int, primary key(a, b) deferrable); + +-- Non-primary-key columns can be removed from GROUP BY +explain (costs off) select * from t1 group by a,b,c,d; + +-- No removal can happen if the complete PK is not present in GROUP BY +explain (costs off) select a,c from t1 group by a,c,d; + +-- Test removal across multiple relations +explain (costs off) select * +from t1 inner join t2 on t1.a = t2.x and t1.b = t2.y +group by t1.a,t1.b,t1.c,t1.d,t2.x,t2.y,t2.z; + +-- Test case where t1 can be optimized but not t2 +explain (costs off) select t1.*,t2.x,t2.z +from t1 inner join t2 on t1.a = t2.x and t1.b = t2.y +group by t1.a,t1.b,t1.c,t1.d,t2.x,t2.z; + +-- Cannot optimize when PK is deferrable +explain (costs off) select * from t3 group by a,b,c; + +create temp table t1c () inherits (t1); + +-- Ensure we don't remove any columns when t1 has a child table +explain (costs off) select * from t1 group by a,b,c,d; + +-- Okay to remove columns if we're only querying the parent. +explain (costs off) select * from only t1 group by a,b,c,d; + +create temp table p_t1 ( + a int, + b int, + c int, + d int, + primary key(a,b) +) partition by list(a); +create temp table p_t1_1 partition of p_t1 for values in(1); +create temp table p_t1_2 partition of p_t1 for values in(2); + +-- Ensure we can remove non-PK columns for partitioned tables. +explain (costs off) select * from p_t1 group by a,b,c,d; + +drop table t1 cascade; +drop table t2; +drop table t3; +drop table p_t1; + +-- +-- Test GROUP BY matching of join columns that are type-coerced due to USING +-- + +create temp table t1(f1 int, f2 bigint); +create temp table t2(f1 bigint, f22 bigint); + +select f1 from t1 left join t2 using (f1) group by f1; +select f1 from t1 left join t2 using (f1) group by t1.f1; +select t1.f1 from t1 left join t2 using (f1) group by t1.f1; +-- only this one should fail: +select t1.f1 from t1 left join t2 using (f1) group by f1; + +drop table t1, t2; + +-- +-- Test combinations of DISTINCT and/or ORDER BY +-- + +select array_agg(a order by b) + from (values (1,4),(2,3),(3,1),(4,2)) v(a,b); +select array_agg(a order by a) + from (values (1,4),(2,3),(3,1),(4,2)) v(a,b); +select array_agg(a order by a desc) + from (values (1,4),(2,3),(3,1),(4,2)) v(a,b); +select array_agg(b order by a desc) + from (values (1,4),(2,3),(3,1),(4,2)) v(a,b); + +select array_agg(distinct a) + from (values (1),(2),(1),(3),(null),(2)) v(a); +select array_agg(distinct a order by a) + from (values (1),(2),(1),(3),(null),(2)) v(a); +select array_agg(distinct a order by a desc) + from (values (1),(2),(1),(3),(null),(2)) v(a); +select array_agg(distinct a order by a desc nulls last) + from (values (1),(2),(1),(3),(null),(2)) v(a); + +-- multi-arg aggs, strict/nonstrict, distinct/order by + +select aggfstr(a,b,c) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); +select aggfns(a,b,c) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); + +select aggfstr(distinct a,b,c) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,3) i; +select aggfns(distinct a,b,c) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,3) i; + +select aggfstr(distinct a,b,c order by b) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,3) i; +select aggfns(distinct a,b,c order by b) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,3) i; + +-- test specific code paths + +select aggfns(distinct a,a,c order by c using ~<~,a) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,2) i; +select aggfns(distinct a,a,c order by c using ~<~) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,2) i; +select aggfns(distinct a,a,c order by a) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,2) i; +select aggfns(distinct a,b,c order by a,c using ~<~,b) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,2) i; + +-- check node I/O via view creation and usage, also deparsing logic + +create view agg_view1 as + select aggfns(a,b,c) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); + +select * from agg_view1; +select pg_get_viewdef('agg_view1'::regclass); + +create or replace view agg_view1 as + select aggfns(distinct a,b,c) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,3) i; + +select * from agg_view1; +select pg_get_viewdef('agg_view1'::regclass); + +create or replace view agg_view1 as + select aggfns(distinct a,b,c order by b) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,3) i; + +select * from agg_view1; +select pg_get_viewdef('agg_view1'::regclass); + +create or replace view agg_view1 as + select aggfns(a,b,c order by b+1) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); + +select * from agg_view1; +select pg_get_viewdef('agg_view1'::regclass); + +create or replace view agg_view1 as + select aggfns(a,a,c order by b) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); + +select * from agg_view1; +select pg_get_viewdef('agg_view1'::regclass); + +create or replace view agg_view1 as + select aggfns(a,b,c order by c using ~<~) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c); + +select * from agg_view1; +select pg_get_viewdef('agg_view1'::regclass); + +create or replace view agg_view1 as + select aggfns(distinct a,b,c order by a,c using ~<~,b) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,2) i; + +select * from agg_view1; +select pg_get_viewdef('agg_view1'::regclass); + +drop view agg_view1; + +-- incorrect DISTINCT usage errors + +select aggfns(distinct a,b,c order by i) + from (values (1,1,'foo')) v(a,b,c), generate_series(1,2) i; +select aggfns(distinct a,b,c order by a,b+1) + from (values (1,1,'foo')) v(a,b,c), generate_series(1,2) i; +select aggfns(distinct a,b,c order by a,b,i,c) + from (values (1,1,'foo')) v(a,b,c), generate_series(1,2) i; +select aggfns(distinct a,a,c order by a,b) + from (values (1,1,'foo')) v(a,b,c), generate_series(1,2) i; + +-- string_agg tests +select string_agg(a,',') from (values('aaaa'),('bbbb'),('cccc')) g(a); +select string_agg(a,',') from (values('aaaa'),(null),('bbbb'),('cccc')) g(a); +select string_agg(a,'AB') from (values(null),(null),('bbbb'),('cccc')) g(a); +select string_agg(a,',') from (values(null),(null)) g(a); + +-- check some implicit casting cases, as per bug #5564 +select string_agg(distinct f1, ',' order by f1) from varchar_tbl; -- ok +select string_agg(distinct f1::text, ',' order by f1) from varchar_tbl; -- not ok +select string_agg(distinct f1, ',' order by f1::text) from varchar_tbl; -- not ok +select string_agg(distinct f1::text, ',' order by f1::text) from varchar_tbl; -- ok + +-- string_agg bytea tests +create table bytea_test_table(v bytea); + +select string_agg(v, '') from bytea_test_table; + +insert into bytea_test_table values(decode('ff','hex')); + +select string_agg(v, '') from bytea_test_table; + +insert into bytea_test_table values(decode('aa','hex')); + +select string_agg(v, '') from bytea_test_table; +select string_agg(v, NULL) from bytea_test_table; +select string_agg(v, decode('ee', 'hex')) from bytea_test_table; + +drop table bytea_test_table; + +-- FILTER tests + +select min(unique1) filter (where unique1 > 100) from tenk1; + +select sum(1/ten) filter (where ten > 0) from tenk1; + +--select ten, sum(distinct four) filter (where four::text ~ '123') from onek a +--group by ten; + +select ten, sum(distinct four) filter (where four > 10) from onek a +group by ten +having exists (select 1 from onek b where sum(distinct a.four) = b.four); + +select max(foo COLLATE "C") filter (where (bar collate "POSIX") > '0') +from (values ('a', 'b')) AS v(foo,bar); + +-- outer reference in FILTER (PostgreSQL extension) +select (select count(*) + from (values (1)) t0(inner_c)) +from (values (2),(3)) t1(outer_c); -- inner query is aggregation query +select (select count(*) filter (where outer_c <> 0) + from (values (1)) t0(inner_c)) +from (values (2),(3)) t1(outer_c); -- outer query is aggregation query +select (select count(inner_c) filter (where outer_c <> 0) + from (values (1)) t0(inner_c)) +from (values (2),(3)) t1(outer_c); -- inner query is aggregation query +select + (select max((select i.unique2 from tenk1 i where i.unique1 = o.unique1)) + filter (where o.unique1 < 10)) +from tenk1 o; -- outer query is aggregation query + +-- subquery in FILTER clause (PostgreSQL extension) +select sum(unique1) FILTER (WHERE + unique1 IN (SELECT unique1 FROM onek where unique1 < 100)) FROM tenk1; + +-- exercise lots of aggregate parts with FILTER +select aggfns(distinct a,b,c order by a,c using ~<~,b) filter (where a > 1) + from (values (1,3,'foo'),(0,null,null),(2,2,'bar'),(3,1,'baz')) v(a,b,c), + generate_series(1,2) i; + +-- ordered-set aggregates + +select p, percentile_cont(p) within group (order by x::float8) +from generate_series(1,5) x, + (values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p) +group by p order by p; + +select p, percentile_cont(p order by p) within group (order by x) -- error +from generate_series(1,5) x, + (values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p) +group by p order by p; + +select p, sum() within group (order by x::float8) -- error +from generate_series(1,5) x, + (values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p) +group by p order by p; + +select p, percentile_cont(p,p) -- error +from generate_series(1,5) x, + (values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p) +group by p order by p; + +select percentile_cont(0.5) within group (order by b) from aggtest; +select percentile_cont(0.5) within group (order by b), sum(b) from aggtest; +select percentile_cont(0.5) within group (order by thousand) from tenk1; +select percentile_disc(0.5) within group (order by thousand) from tenk1; +select rank(3) within group (order by x) +from (values (1),(1),(2),(2),(3),(3),(4)) v(x); +select cume_dist(3) within group (order by x) +from (values (1),(1),(2),(2),(3),(3),(4)) v(x); +select percent_rank(3) within group (order by x) +from (values (1),(1),(2),(2),(3),(3),(4),(5)) v(x); +select dense_rank(3) within group (order by x) +from (values (1),(1),(2),(2),(3),(3),(4)) v(x); + +select percentile_disc(array[0,0.1,0.25,0.5,0.75,0.9,1]) within group (order by thousand) +from tenk1; +select percentile_cont(array[0,0.25,0.5,0.75,1]) within group (order by thousand) +from tenk1; +select percentile_disc(array[[null,1,0.5],[0.75,0.25,null]]) within group (order by thousand) +from tenk1; +select percentile_cont(array[0,1,0.25,0.75,0.5,1,0.3,0.32,0.35,0.38,0.4]) within group (order by x) +from generate_series(1,6) x; + +select ten, mode() within group (order by string4) from tenk1 group by ten; + +select percentile_disc(array[0.25,0.5,0.75]) within group (order by x) +from unnest('{fred,jim,fred,jack,jill,fred,jill,jim,jim,sheila,jim,sheila}'::text[]) u(x); + +-- check collation propagates up in suitable cases: +select pg_collation_for(percentile_disc(1) within group (order by x collate "POSIX")) + from (values ('fred'),('jim')) v(x); + +-- ordered-set aggs created with CREATE AGGREGATE +select test_rank(3) within group (order by x) +from (values (1),(1),(2),(2),(3),(3),(4)) v(x); +select test_percentile_disc(0.5) within group (order by thousand) from tenk1; + +-- ordered-set aggs can't use ungrouped vars in direct args: +select rank(x) within group (order by x) from generate_series(1,5) x; + +-- outer-level agg can't use a grouped arg of a lower level, either: +select array(select percentile_disc(a) within group (order by x) + from (values (0.3),(0.7)) v(a) group by a) + from generate_series(1,5) g(x); + +-- agg in the direct args is a grouping violation, too: +select rank(sum(x)) within group (order by x) from generate_series(1,5) x; + +-- hypothetical-set type unification and argument-count failures: +select rank(3) within group (order by x) from (values ('fred'),('jim')) v(x); +select rank(3) within group (order by stringu1,stringu2) from tenk1; +select rank('fred') within group (order by x) from generate_series(1,5) x; +select rank('adam'::text collate "C") within group (order by x collate "POSIX") + from (values ('fred'),('jim')) v(x); +-- hypothetical-set type unification successes: +select rank('adam'::varchar) within group (order by x) from (values ('fred'),('jim')) v(x); +select rank('3') within group (order by x) from generate_series(1,5) x; + +-- divide by zero check +select percent_rank(0) within group (order by x) from generate_series(1,0) x; + +-- deparse and multiple features: +create view aggordview1 as +select ten, + percentile_disc(0.5) within group (order by thousand) as p50, + percentile_disc(0.5) within group (order by thousand) filter (where hundred=1) as px, + rank(5,'AZZZZ',50) within group (order by hundred, string4 desc, hundred) + from tenk1 + group by ten order by ten; + +select pg_get_viewdef('aggordview1'); +select * from aggordview1 order by ten; +drop view aggordview1; + +-- variadic aggregates +select least_agg(q1,q2) from int8_tbl; +select least_agg(variadic array[q1,q2]) from int8_tbl; + +select cleast_agg(q1,q2) from int8_tbl; +select cleast_agg(4.5,f1) from int4_tbl; +select cleast_agg(variadic array[4.5,f1]) from int4_tbl; +select pg_typeof(cleast_agg(variadic array[4.5,f1])) from int4_tbl; + +-- test aggregates with common transition functions share the same states +begin work; + +create type avg_state as (total bigint, count bigint); + +create or replace function avg_transfn(state avg_state, n int) returns avg_state as +$$ +declare new_state avg_state; +begin + raise notice 'avg_transfn called with %', n; + if state is null then + if n is not null then + new_state.total := n; + new_state.count := 1; + return new_state; + end if; + return null; + elsif n is not null then + state.total := state.total + n; + state.count := state.count + 1; + return state; + end if; + + return null; +end +$$ language plpgsql; + +create function avg_finalfn(state avg_state) returns int4 as +$$ +begin + if state is null then + return NULL; + else + return state.total / state.count; + end if; +end +$$ language plpgsql; + +create function sum_finalfn(state avg_state) returns int4 as +$$ +begin + if state is null then + return NULL; + else + return state.total; + end if; +end +$$ language plpgsql; + +create aggregate my_avg(int4) +( + stype = avg_state, + sfunc = avg_transfn, + finalfunc = avg_finalfn +); + +create aggregate my_sum(int4) +( + stype = avg_state, + sfunc = avg_transfn, + finalfunc = sum_finalfn +); + +-- aggregate state should be shared as aggs are the same. +select my_avg(one),my_avg(one) from (values(1),(3)) t(one); + +-- aggregate state should be shared as transfn is the same for both aggs. +select my_avg(one),my_sum(one) from (values(1),(3)) t(one); + +-- same as previous one, but with DISTINCT, which requires sorting the input. +select my_avg(distinct one),my_sum(distinct one) from (values(1),(3),(1)) t(one); + +-- shouldn't share states due to the distinctness not matching. +select my_avg(distinct one),my_sum(one) from (values(1),(3)) t(one); + +-- shouldn't share states due to the filter clause not matching. +select my_avg(one) filter (where one > 1),my_sum(one) from (values(1),(3)) t(one); + +-- this should not share the state due to different input columns. +select my_avg(one),my_sum(two) from (values(1,2),(3,4)) t(one,two); + +-- exercise cases where OSAs share state +select + percentile_cont(0.5) within group (order by a), + percentile_disc(0.5) within group (order by a) +from (values(1::float8),(3),(5),(7)) t(a); + +select + percentile_cont(0.25) within group (order by a), + percentile_disc(0.5) within group (order by a) +from (values(1::float8),(3),(5),(7)) t(a); + +-- these can't share state currently +select + rank(4) within group (order by a), + dense_rank(4) within group (order by a) +from (values(1),(3),(5),(7)) t(a); + +-- test that aggs with the same sfunc and initcond share the same agg state +create aggregate my_sum_init(int4) +( + stype = avg_state, + sfunc = avg_transfn, + finalfunc = sum_finalfn, + initcond = '(10,0)' +); + +create aggregate my_avg_init(int4) +( + stype = avg_state, + sfunc = avg_transfn, + finalfunc = avg_finalfn, + initcond = '(10,0)' +); + +create aggregate my_avg_init2(int4) +( + stype = avg_state, + sfunc = avg_transfn, + finalfunc = avg_finalfn, + initcond = '(4,0)' +); + +-- state should be shared if INITCONDs are matching +select my_sum_init(one),my_avg_init(one) from (values(1),(3)) t(one); + +-- Varying INITCONDs should cause the states not to be shared. +select my_sum_init(one),my_avg_init2(one) from (values(1),(3)) t(one); + +rollback; + +-- test aggregate state sharing to ensure it works if one aggregate has a +-- finalfn and the other one has none. +begin work; + +create or replace function sum_transfn(state int4, n int4) returns int4 as +$$ +declare new_state int4; +begin + raise notice 'sum_transfn called with %', n; + if state is null then + if n is not null then + new_state := n; + return new_state; + end if; + return null; + elsif n is not null then + state := state + n; + return state; + end if; + + return null; +end +$$ language plpgsql; + +create function halfsum_finalfn(state int4) returns int4 as +$$ +begin + if state is null then + return NULL; + else + return state / 2; + end if; +end +$$ language plpgsql; + +create aggregate my_sum(int4) +( + stype = int4, + sfunc = sum_transfn +); + +create aggregate my_half_sum(int4) +( + stype = int4, + sfunc = sum_transfn, + finalfunc = halfsum_finalfn +); + +-- Agg state should be shared even though my_sum has no finalfn +select my_sum(one),my_half_sum(one) from (values(1),(2),(3),(4)) t(one); + +rollback; + + +-- test that the aggregate transition logic correctly handles +-- transition / combine functions returning NULL + +-- First test the case of a normal transition function returning NULL +BEGIN; +CREATE FUNCTION balkifnull(int8, int4) +RETURNS int8 +STRICT +LANGUAGE plpgsql AS $$ +BEGIN + IF $1 IS NULL THEN + RAISE 'erroneously called with NULL argument'; + END IF; + RETURN NULL; +END$$; + +CREATE AGGREGATE balk(int4) +( + SFUNC = balkifnull(int8, int4), + STYPE = int8, + PARALLEL = SAFE, + INITCOND = '0' +); + +SELECT balk(hundred) FROM tenk1; + +ROLLBACK; + +-- Secondly test the case of a parallel aggregate combiner function +-- returning NULL. For that use normal transition function, but a +-- combiner function returning NULL. +BEGIN ISOLATION LEVEL REPEATABLE READ; +CREATE FUNCTION balkifnull(int8, int8) +RETURNS int8 +PARALLEL SAFE +STRICT +LANGUAGE plpgsql AS $$ +BEGIN + IF $1 IS NULL THEN + RAISE 'erroneously called with NULL argument'; + END IF; + RETURN NULL; +END$$; + +CREATE AGGREGATE balk(int4) +( + SFUNC = int4_sum(int8, int4), + STYPE = int8, + COMBINEFUNC = balkifnull(int8, int8), + PARALLEL = SAFE, + INITCOND = '0' +); + +-- force use of parallelism +ALTER TABLE tenk1 set (parallel_workers = 4); +SET LOCAL parallel_setup_cost=0; +SET LOCAL max_parallel_workers_per_gather=4; + +EXPLAIN (COSTS OFF) SELECT balk(hundred) FROM tenk1; +SELECT balk(hundred) FROM tenk1; + +ROLLBACK; + +-- test coverage for aggregate combine/serial/deserial functions +BEGIN ISOLATION LEVEL REPEATABLE READ; + +SET parallel_setup_cost = 0; +SET parallel_tuple_cost = 0; +SET min_parallel_table_scan_size = 0; +SET max_parallel_workers_per_gather = 4; +SET parallel_leader_participation = off; +SET enable_indexonlyscan = off; + +-- variance(int4) covers numeric_poly_combine +-- sum(int8) covers int8_avg_combine +-- regr_count(float8, float8) covers int8inc_float8_float8 and aggregates with > 1 arg +EXPLAIN (COSTS OFF, VERBOSE) +SELECT variance(unique1::int4), sum(unique1::int8), regr_count(unique1::float8, unique1::float8) +FROM (SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1) u; + +SELECT variance(unique1::int4), sum(unique1::int8), regr_count(unique1::float8, unique1::float8) +FROM (SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1) u; + +-- variance(int8) covers numeric_combine +-- avg(numeric) covers numeric_avg_combine +EXPLAIN (COSTS OFF, VERBOSE) +SELECT variance(unique1::int8), avg(unique1::numeric) +FROM (SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1) u; + +SELECT variance(unique1::int8), avg(unique1::numeric) +FROM (SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1 + UNION ALL SELECT * FROM tenk1) u; + +ROLLBACK; + +-- test coverage for dense_rank +SELECT dense_rank(x) WITHIN GROUP (ORDER BY x) FROM (VALUES (1),(1),(2),(2),(3),(3)) v(x) GROUP BY (x) ORDER BY 1; + + +-- Ensure that the STRICT checks for aggregates does not take NULLness +-- of ORDER BY columns into account. See bug report around +-- 2a505161-2727-2473-7c46-591ed108ac52@email.cz +SELECT min(x ORDER BY y) FROM (VALUES(1, NULL)) AS d(x,y); +SELECT min(x ORDER BY y) FROM (VALUES(1, 2)) AS d(x,y); + +-- check collation-sensitive matching between grouping expressions +select v||'a', case v||'a' when 'aa' then 1 else 0 end, count(*) + from unnest(array['a','b']) u(v) + group by v||'a' order by 1; +select v||'a', case when v||'a' = 'aa' then 1 else 0 end, count(*) + from unnest(array['a','b']) u(v) + group by v||'a' order by 1; + +-- Make sure that generation of HashAggregate for uniqification purposes +-- does not lead to array overflow due to unexpected duplicate hash keys +-- see CAFeeJoKKu0u+A_A9R9316djW-YW3-+Gtgvy3ju655qRHR3jtdA@mail.gmail.com +explain (costs off) + select 1 from tenk1 + where (hundred, thousand) in (select twothousand, twothousand from onek); + +-- +-- Hash Aggregation Spill tests +-- + +set enable_sort=false; +set work_mem='64kB'; + +select unique1, count(*), sum(twothousand) from tenk1 +group by unique1 +having sum(fivethous) > 4975 +order by sum(twothousand); + +set work_mem to default; +set enable_sort to default; + +-- +-- Compare results between plans using sorting and plans using hash +-- aggregation. Force spilling in both cases by setting work_mem low. +-- + +set work_mem='64kB'; + +create table agg_data_2k as +select g from generate_series(0, 1999) g; +analyze agg_data_2k; + +create table agg_data_20k as +select g from generate_series(0, 19999) g; +analyze agg_data_20k; + +-- Produce results with sorting. + +set enable_hashagg = false; + +set jit_above_cost = 0; + +explain (costs off) +select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3 + from agg_data_20k group by g%10000; + +create table agg_group_1 as +select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3 + from agg_data_20k group by g%10000; + +create table agg_group_2 as +select * from + (values (100), (300), (500)) as r(a), + lateral ( + select (g/2)::numeric as c1, + array_agg(g::numeric) as c2, + count(*) as c3 + from agg_data_2k + where g < r.a + group by g/2) as s; + +set jit_above_cost to default; + +create table agg_group_3 as +select (g/2)::numeric as c1, sum(7::int4) as c2, count(*) as c3 + from agg_data_2k group by g/2; + +create table agg_group_4 as +select (g/2)::numeric as c1, array_agg(g::numeric) as c2, count(*) as c3 + from agg_data_2k group by g/2; + +-- Produce results with hash aggregation + +set enable_hashagg = true; +set enable_sort = false; + +set jit_above_cost = 0; + +explain (costs off) +select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3 + from agg_data_20k group by g%10000; + +create table agg_hash_1 as +select g%10000 as c1, sum(g::numeric) as c2, count(*) as c3 + from agg_data_20k group by g%10000; + +create table agg_hash_2 as +select * from + (values (100), (300), (500)) as r(a), + lateral ( + select (g/2)::numeric as c1, + array_agg(g::numeric) as c2, + count(*) as c3 + from agg_data_2k + where g < r.a + group by g/2) as s; + +set jit_above_cost to default; + +create table agg_hash_3 as +select (g/2)::numeric as c1, sum(7::int4) as c2, count(*) as c3 + from agg_data_2k group by g/2; + +create table agg_hash_4 as +select (g/2)::numeric as c1, array_agg(g::numeric) as c2, count(*) as c3 + from agg_data_2k group by g/2; + +set enable_sort = true; +set work_mem to default; + +-- Compare group aggregation results to hash aggregation results + +(select * from agg_hash_1 except select * from agg_group_1) + union all +(select * from agg_group_1 except select * from agg_hash_1); + +(select * from agg_hash_2 except select * from agg_group_2) + union all +(select * from agg_group_2 except select * from agg_hash_2); + +(select * from agg_hash_3 except select * from agg_group_3) + union all +(select * from agg_group_3 except select * from agg_hash_3); + +(select * from agg_hash_4 except select * from agg_group_4) + union all +(select * from agg_group_4 except select * from agg_hash_4); + +drop table agg_group_1; +drop table agg_group_2; +drop table agg_group_3; +drop table agg_group_4; +drop table agg_hash_1; +drop table agg_hash_2; +drop table agg_hash_3; +drop table agg_hash_4; diff --git a/postgresql/examples/alter_generic.sql b/postgresql/examples/alter_generic.sql new file mode 100644 index 0000000..8c5d0e5 --- /dev/null +++ b/postgresql/examples/alter_generic.sql @@ -0,0 +1,605 @@ +-- +-- Test for ALTER some_object {RENAME TO, OWNER TO, SET SCHEMA} +-- + +-- Clean up in case a prior regression run failed +SET client_min_messages TO 'warning'; + +DROP ROLE IF EXISTS regress_alter_generic_user1; +DROP ROLE IF EXISTS regress_alter_generic_user2; +DROP ROLE IF EXISTS regress_alter_generic_user3; + +RESET client_min_messages; + +CREATE USER regress_alter_generic_user3; +CREATE USER regress_alter_generic_user2; +CREATE USER regress_alter_generic_user1 IN ROLE regress_alter_generic_user3; + +CREATE SCHEMA alt_nsp1; +CREATE SCHEMA alt_nsp2; + +GRANT ALL ON SCHEMA alt_nsp1, alt_nsp2 TO public; + +SET search_path = alt_nsp1, public; + +-- +-- Function and Aggregate +-- +SET SESSION AUTHORIZATION regress_alter_generic_user1; +CREATE FUNCTION alt_func1(int) RETURNS int LANGUAGE sql + AS 'SELECT $1 + 1'; +CREATE FUNCTION alt_func2(int) RETURNS int LANGUAGE sql + AS 'SELECT $1 - 1'; +CREATE AGGREGATE alt_agg1 ( + sfunc1 = int4pl, basetype = int4, stype1 = int4, initcond = 0 +); +CREATE AGGREGATE alt_agg2 ( + sfunc1 = int4mi, basetype = int4, stype1 = int4, initcond = 0 +); +ALTER AGGREGATE alt_func1(int) RENAME TO alt_func3; -- failed (not aggregate) +ALTER AGGREGATE alt_func1(int) OWNER TO regress_alter_generic_user3; -- failed (not aggregate) +ALTER AGGREGATE alt_func1(int) SET SCHEMA alt_nsp2; -- failed (not aggregate) + +ALTER FUNCTION alt_func1(int) RENAME TO alt_func2; -- failed (name conflict) +ALTER FUNCTION alt_func1(int) RENAME TO alt_func3; -- OK +ALTER FUNCTION alt_func2(int) OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER FUNCTION alt_func2(int) OWNER TO regress_alter_generic_user3; -- OK +ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp1; -- OK, already there +ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp2; -- OK + +ALTER AGGREGATE alt_agg1(int) RENAME TO alt_agg2; -- failed (name conflict) +ALTER AGGREGATE alt_agg1(int) RENAME TO alt_agg3; -- OK +ALTER AGGREGATE alt_agg2(int) OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER AGGREGATE alt_agg2(int) OWNER TO regress_alter_generic_user3; -- OK +ALTER AGGREGATE alt_agg2(int) SET SCHEMA alt_nsp2; -- OK + +SET SESSION AUTHORIZATION regress_alter_generic_user2; +CREATE FUNCTION alt_func1(int) RETURNS int LANGUAGE sql + AS 'SELECT $1 + 2'; +CREATE FUNCTION alt_func2(int) RETURNS int LANGUAGE sql + AS 'SELECT $1 - 2'; +CREATE AGGREGATE alt_agg1 ( + sfunc1 = int4pl, basetype = int4, stype1 = int4, initcond = 100 +); +CREATE AGGREGATE alt_agg2 ( + sfunc1 = int4mi, basetype = int4, stype1 = int4, initcond = -100 +); + +ALTER FUNCTION alt_func3(int) RENAME TO alt_func4; -- failed (not owner) +ALTER FUNCTION alt_func1(int) RENAME TO alt_func4; -- OK +ALTER FUNCTION alt_func3(int) OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER FUNCTION alt_func2(int) OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER FUNCTION alt_func3(int) SET SCHEMA alt_nsp2; -- failed (not owner) +ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp2; -- failed (name conflicts) + +ALTER AGGREGATE alt_agg3(int) RENAME TO alt_agg4; -- failed (not owner) +ALTER AGGREGATE alt_agg1(int) RENAME TO alt_agg4; -- OK +ALTER AGGREGATE alt_agg3(int) OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER AGGREGATE alt_agg2(int) OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER AGGREGATE alt_agg3(int) SET SCHEMA alt_nsp2; -- failed (not owner) +ALTER AGGREGATE alt_agg2(int) SET SCHEMA alt_nsp2; -- failed (name conflict) + +RESET SESSION AUTHORIZATION; + +SELECT n.nspname, proname, prorettype::regtype, prokind, a.rolname + FROM pg_proc p, pg_namespace n, pg_authid a + WHERE p.pronamespace = n.oid AND p.proowner = a.oid + AND n.nspname IN ('alt_nsp1', 'alt_nsp2') + ORDER BY nspname, proname; + +-- +-- We would test collations here, but it's not possible because the error +-- messages tend to be nonportable. +-- + +-- +-- Conversion +-- +SET SESSION AUTHORIZATION regress_alter_generic_user1; +CREATE CONVERSION alt_conv1 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; +CREATE CONVERSION alt_conv2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; + +ALTER CONVERSION alt_conv1 RENAME TO alt_conv2; -- failed (name conflict) +ALTER CONVERSION alt_conv1 RENAME TO alt_conv3; -- OK +ALTER CONVERSION alt_conv2 OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER CONVERSION alt_conv2 OWNER TO regress_alter_generic_user3; -- OK +ALTER CONVERSION alt_conv2 SET SCHEMA alt_nsp2; -- OK + +SET SESSION AUTHORIZATION regress_alter_generic_user2; +CREATE CONVERSION alt_conv1 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; +CREATE CONVERSION alt_conv2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; + +ALTER CONVERSION alt_conv3 RENAME TO alt_conv4; -- failed (not owner) +ALTER CONVERSION alt_conv1 RENAME TO alt_conv4; -- OK +ALTER CONVERSION alt_conv3 OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER CONVERSION alt_conv2 OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER CONVERSION alt_conv3 SET SCHEMA alt_nsp2; -- failed (not owner) +ALTER CONVERSION alt_conv2 SET SCHEMA alt_nsp2; -- failed (name conflict) + +RESET SESSION AUTHORIZATION; + +SELECT n.nspname, c.conname, a.rolname + FROM pg_conversion c, pg_namespace n, pg_authid a + WHERE c.connamespace = n.oid AND c.conowner = a.oid + AND n.nspname IN ('alt_nsp1', 'alt_nsp2') + ORDER BY nspname, conname; + +-- +-- Foreign Data Wrapper and Foreign Server +-- +CREATE FOREIGN DATA WRAPPER alt_fdw1; +CREATE FOREIGN DATA WRAPPER alt_fdw2; + +CREATE SERVER alt_fserv1 FOREIGN DATA WRAPPER alt_fdw1; +CREATE SERVER alt_fserv2 FOREIGN DATA WRAPPER alt_fdw2; + +ALTER FOREIGN DATA WRAPPER alt_fdw1 RENAME TO alt_fdw2; -- failed (name conflict) +ALTER FOREIGN DATA WRAPPER alt_fdw1 RENAME TO alt_fdw3; -- OK + +ALTER SERVER alt_fserv1 RENAME TO alt_fserv2; -- failed (name conflict) +ALTER SERVER alt_fserv1 RENAME TO alt_fserv3; -- OK + +SELECT fdwname FROM pg_foreign_data_wrapper WHERE fdwname like 'alt_fdw%'; +SELECT srvname FROM pg_foreign_server WHERE srvname like 'alt_fserv%'; + +-- +-- Procedural Language +-- +CREATE LANGUAGE alt_lang1 HANDLER plpgsql_call_handler; +CREATE LANGUAGE alt_lang2 HANDLER plpgsql_call_handler; + +ALTER LANGUAGE alt_lang1 OWNER TO regress_alter_generic_user1; -- OK +ALTER LANGUAGE alt_lang2 OWNER TO regress_alter_generic_user2; -- OK + +SET SESSION AUTHORIZATION regress_alter_generic_user1; +ALTER LANGUAGE alt_lang1 RENAME TO alt_lang2; -- failed (name conflict) +ALTER LANGUAGE alt_lang2 RENAME TO alt_lang3; -- failed (not owner) +ALTER LANGUAGE alt_lang1 RENAME TO alt_lang3; -- OK + +ALTER LANGUAGE alt_lang2 OWNER TO regress_alter_generic_user3; -- failed (not owner) +ALTER LANGUAGE alt_lang3 OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER LANGUAGE alt_lang3 OWNER TO regress_alter_generic_user3; -- OK + +RESET SESSION AUTHORIZATION; +SELECT lanname, a.rolname + FROM pg_language l, pg_authid a + WHERE l.lanowner = a.oid AND l.lanname like 'alt_lang%' + ORDER BY lanname; + +-- +-- Operator +-- +SET SESSION AUTHORIZATION regress_alter_generic_user1; + +CREATE OPERATOR @-@ ( leftarg = int4, rightarg = int4, procedure = int4mi ); +CREATE OPERATOR @+@ ( leftarg = int4, rightarg = int4, procedure = int4pl ); + +ALTER OPERATOR @+@(int4, int4) OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER OPERATOR @+@(int4, int4) OWNER TO regress_alter_generic_user3; -- OK +ALTER OPERATOR @-@(int4, int4) SET SCHEMA alt_nsp2; -- OK + +SET SESSION AUTHORIZATION regress_alter_generic_user2; + +CREATE OPERATOR @-@ ( leftarg = int4, rightarg = int4, procedure = int4mi ); + +ALTER OPERATOR @+@(int4, int4) OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER OPERATOR @-@(int4, int4) OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER OPERATOR @+@(int4, int4) SET SCHEMA alt_nsp2; -- failed (not owner) +-- can't test this: the error message includes the raw oid of namespace +-- ALTER OPERATOR @-@(int4, int4) SET SCHEMA alt_nsp2; -- failed (name conflict) + +RESET SESSION AUTHORIZATION; + +SELECT n.nspname, oprname, a.rolname, + oprleft::regtype, oprright::regtype, oprcode::regproc + FROM pg_operator o, pg_namespace n, pg_authid a + WHERE o.oprnamespace = n.oid AND o.oprowner = a.oid + AND n.nspname IN ('alt_nsp1', 'alt_nsp2') + ORDER BY nspname, oprname; + +-- +-- OpFamily and OpClass +-- +CREATE OPERATOR FAMILY alt_opf1 USING hash; +CREATE OPERATOR FAMILY alt_opf2 USING hash; +ALTER OPERATOR FAMILY alt_opf1 USING hash OWNER TO regress_alter_generic_user1; +ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user1; + +CREATE OPERATOR CLASS alt_opc1 FOR TYPE uuid USING hash AS STORAGE uuid; +CREATE OPERATOR CLASS alt_opc2 FOR TYPE uuid USING hash AS STORAGE uuid; +ALTER OPERATOR CLASS alt_opc1 USING hash OWNER TO regress_alter_generic_user1; +ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user1; + +SET SESSION AUTHORIZATION regress_alter_generic_user1; + +ALTER OPERATOR FAMILY alt_opf1 USING hash RENAME TO alt_opf2; -- failed (name conflict) +ALTER OPERATOR FAMILY alt_opf1 USING hash RENAME TO alt_opf3; -- OK +ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user3; -- OK +ALTER OPERATOR FAMILY alt_opf2 USING hash SET SCHEMA alt_nsp2; -- OK + +ALTER OPERATOR CLASS alt_opc1 USING hash RENAME TO alt_opc2; -- failed (name conflict) +ALTER OPERATOR CLASS alt_opc1 USING hash RENAME TO alt_opc3; -- OK +ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user3; -- OK +ALTER OPERATOR CLASS alt_opc2 USING hash SET SCHEMA alt_nsp2; -- OK + +RESET SESSION AUTHORIZATION; + +CREATE OPERATOR FAMILY alt_opf1 USING hash; +CREATE OPERATOR FAMILY alt_opf2 USING hash; +ALTER OPERATOR FAMILY alt_opf1 USING hash OWNER TO regress_alter_generic_user2; +ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user2; + +CREATE OPERATOR CLASS alt_opc1 FOR TYPE macaddr USING hash AS STORAGE macaddr; +CREATE OPERATOR CLASS alt_opc2 FOR TYPE macaddr USING hash AS STORAGE macaddr; +ALTER OPERATOR CLASS alt_opc1 USING hash OWNER TO regress_alter_generic_user2; +ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user2; + +SET SESSION AUTHORIZATION regress_alter_generic_user2; + +ALTER OPERATOR FAMILY alt_opf3 USING hash RENAME TO alt_opf4; -- failed (not owner) +ALTER OPERATOR FAMILY alt_opf1 USING hash RENAME TO alt_opf4; -- OK +ALTER OPERATOR FAMILY alt_opf3 USING hash OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER OPERATOR FAMILY alt_opf2 USING hash OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER OPERATOR FAMILY alt_opf3 USING hash SET SCHEMA alt_nsp2; -- failed (not owner) +ALTER OPERATOR FAMILY alt_opf2 USING hash SET SCHEMA alt_nsp2; -- failed (name conflict) + +ALTER OPERATOR CLASS alt_opc3 USING hash RENAME TO alt_opc4; -- failed (not owner) +ALTER OPERATOR CLASS alt_opc1 USING hash RENAME TO alt_opc4; -- OK +ALTER OPERATOR CLASS alt_opc3 USING hash OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER OPERATOR CLASS alt_opc2 USING hash OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER OPERATOR CLASS alt_opc3 USING hash SET SCHEMA alt_nsp2; -- failed (not owner) +ALTER OPERATOR CLASS alt_opc2 USING hash SET SCHEMA alt_nsp2; -- failed (name conflict) + +RESET SESSION AUTHORIZATION; + +SELECT nspname, opfname, amname, rolname + FROM pg_opfamily o, pg_am m, pg_namespace n, pg_authid a + WHERE o.opfmethod = m.oid AND o.opfnamespace = n.oid AND o.opfowner = a.oid + AND n.nspname IN ('alt_nsp1', 'alt_nsp2') + AND NOT opfname LIKE 'alt_opc%' + ORDER BY nspname, opfname; + +SELECT nspname, opcname, amname, rolname + FROM pg_opclass o, pg_am m, pg_namespace n, pg_authid a + WHERE o.opcmethod = m.oid AND o.opcnamespace = n.oid AND o.opcowner = a.oid + AND n.nspname IN ('alt_nsp1', 'alt_nsp2') + ORDER BY nspname, opcname; + +-- ALTER OPERATOR FAMILY ... ADD/DROP + +-- Should work. Textbook case of CREATE / ALTER ADD / ALTER DROP / DROP +BEGIN TRANSACTION; +CREATE OPERATOR FAMILY alt_opf4 USING btree; +ALTER OPERATOR FAMILY alt_opf4 USING btree ADD + -- int4 vs int2 + OPERATOR 1 < (int4, int2) , + OPERATOR 2 <= (int4, int2) , + OPERATOR 3 = (int4, int2) , + OPERATOR 4 >= (int4, int2) , + OPERATOR 5 > (int4, int2) , + FUNCTION 1 btint42cmp(int4, int2); + +ALTER OPERATOR FAMILY alt_opf4 USING btree DROP + -- int4 vs int2 + OPERATOR 1 (int4, int2) , + OPERATOR 2 (int4, int2) , + OPERATOR 3 (int4, int2) , + OPERATOR 4 (int4, int2) , + OPERATOR 5 (int4, int2) , + FUNCTION 1 (int4, int2) ; +DROP OPERATOR FAMILY alt_opf4 USING btree; +ROLLBACK; + +-- Should fail. Invalid values for ALTER OPERATOR FAMILY .. ADD / DROP +CREATE OPERATOR FAMILY alt_opf4 USING btree; +ALTER OPERATOR FAMILY alt_opf4 USING invalid_index_method ADD OPERATOR 1 < (int4, int2); -- invalid indexing_method +ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 6 < (int4, int2); -- operator number should be between 1 and 5 +ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 0 < (int4, int2); -- operator number should be between 1 and 5 +ALTER OPERATOR FAMILY alt_opf4 USING btree ADD OPERATOR 1 < ; -- operator without argument types +ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 0 btint42cmp(int4, int2); -- invalid options parsing function +ALTER OPERATOR FAMILY alt_opf4 USING btree ADD FUNCTION 6 btint42cmp(int4, int2); -- function number should be between 1 and 5 +ALTER OPERATOR FAMILY alt_opf4 USING btree ADD STORAGE invalid_storage; -- Ensure STORAGE is not a part of ALTER OPERATOR FAMILY +DROP OPERATOR FAMILY alt_opf4 USING btree; + +-- Should fail. Need to be SUPERUSER to do ALTER OPERATOR FAMILY .. ADD / DROP +BEGIN TRANSACTION; +CREATE ROLE regress_alter_generic_user5 NOSUPERUSER; +CREATE OPERATOR FAMILY alt_opf5 USING btree; +SET ROLE regress_alter_generic_user5; +ALTER OPERATOR FAMILY alt_opf5 USING btree ADD OPERATOR 1 < (int4, int2), FUNCTION 1 btint42cmp(int4, int2); +RESET ROLE; +DROP OPERATOR FAMILY alt_opf5 USING btree; +ROLLBACK; + +-- Should fail. Need rights to namespace for ALTER OPERATOR FAMILY .. ADD / DROP +BEGIN TRANSACTION; +CREATE ROLE regress_alter_generic_user6; +CREATE SCHEMA alt_nsp6; +REVOKE ALL ON SCHEMA alt_nsp6 FROM regress_alter_generic_user6; +CREATE OPERATOR FAMILY alt_nsp6.alt_opf6 USING btree; +SET ROLE regress_alter_generic_user6; +ALTER OPERATOR FAMILY alt_nsp6.alt_opf6 USING btree ADD OPERATOR 1 < (int4, int2); +ROLLBACK; + +-- Should fail. Only two arguments required for ALTER OPERATOR FAMILY ... DROP OPERATOR +CREATE OPERATOR FAMILY alt_opf7 USING btree; +ALTER OPERATOR FAMILY alt_opf7 USING btree ADD OPERATOR 1 < (int4, int2); +ALTER OPERATOR FAMILY alt_opf7 USING btree DROP OPERATOR 1 (int4, int2, int8); +DROP OPERATOR FAMILY alt_opf7 USING btree; + +-- Should work. During ALTER OPERATOR FAMILY ... DROP OPERATOR +-- when left type is the same as right type, a DROP with only one argument type should work +CREATE OPERATOR FAMILY alt_opf8 USING btree; +ALTER OPERATOR FAMILY alt_opf8 USING btree ADD OPERATOR 1 < (int4, int4); +DROP OPERATOR FAMILY alt_opf8 USING btree; + +-- Should work. Textbook case of ALTER OPERATOR FAMILY ... ADD OPERATOR with FOR ORDER BY +CREATE OPERATOR FAMILY alt_opf9 USING gist; +ALTER OPERATOR FAMILY alt_opf9 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops; +DROP OPERATOR FAMILY alt_opf9 USING gist; + +-- Should fail. Ensure correct ordering methods in ALTER OPERATOR FAMILY ... ADD OPERATOR .. FOR ORDER BY +CREATE OPERATOR FAMILY alt_opf10 USING btree; +ALTER OPERATOR FAMILY alt_opf10 USING btree ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops; +DROP OPERATOR FAMILY alt_opf10 USING btree; + +-- Should work. Textbook case of ALTER OPERATOR FAMILY ... ADD OPERATOR with FOR ORDER BY +CREATE OPERATOR FAMILY alt_opf11 USING gist; +ALTER OPERATOR FAMILY alt_opf11 USING gist ADD OPERATOR 1 < (int4, int4) FOR ORDER BY float_ops; +ALTER OPERATOR FAMILY alt_opf11 USING gist DROP OPERATOR 1 (int4, int4); +DROP OPERATOR FAMILY alt_opf11 USING gist; + +-- Should fail. btree comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION +BEGIN TRANSACTION; +CREATE OPERATOR FAMILY alt_opf12 USING btree; +CREATE FUNCTION fn_opf12 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL; +ALTER OPERATOR FAMILY alt_opf12 USING btree ADD FUNCTION 1 fn_opf12(int4, int2); +DROP OPERATOR FAMILY alt_opf12 USING btree; +ROLLBACK; + +-- Should fail. hash comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION +BEGIN TRANSACTION; +CREATE OPERATOR FAMILY alt_opf13 USING hash; +CREATE FUNCTION fn_opf13 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL; +ALTER OPERATOR FAMILY alt_opf13 USING hash ADD FUNCTION 1 fn_opf13(int4); +DROP OPERATOR FAMILY alt_opf13 USING hash; +ROLLBACK; + +-- Should fail. btree comparison functions should have two arguments in ALTER OPERATOR FAMILY ... ADD FUNCTION +BEGIN TRANSACTION; +CREATE OPERATOR FAMILY alt_opf14 USING btree; +CREATE FUNCTION fn_opf14 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL; +ALTER OPERATOR FAMILY alt_opf14 USING btree ADD FUNCTION 1 fn_opf14(int4); +DROP OPERATOR FAMILY alt_opf14 USING btree; +ROLLBACK; + +-- Should fail. hash comparison functions should have one argument in ALTER OPERATOR FAMILY ... ADD FUNCTION +BEGIN TRANSACTION; +CREATE OPERATOR FAMILY alt_opf15 USING hash; +CREATE FUNCTION fn_opf15 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAGE SQL; +ALTER OPERATOR FAMILY alt_opf15 USING hash ADD FUNCTION 1 fn_opf15(int4, int2); +DROP OPERATOR FAMILY alt_opf15 USING hash; +ROLLBACK; + +-- Should fail. In gist throw an error when giving different data types for function argument +-- without defining left / right type in ALTER OPERATOR FAMILY ... ADD FUNCTION +CREATE OPERATOR FAMILY alt_opf16 USING gist; +ALTER OPERATOR FAMILY alt_opf16 USING gist ADD FUNCTION 1 btint42cmp(int4, int2); +DROP OPERATOR FAMILY alt_opf16 USING gist; + +-- Should fail. duplicate operator number / function number in ALTER OPERATOR FAMILY ... ADD FUNCTION +CREATE OPERATOR FAMILY alt_opf17 USING btree; +ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4), OPERATOR 1 < (int4, int4); -- operator # appears twice in same statement +ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4); -- operator 1 requested first-time +ALTER OPERATOR FAMILY alt_opf17 USING btree ADD OPERATOR 1 < (int4, int4); -- operator 1 requested again in separate statement +ALTER OPERATOR FAMILY alt_opf17 USING btree ADD + OPERATOR 1 < (int4, int2) , + OPERATOR 2 <= (int4, int2) , + OPERATOR 3 = (int4, int2) , + OPERATOR 4 >= (int4, int2) , + OPERATOR 5 > (int4, int2) , + FUNCTION 1 btint42cmp(int4, int2) , + FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears twice in same statement +ALTER OPERATOR FAMILY alt_opf17 USING btree ADD + OPERATOR 1 < (int4, int2) , + OPERATOR 2 <= (int4, int2) , + OPERATOR 3 = (int4, int2) , + OPERATOR 4 >= (int4, int2) , + OPERATOR 5 > (int4, int2) , + FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 appears first time +ALTER OPERATOR FAMILY alt_opf17 USING btree ADD + OPERATOR 1 < (int4, int2) , + OPERATOR 2 <= (int4, int2) , + OPERATOR 3 = (int4, int2) , + OPERATOR 4 >= (int4, int2) , + OPERATOR 5 > (int4, int2) , + FUNCTION 1 btint42cmp(int4, int2); -- procedure 1 requested again in separate statement +DROP OPERATOR FAMILY alt_opf17 USING btree; + + +-- Should fail. Ensure that DROP requests for missing OPERATOR / FUNCTIONS +-- return appropriate message in ALTER OPERATOR FAMILY ... DROP OPERATOR / FUNCTION +CREATE OPERATOR FAMILY alt_opf18 USING btree; +ALTER OPERATOR FAMILY alt_opf18 USING btree DROP OPERATOR 1 (int4, int4); +ALTER OPERATOR FAMILY alt_opf18 USING btree ADD + OPERATOR 1 < (int4, int2) , + OPERATOR 2 <= (int4, int2) , + OPERATOR 3 = (int4, int2) , + OPERATOR 4 >= (int4, int2) , + OPERATOR 5 > (int4, int2) , + FUNCTION 1 btint42cmp(int4, int2); +-- Should fail. Not allowed to have cross-type equalimage function. +ALTER OPERATOR FAMILY alt_opf18 USING btree + ADD FUNCTION 4 (int4, int2) btequalimage(oid); +ALTER OPERATOR FAMILY alt_opf18 USING btree DROP FUNCTION 2 (int4, int4); +DROP OPERATOR FAMILY alt_opf18 USING btree; + +-- Should fail. Invalid opclass options function (#5) specifications. +CREATE OPERATOR FAMILY alt_opf19 USING btree; +ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 test_opclass_options_func(internal, text[], bool); +ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) btint42cmp(int4, int2); +ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4, int2) btint42cmp(int4, int2); +ALTER OPERATOR FAMILY alt_opf19 USING btree ADD FUNCTION 5 (int4) test_opclass_options_func(internal); -- Ok +ALTER OPERATOR FAMILY alt_opf19 USING btree DROP FUNCTION 5 (int4, int4); +DROP OPERATOR FAMILY alt_opf19 USING btree; + +-- +-- Statistics +-- +SET SESSION AUTHORIZATION regress_alter_generic_user1; +CREATE TABLE alt_regress_1 (a INTEGER, b INTEGER); +CREATE STATISTICS alt_stat1 ON a, b FROM alt_regress_1; +CREATE STATISTICS alt_stat2 ON a, b FROM alt_regress_1; + +ALTER STATISTICS alt_stat1 RENAME TO alt_stat2; -- failed (name conflict) +ALTER STATISTICS alt_stat1 RENAME TO alt_stat3; -- OK +ALTER STATISTICS alt_stat2 OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER STATISTICS alt_stat2 OWNER TO regress_alter_generic_user3; -- OK +ALTER STATISTICS alt_stat2 SET SCHEMA alt_nsp2; -- OK + +SET SESSION AUTHORIZATION regress_alter_generic_user2; +CREATE TABLE alt_regress_2 (a INTEGER, b INTEGER); +CREATE STATISTICS alt_stat1 ON a, b FROM alt_regress_2; +CREATE STATISTICS alt_stat2 ON a, b FROM alt_regress_2; + +ALTER STATISTICS alt_stat3 RENAME TO alt_stat4; -- failed (not owner) +ALTER STATISTICS alt_stat1 RENAME TO alt_stat4; -- OK +ALTER STATISTICS alt_stat3 OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER STATISTICS alt_stat2 OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER STATISTICS alt_stat3 SET SCHEMA alt_nsp2; -- failed (not owner) +ALTER STATISTICS alt_stat2 SET SCHEMA alt_nsp2; -- failed (name conflict) + +RESET SESSION AUTHORIZATION; +SELECT nspname, stxname, rolname + FROM pg_statistic_ext s, pg_namespace n, pg_authid a + WHERE s.stxnamespace = n.oid AND s.stxowner = a.oid + AND n.nspname in ('alt_nsp1', 'alt_nsp2') + ORDER BY nspname, stxname; + +-- +-- Text Search Dictionary +-- +SET SESSION AUTHORIZATION regress_alter_generic_user1; +CREATE TEXT SEARCH DICTIONARY alt_ts_dict1 (template=simple); +CREATE TEXT SEARCH DICTIONARY alt_ts_dict2 (template=simple); + +ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 RENAME TO alt_ts_dict2; -- failed (name conflict) +ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 RENAME TO alt_ts_dict3; -- OK +ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 OWNER TO regress_alter_generic_user3; -- OK +ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 SET SCHEMA alt_nsp2; -- OK + +SET SESSION AUTHORIZATION regress_alter_generic_user2; +CREATE TEXT SEARCH DICTIONARY alt_ts_dict1 (template=simple); +CREATE TEXT SEARCH DICTIONARY alt_ts_dict2 (template=simple); + +ALTER TEXT SEARCH DICTIONARY alt_ts_dict3 RENAME TO alt_ts_dict4; -- failed (not owner) +ALTER TEXT SEARCH DICTIONARY alt_ts_dict1 RENAME TO alt_ts_dict4; -- OK +ALTER TEXT SEARCH DICTIONARY alt_ts_dict3 OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER TEXT SEARCH DICTIONARY alt_ts_dict3 SET SCHEMA alt_nsp2; -- failed (not owner) +ALTER TEXT SEARCH DICTIONARY alt_ts_dict2 SET SCHEMA alt_nsp2; -- failed (name conflict) + +RESET SESSION AUTHORIZATION; + +SELECT nspname, dictname, rolname + FROM pg_ts_dict t, pg_namespace n, pg_authid a + WHERE t.dictnamespace = n.oid AND t.dictowner = a.oid + AND n.nspname in ('alt_nsp1', 'alt_nsp2') + ORDER BY nspname, dictname; + +-- +-- Text Search Configuration +-- +SET SESSION AUTHORIZATION regress_alter_generic_user1; +CREATE TEXT SEARCH CONFIGURATION alt_ts_conf1 (copy=english); +CREATE TEXT SEARCH CONFIGURATION alt_ts_conf2 (copy=english); + +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 RENAME TO alt_ts_conf2; -- failed (name conflict) +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 RENAME TO alt_ts_conf3; -- OK +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 OWNER TO regress_alter_generic_user2; -- failed (no role membership) +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 OWNER TO regress_alter_generic_user3; -- OK +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 SET SCHEMA alt_nsp2; -- OK + +SET SESSION AUTHORIZATION regress_alter_generic_user2; +CREATE TEXT SEARCH CONFIGURATION alt_ts_conf1 (copy=english); +CREATE TEXT SEARCH CONFIGURATION alt_ts_conf2 (copy=english); + +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf3 RENAME TO alt_ts_conf4; -- failed (not owner) +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf1 RENAME TO alt_ts_conf4; -- OK +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf3 OWNER TO regress_alter_generic_user2; -- failed (not owner) +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 OWNER TO regress_alter_generic_user3; -- failed (no role membership) +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf3 SET SCHEMA alt_nsp2; -- failed (not owner) +ALTER TEXT SEARCH CONFIGURATION alt_ts_conf2 SET SCHEMA alt_nsp2; -- failed (name conflict) + +RESET SESSION AUTHORIZATION; + +SELECT nspname, cfgname, rolname + FROM pg_ts_config t, pg_namespace n, pg_authid a + WHERE t.cfgnamespace = n.oid AND t.cfgowner = a.oid + AND n.nspname in ('alt_nsp1', 'alt_nsp2') + ORDER BY nspname, cfgname; + +-- +-- Text Search Template +-- +CREATE TEXT SEARCH TEMPLATE alt_ts_temp1 (lexize=dsimple_lexize); +CREATE TEXT SEARCH TEMPLATE alt_ts_temp2 (lexize=dsimple_lexize); + +ALTER TEXT SEARCH TEMPLATE alt_ts_temp1 RENAME TO alt_ts_temp2; -- failed (name conflict) +ALTER TEXT SEARCH TEMPLATE alt_ts_temp1 RENAME TO alt_ts_temp3; -- OK +ALTER TEXT SEARCH TEMPLATE alt_ts_temp2 SET SCHEMA alt_nsp2; -- OK + +CREATE TEXT SEARCH TEMPLATE alt_ts_temp2 (lexize=dsimple_lexize); +ALTER TEXT SEARCH TEMPLATE alt_ts_temp2 SET SCHEMA alt_nsp2; -- failed (name conflict) + +-- invalid: non-lowercase quoted identifiers +CREATE TEXT SEARCH TEMPLATE tstemp_case ("Init" = init_function); + +SELECT nspname, tmplname + FROM pg_ts_template t, pg_namespace n + WHERE t.tmplnamespace = n.oid AND nspname like 'alt_nsp%' + ORDER BY nspname, tmplname; + +-- +-- Text Search Parser +-- + +CREATE TEXT SEARCH PARSER alt_ts_prs1 + (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype); +CREATE TEXT SEARCH PARSER alt_ts_prs2 + (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype); + +ALTER TEXT SEARCH PARSER alt_ts_prs1 RENAME TO alt_ts_prs2; -- failed (name conflict) +ALTER TEXT SEARCH PARSER alt_ts_prs1 RENAME TO alt_ts_prs3; -- OK +ALTER TEXT SEARCH PARSER alt_ts_prs2 SET SCHEMA alt_nsp2; -- OK + +CREATE TEXT SEARCH PARSER alt_ts_prs2 + (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype); +ALTER TEXT SEARCH PARSER alt_ts_prs2 SET SCHEMA alt_nsp2; -- failed (name conflict) + +-- invalid: non-lowercase quoted identifiers +CREATE TEXT SEARCH PARSER tspars_case ("Start" = start_function); + +SELECT nspname, prsname + FROM pg_ts_parser t, pg_namespace n + WHERE t.prsnamespace = n.oid AND nspname like 'alt_nsp%' + ORDER BY nspname, prsname; + +--- +--- Cleanup resources +--- +DROP FOREIGN DATA WRAPPER alt_fdw2 CASCADE; +DROP FOREIGN DATA WRAPPER alt_fdw3 CASCADE; + +DROP LANGUAGE alt_lang2 CASCADE; +DROP LANGUAGE alt_lang3 CASCADE; + +DROP SCHEMA alt_nsp1 CASCADE; +DROP SCHEMA alt_nsp2 CASCADE; + +DROP USER regress_alter_generic_user1; +DROP USER regress_alter_generic_user2; +DROP USER regress_alter_generic_user3; diff --git a/postgresql/examples/alter_operator.sql b/postgresql/examples/alter_operator.sql new file mode 100644 index 0000000..fd40370 --- /dev/null +++ b/postgresql/examples/alter_operator.sql @@ -0,0 +1,100 @@ +CREATE FUNCTION alter_op_test_fn(boolean, boolean) +RETURNS boolean AS $$ SELECT NULL::BOOLEAN; $$ LANGUAGE sql IMMUTABLE; + +CREATE FUNCTION customcontsel(internal, oid, internal, integer) +RETURNS float8 AS 'contsel' LANGUAGE internal STABLE STRICT; + +CREATE OPERATOR === ( + LEFTARG = boolean, + RIGHTARG = boolean, + PROCEDURE = alter_op_test_fn, + COMMUTATOR = ===, + NEGATOR = !==, + RESTRICT = customcontsel, + JOIN = contjoinsel, + HASHES, MERGES +); + +SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype +FROM pg_depend +WHERE classid = 'pg_operator'::regclass AND + objid = '===(bool,bool)'::regoperator +ORDER BY 1; + +-- +-- Reset and set params +-- + +ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = NONE); +ALTER OPERATOR === (boolean, boolean) SET (JOIN = NONE); + +SELECT oprrest, oprjoin FROM pg_operator WHERE oprname = '===' + AND oprleft = 'boolean'::regtype AND oprright = 'boolean'::regtype; + +SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype +FROM pg_depend +WHERE classid = 'pg_operator'::regclass AND + objid = '===(bool,bool)'::regoperator +ORDER BY 1; + +ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = contsel); +ALTER OPERATOR === (boolean, boolean) SET (JOIN = contjoinsel); + +SELECT oprrest, oprjoin FROM pg_operator WHERE oprname = '===' + AND oprleft = 'boolean'::regtype AND oprright = 'boolean'::regtype; + +SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype +FROM pg_depend +WHERE classid = 'pg_operator'::regclass AND + objid = '===(bool,bool)'::regoperator +ORDER BY 1; + +ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = NONE, JOIN = NONE); + +SELECT oprrest, oprjoin FROM pg_operator WHERE oprname = '===' + AND oprleft = 'boolean'::regtype AND oprright = 'boolean'::regtype; + +SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype +FROM pg_depend +WHERE classid = 'pg_operator'::regclass AND + objid = '===(bool,bool)'::regoperator +ORDER BY 1; + +ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = customcontsel, JOIN = contjoinsel); + +SELECT oprrest, oprjoin FROM pg_operator WHERE oprname = '===' + AND oprleft = 'boolean'::regtype AND oprright = 'boolean'::regtype; + +SELECT pg_describe_object(refclassid,refobjid,refobjsubid) as ref, deptype +FROM pg_depend +WHERE classid = 'pg_operator'::regclass AND + objid = '===(bool,bool)'::regoperator +ORDER BY 1; + +-- +-- Test invalid options. +-- +ALTER OPERATOR === (boolean, boolean) SET (COMMUTATOR = ====); +ALTER OPERATOR === (boolean, boolean) SET (NEGATOR = ====); +ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = non_existent_func); +ALTER OPERATOR === (boolean, boolean) SET (JOIN = non_existent_func); +ALTER OPERATOR === (boolean, boolean) SET (COMMUTATOR = !==); +ALTER OPERATOR === (boolean, boolean) SET (NEGATOR = !==); + +-- invalid: non-lowercase quoted identifiers +ALTER OPERATOR & (bit, bit) SET ("Restrict" = _int_contsel, "Join" = _int_contjoinsel); + +-- +-- Test permission check. Must be owner to ALTER OPERATOR. +-- +CREATE USER regress_alter_op_user; +SET SESSION AUTHORIZATION regress_alter_op_user; + +ALTER OPERATOR === (boolean, boolean) SET (RESTRICT = NONE); + +-- Clean up +RESET SESSION AUTHORIZATION; +DROP USER regress_alter_op_user; +DROP OPERATOR === (boolean, boolean); +DROP FUNCTION customcontsel(internal, oid, internal, integer); +DROP FUNCTION alter_op_test_fn(boolean, boolean); diff --git a/postgresql/examples/alter_table.sql b/postgresql/examples/alter_table.sql new file mode 100644 index 0000000..717aa1c --- /dev/null +++ b/postgresql/examples/alter_table.sql @@ -0,0 +1,2917 @@ +-- +-- ALTER_TABLE +-- + +-- Clean up in case a prior regression run failed +SET client_min_messages TO 'warning'; +DROP ROLE IF EXISTS regress_alter_table_user1; +RESET client_min_messages; + +CREATE USER regress_alter_table_user1; + +-- +-- add attribute +-- + +CREATE TABLE attmp (initial int4); + +COMMENT ON TABLE attmp_wrong IS 'table comment'; +COMMENT ON TABLE attmp IS 'table comment'; +COMMENT ON TABLE attmp IS NULL; + +ALTER TABLE attmp ADD COLUMN xmin integer; -- fails + +ALTER TABLE attmp ADD COLUMN a int4 default 3; + +ALTER TABLE attmp ADD COLUMN b name; + +ALTER TABLE attmp ADD COLUMN c text; + +ALTER TABLE attmp ADD COLUMN d float8; + +ALTER TABLE attmp ADD COLUMN e float4; + +ALTER TABLE attmp ADD COLUMN f int2; + +ALTER TABLE attmp ADD COLUMN g polygon; + +ALTER TABLE attmp ADD COLUMN i char; + +ALTER TABLE attmp ADD COLUMN k int4; + +ALTER TABLE attmp ADD COLUMN l tid; + +ALTER TABLE attmp ADD COLUMN m xid; + +ALTER TABLE attmp ADD COLUMN n oidvector; + +--ALTER TABLE attmp ADD COLUMN o lock; +ALTER TABLE attmp ADD COLUMN p boolean; + +ALTER TABLE attmp ADD COLUMN q point; + +ALTER TABLE attmp ADD COLUMN r lseg; + +ALTER TABLE attmp ADD COLUMN s path; + +ALTER TABLE attmp ADD COLUMN t box; + +ALTER TABLE attmp ADD COLUMN v timestamp; + +ALTER TABLE attmp ADD COLUMN w interval; + +ALTER TABLE attmp ADD COLUMN x float8[]; + +ALTER TABLE attmp ADD COLUMN y float4[]; + +ALTER TABLE attmp ADD COLUMN z int2[]; + +INSERT INTO attmp (a, b, c, d, e, f, g, i, k, l, m, n, p, q, r, s, t, + v, w, x, y, z) + VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)', + 'c', + 314159, '(1,1)', '512', + '1 2 3 4 5 6 7 8', true, '(1.1,1.1)', '(4.1,4.1,3.1,3.1)', + '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', + 'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}'); + +SELECT * FROM attmp; + +DROP TABLE attmp; + +-- the wolf bug - schema mods caused inconsistent row descriptors +CREATE TABLE attmp ( + initial int4 +); + +ALTER TABLE attmp ADD COLUMN a int4; + +ALTER TABLE attmp ADD COLUMN b name; + +ALTER TABLE attmp ADD COLUMN c text; + +ALTER TABLE attmp ADD COLUMN d float8; + +ALTER TABLE attmp ADD COLUMN e float4; + +ALTER TABLE attmp ADD COLUMN f int2; + +ALTER TABLE attmp ADD COLUMN g polygon; + +ALTER TABLE attmp ADD COLUMN i char; + +ALTER TABLE attmp ADD COLUMN k int4; + +ALTER TABLE attmp ADD COLUMN l tid; + +ALTER TABLE attmp ADD COLUMN m xid; + +ALTER TABLE attmp ADD COLUMN n oidvector; + +--ALTER TABLE attmp ADD COLUMN o lock; +ALTER TABLE attmp ADD COLUMN p boolean; + +ALTER TABLE attmp ADD COLUMN q point; + +ALTER TABLE attmp ADD COLUMN r lseg; + +ALTER TABLE attmp ADD COLUMN s path; + +ALTER TABLE attmp ADD COLUMN t box; + +ALTER TABLE attmp ADD COLUMN v timestamp; + +ALTER TABLE attmp ADD COLUMN w interval; + +ALTER TABLE attmp ADD COLUMN x float8[]; + +ALTER TABLE attmp ADD COLUMN y float4[]; + +ALTER TABLE attmp ADD COLUMN z int2[]; + +INSERT INTO attmp (a, b, c, d, e, f, g, i, k, l, m, n, p, q, r, s, t, + v, w, x, y, z) + VALUES (4, 'name', 'text', 4.1, 4.1, 2, '(4.1,4.1,3.1,3.1)', + 'c', + 314159, '(1,1)', '512', + '1 2 3 4 5 6 7 8', true, '(1.1,1.1)', '(4.1,4.1,3.1,3.1)', + '(0,2,4.1,4.1,3.1,3.1)', '(4.1,4.1,3.1,3.1)', + 'epoch', '01:00:10', '{1.0,2.0,3.0,4.0}', '{1.0,2.0,3.0,4.0}', '{1,2,3,4}'); + +SELECT * FROM attmp; + +CREATE INDEX attmp_idx ON attmp (a, (d + e), b); + +ALTER INDEX attmp_idx ALTER COLUMN 0 SET STATISTICS 1000; + +ALTER INDEX attmp_idx ALTER COLUMN 1 SET STATISTICS 1000; + +ALTER INDEX attmp_idx ALTER COLUMN 2 SET STATISTICS 1000; + +--\d+ attmp_idx + +ALTER INDEX attmp_idx ALTER COLUMN 3 SET STATISTICS 1000; + +ALTER INDEX attmp_idx ALTER COLUMN 4 SET STATISTICS 1000; + +ALTER INDEX attmp_idx ALTER COLUMN 2 SET STATISTICS -1; + +DROP TABLE attmp; + + +-- +-- rename - check on both non-temp and temp tables +-- +CREATE TABLE attmp (regtable int); +CREATE TEMP TABLE attmp (attmptable int); + +ALTER TABLE attmp RENAME TO attmp_new; + +SELECT * FROM attmp; +SELECT * FROM attmp_new; + +ALTER TABLE attmp RENAME TO attmp_new2; + +SELECT * FROM attmp; -- should fail +SELECT * FROM attmp_new; +SELECT * FROM attmp_new2; + +DROP TABLE attmp_new; +DROP TABLE attmp_new2; + +-- check rename of partitioned tables and indexes also +CREATE TABLE part_attmp (a int primary key) partition by range (a); +CREATE TABLE part_attmp1 PARTITION OF part_attmp FOR VALUES FROM (0) TO (100); +ALTER INDEX part_attmp_pkey RENAME TO part_attmp_index; +ALTER INDEX part_attmp1_pkey RENAME TO part_attmp1_index; +ALTER TABLE part_attmp RENAME TO part_at2tmp; +ALTER TABLE part_attmp1 RENAME TO part_at2tmp1; +SET ROLE regress_alter_table_user1; +ALTER INDEX part_attmp_index RENAME TO fail; +ALTER INDEX part_attmp1_index RENAME TO fail; +ALTER TABLE part_at2tmp RENAME TO fail; +ALTER TABLE part_at2tmp1 RENAME TO fail; +RESET ROLE; +DROP TABLE part_at2tmp; + +-- +-- check renaming to a table's array type's autogenerated name +-- (the array type's name should get out of the way) +-- +CREATE TABLE attmp_array (id int); +CREATE TABLE attmp_array2 (id int); +SELECT typname FROM pg_type WHERE oid = 'attmp_array[]'::regtype; +SELECT typname FROM pg_type WHERE oid = 'attmp_array2[]'::regtype; +ALTER TABLE attmp_array2 RENAME TO _attmp_array; +SELECT typname FROM pg_type WHERE oid = 'attmp_array[]'::regtype; +SELECT typname FROM pg_type WHERE oid = '_attmp_array[]'::regtype; +DROP TABLE _attmp_array; +DROP TABLE attmp_array; + +-- renaming to table's own array type's name is an interesting corner case +CREATE TABLE attmp_array (id int); +SELECT typname FROM pg_type WHERE oid = 'attmp_array[]'::regtype; +ALTER TABLE attmp_array RENAME TO _attmp_array; +SELECT typname FROM pg_type WHERE oid = '_attmp_array[]'::regtype; +DROP TABLE _attmp_array; + +-- ALTER TABLE ... RENAME on non-table relations +-- renaming indexes (FIXME: this should probably test the index's functionality) +ALTER INDEX IF EXISTS __onek_unique1 RENAME TO attmp_onek_unique1; +ALTER INDEX IF EXISTS __attmp_onek_unique1 RENAME TO onek_unique1; + +ALTER INDEX onek_unique1 RENAME TO attmp_onek_unique1; +ALTER INDEX attmp_onek_unique1 RENAME TO onek_unique1; + +SET ROLE regress_alter_table_user1; +ALTER INDEX onek_unique1 RENAME TO fail; -- permission denied +RESET ROLE; + +-- renaming views +CREATE VIEW attmp_view (unique1) AS SELECT unique1 FROM tenk1; +ALTER TABLE attmp_view RENAME TO attmp_view_new; + +SET ROLE regress_alter_table_user1; +ALTER VIEW attmp_view_new RENAME TO fail; -- permission denied +RESET ROLE; + +-- hack to ensure we get an indexscan here +set enable_seqscan to off; +set enable_bitmapscan to off; +-- 5 values, sorted +SELECT unique1 FROM tenk1 WHERE unique1 < 5; +reset enable_seqscan; +reset enable_bitmapscan; + +DROP VIEW attmp_view_new; +-- toast-like relation name +alter table stud_emp rename to pg_toast_stud_emp; +alter table pg_toast_stud_emp rename to stud_emp; + +-- renaming index should rename constraint as well +ALTER TABLE onek ADD CONSTRAINT onek_unique1_constraint UNIQUE NULLS NOT DISTINCT (unique1); +ALTER INDEX onek_unique1_constraint RENAME TO onek_unique1_constraint_foo; +ALTER TABLE onek DROP CONSTRAINT onek_unique1_constraint_foo; + +-- renaming constraint +ALTER TABLE onek ADD CONSTRAINT onek_check_constraint CHECK (unique1 >= 0); +ALTER TABLE onek RENAME CONSTRAINT onek_check_constraint TO onek_check_constraint_foo; +ALTER TABLE onek DROP CONSTRAINT onek_check_constraint_foo; + +-- renaming constraint should rename index as well +ALTER TABLE onek ADD CONSTRAINT onek_unique1_constraint UNIQUE NULLS DISTINCT (unique1); +DROP INDEX onek_unique1_constraint; -- to see whether it's there +ALTER TABLE onek RENAME CONSTRAINT onek_unique1_constraint TO onek_unique1_constraint_foo; +DROP INDEX onek_unique1_constraint_foo; -- to see whether it's there +ALTER TABLE onek DROP CONSTRAINT onek_unique1_constraint_foo; + +-- renaming constraints vs. inheritance +CREATE TABLE constraint_rename_test (a int CONSTRAINT con1 CHECK (a > 0), b int, c int); +--\d constraint_rename_test +CREATE TABLE constraint_rename_test2 (a int CONSTRAINT con1 CHECK (a > 0), d int) INHERITS (constraint_rename_test); +--\d constraint_rename_test2 +ALTER TABLE constraint_rename_test2 RENAME CONSTRAINT con1 TO con1foo; -- fail +ALTER TABLE ONLY constraint_rename_test RENAME CONSTRAINT con1 TO con1foo; -- fail +ALTER TABLE constraint_rename_test RENAME CONSTRAINT con1 TO con1foo; -- ok +--\d constraint_rename_test +--\d constraint_rename_test2 +ALTER TABLE constraint_rename_test ADD CONSTRAINT con2 CHECK (b > 0) NO INHERIT; +ALTER TABLE ONLY constraint_rename_test RENAME CONSTRAINT con2 TO con2foo; -- ok +ALTER TABLE constraint_rename_test RENAME CONSTRAINT con2foo TO con2bar; -- ok +--\d constraint_rename_test +--\d constraint_rename_test2 +ALTER TABLE constraint_rename_test ADD CONSTRAINT con3 PRIMARY KEY (a); +ALTER TABLE constraint_rename_test RENAME CONSTRAINT con3 TO con3foo; -- ok +--\d constraint_rename_test +--\d constraint_rename_test2 +DROP TABLE constraint_rename_test2; +DROP TABLE constraint_rename_test; +ALTER TABLE IF EXISTS constraint_not_exist RENAME CONSTRAINT con3 TO con3foo; -- ok +ALTER TABLE IF EXISTS constraint_rename_test ADD CONSTRAINT con4 UNIQUE (a); + +-- renaming constraints with cache reset of target relation +CREATE TABLE constraint_rename_cache (a int, + CONSTRAINT chk_a CHECK (a > 0), + PRIMARY KEY (a)); +ALTER TABLE constraint_rename_cache + RENAME CONSTRAINT chk_a TO chk_a_new; +ALTER TABLE constraint_rename_cache + RENAME CONSTRAINT constraint_rename_cache_pkey TO constraint_rename_pkey_new; +CREATE TABLE like_constraint_rename_cache + (LIKE constraint_rename_cache INCLUDING ALL); +--\d like_constraint_rename_cache +DROP TABLE constraint_rename_cache; +DROP TABLE like_constraint_rename_cache; + +-- FOREIGN KEY CONSTRAINT adding TEST + +CREATE TABLE attmp2 (a int primary key); + +CREATE TABLE attmp3 (a int, b int); + +CREATE TABLE attmp4 (a int, b int, unique(a,b)); + +CREATE TABLE attmp5 (a int, b int); + +-- Insert rows into attmp2 (pktable) +INSERT INTO attmp2 values (1); +INSERT INTO attmp2 values (2); +INSERT INTO attmp2 values (3); +INSERT INTO attmp2 values (4); + +-- Insert rows into attmp3 +INSERT INTO attmp3 values (1,10); +INSERT INTO attmp3 values (1,20); +INSERT INTO attmp3 values (5,50); + +-- Try (and fail) to add constraint due to invalid source columns +ALTER TABLE attmp3 add constraint attmpconstr foreign key(c) references attmp2 match full; + +-- Try (and fail) to add constraint due to invalid destination columns explicitly given +ALTER TABLE attmp3 add constraint attmpconstr foreign key(a) references attmp2(b) match full; + +-- Try (and fail) to add constraint due to invalid data +ALTER TABLE attmp3 add constraint attmpconstr foreign key (a) references attmp2 match full; + +-- Delete failing row +DELETE FROM attmp3 where a=5; + +-- Try (and succeed) +ALTER TABLE attmp3 add constraint attmpconstr foreign key (a) references attmp2 match full; +ALTER TABLE attmp3 drop constraint attmpconstr; + +INSERT INTO attmp3 values (5,50); + +-- Try NOT VALID and then VALIDATE CONSTRAINT, but fails. Delete failure then re-validate +ALTER TABLE attmp3 add constraint attmpconstr foreign key (a) references attmp2 match full NOT VALID; +ALTER TABLE attmp3 validate constraint attmpconstr; + +-- Delete failing row +DELETE FROM attmp3 where a=5; + +-- Try (and succeed) and repeat to show it works on already valid constraint +ALTER TABLE attmp3 validate constraint attmpconstr; +ALTER TABLE attmp3 validate constraint attmpconstr; + +-- Try a non-verified CHECK constraint +ALTER TABLE attmp3 ADD CONSTRAINT b_greater_than_ten CHECK (b > 10); -- fail +ALTER TABLE attmp3 ADD CONSTRAINT b_greater_than_ten CHECK (b > 10) NOT VALID; -- succeeds +ALTER TABLE attmp3 VALIDATE CONSTRAINT b_greater_than_ten; -- fails +DELETE FROM attmp3 WHERE NOT b > 10; +ALTER TABLE attmp3 VALIDATE CONSTRAINT b_greater_than_ten; -- succeeds +ALTER TABLE attmp3 VALIDATE CONSTRAINT b_greater_than_ten; -- succeeds + +-- Test inherited NOT VALID CHECK constraints +select * from attmp3; +CREATE TABLE attmp6 () INHERITS (attmp3); +CREATE TABLE attmp7 () INHERITS (attmp3); + +INSERT INTO attmp6 VALUES (6, 30), (7, 16); +ALTER TABLE attmp3 ADD CONSTRAINT b_le_20 CHECK (b <= 20) NOT VALID; +ALTER TABLE attmp3 VALIDATE CONSTRAINT b_le_20; -- fails +DELETE FROM attmp6 WHERE b > 20; +ALTER TABLE attmp3 VALIDATE CONSTRAINT b_le_20; -- succeeds + +-- An already validated constraint must not be revalidated +CREATE FUNCTION boo(int) RETURNS int IMMUTABLE STRICT LANGUAGE plpgsql AS $$ BEGIN RAISE NOTICE 'boo: %', $1; RETURN $1; END; $$; +INSERT INTO attmp7 VALUES (8, 18); +ALTER TABLE attmp7 ADD CONSTRAINT identity CHECK (b = boo(b)); +ALTER TABLE attmp3 ADD CONSTRAINT IDENTITY check (b = boo(b)) NOT VALID; +ALTER TABLE attmp3 VALIDATE CONSTRAINT identity; + +-- A NO INHERIT constraint should not be looked for in children during VALIDATE CONSTRAINT +create table parent_noinh_convalid (a int); +create table child_noinh_convalid () inherits (parent_noinh_convalid); +insert into parent_noinh_convalid values (1); +insert into child_noinh_convalid values (1); +alter table parent_noinh_convalid add constraint check_a_is_2 check (a = 2) no inherit not valid; +-- fail, because of the row in parent +alter table parent_noinh_convalid validate constraint check_a_is_2; +delete from only parent_noinh_convalid; +-- ok (parent itself contains no violating rows) +alter table parent_noinh_convalid validate constraint check_a_is_2; +select convalidated from pg_constraint where conrelid = 'parent_noinh_convalid'::regclass and conname = 'check_a_is_2'; +-- cleanup +drop table parent_noinh_convalid, child_noinh_convalid; + +-- Try (and fail) to create constraint from attmp5(a) to attmp4(a) - unique constraint on +-- attmp4 is a,b + +ALTER TABLE attmp5 add constraint attmpconstr foreign key(a) references attmp4(a) match full; + +DROP TABLE attmp7; + +DROP TABLE attmp6; + +DROP TABLE attmp5; + +DROP TABLE attmp4; + +DROP TABLE attmp3; + +DROP TABLE attmp2; + +-- NOT VALID with plan invalidation -- ensure we don't use a constraint for +-- exclusion until validated +set constraint_exclusion TO 'partition'; +create table nv_parent (d date, check (false) no inherit not valid); +-- not valid constraint added at creation time should automatically become valid +--\d nv_parent + +create table nv_child_2010 () inherits (nv_parent); +create table nv_child_2011 () inherits (nv_parent); +alter table nv_child_2010 add check (d between '2010-01-01'::date and '2010-12-31'::date) not valid; +alter table nv_child_2011 add check (d between '2011-01-01'::date and '2011-12-31'::date) not valid; +explain (costs off) select * from nv_parent where d between '2011-08-01' and '2011-08-31'; +create table nv_child_2009 (check (d between '2009-01-01'::date and '2009-12-31'::date)) inherits (nv_parent); +explain (costs off) select * from nv_parent where d between '2011-08-01'::date and '2011-08-31'::date; +explain (costs off) select * from nv_parent where d between '2009-08-01'::date and '2009-08-31'::date; +-- after validation, the constraint should be used +alter table nv_child_2011 VALIDATE CONSTRAINT nv_child_2011_d_check; +explain (costs off) select * from nv_parent where d between '2009-08-01'::date and '2009-08-31'::date; + +-- add an inherited NOT VALID constraint +alter table nv_parent add check (d between '2001-01-01'::date and '2099-12-31'::date) not valid; +--\d nv_child_2009 +-- we leave nv_parent and children around to help test pg_dump logic + +-- Foreign key adding test with mixed types + +-- Note: these tables are TEMP to avoid name conflicts when this test +-- is run in parallel with foreign_key.sql. + +CREATE TEMP TABLE PKTABLE (ptest1 int PRIMARY KEY); +INSERT INTO PKTABLE VALUES(42); +CREATE TEMP TABLE FKTABLE (ftest1 inet); +-- This next should fail, because int=inet does not exist +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; +-- This should also fail for the same reason, but here we +-- give the column name +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1); +DROP TABLE FKTABLE; +-- This should succeed, even though they are different types, +-- because int=int8 exists and is a member of the integer opfamily +CREATE TEMP TABLE FKTABLE (ftest1 int8); +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; +-- Check it actually works +INSERT INTO FKTABLE VALUES(42); -- should succeed +INSERT INTO FKTABLE VALUES(43); -- should fail +DROP TABLE FKTABLE; +-- This should fail, because we'd have to cast numeric to int which is +-- not an implicit coercion (or use numeric=numeric, but that's not part +-- of the integer opfamily) +CREATE TEMP TABLE FKTABLE (ftest1 numeric); +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; +-- On the other hand, this should work because int implicitly promotes to +-- numeric, and we allow promotion on the FK side +CREATE TEMP TABLE PKTABLE (ptest1 numeric PRIMARY KEY); +INSERT INTO PKTABLE VALUES(42); +CREATE TEMP TABLE FKTABLE (ftest1 int); +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable; +-- Check it actually works +INSERT INTO FKTABLE VALUES(42); -- should succeed +INSERT INTO FKTABLE VALUES(43); -- should fail +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 inet, + PRIMARY KEY(ptest1, ptest2)); +-- This should fail, because we just chose really odd types +CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp); +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable; +DROP TABLE FKTABLE; +-- Again, so should this... +CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp); +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) + references pktable(ptest1, ptest2); +DROP TABLE FKTABLE; +-- This fails because we mixed up the column ordering +CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 inet); +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) + references pktable(ptest2, ptest1); +-- As does this... +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1) + references pktable(ptest1, ptest2); +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- Test that ALTER CONSTRAINT updates trigger deferrability properly + +CREATE TEMP TABLE PKTABLE (ptest1 int primary key); +CREATE TEMP TABLE FKTABLE (ftest1 int); + +ALTER TABLE FKTABLE ADD CONSTRAINT fknd FOREIGN KEY(ftest1) REFERENCES pktable + ON DELETE CASCADE ON UPDATE NO ACTION NOT DEFERRABLE; +ALTER TABLE FKTABLE ADD CONSTRAINT fkdd FOREIGN KEY(ftest1) REFERENCES pktable + ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE FKTABLE ADD CONSTRAINT fkdi FOREIGN KEY(ftest1) REFERENCES pktable + ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY IMMEDIATE; + +ALTER TABLE FKTABLE ADD CONSTRAINT fknd2 FOREIGN KEY(ftest1) REFERENCES pktable + ON DELETE CASCADE ON UPDATE NO ACTION DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE FKTABLE ALTER CONSTRAINT fknd2 NOT DEFERRABLE; +ALTER TABLE FKTABLE ADD CONSTRAINT fkdd2 FOREIGN KEY(ftest1) REFERENCES pktable + ON DELETE CASCADE ON UPDATE NO ACTION NOT DEFERRABLE; +ALTER TABLE FKTABLE ALTER CONSTRAINT fkdd2 DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE FKTABLE ADD CONSTRAINT fkdi2 FOREIGN KEY(ftest1) REFERENCES pktable + ON DELETE CASCADE ON UPDATE NO ACTION NOT DEFERRABLE; +ALTER TABLE FKTABLE ALTER CONSTRAINT fkdi2 DEFERRABLE INITIALLY IMMEDIATE; + +SELECT conname, tgfoid::regproc, tgtype, tgdeferrable, tginitdeferred +FROM pg_trigger JOIN pg_constraint con ON con.oid = tgconstraint +WHERE tgrelid = 'pktable'::regclass +ORDER BY 1,2,3; +SELECT conname, tgfoid::regproc, tgtype, tgdeferrable, tginitdeferred +FROM pg_trigger JOIN pg_constraint con ON con.oid = tgconstraint +WHERE tgrelid = 'fktable'::regclass +ORDER BY 1,2,3; + +-- temp tables should go away by themselves, need not drop them. + +-- test check constraint adding + +create table atacc1 ( test int ); +-- add a check constraint +alter table atacc1 add constraint atacc_test1 check (test>3); +-- should fail +insert into atacc1 (test) values (2); +-- should succeed +insert into atacc1 (test) values (4); +drop table atacc1; + +-- let's do one where the check fails when added +create table atacc1 ( test int ); +-- insert a soon to be failing row +insert into atacc1 (test) values (2); +-- add a check constraint (fails) +alter table atacc1 add constraint atacc_test1 check (test>3); +insert into atacc1 (test) values (4); +drop table atacc1; + +-- let's do one where the check fails because the column doesn't exist +create table atacc1 ( test int ); +-- add a check constraint (fails) +alter table atacc1 add constraint atacc_test1 check (test1>3); +drop table atacc1; + +-- something a little more complicated +create table atacc1 ( test int, test2 int, test3 int); +-- add a check constraint (fails) +alter table atacc1 add constraint atacc_test1 check (test+test23), test2 int); +alter table atacc1 add check (test2>test); +-- should fail for $2 +insert into atacc1 (test2, test) values (3, 4); +drop table atacc1; + +-- inheritance related tests +create table atacc1 (test int); +create table atacc2 (test2 int); +create table atacc3 (test3 int) inherits (atacc1, atacc2); +alter table atacc2 add constraint foo check (test2>0); +-- fail and then succeed on atacc2 +insert into atacc2 (test2) values (-3); +insert into atacc2 (test2) values (3); +-- fail and then succeed on atacc3 +insert into atacc3 (test2) values (-3); +insert into atacc3 (test2) values (3); +drop table atacc3; +drop table atacc2; +drop table atacc1; + +-- same things with one created with INHERIT +create table atacc1 (test int); +create table atacc2 (test2 int); +create table atacc3 (test3 int) inherits (atacc1, atacc2); +alter table atacc3 no inherit atacc2; +-- fail +alter table atacc3 no inherit atacc2; +-- make sure it really isn't a child +insert into atacc3 (test2) values (3); +select test2 from atacc2; +-- fail due to missing constraint +alter table atacc2 add constraint foo check (test2>0); +alter table atacc3 inherit atacc2; +-- fail due to missing column +alter table atacc3 rename test2 to testx; +alter table atacc3 inherit atacc2; +-- fail due to mismatched data type +alter table atacc3 add test2 bool; +alter table atacc3 inherit atacc2; +alter table atacc3 drop test2; +-- succeed +alter table atacc3 add test2 int; +update atacc3 set test2 = 4 where test2 is null; +alter table atacc3 add constraint foo check (test2>0); +alter table atacc3 inherit atacc2; +-- fail due to duplicates and circular inheritance +alter table atacc3 inherit atacc2; +alter table atacc2 inherit atacc3; +alter table atacc2 inherit atacc2; +-- test that we really are a child now (should see 4 not 3 and cascade should go through) +select test2 from atacc2; +drop table atacc2 cascade; +drop table atacc1; + +-- adding only to a parent is allowed as of 9.2 + +create table atacc1 (test int); +create table atacc2 (test2 int) inherits (atacc1); +-- ok: +alter table atacc1 add constraint foo check (test>0) no inherit; +-- check constraint is not there on child +insert into atacc2 (test) values (-3); +-- check constraint is there on parent +insert into atacc1 (test) values (-3); +insert into atacc1 (test) values (3); +-- fail, violating row: +alter table atacc2 add constraint foo check (test>0) no inherit; +drop table atacc2; +drop table atacc1; + +-- test unique constraint adding + +create table atacc1 ( test int ) ; +-- add a unique constraint +alter table atacc1 add constraint atacc_test1 unique (test); +-- insert first value +insert into atacc1 (test) values (2); +-- should fail +insert into atacc1 (test) values (2); +-- should succeed +insert into atacc1 (test) values (4); +-- try to create duplicates via alter table using - should fail +alter table atacc1 alter column test type integer using 0; +drop table atacc1; + +-- let's do one where the unique constraint fails when added +create table atacc1 ( test int ); +-- insert soon to be failing rows +insert into atacc1 (test) values (2); +insert into atacc1 (test) values (2); +-- add a unique constraint (fails) +alter table atacc1 add constraint atacc_test1 unique (test); +insert into atacc1 (test) values (3); +drop table atacc1; + +-- let's do one where the unique constraint fails +-- because the column doesn't exist +create table atacc1 ( test int ); +-- add a unique constraint (fails) +alter table atacc1 add constraint atacc_test1 unique (test1); +drop table atacc1; + +-- something a little more complicated +create table atacc1 ( test int, test2 int); +-- add a unique constraint +alter table atacc1 add constraint atacc_test1 unique (test, test2); +-- insert initial value +insert into atacc1 (test,test2) values (4,4); +-- should fail +insert into atacc1 (test,test2) values (4,4); +-- should all succeed +insert into atacc1 (test,test2) values (4,5); +insert into atacc1 (test,test2) values (5,4); +insert into atacc1 (test,test2) values (5,5); +drop table atacc1; + +-- lets do some naming tests +create table atacc1 (test int, test2 int, unique(test)); +alter table atacc1 add unique (test2); +-- should fail for @@ second one @@ +insert into atacc1 (test2, test) values (3, 3); +insert into atacc1 (test2, test) values (2, 3); +drop table atacc1; + +-- test primary key constraint adding + +create table atacc1 ( id serial, test int) ; +-- add a primary key constraint +alter table atacc1 add constraint atacc_test1 primary key (test); +-- insert first value +insert into atacc1 (test) values (2); +-- should fail +insert into atacc1 (test) values (2); +-- should succeed +insert into atacc1 (test) values (4); +-- inserting NULL should fail +insert into atacc1 (test) values(NULL); +-- try adding a second primary key (should fail) +alter table atacc1 add constraint atacc_oid1 primary key(id); +-- drop first primary key constraint +alter table atacc1 drop constraint atacc_test1 restrict; +-- try adding a primary key on oid (should succeed) +alter table atacc1 add constraint atacc_oid1 primary key(id); +drop table atacc1; + +-- let's do one where the primary key constraint fails when added +create table atacc1 ( test int ); +-- insert soon to be failing rows +insert into atacc1 (test) values (2); +insert into atacc1 (test) values (2); +-- add a primary key (fails) +alter table atacc1 add constraint atacc_test1 primary key (test); +insert into atacc1 (test) values (3); +drop table atacc1; + +-- let's do another one where the primary key constraint fails when added +create table atacc1 ( test int ); +-- insert soon to be failing row +insert into atacc1 (test) values (NULL); +-- add a primary key (fails) +alter table atacc1 add constraint atacc_test1 primary key (test); +insert into atacc1 (test) values (3); +drop table atacc1; + +-- let's do one where the primary key constraint fails +-- because the column doesn't exist +create table atacc1 ( test int ); +-- add a primary key constraint (fails) +alter table atacc1 add constraint atacc_test1 primary key (test1); +drop table atacc1; + +-- adding a new column as primary key to a non-empty table. +-- should fail unless the column has a non-null default value. +create table atacc1 ( test int ); +insert into atacc1 (test) values (0); +-- add a primary key column without a default (fails). +alter table atacc1 add column test2 int primary key; +-- now add a primary key column with a default (succeeds). +alter table atacc1 add column test2 int default 0 primary key; +drop table atacc1; + +-- this combination used to have order-of-execution problems (bug #15580) +create table atacc1 (a int); +insert into atacc1 values(1); +alter table atacc1 + add column b float8 not null default random(), + add primary key(a); +drop table atacc1; + +-- additionally, we've seen issues with foreign key validation not being +-- properly delayed until after a table rewrite. Check that works ok. +create table atacc1 (a int primary key); +alter table atacc1 add constraint atacc1_fkey foreign key (a) references atacc1 (a) not valid; +alter table atacc1 validate constraint atacc1_fkey, alter a type bigint; +drop table atacc1; + +-- we've also seen issues with check constraints being validated at the wrong +-- time when there's a pending table rewrite. +create table atacc1 (a bigint, b int); +insert into atacc1 values(1,1); +alter table atacc1 add constraint atacc1_chk check(b = 1) not valid; +alter table atacc1 validate constraint atacc1_chk, alter a type int; +drop table atacc1; + +-- same as above, but ensure the constraint violation is detected +create table atacc1 (a bigint, b int); +insert into atacc1 values(1,2); +alter table atacc1 add constraint atacc1_chk check(b = 1) not valid; +alter table atacc1 validate constraint atacc1_chk, alter a type int; +drop table atacc1; + +-- something a little more complicated +create table atacc1 ( test int, test2 int); +-- add a primary key constraint +alter table atacc1 add constraint atacc_test1 primary key (test, test2); +-- try adding a second primary key - should fail +alter table atacc1 add constraint atacc_test2 primary key (test); +-- insert initial value +insert into atacc1 (test,test2) values (4,4); +-- should fail +insert into atacc1 (test,test2) values (4,4); +insert into atacc1 (test,test2) values (NULL,3); +insert into atacc1 (test,test2) values (3, NULL); +insert into atacc1 (test,test2) values (NULL,NULL); +-- should all succeed +insert into atacc1 (test,test2) values (4,5); +insert into atacc1 (test,test2) values (5,4); +insert into atacc1 (test,test2) values (5,5); +drop table atacc1; + +-- lets do some naming tests +create table atacc1 (test int, test2 int, primary key(test)); +-- only first should succeed +insert into atacc1 (test2, test) values (3, 3); +insert into atacc1 (test2, test) values (2, 3); +insert into atacc1 (test2, test) values (1, NULL); +drop table atacc1; + +-- alter table / alter column [set/drop] not null tests +-- try altering system catalogs, should fail +alter table pg_class alter column relname drop not null; +alter table pg_class alter relname set not null; + +-- try altering non-existent table, should fail +alter table non_existent alter column bar set not null; +alter table non_existent alter column bar drop not null; + +-- test setting columns to null and not null and vice versa +-- test checking for null values and primary key +create table atacc1 (test int not null); +alter table atacc1 add constraint "atacc1_pkey" primary key (test); +alter table atacc1 alter column test drop not null; +alter table atacc1 drop constraint "atacc1_pkey"; +alter table atacc1 alter column test drop not null; +insert into atacc1 values (null); +alter table atacc1 alter test set not null; +delete from atacc1; +alter table atacc1 alter test set not null; + +-- try altering a non-existent column, should fail +alter table atacc1 alter bar set not null; +alter table atacc1 alter bar drop not null; + +-- try creating a view and altering that, should fail +create view myview as select * from atacc1; +alter table myview alter column test drop not null; +alter table myview alter column test set not null; +drop view myview; + +drop table atacc1; + +-- set not null verified by constraints +create table atacc1 (test_a int, test_b int); +insert into atacc1 values (null, 1); +-- constraint not cover all values, should fail +alter table atacc1 add constraint atacc1_constr_or check(test_a is not null or test_b < 10); +alter table atacc1 alter test_a set not null; +alter table atacc1 drop constraint atacc1_constr_or; +-- not valid constraint, should fail +alter table atacc1 add constraint atacc1_constr_invalid check(test_a is not null) not valid; +alter table atacc1 alter test_a set not null; +alter table atacc1 drop constraint atacc1_constr_invalid; +-- with valid constraint +update atacc1 set test_a = 1; +alter table atacc1 add constraint atacc1_constr_a_valid check(test_a is not null); +alter table atacc1 alter test_a set not null; +delete from atacc1; + +insert into atacc1 values (2, null); +alter table atacc1 alter test_a drop not null; +-- test multiple set not null at same time +-- test_a checked by atacc1_constr_a_valid, test_b should fail by table scan +alter table atacc1 alter test_a set not null, alter test_b set not null; +-- commands order has no importance +alter table atacc1 alter test_b set not null, alter test_a set not null; + +-- valid one by table scan, one by check constraints +update atacc1 set test_b = 1; +alter table atacc1 alter test_b set not null, alter test_a set not null; + +alter table atacc1 alter test_a drop not null, alter test_b drop not null; +-- both column has check constraints +alter table atacc1 add constraint atacc1_constr_b_valid check(test_b is not null); +alter table atacc1 alter test_b set not null, alter test_a set not null; +drop table atacc1; + +-- test inheritance +create table parent (a int); +create table child (b varchar(255)) inherits (parent); + +alter table parent alter a set not null; +insert into parent values (NULL); +insert into child (a, b) values (NULL, 'foo'); +alter table parent alter a drop not null; +insert into parent values (NULL); +insert into child (a, b) values (NULL, 'foo'); +alter table only parent alter a set not null; +alter table child alter a set not null; +delete from parent; +alter table only parent alter a set not null; +insert into parent values (NULL); +alter table child alter a set not null; +insert into child (a, b) values (NULL, 'foo'); +delete from child; +alter table child alter a set not null; +insert into child (a, b) values (NULL, 'foo'); +drop table child; +drop table parent; + +-- test setting and removing default values +create table def_test ( + c1 int4 default 5, + c2 text default 'initial_default' +); +insert into def_test default values; +alter table def_test alter column c1 drop default; +insert into def_test default values; +alter table def_test alter column c2 drop default; +insert into def_test default values; +alter table def_test alter column c1 set default 10; +alter table def_test alter column c2 set default 'new_default'; +insert into def_test default values; +select * from def_test; + +-- set defaults to an incorrect type: this should fail +alter table def_test alter column c1 set default 'wrong_datatype'; +alter table def_test alter column c2 set default 20; + +-- set defaults on a non-existent column: this should fail +alter table def_test alter column c3 set default 30; + +-- set defaults on views: we need to create a view, add a rule +-- to allow insertions into it, and then alter the view to add +-- a default +create view def_view_test as select * from def_test; +create rule def_view_test_ins as + on insert to def_view_test + do instead insert into def_test select new.*; +insert into def_view_test default values; +alter table def_view_test alter column c1 set default 45; +insert into def_view_test default values; +alter table def_view_test alter column c2 set default 'view_default'; +insert into def_view_test default values; +select * from def_view_test; + +drop rule def_view_test_ins on def_view_test; +drop view def_view_test; +drop table def_test; + +-- alter table / drop column tests +-- try altering system catalogs, should fail +alter table pg_class drop column relname; + +-- try altering non-existent table, should fail +alter table nosuchtable drop column bar; + +-- test dropping columns +create table atacc1 (a int4 not null, b int4, c int4 not null, d int4); +insert into atacc1 values (1, 2, 3, 4); +alter table atacc1 drop a; +alter table atacc1 drop a; + +-- SELECTs +select * from atacc1; +select * from atacc1 order by a; +select * from atacc1 order by "........pg.dropped.1........"; +select * from atacc1 group by a; +select * from atacc1 group by "........pg.dropped.1........"; +select atacc1.* from atacc1; +select a from atacc1; +select atacc1.a from atacc1; +select b,c,d from atacc1; +select a,b,c,d from atacc1; +select * from atacc1 where a = 1; +select "........pg.dropped.1........" from atacc1; +select atacc1."........pg.dropped.1........" from atacc1; +select "........pg.dropped.1........",b,c,d from atacc1; +select * from atacc1 where "........pg.dropped.1........" = 1; + +-- UPDATEs +update atacc1 set a = 3; +update atacc1 set b = 2 where a = 3; +update atacc1 set "........pg.dropped.1........" = 3; +update atacc1 set b = 2 where "........pg.dropped.1........" = 3; + +-- INSERTs +insert into atacc1 values (10, 11, 12, 13); +insert into atacc1 values (default, 11, 12, 13); +insert into atacc1 values (11, 12, 13); +insert into atacc1 (a) values (10); +insert into atacc1 (a) values (default); +insert into atacc1 (a,b,c,d) values (10,11,12,13); +insert into atacc1 (a,b,c,d) values (default,11,12,13); +insert into atacc1 (b,c,d) values (11,12,13); +insert into atacc1 ("........pg.dropped.1........") values (10); +insert into atacc1 ("........pg.dropped.1........") values (default); +insert into atacc1 ("........pg.dropped.1........",b,c,d) values (10,11,12,13); +insert into atacc1 ("........pg.dropped.1........",b,c,d) values (default,11,12,13); + +-- DELETEs +delete from atacc1 where a = 3; +delete from atacc1 where "........pg.dropped.1........" = 3; +delete from atacc1; + +-- try dropping a non-existent column, should fail +alter table atacc1 drop bar; + +-- try removing an oid column, should succeed (as it's nonexistent) +alter table atacc1 SET WITHOUT OIDS; + +-- try adding an oid column, should fail (not supported) +--alter table atacc1 SET WITH OIDS; + +-- try dropping the xmin column, should fail +alter table atacc1 drop xmin; + +-- try creating a view and altering that, should fail +create view myview as select * from atacc1; +select * from myview; +alter table myview drop d; +drop view myview; + +-- test some commands to make sure they fail on the dropped column +analyze atacc1(a); +analyze atacc1("........pg.dropped.1........"); +vacuum analyze atacc1(a); +vacuum analyze atacc1("........pg.dropped.1........"); +comment on column atacc1.a is 'testing'; +comment on column atacc1."........pg.dropped.1........" is 'testing'; +alter table atacc1 alter a set storage plain; +alter table atacc1 alter "........pg.dropped.1........" set storage plain; +alter table atacc1 alter a set statistics 0; +alter table atacc1 alter "........pg.dropped.1........" set statistics 0; +alter table atacc1 alter a set default 3; +alter table atacc1 alter "........pg.dropped.1........" set default 3; +alter table atacc1 alter a drop default; +alter table atacc1 alter "........pg.dropped.1........" drop default; +alter table atacc1 alter a set not null; +alter table atacc1 alter "........pg.dropped.1........" set not null; +alter table atacc1 alter a drop not null; +alter table atacc1 alter "........pg.dropped.1........" drop not null; +alter table atacc1 rename a to x; +alter table atacc1 rename "........pg.dropped.1........" to x; +alter table atacc1 add primary key(a); +alter table atacc1 add primary key("........pg.dropped.1........"); +alter table atacc1 add unique(a); +alter table atacc1 add unique("........pg.dropped.1........"); +alter table atacc1 add check (a > 3); +alter table atacc1 add check ("........pg.dropped.1........" > 3); +create table atacc2 (id int4 unique); +alter table atacc1 add foreign key (a) references atacc2(id); +alter table atacc1 add foreign key ("........pg.dropped.1........") references atacc2(id); +alter table atacc2 add foreign key (id) references atacc1(a); +alter table atacc2 add foreign key (id) references atacc1("........pg.dropped.1........"); +drop table atacc2; +create index "testing_idx" on atacc1(a); +create index "testing_idx" on atacc1("........pg.dropped.1........"); + +-- test create as and select into +insert into atacc1 values (21, 22, 23); +create table attest1 as select * from atacc1; +select * from attest1; +drop table attest1; +select * into attest2 from atacc1; +select * from attest2; +drop table attest2; + +-- try dropping all columns +alter table atacc1 drop c; +alter table atacc1 drop d; +alter table atacc1 drop b; +select * from atacc1; + +drop table atacc1; + +-- test constraint error reporting in presence of dropped columns +create table atacc1 (id serial primary key, value int check (value < 10)); +insert into atacc1(value) values (100); +alter table atacc1 drop column value; +alter table atacc1 add column value int check (value < 10); +insert into atacc1(value) values (100); +insert into atacc1(id, value) values (null, 0); +drop table atacc1; + +-- test inheritance +create table parent (a int, b int, c int); +insert into parent values (1, 2, 3); +alter table parent drop a; +create table child (d varchar(255)) inherits (parent); +insert into child values (12, 13, 'testing'); + +select * from parent; +select * from child; +alter table parent drop c; +select * from parent; +select * from child; + +drop table child; +drop table parent; + +-- check error cases for inheritance column merging +create table parent (a float8, b numeric(10,4), c text collate "C"); + +create table child (a float4) inherits (parent); -- fail +create table child (b decimal(10,7)) inherits (parent); -- fail +create table child (c text collate "POSIX") inherits (parent); -- fail +create table child (a double precision, b decimal(10,4)) inherits (parent); + +drop table child; +drop table parent; + +-- test copy in/out +create table attest (a int4, b int4, c int4); +insert into attest values (1,2,3); +alter table attest drop a; +copy attest to stdout; +copy attest(a) to stdout; +copy attest("........pg.dropped.1........") to stdout; +copy attest from stdin; +--10 11 12 +--\. +select * from attest; +copy attest from stdin; +--21 22 +--\. +select * from attest; +copy attest(a) from stdin; +copy attest("........pg.dropped.1........") from stdin; +copy attest(b,c) from stdin; +--31 32 +--\. +select * from attest; +drop table attest; + +-- test inheritance + +create table dropColumn (a int, b int, e int); +create table dropColumnChild (c int) inherits (dropColumn); +create table dropColumnAnother (d int) inherits (dropColumnChild); + +-- these two should fail +alter table dropColumnchild drop column a; +alter table only dropColumnChild drop column b; + + + +-- these three should work +alter table only dropColumn drop column e; +alter table dropColumnChild drop column c; +alter table dropColumn drop column a; + +create table renameColumn (a int); +create table renameColumnChild (b int) inherits (renameColumn); +create table renameColumnAnother (c int) inherits (renameColumnChild); + +-- these three should fail +alter table renameColumnChild rename column a to d; +alter table only renameColumnChild rename column a to d; +alter table only renameColumn rename column a to d; + +-- these should work +alter table renameColumn rename column a to d; +alter table renameColumnChild rename column b to a; + +-- these should work +alter table if exists doesnt_exist_tab rename column a to d; +alter table if exists doesnt_exist_tab rename column b to a; + +-- this should work +alter table renameColumn add column w int; + +-- this should fail +alter table only renameColumn add column x int; + + +-- Test corner cases in dropping of inherited columns + +create table p1 (f1 int, f2 int); +create table c1 (f1 int not null) inherits(p1); + +-- should be rejected since c1.f1 is inherited +alter table c1 drop column f1; +-- should work +alter table p1 drop column f1; +-- c1.f1 is still there, but no longer inherited +select f1 from c1; +alter table c1 drop column f1; +select f1 from c1; + +drop table p1 cascade; + +create table p1 (f1 int, f2 int); +create table c1 () inherits(p1); + +-- should be rejected since c1.f1 is inherited +alter table c1 drop column f1; +alter table p1 drop column f1; +-- c1.f1 is dropped now, since there is no local definition for it +select f1 from c1; + +drop table p1 cascade; + +create table p1 (f1 int, f2 int); +create table c1 () inherits(p1); + +-- should be rejected since c1.f1 is inherited +alter table c1 drop column f1; +alter table only p1 drop column f1; +-- c1.f1 is NOT dropped, but must now be considered non-inherited +alter table c1 drop column f1; + +drop table p1 cascade; + +create table p1 (f1 int, f2 int); +create table c1 (f1 int not null) inherits(p1); + +-- should be rejected since c1.f1 is inherited +alter table c1 drop column f1; +alter table only p1 drop column f1; +-- c1.f1 is still there, but no longer inherited +alter table c1 drop column f1; + +drop table p1 cascade; + +create table p1(id int, name text); +create table p2(id2 int, name text, height int); +create table c1(age int) inherits(p1,p2); +create table gc1() inherits (c1); + +select relname, attname, attinhcount, attislocal +from pg_class join pg_attribute on (pg_class.oid = pg_attribute.attrelid) +where relname in ('p1','p2','c1','gc1') and attnum > 0 and not attisdropped +order by relname, attnum; + +-- should work +alter table only p1 drop column name; +-- should work. Now c1.name is local and inhcount is 0. +alter table p2 drop column name; +-- should be rejected since its inherited +alter table gc1 drop column name; +-- should work, and drop gc1.name along +alter table c1 drop column name; +-- should fail: column does not exist +alter table gc1 drop column name; +-- should work and drop the attribute in all tables +alter table p2 drop column height; + +-- IF EXISTS test +create table dropColumnExists (); +alter table dropColumnExists drop column non_existing; --fail +alter table dropColumnExists drop column if exists non_existing; --succeed + +select relname, attname, attinhcount, attislocal +from pg_class join pg_attribute on (pg_class.oid = pg_attribute.attrelid) +where relname in ('p1','p2','c1','gc1') and attnum > 0 and not attisdropped +order by relname, attnum; + +drop table p1, p2 cascade; + +-- test attinhcount tracking with merged columns + +create table depth0(); +create table depth1(c text) inherits (depth0); +create table depth2() inherits (depth1); +alter table depth0 add c text; + +select attrelid::regclass, attname, attinhcount, attislocal +from pg_attribute +where attnum > 0 and attrelid::regclass in ('depth0', 'depth1', 'depth2') +order by attrelid::regclass::text, attnum; + +-- test renumbering of child-table columns in inherited operations + +create table p1 (f1 int); +create table c1 (f2 text, f3 int) inherits (p1); + +alter table p1 add column a1 int check (a1 > 0); +alter table p1 add column f2 text; + +insert into p1 values (1,2,'abc'); +insert into c1 values(11,'xyz',33,0); -- should fail +insert into c1 values(11,'xyz',33,22); + +select * from p1; +update p1 set a1 = a1 + 1, f2 = upper(f2); +select * from p1; + +drop table p1 cascade; + +-- test that operations with a dropped column do not try to reference +-- its datatype + +create domain mytype as text; +create temp table foo (f1 text, f2 mytype, f3 text); + +insert into foo values('bb','cc','dd'); +select * from foo; + +drop domain mytype cascade; + +select * from foo; +insert into foo values('qq','rr'); +select * from foo; +update foo set f3 = 'zz'; +select * from foo; +select f3,max(f1) from foo group by f3; + +-- Simple tests for alter table column type +alter table foo alter f1 TYPE integer; -- fails +alter table foo alter f1 TYPE varchar(10); + +create table anothertab (atcol1 serial8, atcol2 boolean, + constraint anothertab_chk check (atcol1 <= 3)); + +insert into anothertab (atcol1, atcol2) values (default, true); +insert into anothertab (atcol1, atcol2) values (default, false); +select * from anothertab; + +alter table anothertab alter column atcol1 type boolean; -- fails +alter table anothertab alter column atcol1 type boolean using atcol1::int; -- fails +alter table anothertab alter column atcol1 type integer; + +select * from anothertab; + +insert into anothertab (atcol1, atcol2) values (45, null); -- fails +insert into anothertab (atcol1, atcol2) values (default, null); + +select * from anothertab; + +alter table anothertab alter column atcol2 type text + using case when atcol2 is true then 'IT WAS TRUE' + when atcol2 is false then 'IT WAS FALSE' + else 'IT WAS NULL!' end; + +select * from anothertab; +alter table anothertab alter column atcol1 type boolean + using case when atcol1 % 2 = 0 then true else false end; -- fails +alter table anothertab alter column atcol1 drop default; +alter table anothertab alter column atcol1 type boolean + using case when atcol1 % 2 = 0 then true else false end; -- fails +alter table anothertab drop constraint anothertab_chk; +alter table anothertab drop constraint anothertab_chk; -- fails +alter table anothertab drop constraint IF EXISTS anothertab_chk; -- succeeds + +alter table anothertab alter column atcol1 type boolean + using case when atcol1 % 2 = 0 then true else false end; + +select * from anothertab; + +drop table anothertab; + +-- Test index handling in alter table column type (cf. bugs #15835, #15865) +create table anothertab(f1 int primary key, f2 int unique, + f3 int, f4 int, f5 int); +alter table anothertab + add exclude using btree (f3 with =); +alter table anothertab + add exclude using btree (f4 with =) where (f4 is not null); +alter table anothertab + add exclude using btree (f4 with =) where (f5 > 0); +alter table anothertab + add unique(f1,f4); +create index on anothertab(f2,f3); +create unique index on anothertab(f4); + +\d anothertab +alter table anothertab alter column f1 type bigint; +alter table anothertab + alter column f2 type bigint, + alter column f3 type bigint, + alter column f4 type bigint; +alter table anothertab alter column f5 type bigint; +\d anothertab + +drop table anothertab; + +-- test that USING expressions are parsed before column alter type / drop steps +create table another (f1 int, f2 text, f3 text); + +insert into another values(1, 'one', 'uno'); +insert into another values(2, 'two', 'due'); +insert into another values(3, 'three', 'tre'); + +select * from another; + +alter table another + alter f1 type text using f2 || ' and ' || f3 || ' more', + alter f2 type bigint using f1 * 10, + drop column f3; + +select * from another; + +drop table another; + +-- Create an index that skips WAL, then perform a SET DATA TYPE that skips +-- rewriting the index. +begin; +create table skip_wal_skip_rewrite_index (c varchar(10) primary key); +alter table skip_wal_skip_rewrite_index alter c type varchar(20); +commit; + +-- table's row type +create table tab1 (a int, b text); +create table tab2 (x int, y tab1); +alter table tab1 alter column b type varchar; -- fails + +-- Alter column type that's part of a partitioned index +create table at_partitioned (a int, b text) partition by range (a); +create table at_part_1 partition of at_partitioned for values from (0) to (1000); +insert into at_partitioned values (512, '0.123'); +create table at_part_2 (b text, a int); +insert into at_part_2 values ('1.234', 1024); +create index on at_partitioned (b); +create index on at_partitioned (a); +\d at_part_1 +\d at_part_2 +alter table at_partitioned attach partition at_part_2 for values from (1000) to (2000); +\d at_part_2 +alter table at_partitioned alter column b type numeric using b::numeric; +\d at_part_1 +\d at_part_2 +drop table at_partitioned; + +-- Alter column type when no table rewrite is required +-- Also check that comments are preserved +create table at_partitioned(id int, name varchar(64), unique (id, name)) + partition by hash(id); +comment on constraint at_partitioned_id_name_key on at_partitioned is 'parent constraint'; +comment on index at_partitioned_id_name_key is 'parent index'; +create table at_partitioned_0 partition of at_partitioned + for values with (modulus 2, remainder 0); +comment on constraint at_partitioned_0_id_name_key on at_partitioned_0 is 'child 0 constraint'; +comment on index at_partitioned_0_id_name_key is 'child 0 index'; +create table at_partitioned_1 partition of at_partitioned + for values with (modulus 2, remainder 1); +comment on constraint at_partitioned_1_id_name_key on at_partitioned_1 is 'child 1 constraint'; +comment on index at_partitioned_1_id_name_key is 'child 1 index'; +insert into at_partitioned values(1, 'foo'); +insert into at_partitioned values(3, 'bar'); + +create temp table old_oids as + select relname, oid as oldoid, relfilenode as oldfilenode + from pg_class where relname like 'at_partitioned%'; + +select relname, + c.oid = oldoid as orig_oid, + case relfilenode + when 0 then 'none' + when c.oid then 'own' + when oldfilenode then 'orig' + else 'OTHER' + end as storage, + obj_description(c.oid, 'pg_class') as desc + from pg_class c left join old_oids using (relname) + where relname like 'at_partitioned%' + order by relname; + +select conname, obj_description(oid, 'pg_constraint') as desc + from pg_constraint where conname like 'at_partitioned%' + order by conname; + +alter table at_partitioned alter column name type varchar(127); + +-- Note: these tests currently show the wrong behavior for comments :-( + +select relname, + c.oid = oldoid as orig_oid, + case relfilenode + when 0 then 'none' + when c.oid then 'own' + when oldfilenode then 'orig' + else 'OTHER' + end as storage, + obj_description(c.oid, 'pg_class') as desc + from pg_class c left join old_oids using (relname) + where relname like 'at_partitioned%' + order by relname; + +select conname, obj_description(oid, 'pg_constraint') as desc + from pg_constraint where conname like 'at_partitioned%' + order by conname; + +-- Don't remove this DROP, it exposes bug #15672 +drop table at_partitioned; + +-- disallow recursive containment of row types +create temp table recur1 (f1 int); +alter table recur1 add column f2 recur1; -- fails +alter table recur1 add column f2 recur1[]; -- fails +create domain array_of_recur1 as recur1[]; +alter table recur1 add column f2 array_of_recur1; -- fails +create temp table recur2 (f1 int, f2 recur1); +alter table recur1 add column f2 recur2; -- fails +alter table recur1 add column f2 int; +alter table recur1 alter column f2 type recur2; -- fails + +-- SET STORAGE may need to add a TOAST table +create table test_storage (a text); +alter table test_storage alter a set storage plain; +alter table test_storage add b int default 0; -- rewrite table to remove its TOAST table +alter table test_storage alter a set storage extended; -- re-add TOAST table + +select reltoastrelid <> 0 as has_toast_table +from pg_class +where oid = 'test_storage'::regclass; + +-- test that SET STORAGE propagates to index correctly +create index test_storage_idx on test_storage (b, a); +alter table test_storage alter column a set storage external; +\d+ test_storage +\d+ test_storage_idx + +-- ALTER COLUMN TYPE with a check constraint and a child table (bug #13779) +CREATE TABLE test_inh_check (a float check (a > 10.2), b float); +CREATE TABLE test_inh_check_child() INHERITS(test_inh_check); +\d test_inh_check +\d test_inh_check_child +select relname, conname, coninhcount, conislocal, connoinherit + from pg_constraint c, pg_class r + where relname like 'test_inh_check%' and c.conrelid = r.oid + order by 1, 2; +ALTER TABLE test_inh_check ALTER COLUMN a TYPE numeric; +\d test_inh_check +\d test_inh_check_child +select relname, conname, coninhcount, conislocal, connoinherit + from pg_constraint c, pg_class r + where relname like 'test_inh_check%' and c.conrelid = r.oid + order by 1, 2; +-- also try noinherit, local, and local+inherited cases +ALTER TABLE test_inh_check ADD CONSTRAINT bnoinherit CHECK (b > 100) NO INHERIT; +ALTER TABLE test_inh_check_child ADD CONSTRAINT blocal CHECK (b < 1000); +ALTER TABLE test_inh_check_child ADD CONSTRAINT bmerged CHECK (b > 1); +ALTER TABLE test_inh_check ADD CONSTRAINT bmerged CHECK (b > 1); +\d test_inh_check +\d test_inh_check_child +select relname, conname, coninhcount, conislocal, connoinherit + from pg_constraint c, pg_class r + where relname like 'test_inh_check%' and c.conrelid = r.oid + order by 1, 2; +ALTER TABLE test_inh_check ALTER COLUMN b TYPE numeric; +\d test_inh_check +\d test_inh_check_child +select relname, conname, coninhcount, conislocal, connoinherit + from pg_constraint c, pg_class r + where relname like 'test_inh_check%' and c.conrelid = r.oid + order by 1, 2; + +-- ALTER COLUMN TYPE with different schema in children +-- Bug at https://postgr.es/m/20170102225618.GA10071@telsasoft.com +CREATE TABLE test_type_diff (f1 int); +CREATE TABLE test_type_diff_c (extra smallint) INHERITS (test_type_diff); +ALTER TABLE test_type_diff ADD COLUMN f2 int; +INSERT INTO test_type_diff_c VALUES (1, 2, 3); +ALTER TABLE test_type_diff ALTER COLUMN f2 TYPE bigint USING f2::bigint; + +CREATE TABLE test_type_diff2 (int_two int2, int_four int4, int_eight int8); +CREATE TABLE test_type_diff2_c1 (int_four int4, int_eight int8, int_two int2); +CREATE TABLE test_type_diff2_c2 (int_eight int8, int_two int2, int_four int4); +CREATE TABLE test_type_diff2_c3 (int_two int2, int_four int4, int_eight int8); +ALTER TABLE test_type_diff2_c1 INHERIT test_type_diff2; +ALTER TABLE test_type_diff2_c2 INHERIT test_type_diff2; +ALTER TABLE test_type_diff2_c3 INHERIT test_type_diff2; +INSERT INTO test_type_diff2_c1 VALUES (1, 2, 3); +INSERT INTO test_type_diff2_c2 VALUES (4, 5, 6); +INSERT INTO test_type_diff2_c3 VALUES (7, 8, 9); +ALTER TABLE test_type_diff2 ALTER COLUMN int_four TYPE int8 USING int_four::int8; +-- whole-row references are disallowed +ALTER TABLE test_type_diff2 ALTER COLUMN int_four TYPE int4 USING (pg_column_size(test_type_diff2)); + +-- check for rollback of ANALYZE corrupting table property flags (bug #11638) +CREATE TABLE check_fk_presence_1 (id int PRIMARY KEY, t text); +CREATE TABLE check_fk_presence_2 (id int REFERENCES check_fk_presence_1, t text); +BEGIN; +ALTER TABLE check_fk_presence_2 DROP CONSTRAINT check_fk_presence_2_id_fkey; +ANALYZE check_fk_presence_2; +ROLLBACK; +\d check_fk_presence_2 +DROP TABLE check_fk_presence_1, check_fk_presence_2; + +-- check column addition within a view (bug #14876) +create table at_base_table(id int, stuff text); +insert into at_base_table values (23, 'skidoo'); +create view at_view_1 as select * from at_base_table bt; +create view at_view_2 as select *, to_json(v1) as j from at_view_1 v1; +\d+ at_view_1 +\d+ at_view_2 +explain (verbose, costs off) select * from at_view_2; +select * from at_view_2; + +create or replace view at_view_1 as select *, 2+2 as more from at_base_table bt; +\d+ at_view_1 +\d+ at_view_2 +explain (verbose, costs off) select * from at_view_2; +select * from at_view_2; + +drop view at_view_2; +drop view at_view_1; +drop table at_base_table; + +-- check adding a column not iself requiring a rewrite, together with +-- a column requiring a default (bug #16038) + +-- ensure that rewrites aren't silently optimized away, removing the +-- value of the test +CREATE FUNCTION check_ddl_rewrite(p_tablename regclass, p_ddl text) +RETURNS boolean +LANGUAGE plpgsql AS $$ +DECLARE + v_relfilenode oid; +BEGIN + v_relfilenode := relfilenode FROM pg_class WHERE oid = p_tablename; + + EXECUTE p_ddl; + + RETURN v_relfilenode <> (SELECT relfilenode FROM pg_class WHERE oid = p_tablename); +END; +$$; + +CREATE TABLE rewrite_test(col text); +INSERT INTO rewrite_test VALUES ('something'); +INSERT INTO rewrite_test VALUES (NULL); + +-- empty[12] don't need rewrite, but notempty[12]_rewrite will force one +SELECT check_ddl_rewrite('rewrite_test', $$ + ALTER TABLE rewrite_test + ADD COLUMN empty1 text, + ADD COLUMN notempty1_rewrite serial; +$$); +SELECT check_ddl_rewrite('rewrite_test', $$ + ALTER TABLE rewrite_test + ADD COLUMN notempty2_rewrite serial, + ADD COLUMN empty2 text; +$$); +-- also check that fast defaults cause no problem, first without rewrite +SELECT check_ddl_rewrite('rewrite_test', $$ + ALTER TABLE rewrite_test + ADD COLUMN empty3 text, + ADD COLUMN notempty3_norewrite int default 42; +$$); +SELECT check_ddl_rewrite('rewrite_test', $$ + ALTER TABLE rewrite_test + ADD COLUMN notempty4_norewrite int default 42, + ADD COLUMN empty4 text; +$$); +-- then with rewrite +SELECT check_ddl_rewrite('rewrite_test', $$ + ALTER TABLE rewrite_test + ADD COLUMN empty5 text, + ADD COLUMN notempty5_norewrite int default 42, + ADD COLUMN notempty5_rewrite serial; +$$); +SELECT check_ddl_rewrite('rewrite_test', $$ + ALTER TABLE rewrite_test + ADD COLUMN notempty6_rewrite serial, + ADD COLUMN empty6 text, + ADD COLUMN notempty6_norewrite int default 42; +$$); + +-- cleanup +DROP FUNCTION check_ddl_rewrite(regclass, text); +DROP TABLE rewrite_test; + +-- +-- lock levels +-- +drop type lockmodes; +create type lockmodes as enum ( + 'SIReadLock' +,'AccessShareLock' +,'RowShareLock' +,'RowExclusiveLock' +,'ShareUpdateExclusiveLock' +,'ShareLock' +,'ShareRowExclusiveLock' +,'ExclusiveLock' +,'AccessExclusiveLock' +); + +drop view my_locks; +create or replace view my_locks as +select case when c.relname like 'pg_toast%' then 'pg_toast' else c.relname end, max(mode::lockmodes) as max_lockmode +from pg_locks l join pg_class c on l.relation = c.oid +where virtualtransaction = ( + select virtualtransaction + from pg_locks + where transactionid = pg_current_xact_id()::xid) +and locktype = 'relation' +and relnamespace != (select oid from pg_namespace where nspname = 'pg_catalog') +and c.relname != 'my_locks' +group by c.relname; + +create table alterlock (f1 int primary key, f2 text); +insert into alterlock values (1, 'foo'); +create table alterlock2 (f3 int primary key, f1 int); +insert into alterlock2 values (1, 1); + +begin; alter table alterlock alter column f2 set statistics 150; +select * from my_locks order by 1; +rollback; + +begin; alter table alterlock cluster on alterlock_pkey; +select * from my_locks order by 1; +commit; + +begin; alter table alterlock set without cluster; +select * from my_locks order by 1; +commit; + +begin; alter table alterlock set (fillfactor = 100); +select * from my_locks order by 1; +commit; + +begin; alter table alterlock reset (fillfactor); +select * from my_locks order by 1; +commit; + +begin; alter table alterlock set (toast.autovacuum_enabled = off); +select * from my_locks order by 1; +commit; + +begin; alter table alterlock set (autovacuum_enabled = off); +select * from my_locks order by 1; +commit; + +begin; alter table alterlock alter column f2 set (n_distinct = 1); +select * from my_locks order by 1; +rollback; + +-- test that mixing options with different lock levels works as expected +begin; alter table alterlock set (autovacuum_enabled = off, fillfactor = 80); +select * from my_locks order by 1; +commit; + +begin; alter table alterlock alter column f2 set storage extended; +select * from my_locks order by 1; +rollback; + +begin; alter table alterlock alter column f2 set default 'x'; +select * from my_locks order by 1; +rollback; + +begin; +create trigger ttdummy + before delete or update on alterlock + for each row + execute procedure + ttdummy (1, 1); +select * from my_locks order by 1; +rollback; + +begin; +select * from my_locks order by 1; +alter table alterlock2 add foreign key (f1) references alterlock (f1); +select * from my_locks order by 1; +rollback; + +begin; +alter table alterlock2 +add constraint alterlock2nv foreign key (f1) references alterlock (f1) NOT VALID; +select * from my_locks order by 1; +commit; +begin; +alter table alterlock2 validate constraint alterlock2nv; +select * from my_locks order by 1; +rollback; + +create or replace view my_locks as +select case when c.relname like 'pg_toast%' then 'pg_toast' else c.relname end, max(mode::lockmodes) as max_lockmode +from pg_locks l join pg_class c on l.relation = c.oid +where virtualtransaction = ( + select virtualtransaction + from pg_locks + where transactionid = pg_current_xact_id()::xid) +and locktype = 'relation' +and relnamespace != (select oid from pg_namespace where nspname = 'pg_catalog') +and c.relname = 'my_locks' +group by c.relname; + +-- raise exception +alter table my_locks set (autovacuum_enabled = false); +alter view my_locks set (autovacuum_enabled = false); +alter table my_locks reset (autovacuum_enabled); +alter view my_locks reset (autovacuum_enabled); + +begin; +alter view my_locks set (security_barrier=off); +select * from my_locks order by 1; +alter view my_locks reset (security_barrier); +rollback; + +-- this test intentionally applies the ALTER TABLE command against a view, but +-- uses a view option so we expect this to succeed. This form of SQL is +-- accepted for historical reasons, as shown in the docs for ALTER VIEW +begin; +alter table my_locks set (security_barrier=off); +select * from my_locks order by 1; +alter table my_locks reset (security_barrier); +rollback; + +-- cleanup +drop table alterlock2; +drop table alterlock; +drop view my_locks; +drop type lockmodes; + +-- +-- alter function +-- +create function test_strict(text) returns text as + 'select coalesce($1, ''got passed a null'');' + language sql returns null on null input; +select test_strict(NULL); +alter function test_strict(text) called on null input; +select test_strict(NULL); + +create function non_strict(text) returns text as + 'select coalesce($1, ''got passed a null'');' + language sql called on null input; +select non_strict(NULL); +alter function non_strict(text) returns null on null input; +select non_strict(NULL); + +-- +-- alter object set schema +-- + +create schema alter1; +create schema alter2; + +create table alter1.t1(f1 serial primary key, f2 int check (f2 > 0)); + +create view alter1.v1 as select * from alter1.t1; + +create function alter1.plus1(int) returns int as 'select $1+1' language sql; + +create domain alter1.posint integer check (value > 0); + +create type alter1.ctype as (f1 int, f2 text); + +create function alter1.same(alter1.ctype, alter1.ctype) returns boolean language sql +as 'select $1.f1 is not distinct from $2.f1 and $1.f2 is not distinct from $2.f2'; + +create operator alter1.=(procedure = alter1.same, leftarg = alter1.ctype, rightarg = alter1.ctype); + +create operator class alter1.ctype_hash_ops default for type alter1.ctype using hash as + operator 1 alter1.=(alter1.ctype, alter1.ctype); + +create conversion alter1.latin1_to_utf8 for 'latin1' to 'utf8' from iso8859_1_to_utf8; + +create text search parser alter1.prs(start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype); +create text search configuration alter1.cfg(parser = alter1.prs); +create text search template alter1.tmpl(init = dsimple_init, lexize = dsimple_lexize); +create text search dictionary alter1.dict(template = alter1.tmpl); + +insert into alter1.t1(f2) values(11); +insert into alter1.t1(f2) values(12); + +alter table alter1.t1 set schema alter1; -- no-op, same schema +alter table alter1.t1 set schema alter2; +alter table alter1.v1 set schema alter2; +alter function alter1.plus1(int) set schema alter2; +alter domain alter1.posint set schema alter2; +alter operator class alter1.ctype_hash_ops using hash set schema alter2; +alter operator family alter1.ctype_hash_ops using hash set schema alter2; +alter operator alter1.=(alter1.ctype, alter1.ctype) set schema alter2; +alter function alter1.same(alter1.ctype, alter1.ctype) set schema alter2; +alter type alter1.ctype set schema alter1; -- no-op, same schema +alter type alter1.ctype set schema alter2; +alter conversion alter1.latin1_to_utf8 set schema alter2; +alter text search parser alter1.prs set schema alter2; +alter text search configuration alter1.cfg set schema alter2; +alter text search template alter1.tmpl set schema alter2; +alter text search dictionary alter1.dict set schema alter2; + +-- this should succeed because nothing is left in alter1 +drop schema alter1; + +insert into alter2.t1(f2) values(13); +insert into alter2.t1(f2) values(14); + +select * from alter2.t1; + +select * from alter2.v1; + +select alter2.plus1(41); + +-- clean up +drop schema alter2 cascade; + +-- +-- composite types +-- + +CREATE TYPE test_type AS (a int); +\d test_type + +ALTER TYPE nosuchtype ADD ATTRIBUTE b text; -- fails + +ALTER TYPE test_type ADD ATTRIBUTE b text; +\d test_type + +ALTER TYPE test_type ADD ATTRIBUTE b text; -- fails + +ALTER TYPE test_type ALTER ATTRIBUTE b SET DATA TYPE varchar; +\d test_type + +ALTER TYPE test_type ALTER ATTRIBUTE b SET DATA TYPE integer; +\d test_type + +ALTER TYPE test_type DROP ATTRIBUTE b; +\d test_type + +ALTER TYPE test_type DROP ATTRIBUTE c; -- fails + +ALTER TYPE test_type DROP ATTRIBUTE IF EXISTS c; + +ALTER TYPE test_type DROP ATTRIBUTE a, ADD ATTRIBUTE d boolean; +\d test_type + +ALTER TYPE test_type RENAME ATTRIBUTE a TO aa; +ALTER TYPE test_type RENAME ATTRIBUTE d TO dd; +\d test_type + +DROP TYPE test_type; + +CREATE TYPE test_type1 AS (a int, b text); +CREATE TABLE test_tbl1 (x int, y test_type1); +ALTER TYPE test_type1 ALTER ATTRIBUTE b TYPE varchar; -- fails + +CREATE TYPE test_type2 AS (a int, b text); +CREATE TABLE test_tbl2 OF test_type2; +CREATE TABLE test_tbl2_subclass () INHERITS (test_tbl2); +\d test_type2 +\d test_tbl2 + +ALTER TYPE test_type2 ADD ATTRIBUTE c text; -- fails +ALTER TYPE test_type2 ADD ATTRIBUTE c text CASCADE; +\d test_type2 +\d test_tbl2 + +ALTER TYPE test_type2 ALTER ATTRIBUTE b TYPE varchar; -- fails +ALTER TYPE test_type2 ALTER ATTRIBUTE b TYPE varchar CASCADE; +\d test_type2 +\d test_tbl2 + +ALTER TYPE test_type2 DROP ATTRIBUTE b; -- fails +ALTER TYPE test_type2 DROP ATTRIBUTE b CASCADE; +\d test_type2 +\d test_tbl2 + +ALTER TYPE test_type2 RENAME ATTRIBUTE a TO aa; -- fails +ALTER TYPE test_type2 RENAME ATTRIBUTE a TO aa CASCADE; +\d test_type2 +\d test_tbl2 +\d test_tbl2_subclass + +DROP TABLE test_tbl2_subclass; + +CREATE TYPE test_typex AS (a int, b text); +CREATE TABLE test_tblx (x int, y test_typex check ((y).a > 0)); +ALTER TYPE test_typex DROP ATTRIBUTE a; -- fails +ALTER TYPE test_typex DROP ATTRIBUTE a CASCADE; +\d test_tblx +DROP TABLE test_tblx; +DROP TYPE test_typex; + +-- This test isn't that interesting on its own, but the purpose is to leave +-- behind a table to test pg_upgrade with. The table has a composite type +-- column in it, and the composite type has a dropped attribute. +CREATE TYPE test_type3 AS (a int); +CREATE TABLE test_tbl3 (c) AS SELECT '(1)'::test_type3; +ALTER TYPE test_type3 DROP ATTRIBUTE a, ADD ATTRIBUTE b int; + +CREATE TYPE test_type_empty AS (); +DROP TYPE test_type_empty; + +-- +-- typed tables: OF / NOT OF +-- + +CREATE TYPE tt_t0 AS (z inet, x int, y numeric(8,2)); +ALTER TYPE tt_t0 DROP ATTRIBUTE z; +CREATE TABLE tt0 (x int NOT NULL, y numeric(8,2)); -- OK +CREATE TABLE tt1 (x int, y bigint); -- wrong base type +CREATE TABLE tt2 (x int, y numeric(9,2)); -- wrong typmod +CREATE TABLE tt3 (y numeric(8,2), x int); -- wrong column order +CREATE TABLE tt4 (x int); -- too few columns +CREATE TABLE tt5 (x int, y numeric(8,2), z int); -- too few columns +CREATE TABLE tt6 () INHERITS (tt0); -- can't have a parent +CREATE TABLE tt7 (x int, q text, y numeric(8,2)); +ALTER TABLE tt7 DROP q; -- OK + +ALTER TABLE tt0 OF tt_t0; +ALTER TABLE tt1 OF tt_t0; +ALTER TABLE tt2 OF tt_t0; +ALTER TABLE tt3 OF tt_t0; +ALTER TABLE tt4 OF tt_t0; +ALTER TABLE tt5 OF tt_t0; +ALTER TABLE tt6 OF tt_t0; +ALTER TABLE tt7 OF tt_t0; + +CREATE TYPE tt_t1 AS (x int, y numeric(8,2)); +ALTER TABLE tt7 OF tt_t1; -- reassign an already-typed table +ALTER TABLE tt7 NOT OF; +\d tt7 + +-- make sure we can drop a constraint on the parent but it remains on the child +CREATE TABLE test_drop_constr_parent (c text CHECK (c IS NOT NULL)); +CREATE TABLE test_drop_constr_child () INHERITS (test_drop_constr_parent); +ALTER TABLE ONLY test_drop_constr_parent DROP CONSTRAINT "test_drop_constr_parent_c_check"; +-- should fail +INSERT INTO test_drop_constr_child (c) VALUES (NULL); +DROP TABLE test_drop_constr_parent CASCADE; + +-- +-- IF EXISTS test +-- +ALTER TABLE IF EXISTS tt8 ADD COLUMN f int; +ALTER TABLE IF EXISTS tt8 ADD CONSTRAINT xxx PRIMARY KEY(f); +ALTER TABLE IF EXISTS tt8 ADD CHECK (f BETWEEN 0 AND 10); +ALTER TABLE IF EXISTS tt8 ALTER COLUMN f SET DEFAULT 0; +ALTER TABLE IF EXISTS tt8 RENAME COLUMN f TO f1; +ALTER TABLE IF EXISTS tt8 SET SCHEMA alter2; + +CREATE TABLE tt8(a int); +CREATE SCHEMA alter2; + +ALTER TABLE IF EXISTS tt8 ADD COLUMN f int; +ALTER TABLE IF EXISTS tt8 ADD CONSTRAINT xxx PRIMARY KEY(f); +ALTER TABLE IF EXISTS tt8 ADD CHECK (f BETWEEN 0 AND 10); +ALTER TABLE IF EXISTS tt8 ALTER COLUMN f SET DEFAULT 0; +ALTER TABLE IF EXISTS tt8 RENAME COLUMN f TO f1; +ALTER TABLE IF EXISTS tt8 SET SCHEMA alter2; + +\d alter2.tt8 + +DROP TABLE alter2.tt8; +DROP SCHEMA alter2; + +-- +-- Check conflicts between index and CHECK constraint names +-- +CREATE TABLE tt9(c integer); +ALTER TABLE tt9 ADD CHECK(c > 1); +ALTER TABLE tt9 ADD CHECK(c > 2); -- picks nonconflicting name +ALTER TABLE tt9 ADD CONSTRAINT foo CHECK(c > 3); +ALTER TABLE tt9 ADD CONSTRAINT foo CHECK(c > 4); -- fail, dup name +ALTER TABLE tt9 ADD UNIQUE(c); +ALTER TABLE tt9 ADD UNIQUE(c); -- picks nonconflicting name +ALTER TABLE tt9 ADD CONSTRAINT tt9_c_key UNIQUE(c); -- fail, dup name +ALTER TABLE tt9 ADD CONSTRAINT foo UNIQUE(c); -- fail, dup name +ALTER TABLE tt9 ADD CONSTRAINT tt9_c_key CHECK(c > 5); -- fail, dup name +ALTER TABLE tt9 ADD CONSTRAINT tt9_c_key2 CHECK(c > 6); +ALTER TABLE tt9 ADD UNIQUE(c); -- picks nonconflicting name +\d tt9 +DROP TABLE tt9; + + +-- Check that comments on constraints and indexes are not lost at ALTER TABLE. +CREATE TABLE comment_test ( + id int, + positive_col int CHECK (positive_col > 0), + indexed_col int, + CONSTRAINT comment_test_pk PRIMARY KEY (id)); +CREATE INDEX comment_test_index ON comment_test(indexed_col); + +COMMENT ON COLUMN comment_test.id IS 'Column ''id'' on comment_test'; +COMMENT ON INDEX comment_test_index IS 'Simple index on comment_test'; +COMMENT ON CONSTRAINT comment_test_positive_col_check ON comment_test IS 'CHECK constraint on comment_test.positive_col'; +COMMENT ON CONSTRAINT comment_test_pk ON comment_test IS 'PRIMARY KEY constraint of comment_test'; +COMMENT ON INDEX comment_test_pk IS 'Index backing the PRIMARY KEY of comment_test'; + +SELECT col_description('comment_test'::regclass, 1) as comment; +SELECT indexrelid::regclass::text as index, obj_description(indexrelid, 'pg_class') as comment FROM pg_index where indrelid = 'comment_test'::regclass ORDER BY 1, 2; +SELECT conname as constraint, obj_description(oid, 'pg_constraint') as comment FROM pg_constraint where conrelid = 'comment_test'::regclass ORDER BY 1, 2; + +-- Change the datatype of all the columns. ALTER TABLE is optimized to not +-- rebuild an index if the new data type is binary compatible with the old +-- one. Check do a dummy ALTER TABLE that doesn't change the datatype +-- first, to test that no-op codepath, and another one that does. +ALTER TABLE comment_test ALTER COLUMN indexed_col SET DATA TYPE int; +ALTER TABLE comment_test ALTER COLUMN indexed_col SET DATA TYPE text; +ALTER TABLE comment_test ALTER COLUMN id SET DATA TYPE int; +ALTER TABLE comment_test ALTER COLUMN id SET DATA TYPE text; +ALTER TABLE comment_test ALTER COLUMN positive_col SET DATA TYPE int; +ALTER TABLE comment_test ALTER COLUMN positive_col SET DATA TYPE bigint; + +-- Check that the comments are intact. +SELECT col_description('comment_test'::regclass, 1) as comment; +SELECT indexrelid::regclass::text as index, obj_description(indexrelid, 'pg_class') as comment FROM pg_index where indrelid = 'comment_test'::regclass ORDER BY 1, 2; +SELECT conname as constraint, obj_description(oid, 'pg_constraint') as comment FROM pg_constraint where conrelid = 'comment_test'::regclass ORDER BY 1, 2; + +-- Check compatibility for foreign keys and comments. This is done +-- separately as rebuilding the column type of the parent leads +-- to an error and would reduce the test scope. +CREATE TABLE comment_test_child ( + id text CONSTRAINT comment_test_child_fk REFERENCES comment_test); +CREATE INDEX comment_test_child_fk ON comment_test_child(id); +COMMENT ON COLUMN comment_test_child.id IS 'Column ''id'' on comment_test_child'; +COMMENT ON INDEX comment_test_child_fk IS 'Index backing the FOREIGN KEY of comment_test_child'; +COMMENT ON CONSTRAINT comment_test_child_fk ON comment_test_child IS 'FOREIGN KEY constraint of comment_test_child'; + +-- Change column type of parent +ALTER TABLE comment_test ALTER COLUMN id SET DATA TYPE text; +ALTER TABLE comment_test ALTER COLUMN id SET DATA TYPE int USING id::integer; + +-- Comments should be intact +SELECT col_description('comment_test_child'::regclass, 1) as comment; +SELECT indexrelid::regclass::text as index, obj_description(indexrelid, 'pg_class') as comment FROM pg_index where indrelid = 'comment_test_child'::regclass ORDER BY 1, 2; +SELECT conname as constraint, obj_description(oid, 'pg_constraint') as comment FROM pg_constraint where conrelid = 'comment_test_child'::regclass ORDER BY 1, 2; + +-- Check that we map relation oids to filenodes and back correctly. Only +-- display bad mappings so the test output doesn't change all the time. A +-- filenode function call can return NULL for a relation dropped concurrently +-- with the call's surrounding query, so ignore a NULL mapped_oid for +-- relations that no longer exist after all calls finish. +CREATE TEMP TABLE filenode_mapping AS +SELECT + oid, mapped_oid, reltablespace, relfilenode, relname +FROM pg_class, + pg_filenode_relation(reltablespace, pg_relation_filenode(oid)) AS mapped_oid +WHERE relkind IN ('r', 'i', 'S', 't', 'm') AND mapped_oid IS DISTINCT FROM oid; + +SELECT m.* FROM filenode_mapping m LEFT JOIN pg_class c ON c.oid = m.oid +WHERE c.oid IS NOT NULL OR m.mapped_oid IS NOT NULL; + +-- Checks on creating and manipulation of user defined relations in +-- pg_catalog. + +SHOW allow_system_table_mods; +-- disallowed because of search_path issues with pg_dump +CREATE TABLE pg_catalog.new_system_table(); +-- instead create in public first, move to catalog +CREATE TABLE new_system_table(id serial primary key, othercol text); +ALTER TABLE new_system_table SET SCHEMA pg_catalog; +ALTER TABLE new_system_table SET SCHEMA public; +ALTER TABLE new_system_table SET SCHEMA pg_catalog; +-- will be ignored -- already there: +ALTER TABLE new_system_table SET SCHEMA pg_catalog; +ALTER TABLE new_system_table RENAME TO old_system_table; +CREATE INDEX old_system_table__othercol ON old_system_table (othercol); +INSERT INTO old_system_table(othercol) VALUES ('somedata'), ('otherdata'); +UPDATE old_system_table SET id = -id; +DELETE FROM old_system_table WHERE othercol = 'somedata'; +TRUNCATE old_system_table; +ALTER TABLE old_system_table DROP CONSTRAINT new_system_table_pkey; +ALTER TABLE old_system_table DROP COLUMN othercol; +DROP TABLE old_system_table; + +-- set logged +CREATE UNLOGGED TABLE unlogged1(f1 SERIAL PRIMARY KEY, f2 TEXT); +-- check relpersistence of an unlogged table +SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1' +UNION ALL +SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^unlogged1' +UNION ALL +SELECT 'toast index', ri.relkind, ri.relpersistence FROM pg_class r join pg_class t ON t.oid = r.reltoastrelid JOIN pg_index i ON i.indrelid = t.oid JOIN pg_class ri ON ri.oid = i.indexrelid WHERE r.relname ~ '^unlogged1' +ORDER BY relname; +CREATE UNLOGGED TABLE unlogged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged1); -- foreign key +CREATE UNLOGGED TABLE unlogged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged3); -- self-referencing foreign key +ALTER TABLE unlogged3 SET LOGGED; -- skip self-referencing foreign key +ALTER TABLE unlogged2 SET LOGGED; -- fails because a foreign key to an unlogged table exists +ALTER TABLE unlogged1 SET LOGGED; +-- check relpersistence of an unlogged table after changing to permanent +SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1' +UNION ALL +SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^unlogged1' +UNION ALL +SELECT 'toast index', ri.relkind, ri.relpersistence FROM pg_class r join pg_class t ON t.oid = r.reltoastrelid JOIN pg_index i ON i.indrelid = t.oid JOIN pg_class ri ON ri.oid = i.indexrelid WHERE r.relname ~ '^unlogged1' +ORDER BY relname; +ALTER TABLE unlogged1 SET LOGGED; -- silently do nothing +DROP TABLE unlogged3; +DROP TABLE unlogged2; +DROP TABLE unlogged1; +-- set unlogged +CREATE TABLE logged1(f1 SERIAL PRIMARY KEY, f2 TEXT); +-- check relpersistence of a permanent table +SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^logged1' +UNION ALL +SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^logged1' +UNION ALL +SELECT 'toast index', ri.relkind, ri.relpersistence FROM pg_class r join pg_class t ON t.oid = r.reltoastrelid JOIN pg_index i ON i.indrelid = t.oid JOIN pg_class ri ON ri.oid = i.indexrelid WHERE r.relname ~ '^logged1' +ORDER BY relname; +CREATE TABLE logged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES logged1); -- foreign key +CREATE TABLE logged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES logged3); -- self-referencing foreign key +ALTER TABLE logged1 SET UNLOGGED; -- fails because a foreign key from a permanent table exists +ALTER TABLE logged3 SET UNLOGGED; -- skip self-referencing foreign key +ALTER TABLE logged2 SET UNLOGGED; +ALTER TABLE logged1 SET UNLOGGED; +-- check relpersistence of a permanent table after changing to unlogged +SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^logged1' +UNION ALL +SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^logged1' +UNION ALL +SELECT 'toast index', ri.relkind, ri.relpersistence FROM pg_class r join pg_class t ON t.oid = r.reltoastrelid JOIN pg_index i ON i.indrelid = t.oid JOIN pg_class ri ON ri.oid = i.indexrelid WHERE r.relname ~ '^logged1' +ORDER BY relname; +ALTER TABLE logged1 SET UNLOGGED; -- silently do nothing +DROP TABLE logged3; +DROP TABLE logged2; +DROP TABLE logged1; + +-- test ADD COLUMN IF NOT EXISTS +CREATE TABLE test_add_column(c1 integer); +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN c2 integer; +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN c2 integer; -- fail because c2 already exists +ALTER TABLE ONLY test_add_column + ADD COLUMN c2 integer; -- fail because c2 already exists +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN IF NOT EXISTS c2 integer; -- skipping because c2 already exists +ALTER TABLE ONLY test_add_column + ADD COLUMN IF NOT EXISTS c2 integer; -- skipping because c2 already exists +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN c2 integer, -- fail because c2 already exists + ADD COLUMN c3 integer primary key; +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN IF NOT EXISTS c2 integer, -- skipping because c2 already exists + ADD COLUMN c3 integer primary key; +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN IF NOT EXISTS c2 integer, -- skipping because c2 already exists + ADD COLUMN IF NOT EXISTS c3 integer primary key; -- skipping because c3 already exists +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN IF NOT EXISTS c2 integer, -- skipping because c2 already exists + ADD COLUMN IF NOT EXISTS c3 integer, -- skipping because c3 already exists + ADD COLUMN c4 integer REFERENCES test_add_column; +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN IF NOT EXISTS c4 integer REFERENCES test_add_column; +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN IF NOT EXISTS c5 SERIAL CHECK (c5 > 8); +\d test_add_column +ALTER TABLE test_add_column + ADD COLUMN IF NOT EXISTS c5 SERIAL CHECK (c5 > 10); +\d test_add_column* +DROP TABLE test_add_column; +\d test_add_column* + +-- assorted cases with multiple ALTER TABLE steps +CREATE TABLE ataddindex(f1 INT); +INSERT INTO ataddindex VALUES (42), (43); +CREATE UNIQUE INDEX ataddindexi0 ON ataddindex(f1); +ALTER TABLE ataddindex + ADD PRIMARY KEY USING INDEX ataddindexi0, + ALTER f1 TYPE BIGINT; +\d ataddindex +DROP TABLE ataddindex; + +CREATE TABLE ataddindex(f1 VARCHAR(10)); +INSERT INTO ataddindex(f1) VALUES ('foo'), ('a'); +ALTER TABLE ataddindex + ALTER f1 SET DATA TYPE TEXT, + ADD EXCLUDE ((f1 LIKE 'a') WITH =); +\d ataddindex +DROP TABLE ataddindex; + +-- unsupported constraint types for partitioned tables +CREATE TABLE partitioned ( + a int, + b int +) PARTITION BY RANGE (a, (a+b+1)); +ALTER TABLE partitioned ADD EXCLUDE USING gist (a WITH &&); + +-- cannot drop column that is part of the partition key +ALTER TABLE partitioned DROP COLUMN a; +ALTER TABLE partitioned ALTER COLUMN a TYPE char(5); +ALTER TABLE partitioned DROP COLUMN b; +ALTER TABLE partitioned ALTER COLUMN b TYPE char(5); + +-- partitioned table cannot participate in regular inheritance +CREATE TABLE nonpartitioned ( + a int, + b int +); +ALTER TABLE partitioned INHERIT nonpartitioned; +ALTER TABLE nonpartitioned INHERIT partitioned; + +-- cannot add NO INHERIT constraint to partitioned tables +ALTER TABLE partitioned ADD CONSTRAINT chk_a CHECK (a > 0) NO INHERIT; + +DROP TABLE partitioned, nonpartitioned; + +-- +-- ATTACH PARTITION +-- + +-- check that target table is partitioned +CREATE TABLE unparted ( + a int +); +CREATE TABLE fail_part (like unparted); +ALTER TABLE unparted ATTACH PARTITION fail_part FOR VALUES IN ('a'); +DROP TABLE unparted, fail_part; + +-- check that partition bound is compatible +CREATE TABLE list_parted ( + a int NOT NULL, + b char(2) COLLATE "C", + CONSTRAINT check_a CHECK (a > 0) +) PARTITION BY LIST (a); +CREATE TABLE fail_part (LIKE list_parted); +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES FROM (1) TO (10); +DROP TABLE fail_part; + +-- check that the table being attached exists +ALTER TABLE list_parted ATTACH PARTITION nonexistent FOR VALUES IN (1); + +-- check ownership of the source table +CREATE ROLE regress_test_me; +CREATE ROLE regress_test_not_me; +CREATE TABLE not_owned_by_me (LIKE list_parted); +ALTER TABLE not_owned_by_me OWNER TO regress_test_not_me; +SET SESSION AUTHORIZATION regress_test_me; +CREATE TABLE owned_by_me ( + a int +) PARTITION BY LIST (a); +ALTER TABLE owned_by_me ATTACH PARTITION not_owned_by_me FOR VALUES IN (1); +RESET SESSION AUTHORIZATION; +DROP TABLE owned_by_me, not_owned_by_me; +DROP ROLE regress_test_not_me; +DROP ROLE regress_test_me; + +-- check that the table being attached is not part of regular inheritance +CREATE TABLE parent (LIKE list_parted); +CREATE TABLE child () INHERITS (parent); +ALTER TABLE list_parted ATTACH PARTITION child FOR VALUES IN (1); +ALTER TABLE list_parted ATTACH PARTITION parent FOR VALUES IN (1); +DROP TABLE parent CASCADE; + +-- check any TEMP-ness +CREATE TEMP TABLE temp_parted (a int) PARTITION BY LIST (a); +CREATE TABLE perm_part (a int); +ALTER TABLE temp_parted ATTACH PARTITION perm_part FOR VALUES IN (1); +DROP TABLE temp_parted, perm_part; + +-- check that the table being attached is not a typed table +CREATE TYPE mytype AS (a int); +CREATE TABLE fail_part OF mytype; +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES IN (1); +DROP TYPE mytype CASCADE; + +-- check that the table being attached has only columns present in the parent +CREATE TABLE fail_part (like list_parted, c int); +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES IN (1); +DROP TABLE fail_part; + +-- check that the table being attached has every column of the parent +CREATE TABLE fail_part (a int NOT NULL); +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES IN (1); +DROP TABLE fail_part; + +-- check that columns match in type, collation and NOT NULL status +CREATE TABLE fail_part ( + b char(3), + a int NOT NULL +); +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES IN (1); +ALTER TABLE fail_part ALTER b TYPE char (2) COLLATE "POSIX"; +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES IN (1); +DROP TABLE fail_part; + +-- check that the table being attached has all constraints of the parent +CREATE TABLE fail_part ( + b char(2) COLLATE "C", + a int NOT NULL +); +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES IN (1); + +-- check that the constraint matches in definition with parent's constraint +ALTER TABLE fail_part ADD CONSTRAINT check_a CHECK (a >= 0); +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES IN (1); +DROP TABLE fail_part; + +-- check the attributes and constraints after partition is attached +CREATE TABLE part_1 ( + a int NOT NULL, + b char(2) COLLATE "C", + CONSTRAINT check_a CHECK (a > 0) +); +ALTER TABLE list_parted ATTACH PARTITION part_1 FOR VALUES IN (1); +-- attislocal and conislocal are always false for merged attributes and constraints respectively. +SELECT attislocal, attinhcount FROM pg_attribute WHERE attrelid = 'part_1'::regclass AND attnum > 0; +SELECT conislocal, coninhcount FROM pg_constraint WHERE conrelid = 'part_1'::regclass AND conname = 'check_a'; + +-- check that the new partition won't overlap with an existing partition +CREATE TABLE fail_part (LIKE part_1 INCLUDING CONSTRAINTS); +ALTER TABLE list_parted ATTACH PARTITION fail_part FOR VALUES IN (1); +DROP TABLE fail_part; +-- check that an existing table can be attached as a default partition +CREATE TABLE def_part (LIKE list_parted INCLUDING CONSTRAINTS); +ALTER TABLE list_parted ATTACH PARTITION def_part DEFAULT; +-- check attaching default partition fails if a default partition already +-- exists +CREATE TABLE fail_def_part (LIKE part_1 INCLUDING CONSTRAINTS); +ALTER TABLE list_parted ATTACH PARTITION fail_def_part DEFAULT; + +-- check validation when attaching list partitions +CREATE TABLE list_parted2 ( + a int, + b char +) PARTITION BY LIST (a); + +-- check that violating rows are correctly reported +CREATE TABLE part_2 (LIKE list_parted2); +INSERT INTO part_2 VALUES (3, 'a'); +ALTER TABLE list_parted2 ATTACH PARTITION part_2 FOR VALUES IN (2); + +-- should be ok after deleting the bad row +DELETE FROM part_2; +ALTER TABLE list_parted2 ATTACH PARTITION part_2 FOR VALUES IN (2); + +-- check partition cannot be attached if default has some row for its values +CREATE TABLE list_parted2_def PARTITION OF list_parted2 DEFAULT; +INSERT INTO list_parted2_def VALUES (11, 'z'); +CREATE TABLE part_3 (LIKE list_parted2); +ALTER TABLE list_parted2 ATTACH PARTITION part_3 FOR VALUES IN (11); +-- should be ok after deleting the bad row +DELETE FROM list_parted2_def WHERE a = 11; +ALTER TABLE list_parted2 ATTACH PARTITION part_3 FOR VALUES IN (11); + +-- adding constraints that describe the desired partition constraint +-- (or more restrictive) will help skip the validation scan +CREATE TABLE part_3_4 ( + LIKE list_parted2, + CONSTRAINT check_a CHECK (a IN (3)) +); + +-- however, if a list partition does not accept nulls, there should be +-- an explicit NOT NULL constraint on the partition key column for the +-- validation scan to be skipped; +ALTER TABLE list_parted2 ATTACH PARTITION part_3_4 FOR VALUES IN (3, 4); + +-- adding a NOT NULL constraint will cause the scan to be skipped +ALTER TABLE list_parted2 DETACH PARTITION part_3_4; +ALTER TABLE part_3_4 ALTER a SET NOT NULL; +ALTER TABLE list_parted2 ATTACH PARTITION part_3_4 FOR VALUES IN (3, 4); + +-- check if default partition scan skipped +ALTER TABLE list_parted2_def ADD CONSTRAINT check_a CHECK (a IN (5, 6)); +CREATE TABLE part_55_66 PARTITION OF list_parted2 FOR VALUES IN (55, 66); + +-- check validation when attaching range partitions +CREATE TABLE range_parted ( + a int, + b int +) PARTITION BY RANGE (a, b); + +-- check that violating rows are correctly reported +CREATE TABLE part1 ( + a int NOT NULL CHECK (a = 1), + b int NOT NULL CHECK (b >= 1 AND b <= 10) +); +INSERT INTO part1 VALUES (1, 10); +-- Remember the TO bound is exclusive +ALTER TABLE range_parted ATTACH PARTITION part1 FOR VALUES FROM (1, 1) TO (1, 10); + +-- should be ok after deleting the bad row +DELETE FROM part1; +ALTER TABLE range_parted ATTACH PARTITION part1 FOR VALUES FROM (1, 1) TO (1, 10); + +-- adding constraints that describe the desired partition constraint +-- (or more restrictive) will help skip the validation scan +CREATE TABLE part2 ( + a int NOT NULL CHECK (a = 1), + b int NOT NULL CHECK (b >= 10 AND b < 18) +); +ALTER TABLE range_parted ATTACH PARTITION part2 FOR VALUES FROM (1, 10) TO (1, 20); + +-- Create default partition +CREATE TABLE partr_def1 PARTITION OF range_parted DEFAULT; + +-- Only one default partition is allowed, hence, following should give error +CREATE TABLE partr_def2 (LIKE part1 INCLUDING CONSTRAINTS); +ALTER TABLE range_parted ATTACH PARTITION partr_def2 DEFAULT; + +-- Overlapping partitions cannot be attached, hence, following should give error +INSERT INTO partr_def1 VALUES (2, 10); +CREATE TABLE part3 (LIKE range_parted); +ALTER TABLE range_parted ATTACH partition part3 FOR VALUES FROM (2, 10) TO (2, 20); + +-- Attaching partitions should be successful when there are no overlapping rows +ALTER TABLE range_parted ATTACH partition part3 FOR VALUES FROM (3, 10) TO (3, 20); + +-- check that leaf partitions are scanned when attaching a partitioned +-- table +CREATE TABLE part_5 ( + LIKE list_parted2 +) PARTITION BY LIST (b); + +-- check that violating rows are correctly reported +CREATE TABLE part_5_a PARTITION OF part_5 FOR VALUES IN ('a'); +INSERT INTO part_5_a (a, b) VALUES (6, 'a'); +ALTER TABLE list_parted2 ATTACH PARTITION part_5 FOR VALUES IN (5); + +-- delete the faulting row and also add a constraint to skip the scan +DELETE FROM part_5_a WHERE a NOT IN (3); +ALTER TABLE part_5 ADD CONSTRAINT check_a CHECK (a IS NOT NULL AND a = 5); +ALTER TABLE list_parted2 ATTACH PARTITION part_5 FOR VALUES IN (5); +ALTER TABLE list_parted2 DETACH PARTITION part_5; +ALTER TABLE part_5 DROP CONSTRAINT check_a; + +-- scan should again be skipped, even though NOT NULL is now a column property +ALTER TABLE part_5 ADD CONSTRAINT check_a CHECK (a IN (5)), ALTER a SET NOT NULL; +ALTER TABLE list_parted2 ATTACH PARTITION part_5 FOR VALUES IN (5); + +-- Check the case where attnos of the partitioning columns in the table being +-- attached differs from the parent. It should not affect the constraint- +-- checking logic that allows to skip the scan. +CREATE TABLE part_6 ( + c int, + LIKE list_parted2, + CONSTRAINT check_a CHECK (a IS NOT NULL AND a = 6) +); +ALTER TABLE part_6 DROP c; +ALTER TABLE list_parted2 ATTACH PARTITION part_6 FOR VALUES IN (6); + +-- Similar to above, but the table being attached is a partitioned table +-- whose partition has still different attnos for the root partitioning +-- columns. +CREATE TABLE part_7 ( + LIKE list_parted2, + CONSTRAINT check_a CHECK (a IS NOT NULL AND a = 7) +) PARTITION BY LIST (b); +CREATE TABLE part_7_a_null ( + c int, + d int, + e int, + LIKE list_parted2, -- 'a' will have attnum = 4 + CONSTRAINT check_b CHECK (b IS NULL OR b = 'a'), + CONSTRAINT check_a CHECK (a IS NOT NULL AND a = 7) +); +ALTER TABLE part_7_a_null DROP c, DROP d, DROP e; +ALTER TABLE part_7 ATTACH PARTITION part_7_a_null FOR VALUES IN ('a', null); +ALTER TABLE list_parted2 ATTACH PARTITION part_7 FOR VALUES IN (7); + +-- Same example, but check this time that the constraint correctly detects +-- violating rows +ALTER TABLE list_parted2 DETACH PARTITION part_7; +ALTER TABLE part_7 DROP CONSTRAINT check_a; -- thusly, scan won't be skipped +INSERT INTO part_7 (a, b) VALUES (8, null), (9, 'a'); +SELECT tableoid::regclass, a, b FROM part_7 order by a; +ALTER TABLE list_parted2 ATTACH PARTITION part_7 FOR VALUES IN (7); + +-- check that leaf partitions of default partition are scanned when +-- attaching a partitioned table. +ALTER TABLE part_5 DROP CONSTRAINT check_a; +CREATE TABLE part5_def PARTITION OF part_5 DEFAULT PARTITION BY LIST(a); +CREATE TABLE part5_def_p1 PARTITION OF part5_def FOR VALUES IN (5); +INSERT INTO part5_def_p1 VALUES (5, 'y'); +CREATE TABLE part5_p1 (LIKE part_5); +ALTER TABLE part_5 ATTACH PARTITION part5_p1 FOR VALUES IN ('y'); +-- should be ok after deleting the bad row +DELETE FROM part5_def_p1 WHERE b = 'y'; +ALTER TABLE part_5 ATTACH PARTITION part5_p1 FOR VALUES IN ('y'); + +-- check that the table being attached is not already a partition +ALTER TABLE list_parted2 ATTACH PARTITION part_2 FOR VALUES IN (2); + +-- check that circular inheritance is not allowed +ALTER TABLE part_5 ATTACH PARTITION list_parted2 FOR VALUES IN ('b'); +ALTER TABLE list_parted2 ATTACH PARTITION list_parted2 FOR VALUES IN (0); + +-- If a partitioned table being created or an existing table being attached +-- as a partition does not have a constraint that would allow validation scan +-- to be skipped, but an individual partition does, then the partition's +-- validation scan is skipped. +CREATE TABLE quuux (a int, b text) PARTITION BY LIST (a); +CREATE TABLE quuux_default PARTITION OF quuux DEFAULT PARTITION BY LIST (b); +CREATE TABLE quuux_default1 PARTITION OF quuux_default ( + CONSTRAINT check_1 CHECK (a IS NOT NULL AND a = 1) +) FOR VALUES IN ('b'); +CREATE TABLE quuux1 (a int, b text); +ALTER TABLE quuux ATTACH PARTITION quuux1 FOR VALUES IN (1); -- validate! +CREATE TABLE quuux2 (a int, b text); +ALTER TABLE quuux ATTACH PARTITION quuux2 FOR VALUES IN (2); -- skip validation +DROP TABLE quuux1, quuux2; +-- should validate for quuux1, but not for quuux2 +CREATE TABLE quuux1 PARTITION OF quuux FOR VALUES IN (1); +CREATE TABLE quuux2 PARTITION OF quuux FOR VALUES IN (2); +DROP TABLE quuux; + +-- check validation when attaching hash partitions + +-- Use hand-rolled hash functions and operator class to get predictable result +-- on different machines. part_test_int4_ops is defined in insert.sql. + +-- check that the new partition won't overlap with an existing partition +CREATE TABLE hash_parted ( + a int, + b int +) PARTITION BY HASH (a part_test_int4_ops); +CREATE TABLE hpart_1 PARTITION OF hash_parted FOR VALUES WITH (MODULUS 4, REMAINDER 0); +CREATE TABLE fail_part (LIKE hpart_1); +ALTER TABLE hash_parted ATTACH PARTITION fail_part FOR VALUES WITH (MODULUS 8, REMAINDER 4); +ALTER TABLE hash_parted ATTACH PARTITION fail_part FOR VALUES WITH (MODULUS 8, REMAINDER 0); +DROP TABLE fail_part; + +-- check validation when attaching hash partitions + +-- check that violating rows are correctly reported +CREATE TABLE hpart_2 (LIKE hash_parted); +INSERT INTO hpart_2 VALUES (3, 0); +ALTER TABLE hash_parted ATTACH PARTITION hpart_2 FOR VALUES WITH (MODULUS 4, REMAINDER 1); + +-- should be ok after deleting the bad row +DELETE FROM hpart_2; +ALTER TABLE hash_parted ATTACH PARTITION hpart_2 FOR VALUES WITH (MODULUS 4, REMAINDER 1); + +-- check that leaf partitions are scanned when attaching a partitioned +-- table +CREATE TABLE hpart_5 ( + LIKE hash_parted +) PARTITION BY LIST (b); + +-- check that violating rows are correctly reported +CREATE TABLE hpart_5_a PARTITION OF hpart_5 FOR VALUES IN ('1', '2', '3'); +INSERT INTO hpart_5_a (a, b) VALUES (7, 1); +ALTER TABLE hash_parted ATTACH PARTITION hpart_5 FOR VALUES WITH (MODULUS 4, REMAINDER 2); + +-- should be ok after deleting the bad row +DELETE FROM hpart_5_a; +ALTER TABLE hash_parted ATTACH PARTITION hpart_5 FOR VALUES WITH (MODULUS 4, REMAINDER 2); + +-- check that the table being attach is with valid modulus and remainder value +CREATE TABLE fail_part(LIKE hash_parted); +ALTER TABLE hash_parted ATTACH PARTITION fail_part FOR VALUES WITH (MODULUS 0, REMAINDER 1); +ALTER TABLE hash_parted ATTACH PARTITION fail_part FOR VALUES WITH (MODULUS 8, REMAINDER 8); +ALTER TABLE hash_parted ATTACH PARTITION fail_part FOR VALUES WITH (MODULUS 3, REMAINDER 2); +DROP TABLE fail_part; + +-- +-- DETACH PARTITION +-- + +-- check that the table is partitioned at all +CREATE TABLE regular_table (a int); +ALTER TABLE regular_table DETACH PARTITION any_name; +DROP TABLE regular_table; + +-- check that the partition being detached exists at all +ALTER TABLE list_parted2 DETACH PARTITION part_4; +ALTER TABLE hash_parted DETACH PARTITION hpart_4; + +-- check that the partition being detached is actually a partition of the parent +CREATE TABLE not_a_part (a int); +ALTER TABLE list_parted2 DETACH PARTITION not_a_part; +ALTER TABLE list_parted2 DETACH PARTITION part_1; + +ALTER TABLE hash_parted DETACH PARTITION not_a_part; +DROP TABLE not_a_part; + +-- check that, after being detached, attinhcount/coninhcount is dropped to 0 and +-- attislocal/conislocal is set to true +ALTER TABLE list_parted2 DETACH PARTITION part_3_4; +SELECT attinhcount, attislocal FROM pg_attribute WHERE attrelid = 'part_3_4'::regclass AND attnum > 0; +SELECT coninhcount, conislocal FROM pg_constraint WHERE conrelid = 'part_3_4'::regclass AND conname = 'check_a'; +DROP TABLE part_3_4; + +-- check that a detached partition is not dropped on dropping a partitioned table +CREATE TABLE range_parted2 ( + a int +) PARTITION BY RANGE(a); +CREATE TABLE part_rp PARTITION OF range_parted2 FOR VALUES FROM (0) to (100); +ALTER TABLE range_parted2 DETACH PARTITION part_rp; +DROP TABLE range_parted2; +SELECT * from part_rp; +DROP TABLE part_rp; + +-- Check ALTER TABLE commands for partitioned tables and partitions + +-- cannot add/drop column to/from *only* the parent +ALTER TABLE ONLY list_parted2 ADD COLUMN c int; +ALTER TABLE ONLY list_parted2 DROP COLUMN b; + +-- cannot add a column to partition or drop an inherited one +ALTER TABLE part_2 ADD COLUMN c text; +ALTER TABLE part_2 DROP COLUMN b; + +-- Nor rename, alter type +ALTER TABLE part_2 RENAME COLUMN b to c; +ALTER TABLE part_2 ALTER COLUMN b TYPE text; + +-- cannot add/drop NOT NULL or check constraints to *only* the parent, when +-- partitions exist +ALTER TABLE ONLY list_parted2 ALTER b SET NOT NULL; +ALTER TABLE ONLY list_parted2 ADD CONSTRAINT check_b CHECK (b <> 'zz'); + +ALTER TABLE list_parted2 ALTER b SET NOT NULL; +ALTER TABLE ONLY list_parted2 ALTER b DROP NOT NULL; +ALTER TABLE list_parted2 ADD CONSTRAINT check_b CHECK (b <> 'zz'); +ALTER TABLE ONLY list_parted2 DROP CONSTRAINT check_b; + +-- It's alright though, if no partitions are yet created +CREATE TABLE parted_no_parts (a int) PARTITION BY LIST (a); +ALTER TABLE ONLY parted_no_parts ALTER a SET NOT NULL; +ALTER TABLE ONLY parted_no_parts ADD CONSTRAINT check_a CHECK (a > 0); +ALTER TABLE ONLY parted_no_parts ALTER a DROP NOT NULL; +ALTER TABLE ONLY parted_no_parts DROP CONSTRAINT check_a; +DROP TABLE parted_no_parts; + +-- cannot drop inherited NOT NULL or check constraints from partition +ALTER TABLE list_parted2 ALTER b SET NOT NULL, ADD CONSTRAINT check_a2 CHECK (a > 0); +ALTER TABLE part_2 ALTER b DROP NOT NULL; +ALTER TABLE part_2 DROP CONSTRAINT check_a2; + +-- Doesn't make sense to add NO INHERIT constraints on partitioned tables +ALTER TABLE list_parted2 add constraint check_b2 check (b <> 'zz') NO INHERIT; + +-- check that a partition cannot participate in regular inheritance +CREATE TABLE inh_test () INHERITS (part_2); +CREATE TABLE inh_test (LIKE part_2); +ALTER TABLE inh_test INHERIT part_2; +ALTER TABLE part_2 INHERIT inh_test; + +-- cannot drop or alter type of partition key columns of lower level +-- partitioned tables; for example, part_5, which is list_parted2's +-- partition, is partitioned on b; +ALTER TABLE list_parted2 DROP COLUMN b; +ALTER TABLE list_parted2 ALTER COLUMN b TYPE text; + +-- dropping non-partition key columns should be allowed on the parent table. +ALTER TABLE list_parted DROP COLUMN b; +SELECT * FROM list_parted; + +-- cleanup +DROP TABLE list_parted, list_parted2, range_parted; +DROP TABLE fail_def_part; +DROP TABLE hash_parted; + +-- more tests for certain multi-level partitioning scenarios +create table p (a int, b int) partition by range (a, b); +create table p1 (b int, a int not null) partition by range (b); +create table p11 (like p1); +alter table p11 drop a; +alter table p11 add a int; +alter table p11 drop a; +alter table p11 add a int not null; +-- attnum for key attribute 'a' is different in p, p1, and p11 +select attrelid::regclass, attname, attnum +from pg_attribute +where attname = 'a' + and (attrelid = 'p'::regclass + or attrelid = 'p1'::regclass + or attrelid = 'p11'::regclass) +order by attrelid::regclass::text; + +alter table p1 attach partition p11 for values from (2) to (5); + +insert into p1 (a, b) values (2, 3); +-- check that partition validation scan correctly detects violating rows +alter table p attach partition p1 for values from (1, 2) to (1, 10); + +-- cleanup +drop table p; +drop table p1; + +-- validate constraint on partitioned tables should only scan leaf partitions +create table parted_validate_test (a int) partition by list (a); +create table parted_validate_test_1 partition of parted_validate_test for values in (0, 1); +alter table parted_validate_test add constraint parted_validate_test_chka check (a > 0) not valid; +alter table parted_validate_test validate constraint parted_validate_test_chka; +drop table parted_validate_test; +-- test alter column options +CREATE TABLE attmp(i integer); +INSERT INTO attmp VALUES (1); +ALTER TABLE attmp ALTER COLUMN i SET (n_distinct = 1, n_distinct_inherited = 2); +ALTER TABLE attmp ALTER COLUMN i RESET (n_distinct_inherited); +ANALYZE attmp; +DROP TABLE attmp; + +DROP USER regress_alter_table_user1; + +-- check that violating rows are correctly reported when attaching as the +-- default partition +create table defpart_attach_test (a int) partition by list (a); +create table defpart_attach_test1 partition of defpart_attach_test for values in (1); +create table defpart_attach_test_d (b int, a int); +alter table defpart_attach_test_d drop b; +insert into defpart_attach_test_d values (1), (2); + +-- error because its constraint as the default partition would be violated +-- by the row containing 1 +alter table defpart_attach_test attach partition defpart_attach_test_d default; +delete from defpart_attach_test_d where a = 1; +alter table defpart_attach_test_d add check (a > 1); + +-- should be attached successfully and without needing to be scanned +alter table defpart_attach_test attach partition defpart_attach_test_d default; + +-- check that attaching a partition correctly reports any rows in the default +-- partition that should not be there for the new partition to be attached +-- successfully +create table defpart_attach_test_2 (like defpart_attach_test_d); +alter table defpart_attach_test attach partition defpart_attach_test_2 for values in (2); + +drop table defpart_attach_test; + +-- check combinations of temporary and permanent relations when attaching +-- partitions. +create table perm_part_parent (a int) partition by list (a); +create temp table temp_part_parent (a int) partition by list (a); +create table perm_part_child (a int); +create temp table temp_part_child (a int); +alter table temp_part_parent attach partition perm_part_child default; -- error +alter table perm_part_parent attach partition temp_part_child default; -- error +alter table temp_part_parent attach partition temp_part_child default; -- ok +drop table perm_part_parent cascade; +drop table temp_part_parent cascade; + +-- check that attaching partitions to a table while it is being used is +-- prevented +create table tab_part_attach (a int) partition by list (a); +create or replace function func_part_attach() returns trigger + language plpgsql as $$ + begin + execute 'create table tab_part_attach_1 (a int)'; + execute 'alter table tab_part_attach attach partition tab_part_attach_1 for values in (1)'; + return null; + end $$; +create trigger trig_part_attach before insert on tab_part_attach + for each statement execute procedure func_part_attach(); +insert into tab_part_attach values (1); +drop table tab_part_attach; +drop function func_part_attach(); + +-- test case where the partitioning operator is a SQL function whose +-- evaluation results in the table's relcache being rebuilt partway through +-- the execution of an ATTACH PARTITION command +create function at_test_sql_partop (int4, int4) returns int language sql +as $$ select case when $1 = $2 then 0 when $1 > $2 then 1 else -1 end; $$; +create operator class at_test_sql_partop for type int4 using btree as + operator 1 < (int4, int4), operator 2 <= (int4, int4), + operator 3 = (int4, int4), operator 4 >= (int4, int4), + operator 5 > (int4, int4), function 1 at_test_sql_partop(int4, int4); +create table at_test_sql_partop (a int) partition by range (a at_test_sql_partop); +create table at_test_sql_partop_1 (a int); +alter table at_test_sql_partop attach partition at_test_sql_partop_1 for values from (0) to (10); +drop table at_test_sql_partop; +drop operator class at_test_sql_partop using btree; +drop function at_test_sql_partop; + + +/* Test case for bug #16242 */ + +-- We create a parent and child where the child has missing +-- non-null attribute values, and arrange to pass them through +-- tuple conversion from the child to the parent tupdesc +create table bar1 (a integer, b integer not null default 1) + partition by range (a); +create table bar2 (a integer); +insert into bar2 values (1); +alter table bar2 add column b integer not null default 1; +-- (at this point bar2 contains tuple with natts=1) +alter table bar1 attach partition bar2 default; + +-- this works: +select * from bar1; + +-- this exercises tuple conversion: +create function xtrig() + returns trigger language plpgsql +as $$ + declare + r record; + begin + for r in select * from old loop + raise info 'a=%, b=%', r.a, r.b; + end loop; + return NULL; + end; +$$; +create trigger xtrig + after update on bar1 + referencing old table as old + for each statement execute procedure xtrig(); + +update bar1 set a = a + 1; + +/* End test case for bug #16242 */ + +-- Test that ALTER TABLE rewrite preserves a clustered index +-- for normal indexes and indexes on constraints. +create table alttype_cluster (a int); +alter table alttype_cluster add primary key (a); +create index alttype_cluster_ind on alttype_cluster (a); +alter table alttype_cluster cluster on alttype_cluster_ind; +-- Normal index remains clustered. +select indexrelid::regclass, indisclustered from pg_index + where indrelid = 'alttype_cluster'::regclass + order by indexrelid::regclass::text; +alter table alttype_cluster alter a type bigint; +select indexrelid::regclass, indisclustered from pg_index + where indrelid = 'alttype_cluster'::regclass + order by indexrelid::regclass::text; +-- Constraint index remains clustered. +alter table alttype_cluster cluster on alttype_cluster_pkey; +select indexrelid::regclass, indisclustered +from pg_index +where indrelid = 'alttype_cluster'::regclass +order by indexrelid::regclass:: text; +alter table alttype_cluster + alter a type int; +select indexrelid::regclass, indisclustered +from pg_index +where indrelid = 'alttype_cluster'::regclass +order by indexrelid::regclass:: text; +drop table alttype_cluster; + +-- test comment on schema table column +create schema alter11; +create table alter11.alter_table +( + a int +); +comment on column alter11.alter_table.a is 'test comment with schema.table.column'; +drop table alter11.alter_table; +drop schema alter11; +-- end test comment on schema table column + diff --git a/postgresql/examples/amutils.sql b/postgresql/examples/amutils.sql new file mode 100644 index 0000000..06e7fa1 --- /dev/null +++ b/postgresql/examples/amutils.sql @@ -0,0 +1,99 @@ +-- +-- Test index AM property-reporting functions +-- + +select prop, + pg_indexam_has_property(a.oid, prop) as "AM", + pg_index_has_property('onek_hundred'::regclass, prop) as "Index", + pg_index_column_has_property('onek_hundred'::regclass, 1, prop) as "Column" + from pg_am a, + unnest(array['asc', 'desc', 'nulls_first', 'nulls_last', + 'orderable', 'distance_orderable', 'returnable', + 'search_array', 'search_nulls', + 'clusterable', 'index_scan', 'bitmap_scan', + 'backward_scan', + 'can_order', 'can_unique', 'can_multi_col', + 'can_exclude', 'can_include', + 'bogus']::text[]) + with ordinality as u(prop,ord) + where a.amname = 'btree' + order by ord; + +select prop, + pg_indexam_has_property(a.oid, prop) as "AM", + pg_index_has_property('gcircleind'::regclass, prop) as "Index", + pg_index_column_has_property('gcircleind'::regclass, 1, prop) as "Column" + from pg_am a, + unnest(array['asc', 'desc', 'nulls_first', 'nulls_last', + 'orderable', 'distance_orderable', 'returnable', + 'search_array', 'search_nulls', + 'clusterable', 'index_scan', 'bitmap_scan', + 'backward_scan', + 'can_order', 'can_unique', 'can_multi_col', + 'can_exclude', 'can_include', + 'bogus']::text[]) + with ordinality as u(prop,ord) + where a.amname = 'gist' + order by ord; + +select prop, + pg_index_column_has_property('onek_hundred'::regclass, 1, prop) as btree, + pg_index_column_has_property('hash_i4_index'::regclass, 1, prop) as hash, + pg_index_column_has_property('gcircleind'::regclass, 1, prop) as gist, + pg_index_column_has_property('sp_radix_ind'::regclass, 1, prop) as spgist_radix, + pg_index_column_has_property('sp_quad_ind'::regclass, 1, prop) as spgist_quad, + pg_index_column_has_property('botharrayidx'::regclass, 1, prop) as gin, + pg_index_column_has_property('brinidx'::regclass, 1, prop) as brin + from unnest(array['asc', 'desc', 'nulls_first', 'nulls_last', + 'orderable', 'distance_orderable', 'returnable', + 'search_array', 'search_nulls', + 'bogus']::text[]) + with ordinality as u(prop,ord) + order by ord; + +select prop, + pg_index_has_property('onek_hundred'::regclass, prop) as btree, + pg_index_has_property('hash_i4_index'::regclass, prop) as hash, + pg_index_has_property('gcircleind'::regclass, prop) as gist, + pg_index_has_property('sp_radix_ind'::regclass, prop) as spgist, + pg_index_has_property('botharrayidx'::regclass, prop) as gin, + pg_index_has_property('brinidx'::regclass, prop) as brin + from unnest(array['clusterable', 'index_scan', 'bitmap_scan', + 'backward_scan', + 'bogus']::text[]) + with ordinality as u(prop,ord) + order by ord; + +select amname, prop, pg_indexam_has_property(a.oid, prop) as p + from pg_am a, + unnest(array['can_order', 'can_unique', 'can_multi_col', + 'can_exclude', 'can_include', 'bogus']::text[]) + with ordinality as u(prop,ord) + where amtype = 'i' + order by amname, ord; + +-- +-- additional checks for pg_index_column_has_property +-- +CREATE TEMP TABLE foo (f1 int, f2 int, f3 int, f4 int); + +CREATE INDEX fooindex ON foo (f1 desc, f2 asc, f3 nulls first, f4 nulls last); + +select col, prop, pg_index_column_has_property(o, col, prop) + from (values ('fooindex'::regclass)) v1(o), + (values (1,'orderable'),(2,'asc'),(3,'desc'), + (4,'nulls_first'),(5,'nulls_last'), + (6, 'bogus')) v2(idx,prop), + generate_series(1,4) col + order by col, idx; + +CREATE INDEX foocover ON foo (f1) INCLUDE (f2,f3); + +select col, prop, pg_index_column_has_property(o, col, prop) + from (values ('foocover'::regclass)) v1(o), + (values (1,'orderable'),(2,'asc'),(3,'desc'), + (4,'nulls_first'),(5,'nulls_last'), + (6,'distance_orderable'),(7,'returnable'), + (8, 'bogus')) v2(idx,prop), + generate_series(1,3) col + order by col, idx; diff --git a/postgresql/examples/arrays.sql b/postgresql/examples/arrays.sql new file mode 100644 index 0000000..0224c78 --- /dev/null +++ b/postgresql/examples/arrays.sql @@ -0,0 +1,702 @@ +-- +-- ARRAYS +-- + +CREATE TABLE arrtest ( + a int2[], + b int4[][][], + c name[], + d text[][], + e float8[], + f char(5)[], + g varchar(5)[] +); + +-- +-- only the 'e' array is 0-based, the others are 1-based. +-- + +INSERT INTO arrtest (a[1:5], b[1:1][1:2][1:2], c, d, f, g) + VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}'); + +UPDATE arrtest SET e[0] = '1.1'; + +UPDATE arrtest SET e[1] = '2.2'; + +INSERT INTO arrtest (f) + VALUES ('{"too long"}'); + +INSERT INTO arrtest (a, b[1:2][1:2], c, d, e, f, g) + VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}', + '{{"elt1", "elt2"}}', '{"3.4", "6.7"}', + '{"abc","abcde"}', '{"abc","abcde"}'); + +INSERT INTO arrtest (a, b[1:2], c, d[1:2]) + VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}'); + + +SELECT * FROM arrtest; + +SELECT arrtest.a[1], + arrtest.b[1][1][1], + arrtest.c[1], + arrtest.d[1][1], + arrtest.e[0] + FROM arrtest; + +SELECT a[1], b[1][1][1], c[1], d[1][1], e[0] + FROM arrtest; + +SELECT a[1:3], + b[1:1][1:2][1:2], + c[1:2], + d[1:1][1:2] + FROM arrtest; + +SELECT array_ndims(a) AS a,array_ndims(b) AS b,array_ndims(c) AS c + FROM arrtest; + +SELECT array_dims(a) AS a,array_dims(b) AS b,array_dims(c) AS c + FROM arrtest; + +-- returns nothing +SELECT * + FROM arrtest + WHERE a[1] < 5 and + c = '{"foobar"}'::_name; + +UPDATE arrtest + SET a[1:2] = '{16,25}' + WHERE NOT a = '{}'::_int2; + +UPDATE arrtest + SET b[1:1][1:1][1:2] = '{113, 117}', + b[1:1][1:2][2:2] = '{142, 147}' + WHERE array_dims(b) = '[1:1][1:2][1:2]'; + +UPDATE arrtest + SET c[2:2] = '{"new_word"}' + WHERE array_dims(c) is not null; + +SELECT a,b,c FROM arrtest; + +SELECT a[1:3], + b[1:1][1:2][1:2], + c[1:2], + d[1:1][2:2] + FROM arrtest; + +SELECT b[1:1][2][2], + d[1:1][2] + FROM arrtest; + +INSERT INTO arrtest(a) VALUES('{1,null,3}'); +SELECT a FROM arrtest; +UPDATE arrtest SET a[4] = NULL WHERE a[2] IS NULL; +SELECT a FROM arrtest WHERE a[2] IS NULL; +DELETE FROM arrtest WHERE a[2] IS NULL AND b IS NULL; +SELECT a,b,c FROM arrtest; + +-- test mixed slice/scalar subscripting +select '{{1,2,3},{4,5,6},{7,8,9}}'::int[]; +select ('{{1,2,3},{4,5,6},{7,8,9}}'::int[])[1:2][2]; +select '[0:2][0:2]={{1,2,3},{4,5,6},{7,8,9}}'::int[]; +select ('[0:2][0:2]={{1,2,3},{4,5,6},{7,8,9}}'::int[])[1:2][2]; + +-- +-- check subscription corner cases +-- +-- More subscripts than MAXDIMS(6) +SELECT ('{}'::int[])[1][2][3][4][5][6][7]; +-- NULL index yields NULL when selecting +SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][NULL][1]; +SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][NULL:1][1]; +SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][1: NULL][1]; +-- NULL index in assignment is an error +UPDATE arrtest + SET c[NULL] = '{"can''t assign"}' + WHERE array_dims(c) is not null; +UPDATE arrtest + SET c[NULL:1] = '{"can''t assign"}' + WHERE array_dims(c) is not null; +UPDATE arrtest + SET c[1: NULL] = '{"can''t assign"}' + WHERE array_dims(c) is not null; + +-- test slices with empty lower and/or upper index +CREATE TEMP TABLE arrtest_s ( + a int2[], + b int2[][] +); +INSERT INTO arrtest_s VALUES ('{1,2,3,4,5}', '{{1,2,3}, {4,5,6}, {7,8,9}}'); +INSERT INTO arrtest_s VALUES ('[0:4]={1,2,3,4,5}', '[0:2][0:2]={{1,2,3}, {4,5,6}, {7,8,9}}'); + +SELECT * FROM arrtest_s; +SELECT a[:3], b[:2][:2] FROM arrtest_s; +SELECT a[2:], b[2:][2:] FROM arrtest_s; +SELECT a[:], b[:] FROM arrtest_s; + +-- updates +UPDATE arrtest_s SET a[:3] = '{11, 12, 13}', b[:2][:2] = '{{11,12}, {14,15}}' + WHERE array_lower(a,1) = 1; +SELECT * FROM arrtest_s; +UPDATE arrtest_s SET a[3:] = '{23, 24, 25}', b[2:][2:] = '{{25,26}, {28,29}}'; +SELECT * FROM arrtest_s; +UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; +SELECT * FROM arrtest_s; +UPDATE arrtest_s SET a[:] = '{23, 24, 25}'; -- fail, too small +INSERT INTO arrtest_s VALUES(NULL, NULL); +UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; -- fail, no good with null + +-- check with fixed-length-array type, such as point +SELECT f1[0:1] FROM POINT_TBL; +SELECT f1[0:] FROM POINT_TBL; +SELECT f1[:1] FROM POINT_TBL; +SELECT f1[:] FROM POINT_TBL; + +-- subscript assignments to fixed-width result in NULL if previous value is NULL +UPDATE point_tbl SET f1[0] = 10 WHERE f1 IS NULL RETURNING *; +INSERT INTO point_tbl(f1[0]) VALUES(0) RETURNING *; +-- NULL assignments get ignored +UPDATE point_tbl SET f1[0] = NULL WHERE f1::text = '(10,10)'::point::text RETURNING *; +-- but non-NULL subscript assignments work +UPDATE point_tbl SET f1[0] = -10, f1[1] = -10 WHERE f1::text = '(10,10)'::point::text RETURNING *; +-- but not to expand the range +UPDATE point_tbl SET f1[3] = 10 WHERE f1::text = '(-10,-10)'::point::text RETURNING *; + +-- +-- test array extension +-- +CREATE TEMP TABLE arrtest1 (i int[], t text[]); +insert into arrtest1 values(array[1,2,null,4], array['one','two',null,'four']); +select * from arrtest1; +update arrtest1 set i[2] = 22, t[2] = 'twenty-two'; +select * from arrtest1; +update arrtest1 set i[5] = 5, t[5] = 'five'; +select * from arrtest1; +update arrtest1 set i[8] = 8, t[8] = 'eight'; +select * from arrtest1; +update arrtest1 set i[0] = 0, t[0] = 'zero'; +select * from arrtest1; +update arrtest1 set i[-3] = -3, t[-3] = 'minus-three'; +select * from arrtest1; +update arrtest1 set i[0:2] = array[10,11,12], t[0:2] = array['ten','eleven','twelve']; +select * from arrtest1; +update arrtest1 set i[8:10] = array[18,null,20], t[8:10] = array['p18',null,'p20']; +select * from arrtest1; +update arrtest1 set i[11:12] = array[null,22], t[11:12] = array[null,'p22']; +select * from arrtest1; +update arrtest1 set i[15:16] = array[null,26], t[15:16] = array[null,'p26']; +select * from arrtest1; +update arrtest1 set i[-5:-3] = array[-15,-14,-13], t[-5:-3] = array['m15','m14','m13']; +select * from arrtest1; +update arrtest1 set i[-7:-6] = array[-17,null], t[-7:-6] = array['m17',null]; +select * from arrtest1; +update arrtest1 set i[-12:-10] = array[-22,null,-20], t[-12:-10] = array['m22',null,'m20']; +select * from arrtest1; +delete from arrtest1; +insert into arrtest1 values(array[1,2,null,4], array['one','two',null,'four']); +select * from arrtest1; +update arrtest1 set i[0:5] = array[0,1,2,null,4,5], t[0:5] = array['z','p1','p2',null,'p4','p5']; +select * from arrtest1; + +-- +-- array expressions and operators +-- + +-- table creation and INSERTs +CREATE TEMP TABLE arrtest2 (i integer ARRAY[4], f float8[], n numeric[], t text[], d timestamp[]); +INSERT INTO arrtest2 VALUES( + ARRAY[[[113,142],[1,147]]], + ARRAY[1.1,1.2,1.3]::float8[], + ARRAY[1.1,1.2,1.3], + ARRAY[[['aaa','aab'],['aba','abb'],['aca','acb']],[['baa','bab'],['bba','bbb'],['bca','bcb']]], + ARRAY['19620326','19931223','19970117']::timestamp[] +); + +-- some more test data +CREATE TEMP TABLE arrtest_f (f0 int, f1 text, f2 float8); +insert into arrtest_f values(1,'cat1',1.21); +insert into arrtest_f values(2,'cat1',1.24); +insert into arrtest_f values(3,'cat1',1.18); +insert into arrtest_f values(4,'cat1',1.26); +insert into arrtest_f values(5,'cat1',1.15); +insert into arrtest_f values(6,'cat2',1.15); +insert into arrtest_f values(7,'cat2',1.26); +insert into arrtest_f values(8,'cat2',1.32); +insert into arrtest_f values(9,'cat2',1.30); + +CREATE TEMP TABLE arrtest_i (f0 int, f1 text, f2 int); +insert into arrtest_i values(1,'cat1',21); +insert into arrtest_i values(2,'cat1',24); +insert into arrtest_i values(3,'cat1',18); +insert into arrtest_i values(4,'cat1',26); +insert into arrtest_i values(5,'cat1',15); +insert into arrtest_i values(6,'cat2',15); +insert into arrtest_i values(7,'cat2',26); +insert into arrtest_i values(8,'cat2',32); +insert into arrtest_i values(9,'cat2',30); + +-- expressions +SELECT t.f[1][3][1] AS "131", t.f[2][2][1] AS "221" FROM ( + SELECT ARRAY[[[111,112],[121,122],[131,132]],[[211,212],[221,122],[231,232]]] AS f +) AS t; +SELECT ARRAY[[[[[['hello'],['world']]]]]]; +SELECT ARRAY[ARRAY['hello'],ARRAY['world']]; +SELECT ARRAY(select f2 from arrtest_f order by f2) AS "ARRAY"; + +-- with nulls +SELECT '{1,null,3}'::int[]; +SELECT ARRAY[1,NULL,3]; + +-- functions +SELECT array_append(array[42], 6) AS "{42,6}"; +SELECT array_prepend(6, array[42]) AS "{6,42}"; +SELECT array_cat(ARRAY[1,2], ARRAY[3,4]) AS "{1,2,3,4}"; +SELECT array_cat(ARRAY[1,2], ARRAY[[3,4],[5,6]]) AS "{{1,2},{3,4},{5,6}}"; +SELECT array_cat(ARRAY[[3,4],[5,6]], ARRAY[1,2]) AS "{{3,4},{5,6},{1,2}}"; + +SELECT array_position(ARRAY[1,2,3,4,5], 4); +SELECT array_position(ARRAY[5,3,4,2,1], 4); +SELECT array_position(ARRAY[[1,2],[3,4]], 3); +SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'mon'); +SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'sat'); +SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], NULL); +SELECT array_position(ARRAY['sun','mon','tue','wed','thu',NULL,'fri','sat'], NULL); +SELECT array_position(ARRAY['sun','mon','tue','wed','thu',NULL,'fri','sat'], 'sat'); + +SELECT array_positions(NULL, 10); +SELECT array_positions(NULL, NULL::int); +SELECT array_positions(ARRAY[1,2,3,4,5,6,1,2,3,4,5,6], 4); +SELECT array_positions(ARRAY[[1,2],[3,4]], 4); +SELECT array_positions(ARRAY[1,2,3,4,5,6,1,2,3,4,5,6], NULL); +SELECT array_positions(ARRAY[1,2,3,NULL,5,6,1,2,3,NULL,5,6], NULL); +SELECT array_length(array_positions(ARRAY(SELECT 'AAAAAAAAAAAAAAAAAAAAAAAAA'::text || i % 10 + FROM generate_series(1,100) g(i)), + 'AAAAAAAAAAAAAAAAAAAAAAAAA5'), 1); + +DO $$ +DECLARE + o int; + a int[] := ARRAY[1,2,3,2,3,1,2]; +BEGIN + o := array_position(a, 2); + WHILE o IS NOT NULL + LOOP + RAISE NOTICE '%', o; + o := array_position(a, 2, o + 1); + END LOOP; +END +$$ LANGUAGE plpgsql; + +SELECT array_position('[2:4]={1,2,3}'::int[], 1); +SELECT array_positions('[2:4]={1,2,3}'::int[], 1); + +SELECT + array_position(ids, (1, 1)), + array_positions(ids, (1, 1)) + FROM +(VALUES + (ARRAY[(0, 0), (1, 1)]), + (ARRAY[(1, 1)]) +) AS f (ids); + +-- operators +SELECT a FROM arrtest WHERE b = ARRAY[[[113,142],[1,147]]]; +SELECT NOT ARRAY[1.1,1.2,1.3] = ARRAY[1.1,1.2,1.3] AS "FALSE"; +SELECT ARRAY[1,2] || 3 AS "{1,2,3}"; +SELECT 0 || ARRAY[1,2] AS "{0,1,2}"; +SELECT ARRAY[1,2] || ARRAY[3,4] AS "{1,2,3,4}"; +SELECT ARRAY[[['hello','world']]] || ARRAY[[['happy','birthday']]] AS "ARRAY"; +SELECT ARRAY[[1,2],[3,4]] || ARRAY[5,6] AS "{{1,2},{3,4},{5,6}}"; +SELECT ARRAY[0,0] || ARRAY[1,1] || ARRAY[2,2] AS "{0,0,1,1,2,2}"; +SELECT 0 || ARRAY[1,2] || 3 AS "{0,1,2,3}"; + +SELECT * FROM array_op_test WHERE i @> '{32}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i && '{32}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i @> '{17}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i && '{17}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i @> '{32,17}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i && '{32,17}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i <@ '{38,34,32,89}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i = '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i @> '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i && '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i <@ '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i = '{NULL}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i @> '{NULL}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i && '{NULL}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i <@ '{NULL}' ORDER BY seqno; + +SELECT * FROM array_op_test WHERE t @> '{AAAAAAAA72908}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t && '{AAAAAAAA72908}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t @> '{AAAAAAAAAA646}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t && '{AAAAAAAAAA646}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t @> '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t && '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t <@ '{AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t = '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t @> '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t && '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE t <@ '{}' ORDER BY seqno; + +-- array casts +SELECT ARRAY[1,2,3]::text[]::int[]::float8[] AS "{1,2,3}"; +SELECT ARRAY[1,2,3]::text[]::int[]::float8[] is of (float8[]) as "TRUE"; +SELECT ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[] AS "{{a,bc},{def,hijk}}"; +SELECT ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[] is of (varchar[]) as "TRUE"; +SELECT CAST(ARRAY[[[[[['a','bb','ccc']]]]]] as text[]) as "{{{{{{a,bb,ccc}}}}}}"; +SELECT NULL::text[]::int[] AS "NULL"; + +-- scalar op any/all (array) +select 33 = any ('{1,2,3}'); +select 33 = any ('{1,2,33}'); +select 33 = all ('{1,2,33}'); +select 33 >= all ('{1,2,33}'); +-- boundary cases +select null::int >= all ('{1,2,33}'); +select null::int >= all ('{}'); +select null::int >= any ('{}'); +-- cross-datatype +select 33.4 = any (array[1,2,3]); +select 33.4 > all (array[1,2,3]); +-- errors +select 33 * any ('{1,2,3}'); +select 33 * any (44); +-- nulls +select 33 = any (null::int[]); +select null::int = any ('{1,2,3}'); +select 33 = any ('{1,null,3}'); +select 33 = any ('{1,null,33}'); +select 33 = all (null::int[]); +select null::int = all ('{1,2,3}'); +select 33 = all ('{1,null,3}'); +select 33 = all ('{33,null,33}'); +-- nulls later in the bitmap +SELECT -1 != ALL(ARRAY(SELECT NULLIF(g.i, 900) FROM generate_series(1,1000) g(i))); + +-- test indexes on arrays +create temp table arr_tbl (f1 int[] unique); +insert into arr_tbl values ('{1,2,3}'); +insert into arr_tbl values ('{1,2}'); +-- failure expected: +insert into arr_tbl values ('{1,2,3}'); +insert into arr_tbl values ('{2,3,4}'); +insert into arr_tbl values ('{1,5,3}'); +insert into arr_tbl values ('{1,2,10}'); + +set enable_seqscan to off; +set enable_bitmapscan to off; +select * from arr_tbl where f1 > '{1,2,3}' and f1 <= '{1,5,3}'; +select * from arr_tbl where f1 >= '{1,2,3}' and f1 < '{1,5,3}'; + +-- test ON CONFLICT DO UPDATE with arrays +create temp table arr_pk_tbl (pk int4 primary key, f1 int[]); +insert into arr_pk_tbl values (1, '{1,2,3}'); +insert into arr_pk_tbl values (1, '{3,4,5}') on conflict (pk) + do update set f1[1] = excluded.f1[1], f1[3] = excluded.f1[3] + returning pk, f1; +insert into arr_pk_tbl(pk, f1[1:2]) values (1, '{6,7,8}') on conflict (pk) + do update set f1[1] = excluded.f1[1], + f1[2] = excluded.f1[2], + f1[3] = excluded.f1[3] + returning pk, f1; + +-- note: if above selects don't produce the expected tuple order, +-- then you didn't get an indexscan plan, and something is busted. +reset enable_seqscan; +reset enable_bitmapscan; + +-- test [not] (like|ilike) (any|all) (...) +select 'foo' like any (array['%a', '%o']); -- t +select 'foo' like any (array['%a', '%b']); -- f +select 'foo' like all (array['f%', '%o']); -- t +select 'foo' like all (array['f%', '%b']); -- f +select 'foo' not like any (array['%a', '%b']); -- t +select 'foo' not like all (array['%a', '%o']); -- f +select 'foo' ilike any (array['%A', '%O']); -- t +select 'foo' ilike all (array['F%', '%O']); -- t + +-- +-- General array parser tests +-- + +-- none of the following should be accepted +select '{{1,{2}},{2,3}}'::text[]; +select '{{},{}}'::text[]; +select E'{{1,2},\\{2,3}}'::text[]; +select '{{"1 2" x},{3}}'::text[]; +select '{}}'::text[]; +select '{ }}'::text[]; +select array[]; +-- none of the above should be accepted + +-- all of the following should be accepted +select '{}'::text[]; +select '{{{1,2,3,4},{2,3,4,5}},{{3,4,5,6},{4,5,6,7}}}'::text[]; +select '{0 second ,0 second}'::interval[]; +select '{ { "," } , { 3 } }'::text[]; +select ' { { " 0 second " , 0 second } }'::text[]; +select '{ + 0 second, + @ 1 hour @ 42 minutes @ 20 seconds + }'::interval[]; +select array[]::text[]; +select '[0:1]={1.1,2.2}'::float8[]; +-- all of the above should be accepted + +-- tests for array aggregates +CREATE TEMP TABLE arraggtest ( f1 INT[], f2 TEXT[][], f3 FLOAT[]); + +INSERT INTO arraggtest (f1, f2, f3) VALUES +('{1,2,3,4}','{{grey,red},{blue,blue}}','{1.6, 0.0}'); +INSERT INTO arraggtest (f1, f2, f3) VALUES +('{1,2,3}','{{grey,red},{grey,blue}}','{1.6}'); +SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; + +INSERT INTO arraggtest (f1, f2, f3) VALUES +('{3,3,2,4,5,6}','{{white,yellow},{pink,orange}}','{2.1,3.3,1.8,1.7,1.6}'); +SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; + +INSERT INTO arraggtest (f1, f2, f3) VALUES +('{2}','{{black,red},{green,orange}}','{1.6,2.2,2.6,0.4}'); +SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; + +INSERT INTO arraggtest (f1, f2, f3) VALUES +('{4,2,6,7,8,1}','{{red},{black},{purple},{blue},{blue}}',NULL); +SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; + +INSERT INTO arraggtest (f1, f2, f3) VALUES +('{}','{{pink,white,blue,red,grey,orange}}','{2.1,1.87,1.4,2.2}'); +SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; + +-- A few simple tests for arrays of composite types + +create type comptype as (f1 int, f2 text); + +create table comptable (c1 comptype, c2 comptype[]); + +-- XXX would like to not have to specify row() construct types here ... +insert into comptable + values (row(1,'foo'), array[row(2,'bar')::comptype, row(3,'baz')::comptype]); + +-- check that implicitly named array type _comptype isn't a problem +create type _comptype as enum('fooey'); + +select * from comptable; +select c2[2].f2 from comptable; + +drop type _comptype; +drop table comptable; +drop type comptype; + +create or replace function unnest1(anyarray) +returns setof anyelement as $$ +select $1[s] from generate_subscripts($1,1) g(s); +$$ language sql immutable; + +create or replace function unnest2(anyarray) +returns setof anyelement as $$ +select $1[s1][s2] from generate_subscripts($1,1) g1(s1), + generate_subscripts($1,2) g2(s2); +$$ language sql immutable; + +select * from unnest1(array[1,2,3]); +select * from unnest2(array[[1,2,3],[4,5,6]]); + +drop function unnest1(anyarray); +drop function unnest2(anyarray); + +select array_fill(null::integer, array[3,3],array[2,2]); +select array_fill(null::integer, array[3,3]); +select array_fill(null::text, array[3,3],array[2,2]); +select array_fill(null::text, array[3,3]); +select array_fill(7, array[3,3],array[2,2]); +select array_fill(7, array[3,3]); +select array_fill('juhu'::text, array[3,3],array[2,2]); +select array_fill('juhu'::text, array[3,3]); +select a, a = '{}' as is_eq, array_dims(a) + from (select array_fill(42, array[0]) as a) ss; +select a, a = '{}' as is_eq, array_dims(a) + from (select array_fill(42, '{}') as a) ss; +select a, a = '{}' as is_eq, array_dims(a) + from (select array_fill(42, '{}', '{}') as a) ss; +-- raise exception +select array_fill(1, null, array[2,2]); +select array_fill(1, array[2,2], null); +select array_fill(1, array[2,2], '{}'); +select array_fill(1, array[3,3], array[1,1,1]); +select array_fill(1, array[1,2,null]); +select array_fill(1, array[[1,2],[3,4]]); + +select string_to_array('1|2|3', '|'); +select string_to_array('1|2|3|', '|'); +select string_to_array('1||2|3||', '||'); +select string_to_array('1|2|3', ''); +select string_to_array('', '|'); +select string_to_array('1|2|3', NULL); +select string_to_array(NULL, '|') IS NULL; +select string_to_array('abc', ''); +select string_to_array('abc', '', 'abc'); +select string_to_array('abc', ','); +select string_to_array('abc', ',', 'abc'); +select string_to_array('1,2,3,4,,6', ','); +select string_to_array('1,2,3,4,,6', ',', ''); +select string_to_array('1,2,3,4,*,6', ',', '*'); + +select array_to_string(NULL::int4[], ',') IS NULL; +select array_to_string('{}'::int4[], ','); +select array_to_string(array[1,2,3,4,NULL,6], ','); +select array_to_string(array[1,2,3,4,NULL,6], ',', '*'); +select array_to_string(array[1,2,3,4,NULL,6], NULL); +select array_to_string(array[1,2,3,4,NULL,6], ',', NULL); + +select array_to_string(string_to_array('1|2|3', '|'), '|'); + +select array_length(array[1,2,3], 1); +select array_length(array[[1,2,3], [4,5,6]], 0); +select array_length(array[[1,2,3], [4,5,6]], 1); +select array_length(array[[1,2,3], [4,5,6]], 2); +select array_length(array[[1,2,3], [4,5,6]], 3); + +select cardinality(NULL::int[]); +select cardinality('{}'::int[]); +select cardinality(array[1,2,3]); +select cardinality('[2:4]={5,6,7}'::int[]); +select cardinality('{{1,2}}'::int[]); +select cardinality('{{1,2},{3,4},{5,6}}'::int[]); +select cardinality('{{{1,9},{5,6}},{{2,3},{3,4}}}'::int[]); + +-- array_agg(anynonarray) +select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss; +select array_agg(ten) from (select ten from tenk1 where unique1 < 15 order by unique1) ss; +select array_agg(nullif(ten, 4)) from (select ten from tenk1 where unique1 < 15 order by unique1) ss; +select array_agg(unique1) from tenk1 where unique1 < -15; + +-- array_agg(anyarray) +select array_agg(ar) + from (values ('{1,2}'::int[]), ('{3,4}'::int[])) v(ar); +select array_agg(distinct ar order by ar desc) + from (select array[i / 2] from generate_series(1,10) a(i)) b(ar); +select array_agg(ar) + from (select array_agg(array[i, i+1, i-1]) + from generate_series(1,2) a(i)) b(ar); +select array_agg(array[i+1.2, i+1.3, i+1.4]) from generate_series(1,3) g(i); +select array_agg(array['Hello', i::text]) from generate_series(9,11) g(i); +select array_agg(array[i, nullif(i, 3), i+1]) from generate_series(1,4) g(i); +-- errors +select array_agg('{}'::int[]) from generate_series(1,2); +select array_agg(null::int[]) from generate_series(1,2); +select array_agg(ar) + from (values ('{1,2}'::int[]), ('{3}'::int[])) v(ar); + +select unnest(array[1,2,3]); +select * from unnest(array[1,2,3]); +select unnest(array[1,2,3,4.5]::float8[]); +select unnest(array[1,2,3,4.5]::numeric[]); +select unnest(array[1,2,3,null,4,null,null,5,6]); +select unnest(array[1,2,3,null,4,null,null,5,6]::text[]); +select abs(unnest(array[1,2,null,-3])); +select array_remove(array[1,2,2,3], 2); +select array_remove(array[1,2,2,3], 5); +select array_remove(array[1,NULL,NULL,3], NULL); +select array_remove(array['A','CC','D','C','RR'], 'RR'); +select array_remove('{{1,2,2},{1,4,3}}', 2); -- not allowed +select array_remove(array['X','X','X'], 'X') = '{}'; +select array_replace(array[1,2,5,4],5,3); +select array_replace(array[1,2,5,4],5,NULL); +select array_replace(array[1,2,NULL,4,NULL],NULL,5); +select array_replace(array['A','B','DD','B'],'B','CC'); +select array_replace(array[1,NULL,3],NULL,NULL); +select array_replace(array['AB',NULL,'CDE'],NULL,'12'); + +-- array(select array-value ...) +select array(select array[i,i/2] from generate_series(1,5) i); +select array(select array['Hello', i::text] from generate_series(9,11) i); + +-- Insert/update on a column that is array of composite + +create temp table t1 (f1 int8_tbl[]); +insert into t1 (f1[5].q1) values(42); +select * from t1; +update t1 set f1[5].q2 = 43; +select * from t1; + +-- Check that arrays of composites are safely detoasted when needed + +create temp table src (f1 text); +insert into src + select string_agg(random()::text,'') from generate_series(1,10000); +create type textandtext as (c1 text, c2 text); +create temp table dest (f1 textandtext[]); +insert into dest select array[row(f1,f1)::textandtext] from src; +select length(md5((f1[1]).c2)) from dest; +delete from src; +select length(md5((f1[1]).c2)) from dest; +truncate table src; +drop table src; +select length(md5((f1[1]).c2)) from dest; +drop table dest; +drop type textandtext; + +-- Tests for polymorphic-array form of width_bucket() + +-- this exercises the varwidth and float8 code paths +SELECT + op, + width_bucket(op::numeric, ARRAY[1, 3, 5, 10.0]::numeric[]) AS wb_n1, + width_bucket(op::numeric, ARRAY[0, 5.5, 9.99]::numeric[]) AS wb_n2, + width_bucket(op::numeric, ARRAY[-6, -5, 2.0]::numeric[]) AS wb_n3, + width_bucket(op::float8, ARRAY[1, 3, 5, 10.0]::float8[]) AS wb_f1, + width_bucket(op::float8, ARRAY[0, 5.5, 9.99]::float8[]) AS wb_f2, + width_bucket(op::float8, ARRAY[-6, -5, 2.0]::float8[]) AS wb_f3 +FROM (VALUES + (-5.2), + (-0.0000000001), + (0.000000000001), + (1), + (1.99999999999999), + (2), + (2.00000000000001), + (3), + (4), + (4.5), + (5), + (5.5), + (6), + (7), + (8), + (9), + (9.99999999999999), + (10), + (10.0000000000001) +) v(op); + +-- ensure float8 path handles NaN properly +SELECT + op, + width_bucket(op, ARRAY[1, 3, 9, 'NaN', 'NaN']::float8[]) AS wb +FROM (VALUES + (-5.2::float8), + (4::float8), + (77::float8), + ('NaN'::float8) +) v(op); + +-- these exercise the generic fixed-width code path +SELECT + op, + width_bucket(op, ARRAY[1, 3, 5, 10]) AS wb_1 +FROM generate_series(0,11) as op; + +SELECT width_bucket(now(), + array['yesterday', 'today', 'tomorrow']::timestamptz[]); + +-- corner cases +SELECT width_bucket(5, ARRAY[3]); +SELECT width_bucket(5, '{}'); + +-- error cases +SELECT width_bucket('5'::text, ARRAY[3, 4]::integer[]); +SELECT width_bucket(5, ARRAY[3, 4, NULL]); +SELECT width_bucket(5, ARRAY[ARRAY[1, 2], ARRAY[3, 4]]); diff --git a/postgresql/examples/async.sql b/postgresql/examples/async.sql new file mode 100644 index 0000000..40f6e01 --- /dev/null +++ b/postgresql/examples/async.sql @@ -0,0 +1,23 @@ +-- +-- ASYNC +-- + +--Should work. Send a valid message via a valid channel name +SELECT pg_notify('notify_async1','sample message1'); +SELECT pg_notify('notify_async1',''); +SELECT pg_notify('notify_async1',NULL); + +-- Should fail. Send a valid message via an invalid channel name +SELECT pg_notify('','sample message1'); +SELECT pg_notify(NULL,'sample message1'); +SELECT pg_notify('notify_async_channel_name_too_long______________________________','sample_message1'); + +--Should work. Valid NOTIFY/LISTEN/UNLISTEN commands +NOTIFY notify_async2; +LISTEN notify_async2; +UNLISTEN notify_async2; +UNLISTEN *; + +-- Should return zero while there are no pending notifications. +-- src/test/isolation/specs/async-notify.spec tests for actual usage. +SELECT pg_notification_queue_usage(); diff --git a/postgresql/examples/bit.sql b/postgresql/examples/bit.sql new file mode 100644 index 0000000..1bb4a06 --- /dev/null +++ b/postgresql/examples/bit.sql @@ -0,0 +1,217 @@ +-- +-- BIT types +-- + +-- +-- Build tables for testing +-- + +CREATE TABLE BIT_TABLE(b BIT(11)); + +INSERT INTO BIT_TABLE VALUES (B'10'); -- too short +INSERT INTO BIT_TABLE VALUES (B'00000000000'); +INSERT INTO BIT_TABLE VALUES (B'11011000000'); +INSERT INTO BIT_TABLE VALUES (B'01010101010'); +INSERT INTO BIT_TABLE VALUES (B'101011111010'); -- too long +--INSERT INTO BIT_TABLE VALUES ('X554'); +--INSERT INTO BIT_TABLE VALUES ('X555'); + +SELECT * FROM BIT_TABLE; + +CREATE TABLE VARBIT_TABLE(v BIT VARYING(11)); + +INSERT INTO VARBIT_TABLE VALUES (B''); +INSERT INTO VARBIT_TABLE VALUES (B'0'); +INSERT INTO VARBIT_TABLE VALUES (B'010101'); +INSERT INTO VARBIT_TABLE VALUES (B'01010101010'); +INSERT INTO VARBIT_TABLE VALUES (B'101011111010'); -- too long +--INSERT INTO VARBIT_TABLE VALUES ('X554'); +--INSERT INTO VARBIT_TABLE VALUES ('X555'); +SELECT * FROM VARBIT_TABLE; + + +-- Concatenation +SELECT v, b, (v || b) AS concat + FROM BIT_TABLE, VARBIT_TABLE + ORDER BY 3; + +-- Length +SELECT b, length(b) AS lb + FROM BIT_TABLE; +SELECT v, length(v) AS lv + FROM VARBIT_TABLE; + +-- Substring +SELECT b, + SUBSTRING(b FROM 2 FOR 4) AS sub_2_4, + SUBSTRING(b FROM 7 FOR 13) AS sub_7_13, + SUBSTRING(b FROM 6) AS sub_6 + FROM BIT_TABLE; +SELECT v, + SUBSTRING(v FROM 2 FOR 4) AS sub_2_4, + SUBSTRING(v FROM 7 FOR 13) AS sub_7_13, + SUBSTRING(v FROM 6) AS sub_6 + FROM VARBIT_TABLE; + +--- Bit operations +DROP TABLE varbit_table; +CREATE TABLE varbit_table (a BIT VARYING(16), b BIT VARYING(16)); +COPY varbit_table FROM stdin; +--X0F X10- +--X1F X11 +--X2F X12 +--X3F X13 +--X8F X04 +--X000F X0010 +--X0123 XFFFF +--X2468 X2468 +--XFA50 X05AF +--X1234 XFFF5 +--\. + + SELECT a,b,a=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM varbit_table; + + +DROP TABLE varbit_table; + +--- Bit operations +DROP TABLE bit_table; +CREATE TABLE bit_table (a BIT(16), b BIT(16)); +COPY bit_table FROM stdin; + +SELECT a,b,a=b AS "a>=b",a>b AS "a>b",a<>b AS "a<>b" FROM bit_table; + +DROP TABLE bit_table; + + +-- The following should fail +select B'001' & B'10'; +select B'0111' | B'011'; + +-- More position tests, checking all the boundary cases +SELECT POSITION(B'1010' IN B'0000101'); -- 0 +SELECT POSITION(B'1010' IN B'00001010'); -- 5 +SELECT POSITION(B'1010' IN B'00000101'); -- 0 +SELECT POSITION(B'1010' IN B'000001010'); -- 6 + +SELECT POSITION(B'' IN B'00001010'); -- 1 +SELECT POSITION(B'0' IN B''); -- 0 +SELECT POSITION(B'' IN B''); -- 0 +SELECT POSITION(B'101101' IN B'001011011011011000'); -- 3 +SELECT POSITION(B'10110110' IN B'001011011011010'); -- 3 +SELECT POSITION(B'1011011011011' IN B'001011011011011'); -- 3 +SELECT POSITION(B'1011011011011' IN B'00001011011011011'); -- 5 + +SELECT POSITION(B'11101011' IN B'11101011'); -- 1 +SELECT POSITION(B'11101011' IN B'011101011'); -- 2 +SELECT POSITION(B'11101011' IN B'00011101011'); -- 4 +SELECT POSITION(B'11101011' IN B'0000011101011'); -- 6 + +SELECT POSITION(B'111010110' IN B'111010110'); -- 1 +SELECT POSITION(B'111010110' IN B'0111010110'); -- 2 +SELECT POSITION(B'111010110' IN B'000111010110'); -- 4 +SELECT POSITION(B'111010110' IN B'00000111010110'); -- 6 + +SELECT POSITION(B'111010110' IN B'11101011'); -- 0 +SELECT POSITION(B'111010110' IN B'011101011'); -- 0 +SELECT POSITION(B'111010110' IN B'00011101011'); -- 0 +SELECT POSITION(B'111010110' IN B'0000011101011'); -- 0 + +SELECT POSITION(B'111010110' IN B'111010110'); -- 1 +SELECT POSITION(B'111010110' IN B'0111010110'); -- 2 +SELECT POSITION(B'111010110' IN B'000111010110'); -- 4 +SELECT POSITION(B'111010110' IN B'00000111010110'); -- 6 + +SELECT POSITION(B'111010110' IN B'000001110101111101011'); -- 0 +SELECT POSITION(B'111010110' IN B'0000001110101111101011'); -- 0 +SELECT POSITION(B'111010110' IN B'000000001110101111101011'); -- 0 +SELECT POSITION(B'111010110' IN B'00000000001110101111101011'); -- 0 + +SELECT POSITION(B'111010110' IN B'0000011101011111010110'); -- 14 +SELECT POSITION(B'111010110' IN B'00000011101011111010110'); -- 15 +SELECT POSITION(B'111010110' IN B'0000000011101011111010110'); -- 17 +SELECT POSITION(B'111010110' IN B'000000000011101011111010110'); -- 19 + +SELECT POSITION(B'000000000011101011111010110' IN B'000000000011101011111010110'); -- 1 +SELECT POSITION(B'00000000011101011111010110' IN B'000000000011101011111010110'); -- 2 +SELECT POSITION(B'0000000000011101011111010110' IN B'000000000011101011111010110'); -- 0 + + +-- Shifting + +CREATE TABLE BIT_SHIFT_TABLE(b BIT(16)); +INSERT INTO BIT_SHIFT_TABLE VALUES (B'1101100000000000'); +SELECT POSITION(B'1101' IN b), + POSITION(B'11011' IN b), + b + FROM BIT_SHIFT_TABLE ; + + +CREATE TABLE VARBIT_SHIFT_TABLE(v BIT VARYING(20)); +INSERT INTO VARBIT_SHIFT_TABLE VALUES (B'11011'); + +DROP TABLE BIT_SHIFT_TABLE; +DROP TABLE VARBIT_SHIFT_TABLE; + +-- Get/Set bit +SELECT get_bit(B'0101011000100', 10); +SELECT set_bit(B'0101011000100100', 15, 1); +SELECT set_bit(B'0101011000100100', 16, 1); -- fail + +-- Overlay +SELECT overlay(B'0101011100' placing '001' from 2 for 3); +SELECT overlay(B'0101011100' placing '101' from 6); +SELECT overlay(B'0101011100' placing '001' from 11); +SELECT overlay(B'0101011100' placing '001' from 20); + +-- This table is intentionally left around to exercise pg_dump/pg_upgrade +CREATE TABLE bit_defaults( + b1 bit(4) DEFAULT '1001', + b2 bit(4) DEFAULT B'0101', + b3 bit varying(5) DEFAULT '1001', + b4 bit varying(5) DEFAULT B'0101' +); +--\d bit_defaults +INSERT INTO bit_defaults DEFAULT VALUES; +TABLE bit_defaults; +SELECT a, b, ~a AS "~ a", a & b AS "a & b", + a | b AS "a | b", a # b AS "a # b" FROM varbit_table; + +SELECT a, b, ~a AS "~ a", a & b AS "a & b", + a | b AS "a | b", a # b AS "a # b" FROM varbit_table; + +SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM varbit_table; +SELECT a,b,~a AS "~ a",a & b AS "a & b", + a|b AS "a | b", a # b AS "a # b" FROM bit_table; + +SELECT a,a<<4 AS "a<<4",b,b>>2 AS "b>>2" FROM bit_table; + +select B'0010' # B'011101'; + +INSERT INTO BIT_SHIFT_TABLE SELECT b>>1 FROM BIT_SHIFT_TABLE; +INSERT INTO BIT_SHIFT_TABLE SELECT b>>2 FROM BIT_SHIFT_TABLE; +INSERT INTO BIT_SHIFT_TABLE SELECT b>>4 FROM BIT_SHIFT_TABLE; +INSERT INTO BIT_SHIFT_TABLE SELECT b>>8 FROM BIT_SHIFT_TABLE; +SELECT b, b >> 1 AS bsr, b << 1 AS bsl + FROM BIT_SHIFT_TABLE ; +SELECT b, b >> 8 AS bsr8, b << 8 AS bsl8 + FROM BIT_SHIFT_TABLE ; +SELECT b::bit(15), b::bit(15) >> 1 AS bsr, b::bit(15) << 1 AS bsl + FROM BIT_SHIFT_TABLE ; +SELECT b::bit(15), b::bit(15) >> 8 AS bsr8, b::bit(15) << 8 AS bsl8 + FROM BIT_SHIFT_TABLE ; + +INSERT INTO VARBIT_SHIFT_TABLE SELECT CAST(v || B'0' AS BIT VARYING(6)) >>1 FROM VARBIT_SHIFT_TABLE; +INSERT INTO VARBIT_SHIFT_TABLE SELECT CAST(v || B'00' AS BIT VARYING(8)) >>2 FROM VARBIT_SHIFT_TABLE; +INSERT INTO VARBIT_SHIFT_TABLE SELECT CAST(v || B'0000' AS BIT VARYING(12)) >>4 FROM VARBIT_SHIFT_TABLE; +INSERT INTO VARBIT_SHIFT_TABLE SELECT CAST(v || B'00000000' AS BIT VARYING(20)) >>8 FROM VARBIT_SHIFT_TABLE; +SELECT POSITION(B'1101' IN v), + POSITION(B'11011' IN v), + v + FROM VARBIT_SHIFT_TABLE ; +SELECT v, v >> 1 AS vsr, v << 1 AS vsl + FROM VARBIT_SHIFT_TABLE ; +SELECT v, v >> 8 AS vsr8, v << 8 AS vsl8 + FROM VARBIT_SHIFT_TABLE ; diff --git a/postgresql/examples/bitmapops.sql b/postgresql/examples/bitmapops.sql new file mode 100644 index 0000000..498f472 --- /dev/null +++ b/postgresql/examples/bitmapops.sql @@ -0,0 +1,41 @@ +-- Test bitmap AND and OR + + +-- Generate enough data that we can test the lossy bitmaps. + +-- There's 55 tuples per page in the table. 53 is just +-- below 55, so that an index scan with qual a = constant +-- will return at least one hit per page. 59 is just above +-- 55, so that an index scan with qual b = constant will return +-- hits on most but not all pages. 53 and 59 are prime, so that +-- there's a maximum number of a,b combinations in the table. +-- That allows us to test all the different combinations of +-- lossy and non-lossy pages with the minimum amount of data + +CREATE TABLE bmscantest (a int, b int, t text); + +INSERT INTO bmscantest + SELECT (r%53), (r%59), 'foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' + FROM generate_series(1,70000) r; + +CREATE INDEX i_bmtest_a ON bmscantest(a); +CREATE INDEX i_bmtest_b ON bmscantest(b); + +-- We want to use bitmapscans. With default settings, the planner currently +-- chooses a bitmap scan for the queries below anyway, but let's make sure. +set enable_indexscan=false; +set enable_seqscan=false; + +-- Lower work_mem to trigger use of lossy bitmaps +set work_mem = 64; + + +-- Test bitmap-and. +SELECT count(*) FROM bmscantest WHERE a = 1 AND b = 1; + +-- Test bitmap-or. +SELECT count(*) FROM bmscantest WHERE a = 1 OR b = 1; + + +-- clean up +DROP TABLE bmscantest; diff --git a/postgresql/examples/boolean.sql b/postgresql/examples/boolean.sql new file mode 100644 index 0000000..f29e3f8 --- /dev/null +++ b/postgresql/examples/boolean.sql @@ -0,0 +1,262 @@ +-- +-- BOOLEAN +-- + +-- +-- sanity check - if this fails go insane! +-- +SELECT 1 AS one; + + +-- ******************testing built-in type bool******************** + +-- check bool input syntax + +SELECT true AS true; + +SELECT false AS false; + +SELECT bool 't' AS true; + +SELECT bool ' f ' AS false; + +SELECT bool 'true' AS true; + +SELECT bool 'test' AS error; + +SELECT bool 'false' AS false; + +SELECT bool 'foo' AS error; + +SELECT bool 'y' AS true; + +SELECT bool 'yes' AS true; + +SELECT bool 'yeah' AS error; + +SELECT bool 'n' AS false; + +SELECT bool 'no' AS false; + +SELECT bool 'nay' AS error; + +SELECT bool 'on' AS true; + +SELECT bool 'off' AS false; + +SELECT bool 'of' AS false; + +SELECT bool 'o' AS error; + +SELECT bool 'on_' AS error; + +SELECT bool 'off_' AS error; + +SELECT bool '1' AS true; + +SELECT bool '11' AS error; + +SELECT bool '0' AS false; + +SELECT bool '000' AS error; + +SELECT bool '' AS error; + +-- and, or, not in qualifications + +SELECT bool 't' or bool 'f' AS true; + +SELECT bool 't' and bool 'f' AS false; + +SELECT not bool 'f' AS true; + +SELECT bool 't' = bool 'f' AS false; + +SELECT bool 't' <> bool 'f' AS true; + +SELECT bool 't' > bool 'f' AS true; + +SELECT bool 't' >= bool 'f' AS true; + +SELECT bool 'f' < bool 't' AS true; + +SELECT bool 'f' <= bool 't' AS true; + +-- explicit casts to/from text +SELECT 'TrUe'::text::boolean AS true, 'fAlse'::text::boolean AS false; +SELECT ' true '::text::boolean AS true, + ' FALSE'::text::boolean AS false; +SELECT true::boolean::text AS true, false::boolean::text AS false; + +SELECT ' tru e '::text::boolean AS invalid; -- error +SELECT ''::text::boolean AS invalid; -- error + +CREATE TABLE BOOLTBL1 (f1 bool); + +INSERT INTO BOOLTBL1 (f1) VALUES (bool 't'); + +INSERT INTO BOOLTBL1 (f1) VALUES (bool 'True'); + +INSERT INTO BOOLTBL1 (f1) VALUES (bool 'true'); + + +-- BOOLTBL1 should be full of true's at this point +SELECT '' AS t_3, BOOLTBL1.* FROM BOOLTBL1; + + +SELECT '' AS t_3, BOOLTBL1.* + FROM BOOLTBL1 + WHERE f1 = bool 'true'; + + +SELECT '' AS t_3, BOOLTBL1.* + FROM BOOLTBL1 + WHERE f1 <> bool 'false'; + +SELECT '' AS zero, BOOLTBL1.* + FROM BOOLTBL1 + WHERE booleq(bool 'false', f1); + +INSERT INTO BOOLTBL1 (f1) VALUES (bool 'f'); + +SELECT '' AS f_1, BOOLTBL1.* + FROM BOOLTBL1 + WHERE f1 = bool 'false'; + + +CREATE TABLE BOOLTBL2 (f1 bool); + +INSERT INTO BOOLTBL2 (f1) VALUES (bool 'f'); + +INSERT INTO BOOLTBL2 (f1) VALUES (bool 'false'); + +INSERT INTO BOOLTBL2 (f1) VALUES (bool 'False'); + +INSERT INTO BOOLTBL2 (f1) VALUES (bool 'FALSE'); + +-- This is now an invalid expression +-- For pre-v6.3 this evaluated to false - thomas 1997-10-23 +INSERT INTO BOOLTBL2 (f1) + VALUES (bool 'XXX'); + +-- BOOLTBL2 should be full of false's at this point +SELECT '' AS f_4, BOOLTBL2.* FROM BOOLTBL2; + + +SELECT '' AS tf_12, BOOLTBL1.*, BOOLTBL2.* + FROM BOOLTBL1, BOOLTBL2 + WHERE BOOLTBL2.f1 <> BOOLTBL1.f1; + + +SELECT '' AS tf_12, BOOLTBL1.*, BOOLTBL2.* + FROM BOOLTBL1, BOOLTBL2 + WHERE boolne(BOOLTBL2.f1,BOOLTBL1.f1); + + +SELECT '' AS ff_4, BOOLTBL1.*, BOOLTBL2.* + FROM BOOLTBL1, BOOLTBL2 + WHERE BOOLTBL2.f1 = BOOLTBL1.f1 and BOOLTBL1.f1 = bool 'false'; + + +SELECT '' AS tf_12_ff_4, BOOLTBL1.*, BOOLTBL2.* + FROM BOOLTBL1, BOOLTBL2 + WHERE BOOLTBL2.f1 = BOOLTBL1.f1 or BOOLTBL1.f1 = bool 'true' + ORDER BY BOOLTBL1.f1, BOOLTBL2.f1; + +-- +-- SQL syntax +-- Try all combinations to ensure that we get nothing when we expect nothing +-- - thomas 2000-01-04 +-- + +SELECT '' AS "True", f1 + FROM BOOLTBL1 + WHERE f1 IS TRUE; + +SELECT '' AS "Not False", f1 + FROM BOOLTBL1 + WHERE f1 IS NOT FALSE; + +SELECT '' AS "False", f1 + FROM BOOLTBL1 + WHERE f1 IS FALSE; + +SELECT '' AS "Not True", f1 + FROM BOOLTBL1 + WHERE f1 IS NOT TRUE; + +SELECT '' AS "True", f1 + FROM BOOLTBL2 + WHERE f1 IS TRUE; + +SELECT '' AS "Not False", f1 + FROM BOOLTBL2 + WHERE f1 IS NOT FALSE; + +SELECT '' AS "False", f1 + FROM BOOLTBL2 + WHERE f1 IS FALSE; + +SELECT '' AS "Not True", f1 + FROM BOOLTBL2 + WHERE f1 IS NOT TRUE; + +-- +-- Tests for BooleanTest +-- +CREATE TABLE BOOLTBL3 (d text, b bool, o int); +INSERT INTO BOOLTBL3 (d, b, o) VALUES ('true', true, 1); +INSERT INTO BOOLTBL3 (d, b, o) VALUES ('false', false, 2); +INSERT INTO BOOLTBL3 (d, b, o) VALUES ('null', null, 3); + +SELECT + d, + b IS TRUE AS istrue, + b IS NOT TRUE AS isnottrue, + b IS FALSE AS isfalse, + b IS NOT FALSE AS isnotfalse, + b IS UNKNOWN AS isunknown, + b IS NOT UNKNOWN AS isnotunknown +FROM booltbl3 ORDER BY o; + + +-- Test to make sure short-circuiting and NULL handling is +-- correct. Use a table as source to prevent constant simplification +-- to interfer. +CREATE TABLE booltbl4(isfalse bool, istrue bool, isnul bool); +INSERT INTO booltbl4 VALUES (false, true, null); +--\pset null '(null)' + +-- AND expression need to return null if there's any nulls and not all +-- of the value are true +SELECT istrue AND isnul AND istrue FROM booltbl4; +SELECT istrue AND istrue AND isnul FROM booltbl4; +SELECT isnul AND istrue AND istrue FROM booltbl4; +SELECT isfalse AND isnul AND istrue FROM booltbl4; +SELECT istrue AND isfalse AND isnul FROM booltbl4; +SELECT isnul AND istrue AND isfalse FROM booltbl4; + +-- OR expression need to return null if there's any nulls and none +-- of the value is true +SELECT isfalse OR isnul OR isfalse FROM booltbl4; +SELECT isfalse OR isfalse OR isnul FROM booltbl4; +SELECT isnul OR isfalse OR isfalse FROM booltbl4; +SELECT isfalse OR isnul OR istrue FROM booltbl4; +SELECT istrue OR isfalse OR isnul FROM booltbl4; +SELECT isnul OR istrue OR isfalse FROM booltbl4; + + +-- +-- Clean up +-- Many tables are retained by the regression test, but these do not seem +-- particularly useful so just get rid of them for now. +-- - thomas 1997-11-30 +-- + +DROP TABLE BOOLTBL1; + +DROP TABLE BOOLTBL2; + +DROP TABLE BOOLTBL3; + +DROP TABLE BOOLTBL4; diff --git a/postgresql/examples/box.sql b/postgresql/examples/box.sql new file mode 100644 index 0000000..66cd482 --- /dev/null +++ b/postgresql/examples/box.sql @@ -0,0 +1,290 @@ +-- +-- BOX +-- + +-- +-- box logic +-- o +-- 3 o--|X +-- | o| +-- 2 +-+-+ | +-- | | | | +-- 1 | o-+-o +-- | | +-- 0 +---+ +-- +-- 0 1 2 3 +-- + +-- boxes are specified by two points, given by four floats x1,y1,x2,y2 + + +CREATE TABLE BOX_TBL (f1 box); + +INSERT INTO BOX_TBL (f1) VALUES ('(2.0,2.0,0.0,0.0)'); + +INSERT INTO BOX_TBL (f1) VALUES ('(1.0,1.0,3.0,3.0)'); + +INSERT INTO BOX_TBL (f1) VALUES ('((-8, 2), (-2, -10))'); + + +-- degenerate cases where the box is a line or a point +-- note that lines and points boxes all have zero area +INSERT INTO BOX_TBL (f1) VALUES ('(2.5, 2.5, 2.5,3.5)'); + +INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)'); + +-- badly formatted box inputs +INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)'); + +INSERT INTO BOX_TBL (f1) VALUES ('[1, 2, 3, 4)'); + +INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4]'); + +INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4) x'); + +INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad'); + + +SELECT '' AS four, * FROM BOX_TBL; + +SELECT '' AS four, b.*, area(b.f1) as barea + FROM BOX_TBL b; + +-- overlap +SELECT '' AS three, b.f1 + FROM BOX_TBL b + WHERE b.f1 && box '(2.5,2.5,1.0,1.0)'; + +-- left-or-overlap (x only) +SELECT '' AS two, b1.* + FROM BOX_TBL b1 + WHERE b1.f1 &< box '(2.0,2.0,2.5,2.5)'; + +-- right-or-overlap (x only) +SELECT '' AS two, b1.* + FROM BOX_TBL b1 + WHERE b1.f1 &> box '(2.0,2.0,2.5,2.5)'; + + +-- area <= +SELECT '' AS four, b.f1 + FROM BOX_TBL b + WHERE b.f1 <= box '(3.0,3.0,5.0,5.0)'; + +-- area < +SELECT '' AS two, b.f1 + FROM BOX_TBL b + WHERE b.f1 < box '(3.0,3.0,5.0,5.0)'; + +-- area = +SELECT '' AS two, b.f1 + FROM BOX_TBL b + WHERE b.f1 = box '(3.0,3.0,5.0,5.0)'; + +-- area > +SELECT '' AS two, b.f1 + FROM BOX_TBL b -- zero area + WHERE b.f1 > box '(3.5,3.0,4.5,3.0)'; + +-- area >= +SELECT '' AS four, b.f1 + FROM BOX_TBL b -- zero area + WHERE b.f1 >= box '(3.5,3.0,4.5,3.0)'; + + +-- contained in +SELECT '' AS three, b.f1 + FROM BOX_TBL b + WHERE b.f1 <@ box '(0,0,3,3)'; + +-- contains +SELECT '' AS three, b.f1 + FROM BOX_TBL b + WHERE box '(0,0,3,3)' @> b.f1; + +-- box equality +SELECT '' AS one, b.f1 + FROM BOX_TBL b + WHERE box '(1,1,3,3)' ~= b.f1; + +-- center of box, left unary operator +SELECT '' AS four, @@(b1.f1) AS p + FROM BOX_TBL b1; + +-- wholly-contained +SELECT '' AS one, b1.*, b2.* + FROM BOX_TBL b1, BOX_TBL b2 + WHERE b1.f1 @> b2.f1 and not b1.f1 ~= b2.f1; + +SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL; + +-- +-- Test the SP-GiST index +-- + +CREATE TEMPORARY TABLE box_temp (f1 box); + +INSERT INTO box_temp + SELECT box(point(i, i), point(i * 2, i * 2)) + FROM generate_series(1, 50) AS i; + +CREATE INDEX box_spgist ON box_temp USING spgist (f1); + +INSERT INTO box_temp + VALUES (NULL), + ('(0,0)(0,100)'), + ('(-3,4.3333333333)(40,1)'), + ('(0,100)(0,infinity)'), + ('(-infinity,0)(0,infinity)'), + ('(-infinity,-infinity)(infinity,infinity)'); + +SET enable_seqscan = false; + + +SELECT * FROM box_temp WHERE f1 &< '(10,4.333334),(5,100)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &< '(10,4.333334),(5,100)'; + +SELECT * FROM box_temp WHERE f1 && '(15,20),(25,30)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 && '(15,20),(25,30)'; + +SELECT * FROM box_temp WHERE f1 &> '(40,30),(45,50)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &> '(40,30),(45,50)'; + + +SELECT * FROM box_temp WHERE f1 <<| '(10,4.33334),(5,100)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 <<| '(10,4.33334),(5,100)'; + +SELECT * FROM box_temp WHERE f1 &<| '(10,4.3333334),(5,1)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 &<| '(10,4.3333334),(5,1)'; + +SELECT * FROM box_temp WHERE f1 |&> '(49.99,49.99),(49.99,49.99)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 |&> '(49.99,49.99),(49.99,49.99)'; + +SELECT * FROM box_temp WHERE f1 |>> '(37,38),(39,40)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 |>> '(37,38),(39,40)'; + +SELECT * FROM box_temp WHERE f1 @> '(10,11),(15,16)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 @> '(10,11),(15,15)'; + +SELECT * FROM box_temp WHERE f1 <@ '(10,15),(30,35)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 <@ '(10,15),(30,35)'; + +SELECT * FROM box_temp WHERE f1 ~= '(20,20),(40,40)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 ~= '(20,20),(40,40)'; + +RESET enable_seqscan; + +DROP INDEX box_spgist; + +-- +-- Test the SP-GiST index on the larger volume of data +-- +CREATE TABLE quad_box_tbl (id int, b box); + +INSERT INTO quad_box_tbl + SELECT (x - 1) * 100 + y, box(point(x * 10, y * 10), point(x * 10 + 5, y * 10 + 5)) + FROM generate_series(1, 100) x, + generate_series(1, 100) y; + +-- insert repeating data to test allTheSame +INSERT INTO quad_box_tbl + SELECT i, '((200, 300),(210, 310))' + FROM generate_series(10001, 11000) AS i; + +INSERT INTO quad_box_tbl +VALUES + (11001, NULL), + (11002, NULL), + (11003, '((-infinity,-infinity),(infinity,infinity))'), + (11004, '((-infinity,100),(-infinity,500))'), + (11005, '((-infinity,-infinity),(700,infinity))'); + +CREATE INDEX quad_box_tbl_idx ON quad_box_tbl USING spgist(b); + +-- get reference results for ORDER BY distance from seq scan +SET enable_seqscan = ON; +SET enable_indexscan = OFF; +SET enable_bitmapscan = OFF; + +CREATE TABLE quad_box_tbl_ord_seq1 AS +SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id +FROM quad_box_tbl; + +CREATE TABLE quad_box_tbl_ord_seq2 AS +SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id +FROM quad_box_tbl WHERE b <@ box '((200,300),(500,600))'; + +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = ON; + +SELECT count(*) FROM quad_box_tbl WHERE b &< box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b && box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b &> box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b <<| box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b &<| box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b |&> box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b |>> box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b @> box '((201,301),(202,303))'; +SELECT count(*) FROM quad_box_tbl WHERE b <@ box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b ~= box '((200,300),(205,305))'; + +-- test ORDER BY distance +SET enable_indexscan = ON; +SET enable_bitmapscan = OFF; + +EXPLAIN (COSTS OFF) +SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id +FROM quad_box_tbl; + +CREATE TEMP TABLE quad_box_tbl_ord_idx1 AS +SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id +FROM quad_box_tbl; + +SELECT * +FROM quad_box_tbl_ord_seq1 seq FULL JOIN quad_box_tbl_ord_idx1 idx + ON seq.n = idx.n AND seq.id = idx.id AND + (seq.dist = idx.dist OR seq.dist IS NULL AND idx.dist IS NULL) +WHERE seq.id IS NULL OR idx.id IS NULL; + + +EXPLAIN (COSTS OFF) +SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id +FROM quad_box_tbl WHERE b <@ box '((200,300),(500,600))'; + +CREATE TEMP TABLE quad_box_tbl_ord_idx2 AS +SELECT rank() OVER (ORDER BY b <-> point '123,456') n, b <-> point '123,456' dist, id +FROM quad_box_tbl WHERE b <@ box '((200,300),(500,600))'; + +SELECT * +FROM quad_box_tbl_ord_seq2 seq FULL JOIN quad_box_tbl_ord_idx2 idx + ON seq.n = idx.n AND seq.id = idx.id AND + (seq.dist = idx.dist OR seq.dist IS NULL AND idx.dist IS NULL) +WHERE seq.id IS NULL OR idx.id IS NULL; + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; +-- left of +SELECT '' AS two, b.f1 + FROM BOX_TBL b + WHERE b.f1 << box '(3.0,3.0,5.0,5.0)'; + +-- right of +SELECT '' AS two, b.f1 + FROM BOX_TBL b + WHERE box '(3.0,3.0,5.0,5.0)' >> b.f1; + +SELECT * FROM box_temp WHERE f1 << '(10,20),(30,40)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 << '(10,20),(30,40)'; + +SELECT * FROM box_temp WHERE f1 >> '(30,40),(40,30)'; +EXPLAIN (COSTS OFF) SELECT * FROM box_temp WHERE f1 >> '(30,40),(40,30)'; + +SELECT count(*) FROM quad_box_tbl WHERE b << box '((100,200),(300,500))'; + +SELECT count(*) FROM quad_box_tbl WHERE b >> box '((100,200),(300,500))'; +SELECT count(*) FROM quad_box_tbl WHERE b >> box '((100,200),(300,500))'; + + \ No newline at end of file diff --git a/postgresql/examples/brin.sql b/postgresql/examples/brin.sql new file mode 100644 index 0000000..ecfe474 --- /dev/null +++ b/postgresql/examples/brin.sql @@ -0,0 +1,473 @@ +CREATE TABLE brintest (byteacol bytea, + charcol "char", + namecol name, + int8col bigint, + int2col smallint, + int4col integer, + textcol text, + oidcol oid, + tidcol tid, + float4col real, + float8col double precision, + macaddrcol macaddr, + inetcol inet, + cidrcol cidr, + bpcharcol character, + datecol date, + timecol time without time zone, + timestampcol timestamp without time zone, + timestamptzcol timestamp with time zone, + intervalcol interval, + timetzcol time with time zone, + bitcol bit(10), + varbitcol bit varying(16), + numericcol numeric, + uuidcol uuid, + int4rangecol int4range, + lsncol pg_lsn, + boxcol box +) WITH (fillfactor=10); + +INSERT INTO brintest SELECT + repeat(stringu1, 8)::bytea, + substr(stringu1, 1, 1)::"char", + stringu1::name, 142857 * tenthous, + thousand, + twothousand, + repeat(stringu1, 8), + unique1::oid, + format('(%s,%s)', tenthous, twenty)::tid, + (four + 1.0)/(hundred+1), + odd::float8 / (tenthous + 1), + format('%s:00:%s:00:%s:00', to_hex(odd), to_hex(even), to_hex(hundred))::macaddr, + inet '10.2.3.4/24' + tenthous, + cidr '10.2.3/24' + tenthous, + substr(stringu1, 1, 1)::bpchar, + date '1995-08-15' + tenthous, + time '01:20:30' + thousand * interval '18.5 second', + timestamp '1942-07-23 03:05:09' + tenthous * interval '36.38 hours', + timestamptz '1972-10-10 03:00' + thousand * interval '1 hour', + justify_days(justify_hours(tenthous * interval '12 minutes')), + timetz '01:30:20+02' + hundred * interval '15 seconds', + thousand::bit(10), + tenthous::bit(16)::varbit, + tenthous::numeric(36,30) * fivethous * even / (hundred + 1), + format('%s%s-%s-%s-%s-%s%s%s', to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'))::uuid, + int4range(thousand, twothousand), + format('%s/%s%s', odd, even, tenthous)::pg_lsn, + box(point(odd, even), point(thousand, twothousand)) +FROM tenk1 ORDER BY unique2 LIMIT 100; + +-- throw in some NULL's and different values +INSERT INTO brintest (inetcol, cidrcol, int4rangecol) SELECT + inet 'fe80::6e40:8ff:fea9:8c46' + tenthous, + cidr 'fe80::6e40:8ff:fea9:8c46' + tenthous, + 'empty'::int4range +FROM tenk1 ORDER BY thousand, tenthous LIMIT 25; + +CREATE INDEX brinidx ON brintest USING brin ( + byteacol, + charcol, + namecol, + int8col, + int2col, + int4col, + textcol, + oidcol, + tidcol, + float4col, + float8col, + macaddrcol, + inetcol inet_inclusion_ops, + inetcol inet_minmax_ops, + cidrcol inet_inclusion_ops, + cidrcol inet_minmax_ops, + bpcharcol, + datecol, + timecol, + timestampcol, + timestamptzcol, + intervalcol, + timetzcol, + bitcol, + varbitcol, + numericcol, + uuidcol, + int4rangecol, + lsncol, + boxcol +) with (pages_per_range = 1); + +CREATE TABLE brinopers (colname name, typ text, + op text[], value text[], matches int[], + check (cardinality(op) = cardinality(value)), + check (cardinality(op) = cardinality(matches))); + +INSERT INTO brinopers VALUES + ('byteacol', 'bytea', + '{>, >=, =, <=, <}', + '{AAAAAA, AAAAAA, BNAAAABNAAAABNAAAABNAAAABNAAAABNAAAABNAAAABNAAAA, ZZZZZZ, ZZZZZZ}', + '{100, 100, 1, 100, 100}'), + ('charcol', '"char"', + '{>, >=, =, <=, <}', + '{A, A, M, Z, Z}', + '{97, 100, 6, 100, 98}'), + ('namecol', 'name', + '{>, >=, =, <=, <}', + '{AAAAAA, AAAAAA, MAAAAA, ZZAAAA, ZZAAAA}', + '{100, 100, 2, 100, 100}'), + ('int2col', 'int2', + '{>, >=, =, <=, <}', + '{0, 0, 800, 999, 999}', + '{100, 100, 1, 100, 100}'), + ('int2col', 'int4', + '{>, >=, =, <=, <}', + '{0, 0, 800, 999, 1999}', + '{100, 100, 1, 100, 100}'), + ('int2col', 'int8', + '{>, >=, =, <=, <}', + '{0, 0, 800, 999, 1428427143}', + '{100, 100, 1, 100, 100}'), + ('int4col', 'int2', + '{>, >=, =, <=, <}', + '{0, 0, 800, 1999, 1999}', + '{100, 100, 1, 100, 100}'), + ('int4col', 'int4', + '{>, >=, =, <=, <}', + '{0, 0, 800, 1999, 1999}', + '{100, 100, 1, 100, 100}'), + ('int4col', 'int8', + '{>, >=, =, <=, <}', + '{0, 0, 800, 1999, 1428427143}', + '{100, 100, 1, 100, 100}'), + ('int8col', 'int2', + '{>, >=}', + '{0, 0}', + '{100, 100}'), + ('int8col', 'int4', + '{>, >=}', + '{0, 0}', + '{100, 100}'), + ('int8col', 'int8', + '{>, >=, =, <=, <}', + '{0, 0, 1257141600, 1428427143, 1428427143}', + '{100, 100, 1, 100, 100}'), + ('textcol', 'text', + '{>, >=, =, <=, <}', + '{ABABAB, ABABAB, BNAAAABNAAAABNAAAABNAAAABNAAAABNAAAABNAAAABNAAAA, ZZAAAA, ZZAAAA}', + '{100, 100, 1, 100, 100}'), + ('oidcol', 'oid', + '{>, >=, =, <=, <}', + '{0, 0, 8800, 9999, 9999}', + '{100, 100, 1, 100, 100}'), + ('tidcol', 'tid', + '{>, >=, =, <=, <}', + '{"(0,0)", "(0,0)", "(8800,0)", "(9999,19)", "(9999,19)"}', + '{100, 100, 1, 100, 100}'), + ('float4col', 'float4', + '{>, >=, =, <=, <}', + '{0.0103093, 0.0103093, 1, 1, 1}', + '{100, 100, 4, 100, 96}'), + ('float4col', 'float8', + '{>, >=, =, <=, <}', + '{0.0103093, 0.0103093, 1, 1, 1}', + '{100, 100, 4, 100, 96}'), + ('float8col', 'float4', + '{>, >=, =, <=, <}', + '{0, 0, 0, 1.98, 1.98}', + '{99, 100, 1, 100, 100}'), + ('float8col', 'float8', + '{>, >=, =, <=, <}', + '{0, 0, 0, 1.98, 1.98}', + '{99, 100, 1, 100, 100}'), + ('macaddrcol', 'macaddr', + '{>, >=, =, <=, <}', + '{00:00:01:00:00:00, 00:00:01:00:00:00, 2c:00:2d:00:16:00, ff:fe:00:00:00:00, ff:fe:00:00:00:00}', + '{99, 100, 2, 100, 100}'), + ('inetcol', 'inet', + '{&&, =, <, <=, >, >=, >>=, >>, <<=, <<}', + '{10/8, 10.2.14.231/24, 255.255.255.255, 255.255.255.255, 0.0.0.0, 0.0.0.0, 10.2.14.231/24, 10.2.14.231/25, 10.2.14.231/8, 0/0}', + '{100, 1, 100, 100, 125, 125, 2, 2, 100, 100}'), + ('inetcol', 'inet', + '{&&, >>=, <<=, =}', + '{fe80::6e40:8ff:fea9:a673/32, fe80::6e40:8ff:fea9:8c46, fe80::6e40:8ff:fea9:a673/32, fe80::6e40:8ff:fea9:8c46}', + '{25, 1, 25, 1}'), + ('inetcol', 'cidr', + '{&&, <, <=, >, >=, >>=, >>, <<=, <<}', + '{10/8, 255.255.255.255, 255.255.255.255, 0.0.0.0, 0.0.0.0, 10.2.14/24, 10.2.14/25, 10/8, 0/0}', + '{100, 100, 100, 125, 125, 2, 2, 100, 100}'), + ('inetcol', 'cidr', + '{&&, >>=, <<=, =}', + '{fe80::/32, fe80::6e40:8ff:fea9:8c46, fe80::/32, fe80::6e40:8ff:fea9:8c46}', + '{25, 1, 25, 1}'), + ('cidrcol', 'inet', + '{&&, =, <, <=, >, >=, >>=, >>, <<=, <<}', + '{10/8, 10.2.14/24, 255.255.255.255, 255.255.255.255, 0.0.0.0, 0.0.0.0, 10.2.14.231/24, 10.2.14.231/25, 10.2.14.231/8, 0/0}', + '{100, 2, 100, 100, 125, 125, 2, 2, 100, 100}'), + ('cidrcol', 'inet', + '{&&, >>=, <<=, =}', + '{fe80::6e40:8ff:fea9:a673/32, fe80::6e40:8ff:fea9:8c46, fe80::6e40:8ff:fea9:a673/32, fe80::6e40:8ff:fea9:8c46}', + '{25, 1, 25, 1}'), + ('cidrcol', 'cidr', + '{&&, =, <, <=, >, >=, >>=, >>, <<=, <<}', + '{10/8, 10.2.14/24, 255.255.255.255, 255.255.255.255, 0.0.0.0, 0.0.0.0, 10.2.14/24, 10.2.14/25, 10/8, 0/0}', + '{100, 2, 100, 100, 125, 125, 2, 2, 100, 100}'), + ('cidrcol', 'cidr', + '{&&, >>=, <<=, =}', + '{fe80::/32, fe80::6e40:8ff:fea9:8c46, fe80::/32, fe80::6e40:8ff:fea9:8c46}', + '{25, 1, 25, 1}'), + ('bpcharcol', 'bpchar', + '{>, >=, =, <=, <}', + '{A, A, W, Z, Z}', + '{97, 100, 6, 100, 98}'), + ('datecol', 'date', + '{>, >=, =, <=, <}', + '{1995-08-15, 1995-08-15, 2009-12-01, 2022-12-30, 2022-12-30}', + '{100, 100, 1, 100, 100}'), + ('timecol', 'time', + '{>, >=, =, <=, <}', + '{01:20:30, 01:20:30, 02:28:57, 06:28:31.5, 06:28:31.5}', + '{100, 100, 1, 100, 100}'), + ('timestampcol', 'timestamp', + '{>, >=, =, <=, <}', + '{1942-07-23 03:05:09, 1942-07-23 03:05:09, 1964-03-24 19:26:45, 1984-01-20 22:42:21, 1984-01-20 22:42:21}', + '{100, 100, 1, 100, 100}'), + ('timestampcol', 'timestamptz', + '{>, >=, =, <=, <}', + '{1942-07-23 03:05:09, 1942-07-23 03:05:09, 1964-03-24 19:26:45, 1984-01-20 22:42:21, 1984-01-20 22:42:21}', + '{100, 100, 1, 100, 100}'), + ('timestamptzcol', 'timestamptz', + '{>, >=, =, <=, <}', + '{1972-10-10 03:00:00-04, 1972-10-10 03:00:00-04, 1972-10-19 09:00:00-07, 1972-11-20 19:00:00-03, 1972-11-20 19:00:00-03}', + '{100, 100, 1, 100, 100}'), + ('intervalcol', 'interval', + '{>, >=, =, <=, <}', + '{00:00:00, 00:00:00, 1 mons 13 days 12:24, 2 mons 23 days 07:48:00, 1 year}', + '{100, 100, 1, 100, 100}'), + ('timetzcol', 'timetz', + '{>, >=, =, <=, <}', + '{01:30:20+02, 01:30:20+02, 01:35:50+02, 23:55:05+02, 23:55:05+02}', + '{99, 100, 2, 100, 100}'), + ('bitcol', 'bit(10)', + '{>, >=, =, <=, <}', + '{0000000010, 0000000010, 0011011110, 1111111000, 1111111000}', + '{100, 100, 1, 100, 100}'), + ('varbitcol', 'varbit(16)', + '{>, >=, =, <=, <}', + '{0000000000000100, 0000000000000100, 0001010001100110, 1111111111111000, 1111111111111000}', + '{100, 100, 1, 100, 100}'), + ('numericcol', 'numeric', + '{>, >=, =, <=, <}', + '{0.00, 0.01, 2268164.347826086956521739130434782609, 99470151.9, 99470151.9}', + '{100, 100, 1, 100, 100}'), + ('uuidcol', 'uuid', + '{>, >=, =, <=, <}', + '{00040004-0004-0004-0004-000400040004, 00040004-0004-0004-0004-000400040004, 52225222-5222-5222-5222-522252225222, 99989998-9998-9998-9998-999899989998, 99989998-9998-9998-9998-999899989998}', + '{100, 100, 1, 100, 100}'), + ('int4rangecol', 'int4range', + '{<<, &<, &&, &>, >>, @>, <@, =, <, <=, >, >=}', + '{"[10000,)","[10000,)","(,]","[3,4)","[36,44)","(1500,1501]","[3,4)","[222,1222)","[36,44)","[43,1043)","[367,4466)","[519,)"}', + '{53, 53, 53, 53, 50, 22, 72, 1, 74, 75, 34, 21}'), + ('int4rangecol', 'int4range', + '{@>, <@, =, <=, >, >=}', + '{empty, empty, empty, empty, empty, empty}', + '{125, 72, 72, 72, 53, 125}'), + ('int4rangecol', 'int4', + '{@>}', + '{1500}', + '{22}'), + ('lsncol', 'pg_lsn', + '{>, >=, =, <=, <, IS, IS NOT}', + '{0/1200, 0/1200, 44/455222, 198/1999799, 198/1999799, NULL, NULL}', + '{100, 100, 1, 100, 100, 25, 100}'), + ('boxcol', 'point', + '{@>}', + '{"(500,43)"}', + '{11}'), + ('boxcol', 'box', + '{<<, &<, &&, &>, >>, <<|, &<|, |&>, |>>, @>, <@, ~=}', + '{"((1000,2000),(3000,4000))","((1,2),(3000,4000))","((1,2),(3000,4000))","((1,2),(3000,4000))","((1,2),(3,4))","((1000,2000),(3000,4000))","((1,2000),(3,4000))","((1000,2),(3000,4))","((1,2),(3,4))","((1,2),(300,400))","((1,2),(3000,4000))","((222,1222),(44,45))"}', + '{100, 100, 100, 99, 96, 100, 100, 99, 96, 1, 99, 1}'); + + +RESET enable_seqscan; +RESET enable_bitmapscan; + +INSERT INTO brintest SELECT + repeat(stringu1, 42)::bytea, + substr(stringu1, 1, 1)::"char", + stringu1::name, 142857 * tenthous, + thousand, + twothousand, + repeat(stringu1, 42), + unique1::oid, + format('(%s,%s)', tenthous, twenty)::tid, + (four + 1.0)/(hundred+1), + odd::float8 / (tenthous + 1), + format('%s:00:%s:00:%s:00', to_hex(odd), to_hex(even), to_hex(hundred))::macaddr, + inet '10.2.3.4' + tenthous, + cidr '10.2.3/24' + tenthous, + substr(stringu1, 1, 1)::bpchar, + date '1995-08-15' + tenthous, + time '01:20:30' + thousand * interval '18.5 second', + timestamp '1942-07-23 03:05:09' + tenthous * interval '36.38 hours', + timestamptz '1972-10-10 03:00' + thousand * interval '1 hour', + justify_days(justify_hours(tenthous * interval '12 minutes')), + timetz '01:30:20' + hundred * interval '15 seconds', + thousand::bit(10), + tenthous::bit(16)::varbit, + tenthous::numeric(36,30) * fivethous * even / (hundred + 1), + format('%s%s-%s-%s-%s-%s%s%s', to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'), to_char(tenthous, 'FM0000'))::uuid, + int4range(thousand, twothousand), + format('%s/%s%s', odd, even, tenthous)::pg_lsn, + box(point(odd, even), point(thousand, twothousand)) +FROM tenk1 ORDER BY unique2 LIMIT 5 OFFSET 5; + +SELECT brin_desummarize_range('brinidx', 0); +VACUUM brintest; -- force a summarization cycle in brinidx + +UPDATE brintest SET int8col = int8col * int4col; +UPDATE brintest SET textcol = '' WHERE textcol IS NOT NULL; + +-- Tests for brin_summarize_new_values +SELECT brin_summarize_new_values('brintest'); -- error, not an index +SELECT brin_summarize_new_values('tenk1_unique1'); -- error, not a BRIN index +SELECT brin_summarize_new_values('brinidx'); -- ok, no change expected + +-- Tests for brin_desummarize_range +SELECT brin_desummarize_range('brinidx', -1); -- error, invalid range +SELECT brin_desummarize_range('brinidx', 0); +SELECT brin_desummarize_range('brinidx', 0); +SELECT brin_desummarize_range('brinidx', 100000000); + +-- Test brin_summarize_range +CREATE TABLE brin_summarize ( + value int +) WITH (fillfactor=10, autovacuum_enabled=false); +CREATE INDEX brin_summarize_idx ON brin_summarize USING brin (value) WITH (pages_per_range=2); +-- Fill a few pages +DO $$ +DECLARE curtid tid; +BEGIN + LOOP + INSERT INTO brin_summarize VALUES (1) RETURNING ctid INTO curtid; + EXIT WHEN curtid > tid '(2, 0)'; + END LOOP; +END; +$$; + +-- summarize one range +SELECT brin_summarize_range('brin_summarize_idx', 0); +-- nothing: already summarized +SELECT brin_summarize_range('brin_summarize_idx', 1); +-- summarize one range +SELECT brin_summarize_range('brin_summarize_idx', 2); +-- nothing: page doesn't exist in table +SELECT brin_summarize_range('brin_summarize_idx', 4294967295); +-- invalid block number values +SELECT brin_summarize_range('brin_summarize_idx', -1); +SELECT brin_summarize_range('brin_summarize_idx', 4294967296); + +-- test value merging in add_value +CREATE TABLE brintest_2 (n numrange); +CREATE INDEX brinidx_2 ON brintest_2 USING brin (n); +INSERT INTO brintest_2 VALUES ('empty'); +INSERT INTO brintest_2 VALUES (numrange(0, 2^1000::numeric)); +INSERT INTO brintest_2 VALUES ('(-1, 0)'); + +SELECT brin_desummarize_range('brinidx', 0); +SELECT brin_summarize_range('brinidx', 0); +DROP TABLE brintest_2; + +-- test brin cost estimates behave sanely based on correlation of values +CREATE TABLE brin_test (a INT, b INT); +INSERT INTO brin_test SELECT x/100,x%100 FROM generate_series(1,10000) x(x); +CREATE INDEX brin_test_a_idx ON brin_test USING brin (a) WITH (pages_per_range = 2); +CREATE INDEX brin_test_b_idx ON brin_test USING brin (b) WITH (pages_per_range = 2); +VACUUM ANALYZE brin_test; + +-- Ensure brin index is used when columns are perfectly correlated +EXPLAIN (COSTS OFF) SELECT * FROM brin_test WHERE a = 1; +-- Ensure brin index is not used when values are not correlated +EXPLAIN (COSTS OFF) SELECT * FROM brin_test WHERE b = 1; +DO $x$ +DECLARE + r record; + r2 record; + cond text; + idx_ctids tid[]; + ss_ctids tid[]; + count int; + plan_ok bool; + plan_line text; +BEGIN + FOR r IN SELECT colname, oper, typ, value[ordinality], matches[ordinality] FROM brinopers, unnest(op) WITH ORDINALITY AS oper LOOP + + -- prepare the condition + IF r.value IS NULL THEN + cond := format('%I %s %L', r.colname, r.oper, r.value); + ELSE + cond := format('%I %s %L::%s', r.colname, r.oper, r.value, r.typ); + END IF; + + -- run the query using the brin index + SET enable_seqscan = 0; + SET enable_bitmapscan = 1; + + plan_ok := false; + FOR plan_line IN EXECUTE format($y$EXPLAIN SELECT array_agg(ctid) FROM brintest WHERE %s $y$, cond) LOOP + IF plan_line LIKE '%Bitmap Heap Scan on brintest%' THEN + plan_ok := true; + END IF; + END LOOP; + IF NOT plan_ok THEN + RAISE WARNING 'did not get bitmap indexscan plan for %', r; + END IF; + + EXECUTE format($y$SELECT array_agg(ctid) FROM brintest WHERE %s $y$, cond) + INTO idx_ctids; + + -- run the query using a seqscan + SET enable_seqscan = 1; + SET enable_bitmapscan = 0; + + plan_ok := false; + FOR plan_line IN EXECUTE format($y$EXPLAIN SELECT array_agg(ctid) FROM brintest WHERE %s $y$, cond) LOOP + IF plan_line LIKE '%Seq Scan on brintest%' THEN + plan_ok := true; + END IF; + END LOOP; + IF NOT plan_ok THEN + RAISE WARNING 'did not get seqscan plan for %', r; + END IF; + + EXECUTE format($y$SELECT array_agg(ctid) FROM brintest WHERE %s $y$, cond) + INTO ss_ctids; + + -- make sure both return the same results + count := array_length(idx_ctids, 1); + + IF NOT (count = array_length(ss_ctids, 1) AND + idx_ctids @> ss_ctids AND + idx_ctids <@ ss_ctids) THEN + -- report the results of each scan to make the differences obvious + RAISE WARNING 'something not right in %: count %', r, count; + SET enable_seqscan = 1; + SET enable_bitmapscan = 0; + FOR r2 IN EXECUTE 'SELECT ' || r.colname || ' FROM brintest WHERE ' || cond LOOP + RAISE NOTICE 'seqscan: %', r2; + END LOOP; + + SET enable_seqscan = 0; + SET enable_bitmapscan = 1; + FOR r2 IN EXECUTE 'SELECT ' || r.colname || ' FROM brintest WHERE ' || cond LOOP + RAISE NOTICE 'bitmapscan: %', r2; + END LOOP; + END IF; + + -- make sure we found expected number of matches + IF count != r.matches THEN RAISE WARNING 'unexpected number of results % for %', count, r; END IF; + END LOOP; +END; +$x$; + diff --git a/postgresql/examples/btree_index.sql b/postgresql/examples/btree_index.sql new file mode 100644 index 0000000..96f5381 --- /dev/null +++ b/postgresql/examples/btree_index.sql @@ -0,0 +1,193 @@ +-- +-- BTREE_INDEX +-- test retrieval of min/max keys for each index +-- + +SELECT b.* + FROM bt_i4_heap b + WHERE b.seqno < 1; + +SELECT b.* + FROM bt_i4_heap b + WHERE b.seqno >= 9999; + +SELECT b.* + FROM bt_i4_heap b + WHERE b.seqno = 4500; + +SELECT b.* + FROM bt_name_heap b + WHERE b.seqno < '1'::name; + +SELECT b.* + FROM bt_name_heap b + WHERE b.seqno >= '9999'::name; + +SELECT b.* + FROM bt_name_heap b + WHERE b.seqno = '4500'::name; + +SELECT b.* + FROM bt_txt_heap b + WHERE b.seqno < '1'::text; + +SELECT b.* + FROM bt_txt_heap b + WHERE b.seqno >= '9999'::text; + +SELECT b.* + FROM bt_txt_heap b + WHERE b.seqno = '4500'::text; + +SELECT b.* + FROM bt_f8_heap b + WHERE b.seqno < '1'::float8; + +SELECT b.* + FROM bt_f8_heap b + WHERE b.seqno >= '9999'::float8; + +SELECT b.* + FROM bt_f8_heap b + WHERE b.seqno = '4500'::float8; + +-- +-- Check correct optimization of LIKE (special index operator support) +-- for both indexscan and bitmapscan cases +-- + +set enable_seqscan to false; +set enable_indexscan to true; +set enable_bitmapscan to false; +explain (costs off) +select proname from pg_proc where proname like E'RI\\_FKey%del' order by 1; +select proname from pg_proc where proname like E'RI\\_FKey%del' order by 1; +explain (costs off) +select proname from pg_proc where proname ilike '00%foo' order by 1; +select proname from pg_proc where proname ilike '00%foo' order by 1; +explain (costs off) +select proname from pg_proc where proname ilike 'ri%foo' order by 1; + +set enable_indexscan to false; +set enable_bitmapscan to true; +explain (costs off) +select proname from pg_proc where proname like E'RI\\_FKey%del' order by 1; +select proname from pg_proc where proname like E'RI\\_FKey%del' order by 1; +explain (costs off) +select proname from pg_proc where proname ilike '00%foo' order by 1; +select proname from pg_proc where proname ilike '00%foo' order by 1; +explain (costs off) +select proname from pg_proc where proname ilike 'ri%foo' order by 1; + +reset enable_seqscan; +reset enable_indexscan; +reset enable_bitmapscan; + +-- Also check LIKE optimization with binary-compatible cases + +create temp table btree_bpchar (f1 text collate "C"); +create index on btree_bpchar(f1 bpchar_ops) WITH (deduplicate_items=on); +insert into btree_bpchar values ('foo'), ('fool'), ('bar'), ('quux'); +-- doesn't match index: +explain (costs off) +select * from btree_bpchar where f1 like 'foo'; +select * from btree_bpchar where f1 like 'foo'; +explain (costs off) +select * from btree_bpchar where f1 like 'foo%'; +select * from btree_bpchar where f1 like 'foo%'; +-- these do match the index: +explain (costs off) +select * from btree_bpchar where f1::bpchar like 'foo'; +select * from btree_bpchar where f1::bpchar like 'foo'; +explain (costs off) +select * from btree_bpchar where f1::bpchar like 'foo%'; +select * from btree_bpchar where f1::bpchar like 'foo%'; + +-- get test coverage for "single value" deduplication strategy: +insert into btree_bpchar select 'foo' from generate_series(1,1500); + +-- +-- Perform unique checking, with and without the use of deduplication +-- +CREATE TABLE dedup_unique_test_table (a int) WITH (autovacuum_enabled=false); +CREATE UNIQUE INDEX dedup_unique ON dedup_unique_test_table (a) WITH (deduplicate_items=on); +CREATE UNIQUE INDEX plain_unique ON dedup_unique_test_table (a) WITH (deduplicate_items=off); +-- Generate enough garbage tuples in index to ensure that even the unique index +-- with deduplication enabled has to check multiple leaf pages during unique +-- checking (at least with a BLCKSZ of 8192 or less) +DO $$ +BEGIN + FOR r IN 1..1350 LOOP + DELETE FROM dedup_unique_test_table; + INSERT INTO dedup_unique_test_table SELECT 1; + END LOOP; +END$$; + +-- Exercise the LP_DEAD-bit-set tuple deletion code with a posting list tuple. +-- The implementation prefers deleting existing items to merging any duplicate +-- tuples into a posting list, so we need an explicit test to make sure we get +-- coverage (note that this test also assumes BLCKSZ is 8192 or less): +DROP INDEX plain_unique; +DELETE FROM dedup_unique_test_table WHERE a = 1; +INSERT INTO dedup_unique_test_table SELECT i FROM generate_series(0,450) i; + +-- +-- Test B-tree fast path (cache rightmost leaf page) optimization. +-- + +-- First create a tree that's at least three levels deep (i.e. has one level +-- between the root and leaf levels). The text inserted is long. It won't be +-- TOAST compressed because we use plain storage in the table. Only a few +-- index tuples fit on each internal page, allowing us to get a tall tree with +-- few pages. (A tall tree is required to trigger caching.) +-- +-- The text column must be the leading column in the index, since suffix +-- truncation would otherwise truncate tuples on internal pages, leaving us +-- with a short tree. +create table btree_tall_tbl(id int4, t text); +alter table btree_tall_tbl alter COLUMN t set storage plain; +create index btree_tall_idx on btree_tall_tbl (t, id) with (fillfactor = 10); +insert into btree_tall_tbl select g, repeat('x', 250) +from generate_series(1, 130) g; + +-- +-- Test vacuum_cleanup_index_scale_factor +-- + +-- Simple create +create table btree_test(a int); +create index btree_idx1 on btree_test(a) with (vacuum_cleanup_index_scale_factor = 40.0); +select reloptions from pg_class WHERE oid = 'btree_idx1'::regclass; + +-- Fail while setting improper values +create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = -10.0); +create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = 100.0); +create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = 'string'); +create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = true); + +-- Simple ALTER INDEX +alter index btree_idx1 set (vacuum_cleanup_index_scale_factor = 70.0); +select reloptions from pg_class WHERE oid = 'btree_idx1'::regclass; + +-- +-- Test for multilevel page deletion +-- +CREATE TABLE delete_test_table (a bigint, b bigint, c bigint, d bigint); +INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,80000) i; +ALTER TABLE delete_test_table ADD PRIMARY KEY (a,b,c,d); +-- Delete most entries, and vacuum, deleting internal pages and creating "fast +-- root" +DELETE FROM delete_test_table WHERE a < 79990; +VACUUM delete_test_table; + +-- +-- Test B-tree insertion with a metapage update (XLOG_BTREE_INSERT_META +-- WAL record type). This happens when a "fast root" page is split. This +-- also creates coverage for nbtree FSM page recycling. +-- +-- The vacuum above should've turned the leaf page into a fast root. We just +-- need to insert some rows to cause the fast root page to split. +INSERT INTO delete_test_table SELECT i, 1, 2, 3 FROM generate_series(1,1000) i; + +-- Test unsupported btree opclass parameters +create index on btree_tall_tbl (id int4_ops(foo=1)); diff --git a/postgresql/examples/builtin_functions_date.sql b/postgresql/examples/builtin_functions_date.sql new file mode 100644 index 0000000..ff2911e --- /dev/null +++ b/postgresql/examples/builtin_functions_date.sql @@ -0,0 +1,37 @@ +SELECT AGE(TIMESTAMP '2001-04-10', TIMESTAMP '1957-06-13'); +SELECT AGE(TIMESTAMP '1957-06-13'); +SELECT CLOCK_TIMESTAMP(); +SELECT CURRENT_DATE; +SELECT CURRENT_TIME; +SELECT CURRENT_TIME(2); +SELECT CURRENT_TIMESTAMP; +SELECT CURRENT_TIMESTAMP(0); +SELECT DATE_BIN('15 MINUTES', TIMESTAMP '2001-02-16 20:38:40', TIMESTAMP '2001-02-16 20:05:00'); +SELECT DATE_PART('HOUR', TIMESTAMP '2001-02-16 20:38:40'); +SELECT DATE_PART('MONTH', INTERVAL '2 YEARS 3 MONTHS'); +SELECT DATE_TRUNC('HOUR', TIMESTAMP '2001-02-16 20:38:40'); +SELECT DATE_TRUNC('DAY', TIMESTAMPTZ '2001-02-16 20:38:40+00', 'AUSTRALIA/SYDNEY'); +SELECT DATE_TRUNC('HOUR', INTERVAL '2 DAYS 3 HOURS 40 MINUTES'); +SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40'); +SELECT EXTRACT(MONTH FROM INTERVAL '2 YEARS 3 MONTHS'); +SELECT ISFINITE(DATE '2001-02-16'); +SELECT ISFINITE(TIMESTAMP 'INFINITY'); +SELECT ISFINITE(INTERVAL '4 HOURS'); +SELECT JUSTIFY_DAYS(INTERVAL '35 DAYS'); +SELECT JUSTIFY_HOURS(INTERVAL '27 HOURS'); +SELECT JUSTIFY_INTERVAL(INTERVAL '1 MON -1 HOUR'); +SELECT LOCALTIME; +SELECT LOCALTIME(0); +SELECT LOCALTIMESTAMP; +SELECT LOCALTIMESTAMP(2); +SELECT MAKE_DATE(2013, 7, 15); +SELECT MAKE_INTERVAL(DAYS => 10); +SELECT MAKE_TIME(8, 15, 23.5); +SELECT MAKE_TIMESTAMP(2013, 7, 15, 8, 15, 23.5); +SELECT MAKE_TIMESTAMPTZ(2013, 7, 15, 8, 15, 23.5); +SELECT MAKE_TIMESTAMPTZ(2013, 7, 15, 8, 15, 23.5, 'AMERICA/NEW_YORK'); +SELECT NOW(); +SELECT STATEMENT_TIMESTAMP(); +SELECT TIMEOFDAY(); +SELECT TRANSACTION_TIMESTAMP(); +SELECT TO_TIMESTAMP(1284352323); \ No newline at end of file diff --git a/postgresql/examples/builtin_functions_format_date.sql b/postgresql/examples/builtin_functions_format_date.sql new file mode 100644 index 0000000..6da7eb8 --- /dev/null +++ b/postgresql/examples/builtin_functions_format_date.sql @@ -0,0 +1,8 @@ +SELECT TO_CHAR(TIMESTAMP '2002-04-20 17:31:12.66', 'HH12:MI:SS') ; +SELECT TO_CHAR ( INTERVAL, TEXT ) ; +SELECT TO_CHAR ( NUMERIC_TYPE, TEXT ) ; +SELECT TO_CHAR(125.8::REAL, '999D9') ; +SELECT TO_CHAR(-125.8, '999D99S') ; +SELECT TO_DATE('05 DEC 2000', 'DD MON YYYY') ; +SELECT TO_NUMBER('12,454.8-', '99G999D9S') ; +SELECT TO_TIMESTAMP('05 DEC 2000', 'DD MON YYYY') ; \ No newline at end of file diff --git a/postgresql/examples/builtin_functions_math.sql b/postgresql/examples/builtin_functions_math.sql new file mode 100644 index 0000000..8d58c18 --- /dev/null +++ b/postgresql/examples/builtin_functions_math.sql @@ -0,0 +1,57 @@ +SELECT ABS(-17.4); +SELECT CBRT(64.0); +SELECT CEIL(42.2); +SELECT CEIL(-42.8); +SELECT CEILING(95.3); +SELECT DEGREES(0.5); +SELECT DIV(9, 4); +SELECT EXP(1.0); +SELECT FACTORIAL(5); +SELECT FLOOR(42.8); +SELECT FLOOR(-42.8); +SELECT GCD(1071, 462); +SELECT LCM(1071, 462); +SELECT LN(2.0); +SELECT LOG(100); +SELECT LOG10(1000); +SELECT LOG(2.0, 64.0); +SELECT MIN_SCALE(8.4100); +SELECT MOD(9, 4); +SELECT PI(); +SELECT POWER(9, 3); +SELECT RADIANS(45.0); +SELECT ROUND(42.4); +SELECT ROUND(42.4382, 2); +SELECT SCALE(8.4100); +SELECT SIGN(-8.4); +SELECT SQRT(2); +SELECT TRIM_SCALE(8.4100); +SELECT TRUNC(42.8); +SELECT TRUNC(-42.8); +SELECT TRUNC(42.4382, 2); +SELECT WIDTH_BUCKET(5.35, 0.024, 10.06, 5); +SELECT WIDTH_BUCKET(NOW(), ARRAY['YESTERDAY', 'TODAY', 'TOMORROW']::TIMESTAMPTZ[]); +SELECT RANDOM(); +SELECT SETSEED(0.12345) +SELECT ACOS(1); +SELECT ACOSD(0.5); +SELECT ASIN(1); +SELECT ASIND(0.5); +SELECT ATAN(1); +SELECT ATAND(1); +SELECT ATAN2(1, 0); +SELECT ATAN2D(1, 0); +SELECT COS(0); +SELECT COSD(60); +SELECT COT(0.5); +SELECT COTD(45); +SELECT SIN(1); +SELECT SIND(30); +SELECT TAN(1); +SELECT TAND(45); +SELECT SINH(1); +SELECT COSH(0); +SELECT TANH(1); +SELECT ASINH(1); +SELECT ACOSH(1); +SELECT ATANH(0.5); \ No newline at end of file diff --git a/postgresql/examples/builtin_functions_string.sql b/postgresql/examples/builtin_functions_string.sql new file mode 100644 index 0000000..fd53478 --- /dev/null +++ b/postgresql/examples/builtin_functions_string.sql @@ -0,0 +1,66 @@ +SELECT BIT_LENGTH('JOSE'); +SELECT CHAR_LENGTH('JOSÉ'); +SELECT LOWER('TOM'); +SELECT NORMALIZE(U&'\0061\0308BC', NFC); +SELECT OCTET_LENGTH('JOSÉ'); +SELECT OCTET_LENGTH('ABC '::CHARACTER(4)); +SELECT OVERLAY('TXXXXAS' PLACING 'HOM' FROM 2 FOR 4); +SELECT POSITION('OM' IN 'THOMAS'); +SELECT SUBSTRING('THOMAS' FROM 2 FOR 3); +SELECT SUBSTRING('THOMAS' FROM 3); +SELECT SUBSTRING('THOMAS' FOR 2); +SELECT SUBSTRING('THOMAS' FROM '...$'); +SELECT SUBSTRING('THOMAS' SIMILAR '%#"O_A#"_' ESCAPE '#'); +SELECT TRIM(BOTH 'XYZ' FROM 'YXTOMXX'); +SELECT TRIM(BOTH FROM 'YXTOMXX', 'XYZ'); +SELECT UPPER('TOM'); +SELECT ASCII('X'); +SELECT BTRIM('XYXTRIMYYX', 'XYZ'); +SELECT CHR(65); +SELECT CONCAT('ABCDE', 2, NULL, 22); +SELECT CONCAT_WS(',', 'ABCDE', 2, NULL, 22); +SELECT FORMAT('HELLO %S, %1$S', 'WORLD'); +SELECT INITCAP('HI THOMAS'); +SELECT LEFT('ABCDE', 2); +SELECT LENGTH('JOSE'); +SELECT LPAD('HI', 5, 'XY'); +SELECT LTRIM('ZZZYTEST', 'XYZ'); +SELECT MD5('ABC'); +SELECT PARSE_IDENT('"SOMESCHEMA".SOMETABLE'); +SELECT PG_CLIENT_ENCODING(); +SELECT QUOTE_IDENT('FOO BAR'); +SELECT QUOTE_LITERAL(E'O\'REILLY'); +SELECT QUOTE_LITERAL(42.5); +SELECT QUOTE_NULLABLE(NULL); +SELECT QUOTE_NULLABLE(42.5); +SELECT REGEXP_COUNT('123456789012', '\D\D\D', 2); +SELECT REGEXP_INSTR('ABCDEF', 'C(.)(..)', 1, 1, 0, 'I'); +SELECT REGEXP_INSTR('ABCDEF', 'C(.)(..)', 1, 1, 0, 'I', 2); +SELECT REGEXP_LIKE('HELLO WORLD', 'WORLD$', 'I'); +SELECT REGEXP_MATCH('FOOBARBEQUEBAZ', '(BAR)(BEQUE)'); +SELECT REGEXP_MATCHES('FOOBARBEQUEBAZ', 'BA.', 'G'); +SELECT REGEXP_REPLACE('THOMAS', '.[MN]A.', 'M'); +SELECT REGEXP_REPLACE('THOMAS', '.', 'X', 3, 2); +SELECT REGEXP_SPLIT_TO_ARRAY('HELLO WORLD', '\S+'); +SELECT REGEXP_SPLIT_TO_TABLE('HELLO WORLD', '\S+'); +SELECT REGEXP_SUBSTR('ABCDEF', 'C(.)(..)', 1, 1, 'I'); +SELECT REGEXP_SUBSTR('ABCDEF', 'C(.)(..)', 1, 1, 'I', 2); +SELECT REPEAT('PG', 4); +SELECT REPLACE('ABCDEFABCDEF', 'CD', 'XX'); +SELECT REVERSE('ABCDE'); +SELECT RIGHT('ABCDE', 2); +SELECT RPAD('HI', 5, 'XY'); +SELECT RTRIM('TESTXXZX', 'XYZ'); +SELECT SPLIT_PART('ABC~@~DEF~@~GHI', '~@~', 2); +SELECT SPLIT_PART('ABC,DEF,GHI,JKL', ',', -2); +SELECT STARTS_WITH('ALPHABET', 'ALPH'); +SELECT STRING_TO_ARRAY('XX~~YY~~ZZ', '~~', 'YY'); +SELECT STRING_TO_TABLE('XX~^~YY~^~ZZ', '~^~', 'YY'); +SELECT STRPOS('HIGH', 'IG'); +SELECT SUBSTR('ALPHABET', 3); +SELECT SUBSTR('ALPHABET', 3, 2); +SELECT TO_ASCII('KARÉL'); +SELECT TO_HEX(2147483647); +SELECT TRANSLATE('12345', '143', 'AX'); +SELECT UNISTR('D\0061T\+000061'); +SELECT UNISTR('D\U0061T\U00000061'); \ No newline at end of file diff --git a/postgresql/examples/case.sql b/postgresql/examples/case.sql new file mode 100644 index 0000000..17436c5 --- /dev/null +++ b/postgresql/examples/case.sql @@ -0,0 +1,254 @@ +-- +-- CASE +-- Test the case statement +-- + +CREATE TABLE CASE_TBL ( + i integer, + f double precision +); + +CREATE TABLE CASE2_TBL ( + i integer, + j integer +); + +INSERT INTO CASE_TBL VALUES (1, 10.1); +INSERT INTO CASE_TBL VALUES (2, 20.2); +INSERT INTO CASE_TBL VALUES (3, -30.3); +INSERT INTO CASE_TBL VALUES (4, NULL); + +INSERT INTO CASE2_TBL VALUES (1, -1); +INSERT INTO CASE2_TBL VALUES (2, -2); +INSERT INTO CASE2_TBL VALUES (3, -3); +INSERT INTO CASE2_TBL VALUES (2, -4); +INSERT INTO CASE2_TBL VALUES (1, NULL); +INSERT INTO CASE2_TBL VALUES (NULL, -6); + +-- +-- Simplest examples without tables +-- + +SELECT '3' AS "One", + CASE + WHEN 1 < 2 THEN 3 + END AS "Simple WHEN"; + +SELECT '' AS "One", + CASE + WHEN 1 > 2 THEN 3 + END AS "Simple default"; + +SELECT '3' AS "One", + CASE + WHEN 1 < 2 THEN 3 + ELSE 4 + END AS "Simple ELSE"; + +SELECT '4' AS "One", + CASE + WHEN 1 > 2 THEN 3 + ELSE 4 + END AS "ELSE default"; + +SELECT '6' AS "One", + CASE + WHEN 1 > 2 THEN 3 + WHEN 4 < 5 THEN 6 + ELSE 7 + END AS "Two WHEN with default"; + + +SELECT '7' AS "None", + CASE WHEN random() < 0 THEN 1 + END AS "NULL on no matches"; + +-- Constant-expression folding shouldn't evaluate unreachable subexpressions +SELECT CASE WHEN 1=0 THEN 1/0 WHEN 1=1 THEN 1 ELSE 2/0 END; +SELECT CASE 1 WHEN 0 THEN 1/0 WHEN 1 THEN 1 ELSE 2/0 END; + +-- However we do not currently suppress folding of potentially +-- reachable subexpressions +SELECT CASE WHEN i > 100 THEN 1/0 ELSE 0 END FROM case_tbl; + +-- Test for cases involving untyped literals in test expression +SELECT CASE 'a' WHEN 'a' THEN 1 ELSE 2 END; + +-- +-- Examples of targets involving tables +-- + +SELECT '' AS "Five", + CASE + WHEN i >= 3 THEN i + END AS ">= 3 or Null" + FROM CASE_TBL; + +SELECT '' AS "Five", + CASE WHEN i >= 3 THEN (i + i) + ELSE i + END AS "Simplest Math" + FROM CASE_TBL; + +SELECT '' AS "Five", i AS "Value", + CASE WHEN (i < 0) THEN 'small' + WHEN (i = 0) THEN 'zero' + WHEN (i = 1) THEN 'one' + WHEN (i = 2) THEN 'two' + ELSE 'big' + END AS "Category" + FROM CASE_TBL; + +SELECT '' AS "Five", + CASE WHEN ((i < 0) or (i < 0)) THEN 'small' + WHEN ((i = 0) or (i = 0)) THEN 'zero' + WHEN ((i = 1) or (i = 1)) THEN 'one' + WHEN ((i = 2) or (i = 2)) THEN 'two' + ELSE 'big' + END AS "Category" + FROM CASE_TBL; + +-- +-- Examples of qualifications involving tables +-- + +-- +-- NULLIF() and COALESCE() +-- Shorthand forms for typical CASE constructs +-- defined in the SQL standard. +-- + +SELECT * FROM CASE_TBL WHERE COALESCE(f,i) = 4; + +SELECT * FROM CASE_TBL WHERE NULLIF(f,i) = 2; + +SELECT COALESCE(a.f, b.i, b.j) + FROM CASE_TBL a, CASE2_TBL b; + +SELECT * + FROM CASE_TBL a, CASE2_TBL b + WHERE COALESCE(a.f, b.i, b.j) = 2; + +SELECT '' AS Five, NULLIF(a.i,b.i) AS "NULLIF(a.i,b.i)", + NULLIF(b.i, 4) AS "NULLIF(b.i,4)" + FROM CASE_TBL a, CASE2_TBL b; + +SELECT '' AS "Two", * + FROM CASE_TBL a, CASE2_TBL b + WHERE COALESCE(f,b.i) = 2; + +-- +-- Examples of updates involving tables +-- + +UPDATE CASE_TBL + SET i = CASE WHEN i >= 3 THEN (- i) + ELSE (2 * i) END; + +SELECT * FROM CASE_TBL; + +UPDATE CASE_TBL + SET i = CASE WHEN i >= 2 THEN (2 * i) + ELSE (3 * i) END; + +SELECT * FROM CASE_TBL; + +UPDATE CASE_TBL + SET i = CASE WHEN b.i >= 2 THEN (2 * j) + ELSE (3 * j) END + FROM CASE2_TBL b + WHERE j = -CASE_TBL.i; + +SELECT * FROM CASE_TBL; + +-- +-- Nested CASE expressions +-- + +-- This test exercises a bug caused by aliasing econtext->caseValue_isNull +-- with the isNull argument of the inner CASE's CaseExpr evaluation. After +-- evaluating the vol(null) expression in the inner CASE's second WHEN-clause, +-- the isNull flag for the case test value incorrectly became true, causing +-- the third WHEN-clause not to match. The volatile function calls are needed +-- to prevent constant-folding in the planner, which would hide the bug. + +-- Wrap this in a single transaction so the transient '=' operator doesn't +-- cause problems in concurrent sessions +BEGIN; + +CREATE FUNCTION vol(text) returns text as + 'begin return $1; end' language plpgsql volatile; + +SELECT CASE + (CASE vol('bar') + WHEN 'foo' THEN 'it was foo!' + WHEN vol(null) THEN 'null input' + WHEN 'bar' THEN 'it was bar!' END + ) + WHEN 'it was foo!' THEN 'foo recognized' + WHEN 'it was bar!' THEN 'bar recognized' + ELSE 'unrecognized' END; + +-- In this case, we can't inline the SQL function without confusing things. +CREATE DOMAIN foodomain AS text; + +CREATE FUNCTION volfoo(text) returns foodomain as + 'begin return $1::foodomain; end' language plpgsql volatile; + +CREATE FUNCTION inline_eq(foodomain, foodomain) returns boolean as + 'SELECT CASE $2::text WHEN $1::text THEN true ELSE false END' language sql; + +CREATE OPERATOR = (procedure = inline_eq, + leftarg = foodomain, rightarg = foodomain); + +SELECT CASE volfoo('bar') WHEN 'foo'::foodomain THEN 'is foo' ELSE 'is not foo' END; + +ROLLBACK; + +-- Test multiple evaluation of a CASE arg that is a read/write object (#14472) +-- Wrap this in a single transaction so the transient '=' operator doesn't +-- cause problems in concurrent sessions +BEGIN; + +CREATE DOMAIN arrdomain AS int[]; + +CREATE FUNCTION make_ad(int,int) returns arrdomain as + 'declare x arrdomain; + begin + x := array[$1,$2]; + return x; + end' language plpgsql volatile; + +CREATE FUNCTION ad_eq(arrdomain, arrdomain) returns boolean as + 'begin return array_eq($1, $2); end' language plpgsql; + +CREATE OPERATOR = (procedure = ad_eq, + leftarg = arrdomain, rightarg = arrdomain); + +SELECT CASE make_ad(1,2) + WHEN array[2,4]::arrdomain THEN 'wrong' + WHEN array[2,5]::arrdomain THEN 'still wrong' + WHEN array[1,2]::arrdomain THEN 'right' + END; + +ROLLBACK; + +-- Test interaction of CASE with ArrayCoerceExpr (bug #15471) +BEGIN; + +CREATE TYPE casetestenum AS ENUM ('e', 'f', 'g'); + +SELECT + CASE 'foo'::text + WHEN 'foo' THEN ARRAY['a', 'b', 'c', 'd'] || enum_range(NULL::casetestenum)::text[] + ELSE ARRAY['x', 'y'] + END; + +ROLLBACK; + +-- +-- Clean up +-- + +DROP TABLE CASE_TBL; +DROP TABLE CASE2_TBL; diff --git a/postgresql/examples/char.sql b/postgresql/examples/char.sql new file mode 100644 index 0000000..235ec62 --- /dev/null +++ b/postgresql/examples/char.sql @@ -0,0 +1,75 @@ +-- +-- CHAR +-- + +-- fixed-length by value +-- internally passed by value if <= 4 bytes in storage + +SELECT char 'c' = char 'c' AS true; + +-- +-- Build a table for testing +-- + +CREATE TABLE CHAR_TBL(f1 char); + +INSERT INTO CHAR_TBL (f1) VALUES ('a'); + +INSERT INTO CHAR_TBL (f1) VALUES ('A'); + +-- any of the following three input formats are acceptable +INSERT INTO CHAR_TBL (f1) VALUES ('1'); + +INSERT INTO CHAR_TBL (f1) VALUES (2); + +INSERT INTO CHAR_TBL (f1) VALUES ('3'); + +-- zero-length char +INSERT INTO CHAR_TBL (f1) VALUES (''); + +-- try char's of greater than 1 length +INSERT INTO CHAR_TBL (f1) VALUES ('cd'); +INSERT INTO CHAR_TBL (f1) VALUES ('c '); + + +SELECT '' AS seven, * FROM CHAR_TBL; + +SELECT '' AS six, c.* + FROM CHAR_TBL c + WHERE c.f1 <> 'a'; + +SELECT '' AS one, c.* + FROM CHAR_TBL c + WHERE c.f1 = 'a'; + +SELECT '' AS five, c.* + FROM CHAR_TBL c + WHERE c.f1 < 'a'; + +SELECT '' AS six, c.* + FROM CHAR_TBL c + WHERE c.f1 <= 'a'; + +SELECT '' AS one, c.* + FROM CHAR_TBL c + WHERE c.f1 > 'a'; + +SELECT '' AS two, c.* + FROM CHAR_TBL c + WHERE c.f1 >= 'a'; + +DROP TABLE CHAR_TBL; + +-- +-- Now test longer arrays of char +-- + +CREATE TABLE CHAR_TBL(f1 char(4)); + +INSERT INTO CHAR_TBL (f1) VALUES ('a'); +INSERT INTO CHAR_TBL (f1) VALUES ('ab'); +INSERT INTO CHAR_TBL (f1) VALUES ('abcd'); +INSERT INTO CHAR_TBL (f1) VALUES ('abcde'); +INSERT INTO CHAR_TBL (f1) VALUES ('abcd '); + +SELECT '' AS four, * FROM CHAR_TBL; diff --git a/postgresql/examples/circle.sql b/postgresql/examples/circle.sql new file mode 100644 index 0000000..170d6be --- /dev/null +++ b/postgresql/examples/circle.sql @@ -0,0 +1,57 @@ +-- +-- CIRCLE +-- + +-- Back off displayed precision a little bit to reduce platform-to-platform +-- variation in results. +SET extra_float_digits = -1; + +CREATE TABLE CIRCLE_TBL (f1 circle); + +INSERT INTO CIRCLE_TBL VALUES ('<(5,1),3>'); + +INSERT INTO CIRCLE_TBL VALUES ('((1,2),100)'); + +INSERT INTO CIRCLE_TBL VALUES (' 1 , 3 , 5 '); + +INSERT INTO CIRCLE_TBL VALUES (' ( ( 1 , 2 ) , 3 ) '); + +INSERT INTO CIRCLE_TBL VALUES (' ( 100 , 200 ) , 10 '); + +INSERT INTO CIRCLE_TBL VALUES (' < ( 100 , 1 ) , 115 > '); + +INSERT INTO CIRCLE_TBL VALUES ('<(3,5),0>'); -- Zero radius + +INSERT INTO CIRCLE_TBL VALUES ('<(3,5),NaN>'); -- NaN radius + +-- bad values + +INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>'); + +INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10'); + +INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10> x'); + +INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5'); + +INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)'); + +SELECT * FROM CIRCLE_TBL; + +SELECT '' AS six, center(f1) AS center + FROM CIRCLE_TBL; + +SELECT '' AS six, radius(f1) AS radius + FROM CIRCLE_TBL; + +SELECT '' AS six, diameter(f1) AS diameter + FROM CIRCLE_TBL; + +SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5; + +SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10; + +SELECT '' as five, c1.f1 AS one, c2.f1 AS two, (c1.f1 <-> c2.f1) AS distance + FROM CIRCLE_TBL c1, CIRCLE_TBL c2 + WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0) + ORDER BY distance, area(c1.f1), area(c2.f1); diff --git a/postgresql/examples/cluster.sql b/postgresql/examples/cluster.sql new file mode 100644 index 0000000..1881836 --- /dev/null +++ b/postgresql/examples/cluster.sql @@ -0,0 +1,268 @@ +-- +-- CLUSTER +-- + +CREATE TABLE clstr_tst_s (rf_a SERIAL PRIMARY KEY, + b INT); + +CREATE TABLE clstr_tst (a SERIAL PRIMARY KEY, + b INT, + c TEXT, + d TEXT, + CONSTRAINT clstr_tst_con FOREIGN KEY (b) REFERENCES clstr_tst_s); + +CREATE INDEX clstr_tst_b ON clstr_tst (b); +CREATE INDEX clstr_tst_c ON clstr_tst (c); +CREATE INDEX clstr_tst_c_b ON clstr_tst (c,b); +CREATE INDEX clstr_tst_b_c ON clstr_tst (b,c); + +INSERT INTO clstr_tst_s (b) VALUES (0); +INSERT INTO clstr_tst_s (b) SELECT b FROM clstr_tst_s; +INSERT INTO clstr_tst_s (b) SELECT b FROM clstr_tst_s; +INSERT INTO clstr_tst_s (b) SELECT b FROM clstr_tst_s; +INSERT INTO clstr_tst_s (b) SELECT b FROM clstr_tst_s; +INSERT INTO clstr_tst_s (b) SELECT b FROM clstr_tst_s; + +CREATE TABLE clstr_tst_inh () INHERITS (clstr_tst); + +INSERT INTO clstr_tst (b, c) VALUES (11, 'once'); +INSERT INTO clstr_tst (b, c) VALUES (10, 'diez'); +INSERT INTO clstr_tst (b, c) VALUES (31, 'treinta y uno'); +INSERT INTO clstr_tst (b, c) VALUES (22, 'veintidos'); +INSERT INTO clstr_tst (b, c) VALUES (3, 'tres'); +INSERT INTO clstr_tst (b, c) VALUES (20, 'veinte'); +INSERT INTO clstr_tst (b, c) VALUES (23, 'veintitres'); +INSERT INTO clstr_tst (b, c) VALUES (21, 'veintiuno'); +INSERT INTO clstr_tst (b, c) VALUES (4, 'cuatro'); +INSERT INTO clstr_tst (b, c) VALUES (14, 'catorce'); +INSERT INTO clstr_tst (b, c) VALUES (2, 'dos'); +INSERT INTO clstr_tst (b, c) VALUES (18, 'dieciocho'); +INSERT INTO clstr_tst (b, c) VALUES (27, 'veintisiete'); +INSERT INTO clstr_tst (b, c) VALUES (25, 'veinticinco'); +INSERT INTO clstr_tst (b, c) VALUES (13, 'trece'); +INSERT INTO clstr_tst (b, c) VALUES (28, 'veintiocho'); +INSERT INTO clstr_tst (b, c) VALUES (32, 'treinta y dos'); +INSERT INTO clstr_tst (b, c) VALUES (5, 'cinco'); +INSERT INTO clstr_tst (b, c) VALUES (29, 'veintinueve'); +INSERT INTO clstr_tst (b, c) VALUES (1, 'uno'); +INSERT INTO clstr_tst (b, c) VALUES (24, 'veinticuatro'); +INSERT INTO clstr_tst (b, c) VALUES (30, 'treinta'); +INSERT INTO clstr_tst (b, c) VALUES (12, 'doce'); +INSERT INTO clstr_tst (b, c) VALUES (17, 'diecisiete'); +INSERT INTO clstr_tst (b, c) VALUES (9, 'nueve'); +INSERT INTO clstr_tst (b, c) VALUES (19, 'diecinueve'); +INSERT INTO clstr_tst (b, c) VALUES (26, 'veintiseis'); +INSERT INTO clstr_tst (b, c) VALUES (15, 'quince'); +INSERT INTO clstr_tst (b, c) VALUES (7, 'siete'); +INSERT INTO clstr_tst (b, c) VALUES (16, 'dieciseis'); +INSERT INTO clstr_tst (b, c) VALUES (8, 'ocho'); +-- This entry is needed to test that TOASTED values are copied correctly. +INSERT INTO clstr_tst (b, c, d) VALUES (6, 'seis', repeat('xyzzy', 100000)); + +CLUSTER clstr_tst_c ON clstr_tst; + +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst; +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY a; +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY b; +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst ORDER BY c; + +-- Verify that inheritance link still works +INSERT INTO clstr_tst_inh VALUES (0, 100, 'in child table'); +SELECT a,b,c,substring(d for 30), length(d) from clstr_tst; + +-- Verify that foreign key link still works +INSERT INTO clstr_tst (b, c) VALUES (1111, 'this should fail'); + +SELECT conname FROM pg_constraint WHERE conrelid = 'clstr_tst'::regclass +ORDER BY 1; + + +SELECT relname, relkind, + EXISTS(SELECT 1 FROM pg_class WHERE oid = c.reltoastrelid) AS hastoast +FROM pg_class c WHERE relname LIKE 'clstr_tst%' ORDER BY relname; + +-- Verify that indisclustered is correctly set +SELECT pg_class.relname FROM pg_index, pg_class, pg_class AS pg_class_2 +WHERE pg_class.oid=indexrelid + AND indrelid=pg_class_2.oid + AND pg_class_2.relname = 'clstr_tst' + AND indisclustered; + +-- Try changing indisclustered +ALTER TABLE clstr_tst CLUSTER ON clstr_tst_b_c; +SELECT pg_class.relname FROM pg_index, pg_class, pg_class AS pg_class_2 +WHERE pg_class.oid=indexrelid + AND indrelid=pg_class_2.oid + AND pg_class_2.relname = 'clstr_tst' + AND indisclustered; + +-- Try turning off all clustering +ALTER TABLE clstr_tst SET WITHOUT CLUSTER; +SELECT pg_class.relname FROM pg_index, pg_class, pg_class AS pg_class_2 +WHERE pg_class.oid=indexrelid + AND indrelid=pg_class_2.oid + AND pg_class_2.relname = 'clstr_tst' + AND indisclustered; + +-- Verify that clustering all tables does in fact cluster the right ones +CREATE USER regress_clstr_user; +CREATE TABLE clstr_1 (a INT PRIMARY KEY); +CREATE TABLE clstr_2 (a INT PRIMARY KEY); +CREATE TABLE clstr_3 (a INT PRIMARY KEY); +ALTER TABLE clstr_1 OWNER TO regress_clstr_user; +ALTER TABLE clstr_3 OWNER TO regress_clstr_user; +GRANT SELECT ON clstr_2 TO regress_clstr_user; +INSERT INTO clstr_1 VALUES (2); +INSERT INTO clstr_1 VALUES (1); +INSERT INTO clstr_2 VALUES (2); +INSERT INTO clstr_2 VALUES (1); +INSERT INTO clstr_3 VALUES (2); +INSERT INTO clstr_3 VALUES (1); + +-- "CLUSTER " on a table that hasn't been clustered +CLUSTER clstr_2; + +CLUSTER clstr_1_pkey ON clstr_1; +CLUSTER clstr_2 USING clstr_2_pkey; +SELECT * FROM clstr_1 UNION ALL + SELECT * FROM clstr_2 UNION ALL + SELECT * FROM clstr_3; + +-- revert to the original state +DELETE FROM clstr_1; +DELETE FROM clstr_2; +DELETE FROM clstr_3; +INSERT INTO clstr_1 VALUES (2); +INSERT INTO clstr_1 VALUES (1); +INSERT INTO clstr_2 VALUES (2); +INSERT INTO clstr_2 VALUES (1); +INSERT INTO clstr_3 VALUES (2); +INSERT INTO clstr_3 VALUES (1); + +-- this user can only cluster clstr_1 and clstr_3, but the latter +-- has not been clustered +SET SESSION AUTHORIZATION regress_clstr_user; +CLUSTER; +SELECT * FROM clstr_1 UNION ALL + SELECT * FROM clstr_2 UNION ALL + SELECT * FROM clstr_3; + +-- cluster a single table using the indisclustered bit previously set +DELETE FROM clstr_1; +INSERT INTO clstr_1 VALUES (2); +INSERT INTO clstr_1 VALUES (1); +CLUSTER clstr_1; +SELECT * FROM clstr_1; + +-- Test MVCC-safety of cluster. There isn't much we can do to verify the +-- results with a single backend... + +CREATE TABLE clustertest (key int PRIMARY KEY); + +INSERT INTO clustertest VALUES (10); +INSERT INTO clustertest VALUES (20); +INSERT INTO clustertest VALUES (30); +INSERT INTO clustertest VALUES (40); +INSERT INTO clustertest VALUES (50); + +-- Use a transaction so that updates are not committed when CLUSTER sees 'em +BEGIN; + +-- Test update where the old row version is found first in the scan +UPDATE clustertest SET key = 100 WHERE key = 10; + +-- Test update where the new row version is found first in the scan +UPDATE clustertest SET key = 35 WHERE key = 40; + +-- Test longer update chain +UPDATE clustertest SET key = 60 WHERE key = 50; +UPDATE clustertest SET key = 70 WHERE key = 60; +UPDATE clustertest SET key = 80 WHERE key = 70; + +SELECT * FROM clustertest; +CLUSTER clustertest_pkey ON clustertest; +SELECT * FROM clustertest; + +COMMIT; + +SELECT * FROM clustertest; + +-- check that temp tables can be clustered +create temp table clstr_temp (col1 int primary key, col2 text); +insert into clstr_temp values (2, 'two'), (1, 'one'); +cluster clstr_temp using clstr_temp_pkey; +select * from clstr_temp; +drop table clstr_temp; + +RESET SESSION AUTHORIZATION; + +-- Check that partitioned tables cannot be clustered +CREATE TABLE clstrpart (a int) PARTITION BY RANGE (a); +CREATE INDEX clstrpart_idx ON clstrpart (a); +ALTER TABLE clstrpart CLUSTER ON clstrpart_idx; +CLUSTER clstrpart USING clstrpart_idx; +DROP TABLE clstrpart; + +-- Test CLUSTER with external tuplesorting + +create table clstr_4 as select * from tenk1; +create index cluster_sort on clstr_4 (hundred, thousand, tenthous); +-- ensure we don't use the index in CLUSTER nor the checking SELECTs +set enable_indexscan = off; + +-- Use external sort: +set maintenance_work_mem = '1MB'; +cluster clstr_4 using cluster_sort; +select * from +(select hundred, lag(hundred) over () as lhundred, + thousand, lag(thousand) over () as lthousand, + tenthous, lag(tenthous) over () as ltenthous from clstr_4) ss +where row(hundred, thousand, tenthous) <= row(lhundred, lthousand, ltenthous); + +reset enable_indexscan; +reset maintenance_work_mem; + +-- test CLUSTER on expression index +CREATE TABLE clstr_expression(id serial primary key, a int, b text COLLATE "C"); +INSERT INTO clstr_expression(a, b) SELECT g.i % 42, 'prefix'||g.i FROM generate_series(1, 133) g(i); +CREATE INDEX clstr_expression_minus_a ON clstr_expression ((-a), b); +CREATE INDEX clstr_expression_upper_b ON clstr_expression ((upper(b))); + +-- verify indexes work before cluster +BEGIN; +SET LOCAL enable_seqscan = false; +EXPLAIN (COSTS OFF) SELECT * FROM clstr_expression WHERE upper(b) = 'PREFIX3'; +SELECT * FROM clstr_expression WHERE upper(b) = 'PREFIX3'; +EXPLAIN (COSTS OFF) SELECT * FROM clstr_expression WHERE -a = -3 ORDER BY -a, b; +SELECT * FROM clstr_expression WHERE -a = -3 ORDER BY -a, b; +COMMIT; + +-- and after clustering on clstr_expression_minus_a +CLUSTER clstr_expression USING clstr_expression_minus_a; +BEGIN; +SET LOCAL enable_seqscan = false; +EXPLAIN (COSTS OFF) SELECT * FROM clstr_expression WHERE upper(b) = 'PREFIX3'; +SELECT * FROM clstr_expression WHERE upper(b) = 'PREFIX3'; +EXPLAIN (COSTS OFF) SELECT * FROM clstr_expression WHERE -a = -3 ORDER BY -a, b; +SELECT * FROM clstr_expression WHERE -a = -3 ORDER BY -a, b; +COMMIT; + +-- and after clustering on clstr_expression_upper_b +CLUSTER clstr_expression USING clstr_expression_upper_b; +BEGIN; +SET LOCAL enable_seqscan = false; +EXPLAIN (COSTS OFF) SELECT * FROM clstr_expression WHERE upper(b) = 'PREFIX3'; +SELECT * FROM clstr_expression WHERE upper(b) = 'PREFIX3'; +EXPLAIN (COSTS OFF) SELECT * FROM clstr_expression WHERE -a = -3 ORDER BY -a, b; +SELECT * FROM clstr_expression WHERE -a = -3 ORDER BY -a, b; +COMMIT; + +-- clean up +DROP TABLE clustertest; +DROP TABLE clstr_1; +DROP TABLE clstr_2; +DROP TABLE clstr_3; +DROP TABLE clstr_4; +DROP TABLE clstr_expression; + +DROP USER regress_clstr_user; diff --git a/postgresql/examples/collate.sql b/postgresql/examples/collate.sql new file mode 100644 index 0000000..53da890 --- /dev/null +++ b/postgresql/examples/collate.sql @@ -0,0 +1,277 @@ +/* + * This test is intended to pass on all platforms supported by Postgres. + * We can therefore only assume that the default, C, and POSIX collations + * are available --- and since the regression tests are often run in a + * C-locale database, these may well all have the same behavior. But + * fortunately, the system doesn't know that and will treat them as + * incompatible collations. It is therefore at least possible to test + * parser behaviors such as collation conflict resolution. This test will, + * however, be more revealing when run in a database with non-C locale, + * since any departure from C sorting behavior will show as a failure. + */ + +CREATE SCHEMA collate_tests; +SET search_path = collate_tests; + +CREATE TABLE collate_test1 ( + a int, + b text COLLATE "C" NOT NULL +); + +\d collate_test1 + +CREATE TABLE collate_test_fail ( + a int COLLATE "C", + b text +); + +CREATE TABLE collate_test_like ( + LIKE collate_test1 +); + +\d collate_test_like + +CREATE TABLE collate_test2 ( + a int, + b text COLLATE "POSIX" +); + +INSERT INTO collate_test1 VALUES (1, 'abc'), (2, 'Abc'), (3, 'bbc'), (4, 'ABD'); +INSERT INTO collate_test2 SELECT * FROM collate_test1; + +SELECT * FROM collate_test1 WHERE b COLLATE "C" >= 'abc'; +SELECT * FROM collate_test1 WHERE b >= 'abc' COLLATE "C"; +SELECT * FROM collate_test1 WHERE b COLLATE "C" >= 'abc' COLLATE "C"; +SELECT * FROM collate_test1 WHERE b COLLATE "C" >= 'bbc' COLLATE "POSIX"; -- fail + +CREATE DOMAIN testdomain_p AS text COLLATE "POSIX"; +CREATE DOMAIN testdomain_i AS int COLLATE "POSIX"; -- fail +CREATE TABLE collate_test4 ( + a int, + b testdomain_p +); +INSERT INTO collate_test4 SELECT * FROM collate_test1; +SELECT a, b FROM collate_test4 ORDER BY b; + +CREATE TABLE collate_test5 ( + a int, + b testdomain_p COLLATE "C" +); +INSERT INTO collate_test5 SELECT * FROM collate_test1; +SELECT a, b FROM collate_test5 ORDER BY b; + + +SELECT a, b FROM collate_test1 ORDER BY b; +SELECT a, b FROM collate_test2 ORDER BY b; + +SELECT a, b FROM collate_test1 ORDER BY b COLLATE "C"; + +-- star expansion +SELECT * FROM collate_test1 ORDER BY b; +SELECT * FROM collate_test2 ORDER BY b; + +-- constant expression folding +SELECT 'bbc' COLLATE "C" > 'Abc' COLLATE "C" AS "true"; +SELECT 'bbc' COLLATE "POSIX" < 'Abc' COLLATE "POSIX" AS "false"; + +-- upper/lower + +CREATE TABLE collate_test10 ( + a int, + x text COLLATE "C", + y text COLLATE "POSIX" +); + +INSERT INTO collate_test10 VALUES (1, 'hij', 'hij'), (2, 'HIJ', 'HIJ'); + +SELECT a, lower(x), lower(y), upper(x), upper(y), initcap(x), initcap(y) FROM collate_test10; +SELECT a, lower(x COLLATE "C"), lower(y COLLATE "C") FROM collate_test10; + +SELECT a, x, y FROM collate_test10 ORDER BY lower(y), a; + +-- backwards parsing + +CREATE VIEW collview1 AS SELECT * FROM collate_test1 WHERE b COLLATE "C" >= 'bbc'; +CREATE VIEW collview2 AS SELECT a, b FROM collate_test1 ORDER BY b COLLATE "C"; +CREATE VIEW collview3 AS SELECT a, lower((x || x) COLLATE "POSIX") FROM collate_test10; + +SELECT table_name, view_definition FROM information_schema.views + WHERE table_name LIKE 'collview%' ORDER BY 1; + + +-- collation propagation in various expression types + +SELECT a, coalesce(b, 'foo') FROM collate_test1 ORDER BY 2; +SELECT a, coalesce(b, 'foo') FROM collate_test2 ORDER BY 2; +SELECT a, lower(coalesce(x, 'foo')), lower(coalesce(y, 'foo')) FROM collate_test10; + +SELECT a, b, greatest(b, 'CCC') FROM collate_test1 ORDER BY 3; +SELECT a, b, greatest(b, 'CCC') FROM collate_test2 ORDER BY 3; +SELECT a, x, y, lower(greatest(x, 'foo')), lower(greatest(y, 'foo')) FROM collate_test10; + +SELECT a, nullif(b, 'abc') FROM collate_test1 ORDER BY 2; +SELECT a, nullif(b, 'abc') FROM collate_test2 ORDER BY 2; +SELECT a, lower(nullif(x, 'foo')), lower(nullif(y, 'foo')) FROM collate_test10; + +SELECT a, CASE b WHEN 'abc' THEN 'abcd' ELSE b END FROM collate_test1 ORDER BY 2; +SELECT a, CASE b WHEN 'abc' THEN 'abcd' ELSE b END FROM collate_test2 ORDER BY 2; + +CREATE DOMAIN testdomain AS text; +SELECT a, b::testdomain FROM collate_test1 ORDER BY 2; +SELECT a, b::testdomain FROM collate_test2 ORDER BY 2; +SELECT a, b::testdomain_p FROM collate_test2 ORDER BY 2; +SELECT a, lower(x::testdomain), lower(y::testdomain) FROM collate_test10; + +SELECT min(b), max(b) FROM collate_test1; +SELECT min(b), max(b) FROM collate_test2; + +SELECT array_agg(b ORDER BY b) FROM collate_test1; +SELECT array_agg(b ORDER BY b) FROM collate_test2; + +-- In aggregates, ORDER BY expressions don't affect aggregate's collation +SELECT string_agg(x COLLATE "C", y COLLATE "POSIX") FROM collate_test10; -- fail +SELECT array_agg(x COLLATE "C" ORDER BY y COLLATE "POSIX") FROM collate_test10; +SELECT array_agg(a ORDER BY x COLLATE "C", y COLLATE "POSIX") FROM collate_test10; +SELECT array_agg(a ORDER BY x||y) FROM collate_test10; -- fail + +SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test1 ORDER BY 2; +SELECT a, b FROM collate_test2 UNION SELECT a, b FROM collate_test2 ORDER BY 2; +SELECT a, b FROM collate_test2 WHERE a < 4 INTERSECT SELECT a, b FROM collate_test2 WHERE a > 1 ORDER BY 2; +SELECT a, b FROM collate_test2 EXCEPT SELECT a, b FROM collate_test2 WHERE a < 2 ORDER BY 2; + +SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test2 ORDER BY 2; -- fail +SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test2; -- ok +SELECT a, b FROM collate_test1 UNION SELECT a, b FROM collate_test2 ORDER BY 2; -- fail +SELECT a, b COLLATE "C" FROM collate_test1 UNION SELECT a, b FROM collate_test2 ORDER BY 2; -- ok +SELECT a, b FROM collate_test1 INTERSECT SELECT a, b FROM collate_test2 ORDER BY 2; -- fail +SELECT a, b FROM collate_test1 EXCEPT SELECT a, b FROM collate_test2 ORDER BY 2; -- fail + +CREATE TABLE test_u AS SELECT a, b FROM collate_test1 UNION ALL SELECT a, b FROM collate_test2; -- fail + +-- ideally this would be a parse-time error, but for now it must be run-time: +select x < y from collate_test10; -- fail +select x || y from collate_test10; -- ok, because || is not collation aware +select x, y from collate_test10 order by x || y; -- not so ok + +-- collation mismatch between recursive and non-recursive term +WITH RECURSIVE foo(x) AS + (SELECT x FROM (VALUES('a' COLLATE "C"),('b')) t(x) + UNION ALL + SELECT (x || 'c') COLLATE "POSIX" FROM foo WHERE length(x) < 10) +SELECT * FROM foo; + +SELECT a, b, a < b as lt FROM + (VALUES ('a', 'B'), ('A', 'b' COLLATE "C")) v(a,b); + +-- collation mismatch in subselects +SELECT * FROM collate_test10 WHERE (x, y) NOT IN (SELECT y, x FROM collate_test10); +-- now it works with overrides +SELECT * FROM collate_test10 WHERE (x COLLATE "POSIX", y COLLATE "C") NOT IN (SELECT y, x FROM collate_test10); +SELECT * FROM collate_test10 WHERE (x, y) NOT IN (SELECT y COLLATE "C", x COLLATE "POSIX" FROM collate_test10); + +-- casting + + + +SELECT a, CAST(b AS varchar) FROM collate_test1 ORDER BY 2; +SELECT a, CAST(b AS varchar) FROM collate_test2 ORDER BY 2; + + +-- result of a SQL function + +CREATE FUNCTION vc (text) RETURNS text LANGUAGE sql + AS 'select $1::varchar'; + +SELECT a, b FROM collate_test1 ORDER BY a, vc(b); + + +-- polymorphism + +SELECT * FROM unnest((SELECT array_agg(b ORDER BY b) FROM collate_test1)) ORDER BY 1; +SELECT * FROM unnest((SELECT array_agg(b ORDER BY b) FROM collate_test2)) ORDER BY 1; + +CREATE FUNCTION dup (anyelement) RETURNS anyelement + AS 'select $1' LANGUAGE sql; + +SELECT a, dup(b) FROM collate_test1 ORDER BY 2; +SELECT a, dup(b) FROM collate_test2 ORDER BY 2; + + +-- indexes + +CREATE INDEX collate_test1_idx1 ON collate_test1 (b); +CREATE INDEX collate_test1_idx2 ON collate_test1 (b COLLATE "POSIX"); +CREATE INDEX collate_test1_idx3 ON collate_test1 ((b COLLATE "POSIX")); -- this is different grammatically +CREATE INDEX collate_test1_idx4 ON collate_test1 (((b||'foo') COLLATE "POSIX")); + +CREATE INDEX collate_test1_idx5 ON collate_test1 (a COLLATE "POSIX"); -- fail +CREATE INDEX collate_test1_idx6 ON collate_test1 ((a COLLATE "POSIX")); -- fail + +SELECT relname, pg_get_indexdef(oid) FROM pg_class WHERE relname LIKE 'collate_test%_idx%' ORDER BY 1; + + +-- foreign keys + +-- force indexes and mergejoins to be used for FK checking queries, +-- else they might not exercise collation-dependent operators +SET enable_seqscan TO 0; +SET enable_hashjoin TO 0; +SET enable_nestloop TO 0; + +CREATE TABLE collate_test20 (f1 text COLLATE "C" PRIMARY KEY); +INSERT INTO collate_test20 VALUES ('foo'), ('bar'); +CREATE TABLE collate_test21 (f2 text COLLATE "POSIX" REFERENCES collate_test20); +INSERT INTO collate_test21 VALUES ('foo'), ('bar'); +INSERT INTO collate_test21 VALUES ('baz'); -- fail +CREATE TABLE collate_test22 (f2 text COLLATE "POSIX"); +INSERT INTO collate_test22 VALUES ('foo'), ('bar'), ('baz'); +ALTER TABLE collate_test22 ADD FOREIGN KEY (f2) REFERENCES collate_test20; -- fail +DELETE FROM collate_test22 WHERE f2 = 'baz'; +ALTER TABLE collate_test22 ADD FOREIGN KEY (f2) REFERENCES collate_test20; + +RESET enable_seqscan; +RESET enable_hashjoin; +RESET enable_nestloop; + + +-- EXPLAIN + +EXPLAIN (COSTS OFF) + SELECT * FROM collate_test10 ORDER BY x, y; +EXPLAIN (COSTS OFF) + SELECT * FROM collate_test10 ORDER BY x DESC, y COLLATE "C" ASC NULLS FIRST; + + +-- CREATE/DROP COLLATION + +CREATE COLLATION mycoll1 FROM "C"; +CREATE COLLATION mycoll2 ( LC_COLLATE = "POSIX", LC_CTYPE = "POSIX" ); +CREATE COLLATION mycoll3 FROM "default"; -- intentionally unsupported + +DROP COLLATION mycoll1; +CREATE TABLE collate_test23 (f1 text collate mycoll2); +DROP COLLATION mycoll2; -- fail + +-- invalid: non-lowercase quoted identifiers +CREATE COLLATION case_coll ("Lc_Collate" = "POSIX", "Lc_Ctype" = "POSIX"); + +-- 9.1 bug with useless COLLATE in an expression subject to length coercion + +CREATE TEMP TABLE vctable (f1 varchar(25)); +INSERT INTO vctable VALUES ('foo' COLLATE "C"); + + +SELECT collation for ('foo'); -- unknown type - null +SELECT collation for ('foo'::text); +SELECT collation for ((SELECT a FROM collate_test1 LIMIT 1)); -- non-collatable type - error +SELECT collation for ((SELECT b FROM collate_test1 LIMIT 1)); + + +-- +-- Clean up. Many of these table names will be re-used if the user is +-- trying to run any platform-specific collation tests later, so we +-- must get rid of them. +-- +DROP SCHEMA collate_tests CASCADE; +--expected error +--SELECT CAST('42' AS text COLLATE "C"); \ No newline at end of file diff --git a/postgresql/examples/combocid.sql b/postgresql/examples/combocid.sql new file mode 100644 index 0000000..4faea36 --- /dev/null +++ b/postgresql/examples/combocid.sql @@ -0,0 +1,111 @@ +-- +-- Tests for some likely failure cases with combo cmin/cmax mechanism +-- +CREATE TEMP TABLE combocidtest (foobar int); + +BEGIN; + +-- a few dummy ops to push up the CommandId counter +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; + +INSERT INTO combocidtest VALUES (1); +INSERT INTO combocidtest VALUES (2); + +SELECT ctid,cmin,* FROM combocidtest; + +SAVEPOINT s1; + +UPDATE combocidtest SET foobar = foobar + 10; + +-- here we should see only updated tuples +SELECT ctid,cmin,* FROM combocidtest; + +ROLLBACK TO s1; + +-- now we should see old tuples, but with combo CIDs starting at 0 +SELECT ctid,cmin,* FROM combocidtest; + +COMMIT; + +-- combo data is not there anymore, but should still see tuples +SELECT ctid,cmin,* FROM combocidtest; + +-- Test combo cids with portals +BEGIN; + +INSERT INTO combocidtest VALUES (333); + +DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest; + +DELETE FROM combocidtest; + +FETCH ALL FROM c; + +ROLLBACK; + +SELECT ctid,cmin,* FROM combocidtest; + +-- check behavior with locked tuples +BEGIN; + +-- a few dummy ops to push up the CommandId counter +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; +INSERT INTO combocidtest SELECT 1 LIMIT 0; + +INSERT INTO combocidtest VALUES (444); + +SELECT ctid,cmin,* FROM combocidtest; + +SAVEPOINT s1; + +-- this doesn't affect cmin +SELECT ctid,cmin,* FROM combocidtest FOR UPDATE; +SELECT ctid,cmin,* FROM combocidtest; + +-- but this does +UPDATE combocidtest SET foobar = foobar + 10; + +SELECT ctid,cmin,* FROM combocidtest; + +ROLLBACK TO s1; + +SELECT ctid,cmin,* FROM combocidtest; + +COMMIT; + +SELECT ctid,cmin,* FROM combocidtest; + +-- test for bug reported in +-- CABRT9RC81YUf1=jsmWopcKJEro=VoeG2ou6sPwyOUTx_qteRsg@mail.gmail.com +CREATE TABLE IF NOT EXISTS testcase( + id int PRIMARY KEY, + balance numeric +); +INSERT INTO testcase VALUES (1, 0); +BEGIN; +SELECT * FROM testcase WHERE testcase.id = 1 FOR UPDATE; +UPDATE testcase SET balance = balance + 400 WHERE id=1; +SAVEPOINT subxact; +UPDATE testcase SET balance = balance - 100 WHERE id=1; +ROLLBACK TO SAVEPOINT subxact; +-- should return one tuple +SELECT * FROM testcase WHERE id = 1 FOR UPDATE; +ROLLBACK; +DROP TABLE testcase; diff --git a/postgresql/examples/comments.sql b/postgresql/examples/comments.sql new file mode 100644 index 0000000..e47db1a --- /dev/null +++ b/postgresql/examples/comments.sql @@ -0,0 +1,42 @@ +-- +-- COMMENTS +-- + +SELECT 'trailing' AS first; -- trailing single line +SELECT /* embedded single line */ 'embedded' AS second; +SELECT /* both embedded and trailing single line */ 'both' AS third; -- trailing single line + +SELECT 'before multi-line' AS fourth; +/* This is an example of SQL which should not execute: + * select 'multi-line'; + */ +SELECT 'after multi-line' AS fifth; + +-- +-- Nested comments +-- + +/* +SELECT 'trailing' as x1; -- inside block comment +*/ + +/* This block comment surrounds a query which itself has a block comment... +SELECT /* embedded single line */ 'embedded' AS x2; +*/ + +SELECT -- continued after the following block comments... +/* Deeply nested comment. + This includes a single apostrophe to make sure we aren't decoding this part as a string. +SELECT 'deep nest' AS n1; +/* Second level of nesting... +SELECT 'deeper nest' as n2; +/* Third level of nesting... +SELECT 'deepest nest' as n3; +*/ +Hoo boy. Still two deep... +*/ +Now just one deep... +*/ +'deeply nested example' AS sixth; + +/* and this is the end of the file */ diff --git a/postgresql/examples/conversion.sql b/postgresql/examples/conversion.sql new file mode 100644 index 0000000..02cf39f --- /dev/null +++ b/postgresql/examples/conversion.sql @@ -0,0 +1,36 @@ +-- +-- create user defined conversion +-- +CREATE USER regress_conversion_user WITH NOCREATEDB NOCREATEROLE; +SET SESSION AUTHORIZATION regress_conversion_user; +CREATE CONVERSION myconv FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; +-- +-- cannot make same name conversion in same schema +-- +CREATE CONVERSION myconv FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; +-- +-- create default conversion with qualified name +-- +CREATE DEFAULT CONVERSION public.mydef FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; +-- +-- cannot make default conversion with same schema/for_encoding/to_encoding +-- +CREATE DEFAULT CONVERSION public.mydef2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; +-- test comments +COMMENT ON CONVERSION myconv_bad IS 'foo'; +COMMENT ON CONVERSION myconv IS 'bar'; +COMMENT ON CONVERSION myconv IS NULL; +-- +-- drop user defined conversion +-- +DROP CONVERSION myconv; +DROP CONVERSION mydef; +-- +-- Note: the built-in conversions are exercised in opr_sanity.sql, +-- so there's no need to do that here. +-- +-- +-- return to the super user +-- +RESET SESSION AUTHORIZATION; +DROP USER regress_conversion_user; diff --git a/postgresql/examples/copydml.sql b/postgresql/examples/copydml.sql new file mode 100644 index 0000000..9a29f9c --- /dev/null +++ b/postgresql/examples/copydml.sql @@ -0,0 +1,91 @@ +-- +-- Test cases for COPY (INSERT/UPDATE/DELETE) TO +-- +create table copydml_test (id serial, t text); +insert into copydml_test (t) values ('a'); +insert into copydml_test (t) values ('b'); +insert into copydml_test (t) values ('c'); +insert into copydml_test (t) values ('d'); +insert into copydml_test (t) values ('e'); + +-- +-- Test COPY (insert/update/delete ...) +-- +copy (insert into copydml_test (t) values ('f') returning id) to stdout; +copy (update copydml_test set t = 'g' where t = 'f' returning id) to stdout; +copy (delete from copydml_test where t = 'g' returning id) to stdout; + +-- +-- Test \copy (insert/update/delete ...) +-- +\copy (insert into copydml_test (t) values ('f') returning id) to stdout; +\copy (update copydml_test set t = 'g' where t = 'f' returning id) to stdout; +\copy (delete from copydml_test where t = 'g' returning id) to stdout; + +-- Error cases +copy (insert into copydml_test default values) to stdout; +copy (update copydml_test set t = 'g') to stdout; +copy (delete from copydml_test) to stdout; + +create rule qqq as on insert to copydml_test do instead nothing; +copy (insert into copydml_test default values) to stdout; +drop rule qqq on copydml_test; +create rule qqq as on insert to copydml_test do also delete from copydml_test; +copy (insert into copydml_test default values) to stdout; +drop rule qqq on copydml_test; +create rule qqq as on insert to copydml_test do instead (delete from copydml_test; delete from copydml_test); +copy (insert into copydml_test default values) to stdout; +drop rule qqq on copydml_test; +create rule qqq as on insert to copydml_test where new.t <> 'f' do instead delete from copydml_test; +copy (insert into copydml_test default values) to stdout; +drop rule qqq on copydml_test; + +create rule qqq as on update to copydml_test do instead nothing; +copy (update copydml_test set t = 'f') to stdout; +drop rule qqq on copydml_test; +create rule qqq as on update to copydml_test do also delete from copydml_test; +copy (update copydml_test set t = 'f') to stdout; +drop rule qqq on copydml_test; +create rule qqq as on update to copydml_test do instead (delete from copydml_test; delete from copydml_test); +copy (update copydml_test set t = 'f') to stdout; +drop rule qqq on copydml_test; +create rule qqq as on update to copydml_test where new.t <> 'f' do instead delete from copydml_test; +copy (update copydml_test set t = 'f') to stdout; +drop rule qqq on copydml_test; + +create rule qqq as on delete to copydml_test do instead nothing; +copy (delete from copydml_test) to stdout; +drop rule qqq on copydml_test; +create rule qqq as on delete to copydml_test do also insert into copydml_test default values; +copy (delete from copydml_test) to stdout; +drop rule qqq on copydml_test; +create rule qqq as on delete to copydml_test do instead (insert into copydml_test default values; insert into copydml_test default values); +copy (delete from copydml_test) to stdout; +drop rule qqq on copydml_test; +create rule qqq as on delete to copydml_test where old.t <> 'f' do instead insert into copydml_test default values; +copy (delete from copydml_test) to stdout; +drop rule qqq on copydml_test; + +-- triggers +create function qqq_trig() returns trigger as $$ +begin +if tg_op in ('INSERT', 'UPDATE') then + raise notice '% %', tg_op, new.id; + return new; +else + raise notice '% %', tg_op, old.id; + return old; +end if; +end +$$ language plpgsql; +create trigger qqqbef before insert or update or delete on copydml_test + for each row execute procedure qqq_trig(); +create trigger qqqaf after insert or update or delete on copydml_test + for each row execute procedure qqq_trig(); + +copy (insert into copydml_test (t) values ('f') returning id) to stdout; +copy (update copydml_test set t = 'g' where t = 'f' returning id) to stdout; +copy (delete from copydml_test where t = 'g' returning id) to stdout; + +drop table copydml_test; +drop function qqq_trig(); diff --git a/postgresql/examples/copyselect.sql b/postgresql/examples/copyselect.sql new file mode 100644 index 0000000..92e5821 --- /dev/null +++ b/postgresql/examples/copyselect.sql @@ -0,0 +1,95 @@ +-- +-- Test cases for COPY (select) TO +-- +create table test1 (id serial, t text); +insert into test1 (t) values ('a'); +insert into test1 (t) values ('b'); +insert into test1 (t) values ('c'); +insert into test1 (t) values ('d'); +insert into test1 (t) values ('e'); + +create table test2 (id serial, t text); +insert into test2 (t) values ('A'); +insert into test2 (t) values ('B'); +insert into test2 (t) values ('C'); +insert into test2 (t) values ('D'); +insert into test2 (t) values ('E'); + +create view v_test1 +as select 'v_'||t from test1; + +-- +-- Test COPY table TO +-- +copy test1 to stdout; +-- +-- This should fail +-- +copy v_test1 to stdout; +-- +-- Test COPY (select) TO +-- +copy (select t from test1 where id=1) to stdout; +-- +-- Test COPY (select for update) TO +-- +copy (select t from test1 where id=3 for update) to stdout; +-- +-- This should fail +-- +copy (select t into temp test3 from test1 where id=3) to stdout; +-- +-- This should fail +-- +--copy (select * from test1) from stdin; +-- +-- This should fail +-- +--copy (select * from test1) (t,id) to stdout; +-- +-- Test JOIN +-- +copy (select * from test1 join test2 using (id)) to stdout; +-- +-- Test UNION SELECT +-- +copy (select t from test1 where id = 1 UNION select * from v_test1 ORDER BY 1) to stdout; +-- +-- Test subselect +-- +copy (select * from (select t from test1 where id = 1 UNION select * from v_test1 ORDER BY 1) t1) to stdout; +-- +-- Test headers, CSV and quotes +-- +copy (select t from test1 where id = 1) to stdout csv header force quote t; +-- +-- Test psql builtins, plain table +-- +\copy test1 to stdout +-- +-- This should fail +-- +\copy v_test1 to stdout +-- +-- Test \copy (select ...) +-- +\copy (select "id",'id','id""'||t,(id + 1)*id,t,"test1"."t" from test1 where id=3) to stdout +-- +-- Drop everything +-- +drop table test2; +drop view v_test1; +drop table test1; + +-- psql handling of COPY in multi-command strings + + + +create table test3 (c int); + +select * from test3; +drop table test3; +select 1/0\; copy (select 1) to stdout; -- error only +copy (select 1) to stdout\; copy (select 2) to stdout\; select 0\; select 3; -- 1 2 3 +copy (select 1) to stdout\; select 1/0; -- row, then error +select 0\; copy test3 from stdin\; copy test3 from stdin\; select 1; -- 1 diff --git a/postgresql/examples/create_aggregate.sql b/postgresql/examples/create_aggregate.sql new file mode 100644 index 0000000..d4b4036 --- /dev/null +++ b/postgresql/examples/create_aggregate.sql @@ -0,0 +1,330 @@ +-- +-- CREATE_AGGREGATE +-- + +-- all functions CREATEd +CREATE AGGREGATE newavg ( + sfunc = int4_avg_accum, basetype = int4, stype = _int8, + finalfunc = int8_avg, + initcond1 = '{0,0}' +); + +-- test comments +COMMENT ON AGGREGATE newavg_wrong (int4) IS 'an agg comment'; +COMMENT ON AGGREGATE newavg (int4) IS 'an agg comment'; +COMMENT ON AGGREGATE newavg (int4) IS NULL; + +-- without finalfunc; test obsolete spellings 'sfunc1' etc +CREATE AGGREGATE newsum ( + sfunc1 = int4pl, basetype = int4, stype1 = int4, + initcond1 = '0' +); + +-- zero-argument aggregate +CREATE AGGREGATE newcnt (*) ( + sfunc = int8inc, stype = int8, + initcond = '0', parallel = safe +); + +-- old-style spelling of same (except without parallel-safe; that's too new) +CREATE AGGREGATE oldcnt ( + sfunc = int8inc, basetype = 'ANY', stype = int8, + initcond = '0' +); + +-- aggregate that only cares about null/nonnull input +CREATE AGGREGATE newcnt ("any") ( + sfunc = int8inc_any, stype = int8, + initcond = '0' +); + +COMMENT ON AGGREGATE nosuchagg (*) IS 'should fail'; +COMMENT ON AGGREGATE newcnt (*) IS 'an agg(*) comment'; +COMMENT ON AGGREGATE newcnt ("any") IS 'an agg(any) comment'; + +-- multi-argument aggregate +create function sum3(int8,int8,int8) returns int8 as +'select $1 + $2 + $3' language sql strict immutable; + +create aggregate sum2(int8,int8) ( + sfunc = sum3, stype = int8, + initcond = '0' +); + +-- multi-argument aggregates sensitive to distinct/order, strict/nonstrict +create type aggtype as (a integer, b integer, c text); + +create function aggf_trans(aggtype[],integer,integer,text) returns aggtype[] +as 'select array_append($1,ROW($2,$3,$4)::aggtype)' +language sql strict immutable; + +create function aggfns_trans(aggtype[],integer,integer,text) returns aggtype[] +as 'select array_append($1,ROW($2,$3,$4)::aggtype)' +language sql immutable; + +create aggregate aggfstr(integer,integer,text) ( + sfunc = aggf_trans, stype = aggtype[], + initcond = '{}' +); + +create aggregate aggfns(integer,integer,text) ( + sfunc = aggfns_trans, stype = aggtype[], sspace = 10000, + initcond = '{}' +); + +-- check error cases that would require run-time type coercion +create function least_accum(int8, int8) returns int8 language sql as + 'select least($1, $2)'; + +create aggregate least_agg(int4) ( + stype = int8, sfunc = least_accum +); -- fails + +drop function least_accum(int8, int8); + +create function least_accum(anycompatible, anycompatible) +returns anycompatible language sql as + 'select least($1, $2)'; + +create aggregate least_agg(int4) ( + stype = int8, sfunc = least_accum +); -- fails + +create aggregate least_agg(int8) ( + stype = int8, sfunc = least_accum +); + +drop function least_accum(anycompatible, anycompatible) cascade; + +-- variadic aggregates +create function least_accum(anyelement, variadic anyarray) +returns anyelement language sql as + 'select least($1, min($2[i])) from generate_subscripts($2,1) g(i)'; + +create aggregate least_agg(variadic items anyarray) ( + stype = anyelement, sfunc = least_accum +); + +create function cleast_accum(anycompatible, variadic anycompatiblearray) +returns anycompatible language sql as + 'select least($1, min($2[i])) from generate_subscripts($2,1) g(i)'; + +create aggregate cleast_agg(variadic items anycompatiblearray) ( + stype = anycompatible, sfunc = cleast_accum +); + +-- test ordered-set aggs using built-in support functions +create aggregate my_percentile_disc(float8 ORDER BY anyelement) ( + stype = internal, + sfunc = ordered_set_transition, + finalfunc = percentile_disc_final, + finalfunc_extra = true, + finalfunc_modify = read_write +); + +create aggregate my_rank(VARIADIC "any" ORDER BY VARIADIC "any") ( + stype = internal, + sfunc = ordered_set_transition_multi, + finalfunc = rank_final, + finalfunc_extra = true, + hypothetical +); + +alter aggregate my_percentile_disc(float8 ORDER BY anyelement) + rename to test_percentile_disc; +alter aggregate my_rank(VARIADIC "any" ORDER BY VARIADIC "any") + rename to test_rank; + +\da test_* + +-- moving-aggregate options + +CREATE AGGREGATE sumdouble (float8) +( + stype = float8, + sfunc = float8pl, + mstype = float8, + msfunc = float8pl, + minvfunc = float8mi +); + +-- aggregate combine and serialization functions + +-- can't specify just one of serialfunc and deserialfunc +CREATE AGGREGATE myavg (numeric) +( + stype = internal, + sfunc = numeric_avg_accum, + serialfunc = numeric_avg_serialize +); + +-- serialfunc must have correct parameters +CREATE AGGREGATE myavg (numeric) +( + stype = internal, + sfunc = numeric_avg_accum, + serialfunc = numeric_avg_deserialize, + deserialfunc = numeric_avg_deserialize +); + +-- deserialfunc must have correct parameters +CREATE AGGREGATE myavg (numeric) +( + stype = internal, + sfunc = numeric_avg_accum, + serialfunc = numeric_avg_serialize, + deserialfunc = numeric_avg_serialize +); + +-- ensure combine function parameters are checked +CREATE AGGREGATE myavg (numeric) +( + stype = internal, + sfunc = numeric_avg_accum, + serialfunc = numeric_avg_serialize, + deserialfunc = numeric_avg_deserialize, + combinefunc = int4larger +); + +-- ensure create aggregate works. +CREATE AGGREGATE myavg (numeric) +( + stype = internal, + sfunc = numeric_avg_accum, + finalfunc = numeric_avg, + serialfunc = numeric_avg_serialize, + deserialfunc = numeric_avg_deserialize, + combinefunc = numeric_avg_combine, + finalfunc_modify = shareable -- just to test a non-default setting +); + +-- Ensure all these functions made it into the catalog +SELECT aggfnoid, aggtransfn, aggcombinefn, aggtranstype::regtype, + aggserialfn, aggdeserialfn, aggfinalmodify +FROM pg_aggregate +WHERE aggfnoid = 'myavg'::REGPROC; + +DROP AGGREGATE myavg (numeric); + +-- create or replace aggregate +CREATE AGGREGATE myavg (numeric) +( + stype = internal, + sfunc = numeric_avg_accum, + finalfunc = numeric_avg +); + +CREATE OR REPLACE AGGREGATE myavg (numeric) +( + stype = internal, + sfunc = numeric_avg_accum, + finalfunc = numeric_avg, + serialfunc = numeric_avg_serialize, + deserialfunc = numeric_avg_deserialize, + combinefunc = numeric_avg_combine, + finalfunc_modify = shareable -- just to test a non-default setting +); + +-- Ensure all these functions made it into the catalog again +SELECT aggfnoid, aggtransfn, aggcombinefn, aggtranstype::regtype, + aggserialfn, aggdeserialfn, aggfinalmodify +FROM pg_aggregate +WHERE aggfnoid = 'myavg'::REGPROC; + +-- can change stype: +CREATE OR REPLACE AGGREGATE myavg (numeric) +( + stype = numeric, + sfunc = numeric_add +); +SELECT aggfnoid, aggtransfn, aggcombinefn, aggtranstype::regtype, + aggserialfn, aggdeserialfn, aggfinalmodify +FROM pg_aggregate +WHERE aggfnoid = 'myavg'::REGPROC; + +-- can't change return type: +CREATE OR REPLACE AGGREGATE myavg (numeric) +( + stype = numeric, + sfunc = numeric_add, + finalfunc = numeric_out +); + +-- can't change to a different kind: +CREATE OR REPLACE AGGREGATE myavg (order by numeric) +( + stype = numeric, + sfunc = numeric_add +); + +-- can't change plain function to aggregate: +create function sum4(int8,int8,int8,int8) returns int8 as +'select $1 + $2 + $3 + $4' language sql strict immutable; + +CREATE OR REPLACE AGGREGATE sum3 (int8,int8,int8) +( + stype = int8, + sfunc = sum4 +); + +drop function sum4(int8,int8,int8,int8); + +DROP AGGREGATE myavg (numeric); + +-- invalid: bad parallel-safety marking +CREATE AGGREGATE mysum (int) +( + stype = int, + sfunc = int4pl, + parallel = pear +); + +-- invalid: nonstrict inverse with strict forward function + +CREATE FUNCTION float8mi_n(float8, float8) RETURNS float8 AS +$$ SELECT $1 - $2; $$ +LANGUAGE SQL; + +CREATE AGGREGATE invalidsumdouble (float8) +( + stype = float8, + sfunc = float8pl, + mstype = float8, + msfunc = float8pl, + minvfunc = float8mi_n +); + +-- invalid: non-matching result types + +CREATE FUNCTION float8mi_int(float8, float8) RETURNS int AS +$$ SELECT CAST($1 - $2 AS INT); $$ +LANGUAGE SQL; + +CREATE AGGREGATE wrongreturntype (float8) +( + stype = float8, + sfunc = float8pl, + mstype = float8, + msfunc = float8pl, + minvfunc = float8mi_int +); + +-- invalid: non-lowercase quoted identifiers + +CREATE AGGREGATE case_agg ( -- old syntax + "Sfunc1" = int4pl, + "Basetype" = int4, + "Stype1" = int4, + "Initcond1" = '0', + "Parallel" = safe +); + +CREATE AGGREGATE case_agg(float8) +( + "Stype" = internal, + "Sfunc" = ordered_set_transition, + "Finalfunc" = percentile_disc_final, + "Finalfunc_extra" = true, + "Finalfunc_modify" = read_write, + "Parallel" = safe +); diff --git a/postgresql/examples/create_am.sql b/postgresql/examples/create_am.sql new file mode 100644 index 0000000..d3d2357 --- /dev/null +++ b/postgresql/examples/create_am.sql @@ -0,0 +1,188 @@ +-- +-- Create access method tests +-- + +-- Make gist2 over gisthandler. In fact, it would be a synonym to gist. +CREATE ACCESS METHOD gist2 TYPE INDEX HANDLER gisthandler; + +-- Verify return type checks for handlers +CREATE ACCESS METHOD bogus TYPE INDEX HANDLER int4in; +CREATE ACCESS METHOD bogus TYPE INDEX HANDLER heap_tableam_handler; + + +-- Try to create gist2 index on fast_emp4000: fail because opclass doesn't exist +CREATE INDEX grect2ind2 ON fast_emp4000 USING gist2 (home_base); + + +-- Create gist2 index on fast_emp4000 +CREATE INDEX grect2ind2 ON fast_emp4000 USING gist2 (home_base); + +-- Now check the results from plain indexscan; temporarily drop existing +-- index grect2ind to ensure it doesn't capture the plan +BEGIN; +DROP INDEX grect2ind; +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = OFF; + +EXPLAIN (COSTS OFF) +SELECT * FROM fast_emp4000 + WHERE home_base @ '(200,200),(2000,1000)'::box + ORDER BY (home_base[0])[0]; +SELECT * FROM fast_emp4000 + WHERE home_base @ '(200,200),(2000,1000)'::box + ORDER BY (home_base[0])[0]; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box; +SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL; +SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL; + +ROLLBACK; + +-- Try to drop access method: fail because of dependent objects +DROP ACCESS METHOD gist2; + +-- Drop access method cascade +DROP ACCESS METHOD gist2 CASCADE; + + +-- +-- Test table access methods +-- + +-- prevent empty values +SET default_table_access_method = ''; + +-- prevent nonexistent values +SET default_table_access_method = 'I do not exist AM'; + +-- prevent setting it to an index AM +SET default_table_access_method = 'btree'; + + +-- Create a heap2 table am handler with heapam handler +CREATE ACCESS METHOD heap2 TYPE TABLE HANDLER heap_tableam_handler; + +-- Verify return type checks for handlers +CREATE ACCESS METHOD bogus TYPE TABLE HANDLER int4in; +CREATE ACCESS METHOD bogus TYPE TABLE HANDLER bthandler; + +SELECT amname, amhandler, amtype FROM pg_am where amtype = 't' ORDER BY 1, 2; + + +-- First create tables employing the new AM using USING + +-- plain CREATE TABLE +CREATE TABLE tableam_tbl_heap2(f1 int) USING heap2; +INSERT INTO tableam_tbl_heap2 VALUES(1); +SELECT f1 FROM tableam_tbl_heap2 ORDER BY f1; + +-- CREATE TABLE AS +CREATE TABLE tableam_tblas_heap2 USING heap2 AS SELECT * FROM tableam_tbl_heap2; +SELECT f1 FROM tableam_tbl_heap2 ORDER BY f1; + +-- SELECT INTO doesn't support USING +--SELECT INTO tableam_tblselectinto_heap2 USING heap2 FROM tableam_tbl_heap2; + +-- CREATE VIEW doesn't support USING +--CREATE VIEW tableam_view_heap2 USING heap2 AS SELECT * FROM tableam_tbl_heap2; + +-- CREATE SEQUENCE doesn't support USING +--CREATE SEQUENCE tableam_seq_heap2 USING heap2; + +-- CREATE MATERIALIZED VIEW does support USING +--CREATE MATERIALIZED VIEW tableam_tblmv_heap2 USING heap2 AS SELECT * FROM tableam_tbl_heap2; +SELECT f1 FROM tableam_tblmv_heap2 ORDER BY f1; + +-- CREATE TABLE .. PARTITION BY doesn't not support USING +--CREATE TABLE tableam_parted_heap2 (a text, b int) PARTITION BY list (a) USING heap2; + +CREATE TABLE tableam_parted_heap2 (a text, b int) PARTITION BY list (a); +-- new partitions will inherit from the current default, rather the partition root +SET default_table_access_method = 'heap'; +CREATE TABLE tableam_parted_a_heap2 PARTITION OF tableam_parted_heap2 FOR VALUES IN ('a'); +SET default_table_access_method = 'heap2'; +CREATE TABLE tableam_parted_b_heap2 PARTITION OF tableam_parted_heap2 FOR VALUES IN ('b'); +RESET default_table_access_method; +-- but the method can be explicitly specified +CREATE TABLE tableam_parted_c_heap2 PARTITION OF tableam_parted_heap2 FOR VALUES IN ('c') USING heap; +CREATE TABLE tableam_parted_d_heap2 PARTITION OF tableam_parted_heap2 FOR VALUES IN ('d') USING heap2; + +-- List all objects in AM +SELECT + pc.relkind, + pa.amname, + CASE WHEN relkind = 't' THEN + (SELECT 'toast for ' || relname::regclass FROM pg_class pcm WHERE pcm.reltoastrelid = pc.oid) + ELSE + relname::regclass::text + END COLLATE "C" AS relname +FROM pg_class AS pc, + pg_am AS pa +WHERE pa.oid = pc.relam + AND pa.amname = 'heap2' +ORDER BY 3, 1, 2; + +-- Show dependencies onto AM - there shouldn't be any for toast +SELECT pg_describe_object(classid,objid,objsubid) AS obj +FROM pg_depend, pg_am +WHERE pg_depend.refclassid = 'pg_am'::regclass + AND pg_am.oid = pg_depend.refobjid + AND pg_am.amname = 'heap2' +ORDER BY classid, objid, objsubid; + + +-- Second, create objects in the new AM by changing the default AM +BEGIN; +SET LOCAL default_table_access_method = 'heap2'; + +-- following tests should all respect the default AM +CREATE TABLE tableam_tbl_heapx(f1 int); +CREATE TABLE tableam_tblas_heapx AS SELECT * FROM tableam_tbl_heapx; +SELECT INTO tableam_tblselectinto_heapx FROM tableam_tbl_heapx; +CREATE MATERIALIZED VIEW tableam_tblmv_heapx USING heap2 AS SELECT * FROM tableam_tbl_heapx; +CREATE TABLE tableam_parted_heapx (a text, b int) PARTITION BY list (a); +CREATE TABLE tableam_parted_1_heapx PARTITION OF tableam_parted_heapx FOR VALUES IN ('a', 'b'); + +-- but an explicitly set AM overrides it +CREATE TABLE tableam_parted_2_heapx PARTITION OF tableam_parted_heapx FOR VALUES IN ('c', 'd') USING heap; + +-- sequences, views and foreign servers shouldn't have an AM +CREATE VIEW tableam_view_heapx AS SELECT * FROM tableam_tbl_heapx; +CREATE SEQUENCE tableam_seq_heapx; +CREATE FOREIGN DATA WRAPPER fdw_heap2 VALIDATOR postgresql_fdw_validator; +CREATE SERVER fs_heap2 FOREIGN DATA WRAPPER fdw_heap2 ; +CREATE FOREIGN table tableam_fdw_heapx () SERVER fs_heap2; + +-- Verify that new AM was used for tables, matviews, but not for sequences, views and fdws +SELECT + pc.relkind, + pa.amname, + CASE WHEN relkind = 't' THEN + (SELECT 'toast for ' || relname::regclass FROM pg_class pcm WHERE pcm.reltoastrelid = pc.oid) + ELSE + relname::regclass::text + END COLLATE "C" AS relname +FROM pg_class AS pc + LEFT JOIN pg_am AS pa ON (pa.oid = pc.relam) +WHERE pc.relname LIKE 'tableam_%_heapx' +ORDER BY 3, 1, 2; + +-- don't want to keep those tables, nor the default +ROLLBACK; + +-- Third, check that we can neither create a table using a nonexistent +-- AM, nor using an index AM +--CREATE TABLE i_am_a_failure() USING ""; +CREATE TABLE i_am_a_failure() USING i_do_not_exist_am; +CREATE TABLE i_am_a_failure() USING "I do not exist AM"; +CREATE TABLE i_am_a_failure() USING "btree"; + +-- Drop table access method, which fails as objects depends on it +DROP ACCESS METHOD heap2; + +-- we intentionally leave the objects created above alive, to verify pg_dump support diff --git a/postgresql/examples/create_cast.sql b/postgresql/examples/create_cast.sql new file mode 100644 index 0000000..b11cf88 --- /dev/null +++ b/postgresql/examples/create_cast.sql @@ -0,0 +1,54 @@ +-- +-- CREATE_CAST +-- + +-- Create some types to test with +CREATE TYPE casttesttype; + +CREATE FUNCTION casttesttype_in(cstring) + RETURNS casttesttype + AS 'textin' + LANGUAGE internal STRICT IMMUTABLE; +CREATE FUNCTION casttesttype_out(casttesttype) + RETURNS cstring + AS 'textout' + LANGUAGE internal STRICT IMMUTABLE; + +CREATE TYPE casttesttype ( + internallength = variable, + input = casttesttype_in, + output = casttesttype_out, + alignment = int4 +); + +-- a dummy function to test with +CREATE FUNCTION casttestfunc(casttesttype) RETURNS int4 LANGUAGE SQL AS +$$ SELECT 1; $$; + +SELECT casttestfunc('foo'::text); -- fails, as there's no cast + +-- Try binary coercion cast +CREATE CAST (text AS casttesttype) WITHOUT FUNCTION; +SELECT casttestfunc('foo'::text); -- doesn't work, as the cast is explicit +SELECT casttestfunc('foo'::text::casttesttype); -- should work +DROP CAST (text AS casttesttype); -- cleanup + +-- Try IMPLICIT binary coercion cast +CREATE CAST (text AS casttesttype) WITHOUT FUNCTION AS IMPLICIT; +SELECT casttestfunc('foo'::text); -- Should work now + +-- Try I/O conversion cast. +SELECT 1234::int4::casttesttype; -- No cast yet, should fail + +CREATE CAST (int4 AS casttesttype) WITH INOUT; +SELECT 1234::int4::casttesttype; -- Should work now + +DROP CAST (int4 AS casttesttype); + +-- Try cast with a function + +CREATE FUNCTION int4_casttesttype(int4) RETURNS casttesttype LANGUAGE SQL AS +$$ SELECT ('foo'::text || $1::text)::casttesttype; $$; + +CREATE CAST (int4 AS casttesttype) WITH FUNCTION int4_casttesttype(int4) AS IMPLICIT; +SELECT 1234::int4::casttesttype; -- Should work now diff --git a/postgresql/examples/create_function_3.sql b/postgresql/examples/create_function_3.sql new file mode 100644 index 0000000..7a2df0e --- /dev/null +++ b/postgresql/examples/create_function_3.sql @@ -0,0 +1,225 @@ +-- +-- CREATE FUNCTION +-- +-- Assorted tests using SQL-language functions +-- + +-- All objects made in this test are in temp_func_test schema + +CREATE USER regress_unpriv_user; + +CREATE SCHEMA temp_func_test; +GRANT ALL ON SCHEMA temp_func_test TO public; + +SET search_path TO temp_func_test, public; + +-- +-- Make sanity checks on the pg_proc entries created by CREATE FUNCTION +-- + +-- +-- ARGUMENT and RETURN TYPES +-- +CREATE FUNCTION functest_A_1(text, date) RETURNS bool LANGUAGE 'sql' + AS 'SELECT $1 = ''abcd'' AND $2 > ''2001-01-01'''; +CREATE FUNCTION functest_A_2(text[]) RETURNS int LANGUAGE 'sql' + AS 'SELECT $1[0]::int'; +CREATE FUNCTION functest_A_3() RETURNS bool LANGUAGE 'sql' + AS 'SELECT false'; +SELECT proname, prorettype::regtype, proargtypes::regtype[] FROM pg_proc + WHERE oid in ('functest_A_1'::regproc, + 'functest_A_2'::regproc, + 'functest_A_3'::regproc) ORDER BY proname; + +-- +-- IMMUTABLE | STABLE | VOLATILE +-- +CREATE FUNCTION functest_B_1(int) RETURNS bool LANGUAGE 'sql' + AS 'SELECT $1 > 0'; +CREATE FUNCTION functest_B_2(int) RETURNS bool LANGUAGE 'sql' + IMMUTABLE AS 'SELECT $1 > 0'; +CREATE FUNCTION functest_B_3(int) RETURNS bool LANGUAGE 'sql' + STABLE AS 'SELECT $1 = 0'; +CREATE FUNCTION functest_B_4(int) RETURNS bool LANGUAGE 'sql' + VOLATILE AS 'SELECT $1 < 0'; +SELECT proname, provolatile FROM pg_proc + WHERE oid in ('functest_B_1'::regproc, + 'functest_B_2'::regproc, + 'functest_B_3'::regproc, + 'functest_B_4'::regproc) ORDER BY proname; + +ALTER FUNCTION functest_B_2(int) VOLATILE; +ALTER FUNCTION functest_B_3(int) COST 100; -- unrelated change, no effect +SELECT proname, provolatile FROM pg_proc + WHERE oid in ('functest_B_1'::regproc, + 'functest_B_2'::regproc, + 'functest_B_3'::regproc, + 'functest_B_4'::regproc) ORDER BY proname; + +-- +-- SECURITY DEFINER | INVOKER +-- +CREATE FUNCTION functest_C_1(int) RETURNS bool LANGUAGE 'sql' + AS 'SELECT $1 > 0'; +CREATE FUNCTION functest_C_2(int) RETURNS bool LANGUAGE 'sql' + SECURITY DEFINER AS 'SELECT $1 = 0'; +CREATE FUNCTION functest_C_3(int) RETURNS bool LANGUAGE 'sql' + SECURITY INVOKER AS 'SELECT $1 < 0'; +SELECT proname, prosecdef FROM pg_proc + WHERE oid in ('functest_C_1'::regproc, + 'functest_C_2'::regproc, + 'functest_C_3'::regproc) ORDER BY proname; + +ALTER FUNCTION functest_C_1(int) IMMUTABLE; -- unrelated change, no effect +ALTER FUNCTION functest_C_2(int) SECURITY INVOKER; +ALTER FUNCTION functest_C_3(int) SECURITY DEFINER; +SELECT proname, prosecdef FROM pg_proc + WHERE oid in ('functest_C_1'::regproc, + 'functest_C_2'::regproc, + 'functest_C_3'::regproc) ORDER BY proname; + +-- +-- LEAKPROOF +-- +CREATE FUNCTION functest_E_1(int) RETURNS bool LANGUAGE 'sql' + AS 'SELECT $1 > 100'; +CREATE FUNCTION functest_E_2(int) RETURNS bool LANGUAGE 'sql' + LEAKPROOF AS 'SELECT $1 > 100'; +SELECT proname, proleakproof FROM pg_proc + WHERE oid in ('functest_E_1'::regproc, + 'functest_E_2'::regproc) ORDER BY proname; + +ALTER FUNCTION functest_E_1(int) LEAKPROOF; +ALTER FUNCTION functest_E_2(int) STABLE; -- unrelated change, no effect +SELECT proname, proleakproof FROM pg_proc + WHERE oid in ('functest_E_1'::regproc, + 'functest_E_2'::regproc) ORDER BY proname; + +ALTER FUNCTION functest_E_2(int) NOT LEAKPROOF; -- remove leakproof attribute +SELECT proname, proleakproof FROM pg_proc + WHERE oid in ('functest_E_1'::regproc, + 'functest_E_2'::regproc) ORDER BY proname; + +-- it takes superuser privilege to turn on leakproof, but not to turn off +ALTER FUNCTION functest_E_1(int) OWNER TO regress_unpriv_user; +ALTER FUNCTION functest_E_2(int) OWNER TO regress_unpriv_user; + +SET SESSION AUTHORIZATION regress_unpriv_user; +SET search_path TO temp_func_test, public; +ALTER FUNCTION functest_E_1(int) NOT LEAKPROOF; +ALTER FUNCTION functest_E_2(int) LEAKPROOF; + +CREATE FUNCTION functest_E_3(int) RETURNS bool LANGUAGE 'sql' + LEAKPROOF AS 'SELECT $1 < 200'; -- fail + +RESET SESSION AUTHORIZATION; + +-- +-- CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT +-- +CREATE FUNCTION functest_F_1(int) RETURNS bool LANGUAGE 'sql' + AS 'SELECT $1 > 50'; +CREATE FUNCTION functest_F_2(int) RETURNS bool LANGUAGE 'sql' + CALLED ON NULL INPUT AS 'SELECT $1 = 50'; +CREATE FUNCTION functest_F_3(int) RETURNS bool LANGUAGE 'sql' + RETURNS NULL ON NULL INPUT AS 'SELECT $1 < 50'; +CREATE FUNCTION functest_F_4(int) RETURNS bool LANGUAGE 'sql' + STRICT AS 'SELECT $1 = 50'; +SELECT proname, proisstrict FROM pg_proc + WHERE oid in ('functest_F_1'::regproc, + 'functest_F_2'::regproc, + 'functest_F_3'::regproc, + 'functest_F_4'::regproc) ORDER BY proname; + +ALTER FUNCTION functest_F_1(int) IMMUTABLE; -- unrelated change, no effect +ALTER FUNCTION functest_F_2(int) STRICT; +ALTER FUNCTION functest_F_3(int) CALLED ON NULL INPUT; +SELECT proname, proisstrict FROM pg_proc + WHERE oid in ('functest_F_1'::regproc, + 'functest_F_2'::regproc, + 'functest_F_3'::regproc, + 'functest_F_4'::regproc) ORDER BY proname; + + +-- pg_get_functiondef tests + +SELECT pg_get_functiondef('functest_A_1'::regproc); +SELECT pg_get_functiondef('functest_B_3'::regproc); +SELECT pg_get_functiondef('functest_C_3'::regproc); +SELECT pg_get_functiondef('functest_F_2'::regproc); + + +-- information_schema tests + +CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo') + RETURNS int + LANGUAGE SQL + AS 'SELECT $1 + $2'; + +CREATE FUNCTION functest_IS_2(out a int, b int default 1) + RETURNS int + LANGUAGE SQL + AS 'SELECT $1'; + +CREATE FUNCTION functest_IS_3(a int default 1, out b int) + RETURNS int + LANGUAGE SQL + AS 'SELECT $1'; + +SELECT routine_name, ordinal_position, parameter_name, parameter_default + FROM information_schema.parameters JOIN information_schema.routines USING (specific_schema, specific_name) + WHERE routine_schema = 'temp_func_test' AND routine_name ~ '^functest_is_' + ORDER BY 1, 2; + +DROP FUNCTION functest_IS_1(int, int, text), functest_IS_2(int), functest_IS_3(int); + +-- overload +CREATE FUNCTION functest_B_2(bigint) RETURNS bool LANGUAGE 'sql' + IMMUTABLE AS 'SELECT $1 > 0'; + +DROP FUNCTION functest_b_1; +DROP FUNCTION functest_b_1; -- error, not found +DROP FUNCTION functest_b_2; -- error, ambiguous + + +-- CREATE OR REPLACE tests + +CREATE FUNCTION functest1(a int) RETURNS int LANGUAGE SQL AS 'SELECT $1'; +CREATE OR REPLACE FUNCTION functest1(a int) RETURNS int LANGUAGE SQL WINDOW AS 'SELECT $1'; +CREATE OR REPLACE PROCEDURE functest1(a int) LANGUAGE SQL AS 'SELECT $1'; +DROP FUNCTION functest1(a int); + + +-- Check behavior of VOID-returning SQL functions + +CREATE FUNCTION voidtest1(a int) RETURNS VOID LANGUAGE SQL AS +$$ SELECT a + 1 $$; +SELECT voidtest1(42); + +CREATE FUNCTION voidtest2(a int, b int) RETURNS VOID LANGUAGE SQL AS +$$ SELECT voidtest1(a + b) $$; +SELECT voidtest2(11,22); + +-- currently, we can inline voidtest2 but not voidtest1 +EXPLAIN (verbose, costs off) SELECT voidtest2(11,22); + +CREATE TEMP TABLE sometable(f1 int); + +CREATE FUNCTION voidtest3(a int) RETURNS VOID LANGUAGE SQL AS +$$ INSERT INTO sometable VALUES(a + 1) $$; +SELECT voidtest3(17); + +CREATE FUNCTION voidtest4(a int) RETURNS VOID LANGUAGE SQL AS +$$ INSERT INTO sometable VALUES(a - 1) RETURNING f1 $$; +SELECT voidtest4(39); + +TABLE sometable; + +CREATE FUNCTION voidtest5(a int) RETURNS SETOF VOID LANGUAGE SQL AS +$$ SELECT generate_series(1, a) $$ STABLE; +SELECT * FROM voidtest5(3); + +-- Cleanup +DROP SCHEMA temp_func_test CASCADE; +DROP USER regress_unpriv_user; +RESET search_path; diff --git a/postgresql/examples/create_index.sql b/postgresql/examples/create_index.sql new file mode 100644 index 0000000..eb3730c --- /dev/null +++ b/postgresql/examples/create_index.sql @@ -0,0 +1,1124 @@ +-- +-- CREATE_INDEX +-- Create ancillary data structures (i.e. indices) +-- + +-- +-- BTREE +-- +CREATE INDEX onek_unique1 ON onek USING btree(unique1 int4_ops); + +CREATE INDEX IF NOT EXISTS onek_unique1 ON onek USING btree(unique1 int4_ops); + +--CREATE INDEX IF NOT EXISTS ON onek USING btree(unique1 int4_ops); + +CREATE INDEX onek_unique2 ON onek USING btree(unique2 int4_ops); + +CREATE INDEX onek_hundred ON onek USING btree(hundred int4_ops); + +CREATE INDEX onek_stringu1 ON onek USING btree(stringu1 name_ops); + +CREATE INDEX tenk1_unique1 ON tenk1 USING btree(unique1 int4_ops); + +CREATE INDEX tenk1_unique2 ON tenk1 USING btree(unique2 int4_ops); + +CREATE INDEX tenk1_hundred ON tenk1 USING btree(hundred int4_ops); + +CREATE INDEX tenk1_thous_tenthous ON tenk1 (thousand, tenthous); + +CREATE INDEX tenk2_unique1 ON tenk2 USING btree(unique1 int4_ops); + +CREATE INDEX tenk2_unique2 ON tenk2 USING btree(unique2 int4_ops); + +CREATE INDEX tenk2_hundred ON tenk2 USING btree(hundred int4_ops); + +CREATE INDEX rix ON road USING btree (name text_ops); + +CREATE INDEX iix ON ihighway USING btree (name text_ops); + +CREATE INDEX six ON shighway USING btree (name text_ops); + +-- test comments +COMMENT ON INDEX six_wrong IS 'bad index'; +COMMENT ON INDEX six IS 'good index'; +COMMENT ON INDEX six IS NULL; + +-- +-- BTREE ascending/descending cases +-- +-- we load int4/text from pure descending data (each key is a new +-- low key) and name/f8 from pure ascending data (each key is a new +-- high key). we had a bug where new low keys would sometimes be +-- "lost". +-- +CREATE INDEX bt_i4_index ON bt_i4_heap USING btree (seqno int4_ops); + +CREATE INDEX bt_name_index ON bt_name_heap USING btree (seqno name_ops); + +CREATE INDEX bt_txt_index ON bt_txt_heap USING btree (seqno text_ops); + +CREATE INDEX bt_f8_index ON bt_f8_heap USING btree (seqno float8_ops); + +-- +-- BTREE partial indices +-- +CREATE INDEX onek2_u1_prtl ON onek2 USING btree(unique1 int4_ops) + where unique1 < 20 or unique1 > 980; + +CREATE INDEX onek2_u2_prtl ON onek2 USING btree(unique2 int4_ops) + where stringu1 < 'B'; + +CREATE INDEX onek2_stu1_prtl ON onek2 USING btree(stringu1 name_ops) + where onek2.stringu1 >= 'J' and onek2.stringu1 < 'K'; + +-- +-- GiST (rtree-equivalent opclasses only) +-- +CREATE INDEX grect2ind ON fast_emp4000 USING gist (home_base); + +CREATE INDEX gpolygonind ON polygon_tbl USING gist (f1); + +CREATE INDEX gcircleind ON circle_tbl USING gist (f1); + +INSERT INTO POINT_TBL(f1) VALUES (NULL); + +CREATE INDEX gpointind ON point_tbl USING gist (f1); + +CREATE TEMP TABLE gpolygon_tbl AS + SELECT polygon(home_base) AS f1 FROM slow_emp4000; +INSERT INTO gpolygon_tbl VALUES ( '(1000,0,0,1000)' ); +INSERT INTO gpolygon_tbl VALUES ( '(0,1000,1000,1000)' ); + +CREATE TEMP TABLE gcircle_tbl AS + SELECT circle(home_base) AS f1 FROM slow_emp4000; + +CREATE INDEX ggpolygonind ON gpolygon_tbl USING gist (f1); + +CREATE INDEX ggcircleind ON gcircle_tbl USING gist (f1); + +-- +-- Test GiST indexes +-- + +-- get non-indexed results for comparison purposes + +SET enable_seqscan = ON; +SET enable_indexscan = OFF; +SET enable_bitmapscan = OFF; + +SELECT * FROM fast_emp4000 + WHERE home_base @ '(200,200),(2000,1000)'::box + ORDER BY (home_base[0])[0]; + +SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box; + +SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL; + +SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon + ORDER BY (poly_center(f1))[0]; + +SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1) + ORDER BY area(f1); + +SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,0)'::polygon; + +SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500>'::circle; + +SELECT count(*) FROM point_tbl WHERE f1 <@ box '(0,0,100,100)'; + +SELECT count(*) FROM point_tbl WHERE box '(0,0,100,100)' @> f1; + +SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,50),(100,0),(0,0)'; + +SELECT count(*) FROM point_tbl WHERE f1 <@ circle '<(50,50),50>'; + + +SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; + +SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; + +SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)'; + +SELECT * FROM point_tbl ORDER BY f1 <-> '0,1'; + +SELECT * FROM point_tbl WHERE f1 IS NULL; + +SELECT * FROM point_tbl WHERE f1 IS NOT NULL ORDER BY f1 <-> '0,1'; + +SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1'; + +SELECT * FROM gpolygon_tbl ORDER BY f1 <-> '(0,0)'::point LIMIT 10; + +SELECT circle_center(f1), round(radius(f1)) as radius FROM gcircle_tbl ORDER BY f1 <-> '(200,300)'::point LIMIT 10; + +-- Now check the results from plain indexscan +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = OFF; + +EXPLAIN (COSTS OFF) +SELECT * FROM fast_emp4000 + WHERE home_base @ '(200,200),(2000,1000)'::box + ORDER BY (home_base[0])[0]; +SELECT * FROM fast_emp4000 + WHERE home_base @ '(200,200),(2000,1000)'::box + ORDER BY (home_base[0])[0]; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box; +SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL; +SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL; + +EXPLAIN (COSTS OFF) +SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon + ORDER BY (poly_center(f1))[0]; +SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon + ORDER BY (poly_center(f1))[0]; + +EXPLAIN (COSTS OFF) +SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1) + ORDER BY area(f1); +SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1) + ORDER BY area(f1); + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,0)'::polygon; +SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,0)'::polygon; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500>'::circle; +SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500>'::circle; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl WHERE f1 <@ box '(0,0,100,100)'; +SELECT count(*) FROM point_tbl WHERE f1 <@ box '(0,0,100,100)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl WHERE box '(0,0,100,100)' @> f1; +SELECT count(*) FROM point_tbl WHERE box '(0,0,100,100)' @> f1; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,50),(100,0),(0,0)'; +SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,50),(100,0),(0,0)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl WHERE f1 <@ circle '<(50,50),50>'; +SELECT count(*) FROM point_tbl WHERE f1 <@ circle '<(50,50),50>'; + + + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)'; + +EXPLAIN (COSTS OFF) +SELECT * FROM point_tbl ORDER BY f1 <-> '0,1'; +SELECT * FROM point_tbl ORDER BY f1 <-> '0,1'; + +EXPLAIN (COSTS OFF) +SELECT * FROM point_tbl WHERE f1 IS NULL; +SELECT * FROM point_tbl WHERE f1 IS NULL; + +EXPLAIN (COSTS OFF) +SELECT * FROM point_tbl WHERE f1 IS NOT NULL ORDER BY f1 <-> '0,1'; +SELECT * FROM point_tbl WHERE f1 IS NOT NULL ORDER BY f1 <-> '0,1'; + +EXPLAIN (COSTS OFF) +SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1'; +SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1'; + +EXPLAIN (COSTS OFF) +SELECT * FROM gpolygon_tbl ORDER BY f1 <-> '(0,0)'::point LIMIT 10; +SELECT * FROM gpolygon_tbl ORDER BY f1 <-> '(0,0)'::point LIMIT 10; + +EXPLAIN (COSTS OFF) +SELECT circle_center(f1), round(radius(f1)) as radius FROM gcircle_tbl ORDER BY f1 <-> '(200,300)'::point LIMIT 10; +SELECT circle_center(f1), round(radius(f1)) as radius FROM gcircle_tbl ORDER BY f1 <-> '(200,300)'::point LIMIT 10; + +-- Now check the results from bitmap indexscan +SET enable_seqscan = OFF; +SET enable_indexscan = OFF; +SET enable_bitmapscan = ON; + +EXPLAIN (COSTS OFF) +SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1'; +SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1'; + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; + +-- +-- GIN over int[] and text[] +-- +-- Note: GIN currently supports only bitmap scans, not plain indexscans +-- + +SET enable_seqscan = OFF; +SET enable_indexscan = OFF; +SET enable_bitmapscan = ON; + +CREATE INDEX intarrayidx ON array_index_op_test USING gin (i); + +explain (costs off) +SELECT * FROM array_index_op_test WHERE i @> '{32}' ORDER BY seqno; + +SELECT * FROM array_index_op_test WHERE i @> '{32}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i && '{32}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i @> '{17}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i && '{17}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i @> '{32,17}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i && '{32,17}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i <@ '{38,34,32,89}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i = '{47,77}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i = '{}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i @> '{}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i && '{}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i <@ '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i = '{NULL}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i @> '{NULL}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i && '{NULL}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i <@ '{NULL}' ORDER BY seqno; + +CREATE INDEX textarrayidx ON array_index_op_test USING gin (t); + +explain (costs off) +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAAA72908}' ORDER BY seqno; + +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAAA72908}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAAA72908}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAAAAA646}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAAAAA646}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t <@ '{AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t = '{AAAAAAAAAA646,A87088}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t = '{}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t @> '{}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t && '{}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t <@ '{}' ORDER BY seqno; + +-- And try it with a multicolumn GIN index + +DROP INDEX intarrayidx, textarrayidx; + +CREATE INDEX botharrayidx ON array_index_op_test USING gin (i, t); + +SELECT * FROM array_index_op_test WHERE i @> '{32}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i && '{32}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAA80240}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAA80240}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i @> '{32}' AND t && '{AAAAAAA80240}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE i && '{32}' AND t @> '{AAAAAAA80240}' ORDER BY seqno; +SELECT * FROM array_index_op_test WHERE t = '{}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i = '{NULL}' ORDER BY seqno; +SELECT * FROM array_op_test WHERE i <@ '{NULL}' ORDER BY seqno; + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; + +-- +-- Try a GIN index with a lot of items with same key. (GIN creates a posting +-- tree when there are enough duplicates) +-- +CREATE TABLE array_gin_test (a int[]); + +INSERT INTO array_gin_test SELECT ARRAY[1, g%5, g] FROM generate_series(1, 10000) g; + +CREATE INDEX array_gin_test_idx ON array_gin_test USING gin (a); + +SELECT COUNT(*) FROM array_gin_test WHERE a @> '{2}'; + +DROP TABLE array_gin_test; + +-- +-- Test GIN index's reloptions +-- +CREATE INDEX gin_relopts_test ON array_index_op_test USING gin (i) + WITH (FASTUPDATE=on, GIN_PENDING_LIST_LIMIT=128); +\d+ gin_relopts_test + +-- +-- HASH +-- +CREATE INDEX hash_i4_index ON hash_i4_heap USING hash (random int4_ops); + +CREATE INDEX hash_name_index ON hash_name_heap USING hash (random name_ops); + +CREATE INDEX hash_txt_index ON hash_txt_heap USING hash (random text_ops); + +CREATE INDEX hash_f8_index ON hash_f8_heap USING hash (random float8_ops) WITH (fillfactor=60); + +CREATE UNLOGGED TABLE unlogged_hash_table (id int4); +CREATE INDEX unlogged_hash_index ON unlogged_hash_table USING hash (id int4_ops); +DROP TABLE unlogged_hash_table; + +-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops); + +-- Test hash index build tuplesorting. Force hash tuplesort using low +-- maintenance_work_mem setting and fillfactor: +SET maintenance_work_mem = '1MB'; +CREATE INDEX hash_tuplesort_idx ON tenk1 USING hash (stringu1 name_ops) WITH (fillfactor = 10); +EXPLAIN (COSTS OFF) +SELECT count(*) FROM tenk1 WHERE stringu1 = 'TVAAAA'; +SELECT count(*) FROM tenk1 WHERE stringu1 = 'TVAAAA'; +DROP INDEX hash_tuplesort_idx; +RESET maintenance_work_mem; + + +-- +-- Test functional index +-- +CREATE TABLE func_index_heap (f1 text, f2 text); +CREATE UNIQUE INDEX func_index_index on func_index_heap (textcat(f1,f2)) NULLS NOT DISTINCT; + +INSERT INTO func_index_heap VALUES('ABC','DEF'); +INSERT INTO func_index_heap VALUES('AB','CDEFG'); +INSERT INTO func_index_heap VALUES('QWE','RTY'); +-- this should fail because of unique index: +INSERT INTO func_index_heap VALUES('ABCD', 'EF'); +-- but this shouldn't: +INSERT INTO func_index_heap VALUES('QWERTY'); + +-- while we're here, see that the metadata looks sane +\d func_index_heap +\d func_index_index + + +-- +-- Same test, expressional index +-- +DROP TABLE func_index_heap; +CREATE TABLE func_index_heap (f1 text, f2 text); +CREATE UNIQUE INDEX func_index_index on func_index_heap ((f1 || f2) text_ops); + +INSERT INTO func_index_heap VALUES('ABC','DEF'); +INSERT INTO func_index_heap VALUES('AB','CDEFG'); +INSERT INTO func_index_heap VALUES('QWE','RTY'); +-- this should fail because of unique index: +INSERT INTO func_index_heap VALUES('ABCD', 'EF'); +-- but this shouldn't: +INSERT INTO func_index_heap VALUES('QWERTY'); + +-- while we're here, see that the metadata looks sane +\d func_index_heap +\d func_index_index + +-- this should fail because of unsafe column type (anonymous record) +create index on func_index_heap ((f1 || f2), (row(f1, f2))); + + +-- +-- Test unique index with included columns +-- +CREATE TABLE covering_index_heap (f1 int, f2 int, f3 text); +CREATE UNIQUE INDEX covering_index_index on covering_index_heap (f1,f2) INCLUDE(f3); + +INSERT INTO covering_index_heap VALUES(1,1,'AAA'); +INSERT INTO covering_index_heap VALUES(1,2,'AAA'); +-- this should fail because of unique index on f1,f2: +INSERT INTO covering_index_heap VALUES(1,2,'BBB'); +-- and this shouldn't: +INSERT INTO covering_index_heap VALUES(1,4,'AAA'); +-- Try to build index on table that already contains data +CREATE UNIQUE INDEX covering_pkey on covering_index_heap (f1,f2) INCLUDE(f3); +-- Try to use existing covering index as primary key +ALTER TABLE covering_index_heap ADD CONSTRAINT covering_pkey PRIMARY KEY USING INDEX +covering_pkey; +DROP TABLE covering_index_heap; + + +-- +-- Also try building functional, expressional, and partial indexes on +-- tables that already contain data. +-- +create unique index hash_f8_index_1 on hash_f8_heap(abs(random)); +create unique index hash_f8_index_2 on hash_f8_heap((seqno + 1), random); +create unique index hash_f8_index_3 on hash_f8_heap(random) where seqno > 1000; + +-- +-- Try some concurrent index builds +-- +-- Unfortunately this only tests about half the code paths because there are +-- no concurrent updates happening to the table at the same time. + +CREATE TABLE concur_heap (f1 text, f2 text); +-- empty table +CREATE INDEX CONCURRENTLY concur_index1 ON concur_heap(f2,f1); +CREATE INDEX CONCURRENTLY IF NOT EXISTS concur_index1 ON concur_heap(f2,f1); +INSERT INTO concur_heap VALUES ('a','b'); +INSERT INTO concur_heap VALUES ('b','b'); +-- unique index +CREATE UNIQUE INDEX CONCURRENTLY concur_index2 ON concur_heap(f1); +CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS concur_index2 ON concur_heap(f1); +-- check if constraint is set up properly to be enforced +INSERT INTO concur_heap VALUES ('b','x'); +-- check if constraint is enforced properly at build time +CREATE UNIQUE INDEX CONCURRENTLY concur_index3 ON concur_heap(f2); +-- test that expression indexes and partial indexes work concurrently +CREATE INDEX CONCURRENTLY concur_index4 on concur_heap(f2) WHERE f1='a'; +CREATE INDEX CONCURRENTLY concur_index5 on concur_heap(f2) WHERE f1='x'; +-- here we also check that you can default the index name +CREATE INDEX CONCURRENTLY on concur_heap((f2||f1)); + +-- You can't do a concurrent index build in a transaction +BEGIN; +CREATE INDEX CONCURRENTLY concur_index7 ON concur_heap(f1); +COMMIT; + +-- But you can do a regular index build in a transaction +BEGIN; +CREATE INDEX std_index on concur_heap(f2); +COMMIT; + +-- Failed builds are left invalid by VACUUM FULL, fixed by REINDEX +VACUUM FULL concur_heap; +REINDEX TABLE concur_heap; +DELETE FROM concur_heap WHERE f1 = 'b'; +VACUUM FULL concur_heap; +\d concur_heap +REINDEX TABLE concur_heap; +\d concur_heap + +-- Temporary tables with concurrent builds and on-commit actions +-- CONCURRENTLY used with CREATE INDEX and DROP INDEX is ignored. +-- PRESERVE ROWS, the default. +CREATE TEMP TABLE concur_temp (f1 int, f2 text) + ON COMMIT PRESERVE ROWS; +INSERT INTO concur_temp VALUES (1, 'foo'), (2, 'bar'); +CREATE INDEX CONCURRENTLY concur_temp_ind ON concur_temp(f1); +DROP INDEX CONCURRENTLY concur_temp_ind; +DROP TABLE concur_temp; +-- ON COMMIT DROP +BEGIN; +CREATE TEMP TABLE concur_temp (f1 int, f2 text) + ON COMMIT DROP; +INSERT INTO concur_temp VALUES (1, 'foo'), (2, 'bar'); +-- Fails when running in a transaction. +CREATE INDEX CONCURRENTLY concur_temp_ind ON concur_temp(f1); +COMMIT; +-- ON COMMIT DELETE ROWS +CREATE TEMP TABLE concur_temp (f1 int, f2 text) + ON COMMIT DELETE ROWS; +INSERT INTO concur_temp VALUES (1, 'foo'), (2, 'bar'); +CREATE INDEX CONCURRENTLY concur_temp_ind ON concur_temp(f1); +DROP INDEX CONCURRENTLY concur_temp_ind; +DROP TABLE concur_temp; + +-- +-- Try some concurrent index drops +-- +DROP INDEX CONCURRENTLY "concur_index2"; -- works +DROP INDEX CONCURRENTLY IF EXISTS "concur_index2"; -- notice + +-- failures +DROP INDEX CONCURRENTLY "concur_index2", "concur_index3"; +BEGIN; +DROP INDEX CONCURRENTLY "concur_index5"; +ROLLBACK; + +-- successes +DROP INDEX CONCURRENTLY IF EXISTS "concur_index3"; +DROP INDEX CONCURRENTLY "concur_index4"; +DROP INDEX CONCURRENTLY "concur_index5"; +DROP INDEX CONCURRENTLY "concur_index1"; +DROP INDEX CONCURRENTLY "concur_heap_expr_idx"; + +\d concur_heap + +DROP TABLE concur_heap; + +-- +-- Test ADD CONSTRAINT USING INDEX +-- + +CREATE TABLE cwi_test( a int , b varchar(10), c char); + +-- add some data so that all tests have something to work with. + +INSERT INTO cwi_test VALUES(1, 2), (3, 4), (5, 6); + +CREATE UNIQUE INDEX cwi_uniq_idx ON cwi_test(a , b); +ALTER TABLE cwi_test ADD primary key USING INDEX cwi_uniq_idx; + +\d cwi_test +\d cwi_uniq_idx + +CREATE UNIQUE INDEX cwi_uniq2_idx ON cwi_test(b , a); +ALTER TABLE cwi_test DROP CONSTRAINT cwi_uniq_idx, + ADD CONSTRAINT cwi_replaced_pkey PRIMARY KEY + USING INDEX cwi_uniq2_idx; + +\d cwi_test +\d cwi_replaced_pkey + +DROP INDEX cwi_replaced_pkey; -- Should fail; a constraint depends on it + +-- Check that non-default index options are rejected +CREATE UNIQUE INDEX cwi_uniq3_idx ON cwi_test(a desc); +ALTER TABLE cwi_test ADD UNIQUE USING INDEX cwi_uniq3_idx; -- fail +CREATE UNIQUE INDEX cwi_uniq4_idx ON cwi_test(b collate "POSIX"); +ALTER TABLE cwi_test ADD UNIQUE USING INDEX cwi_uniq4_idx; -- fail + +DROP TABLE cwi_test; + +-- ADD CONSTRAINT USING INDEX is forbidden on partitioned tables +CREATE TABLE cwi_test(a int) PARTITION BY hash (a); +create unique index on cwi_test (a); +alter table cwi_test add primary key using index cwi_test_a_idx ; +DROP TABLE cwi_test; + +-- +-- Check handling of indexes on system columns +-- +CREATE TABLE syscol_table (a INT); + +-- System columns cannot be indexed +CREATE INDEX ON syscolcol_table (ctid); + +-- nor used in expressions +CREATE INDEX ON syscol_table ((ctid >= '(1000,0)')); + +-- nor used in predicates +CREATE INDEX ON syscol_table (a) WHERE ctid >= '(1000,0)'; + +DROP TABLE syscol_table; + +-- +-- Tests for IS NULL/IS NOT NULL with b-tree indexes +-- + +SELECT unique1, unique2 INTO onek_with_null FROM onek; +INSERT INTO onek_with_null (unique1,unique2) VALUES (NULL, -1), (NULL, NULL); +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2,unique1); + +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = ON; + +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NOT NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL AND unique1 > 500; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique1 > 500; + +DROP INDEX onek_nulltest; + +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2 desc,unique1); + +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NOT NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL AND unique1 > 500; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique1 > 500; + +DROP INDEX onek_nulltest; + +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2 desc nulls last,unique1); + +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NOT NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL AND unique1 > 500; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique1 > 500; + +DROP INDEX onek_nulltest; + +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2 nulls first,unique1); + +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NOT NULL; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL AND unique1 > 500; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique1 > 500; + +DROP INDEX onek_nulltest; + +-- Check initial-positioning logic too + +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2); + +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = OFF; + +SELECT unique1, unique2 FROM onek_with_null + ORDER BY unique2 LIMIT 2; +SELECT unique1, unique2 FROM onek_with_null WHERE unique2 >= -1 + ORDER BY unique2 LIMIT 2; +SELECT unique1, unique2 FROM onek_with_null WHERE unique2 >= 0 + ORDER BY unique2 LIMIT 2; + +SELECT unique1, unique2 FROM onek_with_null + ORDER BY unique2 DESC LIMIT 2; +SELECT unique1, unique2 FROM onek_with_null WHERE unique2 >= -1 + ORDER BY unique2 DESC LIMIT 2; +SELECT unique1, unique2 FROM onek_with_null WHERE unique2 < 999 + ORDER BY unique2 DESC LIMIT 2; + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; + +DROP TABLE onek_with_null; + +-- +-- Check bitmap index path planning +-- + +EXPLAIN (COSTS OFF) +SELECT * FROM tenk1 + WHERE thousand = 42 AND (tenthous = 1 OR tenthous = 3 OR tenthous = 42); +SELECT * FROM tenk1 + WHERE thousand = 42 AND (tenthous = 1 OR tenthous = 3 OR tenthous = 42); + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM tenk1 + WHERE hundred = 42 AND (thousand = 42 OR thousand = 99); +SELECT count(*) FROM tenk1 + WHERE hundred = 42 AND (thousand = 42 OR thousand = 99); + +-- +-- Check behavior with duplicate index column contents +-- + +CREATE TABLE dupindexcols AS + SELECT unique1 as id, stringu2::text as f1 FROM tenk1; +CREATE INDEX dupindexcols_i ON dupindexcols (f1, id, f1 text_pattern_ops); +ANALYZE dupindexcols; + +EXPLAIN (COSTS OFF) + SELECT count(*) FROM dupindexcols + WHERE f1 BETWEEN 'WA' AND 'ZZZ' and id < 1000 and f1 ~<~ 'YX'; +SELECT count(*) FROM dupindexcols + WHERE f1 BETWEEN 'WA' AND 'ZZZ' and id < 1000 and f1 ~<~ 'YX'; + +-- +-- Check ordering of =ANY indexqual results (bug in 9.2.0) +-- + +vacuum tenk1; -- ensure we get consistent plans here + +explain (costs off) +SELECT unique1 FROM tenk1 +WHERE unique1 IN (1,42,7) +ORDER BY unique1; + +SELECT unique1 FROM tenk1 +WHERE unique1 IN (1,42,7) +ORDER BY unique1; + +explain (costs off) +SELECT thousand, tenthous FROM tenk1 +WHERE thousand < 2 AND tenthous IN (1001,3000) +ORDER BY thousand; + +SELECT thousand, tenthous FROM tenk1 +WHERE thousand < 2 AND tenthous IN (1001,3000) +ORDER BY thousand; + +SET enable_indexonlyscan = OFF; + +explain (costs off) +SELECT thousand, tenthous FROM tenk1 +WHERE thousand < 2 AND tenthous IN (1001,3000) +ORDER BY thousand; + +SELECT thousand, tenthous FROM tenk1 +WHERE thousand < 2 AND tenthous IN (1001,3000) +ORDER BY thousand; + +RESET enable_indexonlyscan; + +-- +-- Check elimination of constant-NULL subexpressions +-- + +explain (costs off) + select * from tenk1 where (thousand, tenthous) in ((1,1001), (null,null)); + +-- +-- Check matching of boolean index columns to WHERE conditions and sort keys +-- + +create temp table boolindex (b bool, i int, unique(b, i), junk float); + +explain (costs off) + select * from boolindex order by b, i limit 10; +explain (costs off) + select * from boolindex where b order by i limit 10; +explain (costs off) + select * from boolindex where b = true order by i desc limit 10; +explain (costs off) + select * from boolindex where not b order by i limit 10; +explain (costs off) + select * from boolindex where b is true order by i desc limit 10; +explain (costs off) + select * from boolindex where b is false order by i desc limit 10; + +-- +-- REINDEX (VERBOSE) +-- +CREATE TABLE reindex_verbose(id integer primary key); +\set VERBOSITY terse \\ -- suppress machine-dependent details +REINDEX (VERBOSE) TABLE reindex_verbose; +\set VERBOSITY default +DROP TABLE reindex_verbose; + +-- +-- REINDEX CONCURRENTLY +-- +CREATE TABLE concur_reindex_tab (c1 int); +-- REINDEX +REINDEX TABLE concur_reindex_tab; -- notice +REINDEX TABLE CONCURRENTLY concur_reindex_tab; -- notice +ALTER TABLE concur_reindex_tab ADD COLUMN c2 text; -- add toast index +-- Normal index with integer column +CREATE UNIQUE INDEX concur_reindex_ind1 ON concur_reindex_tab(c1); +-- Normal index with text column +CREATE INDEX concur_reindex_ind2 ON concur_reindex_tab(c2); +-- UNIQUE index with expression +CREATE UNIQUE INDEX concur_reindex_ind3 ON concur_reindex_tab(abs(c1)); +-- Duplicate column names +CREATE INDEX concur_reindex_ind4 ON concur_reindex_tab(c1, c1, c2); +-- Create table for check on foreign key dependence switch with indexes swapped +ALTER TABLE concur_reindex_tab ADD PRIMARY KEY USING INDEX concur_reindex_ind1; +CREATE TABLE concur_reindex_tab2 (c1 int REFERENCES concur_reindex_tab); +INSERT INTO concur_reindex_tab VALUES (1, 'a'); +INSERT INTO concur_reindex_tab VALUES (2, 'a'); +-- Reindex concurrently of exclusion constraint currently not supported +CREATE TABLE concur_reindex_tab3 (c1 int, c2 int4range, EXCLUDE USING gist (c2 WITH &&)); +INSERT INTO concur_reindex_tab3 VALUES (3, '[1,2]'); +REINDEX INDEX CONCURRENTLY concur_reindex_tab3_c2_excl; -- error +REINDEX TABLE CONCURRENTLY concur_reindex_tab3; -- succeeds with warning +INSERT INTO concur_reindex_tab3 VALUES (4, '[2,4]'); +-- Check materialized views +CREATE MATERIALIZED VIEW concur_reindex_matview AS SELECT * FROM concur_reindex_tab; +-- Dependency lookup before and after the follow-up REINDEX commands. +-- These should remain consistent. +SELECT pg_describe_object(classid, objid, objsubid) as obj, + pg_describe_object(refclassid,refobjid,refobjsubid) as objref, + deptype +FROM pg_depend +WHERE classid = 'pg_class'::regclass AND + objid in ('concur_reindex_tab'::regclass, + 'concur_reindex_ind1'::regclass, + 'concur_reindex_ind2'::regclass, + 'concur_reindex_ind3'::regclass, + 'concur_reindex_ind4'::regclass, + 'concur_reindex_matview'::regclass) + ORDER BY 1, 2; +REINDEX INDEX CONCURRENTLY concur_reindex_ind1; +REINDEX TABLE CONCURRENTLY concur_reindex_tab; +REINDEX TABLE CONCURRENTLY concur_reindex_matview; +SELECT pg_describe_object(classid, objid, objsubid) as obj, + pg_describe_object(refclassid,refobjid,refobjsubid) as objref, + deptype +FROM pg_depend +WHERE classid = 'pg_class'::regclass AND + objid in ('concur_reindex_tab'::regclass, + 'concur_reindex_ind1'::regclass, + 'concur_reindex_ind2'::regclass, + 'concur_reindex_ind3'::regclass, + 'concur_reindex_ind4'::regclass, + 'concur_reindex_matview'::regclass) + ORDER BY 1, 2; +-- Check that comments are preserved +CREATE TABLE testcomment (i int); +CREATE INDEX testcomment_idx1 ON testcomment (i); +COMMENT ON INDEX testcomment_idx1 IS 'test comment'; +SELECT obj_description('testcomment_idx1'::regclass, 'pg_class'); +REINDEX TABLE testcomment; +SELECT obj_description('testcomment_idx1'::regclass, 'pg_class'); +REINDEX TABLE CONCURRENTLY testcomment ; +SELECT obj_description('testcomment_idx1'::regclass, 'pg_class'); +DROP TABLE testcomment; +-- Check that indisclustered updates are preserved +CREATE TABLE concur_clustered(i int); +CREATE INDEX concur_clustered_i_idx ON concur_clustered(i); +ALTER TABLE concur_clustered CLUSTER ON concur_clustered_i_idx; +REINDEX TABLE CONCURRENTLY concur_clustered; +SELECT indexrelid::regclass, indisclustered FROM pg_index + WHERE indrelid = 'concur_clustered'::regclass; +DROP TABLE concur_clustered; +-- Check that indisreplident updates are preserved. +CREATE TABLE concur_replident(i int NOT NULL); +CREATE UNIQUE INDEX concur_replident_i_idx ON concur_replident(i); +ALTER TABLE concur_replident REPLICA IDENTITY + USING INDEX concur_replident_i_idx; +SELECT indexrelid::regclass, indisreplident FROM pg_index + WHERE indrelid = 'concur_replident'::regclass; +REINDEX TABLE CONCURRENTLY concur_replident; +SELECT indexrelid::regclass, indisreplident FROM pg_index + WHERE indrelid = 'concur_replident'::regclass; +DROP TABLE concur_replident; + +-- Partitions +-- Create some partitioned tables +CREATE TABLE concur_reindex_part (c1 int, c2 int) PARTITION BY RANGE (c1); +CREATE TABLE concur_reindex_part_0 PARTITION OF concur_reindex_part + FOR VALUES FROM (0) TO (10) PARTITION BY list (c2); +CREATE TABLE concur_reindex_part_0_1 PARTITION OF concur_reindex_part_0 + FOR VALUES IN (1); +CREATE TABLE concur_reindex_part_0_2 PARTITION OF concur_reindex_part_0 + FOR VALUES IN (2); +-- This partitioned table will have no partitions. +CREATE TABLE concur_reindex_part_10 PARTITION OF concur_reindex_part + FOR VALUES FROM (10) TO (20) PARTITION BY list (c2); +-- Create some partitioned indexes +CREATE INDEX concur_reindex_part_index ON ONLY concur_reindex_part (c1); +CREATE INDEX concur_reindex_part_index_0 ON ONLY concur_reindex_part_0 (c1); +ALTER INDEX concur_reindex_part_index ATTACH PARTITION concur_reindex_part_index_0; +-- This partitioned index will have no partitions. +CREATE INDEX concur_reindex_part_index_10 ON ONLY concur_reindex_part_10 (c1); +ALTER INDEX concur_reindex_part_index ATTACH PARTITION concur_reindex_part_index_10; +CREATE INDEX concur_reindex_part_index_0_1 ON ONLY concur_reindex_part_0_1 (c1); +ALTER INDEX concur_reindex_part_index_0 ATTACH PARTITION concur_reindex_part_index_0_1; +CREATE INDEX concur_reindex_part_index_0_2 ON ONLY concur_reindex_part_0_2 (c1); +ALTER INDEX concur_reindex_part_index_0 ATTACH PARTITION concur_reindex_part_index_0_2; +SELECT relid, parentrelid, level FROM pg_partition_tree('concur_reindex_part_index') + ORDER BY relid, level; +-- REINDEX fails for partitioned indexes +REINDEX INDEX concur_reindex_part_index_10; +REINDEX INDEX CONCURRENTLY concur_reindex_part_index_10; +-- REINDEX is a no-op for partitioned tables +REINDEX TABLE concur_reindex_part_10; +REINDEX TABLE CONCURRENTLY concur_reindex_part_10; +SELECT relid, parentrelid, level FROM pg_partition_tree('concur_reindex_part_index') + ORDER BY relid, level; +-- REINDEX should preserve dependencies of partition tree. +SELECT pg_describe_object(classid, objid, objsubid) as obj, + pg_describe_object(refclassid,refobjid,refobjsubid) as objref, + deptype +FROM pg_depend +WHERE classid = 'pg_class'::regclass AND + objid in ('concur_reindex_part'::regclass, + 'concur_reindex_part_0'::regclass, + 'concur_reindex_part_0_1'::regclass, + 'concur_reindex_part_0_2'::regclass, + 'concur_reindex_part_index'::regclass, + 'concur_reindex_part_index_0'::regclass, + 'concur_reindex_part_index_0_1'::regclass, + 'concur_reindex_part_index_0_2'::regclass) + ORDER BY 1, 2; +REINDEX INDEX CONCURRENTLY concur_reindex_part_index_0_1; +REINDEX INDEX CONCURRENTLY concur_reindex_part_index_0_2; +SELECT relid, parentrelid, level FROM pg_partition_tree('concur_reindex_part_index') + ORDER BY relid, level; +REINDEX TABLE CONCURRENTLY concur_reindex_part_0_1; +REINDEX TABLE CONCURRENTLY concur_reindex_part_0_2; +SELECT pg_describe_object(classid, objid, objsubid) as obj, + pg_describe_object(refclassid,refobjid,refobjsubid) as objref, + deptype +FROM pg_depend +WHERE classid = 'pg_class'::regclass AND + objid in ('concur_reindex_part'::regclass, + 'concur_reindex_part_0'::regclass, + 'concur_reindex_part_0_1'::regclass, + 'concur_reindex_part_0_2'::regclass, + 'concur_reindex_part_index'::regclass, + 'concur_reindex_part_index_0'::regclass, + 'concur_reindex_part_index_0_1'::regclass, + 'concur_reindex_part_index_0_2'::regclass) + ORDER BY 1, 2; +SELECT relid, parentrelid, level FROM pg_partition_tree('concur_reindex_part_index') + ORDER BY relid, level; +DROP TABLE concur_reindex_part; + +-- Check errors +-- Cannot run inside a transaction block +BEGIN; +REINDEX TABLE CONCURRENTLY concur_reindex_tab; +COMMIT; +REINDEX TABLE CONCURRENTLY pg_class; -- no catalog relation +REINDEX INDEX CONCURRENTLY pg_class_oid_index; -- no catalog index +-- These are the toast table and index of pg_authid. +REINDEX TABLE CONCURRENTLY pg_toast.pg_toast_1260; -- no catalog toast table +REINDEX INDEX CONCURRENTLY pg_toast.pg_toast_1260_index; -- no catalog toast index +REINDEX SYSTEM CONCURRENTLY postgres; -- not allowed for SYSTEM +-- Warns about catalog relations +REINDEX SCHEMA CONCURRENTLY pg_catalog; + +-- Check the relation status, there should not be invalid indexes +\d concur_reindex_tab +DROP MATERIALIZED VIEW concur_reindex_matview; +DROP TABLE concur_reindex_tab, concur_reindex_tab2, concur_reindex_tab3; + +-- Check handling of invalid indexes +CREATE TABLE concur_reindex_tab4 (c1 int); +INSERT INTO concur_reindex_tab4 VALUES (1), (1), (2); +-- This trick creates an invalid index. +CREATE UNIQUE INDEX CONCURRENTLY concur_reindex_ind5 ON concur_reindex_tab4 (c1); +-- Reindexing concurrently this index fails with the same failure. +-- The extra index created is itself invalid, and can be dropped. +REINDEX INDEX CONCURRENTLY concur_reindex_ind5; +\d concur_reindex_tab4 +DROP INDEX concur_reindex_ind5_ccnew; +-- This makes the previous failure go away, so the index can become valid. +DELETE FROM concur_reindex_tab4 WHERE c1 = 1; +-- The invalid index is not processed when running REINDEX TABLE. +REINDEX TABLE CONCURRENTLY concur_reindex_tab4; +\d concur_reindex_tab4 +-- But it is fixed with REINDEX INDEX. +REINDEX INDEX CONCURRENTLY concur_reindex_ind5; +\d concur_reindex_tab4 +DROP TABLE concur_reindex_tab4; + +-- Check handling of indexes with expressions and predicates. The +-- definitions of the rebuilt indexes should match the original +-- definitions. +CREATE TABLE concur_exprs_tab (c1 int , c2 boolean); +INSERT INTO concur_exprs_tab (c1, c2) VALUES (1369652450, FALSE), + (414515746, TRUE), + (897778963, FALSE); +CREATE UNIQUE INDEX concur_exprs_index_expr + ON concur_exprs_tab ((c1::text COLLATE "C")); +CREATE UNIQUE INDEX concur_exprs_index_pred ON concur_exprs_tab (c1) + WHERE (c1::text > 500000000::text COLLATE "C"); +CREATE UNIQUE INDEX concur_exprs_index_pred_2 + ON concur_exprs_tab ((1 / c1)) + WHERE ('-H') >= (c2::TEXT) COLLATE "C"; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); +REINDEX TABLE CONCURRENTLY concur_exprs_tab; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); +-- ALTER TABLE recreates the indexes, which should keep their collations. +ALTER TABLE concur_exprs_tab ALTER c2 TYPE TEXT; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); +DROP TABLE concur_exprs_tab; + +-- Temporary tables and on-commit actions, where CONCURRENTLY is ignored. +-- ON COMMIT PRESERVE ROWS, the default. +CREATE TEMP TABLE concur_temp_tab_1 (c1 int, c2 text) + ON COMMIT PRESERVE ROWS; +INSERT INTO concur_temp_tab_1 VALUES (1, 'foo'), (2, 'bar'); +CREATE INDEX concur_temp_ind_1 ON concur_temp_tab_1(c2); +REINDEX TABLE CONCURRENTLY concur_temp_tab_1; +REINDEX INDEX CONCURRENTLY concur_temp_ind_1; +-- Still fails in transaction blocks +BEGIN; +REINDEX INDEX CONCURRENTLY concur_temp_ind_1; +COMMIT; +-- ON COMMIT DELETE ROWS +CREATE TEMP TABLE concur_temp_tab_2 (c1 int, c2 text) + ON COMMIT DELETE ROWS; +CREATE INDEX concur_temp_ind_2 ON concur_temp_tab_2(c2); +REINDEX TABLE CONCURRENTLY concur_temp_tab_2; +REINDEX INDEX CONCURRENTLY concur_temp_ind_2; +-- ON COMMIT DROP +BEGIN; +CREATE TEMP TABLE concur_temp_tab_3 (c1 int, c2 text) + ON COMMIT PRESERVE ROWS; +INSERT INTO concur_temp_tab_3 VALUES (1, 'foo'), (2, 'bar'); +CREATE INDEX concur_temp_ind_3 ON concur_temp_tab_3(c2); +-- Fails when running in a transaction +REINDEX INDEX CONCURRENTLY concur_temp_ind_3; +COMMIT; +-- REINDEX SCHEMA processes all temporary relations +CREATE TABLE reindex_temp_before AS +SELECT oid, relname, relfilenode, relkind, reltoastrelid + FROM pg_class + WHERE relname IN ('concur_temp_ind_1', 'concur_temp_ind_2'); + + +SELECT b.relname, + b.relkind, + CASE WHEN a.relfilenode = b.relfilenode THEN 'relfilenode is unchanged' + ELSE 'relfilenode has changed' END + FROM reindex_temp_before b JOIN pg_class a ON b.oid = a.oid + ORDER BY 1; +DROP TABLE concur_temp_tab_1, concur_temp_tab_2, reindex_temp_before; + +-- +-- REINDEX SCHEMA +-- +REINDEX SCHEMA schema_to_reindex; -- failure, schema does not exist +CREATE SCHEMA schema_to_reindex; +SET search_path = 'schema_to_reindex'; +CREATE TABLE table1(col1 SERIAL PRIMARY KEY); +INSERT INTO table1 SELECT generate_series(1,400); +CREATE TABLE table2(col1 SERIAL PRIMARY KEY, col2 TEXT NOT NULL); +INSERT INTO table2 SELECT generate_series(1,400), 'abc'; +CREATE INDEX ON table2(col2); +CREATE MATERIALIZED VIEW matview AS SELECT col1 FROM table2; +CREATE INDEX ON matview(col1); +CREATE VIEW view AS SELECT col2 FROM table2; +CREATE TABLE reindex_before AS +SELECT oid, relname, relfilenode, relkind, reltoastrelid + FROM pg_class + where relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'schema_to_reindex'); +INSERT INTO reindex_before +SELECT oid, 'pg_toast_TABLE', relfilenode, relkind, reltoastrelid +FROM pg_class WHERE oid IN + (SELECT reltoastrelid FROM reindex_before WHERE reltoastrelid > 0); +INSERT INTO reindex_before +SELECT oid, 'pg_toast_TABLE_index', relfilenode, relkind, reltoastrelid +FROM pg_class where oid in + (select indexrelid from pg_index where indrelid in + (select reltoastrelid from reindex_before where reltoastrelid > 0)); +REINDEX SCHEMA schema_to_reindex; +CREATE TABLE reindex_after AS SELECT oid, relname, relfilenode, relkind + FROM pg_class + where relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'schema_to_reindex'); +SELECT b.relname, + b.relkind, + CASE WHEN a.relfilenode = b.relfilenode THEN 'relfilenode is unchanged' + ELSE 'relfilenode has changed' END + FROM reindex_before b JOIN pg_class a ON b.oid = a.oid + ORDER BY 1; +REINDEX SCHEMA schema_to_reindex; +BEGIN; +REINDEX SCHEMA schema_to_reindex; -- failure, cannot run in a transaction +END; + +-- concurrently +REINDEX SCHEMA CONCURRENTLY schema_to_reindex; + +-- Failure for unauthorized user +CREATE ROLE regress_reindexuser NOLOGIN; +SET SESSION ROLE regress_reindexuser; +REINDEX SCHEMA schema_to_reindex; +-- Permission failures with toast tables and indexes (pg_authid here) +RESET ROLE; +GRANT USAGE ON SCHEMA pg_toast TO regress_reindexuser; +SET SESSION ROLE regress_reindexuser; +REINDEX TABLE pg_toast.pg_toast_1260; +REINDEX INDEX pg_toast.pg_toast_1260_index; + +-- Clean up +RESET ROLE; +REVOKE USAGE ON SCHEMA pg_toast FROM regress_reindexuser; +DROP ROLE regress_reindexuser; +DROP SCHEMA schema_to_reindex CASCADE; +SELECT count(*) FROM point_tbl p WHERE p.f1 << '(0.0, 0.0)'; + +SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; + +SELECT count(*) FROM point_tbl p WHERE p.f1 << '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 << '(0.0, 0.0)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; +SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; + diff --git a/postgresql/examples/create_index_spgist.sql b/postgresql/examples/create_index_spgist.sql new file mode 100644 index 0000000..688e31f --- /dev/null +++ b/postgresql/examples/create_index_spgist.sql @@ -0,0 +1,422 @@ +-- +-- SP-GiST index tests +-- + +CREATE TABLE quad_point_tbl AS + SELECT point(unique1,unique2) AS p FROM tenk1; + +INSERT INTO quad_point_tbl + SELECT '(333.0,400.0)'::point FROM generate_series(1,1000); + +INSERT INTO quad_point_tbl VALUES (NULL), (NULL), (NULL); + +CREATE INDEX sp_quad_ind ON quad_point_tbl USING spgist (p); + +CREATE TABLE kd_point_tbl AS SELECT * FROM quad_point_tbl; + +CREATE INDEX sp_kd_ind ON kd_point_tbl USING spgist (p kd_point_ops); + +CREATE TABLE radix_text_tbl AS + SELECT name AS t FROM road WHERE name !~ '^[0-9]'; + +INSERT INTO radix_text_tbl + SELECT 'P0123456789abcdef' FROM generate_series(1,1000); +INSERT INTO radix_text_tbl VALUES ('P0123456789abcde'); +INSERT INTO radix_text_tbl VALUES ('P0123456789abcdefF'); + +CREATE INDEX sp_radix_ind ON radix_text_tbl USING spgist (t); + +-- get non-indexed results for comparison purposes + +SET enable_seqscan = ON; +SET enable_indexscan = OFF; +SET enable_bitmapscan = OFF; + +SELECT count(*) FROM quad_point_tbl WHERE p IS NULL; + +SELECT count(*) FROM quad_point_tbl WHERE p IS NOT NULL; + +SELECT count(*) FROM quad_point_tbl; + +SELECT count(*) FROM quad_point_tbl WHERE p <@ box '(200,200,1000,1000)'; + +SELECT count(*) FROM quad_point_tbl WHERE box '(200,200,1000,1000)' @> p; + + +SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; + +SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; + +SELECT count(*) FROM quad_point_tbl WHERE p ~= '(4585, 365)'; + +CREATE TEMP TABLE quad_point_tbl_ord_seq1 AS +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM quad_point_tbl; + +CREATE TEMP TABLE quad_point_tbl_ord_seq2 AS +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM quad_point_tbl WHERE p <@ box '(200,200,1000,1000)'; + +CREATE TEMP TABLE quad_point_tbl_ord_seq3 AS +SELECT row_number() OVER (ORDER BY p <-> '333,400') n, p <-> '333,400' dist, p +FROM quad_point_tbl WHERE p IS NOT NULL; + +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdef'; + +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcde'; + +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdefF'; + +SELECT count(*) FROM radix_text_tbl WHERE t < 'Aztec Ct '; + +SELECT count(*) FROM radix_text_tbl WHERE t ~<~ 'Aztec Ct '; + +SELECT count(*) FROM radix_text_tbl WHERE t <= 'Aztec Ct '; + +SELECT count(*) FROM radix_text_tbl WHERE t ~<=~ 'Aztec Ct '; + +SELECT count(*) FROM radix_text_tbl WHERE t = 'Aztec Ct '; + +SELECT count(*) FROM radix_text_tbl WHERE t = 'Worth St '; + +SELECT count(*) FROM radix_text_tbl WHERE t >= 'Worth St '; + +SELECT count(*) FROM radix_text_tbl WHERE t ~>=~ 'Worth St '; + +SELECT count(*) FROM radix_text_tbl WHERE t > 'Worth St '; + +SELECT count(*) FROM radix_text_tbl WHERE t ~>~ 'Worth St '; + +SELECT count(*) FROM radix_text_tbl WHERE t ^@ 'Worth'; + +-- Now check the results from plain indexscan +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = OFF; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p IS NULL; +SELECT count(*) FROM quad_point_tbl WHERE p IS NULL; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p IS NOT NULL; +SELECT count(*) FROM quad_point_tbl WHERE p IS NOT NULL; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl; +SELECT count(*) FROM quad_point_tbl; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p <@ box '(200,200,1000,1000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <@ box '(200,200,1000,1000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE box '(200,200,1000,1000)' @> p; +SELECT count(*) FROM quad_point_tbl WHERE box '(200,200,1000,1000)' @> p; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p ~= '(4585, 365)'; +SELECT count(*) FROM quad_point_tbl WHERE p ~= '(4585, 365)'; + +EXPLAIN (COSTS OFF) +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM quad_point_tbl; +CREATE TEMP TABLE quad_point_tbl_ord_idx1 AS +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM quad_point_tbl; +SELECT * FROM quad_point_tbl_ord_seq1 seq FULL JOIN quad_point_tbl_ord_idx1 idx +ON seq.n = idx.n +WHERE seq.dist IS DISTINCT FROM idx.dist; + +EXPLAIN (COSTS OFF) +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM quad_point_tbl WHERE p <@ box '(200,200,1000,1000)'; +CREATE TEMP TABLE quad_point_tbl_ord_idx2 AS +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM quad_point_tbl WHERE p <@ box '(200,200,1000,1000)'; +SELECT * FROM quad_point_tbl_ord_seq2 seq FULL JOIN quad_point_tbl_ord_idx2 idx +ON seq.n = idx.n +WHERE seq.dist IS DISTINCT FROM idx.dist; + +EXPLAIN (COSTS OFF) +SELECT row_number() OVER (ORDER BY p <-> '333,400') n, p <-> '333,400' dist, p +FROM quad_point_tbl WHERE p IS NOT NULL; +CREATE TEMP TABLE quad_point_tbl_ord_idx3 AS +SELECT row_number() OVER (ORDER BY p <-> '333,400') n, p <-> '333,400' dist, p +FROM quad_point_tbl WHERE p IS NOT NULL; +SELECT * FROM quad_point_tbl_ord_seq3 seq FULL JOIN quad_point_tbl_ord_idx3 idx +ON seq.n = idx.n +WHERE seq.dist IS DISTINCT FROM idx.dist; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p <@ box '(200,200,1000,1000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <@ box '(200,200,1000,1000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE box '(200,200,1000,1000)' @> p; +SELECT count(*) FROM kd_point_tbl WHERE box '(200,200,1000,1000)' @> p; + + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p ~= '(4585, 365)'; +SELECT count(*) FROM kd_point_tbl WHERE p ~= '(4585, 365)'; + +EXPLAIN (COSTS OFF) +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM kd_point_tbl; +CREATE TEMP TABLE kd_point_tbl_ord_idx1 AS +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM kd_point_tbl; +SELECT * FROM quad_point_tbl_ord_seq1 seq FULL JOIN kd_point_tbl_ord_idx1 idx +ON seq.n = idx.n +WHERE seq.dist IS DISTINCT FROM idx.dist; + +EXPLAIN (COSTS OFF) +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM kd_point_tbl WHERE p <@ box '(200,200,1000,1000)'; +CREATE TEMP TABLE kd_point_tbl_ord_idx2 AS +SELECT row_number() OVER (ORDER BY p <-> '0,0') n, p <-> '0,0' dist, p +FROM kd_point_tbl WHERE p <@ box '(200,200,1000,1000)'; +SELECT * FROM quad_point_tbl_ord_seq2 seq FULL JOIN kd_point_tbl_ord_idx2 idx +ON seq.n = idx.n +WHERE seq.dist IS DISTINCT FROM idx.dist; + +EXPLAIN (COSTS OFF) +SELECT row_number() OVER (ORDER BY p <-> '333,400') n, p <-> '333,400' dist, p +FROM kd_point_tbl WHERE p IS NOT NULL; +CREATE TEMP TABLE kd_point_tbl_ord_idx3 AS +SELECT row_number() OVER (ORDER BY p <-> '333,400') n, p <-> '333,400' dist, p +FROM kd_point_tbl WHERE p IS NOT NULL; +SELECT * FROM quad_point_tbl_ord_seq3 seq FULL JOIN kd_point_tbl_ord_idx3 idx +ON seq.n = idx.n +WHERE seq.dist IS DISTINCT FROM idx.dist; + +-- check ORDER BY distance to NULL +SELECT (SELECT p FROM kd_point_tbl ORDER BY p <-> pt, p <-> '0,0' LIMIT 1) +FROM (VALUES (point '1,2'), (NULL), ('1234,5678')) pts(pt); + + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdef'; +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdef'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcde'; +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcde'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdefF'; +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdefF'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t < 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t < 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ~<~ 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t ~<~ 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t <= 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t <= 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ~<=~ 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t ~<=~ 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t = 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t = 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t >= 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t >= 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ~>=~ 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t ~>=~ 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t > 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t > 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ~>~ 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t ~>~ 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ^@ 'Worth'; +SELECT count(*) FROM radix_text_tbl WHERE t ^@ 'Worth'; + +-- Now check the results from bitmap indexscan +SET enable_seqscan = OFF; +SET enable_indexscan = OFF; +SET enable_bitmapscan = ON; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p IS NULL; +SELECT count(*) FROM quad_point_tbl WHERE p IS NULL; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p IS NOT NULL; +SELECT count(*) FROM quad_point_tbl WHERE p IS NOT NULL; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl; +SELECT count(*) FROM quad_point_tbl; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p <@ box '(200,200,1000,1000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <@ box '(200,200,1000,1000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE box '(200,200,1000,1000)' @> p; +SELECT count(*) FROM quad_point_tbl WHERE box '(200,200,1000,1000)' @> p; + + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p <^ '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p >^ '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p ~= '(4585, 365)'; +SELECT count(*) FROM quad_point_tbl WHERE p ~= '(4585, 365)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p <@ box '(200,200,1000,1000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <@ box '(200,200,1000,1000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE box '(200,200,1000,1000)' @> p; +SELECT count(*) FROM kd_point_tbl WHERE box '(200,200,1000,1000)' @> p; + + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p <^ '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p >^ '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p ~= '(4585, 365)'; +SELECT count(*) FROM kd_point_tbl WHERE p ~= '(4585, 365)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdef'; +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdef'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcde'; +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcde'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdefF'; +SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdefF'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t < 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t < 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ~<~ 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t ~<~ 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t <= 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t <= 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ~<=~ 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t ~<=~ 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'Aztec Ct '; +SELECT count(*) FROM radix_text_tbl WHERE t = 'Aztec Ct '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t = 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t = 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t >= 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t >= 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ~>=~ 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t ~>=~ 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t > 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t > 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ~>~ 'Worth St '; +SELECT count(*) FROM radix_text_tbl WHERE t ~>~ 'Worth St '; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM radix_text_tbl WHERE t ^@ 'Worth'; +SELECT count(*) FROM radix_text_tbl WHERE t ^@ 'Worth'; + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; +SELECT count(*) FROM quad_point_tbl WHERE p << '(5000, 4000)'; + +SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p << '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p << '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; + + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p << '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p << '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p << '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p << '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; +SELECT count(*) FROM quad_point_tbl WHERE p >> '(5000, 4000)'; +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p << '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p << '(5000, 4000)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; +SELECT count(*) FROM kd_point_tbl WHERE p >> '(5000, 4000)'; diff --git a/postgresql/examples/create_misc.sql b/postgresql/examples/create_misc.sql new file mode 100644 index 0000000..d0b04a8 --- /dev/null +++ b/postgresql/examples/create_misc.sql @@ -0,0 +1,217 @@ +-- +-- CREATE_MISC +-- + +-- CLASS POPULATION +-- (any resemblance to real life is purely coincidental) +-- + +INSERT INTO tenk2 SELECT * FROM tenk1; + +SELECT * INTO TABLE onek2 FROM onek; + +INSERT INTO fast_emp4000 SELECT * FROM slow_emp4000; + +SELECT * + INTO TABLE Bprime + FROM tenk1 + WHERE unique2 < 1000; + +INSERT INTO hobbies_r (name, person) + SELECT 'posthacking', p.name + FROM person* p + WHERE p.name = 'mike' or p.name = 'jeff'; + +INSERT INTO hobbies_r (name, person) + SELECT 'basketball', p.name + FROM person p + WHERE p.name = 'joe' or p.name = 'sally'; + +INSERT INTO hobbies_r (name) VALUES ('skywalking'); + +INSERT INTO equipment_r (name, hobby) VALUES ('advil', 'posthacking'); + +INSERT INTO equipment_r (name, hobby) VALUES ('peet''s coffee', 'posthacking'); + +INSERT INTO equipment_r (name, hobby) VALUES ('hightops', 'basketball'); + +INSERT INTO equipment_r (name, hobby) VALUES ('guts', 'skywalking'); + +INSERT INTO city VALUES +('Podunk', '(1,2),(3,4)', '100,127,1000'), +('Gotham', '(1000,34),(1100,334)', '123456,127,-1000,6789'); +TABLE city; + +SELECT * + INTO TABLE ramp + FROM road + WHERE name ~ '.*Ramp'; + +INSERT INTO ihighway + SELECT * + FROM road + WHERE name ~ 'I- .*'; + +INSERT INTO shighway + SELECT * + FROM road + WHERE name ~ 'State Hwy.*'; + +UPDATE shighway + SET surface = 'asphalt'; + +INSERT INTO a_star (class, a) VALUES ('a', 1); + +INSERT INTO a_star (class, a) VALUES ('a', 2); + +INSERT INTO a_star (class) VALUES ('a'); + +INSERT INTO b_star (class, a, b) VALUES ('b', 3, 'mumble'::text); + +INSERT INTO b_star (class, a) VALUES ('b', 4); + +INSERT INTO b_star (class, b) VALUES ('b', 'bumble'::text); + +INSERT INTO b_star (class) VALUES ('b'); + +INSERT INTO c_star (class, a, c) VALUES ('c', 5, 'hi mom'::name); + +INSERT INTO c_star (class, a) VALUES ('c', 6); + +INSERT INTO c_star (class, c) VALUES ('c', 'hi paul'::name); + +INSERT INTO c_star (class) VALUES ('c'); + +INSERT INTO d_star (class, a, b, c, d) + VALUES ('d', 7, 'grumble'::text, 'hi sunita'::name, '0.0'::float8); + +INSERT INTO d_star (class, a, b, c) + VALUES ('d', 8, 'stumble'::text, 'hi koko'::name); + +INSERT INTO d_star (class, a, b, d) + VALUES ('d', 9, 'rumble'::text, '1.1'::float8); + +INSERT INTO d_star (class, a, c, d) + VALUES ('d', 10, 'hi kristin'::name, '10.01'::float8); + +INSERT INTO d_star (class, b, c, d) + VALUES ('d', 'crumble'::text, 'hi boris'::name, '100.001'::float8); + +INSERT INTO d_star (class, a, b) + VALUES ('d', 11, 'fumble'::text); + +INSERT INTO d_star (class, a, c) + VALUES ('d', 12, 'hi avi'::name); + +INSERT INTO d_star (class, a, d) + VALUES ('d', 13, '1000.0001'::float8); + +INSERT INTO d_star (class, b, c) + VALUES ('d', 'tumble'::text, 'hi andrew'::name); + +INSERT INTO d_star (class, b, d) + VALUES ('d', 'humble'::text, '10000.00001'::float8); + +INSERT INTO d_star (class, c, d) + VALUES ('d', 'hi ginger'::name, '100000.000001'::float8); + +INSERT INTO d_star (class, a) VALUES ('d', 14); + +INSERT INTO d_star (class, b) VALUES ('d', 'jumble'::text); + +INSERT INTO d_star (class, c) VALUES ('d', 'hi jolly'::name); + +INSERT INTO d_star (class, d) VALUES ('d', '1000000.0000001'::float8); + +INSERT INTO d_star (class) VALUES ('d'); + +INSERT INTO e_star (class, a, c, e) + VALUES ('e', 15, 'hi carol'::name, '-1'::int2); + +INSERT INTO e_star (class, a, c) + VALUES ('e', 16, 'hi bob'::name); + +INSERT INTO e_star (class, a, e) + VALUES ('e', 17, '-2'::int2); + +INSERT INTO e_star (class, c, e) + VALUES ('e', 'hi michelle'::name, '-3'::int2); + +INSERT INTO e_star (class, a) + VALUES ('e', 18); + +INSERT INTO e_star (class, c) + VALUES ('e', 'hi elisa'::name); + +INSERT INTO e_star (class, e) + VALUES ('e', '-4'::int2); + +INSERT INTO f_star (class, a, c, e, f) + VALUES ('f', 19, 'hi claire'::name, '-5'::int2, '(1,3),(2,4)'::polygon); + +INSERT INTO f_star (class, a, c, e) + VALUES ('f', 20, 'hi mike'::name, '-6'::int2); + +INSERT INTO f_star (class, a, c, f) + VALUES ('f', 21, 'hi marcel'::name, '(11,44),(22,55),(33,66)'::polygon); + +INSERT INTO f_star (class, a, e, f) + VALUES ('f', 22, '-7'::int2, '(111,555),(222,666),(333,777),(444,888)'::polygon); + +INSERT INTO f_star (class, c, e, f) + VALUES ('f', 'hi keith'::name, '-8'::int2, + '(1111,3333),(2222,4444)'::polygon); + +INSERT INTO f_star (class, a, c) + VALUES ('f', 24, 'hi marc'::name); + +INSERT INTO f_star (class, a, e) + VALUES ('f', 25, '-9'::int2); + +INSERT INTO f_star (class, a, f) + VALUES ('f', 26, '(11111,33333),(22222,44444)'::polygon); + +INSERT INTO f_star (class, c, e) + VALUES ('f', 'hi allison'::name, '-10'::int2); + +INSERT INTO f_star (class, c, f) + VALUES ('f', 'hi jeff'::name, + '(111111,333333),(222222,444444)'::polygon); + +INSERT INTO f_star (class, e, f) + VALUES ('f', '-11'::int2, '(1111111,3333333),(2222222,4444444)'::polygon); + +INSERT INTO f_star (class, a) VALUES ('f', 27); + +INSERT INTO f_star (class, c) VALUES ('f', 'hi carl'::name); + +INSERT INTO f_star (class, e) VALUES ('f', '-12'::int2); + +INSERT INTO f_star (class, f) + VALUES ('f', '(11111111,33333333),(22222222,44444444)'::polygon); + +INSERT INTO f_star (class) VALUES ('f'); + +-- Analyze the X_star tables for better plan stability in later tests +ANALYZE a_star; +ANALYZE b_star; +ANALYZE c_star; +ANALYZE d_star; +ANALYZE e_star; +ANALYZE f_star; + + +-- +-- for internal portal (cursor) tests +-- +CREATE TABLE iportaltest ( + i int4, + d float4, + p polygon +); + +INSERT INTO iportaltest (i, d, p) + VALUES (1, 3.567, '(3.0,1.0),(4.0,2.0)'::polygon); + +INSERT INTO iportaltest (i, d, p) + VALUES (2, 89.05, '(4.0,2.0),(3.0,1.0)'::polygon); diff --git a/postgresql/examples/create_operator.sql b/postgresql/examples/create_operator.sql new file mode 100644 index 0000000..b273f38 --- /dev/null +++ b/postgresql/examples/create_operator.sql @@ -0,0 +1,230 @@ +-- +-- CREATE_OPERATOR +-- + +CREATE OPERATOR ## ( + leftarg = path, + rightarg = path, + function = path_inter, + commutator = ## +); + +CREATE OPERATOR <% ( + leftarg = point, + rightarg = widget, + procedure = pt_in_widget, + commutator = >% , + negator = >=% +); + +CREATE OPERATOR @#@ ( + rightarg = int8, -- left unary + procedure = numeric_fac +); + +CREATE OPERATOR #@# ( + leftarg = int8, -- right unary + procedure = numeric_fac +); + +CREATE OPERATOR #%# ( + leftarg = int8, -- right unary + procedure = numeric_fac +); + +-- Test operator created above +SELECT point '(1,2)' <% widget '(0,0,3)' AS t, + point '(1,2)' <% widget '(0,0,1)' AS f; + +-- Test comments +COMMENT ON OPERATOR ###### (int4, NONE) IS 'bad right unary'; + +-- => is disallowed now +--CREATE OPERATOR => ( +-- leftarg = int8, -- right unary +-- procedure = numeric_fac +--); + +-- lexing of <=, >=, <>, != has a number of edge cases +-- (=> is tested elsewhere) + +-- this is legal because ! is not allowed in sql ops +CREATE OPERATOR !=- ( + leftarg = int8, -- right unary + procedure = numeric_fac +); +SELECT 2 !=-; +-- make sure lexer returns != as <> even in edge cases +SELECT 2 !=/**/ 1, 2 !=/**/ 2; +DO $$ -- use DO to protect -- from psql + declare r boolean; + begin + execute $e$ select 2 !=-- comment + 1 $e$ into r; + raise info 'r = %', r; + end; +$$; + +-- check that <= etc. followed by more operator characters are returned +-- as the correct token with correct precedence +SELECT true<>-1 BETWEEN 1 AND 1; -- BETWEEN has prec. above <> but below Op +SELECT false<>/**/1 BETWEEN 1 AND 1; +SELECT false<=-1 BETWEEN 1 AND 1; +SELECT false>=-1 BETWEEN 1 AND 1; +SELECT 2<=/**/3, 3>=/**/2, 2<>/**/3; +SELECT 3<=/**/2, 2>=/**/3, 2<>/**/2; + +-- Should fail. CREATE OPERATOR requires USAGE on SCHEMA +BEGIN TRANSACTION; +CREATE ROLE regress_rol_op1; +CREATE SCHEMA schema_op1; +GRANT USAGE ON SCHEMA schema_op1 TO PUBLIC; +REVOKE USAGE ON SCHEMA schema_op1 FROM regress_rol_op1; +SET ROLE regress_rol_op1; +CREATE OPERATOR schema_op1.#*# ( + leftarg = int8, -- right unary + procedure = numeric_fac +); +ROLLBACK; + + +-- Should fail. SETOF type functions not allowed as argument (testing leftarg) +BEGIN TRANSACTION; +CREATE OPERATOR #*# ( + leftarg = SETOF int8, + procedure = numeric_fac +); +ROLLBACK; + + +-- Should fail. SETOF type functions not allowed as argument (testing rightarg) +BEGIN TRANSACTION; +CREATE OPERATOR #*# ( + rightarg = SETOF int8, + procedure = numeric_fac +); +ROLLBACK; + + +-- Should work. Sample text-book case +BEGIN TRANSACTION; +CREATE OR REPLACE FUNCTION fn_op2(boolean, boolean) +RETURNS boolean AS $$ + SELECT NULL::BOOLEAN; +$$ LANGUAGE sql IMMUTABLE; +CREATE OPERATOR === ( + LEFTARG = boolean, + RIGHTARG = boolean, + PROCEDURE = fn_op2, + COMMUTATOR = ===, + NEGATOR = !==, + RESTRICT = contsel, + JOIN = contjoinsel, + SORT1, SORT2, LTCMP, GTCMP, HASHES, MERGES +); +ROLLBACK; + +-- Should fail. Invalid attribute +CREATE OPERATOR #@%# ( + leftarg = int8, -- right unary + procedure = numeric_fac, + invalid_att = int8 +); + +-- Should fail. At least leftarg or rightarg should be mandatorily specified +CREATE OPERATOR #@%# ( + procedure = numeric_fac +); + +-- Should fail. Procedure should be mandatorily specified +CREATE OPERATOR #@%# ( + leftarg = int8 +); + +-- Should fail. CREATE OPERATOR requires USAGE on TYPE +BEGIN TRANSACTION; +CREATE ROLE regress_rol_op3; +CREATE TYPE type_op3 AS ENUM ('new', 'open', 'closed'); +CREATE FUNCTION fn_op3(type_op3, int8) +RETURNS int8 AS $$ + SELECT NULL::int8; +$$ LANGUAGE sql IMMUTABLE; +REVOKE USAGE ON TYPE type_op3 FROM regress_rol_op3; +REVOKE USAGE ON TYPE type_op3 FROM PUBLIC; -- Need to do this so that regress_rol_op3 is not allowed USAGE via PUBLIC +SET ROLE regress_rol_op3; +CREATE OPERATOR #*# ( + leftarg = type_op3, + rightarg = int8, + procedure = fn_op3 +); +ROLLBACK; + +-- Should fail. CREATE OPERATOR requires USAGE on TYPE (need to check separately for rightarg) +BEGIN TRANSACTION; +CREATE ROLE regress_rol_op4; +CREATE TYPE type_op4 AS ENUM ('new', 'open', 'closed'); +CREATE FUNCTION fn_op4(int8, type_op4) +RETURNS int8 AS $$ + SELECT NULL::int8; +$$ LANGUAGE sql IMMUTABLE; +REVOKE USAGE ON TYPE type_op4 FROM regress_rol_op4; +REVOKE USAGE ON TYPE type_op4 FROM PUBLIC; -- Need to do this so that regress_rol_op3 is not allowed USAGE via PUBLIC +SET ROLE regress_rol_op4; +CREATE OPERATOR #*# ( + leftarg = int8, + rightarg = type_op4, + procedure = fn_op4 +); +ROLLBACK; + +-- Should fail. CREATE OPERATOR requires EXECUTE on function +BEGIN TRANSACTION; +CREATE ROLE regress_rol_op5; +CREATE TYPE type_op5 AS ENUM ('new', 'open', 'closed'); +CREATE FUNCTION fn_op5(int8, int8) +RETURNS int8 AS $$ + SELECT NULL::int8; +$$ LANGUAGE sql IMMUTABLE; +REVOKE EXECUTE ON FUNCTION fn_op5(int8, int8) FROM regress_rol_op5; +REVOKE EXECUTE ON FUNCTION fn_op5(int8, int8) FROM PUBLIC;-- Need to do this so that regress_rol_op3 is not allowed EXECUTE via PUBLIC +SET ROLE regress_rol_op5; +CREATE OPERATOR #*# ( + leftarg = int8, + rightarg = int8, + procedure = fn_op5 +); +ROLLBACK; + +-- Should fail. CREATE OPERATOR requires USAGE on return TYPE +BEGIN TRANSACTION; +CREATE ROLE regress_rol_op6; +CREATE TYPE type_op6 AS ENUM ('new', 'open', 'closed'); +CREATE FUNCTION fn_op6(int8, int8) +RETURNS type_op6 AS $$ + SELECT NULL::type_op6; +$$ LANGUAGE sql IMMUTABLE; +REVOKE USAGE ON TYPE type_op6 FROM regress_rol_op6; +REVOKE USAGE ON TYPE type_op6 FROM PUBLIC; -- Need to do this so that regress_rol_op3 is not allowed USAGE via PUBLIC +SET ROLE regress_rol_op6; +CREATE OPERATOR #*# ( + leftarg = int8, + rightarg = int8, + procedure = fn_op6 +); +ROLLBACK; + +-- invalid: non-lowercase quoted identifiers +CREATE OPERATOR === +( + "Leftarg" = box, + "Rightarg" = box, + "Procedure" = area_equal_function, + "Commutator" = ===, + "Negator" = !==, + "Restrict" = area_restriction_function, + "Join" = area_join_function, + "Hashes", + "Merges" +); +SELECT 2 !=-- comment to be removed by psql + 1; diff --git a/postgresql/examples/create_procedure.sql b/postgresql/examples/create_procedure.sql new file mode 100644 index 0000000..cf9b0a0 --- /dev/null +++ b/postgresql/examples/create_procedure.sql @@ -0,0 +1,173 @@ +CALL nonexistent(); -- error +CALL random(); -- error + +CREATE PROCEDURE insert_data(a integer, b integer) +LANGUAGE SQL +BEGIN ATOMIC + INSERT INTO tbl VALUES (a); + INSERT INTO tbl VALUES (b); +END; + +CREATE FUNCTION cp_testfunc1(a int) RETURNS int LANGUAGE SQL AS $$ SELECT a $$; + +CREATE TABLE cp_test (a int, b text); + +CREATE PROCEDURE ptest1(x text) +LANGUAGE SQL +AS $$ +INSERT INTO cp_test VALUES (1, x); +$$; + +\df ptest1 +SELECT pg_get_functiondef('ptest1'::regproc); + +-- show only normal functions +\dfn public.*test*1 + +-- show only procedures +\dfp public.*test*1 + +SELECT ptest1('x'); -- error +CALL ptest1('a'); -- ok +CALL ptest1('xy' || 'zzy'); -- ok, constant-folded arg +CALL ptest1(substring(random()::numeric(20,15)::text, 1, 1)); -- ok, volatile arg + +SELECT * FROM cp_test ORDER BY b COLLATE "C"; + + +CREATE PROCEDURE ptest2() +LANGUAGE SQL +AS $$ +SELECT 5; +$$; + +CALL ptest2(); + + +-- nested CALL +TRUNCATE cp_test; + +CREATE PROCEDURE ptest3(y text) +LANGUAGE SQL +AS $$ +CALL ptest1(y); +CALL ptest1($1); +$$; + +CALL ptest3('b'); + +SELECT * FROM cp_test; + + +-- output arguments + +CREATE PROCEDURE ptest4a(INOUT a int, INOUT b int) +LANGUAGE SQL +AS $$ +SELECT 1, 2; +$$; + +CALL ptest4a(NULL, NULL); + +CREATE PROCEDURE ptest4b(INOUT b int, INOUT a int) +LANGUAGE SQL +AS $$ +CALL ptest4a(a, b); -- error, not supported +$$; + +DROP PROCEDURE ptest4a; + + +-- named and default parameters + +CREATE OR REPLACE PROCEDURE ptest5(a int, b text, c int default 100) +LANGUAGE SQL +AS $$ +INSERT INTO cp_test VALUES(a, b); +INSERT INTO cp_test VALUES(c, b); +$$; + +TRUNCATE cp_test; + +CALL ptest5(10, 'Hello', 20); +CALL ptest5(10, 'Hello'); +CALL ptest5(10, b => 'Hello'); +CALL ptest5(b => 'Hello', a => 10); + +SELECT * FROM cp_test; + + +-- polymorphic types + +CREATE PROCEDURE ptest6(a int, b anyelement) +LANGUAGE SQL +AS $$ +SELECT NULL::int; +$$; + +CALL ptest6(1, 2); + + +-- collation assignment + +CREATE PROCEDURE ptest7(a text, b text) +LANGUAGE SQL +AS $$ +SELECT a = b; +$$; + +CALL ptest7(least('a', 'b'), 'a'); + + +-- various error cases + +CALL version(); -- error: not a procedure +CALL sum(1); -- error: not a procedure + +CREATE PROCEDURE ptestx() LANGUAGE SQL WINDOW AS $$ INSERT INTO cp_test VALUES (1, 'a') $$; +CREATE PROCEDURE ptestx() LANGUAGE SQL STRICT AS $$ INSERT INTO cp_test VALUES (1, 'a') $$; +CREATE PROCEDURE ptestx(OUT a int) LANGUAGE SQL AS $$ INSERT INTO cp_test VALUES (1, 'a') $$; + +ALTER PROCEDURE ptest1(text) STRICT; +ALTER FUNCTION ptest1(text) VOLATILE; -- error: not a function +ALTER PROCEDURE cp_testfunc1(int) VOLATILE; -- error: not a procedure +ALTER PROCEDURE nonexistent() VOLATILE; + +DROP FUNCTION ptest1(text); -- error: not a function +DROP PROCEDURE cp_testfunc1(int); -- error: not a procedure +DROP PROCEDURE nonexistent(); + + +-- privileges + +CREATE USER regress_cp_user1; +GRANT INSERT ON cp_test TO regress_cp_user1; +REVOKE EXECUTE ON PROCEDURE ptest1(text) FROM PUBLIC; +SET ROLE regress_cp_user1; +CALL ptest1('a'); -- error +RESET ROLE; +GRANT EXECUTE ON PROCEDURE ptest1(text) TO regress_cp_user1; +SET ROLE regress_cp_user1; +CALL ptest1('a'); -- ok +RESET ROLE; + + +-- ROUTINE syntax + +ALTER ROUTINE cp_testfunc1(int) RENAME TO cp_testfunc1a; +ALTER ROUTINE cp_testfunc1a RENAME TO cp_testfunc1; + +ALTER ROUTINE ptest1(text) RENAME TO ptest1a; +ALTER ROUTINE ptest1a RENAME TO ptest1; + +DROP ROUTINE cp_testfunc1(int); + + +-- cleanup + +DROP PROCEDURE ptest1; +DROP PROCEDURE ptest2; + +DROP TABLE cp_test; + +DROP USER regress_cp_user1; diff --git a/postgresql/examples/create_table.sql b/postgresql/examples/create_table.sql new file mode 100644 index 0000000..c954a95 --- /dev/null +++ b/postgresql/examples/create_table.sql @@ -0,0 +1,973 @@ +-- +-- CREATE_TABLE +-- + +-- +-- CLASS DEFINITIONS +-- +CREATE TABLE hobbies_r ( + name text, + person text +); + +CREATE TABLE equipment_r ( + name text, + hobby text +); + +CREATE TABLE onek ( + unique1 int4, + unique2 int4, + two int4, + four int4, + ten int4, + twenty int4, + hundred int4, + thousand int4, + twothousand int4, + fivethous int4, + tenthous int4, + odd int4, + even int4, + stringu1 name, + stringu2 name, + string4 name +); + +CREATE TABLE tenk1 ( + unique1 int4, + unique2 int4, + two int4, + four int4, + ten int4, + twenty int4, + hundred int4, + thousand int4, + twothousand int4, + fivethous int4, + tenthous int4, + odd int4, + even int4, + stringu1 name, + stringu2 name, + string4 name +); + +CREATE TABLE tenk2 ( + unique1 int4, + unique2 int4, + two int4, + four int4, + ten int4, + twenty int4, + hundred int4, + thousand int4, + twothousand int4, + fivethous int4, + tenthous int4, + odd int4, + even int4, + stringu1 name, + stringu2 name, + string4 name +); + + +CREATE TABLE person ( + name text, + age int4, + location point +); + + +CREATE TABLE emp ( + salary int4, + manager name +) INHERITS (person); + + +CREATE TABLE student ( + gpa float8 +) INHERITS (person); + + +CREATE TABLE stud_emp ( + percent int4 +) INHERITS (emp, student); + + +CREATE TABLE city ( + name name, + location box, + budget city_budget +); + +CREATE TABLE dept ( + dname name, + mgrname text +); + +CREATE TABLE slow_emp4000 ( + home_base box +); + +CREATE TABLE fast_emp4000 ( + home_base box +); + +CREATE TABLE road ( + name text, + thepath path +); + +CREATE TABLE ihighway () INHERITS (road); + +CREATE TABLE shighway ( + surface text +) INHERITS (road); + +CREATE TABLE real_city ( + pop int4, + cname text, + outline path +); + +-- +-- test the "star" operators a bit more thoroughly -- this time, +-- throw in lots of NULL fields... +-- +-- a is the type root +-- b and c inherit from a (one-level single inheritance) +-- d inherits from b and c (two-level multiple inheritance) +-- e inherits from c (two-level single inheritance) +-- f inherits from e (three-level single inheritance) +-- +CREATE TABLE a_star ( + class char, + a int4 +); + +CREATE TABLE b_star ( + b text +) INHERITS (a_star); + +CREATE TABLE c_star ( + c name +) INHERITS (a_star); + +CREATE TABLE d_star ( + d float8 +) INHERITS (b_star, c_star); + +CREATE TABLE e_star ( + e int2 +) INHERITS (c_star); + +CREATE TABLE f_star ( + f polygon +) INHERITS (e_star); + +CREATE TABLE aggtest ( + a int2, + b float4 +); + +CREATE TABLE hash_i4_heap ( + seqno int4, + random int4 +); + +CREATE TABLE hash_name_heap ( + seqno int4, + random name +); + +CREATE TABLE hash_txt_heap ( + seqno int4, + random text +); + +CREATE TABLE hash_f8_heap ( + seqno int4, + random float8 +); + +-- don't include the hash_ovfl_heap stuff in the distribution +-- the data set is too large for what it's worth +-- +-- CREATE TABLE hash_ovfl_heap ( +-- x int4, +-- y int4 +-- ); + +CREATE TABLE bt_i4_heap ( + seqno int4, + random int4 +); + +CREATE TABLE bt_name_heap ( + seqno name, + random int4 +); + +CREATE TABLE bt_txt_heap ( + seqno text, + random int4 +); + +CREATE TABLE bt_f8_heap ( + seqno float8, + random int4 +); + +CREATE TABLE array_op_test ( + seqno int4, + i int4[], + t text[] +); + +CREATE TABLE array_index_op_test ( + seqno int4, + i int4[], + t text[] +); + +CREATE TABLE testjsonb ( + j jsonb +); + +CREATE TABLE unknowntab ( + u unknown -- fail +); + +CREATE TYPE unknown_comptype AS ( + u unknown -- fail +); + +CREATE TABLE IF NOT EXISTS test_tsvector( + t text, + a tsvector +); + +CREATE TABLE IF NOT EXISTS test_tsvector( + t text +); + +-- invalid: non-lowercase quoted reloptions identifiers +CREATE TABLE tas_case WITH ("Fillfactor" = 10) AS SELECT 1 a; + +CREATE UNLOGGED TABLE unlogged1 (a int primary key); -- OK +CREATE TEMPORARY TABLE unlogged2 (a int primary key); -- OK +SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged\d' ORDER BY relname; +REINDEX INDEX unlogged1_pkey; +REINDEX INDEX unlogged2_pkey; +SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged\d' ORDER BY relname; +DROP TABLE unlogged2; +INSERT INTO unlogged1 VALUES (42); +CREATE UNLOGGED TABLE public.unlogged2 (a int primary key); -- also OK +CREATE UNLOGGED TABLE pg_temp.unlogged3 (a int primary key); -- not OK +CREATE TABLE pg_temp.implicitly_temp (a int primary key); -- OK +CREATE TEMP TABLE explicitly_temp (a int primary key); -- also OK +CREATE TEMP TABLE pg_temp.doubly_temp (a int primary key); -- also OK +CREATE TEMP TABLE public.temp_to_perm (a int primary key); -- not OK +DROP TABLE unlogged1, public.unlogged2; + +CREATE TABLE as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r'; +CREATE TABLE as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r'; +CREATE TABLE IF NOT EXISTS as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r'; +DROP TABLE as_select1; + +PREPARE select1 AS SELECT 1 as a; +CREATE TABLE as_select1 AS EXECUTE select1; +CREATE TABLE as_select1 AS EXECUTE select1; +SELECT * FROM as_select1; +CREATE TABLE IF NOT EXISTS as_select1 AS EXECUTE select1; +DROP TABLE as_select1; +DEALLOCATE select1; + +-- create an extra wide table to test for issues related to that +-- (temporarily hide query, to avoid the long CREATE TABLE stmt) +--\set ECHO none +SELECT 'CREATE TABLE extra_wide_table(firstc text, '|| array_to_string(array_agg('c'||i||' bool'),',')||', lastc text);' +FROM generate_series(1, 1100) g(i); +---\gexec +--\set ECHO all +INSERT INTO extra_wide_table(firstc, lastc) VALUES('first col', 'last col'); +SELECT firstc, lastc FROM extra_wide_table; + +-- check that tables with oids cannot be created anymore +--CREATE TABLE withoid() WITH OIDS; +CREATE TABLE withoid() WITH (oids); +CREATE TABLE withoid() WITH (oids = true); + +-- but explicitly not adding oids is still supported +CREATE TEMP TABLE withoutoid() WITHOUT OIDS; DROP TABLE withoutoid; +CREATE TEMP TABLE withoutoid() WITH (oids = false); DROP TABLE withoutoid; + +-- check restriction with default expressions +-- invalid use of column reference in default expressions +CREATE TABLE default_expr_column (id int DEFAULT (id)); +CREATE TABLE default_expr_column (id int DEFAULT (bar.id)); +CREATE TABLE default_expr_agg_column (id int DEFAULT (avg(id))); +-- invalid column definition +CREATE TABLE default_expr_non_column (a int DEFAULT (avg(non_existent))); +-- invalid use of aggregate +CREATE TABLE default_expr_agg (a int DEFAULT (avg(1))); +-- invalid use of subquery +CREATE TABLE default_expr_agg (a int DEFAULT (select 1)); +-- invalid use of set-returning function +CREATE TABLE default_expr_agg (a int DEFAULT (generate_series(1,3))); + +-- Verify that subtransaction rollback restores rd_createSubid. +BEGIN; +CREATE TABLE remember_create_subid (c int); +SAVEPOINT q; DROP TABLE remember_create_subid; ROLLBACK TO q; +COMMIT; +DROP TABLE remember_create_subid; + +-- Verify that subtransaction rollback restores rd_firstRelfilenodeSubid. +CREATE TABLE remember_node_subid (c int); +BEGIN; +ALTER TABLE remember_node_subid ALTER c TYPE bigint; +SAVEPOINT q; DROP TABLE remember_node_subid; ROLLBACK TO q; +COMMIT; +DROP TABLE remember_node_subid; + +-- +-- Partitioned tables +-- + +-- cannot combine INHERITS and PARTITION BY (although grammar allows) +CREATE TABLE partitioned ( + a int +) INHERITS (some_table) PARTITION BY LIST (a); + +-- cannot use more than 1 column as partition key for list partitioned table +CREATE TABLE partitioned ( + a1 int, + a2 int +) PARTITION BY LIST (a1, a2); -- fail + +-- unsupported constraint type for partitioned tables +CREATE TABLE partitioned ( + a int, + EXCLUDE USING gist (a WITH &&) +) PARTITION BY RANGE (a); + +-- prevent using prohibited expressions in the key +CREATE FUNCTION retset (a int) RETURNS SETOF int AS $$ SELECT 1; $$ LANGUAGE SQL IMMUTABLE; +CREATE TABLE partitioned ( + a int +) PARTITION BY RANGE (retset(a)); +DROP FUNCTION retset(int); + +CREATE TABLE partitioned ( + a int +) PARTITION BY RANGE ((avg(a))); + +CREATE TABLE partitioned ( + a int, + b int +) PARTITION BY RANGE ((avg(a) OVER (PARTITION BY b))); + +CREATE TABLE partitioned ( + a int +) PARTITION BY LIST ((a LIKE (SELECT 1))); + +CREATE TABLE partitioned ( + a int +) PARTITION BY RANGE ((42)); + +CREATE FUNCTION const_func () RETURNS int AS $$ SELECT 1; $$ LANGUAGE SQL IMMUTABLE; +CREATE TABLE partitioned ( + a int +) PARTITION BY RANGE (const_func()); +DROP FUNCTION const_func(); + +-- only accept valid partitioning strategy +CREATE TABLE partitioned ( + a int +) PARTITION BY MAGIC (a); + +-- specified column must be present in the table +CREATE TABLE partitioned ( + a int +) PARTITION BY RANGE (b); + +-- cannot use system columns in partition key +CREATE TABLE partitioned ( + a int +) PARTITION BY RANGE (xmin); + +-- cannot use pseudotypes +CREATE TABLE partitioned ( + a int, + b int +) PARTITION BY RANGE (((a, b))); +CREATE TABLE partitioned ( + a int, + b int +) PARTITION BY RANGE (a, ('unknown')); + +-- functions in key must be immutable +CREATE FUNCTION immut_func (a int) RETURNS int AS $$ SELECT a + random()::int; $$ LANGUAGE SQL; +CREATE TABLE partitioned ( + a int +) PARTITION BY RANGE (immut_func(a)); +DROP FUNCTION immut_func(int); + +-- prevent using columns of unsupported types in key (type must have a btree operator class) +CREATE TABLE partitioned ( + a point +) PARTITION BY LIST (a); +CREATE TABLE partitioned ( + a point +) PARTITION BY LIST (a point_ops); +CREATE TABLE partitioned ( + a point +) PARTITION BY RANGE (a); +CREATE TABLE partitioned ( + a point +) PARTITION BY RANGE (a point_ops); + +-- cannot add NO INHERIT constraints to partitioned tables +CREATE TABLE partitioned ( + a int, + CONSTRAINT check_a CHECK (a > 0) NO INHERIT +) PARTITION BY RANGE (a); + +-- some checks after successful creation of a partitioned table +CREATE FUNCTION plusone(a int) RETURNS INT AS $$ SELECT a+1; $$ LANGUAGE SQL; + +CREATE TABLE partitioned ( + a int, + b int, + c text, + d text +) PARTITION BY RANGE (a oid_ops, plusone(b), c collate "default", d collate "C"); + +-- check relkind +SELECT relkind FROM pg_class WHERE relname = 'partitioned'; + +-- prevent a function referenced in partition key from being dropped +DROP FUNCTION plusone(int); + +-- partitioned table cannot participate in regular inheritance +CREATE TABLE partitioned2 ( + a int, + b text +) PARTITION BY RANGE ((a+1), substr(b, 1, 5)); +CREATE TABLE fail () INHERITS (partitioned2); + +-- Partition key in describe output +--\d partitioned +--\d+ partitioned2 + +INSERT INTO partitioned2 VALUES (1, 'hello'); +CREATE TABLE part2_1 PARTITION OF partitioned2 FOR VALUES FROM (-1, 'aaaaa') TO (100, 'ccccc'); +--\d+ part2_1 + +DROP TABLE partitioned, partitioned2; + +-- check reference to partitioned table's rowtype in partition descriptor +create table partitioned (a int, b int) + partition by list ((row(a, b)::partitioned)); +create table partitioned1 + partition of partitioned for values in ('(1,2)'::partitioned); +create table partitioned2 + partition of partitioned for values in ('(2,4)'::partitioned); +explain (costs off) +select * from partitioned where row(a,b)::partitioned = '(1,2)'::partitioned; +drop table partitioned; + +-- whole-row Var in partition key works too +create table partitioned (a int, b int) + partition by list ((partitioned)); +create table partitioned1 + partition of partitioned for values in ('(1,2)'); +create table partitioned2 + partition of partitioned for values in ('(2,4)'); +explain (costs off) +select * from partitioned where partitioned = '(1,2)'::partitioned; +--\d+ partitioned1 +drop table partitioned; + +-- check that dependencies of partition columns are handled correctly +create domain intdom1 as int; + +create table partitioned ( + a intdom1, + b text +) partition by range (a); + +alter table partitioned drop column a; -- fail + +drop domain intdom1; -- fail, requires cascade + +drop domain intdom1 cascade; + +table partitioned; -- gone + +-- likewise for columns used in partition expressions +create domain intdom1 as int; + +create table partitioned ( + a intdom1, + b text +) partition by range (plusone(a)); + +alter table partitioned drop column a; -- fail + +drop domain intdom1; -- fail, requires cascade + +drop domain intdom1 cascade; + +table partitioned; -- gone + + +-- +-- Partitions +-- + +-- check partition bound syntax + +CREATE TABLE list_parted ( + a int +) PARTITION BY LIST (a); +CREATE TABLE part_p1 PARTITION OF list_parted FOR VALUES IN ('1'); +CREATE TABLE part_p2 PARTITION OF list_parted FOR VALUES IN (2); +CREATE TABLE part_p3 PARTITION OF list_parted FOR VALUES IN ((2+1)); +CREATE TABLE part_null PARTITION OF list_parted FOR VALUES IN (null); +--\d+ list_parted + +-- forbidden expressions for partition bound with list partitioned table +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN (somename); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN (somename.somename); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN (a); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN (sum(a)); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN (sum(somename)); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN (sum(1)); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN ((select 1)); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN (generate_series(4, 6)); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN ('1' collate "POSIX"); +CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN ((1+1) collate "POSIX"); + +-- syntax does not allow empty list of values for list partitions +--CREATE TABLE fail_part PARTITION OF list_parted FOR VALUES IN (); +-- trying to specify range for list partitioned table +CREATE TABLE fail_part PARTITION OF list_parted FOR VALUES FROM (1) TO (2); +-- trying to specify modulus and remainder for list partitioned table +CREATE TABLE fail_part PARTITION OF list_parted FOR VALUES WITH (MODULUS 10, REMAINDER 1); + +-- check default partition cannot be created more than once +CREATE TABLE part_default PARTITION OF list_parted DEFAULT; +CREATE TABLE fail_default_part PARTITION OF list_parted DEFAULT; + +-- specified literal can't be cast to the partition column data type +CREATE TABLE bools ( + a bool +) PARTITION BY LIST (a); +CREATE TABLE bools_true PARTITION OF bools FOR VALUES IN (1); +DROP TABLE bools; + +-- specified literal can be cast, and the cast might not be immutable +CREATE TABLE moneyp ( + a money +) PARTITION BY LIST (a); +CREATE TABLE moneyp_10 PARTITION OF moneyp FOR VALUES IN (10); +CREATE TABLE moneyp_11 PARTITION OF moneyp FOR VALUES IN ('11'); +CREATE TABLE moneyp_12 PARTITION OF moneyp FOR VALUES IN (to_char(12, '99')::int); +DROP TABLE moneyp; + +-- cast is immutable +CREATE TABLE bigintp ( + a bigint +) PARTITION BY LIST (a); +CREATE TABLE bigintp_10 PARTITION OF bigintp FOR VALUES IN (10); +-- fails due to overlap: +CREATE TABLE bigintp_10_2 PARTITION OF bigintp FOR VALUES IN ('10'); +DROP TABLE bigintp; + +CREATE TABLE range_parted ( + a date +) PARTITION BY RANGE (a); + +-- forbidden expressions for partition bounds with range partitioned table +CREATE TABLE part_bogus_expr_fail PARTITION OF range_parted + FOR VALUES FROM (somename) TO ('2019-01-01'); +CREATE TABLE part_bogus_expr_fail PARTITION OF range_parted + FOR VALUES FROM (somename.somename) TO ('2019-01-01'); +CREATE TABLE part_bogus_expr_fail PARTITION OF range_parted + FOR VALUES FROM (a) TO ('2019-01-01'); +CREATE TABLE part_bogus_expr_fail PARTITION OF range_parted + FOR VALUES FROM (max(a)) TO ('2019-01-01'); +CREATE TABLE part_bogus_expr_fail PARTITION OF range_parted + FOR VALUES FROM (max(somename)) TO ('2019-01-01'); +CREATE TABLE part_bogus_expr_fail PARTITION OF range_parted + FOR VALUES FROM (max('2019-02-01'::date)) TO ('2019-01-01'); +CREATE TABLE part_bogus_expr_fail PARTITION OF range_parted + FOR VALUES FROM ((select 1)) TO ('2019-01-01'); +CREATE TABLE part_bogus_expr_fail PARTITION OF range_parted + FOR VALUES FROM (generate_series(1, 3)) TO ('2019-01-01'); + +-- trying to specify list for range partitioned table +CREATE TABLE fail_part PARTITION OF range_parted FOR VALUES IN ('a'); +-- trying to specify modulus and remainder for range partitioned table +CREATE TABLE fail_part PARTITION OF range_parted FOR VALUES WITH (MODULUS 10, REMAINDER 1); +-- each of start and end bounds must have same number of values as the +-- length of the partition key +CREATE TABLE fail_part PARTITION OF range_parted FOR VALUES FROM ('a', 1) TO ('z'); +CREATE TABLE fail_part PARTITION OF range_parted FOR VALUES FROM ('a') TO ('z', 1); + +-- cannot specify null values in range bounds +CREATE TABLE fail_part PARTITION OF range_parted FOR VALUES FROM (null) TO (maxvalue); + +-- trying to specify modulus and remainder for range partitioned table +CREATE TABLE fail_part PARTITION OF range_parted FOR VALUES WITH (MODULUS 10, REMAINDER 1); + +-- check partition bound syntax for the hash partition +CREATE TABLE hash_parted ( + a int +) PARTITION BY HASH (a); +CREATE TABLE hpart_1 PARTITION OF hash_parted FOR VALUES WITH (MODULUS 10, REMAINDER 0); +CREATE TABLE hpart_2 PARTITION OF hash_parted FOR VALUES WITH (MODULUS 50, REMAINDER 1); +CREATE TABLE hpart_3 PARTITION OF hash_parted FOR VALUES WITH (MODULUS 200, REMAINDER 2); +-- modulus 25 is factor of modulus of 50 but 10 is not factor of 25. +CREATE TABLE fail_part PARTITION OF hash_parted FOR VALUES WITH (MODULUS 25, REMAINDER 3); +-- previous modulus 50 is factor of 150 but this modulus is not factor of next modulus 200. +CREATE TABLE fail_part PARTITION OF hash_parted FOR VALUES WITH (MODULUS 150, REMAINDER 3); +-- trying to specify range for the hash partitioned table +CREATE TABLE fail_part PARTITION OF hash_parted FOR VALUES FROM ('a', 1) TO ('z'); +-- trying to specify list value for the hash partitioned table +CREATE TABLE fail_part PARTITION OF hash_parted FOR VALUES IN (1000); + +-- trying to create default partition for the hash partitioned table +CREATE TABLE fail_default_part PARTITION OF hash_parted DEFAULT; + +-- check if compatible with the specified parent + +-- cannot create as partition of a non-partitioned table +CREATE TABLE unparted ( + a int +); +CREATE TABLE fail_part PARTITION OF unparted FOR VALUES IN ('a'); +CREATE TABLE fail_part PARTITION OF unparted FOR VALUES WITH (MODULUS 2, REMAINDER 1); +DROP TABLE unparted; + +-- cannot create a permanent rel as partition of a temp rel +CREATE TEMP TABLE temp_parted ( + a int +) PARTITION BY LIST (a); +CREATE TABLE fail_part PARTITION OF temp_parted FOR VALUES IN ('a'); +DROP TABLE temp_parted; + +-- check for partition bound overlap and other invalid specifications + +CREATE TABLE list_parted2 ( + a varchar +) PARTITION BY LIST (a); +CREATE TABLE part_null_z PARTITION OF list_parted2 FOR VALUES IN (null, 'z'); +CREATE TABLE part_ab PARTITION OF list_parted2 FOR VALUES IN ('a', 'b'); +CREATE TABLE list_parted2_def PARTITION OF list_parted2 DEFAULT; + +CREATE TABLE fail_part PARTITION OF list_parted2 FOR VALUES IN (null); +CREATE TABLE fail_part PARTITION OF list_parted2 FOR VALUES IN ('b', 'c'); +-- check default partition overlap +INSERT INTO list_parted2 VALUES('X'); +CREATE TABLE fail_part PARTITION OF list_parted2 FOR VALUES IN ('W', 'X', 'Y'); + +CREATE TABLE range_parted2 ( + a int +) PARTITION BY RANGE (a); + +-- trying to create range partition with empty range +CREATE TABLE fail_part PARTITION OF range_parted2 FOR VALUES FROM (1) TO (0); +-- note that the range '[1, 1)' has no elements +CREATE TABLE fail_part PARTITION OF range_parted2 FOR VALUES FROM (1) TO (1); + +CREATE TABLE part0 PARTITION OF range_parted2 FOR VALUES FROM (minvalue) TO (1); +CREATE TABLE fail_part PARTITION OF range_parted2 FOR VALUES FROM (minvalue) TO (2); +CREATE TABLE part1 PARTITION OF range_parted2 FOR VALUES FROM (1) TO (10); +CREATE TABLE fail_part PARTITION OF range_parted2 FOR VALUES FROM (9) TO (maxvalue); +CREATE TABLE part2 PARTITION OF range_parted2 FOR VALUES FROM (20) TO (30); +CREATE TABLE part3 PARTITION OF range_parted2 FOR VALUES FROM (30) TO (40); +CREATE TABLE fail_part PARTITION OF range_parted2 FOR VALUES FROM (10) TO (30); +CREATE TABLE fail_part PARTITION OF range_parted2 FOR VALUES FROM (10) TO (50); + +-- Create a default partition for range partitioned table +CREATE TABLE range2_default PARTITION OF range_parted2 DEFAULT; + +-- More than one default partition is not allowed, so this should give error +CREATE TABLE fail_default_part PARTITION OF range_parted2 DEFAULT; + +-- Check if the range for default partitions overlap +INSERT INTO range_parted2 VALUES (85); +CREATE TABLE fail_part PARTITION OF range_parted2 FOR VALUES FROM (80) TO (90); +CREATE TABLE part4 PARTITION OF range_parted2 FOR VALUES FROM (90) TO (100); + +-- now check for multi-column range partition key +CREATE TABLE range_parted3 ( + a int, + b int +) PARTITION BY RANGE (a, (b+1)); + +CREATE TABLE part00 PARTITION OF range_parted3 FOR VALUES FROM (0, minvalue) TO (0, maxvalue); +CREATE TABLE fail_part PARTITION OF range_parted3 FOR VALUES FROM (0, minvalue) TO (0, 1); + +CREATE TABLE part10 PARTITION OF range_parted3 FOR VALUES FROM (1, minvalue) TO (1, 1); +CREATE TABLE part11 PARTITION OF range_parted3 FOR VALUES FROM (1, 1) TO (1, 10); +CREATE TABLE part12 PARTITION OF range_parted3 FOR VALUES FROM (1, 10) TO (1, maxvalue); +CREATE TABLE fail_part PARTITION OF range_parted3 FOR VALUES FROM (1, 10) TO (1, 20); +CREATE TABLE range3_default PARTITION OF range_parted3 DEFAULT; + +-- cannot create a partition that says column b is allowed to range +-- from -infinity to +infinity, while there exist partitions that have +-- more specific ranges +CREATE TABLE fail_part PARTITION OF range_parted3 FOR VALUES FROM (1, minvalue) TO (1, maxvalue); + +-- check for partition bound overlap and other invalid specifications for the hash partition +CREATE TABLE hash_parted2 ( + a varchar +) PARTITION BY HASH (a); +CREATE TABLE h2part_1 PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 4, REMAINDER 2); +CREATE TABLE h2part_2 PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 8, REMAINDER 0); +CREATE TABLE h2part_3 PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 8, REMAINDER 4); +CREATE TABLE h2part_4 PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 8, REMAINDER 5); +-- overlap with part_4 +CREATE TABLE fail_part PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 2, REMAINDER 1); +-- modulus must be greater than zero +CREATE TABLE fail_part PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 0, REMAINDER 1); +-- remainder must be greater than or equal to zero and less than modulus +CREATE TABLE fail_part PARTITION OF hash_parted2 FOR VALUES WITH (MODULUS 8, REMAINDER 8); + +-- check schema propagation from parent + +CREATE TABLE parted ( + a text, + b int NOT NULL DEFAULT 0, + CONSTRAINT check_a CHECK (length(a) > 0) +) PARTITION BY LIST (a); + +CREATE TABLE part_a PARTITION OF parted FOR VALUES IN ('a'); + +-- only inherited attributes (never local ones) +SELECT attname, attislocal, attinhcount FROM pg_attribute + WHERE attrelid = 'part_a'::regclass and attnum > 0 + ORDER BY attnum; + +-- able to specify column default, column constraint, and table constraint + +-- first check the "column specified more than once" error +CREATE TABLE part_b PARTITION OF parted ( + b NOT NULL, + b DEFAULT 1, + b CHECK (b >= 0), + CONSTRAINT check_a CHECK (length(a) > 0) +) FOR VALUES IN ('b'); + +CREATE TABLE part_b PARTITION OF parted ( + b NOT NULL DEFAULT 1, + CONSTRAINT check_a CHECK (length(a) > 0), + CONSTRAINT check_b CHECK (b >= 0) +) FOR VALUES IN ('b'); +-- conislocal should be false for any merged constraints, true otherwise +SELECT conislocal, coninhcount FROM pg_constraint WHERE conrelid = 'part_b'::regclass ORDER BY conislocal, coninhcount; + +-- Once check_b is added to the parent, it should be made non-local for part_b +ALTER TABLE parted ADD CONSTRAINT check_b CHECK (b >= 0); +SELECT conislocal, coninhcount FROM pg_constraint WHERE conrelid = 'part_b'::regclass; + +-- Neither check_a nor check_b are droppable from part_b +ALTER TABLE part_b DROP CONSTRAINT check_a; +ALTER TABLE part_b DROP CONSTRAINT check_b; + +-- And dropping it from parted should leave no trace of them on part_b, unlike +-- traditional inheritance where they will be left behind, because they would +-- be local constraints. +ALTER TABLE parted DROP CONSTRAINT check_a, DROP CONSTRAINT check_b; +SELECT conislocal, coninhcount FROM pg_constraint WHERE conrelid = 'part_b'::regclass; + +-- specify PARTITION BY for a partition +CREATE TABLE fail_part_col_not_found PARTITION OF parted FOR VALUES IN ('c') PARTITION BY RANGE (c); +CREATE TABLE part_c PARTITION OF parted (b WITH OPTIONS NOT NULL DEFAULT 0) FOR VALUES IN ('c') PARTITION BY RANGE ((b)); + +-- create a level-2 partition +CREATE TABLE part_c_1_10 PARTITION OF part_c FOR VALUES FROM (1) TO (10); + +-- check that NOT NULL and default value are inherited correctly +create table parted_notnull_inh_test (a int default 1, b int not null default 0) partition by list (a); +create table parted_notnull_inh_test1 partition of parted_notnull_inh_test (a not null, b default 1) for values in (1); +insert into parted_notnull_inh_test (b) values (null); +-- note that while b's default is overriden, a's default is preserved +--\d parted_notnull_inh_test1 +drop table parted_notnull_inh_test; + +-- check for a conflicting COLLATE clause +create table parted_collate_must_match (a text collate "C", b text collate "C") + partition by range (a); +-- on the partition key +create table parted_collate_must_match1 partition of parted_collate_must_match + (a collate "POSIX") for values from ('a') to ('m'); +-- on another column +create table parted_collate_must_match2 partition of parted_collate_must_match + (b collate "POSIX") for values from ('m') to ('z'); +drop table parted_collate_must_match; + +-- check that specifying incompatible collations for partition bound +-- expressions fails promptly + +create table test_part_coll_posix (a text) partition by range (a collate "POSIX"); +-- fail +create table test_part_coll partition of test_part_coll_posix for values from ('a' collate "C") to ('g'); +-- ok +create table test_part_coll partition of test_part_coll_posix for values from ('a' collate "POSIX") to ('g'); +-- ok +create table test_part_coll2 partition of test_part_coll_posix for values from ('g') to ('m'); + +-- using a cast expression uses the target type's default collation + +-- fail +create table test_part_coll_cast partition of test_part_coll_posix for values from (name 'm' collate "C") to ('s'); +-- ok +create table test_part_coll_cast partition of test_part_coll_posix for values from (name 'm' collate "POSIX") to ('s'); +-- ok; partition collation silently overrides the default collation of type 'name' +create table test_part_coll_cast2 partition of test_part_coll_posix for values from (name 's') to ('z'); + +drop table test_part_coll_posix; + +-- Partition bound in describe output +--\d+ part_b + +-- Both partition bound and partition key in describe output +--\d+ part_c + +-- a level-2 partition's constraint will include the parent's expressions +--\d+ part_c_1_10 + +-- Show partition count in the parent's describe output +-- Tempted to include \d+ output listing partitions with bound info but +-- output could vary depending on the order in which partition oids are +-- returned. +--\d parted +--\d hash_parted + +-- check that we get the expected partition constraints +CREATE TABLE range_parted4 (a int, b int, c int) PARTITION BY RANGE (abs(a), abs(b), c); +CREATE TABLE unbounded_range_part PARTITION OF range_parted4 FOR VALUES FROM (MINVALUE, MINVALUE, MINVALUE) TO (MAXVALUE, MAXVALUE, MAXVALUE); +\d+ unbounded_range_part +DROP TABLE unbounded_range_part; +CREATE TABLE range_parted4_1 PARTITION OF range_parted4 FOR VALUES FROM (MINVALUE, MINVALUE, MINVALUE) TO (1, MAXVALUE, MAXVALUE); +\d+ range_parted4_1 +CREATE TABLE range_parted4_2 PARTITION OF range_parted4 FOR VALUES FROM (3, 4, 5) TO (6, 7, MAXVALUE); +\d+ range_parted4_2 +CREATE TABLE range_parted4_3 PARTITION OF range_parted4 FOR VALUES FROM (6, 8, MINVALUE) TO (9, MAXVALUE, MAXVALUE); +\d+ range_parted4_3 +DROP TABLE range_parted4; + +-- user-defined operator class in partition key +CREATE FUNCTION my_int4_sort(int4,int4) RETURNS int LANGUAGE sql + AS $$ SELECT CASE WHEN $1 = $2 THEN 0 WHEN $1 > $2 THEN 1 ELSE -1 END; $$; +CREATE OPERATOR CLASS test_int4_ops FOR TYPE int4 USING btree AS + OPERATOR 1 < (int4,int4), OPERATOR 2 <= (int4,int4), + OPERATOR 3 = (int4,int4), OPERATOR 4 >= (int4,int4), + OPERATOR 5 > (int4,int4), FUNCTION 1 my_int4_sort(int4,int4); +CREATE TABLE partkey_t (a int4) PARTITION BY RANGE (a test_int4_ops); +CREATE TABLE partkey_t_1 PARTITION OF partkey_t FOR VALUES FROM (0) TO (1000); +INSERT INTO partkey_t VALUES (100); +INSERT INTO partkey_t VALUES (200); + +-- cleanup +DROP TABLE parted, list_parted, range_parted, list_parted2, range_parted2, range_parted3; +DROP TABLE partkey_t, hash_parted, hash_parted2; +DROP OPERATOR CLASS test_int4_ops USING btree; +DROP FUNCTION my_int4_sort(int4,int4); + +-- comments on partitioned tables columns +CREATE TABLE parted_col_comment (a int, b text) PARTITION BY LIST (a); +COMMENT ON TABLE parted_col_comment IS 'Am partitioned table'; +COMMENT ON COLUMN parted_col_comment.a IS 'Partition key'; +SELECT obj_description('parted_col_comment'::regclass); +\d+ parted_col_comment +DROP TABLE parted_col_comment; + +-- list partitioning on array type column +CREATE TABLE arrlp (a int[]) PARTITION BY LIST (a); +CREATE TABLE arrlp12 PARTITION OF arrlp FOR VALUES IN ('{1}', '{2}'); +\d+ arrlp12 +DROP TABLE arrlp; + +-- partition on boolean column +create table boolspart (a bool) partition by list (a); +create table boolspart_t partition of boolspart for values in (true); +create table boolspart_f partition of boolspart for values in (false); +\d+ boolspart +drop table boolspart; + +-- partitions mixing temporary and permanent relations +create table perm_parted (a int) partition by list (a); +create temporary table temp_parted (a int) partition by list (a); +create table perm_part partition of temp_parted default; -- error +create temp table temp_part partition of perm_parted default; -- error +create temp table temp_part partition of temp_parted default; -- ok +drop table perm_parted cascade; +drop table temp_parted cascade; + +-- check that adding partitions to a table while it is being used is prevented +create table tab_part_create (a int) partition by list (a); +create or replace function func_part_create() returns trigger + language plpgsql as $$ + begin + execute 'create table tab_part_create_1 partition of tab_part_create for values in (1)'; + return null; + end $$; +create trigger trig_part_create before insert on tab_part_create + for each statement execute procedure func_part_create(); +insert into tab_part_create values (1); +drop table tab_part_create; +drop function func_part_create(); + +-- test using a volatile expression as partition bound +create table volatile_partbound_test (partkey timestamp) partition by range (partkey); +create table volatile_partbound_test1 partition of volatile_partbound_test for values from (minvalue) to (current_timestamp); +create table volatile_partbound_test2 partition of volatile_partbound_test for values from (current_timestamp) to (maxvalue); +-- this should go into the partition volatile_partbound_test2 +insert into volatile_partbound_test values (current_timestamp); +select tableoid::regclass from volatile_partbound_test; +drop table volatile_partbound_test; + +-- test the case where a check constraint on default partition allows +-- to avoid scanning it when adding a new partition +create table defcheck (a int, b int) partition by list (b); +create table defcheck_def (a int, c int, b int); +alter table defcheck_def drop c; +alter table defcheck attach partition defcheck_def default; +alter table defcheck_def add check (b <= 0 and b is not null); +create table defcheck_1 partition of defcheck for values in (1, null); + +-- test that complex default partition constraints are enforced correctly +insert into defcheck_def values (0, 0); +create table defcheck_0 partition of defcheck for values in (0); +drop table defcheck; + +-- tests of column drop with partition tables and indexes using +-- predicates and expressions. +create table part_column_drop ( + useless_1 int, + id int, + useless_2 int, + d int, + b int, + useless_3 int +) partition by range (id); +alter table part_column_drop drop column useless_1; +alter table part_column_drop drop column useless_2; +alter table part_column_drop drop column useless_3; +create index part_column_drop_b_pred on part_column_drop(b) where b = 1; +create index part_column_drop_b_expr on part_column_drop((b = 1)); +create index part_column_drop_d_pred on part_column_drop(d) where d = 2; +create index part_column_drop_d_expr on part_column_drop((d = 2)); +create table part_column_drop_1_10 partition of + part_column_drop for values from (1) to (10); +\d part_column_drop +\d part_column_drop_1_10 +drop table part_column_drop; diff --git a/postgresql/examples/create_table_like.sql b/postgresql/examples/create_table_like.sql new file mode 100644 index 0000000..6981ac0 --- /dev/null +++ b/postgresql/examples/create_table_like.sql @@ -0,0 +1,184 @@ +/* Test inheritance of structure (LIKE) */ +CREATE TABLE inhx (xx text DEFAULT 'text'); + +/* + * Test double inheritance + * + * Ensure that defaults are NOT included unless + * INCLUDING DEFAULTS is specified + */ +CREATE TABLE ctla (aa TEXT); +CREATE TABLE ctlb (bb TEXT) INHERITS (ctla); + +CREATE TABLE foo (LIKE nonexistent); + +CREATE TABLE inhe (ee text, LIKE inhx) inherits (ctlb); +INSERT INTO inhe VALUES ('ee-col1', 'ee-col2', DEFAULT, 'ee-col4'); +SELECT * FROM inhe; /* Columns aa, bb, xx value NULL, ee */ +SELECT * FROM inhx; /* Empty set since LIKE inherits structure only */ +SELECT * FROM ctlb; /* Has ee entry */ +SELECT * FROM ctla; /* Has ee entry */ + +CREATE TABLE inhf (LIKE inhx, LIKE inhx); /* Throw error */ + +CREATE TABLE inhf (LIKE inhx INCLUDING DEFAULTS INCLUDING CONSTRAINTS); +INSERT INTO inhf DEFAULT VALUES; +SELECT * FROM inhf; /* Single entry with value 'text' */ + +ALTER TABLE inhx add constraint foo CHECK (xx = 'text'); +ALTER TABLE inhx ADD PRIMARY KEY (xx); +CREATE TABLE inhg (LIKE inhx); /* Doesn't copy constraint */ +INSERT INTO inhg VALUES ('foo'); +DROP TABLE inhg; +CREATE TABLE inhg (x text, LIKE inhx INCLUDING CONSTRAINTS, y text); /* Copies constraints */ +INSERT INTO inhg VALUES ('x', 'text', 'y'); /* Succeeds */ +INSERT INTO inhg VALUES ('x', 'text', 'y'); /* Succeeds -- Unique constraints not copied */ +INSERT INTO inhg VALUES ('x', 'foo', 'y'); /* fails due to constraint */ +SELECT * FROM inhg; /* Two records with three columns in order x=x, xx=text, y=y */ +DROP TABLE inhg; + +CREATE TABLE test_like_id_1 (a bigint GENERATED ALWAYS AS IDENTITY, b text); +\d test_like_id_1 +INSERT INTO test_like_id_1 (b) VALUES ('b1'); +SELECT * FROM test_like_id_1; +CREATE TABLE test_like_id_2 (LIKE test_like_id_1); +\d test_like_id_2 +INSERT INTO test_like_id_2 (b) VALUES ('b2'); +SELECT * FROM test_like_id_2; -- identity was not copied +CREATE TABLE test_like_id_3 (LIKE test_like_id_1 INCLUDING IDENTITY); +\d test_like_id_3 +INSERT INTO test_like_id_3 (b) VALUES ('b3'); +SELECT * FROM test_like_id_3; -- identity was copied and applied +DROP TABLE test_like_id_1, test_like_id_2, test_like_id_3; + +CREATE TABLE test_like_gen_1 (a int, b int GENERATED ALWAYS AS (a * 2) STORED); +\d test_like_gen_1 +INSERT INTO test_like_gen_1 (a) VALUES (1); +SELECT * FROM test_like_gen_1; +CREATE TABLE test_like_gen_2 (LIKE test_like_gen_1); +\d test_like_gen_2 +INSERT INTO test_like_gen_2 (a) VALUES (1); +SELECT * FROM test_like_gen_2; +CREATE TABLE test_like_gen_3 (LIKE test_like_gen_1 INCLUDING GENERATED); +\d test_like_gen_3 +INSERT INTO test_like_gen_3 (a) VALUES (1); +SELECT * FROM test_like_gen_3; +DROP TABLE test_like_gen_1, test_like_gen_2, test_like_gen_3; + +-- also test generated column with a "forward" reference (bug #16342) +CREATE TABLE test_like_4 (b int DEFAULT 42, c int GENERATED ALWAYS AS (a * 2) STORED, a int); +\d test_like_4 +CREATE TABLE test_like_4a (LIKE test_like_4); +CREATE TABLE test_like_4b (LIKE test_like_4 INCLUDING DEFAULTS); +CREATE TABLE test_like_4c (LIKE test_like_4 INCLUDING GENERATED); +CREATE TABLE test_like_4d (LIKE test_like_4 INCLUDING DEFAULTS INCLUDING GENERATED); +\d test_like_4a +INSERT INTO test_like_4a (a) VALUES(11); +SELECT a, b, c FROM test_like_4a; +\d test_like_4b +INSERT INTO test_like_4b (a) VALUES(11); +SELECT a, b, c FROM test_like_4b; +\d test_like_4c +INSERT INTO test_like_4c (a) VALUES(11); +SELECT a, b, c FROM test_like_4c; +\d test_like_4d +INSERT INTO test_like_4d (a) VALUES(11); +SELECT a, b, c FROM test_like_4d; +DROP TABLE test_like_4, test_like_4a, test_like_4b, test_like_4c, test_like_4d; + +CREATE TABLE inhg (x text, LIKE inhx INCLUDING INDEXES, y text); /* copies indexes */ +INSERT INTO inhg VALUES (5, 10); +INSERT INTO inhg VALUES (20, 10); -- should fail +DROP TABLE inhg; +/* Multiple primary keys creation should fail */ +CREATE TABLE inhg (x text, LIKE inhx INCLUDING INDEXES, PRIMARY KEY(x)); /* fails */ +CREATE TABLE inhz (xx text DEFAULT 'text', yy int UNIQUE); +CREATE UNIQUE INDEX inhz_xx_idx on inhz (xx) WHERE xx <> 'test'; +/* Ok to create multiple unique indexes */ +CREATE TABLE inhg (x text UNIQUE, LIKE inhz INCLUDING INDEXES); +INSERT INTO inhg (xx, yy, x) VALUES ('test', 5, 10); +INSERT INTO inhg (xx, yy, x) VALUES ('test', 10, 15); +INSERT INTO inhg (xx, yy, x) VALUES ('foo', 10, 15); -- should fail +DROP TABLE inhg; +DROP TABLE inhz; + +-- including storage and comments +CREATE TABLE ctlt1 (a text CHECK (length(a) > 2) PRIMARY KEY, b text); +CREATE INDEX ctlt1_b_key ON ctlt1 (b); +CREATE INDEX ctlt1_fnidx ON ctlt1 ((a || b)); +CREATE STATISTICS ctlt1_a_b_stat ON a,b FROM ctlt1; +COMMENT ON STATISTICS ctlt1_a_b_stat IS 'ab stats'; +COMMENT ON COLUMN ctlt1.a IS 'A'; +COMMENT ON COLUMN ctlt1.b IS 'B'; +COMMENT ON CONSTRAINT ctlt1_a_check ON ctlt1 IS 't1_a_check'; +COMMENT ON INDEX ctlt1_pkey IS 'index pkey'; +COMMENT ON INDEX ctlt1_b_key IS 'index b_key'; +ALTER TABLE ctlt1 ALTER COLUMN a SET STORAGE MAIN; + +CREATE TABLE ctlt2 (c text); +ALTER TABLE ctlt2 ALTER COLUMN c SET STORAGE EXTERNAL; +COMMENT ON COLUMN ctlt2.c IS 'C'; + +CREATE TABLE ctlt3 (a text CHECK (length(a) < 5), c text); +ALTER TABLE ctlt3 ALTER COLUMN c SET STORAGE EXTERNAL; +ALTER TABLE ctlt3 ALTER COLUMN a SET STORAGE MAIN; +COMMENT ON COLUMN ctlt3.a IS 'A3'; +COMMENT ON COLUMN ctlt3.c IS 'C'; +COMMENT ON CONSTRAINT ctlt3_a_check ON ctlt3 IS 't3_a_check'; + +CREATE TABLE ctlt4 (a text, c text); +ALTER TABLE ctlt4 ALTER COLUMN c SET STORAGE EXTERNAL; + +CREATE TABLE ctlt12_storage (LIKE ctlt1 INCLUDING STORAGE, LIKE ctlt2 INCLUDING STORAGE); +\d+ ctlt12_storage +CREATE TABLE ctlt12_comments (LIKE ctlt1 INCLUDING COMMENTS, LIKE ctlt2 INCLUDING COMMENTS); +\d+ ctlt12_comments +CREATE TABLE ctlt1_inh (LIKE ctlt1 INCLUDING CONSTRAINTS INCLUDING COMMENTS) INHERITS (ctlt1); +\d+ ctlt1_inh +SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt1_inh'::regclass; +CREATE TABLE ctlt13_inh () INHERITS (ctlt1, ctlt3); +\d+ ctlt13_inh +CREATE TABLE ctlt13_like (LIKE ctlt3 INCLUDING CONSTRAINTS INCLUDING COMMENTS INCLUDING STORAGE) INHERITS (ctlt1); +\d+ ctlt13_like +SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt13_like'::regclass; + +CREATE TABLE ctlt_all (LIKE ctlt1 INCLUDING ALL); +\d+ ctlt_all +SELECT c.relname, objsubid, description FROM pg_description, pg_index i, pg_class c WHERE classoid = 'pg_class'::regclass AND objoid = i.indexrelid AND c.oid = i.indexrelid AND i.indrelid = 'ctlt_all'::regclass ORDER BY c.relname, objsubid; +SELECT s.stxname, objsubid, description FROM pg_description, pg_statistic_ext s WHERE classoid = 'pg_statistic_ext'::regclass AND objoid = s.oid AND s.stxrelid = 'ctlt_all'::regclass ORDER BY s.stxname, objsubid; + +CREATE TABLE inh_error1 () INHERITS (ctlt1, ctlt4); +CREATE TABLE inh_error2 (LIKE ctlt4 INCLUDING STORAGE) INHERITS (ctlt1); + +DROP TABLE ctlt1, ctlt2, ctlt3, ctlt4, ctlt12_storage, ctlt12_comments, ctlt1_inh, ctlt13_inh, ctlt13_like, ctlt_all, ctla, ctlb CASCADE; + +-- LIKE must respect NO INHERIT property of constraints +CREATE TABLE noinh_con_copy (a int CHECK (a > 0) NO INHERIT); +CREATE TABLE noinh_con_copy1 (LIKE noinh_con_copy INCLUDING CONSTRAINTS); +\d noinh_con_copy1 + +-- fail, as partitioned tables don't allow NO INHERIT constraints +CREATE TABLE noinh_con_copy1_parted (LIKE noinh_con_copy INCLUDING ALL) + PARTITION BY LIST (a); + +DROP TABLE noinh_con_copy, noinh_con_copy1; + + +/* LIKE with other relation kinds */ + +CREATE TABLE ctlt4 (a int, b text); + +CREATE SEQUENCE ctlseq1; +CREATE TABLE ctlt10 (LIKE ctlseq1); -- fail + +CREATE VIEW ctlv1 AS SELECT * FROM ctlt4; +CREATE TABLE ctlt11 (LIKE ctlv1); +CREATE TABLE ctlt11a (LIKE ctlv1 INCLUDING ALL); + +CREATE TYPE ctlty1 AS (a int, b text); +CREATE TABLE ctlt12 (LIKE ctlty1); + +DROP SEQUENCE ctlseq1; +DROP TYPE ctlty1; +DROP VIEW ctlv1; +DROP TABLE IF EXISTS ctlt4, ctlt10, ctlt11, ctlt11a, ctlt12; diff --git a/postgresql/examples/create_type.sql b/postgresql/examples/create_type.sql new file mode 100644 index 0000000..44be7da --- /dev/null +++ b/postgresql/examples/create_type.sql @@ -0,0 +1,227 @@ +-- +-- CREATE_TYPE +-- + +-- +-- Note: widget_in/out were created in create_function_1, without any +-- prior shell-type creation. These commands therefore complete a test +-- of the "old style" approach of making the functions first. +-- +CREATE TYPE widget ( + internallength = 24, + input = widget_in, + output = widget_out, + typmod_in = numerictypmodin, + typmod_out = numerictypmodout, + alignment = double +); + +CREATE TYPE city_budget ( + internallength = 16, + input = int44in, + output = int44out, + element = int4, + category = 'x', -- just to verify the system will take it + preferred = true -- ditto +); + +-- Test creation and destruction of shell types +CREATE TYPE shell; +CREATE TYPE shell; -- fail, type already present +DROP TYPE shell; +DROP TYPE shell; -- fail, type not exist + +-- also, let's leave one around for purposes of pg_dump testing +CREATE TYPE myshell; + +-- +-- Test type-related default values (broken in releases before PG 7.2) +-- +-- This part of the test also exercises the "new style" approach of making +-- a shell type and then filling it in. +-- +CREATE TYPE int42; +CREATE TYPE text_w_default; + +-- Make dummy I/O routines using the existing internal support for int4, text +CREATE FUNCTION int42_in(cstring) + RETURNS int42 + AS 'int4in' + LANGUAGE internal STRICT IMMUTABLE; +CREATE FUNCTION int42_out(int42) + RETURNS cstring + AS 'int4out' + LANGUAGE internal STRICT IMMUTABLE; +CREATE FUNCTION text_w_default_in(cstring) + RETURNS text_w_default + AS 'textin' + LANGUAGE internal STRICT IMMUTABLE; +CREATE FUNCTION text_w_default_out(text_w_default) + RETURNS cstring + AS 'textout' + LANGUAGE internal STRICT IMMUTABLE; + +CREATE TYPE int42 ( + internallength = 4, + input = int42_in, + output = int42_out, + alignment = int4, + default = 42, + passedbyvalue +); + +CREATE TYPE text_w_default ( + internallength = variable, + input = text_w_default_in, + output = text_w_default_out, + alignment = int4, + default = 'zippo' +); + +CREATE TABLE default_test (f1 text_w_default, f2 int42); + +INSERT INTO default_test DEFAULT VALUES; + +SELECT * FROM default_test; + +-- We need a shell type to test some CREATE TYPE failure cases with +CREATE TYPE bogus_type; + +-- invalid: non-lowercase quoted identifiers +/* +CREATE TYPE bogus_type ( + "Internallength" = 4, + "Input" = int42_in, + "Output" = int42_out, + "Alignment" = int4, + "Default" = 42, + "Passedbyvalue" +); +*/ + +-- invalid: input/output function incompatibility +CREATE TYPE bogus_type (INPUT = array_in, + OUTPUT = array_out, + ELEMENT = int, + INTERNALLENGTH = 32); + +DROP TYPE bogus_type; + +-- It no longer is possible to issue CREATE TYPE without making a shell first +CREATE TYPE bogus_type (INPUT = array_in, + OUTPUT = array_out, + ELEMENT = int, + INTERNALLENGTH = 32); + +-- Test stand-alone composite type + +CREATE TYPE default_test_row AS (f1 text_w_default, f2 int42); + +CREATE FUNCTION get_default_test() RETURNS SETOF default_test_row AS ' + SELECT * FROM default_test; +' LANGUAGE SQL; + +SELECT * FROM get_default_test(); + +-- Test comments +COMMENT ON TYPE bad IS 'bad comment'; +COMMENT ON TYPE default_test_row IS 'good comment'; +COMMENT ON TYPE default_test_row IS NULL; +COMMENT ON COLUMN default_test_row.nope IS 'bad comment'; +COMMENT ON COLUMN default_test_row.f1 IS 'good comment'; +COMMENT ON COLUMN default_test_row.f1 IS NULL; + +-- Check shell type create for existing types +CREATE TYPE text_w_default; -- should fail + +DROP TYPE default_test_row CASCADE; + +DROP TABLE default_test; + +-- Check dependencies are established when creating a new type +CREATE TYPE base_type; +CREATE FUNCTION base_fn_in(cstring) RETURNS base_type AS 'boolin' + LANGUAGE internal IMMUTABLE STRICT; +CREATE FUNCTION base_fn_out(base_type) RETURNS cstring AS 'boolout' + LANGUAGE internal IMMUTABLE STRICT; +CREATE TYPE base_type(INPUT = base_fn_in, OUTPUT = base_fn_out); +--DROP FUNCTION base_fn_in(cstring); -- error +--DROP FUNCTION base_fn_out(base_type); -- error +DROP TYPE base_type; -- error +DROP TYPE base_type CASCADE; + +-- Check usage of typmod with a user-defined type +-- (we have borrowed numeric's typmod functions) + +--CREATE TEMP TABLE mytab (foo widget(42,13,7)); -- should fail +--CREATE TEMP TABLE mytab (foo widget(42,13)); + +--SELECT format_type(atttypid,atttypmod) FROM pg_attribute +--WHERE attrelid = 'mytab'::regclass AND attnum > 0; + +-- might as well exercise the widget type while we're here +--INSERT INTO mytab VALUES ('(1,2,3)'), ('(-44,5.5,12)'); +TABLE mytab; + +-- and test format_type() a bit more, too +--select format_type('varchar'::regtype, 42); +--select format_type('bpchar'::regtype, null); +-- this behavior difference is intentional +--select format_type('bpchar'::regtype, -1); + +-- +-- Test CREATE/ALTER TYPE using a type that's compatible with varchar, +-- so we can re-use those support functions +-- +CREATE TYPE myvarchar; + +CREATE FUNCTION myvarcharin(cstring, oid, integer) RETURNS myvarchar +LANGUAGE internal IMMUTABLE PARALLEL SAFE STRICT AS 'varcharin'; + +CREATE FUNCTION myvarcharout(myvarchar) RETURNS cstring +LANGUAGE internal IMMUTABLE PARALLEL SAFE STRICT AS 'varcharout'; + +CREATE FUNCTION myvarcharsend(myvarchar) RETURNS bytea +LANGUAGE internal STABLE PARALLEL SAFE STRICT AS 'varcharsend'; + +CREATE FUNCTION myvarcharrecv(internal, oid, integer) RETURNS myvarchar +LANGUAGE internal STABLE PARALLEL SAFE STRICT AS 'varcharrecv'; + +-- fail, it's still a shell: +--ALTER TYPE myvarchar SET (storage = extended); + +CREATE TYPE myvarchar ( + input = myvarcharin, + output = myvarcharout, + alignment = integer, + storage = main +); + +-- want to check updating of a domain over the target type, too +CREATE DOMAIN myvarchardom AS myvarchar; + +--ALTER TYPE myvarchar SET (storage = plain); -- not allowed + +--ALTER TYPE myvarchar SET (storage = extended); + +ALTER TYPE myvarchar SET ( + send = myvarcharsend, + receive = myvarcharrecv, + typmod_in = varchartypmodin, + typmod_out = varchartypmodout +, analyze = array_typanalyze -- bogus, but it doesn't matter +); + +SELECT typinput, typoutput, typreceive, typsend, typmodin, typmodout, + typanalyze, typstorage +FROM pg_type WHERE typname = 'myvarchar'; + +SELECT typinput, typoutput, typreceive, typsend, typmodin, typmodout, + typanalyze, typstorage +FROM pg_type WHERE typname = 'myvarchardom'; + +-- ensure dependencies are straight +--DROP FUNCTION myvarcharsend(myvarchar); -- fail +DROP TYPE myvarchar; -- fail + +DROP TYPE myvarchar CASCADE; diff --git a/postgresql/examples/create_view.sql b/postgresql/examples/create_view.sql new file mode 100644 index 0000000..254c0b3 --- /dev/null +++ b/postgresql/examples/create_view.sql @@ -0,0 +1,651 @@ +-- +-- CREATE_VIEW +-- Virtual class definitions +-- (this also tests the query rewrite system) +-- + +CREATE VIEW street AS + SELECT r.name, r.thepath, c.cname AS cname + FROM ONLY road r, real_city c + WHERE c.outline ## r.thepath; + +CREATE VIEW iexit AS + SELECT ih.name, ih.thepath, + interpt_pp(ih.thepath, r.thepath) AS exit + FROM ihighway ih, ramp r + WHERE ih.thepath ## r.thepath; + +CREATE VIEW toyemp AS + SELECT name, age, location, 12*salary AS annualsal + FROM emp; + +-- Test comments +COMMENT ON VIEW noview IS 'no view'; +COMMENT ON VIEW toyemp IS 'is a view'; +COMMENT ON VIEW toyemp IS NULL; + +-- These views are left around mainly to exercise special cases in pg_dump. + +CREATE TABLE view_base_table (key int PRIMARY KEY, data varchar(20)); + +CREATE VIEW key_dependent_view AS + SELECT * FROM view_base_table GROUP BY key; + +ALTER TABLE view_base_table DROP CONSTRAINT view_base_table_pkey; -- fails + +CREATE VIEW key_dependent_view_no_cols AS + SELECT FROM view_base_table GROUP BY key HAVING length(data) > 0; + +-- +-- CREATE OR REPLACE VIEW +-- + +CREATE TABLE viewtest_tbl (a int, b int); +COPY viewtest_tbl FROM stdin; +--5 10 +--10 15 +--15 20 +--20 25 +--\. + +CREATE OR REPLACE VIEW viewtest AS + SELECT * FROM viewtest_tbl; + +CREATE OR REPLACE VIEW viewtest AS + SELECT * FROM viewtest_tbl WHERE a > 10; + +SELECT * FROM viewtest; + +CREATE OR REPLACE VIEW viewtest AS + SELECT a, b FROM viewtest_tbl WHERE a > 5 ORDER BY b DESC; + +SELECT * FROM viewtest; + +-- should fail +CREATE OR REPLACE VIEW viewtest AS + SELECT a FROM viewtest_tbl WHERE a <> 20; + +-- should fail +CREATE OR REPLACE VIEW viewtest AS + SELECT 1, * FROM viewtest_tbl; + +-- should fail +CREATE OR REPLACE VIEW viewtest AS + SELECT a, b::numeric FROM viewtest_tbl; + +-- should work +CREATE OR REPLACE VIEW viewtest AS + SELECT a, b, 0 AS c FROM viewtest_tbl; + +DROP VIEW viewtest; +DROP TABLE viewtest_tbl; + +-- tests for temporary views + +CREATE SCHEMA temp_view_test + CREATE TABLE base_table (a int, id int) + CREATE TABLE base_table2 (a int, id int); + +SET search_path TO temp_view_test, public; + +CREATE TEMPORARY TABLE temp_table (a int, id int); + +-- should be created in temp_view_test schema +CREATE VIEW v1 AS SELECT * FROM base_table; +-- should be created in temp object schema +CREATE VIEW v1_temp AS SELECT * FROM temp_table; +-- should be created in temp object schema +CREATE TEMP VIEW v2_temp AS SELECT * FROM base_table; +-- should be created in temp_views schema +CREATE VIEW temp_view_test.v2 AS SELECT * FROM base_table; +-- should fail +CREATE VIEW temp_view_test.v3_temp AS SELECT * FROM temp_table; +-- should fail +CREATE SCHEMA test_view_schema + CREATE TEMP VIEW testview AS SELECT 1; + +-- joins: if any of the join relations are temporary, the view +-- should also be temporary + +-- should be non-temp +CREATE VIEW v3 AS + SELECT t1.a AS t1_a, t2.a AS t2_a + FROM base_table t1, base_table2 t2 + WHERE t1.id = t2.id; +-- should be temp (one join rel is temp) +CREATE VIEW v4_temp AS + SELECT t1.a AS t1_a, t2.a AS t2_a + FROM base_table t1, temp_table t2 + WHERE t1.id = t2.id; +-- should be temp +CREATE VIEW v5_temp AS + SELECT t1.a AS t1_a, t2.a AS t2_a, t3.a AS t3_a + FROM base_table t1, base_table2 t2, temp_table t3 + WHERE t1.id = t2.id and t2.id = t3.id; + +-- subqueries +CREATE VIEW v4 AS SELECT * FROM base_table WHERE id IN (SELECT id FROM base_table2); +CREATE VIEW v5 AS SELECT t1.id, t2.a FROM base_table t1, (SELECT * FROM base_table2) t2; +CREATE VIEW v6 AS SELECT * FROM base_table WHERE EXISTS (SELECT 1 FROM base_table2); +CREATE VIEW v7 AS SELECT * FROM base_table WHERE NOT EXISTS (SELECT 1 FROM base_table2); +CREATE VIEW v8 AS SELECT * FROM base_table WHERE EXISTS (SELECT 1); + +CREATE VIEW v6_temp AS SELECT * FROM base_table WHERE id IN (SELECT id FROM temp_table); +CREATE VIEW v7_temp AS SELECT t1.id, t2.a FROM base_table t1, (SELECT * FROM temp_table) t2; +CREATE VIEW v8_temp AS SELECT * FROM base_table WHERE EXISTS (SELECT 1 FROM temp_table); +CREATE VIEW v9_temp AS SELECT * FROM base_table WHERE NOT EXISTS (SELECT 1 FROM temp_table); + +-- a view should also be temporary if it references a temporary view +CREATE VIEW v10_temp AS SELECT * FROM v7_temp; +CREATE VIEW v11_temp AS SELECT t1.id, t2.a FROM base_table t1, v10_temp t2; +CREATE VIEW v12_temp AS SELECT true FROM v11_temp; + +-- a view should also be temporary if it references a temporary sequence +CREATE SEQUENCE seq1; +CREATE TEMPORARY SEQUENCE seq1_temp; +CREATE VIEW v9 AS SELECT seq1.is_called FROM seq1; +CREATE VIEW v13_temp AS SELECT seq1_temp.is_called FROM seq1_temp; + +SELECT relname FROM pg_class + WHERE relname LIKE 'v_' + AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'temp_view_test') + ORDER BY relname; +SELECT relname FROM pg_class + WHERE relname LIKE 'v%' + AND relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname LIKE 'pg_temp%') + ORDER BY relname; + +CREATE SCHEMA testviewschm2; +SET search_path TO testviewschm2, public; + +CREATE TABLE t1 (num int, name text); +CREATE TABLE t2 (num2 int, value text); +CREATE TEMP TABLE tt (num2 int, value text); + +--todo: fix error with cross join +--CREATE VIEW nontemp1 AS SELECT * FROM t1 CROSS JOIN t2; +--CREATE VIEW temporal1 AS SELECT * FROM t1 CROSS JOIN tt; +CREATE VIEW nontemp2 AS SELECT * FROM t1 INNER JOIN t2 ON t1.num = t2.num2; +CREATE VIEW temporal2 AS SELECT * FROM t1 INNER JOIN tt ON t1.num = tt.num2; +CREATE VIEW nontemp3 AS SELECT * FROM t1 LEFT JOIN t2 ON t1.num = t2.num2; +CREATE VIEW temporal3 AS SELECT * FROM t1 LEFT JOIN tt ON t1.num = tt.num2; +CREATE VIEW nontemp4 AS SELECT * FROM t1 LEFT JOIN t2 ON t1.num = t2.num2 AND t2.value = 'xxx'; +CREATE VIEW temporal4 AS SELECT * FROM t1 LEFT JOIN tt ON t1.num = tt.num2 AND tt.value = 'xxx'; + +SELECT relname FROM pg_class + WHERE relname LIKE 'nontemp%' + AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'testviewschm2') + ORDER BY relname; +SELECT relname FROM pg_class + WHERE relname LIKE 'temporal%' + AND relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname LIKE 'pg_temp%') + ORDER BY relname; + +CREATE TABLE tbl1 ( a int, b int); +CREATE TABLE tbl2 (c int, d int); +CREATE TABLE tbl3 (e int, f int); +CREATE TABLE tbl4 (g int, h int); +CREATE TEMP TABLE tmptbl (i int, j int); + +--Should be in testviewschm2 +CREATE VIEW pubview AS SELECT * FROM tbl1 WHERE tbl1.a +BETWEEN (SELECT d FROM tbl2 WHERE c = 1) AND (SELECT e FROM tbl3 WHERE f = 2) +AND EXISTS (SELECT g FROM tbl4 LEFT JOIN tbl3 ON tbl4.h = tbl3.f); + +SELECT count(*) FROM pg_class where relname = 'pubview' +AND relnamespace IN (SELECT OID FROM pg_namespace WHERE nspname = 'testviewschm2'); + +--Should be in temp object schema +CREATE VIEW mytempview AS SELECT * FROM tbl1 WHERE tbl1.a +BETWEEN (SELECT d FROM tbl2 WHERE c = 1) AND (SELECT e FROM tbl3 WHERE f = 2) +AND EXISTS (SELECT g FROM tbl4 LEFT JOIN tbl3 ON tbl4.h = tbl3.f) +AND NOT EXISTS (SELECT g FROM tbl4 LEFT JOIN tmptbl ON tbl4.h = tmptbl.j); + +SELECT count(*) FROM pg_class where relname LIKE 'mytempview' +And relnamespace IN (SELECT OID FROM pg_namespace WHERE nspname LIKE 'pg_temp%'); + +-- +-- CREATE VIEW and WITH(...) clause +-- +CREATE VIEW mysecview1 + AS SELECT * FROM tbl1 WHERE a = 0; +CREATE VIEW mysecview2 WITH (security_barrier=true) + AS SELECT * FROM tbl1 WHERE a > 0; +CREATE VIEW mysecview3 WITH (security_barrier=false) + AS SELECT * FROM tbl1 WHERE a < 0; +CREATE VIEW mysecview4 WITH (security_barrier) + AS SELECT * FROM tbl1 WHERE a <> 0; +CREATE VIEW mysecview5 WITH (security_barrier=100) -- Error + AS SELECT * FROM tbl1 WHERE a > 100; +CREATE VIEW mysecview6 WITH (invalid_option) -- Error + AS SELECT * FROM tbl1 WHERE a < 100; +SELECT relname, relkind, reloptions FROM pg_class + WHERE oid in ('mysecview1'::regclass, 'mysecview2'::regclass, + 'mysecview3'::regclass, 'mysecview4'::regclass) + ORDER BY relname; + +CREATE OR REPLACE VIEW mysecview1 + AS SELECT * FROM tbl1 WHERE a = 256; +CREATE OR REPLACE VIEW mysecview2 + AS SELECT * FROM tbl1 WHERE a > 256; +CREATE OR REPLACE VIEW mysecview3 WITH (security_barrier=true) + AS SELECT * FROM tbl1 WHERE a < 256; +CREATE OR REPLACE VIEW mysecview4 WITH (security_barrier=false) + AS SELECT * FROM tbl1 WHERE a <> 256; +SELECT relname, relkind, reloptions FROM pg_class + WHERE oid in ('mysecview1'::regclass, 'mysecview2'::regclass, + 'mysecview3'::regclass, 'mysecview4'::regclass) + ORDER BY relname; + +-- Check that unknown literals are converted to "text" in CREATE VIEW, +-- so that we don't end up with unknown-type columns. + +CREATE VIEW unspecified_types AS + SELECT 42 as i, 42.5 as num, 'foo' as u, 'foo'::unknown as u2, null as n; +\d+ unspecified_types +SELECT * FROM unspecified_types; + +-- This test checks that proper typmods are assigned in a multi-row VALUES + +CREATE VIEW tt1 AS + SELECT * FROM ( + VALUES + ('abc'::varchar(3), '0123456789', 42, 'abcd'::varchar(4)), + ('0123456789', 'abc'::varchar(3), 42.12, 'abc'::varchar(4)) + ) vv(a,b,c,d); +\d+ tt1 +SELECT * FROM tt1; +SELECT a::varchar(3) FROM tt1; +DROP VIEW tt1; + +-- Test view decompilation in the face of relation renaming conflicts + +CREATE TABLE tt1 (f1 int, f2 int, f3 text); +CREATE TABLE tx1 (x1 int, x2 int, x3 text); +CREATE TABLE temp_view_test.tt1 (y1 int, f2 int, f3 text); + +CREATE VIEW aliased_view_1 AS + select * from tt1 + where exists (select 1 from tx1 where tt1.f1 = tx1.x1); +CREATE VIEW aliased_view_2 AS + select * from tt1 a1 + where exists (select 1 from tx1 where a1.f1 = tx1.x1); +CREATE VIEW aliased_view_3 AS + select * from tt1 + where exists (select 1 from tx1 a2 where tt1.f1 = a2.x1); +CREATE VIEW aliased_view_4 AS + select * from temp_view_test.tt1 + where exists (select 1 from tt1 where temp_view_test.tt1.y1 = tt1.f1); + +\d+ aliased_view_1 +\d+ aliased_view_2 +\d+ aliased_view_3 +\d+ aliased_view_4 + +ALTER TABLE tx1 RENAME TO a1; + +\d+ aliased_view_1 +\d+ aliased_view_2 +\d+ aliased_view_3 +\d+ aliased_view_4 + +ALTER TABLE tt1 RENAME TO a2; + +\d+ aliased_view_1 +\d+ aliased_view_2 +\d+ aliased_view_3 +\d+ aliased_view_4 + +ALTER TABLE a1 RENAME TO tt1; + +\d+ aliased_view_1 +\d+ aliased_view_2 +\d+ aliased_view_3 +\d+ aliased_view_4 + +ALTER TABLE a2 RENAME TO tx1; +ALTER TABLE tx1 SET SCHEMA temp_view_test; + +\d+ aliased_view_1 +\d+ aliased_view_2 +\d+ aliased_view_3 +\d+ aliased_view_4 + +ALTER TABLE temp_view_test.tt1 RENAME TO tmp1; +ALTER TABLE temp_view_test.tmp1 SET SCHEMA testviewschm2; +ALTER TABLE tmp1 RENAME TO tx1; + +\d+ aliased_view_1 +\d+ aliased_view_2 +\d+ aliased_view_3 +\d+ aliased_view_4 + +-- Test aliasing of joins + +/* +--TODO fix error with cross join +create view view_of_joins as +select * from + (select * from (tbl1 cross join tbl2) same) ss, + (tbl3 cross join tbl4) same; +*/ +\d+ view_of_joins + +-- Test view decompilation in the face of column addition/deletion/renaming + +create table tt2 (a int, b int, c int); +create table tt3 (ax int8, b int2, c numeric); +create table tt4 (ay int, b int, q int); + +create view v1 as select * from tt2 natural join tt3; +create view v1a as select * from (tt2 natural join tt3) j; +create view v2 as select * from tt2 join tt3 using (b,c) join tt4 using (b); +create view v2a as select * from (tt2 join tt3 using (b,c) join tt4 using (b)) j; +create view v3 as select * from tt2 join tt3 using (b,c) full join tt4 using (b); + +select pg_get_viewdef('v1', true); +select pg_get_viewdef('v1a', true); +select pg_get_viewdef('v2', true); +select pg_get_viewdef('v2a', true); +select pg_get_viewdef('v3', true); + +alter table tt2 add column d int; +alter table tt2 add column e int; + +select pg_get_viewdef('v1', true); +select pg_get_viewdef('v1a', true); +select pg_get_viewdef('v2', true); +select pg_get_viewdef('v2a', true); +select pg_get_viewdef('v3', true); + +alter table tt3 rename c to d; + +select pg_get_viewdef('v1', true); +select pg_get_viewdef('v1a', true); +select pg_get_viewdef('v2', true); +select pg_get_viewdef('v2a', true); +select pg_get_viewdef('v3', true); + +alter table tt3 add column c int; +alter table tt3 add column e int; + +select pg_get_viewdef('v1', true); +select pg_get_viewdef('v1a', true); +select pg_get_viewdef('v2', true); +select pg_get_viewdef('v2a', true); +select pg_get_viewdef('v3', true); + +alter table tt2 drop column d; + +select pg_get_viewdef('v1', true); +select pg_get_viewdef('v1a', true); +select pg_get_viewdef('v2', true); +select pg_get_viewdef('v2a', true); +select pg_get_viewdef('v3', true); + +create table tt5 (a int, b int); +create table tt6 (c int, d int); +create view vv1 as select * from (tt5 cross join tt6) j(aa,bb,cc,dd); +select pg_get_viewdef('vv1', true); +alter table tt5 add column c int; +select pg_get_viewdef('vv1', true); +alter table tt5 add column cc int; +select pg_get_viewdef('vv1', true); +alter table tt5 drop column c; +select pg_get_viewdef('vv1', true); + +create view v4 as select * from v1; +alter view v1 rename column a to x; +select pg_get_viewdef('v1', true); +select pg_get_viewdef('v4', true); + + +-- Unnamed FULL JOIN USING is lots of fun too + +create table tt7 (x int, xx int, y int); +alter table tt7 drop column xx; +create table tt8 (x int, z int); + +create view vv2 as +select * from (values(1,2,3,4,5)) v(a,b,c,d,e) +union all +select * from tt7 full join tt8 using (x), tt8 tt8x; + +select pg_get_viewdef('vv2', true); + +create view vv3 as +select * from (values(1,2,3,4,5,6)) v(a,b,c,x,e,f) +union all +select * from + tt7 full join tt8 using (x), + tt7 tt7x full join tt8 tt8x using (x); + +select pg_get_viewdef('vv3', true); + +create view vv4 as +select * from (values(1,2,3,4,5,6,7)) v(a,b,c,x,e,f,g) +union all +select * from + tt7 full join tt8 using (x), + tt7 tt7x full join tt8 tt8x using (x) full join tt8 tt8y using (x); + +select pg_get_viewdef('vv4', true); + +alter table tt7 add column zz int; +alter table tt7 add column z int; +alter table tt7 drop column zz; +alter table tt8 add column z2 int; + +select pg_get_viewdef('vv2', true); +select pg_get_viewdef('vv3', true); +select pg_get_viewdef('vv4', true); + +-- Implicit coercions in a JOIN USING create issues similar to FULL JOIN + +create table tt7a (x date, xx int, y int); +alter table tt7a drop column xx; +create table tt8a (x timestamptz, z int); + +create view vv2a as +select * from (values(now(),2,3,now(),5)) v(a,b,c,d,e) +union all +select * from tt7a left join tt8a using (x), tt8a tt8ax; + +select pg_get_viewdef('vv2a', true); + +-- +-- Also check dropping a column that existed when the view was made +-- + +create table tt9 (x int, xx int, y int); +create table tt10 (x int, z int); + +create view vv5 as select x,y,z from tt9 join tt10 using(x); + +select pg_get_viewdef('vv5', true); + +alter table tt9 drop column xx; + +select pg_get_viewdef('vv5', true); + +-- +-- Another corner case is that we might add a column to a table below a +-- JOIN USING, and thereby make the USING column name ambiguous +-- + +create table tt11 (x int, y int); +create table tt12 (x int, z int); +create table tt13 (z int, q int); + +create view vv6 as select x,y,z,q from + (tt11 join tt12 using(x)) join tt13 using(z); + +select pg_get_viewdef('vv6', true); + +alter table tt11 add column z int; + +select pg_get_viewdef('vv6', true); + +-- +-- Check cases involving dropped/altered columns in a function's rowtype result +-- + +create table tt14t (f1 text, f2 text, f3 text, f4 text); +insert into tt14t values('foo', 'bar', 'baz', '42'); + +alter table tt14t drop column f2; + +create function tt14f() returns setof tt14t as +$$ +declare + rec1 record; +begin + for rec1 in select * from tt14t + loop + return next rec1; + end loop; +end; +$$ +language plpgsql; + +create view tt14v as select t.* from tt14f() t; + +select pg_get_viewdef('tt14v', true); +select * from tt14v; + +begin; + +-- this perhaps should be rejected, but it isn't: +alter table tt14t drop column f3; + +-- f3 is still in the view ... +select pg_get_viewdef('tt14v', true); +-- but will fail at execution +select f1, f4 from tt14v; +select * from tt14v; + +rollback; + +begin; + +-- this perhaps should be rejected, but it isn't: +alter table tt14t alter column f4 type integer using f4::integer; + +-- f4 is still in the view ... +select pg_get_viewdef('tt14v', true); +-- but will fail at execution +select f1, f3 from tt14v; +select * from tt14v; + +rollback; + +-- check display of whole-row variables in some corner cases + +create type nestedcomposite as (x int8_tbl); +create view tt15v as select row(i)::nestedcomposite from int8_tbl i; +select * from tt15v; +select pg_get_viewdef('tt15v', true); +select row(i.*::int8_tbl)::nestedcomposite from int8_tbl i; + +create view tt16v as select * from int8_tbl i, lateral(values(i)) ss; +select * from tt16v; +select pg_get_viewdef('tt16v', true); +select * from int8_tbl i, lateral(values(i.*::int8_tbl)) ss; + +create view tt17v as select * from int8_tbl i where i in (values(i)); +select * from tt17v; +select pg_get_viewdef('tt17v', true); +select * from int8_tbl i where i.* in (values(i.*::int8_tbl)); + +-- check unique-ification of overlength names + +create view tt18v as + select * from int8_tbl xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy + union all + select * from int8_tbl xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz; +select pg_get_viewdef('tt18v', true); +explain (costs off) select * from tt18v; + +-- check display of ScalarArrayOp with a sub-select + +select 'foo'::text = any(array['abc','def','foo']::text[]); +select 'foo'::text = any((select array['abc','def','foo']::text[])); -- fail +select 'foo'::text = any((select array['abc','def','foo']::text[])::text[]); + +create view tt19v as +select 'foo'::text = any(array['abc','def','foo']::text[]) c1, + 'foo'::text = any((select array['abc','def','foo']::text[])::text[]) c2; +select pg_get_viewdef('tt19v', true); + +-- check display of assorted RTE_FUNCTION expressions + +create view tt20v as +select * from + coalesce(1,2) as c, + collation for ('x'::text) col, + current_date as d, + localtimestamp(3) as t, + cast(1+2 as int4) as i4, + cast(1+2 as int8) as i8; +select pg_get_viewdef('tt20v', true); + +-- corner cases with empty join conditions + +create view tt21v as +select * from tt5 natural inner join tt6; +select pg_get_viewdef('tt21v', true); + +create view tt22v as +select * from tt5 natural left join tt6; +select pg_get_viewdef('tt22v', true); + +-- check handling of views with immediately-renamed columns + +create view tt23v (col_a, col_b) as +select q1 as other_name1, q2 as other_name2 from int8_tbl +union +select 42, 43; + +select pg_get_viewdef('tt23v', true); +select pg_get_ruledef(oid, true) from pg_rewrite + where ev_class = 'tt23v'::regclass and ev_type = '1'; + +-- test extraction of FieldSelect field names (get_name_for_var_field) + +create view tt24v as +with cte as materialized (select r from (values(1,2),(3,4)) r) +select (r).column2 as col_a, (rr).column2 as col_b from + cte join (select rr from (values(1,7),(3,8)) rr limit 2) ss + on (r).column1 = (rr).column1; +select pg_get_viewdef('tt24v', true); +create view tt25v as +with cte as materialized (select pg_get_keywords() k) +select (k).word from cte; +select pg_get_viewdef('tt25v', true); +-- also check cases seen only in EXPLAIN +explain (verbose, costs off) +select * from tt24v; +explain (verbose, costs off) +select (r).column2 from (select r from (values(1,2),(3,4)) r limit 1) ss; + +-- test pretty-print parenthesization rules, and SubLink deparsing + +select pg_get_viewdef('tt26v', true); + +-- clean up all the random objects we made above +DROP SCHEMA temp_view_test CASCADE; +DROP SCHEMA testviewschm2 CASCADE; +create view tt26v as +select x + y + z as c1, + (x * y) + z as c2, + x + (y * z) as c3, + (x + y) * z as c4, + x * (y + z) as c5, + x + (y + z) as c6, + x + (y # z) as c7, + (x > y) AND (y > z OR x > z) as c8, + (x > y) OR (y > z AND NOT (x > z)) as c9, + (x,y) <> ALL (values(1,2),(3,4)) as c10, + (x,y) <= ANY (values(1,2),(3,4)) as c11 +from (values(1,2,3)) v(x,y,z); + diff --git a/postgresql/examples/date.sql b/postgresql/examples/date.sql new file mode 100644 index 0000000..1c3adf7 --- /dev/null +++ b/postgresql/examples/date.sql @@ -0,0 +1,342 @@ +-- +-- DATE +-- + +CREATE TABLE DATE_TBL (f1 date); + +INSERT INTO DATE_TBL VALUES ('1957-04-09'); +INSERT INTO DATE_TBL VALUES ('1957-06-13'); +INSERT INTO DATE_TBL VALUES ('1996-02-28'); +INSERT INTO DATE_TBL VALUES ('1996-02-29'); +INSERT INTO DATE_TBL VALUES ('1996-03-01'); +INSERT INTO DATE_TBL VALUES ('1996-03-02'); +INSERT INTO DATE_TBL VALUES ('1997-02-28'); +INSERT INTO DATE_TBL VALUES ('1997-02-29'); +INSERT INTO DATE_TBL VALUES ('1997-03-01'); +INSERT INTO DATE_TBL VALUES ('1997-03-02'); +INSERT INTO DATE_TBL VALUES ('2000-04-01'); +INSERT INTO DATE_TBL VALUES ('2000-04-02'); +INSERT INTO DATE_TBL VALUES ('2000-04-03'); +INSERT INTO DATE_TBL VALUES ('2038-04-08'); +INSERT INTO DATE_TBL VALUES ('2039-04-09'); +INSERT INTO DATE_TBL VALUES ('2040-04-10'); + +SELECT f1 AS "Fifteen" FROM DATE_TBL; + +SELECT f1 AS "Nine" FROM DATE_TBL WHERE f1 < '2000-01-01'; + +SELECT f1 AS "Three" FROM DATE_TBL + WHERE f1 BETWEEN '2000-01-01' AND '2001-01-01'; + +-- +-- Check all the documented input formats +-- +SET datestyle TO iso; -- display results in ISO + +SET datestyle TO ymd; + +SELECT date 'January 8, 1999'; +SELECT date '1999-01-08'; +SELECT date '1999-01-18'; +SELECT date '1/8/1999'; +SELECT date '1/18/1999'; +SELECT date '18/1/1999'; +SELECT date '01/02/03'; +SELECT date '19990108'; +SELECT date '990108'; +SELECT date '1999.008'; +SELECT date 'J2451187'; +SELECT date 'January 8, 99 BC'; + +SELECT date '99-Jan-08'; +SELECT date '1999-Jan-08'; +SELECT date '08-Jan-99'; +SELECT date '08-Jan-1999'; +SELECT date 'Jan-08-99'; +SELECT date 'Jan-08-1999'; +SELECT date '99-08-Jan'; +SELECT date '1999-08-Jan'; + +SELECT date '99 Jan 08'; +SELECT date '1999 Jan 08'; +SELECT date '08 Jan 99'; +SELECT date '08 Jan 1999'; +SELECT date 'Jan 08 99'; +SELECT date 'Jan 08 1999'; +SELECT date '99 08 Jan'; +SELECT date '1999 08 Jan'; + +SELECT date '99-01-08'; +SELECT date '1999-01-08'; +SELECT date '08-01-99'; +SELECT date '08-01-1999'; +SELECT date '01-08-99'; +SELECT date '01-08-1999'; +SELECT date '99-08-01'; +SELECT date '1999-08-01'; + +SELECT date '99 01 08'; +SELECT date '1999 01 08'; +SELECT date '08 01 99'; +SELECT date '08 01 1999'; +SELECT date '01 08 99'; +SELECT date '01 08 1999'; +SELECT date '99 08 01'; +SELECT date '1999 08 01'; + +SET datestyle TO dmy; + +SELECT date 'January 8, 1999'; +SELECT date '1999-01-08'; +SELECT date '1999-01-18'; +SELECT date '1/8/1999'; +SELECT date '1/18/1999'; +SELECT date '18/1/1999'; +SELECT date '01/02/03'; +SELECT date '19990108'; +SELECT date '990108'; +SELECT date '1999.008'; +SELECT date 'J2451187'; +SELECT date 'January 8, 99 BC'; + +SELECT date '99-Jan-08'; +SELECT date '1999-Jan-08'; +SELECT date '08-Jan-99'; +SELECT date '08-Jan-1999'; +SELECT date 'Jan-08-99'; +SELECT date 'Jan-08-1999'; +SELECT date '99-08-Jan'; +SELECT date '1999-08-Jan'; + +SELECT date '99 Jan 08'; +SELECT date '1999 Jan 08'; +SELECT date '08 Jan 99'; +SELECT date '08 Jan 1999'; +SELECT date 'Jan 08 99'; +SELECT date 'Jan 08 1999'; +SELECT date '99 08 Jan'; +SELECT date '1999 08 Jan'; + +SELECT date '99-01-08'; +SELECT date '1999-01-08'; +SELECT date '08-01-99'; +SELECT date '08-01-1999'; +SELECT date '01-08-99'; +SELECT date '01-08-1999'; +SELECT date '99-08-01'; +SELECT date '1999-08-01'; + +SELECT date '99 01 08'; +SELECT date '1999 01 08'; +SELECT date '08 01 99'; +SELECT date '08 01 1999'; +SELECT date '01 08 99'; +SELECT date '01 08 1999'; +SELECT date '99 08 01'; +SELECT date '1999 08 01'; + +SET datestyle TO mdy; + +SELECT date 'January 8, 1999'; +SELECT date '1999-01-08'; +SELECT date '1999-01-18'; +SELECT date '1/8/1999'; +SELECT date '1/18/1999'; +SELECT date '18/1/1999'; +SELECT date '01/02/03'; +SELECT date '19990108'; +SELECT date '990108'; +SELECT date '1999.008'; +SELECT date 'J2451187'; +SELECT date 'January 8, 99 BC'; + +SELECT date '99-Jan-08'; +SELECT date '1999-Jan-08'; +SELECT date '08-Jan-99'; +SELECT date '08-Jan-1999'; +SELECT date 'Jan-08-99'; +SELECT date 'Jan-08-1999'; +SELECT date '99-08-Jan'; +SELECT date '1999-08-Jan'; + +SELECT date '99 Jan 08'; +SELECT date '1999 Jan 08'; +SELECT date '08 Jan 99'; +SELECT date '08 Jan 1999'; +SELECT date 'Jan 08 99'; +SELECT date 'Jan 08 1999'; +SELECT date '99 08 Jan'; +SELECT date '1999 08 Jan'; + +SELECT date '99-01-08'; +SELECT date '1999-01-08'; +SELECT date '08-01-99'; +SELECT date '08-01-1999'; +SELECT date '01-08-99'; +SELECT date '01-08-1999'; +SELECT date '99-08-01'; +SELECT date '1999-08-01'; + +SELECT date '99 01 08'; +SELECT date '1999 01 08'; +SELECT date '08 01 99'; +SELECT date '08 01 1999'; +SELECT date '01 08 99'; +SELECT date '01 08 1999'; +SELECT date '99 08 01'; +SELECT date '1999 08 01'; + +-- Check upper and lower limits of date range +SELECT date '4714-11-24 BC'; +SELECT date '4714-11-23 BC'; -- out of range +SELECT date '5874897-12-31'; +SELECT date '5874898-01-01'; -- out of range + +RESET datestyle; + +-- +-- Simple math +-- Leave most of it for the horology tests +-- + +SELECT f1 - date '2000-01-01' AS "Days From 2K" FROM DATE_TBL; + +SELECT f1 - date 'epoch' AS "Days From Epoch" FROM DATE_TBL; + +SELECT date 'yesterday' - date 'today' AS "One day"; + +SELECT date 'today' - date 'tomorrow' AS "One day"; + +SELECT date 'yesterday' - date 'tomorrow' AS "Two days"; + +SELECT date 'tomorrow' - date 'today' AS "One day"; + +SELECT date 'today' - date 'yesterday' AS "One day"; + +SELECT date 'tomorrow' - date 'yesterday' AS "Two days"; + +-- +-- test extract! +-- +-- epoch +-- +SELECT EXTRACT(EPOCH FROM DATE '1970-01-01'); -- 0 +SELECT EXTRACT(EPOCH FROM TIMESTAMP '1970-01-01'); -- 0 +SELECT EXTRACT(EPOCH FROM TIMESTAMPTZ '1970-01-01+00'); -- 0 +-- +-- century +-- +SELECT EXTRACT(CENTURY FROM DATE '0101-12-31 BC'); -- -2 +SELECT EXTRACT(CENTURY FROM DATE '0100-12-31 BC'); -- -1 +SELECT EXTRACT(CENTURY FROM DATE '0001-12-31 BC'); -- -1 +SELECT EXTRACT(CENTURY FROM DATE '0001-01-01'); -- 1 +SELECT EXTRACT(CENTURY FROM DATE '0001-01-01 AD'); -- 1 +SELECT EXTRACT(CENTURY FROM DATE '1900-12-31'); -- 19 +SELECT EXTRACT(CENTURY FROM DATE '1901-01-01'); -- 20 +SELECT EXTRACT(CENTURY FROM DATE '2000-12-31'); -- 20 +SELECT EXTRACT(CENTURY FROM DATE '2001-01-01'); -- 21 +SELECT EXTRACT(CENTURY FROM CURRENT_DATE)>=21 AS True; -- true +-- +-- millennium +-- +SELECT EXTRACT(MILLENNIUM FROM DATE '0001-12-31 BC'); -- -1 +SELECT EXTRACT(MILLENNIUM FROM DATE '0001-01-01 AD'); -- 1 +SELECT EXTRACT(MILLENNIUM FROM DATE '1000-12-31'); -- 1 +SELECT EXTRACT(MILLENNIUM FROM DATE '1001-01-01'); -- 2 +SELECT EXTRACT(MILLENNIUM FROM DATE '2000-12-31'); -- 2 +SELECT EXTRACT(MILLENNIUM FROM DATE '2001-01-01'); -- 3 +-- next test to be fixed on the turn of the next millennium;-) +SELECT EXTRACT(MILLENNIUM FROM CURRENT_DATE); -- 3 +-- +-- decade +-- +SELECT EXTRACT(DECADE FROM DATE '1994-12-25'); -- 199 +SELECT EXTRACT(DECADE FROM DATE '0010-01-01'); -- 1 +SELECT EXTRACT(DECADE FROM DATE '0009-12-31'); -- 0 +SELECT EXTRACT(DECADE FROM DATE '0001-01-01 BC'); -- 0 +SELECT EXTRACT(DECADE FROM DATE '0002-12-31 BC'); -- -1 +SELECT EXTRACT(DECADE FROM DATE '0011-01-01 BC'); -- -1 +SELECT EXTRACT(DECADE FROM DATE '0012-12-31 BC'); -- -2 +-- +-- some other types: +-- +-- on a timestamp. +SELECT EXTRACT(CENTURY FROM NOW())>=21 AS True; -- true +SELECT EXTRACT(CENTURY FROM TIMESTAMP '1970-03-20 04:30:00.00000'); -- 20 +-- +-- test trunc function! +-- +SELECT DATE_TRUNC('MILLENNIUM', TIMESTAMP '1970-03-20 04:30:00.00000'); -- 1001 +SELECT DATE_TRUNC('MILLENNIUM', DATE '1970-03-20'); -- 1001-01-01 +SELECT DATE_TRUNC('CENTURY', TIMESTAMP '1970-03-20 04:30:00.00000'); -- 1901 +SELECT DATE_TRUNC('CENTURY', DATE '1970-03-20'); -- 1901 +SELECT DATE_TRUNC('CENTURY', DATE '2004-08-10'); -- 2001-01-01 +SELECT DATE_TRUNC('CENTURY', DATE '0002-02-04'); -- 0001-01-01 +SELECT DATE_TRUNC('CENTURY', DATE '0055-08-10 BC'); -- 0100-01-01 BC +SELECT DATE_TRUNC('DECADE', DATE '1993-12-25'); -- 1990-01-01 +SELECT DATE_TRUNC('DECADE', DATE '0004-12-25'); -- 0001-01-01 BC +SELECT DATE_TRUNC('DECADE', DATE '0002-12-31 BC'); -- 0011-01-01 BC +-- +-- test infinity +-- +select 'infinity'::date, '-infinity'::date; +select 'infinity'::date > 'today'::date as t; +select '-infinity'::date < 'today'::date as t; +select isfinite('infinity'::date), isfinite('-infinity'::date), isfinite('today'::date); +-- +-- oscillating fields from non-finite date/timestamptz: +-- +SELECT EXTRACT(HOUR FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(HOUR FROM DATE '-infinity'); -- NULL +SELECT EXTRACT(HOUR FROM TIMESTAMP 'infinity'); -- NULL +SELECT EXTRACT(HOUR FROM TIMESTAMP '-infinity'); -- NULL +SELECT EXTRACT(HOUR FROM TIMESTAMPTZ 'infinity'); -- NULL +SELECT EXTRACT(HOUR FROM TIMESTAMPTZ '-infinity'); -- NULL +-- all possible fields +SELECT EXTRACT(MICROSECONDS FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(MILLISECONDS FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(SECOND FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(MINUTE FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(HOUR FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(DAY FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(MONTH FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(QUARTER FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(WEEK FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(DOW FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(ISODOW FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(DOY FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(TIMEZONE FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(TIMEZONE_M FROM DATE 'infinity'); -- NULL +SELECT EXTRACT(TIMEZONE_H FROM DATE 'infinity'); -- NULL +-- +-- monotonic fields from non-finite date/timestamptz: +-- +SELECT EXTRACT(EPOCH FROM DATE 'infinity'); -- Infinity +SELECT EXTRACT(EPOCH FROM DATE '-infinity'); -- -Infinity +SELECT EXTRACT(EPOCH FROM TIMESTAMP 'infinity'); -- Infinity +SELECT EXTRACT(EPOCH FROM TIMESTAMP '-infinity'); -- -Infinity +SELECT EXTRACT(EPOCH FROM TIMESTAMPTZ 'infinity'); -- Infinity +SELECT EXTRACT(EPOCH FROM TIMESTAMPTZ '-infinity'); -- -Infinity +-- all possible fields +SELECT EXTRACT(YEAR FROM DATE 'infinity'); -- Infinity +SELECT EXTRACT(DECADE FROM DATE 'infinity'); -- Infinity +SELECT EXTRACT(CENTURY FROM DATE 'infinity'); -- Infinity +SELECT EXTRACT(MILLENNIUM FROM DATE 'infinity'); -- Infinity +SELECT EXTRACT(JULIAN FROM DATE 'infinity'); -- Infinity +SELECT EXTRACT(ISOYEAR FROM DATE 'infinity'); -- Infinity +SELECT EXTRACT(EPOCH FROM DATE 'infinity'); -- Infinity +-- +-- wrong fields from non-finite date: +-- +SELECT EXTRACT(MICROSEC FROM DATE 'infinity'); -- ERROR: timestamp units "microsec" not recognized + +-- test constructors +select make_date(2013, 7, 15); +select make_date(-44, 3, 15); +select make_time(8, 20, 0.0); +-- should fail +select make_date(2013, 2, 30); +select make_date(2013, 13, 1); +select make_date(2013, 11, -1); +select make_time(10, 55, 100.1); +select make_time(24, 0, 2.1); diff --git a/postgresql/examples/dbsize.sql b/postgresql/examples/dbsize.sql new file mode 100644 index 0000000..d10a4d7 --- /dev/null +++ b/postgresql/examples/dbsize.sql @@ -0,0 +1,51 @@ +SELECT size, pg_size_pretty(size), pg_size_pretty(-1 * size) FROM + (VALUES (10::bigint), (1000::bigint), (1000000::bigint), + (1000000000::bigint), (1000000000000::bigint), + (1000000000000000::bigint)) x(size); + +SELECT size, pg_size_pretty(size), pg_size_pretty(-1 * size) FROM + (VALUES (10::numeric), (1000::numeric), (1000000::numeric), + (1000000000::numeric), (1000000000000::numeric), + (1000000000000000::numeric), + (10.5::numeric), (1000.5::numeric), (1000000.5::numeric), + (1000000000.5::numeric), (1000000000000.5::numeric), + (1000000000000000.5::numeric)) x(size); + +SELECT size, pg_size_bytes(size) FROM + (VALUES ('1'), ('123bytes'), ('1kB'), ('1MB'), (' 1 GB'), ('1.5 GB '), + ('1TB'), ('3000 TB'), ('1e6 MB')) x(size); + +-- case-insensitive units are supported +SELECT size, pg_size_bytes(size) FROM + (VALUES ('1'), ('123bYteS'), ('1kb'), ('1mb'), (' 1 Gb'), ('1.5 gB '), + ('1tb'), ('3000 tb'), ('1e6 mb')) x(size); + +-- negative numbers are supported +SELECT size, pg_size_bytes(size) FROM + (VALUES ('-1'), ('-123bytes'), ('-1kb'), ('-1mb'), (' -1 Gb'), ('-1.5 gB '), + ('-1tb'), ('-3000 TB'), ('-10e-1 MB')) x(size); + +-- different cases with allowed points +SELECT size, pg_size_bytes(size) FROM + (VALUES ('-1.'), ('-1.kb'), ('-1. kb'), ('-0. gb'), + ('-.1'), ('-.1kb'), ('-.1 kb'), ('-.0 gb')) x(size); + +-- invalid inputs +SELECT pg_size_bytes('1 AB'); +SELECT pg_size_bytes('1 AB A'); +SELECT pg_size_bytes('1 AB A '); +SELECT pg_size_bytes('9223372036854775807.9'); +SELECT pg_size_bytes('1e100'); +SELECT pg_size_bytes('1e1000000000000000000'); +SELECT pg_size_bytes('1 byte'); -- the singular "byte" is not supported +SELECT pg_size_bytes(''); + +SELECT pg_size_bytes('kb'); +SELECT pg_size_bytes('..'); +SELECT pg_size_bytes('-.'); +SELECT pg_size_bytes('-.kb'); +SELECT pg_size_bytes('-. kb'); + +SELECT pg_size_bytes('.+912'); +SELECT pg_size_bytes('+912+ kB'); +SELECT pg_size_bytes('++123 kB'); diff --git a/postgresql/examples/delete.sql b/postgresql/examples/delete.sql new file mode 100644 index 0000000..d8cb99e --- /dev/null +++ b/postgresql/examples/delete.sql @@ -0,0 +1,25 @@ +CREATE TABLE delete_test ( + id SERIAL PRIMARY KEY, + a INT, + b text +); + +INSERT INTO delete_test (a) VALUES (10); +INSERT INTO delete_test (a, b) VALUES (50, repeat('x', 10000)); +INSERT INTO delete_test (a) VALUES (100); + +-- allow an alias to be specified for DELETE's target table +DELETE FROM delete_test AS dt WHERE dt.a > 75; + +-- if an alias is specified, don't allow the original table name +-- to be referenced +DELETE FROM delete_test dt WHERE delete_test.a > 25; + +SELECT id, a, char_length(b) FROM delete_test; + +-- delete a row with a TOASTed value +DELETE FROM delete_test WHERE a > 25; + +SELECT id, a, char_length(b) FROM delete_test; + +DROP TABLE delete_test; diff --git a/postgresql/examples/dependency.sql b/postgresql/examples/dependency.sql new file mode 100644 index 0000000..2559c62 --- /dev/null +++ b/postgresql/examples/dependency.sql @@ -0,0 +1,116 @@ +-- +-- DEPENDENCIES +-- + +CREATE USER regress_dep_user; +CREATE USER regress_dep_user2; +CREATE USER regress_dep_user3; +CREATE GROUP regress_dep_group; + +CREATE TABLE deptest (f1 serial primary key, f2 text); + +GRANT SELECT ON TABLE deptest TO GROUP regress_dep_group; +GRANT ALL ON TABLE deptest TO regress_dep_user, regress_dep_user2; + +-- can't drop neither because they have privileges somewhere +DROP USER regress_dep_user; +DROP GROUP regress_dep_group; + +-- if we revoke the privileges we can drop the group +REVOKE SELECT ON deptest FROM GROUP regress_dep_group; +DROP GROUP regress_dep_group; + +-- can't drop the user if we revoke the privileges partially +REVOKE SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES ON deptest FROM regress_dep_user; +DROP USER regress_dep_user; + +-- now we are OK to drop him +REVOKE TRIGGER ON deptest FROM regress_dep_user; +DROP USER regress_dep_user; + +-- we are OK too if we drop the privileges all at once +REVOKE ALL ON deptest FROM regress_dep_user2; +DROP USER regress_dep_user2; + +-- can't drop the owner of an object +-- the error message detail here would include a pg_toast_nnn name that +-- is not constant, so suppress it +\set VERBOSITY terse +ALTER TABLE deptest OWNER TO regress_dep_user3; +DROP USER regress_dep_user3; +\set VERBOSITY default + +-- if we drop the object, we can drop the user too +DROP TABLE deptest; +DROP USER regress_dep_user3; + +-- Test DROP OWNED +CREATE USER regress_dep_user0; +CREATE USER regress_dep_user1; +CREATE USER regress_dep_user2; +SET SESSION AUTHORIZATION regress_dep_user0; +-- permission denied +DROP OWNED BY regress_dep_user1; +DROP OWNED BY regress_dep_user0, regress_dep_user2; +REASSIGN OWNED BY regress_dep_user0 TO regress_dep_user1; +REASSIGN OWNED BY regress_dep_user1 TO regress_dep_user0; +-- this one is allowed +DROP OWNED BY regress_dep_user0; + +CREATE TABLE deptest1 (f1 int unique); +GRANT ALL ON deptest1 TO regress_dep_user1 WITH GRANT OPTION; + +SET SESSION AUTHORIZATION regress_dep_user1; +CREATE TABLE deptest (a serial primary key, b text); +GRANT ALL ON deptest1 TO regress_dep_user2; +RESET SESSION AUTHORIZATION; +\z deptest1 + +DROP OWNED BY regress_dep_user1; +-- all grants revoked +\z deptest1 +-- table was dropped +\d deptest + +-- Test REASSIGN OWNED +GRANT ALL ON deptest1 TO regress_dep_user1; +GRANT CREATE ON DATABASE regression TO regress_dep_user1; + +SET SESSION AUTHORIZATION regress_dep_user1; +CREATE SCHEMA deptest; +CREATE TABLE deptest (a serial primary key, b text); +ALTER DEFAULT PRIVILEGES FOR ROLE regress_dep_user1 IN SCHEMA deptest + GRANT ALL ON TABLES TO regress_dep_user2; +CREATE FUNCTION deptest_func() RETURNS void LANGUAGE plpgsql + AS $$ BEGIN END; $$; +CREATE TYPE deptest_enum AS ENUM ('red'); +CREATE TYPE deptest_range AS RANGE (SUBTYPE = int4); + +CREATE TABLE deptest2 (f1 int); +-- make a serial column the hard way +CREATE SEQUENCE ss1; +ALTER TABLE deptest2 ALTER f1 SET DEFAULT nextval('ss1'); +ALTER SEQUENCE ss1 OWNED BY deptest2.f1; + +-- When reassigning ownership of a composite type, its pg_class entry +-- should match +CREATE TYPE deptest_t AS (a int); +SELECT typowner = relowner +FROM pg_type JOIN pg_class c ON typrelid = c.oid WHERE typname = 'deptest_t'; + +RESET SESSION AUTHORIZATION; +REASSIGN OWNED BY regress_dep_user1 TO regress_dep_user2; +\dt deptest + +SELECT typowner = relowner +FROM pg_type JOIN pg_class c ON typrelid = c.oid WHERE typname = 'deptest_t'; + +-- doesn't work: grant still exists +DROP USER regress_dep_user1; +DROP OWNED BY regress_dep_user1; +DROP USER regress_dep_user1; + +DROP USER regress_dep_user2; +DROP OWNED BY regress_dep_user2, regress_dep_user0; +DROP USER regress_dep_user2; +DROP USER regress_dep_user0; diff --git a/postgresql/examples/domain.sql b/postgresql/examples/domain.sql new file mode 100644 index 0000000..9c03a36 --- /dev/null +++ b/postgresql/examples/domain.sql @@ -0,0 +1,754 @@ +-- +-- Test domains. +-- + +-- Test Comment / Drop +create domain domaindroptest int4; +comment on domain domaindroptest is 'About to drop this..'; + +create domain dependenttypetest domaindroptest; + +-- fail because of dependent type +drop domain domaindroptest; + +drop domain domaindroptest cascade; + +-- this should fail because already gone +drop domain domaindroptest cascade; + + +-- Test domain input. + +-- Note: the point of checking both INSERT and COPY FROM is that INSERT +-- exercises CoerceToDomain while COPY exercises domain_in. + +create domain domainvarchar varchar(5); +create domain domainnumeric numeric(8,2); +create domain domainint4 int4; +create domain domaintext text; + +-- Test explicit coercions --- these should succeed (and truncate) +SELECT cast('123456' as domainvarchar); +SELECT cast('12345' as domainvarchar); + +-- Test tables using domains +create table basictest + ( testint4 domainint4 + , testtext domaintext + , testvarchar domainvarchar + , testnumeric domainnumeric + ); + +INSERT INTO basictest values ('88', 'haha', 'short', '123.12'); -- Good +INSERT INTO basictest values ('88', 'haha', 'short text', '123.12'); -- Bad varchar +INSERT INTO basictest values ('88', 'haha', 'short', '123.1212'); -- Truncate numeric + +-- Test copy +COPY basictest (testvarchar) FROM stdin; -- fail +--notsoshorttext +\. + +COPY basictest (testvarchar) FROM stdin; +--short +\. + +select * from basictest; + +-- check that domains inherit operations from base types +select testtext || testvarchar as concat, testnumeric + 42 as sum +from basictest; + +-- check that union/case/coalesce type resolution handles domains properly +select coalesce(4::domainint4, 7) is of (int4) as t; +select coalesce(4::domainint4, 7) is of (domainint4) as f; +select coalesce(4::domainint4, 7::domainint4) is of (domainint4) as t; + +drop table basictest; +drop domain domainvarchar restrict; +drop domain domainnumeric restrict; +drop domain domainint4 restrict; +drop domain domaintext; + + +-- Test domains over array types + +create domain domainint4arr int4[1]; +create domain domainchar4arr varchar(4)[2][3]; + +create table domarrtest + ( testint4arr domainint4arr + , testchar4arr domainchar4arr + ); +INSERT INTO domarrtest values ('{2,2}', '{{"a","b"},{"c","d"}}'); +INSERT INTO domarrtest values ('{{2,2},{2,2}}', '{{"a","b"}}'); +INSERT INTO domarrtest values ('{2,2}', '{{"a","b"},{"c","d"},{"e","f"}}'); +INSERT INTO domarrtest values ('{2,2}', '{{"a"},{"c"}}'); +INSERT INTO domarrtest values (NULL, '{{"a","b","c"},{"d","e","f"}}'); +INSERT INTO domarrtest values (NULL, '{{"toolong","b","c"},{"d","e","f"}}'); +INSERT INTO domarrtest (testint4arr[1], testint4arr[3]) values (11,22); +select * from domarrtest; +select testint4arr[1], testchar4arr[2:2] from domarrtest; +select array_dims(testint4arr), array_dims(testchar4arr) from domarrtest; + +COPY domarrtest FROM stdin; +\. + +COPY domarrtest FROM stdin; -- fail +\. + +select * from domarrtest; + +update domarrtest set + testint4arr[1] = testint4arr[1] + 1, + testint4arr[3] = testint4arr[3] - 1 +where testchar4arr is null; + +select * from domarrtest where testchar4arr is null; + +drop table domarrtest; +drop domain domainint4arr restrict; +drop domain domainchar4arr restrict; + +create domain dia as int[]; +select '{1,2,3}'::dia; +select array_dims('{1,2,3}'::dia); +select pg_typeof('{1,2,3}'::dia); +select pg_typeof('{1,2,3}'::dia || 42); -- should be int[] not dia +drop domain dia; + + +-- Test domains over composites + +create type comptype as (r float8, i float8); +create domain dcomptype as comptype; +create table dcomptable (d1 dcomptype unique); + +insert into dcomptable values (row(1,2)::dcomptype); +insert into dcomptable values (row(3,4)::comptype); +insert into dcomptable values (row(1,2)::dcomptype); -- fail on uniqueness +insert into dcomptable (d1.r) values(11); + +select * from dcomptable; +select (d1).r, (d1).i, (d1).* from dcomptable; +update dcomptable set d1.r = (d1).r + 1 where (d1).i > 0; +select * from dcomptable; + +alter domain dcomptype add constraint c1 check ((value).r <= (value).i); +alter domain dcomptype add constraint c2 check ((value).r > (value).i); -- fail + +select row(2,1)::dcomptype; -- fail +insert into dcomptable values (row(1,2)::comptype); +insert into dcomptable values (row(2,1)::comptype); -- fail +insert into dcomptable (d1.r) values(99); +insert into dcomptable (d1.r, d1.i) values(99, 100); +insert into dcomptable (d1.r, d1.i) values(100, 99); -- fail +update dcomptable set d1.r = (d1).r + 1 where (d1).i > 0; -- fail +update dcomptable set d1.r = (d1).r - 1, d1.i = (d1).i + 1 where (d1).i > 0; +select * from dcomptable; + +explain (verbose, costs off) + update dcomptable set d1.r = (d1).r - 1, d1.i = (d1).i + 1 where (d1).i > 0; +create rule silly as on delete to dcomptable do instead + update dcomptable set d1.r = (d1).r - 1, d1.i = (d1).i + 1 where (d1).i > 0; +\d+ dcomptable + +drop table dcomptable; +drop type comptype cascade; + + +-- check altering and dropping columns used by domain constraints +create type comptype as (r float8, i float8); +create domain dcomptype as comptype; +alter domain dcomptype add constraint c1 check ((value).r > 0); +comment on constraint c1 on domain dcomptype is 'random commentary'; + +select row(0,1)::dcomptype; -- fail + +alter type comptype alter attribute r type varchar; -- fail +alter type comptype alter attribute r type bigint; + +alter type comptype drop attribute r; -- fail +alter type comptype drop attribute i; + +select conname, obj_description(oid, 'pg_constraint') from pg_constraint + where contypid = 'dcomptype'::regtype; -- check comment is still there + +drop type comptype cascade; + + +-- Test domains over arrays of composite + +create type comptype as (r float8, i float8); +create domain dcomptypea as comptype[]; +create table dcomptable (d1 dcomptypea unique); + +insert into dcomptable values (array[row(1,2)]::dcomptypea); +insert into dcomptable values (array[row(3,4), row(5,6)]::comptype[]); +insert into dcomptable values (array[row(7,8)::comptype, row(9,10)::comptype]); +insert into dcomptable values (array[row(1,2)]::dcomptypea); -- fail on uniqueness +insert into dcomptable (d1[1]) values(row(9,10)); +insert into dcomptable (d1[1].r) values(11); + +select * from dcomptable; +select d1[2], d1[1].r, d1[1].i from dcomptable; +update dcomptable set d1[2] = row(d1[2].i, d1[2].r); +select * from dcomptable; +update dcomptable set d1[1].r = d1[1].r + 1 where d1[1].i > 0; +select * from dcomptable; + +alter domain dcomptypea add constraint c1 check (value[1].r <= value[1].i); +alter domain dcomptypea add constraint c2 check (value[1].r > value[1].i); -- fail + +select array[row(2,1)]::dcomptypea; -- fail +insert into dcomptable values (array[row(1,2)]::comptype[]); +insert into dcomptable values (array[row(2,1)]::comptype[]); -- fail +insert into dcomptable (d1[1].r) values(99); +insert into dcomptable (d1[1].r, d1[1].i) values(99, 100); +insert into dcomptable (d1[1].r, d1[1].i) values(100, 99); -- fail +update dcomptable set d1[1].r = d1[1].r + 1 where d1[1].i > 0; -- fail +update dcomptable set d1[1].r = d1[1].r - 1, d1[1].i = d1[1].i + 1 + where d1[1].i > 0; +select * from dcomptable; + +explain (verbose, costs off) + update dcomptable set d1[1].r = d1[1].r - 1, d1[1].i = d1[1].i + 1 + where d1[1].i > 0; +create rule silly as on delete to dcomptable do instead + update dcomptable set d1[1].r = d1[1].r - 1, d1[1].i = d1[1].i + 1 + where d1[1].i > 0; +\d+ dcomptable + +drop table dcomptable; +drop type comptype cascade; + + +-- Test arrays over domains + +create domain posint as int check (value > 0); + +create table pitable (f1 posint[]); +insert into pitable values(array[42]); +insert into pitable values(array[-1]); -- fail +insert into pitable values('{0}'); -- fail +update pitable set f1[1] = f1[1] + 1; +update pitable set f1[1] = 0; -- fail +select * from pitable; +drop table pitable; + +create domain vc4 as varchar(4); +create table vc4table (f1 vc4[]); +insert into vc4table values(array['too long']); -- fail +insert into vc4table values(array['too long']::vc4[]); -- cast truncates +select * from vc4table; +drop table vc4table; +drop type vc4; + +-- You can sort of fake arrays-of-arrays by putting a domain in between +create domain dposinta as posint[]; +create table dposintatable (f1 dposinta[]); +insert into dposintatable values(array[array[42]]); -- fail +insert into dposintatable values(array[array[42]::posint[]]); -- still fail +insert into dposintatable values(array[array[42]::dposinta]); -- but this works +select f1, f1[1], (f1[1])[1] from dposintatable; +select pg_typeof(f1) from dposintatable; +select pg_typeof(f1[1]) from dposintatable; +select pg_typeof(f1[1][1]) from dposintatable; +select pg_typeof((f1[1])[1]) from dposintatable; +update dposintatable set f1[2] = array[99]; +select f1, f1[1], (f1[2])[1] from dposintatable; +-- it'd be nice if you could do something like this, but for now you can't: +update dposintatable set f1[2][1] = array[97]; +-- maybe someday we can make this syntax work: +--update dposintatable set (f1[2])[1] = array[98]; + +drop table dposintatable; +drop domain posint cascade; + + +-- Test not-null restrictions + +create domain dnotnull varchar(15) NOT NULL; +create domain dnull varchar(15); +create domain dcheck varchar(15) NOT NULL CHECK (VALUE = 'a' OR VALUE = 'c' OR VALUE = 'd'); + +create table nulltest + ( col1 dnotnull + , col2 dnotnull NULL -- NOT NULL in the domain cannot be overridden + , col3 dnull NOT NULL + , col4 dnull + , col5 dcheck CHECK (col5 IN ('c', 'd')) + ); +INSERT INTO nulltest DEFAULT VALUES; +INSERT INTO nulltest values ('a', 'b', 'c', 'd', 'c'); -- Good +insert into nulltest values ('a', 'b', 'c', 'd', NULL); +insert into nulltest values ('a', 'b', 'c', 'd', 'a'); +INSERT INTO nulltest values (NULL, 'b', 'c', 'd', 'd'); +INSERT INTO nulltest values ('a', NULL, 'c', 'd', 'c'); +INSERT INTO nulltest values ('a', 'b', NULL, 'd', 'c'); +INSERT INTO nulltest values ('a', 'b', 'c', NULL, 'd'); -- Good + +-- Test copy +COPY nulltest FROM stdin; --fail +\. + +COPY nulltest FROM stdin; --fail +\. + +-- Last row is bad +COPY nulltest FROM stdin; +\. + +select * from nulltest; + +-- Test out coerced (casted) constraints +SELECT cast('1' as dnotnull); +SELECT cast(NULL as dnotnull); -- fail +SELECT cast(cast(NULL as dnull) as dnotnull); -- fail +SELECT cast(col4 as dnotnull) from nulltest; -- fail + +-- cleanup +drop table nulltest; +drop domain dnotnull restrict; +drop domain dnull restrict; +drop domain dcheck restrict; + + +create domain ddef1 int4 DEFAULT 3; +create domain ddef2 oid DEFAULT '12'; +-- Type mixing, function returns int8 +create domain ddef3 text DEFAULT 5; +create sequence ddef4_seq; +create domain ddef4 int4 DEFAULT nextval('ddef4_seq'); +create domain ddef5 numeric(8,2) NOT NULL DEFAULT '12.12'; + +create table defaulttest + ( col1 ddef1 + , col2 ddef2 + , col3 ddef3 + , col4 ddef4 PRIMARY KEY + , col5 ddef1 NOT NULL DEFAULT NULL + , col6 ddef2 DEFAULT '88' + , col7 ddef4 DEFAULT 8000 + , col8 ddef5 + ); +insert into defaulttest(col4) values(0); -- fails, col5 defaults to null +alter table defaulttest alter column col5 drop default; +insert into defaulttest default values; -- succeeds, inserts domain default +-- We used to treat SET DEFAULT NULL as equivalent to DROP DEFAULT; wrong +alter table defaulttest alter column col5 set default null; +insert into defaulttest(col4) values(0); -- fails +alter table defaulttest alter column col5 drop default; +insert into defaulttest default values; +insert into defaulttest default values; + +-- Test defaults with copy +COPY defaulttest(col5) FROM stdin; +\. + +select * from defaulttest; + +drop table defaulttest cascade; + +-- Test ALTER DOMAIN .. NOT NULL +create domain dnotnulltest integer; +create table domnotnull +( col1 dnotnulltest +, col2 dnotnulltest +); + +insert into domnotnull default values; +alter domain dnotnulltest set not null; -- fails + +update domnotnull set col1 = 5; +alter domain dnotnulltest set not null; -- fails + +update domnotnull set col2 = 6; + +alter domain dnotnulltest set not null; + +update domnotnull set col1 = null; -- fails + +alter domain dnotnulltest drop not null; + +update domnotnull set col1 = null; + +drop domain dnotnulltest cascade; + +-- Test ALTER DOMAIN .. DEFAULT .. +create table domdeftest (col1 ddef1); + +insert into domdeftest default values; +select * from domdeftest; + +alter domain ddef1 set default '42'; +insert into domdeftest default values; +select * from domdeftest; + +alter domain ddef1 drop default; +insert into domdeftest default values; +select * from domdeftest; + +drop table domdeftest; + +-- Test ALTER DOMAIN .. CONSTRAINT .. +create domain con as integer; +create table domcontest (col1 con); + +insert into domcontest values (1); +insert into domcontest values (2); +alter domain con add constraint t check (VALUE < 1); -- fails + +alter domain con add constraint t check (VALUE < 34); +alter domain con add check (VALUE > 0); + +insert into domcontest values (-5); -- fails +insert into domcontest values (42); -- fails +insert into domcontest values (5); + +alter domain con drop constraint t; +insert into domcontest values (-5); --fails +insert into domcontest values (42); + +alter domain con drop constraint nonexistent; +alter domain con drop constraint if exists nonexistent; + +-- Test ALTER DOMAIN .. CONSTRAINT .. NOT VALID +create domain things AS INT; +CREATE TABLE thethings (stuff things); +INSERT INTO thethings (stuff) VALUES (55); +ALTER DOMAIN things ADD CONSTRAINT meow CHECK (VALUE < 11); +ALTER DOMAIN things ADD CONSTRAINT meow CHECK (VALUE < 11) NOT VALID; +ALTER DOMAIN things VALIDATE CONSTRAINT meow; +UPDATE thethings SET stuff = 10; +ALTER DOMAIN things VALIDATE CONSTRAINT meow; + +-- Confirm ALTER DOMAIN with RULES. +create table domtab (col1 integer); +create domain dom as integer; +create view domview as select cast(col1 as dom) from domtab; +insert into domtab (col1) values (null); +insert into domtab (col1) values (5); +select * from domview; + +alter domain dom set not null; +select * from domview; -- fail + +alter domain dom drop not null; +select * from domview; + +alter domain dom add constraint domchkgt6 check(value > 6); +select * from domview; --fail + +alter domain dom drop constraint domchkgt6 restrict; +select * from domview; + +-- cleanup +drop domain ddef1 restrict; +drop domain ddef2 restrict; +drop domain ddef3 restrict; +drop domain ddef4 restrict; +drop domain ddef5 restrict; +drop sequence ddef4_seq; + +-- Test domains over domains +create domain vchar4 varchar(4); +create domain dinter vchar4 check (substring(VALUE, 1, 1) = 'x'); +create domain dtop dinter check (substring(VALUE, 2, 1) = '1'); + +select 'x123'::dtop; +select 'x1234'::dtop; -- explicit coercion should truncate +select 'y1234'::dtop; -- fail +select 'y123'::dtop; -- fail +select 'yz23'::dtop; -- fail +select 'xz23'::dtop; -- fail + +create temp table dtest(f1 dtop); + +insert into dtest values('x123'); +insert into dtest values('x1234'); -- fail, implicit coercion +insert into dtest values('y1234'); -- fail, implicit coercion +insert into dtest values('y123'); -- fail +insert into dtest values('yz23'); -- fail +insert into dtest values('xz23'); -- fail + +drop table dtest; +drop domain vchar4 cascade; + +-- Make sure that constraints of newly-added domain columns are +-- enforced correctly, even if there's no default value for the new +-- column. Per bug #1433 +create domain str_domain as text not null; + +create table domain_test (a int, b int); + +insert into domain_test values (1, 2); +insert into domain_test values (1, 2); + +-- should fail +alter table domain_test add column c str_domain; + +create domain str_domain2 as text check (value <> 'foo') default 'foo'; + +-- should fail +alter table domain_test add column d str_domain2; + +-- Check that domain constraints on prepared statement parameters of +-- unknown type are enforced correctly. +create domain pos_int as int4 check (value > 0) not null; +prepare s1 as select $1::pos_int = 10 as "is_ten"; + +execute s1(10); +execute s1(0); -- should fail +execute s1(NULL); -- should fail + +-- Check that domain constraints on plpgsql function parameters, results, +-- and local variables are enforced correctly. + +create function doubledecrement(p1 pos_int) returns pos_int as $$ +declare v pos_int; +begin + return p1; +end$$ language plpgsql; + +select doubledecrement(3); -- fail because of implicit null assignment + +create or replace function doubledecrement(p1 pos_int) returns pos_int as $$ +declare v pos_int := 0; +begin + return p1; +end$$ language plpgsql; + +select doubledecrement(3); -- fail at initialization assignment + +create or replace function doubledecrement(p1 pos_int) returns pos_int as $$ +declare v pos_int := 1; +begin + v := p1 - 1; + return v - 1; +end$$ language plpgsql; + +select doubledecrement(null); -- fail before call +select doubledecrement(0); -- fail before call +select doubledecrement(1); -- fail at assignment to v +select doubledecrement(2); -- fail at return +select doubledecrement(3); -- good + +-- Check that ALTER DOMAIN tests columns of derived types + +create domain posint as int4; + +-- Currently, this doesn't work for composite types, but verify it complains +create type ddtest1 as (f1 posint); +create table ddtest2(f1 ddtest1); +insert into ddtest2 values(row(-1)); +alter domain posint add constraint c1 check(value >= 0); +drop table ddtest2; + +-- Likewise for domains within arrays of composite +create table ddtest2(f1 ddtest1[]); +insert into ddtest2 values('{(-1)}'); +alter domain posint add constraint c1 check(value >= 0); +drop table ddtest2; + +-- Likewise for domains within domains over composite +create domain ddtest1d as ddtest1; +create table ddtest2(f1 ddtest1d); +insert into ddtest2 values('(-1)'); +alter domain posint add constraint c1 check(value >= 0); +drop table ddtest2; +drop domain ddtest1d; + +-- Likewise for domains within domains over array of composite +create domain ddtest1d as ddtest1[]; +create table ddtest2(f1 ddtest1d); +insert into ddtest2 values('{(-1)}'); +alter domain posint add constraint c1 check(value >= 0); +drop table ddtest2; +drop domain ddtest1d; + +-- Doesn't work for ranges, either +create type rposint as range (subtype = posint); +create table ddtest2(f1 rposint); +insert into ddtest2 values('(-1,3]'); +alter domain posint add constraint c1 check(value >= 0); +drop table ddtest2; +drop type rposint; + +alter domain posint add constraint c1 check(value >= 0); + +create domain posint2 as posint check (value % 2 = 0); +create table ddtest2(f1 posint2); +insert into ddtest2 values(11); -- fail +insert into ddtest2 values(-2); -- fail +insert into ddtest2 values(2); + +alter domain posint add constraint c2 check(value >= 10); -- fail +alter domain posint add constraint c2 check(value > 0); -- OK + +drop table ddtest2; +drop type ddtest1; +drop domain posint cascade; + +-- +-- Check enforcement of domain-related typmod in plpgsql (bug #5717) +-- + +create or replace function array_elem_check(numeric) returns numeric as $$ +declare + x numeric(4,2)[1]; +begin + x[1] := $1; + return x[1]; +end$$ language plpgsql; + +select array_elem_check(121.00); +select array_elem_check(1.23456); + +create domain mynums as numeric(4,2)[1]; + +create or replace function array_elem_check(numeric) returns numeric as $$ +declare + x mynums; +begin + x[1] := $1; + return x[1]; +end$$ language plpgsql; + +select array_elem_check(121.00); +select array_elem_check(1.23456); + +create domain mynums2 as mynums; + +create or replace function array_elem_check(numeric) returns numeric as $$ +declare + x mynums2; +begin + x[1] := $1; + return x[1]; +end$$ language plpgsql; + +select array_elem_check(121.00); +select array_elem_check(1.23456); + +drop function array_elem_check(numeric); + +-- +-- Check enforcement of array-level domain constraints +-- + +create domain orderedpair as int[2] check (value[1] < value[2]); + +select array[1,2]::orderedpair; +select array[2,1]::orderedpair; -- fail + +create temp table op (f1 orderedpair); +insert into op values (array[1,2]); +insert into op values (array[2,1]); -- fail + +update op set f1[2] = 3; +update op set f1[2] = 0; -- fail +select * from op; + +create or replace function array_elem_check(int) returns int as $$ +declare + x orderedpair := '{1,2}'; +begin + x[2] := $1; + return x[2]; +end$$ language plpgsql; + +select array_elem_check(3); +select array_elem_check(-1); + +drop function array_elem_check(int); + +-- +-- Check enforcement of changing constraints in plpgsql +-- + +create domain di as int; + +create function dom_check(int) returns di as $$ +declare d di; +begin + d := $1::di; + return d; +end +$$ language plpgsql immutable; + +select dom_check(0); + +alter domain di add constraint pos check (value > 0); + +select dom_check(0); -- fail + +alter domain di drop constraint pos; + +select dom_check(0); + +-- implicit cast during assignment is a separate code path, test that too + +create or replace function dom_check(int) returns di as $$ +declare d di; +begin + d := $1; + return d; +end +$$ language plpgsql immutable; + +select dom_check(0); + +alter domain di add constraint pos check (value > 0); + +select dom_check(0); -- fail + +alter domain di drop constraint pos; + +select dom_check(0); + +drop function dom_check(int); + +drop domain di; + +-- +-- Check use of a (non-inline-able) SQL function in a domain constraint; +-- this has caused issues in the past +-- + +create function sql_is_distinct_from(anyelement, anyelement) +returns boolean language sql +as 'select $1 is distinct from $2 limit 1'; + +create domain inotnull int + check (sql_is_distinct_from(value, null)); + +select 1::inotnull; +select null::inotnull; + +create table dom_table (x inotnull); +insert into dom_table values ('1'); +insert into dom_table values (1); +insert into dom_table values (null); + +drop table dom_table; +drop domain inotnull; +drop function sql_is_distinct_from(anyelement, anyelement); + +-- +-- Renaming +-- + +create domain testdomain1 as int; +alter domain testdomain1 rename to testdomain2; +alter type testdomain2 rename to testdomain3; -- alter type also works +drop domain testdomain3; + + +-- +-- Renaming domain constraints +-- + +create domain testdomain1 as int constraint unsigned check (value > 0); +alter domain testdomain1 rename constraint unsigned to unsigned_foo; +alter domain testdomain1 drop constraint unsigned_foo; +drop domain testdomain1; diff --git a/postgresql/examples/drop_if_exists.sql b/postgresql/examples/drop_if_exists.sql new file mode 100644 index 0000000..a6920a6 --- /dev/null +++ b/postgresql/examples/drop_if_exists.sql @@ -0,0 +1,305 @@ +-- +-- IF EXISTS tests +-- + +-- table (will be really dropped at the end) + +DROP TABLE test_exists; + +DROP TABLE IF EXISTS test_exists; + +CREATE TABLE test_exists (a int, b text); + +-- view + +DROP VIEW test_view_exists; + +DROP VIEW IF EXISTS test_view_exists; + +CREATE VIEW test_view_exists AS select * from test_exists; + +DROP VIEW IF EXISTS test_view_exists; + +DROP VIEW test_view_exists; + +-- index + +DROP INDEX test_index_exists; + +DROP INDEX IF EXISTS test_index_exists; + +CREATE INDEX test_index_exists on test_exists(a); + +DROP INDEX IF EXISTS test_index_exists; + +DROP INDEX test_index_exists; + +-- sequence + +DROP SEQUENCE test_sequence_exists; + +DROP SEQUENCE IF EXISTS test_sequence_exists; + +CREATE SEQUENCE test_sequence_exists; + +DROP SEQUENCE IF EXISTS test_sequence_exists; + +DROP SEQUENCE test_sequence_exists; + +-- schema + +DROP SCHEMA test_schema_exists; + +DROP SCHEMA IF EXISTS test_schema_exists; + +CREATE SCHEMA test_schema_exists; + +DROP SCHEMA IF EXISTS test_schema_exists; + +DROP SCHEMA test_schema_exists; + +-- type + +DROP TYPE test_type_exists; + +DROP TYPE IF EXISTS test_type_exists; + +CREATE type test_type_exists as (a int, b text); + +DROP TYPE IF EXISTS test_type_exists; + +DROP TYPE test_type_exists; + +-- domain + +DROP DOMAIN test_domain_exists; + +DROP DOMAIN IF EXISTS test_domain_exists; + +CREATE domain test_domain_exists as int not null check (value > 0); + +DROP DOMAIN IF EXISTS test_domain_exists; + +DROP DOMAIN test_domain_exists; + +--- +--- role/user/group +--- + +CREATE USER regress_test_u1; +CREATE ROLE regress_test_r1; +CREATE GROUP regress_test_g1; + +DROP USER regress_test_u2; + +DROP USER IF EXISTS regress_test_u1, regress_test_u2; + +DROP USER regress_test_u1; + +DROP ROLE regress_test_r2; + +DROP ROLE IF EXISTS regress_test_r1, regress_test_r2; + +DROP ROLE regress_test_r1; + +DROP GROUP regress_test_g2; + +DROP GROUP IF EXISTS regress_test_g1, regress_test_g2; + +DROP GROUP regress_test_g1; + +-- collation +DROP COLLATION IF EXISTS test_collation_exists; + +-- conversion +DROP CONVERSION test_conversion_exists; +DROP CONVERSION IF EXISTS test_conversion_exists; +CREATE CONVERSION test_conversion_exists + FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8; +DROP CONVERSION test_conversion_exists; + +-- text search parser +DROP TEXT SEARCH PARSER test_tsparser_exists; +DROP TEXT SEARCH PARSER IF EXISTS test_tsparser_exists; + +-- text search dictionary +DROP TEXT SEARCH DICTIONARY test_tsdict_exists; +DROP TEXT SEARCH DICTIONARY IF EXISTS test_tsdict_exists; +CREATE TEXT SEARCH DICTIONARY test_tsdict_exists ( + Template=ispell, + DictFile=ispell_sample, + AffFile=ispell_sample +); +DROP TEXT SEARCH DICTIONARY test_tsdict_exists; + +-- test search template +DROP TEXT SEARCH TEMPLATE test_tstemplate_exists; +DROP TEXT SEARCH TEMPLATE IF EXISTS test_tstemplate_exists; + +-- text search configuration +DROP TEXT SEARCH CONFIGURATION test_tsconfig_exists; +DROP TEXT SEARCH CONFIGURATION IF EXISTS test_tsconfig_exists; +CREATE TEXT SEARCH CONFIGURATION test_tsconfig_exists (COPY=english); +DROP TEXT SEARCH CONFIGURATION test_tsconfig_exists; + +-- extension +DROP EXTENSION test_extension_exists; +DROP EXTENSION IF EXISTS test_extension_exists; + +-- functions +DROP FUNCTION test_function_exists(); +DROP FUNCTION IF EXISTS test_function_exists(); + +DROP FUNCTION test_function_exists(int, text, int[]); +DROP FUNCTION IF EXISTS test_function_exists(int, text, int[]); + +-- aggregate +DROP AGGREGATE test_aggregate_exists(*); +DROP AGGREGATE IF EXISTS test_aggregate_exists(*); + +DROP AGGREGATE test_aggregate_exists(int); +DROP AGGREGATE IF EXISTS test_aggregate_exists(int); + +-- operator +DROP OPERATOR @#@ (int, int); +DROP OPERATOR IF EXISTS @#@ (int, int); +CREATE OPERATOR @#@ + (leftarg = int8, rightarg = int8, procedure = int8xor); +DROP OPERATOR @#@ (int8, int8); + +-- language +DROP LANGUAGE test_language_exists; +DROP LANGUAGE IF EXISTS test_language_exists; + +-- cast +DROP CAST (text AS text); +DROP CAST IF EXISTS (text AS text); + +-- trigger +DROP TRIGGER test_trigger_exists ON test_exists; +DROP TRIGGER IF EXISTS test_trigger_exists ON test_exists; + +DROP TRIGGER test_trigger_exists ON no_such_table; +DROP TRIGGER IF EXISTS test_trigger_exists ON no_such_table; + +DROP TRIGGER test_trigger_exists ON no_such_schema.no_such_table; +DROP TRIGGER IF EXISTS test_trigger_exists ON no_such_schema.no_such_table; + +CREATE TRIGGER test_trigger_exists + BEFORE UPDATE ON test_exists + FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger(); +DROP TRIGGER test_trigger_exists ON test_exists; + +-- rule +DROP RULE test_rule_exists ON test_exists; +DROP RULE IF EXISTS test_rule_exists ON test_exists; + +DROP RULE test_rule_exists ON no_such_table; +DROP RULE IF EXISTS test_rule_exists ON no_such_table; + +DROP RULE test_rule_exists ON no_such_schema.no_such_table; +DROP RULE IF EXISTS test_rule_exists ON no_such_schema.no_such_table; + +CREATE RULE test_rule_exists AS ON INSERT TO test_exists + DO INSTEAD + INSERT INTO test_exists VALUES (NEW.a, NEW.b || NEW.a::text); +DROP RULE test_rule_exists ON test_exists; + +-- foreign data wrapper +DROP FOREIGN DATA WRAPPER test_fdw_exists; +DROP FOREIGN DATA WRAPPER IF EXISTS test_fdw_exists; + +-- foreign server +DROP SERVER test_server_exists; +DROP SERVER IF EXISTS test_server_exists; + +-- operator class +DROP OPERATOR CLASS test_operator_class USING btree; +DROP OPERATOR CLASS IF EXISTS test_operator_class USING btree; + +DROP OPERATOR CLASS test_operator_class USING no_such_am; +DROP OPERATOR CLASS IF EXISTS test_operator_class USING no_such_am; + +-- operator family +DROP OPERATOR FAMILY test_operator_family USING btree; +DROP OPERATOR FAMILY IF EXISTS test_operator_family USING btree; + +DROP OPERATOR FAMILY test_operator_family USING no_such_am; +DROP OPERATOR FAMILY IF EXISTS test_operator_family USING no_such_am; + +-- access method +DROP ACCESS METHOD no_such_am; +DROP ACCESS METHOD IF EXISTS no_such_am; + +-- drop the table + +DROP TABLE IF EXISTS test_exists; + +DROP TABLE test_exists; + +-- be tolerant with missing schemas, types, etc + +DROP AGGREGATE IF EXISTS no_such_schema.foo(int); +DROP AGGREGATE IF EXISTS foo(no_such_type); +DROP AGGREGATE IF EXISTS foo(no_such_schema.no_such_type); +DROP CAST IF EXISTS (INTEGER AS no_such_type2); +DROP CAST IF EXISTS (no_such_type1 AS INTEGER); +DROP CAST IF EXISTS (INTEGER AS no_such_schema.bar); +DROP CAST IF EXISTS (no_such_schema.foo AS INTEGER); +DROP COLLATION IF EXISTS no_such_schema.foo; +DROP CONVERSION IF EXISTS no_such_schema.foo; +DROP DOMAIN IF EXISTS no_such_schema.foo; +DROP FOREIGN TABLE IF EXISTS no_such_schema.foo; +DROP FUNCTION IF EXISTS no_such_schema.foo(); +DROP FUNCTION IF EXISTS foo(no_such_type); +DROP FUNCTION IF EXISTS foo(no_such_schema.no_such_type); +DROP INDEX IF EXISTS no_such_schema.foo; +DROP MATERIALIZED VIEW IF EXISTS no_such_schema.foo; +DROP OPERATOR IF EXISTS no_such_schema.+ (int, int); +DROP OPERATOR IF EXISTS + (no_such_type, no_such_type); +DROP OPERATOR IF EXISTS + (no_such_schema.no_such_type, no_such_schema.no_such_type); + +DROP OPERATOR CLASS IF EXISTS no_such_schema.widget_ops USING btree; +DROP OPERATOR FAMILY IF EXISTS no_such_schema.float_ops USING btree; +DROP RULE IF EXISTS foo ON no_such_schema.bar; +DROP SEQUENCE IF EXISTS no_such_schema.foo; +DROP TABLE IF EXISTS no_such_schema.foo; +DROP TEXT SEARCH CONFIGURATION IF EXISTS no_such_schema.foo; +DROP TEXT SEARCH DICTIONARY IF EXISTS no_such_schema.foo; +DROP TEXT SEARCH PARSER IF EXISTS no_such_schema.foo; +DROP TEXT SEARCH TEMPLATE IF EXISTS no_such_schema.foo; +DROP TRIGGER IF EXISTS foo ON no_such_schema.bar; +DROP TYPE IF EXISTS no_such_schema.foo; +DROP VIEW IF EXISTS no_such_schema.foo; + +-- Check we receive an ambiguous function error when there are +-- multiple matching functions. +CREATE FUNCTION test_ambiguous_funcname(int) returns int as $$ select $1; $$ language sql; +CREATE FUNCTION test_ambiguous_funcname(text) returns text as $$ select $1; $$ language sql; +DROP FUNCTION test_ambiguous_funcname; +DROP FUNCTION IF EXISTS test_ambiguous_funcname; + +-- cleanup +DROP FUNCTION test_ambiguous_funcname(int); +DROP FUNCTION test_ambiguous_funcname(text); + +-- Likewise for procedures. +CREATE PROCEDURE test_ambiguous_procname(int) as $$ begin end; $$ language plpgsql; +CREATE PROCEDURE test_ambiguous_procname(text) as $$ begin end; $$ language plpgsql; +DROP PROCEDURE test_ambiguous_procname; +DROP PROCEDURE IF EXISTS test_ambiguous_procname; + +-- Check we get a similar error if we use ROUTINE instead of PROCEDURE. +DROP ROUTINE IF EXISTS test_ambiguous_procname; + +-- cleanup +DROP PROCEDURE test_ambiguous_procname(int); +DROP PROCEDURE test_ambiguous_procname(text); + +-- This test checks both the functionality of 'if exists' and the syntax +-- of the drop database command. +drop database test_database_exists (force); +drop database test_database_exists with (force); +drop database if exists test_database_exists (force); +drop database if exists test_database_exists with (force); +DROP OPERATOR IF EXISTS # (NONE, no_such_schema.no_such_type); diff --git a/postgresql/examples/drop_operator.sql b/postgresql/examples/drop_operator.sql new file mode 100644 index 0000000..cc62cfa --- /dev/null +++ b/postgresql/examples/drop_operator.sql @@ -0,0 +1,56 @@ +CREATE OPERATOR === ( + PROCEDURE = int8eq, + LEFTARG = bigint, + RIGHTARG = bigint, + COMMUTATOR = === +); + +CREATE OPERATOR !== ( + PROCEDURE = int8ne, + LEFTARG = bigint, + RIGHTARG = bigint, + NEGATOR = ===, + COMMUTATOR = !== +); + +DROP OPERATOR !==(bigint, bigint); + +SELECT ctid, oprcom +FROM pg_catalog.pg_operator fk +WHERE oprcom != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.oprcom); + +SELECT ctid, oprnegate +FROM pg_catalog.pg_operator fk +WHERE oprnegate != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.oprnegate); + +DROP OPERATOR ===(bigint, bigint); + +CREATE OPERATOR <| ( + PROCEDURE = int8lt, + LEFTARG = bigint, + RIGHTARG = bigint +); + +CREATE OPERATOR |> ( + PROCEDURE = int8gt, + LEFTARG = bigint, + RIGHTARG = bigint, + NEGATOR = <|, + COMMUTATOR = <| +); + +DROP OPERATOR |>(bigint, bigint); + +SELECT ctid, oprcom +FROM pg_catalog.pg_operator fk +WHERE oprcom != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.oprcom); + +SELECT ctid, oprnegate +FROM pg_catalog.pg_operator fk +WHERE oprnegate != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.oprnegate); + +DROP OPERATOR <|(bigint, bigint); diff --git a/postgresql/examples/enum.sql b/postgresql/examples/enum.sql new file mode 100644 index 0000000..2ee7017 --- /dev/null +++ b/postgresql/examples/enum.sql @@ -0,0 +1,341 @@ +-- +-- Enum tests +-- + +CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple'); + +-- +-- Did it create the right number of rows? +-- +SELECT COUNT(*) FROM pg_enum WHERE enumtypid = 'rainbow'::regtype; + +-- +-- I/O functions +-- +SELECT 'red'::rainbow; +SELECT 'mauve'::rainbow; + +-- +-- adding new values +-- + +CREATE TYPE planets AS ENUM ( 'venus', 'earth', 'mars' ); + +SELECT enumlabel, enumsortorder +FROM pg_enum +WHERE enumtypid = 'planets'::regtype +ORDER BY 2; + +ALTER TYPE planets ADD VALUE 'uranus'; + +SELECT enumlabel, enumsortorder +FROM pg_enum +WHERE enumtypid = 'planets'::regtype +ORDER BY 2; + +ALTER TYPE planets ADD VALUE 'mercury' BEFORE 'venus'; +ALTER TYPE planets ADD VALUE 'saturn' BEFORE 'uranus'; +ALTER TYPE planets ADD VALUE 'jupiter' AFTER 'mars'; +ALTER TYPE planets ADD VALUE 'neptune' AFTER 'uranus'; + +SELECT enumlabel, enumsortorder +FROM pg_enum +WHERE enumtypid = 'planets'::regtype +ORDER BY 2; + +SELECT enumlabel, enumsortorder +FROM pg_enum +WHERE enumtypid = 'planets'::regtype +ORDER BY enumlabel::planets; + +-- errors for adding labels +ALTER TYPE planets ADD VALUE + 'plutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutoplutopluto'; + +ALTER TYPE planets ADD VALUE 'pluto' AFTER 'zeus'; + +-- if not exists tests + +-- existing value gives error +ALTER TYPE planets ADD VALUE 'mercury'; + +-- unless IF NOT EXISTS is specified +ALTER TYPE planets ADD VALUE IF NOT EXISTS 'mercury'; + +-- should be neptune, not mercury +SELECT enum_last(NULL::planets); + +ALTER TYPE planets ADD VALUE IF NOT EXISTS 'pluto'; + +-- should be pluto, i.e. the new value +SELECT enum_last(NULL::planets); + +-- +-- Test inserting so many values that we have to renumber +-- + +create type insenum as enum ('L1', 'L2'); + +alter type insenum add value 'i1' before 'L2'; +alter type insenum add value 'i2' before 'L2'; +alter type insenum add value 'i3' before 'L2'; +alter type insenum add value 'i4' before 'L2'; +alter type insenum add value 'i5' before 'L2'; +alter type insenum add value 'i6' before 'L2'; +alter type insenum add value 'i7' before 'L2'; +alter type insenum add value 'i8' before 'L2'; +alter type insenum add value 'i9' before 'L2'; +alter type insenum add value 'i10' before 'L2'; +alter type insenum add value 'i11' before 'L2'; +alter type insenum add value 'i12' before 'L2'; +alter type insenum add value 'i13' before 'L2'; +alter type insenum add value 'i14' before 'L2'; +alter type insenum add value 'i15' before 'L2'; +alter type insenum add value 'i16' before 'L2'; +alter type insenum add value 'i17' before 'L2'; +alter type insenum add value 'i18' before 'L2'; +alter type insenum add value 'i19' before 'L2'; +alter type insenum add value 'i20' before 'L2'; +alter type insenum add value 'i21' before 'L2'; +alter type insenum add value 'i22' before 'L2'; +alter type insenum add value 'i23' before 'L2'; +alter type insenum add value 'i24' before 'L2'; +alter type insenum add value 'i25' before 'L2'; +alter type insenum add value 'i26' before 'L2'; +alter type insenum add value 'i27' before 'L2'; +alter type insenum add value 'i28' before 'L2'; +alter type insenum add value 'i29' before 'L2'; +alter type insenum add value 'i30' before 'L2'; + +-- The exact values of enumsortorder will now depend on the local properties +-- of float4, but in any reasonable implementation we should get at least +-- 20 splits before having to renumber; so only hide values > 20. + +SELECT enumlabel, + case when enumsortorder > 20 then null else enumsortorder end as so +FROM pg_enum +WHERE enumtypid = 'insenum'::regtype +ORDER BY enumsortorder; + +-- +-- Basic table creation, row selection +-- +CREATE TABLE enumtest (col rainbow); +INSERT INTO enumtest values ('red'), ('orange'), ('yellow'), ('green'); +COPY enumtest FROM stdin; +--//blue +--//purple +--//\. +SELECT * FROM enumtest; + +-- +-- Operators, no index +-- +SELECT * FROM enumtest WHERE col = 'orange'; +SELECT * FROM enumtest WHERE col <> 'orange' ORDER BY col; +SELECT * FROM enumtest WHERE col > 'yellow' ORDER BY col; +SELECT * FROM enumtest WHERE col >= 'yellow' ORDER BY col; +SELECT * FROM enumtest WHERE col < 'green' ORDER BY col; +SELECT * FROM enumtest WHERE col <= 'green' ORDER BY col; + +-- +-- Cast to/from text +-- +SELECT 'red'::rainbow::text || 'hithere'; +SELECT 'red'::text::rainbow = 'red'::rainbow; + +-- +-- Aggregates +-- +SELECT min(col) FROM enumtest; +SELECT max(col) FROM enumtest; +SELECT max(col) FROM enumtest WHERE col < 'green'; + +-- +-- Index tests, force use of index +-- +SET enable_seqscan = off; +SET enable_bitmapscan = off; + +-- +-- Btree index / opclass with the various operators +-- +CREATE UNIQUE INDEX enumtest_btree ON enumtest USING btree (col); +SELECT * FROM enumtest WHERE col = 'orange'; +SELECT * FROM enumtest WHERE col <> 'orange' ORDER BY col; +SELECT * FROM enumtest WHERE col > 'yellow' ORDER BY col; +SELECT * FROM enumtest WHERE col >= 'yellow' ORDER BY col; +SELECT * FROM enumtest WHERE col < 'green' ORDER BY col; +SELECT * FROM enumtest WHERE col <= 'green' ORDER BY col; +SELECT min(col) FROM enumtest; +SELECT max(col) FROM enumtest; +SELECT max(col) FROM enumtest WHERE col < 'green'; +DROP INDEX enumtest_btree; + +-- +-- Hash index / opclass with the = operator +-- +CREATE INDEX enumtest_hash ON enumtest USING hash (col); +SELECT * FROM enumtest WHERE col = 'orange'; +DROP INDEX enumtest_hash; + +-- +-- End index tests +-- +RESET enable_seqscan; +RESET enable_bitmapscan; + +-- +-- Domains over enums +-- +CREATE DOMAIN rgb AS rainbow CHECK (VALUE IN ('red', 'green', 'blue')); +SELECT 'red'::rgb; +SELECT 'purple'::rgb; +SELECT 'purple'::rainbow::rgb; +DROP DOMAIN rgb; + +-- +-- Arrays +-- +SELECT '{red,green,blue}'::rainbow[]; +SELECT ('{red,green,blue}'::rainbow[])[2]; +SELECT 'red' = ANY ('{red,green,blue}'::rainbow[]); +SELECT 'yellow' = ANY ('{red,green,blue}'::rainbow[]); +SELECT 'red' = ALL ('{red,green,blue}'::rainbow[]); +SELECT 'red' = ALL ('{red,red}'::rainbow[]); + +-- +-- Support functions +-- +SELECT enum_first(NULL::rainbow); +SELECT enum_last('green'::rainbow); +SELECT enum_range(NULL::rainbow); +SELECT enum_range('orange'::rainbow, 'green'::rainbow); +SELECT enum_range(NULL, 'green'::rainbow); +SELECT enum_range('orange'::rainbow, NULL); +SELECT enum_range(NULL::rainbow, NULL); + +-- +-- User functions, can't test perl/python etc here since may not be compiled. +-- +CREATE FUNCTION echo_me(anyenum) RETURNS text AS $$ +BEGIN +RETURN $1::text || 'omg'; +END +$$ LANGUAGE plpgsql; +SELECT echo_me('red'::rainbow); +-- +-- Concrete function should override generic one +-- +CREATE FUNCTION echo_me(rainbow) RETURNS text AS $$ +BEGIN +RETURN $1::text || 'wtf'; +END +$$ LANGUAGE plpgsql; +SELECT echo_me('red'::rainbow); +-- +-- If we drop the original generic one, we don't have to qualify the type +-- anymore, since there's only one match +-- +DROP FUNCTION echo_me(anyenum); +SELECT echo_me('red'); +DROP FUNCTION echo_me(rainbow); + +-- +-- RI triggers on enum types +-- +CREATE TABLE enumtest_parent (id rainbow PRIMARY KEY); +CREATE TABLE enumtest_child (parent rainbow REFERENCES enumtest_parent); +INSERT INTO enumtest_parent VALUES ('red'); +INSERT INTO enumtest_child VALUES ('red'); +INSERT INTO enumtest_child VALUES ('blue'); -- fail +DELETE FROM enumtest_parent; -- fail +-- +-- cross-type RI should fail +-- +CREATE TYPE bogus AS ENUM('good', 'bad', 'ugly'); +CREATE TABLE enumtest_bogus_child(parent bogus REFERENCES enumtest_parent); +DROP TYPE bogus; + +-- check renaming a value +ALTER TYPE rainbow RENAME VALUE 'red' TO 'crimson'; +SELECT enumlabel, enumsortorder +FROM pg_enum +WHERE enumtypid = 'rainbow'::regtype +ORDER BY 2; +-- check that renaming a non-existent value fails +ALTER TYPE rainbow RENAME VALUE 'red' TO 'crimson'; +-- check that renaming to an existent value fails +ALTER TYPE rainbow RENAME VALUE 'blue' TO 'green'; + +-- +-- check transactional behaviour of ALTER TYPE ... ADD VALUE +-- +CREATE TYPE bogus AS ENUM('good'); + +-- check that we can add new values to existing enums in a transaction +-- but we can't use them +BEGIN; +ALTER TYPE bogus ADD VALUE 'new'; +SAVEPOINT x; +SELECT 'new'::bogus; -- unsafe +ROLLBACK TO x; +SELECT enum_first(null::bogus); -- safe +SELECT enum_last(null::bogus); -- unsafe +ROLLBACK TO x; +SELECT enum_range(null::bogus); -- unsafe +ROLLBACK TO x; +COMMIT; +SELECT 'new'::bogus; -- now safe +SELECT enumlabel, enumsortorder +FROM pg_enum +WHERE enumtypid = 'bogus'::regtype +ORDER BY 2; + +-- check that we recognize the case where the enum already existed but was +-- modified in the current txn; this should not be considered safe +BEGIN; +ALTER TYPE bogus RENAME TO bogon; +ALTER TYPE bogon ADD VALUE 'bad'; +SELECT 'bad'::bogon; +ROLLBACK; + +-- but a renamed value is safe to use later in same transaction +BEGIN; +ALTER TYPE bogus RENAME VALUE 'good' to 'bad'; +SELECT 'bad'::bogus; +ROLLBACK; + +DROP TYPE bogus; + +-- check that values created during CREATE TYPE can be used in any case +BEGIN; +CREATE TYPE bogus AS ENUM('good','bad','ugly'); +ALTER TYPE bogus RENAME TO bogon; +select enum_range(null::bogon); +ROLLBACK; + +-- ideally, we'd allow this usage; but it requires keeping track of whether +-- the enum type was created in the current transaction, which is expensive +BEGIN; +CREATE TYPE bogus AS ENUM('good'); +ALTER TYPE bogus RENAME TO bogon; +ALTER TYPE bogon ADD VALUE 'bad'; +ALTER TYPE bogon ADD VALUE 'ugly'; +select enum_range(null::bogon); -- fails +ROLLBACK; + +-- +-- Cleanup +-- +DROP TABLE enumtest_child; +DROP TABLE enumtest_parent; +DROP TABLE enumtest; +DROP TYPE rainbow; + +-- +-- Verify properly cleaned up +-- +SELECT COUNT(*) FROM pg_type WHERE typname = 'rainbow'; +SELECT * FROM pg_enum WHERE NOT EXISTS + (SELECT 1 FROM pg_type WHERE pg_type.oid = enumtypid); diff --git a/postgresql/examples/equivclass.sql b/postgresql/examples/equivclass.sql new file mode 100644 index 0000000..247b0a3 --- /dev/null +++ b/postgresql/examples/equivclass.sql @@ -0,0 +1,271 @@ +-- +-- Tests for the planner's "equivalence class" mechanism +-- + +-- One thing that's not tested well during normal querying is the logic +-- for handling "broken" ECs. This is because an EC can only become broken +-- if its underlying btree operator family doesn't include a complete set +-- of cross-type equality operators. There are not (and should not be) +-- any such families built into Postgres; so we have to hack things up +-- to create one. We do this by making two alias types that are really +-- int8 (so we need no new C code) and adding only some operators for them +-- into the standard integer_ops opfamily. + +create type int8alias1; +create function int8alias1in(cstring) returns int8alias1 + strict immutable language internal as 'int8in'; +create function int8alias1out(int8alias1) returns cstring + strict immutable language internal as 'int8out'; +create type int8alias1 ( + input = int8alias1in, + output = int8alias1out, + like = int8 +); + +create type int8alias2; +create function int8alias2in(cstring) returns int8alias2 + strict immutable language internal as 'int8in'; +create function int8alias2out(int8alias2) returns cstring + strict immutable language internal as 'int8out'; +create type int8alias2 ( + input = int8alias2in, + output = int8alias2out, + like = int8 +); + +create cast (int8 as int8alias1) without function; +create cast (int8 as int8alias2) without function; +create cast (int8alias1 as int8) without function; +create cast (int8alias2 as int8) without function; + +create function int8alias1eq(int8alias1, int8alias1) returns bool + strict immutable language internal as 'int8eq'; +create operator = ( + procedure = int8alias1eq, + leftarg = int8alias1, rightarg = int8alias1, + commutator = =, + restrict = eqsel, join = eqjoinsel, + merges +); +alter operator family integer_ops using btree add + operator 3 = (int8alias1, int8alias1); + +create function int8alias2eq(int8alias2, int8alias2) returns bool + strict immutable language internal as 'int8eq'; +create operator = ( + procedure = int8alias2eq, + leftarg = int8alias2, rightarg = int8alias2, + commutator = =, + restrict = eqsel, join = eqjoinsel, + merges +); +alter operator family integer_ops using btree add + operator 3 = (int8alias2, int8alias2); + +create function int8alias1eq(int8, int8alias1) returns bool + strict immutable language internal as 'int8eq'; +create operator = ( + procedure = int8alias1eq, + leftarg = int8, rightarg = int8alias1, + restrict = eqsel, join = eqjoinsel, + merges +); +alter operator family integer_ops using btree add + operator 3 = (int8, int8alias1); + +create function int8alias1eq(int8alias1, int8alias2) returns bool + strict immutable language internal as 'int8eq'; +create operator = ( + procedure = int8alias1eq, + leftarg = int8alias1, rightarg = int8alias2, + restrict = eqsel, join = eqjoinsel, + merges +); +alter operator family integer_ops using btree add + operator 3 = (int8alias1, int8alias2); + +create function int8alias1lt(int8alias1, int8alias1) returns bool + strict immutable language internal as 'int8lt'; +create operator < ( + procedure = int8alias1lt, + leftarg = int8alias1, rightarg = int8alias1 +); +alter operator family integer_ops using btree add + operator 1 < (int8alias1, int8alias1); + +create function int8alias1cmp(int8, int8alias1) returns int + strict immutable language internal as 'btint8cmp'; +alter operator family integer_ops using btree add + function 1 int8alias1cmp (int8, int8alias1); + +create table ec0 (ff int8 primary key, f1 int8, f2 int8); +create table ec1 (ff int8 primary key, f1 int8alias1, f2 int8alias2); +create table ec2 (xf int8 primary key, x1 int8alias1, x2 int8alias2); + +-- for the moment we only want to look at nestloop plans +set enable_hashjoin = off; +set enable_mergejoin = off; + +-- +-- Note that for cases where there's a missing operator, we don't care so +-- much whether the plan is ideal as that we don't fail or generate an +-- outright incorrect plan. +-- + +explain (costs off) + select * from ec0 where ff = f1 and f1 = '42'::int8; +explain (costs off) + select * from ec0 where ff = f1 and f1 = '42'::int8alias1; +explain (costs off) + select * from ec1 where ff = f1 and f1 = '42'::int8alias1; +explain (costs off) + select * from ec1 where ff = f1 and f1 = '42'::int8alias2; + +explain (costs off) + select * from ec1, ec2 where ff = x1 and ff = '42'::int8; +explain (costs off) + select * from ec1, ec2 where ff = x1 and ff = '42'::int8alias1; +explain (costs off) + select * from ec1, ec2 where ff = x1 and '42'::int8 = x1; +explain (costs off) + select * from ec1, ec2 where ff = x1 and x1 = '42'::int8alias1; +explain (costs off) + select * from ec1, ec2 where ff = x1 and x1 = '42'::int8alias2; + +create unique index ec1_expr1 on ec1((ff + 1)); +create unique index ec1_expr2 on ec1((ff + 2 + 1)); +create unique index ec1_expr3 on ec1((ff + 3 + 1)); +create unique index ec1_expr4 on ec1((ff + 4)); + +explain (costs off) + select * from ec1, + (select ff + 1 as x from + (select ff + 2 as ff from ec1 + union all + select ff + 3 as ff from ec1) ss0 + union all + select ff + 4 as x from ec1) as ss1 + where ss1.x = ec1.f1 and ec1.ff = 42::int8; + +explain (costs off) + select * from ec1, + (select ff + 1 as x from + (select ff + 2 as ff from ec1 + union all + select ff + 3 as ff from ec1) ss0 + union all + select ff + 4 as x from ec1) as ss1 + where ss1.x = ec1.f1 and ec1.ff = 42::int8 and ec1.ff = ec1.f1; + +explain (costs off) + select * from ec1, + (select ff + 1 as x from + (select ff + 2 as ff from ec1 + union all + select ff + 3 as ff from ec1) ss0 + union all + select ff + 4 as x from ec1) as ss1, + (select ff + 1 as x from + (select ff + 2 as ff from ec1 + union all + select ff + 3 as ff from ec1) ss0 + union all + select ff + 4 as x from ec1) as ss2 + where ss1.x = ec1.f1 and ss1.x = ss2.x and ec1.ff = 42::int8; + +-- let's try that as a mergejoin +set enable_mergejoin = on; +set enable_nestloop = off; + +explain (costs off) + select * from ec1, + (select ff + 1 as x from + (select ff + 2 as ff from ec1 + union all + select ff + 3 as ff from ec1) ss0 + union all + select ff + 4 as x from ec1) as ss1, + (select ff + 1 as x from + (select ff + 2 as ff from ec1 + union all + select ff + 3 as ff from ec1) ss0 + union all + select ff + 4 as x from ec1) as ss2 + where ss1.x = ec1.f1 and ss1.x = ss2.x and ec1.ff = 42::int8; + +-- check partially indexed scan +set enable_nestloop = on; +set enable_mergejoin = off; + +drop index ec1_expr3; + +explain (costs off) + select * from ec1, + (select ff + 1 as x from + (select ff + 2 as ff from ec1 + union all + select ff + 3 as ff from ec1) ss0 + union all + select ff + 4 as x from ec1) as ss1 + where ss1.x = ec1.f1 and ec1.ff = 42::int8; + +-- let's try that as a mergejoin +set enable_mergejoin = on; +set enable_nestloop = off; + +explain (costs off) + select * from ec1, + (select ff + 1 as x from + (select ff + 2 as ff from ec1 + union all + select ff + 3 as ff from ec1) ss0 + union all + select ff + 4 as x from ec1) as ss1 + where ss1.x = ec1.f1 and ec1.ff = 42::int8; + +-- check effects of row-level security +set enable_nestloop = on; +set enable_mergejoin = off; + +alter table ec1 enable row level security; +create policy p1 on ec1 using (f1 < '5'::int8alias1); + +create user regress_user_ectest; +grant select on ec0 to regress_user_ectest; +grant select on ec1 to regress_user_ectest; + +-- without any RLS, we'll treat {a.ff, b.ff, 43} as an EquivalenceClass +explain (costs off) + select * from ec0 a, ec1 b + where a.ff = b.ff and a.ff = 43::bigint::int8alias1; + +set session authorization regress_user_ectest; + +-- with RLS active, the non-leakproof a.ff = 43 clause is not treated +-- as a suitable source for an EquivalenceClass; currently, this is true +-- even though the RLS clause has nothing to do directly with the EC +explain (costs off) + select * from ec0 a, ec1 b + where a.ff = b.ff and a.ff = 43::bigint::int8alias1; + +reset session authorization; + +revoke select on ec0 from regress_user_ectest; +revoke select on ec1 from regress_user_ectest; + +drop user regress_user_ectest; + +-- check that X=X is converted to X IS NOT NULL when appropriate +explain (costs off) + select * from tenk1 where unique1 = unique1 and unique2 = unique2; + +-- this could be converted, but isn't at present +explain (costs off) + select * from tenk1 where unique1 = unique1 or unique2 = unique2; + +-- check that we recognize equivalence with dummy domains in the way +create temp table undername (f1 name, f2 int); +create temp view overview as + select f1::information_schema.sql_identifier as sqli, f2 from undername; +explain (costs off) -- this should not require a sort + select * from overview where sqli = 'foo' order by sqli; diff --git a/postgresql/examples/event_trigger.sql b/postgresql/examples/event_trigger.sql new file mode 100644 index 0000000..b859397 --- /dev/null +++ b/postgresql/examples/event_trigger.sql @@ -0,0 +1,431 @@ +-- should fail, return type mismatch +create event trigger regress_event_trigger + on ddl_command_start + execute procedure pg_backend_pid(); + +-- OK +create function test_event_trigger() returns event_trigger as $$ +BEGIN + RAISE NOTICE 'test_event_trigger: % %', tg_event, tg_tag; +END +$$ language plpgsql; + +-- should fail, can't call it as a plain function +SELECT test_event_trigger(); + +-- should fail, event triggers cannot have declared arguments +create function test_event_trigger_arg(name text) +returns event_trigger as $$ BEGIN RETURN 1; END $$ language plpgsql; + +-- should fail, SQL functions cannot be event triggers +create function test_event_trigger_sql() returns event_trigger as $$ +SELECT 1 $$ language sql; + +-- should fail, no elephant_bootstrap entry point +create event trigger regress_event_trigger on elephant_bootstrap + execute procedure test_event_trigger(); + +-- OK +create event trigger regress_event_trigger on ddl_command_start + execute procedure test_event_trigger(); + +-- OK +create event trigger regress_event_trigger_end on ddl_command_end + execute function test_event_trigger(); + +-- should fail, food is not a valid filter variable +create event trigger regress_event_trigger2 on ddl_command_start + when food in ('sandwich') + execute procedure test_event_trigger(); + +-- should fail, sandwich is not a valid command tag +create event trigger regress_event_trigger2 on ddl_command_start + when tag in ('sandwich') + execute procedure test_event_trigger(); + +-- should fail, create skunkcabbage is not a valid command tag +create event trigger regress_event_trigger2 on ddl_command_start + when tag in ('create table', 'create skunkcabbage') + execute procedure test_event_trigger(); + +-- should fail, can't have event triggers on event triggers +create event trigger regress_event_trigger2 on ddl_command_start + when tag in ('DROP EVENT TRIGGER') + execute procedure test_event_trigger(); + +-- should fail, can't have event triggers on global objects +create event trigger regress_event_trigger2 on ddl_command_start + when tag in ('CREATE ROLE') + execute procedure test_event_trigger(); + +-- should fail, can't have event triggers on global objects +create event trigger regress_event_trigger2 on ddl_command_start + when tag in ('CREATE DATABASE') + execute procedure test_event_trigger(); + +-- should fail, can't have event triggers on global objects +create event trigger regress_event_trigger2 on ddl_command_start + when tag in ('CREATE TABLESPACE') + execute procedure test_event_trigger(); + +-- should fail, can't have same filter variable twice +create event trigger regress_event_trigger2 on ddl_command_start + when tag in ('create table') and tag in ('CREATE FUNCTION') + execute procedure test_event_trigger(); + +-- should fail, can't have arguments +--create event trigger regress_event_trigger2 on ddl_command_start +-- execute procedure test_event_trigger('argument not allowed'); + +-- OK +create event trigger regress_event_trigger2 on ddl_command_start + when tag in ('create table', 'CREATE FUNCTION') + execute procedure test_event_trigger(); + +-- OK +comment on event trigger regress_event_trigger is 'test comment'; + +-- drop as non-superuser should fail +create role regress_evt_user; +set role regress_evt_user; +create event trigger regress_event_trigger_noperms on ddl_command_start + execute procedure test_event_trigger(); +reset role; + +-- test enabling and disabling +alter event trigger regress_event_trigger disable; +-- fires _trigger2 and _trigger_end should fire, but not _trigger +create table event_trigger_fire1 (a int); +alter event trigger regress_event_trigger enable; +set session_replication_role = replica; +-- fires nothing +create table event_trigger_fire2 (a int); +alter event trigger regress_event_trigger enable replica; +-- fires only _trigger +create table event_trigger_fire3 (a int); +alter event trigger regress_event_trigger enable always; +-- fires only _trigger +create table event_trigger_fire4 (a int); +reset session_replication_role; +-- fires all three +create table event_trigger_fire5 (a int); +-- non-top-level command +create function f1() returns int +language plpgsql +as $$ +begin + create table event_trigger_fire6 (a int); + return 0; +end $$; +select f1(); +-- non-top-level command +create procedure p1() +language plpgsql +as $$ +begin + create table event_trigger_fire7 (a int); +end $$; +call p1(); + +-- clean up +alter event trigger regress_event_trigger disable; +drop table event_trigger_fire2, event_trigger_fire3, event_trigger_fire4, event_trigger_fire5, event_trigger_fire6, event_trigger_fire7; +drop routine f1(), p1(); + +-- regress_event_trigger_end should fire on these commands +grant all on table event_trigger_fire1 to public; +comment on table event_trigger_fire1 is 'here is a comment'; +revoke all on table event_trigger_fire1 from public; +drop table event_trigger_fire1; +create foreign data wrapper useless; +create server useless_server foreign data wrapper useless; +create user mapping for regress_evt_user server useless_server; +alter default privileges for role regress_evt_user + revoke delete on tables from regress_evt_user; + +-- alter owner to non-superuser should fail +alter event trigger regress_event_trigger owner to regress_evt_user; + +-- alter owner to superuser should work +alter role regress_evt_user superuser; +alter event trigger regress_event_trigger owner to regress_evt_user; + +-- should fail, name collision +alter event trigger regress_event_trigger rename to regress_event_trigger2; + +-- OK +alter event trigger regress_event_trigger rename to regress_event_trigger3; + +-- should fail, doesn't exist any more +drop event trigger regress_event_trigger; + +-- should fail, regress_evt_user owns some objects +drop role regress_evt_user; + +-- cleanup before next test +-- these are all OK; the second one should emit a NOTICE +drop event trigger if exists regress_event_trigger2; +drop event trigger if exists regress_event_trigger2; +drop event trigger regress_event_trigger3; +drop event trigger regress_event_trigger_end; + +-- test support for dropped objects +CREATE SCHEMA schema_one authorization regress_evt_user; +CREATE SCHEMA schema_two authorization regress_evt_user; +CREATE SCHEMA audit_tbls authorization regress_evt_user; +CREATE TEMP TABLE a_temp_tbl (); +SET SESSION AUTHORIZATION regress_evt_user; + +CREATE TABLE schema_one.table_one(a int); +CREATE TABLE schema_one."table two"(a int); +CREATE TABLE schema_one.table_three(a int); +CREATE TABLE audit_tbls.schema_one_table_two(the_value text); + +CREATE TABLE schema_two.table_two(a int); +CREATE TABLE schema_two.table_three(a int, b text); +CREATE TABLE audit_tbls.schema_two_table_three(the_value text); + +CREATE OR REPLACE FUNCTION schema_two.add(int, int) RETURNS int LANGUAGE plpgsql + CALLED ON NULL INPUT + AS $$ BEGIN RETURN coalesce($1,0) + coalesce($2,0); END; $$; +CREATE AGGREGATE schema_two.newton + (BASETYPE = int, SFUNC = schema_two.add, STYPE = int); + +RESET SESSION AUTHORIZATION; + +CREATE TABLE undroppable_objs ( + object_type text, + object_identity text +); +INSERT INTO undroppable_objs VALUES +('table', 'schema_one.table_three'), +('table', 'audit_tbls.schema_two_table_three'); + +CREATE TABLE dropped_objects ( + type text, + schema text, + object text +); + +-- This tests errors raised within event triggers; the one in audit_tbls +-- uses 2nd-level recursive invocation via test_evtrig_dropped_objects(). +CREATE OR REPLACE FUNCTION undroppable() RETURNS event_trigger +LANGUAGE plpgsql AS $$ +DECLARE + obj record; +BEGIN + PERFORM 1 FROM pg_tables WHERE tablename = 'undroppable_objs'; + IF NOT FOUND THEN + RAISE NOTICE 'table undroppable_objs not found, skipping'; + RETURN; + END IF; + FOR obj IN + SELECT * FROM pg_event_trigger_dropped_objects() JOIN + undroppable_objs USING (object_type, object_identity) + LOOP + RAISE EXCEPTION 'object % of type % cannot be dropped', + obj.object_identity, obj.object_type; + END LOOP; +END; +$$; + +CREATE EVENT TRIGGER undroppable ON sql_drop + EXECUTE PROCEDURE undroppable(); + +CREATE OR REPLACE FUNCTION test_evtrig_dropped_objects() RETURNS event_trigger +LANGUAGE plpgsql AS $$ +DECLARE + obj record; +BEGIN + FOR obj IN SELECT * FROM pg_event_trigger_dropped_objects() + LOOP + IF obj.object_type = 'table' THEN + EXECUTE format('DROP TABLE IF EXISTS audit_tbls.%I', + format('%s_%s', obj.schema_name, obj.object_name)); + END IF; + + INSERT INTO dropped_objects + (type, schema, object) VALUES + (obj.object_type, obj.schema_name, obj.object_identity); + END LOOP; +END +$$; + +CREATE EVENT TRIGGER regress_event_trigger_drop_objects ON sql_drop + WHEN TAG IN ('drop table', 'drop function', 'drop view', + 'drop owned', 'drop schema', 'alter table') + EXECUTE PROCEDURE test_evtrig_dropped_objects(); + +ALTER TABLE schema_one.table_one DROP COLUMN a; +DROP SCHEMA schema_one, schema_two CASCADE; +DELETE FROM undroppable_objs WHERE object_identity = 'audit_tbls.schema_two_table_three'; +DROP SCHEMA schema_one, schema_two CASCADE; +DELETE FROM undroppable_objs WHERE object_identity = 'schema_one.table_three'; +DROP SCHEMA schema_one, schema_two CASCADE; + +SELECT * FROM dropped_objects WHERE schema IS NULL OR schema <> 'pg_toast'; + +DROP OWNED BY regress_evt_user; +SELECT * FROM dropped_objects WHERE type = 'schema'; + +DROP ROLE regress_evt_user; + +DROP EVENT TRIGGER regress_event_trigger_drop_objects; +DROP EVENT TRIGGER undroppable; + +CREATE OR REPLACE FUNCTION event_trigger_report_dropped() + RETURNS event_trigger + LANGUAGE plpgsql +AS $$ +DECLARE r record; +BEGIN + FOR r IN SELECT * from pg_event_trigger_dropped_objects() + LOOP + IF NOT r.normal AND NOT r.original THEN + CONTINUE; + END IF; + RAISE NOTICE 'NORMAL: orig=% normal=% istemp=% type=% identity=% name=% args=%', + r.original, r.normal, r.is_temporary, r.object_type, + r.object_identity, r.address_names, r.address_args; + END LOOP; +END; $$; +CREATE EVENT TRIGGER regress_event_trigger_report_dropped ON sql_drop + EXECUTE PROCEDURE event_trigger_report_dropped(); +CREATE SCHEMA evttrig + CREATE TABLE one (col_a SERIAL PRIMARY KEY, col_b text DEFAULT 'forty two') + CREATE INDEX one_idx ON one (col_b) + CREATE TABLE two (col_c INTEGER CHECK (col_c > 0) REFERENCES one DEFAULT 42); + +-- Partitioned tables with a partitioned index +CREATE TABLE evttrig.parted ( + id int PRIMARY KEY) + PARTITION BY RANGE (id); +CREATE TABLE evttrig.part_1_10 PARTITION OF evttrig.parted (id) + FOR VALUES FROM (1) TO (10); +CREATE TABLE evttrig.part_10_20 PARTITION OF evttrig.parted (id) + FOR VALUES FROM (10) TO (20) PARTITION BY RANGE (id); +CREATE TABLE evttrig.part_10_15 PARTITION OF evttrig.part_10_20 (id) + FOR VALUES FROM (10) TO (15); +CREATE TABLE evttrig.part_15_20 PARTITION OF evttrig.part_10_20 (id) + FOR VALUES FROM (15) TO (20); + +ALTER TABLE evttrig.two DROP COLUMN col_c; +ALTER TABLE evttrig.one ALTER COLUMN col_b DROP DEFAULT; +ALTER TABLE evttrig.one DROP CONSTRAINT one_pkey; +DROP INDEX evttrig.one_idx; +DROP SCHEMA evttrig CASCADE; +DROP TABLE a_temp_tbl; + +DROP EVENT TRIGGER regress_event_trigger_report_dropped; + +-- only allowed from within an event trigger function, should fail +select pg_event_trigger_table_rewrite_oid(); + +-- test Table Rewrite Event Trigger +CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger +LANGUAGE plpgsql AS $$ +BEGIN + RAISE EXCEPTION 'rewrites not allowed'; +END; +$$; + +create event trigger no_rewrite_allowed on table_rewrite + execute procedure test_evtrig_no_rewrite(); + +create table rewriteme (id serial primary key, foo float, bar timestamptz); +insert into rewriteme + select x * 1.001 from generate_series(1, 500) as t(x); +alter table rewriteme alter column foo type numeric; +alter table rewriteme add column baz int default 0; + +-- test with more than one reason to rewrite a single table +CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger +LANGUAGE plpgsql AS $$ +BEGIN + RAISE NOTICE 'Table ''%'' is being rewritten (reason = %)', + pg_event_trigger_table_rewrite_oid()::regclass, + pg_event_trigger_table_rewrite_reason(); +END; +$$; + +alter table rewriteme + add column onemore int default 0, + add column another int default -1, + alter column foo type numeric(10,4); + +-- shouldn't trigger a table_rewrite event +alter table rewriteme alter column foo type numeric(12,4); +begin; +set timezone to 'UTC'; +alter table rewriteme alter column bar type timestamp; +set timezone to '0'; +alter table rewriteme alter column bar type timestamptz; +set timezone to 'Europe/London'; +alter table rewriteme alter column bar type timestamp; -- does rewrite +rollback; + +-- typed tables are rewritten when their type changes. Don't emit table +-- name, because firing order is not stable. +CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger +LANGUAGE plpgsql AS $$ +BEGIN + RAISE NOTICE 'Table is being rewritten (reason = %)', + pg_event_trigger_table_rewrite_reason(); +END; +$$; + +create type rewritetype as (a int); +create table rewritemetoo1 of rewritetype; +create table rewritemetoo2 of rewritetype; +alter type rewritetype alter attribute a type text cascade; + +-- but this doesn't work +create table rewritemetoo3 (a rewritetype); +alter type rewritetype alter attribute a type varchar cascade; + +drop table rewriteme; +drop event trigger no_rewrite_allowed; +drop function test_evtrig_no_rewrite(); + +-- test Row Security Event Trigger +RESET SESSION AUTHORIZATION; +CREATE TABLE event_trigger_test (a integer, b text); + +CREATE OR REPLACE FUNCTION start_command() +RETURNS event_trigger AS $$ +BEGIN +RAISE NOTICE '% - ddl_command_start', tg_tag; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION end_command() +RETURNS event_trigger AS $$ +BEGIN +RAISE NOTICE '% - ddl_command_end', tg_tag; +END; +$$ LANGUAGE plpgsql; + +CREATE OR REPLACE FUNCTION drop_sql_command() +RETURNS event_trigger AS $$ +BEGIN +RAISE NOTICE '% - sql_drop', tg_tag; +END; +$$ LANGUAGE plpgsql; + +CREATE EVENT TRIGGER start_rls_command ON ddl_command_start + WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE start_command(); + +CREATE EVENT TRIGGER end_rls_command ON ddl_command_end + WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE end_command(); + +CREATE EVENT TRIGGER sql_drop_command ON sql_drop + WHEN TAG IN ('DROP POLICY') EXECUTE PROCEDURE drop_sql_command(); + +CREATE POLICY p1 ON event_trigger_test USING (FALSE); +ALTER POLICY p1 ON event_trigger_test USING (TRUE); +ALTER POLICY p1 ON event_trigger_test RENAME TO p2; +DROP POLICY p2 ON event_trigger_test; + +DROP EVENT TRIGGER start_rls_command; +DROP EVENT TRIGGER end_rls_command; +DROP EVENT TRIGGER sql_drop_command; diff --git a/postgresql/examples/explain.sql b/postgresql/examples/explain.sql new file mode 100644 index 0000000..dce2a34 --- /dev/null +++ b/postgresql/examples/explain.sql @@ -0,0 +1,102 @@ +-- +-- EXPLAIN +-- +-- There are many test cases elsewhere that use EXPLAIN as a vehicle for +-- checking something else (usually planner behavior). This file is +-- concerned with testing EXPLAIN in its own right. +-- + +-- To produce stable regression test output, it's usually necessary to +-- ignore details such as exact costs or row counts. These filter +-- functions replace changeable output details with fixed strings. + +create function explain_filter(text) returns setof text +language plpgsql as +$$ +declare + ln text; +begin + for ln in execute $1 + loop + -- Replace any numeric word with just 'N' + ln := regexp_replace(ln, '\m\d+\M', 'N', 'g'); + -- In sort output, the above won't match units-suffixed numbers + ln := regexp_replace(ln, '\m\d+kB', 'NkB', 'g'); + -- Ignore text-mode buffers output because it varies depending + -- on the system state + CONTINUE WHEN (ln ~ ' +Buffers: .*'); + return next ln; + end loop; +end; +$$; + +-- To produce valid JSON output, replace numbers with "0" or "0.0" not "N" +create function explain_filter_to_json(text) returns jsonb +language plpgsql as +$$ +declare + data text := ''; + ln text; +begin + for ln in execute $1 + loop + -- Replace any numeric word with just '0' + ln := regexp_replace(ln, '\m\d+\M', '0', 'g'); + data := data || ln; + end loop; + return data::jsonb; +end; +$$; + +-- Simple cases + +select explain_filter('explain select * from int8_tbl i8'); +select explain_filter('explain (analyze) select * from int8_tbl i8'); +select explain_filter('explain (analyze, verbose) select * from int8_tbl i8'); +select explain_filter('explain (analyze, buffers, format text) select * from int8_tbl i8'); +select explain_filter('explain (analyze, buffers, format json) select * from int8_tbl i8'); +select explain_filter('explain (analyze, buffers, format xml) select * from int8_tbl i8'); +select explain_filter('explain (analyze, buffers, format yaml) select * from int8_tbl i8'); + +-- SETTINGS option +-- We have to ignore other settings that might be imposed by the environment, +-- so printing the whole Settings field unfortunately won't do. + +begin; +set local plan_cache_mode = force_generic_plan; +select true as "OK" + from explain_filter('explain (settings) select * from int8_tbl i8') ln + where ln ~ '^ *Settings: .*plan_cache_mode = ''force_generic_plan'''; +select explain_filter_to_json('explain (settings, format json) select * from int8_tbl i8') #> '{0,Settings,plan_cache_mode}'; +rollback; + +-- +-- Test production of per-worker data +-- +-- Unfortunately, because we don't know how many worker processes we'll +-- actually get (maybe none at all), we can't examine the "Workers" output +-- in any detail. We can check that it parses correctly as JSON, and then +-- remove it from the displayed results. + +-- Serializable isolation would disable parallel query, so explicitly use an +-- arbitrary other level. +begin isolation level repeatable read; +-- encourage use of parallel plans +set parallel_setup_cost=0; +set parallel_tuple_cost=0; +set min_parallel_table_scan_size=0; +set max_parallel_workers_per_gather=4; + +select jsonb_pretty( + explain_filter_to_json('explain (analyze, verbose, buffers, format json) + select * from tenk1 order by tenthous') + -- remove "Workers" node of the Seq Scan plan node + #- '{0,Plan,Plans,0,Plans,0,Workers}' + -- remove "Workers" node of the Sort plan node + #- '{0,Plan,Plans,0,Workers}' + -- Also remove its sort-type fields, as those aren't 100% stable + #- '{0,Plan,Plans,0,Sort Method}' + #- '{0,Plan,Plans,0,Sort Space Type}' +); + +rollback; diff --git a/postgresql/examples/expressions.sql b/postgresql/examples/expressions.sql new file mode 100644 index 0000000..1ca8bb1 --- /dev/null +++ b/postgresql/examples/expressions.sql @@ -0,0 +1,67 @@ +-- +-- expression evaluation tests that don't fit into a more specific file +-- + +-- +-- Tests for SQLVAlueFunction +-- + + +-- current_date (always matches because of transactional behaviour) +SELECT date(now())::text = current_date::text; + + +-- current_time / localtime +SELECT now()::timetz::text = current_time::text; +SELECT now()::timetz(4)::text = current_time(4)::text; +SELECT now()::time::text = localtime::text; +SELECT now()::time(3)::text = localtime(3)::text; + +-- current_timestamp / localtimestamp (always matches because of transactional behaviour) +SELECT current_timestamp = NOW(); +-- precision +SELECT length(current_timestamp::text) >= length(current_timestamp(0)::text); +-- localtimestamp +SELECT now()::timestamp::text = localtimestamp::text; + +-- current_role/user/user is tested in rolnames.sql + +-- current database / catalog +SELECT current_catalog = current_database(); + +-- current_schema +SELECT current_schema; +SET search_path = 'notme'; +SELECT current_schema; +SET search_path = 'pg_catalog'; +SELECT current_schema; +RESET search_path; + + +-- +-- Tests for BETWEEN +-- + +explain (costs off) +select count(*) from date_tbl + where f1 between '1997-01-01' and '1998-01-01'; +select count(*) from date_tbl + where f1 between '1997-01-01' and '1998-01-01'; + +explain (costs off) +select count(*) from date_tbl + where f1 not between '1997-01-01' and '1998-01-01'; +select count(*) from date_tbl + where f1 not between '1997-01-01' and '1998-01-01'; + +explain (costs off) +select count(*) from date_tbl + where f1 between symmetric '1997-01-01' and '1998-01-01'; +select count(*) from date_tbl + where f1 between symmetric '1997-01-01' and '1998-01-01'; + +explain (costs off) +select count(*) from date_tbl + where f1 not between symmetric '1997-01-01' and '1998-01-01'; +select count(*) from date_tbl + where f1 not between symmetric '1997-01-01' and '1998-01-01'; diff --git a/postgresql/examples/fast_default.sql b/postgresql/examples/fast_default.sql new file mode 100644 index 0000000..ec770e8 --- /dev/null +++ b/postgresql/examples/fast_default.sql @@ -0,0 +1,549 @@ +-- +-- ALTER TABLE ADD COLUMN DEFAULT test +-- + +SET search_path = fast_default; +CREATE SCHEMA fast_default; +CREATE TABLE m(id OID); +INSERT INTO m VALUES (NULL::OID); + +CREATE FUNCTION set(tabname name) RETURNS VOID +AS $$ +BEGIN + UPDATE m + SET id = (SELECT c.relfilenode + FROM pg_class AS c, pg_namespace AS s + WHERE c.relname = tabname + AND c.relnamespace = s.oid + AND s.nspname = 'fast_default'); +END; +$$ LANGUAGE 'plpgsql'; + +CREATE FUNCTION comp() RETURNS TEXT +AS $$ +BEGIN + RETURN (SELECT CASE + WHEN m.id = c.relfilenode THEN 'Unchanged' + ELSE 'Rewritten' + END + FROM m, pg_class AS c, pg_namespace AS s + WHERE c.relname = 't' + AND c.relnamespace = s.oid + AND s.nspname = 'fast_default'); +END; +$$ LANGUAGE 'plpgsql'; + + +CREATE TABLE has_volatile AS +SELECT * FROM generate_series(1,10) id; + + +CREATE EVENT TRIGGER has_volatile_rewrite + ON table_rewrite + EXECUTE PROCEDURE log_rewrite(); + +-- only the last of these should trigger a rewrite +ALTER TABLE has_volatile ADD col1 int; +ALTER TABLE has_volatile ADD col2 int DEFAULT 1; +ALTER TABLE has_volatile ADD col3 timestamptz DEFAULT current_timestamp; +ALTER TABLE has_volatile ADD col4 int DEFAULT (random() * 10000)::int; + + + +-- Test a large sample of different datatypes +CREATE TABLE T(pk INT NOT NULL PRIMARY KEY, c_int INT DEFAULT 1); + +SELECT set('t'); + +INSERT INTO T VALUES (1), (2); + +ALTER TABLE T ADD COLUMN c_bpchar BPCHAR(5) DEFAULT 'hello', + ALTER COLUMN c_int SET DEFAULT 2; + +INSERT INTO T VALUES (3), (4); + + +ALTER TABLE T ADD COLUMN c_text TEXT DEFAULT 'world', + ALTER COLUMN c_bpchar SET DEFAULT 'dog'; + +INSERT INTO T VALUES (5), (6); + +ALTER TABLE T ADD COLUMN c_date DATE DEFAULT '2016-06-02', + ALTER COLUMN c_text SET DEFAULT 'cat'; + +INSERT INTO T VALUES (7), (8); + +ALTER TABLE T ADD COLUMN c_timestamp TIMESTAMP DEFAULT '2016-09-01 12:00:00', + ADD COLUMN c_timestamp_null TIMESTAMP, + ALTER COLUMN c_date SET DEFAULT '2010-01-01'; + +INSERT INTO T VALUES (9), (10); + +ALTER TABLE T ADD COLUMN c_array TEXT[] + DEFAULT '{"This", "is", "the", "real", "world"}', + ALTER COLUMN c_timestamp SET DEFAULT '1970-12-31 11:12:13', + ALTER COLUMN c_timestamp_null SET DEFAULT '2016-09-29 12:00:00'; + +INSERT INTO T VALUES (11), (12); + +ALTER TABLE T ADD COLUMN c_small SMALLINT DEFAULT -5, + ADD COLUMN c_small_null SMALLINT, + ALTER COLUMN c_array + SET DEFAULT '{"This", "is", "no", "fantasy"}'; + +INSERT INTO T VALUES (13), (14); + +ALTER TABLE T ADD COLUMN c_big BIGINT DEFAULT 180000000000018, + ALTER COLUMN c_small SET DEFAULT 9, + ALTER COLUMN c_small_null SET DEFAULT 13; + +INSERT INTO T VALUES (15), (16); + +ALTER TABLE T ADD COLUMN c_num NUMERIC DEFAULT 1.00000000001, + ALTER COLUMN c_big SET DEFAULT -9999999999999999; + +INSERT INTO T VALUES (17), (18); + +ALTER TABLE T ADD COLUMN c_time TIME DEFAULT '12:00:00', + ALTER COLUMN c_num SET DEFAULT 2.000000000000002; + +INSERT INTO T VALUES (19), (20); + +ALTER TABLE T ADD COLUMN c_interval INTERVAL DEFAULT '1 day', + ALTER COLUMN c_time SET DEFAULT '23:59:59'; + +INSERT INTO T VALUES (21), (22); + +ALTER TABLE T ADD COLUMN c_hugetext TEXT DEFAULT repeat('abcdefg',1000), + ALTER COLUMN c_interval SET DEFAULT '3 hours'; + +INSERT INTO T VALUES (23), (24); + +ALTER TABLE T ALTER COLUMN c_interval DROP DEFAULT, + ALTER COLUMN c_hugetext SET DEFAULT repeat('poiuyt', 1000); + +INSERT INTO T VALUES (25), (26); + +ALTER TABLE T ALTER COLUMN c_bpchar DROP DEFAULT, + ALTER COLUMN c_date DROP DEFAULT, + ALTER COLUMN c_text DROP DEFAULT, + ALTER COLUMN c_timestamp DROP DEFAULT, + ALTER COLUMN c_array DROP DEFAULT, + ALTER COLUMN c_small DROP DEFAULT, + ALTER COLUMN c_big DROP DEFAULT, + ALTER COLUMN c_num DROP DEFAULT, + ALTER COLUMN c_time DROP DEFAULT, + ALTER COLUMN c_hugetext DROP DEFAULT; + +INSERT INTO T VALUES (27), (28); + +SELECT pk, c_int, c_bpchar, c_text, c_date, c_timestamp, + c_timestamp_null, c_array, c_small, c_small_null, + c_big, c_num, c_time, c_interval, + c_hugetext = repeat('abcdefg',1000) as c_hugetext_origdef, + c_hugetext = repeat('poiuyt', 1000) as c_hugetext_newdef +FROM T ORDER BY pk; + +SELECT comp(); + +DROP TABLE T; + +-- Test expressions in the defaults +CREATE OR REPLACE FUNCTION foo(a INT) RETURNS TEXT AS $$ +DECLARE res TEXT := ''; + i INT; +BEGIN + i := 0; + WHILE (i < a) LOOP + res := res || chr(ascii('a') + i); + i := i + 1; + END LOOP; + RETURN res; +END; $$ LANGUAGE PLPGSQL STABLE; + +CREATE TABLE T(pk INT NOT NULL PRIMARY KEY, c_int INT DEFAULT LENGTH(foo(6))); + +SELECT set('t'); + +INSERT INTO T VALUES (1), (2); + +ALTER TABLE T ADD COLUMN c_bpchar BPCHAR(5) DEFAULT foo(4), + ALTER COLUMN c_int SET DEFAULT LENGTH(foo(8)); + +INSERT INTO T VALUES (3), (4); + +ALTER TABLE T ADD COLUMN c_text TEXT DEFAULT foo(6), + ALTER COLUMN c_bpchar SET DEFAULT foo(3); + +INSERT INTO T VALUES (5), (6); + +ALTER TABLE T ADD COLUMN c_date DATE + DEFAULT '2016-06-02'::DATE + LENGTH(foo(10)), + ALTER COLUMN c_text SET DEFAULT foo(12); + +INSERT INTO T VALUES (7), (8); + +ALTER TABLE T ADD COLUMN c_timestamp TIMESTAMP + DEFAULT '2016-09-01'::DATE + LENGTH(foo(10)), + ALTER COLUMN c_date + SET DEFAULT '2010-01-01'::DATE - LENGTH(foo(4)); + +INSERT INTO T VALUES (9), (10); + +ALTER TABLE T ADD COLUMN c_array TEXT[] + DEFAULT ('{"This", "is", "' || foo(4) || + '","the", "real", "world"}')::TEXT[], + ALTER COLUMN c_timestamp + SET DEFAULT '1970-12-31'::DATE + LENGTH(foo(30)); + +INSERT INTO T VALUES (11), (12); + +ALTER TABLE T ALTER COLUMN c_int DROP DEFAULT, + ALTER COLUMN c_array + SET DEFAULT ('{"This", "is", "' || foo(1) || + '", "fantasy"}')::text[]; + +INSERT INTO T VALUES (13), (14); + +ALTER TABLE T ALTER COLUMN c_bpchar DROP DEFAULT, + ALTER COLUMN c_date DROP DEFAULT, + ALTER COLUMN c_text DROP DEFAULT, + ALTER COLUMN c_timestamp DROP DEFAULT, + ALTER COLUMN c_array DROP DEFAULT; + +INSERT INTO T VALUES (15), (16); + +SELECT * FROM T; + +SELECT comp(); + +DROP TABLE T; + +DROP FUNCTION foo(INT); + +-- Fall back to full rewrite for volatile expressions +CREATE TABLE T(pk INT NOT NULL PRIMARY KEY); + +INSERT INTO T VALUES (1); + +SELECT set('t'); + +-- now() is stable, because it returns the transaction timestamp +ALTER TABLE T ADD COLUMN c1 TIMESTAMP DEFAULT now(); + +SELECT comp(); + +-- clock_timestamp() is volatile +ALTER TABLE T ADD COLUMN c2 TIMESTAMP DEFAULT clock_timestamp(); + +SELECT comp(); + +DROP TABLE T; + +-- Simple querie +CREATE TABLE T (pk INT NOT NULL PRIMARY KEY); + +SELECT set('t'); + +INSERT INTO T SELECT * FROM generate_series(1, 10) a; + +ALTER TABLE T ADD COLUMN c_bigint BIGINT NOT NULL DEFAULT -1; + +INSERT INTO T SELECT b, b - 10 FROM generate_series(11, 20) a(b); + +ALTER TABLE T ADD COLUMN c_text TEXT DEFAULT 'hello'; + +INSERT INTO T SELECT b, b - 10, (b + 10)::text FROM generate_series(21, 30) a(b); + +-- WHERE clause +SELECT c_bigint, c_text FROM T WHERE c_bigint = -1 LIMIT 1; + +EXPLAIN (VERBOSE TRUE, COSTS FALSE) +SELECT c_bigint, c_text FROM T WHERE c_bigint = -1 LIMIT 1; + +SELECT c_bigint, c_text FROM T WHERE c_text = 'hello' LIMIT 1; + +EXPLAIN (VERBOSE TRUE, COSTS FALSE) SELECT c_bigint, c_text FROM T WHERE c_text = 'hello' LIMIT 1; + + +-- COALESCE +SELECT COALESCE(c_bigint, pk), COALESCE(c_text, pk::text) +FROM T +ORDER BY pk LIMIT 10; + +-- Aggregate function +SELECT SUM(c_bigint), MAX(c_text COLLATE "C" ), MIN(c_text COLLATE "C") FROM T; + +-- ORDER BY +SELECT * FROM T ORDER BY c_bigint, c_text, pk LIMIT 10; + +EXPLAIN (VERBOSE TRUE, COSTS FALSE) +SELECT * FROM T ORDER BY c_bigint, c_text, pk LIMIT 10; + +-- LIMIT +SELECT * FROM T WHERE c_bigint > -1 ORDER BY c_bigint, c_text, pk LIMIT 10; + +EXPLAIN (VERBOSE TRUE, COSTS FALSE) +SELECT * FROM T WHERE c_bigint > -1 ORDER BY c_bigint, c_text, pk LIMIT 10; + +-- DELETE with RETURNING +DELETE FROM T WHERE pk BETWEEN 10 AND 20 RETURNING *; +EXPLAIN (VERBOSE TRUE, COSTS FALSE) +DELETE FROM T WHERE pk BETWEEN 10 AND 20 RETURNING *; + +-- UPDATE +UPDATE T SET c_text = '"' || c_text || '"' WHERE pk < 10; +SELECT * FROM T WHERE c_text LIKE '"%"' ORDER BY PK; + +SELECT comp(); + +DROP TABLE T; + + +-- Combine with other DDL +CREATE TABLE T(pk INT NOT NULL PRIMARY KEY); + +SELECT set('t'); + +INSERT INTO T VALUES (1), (2); + +ALTER TABLE T ADD COLUMN c_int INT NOT NULL DEFAULT -1; + +INSERT INTO T VALUES (3), (4); + +ALTER TABLE T ADD COLUMN c_text TEXT DEFAULT 'Hello'; + +INSERT INTO T VALUES (5), (6); + +ALTER TABLE T ALTER COLUMN c_text SET DEFAULT 'world', + ALTER COLUMN c_int SET DEFAULT 1; + +INSERT INTO T VALUES (7), (8); + +SELECT * FROM T ORDER BY pk; + +-- Add an index +CREATE INDEX i ON T(c_int, c_text); + +SELECT c_text FROM T WHERE c_int = -1; + +SELECT comp(); + +-- query to exercise expand_tuple function +CREATE TABLE t1 AS +SELECT 1::int AS a , 2::int AS b +FROM generate_series(1,20) q; + +ALTER TABLE t1 ADD COLUMN c text; + +SELECT a, + stddev(cast((SELECT sum(1) FROM generate_series(1,20) x) AS float4)) + OVER (PARTITION BY a,b,c ORDER BY b) + AS z +FROM t1; + +DROP TABLE T; + +-- test that we account for missing columns without defaults correctly +-- in expand_tuple, and that rows are correctly expanded for triggers + +CREATE FUNCTION test_trigger() +RETURNS trigger +LANGUAGE plpgsql +AS $$ + +begin + raise notice 'old tuple: %', to_json(OLD)::text; + if TG_OP = 'DELETE' + then + return OLD; + else + return NEW; + end if; +end; + +$$; + +-- 2 new columns, both have defaults +CREATE TABLE t (id serial PRIMARY KEY, a int, b int, c int); +INSERT INTO t (a,b,c) VALUES (1,2,3); +ALTER TABLE t ADD COLUMN x int NOT NULL DEFAULT 4; +ALTER TABLE t ADD COLUMN y int NOT NULL DEFAULT 5; +CREATE TRIGGER a BEFORE UPDATE ON t FOR EACH ROW EXECUTE PROCEDURE test_trigger(); +SELECT * FROM t; +UPDATE t SET y = 2; +SELECT * FROM t; +DROP TABLE t; + +-- 2 new columns, first has default +CREATE TABLE t (id serial PRIMARY KEY, a int, b int, c int); +INSERT INTO t (a,b,c) VALUES (1,2,3); +ALTER TABLE t ADD COLUMN x int NOT NULL DEFAULT 4; +ALTER TABLE t ADD COLUMN y int; +CREATE TRIGGER a BEFORE UPDATE ON t FOR EACH ROW EXECUTE PROCEDURE test_trigger(); +SELECT * FROM t; +UPDATE t SET y = 2; +SELECT * FROM t; +DROP TABLE t; + +-- 2 new columns, second has default +CREATE TABLE t (id serial PRIMARY KEY, a int, b int, c int); +INSERT INTO t (a,b,c) VALUES (1,2,3); +ALTER TABLE t ADD COLUMN x int; +ALTER TABLE t ADD COLUMN y int NOT NULL DEFAULT 5; +CREATE TRIGGER a BEFORE UPDATE ON t FOR EACH ROW EXECUTE PROCEDURE test_trigger(); +SELECT * FROM t; +UPDATE t SET y = 2; +SELECT * FROM t; +DROP TABLE t; + +-- 2 new columns, neither has default +CREATE TABLE t (id serial PRIMARY KEY, a int, b int, c int); +INSERT INTO t (a,b,c) VALUES (1,2,3); +ALTER TABLE t ADD COLUMN x int; +ALTER TABLE t ADD COLUMN y int; +CREATE TRIGGER a BEFORE UPDATE ON t FOR EACH ROW EXECUTE PROCEDURE test_trigger(); +SELECT * FROM t; +UPDATE t SET y = 2; +SELECT * FROM t; +DROP TABLE t; + +-- same as last 4 tests but here the last original column has a NULL value +-- 2 new columns, both have defaults +CREATE TABLE t (id serial PRIMARY KEY, a int, b int, c int); +INSERT INTO t (a,b,c) VALUES (1,2,NULL); +ALTER TABLE t ADD COLUMN x int NOT NULL DEFAULT 4; +ALTER TABLE t ADD COLUMN y int NOT NULL DEFAULT 5; +CREATE TRIGGER a BEFORE UPDATE ON t FOR EACH ROW EXECUTE PROCEDURE test_trigger(); +SELECT * FROM t; +UPDATE t SET y = 2; +SELECT * FROM t; +DROP TABLE t; + +-- 2 new columns, first has default +CREATE TABLE t (id serial PRIMARY KEY, a int, b int, c int); +INSERT INTO t (a,b,c) VALUES (1,2,NULL); +ALTER TABLE t ADD COLUMN x int NOT NULL DEFAULT 4; +ALTER TABLE t ADD COLUMN y int; +CREATE TRIGGER a BEFORE UPDATE ON t FOR EACH ROW EXECUTE PROCEDURE test_trigger(); +SELECT * FROM t; +UPDATE t SET y = 2; +SELECT * FROM t; +DROP TABLE t; + +-- 2 new columns, second has default +CREATE TABLE t (id serial PRIMARY KEY, a int, b int, c int); +INSERT INTO t (a,b,c) VALUES (1,2,NULL); +ALTER TABLE t ADD COLUMN x int; +ALTER TABLE t ADD COLUMN y int NOT NULL DEFAULT 5; +CREATE TRIGGER a BEFORE UPDATE ON t FOR EACH ROW EXECUTE PROCEDURE test_trigger(); +SELECT * FROM t; +UPDATE t SET y = 2; +SELECT * FROM t; +DROP TABLE t; + +-- 2 new columns, neither has default +CREATE TABLE t (id serial PRIMARY KEY, a int, b int, c int); +INSERT INTO t (a,b,c) VALUES (1,2,NULL); +ALTER TABLE t ADD COLUMN x int; +ALTER TABLE t ADD COLUMN y int; +CREATE TRIGGER a BEFORE UPDATE ON t FOR EACH ROW EXECUTE PROCEDURE test_trigger(); +SELECT * FROM t; +UPDATE t SET y = 2; +SELECT * FROM t; +DROP TABLE t; + +-- make sure expanded tuple has correct self pointer +-- it will be required by the RI trigger doing the cascading delete + +CREATE TABLE leader (a int PRIMARY KEY, b int); +CREATE TABLE follower (a int REFERENCES leader ON DELETE CASCADE, b int); +INSERT INTO leader VALUES (1, 1), (2, 2); +ALTER TABLE leader ADD c int; +ALTER TABLE leader DROP c; +DELETE FROM leader; + +-- check that ALTER TABLE ... ALTER TYPE does the right thing + +CREATE TABLE vtype( a integer); +INSERT INTO vtype VALUES (1); +ALTER TABLE vtype ADD COLUMN b DOUBLE PRECISION DEFAULT 0.2; +ALTER TABLE vtype ADD COLUMN c BOOLEAN DEFAULT true; +SELECT * FROM vtype; +ALTER TABLE vtype + ALTER b TYPE text USING b::text, + ALTER c TYPE text USING c::text; +SELECT * FROM vtype; + +-- also check the case that doesn't rewrite the table + +CREATE TABLE vtype2 (a int); +INSERT INTO vtype2 VALUES (1); +ALTER TABLE vtype2 ADD COLUMN b varchar(10) DEFAULT 'xxx'; +ALTER TABLE vtype2 ALTER COLUMN b SET DEFAULT 'yyy'; +INSERT INTO vtype2 VALUES (2); + +ALTER TABLE vtype2 ALTER COLUMN b TYPE varchar(20) USING b::varchar(20); +SELECT * FROM vtype2; + + +-- Ensure that defaults are checked when evaluating whether HOT update +-- is possible, this was broken for a while: +-- https://postgr.es/m/20190202133521.ylauh3ckqa7colzj%40alap3.anarazel.de +BEGIN; +CREATE TABLE t(); +INSERT INTO t DEFAULT VALUES; +ALTER TABLE t ADD COLUMN a int DEFAULT 1; +CREATE INDEX ON t(a); +-- set column with a default 1 to NULL, due to a bug that wasn't +-- noticed has heap_getattr buggily returned NULL for default columns +UPDATE t SET a = NULL; + +-- verify that index and non-index scans show the same result +SET LOCAL enable_seqscan = true; +SELECT * FROM t WHERE a IS NULL; +SET LOCAL enable_seqscan = false; +SELECT * FROM t WHERE a IS NULL; +ROLLBACK; + + +-- cleanup +DROP TABLE vtype; +DROP TABLE vtype2; +DROP TABLE follower; +DROP TABLE leader; +DROP FUNCTION test_trigger(); +DROP TABLE t1; +DROP FUNCTION set(name); +DROP FUNCTION comp(); +DROP TABLE m; +DROP TABLE has_volatile; +DROP EVENT TRIGGER has_volatile_rewrite; +DROP FUNCTION log_rewrite; +DROP SCHEMA fast_default; + +-- Leave a table with an active fast default in place, for pg_upgrade testing +set search_path = public; +create table has_fast_default(f1 int); +insert into has_fast_default values(1); +alter table has_fast_default add column f2 int default 42; +table has_fast_default; +CREATE FUNCTION log_rewrite() RETURNS event_trigger +LANGUAGE plpgsql as +$func$ + +declare + this_schema text; +begin + select into this_schema relnamespace::regnamespace::text + from pg_class + where oid = pg_event_trigger_table_rewrite_oid(); + if this_schema = 'fast_default' + then + RAISE NOTICE 'rewriting table % for reason %', + pg_event_trigger_table_rewrite_oid()::regclass, + pg_event_trigger_table_rewrite_reason(); + end if; +end; +$func$; + diff --git a/postgresql/examples/float4.sql b/postgresql/examples/float4.sql new file mode 100644 index 0000000..1fcf823 --- /dev/null +++ b/postgresql/examples/float4.sql @@ -0,0 +1,353 @@ +-- +-- FLOAT4 +-- + +CREATE TABLE FLOAT4_TBL (f1 float4); + +INSERT INTO FLOAT4_TBL(f1) VALUES (' 0.0'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('1004.30 '); +INSERT INTO FLOAT4_TBL(f1) VALUES (' -34.84 '); +INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e+20'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e-20'); + +-- test for over and under flow +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'); + +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8); +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8); + +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e400'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-400'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-400'); + +-- bad input +INSERT INTO FLOAT4_TBL(f1) VALUES (''); +INSERT INTO FLOAT4_TBL(f1) VALUES (' '); +INSERT INTO FLOAT4_TBL(f1) VALUES ('xyz'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('5.0.0'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('5 . 0'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0'); +INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5'); + +-- special inputs +SELECT 'NaN'::float4; +SELECT 'nan'::float4; +SELECT ' NAN '::float4; +SELECT 'infinity'::float4; +SELECT ' -INFINiTY '::float4; +-- bad special inputs +SELECT 'N A N'::float4; +SELECT 'NaN x'::float4; +SELECT ' INFINITY x'::float4; + +SELECT 'Infinity'::float4 + 100.0; +SELECT 'Infinity'::float4 / 'Infinity'::float4; +SELECT 'nan'::float4 / 'nan'::float4; +SELECT 'nan'::float4 / '0'::float4; +SELECT 'nan'::numeric::float4; + +SELECT '' AS five, * FROM FLOAT4_TBL; + +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <> '1004.3'; + +SELECT '' AS one, f.* FROM FLOAT4_TBL f WHERE f.f1 = '1004.3'; + +SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE '1004.3' > f.f1; + +SELECT '' AS three, f.* FROM FLOAT4_TBL f WHERE f.f1 < '1004.3'; + +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE '1004.3' >= f.f1; + +SELECT '' AS four, f.* FROM FLOAT4_TBL f WHERE f.f1 <= '1004.3'; + +SELECT '' AS three, f.f1, f.f1 * '-10' AS x FROM FLOAT4_TBL f + WHERE f.f1 > '0.0'; + +SELECT '' AS three, f.f1, f.f1 + '-10' AS x FROM FLOAT4_TBL f + WHERE f.f1 > '0.0'; + +SELECT '' AS three, f.f1, f.f1 / '-10' AS x FROM FLOAT4_TBL f + WHERE f.f1 > '0.0'; + +SELECT '' AS three, f.f1, f.f1 - '-10' AS x FROM FLOAT4_TBL f + WHERE f.f1 > '0.0'; + +-- test divide by zero +SELECT '' AS bad, f.f1 / '0.0' from FLOAT4_TBL f; + +SELECT '' AS five, * FROM FLOAT4_TBL; + +-- test the unary float4abs operator +SELECT '' AS five, f.f1, @f.f1 AS abs_f1 FROM FLOAT4_TBL f; + +UPDATE FLOAT4_TBL + SET f1 = FLOAT4_TBL.f1 * '-1' + WHERE FLOAT4_TBL.f1 > '0.0'; + +SELECT '' AS five, * FROM FLOAT4_TBL; + +-- test edge-case coercions to integer +SELECT '32767.4'::float4::int2; +SELECT '32767.6'::float4::int2; +SELECT '-32768.4'::float4::int2; +SELECT '-32768.6'::float4::int2; +SELECT '2147483520'::float4::int4; +SELECT '2147483647'::float4::int4; +SELECT '-2147483648.5'::float4::int4; +SELECT '-2147483900'::float4::int4; +SELECT '9223369837831520256'::float4::int8; +SELECT '9223372036854775807'::float4::int8; +SELECT '-9223372036854775808.5'::float4::int8; +SELECT '-9223380000000000000'::float4::int8; + +-- Test for correct input rounding in edge cases. +-- These lists are from Paxson 1991, excluding subnormals and +-- inputs of over 9 sig. digits. + +SELECT float4send('5e-20'::float4); +SELECT float4send('67e14'::float4); +SELECT float4send('985e15'::float4); +SELECT float4send('55895e-16'::float4); +SELECT float4send('7038531e-32'::float4); +SELECT float4send('702990899e-20'::float4); + +SELECT float4send('3e-23'::float4); +SELECT float4send('57e18'::float4); +SELECT float4send('789e-35'::float4); +SELECT float4send('2539e-18'::float4); +SELECT float4send('76173e28'::float4); +SELECT float4send('887745e-11'::float4); +SELECT float4send('5382571e-37'::float4); +SELECT float4send('82381273e-35'::float4); +SELECT float4send('750486563e-38'::float4); + +-- Test that the smallest possible normalized input value inputs +-- correctly, either in 9-significant-digit or shortest-decimal +-- format. +-- +-- exact val is 1.1754943508... +-- shortest val is 1.1754944000 +-- midpoint to next val is 1.1754944208... + +SELECT float4send('1.17549435e-38'::float4); +SELECT float4send('1.1754944e-38'::float4); + +-- test output (and round-trip safety) of various values. +-- To ensure we're testing what we think we're testing, start with +-- float values specified by bit patterns (as a useful side effect, +-- this means we'll fail on non-IEEE platforms). + +create type xfloat4; +create function xfloat4in(cstring) returns xfloat4 immutable strict + language internal as 'int4in'; +create function xfloat4out(xfloat4) returns cstring immutable strict + language internal as 'int4out'; +create type xfloat4 (input = xfloat4in, output = xfloat4out, like = float4); +create cast (xfloat4 as float4) without function; +create cast (float4 as xfloat4) without function; +create cast (xfloat4 as integer) without function; +create cast (integer as xfloat4) without function; + +-- float4: seeeeeee emmmmmmm mmmmmmmm mmmmmmmm + +-- we don't care to assume the platform's strtod() handles subnormals +-- correctly; those are "use at your own risk". However we do test +-- subnormal outputs, since those are under our control. + +with testdata(bits) as (values + -- small subnormals + (x'00000001'), + (x'00000002'), (x'00000003'), + (x'00000010'), (x'00000011'), (x'00000100'), (x'00000101'), + (x'00004000'), (x'00004001'), (x'00080000'), (x'00080001'), + -- stress values + (x'0053c4f4'), -- 7693e-42 + (x'006c85c4'), -- 996622e-44 + (x'0041ca76'), -- 60419369e-46 + (x'004b7678'), -- 6930161142e-48 + -- taken from upstream testsuite + (x'00000007'), + (x'00424fe2'), + -- borderline between subnormal and normal + (x'007ffff0'), (x'007ffff1'), (x'007ffffe'), (x'007fffff')) +select float4send(flt) as ibits, + flt + from (select bits::integer::xfloat4::float4 as flt + from testdata + offset 0) s; + +with testdata(bits) as (values + (x'00000000'), + -- smallest normal values + (x'00800000'), (x'00800001'), (x'00800004'), (x'00800005'), + (x'00800006'), + -- small normal values chosen for short vs. long output + (x'008002f1'), (x'008002f2'), (x'008002f3'), + (x'00800e17'), (x'00800e18'), (x'00800e19'), + -- assorted values (random mantissae) + (x'01000001'), (x'01102843'), (x'01a52c98'), + (x'0219c229'), (x'02e4464d'), (x'037343c1'), (x'03a91b36'), + (x'047ada65'), (x'0496fe87'), (x'0550844f'), (x'05999da3'), + (x'060ea5e2'), (x'06e63c45'), (x'07f1e548'), (x'0fc5282b'), + (x'1f850283'), (x'2874a9d6'), + -- values around 5e-08 + (x'3356bf94'), (x'3356bf95'), (x'3356bf96'), + -- around 1e-07 + (x'33d6bf94'), (x'33d6bf95'), (x'33d6bf96'), + -- around 3e-07 .. 1e-04 + (x'34a10faf'), (x'34a10fb0'), (x'34a10fb1'), + (x'350637bc'), (x'350637bd'), (x'350637be'), + (x'35719786'), (x'35719787'), (x'35719788'), + (x'358637bc'), (x'358637bd'), (x'358637be'), + (x'36a7c5ab'), (x'36a7c5ac'), (x'36a7c5ad'), + (x'3727c5ab'), (x'3727c5ac'), (x'3727c5ad'), + -- format crossover at 1e-04 + (x'38d1b714'), (x'38d1b715'), (x'38d1b716'), + (x'38d1b717'), (x'38d1b718'), (x'38d1b719'), + (x'38d1b71a'), (x'38d1b71b'), (x'38d1b71c'), + (x'38d1b71d'), + -- + (x'38dffffe'), (x'38dfffff'), (x'38e00000'), + (x'38efffff'), (x'38f00000'), (x'38f00001'), + (x'3a83126e'), (x'3a83126f'), (x'3a831270'), + (x'3c23d709'), (x'3c23d70a'), (x'3c23d70b'), + (x'3dcccccc'), (x'3dcccccd'), (x'3dccccce'), + -- chosen to need 9 digits for 3dcccd70 + (x'3dcccd6f'), (x'3dcccd70'), (x'3dcccd71'), + -- + (x'3effffff'), (x'3f000000'), (x'3f000001'), + (x'3f333332'), (x'3f333333'), (x'3f333334'), + -- approach 1.0 with increasing numbers of 9s + (x'3f666665'), (x'3f666666'), (x'3f666667'), + (x'3f7d70a3'), (x'3f7d70a4'), (x'3f7d70a5'), + (x'3f7fbe76'), (x'3f7fbe77'), (x'3f7fbe78'), + (x'3f7ff971'), (x'3f7ff972'), (x'3f7ff973'), + (x'3f7fff57'), (x'3f7fff58'), (x'3f7fff59'), + (x'3f7fffee'), (x'3f7fffef'), + -- values very close to 1 + (x'3f7ffff0'), (x'3f7ffff1'), (x'3f7ffff2'), + (x'3f7ffff3'), (x'3f7ffff4'), (x'3f7ffff5'), + (x'3f7ffff6'), (x'3f7ffff7'), (x'3f7ffff8'), + (x'3f7ffff9'), (x'3f7ffffa'), (x'3f7ffffb'), + (x'3f7ffffc'), (x'3f7ffffd'), (x'3f7ffffe'), + (x'3f7fffff'), + (x'3f800000'), + (x'3f800001'), (x'3f800002'), (x'3f800003'), + (x'3f800004'), (x'3f800005'), (x'3f800006'), + (x'3f800007'), (x'3f800008'), (x'3f800009'), + -- values 1 to 1.1 + (x'3f80000f'), (x'3f800010'), (x'3f800011'), + (x'3f800012'), (x'3f800013'), (x'3f800014'), + (x'3f800017'), (x'3f800018'), (x'3f800019'), + (x'3f80001a'), (x'3f80001b'), (x'3f80001c'), + (x'3f800029'), (x'3f80002a'), (x'3f80002b'), + (x'3f800053'), (x'3f800054'), (x'3f800055'), + (x'3f800346'), (x'3f800347'), (x'3f800348'), + (x'3f8020c4'), (x'3f8020c5'), (x'3f8020c6'), + (x'3f8147ad'), (x'3f8147ae'), (x'3f8147af'), + (x'3f8ccccc'), (x'3f8ccccd'), (x'3f8cccce'), + -- + (x'3fc90fdb'), -- pi/2 + (x'402df854'), -- e + (x'40490fdb'), -- pi + -- + (x'409fffff'), (x'40a00000'), (x'40a00001'), + (x'40afffff'), (x'40b00000'), (x'40b00001'), + (x'411fffff'), (x'41200000'), (x'41200001'), + (x'42c7ffff'), (x'42c80000'), (x'42c80001'), + (x'4479ffff'), (x'447a0000'), (x'447a0001'), + (x'461c3fff'), (x'461c4000'), (x'461c4001'), + (x'47c34fff'), (x'47c35000'), (x'47c35001'), + (x'497423ff'), (x'49742400'), (x'49742401'), + (x'4b18967f'), (x'4b189680'), (x'4b189681'), + (x'4cbebc1f'), (x'4cbebc20'), (x'4cbebc21'), + (x'4e6e6b27'), (x'4e6e6b28'), (x'4e6e6b29'), + (x'501502f8'), (x'501502f9'), (x'501502fa'), + (x'51ba43b6'), (x'51ba43b7'), (x'51ba43b8'), + -- stress values + (x'1f6c1e4a'), -- 5e-20 + (x'59be6cea'), -- 67e14 + (x'5d5ab6c4'), -- 985e15 + (x'2cc4a9bd'), -- 55895e-16 + (x'15ae43fd'), -- 7038531e-32 + (x'2cf757ca'), -- 702990899e-20 + (x'665ba998'), -- 25933168707e13 + (x'743c3324'), -- 596428896559e20 + -- exercise fixed-point memmoves + (x'47f1205a'), + (x'4640e6ae'), + (x'449a5225'), + (x'42f6e9d5'), + (x'414587dd'), + (x'3f9e064b'), + -- these cases come from the upstream's testsuite + -- BoundaryRoundEven + (x'4c000004'), + (x'50061c46'), + (x'510006a8'), + -- ExactValueRoundEven + (x'48951f84'), + (x'45fd1840'), + -- LotsOfTrailingZeros + (x'39800000'), + (x'3b200000'), + (x'3b900000'), + (x'3bd00000'), + -- Regression + (x'63800000'), + (x'4b000000'), + (x'4b800000'), + (x'4c000001'), + (x'4c800b0d'), + (x'00d24584'), + (x'00d90b88'), + (x'45803f34'), + (x'4f9f24f7'), + (x'3a8722c3'), + (x'5c800041'), + (x'15ae43fd'), + (x'5d4cccfb'), + (x'4c800001'), + (x'57800ed8'), + (x'5f000000'), + (x'700000f0'), + (x'5f23e9ac'), + (x'5e9502f9'), + (x'5e8012b1'), + (x'3c000028'), + (x'60cde861'), + (x'03aa2a50'), + (x'43480000'), + (x'4c000000'), + -- LooksLikePow5 + (x'5D1502F9'), + (x'5D9502F9'), + (x'5E1502F9'), + -- OutputLength + (x'3f99999a'), + (x'3f9d70a4'), + (x'3f9df3b6'), + (x'3f9e0419'), + (x'3f9e0610'), + (x'3f9e064b'), + (x'3f9e0651'), + (x'03d20cfe') +) +select float4send(flt) as ibits, + flt, + flt::text::float4 as r_flt, + float4send(flt::text::float4) as obits, + float4send(flt::text::float4) = float4send(flt) as correct + from (select bits::integer::xfloat4::float4 as flt + from testdata + offset 0) s; + +-- clean up, lest opr_sanity complain +drop type xfloat4 cascade; diff --git a/postgresql/examples/float8.sql b/postgresql/examples/float8.sql new file mode 100644 index 0000000..f103871 --- /dev/null +++ b/postgresql/examples/float8.sql @@ -0,0 +1,499 @@ +-- +-- FLOAT8 +-- + +CREATE TABLE FLOAT8_TBL(f1 float8); + +INSERT INTO FLOAT8_TBL(f1) VALUES (' 0.0 '); +INSERT INTO FLOAT8_TBL(f1) VALUES ('1004.30 '); +INSERT INTO FLOAT8_TBL(f1) VALUES (' -34.84'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e+200'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('1.2345678901234e-200'); + +-- test for underflow and overflow handling +SELECT '10e400'::float8; +SELECT '-10e400'::float8; +SELECT '10e-400'::float8; +SELECT '-10e-400'::float8; + +-- test smallest normalized input +SELECT float8send('2.2250738585072014E-308'::float8); + +-- bad input +INSERT INTO FLOAT8_TBL(f1) VALUES (''); +INSERT INTO FLOAT8_TBL(f1) VALUES (' '); +INSERT INTO FLOAT8_TBL(f1) VALUES ('xyz'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('5.0.0'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('5 . 0'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('5. 0'); +INSERT INTO FLOAT8_TBL(f1) VALUES (' - 3'); +INSERT INTO FLOAT8_TBL(f1) VALUES ('123 5'); + +-- special inputs +SELECT 'NaN'::float8; +SELECT 'nan'::float8; +SELECT ' NAN '::float8; +SELECT 'infinity'::float8; +SELECT ' -INFINiTY '::float8; +-- bad special inputs +SELECT 'N A N'::float8; +SELECT 'NaN x'::float8; +SELECT ' INFINITY x'::float8; + +SELECT 'Infinity'::float8 + 100.0; +SELECT 'Infinity'::float8 / 'Infinity'::float8; +SELECT 'nan'::float8 / 'nan'::float8; +SELECT 'nan'::float8 / '0'::float8; +SELECT 'nan'::numeric::float8; + +SELECT '' AS five, * FROM FLOAT8_TBL; + +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <> '1004.3'; + +SELECT '' AS one, f.* FROM FLOAT8_TBL f WHERE f.f1 = '1004.3'; + +SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE '1004.3' > f.f1; + +SELECT '' AS three, f.* FROM FLOAT8_TBL f WHERE f.f1 < '1004.3'; + +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE '1004.3' >= f.f1; + +SELECT '' AS four, f.* FROM FLOAT8_TBL f WHERE f.f1 <= '1004.3'; + +SELECT '' AS three, f.f1, f.f1 * '-10' AS x + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + +SELECT '' AS three, f.f1, f.f1 + '-10' AS x + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + +SELECT '' AS three, f.f1, f.f1 / '-10' AS x + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + +SELECT '' AS three, f.f1, f.f1 - '-10' AS x + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + +SELECT '' AS one, f.f1 ^ '2.0' AS square_f1 + FROM FLOAT8_TBL f where f.f1 = '1004.3'; + +-- absolute value +SELECT '' AS five, f.f1, @f.f1 AS abs_f1 + FROM FLOAT8_TBL f; + +-- truncate +SELECT '' AS five, f.f1, trunc(f.f1) AS trunc_f1 + FROM FLOAT8_TBL f; + +-- round +SELECT '' AS five, f.f1, round(f.f1) AS round_f1 + FROM FLOAT8_TBL f; + +-- ceil / ceiling +select ceil(f1) as ceil_f1 from float8_tbl f; +select ceiling(f1) as ceiling_f1 from float8_tbl f; + +-- floor +select floor(f1) as floor_f1 from float8_tbl f; + +-- sign +select sign(f1) as sign_f1 from float8_tbl f; + +-- avoid bit-exact output here because operations may not be bit-exact. +SET extra_float_digits = 0; + +-- square root +SELECT sqrt(float8 '64') AS eight; + +SELECT |/ float8 '64' AS eight; + +SELECT '' AS three, f.f1, |/f.f1 AS sqrt_f1 + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + +-- power +SELECT power(float8 '144', float8 '0.5'); +SELECT power(float8 'NaN', float8 '0.5'); +SELECT power(float8 '144', float8 'NaN'); +SELECT power(float8 'NaN', float8 'NaN'); +SELECT power(float8 '-1', float8 'NaN'); +SELECT power(float8 '1', float8 'NaN'); +SELECT power(float8 'NaN', float8 '0'); +SELECT power(float8 'inf', float8 '0'); +SELECT power(float8 '-inf', float8 '0'); +SELECT power(float8 '0', float8 'inf'); +SELECT power(float8 '0', float8 '-inf'); +SELECT power(float8 '1', float8 'inf'); +SELECT power(float8 '1', float8 '-inf'); +SELECT power(float8 '-1', float8 'inf'); +SELECT power(float8 '-1', float8 '-inf'); +SELECT power(float8 '0.1', float8 'inf'); +SELECT power(float8 '-0.1', float8 'inf'); +SELECT power(float8 '1.1', float8 'inf'); +SELECT power(float8 '-1.1', float8 'inf'); +SELECT power(float8 '0.1', float8 '-inf'); +SELECT power(float8 '-0.1', float8 '-inf'); +SELECT power(float8 '1.1', float8 '-inf'); +SELECT power(float8 '-1.1', float8 '-inf'); +SELECT power(float8 'inf', float8 '-2'); +SELECT power(float8 'inf', float8 '2'); +SELECT power(float8 'inf', float8 'inf'); +SELECT power(float8 'inf', float8 '-inf'); +-- Intel's icc misoptimizes the code that controls the sign of this result, +-- even with -mp1. Pending a fix for that, only test for "is it zero". +SELECT power(float8 '-inf', float8 '-2') = '0'; +SELECT power(float8 '-inf', float8 '-3'); +SELECT power(float8 '-inf', float8 '2'); +SELECT power(float8 '-inf', float8 '3'); +SELECT power(float8 '-inf', float8 '3.5'); +SELECT power(float8 '-inf', float8 'inf'); +SELECT power(float8 '-inf', float8 '-inf'); + +-- take exp of ln(f.f1) +SELECT '' AS three, f.f1, exp(ln(f.f1)) AS exp_ln_f1 + FROM FLOAT8_TBL f + WHERE f.f1 > '0.0'; + +-- check edge cases for exp +SELECT exp('inf'::float8), exp('-inf'::float8), exp('nan'::float8); + +-- cube root +SELECT ||/ float8 '27' AS three; + +SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f; + + +SELECT '' AS five, * FROM FLOAT8_TBL; + +UPDATE FLOAT8_TBL + SET f1 = FLOAT8_TBL.f1 * '-1' + WHERE FLOAT8_TBL.f1 > '0.0'; + +SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f; + +SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f; + +SELECT 0 ^ 0 + 0 ^ 1 + 0 ^ 0.0 + 0 ^ 0.5; + +SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ; + +SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ; + +SELECT '' AS bad, exp(f.f1) from FLOAT8_TBL f; + +SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f; + +SELECT '' AS five, * FROM FLOAT8_TBL; + +-- hyperbolic functions +-- we run these with extra_float_digits = 0 too, since different platforms +-- tend to produce results that vary in the last place. +SELECT sinh(float8 '1'); +SELECT cosh(float8 '1'); +SELECT tanh(float8 '1'); +SELECT asinh(float8 '1'); +SELECT acosh(float8 '2'); +SELECT atanh(float8 '0.5'); +-- test Inf/NaN cases for hyperbolic functions +SELECT sinh(float8 'infinity'); +SELECT sinh(float8 '-infinity'); +SELECT sinh(float8 'nan'); +SELECT cosh(float8 'infinity'); +SELECT cosh(float8 '-infinity'); +SELECT cosh(float8 'nan'); +SELECT tanh(float8 'infinity'); +SELECT tanh(float8 '-infinity'); +SELECT tanh(float8 'nan'); +SELECT asinh(float8 'infinity'); +SELECT asinh(float8 '-infinity'); +SELECT asinh(float8 'nan'); +-- acosh(Inf) should be Inf, but some mingw versions produce NaN, so skip test +-- SELECT acosh(float8 'infinity'); +SELECT acosh(float8 '-infinity'); +SELECT acosh(float8 'nan'); +SELECT atanh(float8 'infinity'); +SELECT atanh(float8 '-infinity'); +SELECT atanh(float8 'nan'); + +RESET extra_float_digits; + +-- test for over- and underflow +INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); + +INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400'); + +INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400'); + +INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400'); + +-- maintain external table consistency across platforms +-- delete all values and reinsert well-behaved ones + +DELETE FROM FLOAT8_TBL; + +INSERT INTO FLOAT8_TBL(f1) VALUES ('0.0'); + +INSERT INTO FLOAT8_TBL(f1) VALUES ('-34.84'); + +INSERT INTO FLOAT8_TBL(f1) VALUES ('-1004.30'); + +INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e+200'); + +INSERT INTO FLOAT8_TBL(f1) VALUES ('-1.2345678901234e-200'); + +SELECT '' AS five, * FROM FLOAT8_TBL; + +-- test edge-case coercions to integer +SELECT '32767.4'::float8::int2; +SELECT '32767.6'::float8::int2; +SELECT '-32768.4'::float8::int2; +SELECT '-32768.6'::float8::int2; +SELECT '2147483647.4'::float8::int4; +SELECT '2147483647.6'::float8::int4; +SELECT '-2147483648.4'::float8::int4; +SELECT '-2147483648.6'::float8::int4; +SELECT '9223372036854773760'::float8::int8; +SELECT '9223372036854775807'::float8::int8; +SELECT '-9223372036854775808.5'::float8::int8; +SELECT '-9223372036854780000'::float8::int8; + +-- test exact cases for trigonometric functions in degrees + +SELECT x, + sind(x), + sind(x) IN (-1,-0.5,0,0.5,1) AS sind_exact +FROM (VALUES (0), (30), (90), (150), (180), + (210), (270), (330), (360)) AS t(x); + +SELECT x, + cosd(x), + cosd(x) IN (-1,-0.5,0,0.5,1) AS cosd_exact +FROM (VALUES (0), (60), (90), (120), (180), + (240), (270), (300), (360)) AS t(x); + +SELECT x, + tand(x), + tand(x) IN ('-Infinity'::float8,-1,0, + 1,'Infinity'::float8) AS tand_exact, + cotd(x), + cotd(x) IN ('-Infinity'::float8,-1,0, + 1,'Infinity'::float8) AS cotd_exact +FROM (VALUES (0), (45), (90), (135), (180), + (225), (270), (315), (360)) AS t(x); + +SELECT x, + asind(x), + asind(x) IN (-90,-30,0,30,90) AS asind_exact, + acosd(x), + acosd(x) IN (0,60,90,120,180) AS acosd_exact +FROM (VALUES (-1), (-0.5), (0), (0.5), (1)) AS t(x); + +SELECT x, + atand(x), + atand(x) IN (-90,-45,0,45,90) AS atand_exact +FROM (VALUES ('-Infinity'::float8), (-1), (0), (1), + ('Infinity'::float8)) AS t(x); + +SELECT x, y, + atan2d(y, x), + atan2d(y, x) IN (-90,0,90,180) AS atan2d_exact +FROM (SELECT 10*cosd(a), 10*sind(a) + FROM generate_series(0, 360, 90) AS t(a)) AS t(x,y); + +-- +-- test output (and round-trip safety) of various values. +-- To ensure we're testing what we think we're testing, start with +-- float values specified by bit patterns (as a useful side effect, +-- this means we'll fail on non-IEEE platforms). + +create type xfloat8; +create function xfloat8in(cstring) returns xfloat8 immutable strict + language internal as 'int8in'; +create function xfloat8out(xfloat8) returns cstring immutable strict + language internal as 'int8out'; +create type xfloat8 (input = xfloat8in, output = xfloat8out, like = float8); +create cast (xfloat8 as float8) without function; +create cast (float8 as xfloat8) without function; +create cast (xfloat8 as bigint) without function; +create cast (bigint as xfloat8) without function; + +-- float8: seeeeeee eeeeeeee eeeeeeee mmmmmmmm mmmmmmmm(x4) + +-- we don't care to assume the platform's strtod() handles subnormals +-- correctly; those are "use at your own risk". However we do test +-- subnormal outputs, since those are under our control. + +with testdata(bits) as (values + -- small subnormals + (x'0000000000000001'), + (x'0000000000000002'), (x'0000000000000003'), + (x'0000000000001000'), (x'0000000100000000'), + (x'0000010000000000'), (x'0000010100000000'), + (x'0000400000000000'), (x'0000400100000000'), + (x'0000800000000000'), (x'0000800000000001'), + -- these values taken from upstream testsuite + (x'00000000000f4240'), + (x'00000000016e3600'), + (x'0000008cdcdea440'), + -- borderline between subnormal and normal + (x'000ffffffffffff0'), (x'000ffffffffffff1'), + (x'000ffffffffffffe'), (x'000fffffffffffff')) +select float8send(flt) as ibits, + flt + from (select bits::bigint::xfloat8::float8 as flt + from testdata + offset 0) s; + +-- round-trip tests + +with testdata(bits) as (values + (x'0000000000000000'), + -- smallest normal values + (x'0010000000000000'), (x'0010000000000001'), + (x'0010000000000002'), (x'0018000000000000'), + -- + (x'3ddb7cdfd9d7bdba'), (x'3ddb7cdfd9d7bdbb'), (x'3ddb7cdfd9d7bdbc'), + (x'3e112e0be826d694'), (x'3e112e0be826d695'), (x'3e112e0be826d696'), + (x'3e45798ee2308c39'), (x'3e45798ee2308c3a'), (x'3e45798ee2308c3b'), + (x'3e7ad7f29abcaf47'), (x'3e7ad7f29abcaf48'), (x'3e7ad7f29abcaf49'), + (x'3eb0c6f7a0b5ed8c'), (x'3eb0c6f7a0b5ed8d'), (x'3eb0c6f7a0b5ed8e'), + (x'3ee4f8b588e368ef'), (x'3ee4f8b588e368f0'), (x'3ee4f8b588e368f1'), + (x'3f1a36e2eb1c432c'), (x'3f1a36e2eb1c432d'), (x'3f1a36e2eb1c432e'), + (x'3f50624dd2f1a9fb'), (x'3f50624dd2f1a9fc'), (x'3f50624dd2f1a9fd'), + (x'3f847ae147ae147a'), (x'3f847ae147ae147b'), (x'3f847ae147ae147c'), + (x'3fb9999999999999'), (x'3fb999999999999a'), (x'3fb999999999999b'), + -- values very close to 1 + (x'3feffffffffffff0'), (x'3feffffffffffff1'), (x'3feffffffffffff2'), + (x'3feffffffffffff3'), (x'3feffffffffffff4'), (x'3feffffffffffff5'), + (x'3feffffffffffff6'), (x'3feffffffffffff7'), (x'3feffffffffffff8'), + (x'3feffffffffffff9'), (x'3feffffffffffffa'), (x'3feffffffffffffb'), + (x'3feffffffffffffc'), (x'3feffffffffffffd'), (x'3feffffffffffffe'), + (x'3fefffffffffffff'), + (x'3ff0000000000000'), + (x'3ff0000000000001'), (x'3ff0000000000002'), (x'3ff0000000000003'), + (x'3ff0000000000004'), (x'3ff0000000000005'), (x'3ff0000000000006'), + (x'3ff0000000000007'), (x'3ff0000000000008'), (x'3ff0000000000009'), + -- + (x'3ff921fb54442d18'), + (x'4005bf0a8b14576a'), + (x'400921fb54442d18'), + -- + (x'4023ffffffffffff'), (x'4024000000000000'), (x'4024000000000001'), + (x'4058ffffffffffff'), (x'4059000000000000'), (x'4059000000000001'), + (x'408f3fffffffffff'), (x'408f400000000000'), (x'408f400000000001'), + (x'40c387ffffffffff'), (x'40c3880000000000'), (x'40c3880000000001'), + (x'40f869ffffffffff'), (x'40f86a0000000000'), (x'40f86a0000000001'), + (x'412e847fffffffff'), (x'412e848000000000'), (x'412e848000000001'), + (x'416312cfffffffff'), (x'416312d000000000'), (x'416312d000000001'), + (x'4197d783ffffffff'), (x'4197d78400000000'), (x'4197d78400000001'), + (x'41cdcd64ffffffff'), (x'41cdcd6500000000'), (x'41cdcd6500000001'), + (x'4202a05f1fffffff'), (x'4202a05f20000000'), (x'4202a05f20000001'), + (x'42374876e7ffffff'), (x'42374876e8000000'), (x'42374876e8000001'), + (x'426d1a94a1ffffff'), (x'426d1a94a2000000'), (x'426d1a94a2000001'), + (x'42a2309ce53fffff'), (x'42a2309ce5400000'), (x'42a2309ce5400001'), + (x'42d6bcc41e8fffff'), (x'42d6bcc41e900000'), (x'42d6bcc41e900001'), + (x'430c6bf52633ffff'), (x'430c6bf526340000'), (x'430c6bf526340001'), + (x'4341c37937e07fff'), (x'4341c37937e08000'), (x'4341c37937e08001'), + (x'4376345785d89fff'), (x'4376345785d8a000'), (x'4376345785d8a001'), + (x'43abc16d674ec7ff'), (x'43abc16d674ec800'), (x'43abc16d674ec801'), + (x'43e158e460913cff'), (x'43e158e460913d00'), (x'43e158e460913d01'), + (x'4415af1d78b58c3f'), (x'4415af1d78b58c40'), (x'4415af1d78b58c41'), + (x'444b1ae4d6e2ef4f'), (x'444b1ae4d6e2ef50'), (x'444b1ae4d6e2ef51'), + (x'4480f0cf064dd591'), (x'4480f0cf064dd592'), (x'4480f0cf064dd593'), + (x'44b52d02c7e14af5'), (x'44b52d02c7e14af6'), (x'44b52d02c7e14af7'), + (x'44ea784379d99db3'), (x'44ea784379d99db4'), (x'44ea784379d99db5'), + (x'45208b2a2c280290'), (x'45208b2a2c280291'), (x'45208b2a2c280292'), + -- + (x'7feffffffffffffe'), (x'7fefffffffffffff'), + -- round to even tests (+ve) + (x'4350000000000002'), + (x'4350000000002e06'), + (x'4352000000000003'), + (x'4352000000000004'), + (x'4358000000000003'), + (x'4358000000000004'), + (x'435f000000000020'), + -- round to even tests (-ve) + (x'c350000000000002'), + (x'c350000000002e06'), + (x'c352000000000003'), + (x'c352000000000004'), + (x'c358000000000003'), + (x'c358000000000004'), + (x'c35f000000000020'), + -- exercise fixed-point memmoves + (x'42dc12218377de66'), + (x'42a674e79c5fe51f'), + (x'4271f71fb04cb74c'), + (x'423cbe991a145879'), + (x'4206fee0e1a9e061'), + (x'41d26580b487e6b4'), + (x'419d6f34540ca453'), + (x'41678c29dcd6e9dc'), + (x'4132d687e3df217d'), + (x'40fe240c9fcb68c8'), + (x'40c81cd6e63c53d3'), + (x'40934a4584fd0fdc'), + (x'405edd3c07fb4c93'), + (x'4028b0fcd32f7076'), + (x'3ff3c0ca428c59f8'), + -- these cases come from the upstream's testsuite + -- LotsOfTrailingZeros) + (x'3e60000000000000'), + -- Regression + (x'c352bd2668e077c4'), + (x'434018601510c000'), + (x'43d055dc36f24000'), + (x'43e052961c6f8000'), + (x'3ff3c0ca2a5b1d5d'), + -- LooksLikePow5 + (x'4830f0cf064dd592'), + (x'4840f0cf064dd592'), + (x'4850f0cf064dd592'), + -- OutputLength + (x'3ff3333333333333'), + (x'3ff3ae147ae147ae'), + (x'3ff3be76c8b43958'), + (x'3ff3c083126e978d'), + (x'3ff3c0c1fc8f3238'), + (x'3ff3c0c9539b8887'), + (x'3ff3c0ca2a5b1d5d'), + (x'3ff3c0ca4283de1b'), + (x'3ff3c0ca43db770a'), + (x'3ff3c0ca428abd53'), + (x'3ff3c0ca428c1d2b'), + (x'3ff3c0ca428c51f2'), + (x'3ff3c0ca428c58fc'), + (x'3ff3c0ca428c59dd'), + (x'3ff3c0ca428c59f8'), + (x'3ff3c0ca428c59fb'), + -- 32-bit chunking + (x'40112e0be8047a7d'), + (x'40112e0be815a889'), + (x'40112e0be826d695'), + (x'40112e0be83804a1'), + (x'40112e0be84932ad'), + -- MinMaxShift + (x'0040000000000000'), + (x'007fffffffffffff'), + (x'0290000000000000'), + (x'029fffffffffffff'), + (x'4350000000000000'), + (x'435fffffffffffff'), + (x'1330000000000000'), + (x'133fffffffffffff'), + (x'3a6fa7161a4d6e0c') +) +select float8send(flt) as ibits, + flt, + flt::text::float8 as r_flt, + float8send(flt::text::float8) as obits, + float8send(flt::text::float8) = float8send(flt) as correct + from (select bits::bigint::xfloat8::float8 as flt + from testdata + offset 0) s; + +-- clean up, lest opr_sanity complain +drop type xfloat8 cascade; diff --git a/postgresql/examples/foreign_data.sql b/postgresql/examples/foreign_data.sql new file mode 100644 index 0000000..ce4f8fd --- /dev/null +++ b/postgresql/examples/foreign_data.sql @@ -0,0 +1,861 @@ +-- +-- Test foreign-data wrapper and server management. +-- + +-- Clean up in case a prior regression run failed + +-- Suppress NOTICE messages when roles don't exist +SET client_min_messages TO 'warning'; + +DROP ROLE IF EXISTS regress_foreign_data_user, regress_test_role, regress_test_role2, regress_test_role_super, regress_test_indirect, regress_unprivileged_role; + +RESET client_min_messages; + +CREATE ROLE regress_foreign_data_user LOGIN SUPERUSER; +SET SESSION AUTHORIZATION 'regress_foreign_data_user'; + +CREATE ROLE regress_test_role; +CREATE ROLE regress_test_role2; +CREATE ROLE regress_test_role_super SUPERUSER; +CREATE ROLE regress_test_indirect; +CREATE ROLE regress_unprivileged_role; + +CREATE FOREIGN DATA WRAPPER dummy; +COMMENT ON FOREIGN DATA WRAPPER dummy IS 'useless'; +CREATE FOREIGN DATA WRAPPER postgresql VALIDATOR postgresql_fdw_validator; + +-- At this point we should have 2 built-in wrappers and no servers. +SELECT fdwname, fdwhandler::regproc, fdwvalidator::regproc, fdwoptions FROM pg_foreign_data_wrapper ORDER BY 1, 2, 3; +SELECT srvname, srvoptions FROM pg_foreign_server; +SELECT * FROM pg_user_mapping; + +-- CREATE FOREIGN DATA WRAPPER +CREATE FOREIGN DATA WRAPPER foo VALIDATOR bar; -- ERROR +CREATE FOREIGN DATA WRAPPER foo; +\dew + +CREATE FOREIGN DATA WRAPPER foo; -- duplicate +DROP FOREIGN DATA WRAPPER foo; +CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1'); +\dew+ + +DROP FOREIGN DATA WRAPPER foo; +CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1', testing '2'); -- ERROR +CREATE FOREIGN DATA WRAPPER foo OPTIONS (testing '1', another '2'); +\dew+ + +DROP FOREIGN DATA WRAPPER foo; +SET ROLE regress_test_role; +CREATE FOREIGN DATA WRAPPER foo; -- ERROR +RESET ROLE; +CREATE FOREIGN DATA WRAPPER foo VALIDATOR postgresql_fdw_validator; +\dew+ + +-- HANDLER related checks +CREATE FUNCTION invalid_fdw_handler() RETURNS int LANGUAGE SQL AS 'SELECT 1;'; +CREATE FOREIGN DATA WRAPPER test_fdw HANDLER invalid_fdw_handler; -- ERROR +CREATE FOREIGN DATA WRAPPER test_fdw HANDLER test_fdw_handler HANDLER invalid_fdw_handler; -- ERROR +CREATE FOREIGN DATA WRAPPER test_fdw HANDLER test_fdw_handler; +DROP FOREIGN DATA WRAPPER test_fdw; + +-- ALTER FOREIGN DATA WRAPPER +--ALTER FOREIGN DATA WRAPPER foo; -- ERROR +--ALTER FOREIGN DATA WRAPPER foo VALIDATOR bar; -- ERROR +ALTER FOREIGN DATA WRAPPER foo NO VALIDATOR; +\dew+ + +ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '1', b '2'); +ALTER FOREIGN DATA WRAPPER foo OPTIONS (SET c '4'); -- ERROR +ALTER FOREIGN DATA WRAPPER foo OPTIONS (DROP c); -- ERROR +ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD x '1', DROP x); +\dew+ + +ALTER FOREIGN DATA WRAPPER foo OPTIONS (DROP a, SET b '3', ADD c '4'); +\dew+ + +ALTER FOREIGN DATA WRAPPER foo OPTIONS (a '2'); +ALTER FOREIGN DATA WRAPPER foo OPTIONS (b '4'); -- ERROR +\dew+ + +SET ROLE regress_test_role; +ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD d '5'); -- ERROR +SET ROLE regress_test_role_super; +ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD d '5'); +\dew+ + +ALTER FOREIGN DATA WRAPPER foo OWNER TO regress_test_role; -- ERROR +ALTER FOREIGN DATA WRAPPER foo OWNER TO regress_test_role_super; +ALTER ROLE regress_test_role_super NOSUPERUSER; +SET ROLE regress_test_role_super; +ALTER FOREIGN DATA WRAPPER foo OPTIONS (ADD e '6'); -- ERROR +RESET ROLE; +\dew+ + +ALTER FOREIGN DATA WRAPPER foo RENAME TO foo1; +\dew+ +ALTER FOREIGN DATA WRAPPER foo1 RENAME TO foo; + +-- HANDLER related checks +ALTER FOREIGN DATA WRAPPER foo HANDLER invalid_fdw_handler; -- ERROR +ALTER FOREIGN DATA WRAPPER foo HANDLER test_fdw_handler HANDLER anything; -- ERROR +ALTER FOREIGN DATA WRAPPER foo HANDLER test_fdw_handler; +DROP FUNCTION invalid_fdw_handler(); + +-- DROP FOREIGN DATA WRAPPER +DROP FOREIGN DATA WRAPPER nonexistent; -- ERROR +DROP FOREIGN DATA WRAPPER IF EXISTS nonexistent; +\dew+ + +DROP ROLE regress_test_role_super; -- ERROR +SET ROLE regress_test_role_super; +DROP FOREIGN DATA WRAPPER foo; +RESET ROLE; +DROP ROLE regress_test_role_super; +\dew+ + +CREATE FOREIGN DATA WRAPPER foo; +CREATE SERVER s1 FOREIGN DATA WRAPPER foo; +COMMENT ON SERVER s1 IS 'foreign server'; +CREATE USER MAPPING FOR current_user SERVER s1; +CREATE USER MAPPING FOR current_user SERVER s1; -- ERROR +CREATE USER MAPPING IF NOT EXISTS FOR current_user SERVER s1; -- NOTICE +\dew+ +\des+ +\deu+ +DROP FOREIGN DATA WRAPPER foo; -- ERROR +SET ROLE regress_test_role; +DROP FOREIGN DATA WRAPPER foo CASCADE; -- ERROR +RESET ROLE; +DROP FOREIGN DATA WRAPPER foo CASCADE; +\dew+ +\des+ +\deu+ + +-- exercise CREATE SERVER +CREATE SERVER s1 FOREIGN DATA WRAPPER foo; -- ERROR +CREATE FOREIGN DATA WRAPPER foo OPTIONS ("test wrapper" 'true'); +CREATE SERVER s1 FOREIGN DATA WRAPPER foo; +CREATE SERVER s1 FOREIGN DATA WRAPPER foo; -- ERROR +CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER foo; -- No ERROR, just NOTICE +CREATE SERVER s2 FOREIGN DATA WRAPPER foo OPTIONS (host 'a', dbname 'b'); +CREATE SERVER s3 TYPE 'oracle' FOREIGN DATA WRAPPER foo; +CREATE SERVER s4 TYPE 'oracle' FOREIGN DATA WRAPPER foo OPTIONS (host 'a', dbname 'b'); +CREATE SERVER s5 VERSION '15.0' FOREIGN DATA WRAPPER foo; +CREATE SERVER s6 VERSION '16.0' FOREIGN DATA WRAPPER foo OPTIONS (host 'a', dbname 'b'); +CREATE SERVER s7 TYPE 'oracle' VERSION '17.0' FOREIGN DATA WRAPPER foo OPTIONS (host 'a', dbname 'b'); +CREATE SERVER s8 FOREIGN DATA WRAPPER postgresql OPTIONS (foo '1'); -- ERROR +CREATE SERVER s8 FOREIGN DATA WRAPPER postgresql OPTIONS (host 'localhost', dbname 's8db'); +\des+ +SET ROLE regress_test_role; +CREATE SERVER t1 FOREIGN DATA WRAPPER foo; -- ERROR: no usage on FDW +RESET ROLE; +GRANT USAGE ON FOREIGN DATA WRAPPER foo TO regress_test_role; +SET ROLE regress_test_role; +CREATE SERVER t1 FOREIGN DATA WRAPPER foo; +RESET ROLE; +\des+ + +REVOKE USAGE ON FOREIGN DATA WRAPPER foo FROM regress_test_role; +GRANT USAGE ON FOREIGN DATA WRAPPER foo TO regress_test_indirect; +SET ROLE regress_test_role; +CREATE SERVER t2 FOREIGN DATA WRAPPER foo; -- ERROR +RESET ROLE; +GRANT regress_test_indirect TO regress_test_role; +SET ROLE regress_test_role; +CREATE SERVER t2 FOREIGN DATA WRAPPER foo; +\des+ +RESET ROLE; +REVOKE regress_test_indirect FROM regress_test_role; + +-- ALTER SERVER +--ALTER SERVER s0; -- ERROR +--ALTER SERVER s0 OPTIONS (a '1'); -- ERROR +ALTER SERVER s1 VERSION '1.0' OPTIONS (servername 's1'); +ALTER SERVER s2 VERSION '1.1'; +ALTER SERVER s3 OPTIONS ("tns name" 'orcl', port '1521'); +GRANT USAGE ON FOREIGN SERVER s1 TO regress_test_role; +GRANT USAGE ON FOREIGN SERVER s6 TO regress_test_role2 WITH GRANT OPTION; +\des+ +SET ROLE regress_test_role; +--ALTER SERVER s1 VERSION '1.1'; -- ERROR +--ALTER SERVER s1 OWNER TO regress_test_role; -- ERROR +RESET ROLE; +ALTER SERVER s1 OWNER TO regress_test_role; +GRANT regress_test_role2 TO regress_test_role; +SET ROLE regress_test_role; +ALTER SERVER s1 VERSION '1.1'; +--ALTER SERVER s1 OWNER TO regress_test_role2; -- ERROR +RESET ROLE; +ALTER SERVER s8 OPTIONS (foo '1'); -- ERROR option validation +ALTER SERVER s8 OPTIONS (connect_timeout '30', SET dbname 'db1', DROP host); +SET ROLE regress_test_role; +--ALTER SERVER s1 OWNER TO regress_test_indirect; -- ERROR +RESET ROLE; +GRANT regress_test_indirect TO regress_test_role; +SET ROLE regress_test_role; +ALTER SERVER s1 OWNER TO regress_test_indirect; +RESET ROLE; +GRANT USAGE ON FOREIGN DATA WRAPPER foo TO regress_test_indirect; +SET ROLE regress_test_role; +ALTER SERVER s1 OWNER TO regress_test_indirect; +RESET ROLE; +DROP ROLE regress_test_indirect; -- ERROR +\des+ + +ALTER SERVER s8 RENAME to s8new; +\des+ +ALTER SERVER s8new RENAME to s8; + +-- DROP SERVER +DROP SERVER nonexistent; -- ERROR +DROP SERVER IF EXISTS nonexistent; +\des +SET ROLE regress_test_role; +DROP SERVER s2; -- ERROR +DROP SERVER s1; +RESET ROLE; +\des +ALTER SERVER s2 OWNER TO regress_test_role; +SET ROLE regress_test_role; +DROP SERVER s2; +RESET ROLE; +\des +CREATE USER MAPPING FOR current_user SERVER s3; +\deu +DROP SERVER s3; -- ERROR +DROP SERVER s3 CASCADE; +\des +\deu + +-- CREATE USER MAPPING +CREATE USER MAPPING FOR regress_test_missing_role SERVER s1; -- ERROR +CREATE USER MAPPING FOR current_user SERVER s1; -- ERROR +CREATE USER MAPPING FOR current_user SERVER s4; +CREATE USER MAPPING FOR user SERVER s4; -- ERROR duplicate +CREATE USER MAPPING FOR public SERVER s4 OPTIONS ("this mapping" 'is public'); +CREATE USER MAPPING FOR user SERVER s8 OPTIONS (username 'test', password 'secret'); -- ERROR +CREATE USER MAPPING FOR user SERVER s8 OPTIONS (user 'test', password 'secret'); +ALTER SERVER s5 OWNER TO regress_test_role; +ALTER SERVER s6 OWNER TO regress_test_indirect; +SET ROLE regress_test_role; +CREATE USER MAPPING FOR current_user SERVER s5; +CREATE USER MAPPING FOR current_user SERVER s6 OPTIONS (username 'test'); +CREATE USER MAPPING FOR current_user SERVER s7; -- ERROR +CREATE USER MAPPING FOR public SERVER s8; -- ERROR +RESET ROLE; + +ALTER SERVER t1 OWNER TO regress_test_indirect; +SET ROLE regress_test_role; +CREATE USER MAPPING FOR current_user SERVER t1 OPTIONS (username 'bob', password 'boo'); +CREATE USER MAPPING FOR public SERVER t1; +RESET ROLE; +\deu + +-- ALTER USER MAPPING +ALTER USER MAPPING FOR regress_test_missing_role SERVER s4 OPTIONS (gotcha 'true'); -- ERROR +ALTER USER MAPPING FOR user SERVER ss4 OPTIONS (gotcha 'true'); -- ERROR +ALTER USER MAPPING FOR public SERVER s5 OPTIONS (gotcha 'true'); -- ERROR +ALTER USER MAPPING FOR current_user SERVER s8 OPTIONS (username 'test'); -- ERROR +ALTER USER MAPPING FOR current_user SERVER s8 OPTIONS (DROP user, SET password 'public'); +SET ROLE regress_test_role; +ALTER USER MAPPING FOR current_user SERVER s5 OPTIONS (ADD modified '1'); +ALTER USER MAPPING FOR public SERVER s4 OPTIONS (ADD modified '1'); -- ERROR +ALTER USER MAPPING FOR public SERVER t1 OPTIONS (ADD modified '1'); +RESET ROLE; +\deu+ + +-- DROP USER MAPPING +DROP USER MAPPING FOR regress_test_missing_role SERVER s4; -- ERROR +DROP USER MAPPING FOR user SERVER ss4; +DROP USER MAPPING FOR public SERVER s7; -- ERROR +DROP USER MAPPING IF EXISTS FOR regress_test_missing_role SERVER s4; +DROP USER MAPPING IF EXISTS FOR user SERVER ss4; +DROP USER MAPPING IF EXISTS FOR public SERVER s7; +CREATE USER MAPPING FOR public SERVER s8; +SET ROLE regress_test_role; +DROP USER MAPPING FOR public SERVER s8; -- ERROR +RESET ROLE; +DROP SERVER s7; +\deu + +-- CREATE FOREIGN TABLE +CREATE SCHEMA foreign_schema; +CREATE SERVER s0 FOREIGN DATA WRAPPER dummy; +--CREATE FOREIGN TABLE ft1 (); -- ERROR +CREATE FOREIGN TABLE ft1 () SERVER no_server; -- ERROR +CREATE FOREIGN TABLE ft1 ( + c1 integer OPTIONS ("param 1" 'val1') PRIMARY KEY, + c2 text OPTIONS (param2 'val2', param3 'val3'), + c3 date +) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); -- ERROR +CREATE TABLE ref_table (id integer PRIMARY KEY); +CREATE FOREIGN TABLE ft1 ( + c1 integer OPTIONS ("param 1" 'val1') REFERENCES ref_table (id), + c2 text OPTIONS (param2 'val2', param3 'val3'), + c3 date +) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); -- ERROR +DROP TABLE ref_table; +CREATE FOREIGN TABLE ft1 ( + c1 integer OPTIONS ("param 1" 'val1') NOT NULL, + c2 text OPTIONS (param2 'val2', param3 'val3'), + c3 date, + UNIQUE (c3) +) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); -- ERROR +CREATE FOREIGN TABLE ft1 ( + c1 integer OPTIONS ("param 1" 'val1') NOT NULL, + c2 text OPTIONS (param2 'val2', param3 'val3') CHECK (c2 <> ''), + c3 date, + CHECK (c3 BETWEEN '1994-01-01'::date AND '1994-01-31'::date) +) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); +COMMENT ON FOREIGN TABLE ft1 IS 'ft1'; +COMMENT ON COLUMN ft1.c1 IS 'ft1.c1'; +\d+ ft1 +\det+ +CREATE INDEX id_ft1_c2 ON ft1 (c2); -- ERROR +SELECT * FROM ft1; -- ERROR +EXPLAIN SELECT * FROM ft1; -- ERROR + +CREATE TABLE lt1 (a INT) PARTITION BY RANGE (a); +CREATE FOREIGN TABLE ft_part1 + PARTITION OF lt1 FOR VALUES FROM (0) TO (1000) SERVER s0; +CREATE INDEX ON lt1 (a); -- skips partition +CREATE UNIQUE INDEX ON lt1 (a); -- ERROR +ALTER TABLE lt1 ADD PRIMARY KEY (a); -- ERROR +DROP TABLE lt1; + +CREATE TABLE lt1 (a INT) PARTITION BY RANGE (a); +CREATE INDEX ON lt1 (a); +CREATE FOREIGN TABLE ft_part1 + PARTITION OF lt1 FOR VALUES FROM (0) TO (1000) SERVER s0; +CREATE FOREIGN TABLE ft_part2 (a INT) SERVER s0; +ALTER TABLE lt1 ATTACH PARTITION ft_part2 FOR VALUES FROM (1000) TO (2000); +DROP FOREIGN TABLE ft_part1, ft_part2; +CREATE UNIQUE INDEX ON lt1 (a); +ALTER TABLE lt1 ADD PRIMARY KEY (a); +CREATE FOREIGN TABLE ft_part1 + PARTITION OF lt1 FOR VALUES FROM (0) TO (1000) SERVER s0; -- ERROR +CREATE FOREIGN TABLE ft_part2 (a INT NOT NULL) SERVER s0; +ALTER TABLE lt1 ATTACH PARTITION ft_part2 + FOR VALUES FROM (1000) TO (2000); -- ERROR +DROP TABLE lt1; +DROP FOREIGN TABLE ft_part2; + +CREATE TABLE lt1 (a INT) PARTITION BY RANGE (a); +CREATE INDEX ON lt1 (a); +CREATE TABLE lt1_part1 + PARTITION OF lt1 FOR VALUES FROM (0) TO (1000) + PARTITION BY RANGE (a); +CREATE FOREIGN TABLE ft_part_1_1 + PARTITION OF lt1_part1 FOR VALUES FROM (0) TO (100) SERVER s0; +CREATE FOREIGN TABLE ft_part_1_2 (a INT) SERVER s0; +ALTER TABLE lt1_part1 ATTACH PARTITION ft_part_1_2 FOR VALUES FROM (100) TO (200); +CREATE UNIQUE INDEX ON lt1 (a); +ALTER TABLE lt1 ADD PRIMARY KEY (a); +DROP FOREIGN TABLE ft_part_1_1, ft_part_1_2; +CREATE UNIQUE INDEX ON lt1 (a); +ALTER TABLE lt1 ADD PRIMARY KEY (a); +CREATE FOREIGN TABLE ft_part_1_1 + PARTITION OF lt1_part1 FOR VALUES FROM (0) TO (100) SERVER s0; +CREATE FOREIGN TABLE ft_part_1_2 (a INT NOT NULL) SERVER s0; +ALTER TABLE lt1_part1 ATTACH PARTITION ft_part_1_2 FOR VALUES FROM (100) TO (200); +DROP TABLE lt1; +DROP FOREIGN TABLE ft_part_1_2; + +-- ALTER FOREIGN TABLE +COMMENT ON FOREIGN TABLE ft1 IS 'foreign table'; +COMMENT ON FOREIGN TABLE ft1 IS NULL; +COMMENT ON COLUMN ft1.c1 IS 'foreign column'; +COMMENT ON COLUMN ft1.c1 IS NULL; + +ALTER FOREIGN TABLE ft1 ADD COLUMN c4 integer; +ALTER FOREIGN TABLE ft1 ADD COLUMN c5 integer DEFAULT 0; +ALTER FOREIGN TABLE ft1 ADD COLUMN c6 integer; +ALTER FOREIGN TABLE ft1 ADD COLUMN c7 integer NOT NULL; +ALTER FOREIGN TABLE ft1 ADD COLUMN c8 integer; +ALTER FOREIGN TABLE ft1 ADD COLUMN c9 integer; +ALTER FOREIGN TABLE ft1 ADD COLUMN c10 integer OPTIONS (p1 'v1'); + +ALTER FOREIGN TABLE ft1 ALTER COLUMN c4 SET DEFAULT 0; +ALTER FOREIGN TABLE ft1 ALTER COLUMN c5 DROP DEFAULT; +ALTER FOREIGN TABLE ft1 ALTER COLUMN c6 SET NOT NULL; +ALTER FOREIGN TABLE ft1 ALTER COLUMN c7 DROP NOT NULL; +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE char(10) USING '0'; -- ERROR +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE char(10); +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET DATA TYPE text; +ALTER FOREIGN TABLE ft1 ALTER COLUMN xmin OPTIONS (ADD p1 'v1'); -- ERROR +ALTER FOREIGN TABLE ft1 ALTER COLUMN c7 OPTIONS (ADD p1 'v1', ADD p2 'v2'), + ALTER COLUMN c8 OPTIONS (ADD p1 'v1', ADD p2 'v2'); +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 OPTIONS (SET p2 'V2', DROP p1); +ALTER FOREIGN TABLE ft1 ALTER COLUMN c1 SET STATISTICS 10000; +ALTER FOREIGN TABLE ft1 ALTER COLUMN c1 SET (n_distinct = 100); +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET STATISTICS -1; +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET STORAGE PLAIN; +\d+ ft1 +-- can't change the column type if it's used elsewhere +CREATE TABLE use_ft1_column_type (x ft1); +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET DATA TYPE integer; -- ERROR +DROP TABLE use_ft1_column_type; +ALTER FOREIGN TABLE ft1 ADD PRIMARY KEY (c7); -- ERROR +ALTER FOREIGN TABLE ft1 ADD CONSTRAINT ft1_c9_check CHECK (c9 < 0) NOT VALID; +ALTER FOREIGN TABLE ft1 ALTER CONSTRAINT ft1_c9_check DEFERRABLE; -- ERROR +ALTER FOREIGN TABLE ft1 DROP CONSTRAINT ft1_c9_check; +ALTER FOREIGN TABLE ft1 DROP CONSTRAINT no_const; -- ERROR +ALTER FOREIGN TABLE ft1 DROP CONSTRAINT IF EXISTS no_const; +ALTER FOREIGN TABLE ft1 OWNER TO regress_test_role; +ALTER FOREIGN TABLE ft1 OPTIONS (DROP delimiter, SET quote '~', ADD escape '@'); +ALTER FOREIGN TABLE ft1 DROP COLUMN no_column; -- ERROR +ALTER FOREIGN TABLE ft1 DROP COLUMN IF EXISTS no_column; +ALTER FOREIGN TABLE ft1 DROP COLUMN c9; +ALTER FOREIGN TABLE ft1 SET SCHEMA foreign_schema; +ALTER FOREIGN TABLE ft1 SET TABLESPACE ts; -- ERROR +ALTER FOREIGN TABLE foreign_schema.ft1 RENAME c1 TO foreign_column_1; +ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1; +\d foreign_schema.foreign_table_1 + +-- alter noexisting table +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ADD COLUMN c4 integer; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ADD COLUMN c6 integer; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ADD COLUMN c7 integer NOT NULL; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ADD COLUMN c8 integer; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ADD COLUMN c9 integer; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ADD COLUMN c10 integer OPTIONS (p1 'v1'); + +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ALTER COLUMN c6 SET NOT NULL; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ALTER COLUMN c7 DROP NOT NULL; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ALTER COLUMN c8 TYPE char(10); +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ALTER COLUMN c8 SET DATA TYPE text; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ALTER COLUMN c7 OPTIONS (ADD p1 'v1', ADD p2 'v2'), + ALTER COLUMN c8 OPTIONS (ADD p1 'v1', ADD p2 'v2'); +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ALTER COLUMN c8 OPTIONS (SET p2 'V2', DROP p1); + +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 DROP CONSTRAINT IF EXISTS no_const; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 DROP CONSTRAINT ft1_c1_check; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 OWNER TO regress_test_role; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 OPTIONS (DROP delimiter, SET quote '~', ADD escape '@'); +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 DROP COLUMN IF EXISTS no_column; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 DROP COLUMN c9; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 SET SCHEMA foreign_schema; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 RENAME c1 TO foreign_column_1; +ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 RENAME TO foreign_table_1; + +-- Information schema + +SELECT * FROM information_schema.foreign_data_wrappers ORDER BY 1, 2; +SELECT * FROM information_schema.foreign_data_wrapper_options ORDER BY 1, 2, 3; +SELECT * FROM information_schema.foreign_servers ORDER BY 1, 2; +SELECT * FROM information_schema.foreign_server_options ORDER BY 1, 2, 3; +SELECT * FROM information_schema.user_mappings ORDER BY lower(authorization_identifier), 2, 3; +SELECT * FROM information_schema.user_mapping_options ORDER BY lower(authorization_identifier), 2, 3, 4; +SELECT * FROM information_schema.usage_privileges WHERE object_type LIKE 'FOREIGN%' AND object_name IN ('s6', 'foo') ORDER BY 1, 2, 3, 4, 5; +SELECT * FROM information_schema.role_usage_grants WHERE object_type LIKE 'FOREIGN%' AND object_name IN ('s6', 'foo') ORDER BY 1, 2, 3, 4, 5; +SELECT * FROM information_schema.foreign_tables ORDER BY 1, 2, 3; +SELECT * FROM information_schema.foreign_table_options ORDER BY 1, 2, 3, 4; +SET ROLE regress_test_role; +SELECT * FROM information_schema.user_mapping_options ORDER BY 1, 2, 3, 4; +SELECT * FROM information_schema.usage_privileges WHERE object_type LIKE 'FOREIGN%' AND object_name IN ('s6', 'foo') ORDER BY 1, 2, 3, 4, 5; +SELECT * FROM information_schema.role_usage_grants WHERE object_type LIKE 'FOREIGN%' AND object_name IN ('s6', 'foo') ORDER BY 1, 2, 3, 4, 5; +DROP USER MAPPING FOR current_user SERVER t1; +SET ROLE regress_test_role2; +SELECT * FROM information_schema.user_mapping_options ORDER BY 1, 2, 3, 4; +RESET ROLE; + + +-- has_foreign_data_wrapper_privilege +SELECT has_foreign_data_wrapper_privilege('regress_test_role', + (SELECT oid FROM pg_foreign_data_wrapper WHERE fdwname='foo'), 'USAGE'); +SELECT has_foreign_data_wrapper_privilege('regress_test_role', 'foo', 'USAGE'); +SELECT has_foreign_data_wrapper_privilege( + (SELECT oid FROM pg_roles WHERE rolname='regress_test_role'), + (SELECT oid FROM pg_foreign_data_wrapper WHERE fdwname='foo'), 'USAGE'); +SELECT has_foreign_data_wrapper_privilege( + (SELECT oid FROM pg_foreign_data_wrapper WHERE fdwname='foo'), 'USAGE'); +SELECT has_foreign_data_wrapper_privilege( + (SELECT oid FROM pg_roles WHERE rolname='regress_test_role'), 'foo', 'USAGE'); +SELECT has_foreign_data_wrapper_privilege('foo', 'USAGE'); +GRANT USAGE ON FOREIGN DATA WRAPPER foo TO regress_test_role; +SELECT has_foreign_data_wrapper_privilege('regress_test_role', 'foo', 'USAGE'); + +-- has_server_privilege +SELECT has_server_privilege('regress_test_role', + (SELECT oid FROM pg_foreign_server WHERE srvname='s8'), 'USAGE'); +SELECT has_server_privilege('regress_test_role', 's8', 'USAGE'); +SELECT has_server_privilege( + (SELECT oid FROM pg_roles WHERE rolname='regress_test_role'), + (SELECT oid FROM pg_foreign_server WHERE srvname='s8'), 'USAGE'); +SELECT has_server_privilege( + (SELECT oid FROM pg_foreign_server WHERE srvname='s8'), 'USAGE'); +SELECT has_server_privilege( + (SELECT oid FROM pg_roles WHERE rolname='regress_test_role'), 's8', 'USAGE'); +SELECT has_server_privilege('s8', 'USAGE'); +GRANT USAGE ON FOREIGN SERVER s8 TO regress_test_role; +SELECT has_server_privilege('regress_test_role', 's8', 'USAGE'); +REVOKE USAGE ON FOREIGN SERVER s8 FROM regress_test_role; + +GRANT USAGE ON FOREIGN SERVER s4 TO regress_test_role; +DROP USER MAPPING FOR public SERVER s4; +ALTER SERVER s6 OPTIONS (DROP host, DROP dbname); +ALTER USER MAPPING FOR regress_test_role SERVER s6 OPTIONS (DROP username); +ALTER FOREIGN DATA WRAPPER foo VALIDATOR postgresql_fdw_validator; + +-- Privileges +SET ROLE regress_unprivileged_role; +CREATE FOREIGN DATA WRAPPER foobar; -- ERROR +ALTER FOREIGN DATA WRAPPER foo OPTIONS (gotcha 'true'); -- ERROR +ALTER FOREIGN DATA WRAPPER foo OWNER TO regress_unprivileged_role; -- ERROR +DROP FOREIGN DATA WRAPPER foo; -- ERROR +GRANT USAGE ON FOREIGN DATA WRAPPER foo TO regress_test_role; -- ERROR +CREATE SERVER s9 FOREIGN DATA WRAPPER foo; -- ERROR +ALTER SERVER s4 VERSION '0.5'; -- ERROR +ALTER SERVER s4 OWNER TO regress_unprivileged_role; -- ERROR +DROP SERVER s4; -- ERROR +GRANT USAGE ON FOREIGN SERVER s4 TO regress_test_role; -- ERROR +CREATE USER MAPPING FOR public SERVER s4; -- ERROR +ALTER USER MAPPING FOR regress_test_role SERVER s6 OPTIONS (gotcha 'true'); -- ERROR +DROP USER MAPPING FOR regress_test_role SERVER s6; -- ERROR +RESET ROLE; + +GRANT USAGE ON FOREIGN DATA WRAPPER postgresql TO regress_unprivileged_role; +GRANT USAGE ON FOREIGN DATA WRAPPER foo TO regress_unprivileged_role WITH GRANT OPTION; +SET ROLE regress_unprivileged_role; +CREATE FOREIGN DATA WRAPPER foobar; -- ERROR +ALTER FOREIGN DATA WRAPPER foo OPTIONS (gotcha 'true'); -- ERROR +DROP FOREIGN DATA WRAPPER foo; -- ERROR +GRANT USAGE ON FOREIGN DATA WRAPPER postgresql TO regress_test_role; -- WARNING +GRANT USAGE ON FOREIGN DATA WRAPPER foo TO regress_test_role; +CREATE SERVER s9 FOREIGN DATA WRAPPER postgresql; +ALTER SERVER s6 VERSION '0.5'; -- ERROR +DROP SERVER s6; -- ERROR +GRANT USAGE ON FOREIGN SERVER s6 TO regress_test_role; -- ERROR +GRANT USAGE ON FOREIGN SERVER s9 TO regress_test_role; +CREATE USER MAPPING FOR public SERVER s6; -- ERROR +CREATE USER MAPPING FOR public SERVER s9; +ALTER USER MAPPING FOR regress_test_role SERVER s6 OPTIONS (gotcha 'true'); -- ERROR +DROP USER MAPPING FOR regress_test_role SERVER s6; -- ERROR +RESET ROLE; + +REVOKE USAGE ON FOREIGN DATA WRAPPER foo FROM regress_unprivileged_role; -- ERROR +REVOKE USAGE ON FOREIGN DATA WRAPPER foo FROM regress_unprivileged_role CASCADE; +SET ROLE regress_unprivileged_role; +GRANT USAGE ON FOREIGN DATA WRAPPER foo TO regress_test_role; -- ERROR +CREATE SERVER s10 FOREIGN DATA WRAPPER foo; -- ERROR +ALTER SERVER s9 VERSION '1.1'; +GRANT USAGE ON FOREIGN SERVER s9 TO regress_test_role; +CREATE USER MAPPING FOR current_user SERVER s9; +DROP SERVER s9 CASCADE; +RESET ROLE; +CREATE SERVER s9 FOREIGN DATA WRAPPER foo; +GRANT USAGE ON FOREIGN SERVER s9 TO regress_unprivileged_role; +SET ROLE regress_unprivileged_role; +ALTER SERVER s9 VERSION '1.2'; -- ERROR +GRANT USAGE ON FOREIGN SERVER s9 TO regress_test_role; -- WARNING +CREATE USER MAPPING FOR current_user SERVER s9; +DROP SERVER s9 CASCADE; -- ERROR + +-- Check visibility of user mapping data +SET ROLE regress_test_role; +CREATE SERVER s10 FOREIGN DATA WRAPPER foo; +CREATE USER MAPPING FOR public SERVER s10 OPTIONS (user 'secret'); +CREATE USER MAPPING FOR regress_unprivileged_role SERVER s10 OPTIONS (user 'secret'); +-- owner of server can see some option fields +\deu+ +RESET ROLE; +-- superuser can see all option fields +\deu+ +-- unprivileged user cannot see any option field +SET ROLE regress_unprivileged_role; +\deu+ +RESET ROLE; +DROP SERVER s10 CASCADE; + +-- Triggers +CREATE FUNCTION dummy_trigger() RETURNS TRIGGER AS $$ + BEGIN + RETURN NULL; + END +$$ language plpgsql; + +CREATE TRIGGER trigtest_before_stmt BEFORE INSERT OR UPDATE OR DELETE +ON foreign_schema.foreign_table_1 +FOR EACH STATEMENT +EXECUTE PROCEDURE dummy_trigger(); + +CREATE TRIGGER trigtest_after_stmt AFTER INSERT OR UPDATE OR DELETE +ON foreign_schema.foreign_table_1 +FOR EACH STATEMENT +EXECUTE PROCEDURE dummy_trigger(); + +CREATE TRIGGER trigtest_after_stmt_tt AFTER INSERT OR UPDATE OR DELETE -- ERROR +ON foreign_schema.foreign_table_1 +REFERENCING NEW TABLE AS new_table +FOR EACH STATEMENT +EXECUTE PROCEDURE dummy_trigger(); + +CREATE TRIGGER trigtest_before_row BEFORE INSERT OR UPDATE OR DELETE +ON foreign_schema.foreign_table_1 +FOR EACH ROW +EXECUTE PROCEDURE dummy_trigger(); + +CREATE TRIGGER trigtest_after_row AFTER INSERT OR UPDATE OR DELETE +ON foreign_schema.foreign_table_1 +FOR EACH ROW +EXECUTE PROCEDURE dummy_trigger(); + +CREATE CONSTRAINT TRIGGER trigtest_constraint AFTER INSERT OR UPDATE OR DELETE +ON foreign_schema.foreign_table_1 +FOR EACH ROW +EXECUTE PROCEDURE dummy_trigger(); + +ALTER FOREIGN TABLE foreign_schema.foreign_table_1 + DISABLE TRIGGER trigtest_before_stmt; +ALTER FOREIGN TABLE foreign_schema.foreign_table_1 + ENABLE TRIGGER trigtest_before_stmt; + +DROP TRIGGER trigtest_before_stmt ON foreign_schema.foreign_table_1; +DROP TRIGGER trigtest_before_row ON foreign_schema.foreign_table_1; +DROP TRIGGER trigtest_after_stmt ON foreign_schema.foreign_table_1; +DROP TRIGGER trigtest_after_row ON foreign_schema.foreign_table_1; + +DROP FUNCTION dummy_trigger(); + +-- Table inheritance +CREATE TABLE fd_pt1 ( + c1 integer NOT NULL, + c2 text, + c3 date +); +CREATE FOREIGN TABLE ft2 () INHERITS (fd_pt1) + SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); +\d+ fd_pt1 +\d+ ft2 +DROP FOREIGN TABLE ft2; +\d+ fd_pt1 +CREATE FOREIGN TABLE ft2 ( + c1 integer NOT NULL, + c2 text, + c3 date +) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); +\d+ ft2 +ALTER FOREIGN TABLE ft2 INHERIT fd_pt1; +\d+ fd_pt1 +\d+ ft2 +CREATE TABLE ct3() INHERITS(ft2); +CREATE FOREIGN TABLE ft3 ( + c1 integer NOT NULL, + c2 text, + c3 date +) INHERITS(ft2) + SERVER s0; +\d+ ft2 +\d+ ct3 +\d+ ft3 + +-- add attributes recursively +ALTER TABLE fd_pt1 ADD COLUMN c4 integer; +ALTER TABLE fd_pt1 ADD COLUMN c5 integer DEFAULT 0; +ALTER TABLE fd_pt1 ADD COLUMN c6 integer; +ALTER TABLE fd_pt1 ADD COLUMN c7 integer NOT NULL; +ALTER TABLE fd_pt1 ADD COLUMN c8 integer; +\d+ fd_pt1 +\d+ ft2 +\d+ ct3 +\d+ ft3 + +-- alter attributes recursively +ALTER TABLE fd_pt1 ALTER COLUMN c4 SET DEFAULT 0; +ALTER TABLE fd_pt1 ALTER COLUMN c5 DROP DEFAULT; +ALTER TABLE fd_pt1 ALTER COLUMN c6 SET NOT NULL; +ALTER TABLE fd_pt1 ALTER COLUMN c7 DROP NOT NULL; +ALTER TABLE fd_pt1 ALTER COLUMN c8 TYPE char(10) USING '0'; -- ERROR +ALTER TABLE fd_pt1 ALTER COLUMN c8 TYPE char(10); +ALTER TABLE fd_pt1 ALTER COLUMN c8 SET DATA TYPE text; +ALTER TABLE fd_pt1 ALTER COLUMN c1 SET STATISTICS 10000; +ALTER TABLE fd_pt1 ALTER COLUMN c1 SET (n_distinct = 100); +ALTER TABLE fd_pt1 ALTER COLUMN c8 SET STATISTICS -1; +ALTER TABLE fd_pt1 ALTER COLUMN c8 SET STORAGE EXTERNAL; +\d+ fd_pt1 +\d+ ft2 + +-- drop attributes recursively +ALTER TABLE fd_pt1 DROP COLUMN c4; +ALTER TABLE fd_pt1 DROP COLUMN c5; +ALTER TABLE fd_pt1 DROP COLUMN c6; +ALTER TABLE fd_pt1 DROP COLUMN c7; +ALTER TABLE fd_pt1 DROP COLUMN c8; +\d+ fd_pt1 +\d+ ft2 + +-- add constraints recursively +ALTER TABLE fd_pt1 ADD CONSTRAINT fd_pt1chk1 CHECK (c1 > 0) NO INHERIT; +ALTER TABLE fd_pt1 ADD CONSTRAINT fd_pt1chk2 CHECK (c2 <> ''); +-- connoinherit should be true for NO INHERIT constraint +SELECT relname, conname, contype, conislocal, coninhcount, connoinherit + FROM pg_class AS pc JOIN pg_constraint AS pgc ON (conrelid = pc.oid) + WHERE pc.relname = 'fd_pt1' + ORDER BY 1,2; +-- child does not inherit NO INHERIT constraints +\d+ fd_pt1 +\d+ ft2 +DROP FOREIGN TABLE ft2; -- ERROR +DROP FOREIGN TABLE ft2 CASCADE; +CREATE FOREIGN TABLE ft2 ( + c1 integer NOT NULL, + c2 text, + c3 date +) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); +-- child must have parent's INHERIT constraints +ALTER FOREIGN TABLE ft2 INHERIT fd_pt1; -- ERROR +ALTER FOREIGN TABLE ft2 ADD CONSTRAINT fd_pt1chk2 CHECK (c2 <> ''); +ALTER FOREIGN TABLE ft2 INHERIT fd_pt1; +-- child does not inherit NO INHERIT constraints +\d+ fd_pt1 +\d+ ft2 + +-- drop constraints recursively +ALTER TABLE fd_pt1 DROP CONSTRAINT fd_pt1chk1 CASCADE; +ALTER TABLE fd_pt1 DROP CONSTRAINT fd_pt1chk2 CASCADE; + +-- NOT VALID case +INSERT INTO fd_pt1 VALUES (1, 'fd_pt1'::text, '1994-01-01'::date); +ALTER TABLE fd_pt1 ADD CONSTRAINT fd_pt1chk3 CHECK (c2 <> '') NOT VALID; +\d+ fd_pt1 +\d+ ft2 +-- VALIDATE CONSTRAINT need do nothing on foreign tables +ALTER TABLE fd_pt1 VALIDATE CONSTRAINT fd_pt1chk3; +\d+ fd_pt1 +\d+ ft2 + +-- changes name of an attribute recursively +ALTER TABLE fd_pt1 RENAME COLUMN c1 TO f1; +ALTER TABLE fd_pt1 RENAME COLUMN c2 TO f2; +ALTER TABLE fd_pt1 RENAME COLUMN c3 TO f3; +-- changes name of a constraint recursively +ALTER TABLE fd_pt1 RENAME CONSTRAINT fd_pt1chk3 TO f2_check; +\d+ fd_pt1 +\d+ ft2 + +-- TRUNCATE doesn't work on foreign tables, either directly or recursively +TRUNCATE ft2; -- ERROR +TRUNCATE fd_pt1; -- ERROR + +DROP TABLE fd_pt1 CASCADE; + +-- IMPORT FOREIGN SCHEMA +IMPORT FOREIGN SCHEMA s1 FROM SERVER s9 INTO public; -- ERROR +IMPORT FOREIGN SCHEMA s1 LIMIT TO (t1) FROM SERVER s9 INTO public; --ERROR +IMPORT FOREIGN SCHEMA s1 EXCEPT (t1) FROM SERVER s9 INTO public; -- ERROR +IMPORT FOREIGN SCHEMA s1 EXCEPT (t1, t2) FROM SERVER s9 INTO public +OPTIONS (option1 'value1', option2 'value2'); -- ERROR + +-- DROP FOREIGN TABLE +DROP FOREIGN TABLE no_table; -- ERROR +DROP FOREIGN TABLE IF EXISTS no_table; +DROP FOREIGN TABLE foreign_schema.foreign_table_1; + +-- REASSIGN OWNED/DROP OWNED of foreign objects +REASSIGN OWNED BY regress_test_role TO regress_test_role2; +DROP OWNED BY regress_test_role2; +DROP OWNED BY regress_test_role2 CASCADE; + +-- Foreign partition DDL stuff +CREATE TABLE fd_pt2 ( + c1 integer NOT NULL, + c2 text, + c3 date +) PARTITION BY LIST (c1); +CREATE FOREIGN TABLE fd_pt2_1 PARTITION OF fd_pt2 FOR VALUES IN (1) + SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); +\d+ fd_pt2 +\d+ fd_pt2_1 + +-- partition cannot have additional columns +DROP FOREIGN TABLE fd_pt2_1; +CREATE FOREIGN TABLE fd_pt2_1 ( + c1 integer NOT NULL, + c2 text, + c3 date, + c4 char +) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); +\d+ fd_pt2_1 +ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); -- ERROR + +DROP FOREIGN TABLE fd_pt2_1; +\d+ fd_pt2 +CREATE FOREIGN TABLE fd_pt2_1 ( + c1 integer NOT NULL, + c2 text, + c3 date +) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value'); +\d+ fd_pt2_1 +-- no attach partition validation occurs for foreign tables +ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); +\d+ fd_pt2 +\d+ fd_pt2_1 + +-- cannot add column to a partition +ALTER TABLE fd_pt2_1 ADD c4 char; + +-- ok to have a partition's own constraints though +ALTER TABLE fd_pt2_1 ALTER c3 SET NOT NULL; +ALTER TABLE fd_pt2_1 ADD CONSTRAINT p21chk CHECK (c2 <> ''); +\d+ fd_pt2 +\d+ fd_pt2_1 + +-- cannot drop inherited NOT NULL constraint from a partition +ALTER TABLE fd_pt2_1 ALTER c1 DROP NOT NULL; + +-- partition must have parent's constraints +ALTER TABLE fd_pt2 DETACH PARTITION fd_pt2_1; +ALTER TABLE fd_pt2 ALTER c2 SET NOT NULL; +\d+ fd_pt2 +\d+ fd_pt2_1 +ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); -- ERROR +ALTER FOREIGN TABLE fd_pt2_1 ALTER c2 SET NOT NULL; +ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); + +ALTER TABLE fd_pt2 DETACH PARTITION fd_pt2_1; +ALTER TABLE fd_pt2 ADD CONSTRAINT fd_pt2chk1 CHECK (c1 > 0); +\d+ fd_pt2 +\d+ fd_pt2_1 +ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); -- ERROR +ALTER FOREIGN TABLE fd_pt2_1 ADD CONSTRAINT fd_pt2chk1 CHECK (c1 > 0); +ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); + +-- TRUNCATE doesn't work on foreign tables, either directly or recursively +TRUNCATE fd_pt2_1; -- ERROR +TRUNCATE fd_pt2; -- ERROR + +DROP FOREIGN TABLE fd_pt2_1; +DROP TABLE fd_pt2; + +-- foreign table cannot be part of partition tree made of temporary +-- relations. +CREATE TEMP TABLE temp_parted (a int) PARTITION BY LIST (a); +CREATE FOREIGN TABLE foreign_part PARTITION OF temp_parted DEFAULT + SERVER s0; -- ERROR +CREATE FOREIGN TABLE foreign_part (a int) SERVER s0; +ALTER TABLE temp_parted ATTACH PARTITION foreign_part DEFAULT; -- ERROR +DROP FOREIGN TABLE foreign_part; +DROP TABLE temp_parted; + +-- Cleanup +DROP SCHEMA foreign_schema CASCADE; +DROP ROLE regress_test_role; -- ERROR +DROP SERVER t1 CASCADE; +DROP USER MAPPING FOR regress_test_role SERVER s6; +DROP FOREIGN DATA WRAPPER foo CASCADE; +DROP SERVER s8 CASCADE; +DROP ROLE regress_test_indirect; +DROP ROLE regress_test_role; +DROP ROLE regress_unprivileged_role; -- ERROR +REVOKE ALL ON FOREIGN DATA WRAPPER postgresql FROM regress_unprivileged_role; +DROP ROLE regress_unprivileged_role; +DROP ROLE regress_test_role2; +DROP FOREIGN DATA WRAPPER postgresql CASCADE; +DROP FOREIGN DATA WRAPPER dummy CASCADE; +\c +DROP ROLE regress_foreign_data_user; + +-- At this point we should have no wrappers, no servers, and no mappings. +SELECT fdwname, fdwhandler, fdwvalidator, fdwoptions FROM pg_foreign_data_wrapper; +SELECT srvname, srvoptions FROM pg_foreign_server; +SELECT * FROM pg_user_mapping; diff --git a/postgresql/examples/foreign_key.sql b/postgresql/examples/foreign_key.sql new file mode 100644 index 0000000..f0925e8 --- /dev/null +++ b/postgresql/examples/foreign_key.sql @@ -0,0 +1,1741 @@ +-- +-- FOREIGN KEY +-- + +-- MATCH FULL +-- +-- First test, check and cascade +-- +CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text ); +CREATE TABLE FKTABLE ( ftest1 int REFERENCES PKTABLE MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE, ftest2 int ); + +-- Insert test data into PKTABLE +INSERT INTO PKTABLE VALUES (1, 'Test1'); +INSERT INTO PKTABLE VALUES (2, 'Test2'); +INSERT INTO PKTABLE VALUES (3, 'Test3'); +INSERT INTO PKTABLE VALUES (4, 'Test4'); +INSERT INTO PKTABLE VALUES (5, 'Test5'); + +-- Insert successful rows into FK TABLE +INSERT INTO FKTABLE VALUES (1, 2); +INSERT INTO FKTABLE VALUES (2, 3); +INSERT INTO FKTABLE VALUES (3, 4); +INSERT INTO FKTABLE VALUES (NULL, 1); + +-- Insert a failed row into FK TABLE +INSERT INTO FKTABLE VALUES (100, 2); + +-- Check FKTABLE +SELECT * FROM FKTABLE; + +-- Delete a row from PK TABLE +DELETE FROM PKTABLE WHERE ptest1=1; + +-- Check FKTABLE for removal of matched row +SELECT * FROM FKTABLE; + +-- Update a row from PK TABLE +UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; + +-- Check FKTABLE for update of matched row +SELECT * FROM FKTABLE; + +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- +-- check set NULL and table constraint on multiple columns +-- +CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1, ptest2) ); +CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, CONSTRAINT constrname FOREIGN KEY(ftest1, ftest2) + REFERENCES PKTABLE MATCH FULL ON DELETE SET NULL ON UPDATE SET NULL); + +-- Test comments +COMMENT ON CONSTRAINT constrname_wrong ON FKTABLE IS 'fk constraint comment'; +COMMENT ON CONSTRAINT constrname ON FKTABLE IS 'fk constraint comment'; +COMMENT ON CONSTRAINT constrname ON FKTABLE IS NULL; + +-- Insert test data into PKTABLE +INSERT INTO PKTABLE VALUES (1, 2, 'Test1'); +INSERT INTO PKTABLE VALUES (1, 3, 'Test1-2'); +INSERT INTO PKTABLE VALUES (2, 4, 'Test2'); +INSERT INTO PKTABLE VALUES (3, 6, 'Test3'); +INSERT INTO PKTABLE VALUES (4, 8, 'Test4'); +INSERT INTO PKTABLE VALUES (5, 10, 'Test5'); + +-- Insert successful rows into FK TABLE +INSERT INTO FKTABLE VALUES (1, 2, 4); +INSERT INTO FKTABLE VALUES (1, 3, 5); +INSERT INTO FKTABLE VALUES (2, 4, 8); +INSERT INTO FKTABLE VALUES (3, 6, 12); +INSERT INTO FKTABLE VALUES (NULL, NULL, 0); + +-- Insert failed rows into FK TABLE +INSERT INTO FKTABLE VALUES (100, 2, 4); +INSERT INTO FKTABLE VALUES (2, 2, 4); +INSERT INTO FKTABLE VALUES (NULL, 2, 4); +INSERT INTO FKTABLE VALUES (1, NULL, 4); + +-- Check FKTABLE +SELECT * FROM FKTABLE; + +-- Delete a row from PK TABLE +DELETE FROM PKTABLE WHERE ptest1=1 and ptest2=2; + +-- Check FKTABLE for removal of matched row +SELECT * FROM FKTABLE; + +-- Delete another row from PK TABLE +DELETE FROM PKTABLE WHERE ptest1=5 and ptest2=10; + +-- Check FKTABLE (should be no change) +SELECT * FROM FKTABLE; + +-- Update a row from PK TABLE +UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; + +-- Check FKTABLE for update of matched row +SELECT * FROM FKTABLE; + +-- Check update with part of key null +UPDATE FKTABLE SET ftest1 = NULL WHERE ftest1 = 1; + +-- Check update with old and new key values equal +UPDATE FKTABLE SET ftest1 = 1 WHERE ftest1 = 1; + +-- Try altering the column type where foreign keys are involved +ALTER TABLE PKTABLE ALTER COLUMN ptest1 TYPE bigint; +ALTER TABLE FKTABLE ALTER COLUMN ftest1 TYPE bigint; +SELECT * FROM PKTABLE; +SELECT * FROM FKTABLE; + +DROP TABLE PKTABLE CASCADE; +DROP TABLE FKTABLE; + +-- +-- check set default and table constraint on multiple columns +-- +CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1, ptest2) ); +CREATE TABLE FKTABLE ( ftest1 int DEFAULT -1, ftest2 int DEFAULT -2, ftest3 int, CONSTRAINT constrname2 FOREIGN KEY(ftest1, ftest2) + REFERENCES PKTABLE MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT); + +-- Insert a value in PKTABLE for default +INSERT INTO PKTABLE VALUES (-1, -2, 'The Default!'); + +-- Insert test data into PKTABLE +INSERT INTO PKTABLE VALUES (1, 2, 'Test1'); +INSERT INTO PKTABLE VALUES (1, 3, 'Test1-2'); +INSERT INTO PKTABLE VALUES (2, 4, 'Test2'); +INSERT INTO PKTABLE VALUES (3, 6, 'Test3'); +INSERT INTO PKTABLE VALUES (4, 8, 'Test4'); +INSERT INTO PKTABLE VALUES (5, 10, 'Test5'); + +-- Insert successful rows into FK TABLE +INSERT INTO FKTABLE VALUES (1, 2, 4); +INSERT INTO FKTABLE VALUES (1, 3, 5); +INSERT INTO FKTABLE VALUES (2, 4, 8); +INSERT INTO FKTABLE VALUES (3, 6, 12); +INSERT INTO FKTABLE VALUES (NULL, NULL, 0); + +-- Insert failed rows into FK TABLE +INSERT INTO FKTABLE VALUES (100, 2, 4); +INSERT INTO FKTABLE VALUES (2, 2, 4); +INSERT INTO FKTABLE VALUES (NULL, 2, 4); +INSERT INTO FKTABLE VALUES (1, NULL, 4); + +-- Check FKTABLE +SELECT * FROM FKTABLE; + +-- Delete a row from PK TABLE +DELETE FROM PKTABLE WHERE ptest1=1 and ptest2=2; + +-- Check FKTABLE to check for removal +SELECT * FROM FKTABLE; + +-- Delete another row from PK TABLE +DELETE FROM PKTABLE WHERE ptest1=5 and ptest2=10; + +-- Check FKTABLE (should be no change) +SELECT * FROM FKTABLE; + +-- Update a row from PK TABLE +UPDATE PKTABLE SET ptest1=1 WHERE ptest1=2; + +-- Check FKTABLE for update of matched row +SELECT * FROM FKTABLE; + +-- this should fail for lack of CASCADE +DROP TABLE PKTABLE; +DROP TABLE PKTABLE CASCADE; +DROP TABLE FKTABLE; + + +-- +-- First test, check with no on delete or on update +-- +CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text ); +CREATE TABLE FKTABLE ( ftest1 int REFERENCES PKTABLE MATCH FULL, ftest2 int ); + +-- Insert test data into PKTABLE +INSERT INTO PKTABLE VALUES (1, 'Test1'); +INSERT INTO PKTABLE VALUES (2, 'Test2'); +INSERT INTO PKTABLE VALUES (3, 'Test3'); +INSERT INTO PKTABLE VALUES (4, 'Test4'); +INSERT INTO PKTABLE VALUES (5, 'Test5'); + +-- Insert successful rows into FK TABLE +INSERT INTO FKTABLE VALUES (1, 2); +INSERT INTO FKTABLE VALUES (2, 3); +INSERT INTO FKTABLE VALUES (3, 4); +INSERT INTO FKTABLE VALUES (NULL, 1); + +-- Insert a failed row into FK TABLE +INSERT INTO FKTABLE VALUES (100, 2); + +-- Check FKTABLE +SELECT * FROM FKTABLE; + +-- Check PKTABLE +SELECT * FROM PKTABLE; + +-- Delete a row from PK TABLE (should fail) +DELETE FROM PKTABLE WHERE ptest1=1; + +-- Delete a row from PK TABLE (should succeed) +DELETE FROM PKTABLE WHERE ptest1=5; + +-- Check PKTABLE for deletes +SELECT * FROM PKTABLE; + +-- Update a row from PK TABLE (should fail) +UPDATE PKTABLE SET ptest1=0 WHERE ptest1=2; + +-- Update a row from PK TABLE (should succeed) +UPDATE PKTABLE SET ptest1=0 WHERE ptest1=4; + +-- Check PKTABLE for updates +SELECT * FROM PKTABLE; + +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- +-- Check initial check upon ALTER TABLE +-- +CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, PRIMARY KEY(ptest1, ptest2) ); +CREATE TABLE FKTABLE ( ftest1 int, ftest2 int ); + +INSERT INTO PKTABLE VALUES (1, 2); +INSERT INTO FKTABLE VALUES (1, NULL); + +ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) REFERENCES PKTABLE MATCH FULL; + +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + + +-- MATCH SIMPLE + +-- Base test restricting update/delete +CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); +CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 + FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE); + +-- Insert Primary Key values +INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1'); +INSERT INTO PKTABLE VALUES (1, 3, 3, 'test2'); +INSERT INTO PKTABLE VALUES (2, 3, 4, 'test3'); +INSERT INTO PKTABLE VALUES (2, 4, 5, 'test4'); + +-- Insert Foreign Key values +INSERT INTO FKTABLE VALUES (1, 2, 3, 1); +INSERT INTO FKTABLE VALUES (NULL, 2, 3, 2); +INSERT INTO FKTABLE VALUES (2, NULL, 3, 3); +INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4); +INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5); + +-- Insert a failed values +INSERT INTO FKTABLE VALUES (1, 2, 7, 6); + +-- Show FKTABLE +SELECT * from FKTABLE; + +-- Try to update something that should fail +UPDATE PKTABLE set ptest2=5 where ptest2=2; + +-- Try to update something that should succeed +UPDATE PKTABLE set ptest1=1 WHERE ptest2=3; + +-- Try to delete something that should fail +DELETE FROM PKTABLE where ptest1=1 and ptest2=2 and ptest3=3; + +-- Try to delete something that should work +DELETE FROM PKTABLE where ptest1=2; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; + +SELECT * from FKTABLE; + +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- restrict with null values +CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, UNIQUE(ptest1, ptest2, ptest3) ); +CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 + FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE (ptest1, ptest2, ptest3)); + +INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1'); +INSERT INTO PKTABLE VALUES (1, 3, NULL, 'test2'); +INSERT INTO PKTABLE VALUES (2, NULL, 4, 'test3'); + +INSERT INTO FKTABLE VALUES (1, 2, 3, 1); + +DELETE FROM PKTABLE WHERE ptest1 = 2; + +SELECT * FROM PKTABLE; +SELECT * FROM FKTABLE; + +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- cascade update/delete +CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); +CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 + FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE + ON DELETE CASCADE ON UPDATE CASCADE); + +-- Insert Primary Key values +INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1'); +INSERT INTO PKTABLE VALUES (1, 3, 3, 'test2'); +INSERT INTO PKTABLE VALUES (2, 3, 4, 'test3'); +INSERT INTO PKTABLE VALUES (2, 4, 5, 'test4'); + +-- Insert Foreign Key values +INSERT INTO FKTABLE VALUES (1, 2, 3, 1); +INSERT INTO FKTABLE VALUES (NULL, 2, 3, 2); +INSERT INTO FKTABLE VALUES (2, NULL, 3, 3); +INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4); +INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5); + +-- Insert a failed values +INSERT INTO FKTABLE VALUES (1, 2, 7, 6); + +-- Show FKTABLE +SELECT * from FKTABLE; + +-- Try to update something that will cascade +UPDATE PKTABLE set ptest2=5 where ptest2=2; + +-- Try to update something that should not cascade +UPDATE PKTABLE set ptest1=1 WHERE ptest2=3; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +-- Try to delete something that should cascade +DELETE FROM PKTABLE where ptest1=1 and ptest2=5 and ptest3=3; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +-- Try to delete something that should not have a cascade +DELETE FROM PKTABLE where ptest1=2; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- set null update / set default delete +CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); +CREATE TABLE FKTABLE ( ftest1 int DEFAULT 0, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3 + FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE + ON DELETE SET DEFAULT ON UPDATE SET NULL); + +-- Insert Primary Key values +INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1'); +INSERT INTO PKTABLE VALUES (1, 3, 3, 'test2'); +INSERT INTO PKTABLE VALUES (2, 3, 4, 'test3'); +INSERT INTO PKTABLE VALUES (2, 4, 5, 'test4'); + +-- Insert Foreign Key values +INSERT INTO FKTABLE VALUES (1, 2, 3, 1); +INSERT INTO FKTABLE VALUES (2, 3, 4, 1); +INSERT INTO FKTABLE VALUES (NULL, 2, 3, 2); +INSERT INTO FKTABLE VALUES (2, NULL, 3, 3); +INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4); +INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5); + +-- Insert a failed values +INSERT INTO FKTABLE VALUES (1, 2, 7, 6); + +-- Show FKTABLE +SELECT * from FKTABLE; + +-- Try to update something that will set null +UPDATE PKTABLE set ptest2=5 where ptest2=2; + +-- Try to update something that should not set null +UPDATE PKTABLE set ptest2=2 WHERE ptest2=3 and ptest1=1; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +-- Try to delete something that should set default +DELETE FROM PKTABLE where ptest1=2 and ptest2=3 and ptest3=4; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +-- Try to delete something that should not set default +DELETE FROM PKTABLE where ptest2=5; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- set default update / set null delete +CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) ); +CREATE TABLE FKTABLE ( ftest1 int DEFAULT 0, ftest2 int DEFAULT -1, ftest3 int DEFAULT -2, ftest4 int, CONSTRAINT constrname3 + FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE + ON DELETE SET NULL ON UPDATE SET DEFAULT); + +-- Insert Primary Key values +INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1'); +INSERT INTO PKTABLE VALUES (1, 3, 3, 'test2'); +INSERT INTO PKTABLE VALUES (2, 3, 4, 'test3'); +INSERT INTO PKTABLE VALUES (2, 4, 5, 'test4'); +INSERT INTO PKTABLE VALUES (2, -1, 5, 'test5'); + +-- Insert Foreign Key values +INSERT INTO FKTABLE VALUES (1, 2, 3, 1); +INSERT INTO FKTABLE VALUES (2, 3, 4, 1); +INSERT INTO FKTABLE VALUES (2, 4, 5, 1); +INSERT INTO FKTABLE VALUES (NULL, 2, 3, 2); +INSERT INTO FKTABLE VALUES (2, NULL, 3, 3); +INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4); +INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5); + +-- Insert a failed values +INSERT INTO FKTABLE VALUES (1, 2, 7, 6); + +-- Show FKTABLE +SELECT * from FKTABLE; + +-- Try to update something that will fail +UPDATE PKTABLE set ptest2=5 where ptest2=2; + +-- Try to update something that will set default + +UPDATE PKTABLE set ptest2=10 where ptest2=4; + +-- Try to update something that should not set default +UPDATE PKTABLE set ptest2=2 WHERE ptest2=3 and ptest1=1; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +-- Try to delete something that should set null +DELETE FROM PKTABLE where ptest1=2 and ptest2=3 and ptest3=4; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +-- Try to delete something that should not set null +DELETE FROM PKTABLE where ptest2=-1 and ptest3=5; + +-- Show PKTABLE and FKTABLE +SELECT * from PKTABLE; +SELECT * from FKTABLE; + +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY); +CREATE TABLE FKTABLE_FAIL1 ( ftest1 int, CONSTRAINT fkfail1 FOREIGN KEY (ftest2) REFERENCES PKTABLE); +CREATE TABLE FKTABLE_FAIL2 ( ftest1 int, CONSTRAINT fkfail1 FOREIGN KEY (ftest1) REFERENCES PKTABLE(ptest2)); + +DROP TABLE FKTABLE_FAIL1; +DROP TABLE FKTABLE_FAIL2; +DROP TABLE PKTABLE; + +-- Test for referencing column number smaller than referenced constraint +CREATE TABLE PKTABLE (ptest1 int, ptest2 int, UNIQUE(ptest1, ptest2)); +CREATE TABLE FKTABLE_FAIL1 (ftest1 int REFERENCES pktable(ptest1)); + +DROP TABLE FKTABLE_FAIL1; +DROP TABLE PKTABLE; + +-- +-- Tests for mismatched types +-- +-- Basic one column, two table setup +CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY); +INSERT INTO PKTABLE VALUES(42); +-- This next should fail, because int=inet does not exist +CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable); +-- This should also fail for the same reason, but here we +-- give the column name +CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable(ptest1)); +-- This should succeed, even though they are different types, +-- because int=int8 exists and is a member of the integer opfamily +CREATE TABLE FKTABLE (ftest1 int8 REFERENCES pktable); +-- Check it actually works +INSERT INTO FKTABLE VALUES(42); -- should succeed +INSERT INTO FKTABLE VALUES(43); -- should fail +UPDATE FKTABLE SET ftest1 = ftest1; -- should succeed +UPDATE FKTABLE SET ftest1 = ftest1 + 1; -- should fail +DROP TABLE FKTABLE; +-- This should fail, because we'd have to cast numeric to int which is +-- not an implicit coercion (or use numeric=numeric, but that's not part +-- of the integer opfamily) +CREATE TABLE FKTABLE (ftest1 numeric REFERENCES pktable); +DROP TABLE PKTABLE; +-- On the other hand, this should work because int implicitly promotes to +-- numeric, and we allow promotion on the FK side +CREATE TABLE PKTABLE (ptest1 numeric PRIMARY KEY); +INSERT INTO PKTABLE VALUES(42); +CREATE TABLE FKTABLE (ftest1 int REFERENCES pktable); +-- Check it actually works +INSERT INTO FKTABLE VALUES(42); -- should succeed +INSERT INTO FKTABLE VALUES(43); -- should fail +UPDATE FKTABLE SET ftest1 = ftest1; -- should succeed +UPDATE FKTABLE SET ftest1 = ftest1 + 1; -- should fail +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- Two columns, two tables +CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, PRIMARY KEY(ptest1, ptest2)); +-- This should fail, because we just chose really odd types +CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable); +-- Again, so should this... +CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2)); +-- This fails because we mixed up the column ordering +CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable); +-- As does this... +CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest1, ptest2)); +-- And again.. +CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest2, ptest1)); +-- This works... +CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest2, ptest1)); +DROP TABLE FKTABLE; +-- As does this +CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2)); +DROP TABLE FKTABLE; +DROP TABLE PKTABLE; + +-- Two columns, same table +-- Make sure this still works... +CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3, +ptest4) REFERENCES pktable(ptest1, ptest2)); +DROP TABLE PKTABLE; +-- And this, +CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3, +ptest4) REFERENCES pktable); +DROP TABLE PKTABLE; +-- This shouldn't (mixed up columns) +CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3, +ptest4) REFERENCES pktable(ptest2, ptest1)); +-- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types +CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4, +ptest3) REFERENCES pktable(ptest1, ptest2)); +-- Not this one either... Same as the last one except we didn't defined the columns being referenced. +CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4, +ptest3) REFERENCES pktable); + +-- +-- Now some cases with inheritance +-- Basic 2 table case: 1 column of matching types. +create table pktable_base (base1 int not null); +create table pktable (ptest1 int, primary key(base1), unique(base1, ptest1)) inherits (pktable_base); +create table fktable (ftest1 int references pktable(base1)); +-- now some ins, upd, del +insert into pktable(base1) values (1); +insert into pktable(base1) values (2); +-- let's insert a non-existent fktable value +insert into fktable(ftest1) values (3); +-- let's make a valid row for that +insert into pktable(base1) values (3); +insert into fktable(ftest1) values (3); +-- let's try removing a row that should fail from pktable +delete from pktable where base1>2; +-- okay, let's try updating all of the base1 values to *4 +-- which should fail. +update pktable set base1=base1*4; +-- okay, let's try an update that should work. +update pktable set base1=base1*4 where base1<3; +-- and a delete that should work +delete from pktable where base1>3; +-- cleanup +drop table fktable; +delete from pktable; + +-- Now 2 columns 2 tables, matching types +create table fktable (ftest1 int, ftest2 int, foreign key(ftest1, ftest2) references pktable(base1, ptest1)); +-- now some ins, upd, del +insert into pktable(base1, ptest1) values (1, 1); +insert into pktable(base1, ptest1) values (2, 2); +-- let's insert a non-existent fktable value +insert into fktable(ftest1, ftest2) values (3, 1); +-- let's make a valid row for that +insert into pktable(base1,ptest1) values (3, 1); +insert into fktable(ftest1, ftest2) values (3, 1); +-- let's try removing a row that should fail from pktable +delete from pktable where base1>2; +-- okay, let's try updating all of the base1 values to *4 +-- which should fail. +update pktable set base1=base1*4; +-- okay, let's try an update that should work. +update pktable set base1=base1*4 where base1<3; +-- and a delete that should work +delete from pktable where base1>3; +-- cleanup +drop table fktable; +drop table pktable; +drop table pktable_base; + +-- Now we'll do one all in 1 table with 2 columns of matching types +create table pktable_base(base1 int not null, base2 int); +create table pktable(ptest1 int, ptest2 int, primary key(base1, ptest1), foreign key(base2, ptest2) references + pktable(base1, ptest1)) inherits (pktable_base); +insert into pktable (base1, ptest1, base2, ptest2) values (1, 1, 1, 1); +insert into pktable (base1, ptest1, base2, ptest2) values (2, 1, 1, 1); +insert into pktable (base1, ptest1, base2, ptest2) values (2, 2, 2, 1); +insert into pktable (base1, ptest1, base2, ptest2) values (1, 3, 2, 2); +-- fails (3,2) isn't in base1, ptest1 +insert into pktable (base1, ptest1, base2, ptest2) values (2, 3, 3, 2); +-- fails (2,2) is being referenced +delete from pktable where base1=2; +-- fails (1,1) is being referenced (twice) +update pktable set base1=3 where base1=1; +-- this sequence of two deletes will work, since after the first there will be no (2,*) references +delete from pktable where base2=2; +delete from pktable where base1=2; +drop table pktable; +drop table pktable_base; + +-- 2 columns (2 tables), mismatched types +create table pktable_base(base1 int not null); +create table pktable(ptest1 inet, primary key(base1, ptest1)) inherits (pktable_base); +-- just generally bad types (with and without column references on the referenced table) +create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable); +create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable(base1, ptest1)); +-- let's mix up which columns reference which +create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable); +create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable(base1, ptest1)); +create table fktable(ftest1 int, ftest2 inet, foreign key(ftest1, ftest2) references pktable(ptest1, base1)); +drop table pktable; +drop table pktable_base; + +-- 2 columns (1 table), mismatched types +create table pktable_base(base1 int not null, base2 int); +create table pktable(ptest1 inet, ptest2 inet[], primary key(base1, ptest1), foreign key(base2, ptest2) references + pktable(base1, ptest1)) inherits (pktable_base); +create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(base2, ptest2) references + pktable(ptest1, base1)) inherits (pktable_base); +create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references + pktable(base1, ptest1)) inherits (pktable_base); +create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references + pktable(base1, ptest1)) inherits (pktable_base); +drop table pktable; +drop table pktable_base; + +-- +-- Deferrable constraints +-- + +-- deferrable, explicitly deferred +CREATE TABLE pktable ( + id INT4 PRIMARY KEY, + other INT4 +); + +CREATE TABLE fktable ( + id INT4 PRIMARY KEY, + fk INT4 REFERENCES pktable DEFERRABLE +); + +-- default to immediate: should fail +INSERT INTO fktable VALUES (5, 10); + +-- explicitly defer the constraint +BEGIN; + +SET CONSTRAINTS ALL DEFERRED; + +INSERT INTO fktable VALUES (10, 15); +INSERT INTO pktable VALUES (15, 0); -- make the FK insert valid + +COMMIT; + +DROP TABLE fktable, pktable; + +-- deferrable, initially deferred +CREATE TABLE pktable ( + id INT4 PRIMARY KEY, + other INT4 +); + +CREATE TABLE fktable ( + id INT4 PRIMARY KEY, + fk INT4 REFERENCES pktable DEFERRABLE INITIALLY DEFERRED +); + +-- default to deferred, should succeed +BEGIN; + +INSERT INTO fktable VALUES (100, 200); +INSERT INTO pktable VALUES (200, 500); -- make the FK insert valid + +COMMIT; + +-- default to deferred, explicitly make immediate +BEGIN; + +SET CONSTRAINTS ALL IMMEDIATE; + +-- should fail +INSERT INTO fktable VALUES (500, 1000); + +COMMIT; + +DROP TABLE fktable, pktable; + +-- tricky behavior: according to SQL99, if a deferred constraint is set +-- to 'immediate' mode, it should be checked for validity *immediately*, +-- not when the current transaction commits (i.e. the mode change applies +-- retroactively) +CREATE TABLE pktable ( + id INT4 PRIMARY KEY, + other INT4 +); + +CREATE TABLE fktable ( + id INT4 PRIMARY KEY, + fk INT4 REFERENCES pktable DEFERRABLE +); + +BEGIN; + +SET CONSTRAINTS ALL DEFERRED; + +-- should succeed, for now +INSERT INTO fktable VALUES (1000, 2000); + +-- should cause transaction abort, due to preceding error +SET CONSTRAINTS ALL IMMEDIATE; + +INSERT INTO pktable VALUES (2000, 3); -- too late + +COMMIT; + +DROP TABLE fktable, pktable; + +-- deferrable, initially deferred +CREATE TABLE pktable ( + id INT4 PRIMARY KEY, + other INT4 +); + +CREATE TABLE fktable ( + id INT4 PRIMARY KEY, + fk INT4 REFERENCES pktable DEFERRABLE INITIALLY DEFERRED +); + +BEGIN; + +-- no error here +INSERT INTO fktable VALUES (100, 200); + +-- error here on commit +COMMIT; + +DROP TABLE pktable, fktable; + +-- test notice about expensive referential integrity checks, +-- where the index cannot be used because of type incompatibilities. + +CREATE TEMP TABLE pktable ( + id1 INT4 PRIMARY KEY, + id2 VARCHAR(4) UNIQUE, + id3 REAL UNIQUE, + UNIQUE(id1, id2, id3) +); + +CREATE TEMP TABLE fktable ( + x1 INT4 REFERENCES pktable(id1), + x2 VARCHAR(4) REFERENCES pktable(id2), + x3 REAL REFERENCES pktable(id3), + x4 TEXT, + x5 INT2 +); + +-- check individual constraints with alter table. + +-- should fail + +-- varchar does not promote to real +ALTER TABLE fktable ADD CONSTRAINT fk_2_3 +FOREIGN KEY (x2) REFERENCES pktable(id3); + +-- nor to int4 +ALTER TABLE fktable ADD CONSTRAINT fk_2_1 +FOREIGN KEY (x2) REFERENCES pktable(id1); + +-- real does not promote to int4 +ALTER TABLE fktable ADD CONSTRAINT fk_3_1 +FOREIGN KEY (x3) REFERENCES pktable(id1); + +-- int4 does not promote to text +ALTER TABLE fktable ADD CONSTRAINT fk_1_2 +FOREIGN KEY (x1) REFERENCES pktable(id2); + +-- should succeed + +-- int4 promotes to real +ALTER TABLE fktable ADD CONSTRAINT fk_1_3 +FOREIGN KEY (x1) REFERENCES pktable(id3); + +-- text is compatible with varchar +ALTER TABLE fktable ADD CONSTRAINT fk_4_2 +FOREIGN KEY (x4) REFERENCES pktable(id2); + +-- int2 is part of integer opfamily as of 8.0 +ALTER TABLE fktable ADD CONSTRAINT fk_5_1 +FOREIGN KEY (x5) REFERENCES pktable(id1); + +-- check multikey cases, especially out-of-order column lists + +-- these should work + +ALTER TABLE fktable ADD CONSTRAINT fk_123_123 +FOREIGN KEY (x1,x2,x3) REFERENCES pktable(id1,id2,id3); + +ALTER TABLE fktable ADD CONSTRAINT fk_213_213 +FOREIGN KEY (x2,x1,x3) REFERENCES pktable(id2,id1,id3); + +ALTER TABLE fktable ADD CONSTRAINT fk_253_213 +FOREIGN KEY (x2,x5,x3) REFERENCES pktable(id2,id1,id3); + +-- these should fail + +ALTER TABLE fktable ADD CONSTRAINT fk_123_231 +FOREIGN KEY (x1,x2,x3) REFERENCES pktable(id2,id3,id1); + +ALTER TABLE fktable ADD CONSTRAINT fk_241_132 +FOREIGN KEY (x2,x4,x1) REFERENCES pktable(id1,id3,id2); + +DROP TABLE pktable, fktable; + +-- test a tricky case: we can elide firing the FK check trigger during +-- an UPDATE if the UPDATE did not change the foreign key +-- field. However, we can't do this if our transaction was the one that +-- created the updated row and the trigger is deferred, since our UPDATE +-- will have invalidated the original newly-inserted tuple, and therefore +-- cause the on-INSERT RI trigger not to be fired. + +CREATE TEMP TABLE pktable ( + id int primary key, + other int +); + +CREATE TEMP TABLE fktable ( + id int primary key, + fk int references pktable deferrable initially deferred +); + +INSERT INTO pktable VALUES (5, 10); + +BEGIN; + +-- doesn't match PK, but no error yet +INSERT INTO fktable VALUES (0, 20); + +-- don't change FK +UPDATE fktable SET id = id + 1; + +-- should catch error from initial INSERT +COMMIT; + +-- check same case when insert is in a different subtransaction than update + +BEGIN; + +-- doesn't match PK, but no error yet +INSERT INTO fktable VALUES (0, 20); + +-- UPDATE will be in a subxact +SAVEPOINT savept1; + +-- don't change FK +UPDATE fktable SET id = id + 1; + +-- should catch error from initial INSERT +COMMIT; + +BEGIN; + +-- INSERT will be in a subxact +SAVEPOINT savept1; + +-- doesn't match PK, but no error yet +INSERT INTO fktable VALUES (0, 20); + +RELEASE SAVEPOINT savept1; + +-- don't change FK +UPDATE fktable SET id = id + 1; + +-- should catch error from initial INSERT +COMMIT; + +BEGIN; + +-- doesn't match PK, but no error yet +INSERT INTO fktable VALUES (0, 20); + +-- UPDATE will be in a subxact +SAVEPOINT savept1; + +-- don't change FK +UPDATE fktable SET id = id + 1; + +-- Roll back the UPDATE +ROLLBACK TO savept1; + +-- should catch error from initial INSERT +COMMIT; + +-- +-- check ALTER CONSTRAINT +-- + +INSERT INTO fktable VALUES (1, 5); + +ALTER TABLE fktable ALTER CONSTRAINT fktable_fk_fkey DEFERRABLE INITIALLY IMMEDIATE; + +BEGIN; + +-- doesn't match FK, should throw error now +UPDATE pktable SET id = 10 WHERE id = 5; + +COMMIT; + +BEGIN; + +-- doesn't match PK, should throw error now +INSERT INTO fktable VALUES (0, 20); + +COMMIT; + +-- try additional syntax +ALTER TABLE fktable ALTER CONSTRAINT fktable_fk_fkey NOT DEFERRABLE; +-- illegal option +ALTER TABLE fktable ALTER CONSTRAINT fktable_fk_fkey NOT DEFERRABLE INITIALLY DEFERRED; + +-- test order of firing of FK triggers when several RI-induced changes need to +-- be made to the same row. This was broken by subtransaction-related +-- changes in 8.0. + +CREATE TEMP TABLE users ( + id INT PRIMARY KEY, + name VARCHAR NOT NULL +); + +INSERT INTO users VALUES (1, 'Jozko'); +INSERT INTO users VALUES (2, 'Ferko'); +INSERT INTO users VALUES (3, 'Samko'); + +CREATE TEMP TABLE tasks ( + id INT PRIMARY KEY, + owner INT REFERENCES users ON UPDATE CASCADE ON DELETE SET NULL, + worker INT REFERENCES users ON UPDATE CASCADE ON DELETE SET NULL, + checked_by INT REFERENCES users ON UPDATE CASCADE ON DELETE SET NULL +); + +INSERT INTO tasks VALUES (1,1,NULL,NULL); +INSERT INTO tasks VALUES (2,2,2,NULL); +INSERT INTO tasks VALUES (3,3,3,3); + +SELECT * FROM tasks; + +UPDATE users SET id = 4 WHERE id = 3; + +SELECT * FROM tasks; + +DELETE FROM users WHERE id = 4; + +SELECT * FROM tasks; + +-- could fail with only 2 changes to make, if row was already updated +BEGIN; +UPDATE tasks set id=id WHERE id=2; +SELECT * FROM tasks; +DELETE FROM users WHERE id = 2; +SELECT * FROM tasks; +COMMIT; + +-- +-- Test self-referential FK with CASCADE (bug #6268) +-- +create temp table selfref ( + a int primary key, + b int, + foreign key (b) references selfref (a) + on update cascade on delete cascade +); + +insert into selfref (a, b) +values + (0, 0), + (1, 1); + +begin; + update selfref set a = 123 where a = 0; + select a, b from selfref; + update selfref set a = 456 where a = 123; + select a, b from selfref; +commit; + +-- +-- Test that SET DEFAULT actions recognize updates to default values +-- +create temp table defp (f1 int primary key); +create temp table defc (f1 int default 0 + references defp on delete set default); +insert into defp values (0), (1), (2); +insert into defc values (2); +select * from defc; +delete from defp where f1 = 2; +select * from defc; +delete from defp where f1 = 0; -- fail +alter table defc alter column f1 set default 1; +delete from defp where f1 = 0; +select * from defc; +delete from defp where f1 = 1; -- fail + +-- +-- Test the difference between NO ACTION and RESTRICT +-- +create temp table pp (f1 int primary key); +create temp table cc (f1 int references pp on update no action on delete no action); +insert into pp values(12); +insert into pp values(11); +update pp set f1=f1+1; +insert into cc values(13); +update pp set f1=f1+1; +update pp set f1=f1+1; -- fail +delete from pp where f1 = 13; -- fail +drop table pp, cc; + +create temp table pp (f1 int primary key); +create temp table cc (f1 int references pp on update restrict on delete restrict); +insert into pp values(12); +insert into pp values(11); +update pp set f1=f1+1; +insert into cc values(13); +update pp set f1=f1+1; -- fail +delete from pp where f1 = 13; -- fail +drop table pp, cc; + +-- +-- Test interaction of foreign-key optimization with rules (bug #14219) +-- +create temp table t1 (a integer primary key, b text); +create temp table t2 (a integer primary key, b integer references t1); +create rule r1 as on delete to t1 do delete from t2 where t2.b = old.a; + +explain (costs off) delete from t1 where a = 1; +delete from t1 where a = 1; + +-- Test a primary key with attributes located in later attnum positions +-- compared to the fk attributes. +create table pktable2 (a int, b int, c int, d int, e int, primary key (d, e)); +create table fktable2 (d int, e int, foreign key (d, e) references pktable2); +insert into pktable2 values (1, 2, 3, 4, 5); +insert into fktable2 values (4, 5); +delete from pktable2; +update pktable2 set d = 5; +drop table pktable2, fktable2; + +-- Test truncation of long foreign key names +create table pktable1 (a int primary key); +create table pktable2 (a int, b int, primary key (a, b)); +create table fktable2 ( + a int, + b int, + very_very_long_column_name_to_exceed_63_characters int, + foreign key (very_very_long_column_name_to_exceed_63_characters) references pktable1, + foreign key (a, very_very_long_column_name_to_exceed_63_characters) references pktable2, + foreign key (a, very_very_long_column_name_to_exceed_63_characters) references pktable2 +); +select conname from pg_constraint where conrelid = 'fktable2'::regclass order by conname; +drop table pktable1, pktable2, fktable2; + +-- +-- Test deferred FK check on a tuple deleted by a rolled-back subtransaction +-- +create table pktable2(f1 int primary key); +create table fktable2(f1 int references pktable2 deferrable initially deferred); +insert into pktable2 values(1); + +begin; +insert into fktable2 values(1); +savepoint x; +delete from fktable2; +rollback to x; +commit; + +begin; +insert into fktable2 values(2); +savepoint x; +delete from fktable2; +rollback to x; +commit; -- fail + +-- +-- Test that we prevent dropping FK constraint with pending trigger events +-- +begin; +insert into fktable2 values(2); +alter table fktable2 drop constraint fktable2_f1_fkey; +commit; + +begin; +delete from pktable2 where f1 = 1; +alter table fktable2 drop constraint fktable2_f1_fkey; +commit; + +drop table pktable2, fktable2; + +-- +-- Test keys that "look" different but compare as equal +-- +create table pktable2 (a float8, b float8, primary key (a, b)); +create table fktable2 (x float8, y float8, foreign key (x, y) references pktable2 (a, b) on update cascade); + +insert into pktable2 values ('-0', '-0'); +insert into fktable2 values ('-0', '-0'); + +select * from pktable2; +select * from fktable2; + +update pktable2 set a = '0' where a = '-0'; + +select * from pktable2; +-- should have updated fktable2.x +select * from fktable2; + +drop table pktable2, fktable2; + + +-- +-- Foreign keys and partitioned tables +-- + +-- Creation of a partitioned hierarchy with irregular definitions +CREATE TABLE fk_notpartitioned_pk (fdrop1 int, a int, fdrop2 int, b int, + PRIMARY KEY (a, b)); +ALTER TABLE fk_notpartitioned_pk DROP COLUMN fdrop1, DROP COLUMN fdrop2; +CREATE TABLE fk_partitioned_fk (b int, fdrop1 int, a int) PARTITION BY RANGE (a, b); +ALTER TABLE fk_partitioned_fk DROP COLUMN fdrop1; +CREATE TABLE fk_partitioned_fk_1 (fdrop1 int, fdrop2 int, a int, fdrop3 int, b int); +ALTER TABLE fk_partitioned_fk_1 DROP COLUMN fdrop1, DROP COLUMN fdrop2, DROP COLUMN fdrop3; +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_1 FOR VALUES FROM (0,0) TO (1000,1000); +ALTER TABLE fk_partitioned_fk ADD FOREIGN KEY (a, b) REFERENCES fk_notpartitioned_pk; +CREATE TABLE fk_partitioned_fk_2 (b int, fdrop1 int, fdrop2 int, a int); +ALTER TABLE fk_partitioned_fk_2 DROP COLUMN fdrop1, DROP COLUMN fdrop2; +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_2 FOR VALUES FROM (1000,1000) TO (2000,2000); + +CREATE TABLE fk_partitioned_fk_3 (fdrop1 int, fdrop2 int, fdrop3 int, fdrop4 int, b int, a int) + PARTITION BY HASH (a); +ALTER TABLE fk_partitioned_fk_3 DROP COLUMN fdrop1, DROP COLUMN fdrop2, + DROP COLUMN fdrop3, DROP COLUMN fdrop4; +CREATE TABLE fk_partitioned_fk_3_0 PARTITION OF fk_partitioned_fk_3 FOR VALUES WITH (MODULUS 5, REMAINDER 0); +CREATE TABLE fk_partitioned_fk_3_1 PARTITION OF fk_partitioned_fk_3 FOR VALUES WITH (MODULUS 5, REMAINDER 1); +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_3 + FOR VALUES FROM (2000,2000) TO (3000,3000); + +-- Creating a foreign key with ONLY on a partitioned table referencing +-- a non-partitioned table fails. +ALTER TABLE ONLY fk_partitioned_fk ADD FOREIGN KEY (a, b) + REFERENCES fk_notpartitioned_pk; +-- Adding a NOT VALID foreign key on a partitioned table referencing +-- a non-partitioned table fails. +ALTER TABLE fk_partitioned_fk ADD FOREIGN KEY (a, b) + REFERENCES fk_notpartitioned_pk NOT VALID; + +-- these inserts, targeting both the partition directly as well as the +-- partitioned table, should all fail +INSERT INTO fk_partitioned_fk (a,b) VALUES (500, 501); +INSERT INTO fk_partitioned_fk_1 (a,b) VALUES (500, 501); +INSERT INTO fk_partitioned_fk (a,b) VALUES (1500, 1501); +INSERT INTO fk_partitioned_fk_2 (a,b) VALUES (1500, 1501); +INSERT INTO fk_partitioned_fk (a,b) VALUES (2500, 2502); +INSERT INTO fk_partitioned_fk_3 (a,b) VALUES (2500, 2502); +INSERT INTO fk_partitioned_fk (a,b) VALUES (2501, 2503); +INSERT INTO fk_partitioned_fk_3 (a,b) VALUES (2501, 2503); + +-- but if we insert the values that make them valid, then they work +INSERT INTO fk_notpartitioned_pk VALUES (500, 501), (1500, 1501), + (2500, 2502), (2501, 2503); +INSERT INTO fk_partitioned_fk (a,b) VALUES (500, 501); +INSERT INTO fk_partitioned_fk (a,b) VALUES (1500, 1501); +INSERT INTO fk_partitioned_fk (a,b) VALUES (2500, 2502); +INSERT INTO fk_partitioned_fk (a,b) VALUES (2501, 2503); + +-- this update fails because there is no referenced row +UPDATE fk_partitioned_fk SET a = a + 1 WHERE a = 2501; +-- but we can fix it thusly: +INSERT INTO fk_notpartitioned_pk (a,b) VALUES (2502, 2503); +UPDATE fk_partitioned_fk SET a = a + 1 WHERE a = 2501; + +-- these updates would leave lingering rows in the referencing table; disallow +UPDATE fk_notpartitioned_pk SET b = 502 WHERE a = 500; +UPDATE fk_notpartitioned_pk SET b = 1502 WHERE a = 1500; +UPDATE fk_notpartitioned_pk SET b = 2504 WHERE a = 2500; +-- check psql behavior +\d fk_notpartitioned_pk +ALTER TABLE fk_partitioned_fk DROP CONSTRAINT fk_partitioned_fk_a_b_fkey; +-- done. +DROP TABLE fk_notpartitioned_pk, fk_partitioned_fk; + +-- Altering a type referenced by a foreign key needs to drop/recreate the FK. +-- Ensure that works. +CREATE TABLE fk_notpartitioned_pk (a INT, PRIMARY KEY(a), CHECK (a > 0)); +CREATE TABLE fk_partitioned_fk (a INT REFERENCES fk_notpartitioned_pk(a) PRIMARY KEY) PARTITION BY RANGE(a); +CREATE TABLE fk_partitioned_fk_1 PARTITION OF fk_partitioned_fk FOR VALUES FROM (MINVALUE) TO (MAXVALUE); +INSERT INTO fk_notpartitioned_pk VALUES (1); +INSERT INTO fk_partitioned_fk VALUES (1); +ALTER TABLE fk_notpartitioned_pk ALTER COLUMN a TYPE bigint; +DELETE FROM fk_notpartitioned_pk WHERE a = 1; +DROP TABLE fk_notpartitioned_pk, fk_partitioned_fk; + +-- Test some other exotic foreign key features: MATCH SIMPLE, ON UPDATE/DELETE +-- actions +CREATE TABLE fk_notpartitioned_pk (a int, b int, primary key (a, b)); +CREATE TABLE fk_partitioned_fk (a int default 2501, b int default 142857) PARTITION BY LIST (a); +CREATE TABLE fk_partitioned_fk_1 PARTITION OF fk_partitioned_fk FOR VALUES IN (NULL,500,501,502); +ALTER TABLE fk_partitioned_fk ADD FOREIGN KEY (a, b) + REFERENCES fk_notpartitioned_pk MATCH SIMPLE + ON DELETE SET NULL ON UPDATE SET NULL; +CREATE TABLE fk_partitioned_fk_2 PARTITION OF fk_partitioned_fk FOR VALUES IN (1500,1502); +CREATE TABLE fk_partitioned_fk_3 (a int, b int); +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_3 FOR VALUES IN (2500,2501,2502,2503); + +-- this insert fails +INSERT INTO fk_partitioned_fk (a, b) VALUES (2502, 2503); +INSERT INTO fk_partitioned_fk_3 (a, b) VALUES (2502, 2503); +-- but since the FK is MATCH SIMPLE, this one doesn't +INSERT INTO fk_partitioned_fk_3 (a, b) VALUES (2502, NULL); +-- now create the referenced row ... +INSERT INTO fk_notpartitioned_pk VALUES (2502, 2503); +--- and now the same insert work +INSERT INTO fk_partitioned_fk_3 (a, b) VALUES (2502, 2503); +-- this always works +INSERT INTO fk_partitioned_fk (a,b) VALUES (NULL, NULL); + +-- MATCH FULL +INSERT INTO fk_notpartitioned_pk VALUES (1, 2); +CREATE TABLE fk_partitioned_fk_full (x int, y int) PARTITION BY RANGE (x); +CREATE TABLE fk_partitioned_fk_full_1 PARTITION OF fk_partitioned_fk_full DEFAULT; +INSERT INTO fk_partitioned_fk_full VALUES (1, NULL); +ALTER TABLE fk_partitioned_fk_full ADD FOREIGN KEY (x, y) REFERENCES fk_notpartitioned_pk MATCH FULL; -- fails +TRUNCATE fk_partitioned_fk_full; +ALTER TABLE fk_partitioned_fk_full ADD FOREIGN KEY (x, y) REFERENCES fk_notpartitioned_pk MATCH FULL; +INSERT INTO fk_partitioned_fk_full VALUES (1, NULL); -- fails +DROP TABLE fk_partitioned_fk_full; + +-- ON UPDATE SET NULL +SELECT tableoid::regclass, a, b FROM fk_partitioned_fk WHERE b IS NULL ORDER BY a; +UPDATE fk_notpartitioned_pk SET a = a + 1 WHERE a = 2502; +SELECT tableoid::regclass, a, b FROM fk_partitioned_fk WHERE b IS NULL ORDER BY a; + +-- ON DELETE SET NULL +INSERT INTO fk_partitioned_fk VALUES (2503, 2503); +SELECT count(*) FROM fk_partitioned_fk WHERE a IS NULL; +DELETE FROM fk_notpartitioned_pk; +SELECT count(*) FROM fk_partitioned_fk WHERE a IS NULL; + +-- ON UPDATE/DELETE SET DEFAULT +ALTER TABLE fk_partitioned_fk DROP CONSTRAINT fk_partitioned_fk_a_b_fkey; +ALTER TABLE fk_partitioned_fk ADD FOREIGN KEY (a, b) + REFERENCES fk_notpartitioned_pk + ON DELETE SET DEFAULT ON UPDATE SET DEFAULT; +INSERT INTO fk_notpartitioned_pk VALUES (2502, 2503); +INSERT INTO fk_partitioned_fk_3 (a, b) VALUES (2502, 2503); +-- this fails, because the defaults for the referencing table are not present +-- in the referenced table: +UPDATE fk_notpartitioned_pk SET a = 1500 WHERE a = 2502; +-- but inserting the row we can make it work: +INSERT INTO fk_notpartitioned_pk VALUES (2501, 142857); +UPDATE fk_notpartitioned_pk SET a = 1500 WHERE a = 2502; +SELECT * FROM fk_partitioned_fk WHERE b = 142857; + +-- ON UPDATE/DELETE CASCADE +ALTER TABLE fk_partitioned_fk DROP CONSTRAINT fk_partitioned_fk_a_b_fkey; +ALTER TABLE fk_partitioned_fk ADD FOREIGN KEY (a, b) + REFERENCES fk_notpartitioned_pk + ON DELETE CASCADE ON UPDATE CASCADE; +UPDATE fk_notpartitioned_pk SET a = 2502 WHERE a = 2501; +SELECT * FROM fk_partitioned_fk WHERE b = 142857; + +-- Now you see it ... +SELECT * FROM fk_partitioned_fk WHERE b = 142857; +DELETE FROM fk_notpartitioned_pk WHERE b = 142857; +-- now you don't. +SELECT * FROM fk_partitioned_fk WHERE a = 142857; + +-- verify that DROP works +DROP TABLE fk_partitioned_fk_2; + +-- Test behavior of the constraint together with attaching and detaching +-- partitions. +CREATE TABLE fk_partitioned_fk_2 PARTITION OF fk_partitioned_fk FOR VALUES IN (1500,1502); +ALTER TABLE fk_partitioned_fk DETACH PARTITION fk_partitioned_fk_2; +BEGIN; +DROP TABLE fk_partitioned_fk; +-- constraint should still be there +\d fk_partitioned_fk_2; +ROLLBACK; +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_2 FOR VALUES IN (1500,1502); +DROP TABLE fk_partitioned_fk_2; +CREATE TABLE fk_partitioned_fk_2 (b int, c text, a int, + FOREIGN KEY (a, b) REFERENCES fk_notpartitioned_pk ON UPDATE CASCADE ON DELETE CASCADE); +ALTER TABLE fk_partitioned_fk_2 DROP COLUMN c; +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_2 FOR VALUES IN (1500,1502); +-- should have only one constraint +\d fk_partitioned_fk_2 +DROP TABLE fk_partitioned_fk_2; + +CREATE TABLE fk_partitioned_fk_4 (a int, b int, FOREIGN KEY (a, b) REFERENCES fk_notpartitioned_pk(a, b) ON UPDATE CASCADE ON DELETE CASCADE) PARTITION BY RANGE (b, a); +CREATE TABLE fk_partitioned_fk_4_1 PARTITION OF fk_partitioned_fk_4 FOR VALUES FROM (1,1) TO (100,100); +CREATE TABLE fk_partitioned_fk_4_2 (a int, b int, FOREIGN KEY (a, b) REFERENCES fk_notpartitioned_pk(a, b) ON UPDATE SET NULL); +ALTER TABLE fk_partitioned_fk_4 ATTACH PARTITION fk_partitioned_fk_4_2 FOR VALUES FROM (100,100) TO (1000,1000); +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_4 FOR VALUES IN (3500,3502); +ALTER TABLE fk_partitioned_fk DETACH PARTITION fk_partitioned_fk_4; +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_4 FOR VALUES IN (3500,3502); +-- should only have one constraint +\d fk_partitioned_fk_4 +\d fk_partitioned_fk_4_1 +-- this one has an FK with mismatched properties +\d fk_partitioned_fk_4_2 + +CREATE TABLE fk_partitioned_fk_5 (a int, b int, + FOREIGN KEY (a, b) REFERENCES fk_notpartitioned_pk(a, b) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE, + FOREIGN KEY (a, b) REFERENCES fk_notpartitioned_pk(a, b) MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE) + PARTITION BY RANGE (a); +CREATE TABLE fk_partitioned_fk_5_1 (a int, b int, FOREIGN KEY (a, b) REFERENCES fk_notpartitioned_pk); +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_5 FOR VALUES IN (4500); +ALTER TABLE fk_partitioned_fk_5 ATTACH PARTITION fk_partitioned_fk_5_1 FOR VALUES FROM (0) TO (10); +ALTER TABLE fk_partitioned_fk DETACH PARTITION fk_partitioned_fk_5; +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_5 FOR VALUES IN (4500); +-- this one has two constraints, similar but not quite the one in the parent, +-- so it gets a new one +\d fk_partitioned_fk_5 +-- verify that it works to reattaching a child with multiple candidate +-- constraints +ALTER TABLE fk_partitioned_fk_5 DETACH PARTITION fk_partitioned_fk_5_1; +ALTER TABLE fk_partitioned_fk_5 ATTACH PARTITION fk_partitioned_fk_5_1 FOR VALUES FROM (0) TO (10); +\d fk_partitioned_fk_5_1 + +-- verify that attaching a table checks that the existing data satisfies the +-- constraint +CREATE TABLE fk_partitioned_fk_2 (a int, b int) PARTITION BY RANGE (b); +CREATE TABLE fk_partitioned_fk_2_1 PARTITION OF fk_partitioned_fk_2 FOR VALUES FROM (0) TO (1000); +CREATE TABLE fk_partitioned_fk_2_2 PARTITION OF fk_partitioned_fk_2 FOR VALUES FROM (1000) TO (2000); +INSERT INTO fk_partitioned_fk_2 VALUES (1600, 601), (1600, 1601); +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_2 + FOR VALUES IN (1600); +INSERT INTO fk_notpartitioned_pk VALUES (1600, 601), (1600, 1601); +ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_2 + FOR VALUES IN (1600); + +-- leave these tables around intentionally + +-- test the case when the referenced table is owned by a different user +create role regress_other_partitioned_fk_owner; +grant references on fk_notpartitioned_pk to regress_other_partitioned_fk_owner; +set role regress_other_partitioned_fk_owner; +create table other_partitioned_fk(a int, b int) partition by list (a); +create table other_partitioned_fk_1 partition of other_partitioned_fk + for values in (2048); +insert into other_partitioned_fk + select 2048, x from generate_series(1,10) x; +-- this should fail +alter table other_partitioned_fk add foreign key (a, b) + references fk_notpartitioned_pk(a, b); +-- add the missing keys and retry +reset role; +insert into fk_notpartitioned_pk (a, b) + select 2048, x from generate_series(1,10) x; +set role regress_other_partitioned_fk_owner; +alter table other_partitioned_fk add foreign key (a, b) + references fk_notpartitioned_pk(a, b); +-- clean up +drop table other_partitioned_fk; +reset role; +revoke all on fk_notpartitioned_pk from regress_other_partitioned_fk_owner; +drop role regress_other_partitioned_fk_owner; + +-- Test creating a constraint at the parent that already exists in partitions. +-- There should be no duplicated constraints, and attempts to drop the +-- constraint in partitions should raise appropriate errors. +create schema fkpart0 + create table pkey (a int primary key) + create table fk_part (a int) partition by list (a) + create table fk_part_1 partition of fk_part + (foreign key (a) references fkpart0.pkey) for values in (1) + create table fk_part_23 partition of fk_part + (foreign key (a) references fkpart0.pkey) for values in (2, 3) + partition by list (a) + create table fk_part_23_2 partition of fk_part_23 for values in (2); + +alter table fkpart0.fk_part add foreign key (a) references fkpart0.pkey; +\d fkpart0.fk_part_1 \\ -- should have only one FK +alter table fkpart0.fk_part_1 drop constraint fk_part_1_a_fkey; + +\d fkpart0.fk_part_23 \\ -- should have only one FK +\d fkpart0.fk_part_23_2 \\ -- should have only one FK +alter table fkpart0.fk_part_23 drop constraint fk_part_23_a_fkey; +alter table fkpart0.fk_part_23_2 drop constraint fk_part_23_a_fkey; + +create table fkpart0.fk_part_4 partition of fkpart0.fk_part for values in (4); +\d fkpart0.fk_part_4 +alter table fkpart0.fk_part_4 drop constraint fk_part_a_fkey; + +create table fkpart0.fk_part_56 partition of fkpart0.fk_part + for values in (5,6) partition by list (a); +create table fkpart0.fk_part_56_5 partition of fkpart0.fk_part_56 + for values in (5); +\d fkpart0.fk_part_56 +alter table fkpart0.fk_part_56 drop constraint fk_part_a_fkey; +alter table fkpart0.fk_part_56_5 drop constraint fk_part_a_fkey; + +-- verify that attaching and detaching partitions maintains the right set of +-- triggers +create schema fkpart1 + create table pkey (a int primary key) + create table fk_part (a int) partition by list (a) + create table fk_part_1 partition of fk_part for values in (1) partition by list (a) + create table fk_part_1_1 partition of fk_part_1 for values in (1); +alter table fkpart1.fk_part add foreign key (a) references fkpart1.pkey; +insert into fkpart1.fk_part values (1); -- should fail +insert into fkpart1.pkey values (1); +insert into fkpart1.fk_part values (1); +delete from fkpart1.pkey where a = 1; -- should fail +alter table fkpart1.fk_part detach partition fkpart1.fk_part_1; +create table fkpart1.fk_part_1_2 partition of fkpart1.fk_part_1 for values in (2); +insert into fkpart1.fk_part_1 values (2); -- should fail +delete from fkpart1.pkey where a = 1; + +-- verify that attaching and detaching partitions manipulates the inheritance +-- properties of their FK constraints correctly +create schema fkpart2 + create table pkey (a int primary key) + create table fk_part (a int, constraint fkey foreign key (a) references fkpart2.pkey) partition by list (a) + create table fk_part_1 partition of fkpart2.fk_part for values in (1) partition by list (a) + create table fk_part_1_1 (a int, constraint my_fkey foreign key (a) references fkpart2.pkey); +alter table fkpart2.fk_part_1 attach partition fkpart2.fk_part_1_1 for values in (1); +alter table fkpart2.fk_part_1 drop constraint fkey; -- should fail +alter table fkpart2.fk_part_1_1 drop constraint my_fkey; -- should fail +alter table fkpart2.fk_part detach partition fkpart2.fk_part_1; +alter table fkpart2.fk_part_1 drop constraint fkey; -- ok +alter table fkpart2.fk_part_1_1 drop constraint my_fkey; -- doesn't exist + +-- verify constraint deferrability +create schema fkpart3 + create table pkey (a int primary key) + create table fk_part (a int, constraint fkey foreign key (a) references fkpart3.pkey deferrable initially immediate) partition by list (a) + create table fk_part_1 partition of fkpart3.fk_part for values in (1) partition by list (a) + create table fk_part_1_1 partition of fkpart3.fk_part_1 for values in (1) + create table fk_part_2 partition of fkpart3.fk_part for values in (2); +begin; +set constraints fkpart3.fkey deferred; +insert into fkpart3.fk_part values (1); +insert into fkpart3.pkey values (1); +commit; +begin; +set constraints fkpart3.fkey deferred; +delete from fkpart3.pkey; +delete from fkpart3.fk_part; +commit; + +drop schema fkpart0, fkpart1, fkpart2, fkpart3 cascade; + +-- Test a partitioned table as referenced table. + +-- Verify basic functionality with a regular partition creation and a partition +-- with a different column layout, as well as partitions added (created and +-- attached) after creating the foreign key. +CREATE SCHEMA fkpart3; +SET search_path TO fkpart3; + +CREATE TABLE pk (a int PRIMARY KEY) PARTITION BY RANGE (a); +CREATE TABLE pk1 PARTITION OF pk FOR VALUES FROM (0) TO (1000); +CREATE TABLE pk2 (b int, a int); +ALTER TABLE pk2 DROP COLUMN b; +ALTER TABLE pk2 ALTER a SET NOT NULL; +ALTER TABLE pk ATTACH PARTITION pk2 FOR VALUES FROM (1000) TO (2000); + +CREATE TABLE fk (a int) PARTITION BY RANGE (a); +CREATE TABLE fk1 PARTITION OF fk FOR VALUES FROM (0) TO (750); +ALTER TABLE fk ADD FOREIGN KEY (a) REFERENCES pk; +CREATE TABLE fk2 (b int, a int) ; +ALTER TABLE fk2 DROP COLUMN b; +ALTER TABLE fk ATTACH PARTITION fk2 FOR VALUES FROM (750) TO (3500); + +CREATE TABLE pk3 PARTITION OF pk FOR VALUES FROM (2000) TO (3000); +CREATE TABLE pk4 (LIKE pk); +ALTER TABLE pk ATTACH PARTITION pk4 FOR VALUES FROM (3000) TO (4000); + +CREATE TABLE pk5 (c int, b int, a int NOT NULL) PARTITION BY RANGE (a); +ALTER TABLE pk5 DROP COLUMN b, DROP COLUMN c; +CREATE TABLE pk51 PARTITION OF pk5 FOR VALUES FROM (4000) TO (4500); +CREATE TABLE pk52 PARTITION OF pk5 FOR VALUES FROM (4500) TO (5000); +ALTER TABLE pk ATTACH PARTITION pk5 FOR VALUES FROM (4000) TO (5000); + +CREATE TABLE fk3 PARTITION OF fk FOR VALUES FROM (3500) TO (5000); + +-- these should fail: referenced value not present +INSERT into fk VALUES (1); +INSERT into fk VALUES (1000); +INSERT into fk VALUES (2000); +INSERT into fk VALUES (3000); +INSERT into fk VALUES (4000); +INSERT into fk VALUES (4500); +-- insert into the referenced table, now they should work +INSERT into pk VALUES (1), (1000), (2000), (3000), (4000), (4500); +INSERT into fk VALUES (1), (1000), (2000), (3000), (4000), (4500); + +-- should fail: referencing value present +DELETE FROM pk WHERE a = 1; +DELETE FROM pk WHERE a = 1000; +DELETE FROM pk WHERE a = 2000; +DELETE FROM pk WHERE a = 3000; +DELETE FROM pk WHERE a = 4000; +DELETE FROM pk WHERE a = 4500; +UPDATE pk SET a = 2 WHERE a = 1; +UPDATE pk SET a = 1002 WHERE a = 1000; +UPDATE pk SET a = 2002 WHERE a = 2000; +UPDATE pk SET a = 3002 WHERE a = 3000; +UPDATE pk SET a = 4002 WHERE a = 4000; +UPDATE pk SET a = 4502 WHERE a = 4500; +-- now they should work +DELETE FROM fk; +UPDATE pk SET a = 2 WHERE a = 1; +DELETE FROM pk WHERE a = 2; +UPDATE pk SET a = 1002 WHERE a = 1000; +DELETE FROM pk WHERE a = 1002; +UPDATE pk SET a = 2002 WHERE a = 2000; +DELETE FROM pk WHERE a = 2002; +UPDATE pk SET a = 3002 WHERE a = 3000; +DELETE FROM pk WHERE a = 3002; +UPDATE pk SET a = 4002 WHERE a = 4000; +DELETE FROM pk WHERE a = 4002; +UPDATE pk SET a = 4502 WHERE a = 4500; +DELETE FROM pk WHERE a = 4502; + +CREATE SCHEMA fkpart4; +SET search_path TO fkpart4; +-- dropping/detaching PARTITIONs is prevented if that would break +-- a foreign key's existing data +CREATE TABLE droppk (a int PRIMARY KEY) PARTITION BY RANGE (a); +CREATE TABLE droppk1 PARTITION OF droppk FOR VALUES FROM (0) TO (1000); +CREATE TABLE droppk_d PARTITION OF droppk DEFAULT; +CREATE TABLE droppk2 PARTITION OF droppk FOR VALUES FROM (1000) TO (2000) + PARTITION BY RANGE (a); +CREATE TABLE droppk21 PARTITION OF droppk2 FOR VALUES FROM (1000) TO (1400); +CREATE TABLE droppk2_d PARTITION OF droppk2 DEFAULT; +INSERT into droppk VALUES (1), (1000), (1500), (2000); +CREATE TABLE dropfk (a int REFERENCES droppk); +INSERT into dropfk VALUES (1), (1000), (1500), (2000); +-- these should all fail +ALTER TABLE droppk DETACH PARTITION droppk_d; +ALTER TABLE droppk2 DETACH PARTITION droppk2_d; +ALTER TABLE droppk DETACH PARTITION droppk1; +ALTER TABLE droppk DETACH PARTITION droppk2; +ALTER TABLE droppk2 DETACH PARTITION droppk21; +-- dropping partitions is disallowed +DROP TABLE droppk_d; +DROP TABLE droppk2_d; +DROP TABLE droppk1; +DROP TABLE droppk2; +DROP TABLE droppk21; +DELETE FROM dropfk; +-- dropping partitions is disallowed, even when no referencing values +DROP TABLE droppk_d; +DROP TABLE droppk2_d; +DROP TABLE droppk1; +-- but DETACH is allowed, and DROP afterwards works +ALTER TABLE droppk2 DETACH PARTITION droppk21; +DROP TABLE droppk2; + +-- Verify that initial constraint creation and cloning behave correctly +CREATE SCHEMA fkpart5; +SET search_path TO fkpart5; +CREATE TABLE pk (a int PRIMARY KEY) PARTITION BY LIST (a); +CREATE TABLE pk1 PARTITION OF pk FOR VALUES IN (1) PARTITION BY LIST (a); +CREATE TABLE pk11 PARTITION OF pk1 FOR VALUES IN (1); +CREATE TABLE fk (a int) PARTITION BY LIST (a); +CREATE TABLE fk1 PARTITION OF fk FOR VALUES IN (1) PARTITION BY LIST (a); +CREATE TABLE fk11 PARTITION OF fk1 FOR VALUES IN (1); +ALTER TABLE fk ADD FOREIGN KEY (a) REFERENCES pk; +CREATE TABLE pk2 PARTITION OF pk FOR VALUES IN (2); +CREATE TABLE pk3 (a int NOT NULL) PARTITION BY LIST (a); +CREATE TABLE pk31 PARTITION OF pk3 FOR VALUES IN (31); +CREATE TABLE pk32 (b int, a int NOT NULL); +ALTER TABLE pk32 DROP COLUMN b; +ALTER TABLE pk3 ATTACH PARTITION pk32 FOR VALUES IN (32); +ALTER TABLE pk ATTACH PARTITION pk3 FOR VALUES IN (31, 32); +CREATE TABLE fk2 PARTITION OF fk FOR VALUES IN (2); +CREATE TABLE fk3 (b int, a int); +ALTER TABLE fk3 DROP COLUMN b; +ALTER TABLE fk ATTACH PARTITION fk3 FOR VALUES IN (3); +SELECT pg_describe_object('pg_constraint'::regclass, oid, 0), confrelid::regclass, + CASE WHEN conparentid <> 0 THEN pg_describe_object('pg_constraint'::regclass, conparentid, 0) ELSE 'TOP' END +FROM pg_catalog.pg_constraint +WHERE conrelid IN (SELECT relid FROM pg_partition_tree('fk')) +ORDER BY conrelid::regclass::text, conname; +CREATE TABLE fk4 (LIKE fk); +INSERT INTO fk4 VALUES (50); +ALTER TABLE fk ATTACH PARTITION fk4 FOR VALUES IN (50); + +-- Verify constraint deferrability +CREATE SCHEMA fkpart9; +SET search_path TO fkpart9; +CREATE TABLE pk (a int PRIMARY KEY) PARTITION BY LIST (a); +CREATE TABLE pk1 PARTITION OF pk FOR VALUES IN (1, 2) PARTITION BY LIST (a); +CREATE TABLE pk11 PARTITION OF pk1 FOR VALUES IN (1); +CREATE TABLE pk3 PARTITION OF pk FOR VALUES IN (3); +CREATE TABLE fk (a int REFERENCES pk DEFERRABLE INITIALLY IMMEDIATE); +INSERT INTO fk VALUES (1); -- should fail +BEGIN; +SET CONSTRAINTS fk_a_fkey DEFERRED; +INSERT INTO fk VALUES (1); +COMMIT; -- should fail +BEGIN; +SET CONSTRAINTS fk_a_fkey DEFERRED; +INSERT INTO fk VALUES (1); +INSERT INTO pk VALUES (1); +COMMIT; -- OK +BEGIN; +SET CONSTRAINTS fk_a_fkey DEFERRED; +DELETE FROM pk WHERE a = 1; +DELETE FROM fk WHERE a = 1; +COMMIT; -- OK +DROP SCHEMA fkpart9 CASCADE; + +-- Verify ON UPDATE/DELETE behavior +CREATE SCHEMA fkpart6; +SET search_path TO fkpart6; +CREATE TABLE pk (a int PRIMARY KEY) PARTITION BY RANGE (a); +CREATE TABLE pk1 PARTITION OF pk FOR VALUES FROM (1) TO (100) PARTITION BY RANGE (a); +CREATE TABLE pk11 PARTITION OF pk1 FOR VALUES FROM (1) TO (50); +CREATE TABLE pk12 PARTITION OF pk1 FOR VALUES FROM (50) TO (100); +CREATE TABLE fk (a int) PARTITION BY RANGE (a); +CREATE TABLE fk1 PARTITION OF fk FOR VALUES FROM (1) TO (100) PARTITION BY RANGE (a); +CREATE TABLE fk11 PARTITION OF fk1 FOR VALUES FROM (1) TO (10); +CREATE TABLE fk12 PARTITION OF fk1 FOR VALUES FROM (10) TO (100); +ALTER TABLE fk ADD FOREIGN KEY (a) REFERENCES pk ON UPDATE CASCADE ON DELETE CASCADE; +CREATE TABLE fk_d PARTITION OF fk DEFAULT; +INSERT INTO pk VALUES (1); +INSERT INTO fk VALUES (1); +UPDATE pk SET a = 20; +SELECT tableoid::regclass, * FROM fk; +DELETE FROM pk WHERE a = 20; +SELECT tableoid::regclass, * FROM fk; +DROP TABLE fk; + +TRUNCATE TABLE pk; +INSERT INTO pk VALUES (20), (50); +CREATE TABLE fk (a int) PARTITION BY RANGE (a); +CREATE TABLE fk1 PARTITION OF fk FOR VALUES FROM (1) TO (100) PARTITION BY RANGE (a); +CREATE TABLE fk11 PARTITION OF fk1 FOR VALUES FROM (1) TO (10); +CREATE TABLE fk12 PARTITION OF fk1 FOR VALUES FROM (10) TO (100); +ALTER TABLE fk ADD FOREIGN KEY (a) REFERENCES pk ON UPDATE SET NULL ON DELETE SET NULL; +CREATE TABLE fk_d PARTITION OF fk DEFAULT; +INSERT INTO fk VALUES (20), (50); +UPDATE pk SET a = 21 WHERE a = 20; +DELETE FROM pk WHERE a = 50; +SELECT tableoid::regclass, * FROM fk; +DROP TABLE fk; + +TRUNCATE TABLE pk; +INSERT INTO pk VALUES (20), (30), (50); +CREATE TABLE fk (id int, a int DEFAULT 50) PARTITION BY RANGE (a); +CREATE TABLE fk1 PARTITION OF fk FOR VALUES FROM (1) TO (100) PARTITION BY RANGE (a); +CREATE TABLE fk11 PARTITION OF fk1 FOR VALUES FROM (1) TO (10); +CREATE TABLE fk12 PARTITION OF fk1 FOR VALUES FROM (10) TO (100); +ALTER TABLE fk ADD FOREIGN KEY (a) REFERENCES pk ON UPDATE SET DEFAULT ON DELETE SET DEFAULT; +CREATE TABLE fk_d PARTITION OF fk DEFAULT; +INSERT INTO fk VALUES (1, 20), (2, 30); +DELETE FROM pk WHERE a = 20 RETURNING *; +UPDATE pk SET a = 90 WHERE a = 30 RETURNING *; +SELECT tableoid::regclass, * FROM fk; +DROP TABLE fk; + +TRUNCATE TABLE pk; +INSERT INTO pk VALUES (20), (30); +CREATE TABLE fk (a int DEFAULT 50) PARTITION BY RANGE (a); +CREATE TABLE fk1 PARTITION OF fk FOR VALUES FROM (1) TO (100) PARTITION BY RANGE (a); +CREATE TABLE fk11 PARTITION OF fk1 FOR VALUES FROM (1) TO (10); +CREATE TABLE fk12 PARTITION OF fk1 FOR VALUES FROM (10) TO (100); +ALTER TABLE fk ADD FOREIGN KEY (a) REFERENCES pk ON UPDATE RESTRICT ON DELETE RESTRICT; +CREATE TABLE fk_d PARTITION OF fk DEFAULT; +INSERT INTO fk VALUES (20), (30); +DELETE FROM pk WHERE a = 20; +UPDATE pk SET a = 90 WHERE a = 30; +SELECT tableoid::regclass, * FROM fk; +DROP TABLE fk; + +-- test for reported bug: relispartition not set +-- https://postgr.es/m/CA+HiwqHMsRtRYRWYTWavKJ8x14AFsv7bmAV46mYwnfD3vy8goQ@mail.gmail.com +CREATE SCHEMA fkpart7 + CREATE TABLE pkpart (a int) PARTITION BY LIST (a) + CREATE TABLE pkpart1 PARTITION OF pkpart FOR VALUES IN (1); +ALTER TABLE fkpart7.pkpart1 ADD PRIMARY KEY (a); +ALTER TABLE fkpart7.pkpart ADD PRIMARY KEY (a); +CREATE TABLE fkpart7.fk (a int REFERENCES fkpart7.pkpart); +DROP SCHEMA fkpart7 CASCADE; + +-- ensure we check partitions are "not used" when dropping constraints +CREATE SCHEMA fkpart8 + CREATE TABLE tbl1(f1 int PRIMARY KEY) + CREATE TABLE tbl2(f1 int REFERENCES tbl1 DEFERRABLE INITIALLY DEFERRED) PARTITION BY RANGE(f1) + CREATE TABLE tbl2_p1 PARTITION OF tbl2 FOR VALUES FROM (minvalue) TO (maxvalue); +INSERT INTO fkpart8.tbl1 VALUES(1); +BEGIN; +INSERT INTO fkpart8.tbl2 VALUES(1); +ALTER TABLE fkpart8.tbl2 DROP CONSTRAINT tbl2_f1_fkey; +COMMIT; +DROP SCHEMA fkpart8 CASCADE; + +-- ensure FK referencing a multi-level partitioned table are +-- enforce reference to sub-children. +CREATE SCHEMA fkpart9 + CREATE TABLE pk (a INT PRIMARY KEY) PARTITION BY RANGE (a) + CREATE TABLE fk ( + fk_a INT REFERENCES pk(a) ON DELETE CASCADE + ) + CREATE TABLE pk1 PARTITION OF pk FOR VALUES FROM (30) TO (50) PARTITION BY RANGE (a) + CREATE TABLE pk11 PARTITION OF pk1 FOR VALUES FROM (30) TO (40); +INSERT INTO fkpart9.pk VALUES (35); +INSERT INTO fkpart9.fk VALUES (35); +DELETE FROM fkpart9.pk WHERE a=35; +SELECT * FROM fkpart9.pk; +SELECT * FROM fkpart9.fk; +DROP SCHEMA fkpart9 CASCADE; +UPDATE PKTABLE set ptest1=0, ptest2=-1, ptest3=-2 where ptest2=2; diff --git a/postgresql/examples/functional_deps.sql b/postgresql/examples/functional_deps.sql new file mode 100644 index 0000000..406490b --- /dev/null +++ b/postgresql/examples/functional_deps.sql @@ -0,0 +1,210 @@ +-- from http://www.depesz.com/index.php/2010/04/19/getting-unique-elements/ + +CREATE TEMP TABLE articles ( + id int CONSTRAINT articles_pkey PRIMARY KEY, + keywords text, + title text UNIQUE NOT NULL, + body text UNIQUE, + created date +); + +CREATE TEMP TABLE articles_in_category ( + article_id int, + category_id int, + changed date, + PRIMARY KEY (article_id, category_id) +); + +-- test functional dependencies based on primary keys/unique constraints + +-- base tables + +-- group by primary key (OK) +SELECT id, keywords, title, body, created +FROM articles +GROUP BY id; + +-- group by unique not null (fail/todo) +SELECT id, keywords, title, body, created +FROM articles +GROUP BY title; + +-- group by unique nullable (fail) +SELECT id, keywords, title, body, created +FROM articles +GROUP BY body; + +-- group by something else (fail) +SELECT id, keywords, title, body, created +FROM articles +GROUP BY keywords; + +-- multiple tables + +-- group by primary key (OK) +SELECT a.id, a.keywords, a.title, a.body, a.created +FROM articles AS a, articles_in_category AS aic +WHERE a.id = aic.article_id AND aic.category_id in (14,62,70,53,138) +GROUP BY a.id; + +-- group by something else (fail) +SELECT a.id, a.keywords, a.title, a.body, a.created +FROM articles AS a, articles_in_category AS aic +WHERE a.id = aic.article_id AND aic.category_id in (14,62,70,53,138) +GROUP BY aic.article_id, aic.category_id; + +-- JOIN syntax + +-- group by left table's primary key (OK) +SELECT a.id, a.keywords, a.title, a.body, a.created +FROM articles AS a JOIN articles_in_category AS aic ON a.id = aic.article_id +WHERE aic.category_id in (14,62,70,53,138) +GROUP BY a.id; + +-- group by something else (fail) +SELECT a.id, a.keywords, a.title, a.body, a.created +FROM articles AS a JOIN articles_in_category AS aic ON a.id = aic.article_id +WHERE aic.category_id in (14,62,70,53,138) +GROUP BY aic.article_id, aic.category_id; + +-- group by right table's (composite) primary key (OK) +SELECT aic.changed +FROM articles AS a JOIN articles_in_category AS aic ON a.id = aic.article_id +WHERE aic.category_id in (14,62,70,53,138) +GROUP BY aic.category_id, aic.article_id; + +-- group by right table's partial primary key (fail) +SELECT aic.changed +FROM articles AS a JOIN articles_in_category AS aic ON a.id = aic.article_id +WHERE aic.category_id in (14,62,70,53,138) +GROUP BY aic.article_id; + + +-- example from documentation + +CREATE TEMP TABLE products (product_id int, name text, price numeric); +CREATE TEMP TABLE sales (product_id int, units int); + +-- OK +SELECT product_id, p.name, (sum(s.units) * p.price) AS sales + FROM products p LEFT JOIN sales s USING (product_id) + GROUP BY product_id, p.name, p.price; + +-- fail +SELECT product_id, p.name, (sum(s.units) * p.price) AS sales + FROM products p LEFT JOIN sales s USING (product_id) + GROUP BY product_id; + +ALTER TABLE products ADD PRIMARY KEY (product_id); + +-- OK now +SELECT product_id, p.name, (sum(s.units) * p.price) AS sales + FROM products p LEFT JOIN sales s USING (product_id) + GROUP BY product_id; + + +-- Drupal example, http://drupal.org/node/555530 + +CREATE TEMP TABLE node ( + nid SERIAL, + vid integer NOT NULL default '0', + type varchar(32) NOT NULL default '', + title varchar(128) NOT NULL default '', + uid integer NOT NULL default '0', + status integer NOT NULL default '1', + created integer NOT NULL default '0', + -- snip + PRIMARY KEY (nid, vid) +); + +CREATE TEMP TABLE users ( + uid integer NOT NULL default '0', + name varchar(60) NOT NULL default '', + pass varchar(32) NOT NULL default '', + -- snip + PRIMARY KEY (uid), + UNIQUE (name) +); + +-- OK +SELECT u.uid, u.name FROM node n +INNER JOIN users u ON u.uid = n.uid +WHERE n.type = 'blog' AND n.status = 1 +GROUP BY u.uid, u.name; + +-- OK +SELECT u.uid, u.name FROM node n +INNER JOIN users u ON u.uid = n.uid +WHERE n.type = 'blog' AND n.status = 1 +GROUP BY u.uid; + + +-- Check views and dependencies + +-- fail +CREATE TEMP VIEW fdv1 AS +SELECT id, keywords, title, body, created +FROM articles +GROUP BY body; + +-- OK +CREATE TEMP VIEW fdv1 AS +SELECT id, keywords, title, body, created +FROM articles +GROUP BY id; + +-- fail +ALTER TABLE articles DROP CONSTRAINT articles_pkey RESTRICT; + +DROP VIEW fdv1; + + +-- multiple dependencies +CREATE TEMP VIEW fdv2 AS +SELECT a.id, a.keywords, a.title, aic.category_id, aic.changed +FROM articles AS a JOIN articles_in_category AS aic ON a.id = aic.article_id +WHERE aic.category_id in (14,62,70,53,138) +GROUP BY a.id, aic.category_id, aic.article_id; + +ALTER TABLE articles DROP CONSTRAINT articles_pkey RESTRICT; -- fail +ALTER TABLE articles_in_category DROP CONSTRAINT articles_in_category_pkey RESTRICT; --fail + +DROP VIEW fdv2; + + +-- nested queries + +CREATE TEMP VIEW fdv3 AS +SELECT id, keywords, title, body, created +FROM articles +GROUP BY id +UNION +SELECT id, keywords, title, body, created +FROM articles +GROUP BY id; + +ALTER TABLE articles DROP CONSTRAINT articles_pkey RESTRICT; -- fail + +DROP VIEW fdv3; + + +CREATE TEMP VIEW fdv4 AS +SELECT * FROM articles WHERE title IN (SELECT title FROM articles GROUP BY id); + +ALTER TABLE articles DROP CONSTRAINT articles_pkey RESTRICT; -- fail + +DROP VIEW fdv4; + + +-- prepared query plans: this results in failure on reuse + +PREPARE foo AS + SELECT id, keywords, title, body, created + FROM articles + GROUP BY id; + +EXECUTE foo; + +ALTER TABLE articles DROP CONSTRAINT articles_pkey RESTRICT; + +EXECUTE foo; -- fail diff --git a/postgresql/examples/generated.sql b/postgresql/examples/generated.sql new file mode 100644 index 0000000..f5ea5e8 --- /dev/null +++ b/postgresql/examples/generated.sql @@ -0,0 +1,540 @@ +-- sanity check of system catalog +SELECT attrelid, attname, attgenerated FROM pg_attribute WHERE attgenerated NOT IN ('', 's'); + + +CREATE TABLE gtest0 (a int PRIMARY KEY, b int GENERATED ALWAYS AS (55) STORED); +CREATE TABLE gtest1 (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED); + +SELECT table_name, column_name, column_default, is_nullable, is_generated, generation_expression FROM information_schema.columns WHERE table_name LIKE 'gtest_' ORDER BY 1, 2; + +SELECT table_name, column_name, dependent_column FROM information_schema.column_column_usage ORDER BY 1, 2, 3; + +\d gtest1 + +-- duplicate generated +CREATE TABLE gtest_err_1 (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED GENERATED ALWAYS AS (a * 3) STORED); + +-- references to other generated columns, including self-references +CREATE TABLE gtest_err_2a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (b * 2) STORED); +CREATE TABLE gtest_err_2b (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED, c int GENERATED ALWAYS AS (b * 3) STORED); + +-- invalid reference +CREATE TABLE gtest_err_3 (a int PRIMARY KEY, b int GENERATED ALWAYS AS (c * 2) STORED); + +-- generation expression must be immutable +CREATE TABLE gtest_err_4 (a int PRIMARY KEY, b double precision GENERATED ALWAYS AS (random()) STORED); + +-- cannot have default/identity and generated +CREATE TABLE gtest_err_5a (a int PRIMARY KEY, b int DEFAULT 5 GENERATED ALWAYS AS (a * 2) STORED); +CREATE TABLE gtest_err_5b (a int PRIMARY KEY, b int GENERATED ALWAYS AS identity GENERATED ALWAYS AS (a * 2) STORED); + +-- reference to system column not allowed in generated column +CREATE TABLE gtest_err_6a (a int PRIMARY KEY, b bool GENERATED ALWAYS AS (xmin <> 37) STORED); + +-- various prohibited constructs +CREATE TABLE gtest_err_7a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (avg(a)) STORED); +CREATE TABLE gtest_err_7b (a int PRIMARY KEY, b int GENERATED ALWAYS AS (row_number() OVER (ORDER BY a)) STORED); +CREATE TABLE gtest_err_7c (a int PRIMARY KEY, b int GENERATED ALWAYS AS ((SELECT a)) STORED); +CREATE TABLE gtest_err_7d (a int PRIMARY KEY, b int GENERATED ALWAYS AS (generate_series(1, a)) STORED); + +-- GENERATED BY DEFAULT not allowed +CREATE TABLE gtest_err_8 (a int PRIMARY KEY, b int GENERATED BY DEFAULT AS (a * 2) STORED); + +INSERT INTO gtest1 VALUES (1); +INSERT INTO gtest1 VALUES (2, DEFAULT); +INSERT INTO gtest1 VALUES (3, 33); -- error + +SELECT * FROM gtest1 ORDER BY a; + +UPDATE gtest1 SET b = DEFAULT WHERE a = 1; +UPDATE gtest1 SET b = 11 WHERE a = 1; -- error + +SELECT * FROM gtest1 ORDER BY a; + +SELECT a, b, b * 2 AS b2 FROM gtest1 ORDER BY a; +SELECT a, b FROM gtest1 WHERE b = 4 ORDER BY a; + +-- test that overflow error happens on write +INSERT INTO gtest1 VALUES (2000000000); +SELECT * FROM gtest1; +DELETE FROM gtest1 WHERE a = 2000000000; + +-- test with joins +CREATE TABLE gtestx (x int, y int); +INSERT INTO gtestx VALUES (11, 1), (22, 2), (33, 3); +SELECT * FROM gtestx, gtest1 WHERE gtestx.y = gtest1.a; +DROP TABLE gtestx; + +-- test UPDATE/DELETE quals +SELECT * FROM gtest1 ORDER BY a; +UPDATE gtest1 SET a = 3 WHERE b = 4; +SELECT * FROM gtest1 ORDER BY a; +DELETE FROM gtest1 WHERE b = 2; +SELECT * FROM gtest1 ORDER BY a; + +-- views +CREATE VIEW gtest1v AS SELECT * FROM gtest1; +SELECT * FROM gtest1v; +INSERT INTO gtest1v VALUES (4, 8); -- fails +DROP VIEW gtest1v; + +-- CTEs +WITH foo AS (SELECT * FROM gtest1) SELECT * FROM foo; + +-- inheritance +CREATE TABLE gtest1_1 () INHERITS (gtest1); +SELECT * FROM gtest1_1; +\d gtest1_1 +INSERT INTO gtest1_1 VALUES (4); +SELECT * FROM gtest1_1; +SELECT * FROM gtest1; + +CREATE TABLE gtest_normal (a int, b int); +CREATE TABLE gtest_normal_child (a int, b int GENERATED ALWAYS AS (a * 2) STORED) INHERITS (gtest_normal); +\d gtest_normal_child +INSERT INTO gtest_normal (a) VALUES (1); +INSERT INTO gtest_normal_child (a) VALUES (2); +SELECT * FROM gtest_normal; + +-- test inheritance mismatches between parent and child +CREATE TABLE gtestx (x int, b int GENERATED ALWAYS AS (a * 22) STORED) INHERITS (gtest1); -- error +CREATE TABLE gtestx (x int, b int DEFAULT 10) INHERITS (gtest1); -- error +CREATE TABLE gtestx (x int, b int GENERATED ALWAYS AS IDENTITY) INHERITS (gtest1); -- error + +-- test multiple inheritance mismatches +CREATE TABLE gtesty (x int, b int); +CREATE TABLE gtest1_2 () INHERITS (gtest1, gtesty); -- error +DROP TABLE gtesty; + +CREATE TABLE gtesty (x int, b int GENERATED ALWAYS AS (x * 22) STORED); +CREATE TABLE gtest1_2 () INHERITS (gtest1, gtesty); -- error +DROP TABLE gtesty; + +CREATE TABLE gtesty (x int, b int DEFAULT 55); +CREATE TABLE gtest1_2 () INHERITS (gtest0, gtesty); -- error +DROP TABLE gtesty; + +-- test stored update +CREATE TABLE gtest3 (a int, b int GENERATED ALWAYS AS (a * 3) STORED); +INSERT INTO gtest3 (a) VALUES (1), (2), (3), (NULL); +SELECT * FROM gtest3 ORDER BY a; +UPDATE gtest3 SET a = 22 WHERE a = 2; +SELECT * FROM gtest3 ORDER BY a; + +CREATE TABLE gtest3a (a text, b text GENERATED ALWAYS AS (a || '+' || a) STORED); +INSERT INTO gtest3a (a) VALUES ('a'), ('b'), ('c'), (NULL); +SELECT * FROM gtest3a ORDER BY a; +UPDATE gtest3a SET a = 'bb' WHERE a = 'b'; +SELECT * FROM gtest3a ORDER BY a; + +-- COPY +TRUNCATE gtest1; +INSERT INTO gtest1 (a) VALUES (1), (2); + +COPY gtest1 TO stdout; + +COPY gtest1 (a, b) TO stdout; + +COPY gtest1 FROM stdin; +\. + +COPY gtest1 (a, b) FROM stdin; + +SELECT * FROM gtest1 ORDER BY a; + +TRUNCATE gtest3; +INSERT INTO gtest3 (a) VALUES (1), (2); + +COPY gtest3 TO stdout; + +COPY gtest3 (a, b) TO stdout; + +COPY gtest3 FROM stdin; +\. + +COPY gtest3 (a, b) FROM stdin; + +SELECT * FROM gtest3 ORDER BY a; + +-- null values +CREATE TABLE gtest2 (a int PRIMARY KEY, b int GENERATED ALWAYS AS (NULL) STORED); +INSERT INTO gtest2 VALUES (1); +SELECT * FROM gtest2; + +-- simple column reference for varlena types +CREATE TABLE gtest_varlena (a varchar, b varchar GENERATED ALWAYS AS (a) STORED); +INSERT INTO gtest_varlena (a) VALUES('01234567890123456789'); +INSERT INTO gtest_varlena (a) VALUES(NULL); +SELECT * FROM gtest_varlena ORDER BY a; +DROP TABLE gtest_varlena; + +-- composite types +CREATE TYPE double_int as (a int, b int); +CREATE TABLE gtest4 ( + a int, + b double_int GENERATED ALWAYS AS ((a * 2, a * 3)) STORED +); +INSERT INTO gtest4 VALUES (1), (6); +SELECT * FROM gtest4; + +DROP TABLE gtest4; +DROP TYPE double_int; + +-- using tableoid is allowed +CREATE TABLE gtest_tableoid ( + a int PRIMARY KEY, + b bool GENERATED ALWAYS AS (tableoid <> 0) STORED +); +INSERT INTO gtest_tableoid VALUES (1), (2); +SELECT * FROM gtest_tableoid; + +-- drop column behavior +CREATE TABLE gtest10 (a int PRIMARY KEY, b int, c int GENERATED ALWAYS AS (b * 2) STORED); +ALTER TABLE gtest10 DROP COLUMN b; + +\d gtest10 + +CREATE TABLE gtest10a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED); +ALTER TABLE gtest10a DROP COLUMN b; +INSERT INTO gtest10a (a) VALUES (1); + +-- privileges +CREATE USER regress_user11; + +CREATE TABLE gtest11s (a int PRIMARY KEY, b int, c int GENERATED ALWAYS AS (b * 2) STORED); +INSERT INTO gtest11s VALUES (1, 10), (2, 20); +GRANT SELECT (a, c) ON gtest11s TO regress_user11; + +CREATE FUNCTION gf1(a int) RETURNS int AS $$ SELECT a * 3 $$ IMMUTABLE LANGUAGE SQL; +REVOKE ALL ON FUNCTION gf1(int) FROM PUBLIC; + +CREATE TABLE gtest12s (a int PRIMARY KEY, b int, c int GENERATED ALWAYS AS (gf1(b)) STORED); +INSERT INTO gtest12s VALUES (1, 10), (2, 20); +GRANT SELECT (a, c) ON gtest12s TO regress_user11; + +SET ROLE regress_user11; +SELECT a, b FROM gtest11s; -- not allowed +SELECT a, c FROM gtest11s; -- allowed +SELECT gf1(10); -- not allowed +SELECT a, c FROM gtest12s; -- allowed +RESET ROLE; + +DROP TABLE gtest11s, gtest12s; +DROP FUNCTION gf1(int); +DROP USER regress_user11; + +-- check constraints +CREATE TABLE gtest20 (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED CHECK (b < 50)); +INSERT INTO gtest20 (a) VALUES (10); -- ok +INSERT INTO gtest20 (a) VALUES (30); -- violates constraint + +CREATE TABLE gtest20a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED); +INSERT INTO gtest20a (a) VALUES (10); +INSERT INTO gtest20a (a) VALUES (30); +ALTER TABLE gtest20a ADD CHECK (b < 50); -- fails on existing row + +CREATE TABLE gtest20b (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED); +INSERT INTO gtest20b (a) VALUES (10); +INSERT INTO gtest20b (a) VALUES (30); +ALTER TABLE gtest20b ADD CONSTRAINT chk CHECK (b < 50) NOT VALID; +ALTER TABLE gtest20b VALIDATE CONSTRAINT chk; -- fails on existing row + +-- not-null constraints +CREATE TABLE gtest21a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (nullif(a, 0)) STORED NOT NULL); +INSERT INTO gtest21a (a) VALUES (1); -- ok +INSERT INTO gtest21a (a) VALUES (0); -- violates constraint + +CREATE TABLE gtest21b (a int PRIMARY KEY, b int GENERATED ALWAYS AS (nullif(a, 0)) STORED); +ALTER TABLE gtest21b ALTER COLUMN b SET NOT NULL; +INSERT INTO gtest21b (a) VALUES (1); -- ok +INSERT INTO gtest21b (a) VALUES (0); -- violates constraint +ALTER TABLE gtest21b ALTER COLUMN b DROP NOT NULL; +INSERT INTO gtest21b (a) VALUES (0); -- ok now + +-- index constraints +CREATE TABLE gtest22a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a / 2) STORED UNIQUE); +INSERT INTO gtest22a VALUES (2); +INSERT INTO gtest22a VALUES (3); +INSERT INTO gtest22a VALUES (4); +CREATE TABLE gtest22b (a int, b int GENERATED ALWAYS AS (a / 2) STORED, PRIMARY KEY (a, b)); +INSERT INTO gtest22b VALUES (2); +INSERT INTO gtest22b VALUES (2); + +-- indexes +CREATE TABLE gtest22c (a int, b int GENERATED ALWAYS AS (a * 2) STORED); +CREATE INDEX gtest22c_b_idx ON gtest22c (b); +CREATE INDEX gtest22c_expr_idx ON gtest22c ((b * 3)); +CREATE INDEX gtest22c_pred_idx ON gtest22c (a) WHERE b > 0; +\d gtest22c + +INSERT INTO gtest22c VALUES (1), (2), (3); +SET enable_seqscan TO off; +SET enable_bitmapscan TO off; +EXPLAIN (COSTS OFF) SELECT * FROM gtest22c WHERE b = 4; +SELECT * FROM gtest22c WHERE b = 4; +EXPLAIN (COSTS OFF) SELECT * FROM gtest22c WHERE b * 3 = 6; +SELECT * FROM gtest22c WHERE b * 3 = 6; +EXPLAIN (COSTS OFF) SELECT * FROM gtest22c WHERE a = 1 AND b > 0; +SELECT * FROM gtest22c WHERE a = 1 AND b > 0; +RESET enable_seqscan; +RESET enable_bitmapscan; + +-- foreign keys +CREATE TABLE gtest23a (x int PRIMARY KEY, y int); +INSERT INTO gtest23a VALUES (1, 11), (2, 22), (3, 33); + +CREATE TABLE gtest23x (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED REFERENCES gtest23a (x) ON UPDATE CASCADE); -- error +CREATE TABLE gtest23x (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED REFERENCES gtest23a (x) ON DELETE SET NULL); -- error + +CREATE TABLE gtest23b (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) STORED REFERENCES gtest23a (x)); +\d gtest23b + +INSERT INTO gtest23b VALUES (1); -- ok +INSERT INTO gtest23b VALUES (5); -- error + +DROP TABLE gtest23b; +DROP TABLE gtest23a; + +CREATE TABLE gtest23p (x int, y int GENERATED ALWAYS AS (x * 2) STORED, PRIMARY KEY (y)); +INSERT INTO gtest23p VALUES (1), (2), (3); + +CREATE TABLE gtest23q (a int PRIMARY KEY, b int REFERENCES gtest23p (y)); +INSERT INTO gtest23q VALUES (1, 2); -- ok +INSERT INTO gtest23q VALUES (2, 5); -- error + +-- domains +CREATE DOMAIN gtestdomain1 AS int CHECK (VALUE < 10); +CREATE TABLE gtest24 (a int PRIMARY KEY, b gtestdomain1 GENERATED ALWAYS AS (a * 2) STORED); +INSERT INTO gtest24 (a) VALUES (4); -- ok +INSERT INTO gtest24 (a) VALUES (6); -- error + +-- typed tables (currently not supported) +CREATE TYPE gtest_type AS (f1 integer, f2 text, f3 bigint); +CREATE TABLE gtest28 OF gtest_type (f1 WITH OPTIONS GENERATED ALWAYS AS (f2 *2) STORED); +DROP TYPE gtest_type CASCADE; + +-- table partitions (currently not supported) +CREATE TABLE gtest_parent (f1 date NOT NULL, f2 text, f3 bigint) PARTITION BY RANGE (f1); +CREATE TABLE gtest_child PARTITION OF gtest_parent ( + f3 WITH OPTIONS GENERATED ALWAYS AS (f2 * 2) STORED +) FOR VALUES FROM ('2016-07-01') TO ('2016-08-01'); -- error +DROP TABLE gtest_parent; + +-- partitioned table +CREATE TABLE gtest_parent (f1 date NOT NULL, f2 bigint, f3 bigint GENERATED ALWAYS AS (f2 * 2) STORED) PARTITION BY RANGE (f1); +CREATE TABLE gtest_child PARTITION OF gtest_parent FOR VALUES FROM ('2016-07-01') TO ('2016-08-01'); +INSERT INTO gtest_parent (f1, f2) VALUES ('2016-07-15', 1); +SELECT * FROM gtest_parent; +SELECT * FROM gtest_child; +DROP TABLE gtest_parent; + +-- generated columns in partition key (not allowed) +CREATE TABLE gtest_parent (f1 date NOT NULL, f2 bigint, f3 bigint GENERATED ALWAYS AS (f2 * 2) STORED) PARTITION BY RANGE (f3); +CREATE TABLE gtest_parent (f1 date NOT NULL, f2 bigint, f3 bigint GENERATED ALWAYS AS (f2 * 2) STORED) PARTITION BY RANGE ((f3 * 3)); + +-- ALTER TABLE ... ADD COLUMN +CREATE TABLE gtest25 (a int PRIMARY KEY); +INSERT INTO gtest25 VALUES (3), (4); +ALTER TABLE gtest25 ADD COLUMN b int GENERATED ALWAYS AS (a * 3) STORED; +SELECT * FROM gtest25 ORDER BY a; +ALTER TABLE gtest25 ADD COLUMN x int GENERATED ALWAYS AS (b * 4) STORED; -- error +ALTER TABLE gtest25 ADD COLUMN x int GENERATED ALWAYS AS (z * 4) STORED; -- error +ALTER TABLE gtest25 ADD COLUMN c int DEFAULT 42, + ADD COLUMN x int GENERATED ALWAYS AS (c * 4) STORED; +ALTER TABLE gtest25 ADD COLUMN d int DEFAULT 101; +ALTER TABLE gtest25 ALTER COLUMN d SET DATA TYPE float8, + ADD COLUMN y float8 GENERATED ALWAYS AS (d * 4) STORED; +SELECT * FROM gtest25 ORDER BY a; +\d gtest25 + +-- ALTER TABLE ... ALTER COLUMN +CREATE TABLE gtest27 ( + a int, + b int, + x int GENERATED ALWAYS AS ((a + b) * 2) STORED +); +INSERT INTO gtest27 (a, b) VALUES (3, 7), (4, 11); +ALTER TABLE gtest27 ALTER COLUMN a TYPE text; -- error +ALTER TABLE gtest27 ALTER COLUMN x TYPE numeric; +\d gtest27 +SELECT * FROM gtest27; +ALTER TABLE gtest27 ALTER COLUMN x TYPE boolean USING x <> 0; -- error +ALTER TABLE gtest27 ALTER COLUMN x DROP DEFAULT; -- error +-- It's possible to alter the column types this way: +ALTER TABLE gtest27 + DROP COLUMN x, + ALTER COLUMN a TYPE bigint, + ALTER COLUMN b TYPE bigint, + ADD COLUMN x bigint GENERATED ALWAYS AS ((a + b) * 2) STORED; +\d gtest27 +-- Ideally you could just do this, but not today (and should x change type?): +ALTER TABLE gtest27 + ALTER COLUMN a TYPE float8, + ALTER COLUMN b TYPE float8; -- error +\d gtest27 +SELECT * FROM gtest27; + +-- ALTER TABLE ... ALTER COLUMN ... DROP EXPRESSION +CREATE TABLE gtest29 ( + a int, + b int GENERATED ALWAYS AS (a * 2) STORED +); +INSERT INTO gtest29 (a) VALUES (3), (4); +ALTER TABLE gtest29 ALTER COLUMN a DROP EXPRESSION; -- error +ALTER TABLE gtest29 ALTER COLUMN a DROP EXPRESSION IF EXISTS; -- notice +ALTER TABLE gtest29 ALTER COLUMN b DROP EXPRESSION; +INSERT INTO gtest29 (a) VALUES (5); +INSERT INTO gtest29 (a, b) VALUES (6, 66); +SELECT * FROM gtest29; +\d gtest29 + +-- check that dependencies between columns have also been removed +ALTER TABLE gtest29 DROP COLUMN a; -- should not drop b +\d gtest29 + +-- with inheritance +CREATE TABLE gtest30 ( + a int, + b int GENERATED ALWAYS AS (a * 2) STORED +); +CREATE TABLE gtest30_1 () INHERITS (gtest30); +ALTER TABLE gtest30 ALTER COLUMN b DROP EXPRESSION; +\d gtest30 +\d gtest30_1 +DROP TABLE gtest30 CASCADE; +CREATE TABLE gtest30 ( + a int, + b int GENERATED ALWAYS AS (a * 2) STORED +); +CREATE TABLE gtest30_1 () INHERITS (gtest30); +ALTER TABLE ONLY gtest30 ALTER COLUMN b DROP EXPRESSION; +\d gtest30 +\d gtest30_1 +ALTER TABLE gtest30_1 ALTER COLUMN b DROP EXPRESSION; -- error + +-- triggers +CREATE TABLE gtest26 ( + a int PRIMARY KEY, + b int GENERATED ALWAYS AS (a * 2) STORED +); + +CREATE FUNCTION gtest_trigger_func() RETURNS trigger + LANGUAGE plpgsql +AS $$ +BEGIN + IF tg_op IN ('DELETE', 'UPDATE') THEN + RAISE INFO '%: %: old = %', TG_NAME, TG_WHEN, OLD; + END IF; + IF tg_op IN ('INSERT', 'UPDATE') THEN + RAISE INFO '%: %: new = %', TG_NAME, TG_WHEN, NEW; + END IF; + IF tg_op = 'DELETE' THEN + RETURN OLD; + ELSE + RETURN NEW; + END IF; +END +$$; + +CREATE TRIGGER gtest1 BEFORE DELETE OR UPDATE ON gtest26 + FOR EACH ROW + WHEN (OLD.b < 0) -- ok + EXECUTE PROCEDURE gtest_trigger_func(); + +CREATE TRIGGER gtest2a BEFORE INSERT OR UPDATE ON gtest26 + FOR EACH ROW + WHEN (NEW.b < 0) -- error + EXECUTE PROCEDURE gtest_trigger_func(); + +CREATE TRIGGER gtest2b BEFORE INSERT OR UPDATE ON gtest26 + FOR EACH ROW + WHEN (NEW.* IS NOT NULL) -- error + EXECUTE PROCEDURE gtest_trigger_func(); + +CREATE TRIGGER gtest2 BEFORE INSERT ON gtest26 + FOR EACH ROW + WHEN (NEW.a < 0) + EXECUTE PROCEDURE gtest_trigger_func(); + +CREATE TRIGGER gtest3 AFTER DELETE OR UPDATE ON gtest26 + FOR EACH ROW + WHEN (OLD.b < 0) -- ok + EXECUTE PROCEDURE gtest_trigger_func(); + +CREATE TRIGGER gtest4 AFTER INSERT OR UPDATE ON gtest26 + FOR EACH ROW + WHEN (NEW.b < 0) -- ok + EXECUTE PROCEDURE gtest_trigger_func(); + +INSERT INTO gtest26 (a) VALUES (-2), (0), (3); +SELECT * FROM gtest26 ORDER BY a; +UPDATE gtest26 SET a = a * -2; +SELECT * FROM gtest26 ORDER BY a; +DELETE FROM gtest26 WHERE a = -6; +SELECT * FROM gtest26 ORDER BY a; + +DROP TRIGGER gtest1 ON gtest26; +DROP TRIGGER gtest2 ON gtest26; +DROP TRIGGER gtest3 ON gtest26; + +-- Check that an UPDATE of "a" fires the trigger for UPDATE OF b, per +-- SQL standard. +CREATE FUNCTION gtest_trigger_func3() RETURNS trigger + LANGUAGE plpgsql +AS $$ +BEGIN + RAISE NOTICE 'OK'; + RETURN NEW; +END +$$; + +CREATE TRIGGER gtest11 BEFORE UPDATE OF b ON gtest26 + FOR EACH ROW + EXECUTE PROCEDURE gtest_trigger_func3(); + +UPDATE gtest26 SET a = 1 WHERE a = 0; + +DROP TRIGGER gtest11 ON gtest26; +TRUNCATE gtest26; + +-- check that modifications of stored generated columns in triggers do +-- not get propagated +CREATE FUNCTION gtest_trigger_func4() RETURNS trigger + LANGUAGE plpgsql +AS $$ +BEGIN + NEW.a = 10; + NEW.b = 300; + RETURN NEW; +END; +$$; + +CREATE TRIGGER gtest12_01 BEFORE UPDATE ON gtest26 + FOR EACH ROW + EXECUTE PROCEDURE gtest_trigger_func(); + +CREATE TRIGGER gtest12_02 BEFORE UPDATE ON gtest26 + FOR EACH ROW + EXECUTE PROCEDURE gtest_trigger_func4(); + +CREATE TRIGGER gtest12_03 BEFORE UPDATE ON gtest26 + FOR EACH ROW + EXECUTE PROCEDURE gtest_trigger_func(); + +INSERT INTO gtest26 (a) VALUES (1); +UPDATE gtest26 SET a = 11 WHERE a = 1; +SELECT * FROM gtest26 ORDER BY a; + +-- LIKE INCLUDING GENERATED and dropped column handling +CREATE TABLE gtest28a ( + a int, + b int, + c int, + x int GENERATED ALWAYS AS (b * 2) STORED +); + +ALTER TABLE gtest28a DROP COLUMN a; + +CREATE TABLE gtest28b (LIKE gtest28a INCLUDING GENERATED); + +\d gtest28* diff --git a/postgresql/examples/geometry.sql b/postgresql/examples/geometry.sql new file mode 100644 index 0000000..ec88d30 --- /dev/null +++ b/postgresql/examples/geometry.sql @@ -0,0 +1,511 @@ +-- +-- GEOMETRY +-- + +-- Back off displayed precision a little bit to reduce platform-to-platform +-- variation in results. +SET extra_float_digits TO -3; + +-- +-- Points +-- + +SELECT '' AS four, center(f1) AS center + FROM BOX_TBL; + +SELECT '' AS four, (@@ f1) AS center + FROM BOX_TBL; + +SELECT '' AS six, point(f1) AS center + FROM CIRCLE_TBL; + +SELECT '' AS six, (@@ f1) AS center + FROM CIRCLE_TBL; + + +-- "is horizontal" function +SELECT '' AS two, p1.f1 + FROM POINT_TBL p1 + WHERE ishorizontal(p1.f1, point '(0,0)'); + +-- "is horizontal" operator +SELECT '' AS two, p1.f1 + FROM POINT_TBL p1 + WHERE p1.f1 ?- point '(0,0)'; + +-- "is vertical" function +SELECT '' AS one, p1.f1 + FROM POINT_TBL p1 + WHERE isvertical(p1.f1, point '(5.1,34.5)'); + +-- "is vertical" operator +SELECT '' AS one, p1.f1 + FROM POINT_TBL p1 + WHERE p1.f1 ?| point '(5.1,34.5)'; + +-- Slope +SELECT p1.f1, p2.f1, slope(p1.f1, p2.f1) FROM POINT_TBL p1, POINT_TBL p2; + +-- Add point +SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM POINT_TBL p1, POINT_TBL p2; + +-- Subtract point +SELECT p1.f1, p2.f1, p1.f1 - p2.f1 FROM POINT_TBL p1, POINT_TBL p2; + +-- Multiply with point +SELECT p1.f1, p2.f1, p1.f1 * p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1[0] BETWEEN 1 AND 1000; + +-- Underflow error +SELECT p1.f1, p2.f1, p1.f1 * p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1[0] < 1; + +-- Divide by point +SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1[0] BETWEEN 1 AND 1000; + +-- Overflow error +SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1[0] > 1000; + +-- Division by 0 error +SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1 ~= '(0,0)'::point; + +-- Distance to line +SELECT p.f1, l.s, p.f1 <-> l.s AS dist_pl, l.s <-> p.f1 AS dist_lp FROM POINT_TBL p, LINE_TBL l; + +-- Distance to line segment +SELECT p.f1, l.s, p.f1 <-> l.s AS dist_ps, l.s <-> p.f1 AS dist_sp FROM POINT_TBL p, LSEG_TBL l; + +-- Distance to box +SELECT p.f1, b.f1, p.f1 <-> b.f1 AS dist_pb, b.f1 <-> p.f1 AS dist_bp FROM POINT_TBL p, BOX_TBL b; + +-- Distance to path +SELECT p.f1, p1.f1, p.f1 <-> p1.f1 AS dist_ppath, p1.f1 <-> p.f1 AS dist_pathp FROM POINT_TBL p, PATH_TBL p1; + +-- Distance to polygon +SELECT p.f1, p1.f1, p.f1 <-> p1.f1 AS dist_ppoly, p1.f1 <-> p.f1 AS dist_polyp FROM POINT_TBL p, POLYGON_TBL p1; + +-- Closest point to line +SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LINE_TBL l; + +-- Closest point to line segment +SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LSEG_TBL l; + +-- Closest point to box +SELECT p.f1, b.f1, p.f1 ## b.f1 FROM POINT_TBL p, BOX_TBL b; + +-- On line +SELECT p.f1, l.s FROM POINT_TBL p, LINE_TBL l WHERE p.f1 <@ l.s; + +-- On line segment +SELECT p.f1, l.s FROM POINT_TBL p, LSEG_TBL l WHERE p.f1 <@ l.s; + +-- On path +SELECT p.f1, p1.f1 FROM POINT_TBL p, PATH_TBL p1 WHERE p.f1 <@ p1.f1; + +-- +-- Lines +-- + +-- Vertical +SELECT s FROM LINE_TBL WHERE ?| s; + +-- Horizontal +SELECT s FROM LINE_TBL WHERE ?- s; + +-- Same as line +SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s = l2.s; + +-- Parallel to line +SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?|| l2.s; + +-- Perpendicular to line +SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?-| l2.s; + +-- Distance to line +SELECT l1.s, l2.s, l1.s <-> l2.s FROM LINE_TBL l1, LINE_TBL l2; + +-- Distance to box +SELECT l.s, b.f1, l.s <-> b.f1 FROM LINE_TBL l, BOX_TBL b; +SELECT l.s, b.f1, b.f1 <-> l.s FROM LINE_TBL l, BOX_TBL b; + +-- Intersect with line +SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?# l2.s; + +-- Intersect with box +SELECT l.s, b.f1 FROM LINE_TBL l, BOX_TBL b WHERE l.s ?# b.f1; + + +-- Length +SELECT s, @-@ s FROM LSEG_TBL; + +-- Vertical +SELECT s FROM LSEG_TBL WHERE ?| s; + +-- Horizontal +SELECT s FROM LSEG_TBL WHERE ?- s; + +-- Center +SELECT s, @@ s FROM LSEG_TBL; + +-- To point +SELECT s, s::point FROM LSEG_TBL; + +-- Has points less than line segment +SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s < l2.s; + +-- Has points less than or equal to line segment +SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s <= l2.s; + +-- Has points equal to line segment +SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s = l2.s; + +-- Has points greater than or equal to line segment +SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s >= l2.s; + +-- Has points greater than line segment +SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s > l2.s; + +-- Has points not equal to line segment +SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s != l2.s; + +-- Parallel with line segment +SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?|| l2.s; + +-- Perpendicular with line segment +SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?-| l2.s; + +-- Distance to line +SELECT l.s, l1.s, l.s <-> l1.s AS dist_sl, l1.s <-> l.s AS dist_ls FROM LSEG_TBL l, LINE_TBL l1; + +-- Distance to line segment +SELECT l1.s, l2.s, l1.s <-> l2.s FROM LSEG_TBL l1, LSEG_TBL l2; + +-- Distance to box +SELECT l.s, b.f1, l.s <-> b.f1 AS dist_sb, b.f1 <-> l.s AS dist_bs FROM LSEG_TBL l, BOX_TBL b; + +-- Intersect with line segment +SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s ?# l1.s; + +-- Intersect with box +SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s ?# b.f1; + +-- Intersection point with line segment + +-- On line +SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s <@ l1.s; + +-- On box +SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s <@ b.f1; + +-- +-- Boxes +-- + +SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL; + +-- translation +SELECT '' AS twentyfour, b.f1 + p.f1 AS translation + FROM BOX_TBL b, POINT_TBL p; + +SELECT '' AS twentyfour, b.f1 - p.f1 AS translation + FROM BOX_TBL b, POINT_TBL p; + +-- Multiply with point +SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000; + +-- Overflow error +SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] > 1000; + +-- Divide by point +SELECT b.f1, p.f1, b.f1 / p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000; + +-- To box +SELECT f1::box + FROM POINT_TBL; + +SELECT bound_box(a.f1, b.f1) + FROM BOX_TBL a, BOX_TBL b; + +-- Below box +SELECT b1.f1, b2.f1, b1.f1 <^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2; + +-- Above box +SELECT b1.f1, b2.f1, b1.f1 >^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2; + + +-- Diagonal +SELECT f1, diagonal(f1) FROM BOX_TBL; + +-- Distance to box +SELECT b1.f1, b2.f1, b1.f1 <-> b2.f1 FROM BOX_TBL b1, BOX_TBL b2; + +-- +-- Paths +-- + +-- Points +SELECT f1, npoints(f1) FROM PATH_TBL; + +-- Area +SELECT f1, area(f1) FROM PATH_TBL; + +-- Length +SELECT f1, @-@ f1 FROM PATH_TBL; + +-- Center +SELECT f1, @@ f1 FROM PATH_TBL; + +-- To polygon +SELECT f1, f1::polygon FROM PATH_TBL WHERE isclosed(f1); + +-- Open path cannot be converted to polygon error +SELECT f1, f1::polygon FROM PATH_TBL WHERE isopen(f1); + +-- Has points less than path +SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 < p2.f1; + +-- Has points less than or equal to path +SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 <= p2.f1; + +-- Has points equal to path +SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 = p2.f1; + +-- Has points greater than or equal to path +SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 >= p2.f1; + +-- Has points greater than path +SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 > p2.f1; + +-- Add path +SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM PATH_TBL p1, PATH_TBL p2; + +-- Add point +SELECT p.f1, p1.f1, p.f1 + p1.f1 FROM PATH_TBL p, POINT_TBL p1; + +-- Subtract point +SELECT p.f1, p1.f1, p.f1 - p1.f1 FROM PATH_TBL p, POINT_TBL p1; + +-- Multiply with point +SELECT p.f1, p1.f1, p.f1 * p1.f1 FROM PATH_TBL p, POINT_TBL p1; + +-- Divide by point +SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1[0] BETWEEN 1 AND 1000; + +-- Division by 0 error +SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1 ~= '(0,0)'::point; + +-- Distance to path +SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM PATH_TBL p1, PATH_TBL p2; + +-- +-- Polygons +-- + +-- containment +SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 @> p.f1 AS contains + FROM POLYGON_TBL poly, POINT_TBL p; + +SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 <@ poly.f1 AS contained + FROM POLYGON_TBL poly, POINT_TBL p; + +SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon + FROM POLYGON_TBL; + +SELECT '' AS four, polygon(f1) + FROM BOX_TBL; + +SELECT '' AS four, polygon(f1) + FROM PATH_TBL WHERE isclosed(f1); + +SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon + FROM PATH_TBL + WHERE isopen(f1); + +-- To box +SELECT f1, f1::box FROM POLYGON_TBL; + +-- To path +SELECT f1, f1::path FROM POLYGON_TBL; + +-- Same as polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 ~= p2.f1; + +-- Contained by polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <@ p2.f1; + +-- Contains polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 @> p2.f1; + +-- Overlap with polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 && p2.f1; + +-- Left of polygon + +-- Overlap of left of polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &< p2.f1; + + +-- Overlap of right of polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &> p2.f1; + +-- Below polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <<| p2.f1; + +-- Overlap or below polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &<| p2.f1; + +-- Above polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |>> p2.f1; + +-- Overlap or above polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |&> p2.f1; + +-- Distance to polygon +SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2; + +-- +-- Circles +-- + +SELECT '' AS six, circle(f1, 50.0) + FROM POINT_TBL; + +SELECT '' AS four, circle(f1) + FROM BOX_TBL; + + +SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance + FROM CIRCLE_TBL c1, POINT_TBL p1 + WHERE (p1.f1 <-> c1.f1) > 0 + ORDER BY distance, area(c1.f1), p1.f1[0]; + +-- To polygon +SELECT f1, f1::polygon FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>'; + +-- To polygon with less points +SELECT f1, polygon(8, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>'; + +-- Too less points error +SELECT f1, polygon(1, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>'; + +-- Zero radius error +SELECT f1, polygon(10, f1) FROM CIRCLE_TBL WHERE f1 < '<(0,0),1>'; + +-- Same as circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 ~= c2.f1; + +-- Overlap with circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 && c2.f1; + +-- Overlap or left of circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &< c2.f1; + +-- Left of circle + +-- Overlap or right of circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &> c2.f1; + +-- Contained by circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <@ c2.f1; + +-- Contain by circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 @> c2.f1; + +-- Below circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <<| c2.f1; + +-- Above circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |>> c2.f1; + +-- Overlap or below circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &<| c2.f1; + +-- Overlap or above circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |&> c2.f1; + +-- Area equal with circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 = c2.f1; + +-- Area not equal with circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 != c2.f1; + +-- Area less than circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1; + +-- Area greater than circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 > c2.f1; + +-- Area less than or equal circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <= c2.f1; + +-- Area greater than or equal circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >= c2.f1; + +-- Area less than circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1; + +-- Area greater than circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1; + +-- Add point +SELECT c.f1, p.f1, c.f1 + p.f1 FROM CIRCLE_TBL c, POINT_TBL p; + +-- Subtract point +SELECT c.f1, p.f1, c.f1 - p.f1 FROM CIRCLE_TBL c, POINT_TBL p; + +-- Multiply with point +SELECT c.f1, p.f1, c.f1 * p.f1 FROM CIRCLE_TBL c, POINT_TBL p; + +-- Divide by point +SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000; + +-- Overflow error +SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] > 1000; + +-- Division by 0 error +SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1 ~= '(0,0)'::point; + +-- Distance to polygon +SELECT c.f1, p.f1, c.f1 <-> p.f1 FROM CIRCLE_TBL c, POLYGON_TBL p; +SELECT '' AS two, (@@ f1) AS center + FROM POLYGON_TBL + WHERE (# f1) > 2; + +-- Intersection point with line +SELECT l1.s, l2.s, l1.s # l2.s FROM LINE_TBL l1, LINE_TBL l2; + +-- Closest point to line segment +SELECT l.s, l1.s, l.s ## l1.s FROM LINE_TBL l, LSEG_TBL l1; + +-- Closest point to box +SELECT l.s, b.f1, l.s ## b.f1 FROM LINE_TBL l, BOX_TBL b; + +-- +-- Line segments +-- + +-- intersection +SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection + FROM LSEG_TBL l, POINT_TBL p; +SELECT l1.s, l2.s, l1.s # l2.s FROM LSEG_TBL l1, LSEG_TBL l2; + +-- Closest point to line +SELECT l.s, l1.s, l.s ## l1.s FROM LSEG_TBL l, LINE_TBL l1; + +-- Closest point to line segment +SELECT l1.s, l2.s, l1.s ## l2.s FROM LSEG_TBL l1, LSEG_TBL l2; + +-- Closest point to box +SELECT l.s, b.f1, l.s ## b.f1 FROM LSEG_TBL l, BOX_TBL b; +-- Intersection point with box +SELECT b1.f1, b2.f1, b1.f1 # b2.f1 FROM BOX_TBL b1, BOX_TBL b2; + +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 << p2.f1; +-- Right of polygon +SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 >> p2.f1; +SELECT '' AS two, circle(f1) + FROM POLYGON_TBL + WHERE (# f1) >= 3; + +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 << c2.f1; + +-- Right of circle +SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >> c2.f1; diff --git a/postgresql/examples/gin.sql b/postgresql/examples/gin.sql new file mode 100644 index 0000000..abe3575 --- /dev/null +++ b/postgresql/examples/gin.sql @@ -0,0 +1,141 @@ +-- +-- Test GIN indexes. +-- +-- There are other tests to test different GIN opclasses. This is for testing +-- GIN itself. + +-- Create and populate a test table with a GIN index. +create table gin_test_tbl(i int4[]) with (autovacuum_enabled = off); +create index gin_test_idx on gin_test_tbl using gin (i) + with (fastupdate = on, gin_pending_list_limit = 4096); +insert into gin_test_tbl select array[1, 2, g] from generate_series(1, 20000) g; +insert into gin_test_tbl select array[1, 3, g] from generate_series(1, 1000) g; + +select gin_clean_pending_list('gin_test_idx')>10 as many; -- flush the fastupdate buffers + +insert into gin_test_tbl select array[3, 1, g] from generate_series(1, 1000) g; + +vacuum gin_test_tbl; -- flush the fastupdate buffers + +select gin_clean_pending_list('gin_test_idx'); -- nothing to flush + +-- Test vacuuming +delete from gin_test_tbl where i @> array[2]; +vacuum gin_test_tbl; + +-- Disable fastupdate, and do more insertions. With fastupdate enabled, most +-- insertions (by flushing the list pages) cause page splits. Without +-- fastupdate, we get more churn in the GIN data leaf pages, and exercise the +-- recompression codepaths. +alter index gin_test_idx set (fastupdate = off); + +insert into gin_test_tbl select array[1, 2, g] from generate_series(1, 1000) g; +insert into gin_test_tbl select array[1, 3, g] from generate_series(1, 1000) g; + +delete from gin_test_tbl where i @> array[2]; +vacuum gin_test_tbl; + +-- Test for "rare && frequent" searches +explain (costs off) +select count(*) from gin_test_tbl where i @> array[1, 999]; + +select count(*) from gin_test_tbl where i @> array[1, 999]; + +-- Very weak test for gin_fuzzy_search_limit +set gin_fuzzy_search_limit = 1000; + +explain (costs off) +select count(*) > 0 as ok from gin_test_tbl where i @> array[1]; + +select count(*) > 0 as ok from gin_test_tbl where i @> array[1]; + +reset gin_fuzzy_search_limit; + +-- Test optimization of empty queries +create temp table t_gin_test_tbl(i int4[], j int4[]); +create index on t_gin_test_tbl using gin (i, j); +insert into t_gin_test_tbl +values + (null, null), + ('{}', null), + ('{1}', null), + ('{1,2}', null), + (null, '{}'), + (null, '{10}'), + ('{1,2}', '{10}'), + ('{2}', '{10}'), + ('{1,3}', '{}'), + ('{1,1}', '{10}'); + +set enable_seqscan = off; +explain (costs off) +select * from t_gin_test_tbl where array[0] <@ i; +select * from t_gin_test_tbl where array[0] <@ i; +select * from t_gin_test_tbl where array[0] <@ i and '{}'::int4[] <@ j; + +explain (costs off) +select * from t_gin_test_tbl where i @> '{}'; +select * from t_gin_test_tbl where i @> '{}'; + +create function explain_query_json(query_sql text) +returns table (explain_line json) +language plpgsql as +$$ +begin + set enable_seqscan = off; + set enable_bitmapscan = on; + return query execute 'EXPLAIN (ANALYZE, FORMAT json) ' || query_sql; +end; +$$; + +create function execute_text_query_index(query_sql text) +returns setof text +language plpgsql +as +$$ +begin + set enable_seqscan = off; + set enable_bitmapscan = on; + return query execute query_sql; +end; +$$; + +create function execute_text_query_heap(query_sql text) +returns setof text +language plpgsql +as +$$ +begin + set enable_seqscan = on; + set enable_bitmapscan = off; + return query execute query_sql; +end; +$$; + +-- check number of rows returned by index and removed by recheck +select + query, + js->0->'Plan'->'Plans'->0->'Actual Rows' as "return by index", + js->0->'Plan'->'Rows Removed by Index Recheck' as "removed by recheck", + (res_index = res_heap) as "match" +from + (values + ($$ i @> '{}' $$), + ($$ j @> '{}' $$), + ($$ i @> '{}' and j @> '{}' $$), + ($$ i @> '{1}' $$), + ($$ i @> '{1}' and j @> '{}' $$), + ($$ i @> '{1}' and i @> '{}' and j @> '{}' $$), + ($$ j @> '{10}' $$), + ($$ j @> '{10}' and i @> '{}' $$), + ($$ j @> '{10}' and j @> '{}' and i @> '{}' $$), + ($$ i @> '{1}' and j @> '{10}' $$) + ) q(query), + lateral explain_query_json($$select * from t_gin_test_tbl where $$ || query) js, + lateral execute_text_query_index($$select string_agg((i, j)::text, ' ') from t_gin_test_tbl where $$ || query) res_index, + lateral execute_text_query_heap($$select string_agg((i, j)::text, ' ') from t_gin_test_tbl where $$ || query) res_heap; + +reset enable_seqscan; +reset enable_bitmapscan; + +drop table t_gin_test_tbl; diff --git a/postgresql/examples/gist.sql b/postgresql/examples/gist.sql new file mode 100644 index 0000000..b9d398e --- /dev/null +++ b/postgresql/examples/gist.sql @@ -0,0 +1,150 @@ +-- +-- Test GiST indexes. +-- +-- There are other tests to test different GiST opclasses. This is for +-- testing GiST code itself. Vacuuming in particular. + +create table gist_point_tbl(id int4, p point); +create index gist_pointidx on gist_point_tbl using gist(p); + +-- Verify the fillfactor and buffering options +create index gist_pointidx2 on gist_point_tbl using gist(p) with (buffering = on, fillfactor=50); +create index gist_pointidx3 on gist_point_tbl using gist(p) with (buffering = off); +create index gist_pointidx4 on gist_point_tbl using gist(p) with (buffering = auto); +drop index gist_pointidx2, gist_pointidx3, gist_pointidx4; + +-- Make sure bad values are refused +create index gist_pointidx5 on gist_point_tbl using gist(p) with (buffering = invalid_value); +create index gist_pointidx5 on gist_point_tbl using gist(p) with (fillfactor=9); +create index gist_pointidx5 on gist_point_tbl using gist(p) with (fillfactor=101); + +-- Insert enough data to create a tree that's a couple of levels deep. +insert into gist_point_tbl (id, p) +select g, point(g*10, g*10) from generate_series(1, 10000) g; + +insert into gist_point_tbl (id, p) +select g+100000, point(g*10+1, g*10+1) from generate_series(1, 10000) g; + +-- To test vacuum, delete some entries from all over the index. +delete from gist_point_tbl where id % 2 = 1; + +-- And also delete some concentration of values. +delete from gist_point_tbl where id > 5000; + +vacuum analyze gist_point_tbl; + +-- rebuild the index with a different fillfactor +alter index gist_pointidx SET (fillfactor = 40); +reindex index gist_pointidx; + +-- +-- Test Index-only plans on GiST indexes +-- + +create table gist_tbl (b box, p point, c circle); + +insert into gist_tbl +select box(point(0.05*i, 0.05*i), point(0.05*i, 0.05*i)), + point(0.05*i, 0.05*i), + circle(point(0.05*i, 0.05*i), 1.0) +from generate_series(0,10000) as i; + +vacuum analyze gist_tbl; + +set enable_seqscan=off; +set enable_bitmapscan=off; +set enable_indexonlyscan=on; + +-- Test index-only scan with point opclass +create index gist_tbl_point_index on gist_tbl using gist (p); + +-- check that the planner chooses an index-only scan +explain (costs off) +select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5)); + +-- execute the same +select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5)); + +-- Also test an index-only knn-search +explain (costs off) +select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5)) +order by p <-> point(0.201, 0.201); + +select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5)) +order by p <-> point(0.201, 0.201); + +-- Check commuted case as well +explain (costs off) +select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5)) +order by point(0.101, 0.101) <-> p; + +select p from gist_tbl where p <@ box(point(0,0), point(0.5, 0.5)) +order by point(0.101, 0.101) <-> p; + +-- Check case with multiple rescans (bug #14641) +explain (costs off) +select p from + (values (box(point(0,0), point(0.5,0.5))), + (box(point(0.5,0.5), point(0.75,0.75))), + (box(point(0.8,0.8), point(1.0,1.0)))) as v(bb) +cross join lateral + (select p from gist_tbl where p <@ bb order by p <-> bb[0] limit 2) ss; + +select p from + (values (box(point(0,0), point(0.5,0.5))), + (box(point(0.5,0.5), point(0.75,0.75))), + (box(point(0.8,0.8), point(1.0,1.0)))) as v(bb) +cross join lateral + (select p from gist_tbl where p <@ bb order by p <-> bb[0] limit 2) ss; + +drop index gist_tbl_point_index; + +-- Test index-only scan with box opclass +create index gist_tbl_box_index on gist_tbl using gist (b); + +-- check that the planner chooses an index-only scan +explain (costs off) +select b from gist_tbl where b <@ box(point(5,5), point(6,6)); + +-- execute the same +select b from gist_tbl where b <@ box(point(5,5), point(6,6)); + +-- Also test an index-only knn-search +explain (costs off) +select b from gist_tbl where b <@ box(point(5,5), point(6,6)) +order by b <-> point(5.2, 5.91); + +select b from gist_tbl where b <@ box(point(5,5), point(6,6)) +order by b <-> point(5.2, 5.91); + +-- Check commuted case as well +explain (costs off) +select b from gist_tbl where b <@ box(point(5,5), point(6,6)) +order by point(5.2, 5.91) <-> b; + +select b from gist_tbl where b <@ box(point(5,5), point(6,6)) +order by point(5.2, 5.91) <-> b; + +drop index gist_tbl_box_index; + +-- Test that an index-only scan is not chosen, when the query involves the +-- circle column (the circle opclass does not support index-only scans). +create index gist_tbl_multi_index on gist_tbl using gist (p, c); + +explain (costs off) +select p, c from gist_tbl +where p <@ box(point(5,5), point(6, 6)); + +-- execute the same +select b, p from gist_tbl +where b <@ box(point(4.5, 4.5), point(5.5, 5.5)) +and p <@ box(point(5,5), point(6, 6)); + +drop index gist_tbl_multi_index; + +-- Clean up +reset enable_seqscan; +reset enable_bitmapscan; +reset enable_indexonlyscan; + +drop table gist_tbl; diff --git a/postgresql/examples/groupingsets.sql b/postgresql/examples/groupingsets.sql new file mode 100644 index 0000000..9bb95ec --- /dev/null +++ b/postgresql/examples/groupingsets.sql @@ -0,0 +1,489 @@ +-- +-- grouping sets +-- + +-- test data sources + +create temp view gstest1(a,b,v) + as values (1,1,10),(1,1,11),(1,2,12),(1,2,13),(1,3,14), + (2,3,15), + (3,3,16),(3,4,17), + (4,1,18),(4,1,19); + +create temp table gstest2 (a integer, b integer, c integer, d integer, + e integer, f integer, g integer, h integer); +copy gstest2 from stdin; +\. + +create temp table gstest3 (a integer, b integer, c integer, d integer); +copy gstest3 from stdin; +\. +alter table gstest3 add primary key (a); + +create temp table gstest4(id integer, v integer, + unhashable_col bit(4), unsortable_col xid); +insert into gstest4 +values (1,1,b'0000','1'), (2,2,b'0001','1'), + (3,4,b'0010','2'), (4,8,b'0011','2'), + (5,16,b'0000','2'), (6,32,b'0001','2'), + (7,64,b'0010','1'), (8,128,b'0011','1'); + +create temp table gstest_empty (a integer, b integer, v integer); + +--TODO +/* +create function gstest_data(v integer, out a integer, out b integer) + returns setof record + as $f$ + begin + return query select v, i from generate_series(1,3) i; + end; + $f$ language plpgsql; +*/ +-- basic functionality + +set enable_hashagg = false; -- test hashing explicitly later + +-- simple rollup with multiple plain aggregates, with and without ordering +-- (and with ordering differing from grouping) + +select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by rollup (a,b); +select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by rollup (a,b) order by a,b; +select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by rollup (a,b) order by b desc, a; +select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by rollup (a,b) order by coalesce(a,0)+coalesce(b,0); + +-- various types of ordered aggs +select a, b, grouping(a,b), + array_agg(v order by v), + string_agg(v::text, ':' order by v desc), + percentile_disc(0.5) within group (order by v), + rank(1,2,12) within group (order by a,b,v) + from gstest1 group by rollup (a,b) order by a,b; + +-- test usage of grouped columns in direct args of aggs +select grouping(a), a, array_agg(b), + rank(a) within group (order by b nulls first), + rank(a) within group (order by b nulls last) + from (values (1,1),(1,4),(1,5),(3,1),(3,2)) v(a,b) + group by rollup (a) order by a; + +-- nesting with window functions +select a, b, sum(c), sum(sum(c)) over (order by a,b) as rsum + from gstest2 group by rollup (a,b) order by rsum, a, b; + +-- nesting with grouping sets +select sum(c) from gstest2 + group by grouping sets((), grouping sets((), grouping sets(()))) + order by 1 desc; +select sum(c) from gstest2 + group by grouping sets((), grouping sets((), grouping sets(((a, b))))) + order by 1 desc; +select sum(c) from gstest2 + group by grouping sets(grouping sets(rollup(c), grouping sets(cube(c)))) + order by 1 desc; +select sum(c) from gstest2 + group by grouping sets(a, grouping sets(a, cube(b))) + order by 1 desc; +select sum(c) from gstest2 + group by grouping sets(grouping sets((a, (b)))) + order by 1 desc; +select sum(c) from gstest2 + group by grouping sets(grouping sets((a, b))) + order by 1 desc; +select sum(c) from gstest2 + group by grouping sets(grouping sets(a, grouping sets(a), a)) + order by 1 desc; +select sum(c) from gstest2 + group by grouping sets(grouping sets(a, grouping sets(a, grouping sets(a), ((a)), a, grouping sets(a), (a)), a)) + order by 1 desc; +select sum(c) from gstest2 + group by grouping sets((a,(a,b)), grouping sets((a,(a,b)),a)) + order by 1 desc; + +-- empty input: first is 0 rows, second 1, third 3 etc. +select a, b, sum(v), count(*) from gstest_empty group by grouping sets ((a,b),a); +select a, b, sum(v), count(*) from gstest_empty group by grouping sets ((a,b),()); +select a, b, sum(v), count(*) from gstest_empty group by grouping sets ((a,b),(),(),()); +select sum(v), count(*) from gstest_empty group by grouping sets ((),(),()); + +-- empty input with joins tests some important code paths +select t1.a, t2.b, sum(t1.v), count(*) from gstest_empty t1, gstest_empty t2 + group by grouping sets ((t1.a,t2.b),()); + +-- simple joins, var resolution, GROUPING on join vars +select t1.a, t2.b, grouping(t1.a, t2.b), sum(t1.v), max(t2.a) + from gstest1 t1, gstest2 t2 + group by grouping sets ((t1.a, t2.b), ()); + +select t1.a, t2.b, grouping(t1.a, t2.b), sum(t1.v), max(t2.a) + from gstest1 t1 join gstest2 t2 on (t1.a=t2.a) + group by grouping sets ((t1.a, t2.b), ()); + +select a, b, grouping(a, b), sum(t1.v), max(t2.c) + from gstest1 t1 join gstest2 t2 using (a,b) + group by grouping sets ((a, b), ()); + +-- check that functionally dependent cols are not nulled +select a, d, grouping(a,b,c) + from gstest3 + group by grouping sets ((a,b), (a,c)); + +-- check that distinct grouping columns are kept separate +-- even if they are equal() +explain (costs off) +select g as alias1, g as alias2 + from generate_series(1,3) g + group by alias1, rollup(alias2); + +select g as alias1, g as alias2 + from generate_series(1,3) g + group by alias1, rollup(alias2); + +-- check that pulled-up subquery outputs still go to null when appropriate +select four, x + from (select four, ten, 'foo'::text as x from tenk1) as t + group by grouping sets (four, x) + having x = 'foo'; + +select four, x || 'x' + from (select four, ten, 'foo'::text as x from tenk1) as t + group by grouping sets (four, x) + order by four; + +select (x+y)*1, sum(z) + from (select 1 as x, 2 as y, 3 as z) s + group by grouping sets (x+y, x); + +select x, not x as not_x, q2 from + (select *, q1 = 1 as x from int8_tbl i1) as t + group by grouping sets(x, q2) + order by x, q2; + +-- simple rescan tests + +select a, b, sum(v.x) + from (values (1),(2)) v(x), gstest_data(v.x) + group by rollup (a,b); + +select * + from (values (1),(2)) v(x), + lateral (select a, b, sum(v.x) from gstest_data(v.x) group by rollup (a,b)) s; + +-- min max optimization should still work with GROUP BY () +explain (costs off) + select min(unique1) from tenk1 GROUP BY (); + +-- Views with GROUPING SET queries +CREATE VIEW gstest_view AS select a, b, grouping(a,b), sum(c), count(*), max(c) + from gstest2 group by rollup ((a,b,c),(c,d)); + +select pg_get_viewdef('gstest_view'::regclass, true); + +-- Nested queries with 3 or more levels of nesting +select(select (select grouping(a,b) from (values (1)) v2(c)) from (values (1,2)) v1(a,b) group by (a,b)) from (values(6,7)) v3(e,f) GROUP BY ROLLUP(e,f); +select(select (select grouping(e,f) from (values (1)) v2(c)) from (values (1,2)) v1(a,b) group by (a,b)) from (values(6,7)) v3(e,f) GROUP BY ROLLUP(e,f); +select(select (select grouping(c) from (values (1)) v2(c) GROUP BY c) from (values (1,2)) v1(a,b) group by (a,b)) from (values(6,7)) v3(e,f) GROUP BY ROLLUP(e,f); + +-- Combinations of operations +select a, b, c, d from gstest2 group by rollup(a,b),grouping sets(c,d); +select a, b from (values (1,2),(2,3)) v(a,b) group by a,b, grouping sets(a); + +-- Tests for chained aggregates +select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by grouping sets ((a,b),(a+1,b+1),(a+2,b+2)) order by 3,6; +select(select (select grouping(a,b) from (values (1)) v2(c)) from (values (1,2)) v1(a,b) group by (a,b)) from (values(6,7)) v3(e,f) GROUP BY ROLLUP((e+1),(f+1)); +select(select (select grouping(a,b) from (values (1)) v2(c)) from (values (1,2)) v1(a,b) group by (a,b)) from (values(6,7)) v3(e,f) GROUP BY CUBE((e+1),(f+1)) ORDER BY (e+1),(f+1); +select a, b, sum(c), sum(sum(c)) over (order by a,b) as rsum + from gstest2 group by cube (a,b) order by rsum, a, b; +select a, b, sum(c) from (values (1,1,10),(1,1,11),(1,2,12),(1,2,13),(1,3,14),(2,3,15),(3,3,16),(3,4,17),(4,1,18),(4,1,19)) v(a,b,c) group by rollup (a,b); +select a, b, sum(v.x) + from (values (1),(2)) v(x), gstest_data(v.x) + group by cube (a,b) order by a,b; + +-- Test reordering of grouping sets +explain (costs off) +select * from gstest1 group by grouping sets((a,b,v),(v)) order by v,b,a; + +-- Agg level check. This query should error out. +select (select grouping(a,b) from gstest2) from gstest2 group by a,b; + +--Nested queries +select a, b, sum(c), count(*) from gstest2 group by grouping sets (rollup(a,b),a); + +-- HAVING queries +select ten, sum(distinct four) from onek a +group by grouping sets((ten,four),(ten)) +having exists (select 1 from onek b where sum(distinct a.four) = b.four); + +-- Tests around pushdown of HAVING clauses, partially testing against previous bugs +select a,count(*) from gstest2 group by rollup(a) order by a; +select a,count(*) from gstest2 group by rollup(a) having a is distinct from 1 order by a; +explain (costs off) + select a,count(*) from gstest2 group by rollup(a) having a is distinct from 1 order by a; + +select v.c, (select count(*) from gstest2 group by () having v.c) + from (values (false),(true)) v(c) order by v.c; +explain (costs off) + select v.c, (select count(*) from gstest2 group by () having v.c) + from (values (false),(true)) v(c) order by v.c; + +-- HAVING with GROUPING queries +select ten, grouping(ten) from onek +group by grouping sets(ten) having grouping(ten) >= 0 +order by 2,1; +select ten, grouping(ten) from onek +group by grouping sets(ten, four) having grouping(ten) > 0 +order by 2,1; +select ten, grouping(ten) from onek +group by rollup(ten) having grouping(ten) > 0 +order by 2,1; +select ten, grouping(ten) from onek +group by cube(ten) having grouping(ten) > 0 +order by 2,1; +select ten, grouping(ten) from onek +group by (ten) having grouping(ten) >= 0 +order by 2,1; + +-- FILTER queries +select ten, sum(distinct four) filter (where four::text ~ '123') from onek a +group by rollup(ten); + +-- More rescan tests +select * from (values (1),(2)) v(a) left join lateral (select v.a, four, ten, count(*) from onek group by cube(four,ten)) s on true order by v.a,four,ten; +select array(select row(v.a,s1.*) from (select two,four, count(*) from onek group by cube(two,four) order by two,four) s1) from (values (1),(2)) v(a); + +-- Grouping on text columns +select sum(ten) from onek group by two, rollup(four::text) order by 1; +select sum(ten) from onek group by rollup(four::text), two order by 1; + +-- hashing support + +set enable_hashagg = true; + +-- failure cases + +select count(*) from gstest4 group by rollup(unhashable_col,unsortable_col); +select array_agg(v order by v) from gstest4 group by grouping sets ((id,unsortable_col),(id)); + +-- simple cases + +select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by grouping sets ((a),(b)) order by 3,1,2; +explain (costs off) select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by grouping sets ((a),(b)) order by 3,1,2; + +select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by cube(a,b) order by 3,1,2; +explain (costs off) select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by cube(a,b) order by 3,1,2; + +-- shouldn't try and hash +explain (costs off) + select a, b, grouping(a,b), array_agg(v order by v) + from gstest1 group by cube(a,b); + +-- unsortable cases +select unsortable_col, count(*) + from gstest4 group by grouping sets ((unsortable_col),(unsortable_col)) + order by unsortable_col::text; + +-- mixed hashable/sortable cases +select unhashable_col, unsortable_col, + grouping(unhashable_col, unsortable_col), + count(*), sum(v) + from gstest4 group by grouping sets ((unhashable_col),(unsortable_col)) + order by 3, 5; +explain (costs off) + select unhashable_col, unsortable_col, + grouping(unhashable_col, unsortable_col), + count(*), sum(v) + from gstest4 group by grouping sets ((unhashable_col),(unsortable_col)) + order by 3,5; + +select unhashable_col, unsortable_col, + grouping(unhashable_col, unsortable_col), + count(*), sum(v) + from gstest4 group by grouping sets ((v,unhashable_col),(v,unsortable_col)) + order by 3,5; +explain (costs off) + select unhashable_col, unsortable_col, + grouping(unhashable_col, unsortable_col), + count(*), sum(v) + from gstest4 group by grouping sets ((v,unhashable_col),(v,unsortable_col)) + order by 3,5; + +-- empty input: first is 0 rows, second 1, third 3 etc. +select a, b, sum(v), count(*) from gstest_empty group by grouping sets ((a,b),a); +explain (costs off) + select a, b, sum(v), count(*) from gstest_empty group by grouping sets ((a,b),a); +select a, b, sum(v), count(*) from gstest_empty group by grouping sets ((a,b),()); +select a, b, sum(v), count(*) from gstest_empty group by grouping sets ((a,b),(),(),()); +explain (costs off) + select a, b, sum(v), count(*) from gstest_empty group by grouping sets ((a,b),(),(),()); +select sum(v), count(*) from gstest_empty group by grouping sets ((),(),()); +explain (costs off) + select sum(v), count(*) from gstest_empty group by grouping sets ((),(),()); + +-- check that functionally dependent cols are not nulled +select a, d, grouping(a,b,c) + from gstest3 + group by grouping sets ((a,b), (a,c)); +explain (costs off) + select a, d, grouping(a,b,c) + from gstest3 + group by grouping sets ((a,b), (a,c)); + +-- simple rescan tests + +select a, b, sum(v.x) + from (values (1),(2)) v(x), gstest_data(v.x) + group by grouping sets (a,b) + order by 1, 2, 3; +explain (costs off) + select a, b, sum(v.x) + from (values (1),(2)) v(x), gstest_data(v.x) + group by grouping sets (a,b) + order by 3, 1, 2; +select * + from (values (1),(2)) v(x), + lateral (select a, b, sum(v.x) from gstest_data(v.x) group by grouping sets (a,b)) s; +explain (costs off) + select * + from (values (1),(2)) v(x), + lateral (select a, b, sum(v.x) from gstest_data(v.x) group by grouping sets (a,b)) s; + +-- Tests for chained aggregates +select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by grouping sets ((a,b),(a+1,b+1),(a+2,b+2)) order by 3,6; +explain (costs off) + select a, b, grouping(a,b), sum(v), count(*), max(v) + from gstest1 group by grouping sets ((a,b),(a+1,b+1),(a+2,b+2)) order by 3,6; +select a, b, sum(c), sum(sum(c)) over (order by a,b) as rsum + from gstest2 group by cube (a,b) order by rsum, a, b; +explain (costs off) + select a, b, sum(c), sum(sum(c)) over (order by a,b) as rsum + from gstest2 group by cube (a,b) order by rsum, a, b; +select a, b, sum(v.x) + from (values (1),(2)) v(x), gstest_data(v.x) + group by cube (a,b) order by a,b; +explain (costs off) + select a, b, sum(v.x) + from (values (1),(2)) v(x), gstest_data(v.x) + group by cube (a,b) order by a,b; + +-- Verify that we correctly handle the child node returning a +-- non-minimal slot, which happens if the input is pre-sorted, +-- e.g. due to an index scan. +BEGIN; +SET LOCAL enable_hashagg = false; +EXPLAIN (COSTS OFF) SELECT a, b, count(*), max(a), max(b) FROM gstest3 GROUP BY GROUPING SETS(a, b,()) ORDER BY a, b; +SELECT a, b, count(*), max(a), max(b) FROM gstest3 GROUP BY GROUPING SETS(a, b,()) ORDER BY a, b; +SET LOCAL enable_seqscan = false; +EXPLAIN (COSTS OFF) SELECT a, b, count(*), max(a), max(b) FROM gstest3 GROUP BY GROUPING SETS(a, b,()) ORDER BY a, b; +SELECT a, b, count(*), max(a), max(b) FROM gstest3 GROUP BY GROUPING SETS(a, b,()) ORDER BY a, b; +COMMIT; + +-- More rescan tests +select * from (values (1),(2)) v(a) left join lateral (select v.a, four, ten, count(*) from onek group by cube(four,ten)) s on true order by v.a,four,ten; +select array(select row(v.a,s1.*) from (select two,four, count(*) from onek group by cube(two,four) order by two,four) s1) from (values (1),(2)) v(a); + +-- Rescan logic changes when there are no empty grouping sets, so test +-- that too: +select * from (values (1),(2)) v(a) left join lateral (select v.a, four, ten, count(*) from onek group by grouping sets(four,ten)) s on true order by v.a,four,ten; +select array(select row(v.a,s1.*) from (select two,four, count(*) from onek group by grouping sets(two,four) order by two,four) s1) from (values (1),(2)) v(a); + +-- test the knapsack + +set enable_indexscan = false; +set work_mem = '64kB'; +explain (costs off) + select unique1, + count(two), count(four), count(ten), + count(hundred), count(thousand), count(twothousand), + count(*) + from tenk1 group by grouping sets (unique1,twothousand,thousand,hundred,ten,four,two); +explain (costs off) + select unique1, + count(two), count(four), count(ten), + count(hundred), count(thousand), count(twothousand), + count(*) + from tenk1 group by grouping sets (unique1,hundred,ten,four,two); + +set work_mem = '384kB'; +explain (costs off) + select unique1, + count(two), count(four), count(ten), + count(hundred), count(thousand), count(twothousand), + count(*) + from tenk1 group by grouping sets (unique1,twothousand,thousand,hundred,ten,four,two); + +-- check collation-sensitive matching between grouping expressions +-- (similar to a check for aggregates, but there are additional code +-- paths for GROUPING, so check again here) + +select v||'a', case grouping(v||'a') when 1 then 1 else 0 end, count(*) + from unnest(array[1,1], array['a','b']) u(i,v) + group by rollup(i, v||'a') order by 1,3; +select v||'a', case when grouping(v||'a') = 1 then 1 else 0 end, count(*) + from unnest(array[1,1], array['a','b']) u(i,v) + group by rollup(i, v||'a') order by 1,3; + +-- +-- Compare results between plans using sorting and plans using hash +-- aggregation. Force spilling in both cases by setting work_mem low +-- and altering the statistics. +-- + +create table gs_data_1 as +select g%1000 as g1000, g%100 as g100, g%10 as g10, g + from generate_series(0,1999) g; + +analyze gs_data_1; +alter table gs_data_1 set (autovacuum_enabled = 'false'); +update pg_class set reltuples = 10 where relname='gs_data_1'; + +SET work_mem='64kB'; + +-- Produce results with sorting. + +set enable_hashagg = false; +set jit_above_cost = 0; + +explain (costs off) +select g100, g10, sum(g::numeric), count(*), max(g::text) +from gs_data_1 group by cube (g1000, g100,g10); + +create table gs_group_1 as +select g100, g10, sum(g::numeric), count(*), max(g::text) +from gs_data_1 group by cube (g1000, g100,g10); + +-- Produce results with hash aggregation. + +set enable_hashagg = true; +set enable_sort = false; + +explain (costs off) +select g100, g10, sum(g::numeric), count(*), max(g::text) +from gs_data_1 group by cube (g1000, g100,g10); + +create table gs_hash_1 as +select g100, g10, sum(g::numeric), count(*), max(g::text) +from gs_data_1 group by cube (g1000, g100,g10); + +set enable_sort = true; +set work_mem to default; + +-- Compare results + +(select * from gs_hash_1 except select * from gs_group_1) + union all +(select * from gs_group_1 except select * from gs_hash_1); + +drop table gs_group_1; +drop table gs_hash_1; + +-- end diff --git a/postgresql/examples/guc.sql b/postgresql/examples/guc.sql new file mode 100644 index 0000000..43dbba3 --- /dev/null +++ b/postgresql/examples/guc.sql @@ -0,0 +1,298 @@ +-- pg_regress should ensure that this default value applies; however +-- we can't rely on any specific default value of vacuum_cost_delay +SHOW datestyle; + +-- SET to some nondefault value +SET vacuum_cost_delay TO 40; +SET datestyle = 'ISO, YMD'; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- SET LOCAL has no effect outside of a transaction +SET LOCAL vacuum_cost_delay TO 50; +SHOW vacuum_cost_delay; +SET LOCAL datestyle = 'SQL'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- SET LOCAL within a transaction that commits +BEGIN; +SET LOCAL vacuum_cost_delay TO 50; +SHOW vacuum_cost_delay; +SET LOCAL datestyle = 'SQL'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +COMMIT; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- SET should be reverted after ROLLBACK +BEGIN; +SET vacuum_cost_delay TO 60; +SHOW vacuum_cost_delay; +SET datestyle = 'German'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +ROLLBACK; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- Some tests with subtransactions +BEGIN; +SET vacuum_cost_delay TO 70; +SET datestyle = 'MDY'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +SAVEPOINT first_sp; +SET vacuum_cost_delay TO 80.1; +SHOW vacuum_cost_delay; +SET datestyle = 'German, DMY'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +ROLLBACK TO first_sp; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +SAVEPOINT second_sp; +SET vacuum_cost_delay TO '900us'; +SET datestyle = 'SQL, YMD'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +SAVEPOINT third_sp; +SET vacuum_cost_delay TO 100; +SHOW vacuum_cost_delay; +SET datestyle = 'Postgres, MDY'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +ROLLBACK TO third_sp; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +ROLLBACK TO second_sp; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +ROLLBACK; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- SET LOCAL with Savepoints +BEGIN; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +SAVEPOINT sp; +SET LOCAL vacuum_cost_delay TO 30; +SHOW vacuum_cost_delay; +SET LOCAL datestyle = 'Postgres, MDY'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +ROLLBACK TO sp; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +ROLLBACK; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- SET LOCAL persists through RELEASE (which was not true in 8.0-8.2) +BEGIN; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +SAVEPOINT sp; +SET LOCAL vacuum_cost_delay TO 30; +SHOW vacuum_cost_delay; +SET LOCAL datestyle = 'Postgres, MDY'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +RELEASE SAVEPOINT sp; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +ROLLBACK; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- SET followed by SET LOCAL +BEGIN; +SET vacuum_cost_delay TO 40; +SET LOCAL vacuum_cost_delay TO 50; +SHOW vacuum_cost_delay; +SET datestyle = 'ISO, DMY'; +SET LOCAL datestyle = 'Postgres, MDY'; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +COMMIT; +SHOW vacuum_cost_delay; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- +-- Test RESET. We use datestyle because the reset value is forced by +-- pg_regress, so it doesn't depend on the installation's configuration. +-- +SET datestyle = iso, ymd; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; +RESET datestyle; +SHOW datestyle; +SELECT '2006-08-13 12:34:56'::timestamptz; + +-- Test some simple error cases +SET seq_page_cost TO 'NaN'; +SET vacuum_cost_delay TO '10s'; + +-- +-- Test DISCARD TEMP +-- +CREATE TEMP TABLE reset_test ( data text ) ON COMMIT DELETE ROWS; +SELECT relname FROM pg_class WHERE relname = 'reset_test'; +DISCARD TEMP; +SELECT relname FROM pg_class WHERE relname = 'reset_test'; + +-- +-- Test DISCARD ALL +-- + +-- do changes +DECLARE foo CURSOR WITH HOLD FOR SELECT 1; +PREPARE foo AS SELECT 1; +LISTEN foo_event; +SET vacuum_cost_delay = 13; +CREATE TEMP TABLE tmp_foo (data text) ON COMMIT DELETE ROWS; +CREATE ROLE regress_guc_user; +SET SESSION AUTHORIZATION regress_guc_user; +-- look changes +SELECT pg_listening_channels(); +SELECT name FROM pg_prepared_statements; +SELECT name FROM pg_cursors; +SHOW vacuum_cost_delay; +SELECT relname from pg_class where relname = 'tmp_foo'; +SELECT current_user = 'regress_guc_user'; +-- discard everything +DISCARD ALL; +-- look again +SELECT pg_listening_channels(); +SELECT name FROM pg_prepared_statements; +SELECT name FROM pg_cursors; +SHOW vacuum_cost_delay; +SELECT relname from pg_class where relname = 'tmp_foo'; +SELECT current_user = 'regress_guc_user'; +DROP ROLE regress_guc_user; + +-- +-- search_path should react to changes in pg_namespace +-- + +set search_path = foo, public, not_there_initially; +select current_schemas(false); +create schema not_there_initially; +select current_schemas(false); +drop schema not_there_initially; +select current_schemas(false); +reset search_path; + +-- +-- Tests for function-local GUC settings +-- + +set work_mem = '3MB'; + +create function report_guc(text) returns text as +$$ select current_setting($1) $$ language sql +set work_mem = '1MB'; + +select report_guc('work_mem'), current_setting('work_mem'); + +alter function report_guc(text) set work_mem = '2MB'; + +select report_guc('work_mem'), current_setting('work_mem'); + +alter function report_guc(text) reset all; + +select report_guc('work_mem'), current_setting('work_mem'); + +-- SET LOCAL is restricted by a function SET option +create or replace function myfunc(int) returns text as $$ +begin + set local work_mem = '2MB'; + return current_setting('work_mem'); +end $$ +language plpgsql +set work_mem = '1MB'; + +select myfunc(0), current_setting('work_mem'); + +alter function myfunc(int) reset all; + +select myfunc(0), current_setting('work_mem'); + +set work_mem = '3MB'; + +-- but SET isn't +create or replace function myfunc(int) returns text as $$ +begin + set work_mem = '2MB'; + return current_setting('work_mem'); +end $$ +language plpgsql +set work_mem = '1MB'; + +select myfunc(0), current_setting('work_mem'); + +set work_mem = '3MB'; + +-- it should roll back on error, though +create or replace function myfunc(int) returns text as $$ +begin + set work_mem = '2MB'; + perform 1/$1; + return current_setting('work_mem'); +end $$ +language plpgsql +set work_mem = '1MB'; + +select myfunc(0); +select current_setting('work_mem'); +select myfunc(1), current_setting('work_mem'); + +-- check current_setting()'s behavior with invalid setting name + +select current_setting('nosuch.setting'); -- FAIL +select current_setting('nosuch.setting', false); -- FAIL +select current_setting('nosuch.setting', true) is null; + +-- after this, all three cases should yield 'nada' +set nosuch.setting = 'nada'; + +select current_setting('nosuch.setting'); +select current_setting('nosuch.setting', false); +select current_setting('nosuch.setting', true); + +-- Normally, CREATE FUNCTION should complain about invalid values in +-- function SET options; but not if check_function_bodies is off, +-- because that creates ordering hazards for pg_dump + +create function func_with_bad_set() returns int as $$ select 1 $$ +language sql +set default_text_search_config = no_such_config; + +set check_function_bodies = off; + +create function func_with_bad_set() returns int as $$ select 1 $$ +language sql +set default_text_search_config = no_such_config; + +select func_with_bad_set(); + +reset check_function_bodies; + +set default_with_oids to f; +-- Should not allow to set it to true. +set default_with_oids to t; diff --git a/postgresql/examples/hash_func.sql b/postgresql/examples/hash_func.sql new file mode 100644 index 0000000..b7ce8b2 --- /dev/null +++ b/postgresql/examples/hash_func.sql @@ -0,0 +1,222 @@ +-- +-- Test hash functions +-- +-- When the salt is 0, the extended hash function should produce a result +-- whose low 32 bits match the standard hash function. When the salt is +-- not 0, we should get a different result. +-- + +SELECT v as value, hashint2(v)::bit(32) as standard, + hashint2extended(v, 0)::bit(32) as extended0, + hashint2extended(v, 1)::bit(32) as extended1 +FROM (VALUES (0::int2), (1::int2), (17::int2), (42::int2)) x(v) +WHERE hashint2(v)::bit(32) != hashint2extended(v, 0)::bit(32) + OR hashint2(v)::bit(32) = hashint2extended(v, 1)::bit(32); + +SELECT v as value, hashint4(v)::bit(32) as standard, + hashint4extended(v, 0)::bit(32) as extended0, + hashint4extended(v, 1)::bit(32) as extended1 +FROM (VALUES (0), (1), (17), (42), (550273), (207112489)) x(v) +WHERE hashint4(v)::bit(32) != hashint4extended(v, 0)::bit(32) + OR hashint4(v)::bit(32) = hashint4extended(v, 1)::bit(32); + +SELECT v as value, hashint8(v)::bit(32) as standard, + hashint8extended(v, 0)::bit(32) as extended0, + hashint8extended(v, 1)::bit(32) as extended1 +FROM (VALUES (0), (1), (17), (42), (550273), (207112489)) x(v) +WHERE hashint8(v)::bit(32) != hashint8extended(v, 0)::bit(32) + OR hashint8(v)::bit(32) = hashint8extended(v, 1)::bit(32); + +SELECT v as value, hashfloat4(v)::bit(32) as standard, + hashfloat4extended(v, 0)::bit(32) as extended0, + hashfloat4extended(v, 1)::bit(32) as extended1 +FROM (VALUES (0), (1), (17), (42), (550273), (207112489)) x(v) +WHERE hashfloat4(v)::bit(32) != hashfloat4extended(v, 0)::bit(32) + OR hashfloat4(v)::bit(32) = hashfloat4extended(v, 1)::bit(32); + +SELECT v as value, hashfloat8(v)::bit(32) as standard, + hashfloat8extended(v, 0)::bit(32) as extended0, + hashfloat8extended(v, 1)::bit(32) as extended1 +FROM (VALUES (0), (1), (17), (42), (550273), (207112489)) x(v) +WHERE hashfloat8(v)::bit(32) != hashfloat8extended(v, 0)::bit(32) + OR hashfloat8(v)::bit(32) = hashfloat8extended(v, 1)::bit(32); + +SELECT v as value, hashoid(v)::bit(32) as standard, + hashoidextended(v, 0)::bit(32) as extended0, + hashoidextended(v, 1)::bit(32) as extended1 +FROM (VALUES (0), (1), (17), (42), (550273), (207112489)) x(v) +WHERE hashoid(v)::bit(32) != hashoidextended(v, 0)::bit(32) + OR hashoid(v)::bit(32) = hashoidextended(v, 1)::bit(32); + +SELECT v as value, hashchar(v)::bit(32) as standard, + hashcharextended(v, 0)::bit(32) as extended0, + hashcharextended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::"char"), ('1'), ('x'), ('X'), ('p'), ('N')) x(v) +WHERE hashchar(v)::bit(32) != hashcharextended(v, 0)::bit(32) + OR hashchar(v)::bit(32) = hashcharextended(v, 1)::bit(32); + +SELECT v as value, hashname(v)::bit(32) as standard, + hashnameextended(v, 0)::bit(32) as extended0, + hashnameextended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL), ('PostgreSQL'), ('eIpUEtqmY89'), ('AXKEJBTK'), + ('muop28x03'), ('yi3nm0d73')) x(v) +WHERE hashname(v)::bit(32) != hashnameextended(v, 0)::bit(32) + OR hashname(v)::bit(32) = hashnameextended(v, 1)::bit(32); + +SELECT v as value, hashtext(v)::bit(32) as standard, + hashtextextended(v, 0)::bit(32) as extended0, + hashtextextended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL), ('PostgreSQL'), ('eIpUEtqmY89'), ('AXKEJBTK'), + ('muop28x03'), ('yi3nm0d73')) x(v) +WHERE hashtext(v)::bit(32) != hashtextextended(v, 0)::bit(32) + OR hashtext(v)::bit(32) = hashtextextended(v, 1)::bit(32); + +SELECT v as value, hashoidvector(v)::bit(32) as standard, + hashoidvectorextended(v, 0)::bit(32) as extended0, + hashoidvectorextended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::oidvector), ('0 1 2 3 4'), ('17 18 19 20'), + ('42 43 42 45'), ('550273 550273 570274'), + ('207112489 207112499 21512 2155 372325 1363252')) x(v) +WHERE hashoidvector(v)::bit(32) != hashoidvectorextended(v, 0)::bit(32) + OR hashoidvector(v)::bit(32) = hashoidvectorextended(v, 1)::bit(32); + +SELECT v as value, hash_aclitem(v)::bit(32) as standard, + hash_aclitem_extended(v, 0)::bit(32) as extended0, + hash_aclitem_extended(v, 1)::bit(32) as extended1 +FROM (SELECT DISTINCT(relacl[1]) FROM pg_class LIMIT 10) x(v) +WHERE hash_aclitem(v)::bit(32) != hash_aclitem_extended(v, 0)::bit(32) + OR hash_aclitem(v)::bit(32) = hash_aclitem_extended(v, 1)::bit(32); + +SELECT v as value, hashmacaddr(v)::bit(32) as standard, + hashmacaddrextended(v, 0)::bit(32) as extended0, + hashmacaddrextended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::macaddr), ('08:00:2b:01:02:04'), ('08:00:2b:01:02:04'), + ('e2:7f:51:3e:70:49'), ('d6:a9:4a:78:1c:d5'), + ('ea:29:b1:5e:1f:a5')) x(v) +WHERE hashmacaddr(v)::bit(32) != hashmacaddrextended(v, 0)::bit(32) + OR hashmacaddr(v)::bit(32) = hashmacaddrextended(v, 1)::bit(32); + +SELECT v as value, hashinet(v)::bit(32) as standard, + hashinetextended(v, 0)::bit(32) as extended0, + hashinetextended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::inet), ('192.168.100.128/25'), ('192.168.100.0/8'), + ('172.168.10.126/16'), ('172.18.103.126/24'), ('192.188.13.16/32')) x(v) +WHERE hashinet(v)::bit(32) != hashinetextended(v, 0)::bit(32) + OR hashinet(v)::bit(32) = hashinetextended(v, 1)::bit(32); + +SELECT v as value, hash_numeric(v)::bit(32) as standard, + hash_numeric_extended(v, 0)::bit(32) as extended0, + hash_numeric_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (0), (1.149484958), (17.149484958), (42.149484958), + (149484958.550273), (2071124898672)) x(v) +WHERE hash_numeric(v)::bit(32) != hash_numeric_extended(v, 0)::bit(32) + OR hash_numeric(v)::bit(32) = hash_numeric_extended(v, 1)::bit(32); + +SELECT v as value, hashmacaddr8(v)::bit(32) as standard, + hashmacaddr8extended(v, 0)::bit(32) as extended0, + hashmacaddr8extended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::macaddr8), ('08:00:2b:01:02:04:36:49'), + ('08:00:2b:01:02:04:f0:e8'), ('e2:7f:51:3e:70:49:16:29'), + ('d6:a9:4a:78:1c:d5:47:32'), ('ea:29:b1:5e:1f:a5')) x(v) +WHERE hashmacaddr8(v)::bit(32) != hashmacaddr8extended(v, 0)::bit(32) + OR hashmacaddr8(v)::bit(32) = hashmacaddr8extended(v, 1)::bit(32); + +SELECT v as value, hash_array(v)::bit(32) as standard, + hash_array_extended(v, 0)::bit(32) as extended0, + hash_array_extended(v, 1)::bit(32) as extended1 +FROM (VALUES ('{0}'::int4[]), ('{0,1,2,3,4}'), ('{17,18,19,20}'), + ('{42,34,65,98}'), ('{550273,590027, 870273}'), + ('{207112489, 807112489}')) x(v) +WHERE hash_array(v)::bit(32) != hash_array_extended(v, 0)::bit(32) + OR hash_array(v)::bit(32) = hash_array_extended(v, 1)::bit(32); + +SELECT v as value, hashbpchar(v)::bit(32) as standard, + hashbpcharextended(v, 0)::bit(32) as extended0, + hashbpcharextended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL), ('PostgreSQL'), ('eIpUEtqmY89'), ('AXKEJBTK'), + ('muop28x03'), ('yi3nm0d73')) x(v) +WHERE hashbpchar(v)::bit(32) != hashbpcharextended(v, 0)::bit(32) + OR hashbpchar(v)::bit(32) = hashbpcharextended(v, 1)::bit(32); + +SELECT v as value, time_hash(v)::bit(32) as standard, + time_hash_extended(v, 0)::bit(32) as extended0, + time_hash_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::time), ('11:09:59'), ('1:09:59'), ('11:59:59'), + ('7:9:59'), ('5:15:59')) x(v) +WHERE time_hash(v)::bit(32) != time_hash_extended(v, 0)::bit(32) + OR time_hash(v)::bit(32) = time_hash_extended(v, 1)::bit(32); + +SELECT v as value, timetz_hash(v)::bit(32) as standard, + timetz_hash_extended(v, 0)::bit(32) as extended0, + timetz_hash_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::timetz), ('00:11:52.518762-07'), ('00:11:52.51762-08'), + ('00:11:52.62-01'), ('00:11:52.62+01'), ('11:59:59+04')) x(v) +WHERE timetz_hash(v)::bit(32) != timetz_hash_extended(v, 0)::bit(32) + OR timetz_hash(v)::bit(32) = timetz_hash_extended(v, 1)::bit(32); + +SELECT v as value, interval_hash(v)::bit(32) as standard, + interval_hash_extended(v, 0)::bit(32) as extended0, + interval_hash_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::interval), + ('5 month 7 day 46 minutes'), ('1 year 7 day 46 minutes'), + ('1 year 7 month 20 day 46 minutes'), ('5 month'), + ('17 year 11 month 7 day 9 hours 46 minutes 5 seconds')) x(v) +WHERE interval_hash(v)::bit(32) != interval_hash_extended(v, 0)::bit(32) + OR interval_hash(v)::bit(32) = interval_hash_extended(v, 1)::bit(32); + +SELECT v as value, timestamp_hash(v)::bit(32) as standard, + timestamp_hash_extended(v, 0)::bit(32) as extended0, + timestamp_hash_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::timestamp), ('2017-08-22 00:09:59.518762'), + ('2015-08-20 00:11:52.51762-08'), + ('2017-05-22 00:11:52.62-01'), + ('2013-08-22 00:11:52.62+01'), ('2013-08-22 11:59:59+04')) x(v) +WHERE timestamp_hash(v)::bit(32) != timestamp_hash_extended(v, 0)::bit(32) + OR timestamp_hash(v)::bit(32) = timestamp_hash_extended(v, 1)::bit(32); + +SELECT v as value, uuid_hash(v)::bit(32) as standard, + uuid_hash_extended(v, 0)::bit(32) as extended0, + uuid_hash_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::uuid), ('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'), + ('5a9ba4ac-8d6f-11e7-bb31-be2e44b06b34'), + ('99c6705c-d939-461c-a3c9-1690ad64ed7b'), + ('7deed3ca-8d6f-11e7-bb31-be2e44b06b34'), + ('9ad46d4f-6f2a-4edd-aadb-745993928e1e')) x(v) +WHERE uuid_hash(v)::bit(32) != uuid_hash_extended(v, 0)::bit(32) + OR uuid_hash(v)::bit(32) = uuid_hash_extended(v, 1)::bit(32); + +SELECT v as value, pg_lsn_hash(v)::bit(32) as standard, + pg_lsn_hash_extended(v, 0)::bit(32) as extended0, + pg_lsn_hash_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::pg_lsn), ('16/B374D84'), ('30/B374D84'), + ('255/B374D84'), ('25/B379D90'), ('900/F37FD90')) x(v) +WHERE pg_lsn_hash(v)::bit(32) != pg_lsn_hash_extended(v, 0)::bit(32) + OR pg_lsn_hash(v)::bit(32) = pg_lsn_hash_extended(v, 1)::bit(32); + +CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy'); +SELECT v as value, hashenum(v)::bit(32) as standard, + hashenumextended(v, 0)::bit(32) as extended0, + hashenumextended(v, 1)::bit(32) as extended1 +FROM (VALUES ('sad'::mood), ('ok'), ('happy')) x(v) +WHERE hashenum(v)::bit(32) != hashenumextended(v, 0)::bit(32) + OR hashenum(v)::bit(32) = hashenumextended(v, 1)::bit(32); +DROP TYPE mood; + +SELECT v as value, jsonb_hash(v)::bit(32) as standard, + jsonb_hash_extended(v, 0)::bit(32) as extended0, + jsonb_hash_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (NULL::jsonb), + ('{"a": "aaa bbb ddd ccc", "b": ["eee fff ggg"], "c": {"d": "hhh iii"}}'), + ('{"foo": [true, "bar"], "tags": {"e": 1, "f": null}}'), + ('{"g": {"h": "value"}}')) x(v) +WHERE jsonb_hash(v)::bit(32) != jsonb_hash_extended(v, 0)::bit(32) + OR jsonb_hash(v)::bit(32) = jsonb_hash_extended(v, 1)::bit(32); + +SELECT v as value, hash_range(v)::bit(32) as standard, + hash_range_extended(v, 0)::bit(32) as extended0, + hash_range_extended(v, 1)::bit(32) as extended1 +FROM (VALUES (int4range(10, 20)), (int4range(23, 43)), + (int4range(5675, 550273)), + (int4range(550274, 1550274)), (int4range(1550275, 208112489))) x(v) +WHERE hash_range(v)::bit(32) != hash_range_extended(v, 0)::bit(32) + OR hash_range(v)::bit(32) = hash_range_extended(v, 1)::bit(32); diff --git a/postgresql/examples/hash_index.sql b/postgresql/examples/hash_index.sql new file mode 100644 index 0000000..4d1aa02 --- /dev/null +++ b/postgresql/examples/hash_index.sql @@ -0,0 +1,204 @@ +-- +-- HASH_INDEX +-- grep 843938989 hash.data +-- + +SELECT * FROM hash_i4_heap + WHERE hash_i4_heap.random = 843938989; + +-- +-- hash index +-- grep 66766766 hash.data +-- +SELECT * FROM hash_i4_heap + WHERE hash_i4_heap.random = 66766766; + +-- +-- hash index +-- grep 1505703298 hash.data +-- +SELECT * FROM hash_name_heap + WHERE hash_name_heap.random = '1505703298'::name; + +-- +-- hash index +-- grep 7777777 hash.data +-- +SELECT * FROM hash_name_heap + WHERE hash_name_heap.random = '7777777'::name; + +-- +-- hash index +-- grep 1351610853 hash.data +-- +SELECT * FROM hash_txt_heap + WHERE hash_txt_heap.random = '1351610853'::text; + +-- +-- hash index +-- grep 111111112222222233333333 hash.data +-- +SELECT * FROM hash_txt_heap + WHERE hash_txt_heap.random = '111111112222222233333333'::text; + +-- +-- hash index +-- grep 444705537 hash.data +-- +SELECT * FROM hash_f8_heap + WHERE hash_f8_heap.random = '444705537'::float8; + +-- +-- hash index +-- grep 88888888 hash.data +-- +SELECT * FROM hash_f8_heap + WHERE hash_f8_heap.random = '88888888'::float8; + +-- +-- hash index +-- grep '^90[^0-9]' hashovfl.data +-- +-- SELECT count(*) AS i988 FROM hash_ovfl_heap +-- WHERE x = 90; + +-- +-- hash index +-- grep '^1000[^0-9]' hashovfl.data +-- +-- SELECT count(*) AS i0 FROM hash_ovfl_heap +-- WHERE x = 1000; + +-- +-- HASH +-- +UPDATE hash_i4_heap + SET random = 1 + WHERE hash_i4_heap.seqno = 1492; + +SELECT h.seqno AS i1492, h.random AS i1 + FROM hash_i4_heap h + WHERE h.random = 1; + +UPDATE hash_i4_heap + SET seqno = 20000 + WHERE hash_i4_heap.random = 1492795354; + +SELECT h.seqno AS i20000 + FROM hash_i4_heap h + WHERE h.random = 1492795354; + +UPDATE hash_name_heap + SET random = '0123456789abcdef'::name + WHERE hash_name_heap.seqno = 6543; + +SELECT h.seqno AS i6543, h.random AS c0_to_f + FROM hash_name_heap h + WHERE h.random = '0123456789abcdef'::name; + +UPDATE hash_name_heap + SET seqno = 20000 + WHERE hash_name_heap.random = '76652222'::name; + +-- +-- this is the row we just replaced; index scan should return zero rows +-- +SELECT h.seqno AS emptyset + FROM hash_name_heap h + WHERE h.random = '76652222'::name; + +UPDATE hash_txt_heap + SET random = '0123456789abcdefghijklmnop'::text + WHERE hash_txt_heap.seqno = 4002; + +SELECT h.seqno AS i4002, h.random AS c0_to_p + FROM hash_txt_heap h + WHERE h.random = '0123456789abcdefghijklmnop'::text; + +UPDATE hash_txt_heap + SET seqno = 20000 + WHERE hash_txt_heap.random = '959363399'::text; + +SELECT h.seqno AS t20000 + FROM hash_txt_heap h + WHERE h.random = '959363399'::text; + +UPDATE hash_f8_heap + SET random = '-1234.1234'::float8 + WHERE hash_f8_heap.seqno = 8906; + +SELECT h.seqno AS i8096, h.random AS f1234_1234 + FROM hash_f8_heap h + WHERE h.random = '-1234.1234'::float8; + +UPDATE hash_f8_heap + SET seqno = 20000 + WHERE hash_f8_heap.random = '488912369'::float8; + +SELECT h.seqno AS f20000 + FROM hash_f8_heap h + WHERE h.random = '488912369'::float8; + +-- UPDATE hash_ovfl_heap +-- SET x = 1000 +-- WHERE x = 90; + +-- this vacuums the index as well +-- VACUUM hash_ovfl_heap; + +-- SELECT count(*) AS i0 FROM hash_ovfl_heap +-- WHERE x = 90; + +-- SELECT count(*) AS i988 FROM hash_ovfl_heap +-- WHERE x = 1000; + +-- +-- Cause some overflow insert and splits. +-- +CREATE TABLE hash_split_heap (keycol INT); +INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 500) a; +CREATE INDEX hash_split_index on hash_split_heap USING HASH (keycol); +INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 5000) a; + +-- Let's do a backward scan. +BEGIN; +SET enable_seqscan = OFF; +SET enable_bitmapscan = OFF; + +DECLARE c CURSOR FOR SELECT * from hash_split_heap WHERE keycol = 1; +MOVE FORWARD ALL FROM c; +MOVE BACKWARD 10000 FROM c; +MOVE BACKWARD ALL FROM c; +CLOSE c; +END; + +-- DELETE, INSERT, VACUUM. +DELETE FROM hash_split_heap WHERE keycol = 1; +INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 25000) a; + +VACUUM hash_split_heap; + +-- Rebuild the index using a different fillfactor +ALTER INDEX hash_split_index SET (fillfactor = 10); +REINDEX INDEX hash_split_index; + +-- Clean up. +DROP TABLE hash_split_heap; + +-- Index on temp table. +CREATE TEMP TABLE hash_temp_heap (x int, y int); +INSERT INTO hash_temp_heap VALUES (1,1); +CREATE INDEX hash_idx ON hash_temp_heap USING hash (x); +DROP TABLE hash_temp_heap CASCADE; + +-- Float4 type. +CREATE TABLE hash_heap_float4 (x float4, y int); +INSERT INTO hash_heap_float4 VALUES (1.1,1); +CREATE INDEX hash_idx ON hash_heap_float4 USING hash (x); +DROP TABLE hash_heap_float4 CASCADE; + +-- Test out-of-range fillfactor values +CREATE INDEX hash_f8_index2 ON hash_f8_heap USING hash (random float8_ops) + WITH (fillfactor=9); +CREATE INDEX hash_f8_index2 ON hash_f8_heap USING hash (random float8_ops) + WITH (fillfactor=101); diff --git a/postgresql/examples/hash_part.sql b/postgresql/examples/hash_part.sql new file mode 100644 index 0000000..e7eb365 --- /dev/null +++ b/postgresql/examples/hash_part.sql @@ -0,0 +1,90 @@ +-- +-- Hash partitioning. +-- + +-- Use hand-rolled hash functions and operator classes to get predictable +-- result on different machines. See the definitions of +-- part_part_test_int4_ops and part_test_text_ops in insert.sql. + +CREATE TABLE mchash (a int, b text, c jsonb) + PARTITION BY HASH (a part_test_int4_ops, b part_test_text_ops); +CREATE TABLE mchash1 + PARTITION OF mchash FOR VALUES WITH (MODULUS 4, REMAINDER 0); + +-- invalid OID, no such table +SELECT satisfies_hash_partition(0, 4, 0, NULL); + +-- not partitioned +SELECT satisfies_hash_partition('tenk1'::regclass, 4, 0, NULL); + +-- partition rather than the parent +SELECT satisfies_hash_partition('mchash1'::regclass, 4, 0, NULL); + +-- invalid modulus +SELECT satisfies_hash_partition('mchash'::regclass, 0, 0, NULL); + +-- remainder too small +SELECT satisfies_hash_partition('mchash'::regclass, 1, -1, NULL); + +-- remainder too large +SELECT satisfies_hash_partition('mchash'::regclass, 1, 1, NULL); + +-- modulus is null +SELECT satisfies_hash_partition('mchash'::regclass, NULL, 0, NULL); + +-- remainder is null +SELECT satisfies_hash_partition('mchash'::regclass, 4, NULL, NULL); + +-- too many arguments +SELECT satisfies_hash_partition('mchash'::regclass, 4, 0, NULL::int, NULL::text, NULL::json); + +-- too few arguments +SELECT satisfies_hash_partition('mchash'::regclass, 3, 1, NULL::int); + +-- wrong argument type +SELECT satisfies_hash_partition('mchash'::regclass, 2, 1, NULL::int, NULL::int); + +-- ok, should be false +SELECT satisfies_hash_partition('mchash'::regclass, 4, 0, 0, ''::text); + +-- ok, should be true +SELECT satisfies_hash_partition('mchash'::regclass, 4, 0, 2, ''::text); + +-- argument via variadic syntax, should fail because not all partitioning +-- columns are of the correct type +SELECT satisfies_hash_partition('mchash'::regclass, 2, 1, + variadic array[1,2]::int[]); + +-- multiple partitioning columns of the same type +CREATE TABLE mcinthash (a int, b int, c jsonb) + PARTITION BY HASH (a part_test_int4_ops, b part_test_int4_ops); + +-- now variadic should work, should be false +SELECT satisfies_hash_partition('mcinthash'::regclass, 4, 0, + variadic array[0, 0]); + +-- should be true +SELECT satisfies_hash_partition('mcinthash'::regclass, 4, 0, + variadic array[0, 1]); + +-- wrong length +SELECT satisfies_hash_partition('mcinthash'::regclass, 4, 0, + variadic array[]::int[]); + +-- wrong type +SELECT satisfies_hash_partition('mcinthash'::regclass, 4, 0, + variadic array[now(), now()]); + +-- check satisfies_hash_partition passes correct collation +create table text_hashp (a text) partition by hash (a); +create table text_hashp0 partition of text_hashp for values with (modulus 2, remainder 0); +create table text_hashp1 partition of text_hashp for values with (modulus 2, remainder 1); +-- The result here should always be true, because 'xxx' must belong to +-- one of the two defined partitions +select satisfies_hash_partition('text_hashp'::regclass, 2, 0, 'xxx'::text) OR + satisfies_hash_partition('text_hashp'::regclass, 2, 1, 'xxx'::text) AS satisfies; + +-- cleanup +DROP TABLE mchash; +DROP TABLE mcinthash; +DROP TABLE text_hashp; diff --git a/postgresql/examples/horology.sql b/postgresql/examples/horology.sql new file mode 100644 index 0000000..c464e67 --- /dev/null +++ b/postgresql/examples/horology.sql @@ -0,0 +1,531 @@ +-- +-- HOROLOGY +-- +SET DateStyle = 'Postgres, MDY'; + +-- +-- Test various input formats +-- +SELECT timestamp with time zone '20011227 040506+08'; +SELECT timestamp with time zone '20011227 040506-08'; +SELECT timestamp with time zone '20011227 040506.789+08'; +SELECT timestamp with time zone '20011227 040506.789-08'; +SELECT timestamp with time zone '20011227T040506+08'; +SELECT timestamp with time zone '20011227T040506-08'; +SELECT timestamp with time zone '20011227T040506.789+08'; +SELECT timestamp with time zone '20011227T040506.789-08'; +SELECT timestamp with time zone '2001-12-27 04:05:06.789-08'; +SELECT timestamp with time zone '2001.12.27 04:05:06.789-08'; +SELECT timestamp with time zone '2001/12/27 04:05:06.789-08'; +SELECT timestamp with time zone '12/27/2001 04:05:06.789-08'; +-- should fail in mdy mode: +SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'; +set datestyle to dmy; +SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'; +reset datestyle; +SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789+08'; +SELECT timestamp with time zone 'Y2001M12D27H04M05S06.789-08'; +SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789+08'; +SELECT timestamp with time zone 'Y2001M12D27H04MM05S06.789-08'; +SELECT timestamp with time zone 'J2452271+08'; +SELECT timestamp with time zone 'J2452271-08'; +SELECT timestamp with time zone 'J2452271.5+08'; +SELECT timestamp with time zone 'J2452271.5-08'; +SELECT timestamp with time zone 'J2452271 04:05:06+08'; +SELECT timestamp with time zone 'J2452271 04:05:06-08'; +SELECT timestamp with time zone 'J2452271T040506+08'; +SELECT timestamp with time zone 'J2452271T040506-08'; +SELECT timestamp with time zone 'J2452271T040506.789+08'; +SELECT timestamp with time zone 'J2452271T040506.789-08'; +-- German/European-style dates with periods as delimiters +SELECT timestamp with time zone '12.27.2001 04:05:06.789+08'; +SELECT timestamp with time zone '12.27.2001 04:05:06.789-08'; +SET DateStyle = 'German'; +SELECT timestamp with time zone '27.12.2001 04:05:06.789+08'; +SELECT timestamp with time zone '27.12.2001 04:05:06.789-08'; +SET DateStyle = 'ISO'; +-- As of 7.4, allow time without time zone having a time zone specified +SELECT time without time zone '040506.789+08'; +SELECT time without time zone '040506.789-08'; +SELECT time without time zone 'T040506.789+08'; +SELECT time without time zone 'T040506.789-08'; +SELECT time with time zone '040506.789+08'; +SELECT time with time zone '040506.789-08'; +SELECT time with time zone 'T040506.789+08'; +SELECT time with time zone 'T040506.789-08'; +SELECT time with time zone 'T040506.789 +08'; +SELECT time with time zone 'T040506.789 -08'; +SET DateStyle = 'Postgres, MDY'; +-- Check Julian dates BC +SELECT date 'J1520447' AS "Confucius' Birthday"; +SELECT date 'J0' AS "Julian Epoch"; + +-- +-- date, time arithmetic +-- + +SELECT date '1981-02-03' + time '04:05:06' AS "Date + Time"; +SELECT date '1991-02-03' + time with time zone '04:05:06 PST' AS "Date + Time PST"; +SELECT date '2001-02-03' + time with time zone '04:05:06 UTC' AS "Date + Time UTC"; +SELECT date '1991-02-03' + interval '2 years' AS "Add Two Years"; +SELECT date '2001-12-13' - interval '2 years' AS "Subtract Two Years"; +-- subtract time from date should not make sense; use interval instead +SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time"; +SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC"; + +-- +-- timestamp, interval arithmetic +-- + +SELECT timestamp without time zone '1996-03-01' - interval '1 second' AS "Feb 29"; +SELECT timestamp without time zone '1999-03-01' - interval '1 second' AS "Feb 28"; +SELECT timestamp without time zone '2000-03-01' - interval '1 second' AS "Feb 29"; +SELECT timestamp without time zone '1999-12-01' + interval '1 month - 1 second' AS "Dec 31"; +SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '106000000 days' AS "Feb 23, 285506"; +SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '107000000 days' AS "Jan 20, 288244"; +SELECT timestamp without time zone 'Jan 1, 4713 BC' + interval '109203489 days' AS "Dec 31, 294276"; +SELECT timestamp without time zone '12/31/294276' - timestamp without time zone '12/23/1999' AS "106751991 Days"; + +-- Shorthand values +-- Not directly usable for regression testing since these are not constants. +-- So, just try to test parser and hope for the best - thomas 97/04/26 +SELECT (timestamp without time zone 'today' = (timestamp without time zone 'yesterday' + interval '1 day')) as "True"; +SELECT (timestamp without time zone 'today' = (timestamp without time zone 'tomorrow' - interval '1 day')) as "True"; +SELECT (timestamp without time zone 'today 10:30' = (timestamp without time zone 'yesterday' + interval '1 day 10 hr 30 min')) as "True"; +SELECT (timestamp without time zone '10:30 today' = (timestamp without time zone 'yesterday' + interval '1 day 10 hr 30 min')) as "True"; +SELECT (timestamp without time zone 'tomorrow' = (timestamp without time zone 'yesterday' + interval '2 days')) as "True"; +SELECT (timestamp without time zone 'tomorrow 16:00:00' = (timestamp without time zone 'today' + interval '1 day 16 hours')) as "True"; +SELECT (timestamp without time zone '16:00:00 tomorrow' = (timestamp without time zone 'today' + interval '1 day 16 hours')) as "True"; +SELECT (timestamp without time zone 'yesterday 12:34:56' = (timestamp without time zone 'tomorrow' - interval '2 days - 12:34:56')) as "True"; +SELECT (timestamp without time zone '12:34:56 yesterday' = (timestamp without time zone 'tomorrow' - interval '2 days - 12:34:56')) as "True"; +SELECT (timestamp without time zone 'tomorrow' > 'now') as "True"; + +-- Convert from date and time to timestamp +-- This test used to be timestamp(date,time) but no longer allowed by grammar +-- to enable support for SQL99 timestamp type syntax. +SELECT date '1994-01-01' + time '11:00' AS "Jan_01_1994_11am"; +SELECT date '1994-01-01' + time '10:00' AS "Jan_01_1994_10am"; +SELECT date '1994-01-01' + timetz '11:00-5' AS "Jan_01_1994_8am"; +SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am"; + +SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL; +SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL; + +SELECT timestamp with time zone '1996-03-01' - interval '1 second' AS "Feb 29"; +SELECT timestamp with time zone '1999-03-01' - interval '1 second' AS "Feb 28"; +SELECT timestamp with time zone '2000-03-01' - interval '1 second' AS "Feb 29"; +SELECT timestamp with time zone '1999-12-01' + interval '1 month - 1 second' AS "Dec 31"; + +SELECT (timestamp with time zone 'today' = (timestamp with time zone 'yesterday' + interval '1 day')) as "True"; +SELECT (timestamp with time zone 'today' = (timestamp with time zone 'tomorrow' - interval '1 day')) as "True"; +SELECT (timestamp with time zone 'tomorrow' = (timestamp with time zone 'yesterday' + interval '2 days')) as "True"; +SELECT (timestamp with time zone 'tomorrow' > 'now') as "True"; + +-- timestamp with time zone, interval arithmetic around DST change +-- (just for fun, let's use an intentionally nonstandard POSIX zone spec) +SET TIME ZONE 'CST7CDT,M4.1.0,M10.5.0'; +SELECT timestamp with time zone '2005-04-02 12:00-07' + interval '1 day' as "Apr 3, 12:00"; +SELECT timestamp with time zone '2005-04-02 12:00-07' + interval '24 hours' as "Apr 3, 13:00"; +SELECT timestamp with time zone '2005-04-03 12:00-06' - interval '1 day' as "Apr 2, 12:00"; +SELECT timestamp with time zone '2005-04-03 12:00-06' - interval '24 hours' as "Apr 2, 11:00"; +RESET TIME ZONE; + + +SELECT timestamptz(date '1994-01-01', time '11:00') AS "Jan_01_1994_10am"; +SELECT timestamptz(date '1994-01-01', time '10:00') AS "Jan_01_1994_9am"; +SELECT timestamptz(date '1994-01-01', time with time zone '11:00-8') AS "Jan_01_1994_11am"; +SELECT timestamptz(date '1994-01-01', time with time zone '10:00-8') AS "Jan_01_1994_10am"; +SELECT timestamptz(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am"; + +SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; +SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL; + +-- +-- time, interval arithmetic +-- + +SELECT CAST(time '01:02' AS interval) AS "+01:02"; +SELECT CAST(interval '02:03' AS time) AS "02:03:00"; +SELECT time '01:30' + interval '02:01' AS "03:31:00"; +SELECT time '01:30' - interval '02:01' AS "23:29:00"; +SELECT time '02:30' + interval '36:01' AS "14:31:00"; +SELECT time '03:30' + interval '1 month 04:01' AS "07:31:00"; +SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01"; +SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08"; +SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08"; +SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08"; + +-- These two tests cannot be used because they default to current timezone, +-- which may be either -08 or -07 depending on the time of year. +-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08"; +-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08"; +-- Try the following two tests instead, as a poor substitute + +SELECT CAST(CAST(date 'today' + time with time zone '05:30' + + interval '02:01' AS time with time zone) AS time) AS "07:31:00"; + +SELECT CAST(cast(date 'today' + time with time zone '03:30' + + interval '1 month 04:01' as timestamp without time zone) AS time) AS "07:31:00"; + +SELECT t.d1 AS t, i.f1 AS i, t.d1 + i.f1 AS "add", t.d1 - i.f1 AS "subtract" + FROM TIMESTAMP_TBL t, INTERVAL_TBL i + WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01' + AND i.f1 BETWEEN '00:00' AND '23:00' + ORDER BY 1,2; + +SELECT t.f1 AS t, i.f1 AS i, t.f1 + i.f1 AS "add", t.f1 - i.f1 AS "subtract" + FROM TIME_TBL t, INTERVAL_TBL i + ORDER BY 1,2; + +SELECT t.f1 AS t, i.f1 AS i, t.f1 + i.f1 AS "add", t.f1 - i.f1 AS "subtract" + FROM TIMETZ_TBL t, INTERVAL_TBL i + ORDER BY 1,2; + +-- SQL9x OVERLAPS operator +-- test with time zone +SELECT (timestamp with time zone '2000-11-27', timestamp with time zone '2000-11-28') + OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "True"; + +SELECT (timestamp with time zone '2000-11-26', timestamp with time zone '2000-11-27') + OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "False"; + +SELECT (timestamp with time zone '2000-11-27', timestamp with time zone '2000-11-28') + OVERLAPS (timestamp with time zone '2000-11-27 12:00', interval '1 day') AS "True"; + +SELECT (timestamp with time zone '2000-11-27', interval '12 hours') + OVERLAPS (timestamp with time zone '2000-11-27 12:00', timestamp with time zone '2000-11-30') AS "False"; + +SELECT (timestamp with time zone '2000-11-27', interval '12 hours') + OVERLAPS (timestamp with time zone '2000-11-27', interval '12 hours') AS "True"; + +SELECT (timestamp with time zone '2000-11-27', interval '12 hours') + OVERLAPS (timestamp with time zone '2000-11-27 12:00', interval '12 hours') AS "False"; + +-- test without time zone +SELECT (timestamp without time zone '2000-11-27', timestamp without time zone '2000-11-28') + OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "True"; + +SELECT (timestamp without time zone '2000-11-26', timestamp without time zone '2000-11-27') + OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "False"; + +SELECT (timestamp without time zone '2000-11-27', timestamp without time zone '2000-11-28') + OVERLAPS (timestamp without time zone '2000-11-27 12:00', interval '1 day') AS "True"; + +SELECT (timestamp without time zone '2000-11-27', interval '12 hours') + OVERLAPS (timestamp without time zone '2000-11-27 12:00', timestamp without time zone '2000-11-30') AS "False"; + +SELECT (timestamp without time zone '2000-11-27', interval '12 hours') + OVERLAPS (timestamp without time zone '2000-11-27', interval '12 hours') AS "True"; + +SELECT (timestamp without time zone '2000-11-27', interval '12 hours') + OVERLAPS (timestamp without time zone '2000-11-27 12:00', interval '12 hours') AS "False"; + +-- test time and interval +SELECT (time '00:00', time '01:00') + OVERLAPS (time '00:30', time '01:30') AS "True"; + +SELECT (time '00:00', interval '1 hour') + OVERLAPS (time '00:30', interval '1 hour') AS "True"; + +SELECT (time '00:00', interval '1 hour') + OVERLAPS (time '01:30', interval '1 hour') AS "False"; + +-- SQL99 seems to want this to be false (and we conform to the spec). +-- istm that this *should* return true, on the theory that time +-- intervals can wrap around the day boundary - thomas 2001-09-25 +SELECT (time '00:00', interval '1 hour') + OVERLAPS (time '01:30', interval '1 day') AS "False"; + +CREATE TABLE TEMP_TIMESTAMP (f1 timestamp with time zone); + +-- get some candidate input values + +INSERT INTO TEMP_TIMESTAMP (f1) + SELECT d1 FROM TIMESTAMP_TBL + WHERE d1 BETWEEN '13-jun-1957' AND '1-jan-1997' + OR d1 BETWEEN '1-jan-1999' AND '1-jan-2010'; + +SELECT '' AS "16", f1 AS "timestamp" + FROM TEMP_TIMESTAMP + ORDER BY "timestamp"; + +SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 + t.f1 AS plus + FROM TEMP_TIMESTAMP d, INTERVAL_TBL t + ORDER BY plus, "timestamp", "interval"; + +SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 - t.f1 AS minus + FROM TEMP_TIMESTAMP d, INTERVAL_TBL t + WHERE isfinite(d.f1) + ORDER BY minus, "timestamp", "interval"; + +SELECT '' AS "16", d.f1 AS "timestamp", + timestamp with time zone '1980-01-06 00:00 GMT' AS gpstime_zero, + d.f1 - timestamp with time zone '1980-01-06 00:00 GMT' AS difference + FROM TEMP_TIMESTAMP d + ORDER BY difference; + +SELECT '' AS "226", d1.f1 AS timestamp1, d2.f1 AS timestamp2, d1.f1 - d2.f1 AS difference + FROM TEMP_TIMESTAMP d1, TEMP_TIMESTAMP d2 + ORDER BY timestamp1, timestamp2, difference; + +-- +-- Conversions +-- + +SELECT '' AS "16", f1 AS "timestamp", date(f1) AS date + FROM TEMP_TIMESTAMP + WHERE f1 <> timestamp 'now' + ORDER BY date, "timestamp"; + +DROP TABLE TEMP_TIMESTAMP; + +-- +-- Formats +-- + +SET DateStyle TO 'US,Postgres'; + +SHOW DateStyle; + +SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL; + +SET DateStyle TO 'US,ISO'; + +SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL; + +SET DateStyle TO 'US,SQL'; + +SHOW DateStyle; + +SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL; + +SET DateStyle TO 'European,Postgres'; + +SHOW DateStyle; + +INSERT INTO TIMESTAMP_TBL VALUES('13/06/1957'); + +SELECT count(*) as one FROM TIMESTAMP_TBL WHERE d1 = 'Jun 13 1957'; + +SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL; + +SET DateStyle TO 'European,ISO'; + +SHOW DateStyle; + +SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL; + +SET DateStyle TO 'European,SQL'; + +SHOW DateStyle; + +SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL; + +RESET DateStyle; + +-- +-- to_timestamp() +-- + +SELECT to_timestamp('0097/Feb/16 --> 08:14:30', 'YYYY/Mon/DD --> HH:MI:SS'); + +SELECT to_timestamp('97/2/16 8:14:30', 'FMYYYY/FMMM/FMDD FMHH:FMMI:FMSS'); + +SELECT to_timestamp('2011$03!18 23_38_15', 'YYYY-MM-DD HH24:MI:SS'); + +SELECT to_timestamp('1985 January 12', 'YYYY FMMonth DD'); + +SELECT to_timestamp('1985 FMMonth 12', 'YYYY "FMMonth" DD'); + +SELECT to_timestamp('1985 \ 12', 'YYYY \\ DD'); + +SELECT to_timestamp('My birthday-> Year: 1976, Month: May, Day: 16', + '"My birthday-> Year:" YYYY, "Month:" FMMonth, "Day:" DD'); + +SELECT to_timestamp('1,582nd VIII 21', 'Y,YYYth FMRM DD'); + +SELECT to_timestamp('15 "text between quote marks" 98 54 45', + E'HH24 "\\"text between quote marks\\"" YY MI SS'); + +SELECT to_timestamp('05121445482000', 'MMDDHH24MISSYYYY'); + +SELECT to_timestamp('2000January09Sunday', 'YYYYFMMonthDDFMDay'); + +SELECT to_timestamp('97/Feb/16', 'YYMonDD'); + +SELECT to_timestamp('97/Feb/16', 'YY:Mon:DD'); + +SELECT to_timestamp('97/Feb/16', 'FXYY:Mon:DD'); + +SELECT to_timestamp('97/Feb/16', 'FXYY/Mon/DD'); + +SELECT to_timestamp('19971116', 'YYYYMMDD'); + +SELECT to_timestamp('20000-1116', 'YYYY-MMDD'); + +SELECT to_timestamp('1997 AD 11 16', 'YYYY BC MM DD'); +SELECT to_timestamp('1997 BC 11 16', 'YYYY BC MM DD'); + +SELECT to_timestamp('1997 A.D. 11 16', 'YYYY B.C. MM DD'); +SELECT to_timestamp('1997 B.C. 11 16', 'YYYY B.C. MM DD'); + +SELECT to_timestamp('9-1116', 'Y-MMDD'); + +SELECT to_timestamp('95-1116', 'YY-MMDD'); + +SELECT to_timestamp('995-1116', 'YYY-MMDD'); + +SELECT to_timestamp('2005426', 'YYYYWWD'); + +SELECT to_timestamp('2005300', 'YYYYDDD'); + +SELECT to_timestamp('2005527', 'IYYYIWID'); + +SELECT to_timestamp('005527', 'IYYIWID'); + +SELECT to_timestamp('05527', 'IYIWID'); + +SELECT to_timestamp('5527', 'IIWID'); + +SELECT to_timestamp('2005364', 'IYYYIDDD'); + +SELECT to_timestamp('20050302', 'YYYYMMDD'); + +SELECT to_timestamp('2005 03 02', 'YYYYMMDD'); + +SELECT to_timestamp(' 2005 03 02', 'YYYYMMDD'); + +SELECT to_timestamp(' 20050302', 'YYYYMMDD'); + +SELECT to_timestamp('2011-12-18 11:38 AM', 'YYYY-MM-DD HH12:MI PM'); +SELECT to_timestamp('2011-12-18 11:38 PM', 'YYYY-MM-DD HH12:MI PM'); + +SELECT to_timestamp('2011-12-18 11:38 A.M.', 'YYYY-MM-DD HH12:MI P.M.'); +SELECT to_timestamp('2011-12-18 11:38 P.M.', 'YYYY-MM-DD HH12:MI P.M.'); + +SELECT to_timestamp('2011-12-18 11:38 +05', 'YYYY-MM-DD HH12:MI TZH'); +SELECT to_timestamp('2011-12-18 11:38 -05', 'YYYY-MM-DD HH12:MI TZH'); +SELECT to_timestamp('2011-12-18 11:38 +05:20', 'YYYY-MM-DD HH12:MI TZH:TZM'); +SELECT to_timestamp('2011-12-18 11:38 -05:20', 'YYYY-MM-DD HH12:MI TZH:TZM'); +SELECT to_timestamp('2011-12-18 11:38 20', 'YYYY-MM-DD HH12:MI TZM'); + +SELECT to_timestamp('2011-12-18 11:38 PST', 'YYYY-MM-DD HH12:MI TZ'); -- NYI + +SELECT to_timestamp('2018-11-02 12:34:56.025', 'YYYY-MM-DD HH24:MI:SS.MS'); + +SELECT i, to_timestamp('2018-11-02 12:34:56', 'YYYY-MM-DD HH24:MI:SS.FF' || i) FROM generate_series(1, 6) i; +SELECT i, to_timestamp('2018-11-02 12:34:56.1', 'YYYY-MM-DD HH24:MI:SS.FF' || i) FROM generate_series(1, 6) i; +SELECT i, to_timestamp('2018-11-02 12:34:56.12', 'YYYY-MM-DD HH24:MI:SS.FF' || i) FROM generate_series(1, 6) i; +SELECT i, to_timestamp('2018-11-02 12:34:56.123', 'YYYY-MM-DD HH24:MI:SS.FF' || i) FROM generate_series(1, 6) i; +SELECT i, to_timestamp('2018-11-02 12:34:56.1234', 'YYYY-MM-DD HH24:MI:SS.FF' || i) FROM generate_series(1, 6) i; +SELECT i, to_timestamp('2018-11-02 12:34:56.12345', 'YYYY-MM-DD HH24:MI:SS.FF' || i) FROM generate_series(1, 6) i; +SELECT i, to_timestamp('2018-11-02 12:34:56.123456', 'YYYY-MM-DD HH24:MI:SS.FF' || i) FROM generate_series(1, 6) i; +SELECT i, to_timestamp('2018-11-02 12:34:56.123456789', 'YYYY-MM-DD HH24:MI:SS.FF' || i) FROM generate_series(1, 6) i; + +SELECT to_date('1 4 1902', 'Q MM YYYY'); -- Q is ignored +SELECT to_date('3 4 21 01', 'W MM CC YY'); +SELECT to_date('2458872', 'J'); + +-- +-- Check handling of multiple spaces in format and/or input +-- + +SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS'); + +SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2011-12-18 23:38:15', 'YYYY-MM-DD HH24:MI:SS'); + +SELECT to_timestamp('2000+ JUN', 'YYYY/MON'); +SELECT to_timestamp(' 2000 +JUN', 'YYYY/MON'); +SELECT to_timestamp(' 2000 +JUN', 'YYYY//MON'); +SELECT to_timestamp('2000 +JUN', 'YYYY//MON'); +SELECT to_timestamp('2000 + JUN', 'YYYY MON'); +SELECT to_timestamp('2000 ++ JUN', 'YYYY MON'); +SELECT to_timestamp('2000 + + JUN', 'YYYY MON'); +SELECT to_timestamp('2000 + + JUN', 'YYYY MON'); +SELECT to_timestamp('2000 -10', 'YYYY TZH'); +SELECT to_timestamp('2000 -10', 'YYYY TZH'); + +SELECT to_date('2011 12 18', 'YYYY MM DD'); +SELECT to_date('2011 12 18', 'YYYY MM DD'); +SELECT to_date('2011 12 18', 'YYYY MM DD'); + +SELECT to_date('2011 12 18', 'YYYY MM DD'); +SELECT to_date('2011 12 18', 'YYYY MM DD'); +SELECT to_date('2011 12 18', 'YYYY MM DD'); + +SELECT to_date('2011 12 18', 'YYYYxMMxDD'); +SELECT to_date('2011x 12x 18', 'YYYYxMMxDD'); +SELECT to_date('2011 x12 x18', 'YYYYxMMxDD'); + +-- +-- Check errors for some incorrect usages of to_timestamp() and to_date() +-- + +-- Mixture of date conventions (ISO week and Gregorian): +SELECT to_timestamp('2005527', 'YYYYIWID'); + +-- Insufficient characters in the source string: +SELECT to_timestamp('19971', 'YYYYMMDD'); + +-- Insufficient digit characters for a single node: +SELECT to_timestamp('19971)24', 'YYYYMMDD'); + +-- We don't accept full-length day or month names if short form is specified: +SELECT to_timestamp('Friday 1-January-1999', 'DY DD MON YYYY'); +SELECT to_timestamp('Fri 1-January-1999', 'DY DD MON YYYY'); +SELECT to_timestamp('Fri 1-Jan-1999', 'DY DD MON YYYY'); -- ok + +-- Value clobbering: +SELECT to_timestamp('1997-11-Jan-16', 'YYYY-MM-Mon-DD'); + +-- Non-numeric input: +SELECT to_timestamp('199711xy', 'YYYYMMDD'); + +-- Input that doesn't fit in an int: +SELECT to_timestamp('10000000000', 'FMYYYY'); + +-- Out-of-range and not-quite-out-of-range fields: +SELECT to_timestamp('2016-06-13 25:00:00', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2016-06-13 15:60:00', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2016-06-13 15:50:60', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2016-06-13 15:50:55', 'YYYY-MM-DD HH24:MI:SS'); -- ok +SELECT to_timestamp('2016-06-13 15:50:55', 'YYYY-MM-DD HH:MI:SS'); +SELECT to_timestamp('2016-13-01 15:50:55', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2016-02-30 15:50:55', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2016-02-29 15:50:55', 'YYYY-MM-DD HH24:MI:SS'); -- ok +SELECT to_timestamp('2015-02-29 15:50:55', 'YYYY-MM-DD HH24:MI:SS'); +SELECT to_timestamp('2015-02-11 86000', 'YYYY-MM-DD SSSS'); -- ok +SELECT to_timestamp('2015-02-11 86400', 'YYYY-MM-DD SSSS'); +SELECT to_timestamp('2015-02-11 86000', 'YYYY-MM-DD SSSSS'); -- ok +SELECT to_timestamp('2015-02-11 86400', 'YYYY-MM-DD SSSSS'); +SELECT to_date('2016-13-10', 'YYYY-MM-DD'); +SELECT to_date('2016-02-30', 'YYYY-MM-DD'); +SELECT to_date('2016-02-29', 'YYYY-MM-DD'); -- ok +SELECT to_date('2015-02-29', 'YYYY-MM-DD'); +SELECT to_date('2015 365', 'YYYY DDD'); -- ok +SELECT to_date('2015 366', 'YYYY DDD'); +SELECT to_date('2016 365', 'YYYY DDD'); -- ok +SELECT to_date('2016 366', 'YYYY DDD'); -- ok +SELECT to_date('2016 367', 'YYYY DDD'); + +-- +-- Check behavior with SQL-style fixed-GMT-offset time zone (cf bug #8572) +-- + +SET TIME ZONE 'America/New_York'; +SET TIME ZONE '-1.5'; + +SHOW TIME ZONE; + +SELECT '2012-12-12 12:00'::timestamptz; +SELECT '2012-12-12 12:00 America/New_York'::timestamptz; + +SELECT to_char('2012-12-12 12:00'::timestamptz, 'YYYY-MM-DD HH:MI:SS TZ'); +SELECT to_char('2012-12-12 12:00'::timestamptz, 'YYYY-MM-DD SSSS'); +SELECT to_char('2012-12-12 12:00'::timestamptz, 'YYYY-MM-DD SSSSS'); + +RESET TIME ZONE; diff --git a/postgresql/examples/hs_primary_extremes.sql b/postgresql/examples/hs_primary_extremes.sql new file mode 100644 index 0000000..2051e2e --- /dev/null +++ b/postgresql/examples/hs_primary_extremes.sql @@ -0,0 +1,73 @@ +-- +-- Hot Standby tests +-- +-- hs_primary_extremes.sql +-- + +drop table if exists hs_extreme; +create table hs_extreme (col1 integer); + +CREATE OR REPLACE FUNCTION hs_subxids (n integer) +RETURNS void +LANGUAGE plpgsql +AS $$ + BEGIN + IF n <= 0 THEN RETURN; END IF; + INSERT INTO hs_extreme VALUES (n); + PERFORM hs_subxids(n - 1); + RETURN; + EXCEPTION WHEN raise_exception THEN NULL; END; +$$; + +BEGIN; +SELECT hs_subxids(257); +ROLLBACK; +BEGIN; +SELECT hs_subxids(257); +COMMIT; + +set client_min_messages = 'warning'; + +CREATE OR REPLACE FUNCTION hs_locks_create (n integer) +RETURNS void +LANGUAGE plpgsql +AS $$ + BEGIN + IF n <= 0 THEN + CHECKPOINT; + RETURN; + END IF; + EXECUTE 'CREATE TABLE hs_locks_' || n::text || ' ()'; + PERFORM hs_locks_create(n - 1); + RETURN; + EXCEPTION WHEN raise_exception THEN NULL; END; +$$; + +CREATE OR REPLACE FUNCTION hs_locks_drop (n integer) +RETURNS void +LANGUAGE plpgsql +AS $$ + BEGIN + IF n <= 0 THEN + CHECKPOINT; + RETURN; + END IF; + EXECUTE 'DROP TABLE IF EXISTS hs_locks_' || n::text; + PERFORM hs_locks_drop(n - 1); + RETURN; + EXCEPTION WHEN raise_exception THEN NULL; END; +$$; + +BEGIN; +SELECT hs_locks_drop(257); +SELECT hs_locks_create(257); +SELECT count(*) > 257 FROM pg_locks; +ROLLBACK; +BEGIN; +SELECT hs_locks_drop(257); +SELECT hs_locks_create(257); +SELECT count(*) > 257 FROM pg_locks; +COMMIT; +SELECT hs_locks_drop(257); + +SELECT pg_switch_wal(); diff --git a/postgresql/examples/hs_primary_setup.sql b/postgresql/examples/hs_primary_setup.sql new file mode 100644 index 0000000..eeb4421 --- /dev/null +++ b/postgresql/examples/hs_primary_setup.sql @@ -0,0 +1,25 @@ +-- +-- Hot Standby tests +-- +-- hs_primary_setup.sql +-- + +drop table if exists hs1; +create table hs1 (col1 integer primary key); +insert into hs1 values (1); + +drop table if exists hs2; +create table hs2 (col1 integer primary key); +insert into hs2 values (12); +insert into hs2 values (13); + +drop table if exists hs3; +create table hs3 (col1 integer primary key); +insert into hs3 values (113); +insert into hs3 values (114); +insert into hs3 values (115); + +DROP sequence if exists hsseq; +create sequence hsseq; + +SELECT pg_switch_wal(); diff --git a/postgresql/examples/hs_standby_allowed.sql b/postgresql/examples/hs_standby_allowed.sql new file mode 100644 index 0000000..6debddc --- /dev/null +++ b/postgresql/examples/hs_standby_allowed.sql @@ -0,0 +1,125 @@ +-- +-- Hot Standby tests +-- +-- hs_standby_allowed.sql +-- + +-- SELECT + +select count(*) as should_be_1 from hs1; + +select count(*) as should_be_2 from hs2; + +select count(*) as should_be_3 from hs3; + +COPY hs1 TO '/tmp/copy_test'; +\! cat /tmp/copy_test + +-- Access sequence directly +select is_called from hsseq; + +-- Transactions + +begin; +select count(*) as should_be_1 from hs1; +end; + +begin transaction read only; +select count(*) as should_be_1 from hs1; +end; + +begin transaction isolation level repeatable read; +select count(*) as should_be_1 from hs1; +select count(*) as should_be_1 from hs1; +select count(*) as should_be_1 from hs1; +commit; + +begin; +select count(*) as should_be_1 from hs1; +commit; + +begin; +select count(*) as should_be_1 from hs1; +abort; + +start transaction; +select count(*) as should_be_1 from hs1; +commit; + +begin; +select count(*) as should_be_1 from hs1; +rollback; + +begin; +select count(*) as should_be_1 from hs1; +savepoint s; +select count(*) as should_be_2 from hs2; +commit; + +begin; +select count(*) as should_be_1 from hs1; +savepoint s; +select count(*) as should_be_2 from hs2; +release savepoint s; +select count(*) as should_be_2 from hs2; +savepoint s; +select count(*) as should_be_3 from hs3; +rollback to savepoint s; +select count(*) as should_be_2 from hs2; +commit; + +-- SET parameters + +-- has no effect on read only transactions, but we can still set it +set synchronous_commit = on; +show synchronous_commit; +reset synchronous_commit; + +discard temp; +discard all; + +-- CURSOR commands + +BEGIN; + +DECLARE hsc CURSOR FOR select * from hs3; + +FETCH next from hsc; +fetch first from hsc; +fetch last from hsc; +fetch 1 from hsc; + +CLOSE hsc; + +COMMIT; + +-- Prepared plans + +PREPARE hsp AS select count(*) from hs1; +PREPARE hsp_noexec (integer) AS insert into hs1 values ($1); + +EXECUTE hsp; + +DEALLOCATE hsp; + +-- LOCK + +BEGIN; +LOCK hs1 IN ACCESS SHARE MODE; +LOCK hs1 IN ROW SHARE MODE; +LOCK hs1 IN ROW EXCLUSIVE MODE; +COMMIT; + +-- UNLISTEN +UNLISTEN a; +UNLISTEN *; + +-- LOAD +-- should work, easier if there is no test for that... + + +-- ALLOWED COMMANDS + +CHECKPOINT; + +discard all; diff --git a/postgresql/examples/hs_standby_check.sql b/postgresql/examples/hs_standby_check.sql new file mode 100644 index 0000000..3fe8a02 --- /dev/null +++ b/postgresql/examples/hs_standby_check.sql @@ -0,0 +1,16 @@ +-- +-- Hot Standby tests +-- +-- hs_standby_check.sql +-- + +-- +-- If the query below returns false then all other tests will fail after it. +-- +select case pg_is_in_recovery() when false then + 'These tests are intended only for execution on a standby server that is reading ' || + 'WAL from a server upon which the regression database is already created and into ' || + 'which src/test/regress/sql/hs_primary_setup.sql has been run' +else + 'Tests are running on a standby server during recovery' +end; diff --git a/postgresql/examples/hs_standby_disallowed.sql b/postgresql/examples/hs_standby_disallowed.sql new file mode 100644 index 0000000..a470600 --- /dev/null +++ b/postgresql/examples/hs_standby_disallowed.sql @@ -0,0 +1,103 @@ +-- +-- Hot Standby tests +-- +-- hs_standby_disallowed.sql +-- + +SET transaction_read_only = off; + +begin transaction read write; +commit; + +-- SELECT + +select * from hs1 FOR SHARE; +select * from hs1 FOR UPDATE; + +-- DML +BEGIN; +insert into hs1 values (37); +ROLLBACK; +BEGIN; +delete from hs1 where col1 = 1; +ROLLBACK; +BEGIN; +update hs1 set col1 = NULL where col1 > 0; +ROLLBACK; +BEGIN; +truncate hs3; +ROLLBACK; + +-- DDL + +create temporary table hstemp1 (col1 integer); +BEGIN; +drop table hs2; +ROLLBACK; +BEGIN; +create table hs4 (col1 integer); +ROLLBACK; + +-- Sequences + +SELECT nextval('hsseq'); + +-- Two-phase commit transaction stuff + +BEGIN; +SELECT count(*) FROM hs1; +PREPARE TRANSACTION 'foobar'; +ROLLBACK; +BEGIN; +SELECT count(*) FROM hs1; +COMMIT PREPARED 'foobar'; +ROLLBACK; + +BEGIN; +SELECT count(*) FROM hs1; +PREPARE TRANSACTION 'foobar'; +ROLLBACK PREPARED 'foobar'; +ROLLBACK; + +BEGIN; +SELECT count(*) FROM hs1; +ROLLBACK PREPARED 'foobar'; +ROLLBACK; + + +-- Locks +BEGIN; +LOCK hs1; +COMMIT; +BEGIN; +LOCK hs1 IN SHARE UPDATE EXCLUSIVE MODE; +COMMIT; +BEGIN; +LOCK hs1 IN SHARE MODE; +COMMIT; +BEGIN; +LOCK hs1 IN SHARE ROW EXCLUSIVE MODE; +COMMIT; +BEGIN; +LOCK hs1 IN EXCLUSIVE MODE; +COMMIT; +BEGIN; +LOCK hs1 IN ACCESS EXCLUSIVE MODE; +COMMIT; + +-- Listen +listen a; +notify a; + +-- disallowed commands + +ANALYZE hs1; + +VACUUM hs2; + +CLUSTER hs2 using hs1_pkey; + +REINDEX TABLE hs2; + +REVOKE SELECT ON hs1 FROM PUBLIC; +GRANT SELECT ON hs1 TO PUBLIC; diff --git a/postgresql/examples/hs_standby_functions.sql b/postgresql/examples/hs_standby_functions.sql new file mode 100644 index 0000000..b57f67f --- /dev/null +++ b/postgresql/examples/hs_standby_functions.sql @@ -0,0 +1,24 @@ +-- +-- Hot Standby tests +-- +-- hs_standby_functions.sql +-- + +-- should fail +select pg_current_xact_id(); + +select length(pg_current_snapshot()::text) >= 4; + +select pg_start_backup('should fail'); +select pg_switch_wal(); +select pg_stop_backup(); + +-- should return no rows +select * from pg_prepared_xacts; + +-- just the startup process +select locktype, virtualxid, virtualtransaction, mode, granted +from pg_locks where virtualxid = '1/1'; + +-- suicide is painless +select pg_cancel_backend(pg_backend_pid()); diff --git a/postgresql/examples/identity.sql b/postgresql/examples/identity.sql new file mode 100644 index 0000000..9f2fe36 --- /dev/null +++ b/postgresql/examples/identity.sql @@ -0,0 +1,319 @@ +-- sanity check of system catalog +SELECT attrelid, attname, attidentity FROM pg_attribute WHERE attidentity NOT IN ('', 'a', 'd'); + + +CREATE TABLE itest1 (a int generated by default as identity, b text); +CREATE TABLE itest2 (a bigint generated always as identity, b text); +CREATE TABLE itest3 (a smallint generated by default as identity (start with 7 increment by 5), b text); +ALTER TABLE itest3 ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY; -- error + +SELECT table_name, column_name, column_default, is_nullable, is_identity, identity_generation, identity_start, identity_increment, identity_maximum, identity_minimum, identity_cycle FROM information_schema.columns WHERE table_name LIKE 'itest_' ORDER BY 1, 2; + +-- internal sequences should not be shown here +SELECT sequence_name FROM information_schema.sequences WHERE sequence_name LIKE 'itest%'; + +SELECT pg_get_serial_sequence('itest1', 'a'); + +\d itest1_a_seq + +CREATE TABLE itest4 (a int, b text); +ALTER TABLE itest4 ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY; -- error, requires NOT NULL +ALTER TABLE itest4 ALTER COLUMN a SET NOT NULL; +ALTER TABLE itest4 ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY; -- ok +ALTER TABLE itest4 ALTER COLUMN a DROP NOT NULL; -- error, disallowed +ALTER TABLE itest4 ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY; -- error, already set +ALTER TABLE itest4 ALTER COLUMN b ADD GENERATED ALWAYS AS IDENTITY; -- error, wrong data type + +-- for later +ALTER TABLE itest4 ALTER COLUMN b SET DEFAULT ''; + +-- invalid column type +CREATE TABLE itest_err_1 (a text generated by default as identity); + +-- duplicate identity +CREATE TABLE itest_err_2 (a int generated always as identity generated by default as identity); + +-- cannot have default and identity +CREATE TABLE itest_err_3 (a int default 5 generated by default as identity); + +-- cannot combine serial and identity +CREATE TABLE itest_err_4 (a serial generated by default as identity); + +INSERT INTO itest1 DEFAULT VALUES; +INSERT INTO itest1 DEFAULT VALUES; +INSERT INTO itest2 DEFAULT VALUES; +INSERT INTO itest2 DEFAULT VALUES; +INSERT INTO itest3 DEFAULT VALUES; +INSERT INTO itest3 DEFAULT VALUES; +INSERT INTO itest4 DEFAULT VALUES; +INSERT INTO itest4 DEFAULT VALUES; + +SELECT * FROM itest1; +SELECT * FROM itest2; +SELECT * FROM itest3; +SELECT * FROM itest4; + + +-- VALUES RTEs + +INSERT INTO itest3 VALUES (DEFAULT, 'a'); +INSERT INTO itest3 VALUES (DEFAULT, 'b'), (DEFAULT, 'c'); + +SELECT * FROM itest3; + + +-- OVERRIDING tests + +-- GENERATED BY DEFAULT + +-- This inserts the row as presented: +INSERT INTO itest1 VALUES (10, 'xyz'); +-- With GENERATED BY DEFAULT, OVERRIDING SYSTEM VALUE is not allowed +-- by the standard, but we allow it as a no-op, since it is of use if +-- there are multiple identity columns in a table, which is also an +-- extension. +INSERT INTO itest1 OVERRIDING SYSTEM VALUE VALUES (20, 'xyz'); +-- This ignores the 30 and uses the sequence value instead: +INSERT INTO itest1 OVERRIDING USER VALUE VALUES (30, 'xyz'); + +SELECT * FROM itest1; + +-- GENERATED ALWAYS + +-- This is an error: +INSERT INTO itest2 VALUES (10, 'xyz'); +-- This inserts the row as presented: +INSERT INTO itest2 OVERRIDING SYSTEM VALUE VALUES (20, 'xyz'); +-- This ignores the 30 and uses the sequence value instead: +INSERT INTO itest2 OVERRIDING USER VALUE VALUES (30, 'xyz'); + +SELECT * FROM itest2; + + +-- UPDATE tests + +-- GENERATED BY DEFAULT is not restricted. +UPDATE itest1 SET a = 101 WHERE a = 1; +UPDATE itest1 SET a = DEFAULT WHERE a = 2; +SELECT * FROM itest1; + +-- GENERATED ALWAYS allows only DEFAULT. +UPDATE itest2 SET a = 101 WHERE a = 1; -- error +UPDATE itest2 SET a = DEFAULT WHERE a = 2; -- ok +SELECT * FROM itest2; + + +-- COPY tests + +CREATE TABLE itest9 (a int GENERATED ALWAYS AS IDENTITY, b text, c bigint); + +COPY itest9 FROM stdin; + +COPY itest9 (b, c) FROM stdin; + +SELECT * FROM itest9 ORDER BY c; + + +-- DROP IDENTITY tests + +ALTER TABLE itest4 ALTER COLUMN a DROP IDENTITY; +ALTER TABLE itest4 ALTER COLUMN a DROP IDENTITY; -- error +ALTER TABLE itest4 ALTER COLUMN a DROP IDENTITY IF EXISTS; -- noop + +INSERT INTO itest4 DEFAULT VALUES; -- fails because NOT NULL is not dropped +ALTER TABLE itest4 ALTER COLUMN a DROP NOT NULL; +INSERT INTO itest4 DEFAULT VALUES; +SELECT * FROM itest4; + +-- check that sequence is removed +SELECT sequence_name FROM itest4_a_seq; + + +-- test views + +CREATE TABLE itest10 (a int generated by default as identity, b text); +CREATE TABLE itest11 (a int generated always as identity, b text); + +CREATE VIEW itestv10 AS SELECT * FROM itest10; +CREATE VIEW itestv11 AS SELECT * FROM itest11; + +INSERT INTO itestv10 DEFAULT VALUES; +INSERT INTO itestv10 DEFAULT VALUES; + +INSERT INTO itestv11 DEFAULT VALUES; +INSERT INTO itestv11 DEFAULT VALUES; + +SELECT * FROM itestv10; +SELECT * FROM itestv11; + +INSERT INTO itestv10 VALUES (10, 'xyz'); +INSERT INTO itestv10 OVERRIDING USER VALUE VALUES (11, 'xyz'); + +SELECT * FROM itestv10; + +INSERT INTO itestv11 VALUES (10, 'xyz'); +INSERT INTO itestv11 OVERRIDING SYSTEM VALUE VALUES (11, 'xyz'); + +SELECT * FROM itestv11; + +DROP VIEW itestv10, itestv11; + + +-- ADD COLUMN + +CREATE TABLE itest13 (a int); +-- add column to empty table +ALTER TABLE itest13 ADD COLUMN b int GENERATED BY DEFAULT AS IDENTITY; +INSERT INTO itest13 VALUES (1), (2), (3); +-- add column to populated table +ALTER TABLE itest13 ADD COLUMN c int GENERATED BY DEFAULT AS IDENTITY; +SELECT * FROM itest13; + + +-- various ALTER COLUMN tests + +-- fail, not allowed for identity columns +ALTER TABLE itest1 ALTER COLUMN a SET DEFAULT 1; + +-- fail, not allowed, already has a default +CREATE TABLE itest5 (a serial, b text); +ALTER TABLE itest5 ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY; + +ALTER TABLE itest3 ALTER COLUMN a TYPE int; +SELECT seqtypid::regtype FROM pg_sequence WHERE seqrelid = 'itest3_a_seq'::regclass; +\d itest3 + +ALTER TABLE itest3 ALTER COLUMN a TYPE text; -- error + +-- kinda silly to change property in the same command, but it should work +ALTER TABLE itest3 + ADD COLUMN c int GENERATED BY DEFAULT AS IDENTITY, + ALTER COLUMN c SET GENERATED ALWAYS; +\d itest3 + + +-- ALTER COLUMN ... SET + +CREATE TABLE itest6 (a int GENERATED ALWAYS AS IDENTITY, b text); +INSERT INTO itest6 DEFAULT VALUES; + +ALTER TABLE itest6 ALTER COLUMN a SET GENERATED BY DEFAULT SET INCREMENT BY 2 SET START WITH 100 RESTART; +INSERT INTO itest6 DEFAULT VALUES; +INSERT INTO itest6 DEFAULT VALUES; +SELECT * FROM itest6; + +SELECT table_name, column_name, is_identity, identity_generation FROM information_schema.columns WHERE table_name = 'itest6'; + +ALTER TABLE itest6 ALTER COLUMN b SET INCREMENT BY 2; -- fail, not identity + + +-- prohibited direct modification of sequence + +ALTER SEQUENCE itest6_a_seq OWNED BY NONE; + + +-- inheritance + +CREATE TABLE itest7 (a int GENERATED ALWAYS AS IDENTITY); +INSERT INTO itest7 DEFAULT VALUES; +SELECT * FROM itest7; + +-- identity property is not inherited +CREATE TABLE itest7a (b text) INHERITS (itest7); + +-- make column identity in child table +CREATE TABLE itest7b (a int); +CREATE TABLE itest7c (a int GENERATED ALWAYS AS IDENTITY) INHERITS (itest7b); +INSERT INTO itest7c DEFAULT VALUES; +SELECT * FROM itest7c; + +CREATE TABLE itest7d (a int not null); +CREATE TABLE itest7e () INHERITS (itest7d); +ALTER TABLE itest7d ALTER COLUMN a ADD GENERATED ALWAYS AS IDENTITY; +ALTER TABLE itest7d ADD COLUMN b int GENERATED ALWAYS AS IDENTITY; -- error + +SELECT table_name, column_name, is_nullable, is_identity, identity_generation FROM information_schema.columns WHERE table_name LIKE 'itest7%' ORDER BY 1, 2; + +-- These ALTER TABLE variants will not recurse. +ALTER TABLE itest7 ALTER COLUMN a SET GENERATED BY DEFAULT; +ALTER TABLE itest7 ALTER COLUMN a RESTART; +ALTER TABLE itest7 ALTER COLUMN a DROP IDENTITY; + +-- privileges +CREATE USER regress_identity_user1; +CREATE TABLE itest8 (a int GENERATED ALWAYS AS IDENTITY, b text); +GRANT SELECT, INSERT ON itest8 TO regress_identity_user1; +SET ROLE regress_identity_user1; +INSERT INTO itest8 DEFAULT VALUES; +SELECT * FROM itest8; +RESET ROLE; +DROP TABLE itest8; +DROP USER regress_identity_user1; + +-- multiple steps in ALTER TABLE +CREATE TABLE itest8 (f1 int); + +ALTER TABLE itest8 + ADD COLUMN f2 int NOT NULL, + ALTER COLUMN f2 ADD GENERATED ALWAYS AS IDENTITY; + +ALTER TABLE itest8 + ADD COLUMN f3 int NOT NULL, + ALTER COLUMN f3 ADD GENERATED ALWAYS AS IDENTITY, + ALTER COLUMN f3 SET GENERATED BY DEFAULT SET INCREMENT 10; + +ALTER TABLE itest8 + ADD COLUMN f4 int; + +ALTER TABLE itest8 + ALTER COLUMN f4 SET NOT NULL, + ALTER COLUMN f4 ADD GENERATED ALWAYS AS IDENTITY, + ALTER COLUMN f4 SET DATA TYPE bigint; + +ALTER TABLE itest8 + ADD COLUMN f5 int GENERATED ALWAYS AS IDENTITY; + +ALTER TABLE itest8 + ALTER COLUMN f5 DROP IDENTITY, + ALTER COLUMN f5 DROP NOT NULL, + ALTER COLUMN f5 SET DATA TYPE bigint; + +INSERT INTO itest8 VALUES(0), (1); + +-- This does not work when the table isn't empty. That's intentional, +-- since ADD GENERATED should only affect later insertions: +ALTER TABLE itest8 + ADD COLUMN f22 int NOT NULL, + ALTER COLUMN f22 ADD GENERATED ALWAYS AS IDENTITY; + +TABLE itest8; +\d+ itest8 +\d itest8_f2_seq +\d itest8_f3_seq +\d itest8_f4_seq +\d itest8_f5_seq +DROP TABLE itest8; + + +-- typed tables (currently not supported) + +CREATE TYPE itest_type AS (f1 integer, f2 text, f3 bigint); +CREATE TABLE itest12 OF itest_type (f1 WITH OPTIONS GENERATED ALWAYS AS IDENTITY); -- error +DROP TYPE itest_type CASCADE; + + +-- table partitions (currently not supported) + +CREATE TABLE itest_parent (f1 date NOT NULL, f2 text, f3 bigint) PARTITION BY RANGE (f1); +CREATE TABLE itest_child PARTITION OF itest_parent ( + f3 WITH OPTIONS GENERATED ALWAYS AS IDENTITY +) FOR VALUES FROM ('2016-07-01') TO ('2016-08-01'); -- error +DROP TABLE itest_parent; + + +-- test that sequence of half-dropped serial column is properly ignored + +CREATE TABLE itest14 (id serial); +ALTER TABLE itest14 ALTER id DROP DEFAULT; +ALTER TABLE itest14 ALTER id ADD GENERATED BY DEFAULT AS IDENTITY; +INSERT INTO itest14 (id) VALUES (DEFAULT); diff --git a/postgresql/examples/incremental_sort.sql b/postgresql/examples/incremental_sort.sql new file mode 100644 index 0000000..9c040c9 --- /dev/null +++ b/postgresql/examples/incremental_sort.sql @@ -0,0 +1,223 @@ +-- When we have to sort the entire table, incremental sort will +-- be slower than plain sort, so it should not be used. +explain (costs off) +select * from (select * from tenk1 order by four) t order by four, ten; + +-- When there is a LIMIT clause, incremental sort is beneficial because +-- it only has to sort some of the groups, and not the entire table. +explain (costs off) +select * from (select * from tenk1 order by four) t order by four, ten +limit 1; + +-- When work_mem is not enough to sort the entire table, incremental sort +-- may be faster if individual groups still fit into work_mem. +set work_mem to '2MB'; +explain (costs off) +select * from (select * from tenk1 order by four) t order by four, ten; +reset work_mem; + +create table t(a integer, b integer); + +create or replace function explain_analyze_without_memory(query text) +returns table (out_line text) language plpgsql +as +$$ +declare + line text; +begin + for line in + execute 'explain (analyze, costs off, summary off, timing off) ' || query + loop + out_line := regexp_replace(line, '\d+kB', 'NNkB', 'g'); + return next; + end loop; +end; +$$; + +create or replace function explain_analyze_inc_sort_nodes(query text) +returns jsonb language plpgsql +as +$$ +declare + elements jsonb; + element jsonb; + matching_nodes jsonb := '[]'::jsonb; +begin + execute 'explain (analyze, costs off, summary off, timing off, format ''json'') ' || query into strict elements; + while jsonb_array_length(elements) > 0 loop + element := elements->0; + elements := elements - 0; + case jsonb_typeof(element) + when 'array' then + if jsonb_array_length(element) > 0 then + elements := elements || element; + end if; + when 'object' then + if element ? 'Plan' then + elements := elements || jsonb_build_array(element->'Plan'); + element := element - 'Plan'; + else + if element ? 'Plans' then + elements := elements || jsonb_build_array(element->'Plans'); + element := element - 'Plans'; + end if; + if (element->>'Node Type')::text = 'Incremental Sort' then + matching_nodes := matching_nodes || element; + end if; + end if; + end case; + end loop; + return matching_nodes; +end; +$$; + +create or replace function explain_analyze_inc_sort_nodes_without_memory(query text) +returns jsonb language plpgsql +as +$$ +declare + nodes jsonb := '[]'::jsonb; + node jsonb; + group_key text; + space_key text; +begin + for node in select * from jsonb_array_elements(explain_analyze_inc_sort_nodes(query)) t loop + for group_key in select unnest(array['Full-sort Groups', 'Pre-sorted Groups']::text[]) t loop + for space_key in select unnest(array['Sort Space Memory', 'Sort Space Disk']::text[]) t loop + node := jsonb_set(node, array[group_key, space_key, 'Average Sort Space Used'], '"NN"', false); + node := jsonb_set(node, array[group_key, space_key, 'Peak Sort Space Used'], '"NN"', false); + end loop; + end loop; + nodes := nodes || node; + end loop; + return nodes; +end; +$$; + +create or replace function explain_analyze_inc_sort_nodes_verify_invariants(query text) +returns bool language plpgsql +as +$$ +declare + node jsonb; + group_stats jsonb; + group_key text; + space_key text; +begin + for node in select * from jsonb_array_elements(explain_analyze_inc_sort_nodes(query)) t loop + for group_key in select unnest(array['Full-sort Groups', 'Pre-sorted Groups']::text[]) t loop + group_stats := node->group_key; + for space_key in select unnest(array['Sort Space Memory', 'Sort Space Disk']::text[]) t loop + if (group_stats->space_key->'Peak Sort Space Used')::bigint < (group_stats->space_key->'Peak Sort Space Used')::bigint then + raise exception '% has invalid max space < average space', group_key; + end if; + end loop; + end loop; + end loop; + return true; +end; +$$; + +-- A single large group tested around each mode transition point. +insert into t(a, b) select i/100 + 1, i + 1 from generate_series(0, 999) n(i); +analyze t; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 31; +select * from (select * from t order by a) s order by a, b limit 31; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 32; +select * from (select * from t order by a) s order by a, b limit 32; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 33; +select * from (select * from t order by a) s order by a, b limit 33; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 65; +select * from (select * from t order by a) s order by a, b limit 65; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 66; +select * from (select * from t order by a) s order by a, b limit 66; +delete from t; + +-- An initial large group followed by a small group. +insert into t(a, b) select i/50 + 1, i + 1 from generate_series(0, 999) n(i); +analyze t; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 55; +select * from (select * from t order by a) s order by a, b limit 55; +-- Test EXPLAIN ANALYZE with only a fullsort group. +select explain_analyze_without_memory('select * from (select * from t order by a) s order by a, b limit 55'); +select jsonb_pretty(explain_analyze_inc_sort_nodes_without_memory('select * from (select * from t order by a) s order by a, b limit 55')); +select explain_analyze_inc_sort_nodes_verify_invariants('select * from (select * from t order by a) s order by a, b limit 55'); +delete from t; + +-- An initial small group followed by a large group. +insert into t(a, b) select (case when i < 5 then i else 9 end), i from generate_series(1, 1000) n(i); +analyze t; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 70; +select * from (select * from t order by a) s order by a, b limit 70; +-- Test rescan. +begin; +-- We force the planner to choose a plan with incremental sort on the right side +-- of a nested loop join node. That way we trigger the rescan code path. +set local enable_hashjoin = off; +set local enable_mergejoin = off; +set local enable_material = off; +set local enable_sort = off; +explain (costs off) select * from t left join (select * from (select * from t order by a) v order by a, b) s on s.a = t.a where t.a in (1, 2); +select * from t left join (select * from (select * from t order by a) v order by a, b) s on s.a = t.a where t.a in (1, 2); +rollback; +-- Test EXPLAIN ANALYZE with both fullsort and presorted groups. +select explain_analyze_without_memory('select * from (select * from t order by a) s order by a, b limit 70'); +select jsonb_pretty(explain_analyze_inc_sort_nodes_without_memory('select * from (select * from t order by a) s order by a, b limit 70')); +select explain_analyze_inc_sort_nodes_verify_invariants('select * from (select * from t order by a) s order by a, b limit 70'); +delete from t; + +-- Small groups of 10 tuples each tested around each mode transition point. +insert into t(a, b) select i / 10, i from generate_series(1, 1000) n(i); +analyze t; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 31; +select * from (select * from t order by a) s order by a, b limit 31; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 32; +select * from (select * from t order by a) s order by a, b limit 32; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 33; +select * from (select * from t order by a) s order by a, b limit 33; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 65; +select * from (select * from t order by a) s order by a, b limit 65; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 66; +select * from (select * from t order by a) s order by a, b limit 66; +delete from t; + +-- Small groups of only 1 tuple each tested around each mode transition point. +insert into t(a, b) select i, i from generate_series(1, 1000) n(i); +analyze t; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 31; +select * from (select * from t order by a) s order by a, b limit 31; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 32; +select * from (select * from t order by a) s order by a, b limit 32; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 33; +select * from (select * from t order by a) s order by a, b limit 33; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 65; +select * from (select * from t order by a) s order by a, b limit 65; +explain (costs off) select * from (select * from t order by a) s order by a, b limit 66; +select * from (select * from t order by a) s order by a, b limit 66; +delete from t; + +drop table t; + +-- Incremental sort vs. parallel queries +set min_parallel_table_scan_size = '1kB'; +set min_parallel_index_scan_size = '1kB'; +set parallel_setup_cost = 0; +set parallel_tuple_cost = 0; +set max_parallel_workers_per_gather = 2; + +create table t (a int, b int, c int); +insert into t select mod(i,10),mod(i,10),i from generate_series(1,10000) s(i); +create index on t (a); +analyze t; + +set enable_incremental_sort = off; +explain (costs off) select a,b,sum(c) from t group by 1,2 order by 1,2,3 limit 1; + +set enable_incremental_sort = on; +explain (costs off) select a,b,sum(c) from t group by 1,2 order by 1,2,3 limit 1; + +-- Incremental sort vs. set operations with varno 0 +set enable_hashagg to off; +explain (costs off) select * from t union select * from t order by 1,3; + +drop table t; diff --git a/postgresql/examples/index_including.sql b/postgresql/examples/index_including.sql new file mode 100644 index 0000000..7e51748 --- /dev/null +++ b/postgresql/examples/index_including.sql @@ -0,0 +1,219 @@ +/* + * 1.test CREATE INDEX + * + * Deliberately avoid dropping objects in this section, to get some pg_dump + * coverage. + */ + +-- Regular index with included columns +CREATE TABLE tbl_include_reg (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_include_reg SELECT x, 2*x, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +CREATE INDEX tbl_include_reg_idx ON tbl_include_reg (c1, c2) INCLUDE (c3, c4); +-- duplicate column is pretty pointless, but we allow it anyway +CREATE INDEX ON tbl_include_reg (c1, c2) INCLUDE (c1, c3); +SELECT pg_get_indexdef(i.indexrelid) +FROM pg_index i JOIN pg_class c ON i.indexrelid = c.oid +WHERE i.indrelid = 'tbl_include_reg'::regclass ORDER BY c.relname; +\d tbl_include_reg_idx + +-- Unique index and unique constraint +CREATE TABLE tbl_include_unique1 (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_include_unique1 SELECT x, 2*x, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +CREATE UNIQUE INDEX tbl_include_unique1_idx_unique ON tbl_include_unique1 using btree (c1, c2) INCLUDE (c3, c4); +ALTER TABLE tbl_include_unique1 add UNIQUE USING INDEX tbl_include_unique1_idx_unique; +ALTER TABLE tbl_include_unique1 add UNIQUE (c1, c2) INCLUDE (c3, c4); +SELECT pg_get_indexdef(i.indexrelid) +FROM pg_index i JOIN pg_class c ON i.indexrelid = c.oid +WHERE i.indrelid = 'tbl_include_unique1'::regclass ORDER BY c.relname; + +-- Unique index and unique constraint. Both must fail. +CREATE TABLE tbl_include_unique2 (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_include_unique2 SELECT 1, 2, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +CREATE UNIQUE INDEX tbl_include_unique2_idx_unique ON tbl_include_unique2 using btree (c1, c2) INCLUDE (c3, c4); +ALTER TABLE tbl_include_unique2 add UNIQUE (c1, c2) INCLUDE (c3, c4); + +-- PK constraint +CREATE TABLE tbl_include_pk (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_include_pk SELECT 1, 2*x, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +ALTER TABLE tbl_include_pk add PRIMARY KEY (c1, c2) INCLUDE (c3, c4); +SELECT pg_get_indexdef(i.indexrelid) +FROM pg_index i JOIN pg_class c ON i.indexrelid = c.oid +WHERE i.indrelid = 'tbl_include_pk'::regclass ORDER BY c.relname; + +CREATE TABLE tbl_include_box (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_include_box SELECT 1, 2*x, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +CREATE UNIQUE INDEX tbl_include_box_idx_unique ON tbl_include_box using btree (c1, c2) INCLUDE (c3, c4); +ALTER TABLE tbl_include_box add PRIMARY KEY USING INDEX tbl_include_box_idx_unique; +SELECT pg_get_indexdef(i.indexrelid) +FROM pg_index i JOIN pg_class c ON i.indexrelid = c.oid +WHERE i.indrelid = 'tbl_include_box'::regclass ORDER BY c.relname; + +-- PK constraint. Must fail. +CREATE TABLE tbl_include_box_pk (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_include_box_pk SELECT 1, 2, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +ALTER TABLE tbl_include_box_pk add PRIMARY KEY (c1, c2) INCLUDE (c3, c4); + + +/* + * 2. Test CREATE TABLE with constraint + */ +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, + CONSTRAINT covering UNIQUE(c1,c2) INCLUDE(c3,c4)); +SELECT indexrelid::regclass, indnatts, indnkeyatts, indisunique, indisprimary, indkey, indclass FROM pg_index WHERE indrelid = 'tbl'::regclass::oid; +SELECT pg_get_constraintdef(oid), conname, conkey FROM pg_constraint WHERE conrelid = 'tbl'::regclass::oid; +-- ensure that constraint works +INSERT INTO tbl SELECT 1, 2, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +DROP TABLE tbl; + +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, + CONSTRAINT covering PRIMARY KEY(c1,c2) INCLUDE(c3,c4)); +SELECT indexrelid::regclass, indnatts, indnkeyatts, indisunique, indisprimary, indkey, indclass FROM pg_index WHERE indrelid = 'tbl'::regclass::oid; +SELECT pg_get_constraintdef(oid), conname, conkey FROM pg_constraint WHERE conrelid = 'tbl'::regclass::oid; +-- ensure that constraint works +INSERT INTO tbl SELECT 1, 2, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +INSERT INTO tbl SELECT 1, NULL, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +INSERT INTO tbl SELECT x, 2*x, NULL, NULL FROM generate_series(1,300) AS x; +explain (costs off) +select * from tbl where (c1,c2,c3) < (2,5,1); +select * from tbl where (c1,c2,c3) < (2,5,1); +-- row comparison that compares high key at page boundary +SET enable_seqscan = off; +explain (costs off) +select * from tbl where (c1,c2,c3) < (262,1,1) limit 1; +select * from tbl where (c1,c2,c3) < (262,1,1) limit 1; +DROP TABLE tbl; +RESET enable_seqscan; + +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, + UNIQUE(c1,c2) INCLUDE(c3,c4)); +SELECT indexrelid::regclass, indnatts, indnkeyatts, indisunique, indisprimary, indkey, indclass FROM pg_index WHERE indrelid = 'tbl'::regclass::oid; +SELECT pg_get_constraintdef(oid), conname, conkey FROM pg_constraint WHERE conrelid = 'tbl'::regclass::oid; +-- ensure that constraint works +INSERT INTO tbl SELECT 1, 2, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +DROP TABLE tbl; + +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, + PRIMARY KEY(c1,c2) INCLUDE(c3,c4)); +SELECT indexrelid::regclass, indnatts, indnkeyatts, indisunique, indisprimary, indkey, indclass FROM pg_index WHERE indrelid = 'tbl'::regclass::oid; +SELECT pg_get_constraintdef(oid), conname, conkey FROM pg_constraint WHERE conrelid = 'tbl'::regclass::oid; +-- ensure that constraint works +INSERT INTO tbl SELECT 1, 2, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +INSERT INTO tbl SELECT 1, NULL, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +INSERT INTO tbl SELECT x, 2*x, NULL, NULL FROM generate_series(1,10) AS x; +DROP TABLE tbl; + +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, + EXCLUDE USING btree (c1 WITH =) INCLUDE(c3,c4)); +SELECT indexrelid::regclass, indnatts, indnkeyatts, indisunique, indisprimary, indkey, indclass FROM pg_index WHERE indrelid = 'tbl'::regclass::oid; +SELECT pg_get_constraintdef(oid), conname, conkey FROM pg_constraint WHERE conrelid = 'tbl'::regclass::oid; +-- ensure that constraint works +INSERT INTO tbl SELECT 1, 2, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +INSERT INTO tbl SELECT x, 2*x, NULL, NULL FROM generate_series(1,10) AS x; +DROP TABLE tbl; + +/* + * 3.0 Test ALTER TABLE DROP COLUMN. + * Any column deletion leads to index deletion. + */ +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 int); +CREATE UNIQUE INDEX tbl_idx ON tbl using btree(c1, c2, c3, c4); +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +ALTER TABLE tbl DROP COLUMN c3; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +DROP TABLE tbl; + +/* + * 3.1 Test ALTER TABLE DROP COLUMN. + * Included column deletion leads to the index deletion, + * AS well AS key columns deletion. It's explained in documentation. + */ +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box); +CREATE UNIQUE INDEX tbl_idx ON tbl using btree(c1, c2) INCLUDE(c3,c4); +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +ALTER TABLE tbl DROP COLUMN c3; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +DROP TABLE tbl; + +/* + * 3.2 Test ALTER TABLE DROP COLUMN. + * Included column deletion leads to the index deletion. + * AS well AS key columns deletion. It's explained in documentation. + */ +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDE(c3,c4)); +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +ALTER TABLE tbl DROP COLUMN c3; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +ALTER TABLE tbl DROP COLUMN c1; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +DROP TABLE tbl; + +/* + * 3.3 Test ALTER TABLE SET STATISTICS + */ +CREATE TABLE tbl (c1 int, c2 int); +CREATE INDEX tbl_idx ON tbl (c1, (c1+0)) INCLUDE (c2); +ALTER INDEX tbl_idx ALTER COLUMN 1 SET STATISTICS 1000; +ALTER INDEX tbl_idx ALTER COLUMN 2 SET STATISTICS 1000; +ALTER INDEX tbl_idx ALTER COLUMN 3 SET STATISTICS 1000; +ALTER INDEX tbl_idx ALTER COLUMN 4 SET STATISTICS 1000; +DROP TABLE tbl; + +/* + * 4. CREATE INDEX CONCURRENTLY + */ +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDE(c3,c4)); +INSERT INTO tbl SELECT x, 2*x, 3*x, box('4,4,4,4') FROM generate_series(1,1000) AS x; +CREATE UNIQUE INDEX CONCURRENTLY on tbl (c1, c2) INCLUDE (c3, c4); +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +DROP TABLE tbl; + + +/* + * 5. REINDEX + */ +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDE(c3,c4)); +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +ALTER TABLE tbl DROP COLUMN c3; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +REINDEX INDEX tbl_c1_c2_c3_c4_key; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +ALTER TABLE tbl DROP COLUMN c1; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl' ORDER BY indexname; +DROP TABLE tbl; + +/* + * 7. Check various AMs. All but btree and gist must fail. + */ +CREATE TABLE tbl (c1 int,c2 int, c3 box, c4 box); +CREATE INDEX on tbl USING brin(c1, c2) INCLUDE (c3, c4); +CREATE INDEX on tbl USING gist(c3) INCLUDE (c1, c4); +CREATE INDEX on tbl USING spgist(c3) INCLUDE (c4); +CREATE INDEX on tbl USING gin(c1, c2) INCLUDE (c3, c4); +CREATE INDEX on tbl USING hash(c1, c2) INCLUDE (c3, c4); +CREATE INDEX on tbl USING rtree(c3) INCLUDE (c1, c4); +CREATE INDEX on tbl USING btree(c1, c2) INCLUDE (c3, c4); +DROP TABLE tbl; + +/* + * 8. Update, delete values in indexed table. + */ +CREATE TABLE tbl (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl SELECT x, 2*x, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +CREATE UNIQUE INDEX tbl_idx_unique ON tbl using btree(c1, c2) INCLUDE (c3,c4); +UPDATE tbl SET c1 = 100 WHERE c1 = 2; +UPDATE tbl SET c1 = 1 WHERE c1 = 3; +-- should fail +UPDATE tbl SET c2 = 2 WHERE c1 = 1; +UPDATE tbl SET c3 = 1; +DELETE FROM tbl WHERE c1 = 5 OR c3 = 12; +DROP TABLE tbl; + +/* + * 9. Alter column type. + */ +CREATE TABLE tbl (c1 int,c2 int, c3 int, c4 box, UNIQUE(c1, c2) INCLUDE(c3,c4)); +INSERT INTO tbl SELECT x, 2*x, 3*x, box('4,4,4,4') FROM generate_series(1,10) AS x; +ALTER TABLE tbl ALTER c1 TYPE bigint; +ALTER TABLE tbl ALTER c3 TYPE bigint; +\d tbl +DROP TABLE tbl; diff --git a/postgresql/examples/index_including_gist.sql b/postgresql/examples/index_including_gist.sql new file mode 100644 index 0000000..7d5c99b --- /dev/null +++ b/postgresql/examples/index_including_gist.sql @@ -0,0 +1,90 @@ +/* + * 1.1. test CREATE INDEX with buffered build + */ + +-- Regular index with included columns +CREATE TABLE tbl_gist (c1 int, c2 int, c3 int, c4 box); +-- size is chosen to exceed page size and trigger actual truncation +INSERT INTO tbl_gist SELECT x, 2*x, 3*x, box(point(x,x+1),point(2*x,2*x+1)) FROM generate_series(1,8000) AS x; +CREATE INDEX tbl_gist_idx ON tbl_gist using gist (c4) INCLUDE (c1,c2,c3); +SELECT pg_get_indexdef(i.indexrelid) +FROM pg_index i JOIN pg_class c ON i.indexrelid = c.oid +WHERE i.indrelid = 'tbl_gist'::regclass ORDER BY c.relname; +SELECT * FROM tbl_gist where c4 <@ box(point(1,1),point(10,10)); +SET enable_bitmapscan TO off; +EXPLAIN (costs off) SELECT * FROM tbl_gist where c4 <@ box(point(1,1),point(10,10)); +SET enable_bitmapscan TO default; +DROP TABLE tbl_gist; + +/* + * 1.2. test CREATE INDEX with inserts + */ + +-- Regular index with included columns +CREATE TABLE tbl_gist (c1 int, c2 int, c3 int, c4 box); +-- size is chosen to exceed page size and trigger actual truncation +CREATE INDEX tbl_gist_idx ON tbl_gist using gist (c4) INCLUDE (c1,c2,c3); +INSERT INTO tbl_gist SELECT x, 2*x, 3*x, box(point(x,x+1),point(2*x,2*x+1)) FROM generate_series(1,8000) AS x; +SELECT pg_get_indexdef(i.indexrelid) +FROM pg_index i JOIN pg_class c ON i.indexrelid = c.oid +WHERE i.indrelid = 'tbl_gist'::regclass ORDER BY c.relname; +SELECT * FROM tbl_gist where c4 <@ box(point(1,1),point(10,10)); +SET enable_bitmapscan TO off; +EXPLAIN (costs off) SELECT * FROM tbl_gist where c4 <@ box(point(1,1),point(10,10)); +SET enable_bitmapscan TO default; +DROP TABLE tbl_gist; + +/* + * 2. CREATE INDEX CONCURRENTLY + */ +CREATE TABLE tbl_gist (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_gist SELECT x, 2*x, 3*x, box(point(x,x+1),point(2*x,2*x+1)) FROM generate_series(1,10) AS x; +CREATE INDEX CONCURRENTLY tbl_gist_idx ON tbl_gist using gist (c4) INCLUDE (c1,c2,c3); +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl_gist' ORDER BY indexname; +DROP TABLE tbl_gist; + + +/* + * 3. REINDEX + */ +CREATE TABLE tbl_gist (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_gist SELECT x, 2*x, 3*x, box(point(x,x+1),point(2*x,2*x+1)) FROM generate_series(1,10) AS x; +CREATE INDEX tbl_gist_idx ON tbl_gist using gist (c4) INCLUDE (c1,c3); +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl_gist' ORDER BY indexname; +REINDEX INDEX tbl_gist_idx; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl_gist' ORDER BY indexname; +ALTER TABLE tbl_gist DROP COLUMN c1; +SELECT indexdef FROM pg_indexes WHERE tablename = 'tbl_gist' ORDER BY indexname; +DROP TABLE tbl_gist; + +/* + * 4. Update, delete values in indexed table. + */ +CREATE TABLE tbl_gist (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_gist SELECT x, 2*x, 3*x, box(point(x,x+1),point(2*x,2*x+1)) FROM generate_series(1,10) AS x; +CREATE INDEX tbl_gist_idx ON tbl_gist using gist (c4) INCLUDE (c1,c3); +UPDATE tbl_gist SET c1 = 100 WHERE c1 = 2; +UPDATE tbl_gist SET c1 = 1 WHERE c1 = 3; +DELETE FROM tbl_gist WHERE c1 = 5 OR c3 = 12; +DROP TABLE tbl_gist; + +/* + * 5. Alter column type. + */ +CREATE TABLE tbl_gist (c1 int, c2 int, c3 int, c4 box); +INSERT INTO tbl_gist SELECT x, 2*x, 3*x, box(point(x,x+1),point(2*x,2*x+1)) FROM generate_series(1,10) AS x; +CREATE INDEX tbl_gist_idx ON tbl_gist using gist (c4) INCLUDE (c1,c3); +ALTER TABLE tbl_gist ALTER c1 TYPE bigint; +ALTER TABLE tbl_gist ALTER c3 TYPE bigint; +\d tbl_gist +DROP TABLE tbl_gist; + +/* + * 6. EXCLUDE constraint. + */ +CREATE TABLE tbl_gist (c1 int, c2 int, c3 int, c4 box, EXCLUDE USING gist (c4 WITH &&) INCLUDE (c1, c2, c3)); +INSERT INTO tbl_gist SELECT x, 2*x, 3*x, box(point(x,x+1),point(2*x,2*x+1)) FROM generate_series(1,10) AS x; +INSERT INTO tbl_gist SELECT x, 2*x, 3*x, box(point(3*x,2*x),point(3*x+1,2*x+1)) FROM generate_series(1,10) AS x; +EXPLAIN (costs off) SELECT * FROM tbl_gist where c4 <@ box(point(1,1),point(10,10)); +\d tbl_gist +DROP TABLE tbl_gist; diff --git a/postgresql/examples/indexing.sql b/postgresql/examples/indexing.sql new file mode 100644 index 0000000..35d159f --- /dev/null +++ b/postgresql/examples/indexing.sql @@ -0,0 +1,736 @@ +-- Creating an index on a partitioned table makes the partitions +-- automatically get the index +create table idxpart (a int, b int, c text) partition by range (a); + +-- relhassubclass of a partitioned index is false before creating any partition. +-- It will be set after the first partition is created. +create index idxpart_idx on idxpart (a); +select relhassubclass from pg_class where relname = 'idxpart_idx'; + +-- Check that partitioned indexes are present in pg_indexes. +select indexdef from pg_indexes where indexname like 'idxpart_idx%'; +drop index idxpart_idx; + +create table idxpart1 partition of idxpart for values from (0) to (10); +create table idxpart2 partition of idxpart for values from (10) to (100) + partition by range (b); +create table idxpart21 partition of idxpart2 for values from (0) to (100); + +-- Even with partitions, relhassubclass should not be set if a partitioned +-- index is created only on the parent. +create index idxpart_idx on only idxpart(a); +select relhassubclass from pg_class where relname = 'idxpart_idx'; +drop index idxpart_idx; + +create index on idxpart (a); +select relname, relkind, relhassubclass, inhparent::regclass + from pg_class left join pg_index ix on (indexrelid = oid) + left join pg_inherits on (ix.indexrelid = inhrelid) + where relname like 'idxpart%' order by relname; +drop table idxpart; + +-- Some unsupported features +create table idxpart (a int, b int, c text) partition by range (a); +create table idxpart1 partition of idxpart for values from (0) to (10); +create index concurrently on idxpart (a); +drop table idxpart; + +-- Verify bugfix with query on indexed partitioned table with no partitions +-- https://postgr.es/m/20180124162006.pmapfiznhgngwtjf@alvherre.pgsql +CREATE TABLE idxpart (col1 INT) PARTITION BY RANGE (col1); +CREATE INDEX ON idxpart (col1); +CREATE TABLE idxpart_two (col2 INT); +SELECT col2 FROM idxpart_two fk LEFT OUTER JOIN idxpart pk ON (col1 = col2); +DROP table idxpart, idxpart_two; + +-- Verify bugfix with index rewrite on ALTER TABLE / SET DATA TYPE +-- https://postgr.es/m/CAKcux6mxNCGsgATwf5CGMF8g4WSupCXicCVMeKUTuWbyxHOMsQ@mail.gmail.com +CREATE TABLE idxpart (a INT, b TEXT, c INT) PARTITION BY RANGE(a); +CREATE TABLE idxpart1 PARTITION OF idxpart FOR VALUES FROM (MINVALUE) TO (MAXVALUE); +CREATE INDEX partidx_abc_idx ON idxpart (a, b, c); +INSERT INTO idxpart (a, b, c) SELECT i, i, i FROM generate_series(1, 50) i; +ALTER TABLE idxpart ALTER COLUMN c TYPE numeric; +DROP TABLE idxpart; + +-- If a table without index is attached as partition to a table with +-- an index, the index is automatically created +create table idxpart (a int, b int, c text) partition by range (a); +create index idxparti on idxpart (a); +create index idxparti2 on idxpart (b, c); +create table idxpart1 (like idxpart); +\d idxpart1 +alter table idxpart attach partition idxpart1 for values from (0) to (10); +\d idxpart1 +\d+ idxpart1_a_idx +\d+ idxpart1_b_c_idx + +-- Forbid ALTER TABLE when attaching or detaching an index to a partition. +create index idxpart_c on only idxpart (c); +create index idxpart1_c on idxpart1 (c); +alter table idxpart_c attach partition idxpart1_c for values from (10) to (20); +alter index idxpart_c attach partition idxpart1_c; +select relname, relpartbound from pg_class + where relname in ('idxpart_c', 'idxpart1_c') + order by relname; +alter table idxpart_c detach partition idxpart1_c; +drop table idxpart; + +-- If a partition already has an index, don't create a duplicative one +create table idxpart (a int, b int) partition by range (a, b); +create table idxpart1 partition of idxpart for values from (0, 0) to (10, 10); +create index on idxpart1 (a, b); +create index on idxpart (a, b); +\d idxpart1 +select relname, relkind, relhassubclass, inhparent::regclass + from pg_class left join pg_index ix on (indexrelid = oid) + left join pg_inherits on (ix.indexrelid = inhrelid) + where relname like 'idxpart%' order by relname; +drop table idxpart; + +-- DROP behavior for partitioned indexes +create table idxpart (a int) partition by range (a); +create index on idxpart (a); +create table idxpart1 partition of idxpart for values from (0) to (10); +drop index idxpart1_a_idx; -- no way +drop index idxpart_a_idx; -- both indexes go away +select relname, relkind from pg_class + where relname like 'idxpart%' order by relname; +create index on idxpart (a); +drop table idxpart1; -- the index on partition goes away too +select relname, relkind from pg_class + where relname like 'idxpart%' order by relname; +drop table idxpart; + +-- ALTER INDEX .. ATTACH, error cases +create table idxpart (a int, b int) partition by range (a, b); +create table idxpart1 partition of idxpart for values from (0, 0) to (10, 10); +create index idxpart_a_b_idx on only idxpart (a, b); +create index idxpart1_a_b_idx on idxpart1 (a, b); +create index idxpart1_tst1 on idxpart1 (b, a); +create index idxpart1_tst2 on idxpart1 using hash (a); +create index idxpart1_tst3 on idxpart1 (a, b) where a > 10; + +alter index idxpart attach partition idxpart1; +alter index idxpart_a_b_idx attach partition idxpart1; +alter index idxpart_a_b_idx attach partition idxpart_a_b_idx; +alter index idxpart_a_b_idx attach partition idxpart1_b_idx; +alter index idxpart_a_b_idx attach partition idxpart1_tst1; +alter index idxpart_a_b_idx attach partition idxpart1_tst2; +alter index idxpart_a_b_idx attach partition idxpart1_tst3; +-- OK +alter index idxpart_a_b_idx attach partition idxpart1_a_b_idx; +alter index idxpart_a_b_idx attach partition idxpart1_a_b_idx; -- quiet + +-- reject dupe +create index idxpart1_2_a_b on idxpart1 (a, b); +alter index idxpart_a_b_idx attach partition idxpart1_2_a_b; +drop table idxpart; +-- make sure everything's gone +select indexrelid::regclass, indrelid::regclass + from pg_index where indexrelid::regclass::text like 'idxpart%'; + +-- Don't auto-attach incompatible indexes +create table idxpart (a int, b int) partition by range (a); +create table idxpart1 (a int, b int); +create index on idxpart1 using hash (a); +create index on idxpart1 (a) where b > 1; +create index on idxpart1 ((a + 0)); +create index on idxpart1 (a, a); +create index on idxpart (a); +alter table idxpart attach partition idxpart1 for values from (0) to (1000); +\d idxpart1 +drop table idxpart; + +-- If CREATE INDEX ONLY, don't create indexes on partitions; and existing +-- indexes on partitions don't change parent. ALTER INDEX ATTACH can change +-- the parent after the fact. +create table idxpart (a int) partition by range (a); +create table idxpart1 partition of idxpart for values from (0) to (100); +create table idxpart2 partition of idxpart for values from (100) to (1000) + partition by range (a); +create table idxpart21 partition of idxpart2 for values from (100) to (200); +create table idxpart22 partition of idxpart2 for values from (200) to (300); +create index on idxpart22 (a); +create index on only idxpart2 (a); +create index on idxpart (a); +-- Here we expect that idxpart1 and idxpart2 have a new index, but idxpart21 +-- does not; also, idxpart22 is not attached. +\d idxpart1 +\d idxpart2 +\d idxpart21 +select indexrelid::regclass, indrelid::regclass, inhparent::regclass + from pg_index idx left join pg_inherits inh on (idx.indexrelid = inh.inhrelid) +where indexrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +alter index idxpart2_a_idx attach partition idxpart22_a_idx; +select indexrelid::regclass, indrelid::regclass, inhparent::regclass + from pg_index idx left join pg_inherits inh on (idx.indexrelid = inh.inhrelid) +where indexrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +-- attaching idxpart22 is not enough to set idxpart22_a_idx valid ... +alter index idxpart2_a_idx attach partition idxpart22_a_idx; +\d idxpart2 +-- ... but this one is. +create index on idxpart21 (a); +alter index idxpart2_a_idx attach partition idxpart21_a_idx; +\d idxpart2 +drop table idxpart; + +-- When a table is attached a partition and it already has an index, a +-- duplicate index should not get created, but rather the index becomes +-- attached to the parent's index. +create table idxpart (a int, b int, c text) partition by range (a); +create index idxparti on idxpart (a); +create index idxparti2 on idxpart (b, c); +create table idxpart1 (like idxpart including indexes); +\d idxpart1 +select relname, relkind, inhparent::regclass + from pg_class left join pg_index ix on (indexrelid = oid) + left join pg_inherits on (ix.indexrelid = inhrelid) + where relname like 'idxpart%' order by relname; +alter table idxpart attach partition idxpart1 for values from (0) to (10); +\d idxpart1 +select relname, relkind, inhparent::regclass + from pg_class left join pg_index ix on (indexrelid = oid) + left join pg_inherits on (ix.indexrelid = inhrelid) + where relname like 'idxpart%' order by relname; +drop table idxpart; + +-- Verify that attaching an invalid index does not mark the parent index valid. +-- On the other hand, attaching a valid index marks not only its direct +-- ancestor valid, but also any indirect ancestor that was only missing the one +-- that was just made valid +create table idxpart (a int, b int) partition by range (a); +create table idxpart1 partition of idxpart for values from (1) to (1000) partition by range (a); +create table idxpart11 partition of idxpart1 for values from (1) to (100); +create index on only idxpart1 (a); +create index on only idxpart (a); +-- this results in two invalid indexes: +select relname, indisvalid from pg_class join pg_index on indexrelid = oid + where relname like 'idxpart%' order by relname; +-- idxpart1_a_idx is not valid, so idxpart_a_idx should not become valid: +alter index idxpart_a_idx attach partition idxpart1_a_idx; +select relname, indisvalid from pg_class join pg_index on indexrelid = oid + where relname like 'idxpart%' order by relname; +-- after creating and attaching this, both idxpart1_a_idx and idxpart_a_idx +-- should become valid +create index on idxpart11 (a); +alter index idxpart1_a_idx attach partition idxpart11_a_idx; +select relname, indisvalid from pg_class join pg_index on indexrelid = oid + where relname like 'idxpart%' order by relname; +drop table idxpart; + +-- verify dependency handling during ALTER TABLE DETACH PARTITION +create table idxpart (a int) partition by range (a); +create table idxpart1 (like idxpart); +create index on idxpart1 (a); +create index on idxpart (a); +create table idxpart2 (like idxpart); +alter table idxpart attach partition idxpart1 for values from (0000) to (1000); +alter table idxpart attach partition idxpart2 for values from (1000) to (2000); +create table idxpart3 partition of idxpart for values from (2000) to (3000); +select relname, relkind from pg_class where relname like 'idxpart%' order by relname; +-- a) after detaching partitions, the indexes can be dropped independently +alter table idxpart detach partition idxpart1; +alter table idxpart detach partition idxpart2; +alter table idxpart detach partition idxpart3; +drop index idxpart1_a_idx; +drop index idxpart2_a_idx; +drop index idxpart3_a_idx; +select relname, relkind from pg_class where relname like 'idxpart%' order by relname; +drop table idxpart, idxpart1, idxpart2, idxpart3; +select relname, relkind from pg_class where relname like 'idxpart%' order by relname; + +create table idxpart (a int) partition by range (a); +create table idxpart1 (like idxpart); +create index on idxpart1 (a); +create index on idxpart (a); +create table idxpart2 (like idxpart); +alter table idxpart attach partition idxpart1 for values from (0000) to (1000); +alter table idxpart attach partition idxpart2 for values from (1000) to (2000); +create table idxpart3 partition of idxpart for values from (2000) to (3000); +-- b) after detaching, dropping the index on parent does not remove the others +select relname, relkind from pg_class where relname like 'idxpart%' order by relname; +alter table idxpart detach partition idxpart1; +alter table idxpart detach partition idxpart2; +alter table idxpart detach partition idxpart3; +drop index idxpart_a_idx; +select relname, relkind from pg_class where relname like 'idxpart%' order by relname; +drop table idxpart, idxpart1, idxpart2, idxpart3; +select relname, relkind from pg_class where relname like 'idxpart%' order by relname; + +create table idxpart (a int, b int, c int) partition by range(a); +create index on idxpart(c); +create table idxpart1 partition of idxpart for values from (0) to (250); +create table idxpart2 partition of idxpart for values from (250) to (500); +alter table idxpart detach partition idxpart2; +\d idxpart2 +alter table idxpart2 drop column c; +\d idxpart2 +drop table idxpart, idxpart2; + +-- Verify that expression indexes inherit correctly +create table idxpart (a int, b int) partition by range (a); +create table idxpart1 (like idxpart); +create index on idxpart1 ((a + b)); +create index on idxpart ((a + b)); +create table idxpart2 (like idxpart); +alter table idxpart attach partition idxpart1 for values from (0000) to (1000); +alter table idxpart attach partition idxpart2 for values from (1000) to (2000); +create table idxpart3 partition of idxpart for values from (2000) to (3000); +select relname as child, inhparent::regclass as parent, pg_get_indexdef as childdef + from pg_class join pg_inherits on inhrelid = oid, + lateral pg_get_indexdef(pg_class.oid) + where relkind in ('i', 'I') and relname like 'idxpart%' order by relname; +drop table idxpart; + +-- Verify behavior for collation (mis)matches +create table idxpart (a text) partition by range (a); +create table idxpart1 (like idxpart); +create table idxpart2 (like idxpart); +create index on idxpart2 (a collate "POSIX"); +create index on idxpart2 (a); +create index on idxpart2 (a collate "C"); +alter table idxpart attach partition idxpart1 for values from ('aaa') to ('bbb'); +alter table idxpart attach partition idxpart2 for values from ('bbb') to ('ccc'); +create table idxpart3 partition of idxpart for values from ('ccc') to ('ddd'); +create index on idxpart (a collate "C"); +create table idxpart4 partition of idxpart for values from ('ddd') to ('eee'); +select relname as child, inhparent::regclass as parent, pg_get_indexdef as childdef + from pg_class left join pg_inherits on inhrelid = oid, + lateral pg_get_indexdef(pg_class.oid) + where relkind in ('i', 'I') and relname like 'idxpart%' order by relname; +drop table idxpart; + +-- Verify behavior for opclass (mis)matches +create table idxpart (a text) partition by range (a); +create table idxpart1 (like idxpart); +create table idxpart2 (like idxpart); +create index on idxpart2 (a); +alter table idxpart attach partition idxpart1 for values from ('aaa') to ('bbb'); +alter table idxpart attach partition idxpart2 for values from ('bbb') to ('ccc'); +create table idxpart3 partition of idxpart for values from ('ccc') to ('ddd'); +create index on idxpart (a text_pattern_ops); +create table idxpart4 partition of idxpart for values from ('ddd') to ('eee'); +-- must *not* have attached the index we created on idxpart2 +select relname as child, inhparent::regclass as parent, pg_get_indexdef as childdef + from pg_class left join pg_inherits on inhrelid = oid, + lateral pg_get_indexdef(pg_class.oid) + where relkind in ('i', 'I') and relname like 'idxpart%' order by relname; +drop index idxpart_a_idx; +create index on only idxpart (a text_pattern_ops); +-- must reject +alter index idxpart_a_idx attach partition idxpart2_a_idx; +drop table idxpart; + +-- Verify that attaching indexes maps attribute numbers correctly +create table idxpart (col1 int, a int, col2 int, b int) partition by range (a); +create table idxpart1 (b int, col1 int, col2 int, col3 int, a int); +alter table idxpart drop column col1, drop column col2; +alter table idxpart1 drop column col1, drop column col2, drop column col3; +alter table idxpart attach partition idxpart1 for values from (0) to (1000); +create index idxpart_1_idx on only idxpart (b, a); +create index idxpart1_1_idx on idxpart1 (b, a); +create index idxpart1_1b_idx on idxpart1 (b); +-- test expressions and partial-index predicate, too +create index idxpart_2_idx on only idxpart ((b + a)) where a > 1; +create index idxpart1_2_idx on idxpart1 ((b + a)) where a > 1; +create index idxpart1_2b_idx on idxpart1 ((a + b)) where a > 1; +create index idxpart1_2c_idx on idxpart1 ((b + a)) where b > 1; +alter index idxpart_1_idx attach partition idxpart1_1b_idx; -- fail +alter index idxpart_1_idx attach partition idxpart1_1_idx; +alter index idxpart_2_idx attach partition idxpart1_2b_idx; -- fail +alter index idxpart_2_idx attach partition idxpart1_2c_idx; -- fail +alter index idxpart_2_idx attach partition idxpart1_2_idx; -- ok +select relname as child, inhparent::regclass as parent, pg_get_indexdef as childdef + from pg_class left join pg_inherits on inhrelid = oid, + lateral pg_get_indexdef(pg_class.oid) + where relkind in ('i', 'I') and relname like 'idxpart%' order by relname; +drop table idxpart; + +-- Make sure the partition columns are mapped correctly +create table idxpart (a int, b int, c text) partition by range (a); +create index idxparti on idxpart (a); +create index idxparti2 on idxpart (c, b); +create table idxpart1 (c text, a int, b int); +alter table idxpart attach partition idxpart1 for values from (0) to (10); +create table idxpart2 (c text, a int, b int); +create index on idxpart2 (a); +create index on idxpart2 (c, b); +alter table idxpart attach partition idxpart2 for values from (10) to (20); +select c.relname, pg_get_indexdef(indexrelid) + from pg_class c join pg_index i on c.oid = i.indexrelid + where indrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +drop table idxpart; + +-- Verify that columns are mapped correctly in expression indexes +create table idxpart (col1 int, col2 int, a int, b int) partition by range (a); +create table idxpart1 (col2 int, b int, col1 int, a int); +create table idxpart2 (col1 int, col2 int, b int, a int); +alter table idxpart drop column col1, drop column col2; +alter table idxpart1 drop column col1, drop column col2; +alter table idxpart2 drop column col1, drop column col2; +create index on idxpart2 (abs(b)); +alter table idxpart attach partition idxpart2 for values from (0) to (1); +create index on idxpart (abs(b)); +create index on idxpart ((b + 1)); +alter table idxpart attach partition idxpart1 for values from (1) to (2); +select c.relname, pg_get_indexdef(indexrelid) + from pg_class c join pg_index i on c.oid = i.indexrelid + where indrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +drop table idxpart; + +-- Verify that columns are mapped correctly for WHERE in a partial index +create table idxpart (col1 int, a int, col3 int, b int) partition by range (a); +alter table idxpart drop column col1, drop column col3; +create table idxpart1 (col1 int, col2 int, col3 int, col4 int, b int, a int); +alter table idxpart1 drop column col1, drop column col2, drop column col3, drop column col4; +alter table idxpart attach partition idxpart1 for values from (0) to (1000); +create table idxpart2 (col1 int, col2 int, b int, a int); +create index on idxpart2 (a) where b > 1000; +alter table idxpart2 drop column col1, drop column col2; +alter table idxpart attach partition idxpart2 for values from (1000) to (2000); +create index on idxpart (a) where b > 1000; +select c.relname, pg_get_indexdef(indexrelid) + from pg_class c join pg_index i on c.oid = i.indexrelid + where indrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +drop table idxpart; + +-- Column number mapping: dropped columns in the partition +create table idxpart1 (drop_1 int, drop_2 int, col_keep int, drop_3 int); +alter table idxpart1 drop column drop_1; +alter table idxpart1 drop column drop_2; +alter table idxpart1 drop column drop_3; +create index on idxpart1 (col_keep); +create table idxpart (col_keep int) partition by range (col_keep); +create index on idxpart (col_keep); +alter table idxpart attach partition idxpart1 for values from (0) to (1000); +\d idxpart +\d idxpart1 +select attrelid::regclass, attname, attnum from pg_attribute + where attrelid::regclass::text like 'idxpart%' and attnum > 0 + order by attrelid::regclass, attnum; +drop table idxpart; + +-- Column number mapping: dropped columns in the parent table +create table idxpart(drop_1 int, drop_2 int, col_keep int, drop_3 int) partition by range (col_keep); +alter table idxpart drop column drop_1; +alter table idxpart drop column drop_2; +alter table idxpart drop column drop_3; +create table idxpart1 (col_keep int); +create index on idxpart1 (col_keep); +create index on idxpart (col_keep); +alter table idxpart attach partition idxpart1 for values from (0) to (1000); +\d idxpart +\d idxpart1 +select attrelid::regclass, attname, attnum from pg_attribute + where attrelid::regclass::text like 'idxpart%' and attnum > 0 + order by attrelid::regclass, attnum; +drop table idxpart; + +-- +-- Constraint-related indexes +-- + +-- Verify that it works to add primary key / unique to partitioned tables +create table idxpart (a int primary key, b int) partition by range (a); +\d idxpart +-- multiple primary key on child should fail +create table failpart partition of idxpart (b primary key) for values from (0) to (100); +drop table idxpart; +-- primary key on child is okay if there's no PK in the parent, though +create table idxpart (a int) partition by range (a); +create table idxpart1pk partition of idxpart (a primary key) for values from (0) to (100); +\d idxpart1pk +drop table idxpart; + +-- Failing to use the full partition key is not allowed +create table idxpart (a int unique, b int) partition by range (a, b); +create table idxpart (a int, b int unique) partition by range (a, b); +create table idxpart (a int primary key, b int) partition by range (b, a); +create table idxpart (a int, b int primary key) partition by range (b, a); + +-- OK if you use them in some other order +create table idxpart (a int, b int, c text, primary key (a, b, c)) partition by range (b, c, a); +drop table idxpart; + +-- not other types of index-based constraints +create table idxpart (a int, exclude (a with = )) partition by range (a); + +-- no expressions in partition key for PK/UNIQUE +create table idxpart (a int primary key, b int) partition by range ((b + a)); +create table idxpart (a int unique, b int) partition by range ((b + a)); + +-- use ALTER TABLE to add a primary key +create table idxpart (a int, b int, c text) partition by range (a, b); +alter table idxpart add primary key (a); -- not an incomplete one though +alter table idxpart add primary key (a, b); -- this works +\d idxpart +create table idxpart1 partition of idxpart for values from (0, 0) to (1000, 1000); +\d idxpart1 +drop table idxpart; + +-- use ALTER TABLE to add a unique constraint +create table idxpart (a int, b int) partition by range (a, b); +alter table idxpart add unique (a); -- not an incomplete one though +alter table idxpart add unique (b, a); -- this works +\d idxpart +drop table idxpart; + +-- Exclusion constraints cannot be added +create table idxpart (a int, b int) partition by range (a); +alter table idxpart add exclude (a with =); +drop table idxpart; + +-- When (sub)partitions are created, they also contain the constraint +create table idxpart (a int, b int, primary key (a, b)) partition by range (a, b); +create table idxpart1 partition of idxpart for values from (1, 1) to (10, 10); +create table idxpart2 partition of idxpart for values from (10, 10) to (20, 20) + partition by range (b); +create table idxpart21 partition of idxpart2 for values from (10) to (15); +create table idxpart22 partition of idxpart2 for values from (15) to (20); +create table idxpart3 (b int not null, a int not null); +alter table idxpart attach partition idxpart3 for values from (20, 20) to (30, 30); +select conname, contype, conrelid::regclass, conindid::regclass, conkey + from pg_constraint where conrelid::regclass::text like 'idxpart%' + order by conname; +drop table idxpart; + +-- Verify that multi-layer partitioning honors the requirement that all +-- columns in the partition key must appear in primary/unique key +create table idxpart (a int, b int, primary key (a)) partition by range (a); +create table idxpart2 partition of idxpart +for values from (0) to (1000) partition by range (b); -- fail +drop table idxpart; + +-- Ditto for the ATTACH PARTITION case +create table idxpart (a int unique, b int) partition by range (a); +create table idxpart1 (a int not null, b int, unique (a, b)) + partition by range (a, b); +alter table idxpart attach partition idxpart1 for values from (1) to (1000); +DROP TABLE idxpart, idxpart1; + +-- Multi-layer partitioning works correctly in this case: +create table idxpart (a int, b int, primary key (a, b)) partition by range (a); +create table idxpart2 partition of idxpart for values from (0) to (1000) partition by range (b); +create table idxpart21 partition of idxpart2 for values from (0) to (1000); +select conname, contype, conrelid::regclass, conindid::regclass, conkey + from pg_constraint where conrelid::regclass::text like 'idxpart%' + order by conname; +drop table idxpart; + +-- If a partitioned table has a unique/PK constraint, then it's not possible +-- to drop the corresponding constraint in the children; nor it's possible +-- to drop the indexes individually. Dropping the constraint in the parent +-- gets rid of the lot. +create table idxpart (i int) partition by hash (i); +create table idxpart0 partition of idxpart (i) for values with (modulus 2, remainder 0); +create table idxpart1 partition of idxpart (i) for values with (modulus 2, remainder 1); +alter table idxpart0 add primary key(i); +alter table idxpart add primary key(i); +select indrelid::regclass, indexrelid::regclass, inhparent::regclass, indisvalid, + conname, conislocal, coninhcount, connoinherit, convalidated + from pg_index idx left join pg_inherits inh on (idx.indexrelid = inh.inhrelid) + left join pg_constraint con on (idx.indexrelid = con.conindid) + where indrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +drop index idxpart0_pkey; -- fail +drop index idxpart1_pkey; -- fail +alter table idxpart0 drop constraint idxpart0_pkey; -- fail +alter table idxpart1 drop constraint idxpart1_pkey; -- fail +alter table idxpart drop constraint idxpart_pkey; -- ok +select indrelid::regclass, indexrelid::regclass, inhparent::regclass, indisvalid, + conname, conislocal, coninhcount, connoinherit, convalidated + from pg_index idx left join pg_inherits inh on (idx.indexrelid = inh.inhrelid) + left join pg_constraint con on (idx.indexrelid = con.conindid) + where indrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +drop table idxpart; + +-- If the partition to be attached already has a primary key, fail if +-- it doesn't match the parent's PK. +CREATE TABLE idxpart (c1 INT PRIMARY KEY, c2 INT, c3 VARCHAR(10)) PARTITION BY RANGE(c1); +CREATE TABLE idxpart1 (LIKE idxpart); +ALTER TABLE idxpart1 ADD PRIMARY KEY (c1, c2); +ALTER TABLE idxpart ATTACH PARTITION idxpart1 FOR VALUES FROM (100) TO (200); +DROP TABLE idxpart, idxpart1; + +-- Ditto if there is some distance between the PKs (subpartitioning) +create table idxpart (a int, b int, primary key (a)) partition by range (a); +create table idxpart1 (a int not null, b int) partition by range (a); +create table idxpart11 (a int not null, b int primary key); +alter table idxpart1 attach partition idxpart11 for values from (0) to (1000); +alter table idxpart attach partition idxpart1 for values from (0) to (10000); +drop table idxpart, idxpart1, idxpart11; + +-- If a partitioned table has a constraint whose index is not valid, +-- attaching a missing partition makes it valid. +create table idxpart (a int) partition by range (a); +create table idxpart0 (like idxpart); +alter table idxpart0 add primary key (a); +alter table idxpart attach partition idxpart0 for values from (0) to (1000); +alter table only idxpart add primary key (a); +select indrelid::regclass, indexrelid::regclass, inhparent::regclass, indisvalid, + conname, conislocal, coninhcount, connoinherit, convalidated + from pg_index idx left join pg_inherits inh on (idx.indexrelid = inh.inhrelid) + left join pg_constraint con on (idx.indexrelid = con.conindid) + where indrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +alter index idxpart_pkey attach partition idxpart0_pkey; +select indrelid::regclass, indexrelid::regclass, inhparent::regclass, indisvalid, + conname, conislocal, coninhcount, connoinherit, convalidated + from pg_index idx left join pg_inherits inh on (idx.indexrelid = inh.inhrelid) + left join pg_constraint con on (idx.indexrelid = con.conindid) + where indrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +drop table idxpart; + +-- Related to the above scenario: ADD PRIMARY KEY on the parent mustn't +-- automatically propagate NOT NULL to child columns. +create table idxpart (a int) partition by range (a); +create table idxpart0 (like idxpart); +alter table idxpart0 add unique (a); +alter table idxpart attach partition idxpart0 default; +alter table only idxpart add primary key (a); -- fail, no NOT NULL constraint +alter table idxpart0 alter column a set not null; +alter table only idxpart add primary key (a); -- now it works +alter table idxpart0 alter column a drop not null; -- fail, pkey needs it +drop table idxpart; + +-- if a partition has a unique index without a constraint, does not attach +-- automatically; creates a new index instead. +create table idxpart (a int, b int) partition by range (a); +create table idxpart1 (a int not null, b int); +create unique index on idxpart1 (a); +alter table idxpart add primary key (a); +alter table idxpart attach partition idxpart1 for values from (1) to (1000); +select indrelid::regclass, indexrelid::regclass, inhparent::regclass, indisvalid, + conname, conislocal, coninhcount, connoinherit, convalidated + from pg_index idx left join pg_inherits inh on (idx.indexrelid = inh.inhrelid) + left join pg_constraint con on (idx.indexrelid = con.conindid) + where indrelid::regclass::text like 'idxpart%' + order by indexrelid::regclass::text collate "C"; +drop table idxpart; + +-- Can't attach an index without a corresponding constraint +create table idxpart (a int, b int) partition by range (a); +create table idxpart1 (a int not null, b int); +create unique index on idxpart1 (a); +alter table idxpart attach partition idxpart1 for values from (1) to (1000); +alter table only idxpart add primary key (a); +alter index idxpart_pkey attach partition idxpart1_a_idx; -- fail +drop table idxpart; + +-- Test that unique constraints are working +create table idxpart (a int, b text, primary key (a, b)) partition by range (a); +create table idxpart1 partition of idxpart for values from (0) to (100000); +create table idxpart2 (c int, like idxpart); +insert into idxpart2 (c, a, b) values (42, 572814, 'inserted first'); +alter table idxpart2 drop column c; +create unique index on idxpart (a); +alter table idxpart attach partition idxpart2 for values from (100000) to (1000000); +insert into idxpart values (0, 'zero'), (42, 'life'), (2^16, 'sixteen'); +insert into idxpart select 2^g, format('two to power of %s', g) from generate_series(15, 17) g; +insert into idxpart values (16, 'sixteen'); +insert into idxpart (b, a) values ('one', 142857), ('two', 285714); +insert into idxpart select a * 2, b || b from idxpart where a between 2^16 and 2^19; +insert into idxpart values (572814, 'five'); +insert into idxpart values (857142, 'six'); +select tableoid::regclass, * from idxpart order by a; +drop table idxpart; + +-- intentionally leave some objects around +create table idxpart (a int) partition by range (a); +create table idxpart1 partition of idxpart for values from (0) to (100); +create table idxpart2 partition of idxpart for values from (100) to (1000) + partition by range (a); +create table idxpart21 partition of idxpart2 for values from (100) to (200); +create table idxpart22 partition of idxpart2 for values from (200) to (300); +create index on idxpart22 (a); +create index on only idxpart2 (a); +alter index idxpart2_a_idx attach partition idxpart22_a_idx; +create index on idxpart (a); +create table idxpart_another (a int, b int, primary key (a, b)) partition by range (a); +create table idxpart_another_1 partition of idxpart_another for values from (0) to (100); +create table idxpart3 (c int, b int, a int) partition by range (a); +alter table idxpart3 drop column b, drop column c; +create table idxpart31 partition of idxpart3 for values from (1000) to (1200); +create table idxpart32 partition of idxpart3 for values from (1200) to (1400); +alter table idxpart attach partition idxpart3 for values from (1000) to (2000); + +-- More objects intentionally left behind, to verify some pg_dump/pg_upgrade +-- behavior; see https://postgr.es/m/20190321204928.GA17535@alvherre.pgsql +create schema regress_indexing; +set search_path to regress_indexing; +create table pk (a int primary key) partition by range (a); +create table pk1 partition of pk for values from (0) to (1000); +create table pk2 (b int, a int); +alter table pk2 drop column b; +alter table pk2 alter a set not null; +alter table pk attach partition pk2 for values from (1000) to (2000); +create table pk3 partition of pk for values from (2000) to (3000); +create table pk4 (like pk); +alter table pk attach partition pk4 for values from (3000) to (4000); +create table pk5 (like pk) partition by range (a); +create table pk51 partition of pk5 for values from (4000) to (4500); +create table pk52 partition of pk5 for values from (4500) to (5000); +alter table pk attach partition pk5 for values from (4000) to (5000); +reset search_path; + +-- Test that covering partitioned indexes work in various cases +create table covidxpart (a int, b int) partition by list (a); +create unique index on covidxpart (a) include (b); +create table covidxpart1 partition of covidxpart for values in (1); +create table covidxpart2 partition of covidxpart for values in (2); +insert into covidxpart values (1, 1); +insert into covidxpart values (1, 1); +create table covidxpart3 (b int, c int, a int); +alter table covidxpart3 drop c; +alter table covidxpart attach partition covidxpart3 for values in (3); +insert into covidxpart values (3, 1); +insert into covidxpart values (3, 1); +create table covidxpart4 (b int, a int); +create unique index on covidxpart4 (a) include (b); +create unique index on covidxpart4 (a); +alter table covidxpart attach partition covidxpart4 for values in (4); +insert into covidxpart values (4, 1); +insert into covidxpart values (4, 1); +create unique index on covidxpart (b) include (a); -- should fail + +-- check that detaching a partition also detaches the primary key constraint +create table parted_pk_detach_test (a int primary key) partition by list (a); +create table parted_pk_detach_test1 partition of parted_pk_detach_test for values in (1); +alter table parted_pk_detach_test1 drop constraint parted_pk_detach_test1_pkey; -- should fail +alter table parted_pk_detach_test detach partition parted_pk_detach_test1; +alter table parted_pk_detach_test1 drop constraint parted_pk_detach_test1_pkey; +drop table parted_pk_detach_test, parted_pk_detach_test1; +create table parted_uniq_detach_test (a int unique) partition by list (a); +create table parted_uniq_detach_test1 partition of parted_uniq_detach_test for values in (1); +alter table parted_uniq_detach_test1 drop constraint parted_uniq_detach_test1_a_key; -- should fail +alter table parted_uniq_detach_test detach partition parted_uniq_detach_test1; +alter table parted_uniq_detach_test1 drop constraint parted_uniq_detach_test1_a_key; +drop table parted_uniq_detach_test, parted_uniq_detach_test1; + +-- check that dropping a column takes with it any partitioned indexes +-- depending on it. +create table parted_index_col_drop(a int, b int, c int) + partition by list (a); +create table parted_index_col_drop1 partition of parted_index_col_drop + for values in (1) partition by list (a); +-- leave this partition without children. +create table parted_index_col_drop2 partition of parted_index_col_drop + for values in (2) partition by list (a); +create table parted_index_col_drop11 partition of parted_index_col_drop1 + for values in (1); +create index on parted_index_col_drop (b); +create index on parted_index_col_drop (c); +create index on parted_index_col_drop (b, c); +alter table parted_index_col_drop drop column c; +\d parted_index_col_drop +\d parted_index_col_drop1 +\d parted_index_col_drop2 +\d parted_index_col_drop11 +drop table parted_index_col_drop; diff --git a/postgresql/examples/indirect_toast.sql b/postgresql/examples/indirect_toast.sql new file mode 100644 index 0000000..efb1eb4 --- /dev/null +++ b/postgresql/examples/indirect_toast.sql @@ -0,0 +1,61 @@ +CREATE TABLE indtoasttest(descr text, cnt int DEFAULT 0, f1 text, f2 text); + +INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-compressed', repeat('1234567890',1000), repeat('1234567890',1000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-toasted', repeat('1234567890',30000), repeat('1234567890',50000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-compressed,one-null', NULL, repeat('1234567890',1000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-toasted,one-null', NULL, repeat('1234567890',50000)); + +-- check whether indirect tuples works on the most basic level +SELECT descr, substring(make_tuple_indirect(indtoasttest)::text, 1, 200) FROM indtoasttest; + +-- modification without changing varlenas +UPDATE indtoasttest SET cnt = cnt +1 RETURNING substring(indtoasttest::text, 1, 200); + +-- modification without modifying assigned value +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(indtoasttest::text, 1, 200); + +-- modification modifying, but effectively not changing +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoasttest::text, 1, 200); + +UPDATE indtoasttest SET cnt = cnt +1, f1 = '-'||f1||'-' RETURNING substring(indtoasttest::text, 1, 200); + +SELECT substring(indtoasttest::text, 1, 200) FROM indtoasttest; +-- check we didn't screw with main/toast tuple visibility +VACUUM FREEZE indtoasttest; +SELECT substring(indtoasttest::text, 1, 200) FROM indtoasttest; + +-- now create a trigger that forces all Datums to be indirect ones +CREATE FUNCTION update_using_indirect() + RETURNS trigger + LANGUAGE plpgsql AS $$ +BEGIN + NEW := make_tuple_indirect(NEW); + RETURN NEW; +END$$; + +CREATE TRIGGER indtoasttest_update_indirect + BEFORE INSERT OR UPDATE + ON indtoasttest + FOR EACH ROW + EXECUTE PROCEDURE update_using_indirect(); + +-- modification without changing varlenas +UPDATE indtoasttest SET cnt = cnt +1 RETURNING substring(indtoasttest::text, 1, 200); + +-- modification without modifying assigned value +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(indtoasttest::text, 1, 200); + +-- modification modifying, but effectively not changing +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoasttest::text, 1, 200); + +UPDATE indtoasttest SET cnt = cnt +1, f1 = '-'||f1||'-' RETURNING substring(indtoasttest::text, 1, 200); + +INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-toasted,one-null, via indirect', repeat('1234567890',30000), NULL); + +SELECT substring(indtoasttest::text, 1, 200) FROM indtoasttest; +-- check we didn't screw with main/toast tuple visibility +VACUUM FREEZE indtoasttest; +SELECT substring(indtoasttest::text, 1, 200) FROM indtoasttest; + +DROP TABLE indtoasttest; +DROP FUNCTION update_using_indirect(); diff --git a/postgresql/examples/inet.sql b/postgresql/examples/inet.sql new file mode 100644 index 0000000..4dc869b --- /dev/null +++ b/postgresql/examples/inet.sql @@ -0,0 +1,256 @@ +-- +-- INET +-- + +-- prepare the table... + +DROP TABLE INET_TBL; +CREATE TABLE INET_TBL (c cidr, i inet); +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24'); +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.0/26', '192.168.1.226'); +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.0/24'); +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.0/25'); +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.255/24'); +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.255/25'); +INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8'); +INSERT INTO INET_TBL (c, i) VALUES ('10.0.0.0', '10.1.2.3/8'); +INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32'); +INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24'); +INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16'); +INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8'); +INSERT INTO INET_TBL (c, i) VALUES ('10', '11.1.2.3/8'); +INSERT INTO INET_TBL (c, i) VALUES ('10', '9.1.2.3/8'); +INSERT INTO INET_TBL (c, i) VALUES ('10:23::f1', '10:23::f1/64'); +INSERT INTO INET_TBL (c, i) VALUES ('10:23::8000/113', '10:23::ffff'); +INSERT INTO INET_TBL (c, i) VALUES ('::ffff:1.2.3.4', '::4.3.2.1/24'); +-- check that CIDR rejects invalid input: +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/30', '192.168.1.226'); +INSERT INTO INET_TBL (c, i) VALUES ('1234::1234::1234', '::1.2.3.4'); +-- check that CIDR rejects invalid input when converting from text: +INSERT INTO INET_TBL (c, i) VALUES (cidr('192.168.1.2/30'), '192.168.1.226'); +INSERT INTO INET_TBL (c, i) VALUES (cidr('ffff:ffff:ffff:ffff::/24'), '::192.168.1.226'); +SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL; + +-- now test some support functions + +SELECT '' AS ten, i AS inet, host(i), text(i), family(i) FROM INET_TBL; +SELECT '' AS ten, c AS cidr, broadcast(c), + i AS inet, broadcast(i) FROM INET_TBL; +SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)", + i AS inet, network(i) AS "network(inet)" FROM INET_TBL; +SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)", + i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL; + +SELECT '' AS four, c AS cidr, masklen(c) AS "masklen(cidr)", + i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL + WHERE masklen(c) <= 8; + +SELECT '' AS six, c AS cidr, i AS inet FROM INET_TBL + WHERE c = i; + + +SELECT max(i) AS max, min(i) AS min FROM INET_TBL; +SELECT max(c) AS max, min(c) AS min FROM INET_TBL; + +-- check the conversion to/from text and set_netmask +SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL; + +-- check that btree index works correctly +CREATE INDEX inet_idx1 ON inet_tbl(i); +SET enable_seqscan TO off; +SET enable_seqscan TO on; +DROP INDEX inet_idx1; + +-- check that gist index works correctly +CREATE INDEX inet_idx2 ON inet_tbl using gist (i inet_ops); +SET enable_seqscan TO off; +SELECT * FROM inet_tbl WHERE i < '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i <= '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i = '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i >= '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i > '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i <> '192.168.1.0/24'::cidr ORDER BY i; + + +SET enable_seqscan TO on; +DROP INDEX inet_idx2; + +-- check that spgist index works correctly +CREATE INDEX inet_idx3 ON inet_tbl using spgist (i); +SET enable_seqscan TO off; +SELECT * FROM inet_tbl WHERE i < '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i <= '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i = '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i >= '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i > '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i <> '192.168.1.0/24'::cidr ORDER BY i; + + +SET enable_seqscan TO on; +DROP INDEX inet_idx3; + +-- simple tests of inet boolean and arithmetic operators +SELECT i, ~i AS "~i" FROM inet_tbl; +SELECT i, c, i & c AS "and" FROM inet_tbl; +SELECT i, c, i | c AS "or" FROM inet_tbl; +SELECT i, i + 500 AS "i+500" FROM inet_tbl; +SELECT i, i - 500 AS "i-500" FROM inet_tbl; +SELECT i, c, i - c AS "minus" FROM inet_tbl; +SELECT '127.0.0.1'::inet + 257; +SELECT ('127.0.0.1'::inet + 257) - 257; +SELECT '127::1'::inet + 257; +SELECT ('127::1'::inet + 257) - 257; +SELECT '127.0.0.2'::inet - ('127.0.0.2'::inet + 500); +SELECT '127.0.0.2'::inet - ('127.0.0.2'::inet - 500); +SELECT '127::2'::inet - ('127::2'::inet + 500); +SELECT '127::2'::inet - ('127::2'::inet - 500); +-- these should give overflow errors: +SELECT '127.0.0.1'::inet + 10000000000; +SELECT '127.0.0.1'::inet - 10000000000; +SELECT '126::1'::inet - '127::2'::inet; +SELECT '127::1'::inet - '126::2'::inet; +-- but not these +SELECT '127::1'::inet + 10000000000; +SELECT '127::1'::inet - '127::2'::inet; + +-- insert one more row with addressed from different families +INSERT INTO INET_TBL (c, i) VALUES ('10', '10::/8'); +-- now, this one should fail +SELECT inet_merge(c, i) FROM INET_TBL; +-- fix it by inet_same_family() condition +SELECT inet_merge(c, i) FROM INET_TBL WHERE inet_same_family(c, i); + +-- Test inet sortsupport with a variety of boundary inputs: +SELECT a FROM (VALUES + ('0.0.0.0/0'::inet), + ('0.0.0.0/1'::inet), + ('0.0.0.0/32'::inet), + ('0.0.0.1/0'::inet), + ('0.0.0.1/1'::inet), + ('127.126.127.127/0'::inet), + ('127.127.127.127/0'::inet), + ('127.128.127.127/0'::inet), + ('192.168.1.0/24'::inet), + ('192.168.1.0/25'::inet), + ('192.168.1.1/23'::inet), + ('192.168.1.1/5'::inet), + ('192.168.1.1/6'::inet), + ('192.168.1.1/25'::inet), + ('192.168.1.2/25'::inet), + ('192.168.1.1/26'::inet), + ('192.168.1.2/26'::inet), + ('192.168.1.2/23'::inet), + ('192.168.1.255/5'::inet), + ('192.168.1.255/6'::inet), + ('192.168.1.3/1'::inet), + ('192.168.1.3/23'::inet), + ('192.168.1.4/0'::inet), + ('192.168.1.5/0'::inet), + ('255.0.0.0/0'::inet), + ('255.1.0.0/0'::inet), + ('255.2.0.0/0'::inet), + ('255.255.000.000/0'::inet), + ('255.255.000.000/0'::inet), + ('255.255.000.000/15'::inet), + ('255.255.000.000/16'::inet), + ('255.255.255.254/32'::inet), + ('255.255.255.000/32'::inet), + ('255.255.255.001/31'::inet), + ('255.255.255.002/31'::inet), + ('255.255.255.003/31'::inet), + ('255.255.255.003/32'::inet), + ('255.255.255.001/32'::inet), + ('255.255.255.255/0'::inet), + ('255.255.255.255/0'::inet), + ('255.255.255.255/0'::inet), + ('255.255.255.255/1'::inet), + ('255.255.255.255/16'::inet), + ('255.255.255.255/16'::inet), + ('255.255.255.255/31'::inet), + ('255.255.255.255/32'::inet), + ('255.255.255.253/32'::inet), + ('255.255.255.252/32'::inet), + ('255.3.0.0/0'::inet), + ('0000:0000:0000:0000:0000:0000:0000:0000/0'::inet), + ('0000:0000:0000:0000:0000:0000:0000:0000/128'::inet), + ('0000:0000:0000:0000:0000:0000:0000:0001/128'::inet), + ('10:23::f1/64'::inet), + ('10:23::f1/65'::inet), + ('10:23::ffff'::inet), + ('127::1'::inet), + ('127::2'::inet), + ('8000:0000:0000:0000:0000:0000:0000:0000/1'::inet), + ('::1:ffff:ffff:ffff:ffff/128'::inet), + ('::2:ffff:ffff:ffff:ffff/128'::inet), + ('::4:3:2:0/24'::inet), + ('::4:3:2:1/24'::inet), + ('::4:3:2:2/24'::inet), + ('ffff:83e7:f118:57dc:6093:6d92:689d:58cf/70'::inet), + ('ffff:84b0:4775:536e:c3ed:7116:a6d6:34f0/44'::inet), + ('ffff:8566:f84:5867:47f1:7867:d2ba:8a1a/69'::inet), + ('ffff:8883:f028:7d2:4d68:d510:7d6b:ac43/73'::inet), + ('ffff:8ae8:7c14:65b3:196:8e4a:89ae:fb30/89'::inet), + ('ffff:8dd0:646:694c:7c16:7e35:6a26:171/104'::inet), + ('ffff:8eef:cbf:700:eda3:ae32:f4b4:318b/121'::inet), + ('ffff:90e7:e744:664:a93:8efe:1f25:7663/122'::inet), + ('ffff:9597:c69c:8b24:57a:8639:ec78:6026/111'::inet), + ('ffff:9e86:79ea:f16e:df31:8e4d:7783:532e/88'::inet), + ('ffff:a0c7:82d3:24de:f762:6e1f:316d:3fb2/23'::inet), + ('ffff:fffa:ffff:ffff:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:fffb:ffff:ffff:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:fffc:ffff:ffff:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:fffd:ffff:ffff:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:fffe:ffff:ffff:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:ffff:ffff:fffa:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:ffff:ffff:fffb:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:ffff:ffff:fffc:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:ffff:ffff:fffd::/128'::inet), + ('ffff:ffff:ffff:fffd:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:ffff:ffff:fffe::/128'::inet), + ('ffff:ffff:ffff:fffe:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:ffff:ffff:ffff:4:3:2:0/24'::inet), + ('ffff:ffff:ffff:ffff:4:3:2:1/24'::inet), + ('ffff:ffff:ffff:ffff:4:3:2:2/24'::inet), + ('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/0'::inet), + ('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128'::inet) +) AS i(a) ORDER BY a; +SELECT '' AS ten, i, c, + i < c AS lt, i <= c AS le, i = c AS eq, + i >= c AS ge, i > c AS gt, i <> c AS ne, + i << c AS sb, i <<= c AS sbe, + i >> c AS sup, i >>= c AS spe, + i && c AS ovr + FROM INET_TBL; + + +EXPLAIN (COSTS OFF) +SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr; +SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr; +EXPLAIN (COSTS OFF) +SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr; +SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr; +EXPLAIN (COSTS OFF) +SELECT * FROM inet_tbl WHERE '192.168.1.0/24'::cidr >>= i; +SELECT * FROM inet_tbl WHERE '192.168.1.0/24'::cidr >>= i; +EXPLAIN (COSTS OFF) +SELECT * FROM inet_tbl WHERE '192.168.1.0/24'::cidr >> i; +SELECT * FROM inet_tbl WHERE '192.168.1.0/24'::cidr >> i; +SELECT * FROM inet_tbl WHERE i << '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i <<= '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i && '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i >>= '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i >> '192.168.1.0/24'::cidr ORDER BY i; +-- test index-only scans +EXPLAIN (COSTS OFF) +SELECT i FROM inet_tbl WHERE i << '192.168.1.0/24'::cidr ORDER BY i; +SELECT i FROM inet_tbl WHERE i << '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i << '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i <<= '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i && '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i >>= '192.168.1.0/24'::cidr ORDER BY i; +SELECT * FROM inet_tbl WHERE i >> '192.168.1.0/24'::cidr ORDER BY i; +-- test index-only scans +EXPLAIN (COSTS OFF) +SELECT i FROM inet_tbl WHERE i << '192.168.1.0/24'::cidr ORDER BY i; +SELECT i FROM inet_tbl WHERE i << '192.168.1.0/24'::cidr ORDER BY i; + diff --git a/postgresql/examples/inherit.sql b/postgresql/examples/inherit.sql new file mode 100644 index 0000000..64173a8 --- /dev/null +++ b/postgresql/examples/inherit.sql @@ -0,0 +1,988 @@ +-- +-- Test inheritance features +-- +CREATE TABLE a (aa TEXT); +CREATE TABLE b (bb TEXT) INHERITS (a); +CREATE TABLE c (cc TEXT) INHERITS (a); +CREATE TABLE d (dd TEXT) INHERITS (b,c,a); + +INSERT INTO a(aa) VALUES('aaa'); +INSERT INTO a(aa) VALUES('aaaa'); +INSERT INTO a(aa) VALUES('aaaaa'); +INSERT INTO a(aa) VALUES('aaaaaa'); +INSERT INTO a(aa) VALUES('aaaaaaa'); +INSERT INTO a(aa) VALUES('aaaaaaaa'); + +INSERT INTO b(aa) VALUES('bbb'); +INSERT INTO b(aa) VALUES('bbbb'); +INSERT INTO b(aa) VALUES('bbbbb'); +INSERT INTO b(aa) VALUES('bbbbbb'); +INSERT INTO b(aa) VALUES('bbbbbbb'); +INSERT INTO b(aa) VALUES('bbbbbbbb'); + +INSERT INTO c(aa) VALUES('ccc'); +INSERT INTO c(aa) VALUES('cccc'); +INSERT INTO c(aa) VALUES('ccccc'); +INSERT INTO c(aa) VALUES('cccccc'); +INSERT INTO c(aa) VALUES('ccccccc'); +INSERT INTO c(aa) VALUES('cccccccc'); + +INSERT INTO d(aa) VALUES('ddd'); +INSERT INTO d(aa) VALUES('dddd'); +INSERT INTO d(aa) VALUES('ddddd'); +INSERT INTO d(aa) VALUES('dddddd'); +INSERT INTO d(aa) VALUES('ddddddd'); +INSERT INTO d(aa) VALUES('dddddddd'); + +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; + +UPDATE a SET aa='zzzz' WHERE aa='aaaa'; +UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa'; +UPDATE b SET aa='zzz' WHERE aa='aaa'; +UPDATE ONLY b SET aa='zzz' WHERE aa='aaa'; +UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%'; + +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; + +UPDATE b SET aa='new'; + +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; + +UPDATE a SET aa='new'; + +DELETE FROM ONLY c WHERE aa='new'; + +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; + +DELETE FROM a; + +SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid; +SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid; +SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid; +SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid; +SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid; + +-- Confirm PRIMARY KEY adds NOT NULL constraint to child table +CREATE TEMP TABLE z (b TEXT, PRIMARY KEY(aa, b)) inherits (a); +INSERT INTO z VALUES (NULL, 'text'); -- should fail + +-- Check inherited UPDATE with all children excluded +create table some_tab (a int, b int); +create table some_tab_child () inherits (some_tab); +insert into some_tab_child values(1,2); + +explain (verbose, costs off) +update some_tab set a = a + 1 where false; +update some_tab set a = a + 1 where false; +explain (verbose, costs off) +update some_tab set a = a + 1 where false returning b, a; +update some_tab set a = a + 1 where false returning b, a; +table some_tab; + +drop table some_tab cascade; + +-- Check UPDATE with inherited target and an inherited source table +create temp table foo(f1 int, f2 int); +create temp table foo2(f3 int) inherits (foo); +create temp table bar(f1 int, f2 int); +create temp table bar2(f3 int) inherits (bar); + +insert into foo values(1,1); +insert into foo values(3,3); +insert into foo2 values(2,2,2); +insert into foo2 values(3,3,3); +insert into bar values(1,1); +insert into bar values(2,2); +insert into bar values(3,3); +insert into bar values(4,4); +insert into bar2 values(1,1,1); +insert into bar2 values(2,2,2); +insert into bar2 values(3,3,3); +insert into bar2 values(4,4,4); + +update bar set f2 = f2 + 100 where f1 in (select f1 from foo); + +select tableoid::regclass::text as relname, bar.* from bar order by 1,2; + +-- Check UPDATE with inherited target and an appendrel subquery +update bar set f2 = f2 + 100 +from + ( select f1 from foo union all select f1+3 from foo ) ss +where bar.f1 = ss.f1; + +select tableoid::regclass::text as relname, bar.* from bar order by 1,2; + +-- Check UPDATE with *partitioned* inherited target and an appendrel subquery +create table some_tab (a int); +insert into some_tab values (0); +create table some_tab_child () inherits (some_tab); +insert into some_tab_child values (1); +create table parted_tab (a int, b char) partition by list (a); +create table parted_tab_part1 partition of parted_tab for values in (1); +create table parted_tab_part2 partition of parted_tab for values in (2); +create table parted_tab_part3 partition of parted_tab for values in (3); +insert into parted_tab values (1, 'a'), (2, 'a'), (3, 'a'); + +update parted_tab set b = 'b' +from + (select a from some_tab union all select a+1 from some_tab) ss (a) +where parted_tab.a = ss.a; +select tableoid::regclass::text as relname, parted_tab.* from parted_tab order by 1,2; + +truncate parted_tab; +insert into parted_tab values (1, 'a'), (2, 'a'), (3, 'a'); +update parted_tab set b = 'b' +from + (select 0 from parted_tab union all select 1 from parted_tab) ss (a) +where parted_tab.a = ss.a; +select tableoid::regclass::text as relname, parted_tab.* from parted_tab order by 1,2; + +-- modifies partition key, but no rows will actually be updated +explain update parted_tab set a = 2 where false; + +drop table parted_tab; + +-- Check UPDATE with multi-level partitioned inherited target +create table mlparted_tab (a int, b char, c text) partition by list (a); +create table mlparted_tab_part1 partition of mlparted_tab for values in (1); +create table mlparted_tab_part2 partition of mlparted_tab for values in (2) partition by list (b); +create table mlparted_tab_part3 partition of mlparted_tab for values in (3); +create table mlparted_tab_part2a partition of mlparted_tab_part2 for values in ('a'); +create table mlparted_tab_part2b partition of mlparted_tab_part2 for values in ('b'); +insert into mlparted_tab values (1, 'a'), (2, 'a'), (2, 'b'), (3, 'a'); + +update mlparted_tab mlp set c = 'xxx' +from + (select a from some_tab union all select a+1 from some_tab) ss (a) +where (mlp.a = ss.a and mlp.b = 'b') or mlp.a = 3; +select tableoid::regclass::text as relname, mlparted_tab.* from mlparted_tab order by 1,2; + +drop table mlparted_tab; +drop table some_tab cascade; + +/* Test multiple inheritance of column defaults */ + +CREATE TABLE firstparent (tomorrow date default now()::date + 1); +CREATE TABLE secondparent (tomorrow date default now() :: date + 1); +CREATE TABLE jointchild () INHERITS (firstparent, secondparent); -- ok +CREATE TABLE thirdparent (tomorrow date default now()::date - 1); +CREATE TABLE otherchild () INHERITS (firstparent, thirdparent); -- not ok +CREATE TABLE otherchild (tomorrow date default now()) + INHERITS (firstparent, thirdparent); -- ok, child resolves ambiguous default + +DROP TABLE firstparent, secondparent, jointchild, thirdparent, otherchild; + +-- Test changing the type of inherited columns +insert into d values('test','one','two','three'); +alter table a alter column aa type integer using bit_length(aa); +select * from d; + +-- The above verified that we can change the type of a multiply-inherited +-- column; but we should reject that if any definition was inherited from +-- an unrelated parent. +create temp table parent1(f1 int, f2 int); +create temp table parent2(f1 int, f3 bigint); +create temp table childtab(f4 int) inherits(parent1, parent2); +alter table parent1 alter column f1 type bigint; -- fail, conflict w/parent2 +alter table parent1 alter column f2 type bigint; -- ok + +-- Test non-inheritable parent constraints +create table p1(ff1 int); +alter table p1 add constraint p1chk check (ff1 > 0) no inherit; +alter table p1 add constraint p2chk check (ff1 > 10); +-- connoinherit should be true for NO INHERIT constraint +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pgc.connoinherit from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname = 'p1' order by 1,2; + +-- Test that child does not inherit NO INHERIT constraints +create table c1 () inherits (p1); +\d p1 +\d c1 + +-- Test that child does not override inheritable constraints of the parent +create table c2 (constraint p2chk check (ff1 > 10) no inherit) inherits (p1); --fails + +drop table p1 cascade; + +-- Tests for casting between the rowtypes of parent and child +-- tables. See the pgsql-hackers thread beginning Dec. 4/04 +create table base (i integer); +create table derived () inherits (base); +create table more_derived (like derived, b int) inherits (derived); +insert into derived (i) values (0); +select derived::base from derived; +select NULL::derived::base; +-- remove redundant conversions. +explain (verbose on, costs off) select row(i, b)::more_derived::derived::base from more_derived; +explain (verbose on, costs off) select (1, 2)::more_derived::derived::base; +drop table more_derived; +drop table derived; +drop table base; + +create table p1(ff1 int); +create table p2(f1 text); +create function p2text(p2) returns text as 'select $1.f1' language sql; +create table c1(f3 int) inherits(p1,p2); +insert into c1 values(123456789, 'hi', 42); +select p2text(c1.*) from c1; +drop function p2text(p2); +drop table c1; +drop table p2; +drop table p1; + +CREATE TABLE ac (aa TEXT); +alter table ac add constraint ac_check check (aa is not null); +CREATE TABLE bc (bb TEXT) INHERITS (ac); +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc') order by 1,2; + +insert into ac (aa) values (NULL); +insert into bc (aa) values (NULL); + +alter table bc drop constraint ac_check; -- fail, disallowed +alter table ac drop constraint ac_check; +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc') order by 1,2; + +-- try the unnamed-constraint case +alter table ac add check (aa is not null); +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc') order by 1,2; + +insert into ac (aa) values (NULL); +insert into bc (aa) values (NULL); + +alter table bc drop constraint ac_aa_check; -- fail, disallowed +alter table ac drop constraint ac_aa_check; +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc') order by 1,2; + +alter table ac add constraint ac_check check (aa is not null); +alter table bc no inherit ac; +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc') order by 1,2; +alter table bc drop constraint ac_check; +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc') order by 1,2; +alter table ac drop constraint ac_check; +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc') order by 1,2; + +drop table bc; +drop table ac; + +create table ac (a int constraint check_a check (a <> 0)); +create table bc (a int constraint check_a check (a <> 0), b int constraint check_b check (b <> 0)) inherits (ac); +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc') order by 1,2; + +drop table bc; +drop table ac; + +create table ac (a int constraint check_a check (a <> 0)); +create table bc (b int constraint check_b check (b <> 0)); +create table cc (c int constraint check_c check (c <> 0)) inherits (ac, bc); +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc', 'cc') order by 1,2; + +alter table cc no inherit bc; +select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg_get_expr(pgc.conbin, pc.oid) as consrc from pg_class as pc inner join pg_constraint as pgc on (pgc.conrelid = pc.oid) where pc.relname in ('ac', 'bc', 'cc') order by 1,2; + +drop table cc; +drop table bc; +drop table ac; + +create table p1(f1 int); +create table p2(f2 int); +create table c1(f3 int) inherits(p1,p2); +insert into c1 values(1,-1,2); +alter table p2 add constraint cc check (f2>0); -- fail +alter table p2 add check (f2>0); -- check it without a name, too +delete from c1; +insert into c1 values(1,1,2); +alter table p2 add check (f2>0); +insert into c1 values(1,-1,2); -- fail +create table c2(f3 int) inherits(p1,p2); +\d c2 +create table c3 (f4 int) inherits(c1,c2); +\d c3 +drop table p1 cascade; +drop table p2 cascade; + +create table pp1 (f1 int); +create table cc1 (f2 text, f3 int) inherits (pp1); +alter table pp1 add column a1 int check (a1 > 0); +\d cc1 +create table cc2(f4 float) inherits(pp1,cc1); +\d cc2 +alter table pp1 add column a2 int check (a2 > 0); +\d cc2 +drop table pp1 cascade; + +-- Test for renaming in simple multiple inheritance +CREATE TABLE inht1 (a int, b int); +CREATE TABLE inhs1 (b int, c int); +CREATE TABLE inhts (d int) INHERITS (inht1, inhs1); + +ALTER TABLE inht1 RENAME a TO aa; +ALTER TABLE inht1 RENAME b TO bb; -- to be failed +ALTER TABLE inhts RENAME aa TO aaa; -- to be failed +ALTER TABLE inhts RENAME d TO dd; +\d+ inhts + +DROP TABLE inhts; + +-- Test for renaming in diamond inheritance +CREATE TABLE inht2 (x int) INHERITS (inht1); +CREATE TABLE inht3 (y int) INHERITS (inht1); +CREATE TABLE inht4 (z int) INHERITS (inht2, inht3); + +ALTER TABLE inht1 RENAME aa TO aaa; +\d+ inht4 + +CREATE TABLE inhts (d int) INHERITS (inht2, inhs1); +ALTER TABLE inht1 RENAME aaa TO aaaa; +ALTER TABLE inht1 RENAME b TO bb; -- to be failed +\d+ inhts + +WITH RECURSIVE r AS ( + SELECT 'inht1'::regclass AS inhrelid +UNION ALL + SELECT c.inhrelid FROM pg_inherits c, r WHERE r.inhrelid = c.inhparent +) +SELECT a.attrelid::regclass, a.attname, a.attinhcount, e.expected + FROM (SELECT inhrelid, count(*) AS expected FROM pg_inherits + WHERE inhparent IN (SELECT inhrelid FROM r) GROUP BY inhrelid) e + JOIN pg_attribute a ON e.inhrelid = a.attrelid WHERE NOT attislocal + ORDER BY a.attrelid::regclass::name, a.attnum; + +DROP TABLE inht1, inhs1 CASCADE; + + +-- Test non-inheritable indices [UNIQUE, EXCLUDE] constraints +CREATE TABLE test_constraints (id int, val1 varchar, val2 int, UNIQUE(val1, val2)); +CREATE TABLE test_constraints_inh () INHERITS (test_constraints); +\d+ test_constraints +ALTER TABLE ONLY test_constraints DROP CONSTRAINT test_constraints_val1_val2_key; +\d+ test_constraints +\d+ test_constraints_inh +DROP TABLE test_constraints_inh; +DROP TABLE test_constraints; + +CREATE TABLE test_ex_constraints ( + c circle, + EXCLUDE USING gist (c WITH &&) +); +CREATE TABLE test_ex_constraints_inh () INHERITS (test_ex_constraints); +\d+ test_ex_constraints +ALTER TABLE test_ex_constraints DROP CONSTRAINT test_ex_constraints_c_excl; +\d+ test_ex_constraints +\d+ test_ex_constraints_inh +DROP TABLE test_ex_constraints_inh; +DROP TABLE test_ex_constraints; + +-- Test non-inheritable foreign key constraints +CREATE TABLE test_primary_constraints(id int PRIMARY KEY); +CREATE TABLE test_foreign_constraints(id1 int REFERENCES test_primary_constraints(id)); +CREATE TABLE test_foreign_constraints_inh () INHERITS (test_foreign_constraints); +\d+ test_primary_constraints +\d+ test_foreign_constraints +ALTER TABLE test_foreign_constraints DROP CONSTRAINT test_foreign_constraints_id1_fkey; +\d+ test_foreign_constraints +\d+ test_foreign_constraints_inh +DROP TABLE test_foreign_constraints_inh; +DROP TABLE test_foreign_constraints; +DROP TABLE test_primary_constraints; + +-- Test foreign key behavior +create table inh_fk_1 (a int primary key); +insert into inh_fk_1 values (1), (2), (3); +create table inh_fk_2 (x int primary key, y int references inh_fk_1 on delete cascade); +insert into inh_fk_2 values (11, 1), (22, 2), (33, 3); +create table inh_fk_2_child () inherits (inh_fk_2); +insert into inh_fk_2_child values (111, 1), (222, 2); +delete from inh_fk_1 where a = 1; +select * from inh_fk_1 order by 1; +select * from inh_fk_2 order by 1, 2; +drop table inh_fk_1, inh_fk_2, inh_fk_2_child; + +-- Test that parent and child CHECK constraints can be created in either order +create table p1(f1 int); +create table p1_c1() inherits(p1); + +alter table p1 add constraint inh_check_constraint1 check (f1 > 0); +alter table p1_c1 add constraint inh_check_constraint1 check (f1 > 0); + +alter table p1_c1 add constraint inh_check_constraint2 check (f1 < 10); +alter table p1 add constraint inh_check_constraint2 check (f1 < 10); + +select conrelid::regclass::text as relname, conname, conislocal, coninhcount +from pg_constraint where conname like 'inh\_check\_constraint%' +order by 1, 2; + +drop table p1 cascade; + +-- Test that a valid child can have not-valid parent, but not vice versa +create table invalid_check_con(f1 int); +create table invalid_check_con_child() inherits(invalid_check_con); + +alter table invalid_check_con_child add constraint inh_check_constraint check(f1 > 0) not valid; +alter table invalid_check_con add constraint inh_check_constraint check(f1 > 0); -- fail +alter table invalid_check_con_child drop constraint inh_check_constraint; + +insert into invalid_check_con values(0); + +alter table invalid_check_con_child add constraint inh_check_constraint check(f1 > 0); +alter table invalid_check_con add constraint inh_check_constraint check(f1 > 0) not valid; + +insert into invalid_check_con values(0); -- fail +insert into invalid_check_con_child values(0); -- fail + +select conrelid::regclass::text as relname, conname, + convalidated, conislocal, coninhcount, connoinherit +from pg_constraint where conname like 'inh\_check\_constraint%' +order by 1, 2; + +-- We don't drop the invalid_check_con* tables, to test dump/reload with + +-- +-- Test parameterized append plans for inheritance trees +-- + +create temp table patest0 (id, x) as + select x, x from generate_series(0,1000) x; +create temp table patest1() inherits (patest0); +insert into patest1 + select x, x from generate_series(0,1000) x; +create temp table patest2() inherits (patest0); +insert into patest2 + select x, x from generate_series(0,1000) x; +create index patest0i on patest0(id); +create index patest1i on patest1(id); +create index patest2i on patest2(id); +analyze patest0; +analyze patest1; +analyze patest2; + +explain (costs off) +select * from patest0 join (select f1 from int4_tbl limit 1) ss on id = f1; +select * from patest0 join (select f1 from int4_tbl limit 1) ss on id = f1; + +drop index patest2i; + +explain (costs off) +select * from patest0 join (select f1 from int4_tbl limit 1) ss on id = f1; +select * from patest0 join (select f1 from int4_tbl limit 1) ss on id = f1; + +drop table patest0 cascade; + +-- +-- Test merge-append plans for inheritance trees +-- + +create table matest0 (id serial primary key, name text); +create table matest1 (id integer primary key) inherits (matest0); +create table matest2 (id integer primary key) inherits (matest0); +create table matest3 (id integer primary key) inherits (matest0); + +create index matest0i on matest0 ((1-id)); +create index matest1i on matest1 ((1-id)); +-- create index matest2i on matest2 ((1-id)); -- intentionally missing +create index matest3i on matest3 ((1-id)); + +insert into matest1 (name) values ('Test 1'); +insert into matest1 (name) values ('Test 2'); +insert into matest2 (name) values ('Test 3'); +insert into matest2 (name) values ('Test 4'); +insert into matest3 (name) values ('Test 5'); +insert into matest3 (name) values ('Test 6'); + +set enable_indexscan = off; -- force use of seqscan/sort, so no merge +explain (verbose, costs off) select * from matest0 order by 1-id; +select * from matest0 order by 1-id; +explain (verbose, costs off) select min(1-id) from matest0; +select min(1-id) from matest0; +reset enable_indexscan; + +set enable_seqscan = off; -- plan with fewest seqscans should be merge +set enable_parallel_append = off; -- Don't let parallel-append interfere +explain (verbose, costs off) select * from matest0 order by 1-id; +select * from matest0 order by 1-id; +explain (verbose, costs off) select min(1-id) from matest0; +select min(1-id) from matest0; +reset enable_seqscan; +reset enable_parallel_append; + +drop table matest0 cascade; + +-- +-- Check that use of an index with an extraneous column doesn't produce +-- a plan with extraneous sorting +-- + +create table matest0 (a int, b int, c int, d int); +create table matest1 () inherits(matest0); +create index matest0i on matest0 (b, c); +create index matest1i on matest1 (b, c); + +set enable_nestloop = off; -- we want a plan with two MergeAppends + +explain (costs off) +select t1.* from matest0 t1, matest0 t2 +where t1.b = t2.b and t2.c = t2.d +order by t1.b limit 10; + +reset enable_nestloop; + +drop table matest0 cascade; + +-- +-- Test merge-append for UNION ALL append relations +-- + +set enable_seqscan = off; +set enable_indexscan = on; +set enable_bitmapscan = off; + +-- Check handling of duplicated, constant, or volatile targetlist items +explain (costs off) +SELECT thousand, tenthous FROM tenk1 +UNION ALL +SELECT thousand, thousand FROM tenk1 +ORDER BY thousand, tenthous; + +explain (costs off) +SELECT thousand, tenthous, thousand+tenthous AS x FROM tenk1 +UNION ALL +SELECT 42, 42, hundred FROM tenk1 +ORDER BY thousand, tenthous; + +explain (costs off) +SELECT thousand, tenthous FROM tenk1 +UNION ALL +SELECT thousand, random()::integer FROM tenk1 +ORDER BY thousand, tenthous; + +-- Check min/max aggregate optimization +explain (costs off) +SELECT min(x) FROM + (SELECT unique1 AS x FROM tenk1 a + UNION ALL + SELECT unique2 AS x FROM tenk1 b) s; + +explain (costs off) +SELECT min(y) FROM + (SELECT unique1 AS x, unique1 AS y FROM tenk1 a + UNION ALL + SELECT unique2 AS x, unique2 AS y FROM tenk1 b) s; + +-- XXX planner doesn't recognize that index on unique2 is sufficiently sorted +explain (costs off) +SELECT x, y FROM + (SELECT thousand AS x, tenthous AS y FROM tenk1 a + UNION ALL + SELECT unique2 AS x, unique2 AS y FROM tenk1 b) s +ORDER BY x, y; + +-- exercise rescan code path via a repeatedly-evaluated subquery +explain (costs off) +SELECT + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) + UNION ALL + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) + ) f(i) + ORDER BY f.i LIMIT 10) +FROM generate_series(1, 3) g(i); + +SELECT + ARRAY(SELECT f.i FROM ( + (SELECT d + g.i FROM generate_series(4, 30, 3) d ORDER BY 1) + UNION ALL + (SELECT d + g.i FROM generate_series(0, 30, 5) d ORDER BY 1) + ) f(i) + ORDER BY f.i LIMIT 10) +FROM generate_series(1, 3) g(i); + +reset enable_seqscan; +reset enable_indexscan; +reset enable_bitmapscan; + +-- +-- Check handling of a constant-null CHECK constraint +-- +create table cnullparent (f1 int); +create table cnullchild (check (f1 = 1 or f1 = null)) inherits(cnullparent); +insert into cnullchild values(1); +insert into cnullchild values(2); +insert into cnullchild values(null); +select * from cnullparent; +select * from cnullparent where f1 = 2; +drop table cnullparent cascade; + +-- +-- Check use of temporary tables with inheritance trees +-- +create table inh_perm_parent (a1 int); +create temp table inh_temp_parent (a1 int); +create temp table inh_temp_child () inherits (inh_perm_parent); -- ok +create table inh_perm_child () inherits (inh_temp_parent); -- error +create temp table inh_temp_child_2 () inherits (inh_temp_parent); -- ok +insert into inh_perm_parent values (1); +insert into inh_temp_parent values (2); +insert into inh_temp_child values (3); +insert into inh_temp_child_2 values (4); +select tableoid::regclass, a1 from inh_perm_parent; +select tableoid::regclass, a1 from inh_temp_parent; +drop table inh_perm_parent cascade; +drop table inh_temp_parent cascade; + +-- +-- Check that constraint exclusion works correctly with partitions using +-- implicit constraints generated from the partition bound information. +-- +create table list_parted ( + a varchar +) partition by list (a); +create table part_ab_cd partition of list_parted for values in ('ab', 'cd'); +create table part_ef_gh partition of list_parted for values in ('ef', 'gh'); +create table part_null_xy partition of list_parted for values in (null, 'xy'); + +explain (costs off) select * from list_parted; +explain (costs off) select * from list_parted where a is null; +explain (costs off) select * from list_parted where a is not null; +explain (costs off) select * from list_parted where a in ('ab', 'cd', 'ef'); +explain (costs off) select * from list_parted where a = 'ab' or a in (null, 'cd'); +explain (costs off) select * from list_parted where a = 'ab'; + +create table range_list_parted ( + a int, + b char(2) +) partition by range (a); +create table part_1_10 partition of range_list_parted for values from (1) to (10) partition by list (b); +create table part_1_10_ab partition of part_1_10 for values in ('ab'); +create table part_1_10_cd partition of part_1_10 for values in ('cd'); +create table part_10_20 partition of range_list_parted for values from (10) to (20) partition by list (b); +create table part_10_20_ab partition of part_10_20 for values in ('ab'); +create table part_10_20_cd partition of part_10_20 for values in ('cd'); +create table part_21_30 partition of range_list_parted for values from (21) to (30) partition by list (b); +create table part_21_30_ab partition of part_21_30 for values in ('ab'); +create table part_21_30_cd partition of part_21_30 for values in ('cd'); +create table part_40_inf partition of range_list_parted for values from (40) to (maxvalue) partition by list (b); +create table part_40_inf_ab partition of part_40_inf for values in ('ab'); +create table part_40_inf_cd partition of part_40_inf for values in ('cd'); +create table part_40_inf_null partition of part_40_inf for values in (null); + +explain (costs off) select * from range_list_parted; +explain (costs off) select * from range_list_parted where a = 5; +explain (costs off) select * from range_list_parted where b = 'ab'; +explain (costs off) select * from range_list_parted where a between 3 and 23 and b in ('ab'); + +/* Should select no rows because range partition key cannot be null */ +explain (costs off) select * from range_list_parted where a is null; + +/* Should only select rows from the null-accepting partition */ +explain (costs off) select * from range_list_parted where b is null; +explain (costs off) select * from range_list_parted where a is not null and a < 67; +explain (costs off) select * from range_list_parted where a >= 30; + +drop table list_parted; +drop table range_list_parted; + +-- check that constraint exclusion is able to cope with the partition +-- constraint emitted for multi-column range partitioned tables +create table mcrparted (a int, b int, c int) partition by range (a, abs(b), c); +create table mcrparted_def partition of mcrparted default; +create table mcrparted0 partition of mcrparted for values from (minvalue, minvalue, minvalue) to (1, 1, 1); +create table mcrparted1 partition of mcrparted for values from (1, 1, 1) to (10, 5, 10); +create table mcrparted2 partition of mcrparted for values from (10, 5, 10) to (10, 10, 10); +create table mcrparted3 partition of mcrparted for values from (11, 1, 1) to (20, 10, 10); +create table mcrparted4 partition of mcrparted for values from (20, 10, 10) to (20, 20, 20); +create table mcrparted5 partition of mcrparted for values from (20, 20, 20) to (maxvalue, maxvalue, maxvalue); +explain (costs off) select * from mcrparted where a = 0; -- scans mcrparted0, mcrparted_def +explain (costs off) select * from mcrparted where a = 10 and abs(b) < 5; -- scans mcrparted1, mcrparted_def +explain (costs off) select * from mcrparted where a = 10 and abs(b) = 5; -- scans mcrparted1, mcrparted2, mcrparted_def +explain (costs off) select * from mcrparted where abs(b) = 5; -- scans all partitions +explain (costs off) select * from mcrparted where a > -1; -- scans all partitions +explain (costs off) select * from mcrparted where a = 20 and abs(b) = 10 and c > 10; -- scans mcrparted4 +explain (costs off) select * from mcrparted where a = 20 and c > 20; -- scans mcrparted3, mcrparte4, mcrparte5, mcrparted_def + +-- check that partitioned table Appends cope with being referenced in +-- subplans +create table parted_minmax (a int, b varchar(16)) partition by range (a); +create table parted_minmax1 partition of parted_minmax for values from (1) to (10); +create index parted_minmax1i on parted_minmax1 (a, b); +insert into parted_minmax values (1,'12345'); +explain (costs off) select min(a), max(a) from parted_minmax where b = '12345'; +select min(a), max(a) from parted_minmax where b = '12345'; +drop table parted_minmax; + +-- Test code that uses Append nodes in place of MergeAppend when the +-- partition ordering matches the desired ordering. + +create index mcrparted_a_abs_c_idx on mcrparted (a, abs(b), c); + +-- MergeAppend must be used when a default partition exists +explain (costs off) select * from mcrparted order by a, abs(b), c; + +drop table mcrparted_def; + +-- Append is used for a RANGE partitioned table with no default +-- and no subpartitions +explain (costs off) select * from mcrparted order by a, abs(b), c; + +-- Append is used with subpaths in reverse order with backwards index scans +explain (costs off) select * from mcrparted order by a desc, abs(b) desc, c desc; + +-- check that Append plan is used containing a MergeAppend for sub-partitions +-- that are unordered. +drop table mcrparted5; +create table mcrparted5 partition of mcrparted for values from (20, 20, 20) to (maxvalue, maxvalue, maxvalue) partition by list (a); +create table mcrparted5a partition of mcrparted5 for values in(20); +create table mcrparted5_def partition of mcrparted5 default; + +explain (costs off) select * from mcrparted order by a, abs(b), c; + +drop table mcrparted5_def; + +-- check that an Append plan is used and the sub-partitions are flattened +-- into the main Append when the sub-partition is unordered but contains +-- just a single sub-partition. +explain (costs off) select a, abs(b) from mcrparted order by a, abs(b), c; + +-- check that Append is used when the sub-partitioned tables are pruned +-- during planning. +explain (costs off) select * from mcrparted where a < 20 order by a, abs(b), c; + +create table mclparted (a int) partition by list(a); +create table mclparted1 partition of mclparted for values in(1); +create table mclparted2 partition of mclparted for values in(2); +create index on mclparted (a); + +-- Ensure an Append is used for a list partition with an order by. +explain (costs off) select * from mclparted order by a; + +-- Ensure a MergeAppend is used when a partition exists with interleaved +-- datums in the partition bound. +create table mclparted3_5 partition of mclparted for values in(3,5); +create table mclparted4 partition of mclparted for values in(4); + +explain (costs off) select * from mclparted order by a; + +drop table mclparted; + +-- Ensure subplans which don't have a path with the correct pathkeys get +-- sorted correctly. +drop index mcrparted_a_abs_c_idx; +create index on mcrparted1 (a, abs(b), c); +create index on mcrparted2 (a, abs(b), c); +create index on mcrparted3 (a, abs(b), c); +create index on mcrparted4 (a, abs(b), c); + +explain (costs off) select * from mcrparted where a < 20 order by a, abs(b), c limit 1; + +set enable_bitmapscan = 0; +-- Ensure Append node can be used when the partition is ordered by some +-- pathkeys which were deemed redundant. +explain (costs off) select * from mcrparted where a = 10 order by a, abs(b), c; +reset enable_bitmapscan; + +drop table mcrparted; + +-- Ensure LIST partitions allow an Append to be used instead of a MergeAppend +create table bool_lp (b bool) partition by list(b); +create table bool_lp_true partition of bool_lp for values in(true); +create table bool_lp_false partition of bool_lp for values in(false); +create index on bool_lp (b); + +explain (costs off) select * from bool_lp order by b; + +drop table bool_lp; + +-- Ensure const bool quals can be properly detected as redundant +create table bool_rp (b bool, a int) partition by range(b,a); +create table bool_rp_false_1k partition of bool_rp for values from (false,0) to (false,1000); +create table bool_rp_true_1k partition of bool_rp for values from (true,0) to (true,1000); +create table bool_rp_false_2k partition of bool_rp for values from (false,1000) to (false,2000); +create table bool_rp_true_2k partition of bool_rp for values from (true,1000) to (true,2000); +create index on bool_rp (b,a); +explain (costs off) select * from bool_rp where b = true order by b,a; +explain (costs off) select * from bool_rp where b = false order by b,a; +explain (costs off) select * from bool_rp where b = true order by a; +explain (costs off) select * from bool_rp where b = false order by a; + +drop table bool_rp; + +-- Ensure an Append scan is chosen when the partition order is a subset of +-- the required order. +create table range_parted (a int, b int, c int) partition by range(a, b); +create table range_parted1 partition of range_parted for values from (0,0) to (10,10); +create table range_parted2 partition of range_parted for values from (10,10) to (20,20); +create index on range_parted (a,b,c); + +explain (costs off) select * from range_parted order by a,b,c; +explain (costs off) select * from range_parted order by a desc,b desc,c desc; + +drop table range_parted; + +-- Check that we allow access to a child table's statistics when the user +-- has permissions only for the parent table. +create table permtest_parent (a int, b text, c text) partition by list (a); +create table permtest_child (b text, c text, a int) partition by list (b); +create table permtest_grandchild (c text, b text, a int); +alter table permtest_child attach partition permtest_grandchild for values in ('a'); +alter table permtest_parent attach partition permtest_child for values in (1); +create index on permtest_parent (left(c, 3)); +insert into permtest_parent + select 1, 'a', left(md5(i::text), 5) from generate_series(0, 100) i; +analyze permtest_parent; +create role regress_no_child_access; +revoke all on permtest_grandchild from regress_no_child_access; +grant select on permtest_parent to regress_no_child_access; +set session authorization regress_no_child_access; +-- without stats access, these queries would produce hash join plans: +explain (costs off) + select * from permtest_parent p1 inner join permtest_parent p2 + on p1.a = p2.a and p1.c ~ 'a1$'; +explain (costs off) + select * from permtest_parent p1 inner join permtest_parent p2 + on p1.a = p2.a and left(p1.c, 3) ~ 'a1$'; +reset session authorization; +revoke all on permtest_parent from regress_no_child_access; +grant select(a,c) on permtest_parent to regress_no_child_access; +set session authorization regress_no_child_access; +explain (costs off) + select p2.a, p1.c from permtest_parent p1 inner join permtest_parent p2 + on p1.a = p2.a and p1.c ~ 'a1$'; +-- we will not have access to the expression index's stats here: +explain (costs off) + select p2.a, p1.c from permtest_parent p1 inner join permtest_parent p2 + on p1.a = p2.a and left(p1.c, 3) ~ 'a1$'; +reset session authorization; +revoke all on permtest_parent from regress_no_child_access; +drop role regress_no_child_access; +drop table permtest_parent; + +-- Verify that constraint errors across partition root / child are +-- handled correctly (Bug #16293) +CREATE TABLE errtst_parent ( + partid int not null, + shdata int not null, + data int NOT NULL DEFAULT 0, + CONSTRAINT shdata_small CHECK(shdata < 3) +) PARTITION BY RANGE (partid); + +-- fast defaults lead to attribute mapping being used in one +-- direction, but not the other +CREATE TABLE errtst_child_fastdef ( + partid int not null, + shdata int not null, + CONSTRAINT shdata_small CHECK(shdata < 3) +); + +-- no remapping in either direction necessary +CREATE TABLE errtst_child_plaindef ( + partid int not null, + shdata int not null, + data int NOT NULL DEFAULT 0, + CONSTRAINT shdata_small CHECK(shdata < 3), + CHECK(data < 10) +); + +-- remapping in both direction +CREATE TABLE errtst_child_reorder ( + data int NOT NULL DEFAULT 0, + shdata int not null, + partid int not null, + CONSTRAINT shdata_small CHECK(shdata < 3), + CHECK(data < 10) +); + +ALTER TABLE errtst_child_fastdef ADD COLUMN data int NOT NULL DEFAULT 0; +ALTER TABLE errtst_child_fastdef ADD CONSTRAINT errtest_child_fastdef_data_check CHECK (data < 10); + +ALTER TABLE errtst_parent ATTACH PARTITION errtst_child_fastdef FOR VALUES FROM (0) TO (10); +ALTER TABLE errtst_parent ATTACH PARTITION errtst_child_plaindef FOR VALUES FROM (10) TO (20); +ALTER TABLE errtst_parent ATTACH PARTITION errtst_child_reorder FOR VALUES FROM (20) TO (30); + +-- insert without child check constraint error +INSERT INTO errtst_parent(partid, shdata, data) VALUES ( '0', '1', '5'); +INSERT INTO errtst_parent(partid, shdata, data) VALUES ('10', '1', '5'); +INSERT INTO errtst_parent(partid, shdata, data) VALUES ('20', '1', '5'); + +-- insert with child check constraint error +INSERT INTO errtst_parent(partid, shdata, data) VALUES ( '0', '1', '10'); +INSERT INTO errtst_parent(partid, shdata, data) VALUES ('10', '1', '10'); +INSERT INTO errtst_parent(partid, shdata, data) VALUES ('20', '1', '10'); + +-- insert with child not null constraint error +INSERT INTO errtst_parent(partid, shdata, data) VALUES ( '0', '1', NULL); +INSERT INTO errtst_parent(partid, shdata, data) VALUES ('10', '1', NULL); +INSERT INTO errtst_parent(partid, shdata, data) VALUES ('20', '1', NULL); + +-- insert with shared check constraint error +INSERT INTO errtst_parent(partid, shdata, data) VALUES ( '0', '5', '5'); +INSERT INTO errtst_parent(partid, shdata, data) VALUES ('10', '5', '5'); +INSERT INTO errtst_parent(partid, shdata, data) VALUES ('20', '5', '5'); + +-- within partition update without child check constraint violation +BEGIN; +UPDATE errtst_parent SET data = data + 1 WHERE partid = 0; +UPDATE errtst_parent SET data = data + 1 WHERE partid = 10; +UPDATE errtst_parent SET data = data + 1 WHERE partid = 20; +ROLLBACK; + +-- within partition update with child check constraint violation +UPDATE errtst_parent SET data = data + 10 WHERE partid = 0; +UPDATE errtst_parent SET data = data + 10 WHERE partid = 10; +UPDATE errtst_parent SET data = data + 10 WHERE partid = 20; + +-- direct leaf partition update, without partition id violation +BEGIN; +UPDATE errtst_child_fastdef SET partid = 1 WHERE partid = 0; +UPDATE errtst_child_plaindef SET partid = 11 WHERE partid = 10; +UPDATE errtst_child_reorder SET partid = 21 WHERE partid = 20; +ROLLBACK; + +-- direct leaf partition update, with partition id violation +UPDATE errtst_child_fastdef SET partid = partid + 10 WHERE partid = 0; +UPDATE errtst_child_plaindef SET partid = partid + 10 WHERE partid = 10; +UPDATE errtst_child_reorder SET partid = partid + 10 WHERE partid = 20; + +-- partition move, without child check constraint violation +BEGIN; +UPDATE errtst_parent SET partid = 10, data = data + 1 WHERE partid = 0; +UPDATE errtst_parent SET partid = 20, data = data + 1 WHERE partid = 10; +UPDATE errtst_parent SET partid = 0, data = data + 1 WHERE partid = 20; +ROLLBACK; + +-- partition move, with child check constraint violation +UPDATE errtst_parent SET partid = 10, data = data + 10 WHERE partid = 0; +UPDATE errtst_parent SET partid = 20, data = data + 10 WHERE partid = 10; +UPDATE errtst_parent SET partid = 0, data = data + 10 WHERE partid = 20; + +-- partition move, without target partition +UPDATE errtst_parent SET partid = 30, data = data + 10 WHERE partid = 20; + +DROP TABLE errtst_parent; diff --git a/postgresql/examples/init_privs.sql b/postgresql/examples/init_privs.sql new file mode 100644 index 0000000..4a31af2 --- /dev/null +++ b/postgresql/examples/init_privs.sql @@ -0,0 +1,10 @@ +-- Test initial privileges + +-- There should always be some initial privileges, set up by initdb +SELECT count(*) > 0 FROM pg_init_privs; + +-- Intentionally include some non-initial privs for pg_dump to dump out +GRANT SELECT ON pg_proc TO CURRENT_USER; +GRANT SELECT (prosrc) ON pg_proc TO CURRENT_USER; + +GRANT SELECT (rolname, rolsuper) ON pg_authid TO CURRENT_USER; diff --git a/postgresql/examples/insert.sql b/postgresql/examples/insert.sql new file mode 100644 index 0000000..67c263c --- /dev/null +++ b/postgresql/examples/insert.sql @@ -0,0 +1,608 @@ +-- +-- insert with DEFAULT in the target_list +-- +create table inserttest (col1 int4, col2 int4 NOT NULL, col3 text default 'testing'); +insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT, DEFAULT); +insert into inserttest (col2, col3) values (3, DEFAULT); +insert into inserttest (col1, col2, col3) values (DEFAULT, 5, DEFAULT); +insert into inserttest values (DEFAULT, 5, 'test'); +insert into inserttest values (DEFAULT, 7); + +select * from inserttest; + +-- +-- insert with similar expression / target_list values (all fail) +-- +insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT); +insert into inserttest (col1, col2, col3) values (1, 2); +insert into inserttest (col1) values (1, 2); +insert into inserttest (col1) values (DEFAULT, DEFAULT); + +select * from inserttest; + +-- +-- VALUES test +-- +insert into inserttest values(10, 20, '40'), (-1, 2, DEFAULT), + ((select 2), (select i from (values(3)) as foo (i)), 'values are fun!'); + +select * from inserttest; + +-- +-- TOASTed value test +-- +insert into inserttest values(30, 50, repeat('x', 10000)); + +select col1, col2, char_length(col3) from inserttest; + +drop table inserttest; + +-- +-- check indirection (field/array assignment), cf bug #14265 +-- +-- these tests are aware that transformInsertStmt has 3 separate code paths +-- + +create type insert_test_type as (if1 int, if2 text[]); + +create table inserttest (f1 int, f2 int[], + f3 insert_test_type, f4 insert_test_type[]); + +insert into inserttest (f2[1], f2[2]) values (1,2); +insert into inserttest (f2[1], f2[2]) values (3,4), (5,6); +insert into inserttest (f2[1], f2[2]) select 7,8; +insert into inserttest (f2[1], f2[2]) values (1,default); -- not supported + +insert into inserttest (f3.if1, f3.if2) values (1,array['foo']); +insert into inserttest (f3.if1, f3.if2) values (1,'{foo}'), (2,'{bar}'); +insert into inserttest (f3.if1, f3.if2) select 3, '{baz,quux}'; +insert into inserttest (f3.if1, f3.if2) values (1,default); -- not supported + +insert into inserttest (f3.if2[1], f3.if2[2]) values ('foo', 'bar'); +insert into inserttest (f3.if2[1], f3.if2[2]) values ('foo', 'bar'), ('baz', 'quux'); +insert into inserttest (f3.if2[1], f3.if2[2]) select 'bear', 'beer'; + +insert into inserttest (f4[1].if2[1], f4[1].if2[2]) values ('foo', 'bar'); +insert into inserttest (f4[1].if2[1], f4[1].if2[2]) values ('foo', 'bar'), ('baz', 'quux'); +insert into inserttest (f4[1].if2[1], f4[1].if2[2]) select 'bear', 'beer'; + +select * from inserttest; + +-- also check reverse-listing +create table inserttest2 (f1 bigint, f2 text); +create rule irule1 as on insert to inserttest2 do also + insert into inserttest (f3.if2[1], f3.if2[2]) + values (new.f1,new.f2); +create rule irule2 as on insert to inserttest2 do also + insert into inserttest (f4[1].if1, f4[1].if2[2]) + values (1,'fool'),(new.f1,new.f2); +create rule irule3 as on insert to inserttest2 do also + insert into inserttest (f4[1].if1, f4[1].if2[2]) + select new.f1, new.f2; +\d+ inserttest2 + +drop table inserttest2; +drop table inserttest; +drop type insert_test_type; + +-- direct partition inserts should check partition bound constraint +create table range_parted ( + a text, + b int +) partition by range (a, (b+0)); + +-- no partitions, so fail +insert into range_parted values ('a', 11); + +create table part1 partition of range_parted for values from ('a', 1) to ('a', 10); +create table part2 partition of range_parted for values from ('a', 10) to ('a', 20); +create table part3 partition of range_parted for values from ('b', 1) to ('b', 10); +create table part4 partition of range_parted for values from ('b', 10) to ('b', 20); + +-- fail +insert into part1 values ('a', 11); +insert into part1 values ('b', 1); +-- ok +insert into part1 values ('a', 1); +-- fail +insert into part4 values ('b', 21); +insert into part4 values ('a', 10); +-- ok +insert into part4 values ('b', 10); + +-- fail (partition key a has a NOT NULL constraint) +insert into part1 values (null); +-- fail (expression key (b+0) cannot be null either) +insert into part1 values (1); + +create table list_parted ( + a text, + b int +) partition by list (lower(a)); +create table part_aa_bb partition of list_parted FOR VALUES IN ('aa', 'bb'); +create table part_cc_dd partition of list_parted FOR VALUES IN ('cc', 'dd'); +create table part_null partition of list_parted FOR VALUES IN (null); + +-- fail +insert into part_aa_bb values ('cc', 1); +insert into part_aa_bb values ('AAa', 1); +insert into part_aa_bb values (null); +-- ok +insert into part_cc_dd values ('cC', 1); +insert into part_null values (null, 0); + +-- check in case of multi-level partitioned table +create table part_ee_ff partition of list_parted for values in ('ee', 'ff') partition by range (b); +create table part_ee_ff1 partition of part_ee_ff for values from (1) to (10); +create table part_ee_ff2 partition of part_ee_ff for values from (10) to (20); + +-- test default partition +create table part_default partition of list_parted default; +-- Negative test: a row, which would fit in other partition, does not fit +-- default partition, even when inserted directly +insert into part_default values ('aa', 2); +insert into part_default values (null, 2); +-- ok +insert into part_default values ('Zz', 2); +-- test if default partition works as expected for multi-level partitioned +-- table as well as when default partition itself is further partitioned +drop table part_default; +create table part_xx_yy partition of list_parted for values in ('xx', 'yy') partition by list (a); +create table part_xx_yy_p1 partition of part_xx_yy for values in ('xx'); +create table part_xx_yy_defpart partition of part_xx_yy default; +create table part_default partition of list_parted default partition by range(b); +create table part_default_p1 partition of part_default for values from (20) to (30); +create table part_default_p2 partition of part_default for values from (30) to (40); + +-- fail +insert into part_ee_ff1 values ('EE', 11); +insert into part_default_p2 values ('gg', 43); +-- fail (even the parent's, ie, part_ee_ff's partition constraint applies) +insert into part_ee_ff1 values ('cc', 1); +insert into part_default values ('gg', 43); +-- ok +insert into part_ee_ff1 values ('ff', 1); +insert into part_ee_ff2 values ('ff', 11); +insert into part_default_p1 values ('cd', 25); +insert into part_default_p2 values ('de', 35); +insert into list_parted values ('ab', 21); +insert into list_parted values ('xx', 1); +insert into list_parted values ('yy', 2); +select tableoid::regclass, * from list_parted; + +-- Check tuple routing for partitioned tables + +-- fail +insert into range_parted values ('a', 0); +-- ok +insert into range_parted values ('a', 1); +insert into range_parted values ('a', 10); +-- fail +insert into range_parted values ('a', 20); +-- ok +insert into range_parted values ('b', 1); +insert into range_parted values ('b', 10); +-- fail (partition key (b+0) is null) +insert into range_parted values ('a'); + +-- Check default partition +create table part_def partition of range_parted default; +-- fail +insert into part_def values ('b', 10); +-- ok +insert into part_def values ('c', 10); +insert into range_parted values (null, null); +insert into range_parted values ('a', null); +insert into range_parted values (null, 19); +insert into range_parted values ('b', 20); + +select tableoid::regclass, * from range_parted; +-- ok +insert into list_parted values (null, 1); +insert into list_parted (a) values ('aA'); +-- fail (partition of part_ee_ff not found in both cases) +insert into list_parted values ('EE', 0); +insert into part_ee_ff values ('EE', 0); +-- ok +insert into list_parted values ('EE', 1); +insert into part_ee_ff values ('EE', 10); +select tableoid::regclass, * from list_parted; + +-- some more tests to exercise tuple-routing with multi-level partitioning +create table part_gg partition of list_parted for values in ('gg') partition by range (b); +create table part_gg1 partition of part_gg for values from (minvalue) to (1); +create table part_gg2 partition of part_gg for values from (1) to (10) partition by range (b); +create table part_gg2_1 partition of part_gg2 for values from (1) to (5); +create table part_gg2_2 partition of part_gg2 for values from (5) to (10); + +create table part_ee_ff3 partition of part_ee_ff for values from (20) to (30) partition by range (b); +create table part_ee_ff3_1 partition of part_ee_ff3 for values from (20) to (25); +create table part_ee_ff3_2 partition of part_ee_ff3 for values from (25) to (30); + +truncate list_parted; +insert into list_parted values ('aa'), ('cc'); +insert into list_parted select 'Ff', s.a from generate_series(1, 29) s(a); +insert into list_parted select 'gg', s.a from generate_series(1, 9) s(a); +insert into list_parted (b) values (1); +select tableoid::regclass::text, a, min(b) as min_b, max(b) as max_b from list_parted group by 1, 2 order by 1; + +-- direct partition inserts should check hash partition bound constraint + +-- Use hand-rolled hash functions and operator classes to get predictable +-- result on different machines. The hash function for int4 simply returns +-- the sum of the values passed to it and the one for text returns the length +-- of the non-empty string value passed to it or 0. + +create or replace function part_hashint4_noop(value int4, seed int8) +returns int8 as $$ +select value + seed; +$$ language sql immutable; + +create operator class part_test_int4_ops +for type int4 +using hash as +operator 1 =, +function 2 part_hashint4_noop(int4, int8); + +create or replace function part_hashtext_length(value text, seed int8) +RETURNS int8 AS $$ +select length(coalesce(value, ''))::int8 +$$ language sql immutable; + +create operator class part_test_text_ops +for type text +using hash as +operator 1 =, +function 2 part_hashtext_length(text, int8); + +create table hash_parted ( + a int +) partition by hash (a part_test_int4_ops); +create table hpart0 partition of hash_parted for values with (modulus 4, remainder 0); +create table hpart1 partition of hash_parted for values with (modulus 4, remainder 1); +create table hpart2 partition of hash_parted for values with (modulus 4, remainder 2); +create table hpart3 partition of hash_parted for values with (modulus 4, remainder 3); + +insert into hash_parted values(generate_series(1,10)); + +-- direct insert of values divisible by 4 - ok; +insert into hpart0 values(12),(16); +-- fail; +insert into hpart0 values(11); +-- 11 % 4 -> 3 remainder i.e. valid data for hpart3 partition +insert into hpart3 values(11); + +-- view data +select tableoid::regclass as part, a, a%4 as "remainder = a % 4" +from hash_parted order by part; + +-- test \d+ output on a table which has both partitioned and unpartitioned +-- partitions +\d+ list_parted + +-- cleanup +drop table range_parted, list_parted; +drop table hash_parted; + +-- test that a default partition added as the first partition accepts any value +-- including null +create table list_parted (a int) partition by list (a); +create table part_default partition of list_parted default; +\d+ part_default +insert into part_default values (null); +insert into part_default values (1); +insert into part_default values (-1); +select tableoid::regclass, a from list_parted; +-- cleanup +drop table list_parted; + +-- more tests for certain multi-level partitioning scenarios +create table mlparted (a int, b int) partition by range (a, b); +create table mlparted1 (b int not null, a int not null) partition by range ((b+0)); +create table mlparted11 (like mlparted1); +alter table mlparted11 drop a; +alter table mlparted11 add a int; +alter table mlparted11 drop a; +alter table mlparted11 add a int not null; +-- attnum for key attribute 'a' is different in mlparted, mlparted1, and mlparted11 +select attrelid::regclass, attname, attnum +from pg_attribute +where attname = 'a' + and (attrelid = 'mlparted'::regclass + or attrelid = 'mlparted1'::regclass + or attrelid = 'mlparted11'::regclass) +order by attrelid::regclass::text; + +alter table mlparted1 attach partition mlparted11 for values from (2) to (5); +alter table mlparted attach partition mlparted1 for values from (1, 2) to (1, 10); + +-- check that "(1, 2)" is correctly routed to mlparted11. +insert into mlparted values (1, 2); +select tableoid::regclass, * from mlparted; + +-- check that proper message is shown after failure to route through mlparted1 +insert into mlparted (a, b) values (1, 5); + +truncate mlparted; +alter table mlparted add constraint check_b check (b = 3); + +-- have a BR trigger modify the row such that the check_b is violated +create function mlparted11_trig_fn() +returns trigger AS +$$ +begin + NEW.b := 4; + return NEW; +end; +$$ +language plpgsql; +create trigger mlparted11_trig before insert ON mlparted11 + for each row execute procedure mlparted11_trig_fn(); + +-- check that the correct row is shown when constraint check_b fails after +-- "(1, 2)" is routed to mlparted11 (actually "(1, 4)" would be shown due +-- to the BR trigger mlparted11_trig_fn) +insert into mlparted values (1, 2); +drop trigger mlparted11_trig on mlparted11; +drop function mlparted11_trig_fn(); + +-- check that inserting into an internal partition successfully results in +-- checking its partition constraint before inserting into the leaf partition +-- selected by tuple-routing +insert into mlparted1 (a, b) values (2, 3); + +-- check routing error through a list partitioned table when the key is null +create table lparted_nonullpart (a int, b char) partition by list (b); +create table lparted_nonullpart_a partition of lparted_nonullpart for values in ('a'); +insert into lparted_nonullpart values (1); +drop table lparted_nonullpart; + +-- check that RETURNING works correctly with tuple-routing +alter table mlparted drop constraint check_b; +create table mlparted12 partition of mlparted1 for values from (5) to (10); +create table mlparted2 (b int not null, a int not null); +alter table mlparted attach partition mlparted2 for values from (1, 10) to (1, 20); +create table mlparted3 partition of mlparted for values from (1, 20) to (1, 30); +create table mlparted4 (like mlparted); +alter table mlparted4 drop a; +alter table mlparted4 add a int not null; +alter table mlparted attach partition mlparted4 for values from (1, 30) to (1, 40); +with ins (a, b, c) as + (insert into mlparted (b, a) select s.a, 1 from generate_series(2, 39) s(a) returning tableoid::regclass, *) + select a, b, min(c), max(c) from ins group by a, b order by 1; + +alter table mlparted add c text; +create table mlparted5 (c text, a int not null, b int not null) partition by list (c); +create table mlparted5a (a int not null, c text, b int not null); +alter table mlparted5 attach partition mlparted5a for values in ('a'); +alter table mlparted attach partition mlparted5 for values from (1, 40) to (1, 50); +alter table mlparted add constraint check_b check (a = 1 and b < 45); +insert into mlparted values (1, 45, 'a'); +create function mlparted5abrtrig_func() returns trigger as $$ begin new.c = 'b'; return new; end; $$ language plpgsql; +create trigger mlparted5abrtrig before insert on mlparted5a for each row execute procedure mlparted5abrtrig_func(); +insert into mlparted5 (a, b, c) values (1, 40, 'a'); +drop table mlparted5; +alter table mlparted drop constraint check_b; + +-- Check multi-level default partition +create table mlparted_def partition of mlparted default partition by range(a); +create table mlparted_def1 partition of mlparted_def for values from (40) to (50); +create table mlparted_def2 partition of mlparted_def for values from (50) to (60); +insert into mlparted values (40, 100); +insert into mlparted_def1 values (42, 100); +insert into mlparted_def2 values (54, 50); +-- fail +insert into mlparted values (70, 100); +insert into mlparted_def1 values (52, 50); +insert into mlparted_def2 values (34, 50); +-- ok +create table mlparted_defd partition of mlparted_def default; +insert into mlparted values (70, 100); + +select tableoid::regclass, * from mlparted_def; + +-- Check multi-level tuple routing with attributes dropped from the +-- top-most parent. First remove the last attribute. +alter table mlparted add d int, add e int; +alter table mlparted drop e; +create table mlparted5 partition of mlparted + for values from (1, 40) to (1, 50) partition by range (c); +create table mlparted5_ab partition of mlparted5 + for values from ('a') to ('c') partition by list (c); +-- This partitioned table should remain with no partitions. +create table mlparted5_cd partition of mlparted5 + for values from ('c') to ('e') partition by list (c); +create table mlparted5_a partition of mlparted5_ab for values in ('a'); +create table mlparted5_b (d int, b int, c text, a int); +alter table mlparted5_ab attach partition mlparted5_b for values in ('b'); +truncate mlparted; +insert into mlparted values (1, 2, 'a', 1); +insert into mlparted values (1, 40, 'a', 1); -- goes to mlparted5_a +insert into mlparted values (1, 45, 'b', 1); -- goes to mlparted5_b +insert into mlparted values (1, 45, 'c', 1); -- goes to mlparted5_cd, fails +insert into mlparted values (1, 45, 'f', 1); -- goes to mlparted5, fails +select tableoid::regclass, * from mlparted order by a, b, c, d; +alter table mlparted drop d; +truncate mlparted; +-- Remove the before last attribute. +alter table mlparted add e int, add d int; +alter table mlparted drop e; +insert into mlparted values (1, 2, 'a', 1); +insert into mlparted values (1, 40, 'a', 1); -- goes to mlparted5_a +insert into mlparted values (1, 45, 'b', 1); -- goes to mlparted5_b +insert into mlparted values (1, 45, 'c', 1); -- goes to mlparted5_cd, fails +insert into mlparted values (1, 45, 'f', 1); -- goes to mlparted5, fails +select tableoid::regclass, * from mlparted order by a, b, c, d; +alter table mlparted drop d; +drop table mlparted5; + +-- check that message shown after failure to find a partition shows the +-- appropriate key description (or none) in various situations +create table key_desc (a int, b int) partition by list ((a+0)); +create table key_desc_1 partition of key_desc for values in (1) partition by range (b); + +create user regress_insert_other_user; +grant select (a) on key_desc_1 to regress_insert_other_user; +grant insert on key_desc to regress_insert_other_user; + +set role regress_insert_other_user; +-- no key description is shown +insert into key_desc values (1, 1); + +reset role; +grant select (b) on key_desc_1 to regress_insert_other_user; +set role regress_insert_other_user; +-- key description (b)=(1) is now shown +insert into key_desc values (1, 1); + +-- key description is not shown if key contains expression +insert into key_desc values (2, 1); +reset role; +revoke all on key_desc from regress_insert_other_user; +revoke all on key_desc_1 from regress_insert_other_user; +drop role regress_insert_other_user; +drop table key_desc, key_desc_1; + +-- test minvalue/maxvalue restrictions +create table mcrparted (a int, b int, c int) partition by range (a, abs(b), c); +create table mcrparted0 partition of mcrparted for values from (minvalue, 0, 0) to (1, maxvalue, maxvalue); +create table mcrparted2 partition of mcrparted for values from (10, 6, minvalue) to (10, maxvalue, minvalue); +create table mcrparted4 partition of mcrparted for values from (21, minvalue, 0) to (30, 20, minvalue); + +-- check multi-column range partitioning expression enforces the same +-- constraint as what tuple-routing would determine it to be +create table mcrparted0 partition of mcrparted for values from (minvalue, minvalue, minvalue) to (1, maxvalue, maxvalue); +create table mcrparted1 partition of mcrparted for values from (2, 1, minvalue) to (10, 5, 10); +create table mcrparted2 partition of mcrparted for values from (10, 6, minvalue) to (10, maxvalue, maxvalue); +create table mcrparted3 partition of mcrparted for values from (11, 1, 1) to (20, 10, 10); +create table mcrparted4 partition of mcrparted for values from (21, minvalue, minvalue) to (30, 20, maxvalue); +create table mcrparted5 partition of mcrparted for values from (30, 21, 20) to (maxvalue, maxvalue, maxvalue); + +-- null not allowed in range partition +insert into mcrparted values (null, null, null); + +-- routed to mcrparted0 +insert into mcrparted values (0, 1, 1); +insert into mcrparted0 values (0, 1, 1); + +-- routed to mcparted1 +insert into mcrparted values (9, 1000, 1); +insert into mcrparted1 values (9, 1000, 1); +insert into mcrparted values (10, 5, -1); +insert into mcrparted1 values (10, 5, -1); +insert into mcrparted values (2, 1, 0); +insert into mcrparted1 values (2, 1, 0); + +-- routed to mcparted2 +insert into mcrparted values (10, 6, 1000); +insert into mcrparted2 values (10, 6, 1000); +insert into mcrparted values (10, 1000, 1000); +insert into mcrparted2 values (10, 1000, 1000); + +-- no partition exists, nor does mcrparted3 accept it +insert into mcrparted values (11, 1, -1); +insert into mcrparted3 values (11, 1, -1); + +-- routed to mcrparted5 +insert into mcrparted values (30, 21, 20); +insert into mcrparted5 values (30, 21, 20); +insert into mcrparted4 values (30, 21, 20); -- error + +-- check rows +select tableoid::regclass::text, * from mcrparted order by 1; + +-- cleanup +drop table mcrparted; + +-- check that a BR constraint can't make partition contain violating rows +create table brtrigpartcon (a int, b text) partition by list (a); +create table brtrigpartcon1 partition of brtrigpartcon for values in (1); +create or replace function brtrigpartcon1trigf() returns trigger as $$begin new.a := 2; return new; end$$ language plpgsql; +create trigger brtrigpartcon1trig before insert on brtrigpartcon1 for each row execute procedure brtrigpartcon1trigf(); +insert into brtrigpartcon values (1, 'hi there'); +insert into brtrigpartcon1 values (1, 'hi there'); + +-- check that the message shows the appropriate column description in a +-- situation where the partitioned table is not the primary ModifyTable node +create table inserttest3 (f1 text default 'foo', f2 text default 'bar', f3 int); +create role regress_coldesc_role; +grant insert on inserttest3 to regress_coldesc_role; +grant insert on brtrigpartcon to regress_coldesc_role; +revoke select on brtrigpartcon from regress_coldesc_role; +set role regress_coldesc_role; +with result as (insert into brtrigpartcon values (1, 'hi there') returning 1) + insert into inserttest3 (f3) select * from result; +reset role; + +-- cleanup +revoke all on inserttest3 from regress_coldesc_role; +revoke all on brtrigpartcon from regress_coldesc_role; +drop role regress_coldesc_role; +drop table inserttest3; +drop table brtrigpartcon; +drop function brtrigpartcon1trigf(); + +-- check that "do nothing" BR triggers work with tuple-routing (this checks +-- that estate->es_result_relation_info is appropriately set/reset for each +-- routed tuple) +create table donothingbrtrig_test (a int, b text) partition by list (a); +create table donothingbrtrig_test1 (b text, a int); +create table donothingbrtrig_test2 (c text, b text, a int); +alter table donothingbrtrig_test2 drop column c; +create or replace function donothingbrtrig_func() returns trigger as $$begin raise notice 'b: %', new.b; return NULL; end$$ language plpgsql; +create trigger donothingbrtrig1 before insert on donothingbrtrig_test1 for each row execute procedure donothingbrtrig_func(); +create trigger donothingbrtrig2 before insert on donothingbrtrig_test2 for each row execute procedure donothingbrtrig_func(); +alter table donothingbrtrig_test attach partition donothingbrtrig_test1 for values in (1); +alter table donothingbrtrig_test attach partition donothingbrtrig_test2 for values in (2); +insert into donothingbrtrig_test values (1, 'foo'), (2, 'bar'); +copy donothingbrtrig_test from stdout; +/* +1 baz +2 qux +\. +*/ +select tableoid::regclass, * from donothingbrtrig_test; + +-- cleanup +drop table donothingbrtrig_test; +drop function donothingbrtrig_func(); + +-- check multi-column range partitioning with minvalue/maxvalue constraints +create table mcrparted (a text, b int) partition by range(a, b); +create table mcrparted1_lt_b partition of mcrparted for values from (minvalue, minvalue) to ('b', minvalue); +create table mcrparted2_b partition of mcrparted for values from ('b', minvalue) to ('c', minvalue); +create table mcrparted3_c_to_common partition of mcrparted for values from ('c', minvalue) to ('common', minvalue); +create table mcrparted4_common_lt_0 partition of mcrparted for values from ('common', minvalue) to ('common', 0); +create table mcrparted5_common_0_to_10 partition of mcrparted for values from ('common', 0) to ('common', 10); +create table mcrparted6_common_ge_10 partition of mcrparted for values from ('common', 10) to ('common', maxvalue); +create table mcrparted7_gt_common_lt_d partition of mcrparted for values from ('common', maxvalue) to ('d', minvalue); +create table mcrparted8_ge_d partition of mcrparted for values from ('d', minvalue) to (maxvalue, maxvalue); + +\d+ mcrparted +\d+ mcrparted1_lt_b +\d+ mcrparted2_b +\d+ mcrparted3_c_to_common +\d+ mcrparted4_common_lt_0 +\d+ mcrparted5_common_0_to_10 +\d+ mcrparted6_common_ge_10 +\d+ mcrparted7_gt_common_lt_d +\d+ mcrparted8_ge_d + +insert into mcrparted values ('aaa', 0), ('b', 0), ('bz', 10), ('c', -10), + ('comm', -10), ('common', -10), ('common', 0), ('common', 10), + ('commons', 0), ('d', -10), ('e', 0); +select tableoid::regclass, * from mcrparted order by a, b; +drop table mcrparted; + +-- check that wholerow vars in the RETURNING list work with partitioned tables +create table returningwrtest (a int) partition by list (a); +create table returningwrtest1 partition of returningwrtest for values in (1); +insert into returningwrtest values (1) returning returningwrtest; + +-- check also that the wholerow vars in RETURNING list are converted as needed +alter table returningwrtest add b text; +create table returningwrtest2 (b text, c int, a int); +alter table returningwrtest2 drop c; +alter table returningwrtest attach partition returningwrtest2 for values in (2); +insert into returningwrtest values (2, 'foo') returning returningwrtest; +drop table returningwrtest; diff --git a/postgresql/examples/insert_conflict.sql b/postgresql/examples/insert_conflict.sql new file mode 100644 index 0000000..80ae5c7 --- /dev/null +++ b/postgresql/examples/insert_conflict.sql @@ -0,0 +1,582 @@ +-- +-- insert...on conflict do unique index inference +-- +create table insertconflicttest(key int4, fruit text); + +-- +-- Test unique index inference with operator class specifications and +-- named collations +-- +create unique index op_index_key on insertconflicttest(key, fruit text_pattern_ops); +create unique index collation_index_key on insertconflicttest(key, fruit collate "C"); +create unique index both_index_key on insertconflicttest(key, fruit collate "C" text_pattern_ops); +create unique index both_index_expr_key on insertconflicttest(key, lower(fruit) collate "C" text_pattern_ops); + +-- fails +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key) do nothing; +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit) do nothing; + +-- succeeds +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit) do nothing; +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit, key, fruit, key) do nothing; +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit), key, lower(fruit), key) do nothing; +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit) do update set fruit = excluded.fruit + where exists (select 1 from insertconflicttest ii where ii.key = excluded.key); +-- Neither collation nor operator class specifications are required -- +-- supplying them merely *limits* matches to indexes with matching opclasses +-- used for relevant indexes +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit text_pattern_ops) do nothing; +-- Okay, arbitrates using both index where text_pattern_ops opclass does and +-- does not appear. +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit collate "C") do nothing; +-- Okay, but only accepts the single index where both opclass and collation are +-- specified +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit collate "C" text_pattern_ops, key) do nothing; +-- Okay, but only accepts the single index where both opclass and collation are +-- specified (plus expression variant) +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit) collate "C", key, key) do nothing; +-- Attribute appears twice, while not all attributes/expressions on attributes +-- appearing within index definition match in terms of both opclass and +-- collation. +-- +-- Works because every attribute in inference specification needs to be +-- satisfied once or more by cataloged index attribute, and as always when an +-- attribute in the cataloged definition has a non-default opclass/collation, +-- it still satisfied some inference attribute lacking any particular +-- opclass/collation specification. +-- +-- The implementation is liberal in accepting inference specifications on the +-- assumption that multiple inferred unique indexes will prevent problematic +-- cases. It rolls with unique indexes where attributes redundantly appear +-- multiple times, too (which is not tested here). +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (fruit, key, fruit text_pattern_ops, key) do nothing; +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit) collate "C" text_pattern_ops, key, key) do nothing; + +drop index op_index_key; +drop index collation_index_key; +drop index both_index_key; +drop index both_index_expr_key; + +-- +-- Make sure that cross matching of attribute opclass/collation does not occur +-- +create unique index cross_match on insertconflicttest(lower(fruit) collate "C", upper(fruit) text_pattern_ops); + +-- fails: +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit) text_pattern_ops, upper(fruit) collate "C") do nothing; +-- works: +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (lower(fruit) collate "C", upper(fruit) text_pattern_ops) do nothing; + +drop index cross_match; + +-- +-- Single key tests +-- +create unique index key_index on insertconflicttest(key); + +-- +-- Explain tests +-- +explain (costs off) insert into insertconflicttest values (0, 'Bilberry') on conflict (key) do update set fruit = excluded.fruit; +-- Should display qual actually attributable to internal sequential scan: +explain (costs off) insert into insertconflicttest values (0, 'Bilberry') on conflict (key) do update set fruit = excluded.fruit where insertconflicttest.fruit != 'Cawesh'; +-- With EXCLUDED.* expression in scan node: +explain (costs off) insert into insertconflicttest values(0, 'Crowberry') on conflict (key) do update set fruit = excluded.fruit where excluded.fruit != 'Elderberry'; +-- Does the same, but JSON format shows "Conflict Arbiter Index" as JSON array: +explain (costs off, format json) insert into insertconflicttest values (0, 'Bilberry') on conflict (key) do update set fruit = excluded.fruit where insertconflicttest.fruit != 'Lime' returning *; + +-- Fails (no unique index inference specification, required for do update variant): +insert into insertconflicttest values (1, 'Apple') on conflict do update set fruit = excluded.fruit; + +-- inference succeeds: +insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (2, 'Orange') on conflict (key, key, key) do update set fruit = excluded.fruit; + +-- Succeed, since multi-assignment does not involve subquery: +insert into insertconflicttest +values (1, 'Apple'), (2, 'Orange') +on conflict (key) do update set (fruit, key) = (excluded.fruit, excluded.key); + +-- Give good diagnostic message when EXCLUDED.* spuriously referenced from +-- RETURNING: +insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruit RETURNING excluded.fruit; + +-- Only suggest .* column when inference element misspelled: +insert into insertconflicttest values (1, 'Apple') on conflict (keyy) do update set fruit = excluded.fruit; + +-- Have useful HINT for EXCLUDED.* RTE within UPDATE: +insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruitt; + +-- inference fails: +insert into insertconflicttest values (3, 'Kiwi') on conflict (key, fruit) do update set fruit = excluded.fruit; +insert into insertconflicttest values (4, 'Mango') on conflict (fruit, key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (5, 'Lemon') on conflict (fruit) do update set fruit = excluded.fruit; +insert into insertconflicttest values (6, 'Passionfruit') on conflict (lower(fruit)) do update set fruit = excluded.fruit; + +-- Check the target relation can be aliased +insert into insertconflicttest AS ict values (6, 'Passionfruit') on conflict (key) do update set fruit = excluded.fruit; -- ok, no reference to target table +insert into insertconflicttest AS ict values (6, 'Passionfruit') on conflict (key) do update set fruit = ict.fruit; -- ok, alias +insert into insertconflicttest AS ict values (6, 'Passionfruit') on conflict (key) do update set fruit = insertconflicttest.fruit; -- error, references aliased away name + +drop index key_index; + +-- +-- Composite key tests +-- +create unique index comp_key_index on insertconflicttest(key, fruit); + +-- inference succeeds: +insert into insertconflicttest values (7, 'Raspberry') on conflict (key, fruit) do update set fruit = excluded.fruit; +insert into insertconflicttest values (8, 'Lime') on conflict (fruit, key) do update set fruit = excluded.fruit; + +-- inference fails: +insert into insertconflicttest values (9, 'Banana') on conflict (key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (10, 'Blueberry') on conflict (key, key, key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (11, 'Cherry') on conflict (key, lower(fruit)) do update set fruit = excluded.fruit; +insert into insertconflicttest values (12, 'Date') on conflict (lower(fruit), key) do update set fruit = excluded.fruit; + +drop index comp_key_index; + +-- +-- Partial index tests, no inference predicate specified +-- +create unique index part_comp_key_index on insertconflicttest(key, fruit) where key < 5; +create unique index expr_part_comp_key_index on insertconflicttest(key, lower(fruit)) where key < 5; + +-- inference fails: +insert into insertconflicttest values (13, 'Grape') on conflict (key, fruit) do update set fruit = excluded.fruit; +insert into insertconflicttest values (14, 'Raisin') on conflict (fruit, key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (15, 'Cranberry') on conflict (key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (16, 'Melon') on conflict (key, key, key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (17, 'Mulberry') on conflict (key, lower(fruit)) do update set fruit = excluded.fruit; +insert into insertconflicttest values (18, 'Pineapple') on conflict (lower(fruit), key) do update set fruit = excluded.fruit; + +drop index part_comp_key_index; +drop index expr_part_comp_key_index; + +-- +-- Expression index tests +-- +create unique index expr_key_index on insertconflicttest(lower(fruit)); + +-- inference succeeds: +insert into insertconflicttest values (20, 'Quince') on conflict (lower(fruit)) do update set fruit = excluded.fruit; +insert into insertconflicttest values (21, 'Pomegranate') on conflict (lower(fruit), lower(fruit)) do update set fruit = excluded.fruit; + +-- inference fails: +insert into insertconflicttest values (22, 'Apricot') on conflict (upper(fruit)) do update set fruit = excluded.fruit; +insert into insertconflicttest values (23, 'Blackberry') on conflict (fruit) do update set fruit = excluded.fruit; + +drop index expr_key_index; + +-- +-- Expression index tests (with regular column) +-- +create unique index expr_comp_key_index on insertconflicttest(key, lower(fruit)); +create unique index tricky_expr_comp_key_index on insertconflicttest(key, lower(fruit), upper(fruit)); + +-- inference succeeds: +insert into insertconflicttest values (24, 'Plum') on conflict (key, lower(fruit)) do update set fruit = excluded.fruit; +insert into insertconflicttest values (25, 'Peach') on conflict (lower(fruit), key) do update set fruit = excluded.fruit; +-- Should not infer "tricky_expr_comp_key_index" index: +explain (costs off) insert into insertconflicttest values (26, 'Fig') on conflict (lower(fruit), key, lower(fruit), key) do update set fruit = excluded.fruit; + +-- inference fails: +insert into insertconflicttest values (27, 'Prune') on conflict (key, upper(fruit)) do update set fruit = excluded.fruit; +insert into insertconflicttest values (28, 'Redcurrant') on conflict (fruit, key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (29, 'Nectarine') on conflict (key) do update set fruit = excluded.fruit; + +drop index expr_comp_key_index; +drop index tricky_expr_comp_key_index; + +-- +-- Non-spurious duplicate violation tests +-- +create unique index key_index on insertconflicttest(key); +create unique index fruit_index on insertconflicttest(fruit); + +-- succeeds, since UPDATE happens to update "fruit" to existing value: +insert into insertconflicttest values (26, 'Fig') on conflict (key) do update set fruit = excluded.fruit; +-- fails, since UPDATE is to row with key value 26, and we're updating "fruit" +-- to a value that happens to exist in another row ('peach'): +insert into insertconflicttest values (26, 'Peach') on conflict (key) do update set fruit = excluded.fruit; +-- succeeds, since "key" isn't repeated/referenced in UPDATE, and "fruit" +-- arbitrates that statement updates existing "Fig" row: +insert into insertconflicttest values (25, 'Fig') on conflict (fruit) do update set fruit = excluded.fruit; + +drop index key_index; +drop index fruit_index; + +-- +-- Test partial unique index inference +-- +create unique index partial_key_index on insertconflicttest(key) where fruit like '%berry'; + +-- Succeeds +insert into insertconflicttest values (23, 'Blackberry') on conflict (key) where fruit like '%berry' do update set fruit = excluded.fruit; +insert into insertconflicttest values (23, 'Blackberry') on conflict (key) where fruit like '%berry' and fruit = 'inconsequential' do nothing; + +-- fails +insert into insertconflicttest values (23, 'Blackberry') on conflict (key) do update set fruit = excluded.fruit; +insert into insertconflicttest values (23, 'Blackberry') on conflict (key) where fruit like '%berry' or fruit = 'consequential' do nothing; +insert into insertconflicttest values (23, 'Blackberry') on conflict (fruit) where fruit like '%berry' do update set fruit = excluded.fruit; + +drop index partial_key_index; + +-- +-- Test that wholerow references to ON CONFLICT's EXCLUDED work +-- +create unique index plain on insertconflicttest(key); + +-- Succeeds, updates existing row: +insert into insertconflicttest as i values (23, 'Jackfruit') on conflict (key) do update set fruit = excluded.fruit + where i.* != excluded.* returning *; +-- No update this time, though: +insert into insertconflicttest as i values (23, 'Jackfruit') on conflict (key) do update set fruit = excluded.fruit + where i.* != excluded.* returning *; +-- Predicate changed to require match rather than non-match, so updates once more: +insert into insertconflicttest as i values (23, 'Jackfruit') on conflict (key) do update set fruit = excluded.fruit + where i.* = excluded.* returning *; +-- Assign: +insert into insertconflicttest as i values (23, 'Avocado') on conflict (key) do update set fruit = excluded.*::text + returning *; +-- deparse whole row var in WHERE and SET clauses: +explain (costs off) insert into insertconflicttest as i values (23, 'Avocado') on conflict (key) do update set fruit = excluded.fruit where excluded.* is null; +explain (costs off) insert into insertconflicttest as i values (23, 'Avocado') on conflict (key) do update set fruit = excluded.*::text; + +drop index plain; + +-- Cleanup +drop table insertconflicttest; + + +-- +-- Verify that EXCLUDED does not allow system column references. These +-- do not make sense because EXCLUDED isn't an already stored tuple +-- (and thus doesn't have a ctid etc). +-- +create table syscolconflicttest(key int4, data text); +insert into syscolconflicttest values (1); +insert into syscolconflicttest values (1) on conflict (key) do update set data = excluded.ctid::text; +drop table syscolconflicttest; + +-- +-- Previous tests all managed to not test any expressions requiring +-- planner preprocessing ... +-- +create table insertconflict (a bigint, b bigint); + +create unique index insertconflicti1 on insertconflict(coalesce(a, 0)); + +create unique index insertconflicti2 on insertconflict(b) + where coalesce(a, 1) > 0; + +insert into insertconflict values (1, 2) +on conflict (coalesce(a, 0)) do nothing; + +insert into insertconflict values (1, 2) +on conflict (b) where coalesce(a, 1) > 0 do nothing; + +insert into insertconflict values (1, 2) +on conflict (b) where coalesce(a, 1) > 1 do nothing; + +drop table insertconflict; + +-- +-- test insertion through view +-- + +create table insertconflict (f1 int primary key, f2 text); +create view insertconflictv as + select * from insertconflict with cascaded check option; + +insert into insertconflictv values (1,'foo') + on conflict (f1) do update set f2 = excluded.f2; +select * from insertconflict; +insert into insertconflictv values (1,'bar') + on conflict (f1) do update set f2 = excluded.f2; +select * from insertconflict; + +drop view insertconflictv; +drop table insertconflict; + + +-- ****************************************************************** +-- * * +-- * Test inheritance (example taken from tutorial) * +-- * * +-- ****************************************************************** +create table cities ( + name text, + population float8, + altitude int -- (in ft) +); + +create table capitals ( + state char(2) +) inherits (cities); + +-- Create unique indexes. Due to a general limitation of inheritance, +-- uniqueness is only enforced per-relation. Unique index inference +-- specification will do the right thing, though. +create unique index cities_names_unique on cities (name); +create unique index capitals_names_unique on capitals (name); + +-- prepopulate the tables. +insert into cities values ('San Francisco', 7.24E+5, 63); +insert into cities values ('Las Vegas', 2.583E+5, 2174); +insert into cities values ('Mariposa', 1200, 1953); + +insert into capitals values ('Sacramento', 3.694E+5, 30, 'CA'); +insert into capitals values ('Madison', 1.913E+5, 845, 'WI'); + +-- Tests proper for inheritance: +select * from capitals; + +-- Succeeds: +insert into cities values ('Las Vegas', 2.583E+5, 2174) on conflict do nothing; +insert into capitals values ('Sacramento', 4664.E+5, 30, 'CA') on conflict (name) do update set population = excluded.population; +-- Wrong "Sacramento", so do nothing: +insert into capitals values ('Sacramento', 50, 2267, 'NE') on conflict (name) do nothing; +select * from capitals; +insert into cities values ('Las Vegas', 5.83E+5, 2001) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude; +select tableoid::regclass, * from cities; +insert into capitals values ('Las Vegas', 5.83E+5, 2222, 'NV') on conflict (name) do update set population = excluded.population; +-- Capitals will contain new capital, Las Vegas: +select * from capitals; +-- Cities contains two instances of "Las Vegas", since unique constraints don't +-- work across inheritance: +select tableoid::regclass, * from cities; +-- This only affects "cities" version of "Las Vegas": +insert into cities values ('Las Vegas', 5.86E+5, 2223) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude; +select tableoid::regclass, * from cities; + +-- clean up +drop table capitals; +drop table cities; + + +-- Make sure a table named excluded is handled properly +create table excluded(key int primary key, data text); +insert into excluded values(1, '1'); +-- error, ambiguous +insert into excluded values(1, '2') on conflict (key) do update set data = excluded.data RETURNING *; +-- ok, aliased +insert into excluded AS target values(1, '2') on conflict (key) do update set data = excluded.data RETURNING *; +-- ok, aliased +insert into excluded AS target values(1, '2') on conflict (key) do update set data = target.data RETURNING *; +-- make sure excluded isn't a problem in returning clause +insert into excluded values(1, '2') on conflict (key) do update set data = 3 RETURNING excluded.*; + +-- clean up +drop table excluded; + + +-- check that references to columns after dropped columns are handled correctly +create table dropcol(key int primary key, drop1 int, keep1 text, drop2 numeric, keep2 float); +insert into dropcol(key, drop1, keep1, drop2, keep2) values(1, 1, '1', '1', 1); +-- set using excluded +insert into dropcol(key, drop1, keep1, drop2, keep2) values(1, 2, '2', '2', 2) on conflict(key) + do update set drop1 = excluded.drop1, keep1 = excluded.keep1, drop2 = excluded.drop2, keep2 = excluded.keep2 + where excluded.drop1 is not null and excluded.keep1 is not null and excluded.drop2 is not null and excluded.keep2 is not null + and dropcol.drop1 is not null and dropcol.keep1 is not null and dropcol.drop2 is not null and dropcol.keep2 is not null + returning *; + +-- set using existing table +insert into dropcol(key, drop1, keep1, drop2, keep2) values(1, 3, '3', '3', 3) on conflict(key) + do update set drop1 = dropcol.drop1, keep1 = dropcol.keep1, drop2 = dropcol.drop2, keep2 = dropcol.keep2 + returning *; + +alter table dropcol drop column drop1, drop column drop2; +-- set using excluded +insert into dropcol(key, keep1, keep2) values(1, '4', 4) on conflict(key) + do update set keep1 = excluded.keep1, keep2 = excluded.keep2 + where excluded.keep1 is not null and excluded.keep2 is not null + and dropcol.keep1 is not null and dropcol.keep2 is not null + returning *; + +-- set using existing table +insert into dropcol(key, keep1, keep2) values(1, '5', 5) on conflict(key) + do update set keep1 = dropcol.keep1, keep2 = dropcol.keep2 + returning *; + + +DROP TABLE dropcol; + +-- check handling of regular btree constraint along with gist constraint + +create table twoconstraints (f1 int unique, f2 box, + exclude using gist(f2 with &&)); +insert into twoconstraints values(1, '((0,0),(1,1))'); +insert into twoconstraints values(1, '((2,2),(3,3))'); -- fail on f1 +insert into twoconstraints values(2, '((0,0),(1,2))'); -- fail on f2 +insert into twoconstraints values(2, '((0,0),(1,2))') + on conflict on constraint twoconstraints_f1_key do nothing; -- fail on f2 +insert into twoconstraints values(2, '((0,0),(1,2))') + on conflict on constraint twoconstraints_f2_excl do nothing; -- do nothing +select * from twoconstraints; +drop table twoconstraints; + +-- check handling of self-conflicts at various isolation levels + +create table selfconflict (f1 int primary key, f2 int); + +begin transaction isolation level read committed; +insert into selfconflict values (1,1), (1,2) on conflict do nothing; +commit; + +begin transaction isolation level repeatable read; +insert into selfconflict values (2,1), (2,2) on conflict do nothing; +commit; + +begin transaction isolation level serializable; +insert into selfconflict values (3,1), (3,2) on conflict do nothing; +commit; + +begin transaction isolation level read committed; +insert into selfconflict values (4,1), (4,2) on conflict(f1) do update set f2 = 0; +commit; + +begin transaction isolation level repeatable read; +insert into selfconflict values (5,1), (5,2) on conflict(f1) do update set f2 = 0; +commit; + +begin transaction isolation level serializable; +insert into selfconflict values (6,1), (6,2) on conflict(f1) do update set f2 = 0; +commit; + +select * from selfconflict; + +drop table selfconflict; + +-- check ON CONFLICT handling with partitioned tables +create table parted_conflict_test (a int unique, b char) partition by list (a); +create table parted_conflict_test_1 partition of parted_conflict_test (b unique) for values in (1, 2); + +-- no indexes required here +insert into parted_conflict_test values (1, 'a') on conflict do nothing; + +-- index on a required, which does exist in parent +insert into parted_conflict_test values (1, 'a') on conflict (a) do nothing; +insert into parted_conflict_test values (1, 'a') on conflict (a) do update set b = excluded.b; + +-- targeting partition directly will work +insert into parted_conflict_test_1 values (1, 'a') on conflict (a) do nothing; +insert into parted_conflict_test_1 values (1, 'b') on conflict (a) do update set b = excluded.b; + +-- index on b required, which doesn't exist in parent +insert into parted_conflict_test values (2, 'b') on conflict (b) do update set a = excluded.a; + +-- targeting partition directly will work +insert into parted_conflict_test_1 values (2, 'b') on conflict (b) do update set a = excluded.a; + +-- should see (2, 'b') +select * from parted_conflict_test order by a; + +-- now check that DO UPDATE works correctly for target partition with +-- different attribute numbers +create table parted_conflict_test_2 (b char, a int unique); +alter table parted_conflict_test attach partition parted_conflict_test_2 for values in (3); +truncate parted_conflict_test; +insert into parted_conflict_test values (3, 'a') on conflict (a) do update set b = excluded.b; +insert into parted_conflict_test values (3, 'b') on conflict (a) do update set b = excluded.b; + +-- should see (3, 'b') +select * from parted_conflict_test order by a; + +-- case where parent will have a dropped column, but the partition won't +alter table parted_conflict_test drop b, add b char; +create table parted_conflict_test_3 partition of parted_conflict_test for values in (4); +truncate parted_conflict_test; +insert into parted_conflict_test (a, b) values (4, 'a') on conflict (a) do update set b = excluded.b; +insert into parted_conflict_test (a, b) values (4, 'b') on conflict (a) do update set b = excluded.b where parted_conflict_test.b = 'a'; + +-- should see (4, 'b') +select * from parted_conflict_test order by a; + +-- case with multi-level partitioning +create table parted_conflict_test_4 partition of parted_conflict_test for values in (5) partition by list (a); +create table parted_conflict_test_4_1 partition of parted_conflict_test_4 for values in (5); +truncate parted_conflict_test; +insert into parted_conflict_test (a, b) values (5, 'a') on conflict (a) do update set b = excluded.b; +insert into parted_conflict_test (a, b) values (5, 'b') on conflict (a) do update set b = excluded.b where parted_conflict_test.b = 'a'; + +-- should see (5, 'b') +select * from parted_conflict_test order by a; + +-- test with multiple rows +truncate parted_conflict_test; +insert into parted_conflict_test (a, b) values (1, 'a'), (2, 'a'), (4, 'a') on conflict (a) do update set b = excluded.b where excluded.b = 'b'; +insert into parted_conflict_test (a, b) values (1, 'b'), (2, 'c'), (4, 'b') on conflict (a) do update set b = excluded.b where excluded.b = 'b'; + +-- should see (1, 'b'), (2, 'a'), (4, 'b') +select * from parted_conflict_test order by a; + +drop table parted_conflict_test; + +-- test behavior of inserting a conflicting tuple into an intermediate +-- partitioning level +create table parted_conflict (a int primary key, b text) partition by range (a); +create table parted_conflict_1 partition of parted_conflict for values from (0) to (1000) partition by range (a); +create table parted_conflict_1_1 partition of parted_conflict_1 for values from (0) to (500); +insert into parted_conflict values (40, 'forty'); +insert into parted_conflict_1 values (40, 'cuarenta') + on conflict (a) do update set b = excluded.b; +drop table parted_conflict; + +-- same thing, but this time try to use an index that's created not in the +-- partition +create table parted_conflict (a int, b text) partition by range (a); +create table parted_conflict_1 partition of parted_conflict for values from (0) to (1000) partition by range (a); +create table parted_conflict_1_1 partition of parted_conflict_1 for values from (0) to (500); +create unique index on only parted_conflict_1 (a); +create unique index on only parted_conflict (a); +alter index parted_conflict_a_idx attach partition parted_conflict_1_a_idx; +insert into parted_conflict values (40, 'forty'); +insert into parted_conflict_1 values (40, 'cuarenta') + on conflict (a) do update set b = excluded.b; +drop table parted_conflict; + +-- test whole-row Vars in ON CONFLICT expressions +create table parted_conflict (a int, b text, c int) partition by range (a); +create table parted_conflict_1 (drp text, c int, a int, b text); +alter table parted_conflict_1 drop column drp; +create unique index on parted_conflict (a, b); +alter table parted_conflict attach partition parted_conflict_1 for values from (0) to (1000); +truncate parted_conflict; +insert into parted_conflict values (50, 'cincuenta', 1); +insert into parted_conflict values (50, 'cincuenta', 2) + on conflict (a, b) do update set (a, b, c) = row(excluded.*) + where parted_conflict = (50, text 'cincuenta', 1) and + excluded = (50, text 'cincuenta', 2); + +-- should see (50, 'cincuenta', 2) +select * from parted_conflict order by a; + +-- test with statement level triggers +create or replace function parted_conflict_update_func() returns trigger as $$ +declare + r record; +begin + for r in select * from inserted loop + raise notice 'a = %, b = %, c = %', r.a, r.b, r.c; + end loop; + return new; +end; +$$ language plpgsql; + +create trigger parted_conflict_update + after update on parted_conflict + referencing new table as inserted + for each statement + execute procedure parted_conflict_update_func(); + +truncate parted_conflict; + +insert into parted_conflict values (0, 'cero', 1); + +insert into parted_conflict values(0, 'cero', 1) + on conflict (a,b) do update set c = parted_conflict.c + 1; + +drop table parted_conflict; +drop function parted_conflict_update_func(); diff --git a/postgresql/examples/int2.sql b/postgresql/examples/int2.sql new file mode 100644 index 0000000..6d5cc4e --- /dev/null +++ b/postgresql/examples/int2.sql @@ -0,0 +1,115 @@ +-- +-- INT2 +-- + +CREATE TABLE INT2_TBL(f1 int2); + +INSERT INTO INT2_TBL(f1) VALUES ('0 '); + +INSERT INTO INT2_TBL(f1) VALUES (' 1234 '); + +INSERT INTO INT2_TBL(f1) VALUES (' -1234'); + +INSERT INTO INT2_TBL(f1) VALUES ('34.5'); + +-- largest and smallest values +INSERT INTO INT2_TBL(f1) VALUES ('32767'); + +INSERT INTO INT2_TBL(f1) VALUES ('-32767'); + +-- bad input values -- should give errors +INSERT INTO INT2_TBL(f1) VALUES ('100000'); +INSERT INTO INT2_TBL(f1) VALUES ('asdf'); +INSERT INTO INT2_TBL(f1) VALUES (' '); +INSERT INTO INT2_TBL(f1) VALUES ('- 1234'); +INSERT INTO INT2_TBL(f1) VALUES ('4 444'); +INSERT INTO INT2_TBL(f1) VALUES ('123 dt'); +INSERT INTO INT2_TBL(f1) VALUES (''); + + +SELECT '' AS five, * FROM INT2_TBL; + +SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int2 '0'; + +SELECT '' AS four, i.* FROM INT2_TBL i WHERE i.f1 <> int4 '0'; + +SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int2 '0'; + +SELECT '' AS one, i.* FROM INT2_TBL i WHERE i.f1 = int4 '0'; + +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int2 '0'; + +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 < int4 '0'; + +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int2 '0'; + +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 <= int4 '0'; + +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int2 '0'; + +SELECT '' AS two, i.* FROM INT2_TBL i WHERE i.f1 > int4 '0'; + +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int2 '0'; + +SELECT '' AS three, i.* FROM INT2_TBL i WHERE i.f1 >= int4 '0'; + +-- positive odds +SELECT '' AS one, i.* FROM INT2_TBL i WHERE (i.f1 % int2 '2') = int2 '1'; + +-- any evens +SELECT '' AS three, i.* FROM INT2_TBL i WHERE (i.f1 % int4 '2') = int2 '0'; + +SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i; + +SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT2_TBL i +WHERE abs(f1) < 16384; + +SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT2_TBL i; + +SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i; + +SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT2_TBL i +WHERE f1 < 32766; + +SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT2_TBL i; + +SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i; + +SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT2_TBL i +WHERE f1 > -32767; + +SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT2_TBL i; + +SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT2_TBL i; + +SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT2_TBL i; + + +-- check sane handling of INT16_MIN overflow cases +SELECT (-32768)::int2 * (-1)::int2; +SELECT (-32768)::int2 / (-1)::int2; +SELECT (-32768)::int2 % (-1)::int2; + +-- check rounding when casting from float +SELECT x, x::int2 AS int2_value +FROM (VALUES (-2.5::float8), + (-1.5::float8), + (-0.5::float8), + (0.0::float8), + (0.5::float8), + (1.5::float8), + (2.5::float8)) t(x); + +-- check rounding when casting from numeric +SELECT x, x::int2 AS int2_value +FROM (VALUES (-2.5::numeric), + (-1.5::numeric), + (-0.5::numeric), + (0.0::numeric), + (0.5::numeric), + (1.5::numeric), + (2.5::numeric)) t(x); +-- corner cases +SELECT (-1::int2<<15)::text; +SELECT ((-1::int2<<15)+1::int2)::text; + diff --git a/postgresql/examples/int4.sql b/postgresql/examples/int4.sql new file mode 100644 index 0000000..5555ea7 --- /dev/null +++ b/postgresql/examples/int4.sql @@ -0,0 +1,179 @@ +-- +-- INT4 +-- + +CREATE TABLE INT4_TBL(f1 int4); + +INSERT INTO INT4_TBL(f1) VALUES (' 0 '); + +INSERT INTO INT4_TBL(f1) VALUES ('123456 '); + +INSERT INTO INT4_TBL(f1) VALUES (' -123456'); + +INSERT INTO INT4_TBL(f1) VALUES ('34.5'); + +-- largest and smallest values +INSERT INTO INT4_TBL(f1) VALUES ('2147483647'); + +INSERT INTO INT4_TBL(f1) VALUES ('-2147483647'); + +-- bad input values -- should give errors +INSERT INTO INT4_TBL(f1) VALUES ('1000000000000'); +INSERT INTO INT4_TBL(f1) VALUES ('asdf'); +INSERT INTO INT4_TBL(f1) VALUES (' '); +INSERT INTO INT4_TBL(f1) VALUES (' asdf '); +INSERT INTO INT4_TBL(f1) VALUES ('- 1234'); +INSERT INTO INT4_TBL(f1) VALUES ('123 5'); +INSERT INTO INT4_TBL(f1) VALUES (''); + + +SELECT '' AS five, * FROM INT4_TBL; + +SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int2 '0'; + +SELECT '' AS four, i.* FROM INT4_TBL i WHERE i.f1 <> int4 '0'; + +SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int2 '0'; + +SELECT '' AS one, i.* FROM INT4_TBL i WHERE i.f1 = int4 '0'; + +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int2 '0'; + +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 < int4 '0'; + +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int2 '0'; + +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 <= int4 '0'; + +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int2 '0'; + +SELECT '' AS two, i.* FROM INT4_TBL i WHERE i.f1 > int4 '0'; + +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int2 '0'; + +SELECT '' AS three, i.* FROM INT4_TBL i WHERE i.f1 >= int4 '0'; + +-- positive odds +SELECT '' AS one, i.* FROM INT4_TBL i WHERE (i.f1 % int2 '2') = int2 '1'; + +-- any evens +SELECT '' AS three, i.* FROM INT4_TBL i WHERE (i.f1 % int4 '2') = int2 '0'; + +SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i; + +SELECT '' AS five, i.f1, i.f1 * int2 '2' AS x FROM INT4_TBL i +WHERE abs(f1) < 1073741824; + +SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i; + +SELECT '' AS five, i.f1, i.f1 * int4 '2' AS x FROM INT4_TBL i +WHERE abs(f1) < 1073741824; + +SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i; + +SELECT '' AS five, i.f1, i.f1 + int2 '2' AS x FROM INT4_TBL i +WHERE f1 < 2147483646; + +SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i; + +SELECT '' AS five, i.f1, i.f1 + int4 '2' AS x FROM INT4_TBL i +WHERE f1 < 2147483646; + +SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i; + +SELECT '' AS five, i.f1, i.f1 - int2 '2' AS x FROM INT4_TBL i +WHERE f1 > -2147483647; + +SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i; + +SELECT '' AS five, i.f1, i.f1 - int4 '2' AS x FROM INT4_TBL i +WHERE f1 > -2147483647; + +SELECT '' AS five, i.f1, i.f1 / int2 '2' AS x FROM INT4_TBL i; + +SELECT '' AS five, i.f1, i.f1 / int4 '2' AS x FROM INT4_TBL i; + +-- +-- more complex expressions +-- + +-- variations on unary minus parsing +SELECT -2+3 AS one; + +SELECT 4-2 AS two; + +SELECT 2- -1 AS three; + +SELECT 2 - -2 AS four; + +SELECT int2 '2' * int2 '2' = int2 '16' / int2 '4' AS true; + +SELECT int4 '2' * int2 '2' = int2 '16' / int4 '4' AS true; + +SELECT int2 '2' * int4 '2' = int4 '16' / int2 '4' AS true; + +SELECT int4 '1000' < int4 '999' AS false; + +SELECT 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 AS ten; + +SELECT 2 + 2 / 2 AS three; + +SELECT (2 + 2) / 2 AS two; + + +-- check sane handling of INT_MIN overflow cases +SELECT (-2147483648)::int4 * (-1)::int4; +SELECT (-2147483648)::int4 / (-1)::int4; +SELECT (-2147483648)::int4 % (-1)::int4; +SELECT (-2147483648)::int4 * (-1)::int2; +SELECT (-2147483648)::int4 / (-1)::int2; +SELECT (-2147483648)::int4 % (-1)::int2; + +-- check rounding when casting from float +SELECT x, x::int4 AS int4_value +FROM (VALUES (-2.5::float8), + (-1.5::float8), + (-0.5::float8), + (0.0::float8), + (0.5::float8), + (1.5::float8), + (2.5::float8)) t(x); + +-- check rounding when casting from numeric +SELECT x, x::int4 AS int4_value +FROM (VALUES (-2.5::numeric), + (-1.5::numeric), + (-0.5::numeric), + (0.0::numeric), + (0.5::numeric), + (1.5::numeric), + (2.5::numeric)) t(x); + +-- test gcd() +SELECT a, b, gcd(a, b), gcd(a, -b), gcd(b, a), gcd(-b, a) +FROM (VALUES (0::int4, 0::int4), + (0::int4, 6410818::int4), + (61866666::int4, 6410818::int4), + (-61866666::int4, 6410818::int4), + ((-2147483648)::int4, 1::int4), + ((-2147483648)::int4, 2147483647::int4), + ((-2147483648)::int4, 1073741824::int4)) AS v(a, b); + +SELECT gcd((-2147483648)::int4, 0::int4); -- overflow +SELECT gcd((-2147483648)::int4, (-2147483648)::int4); -- overflow + +-- test lcm() +SELECT a, b, lcm(a, b), lcm(a, -b), lcm(b, a), lcm(-b, a) +FROM (VALUES (0::int4, 0::int4), + (0::int4, 42::int4), + (42::int4, 42::int4), + (330::int4, 462::int4), + (-330::int4, 462::int4), + ((-2147483648)::int4, 0::int4)) AS v(a, b); + +SELECT lcm((-2147483648)::int4, 1::int4); -- overflow +SELECT lcm(2147483647::int4, 2147483646::int4); -- overflow +-- corner case +SELECT (-1::int4<<31)::text; +SELECT ((-1::int4<<31)+1)::text; + diff --git a/postgresql/examples/int8.sql b/postgresql/examples/int8.sql new file mode 100644 index 0000000..16330bd --- /dev/null +++ b/postgresql/examples/int8.sql @@ -0,0 +1,253 @@ +-- +-- INT8 +-- Test int8 64-bit integers. +-- +CREATE TABLE INT8_TBL(q1 int8, q2 int8); + +INSERT INTO INT8_TBL VALUES(' 123 ',' 456'); +INSERT INTO INT8_TBL VALUES('123 ','4567890123456789'); +INSERT INTO INT8_TBL VALUES('4567890123456789','123'); +INSERT INTO INT8_TBL VALUES(+4567890123456789,'4567890123456789'); +INSERT INTO INT8_TBL VALUES('+4567890123456789','-4567890123456789'); + +-- bad inputs +INSERT INTO INT8_TBL(q1) VALUES (' '); +INSERT INTO INT8_TBL(q1) VALUES ('xxx'); +INSERT INTO INT8_TBL(q1) VALUES ('3908203590239580293850293850329485'); +INSERT INTO INT8_TBL(q1) VALUES ('-1204982019841029840928340329840934'); +INSERT INTO INT8_TBL(q1) VALUES ('- 123'); +INSERT INTO INT8_TBL(q1) VALUES (' 345 5'); +INSERT INTO INT8_TBL(q1) VALUES (''); + +SELECT * FROM INT8_TBL; + +-- int8/int8 cmp +SELECT * FROM INT8_TBL WHERE q2 = 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 <> 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 < 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 > 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 <= 4567890123456789; +SELECT * FROM INT8_TBL WHERE q2 >= 4567890123456789; + +-- int8/int4 cmp +SELECT * FROM INT8_TBL WHERE q2 = 456; +SELECT * FROM INT8_TBL WHERE q2 <> 456; +SELECT * FROM INT8_TBL WHERE q2 < 456; +SELECT * FROM INT8_TBL WHERE q2 > 456; +SELECT * FROM INT8_TBL WHERE q2 <= 456; +SELECT * FROM INT8_TBL WHERE q2 >= 456; + +-- int4/int8 cmp +SELECT * FROM INT8_TBL WHERE 123 = q1; +SELECT * FROM INT8_TBL WHERE 123 <> q1; +SELECT * FROM INT8_TBL WHERE 123 < q1; +SELECT * FROM INT8_TBL WHERE 123 > q1; +SELECT * FROM INT8_TBL WHERE 123 <= q1; +SELECT * FROM INT8_TBL WHERE 123 >= q1; + +-- int8/int2 cmp +SELECT * FROM INT8_TBL WHERE q2 = '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 <> '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 < '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 > '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 <= '456'::int2; +SELECT * FROM INT8_TBL WHERE q2 >= '456'::int2; + +-- int2/int8 cmp +SELECT * FROM INT8_TBL WHERE '123'::int2 = q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 <> q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 < q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 > q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 <= q1; +SELECT * FROM INT8_TBL WHERE '123'::int2 >= q1; + + +SELECT '' AS five, q1 AS plus, -q1 AS minus FROM INT8_TBL; + +SELECT '' AS five, q1, q2, q1 + q2 AS plus FROM INT8_TBL; +SELECT '' AS five, q1, q2, q1 - q2 AS minus FROM INT8_TBL; +SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL; +SELECT '' AS three, q1, q2, q1 * q2 AS multiply FROM INT8_TBL + WHERE q1 < 1000 or (q2 > 0 and q2 < 1000); +SELECT '' AS five, q1, q2, q1 / q2 AS divide, q1 % q2 AS mod FROM INT8_TBL; + +SELECT '' AS five, q1, float8(q1) FROM INT8_TBL; +SELECT '' AS five, q2, float8(q2) FROM INT8_TBL; + +SELECT 37 + q1 AS plus4 FROM INT8_TBL; +SELECT 37 - q1 AS minus4 FROM INT8_TBL; +SELECT '' AS five, 2 * q1 AS "twice int4" FROM INT8_TBL; +SELECT '' AS five, q1 * 2 AS "twice int4" FROM INT8_TBL; + +-- int8 op int4 +SELECT q1 + 42::int4 AS "8plus4", q1 - 42::int4 AS "8minus4", q1 * 42::int4 AS "8mul4", q1 / 42::int4 AS "8div4" FROM INT8_TBL; +-- int4 op int8 +SELECT 246::int4 + q1 AS "4plus8", 246::int4 - q1 AS "4minus8", 246::int4 * q1 AS "4mul8", 246::int4 / q1 AS "4div8" FROM INT8_TBL; + +-- int8 op int2 +SELECT q1 + 42::int2 AS "8plus2", q1 - 42::int2 AS "8minus2", q1 * 42::int2 AS "8mul2", q1 / 42::int2 AS "8div2" FROM INT8_TBL; +-- int2 op int8 +SELECT 246::int2 + q1 AS "2plus8", 246::int2 - q1 AS "2minus8", 246::int2 * q1 AS "2mul8", 246::int2 / q1 AS "2div8" FROM INT8_TBL; + +SELECT q2, abs(q2) FROM INT8_TBL; +SELECT min(q1), min(q2) FROM INT8_TBL; +SELECT max(q1), max(q2) FROM INT8_TBL; + + +-- TO_CHAR() +-- +SELECT '' AS to_char_1, to_char(q1, '9G999G999G999G999G999'), to_char(q2, '9,999,999,999,999,999') + FROM INT8_TBL; + +SELECT '' AS to_char_2, to_char(q1, '9G999G999G999G999G999D999G999'), to_char(q2, '9,999,999,999,999,999.999,999') + FROM INT8_TBL; + +SELECT '' AS to_char_3, to_char( (q1 * -1), '9999999999999999PR'), to_char( (q2 * -1), '9999999999999999.999PR') + FROM INT8_TBL; + +SELECT '' AS to_char_4, to_char( (q1 * -1), '9999999999999999S'), to_char( (q2 * -1), 'S9999999999999999') + FROM INT8_TBL; + +SELECT '' AS to_char_5, to_char(q2, 'MI9999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_6, to_char(q2, 'FMS9999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_7, to_char(q2, 'FM9999999999999999THPR') FROM INT8_TBL; +SELECT '' AS to_char_8, to_char(q2, 'SG9999999999999999th') FROM INT8_TBL; +SELECT '' AS to_char_9, to_char(q2, '0999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_10, to_char(q2, 'S0999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_11, to_char(q2, 'FM0999999999999999') FROM INT8_TBL; +SELECT '' AS to_char_12, to_char(q2, 'FM9999999999999999.000') FROM INT8_TBL; +SELECT '' AS to_char_13, to_char(q2, 'L9999999999999999.000') FROM INT8_TBL; +SELECT '' AS to_char_14, to_char(q2, 'FM9999999999999999.999') FROM INT8_TBL; +SELECT '' AS to_char_15, to_char(q2, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9') FROM INT8_TBL; +SELECT '' AS to_char_16, to_char(q2, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM INT8_TBL; +SELECT '' AS to_char_17, to_char(q2, '999999SG9999999999') FROM INT8_TBL; + +-- check min/max values and overflow behavior + +select '-9223372036854775808'::int8; +select '-9223372036854775809'::int8; +select '9223372036854775807'::int8; +select '9223372036854775808'::int8; + +select -('-9223372036854775807'::int8); +select -('-9223372036854775808'::int8); + +select '9223372036854775800'::int8 + '9223372036854775800'::int8; +select '-9223372036854775800'::int8 + '-9223372036854775800'::int8; + +select '9223372036854775800'::int8 - '-9223372036854775800'::int8; +select '-9223372036854775800'::int8 - '9223372036854775800'::int8; + +select '9223372036854775800'::int8 * '9223372036854775800'::int8; + +select '9223372036854775800'::int8 / '0'::int8; +select '9223372036854775800'::int8 % '0'::int8; + +select abs('-9223372036854775808'::int8); + +select '9223372036854775800'::int8 + '100'::int4; +select '-9223372036854775800'::int8 - '100'::int4; +select '9223372036854775800'::int8 * '100'::int4; + +select '100'::int4 + '9223372036854775800'::int8; +select '-100'::int4 - '9223372036854775800'::int8; +select '100'::int4 * '9223372036854775800'::int8; + +select '9223372036854775800'::int8 + '100'::int2; +select '-9223372036854775800'::int8 - '100'::int2; +select '9223372036854775800'::int8 * '100'::int2; +select '-9223372036854775808'::int8 / '0'::int2; + +select '100'::int2 + '9223372036854775800'::int8; +select '-100'::int2 - '9223372036854775800'::int8; +select '100'::int2 * '9223372036854775800'::int8; +select '100'::int2 / '0'::int8; + +SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 = 456; +SELECT CAST(q1 AS int4) FROM int8_tbl WHERE q2 <> 456; + +SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 = 456; +SELECT CAST(q1 AS int2) FROM int8_tbl WHERE q2 <> 456; + +SELECT CAST('42'::int2 AS int8), CAST('-37'::int2 AS int8); + +SELECT CAST(q1 AS float4), CAST(q2 AS float8) FROM INT8_TBL; +SELECT CAST('36854775807.0'::float4 AS int8); +SELECT CAST('922337203685477580700.0'::float8 AS int8); + +SELECT CAST(q1 AS oid) FROM INT8_TBL; +SELECT oid::int8 FROM pg_class WHERE relname = 'pg_class'; + + + + +-- generate_series + +SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8); +SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 0); +SELECT * FROM generate_series('+4567890123456789'::int8, '+4567890123456799'::int8, 2); + + +-- check sane handling of INT64_MIN overflow cases +SELECT (-9223372036854775808)::int8 * (-1)::int8; +SELECT (-9223372036854775808)::int8 / (-1)::int8; +SELECT (-9223372036854775808)::int8 % (-1)::int8; +SELECT (-9223372036854775808)::int8 * (-1)::int4; +SELECT (-9223372036854775808)::int8 / (-1)::int4; +SELECT (-9223372036854775808)::int8 % (-1)::int4; +SELECT (-9223372036854775808)::int8 * (-1)::int2; +SELECT (-9223372036854775808)::int8 / (-1)::int2; +SELECT (-9223372036854775808)::int8 % (-1)::int2; + +-- check rounding when casting from float +SELECT x, x::int8 AS int8_value +FROM (VALUES (-2.5::float8), + (-1.5::float8), + (-0.5::float8), + (0.0::float8), + (0.5::float8), + (1.5::float8), + (2.5::float8)) t(x); + +-- check rounding when casting from numeric +SELECT x, x::int8 AS int8_value +FROM (VALUES (-2.5::numeric), + (-1.5::numeric), + (-0.5::numeric), + (0.0::numeric), + (0.5::numeric), + (1.5::numeric), + (2.5::numeric)) t(x); + +-- test gcd() +SELECT a, b, gcd(a, b), gcd(a, -b), gcd(b, a), gcd(-b, a) +FROM (VALUES (0::int8, 0::int8), + (0::int8, 29893644334::int8), + (288484263558::int8, 29893644334::int8), + (-288484263558::int8, 29893644334::int8), + ((-9223372036854775808)::int8, 1::int8), + ((-9223372036854775808)::int8, 9223372036854775807::int8), + ((-9223372036854775808)::int8, 4611686018427387904::int8)) AS v(a, b); + +SELECT gcd((-9223372036854775808)::int8, 0::int8); -- overflow +SELECT gcd((-9223372036854775808)::int8, (-9223372036854775808)::int8); -- overflow + +-- test lcm() +SELECT a, b, lcm(a, b), lcm(a, -b), lcm(b, a), lcm(-b, a) +FROM (VALUES (0::int8, 0::int8), + (0::int8, 29893644334::int8), + (29893644334::int8, 29893644334::int8), + (288484263558::int8, 29893644334::int8), + (-288484263558::int8, 29893644334::int8), + ((-9223372036854775808)::int8, 0::int8)) AS v(a, b); + +SELECT lcm((-9223372036854775808)::int8, 1::int8); -- overflow +SELECT lcm(9223372036854775807::int8, 9223372036854775806::int8); -- overflow +-- bit operations + +SELECT q1, q2, q1 & q2 AS "and", q1 | q2 AS "or", q1 # q2 AS "xor", ~q1 AS "not" FROM INT8_TBL; +SELECT q1, q1 << 2 AS "shl", q1 >> 3 AS "shr" FROM INT8_TBL; + +-- corner case +SELECT (-1::int8<<63)::text; +SELECT ((-1::int8<<63)+1)::text; diff --git a/postgresql/examples/interval.sql b/postgresql/examples/interval.sql new file mode 100644 index 0000000..05df116 --- /dev/null +++ b/postgresql/examples/interval.sql @@ -0,0 +1,337 @@ +-- +-- INTERVAL +-- + +SET DATESTYLE = 'ISO'; +SET IntervalStyle to postgres; + +-- check acceptance of "time zone style" +SELECT INTERVAL '01:00' AS "One hour"; +SELECT INTERVAL '+02:00' AS "Two hours"; +SELECT INTERVAL '-08:00' AS "Eight hours"; +SELECT INTERVAL '-1 +02:03' AS "22 hours ago..."; +SELECT INTERVAL '-1 days +02:03' AS "22 hours ago..."; +SELECT INTERVAL '1.5 weeks' AS "Ten days twelve hours"; +SELECT INTERVAL '1.5 months' AS "One month 15 days"; +SELECT INTERVAL '10 years -11 month -12 days +13:14' AS "9 years..."; + +CREATE TABLE INTERVAL_TBL (f1 interval); + +INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 1 minute'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 5 hour'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 10 day'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 34 year'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 3 months'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 14 seconds ago'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('1 day 2 hours 3 minutes 4 seconds'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('6 years'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('5 months'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('5 months 12 hours'); + +-- badly formatted interval +INSERT INTO INTERVAL_TBL (f1) VALUES ('badly formatted interval'); +INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 30 eons ago'); + +-- test interval operators + +SELECT '' AS ten, * FROM INTERVAL_TBL; + +SELECT '' AS nine, * FROM INTERVAL_TBL + WHERE INTERVAL_TBL.f1 <> interval '@ 10 days'; + +SELECT '' AS three, * FROM INTERVAL_TBL + WHERE INTERVAL_TBL.f1 <= interval '@ 5 hours'; + +SELECT '' AS three, * FROM INTERVAL_TBL + WHERE INTERVAL_TBL.f1 < interval '@ 1 day'; + +SELECT '' AS one, * FROM INTERVAL_TBL + WHERE INTERVAL_TBL.f1 = interval '@ 34 years'; + +SELECT '' AS five, * FROM INTERVAL_TBL + WHERE INTERVAL_TBL.f1 >= interval '@ 1 month'; + +SELECT '' AS nine, * FROM INTERVAL_TBL + WHERE INTERVAL_TBL.f1 > interval '@ 3 seconds ago'; + +SELECT '' AS fortyfive, r1.*, r2.* + FROM INTERVAL_TBL r1, INTERVAL_TBL r2 + WHERE r1.f1 > r2.f1 + ORDER BY r1.f1, r2.f1; + +-- Test intervals that are large enough to overflow 64 bits in comparisons +CREATE TEMP TABLE INTERVAL_TBL_OF (f1 interval); +INSERT INTO INTERVAL_TBL_OF (f1) VALUES + ('2147483647 days 2147483647 months'), + ('2147483647 days -2147483648 months'), + ('1 year'), + ('-2147483648 days 2147483647 months'), + ('-2147483648 days -2147483648 months'); +-- these should fail as out-of-range +INSERT INTO INTERVAL_TBL_OF (f1) VALUES ('2147483648 days'); +INSERT INTO INTERVAL_TBL_OF (f1) VALUES ('-2147483649 days'); +INSERT INTO INTERVAL_TBL_OF (f1) VALUES ('2147483647 years'); +INSERT INTO INTERVAL_TBL_OF (f1) VALUES ('-2147483648 years'); + +-- Test edge-case overflow detection in interval multiplication +select extract(epoch from '256 microseconds'::interval * (2^55)::float8); + +SELECT r1.*, r2.* + FROM INTERVAL_TBL_OF r1, INTERVAL_TBL_OF r2 + WHERE r1.f1 > r2.f1 + ORDER BY r1.f1, r2.f1; + +CREATE INDEX ON INTERVAL_TBL_OF USING btree (f1); +SET enable_seqscan TO false; +EXPLAIN (COSTS OFF) +SELECT f1 FROM INTERVAL_TBL_OF r1 ORDER BY f1; +SELECT f1 FROM INTERVAL_TBL_OF r1 ORDER BY f1; +RESET enable_seqscan; + +DROP TABLE INTERVAL_TBL_OF; + +-- Test multiplication and division with intervals. +-- Floating point arithmetic rounding errors can lead to unexpected results, +-- though the code attempts to do the right thing and round up to days and +-- minutes to avoid results such as '3 days 24:00 hours' or '14:20:60'. +-- Note that it is expected for some day components to be greater than 29 and +-- some time components be greater than 23:59:59 due to how intervals are +-- stored internally. + +CREATE TABLE INTERVAL_MULDIV_TBL (span interval); +COPY INTERVAL_MULDIV_TBL FROM STDIN; +\. + +SELECT span * 0.3 AS product +FROM INTERVAL_MULDIV_TBL; + +SELECT span * 8.2 AS product +FROM INTERVAL_MULDIV_TBL; + +SELECT span / 10 AS quotient +FROM INTERVAL_MULDIV_TBL; + +SELECT span / 100 AS quotient +FROM INTERVAL_MULDIV_TBL; + +DROP TABLE INTERVAL_MULDIV_TBL; + +SET DATESTYLE = 'postgres'; +SET IntervalStyle to postgres_verbose; + +SELECT '' AS ten, * FROM INTERVAL_TBL; + +-- test avg(interval), which is somewhat fragile since people have been +-- known to change the allowed input syntax for type interval without +-- updating pg_aggregate.agginitval + +select avg(f1) from interval_tbl; + +-- test long interval input +select '4 millenniums 5 centuries 4 decades 1 year 4 months 4 days 17 minutes 31 seconds'::interval; + +-- test long interval output +-- Note: the actual maximum length of the interval output is longer, +-- but we need the test to work for both integer and floating-point +-- timestamps. +select '100000000y 10mon -1000000000d -100000h -10min -10.000001s ago'::interval; + +-- test justify_hours() and justify_days() + +SELECT justify_hours(interval '6 months 3 days 52 hours 3 minutes 2 seconds') as "6 mons 5 days 4 hours 3 mins 2 seconds"; +SELECT justify_days(interval '6 months 36 days 5 hours 4 minutes 3 seconds') as "7 mons 6 days 5 hours 4 mins 3 seconds"; + +-- test justify_interval() + +SELECT justify_interval(interval '1 month -1 hour') as "1 month -1 hour"; + +-- test fractional second input, and detection of duplicate units +SET DATESTYLE = 'ISO'; +SET IntervalStyle TO postgres; + +SELECT '1 millisecond'::interval, '1 microsecond'::interval, + '500 seconds 99 milliseconds 51 microseconds'::interval; +SELECT '3 days 5 milliseconds'::interval; + +SELECT '1 second 2 seconds'::interval; -- error +SELECT '10 milliseconds 20 milliseconds'::interval; -- error +SELECT '5.5 seconds 3 milliseconds'::interval; -- error +SELECT '1:20:05 5 microseconds'::interval; -- error +SELECT '1 day 1 day'::interval; -- error +SELECT interval '1-2'; -- SQL year-month literal +SELECT interval '999' second; -- oversize leading field is ok +SELECT interval '999' minute; +SELECT interval '999' hour; +SELECT interval '999' day; +SELECT interval '999' month; + +-- test SQL-spec syntaxes for restricted field sets +SELECT interval '1' year; +SELECT interval '2' month; +SELECT interval '3' day; +SELECT interval '4' hour; +SELECT interval '5' minute; +SELECT interval '6' second; +SELECT interval '1' year to month; +SELECT interval '1-2' year to month; +SELECT interval '1 2' day to hour; +SELECT interval '1 2:03' day to hour; +SELECT interval '1 2:03:04' day to hour; +SELECT interval '1 2' day to minute; +SELECT interval '1 2:03' day to minute; +SELECT interval '1 2:03:04' day to minute; +SELECT interval '1 2' day to second; +SELECT interval '1 2:03' day to second; +SELECT interval '1 2:03:04' day to second; +SELECT interval '1 2' hour to minute; +SELECT interval '1 2:03' hour to minute; +SELECT interval '1 2:03:04' hour to minute; +SELECT interval '1 2' hour to second; +SELECT interval '1 2:03' hour to second; +SELECT interval '1 2:03:04' hour to second; +SELECT interval '1 2' minute to second; +SELECT interval '1 2:03' minute to second; +SELECT interval '1 2:03:04' minute to second; +SELECT interval '1 +2:03' minute to second; +SELECT interval '1 +2:03:04' minute to second; +SELECT interval '1 -2:03' minute to second; +SELECT interval '1 -2:03:04' minute to second; +SELECT interval '123 11' day to hour; -- ok +SELECT interval '123 11' day; -- not ok +SELECT interval '123 11'; -- not ok, too ambiguous +SELECT interval '123 2:03 -2:04'; -- not ok, redundant hh:mm fields + +-- test syntaxes for restricted precision +SELECT interval(0) '1 day 01:23:45.6789'; +SELECT interval(2) '1 day 01:23:45.6789'; +SELECT interval '12:34.5678' minute to second(2); -- per SQL spec +SELECT interval '1.234' second; +SELECT interval '1.234' second(2); +SELECT interval '1 2.345' day to second(2); +SELECT interval '1 2:03' day to second(2); +SELECT interval '1 2:03.4567' day to second(2); +SELECT interval '1 2:03:04.5678' day to second(2); +SELECT interval '1 2.345' hour to second(2); +SELECT interval '1 2:03.45678' hour to second(2); +SELECT interval '1 2:03:04.5678' hour to second(2); +SELECT interval '1 2.3456' minute to second(2); +SELECT interval '1 2:03.5678' minute to second(2); +SELECT interval '1 2:03:04.5678' minute to second(2); + +-- test casting to restricted precision (bug #14479) +SELECT f1, f1::INTERVAL DAY TO MINUTE AS "minutes", + (f1 + INTERVAL '1 month')::INTERVAL MONTH::INTERVAL YEAR AS "years" + FROM interval_tbl; + +-- test inputting and outputting SQL standard interval literals +SET IntervalStyle TO sql_standard; +SELECT interval '0' AS "zero", + interval '1-2' year to month AS "year-month", + interval '1 2:03:04' day to second AS "day-time", + - interval '1-2' AS "negative year-month", + - interval '1 2:03:04' AS "negative day-time"; + +-- test input of some not-quite-standard interval values in the sql style +SET IntervalStyle TO postgres; +SELECT interval '+1 -1:00:00', + interval '-1 +1:00:00', + interval '+1-2 -3 +4:05:06.789', + interval '-1-2 +3 -4:05:06.789'; + +-- test output of couple non-standard interval values in the sql style +SET IntervalStyle TO sql_standard; +SELECT interval '1 day -1 hours', + interval '-1 days +1 hours', + interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds', + - interval '1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds'; + +-- test outputting iso8601 intervals +SET IntervalStyle to iso_8601; +select interval '0' AS "zero", + interval '1-2' AS "a year 2 months", + interval '1 2:03:04' AS "a bit over a day", + interval '2:03:04.45679' AS "a bit over 2 hours", + (interval '1-2' + interval '3 4:05:06.7') AS "all fields", + (interval '1-2' - interval '3 4:05:06.7') AS "mixed sign", + (- interval '1-2' + interval '3 4:05:06.7') AS "negative"; + +-- test inputting ISO 8601 4.4.2.1 "Format With Time Unit Designators" +SET IntervalStyle to sql_standard; +select interval 'P0Y' AS "zero", + interval 'P1Y2M' AS "a year 2 months", + interval 'P1W' AS "a week", + interval 'P1DT2H3M4S' AS "a bit over a day", + interval 'P1Y2M3DT4H5M6.7S' AS "all fields", + interval 'P-1Y-2M-3DT-4H-5M-6.7S' AS "negative", + interval 'PT-0.1S' AS "fractional second"; + +-- test inputting ISO 8601 4.4.2.2 "Alternative Format" +SET IntervalStyle to postgres; +select interval 'P00021015T103020' AS "ISO8601 Basic Format", + interval 'P0002-10-15T10:30:20' AS "ISO8601 Extended Format"; + +-- Make sure optional ISO8601 alternative format fields are optional. +select interval 'P0002' AS "year only", + interval 'P0002-10' AS "year month", + interval 'P0002-10-15' AS "year month day", + interval 'P0002T1S' AS "year only plus time", + interval 'P0002-10T1S' AS "year month plus time", + interval 'P0002-10-15T1S' AS "year month day plus time", + interval 'PT10' AS "hour only", + interval 'PT10:30' AS "hour minute"; + +-- test a couple rounding cases that changed since 8.3 w/ HAVE_INT64_TIMESTAMP. +SET IntervalStyle to postgres_verbose; +select interval '-10 mons -3 days +03:55:06.70'; +select interval '1 year 2 mons 3 days 04:05:06.699999'; +select interval '0:0:0.7', interval '@ 0.70 secs', interval '0.7 seconds'; + +-- check that '30 days' equals '1 month' according to the hash function +select '30 days'::interval = '1 month'::interval as t; +select interval_hash('30 days'::interval) = interval_hash('1 month'::interval) as t; + +-- numeric constructor +select make_interval(years := 2); +select make_interval(years := 1, months := 6); +select make_interval(years := 1, months := -1, weeks := 5, days := -7, hours := 25, mins := -180); + +select make_interval() = make_interval(years := 0, months := 0, weeks := 0, days := 0, mins := 0, secs := 0.0); +select make_interval(hours := -2, mins := -10, secs := -25.3); + +select make_interval(years := 'inf'::float::int); +select make_interval(months := 'NaN'::float::int); +select make_interval(secs := 'inf'); +select make_interval(secs := 'NaN'); +select make_interval(secs := 7e12); + +-- +-- test EXTRACT +-- +SELECT f1, + EXTRACT(MICROSECOND FROM f1) AS MICROSECOND, + EXTRACT(MILLISECOND FROM f1) AS MILLISECOND, + EXTRACT(SECOND FROM f1) AS SECOND, + EXTRACT(MINUTE FROM f1) AS MINUTE, + EXTRACT(HOUR FROM f1) AS HOUR, + EXTRACT(DAY FROM f1) AS DAY, + EXTRACT(MONTH FROM f1) AS MONTH, + EXTRACT(QUARTER FROM f1) AS QUARTER, + EXTRACT(YEAR FROM f1) AS YEAR, + EXTRACT(DECADE FROM f1) AS DECADE, + EXTRACT(CENTURY FROM f1) AS CENTURY, + EXTRACT(MILLENNIUM FROM f1) AS MILLENNIUM, + EXTRACT(EPOCH FROM f1) AS EPOCH + FROM INTERVAL_TBL; + +SELECT EXTRACT(FORTNIGHT FROM INTERVAL '2 days'); -- error +SELECT EXTRACT(TIMEZONE FROM INTERVAL '2 days'); -- error + +SELECT EXTRACT(DECADE FROM INTERVAL '100 y'); +SELECT EXTRACT(DECADE FROM INTERVAL '99 y'); +SELECT EXTRACT(DECADE FROM INTERVAL '-99 y'); +SELECT EXTRACT(DECADE FROM INTERVAL '-100 y'); + +SELECT EXTRACT(CENTURY FROM INTERVAL '100 y'); +SELECT EXTRACT(CENTURY FROM INTERVAL '99 y'); +SELECT EXTRACT(CENTURY FROM INTERVAL '-99 y'); +SELECT EXTRACT(CENTURY FROM INTERVAL '-100 y'); diff --git a/postgresql/examples/join.sql b/postgresql/examples/join.sql new file mode 100644 index 0000000..1403e0f --- /dev/null +++ b/postgresql/examples/join.sql @@ -0,0 +1,2173 @@ +-- +-- JOIN +-- Test JOIN clauses +-- + +CREATE TABLE J1_TBL ( + i integer, + j integer, + t text +); + +CREATE TABLE J2_TBL ( + i integer, + k integer +); + + +INSERT INTO J1_TBL VALUES (1, 4, 'one'); +INSERT INTO J1_TBL VALUES (2, 3, 'two'); +INSERT INTO J1_TBL VALUES (3, 2, 'three'); +INSERT INTO J1_TBL VALUES (4, 1, 'four'); +INSERT INTO J1_TBL VALUES (5, 0, 'five'); +INSERT INTO J1_TBL VALUES (6, 6, 'six'); +INSERT INTO J1_TBL VALUES (7, 7, 'seven'); +INSERT INTO J1_TBL VALUES (8, 8, 'eight'); +INSERT INTO J1_TBL VALUES (0, NULL, 'zero'); +INSERT INTO J1_TBL VALUES (NULL, NULL, 'null'); +INSERT INTO J1_TBL VALUES (NULL, 0, 'zero'); + +INSERT INTO J2_TBL VALUES (1, -1); +INSERT INTO J2_TBL VALUES (2, 2); +INSERT INTO J2_TBL VALUES (3, -3); +INSERT INTO J2_TBL VALUES (2, 4); +INSERT INTO J2_TBL VALUES (5, -5); +INSERT INTO J2_TBL VALUES (5, -5); +INSERT INTO J2_TBL VALUES (0, NULL); +INSERT INTO J2_TBL VALUES (NULL, NULL); +INSERT INTO J2_TBL VALUES (NULL, 0); + +-- useful in some tests below +create temp table onerow(); +insert into onerow default values; +analyze onerow; + + +-- +-- CORRELATION NAMES +-- Make sure that table/column aliases are supported +-- before diving into more complex join syntax. +-- + +SELECT '' AS "xxx", * + FROM J1_TBL AS tx; + +SELECT '' AS "xxx", * + FROM J1_TBL tx; + +SELECT '' AS "xxx", * + FROM J1_TBL AS t1 (a, b, c); + +SELECT '' AS "xxx", * + FROM J1_TBL t1 (a, b, c); + +SELECT '' AS "xxx", * + FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e); + +SELECT '' AS "xxx", t1.a, t2.e + FROM J1_TBL t1 (a, b, c), J2_TBL t2 (d, e) + WHERE t1.a = t2.d; + + +-- +-- CROSS JOIN +-- Qualifications are not allowed on cross joins, +-- which degenerate into a standard unqualified inner join. +-- + +SELECT '' AS "xxx", * + FROM J1_TBL CROSS JOIN J2_TBL; + +-- ambiguous column +SELECT '' AS "xxx", i, k, t + FROM J1_TBL CROSS JOIN J2_TBL; + +-- resolve previous ambiguity by specifying the table name +SELECT '' AS "xxx", t1.i, k, t + FROM J1_TBL t1 CROSS JOIN J2_TBL t2; + +SELECT '' AS "xxx", ii, tt, kk + FROM (J1_TBL CROSS JOIN J2_TBL) + AS tx (ii, jj, tt, ii2, kk); + +SELECT '' AS "xxx", tx.ii, tx.jj, tx.kk + FROM (J1_TBL t1 (a, b, c) CROSS JOIN J2_TBL t2 (d, e)) + AS tx (ii, jj, tt, ii2, kk); + +SELECT '' AS "xxx", * + FROM J1_TBL CROSS JOIN J2_TBL a CROSS JOIN J2_TBL b; + + +-- +-- +-- Inner joins (equi-joins) +-- +-- + +-- +-- Inner joins (equi-joins) with USING clause +-- The USING syntax changes the shape of the resulting table +-- by including a column in the USING clause only once in the result. +-- + +-- Inner equi-join on specified column +SELECT '' AS "xxx", * + FROM J1_TBL INNER JOIN J2_TBL USING (i); + +-- Same as above, slightly different syntax +SELECT '' AS "xxx", * + FROM J1_TBL JOIN J2_TBL USING (i); + +SELECT '' AS "xxx", * + FROM J1_TBL t1 (a, b, c) JOIN J2_TBL t2 (a, d) USING (a) + ORDER BY a, d; + +SELECT '' AS "xxx", * + FROM J1_TBL t1 (a, b, c) JOIN J2_TBL t2 (a, b) USING (b) + ORDER BY b, t1.a; + + +-- +-- NATURAL JOIN +-- Inner equi-join on all columns with the same name +-- + +SELECT '' AS "xxx", * + FROM J1_TBL NATURAL JOIN J2_TBL; + +SELECT '' AS "xxx", * + FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (a, d); + +SELECT '' AS "xxx", * + FROM J1_TBL t1 (a, b, c) NATURAL JOIN J2_TBL t2 (d, a); + +-- mismatch number of columns +-- currently, Postgres will fill in with underlying names +SELECT '' AS "xxx", * + FROM J1_TBL t1 (a, b) NATURAL JOIN J2_TBL t2 (a); + + +-- +-- Inner joins (equi-joins) +-- + +SELECT '' AS "xxx", * + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.i); + +SELECT '' AS "xxx", * + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i = J2_TBL.k); + + +-- +-- Non-equi-joins +-- + +SELECT '' AS "xxx", * + FROM J1_TBL JOIN J2_TBL ON (J1_TBL.i <= J2_TBL.k); + + +-- +-- Outer joins +-- Note that OUTER is a noise word +-- + +SELECT '' AS "xxx", * + FROM J1_TBL LEFT OUTER JOIN J2_TBL USING (i) + ORDER BY i, k, t; + +SELECT '' AS "xxx", * + FROM J1_TBL LEFT JOIN J2_TBL USING (i) + ORDER BY i, k, t; + +SELECT '' AS "xxx", * + FROM J1_TBL RIGHT OUTER JOIN J2_TBL USING (i); + +SELECT '' AS "xxx", * + FROM J1_TBL RIGHT JOIN J2_TBL USING (i); + +SELECT '' AS "xxx", * + FROM J1_TBL FULL OUTER JOIN J2_TBL USING (i) + ORDER BY i, k, t; + +SELECT '' AS "xxx", * + FROM J1_TBL FULL JOIN J2_TBL USING (i) + ORDER BY i, k, t; + +SELECT '' AS "xxx", * + FROM J1_TBL LEFT JOIN J2_TBL USING (i) WHERE (k = 1); + +SELECT '' AS "xxx", * + FROM J1_TBL LEFT JOIN J2_TBL USING (i) WHERE (i = 1); + +-- +-- semijoin selectivity for <> +-- +explain (costs off) +select * from int4_tbl i4, tenk1 a +where exists(select * from tenk1 b + where a.twothousand = b.twothousand and a.fivethous <> b.fivethous) + and i4.f1 = a.tenthous; + + +-- +-- More complicated constructs +-- + +-- +-- Multiway full join +-- + +CREATE TABLE t1 (name TEXT, n INTEGER); +CREATE TABLE t2 (name TEXT, n INTEGER); +CREATE TABLE t3 (name TEXT, n INTEGER); + +INSERT INTO t1 VALUES ( 'bb', 11 ); +INSERT INTO t2 VALUES ( 'bb', 12 ); +INSERT INTO t2 VALUES ( 'cc', 22 ); +INSERT INTO t2 VALUES ( 'ee', 42 ); +INSERT INTO t3 VALUES ( 'bb', 13 ); +INSERT INTO t3 VALUES ( 'cc', 23 ); +INSERT INTO t3 VALUES ( 'dd', 33 ); + +SELECT * FROM t1 FULL JOIN t2 USING (name) FULL JOIN t3 USING (name); + +-- +-- Test interactions of join syntax and subqueries +-- + +-- Basic cases (we expect planner to pull up the subquery here) +SELECT * FROM +(SELECT * FROM t2) as s2 +INNER JOIN +(SELECT * FROM t3) s3 +USING (name); + +SELECT * FROM +(SELECT * FROM t2) as s2 +LEFT JOIN +(SELECT * FROM t3) s3 +USING (name); + +SELECT * FROM +(SELECT * FROM t2) as s2 +FULL JOIN +(SELECT * FROM t3) s3 +USING (name); + +-- Cases with non-nullable expressions in subquery results; +-- make sure these go to null as expected +SELECT * FROM +(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 +NATURAL INNER JOIN +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; + +SELECT * FROM +(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 +NATURAL LEFT JOIN +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; + +SELECT * FROM +(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 +NATURAL FULL JOIN +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; + +SELECT * FROM +(SELECT name, n as s1_n, 1 as s1_1 FROM t1) as s1 +NATURAL INNER JOIN +(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 +NATURAL INNER JOIN +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; + +SELECT * FROM +(SELECT name, n as s1_n, 1 as s1_1 FROM t1) as s1 +NATURAL FULL JOIN +(SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 +NATURAL FULL JOIN +(SELECT name, n as s3_n, 3 as s3_2 FROM t3) s3; + +SELECT * FROM +(SELECT name, n as s1_n FROM t1) as s1 +NATURAL FULL JOIN + (SELECT * FROM + (SELECT name, n as s2_n FROM t2) as s2 + NATURAL FULL JOIN + (SELECT name, n as s3_n FROM t3) as s3 + ) ss2; + +SELECT * FROM +(SELECT name, n as s1_n FROM t1) as s1 +NATURAL FULL JOIN + (SELECT * FROM + (SELECT name, n as s2_n, 2 as s2_2 FROM t2) as s2 + NATURAL FULL JOIN + (SELECT name, n as s3_n FROM t3) as s3 + ) ss2; + +-- Constants as join keys can also be problematic +SELECT * FROM + (SELECT name, n as s1_n FROM t1) as s1 +FULL JOIN + (SELECT name, 2 as s2_n FROM t2) as s2 +ON (s1_n = s2_n); + + +-- Test for propagation of nullability constraints into sub-joins + +create temp table x (x1 int, x2 int); +insert into x values (1,11); +insert into x values (2,22); +insert into x values (3,null); +insert into x values (4,44); +insert into x values (5,null); + +create temp table y (y1 int, y2 int); +insert into y values (1,111); +insert into y values (2,222); +insert into y values (3,333); +insert into y values (4,null); + +select * from x; +select * from y; + +select * from x left join y on (x1 = y1 and x2 is not null); +select * from x left join y on (x1 = y1 and y2 is not null); + +select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) +on (x1 = xx1); +select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) +on (x1 = xx1 and x2 is not null); +select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) +on (x1 = xx1 and y2 is not null); +select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) +on (x1 = xx1 and xx2 is not null); +-- these should NOT give the same answers as above +select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) +on (x1 = xx1) where (x2 is not null); +select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) +on (x1 = xx1) where (y2 is not null); +select * from (x left join y on (x1 = y1)) left join x xx(xx1,xx2) +on (x1 = xx1) where (xx2 is not null); + +-- +-- regression test: check for bug with propagation of implied equality +-- to outside an IN +-- +select count(*) from tenk1 a where unique1 in + (select unique1 from tenk1 b join tenk1 c using (unique1) + where b.unique2 = 42); + +-- +-- regression test: check for failure to generate a plan with multiple +-- degenerate IN clauses +-- +select count(*) from tenk1 x where + x.unique1 in (select a.f1 from int4_tbl a,float8_tbl b where a.f1=b.f1) and + x.unique1 = 0 and + x.unique1 in (select aa.f1 from int4_tbl aa,float8_tbl bb where aa.f1=bb.f1); + +-- try that with GEQO too +begin; +set geqo = on; +set geqo_threshold = 2; +select count(*) from tenk1 x where + x.unique1 in (select a.f1 from int4_tbl a,float8_tbl b where a.f1=b.f1) and + x.unique1 = 0 and + x.unique1 in (select aa.f1 from int4_tbl aa,float8_tbl bb where aa.f1=bb.f1); +rollback; + +-- +-- regression test: be sure we cope with proven-dummy append rels +-- +explain (costs off) +select aa, bb, unique1, unique1 + from tenk1 right join b on aa = unique1 + where bb < bb and bb is null; + +select aa, bb, unique1, unique1 + from tenk1 right join b on aa = unique1 + where bb < bb and bb is null; + +-- +-- regression test: check handling of empty-FROM subquery underneath outer join +-- +explain (costs off) +select * from int8_tbl i1 left join (int8_tbl i2 join + (select 123 as x) ss on i2.q1 = x) on i1.q2 = i2.q2 +order by 1, 2; + +select * from int8_tbl i1 left join (int8_tbl i2 join + (select 123 as x) ss on i2.q1 = x) on i1.q2 = i2.q2 +order by 1, 2; + +-- +-- regression test: check a case where join_clause_is_movable_into() gives +-- an imprecise result, causing an assertion failure +-- +select count(*) +from + (select t3.tenthous as x1, coalesce(t1.stringu1, t2.stringu1) as x2 + from tenk1 t1 + left join tenk1 t2 on t1.unique1 = t2.unique1 + join tenk1 t3 on t1.unique2 = t3.unique2) ss, + tenk1 t4, + tenk1 t5 +where t4.thousand = t5.unique1 and ss.x1 = t4.tenthous and ss.x2 = t5.stringu1; + +-- +-- regression test: check a case where we formerly missed including an EC +-- enforcement clause because it was expected to be handled at scan level +-- +explain (costs off) +select a.f1, b.f1, t.thousand, t.tenthous from + tenk1 t, + (select sum(f1)+1 as f1 from int4_tbl i4a) a, + (select sum(f1) as f1 from int4_tbl i4b) b +where b.f1 = t.thousand and a.f1 = b.f1 and (a.f1+b.f1+999) = t.tenthous; + +select a.f1, b.f1, t.thousand, t.tenthous from + tenk1 t, + (select sum(f1)+1 as f1 from int4_tbl i4a) a, + (select sum(f1) as f1 from int4_tbl i4b) b +where b.f1 = t.thousand and a.f1 = b.f1 and (a.f1+b.f1+999) = t.tenthous; + +-- +-- check a case where we formerly got confused by conflicting sort orders +-- in redundant merge join path keys +-- +explain (costs off) +select * from + j1_tbl full join + (select * from j2_tbl order by j2_tbl.i desc, j2_tbl.k asc) j2_tbl + on j1_tbl.i = j2_tbl.i and j1_tbl.i = j2_tbl.k; + +select * from + j1_tbl full join + (select * from j2_tbl order by j2_tbl.i desc, j2_tbl.k asc) j2_tbl + on j1_tbl.i = j2_tbl.i and j1_tbl.i = j2_tbl.k; + +-- +-- a different check for handling of redundant sort keys in merge joins +-- +explain (costs off) +select count(*) from + (select * from tenk1 x order by x.thousand, x.twothousand, x.fivethous) x + left join + (select * from tenk1 y order by y.unique2) y + on x.thousand = y.unique2 and x.twothousand = y.hundred and x.fivethous = y.unique2; + +select count(*) from + (select * from tenk1 x order by x.thousand, x.twothousand, x.fivethous) x + left join + (select * from tenk1 y order by y.unique2) y + on x.thousand = y.unique2 and x.twothousand = y.hundred and x.fivethous = y.unique2; + + +-- +-- Clean up +-- + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +DROP TABLE J1_TBL; +DROP TABLE J2_TBL; + +-- Both DELETE and UPDATE allow the specification of additional tables +-- to "join" against to determine which rows should be modified. + +CREATE TEMP TABLE t1 (a int, b int); +CREATE TEMP TABLE t2 (a int, b int); +CREATE TEMP TABLE t3 (x int, y int); + +INSERT INTO t1 VALUES (5, 10); +INSERT INTO t1 VALUES (15, 20); +INSERT INTO t1 VALUES (100, 100); +INSERT INTO t1 VALUES (200, 1000); +INSERT INTO t2 VALUES (200, 2000); +INSERT INTO t3 VALUES (5, 20); +INSERT INTO t3 VALUES (6, 7); +INSERT INTO t3 VALUES (7, 8); +INSERT INTO t3 VALUES (500, 100); + +DELETE FROM t3 USING t1 table1 WHERE t3.x = table1.a; +SELECT * FROM t3; +DELETE FROM t3 USING t1 JOIN t2 USING (a) WHERE t3.x > t1.a; +SELECT * FROM t3; +DELETE FROM t3 USING t3 t3_other WHERE t3.x = t3_other.x AND t3.y = t3_other.y; +SELECT * FROM t3; + +-- Test join against inheritance tree + +create temp table t2a () inherits (t2); + +insert into t2a values (200, 2001); + +select * from t1 left join t2 on (t1.a = t2.a); + +-- Test matching of column name with wrong alias + +select t1.x from t1 join t3 on (t1.a = t3.x); + +-- +-- regression test for 8.1 merge right join bug +-- + +CREATE TEMP TABLE tt1 ( tt1_id int4, joincol int4 ); +INSERT INTO tt1 VALUES (1, 11); +INSERT INTO tt1 VALUES (2, NULL); + +CREATE TEMP TABLE tt2 ( tt2_id int4, joincol int4 ); +INSERT INTO tt2 VALUES (21, 11); +INSERT INTO tt2 VALUES (22, 11); + +set enable_hashjoin to off; +set enable_nestloop to off; + +-- these should give the same results + +select tt1.*, tt2.* from tt1 left join tt2 on tt1.joincol = tt2.joincol; + +select tt1.*, tt2.* from tt2 right join tt1 on tt1.joincol = tt2.joincol; + +reset enable_hashjoin; +reset enable_nestloop; + +-- +-- regression test for bug #13908 (hash join with skew tuples & nbatch increase) +-- + +set work_mem to '64kB'; +set enable_mergejoin to off; + +explain (costs off) +select count(*) from tenk1 a, tenk1 b + where a.hundred = b.thousand and (b.fivethous % 10) < 10; +select count(*) from tenk1 a, tenk1 b + where a.hundred = b.thousand and (b.fivethous % 10) < 10; + +reset work_mem; +reset enable_mergejoin; + +-- +-- regression test for 8.2 bug with improper re-ordering of left joins +-- + +create temp table tt3(f1 int, f2 text); +insert into tt3 select x, repeat('xyzzy', 100) from generate_series(1,10000) x; +create index tt3i on tt3(f1); +analyze tt3; + +create temp table tt4(f1 int); +insert into tt4 values (0),(1),(9999); +analyze tt4; + +SELECT a.f1 +FROM tt4 a +LEFT JOIN ( + SELECT b.f1 + FROM tt3 b LEFT JOIN tt3 c ON (b.f1 = c.f1) + WHERE c.f1 IS NULL +) AS d ON (a.f1 = d.f1) +WHERE d.f1 IS NULL; + +-- +-- regression test for proper handling of outer joins within antijoins +-- + +create temp table tt4x(c1 int, c2 int, c3 int); + +explain (costs off) +select * from tt4x t1 +where not exists ( + select 1 from tt4x t2 + left join tt4x t3 on t2.c3 = t3.c1 + left join ( select t5.c1 as c1 + from tt4x t4 left join tt4x t5 on t4.c2 = t5.c1 + ) a1 on t3.c2 = a1.c1 + where t1.c1 = t2.c2 +); + +-- +-- regression test for problems of the sort depicted in bug #3494 +-- + +create temp table tt5(f1 int, f2 int); +create temp table tt6(f1 int, f2 int); + +insert into tt5 values(1, 10); +insert into tt5 values(1, 11); + +insert into tt6 values(1, 9); +insert into tt6 values(1, 2); +insert into tt6 values(2, 9); + +select * from tt5,tt6 where tt5.f1 = tt6.f1 and tt5.f1 = tt5.f2 - tt6.f2; + +-- +-- regression test for problems of the sort depicted in bug #3588 +-- + +create temp table xx (pkxx int); +create temp table yy (pkyy int, pkxx int); + +insert into xx values (1); +insert into xx values (2); +insert into xx values (3); + +insert into yy values (101, 1); +insert into yy values (201, 2); +insert into yy values (301, NULL); + +select yy.pkyy as yy_pkyy, yy.pkxx as yy_pkxx, yya.pkyy as yya_pkyy, + xxa.pkxx as xxa_pkxx, xxb.pkxx as xxb_pkxx +from yy + left join (SELECT * FROM yy where pkyy = 101) as yya ON yy.pkyy = yya.pkyy + left join xx xxa on yya.pkxx = xxa.pkxx + left join xx xxb on coalesce (xxa.pkxx, 1) = xxb.pkxx; + +-- +-- regression test for improper pushing of constants across outer-join clauses +-- (as seen in early 8.2.x releases) +-- + +create temp table zt1 (f1 int primary key); +create temp table zt2 (f2 int primary key); +create temp table zt3 (f3 int primary key); +insert into zt1 values(53); +insert into zt2 values(53); + +select * from + zt2 left join zt3 on (f2 = f3) + left join zt1 on (f3 = f1) +where f2 = 53; + +create temp view zv1 as select *,'dummy'::text AS junk from zt1; + +select * from + zt2 left join zt3 on (f2 = f3) + left join zv1 on (f3 = f1) +where f2 = 53; + +-- +-- regression test for improper extraction of OR indexqual conditions +-- (as seen in early 8.3.x releases) +-- + +select a.unique2, a.ten, b.tenthous, b.unique2, b.hundred +from tenk1 a left join tenk1 b on a.unique2 = b.tenthous +where a.unique1 = 42 and + ((b.unique2 is null and a.ten = 2) or b.hundred = 3); + +-- +-- test proper positioning of one-time quals in EXISTS (8.4devel bug) +-- +prepare foo(bool) as + select count(*) from tenk1 a left join tenk1 b + on (a.unique2 = b.unique1 and exists + (select 1 from tenk1 c where c.thousand = b.unique2 and $1)); +execute foo(true); +execute foo(false); + +-- +-- test for sane behavior with noncanonical merge clauses, per bug #4926 +-- + +begin; + +set enable_mergejoin = 1; +set enable_hashjoin = 0; +set enable_nestloop = 0; + +create temp table a (i integer); +create temp table b (x integer, y integer); + +select * from a left join b on i = x and i = y and x = i; + +rollback; + +-- +-- test handling of merge clauses using record_ops +-- +begin; + +create type mycomptype as (id int, v bigint); + +create temp table tidv (idv mycomptype); +create index on tidv (idv); + +explain (costs off) +select a.idv, b.idv from tidv a, tidv b where a.idv = b.idv; + +set enable_mergejoin = 0; + +explain (costs off) +select a.idv, b.idv from tidv a, tidv b where a.idv = b.idv; + +rollback; + +-- +-- test NULL behavior of whole-row Vars, per bug #5025 +-- +select t1.q2, count(t2.*) +from int8_tbl t1 left join int8_tbl t2 on (t1.q2 = t2.q1) +group by t1.q2 order by 1; + +select t1.q2, count(t2.*) +from int8_tbl t1 left join (select * from int8_tbl) t2 on (t1.q2 = t2.q1) +group by t1.q2 order by 1; + +select t1.q2, count(t2.*) +from int8_tbl t1 left join (select * from int8_tbl offset 0) t2 on (t1.q2 = t2.q1) +group by t1.q2 order by 1; + +select t1.q2, count(t2.*) +from int8_tbl t1 left join + (select q1, case when q2=1 then 1 else q2 end as q2 from int8_tbl) t2 + on (t1.q2 = t2.q1) +group by t1.q2 order by 1; + +-- +-- test incorrect failure to NULL pulled-up subexpressions +-- +begin; + +create temp table a ( + code char not null, + constraint a_pk primary key (code) +); +create temp table b ( + a char not null, + num integer not null, + constraint b_pk primary key (a, num) +); +create temp table c ( + name char not null, + a char, + constraint c_pk primary key (name) +); + +insert into a (code) values ('p'); +insert into a (code) values ('q'); +insert into b (a, num) values ('p', 1); +insert into b (a, num) values ('p', 2); +insert into c (name, a) values ('A', 'p'); +insert into c (name, a) values ('B', 'q'); +insert into c (name, a) values ('C', null); + +select c.name, ss.code, ss.b_cnt, ss.const +from c left join + (select a.code, coalesce(b_grp.cnt, 0) as b_cnt, -1 as const + from a left join + (select count(1) as cnt, b.a from b group by b.a) as b_grp + on a.code = b_grp.a + ) as ss + on (c.a = ss.code) +order by c.name; + +rollback; + +-- +-- test incorrect handling of placeholders that only appear in targetlists, +-- per bug #6154 +-- +SELECT * FROM +( SELECT 1 as key1 ) sub1 +LEFT JOIN +( SELECT sub3.key3, sub4.value2, COALESCE(sub4.value2, 66) as value3 FROM + ( SELECT 1 as key3 ) sub3 + LEFT JOIN + ( SELECT sub5.key5, COALESCE(sub6.value1, 1) as value2 FROM + ( SELECT 1 as key5 ) sub5 + LEFT JOIN + ( SELECT 2 as key6, 42 as value1 ) sub6 + ON sub5.key5 = sub6.key6 + ) sub4 + ON sub4.key5 = sub3.key3 +) sub2 +ON sub1.key1 = sub2.key3; + +-- test the path using join aliases, too +SELECT * FROM +( SELECT 1 as key1 ) sub1 +LEFT JOIN +( SELECT sub3.key3, value2, COALESCE(value2, 66) as value3 FROM + ( SELECT 1 as key3 ) sub3 + LEFT JOIN + ( SELECT sub5.key5, COALESCE(sub6.value1, 1) as value2 FROM + ( SELECT 1 as key5 ) sub5 + LEFT JOIN + ( SELECT 2 as key6, 42 as value1 ) sub6 + ON sub5.key5 = sub6.key6 + ) sub4 + ON sub4.key5 = sub3.key3 +) sub2 +ON sub1.key1 = sub2.key3; + +-- +-- test case where a PlaceHolderVar is used as a nestloop parameter +-- + +EXPLAIN (COSTS OFF) +SELECT qq, unique1 + FROM + ( SELECT COALESCE(q1, 0) AS qq FROM int8_tbl a ) AS ss1 + FULL OUTER JOIN + ( SELECT COALESCE(q2, -1) AS qq FROM int8_tbl b ) AS ss2 + USING (qq) + INNER JOIN tenk1 c ON qq = unique2; + +SELECT qq, unique1 + FROM + ( SELECT COALESCE(q1, 0) AS qq FROM int8_tbl a ) AS ss1 + FULL OUTER JOIN + ( SELECT COALESCE(q2, -1) AS qq FROM int8_tbl b ) AS ss2 + USING (qq) + INNER JOIN tenk1 c ON qq = unique2; + +-- +-- nested nestloops can require nested PlaceHolderVars +-- + +create temp table nt1 ( + id int primary key, + a1 boolean, + a2 boolean +); +create temp table nt2 ( + id int primary key, + nt1_id int, + b1 boolean, + b2 boolean, + foreign key (nt1_id) references nt1(id) +); +create temp table nt3 ( + id int primary key, + nt2_id int, + c1 boolean, + foreign key (nt2_id) references nt2(id) +); + +insert into nt1 values (1,true,true); +insert into nt1 values (2,true,false); +insert into nt1 values (3,false,false); +insert into nt2 values (1,1,true,true); +insert into nt2 values (2,2,true,false); +insert into nt2 values (3,3,false,false); +insert into nt3 values (1,1,true); +insert into nt3 values (2,2,false); +insert into nt3 values (3,3,true); + +explain (costs off) +select nt3.id +from nt3 as nt3 + left join + (select nt2.*, (nt2.b1 and ss1.a3) AS b3 + from nt2 as nt2 + left join + (select nt1.*, (nt1.id is not null) as a3 from nt1) as ss1 + on ss1.id = nt2.nt1_id + ) as ss2 + on ss2.id = nt3.nt2_id +where nt3.id = 1 and ss2.b3; + +select nt3.id +from nt3 as nt3 + left join + (select nt2.*, (nt2.b1 and ss1.a3) AS b3 + from nt2 as nt2 + left join + (select nt1.*, (nt1.id is not null) as a3 from nt1) as ss1 + on ss1.id = nt2.nt1_id + ) as ss2 + on ss2.id = nt3.nt2_id +where nt3.id = 1 and ss2.b3; + +-- +-- test case where a PlaceHolderVar is propagated into a subquery +-- + +explain (costs off) +select * from + int8_tbl t1 left join + (select q1 as x, 42 as y from int8_tbl t2) ss + on t1.q2 = ss.x +where + 1 = (select 1 from int8_tbl t3 where ss.y is not null limit 1) +order by 1,2; + +select * from + int8_tbl t1 left join + (select q1 as x, 42 as y from int8_tbl t2) ss + on t1.q2 = ss.x +where + 1 = (select 1 from int8_tbl t3 where ss.y is not null limit 1) +order by 1,2; + +-- +-- test the corner cases FULL JOIN ON TRUE and FULL JOIN ON FALSE +-- +select * from int4_tbl a full join int4_tbl b on true; +select * from int4_tbl a full join int4_tbl b on false; + +-- +-- test for ability to use a cartesian join when necessary +-- + +create temp table q1 as select 1 as q1; +create temp table q2 as select 0 as q2; +analyze q1; +analyze q2; + +explain (costs off) +select * from + tenk1 join int4_tbl on f1 = twothousand, + q1, q2 +where q1 = thousand or q2 = thousand; + +explain (costs off) +select * from + tenk1 join int4_tbl on f1 = twothousand, + q1, q2 +where thousand = (q1 + q2); + +-- +-- test ability to generate a suitable plan for a star-schema query +-- + +explain (costs off) +select * from + tenk1, int8_tbl a, int8_tbl b +where thousand = a.q1 and tenthous = b.q1 and a.q2 = 1 and b.q2 = 2; + +-- +-- test a corner case in which we shouldn't apply the star-schema optimization +-- + +explain (costs off) +select t1.unique2, t1.stringu1, t2.unique1, t2.stringu2 from + tenk1 t1 + inner join int4_tbl i1 + left join (select v1.x2, v2.y1, 11 AS d1 + from (select 1,0 from onerow) v1(x1,x2) + left join (select 3,1 from onerow) v2(y1,y2) + on v1.x1 = v2.y2) subq1 + on (i1.f1 = subq1.x2) + on (t1.unique2 = subq1.d1) + left join tenk1 t2 + on (subq1.y1 = t2.unique1) +where t1.unique2 < 42 and t1.stringu1 > t2.stringu2; + +select t1.unique2, t1.stringu1, t2.unique1, t2.stringu2 from + tenk1 t1 + inner join int4_tbl i1 + left join (select v1.x2, v2.y1, 11 AS d1 + from (select 1,0 from onerow) v1(x1,x2) + left join (select 3,1 from onerow) v2(y1,y2) + on v1.x1 = v2.y2) subq1 + on (i1.f1 = subq1.x2) + on (t1.unique2 = subq1.d1) + left join tenk1 t2 + on (subq1.y1 = t2.unique1) +where t1.unique2 < 42 and t1.stringu1 > t2.stringu2; + +-- variant that isn't quite a star-schema case + +select ss1.d1 from + tenk1 as t1 + inner join tenk1 as t2 + on t1.tenthous = t2.ten + inner join + int8_tbl as i8 + left join int4_tbl as i4 + inner join (select 64::information_schema.cardinal_number as d1 + from tenk1 t3, + lateral (select abs(t3.unique1) + random()) ss0(x) + where t3.fivethous < 0) as ss1 + on i4.f1 = ss1.d1 + on i8.q1 = i4.f1 + on t1.tenthous = ss1.d1 +where t1.unique1 < i4.f1; + +-- this variant is foldable by the remove-useless-RESULT-RTEs code + +explain (costs off) +select t1.unique2, t1.stringu1, t2.unique1, t2.stringu2 from + tenk1 t1 + inner join int4_tbl i1 + left join (select v1.x2, v2.y1, 11 AS d1 + from (values(1,0)) v1(x1,x2) + left join (values(3,1)) v2(y1,y2) + on v1.x1 = v2.y2) subq1 + on (i1.f1 = subq1.x2) + on (t1.unique2 = subq1.d1) + left join tenk1 t2 + on (subq1.y1 = t2.unique1) +where t1.unique2 < 42 and t1.stringu1 > t2.stringu2; + +select t1.unique2, t1.stringu1, t2.unique1, t2.stringu2 from + tenk1 t1 + inner join int4_tbl i1 + left join (select v1.x2, v2.y1, 11 AS d1 + from (values(1,0)) v1(x1,x2) + left join (values(3,1)) v2(y1,y2) + on v1.x1 = v2.y2) subq1 + on (i1.f1 = subq1.x2) + on (t1.unique2 = subq1.d1) + left join tenk1 t2 + on (subq1.y1 = t2.unique1) +where t1.unique2 < 42 and t1.stringu1 > t2.stringu2; + +-- Here's a variant that we can't fold too aggressively, though, +-- or we end up with noplace to evaluate the lateral PHV +explain (verbose, costs off) +select * from + (select 1 as x) ss1 left join (select 2 as y) ss2 on (true), + lateral (select ss2.y as z limit 1) ss3; +select * from + (select 1 as x) ss1 left join (select 2 as y) ss2 on (true), + lateral (select ss2.y as z limit 1) ss3; + +-- +-- test inlining of immutable functions +-- +create function f_immutable_int4(i integer) returns integer as +$$ begin return i; end; $$ language plpgsql immutable; + +-- check optimization of function scan with join +explain (costs off) +select unique1 from tenk1, (select * from f_immutable_int4(1) x) x +where x = unique1; + +explain (verbose, costs off) +select unique1, x.* +from tenk1, (select *, random() from f_immutable_int4(1) x) x +where x = unique1; + +explain (costs off) +select unique1 from tenk1, f_immutable_int4(1) x where x = unique1; + +explain (costs off) +select unique1 from tenk1, lateral f_immutable_int4(1) x where x = unique1; + +explain (costs off) +select unique1, x from tenk1 join f_immutable_int4(1) x on unique1 = x; + +explain (costs off) +select unique1, x from tenk1 left join f_immutable_int4(1) x on unique1 = x; + +explain (costs off) +select unique1, x from tenk1 right join f_immutable_int4(1) x on unique1 = x; + +explain (costs off) +select unique1, x from tenk1 full join f_immutable_int4(1) x on unique1 = x; + +-- check that pullup of a const function allows further const-folding +explain (costs off) +select unique1 from tenk1, f_immutable_int4(1) x where x = 42; + +-- test inlining of immutable functions with PlaceHolderVars +explain (costs off) +select nt3.id +from nt3 as nt3 + left join + (select nt2.*, (nt2.b1 or i4 = 42) AS b3 + from nt2 as nt2 + left join + f_immutable_int4(0) i4 + on i4 = nt2.nt1_id + ) as ss2 + on ss2.id = nt3.nt2_id +where nt3.id = 1 and ss2.b3; + +drop function f_immutable_int4(int); + +-- test inlining when function returns composite + +create function mki8(bigint, bigint) returns int8_tbl as +$$select row($1,$2)::int8_tbl$$ language sql; + +create function mki4(int) returns int4_tbl as +$$select row($1)::int4_tbl$$ language sql; + +explain (verbose, costs off) +select * from mki8(1,2); +select * from mki8(1,2); + +explain (verbose, costs off) +select * from mki4(42); +select * from mki4(42); + +drop function mki8(bigint, bigint); +drop function mki4(int); + +-- +-- test extraction of restriction OR clauses from join OR clause +-- (we used to only do this for indexable clauses) +-- + +explain (costs off) +select * from tenk1 a join tenk1 b on + (a.unique1 = 1 and b.unique1 = 2) or (a.unique2 = 3 and b.hundred = 4); +explain (costs off) +select * from tenk1 a join tenk1 b on + (a.unique1 = 1 and b.unique1 = 2) or (a.unique2 = 3 and b.ten = 4); +explain (costs off) +select * from tenk1 a join tenk1 b on + (a.unique1 = 1 and b.unique1 = 2) or + ((a.unique2 = 3 or a.unique2 = 7) and b.hundred = 4); + +-- +-- test placement of movable quals in a parameterized join tree +-- + +explain (costs off) +select * from tenk1 t1 left join + (tenk1 t2 join tenk1 t3 on t2.thousand = t3.unique2) + on t1.hundred = t2.hundred and t1.ten = t3.ten +where t1.unique1 = 1; + +explain (costs off) +select * from tenk1 t1 left join + (tenk1 t2 join tenk1 t3 on t2.thousand = t3.unique2) + on t1.hundred = t2.hundred and t1.ten + t2.ten = t3.ten +where t1.unique1 = 1; + +explain (costs off) +select count(*) from + tenk1 a join tenk1 b on a.unique1 = b.unique2 + left join tenk1 c on a.unique2 = b.unique1 and c.thousand = a.thousand + join int4_tbl on b.thousand = f1; + +select count(*) from + tenk1 a join tenk1 b on a.unique1 = b.unique2 + left join tenk1 c on a.unique2 = b.unique1 and c.thousand = a.thousand + join int4_tbl on b.thousand = f1; + +explain (costs off) +select b.unique1 from + tenk1 a join tenk1 b on a.unique1 = b.unique2 + left join tenk1 c on b.unique1 = 42 and c.thousand = a.thousand + join int4_tbl i1 on b.thousand = f1 + right join int4_tbl i2 on i2.f1 = b.tenthous + order by 1; + +select b.unique1 from + tenk1 a join tenk1 b on a.unique1 = b.unique2 + left join tenk1 c on b.unique1 = 42 and c.thousand = a.thousand + join int4_tbl i1 on b.thousand = f1 + right join int4_tbl i2 on i2.f1 = b.tenthous + order by 1; + +explain (costs off) +select * from +( + select unique1, q1, coalesce(unique1, -1) + q1 as fault + from int8_tbl left join tenk1 on (q2 = unique2) +) ss +where fault = 122 +order by fault; + +select * from +( + select unique1, q1, coalesce(unique1, -1) + q1 as fault + from int8_tbl left join tenk1 on (q2 = unique2) +) ss +where fault = 122 +order by fault; + +explain (costs off) +select * from +(values (1, array[10,20]), (2, array[20,30])) as v1(v1x,v1ys) +left join (values (1, 10), (2, 20)) as v2(v2x,v2y) on v2x = v1x +left join unnest(v1ys) as u1(u1y) on u1y = v2y; + +select * from +(values (1, array[10,20]), (2, array[20,30])) as v1(v1x,v1ys) +left join (values (1, 10), (2, 20)) as v2(v2x,v2y) on v2x = v1x +left join unnest(v1ys) as u1(u1y) on u1y = v2y; + +-- +-- test handling of potential equivalence clauses above outer joins +-- + +explain (costs off) +select q1, unique2, thousand, hundred + from int8_tbl a left join tenk1 b on q1 = unique2 + where coalesce(thousand,123) = q1 and q1 = coalesce(hundred,123); + +select q1, unique2, thousand, hundred + from int8_tbl a left join tenk1 b on q1 = unique2 + where coalesce(thousand,123) = q1 and q1 = coalesce(hundred,123); + +explain (costs off) +select f1, unique2, case when unique2 is null then f1 else 0 end + from int4_tbl a left join tenk1 b on f1 = unique2 + where (case when unique2 is null then f1 else 0 end) = 0; + +select f1, unique2, case when unique2 is null then f1 else 0 end + from int4_tbl a left join tenk1 b on f1 = unique2 + where (case when unique2 is null then f1 else 0 end) = 0; + +-- +-- another case with equivalence clauses above outer joins (bug #8591) +-- + +explain (costs off) +select a.unique1, b.unique1, c.unique1, coalesce(b.twothousand, a.twothousand) + from tenk1 a left join tenk1 b on b.thousand = a.unique1 left join tenk1 c on c.unique2 = coalesce(b.twothousand, a.twothousand) + where a.unique2 < 10 and coalesce(b.twothousand, a.twothousand) = 44; + +select a.unique1, b.unique1, c.unique1, coalesce(b.twothousand, a.twothousand) + from tenk1 a left join tenk1 b on b.thousand = a.unique1 left join tenk1 c on c.unique2 = coalesce(b.twothousand, a.twothousand) + where a.unique2 < 10 and coalesce(b.twothousand, a.twothousand) = 44; + +-- +-- check handling of join aliases when flattening multiple levels of subquery +-- + +explain (verbose, costs off) +select foo1.join_key as foo1_id, foo3.join_key AS foo3_id, bug_field from + (values (0),(1)) foo1(join_key) +left join + (select join_key, bug_field from + (select ss1.join_key, ss1.bug_field from + (select f1 as join_key, 666 as bug_field from int4_tbl i1) ss1 + ) foo2 + left join + (select unique2 as join_key from tenk1 i2) ss2 + using (join_key) + ) foo3 +using (join_key); + +select foo1.join_key as foo1_id, foo3.join_key AS foo3_id, bug_field from + (values (0),(1)) foo1(join_key) +left join + (select join_key, bug_field from + (select ss1.join_key, ss1.bug_field from + (select f1 as join_key, 666 as bug_field from int4_tbl i1) ss1 + ) foo2 + left join + (select unique2 as join_key from tenk1 i2) ss2 + using (join_key) + ) foo3 +using (join_key); + +-- +-- test successful handling of nested outer joins with degenerate join quals +-- + +explain (verbose, costs off) +select t1.* from + text_tbl t1 + left join (select *, '***'::text as d1 from int8_tbl i8b1) b1 + left join int8_tbl i8 + left join (select *, null::int as d2 from int8_tbl i8b2) b2 + on (i8.q1 = b2.q1) + on (b2.d2 = b1.q2) + on (t1.f1 = b1.d1) + left join int4_tbl i4 + on (i8.q2 = i4.f1); + +select t1.* from + text_tbl t1 + left join (select *, '***'::text as d1 from int8_tbl i8b1) b1 + left join int8_tbl i8 + left join (select *, null::int as d2 from int8_tbl i8b2) b2 + on (i8.q1 = b2.q1) + on (b2.d2 = b1.q2) + on (t1.f1 = b1.d1) + left join int4_tbl i4 + on (i8.q2 = i4.f1); + +explain (verbose, costs off) +select t1.* from + text_tbl t1 + left join (select *, '***'::text as d1 from int8_tbl i8b1) b1 + left join int8_tbl i8 + left join (select *, null::int as d2 from int8_tbl i8b2, int4_tbl i4b2) b2 + on (i8.q1 = b2.q1) + on (b2.d2 = b1.q2) + on (t1.f1 = b1.d1) + left join int4_tbl i4 + on (i8.q2 = i4.f1); + +select t1.* from + text_tbl t1 + left join (select *, '***'::text as d1 from int8_tbl i8b1) b1 + left join int8_tbl i8 + left join (select *, null::int as d2 from int8_tbl i8b2, int4_tbl i4b2) b2 + on (i8.q1 = b2.q1) + on (b2.d2 = b1.q2) + on (t1.f1 = b1.d1) + left join int4_tbl i4 + on (i8.q2 = i4.f1); + +explain (verbose, costs off) +select t1.* from + text_tbl t1 + left join (select *, '***'::text as d1 from int8_tbl i8b1) b1 + left join int8_tbl i8 + left join (select *, null::int as d2 from int8_tbl i8b2, int4_tbl i4b2 + where q1 = f1) b2 + on (i8.q1 = b2.q1) + on (b2.d2 = b1.q2) + on (t1.f1 = b1.d1) + left join int4_tbl i4 + on (i8.q2 = i4.f1); + +select t1.* from + text_tbl t1 + left join (select *, '***'::text as d1 from int8_tbl i8b1) b1 + left join int8_tbl i8 + left join (select *, null::int as d2 from int8_tbl i8b2, int4_tbl i4b2 + where q1 = f1) b2 + on (i8.q1 = b2.q1) + on (b2.d2 = b1.q2) + on (t1.f1 = b1.d1) + left join int4_tbl i4 + on (i8.q2 = i4.f1); + +explain (verbose, costs off) +select * from + text_tbl t1 + inner join int8_tbl i8 + on i8.q2 = 456 + right join text_tbl t2 + on t1.f1 = 'doh!' + left join int4_tbl i4 + on i8.q1 = i4.f1; + +select * from + text_tbl t1 + inner join int8_tbl i8 + on i8.q2 = 456 + right join text_tbl t2 + on t1.f1 = 'doh!' + left join int4_tbl i4 + on i8.q1 = i4.f1; + +-- +-- test for appropriate join order in the presence of lateral references +-- + +explain (verbose, costs off) +select * from + text_tbl t1 + left join int8_tbl i8 + on i8.q2 = 123, + lateral (select i8.q1, t2.f1 from text_tbl t2 limit 1) as ss +where t1.f1 = ss.f1; + +select * from + text_tbl t1 + left join int8_tbl i8 + on i8.q2 = 123, + lateral (select i8.q1, t2.f1 from text_tbl t2 limit 1) as ss +where t1.f1 = ss.f1; + +explain (verbose, costs off) +select * from + text_tbl t1 + left join int8_tbl i8 + on i8.q2 = 123, + lateral (select i8.q1, t2.f1 from text_tbl t2 limit 1) as ss1, + lateral (select ss1.* from text_tbl t3 limit 1) as ss2 +where t1.f1 = ss2.f1; + +select * from + text_tbl t1 + left join int8_tbl i8 + on i8.q2 = 123, + lateral (select i8.q1, t2.f1 from text_tbl t2 limit 1) as ss1, + lateral (select ss1.* from text_tbl t3 limit 1) as ss2 +where t1.f1 = ss2.f1; + +explain (verbose, costs off) +select 1 from + text_tbl as tt1 + inner join text_tbl as tt2 on (tt1.f1 = 'foo') + left join text_tbl as tt3 on (tt3.f1 = 'foo') + left join text_tbl as tt4 on (tt3.f1 = tt4.f1), + lateral (select tt4.f1 as c0 from text_tbl as tt5 limit 1) as ss1 +where tt1.f1 = ss1.c0; + +select 1 from + text_tbl as tt1 + inner join text_tbl as tt2 on (tt1.f1 = 'foo') + left join text_tbl as tt3 on (tt3.f1 = 'foo') + left join text_tbl as tt4 on (tt3.f1 = tt4.f1), + lateral (select tt4.f1 as c0 from text_tbl as tt5 limit 1) as ss1 +where tt1.f1 = ss1.c0; + +-- +-- check a case in which a PlaceHolderVar forces join order +-- + +explain (verbose, costs off) +select ss2.* from + int4_tbl i41 + left join int8_tbl i8 + join (select i42.f1 as c1, i43.f1 as c2, 42 as c3 + from int4_tbl i42, int4_tbl i43) ss1 + on i8.q1 = ss1.c2 + on i41.f1 = ss1.c1, + lateral (select i41.*, i8.*, ss1.* from text_tbl limit 1) ss2 +where ss1.c2 = 0; + +select ss2.* from + int4_tbl i41 + left join int8_tbl i8 + join (select i42.f1 as c1, i43.f1 as c2, 42 as c3 + from int4_tbl i42, int4_tbl i43) ss1 + on i8.q1 = ss1.c2 + on i41.f1 = ss1.c1, + lateral (select i41.*, i8.*, ss1.* from text_tbl limit 1) ss2 +where ss1.c2 = 0; + +-- +-- test successful handling of full join underneath left join (bug #14105) +-- + +explain (costs off) +select * from + (select 1 as id) as xx + left join + (tenk1 as a1 full join (select 1 as id) as yy on (a1.unique1 = yy.id)) + on (xx.id = coalesce(yy.id)); + +select * from + (select 1 as id) as xx + left join + (tenk1 as a1 full join (select 1 as id) as yy on (a1.unique1 = yy.id)) + on (xx.id = coalesce(yy.id)); + +-- +-- test ability to push constants through outer join clauses +-- + +explain (costs off) + select * from int4_tbl a left join tenk1 b on f1 = unique2 where f1 = 0; + +explain (costs off) + select * from tenk1 a full join tenk1 b using(unique2) where unique2 = 42; + +-- +-- test that quals attached to an outer join have correct semantics, +-- specifically that they don't re-use expressions computed below the join; +-- we force a mergejoin so that coalesce(b.q1, 1) appears as a join input +-- + +set enable_hashjoin to off; +set enable_nestloop to off; + +explain (verbose, costs off) + select a.q2, b.q1 + from int8_tbl a left join int8_tbl b on a.q2 = coalesce(b.q1, 1) + where coalesce(b.q1, 1) > 0; +select a.q2, b.q1 + from int8_tbl a left join int8_tbl b on a.q2 = coalesce(b.q1, 1) + where coalesce(b.q1, 1) > 0; + +reset enable_hashjoin; +reset enable_nestloop; + +-- +-- test join removal +-- + +begin; + +CREATE TEMP TABLE a (id int PRIMARY KEY, b_id int); +CREATE TEMP TABLE b (id int PRIMARY KEY, c_id int); +CREATE TEMP TABLE c (id int PRIMARY KEY); +CREATE TEMP TABLE d (a int, b int); +INSERT INTO a VALUES (0, 0), (1, NULL); +INSERT INTO b VALUES (0, 0), (1, NULL); +INSERT INTO c VALUES (0), (1); +INSERT INTO d VALUES (1,3), (2,2), (3,1); + +-- all three cases should be optimizable into a simple seqscan +explain (costs off) SELECT a.* FROM a LEFT JOIN b ON a.b_id = b.id; +explain (costs off) SELECT b.* FROM b LEFT JOIN c ON b.c_id = c.id; +explain (costs off) + SELECT a.* FROM a LEFT JOIN (b left join c on b.c_id = c.id) + ON (a.b_id = b.id); + +-- check optimization of outer join within another special join +explain (costs off) +select id from a where id in ( + select b.id from b left join c on b.id = c.id +); + +-- check that join removal works for a left join when joining a subquery +-- that is guaranteed to be unique by its GROUP BY clause +explain (costs off) +select d.* from d left join (select * from b group by b.id, b.c_id) s + on d.a = s.id and d.b = s.c_id; + +-- similarly, but keying off a DISTINCT clause +explain (costs off) +select d.* from d left join (select distinct * from b) s + on d.a = s.id and d.b = s.c_id; + +-- join removal is not possible when the GROUP BY contains a column that is +-- not in the join condition. (Note: as of 9.6, we notice that b.id is a +-- primary key and so drop b.c_id from the GROUP BY of the resulting plan; +-- but this happens too late for join removal in the outer plan level.) +explain (costs off) +select d.* from d left join (select * from b group by b.id, b.c_id) s + on d.a = s.id; + +-- similarly, but keying off a DISTINCT clause +explain (costs off) +select d.* from d left join (select distinct * from b) s + on d.a = s.id; + +-- check join removal works when uniqueness of the join condition is enforced +-- by a UNION +explain (costs off) +select d.* from d left join (select id from a union select id from b) s + on d.a = s.id; + +-- check join removal with a cross-type comparison operator +explain (costs off) +select i8.* from int8_tbl i8 left join (select f1 from int4_tbl group by f1) i4 + on i8.q1 = i4.f1; + +-- check join removal with lateral references +explain (costs off) +select 1 from (select a.id FROM a left join b on a.b_id = b.id) q, + lateral generate_series(1, q.id) gs(i) where q.id = gs.i; + +rollback; + +create temp table parent (k int primary key, pd int); +create temp table child (k int unique, cd int); +insert into parent values (1, 10), (2, 20), (3, 30); +insert into child values (1, 100), (4, 400); + +-- this case is optimizable +select p.* from parent p left join child c on (p.k = c.k); +explain (costs off) + select p.* from parent p left join child c on (p.k = c.k); + +-- this case is not +select p.*, linked from parent p + left join (select c.*, true as linked from child c) as ss + on (p.k = ss.k); +explain (costs off) + select p.*, linked from parent p + left join (select c.*, true as linked from child c) as ss + on (p.k = ss.k); + +-- check for a 9.0rc1 bug: join removal breaks pseudoconstant qual handling +select p.* from + parent p left join child c on (p.k = c.k) + where p.k = 1 and p.k = 2; +explain (costs off) +select p.* from + parent p left join child c on (p.k = c.k) + where p.k = 1 and p.k = 2; + +select p.* from + (parent p left join child c on (p.k = c.k)) join parent x on p.k = x.k + where p.k = 1 and p.k = 2; +explain (costs off) +select p.* from + (parent p left join child c on (p.k = c.k)) join parent x on p.k = x.k + where p.k = 1 and p.k = 2; + +-- bug 5255: this is not optimizable by join removal +begin; + +CREATE TEMP TABLE a (id int PRIMARY KEY); +CREATE TEMP TABLE b (id int PRIMARY KEY, a_id int); +INSERT INTO a VALUES (0), (1); +INSERT INTO b VALUES (0, 0), (1, NULL); + +SELECT * FROM b LEFT JOIN a ON (b.a_id = a.id) WHERE (a.id IS NULL OR a.id > 0); +SELECT b.* FROM b LEFT JOIN a ON (b.a_id = a.id) WHERE (a.id IS NULL OR a.id > 0); + +rollback; + +-- another join removal bug: this is not optimizable, either +begin; + +create temp table innertab (id int8 primary key, dat1 int8); +insert into innertab values(123, 42); + +SELECT * FROM + (SELECT 1 AS x) ss1 + LEFT JOIN + (SELECT q1, q2, COALESCE(dat1, q1) AS y + FROM int8_tbl LEFT JOIN innertab ON q2 = id) ss2 + ON true; + +rollback; + +-- another join removal bug: we must clean up correctly when removing a PHV +begin; + +create temp table uniquetbl (f1 text unique); + +explain (costs off) +select t1.* from + uniquetbl as t1 + left join (select *, '***'::text as d1 from uniquetbl) t2 + on t1.f1 = t2.f1 + left join uniquetbl t3 + on t2.d1 = t3.f1; + +explain (costs off) +select t0.* +from + text_tbl t0 + left join + (select case t1.ten when 0 then 'doh!'::text else null::text end as case1, + t1.stringu2 + from tenk1 t1 + join int4_tbl i4 ON i4.f1 = t1.unique2 + left join uniquetbl u1 ON u1.f1 = t1.string4) ss + on t0.f1 = ss.case1 +where ss.stringu2 !~* ss.case1; + +select t0.* +from + text_tbl t0 + left join + (select case t1.ten when 0 then 'doh!'::text else null::text end as case1, + t1.stringu2 + from tenk1 t1 + join int4_tbl i4 ON i4.f1 = t1.unique2 + left join uniquetbl u1 ON u1.f1 = t1.string4) ss + on t0.f1 = ss.case1 +where ss.stringu2 !~* ss.case1; + +rollback; + +-- bug #8444: we've historically allowed duplicate aliases within aliased JOINs + +select * from + int8_tbl x join (int4_tbl x cross join int4_tbl y) j on q1 = f1; -- error +select * from + int8_tbl x join (int4_tbl x cross join int4_tbl y) j on q1 = y.f1; -- error +select * from + int8_tbl x join (int4_tbl x cross join int4_tbl y(ff)) j on q1 = f1; -- ok + +-- +-- Test hints given on incorrect column references are useful +-- + +select t1.uunique1 from + tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t1" suggestion +select t2.uunique1 from + tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t2" suggestion +select uunique1 from + tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, suggest both at once + +-- +-- Take care to reference the correct RTE +-- + +select atts.relid::regclass, s.* from pg_stats s join + pg_attribute a on s.attname = a.attname and s.tablename = + a.attrelid::regclass::text join (select unnest(indkey) attnum, + indexrelid from pg_index i) atts on atts.attnum = a.attnum where + schemaname != 'pg_catalog'; + +-- +-- Test LATERAL +-- + +select unique2, x.* +from tenk1 a, lateral (select * from int4_tbl b where f1 = a.unique1) x; +explain (costs off) + select unique2, x.* + from tenk1 a, lateral (select * from int4_tbl b where f1 = a.unique1) x; +select unique2, x.* +from int4_tbl x, lateral (select unique2 from tenk1 where f1 = unique1) ss; +explain (costs off) + select unique2, x.* + from int4_tbl x, lateral (select unique2 from tenk1 where f1 = unique1) ss; +explain (costs off) + select unique2, x.* + from int4_tbl x cross join lateral (select unique2 from tenk1 where f1 = unique1) ss; +select unique2, x.* +from int4_tbl x left join lateral (select unique1, unique2 from tenk1 where f1 = unique1) ss on true; +explain (costs off) + select unique2, x.* + from int4_tbl x left join lateral (select unique1, unique2 from tenk1 where f1 = unique1) ss on true; + +-- check scoping of lateral versus parent references +-- the first of these should return int8_tbl.q2, the second int8_tbl.q1 +select *, (select r from (select q1 as q2) x, (select q2 as r) y) from int8_tbl; +select *, (select r from (select q1 as q2) x, lateral (select q2 as r) y) from int8_tbl; + +-- lateral with function in FROM +select count(*) from tenk1 a, lateral generate_series(1,two) g; +explain (costs off) + select count(*) from tenk1 a, lateral generate_series(1,two) g; +explain (costs off) + select count(*) from tenk1 a cross join lateral generate_series(1,two) g; +-- don't need the explicit LATERAL keyword for functions +explain (costs off) + select count(*) from tenk1 a, generate_series(1,two) g; + +-- lateral with UNION ALL subselect +explain (costs off) + select * from generate_series(100,200) g, + lateral (select * from int8_tbl a where g = q1 union all + select * from int8_tbl b where g = q2) ss; +select * from generate_series(100,200) g, + lateral (select * from int8_tbl a where g = q1 union all + select * from int8_tbl b where g = q2) ss; + +-- lateral with VALUES +explain (costs off) + select count(*) from tenk1 a, + tenk1 b join lateral (values(a.unique1)) ss(x) on b.unique2 = ss.x; +select count(*) from tenk1 a, + tenk1 b join lateral (values(a.unique1)) ss(x) on b.unique2 = ss.x; + +-- lateral with VALUES, no flattening possible +explain (costs off) + select count(*) from tenk1 a, + tenk1 b join lateral (values(a.unique1),(-1)) ss(x) on b.unique2 = ss.x; +select count(*) from tenk1 a, + tenk1 b join lateral (values(a.unique1),(-1)) ss(x) on b.unique2 = ss.x; + +-- lateral injecting a strange outer join condition +explain (costs off) + select * from int8_tbl a, + int8_tbl x left join lateral (select a.q1 from int4_tbl y) ss(z) + on x.q2 = ss.z + order by a.q1, a.q2, x.q1, x.q2, ss.z; +select * from int8_tbl a, + int8_tbl x left join lateral (select a.q1 from int4_tbl y) ss(z) + on x.q2 = ss.z + order by a.q1, a.q2, x.q1, x.q2, ss.z; + +-- lateral reference to a join alias variable +select * from (select f1/2 as x from int4_tbl) ss1 join int4_tbl i4 on x = f1, + lateral (select x) ss2(y); +select * from (select f1 as x from int4_tbl) ss1 join int4_tbl i4 on x = f1, + lateral (values(x)) ss2(y); +select * from ((select f1/2 as x from int4_tbl) ss1 join int4_tbl i4 on x = f1) j, + lateral (select x) ss2(y); + +-- lateral references requiring pullup +select * from (values(1)) x(lb), + lateral generate_series(lb,4) x4; +select * from (select f1/1000000000 from int4_tbl) x(lb), + lateral generate_series(lb,4) x4; +select * from (values(1)) x(lb), + lateral (values(lb)) y(lbcopy); +select * from (values(1)) x(lb), + lateral (select lb from int4_tbl) y(lbcopy); +select * from + int8_tbl x left join (select q1,coalesce(q2,0) q2 from int8_tbl) y on x.q2 = y.q1, + lateral (values(x.q1,y.q1,y.q2)) v(xq1,yq1,yq2); +select * from + int8_tbl x left join (select q1,coalesce(q2,0) q2 from int8_tbl) y on x.q2 = y.q1, + lateral (select x.q1,y.q1,y.q2) v(xq1,yq1,yq2); +select x.* from + int8_tbl x left join (select q1,coalesce(q2,0) q2 from int8_tbl) y on x.q2 = y.q1, + lateral (select x.q1,y.q1,y.q2) v(xq1,yq1,yq2); +select v.* from + (int8_tbl x left join (select q1,coalesce(q2,0) q2 from int8_tbl) y on x.q2 = y.q1) + left join int4_tbl z on z.f1 = x.q2, + lateral (select x.q1,y.q1 union all select x.q2,y.q2) v(vx,vy); +select v.* from + (int8_tbl x left join (select q1,(select coalesce(q2,0)) q2 from int8_tbl) y on x.q2 = y.q1) + left join int4_tbl z on z.f1 = x.q2, + lateral (select x.q1,y.q1 union all select x.q2,y.q2) v(vx,vy); +select v.* from + (int8_tbl x left join (select q1,(select coalesce(q2,0)) q2 from int8_tbl) y on x.q2 = y.q1) + left join int4_tbl z on z.f1 = x.q2, + lateral (select x.q1,y.q1 from onerow union all select x.q2,y.q2 from onerow) v(vx,vy); + +explain (verbose, costs off) +select * from + int8_tbl a left join + lateral (select *, a.q2 as x from int8_tbl b) ss on a.q2 = ss.q1; +select * from + int8_tbl a left join + lateral (select *, a.q2 as x from int8_tbl b) ss on a.q2 = ss.q1; +explain (verbose, costs off) +select * from + int8_tbl a left join + lateral (select *, coalesce(a.q2, 42) as x from int8_tbl b) ss on a.q2 = ss.q1; +select * from + int8_tbl a left join + lateral (select *, coalesce(a.q2, 42) as x from int8_tbl b) ss on a.q2 = ss.q1; + +-- lateral can result in join conditions appearing below their +-- real semantic level +explain (verbose, costs off) +select * from int4_tbl i left join + lateral (select * from int2_tbl j where i.f1 = j.f1) k on true; +select * from int4_tbl i left join + lateral (select * from int2_tbl j where i.f1 = j.f1) k on true; +explain (verbose, costs off) +select * from int4_tbl i left join + lateral (select coalesce(i) from int2_tbl j where i.f1 = j.f1) k on true; +select * from int4_tbl i left join + lateral (select coalesce(i) from int2_tbl j where i.f1 = j.f1) k on true; +explain (verbose, costs off) +select * from int4_tbl a, + lateral ( + select * from int4_tbl b left join int8_tbl c on (b.f1 = q1 and a.f1 = q2) + ) ss; +select * from int4_tbl a, + lateral ( + select * from int4_tbl b left join int8_tbl c on (b.f1 = q1 and a.f1 = q2) + ) ss; + +-- lateral reference in a PlaceHolderVar evaluated at join level +explain (verbose, costs off) +select * from + int8_tbl a left join lateral + (select b.q1 as bq1, c.q1 as cq1, least(a.q1,b.q1,c.q1) from + int8_tbl b cross join int8_tbl c) ss + on a.q2 = ss.bq1; +select * from + int8_tbl a left join lateral + (select b.q1 as bq1, c.q1 as cq1, least(a.q1,b.q1,c.q1) from + int8_tbl b cross join int8_tbl c) ss + on a.q2 = ss.bq1; + +-- case requiring nested PlaceHolderVars +explain (verbose, costs off) +select * from + int8_tbl c left join ( + int8_tbl a left join (select q1, coalesce(q2,42) as x from int8_tbl b) ss1 + on a.q2 = ss1.q1 + cross join + lateral (select q1, coalesce(ss1.x,q2) as y from int8_tbl d) ss2 + ) on c.q2 = ss2.q1, + lateral (select ss2.y offset 0) ss3; + +-- case that breaks the old ph_may_need optimization +explain (verbose, costs off) +select c.*,a.*,ss1.q1,ss2.q1,ss3.* from + int8_tbl c left join ( + int8_tbl a left join + (select q1, coalesce(q2,f1) as x from int8_tbl b, int4_tbl b2 + where q1 < f1) ss1 + on a.q2 = ss1.q1 + cross join + lateral (select q1, coalesce(ss1.x,q2) as y from int8_tbl d) ss2 + ) on c.q2 = ss2.q1, + lateral (select * from int4_tbl i where ss2.y > f1) ss3; + +-- check processing of postponed quals (bug #9041) +explain (verbose, costs off) +select * from + (select 1 as x offset 0) x cross join (select 2 as y offset 0) y + left join lateral ( + select * from (select 3 as z offset 0) z where z.z = x.x + ) zz on zz.z = y.y; + +-- check dummy rels with lateral references (bug #15694) +explain (verbose, costs off) +select * from int8_tbl i8 left join lateral + (select *, i8.q2 from int4_tbl where false) ss on true; +explain (verbose, costs off) +select * from int8_tbl i8 left join lateral + (select *, i8.q2 from int4_tbl i1, int4_tbl i2 where false) ss on true; + +-- check handling of nested appendrels inside LATERAL +select * from + ((select 2 as v) union all (select 3 as v)) as q1 + cross join lateral + ((select * from + ((select 4 as v) union all (select 5 as v)) as q3) + union all + (select q1.v) + ) as q2; + +-- check we don't try to do a unique-ified semijoin with LATERAL +explain (verbose, costs off) +select * from + (values (0,9998), (1,1000)) v(id,x), + lateral (select f1 from int4_tbl + where f1 = any (select unique1 from tenk1 + where unique2 = v.x offset 0)) ss; +select * from + (values (0,9998), (1,1000)) v(id,x), + lateral (select f1 from int4_tbl + where f1 = any (select unique1 from tenk1 + where unique2 = v.x offset 0)) ss; + +-- check proper extParam/allParam handling (this isn't exactly a LATERAL issue, +-- but we can make the test case much more compact with LATERAL) +explain (verbose, costs off) +select * from (values (0), (1)) v(id), +lateral (select * from int8_tbl t1, + lateral (select * from + (select * from int8_tbl t2 + where q1 = any (select q2 from int8_tbl t3 + where q2 = (select greatest(t1.q1,t2.q2)) + and (select v.id=0)) offset 0) ss2) ss + where t1.q1 = ss.q2) ss0; + +select * from (values (0), (1)) v(id), +lateral (select * from int8_tbl t1, + lateral (select * from + (select * from int8_tbl t2 + where q1 = any (select q2 from int8_tbl t3 + where q2 = (select greatest(t1.q1,t2.q2)) + and (select v.id=0)) offset 0) ss2) ss + where t1.q1 = ss.q2) ss0; + +-- test some error cases where LATERAL should have been used but wasn't +select f1,g from int4_tbl a, (select f1 as g) ss; +select f1,g from int4_tbl a, (select a.f1 as g) ss; +select f1,g from int4_tbl a cross join (select f1 as g) ss; +select f1,g from int4_tbl a cross join (select a.f1 as g) ss; +-- SQL:2008 says the left table is in scope but illegal to access here +select f1,g from int4_tbl a right join lateral generate_series(0, a.f1) g on true; +select f1,g from int4_tbl a full join lateral generate_series(0, a.f1) g on true; +-- check we complain about ambiguous table references +select * from + int8_tbl x cross join (int4_tbl x cross join lateral (select x.f1) ss); +-- LATERAL can be used to put an aggregate into the FROM clause of its query +select 1 from tenk1 a, lateral (select max(a.unique1) from int4_tbl b) ss; + +-- check behavior of LATERAL in UPDATE/DELETE + +create temp table xx1 as select f1 as x1, -f1 as x2 from int4_tbl; + +-- error, can't do this: +update xx1 set x2 = f1 from (select * from int4_tbl where f1 = x1) ss; +update xx1 set x2 = f1 from (select * from int4_tbl where f1 = xx1.x1) ss; +-- can't do it even with LATERAL: +update xx1 set x2 = f1 from lateral (select * from int4_tbl where f1 = x1) ss; +-- we might in future allow something like this, but for now it's an error: +update xx1 set x2 = f1 from xx1, lateral (select * from int4_tbl where f1 = x1) ss; + +-- also errors: +delete from xx1 using (select * from int4_tbl where f1 = x1) ss; +delete from xx1 using (select * from int4_tbl where f1 = xx1.x1) ss; +delete from xx1 using lateral (select * from int4_tbl where f1 = x1) ss; + +-- +-- test LATERAL reference propagation down a multi-level inheritance hierarchy +-- produced for a multi-level partitioned table hierarchy. +-- +create table join_pt1 (a int, b int, c varchar) partition by range(a); +create table join_pt1p1 partition of join_pt1 for values from (0) to (100) partition by range(b); +create table join_pt1p2 partition of join_pt1 for values from (100) to (200); +create table join_pt1p1p1 partition of join_pt1p1 for values from (0) to (100); +insert into join_pt1 values (1, 1, 'x'), (101, 101, 'y'); +create table join_ut1 (a int, b int, c varchar); +insert into join_ut1 values (101, 101, 'y'), (2, 2, 'z'); +explain (verbose, costs off) +select t1.b, ss.phv from join_ut1 t1 left join lateral + (select t2.a as t2a, t3.a t3a, least(t1.a, t2.a, t3.a) phv + from join_pt1 t2 join join_ut1 t3 on t2.a = t3.b) ss + on t1.a = ss.t2a order by t1.a; +select t1.b, ss.phv from join_ut1 t1 left join lateral + (select t2.a as t2a, t3.a t3a, least(t1.a, t2.a, t3.a) phv + from join_pt1 t2 join join_ut1 t3 on t2.a = t3.b) ss + on t1.a = ss.t2a order by t1.a; + +drop table join_pt1; +drop table join_ut1; +-- +-- test that foreign key join estimation performs sanely for outer joins +-- + +begin; + +create table fkest (a int, b int, c int unique, primary key(a,b)); +create table fkest1 (a int, b int, primary key(a,b)); + +insert into fkest select x/10, x%10, x from generate_series(1,1000) x; +insert into fkest1 select x/10, x%10 from generate_series(1,1000) x; + +alter table fkest1 + add constraint fkest1_a_b_fkey foreign key (a,b) references fkest; + +analyze fkest; +analyze fkest1; + +explain (costs off) +select * +from fkest f + left join fkest1 f1 on f.a = f1.a and f.b = f1.b + left join fkest1 f2 on f.a = f2.a and f.b = f2.b + left join fkest1 f3 on f.a = f3.a and f.b = f3.b +where f.c = 1; + +rollback; + +-- +-- test planner's ability to mark joins as unique +-- + +create table j1 (id int primary key); +create table j2 (id int primary key); +create table j3 (id int); + +insert into j1 values(1),(2),(3); +insert into j2 values(1),(2),(3); +insert into j3 values(1),(1); + +analyze j1; +analyze j2; +analyze j3; + +-- ensure join is properly marked as unique +explain (verbose, costs off) +select * from j1 inner join j2 on j1.id = j2.id; + +-- ensure join is not unique when not an equi-join +explain (verbose, costs off) +select * from j1 inner join j2 on j1.id > j2.id; + +-- ensure non-unique rel is not chosen as inner +explain (verbose, costs off) +select * from j1 inner join j3 on j1.id = j3.id; + +-- ensure left join is marked as unique +explain (verbose, costs off) +select * from j1 left join j2 on j1.id = j2.id; + +-- ensure right join is marked as unique +explain (verbose, costs off) +select * from j1 right join j2 on j1.id = j2.id; + +-- ensure full join is marked as unique +explain (verbose, costs off) +select * from j1 full join j2 on j1.id = j2.id; + +-- a clauseless (cross) join can't be unique +explain (verbose, costs off) +select * from j1 cross join j2; + +-- ensure a natural join is marked as unique +explain (verbose, costs off) +select * from j1 natural join j2; + +-- ensure a distinct clause allows the inner to become unique +explain (verbose, costs off) +select * from j1 +inner join (select distinct id from j3) j3 on j1.id = j3.id; + +-- ensure group by clause allows the inner to become unique +explain (verbose, costs off) +select * from j1 +inner join (select id from j3 group by id) j3 on j1.id = j3.id; + +drop table j1; +drop table j2; +drop table j3; + +-- test more complex permutations of unique joins + +create table j1 (id1 int, id2 int, primary key(id1,id2)); +create table j2 (id1 int, id2 int, primary key(id1,id2)); +create table j3 (id1 int, id2 int, primary key(id1,id2)); + +insert into j1 values(1,1),(1,2); +insert into j2 values(1,1); +insert into j3 values(1,1); + +analyze j1; +analyze j2; +analyze j3; + +-- ensure there's no unique join when not all columns which are part of the +-- unique index are seen in the join clause +explain (verbose, costs off) +select * from j1 +inner join j2 on j1.id1 = j2.id1; + +-- ensure proper unique detection with multiple join quals +explain (verbose, costs off) +select * from j1 +inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2; + +-- ensure we don't detect the join to be unique when quals are not part of the +-- join condition +explain (verbose, costs off) +select * from j1 +inner join j2 on j1.id1 = j2.id1 where j1.id2 = 1; + +-- as above, but for left joins. +explain (verbose, costs off) +select * from j1 +left join j2 on j1.id1 = j2.id1 where j1.id2 = 1; + +-- validate logic in merge joins which skips mark and restore. +-- it should only do this if all quals which were used to detect the unique +-- are present as join quals, and not plain quals. +set enable_nestloop to 0; +set enable_hashjoin to 0; +set enable_sort to 0; + +-- create indexes that will be preferred over the PKs to perform the join +create index j1_id1_idx on j1 (id1) where id1 % 1000 = 1; +create index j2_id1_idx on j2 (id1) where id1 % 1000 = 1; + +-- need an additional row in j2, if we want j2_id1_idx to be preferred +insert into j2 values(1,2); +analyze j2; + +explain (costs off) select * from j1 +inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2 +where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1; + +select * from j1 +inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2 +where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1; + +-- Exercise array keys mark/restore B-Tree code +explain (costs off) select * from j1 +inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2 +where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1 and j2.id1 = any (array[1]); + +select * from j1 +inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2 +where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1 and j2.id1 = any (array[1]); + +-- Exercise array keys "find extreme element" B-Tree code +explain (costs off) select * from j1 +inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2 +where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1 and j2.id1 >= any (array[1,5]); + +select * from j1 +inner join j2 on j1.id1 = j2.id1 and j1.id2 = j2.id2 +where j1.id1 % 1000 = 1 and j2.id1 % 1000 = 1 and j2.id1 >= any (array[1,5]); + +reset enable_nestloop; +reset enable_hashjoin; +reset enable_sort; + +drop table j1; +drop table j2; +drop table j3; + +-- check that semijoin inner is not seen as unique for a portion of the outerrel +explain (verbose, costs off) +select t1.unique1, t2.hundred +from onek t1, tenk1 t2 +where exists (select 1 from tenk1 t3 + where t3.thousand = t1.unique1 and t3.tenthous = t2.hundred) + and t1.unique1 < 1; + +-- ... unless it actually is unique +create table j3 as select unique1, tenthous from onek; +vacuum analyze j3; +create unique index on j3(unique1, tenthous); + +explain (verbose, costs off) +select t1.unique1, t2.hundred +from onek t1, tenk1 t2 +where exists (select 1 from j3 + where j3.unique1 = t1.unique1 and j3.tenthous = t2.hundred) + and t1.unique1 < 1; + +drop table j3; diff --git a/postgresql/examples/join_hash.sql b/postgresql/examples/join_hash.sql new file mode 100644 index 0000000..68c1a8c --- /dev/null +++ b/postgresql/examples/join_hash.sql @@ -0,0 +1,540 @@ +-- +-- exercises for the hash join code +-- + +begin; + +set local min_parallel_table_scan_size = 0; +set local parallel_setup_cost = 0; +set local enable_hashjoin = on; + +-- Extract bucket and batch counts from an explain analyze plan. In +-- general we can't make assertions about how many batches (or +-- buckets) will be required because it can vary, but we can in some +-- special cases and we can check for growth. +create or replace function find_hash(node json) +returns json language plpgsql +as +$$ +declare + x json; + child json; +begin + if node->>'Node Type' = 'Hash' then + return node; + else + for child in select json_array_elements(node->'Plans') + loop + x := find_hash(child); + if x is not null then + return x; + end if; + end loop; + return null; + end if; +end; +$$; +create or replace function hash_join_batches(query text) +returns table (original int, final int) language plpgsql +as +$$ +declare + whole_plan json; + hash_node json; +begin + for whole_plan in + execute 'explain (analyze, format ''json'') ' || query + loop + hash_node := find_hash(json_extract_path(whole_plan, '0', 'Plan')); + original := hash_node->>'Original Hash Batches'; + final := hash_node->>'Hash Batches'; + return next; + end loop; +end; +$$; + +-- Make a simple relation with well distributed keys and correctly +-- estimated size. +create table simple as + select generate_series(1, 20000) AS id, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; +alter table simple set (parallel_workers = 2); +analyze simple; + +-- Make a relation whose size we will under-estimate. We want stats +-- to say 1000 rows, but actually there are 20,000 rows. +create table bigger_than_it_looks as + select generate_series(1, 20000) as id, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; +alter table bigger_than_it_looks set (autovacuum_enabled = 'false'); +alter table bigger_than_it_looks set (parallel_workers = 2); +analyze bigger_than_it_looks; +update pg_class set reltuples = 1000 where relname = 'bigger_than_it_looks'; + +-- Make a relation whose size we underestimate and that also has a +-- kind of skew that breaks our batching scheme. We want stats to say +-- 2 rows, but actually there are 20,000 rows with the same key. +create table extremely_skewed (id int, t text); +alter table extremely_skewed set (autovacuum_enabled = 'false'); +alter table extremely_skewed set (parallel_workers = 2); +analyze extremely_skewed; +insert into extremely_skewed + select 42 as id, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + from generate_series(1, 20000); +update pg_class + set reltuples = 2, relpages = pg_relation_size('extremely_skewed') / 8192 + where relname = 'extremely_skewed'; + +-- Make a relation with a couple of enormous tuples. +create table wide as select generate_series(1, 2) as id, rpad('', 320000, 'x') as t; +alter table wide set (parallel_workers = 2); + +-- The "optimal" case: the hash table fits in memory; we plan for 1 +-- batch, we stick to that number, and peak memory usage stays within +-- our work_mem budget + +-- non-parallel +savepoint settings; +set local max_parallel_workers_per_gather = 0; +set local work_mem = '4MB'; +explain (costs off) + select count(*) from simple r join simple s using (id); +select count(*) from simple r join simple s using (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) from simple r join simple s using (id); +$$); +rollback to settings; + +-- parallel with parallel-oblivious hash join +savepoint settings; +set local max_parallel_workers_per_gather = 2; +set local work_mem = '4MB'; +set local enable_parallel_hash = off; +explain (costs off) + select count(*) from simple r join simple s using (id); +select count(*) from simple r join simple s using (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) from simple r join simple s using (id); +$$); +rollback to settings; + +-- parallel with parallel-aware hash join +savepoint settings; +set local max_parallel_workers_per_gather = 2; +set local work_mem = '4MB'; +set local enable_parallel_hash = on; +explain (costs off) + select count(*) from simple r join simple s using (id); +select count(*) from simple r join simple s using (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) from simple r join simple s using (id); +$$); +rollback to settings; + +-- The "good" case: batches required, but we plan the right number; we +-- plan for some number of batches, and we stick to that number, and +-- peak memory usage says within our work_mem budget + +-- non-parallel +savepoint settings; +set local max_parallel_workers_per_gather = 0; +set local work_mem = '128kB'; +explain (costs off) + select count(*) from simple r join simple s using (id); +select count(*) from simple r join simple s using (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) from simple r join simple s using (id); +$$); +rollback to settings; + +-- parallel with parallel-oblivious hash join +savepoint settings; +set local max_parallel_workers_per_gather = 2; +set local work_mem = '128kB'; +set local enable_parallel_hash = off; +explain (costs off) + select count(*) from simple r join simple s using (id); +select count(*) from simple r join simple s using (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) from simple r join simple s using (id); +$$); +rollback to settings; + +-- parallel with parallel-aware hash join +savepoint settings; +set local max_parallel_workers_per_gather = 2; +set local work_mem = '192kB'; +set local enable_parallel_hash = on; +explain (costs off) + select count(*) from simple r join simple s using (id); +select count(*) from simple r join simple s using (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) from simple r join simple s using (id); +$$); +rollback to settings; + +-- The "bad" case: during execution we need to increase number of +-- batches; in this case we plan for 1 batch, and increase at least a +-- couple of times, and peak memory usage stays within our work_mem +-- budget + +-- non-parallel +savepoint settings; +set local max_parallel_workers_per_gather = 0; +set local work_mem = '128kB'; +explain (costs off) + select count(*) FROM simple r JOIN bigger_than_it_looks s USING (id); +select count(*) FROM simple r JOIN bigger_than_it_looks s USING (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) FROM simple r JOIN bigger_than_it_looks s USING (id); +$$); +rollback to settings; + +-- parallel with parallel-oblivious hash join +savepoint settings; +set local max_parallel_workers_per_gather = 2; +set local work_mem = '128kB'; +set local enable_parallel_hash = off; +explain (costs off) + select count(*) from simple r join bigger_than_it_looks s using (id); +select count(*) from simple r join bigger_than_it_looks s using (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) from simple r join bigger_than_it_looks s using (id); +$$); +rollback to settings; + +-- parallel with parallel-aware hash join +savepoint settings; +set local max_parallel_workers_per_gather = 1; +set local work_mem = '192kB'; +set local enable_parallel_hash = on; +explain (costs off) + select count(*) from simple r join bigger_than_it_looks s using (id); +select count(*) from simple r join bigger_than_it_looks s using (id); +select original > 1 as initially_multibatch, final > original as increased_batches + from hash_join_batches( +$$ + select count(*) from simple r join bigger_than_it_looks s using (id); +$$); +rollback to settings; + +-- The "ugly" case: increasing the number of batches during execution +-- doesn't help, so stop trying to fit in work_mem and hope for the +-- best; in this case we plan for 1 batch, increases just once and +-- then stop increasing because that didn't help at all, so we blow +-- right through the work_mem budget and hope for the best... + +-- non-parallel +savepoint settings; +set local max_parallel_workers_per_gather = 0; +set local work_mem = '128kB'; +explain (costs off) + select count(*) from simple r join extremely_skewed s using (id); +select count(*) from simple r join extremely_skewed s using (id); +select * from hash_join_batches( +$$ + select count(*) from simple r join extremely_skewed s using (id); +$$); +rollback to settings; + +-- parallel with parallel-oblivious hash join +savepoint settings; +set local max_parallel_workers_per_gather = 2; +set local work_mem = '128kB'; +set local enable_parallel_hash = off; +explain (costs off) + select count(*) from simple r join extremely_skewed s using (id); +select count(*) from simple r join extremely_skewed s using (id); +select * from hash_join_batches( +$$ + select count(*) from simple r join extremely_skewed s using (id); +$$); +rollback to settings; + +-- parallel with parallel-aware hash join +savepoint settings; +set local max_parallel_workers_per_gather = 1; +set local work_mem = '128kB'; +set local enable_parallel_hash = on; +explain (costs off) + select count(*) from simple r join extremely_skewed s using (id); +select count(*) from simple r join extremely_skewed s using (id); +select * from hash_join_batches( +$$ + select count(*) from simple r join extremely_skewed s using (id); +$$); +rollback to settings; + +-- A couple of other hash join tests unrelated to work_mem management. + +-- Check that EXPLAIN ANALYZE has data even if the leader doesn't participate +savepoint settings; +set local max_parallel_workers_per_gather = 2; +set local work_mem = '4MB'; +set local parallel_leader_participation = off; +select * from hash_join_batches( +$$ + select count(*) from simple r join simple s using (id); +$$); +rollback to settings; + +-- Exercise rescans. We'll turn off parallel_leader_participation so +-- that we can check that instrumentation comes back correctly. + +create table join_foo as select generate_series(1, 3) as id, 'xxxxx'::text as t; +alter table join_foo set (parallel_workers = 0); +create table join_bar as select generate_series(1, 10000) as id, 'xxxxx'::text as t; +alter table join_bar set (parallel_workers = 2); + +-- multi-batch with rescan, parallel-oblivious +savepoint settings; +set enable_parallel_hash = off; +set parallel_leader_participation = off; +set min_parallel_table_scan_size = 0; +set parallel_setup_cost = 0; +set parallel_tuple_cost = 0; +set max_parallel_workers_per_gather = 2; +set enable_material = off; +set enable_mergejoin = off; +set work_mem = '64kB'; +explain (costs off) + select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +select final > 1 as multibatch + from hash_join_batches( +$$ + select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +$$); +rollback to settings; + +-- single-batch with rescan, parallel-oblivious +savepoint settings; +set enable_parallel_hash = off; +set parallel_leader_participation = off; +set min_parallel_table_scan_size = 0; +set parallel_setup_cost = 0; +set parallel_tuple_cost = 0; +set max_parallel_workers_per_gather = 2; +set enable_material = off; +set enable_mergejoin = off; +set work_mem = '4MB'; +explain (costs off) + select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +select final > 1 as multibatch + from hash_join_batches( +$$ + select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +$$); +rollback to settings; + +-- multi-batch with rescan, parallel-aware +savepoint settings; +set enable_parallel_hash = on; +set parallel_leader_participation = off; +set min_parallel_table_scan_size = 0; +set parallel_setup_cost = 0; +set parallel_tuple_cost = 0; +set max_parallel_workers_per_gather = 2; +set enable_material = off; +set enable_mergejoin = off; +set work_mem = '64kB'; +explain (costs off) + select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +select final > 1 as multibatch + from hash_join_batches( +$$ + select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +$$); +rollback to settings; + +-- single-batch with rescan, parallel-aware +savepoint settings; +set enable_parallel_hash = on; +set parallel_leader_participation = off; +set min_parallel_table_scan_size = 0; +set parallel_setup_cost = 0; +set parallel_tuple_cost = 0; +set max_parallel_workers_per_gather = 2; +set enable_material = off; +set enable_mergejoin = off; +set work_mem = '4MB'; +explain (costs off) + select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +select final > 1 as multibatch + from hash_join_batches( +$$ + select count(*) from join_foo + left join (select b1.id, b1.t from join_bar b1 join join_bar b2 using (id)) ss + on join_foo.id < ss.id + 1 and join_foo.id > ss.id - 1; +$$); +rollback to settings; + +-- A full outer join where every record is matched. + +-- non-parallel +savepoint settings; +set local max_parallel_workers_per_gather = 0; +explain (costs off) + select count(*) from simple r full outer join simple s using (id); +select count(*) from simple r full outer join simple s using (id); +rollback to settings; + +-- parallelism not possible with parallel-oblivious outer hash join +savepoint settings; +set local max_parallel_workers_per_gather = 2; +explain (costs off) + select count(*) from simple r full outer join simple s using (id); +select count(*) from simple r full outer join simple s using (id); +rollback to settings; + +-- An full outer join where every record is not matched. + +-- non-parallel +savepoint settings; +set local max_parallel_workers_per_gather = 0; +explain (costs off) + select count(*) from simple r full outer join simple s on (r.id = 0 - s.id); +select count(*) from simple r full outer join simple s on (r.id = 0 - s.id); +rollback to settings; + +-- parallelism not possible with parallel-oblivious outer hash join +savepoint settings; +set local max_parallel_workers_per_gather = 2; +explain (costs off) + select count(*) from simple r full outer join simple s on (r.id = 0 - s.id); +select count(*) from simple r full outer join simple s on (r.id = 0 - s.id); +rollback to settings; + +-- exercise special code paths for huge tuples (note use of non-strict +-- expression and left join required to get the detoasted tuple into +-- the hash table) + +-- parallel with parallel-aware hash join (hits ExecParallelHashLoadTuple and +-- sts_puttuple oversized tuple cases because it's multi-batch) +savepoint settings; +set max_parallel_workers_per_gather = 2; +set enable_parallel_hash = on; +set work_mem = '128kB'; +explain (costs off) + select length(max(s.t)) + from wide left join (select id, coalesce(t, '') || '' as t from wide) s using (id); +select length(max(s.t)) +from wide left join (select id, coalesce(t, '') || '' as t from wide) s using (id); +select final > 1 as multibatch + from hash_join_batches( +$$ + select length(max(s.t)) + from wide left join (select id, coalesce(t, '') || '' as t from wide) s using (id); +$$); +rollback to settings; + +rollback; + + +-- Verify that hash key expressions reference the correct +-- nodes. Hashjoin's hashkeys need to reference its outer plan, Hash's +-- need to reference Hash's outer plan (which is below HashJoin's +-- inner plan). It's not trivial to verify that the references are +-- correct (we don't display the hashkeys themselves), but if the +-- hashkeys contain subplan references, those will be displayed. Force +-- subplans to appear just about everywhere. +-- +-- Bug report: +-- https://www.postgresql.org/message-id/CAPpHfdvGVegF_TKKRiBrSmatJL2dR9uwFCuR%2BteQ_8tEXU8mxg%40mail.gmail.com +-- +BEGIN; +SET LOCAL enable_sort = OFF; -- avoid mergejoins +SET LOCAL from_collapse_limit = 1; -- allows easy changing of join order + +CREATE TABLE hjtest_1 (a text, b int, id int, c bool); +CREATE TABLE hjtest_2 (a bool, id int, b text, c int); + +INSERT INTO hjtest_1(a, b, id, c) VALUES ('text', 2, 1, false); -- matches +INSERT INTO hjtest_1(a, b, id, c) VALUES ('text', 1, 2, false); -- fails id join condition +INSERT INTO hjtest_1(a, b, id, c) VALUES ('text', 20, 1, false); -- fails < 50 +INSERT INTO hjtest_1(a, b, id, c) VALUES ('text', 1, 1, false); -- fails (SELECT hjtest_1.b * 5) = (SELECT hjtest_2.c*5) + +INSERT INTO hjtest_2(a, id, b, c) VALUES (true, 1, 'another', 2); -- matches +INSERT INTO hjtest_2(a, id, b, c) VALUES (true, 3, 'another', 7); -- fails id join condition +INSERT INTO hjtest_2(a, id, b, c) VALUES (true, 1, 'another', 90); -- fails < 55 +INSERT INTO hjtest_2(a, id, b, c) VALUES (true, 1, 'another', 3); -- fails (SELECT hjtest_1.b * 5) = (SELECT hjtest_2.c*5) +INSERT INTO hjtest_2(a, id, b, c) VALUES (true, 1, 'text', 1); -- fails hjtest_1.a <> hjtest_2.b; + +EXPLAIN (COSTS OFF, VERBOSE) +SELECT hjtest_1.a a1, hjtest_2.a a2,hjtest_1.tableoid::regclass t1, hjtest_2.tableoid::regclass t2 +FROM hjtest_1, hjtest_2 +WHERE + hjtest_1.id = (SELECT 1 WHERE hjtest_2.id = 1) + AND (SELECT hjtest_1.b * 5) = (SELECT hjtest_2.c*5) + AND (SELECT hjtest_1.b * 5) < 50 + AND (SELECT hjtest_2.c * 5) < 55 + AND hjtest_1.a <> hjtest_2.b; + +SELECT hjtest_1.a a1, hjtest_2.a a2,hjtest_1.tableoid::regclass t1, hjtest_2.tableoid::regclass t2 +FROM hjtest_1, hjtest_2 +WHERE + hjtest_1.id = (SELECT 1 WHERE hjtest_2.id = 1) + AND (SELECT hjtest_1.b * 5) = (SELECT hjtest_2.c*5) + AND (SELECT hjtest_1.b * 5) < 50 + AND (SELECT hjtest_2.c * 5) < 55 + AND hjtest_1.a <> hjtest_2.b; + +EXPLAIN (COSTS OFF, VERBOSE) +SELECT hjtest_1.a a1, hjtest_2.a a2,hjtest_1.tableoid::regclass t1, hjtest_2.tableoid::regclass t2 +FROM hjtest_2, hjtest_1 +WHERE + hjtest_1.id = (SELECT 1 WHERE hjtest_2.id = 1) + AND (SELECT hjtest_1.b * 5) = (SELECT hjtest_2.c*5) + AND (SELECT hjtest_1.b * 5) < 50 + AND (SELECT hjtest_2.c * 5) < 55 + AND hjtest_1.a <> hjtest_2.b; + +SELECT hjtest_1.a a1, hjtest_2.a a2,hjtest_1.tableoid::regclass t1, hjtest_2.tableoid::regclass t2 +FROM hjtest_2, hjtest_1 +WHERE + hjtest_1.id = (SELECT 1 WHERE hjtest_2.id = 1) + AND (SELECT hjtest_1.b * 5) = (SELECT hjtest_2.c*5) + AND (SELECT hjtest_1.b * 5) < 50 + AND (SELECT hjtest_2.c * 5) < 55 + AND hjtest_1.a <> hjtest_2.b; + +ROLLBACK; diff --git a/postgresql/examples/json.sql b/postgresql/examples/json.sql new file mode 100644 index 0000000..20354f0 --- /dev/null +++ b/postgresql/examples/json.sql @@ -0,0 +1,835 @@ +-- Strings. +SELECT '""'::json; -- OK. +SELECT $$''$$::json; -- ERROR, single quotes are not allowed +SELECT '"abc"'::json; -- OK +SELECT '"abc'::json; -- ERROR, quotes not closed +SELECT '"abc +def"'::json; -- ERROR, unescaped newline in string constant +SELECT '"\n\"\\"'::json; -- OK, legal escapes +SELECT '"\v"'::json; -- ERROR, not a valid JSON escape +-- see json_encoding test for input with unicode escapes + +-- Numbers. +SELECT '1'::json; -- OK +SELECT '0'::json; -- OK +SELECT '01'::json; -- ERROR, not valid according to JSON spec +SELECT '0.1'::json; -- OK +SELECT '9223372036854775808'::json; -- OK, even though it's too large for int8 +SELECT '1e100'::json; -- OK +SELECT '1.3e100'::json; -- OK +SELECT '1f2'::json; -- ERROR +SELECT '0.x1'::json; -- ERROR +SELECT '1.3ex100'::json; -- ERROR + +-- Arrays. +SELECT '[]'::json; -- OK +SELECT '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'::json; -- OK +SELECT '[1,2]'::json; -- OK +SELECT '[1,2,]'::json; -- ERROR, trailing comma +SELECT '[1,2'::json; -- ERROR, no closing bracket +SELECT '[1,[2]'::json; -- ERROR, no closing bracket + +-- Objects. +SELECT '{}'::json; -- OK +SELECT '{"abc"}'::json; -- ERROR, no value +SELECT '{"abc":1}'::json; -- OK +SELECT '{1:"abc"}'::json; -- ERROR, keys must be strings +SELECT '{"abc",1}'::json; -- ERROR, wrong separator +SELECT '{"abc"=1}'::json; -- ERROR, totally wrong separator +SELECT '{"abc"::1}'::json; -- ERROR, another wrong separator +SELECT '{"abc":1,"def":2,"ghi":[3,4],"hij":{"klm":5,"nop":[6]}}'::json; -- OK +SELECT '{"abc":1:2}'::json; -- ERROR, colon in wrong spot +SELECT '{"abc":1,3}'::json; -- ERROR, no value + +-- Recursion. +SET max_stack_depth = '100kB'; +SELECT repeat('[', 10000)::json; +SELECT repeat('{"a":', 10000)::json; +RESET max_stack_depth; + +-- Miscellaneous stuff. +SELECT 'true'::json; -- OK +SELECT 'false'::json; -- OK +SELECT 'null'::json; -- OK +SELECT ' true '::json; -- OK, even with extra whitespace +SELECT 'true false'::json; -- ERROR, too many values +SELECT 'true, false'::json; -- ERROR, too many values +SELECT 'truf'::json; -- ERROR, not a keyword +SELECT 'trues'::json; -- ERROR, not a keyword +SELECT ''::json; -- ERROR, no value +SELECT ' '::json; -- ERROR, no value + +--constructors +-- array_to_json + +SELECT array_to_json(array(select 1 as a)); +SELECT array_to_json(array_agg(q),false) from (select x as b, x * 2 as c from generate_series(1,3) x) q; +SELECT array_to_json(array_agg(q),true) from (select x as b, x * 2 as c from generate_series(1,3) x) q; +SELECT array_to_json(array_agg(q),false) + FROM ( SELECT $$a$$ || x AS b, y AS c, + ARRAY[ROW(x.*,ARRAY[1,2,3]), + ROW(y.*,ARRAY[4,5,6])] AS z + FROM generate_series(1,2) x, + generate_series(4,5) y) q; +SELECT array_to_json(array_agg(x),false) from generate_series(5,10) x; +SELECT array_to_json('{{1,5},{99,100}}'::int[]); + +-- row_to_json +SELECT row_to_json(row(1,'foo')); + +SELECT row_to_json(q) +FROM (SELECT $$a$$ || x AS b, + y AS c, + ARRAY[ROW(x.*,ARRAY[1,2,3]), + ROW(y.*,ARRAY[4,5,6])] AS z + FROM generate_series(1,2) x, + generate_series(4,5) y) q; + +SELECT row_to_json(q,true) +FROM (SELECT $$a$$ || x AS b, + y AS c, + ARRAY[ROW(x.*,ARRAY[1,2,3]), + ROW(y.*,ARRAY[4,5,6])] AS z + FROM generate_series(1,2) x, + generate_series(4,5) y) q; + +CREATE TEMP TABLE rows AS +SELECT x, 'txt' || x as y +FROM generate_series(1,3) AS x; + +SELECT row_to_json(q,true) +FROM rows q; + +SELECT row_to_json(row((select array_agg(x) as d from generate_series(5,10) x)),false); + +-- anyarray column + +analyze rows; + +select attname, to_json(histogram_bounds) histogram_bounds +from pg_stats +where tablename = 'rows' and + schemaname = pg_my_temp_schema()::regnamespace::text +order by 1; + +-- to_json, timestamps + +select to_json(timestamp '2014-05-28 12:22:35.614298'); + +BEGIN; +SET LOCAL TIME ZONE 10.5; +select to_json(timestamptz '2014-05-28 12:22:35.614298-04'); +SET LOCAL TIME ZONE -8; +select to_json(timestamptz '2014-05-28 12:22:35.614298-04'); +COMMIT; + +select to_json(date '2014-05-28'); + +select to_json(date 'Infinity'); +select to_json(date '-Infinity'); +select to_json(timestamp 'Infinity'); +select to_json(timestamp '-Infinity'); +select to_json(timestamptz 'Infinity'); +select to_json(timestamptz '-Infinity'); + +--json_agg + +SELECT json_agg(q) + FROM ( SELECT $$a$$ || x AS b, y AS c, + ARRAY[ROW(x.*,ARRAY[1,2,3]), + ROW(y.*,ARRAY[4,5,6])] AS z + FROM generate_series(1,2) x, + generate_series(4,5) y) q; + +SELECT json_agg(q ORDER BY x, y) + FROM rows q; + +UPDATE rows SET x = NULL WHERE x = 1; + +SELECT json_agg(q ORDER BY x NULLS FIRST, y) + FROM rows q; + +-- non-numeric output +SELECT row_to_json(q) +FROM (SELECT 'NaN'::float8 AS "float8field") q; + +SELECT row_to_json(q) +FROM (SELECT 'Infinity'::float8 AS "float8field") q; + +SELECT row_to_json(q) +FROM (SELECT '-Infinity'::float8 AS "float8field") q; + +-- json input +SELECT row_to_json(q) +FROM (SELECT '{"a":1,"b": [2,3,4,"d","e","f"],"c":{"p":1,"q":2}}'::json AS "jsonfield") q; + + +-- json extraction functions + +CREATE TEMP TABLE test_json ( + json_type text, + test_json json +); + +INSERT INTO test_json VALUES +('scalar','"a scalar"'), +('array','["zero", "one","two",null,"four","five", [1,2,3],{"f1":9}]'), +('object','{"field1":"val1","field2":"val2","field3":null, "field4": 4, "field5": [1,2,3], "field6": {"f1":9}}'); + +SELECT test_json -> 'x' +FROM test_json +WHERE json_type = 'scalar'; + +SELECT test_json -> 'x' +FROM test_json +WHERE json_type = 'array'; + +SELECT test_json -> 'x' +FROM test_json +WHERE json_type = 'object'; + +SELECT test_json->'field2' +FROM test_json +WHERE json_type = 'object'; + +SELECT test_json->>'field2' +FROM test_json +WHERE json_type = 'object'; + +SELECT test_json -> 2 +FROM test_json +WHERE json_type = 'scalar'; + +SELECT test_json -> 2 +FROM test_json +WHERE json_type = 'array'; + +SELECT test_json -> -1 +FROM test_json +WHERE json_type = 'array'; + +SELECT test_json -> 2 +FROM test_json +WHERE json_type = 'object'; + +SELECT test_json->>2 +FROM test_json +WHERE json_type = 'array'; + +SELECT test_json ->> 6 FROM test_json WHERE json_type = 'array'; +SELECT test_json ->> 7 FROM test_json WHERE json_type = 'array'; + +SELECT test_json ->> 'field4' FROM test_json WHERE json_type = 'object'; +SELECT test_json ->> 'field5' FROM test_json WHERE json_type = 'object'; +SELECT test_json ->> 'field6' FROM test_json WHERE json_type = 'object'; + +SELECT json_object_keys(test_json) +FROM test_json +WHERE json_type = 'scalar'; + +SELECT json_object_keys(test_json) +FROM test_json +WHERE json_type = 'array'; + +SELECT json_object_keys(test_json) +FROM test_json +WHERE json_type = 'object'; + +-- test extending object_keys resultset - initial resultset size is 256 + +select count(*) from + (select json_object_keys(json_object(array_agg(g))) + from (select unnest(array['f'||n,n::text])as g + from generate_series(1,300) as n) x ) y; + +-- nulls + +select (test_json->'field3') is null as expect_false +from test_json +where json_type = 'object'; + +select (test_json->>'field3') is null as expect_true +from test_json +where json_type = 'object'; + +select (test_json->3) is null as expect_false +from test_json +where json_type = 'array'; + +select (test_json->>3) is null as expect_true +from test_json +where json_type = 'array'; + +-- corner cases + +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> null::text; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> null::int; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> 1; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> -1; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> 'z'; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json -> ''; +select '[{"b": "c"}, {"b": "cc"}]'::json -> 1; +select '[{"b": "c"}, {"b": "cc"}]'::json -> 3; +select '[{"b": "c"}, {"b": "cc"}]'::json -> 'z'; +select '{"a": "c", "b": null}'::json -> 'b'; +select '"foo"'::json -> 1; +select '"foo"'::json -> 'z'; + +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> null::text; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> null::int; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> 1; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> 'z'; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json ->> ''; +select '[{"b": "c"}, {"b": "cc"}]'::json ->> 1; +select '[{"b": "c"}, {"b": "cc"}]'::json ->> 3; +select '[{"b": "c"}, {"b": "cc"}]'::json ->> 'z'; +select '{"a": "c", "b": null}'::json ->> 'b'; +select '"foo"'::json ->> 1; +select '"foo"'::json ->> 'z'; + +-- array length + +SELECT json_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]'); + +SELECT json_array_length('[]'); + +SELECT json_array_length('{"f1":1,"f2":[5,6]}'); + +SELECT json_array_length('4'); + +-- each + +select json_each('{"f1":[1,2,3],"f2":{"f3":1},"f4":null}'); +select * from json_each('{"f1":[1,2,3],"f2":{"f3":1},"f4":null,"f5":99,"f6":"stringy"}') q; + +select json_each_text('{"f1":[1,2,3],"f2":{"f3":1},"f4":null,"f5":"null"}'); +select * from json_each_text('{"f1":[1,2,3],"f2":{"f3":1},"f4":null,"f5":99,"f6":"stringy"}') q; + +-- extract_path, extract_path_as_text + +select json_extract_path('{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}','f4','f6'); +select json_extract_path('{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}','f2'); +select json_extract_path('{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}','f2',0::text); +select json_extract_path('{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}','f2',1::text); +select json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}','f4','f6'); +select json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}','f2'); +select json_extract_path_text('{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}','f2',0::text); +select json_extract_path_text('{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}','f2',1::text); + +-- extract_path nulls + +select json_extract_path('{"f2":{"f3":1},"f4":{"f5":null,"f6":"stringy"}}','f4','f5') is null as expect_false; +select json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":null,"f6":"stringy"}}','f4','f5') is null as expect_true; +select json_extract_path('{"f2":{"f3":1},"f4":[0,1,2,null]}','f4','3') is null as expect_false; +select json_extract_path_text('{"f2":{"f3":1},"f4":[0,1,2,null]}','f4','3') is null as expect_true; + +-- extract_path operators + +select '{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}'::json#>array['f4','f6']; +select '{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}'::json#>array['f2']; +select '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::json#>array['f2','0']; +select '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::json#>array['f2','1']; + +select '{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}'::json#>>array['f4','f6']; +select '{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}'::json#>>array['f2']; +select '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::json#>>array['f2','0']; +select '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::json#>>array['f2','1']; + +-- corner cases for same +select '{"a": {"b":{"c": "foo"}}}'::json #> '{}'; +select '[1,2,3]'::json #> '{}'; +select '"foo"'::json #> '{}'; +select '42'::json #> '{}'; +select 'null'::json #> '{}'; +select '{"a": {"b":{"c": "foo"}}}'::json #> array['a']; +select '{"a": {"b":{"c": "foo"}}}'::json #> array['a', null]; +select '{"a": {"b":{"c": "foo"}}}'::json #> array['a', '']; +select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','b']; +select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','b','c']; +select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','b','c','d']; +select '{"a": {"b":{"c": "foo"}}}'::json #> array['a','z','c']; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json #> array['a','1','b']; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json #> array['a','z','b']; +select '[{"b": "c"}, {"b": "cc"}]'::json #> array['1','b']; +select '[{"b": "c"}, {"b": "cc"}]'::json #> array['z','b']; +select '[{"b": "c"}, {"b": null}]'::json #> array['1','b']; +select '"foo"'::json #> array['z']; +select '42'::json #> array['f2']; +select '42'::json #> array['0']; + +select '{"a": {"b":{"c": "foo"}}}'::json #>> '{}'; +select '[1,2,3]'::json #>> '{}'; +select '"foo"'::json #>> '{}'; +select '42'::json #>> '{}'; +select 'null'::json #>> '{}'; +select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a']; +select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a', null]; +select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a', '']; +select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','b']; +select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','b','c']; +select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','b','c','d']; +select '{"a": {"b":{"c": "foo"}}}'::json #>> array['a','z','c']; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json #>> array['a','1','b']; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::json #>> array['a','z','b']; +select '[{"b": "c"}, {"b": "cc"}]'::json #>> array['1','b']; +select '[{"b": "c"}, {"b": "cc"}]'::json #>> array['z','b']; +select '[{"b": "c"}, {"b": null}]'::json #>> array['1','b']; +select '"foo"'::json #>> array['z']; +select '42'::json #>> array['f2']; +select '42'::json #>> array['0']; + +-- array_elements + +select json_array_elements('[1,true,[1,[2,3]],null,{"f1":1,"f2":[7,8,9]},false,"stringy"]'); +select * from json_array_elements('[1,true,[1,[2,3]],null,{"f1":1,"f2":[7,8,9]},false,"stringy"]') q; +select json_array_elements_text('[1,true,[1,[2,3]],null,{"f1":1,"f2":[7,8,9]},false,"stringy"]'); +select * from json_array_elements_text('[1,true,[1,[2,3]],null,{"f1":1,"f2":[7,8,9]},false,"stringy"]') q; + +-- populate_record +create type jpop as (a text, b int, c timestamp); + +CREATE DOMAIN js_int_not_null AS int NOT NULL; +CREATE DOMAIN js_int_array_1d AS int[] CHECK(array_length(VALUE, 1) = 3); +CREATE DOMAIN js_int_array_2d AS int[][] CHECK(array_length(VALUE, 2) = 3); + +create type j_unordered_pair as (x int, y int); +create domain j_ordered_pair as j_unordered_pair check((value).x <= (value).y); + +CREATE TYPE jsrec AS ( + i int, + ia _int4, + ia1 int[], + ia2 int[][], + ia3 int[][][], + ia1d js_int_array_1d, + ia2d js_int_array_2d, + t text, + ta text[], + c char(10), + ca char(10)[], + ts timestamp, + js json, + jsb jsonb, + jsa json[], + rec jpop, + reca jpop[] +); + +CREATE TYPE jsrec_i_not_null AS ( + i js_int_not_null +); + +select * from json_populate_record(null::jpop,'{"a":"blurfl","x":43.2}') q; +select * from json_populate_record(row('x',3,'2012-12-31 15:30:56')::jpop,'{"a":"blurfl","x":43.2}') q; + +select * from json_populate_record(null::jpop,'{"a":"blurfl","x":43.2}') q; +select * from json_populate_record(row('x',3,'2012-12-31 15:30:56')::jpop,'{"a":"blurfl","x":43.2}') q; + +select * from json_populate_record(null::jpop,'{"a":[100,200,false],"x":43.2}') q; +select * from json_populate_record(row('x',3,'2012-12-31 15:30:56')::jpop,'{"a":[100,200,false],"x":43.2}') q; +select * from json_populate_record(row('x',3,'2012-12-31 15:30:56')::jpop,'{"c":[100,200,false],"x":43.2}') q; + +select * from json_populate_record(row('x',3,'2012-12-31 15:30:56')::jpop,'{}') q; + +SELECT i FROM json_populate_record(NULL::jsrec_i_not_null, '{"x": 43.2}') q; +SELECT i FROM json_populate_record(NULL::jsrec_i_not_null, '{"i": null}') q; +SELECT i FROM json_populate_record(NULL::jsrec_i_not_null, '{"i": 12345}') q; + +SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": null}') q; +SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": 123}') q; +SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [1, "2", null, 4]}') q; +SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1, 2], [3, 4]]}') q; +SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1], 2]}') q; +SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1], [2, 3]]}') q; +SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": "{1,2,3}"}') q; + +SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": null}') q; +SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": 123}') q; +SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": [1, "2", null, 4]}') q; +SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": [[1, 2, 3]]}') q; + +SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": null}') q; +SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": 123}') q; +SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": [1, "2", null, 4]}') q; +SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": [1, "2", null]}') q; + +SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [1, "2", null, 4]}') q; +SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[1, 2], [null, 4]]}') q; +SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[], []]}') q; +SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[1, 2], [3]]}') q; +SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[1, 2], 3, 4]}') q; + +SELECT ia2d FROM json_populate_record(NULL::jsrec, '{"ia2d": [[1, "2"], [null, 4]]}') q; +SELECT ia2d FROM json_populate_record(NULL::jsrec, '{"ia2d": [[1, "2", 3], [null, 5, 6]]}') q; + +SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [1, "2", null, 4]}') q; +SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [[1, 2], [null, 4]]}') q; +SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [ [[], []], [[], []], [[], []] ]}') q; +SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [ [[1, 2]], [[3, 4]] ]}') q; +SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [ [[1, 2], [3, 4]], [[5, 6], [7, 8]] ]}') q; +SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [ [[1, 2], [3, 4]], [[5, 6], [7, 8], [9, 10]] ]}') q; + +SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": null}') q; +SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": 123}') q; +SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": [1, "2", null, 4]}') q; +SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": [[1, 2, 3], {"k": "v"}]}') q; + +SELECT c FROM json_populate_record(NULL::jsrec, '{"c": null}') q; +SELECT c FROM json_populate_record(NULL::jsrec, '{"c": "aaa"}') q; +SELECT c FROM json_populate_record(NULL::jsrec, '{"c": "aaaaaaaaaa"}') q; +SELECT c FROM json_populate_record(NULL::jsrec, '{"c": "aaaaaaaaaaaaa"}') q; + +SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": null}') q; +SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": 123}') q; +SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": [1, "2", null, 4]}') q; +SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": ["aaaaaaaaaaaaaaaa"]}') q; +SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": [[1, 2, 3], {"k": "v"}]}') q; + +SELECT js FROM json_populate_record(NULL::jsrec, '{"js": null}') q; +SELECT js FROM json_populate_record(NULL::jsrec, '{"js": true}') q; +SELECT js FROM json_populate_record(NULL::jsrec, '{"js": 123.45}') q; +SELECT js FROM json_populate_record(NULL::jsrec, '{"js": "123.45"}') q; +SELECT js FROM json_populate_record(NULL::jsrec, '{"js": "abc"}') q; +SELECT js FROM json_populate_record(NULL::jsrec, '{"js": [123, "123", null, {"key": "value"}]}') q; +SELECT js FROM json_populate_record(NULL::jsrec, '{"js": {"a": "bbb", "b": null, "c": 123.45}}') q; + +SELECT jsb FROM json_populate_record(NULL::jsrec, '{"jsb": null}') q; +SELECT jsb FROM json_populate_record(NULL::jsrec, '{"jsb": true}') q; +SELECT jsb FROM json_populate_record(NULL::jsrec, '{"jsb": 123.45}') q; +SELECT jsb FROM json_populate_record(NULL::jsrec, '{"jsb": "123.45"}') q; +SELECT jsb FROM json_populate_record(NULL::jsrec, '{"jsb": "abc"}') q; +SELECT jsb FROM json_populate_record(NULL::jsrec, '{"jsb": [123, "123", null, {"key": "value"}]}') q; +SELECT jsb FROM json_populate_record(NULL::jsrec, '{"jsb": {"a": "bbb", "b": null, "c": 123.45}}') q; + +SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": null}') q; +SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": 123}') q; +SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": [1, "2", null, 4]}') q; +SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": ["aaa", null, [1, 2, "3", {}], { "k" : "v" }]}') q; + +SELECT rec FROM json_populate_record(NULL::jsrec, '{"rec": 123}') q; +SELECT rec FROM json_populate_record(NULL::jsrec, '{"rec": [1, 2]}') q; +SELECT rec FROM json_populate_record(NULL::jsrec, '{"rec": {"a": "abc", "c": "01.02.2003", "x": 43.2}}') q; +SELECT rec FROM json_populate_record(NULL::jsrec, '{"rec": "(abc,42,01.02.2003)"}') q; + +SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": 123}') q; +SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": [1, 2]}') q; +SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": [{"a": "abc", "b": 456}, null, {"c": "01.02.2003", "x": 43.2}]}') q; +SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": ["(abc,42,01.02.2003)"]}') q; +SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": "{\"(abc,42,01.02.2003)\"}"}') q; + +SELECT rec FROM json_populate_record( + row(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, + row('x',3,'2012-12-31 15:30:56')::jpop,NULL)::jsrec, + '{"rec": {"a": "abc", "c": "01.02.2003", "x": 43.2}}' +) q; + +-- anonymous record type +SELECT json_populate_record(null::record, '{"x": 0, "y": 1}'); +SELECT json_populate_record(row(1,2), '{"f1": 0, "f2": 1}'); +SELECT * FROM + json_populate_record(null::record, '{"x": 776}') AS (x int, y int); + +-- composite domain +SELECT json_populate_record(null::j_ordered_pair, '{"x": 0, "y": 1}'); +SELECT json_populate_record(row(1,2)::j_ordered_pair, '{"x": 0}'); +SELECT json_populate_record(row(1,2)::j_ordered_pair, '{"x": 1, "y": 0}'); + +-- populate_recordset + +select * from json_populate_recordset(null::jpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +select * from json_populate_recordset(row('def',99,null)::jpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +select * from json_populate_recordset(null::jpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +select * from json_populate_recordset(row('def',99,null)::jpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +select * from json_populate_recordset(row('def',99,null)::jpop,'[{"a":[100,200,300],"x":43.2},{"a":{"z":true},"b":3,"c":"2012-01-20 10:42:53"}]') q; +select * from json_populate_recordset(row('def',99,null)::jpop,'[{"c":[100,200,300],"x":43.2},{"a":{"z":true},"b":3,"c":"2012-01-20 10:42:53"}]') q; + +create type jpop2 as (a int, b json, c int, d int); +select * from json_populate_recordset(null::jpop2, '[{"a":2,"c":3,"b":{"z":4},"d":6}]') q; + +select * from json_populate_recordset(null::jpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +select * from json_populate_recordset(row('def',99,null)::jpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +select * from json_populate_recordset(row('def',99,null)::jpop,'[{"a":[100,200,300],"x":43.2},{"a":{"z":true},"b":3,"c":"2012-01-20 10:42:53"}]') q; + +-- anonymous record type +SELECT json_populate_recordset(null::record, '[{"x": 0, "y": 1}]'); +SELECT json_populate_recordset(row(1,2), '[{"f1": 0, "f2": 1}]'); +SELECT i, json_populate_recordset(row(i,50), '[{"f1":"42"},{"f2":"43"}]') +FROM (VALUES (1),(2)) v(i); +SELECT * FROM + json_populate_recordset(null::record, '[{"x": 776}]') AS (x int, y int); + +-- empty array is a corner case +SELECT json_populate_recordset(null::record, '[]'); +SELECT json_populate_recordset(row(1,2), '[]'); +SELECT * FROM json_populate_recordset(NULL::jpop,'[]') q; +SELECT * FROM + json_populate_recordset(null::record, '[]') AS (x int, y int); + +-- composite domain +SELECT json_populate_recordset(null::j_ordered_pair, '[{"x": 0, "y": 1}]'); +SELECT json_populate_recordset(row(1,2)::j_ordered_pair, '[{"x": 0}, {"y": 3}]'); +SELECT json_populate_recordset(row(1,2)::j_ordered_pair, '[{"x": 1, "y": 0}]'); + +-- negative cases where the wrong record type is supplied +select * from json_populate_recordset(row(0::int),'[{"a":"1","b":"2"},{"a":"3"}]') q (a text, b text); +select * from json_populate_recordset(row(0::int,0::int),'[{"a":"1","b":"2"},{"a":"3"}]') q (a text, b text); +select * from json_populate_recordset(row(0::int,0::int,0::int),'[{"a":"1","b":"2"},{"a":"3"}]') q (a text, b text); +select * from json_populate_recordset(row(1000000000::int,50::int),'[{"b":"2"},{"a":"3"}]') q (a text, b text); + +-- test type info caching in json_populate_record() +CREATE TEMP TABLE jspoptest (js json); + +INSERT INTO jspoptest +SELECT '{ + "jsa": [1, "2", null, 4], + "rec": {"a": "abc", "c": "01.02.2003", "x": 43.2}, + "reca": [{"a": "abc", "b": 456}, null, {"c": "01.02.2003", "x": 43.2}] +}'::json +FROM generate_series(1, 3); + +SELECT (json_populate_record(NULL::jsrec, js)).* FROM jspoptest; + +DROP TYPE jsrec; +DROP TYPE jsrec_i_not_null; +DROP DOMAIN js_int_not_null; +DROP DOMAIN js_int_array_1d; +DROP DOMAIN js_int_array_2d; +DROP DOMAIN j_ordered_pair; +DROP TYPE j_unordered_pair; + +--json_typeof() function +select value, json_typeof(value) + from (values (json '123.4'), + (json '-1'), + (json '"foo"'), + (json 'true'), + (json 'false'), + (json 'null'), + (json '[1, 2, 3]'), + (json '[]'), + (json '{"x":"foo", "y":123}'), + (json '{}'), + (NULL::json)) + as data(value); + +-- json_build_array, json_build_object, json_object_agg + +SELECT json_build_array('a',1,'b',1.2,'c',true,'d',null,'e',json '{"x": 3, "y": [1,2,3]}'); +SELECT json_build_array('a', NULL); -- ok +SELECT json_build_array(VARIADIC NULL::text[]); -- ok +SELECT json_build_array(VARIADIC '{}'::text[]); -- ok +SELECT json_build_array(VARIADIC '{a,b,c}'::text[]); -- ok +SELECT json_build_array(VARIADIC ARRAY['a', NULL]::text[]); -- ok +SELECT json_build_array(VARIADIC '{1,2,3,4}'::text[]); -- ok +SELECT json_build_array(VARIADIC '{1,2,3,4}'::int[]); -- ok +SELECT json_build_array(VARIADIC '{{1,4},{2,5},{3,6}}'::int[][]); -- ok + +SELECT json_build_object('a',1,'b',1.2,'c',true,'d',null,'e',json '{"x": 3, "y": [1,2,3]}'); + +SELECT json_build_object( + 'a', json_build_object('b',false,'c',99), + 'd', json_build_object('e',array[9,8,7]::int[], + 'f', (select row_to_json(r) from ( select relkind, oid::regclass as name from pg_class where relname = 'pg_class') r))); +SELECT json_build_object('{a,b,c}'::text[]); -- error +SELECT json_build_object('{a,b,c}'::text[], '{d,e,f}'::text[]); -- error, key cannot be array +SELECT json_build_object('a', 'b', 'c'); -- error +SELECT json_build_object(NULL, 'a'); -- error, key cannot be NULL +SELECT json_build_object('a', NULL); -- ok +SELECT json_build_object(VARIADIC NULL::text[]); -- ok +SELECT json_build_object(VARIADIC '{}'::text[]); -- ok +SELECT json_build_object(VARIADIC '{a,b,c}'::text[]); -- error +SELECT json_build_object(VARIADIC ARRAY['a', NULL]::text[]); -- ok +SELECT json_build_object(VARIADIC ARRAY[NULL, 'a']::text[]); -- error, key cannot be NULL +SELECT json_build_object(VARIADIC '{1,2,3,4}'::text[]); -- ok +SELECT json_build_object(VARIADIC '{1,2,3,4}'::int[]); -- ok +SELECT json_build_object(VARIADIC '{{1,4},{2,5},{3,6}}'::int[][]); -- ok + +-- empty objects/arrays +SELECT json_build_array(); + +SELECT json_build_object(); + +-- make sure keys are quoted +SELECT json_build_object(1,2); + +-- keys must be scalar and not null +SELECT json_build_object(null,2); + +SELECT json_build_object(r,2) FROM (SELECT 1 AS a, 2 AS b) r; + +SELECT json_build_object(json '{"a":1,"b":2}', 3); + +SELECT json_build_object('{1,2,3}'::int[], 3); + +CREATE TEMP TABLE foo (serial_num int, name text, type text); +INSERT INTO foo VALUES (847001,'t15','GE1043'); +INSERT INTO foo VALUES (847002,'t16','GE1043'); +INSERT INTO foo VALUES (847003,'sub-alpha','GESS90'); + +SELECT json_build_object('turbines',json_object_agg(serial_num,json_build_object('name',name,'type',type))) +FROM foo; + +SELECT json_object_agg(name, type) FROM foo; + +INSERT INTO foo VALUES (999999, NULL, 'bar'); +SELECT json_object_agg(name, type) FROM foo; + +-- json_object + +-- empty object, one dimension +SELECT json_object('{}'); + +-- empty object, two dimensions +SELECT json_object('{}', '{}'); + +-- one dimension +SELECT json_object('{a,1,b,2,3,NULL,"d e f","a b c"}'); + +-- same but with two dimensions +SELECT json_object('{{a,1},{b,2},{3,NULL},{"d e f","a b c"}}'); + +-- odd number error +SELECT json_object('{a,b,c}'); + +-- one column error +SELECT json_object('{{a},{b}}'); + +-- too many columns error +SELECT json_object('{{a,b,c},{b,c,d}}'); + +-- too many dimensions error +SELECT json_object('{{{a,b},{c,d}},{{b,c},{d,e}}}'); + +--two argument form of json_object + +select json_object('{a,b,c,"d e f"}','{1,2,3,"a b c"}'); + +-- too many dimensions +SELECT json_object('{{a,1},{b,2},{3,NULL},{"d e f","a b c"}}', '{{a,1},{b,2},{3,NULL},{"d e f","a b c"}}'); + +-- mismatched dimensions + +select json_object('{a,b,c,"d e f",g}','{1,2,3,"a b c"}'); + +select json_object('{a,b,c,"d e f"}','{1,2,3,"a b c",g}'); + +-- null key error + +select json_object('{a,b,NULL,"d e f"}','{1,2,3,"a b c"}'); + +-- empty key is allowed + +select json_object('{a,b,"","d e f"}','{1,2,3,"a b c"}'); + + +-- json_to_record and json_to_recordset + +select * from json_to_record('{"a":1,"b":"foo","c":"bar"}') + as x(a int, b text, d text); + +select * from json_to_recordset('[{"a":1,"b":"foo","d":false},{"a":2,"b":"bar","c":true}]') + as x(a int, b text, c boolean); + +select * from json_to_recordset('[{"a":1,"b":{"d":"foo"},"c":true},{"a":2,"c":false,"b":{"d":"bar"}}]') + as x(a int, b json, c boolean); + +select *, c is null as c_is_null +from json_to_record('{"a":1, "b":{"c":16, "d":2}, "x":8, "ca": ["1 2", 3], "ia": [[1,2],[3,4]], "r": {"a": "aaa", "b": 123}}'::json) + as t(a int, b json, c text, x int, ca char(5)[], ia int[][], r jpop); + +select *, c is null as c_is_null +from json_to_recordset('[{"a":1, "b":{"c":16, "d":2}, "x":8}]'::json) + as t(a int, b json, c text, x int); + +select * from json_to_record('{"ia": null}') as x(ia _int4); +select * from json_to_record('{"ia": 123}') as x(ia _int4); +select * from json_to_record('{"ia": [1, "2", null, 4]}') as x(ia _int4); +select * from json_to_record('{"ia": [[1, 2], [3, 4]]}') as x(ia _int4); +select * from json_to_record('{"ia": [[1], 2]}') as x(ia _int4); +select * from json_to_record('{"ia": [[1], [2, 3]]}') as x(ia _int4); + +select * from json_to_record('{"ia2": [1, 2, 3]}') as x(ia2 int[][]); +select * from json_to_record('{"ia2": [[1, 2], [3, 4]]}') as x(ia2 int4[][]); +select * from json_to_record('{"ia2": [[[1], [2], [3]]]}') as x(ia2 int4[][]); + +select * from json_to_record('{"out": {"key": 1}}') as x(out json); +select * from json_to_record('{"out": [{"key": 1}]}') as x(out json); +select * from json_to_record('{"out": "{\"key\": 1}"}') as x(out json); +select * from json_to_record('{"out": {"key": 1}}') as x(out jsonb); +select * from json_to_record('{"out": [{"key": 1}]}') as x(out jsonb); +select * from json_to_record('{"out": "{\"key\": 1}"}') as x(out jsonb); + +-- json_strip_nulls + +select json_strip_nulls(null); + +select json_strip_nulls('1'); + +select json_strip_nulls('"a string"'); + +select json_strip_nulls('null'); + +select json_strip_nulls('[1,2,null,3,4]'); + +select json_strip_nulls('{"a":1,"b":null,"c":[2,null,3],"d":{"e":4,"f":null}}'); + +select json_strip_nulls('[1,{"a":1,"b":null,"c":2},3]'); + +-- an empty object is not null and should not be stripped +select json_strip_nulls('{"a": {"b": null, "c": null}, "d": {} }'); + +-- json to tsvector +select to_tsvector('{"a": "aaa bbb ddd ccc", "b": ["eee fff ggg"], "c": {"d": "hhh iii"}}'::json); + +-- json to tsvector with config +select to_tsvector('simple', '{"a": "aaa bbb ddd ccc", "b": ["eee fff ggg"], "c": {"d": "hhh iii"}}'::json); + +-- json to tsvector with stop words +select to_tsvector('english', '{"a": "aaa in bbb ddd ccc", "b": ["the eee fff ggg"], "c": {"d": "hhh. iii"}}'::json); + +-- json to tsvector with numeric values +select to_tsvector('english', '{"a": "aaa in bbb ddd ccc", "b": 123, "c": 456}'::json); + +-- json_to_tsvector +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"all"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"key"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"string"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"numeric"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"boolean"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '["string", "numeric"]'); + +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"all"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"key"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"string"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"numeric"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '"boolean"'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '["string", "numeric"]'); + +-- to_tsvector corner cases +select to_tsvector('""'::json); +select to_tsvector('{}'::json); +select to_tsvector('[]'::json); +select to_tsvector('null'::json); + +-- json_to_tsvector corner cases +select json_to_tsvector('""'::json, '"all"'); +select json_to_tsvector('{}'::json, '"all"'); +select json_to_tsvector('[]'::json, '"all"'); +select json_to_tsvector('null'::json, '"all"'); + +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '""'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '{}'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '[]'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, 'null'); +select json_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::json, '["all", null]'); + +-- ts_headline for json +select ts_headline('{"a": "aaa bbb", "b": {"c": "ccc ddd fff", "c1": "ccc1 ddd1"}, "d": ["ggg hhh", "iii jjj"]}'::json, tsquery('bbb & ddd & hhh')); +select ts_headline('english', '{"a": "aaa bbb", "b": {"c": "ccc ddd fff"}, "d": ["ggg hhh", "iii jjj"]}'::json, tsquery('bbb & ddd & hhh')); +select ts_headline('{"a": "aaa bbb", "b": {"c": "ccc ddd fff", "c1": "ccc1 ddd1"}, "d": ["ggg hhh", "iii jjj"]}'::json, tsquery('bbb & ddd & hhh'), 'StartSel = <, StopSel = >'); +select ts_headline('english', '{"a": "aaa bbb", "b": {"c": "ccc ddd fff", "c1": "ccc1 ddd1"}, "d": ["ggg hhh", "iii jjj"]}'::json, tsquery('bbb & ddd & hhh'), 'StartSel = <, StopSel = >'); + +-- corner cases for ts_headline with json +select ts_headline('null'::json, tsquery('aaa & bbb')); +select ts_headline('{}'::json, tsquery('aaa & bbb')); +select ts_headline('[]'::json, tsquery('aaa & bbb')); diff --git a/postgresql/examples/json_encoding.sql b/postgresql/examples/json_encoding.sql new file mode 100644 index 0000000..cc23613 --- /dev/null +++ b/postgresql/examples/json_encoding.sql @@ -0,0 +1,81 @@ +-- +-- encoding-sensitive tests for json and jsonb +-- + +-- We provide expected-results files for UTF8 (json_encoding.out) +-- and for SQL_ASCII (json_encoding_1.out). Skip otherwise. +\if :skip_test +\quit +\endif + +SELECT getdatabaseencoding(); -- just to label the results files + +-- first json + +-- basic unicode input +SELECT '"\u"'::json; -- ERROR, incomplete escape +SELECT '"\u00"'::json; -- ERROR, incomplete escape +SELECT '"\u000g"'::json; -- ERROR, g is not a hex digit +SELECT '"\u0000"'::json; -- OK, legal escape +SELECT '"\uaBcD"'::json; -- OK, uppercase and lower case both OK + +-- handling of unicode surrogate pairs + +select json '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a' as correct_in_utf8; +select json '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row +select json '{ "a": "\ude04\ud83d" }' -> 'a'; -- surrogates in wrong order +select json '{ "a": "\ud83dX" }' -> 'a'; -- orphan high surrogate +select json '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate + +--handling of simple unicode escapes + +select json '{ "a": "the Copyright \u00a9 sign" }' as correct_in_utf8; +select json '{ "a": "dollar \u0024 character" }' as correct_everywhere; +select json '{ "a": "dollar \\u0024 character" }' as not_an_escape; +select json '{ "a": "null \u0000 escape" }' as not_unescaped; +select json '{ "a": "null \\u0000 escape" }' as not_an_escape; + +select json '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8; +select json '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere; +select json '{ "a": "dollar \\u0024 character" }' ->> 'a' as not_an_escape; +select json '{ "a": "null \u0000 escape" }' ->> 'a' as fails; +select json '{ "a": "null \\u0000 escape" }' ->> 'a' as not_an_escape; + +-- then jsonb + +-- basic unicode input +SELECT '"\u"'::jsonb; -- ERROR, incomplete escape +SELECT '"\u00"'::jsonb; -- ERROR, incomplete escape +SELECT '"\u000g"'::jsonb; -- ERROR, g is not a hex digit +SELECT '"\u0045"'::jsonb; -- OK, legal escape +SELECT '"\u0000"'::jsonb; -- ERROR, we don't support U+0000 +-- use octet_length here so we don't get an odd unicode char in the +-- output +SELECT octet_length('"\uaBcD"'::jsonb::text); -- OK, uppercase and lower case both OK + +-- handling of unicode surrogate pairs + +SELECT octet_length((jsonb '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a')::text) AS correct_in_utf8; +SELECT jsonb '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row +SELECT jsonb '{ "a": "\ude04\ud83d" }' -> 'a'; -- surrogates in wrong order +SELECT jsonb '{ "a": "\ud83dX" }' -> 'a'; -- orphan high surrogate +SELECT jsonb '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate + +-- handling of simple unicode escapes + +SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' as correct_in_utf8; +SELECT jsonb '{ "a": "dollar \u0024 character" }' as correct_everywhere; +SELECT jsonb '{ "a": "dollar \\u0024 character" }' as not_an_escape; +SELECT jsonb '{ "a": "null \u0000 escape" }' as fails; +SELECT jsonb '{ "a": "null \\u0000 escape" }' as not_an_escape; + +SELECT jsonb '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8; +SELECT jsonb '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere; +SELECT jsonb '{ "a": "dollar \\u0024 character" }' ->> 'a' as not_an_escape; +SELECT jsonb '{ "a": "null \u0000 escape" }' ->> 'a' as fails; +SELECT jsonb '{ "a": "null \\u0000 escape" }' ->> 'a' as not_an_escape; +SELECT getdatabaseencoding() NOT IN ('UTF8', 'SQL_ASCII') + AS skip_test \gset +SELECT getdatabaseencoding() NOT IN ('UTF8', 'SQL_ASCII') + AS skip_test \gset + diff --git a/postgresql/examples/jsonb.sql b/postgresql/examples/jsonb.sql new file mode 100644 index 0000000..3e2b8f6 --- /dev/null +++ b/postgresql/examples/jsonb.sql @@ -0,0 +1,1282 @@ +-- Strings. +SELECT '""'::jsonb; -- OK. +SELECT $$''$$::jsonb; -- ERROR, single quotes are not allowed +SELECT '"abc"'::jsonb; -- OK +SELECT '"abc'::jsonb; -- ERROR, quotes not closed +SELECT '"abc +def"'::jsonb; -- ERROR, unescaped newline in string constant +SELECT '"\n\"\\"'::jsonb; -- OK, legal escapes +SELECT '"\v"'::jsonb; -- ERROR, not a valid JSON escape +-- see json_encoding test for input with unicode escapes + +-- Numbers. +SELECT '1'::jsonb; -- OK +SELECT '0'::jsonb; -- OK +SELECT '01'::jsonb; -- ERROR, not valid according to JSON spec +SELECT '0.1'::jsonb; -- OK +SELECT '9223372036854775808'::jsonb; -- OK, even though it's too large for int8 +SELECT '1e100'::jsonb; -- OK +SELECT '1.3e100'::jsonb; -- OK +SELECT '1f2'::jsonb; -- ERROR +SELECT '0.x1'::jsonb; -- ERROR +SELECT '1.3ex100'::jsonb; -- ERROR + +-- Arrays. +SELECT '[]'::jsonb; -- OK +SELECT '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'::jsonb; -- OK +SELECT '[1,2]'::jsonb; -- OK +SELECT '[1,2,]'::jsonb; -- ERROR, trailing comma +SELECT '[1,2'::jsonb; -- ERROR, no closing bracket +SELECT '[1,[2]'::jsonb; -- ERROR, no closing bracket + +-- Objects. +SELECT '{}'::jsonb; -- OK +SELECT '{"abc"}'::jsonb; -- ERROR, no value +SELECT '{"abc":1}'::jsonb; -- OK +SELECT '{1:"abc"}'::jsonb; -- ERROR, keys must be strings +SELECT '{"abc",1}'::jsonb; -- ERROR, wrong separator +SELECT '{"abc"=1}'::jsonb; -- ERROR, totally wrong separator +SELECT '{"abc"::1}'::jsonb; -- ERROR, another wrong separator +SELECT '{"abc":1,"def":2,"ghi":[3,4],"hij":{"klm":5,"nop":[6]}}'::jsonb; -- OK +SELECT '{"abc":1:2}'::jsonb; -- ERROR, colon in wrong spot +SELECT '{"abc":1,3}'::jsonb; -- ERROR, no value + +-- Recursion. +SET max_stack_depth = '100kB'; +SELECT repeat('[', 10000)::jsonb; +SELECT repeat('{"a":', 10000)::jsonb; +RESET max_stack_depth; + +-- Miscellaneous stuff. +SELECT 'true'::jsonb; -- OK +SELECT 'false'::jsonb; -- OK +SELECT 'null'::jsonb; -- OK +SELECT ' true '::jsonb; -- OK, even with extra whitespace +SELECT 'true false'::jsonb; -- ERROR, too many values +SELECT 'true, false'::jsonb; -- ERROR, too many values +SELECT 'truf'::jsonb; -- ERROR, not a keyword +SELECT 'trues'::jsonb; -- ERROR, not a keyword +SELECT ''::jsonb; -- ERROR, no value +SELECT ' '::jsonb; -- ERROR, no value + +-- make sure jsonb is passed through json generators without being escaped +SELECT array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']); + +-- anyarray column + +CREATE TEMP TABLE rows AS +SELECT x, 'txt' || x as y +FROM generate_series(1,3) AS x; + +analyze rows; + +select attname, to_jsonb(histogram_bounds) histogram_bounds +from pg_stats +where tablename = 'rows' and + schemaname = pg_my_temp_schema()::regnamespace::text +order by 1; + +-- to_jsonb, timestamps + +select to_jsonb(timestamp '2014-05-28 12:22:35.614298'); + +BEGIN; +SET LOCAL TIME ZONE 10.5; +select to_jsonb(timestamptz '2014-05-28 12:22:35.614298-04'); +SET LOCAL TIME ZONE -8; +select to_jsonb(timestamptz '2014-05-28 12:22:35.614298-04'); +COMMIT; + +select to_jsonb(date '2014-05-28'); + +select to_jsonb(date 'Infinity'); +select to_jsonb(date '-Infinity'); +select to_jsonb(timestamp 'Infinity'); +select to_jsonb(timestamp '-Infinity'); +select to_jsonb(timestamptz 'Infinity'); +select to_jsonb(timestamptz '-Infinity'); + +--jsonb_agg + +SELECT jsonb_agg(q) + FROM ( SELECT $$a$$ || x AS b, y AS c, + ARRAY[ROW(x.*,ARRAY[1,2,3]), + ROW(y.*,ARRAY[4,5,6])] AS z + FROM generate_series(1,2) x, + generate_series(4,5) y) q; + +SELECT jsonb_agg(q ORDER BY x, y) + FROM rows q; + +UPDATE rows SET x = NULL WHERE x = 1; + +SELECT jsonb_agg(q ORDER BY x NULLS FIRST, y) + FROM rows q; + +-- jsonb extraction functions +CREATE TEMP TABLE test_jsonb ( + json_type text, + test_json jsonb +); + +INSERT INTO test_jsonb VALUES +('scalar','"a scalar"'), +('array','["zero", "one","two",null,"four","five", [1,2,3],{"f1":9}]'), +('object','{"field1":"val1","field2":"val2","field3":null, "field4": 4, "field5": [1,2,3], "field6": {"f1":9}}'); + +SELECT test_json -> 'x' FROM test_jsonb WHERE json_type = 'scalar'; +SELECT test_json -> 'x' FROM test_jsonb WHERE json_type = 'array'; +SELECT test_json -> 'x' FROM test_jsonb WHERE json_type = 'object'; +SELECT test_json -> 'field2' FROM test_jsonb WHERE json_type = 'object'; + +SELECT test_json ->> 'field2' FROM test_jsonb WHERE json_type = 'scalar'; +SELECT test_json ->> 'field2' FROM test_jsonb WHERE json_type = 'array'; +SELECT test_json ->> 'field2' FROM test_jsonb WHERE json_type = 'object'; + +SELECT test_json -> 2 FROM test_jsonb WHERE json_type = 'scalar'; +SELECT test_json -> 2 FROM test_jsonb WHERE json_type = 'array'; +SELECT test_json -> 9 FROM test_jsonb WHERE json_type = 'array'; +SELECT test_json -> 2 FROM test_jsonb WHERE json_type = 'object'; + +SELECT test_json ->> 6 FROM test_jsonb WHERE json_type = 'array'; +SELECT test_json ->> 7 FROM test_jsonb WHERE json_type = 'array'; + +SELECT test_json ->> 'field4' FROM test_jsonb WHERE json_type = 'object'; +SELECT test_json ->> 'field5' FROM test_jsonb WHERE json_type = 'object'; +SELECT test_json ->> 'field6' FROM test_jsonb WHERE json_type = 'object'; + +SELECT test_json ->> 2 FROM test_jsonb WHERE json_type = 'scalar'; +SELECT test_json ->> 2 FROM test_jsonb WHERE json_type = 'array'; +SELECT test_json ->> 2 FROM test_jsonb WHERE json_type = 'object'; + +SELECT jsonb_object_keys(test_json) FROM test_jsonb WHERE json_type = 'scalar'; +SELECT jsonb_object_keys(test_json) FROM test_jsonb WHERE json_type = 'array'; +SELECT jsonb_object_keys(test_json) FROM test_jsonb WHERE json_type = 'object'; + +-- nulls +SELECT (test_json->'field3') IS NULL AS expect_false FROM test_jsonb WHERE json_type = 'object'; +SELECT (test_json->>'field3') IS NULL AS expect_true FROM test_jsonb WHERE json_type = 'object'; +SELECT (test_json->3) IS NULL AS expect_false FROM test_jsonb WHERE json_type = 'array'; +SELECT (test_json->>3) IS NULL AS expect_true FROM test_jsonb WHERE json_type = 'array'; + +-- corner cases +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> null::text; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> null::int; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> 1; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> 'z'; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb -> ''; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb -> 1; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb -> 3; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb -> 'z'; +select '{"a": "c", "b": null}'::jsonb -> 'b'; +select '"foo"'::jsonb -> 1; +select '"foo"'::jsonb -> 'z'; + +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> null::text; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> null::int; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> 1; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> 'z'; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb ->> ''; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 1; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 3; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb ->> 'z'; +select '{"a": "c", "b": null}'::jsonb ->> 'b'; +select '"foo"'::jsonb ->> 1; +select '"foo"'::jsonb ->> 'z'; + +-- equality and inequality +SELECT '{"x":"y"}'::jsonb = '{"x":"y"}'::jsonb; +SELECT '{"x":"y"}'::jsonb = '{"x":"z"}'::jsonb; + +SELECT '{"x":"y"}'::jsonb <> '{"x":"y"}'::jsonb; +SELECT '{"x":"y"}'::jsonb <> '{"x":"z"}'::jsonb; + +-- containment +SELECT jsonb_contains('{"a":"b", "b":1, "c":null}', '{"a":"b"}'); +SELECT jsonb_contains('{"a":"b", "b":1, "c":null}', '{"a":"b", "c":null}'); +SELECT jsonb_contains('{"a":"b", "b":1, "c":null}', '{"a":"b", "g":null}'); +SELECT jsonb_contains('{"a":"b", "b":1, "c":null}', '{"g":null}'); +SELECT jsonb_contains('{"a":"b", "b":1, "c":null}', '{"a":"c"}'); +SELECT jsonb_contains('{"a":"b", "b":1, "c":null}', '{"a":"b"}'); +SELECT jsonb_contains('{"a":"b", "b":1, "c":null}', '{"a":"b", "c":"q"}'); +SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}'; +SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":null}'; +SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "g":null}'; +SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"g":null}'; +SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"c"}'; +SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b"}'; +SELECT '{"a":"b", "b":1, "c":null}'::jsonb @> '{"a":"b", "c":"q"}'; + +SELECT '[1,2]'::jsonb @> '[1,2,2]'::jsonb; +SELECT '[1,1,2]'::jsonb @> '[1,2,2]'::jsonb; +SELECT '[[1,2]]'::jsonb @> '[[1,2,2]]'::jsonb; +SELECT '[1,2,2]'::jsonb <@ '[1,2]'::jsonb; +SELECT '[1,2,2]'::jsonb <@ '[1,1,2]'::jsonb; +SELECT '[[1,2,2]]'::jsonb <@ '[[1,2]]'::jsonb; + +SELECT jsonb_contained('{"a":"b"}', '{"a":"b", "b":1, "c":null}'); +SELECT jsonb_contained('{"a":"b", "c":null}', '{"a":"b", "b":1, "c":null}'); +SELECT jsonb_contained('{"a":"b", "g":null}', '{"a":"b", "b":1, "c":null}'); +SELECT jsonb_contained('{"g":null}', '{"a":"b", "b":1, "c":null}'); +SELECT jsonb_contained('{"a":"c"}', '{"a":"b", "b":1, "c":null}'); +SELECT jsonb_contained('{"a":"b"}', '{"a":"b", "b":1, "c":null}'); +SELECT jsonb_contained('{"a":"b", "c":"q"}', '{"a":"b", "b":1, "c":null}'); +SELECT '{"a":"b"}'::jsonb <@ '{"a":"b", "b":1, "c":null}'; +SELECT '{"a":"b", "c":null}'::jsonb <@ '{"a":"b", "b":1, "c":null}'; +SELECT '{"a":"b", "g":null}'::jsonb <@ '{"a":"b", "b":1, "c":null}'; +SELECT '{"g":null}'::jsonb <@ '{"a":"b", "b":1, "c":null}'; +SELECT '{"a":"c"}'::jsonb <@ '{"a":"b", "b":1, "c":null}'; +SELECT '{"a":"b"}'::jsonb <@ '{"a":"b", "b":1, "c":null}'; +SELECT '{"a":"b", "c":"q"}'::jsonb <@ '{"a":"b", "b":1, "c":null}'; +-- Raw scalar may contain another raw scalar, array may contain a raw scalar +SELECT '[5]'::jsonb @> '[5]'; +SELECT '5'::jsonb @> '5'; +SELECT '[5]'::jsonb @> '5'; +-- But a raw scalar cannot contain an array +SELECT '5'::jsonb @> '[5]'; +-- In general, one thing should always contain itself. Test array containment: +SELECT '["9", ["7", "3"], 1]'::jsonb @> '["9", ["7", "3"], 1]'::jsonb; +SELECT '["9", ["7", "3"], ["1"]]'::jsonb @> '["9", ["7", "3"], ["1"]]'::jsonb; +-- array containment string matching confusion bug +SELECT '{ "name": "Bob", "tags": [ "enim", "qui"]}'::jsonb @> '{"tags":["qu"]}'; + +-- array length +SELECT jsonb_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]'); +SELECT jsonb_array_length('[]'); +SELECT jsonb_array_length('{"f1":1,"f2":[5,6]}'); +SELECT jsonb_array_length('4'); + +-- each +SELECT jsonb_each('{"f1":[1,2,3],"f2":{"f3":1},"f4":null}'); +SELECT jsonb_each('{"a":{"b":"c","c":"b","1":"first"},"b":[1,2],"c":"cc","1":"first","n":null}'::jsonb) AS q; +SELECT * FROM jsonb_each('{"f1":[1,2,3],"f2":{"f3":1},"f4":null,"f5":99,"f6":"stringy"}') q; +SELECT * FROM jsonb_each('{"a":{"b":"c","c":"b","1":"first"},"b":[1,2],"c":"cc","1":"first","n":null}'::jsonb) AS q; + +SELECT jsonb_each_text('{"f1":[1,2,3],"f2":{"f3":1},"f4":null,"f5":"null"}'); +SELECT jsonb_each_text('{"a":{"b":"c","c":"b","1":"first"},"b":[1,2],"c":"cc","1":"first","n":null}'::jsonb) AS q; +SELECT * FROM jsonb_each_text('{"f1":[1,2,3],"f2":{"f3":1},"f4":null,"f5":99,"f6":"stringy"}') q; +SELECT * FROM jsonb_each_text('{"a":{"b":"c","c":"b","1":"first"},"b":[1,2],"c":"cc","1":"first","n":null}'::jsonb) AS q; + +-- exists +SELECT jsonb_exists('{"a":null, "b":"qq"}', 'a'); +SELECT jsonb_exists('{"a":null, "b":"qq"}', 'b'); +SELECT jsonb_exists('{"a":null, "b":"qq"}', 'c'); +SELECT jsonb_exists('{"a":"null", "b":"qq"}', 'a'); +SELECT jsonb '{"a":null, "b":"qq"}' ? 'a'; +SELECT jsonb '{"a":null, "b":"qq"}' ? 'b'; +SELECT jsonb '{"a":null, "b":"qq"}' ? 'c'; +SELECT jsonb '{"a":"null", "b":"qq"}' ? 'a'; +-- array exists - array elements should behave as keys +SELECT count(*) from testjsonb WHERE j->'array' ? 'bar'; +-- type sensitive array exists - should return no rows (since "exists" only +-- matches strings that are either object keys or array elements) +SELECT count(*) from testjsonb WHERE j->'array' ? '5'::text; +-- However, a raw scalar is *contained* within the array +SELECT count(*) from testjsonb WHERE j->'array' @> '5'::jsonb; + +SELECT jsonb_exists_any('{"a":null, "b":"qq"}', ARRAY['a','b']); +SELECT jsonb_exists_any('{"a":null, "b":"qq"}', ARRAY['b','a']); +SELECT jsonb_exists_any('{"a":null, "b":"qq"}', ARRAY['c','a']); +SELECT jsonb_exists_any('{"a":null, "b":"qq"}', ARRAY['c','d']); +SELECT jsonb_exists_any('{"a":null, "b":"qq"}', '{}'::text[]); +SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['a','b']; +SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['b','a']; +SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['c','a']; +SELECT jsonb '{"a":null, "b":"qq"}' ?| ARRAY['c','d']; +SELECT jsonb '{"a":null, "b":"qq"}' ?| '{}'::text[]; + +SELECT jsonb_exists_all('{"a":null, "b":"qq"}', ARRAY['a','b']); +SELECT jsonb_exists_all('{"a":null, "b":"qq"}', ARRAY['b','a']); +SELECT jsonb_exists_all('{"a":null, "b":"qq"}', ARRAY['c','a']); +SELECT jsonb_exists_all('{"a":null, "b":"qq"}', ARRAY['c','d']); +SELECT jsonb_exists_all('{"a":null, "b":"qq"}', '{}'::text[]); +SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['a','b']; +SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['b','a']; +SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['c','a']; +SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['c','d']; +SELECT jsonb '{"a":null, "b":"qq"}' ?& ARRAY['a','a', 'b', 'b', 'b']; +SELECT jsonb '{"a":null, "b":"qq"}' ?& '{}'::text[]; + +-- typeof +SELECT jsonb_typeof('{}') AS object; +SELECT jsonb_typeof('{"c":3,"p":"o"}') AS object; +SELECT jsonb_typeof('[]') AS array; +SELECT jsonb_typeof('["a", 1]') AS array; +SELECT jsonb_typeof('null') AS "null"; +SELECT jsonb_typeof('1') AS number; +SELECT jsonb_typeof('-1') AS number; +SELECT jsonb_typeof('1.0') AS number; +SELECT jsonb_typeof('1e2') AS number; +SELECT jsonb_typeof('-1.0') AS number; +SELECT jsonb_typeof('true') AS boolean; +SELECT jsonb_typeof('false') AS boolean; +SELECT jsonb_typeof('"hello"') AS string; +SELECT jsonb_typeof('"true"') AS string; +SELECT jsonb_typeof('"1.0"') AS string; + +-- jsonb_build_array, jsonb_build_object, jsonb_object_agg + +SELECT jsonb_build_array('a',1,'b',1.2,'c',true,'d',null,'e',json '{"x": 3, "y": [1,2,3]}'); +SELECT jsonb_build_array('a', NULL); -- ok +SELECT jsonb_build_array(VARIADIC NULL::text[]); -- ok +SELECT jsonb_build_array(VARIADIC '{}'::text[]); -- ok +SELECT jsonb_build_array(VARIADIC '{a,b,c}'::text[]); -- ok +SELECT jsonb_build_array(VARIADIC ARRAY['a', NULL]::text[]); -- ok +SELECT jsonb_build_array(VARIADIC '{1,2,3,4}'::text[]); -- ok +SELECT jsonb_build_array(VARIADIC '{1,2,3,4}'::int[]); -- ok +SELECT jsonb_build_array(VARIADIC '{{1,4},{2,5},{3,6}}'::int[][]); -- ok + +SELECT jsonb_build_object('a',1,'b',1.2,'c',true,'d',null,'e',json '{"x": 3, "y": [1,2,3]}'); + +SELECT jsonb_build_object( + 'a', jsonb_build_object('b',false,'c',99), + 'd', jsonb_build_object('e',array[9,8,7]::int[], + 'f', (select row_to_json(r) from ( select relkind, oid::regclass as name from pg_class where relname = 'pg_class') r))); +SELECT jsonb_build_object('{a,b,c}'::text[]); -- error +SELECT jsonb_build_object('{a,b,c}'::text[], '{d,e,f}'::text[]); -- error, key cannot be array +SELECT jsonb_build_object('a', 'b', 'c'); -- error +SELECT jsonb_build_object(NULL, 'a'); -- error, key cannot be NULL +SELECT jsonb_build_object('a', NULL); -- ok +SELECT jsonb_build_object(VARIADIC NULL::text[]); -- ok +SELECT jsonb_build_object(VARIADIC '{}'::text[]); -- ok +SELECT jsonb_build_object(VARIADIC '{a,b,c}'::text[]); -- error +SELECT jsonb_build_object(VARIADIC ARRAY['a', NULL]::text[]); -- ok +SELECT jsonb_build_object(VARIADIC ARRAY[NULL, 'a']::text[]); -- error, key cannot be NULL +SELECT jsonb_build_object(VARIADIC '{1,2,3,4}'::text[]); -- ok +SELECT jsonb_build_object(VARIADIC '{1,2,3,4}'::int[]); -- ok +SELECT jsonb_build_object(VARIADIC '{{1,4},{2,5},{3,6}}'::int[][]); -- ok + +-- empty objects/arrays +SELECT jsonb_build_array(); + +SELECT jsonb_build_object(); + +-- make sure keys are quoted +SELECT jsonb_build_object(1,2); + +-- keys must be scalar and not null +SELECT jsonb_build_object(null,2); + +SELECT jsonb_build_object(r,2) FROM (SELECT 1 AS a, 2 AS b) r; + +SELECT jsonb_build_object(json '{"a":1,"b":2}', 3); + +SELECT jsonb_build_object('{1,2,3}'::int[], 3); + +-- handling of NULL values +SELECT jsonb_object_agg(1, NULL::jsonb); +SELECT jsonb_object_agg(NULL, '{"a":1}'); + +CREATE TEMP TABLE foo (serial_num int, name text, type text); +INSERT INTO foo VALUES (847001,'t15','GE1043'); +INSERT INTO foo VALUES (847002,'t16','GE1043'); +INSERT INTO foo VALUES (847003,'sub-alpha','GESS90'); + +SELECT jsonb_build_object('turbines',jsonb_object_agg(serial_num,jsonb_build_object('name',name,'type',type))) +FROM foo; + +SELECT jsonb_object_agg(name, type) FROM foo; + +INSERT INTO foo VALUES (999999, NULL, 'bar'); +SELECT jsonb_object_agg(name, type) FROM foo; + +-- jsonb_object + +-- empty object, one dimension +SELECT jsonb_object('{}'); + +-- empty object, two dimensions +SELECT jsonb_object('{}', '{}'); + +-- one dimension +SELECT jsonb_object('{a,1,b,2,3,NULL,"d e f","a b c"}'); + +-- same but with two dimensions +SELECT jsonb_object('{{a,1},{b,2},{3,NULL},{"d e f","a b c"}}'); + +-- odd number error +SELECT jsonb_object('{a,b,c}'); + +-- one column error +SELECT jsonb_object('{{a},{b}}'); + +-- too many columns error +SELECT jsonb_object('{{a,b,c},{b,c,d}}'); + +-- too many dimensions error +SELECT jsonb_object('{{{a,b},{c,d}},{{b,c},{d,e}}}'); + +--two argument form of jsonb_object + +select jsonb_object('{a,b,c,"d e f"}','{1,2,3,"a b c"}'); + +-- too many dimensions +SELECT jsonb_object('{{a,1},{b,2},{3,NULL},{"d e f","a b c"}}', '{{a,1},{b,2},{3,NULL},{"d e f","a b c"}}'); + +-- mismatched dimensions + +select jsonb_object('{a,b,c,"d e f",g}','{1,2,3,"a b c"}'); + +select jsonb_object('{a,b,c,"d e f"}','{1,2,3,"a b c",g}'); + +-- null key error + +select jsonb_object('{a,b,NULL,"d e f"}','{1,2,3,"a b c"}'); + +-- empty key is allowed + +select jsonb_object('{a,b,"","d e f"}','{1,2,3,"a b c"}'); + + + +-- extract_path, extract_path_as_text +SELECT jsonb_extract_path('{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}','f4','f6'); +SELECT jsonb_extract_path('{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}','f2'); +SELECT jsonb_extract_path('{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}','f2',0::text); +SELECT jsonb_extract_path('{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}','f2',1::text); +SELECT jsonb_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}','f4','f6'); +SELECT jsonb_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}','f2'); +SELECT jsonb_extract_path_text('{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}','f2',0::text); +SELECT jsonb_extract_path_text('{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}','f2',1::text); + +-- extract_path nulls +SELECT jsonb_extract_path('{"f2":{"f3":1},"f4":{"f5":null,"f6":"stringy"}}','f4','f5') IS NULL AS expect_false; +SELECT jsonb_extract_path_text('{"f2":{"f3":1},"f4":{"f5":null,"f6":"stringy"}}','f4','f5') IS NULL AS expect_true; +SELECT jsonb_extract_path('{"f2":{"f3":1},"f4":[0,1,2,null]}','f4','3') IS NULL AS expect_false; +SELECT jsonb_extract_path_text('{"f2":{"f3":1},"f4":[0,1,2,null]}','f4','3') IS NULL AS expect_true; + +-- extract_path operators +SELECT '{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>array['f4','f6']; +SELECT '{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>array['f2']; +SELECT '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>array['f2','0']; +SELECT '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>array['f2','1']; + +SELECT '{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>>array['f4','f6']; +SELECT '{"f2":{"f3":1},"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>>array['f2']; +SELECT '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>>array['f2','0']; +SELECT '{"f2":["f3",1],"f4":{"f5":99,"f6":"stringy"}}'::jsonb#>>array['f2','1']; + +-- corner cases for same +select '{"a": {"b":{"c": "foo"}}}'::jsonb #> '{}'; +select '[1,2,3]'::jsonb #> '{}'; +select '"foo"'::jsonb #> '{}'; +select '42'::jsonb #> '{}'; +select 'null'::jsonb #> '{}'; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a', null]; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a', '']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','b']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','b','c']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','b','c','d']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #> array['a','z','c']; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb #> array['a','1','b']; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb #> array['a','z','b']; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb #> array['1','b']; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb #> array['z','b']; +select '[{"b": "c"}, {"b": null}]'::jsonb #> array['1','b']; +select '"foo"'::jsonb #> array['z']; +select '42'::jsonb #> array['f2']; +select '42'::jsonb #> array['0']; + +select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> '{}'; +select '[1,2,3]'::jsonb #>> '{}'; +select '"foo"'::jsonb #>> '{}'; +select '42'::jsonb #>> '{}'; +select 'null'::jsonb #>> '{}'; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a', null]; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a', '']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','b']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','b','c']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','b','c','d']; +select '{"a": {"b":{"c": "foo"}}}'::jsonb #>> array['a','z','c']; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb #>> array['a','1','b']; +select '{"a": [{"b": "c"}, {"b": "cc"}]}'::jsonb #>> array['a','z','b']; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb #>> array['1','b']; +select '[{"b": "c"}, {"b": "cc"}]'::jsonb #>> array['z','b']; +select '[{"b": "c"}, {"b": null}]'::jsonb #>> array['1','b']; +select '"foo"'::jsonb #>> array['z']; +select '42'::jsonb #>> array['f2']; +select '42'::jsonb #>> array['0']; + +-- array_elements +SELECT jsonb_array_elements('[1,true,[1,[2,3]],null,{"f1":1,"f2":[7,8,9]},false]'); +SELECT * FROM jsonb_array_elements('[1,true,[1,[2,3]],null,{"f1":1,"f2":[7,8,9]},false]') q; +SELECT jsonb_array_elements_text('[1,true,[1,[2,3]],null,{"f1":1,"f2":[7,8,9]},false,"stringy"]'); +SELECT * FROM jsonb_array_elements_text('[1,true,[1,[2,3]],null,{"f1":1,"f2":[7,8,9]},false,"stringy"]') q; + +-- populate_record +CREATE TYPE jbpop AS (a text, b int, c timestamp); + +CREATE DOMAIN jsb_int_not_null AS int NOT NULL; +CREATE DOMAIN jsb_int_array_1d AS int[] CHECK(array_length(VALUE, 1) = 3); +CREATE DOMAIN jsb_int_array_2d AS int[][] CHECK(array_length(VALUE, 2) = 3); + +create type jb_unordered_pair as (x int, y int); +create domain jb_ordered_pair as jb_unordered_pair check((value).x <= (value).y); + +CREATE TYPE jsbrec AS ( + i int, + ia _int4, + ia1 int[], + ia2 int[][], + ia3 int[][][], + ia1d jsb_int_array_1d, + ia2d jsb_int_array_2d, + t text, + ta text[], + c char(10), + ca char(10)[], + ts timestamp, + js json, + jsb jsonb, + jsa json[], + rec jbpop, + reca jbpop[] +); + +CREATE TYPE jsbrec_i_not_null AS ( + i jsb_int_not_null +); + +SELECT * FROM jsonb_populate_record(NULL::jbpop,'{"a":"blurfl","x":43.2}') q; +SELECT * FROM jsonb_populate_record(row('x',3,'2012-12-31 15:30:56')::jbpop,'{"a":"blurfl","x":43.2}') q; + +SELECT * FROM jsonb_populate_record(NULL::jbpop,'{"a":"blurfl","x":43.2}') q; +SELECT * FROM jsonb_populate_record(row('x',3,'2012-12-31 15:30:56')::jbpop,'{"a":"blurfl","x":43.2}') q; + +SELECT * FROM jsonb_populate_record(NULL::jbpop,'{"a":[100,200,false],"x":43.2}') q; +SELECT * FROM jsonb_populate_record(row('x',3,'2012-12-31 15:30:56')::jbpop,'{"a":[100,200,false],"x":43.2}') q; +SELECT * FROM jsonb_populate_record(row('x',3,'2012-12-31 15:30:56')::jbpop,'{"c":[100,200,false],"x":43.2}') q; + +SELECT * FROM jsonb_populate_record(row('x',3,'2012-12-31 15:30:56')::jbpop, '{}') q; + +SELECT i FROM jsonb_populate_record(NULL::jsbrec_i_not_null, '{"x": 43.2}') q; +SELECT i FROM jsonb_populate_record(NULL::jsbrec_i_not_null, '{"i": null}') q; +SELECT i FROM jsonb_populate_record(NULL::jsbrec_i_not_null, '{"i": 12345}') q; + +SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": null}') q; +SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": 123}') q; +SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [1, "2", null, 4]}') q; +SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1, 2], [3, 4]]}') q; +SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1], 2]}') q; +SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1], [2, 3]]}') q; +SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": "{1,2,3}"}') q; + +SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": null}') q; +SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": 123}') q; +SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": [1, "2", null, 4]}') q; +SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": [[1, 2, 3]]}') q; + +SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": null}') q; +SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": 123}') q; +SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": [1, "2", null, 4]}') q; +SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": [1, "2", null]}') q; + +SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [1, "2", null, 4]}') q; +SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[1, 2], [null, 4]]}') q; +SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[], []]}') q; +SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[1, 2], [3]]}') q; +SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[1, 2], 3, 4]}') q; + +SELECT ia2d FROM jsonb_populate_record(NULL::jsbrec, '{"ia2d": [[1, "2"], [null, 4]]}') q; +SELECT ia2d FROM jsonb_populate_record(NULL::jsbrec, '{"ia2d": [[1, "2", 3], [null, 5, 6]]}') q; + +SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [1, "2", null, 4]}') q; +SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [[1, 2], [null, 4]]}') q; +SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [ [[], []], [[], []], [[], []] ]}') q; +SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [ [[1, 2]], [[3, 4]] ]}') q; +SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [ [[1, 2], [3, 4]], [[5, 6], [7, 8]] ]}') q; +SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [ [[1, 2], [3, 4]], [[5, 6], [7, 8], [9, 10]] ]}') q; + +SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": null}') q; +SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": 123}') q; +SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": [1, "2", null, 4]}') q; +SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": [[1, 2, 3], {"k": "v"}]}') q; + +SELECT c FROM jsonb_populate_record(NULL::jsbrec, '{"c": null}') q; +SELECT c FROM jsonb_populate_record(NULL::jsbrec, '{"c": "aaa"}') q; +SELECT c FROM jsonb_populate_record(NULL::jsbrec, '{"c": "aaaaaaaaaa"}') q; +SELECT c FROM jsonb_populate_record(NULL::jsbrec, '{"c": "aaaaaaaaaaaaa"}') q; + +SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": null}') q; +SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": 123}') q; +SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": [1, "2", null, 4]}') q; +SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": ["aaaaaaaaaaaaaaaa"]}') q; +SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": [[1, 2, 3], {"k": "v"}]}') q; + +SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": null}') q; +SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": true}') q; +SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": 123.45}') q; +SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": "123.45"}') q; +SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": "abc"}') q; +SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": [123, "123", null, {"key": "value"}]}') q; +SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": {"a": "bbb", "b": null, "c": 123.45}}') q; + +SELECT jsb FROM jsonb_populate_record(NULL::jsbrec, '{"jsb": null}') q; +SELECT jsb FROM jsonb_populate_record(NULL::jsbrec, '{"jsb": true}') q; +SELECT jsb FROM jsonb_populate_record(NULL::jsbrec, '{"jsb": 123.45}') q; +SELECT jsb FROM jsonb_populate_record(NULL::jsbrec, '{"jsb": "123.45"}') q; +SELECT jsb FROM jsonb_populate_record(NULL::jsbrec, '{"jsb": "abc"}') q; +SELECT jsb FROM jsonb_populate_record(NULL::jsbrec, '{"jsb": [123, "123", null, {"key": "value"}]}') q; +SELECT jsb FROM jsonb_populate_record(NULL::jsbrec, '{"jsb": {"a": "bbb", "b": null, "c": 123.45}}') q; + +SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": null}') q; +SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": 123}') q; +SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": [1, "2", null, 4]}') q; +SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": ["aaa", null, [1, 2, "3", {}], { "k" : "v" }]}') q; + +SELECT rec FROM jsonb_populate_record(NULL::jsbrec, '{"rec": 123}') q; +SELECT rec FROM jsonb_populate_record(NULL::jsbrec, '{"rec": [1, 2]}') q; +SELECT rec FROM jsonb_populate_record(NULL::jsbrec, '{"rec": {"a": "abc", "c": "01.02.2003", "x": 43.2}}') q; +SELECT rec FROM jsonb_populate_record(NULL::jsbrec, '{"rec": "(abc,42,01.02.2003)"}') q; + +SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": 123}') q; +SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": [1, 2]}') q; +SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": [{"a": "abc", "b": 456}, null, {"c": "01.02.2003", "x": 43.2}]}') q; +SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": ["(abc,42,01.02.2003)"]}') q; +SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": "{\"(abc,42,01.02.2003)\"}"}') q; + +SELECT rec FROM jsonb_populate_record( + row(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, + row('x',3,'2012-12-31 15:30:56')::jbpop,NULL)::jsbrec, + '{"rec": {"a": "abc", "c": "01.02.2003", "x": 43.2}}' +) q; + +-- anonymous record type +SELECT jsonb_populate_record(null::record, '{"x": 0, "y": 1}'); +SELECT jsonb_populate_record(row(1,2), '{"f1": 0, "f2": 1}'); +SELECT * FROM + jsonb_populate_record(null::record, '{"x": 776}') AS (x int, y int); + +-- composite domain +SELECT jsonb_populate_record(null::jb_ordered_pair, '{"x": 0, "y": 1}'); +SELECT jsonb_populate_record(row(1,2)::jb_ordered_pair, '{"x": 0}'); +SELECT jsonb_populate_record(row(1,2)::jb_ordered_pair, '{"x": 1, "y": 0}'); + +-- populate_recordset +SELECT * FROM jsonb_populate_recordset(NULL::jbpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +SELECT * FROM jsonb_populate_recordset(row('def',99,NULL)::jbpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +SELECT * FROM jsonb_populate_recordset(NULL::jbpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +SELECT * FROM jsonb_populate_recordset(row('def',99,NULL)::jbpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +SELECT * FROM jsonb_populate_recordset(row('def',99,NULL)::jbpop,'[{"a":[100,200,300],"x":43.2},{"a":{"z":true},"b":3,"c":"2012-01-20 10:42:53"}]') q; +SELECT * FROM jsonb_populate_recordset(row('def',99,NULL)::jbpop,'[{"c":[100,200,300],"x":43.2},{"a":{"z":true},"b":3,"c":"2012-01-20 10:42:53"}]') q; + +SELECT * FROM jsonb_populate_recordset(NULL::jbpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +SELECT * FROM jsonb_populate_recordset(row('def',99,NULL)::jbpop,'[{"a":"blurfl","x":43.2},{"b":3,"c":"2012-01-20 10:42:53"}]') q; +SELECT * FROM jsonb_populate_recordset(row('def',99,NULL)::jbpop,'[{"a":[100,200,300],"x":43.2},{"a":{"z":true},"b":3,"c":"2012-01-20 10:42:53"}]') q; + +-- anonymous record type +SELECT jsonb_populate_recordset(null::record, '[{"x": 0, "y": 1}]'); +SELECT jsonb_populate_recordset(row(1,2), '[{"f1": 0, "f2": 1}]'); +SELECT i, jsonb_populate_recordset(row(i,50), '[{"f1":"42"},{"f2":"43"}]') +FROM (VALUES (1),(2)) v(i); +SELECT * FROM + jsonb_populate_recordset(null::record, '[{"x": 776}]') AS (x int, y int); + +-- empty array is a corner case +SELECT jsonb_populate_recordset(null::record, '[]'); +SELECT jsonb_populate_recordset(row(1,2), '[]'); +SELECT * FROM jsonb_populate_recordset(NULL::jbpop,'[]') q; +SELECT * FROM + jsonb_populate_recordset(null::record, '[]') AS (x int, y int); + +-- composite domain +SELECT jsonb_populate_recordset(null::jb_ordered_pair, '[{"x": 0, "y": 1}]'); +SELECT jsonb_populate_recordset(row(1,2)::jb_ordered_pair, '[{"x": 0}, {"y": 3}]'); +SELECT jsonb_populate_recordset(row(1,2)::jb_ordered_pair, '[{"x": 1, "y": 0}]'); + +-- negative cases where the wrong record type is supplied +select * from jsonb_populate_recordset(row(0::int),'[{"a":"1","b":"2"},{"a":"3"}]') q (a text, b text); +select * from jsonb_populate_recordset(row(0::int,0::int),'[{"a":"1","b":"2"},{"a":"3"}]') q (a text, b text); +select * from jsonb_populate_recordset(row(0::int,0::int,0::int),'[{"a":"1","b":"2"},{"a":"3"}]') q (a text, b text); +select * from jsonb_populate_recordset(row(1000000000::int,50::int),'[{"b":"2"},{"a":"3"}]') q (a text, b text); + +-- jsonb_to_record and jsonb_to_recordset + +select * from jsonb_to_record('{"a":1,"b":"foo","c":"bar"}') + as x(a int, b text, d text); + +select * from jsonb_to_recordset('[{"a":1,"b":"foo","d":false},{"a":2,"b":"bar","c":true}]') + as x(a int, b text, c boolean); + +select *, c is null as c_is_null +from jsonb_to_record('{"a":1, "b":{"c":16, "d":2}, "x":8, "ca": ["1 2", 3], "ia": [[1,2],[3,4]], "r": {"a": "aaa", "b": 123}}'::jsonb) + as t(a int, b jsonb, c text, x int, ca char(5)[], ia int[][], r jbpop); + +select *, c is null as c_is_null +from jsonb_to_recordset('[{"a":1, "b":{"c":16, "d":2}, "x":8}]'::jsonb) + as t(a int, b jsonb, c text, x int); + +select * from jsonb_to_record('{"ia": null}') as x(ia _int4); +select * from jsonb_to_record('{"ia": 123}') as x(ia _int4); +select * from jsonb_to_record('{"ia": [1, "2", null, 4]}') as x(ia _int4); +select * from jsonb_to_record('{"ia": [[1, 2], [3, 4]]}') as x(ia _int4); +select * from jsonb_to_record('{"ia": [[1], 2]}') as x(ia _int4); +select * from jsonb_to_record('{"ia": [[1], [2, 3]]}') as x(ia _int4); + +select * from jsonb_to_record('{"ia2": [1, 2, 3]}') as x(ia2 int[][]); +select * from jsonb_to_record('{"ia2": [[1, 2], [3, 4]]}') as x(ia2 int4[][]); +select * from jsonb_to_record('{"ia2": [[[1], [2], [3]]]}') as x(ia2 int4[][]); + +select * from jsonb_to_record('{"out": {"key": 1}}') as x(out json); +select * from jsonb_to_record('{"out": [{"key": 1}]}') as x(out json); +select * from jsonb_to_record('{"out": "{\"key\": 1}"}') as x(out json); +select * from jsonb_to_record('{"out": {"key": 1}}') as x(out jsonb); +select * from jsonb_to_record('{"out": [{"key": 1}]}') as x(out jsonb); +select * from jsonb_to_record('{"out": "{\"key\": 1}"}') as x(out jsonb); + +-- test type info caching in jsonb_populate_record() +CREATE TEMP TABLE jsbpoptest (js jsonb); + +INSERT INTO jsbpoptest +SELECT '{ + "jsa": [1, "2", null, 4], + "rec": {"a": "abc", "c": "01.02.2003", "x": 43.2}, + "reca": [{"a": "abc", "b": 456}, null, {"c": "01.02.2003", "x": 43.2}] +}'::jsonb +FROM generate_series(1, 3); + +SELECT (jsonb_populate_record(NULL::jsbrec, js)).* FROM jsbpoptest; + +DROP TYPE jsbrec; +DROP TYPE jsbrec_i_not_null; +DROP DOMAIN jsb_int_not_null; +DROP DOMAIN jsb_int_array_1d; +DROP DOMAIN jsb_int_array_2d; +DROP DOMAIN jb_ordered_pair; +DROP TYPE jb_unordered_pair; + +-- indexing +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":null}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":"CC"}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":"CC", "public":true}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"age":25}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"age":25.0}'; +SELECT count(*) FROM testjsonb WHERE j ? 'public'; +SELECT count(*) FROM testjsonb WHERE j ? 'bar'; +SELECT count(*) FROM testjsonb WHERE j ?| ARRAY['public','disabled']; +SELECT count(*) FROM testjsonb WHERE j ?& ARRAY['public','disabled']; +SELECT count(*) FROM testjsonb WHERE j @@ '$.wait == null'; +SELECT count(*) FROM testjsonb WHERE j @@ '"CC" == $.wait'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.wait == "CC" && true == $.public'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.age == 25'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.age == 25.0'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($)'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.public)'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.bar)'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.public) || exists($.disabled)'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.public) && exists($.disabled)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.wait ? (@ == null)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.wait ? ("CC" == @)'; +SELECT count(*) FROM testjsonb WHERE j @? '$ ? (@.wait == "CC" && true == @.public)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.age ? (@ == 25)'; +SELECT count(*) FROM testjsonb WHERE j @? '$ ? (@.age == 25.0)'; +SELECT count(*) FROM testjsonb WHERE j @? '$'; +SELECT count(*) FROM testjsonb WHERE j @? '$.public'; +SELECT count(*) FROM testjsonb WHERE j @? '$.bar'; + +CREATE INDEX jidx ON testjsonb USING gin (j); +SET enable_seqscan = off; + +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":null}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":"CC"}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":"CC", "public":true}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"age":25}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"age":25.0}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"array":["foo"]}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"array":["bar"]}'; +-- exercise GIN_SEARCH_MODE_ALL +SELECT count(*) FROM testjsonb WHERE j @> '{}'; +SELECT count(*) FROM testjsonb WHERE j ? 'public'; +SELECT count(*) FROM testjsonb WHERE j ? 'bar'; +SELECT count(*) FROM testjsonb WHERE j ?| ARRAY['public','disabled']; +SELECT count(*) FROM testjsonb WHERE j ?& ARRAY['public','disabled']; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM testjsonb WHERE j @@ '$.wait == null'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.wait == null'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($ ? (@.wait == null))'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.wait ? (@ == null))'; +SELECT count(*) FROM testjsonb WHERE j @@ '"CC" == $.wait'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.wait == "CC" && true == $.public'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.age == 25'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.age == 25.0'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.array[*] == "foo"'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.array[*] == "bar"'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($ ? (@.array[*] == "bar"))'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.array ? (@[*] == "bar"))'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.array[*] ? (@ == "bar"))'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($)'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.public)'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.bar)'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.public) || exists($.disabled)'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.public) && exists($.disabled)'; +EXPLAIN (COSTS OFF) +SELECT count(*) FROM testjsonb WHERE j @? '$.wait ? (@ == null)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.wait ? (@ == null)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.wait ? ("CC" == @)'; +SELECT count(*) FROM testjsonb WHERE j @? '$ ? (@.wait == "CC" && true == @.public)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.age ? (@ == 25)'; +SELECT count(*) FROM testjsonb WHERE j @? '$ ? (@.age == 25.0)'; +SELECT count(*) FROM testjsonb WHERE j @? '$ ? (@.array[*] == "bar")'; +SELECT count(*) FROM testjsonb WHERE j @? '$.array ? (@[*] == "bar")'; +SELECT count(*) FROM testjsonb WHERE j @? '$.array[*] ? (@ == "bar")'; +SELECT count(*) FROM testjsonb WHERE j @? '$'; +SELECT count(*) FROM testjsonb WHERE j @? '$.public'; +SELECT count(*) FROM testjsonb WHERE j @? '$.bar'; + +-- array exists - array elements should behave as keys (for GIN index scans too) +CREATE INDEX jidx_array ON testjsonb USING gin((j->'array')); +SELECT count(*) from testjsonb WHERE j->'array' ? 'bar'; +-- type sensitive array exists - should return no rows (since "exists" only +-- matches strings that are either object keys or array elements) +SELECT count(*) from testjsonb WHERE j->'array' ? '5'::text; +-- However, a raw scalar is *contained* within the array +SELECT count(*) from testjsonb WHERE j->'array' @> '5'::jsonb; + +RESET enable_seqscan; + +SELECT count(*) FROM (SELECT (jsonb_each(j)).key FROM testjsonb) AS wow; +SELECT key, count(*) FROM (SELECT (jsonb_each(j)).key FROM testjsonb) AS wow GROUP BY key ORDER BY count DESC, key; + +-- sort/hash +SELECT count(distinct j) FROM testjsonb; +SET enable_hashagg = off; +SELECT count(*) FROM (SELECT j FROM (SELECT * FROM testjsonb UNION ALL SELECT * FROM testjsonb) js GROUP BY j) js2; +SET enable_hashagg = on; +SET enable_sort = off; +SELECT count(*) FROM (SELECT j FROM (SELECT * FROM testjsonb UNION ALL SELECT * FROM testjsonb) js GROUP BY j) js2; +SELECT distinct * FROM (values (jsonb '{}' || ''::text),('{}')) v(j); +SET enable_sort = on; + +RESET enable_hashagg; +RESET enable_sort; + +DROP INDEX jidx; +DROP INDEX jidx_array; +-- btree +CREATE INDEX jidx ON testjsonb USING btree (j); +SET enable_seqscan = off; + +SELECT count(*) FROM testjsonb WHERE j > '{"p":1}'; +SELECT count(*) FROM testjsonb WHERE j = '{"pos":98, "line":371, "node":"CBA", "indexed":true}'; + +--gin path opclass +DROP INDEX jidx; +CREATE INDEX jidx ON testjsonb USING gin (j jsonb_path_ops); +SET enable_seqscan = off; + +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":null}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":"CC"}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"wait":"CC", "public":true}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"age":25}'; +SELECT count(*) FROM testjsonb WHERE j @> '{"age":25.0}'; +-- exercise GIN_SEARCH_MODE_ALL +SELECT count(*) FROM testjsonb WHERE j @> '{}'; + +SELECT count(*) FROM testjsonb WHERE j @@ '$.wait == null'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($ ? (@.wait == null))'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.wait ? (@ == null))'; +SELECT count(*) FROM testjsonb WHERE j @@ '"CC" == $.wait'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.wait == "CC" && true == $.public'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.age == 25'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.age == 25.0'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.array[*] == "foo"'; +SELECT count(*) FROM testjsonb WHERE j @@ '$.array[*] == "bar"'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($ ? (@.array[*] == "bar"))'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.array ? (@[*] == "bar"))'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($.array[*] ? (@ == "bar"))'; +SELECT count(*) FROM testjsonb WHERE j @@ 'exists($)'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM testjsonb WHERE j @? '$.wait ? (@ == null)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.wait ? (@ == null)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.wait ? ("CC" == @)'; +SELECT count(*) FROM testjsonb WHERE j @? '$ ? (@.wait == "CC" && true == @.public)'; +SELECT count(*) FROM testjsonb WHERE j @? '$.age ? (@ == 25)'; +SELECT count(*) FROM testjsonb WHERE j @? '$ ? (@.age == 25.0)'; +SELECT count(*) FROM testjsonb WHERE j @? '$ ? (@.array[*] == "bar")'; +SELECT count(*) FROM testjsonb WHERE j @? '$.array ? (@[*] == "bar")'; +SELECT count(*) FROM testjsonb WHERE j @? '$.array[*] ? (@ == "bar")'; +SELECT count(*) FROM testjsonb WHERE j @? '$'; +SELECT count(*) FROM testjsonb WHERE j @? '$.public'; +SELECT count(*) FROM testjsonb WHERE j @? '$.bar'; + +RESET enable_seqscan; +DROP INDEX jidx; + +-- nested tests +SELECT '{"ff":{"a":12,"b":16}}'::jsonb; +SELECT '{"ff":{"a":12,"b":16},"qq":123}'::jsonb; +SELECT '{"aa":["a","aaa"],"qq":{"a":12,"b":16,"c":["c1","c2"],"d":{"d1":"d1","d2":"d2","d1":"d3"}}}'::jsonb; +SELECT '{"aa":["a","aaa"],"qq":{"a":"12","b":"16","c":["c1","c2"],"d":{"d1":"d1","d2":"d2"}}}'::jsonb; +SELECT '{"aa":["a","aaa"],"qq":{"a":"12","b":"16","c":["c1","c2",["c3"],{"c4":4}],"d":{"d1":"d1","d2":"d2"}}}'::jsonb; +SELECT '{"ff":["a","aaa"]}'::jsonb; + +SELECT + '{"ff":{"a":12,"b":16},"qq":123,"x":[1,2],"Y":null}'::jsonb -> 'ff', + '{"ff":{"a":12,"b":16},"qq":123,"x":[1,2],"Y":null}'::jsonb -> 'qq', + ('{"ff":{"a":12,"b":16},"qq":123,"x":[1,2],"Y":null}'::jsonb -> 'Y') IS NULL AS f, + ('{"ff":{"a":12,"b":16},"qq":123,"x":[1,2],"Y":null}'::jsonb ->> 'Y') IS NULL AS t, + '{"ff":{"a":12,"b":16},"qq":123,"x":[1,2],"Y":null}'::jsonb -> 'x'; + +-- nested containment +SELECT '{"a":[1,2],"c":"b"}'::jsonb @> '{"a":[1,2]}'; +SELECT '{"a":[2,1],"c":"b"}'::jsonb @> '{"a":[1,2]}'; +SELECT '{"a":{"1":2},"c":"b"}'::jsonb @> '{"a":[1,2]}'; +SELECT '{"a":{"2":1},"c":"b"}'::jsonb @> '{"a":[1,2]}'; +SELECT '{"a":{"1":2},"c":"b"}'::jsonb @> '{"a":{"1":2}}'; +SELECT '{"a":{"2":1},"c":"b"}'::jsonb @> '{"a":{"1":2}}'; +SELECT '["a","b"]'::jsonb @> '["a","b","c","b"]'; +SELECT '["a","b","c","b"]'::jsonb @> '["a","b"]'; +SELECT '["a","b","c",[1,2]]'::jsonb @> '["a",[1,2]]'; +SELECT '["a","b","c",[1,2]]'::jsonb @> '["b",[1,2]]'; + +SELECT '{"a":[1,2],"c":"b"}'::jsonb @> '{"a":[1]}'; +SELECT '{"a":[1,2],"c":"b"}'::jsonb @> '{"a":[2]}'; +SELECT '{"a":[1,2],"c":"b"}'::jsonb @> '{"a":[3]}'; + +SELECT '{"a":[1,2,{"c":3,"x":4}],"c":"b"}'::jsonb @> '{"a":[{"c":3}]}'; +SELECT '{"a":[1,2,{"c":3,"x":4}],"c":"b"}'::jsonb @> '{"a":[{"x":4}]}'; +SELECT '{"a":[1,2,{"c":3,"x":4}],"c":"b"}'::jsonb @> '{"a":[{"x":4},3]}'; +SELECT '{"a":[1,2,{"c":3,"x":4}],"c":"b"}'::jsonb @> '{"a":[{"x":4},1]}'; + +-- check some corner cases for indexed nested containment (bug #13756) +create temp table nestjsonb (j jsonb); +insert into nestjsonb (j) values ('{"a":[["b",{"x":1}],["b",{"x":2}]],"c":3}'); +insert into nestjsonb (j) values ('[[14,2,3]]'); +insert into nestjsonb (j) values ('[1,[14,2,3]]'); +create index on nestjsonb using gin(j jsonb_path_ops); + +set enable_seqscan = on; +set enable_bitmapscan = off; +select * from nestjsonb where j @> '{"a":[[{"x":2}]]}'::jsonb; +select * from nestjsonb where j @> '{"c":3}'; +select * from nestjsonb where j @> '[[14]]'; +set enable_seqscan = off; +set enable_bitmapscan = on; +select * from nestjsonb where j @> '{"a":[[{"x":2}]]}'::jsonb; +select * from nestjsonb where j @> '{"c":3}'; +select * from nestjsonb where j @> '[[14]]'; +reset enable_seqscan; +reset enable_bitmapscan; + +-- nested object field / array index lookup +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb -> 'n'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb -> 'a'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb -> 'b'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb -> 'c'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb -> 'd'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb -> 'd' -> '1'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb -> 'e'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb -> 0; --expecting error + +SELECT '["a","b","c",[1,2],null]'::jsonb -> 0; +SELECT '["a","b","c",[1,2],null]'::jsonb -> 1; +SELECT '["a","b","c",[1,2],null]'::jsonb -> 2; +SELECT '["a","b","c",[1,2],null]'::jsonb -> 3; +SELECT '["a","b","c",[1,2],null]'::jsonb -> 3 -> 1; +SELECT '["a","b","c",[1,2],null]'::jsonb -> 4; +SELECT '["a","b","c",[1,2],null]'::jsonb -> 5; +SELECT '["a","b","c",[1,2],null]'::jsonb -> -1; +SELECT '["a","b","c",[1,2],null]'::jsonb -> -5; +SELECT '["a","b","c",[1,2],null]'::jsonb -> -6; + +--nested path extraction +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{0}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{a}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{c}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{c,0}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{c,1}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{c,2}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{c,3}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{c,-1}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{c,-3}'; +SELECT '{"a":"b","c":[1,2,3]}'::jsonb #> '{c,-4}'; + +SELECT '[0,1,2,[3,4],{"5":"five"}]'::jsonb #> '{0}'; +SELECT '[0,1,2,[3,4],{"5":"five"}]'::jsonb #> '{3}'; +SELECT '[0,1,2,[3,4],{"5":"five"}]'::jsonb #> '{4}'; +SELECT '[0,1,2,[3,4],{"5":"five"}]'::jsonb #> '{4,5}'; + +--nested exists +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb ? 'n'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb ? 'a'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb ? 'b'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb ? 'c'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb ? 'd'; +SELECT '{"n":null,"a":1,"b":[1,2],"c":{"1":2},"d":{"1":[2,3]}}'::jsonb ? 'e'; + +-- jsonb_strip_nulls + +select jsonb_strip_nulls(null); + +select jsonb_strip_nulls('1'); + +select jsonb_strip_nulls('"a string"'); + +select jsonb_strip_nulls('null'); + +select jsonb_strip_nulls('[1,2,null,3,4]'); + +select jsonb_strip_nulls('{"a":1,"b":null,"c":[2,null,3],"d":{"e":4,"f":null}}'); + +select jsonb_strip_nulls('[1,{"a":1,"b":null,"c":2},3]'); + +-- an empty object is not null and should not be stripped +select jsonb_strip_nulls('{"a": {"b": null, "c": null}, "d": {} }'); + + +select jsonb_pretty('{"a": "test", "b": [1, 2, 3], "c": "test3", "d":{"dd": "test4", "dd2":{"ddd": "test5"}}}'); +select jsonb_pretty('[{"f1":1,"f2":null},2,null,[[{"x":true},6,7],8],3]'); +select jsonb_pretty('{"a":["b", "c"], "d": {"e":"f"}}'); + +select jsonb_concat('{"d": "test", "a": [1, 2]}', '{"g": "test2", "c": {"c1":1, "c2":2}}'); + +select '{"aa":1 , "b":2, "cq":3}'::jsonb || '{"cq":"l", "b":"g", "fg":false}'; +select '{"aa":1 , "b":2, "cq":3}'::jsonb || '{"aq":"l"}'; +select '{"aa":1 , "b":2, "cq":3}'::jsonb || '{"aa":"l"}'; +select '{"aa":1 , "b":2, "cq":3}'::jsonb || '{}'; + +select '["a", "b"]'::jsonb || '["c"]'; +select '["a", "b"]'::jsonb || '["c", "d"]'; +select '["c"]' || '["a", "b"]'::jsonb; + +select '["a", "b"]'::jsonb || '"c"'; +select '"c"' || '["a", "b"]'::jsonb; + +select '[]'::jsonb || '["a"]'::jsonb; +select '[]'::jsonb || '"a"'::jsonb; +select '"b"'::jsonb || '"a"'::jsonb; +select '{}'::jsonb || '{"a":"b"}'::jsonb; +select '[]'::jsonb || '{"a":"b"}'::jsonb; +select '{"a":"b"}'::jsonb || '[]'::jsonb; + +select '"a"'::jsonb || '{"a":1}'; +select '{"a":1}' || '"a"'::jsonb; + +select '["a", "b"]'::jsonb || '{"c":1}'; +select '{"c": 1}'::jsonb || '["a", "b"]'; + +select '{}'::jsonb || '{"cq":"l", "b":"g", "fg":false}'; + +select pg_column_size('{}'::jsonb || '{}'::jsonb) = pg_column_size('{}'::jsonb); +select pg_column_size('{"aa":1}'::jsonb || '{"b":2}'::jsonb) = pg_column_size('{"aa":1, "b":2}'::jsonb); +select pg_column_size('{"aa":1, "b":2}'::jsonb || '{}'::jsonb) = pg_column_size('{"aa":1, "b":2}'::jsonb); +select pg_column_size('{}'::jsonb || '{"aa":1, "b":2}'::jsonb) = pg_column_size('{"aa":1, "b":2}'::jsonb); + +select jsonb_delete('{"a":1 , "b":2, "c":3}'::jsonb, 'a'); +select jsonb_delete('{"a":null , "b":2, "c":3}'::jsonb, 'a'); +select jsonb_delete('{"a":1 , "b":2, "c":3}'::jsonb, 'b'); +select jsonb_delete('{"a":1 , "b":2, "c":3}'::jsonb, 'c'); +select jsonb_delete('{"a":1 , "b":2, "c":3}'::jsonb, 'd'); +select '{"a":1 , "b":2, "c":3}'::jsonb - 'a'; +select '{"a":null , "b":2, "c":3}'::jsonb - 'a'; +select '{"a":1 , "b":2, "c":3}'::jsonb - 'b'; +select '{"a":1 , "b":2, "c":3}'::jsonb - 'c'; +select '{"a":1 , "b":2, "c":3}'::jsonb - 'd'; +select pg_column_size('{"a":1 , "b":2, "c":3}'::jsonb - 'b') = pg_column_size('{"a":1, "b":2}'::jsonb); + +select '["a","b","c"]'::jsonb - 3; +select '["a","b","c"]'::jsonb - 2; +select '["a","b","c"]'::jsonb - 1; +select '["a","b","c"]'::jsonb - 0; +select '["a","b","c"]'::jsonb - -1; +select '["a","b","c"]'::jsonb - -2; +select '["a","b","c"]'::jsonb - -3; +select '["a","b","c"]'::jsonb - -4; + +select '{"a":1 , "b":2, "c":3}'::jsonb - '{b}'::text[]; +select '{"a":1 , "b":2, "c":3}'::jsonb - '{c,b}'::text[]; +select '{"a":1 , "b":2, "c":3}'::jsonb - '{}'::text[]; + +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{n}', '[1,2,3]'); +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{b,-1}', '[1,2,3]'); +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{d,1,0}', '[1,2,3]'); +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{d,NULL,0}', '[1,2,3]'); + +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{n}', '{"1": 2}'); +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{b,-1}', '{"1": 2}'); +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{d,1,0}', '{"1": 2}'); +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{d,NULL,0}', '{"1": 2}'); + +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{b,-1}', '"test"'); +select jsonb_set('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb, '{b,-1}', '{"f": "test"}'); + +select jsonb_delete_path('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}', '{n}'); +select jsonb_delete_path('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}', '{b,-1}'); +select jsonb_delete_path('{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}', '{d,1,0}'); + +select '{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb #- '{n}'; +select '{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb #- '{b,-1}'; +select '{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb #- '{b,-1e}'; -- invalid array subscript +select '{"n":null, "a":1, "b":[1,2], "c":{"1":2}, "d":{"1":[2,3]}}'::jsonb #- '{d,1,0}'; + + +-- empty structure and error conditions for delete and replace + +select '"a"'::jsonb - 'a'; -- error +select '{}'::jsonb - 'a'; +select '[]'::jsonb - 'a'; +select '"a"'::jsonb - 1; -- error +select '{}'::jsonb - 1; -- error +select '[]'::jsonb - 1; +select '"a"'::jsonb #- '{a}'; -- error +select '{}'::jsonb #- '{a}'; +select '[]'::jsonb #- '{a}'; +select jsonb_set('"a"','{a}','"b"'); --error +select jsonb_set('{}','{a}','"b"', false); +select jsonb_set('[]','{1}','"b"', false); +select jsonb_set('[{"f1":1,"f2":null},2,null,3]', '{0}','[2,3,4]', false); + +-- jsonb_set adding instead of replacing + +-- prepend to array +select jsonb_set('{"a":1,"b":[0,1,2],"c":{"d":4}}','{b,-33}','{"foo":123}'); +-- append to array +select jsonb_set('{"a":1,"b":[0,1,2],"c":{"d":4}}','{b,33}','{"foo":123}'); +-- check nesting levels addition +select jsonb_set('{"a":1,"b":[4,5,[0,1,2],6,7],"c":{"d":4}}','{b,2,33}','{"foo":123}'); +-- add new key +select jsonb_set('{"a":1,"b":[0,1,2],"c":{"d":4}}','{c,e}','{"foo":123}'); +-- adding doesn't do anything if elements before last aren't present +select jsonb_set('{"a":1,"b":[0,1,2],"c":{"d":4}}','{x,-33}','{"foo":123}'); +select jsonb_set('{"a":1,"b":[0,1,2],"c":{"d":4}}','{x,y}','{"foo":123}'); +-- add to empty object +select jsonb_set('{}','{x}','{"foo":123}'); +--add to empty array +select jsonb_set('[]','{0}','{"foo":123}'); +select jsonb_set('[]','{99}','{"foo":123}'); +select jsonb_set('[]','{-99}','{"foo":123}'); +select jsonb_set('{"a": [1, 2, 3]}', '{a, non_integer}', '"new_value"'); +select jsonb_set('{"a": {"b": [1, 2, 3]}}', '{a, b, non_integer}', '"new_value"'); +select jsonb_set('{"a": {"b": [1, 2, 3]}}', '{a, b, NULL}', '"new_value"'); + +-- jsonb_set_lax + +\pset null NULL + +-- pass though non nulls to jsonb_set +select jsonb_set_lax('{"a":1,"b":2}','{b}','5') ; +select jsonb_set_lax('{"a":1,"b":2}','{d}','6', true) ; +-- using the default treatment +select jsonb_set_lax('{"a":1,"b":2}','{b}',null); +select jsonb_set_lax('{"a":1,"b":2}','{d}',null,true); +-- errors +select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, true, null); +select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, true, 'no_such_treatment'); +-- explicit treatments +select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, null_value_treatment => 'raise_exception') as raise_exception; +select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, null_value_treatment => 'return_target') as return_target; +select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, null_value_treatment => 'delete_key') as delete_key; +select jsonb_set_lax('{"a":1,"b":2}', '{b}', null, null_value_treatment => 'use_json_null') as use_json_null; + +\pset null + +-- jsonb_insert +select jsonb_insert('{"a": [0,1,2]}', '{a, 1}', '"new_value"'); +select jsonb_insert('{"a": [0,1,2]}', '{a, 1}', '"new_value"', true); +select jsonb_insert('{"a": {"b": {"c": [0, 1, "test1", "test2"]}}}', '{a, b, c, 2}', '"new_value"'); +select jsonb_insert('{"a": {"b": {"c": [0, 1, "test1", "test2"]}}}', '{a, b, c, 2}', '"new_value"', true); +select jsonb_insert('{"a": [0,1,2]}', '{a, 1}', '{"b": "value"}'); +select jsonb_insert('{"a": [0,1,2]}', '{a, 1}', '["value1", "value2"]'); + +-- edge cases +select jsonb_insert('{"a": [0,1,2]}', '{a, 0}', '"new_value"'); +select jsonb_insert('{"a": [0,1,2]}', '{a, 0}', '"new_value"', true); +select jsonb_insert('{"a": [0,1,2]}', '{a, 2}', '"new_value"'); +select jsonb_insert('{"a": [0,1,2]}', '{a, 2}', '"new_value"', true); +select jsonb_insert('{"a": [0,1,2]}', '{a, -1}', '"new_value"'); +select jsonb_insert('{"a": [0,1,2]}', '{a, -1}', '"new_value"', true); +select jsonb_insert('[]', '{1}', '"new_value"'); +select jsonb_insert('[]', '{1}', '"new_value"', true); +select jsonb_insert('{"a": []}', '{a, 1}', '"new_value"'); +select jsonb_insert('{"a": []}', '{a, 1}', '"new_value"', true); +select jsonb_insert('{"a": [0,1,2]}', '{a, 10}', '"new_value"'); +select jsonb_insert('{"a": [0,1,2]}', '{a, -10}', '"new_value"'); + +-- jsonb_insert should be able to insert new value for objects, but not to replace +select jsonb_insert('{"a": {"b": "value"}}', '{a, c}', '"new_value"'); +select jsonb_insert('{"a": {"b": "value"}}', '{a, c}', '"new_value"', true); + +select jsonb_insert('{"a": {"b": "value"}}', '{a, b}', '"new_value"'); +select jsonb_insert('{"a": {"b": "value"}}', '{a, b}', '"new_value"', true); + +-- jsonb to tsvector +select to_tsvector('{"a": "aaa bbb ddd ccc", "b": ["eee fff ggg"], "c": {"d": "hhh iii"}}'::jsonb); + +-- jsonb to tsvector with config +select to_tsvector('simple', '{"a": "aaa bbb ddd ccc", "b": ["eee fff ggg"], "c": {"d": "hhh iii"}}'::jsonb); + +-- jsonb to tsvector with stop words +select to_tsvector('english', '{"a": "aaa in bbb ddd ccc", "b": ["the eee fff ggg"], "c": {"d": "hhh. iii"}}'::jsonb); + +-- jsonb to tsvector with numeric values +select to_tsvector('english', '{"a": "aaa in bbb ddd ccc", "b": 123, "c": 456}'::jsonb); + +-- jsonb_to_tsvector +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"all"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"key"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"string"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"numeric"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"boolean"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '["string", "numeric"]'); + +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"all"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"key"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"string"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"numeric"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '"boolean"'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '["string", "numeric"]'); + +-- to_tsvector corner cases +select to_tsvector('""'::jsonb); +select to_tsvector('{}'::jsonb); +select to_tsvector('[]'::jsonb); +select to_tsvector('null'::jsonb); + +-- jsonb_to_tsvector corner cases +select jsonb_to_tsvector('""'::jsonb, '"all"'); +select jsonb_to_tsvector('{}'::jsonb, '"all"'); +select jsonb_to_tsvector('[]'::jsonb, '"all"'); +select jsonb_to_tsvector('null'::jsonb, '"all"'); + +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '""'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '{}'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '[]'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, 'null'); +select jsonb_to_tsvector('english', '{"a": "aaa in bbb", "b": 123, "c": 456, "d": true, "f": false, "g": null}'::jsonb, '["all", null]'); + +-- ts_headline for jsonb +select ts_headline('{"a": "aaa bbb", "b": {"c": "ccc ddd fff", "c1": "ccc1 ddd1"}, "d": ["ggg hhh", "iii jjj"]}'::jsonb, tsquery('bbb & ddd & hhh')); +select ts_headline('english', '{"a": "aaa bbb", "b": {"c": "ccc ddd fff"}, "d": ["ggg hhh", "iii jjj"]}'::jsonb, tsquery('bbb & ddd & hhh')); +select ts_headline('{"a": "aaa bbb", "b": {"c": "ccc ddd fff", "c1": "ccc1 ddd1"}, "d": ["ggg hhh", "iii jjj"]}'::jsonb, tsquery('bbb & ddd & hhh'), 'StartSel = <, StopSel = >'); +select ts_headline('english', '{"a": "aaa bbb", "b": {"c": "ccc ddd fff", "c1": "ccc1 ddd1"}, "d": ["ggg hhh", "iii jjj"]}'::jsonb, tsquery('bbb & ddd & hhh'), 'StartSel = <, StopSel = >'); + +-- corner cases for ts_headline with jsonb +select ts_headline('null'::jsonb, tsquery('aaa & bbb')); +select ts_headline('{}'::jsonb, tsquery('aaa & bbb')); +select ts_headline('[]'::jsonb, tsquery('aaa & bbb')); + +-- casts +select 'true'::jsonb::bool; +select '[]'::jsonb::bool; +select '1.0'::jsonb::float; +select '[1.0]'::jsonb::float; +select '12345'::jsonb::int4; +select '"hello"'::jsonb::int4; +select '12345'::jsonb::numeric; +select '{}'::jsonb::numeric; +select '12345.05'::jsonb::numeric; +select '12345.05'::jsonb::float4; +select '12345.05'::jsonb::float8; +select '12345.05'::jsonb::int2; +select '12345.05'::jsonb::int4; +select '12345.05'::jsonb::int8; +select '12345.0000000000000000000000000000000000000000000005'::jsonb::numeric; +select '12345.0000000000000000000000000000000000000000000005'::jsonb::float4; +select '12345.0000000000000000000000000000000000000000000005'::jsonb::float8; +select '12345.0000000000000000000000000000000000000000000005'::jsonb::int2; +select '12345.0000000000000000000000000000000000000000000005'::jsonb::int4; +select '12345.0000000000000000000000000000000000000000000005'::jsonb::int8; diff --git a/postgresql/examples/jsonb_jsonpath.sql b/postgresql/examples/jsonb_jsonpath.sql new file mode 100644 index 0000000..a50abed --- /dev/null +++ b/postgresql/examples/jsonb_jsonpath.sql @@ -0,0 +1,581 @@ +select jsonb '{"a": 12}' @? '$'; +select jsonb '{"a": 12}' @? '1'; +select jsonb '{"a": 12}' @? '$.a.b'; +select jsonb '{"a": 12}' @? '$.b'; +select jsonb '{"a": 12}' @? '$.a + 2'; +select jsonb '{"a": 12}' @? '$.b + 2'; +select jsonb '{"a": {"a": 12}}' @? '$.a.a'; +select jsonb '{"a": {"a": 12}}' @? '$.*.a'; +select jsonb '{"b": {"a": 12}}' @? '$.*.a'; +select jsonb '{"b": {"a": 12}}' @? '$.*.b'; +select jsonb '{"b": {"a": 12}}' @? 'strict $.*.b'; +select jsonb '{}' @? '$.*'; +select jsonb '{"a": 1}' @? '$.*'; +select jsonb '{"a": {"b": 1}}' @? 'lax $.**{1}'; +select jsonb '{"a": {"b": 1}}' @? 'lax $.**{2}'; +select jsonb '{"a": {"b": 1}}' @? 'lax $.**{3}'; +select jsonb '[]' @? '$[*]'; +select jsonb '[1]' @? '$[*]'; +select jsonb '[1]' @? '$[1]'; +select jsonb '[1]' @? 'strict $[1]'; +select jsonb_path_query('[1]', 'strict $[1]'); +select jsonb_path_query('[1]', 'strict $[1]', silent => true); +select jsonb '[1]' @? 'lax $[10000000000000000]'; +select jsonb '[1]' @? 'strict $[10000000000000000]'; +select jsonb_path_query('[1]', 'lax $[10000000000000000]'); +select jsonb_path_query('[1]', 'strict $[10000000000000000]'); +select jsonb '[1]' @? '$[0]'; +select jsonb '[1]' @? '$[0.3]'; +select jsonb '[1]' @? '$[0.5]'; +select jsonb '[1]' @? '$[0.9]'; +select jsonb '[1]' @? '$[1.2]'; +select jsonb '[1]' @? 'strict $[1.2]'; +select jsonb '{"a": [1,2,3], "b": [3,4,5]}' @? '$ ? (@.a[*] > @.b[*])'; +select jsonb '{"a": [1,2,3], "b": [3,4,5]}' @? '$ ? (@.a[*] >= @.b[*])'; +select jsonb '{"a": [1,2,3], "b": [3,4,"5"]}' @? '$ ? (@.a[*] >= @.b[*])'; +select jsonb '{"a": [1,2,3], "b": [3,4,"5"]}' @? 'strict $ ? (@.a[*] >= @.b[*])'; +select jsonb '{"a": [1,2,3], "b": [3,4,null]}' @? '$ ? (@.a[*] >= @.b[*])'; +select jsonb '1' @? '$ ? ((@ == "1") is unknown)'; +select jsonb '1' @? '$ ? ((@ == 1) is unknown)'; +select jsonb '[{"a": 1}, {"a": 2}]' @? '$[0 to 1] ? (@.a > 1)'; + +select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'lax $[*].a', silent => false); +select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'lax $[*].a', silent => true); +select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'strict $[*].a', silent => false); +select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'strict $[*].a', silent => true); + +select jsonb_path_query('1', 'lax $.a'); +select jsonb_path_query('1', 'strict $.a'); +select jsonb_path_query('1', 'strict $.*'); +select jsonb_path_query('1', 'strict $.a', silent => true); +select jsonb_path_query('1', 'strict $.*', silent => true); +select jsonb_path_query('[]', 'lax $.a'); +select jsonb_path_query('[]', 'strict $.a'); +select jsonb_path_query('[]', 'strict $.a', silent => true); +select jsonb_path_query('{}', 'lax $.a'); +select jsonb_path_query('{}', 'strict $.a'); +select jsonb_path_query('{}', 'strict $.a', silent => true); + +select jsonb_path_query('1', 'strict $[1]'); +select jsonb_path_query('1', 'strict $[*]'); +select jsonb_path_query('[]', 'strict $[1]'); +select jsonb_path_query('[]', 'strict $["a"]'); +select jsonb_path_query('1', 'strict $[1]', silent => true); +select jsonb_path_query('1', 'strict $[*]', silent => true); +select jsonb_path_query('[]', 'strict $[1]', silent => true); +select jsonb_path_query('[]', 'strict $["a"]', silent => true); + +select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.a'); +select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.b'); +select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.*'); +select jsonb_path_query('{"a": 12, "b": {"a": 13}}', 'lax $.*.a'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[*].a'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[*].*'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0].a'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[1].a'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[2].a'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0,1].a'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0 to 10].a'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0 to 10 / 0].a'); +select jsonb_path_query('[12, {"a": 13}, {"b": 14}, "ccc", true]', '$[2.5 - 1 to $.size() - 2]'); +select jsonb_path_query('1', 'lax $[0]'); +select jsonb_path_query('1', 'lax $[*]'); +select jsonb_path_query('[1]', 'lax $[0]'); +select jsonb_path_query('[1]', 'lax $[*]'); +select jsonb_path_query('[1,2,3]', 'lax $[*]'); +select jsonb_path_query('[1,2,3]', 'strict $[*].a'); +select jsonb_path_query('[1,2,3]', 'strict $[*].a', silent => true); +select jsonb_path_query('[]', '$[last]'); +select jsonb_path_query('[]', '$[last ? (exists(last))]'); +select jsonb_path_query('[]', 'strict $[last]'); +select jsonb_path_query('[]', 'strict $[last]', silent => true); +select jsonb_path_query('[1]', '$[last]'); +select jsonb_path_query('[1,2,3]', '$[last]'); +select jsonb_path_query('[1,2,3]', '$[last - 1]'); +select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "number")]'); +select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "string")]'); +select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "string")]', silent => true); + +select * from jsonb_path_query('{"a": 10}', '$'); +select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)'); +select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '1'); +select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '[{"value" : 13}]'); +select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '{"value" : 13}'); +select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '{"value" : 8}'); +select * from jsonb_path_query('{"a": 10}', '$.a ? (@ < $value)', '{"value" : 13}'); +select * from jsonb_path_query('[10,11,12,13,14,15]', '$[*] ? (@ < $value)', '{"value" : 13}'); +select * from jsonb_path_query('[10,11,12,13,14,15]', '$[0,1] ? (@ < $x.value)', '{"x": {"value" : 13}}'); +select * from jsonb_path_query('[10,11,12,13,14,15]', '$[0 to 2] ? (@ < $value)', '{"value" : 15}'); +select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == "1")'); +select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == $value)', '{"value" : "1"}'); +select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == $value)', '{"value" : null}'); +select * from jsonb_path_query('[1, "2", null]', '$[*] ? (@ != null)'); +select * from jsonb_path_query('[1, "2", null]', '$[*] ? (@ == null)'); +select * from jsonb_path_query('{}', '$ ? (@ == @)'); +select * from jsonb_path_query('[]', 'strict $ ? (@ == @)'); + +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0}'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0 to last}'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1}'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to last}'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{2}'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{2 to last}'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{3 to last}'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{last}'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0 to last}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to last}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to 2}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{0}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{0 to last}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1 to last}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1 to 2}.b ? (@ > 0)'); +select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{2 to 3}.b ? (@ > 0)'); + +select jsonb '{"a": {"b": 1}}' @? '$.**.b ? ( @ > 0)'; +select jsonb '{"a": {"b": 1}}' @? '$.**{0}.b ? ( @ > 0)'; +select jsonb '{"a": {"b": 1}}' @? '$.**{1}.b ? ( @ > 0)'; +select jsonb '{"a": {"b": 1}}' @? '$.**{0 to last}.b ? ( @ > 0)'; +select jsonb '{"a": {"b": 1}}' @? '$.**{1 to last}.b ? ( @ > 0)'; +select jsonb '{"a": {"b": 1}}' @? '$.**{1 to 2}.b ? ( @ > 0)'; +select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**.b ? ( @ > 0)'; +select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{0}.b ? ( @ > 0)'; +select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1}.b ? ( @ > 0)'; +select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{0 to last}.b ? ( @ > 0)'; +select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1 to last}.b ? ( @ > 0)'; +select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1 to 2}.b ? ( @ > 0)'; +select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{2 to 3}.b ? ( @ > 0)'; + +select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.x))'); +select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.y))'); +select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.x ? (@ >= 2) ))'); +select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? (exists (@.x))'); +select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? (exists (@.x + "3"))'); +select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? ((exists (@.x + "3")) is unknown)'); +select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g[*] ? (exists (@.x))'); +select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g[*] ? ((exists (@.x)) is unknown)'); +select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g ? (exists (@[*].x))'); +select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g ? ((exists (@[*].x)) is unknown)'); + +--test ternary logic +select + x, y, + jsonb_path_query( + '[true, false, null]', + '$[*] ? (@ == true && ($x == true && $y == true) || + @ == false && !($x == true && $y == true) || + @ == null && ($x == true && $y == true) is unknown)', + jsonb_build_object('x', x, 'y', y) + ) as "x && y" +from + (values (jsonb 'true'), ('false'), ('"null"')) x(x), + (values (jsonb 'true'), ('false'), ('"null"')) y(y); + +select + x, y, + jsonb_path_query( + '[true, false, null]', + '$[*] ? (@ == true && ($x == true || $y == true) || + @ == false && !($x == true || $y == true) || + @ == null && ($x == true || $y == true) is unknown)', + jsonb_build_object('x', x, 'y', y) + ) as "x || y" +from + (values (jsonb 'true'), ('false'), ('"null"')) x(x), + (values (jsonb 'true'), ('false'), ('"null"')) y(y); + +select jsonb '{"a": 1, "b":1}' @? '$ ? (@.a == @.b)'; +select jsonb '{"c": {"a": 1, "b":1}}' @? '$ ? (@.a == @.b)'; +select jsonb '{"c": {"a": 1, "b":1}}' @? '$.c ? (@.a == @.b)'; +select jsonb '{"c": {"a": 1, "b":1}}' @? '$.c ? ($.c.a == @.b)'; +select jsonb '{"c": {"a": 1, "b":1}}' @? '$.* ? (@.a == @.b)'; +select jsonb '{"a": 1, "b":1}' @? '$.** ? (@.a == @.b)'; +select jsonb '{"c": {"a": 1, "b":1}}' @? '$.** ? (@.a == @.b)'; + +select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == 1 + 1)'); +select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == (1 + 1))'); +select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == @.b + 1)'); +select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == (@.b + 1))'); +select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == - 1)'; +select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == -1)'; +select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == -@.b)'; +select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == - @.b)'; +select jsonb '{"c": {"a": 0, "b":1}}' @? '$.** ? (@.a == 1 - @.b)'; +select jsonb '{"c": {"a": 2, "b":1}}' @? '$.** ? (@.a == 1 - - @.b)'; +select jsonb '{"c": {"a": 0, "b":1}}' @? '$.** ? (@.a == 1 - +@.b)'; +select jsonb '[1,2,3]' @? '$ ? (+@[*] > +2)'; +select jsonb '[1,2,3]' @? '$ ? (+@[*] > +3)'; +select jsonb '[1,2,3]' @? '$ ? (-@[*] < -2)'; +select jsonb '[1,2,3]' @? '$ ? (-@[*] < -3)'; +select jsonb '1' @? '$ ? ($ > 0)'; + +-- arithmetic errors +select jsonb_path_query('[1,2,0,3]', '$[*] ? (2 / @ > 0)'); +select jsonb_path_query('[1,2,0,3]', '$[*] ? ((2 / @ > 0) is unknown)'); +select jsonb_path_query('0', '1 / $'); +select jsonb_path_query('0', '1 / $ + 2'); +select jsonb_path_query('0', '-(3 + 1 % $)'); +select jsonb_path_query('1', '$ + "2"'); +select jsonb_path_query('[1, 2]', '3 * $'); +select jsonb_path_query('"a"', '-$'); +select jsonb_path_query('[1,"2",3]', '+$'); +select jsonb_path_query('1', '$ + "2"', silent => true); +select jsonb_path_query('[1, 2]', '3 * $', silent => true); +select jsonb_path_query('"a"', '-$', silent => true); +select jsonb_path_query('[1,"2",3]', '+$', silent => true); +select jsonb '["1",2,0,3]' @? '-$[*]'; +select jsonb '[1,"2",0,3]' @? '-$[*]'; +select jsonb '["1",2,0,3]' @? 'strict -$[*]'; +select jsonb '[1,"2",0,3]' @? 'strict -$[*]'; + +-- unwrapping of operator arguments in lax mode +select jsonb_path_query('{"a": [2]}', 'lax $.a * 3'); +select jsonb_path_query('{"a": [2]}', 'lax $.a + 3'); +select jsonb_path_query('{"a": [2, 3, 4]}', 'lax -$.a'); +-- should fail +select jsonb_path_query('{"a": [1, 2]}', 'lax $.a * 3'); +select jsonb_path_query('{"a": [1, 2]}', 'lax $.a * 3', silent => true); + +-- extension: boolean expressions +select jsonb_path_query('2', '$ > 1'); +select jsonb_path_query('2', '$ <= 1'); +select jsonb_path_query('2', '$ == "2"'); +select jsonb '2' @? '$ == "2"'; + +select jsonb '2' @@ '$ > 1'; +select jsonb '2' @@ '$ <= 1'; +select jsonb '2' @@ '$ == "2"'; +select jsonb '2' @@ '1'; +select jsonb '{}' @@ '$'; +select jsonb '[]' @@ '$'; +select jsonb '[1,2,3]' @@ '$[*]'; +select jsonb '[]' @@ '$[*]'; +select jsonb_path_match('[[1, true], [2, false]]', 'strict $[*] ? (@[0] > $x) [1]', '{"x": 1}'); +select jsonb_path_match('[[1, true], [2, false]]', 'strict $[*] ? (@[0] < $x) [1]', '{"x": 2}'); + +select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'lax exists($[*].a)', silent => false); +select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'lax exists($[*].a)', silent => true); +select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'strict exists($[*].a)', silent => false); +select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'strict exists($[*].a)', silent => true); + + +select jsonb_path_query('[null,1,true,"a",[],{}]', '$.type()'); +select jsonb_path_query('[null,1,true,"a",[],{}]', 'lax $.type()'); +select jsonb_path_query('[null,1,true,"a",[],{}]', '$[*].type()'); +select jsonb_path_query('null', 'null.type()'); +select jsonb_path_query('null', 'true.type()'); +select jsonb_path_query('null', '(123).type()'); +select jsonb_path_query('null', '"123".type()'); + +select jsonb_path_query('{"a": 2}', '($.a - 5).abs() + 10'); +select jsonb_path_query('{"a": 2.5}', '-($.a * $.a).floor() % 4.3'); +select jsonb_path_query('[1, 2, 3]', '($[*] > 2) ? (@ == true)'); +select jsonb_path_query('[1, 2, 3]', '($[*] > 3).type()'); +select jsonb_path_query('[1, 2, 3]', '($[*].a > 3).type()'); +select jsonb_path_query('[1, 2, 3]', 'strict ($[*].a > 3).type()'); + +select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'strict $[*].size()'); +select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'strict $[*].size()', silent => true); +select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'lax $[*].size()'); + +select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].abs()'); +select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].floor()'); +select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling()'); +select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling().abs()'); +select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling().abs().type()'); + +select jsonb_path_query('[{},1]', '$[*].keyvalue()'); +select jsonb_path_query('[{},1]', '$[*].keyvalue()', silent => true); +select jsonb_path_query('{}', '$.keyvalue()'); +select jsonb_path_query('{"a": 1, "b": [1, 2], "c": {"a": "bbb"}}', '$.keyvalue()'); +select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', '$[*].keyvalue()'); +select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'strict $.keyvalue()'); +select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'lax $.keyvalue()'); +select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'strict $.keyvalue().a'); +select jsonb '{"a": 1, "b": [1, 2]}' @? 'lax $.keyvalue()'; +select jsonb '{"a": 1, "b": [1, 2]}' @? 'lax $.keyvalue().key'; + +select jsonb_path_query('null', '$.double()'); +select jsonb_path_query('true', '$.double()'); +select jsonb_path_query('null', '$.double()', silent => true); +select jsonb_path_query('true', '$.double()', silent => true); +select jsonb_path_query('[]', '$.double()'); +select jsonb_path_query('[]', 'strict $.double()'); +select jsonb_path_query('{}', '$.double()'); +select jsonb_path_query('[]', 'strict $.double()', silent => true); +select jsonb_path_query('{}', '$.double()', silent => true); +select jsonb_path_query('1.23', '$.double()'); +select jsonb_path_query('"1.23"', '$.double()'); +select jsonb_path_query('"1.23aaa"', '$.double()'); +select jsonb_path_query('1e1000', '$.double()'); +select jsonb_path_query('"nan"', '$.double()'); +select jsonb_path_query('"NaN"', '$.double()'); +select jsonb_path_query('"inf"', '$.double()'); +select jsonb_path_query('"-inf"', '$.double()'); +select jsonb_path_query('"inf"', '$.double()', silent => true); +select jsonb_path_query('"-inf"', '$.double()', silent => true); + +select jsonb_path_query('{}', '$.abs()'); +select jsonb_path_query('true', '$.floor()'); +select jsonb_path_query('"1.2"', '$.ceiling()'); +select jsonb_path_query('{}', '$.abs()', silent => true); +select jsonb_path_query('true', '$.floor()', silent => true); +select jsonb_path_query('"1.2"', '$.ceiling()', silent => true); + +select jsonb_path_query('["", "a", "abc", "abcabc"]', '$[*] ? (@ starts with "abc")'); +select jsonb_path_query('["", "a", "abc", "abcabc"]', 'strict $ ? (@[*] starts with "abc")'); +select jsonb_path_query('["", "a", "abd", "abdabc"]', 'strict $ ? (@[*] starts with "abc")'); +select jsonb_path_query('["abc", "abcabc", null, 1]', 'strict $ ? (@[*] starts with "abc")'); +select jsonb_path_query('["abc", "abcabc", null, 1]', 'strict $ ? ((@[*] starts with "abc") is unknown)'); +select jsonb_path_query('[[null, 1, "abc", "abcabc"]]', 'lax $ ? (@[*] starts with "abc")'); +select jsonb_path_query('[[null, 1, "abd", "abdabc"]]', 'lax $ ? ((@[*] starts with "abc") is unknown)'); +select jsonb_path_query('[null, 1, "abd", "abdabc"]', 'lax $[*] ? ((@ starts with "abc") is unknown)'); + +select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c")'); +select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "i")'); +select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "m")'); +select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "s")'); +select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "a\\b" flag "q")'); +select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "a\\b" flag "")'); +select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\b$" flag "q")'); +select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\B$" flag "q")'); +select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\B$" flag "iq")'); +select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\b$" flag "")'); + +select jsonb_path_query('null', '$.datetime()'); +select jsonb_path_query('true', '$.datetime()'); +select jsonb_path_query('1', '$.datetime()'); +select jsonb_path_query('[]', '$.datetime()'); +select jsonb_path_query('[]', 'strict $.datetime()'); +select jsonb_path_query('{}', '$.datetime()'); +select jsonb_path_query('"bogus"', '$.datetime()'); +select jsonb_path_query('"12:34"', '$.datetime("aaa")'); +select jsonb_path_query('"aaaa"', '$.datetime("HH24")'); + +select jsonb '"10-03-2017"' @? '$.datetime("dd-mm-yyyy")'; +select jsonb_path_query('"10-03-2017"', '$.datetime("dd-mm-yyyy")'); +select jsonb_path_query('"10-03-2017"', '$.datetime("dd-mm-yyyy").type()'); +select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy")'); +select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy").type()'); + +select jsonb_path_query('"10-03-2017 12:34"', ' $.datetime("dd-mm-yyyy HH24:MI").type()'); +select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM").type()'); +select jsonb_path_query('"12:34:56"', '$.datetime("HH24:MI:SS").type()'); +select jsonb_path_query('"12:34:56 +05:20"', '$.datetime("HH24:MI:SS TZH:TZM").type()'); + +set time zone '+00'; + +select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI")'); +select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI TZH")'); +select jsonb_path_query('"10-03-2017 12:34 +05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")'); +select jsonb_path_query('"10-03-2017 12:34 -05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")'); +select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")'); +select jsonb_path_query('"10-03-2017 12:34 -05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")'); +select jsonb_path_query('"12:34"', '$.datetime("HH24:MI")'); +select jsonb_path_query('"12:34"', '$.datetime("HH24:MI TZH")'); +select jsonb_path_query('"12:34 +05"', '$.datetime("HH24:MI TZH")'); +select jsonb_path_query('"12:34 -05"', '$.datetime("HH24:MI TZH")'); +select jsonb_path_query('"12:34 +05:20"', '$.datetime("HH24:MI TZH:TZM")'); +select jsonb_path_query('"12:34 -05:20"', '$.datetime("HH24:MI TZH:TZM")'); + +set time zone '+10'; + +select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI")'); +select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI TZH")'); +select jsonb_path_query('"10-03-2017 12:34 +05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")'); +select jsonb_path_query('"10-03-2017 12:34 -05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")'); +select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")'); +select jsonb_path_query('"10-03-2017 12:34 -05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")'); +select jsonb_path_query('"12:34"', '$.datetime("HH24:MI")'); +select jsonb_path_query('"12:34"', '$.datetime("HH24:MI TZH")'); +select jsonb_path_query('"12:34 +05"', '$.datetime("HH24:MI TZH")'); +select jsonb_path_query('"12:34 -05"', '$.datetime("HH24:MI TZH")'); +select jsonb_path_query('"12:34 +05:20"', '$.datetime("HH24:MI TZH:TZM")'); +select jsonb_path_query('"12:34 -05:20"', '$.datetime("HH24:MI TZH:TZM")'); + +set time zone default; + +select jsonb_path_query('"2017-03-10"', '$.datetime().type()'); +select jsonb_path_query('"2017-03-10"', '$.datetime()'); +select jsonb_path_query('"2017-03-10 12:34:56"', '$.datetime().type()'); +select jsonb_path_query('"2017-03-10 12:34:56"', '$.datetime()'); +select jsonb_path_query('"2017-03-10 12:34:56 +3"', '$.datetime().type()'); +select jsonb_path_query('"2017-03-10 12:34:56 +3"', '$.datetime()'); +select jsonb_path_query('"2017-03-10 12:34:56 +3:10"', '$.datetime().type()'); +select jsonb_path_query('"2017-03-10 12:34:56 +3:10"', '$.datetime()'); +select jsonb_path_query('"12:34:56"', '$.datetime().type()'); +select jsonb_path_query('"12:34:56"', '$.datetime()'); +select jsonb_path_query('"12:34:56 +3"', '$.datetime().type()'); +select jsonb_path_query('"12:34:56 +3"', '$.datetime()'); +select jsonb_path_query('"12:34:56 +3:10"', '$.datetime().type()'); +select jsonb_path_query('"12:34:56 +3:10"', '$.datetime()'); + +set time zone '+00'; + +-- date comparison +select jsonb_path_query( + '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03 +04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03 +04", "2017-03-10 03:00:00 +03"]', + '$[*].datetime() ? (@ == "10.03.2017".datetime("dd.mm.yyyy"))'); +select jsonb_path_query( + '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03 +04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03 +04", "2017-03-10 03:00:00 +03"]', + '$[*].datetime() ? (@ >= "10.03.2017".datetime("dd.mm.yyyy"))'); +select jsonb_path_query( + '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03 +04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03 +04", "2017-03-10 03:00:00 +03"]', + '$[*].datetime() ? (@ < "10.03.2017".datetime("dd.mm.yyyy"))'); +select jsonb_path_query_tz( + '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03 +04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03 +04", "2017-03-10 03:00:00 +03"]', + '$[*].datetime() ? (@ == "10.03.2017".datetime("dd.mm.yyyy"))'); +select jsonb_path_query_tz( + '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03 +04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03 +04", "2017-03-10 03:00:00 +03"]', + '$[*].datetime() ? (@ >= "10.03.2017".datetime("dd.mm.yyyy"))'); +select jsonb_path_query_tz( + '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03 +04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03 +04", "2017-03-10 03:00:00 +03"]', + '$[*].datetime() ? (@ < "10.03.2017".datetime("dd.mm.yyyy"))'); + +-- time comparison +select jsonb_path_query( + '["12:34:00", "12:35:00", "12:36:00", "12:35:00 +00", "12:35:00 +01", "13:35:00 +01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +01"]', + '$[*].datetime() ? (@ == "12:35".datetime("HH24:MI"))'); +select jsonb_path_query( + '["12:34:00", "12:35:00", "12:36:00", "12:35:00 +00", "12:35:00 +01", "13:35:00 +01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +01"]', + '$[*].datetime() ? (@ >= "12:35".datetime("HH24:MI"))'); +select jsonb_path_query( + '["12:34:00", "12:35:00", "12:36:00", "12:35:00 +00", "12:35:00 +01", "13:35:00 +01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +01"]', + '$[*].datetime() ? (@ < "12:35".datetime("HH24:MI"))'); +select jsonb_path_query_tz( + '["12:34:00", "12:35:00", "12:36:00", "12:35:00 +00", "12:35:00 +01", "13:35:00 +01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +01"]', + '$[*].datetime() ? (@ == "12:35".datetime("HH24:MI"))'); +select jsonb_path_query_tz( + '["12:34:00", "12:35:00", "12:36:00", "12:35:00 +00", "12:35:00 +01", "13:35:00 +01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +01"]', + '$[*].datetime() ? (@ >= "12:35".datetime("HH24:MI"))'); +select jsonb_path_query_tz( + '["12:34:00", "12:35:00", "12:36:00", "12:35:00 +00", "12:35:00 +01", "13:35:00 +01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +01"]', + '$[*].datetime() ? (@ < "12:35".datetime("HH24:MI"))'); + +-- timetz comparison +select jsonb_path_query( + '["12:34:00 +01", "12:35:00 +01", "12:36:00 +01", "12:35:00 +02", "12:35:00 -02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]', + '$[*].datetime() ? (@ == "12:35 +1".datetime("HH24:MI TZH"))'); +select jsonb_path_query( + '["12:34:00 +01", "12:35:00 +01", "12:36:00 +01", "12:35:00 +02", "12:35:00 -02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]', + '$[*].datetime() ? (@ >= "12:35 +1".datetime("HH24:MI TZH"))'); +select jsonb_path_query( + '["12:34:00 +01", "12:35:00 +01", "12:36:00 +01", "12:35:00 +02", "12:35:00 -02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]', + '$[*].datetime() ? (@ < "12:35 +1".datetime("HH24:MI TZH"))'); +select jsonb_path_query_tz( + '["12:34:00 +01", "12:35:00 +01", "12:36:00 +01", "12:35:00 +02", "12:35:00 -02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]', + '$[*].datetime() ? (@ == "12:35 +1".datetime("HH24:MI TZH"))'); +select jsonb_path_query_tz( + '["12:34:00 +01", "12:35:00 +01", "12:36:00 +01", "12:35:00 +02", "12:35:00 -02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]', + '$[*].datetime() ? (@ >= "12:35 +1".datetime("HH24:MI TZH"))'); +select jsonb_path_query_tz( + '["12:34:00 +01", "12:35:00 +01", "12:36:00 +01", "12:35:00 +02", "12:35:00 -02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]', + '$[*].datetime() ? (@ < "12:35 +1".datetime("HH24:MI TZH"))'); + +-- timestamp comparison +select jsonb_path_query( + '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00 +01", "2017-03-10 13:35:00 +01", "2017-03-10 12:35:00 -01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ == "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))'); +select jsonb_path_query( + '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00 +01", "2017-03-10 13:35:00 +01", "2017-03-10 12:35:00 -01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ >= "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))'); +select jsonb_path_query( + '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00 +01", "2017-03-10 13:35:00 +01", "2017-03-10 12:35:00 -01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ < "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))'); +select jsonb_path_query_tz( + '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00 +01", "2017-03-10 13:35:00 +01", "2017-03-10 12:35:00 -01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ == "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))'); +select jsonb_path_query_tz( + '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00 +01", "2017-03-10 13:35:00 +01", "2017-03-10 12:35:00 -01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ >= "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))'); +select jsonb_path_query_tz( + '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00 +01", "2017-03-10 13:35:00 +01", "2017-03-10 12:35:00 -01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ < "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))'); + +-- timestamptz comparison +select jsonb_path_query( + '["2017-03-10 12:34:00 +01", "2017-03-10 12:35:00 +01", "2017-03-10 12:36:00 +01", "2017-03-10 12:35:00 +02", "2017-03-10 12:35:00 -02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ == "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))'); +select jsonb_path_query( + '["2017-03-10 12:34:00 +01", "2017-03-10 12:35:00 +01", "2017-03-10 12:36:00 +01", "2017-03-10 12:35:00 +02", "2017-03-10 12:35:00 -02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ >= "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))'); +select jsonb_path_query( + '["2017-03-10 12:34:00 +01", "2017-03-10 12:35:00 +01", "2017-03-10 12:36:00 +01", "2017-03-10 12:35:00 +02", "2017-03-10 12:35:00 -02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ < "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))'); +select jsonb_path_query_tz( + '["2017-03-10 12:34:00 +01", "2017-03-10 12:35:00 +01", "2017-03-10 12:36:00 +01", "2017-03-10 12:35:00 +02", "2017-03-10 12:35:00 -02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ == "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))'); +select jsonb_path_query_tz( + '["2017-03-10 12:34:00 +01", "2017-03-10 12:35:00 +01", "2017-03-10 12:36:00 +01", "2017-03-10 12:35:00 +02", "2017-03-10 12:35:00 -02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ >= "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))'); +select jsonb_path_query_tz( + '["2017-03-10 12:34:00 +01", "2017-03-10 12:35:00 +01", "2017-03-10 12:36:00 +01", "2017-03-10 12:35:00 +02", "2017-03-10 12:35:00 -02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56 +01"]', + '$[*].datetime() ? (@ < "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))'); + +-- overflow during comparison +select jsonb_path_query('"1000000-01-01"', '$.datetime() > "2020-01-01 12:00:00".datetime()'::jsonpath); + +set time zone default; + +-- jsonpath operators + +SELECT jsonb_path_query('[{"a": 1}, {"a": 2}]', '$[*]'); +SELECT jsonb_path_query('[{"a": 1}, {"a": 2}]', '$[*] ? (@.a > 10)'); + +SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a'); +SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a'); +SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ == 1)'); +SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 10)'); +SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 1, "max": 4}'); +SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 3, "max": 4}'); + +SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a'); +SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a', silent => true); +SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a'); +SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ == 1)'); +SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 10)'); +SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 1, "max": 4}'); +SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 3, "max": 4}'); + +SELECT jsonb '[{"a": 1}, {"a": 2}]' @? '$[*].a ? (@ > 1)'; +SELECT jsonb '[{"a": 1}, {"a": 2}]' @? '$[*] ? (@.a > 2)'; +SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 1)'); +SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@.a > $min && @.a < $max)', vars => '{"min": 1, "max": 4}'); +SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@.a > $min && @.a < $max)', vars => '{"min": 3, "max": 4}'); + +SELECT jsonb_path_match('true', '$', silent => false); +SELECT jsonb_path_match('false', '$', silent => false); +SELECT jsonb_path_match('null', '$', silent => false); +SELECT jsonb_path_match('1', '$', silent => true); +SELECT jsonb_path_match('1', '$', silent => false); +SELECT jsonb_path_match('"a"', '$', silent => false); +SELECT jsonb_path_match('{}', '$', silent => false); +SELECT jsonb_path_match('[true]', '$', silent => false); +SELECT jsonb_path_match('{}', 'lax $.a', silent => false); +SELECT jsonb_path_match('{}', 'strict $.a', silent => false); +SELECT jsonb_path_match('{}', 'strict $.a', silent => true); +SELECT jsonb_path_match('[true, true]', '$[*]', silent => false); +SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 1'; +SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 2'; +SELECT jsonb_path_match('[{"a": 1}, {"a": 2}]', '$[*].a > 1'); + +-- test string comparison (Unicode codepoint collation) +WITH str(j, num) AS +( + SELECT jsonb_build_object('s', s), num + FROM unnest('{"", "a", "ab", "abc", "abcd", "b", "A", "AB", "ABC", "ABc", "ABcD", "B"}'::text[]) WITH ORDINALITY AS a(s, num) +) +SELECT + s1.j, s2.j, + jsonb_path_query_first(s1.j, '$.s < $s', vars => s2.j) lt, + jsonb_path_query_first(s1.j, '$.s <= $s', vars => s2.j) le, + jsonb_path_query_first(s1.j, '$.s == $s', vars => s2.j) eq, + jsonb_path_query_first(s1.j, '$.s >= $s', vars => s2.j) ge, + jsonb_path_query_first(s1.j, '$.s > $s', vars => s2.j) gt +FROM str s1, str s2 +ORDER BY s1.num, s2.num; diff --git a/postgresql/examples/jsonpath.sql b/postgresql/examples/jsonpath.sql new file mode 100644 index 0000000..17ab775 --- /dev/null +++ b/postgresql/examples/jsonpath.sql @@ -0,0 +1,181 @@ +--jsonpath io + +select ''::jsonpath; +select '$'::jsonpath; +select 'strict $'::jsonpath; +select 'lax $'::jsonpath; +select '$.a'::jsonpath; +select '$.a.v'::jsonpath; +select '$.a.*'::jsonpath; +select '$.*[*]'::jsonpath; +select '$.a[*]'::jsonpath; +select '$.a[*][*]'::jsonpath; +select '$[*]'::jsonpath; +select '$[0]'::jsonpath; +select '$[*][0]'::jsonpath; +select '$[*].a'::jsonpath; +select '$[*][0].a.b'::jsonpath; +select '$.a.**.b'::jsonpath; +select '$.a.**{2}.b'::jsonpath; +select '$.a.**{2 to 2}.b'::jsonpath; +select '$.a.**{2 to 5}.b'::jsonpath; +select '$.a.**{0 to 5}.b'::jsonpath; +select '$.a.**{5 to last}.b'::jsonpath; +select '$.a.**{last}.b'::jsonpath; +select '$.a.**{last to 5}.b'::jsonpath; +select '$+1'::jsonpath; +select '$-1'::jsonpath; +select '$--+1'::jsonpath; +select '$.a/+-1'::jsonpath; +select '1 * 2 + 4 % -3 != false'::jsonpath; + +select '"\b\f\r\n\t\v\"\''\\"'::jsonpath; +select '"\x50\u0067\u{53}\u{051}\u{00004C}"'::jsonpath; +select '$.foo\x50\u0067\u{53}\u{051}\u{00004C}\t\"bar'::jsonpath; +select '"\z"'::jsonpath; -- unrecognized escape is just the literal char + +select '$.g ? ($.a == 1)'::jsonpath; +select '$.g ? (@ == 1)'::jsonpath; +select '$.g ? (@.a == 1)'::jsonpath; +select '$.g ? (@.a == 1 || @.a == 4)'::jsonpath; +select '$.g ? (@.a == 1 && @.a == 4)'::jsonpath; +select '$.g ? (@.a == 1 || @.a == 4 && @.b == 7)'::jsonpath; +select '$.g ? (@.a == 1 || !(@.a == 4) && @.b == 7)'::jsonpath; +select '$.g ? (@.a == 1 || !(@.x >= 123 || @.a == 4) && @.b == 7)'::jsonpath; +select '$.g ? (@.x >= @[*]?(@.a > "abc"))'::jsonpath; +select '$.g ? ((@.x >= 123 || @.a == 4) is unknown)'::jsonpath; +select '$.g ? (exists (@.x))'::jsonpath; +select '$.g ? (exists (@.x ? (@ == 14)))'::jsonpath; +select '$.g ? ((@.x >= 123 || @.a == 4) && exists (@.x ? (@ == 14)))'::jsonpath; +select '$.g ? (+@.x >= +-(+@.a + 2))'::jsonpath; + +select '$a'::jsonpath; +select '$a.b'::jsonpath; +select '$a[*]'::jsonpath; +select '$.g ? (@.zip == $zip)'::jsonpath; +select '$.a[1,2, 3 to 16]'::jsonpath; +select '$.a[$a + 1, ($b[*]) to -($[0] * 2)]'::jsonpath; +select '$.a[$.a.size() - 3]'::jsonpath; +select 'last'::jsonpath; +select '"last"'::jsonpath; +select '$.last'::jsonpath; +select '$ ? (last > 0)'::jsonpath; +select '$[last]'::jsonpath; +select '$[$[0] ? (last > 0)]'::jsonpath; + +select 'null.type()'::jsonpath; +select '1.type()'::jsonpath; +select '(1).type()'::jsonpath; +select '1.2.type()'::jsonpath; +select '"aaa".type()'::jsonpath; +select 'true.type()'::jsonpath; +select '$.double().floor().ceiling().abs()'::jsonpath; +select '$.keyvalue().key'::jsonpath; +select '$.datetime()'::jsonpath; +select '$.datetime("datetime template")'::jsonpath; + +select '$ ? (@ starts with "abc")'::jsonpath; +select '$ ? (@ starts with $var)'::jsonpath; + +select '$ ? (@ like_regex "(invalid pattern")'::jsonpath; +select '$ ? (@ like_regex "pattern")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "i")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "is")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "isim")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "xsms")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "q")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "iq")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "smixq")'::jsonpath; +select '$ ? (@ like_regex "pattern" flag "a")'::jsonpath; + +select '$ < 1'::jsonpath; +select '($ < 1) || $.a.b <= $x'::jsonpath; +select '@ + 1'::jsonpath; + +select '($).a.b'::jsonpath; +select '($.a.b).c.d'::jsonpath; +select '($.a.b + -$.x.y).c.d'::jsonpath; +select '(-+$.a.b).c.d'::jsonpath; +select '1 + ($.a.b + 2).c.d'::jsonpath; +select '1 + ($.a.b > 2).c.d'::jsonpath; +select '($)'::jsonpath; +select '(($))'::jsonpath; +select '((($ + 1)).a + ((2)).b ? ((((@ > 1)) || (exists(@.c)))))'::jsonpath; + +select '$ ? (@.a < 1)'::jsonpath; +select '$ ? (@.a < -1)'::jsonpath; +select '$ ? (@.a < +1)'::jsonpath; +select '$ ? (@.a < .1)'::jsonpath; +select '$ ? (@.a < -.1)'::jsonpath; +select '$ ? (@.a < +.1)'::jsonpath; +select '$ ? (@.a < 0.1)'::jsonpath; +select '$ ? (@.a < -0.1)'::jsonpath; +select '$ ? (@.a < +0.1)'::jsonpath; +select '$ ? (@.a < 10.1)'::jsonpath; +select '$ ? (@.a < -10.1)'::jsonpath; +select '$ ? (@.a < +10.1)'::jsonpath; +select '$ ? (@.a < 1e1)'::jsonpath; +select '$ ? (@.a < -1e1)'::jsonpath; +select '$ ? (@.a < +1e1)'::jsonpath; +select '$ ? (@.a < .1e1)'::jsonpath; +select '$ ? (@.a < -.1e1)'::jsonpath; +select '$ ? (@.a < +.1e1)'::jsonpath; +select '$ ? (@.a < 0.1e1)'::jsonpath; +select '$ ? (@.a < -0.1e1)'::jsonpath; +select '$ ? (@.a < +0.1e1)'::jsonpath; +select '$ ? (@.a < 10.1e1)'::jsonpath; +select '$ ? (@.a < -10.1e1)'::jsonpath; +select '$ ? (@.a < +10.1e1)'::jsonpath; +select '$ ? (@.a < 1e-1)'::jsonpath; +select '$ ? (@.a < -1e-1)'::jsonpath; +select '$ ? (@.a < +1e-1)'::jsonpath; +select '$ ? (@.a < .1e-1)'::jsonpath; +select '$ ? (@.a < -.1e-1)'::jsonpath; +select '$ ? (@.a < +.1e-1)'::jsonpath; +select '$ ? (@.a < 0.1e-1)'::jsonpath; +select '$ ? (@.a < -0.1e-1)'::jsonpath; +select '$ ? (@.a < +0.1e-1)'::jsonpath; +select '$ ? (@.a < 10.1e-1)'::jsonpath; +select '$ ? (@.a < -10.1e-1)'::jsonpath; +select '$ ? (@.a < +10.1e-1)'::jsonpath; +select '$ ? (@.a < 1e+1)'::jsonpath; +select '$ ? (@.a < -1e+1)'::jsonpath; +select '$ ? (@.a < +1e+1)'::jsonpath; +select '$ ? (@.a < .1e+1)'::jsonpath; +select '$ ? (@.a < -.1e+1)'::jsonpath; +select '$ ? (@.a < +.1e+1)'::jsonpath; +select '$ ? (@.a < 0.1e+1)'::jsonpath; +select '$ ? (@.a < -0.1e+1)'::jsonpath; +select '$ ? (@.a < +0.1e+1)'::jsonpath; +select '$ ? (@.a < 10.1e+1)'::jsonpath; +select '$ ? (@.a < -10.1e+1)'::jsonpath; +select '$ ? (@.a < +10.1e+1)'::jsonpath; + +select '0'::jsonpath; +select '00'::jsonpath; +select '0.0'::jsonpath; +select '0.000'::jsonpath; +select '0.000e1'::jsonpath; +select '0.000e2'::jsonpath; +select '0.000e3'::jsonpath; +select '0.0010'::jsonpath; +select '0.0010e-1'::jsonpath; +select '0.0010e+1'::jsonpath; +select '0.0010e+2'::jsonpath; +select '1e'::jsonpath; +select '1.e'::jsonpath; +select '1.2e'::jsonpath; +select '1.2.e'::jsonpath; +select '(1.2).e'::jsonpath; +select '1e3'::jsonpath; +select '1.e3'::jsonpath; +select '1.e3.e'::jsonpath; +select '1.e3.e4'::jsonpath; +select '1.2e3'::jsonpath; +select '1.2.e3'::jsonpath; +select '(1.2).e3'::jsonpath; +select '1..e'::jsonpath; +select '1..e3'::jsonpath; +select '(1.).e'::jsonpath; +select '(1.).e3'::jsonpath; diff --git a/postgresql/examples/jsonpath_encoding.sql b/postgresql/examples/jsonpath_encoding.sql new file mode 100644 index 0000000..1ddf580 --- /dev/null +++ b/postgresql/examples/jsonpath_encoding.sql @@ -0,0 +1,57 @@ +-- +-- encoding-sensitive tests for jsonpath +-- + +-- We provide expected-results files for UTF8 (jsonpath_encoding.out) +-- and for SQL_ASCII (jsonpath_encoding_1.out). Skip otherwise. +\if :skip_test +\quit +\endif + +SELECT getdatabaseencoding(); -- just to label the results files + +-- checks for double-quoted values + +-- basic unicode input +SELECT '"\u"'::jsonpath; -- ERROR, incomplete escape +SELECT '"\u00"'::jsonpath; -- ERROR, incomplete escape +SELECT '"\u000g"'::jsonpath; -- ERROR, g is not a hex digit +SELECT '"\u0000"'::jsonpath; -- OK, legal escape +SELECT '"\uaBcD"'::jsonpath; -- OK, uppercase and lower case both OK + +-- handling of unicode surrogate pairs +select '"\ud83d\ude04\ud83d\udc36"'::jsonpath as correct_in_utf8; +select '"\ud83d\ud83d"'::jsonpath; -- 2 high surrogates in a row +select '"\ude04\ud83d"'::jsonpath; -- surrogates in wrong order +select '"\ud83dX"'::jsonpath; -- orphan high surrogate +select '"\ude04X"'::jsonpath; -- orphan low surrogate + +--handling of simple unicode escapes +select '"the Copyright \u00a9 sign"'::jsonpath as correct_in_utf8; +select '"dollar \u0024 character"'::jsonpath as correct_everywhere; +select '"dollar \\u0024 character"'::jsonpath as not_an_escape; +select '"null \u0000 escape"'::jsonpath as not_unescaped; +select '"null \\u0000 escape"'::jsonpath as not_an_escape; + +-- checks for quoted key names + +-- basic unicode input +SELECT '$."\u"'::jsonpath; -- ERROR, incomplete escape +SELECT '$."\u00"'::jsonpath; -- ERROR, incomplete escape +SELECT '$."\u000g"'::jsonpath; -- ERROR, g is not a hex digit +SELECT '$."\u0000"'::jsonpath; -- OK, legal escape +SELECT '$."\uaBcD"'::jsonpath; -- OK, uppercase and lower case both OK + +-- handling of unicode surrogate pairs +select '$."\ud83d\ude04\ud83d\udc36"'::jsonpath as correct_in_utf8; +select '$."\ud83d\ud83d"'::jsonpath; -- 2 high surrogates in a row +select '$."\ude04\ud83d"'::jsonpath; -- surrogates in wrong order +select '$."\ud83dX"'::jsonpath; -- orphan high surrogate +select '$."\ude04X"'::jsonpath; -- orphan low surrogate + +--handling of simple unicode escapes +select '$."the Copyright \u00a9 sign"'::jsonpath as correct_in_utf8; +select '$."dollar \u0024 character"'::jsonpath as correct_everywhere; +select '$."dollar \\u0024 character"'::jsonpath as not_an_escape; +select '$."null \u0000 escape"'::jsonpath as not_unescaped; +select '$."null \\u0000 escape"'::jsonpath as not_an_escape; diff --git a/postgresql/examples/limit.sql b/postgresql/examples/limit.sql new file mode 100644 index 0000000..81618bc --- /dev/null +++ b/postgresql/examples/limit.sql @@ -0,0 +1,198 @@ +-- +-- LIMIT +-- Check the LIMIT/OFFSET feature of SELECT +-- + +SELECT ''::text AS two, unique1, unique2, stringu1 + FROM onek WHERE unique1 > 50 + ORDER BY unique1 LIMIT 2; +SELECT ''::text AS five, unique1, unique2, stringu1 + FROM onek WHERE unique1 > 60 + ORDER BY unique1 LIMIT 5; +SELECT ''::text AS two, unique1, unique2, stringu1 + FROM onek WHERE unique1 > 60 AND unique1 < 63 + ORDER BY unique1 LIMIT 5; +SELECT ''::text AS three, unique1, unique2, stringu1 + FROM onek WHERE unique1 > 100 + ORDER BY unique1 LIMIT 3 OFFSET 20; +SELECT ''::text AS zero, unique1, unique2, stringu1 + FROM onek WHERE unique1 < 50 + ORDER BY unique1 DESC LIMIT 8 OFFSET 99; +SELECT ''::text AS eleven, unique1, unique2, stringu1 + FROM onek WHERE unique1 < 50 + ORDER BY unique1 DESC LIMIT 20 OFFSET 39; +SELECT ''::text AS ten, unique1, unique2, stringu1 + FROM onek + ORDER BY unique1 OFFSET 990; +SELECT ''::text AS five, unique1, unique2, stringu1 + FROM onek + ORDER BY unique1 OFFSET 990 LIMIT 5; +SELECT ''::text AS five, unique1, unique2, stringu1 + FROM onek + ORDER BY unique1 LIMIT 5 OFFSET 900; + +-- Test null limit and offset. The planner would discard a simple null +-- constant, so to ensure executor is exercised, do this: +select * from int8_tbl limit (case when random() < 0.5 then null::bigint end); +select * from int8_tbl offset (case when random() < 0.5 then null::bigint end); + +-- Test assorted cases involving backwards fetch from a LIMIT plan node +begin; + +declare c1 cursor for select * from int8_tbl limit 10; +fetch all in c1; +fetch 1 in c1; +fetch backward 1 in c1; +fetch backward all in c1; +fetch backward 1 in c1; +fetch all in c1; + +declare c2 cursor for select * from int8_tbl limit 3; +fetch all in c2; +fetch 1 in c2; +fetch backward 1 in c2; +fetch backward all in c2; +fetch backward 1 in c2; +fetch all in c2; + +declare c3 cursor for select * from int8_tbl offset 3; +fetch all in c3; +fetch 1 in c3; +fetch backward 1 in c3; +fetch backward all in c3; +fetch backward 1 in c3; +fetch all in c3; + +declare c4 cursor for select * from int8_tbl offset 10; +fetch all in c4; +fetch 1 in c4; +fetch backward 1 in c4; +fetch backward all in c4; +fetch backward 1 in c4; +fetch all in c4; + +declare c5 cursor for select * from int8_tbl order by q1 fetch first 2 rows with ties; +fetch all in c5; +fetch 1 in c5; +fetch backward 1 in c5; +fetch backward 1 in c5; +fetch all in c5; +fetch backward all in c5; +fetch all in c5; +fetch backward all in c5; + +rollback; + +-- Stress test for variable LIMIT in conjunction with bounded-heap sorting + +SELECT + (SELECT n + FROM (VALUES (1)) AS x, + (SELECT n FROM generate_series(1,10) AS n + ORDER BY n LIMIT 1 OFFSET s-1) AS y) AS z + FROM generate_series(1,10) AS s; + +-- +-- Test behavior of volatile and set-returning functions in conjunction +-- with ORDER BY and LIMIT. +-- + +create temp sequence testseq; + +explain (verbose, costs off) +select unique1, unique2, nextval('testseq') + from tenk1 order by unique2 limit 10; + +select unique1, unique2, nextval('testseq') + from tenk1 order by unique2 limit 10; + +select currval('testseq'); + +explain (verbose, costs off) +select unique1, unique2, nextval('testseq') + from tenk1 order by tenthous limit 10; + +select unique1, unique2, nextval('testseq') + from tenk1 order by tenthous limit 10; + +select currval('testseq'); + +explain (verbose, costs off) +select unique1, unique2, generate_series(1,10) + from tenk1 order by unique2 limit 7; + +select unique1, unique2, generate_series(1,10) + from tenk1 order by unique2 limit 7; + +explain (verbose, costs off) +select unique1, unique2, generate_series(1,10) + from tenk1 order by tenthous limit 7; + +select unique1, unique2, generate_series(1,10) + from tenk1 order by tenthous limit 7; + + + +-- test for failure to set all aggregates' aggtranstype +explain (verbose, costs off) +select sum(tenthous) as s1, sum(tenthous) + random()*0 as s2 + from tenk1 group by thousand order by thousand limit 3; + +select sum(tenthous) as s1, sum(tenthous) + random()*0 as s2 + from tenk1 group by thousand order by thousand limit 3; + +-- +-- FETCH FIRST +-- Check the WITH TIES clause +-- + +SELECT thousand + FROM onek WHERE thousand < 5 + ORDER BY thousand FETCH FIRST 2 ROW WITH TIES; + +SELECT thousand + FROM onek WHERE thousand < 5 + ORDER BY thousand FETCH FIRST ROWS WITH TIES; + +SELECT thousand + FROM onek WHERE thousand < 5 + ORDER BY thousand FETCH FIRST 1 ROW WITH TIES; + +SELECT thousand + FROM onek WHERE thousand < 5 + ORDER BY thousand FETCH FIRST 2 ROW ONLY; + +-- should fail +SELECT ''::text AS two, unique1, unique2, stringu1 + FROM onek WHERE unique1 > 50 + FETCH FIRST 2 ROW WITH TIES; + +-- test ruleutils +CREATE VIEW limit_thousand_v_1 AS SELECT thousand FROM onek WHERE thousand < 995 + ORDER BY thousand FETCH FIRST 5 ROWS WITH TIES OFFSET 10; +\d+ limit_thousand_v_1 +CREATE VIEW limit_thousand_v_2 AS SELECT thousand FROM onek WHERE thousand < 995 + ORDER BY thousand OFFSET 10 FETCH FIRST 5 ROWS ONLY; +\d+ limit_thousand_v_2 +CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousand < 995 + ORDER BY thousand FETCH FIRST NULL ROWS WITH TIES; -- fails +CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousand < 995 + ORDER BY thousand FETCH FIRST (NULL+1) ROWS WITH TIES; +\d+ limit_thousand_v_3 +CREATE VIEW limit_thousand_v_4 AS SELECT thousand FROM onek WHERE thousand < 995 + ORDER BY thousand FETCH FIRST NULL ROWS ONLY; +\d+ limit_thousand_v_4 +-- leave these views +-- use of random() is to keep planner from folding the expressions together +explain (verbose, costs off) +select generate_series(0,2) as s1, generate_series((random()*.1)::int,2) as s2; + +select generate_series(0,2) as s1, generate_series((random()*.1)::int,2) as s2; + +explain (verbose, costs off) +select generate_series(0,2) as s1, generate_series((random()*.1)::int,2) as s2 +order by s2 desc; + +select generate_series(0,2) as s1, generate_series((random()*.1)::int,2) as s2 +order by s2 desc; + diff --git a/postgresql/examples/line.sql b/postgresql/examples/line.sql new file mode 100644 index 0000000..f589ffe --- /dev/null +++ b/postgresql/examples/line.sql @@ -0,0 +1,42 @@ +-- +-- LINE +-- Infinite lines +-- + +--DROP TABLE LINE_TBL; +CREATE TABLE LINE_TBL (s line); + +INSERT INTO LINE_TBL VALUES ('{0,-1,5}'); -- A == 0 +INSERT INTO LINE_TBL VALUES ('{1,0,5}'); -- B == 0 +INSERT INTO LINE_TBL VALUES ('{0,3,0}'); -- A == C == 0 +INSERT INTO LINE_TBL VALUES (' (0,0), (6,6)'); +INSERT INTO LINE_TBL VALUES ('10,-10 ,-5,-4'); +INSERT INTO LINE_TBL VALUES ('[-1e6,2e2,3e5, -4e1]'); + +INSERT INTO LINE_TBL VALUES ('{3,NaN,5}'); +INSERT INTO LINE_TBL VALUES ('{NaN,NaN,NaN}'); + +-- horizontal +INSERT INTO LINE_TBL VALUES ('[(1,3),(2,3)]'); +-- vertical +INSERT INTO LINE_TBL VALUES (line(point '(3,1)', point '(3,2)')); + +-- bad values for parser testing +INSERT INTO LINE_TBL VALUES ('{}'); +INSERT INTO LINE_TBL VALUES ('{0'); +INSERT INTO LINE_TBL VALUES ('{0,0}'); +INSERT INTO LINE_TBL VALUES ('{0,0,1'); +INSERT INTO LINE_TBL VALUES ('{0,0,1}'); +INSERT INTO LINE_TBL VALUES ('{0,0,1} x'); +INSERT INTO LINE_TBL VALUES ('(3asdf,2 ,3,4r2)'); +INSERT INTO LINE_TBL VALUES ('[1,2,3, 4'); +INSERT INTO LINE_TBL VALUES ('[(,2),(3,4)]'); +INSERT INTO LINE_TBL VALUES ('[(1,2),(3,4)'); +INSERT INTO LINE_TBL VALUES ('[(1,2),(1,2)]'); + +INSERT INTO LINE_TBL VALUES (line(point '(1,0)', point '(1,0)')); + +select * from LINE_TBL; + +select '{nan, 1, nan}'::line = '{nan, 1, nan}'::line as true, + '{nan, 1, nan}'::line = '{nan, 2, nan}'::line as false; diff --git a/postgresql/examples/lock.sql b/postgresql/examples/lock.sql new file mode 100644 index 0000000..e50cb6f --- /dev/null +++ b/postgresql/examples/lock.sql @@ -0,0 +1,139 @@ +-- +-- Test the LOCK statement +-- + +-- Setup +CREATE SCHEMA lock_schema1; +SET search_path = lock_schema1; +CREATE TABLE lock_tbl1 (a BIGINT); +CREATE TABLE lock_tbl1a (a BIGINT); +CREATE VIEW lock_view1 AS SELECT * FROM lock_tbl1; +CREATE VIEW lock_view2(a,b) AS SELECT * FROM lock_tbl1, lock_tbl1a; +CREATE VIEW lock_view3 AS SELECT * from lock_view2; +CREATE VIEW lock_view4 AS SELECT (select a from lock_tbl1a limit 1) from lock_tbl1; +CREATE VIEW lock_view5 AS SELECT * from lock_tbl1 where a in (select * from lock_tbl1a); +CREATE VIEW lock_view6 AS SELECT * from (select * from lock_tbl1) sub; +CREATE ROLE regress_rol_lock1; +ALTER ROLE regress_rol_lock1 SET search_path = lock_schema1; +GRANT USAGE ON SCHEMA lock_schema1 TO regress_rol_lock1; + +-- Try all valid lock options; also try omitting the optional TABLE keyword. +BEGIN TRANSACTION; +LOCK TABLE lock_tbl1 IN ACCESS SHARE MODE; +LOCK lock_tbl1 IN ROW SHARE MODE; +LOCK TABLE lock_tbl1 IN ROW EXCLUSIVE MODE; +LOCK TABLE lock_tbl1 IN SHARE UPDATE EXCLUSIVE MODE; +LOCK TABLE lock_tbl1 IN SHARE MODE; +LOCK lock_tbl1 IN SHARE ROW EXCLUSIVE MODE; +LOCK TABLE lock_tbl1 IN EXCLUSIVE MODE; +LOCK TABLE lock_tbl1 IN ACCESS EXCLUSIVE MODE; +ROLLBACK; + +-- Try using NOWAIT along with valid options. +BEGIN TRANSACTION; +LOCK TABLE lock_tbl1 IN ACCESS SHARE MODE NOWAIT; +LOCK TABLE lock_tbl1 IN ROW SHARE MODE NOWAIT; +LOCK TABLE lock_tbl1 IN ROW EXCLUSIVE MODE NOWAIT; +LOCK TABLE lock_tbl1 IN SHARE UPDATE EXCLUSIVE MODE NOWAIT; +LOCK TABLE lock_tbl1 IN SHARE MODE NOWAIT; +LOCK TABLE lock_tbl1 IN SHARE ROW EXCLUSIVE MODE NOWAIT; +LOCK TABLE lock_tbl1 IN EXCLUSIVE MODE NOWAIT; +LOCK TABLE lock_tbl1 IN ACCESS EXCLUSIVE MODE NOWAIT; +ROLLBACK; + +-- Verify that we can lock views. +BEGIN TRANSACTION; +LOCK TABLE lock_view1 IN EXCLUSIVE MODE; +-- lock_view1 and lock_tbl1 are locked. +select relname from pg_locks l, pg_class c + where l.relation = c.oid and relname like '%lock_%' and mode = 'ExclusiveLock' + order by relname; +ROLLBACK; +BEGIN TRANSACTION; +LOCK TABLE lock_view2 IN EXCLUSIVE MODE; +-- lock_view1, lock_tbl1, and lock_tbl1a are locked. +select relname from pg_locks l, pg_class c + where l.relation = c.oid and relname like '%lock_%' and mode = 'ExclusiveLock' + order by relname; +ROLLBACK; +BEGIN TRANSACTION; +LOCK TABLE lock_view3 IN EXCLUSIVE MODE; +-- lock_view3, lock_view2, lock_tbl1, and lock_tbl1a are locked recursively. +select relname from pg_locks l, pg_class c + where l.relation = c.oid and relname like '%lock_%' and mode = 'ExclusiveLock' + order by relname; +ROLLBACK; +BEGIN TRANSACTION; +LOCK TABLE lock_view4 IN EXCLUSIVE MODE; +-- lock_view4, lock_tbl1, and lock_tbl1a are locked. +select relname from pg_locks l, pg_class c + where l.relation = c.oid and relname like '%lock_%' and mode = 'ExclusiveLock' + order by relname; +ROLLBACK; +BEGIN TRANSACTION; +LOCK TABLE lock_view5 IN EXCLUSIVE MODE; +-- lock_view5, lock_tbl1, and lock_tbl1a are locked. +select relname from pg_locks l, pg_class c + where l.relation = c.oid and relname like '%lock_%' and mode = 'ExclusiveLock' + order by relname; +ROLLBACK; +BEGIN TRANSACTION; +LOCK TABLE lock_view6 IN EXCLUSIVE MODE; +-- lock_view6 an lock_tbl1 are locked. +select relname from pg_locks l, pg_class c + where l.relation = c.oid and relname like '%lock_%' and mode = 'ExclusiveLock' + order by relname; +ROLLBACK; +-- detecting infinite recursions in view definitions +CREATE OR REPLACE VIEW lock_view2 AS SELECT * from lock_view3; +BEGIN TRANSACTION; +LOCK TABLE lock_view2 IN EXCLUSIVE MODE; +ROLLBACK; +CREATE VIEW lock_view7 AS SELECT * from lock_view2; +BEGIN TRANSACTION; +LOCK TABLE lock_view7 IN EXCLUSIVE MODE; +ROLLBACK; + +-- Verify that we can lock a table with inheritance children. +CREATE TABLE lock_tbl2 (b BIGINT) INHERITS (lock_tbl1); +CREATE TABLE lock_tbl3 () INHERITS (lock_tbl2); +BEGIN TRANSACTION; +LOCK TABLE lock_tbl1 * IN ACCESS EXCLUSIVE MODE; +ROLLBACK; + +-- Child tables are locked without granting explicit permission to do so as +-- long as we have permission to lock the parent. +GRANT UPDATE ON TABLE lock_tbl1 TO regress_rol_lock1; +SET ROLE regress_rol_lock1; +-- fail when child locked directly +BEGIN; +LOCK TABLE lock_tbl2; +ROLLBACK; +BEGIN; +LOCK TABLE lock_tbl1 * IN ACCESS EXCLUSIVE MODE; +ROLLBACK; +BEGIN; +LOCK TABLE ONLY lock_tbl1; +ROLLBACK; +RESET ROLE; + +-- +-- Clean up +-- +DROP VIEW lock_view7; +DROP VIEW lock_view6; +DROP VIEW lock_view5; +DROP VIEW lock_view4; +DROP VIEW lock_view3 CASCADE; +DROP VIEW lock_view1; +DROP TABLE lock_tbl3; +DROP TABLE lock_tbl2; +DROP TABLE lock_tbl1; +DROP TABLE lock_tbl1a; +DROP SCHEMA lock_schema1 CASCADE; +DROP ROLE regress_rol_lock1; + + +-- atomic ops tests +RESET search_path; +SELECT test_atomic_ops(); diff --git a/postgresql/examples/lseg.sql b/postgresql/examples/lseg.sql new file mode 100644 index 0000000..f266ca3 --- /dev/null +++ b/postgresql/examples/lseg.sql @@ -0,0 +1,24 @@ +-- +-- LSEG +-- Line segments +-- + +--DROP TABLE LSEG_TBL; +CREATE TABLE LSEG_TBL (s lseg); + +INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)]'); +INSERT INTO LSEG_TBL VALUES ('(0,0),(6,6)'); +INSERT INTO LSEG_TBL VALUES ('10,-10 ,-3,-4'); +INSERT INTO LSEG_TBL VALUES ('[-1e6,2e2,3e5, -4e1]'); +INSERT INTO LSEG_TBL VALUES (lseg(point(11, 22), point(33,44))); +INSERT INTO LSEG_TBL VALUES ('[(-10,2),(-10,3)]'); -- vertical +INSERT INTO LSEG_TBL VALUES ('[(0,-20),(30,-20)]'); -- horizontal +INSERT INTO LSEG_TBL VALUES ('[(NaN,1),(NaN,90)]'); -- NaN + +-- bad values for parser testing +INSERT INTO LSEG_TBL VALUES ('(3asdf,2 ,3,4r2)'); +INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4'); +INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]'); +INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)'); + +select * from LSEG_TBL; diff --git a/postgresql/examples/macaddr.sql b/postgresql/examples/macaddr.sql new file mode 100644 index 0000000..7bad8f5 --- /dev/null +++ b/postgresql/examples/macaddr.sql @@ -0,0 +1,43 @@ +-- +-- macaddr +-- + +CREATE TABLE macaddr_data (a int, b macaddr); + +INSERT INTO macaddr_data VALUES (1, '08:00:2b:01:02:03'); +INSERT INTO macaddr_data VALUES (2, '08-00-2b-01-02-03'); +INSERT INTO macaddr_data VALUES (3, '08002b:010203'); +INSERT INTO macaddr_data VALUES (4, '08002b-010203'); +INSERT INTO macaddr_data VALUES (5, '0800.2b01.0203'); +INSERT INTO macaddr_data VALUES (6, '0800-2b01-0203'); +INSERT INTO macaddr_data VALUES (7, '08002b010203'); +INSERT INTO macaddr_data VALUES (8, '0800:2b01:0203'); -- invalid +INSERT INTO macaddr_data VALUES (9, 'not even close'); -- invalid + +INSERT INTO macaddr_data VALUES (10, '08:00:2b:01:02:04'); +INSERT INTO macaddr_data VALUES (11, '08:00:2b:01:02:02'); +INSERT INTO macaddr_data VALUES (12, '08:00:2a:01:02:03'); +INSERT INTO macaddr_data VALUES (13, '08:00:2c:01:02:03'); +INSERT INTO macaddr_data VALUES (14, '08:00:2a:01:02:04'); + +SELECT * FROM macaddr_data; + +CREATE INDEX macaddr_data_btree ON macaddr_data USING btree (b); +CREATE INDEX macaddr_data_hash ON macaddr_data USING hash (b); + +SELECT a, b, trunc(b) FROM macaddr_data ORDER BY 2, 1; + +SELECT b < '08:00:2b:01:02:04' FROM macaddr_data WHERE a = 1; -- true +SELECT b > '08:00:2b:01:02:04' FROM macaddr_data WHERE a = 1; -- false +SELECT b > '08:00:2b:01:02:03' FROM macaddr_data WHERE a = 1; -- false +SELECT b <= '08:00:2b:01:02:04' FROM macaddr_data WHERE a = 1; -- true +SELECT b >= '08:00:2b:01:02:04' FROM macaddr_data WHERE a = 1; -- false +SELECT b = '08:00:2b:01:02:03' FROM macaddr_data WHERE a = 1; -- true +SELECT b <> '08:00:2b:01:02:04' FROM macaddr_data WHERE a = 1; -- true +SELECT b <> '08:00:2b:01:02:03' FROM macaddr_data WHERE a = 1; -- false + +SELECT ~b FROM macaddr_data; +SELECT b & '00:00:00:ff:ff:ff' FROM macaddr_data; +SELECT b | '01:02:03:04:05:06' FROM macaddr_data; + +DROP TABLE macaddr_data; diff --git a/postgresql/examples/macaddr8.sql b/postgresql/examples/macaddr8.sql new file mode 100644 index 0000000..57a227c --- /dev/null +++ b/postgresql/examples/macaddr8.sql @@ -0,0 +1,89 @@ +-- +-- macaddr8 +-- + +-- test various cases of valid and invalid input +-- valid +SELECT '08:00:2b:01:02:03 '::macaddr8; +SELECT ' 08:00:2b:01:02:03 '::macaddr8; +SELECT ' 08:00:2b:01:02:03'::macaddr8; +SELECT '08:00:2b:01:02:03:04:05 '::macaddr8; +SELECT ' 08:00:2b:01:02:03:04:05 '::macaddr8; +SELECT ' 08:00:2b:01:02:03:04:05'::macaddr8; + +SELECT '123 08:00:2b:01:02:03'::macaddr8; -- invalid +SELECT '08:00:2b:01:02:03 123'::macaddr8; -- invalid +SELECT '123 08:00:2b:01:02:03:04:05'::macaddr8; -- invalid +SELECT '08:00:2b:01:02:03:04:05 123'::macaddr8; -- invalid +SELECT '08:00:2b:01:02:03:04:05:06:07'::macaddr8; -- invalid +SELECT '08-00-2b-01-02-03-04-05-06-07'::macaddr8; -- invalid +SELECT '08002b:01020304050607'::macaddr8; -- invalid +SELECT '08002b01020304050607'::macaddr8; -- invalid +SELECT '0z002b0102030405'::macaddr8; -- invalid +SELECT '08002b010203xyza'::macaddr8; -- invalid + +SELECT '08:00-2b:01:02:03:04:05'::macaddr8; -- invalid +SELECT '08:00-2b:01:02:03:04:05'::macaddr8; -- invalid +SELECT '08:00:2b:01.02:03:04:05'::macaddr8; -- invalid +SELECT '08:00:2b:01.02:03:04:05'::macaddr8; -- invalid + +-- test converting a MAC address to modified EUI-64 for inclusion +-- in an ipv6 address +SELECT macaddr8_set7bit('00:08:2b:01:02:03'::macaddr8); + +CREATE TABLE macaddr8_data (a int, b macaddr8); + +INSERT INTO macaddr8_data VALUES (1, '08:00:2b:01:02:03'); +INSERT INTO macaddr8_data VALUES (2, '08-00-2b-01-02-03'); +INSERT INTO macaddr8_data VALUES (3, '08002b:010203'); +INSERT INTO macaddr8_data VALUES (4, '08002b-010203'); +INSERT INTO macaddr8_data VALUES (5, '0800.2b01.0203'); +INSERT INTO macaddr8_data VALUES (6, '0800-2b01-0203'); +INSERT INTO macaddr8_data VALUES (7, '08002b010203'); +INSERT INTO macaddr8_data VALUES (8, '0800:2b01:0203'); +INSERT INTO macaddr8_data VALUES (9, 'not even close'); -- invalid + +INSERT INTO macaddr8_data VALUES (10, '08:00:2b:01:02:04'); +INSERT INTO macaddr8_data VALUES (11, '08:00:2b:01:02:02'); +INSERT INTO macaddr8_data VALUES (12, '08:00:2a:01:02:03'); +INSERT INTO macaddr8_data VALUES (13, '08:00:2c:01:02:03'); +INSERT INTO macaddr8_data VALUES (14, '08:00:2a:01:02:04'); + +INSERT INTO macaddr8_data VALUES (15, '08:00:2b:01:02:03:04:05'); +INSERT INTO macaddr8_data VALUES (16, '08-00-2b-01-02-03-04-05'); +INSERT INTO macaddr8_data VALUES (17, '08002b:0102030405'); +INSERT INTO macaddr8_data VALUES (18, '08002b-0102030405'); +INSERT INTO macaddr8_data VALUES (19, '0800.2b01.0203.0405'); +INSERT INTO macaddr8_data VALUES (20, '08002b01:02030405'); +INSERT INTO macaddr8_data VALUES (21, '08002b0102030405'); + +SELECT * FROM macaddr8_data ORDER BY 1; + +CREATE INDEX macaddr8_data_btree ON macaddr8_data USING btree (b); +CREATE INDEX macaddr8_data_hash ON macaddr8_data USING hash (b); + +SELECT a, b, trunc(b) FROM macaddr8_data ORDER BY 2, 1; + +SELECT b < '08:00:2b:01:02:04' FROM macaddr8_data WHERE a = 1; -- true +SELECT b > '08:00:2b:ff:fe:01:02:04' FROM macaddr8_data WHERE a = 1; -- false +SELECT b > '08:00:2b:ff:fe:01:02:03' FROM macaddr8_data WHERE a = 1; -- false +SELECT b::macaddr <= '08:00:2b:01:02:04' FROM macaddr8_data WHERE a = 1; -- true +SELECT b::macaddr >= '08:00:2b:01:02:04' FROM macaddr8_data WHERE a = 1; -- false +SELECT b = '08:00:2b:ff:fe:01:02:03' FROM macaddr8_data WHERE a = 1; -- true +SELECT b::macaddr <> '08:00:2b:01:02:04'::macaddr FROM macaddr8_data WHERE a = 1; -- true +SELECT b::macaddr <> '08:00:2b:01:02:03'::macaddr FROM macaddr8_data WHERE a = 1; -- false + +SELECT b < '08:00:2b:01:02:03:04:06' FROM macaddr8_data WHERE a = 15; -- true +SELECT b > '08:00:2b:01:02:03:04:06' FROM macaddr8_data WHERE a = 15; -- false +SELECT b > '08:00:2b:01:02:03:04:05' FROM macaddr8_data WHERE a = 15; -- false +SELECT b <= '08:00:2b:01:02:03:04:06' FROM macaddr8_data WHERE a = 15; -- true +SELECT b >= '08:00:2b:01:02:03:04:06' FROM macaddr8_data WHERE a = 15; -- false +SELECT b = '08:00:2b:01:02:03:04:05' FROM macaddr8_data WHERE a = 15; -- true +SELECT b <> '08:00:2b:01:02:03:04:06' FROM macaddr8_data WHERE a = 15; -- true +SELECT b <> '08:00:2b:01:02:03:04:05' FROM macaddr8_data WHERE a = 15; -- false + +SELECT ~b FROM macaddr8_data; +SELECT b & '00:00:00:ff:ff:ff' FROM macaddr8_data; +SELECT b | '01:02:03:04:05:06' FROM macaddr8_data; + +DROP TABLE macaddr8_data; diff --git a/postgresql/examples/matview.sql b/postgresql/examples/matview.sql new file mode 100644 index 0000000..d96175a --- /dev/null +++ b/postgresql/examples/matview.sql @@ -0,0 +1,238 @@ +-- create a table to use as a basis for views and materialized views in various combinations +CREATE TABLE mvtest_t (id int NOT NULL PRIMARY KEY, type text NOT NULL, amt numeric NOT NULL); +INSERT INTO mvtest_t VALUES + (1, 'x', 2), + (2, 'x', 3), + (3, 'y', 5), + (4, 'y', 7), + (5, 'z', 11); + +-- we want a view based on the table, too, since views present additional challenges +CREATE VIEW mvtest_tv AS SELECT type, sum(amt) AS totamt FROM mvtest_t GROUP BY type; +SELECT * FROM mvtest_tv ORDER BY type; + +-- create a materialized view with no data, and confirm correct behavior +EXPLAIN (costs off) + CREATE MATERIALIZED VIEW mvtest_tm AS SELECT type, sum(amt) AS totamt FROM mvtest_t GROUP BY type WITH NO DATA; +CREATE MATERIALIZED VIEW mvtest_tm AS SELECT type, sum(amt) AS totamt FROM mvtest_t GROUP BY type WITH NO DATA; +SELECT relispopulated FROM pg_class WHERE oid = 'mvtest_tm'::regclass; +SELECT * FROM mvtest_tm ORDER BY type; +REFRESH MATERIALIZED VIEW mvtest_tm; +SELECT relispopulated FROM pg_class WHERE oid = 'mvtest_tm'::regclass; +CREATE UNIQUE INDEX mvtest_tm_type ON mvtest_tm (type); +SELECT * FROM mvtest_tm ORDER BY type; + +-- create various views +EXPLAIN (costs off) + CREATE MATERIALIZED VIEW mvtest_tvm AS SELECT * FROM mvtest_tv ORDER BY type; +CREATE MATERIALIZED VIEW mvtest_tvm AS SELECT * FROM mvtest_tv ORDER BY type; +SELECT * FROM mvtest_tvm; +CREATE MATERIALIZED VIEW mvtest_tmm AS SELECT sum(totamt) AS grandtot FROM mvtest_tm; +CREATE MATERIALIZED VIEW mvtest_tvmm AS SELECT sum(totamt) AS grandtot FROM mvtest_tvm; +CREATE UNIQUE INDEX mvtest_tvmm_expr ON mvtest_tvmm ((grandtot > 0)); +CREATE UNIQUE INDEX mvtest_tvmm_pred ON mvtest_tvmm (grandtot) WHERE grandtot < 0; +CREATE VIEW mvtest_tvv AS SELECT sum(totamt) AS grandtot FROM mvtest_tv; +EXPLAIN (costs off) + CREATE MATERIALIZED VIEW mvtest_tvvm AS SELECT * FROM mvtest_tvv; +CREATE MATERIALIZED VIEW mvtest_tvvm AS SELECT * FROM mvtest_tvv; +CREATE VIEW mvtest_tvvmv AS SELECT * FROM mvtest_tvvm; +CREATE MATERIALIZED VIEW mvtest_bb AS SELECT * FROM mvtest_tvvmv; +CREATE INDEX mvtest_aa ON mvtest_bb (grandtot); + +-- check that plans seem reasonable +\d+ mvtest_tvm +\d+ mvtest_tvm +\d+ mvtest_tvvm +\d+ mvtest_bb + +-- test schema behavior +CREATE SCHEMA mvtest_mvschema; +ALTER MATERIALIZED VIEW mvtest_tvm SET SCHEMA mvtest_mvschema; +\d+ mvtest_tvm +\d+ mvtest_tvmm +SET search_path = mvtest_mvschema, public; +\d+ mvtest_tvm + +-- modify the underlying table data +INSERT INTO mvtest_t VALUES (6, 'z', 13); + +-- confirm pre- and post-refresh contents of fairly simple materialized views +SELECT * FROM mvtest_tm ORDER BY type; +SELECT * FROM mvtest_tvm ORDER BY type; +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_tm; +REFRESH MATERIALIZED VIEW mvtest_tvm; +SELECT * FROM mvtest_tm ORDER BY type; +SELECT * FROM mvtest_tvm ORDER BY type; +RESET search_path; + +-- confirm pre- and post-refresh contents of nested materialized views +EXPLAIN (costs off) + SELECT * FROM mvtest_tmm; +EXPLAIN (costs off) + SELECT * FROM mvtest_tvmm; +EXPLAIN (costs off) + SELECT * FROM mvtest_tvvm; +SELECT * FROM mvtest_tmm; +SELECT * FROM mvtest_tvmm; +SELECT * FROM mvtest_tvvm; +REFRESH MATERIALIZED VIEW mvtest_tmm; +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_tvmm; +REFRESH MATERIALIZED VIEW mvtest_tvmm; +REFRESH MATERIALIZED VIEW mvtest_tvvm; +EXPLAIN (costs off) + SELECT * FROM mvtest_tmm; +EXPLAIN (costs off) + SELECT * FROM mvtest_tvmm; +EXPLAIN (costs off) + SELECT * FROM mvtest_tvvm; +SELECT * FROM mvtest_tmm; +SELECT * FROM mvtest_tvmm; +SELECT * FROM mvtest_tvvm; + +-- test diemv when the mv does not exist +DROP MATERIALIZED VIEW IF EXISTS no_such_mv; + +-- make sure invalid combination of options is prohibited +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_tvmm WITH NO DATA; + +-- no tuple locks on materialized views +SELECT * FROM mvtest_tvvm FOR SHARE; + +-- test join of mv and view +SELECT type, m.totamt AS mtot, v.totamt AS vtot FROM mvtest_tm m LEFT JOIN mvtest_tv v USING (type) ORDER BY type; + +-- make sure that dependencies are reported properly when they block the drop +DROP TABLE mvtest_t; + +-- make sure dependencies are dropped and reported +-- and make sure that transactional behavior is correct on rollback +-- incidentally leaving some interesting materialized views for pg_dump testing +BEGIN; +DROP TABLE mvtest_t CASCADE; +ROLLBACK; + +-- some additional tests not using base tables +CREATE VIEW mvtest_vt1 AS SELECT 1 moo; +CREATE VIEW mvtest_vt2 AS SELECT moo, 2*moo FROM mvtest_vt1 UNION ALL SELECT moo, 3*moo FROM mvtest_vt1; +\d+ mvtest_vt2 +CREATE MATERIALIZED VIEW mv_test2 AS SELECT moo, 2*moo FROM mvtest_vt2 UNION ALL SELECT moo, 3*moo FROM mvtest_vt2; +\d+ mv_test2 +CREATE MATERIALIZED VIEW mv_test3 AS SELECT * FROM mv_test2 WHERE moo = 12345; +SELECT relispopulated FROM pg_class WHERE oid = 'mv_test3'::regclass; + +DROP VIEW mvtest_vt1 CASCADE; + +-- test that duplicate values on unique index prevent refresh +CREATE TABLE mvtest_foo(a, b) AS VALUES(1, 10); +CREATE MATERIALIZED VIEW mvtest_mv AS SELECT * FROM mvtest_foo; +CREATE UNIQUE INDEX ON mvtest_mv(a); +INSERT INTO mvtest_foo SELECT * FROM mvtest_foo; +REFRESH MATERIALIZED VIEW mvtest_mv; +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_mv; +DROP TABLE mvtest_foo CASCADE; + +-- make sure that all columns covered by unique indexes works +CREATE TABLE mvtest_foo(a, b, c) AS VALUES(1, 2, 3); +CREATE MATERIALIZED VIEW mvtest_mv AS SELECT * FROM mvtest_foo; +CREATE UNIQUE INDEX ON mvtest_mv (a); +CREATE UNIQUE INDEX ON mvtest_mv (b); +CREATE UNIQUE INDEX on mvtest_mv (c); +INSERT INTO mvtest_foo VALUES(2, 3, 4); +INSERT INTO mvtest_foo VALUES(3, 4, 5); +REFRESH MATERIALIZED VIEW mvtest_mv; +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_mv; +DROP TABLE mvtest_foo CASCADE; + +-- allow subquery to reference unpopulated matview if WITH NO DATA is specified +CREATE MATERIALIZED VIEW mvtest_mv1 AS SELECT 1 AS col1 WITH NO DATA; +CREATE MATERIALIZED VIEW mvtest_mv2 AS SELECT * FROM mvtest_mv1 + WHERE col1 = (SELECT LEAST(col1) FROM mvtest_mv1) WITH NO DATA; +DROP MATERIALIZED VIEW mvtest_mv1 CASCADE; + +-- make sure that types with unusual equality tests work +CREATE TABLE mvtest_boxes (id serial primary key, b box); +INSERT INTO mvtest_boxes (b) VALUES + ('(32,32),(31,31)'), + ('(2.0000004,2.0000004),(1,1)'), + ('(1.9999996,1.9999996),(1,1)'); +CREATE MATERIALIZED VIEW mvtest_boxmv AS SELECT * FROM mvtest_boxes; +CREATE UNIQUE INDEX mvtest_boxmv_id ON mvtest_boxmv (id); +UPDATE mvtest_boxes SET b = '(2,2),(1,1)' WHERE id = 2; +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_boxmv; +SELECT * FROM mvtest_boxmv ORDER BY id; +DROP TABLE mvtest_boxes CASCADE; + +-- make sure that column names are handled correctly +CREATE TABLE mvtest_v (i int, j int); +CREATE MATERIALIZED VIEW mvtest_mv_v (ii, jj, kk) AS SELECT i, j FROM mvtest_v; -- error +CREATE MATERIALIZED VIEW mvtest_mv_v (ii, jj) AS SELECT i, j FROM mvtest_v; -- ok +CREATE MATERIALIZED VIEW mvtest_mv_v_2 (ii) AS SELECT i, j FROM mvtest_v; -- ok +CREATE MATERIALIZED VIEW mvtest_mv_v_3 (ii, jj, kk) AS SELECT i, j FROM mvtest_v WITH NO DATA; -- error +CREATE MATERIALIZED VIEW mvtest_mv_v_3 (ii, jj) AS SELECT i, j FROM mvtest_v WITH NO DATA; -- ok +CREATE MATERIALIZED VIEW mvtest_mv_v_4 (ii) AS SELECT i, j FROM mvtest_v WITH NO DATA; -- ok +ALTER TABLE mvtest_v RENAME COLUMN i TO x; +INSERT INTO mvtest_v values (1, 2); +CREATE UNIQUE INDEX mvtest_mv_v_ii ON mvtest_mv_v (ii); +REFRESH MATERIALIZED VIEW mvtest_mv_v; +UPDATE mvtest_v SET j = 3 WHERE x = 1; +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_mv_v; +REFRESH MATERIALIZED VIEW mvtest_mv_v_2; +REFRESH MATERIALIZED VIEW mvtest_mv_v_3; +REFRESH MATERIALIZED VIEW mvtest_mv_v_4; +SELECT * FROM mvtest_v; +SELECT * FROM mvtest_mv_v; +SELECT * FROM mvtest_mv_v_2; +SELECT * FROM mvtest_mv_v_3; +SELECT * FROM mvtest_mv_v_4; +DROP TABLE mvtest_v CASCADE; + +-- Check that unknown literals are converted to "text" in CREATE MATVIEW, +-- so that we don't end up with unknown-type columns. +CREATE MATERIALIZED VIEW mv_unspecified_types AS + SELECT 42 as i, 42.5 as num, 'foo' as u, 'foo'::unknown as u2, null as n; +\d+ mv_unspecified_types +SELECT * FROM mv_unspecified_types; +DROP MATERIALIZED VIEW mv_unspecified_types; + +-- make sure that create WITH NO DATA does not plan the query (bug #13907) +create materialized view mvtest_error as select 1/0 as x; -- fail +create materialized view mvtest_error as select 1/0 as x with no data; +refresh materialized view mvtest_error; -- fail here +drop materialized view mvtest_error; + +-- make sure that matview rows can be referenced as source rows (bug #9398) +CREATE TABLE mvtest_v AS SELECT generate_series(1,10) AS a; +CREATE MATERIALIZED VIEW mvtest_mv_v AS SELECT a FROM mvtest_v WHERE a <= 5; +DELETE FROM mvtest_v WHERE EXISTS ( SELECT * FROM mvtest_mv_v WHERE mvtest_mv_v.a = mvtest_v.a ); +SELECT * FROM mvtest_v; +SELECT * FROM mvtest_mv_v; +DROP TABLE mvtest_v CASCADE; + +-- make sure running as superuser works when MV owned by another role (bug #11208) +CREATE ROLE regress_user_mvtest; +SET ROLE regress_user_mvtest; +CREATE TABLE mvtest_foo_data AS SELECT i, md5(random()::text) + FROM generate_series(1, 10) i; +CREATE MATERIALIZED VIEW mvtest_mv_foo AS SELECT * FROM mvtest_foo_data; +CREATE MATERIALIZED VIEW mvtest_mv_foo AS SELECT * FROM mvtest_foo_data; +CREATE MATERIALIZED VIEW IF NOT EXISTS mvtest_mv_foo AS SELECT * FROM mvtest_foo_data; +CREATE UNIQUE INDEX ON mvtest_mv_foo (i); +RESET ROLE; +REFRESH MATERIALIZED VIEW mvtest_mv_foo; +REFRESH MATERIALIZED VIEW CONCURRENTLY mvtest_mv_foo; +DROP OWNED BY regress_user_mvtest CASCADE; +DROP ROLE regress_user_mvtest; + +-- make sure that create WITH NO DATA works via SPI +BEGIN; +CREATE FUNCTION mvtest_func() + RETURNS void AS $$ +BEGIN + CREATE MATERIALIZED VIEW mvtest1 AS SELECT 1 AS x; + CREATE MATERIALIZED VIEW mvtest2 AS SELECT 1 AS x WITH NO DATA; +END; +$$ LANGUAGE plpgsql; +SELECT mvtest_func(); +SELECT * FROM mvtest1; +SELECT * FROM mvtest2; +ROLLBACK; diff --git a/postgresql/examples/merge.sql b/postgresql/examples/merge.sql new file mode 100644 index 0000000..1394e7a --- /dev/null +++ b/postgresql/examples/merge.sql @@ -0,0 +1,27 @@ +MERGE INTO customer_account ca +USING recent_transactions t +ON t.customer_id = ca.customer_id +WHEN MATCHED THEN + UPDATE SET balance = balance + transaction_value +WHEN NOT MATCHED THEN + INSERT (customer_id, balance) + VALUES (t.customer_id, t.transaction_value); + +MERGE INTO customer_account ca +USING (SELECT customer_id, transaction_value FROM recent_transactions) AS t +ON t.customer_id = ca.customer_id +WHEN MATCHED THEN + UPDATE SET balance = balance + transaction_value +WHEN NOT MATCHED THEN + INSERT (customer_id, balance) + VALUES (t.customer_id, t.transaction_value); + +MERGE INTO wines w +USING wine_stock_changes s +ON s.winename = w.winename +WHEN NOT MATCHED AND s.stock_delta > 0 THEN + INSERT VALUES(s.winename, s.stock_delta) +WHEN MATCHED AND w.stock + s.stock_delta > 0 THEN + UPDATE SET stock = w.stock + s.stock_delta +WHEN MATCHED THEN + DELETE; \ No newline at end of file diff --git a/postgresql/examples/misc_functions.sql b/postgresql/examples/misc_functions.sql new file mode 100644 index 0000000..1619637 --- /dev/null +++ b/postgresql/examples/misc_functions.sql @@ -0,0 +1,97 @@ +-- +-- num_nulls() +-- + +SELECT num_nonnulls(NULL); +SELECT num_nonnulls('1'); +SELECT num_nonnulls(NULL::text); +SELECT num_nonnulls(NULL::text, NULL::int); +SELECT num_nonnulls(1, 2, NULL::text, NULL::point, '', int8 '9', 1.0 / NULL); +SELECT num_nonnulls(VARIADIC '{1,2,NULL,3}'::int[]); +SELECT num_nonnulls(VARIADIC '{"1","2","3","4"}'::text[]); +SELECT num_nonnulls(VARIADIC ARRAY(SELECT CASE WHEN i <> 40 THEN i END FROM generate_series(1, 100) i)); + +SELECT num_nulls(NULL); +SELECT num_nulls('1'); +SELECT num_nulls(NULL::text); +SELECT num_nulls(NULL::text, NULL::int); +SELECT num_nulls(1, 2, NULL::text, NULL::point, '', int8 '9', 1.0 / NULL); +SELECT num_nulls(VARIADIC '{1,2,NULL,3}'::int[]); +SELECT num_nulls(VARIADIC '{"1","2","3","4"}'::text[]); +SELECT num_nulls(VARIADIC ARRAY(SELECT CASE WHEN i <> 40 THEN i END FROM generate_series(1, 100) i)); + +-- special cases +SELECT num_nonnulls(VARIADIC NULL::text[]); +SELECT num_nonnulls(VARIADIC '{}'::int[]); +SELECT num_nulls(VARIADIC NULL::text[]); +SELECT num_nulls(VARIADIC '{}'::int[]); + +-- should fail, one or more arguments is required +SELECT num_nonnulls(); +SELECT num_nulls(); + +-- +-- Test some built-in SRFs +-- +-- The outputs of these are variable, so we can't just print their results +-- directly, but we can at least verify that the code doesn't fail. +-- + +select count(*) > 0 as ok from pg_ls_waldir(); +-- Test ProjectSet as well as FunctionScan +select count(*) > 0 as ok from (select pg_ls_waldir()) ss; +-- Test not-run-to-completion cases. +select * from pg_ls_waldir() limit 0; +select count(*) > 0 as ok from (select * from pg_ls_waldir() limit 1) ss; + +select count(*) >= 0 as ok from pg_ls_archive_statusdir(); + +select * from (select pg_ls_dir('.') a) a where a = 'base' limit 1; + +select * from (select (pg_timezone_names()).name) ptn where name='UTC' limit 1; + +select count(*) > 0 from + (select pg_tablespace_databases(oid) as pts from pg_tablespace + where spcname = 'pg_default') pts + join pg_database db on pts.pts = db.oid; + +-- +-- Test adding a support function to a subject function +-- + +CREATE FUNCTION my_int_eq(int, int) RETURNS bool + LANGUAGE internal STRICT IMMUTABLE PARALLEL SAFE + AS $$int4eq$$; + +-- By default, planner does not think that's selective +EXPLAIN (COSTS OFF) +SELECT * FROM tenk1 a JOIN tenk1 b ON a.unique1 = b.unique1 +WHERE my_int_eq(a.unique2, 42); + +-- With support function that knows it's int4eq, we get a different plan +ALTER FUNCTION my_int_eq(int, int) SUPPORT test_support_func; + +EXPLAIN (COSTS OFF) +SELECT * FROM tenk1 a JOIN tenk1 b ON a.unique1 = b.unique1 +WHERE my_int_eq(a.unique2, 42); + +-- Also test non-default rowcount estimate +CREATE FUNCTION my_gen_series(int, int) RETURNS SETOF integer + LANGUAGE internal STRICT IMMUTABLE PARALLEL SAFE + AS $$generate_series_int4$$ + SUPPORT test_support_func; + +EXPLAIN (COSTS OFF) +SELECT * FROM tenk1 a JOIN my_gen_series(1,1000) g ON a.unique1 = g; + +EXPLAIN (COSTS OFF) +SELECT * FROM tenk1 a JOIN my_gen_series(1,10) g ON a.unique1 = g; +select setting as segsize +from pg_settings where name = 'wal_segment_size' +\gset + +select 1; + +select (w).size = :segsize as ok +from (select pg_ls_waldir() w) ss where length((w).name) = 24 limit 1; + diff --git a/postgresql/examples/misc_sanity.sql b/postgresql/examples/misc_sanity.sql new file mode 100644 index 0000000..3ce32e4 --- /dev/null +++ b/postgresql/examples/misc_sanity.sql @@ -0,0 +1,96 @@ +-- +-- MISC_SANITY +-- Sanity checks for common errors in making system tables that don't fit +-- comfortably into either opr_sanity or type_sanity. +-- +-- Every test failure in this file should be closely inspected. +-- The description of the failing test should be read carefully before +-- adjusting the expected output. In most cases, the queries should +-- not find *any* matching entries. +-- +-- NB: run this test early, because some later tests create bogus entries. + + +-- **************** pg_depend **************** + +-- Look for illegal values in pg_depend fields. +-- classid/objid can be zero, but only in 'p' entries + +SELECT * +FROM pg_depend as d1 +WHERE refclassid = 0 OR refobjid = 0 OR + deptype NOT IN ('a', 'e', 'i', 'n', 'p') OR + (deptype != 'p' AND (classid = 0 OR objid = 0)) OR + (deptype = 'p' AND (classid != 0 OR objid != 0 OR objsubid != 0)); + +-- **************** pg_shdepend **************** + +-- Look for illegal values in pg_shdepend fields. +-- classid/objid can be zero, but only in 'p' entries + +SELECT * +FROM pg_shdepend as d1 +WHERE refclassid = 0 OR refobjid = 0 OR + deptype NOT IN ('a', 'o', 'p', 'r') OR + (deptype != 'p' AND (classid = 0 OR objid = 0)) OR + (deptype = 'p' AND (dbid != 0 OR classid != 0 OR objid != 0 OR objsubid != 0)); + + +-- Check each OID-containing system catalog to see if its lowest-numbered OID +-- is pinned. If not, and if that OID was generated during initdb, then +-- perhaps initdb forgot to scan that catalog for pinnable entries. +-- Generally, it's okay for a catalog to be listed in the output of this +-- test if that catalog is scanned by initdb.c's setup_depend() function; +-- whatever OID the test is complaining about must have been added later +-- in initdb, where it intentionally isn't pinned. Legitimate exceptions +-- to that rule are listed in the comments in setup_depend(). + +do $$ +declare relnm text; + reloid oid; + shared bool; + lowoid oid; + pinned bool; +begin +for relnm, reloid, shared in + select relname, oid, relisshared from pg_class + where EXISTS( + SELECT * FROM pg_attribute + WHERE attrelid = pg_class.oid AND attname = 'oid') + and relkind = 'r' and oid < 16384 order by 1 +loop + execute 'select min(oid) from ' || relnm into lowoid; + continue when lowoid is null or lowoid >= 16384; + if shared then + pinned := exists(select 1 from pg_shdepend + where refclassid = reloid and refobjid = lowoid + and deptype = 'p'); + else + pinned := exists(select 1 from pg_depend + where refclassid = reloid and refobjid = lowoid + and deptype = 'p'); + end if; + if not pinned then + raise notice '% contains unpinned initdb-created object(s)', relnm; + end if; +end loop; +end$$; + +-- **************** pg_class **************** + +-- Look for system tables with varlena columns but no toast table. All +-- system tables with toastable columns should have toast tables, with +-- the following exceptions: +-- 1. pg_class, pg_attribute, and pg_index, due to fear of recursive +-- dependencies as toast tables depend on them. +-- 2. pg_largeobject and pg_largeobject_metadata. Large object catalogs +-- and toast tables are mutually exclusive and large object data is handled +-- as user data by pg_upgrade, which would cause failures. + +SELECT relname, attname, atttypid::regtype +FROM pg_class c JOIN pg_attribute a ON c.oid = attrelid +WHERE c.oid < 16384 AND + reltoastrelid = 0 AND + relkind = 'r' AND + attstorage != 'p' +ORDER BY 1, 2; diff --git a/postgresql/examples/money.sql b/postgresql/examples/money.sql new file mode 100644 index 0000000..5e74628 --- /dev/null +++ b/postgresql/examples/money.sql @@ -0,0 +1,131 @@ +-- +-- MONEY +-- +-- Note that we assume lc_monetary has been set to C. +-- + +CREATE TABLE money_data (m money); + +INSERT INTO money_data VALUES ('123'); +SELECT * FROM money_data; +SELECT m + '123' FROM money_data; +SELECT m + '123.45' FROM money_data; +SELECT m - '123.45' FROM money_data; +SELECT m / '2'::money FROM money_data; +SELECT m * 2 FROM money_data; +SELECT 2 * m FROM money_data; +SELECT m / 2 FROM money_data; +SELECT m * 2::int2 FROM money_data; +SELECT 2::int2 * m FROM money_data; +SELECT m / 2::int2 FROM money_data; +SELECT m * 2::int8 FROM money_data; +SELECT 2::int8 * m FROM money_data; +SELECT m / 2::int8 FROM money_data; +SELECT m * 2::float8 FROM money_data; +SELECT 2::float8 * m FROM money_data; +SELECT m / 2::float8 FROM money_data; +SELECT m * 2::float4 FROM money_data; +SELECT 2::float4 * m FROM money_data; +SELECT m / 2::float4 FROM money_data; + +-- All true +SELECT m = '$123.00' FROM money_data; +SELECT m != '$124.00' FROM money_data; +SELECT m <= '$123.00' FROM money_data; +SELECT m >= '$123.00' FROM money_data; +SELECT m < '$124.00' FROM money_data; +SELECT m > '$122.00' FROM money_data; + +-- All false +SELECT m = '$123.01' FROM money_data; +SELECT m != '$123.00' FROM money_data; +SELECT m <= '$122.99' FROM money_data; +SELECT m >= '$123.01' FROM money_data; +SELECT m > '$124.00' FROM money_data; +SELECT m < '$122.00' FROM money_data; + +SELECT cashlarger(m, '$124.00') FROM money_data; +SELECT cashsmaller(m, '$124.00') FROM money_data; +SELECT cash_words(m) FROM money_data; +SELECT cash_words(m + '1.23') FROM money_data; + +DELETE FROM money_data; +INSERT INTO money_data VALUES ('$123.45'); +SELECT * FROM money_data; + +DELETE FROM money_data; +INSERT INTO money_data VALUES ('$123.451'); +SELECT * FROM money_data; + +DELETE FROM money_data; +INSERT INTO money_data VALUES ('$123.454'); +SELECT * FROM money_data; + +DELETE FROM money_data; +INSERT INTO money_data VALUES ('$123.455'); +SELECT * FROM money_data; + +DELETE FROM money_data; +INSERT INTO money_data VALUES ('$123.456'); +SELECT * FROM money_data; + +DELETE FROM money_data; +INSERT INTO money_data VALUES ('$123.459'); +SELECT * FROM money_data; + +-- input checks +SELECT '1234567890'::money; +SELECT '12345678901234567'::money; +SELECT '123456789012345678'::money; +SELECT '9223372036854775807'::money; +SELECT '-12345'::money; +SELECT '-1234567890'::money; +SELECT '-12345678901234567'::money; +SELECT '-123456789012345678'::money; +SELECT '-9223372036854775808'::money; + +-- special characters +SELECT '(1)'::money; +SELECT '($123,456.78)'::money; + +-- documented minimums and maximums +SELECT '-92233720368547758.08'::money; +SELECT '92233720368547758.07'::money; + +SELECT '-92233720368547758.09'::money; +SELECT '92233720368547758.08'::money; + +-- rounding +SELECT '-92233720368547758.085'::money; +SELECT '92233720368547758.075'::money; + +-- rounding vs. truncation in division +SELECT '878.08'::money / 11::float8; +SELECT '878.08'::money / 11::float4; +SELECT '878.08'::money / 11::bigint; +SELECT '878.08'::money / 11::int; +SELECT '878.08'::money / 11::smallint; + +-- check for precision loss in division +SELECT '90000000000000099.00'::money / 10::bigint; +SELECT '90000000000000099.00'::money / 10::int; +SELECT '90000000000000099.00'::money / 10::smallint; + +-- Cast int4/int8/numeric to money +SELECT 1234567890::money; +SELECT 12345678901234567::money; +SELECT (-12345)::money; +SELECT (-1234567890)::money; +SELECT (-12345678901234567)::money; +SELECT 1234567890::int4::money; +SELECT 12345678901234567::int8::money; +SELECT 12345678901234567::numeric::money; +SELECT (-1234567890)::int4::money; +SELECT (-12345678901234567)::int8::money; +SELECT (-12345678901234567)::numeric::money; + +-- Cast from money to numeric +SELECT '12345678901234567'::money::numeric; +SELECT '-12345678901234567'::money::numeric; +SELECT '92233720368547758.07'::money::numeric; +SELECT '-92233720368547758.08'::money::numeric; diff --git a/postgresql/examples/name.sql b/postgresql/examples/name.sql new file mode 100644 index 0000000..602bf26 --- /dev/null +++ b/postgresql/examples/name.sql @@ -0,0 +1,87 @@ +-- +-- NAME +-- all inputs are silently truncated at NAMEDATALEN-1 (63) characters +-- + +-- fixed-length by reference +SELECT name 'name string' = name 'name string' AS "True"; + +SELECT name 'name string' = name 'name string ' AS "False"; + +-- +-- +-- + +CREATE TABLE NAME_TBL(f1 name); + +INSERT INTO NAME_TBL(f1) VALUES ('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'); + +INSERT INTO NAME_TBL(f1) VALUES ('1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqr'); + +INSERT INTO NAME_TBL(f1) VALUES ('asdfghjkl;'); + +INSERT INTO NAME_TBL(f1) VALUES ('343f%2a'); + +INSERT INTO NAME_TBL(f1) VALUES ('d34aaasdf'); + +INSERT INTO NAME_TBL(f1) VALUES (''); + +INSERT INTO NAME_TBL(f1) VALUES ('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'); + + +SELECT '' AS seven, * FROM NAME_TBL; + +SELECT '' AS six, c.f1 FROM NAME_TBL c WHERE c.f1 <> '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; + +SELECT '' AS one, c.f1 FROM NAME_TBL c WHERE c.f1 = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; + +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 < '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; + +SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 <= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; + +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 > '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; + +SELECT '' AS four, c.f1 FROM NAME_TBL c WHERE c.f1 >= '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQR'; + +SELECT '' AS seven, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*'; + +SELECT '' AS zero, c.f1 FROM NAME_TBL c WHERE c.f1 !~ '.*'; + +SELECT '' AS three, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '[0-9]'; + +SELECT '' AS two, c.f1 FROM NAME_TBL c WHERE c.f1 ~ '.*asdf.*'; + +DROP TABLE NAME_TBL; + +DO $$ +DECLARE r text[]; +BEGIN + r := parse_ident('Schemax.Tabley'); + RAISE NOTICE '%', format('%I.%I', r[1], r[2]); + r := parse_ident('"SchemaX"."TableY"'); + RAISE NOTICE '%', format('%I.%I', r[1], r[2]); +END; +$$; + +SELECT parse_ident('foo.boo'); +SELECT parse_ident('foo.boo[]'); -- should fail +SELECT parse_ident('foo.boo[]', strict => false); -- ok + +-- should fail +SELECT parse_ident(' '); +SELECT parse_ident(' .aaa'); +SELECT parse_ident(' aaa . '); +SELECT parse_ident('aaa.a%b'); +SELECT parse_ident(E'X\rXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); + +SELECT length(a[1]), length(a[2]) from parse_ident('"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy') as a ; + +SELECT parse_ident(' first . " second " ." third ". " ' || repeat('x',66) || '"'); +SELECT parse_ident(' first . " second " ." third ". " ' || repeat('x',66) || '"')::name[]; + +SELECT parse_ident(E'"c".X XXXX\002XXXXXX'); +SELECT parse_ident('1020'); +SELECT parse_ident('10.20'); +SELECT parse_ident('.'); +SELECT parse_ident('.1020'); +SELECT parse_ident('xxx.1020'); diff --git a/postgresql/examples/namespace.sql b/postgresql/examples/namespace.sql new file mode 100644 index 0000000..6b12c96 --- /dev/null +++ b/postgresql/examples/namespace.sql @@ -0,0 +1,44 @@ +-- +-- Regression tests for schemas (namespaces) +-- + +CREATE SCHEMA test_ns_schema_1 + CREATE UNIQUE INDEX abc_a_idx ON abc (a) + + CREATE VIEW abc_view AS + SELECT a+1 AS a, b+1 AS b FROM abc + + CREATE TABLE abc ( + a serial, + b int UNIQUE + ); + +-- verify that the objects were created +SELECT COUNT(*) FROM pg_class WHERE relnamespace = + (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1'); + +INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; +INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; +INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; + +SELECT * FROM test_ns_schema_1.abc; +SELECT * FROM test_ns_schema_1.abc_view; + +ALTER SCHEMA test_ns_schema_1 RENAME TO test_ns_schema_renamed; +SELECT COUNT(*) FROM pg_class WHERE relnamespace = + (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1'); + +-- test IF NOT EXISTS cases +CREATE SCHEMA test_ns_schema_renamed; -- fail, already exists +CREATE SCHEMA IF NOT EXISTS test_ns_schema_renamed; -- ok with notice +CREATE SCHEMA IF NOT EXISTS test_ns_schema_renamed -- fail, disallowed + CREATE TABLE abc ( + a serial, + b int UNIQUE + ); + +DROP SCHEMA test_ns_schema_renamed CASCADE; + +-- verify that the objects were dropped +SELECT COUNT(*) FROM pg_class WHERE relnamespace = + (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_renamed'); diff --git a/postgresql/examples/non_ansi_join.sql b/postgresql/examples/non_ansi_join.sql new file mode 100644 index 0000000..d126f34 --- /dev/null +++ b/postgresql/examples/non_ansi_join.sql @@ -0,0 +1,5 @@ +SELECT a.au_id, t.titlr e +FROM titles AS t, authors AS a, titleauthor AS ta +WHERE a.au_id = ta.au_id +AND ta.title_id = t.title_id +AND t.title LIKE 'Example%' \ No newline at end of file diff --git a/postgresql/examples/numeric.sql b/postgresql/examples/numeric.sql new file mode 100644 index 0000000..c586da1 --- /dev/null +++ b/postgresql/examples/numeric.sql @@ -0,0 +1,1318 @@ +-- +-- NUMERIC +-- + +CREATE TABLE num_data (id int4, val numeric(210,10)); +CREATE TABLE num_exp_add (id1 int4, id2 int4, expected numeric(210,10)); +CREATE TABLE num_exp_sub (id1 int4, id2 int4, expected numeric(210,10)); +CREATE TABLE num_exp_div (id1 int4, id2 int4, expected numeric(210,10)); +CREATE TABLE num_exp_mul (id1 int4, id2 int4, expected numeric(210,10)); +CREATE TABLE num_exp_sqrt (id int4, expected numeric(210,10)); +CREATE TABLE num_exp_ln (id int4, expected numeric(210,10)); +CREATE TABLE num_exp_log10 (id int4, expected numeric(210,10)); +CREATE TABLE num_exp_power_10_ln (id int4, expected numeric(210,10)); + +CREATE TABLE num_result (id1 int4, id2 int4, result numeric(210,10)); + + +-- ****************************** +-- * The following EXPECTED results are computed by bc(1) +-- * with a scale of 200 +-- ****************************** + +BEGIN TRANSACTION; +INSERT INTO num_exp_add VALUES (0,0,'0'); +INSERT INTO num_exp_sub VALUES (0,0,'0'); +INSERT INTO num_exp_mul VALUES (0,0,'0'); +INSERT INTO num_exp_div VALUES (0,0,'NaN'); +INSERT INTO num_exp_add VALUES (0,1,'0'); +INSERT INTO num_exp_sub VALUES (0,1,'0'); +INSERT INTO num_exp_mul VALUES (0,1,'0'); +INSERT INTO num_exp_div VALUES (0,1,'NaN'); +INSERT INTO num_exp_add VALUES (0,2,'-34338492.215397047'); +INSERT INTO num_exp_sub VALUES (0,2,'34338492.215397047'); +INSERT INTO num_exp_mul VALUES (0,2,'0'); +INSERT INTO num_exp_div VALUES (0,2,'0'); +INSERT INTO num_exp_add VALUES (0,3,'4.31'); +INSERT INTO num_exp_sub VALUES (0,3,'-4.31'); +INSERT INTO num_exp_mul VALUES (0,3,'0'); +INSERT INTO num_exp_div VALUES (0,3,'0'); +INSERT INTO num_exp_add VALUES (0,4,'7799461.4119'); +INSERT INTO num_exp_sub VALUES (0,4,'-7799461.4119'); +INSERT INTO num_exp_mul VALUES (0,4,'0'); +INSERT INTO num_exp_div VALUES (0,4,'0'); +INSERT INTO num_exp_add VALUES (0,5,'16397.038491'); +INSERT INTO num_exp_sub VALUES (0,5,'-16397.038491'); +INSERT INTO num_exp_mul VALUES (0,5,'0'); +INSERT INTO num_exp_div VALUES (0,5,'0'); +INSERT INTO num_exp_add VALUES (0,6,'93901.57763026'); +INSERT INTO num_exp_sub VALUES (0,6,'-93901.57763026'); +INSERT INTO num_exp_mul VALUES (0,6,'0'); +INSERT INTO num_exp_div VALUES (0,6,'0'); +INSERT INTO num_exp_add VALUES (0,7,'-83028485'); +INSERT INTO num_exp_sub VALUES (0,7,'83028485'); +INSERT INTO num_exp_mul VALUES (0,7,'0'); +INSERT INTO num_exp_div VALUES (0,7,'0'); +INSERT INTO num_exp_add VALUES (0,8,'74881'); +INSERT INTO num_exp_sub VALUES (0,8,'-74881'); +INSERT INTO num_exp_mul VALUES (0,8,'0'); +INSERT INTO num_exp_div VALUES (0,8,'0'); +INSERT INTO num_exp_add VALUES (0,9,'-24926804.045047420'); +INSERT INTO num_exp_sub VALUES (0,9,'24926804.045047420'); +INSERT INTO num_exp_mul VALUES (0,9,'0'); +INSERT INTO num_exp_div VALUES (0,9,'0'); +INSERT INTO num_exp_add VALUES (1,0,'0'); +INSERT INTO num_exp_sub VALUES (1,0,'0'); +INSERT INTO num_exp_mul VALUES (1,0,'0'); +INSERT INTO num_exp_div VALUES (1,0,'NaN'); +INSERT INTO num_exp_add VALUES (1,1,'0'); +INSERT INTO num_exp_sub VALUES (1,1,'0'); +INSERT INTO num_exp_mul VALUES (1,1,'0'); +INSERT INTO num_exp_div VALUES (1,1,'NaN'); +INSERT INTO num_exp_add VALUES (1,2,'-34338492.215397047'); +INSERT INTO num_exp_sub VALUES (1,2,'34338492.215397047'); +INSERT INTO num_exp_mul VALUES (1,2,'0'); +INSERT INTO num_exp_div VALUES (1,2,'0'); +INSERT INTO num_exp_add VALUES (1,3,'4.31'); +INSERT INTO num_exp_sub VALUES (1,3,'-4.31'); +INSERT INTO num_exp_mul VALUES (1,3,'0'); +INSERT INTO num_exp_div VALUES (1,3,'0'); +INSERT INTO num_exp_add VALUES (1,4,'7799461.4119'); +INSERT INTO num_exp_sub VALUES (1,4,'-7799461.4119'); +INSERT INTO num_exp_mul VALUES (1,4,'0'); +INSERT INTO num_exp_div VALUES (1,4,'0'); +INSERT INTO num_exp_add VALUES (1,5,'16397.038491'); +INSERT INTO num_exp_sub VALUES (1,5,'-16397.038491'); +INSERT INTO num_exp_mul VALUES (1,5,'0'); +INSERT INTO num_exp_div VALUES (1,5,'0'); +INSERT INTO num_exp_add VALUES (1,6,'93901.57763026'); +INSERT INTO num_exp_sub VALUES (1,6,'-93901.57763026'); +INSERT INTO num_exp_mul VALUES (1,6,'0'); +INSERT INTO num_exp_div VALUES (1,6,'0'); +INSERT INTO num_exp_add VALUES (1,7,'-83028485'); +INSERT INTO num_exp_sub VALUES (1,7,'83028485'); +INSERT INTO num_exp_mul VALUES (1,7,'0'); +INSERT INTO num_exp_div VALUES (1,7,'0'); +INSERT INTO num_exp_add VALUES (1,8,'74881'); +INSERT INTO num_exp_sub VALUES (1,8,'-74881'); +INSERT INTO num_exp_mul VALUES (1,8,'0'); +INSERT INTO num_exp_div VALUES (1,8,'0'); +INSERT INTO num_exp_add VALUES (1,9,'-24926804.045047420'); +INSERT INTO num_exp_sub VALUES (1,9,'24926804.045047420'); +INSERT INTO num_exp_mul VALUES (1,9,'0'); +INSERT INTO num_exp_div VALUES (1,9,'0'); +INSERT INTO num_exp_add VALUES (2,0,'-34338492.215397047'); +INSERT INTO num_exp_sub VALUES (2,0,'-34338492.215397047'); +INSERT INTO num_exp_mul VALUES (2,0,'0'); +INSERT INTO num_exp_div VALUES (2,0,'NaN'); +INSERT INTO num_exp_add VALUES (2,1,'-34338492.215397047'); +INSERT INTO num_exp_sub VALUES (2,1,'-34338492.215397047'); +INSERT INTO num_exp_mul VALUES (2,1,'0'); +INSERT INTO num_exp_div VALUES (2,1,'NaN'); +INSERT INTO num_exp_add VALUES (2,2,'-68676984.430794094'); +INSERT INTO num_exp_sub VALUES (2,2,'0'); +INSERT INTO num_exp_mul VALUES (2,2,'1179132047626883.596862135856320209'); +INSERT INTO num_exp_div VALUES (2,2,'1.00000000000000000000'); +INSERT INTO num_exp_add VALUES (2,3,'-34338487.905397047'); +INSERT INTO num_exp_sub VALUES (2,3,'-34338496.525397047'); +INSERT INTO num_exp_mul VALUES (2,3,'-147998901.44836127257'); +INSERT INTO num_exp_div VALUES (2,3,'-7967167.56737750510440835266'); +INSERT INTO num_exp_add VALUES (2,4,'-26539030.803497047'); +INSERT INTO num_exp_sub VALUES (2,4,'-42137953.627297047'); +INSERT INTO num_exp_mul VALUES (2,4,'-267821744976817.8111137106593'); +INSERT INTO num_exp_div VALUES (2,4,'-4.40267480046830116685'); +INSERT INTO num_exp_add VALUES (2,5,'-34322095.176906047'); +INSERT INTO num_exp_sub VALUES (2,5,'-34354889.253888047'); +INSERT INTO num_exp_mul VALUES (2,5,'-563049578578.769242506736077'); +INSERT INTO num_exp_div VALUES (2,5,'-2094.18866914563535496429'); +INSERT INTO num_exp_add VALUES (2,6,'-34244590.637766787'); +INSERT INTO num_exp_sub VALUES (2,6,'-34432393.793027307'); +INSERT INTO num_exp_mul VALUES (2,6,'-3224438592470.18449811926184222'); +INSERT INTO num_exp_div VALUES (2,6,'-365.68599891479766440940'); +INSERT INTO num_exp_add VALUES (2,7,'-117366977.215397047'); +INSERT INTO num_exp_sub VALUES (2,7,'48689992.784602953'); +INSERT INTO num_exp_mul VALUES (2,7,'2851072985828710.485883795'); +INSERT INTO num_exp_div VALUES (2,7,'.41357483778485235518'); +INSERT INTO num_exp_add VALUES (2,8,'-34263611.215397047'); +INSERT INTO num_exp_sub VALUES (2,8,'-34413373.215397047'); +INSERT INTO num_exp_mul VALUES (2,8,'-2571300635581.146276407'); +INSERT INTO num_exp_div VALUES (2,8,'-458.57416721727870888476'); +INSERT INTO num_exp_add VALUES (2,9,'-59265296.260444467'); +INSERT INTO num_exp_sub VALUES (2,9,'-9411688.170349627'); +INSERT INTO num_exp_mul VALUES (2,9,'855948866655588.453741509242968740'); +INSERT INTO num_exp_div VALUES (2,9,'1.37757299946438931811'); +INSERT INTO num_exp_add VALUES (3,0,'4.31'); +INSERT INTO num_exp_sub VALUES (3,0,'4.31'); +INSERT INTO num_exp_mul VALUES (3,0,'0'); +INSERT INTO num_exp_div VALUES (3,0,'NaN'); +INSERT INTO num_exp_add VALUES (3,1,'4.31'); +INSERT INTO num_exp_sub VALUES (3,1,'4.31'); +INSERT INTO num_exp_mul VALUES (3,1,'0'); +INSERT INTO num_exp_div VALUES (3,1,'NaN'); +INSERT INTO num_exp_add VALUES (3,2,'-34338487.905397047'); +INSERT INTO num_exp_sub VALUES (3,2,'34338496.525397047'); +INSERT INTO num_exp_mul VALUES (3,2,'-147998901.44836127257'); +INSERT INTO num_exp_div VALUES (3,2,'-.00000012551512084352'); +INSERT INTO num_exp_add VALUES (3,3,'8.62'); +INSERT INTO num_exp_sub VALUES (3,3,'0'); +INSERT INTO num_exp_mul VALUES (3,3,'18.5761'); +INSERT INTO num_exp_div VALUES (3,3,'1.00000000000000000000'); +INSERT INTO num_exp_add VALUES (3,4,'7799465.7219'); +INSERT INTO num_exp_sub VALUES (3,4,'-7799457.1019'); +INSERT INTO num_exp_mul VALUES (3,4,'33615678.685289'); +INSERT INTO num_exp_div VALUES (3,4,'.00000055260225961552'); +INSERT INTO num_exp_add VALUES (3,5,'16401.348491'); +INSERT INTO num_exp_sub VALUES (3,5,'-16392.728491'); +INSERT INTO num_exp_mul VALUES (3,5,'70671.23589621'); +INSERT INTO num_exp_div VALUES (3,5,'.00026285234387695504'); +INSERT INTO num_exp_add VALUES (3,6,'93905.88763026'); +INSERT INTO num_exp_sub VALUES (3,6,'-93897.26763026'); +INSERT INTO num_exp_mul VALUES (3,6,'404715.7995864206'); +INSERT INTO num_exp_div VALUES (3,6,'.00004589912234457595'); +INSERT INTO num_exp_add VALUES (3,7,'-83028480.69'); +INSERT INTO num_exp_sub VALUES (3,7,'83028489.31'); +INSERT INTO num_exp_mul VALUES (3,7,'-357852770.35'); +INSERT INTO num_exp_div VALUES (3,7,'-.00000005190989574240'); +INSERT INTO num_exp_add VALUES (3,8,'74885.31'); +INSERT INTO num_exp_sub VALUES (3,8,'-74876.69'); +INSERT INTO num_exp_mul VALUES (3,8,'322737.11'); +INSERT INTO num_exp_div VALUES (3,8,'.00005755799201399553'); +INSERT INTO num_exp_add VALUES (3,9,'-24926799.735047420'); +INSERT INTO num_exp_sub VALUES (3,9,'24926808.355047420'); +INSERT INTO num_exp_mul VALUES (3,9,'-107434525.43415438020'); +INSERT INTO num_exp_div VALUES (3,9,'-.00000017290624149854'); +INSERT INTO num_exp_add VALUES (4,0,'7799461.4119'); +INSERT INTO num_exp_sub VALUES (4,0,'7799461.4119'); +INSERT INTO num_exp_mul VALUES (4,0,'0'); +INSERT INTO num_exp_div VALUES (4,0,'NaN'); +INSERT INTO num_exp_add VALUES (4,1,'7799461.4119'); +INSERT INTO num_exp_sub VALUES (4,1,'7799461.4119'); +INSERT INTO num_exp_mul VALUES (4,1,'0'); +INSERT INTO num_exp_div VALUES (4,1,'NaN'); +INSERT INTO num_exp_add VALUES (4,2,'-26539030.803497047'); +INSERT INTO num_exp_sub VALUES (4,2,'42137953.627297047'); +INSERT INTO num_exp_mul VALUES (4,2,'-267821744976817.8111137106593'); +INSERT INTO num_exp_div VALUES (4,2,'-.22713465002993920385'); +INSERT INTO num_exp_add VALUES (4,3,'7799465.7219'); +INSERT INTO num_exp_sub VALUES (4,3,'7799457.1019'); +INSERT INTO num_exp_mul VALUES (4,3,'33615678.685289'); +INSERT INTO num_exp_div VALUES (4,3,'1809619.81714617169373549883'); +INSERT INTO num_exp_add VALUES (4,4,'15598922.8238'); +INSERT INTO num_exp_sub VALUES (4,4,'0'); +INSERT INTO num_exp_mul VALUES (4,4,'60831598315717.14146161'); +INSERT INTO num_exp_div VALUES (4,4,'1.00000000000000000000'); +INSERT INTO num_exp_add VALUES (4,5,'7815858.450391'); +INSERT INTO num_exp_sub VALUES (4,5,'7783064.373409'); +INSERT INTO num_exp_mul VALUES (4,5,'127888068979.9935054429'); +INSERT INTO num_exp_div VALUES (4,5,'475.66281046305802686061'); +INSERT INTO num_exp_add VALUES (4,6,'7893362.98953026'); +INSERT INTO num_exp_sub VALUES (4,6,'7705559.83426974'); +INSERT INTO num_exp_mul VALUES (4,6,'732381731243.745115764094'); +INSERT INTO num_exp_div VALUES (4,6,'83.05996138436129499606'); +INSERT INTO num_exp_add VALUES (4,7,'-75229023.5881'); +INSERT INTO num_exp_sub VALUES (4,7,'90827946.4119'); +INSERT INTO num_exp_mul VALUES (4,7,'-647577464846017.9715'); +INSERT INTO num_exp_div VALUES (4,7,'-.09393717604145131637'); +INSERT INTO num_exp_add VALUES (4,8,'7874342.4119'); +INSERT INTO num_exp_sub VALUES (4,8,'7724580.4119'); +INSERT INTO num_exp_mul VALUES (4,8,'584031469984.4839'); +INSERT INTO num_exp_div VALUES (4,8,'104.15808298366741897143'); +INSERT INTO num_exp_add VALUES (4,9,'-17127342.633147420'); +INSERT INTO num_exp_sub VALUES (4,9,'32726265.456947420'); +INSERT INTO num_exp_mul VALUES (4,9,'-194415646271340.1815956522980'); +INSERT INTO num_exp_div VALUES (4,9,'-.31289456112403769409'); +INSERT INTO num_exp_add VALUES (5,0,'16397.038491'); +INSERT INTO num_exp_sub VALUES (5,0,'16397.038491'); +INSERT INTO num_exp_mul VALUES (5,0,'0'); +INSERT INTO num_exp_div VALUES (5,0,'NaN'); +INSERT INTO num_exp_add VALUES (5,1,'16397.038491'); +INSERT INTO num_exp_sub VALUES (5,1,'16397.038491'); +INSERT INTO num_exp_mul VALUES (5,1,'0'); +INSERT INTO num_exp_div VALUES (5,1,'NaN'); +INSERT INTO num_exp_add VALUES (5,2,'-34322095.176906047'); +INSERT INTO num_exp_sub VALUES (5,2,'34354889.253888047'); +INSERT INTO num_exp_mul VALUES (5,2,'-563049578578.769242506736077'); +INSERT INTO num_exp_div VALUES (5,2,'-.00047751189505192446'); +INSERT INTO num_exp_add VALUES (5,3,'16401.348491'); +INSERT INTO num_exp_sub VALUES (5,3,'16392.728491'); +INSERT INTO num_exp_mul VALUES (5,3,'70671.23589621'); +INSERT INTO num_exp_div VALUES (5,3,'3804.41728329466357308584'); +INSERT INTO num_exp_add VALUES (5,4,'7815858.450391'); +INSERT INTO num_exp_sub VALUES (5,4,'-7783064.373409'); +INSERT INTO num_exp_mul VALUES (5,4,'127888068979.9935054429'); +INSERT INTO num_exp_div VALUES (5,4,'.00210232958726897192'); +INSERT INTO num_exp_add VALUES (5,5,'32794.076982'); +INSERT INTO num_exp_sub VALUES (5,5,'0'); +INSERT INTO num_exp_mul VALUES (5,5,'268862871.275335557081'); +INSERT INTO num_exp_div VALUES (5,5,'1.00000000000000000000'); +INSERT INTO num_exp_add VALUES (5,6,'110298.61612126'); +INSERT INTO num_exp_sub VALUES (5,6,'-77504.53913926'); +INSERT INTO num_exp_mul VALUES (5,6,'1539707782.76899778633766'); +INSERT INTO num_exp_div VALUES (5,6,'.17461941433576102689'); +INSERT INTO num_exp_add VALUES (5,7,'-83012087.961509'); +INSERT INTO num_exp_sub VALUES (5,7,'83044882.038491'); +INSERT INTO num_exp_mul VALUES (5,7,'-1361421264394.416135'); +INSERT INTO num_exp_div VALUES (5,7,'-.00019748690453643710'); +INSERT INTO num_exp_add VALUES (5,8,'91278.038491'); +INSERT INTO num_exp_sub VALUES (5,8,'-58483.961509'); +INSERT INTO num_exp_mul VALUES (5,8,'1227826639.244571'); +INSERT INTO num_exp_div VALUES (5,8,'.21897461960978085228'); +INSERT INTO num_exp_add VALUES (5,9,'-24910407.006556420'); +INSERT INTO num_exp_sub VALUES (5,9,'24943201.083538420'); +INSERT INTO num_exp_mul VALUES (5,9,'-408725765384.257043660243220'); +INSERT INTO num_exp_div VALUES (5,9,'-.00065780749354660427'); +INSERT INTO num_exp_add VALUES (6,0,'93901.57763026'); +INSERT INTO num_exp_sub VALUES (6,0,'93901.57763026'); +INSERT INTO num_exp_mul VALUES (6,0,'0'); +INSERT INTO num_exp_div VALUES (6,0,'NaN'); +INSERT INTO num_exp_add VALUES (6,1,'93901.57763026'); +INSERT INTO num_exp_sub VALUES (6,1,'93901.57763026'); +INSERT INTO num_exp_mul VALUES (6,1,'0'); +INSERT INTO num_exp_div VALUES (6,1,'NaN'); +INSERT INTO num_exp_add VALUES (6,2,'-34244590.637766787'); +INSERT INTO num_exp_sub VALUES (6,2,'34432393.793027307'); +INSERT INTO num_exp_mul VALUES (6,2,'-3224438592470.18449811926184222'); +INSERT INTO num_exp_div VALUES (6,2,'-.00273458651128995823'); +INSERT INTO num_exp_add VALUES (6,3,'93905.88763026'); +INSERT INTO num_exp_sub VALUES (6,3,'93897.26763026'); +INSERT INTO num_exp_mul VALUES (6,3,'404715.7995864206'); +INSERT INTO num_exp_div VALUES (6,3,'21786.90896293735498839907'); +INSERT INTO num_exp_add VALUES (6,4,'7893362.98953026'); +INSERT INTO num_exp_sub VALUES (6,4,'-7705559.83426974'); +INSERT INTO num_exp_mul VALUES (6,4,'732381731243.745115764094'); +INSERT INTO num_exp_div VALUES (6,4,'.01203949512295682469'); +INSERT INTO num_exp_add VALUES (6,5,'110298.61612126'); +INSERT INTO num_exp_sub VALUES (6,5,'77504.53913926'); +INSERT INTO num_exp_mul VALUES (6,5,'1539707782.76899778633766'); +INSERT INTO num_exp_div VALUES (6,5,'5.72674008674192359679'); +INSERT INTO num_exp_add VALUES (6,6,'187803.15526052'); +INSERT INTO num_exp_sub VALUES (6,6,'0'); +INSERT INTO num_exp_mul VALUES (6,6,'8817506281.4517452372676676'); +INSERT INTO num_exp_div VALUES (6,6,'1.00000000000000000000'); +INSERT INTO num_exp_add VALUES (6,7,'-82934583.42236974'); +INSERT INTO num_exp_sub VALUES (6,7,'83122386.57763026'); +INSERT INTO num_exp_mul VALUES (6,7,'-7796505729750.37795610'); +INSERT INTO num_exp_div VALUES (6,7,'-.00113095617281538980'); +INSERT INTO num_exp_add VALUES (6,8,'168782.57763026'); +INSERT INTO num_exp_sub VALUES (6,8,'19020.57763026'); +INSERT INTO num_exp_mul VALUES (6,8,'7031444034.53149906'); +INSERT INTO num_exp_div VALUES (6,8,'1.25401073209839612184'); +INSERT INTO num_exp_add VALUES (6,9,'-24832902.467417160'); +INSERT INTO num_exp_sub VALUES (6,9,'25020705.622677680'); +INSERT INTO num_exp_mul VALUES (6,9,'-2340666225110.29929521292692920'); +INSERT INTO num_exp_div VALUES (6,9,'-.00376709254265256789'); +INSERT INTO num_exp_add VALUES (7,0,'-83028485'); +INSERT INTO num_exp_sub VALUES (7,0,'-83028485'); +INSERT INTO num_exp_mul VALUES (7,0,'0'); +INSERT INTO num_exp_div VALUES (7,0,'NaN'); +INSERT INTO num_exp_add VALUES (7,1,'-83028485'); +INSERT INTO num_exp_sub VALUES (7,1,'-83028485'); +INSERT INTO num_exp_mul VALUES (7,1,'0'); +INSERT INTO num_exp_div VALUES (7,1,'NaN'); +INSERT INTO num_exp_add VALUES (7,2,'-117366977.215397047'); +INSERT INTO num_exp_sub VALUES (7,2,'-48689992.784602953'); +INSERT INTO num_exp_mul VALUES (7,2,'2851072985828710.485883795'); +INSERT INTO num_exp_div VALUES (7,2,'2.41794207151503385700'); +INSERT INTO num_exp_add VALUES (7,3,'-83028480.69'); +INSERT INTO num_exp_sub VALUES (7,3,'-83028489.31'); +INSERT INTO num_exp_mul VALUES (7,3,'-357852770.35'); +INSERT INTO num_exp_div VALUES (7,3,'-19264149.65197215777262180974'); +INSERT INTO num_exp_add VALUES (7,4,'-75229023.5881'); +INSERT INTO num_exp_sub VALUES (7,4,'-90827946.4119'); +INSERT INTO num_exp_mul VALUES (7,4,'-647577464846017.9715'); +INSERT INTO num_exp_div VALUES (7,4,'-10.64541262725136247686'); +INSERT INTO num_exp_add VALUES (7,5,'-83012087.961509'); +INSERT INTO num_exp_sub VALUES (7,5,'-83044882.038491'); +INSERT INTO num_exp_mul VALUES (7,5,'-1361421264394.416135'); +INSERT INTO num_exp_div VALUES (7,5,'-5063.62688881730941836574'); +INSERT INTO num_exp_add VALUES (7,6,'-82934583.42236974'); +INSERT INTO num_exp_sub VALUES (7,6,'-83122386.57763026'); +INSERT INTO num_exp_mul VALUES (7,6,'-7796505729750.37795610'); +INSERT INTO num_exp_div VALUES (7,6,'-884.20756174009028770294'); +INSERT INTO num_exp_add VALUES (7,7,'-166056970'); +INSERT INTO num_exp_sub VALUES (7,7,'0'); +INSERT INTO num_exp_mul VALUES (7,7,'6893729321395225'); +INSERT INTO num_exp_div VALUES (7,7,'1.00000000000000000000'); +INSERT INTO num_exp_add VALUES (7,8,'-82953604'); +INSERT INTO num_exp_sub VALUES (7,8,'-83103366'); +INSERT INTO num_exp_mul VALUES (7,8,'-6217255985285'); +INSERT INTO num_exp_div VALUES (7,8,'-1108.80577182462841041118'); +INSERT INTO num_exp_add VALUES (7,9,'-107955289.045047420'); +INSERT INTO num_exp_sub VALUES (7,9,'-58101680.954952580'); +INSERT INTO num_exp_mul VALUES (7,9,'2069634775752159.035758700'); +INSERT INTO num_exp_div VALUES (7,9,'3.33089171198810413382'); +INSERT INTO num_exp_add VALUES (8,0,'74881'); +INSERT INTO num_exp_sub VALUES (8,0,'74881'); +INSERT INTO num_exp_mul VALUES (8,0,'0'); +INSERT INTO num_exp_div VALUES (8,0,'NaN'); +INSERT INTO num_exp_add VALUES (8,1,'74881'); +INSERT INTO num_exp_sub VALUES (8,1,'74881'); +INSERT INTO num_exp_mul VALUES (8,1,'0'); +INSERT INTO num_exp_div VALUES (8,1,'NaN'); +INSERT INTO num_exp_add VALUES (8,2,'-34263611.215397047'); +INSERT INTO num_exp_sub VALUES (8,2,'34413373.215397047'); +INSERT INTO num_exp_mul VALUES (8,2,'-2571300635581.146276407'); +INSERT INTO num_exp_div VALUES (8,2,'-.00218067233500788615'); +INSERT INTO num_exp_add VALUES (8,3,'74885.31'); +INSERT INTO num_exp_sub VALUES (8,3,'74876.69'); +INSERT INTO num_exp_mul VALUES (8,3,'322737.11'); +INSERT INTO num_exp_div VALUES (8,3,'17373.78190255220417633410'); +INSERT INTO num_exp_add VALUES (8,4,'7874342.4119'); +INSERT INTO num_exp_sub VALUES (8,4,'-7724580.4119'); +INSERT INTO num_exp_mul VALUES (8,4,'584031469984.4839'); +INSERT INTO num_exp_div VALUES (8,4,'.00960079113741758956'); +INSERT INTO num_exp_add VALUES (8,5,'91278.038491'); +INSERT INTO num_exp_sub VALUES (8,5,'58483.961509'); +INSERT INTO num_exp_mul VALUES (8,5,'1227826639.244571'); +INSERT INTO num_exp_div VALUES (8,5,'4.56673929509287019456'); +INSERT INTO num_exp_add VALUES (8,6,'168782.57763026'); +INSERT INTO num_exp_sub VALUES (8,6,'-19020.57763026'); +INSERT INTO num_exp_mul VALUES (8,6,'7031444034.53149906'); +INSERT INTO num_exp_div VALUES (8,6,'.79744134113322314424'); +INSERT INTO num_exp_add VALUES (8,7,'-82953604'); +INSERT INTO num_exp_sub VALUES (8,7,'83103366'); +INSERT INTO num_exp_mul VALUES (8,7,'-6217255985285'); +INSERT INTO num_exp_div VALUES (8,7,'-.00090187120721280172'); +INSERT INTO num_exp_add VALUES (8,8,'149762'); +INSERT INTO num_exp_sub VALUES (8,8,'0'); +INSERT INTO num_exp_mul VALUES (8,8,'5607164161'); +INSERT INTO num_exp_div VALUES (8,8,'1.00000000000000000000'); +INSERT INTO num_exp_add VALUES (8,9,'-24851923.045047420'); +INSERT INTO num_exp_sub VALUES (8,9,'25001685.045047420'); +INSERT INTO num_exp_mul VALUES (8,9,'-1866544013697.195857020'); +INSERT INTO num_exp_div VALUES (8,9,'-.00300403532938582735'); +INSERT INTO num_exp_add VALUES (9,0,'-24926804.045047420'); +INSERT INTO num_exp_sub VALUES (9,0,'-24926804.045047420'); +INSERT INTO num_exp_mul VALUES (9,0,'0'); +INSERT INTO num_exp_div VALUES (9,0,'NaN'); +INSERT INTO num_exp_add VALUES (9,1,'-24926804.045047420'); +INSERT INTO num_exp_sub VALUES (9,1,'-24926804.045047420'); +INSERT INTO num_exp_mul VALUES (9,1,'0'); +INSERT INTO num_exp_div VALUES (9,1,'NaN'); +INSERT INTO num_exp_add VALUES (9,2,'-59265296.260444467'); +INSERT INTO num_exp_sub VALUES (9,2,'9411688.170349627'); +INSERT INTO num_exp_mul VALUES (9,2,'855948866655588.453741509242968740'); +INSERT INTO num_exp_div VALUES (9,2,'.72591434384152961526'); +INSERT INTO num_exp_add VALUES (9,3,'-24926799.735047420'); +INSERT INTO num_exp_sub VALUES (9,3,'-24926808.355047420'); +INSERT INTO num_exp_mul VALUES (9,3,'-107434525.43415438020'); +INSERT INTO num_exp_div VALUES (9,3,'-5783481.21694835730858468677'); +INSERT INTO num_exp_add VALUES (9,4,'-17127342.633147420'); +INSERT INTO num_exp_sub VALUES (9,4,'-32726265.456947420'); +INSERT INTO num_exp_mul VALUES (9,4,'-194415646271340.1815956522980'); +INSERT INTO num_exp_div VALUES (9,4,'-3.19596478892958416484'); +INSERT INTO num_exp_add VALUES (9,5,'-24910407.006556420'); +INSERT INTO num_exp_sub VALUES (9,5,'-24943201.083538420'); +INSERT INTO num_exp_mul VALUES (9,5,'-408725765384.257043660243220'); +INSERT INTO num_exp_div VALUES (9,5,'-1520.20159364322004505807'); +INSERT INTO num_exp_add VALUES (9,6,'-24832902.467417160'); +INSERT INTO num_exp_sub VALUES (9,6,'-25020705.622677680'); +INSERT INTO num_exp_mul VALUES (9,6,'-2340666225110.29929521292692920'); +INSERT INTO num_exp_div VALUES (9,6,'-265.45671195426965751280'); +INSERT INTO num_exp_add VALUES (9,7,'-107955289.045047420'); +INSERT INTO num_exp_sub VALUES (9,7,'58101680.954952580'); +INSERT INTO num_exp_mul VALUES (9,7,'2069634775752159.035758700'); +INSERT INTO num_exp_div VALUES (9,7,'.30021990699995814689'); +INSERT INTO num_exp_add VALUES (9,8,'-24851923.045047420'); +INSERT INTO num_exp_sub VALUES (9,8,'-25001685.045047420'); +INSERT INTO num_exp_mul VALUES (9,8,'-1866544013697.195857020'); +INSERT INTO num_exp_div VALUES (9,8,'-332.88556569820675471748'); +INSERT INTO num_exp_add VALUES (9,9,'-49853608.090094840'); +INSERT INTO num_exp_sub VALUES (9,9,'0'); +INSERT INTO num_exp_mul VALUES (9,9,'621345559900192.420120630048656400'); +INSERT INTO num_exp_div VALUES (9,9,'1.00000000000000000000'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_exp_sqrt VALUES (0,'0'); +INSERT INTO num_exp_sqrt VALUES (1,'0'); +INSERT INTO num_exp_sqrt VALUES (2,'5859.90547836712524903505'); +INSERT INTO num_exp_sqrt VALUES (3,'2.07605394920266944396'); +INSERT INTO num_exp_sqrt VALUES (4,'2792.75158435189147418923'); +INSERT INTO num_exp_sqrt VALUES (5,'128.05092147657509145473'); +INSERT INTO num_exp_sqrt VALUES (6,'306.43364311096782703406'); +INSERT INTO num_exp_sqrt VALUES (7,'9111.99676251039939975230'); +INSERT INTO num_exp_sqrt VALUES (8,'273.64392922189960397542'); +INSERT INTO num_exp_sqrt VALUES (9,'4992.67503899937593364766'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_exp_ln VALUES (0,'NaN'); +INSERT INTO num_exp_ln VALUES (1,'NaN'); +INSERT INTO num_exp_ln VALUES (2,'17.35177750493897715514'); +INSERT INTO num_exp_ln VALUES (3,'1.46093790411565641971'); +INSERT INTO num_exp_ln VALUES (4,'15.86956523951936572464'); +INSERT INTO num_exp_ln VALUES (5,'9.70485601768871834038'); +INSERT INTO num_exp_ln VALUES (6,'11.45000246622944403127'); +INSERT INTO num_exp_ln VALUES (7,'18.23469429965478772991'); +INSERT INTO num_exp_ln VALUES (8,'11.22365546576315513668'); +INSERT INTO num_exp_ln VALUES (9,'17.03145425013166006962'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_exp_log10 VALUES (0,'NaN'); +INSERT INTO num_exp_log10 VALUES (1,'NaN'); +INSERT INTO num_exp_log10 VALUES (2,'7.53578122160797276459'); +INSERT INTO num_exp_log10 VALUES (3,'.63447727016073160075'); +INSERT INTO num_exp_log10 VALUES (4,'6.89206461372691743345'); +INSERT INTO num_exp_log10 VALUES (5,'4.21476541614777768626'); +INSERT INTO num_exp_log10 VALUES (6,'4.97267288886207207671'); +INSERT INTO num_exp_log10 VALUES (7,'7.91922711353275546914'); +INSERT INTO num_exp_log10 VALUES (8,'4.87437163556421004138'); +INSERT INTO num_exp_log10 VALUES (9,'7.39666659961986567059'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_exp_power_10_ln VALUES (0,'NaN'); +INSERT INTO num_exp_power_10_ln VALUES (1,'NaN'); +INSERT INTO num_exp_power_10_ln VALUES (2,'224790267919917955.13261618583642653184'); +INSERT INTO num_exp_power_10_ln VALUES (3,'28.90266599445155957393'); +INSERT INTO num_exp_power_10_ln VALUES (4,'7405685069594999.07733999469386277636'); +INSERT INTO num_exp_power_10_ln VALUES (5,'5068226527.32127265408584640098'); +INSERT INTO num_exp_power_10_ln VALUES (6,'281839893606.99372343357047819067'); +INSERT INTO num_exp_power_10_ln VALUES (7,'1716699575118597095.42330819910640247627'); +INSERT INTO num_exp_power_10_ln VALUES (8,'167361463828.07491320069016125952'); +INSERT INTO num_exp_power_10_ln VALUES (9,'107511333880052007.04141124673540337457'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_data VALUES (0, '0'); +INSERT INTO num_data VALUES (1, '0'); +INSERT INTO num_data VALUES (2, '-34338492.215397047'); +INSERT INTO num_data VALUES (3, '4.31'); +INSERT INTO num_data VALUES (4, '7799461.4119'); +INSERT INTO num_data VALUES (5, '16397.038491'); +INSERT INTO num_data VALUES (6, '93901.57763026'); +INSERT INTO num_data VALUES (7, '-83028485'); +INSERT INTO num_data VALUES (8, '74881'); +INSERT INTO num_data VALUES (9, '-24926804.045047420'); +COMMIT TRANSACTION; + +-- ****************************** +-- * Create indices for faster checks +-- ****************************** + +CREATE UNIQUE INDEX num_exp_add_idx ON num_exp_add (id1, id2); +CREATE UNIQUE INDEX num_exp_sub_idx ON num_exp_sub (id1, id2); +CREATE UNIQUE INDEX num_exp_div_idx ON num_exp_div (id1, id2); +CREATE UNIQUE INDEX num_exp_mul_idx ON num_exp_mul (id1, id2); +CREATE UNIQUE INDEX num_exp_sqrt_idx ON num_exp_sqrt (id); +CREATE UNIQUE INDEX num_exp_ln_idx ON num_exp_ln (id); +CREATE UNIQUE INDEX num_exp_log10_idx ON num_exp_log10 (id); +CREATE UNIQUE INDEX num_exp_power_10_ln_idx ON num_exp_power_10_ln (id); + +VACUUM ANALYZE num_exp_add; +VACUUM ANALYZE num_exp_sub; +VACUUM ANALYZE num_exp_div; +VACUUM ANALYZE num_exp_mul; +VACUUM ANALYZE num_exp_sqrt; +VACUUM ANALYZE num_exp_ln; +VACUUM ANALYZE num_exp_log10; +VACUUM ANALYZE num_exp_power_10_ln; + +-- ****************************** +-- * Now check the behaviour of the NUMERIC type +-- ****************************** + +-- ****************************** +-- * Addition check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, t1.val + t2.val + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, t2.expected + FROM num_result t1, num_exp_add t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != t2.expected; + +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val + t2.val, 10) + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 10) as expected + FROM num_result t1, num_exp_add t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != round(t2.expected, 10); + +-- ****************************** +-- * Subtraction check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, t1.val - t2.val + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, t2.expected + FROM num_result t1, num_exp_sub t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != t2.expected; + +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val - t2.val, 40) + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 40) + FROM num_result t1, num_exp_sub t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != round(t2.expected, 40); + +-- ****************************** +-- * Multiply check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, t1.val * t2.val + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, t2.expected + FROM num_result t1, num_exp_mul t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != t2.expected; + +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val * t2.val, 30) + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 30) as expected + FROM num_result t1, num_exp_mul t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != round(t2.expected, 30); + +-- ****************************** +-- * Division check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, t1.val / t2.val + FROM num_data t1, num_data t2 + WHERE t2.val != '0.0'; +SELECT t1.id1, t1.id2, t1.result, t2.expected + FROM num_result t1, num_exp_div t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != t2.expected; + +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val / t2.val, 80) + FROM num_data t1, num_data t2 + WHERE t2.val != '0.0'; +SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 80) as expected + FROM num_result t1, num_exp_div t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != round(t2.expected, 80); + +-- ****************************** +-- * Square root check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT id, 0, SQRT(ABS(val)) + FROM num_data; +SELECT t1.id1, t1.result, t2.expected + FROM num_result t1, num_exp_sqrt t2 + WHERE t1.id1 = t2.id + AND t1.result != t2.expected; + +-- ****************************** +-- * Natural logarithm check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT id, 0, LN(ABS(val)) + FROM num_data + WHERE val != '0.0'; +SELECT t1.id1, t1.result, t2.expected + FROM num_result t1, num_exp_ln t2 + WHERE t1.id1 = t2.id + AND t1.result != t2.expected; + +-- ****************************** +-- * Logarithm base 10 check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT id, 0, LOG(numeric '10', ABS(val)) + FROM num_data + WHERE val != '0.0'; +SELECT t1.id1, t1.result, t2.expected + FROM num_result t1, num_exp_log10 t2 + WHERE t1.id1 = t2.id + AND t1.result != t2.expected; + +-- ****************************** +-- * POWER(10, LN(value)) check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT id, 0, POWER(numeric '10', LN(ABS(round(val,200)))) + FROM num_data + WHERE val != '0.0'; +SELECT t1.id1, t1.result, t2.expected + FROM num_result t1, num_exp_power_10_ln t2 + WHERE t1.id1 = t2.id + AND t1.result != t2.expected; + +-- ****************************** +-- * Check behavior with Inf and NaN inputs. It's easiest to handle these +-- * separately from the num_data framework used above, because some input +-- * combinations will throw errors. +-- ****************************** + +WITH v(x) AS + (VALUES('0'::numeric),('1'),('-1'),('4.2'),('inf'),('-inf'),('nan')) +SELECT x1, x2, + x1 + x2 AS sum, + x1 - x2 AS diff, + x1 * x2 AS prod +FROM v AS v1(x1), v AS v2(x2); + +WITH v(x) AS + (VALUES('0'::numeric),('1'),('-1'),('4.2'),('inf'),('-inf'),('nan')) +SELECT x1, x2, + x1 / x2 AS quot, + x1 % x2 AS mod, + div(x1, x2) AS div +FROM v AS v1(x1), v AS v2(x2) WHERE x2 != 0; + +SELECT 'inf'::numeric / '0'; +SELECT '-inf'::numeric / '0'; +SELECT 'nan'::numeric / '0'; +SELECT '0'::numeric / '0'; +SELECT 'inf'::numeric % '0'; +SELECT '-inf'::numeric % '0'; +SELECT 'nan'::numeric % '0'; +SELECT '0'::numeric % '0'; +SELECT div('inf'::numeric, '0'); +SELECT div('-inf'::numeric, '0'); +SELECT div('nan'::numeric, '0'); +SELECT div('0'::numeric, '0'); + +WITH v(x) AS + (VALUES('0'::numeric),('1'),('-1'),('4.2'),('-7.777'),('inf'),('-inf'),('nan')) +SELECT x, -x as minusx, abs(x), floor(x), ceil(x), sign(x), numeric_inc(x) as inc +FROM v; + +WITH v(x) AS + (VALUES('0'::numeric),('1'),('-1'),('4.2'),('-7.777'),('inf'),('-inf'),('nan')) +SELECT x, round(x), round(x,1) as round1, trunc(x), trunc(x,1) as trunc1 +FROM v; + +-- the large values fall into the numeric abbreviation code's maximal classes +WITH v(x) AS + (VALUES('0'::numeric),('1'),('-1'),('4.2'),('-7.777'),('1e340'),('-1e340'), + ('inf'),('-inf'),('nan'), + ('inf'),('-inf'),('nan')) +SELECT substring(x::text, 1, 32) +FROM v ORDER BY x; + +WITH v(x) AS + (VALUES('0'::numeric),('1'),('4.2'),('inf'),('nan')) +SELECT x, sqrt(x) +FROM v; + +SELECT sqrt('-1'::numeric); +SELECT sqrt('-inf'::numeric); + +WITH v(x) AS + (VALUES('1'::numeric),('4.2'),('inf'),('nan')) +SELECT x, + log(x), + log10(x), + ln(x) +FROM v; + +SELECT ln('0'::numeric); +SELECT ln('-1'::numeric); +SELECT ln('-inf'::numeric); + +WITH v(x) AS + (VALUES('2'::numeric),('4.2'),('inf'),('nan')) +SELECT x1, x2, + log(x1, x2) +FROM v AS v1(x1), v AS v2(x2); + +SELECT log('0'::numeric, '10'); +SELECT log('10'::numeric, '0'); +SELECT log('-inf'::numeric, '10'); +SELECT log('10'::numeric, '-inf'); +SELECT log('inf'::numeric, '0'); +SELECT log('inf'::numeric, '-inf'); +SELECT log('-inf'::numeric, 'inf'); + +WITH v(x) AS + (VALUES('0'::numeric),('1'),('2'),('4.2'),('inf'),('nan')) +SELECT x1, x2, + power(x1, x2) +FROM v AS v1(x1), v AS v2(x2) WHERE x1 != 0 OR x2 >= 0; + +SELECT power('0'::numeric, '-1'); +SELECT power('0'::numeric, '-inf'); +SELECT power('-1'::numeric, 'inf'); +SELECT power('-2'::numeric, '3'); +SELECT power('-2'::numeric, '3.3'); +SELECT power('-2'::numeric, '-1'); +SELECT power('-2'::numeric, '-1.5'); +SELECT power('-2'::numeric, 'inf'); +SELECT power('-2'::numeric, '-inf'); +SELECT power('inf'::numeric, '-2'); +SELECT power('inf'::numeric, '-inf'); +SELECT power('-inf'::numeric, '2'); +SELECT power('-inf'::numeric, '3'); +SELECT power('-inf'::numeric, '4.5'); +SELECT power('-inf'::numeric, '-2'); +SELECT power('-inf'::numeric, '-3'); +SELECT power('-inf'::numeric, '0'); +SELECT power('-inf'::numeric, 'inf'); +SELECT power('-inf'::numeric, '-inf'); + +-- ****************************** +-- * miscellaneous checks for things that have been broken in the past... +-- ****************************** +-- numeric AVG used to fail on some platforms +SELECT AVG(val) FROM num_data; +SELECT STDDEV(val) FROM num_data; +SELECT VARIANCE(val) FROM num_data; + +-- Check for appropriate rounding and overflow +CREATE TABLE fract_only (id int, val numeric(4,4)); +INSERT INTO fract_only VALUES (1, '0.0'); +INSERT INTO fract_only VALUES (2, '0.1'); +INSERT INTO fract_only VALUES (3, '1.0'); -- should fail +INSERT INTO fract_only VALUES (4, '-0.9999'); +INSERT INTO fract_only VALUES (5, '0.99994'); +INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail +INSERT INTO fract_only VALUES (7, '0.00001'); +INSERT INTO fract_only VALUES (8, '0.00017'); +INSERT INTO fract_only VALUES (9, 'NaN'); +INSERT INTO fract_only VALUES (10, 'Inf'); -- should fail +INSERT INTO fract_only VALUES (11, '-Inf'); -- should fail +SELECT * FROM fract_only; +DROP TABLE fract_only; + +-- Check inf/nan conversion behavior +SELECT 'NaN'::float8::numeric; +SELECT 'Infinity'::float8::numeric; +SELECT '-Infinity'::float8::numeric; +SELECT 'NaN'::numeric::float8; +SELECT 'Infinity'::numeric::float8; +SELECT '-Infinity'::numeric::float8; +SELECT 'NaN'::float4::numeric; +SELECT 'Infinity'::float4::numeric; +SELECT '-Infinity'::float4::numeric; +SELECT 'NaN'::numeric::float4; +SELECT 'Infinity'::numeric::float4; +SELECT '-Infinity'::numeric::float4; +SELECT '42'::int2::numeric; +SELECT 'NaN'::numeric::int2; +SELECT 'Infinity'::numeric::int2; +SELECT '-Infinity'::numeric::int2; +SELECT 'NaN'::numeric::int4; +SELECT 'Infinity'::numeric::int4; +SELECT '-Infinity'::numeric::int4; +SELECT 'NaN'::numeric::int8; +SELECT 'Infinity'::numeric::int8; +SELECT '-Infinity'::numeric::int8; + +-- Simple check that ceil(), floor(), and round() work correctly +CREATE TABLE ceil_floor_round (a numeric); +INSERT INTO ceil_floor_round VALUES ('-5.5'); +INSERT INTO ceil_floor_round VALUES ('-5.499999'); +INSERT INTO ceil_floor_round VALUES ('9.5'); +INSERT INTO ceil_floor_round VALUES ('9.4999999'); +INSERT INTO ceil_floor_round VALUES ('0.0'); +INSERT INTO ceil_floor_round VALUES ('0.0000001'); +INSERT INTO ceil_floor_round VALUES ('-0.000001'); +SELECT a, ceil(a), ceiling(a), floor(a), round(a) FROM ceil_floor_round; +DROP TABLE ceil_floor_round; + +-- Check rounding, it should round ties away from zero. +SELECT i as pow, + round((-2.5 * 10 ^ i)::numeric, -i), + round((-1.5 * 10 ^ i)::numeric, -i), + round((-0.5 * 10 ^ i)::numeric, -i), + round((0.5 * 10 ^ i)::numeric, -i), + round((1.5 * 10 ^ i)::numeric, -i), + round((2.5 * 10 ^ i)::numeric, -i) +FROM generate_series(-5,5) AS t(i); + +-- Testing for width_bucket(). For convenience, we test both the +-- numeric and float8 versions of the function in this file. + +-- errors +SELECT width_bucket(5.0, 3.0, 4.0, 0); +SELECT width_bucket(5.0, 3.0, 4.0, -5); +SELECT width_bucket(3.5, 3.0, 3.0, 888); +SELECT width_bucket(5.0::float8, 3.0::float8, 4.0::float8, 0); +SELECT width_bucket(5.0::float8, 3.0::float8, 4.0::float8, -5); +SELECT width_bucket(3.5::float8, 3.0::float8, 3.0::float8, 888); +SELECT width_bucket('NaN', 3.0, 4.0, 888); +SELECT width_bucket(0::float8, 'NaN', 4.0::float8, 888); +SELECT width_bucket('inf', 3.0, 4.0, 888); +SELECT width_bucket(2.0, 3.0, '-inf', 888); +SELECT width_bucket(0::float8, '-inf', 4.0::float8, 888); + +-- normal operation +CREATE TABLE width_bucket_test (operand_num numeric, operand_f8 float8); + +COPY width_bucket_test (operand_num) FROM stdin; +/*-5.2 +-0.0000000001 +0.000000000001 +1 +1.99999999999999 +2 +2.00000000000001 +3 +4 +4.5 +5 +5.5 +6 +7 +8 +9 +9.99999999999999 +10 +10.0000000000001 +*/ +\. + +UPDATE width_bucket_test SET operand_f8 = operand_num::float8; + +SELECT + operand_num, + width_bucket(operand_num, 0, 10, 5) AS wb_1, + width_bucket(operand_f8, 0, 10, 5) AS wb_1f, + width_bucket(operand_num, 10, 0, 5) AS wb_2, + width_bucket(operand_f8, 10, 0, 5) AS wb_2f, + width_bucket(operand_num, 2, 8, 4) AS wb_3, + width_bucket(operand_f8, 2, 8, 4) AS wb_3f, + width_bucket(operand_num, 5.0, 5.5, 20) AS wb_4, + width_bucket(operand_f8, 5.0, 5.5, 20) AS wb_4f, + width_bucket(operand_num, -25, 25, 10) AS wb_5, + width_bucket(operand_f8, -25, 25, 10) AS wb_5f + FROM width_bucket_test; + +-- for float8 only, check positive and negative infinity: we require +-- finite bucket bounds, but allow an infinite operand +SELECT width_bucket(0.0::float8, 'Infinity'::float8, 5, 10); -- error +SELECT width_bucket(0.0::float8, 5, '-Infinity'::float8, 20); -- error +SELECT width_bucket('Infinity'::float8, 1, 10, 10), + width_bucket('-Infinity'::float8, 1, 10, 10); + +DROP TABLE width_bucket_test; + +-- TO_CHAR() +-- +SELECT '' AS to_char_1, to_char(val, '9G999G999G999G999G999') + FROM num_data; + +SELECT '' AS to_char_2, to_char(val, '9G999G999G999G999G999D999G999G999G999G999') + FROM num_data; + +SELECT '' AS to_char_3, to_char(val, '9999999999999999.999999999999999PR') + FROM num_data; + +SELECT '' AS to_char_4, to_char(val, '9999999999999999.999999999999999S') + FROM num_data; + +SELECT '' AS to_char_5, to_char(val, 'MI9999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_6, to_char(val, 'FMS9999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_7, to_char(val, 'FM9999999999999999.999999999999999THPR') FROM num_data; +SELECT '' AS to_char_8, to_char(val, 'SG9999999999999999.999999999999999th') FROM num_data; +SELECT '' AS to_char_9, to_char(val, '0999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_10, to_char(val, 'S0999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_11, to_char(val, 'FM0999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_12, to_char(val, 'FM9999999999999999.099999999999999') FROM num_data; +SELECT '' AS to_char_13, to_char(val, 'FM9999999999990999.990999999999999') FROM num_data; +SELECT '' AS to_char_14, to_char(val, 'FM0999999999999999.999909999999999') FROM num_data; +SELECT '' AS to_char_15, to_char(val, 'FM9999999990999999.099999999999999') FROM num_data; +SELECT '' AS to_char_16, to_char(val, 'L9999999999999999.099999999999999') FROM num_data; +SELECT '' AS to_char_17, to_char(val, 'FM9999999999999999.99999999999999') FROM num_data; +SELECT '' AS to_char_18, to_char(val, 'S 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data; +SELECT '' AS to_char_19, to_char(val, 'FMS 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 . 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9') FROM num_data; +SELECT '' AS to_char_20, to_char(val, E'99999 "text" 9999 "9999" 999 "\\"text between quote marks\\"" 9999') FROM num_data; +SELECT '' AS to_char_21, to_char(val, '999999SG9999999999') FROM num_data; +SELECT '' AS to_char_22, to_char(val, 'FM9999999999999999.999999999999999') FROM num_data; +SELECT '' AS to_char_23, to_char(val, '9.999EEEE') FROM num_data; + +WITH v(val) AS + (VALUES('0'::numeric),('-4.2'),('4.2e9'),('1.2e-5'),('inf'),('-inf'),('nan')) +SELECT val, + to_char(val, '9.999EEEE') as numeric, + to_char(val::float8, '9.999EEEE') as float8, + to_char(val::float4, '9.999EEEE') as float4 +FROM v; + +WITH v(val) AS + (VALUES('0'::numeric),('-4.2'),('4.2e9'),('1.2e-5'),('inf'),('-inf'),('nan')) +SELECT val, + to_char(val, 'MI9999999999.99') as numeric, + to_char(val::float8, 'MI9999999999.99') as float8, + to_char(val::float4, 'MI9999999999.99') as float4 +FROM v; + +WITH v(val) AS + (VALUES('0'::numeric),('-4.2'),('4.2e9'),('1.2e-5'),('inf'),('-inf'),('nan')) +SELECT val, + to_char(val, 'MI99.99') as numeric, + to_char(val::float8, 'MI99.99') as float8, + to_char(val::float4, 'MI99.99') as float4 +FROM v; + +SELECT '' AS to_char_24, to_char('100'::numeric, 'FM999.9'); +SELECT '' AS to_char_25, to_char('100'::numeric, 'FM999.'); +SELECT '' AS to_char_26, to_char('100'::numeric, 'FM999'); + +-- Check parsing of literal text in a format string +SELECT '' AS to_char_27, to_char('100'::numeric, 'foo999'); +SELECT '' AS to_char_28, to_char('100'::numeric, 'f\oo999'); +SELECT '' AS to_char_29, to_char('100'::numeric, 'f\\oo999'); +SELECT '' AS to_char_30, to_char('100'::numeric, 'f\"oo999'); +SELECT '' AS to_char_31, to_char('100'::numeric, 'f\\"oo999'); +SELECT '' AS to_char_32, to_char('100'::numeric, 'f"ool"999'); +SELECT '' AS to_char_33, to_char('100'::numeric, 'f"\ool"999'); +SELECT '' AS to_char_34, to_char('100'::numeric, 'f"\\ool"999'); +SELECT '' AS to_char_35, to_char('100'::numeric, 'f"ool\"999'); +SELECT '' AS to_char_36, to_char('100'::numeric, 'f"ool\\"999'); + +-- TO_NUMBER() +-- +SET lc_numeric = 'C'; +SELECT '' AS to_number_1, to_number('-34,338,492', '99G999G999'); +SELECT '' AS to_number_2, to_number('-34,338,492.654,878', '99G999G999D999G999'); +SELECT '' AS to_number_3, to_number('<564646.654564>', '999999.999999PR'); +SELECT '' AS to_number_4, to_number('0.00001-', '9.999999S'); +SELECT '' AS to_number_5, to_number('5.01-', 'FM9.999999S'); +SELECT '' AS to_number_5, to_number('5.01-', 'FM9.999999MI'); +SELECT '' AS to_number_7, to_number('5 4 4 4 4 8 . 7 8', '9 9 9 9 9 9 . 9 9'); +SELECT '' AS to_number_8, to_number('.01', 'FM9.99'); +SELECT '' AS to_number_9, to_number('.0', '99999999.99999999'); +SELECT '' AS to_number_10, to_number('0', '99.99'); +SELECT '' AS to_number_11, to_number('.-01', 'S99.99'); +SELECT '' AS to_number_12, to_number('.01-', '99.99S'); +SELECT '' AS to_number_13, to_number(' . 0 1-', ' 9 9 . 9 9 S'); +SELECT '' AS to_number_14, to_number('34,50','999,99'); +SELECT '' AS to_number_15, to_number('123,000','999G'); +SELECT '' AS to_number_16, to_number('123456','999G999'); +SELECT '' AS to_number_17, to_number('$1234.56','L9,999.99'); +SELECT '' AS to_number_18, to_number('$1234.56','L99,999.99'); +SELECT '' AS to_number_19, to_number('$1,234.56','L99,999.99'); +SELECT '' AS to_number_20, to_number('1234.56','L99,999.99'); +SELECT '' AS to_number_21, to_number('1,234.56','L99,999.99'); +SELECT '' AS to_number_22, to_number('42nd', '99th'); +RESET lc_numeric; + +-- +-- Input syntax +-- + +CREATE TABLE num_input_test (n1 numeric); + +-- good inputs +INSERT INTO num_input_test(n1) VALUES (' 123'); +INSERT INTO num_input_test(n1) VALUES (' 3245874 '); +INSERT INTO num_input_test(n1) VALUES (' -93853'); +INSERT INTO num_input_test(n1) VALUES ('555.50'); +INSERT INTO num_input_test(n1) VALUES ('-555.50'); +INSERT INTO num_input_test(n1) VALUES ('NaN '); +INSERT INTO num_input_test(n1) VALUES (' nan'); +INSERT INTO num_input_test(n1) VALUES (' inf '); +INSERT INTO num_input_test(n1) VALUES (' +inf '); +INSERT INTO num_input_test(n1) VALUES (' -inf '); +INSERT INTO num_input_test(n1) VALUES (' Infinity '); +INSERT INTO num_input_test(n1) VALUES (' +inFinity '); +INSERT INTO num_input_test(n1) VALUES (' -INFINITY '); + +-- bad inputs +INSERT INTO num_input_test(n1) VALUES (' '); +INSERT INTO num_input_test(n1) VALUES (' 1234 %'); +INSERT INTO num_input_test(n1) VALUES ('xyz'); +INSERT INTO num_input_test(n1) VALUES ('- 1234'); +INSERT INTO num_input_test(n1) VALUES ('5 . 0'); +INSERT INTO num_input_test(n1) VALUES ('5. 0 '); +INSERT INTO num_input_test(n1) VALUES (''); +INSERT INTO num_input_test(n1) VALUES (' N aN '); +INSERT INTO num_input_test(n1) VALUES ('+ infinity'); + +SELECT * FROM num_input_test; + +-- +-- Test some corner cases for multiplication +-- + +select 4790999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999; + +select 4789999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999; + +select 4770999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999; + +select 4769999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999; + +-- +-- Test some corner cases for division +-- + +select 999999999999999999999::numeric/1000000000000000000000; +select div(999999999999999999999::numeric,1000000000000000000000); +select mod(999999999999999999999::numeric,1000000000000000000000); +select div(-9999999999999999999999::numeric,1000000000000000000000); +select mod(-9999999999999999999999::numeric,1000000000000000000000); +select div(-9999999999999999999999::numeric,1000000000000000000000)*1000000000000000000000 + mod(-9999999999999999999999::numeric,1000000000000000000000); +select mod (70.0,70) ; +select div (70.0,70) ; +select 70.0 / 70 ; +select 12345678901234567890 % 123; +select 12345678901234567890 / 123; +select div(12345678901234567890, 123); +select div(12345678901234567890, 123) * 123 + 12345678901234567890 % 123; + +-- +-- Test some corner cases for square root +-- + +select sqrt(1.000000000000003::numeric); +select sqrt(1.000000000000004::numeric); +select sqrt(96627521408608.56340355805::numeric); +select sqrt(96627521408608.56340355806::numeric); +select sqrt(515549506212297735.073688290367::numeric); +select sqrt(515549506212297735.073688290368::numeric); +select sqrt(8015491789940783531003294973900306::numeric); +select sqrt(8015491789940783531003294973900307::numeric); + +-- +-- Test code path for raising to integer powers +-- + +select 10.0 ^ -2147483648 as rounds_to_zero; +select 10.0 ^ -2147483647 as rounds_to_zero; +select 10.0 ^ 2147483647 as overflows; +select 117743296169.0 ^ 1000000000 as overflows; + +-- cases that used to return inaccurate results +select 3.789 ^ 21; +select 3.789 ^ 35; +select 1.2 ^ 345; +select 0.12 ^ (-20); + +-- cases that used to error out +select 0.12 ^ (-25); +select 0.5678 ^ (-85); + +-- +-- Tests for raising to non-integer powers +-- + +-- special cases +select 0.0 ^ 0.0; +select (-12.34) ^ 0.0; +select 12.34 ^ 0.0; +select 0.0 ^ 12.34; + +-- NaNs +select 'NaN'::numeric ^ 'NaN'::numeric; +select 'NaN'::numeric ^ 0; +select 'NaN'::numeric ^ 1; +select 0 ^ 'NaN'::numeric; +select 1 ^ 'NaN'::numeric; + +-- invalid inputs +select 0.0 ^ (-12.34); +select (-12.34) ^ 1.2; + +-- cases that used to generate inaccurate results +select 32.1 ^ 9.8; +select 32.1 ^ (-9.8); +select 12.3 ^ 45.6; +select 12.3 ^ (-45.6); + +-- big test +select 1.234 ^ 5678; + +-- +-- Tests for EXP() +-- + +-- special cases +select exp(0.0); +select exp(1.0); +select exp(1.0::numeric(71,70)); +select exp('nan'::numeric); +select exp('inf'::numeric); +select exp('-inf'::numeric); + +-- cases that used to generate inaccurate results +select exp(32.999); +select exp(-32.999); +select exp(123.456); +select exp(-123.456); + +-- big test +select exp(1234.5678); + +-- +-- Tests for generate_series +-- +select * from generate_series(0.0::numeric, 4.0::numeric); +select * from generate_series(0.1::numeric, 4.0::numeric, 1.3::numeric); +select * from generate_series(4.0::numeric, -1.5::numeric, -2.2::numeric); +-- Trigger errors +select * from generate_series(-100::numeric, 100::numeric, 0::numeric); +select * from generate_series(-100::numeric, 100::numeric, 'nan'::numeric); +select * from generate_series('nan'::numeric, 100::numeric, 10::numeric); +select * from generate_series(0::numeric, 'nan'::numeric, 10::numeric); +select * from generate_series('inf'::numeric, 'inf'::numeric, 10::numeric); +select * from generate_series(0::numeric, 'inf'::numeric, 10::numeric); +select * from generate_series(0::numeric, '42'::numeric, '-inf'::numeric); +-- Checks maximum, output is truncated +select (i / (10::numeric ^ 131071))::numeric(1,0) + from generate_series(6 * (10::numeric ^ 131071), + 9 * (10::numeric ^ 131071), + 10::numeric ^ 131071) as a(i); +-- Check usage with variables +select * from generate_series(1::numeric, 3::numeric) i, generate_series(i,3) j; +select * from generate_series(1::numeric, 3::numeric) i, generate_series(1,i) j; +select * from generate_series(1::numeric, 3::numeric) i, generate_series(1,5,i) j; + +-- +-- Tests for LN() +-- + +-- Invalid inputs +select ln(-12.34); +select ln(0.0); + +-- Some random tests +select ln(1.2345678e-28); +select ln(0.0456789); +select ln(0.349873948359354029493948309745709580730482050975); +select ln(0.99949452); +select ln(1.00049687395); +select ln(1234.567890123456789); +select ln(5.80397490724e5); +select ln(9.342536355e34); + +-- +-- Tests for LOG() (base 10) +-- + +-- invalid inputs +select log(-12.34); +select log(0.0); + +-- some random tests +select log(1.234567e-89); +select log(3.4634998359873254962349856073435545); +select log(9.999999999999999999); +select log(10.00000000000000000); +select log(10.00000000000000001); +select log(590489.45235237); + +-- +-- Tests for LOG() (arbitrary base) +-- + +-- invalid inputs +select log(-12.34, 56.78); +select log(-12.34, -56.78); +select log(12.34, -56.78); +select log(0.0, 12.34); +select log(12.34, 0.0); +select log(1.0, 12.34); + +-- some random tests +select log(1.23e-89, 6.4689e45); +select log(0.99923, 4.58934e34); +select log(1.000016, 8.452010e18); +select log(3.1954752e47, 9.4792021e-73); + +-- +-- Tests for scale() +-- + +select scale(numeric 'NaN'); +select scale(numeric 'inf'); +select scale(NULL::numeric); +select scale(1.12); +select scale(0); +select scale(0.00); +select scale(1.12345); +select scale(110123.12475871856128); +select scale(-1123.12471856128); +select scale(-13.000000000000000); + +-- +-- Tests for min_scale() +-- + +select min_scale(numeric 'NaN') is NULL; -- should be true +select min_scale(numeric 'inf') is NULL; -- should be true +select min_scale(0); -- no digits +select min_scale(0.00); -- no digits again +select min_scale(1.0); -- no scale +select min_scale(1.1); -- scale 1 +select min_scale(1.12); -- scale 2 +select min_scale(1.123); -- scale 3 +select min_scale(1.1234); -- scale 4, filled digit +select min_scale(1.12345); -- scale 5, 2 NDIGITS +select min_scale(1.1000); -- 1 pos in NDIGITS +select min_scale(1e100); -- very big number + +-- +-- Tests for trim_scale() +-- + +select trim_scale(numeric 'NaN'); +select trim_scale(numeric 'inf'); +select trim_scale(1.120); +select trim_scale(0); +select trim_scale(0.00); +select trim_scale(1.1234500); +select trim_scale(110123.12475871856128000); +select trim_scale(-1123.124718561280000000); +select trim_scale(-13.00000000000000000000); +select trim_scale(1e100); + +-- +-- Tests for SUM() +-- + +-- cases that need carry propagation +SELECT SUM(9999::numeric) FROM generate_series(1, 100000); +SELECT SUM((-9999)::numeric) FROM generate_series(1, 100000); + +-- +-- Tests for GCD() +-- +SELECT a, b, gcd(a, b), gcd(a, -b), gcd(-b, a), gcd(-b, -a) +FROM (VALUES (0::numeric, 0::numeric), + (0::numeric, numeric 'NaN'), + (0::numeric, 46375::numeric), + (433125::numeric, 46375::numeric), + (43312.5::numeric, 4637.5::numeric), + (4331.250::numeric, 463.75000::numeric), + ('inf', '0'), + ('inf', '42'), + ('inf', 'inf') + ) AS v(a, b); + +-- +-- Tests for LCM() +-- +SELECT a,b, lcm(a, b), lcm(a, -b), lcm(-b, a), lcm(-b, -a) +FROM (VALUES (0::numeric, 0::numeric), + (0::numeric, numeric 'NaN'), + (0::numeric, 13272::numeric), + (13272::numeric, 13272::numeric), + (423282::numeric, 13272::numeric), + (42328.2::numeric, 1327.2::numeric), + (4232.820::numeric, 132.72000::numeric), + ('inf', '0'), + ('inf', '42'), + ('inf', 'inf') + ) AS v(a, b); + +SELECT lcm(9999 * (10::numeric)^131068 + (10::numeric^131068 - 1), 2); -- overflow + +-- +-- Tests for factorial +-- +SELECT 4!; +SELECT !!3; +SELECT factorial(15); +SELECT 100000!; +SELECT 0!; +SELECT -4!; +SELECT factorial(-4); + +-- +-- Tests for pg_lsn() +-- +SELECT pg_lsn(23783416::numeric); +SELECT pg_lsn(0::numeric); +SELECT pg_lsn(18446744073709551615::numeric); +SELECT pg_lsn(-1::numeric); +SELECT pg_lsn(18446744073709551616::numeric); +SELECT pg_lsn('NaN'::numeric); diff --git a/postgresql/examples/numeric_big.sql b/postgresql/examples/numeric_big.sql new file mode 100644 index 0000000..891843e --- /dev/null +++ b/postgresql/examples/numeric_big.sql @@ -0,0 +1,1377 @@ +-- ****************************** +-- * Test suite for the Postgres NUMERIC data type +-- ****************************** + +-- Must drop tables created by short numeric test. +DROP TABLE num_data; +DROP TABLE num_exp_add; +DROP TABLE num_exp_sub; +DROP TABLE num_exp_div; +DROP TABLE num_exp_mul; +DROP TABLE num_exp_sqrt; +DROP TABLE num_exp_ln; +DROP TABLE num_exp_log10; +DROP TABLE num_exp_power_10_ln; +DROP TABLE num_result; + +CREATE TABLE num_data (id int4, val numeric(1000,800)); +CREATE TABLE num_exp_add (id1 int4, id2 int4, expected numeric(1000,800)); +CREATE TABLE num_exp_sub (id1 int4, id2 int4, expected numeric(1000,800)); +CREATE TABLE num_exp_div (id1 int4, id2 int4, expected numeric(1000,800)); +CREATE TABLE num_exp_mul (id1 int4, id2 int4, expected numeric(1000,800)); +CREATE TABLE num_exp_sqrt (id int4, expected numeric(1000,800)); +CREATE TABLE num_exp_ln (id int4, expected numeric(1000,800)); +CREATE TABLE num_exp_log10 (id int4, expected numeric(1000,800)); +CREATE TABLE num_exp_power_10_ln (id int4, expected numeric(1000,800)); + +CREATE TABLE num_result (id1 int4, id2 int4, result numeric(1000,800)); + + +-- ****************************** +-- * The following EXPECTED results are computed by bc(1) +-- * with a scale of 1000 +-- ****************************** + +BEGIN TRANSACTION; +INSERT INTO num_exp_add VALUES (0,0,'0'); +INSERT INTO num_exp_sub VALUES (0,0,'0'); +INSERT INTO num_exp_mul VALUES (0,0,'0'); +INSERT INTO num_exp_div VALUES (0,0,'NaN'); +INSERT INTO num_exp_add VALUES (0,1,'85243.39540024977626076239847863600785982737155858270959890014613035727868293618673807776733416230953723818527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_sub VALUES (0,1,'-85243.39540024977626076239847863600785982737155858270959890014613035727868293618673807776733416230953723818527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (0,1,'0'); +INSERT INTO num_exp_div VALUES (0,1,'0'); +INSERT INTO num_exp_add VALUES (0,2,'-994877526002806872754342148749241.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_sub VALUES (0,2,'994877526002806872754342148749241.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_mul VALUES (0,2,'0'); +INSERT INTO num_exp_div VALUES (0,2,'0'); +INSERT INTO num_exp_add VALUES (0,3,'-60302029489319384367663884408085757480.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (0,3,'60302029489319384367663884408085757480.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (0,3,'0'); +INSERT INTO num_exp_div VALUES (0,3,'0'); +INSERT INTO num_exp_add VALUES (0,4,'5329378275943663322215245.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (0,4,'-5329378275943663322215245.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (0,4,'0'); +INSERT INTO num_exp_div VALUES (0,4,'0'); +INSERT INTO num_exp_add VALUES (0,5,'-652755630.43456071828048833552593835051449845484289562110789582081210403487973096161149072377955192388469356112505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (0,5,'652755630.43456071828048833552593835051449845484289562110789582081210403487973096161149072377955192388469356112505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (0,5,'0'); +INSERT INTO num_exp_div VALUES (0,5,'0'); +INSERT INTO num_exp_add VALUES (0,6,'.0469370721950711508944806393077762204079964905145503836835397203739563036579760026190241480514409364'); +INSERT INTO num_exp_sub VALUES (0,6,'-.0469370721950711508944806393077762204079964905145503836835397203739563036579760026190241480514409364'); +INSERT INTO num_exp_mul VALUES (0,6,'0'); +INSERT INTO num_exp_div VALUES (0,6,'0'); +INSERT INTO num_exp_add VALUES (0,7,'-818934540071845742'); +INSERT INTO num_exp_sub VALUES (0,7,'818934540071845742'); +INSERT INTO num_exp_mul VALUES (0,7,'0'); +INSERT INTO num_exp_div VALUES (0,7,'0'); +INSERT INTO num_exp_add VALUES (0,8,'8496986223.64063724353165506167988570717591150432282238795309964705925283285060558038824227595710139960766584401003765241409149793494330798800'); +INSERT INTO num_exp_sub VALUES (0,8,'-8496986223.64063724353165506167988570717591150432282238795309964705925283285060558038824227595710139960766584401003765241409149793494330798800'); +INSERT INTO num_exp_mul VALUES (0,8,'0'); +INSERT INTO num_exp_div VALUES (0,8,'0'); +INSERT INTO num_exp_add VALUES (0,9,'54863480.34685027005508022756223282084742813020271603840941647350440860843570182437301045468670059279379903480024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_sub VALUES (0,9,'-54863480.34685027005508022756223282084742813020271603840941647350440860843570182437301045468670059279379903480024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_mul VALUES (0,9,'0'); +INSERT INTO num_exp_div VALUES (0,9,'0'); +INSERT INTO num_exp_add VALUES (1,0,'85243.39540024977626076239847863600785982737155858270959890014613035727868293618673807776733416230953723818527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_sub VALUES (1,0,'85243.39540024977626076239847863600785982737155858270959890014613035727868293618673807776733416230953723818527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (1,0,'0'); +INSERT INTO num_exp_div VALUES (1,0,'NaN'); +INSERT INTO num_exp_add VALUES (1,1,'170486.79080049955252152479695727201571965474311716541919780029226071455736587237347615553466832461907447637054203186991790701615551214692555785671028648640897898741246882118067609728317430043806625387779037980513762118868084887015059202190301421555269486602797852927777567694581746398790609996101506730430853942556475840126871131898407356048450541232591147357021858041662012293323494543567675306406079659294204054863522259037763051870433216859794083051717080761509518250300466106939998045710070'); +INSERT INTO num_exp_sub VALUES (1,1,'0'); +INSERT INTO num_exp_mul VALUES (1,1,'7266436459.363324713115467666113895787027372854351303425444968800459979742082292257107107767894843498525848597439323325297125474674300428669958003640228730876886174255457103020291514229439701871032118057857763809224712818579091741996335014138185389554630910658876423205103697147288306070059640369158894028731728589073730895396494400175420670713113234800826523252075036892246807434088405522834549449664122407363485486902219500109237667016524913027290777216477989904700729228025571098410870506256758678625928245828210775042611512394316804583459576285681159178280400209217948833631961377519855502763611693070238579591463373484424582723121059964236704135695706864890193388054537703767833595331866551990460050750959493829603581882430597105627056085260296454181999581594565113210481151487049158699087454047624433576922179904629'); +INSERT INTO num_exp_div VALUES (1,1,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +INSERT INTO num_exp_add VALUES (1,2,'-994877526002806872754342148663997.64812998474240514147207095573950146764154822009863493316394610578375247334825932838513167168342610420582834742950389452212867974756590355021495169819086060202117180229196935525386766373096687306110481009743118940565957556492470398904849289222365256698601073536111216152709126800604695001949246634784573028721762079936564434050796321975774729383704426321489070979168993853338252728216162346796960170352897972568238870481118474064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_sub VALUES (1,2,'994877526002806872754342148834484.43893048429492666626902822775522112238466538551783273345620682034111834572173548391979999630250058057637037929942180153828419189449146140692523818459983958943364062347264545253704196416903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (1,2,'-84806738323879544552397401815149740513.8505875535743013876823142649666132764556588225959336097903898464616542203793600590311980154402068027051522932586050753865288419084437796768749509032177577451738712965496693249429231838833655025794915864261585848007162358912070811805298210095333433397862313304655108809804359760907473898420016370058274978588765092161529583480924554820756527238472641797198545539410039895140087686344382628317530286295498797849942258314364503000942821309916954725689781458590617068629906894951122301020797266469357701283289275708774593896770378558232444454118891917258610753077932026885574920166837998049508644891327208474213193224700658584824407382455480657734911543930195324144216374573825'); +INSERT INTO num_exp_div VALUES (1,2,'-.000000000000000000000000000085682300757901809257711279577127388124986344391495296640171942990079130291883279872719240502687189411421655284515420074848478500192127657883342858267913417679786356766341637336955924836847768457039175660279784295612167899455618405343686908907695358239088351870495830739180518509859269437015797489301844593920484927630172344269378248455657186218762679357609204333669024237648538465053048724383898528808961206696787294681884412485427843796696788390072124570957047672341581447744981862017791206857428430183366004980966398716823512288330174863890117558744630102020144500158878244146399686532935435591262767487823942606452349972401012308378888947381934278131785907155692007064636085000405504866631011593239041758448995933095907216863744502344014999804306234830774259496097549717476344048'); +INSERT INTO num_exp_add VALUES (1,3,'-60302029489319384367663884408085672236.83687099063256754698860828386302509843815398979402006244388708674093244201278399438376682321121138429850885935540924586964982855913223221441591310211730902799041126800414795030815514254713522692405212716783388698431088814919226444677188004928663343696636297536500970117716818423689175692808344185016908913828066250587407384563498516598672584120143890364303296142744031320345312431817858545326010704685255237541162931904446804064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_sub VALUES (1,3,'60302029489319384367663884408085842723.62767149018508907178556555587874475318127115521321786273614780129829831438626014991843514783028586066905089122532715288580534070605779007112619958852628801540288008918482404759132944298520148080184250697297150817299173701934285646867489426483932830299434150464278537812298564822479785688909850915447762856384542090714278516461905872647123125352735037721325154184406043613668806975385533851732090363979459292404685190942209855935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (1,3,'-5140349743195574373979577554212527512597024.162480344833040409158673429491690439298506850052285119390701002577176786023622062742050099464897084793357329597395417632908812044304066963549928478520702505283307379218587635434673128958824348493758429380623577527186462464399974242800361134191519694694139153279582776168995426125926314513926640766117733774558011741611075336271613675760116784769700605008122422944290652448956922432960815546502965310676913079866511016221573557684245901002643719965652152439520727383305120298495304784052489867651462175349450610643411043707261107569691076730261762793560088893354750383257372118118753366377402045596735023445172252225346164608897913115394905485106225627590643805003075069931177395059698550161546962768768895596088478488887530518018212441345360153523733317120037436403475909117998647781920105313938836144009539683'); +INSERT INTO num_exp_div VALUES (1,3,'-.000000000000000000000000000000001413607404628860353773457807436398753936801768769045711604884548436548520368932184112069166807060840219636509423284498981041814526856251281381511288768719259120481595036745286884246627534964287523188738499223075292690431699417313258943941279343383979626641848305343592679057491670166887054819766294147341982669243114259272404203080347707713358471397866402657818267495050115642987782080912962056565478445923456884713049272637646637760989004917643369240372476411912794578381690666695711891846833983534126217706309741885844723208036219144146342212915129560758201609824034610223907791643110990898577049488934294259106725414517181607988173722432655731491050637087261030314548853334338835938120502930424813699221083197863303458179445322810087784892821862085562891180364134284641396475'); +INSERT INTO num_exp_add VALUES (1,4,'5329378275943663322300488.64471790965256505869684245785528331091076155554650629138833809683459634328609777839510066435612911583108717191216693735823717997111970662575497378762952496582183738308720094529950793570383580785385569873278068217936841324404119828637880370718028782103860007754579779716996004352284614661690063919125301052941328989181561787543541920734755989452320799185700078241880935083616978140555713297241612718277766918005268951861880490889884082730841740604517529391011862694381726143520658746305661338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (1,4,'-5329378275943663322130001.85391741010004353389988518583956365616764439012730849109607738227723047091262162286043233973705463946054514004224903034208166782419414876904468730122054597840936856190652484801633363526576955397606531892764306099068756437389060626447578949162759295501062154826802212022414257953494004665588557188694447110384853149054690655645134564686305448219729651828678220200218922790293483596988037990835533058983562863141746692824117439019450865871047657552800448629502344444081260036580660700595591338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (1,4,'454294299613767152878025320780.534199313974295807138790763501115780294529340799108297697573066187975311338382917022391830256203305238757334106943821060545424417350991354829668286194840925251162479496893943917530660694097932059166013476064988623431110002057735318529554555260199417935495388243829261809007709919225000608711536928171687251088217591210419208480251102484043683131687013687838713055660405381318396419588727500715930145098362997142075433472039319292466570912777345841400769387321465602989947078951135489852486382469990409873227894248208197179481868230244584527040573428134962626267135732247029762468417273891700661832893497067151409134724061246612631376075173287264787886064622106855886785805818642123776489793586531950438285720668411465570116161790343538663297713926678759640594912243360541590368666922379919514826022141331900181'); +INSERT INTO num_exp_div VALUES (1,4,'.000000000000000000015994998100440878014888861029956505927201309704413242103407885948184870841766875212766910686894450511886242468216220470061916924303252919423028993720180330014505454865704155281502763018913215741264982350384245753394656021401865680441649920273268554396350483440173848850052788410943178207336328451359951614056237100465802151856198860908371340425459435127133071447273887829397881221098443685586506647314622864702873235212396755866459409263439958011711379929751157260020133239574261188528305921244365838405372320186907437842180388704854605498842516581811515413843298370501194935797268161171428747542997504369133579105180311662221854071962295818264211400101689450830279979372422749150894553349570063000769685274875561760334738424509532610467832951796852051505383374693614022043010735004494395190'); +INSERT INTO num_exp_add VALUES (1,5,'-652670387.03916046850422757312745971450663862747133703839829692066597367760104802542475264601221776157515632293978442027199108085723617181683235487266149426304575903892721468296143475297345699313102262188759506518376019936160961709578829069446312051432780603656651983414612264636232727512091101057374054475214114364113300402823059519499217878746766275164739724770556122895799337810694888119810524986616938847385753562624139431982468828696587199570410008890188532132652095915565323400735066310142303225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (1,5,'652840873.82996096805674909792441698652235828221445420381749472095823439215841389779822880154688608619423079931032645214190898787339168396375791272937178074945473802633968350414211085025663129356908887576538544498889782055029046596593888271636613472988050090259449836342389832330814473910881711053475561205644968306669776242949930651397625234795216816397330872127577980937461350104018382663378200293023018506679957617487661691020231880567020416430204091941905612894161614165865789507675064355852373225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (1,5,'-55643106304872.575994253221940844841058071061962511162776681458310912066379595519265546225338405882027547140476045378015935579066580347282075024392379464189067155567624835346798806677988850250198082355055954078446421075165109896091047534711081616362392995575466807084807876544560268050611445006601394735810211678919646667455478469014906335433468365011768049600750224822391684377238242162320161552720449713229523135506671063115436813348612986916614320012995541575293478341408982118538094438068036422562665160411591652618670802973618768526197813319204816293073794413317669922144705633308090832805914096147659820167569140291210526520361556881576175809360614782817717579318298657744021133210954279487777567785280633309576696708168342539425395482429923273623865667723482418178781573723597156804085501875735112311466228778929147929'); +INSERT INTO num_exp_div VALUES (1,5,'-.000130590057635351941758745900947472461593749814351229292370661147301124533787181489468804246182606762727711479707901680546780430454163647774077629503207962424213266902732555945190365467801995495570282501722505521485829885605904543846887348545254658726343578684749830307120625129857380290225370772763609458975555029415082569247186899112975387051141777417911244576134390940441209829852154391377911942082738699481875795620569383196133124499983396562167632007454221121465745085962247988140942672429187053671899537331280701003778040796615094903602095098880716919238394057384949891444700347825726273725378453454782330181608182747900774711384845635284701538541452235224216112380245660177463043471814071809869894647262285332580556739424040615194137651616350340752691170045698234853734471923738591898290468792787543896'); +INSERT INTO num_exp_add VALUES (1,6,'85243.44233732197133191329295927531563604777955507322414928382967007765263923984471408038635831036097817458527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_sub VALUES (1,6,'85243.34846317758118961150399799670008360696356209219504851646259063690472663252876207514831001425809630178527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (1,6,'4001.075404054519813215296429095020391062109905613738157927030437221793757373268325953178030040276107574363822832168160758728653712686313134828282109532831190239521843808940611025488601517574653932032236616573457735900045655665690517797280666732780030171712864961531623060353548802466577910774711998056232872212688464691036260746751992072745518373073825852119460094113694393273456369345499434994672730920070410547163082189385645712866100999708173472360864669110044660667614583576570496399103026286828660558854973376227247132815728164629722965145778698957093136175449225024685874279280018547740'); +INSERT INTO num_exp_div VALUES (1,6,'1816120.848909727306817960620941575637231136442992819290405125420545200026620306446043740992108329883383706060582482495616151605111275635501481354526017831484915013545483361715432312183101964395505340188909970344423950565285639911521082834494088840596716495422427543520536844348040681236845850482165744696068209384509064196671206362539077218412355776790921130042376467606683622970728503408501481791356294886150690067651815776445750760428874351556866105285911902433352126498951242195408782804314174041618879250740246352525074791310920062276490422853700893340860452528740673590486626464460321410814395342850270921486724297414692313177440726749004398703147904603937755702369682956482832074779404350351752662820773690162594400557957241676636030332988289683112176900913522668426137377289536793838959751008646843014106876005'); +INSERT INTO num_exp_add VALUES (1,7,'-818934540071760498.60459975022373923760152136399214017262844141729040109985386964272131706381326192223266583769046276181472898406504104649192224392653722107164485675679551050629376558940966195135841284978096687306110481009743118940565957556492470398904849289222365256698601073536111216152709126800604695001949246634784573028721762079936564434050796321975774729383704426321489070979168993853338252728216162346796960170352897972568238870481118474064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_sub VALUES (1,7,'818934540071930985.39540024977626076239847863600785982737155858270959890014613035727868293618673807776733416230953723818527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (1,7,'-69808760806266041400340.70700818693892852138813934414383886494691670042143650609934777814995087699409404201920249076407981012095999320858479644760715204999741683528746097757549835956359129287002171391961763797857794730120426599135099619822532290339000466211195776337667123320942107370731349851576864242697412616810236323676004067839744992733887503405311090677026008324895177587064547630828026123718296429295638934384446325302964896473296829265805737112709269803814942537657996725913938408781715328945194948010970'); +INSERT INTO num_exp_div VALUES (1,7,'-.000000000000104090609479936344103210175655521317012597986331111866307697262848964666360492361638117930801818899121383806224630563676018240181412174154250663423230239912527388431901852952893943812666142740182651125508583527237123596541789628675379232473721293630968882045044077795828674268595016625198802475186587918019739056755398151182369187670251750080227679555002307777300392769289647975058449905106584837938556260801229545589323224752038795423164214112897202147313792076165011373139219134850954217300915326944185918762838321705825423789073869940092569940135329697980600082436317664012683589681419530904283106912171330819469065141821685734295058255484933744156717782754922568796985634397878149984177882018261742637463462647452140104146195353696596211873925359508622779658904411330975862442989437933211964821'); +INSERT INTO num_exp_add VALUES (1,8,'8497071467.03603749330791582407836434318377133169438097066269854720538319012928851657498035372443556191720308219530866834905045144302106406146277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_sub VALUES (1,8,'-8496900980.24523699375539429928140707116805167695126380524350074691312247557192264420150419818976723729812860582476663647913254442686555191453722107164485675679551050629376558940966195135841284978096687306110481009743118940565957556492470398904849289222365256698601073536111216152709126800604695001949246634784573028721762079936564434050796321975774729383704426321489070979168993853338252728216162346796960170352897972568238870481118474064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_mul VALUES (1,8,'724311956372274.0135050255361637906710330203036651743488213007179039756514944640108625580172737414192938789413338554327986697518463087452612658955180411327002900979574347739956600177846996063741787205122007268468674386396156638261992679442768654367111433834151087792255469957061758837789341439211010331332174981459471333376067541234901538285101103690622656631026001337239036711179989456674399137008584021283568040818388709554256523118702728176420022080138548890713013682480239784198421500241995499841675772793497485550923152267616622892846304530712344886979674416990935007952941652591352603797627920865960622077762568060903908151958000'); +INSERT INTO num_exp_div VALUES (1,8,'.000010032191786198542900505683562217892317481076466949299850809276743457759270150820565375820388277409258249926696079166209409657808406245382887790534127749833677458375931047385994887406206232330491317602830654688957983804698568410728278089250379255157030886262396950539100566975000094268415749476738358914633948867977798590927055566888255636132486899287919515638902721543629183577900872078173883974905921239149419877613723476347774771230668479296621531969573505480695490386225866950545725121902534610730154727385072738079149623798073810167706094070842646222833137345669922898403368997676634709281456818189049718956207208697021706186341405575300648248555331280690778367620868775005181264547924615247991795542738868003191757946979714250339430363902549866892041102771965653407197094250270379367437342632741280710'); +INSERT INTO num_exp_add VALUES (1,9,'54948723.74225051983134098996071145685528795757427462111901537365053896571438476055974853245403475510333627298551845046116291696445177112567064282766115207407461565363967417615506303416694032848457927390574251904212425813072768882213388082765916956736282110801611726537663292922699021333445658549608928179155685881583228490235606377831724593358583903616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_sub VALUES (1,9,'-54778236.95145002027881946516375418483956830283115745569981757335827825115701888818627237691936643048426179661497641859124500994829625897874508497095086558766563666622720535497438693688376602804651302002795213923698663694204683995198328880575615535181012624198813873609885725228117274934655048553507421448724831939026752650108735245933317237310133362383704426321489070979168993853338252728216162346796960170352897972568238870481118474064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_mul VALUES (1,9,'4676749348240.390309875431213992853550297086049749814750492488995108783145961719774217441193547534210468967573344456866203963659951312519988497979489304488948342258375915152429008993288817366720647491166024151209542534474867042837694499222928509320280684557676243780452100132238968233413333851595648146954975713386711764268506890884764704949969602122157394714663532141060559896359465918874990769222345665160127552795532197771168442486088776803398878354288847069602460071745966589164282641033852314335279121191855487126430176047553895892632834940595958394834437871886013513058514896870683979585091413977173250824451205330441299000850618134248917380244749589254309567551846327349592529960432446947239714236828401206843011440433362544797025114476612133622499094287321570559088587999417440664282418005102546343020409520421747216'); +INSERT INTO num_exp_div VALUES (1,9,'.001553736563217204408368240901181555234014339476186598647410198373122572205209277343865051610898136462487966496673511261433286284257044548634547569923035899634327495195510767312478861719221916387940027268721306540663743713345337497285507595251328382906111997524508729275471287648008479480805967901972481289402930660848950039779707354469389216931774094174326513465502460315792834278614886136688161679443873815113442220055827192996984074129528034845339130162104547166079591654852164993577408422015514100323825529286511720963047269483211930770803479398243069649400360625259869765138545866815758888670363356947311319523139395191102286838888146829667276592755438606664644975648828848738708349790766370694194763606850690923803984129157519048493985198591771429264967247245289970213262206709011468289046840862597010969'); +INSERT INTO num_exp_add VALUES (2,0,'-994877526002806872754342148749241.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_sub VALUES (2,0,'-994877526002806872754342148749241.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_mul VALUES (2,0,'0'); +INSERT INTO num_exp_div VALUES (2,0,'NaN'); +INSERT INTO num_exp_add VALUES (2,1,'-994877526002806872754342148663997.64812998474240514147207095573950146764154822009863493316394610578375247334825932838513167168342610420582834742950389452212867974756590355021495169819086060202117180229196935525386766373096687306110481009743118940565957556492470398904849289222365256698601073536111216152709126800604695001949246634784573028721762079936564434050796321975774729383704426321489070979168993853338252728216162346796960170352897972568238870481118474064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_sub VALUES (2,1,'-994877526002806872754342148834484.43893048429492666626902822775522112238466538551783273345620682034111834572173548391979999630250058057637037929942180153828419189449146140692523818459983958943364062347264545253704196416903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (2,1,'-84806738323879544552397401815149740513.8505875535743013876823142649666132764556588225959336097903898464616542203793600590311980154402068027051522932586050753865288419084437796768749509032177577451738712965496693249429231838833655025794915864261585848007162358912070811805298210095333433397862313304655108809804359760907473898420016370058274978588765092161529583480924554820756527238472641797198545539410039895140087686344382628317530286295498797849942258314364503000942821309916954725689781458590617068629906894951122301020797266469357701283289275708774593896770378558232444454118891917258610753077932026885574920166837998049508644891327208474213193224700658584824407382455480657734911543930195324144216374573825'); +INSERT INTO num_exp_div VALUES (2,1,'-11671021799770914903865020509.301561107153561058074179843542446420696517132461554451075945807420674211966679216615407057626541711186781735967334896541890595771915856783008831770988426637435694856170266346306640678577376310547806764332837625966429200996250687908930748245035578756314083608655163891041399241377675534416837659335561005203219889972336214863417948542956735403991871098341470996860469878038840964359144637726669728240650066795729910649523281308716277906908340457162235831526838308777581569974551673352306004330423694524256415657620427590352277556907586751621496248973165690360552007637570957980230685679819820147036159174977086193494572117089582758015847544798464543446227632367713941117001423437766840744488426025388612316819120660814681298624293065972395923651314350558006567251033289878238407790871784676348196394482477767774'); +INSERT INTO num_exp_add VALUES (2,2,'-1989755052005613745508684297498482.08706046903733180774109918349472259002621360561646766662015292612487081906999481230493166798592668478219872672892569606041287164205736495714018988279070019145481242576461480779090962790'); +INSERT INTO num_exp_sub VALUES (2,2,'0'); +INSERT INTO num_exp_mul VALUES (2,2,'989781291745465665243281323944996915810556285052564220274237162526.1617859904902612197894543199389468971679632139059029459520163585971122643624316475417489000981872666677202334180945949860058384424993911721081868337499377890298636260338063268639283065887210924895929155083478140340889209440025415565915964293989840603863813531303253038823629712989041722072693449251635519992922148998556112923060331794396659338057474019846675262291146025'); +INSERT INTO num_exp_div VALUES (2,2,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +INSERT INTO num_exp_add VALUES (2,3,'-60303024366845387174536638750234506721.2758014749274942132576365116182462208228193753118527959000939070820507877345194783035668195137119648748792386548310474079340204536236936213411512867171486174240518914767934028451971067161683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (2,3,'60301034611793381560791130065937008239.1887410058901624055165373281235236307966057696953851292799409809571799686645246659986351515277852800926805119259053513475211488115663286642009614039264484259692394657121785950542874788161683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (2,3,'59993133911282372667149627097418449223835595194300848703012380022306762.154418449236691515146061305380465061074531890529497774836941002526095632166401249277270674802626154774328055399254982998368191676630276960361274433270795772477146870294928855773172789856196219950097157391050424577381777627004101100872747943673762087675405200265837631665464736842180920496158545887039337399558993437594084473932658319914390365451919627956823980800124880375978662052111797881386060353490432427832058851094210488804887183034572364751639107535041308434932952695103493677600969712634416241541391613699710826602011076372592299807609658979777598672141389319098817824624950794758296679318319299142035'); +INSERT INTO num_exp_div VALUES (2,3,'.000016498242835741013709859217005931279826178662180173096568520102488480129191427472581644597420895622947234184547373944996197105916093347103336318249582032230903680989710242610024298937774441533502282949127537125997753002819456724709929935850697744632904111143787011103837624936502324835260843148595669524694347566421203164808527739207590986975750648112133699756328511947175496694080071202064255118777680958612315513441989609682655431197367166056616661045712867189326408877133865572680407329449150282415810958772293869902662884761202424695742898573841869524376684740249281181605067345203479719345061595919652192297531638467223956758315591610733251562492794891852151639643060692698365496208796638230566761231611376199140556503620471090364900792180618741355091923808605890415081571900697282725022629812561702118'); +INSERT INTO num_exp_add VALUES (2,4,'-994877520673428596810678826533995.79421257464236160757218576989993781147390382997132644206786872350652200243563770552469933194637146474528320738725486418004701192337175478117026439697031462361180324038544450723753402846519731908503949116978812841497201119103409772457270340059605961197538918709309004130294868847110690336360689446090125918336908930881873778405661757289469281163974774492810850778950071063044769131228124355961427111369335109426492177657001035045332525699055300921341010989742896430768506909949340276549373661076950964959025967328861569387160956730002517417236732463510495205173523163676450203614971844583064927040066684531931069310935516821795449174271052747559395296525950219449541557191520903507653089998307641491381797101485104546410643'); +INSERT INTO num_exp_sub VALUES (2,4,'-994877531332185148698005470964486.29284789439497020016891341359478477855230977564514122455228420261834881663435710678023233603955522003691551934167083188036585971868561017596992548582038556784300918537917030055337559943480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (2,4,'-5302078674303935968062773235453828254014583744527466365136.236414807326868572353809920518232561005161225922028750078608989965741402418802255050636954800114792425419735155504035469350521800895164087027043476055514245942961100610551646034472084954313670284875310691807937254054948742125729353864014122131419164449567115006621212424805182687707372956385102095255735458593389920872596796806885847543910224476727171570873698525606016990229936284811067826588349092841322512643043008589065847223683467371925773023109720951609815041012521485326120380123169545818055967455575736140138663815073081494226676896278654189873597341203197903408668523514375373841493189836809506003729379742035629498519683885268256481104619815130659628225053833297766479068686119691010593208135616363994230674606991733148502293102108193522604968743948323130517040609601859735899914987426089053869350663'); +INSERT INTO num_exp_div VALUES (2,4,'-186677971.517539861245390308778107722315862721823627804195528485535806132067679059453022306691281662574091826898288146790399178357754908901382135796783067563944022498807930452234032896817601590728156392188660701355670595952594500812333935362955625137944589981298793332621503315902294100258945995827423279442031218510259915311555745581797315793010762585658196457363672908315687720174516274528662385172326028870945153551774300419158584379602045442200523311437013776079979639415633358878239012925000523542907592866797199229858272764668664323316251874027468128770456766875866492004650352654523634716923150212263912760225390093339729495231675627059805624175587380165509763048913150826017167286786277908970769297060278191518730887417202276531151575412404467497036737825989088867451153485938272367300939127313445244028528055624'); +INSERT INTO num_exp_add VALUES (2,5,'-994877526002806872754342801504871.47809095279915423939648794226185974985600242391612965412218049794216637114648812993201775787765690351615479957141288239552036371132381627958673244764559862836085530643408020551049895730005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (2,5,'-994877526002806872754341495993610.60896951623817756834461124123286284017021118170033801249797242818270444792350668237291391010826978126604392715751281366489250793073354867755345743514510156309395711933053460228041067059994425117350974491367099004404995846913641329458537237789584653041949090121498951516476399288513593944575192159570458664608461677113504914551578443229008454218964701550932948083369656042643364608405637360180021322967144409944099438498649645368196191999692949583952927486593144959284443545794934667002661774373364219852712996869245745722896071593910890197478196462961042627387162830776094709087748993678069776845437889735782063'); +INSERT INTO num_exp_mul VALUES (2,5,'649411906691138274293985410502516861224852.2323455192714410716272307781034189160865613770320102043319541634113746032638191509585045862973333645830298922352816245477556264222094036953195419857712804755170632292914187367964994214922001758104594052499795564860466055599417895782179851297585155129541589802249540436678824225950907268084876110445460948679383611117263673106597132046331719468816839434908155684738864149955129235751738204036443603521478609787295079710078973503970964790273461142497259987849074597264522099648376356902360358310245001183020992360260836105404118742418040965190000718736837422434593694808973939805954329718232693154128543253581495885789333274488461716809104532693754070810202831113003978085636579574171344721710232931261731022478029314435363413498991740750878099825781577297965642009156858479681236085226911858782115'); +INSERT INTO num_exp_div VALUES (2,5,'1524119409495532727030986.638577103454261465522025182901477334004986357902177024959076085490119358611626688213654669281670407680244740174673394111775678935383154847014211641601227316639834450258566053805263858706381900273201146454036688771735398324537667996974210741719621449948660517037619359095556637235980122706739013220201060795557114248610410815988952748489854367480813823114296393315170621979351958306734282429929421779129764262568942699813166237466796852578307944635545174715298176546980314973426586923195248536376403319094417073026382024413817222396402299695717290716014320518777088811749776114378145110676170242861393274018655137797545194817703831240390631723050378397773341835222892981773205967439339460305257986693600088957772328044922955990976285151896366292514128607363007421484320868718566256882080399264346243272770200676'); +INSERT INTO num_exp_add VALUES (2,6,'-994877526002806872754342148749240.99659316232359475297606895243958507460511031229368344962653674268847910587702140353344168594152240599109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_sub VALUES (2,6,'-994877526002806872754342148749241.09046730671373705476503023105513751542110329332278421699361618343639171319297340877148998204440427879109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_mul VALUES (2,6,'-46696638263247522384986521136500.479312417066793299922708112595886608370451213741279484136907754744903470430131032928908162742687359367826808123516519335458861613010646992354378739165872253762686683966945711430182491860196341344982195078000259063231136011430995647812149294224699587849791008794261026932467933475782780'); +INSERT INTO num_exp_div VALUES (2,6,'-21195986018643887410662481595901800.342199657994285865579781485758715114242459388977583220756870314514884887803267837816669111279417861218648323488364513921592045485003563036021370174294475403630933854767386355037781881144701319212711655881277140183173924089814927297045029394618083349813549439341772734606115369911736164723942330187830605893993276674913563980890459604886172701331890746621222114280438198802989678877404376001410627722336243835841751052795437979198996482216031399073597399901975686733315751292369326904428230195579137225651689857057115970784985439417129044974524632220457594191305254649113470116960582543784928547885740020507755033347968928034294570497118410435615856155184563329718831512839630769097935523279881940380220955993456451396417879773380305142918906742431812580562496634831735169817705720949712410595406012323294829461'); +INSERT INTO num_exp_add VALUES (2,7,'-994877526002807691688882220594983.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_sub VALUES (2,7,'-994877526002806053819802076903499.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_mul VALUES (2,7,'814739569184924399102711674444306584731316176345067.39834031417849342571224916231092924046722938910652929295271097903377854123984307101079073134405782275535446337229706620713104545454319555885847481531722101704765783025789147453570970090'); +INSERT INTO num_exp_div VALUES (2,7,'1214843772391778.127361407585140553741220126410637250571020684739034685508176000812180032686291124045768750332493129822580347351032145964983629059968936201592138368806173099130176852606440296388856520582890650384142745607345709716826703676313341953999327129144154152914234659001555055379537780751567782847296067128932113870102563522810980359433259696591977617184951677390423898232135100000764121508662830515405980450892222598485287609657612482190264517684867291774820716746063133066053446257163185646067618679478975882247893469409405379034723543061767846895135644429012095930584952053545016706315299076691015196261253199176743281648949731423486208098120903720124071047872917636988241710583721537777321338769039241700203546247947405745989053846970910400831817998342969657501678430211657755864160072525313889413731419647001970593'); +INSERT INTO num_exp_add VALUES (2,8,'-994877526002806872754333651763017.40289299098701084219066388457144979069028441485513418625082363021182982914675513019536443438529749838106171095037135009526312783302868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_sub VALUES (2,8,'-994877526002806872754350645735464.68416747805032096555043529892327279933592919076133348036932929591304098992323968210956723360062918640113701577855434596514974380902868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_mul VALUES (2,8,'-8453460632655529853033389979024265783461224.3195241893307807116624750282852146303290708492834695194274289713076935297734670940696121761483641291930931061232942894577813178566088927221374036301485916497770984757492912292002695944367308880163698595015497307574177176409203214324418237020500352652934909632442547242092296504047310806151851207329042221920888326000'); +INSERT INTO num_exp_div VALUES (2,8,'-117085929036205907700251.219065234073336548829793284434494573185718678644093751558890746941383215425734761534822966779511801033216479269605150574332107020180872343673157350081102818832254463561564431056604957702984438484261858890324442581609284935850435611342611117035589511568432559140282381526487115307554496353616929034919886387903446436924514812698404129456069856633480965357915969548215985452939172313964007318881987188665231550330515412104367728617802960792164260429920719961650164518261501571220901151359208484337831586551714193024143212288426326740373893030225940355268499071669300664200888186064836443459131985786957267268845966279576380786883200277187591448294590370986026461176853573555996139940001165172158855197070946665074838360933025833716166930231164328918316437195201546383664484983447934244744303265471044295601062898'); +INSERT INTO num_exp_add VALUES (2,9,'-994877526002806872754342093885760.69667996446358567630831677089993316481039076439881735980566785462673358516198695146576524119916430759085192883825888457383242076882081857926408611052522393579396644731758241837010163568445385303315267086044455246361273561294141518329233754041352632499787199926225490924591851865949646448441825186059741089695009429827829188117479084665641367'); +INSERT INTO num_exp_sub VALUES (2,9,'-994877526002806872754342203612721.39038050457374613143278241259478942521582284121765030681448507149813723390800786083916642678676237719134679789066681148658045087323654637787610377226547625566084597844703238942080799221554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_mul VALUES (2,9,'-54582443595378013373024060492546032003692.4875677735896411267274323339692558458420972958075073392126734000341372096298914875892612108329218081214550050039133117695428196702128258481789017059073444323729583900855712795086447886053552786449313809589992185978097430132940882612817775035217244553616977182049775786664446683332098226841743818600819221587510039430478859412452506872131851471967577741190323481953867845129745440745526578327709351120432530702446916035797432129052518980799424635406993848916727957825620638983706180841278402925286540375225365057191075559133035'); +INSERT INTO num_exp_div VALUES (2,9,'-18133693300409132895168796.074616314168631402221003009151140409826855230810646429042722071403306917323628118792142878282108022292754325022530103525285999179488507720688317761243448898240836430183645778132937666952111134601563043980164547020295727057908447220163534134835130866457657964382363853570827467081988390359191484798677813656413640874450449802233520570178139244957518604566383671867773821069602665918688868868894979351219381089954104823746091972754649316823714354000113723793845707472924569647945844436702275724514171940901057842455729977729388911537391920702753167125695758365521631000334183494148229356487592577177344247694925635113222720411958290166668659311154664393442690740373285505786584987609789805525300762074682544164213490532272590665630428583216403362629445153016404037983825555019274338559686335405719430737559715778'); +INSERT INTO num_exp_add VALUES (3,0,'-60302029489319384367663884408085757480.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (3,0,'-60302029489319384367663884408085757480.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (3,0,'0'); +INSERT INTO num_exp_div VALUES (3,0,'NaN'); +INSERT INTO num_exp_add VALUES (3,1,'-60302029489319384367663884408085672236.83687099063256754698860828386302509843815398979402006244388708674093244201278399438376682321121138429850885935540924586964982855913223221441591310211730902799041126800414795030815514254713522692405212716783388698431088814919226444677188004928663343696636297536500970117716818423689175692808344185016908913828066250587407384563498516598672584120143890364303296142744031320345312431817858545326010704685255237541162931904446804064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_sub VALUES (3,1,'-60302029489319384367663884408085842723.62767149018508907178556555587874475318127115521321786273614780129829831438626014991843514783028586066905089122532715288580534070605779007112619958852628801540288008918482404759132944298520148080184250697297150817299173701934285646867489426483932830299434150464278537812298564822479785688909850915447762856384542090714278516461905872647123125352735037721325154184406043613668806975385533851732090363979459292404685190942209855935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (3,1,'-5140349743195574373979577554212527512597024.162480344833040409158673429491690439298506850052285119390701002577176786023622062742050099464897084793357329597395417632908812044304066963549928478520702505283307379218587635434673128958824348493758429380623577527186462464399974242800361134191519694694139153279582776168995426125926314513926640766117733774558011741611075336271613675760116784769700605008122422944290652448956922432960815546502965310676913079866511016221573557684245901002643719965652152439520727383305120298495304784052489867651462175349450610643411043707261107569691076730261762793560088893354750383257372118118753366377402045596735023445172252225346164608897913115394905485106225627590643805003075069931177395059698550161546962768768895596088478488887530518018212441345360153523733317120037436403475909117998647781920105313938836144009539683'); +INSERT INTO num_exp_div VALUES (3,1,'-707409990019504668223608170643582.082425157530076679823177950190511141917761066423266390864536360056345386873500583953954967225431526056199231768143978526582904071798714789552447782850723926323452633811653766838064983821149041415149067433978085927687765773012158659685363079191901396502099956189371719135315616249471739677995520904113581848295732911534266040260836644379296158092198514963023001686666281725991605685524015227112003429486755206848316731257322742428352116058878710728614841247581716185886403744830796740424927494009978599974431617064012221450054532987372285996679180090592706458366967534834069977644215413076082570497451654516268857039718730203921980307096740864747006176117071983875364434497517026142488015705391255750729200497229031250705777282987863242056223584453312226818451807347197583925624299372040413470456696588043062815'); +INSERT INTO num_exp_add VALUES (3,2,'-60303024366845387174536638750234506721.2758014749274942132576365116182462208228193753118527959000939070820507877345194783035668195137119648748792386548310474079340204536236936213411512867171486174240518914767934028451971067161683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (3,2,'-60301034611793381560791130065937008239.1887410058901624055165373281235236307966057696953851292799409809571799686645246659986351515277852800926805119259053513475211488115663286642009614039264484259692394657121785950542874788161683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (3,2,'59993133911282372667149627097418449223835595194300848703012380022306762.154418449236691515146061305380465061074531890529497774836941002526095632166401249277270674802626154774328055399254982998368191676630276960361274433270795772477146870294928855773172789856196219950097157391050424577381777627004101100872747943673762087675405200265837631665464736842180920496158545887039337399558993437594084473932658319914390365451919627956823980800124880375978662052111797881386060353490432427832058851094210488804887183034572364751639107535041308434932952695103493677600969712634416241541391613699710826602011076372592299807609658979777598672141389319098817824624950794758296679318319299142035'); +INSERT INTO num_exp_div VALUES (3,2,'60612.515523995516156897729403721504966784736064970538891936016753206905080265887046037910122269129293912171105589512464185386239562077778499936203155976336284324712221812806801062157592930664021782540155687632208890794166119782594464410498356083266087045927038416810562596141871858142749062925965665039981381277808608946877852933015970874447235220989360704166270479475802673572039541121473138382812420076284458769543418652217394352637294823914346726065145538710933281768776286965107974980550163605068693568717671571780028113969794125200592691656568731359981803586296135840575095063824258761205175762907549288801963550628589530419118771779395037240198270853609924445368393952404606326559485235840170339343865253618184271158932135392539396160392488927771488269959497352568205940636180870805982484030168838833607478593'); +INSERT INTO num_exp_add VALUES (3,3,'-120604058978638768735327768816171514960.4645424808176566187741738397417698516194251450072379251800348880392307563990441443022019710414972449675597505807363987554551692651900222855421126906435970433932913571889719978994845855323367077258946341408053951573026251685351209154467743141259617399607044800077950793001538324616896138171819510046467177021260834130168590102540438924579570947287892808562845032715007493401411940720339239705810106866471452994584812284665666'); +INSERT INTO num_exp_sub VALUES (3,3,'0'); +INSERT INTO num_exp_mul VALUES (3,3,'3636334760530744652235488357607657374520053530993537920755375319352615385278.023608692512217812784472508939511216316773023870624171279878340621219698109986095090336065266376220109007718694455520948311677863167090936408887147442375455695868593092154861636486745490748828207939155392396090682312136290864359484540126174821846208064763823279315343506148025281475729723686566174395516982893064510403581479746673749128344955124070957545815390178764940816628194640888255387443237798761377617383817511745005525149990207764725040109364671749403389999498572538135588695345112358160274671918953118753964073105250116426665508214894805722798842017943220605600452911496071424281587802689830031742105619630787641205011894680546049982654601956546154572720177337696285354350903475239411654436042931409507429892682706228354459580412759920815932840348933425754970917910500027837428631661182510071352138858'); +INSERT INTO num_exp_div VALUES (3,3,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +INSERT INTO num_exp_add VALUES (3,4,'-60302029489314054989387940744763542234.98295358053252401308872309802346144227050959966671157134780970446370197110016237152333448347415674483796371931316021552756816073493808344537122580089676304958104270609762310229182150728136567294798680824019082599362332377530165818229609055765904048195574142709698758095302560470195171027219786996322461803443213101532716728918363951912367135900414238535625075942525108530051828834829820554490477645701692374399416239080329365045332525699055300921341010989742896430768506909949340276549373661076950964959025967328861569387160956730002517417236732463510495205173523163676450203614971844583064927040066684531931069310935516821795449174271052747559395296525950219449541557191520903507653089998307641491381797101485104546410643'); +INSERT INTO num_exp_sub VALUES (3,4,'-60302029489324713745939828071407972725.48158890028513260568545074171830840934891554534052635383222518357552878529888177277886748756734050012959603126757618322788700853025193884017088688974683399381224865109134889560766307825097103477790782590061456916367930139323346273315068375646692125800496305291080749834712822775973790354498408104142209966769395239768969172107040437333428573572464689550003374384624966403962290572373571842567623422963022155546431883766327294954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (3,4,'-321372325955692885069615337209737469749246561535004445508427591.072860243358366933071485495726715620133686420023451450292996945184959542770492705998350644739298629407567812798540119555932604687814429669592481327761428042980782672136901602006622227365754036664912989085940235439697789102358431343119457114603363936544931303133371137532006899162833369543279729021228901466728220729625107362063321334489394782322741444425117731922691457341543446841167138481424319752111748042440994701571955325673470021626946676976482516292402239416632497972073915818846704053624707839813514171497746804751780741682011937606462260710753056669269928580460921188286249923152921382198282201761171043384698319895970192114563900025573490442674225227682235790590616707857188385274186584856872573669591460447105688151281208238908470285147895678001948902280493477604361481216667716971590499226735103039'); +INSERT INTO num_exp_div VALUES (3,4,'-11315021446594.877643290091276308982961654569173523687151347727612592478433578066762912541361898899908505997444632820107356713116459078630334224890355872486337973552333755378190316811715776951317058334754704988120078733912131691682869448731717816749620336196719541702138949084375907248656748314375183301372633028246109596775255074617515860012417935744433243071057057560464360663978361945666099558526069794464437818864063206829678640156992474597480916575712563493776637239091589972373682399519931569163592317107392231951775499293572134702843085474656152913351183535194499521618027894129537558509428098859715020703897463518891082573242502356303078754574312965093639182648263511466558336912294702019648266054331227425119096294871153811412169351624751542166779635702042223762951850816568617453355571302500885410532963789364822647'); +INSERT INTO num_exp_add VALUES (3,5,'-60302029489319384367663884408738513110.66683195868931664491302527038538338065260819361151478340212147889934633981101279593065290940544218360883531149731823374304151252289014494378769385157204705433009477214625880056478643611622410268943757215673170753460135411513114716313801477916713433956086133878890802448531292334570886746283905390661877220497842493537338035961123751393889400517474762491881277080205381424363695095196058838349029211365212855028824622924678684631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (3,5,'-60302029489319384367663884407433001849.79771052212833997386114856935638647096681695139572314177791340913988441658803134837154906163605506135872443908341816501241365674229987734175441883907154998906319658504271319733469814941611260503645706198407368762270127105340397375230875953495882740039984314121888705481484090911598074635434289709802794549714765847764347865064280637851906308955404165593747173246944693509650424312007333558709071857299501674917023499921977975368196191999692949583952927486593144959284443545794934667002661774373364219852712996869245745722896071593910890197478196462961042627387162830776094709087748993678069776845437889735782063'); +INSERT INTO num_exp_mul VALUES (3,5,'39362489275784146262776411377472433635883331946.794473520543457442955620133347015506556162839462623905489255080102447195050109095701660164272430316804466254467810714209179752718730906325952685817112992943656292503112803950215110778476301809440329937774061163668461957943313261962261081942055908935814323069621279128270849852239727888939033546870208376394878842958202403235309372240005941467570230067124830916866857395233038346727879951123599893174252558078732888910139309038957525961212820831321973219557165558911222848692996406741318948607549825343491479728117062814094258484536263158005174429922237853707635743736923521032098496725445243775790161216159399180889906705265012270270348146530113428221072591696851818281866095288773371414866822270689959827332258348570976075184933893434327278299820594014788148344260948638847457822697682605612771344335201258128'); +INSERT INTO num_exp_div VALUES (3,5,'92380711368470856513514428781.033155715252174277753317877861994356621252232374386687048394529670637693505779282500567256835271428113529026462111032257747830329068594622091282098767000694818101994264352932243278144124687156236926607422077479412495979777588932692081795130282128890441931602671468684153168580234070246201722180460130467506344034452687371838907269162119534950946217165384250603250357360223255177692065141037447374172264943732616165429783010079281851748804739433821308362193703012671569249508710820679009084891198169587484117171861141580870066764275087111843275285564262902405980617569581840831518012986031156042600391943605532635833608358301306456966765206853910579231447150839538731157206153540873916893579943906851149770881336811951119112558311734171557608362620988555075663589827484854016702489324791126228380209309587206299'); +INSERT INTO num_exp_add VALUES (3,6,'-60302029489319384367663884408085757480.1853341682137571584926062805631087054017160819890685789064777236456590745415460695320768374693076860837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (3,6,'-60302029489319384367663884408085757480.2792083126038994602815675591786611462177090630181693462735571643935716818574980747701251335721895588837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (3,6,'-2830400711649493468815157129316992649.40542786074520931471973065281957756940496588853021620372179463538053123396140685749478530925306163968207226329985017644835203709485594362663495728106061878665324856417118064730721101615473194292620972173690618491026470353143141125614124440035267592258385099934706896692953497971326605145704135723011753705907329979207428661473172503098296622281647255008204864404416199384701720347319806375450632245634238172654086373193251877533131784268854289406126119630708578053354762596511353053106459297339360827562281168219966099848212'); +INSERT INTO num_exp_div VALUES (3,6,'-1284742031601444539630782308463065726620.121021225455596762466053504195700643301310745151565435123335541550963124666304408503436412726848834604336377169205828654564329888653766451656774534718709065521243637375270687684572524302099749018591530352756390467862377335526634920857924031482455373589053524922608255779040656019538392173139295812160325688504210040741075388404155144782519528791757450256668977268409265390016721724966592135644698341754332845002439113523127047593325646484654291494607100188094186116001064043796216982681807318598789324900462932294782971663150070521334398542559480877366424630693734132836518604260869235580641521264976411493166969530737254118968281271908306432918913600567757535151861421384835424322504855607676315840963696944683182767935565256136130185809101891760917733694553800748568697830680328155128016670099315391685422333'); +INSERT INTO num_exp_add VALUES (3,7,'-60302029489319384368482818948157603222.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (3,7,'-60302029489319384366844949868013911738.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (3,7,'49383414785234649002982046297226894664526726187218771083.0993243619030008310875293647868815940421844461627295157812843657782639833900543200310573708100000958929315945039020410482966753145208427035917753919085618457760620513481628641658765820294863970581642745379331727722585319163262763708386199720411053619449096019862596221607526610103408936214184850115071874430846697061554769773328338028749631552202705583855831155461651414320570061181212214810086436100771547030013079997847086'); +INSERT INTO num_exp_div VALUES (3,7,'73634737013325927185.787791148221519354461791539553527545166847382784629235192342551464898036004011575416717008403527685470842765455409054592207142526523023201841973047779202013398235864494503216973882479116841765663948294836180515686647139678530220909072497288527276378202532400736141014848907023234659020093073127450778982904578906877634654521825977382116752537063128793631412296206704078569268566614023846282524151679028060869175439188773864994186109445961525301841201265289707928211114515861536069733921800160245586536759625418951427346236213019358749196674633237197452976517130405065120577692737021174118093373953642724512531935525024447977867020930500433287279183436509990047372809400167546185096048971157700858970777301410692908939206693154161335335755844997198191427289546263182822280127912118140820265025555165337881999926'); +INSERT INTO num_exp_add VALUES (3,8,'-60302029489319384367663884399588771256.5916339968771732477072012126949734214868901845505193155307646111690097978112797961939995859130827784737422228762767014427842766445950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (3,8,'-60302029489319384367663884416582743703.8729084839404833710669726270467964301325349604567186096492702768702209585877643481082023851284144664938175277044596973126708926205950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (3,8,'-512385513828318260570283740065493064477880918352.732624553690077857674083796435724202494963885926573907185100543184828131859183999195040110586155435203949963570735841632689374488877298209082579317039061893012560130258753218955057387206477423088065663401594359617882154814262843273526859406265633827109554791772242178864873774889091687515990672487380368975556580539271333144212685871370972163560839446696514092637412587953506052848750866803569213269271165856310101244342151576488190595936869490659700946174362872797854591188391982770203203644172999264143929484089237665313698600170041324566984832357000400'); +INSERT INTO num_exp_div VALUES (3,8,'-7096872691348467943606706217.907270287823269424282176534343841939501231816905820949045946136373255017076943323578903040918266385724756894003692978391468202345397178445216069294845721607024056189567609414049207292919519881725733381453217071918292453682942046440563446278374996563501512335133749731529362537349288419883140401056747081065947774593869673146309163791076953204291951821124894409171722911526435445719071769008713367057971351892550570642991097981458696464929009464411568672010548002196406312721789582428747564855324072212842315229302959908665089850886951261233852165624100634055045684536311382452553544676139507899503993644452161529145849579200003677255968757773363970434791501820320494192909660871475590637419913907191608957830524390049664686282439567943053924245852983990958276537000732363895444894582579142752920882750130052682'); +INSERT INTO num_exp_add VALUES (3,9,'-60302029489319384367663884408030893999.8854209703537480818248540990234567956069965340942024890856088355839135538265116174644003927269495876835324407641642359213535695803871472434650475144516723617632059130297610134243891145006222068960999879308472500422640481972089756410157246974765071949782242392661524488959954348903412713930092273629207697480131360047867213863018127928853922173643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (3,9,'-60302029489319384367663884408140620960.5791215104639085369493197407183130560124286109130354360944260524553172025725325268378015783145476572840273098165721628341015996848028750420770651761919246816300854441592109844750954710317145008297946462099581451150385769713261452744310496166494545449824802407416426304041583975713483424241727236417259479541129474082301376239522310995725648773643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (3,9,'-3308379209762459471107480259839508279070920437.883503980178028214343751083865562028455061662673132221930429904398963590401793045470444301883103141901787466923883803951815572606105617157736442670792467625964359169270739534412932791178258858918086886061702512427989129732248215348301444245772127142869263635282888226326427510486246184233225114523636171202034558843515894542952126988613018789833835507734620046994907453602573865012044120483116345444810078666601100257620969379968264504287700045822481492526688635364586344704730579892342786173395802035361824932075736340405960099542224953439044947229246847140957298841482874444906129049023002897135347878048572628834749795298712449864571996898774444932083319581439741625832405434317985988163261591679157437224404970927012111196724239860528859217322132733404472897289'); +INSERT INTO num_exp_div VALUES (3,9,'-1099128766678422054524173986658.839339966689456265703816212189145237878729886466041806078542573981227645802109969871638687985985845489422516004202630099080709709893022100481258818112345013009059633421290241583864468453396484606925071369550998772875840640325758308835852391176503689677263605949075815552026731067384737231681068134099746550363063940273625924224721503126912810251607546172009765059506591787282558727077669973711491157840340631805422942099954647016059576777054339588421998882440726473698513560202030309804089250300097589174314677765341104767702983421063649104691583044460507666600260994707192787133590502137391691330098102374713996115782701417107878938473243874299874872852713499024851414757892169376458916467621226859152075901273014182163212783658933754507272478777304254191033562324994395916168496097385872331012258027431094381'); +INSERT INTO num_exp_add VALUES (4,0,'5329378275943663322215245.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (4,0,'5329378275943663322215245.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,0,'0'); +INSERT INTO num_exp_div VALUES (4,0,'NaN'); +INSERT INTO num_exp_add VALUES (4,1,'5329378275943663322300488.64471790965256505869684245785528331091076155554650629138833809683459634328609777839510066435612911583108717191216693735823717997111970662575497378762952496582183738308720094529950793570383580785385569873278068217936841324404119828637880370718028782103860007754579779716996004352284614661690063919125301052941328989181561787543541920734755989452320799185700078241880935083616978140555713297241612718277766918005268951861880490889884082730841740604517529391011862694381726143520658746305661338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (4,1,'5329378275943663322130001.85391741010004353389988518583956365616764439012730849109607738227723047091262162286043233973705463946054514004224903034208166782419414876904468730122054597840936856190652484801633363526576955397606531892764306099068756437389060626447578949162759295501062154826802212022414257953494004665588557188694447110384853149054690655645134564686305448219729651828678220200218922790293483596988037990835533058983562863141746692824117439019450865871047657552800448629502344444081260036580660700595591338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,1,'454294299613767152878025320780.534199313974295807138790763501115780294529340799108297697573066187975311338382917022391830256203305238757334106943821060545424417350991354829668286194840925251162479496893943917530660694097932059166013476064988623431110002057735318529554555260199417935495388243829261809007709919225000608711536928171687251088217591210419208480251102484043683131687013687838713055660405381318396419588727500715930145098362997142075433472039319292466570912777345841400769387321465602989947078951135489852486382469990409873227894248208197179481868230244584527040573428134962626267135732247029762468417273891700661832893497067151409134724061246612631376075173287264787886064622106855886785805818642123776489793586531950438285720668411465570116161790343538663297713926678759640594912243360541590368666922379919514826022141331900181'); +INSERT INTO num_exp_div VALUES (4,1,'62519544780217042176.800424689664850775296526267109332647921183817056683200043718160298562843864918741523494444361916531159341418970534833628106062976341639276761669219281771109561175175033739624472497927501467465456946098280878993371659461957361369508794842102784763955539708800574418468150309301129490186416766691183270872711413796386178009615777589066235359283212636467980113350635181915492452697347977967985810294150853782607014649150457138118264698071689065469752702524632313088938504181640435324554007553994564705401249228914199354821595855823113730697333390936834057091883654016371107974899726642500486005445063301647520527084320363513388355471718583708935211830796440056542408492723718088396437530207347815505844074508948817594746824098278470533148171941442049323578854023683167934569551595335539887777638716651319134577441'); +INSERT INTO num_exp_add VALUES (4,2,'-994877520673428596810678826533995.79421257464236160757218576989993781147390382997132644206786872350652200243563770552469933194637146474528320738725486418004701192337175478117026439697031462361180324038544450723753402846519731908503949116978812841497201119103409772457270340059605961197538918709309004130294868847110690336360689446090125918336908930881873778405661757289469281163974774492810850778950071063044769131228124355961427111369335109426492177657001035045332525699055300921341010989742896430768506909949340276549373661076950964959025967328861569387160956730002517417236732463510495205173523163676450203614971844583064927040066684531931069310935516821795449174271052747559395296525950219449541557191520903507653089998307641491381797101485104546410643'); +INSERT INTO num_exp_sub VALUES (4,2,'994877531332185148698005470964486.29284789439497020016891341359478477855230977564514122455228420261834881663435710678023233603955522003691551934167083188036585971868561017596992548582038556784300918537917030055337559943480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,2,'-5302078674303935968062773235453828254014583744527466365136.236414807326868572353809920518232561005161225922028750078608989965741402418802255050636954800114792425419735155504035469350521800895164087027043476055514245942961100610551646034472084954313670284875310691807937254054948742125729353864014122131419164449567115006621212424805182687707372956385102095255735458593389920872596796806885847543910224476727171570873698525606016990229936284811067826588349092841322512643043008589065847223683467371925773023109720951609815041012521485326120380123169545818055967455575736140138663815073081494226676896278654189873597341203197903408668523514375373841493189836809506003729379742035629498519683885268256481104619815130659628225053833297766479068686119691010593208135616363994230674606991733148502293102108193522604968743948323130517040609601859735899914987426089053869350663'); +INSERT INTO num_exp_div VALUES (4,2,'-.000000005356818439105666775800262590702859770599410113087721172791624002387236505438218124867814437523686300450045582100868990117124343222534568799037421944272316277130975314766456260710406160143182498931595199129228915695802952695510723443157825968340043198200740606202264287904755124946591110599335909404657109057432686191440989434662797205973563889238804413861126260401987949920244286377128599413927273444061572120561496904543200956508673923547626768641271397088562966176629018606103663605145666976048261236691866387601532424530473754175270500777679603569715192364542901360534980926452487443629100484491344001509360344122933911316486556042277769848194790964257060927912344609376571637126617813506411190014141992988288983968823792971270853369317867326071952900448455162898476163801382836761898292684175721846'); +INSERT INTO num_exp_add VALUES (4,3,'-60302029489314054989387940744763542234.98295358053252401308872309802346144227050959966671157134780970446370197110016237152333448347415674483796371931316021552756816073493808344537122580089676304958104270609762310229182150728136567294798680824019082599362332377530165818229609055765904048195574142709698758095302560470195171027219786996322461803443213101532716728918363951912367135900414238535625075942525108530051828834829820554490477645701692374399416239080329365045332525699055300921341010989742896430768506909949340276549373661076950964959025967328861569387160956730002517417236732463510495205173523163676450203614971844583064927040066684531931069310935516821795449174271052747559395296525950219449541557191520903507653089998307641491381797101485104546410643'); +INSERT INTO num_exp_sub VALUES (4,3,'60302029489324713745939828071407972725.48158890028513260568545074171830840934891554534052635383222518357552878529888177277886748756734050012959603126757618322788700853025193884017088688974683399381224865109134889560766307825097103477790782590061456916367930139323346273315068375646692125800496305291080749834712822775973790354498408104142209966769395239768969172107040437333428573572464689550003374384624966403962290572373571842567623422963022155546431883766327294954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,3,'-321372325955692885069615337209737469749246561535004445508427591.072860243358366933071485495726715620133686420023451450292996945184959542770492705998350644739298629407567812798540119555932604687814429669592481327761428042980782672136901602006622227365754036664912989085940235439697789102358431343119457114603363936544931303133371137532006899162833369543279729021228901466728220729625107362063321334489394782322741444425117731922691457341543446841167138481424319752111748042440994701571955325673470021626946676976482516292402239416632497972073915818846704053624707839813514171497746804751780741682011937606462260710753056669269928580460921188286249923152921382198282201761171043384698319895970192114563900025573490442674225227682235790590616707857188385274186584856872573669591460447105688151281208238908470285147895678001948902280493477604361481216667716971590499226735103039'); +INSERT INTO num_exp_div VALUES (4,3,'-.000000000000088378091435340426596348183959201660680284222502095357746364378698792730669202270228092348823133529449019715406417264278615046537007844589547485282959556860316942508808911542109265489435572674031608663747132688980867386885961271358592278360097086532747883342438036287136994589308551796702164612609710942175900921197001888540314760352113821737014875886635147123114456910985089625906448913621495025509697742196814421833448856595853403450682101743559369637786458968714240975228615283970739279506239628546165569688434254286341567486905374255702980370754235630955328837646999003123103831262789115646588779721625156078607919060762857866951417867378220773543985422722165221371084387943737083254760594128718841665355053236168688218864433967871311858292181233490194833547273501436630325295640020916257836404'); +INSERT INTO num_exp_add VALUES (4,4,'10658756551887326644430490.49863531975260859259672764369484696707840594567381478248441547911182681419871940125553300409318375529163231195441596770031884779531385539479966108885007094423120594499372579331584157096960536182992101766042374317005597761793180455085459319880788077604922162581381991739410262305778619327278621107819748163326182138236252443188676485421061437672050451014378298442099857873910461737543751288077145777261329781147015644685997929909334948601889398157317978020514207138462986180101319446901252677846098070081948065342276861225678086539994965165526535072979009589652953672647099592770056310833870145919866630936137861378128966356409101651457894504881209406948099561100916885616958192984693820003384717017236405797029790907178714'); +INSERT INTO num_exp_sub VALUES (4,4,'0'); +INSERT INTO num_exp_mul VALUES (4,4,'28402272808100253242547006276715304015308580784958.804614276533085644370816876160290159450291717634111299841065255625515058118012211808741402904995080624675460593676923639082981788732031193774047612589113654423166826140872334380708795266307037944059108148612979119729408762532396036043629484049508789880964586236575769826806092391573178899640321403656891487586452524427223891405519836671312830183895761747460911777623703557946796784873885800089025388390522992806365773290733075927321101736155663727528284512100509273076328103465333687228713897893434161293693971954442699482857938492961830350598789444266860160794913830991304996676299650460125000959751177037694425217989910261807246272771711816326991282202653917488360776928533800529297474279497910326579608191975246060946079639658615178160271122713225105861574160788280907842327681375920919676063500116492292319'); +INSERT INTO num_exp_div VALUES (4,4,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +INSERT INTO num_exp_add VALUES (4,5,'5329378275943662669459614.81475694159581596077242547133292502869630735172901157043010370467618244548786897684821457816189831652076071977025794948484549600736179389638319303817478693948215387894509009504287664213474693208847025374388286162907794727810231557001266897729978691844410171412189947386181530441402903608214502713480332746271552746231631136145916685939539173054989927058122097304419584979598595477177513004218594211597809300517607260841648610322863666300637648662611916496850248528515936635845594390453288113296413254893687029540384176335735114863908372780241463999450547422213639667099644505472777149095004849805371205203850993689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (4,5,'5329378275943663974970875.68387837815679263182430217236192193838209859394480321205431177443564436871085042440731842593128543877087159218415801821547335178795206149841646805067528400474905206604863569827296492883485842974145076391654088154097803033982948898084192422150809385760511991169192044353228731864375715719064118394339415417054629392004621307042759799481522264617060523956256201137680272894311866260366238283858551565663520480629408383844349319586471282301251749494706061523663958609947049544255725056447964564549684815188261035801892684889942971676086592385285071073528462167439314005547455087297279161738865296114495425732286867689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,5,'-3478781676337858247983014311182511.567538638808357215203593479841446379226774481291286361639429856698999485760647422501864626078375852610019829111004807806660731243672830787729048847342063218718651165150612717759770504648306347926061960607388621011846314969634048226452709389995594961695723139571002939804473057725442880410434039783304583526414509590532906062732322732569475349107437896717416548237633532805602064623969799081086996320156575550896200848758685986331692388099427314008504506503745527468550106879602399030419569897808150076298414568875477195447656904373310322813412927463518325927626891046356679526447117311923853482118502868148386882363449163182892615259995945992014431502761210899772725227648729095696228388558331052524469604046072203605897109629560683446827492904111565278516043939137760721315953500281379039771826554155511347152'); +INSERT INTO num_exp_div VALUES (4,5,'-8164430956184510.184223536017248184022252663660196916321116266103608317725855237211273642694947892658721606226082017525816544904635887836163201565923338826779819876742736219975639586566502584026349778499211535661173597356253186281116862244165796632756909578140184577853088376334255860281874385669242675881761388233070861374295536603371778669602656670852115614651462552069294889723058758969660566508798011830996965570446030123780674316363670374970480994905368006454513642480180066435609577311074332150098288374616437489163254821095377348025470309665651059603665062887597814064136313866690824972464351274062540825405003954064175728198182815347642172934453828192850870808373638597839434504241236228591053696481146252072190903430582534862988719805163692697482513169856291048966811374872266165034373412719593685881972700171726777938'); +INSERT INTO num_exp_add VALUES (4,6,'5329378275943663322215245.29625473207137544719284446115519970394719946335145777492574745992986971075733570324679065009803281404581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (4,6,'5329378275943663322215245.20238058768123314540388318253964726313120648232235700755866801918195710344138369800874235399515094124581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,6,'250145412892811547138949.592621291590152419206270097656346630226508074074623894951308487425470437268130465956063593951784820669318897182831355375451719125809800516979013437732298382708070979871283132689492336823087794373113039154669229889503700598930220858275174342776478898670277868700384853696009897221747924643343353942154528501454689084608965009561564638167714973711022212547096732831847202912862290958304510651828842182545311077713664465815992616213663619529378061133917572474298028065850515876361609671565914027186063801852554353160801534696062207299890867876199323530337336273950892723090754719547285920090419070001019943385293110663922226230169381423410428577990604776655422105400452217085311617728003688836185608912367677734364834577573255789160419371322775733777518997638403409000055707558465286469808848200141192627396502735'); +INSERT INTO num_exp_div VALUES (4,6,'113543048739697485358574290.758354267447744932153707340542459183720907885610125346262898114677742971240785031722334497858930434531517077525413654346644836353208132641713415396062580605566225794048569430676355036264762949452090151450855446984773994337170590068740235544320694721909983307239491151139099779296496785240814600627140543144068640768857707110930453204162312973998304574796413938461971472337040811785231390930046688391955000749644938061585377150632133417156866197053052425576957646564943278156977176976876921235395711611898108821587442609611001702344783440618040704066809035404237786023075676374788819144406909313755996914145273176359246052899650387182222905558751208368173052381982668563471143298720677965028880626152749773712037769548408324298835212547215352657271696665387200792785056233953536347605130973626194099064678842085'); +INSERT INTO num_exp_add VALUES (4,7,'5329377457009123250369503.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (4,7,'5329379094878203394060987.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,7,'-4364411947278810125327066890819882483326918.05664098958260550284395870948992407314161088028674246708928421994893923699743452802989464864039994566042797942433140378990308345483670828497915478397481687305406460330009319949623844175096007381662809083363069100235985794575399268709260901964834244796150883807308976949196661411035264619638771824190014274817662519438658481432363824187693821267613212631153175155634316128036152465184903927860719447693468054624663668062006049759837326188252927823612718163916100588143128358998656306593393889422386501730237442526450419990376323903182669190482615734972147533221144682538647497701130447816148459762464395194383090936159579764712919396391813914821973715879062992249315474841639591907249142779103650773383644785606333916967894'); +INSERT INTO num_exp_div VALUES (4,7,'-6507697.520580964829176145824902679560705744817573189143227837387224410616222039115571544850095278317993922427931439719549137387753697989249394347047436951117850128104928719365703899136632100669607126357491484781141296021264049762417528697619931558728863308905257358126654378784709213859234056696519305650316810797382293500878834933984458810656133463638442959750083607649924453935287420620424368291770694630751828333903156364366745210911640207075765008558904788350844410055253643515389003711759818446776538393914018427075074171758415188027562645239606914126802490579848138218395145734902830046359100742374008993296019987093605275289913663224324033923096998194326249508491872193747944673057257521552387923218450155737056841633810711295424578984452176016198348344913655301417872189073133147510027427530833694019910340299'); +INSERT INTO num_exp_add VALUES (4,8,'5329378275943671819201468.88995490340795935797824952902333498786202536079000703830146057240651898748760197658486790165425772165585380839129948178510273188565692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (4,8,'5329378275943654825229021.60868041634464923461847811467151197921638058488380774418295490670530782671111742467066510243892603363577850356311648591521611590965692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,8,'45283653791262997781451381354094822.762732909505051438036873220502792213670540454778361182993875916509061144859281577740137081988678361247725064336120451090222456518107029158304937620179032477664627949959143233370320432203497828243297406462513350790251761540074946469824444452248386782451723637769289822576372357189700319768797708375563651655860093365309717823602754924352327588945034832436331911584742966378275504545736896430718939807674966738116698454215555860047859161126694019895490767779791933882712567492115664113775047192011252893773389940988533801360010782816196288710063568554147458866942816721046004257953642508395867837127678980002737669139369781058046396738606563716339660654364541530532834806205571191828994250708412638796240377704994928921528330863683630622922959130920715261879547446054261914770022377059156125037157979236658010950'); +INSERT INTO num_exp_div VALUES (4,8,'627208063620965.397582272040628872773601055303353339700043792111288801181637510303989399395425313995651311362368773096988861977687484912995632130587762386590996099363383976320342247076516604162469063709298438133327434461462906199160715395064249299615054970359309619951777972710299484596875999967582794277241285253106817446259313281064844416249524876385699646393555435017820686376877981018047574348711991428666249794623006175739581915209218834701034964043360823844816042368184094857692062884223864639972005010863342567608351008172649209459933114800143792514183138995700133608613158857147417653998048890116531052767737435620558349226865105888201598712435680481803901906613772821370519525404423549161696526405320391828194356063547089626322474164332505209233143121068245585662919687001395119229263995765376465304715643388771609446'); +INSERT INTO num_exp_add VALUES (4,9,'5329378275943663377078725.59616792993138452386059664269485161374191901124632386474661634799161523147237015531446709484039091244606359050341194730653343894986479159670583937529516163204904273806158788218327396375034882788180783796976731912141525319602448709213495905899041406302673881364465504945113279286939663215197485367850132991968081639290297033476859158044889351836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (4,9,'5329378275943663267351764.90246738982122406873613100099999535333648693442749091773779913112021158272634924594106590925279284284556872145100402039378540884544906379809382171355490931218216320693213791113256760721925653394811317969065642404864072442190731745871963413981746671302248281216916486794296983018838956112081135739969615171358100498945955409711817327376172085836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (4,9,'292388240303165948041827159734686.255558469787242316676287235194652580157149226950109397295920730296960145548003120827363226435916209781396711693581454960342091452830648929118261388933297036933167543189308061917640517578583521401267417187854611829815212778183983326568586118831109538377828156118900313778053576483381085207892754728937946691892849474364477434665960112125254104966566712906532318984871145605839506991591027939136026602051635433295687547552796828217859648186757719639965988287173297286034098497871707197092627676226053609131138590878743560287292934815277894463305001278326023708395571840850120055316276256138004565442099731931051413153564744766098053176049414330146267604802971221161572130161432525297614616942172815141372973870720928125699420370428856022295499447755488148545048400795053604349570217878099721865670458104653570360'); +INSERT INTO num_exp_div VALUES (4,9,'97138902640718538.241246716463110895614166618530828908023040947887095196830690221211560526562522274118188963051412359798837957512805692731972838989047910709158995922699598619854907969493232150042212406549916252602794415099066259707018021422154933830674786488990033885447289593742424717170197810316367637885248684134204152352748803532396210051700193575105804898183523770153431536054848843504020390623875664696278263569145547515663340450903772852615789980257449146000410036925975898331113013857953289990299253584950458042598491897496393582249411290555264437893099880371008957017323366523688894303458743415715114628052487518110654201696604914159777300997374156315186315524817636714210119873791848535246674326877611945112249137224923201544452904111118569299934059002046318394345055859769572070097973298522564724884895879226870720839'); +INSERT INTO num_exp_add VALUES (5,0,'-652755630.43456071828048833552593835051449845484289562110789582081210403487973096161149072377955192388469356112505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (5,0,'-652755630.43456071828048833552593835051449845484289562110789582081210403487973096161149072377955192388469356112505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (5,0,'0'); +INSERT INTO num_exp_div VALUES (5,0,'NaN'); +INSERT INTO num_exp_add VALUES (5,1,'-652670387.03916046850422757312745971450663862747133703839829692066597367760104802542475264601221776157515632293978442027199108085723617181683235487266149426304575903892721468296143475297345699313102262188759506518376019936160961709578829069446312051432780603656651983414612264636232727512091101057374054475214114364113300402823059519499217878746766275164739724770556122895799337810694888119810524986616938847385753562624139431982468828696587199570410008890188532132652095915565323400735066310142303225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (5,1,'-652840873.82996096805674909792441698652235828221445420381749472095823439215841389779822880154688608619423079931032645214190898787339168396375791272937178074945473802633968350414211085025663129356908887576538544498889782055029046596593888271636613472988050090259449836342389832330814473910881711053475561205644968306669776242949930651397625234795216816397330872127577980937461350104018382663378200293023018506679957617487661691020231880567020416430204091941905612894161614165865789507675064355852373225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (5,1,'-55643106304872.575994253221940844841058071061962511162776681458310912066379595519265546225338405882027547140476045378015935579066580347282075024392379464189067155567624835346798806677988850250198082355055954078446421075165109896091047534711081616362392995575466807084807876544560268050611445006601394735810211678919646667455478469014906335433468365011768049600750224822391684377238242162320161552720449713229523135506671063115436813348612986916614320012995541575293478341408982118538094438068036422562665160411591652618670802973618768526197813319204816293073794413317669922144705633308090832805914096147659820167569140291210526520361556881576175809360614782817717579318298657744021133210954279487777567785280633309576696708168342539425395482429923273623865667723482418178781573723597156804085501875735112311466228778929147929'); +INSERT INTO num_exp_div VALUES (5,1,'-7657.550797567691019915353529993301413746369700087741672762343206271266232635965032053368224472333368713006346867984576168784127503674579531243603836945595880917241997606783133673324236134063757452734295148763280059050480246827193380861494669624151921824660313516974440913733511526807313019192263170823268678149435664224184903925632177789052038092611394447709922076676981043877747276056677801802695466205531230350209787298926245402046182150996849906836743231861317120171583577624262765589605263477198809166390259128339127005924586833372241946051704497188891325715185091060185547236923494393813210904033520844572880475265306843414506359253445517738473745552980984097762509546161690823646176501838559393690565709795724159196133663168004773260451322595899506776323262195323943138344537866088159583331807728944620284996'); +INSERT INTO num_exp_add VALUES (5,2,'-994877526002806872754342801504871.47809095279915423939648794226185974985600242391612965412218049794216637114648812993201775787765690351615479957141288239552036371132381627958673244764559862836085530643408020551049895730005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (5,2,'994877526002806872754341495993610.60896951623817756834461124123286284017021118170033801249797242818270444792350668237291391010826978126604392715751281366489250793073354867755345743514510156309395711933053460228041067059994425117350974491367099004404995846913641329458537237789584653041949090121498951516476399288513593944575192159570458664608461677113504914551578443229008454218964701550932948083369656042643364608405637360180021322967144409944099438498649645368196191999692949583952927486593144959284443545794934667002661774373364219852712996869245745722896071593910890197478196462961042627387162830776094709087748993678069776845437889735782063'); +INSERT INTO num_exp_mul VALUES (5,2,'649411906691138274293985410502516861224852.2323455192714410716272307781034189160865613770320102043319541634113746032638191509585045862973333645830298922352816245477556264222094036953195419857712804755170632292914187367964994214922001758104594052499795564860466055599417895782179851297585155129541589802249540436678824225950907268084876110445460948679383611117263673106597132046331719468816839434908155684738864149955129235751738204036443603521478609787295079710078973503970964790273461142497259987849074597264522099648376356902360358310245001183020992360260836105404118742418040965190000718736837422434593694808973939805954329718232693154128543253581495885789333274488461716809104532693754070810202831113003978085636579574171344721710232931261731022478029314435363413498991740750878099825781577297965642009156858479681236085226911858782115'); +INSERT INTO num_exp_div VALUES (5,2,'.000000000000000000000000656116570506105776235076334177868550033347254561166417969910286926369599900073757929714260350320362090452092025380232792749476245042480546813848702351830607516880397305138543526307608094143028291193163613755680419049060162928958489964834941920423432354996040147818253087783193280640282263490705632002572757216731766513434035163528102590524432221718194164133959630768718395847710529339782880381264265894322494716854757290930538739000043383104085867828258790010654331660516512156519838978751447311068903958136482041673109857552178367614498426226323001399275980281507353231821022591045797658991388304873240910526149138339658220844723880158150606035181559877351791752701872877147074033569061408920725522180134133183999181370354585872214368766629114773129541658653693832843354053701079334077'); +INSERT INTO num_exp_add VALUES (5,3,'-60302029489319384367663884408738513110.66683195868931664491302527038538338065260819361151478340212147889934633981101279593065290940544218360883531149731823374304151252289014494378769385157204705433009477214625880056478643611622410268943757215673170753460135411513114716313801477916713433956086133878890802448531292334570886746283905390661877220497842493537338035961123751393889400517474762491881277080205381424363695095196058838349029211365212855028824622924678684631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (5,3,'60302029489319384367663884407433001849.79771052212833997386114856935638647096681695139572314177791340913988441658803134837154906163605506135872443908341816501241365674229987734175441883907154998906319658504271319733469814941611260503645706198407368762270127105340397375230875953495882740039984314121888705481484090911598074635434289709802794549714765847764347865064280637851906308955404165593747173246944693509650424312007333558709071857299501674917023499921977975368196191999692949583952927486593144959284443545794934667002661774373364219852712996869245745722896071593910890197478196462961042627387162830776094709087748993678069776845437889735782063'); +INSERT INTO num_exp_mul VALUES (5,3,'39362489275784146262776411377472433635883331946.794473520543457442955620133347015506556162839462623905489255080102447195050109095701660164272430316804466254467810714209179752718730906325952685817112992943656292503112803950215110778476301809440329937774061163668461957943313261962261081942055908935814323069621279128270849852239727888939033546870208376394878842958202403235309372240005941467570230067124830916866857395233038346727879951123599893174252558078732888910139309038957525961212820831321973219557165558911222848692996406741318948607549825343491479728117062814094258484536263158005174429922237853707635743736923521032098496725445243775790161216159399180889906705265012270270348146530113428221072591696851818281866095288773371414866822270689959827332258348570976075184933893434327278299820594014788148344260948638847457822697682605612771344335201258128'); +INSERT INTO num_exp_div VALUES (5,3,'.000000000000000000000000000010824770508763323320533297369674519056450544793568147911931789010432012750062661590994728968589403602468229106206242395792957238667714358401601098858606386995096923432407249369639633268143022787987190106724545750803196130511146323174462918572423414631798141263222875752767731279138952850500369328934959764805948568471324562210715908420467881411844098258193571194910997918428786213948547748701831331312040839544355427357749520227124858111324859160114175254197992204974033767300989488517391063188153561391320190653403747521648794370679322504188364455328709488846777004202196382575648619395139553279192346251133156445942281048959845827006761160755031086836046398020850814350246219929303018051720203943879538087954853996826539712240458022307680912400297508925714946398031304516583939283'); +INSERT INTO num_exp_add VALUES (5,4,'5329378275943662669459614.81475694159581596077242547133292502869630735172901157043010370467618244548786897684821457816189831652076071977025794948484549600736179389638319303817478693948215387894509009504287664213474693208847025374388286162907794727810231557001266897729978691844410171412189947386181530441402903608214502713480332746271552746231631136145916685939539173054989927058122097304419584979598595477177513004218594211597809300517607260841648610322863666300637648662611916496850248528515936635845594390453288113296413254893687029540384176335735114863908372780241463999450547422213639667099644505472777149095004849805371205203850993689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (5,4,'-5329378275943663974970875.68387837815679263182430217236192193838209859394480321205431177443564436871085042440731842593128543877087159218415801821547335178795206149841646805067528400474905206604863569827296492883485842974145076391654088154097803033982948898084192422150809385760511991169192044353228731864375715719064118394339415417054629392004621307042759799481522264617060523956256201137680272894311866260366238283858551565663520480629408383844349319586471282301251749494706061523663958609947049544255725056447964564549684815188261035801892684889942971676086592385285071073528462167439314005547455087297279161738865296114495425732286867689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (5,4,'-3478781676337858247983014311182511.567538638808357215203593479841446379226774481291286361639429856698999485760647422501864626078375852610019829111004807806660731243672830787729048847342063218718651165150612717759770504648306347926061960607388621011846314969634048226452709389995594961695723139571002939804473057725442880410434039783304583526414509590532906062732322732569475349107437896717416548237633532805602064623969799081086996320156575550896200848758685986331692388099427314008504506503745527468550106879602399030419569897808150076298414568875477195447656904373310322813412927463518325927626891046356679526447117311923853482118502868148386882363449163182892615259995945992014431502761210899772725227648729095696228388558331052524469604046072203605897109629560683446827492904111565278516043939137760721315953500281379039771826554155511347152'); +INSERT INTO num_exp_div VALUES (5,4,'-.000000000000000122482510461124748279475400009367345900846466958806966807399903713411658400733717078392550780910604704603123670767210550800752620037863340961255721285160854785449315208955654408132775022766783343331151895973970395232686910362226184006990485313002943710214511418310741271074710741339586430026286272098156531835438969774325517509155992092194349661122678547097423264670055720422496527272118788005921590521726691666219504214087867030003203385360001614199656989667055583749577099440092378355805901262289841168751608673297446473709956390142112843400255748161809121986096092991616144443486023218404881798896685413932215981950393130292001833627899480153863300557853617312991880655905907971211246077450786084079040513198340644157868678782195341316027563717617074364438885981635394382733697473265872796207'); +INSERT INTO num_exp_add VALUES (5,5,'-1305511260.86912143656097667105187670102899690968579124221579164162420806975946192322298144755910384776938712225011087241390006873062785578059026760203327501250049706526689818710354560323008828670011149765298051017265801991190008306172717341082925524420830693916101819757002096967047201422972812110849615680859082670783076645772990170896843113541983091562070596898134103833260687914713270783188725279639957354065711180111801123002700709263607616000614100832094145026813710081431112908410130665994676451253271560294574006261508508554207856812178219605043607074077914745225674338447810581824502012643860446309124220528435874'); +INSERT INTO num_exp_sub VALUES (5,5,'0'); +INSERT INTO num_exp_mul VALUES (5,5,'426089913064020811.057708378200224487694731586862745370027417544052374884336177893807736467646454486029424673621605232432043672119510371547153895504456723242262639262542904151307250842477327375961936454637964429999741717244285121019840463692418987118402683746281993192269229200465080358289645050337976214115902915692028162689089167194843185708212911364017271332623359100711545479273675423617018342297822477514128997410642005300368966199980354369928371655155437291469427189561877718971914040675572136507472590254222870537216617260612835805368361975725573009455402822669103118872235140158440342063571894152305875004532651814592458133460160514384171804043127771746596286988679698684698755896736275307574630777027620558428909546664763675431701332632828281070572045822129984625797185173815273651376003614106277727279230096226977335510'); +INSERT INTO num_exp_div VALUES (5,5,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +INSERT INTO num_exp_add VALUES (5,6,'-652755630.38762364608541718463145771120672223443489913059334543712856431450577465795351472116052777583325262472505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (5,6,'-652755630.48149779047555948642041898982227467525089211162244620449564375525368726526946672639857607193613449752505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (5,6,'-30638438.151446159804025029882398388155309149089870990062944469684482366692824338098201222171115395923414887930224163525189097571163687285244255335505387733673499447610577050114902372990462064696637481657064525319516004273769831260452832960893174173254560250804003884280384718123289136453955482855362019158401218620018346500189769819687260476334734259702665316562988639223597110627626759216850014150105605927773639897638043177685498804811787888811168524202700283461266793154726325540776914500415140842975457394524215869103737379109516024460317825645645301237375972914247141703084877141866316168268901439172491577729880760950895760711857112463508064820414904611059588717092145484656103798852859978690742216940980929562068'); +INSERT INTO num_exp_div VALUES (5,6,'-13907037655.047994416383638650569341223199042786813441967582376077478024677494832069402897226848055043557486983268019376307288565911231748501636517992289743940159005664424461285010295150828744259113760652210086696250085454819340987566229400805422509198052317518991183515696724846560872057916862620762789778660622787735923967096950195583369113574365386627110408307941105082873469072519133330718161987781080307947247163619814890462416622144825161521790673339279047700672881113718394727610096366361422482794458375587355933614201638489194194834709433413694420512869179976485096875057742460003147602405353823942488343056906912173170809084207937229591627643451380735179767199816663168139837088183577975769442341678933576388936845704303859241320794255052627716474860113993958556604381707826493168941926878481079724185426298004604'); +INSERT INTO num_exp_add VALUES (5,7,'-818934540724601372.43456071828048833552593835051449845484289562110789582081210403487973096161149072377955192388469356112505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (5,7,'818934539419090111.56543928171951166447406164948550154515710437889210417918789596512026903838850927622044807611530643887494456379304996563468607210970486619898336249374975146736655090644822719838495585664994425117350974491367099004404995846913641329458537237789584653041949090121498951516476399288513593944575192159570458664608461677113504914551578443229008454218964701550932948083369656042643364608405637360180021322967144409944099438498649645368196191999692949583952927486593144959284443545794934667002661774373364219852712996869245745722896071593910890197478196462961042627387162830776094709087748993678069776845437889735782063'); +INSERT INTO num_exp_mul VALUES (5,7,'534564131989234694540350103.27821462973515555648644772098605028371173048154132108733819196629002548296868548691993248746628993380136454426833349407578676005545111508293942736555269938962058196496152360848131645787941032968937794930046928523006455386861100809286408671908320322523368135203881520526880998279355848280412933152306299256343179622513731096363088094541514890135766460631462465021694553063366717467560655272004461368865264059368514271105464855575429914212085797297268595943955105608543373940035636033207568676745293499106348500559628723682588033431457023964317090780615020801564861497990103549650624438425421690193862533733474254'); +INSERT INTO num_exp_div VALUES (5,7,'.000000000797079129642393611556079160915147221153735075943759104977169600937534508973732991117540626046659124172765761873705978811124901421049332579161931652390647472911517923131800238903184679028518657818755558526885018755394697157094867449047655737107085020874974955627907737126958129710597811740696534189608639914753884882702680512272194316887744972931453458445314561564591875764930680945589486999586667912816485821717403892703364322658245615895415781719033810595358092343690359557942948213374234065052300866661453767599465059289920067095083062096458980564265691295895672503728815182981118876144075942348853666085714846210822847053889733510154276933759200630639642310562242207518883342516103725757482864105340008709446643820864294556778969997115586027866760708448174502158738150605938364482719960251612464993'); +INSERT INTO num_exp_add VALUES (5,8,'7844230593.20607652525116672615394735666141304947992676684520382624714879797087461877675155217754947572297228288498221620714146356962938009770486619898336249374975146736655090644822719838495585664994425117350974491367099004404995846913641329458537237789584653041949090121498951516476399288513593944575192159570458664608461677113504914551578443229008454218964701550932948083369656042643364608405637360180021322967144409944099438498649645368196191999692949583952927486593144959284443545794934667002661774373364219852712996869245745722896071593910890197478196462961042627387162830776094709087748993678069776845437889735782063'); +INSERT INTO num_exp_sub VALUES (5,8,'-9149741854.07519796181214339720582405769040995916571800906099546787135686773033654199973299973665332349235940513509308862104153230025723587829513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (5,8,'-5546455599206321494.0676583421119904300307105296377723816472192007866147764761501865875232824814135783697976183493106885436876081315217834621720906478074798596116645640251460842350553806256223963023430631066024389364515688765194373161385579258482225808660340732705687558150699172147896486727530192499184101617379930846663835628510376484675411350654979679181852179924386290069790336316958202582966248703889464308649631486542724072047294216362186036638115240070658004553260251510288423749333873893917690832829128021808383128393431810674177390352413548658782609064839524756041501835115152819802758773711821322162752064589750295542985780512921839490040396053737870038534216948323935020460307350020911362024271167085905714873548388570602799432705061561572854498075600'); +INSERT INTO num_exp_div VALUES (5,8,'-.076822018213756690975099471985461347542955923191183223634407380481978143225129486622351714276452369661632980197282261508936298649901018470846144321441236073683990324039849865750139470288565622579952182053792815638469841531577235191276257498209844422440366423136595067535337374223115507557306455001792362506235886189722508617024948653046102060677266555476719102193278190540414934812073355995577639986512222998268934000209944414236509139290657402937840986061987219441410741189615344050459067454369371094189930607834375561948483494321255500497786795636801854613881105643003358210407867114145806225724880370339074242480071595684502491827709175732777776915682786771730423733673667248186336046898260378049328204094804755195626798951644386924178161926128482002518979482630732440619051262620098544265763306253807191182'); +INSERT INTO num_exp_add VALUES (5,9,'-597892150.08771044822540810796370552966707032464017958269847934730769542644402913723848026909285133109089452632480800168074607090893991283808726990171062867538012237270000932798704781608969096508450960185964292594677356241956277714380500188870696516251767979457838109804726539408115452577436052503866633026489282425086547752714324273565900641436632912781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (5,9,'-707619110.78141098833556856308817117136192658504561165951731229431651264331543278598450117846625251667849259592530287073315399782168794294250299770032264633712037469256688885911649778714039732161560189579333758422588445749233730591792217152212229008169062714458263709952275557558931748845536759606982982654369800245696528893058665897330942472105350178781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (5,9,'-35812445701642379.972368737320206275515144213236752803936806738624588812089615098329765811617509505790110909629109400553415312470540217508070421816878544125783329593128638405659896184248784794258084116406472768709113030915308410565617764394827427154923321461158387012978726512246146545834669665093228316853342805604075936530371665576147966721599968786161939347726656168798065647411457701453987215491345496003650288850096338695703984042549594979897253521041581573388369367579323607093487743440894765114619634001789457486407909224339065748496715380572175183589195611952939575073075140094901024063428239223964510824958346570603142906309198033196987949067156046076497974760641964978711558209708743776024313916111738542765749928287600981397080809041007714387564206594515733287925008053261840295560398311905155157989225181164097547541'); +INSERT INTO num_exp_div VALUES (5,9,'-11.897816658873986795664687519069203701902563457968097729876034796143085813450454323128600602495745166997629078984618283588337379184733369491549230343315369634754204412939757136108898254582353378508832611703989221079986765793923635928759179573599208612516427628403686659479459867527627014558600521732194240404211484706621458983727740143568799713006127585168144158660566534382037451913967363675002134687952374080694449905223371627606557311710348820900963340884001770733452314715448053233208783321215998063958966729954113843581448912079950334969908657535514847005768455377990262943747367245613296497099716892292154137652893990339292671106003657659470243633112063075297194691349631518467702876183897580432003030164590920118726657290102377710611324297862045849839571689192181090062958059281673245670440852080202548743'); +INSERT INTO num_exp_add VALUES (6,0,'.0469370721950711508944806393077762204079964905145503836835397203739563036579760026190241480514409364'); +INSERT INTO num_exp_sub VALUES (6,0,'.0469370721950711508944806393077762204079964905145503836835397203739563036579760026190241480514409364'); +INSERT INTO num_exp_mul VALUES (6,0,'0'); +INSERT INTO num_exp_div VALUES (6,0,'NaN'); +INSERT INTO num_exp_add VALUES (6,1,'85243.44233732197133191329295927531563604777955507322414928382967007765263923984471408038635831036097817458527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_sub VALUES (6,1,'-85243.34846317758118961150399799670008360696356209219504851646259063690472663252876207514831001425809630178527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (6,1,'4001.075404054519813215296429095020391062109905613738157927030437221793757373268325953178030040276107574363822832168160758728653712686313134828282109532831190239521843808940611025488601517574653932032236616573457735900045655665690517797280666732780030171712864961531623060353548802466577910774711998056232872212688464691036260746751992072745518373073825852119460094113694393273456369345499434994672730920070410547163082189385645712866100999708173472360864669110044660667614583576570496399103026286828660558854973376227247132815728164629722965145778698957093136175449225024685874279280018547740'); +INSERT INTO num_exp_div VALUES (6,1,'.000000550624150700285432940805295709861455424264970126953321538967550091614148982212874391026630805836518138806917934859138493583812313778188030836027246840794439412443826640206464415527687555214009725107630387889854278497875708390050387195108441635824296563108288712340902423706104029452615686971019125750530034798026103476074158922893374911891438688457439945897348811702908216883650280617098402133628688982793791562476980709924382381505517834196446365877784931355599480881104446907801805570471686295270927836995181422963320376948188855989986414581755633425437161760674162177776773597848142496583128607548351599750592863590334617838124741567654525843413232313914310487355539260264225486180000012813397807525203822863232682089295055713257835007742845010741137213301116647610033909062369843750685396196342928455'); +INSERT INTO num_exp_add VALUES (6,2,'-994877526002806872754342148749240.99659316232359475297606895243958507460511031229368344962653674268847910587702140353344168594152240599109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_sub VALUES (6,2,'994877526002806872754342148749241.09046730671373705476503023105513751542110329332278421699361618343639171319297340877148998204440427879109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_mul VALUES (6,2,'-46696638263247522384986521136500.479312417066793299922708112595886608370451213741279484136907754744903470430131032928908162742687359367826808123516519335458861613010646992354378739165872253762686683966945711430182491860196341344982195078000259063231136011430995647812149294224699587849791008794261026932467933475782780'); +INSERT INTO num_exp_div VALUES (6,2,'-.000000000000000000000000000000000047178744084866106587600962473825168237820701199970144691815329658682341685812472535816245052671243808078367856957579485152424914481414614360809698177236664771558713606961423658442962083541733004775309314926918118528217478256885324362912426275407382550929085958089798861918760121727491366034496581249711153289495601712583077918760003840368008056353090552282274780428335438032908213783490070198414584291402513547386013689752310173492320159738977752795528725029134841933604057954874523842273790958618375118974623107241366036640538085329921129023905888674299774726871808862832797230915933851225308164365269753526489223540580759951230801125605963901491073619448437890841032149898629231552019804656219062534881074125995130202820302133432951999011667568746004715268323913437054078537'); +INSERT INTO num_exp_add VALUES (6,3,'-60302029489319384367663884408085757480.1853341682137571584926062805631087054017160819890685789064777236456590745415460695320768374693076860837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (6,3,'60302029489319384367663884408085757480.2792083126038994602815675591786611462177090630181693462735571643935716818574980747701251335721895588837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (6,3,'-2830400711649493468815157129316992649.40542786074520931471973065281957756940496588853021620372179463538053123396140685749478530925306163968207226329985017644835203709485594362663495728106061878665324856417118064730721101615473194292620972173690618491026470353143141125614124440035267592258385099934706896692953497971326605145704135723011753705907329979207428661473172503098296622281647255008204864404416199384701720347319806375450632245634238172654086373193251877533131784268854289406126119630708578053354762596511353053106459297339360827562281168219966099848212'); +INSERT INTO num_exp_div VALUES (6,3,'-.000000000000000000000000000000000000000778366376597400971124059102619954214055884926284646546105035591052258074563706355894551049631537984053410850060739107742208523938741961208742831871056600773325053133977559789796700130019975964192371715826863472981072974742704091801166438465082519558956925444635729210849210496466189037623555622901738570979273502405907969114110345815802999687171113749364073269902319653450479463404003706147915064100959774312307195946966281098140229199529866429134937742584938255441169541436021827079647129394362379406256722903991353136733939395366152312959281905058592776286736536360235356737359904478313225848562436632109470589310799000750518904145312512621838935796912993778920622238202744037977772169066929474233952081158212174549695244127987299282384885288897893503991509410567351494'); +INSERT INTO num_exp_add VALUES (6,4,'5329378275943663322215245.29625473207137544719284446115519970394719946335145777492574745992986971075733570324679065009803281404581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (6,4,'-5329378275943663322215245.20238058768123314540388318253964726313120648232235700755866801918195710344138369800874235399515094124581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (6,4,'250145412892811547138949.592621291590152419206270097656346630226508074074623894951308487425470437268130465956063593951784820669318897182831355375451719125809800516979013437732298382708070979871283132689492336823087794373113039154669229889503700598930220858275174342776478898670277868700384853696009897221747924643343353942154528501454689084608965009561564638167714973711022212547096732831847202912862290958304510651828842182545311077713664465815992616213663619529378061133917572474298028065850515876361609671565914027186063801852554353160801534696062207299890867876199323530337336273950892723090754719547285920090419070001019943385293110663922226230169381423410428577990604776655422105400452217085311617728003688836185608912367677734364834577573255789160419371322775733777518997638403409000055707558465286469808848200141192627396502735'); +INSERT INTO num_exp_div VALUES (6,4,'.000000000000000000000000008807232244507937251856465017967626593430084223212999583902527587737263981869382895220711835510154989851222501080395520249593128253795609198666884523792646863341248402687314509176781281863891589925961900674092953408613128961234166906173266411035009516545964362406728942021813644419154548354247112601793685146960840364604115937119024575638240439041250900118977183124605578660115160551830946251713350556181960983267689939549506518185340972020820080460565392359379680036788592213479105831301723237102710863182596413567756605711230290883888612188805367801369264231165178487334557824054205160222371548005742602736713668548450400926514169967213301919971189065307721110805424950794015852531342286935114651278691214233054575660712537044810163930633456573860895791198853393107188289695511873068'); +INSERT INTO num_exp_add VALUES (6,5,'-652755630.38762364608541718463145771120672223443489913059334543712856431450577465795351472116052777583325262472505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (6,5,'652755630.48149779047555948642041898982227467525089211162244620449564375525368726526946672639857607193613449752505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (6,5,'-30638438.151446159804025029882398388155309149089870990062944469684482366692824338098201222171115395923414887930224163525189097571163687285244255335505387733673499447610577050114902372990462064696637481657064525319516004273769831260452832960893174173254560250804003884280384718123289136453955482855362019158401218620018346500189769819687260476334734259702665316562988639223597110627626759216850014150105605927773639897638043177685498804811787888811168524202700283461266793154726325540776914500415140842975457394524215869103737379109516024460317825645645301237375972914247141703084877141866316168268901439172491577729880760950895760711857112463508064820414904611059588717092145484656103798852859978690742216940980929562068'); +INSERT INTO num_exp_div VALUES (6,5,'-.000000000071906039575366987930696117572143566208825430801491864851999044659045681114433294052065377679745375399878664822361548237094424148992770296383642432040129230180142339557437679166815114510467763288057917694948929009212876391059413439647163295629904270262780935228234994930653489111444964446097124407804311494588517082748514970905563707392765567625639455978464081409330528324962333492925267647686759704415549221137291475247571296491073010175087298752769122449499990102435819414671847617062560524758344361194566796343756743243766853291113852464023843527189221162680613675369708907935197867458588904367993736363321133720345058432019986643353417257503619558797249295232894674255060861358071309619524800424087896023710729815248847792174290644245138831518072176198607255346603270853333176255533974364728342822'); +INSERT INTO num_exp_add VALUES (6,6,'.0938741443901423017889612786155524408159929810291007673670794407479126073159520052380482961028818728'); +INSERT INTO num_exp_sub VALUES (6,6,'0'); +INSERT INTO num_exp_mul VALUES (6,6,'.00220308874624532134736695825088747995945783791378828770826401323533973395137378460250799184832278118133622563295093909508983301127615815865216895482784469538070133388154961402881325731054433770884496'); +INSERT INTO num_exp_div VALUES (6,6,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +INSERT INTO num_exp_add VALUES (6,7,'-818934540071845741.9530629278049288491055193606922237795920035094854496163164602796260436963420239973809758519485590636'); +INSERT INTO num_exp_sub VALUES (6,7,'818934540071845742.0469370721950711508944806393077762204079964905145503836835397203739563036579760026190241480514409364'); +INSERT INTO num_exp_mul VALUES (6,7,'-38438389630389612.0042045464692275627184627672063157323631169405883031379129843031477339360597564128205768842448328088'); +INSERT INTO num_exp_div VALUES (6,7,'-.000000000000000000057314803440765029050667129936880528769333499793237773980613524885506515999851858649385968476426313207429914995755091541422893944525222307473169425244462149015717526718376299808423552027796204632286454853167559026787019718806449038446612978917236245943248168920696452018925986743620392955122431521581268518101342690974749463089739042586011924590503136498488946387508310209984849243014542648765897536338824721211252335866349509669538308454367849024503312249951727948786393404944555844863805495937835281927012430439403132382055464307180153473189842433614777883826783689904293115204700185380661601223693428304020047393499702811581067120117405280772944184877279069842269329959037186324135435468322336398566440055479142909170224780318371473684868152271947368867666706912563225912012901437076773416'); +INSERT INTO num_exp_add VALUES (6,8,'8496986223.68757431572672621257436634648368772473081887846765003074279255322456188404621827857612554765910678041003765241409149793494330798800'); +INSERT INTO num_exp_sub VALUES (6,8,'-8496986223.59370017133658391078540506786813528391482589743854926337571311247664927673026627333807725155622490761003765241409149793494330798800'); +INSERT INTO num_exp_mul VALUES (6,8,'398823655.819545574205652791249227663407026876411660299394659390409794761643751582473390322547798567169668246138880832642141417531427935520467563318363116897177899262525720710134129529640376020947774470933902793259531840625444267816319963200'); +INSERT INTO num_exp_div VALUES (6,8,'.000000000005523967081937952184172713994498918048454262874017009201501812494019618863622631634736130436187167745347383745890248619882896153083428308074678908731005176810208100004498415662458272149380846809398637385270265351808328466537502823071145089961996689711299405627596294988646826454676198092260759424935699382655736524042353938814268760468122584678267125994645166955751211397353140569987758938572953312303398024147927938612934833827734142292697389251052485981023756760420972614486278837214553818521196182883489483756785207650821722660455451660719560529693418375773124813290305501923899840247103166971466167032437598057958226806335324315214908788839919408525748236713611579486768218564733151121028172253396652755590051310396973181595992981076269789287489208817712754098019817792758730835341151711523474207'); +INSERT INTO num_exp_add VALUES (6,9,'54863480.39378734225015137845671346015520435061071252892396685718794832880965812803098645730572474084523997120024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_sub VALUES (6,9,'-54863480.29991319786000907666775218153965190979471954789486608982086888806174552071503445206767644474235809840024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_mul VALUES (6,9,'2575131.137912978352131546639620215541477987701194164886305951830806120142596646541302305984776928560906754259789485960991272272782091464270104432109904222200473616116525297615725803495463468272171161659654385929185160689572943852767523792651123455283534072794326647404332228203001469884016996499768656263775233430922446983838511590562929268821678518640501686017030536100955531423152839988008496919169395159653034847677470665418765966542111749439412'); +INSERT INTO num_exp_div VALUES (6,9,'.000000000855524875533453524582534418967571681572635027972658867593464437484123442242521660317156546196609749230372398872487667521984251509483676665788527375343148382604836976332389890799079878151841905152004537926201190193814594954194044560537664560344224646197027029681984683465852110060077865421064400958821808374370779297676624123638191407441015008434084079839721156870032377372497814037418047056438760664237367081226979226606227037631073946209105678283624370820396871058367779887709720661001099338250009251834581804647326512873792849059661525874160414378459696930831877643599421297749483849526695657467708603491876916749718079725746259119898269814551222336219537198318796277931946529242436502235147453584237994498566122973953203597470078105606906752099294162422474758048436539653041606499637623370030079916'); +INSERT INTO num_exp_add VALUES (7,0,'-818934540071845742'); +INSERT INTO num_exp_sub VALUES (7,0,'-818934540071845742'); +INSERT INTO num_exp_mul VALUES (7,0,'0'); +INSERT INTO num_exp_div VALUES (7,0,'NaN'); +INSERT INTO num_exp_add VALUES (7,1,'-818934540071760498.60459975022373923760152136399214017262844141729040109985386964272131706381326192223266583769046276181472898406504104649192224392653722107164485675679551050629376558940966195135841284978096687306110481009743118940565957556492470398904849289222365256698601073536111216152709126800604695001949246634784573028721762079936564434050796321975774729383704426321489070979168993853338252728216162346796960170352897972568238870481118474064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_sub VALUES (7,1,'-818934540071930985.39540024977626076239847863600785982737155858270959890014613035727868293618673807776733416230953723818527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_mul VALUES (7,1,'-69808760806266041400340.70700818693892852138813934414383886494691670042143650609934777814995087699409404201920249076407981012095999320858479644760715204999741683528746097757549835956359129287002171391961763797857794730120426599135099619822532290339000466211195776337667123320942107370731349851576864242697412616810236323676004067839744992733887503405311090677026008324895177587064547630828026123718296429295638934384446325302964896473296829265805737112709269803814942537657996725913938408781715328945194948010970'); +INSERT INTO num_exp_div VALUES (7,1,'-9607014551997.140858001442365669993007297071681832468350855627077185145567261170534005832165603932891201648027598773639089125980996652005412450490063683624648655909636499261774535015914730479401090227915382926027949990128880284298688443593909017437720828163877690126019616194376778317148693270900349151496295698078575648169637635898560612738481294674167553369445426793073304518646116539082953755973571046622684332425840412198776081251646424875405772676893185726872613804612566569794177506268399878105117763696990094108960076591684779180089885283939385808214239337829666227427148603057941899878123459708920227867371285837642561064461118016739395972994827327543594846953341750907541716807985738518071480209106185726125017342997283356926976052909493074301401955202616191210810331245427141945840542129607439703255628683506772979'); +INSERT INTO num_exp_add VALUES (7,2,'-994877526002807691688882220594983.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_sub VALUES (7,2,'994877526002806053819802076903499.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_mul VALUES (7,2,'814739569184924399102711674444306584731316176345067.39834031417849342571224916231092924046722938910652929295271097903377854123984307101079073134405782275535446337229706620713104545454319555885847481531722101704765783025789147453570970090'); +INSERT INTO num_exp_div VALUES (7,2,'.000000000000000823151110229758332661330617426417726331211894330147399760458555778324097596176117291103184653828305857999638466183347321835058943563347767579219763002258622507889760416640758842509635599414768344140175277742935564567127659688612699366182158030839083982896107176174766408199870924563237827899202849733606842856491701660599599211106794572237923985121475458446997860253437578966578617985764298513928307852082168209458400544457824307270777530312648199364084272310536024283945598340590403612752287693234647719354745060851129534452514828239800716088248915975054881011343555492596002595181046121935660176097475159074973635534016835214952415720717896518544064238656360099884889450237541254761746029507300068198731306211736696956568648033834554273602524147075895460874922913883751452403825099444642503437'); +INSERT INTO num_exp_add VALUES (7,3,'-60302029489319384368482818948157603222.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (7,3,'60302029489319384366844949868013911738.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (7,3,'49383414785234649002982046297226894664526726187218771083.0993243619030008310875293647868815940421844461627295157812843657782639833900543200310573708100000958929315945039020410482966753145208427035917753919085618457760620513481628641658765820294863970581642745379331727722585319163262763708386199720411053619449096019862596221607526610103408936214184850115071874430846697061554769773328338028749631552202705583855831155461651414320570061181212214810086436100771547030013079997847086'); +INSERT INTO num_exp_div VALUES (7,3,'.000000000000000000013580546907080371873577430837141172674171921610919544849037647398734065712983603204704663262116138799357430947986241590690589753181299773842880079777640016786921825609617596862828930939366173224366864448436461306602680780407912534492687474933386043505172346330210659476505435994582446405414027199938970759003336829722057241708213838318628292667946636226143164221380503228191376939596663443230082698085439531600756771639601022064620204571458766303985028143400866776954225590745596639602613498355332049777798367675438365442468743270334407716567057368347458892075084694158566383133325959042076573734408841629149903649365079563374278550978052491499304166424686842598833319515705663176855033865872333988551611996194856472662292344160194821687681312501127516922809221030420253714666026321243515830'); +INSERT INTO num_exp_add VALUES (7,4,'5329377457009123250369503.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (7,4,'-5329379094878203394060987.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (7,4,'-4364411947278810125327066890819882483326918.05664098958260550284395870948992407314161088028674246708928421994893923699743452802989464864039994566042797942433140378990308345483670828497915478397481687305406460330009319949623844175096007381662809083363069100235985794575399268709260901964834244796150883807308976949196661411035264619638771824190014274817662519438658481432363824187693821267613212631153175155634316128036152465184903927860719447693468054624663668062006049759837326188252927823612718163916100588143128358998656306593393889422386501730237442526450419990376323903182669190482615734972147533221144682538647497701130447816148459762464395194383090936159579764712919396391813914821973715879062992249315474841639591907249142779103650773383644785606333916967894'); +INSERT INTO num_exp_div VALUES (7,4,'-.000000153664179510102140733858340480800294287837601105047285453457000254577644933901525444082336054243749405512900867540483190494113677173628646221933766421338612376123824684592850465460156248403574333545090544920568230979754949827013129083778435107488003838746926270955224758508832133483591156567868631938590248213604979638895901933775098150684618378235712437137852195098700137765601802898366867034641606131280434771339920637353140131159441790904703083143627590062236537714415872864218260252838432414759890832271190606933534662897006726154587341385852258168335058931957995901987808602365467861573344491265289043037273815504867254228957776127752540924854546837197432384563153608878864912196453587628891285275067452280357349897203095502806923463147414086919014592380804424300739713935051357374227246098303140106'); +INSERT INTO num_exp_add VALUES (7,5,'-818934540724601372.43456071828048833552593835051449845484289562110789582081210403487973096161149072377955192388469356112505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (7,5,'-818934539419090111.56543928171951166447406164948550154515710437889210417918789596512026903838850927622044807611530643887494456379304996563468607210970486619898336249374975146736655090644822719838495585664994425117350974491367099004404995846913641329458537237789584653041949090121498951516476399288513593944575192159570458664608461677113504914551578443229008454218964701550932948083369656042643364608405637360180021322967144409944099438498649645368196191999692949583952927486593144959284443545794934667002661774373364219852712996869245745722896071593910890197478196462961042627387162830776094709087748993678069776845437889735782063'); +INSERT INTO num_exp_mul VALUES (7,5,'534564131989234694540350103.27821462973515555648644772098605028371173048154132108733819196629002548296868548691993248746628993380136454426833349407578676005545111508293942736555269938962058196496152360848131645787941032968937794930046928523006455386861100809286408671908320322523368135203881520526880998279355848280412933152306299256343179622513731096363088094541514890135766460631462465021694553063366717467560655272004461368865264059368514271105464855575429914212085797297268595943955105608543373940035636033207568676745293499106348500559628723682588033431457023964317090780615020801564861497990103549650624438425421690193862533733474254'); +INSERT INTO num_exp_div VALUES (7,5,'1254580584.048971438599349046867230181719371038956756285986415773300837165755558702217197735811549684202279755101552533605390208155708695952004683670878589028717509749282693444655857296902117478518511492735290086040573521482737598395369632843374456793385511847676556826348943588519880411018079886373631771830925920986588708409208527042927229627786932908015502292313887561198156623702404977221789649731458241770690830680067801377815840764873662400590343236662968218256211697981048576328148435241545372543075051594952109757428031762469834781538302930957095080167901199455226976113347018972534334210416375400979738414416582588689496706548495076287263281908191770792203069614447622517839588243746755480572371988630084226963919158931419126724681617069720048557166545204944250492282054791996953359013543036918134163144772567093'); +INSERT INTO num_exp_add VALUES (7,6,'-818934540071845741.9530629278049288491055193606922237795920035094854496163164602796260436963420239973809758519485590636'); +INSERT INTO num_exp_sub VALUES (7,6,'-818934540071845742.0469370721950711508944806393077762204079964905145503836835397203739563036579760026190241480514409364'); +INSERT INTO num_exp_mul VALUES (7,6,'-38438389630389612.0042045464692275627184627672063157323631169405883031379129843031477339360597564128205768842448328088'); +INSERT INTO num_exp_div VALUES (7,6,'-17447499423661151023.558342555162228919125358089491573318627107322332520978657843895009110781773496490472817700487707134216424855867015781267287628022535529641238372370292374146871103236048507252055787621394728096799222976387108688980537900309311204203302960751747509648304056939321473462375648710590981564101023812800603438271190184064874290215309040519813024962909469701968804925443161094255632624090623433640078421818321246597728308302979223833487133268472455479442002005374793705431817866798804822885690193667521606781156962792120052947767160957903073698536973292205899421787948529970837601521657406211962967291912148632072929662185840265855612193255596825032457033402506154930851214421895488796227471490998190312007513478459049382774782886773158311656817014322925167278223360446454868236479549745612973293185989975394307678926'); +INSERT INTO num_exp_add VALUES (7,7,'-1637869080143691484'); +INSERT INTO num_exp_sub VALUES (7,7,'0'); +INSERT INTO num_exp_mul VALUES (7,7,'670653780922685519356619170643530564'); +INSERT INTO num_exp_div VALUES (7,7,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +INSERT INTO num_exp_add VALUES (7,8,'-818934531574859518.35936275646834493832011429282408849567717761204690035294074716714939441961175772404289860039233415598996234758590850206505669201200'); +INSERT INTO num_exp_sub VALUES (7,8,'-818934548568831965.64063724353165506167988570717591150432282238795309964705925283285060558038824227595710139960766584401003765241409149793494330798800'); +INSERT INTO num_exp_mul VALUES (7,8,'-6958475505053954666339703437.48985528725312694198056665033448258303533387675711770743843194274181580881296671866212320171337132096489224277825857521033238709600'); +INSERT INTO num_exp_div VALUES (7,8,'-96379412.478435590945480884955616049873645089637121682284625533034225619945532704111492738646389632607594293500930307222576571876059094206480673293295865214240456906965855425738072430281475736130342229749511650392658808510082775031098547507966544723255869156056349218776847523349173551313282283869146710349521487706884633419341568648959204688757523312579312713453540395840470692533267158388401676533369105590789036132185107859069994833345453200014884023709597817280132465224778002071890368479648934317322270613208789859930618055792958996389145963056607200020526949699302565905917600478429628844015684879886549766473809801710003649193772354147104446894109928903223843036925147624639466770660174828940577089095480826473544099693433597812637069287644606693066736302793687011165899362920686114156254982709172925265118077531'); +INSERT INTO num_exp_add VALUES (7,9,'-818934540016982261.65314972994491977243776717915257186979728396159058352649559139156429817562698954531329940720620096519975256547379603654362598494779213610069399116912987384006656023443527501447464682173445385303315267086044455246361273561294141518329233754041352632499787199926225490924591851865949646448441825186059741089695009429827829188117479084665641367'); +INSERT INTO num_exp_sub VALUES (7,9,'-818934540126709222.34685027005508022756223282084742813020271603840941647350440860843570182437301045468670059279379903480024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_mul VALUES (7,9,'-44929599044588573810654775.83678007633232843418115790847152455559258007804727916986432256198687661496804050903769496933400455947645400628259699874770581538122521805603947464462448454681701547899144129061961394870320463199545502030106801911915987309444301341575451240764927967432593181449618816978119423290767783843864768557371257918447461479570164065303599994081990686'); +INSERT INTO num_exp_div VALUES (7,9,'-14926769772.797708334489652004325241753714626257641081061212878627972973992233480868793527325656854681817156284203427388055525855608883067129036717726368707982450450575794623567027457808927082390474261155500697096284790656757163047499531247323702909360444831707029353441147768321257650234732286165724178549576948957405037843360446785505536809409054071975214796532504678683693402401018726571884721963641317944453797513145055081061680091585467186975354801535734149952115333241283186621720677488342266420359417174224757781125498130120775969091933838082305123652811689513300403051544682523761263183781206840940347226802620226164265210810994106136738030959199259066517106713585343004140573604437146025585149934286364795122716971496775012412420105368351774715982565252533025207453326002101655121126631180162560463548157187175671'); +INSERT INTO num_exp_add VALUES (8,0,'8496986223.64063724353165506167988570717591150432282238795309964705925283285060558038824227595710139960766584401003765241409149793494330798800'); +INSERT INTO num_exp_sub VALUES (8,0,'8496986223.64063724353165506167988570717591150432282238795309964705925283285060558038824227595710139960766584401003765241409149793494330798800'); +INSERT INTO num_exp_mul VALUES (8,0,'0'); +INSERT INTO num_exp_div VALUES (8,0,'NaN'); +INSERT INTO num_exp_add VALUES (8,1,'8497071467.03603749330791582407836434318377133169438097066269854720538319012928851657498035372443556191720308219530866834905045144302106406146277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_sub VALUES (8,1,'8496900980.24523699375539429928140707116805167695126380524350074691312247557192264420150419818976723729812860582476663647913254442686555191453722107164485675679551050629376558940966195135841284978096687306110481009743118940565957556492470398904849289222365256698601073536111216152709126800604695001949246634784573028721762079936564434050796321975774729383704426321489070979168993853338252728216162346796960170352897972568238870481118474064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_mul VALUES (8,1,'724311956372274.0135050255361637906710330203036651743488213007179039756514944640108625580172737414192938789413338554327986697518463087452612658955180411327002900979574347739956600177846996063741787205122007268468674386396156638261992679442768654367111433834151087792255469957061758837789341439211010331332174981459471333376067541234901538285101103690622656631026001337239036711179989456674399137008584021283568040818388709554256523118702728176420022080138548890713013682480239784198421500241995499841675772793497485550923152267616622892846304530712344886979674416990935007952941652591352603797627920865960622077762568060903908151958000'); +INSERT INTO num_exp_div VALUES (8,1,'99679.115123747637190903598543851248555278745675862923884476564848911494649941770503156134872464666625927195645517181131678518619856156844072856993813601495176097972982587061507650426363887871820112714099226501603733968262566093655417466145183587899155614471697804006772915054739361437054029183182533671508695646413074668188590846200362324428338974890534273352188276373478524543505805545661569395314989170104140776362043880099775594658817242753124957385625811310332354760117110779649164022618274859298031549851269619167173746259018497289174255201452265070501056913033329291819570027877856677145579673495987354805150868813877928857472561883332547900866904764950837506993759536410161752469488392566682723027340638271076406246129989851281210810196699482980833204884400423019400653089825859983062096326294783573417554749'); +INSERT INTO num_exp_add VALUES (8,2,'-994877526002806872754333651763017.40289299098701084219066388457144979069028441485513418625082363021182982914675513019536443438529749838106171095037135009526312783302868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_sub VALUES (8,2,'994877526002806872754350645735464.68416747805032096555043529892327279933592919076133348036932929591304098992323968210956723360062918640113701577855434596514974380902868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_exp_mul VALUES (8,2,'-8453460632655529853033389979024265783461224.3195241893307807116624750282852146303290708492834695194274289713076935297734670940696121761483641291930931061232942894577813178566088927221374036301485916497770984757492912292002695944367308880163698595015497307574177176409203214324418237020500352652934909632442547242092296504047310806151851207329042221920888326000'); +INSERT INTO num_exp_div VALUES (8,2,'-.000000000000000000000008540735921314463871578184793632135730756619558669911183806487803411545406462244216408739432325839683804021466133071768612386706692296158696852363349481716813410857655324486448455846562309041306880675446880859847445987588059144788756984750993583865748280824370754934966494724951583311563735533173023858438364336214213295786266815116844775733072416507474834701984381586060478606371028156925222726225495235702395502085206072985373035972506738983640539009567237336002073370431753469632428303255926718930619221521257726366850472572830063284204851204189447233044832163423057501488364913539948261528280564870049935369825245920984413480757133585498984374354957754078525161296201228031555280486615145365039415418251448980923331334883673792135893857917681235883506783408111446970710546686739582471'); +INSERT INTO num_exp_add VALUES (8,3,'-60302029489319384367663884399588771256.5916339968771732477072012126949734214868901845505193155307646111690097978112797961939995859130827784737422228762767014427842766445950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (8,3,'60302029489319384367663884416582743703.8729084839404833710669726270467964301325349604567186096492702768702209585877643481082023851284144664938175277044596973126708926205950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (8,3,'-512385513828318260570283740065493064477880918352.732624553690077857674083796435724202494963885926573907185100543184828131859183999195040110586155435203949963570735841632689374488877298209082579317039061893012560130258753218955057387206477423088065663401594359617882154814262843273526859406265633827109554791772242178864873774889091687515990672487380368975556580539271333144212685871370972163560839446696514092637412587953506052848750866803569213269271165856310101244342151576488190595936869490659700946174362872797854591188391982770203203644172999264143929484089237665313698600170041324566984832357000400'); +INSERT INTO num_exp_div VALUES (8,3,'-.000000000000000000000000000140907135225782279761112255989433531718277338909398600029580768021365259747075253760824424092983497958717844671162530550507041138147836569244869107757945370200122955794509365120853536859837243314494576053441804831018954867623755033888264275704547752628348151132333655667171970175829826792355986148522268067032057293494927558322394395160508723637192234110428953945018965078022622950949911124494740703606109543716688008516750321047603009424529696862953094999450658951089435460411028678817795100630449046993274191915359520936265372754315076684798942557329584282177053819106884196674660057281227248874819417305259132106690385871316407455034281900110779740008476645291647094776093567400422266906817555937149628005629880142615126571231411138926043531449659320501743591992888328328980526602'); +INSERT INTO num_exp_add VALUES (8,4,'5329378275943671819201468.88995490340795935797824952902333498786202536079000703830146057240651898748760197658486790165425772165585380839129948178510273188565692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (8,4,'-5329378275943654825229021.60868041634464923461847811467151197921638058488380774418295490670530782671111742467066510243892603363577850356311648591521611590965692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (8,4,'45283653791262997781451381354094822.762732909505051438036873220502792213670540454778361182993875916509061144859281577740137081988678361247725064336120451090222456518107029158304937620179032477664627949959143233370320432203497828243297406462513350790251761540074946469824444452248386782451723637769289822576372357189700319768797708375563651655860093365309717823602754924352327588945034832436331911584742966378275504545736896430718939807674966738116698454215555860047859161126694019895490767779791933882712567492115664113775047192011252893773389940988533801360010782816196288710063568554147458866942816721046004257953642508395867837127678980002737669139369781058046396738606563716339660654364541530532834806205571191828994250708412638796240377704994928921528330863683630622922959130920715261879547446054261914770022377059156125037157979236658010950'); +INSERT INTO num_exp_div VALUES (8,4,'.000000000000001594367257057971052149628499448029056279649281098852958322409409919964709324200796473211884339143791758566019217634542932882694487712398244322522748736692741288668885362384266615527166964187404128216235057387796054457728789109537338988453837993084016408244895452291151218602815057669592284587317035387004942691671916981967449109983992675125005085762403043329820872839739877674121174083273716295673230993049263574856197011389828478636779342320299895806297835595427859271617831720398457416685435560152182883615601663820189195644140652141180949257192740185075408019971747810015931542757445763460947106918998459997631117642552273815713467150465548031203738878873114842844016176922502916339025283749846225376341878386377192605865913018132981323065698049618379727531925408677611856682983907951667054819'); +INSERT INTO num_exp_add VALUES (8,5,'7844230593.20607652525116672615394735666141304947992676684520382624714879797087461877675155217754947572297228288498221620714146356962938009770486619898336249374975146736655090644822719838495585664994425117350974491367099004404995846913641329458537237789584653041949090121498951516476399288513593944575192159570458664608461677113504914551578443229008454218964701550932948083369656042643364608405637360180021322967144409944099438498649645368196191999692949583952927486593144959284443545794934667002661774373364219852712996869245745722896071593910890197478196462961042627387162830776094709087748993678069776845437889735782063'); +INSERT INTO num_exp_sub VALUES (8,5,'9149741854.07519796181214339720582405769040995916571800906099546787135686773033654199973299973665332349235940513509308862104153230025723587829513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (8,5,'-5546455599206321494.0676583421119904300307105296377723816472192007866147764761501865875232824814135783697976183493106885436876081315217834621720906478074798596116645640251460842350553806256223963023430631066024389364515688765194373161385579258482225808660340732705687558150699172147896486727530192499184101617379930846663835628510376484675411350654979679181852179924386290069790336316958202582966248703889464308649631486542724072047294216362186036638115240070658004553260251510288423749333873893917690832829128021808383128393431810674177390352413548658782609064839524756041501835115152819802758773711821322162752064589750295542985780512921839490040396053737870038534216948323935020460307350020911362024271167085905714873548388570602799432705061561572854498075600'); +INSERT INTO num_exp_div VALUES (8,5,'-13.017101389051085341042057308965769356145255575582875626848796382322826525772114256699384710400140437710569924703769685567402446691691210934185000959063158239023412379691360587119206695513775971704926722817528818197919265145207032750407924774510773427697188520818450702875142190949766251178733262143962213111236591970766836685919581025629742334704854852196126735685421250263035895756028805974153787560164935038227108975229771590754808331856162035119882347418116049174638416621093907738608991987582465865527947015457540650512339263071898410531735438556948115098562123055444965056347091625748703503220861221718449714020622377233272042277814766996198081939221253025243417993701684007826177845003391944496774674489538520354606358872276671998045196738090133576377830721671972381371985771591052597345572374064920279182'); +INSERT INTO num_exp_add VALUES (8,6,'8496986223.68757431572672621257436634648368772473081887846765003074279255322456188404621827857612554765910678041003765241409149793494330798800'); +INSERT INTO num_exp_sub VALUES (8,6,'8496986223.59370017133658391078540506786813528391482589743854926337571311247664927673026627333807725155622490761003765241409149793494330798800'); +INSERT INTO num_exp_mul VALUES (8,6,'398823655.819545574205652791249227663407026876411660299394659390409794761643751582473390322547798567169668246138880832642141417531427935520467563318363116897177899262525720710134129529640376020947774470933902793259531840625444267816319963200'); +INSERT INTO num_exp_div VALUES (8,6,'181029319177.110996740664566780784253502559986936959009611748146099327460471609593148344991059106574612143724330935988823134137686051475120980257829276671900076859337187540608483895641504622910361858962883971613675309676443079313179200981488761707281247447120551917205792352229666049191991270809865110506639390610910481490688182068719005593641339338678014189749279508731647492051879768743158839680867283217578754666643688259810863605002821607490100820241093473083445658378988069593782353275713240897038366242558466047071334385431080003439842348547427066389352198560236731403235927478177780757802759046212921140424771887928786549573201311120885052685761195784207710933764480136690216943336587118385525047554334029388869436622866247240903231799829259264158812528305210833683370536416861544931420820452512390255774498188962903'); +INSERT INTO num_exp_add VALUES (8,7,'-818934531574859518.35936275646834493832011429282408849567717761204690035294074716714939441961175772404289860039233415598996234758590850206505669201200'); +INSERT INTO num_exp_sub VALUES (8,7,'818934548568831965.64063724353165506167988570717591150432282238795309964705925283285060558038824227595710139960766584401003765241409149793494330798800'); +INSERT INTO num_exp_mul VALUES (8,7,'-6958475505053954666339703437.48985528725312694198056665033448258303533387675711770743843194274181580881296671866212320171337132096489224277825857521033238709600'); +INSERT INTO num_exp_div VALUES (8,7,'-.000000010375659845651632013446652385870617923988120764298690164486716047614260682259722116360931978511176121353975789418625836899338225571166376573732227571704071000348895791547943896682585450808398324252224265156214259224488248639550967292466343168350213394398101712526534464002532408445204630441167137710565437434313424987517531891145368203998329086865151248833625645567863740298397742783405267970015165358620026813812552194344790169289440822038223606218360105618852154152168496637886434061050281055613760360200323363465925493033734895631921307644481639236601187225135325401868178006133838932915485272554505684060229409404902185944047523033315868230944723282246159741659387362889777495094736963530708159604929268812778894177095572578862150793098548829744006499229853198046828954650334595737117597239208825268'); +INSERT INTO num_exp_add VALUES (8,8,'16993972447.28127448706331012335977141435182300864564477590619929411850566570121116077648455191420279921533168802007530482818299586988661597600'); +INSERT INTO num_exp_sub VALUES (8,8,'0'); +INSERT INTO num_exp_mul VALUES (8,8,'72198774884738777393.8687539247642452953425155400068591498151280875559609979248583367700231031634872342122563819478919600402159024059794279536786611373504966204744811722007869415559012475160471227957857756325962941799428857291371597146319816910515366298862558849452235442246081440000'); +INSERT INTO num_exp_div VALUES (8,8,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +INSERT INTO num_exp_add VALUES (8,9,'8551849703.98748751358673528924211852802333963452553842636251612056366144128630740476125273064380199240146487881028508694029546139131732304020786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_sub VALUES (8,9,'8442122743.29378697347657483411765288632848337412010634954368317355484422441490375601523182127040080681386680920979021788788753447856929293579213610069399116912987384006656023443527501447464682173445385303315267086044455246361273561294141518329233754041352632499787199926225490924591851865949646448441825186059741089695009429827829188117479084665641367'); +INSERT INTO num_exp_mul VALUES (8,9,'466174236688165594.9218054325256670866060556227711696100465581464881295978997280335378678072434776702952026828137140986670189756965420183565968027969700090735690246176791371115610886533930223141650377886909408268207750238603105232560663571044993507074695683027062426288270199495225881785499139012931143826099668999261931834700467395442768201666740663642498098541516326470052372008385656719236306238735524802875519713512894448940917708118676095378518264553310312628830009314653641136566040400'); +INSERT INTO num_exp_div VALUES (8,9,'154.875085756903716715488911525453064308758123952566428258639786597308109810869086867746263482721081985848551254298524280231489145092826397833394044637104667137816928932471315095067524966582810436282901424423215992139000153713476369887383242289102867530775908269805285313842050961754114751975054515055089553180717444020378611767296609130477264722612784088270193199394531972594028420402254831778715196248487757266330454269044609134602570688339750190391651801546906342796660819535014295618246236706572780627362908121159003488810140236665846928586992082180006454824311789091323774002510945263351862712964422865623934112293184149374573706760114682326698881257123280119140924775171374360283137569618025005229268057970275164869735173660958715166148344076027212231446680947914004346760896298312286730627916684448923824769'); +INSERT INTO num_exp_add VALUES (9,0,'54863480.34685027005508022756223282084742813020271603840941647350440860843570182437301045468670059279379903480024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_sub VALUES (9,0,'54863480.34685027005508022756223282084742813020271603840941647350440860843570182437301045468670059279379903480024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_mul VALUES (9,0,'0'); +INSERT INTO num_exp_div VALUES (9,0,'NaN'); +INSERT INTO num_exp_add VALUES (9,1,'54948723.74225051983134098996071145685528795757427462111901537365053896571438476055974853245403475510333627298551845046116291696445177112567064282766115207407461565363967417615506303416694032848457927390574251904212425813072768882213388082765916956736282110801611726537663292922699021333445658549608928179155685881583228490235606377831724593358583903616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_exp_sub VALUES (9,1,'54778236.95145002027881946516375418483956830283115745569981757335827825115701888818627237691936643048426179661497641859124500994829625897874508497095086558766563666622720535497438693688376602804651302002795213923698663694204683995198328880575615535181012624198813873609885725228117274934655048553507421448724831939026752650108735245933317237310133362383704426321489070979168993853338252728216162346796960170352897972568238870481118474064783391570102958474141459619245240874849766946530000977144965'); +INSERT INTO num_exp_mul VALUES (9,1,'4676749348240.390309875431213992853550297086049749814750492488995108783145961719774217441193547534210468967573344456866203963659951312519988497979489304488948342258375915152429008993288817366720647491166024151209542534474867042837694499222928509320280684557676243780452100132238968233413333851595648146954975713386711764268506890884764704949969602122157394714663532141060559896359465918874990769222345665160127552795532197771168442486088776803398878354288847069602460071745966589164282641033852314335279121191855487126430176047553895892632834940595958394834437871886013513058514896870683979585091413977173250824451205330441299000850618134248917380244749589254309567551846327349592529960432446947239714236828401206843011440433362544797025114476612133622499094287321570559088587999417440664282418005102546343020409520421747216'); +INSERT INTO num_exp_div VALUES (9,1,'643.609749344751131516972294140174556703217311736700045690413622699888869645595256683013323517984528456698303984909359393772036036540901870537096836621035845014213031549051156299974682317824766457362427063305495772666640279328909129870227828460705733995380145417663304348663705694070309475835826101153850359826502235923289787750107778906593010060115662191620280031872002110849782776325630424918493602259707267214006217268630948545349980430128422952869610116216278256812581821942763705098526140427280008360043829906543029486315209818099697988089748683904695870401517598840185535891464842870210715421728852789815860153472208176465166954851895457846723102438114697692610933532992841803219018495137378534010155991355251803548866919409031477821173935696065078362044927492034445482457329200246282082707380974745411383781'); +INSERT INTO num_exp_add VALUES (9,2,'-994877526002806872754342093885760.69667996446358567630831677089993316481039076439881735980566785462673358516198695146576524119916430759085192883825888457383242076882081857926408611052522393579396644731758241837010163568445385303315267086044455246361273561294141518329233754041352632499787199926225490924591851865949646448441825186059741089695009429827829188117479084665641367'); +INSERT INTO num_exp_sub VALUES (9,2,'994877526002806872754342203612721.39038050457374613143278241259478942521582284121765030681448507149813723390800786083916642678676237719134679789066681148658045087323654637787610377226547625566084597844703238942080799221554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_mul VALUES (9,2,'-54582443595378013373024060492546032003692.4875677735896411267274323339692558458420972958075073392126734000341372096298914875892612108329218081214550050039133117695428196702128258481789017059073444323729583900855712795086447886053552786449313809589992185978097430132940882612817775035217244553616977182049775786664446683332098226841743818600819221587510039430478859412452506872131851471967577741190323481953867845129745440745526578327709351120432530702446916035797432129052518980799424635406993848916727957825620638983706180841278402925286540375225365057191075559133035'); +INSERT INTO num_exp_div VALUES (9,2,'-.000000000000000000000000055145964114074763360265614481666934002579974728749248345352023099030383962250681574081874554842623852433135871821620640200582985140388676650602814646133317791813938390695683843848260103199745295436998313216878337673674660966362155480524935736646623766057029148471463569162153009963312016563281545776175277904913263614668092319707343286073000287493274965714031678784835459999763925833141049057636632430975424499618419962303087175237320046300285962065818926167792812657620724550768858763098967149546312995222223400007044549870620849992226072041407997925405957501929449911416474388622107825120486594723448780503829317691081601820425151593487431389373265285594626753418140874747955925763163132984655078996173911578832035721963554569605730262976354029623260224710106409129114204296314733036'); +INSERT INTO num_exp_add VALUES (9,3,'-60302029489319384367663884408030893999.8854209703537480818248540990234567956069965340942024890856088355839135538265116174644003927269495876835324407641642359213535695803871472434650475144516723617632059130297610134243891145006222068960999879308472500422640481972089756410157246974765071949782242392661524488959954348903412713930092273629207697480131360047867213863018127928853922173643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_sub VALUES (9,3,'60302029489319384367663884408140620960.5791215104639085369493197407183130560124286109130354360944260524553172025725325268378015783145476572840273098165721628341015996848028750420770651761919246816300854441592109844750954710317145008297946462099581451150385769713261452744310496166494545449824802407416426304041583975713483424241727236417259479541129474082301376239522310995725648773643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_exp_mul VALUES (9,3,'-3308379209762459471107480259839508279070920437.883503980178028214343751083865562028455061662673132221930429904398963590401793045470444301883103141901787466923883803951815572606105617157736442670792467625964359169270739534412932791178258858918086886061702512427989129732248215348301444245772127142869263635282888226326427510486246184233225114523636171202034558843515894542952126988613018789833835507734620046994907453602573865012044120483116345444810078666601100257620969379968264504287700045822481492526688635364586344704730579892342786173395802035361824932075736340405960099542224953439044947229246847140957298841482874444906129049023002897135347878048572628834749795298712449864571996898774444932083319581439741625832405434317985988163261591679157437224404970927012111196724239860528859217322132733404472897289'); +INSERT INTO num_exp_div VALUES (9,3,'-.000000000000000000000000000000909811507365065002714756487495210579371808512079908127938523896001746219475805196061435010714649189975968123072269549018826343830061696154665503565341929634172463095299662727352635590451263034658630449260378893723785917860125051787451512267088404686342938118993621396641623525252649748977992770709930435013456855344203854749977414354164157192885125263071636468941596567220391082793700307461350484216679632552883058303710297475827456761138832914743429330069022439380297715971317819244718196187172770061156794130040674050533617155253444764036426045091327368023602807193742585178432544430741520636125146531502042579276206322507516332917325631822606079220413965396706334639331097621824106950192993127113903265025719013680733760540930122186345919977470628988674677630636632053583144327'); +INSERT INTO num_exp_add VALUES (9,4,'5329378275943663377078725.59616792993138452386059664269485161374191901124632386474661634799161523147237015531446709484039091244606359050341194730653343894986479159670583937529516163204904273806158788218327396375034882788180783796976731912141525319602448709213495905899041406302673881364465504945113279286939663215197485367850132991968081639290297033476859158044889351836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_sub VALUES (9,4,'-5329378275943663267351764.90246738982122406873613100099999535333648693442749091773779913112021158272634924594106590925279284284556872145100402039378540884544906379809382171355490931218216320693213791113256760721925653394811317969065642404864072442190731745871963413981746671302248281216916486794296983018838956112081135739969615171358100498945955409711817327376172085836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_exp_mul VALUES (9,4,'292388240303165948041827159734686.255558469787242316676287235194652580157149226950109397295920730296960145548003120827363226435916209781396711693581454960342091452830648929118261388933297036933167543189308061917640517578583521401267417187854611829815212778183983326568586118831109538377828156118900313778053576483381085207892754728937946691892849474364477434665960112125254104966566712906532318984871145605839506991591027939136026602051635433295687547552796828217859648186757719639965988287173297286034098497871707197092627676226053609131138590878743560287292934815277894463305001278326023708395571840850120055316276256138004565442099731931051413153564744766098053176049414330146267604802971221161572130161432525297614616942172815141372973870720928125699420370428856022295499447755488148545048400795053604349570217878099721865670458104653570360'); +INSERT INTO num_exp_div VALUES (9,4,'.000000000000000010294536718194523982241053267404812827031741197656209184880073175960433631103885281961037127283726462743623757855378209281373475473018922090781553213750339001555832360656399849031527008437303091226051008068950896796359518673740801770866360774945096397034708173365378527676779736929035450380795854046109380272505550244458858231227568118355064007614608452292270378691774826689216790090661497154742954386244856792006376222923780801296832612827123778915598893970651480451509706836620045721191411824060983487064555397842027454385628620582036592315345973096405447742002746762099231557054678593446667904250189208490698468539396733604833688133512716508825505666644390119877423938820483653319376926639295680552194966870285838815705038244628263602997511842285889300557188773128635554621378148419364876651'); +INSERT INTO num_exp_add VALUES (9,5,'-597892150.08771044822540810796370552966707032464017958269847934730769542644402913723848026909285133109089452632480800168074607090893991283808726990171062867538012237270000932798704781608969096508450960185964292594677356241956277714380500188870696516251767979457838109804726539408115452577436052503866633026489282425086547752714324273565900641436632912781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_sub VALUES (9,5,'707619110.78141098833556856308817117136192658504561165951731229431651264331543278598450117846625251667849259592530287073315399782168794294250299770032264633712037469256688885911649778714039732161560189579333758422588445749233730591792217152212229008169062714458263709952275557558931748845536759606982982654369800245696528893058665897330942472105350178781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_exp_mul VALUES (9,5,'-35812445701642379.972368737320206275515144213236752803936806738624588812089615098329765811617509505790110909629109400553415312470540217508070421816878544125783329593128638405659896184248784794258084116406472768709113030915308410565617764394827427154923321461158387012978726512246146545834669665093228316853342805604075936530371665576147966721599968786161939347726656168798065647411457701453987215491345496003650288850096338695703984042549594979897253521041581573388369367579323607093487743440894765114619634001789457486407909224339065748496715380572175183589195611952939575073075140094901024063428239223964510824958346570603142906309198033196987949067156046076497974760641964978711558209708743776024313916111738542765749928287600981397080809041007714387564206594515733287925008053261840295560398311905155157989225181164097547541'); +INSERT INTO num_exp_div VALUES (9,5,'-.084049034261605466896663277055600903951276881294745183935726262038673990196778002490449355450474227878560465916800470848046625257516764244432096856845087412397406701521972651300484716852035267197801389708234913163750232707469240634303111868882057393120649919262424619226282082184091177505826009374043368623853156698509808569378758387708910629731005691079770517679511879694426434724918004419953301426679939010592502325130576915399009756468717124460489039474155719834555522581553817856854607844133431854471292027873672356863673617090151801474016666978499651970627896504709551656249007718965259502928591648533670568214972768900993459927860068104745163979267716597907297073374689384723943955361288974065531322408839914599555769945298758102515352082822617428033648130099822033393662643586331479103933840387663729387'); +INSERT INTO num_exp_add VALUES (9,6,'54863480.39378734225015137845671346015520435061071252892396685718794832880965812803098645730572474084523997120024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_sub VALUES (9,6,'54863480.29991319786000907666775218153965190979471954789486608982086888806174552071503445206767644474235809840024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_mul VALUES (9,6,'2575131.137912978352131546639620215541477987701194164886305951830806120142596646541302305984776928560906754259789485960991272272782091464270104432109904222200473616116525297615725803495463468272171161659654385929185160689572943852767523792651123455283534072794326647404332228203001469884016996499768656263775233430922446983838511590562929268821678518640501686017030536100955531423152839988008496919169395159653034847677470665418765966542111749439412'); +INSERT INTO num_exp_div VALUES (9,6,'1168873084.346566233232746391559830634361431940000227460271861554316197556566224118756340501278103405856646766537018954185964066240457859194626558143313125824412559635129130086906976028635444060218797992547370132082916380788496584864016645155338102476357490305222392452114945853620686975383081427840791892729407194179236897452655907829255937027286698570784397487382242990326347080472574546312522326038419753951437799831430690304084087684303035538181812523230890783372773953961677974396907303758903934808035747944477277528267001070234880092255363221274303820343225415479126819937070570562654065195009839593938440374000473302075568746771126391307584779249330981594640387657042725725493800876630516005713789705652827210295338592985225924959199657729900181287069808881130884115897407246324220524401243575641227725030779990490'); +INSERT INTO num_exp_add VALUES (9,7,'-818934540016982261.65314972994491977243776717915257186979728396159058352649559139156429817562698954531329940720620096519975256547379603654362598494779213610069399116912987384006656023443527501447464682173445385303315267086044455246361273561294141518329233754041352632499787199926225490924591851865949646448441825186059741089695009429827829188117479084665641367'); +INSERT INTO num_exp_sub VALUES (9,7,'818934540126709222.34685027005508022756223282084742813020271603840941647350440860843570182437301045468670059279379903480024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_mul VALUES (9,7,'-44929599044588573810654775.83678007633232843418115790847152455559258007804727916986432256198687661496804050903769496933400455947645400628259699874770581538122521805603947464462448454681701547899144129061961394870320463199545502030106801911915987309444301341575451240764927967432593181449618816978119423290767783843864768557371257918447461479570164065303599994081990686'); +INSERT INTO num_exp_div VALUES (9,7,'-.000000000066993731076524206362744068866774567920404984046399050881532938231826344009126898802592302273719505485084766150904380671495128604515800845609713368334606489445184535043833069145643553083555507533900955661105251251918425885537513359541698046533092111969478225528665278023069818968531644884466229545497943710817187632203193468836772459599856856811131193744272314519908999458320275710240994009061040198159739169960258978462113813370513611735006229733329565083659159456172425715216475781507996483885669437855000029758892126410922067202159414570164537031153818197618428471046051340835826664787585016361564969663413176434498159140395476980277574789931364078570781760777773379636490084338326576889857824344578398580499610233575273027387501809967324874264742269453420400624883982643066864175851881870402856698'); +INSERT INTO num_exp_add VALUES (9,8,'8551849703.98748751358673528924211852802333963452553842636251612056366144128630740476125273064380199240146487881028508694029546139131732304020786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +INSERT INTO num_exp_sub VALUES (9,8,'-8442122743.29378697347657483411765288632848337412010634954368317355484422441490375601523182127040080681386680920979021788788753447856929293579213610069399116912987384006656023443527501447464682173445385303315267086044455246361273561294141518329233754041352632499787199926225490924591851865949646448441825186059741089695009429827829188117479084665641367'); +INSERT INTO num_exp_mul VALUES (9,8,'466174236688165594.9218054325256670866060556227711696100465581464881295978997280335378678072434776702952026828137140986670189756965420183565968027969700090735690246176791371115610886533930223141650377886909408268207750238603105232560663571044993507074695683027062426288270199495225881785499139012931143826099668999261931834700467395442768201666740663642498098541516326470052372008385656719236306238735524802875519713512894448940917708118676095378518264553310312628830009314653641136566040400'); +INSERT INTO num_exp_div VALUES (9,8,'.006456816440893715330247418029019114736889626790871612141686117271826070935285769018710680035004320626745647926106882508048159628931624522666638442625219959259156539178378186912871506893482633695438850964052285542425753626455183282159259999492971992739484319464700978750304962671213318202670228197968646486740006148091321740497272644910882302412140576608739962605210964504469426861972705740810533465451230811358870068391007718532021526225893542801514255726272411690175555142385382688220121052891017808391607717500701760375927811435030512071347521837090721052128992926357375527600337655573639413811262412492632491693179011503973930804928749370652038245414768103001067902012962988384812280453070895781287237746786414435546976395632454474312533482077585837153357017362048554313154580576238549196250793055676215164'); +INSERT INTO num_exp_add VALUES (9,9,'109726960.69370054011016045512446564169485626040543207681883294700881721687140364874602090937340118558759806960049486905240792691274803010441572779861201766174025231986687953112944997105070635653109229393369465827911089507277452877411716963341532491917294735000425600147549018150816296268100707103116349627880517820609981140344341623765041830668717266'); +INSERT INTO num_exp_sub VALUES (9,9,'0'); +INSERT INTO num_exp_mul VALUES (9,9,'3010001475769225.8286280957637941018500905354415197182850820227163907782811814730309044010416886791014702373809932926301368137684091094408663914110947072451332976891128659038142954192986392936981664792370678656287232795203974766040821110221158579481177539669363513848425151485663431478439528936592701070340012569297177488556353760756495238304538439278682066056721729656193616571456456325016960870401748115848423105783116854283646624807603476682295234280408938557209608025246638166902335016025467565869375885610813662767004038102486303756741615124814580306266901273803721191779461890468156043551004644728343579032524687612403663816107770451694666844862368101122025340182510019516924578414085461628689'); +INSERT INTO num_exp_div VALUES (9,9,'1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_exp_sqrt VALUES (0,'0'); +INSERT INTO num_exp_sqrt VALUES (1,'291.964716019333021494947753821238960905461614737525349376826064492714634914263808902604580614735501799528494357560837535773816469841426747889103714048646989532842972129124080559131220979335403729022278994440514872845756198274805589586120535745968205107562348427941379641465378272611453955517402598409789621997041856848783989993820946766177453801729783316269310186191833995557234577548740940419224137195404391193633808203715191863638616433190672511651125299379882126530500870287424768024674231651229908224729856278167033444719242144302972892419034855417126978468296581589282861879645409909873113678361180607775255758820910366926076380306290306477790931129670172989289536405788838857428768869345763784112862591549008321546447442552533919976570125718481191724503352619626562352280522949665158335559389298720990302071'); +INSERT INTO num_exp_sqrt VALUES (2,'31541679188064906.712574384704440356216787857626740375004266523720148374188511622980520374202725176835435173058936870163875556102907654264048353814040480579464700545975346621546520503928314632418705230212623378642743044255181848913683862360044189531298446109955034944189751302497670367665492719604026161836224535961347218522748523360100432275693829501972749859329753224444694962089604095212784768854310289429208671271394086829270986183171968944659703708706544668326267327938226750760690620258967209626420981505237183055363540806281098871221581265173394406715458619627534396065960117454160969749739483126059760636526242783235685190739315590041294766649891987044641492234243404608847939002062827210734973778130441825067858641461599799772535304379732674727995848518807202053316225824685704785148921785964036119338754973714515974054'); +INSERT INTO num_exp_sqrt VALUES (3,'7765438138915239878.949520541017683429203286303188179443533225547096446554008374834292278237558244698868300666061834105683999048386497322007336816482648302911579331582895326423063492240235074387242190187374869842856897538718280497895072291181675294000739548676781615025944675912072664211455701112700937190832332966000160156597821149428032612782336278939437593991008833233156511435294360065004167893309428565243314846456225604669764879344135321428948841659419438769652686215993544390780212859309497190065178705035652106614050448518931820975038314187040226298661787490226917902356569717171481159691409131778764973037046501816919243659681416263730519167614043077472097520207347950292377914586524327206547377189493301153212000966249655331053184913579513686655963686155890934436604123384536027235444923674128269748280097789270784333442'); +INSERT INTO num_exp_sqrt VALUES (4,'2308544622905.016172868282330339228589083058636874526727829838244942341440716909466939214393597311710652963849541394758298277969240038668406494621950956862959196896847352631445328917063551082418729435554972200530109505384839391233286173517804321019323644218483570886304028175359854335870835404627608254205407525763332087823548640923282031978903399118139052814618531713327991857575390136755426466065839913887477577516426991104516201265995293600539957187007068885368699949673989051443005684755994465547159213587471972139403333249259808344536605314911144950465968669770276463111776581675944967401948957460097365849699783091843609965345747287667911324039374314413430490112443463386381631812537639503425989372084906324702158112088898424705684574998783112519152403201231176840068666882123684602080460378627639651465436618032671756'); +INSERT INTO num_exp_sqrt VALUES (5,'25549.082770905117529972076915050747181125832857399138345044265535151111965091602789684342996759657333588444489085160336703294705499665424408218434077722506748278242942379566431768762487954917389137120540138359870652558814224523699917122023018717544160579704907452934297025088008618627873220397030397424422097405152321366495319708580932627092620533785271831833326130796638935296720064431288560292191928489034307645738331451165431755179025359993690642194334018457793169983249853388987495489562746304107188105521296156525984787815685365255240654972150342496329030279439124533240114879332406941960563154881888172285475336782757262639979527682925214971861707635327995621436598536743180180978457735632181738067997521785965451385630326464388080990200265186437768409003553910194212076755448477164192901658547251079126833187'); +INSERT INTO num_exp_sqrt VALUES (6,'.216649653115510782473161631235601739254284877523828136703593069337209747459679979369185882839688430004369697316986054374456779366220242645866798278985273820408495361607183119980716020227424205519727777568954933592987351750339481522149106749713967143685591960510946511796062486795368200503801097611436787402191532618456991115230272084771674098613479989808680789347124789253499967359190605681912854639520917409710307182238065185749856554472717209097115325999946728168357936779767099041518574001682560265549916593333117469681763348860131760281253987626822958726920016922608371657319505153308390495179319529587670415367205193280809809356733443291197315823747505896510820272670040485083775482983378341120809542502350385555577946098824446199419354197416933858522419312733314383889554606932774046771497129486979593226'); +INSERT INTO num_exp_sqrt VALUES (7,'904950020.759072496304165474991957396337281699986101765045213964054286624338102141970514306010139529492299343393832200631760194440206005974547202512275476562767685193838576516154915404389465528270010938533075930081897392863141132529694804621418663424569202655893682412466871297412964570322984865326770090075582481194532433411398133265643849129084449161396724635797324126396071308557057830046688990212282866035593809633839882468628249964862932050189148498591642162462777480125024786829078066012617362076651920045684345679767223337287825546294839320770903419463644110383560050404456170063805115223954191445548226706113970164823214416171441655706141596091717118495955441099867737827763335880891937222647408575142200256804313345924443344596462585960919126827045197885802122062165934504665811115031150357820196176799560314653'); +INSERT INTO num_exp_sqrt VALUES (8,'92179.098626752893864900181023972781406074846653380680747862421481598042923358730531575438403865501429843141967819802251116774924400485954931201776260931315313253827346015775662310076094882239170765060649024538403329505426563390044695320714825481746233901773893996663258170360232639353378395244461670781152793416950717050461856097473105730100523010642696332151571372764781034028324977128554099993021459338419164426784774496292405945103200724413639660488309795423335142455569853549710795692020963174011003447023610692365550245567840477105794884132665155376243735213346877116105595296043532605899184658904822980397411096930267453332143879534914237169761039374689145860503772331147367757318826885494994339695470190886515765452545019167989882527248872835783707554463866334705735781549392895480816605355996057201589681125'); +INSERT INTO num_exp_sqrt VALUES (9,'7406.988615277484686670011157489572203134420118818648711986549881046321377798441006745317356200279801348355202517703531020643333388857073977704009782384103170022716610432579974132111487533733493986910583223121269323909760573942980360508642443245341392335557152177332615977623338526935953706604224108508582338123915133189529507760875123300397933931420500010248194253078118618381590347297853307090813639981736227771834732256867579490224181748450683295253634852775448770576585177080941820456051588076218688792321741398867304684922665590162004919486643750098085197190000638539994723704724550600891137853975703823903659121582583388450687255538838161486019214242094423895463814933532217776443473765708693285683261505695170847285063013324823850724236845500162436661946026097459146424122412596018946436589967013641971183281'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_exp_ln VALUES (0,'NaN'); +INSERT INTO num_exp_ln VALUES (1,'11.353265918833698201334218522735144514838241118349715803442713722607336732214173255618762341321138898556011520430414052782971985419141860417968593746833898952016980791997105866598425597066404919489902082738711038276194174786383758877067916049129476352925010880025206629976454341252818402788928939407784629386362069592202090897264194883276572978998896242281239126931595483958092059051047739223830394259082355969005503976135238921488192773135287876801394308064862257453262299764712613486466254696464150007113953810688169396432889052881763511661127351872408811370081346456019961324265446884877073712053408327408917588393884214304220369626106333713688792094943405258431214313197283237071070354654837081449831786573831004911008790533179001070424813584405346221388686999574752038655226138085374176702005198770598232862'); +INSERT INTO num_exp_ln VALUES (2,'75.980172429959420723484178622920965327708652620924912610122049843800380131746381968266727388919414524075492921510147435877107720844487333947572033626887969846858337336557672107987074468763307953130616555202495401302128216460637786993535376622372745654109623249396257174895352222213037880060756992073605135503615371392439827458529942230210514752764526895030759481226199720092008002458654297737883219558685499445394647863430593136350562417924068100891680398878483362058595716232013516337079804607378041880078724811071904523716775991447489914128580100888252698281559809224785596795038122963619830942475652745611551345360922016753939774272970008770647516790944335173711498988149783075646985898883858697162003144539047532603946093022417842140993960433780913606807466518632121884254341907122163281927271483110212890483'); +INSERT INTO num_exp_ln VALUES (3,'86.992429107491709045555322727377654177072455841678650084144967727028762699430180506209786297136121512625728883607972513154010138109866327600596617277403558404624813332464431424791338402731178416819791932126837396086742033973404980654712734845137075562739300866280737071167943367603243180515859476717635339619107593771719314284984269343476343816253634799874584843436046260962736006310389088154751401911743739429257286834178656182340416539923956100441369280015412718483971113838923221170027312390404790743389872757674342133486652087007983701950040432125562287337697971646750563062524010514537132255605131615248097901911480464339325353279118429890601202554448469387179349495284716473293965884844451619766312048304583068386805927433174443889441171878078987788018564357316138422561213329104267180509029624308926098065'); +INSERT INTO num_exp_ln VALUES (4,'56.935276817066740776567329017240462885579486075188456418197311631774373422196025180114152248099799048545382060930401786002025479108787121595516444894009593031141335985913019897883627990503003577804436730367402618412514152465206336556967419434371593632864308139215157721913158949066717186782560422199668568894551013785702491365073449320535603830475158258853167712460432995074161536886421366716995573365924430692151761737886552457036412140640821310927642146210426044265504978418405684030862182425702683702307323138985481047994648222224089112998195621687911787785594701557252468626097576375468916953563766801336922479861708649876362257086586679701715813254414915314296890025577780265459584203893089574567331742100451277992780400302806430264717887468808962517029442262560742822875484362427192693300423729233467613910'); +INSERT INTO num_exp_ln VALUES (5,'20.296713391219923821414834924710998522858242536565236229645868008008504475111229451635162536658197320282791428572861452713483981402773630985812066048575864982038046409484905688236579134672910905547858248343712686247795669280482288748331949478864729205285910525962001251260319741279139167559906461672936902355959755164523720443059989357054368460911050707727029320725144824995614445423492687177126412520389766864793826362309254124276325522276592246655562770110024099522184080118637524912964002223613671995639705240767929562023556724031894855094820328152633412077228479168557819219970917880393852962560319397442566813746504969336443969816954424715197797253670026862362130664772772977978222813915593329422557592316429203293264572088112274848838446633519530653849595288125585730314673691986554304725866754516304420665'); +INSERT INTO num_exp_ln VALUES (6,'-3.058947463851998053084898503420969773173569760507671013593014983772013099601022840164736581595033399273677583253456908293015637115395777673836877852797643436458673662566205707359569792482081945396989472318998080581824382006377064185813936544714612287417301161454496258176319380348780934551188852900784476213986897306897793456700682073399936398243222895442594762628402487110466705108765286617060826203345783502301472192906817785365563881556293576463515218574477264521950513789471494214626744754200844840310516235570475410854073969787604451971790833680742315518808178608136598148628107328076871698598743664423452623124027059698038466681488746505289551548778131621576387262707147068500249466398507704796800459013580425992071957391417767257856002976954566094297724379688683375704613872658653366052459242767328235849'); +INSERT INTO num_exp_ln VALUES (7,'41.246780548917246608934265057073076900048579756649769602488660179351587788197892095257027979113051775079905924990472069951828742350559917110289416201523653941731339141666097617614477426376799479821365070373247490598890520285155435501242427296281987676879064510605563522117334502131946383957407685328562874307957108543536378261847119286989184256009392692140821396916222386573424618796707564187152459973446833193743614720624765332006827171872712331032607870580880807058576154429597725560836582655488602546786785520452359711161305828045237044625934404295366273012300148250900116489718279757540843657039519736455668388572899273464839528462223812926410544976290646668870192676914370659142463304861500879195867873346447316374869974900582948166687948531910220128160490935170837209017355954301127162240133341813847180541'); +INSERT INTO num_exp_ln VALUES (8,'22.862977375646110045361670561177818139082238721442691850491173190000619222046296383571431877856442345505931635735363450488731186880557789439424987680284612480261693386095598289519783790826332183796775862215503493910816035128476952347072320869461206895223935484838130924268616681347949695029657753251443811448783435000569829291535036468240771401957519222523032235686030017496209956550934543164421459898155836108824017735809352580723262896259290484291175350770265895317482371895188221452083719817251845416195168686335127805092334984596224320638378502008767433534450949989322562311171685891891122105437154553106840103473941148230953978989145470651955269817951560544095229079088083494695756914405635176899994279484466773598435268700064279990885608144109747858515514066444373797446449729058958270758597627587968112958'); +INSERT INTO num_exp_ln VALUES (9,'17.820358481980064387183481028572263407130633079314879566896470101569251997264841660326428805413719418277889123643557369421967068805165885825106611310020187894256310674762734896979157570968168599492401269694048046876387337971177513661006711375440365724346137980004810780215236524986274043416621637509807126148966029923572853117418545426960105154053049098579812135003711132897895016476695223444397389521434633067499404903493027304737402519428197015899833229473322655155458942323004249812974150129789653469524573801259946118454333405580647485894435301530550214095993989552176497867244278699359917247910082169086524111229983698975613609318418313798992088206507831757327320958918656453341769110558376097374227592021075267882222057385413453949580066342977546145482215220982989992069525148522710254796105001938615214263'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_exp_log10 VALUES (0,'NaN'); +INSERT INTO num_exp_log10 VALUES (1,'4.930660740129727276654889314296515979425461685461970306647398411855044094312185293195497201658739777714943974003690119189101973212927970410047992001003936259467465542044528955416040460487922970233600641954269411521809500203864460110903973264337093883907933081597350982496469748131390809569321256206859934619579029279954574676601709408712255490686948453752571699579252140062805776361984468580258289509013081691778727372026090522694670379557247829136504595898935235926069699309392675806881162434168418505908116911054206058735257796918687777716036307205415038158583184624809880157060625643069601549803887864772092583549388533013233603450097615537162442973385137488450178790573546382354482351187412256794374383453695483855501587939419102008302408157959291557415763034668013452188944554607063362933134950906875499201'); +INSERT INTO num_exp_log10 VALUES (2,'32.997769620388965086774969704518222090258389987679691893351902336370051104718852164011301929506188893338106627980171059175447833290713847317665944354651476245003161501753612545484635275306181777040447675475670149066399611203341262105766118892586541910243351018829302798733989560900125591073082441126709911019648451232244139674063434385451279378543163944005973452562993913383659295688375546058256196254319767218634546732685705517341998116744642480938405113447415486950667007645850519659606476727681944251201236366198374488204017630268083077471516734133869728427050843306716313813724061560369884508660845630727190444623729815564381063131729592825825486515070406390371638817503915214206586939112681762984038333298146999891250107667687034785493312416966635780188163871680959873288697497561452228182734430749066579749'); +INSERT INTO num_exp_log10 VALUES (3,'37.780331928743475574895606142114739140772838801045013007323050327909196792739138159615327729728110344767302636436234256468332011934881494997184865617793179255006442447189720642997935223133982347184994174261506212652322213673745795726283311685835974151422721233207287206894148660531800622455957268888702309499182978182878524951883775154983702898237404558813230370364953160102391101897560104513279410610948028599674950811462114131673380477843456965645417025376374320207504913806546872166094337441573669261285052323206348035827948287081776955945081345131570610652073053464020209215624179904586956137079321655773178387441622685682721151900601340680061607114354850640946256225260430676099781727317540719923791064452012925902993317349390523278687089530234444415688602090547516647302454865526291471706301790881694022223'); +INSERT INTO num_exp_log10 VALUES (4,'24.726676547286224970759328746582840552419566534667446425423046931401641497155587075591229106937829957279943690528061985864558314570189069764367933957499905044566413640017549478921384160584906257607957223101377816440084188042395098536074479064548620374152344954289432050971466476174493306432228880930006524504974367146536665170956555486181410864034862861231267121149652317599303804477688621597163730470970207231328339082779056152481480926452142005969020950341307977091850953883445808399574256295803245530993204179747743812544604144379381347499056545148243304041538981954204310612049423688645476667184129189153715486929216331980316967699254518020077226689317148303152585009031597809279387172427408557115400021035692880631275593381822805377317270568779655383061987766693697518921188619814204902583361096973421134004'); +INSERT INTO num_exp_log10 VALUES (5,'8.814750626578650238811431417807018895270298639823442501111235973209197727215795256506525221092818797578008152140054383421240180435087611869193019443372556081555311825248667278358330916098378127100899126895012782320751838528480712942601038190627182482614147263228588284866661508052724762701223357327343090598060805245853527435948381893458352744679795853650453594546267600486696643924152372736774331080527157374379043696696647158270918245668579680394279565181670004245143555617589138267976417280970718829942998800499312890580011246294669585429723974582350357991472101919333996770115834067969654217063942059882195268353998096891812525364797586486311202350700339609637274043915687880562465121559531284337603363356183320193656553931871200575467929714875483123706358278876389849119105053294688326141759401230994901405'); +INSERT INTO num_exp_log10 VALUES (6,'-1.328484003982869642690619298690906747763234110040562640557173509402512757735587333095924652711056556491908059708986413635120656426593745303715671199761364516107844087845783714418487426723538440387069985879601248897538855843115404484229652166941838283489828419407478748732927617251897244190697443966424660881366993754577233476597163021768156814527570512834684713730559883782625870597080940193303268818336816535968869931456641949301731046034660616615392129109391145214470757259042172416816936479713743188047425796931722546185493217275537303458837771965375448968719169174136287532752370175863826715450565025635651343928205805494319778539652563499901671319955144823432132740582617949774638538594081514904904341299199113721131520557004571803778698005652464301037962272085633628653321081368256925971558076970172779715'); +INSERT INTO num_exp_log10 VALUES (7,'17.913249188669140643510654105014358282516966474257460687880559542190804665566625978925406311113121982595279826214959603627387555578965653325278444455875162277940655989601428868642914577248262147833499137348602966573601719040813549936948178463592211685237720748377879836890106515699728652218324794927458352954247096536337594789471529493944292143186953509162522579060020018226817623648563806559917579317916242706559131476179714031602207057714677845347616752450567251644277767418397621490301286115159509360375419599968738067461569666699939732107480135216621373057421990702923042287910730395998082514702629760389192370666675364405730936537832803383367187639209534697198515928978064543150195911463663617683085348965065679311986715357338675515370634753254774665197233934933271954463040729779956682570415317734489164385'); +INSERT INTO num_exp_log10 VALUES (8,'9.929264914121995501917993119394933531225401243275938207624866270551448544301376913376130982251708700134720886862945040266148728213253651323129942781577143957084726727561987639140151337848818195806259935747329665025823709044567138449084349729747202164413995795609659711723455165142329822773177102845804114214340046404641970845707372809306219463962664551623665322610139794354769767829380018857313559373283673392337954610346290037758389035140213224696023751541663171574697035012610534455189013755134090933979479069288110010954211669067225249755249337768792642303351914884187159646984708862430789018895140670365476746734456807215043628059581947593694929159076346249490593187993386780521089745819640214783614157516171005086731241769146397577246387886107367648843380733370112546792442909347322732196805316614555689762'); +INSERT INTO num_exp_log10 VALUES (9,'7.739283354261751283625223433456284905560931805428759681411970457812279544250432389511382263439324085689734710188041049046660480575958686859942980599595036769090747781359217248301544587434077376812293034848418204834388504169166350770257248896025815531248627658465029806509131631454856186387892627989218208026727504548130018922325585619738185507999433763118148418722504204066578294826264005398891049629199412773138457218976050467479292777172717500219850781664314597312411301296201533610562886229900497272268364496763758868455934979903774531992886483396489868888731578355541611359130188566524240259770918423445785338175040098706500034487703124623745259139247432324145633151895802637182446905097253961951018926565652497920605819785424451050191604602898777804133717341512568151920576684198443843944721398831404081859'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_exp_power_10_ln VALUES (0,'NaN'); +INSERT INTO num_exp_power_10_ln VALUES (1,'225561990715.277245515991117670624124484084762557459065170589803293759247930753528436379932442146759103295277479258327642314622036941865221478746258727236601688778946696303277607709407496616423493315166963938393760548678730128692212077086588682984700837334554241405763691119669847463520746595280034536307041368063462023793177898200220207765205127584303464304601759554817607633012272490650155253979182893585119965271975927569080191838676053084168631217591768468344106219831174026139608715965691941366334940196517120885214887008671956523579678156919416435031020452971977153991139145404842034138317592877675821045409772456977018293365238179815614004574330200783530118851005077771478448804470170641452481992602803877112958872108069738434946694089025321283178188028224338756015337492913115267362635647236447601252924834642796058'); +INSERT INTO num_exp_power_10_ln VALUES (2,'9553718264533556311125292459627965006385666643531070061102266984368939757379.536714147420215784125170401370065894858487440153494392538261078415409784085960333028254155527328359894197540839556987826344995348426293585457768226283066583722499658006242709930685932246087653832230889613022921575445199055131152661556678809191264086381976922223866204038615136758192929883317207903579770917317641181652055458721731297347443662717939116561947785705140374908203404860090658919334137955075887697259604047657534191202566335372150375993361370075961180728155127447781364264047857624746079509591666068708743260905728661917791822925979235918475633100283148558978385583805341715868143937062092264994833222352433299015979561976964779350640064096690062929265992966564232453102431600199173711947391200249130712039686700111791790265309426741120465259677894665532560198051256215915373145226284270408649736509'); +INSERT INTO num_exp_power_10_ln VALUES (3,'982718444846268846508445482774217796844461660819285525931206164100817251856409365450682.362683768066405322653747385034480250394145008573806022660379219602846285813744865438912887625784087005970975437905783802114553690522787857272953842288090141945268495451006273685577260054069522075046955466204804067271437138871789034722069934693546671607506851844248427950939791205412350536883779850165603116191193657054604569586553874805856647223849267039531773072343908345333155562072887754900969504551717514980465801806565999410206735831440712124661645970935112535081991606671600328471264697018198676317466846450405861359235297846597981143547119390922405594115478086038680663368675222949247096131378724350715530605691796680604309063173515781378545860473572389718345696107553363715518601596249508215455106779522851210398208919496668879040223859884166805448827948087400426315425231119801173387715922086154065273'); +INSERT INTO num_exp_power_10_ln VALUES (4,'861542720105376650266753999919217194383259935058507531116.774511336660822591851369622743235084609149542494189385785321912210129989390054947787009383210009523204976629456268332186620016067379702483800883493431423160815760933380418976582725913410929214462739708321325884209636272001805871036779154087677637129248122540412937033791526383240502286607736226090213753913654673523613612439527815137888202973659987501649474772884055648603290154867585312925699571949539600328906295652872654314913539778815035321695215634102441494403825526533235061083947035338872599854931230001361227174477274708230470794066733245241594719912710139298949856243576688344051439047966427547889756037265151798639614843866387316916203238068277912991427278268083231579195846744438643659745041780103653332041031419793815914447232121937821142169172566753399257291244398531365781832297786941359729799400'); +INSERT INTO num_exp_power_10_ln VALUES (5,'198021976607570296508.271597639984889464620426933601643322058775615235389194561064983706229795978402690473201671702614911129095149240715527556855309177671128442458698638704394974473956869419481315262823632891676087912529523219333012290621046361106033860210270638559271706082115529424772192777643046125905852037759566224116373416253787241195450409652089019290072319861181399387753223422998872180810295299831487867222464355713552301775702554189470264147325049133532522718679336524769566984150923939420759804463781082299907043016120177416779442865059261387111806785876531152192378576258351599534512031062777609734092707165605364139201322351960602280089186180302246827234844736393745487324460438448807241887783263546165171099497316415863122023114646876909575845860402164818094500541234974716577550807551946414081410743197768993152975501'); +INSERT INTO num_exp_power_10_ln VALUES (6,'.000873076977206566818052116526263730226812004454463281371489634779519089200224205946321120805055212090024554381349223642352209212670470260295303361873760972918129853308169576675500721645609379420329169271088810484607337679253503247351324049221970104335289487989027621978310506220905131150125321713385148268584530413680037620544212746920563790371941626294733473967065607791756894237438288480748407449237446113996117912144587258434808327522518688617394025018756570740098795745692805352377041347367240475846033282850136270250633825482156304826383360291164928049344226886150285595932088884965511963310715773499733217615863523253012606066583814112265708693122563204149232245895551314975524172504103194858904869273185785182598234060315036187756490539352752560361560286717869643902435677448962235275054804452967413005'); +INSERT INTO num_exp_power_10_ln VALUES (7,'176514565873872717825163931126806100435750.096278384530154766967061948052237623936423931849868926020451465515367348890410352640552194499619062823622476972850692557798609619250753020363520533767813563613425606228355802781302735485038377521515850536680425059519814786118919994914180918228654298075183514200191737597656810036850772127169441661576862538643715648802139886576391427423689320082366572297580054381937437005879583216745596935643579262248665490169331304003204939561361718554509909313409421397022626924406091551900222555950699170864234411017062042057683304265485826061096835531732950909546314722726990314852356462874701181085379772134121978510387397276859318242238150439474660772561390798432890789762504242822787017140808209820627435991445529404692793744568204608385843245177656436105160780897472099970336514833257055017279707999437302548655364559'); +INSERT INTO num_exp_power_10_ln VALUES (8,'72941951052009383458167.300747500436981484566111756088702608000390737594784514635592222758882092500858797317505303492923829092720870826490477962201959426813271424853341826896270963213736922458746003100613943600855942721319226948714369219316345322636075285343544788982588956431405042577296229122673590336976893594798942025893296105815818487227300314490440902574022885833779324177053242170024559675073866612316965636832258283516275906085642459351367507561963945012828379111856700009391438637054015804558386733558956649061672420804826896303889067785497738203077050774825608647969196321506624991188638449047860249367840775936911749905927108478444112230174584693363226143549933224252679398881354887872642908328737917862751077365602631600279486028043329404269490375935308156815477700961014566228692743960491745353377403533037122586797765130'); +INSERT INTO num_exp_power_10_ln VALUES (9,'661239032819374816.097553651299556484820492272269662685578275493609248662925676004753503494252951243895572437264999063878330704584509915845096232798927524470286655554736724913758600775591269525423912692080421094644542553026831758426157681271572808657664918053119324646138457659418857926209701677786068580819823633713337632456905824562235373422309621872998037966404189020165296080436871220718574009921789858751384547836431858428729570977259373272041837411903005303672798845573379758630607982213326716018594073712340609488043353995410508475153538231445235003980586600882223782814368245305160648543466496726973755388826656879616734762068443462618454921858705377028522664844761719759342490380417060255776725333319537746890406213693117052223545525717132695297770810635066731941724108167146710297146989770382041617889670713111888375717'); +COMMIT TRANSACTION; +BEGIN TRANSACTION; +INSERT INTO num_data VALUES (0, '0'); +INSERT INTO num_data VALUES (1, '85243.39540024977626076239847863600785982737155858270959890014613035727868293618673807776733416230953723818527101593495895350807775607346277892835514324320448949370623441059033804864158715021903312693889518990256881059434042443507529601095150710777634743301398926463888783847290873199395304998050753365215426971278237920063435565949203678024225270616295573678510929020831006146661747271783837653203039829647102027431761129518881525935216608429897041525858540380754759125150233053469999022855035'); +INSERT INTO num_data VALUES (2, '-994877526002806872754342148749241.04353023451866590387054959174736129501310680280823383331007646306243540953499740615246583399296334239109936336446284803020643582102868247857009494139535009572740621288230740389545481395'); +INSERT INTO num_data VALUES (3, '-60302029489319384367663884408085757480.2322712404088283093870869198708849258097125725036189625900174440196153781995220721511009855207486224837798752903681993777275846325950111427710563453217985216966456785944859989497422927661683538629473170704026975786513125842675604577233871570629808699803522400038975396500769162308448069085909755023233588510630417065084295051270219462289785473643946404281422516357503746700705970360169619852905053433235726497292406142332833'); +INSERT INTO num_data VALUES (4, '5329378275943663322215245.24931765987630429629836382184742348353920297283690739124220773955591340709935970062776650204659187764581615597720798385015942389765692769739983054442503547211560297249686289665792078548480268091496050883021187158502798880896590227542729659940394038802461081290690995869705131152889309663639310553909874081663091069118126221594338242710530718836025225507189149221049928936955230868771875644038572888630664890573507822342998964954667474300944699078658989010257103569231493090050659723450626338923049035040974032671138430612839043269997482582763267536489504794826476836323549796385028155416935072959933315468068930689064483178204550825728947252440604703474049780550458442808479096492346910001692358508618202898514895453589357'); +INSERT INTO num_data VALUES (5, '-652755630.43456071828048833552593835051449845484289562110789582081210403487973096161149072377955192388469356112505543620695003436531392789029513380101663750625024853263344909355177280161504414335005574882649025508632900995595004153086358670541462762210415346958050909878501048483523600711486406055424807840429541335391538322886495085448421556770991545781035298449067051916630343957356635391594362639819978677032855590055900561501350354631803808000307050416047072513406855040715556454205065332997338225626635780147287003130754254277103928406089109802521803537038957372612837169223905290912251006321930223154562110264217937'); +INSERT INTO num_data VALUES (6, '0.0469370721950711508944806393077762204079964905145503836835397203739563036579760026190241480514409364'); +INSERT INTO num_data VALUES (7, '-818934540071845742'); +INSERT INTO num_data VALUES (8, '8496986223.64063724353165506167988570717591150432282238795309964705925283285060558038824227595710139960766584401003765241409149793494330798800'); +INSERT INTO num_data VALUES (9, '054863480.34685027005508022756223282084742813020271603840941647350440860843570182437301045468670059279379903480024743452620396345637401505220786389930600883087012615993343976556472498552535317826554614696684732913955544753638726438705858481670766245958647367500212800073774509075408148134050353551558174813940258910304990570172170811882520915334358633'); +COMMIT TRANSACTION; + +-- ****************************** +-- * Create indices for faster checks +-- ****************************** + +CREATE UNIQUE INDEX num_exp_add_idx ON num_exp_add (id1, id2); +CREATE UNIQUE INDEX num_exp_sub_idx ON num_exp_sub (id1, id2); +CREATE UNIQUE INDEX num_exp_div_idx ON num_exp_div (id1, id2); +CREATE UNIQUE INDEX num_exp_mul_idx ON num_exp_mul (id1, id2); +CREATE UNIQUE INDEX num_exp_sqrt_idx ON num_exp_sqrt (id); +CREATE UNIQUE INDEX num_exp_ln_idx ON num_exp_ln (id); +CREATE UNIQUE INDEX num_exp_log10_idx ON num_exp_log10 (id); +CREATE UNIQUE INDEX num_exp_power_10_ln_idx ON num_exp_power_10_ln (id); + +VACUUM ANALYZE num_exp_add; +VACUUM ANALYZE num_exp_sub; +VACUUM ANALYZE num_exp_div; +VACUUM ANALYZE num_exp_mul; +VACUUM ANALYZE num_exp_sqrt; +VACUUM ANALYZE num_exp_ln; +VACUUM ANALYZE num_exp_log10; +VACUUM ANALYZE num_exp_power_10_ln; + +-- ****************************** +-- * Now check the behaviour of the NUMERIC type +-- ****************************** + +-- ****************************** +-- * Addition check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, t1.val + t2.val + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, t2.expected + FROM num_result t1, num_exp_add t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != t2.expected; + +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val + t2.val, 10) + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 10) as expected + FROM num_result t1, num_exp_add t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != round(t2.expected, 10); + +-- ****************************** +-- * Subtraction check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, t1.val - t2.val + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, t2.expected + FROM num_result t1, num_exp_sub t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != t2.expected; + +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val - t2.val, 40) + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 40) + FROM num_result t1, num_exp_sub t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != round(t2.expected, 40); + +-- ****************************** +-- * Multiply check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, t1.val * t2.val + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, t2.expected + FROM num_result t1, num_exp_mul t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != t2.expected; + +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val * t2.val, 30) + FROM num_data t1, num_data t2; +SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 30) as expected + FROM num_result t1, num_exp_mul t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != round(t2.expected, 30); + +-- ****************************** +-- * Division check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, t1.val / t2.val + FROM num_data t1, num_data t2 + WHERE t2.val != '0.0'; +SELECT t1.id1, t1.id2, t1.result, t2.expected + FROM num_result t1, num_exp_div t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != t2.expected; + +DELETE FROM num_result; +INSERT INTO num_result SELECT t1.id, t2.id, round(t1.val / t2.val, 80) + FROM num_data t1, num_data t2 + WHERE t2.val != '0.0'; +SELECT t1.id1, t1.id2, t1.result, round(t2.expected, 80) as expected + FROM num_result t1, num_exp_div t2 + WHERE t1.id1 = t2.id1 AND t1.id2 = t2.id2 + AND t1.result != round(t2.expected, 80); + +-- ****************************** +-- * Square root check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT id, 0, SQRT(ABS(val)) + FROM num_data; +SELECT t1.id1, t1.result, t2.expected + FROM num_result t1, num_exp_sqrt t2 + WHERE t1.id1 = t2.id + AND t1.result != t2.expected; + +-- ****************************** +-- * Natural logarithm check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT id, 0, LN(ABS(val)) + FROM num_data + WHERE val != '0.0'; +SELECT t1.id1, t1.result, t2.expected + FROM num_result t1, num_exp_ln t2 + WHERE t1.id1 = t2.id + AND t1.result != t2.expected; + +-- ****************************** +-- * Logarithm base 10 check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT id, 0, LOG('10'::numeric, ABS(val)) + FROM num_data + WHERE val != '0.0'; +SELECT t1.id1, t1.result, t2.expected + FROM num_result t1, num_exp_log10 t2 + WHERE t1.id1 = t2.id + AND t1.result != t2.expected; + +-- ****************************** +-- * POW(10, LN(value)) check +-- ****************************** +DELETE FROM num_result; +INSERT INTO num_result SELECT id, 0, POW(numeric '10', LN(ABS(round(val,1000)))) + FROM num_data + WHERE val != '0.0'; +SELECT t1.id1, t1.result, t2.expected + FROM num_result t1, num_exp_power_10_ln t2 + WHERE t1.id1 = t2.id + AND t1.result != t2.expected; + + +-- +-- Test code path for raising to integer powers +-- + +-- base less than 1 +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of POW(): +-- +-- for p in {-20..20} +-- do +-- b="0.084738" +-- r=$(bc -ql <<< "scale=500 ; $b^$p" | head -n 1) +-- echo "($b, $p, $r)," +-- done + +WITH t(b, p, bc_result) AS (VALUES +(0.084738, -20, 2744326694304960114888.7859130502035257), +(0.084738, -19, 232548755422013710215.4459407000481464), +(0.084738, -18, 19705716436950597776.2364581230406798), +(0.084738, -17, 1669822999434319754.3627249884302211), +(0.084738, -16, 141497461326065387.3451885900696001), +(0.084738, -15, 11990211877848128.7928565907453178), +(0.084738, -14, 1016026574105094.7376490817865767), +(0.084738, -13, 86096059836517.5178789078924309), +(0.084738, -12, 7295607918426.8214300228969888), +(0.084738, -11, 618215223791.6519943372802450), +(0.084738, -10, 52386321633.6570066961524534), +(0.084738, -9, 4439112122.5928274334185666), +(0.084738, -8, 376161483.0442710110530225), +(0.084738, -7, 31875171.7502054369346110), +(0.084738, -6, 2701038.3037689083149651), +(0.084738, -5, 228880.5837847697527935), +(0.084738, -4, 19394.8829087538193122), +(0.084738, -3, 1643.4835879219811409), +(0.084738, -2, 139.2655122733328379), +(0.084738, -1, 11.8010809790176780), +(0.084738, 0, 1)/*, + +(0.084738, 1, .084738), +(0.084738, 2, .007180528644), +(0.084738, 3, .0006084636362353), +(0.084738, 4, .0000515599916073), +(0.084738, 5, .0000043690905688), +(0.084738, 6, .0000003702279966), +(0.084738, 7, .0000000313723800), +(0.084738, 8, .0000000026584327), +(0.084738, 9, .0000000002252703), +(0.084738, 10, .0000000000190890), +(0.084738, 11, .0000000000016176), +(0.084738, 12, .0000000000001371), +(0.084738, 13, .0000000000000116), +(0.084738, 14, .0000000000000010), +(0.084738, 15, .0000000000000001), +(0.084738, 16, .0000000000000000), +(0.084738, 17, .0000000000000000), +(0.084738, 18, .0000000000000000), +(0.084738, 19, .0000000000000000), +(0.084738, 20, .0000000000000000)*/ +) +SELECT b, p, bc_result, b^p AS power, b^p - bc_result AS diff FROM t; + +-- base greater than 1 +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of POW(): +-- +-- for p in {-20..20} +-- do +-- b="37.821637" +-- r=$(bc -ql <<< "scale=500 ; $b^$p" | head -n 1) +-- echo "($b, $p, $r)," +-- done + +WITH t(b, p, bc_result) AS (VALUES +/* +--TODO unparsed numeric without leading digits +(37.821637, -20, .0000000000000000), +(37.821637, -19, .0000000000000000), +(37.821637, -18, .0000000000000000), +(37.821637, -17, .0000000000000000), +(37.821637, -16, .0000000000000000), +(37.821637, -15, .0000000000000000), +(37.821637, -14, .0000000000000000), +(37.821637, -13, .0000000000000000), +(37.821637, -12, .0000000000000000), +(37.821637, -11, .0000000000000000), +(37.821637, -10, .0000000000000002), +(37.821637, -9, .0000000000000063), +(37.821637, -8, .0000000000002388), +(37.821637, -7, .0000000000090327), +(37.821637, -6, .0000000003416316), +(37.821637, -5, .0000000129210673), +(37.821637, -4, .0000004886959182), +(37.821637, -3, .0000184832796213), +(37.821637, -2, .0006990678924066), +(37.821637, -1, .0264398920649574), +*/ +(37.821637, 0, 1), +(37.821637, 1, 37.821637), +(37.821637, 2, 1430.476225359769), +(37.821637, 3, 54102.9525326873775219), +(37.821637, 4, 2046262.2313195326271135), +(37.821637, 5, 77392987.3197773940323425), +(37.821637, 6, 2927129472.7542235178972258), +(37.821637, 7, 110708828370.5116321107718772), +(37.821637, 8, 4187189119324.7924539711577286), +(37.821637, 9, 158366346921451.9852944363360812), +(37.821637, 10, 5989674486279224.5007355092228730), +(37.821637, 11, 226539294168214309.7083246628376531), +(37.821637, 12, 8568086950266418559.9938312759931069), +(37.821637, 13, 324059074417413536066.1494087598581043), +(37.821637, 14, 12256444679171401239980.3109258799733927), +(37.821637, 15, 463558801566202198479885.2069857662592280), +(37.821637, 16, 17532552720991931019508170.1002855156233684), +(37.821637, 17, 663109844696719094948877928.0672523682648687), +(37.821637, 18, 25079899837245684700124994552.6717306599041850), +(37.821637, 19, 948562867640665366544581398598.1275771806665398), +(37.821637, 20, 35876200451584291931921101974730.6901038166532866)) +SELECT b, p, bc_result, b^p AS power, b^p - bc_result AS diff FROM t; + +-- +-- Tests for raising to non-integer powers +-- + +-- base less than 1 +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of POW(): +-- +-- for n in {-20..20} +-- do +-- b="0.06933247" +-- p="$n.342987" +-- r=$(bc -ql <<< "scale=500 ; e($p*l($b))" | head -n 1) +-- echo "($b, $p, $r)," +-- done + +WITH t(b, p, bc_result) AS (VALUES +(0.06933247, -20.342987, 379149253615977128356318.39406340), +(0.06933247, -19.342987, 26287354251852125772450.59436685), +(0.06933247, -18.342987, 1822567200045909954554.65766042), +(0.06933247, -17.342987, 126363085720167050546.86216560), +(0.06933247, -16.342987, 8761064849800910427.02880469), +(0.06933247, -15.342987, 607426265866876128.15466179), +(0.06933247, -14.342987, 42114363355427213.14899924), +(0.06933247, -13.342987, 2919892833909256.59283660), +(0.06933247, -12.342987, 202443382310228.51544515), +(0.06933247, -11.342987, 14035899730722.44924025), +(0.06933247, -10.342987, 973143597003.32229028), +(0.06933247, -9.342987, 67470449244.92493259), +(0.06933247, -8.342987, 4677892898.16028054), +(0.06933247, -7.342987, 324329869.02491071), +(0.06933247, -6.342987, 22486590.914273551), +(0.06933247, -5.342987, 1559050.8899661435), +(0.06933247, -4.342987, 108092.84905705095), +(0.06933247, -3.342987, 7494.3442144625131), +(0.06933247, -2.342987, 519.60139541889576), +(0.06933247, -1.342987, 36.025248159838727) +/*, + +(0.06933247, 0.342987, .40036522320023350), +(0.06933247, 1.342987, .02775830982657349), +(0.06933247, 2.342987, .001924552183301612), +(0.06933247, 3.342987, .0001334339565121935), +(0.06933247, 4.342987, .000009251305786862961), +(0.06933247, 5.342987, .0000006414158809285026), +(0.06933247, 6.342987, .00000004447094732199898), +(0.06933247, 7.342987, .000000003083280621074075), +(0.06933247, 8.342987, .0000000002137714611621997), +(0.06933247, 9.342987, .00000000001482130341788437), +(0.06933247, 10.342987, .000000000001027597574581366), +(0.06933247, 11.342987, .00000000000007124587801173530), +(0.06933247, 12.342987, .000000000000004939652699872298), +(0.06933247, 13.342987, .0000000000000003424783226243151), +(0.06933247, 14.342987, .00000000000000002374486802900065), +(0.06933247, 15.342987, .000000000000000001646290350274646), +(0.06933247, 16.342987, .0000000000000000001141413763217064), +(0.06933247, 17.342987, .000000000000000000007913703549583420), +(0.06933247, 18.342987, .0000000000000000000005486766139403860), +(0.06933247, 19.342987, .00000000000000000000003804110487572339), +(0.06933247, 20.342987, .000000000000000000000002637483762562946)*/ +) +SELECT b, p, bc_result, b^p AS power, b^p - bc_result AS diff FROM t; + +-- base greater than 1 +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of POW(): +-- +-- for n in {-20..20} +-- do +-- b="27.234987" +-- p="$n.230957" +-- r=$(bc -ql <<< "scale=500 ; e($p*l($b))" | head -n 1) +-- echo "($b, $p, $r)," +-- done + +WITH t(b, p, bc_result) AS (VALUES +/*(27.234987, -20.230957, .000000000000000000000000000009247064512095633), +(27.234987, -19.230957, .0000000000000000000000000002518436817750859), +(27.234987, -18.230957, .000000000000000000000000006858959399176602), +(27.234987, -17.230957, .0000000000000000000000001868036700701026), +(27.234987, -16.230957, .000000000000000000000005087595525911532), +(27.234987, -15.230957, .0000000000000000000001385605980094587), +(27.234987, -14.230957, .000000000000000000003773696085499835), +(27.234987, -13.230957, .0000000000000000001027765638305389), +(27.234987, -12.230957, .000000000000000002799118379829397), +(27.234987, -11.230957, .00000000000000007623395268611469), +(27.234987, -10.230957, .000000000000002076230710364949), +(27.234987, -9.230957, .00000000000005654611640579014), +(27.234987, -8.230957, .000000000001540032745212181), +(27.234987, -7.230957, .00000000004194277179542807), +(27.234987, -6.230957, .000000001142310844592450), +(27.234987, -5.230957, .00000003111082100243440), +(27.234987, -4.230957, .0000008473028055606278), +(27.234987, -3.230957, .00002307628089450723), +(27.234987, -2.230957, .0006284822101702527), +(27.234987, -1.230957, .01711670482371810),*/ +(27.234987, 0.230957, 2.1451253063142300), +(27.234987, 1.230957, 58.422459830839071), +(27.234987, 2.230957, 1591.1349340009243), +(27.234987, 3.230957, 43334.539242761031), +(27.234987, 4.230957, 1180215.6129275865), +(27.234987, 5.230957, 32143156.875279851), +(27.234987, 6.230957, 875418459.63720737), +(27.234987, 7.230957, 23842010367.779367), +(27.234987, 8.230957, 649336842420.336290), +(27.234987, 9.230957, 17684680461938.907402), +(27.234987, 10.230957, 481642042480060.137900), +(27.234987, 11.230957, 13117514765597885.614921), +(27.234987, 12.230957, 357255344113366461.949871), +(27.234987, 13.230957, 9729844652608062117.440722), +(27.234987, 14.230957, 264992192625800087863.690528), +(27.234987, 15.230957, 7217058921265161257566.469315), +(27.234987, 16.230957, 196556505898890690402726.443417), +(27.234987, 17.230957, 5353213882921711267539279.451015), +(27.234987, 18.230957, 145794710509592328389185797.837767), +(27.234987, 19.230957, 3970717045397510438979206144.696206), +(27.234987, 20.230957, 108142427112079606637962972621.121293)) +SELECT b, p, bc_result, b^p AS power, b^p - bc_result AS diff FROM t; + +-- Inputs close to overflow +-- +-- bc(1) results computed with a scale of 2700 and truncated to 4 decimal +-- places. + +WITH t(b, p, bc_result) AS (VALUES +(0.12, -2829.8369, 58463948950011752465280493160293790845494328939320966633018493248607815580903065923369555885857984675501574162389726507612128133630191173383130639968378879506624785786843501848666498440326970769604109017960864573408272864266102690849952650095786874354625921641729880352858506454246180842452983243549491658464046163869265572232996388827878976066830374513768599285647145439771472435206769249126377164951470622827631950210853282324510655982757098065657709137845327135766013147354253426364240746381620690117663724329288646510198895137275207992825719846135857839292915100523542874885080351683587865157015032404901182924720371819942957083390475846809517968191151435281268695782594904484795360890092607679215675240583291240729468370895035823777914792823688291214492607109455017754453939895630226174304357121900605689015734289765672740769194115142607443713769825894380064727556869268488695795705030158832909348803019429370973064732712469794182891757241046263341655894972953512257981661670321890336672832647028099324621932563236459127918144141230217523147304565594514812518826936144181257723061181656522095236928347413997136815409159361412494284201481609684892562646522086577634100783077813105675590737823924220663206479031113753135119759722725207724879578900186075841393115040465401462266086907464970054073340036852442184414587772177753008511913377364966775792477387717262694468450099866775550614257191941835797445874557362115814601886902749237439492398087966544817154173072811937702110580330775581851211123491341435883319798273456296794954514173820352334127081705706502510709179711510240917772628308487366740741280043704807717608366220401933596364641284631036907635403895053036499618723044314773148779735006542501244942039455169872946018271985844759209768927953340447524637670938413827595013338859796135512187473850161303598087634723542727044978083220970836296653305188470017342167913572166172051819741354902582606590658382067039498769674611071582171914886494269818475850690414812481252963932223686078322390396586222238852602472958831686564971334200490182175112490433364675164900946902818404704835106260174052265784055642968397240262737313737007322288203637798365320295080314524864099419556398713380156353062937736280885716820226469419928595465390700629307079710611273715705695938635644841913194091407807776191951797748706106000922803167645881087385311847268311361092838264814899353459146959869764278464187826798546290981492648723002412475976344071283321798061003719251864595518596639432393032991023409676558943539937377229130132816883146259468718344018277257037013406135980469482324577407154032999045733141275895.3432), +(1.2, 32908.8896, 58463467728170833376633133695001863276259293590926929026251227859007891876739460057725441400966420577009060860805883032969522911803372870882799865787473726926215148161529632590083389287080925059682489116446754279752928005457087175157581627230586554364417068189211136840990661174760199073702207450133797324318403866058202372178813998850887986769280847189341565507156189065295823921162851958925352114220880236114784962150135485415106748467247897246441194126125699204912883449386043559785865023459356275014504597646990160571664166410683323036984805434677654413174177920726210827006973855410386789516533036723888687725436216478665958434776205940192130053647653715221076841771578099896259902368829351569726536927952661429685419815305418450230567773264738536471211804481206474781470237730069753206249915908804615495060673071058534441654604668770343616386612119048579369195201590008082689834456232255266932976831478404670192731621439902738547169253818323045451045749609624500171633897705543164388470746657118050314064066768449450440405619135824055131398727045420324382226572368236570500391463795989258779677208133531636928003546809249007993065200108076924439703799231711400266122025052209803513232429907231051873161206025860851056337427740362763618748092029386371493898291580557004812947013231371383576580415676519066503391905962989205397824064923920045371823949776899815750413244195402085917098964452866825666226141169411712884994564949174271056284898570445214367063763956186792886147126466387576513166370247576466566827375268334148320298849218878848928271566491769458471357076035396330179659440244425914213309776100351793665960978678576150833311810944729586040624059867137538839913141142139636023129691775489034134511666020819676247950267220131499463010350308195762769192775344260909521732256844149916046793599150786757764962585268686580124987490115873389726527572428003433405659445349155536369077209682951123806333170190998931670309088422483075609203671527331975811507450670132060984691061148836994322505371265263690017938762760088575875666254883673433331627055180154954694693433502522592907190906966067656027637884202418119121728966267936832338377284832958974299187166554160783467156478554899314000348357280306042140481751668215838656488457943830180819301102535170705017482946779698265096226184239631924271857062033454725540956591929965181603262502135610768915716020374362368495244256420143645126927013882334008435586481691725030031204304273292938132599127402133470745819213047706793887965197191137237066440328777206799072470374264316425913530947082957300047105685634407092811630672103242089966046839626911122.7149)) +SELECT b, p, bc_result, b^p AS power, b^p - bc_result AS diff FROM t; + +-- +-- Tests for EXP() +-- + +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of EXP(): +-- +-- for n in {-20..20} +-- do +-- x="$n.29837" +-- r=$(bc -ql <<< "scale=500 ; e($x)" | head -n 1) +-- echo "($x, $r)," +-- done + +WITH t(x, bc_result) AS (VALUES +/*(-20.29837, .000000001529431101152222), +(-19.29837, .000000004157424770142192), +(-18.29837, .00000001130105220586304), +(-17.29837, .00000003071944485366452), +(-16.29837, .00000008350410872606600), +(-15.29837, .0000002269877013517336), +(-14.29837, .0000006170165438681061), +(-13.29837, .000001677224859055276), +(-12.29837, .000004559169856609741), +(-11.29837, .00001239310857408049), +(-10.29837, .00003368796183504298), + +(-9.29837, .00009157337449401917), +(-8.29837, .0002489222398577673), +(-7.29837, .0006766408013046928), +(-6.29837, .001839300394580514), +(-5.29837, .004999736839665763), +(-4.29837, .01359069379834070), +(-3.29837, .03694333598818056), +(-2.29837, .1004223988993283), +(-1.29837, .2729763820983097),*/ +(0.29837, 1.3476603299656679), +(1.29837, 3.6633205858807959), +(2.29837, 9.9579377804197108), +(3.29837, 27.068481317440698), +(4.29837, 73.579760889182206), +(5.29837, 200.01052696742555), +(6.29837, 543.68498095607070), +(7.29837, 1477.8890041389891), +(8.29837, 4017.3188244304487), +(9.29837, 10920.204759575742), +(10.29837, 29684.194161006717), +(11.29837, 80690.005580314652), +(12.29837, 219338.17590722828), +(13.29837, 596222.97785597218), +(14.29837, 1620702.0864156289), +(15.29837, 4405525.0308492653), +(16.29837, 11975458.636179032), +(17.29837, 32552671.598188404), +(18.29837, 88487335.673150406), +(19.29837, 240533516.60908059), +(20.29837, 653837887.33381570)) +SELECT x, bc_result, exp(x), exp(x)-bc_result AS diff FROM t; + +-- +-- Tests for LN() +-- + +-- input very small +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {1..40} +-- do +-- l=$(bc -ql <<< "scale=500 ; l(10^-$p)" | head -n 1) +-- echo "('1.0e-$p', $l)," +-- done + +WITH t(x, bc_result) AS (VALUES +('1.0e-1', -2.3025850929940457), +('1.0e-2', -4.6051701859880914), +('1.0e-3', -6.9077552789821371), +('1.0e-4', -9.2103403719761827), +('1.0e-5', -11.512925464970228), +('1.0e-6', -13.815510557964274), +('1.0e-7', -16.118095650958320), +('1.0e-8', -18.420680743952365), +('1.0e-9', -20.723265836946411), +('1.0e-10', -23.025850929940457), +('1.0e-11', -25.328436022934503), +('1.0e-12', -27.631021115928548), +('1.0e-13', -29.933606208922594), +('1.0e-14', -32.236191301916640), +('1.0e-15', -34.5387763949106853), +('1.0e-16', -36.84136148790473094), +('1.0e-17', -39.143946580898776628), +('1.0e-18', -41.4465316738928223123), +('1.0e-19', -43.74911676688686799634), +('1.0e-20', -46.051701859880913680360), +('1.0e-21', -48.3542869528749593643778), +('1.0e-22', -50.65687204586900504839581), +('1.0e-23', -52.959457138863050732413803), +('1.0e-24', -55.2620422318570964164317949), +('1.0e-25', -57.56462732485114210044978637), +('1.0e-26', -59.867212417845187784467777822), +('1.0e-27', -62.1697975108392334684857692765), +('1.0e-28', -64.47238260383327915250376073116), +('1.0e-29', -66.774967696827324836521752185847), +('1.0e-30', -69.0775527898213705205397436405309), +('1.0e-31', -71.38013788281541620455773509521529), +('1.0e-32', -73.682722975809461888575726549899655), +('1.0e-33', -75.9853080688035075725937180045840189), +('1.0e-34', -78.28789316179755325661170945926838306), +('1.0e-35', -80.590478254791598940629700913952747266), +('1.0e-36', -82.8930633477856446246476923686371114736), +('1.0e-37', -85.19564844077969030866568382332147568124), +('1.0e-38', -87.498233533773735992683675278005839888842), +('1.0e-39', -89.8008186267677816767016667326902040964430), +('1.0e-40', -92.10340371976182736071965818737456830404406)) +SELECT x, bc_result, ln(x::numeric), ln(x::numeric)-bc_result AS diff FROM t; + +-- input very close to but smaller than 1 +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {1..40} +-- do +-- l=$(bc -ql <<< "scale=500 ; l(1-10^-$p)" | head -n 1) +-- echo "('1.0e-$p', $l)," +-- done + +/* +WITH t(x, bc_result) AS (VALUES +('1.0e-1', -.10536051565782630), +('1.0e-2', -.010050335853501441), +('1.0e-3', -.0010005003335835335), +('1.0e-4', -.00010000500033335834), +('1.0e-5', -.000010000050000333336), +('1.0e-6', -.0000010000005000003333), +('1.0e-7', -.00000010000000500000033), +('1.0e-8', -.000000010000000050000000), +('1.0e-9', -.0000000010000000005000000), +('1.0e-10', -.00000000010000000000500000), +('1.0e-11', -.000000000010000000000050000), +('1.0e-12', -.0000000000010000000000005000), +('1.0e-13', -.00000000000010000000000000500), +('1.0e-14', -.000000000000010000000000000050), +('1.0e-15', -.0000000000000010000000000000005), +('1.0e-16', -.00000000000000010000000000000001), +('1.0e-17', -.000000000000000010000000000000000), +('1.0e-18', -.0000000000000000010000000000000000), +('1.0e-19', -.00000000000000000010000000000000000), +('1.0e-20', -.000000000000000000010000000000000000), +('1.0e-21', -.0000000000000000000010000000000000000), +('1.0e-22', -.00000000000000000000010000000000000000), +('1.0e-23', -.000000000000000000000010000000000000000), +('1.0e-24', -.0000000000000000000000010000000000000000), +('1.0e-25', -.00000000000000000000000010000000000000000), +('1.0e-26', -.000000000000000000000000010000000000000000), +('1.0e-27', -.0000000000000000000000000010000000000000000), +('1.0e-28', -.00000000000000000000000000010000000000000000), +('1.0e-29', -.000000000000000000000000000010000000000000000), +('1.0e-30', -.0000000000000000000000000000010000000000000000), +('1.0e-31', -.00000000000000000000000000000010000000000000000), +('1.0e-32', -.000000000000000000000000000000010000000000000000), +('1.0e-33', -.0000000000000000000000000000000010000000000000000), +('1.0e-34', -.00000000000000000000000000000000010000000000000000), +('1.0e-35', -.000000000000000000000000000000000010000000000000000), +('1.0e-36', -.0000000000000000000000000000000000010000000000000000), +('1.0e-37', -.00000000000000000000000000000000000010000000000000000), +('1.0e-38', -.000000000000000000000000000000000000010000000000000000), +('1.0e-39', -.0000000000000000000000000000000000000010000000000000000), +('1.0e-40', -.00000000000000000000000000000000000000010000000000000000)) +SELECT '1-'||x, bc_result, ln(1.0-x::numeric), ln(1.0-x::numeric)-bc_result AS diff FROM t; +*/ + +-- input very close to but larger than 1 +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {1..40} +-- do +-- l=$(bc -ql <<< "scale=500 ; l(1+10^-$p)" | head -n 1) +-- echo "('1.0e-$p', $l)," +-- done +/* +WITH t(x, bc_result) AS (VALUES +('1.0e-1', .09531017980432486), +('1.0e-2', .009950330853168083), +('1.0e-3', .0009995003330835332), +('1.0e-4', .00009999500033330834), +('1.0e-5', .000009999950000333331), +('1.0e-6', .0000009999995000003333), +('1.0e-7', .00000009999999500000033), +('1.0e-8', .000000009999999950000000), +('1.0e-9', .0000000009999999995000000), +('1.0e-10', .00000000009999999999500000), +('1.0e-11', .000000000009999999999950000), +('1.0e-12', .0000000000009999999999995000), +('1.0e-13', .00000000000009999999999999500), +('1.0e-14', .000000000000009999999999999950), +('1.0e-15', .0000000000000009999999999999995), +('1.0e-16', .00000000000000010000000000000000), +('1.0e-17', .000000000000000010000000000000000), +('1.0e-18', .0000000000000000010000000000000000), +('1.0e-19', .00000000000000000010000000000000000), +('1.0e-20', .000000000000000000010000000000000000), +('1.0e-21', .0000000000000000000010000000000000000), +('1.0e-22', .00000000000000000000010000000000000000), +('1.0e-23', .000000000000000000000010000000000000000), +('1.0e-24', .0000000000000000000000010000000000000000), +('1.0e-25', .00000000000000000000000010000000000000000), +('1.0e-26', .000000000000000000000000010000000000000000), +('1.0e-27', .0000000000000000000000000010000000000000000), +('1.0e-28', .00000000000000000000000000010000000000000000), +('1.0e-29', .000000000000000000000000000010000000000000000), +('1.0e-30', .0000000000000000000000000000010000000000000000), +('1.0e-31', .00000000000000000000000000000010000000000000000), +('1.0e-32', .000000000000000000000000000000010000000000000000), +('1.0e-33', .0000000000000000000000000000000010000000000000000), +('1.0e-34', .00000000000000000000000000000000010000000000000000), +('1.0e-35', .000000000000000000000000000000000010000000000000000), +('1.0e-36', .0000000000000000000000000000000000010000000000000000), +('1.0e-37', .00000000000000000000000000000000000010000000000000000), +('1.0e-38', .000000000000000000000000000000000000010000000000000000), +('1.0e-39', .0000000000000000000000000000000000000010000000000000000), +('1.0e-40', .00000000000000000000000000000000000000010000000000000000)) +SELECT '1+'||x, bc_result, ln(1.0+x::numeric), ln(1.0+x::numeric)-bc_result AS diff FROM t; +*/ +-- input very large +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {1..40} +-- do +-- l=$(bc -ql <<< "scale=500 ; l(10^$p)" | head -n 1) +-- echo "('1.0e$p', $l)," +-- done + +WITH t(x, bc_result) AS (VALUES +('1.0e1', 2.3025850929940457), +('1.0e2', 4.6051701859880914), +('1.0e3', 6.9077552789821371), +('1.0e4', 9.2103403719761827), +('1.0e5', 11.512925464970228), +('1.0e6', 13.815510557964274), +('1.0e7', 16.118095650958320), +('1.0e8', 18.420680743952365), +('1.0e9', 20.723265836946411), +('1.0e10', 23.025850929940457), +('1.0e11', 25.328436022934503), +('1.0e12', 27.631021115928548), +('1.0e13', 29.933606208922594), +('1.0e14', 32.236191301916640), +('1.0e15', 34.538776394910685), +('1.0e16', 36.841361487904731), +('1.0e17', 39.143946580898777), +('1.0e18', 41.446531673892822), +('1.0e19', 43.749116766886868), +('1.0e20', 46.051701859880914), +('1.0e21', 48.354286952874959), +('1.0e22', 50.656872045869005), +('1.0e23', 52.959457138863051), +('1.0e24', 55.262042231857096), +('1.0e25', 57.564627324851142), +('1.0e26', 59.867212417845188), +('1.0e27', 62.169797510839233), +('1.0e28', 64.472382603833279), +('1.0e29', 66.774967696827325), +('1.0e30', 69.077552789821371), +('1.0e31', 71.380137882815416), +('1.0e32', 73.682722975809462), +('1.0e33', 75.985308068803508), +('1.0e34', 78.287893161797553), +('1.0e35', 80.590478254791599), +('1.0e36', 82.893063347785645), +('1.0e37', 85.195648440779690), +('1.0e38', 87.498233533773736), +('1.0e39', 89.800818626767782), +('1.0e40', 92.103403719761827)) +SELECT x, bc_result, ln(x::numeric), ln(x::numeric)-bc_result AS diff FROM t; + +-- input huge +-- +-- bc(1) results computed with a scale of 1000 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {1..10} +-- do +-- l=$(bc -ql <<< "scale=1000 ; l(10^${p}00)" | head -n 1) +-- echo "('1.0e${p}00', $l)," +-- done + +WITH t(x, bc_result) AS (VALUES +('1.0e100', 230.25850929940457), +('1.0e200', 460.51701859880914), +('1.0e300', 690.77552789821371), +('1.0e400', 921.03403719761827), +('1.0e500', 1151.2925464970228), +('1.0e600', 1381.5510557964274), +('1.0e700', 1611.8095650958320), +('1.0e800', 1842.0680743952365), +('1.0e900', 2072.3265836946411), +('1.0e1000', 2302.5850929940457)) +SELECT x, bc_result, ln(x::numeric), ln(x::numeric)-bc_result AS diff FROM t; + +-- inputs with 1000 decimal places +-- +-- bc(1) results computed with a scale of 2000 and rounded to 1000 decimal +-- places + +WITH t(x, bc_result) AS (VALUES +(484990182159328900690402236933516249572671683638747490717351807610531884491845416923860371219625151551889257298200816555016472471293780254009492949585031653913930735918829139712249577547959394351523545901788627247613322896296041868431769047433229466634098452564756860190085118463828382895145244362033728480588969626012192733802377468089120757046364393407262957242230928854711898925295251902007136232994524624903257456111389508582206404271734668422903183500589303866613158037169610592539145461637447957948521714058034772237111009429638870236361143304703683377693378577075353794118557951847394763531830696578809001981568860219578880229402696449243344235099860421846016326538272155937175661905904288335499593232232926636205909086901191153907183842087577811871344870731324067822883041265129394268082883745408414994.8967939438561591657171240282983703914075472645212002662497023142663831371447287624846942598424990784971781730103682951722370983277124599054059027055336437808366784501932987082321905202623642371063626378290734289114618092750984153422293450048717769065428713836637664433167768445609659527458911187829232316677137895259433038764404970599325009178297626038331436654541552998098529141205301472138026818453893127265938030066392881979113522757891639646670670272542401773230506961559808927249585675430838495658225557294666522469887436551840596777627408780618586500922973500018513068499587683746133637919751545157547095670767246977244726331271787622126889459658539988980096764323712767863722912919120929339399753431689512753214200090670880647731689804555417871258907716687575767185444541243606329768784843125926070743277339790277626515824924290352180761378846035233155198504033292692893297993698953705472933411199778880561376633444249703838589180474329586470353212010427945060694794274109764269805332803290229, + 1864.3702986939570026328504202935192533137907736189919154633800554877738455118081651650863235106905871352085850240570561347180517240105510505203972860921397909573687877993477806728098306202020229409548306695695574102950949468160529713610952021974630774784174851619325758380143625473386495586347322798415543385655090746985183329114860118551572428921774322172798724455202876781611633419444058398798142214904998877857425038669920064728855823072107227506485770367799671977282350083029452784747350395161797215115525867416898416360638482342253129160308632504217096916335590470843180746834864303790913372081974355613359678634194879425862536147988835528973291020680020540866655622823550861337486588647231688134992810403147262346312159819432914207194632564009749236609081399504118359354620598232725290537215007867979331582119891661859015726276335168158288396939655310210558566592649049602925182137256134162660116182293851038854455437841571331011002023088829768308520393956515509475418031437505751407687618234418262), +(87190145885430429849953615409019208993240447426362428988181639909267773304254748257120061524000254226856815085523676417146197197996896030672521334101413071112068202429835905642444187493717977611730127126387257253646790849384975208460867137315507010888782632024640844766297185244443116696943912406389670302370461137850160539373600494054874979342373255280815156048999900951842673141766630630919020492255966628630634124452614590400422133958133100159154995520080124736657520969784129924799670552560034302960877087853678350801769339861812435411200669026902417951572668727488315537985378304242438181615160041688723201917323705450185975141141262578884689500612295576288125956289035673242989906973367691922065122033180281670221390667818909912035903387888639331486823729897326624516015340.0330856710565117793999512551468220085711713631167607285185762046751452975325645379302403715842570486302993296501788672462090620871511446272026693318239212657949496275318383141403236705902077406660768573015707706831878445598837931116223956945944726162551477136715847593742032488181481888084716920605114101902724395659898621880016853548602514706686907951229872573180602614761229992106144727082722940736406782659562775289407005631298246624198606031298081220736931229256511054595028182057216042683060059115371651410352645266000330509331097811566633211452233019461903115970558624057877018778178814946285827512359903934291318219271464841957435711594154280905473802599888081783098187210283997106131616471807951265003903143099667366508222327805543948921694362089860577380749774036318574113007382111997454202845559941557812813566442364810680529092880773126707073967537693927177460459341763934709686530005721141046645111784404932103241501569571235364365556796422998363930810983452790309019295181282099408260156, + 1793.5767085750017553306932533574391150814202249805881581227430032600579405884415934520704053351781361105595296647510475380766428668443641914861849764330704062323054023252886955844207807229267936432730818329225450152491146839618683772020068682795388746108876393249306737841247788224204701299467519965182171772253974884845661168860422489046657965359832930382114760565628765599962013955588754803194908990025689040598990346417563277021386852342928910383706995866844541160576254266641602065102228267316550706943783591722246885978355472097314691737807509436806788803362444745551013400341861820755594413819894154786253014501454443272120342005711761286524843010157182464200556865694401941794983935172457481497909987740544409272349152397774548604845897687504977786762391359552407068124283290504752932824699865504970420939586707791994870941813718246825616335675307740641350673558328821461530563823677144691877374809441673507467507447891562257806191361453045937798278733402269265623588493124129181374135958668436774), +(93936642222690597390233191619858485419795942047468396309991947772747208870873993801669373075421461116465960407843923269693395211616591453397070258466704654943689268224479477016161636938138334729982904232438440955361656138189836032891825113139184685132178764873033678116450665758561650355252211196676137179184043639278410827092182700922151290703747496962700158844772453483316974221113826173404445159281421213715669245417896170368554410830320000019029956317336703559699859949692222685614036912057150632902650913831404804982509990655560731349634628713944739168096272097122388116038119844786988276635032016787352796502360718569977397214936366251320294621522016.6483354941025384161536675750898007896744690911429670830432784905421638721478353275821072200938900938046264210604940707974410950770029535636602548377806284157951164875821446035013896786653932045182167021839184824627082391478016195098055107001433336586881395912782883663046617432598969149948351689103230162742769845955320418573803127107923535948653168889411316007796459064267436246637115946581149511513369842911210359447262641996566147462977170742544980481275049898092152042927981394239266559286915303786701737610786594006685748456635797125029722684151298695274097006242412384086302106763844070230264910503179385988626477852818174114043927841085089058972074427820150462261941575665882880501074676800316585217150509780489224388148722603385921057007086785238310735038314861960410473809826927329368597558806004392175746233568789445929554890241140656324160187253042639339549705859147930476532359840809944163908006480881926041259363654863689570520534301207043189181147254153307163555433328278834311658232337, + 1510.4332713542154696529645934345554302578243896764921637693542962119938599884313210100957753316832762996428481801312323020427109678979117469716796746760060470871840325255146954580681101106876674367471955788143763250819168311353856748872452260808797135108102729064040463343792765872545182299889360257515315869180266759715933989413256377582681707188367254513700731642913479683031478361835565783219287780434673712341147656477670848734998849030451414278832848680301511646182446524915091598080243532068451726548537866633622180283865668708517173065893429240665300584705585310049892047293928733753369421499719516009692095913169665213597158441636480707309244604139865130782756488091268094213446272360006907802989573582755585110277620911226015342778471352130366770729972784317323917141031824334355639769512749560550167491709646539950725523461943580211843652293561678342656010571108219244870234329176123205423872844099992204896411752620881541000940129833754169391528449211839693800724450201835161044717173715867437)) +SELECT trim_scale(ln(x::numeric)-bc_result) AS diff FROM t; + +-- +-- Tests for LOG() (base 10) +-- + +-- input very small, exact result known +WITH t(x) AS (SELECT '1e-'||n FROM generate_series(1, 100) g(n)) +SELECT x, log(x::numeric) FROM t; + +-- input very small, non-exact results +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {1..50..7} +-- do +-- for d in {9..1..3} +-- do +-- l=$(bc -ql <<< "scale=500 ; l($d*10^-$p) / l(10)" | head -n 1) +-- echo "('${d}.0e-$p', $l)," +-- done +-- done + +WITH t(x, bc_result) AS (VALUES +--('9.0e-1', -.04575749056067513), +--('6.0e-1', -.2218487496163564), +--('3.0e-1', -.5228787452803376), +('9.0e-8', -7.045757490560675), +('6.0e-8', -7.221848749616356), +('3.0e-8', -7.522878745280338), +('9.0e-15', -14.0457574905606751), +('6.0e-15', -14.2218487496163564), +('3.0e-15', -14.5228787452803376), +('9.0e-22', -21.04575749056067512540994), +('6.0e-22', -21.22184874961635636749123), +('3.0e-22', -21.52287874528033756270497), +('9.0e-29', -28.045757490560675125409944193490), +('6.0e-29', -28.221848749616356367491233202020), +('3.0e-29', -28.522878745280337562704972096745), +('9.0e-36', -35.0457574905606751254099441934897693816), +('6.0e-36', -35.2218487496163563674912332020203916640), +('3.0e-36', -35.5228787452803375627049720967448846908), +('9.0e-43', -42.04575749056067512540994419348976938159974227), +('6.0e-43', -42.22184874961635636749123320202039166403168125), +('3.0e-43', -42.52287874528033756270497209674488469079987114), +('9.0e-50', -49.045757490560675125409944193489769381599742271618608), +('6.0e-50', -49.221848749616356367491233202020391664031681254347196), +('3.0e-50', -49.522878745280337562704972096744884690799871135809304)) +SELECT x, bc_result, log(x::numeric), log(x::numeric)-bc_result AS diff FROM t; + +-- input very close to but smaller than 1 +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {1..40..7} +-- do +-- for d in {9..1..3} +-- do +-- l=$(bc -ql <<< "scale=500 ; l(1-$d*10^-$p) / l(10)" | head -n 1) +-- echo "('${d}.0e-$p', $l)," +-- done +-- done + /* +WITH t(x, bc_result) AS (VALUES +('9.0e-1', -1.0000000000000000), +('6.0e-1', -.3979400086720376), +('3.0e-1', -.1549019599857432), +('9.0e-8', -.000000039086505130185422), +('6.0e-8', -.000000026057669695925208), +('3.0e-8', -.000000013028834652530076), +('9.0e-15', -.0000000000000039086503371292840), +('6.0e-15', -.0000000000000026057668914195188), +('3.0e-15', -.0000000000000013028834457097574), +('9.0e-22', -.00000000000000000000039086503371292664), +('6.0e-22', -.00000000000000000000026057668914195110), +('3.0e-22', -.00000000000000000000013028834457097555), +('9.0e-29', -.000000000000000000000000000039086503371292664), +('6.0e-29', -.000000000000000000000000000026057668914195110), +('3.0e-29', -.000000000000000000000000000013028834457097555), +('9.0e-36', -.0000000000000000000000000000000000039086503371292664), +('6.0e-36', -.0000000000000000000000000000000000026057668914195110), +('3.0e-36', -.0000000000000000000000000000000000013028834457097555)) +SELECT '1-'||x, bc_result, log(1.0-x::numeric), log(1.0-x::numeric)-bc_result AS diff FROM t; +*/ +-- input very close to but larger than 1 +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {1..40..7} +-- do +-- for d in {9..1..3} +-- do +-- l=$(bc -ql <<< "scale=500 ; l(1+$d*10^-$p) / l(10)" | head -n 1) +-- echo "('${d}.0e-$p', $l)," +-- done +-- done +/* +WITH t(x, bc_result) AS (VALUES +('9.0e-1', .2787536009528290), +('6.0e-1', .2041199826559248), +('3.0e-1', .1139433523068368), +('9.0e-8', .000000039086501612400118), +('6.0e-8', .000000026057668132465074), +('3.0e-8', .000000013028834261665042), +('9.0e-15', .0000000000000039086503371292489), +('6.0e-15', .0000000000000026057668914195031), +('3.0e-15', .0000000000000013028834457097535), +('9.0e-22', .00000000000000000000039086503371292664), +('6.0e-22', .00000000000000000000026057668914195110), +('3.0e-22', .00000000000000000000013028834457097555), +('9.0e-29', .000000000000000000000000000039086503371292664), +('6.0e-29', .000000000000000000000000000026057668914195110), +('3.0e-29', .000000000000000000000000000013028834457097555), +('9.0e-36', .0000000000000000000000000000000000039086503371292664), +('6.0e-36', .0000000000000000000000000000000000026057668914195110), +('3.0e-36', .0000000000000000000000000000000000013028834457097555)) +SELECT '1+'||x, bc_result, log(1.0+x::numeric), log(1.0+x::numeric)-bc_result AS diff FROM t; +*/ +-- input very large, exact result known +WITH t(x) AS (SELECT '1e'||n FROM generate_series(1, 100) g(n)) +SELECT x, log(x::numeric) FROM t; + +-- input very large, non-exact results +-- +-- bc(1) results computed with a scale of 500 and truncated using the script +-- below, and then rounded by hand to match the precision of LN(): +-- +-- for p in {10..50..7} +-- do +-- for d in {2..9..3} +-- do +-- l=$(bc -ql <<< "scale=500 ; l($d*10^$p) / l(10)" | head -n 1) +-- echo "('${d}.0e$p', $l)," +-- done +-- done + +WITH t(x, bc_result) AS (VALUES +('2.0e10', 10.301029995663981), +('5.0e10', 10.698970004336019), +('8.0e10', 10.903089986991944), +('2.0e17', 17.301029995663981), +('5.0e17', 17.698970004336019), +('8.0e17', 17.903089986991944), +('2.0e24', 24.301029995663981), +('5.0e24', 24.698970004336019), +('8.0e24', 24.903089986991944), +('2.0e31', 31.301029995663981), +('5.0e31', 31.698970004336019), +('8.0e31', 31.903089986991944), +('2.0e38', 38.301029995663981), +('5.0e38', 38.698970004336019), +('8.0e38', 38.903089986991944), +('2.0e45', 45.30102999566398), +('5.0e45', 45.69897000433602), +('8.0e45', 45.90308998699194)) +SELECT x, bc_result, log(x::numeric), log(x::numeric)-bc_result AS diff FROM t; diff --git a/postgresql/examples/numerology.sql b/postgresql/examples/numerology.sql new file mode 100644 index 0000000..980d0d7 --- /dev/null +++ b/postgresql/examples/numerology.sql @@ -0,0 +1,98 @@ +-- +-- NUMEROLOGY +-- Test various combinations of numeric types and functions. +-- + +-- +-- Test implicit type conversions +-- This fails for Postgres v6.1 (and earlier?) +-- so let's try explicit conversions for now - tgl 97/05/07 +-- + +CREATE TABLE TEMP_FLOAT (f1 FLOAT8); + +INSERT INTO TEMP_FLOAT (f1) + SELECT float8(f1) FROM INT4_TBL; + +INSERT INTO TEMP_FLOAT (f1) + SELECT float8(f1) FROM INT2_TBL; + +SELECT '' AS ten, f1 FROM TEMP_FLOAT + ORDER BY f1; + +-- int4 + +CREATE TABLE TEMP_INT4 (f1 INT4); + +INSERT INTO TEMP_INT4 (f1) + SELECT int4(f1) FROM FLOAT8_TBL + WHERE (f1 > -2147483647) AND (f1 < 2147483647); + +INSERT INTO TEMP_INT4 (f1) + SELECT int4(f1) FROM INT2_TBL; + +SELECT '' AS nine, f1 FROM TEMP_INT4 + ORDER BY f1; + +-- int2 + +CREATE TABLE TEMP_INT2 (f1 INT2); + +INSERT INTO TEMP_INT2 (f1) + SELECT int2(f1) FROM FLOAT8_TBL + WHERE (f1 >= -32767) AND (f1 <= 32767); + +INSERT INTO TEMP_INT2 (f1) + SELECT int2(f1) FROM INT4_TBL + WHERE (f1 >= -32767) AND (f1 <= 32767); + +SELECT '' AS five, f1 FROM TEMP_INT2 + ORDER BY f1; + +-- +-- Group-by combinations +-- + +CREATE TABLE TEMP_GROUP (f1 INT4, f2 INT4, f3 FLOAT8); + +INSERT INTO TEMP_GROUP + SELECT 1, (- i.f1), (- f.f1) + FROM INT4_TBL i, FLOAT8_TBL f; + +INSERT INTO TEMP_GROUP + SELECT 2, i.f1, f.f1 + FROM INT4_TBL i, FLOAT8_TBL f; + +SELECT DISTINCT f1 AS two FROM TEMP_GROUP ORDER BY 1; + +SELECT f1 AS two, max(f3) AS max_float, min(f3) as min_float + FROM TEMP_GROUP + GROUP BY f1 + ORDER BY two, max_float, min_float; + +-- GROUP BY a result column name is not legal per SQL92, but we accept it +-- anyway (if the name is not the name of any column exposed by FROM). +SELECT f1 AS two, max(f3) AS max_float, min(f3) AS min_float + FROM TEMP_GROUP + GROUP BY two + ORDER BY two, max_float, min_float; + +SELECT f1 AS two, (max(f3) + 1) AS max_plus_1, (min(f3) - 1) AS min_minus_1 + FROM TEMP_GROUP + GROUP BY f1 + ORDER BY two, min_minus_1; + +SELECT f1 AS two, + max(f2) + min(f2) AS max_plus_min, + min(f3) - 1 AS min_minus_1 + FROM TEMP_GROUP + GROUP BY f1 + ORDER BY two, min_minus_1; + +DROP TABLE TEMP_INT2; + +DROP TABLE TEMP_INT4; + +DROP TABLE TEMP_FLOAT; + +DROP TABLE TEMP_GROUP; diff --git a/postgresql/examples/object_address.sql b/postgresql/examples/object_address.sql new file mode 100644 index 0000000..2f4f66e --- /dev/null +++ b/postgresql/examples/object_address.sql @@ -0,0 +1,287 @@ +-- +-- Test for pg_get_object_address +-- + +-- Clean up in case a prior regression run failed +SET client_min_messages TO 'warning'; +DROP ROLE IF EXISTS regress_addr_user; +RESET client_min_messages; + +CREATE USER regress_addr_user; + +-- Test generic object addressing/identification functions +CREATE SCHEMA addr_nsp; +SET search_path TO 'addr_nsp'; +CREATE FOREIGN DATA WRAPPER addr_fdw; +CREATE SERVER addr_fserv FOREIGN DATA WRAPPER addr_fdw; +CREATE TEXT SEARCH DICTIONARY addr_ts_dict (template=simple); +CREATE TEXT SEARCH CONFIGURATION addr_ts_conf (copy=english); +CREATE TEXT SEARCH TEMPLATE addr_ts_temp (lexize=dsimple_lexize); +CREATE TEXT SEARCH PARSER addr_ts_prs + (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype); +CREATE TABLE addr_nsp.gentable ( + a serial primary key CONSTRAINT a_chk CHECK (a > 0), + b text DEFAULT 'hello'); +CREATE TABLE addr_nsp.parttable ( + a int PRIMARY KEY +) PARTITION BY RANGE (a); +CREATE VIEW addr_nsp.genview AS SELECT * from addr_nsp.gentable; +CREATE MATERIALIZED VIEW addr_nsp.genmatview AS SELECT * FROM addr_nsp.gentable; +CREATE TYPE addr_nsp.gencomptype AS (a int); +CREATE TYPE addr_nsp.genenum AS ENUM ('one', 'two'); +CREATE FOREIGN TABLE addr_nsp.genftable (a int) SERVER addr_fserv; +CREATE AGGREGATE addr_nsp.genaggr(int4) (sfunc = int4pl, stype = int4); +CREATE DOMAIN addr_nsp.gendomain AS int4 CONSTRAINT domconstr CHECK (value > 0); +CREATE FUNCTION addr_nsp.trig() RETURNS TRIGGER LANGUAGE plpgsql AS $$ BEGIN END; $$; +CREATE TRIGGER t BEFORE INSERT ON addr_nsp.gentable FOR EACH ROW EXECUTE PROCEDURE addr_nsp.trig(); +CREATE POLICY genpol ON addr_nsp.gentable; +CREATE PROCEDURE addr_nsp.proc(int4) LANGUAGE SQL AS $$ $$; +CREATE SERVER "integer" FOREIGN DATA WRAPPER addr_fdw; +CREATE USER MAPPING FOR regress_addr_user SERVER "integer"; +ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user IN SCHEMA public GRANT ALL ON TABLES TO regress_addr_user; +ALTER DEFAULT PRIVILEGES FOR ROLE regress_addr_user REVOKE DELETE ON TABLES FROM regress_addr_user; +-- this transform would be quite unsafe to leave lying around, +-- except that the SQL language pays no attention to transforms: +CREATE TRANSFORM FOR int LANGUAGE SQL ( + FROM SQL WITH FUNCTION prsd_lextype(internal), + TO SQL WITH FUNCTION int4recv(internal)); +-- suppress warning that depends on wal_level +SET client_min_messages = 'ERROR'; +CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable; +RESET client_min_messages; +CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE); +CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable; + +-- test some error cases +SELECT pg_get_object_address('stone', '{}', '{}'); +SELECT pg_get_object_address('table', '{}', '{}'); +SELECT pg_get_object_address('table', '{NULL}', '{}'); + +-- unrecognized object types +DO $$ +DECLARE + objtype text; +BEGIN + FOR objtype IN VALUES ('toast table'), ('index column'), ('sequence column'), + ('toast table column'), ('view column'), ('materialized view column') + LOOP + BEGIN + PERFORM pg_get_object_address(objtype, '{one}', '{}'); + EXCEPTION WHEN invalid_parameter_value THEN + RAISE WARNING 'error for %: %', objtype, sqlerrm; + END; + END LOOP; +END; +$$; + +-- miscellaneous other errors +select * from pg_get_object_address('operator of access method', '{btree,integer_ops,1}', '{int4,bool}'); +select * from pg_get_object_address('operator of access method', '{btree,integer_ops,99}', '{int4,int4}'); +select * from pg_get_object_address('function of access method', '{btree,integer_ops,1}', '{int4,bool}'); +select * from pg_get_object_address('function of access method', '{btree,integer_ops,99}', '{int4,int4}'); + +DO $$ +DECLARE + objtype text; + names text[]; + args text[]; +BEGIN + FOR objtype IN VALUES + ('table'), ('index'), ('sequence'), ('view'), + ('materialized view'), ('foreign table'), + ('table column'), ('foreign table column'), + ('aggregate'), ('function'), ('procedure'), ('type'), ('cast'), + ('table constraint'), ('domain constraint'), ('conversion'), ('default value'), + ('operator'), ('operator class'), ('operator family'), ('rule'), ('trigger'), + ('text search parser'), ('text search dictionary'), + ('text search template'), ('text search configuration'), + ('policy'), ('user mapping'), ('default acl'), ('transform'), + ('operator of access method'), ('function of access method'), + ('publication relation') + LOOP + FOR names IN VALUES ('{eins}'), ('{addr_nsp, zwei}'), ('{eins, zwei, drei}') + LOOP + FOR args IN VALUES ('{}'), ('{integer}') + LOOP + BEGIN + PERFORM pg_get_object_address(objtype, names, args); + EXCEPTION WHEN OTHERS THEN + RAISE WARNING 'error for %,%,%: %', objtype, names, args, sqlerrm; + END; + END LOOP; + END LOOP; + END LOOP; +END; +$$; + +-- these object types cannot be qualified names +SELECT pg_get_object_address('language', '{one}', '{}'); +SELECT pg_get_object_address('language', '{one,two}', '{}'); +SELECT pg_get_object_address('large object', '{123}', '{}'); +SELECT pg_get_object_address('large object', '{123,456}', '{}'); +SELECT pg_get_object_address('large object', '{blargh}', '{}'); +SELECT pg_get_object_address('schema', '{one}', '{}'); +SELECT pg_get_object_address('schema', '{one,two}', '{}'); +SELECT pg_get_object_address('role', '{one}', '{}'); +SELECT pg_get_object_address('role', '{one,two}', '{}'); +SELECT pg_get_object_address('database', '{one}', '{}'); +SELECT pg_get_object_address('database', '{one,two}', '{}'); +SELECT pg_get_object_address('tablespace', '{one}', '{}'); +SELECT pg_get_object_address('tablespace', '{one,two}', '{}'); +SELECT pg_get_object_address('foreign-data wrapper', '{one}', '{}'); +SELECT pg_get_object_address('foreign-data wrapper', '{one,two}', '{}'); +SELECT pg_get_object_address('server', '{one}', '{}'); +SELECT pg_get_object_address('server', '{one,two}', '{}'); +SELECT pg_get_object_address('extension', '{one}', '{}'); +SELECT pg_get_object_address('extension', '{one,two}', '{}'); +SELECT pg_get_object_address('event trigger', '{one}', '{}'); +SELECT pg_get_object_address('event trigger', '{one,two}', '{}'); +SELECT pg_get_object_address('access method', '{one}', '{}'); +SELECT pg_get_object_address('access method', '{one,two}', '{}'); +SELECT pg_get_object_address('publication', '{one}', '{}'); +SELECT pg_get_object_address('publication', '{one,two}', '{}'); +SELECT pg_get_object_address('subscription', '{one}', '{}'); +SELECT pg_get_object_address('subscription', '{one,two}', '{}'); + +-- test successful cases +WITH objects (type, name, args) AS (VALUES + ('table', '{addr_nsp, gentable}'::text[], '{}'::text[]), + ('table', '{addr_nsp, parttable}'::text[], '{}'::text[]), + ('index', '{addr_nsp, gentable_pkey}', '{}'), + ('index', '{addr_nsp, parttable_pkey}', '{}'), + ('sequence', '{addr_nsp, gentable_a_seq}', '{}'), + -- toast table + ('view', '{addr_nsp, genview}', '{}'), + ('materialized view', '{addr_nsp, genmatview}', '{}'), + ('foreign table', '{addr_nsp, genftable}', '{}'), + ('table column', '{addr_nsp, gentable, b}', '{}'), + ('foreign table column', '{addr_nsp, genftable, a}', '{}'), + ('aggregate', '{addr_nsp, genaggr}', '{int4}'), + ('function', '{pg_catalog, pg_identify_object}', '{pg_catalog.oid, pg_catalog.oid, int4}'), + ('procedure', '{addr_nsp, proc}', '{int4}'), + ('type', '{pg_catalog._int4}', '{}'), + ('type', '{addr_nsp.gendomain}', '{}'), + ('type', '{addr_nsp.gencomptype}', '{}'), + ('type', '{addr_nsp.genenum}', '{}'), + ('cast', '{int8}', '{int4}'), + ('collation', '{default}', '{}'), + ('table constraint', '{addr_nsp, gentable, a_chk}', '{}'), + ('domain constraint', '{addr_nsp.gendomain}', '{domconstr}'), + ('conversion', '{pg_catalog, koi8_r_to_mic}', '{}'), + ('default value', '{addr_nsp, gentable, b}', '{}'), + ('language', '{plpgsql}', '{}'), + -- large object + ('operator', '{+}', '{int4, int4}'), + ('operator class', '{btree, int4_ops}', '{}'), + ('operator family', '{btree, integer_ops}', '{}'), + ('operator of access method', '{btree,integer_ops,1}', '{integer,integer}'), + ('function of access method', '{btree,integer_ops,2}', '{integer,integer}'), + ('rule', '{addr_nsp, genview, _RETURN}', '{}'), + ('trigger', '{addr_nsp, gentable, t}', '{}'), + ('schema', '{addr_nsp}', '{}'), + ('text search parser', '{addr_ts_prs}', '{}'), + ('text search dictionary', '{addr_ts_dict}', '{}'), + ('text search template', '{addr_ts_temp}', '{}'), + ('text search configuration', '{addr_ts_conf}', '{}'), + ('role', '{regress_addr_user}', '{}'), + -- database + -- tablespace + ('foreign-data wrapper', '{addr_fdw}', '{}'), + ('server', '{addr_fserv}', '{}'), + ('user mapping', '{regress_addr_user}', '{integer}'), + ('default acl', '{regress_addr_user,public}', '{r}'), + ('default acl', '{regress_addr_user}', '{r}'), + -- extension + -- event trigger + ('policy', '{addr_nsp, gentable, genpol}', '{}'), + ('transform', '{int}', '{sql}'), + ('access method', '{btree}', '{}'), + ('publication', '{addr_pub}', '{}'), + ('publication relation', '{addr_nsp, gentable}', '{addr_pub}'), + ('subscription', '{regress_addr_sub}', '{}'), + ('statistics object', '{addr_nsp, gentable_stat}', '{}') + ) +SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*, + -- test roundtrip through pg_identify_object_as_address + ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)) = + ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.objsubid)) + FROM objects, pg_get_object_address(type, name, args) addr1, + pg_identify_object_as_address(classid, objid, objsubid) ioa(typ,nms,args), + pg_get_object_address(typ, nms, ioa.args) as addr2 + ORDER BY addr1.classid, addr1.objid, addr1.objsubid; + +--- +--- Cleanup resources +--- +DROP FOREIGN DATA WRAPPER addr_fdw CASCADE; +DROP PUBLICATION addr_pub; +DROP SUBSCRIPTION regress_addr_sub; + +DROP SCHEMA addr_nsp CASCADE; + +DROP OWNED BY regress_addr_user; +DROP USER regress_addr_user; + +-- +-- Checks for invalid objects +-- +-- Make sure that NULL handling is correct. +\pset null 'NULL' +-- Temporarily disable fancy output, so as future additions never create +-- a large amount of diffs. +\a\t + +-- Keep this list in the same order as getObjectIdentityParts() +-- in objectaddress.c. +WITH objects (classid, objid, objsubid) AS (VALUES + ('pg_class'::regclass, 0, 0), -- no relation + ('pg_class'::regclass, 'pg_class'::regclass, 100), -- no column for relation + ('pg_proc'::regclass, 0, 0), -- no function + ('pg_type'::regclass, 0, 0), -- no type + ('pg_cast'::regclass, 0, 0), -- no cast + ('pg_collation'::regclass, 0, 0), -- no collation + ('pg_constraint'::regclass, 0, 0), -- no constraint + ('pg_conversion'::regclass, 0, 0), -- no conversion + ('pg_attrdef'::regclass, 0, 0), -- no default attribute + ('pg_language'::regclass, 0, 0), -- no language + ('pg_largeobject'::regclass, 0, 0), -- no large object, no error + ('pg_operator'::regclass, 0, 0), -- no operator + ('pg_opclass'::regclass, 0, 0), -- no opclass, no need to check for no access method + ('pg_opfamily'::regclass, 0, 0), -- no opfamily + ('pg_am'::regclass, 0, 0), -- no access method + ('pg_amop'::regclass, 0, 0), -- no AM operator + ('pg_amproc'::regclass, 0, 0), -- no AM proc + ('pg_rewrite'::regclass, 0, 0), -- no rewrite + ('pg_trigger'::regclass, 0, 0), -- no trigger + ('pg_namespace'::regclass, 0, 0), -- no schema + ('pg_statistic_ext'::regclass, 0, 0), -- no statistics + ('pg_ts_parser'::regclass, 0, 0), -- no TS parser + ('pg_ts_dict'::regclass, 0, 0), -- no TS dictionnary + ('pg_ts_template'::regclass, 0, 0), -- no TS template + ('pg_ts_config'::regclass, 0, 0), -- no TS configuration + ('pg_authid'::regclass, 0, 0), -- no role + ('pg_database'::regclass, 0, 0), -- no database + ('pg_tablespace'::regclass, 0, 0), -- no tablespace + ('pg_foreign_data_wrapper'::regclass, 0, 0), -- no FDW + ('pg_foreign_server'::regclass, 0, 0), -- no server + ('pg_user_mapping'::regclass, 0, 0), -- no user mapping + ('pg_default_acl'::regclass, 0, 0), -- no default ACL + ('pg_extension'::regclass, 0, 0), -- no extension + ('pg_event_trigger'::regclass, 0, 0), -- no event trigger + ('pg_policy'::regclass, 0, 0), -- no policy + ('pg_publication'::regclass, 0, 0), -- no publication + ('pg_publication_rel'::regclass, 0, 0), -- no publication relation + ('pg_subscription'::regclass, 0, 0), -- no subscription + ('pg_transform'::regclass, 0, 0) -- no transformation + ) +SELECT ROW(pg_identify_object(objects.classid, objects.objid, objects.objsubid)) + AS ident, + ROW(pg_identify_object_as_address(objects.classid, objects.objid, objects.objsubid)) + AS addr, + pg_describe_object(objects.classid, objects.objid, objects.objsubid) + AS descr +FROM objects +ORDER BY objects.classid, objects.objid, objects.objsubid; + +-- restore normal output mode +\a\t diff --git a/postgresql/examples/oid.sql b/postgresql/examples/oid.sql new file mode 100644 index 0000000..4a09689 --- /dev/null +++ b/postgresql/examples/oid.sql @@ -0,0 +1,43 @@ +-- +-- OID +-- + +CREATE TABLE OID_TBL(f1 oid); + +INSERT INTO OID_TBL(f1) VALUES ('1234'); +INSERT INTO OID_TBL(f1) VALUES ('1235'); +INSERT INTO OID_TBL(f1) VALUES ('987'); +INSERT INTO OID_TBL(f1) VALUES ('-1040'); +INSERT INTO OID_TBL(f1) VALUES ('99999999'); +INSERT INTO OID_TBL(f1) VALUES ('5 '); +INSERT INTO OID_TBL(f1) VALUES (' 10 '); +-- leading/trailing hard tab is also allowed +INSERT INTO OID_TBL(f1) VALUES (' 15 '); + +-- bad inputs +INSERT INTO OID_TBL(f1) VALUES (''); +INSERT INTO OID_TBL(f1) VALUES (' '); +INSERT INTO OID_TBL(f1) VALUES ('asdfasd'); +INSERT INTO OID_TBL(f1) VALUES ('99asdfasd'); +INSERT INTO OID_TBL(f1) VALUES ('5 d'); +INSERT INTO OID_TBL(f1) VALUES (' 5d'); +INSERT INTO OID_TBL(f1) VALUES ('5 5'); +INSERT INTO OID_TBL(f1) VALUES (' - 500'); +INSERT INTO OID_TBL(f1) VALUES ('32958209582039852935'); +INSERT INTO OID_TBL(f1) VALUES ('-23582358720398502385'); + +SELECT '' AS six, * FROM OID_TBL; + +SELECT '' AS one, o.* FROM OID_TBL o WHERE o.f1 = 1234; + +SELECT '' AS five, o.* FROM OID_TBL o WHERE o.f1 <> '1234'; + +SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 <= '1234'; + +SELECT '' AS two, o.* FROM OID_TBL o WHERE o.f1 < '1234'; + +SELECT '' AS four, o.* FROM OID_TBL o WHERE o.f1 >= '1234'; + +SELECT '' AS three, o.* FROM OID_TBL o WHERE o.f1 > '1234'; + +DROP TABLE OID_TBL; diff --git a/postgresql/examples/oidjoins.sql b/postgresql/examples/oidjoins.sql new file mode 100644 index 0000000..f6d2d3c --- /dev/null +++ b/postgresql/examples/oidjoins.sql @@ -0,0 +1,727 @@ +-- +-- This is created by pgsql/src/tools/findoidjoins/make_oidjoins_check +-- +SELECT ctid, aggfnoid +FROM pg_catalog.pg_aggregate fk +WHERE aggfnoid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggfnoid); +SELECT ctid, aggtransfn +FROM pg_catalog.pg_aggregate fk +WHERE aggtransfn != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggtransfn); +SELECT ctid, aggfinalfn +FROM pg_catalog.pg_aggregate fk +WHERE aggfinalfn != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggfinalfn); +SELECT ctid, aggcombinefn +FROM pg_catalog.pg_aggregate fk +WHERE aggcombinefn != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggcombinefn); +SELECT ctid, aggserialfn +FROM pg_catalog.pg_aggregate fk +WHERE aggserialfn != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggserialfn); +SELECT ctid, aggdeserialfn +FROM pg_catalog.pg_aggregate fk +WHERE aggdeserialfn != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggdeserialfn); +SELECT ctid, aggmtransfn +FROM pg_catalog.pg_aggregate fk +WHERE aggmtransfn != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggmtransfn); +SELECT ctid, aggminvtransfn +FROM pg_catalog.pg_aggregate fk +WHERE aggminvtransfn != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggminvtransfn); +SELECT ctid, aggmfinalfn +FROM pg_catalog.pg_aggregate fk +WHERE aggmfinalfn != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.aggmfinalfn); +SELECT ctid, aggsortop +FROM pg_catalog.pg_aggregate fk +WHERE aggsortop != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.aggsortop); +SELECT ctid, aggtranstype +FROM pg_catalog.pg_aggregate fk +WHERE aggtranstype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.aggtranstype); +SELECT ctid, aggmtranstype +FROM pg_catalog.pg_aggregate fk +WHERE aggmtranstype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.aggmtranstype); +SELECT ctid, amhandler +FROM pg_catalog.pg_am fk +WHERE amhandler != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.amhandler); +SELECT ctid, amopfamily +FROM pg_catalog.pg_amop fk +WHERE amopfamily != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opfamily pk WHERE pk.oid = fk.amopfamily); +SELECT ctid, amoplefttype +FROM pg_catalog.pg_amop fk +WHERE amoplefttype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.amoplefttype); +SELECT ctid, amoprighttype +FROM pg_catalog.pg_amop fk +WHERE amoprighttype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.amoprighttype); +SELECT ctid, amopopr +FROM pg_catalog.pg_amop fk +WHERE amopopr != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.amopopr); +SELECT ctid, amopmethod +FROM pg_catalog.pg_amop fk +WHERE amopmethod != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_am pk WHERE pk.oid = fk.amopmethod); +SELECT ctid, amopsortfamily +FROM pg_catalog.pg_amop fk +WHERE amopsortfamily != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opfamily pk WHERE pk.oid = fk.amopsortfamily); +SELECT ctid, amprocfamily +FROM pg_catalog.pg_amproc fk +WHERE amprocfamily != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opfamily pk WHERE pk.oid = fk.amprocfamily); +SELECT ctid, amproclefttype +FROM pg_catalog.pg_amproc fk +WHERE amproclefttype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.amproclefttype); +SELECT ctid, amprocrighttype +FROM pg_catalog.pg_amproc fk +WHERE amprocrighttype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.amprocrighttype); +SELECT ctid, amproc +FROM pg_catalog.pg_amproc fk +WHERE amproc != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.amproc); +SELECT ctid, adrelid +FROM pg_catalog.pg_attrdef fk +WHERE adrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.adrelid); +SELECT ctid, attrelid +FROM pg_catalog.pg_attribute fk +WHERE attrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.attrelid); +SELECT ctid, atttypid +FROM pg_catalog.pg_attribute fk +WHERE atttypid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.atttypid); +SELECT ctid, attcollation +FROM pg_catalog.pg_attribute fk +WHERE attcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.attcollation); +SELECT ctid, roleid +FROM pg_catalog.pg_auth_members fk +WHERE roleid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.roleid); +SELECT ctid, member +FROM pg_catalog.pg_auth_members fk +WHERE member != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.member); +SELECT ctid, grantor +FROM pg_catalog.pg_auth_members fk +WHERE grantor != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.grantor); +SELECT ctid, castsource +FROM pg_catalog.pg_cast fk +WHERE castsource != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.castsource); +SELECT ctid, casttarget +FROM pg_catalog.pg_cast fk +WHERE casttarget != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.casttarget); +SELECT ctid, castfunc +FROM pg_catalog.pg_cast fk +WHERE castfunc != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.castfunc); +SELECT ctid, relnamespace +FROM pg_catalog.pg_class fk +WHERE relnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.relnamespace); +SELECT ctid, reltype +FROM pg_catalog.pg_class fk +WHERE reltype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.reltype); +SELECT ctid, reloftype +FROM pg_catalog.pg_class fk +WHERE reloftype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.reloftype); +SELECT ctid, relowner +FROM pg_catalog.pg_class fk +WHERE relowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.relowner); +SELECT ctid, relam +FROM pg_catalog.pg_class fk +WHERE relam != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_am pk WHERE pk.oid = fk.relam); +SELECT ctid, reltablespace +FROM pg_catalog.pg_class fk +WHERE reltablespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_tablespace pk WHERE pk.oid = fk.reltablespace); +SELECT ctid, reltoastrelid +FROM pg_catalog.pg_class fk +WHERE reltoastrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.reltoastrelid); +SELECT ctid, collnamespace +FROM pg_catalog.pg_collation fk +WHERE collnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.collnamespace); +SELECT ctid, collowner +FROM pg_catalog.pg_collation fk +WHERE collowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.collowner); +SELECT ctid, connamespace +FROM pg_catalog.pg_constraint fk +WHERE connamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.connamespace); +SELECT ctid, conrelid +FROM pg_catalog.pg_constraint fk +WHERE conrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.conrelid); +SELECT ctid, contypid +FROM pg_catalog.pg_constraint fk +WHERE contypid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.contypid); +SELECT ctid, conindid +FROM pg_catalog.pg_constraint fk +WHERE conindid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.conindid); +SELECT ctid, conparentid +FROM pg_catalog.pg_constraint fk +WHERE conparentid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_constraint pk WHERE pk.oid = fk.conparentid); +SELECT ctid, confrelid +FROM pg_catalog.pg_constraint fk +WHERE confrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.confrelid); +SELECT ctid, connamespace +FROM pg_catalog.pg_conversion fk +WHERE connamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.connamespace); +SELECT ctid, conowner +FROM pg_catalog.pg_conversion fk +WHERE conowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.conowner); +SELECT ctid, conproc +FROM pg_catalog.pg_conversion fk +WHERE conproc != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.conproc); +SELECT ctid, datdba +FROM pg_catalog.pg_database fk +WHERE datdba != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.datdba); +SELECT ctid, dattablespace +FROM pg_catalog.pg_database fk +WHERE dattablespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_tablespace pk WHERE pk.oid = fk.dattablespace); +SELECT ctid, setdatabase +FROM pg_catalog.pg_db_role_setting fk +WHERE setdatabase != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_database pk WHERE pk.oid = fk.setdatabase); +SELECT ctid, classid +FROM pg_catalog.pg_depend fk +WHERE classid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.classid); +SELECT ctid, refclassid +FROM pg_catalog.pg_depend fk +WHERE refclassid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.refclassid); +SELECT ctid, classoid +FROM pg_catalog.pg_description fk +WHERE classoid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.classoid); +SELECT ctid, enumtypid +FROM pg_catalog.pg_enum fk +WHERE enumtypid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.enumtypid); +SELECT ctid, extowner +FROM pg_catalog.pg_extension fk +WHERE extowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.extowner); +SELECT ctid, extnamespace +FROM pg_catalog.pg_extension fk +WHERE extnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.extnamespace); +SELECT ctid, fdwowner +FROM pg_catalog.pg_foreign_data_wrapper fk +WHERE fdwowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.fdwowner); +SELECT ctid, srvowner +FROM pg_catalog.pg_foreign_server fk +WHERE srvowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.srvowner); +SELECT ctid, srvfdw +FROM pg_catalog.pg_foreign_server fk +WHERE srvfdw != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_foreign_data_wrapper pk WHERE pk.oid = fk.srvfdw); +SELECT ctid, indexrelid +FROM pg_catalog.pg_index fk +WHERE indexrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.indexrelid); +SELECT ctid, indrelid +FROM pg_catalog.pg_index fk +WHERE indrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.indrelid); +SELECT ctid, inhrelid +FROM pg_catalog.pg_inherits fk +WHERE inhrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.inhrelid); +SELECT ctid, inhparent +FROM pg_catalog.pg_inherits fk +WHERE inhparent != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.inhparent); +SELECT ctid, classoid +FROM pg_catalog.pg_init_privs fk +WHERE classoid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.classoid); +SELECT ctid, lanowner +FROM pg_catalog.pg_language fk +WHERE lanowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.lanowner); +SELECT ctid, lanplcallfoid +FROM pg_catalog.pg_language fk +WHERE lanplcallfoid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.lanplcallfoid); +SELECT ctid, laninline +FROM pg_catalog.pg_language fk +WHERE laninline != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.laninline); +SELECT ctid, lanvalidator +FROM pg_catalog.pg_language fk +WHERE lanvalidator != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.lanvalidator); +SELECT ctid, loid +FROM pg_catalog.pg_largeobject fk +WHERE loid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_largeobject_metadata pk WHERE pk.oid = fk.loid); +SELECT ctid, lomowner +FROM pg_catalog.pg_largeobject_metadata fk +WHERE lomowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.lomowner); +SELECT ctid, nspowner +FROM pg_catalog.pg_namespace fk +WHERE nspowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.nspowner); +SELECT ctid, opcmethod +FROM pg_catalog.pg_opclass fk +WHERE opcmethod != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_am pk WHERE pk.oid = fk.opcmethod); +SELECT ctid, opcnamespace +FROM pg_catalog.pg_opclass fk +WHERE opcnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.opcnamespace); +SELECT ctid, opcowner +FROM pg_catalog.pg_opclass fk +WHERE opcowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.opcowner); +SELECT ctid, opcfamily +FROM pg_catalog.pg_opclass fk +WHERE opcfamily != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opfamily pk WHERE pk.oid = fk.opcfamily); +SELECT ctid, opcintype +FROM pg_catalog.pg_opclass fk +WHERE opcintype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.opcintype); +SELECT ctid, opckeytype +FROM pg_catalog.pg_opclass fk +WHERE opckeytype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.opckeytype); +SELECT ctid, oprnamespace +FROM pg_catalog.pg_operator fk +WHERE oprnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.oprnamespace); +SELECT ctid, oprowner +FROM pg_catalog.pg_operator fk +WHERE oprowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.oprowner); +SELECT ctid, oprleft +FROM pg_catalog.pg_operator fk +WHERE oprleft != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.oprleft); +SELECT ctid, oprright +FROM pg_catalog.pg_operator fk +WHERE oprright != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.oprright); +SELECT ctid, oprresult +FROM pg_catalog.pg_operator fk +WHERE oprresult != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.oprresult); +SELECT ctid, oprcom +FROM pg_catalog.pg_operator fk +WHERE oprcom != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.oprcom); +SELECT ctid, oprnegate +FROM pg_catalog.pg_operator fk +WHERE oprnegate != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.oprnegate); +SELECT ctid, oprcode +FROM pg_catalog.pg_operator fk +WHERE oprcode != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.oprcode); +SELECT ctid, oprrest +FROM pg_catalog.pg_operator fk +WHERE oprrest != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.oprrest); +SELECT ctid, oprjoin +FROM pg_catalog.pg_operator fk +WHERE oprjoin != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.oprjoin); +SELECT ctid, opfmethod +FROM pg_catalog.pg_opfamily fk +WHERE opfmethod != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_am pk WHERE pk.oid = fk.opfmethod); +SELECT ctid, opfnamespace +FROM pg_catalog.pg_opfamily fk +WHERE opfnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.opfnamespace); +SELECT ctid, opfowner +FROM pg_catalog.pg_opfamily fk +WHERE opfowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.opfowner); +SELECT ctid, partrelid +FROM pg_catalog.pg_partitioned_table fk +WHERE partrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.partrelid); +SELECT ctid, partdefid +FROM pg_catalog.pg_partitioned_table fk +WHERE partdefid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.partdefid); +SELECT ctid, polrelid +FROM pg_catalog.pg_policy fk +WHERE polrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.polrelid); +SELECT ctid, pronamespace +FROM pg_catalog.pg_proc fk +WHERE pronamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.pronamespace); +SELECT ctid, proowner +FROM pg_catalog.pg_proc fk +WHERE proowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.proowner); +SELECT ctid, prolang +FROM pg_catalog.pg_proc fk +WHERE prolang != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_language pk WHERE pk.oid = fk.prolang); +SELECT ctid, provariadic +FROM pg_catalog.pg_proc fk +WHERE provariadic != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.provariadic); +SELECT ctid, prosupport +FROM pg_catalog.pg_proc fk +WHERE prosupport != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.prosupport); +SELECT ctid, prorettype +FROM pg_catalog.pg_proc fk +WHERE prorettype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.prorettype); +SELECT ctid, rngtypid +FROM pg_catalog.pg_range fk +WHERE rngtypid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.rngtypid); +SELECT ctid, rngsubtype +FROM pg_catalog.pg_range fk +WHERE rngsubtype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.rngsubtype); +SELECT ctid, rngcollation +FROM pg_catalog.pg_range fk +WHERE rngcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.rngcollation); +SELECT ctid, rngsubopc +FROM pg_catalog.pg_range fk +WHERE rngsubopc != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opclass pk WHERE pk.oid = fk.rngsubopc); +SELECT ctid, rngcanonical +FROM pg_catalog.pg_range fk +WHERE rngcanonical != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.rngcanonical); +SELECT ctid, rngsubdiff +FROM pg_catalog.pg_range fk +WHERE rngsubdiff != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.rngsubdiff); +SELECT ctid, ev_class +FROM pg_catalog.pg_rewrite fk +WHERE ev_class != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.ev_class); +SELECT ctid, seqrelid +FROM pg_catalog.pg_sequence fk +WHERE seqrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.seqrelid); +SELECT ctid, seqtypid +FROM pg_catalog.pg_sequence fk +WHERE seqtypid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.seqtypid); +SELECT ctid, refclassid +FROM pg_catalog.pg_shdepend fk +WHERE refclassid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.refclassid); +SELECT ctid, classoid +FROM pg_catalog.pg_shdescription fk +WHERE classoid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.classoid); +SELECT ctid, starelid +FROM pg_catalog.pg_statistic fk +WHERE starelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.starelid); +SELECT ctid, staop1 +FROM pg_catalog.pg_statistic fk +WHERE staop1 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.staop1); +SELECT ctid, staop2 +FROM pg_catalog.pg_statistic fk +WHERE staop2 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.staop2); +SELECT ctid, staop3 +FROM pg_catalog.pg_statistic fk +WHERE staop3 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.staop3); +SELECT ctid, staop4 +FROM pg_catalog.pg_statistic fk +WHERE staop4 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.staop4); +SELECT ctid, staop5 +FROM pg_catalog.pg_statistic fk +WHERE staop5 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.staop5); +SELECT ctid, stacoll1 +FROM pg_catalog.pg_statistic fk +WHERE stacoll1 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.stacoll1); +SELECT ctid, stacoll2 +FROM pg_catalog.pg_statistic fk +WHERE stacoll2 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.stacoll2); +SELECT ctid, stacoll3 +FROM pg_catalog.pg_statistic fk +WHERE stacoll3 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.stacoll3); +SELECT ctid, stacoll4 +FROM pg_catalog.pg_statistic fk +WHERE stacoll4 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.stacoll4); +SELECT ctid, stacoll5 +FROM pg_catalog.pg_statistic fk +WHERE stacoll5 != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.stacoll5); +SELECT ctid, stxrelid +FROM pg_catalog.pg_statistic_ext fk +WHERE stxrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.stxrelid); +SELECT ctid, stxnamespace +FROM pg_catalog.pg_statistic_ext fk +WHERE stxnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.stxnamespace); +SELECT ctid, stxowner +FROM pg_catalog.pg_statistic_ext fk +WHERE stxowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.stxowner); +SELECT ctid, stxoid +FROM pg_catalog.pg_statistic_ext_data fk +WHERE stxoid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_statistic_ext pk WHERE pk.oid = fk.stxoid); +SELECT ctid, spcowner +FROM pg_catalog.pg_tablespace fk +WHERE spcowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.spcowner); +SELECT ctid, trftype +FROM pg_catalog.pg_transform fk +WHERE trftype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.trftype); +SELECT ctid, trflang +FROM pg_catalog.pg_transform fk +WHERE trflang != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_language pk WHERE pk.oid = fk.trflang); +SELECT ctid, trffromsql +FROM pg_catalog.pg_transform fk +WHERE trffromsql != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.trffromsql); +SELECT ctid, trftosql +FROM pg_catalog.pg_transform fk +WHERE trftosql != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.trftosql); +SELECT ctid, tgrelid +FROM pg_catalog.pg_trigger fk +WHERE tgrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.tgrelid); +SELECT ctid, tgparentid +FROM pg_catalog.pg_trigger fk +WHERE tgparentid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_trigger pk WHERE pk.oid = fk.tgparentid); +SELECT ctid, tgfoid +FROM pg_catalog.pg_trigger fk +WHERE tgfoid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.tgfoid); +SELECT ctid, tgconstrrelid +FROM pg_catalog.pg_trigger fk +WHERE tgconstrrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.tgconstrrelid); +SELECT ctid, tgconstrindid +FROM pg_catalog.pg_trigger fk +WHERE tgconstrindid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.tgconstrindid); +SELECT ctid, tgconstraint +FROM pg_catalog.pg_trigger fk +WHERE tgconstraint != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_constraint pk WHERE pk.oid = fk.tgconstraint); +SELECT ctid, cfgnamespace +FROM pg_catalog.pg_ts_config fk +WHERE cfgnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.cfgnamespace); +SELECT ctid, cfgowner +FROM pg_catalog.pg_ts_config fk +WHERE cfgowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.cfgowner); +SELECT ctid, cfgparser +FROM pg_catalog.pg_ts_config fk +WHERE cfgparser != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_ts_parser pk WHERE pk.oid = fk.cfgparser); +SELECT ctid, mapcfg +FROM pg_catalog.pg_ts_config_map fk +WHERE mapcfg != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_ts_config pk WHERE pk.oid = fk.mapcfg); +SELECT ctid, mapdict +FROM pg_catalog.pg_ts_config_map fk +WHERE mapdict != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_ts_dict pk WHERE pk.oid = fk.mapdict); +SELECT ctid, dictnamespace +FROM pg_catalog.pg_ts_dict fk +WHERE dictnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.dictnamespace); +SELECT ctid, dictowner +FROM pg_catalog.pg_ts_dict fk +WHERE dictowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.dictowner); +SELECT ctid, dicttemplate +FROM pg_catalog.pg_ts_dict fk +WHERE dicttemplate != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_ts_template pk WHERE pk.oid = fk.dicttemplate); +SELECT ctid, prsnamespace +FROM pg_catalog.pg_ts_parser fk +WHERE prsnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.prsnamespace); +SELECT ctid, prsstart +FROM pg_catalog.pg_ts_parser fk +WHERE prsstart != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.prsstart); +SELECT ctid, prstoken +FROM pg_catalog.pg_ts_parser fk +WHERE prstoken != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.prstoken); +SELECT ctid, prsend +FROM pg_catalog.pg_ts_parser fk +WHERE prsend != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.prsend); +SELECT ctid, prsheadline +FROM pg_catalog.pg_ts_parser fk +WHERE prsheadline != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.prsheadline); +SELECT ctid, prslextype +FROM pg_catalog.pg_ts_parser fk +WHERE prslextype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.prslextype); +SELECT ctid, tmplnamespace +FROM pg_catalog.pg_ts_template fk +WHERE tmplnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.tmplnamespace); +SELECT ctid, tmplinit +FROM pg_catalog.pg_ts_template fk +WHERE tmplinit != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.tmplinit); +SELECT ctid, tmpllexize +FROM pg_catalog.pg_ts_template fk +WHERE tmpllexize != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.tmpllexize); +SELECT ctid, typnamespace +FROM pg_catalog.pg_type fk +WHERE typnamespace != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_namespace pk WHERE pk.oid = fk.typnamespace); +SELECT ctid, typowner +FROM pg_catalog.pg_type fk +WHERE typowner != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_authid pk WHERE pk.oid = fk.typowner); +SELECT ctid, typrelid +FROM pg_catalog.pg_type fk +WHERE typrelid != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_class pk WHERE pk.oid = fk.typrelid); +SELECT ctid, typelem +FROM pg_catalog.pg_type fk +WHERE typelem != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.typelem); +SELECT ctid, typarray +FROM pg_catalog.pg_type fk +WHERE typarray != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.typarray); +SELECT ctid, typinput +FROM pg_catalog.pg_type fk +WHERE typinput != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typinput); +SELECT ctid, typoutput +FROM pg_catalog.pg_type fk +WHERE typoutput != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typoutput); +SELECT ctid, typreceive +FROM pg_catalog.pg_type fk +WHERE typreceive != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typreceive); +SELECT ctid, typsend +FROM pg_catalog.pg_type fk +WHERE typsend != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typsend); +SELECT ctid, typmodin +FROM pg_catalog.pg_type fk +WHERE typmodin != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typmodin); +SELECT ctid, typmodout +FROM pg_catalog.pg_type fk +WHERE typmodout != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typmodout); +SELECT ctid, typanalyze +FROM pg_catalog.pg_type fk +WHERE typanalyze != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_proc pk WHERE pk.oid = fk.typanalyze); +SELECT ctid, typbasetype +FROM pg_catalog.pg_type fk +WHERE typbasetype != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.typbasetype); +SELECT ctid, typcollation +FROM pg_catalog.pg_type fk +WHERE typcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.typcollation); +SELECT ctid, conpfeqop +FROM (SELECT ctid, unnest(conpfeqop) AS conpfeqop FROM pg_catalog.pg_constraint) fk +WHERE conpfeqop != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.conpfeqop); +SELECT ctid, conppeqop +FROM (SELECT ctid, unnest(conppeqop) AS conppeqop FROM pg_catalog.pg_constraint) fk +WHERE conppeqop != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.conppeqop); +SELECT ctid, conffeqop +FROM (SELECT ctid, unnest(conffeqop) AS conffeqop FROM pg_catalog.pg_constraint) fk +WHERE conffeqop != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.conffeqop); +SELECT ctid, conexclop +FROM (SELECT ctid, unnest(conexclop) AS conexclop FROM pg_catalog.pg_constraint) fk +WHERE conexclop != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.conexclop); +SELECT ctid, indcollation +FROM (SELECT ctid, unnest(indcollation) AS indcollation FROM pg_catalog.pg_index) fk +WHERE indcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.indcollation); +SELECT ctid, indclass +FROM (SELECT ctid, unnest(indclass) AS indclass FROM pg_catalog.pg_index) fk +WHERE indclass != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opclass pk WHERE pk.oid = fk.indclass); +SELECT ctid, partclass +FROM (SELECT ctid, unnest(partclass) AS partclass FROM pg_catalog.pg_partitioned_table) fk +WHERE partclass != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opclass pk WHERE pk.oid = fk.partclass); +SELECT ctid, partcollation +FROM (SELECT ctid, unnest(partcollation) AS partcollation FROM pg_catalog.pg_partitioned_table) fk +WHERE partcollation != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.partcollation); +SELECT ctid, proargtypes +FROM (SELECT ctid, unnest(proargtypes) AS proargtypes FROM pg_catalog.pg_proc) fk +WHERE proargtypes != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.proargtypes); +SELECT ctid, proallargtypes +FROM (SELECT ctid, unnest(proallargtypes) AS proallargtypes FROM pg_catalog.pg_proc) fk +WHERE proallargtypes != 0 AND + NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.proallargtypes); diff --git a/postgresql/examples/opr_sanity.sql b/postgresql/examples/opr_sanity.sql new file mode 100644 index 0000000..7a9180b --- /dev/null +++ b/postgresql/examples/opr_sanity.sql @@ -0,0 +1,1442 @@ +-- +-- OPR_SANITY +-- Sanity checks for common errors in making operator/procedure system tables: +-- pg_operator, pg_proc, pg_cast, pg_conversion, pg_aggregate, pg_am, +-- pg_amop, pg_amproc, pg_opclass, pg_opfamily, pg_index. +-- +-- Every test failure in this file should be closely inspected. +-- The description of the failing test should be read carefully before +-- adjusting the expected output. In most cases, the queries should +-- not find *any* matching entries. +-- +-- NB: we assume the oidjoins test will have caught any dangling links, +-- that is OID or REGPROC fields that are not zero and do not match some +-- row in the linked-to table. However, if we want to enforce that a link +-- field can't be 0, we have to check it here. +-- +-- NB: run this test earlier than the create_operator test, because +-- that test creates some bogus operators... + + +-- Helper functions to deal with cases where binary-coercible matches are +-- allowed. + +-- This should match IsBinaryCoercible() in parse_coerce.c. +-- It doesn't currently know about some cases, notably domains, anyelement, +-- anynonarray, anyenum, or record, but it doesn't need to (yet). +create function binary_coercible(oid, oid) returns bool as $$ +begin + if $1 = $2 then return true; end if; + if EXISTS(select 1 from pg_catalog.pg_cast where + castsource = $1 and casttarget = $2 and + castmethod = 'b' and castcontext = 'i') + then return true; end if; + if $2 = 'pg_catalog.any'::pg_catalog.regtype then return true; end if; + if $2 = 'pg_catalog.anyarray'::pg_catalog.regtype then + if EXISTS(select 1 from pg_catalog.pg_type where + oid = $1 and typelem != 0 and typlen = -1) + then return true; end if; + end if; + if $2 = 'pg_catalog.anyrange'::pg_catalog.regtype then + if (select typtype from pg_catalog.pg_type where oid = $1) = 'r' + then return true; end if; + end if; + return false; +end +$$ language plpgsql strict stable; + +-- This one ignores castcontext, so it will allow cases where an explicit +-- (but still binary) cast would be required to convert the input type. +-- We don't currently use this for any tests in this file, but it is a +-- reasonable alternative definition for some scenarios. +create function explicitly_binary_coercible(oid, oid) returns bool as $$ +begin + if $1 = $2 then return true; end if; + if EXISTS(select 1 from pg_catalog.pg_cast where + castsource = $1 and casttarget = $2 and + castmethod = 'b') + then return true; end if; + if $2 = 'pg_catalog.any'::pg_catalog.regtype then return true; end if; + if $2 = 'pg_catalog.anyarray'::pg_catalog.regtype then + if EXISTS(select 1 from pg_catalog.pg_type where + oid = $1 and typelem != 0 and typlen = -1) + then return true; end if; + end if; + if $2 = 'pg_catalog.anyrange'::pg_catalog.regtype then + if (select typtype from pg_catalog.pg_type where oid = $1) = 'r' + then return true; end if; + end if; + return false; +end +$$ language plpgsql strict stable; + + +-- **************** pg_proc **************** + +-- Look for illegal values in pg_proc fields. + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE p1.prolang = 0 OR p1.prorettype = 0 OR + p1.pronargs < 0 OR + p1.pronargdefaults < 0 OR + p1.pronargdefaults > p1.pronargs OR + array_lower(p1.proargtypes, 1) != 0 OR + array_upper(p1.proargtypes, 1) != p1.pronargs-1 OR + 0::oid = ANY (p1.proargtypes) OR + procost <= 0 OR + CASE WHEN proretset THEN prorows <= 0 ELSE prorows != 0 END OR + prokind NOT IN ('f', 'a', 'w', 'p') OR + provolatile NOT IN ('i', 's', 'v') OR + proparallel NOT IN ('s', 'r', 'u'); + +-- prosrc should never be null or empty +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE prosrc IS NULL OR prosrc = '' OR prosrc = '-'; + +-- proretset should only be set for normal functions +SELECT p1.oid, p1.proname +FROM pg_proc AS p1 +WHERE proretset AND prokind != 'f'; + +-- currently, no built-in functions should be SECURITY DEFINER; +-- this might change in future, but there will probably never be many. +SELECT p1.oid, p1.proname +FROM pg_proc AS p1 +WHERE prosecdef +ORDER BY 1; + +-- pronargdefaults should be 0 iff proargdefaults is null +SELECT p1.oid, p1.proname +FROM pg_proc AS p1 +WHERE (pronargdefaults <> 0) != (proargdefaults IS NOT NULL); + +-- probin should be non-empty for C functions, null everywhere else +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE prolang = 13 AND (probin IS NULL OR probin = '' OR probin = '-'); + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE prolang != 13 AND probin IS NOT NULL; + +-- Look for conflicting proc definitions (same names and input datatypes). +-- (This test should be dead code now that we have the unique index +-- pg_proc_proname_args_nsp_index, but I'll leave it in anyway.) + +SELECT p1.oid, p1.proname, p2.oid, p2.proname +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.proname = p2.proname AND + p1.pronargs = p2.pronargs AND + p1.proargtypes = p2.proargtypes; + +-- Considering only built-in procs (prolang = 12), look for multiple uses +-- of the same internal function (ie, matching prosrc fields). It's OK to +-- have several entries with different pronames for the same internal function, +-- but conflicts in the number of arguments and other critical items should +-- be complained of. (We don't check data types here; see next query.) +-- Note: ignore aggregate functions here, since they all point to the same +-- dummy built-in function. + +SELECT p1.oid, p1.proname, p2.oid, p2.proname +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid < p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + (p1.prokind != 'a' OR p2.prokind != 'a') AND + (p1.prolang != p2.prolang OR + p1.prokind != p2.prokind OR + p1.prosecdef != p2.prosecdef OR + p1.proleakproof != p2.proleakproof OR + p1.proisstrict != p2.proisstrict OR + p1.proretset != p2.proretset OR + p1.provolatile != p2.provolatile OR + p1.pronargs != p2.pronargs); + +-- Look for uses of different type OIDs in the argument/result type fields +-- for different aliases of the same built-in function. +-- This indicates that the types are being presumed to be binary-equivalent, +-- or that the built-in function is prepared to deal with different types. +-- That's not wrong, necessarily, but we make lists of all the types being +-- so treated. Note that the expected output of this part of the test will +-- need to be modified whenever new pairs of types are made binary-equivalent, +-- or when new polymorphic built-in functions are added! +-- Note: ignore aggregate functions here, since they all point to the same +-- dummy built-in function. Likewise, ignore range constructor functions. + +SELECT DISTINCT p1.prorettype::regtype, p2.prorettype::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + p1.prosrc NOT LIKE E'range\\_constructor_' AND + p2.prosrc NOT LIKE E'range\\_constructor_' AND + (p1.prorettype < p2.prorettype) +ORDER BY 1, 2; + +SELECT DISTINCT p1.proargtypes[0]::regtype, p2.proargtypes[0]::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + p1.prosrc NOT LIKE E'range\\_constructor_' AND + p2.prosrc NOT LIKE E'range\\_constructor_' AND + (p1.proargtypes[0] < p2.proargtypes[0]) +ORDER BY 1, 2; + +SELECT DISTINCT p1.proargtypes[1]::regtype, p2.proargtypes[1]::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + p1.prosrc NOT LIKE E'range\\_constructor_' AND + p2.prosrc NOT LIKE E'range\\_constructor_' AND + (p1.proargtypes[1] < p2.proargtypes[1]) +ORDER BY 1, 2; + +SELECT DISTINCT p1.proargtypes[2]::regtype, p2.proargtypes[2]::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + (p1.proargtypes[2] < p2.proargtypes[2]) +ORDER BY 1, 2; + +SELECT DISTINCT p1.proargtypes[3]::regtype, p2.proargtypes[3]::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + (p1.proargtypes[3] < p2.proargtypes[3]) +ORDER BY 1, 2; + +SELECT DISTINCT p1.proargtypes[4]::regtype, p2.proargtypes[4]::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + (p1.proargtypes[4] < p2.proargtypes[4]) +ORDER BY 1, 2; + +SELECT DISTINCT p1.proargtypes[5]::regtype, p2.proargtypes[5]::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + (p1.proargtypes[5] < p2.proargtypes[5]) +ORDER BY 1, 2; + +SELECT DISTINCT p1.proargtypes[6]::regtype, p2.proargtypes[6]::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + (p1.proargtypes[6] < p2.proargtypes[6]) +ORDER BY 1, 2; + +SELECT DISTINCT p1.proargtypes[7]::regtype, p2.proargtypes[7]::regtype +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid != p2.oid AND + p1.prosrc = p2.prosrc AND + p1.prolang = 12 AND p2.prolang = 12 AND + p1.prokind != 'a' AND p2.prokind != 'a' AND + (p1.proargtypes[7] < p2.proargtypes[7]) +ORDER BY 1, 2; + +-- Look for functions that return type "internal" and do not have any +-- "internal" argument. Such a function would be a security hole since +-- it might be used to call an internal function from an SQL command. +-- As of 7.3 this query should find only internal_in, which is safe because +-- it always throws an error when called. + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE p1.prorettype = 'internal'::regtype AND NOT + 'internal'::regtype = ANY (p1.proargtypes); + +-- Look for functions that return a polymorphic type and do not have any +-- polymorphic argument. Calls of such functions would be unresolvable +-- at parse time. As of 9.6 this query should find only some input functions +-- and GiST support functions associated with these pseudotypes. + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE p1.prorettype IN + ('anyelement'::regtype, 'anyarray'::regtype, 'anynonarray'::regtype, + 'anyenum'::regtype) + AND NOT + ('anyelement'::regtype = ANY (p1.proargtypes) OR + 'anyarray'::regtype = ANY (p1.proargtypes) OR + 'anynonarray'::regtype = ANY (p1.proargtypes) OR + 'anyenum'::regtype = ANY (p1.proargtypes) OR + 'anyrange'::regtype = ANY (p1.proargtypes)) +ORDER BY 2; + +-- anyrange is tighter than the rest, can only resolve from anyrange input + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE p1.prorettype = 'anyrange'::regtype + AND NOT + 'anyrange'::regtype = ANY (p1.proargtypes) +ORDER BY 2; + +-- similarly for the anycompatible family + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE p1.prorettype IN + ('anycompatible'::regtype, 'anycompatiblearray'::regtype, + 'anycompatiblenonarray'::regtype) + AND NOT + ('anycompatible'::regtype = ANY (p1.proargtypes) OR + 'anycompatiblearray'::regtype = ANY (p1.proargtypes) OR + 'anycompatiblenonarray'::regtype = ANY (p1.proargtypes) OR + 'anycompatiblerange'::regtype = ANY (p1.proargtypes)) +ORDER BY 2; + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE p1.prorettype = 'anycompatiblerange'::regtype + AND NOT + 'anycompatiblerange'::regtype = ANY (p1.proargtypes) +ORDER BY 2; + + +-- Look for functions that accept cstring and are neither datatype input +-- functions nor encoding conversion functions. It's almost never a good +-- idea to use cstring input for a function meant to be called from SQL; +-- text should be used instead, because cstring lacks suitable casts. +-- As of 9.6 this query should find only cstring_out and cstring_send. +-- However, we must manually exclude shell_in, which might or might not be +-- rejected by the EXISTS clause depending on whether there are currently +-- any shell types. + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE 'cstring'::regtype = ANY (p1.proargtypes) + AND NOT EXISTS(SELECT 1 FROM pg_type WHERE typinput = p1.oid) + AND NOT EXISTS(SELECT 1 FROM pg_conversion WHERE conproc = p1.oid) + AND p1.oid != 'shell_in(cstring)'::regprocedure +ORDER BY 1; + +-- Likewise, look for functions that return cstring and aren't datatype output +-- functions nor typmod output functions. +-- As of 9.6 this query should find only cstring_in and cstring_recv. +-- However, we must manually exclude shell_out. + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE p1.prorettype = 'cstring'::regtype + AND NOT EXISTS(SELECT 1 FROM pg_type WHERE typoutput = p1.oid) + AND NOT EXISTS(SELECT 1 FROM pg_type WHERE typmodout = p1.oid) + AND p1.oid != 'shell_out(void)'::regprocedure +ORDER BY 1; + +-- Check for length inconsistencies between the various argument-info arrays. + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE proallargtypes IS NOT NULL AND + array_length(proallargtypes,1) < array_length(proargtypes,1); + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE proargmodes IS NOT NULL AND + array_length(proargmodes,1) < array_length(proargtypes,1); + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE proargnames IS NOT NULL AND + array_length(proargnames,1) < array_length(proargtypes,1); + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE proallargtypes IS NOT NULL AND proargmodes IS NOT NULL AND + array_length(proallargtypes,1) <> array_length(proargmodes,1); + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE proallargtypes IS NOT NULL AND proargnames IS NOT NULL AND + array_length(proallargtypes,1) <> array_length(proargnames,1); + +SELECT p1.oid, p1.proname +FROM pg_proc as p1 +WHERE proargmodes IS NOT NULL AND proargnames IS NOT NULL AND + array_length(proargmodes,1) <> array_length(proargnames,1); + +-- Check that proallargtypes matches proargtypes +SELECT p1.oid, p1.proname, p1.proargtypes, p1.proallargtypes, p1.proargmodes +FROM pg_proc as p1 +WHERE proallargtypes IS NOT NULL AND + ARRAY(SELECT unnest(proargtypes)) <> + ARRAY(SELECT proallargtypes[i] + FROM generate_series(1, array_length(proallargtypes, 1)) g(i) + WHERE proargmodes IS NULL OR proargmodes[i] IN ('i', 'b', 'v')); + +-- Check for prosupport functions with the wrong signature +SELECT p1.oid, p1.proname, p2.oid, p2.proname +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p2.oid = p1.prosupport AND + (p2.prorettype != 'internal'::regtype OR p2.proretset OR p2.pronargs != 1 + OR p2.proargtypes[0] != 'internal'::regtype); + +-- Insist that all built-in pg_proc entries have descriptions +SELECT p1.oid, p1.proname +FROM pg_proc as p1 LEFT JOIN pg_description as d + ON p1.tableoid = d.classoid and p1.oid = d.objoid and d.objsubid = 0 +WHERE d.classoid IS NULL AND p1.oid <= 9999; + +-- List of built-in leakproof functions +-- +-- Leakproof functions should only be added after carefully +-- scrutinizing all possibly executed codepaths for possible +-- information leaks. Don't add functions here unless you know what a +-- leakproof function is. If unsure, don't mark it as such. + +-- temporarily disable fancy output, so catalog changes create less diff noise +\a\t + +SELECT p1.oid::regprocedure +FROM pg_proc p1 JOIN pg_namespace pn + ON pronamespace = pn.oid +WHERE nspname = 'pg_catalog' AND proleakproof +ORDER BY 1; + +-- restore normal output mode +\a\t + +-- List of functions used by libpq's fe-lobj.c +-- +-- If the output of this query changes, you probably broke libpq. +-- lo_initialize() assumes that there will be at most one match for +-- each listed name. +select proname, oid from pg_catalog.pg_proc +where proname in ( + 'lo_open', + 'lo_close', + 'lo_creat', + 'lo_create', + 'lo_unlink', + 'lo_lseek', + 'lo_lseek64', + 'lo_tell', + 'lo_tell64', + 'lo_truncate', + 'lo_truncate64', + 'loread', + 'lowrite') +and pronamespace = (select oid from pg_catalog.pg_namespace + where nspname = 'pg_catalog') +order by 1; + +-- Check that all immutable functions are marked parallel safe +SELECT p1.oid, p1.proname +FROM pg_proc AS p1 +WHERE provolatile = 'i' AND proparallel = 'u'; + + +-- **************** pg_cast **************** + +-- Catch bogus values in pg_cast columns (other than cases detected by +-- oidjoins test). + +SELECT * +FROM pg_cast c +WHERE castsource = 0 OR casttarget = 0 OR castcontext NOT IN ('e', 'a', 'i') + OR castmethod NOT IN ('f', 'b' ,'i'); + +-- Check that castfunc is nonzero only for cast methods that need a function, +-- and zero otherwise + +SELECT * +FROM pg_cast c +WHERE (castmethod = 'f' AND castfunc = 0) + OR (castmethod IN ('b', 'i') AND castfunc <> 0); + +-- Look for casts to/from the same type that aren't length coercion functions. +-- (We assume they are length coercions if they take multiple arguments.) +-- Such entries are not necessarily harmful, but they are useless. + +SELECT * +FROM pg_cast c +WHERE castsource = casttarget AND castfunc = 0; + +SELECT c.* +FROM pg_cast c, pg_proc p +WHERE c.castfunc = p.oid AND p.pronargs < 2 AND castsource = casttarget; + +-- Look for cast functions that don't have the right signature. The +-- argument and result types in pg_proc must be the same as, or binary +-- compatible with, what it says in pg_cast. +-- As a special case, we allow casts from CHAR(n) that use functions +-- declared to take TEXT. This does not pass the binary-coercibility test +-- because CHAR(n)-to-TEXT normally invokes rtrim(). However, the results +-- are the same, so long as the function is one that ignores trailing blanks. + +SELECT c.* +FROM pg_cast c, pg_proc p +WHERE c.castfunc = p.oid AND + (p.pronargs < 1 OR p.pronargs > 3 + OR NOT (binary_coercible(c.castsource, p.proargtypes[0]) + OR (c.castsource = 'character'::regtype AND + p.proargtypes[0] = 'text'::regtype)) + OR NOT binary_coercible(p.prorettype, c.casttarget)); + +SELECT c.* +FROM pg_cast c, pg_proc p +WHERE c.castfunc = p.oid AND + ((p.pronargs > 1 AND p.proargtypes[1] != 'int4'::regtype) OR + (p.pronargs > 2 AND p.proargtypes[2] != 'bool'::regtype)); + +-- Look for binary compatible casts that do not have the reverse +-- direction registered as well, or where the reverse direction is not +-- also binary compatible. This is legal, but usually not intended. + +-- As of 7.4, this finds the casts from text and varchar to bpchar, because +-- those are binary-compatible while the reverse way goes through rtrim(). + +-- As of 8.2, this finds the cast from cidr to inet, because that is a +-- trivial binary coercion while the other way goes through inet_to_cidr(). + +-- As of 8.3, this finds the casts from xml to text, varchar, and bpchar, +-- because those are binary-compatible while the reverse goes through +-- texttoxml(), which does an XML syntax check. + +-- As of 9.1, this finds the cast from pg_node_tree to text, which we +-- intentionally do not provide a reverse pathway for. + +SELECT castsource::regtype, casttarget::regtype, castfunc, castcontext +FROM pg_cast c +WHERE c.castmethod = 'b' AND + NOT EXISTS (SELECT 1 FROM pg_cast k + WHERE k.castmethod = 'b' AND + k.castsource = c.casttarget AND + k.casttarget = c.castsource); + + +-- **************** pg_conversion **************** + +-- Look for illegal values in pg_conversion fields. + +SELECT p1.oid, p1.conname +FROM pg_conversion as p1 +WHERE p1.conproc = 0 OR + pg_encoding_to_char(conforencoding) = '' OR + pg_encoding_to_char(contoencoding) = ''; + +-- Look for conprocs that don't have the expected signature. + +SELECT p.oid, p.proname, c.oid, c.conname +FROM pg_proc p, pg_conversion c +WHERE p.oid = c.conproc AND + (p.prorettype != 'void'::regtype OR p.proretset OR + p.pronargs != 5 OR + p.proargtypes[0] != 'int4'::regtype OR + p.proargtypes[1] != 'int4'::regtype OR + p.proargtypes[2] != 'cstring'::regtype OR + p.proargtypes[3] != 'internal'::regtype OR + p.proargtypes[4] != 'int4'::regtype); + +-- Check for conprocs that don't perform the specific conversion that +-- pg_conversion alleges they do, by trying to invoke each conversion +-- on some simple ASCII data. (The conproc should throw an error if +-- it doesn't accept the encodings that are passed to it.) +-- Unfortunately, we can't test non-default conprocs this way, because +-- there is no way to ask convert() to invoke them, and we cannot call +-- them directly from SQL. But there are no non-default built-in +-- conversions anyway. +-- (Similarly, this doesn't cope with any search path issues.) + +SELECT p1.oid, p1.conname +FROM pg_conversion as p1 +WHERE condefault AND + convert('ABC'::bytea, pg_encoding_to_char(conforencoding), + pg_encoding_to_char(contoencoding)) != 'ABC'; + + +-- **************** pg_operator **************** + +-- Look for illegal values in pg_operator fields. + +SELECT p1.oid, p1.oprname +FROM pg_operator as p1 +WHERE (p1.oprkind != 'b' AND p1.oprkind != 'l' AND p1.oprkind != 'r') OR + p1.oprresult = 0 OR p1.oprcode = 0; + +-- Look for missing or unwanted operand types + +SELECT p1.oid, p1.oprname +FROM pg_operator as p1 +WHERE (p1.oprleft = 0 and p1.oprkind != 'l') OR + (p1.oprleft != 0 and p1.oprkind = 'l') OR + (p1.oprright = 0 and p1.oprkind != 'r') OR + (p1.oprright != 0 and p1.oprkind = 'r'); + +-- Look for conflicting operator definitions (same names and input datatypes). + +SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode +FROM pg_operator AS p1, pg_operator AS p2 +WHERE p1.oid != p2.oid AND + p1.oprname = p2.oprname AND + p1.oprkind = p2.oprkind AND + p1.oprleft = p2.oprleft AND + p1.oprright = p2.oprright; + +-- Look for commutative operators that don't commute. +-- DEFINITIONAL NOTE: If A.oprcom = B, then x A y has the same result as y B x. +-- We expect that B will always say that B.oprcom = A as well; that's not +-- inherently essential, but it would be inefficient not to mark it so. + +SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode +FROM pg_operator AS p1, pg_operator AS p2 +WHERE p1.oprcom = p2.oid AND + (p1.oprkind != 'b' OR + p1.oprleft != p2.oprright OR + p1.oprright != p2.oprleft OR + p1.oprresult != p2.oprresult OR + p1.oid != p2.oprcom); + +-- Look for negatory operators that don't agree. +-- DEFINITIONAL NOTE: If A.oprnegate = B, then both A and B must yield +-- boolean results, and (x A y) == ! (x B y), or the equivalent for +-- single-operand operators. +-- We expect that B will always say that B.oprnegate = A as well; that's not +-- inherently essential, but it would be inefficient not to mark it so. +-- Also, A and B had better not be the same operator. + +SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcode +FROM pg_operator AS p1, pg_operator AS p2 +WHERE p1.oprnegate = p2.oid AND + (p1.oprkind != p2.oprkind OR + p1.oprleft != p2.oprleft OR + p1.oprright != p2.oprright OR + p1.oprresult != 'bool'::regtype OR + p2.oprresult != 'bool'::regtype OR + p1.oid != p2.oprnegate OR + p1.oid = p2.oid); + +-- Make a list of the names of operators that are claimed to be commutator +-- pairs. This list will grow over time, but before accepting a new entry +-- make sure you didn't link the wrong operators. + +SELECT DISTINCT o1.oprname AS op1, o2.oprname AS op2 +FROM pg_operator o1, pg_operator o2 +WHERE o1.oprcom = o2.oid AND o1.oprname <= o2.oprname +ORDER BY 1, 2; + +-- Likewise for negator pairs. + +SELECT DISTINCT o1.oprname AS op1, o2.oprname AS op2 +FROM pg_operator o1, pg_operator o2 +WHERE o1.oprnegate = o2.oid AND o1.oprname <= o2.oprname +ORDER BY 1, 2; + +-- A mergejoinable or hashjoinable operator must be binary, must return +-- boolean, and must have a commutator (itself, unless it's a cross-type +-- operator). + +SELECT p1.oid, p1.oprname FROM pg_operator AS p1 +WHERE (p1.oprcanmerge OR p1.oprcanhash) AND NOT + (p1.oprkind = 'b' AND p1.oprresult = 'bool'::regtype AND p1.oprcom != 0); + +-- What's more, the commutator had better be mergejoinable/hashjoinable too. + +SELECT p1.oid, p1.oprname, p2.oid, p2.oprname +FROM pg_operator AS p1, pg_operator AS p2 +WHERE p1.oprcom = p2.oid AND + (p1.oprcanmerge != p2.oprcanmerge OR + p1.oprcanhash != p2.oprcanhash); + +-- Mergejoinable operators should appear as equality members of btree index +-- opfamilies. + +SELECT p1.oid, p1.oprname +FROM pg_operator AS p1 +WHERE p1.oprcanmerge AND NOT EXISTS + (SELECT 1 FROM pg_amop + WHERE amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree') AND + amopopr = p1.oid AND amopstrategy = 3); + +-- And the converse. + +SELECT p1.oid, p1.oprname, p.amopfamily +FROM pg_operator AS p1, pg_amop p +WHERE amopopr = p1.oid + AND amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree') + AND amopstrategy = 3 + AND NOT p1.oprcanmerge; + +-- Hashable operators should appear as members of hash index opfamilies. + +SELECT p1.oid, p1.oprname +FROM pg_operator AS p1 +WHERE p1.oprcanhash AND NOT EXISTS + (SELECT 1 FROM pg_amop + WHERE amopmethod = (SELECT oid FROM pg_am WHERE amname = 'hash') AND + amopopr = p1.oid AND amopstrategy = 1); + +-- And the converse. + +SELECT p1.oid, p1.oprname, p.amopfamily +FROM pg_operator AS p1, pg_amop p +WHERE amopopr = p1.oid + AND amopmethod = (SELECT oid FROM pg_am WHERE amname = 'hash') + AND NOT p1.oprcanhash; + +-- Check that each operator defined in pg_operator matches its oprcode entry +-- in pg_proc. Easiest to do this separately for each oprkind. + +SELECT p1.oid, p1.oprname, p2.oid, p2.proname +FROM pg_operator AS p1, pg_proc AS p2 +WHERE p1.oprcode = p2.oid AND + p1.oprkind = 'b' AND + (p2.pronargs != 2 + OR NOT binary_coercible(p2.prorettype, p1.oprresult) + OR NOT binary_coercible(p1.oprleft, p2.proargtypes[0]) + OR NOT binary_coercible(p1.oprright, p2.proargtypes[1])); + +SELECT p1.oid, p1.oprname, p2.oid, p2.proname +FROM pg_operator AS p1, pg_proc AS p2 +WHERE p1.oprcode = p2.oid AND + p1.oprkind = 'l' AND + (p2.pronargs != 1 + OR NOT binary_coercible(p2.prorettype, p1.oprresult) + OR NOT binary_coercible(p1.oprright, p2.proargtypes[0]) + OR p1.oprleft != 0); + +SELECT p1.oid, p1.oprname, p2.oid, p2.proname +FROM pg_operator AS p1, pg_proc AS p2 +WHERE p1.oprcode = p2.oid AND + p1.oprkind = 'r' AND + (p2.pronargs != 1 + OR NOT binary_coercible(p2.prorettype, p1.oprresult) + OR NOT binary_coercible(p1.oprleft, p2.proargtypes[0]) + OR p1.oprright != 0); + +-- If the operator is mergejoinable or hashjoinable, its underlying function +-- should not be volatile. + +SELECT p1.oid, p1.oprname, p2.oid, p2.proname +FROM pg_operator AS p1, pg_proc AS p2 +WHERE p1.oprcode = p2.oid AND + (p1.oprcanmerge OR p1.oprcanhash) AND + p2.provolatile = 'v'; + +-- If oprrest is set, the operator must return boolean, +-- and it must link to a proc with the right signature +-- to be a restriction selectivity estimator. +-- The proc signature we want is: float8 proc(internal, oid, internal, int4) + +SELECT p1.oid, p1.oprname, p2.oid, p2.proname +FROM pg_operator AS p1, pg_proc AS p2 +WHERE p1.oprrest = p2.oid AND + (p1.oprresult != 'bool'::regtype OR + p2.prorettype != 'float8'::regtype OR p2.proretset OR + p2.pronargs != 4 OR + p2.proargtypes[0] != 'internal'::regtype OR + p2.proargtypes[1] != 'oid'::regtype OR + p2.proargtypes[2] != 'internal'::regtype OR + p2.proargtypes[3] != 'int4'::regtype); + +-- If oprjoin is set, the operator must be a binary boolean op, +-- and it must link to a proc with the right signature +-- to be a join selectivity estimator. +-- The proc signature we want is: float8 proc(internal, oid, internal, int2, internal) +-- (Note: the old signature with only 4 args is still allowed, but no core +-- estimator should be using it.) + +SELECT p1.oid, p1.oprname, p2.oid, p2.proname +FROM pg_operator AS p1, pg_proc AS p2 +WHERE p1.oprjoin = p2.oid AND + (p1.oprkind != 'b' OR p1.oprresult != 'bool'::regtype OR + p2.prorettype != 'float8'::regtype OR p2.proretset OR + p2.pronargs != 5 OR + p2.proargtypes[0] != 'internal'::regtype OR + p2.proargtypes[1] != 'oid'::regtype OR + p2.proargtypes[2] != 'internal'::regtype OR + p2.proargtypes[3] != 'int2'::regtype OR + p2.proargtypes[4] != 'internal'::regtype); + +-- Insist that all built-in pg_operator entries have descriptions +SELECT p1.oid, p1.oprname +FROM pg_operator as p1 LEFT JOIN pg_description as d + ON p1.tableoid = d.classoid and p1.oid = d.objoid and d.objsubid = 0 +WHERE d.classoid IS NULL AND p1.oid <= 9999; + +-- Check that operators' underlying functions have suitable comments, +-- namely 'implementation of XXX operator'. (Note: it's not necessary to +-- put such comments into pg_proc.dat; initdb will generate them as needed.) +-- In some cases involving legacy names for operators, there are multiple +-- operators referencing the same pg_proc entry, so ignore operators whose +-- comments say they are deprecated. +-- We also have a few functions that are both operator support and meant to +-- be called directly; those should have comments matching their operator. +WITH funcdescs AS ( + SELECT p.oid as p_oid, proname, o.oid as o_oid, + pd.description as prodesc, + 'implementation of ' || oprname || ' operator' as expecteddesc, + od.description as oprdesc + FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid + LEFT JOIN pg_description pd ON + (pd.objoid = p.oid and pd.classoid = p.tableoid and pd.objsubid = 0) + LEFT JOIN pg_description od ON + (od.objoid = o.oid and od.classoid = o.tableoid and od.objsubid = 0) + WHERE o.oid <= 9999 +) +SELECT * FROM funcdescs + WHERE prodesc IS DISTINCT FROM expecteddesc + AND oprdesc NOT LIKE 'deprecated%' + AND prodesc IS DISTINCT FROM oprdesc; + +-- Show all the operator-implementation functions that have their own +-- comments. This should happen only in cases where the function and +-- operator syntaxes are both documented at the user level. +-- This should be a pretty short list; it's mostly legacy cases. +WITH funcdescs AS ( + SELECT p.oid as p_oid, proname, o.oid as o_oid, + pd.description as prodesc, + 'implementation of ' || oprname || ' operator' as expecteddesc, + od.description as oprdesc + FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid + LEFT JOIN pg_description pd ON + (pd.objoid = p.oid and pd.classoid = p.tableoid and pd.objsubid = 0) + LEFT JOIN pg_description od ON + (od.objoid = o.oid and od.classoid = o.tableoid and od.objsubid = 0) + WHERE o.oid <= 9999 +) +SELECT p_oid, proname, prodesc FROM funcdescs + WHERE prodesc IS DISTINCT FROM expecteddesc + AND oprdesc NOT LIKE 'deprecated%' +ORDER BY 1; + +-- Operators that are commutator pairs should have identical volatility +-- and leakproofness markings on their implementation functions. +SELECT o1.oid, o1.oprcode, o2.oid, o2.oprcode +FROM pg_operator AS o1, pg_operator AS o2, pg_proc AS p1, pg_proc AS p2 +WHERE o1.oprcom = o2.oid AND p1.oid = o1.oprcode AND p2.oid = o2.oprcode AND + (p1.provolatile != p2.provolatile OR + p1.proleakproof != p2.proleakproof); + +-- Likewise for negator pairs. +SELECT o1.oid, o1.oprcode, o2.oid, o2.oprcode +FROM pg_operator AS o1, pg_operator AS o2, pg_proc AS p1, pg_proc AS p2 +WHERE o1.oprnegate = o2.oid AND p1.oid = o1.oprcode AND p2.oid = o2.oprcode AND + (p1.provolatile != p2.provolatile OR + p1.proleakproof != p2.proleakproof); + +-- Btree comparison operators' functions should have the same volatility +-- and leakproofness markings as the associated comparison support function. +SELECT pp.oid::regprocedure as proc, pp.provolatile as vp, pp.proleakproof as lp, + po.oid::regprocedure as opr, po.provolatile as vo, po.proleakproof as lo +FROM pg_proc pp, pg_proc po, pg_operator o, pg_amproc ap, pg_amop ao +WHERE pp.oid = ap.amproc AND po.oid = o.oprcode AND o.oid = ao.amopopr AND + ao.amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree') AND + ao.amopfamily = ap.amprocfamily AND + ao.amoplefttype = ap.amproclefttype AND + ao.amoprighttype = ap.amprocrighttype AND + ap.amprocnum = 1 AND + (pp.provolatile != po.provolatile OR + pp.proleakproof != po.proleakproof) +ORDER BY 1; + + +-- **************** pg_aggregate **************** + +-- Look for illegal values in pg_aggregate fields. + +SELECT ctid, aggfnoid::oid +FROM pg_aggregate as p1 +WHERE aggfnoid = 0 OR aggtransfn = 0 OR + aggkind NOT IN ('n', 'o', 'h') OR + aggnumdirectargs < 0 OR + (aggkind = 'n' AND aggnumdirectargs > 0) OR + aggfinalmodify NOT IN ('r', 's', 'w') OR + aggmfinalmodify NOT IN ('r', 's', 'w') OR + aggtranstype = 0 OR aggtransspace < 0 OR aggmtransspace < 0; + +-- Make sure the matching pg_proc entry is sensible, too. + +SELECT a.aggfnoid::oid, p.proname +FROM pg_aggregate as a, pg_proc as p +WHERE a.aggfnoid = p.oid AND + (p.prokind != 'a' OR p.proretset OR p.pronargs < a.aggnumdirectargs); + +-- Make sure there are no prokind = PROKIND_AGGREGATE pg_proc entries without matches. + +SELECT oid, proname +FROM pg_proc as p +WHERE p.prokind = 'a' AND + NOT EXISTS (SELECT 1 FROM pg_aggregate a WHERE a.aggfnoid = p.oid); + +-- If there is no finalfn then the output type must be the transtype. + +SELECT a.aggfnoid::oid, p.proname +FROM pg_aggregate as a, pg_proc as p +WHERE a.aggfnoid = p.oid AND + a.aggfinalfn = 0 AND p.prorettype != a.aggtranstype; + +-- Cross-check transfn against its entry in pg_proc. +SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname +FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr +WHERE a.aggfnoid = p.oid AND + a.aggtransfn = ptr.oid AND + (ptr.proretset + OR NOT (ptr.pronargs = + CASE WHEN a.aggkind = 'n' THEN p.pronargs + 1 + ELSE greatest(p.pronargs - a.aggnumdirectargs, 1) + 1 END) + OR NOT binary_coercible(ptr.prorettype, a.aggtranstype) + OR NOT binary_coercible(a.aggtranstype, ptr.proargtypes[0]) + OR (p.pronargs > 0 AND + NOT binary_coercible(p.proargtypes[0], ptr.proargtypes[1])) + OR (p.pronargs > 1 AND + NOT binary_coercible(p.proargtypes[1], ptr.proargtypes[2])) + OR (p.pronargs > 2 AND + NOT binary_coercible(p.proargtypes[2], ptr.proargtypes[3])) + -- we could carry the check further, but 3 args is enough for now + OR (p.pronargs > 3) + ); + +-- Cross-check finalfn (if present) against its entry in pg_proc. + +SELECT a.aggfnoid::oid, p.proname, pfn.oid, pfn.proname +FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS pfn +WHERE a.aggfnoid = p.oid AND + a.aggfinalfn = pfn.oid AND + (pfn.proretset OR + NOT binary_coercible(pfn.prorettype, p.prorettype) OR + NOT binary_coercible(a.aggtranstype, pfn.proargtypes[0]) OR + CASE WHEN a.aggfinalextra THEN pfn.pronargs != p.pronargs + 1 + ELSE pfn.pronargs != a.aggnumdirectargs + 1 END + OR (pfn.pronargs > 1 AND + NOT binary_coercible(p.proargtypes[0], pfn.proargtypes[1])) + OR (pfn.pronargs > 2 AND + NOT binary_coercible(p.proargtypes[1], pfn.proargtypes[2])) + OR (pfn.pronargs > 3 AND + NOT binary_coercible(p.proargtypes[2], pfn.proargtypes[3])) + -- we could carry the check further, but 4 args is enough for now + OR (pfn.pronargs > 4) + ); + +-- If transfn is strict then either initval should be non-NULL, or +-- input type should match transtype so that the first non-null input +-- can be assigned as the state value. + +SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname +FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr +WHERE a.aggfnoid = p.oid AND + a.aggtransfn = ptr.oid AND ptr.proisstrict AND + a.agginitval IS NULL AND + NOT binary_coercible(p.proargtypes[0], a.aggtranstype); + +-- Check for inconsistent specifications of moving-aggregate columns. + +SELECT ctid, aggfnoid::oid +FROM pg_aggregate as p1 +WHERE aggmtranstype != 0 AND + (aggmtransfn = 0 OR aggminvtransfn = 0); + +SELECT ctid, aggfnoid::oid +FROM pg_aggregate as p1 +WHERE aggmtranstype = 0 AND + (aggmtransfn != 0 OR aggminvtransfn != 0 OR aggmfinalfn != 0 OR + aggmtransspace != 0 OR aggminitval IS NOT NULL); + +-- If there is no mfinalfn then the output type must be the mtranstype. + +SELECT a.aggfnoid::oid, p.proname +FROM pg_aggregate as a, pg_proc as p +WHERE a.aggfnoid = p.oid AND + a.aggmtransfn != 0 AND + a.aggmfinalfn = 0 AND p.prorettype != a.aggmtranstype; + +-- Cross-check mtransfn (if present) against its entry in pg_proc. +SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname +FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr +WHERE a.aggfnoid = p.oid AND + a.aggmtransfn = ptr.oid AND + (ptr.proretset + OR NOT (ptr.pronargs = + CASE WHEN a.aggkind = 'n' THEN p.pronargs + 1 + ELSE greatest(p.pronargs - a.aggnumdirectargs, 1) + 1 END) + OR NOT binary_coercible(ptr.prorettype, a.aggmtranstype) + OR NOT binary_coercible(a.aggmtranstype, ptr.proargtypes[0]) + OR (p.pronargs > 0 AND + NOT binary_coercible(p.proargtypes[0], ptr.proargtypes[1])) + OR (p.pronargs > 1 AND + NOT binary_coercible(p.proargtypes[1], ptr.proargtypes[2])) + OR (p.pronargs > 2 AND + NOT binary_coercible(p.proargtypes[2], ptr.proargtypes[3])) + -- we could carry the check further, but 3 args is enough for now + OR (p.pronargs > 3) + ); + +-- Cross-check minvtransfn (if present) against its entry in pg_proc. +SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname +FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr +WHERE a.aggfnoid = p.oid AND + a.aggminvtransfn = ptr.oid AND + (ptr.proretset + OR NOT (ptr.pronargs = + CASE WHEN a.aggkind = 'n' THEN p.pronargs + 1 + ELSE greatest(p.pronargs - a.aggnumdirectargs, 1) + 1 END) + OR NOT binary_coercible(ptr.prorettype, a.aggmtranstype) + OR NOT binary_coercible(a.aggmtranstype, ptr.proargtypes[0]) + OR (p.pronargs > 0 AND + NOT binary_coercible(p.proargtypes[0], ptr.proargtypes[1])) + OR (p.pronargs > 1 AND + NOT binary_coercible(p.proargtypes[1], ptr.proargtypes[2])) + OR (p.pronargs > 2 AND + NOT binary_coercible(p.proargtypes[2], ptr.proargtypes[3])) + -- we could carry the check further, but 3 args is enough for now + OR (p.pronargs > 3) + ); + +-- Cross-check mfinalfn (if present) against its entry in pg_proc. + +SELECT a.aggfnoid::oid, p.proname, pfn.oid, pfn.proname +FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS pfn +WHERE a.aggfnoid = p.oid AND + a.aggmfinalfn = pfn.oid AND + (pfn.proretset OR + NOT binary_coercible(pfn.prorettype, p.prorettype) OR + NOT binary_coercible(a.aggmtranstype, pfn.proargtypes[0]) OR + CASE WHEN a.aggmfinalextra THEN pfn.pronargs != p.pronargs + 1 + ELSE pfn.pronargs != a.aggnumdirectargs + 1 END + OR (pfn.pronargs > 1 AND + NOT binary_coercible(p.proargtypes[0], pfn.proargtypes[1])) + OR (pfn.pronargs > 2 AND + NOT binary_coercible(p.proargtypes[1], pfn.proargtypes[2])) + OR (pfn.pronargs > 3 AND + NOT binary_coercible(p.proargtypes[2], pfn.proargtypes[3])) + -- we could carry the check further, but 4 args is enough for now + OR (pfn.pronargs > 4) + ); + +-- If mtransfn is strict then either minitval should be non-NULL, or +-- input type should match mtranstype so that the first non-null input +-- can be assigned as the state value. + +SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname +FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr +WHERE a.aggfnoid = p.oid AND + a.aggmtransfn = ptr.oid AND ptr.proisstrict AND + a.aggminitval IS NULL AND + NOT binary_coercible(p.proargtypes[0], a.aggmtranstype); + +-- mtransfn and minvtransfn should have same strictness setting. + +SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname, iptr.oid, iptr.proname +FROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr, pg_proc AS iptr +WHERE a.aggfnoid = p.oid AND + a.aggmtransfn = ptr.oid AND + a.aggminvtransfn = iptr.oid AND + ptr.proisstrict != iptr.proisstrict; + +-- Check that all combine functions have signature +-- combine(transtype, transtype) returns transtype + +SELECT a.aggfnoid, p.proname +FROM pg_aggregate as a, pg_proc as p +WHERE a.aggcombinefn = p.oid AND + (p.pronargs != 2 OR + p.prorettype != p.proargtypes[0] OR + p.prorettype != p.proargtypes[1] OR + NOT binary_coercible(a.aggtranstype, p.proargtypes[0])); + +-- Check that no combine function for an INTERNAL transtype is strict. + +SELECT a.aggfnoid, p.proname +FROM pg_aggregate as a, pg_proc as p +WHERE a.aggcombinefn = p.oid AND + a.aggtranstype = 'internal'::regtype AND p.proisstrict; + +-- serialize/deserialize functions should be specified only for aggregates +-- with transtype internal and a combine function, and we should have both +-- or neither of them. + +SELECT aggfnoid, aggtranstype, aggserialfn, aggdeserialfn +FROM pg_aggregate +WHERE (aggserialfn != 0 OR aggdeserialfn != 0) + AND (aggtranstype != 'internal'::regtype OR aggcombinefn = 0 OR + aggserialfn = 0 OR aggdeserialfn = 0); + +-- Check that all serialization functions have signature +-- serialize(internal) returns bytea +-- Also insist that they be strict; it's wasteful to run them on NULLs. + +SELECT a.aggfnoid, p.proname +FROM pg_aggregate as a, pg_proc as p +WHERE a.aggserialfn = p.oid AND + (p.prorettype != 'bytea'::regtype OR p.pronargs != 1 OR + p.proargtypes[0] != 'internal'::regtype OR + NOT p.proisstrict); + +-- Check that all deserialization functions have signature +-- deserialize(bytea, internal) returns internal +-- Also insist that they be strict; it's wasteful to run them on NULLs. + +SELECT a.aggfnoid, p.proname +FROM pg_aggregate as a, pg_proc as p +WHERE a.aggdeserialfn = p.oid AND + (p.prorettype != 'internal'::regtype OR p.pronargs != 2 OR + p.proargtypes[0] != 'bytea'::regtype OR + p.proargtypes[1] != 'internal'::regtype OR + NOT p.proisstrict); + +-- Check that aggregates which have the same transition function also have +-- the same combine, serialization, and deserialization functions. +-- While that isn't strictly necessary, it's fishy if they don't. + +SELECT a.aggfnoid, a.aggcombinefn, a.aggserialfn, a.aggdeserialfn, + b.aggfnoid, b.aggcombinefn, b.aggserialfn, b.aggdeserialfn +FROM + pg_aggregate a, pg_aggregate b +WHERE + a.aggfnoid < b.aggfnoid AND a.aggtransfn = b.aggtransfn AND + (a.aggcombinefn != b.aggcombinefn OR a.aggserialfn != b.aggserialfn + OR a.aggdeserialfn != b.aggdeserialfn); + +-- Cross-check aggsortop (if present) against pg_operator. +-- We expect to find entries for bool_and, bool_or, every, max, and min. + +SELECT DISTINCT proname, oprname +FROM pg_operator AS o, pg_aggregate AS a, pg_proc AS p +WHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid +ORDER BY 1, 2; + +-- Check datatypes match + +SELECT a.aggfnoid::oid, o.oid +FROM pg_operator AS o, pg_aggregate AS a, pg_proc AS p +WHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid AND + (oprkind != 'b' OR oprresult != 'boolean'::regtype + OR oprleft != p.proargtypes[0] OR oprright != p.proargtypes[0]); + +-- Check operator is a suitable btree opfamily member + +SELECT a.aggfnoid::oid, o.oid +FROM pg_operator AS o, pg_aggregate AS a, pg_proc AS p +WHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid AND + NOT EXISTS(SELECT 1 FROM pg_amop + WHERE amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree') + AND amopopr = o.oid + AND amoplefttype = o.oprleft + AND amoprighttype = o.oprright); + +-- Check correspondence of btree strategies and names + +SELECT DISTINCT proname, oprname, amopstrategy +FROM pg_operator AS o, pg_aggregate AS a, pg_proc AS p, + pg_amop as ao +WHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid AND + amopopr = o.oid AND + amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree') +ORDER BY 1, 2; + +-- Check that there are not aggregates with the same name and different +-- numbers of arguments. While not technically wrong, we have a project policy +-- to avoid this because it opens the door for confusion in connection with +-- ORDER BY: novices frequently put the ORDER BY in the wrong place. +-- See the fate of the single-argument form of string_agg() for history. +-- (Note: we don't forbid users from creating such aggregates; the policy is +-- just to think twice before creating built-in aggregates like this.) +-- The only aggregates that should show up here are count(x) and count(*). + +SELECT p1.oid::regprocedure, p2.oid::regprocedure +FROM pg_proc AS p1, pg_proc AS p2 +WHERE p1.oid < p2.oid AND p1.proname = p2.proname AND + p1.prokind = 'a' AND p2.prokind = 'a' AND + array_dims(p1.proargtypes) != array_dims(p2.proargtypes) +ORDER BY 1; + +-- For the same reason, built-in aggregates with default arguments are no good. + +SELECT oid, proname +FROM pg_proc AS p +WHERE prokind = 'a' AND proargdefaults IS NOT NULL; + +-- For the same reason, we avoid creating built-in variadic aggregates, except +-- that variadic ordered-set aggregates are OK (since they have special syntax +-- that is not subject to the misplaced ORDER BY issue). + +SELECT p.oid, proname +FROM pg_proc AS p JOIN pg_aggregate AS a ON a.aggfnoid = p.oid +WHERE prokind = 'a' AND provariadic != 0 AND a.aggkind = 'n'; + + +-- **************** pg_opfamily **************** + +-- Look for illegal values in pg_opfamily fields + +SELECT p1.oid +FROM pg_opfamily as p1 +WHERE p1.opfmethod = 0 OR p1.opfnamespace = 0; + +-- Look for opfamilies having no opclasses. While most validation of +-- opfamilies is now handled by AM-specific amvalidate functions, that's +-- driven from pg_opclass entries below, so an empty opfamily would not +-- get noticed. + +SELECT oid, opfname FROM pg_opfamily f +WHERE NOT EXISTS (SELECT 1 FROM pg_opclass WHERE opcfamily = f.oid); + + +-- **************** pg_opclass **************** + +-- Look for illegal values in pg_opclass fields + +SELECT p1.oid +FROM pg_opclass AS p1 +WHERE p1.opcmethod = 0 OR p1.opcnamespace = 0 OR p1.opcfamily = 0 + OR p1.opcintype = 0; + +-- opcmethod must match owning opfamily's opfmethod + +SELECT p1.oid, p2.oid +FROM pg_opclass AS p1, pg_opfamily AS p2 +WHERE p1.opcfamily = p2.oid AND p1.opcmethod != p2.opfmethod; + +-- There should not be multiple entries in pg_opclass with opcdefault true +-- and the same opcmethod/opcintype combination. + +SELECT p1.oid, p2.oid +FROM pg_opclass AS p1, pg_opclass AS p2 +WHERE p1.oid != p2.oid AND + p1.opcmethod = p2.opcmethod AND p1.opcintype = p2.opcintype AND + p1.opcdefault AND p2.opcdefault; + +-- Ask access methods to validate opclasses +-- (this replaces a lot of SQL-level checks that used to be done in this file) + +SELECT oid, opcname FROM pg_opclass WHERE NOT amvalidate(oid); + + +-- **************** pg_am **************** + +-- Look for illegal values in pg_am fields + +SELECT p1.oid, p1.amname +FROM pg_am AS p1 +WHERE p1.amhandler = 0; + +-- Check for index amhandler functions with the wrong signature + +SELECT p1.oid, p1.amname, p2.oid, p2.proname +FROM pg_am AS p1, pg_proc AS p2 +WHERE p2.oid = p1.amhandler AND p1.amtype = 'i' AND + (p2.prorettype != 'index_am_handler'::regtype + OR p2.proretset + OR p2.pronargs != 1 + OR p2.proargtypes[0] != 'internal'::regtype); + +-- Check for table amhandler functions with the wrong signature + +SELECT p1.oid, p1.amname, p2.oid, p2.proname +FROM pg_am AS p1, pg_proc AS p2 +WHERE p2.oid = p1.amhandler AND p1.amtype = 's' AND + (p2.prorettype != 'table_am_handler'::regtype + OR p2.proretset + OR p2.pronargs != 1 + OR p2.proargtypes[0] != 'internal'::regtype); + +-- **************** pg_amop **************** + +-- Look for illegal values in pg_amop fields + +SELECT p1.amopfamily, p1.amopstrategy +FROM pg_amop as p1 +WHERE p1.amopfamily = 0 OR p1.amoplefttype = 0 OR p1.amoprighttype = 0 + OR p1.amopopr = 0 OR p1.amopmethod = 0 OR p1.amopstrategy < 1; + +SELECT p1.amopfamily, p1.amopstrategy +FROM pg_amop as p1 +WHERE NOT ((p1.amoppurpose = 's' AND p1.amopsortfamily = 0) OR + (p1.amoppurpose = 'o' AND p1.amopsortfamily <> 0)); + +-- amopmethod must match owning opfamily's opfmethod + +SELECT p1.oid, p2.oid +FROM pg_amop AS p1, pg_opfamily AS p2 +WHERE p1.amopfamily = p2.oid AND p1.amopmethod != p2.opfmethod; + +-- Make a list of all the distinct operator names being used in particular +-- strategy slots. This is a bit hokey, since the list might need to change +-- in future releases, but it's an effective way of spotting mistakes such as +-- swapping two operators within a family. + +SELECT DISTINCT amopmethod, amopstrategy, oprname +FROM pg_amop p1 LEFT JOIN pg_operator p2 ON amopopr = p2.oid +ORDER BY 1, 2, 3; + +-- Check that all opclass search operators have selectivity estimators. +-- This is not absolutely required, but it seems a reasonable thing +-- to insist on for all standard datatypes. + +SELECT p1.amopfamily, p1.amopopr, p2.oid, p2.oprname +FROM pg_amop AS p1, pg_operator AS p2 +WHERE p1.amopopr = p2.oid AND p1.amoppurpose = 's' AND + (p2.oprrest = 0 OR p2.oprjoin = 0); + +-- Check that each opclass in an opfamily has associated operators, that is +-- ones whose oprleft matches opcintype (possibly by coercion). + +SELECT p1.opcname, p1.opcfamily +FROM pg_opclass AS p1 +WHERE NOT EXISTS(SELECT 1 FROM pg_amop AS p2 + WHERE p2.amopfamily = p1.opcfamily + AND binary_coercible(p1.opcintype, p2.amoplefttype)); + +-- Check that each operator listed in pg_amop has an associated opclass, +-- that is one whose opcintype matches oprleft (possibly by coercion). +-- Otherwise the operator is useless because it cannot be matched to an index. +-- (In principle it could be useful to list such operators in multiple-datatype +-- btree opfamilies, but in practice you'd expect there to be an opclass for +-- every datatype the family knows about.) + +SELECT p1.amopfamily, p1.amopstrategy, p1.amopopr +FROM pg_amop AS p1 +WHERE NOT EXISTS(SELECT 1 FROM pg_opclass AS p2 + WHERE p2.opcfamily = p1.amopfamily + AND binary_coercible(p2.opcintype, p1.amoplefttype)); + +-- Operators that are primary members of opclasses must be immutable (else +-- it suggests that the index ordering isn't fixed). Operators that are +-- cross-type members need only be stable, since they are just shorthands +-- for index probe queries. + +SELECT p1.amopfamily, p1.amopopr, p2.oprname, p3.prosrc +FROM pg_amop AS p1, pg_operator AS p2, pg_proc AS p3 +WHERE p1.amopopr = p2.oid AND p2.oprcode = p3.oid AND + p1.amoplefttype = p1.amoprighttype AND + p3.provolatile != 'i'; + +SELECT p1.amopfamily, p1.amopopr, p2.oprname, p3.prosrc +FROM pg_amop AS p1, pg_operator AS p2, pg_proc AS p3 +WHERE p1.amopopr = p2.oid AND p2.oprcode = p3.oid AND + p1.amoplefttype != p1.amoprighttype AND + p3.provolatile = 'v'; + + +-- **************** pg_amproc **************** + +-- Look for illegal values in pg_amproc fields + +SELECT p1.amprocfamily, p1.amprocnum +FROM pg_amproc as p1 +WHERE p1.amprocfamily = 0 OR p1.amproclefttype = 0 OR p1.amprocrighttype = 0 + OR p1.amprocnum < 0 OR p1.amproc = 0; + +-- Support routines that are primary members of opfamilies must be immutable +-- (else it suggests that the index ordering isn't fixed). But cross-type +-- members need only be stable, since they are just shorthands +-- for index probe queries. + +SELECT p1.amprocfamily, p1.amproc, p2.prosrc +FROM pg_amproc AS p1, pg_proc AS p2 +WHERE p1.amproc = p2.oid AND + p1.amproclefttype = p1.amprocrighttype AND + p2.provolatile != 'i'; + +SELECT p1.amprocfamily, p1.amproc, p2.prosrc +FROM pg_amproc AS p1, pg_proc AS p2 +WHERE p1.amproc = p2.oid AND + p1.amproclefttype != p1.amprocrighttype AND + p2.provolatile = 'v'; + +-- Almost all of the core distribution's Btree opclasses can use one of the +-- two generic "equalimage" functions as their support function 4. Look for +-- opclasses that don't allow deduplication unconditionally here. +-- +-- Newly added Btree opclasses don't have to support deduplication. It will +-- usually be trivial to add support, though. Note that the expected output +-- of this part of the test will need to be updated when a new opclass cannot +-- support deduplication (by using btequalimage). +SELECT amp.amproc::regproc AS proc, opf.opfname AS opfamily_name, + opc.opcname AS opclass_name, opc.opcintype::regtype AS opcintype +FROM pg_am AS am +JOIN pg_opclass AS opc ON opc.opcmethod = am.oid +JOIN pg_opfamily AS opf ON opc.opcfamily = opf.oid +LEFT JOIN pg_amproc AS amp ON amp.amprocfamily = opf.oid AND + amp.amproclefttype = opc.opcintype AND amp.amprocnum = 4 +WHERE am.amname = 'btree' AND + amp.amproc IS DISTINCT FROM 'btequalimage'::regproc +ORDER BY 1, 2, 3; + +-- **************** pg_index **************** + +-- Look for illegal values in pg_index fields. + +SELECT p1.indexrelid, p1.indrelid +FROM pg_index as p1 +WHERE p1.indexrelid = 0 OR p1.indrelid = 0 OR + p1.indnatts <= 0 OR p1.indnatts > 32; + +-- oidvector and int2vector fields should be of length indnatts. + +SELECT p1.indexrelid, p1.indrelid +FROM pg_index as p1 +WHERE array_lower(indkey, 1) != 0 OR array_upper(indkey, 1) != indnatts-1 OR + array_lower(indclass, 1) != 0 OR array_upper(indclass, 1) != indnatts-1 OR + array_lower(indcollation, 1) != 0 OR array_upper(indcollation, 1) != indnatts-1 OR + array_lower(indoption, 1) != 0 OR array_upper(indoption, 1) != indnatts-1; + +-- Check that opclasses and collations match the underlying columns. +-- (As written, this test ignores expression indexes.) + +SELECT indexrelid::regclass, indrelid::regclass, attname, atttypid::regtype, opcname +FROM (SELECT indexrelid, indrelid, unnest(indkey) as ikey, + unnest(indclass) as iclass, unnest(indcollation) as icoll + FROM pg_index) ss, + pg_attribute a, + pg_opclass opc +WHERE a.attrelid = indrelid AND a.attnum = ikey AND opc.oid = iclass AND + (NOT binary_coercible(atttypid, opcintype) OR icoll != attcollation); + +-- For system catalogs, be even tighter: nearly all indexes should be +-- exact type matches not binary-coercible matches. At this writing +-- the only exception is an OID index on a regproc column. + +SELECT indexrelid::regclass, indrelid::regclass, attname, atttypid::regtype, opcname +FROM (SELECT indexrelid, indrelid, unnest(indkey) as ikey, + unnest(indclass) as iclass, unnest(indcollation) as icoll + FROM pg_index + WHERE indrelid < 16384) ss, + pg_attribute a, + pg_opclass opc +WHERE a.attrelid = indrelid AND a.attnum = ikey AND opc.oid = iclass AND + (opcintype != atttypid OR icoll != attcollation) +ORDER BY 1; + +-- Check for system catalogs with collation-sensitive ordering. This is not +-- a representational error in pg_index, but simply wrong catalog design. +-- It's bad because we expect to be able to clone template0 and assign the +-- copy a different database collation. It would especially not work for +-- shared catalogs. + +SELECT relname, attname, attcollation +FROM pg_class c, pg_attribute a +WHERE c.oid = attrelid AND c.oid < 16384 AND + c.relkind != 'v' AND -- we don't care about columns in views + attcollation != 0 AND + attcollation != (SELECT oid FROM pg_collation WHERE collname = 'C'); + +-- Double-check that collation-sensitive indexes have "C" collation, too. + +SELECT indexrelid::regclass, indrelid::regclass, iclass, icoll +FROM (SELECT indexrelid, indrelid, + unnest(indclass) as iclass, unnest(indcollation) as icoll + FROM pg_index + WHERE indrelid < 16384) ss +WHERE icoll != 0 AND + icoll != (SELECT oid FROM pg_collation WHERE collname = 'C'); diff --git a/postgresql/examples/partition_aggregate.sql b/postgresql/examples/partition_aggregate.sql new file mode 100644 index 0000000..117f65e --- /dev/null +++ b/postgresql/examples/partition_aggregate.sql @@ -0,0 +1,332 @@ +-- +-- PARTITION_AGGREGATE +-- Test partitionwise aggregation on partitioned tables +-- +-- Note: to ensure plan stability, it's a good idea to make the partitions of +-- any one partitioned table in this test all have different numbers of rows. +-- + +-- Enable partitionwise aggregate, which by default is disabled. +SET enable_partitionwise_aggregate TO true; +-- Enable partitionwise join, which by default is disabled. +SET enable_partitionwise_join TO true; +-- Disable parallel plans. +SET max_parallel_workers_per_gather TO 0; +-- Disable incremental sort, which can influence selected plans due to fuzz factor. +SET enable_incremental_sort TO off; + +-- +-- Tests for list partitioned tables. +-- +CREATE TABLE pagg_tab (a int, b int, c text, d int) PARTITION BY LIST(c); +CREATE TABLE pagg_tab_p1 PARTITION OF pagg_tab FOR VALUES IN ('0000', '0001', '0002', '0003', '0004'); +CREATE TABLE pagg_tab_p2 PARTITION OF pagg_tab FOR VALUES IN ('0005', '0006', '0007', '0008'); +CREATE TABLE pagg_tab_p3 PARTITION OF pagg_tab FOR VALUES IN ('0009', '0010', '0011'); +INSERT INTO pagg_tab SELECT i % 20, i % 30, to_char(i % 12, 'FM0000'), i % 30 FROM generate_series(0, 2999) i; +ANALYZE pagg_tab; + +-- When GROUP BY clause matches; full aggregation is performed for each partition. +EXPLAIN (COSTS OFF) +SELECT c, sum(a), avg(b), count(*), min(a), max(b) FROM pagg_tab GROUP BY c HAVING avg(d) < 15 ORDER BY 1, 2, 3; +SELECT c, sum(a), avg(b), count(*), min(a), max(b) FROM pagg_tab GROUP BY c HAVING avg(d) < 15 ORDER BY 1, 2, 3; + +-- When GROUP BY clause does not match; partial aggregation is performed for each partition. +EXPLAIN (COSTS OFF) +SELECT a, sum(b), avg(b), count(*), min(a), max(b) FROM pagg_tab GROUP BY a HAVING avg(d) < 15 ORDER BY 1, 2, 3; +SELECT a, sum(b), avg(b), count(*), min(a), max(b) FROM pagg_tab GROUP BY a HAVING avg(d) < 15 ORDER BY 1, 2, 3; + +-- Check with multiple columns in GROUP BY +EXPLAIN (COSTS OFF) +SELECT a, c, count(*) FROM pagg_tab GROUP BY a, c; +-- Check with multiple columns in GROUP BY, order in GROUP BY is reversed +EXPLAIN (COSTS OFF) +SELECT a, c, count(*) FROM pagg_tab GROUP BY c, a; +-- Check with multiple columns in GROUP BY, order in target-list is reversed +EXPLAIN (COSTS OFF) +SELECT c, a, count(*) FROM pagg_tab GROUP BY a, c; + +-- Test when input relation for grouping is dummy +EXPLAIN (COSTS OFF) +SELECT c, sum(a) FROM pagg_tab WHERE 1 = 2 GROUP BY c; +SELECT c, sum(a) FROM pagg_tab WHERE 1 = 2 GROUP BY c; +EXPLAIN (COSTS OFF) +SELECT c, sum(a) FROM pagg_tab WHERE c = 'x' GROUP BY c; +SELECT c, sum(a) FROM pagg_tab WHERE c = 'x' GROUP BY c; + +-- Test GroupAggregate paths by disabling hash aggregates. +SET enable_hashagg TO false; + +-- When GROUP BY clause matches full aggregation is performed for each partition. +EXPLAIN (COSTS OFF) +SELECT c, sum(a), avg(b), count(*) FROM pagg_tab GROUP BY 1 HAVING avg(d) < 15 ORDER BY 1, 2, 3; +SELECT c, sum(a), avg(b), count(*) FROM pagg_tab GROUP BY 1 HAVING avg(d) < 15 ORDER BY 1, 2, 3; + +-- When GROUP BY clause does not match; partial aggregation is performed for each partition. +EXPLAIN (COSTS OFF) +SELECT a, sum(b), avg(b), count(*) FROM pagg_tab GROUP BY 1 HAVING avg(d) < 15 ORDER BY 1, 2, 3; +SELECT a, sum(b), avg(b), count(*) FROM pagg_tab GROUP BY 1 HAVING avg(d) < 15 ORDER BY 1, 2, 3; + +-- Test partitionwise grouping without any aggregates +EXPLAIN (COSTS OFF) +SELECT c FROM pagg_tab GROUP BY c ORDER BY 1; +SELECT c FROM pagg_tab GROUP BY c ORDER BY 1; +EXPLAIN (COSTS OFF) +SELECT a FROM pagg_tab WHERE a < 3 GROUP BY a ORDER BY 1; +SELECT a FROM pagg_tab WHERE a < 3 GROUP BY a ORDER BY 1; + +RESET enable_hashagg; + +-- ROLLUP, partitionwise aggregation does not apply +EXPLAIN (COSTS OFF) +SELECT c, sum(a) FROM pagg_tab GROUP BY rollup(c) ORDER BY 1, 2; + +-- ORDERED SET within the aggregate. +-- Full aggregation; since all the rows that belong to the same group come +-- from the same partition, having an ORDER BY within the aggregate doesn't +-- make any difference. +EXPLAIN (COSTS OFF) +SELECT c, sum(b order by a) FROM pagg_tab GROUP BY c ORDER BY 1, 2; +-- Since GROUP BY clause does not match with PARTITION KEY; we need to do +-- partial aggregation. However, ORDERED SET are not partial safe and thus +-- partitionwise aggregation plan is not generated. +EXPLAIN (COSTS OFF) +SELECT a, sum(b order by a) FROM pagg_tab GROUP BY a ORDER BY 1, 2; + + +-- JOIN query + +CREATE TABLE pagg_tab1(x int, y int) PARTITION BY RANGE(x); +CREATE TABLE pagg_tab1_p1 PARTITION OF pagg_tab1 FOR VALUES FROM (0) TO (10); +CREATE TABLE pagg_tab1_p2 PARTITION OF pagg_tab1 FOR VALUES FROM (10) TO (20); +CREATE TABLE pagg_tab1_p3 PARTITION OF pagg_tab1 FOR VALUES FROM (20) TO (30); + +CREATE TABLE pagg_tab2(x int, y int) PARTITION BY RANGE(y); +CREATE TABLE pagg_tab2_p1 PARTITION OF pagg_tab2 FOR VALUES FROM (0) TO (10); +CREATE TABLE pagg_tab2_p2 PARTITION OF pagg_tab2 FOR VALUES FROM (10) TO (20); +CREATE TABLE pagg_tab2_p3 PARTITION OF pagg_tab2 FOR VALUES FROM (20) TO (30); + +INSERT INTO pagg_tab1 SELECT i % 30, i % 20 FROM generate_series(0, 299, 2) i; +INSERT INTO pagg_tab2 SELECT i % 20, i % 30 FROM generate_series(0, 299, 3) i; + +ANALYZE pagg_tab1; +ANALYZE pagg_tab2; + +-- When GROUP BY clause matches; full aggregation is performed for each partition. +EXPLAIN (COSTS OFF) +SELECT t1.x, sum(t1.y), count(*) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t2.y GROUP BY t1.x ORDER BY 1, 2, 3; +SELECT t1.x, sum(t1.y), count(*) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t2.y GROUP BY t1.x ORDER BY 1, 2, 3; + +-- Check with whole-row reference; partitionwise aggregation does not apply +EXPLAIN (COSTS OFF) +SELECT t1.x, sum(t1.y), count(t1) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t2.y GROUP BY t1.x ORDER BY 1, 2, 3; +SELECT t1.x, sum(t1.y), count(t1) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t2.y GROUP BY t1.x ORDER BY 1, 2, 3; + +-- GROUP BY having other matching key +EXPLAIN (COSTS OFF) +SELECT t2.y, sum(t1.y), count(*) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t2.y GROUP BY t2.y ORDER BY 1, 2, 3; + +-- When GROUP BY clause does not match; partial aggregation is performed for each partition. +-- Also test GroupAggregate paths by disabling hash aggregates. +SET enable_hashagg TO false; +EXPLAIN (COSTS OFF) +SELECT t1.y, sum(t1.x), count(*) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t2.y GROUP BY t1.y HAVING avg(t1.x) > 10 ORDER BY 1, 2, 3; +SELECT t1.y, sum(t1.x), count(*) FROM pagg_tab1 t1, pagg_tab2 t2 WHERE t1.x = t2.y GROUP BY t1.y HAVING avg(t1.x) > 10 ORDER BY 1, 2, 3; +RESET enable_hashagg; + +-- Check with LEFT/RIGHT/FULL OUTER JOINs which produces NULL values for +-- aggregation + +-- LEFT JOIN, should produce partial partitionwise aggregation plan as +-- GROUP BY is on nullable column +EXPLAIN (COSTS OFF) +SELECT b.y, sum(a.y) FROM pagg_tab1 a LEFT JOIN pagg_tab2 b ON a.x = b.y GROUP BY b.y ORDER BY 1 NULLS LAST; +SELECT b.y, sum(a.y) FROM pagg_tab1 a LEFT JOIN pagg_tab2 b ON a.x = b.y GROUP BY b.y ORDER BY 1 NULLS LAST; + +-- RIGHT JOIN, should produce full partitionwise aggregation plan as +-- GROUP BY is on non-nullable column +EXPLAIN (COSTS OFF) +SELECT b.y, sum(a.y) FROM pagg_tab1 a RIGHT JOIN pagg_tab2 b ON a.x = b.y GROUP BY b.y ORDER BY 1 NULLS LAST; +SELECT b.y, sum(a.y) FROM pagg_tab1 a RIGHT JOIN pagg_tab2 b ON a.x = b.y GROUP BY b.y ORDER BY 1 NULLS LAST; + +-- FULL JOIN, should produce partial partitionwise aggregation plan as +-- GROUP BY is on nullable column +EXPLAIN (COSTS OFF) +SELECT a.x, sum(b.x) FROM pagg_tab1 a FULL OUTER JOIN pagg_tab2 b ON a.x = b.y GROUP BY a.x ORDER BY 1 NULLS LAST; +SELECT a.x, sum(b.x) FROM pagg_tab1 a FULL OUTER JOIN pagg_tab2 b ON a.x = b.y GROUP BY a.x ORDER BY 1 NULLS LAST; + +-- LEFT JOIN, with dummy relation on right side, ideally +-- should produce full partitionwise aggregation plan as GROUP BY is on +-- non-nullable columns. +-- But right now we are unable to do partitionwise join in this case. +EXPLAIN (COSTS OFF) +SELECT a.x, b.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x < 20) a LEFT JOIN (SELECT * FROM pagg_tab2 WHERE y > 10) b ON a.x = b.y WHERE a.x > 5 or b.y < 20 GROUP BY a.x, b.y ORDER BY 1, 2; +SELECT a.x, b.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x < 20) a LEFT JOIN (SELECT * FROM pagg_tab2 WHERE y > 10) b ON a.x = b.y WHERE a.x > 5 or b.y < 20 GROUP BY a.x, b.y ORDER BY 1, 2; + +-- FULL JOIN, with dummy relations on both sides, ideally +-- should produce partial partitionwise aggregation plan as GROUP BY is on +-- nullable columns. +-- But right now we are unable to do partitionwise join in this case. +EXPLAIN (COSTS OFF) +SELECT a.x, b.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x < 20) a FULL JOIN (SELECT * FROM pagg_tab2 WHERE y > 10) b ON a.x = b.y WHERE a.x > 5 or b.y < 20 GROUP BY a.x, b.y ORDER BY 1, 2; +SELECT a.x, b.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x < 20) a FULL JOIN (SELECT * FROM pagg_tab2 WHERE y > 10) b ON a.x = b.y WHERE a.x > 5 or b.y < 20 GROUP BY a.x, b.y ORDER BY 1, 2; + +-- Empty join relation because of empty outer side, no partitionwise agg plan +EXPLAIN (COSTS OFF) +SELECT a.x, a.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x = 1 AND x = 2) a LEFT JOIN pagg_tab2 b ON a.x = b.y GROUP BY a.x, a.y ORDER BY 1, 2; +SELECT a.x, a.y, count(*) FROM (SELECT * FROM pagg_tab1 WHERE x = 1 AND x = 2) a LEFT JOIN pagg_tab2 b ON a.x = b.y GROUP BY a.x, a.y ORDER BY 1, 2; + + +-- Partition by multiple columns + +CREATE TABLE pagg_tab_m (a int, b int, c int) PARTITION BY RANGE(a, ((a+b)/2)); +CREATE TABLE pagg_tab_m_p1 PARTITION OF pagg_tab_m FOR VALUES FROM (0, 0) TO (12, 12); +CREATE TABLE pagg_tab_m_p2 PARTITION OF pagg_tab_m FOR VALUES FROM (12, 12) TO (22, 22); +CREATE TABLE pagg_tab_m_p3 PARTITION OF pagg_tab_m FOR VALUES FROM (22, 22) TO (30, 30); +INSERT INTO pagg_tab_m SELECT i % 30, i % 40, i % 50 FROM generate_series(0, 2999) i; +ANALYZE pagg_tab_m; + +-- Partial aggregation as GROUP BY clause does not match with PARTITION KEY +EXPLAIN (COSTS OFF) +SELECT a, sum(b), avg(c), count(*) FROM pagg_tab_m GROUP BY a HAVING avg(c) < 22 ORDER BY 1, 2, 3; +SELECT a, sum(b), avg(c), count(*) FROM pagg_tab_m GROUP BY a HAVING avg(c) < 22 ORDER BY 1, 2, 3; + +-- Full aggregation as GROUP BY clause matches with PARTITION KEY +EXPLAIN (COSTS OFF) +SELECT a, sum(b), avg(c), count(*) FROM pagg_tab_m GROUP BY a, (a+b)/2 HAVING sum(b) < 50 ORDER BY 1, 2, 3; +SELECT a, sum(b), avg(c), count(*) FROM pagg_tab_m GROUP BY a, (a+b)/2 HAVING sum(b) < 50 ORDER BY 1, 2, 3; + +-- Full aggregation as PARTITION KEY is part of GROUP BY clause +EXPLAIN (COSTS OFF) +SELECT a, c, sum(b), avg(c), count(*) FROM pagg_tab_m GROUP BY (a+b)/2, 2, 1 HAVING sum(b) = 50 AND avg(c) > 25 ORDER BY 1, 2, 3; +SELECT a, c, sum(b), avg(c), count(*) FROM pagg_tab_m GROUP BY (a+b)/2, 2, 1 HAVING sum(b) = 50 AND avg(c) > 25 ORDER BY 1, 2, 3; + + +-- Test with multi-level partitioning scheme + +CREATE TABLE pagg_tab_ml (a int, b int, c text) PARTITION BY RANGE(a); +CREATE TABLE pagg_tab_ml_p1 PARTITION OF pagg_tab_ml FOR VALUES FROM (0) TO (12); +CREATE TABLE pagg_tab_ml_p2 PARTITION OF pagg_tab_ml FOR VALUES FROM (12) TO (20) PARTITION BY LIST (c); +CREATE TABLE pagg_tab_ml_p2_s1 PARTITION OF pagg_tab_ml_p2 FOR VALUES IN ('0000', '0001', '0002'); +CREATE TABLE pagg_tab_ml_p2_s2 PARTITION OF pagg_tab_ml_p2 FOR VALUES IN ('0003'); + +-- This level of partitioning has different column positions than the parent +CREATE TABLE pagg_tab_ml_p3(b int, c text, a int) PARTITION BY RANGE (b); +CREATE TABLE pagg_tab_ml_p3_s1(c text, a int, b int); +CREATE TABLE pagg_tab_ml_p3_s2 PARTITION OF pagg_tab_ml_p3 FOR VALUES FROM (7) TO (10); + +ALTER TABLE pagg_tab_ml_p3 ATTACH PARTITION pagg_tab_ml_p3_s1 FOR VALUES FROM (0) TO (7); +ALTER TABLE pagg_tab_ml ATTACH PARTITION pagg_tab_ml_p3 FOR VALUES FROM (20) TO (30); + +INSERT INTO pagg_tab_ml SELECT i % 30, i % 10, to_char(i % 4, 'FM0000') FROM generate_series(0, 29999) i; +ANALYZE pagg_tab_ml; + +-- For Parallel Append +SET max_parallel_workers_per_gather TO 2; + +-- Full aggregation at level 1 as GROUP BY clause matches with PARTITION KEY +-- for level 1 only. For subpartitions, GROUP BY clause does not match with +-- PARTITION KEY, but still we do not see a partial aggregation as array_agg() +-- is not partial agg safe. +EXPLAIN (COSTS OFF) +SELECT a, sum(b), array_agg(distinct c), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER BY 1, 2, 3; +SELECT a, sum(b), array_agg(distinct c), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER BY 1, 2, 3; + +-- Without ORDER BY clause, to test Gather at top-most path +EXPLAIN (COSTS OFF) +SELECT a, sum(b), array_agg(distinct c), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3; + +-- Full aggregation at level 1 as GROUP BY clause matches with PARTITION KEY +-- for level 1 only. For subpartitions, GROUP BY clause does not match with +-- PARTITION KEY, thus we will have a partial aggregation for them. +EXPLAIN (COSTS OFF) +SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER BY 1, 2, 3; +SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER BY 1, 2, 3; + +-- Partial aggregation at all levels as GROUP BY clause does not match with +-- PARTITION KEY +EXPLAIN (COSTS OFF) +SELECT b, sum(a), count(*) FROM pagg_tab_ml GROUP BY b ORDER BY 1, 2, 3; +SELECT b, sum(a), count(*) FROM pagg_tab_ml GROUP BY b HAVING avg(a) < 15 ORDER BY 1, 2, 3; + +-- Full aggregation at all levels as GROUP BY clause matches with PARTITION KEY +EXPLAIN (COSTS OFF) +SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a, b, c HAVING avg(b) > 7 ORDER BY 1, 2, 3; +SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a, b, c HAVING avg(b) > 7 ORDER BY 1, 2, 3; + +-- Parallelism within partitionwise aggregates + +SET min_parallel_table_scan_size TO '8kB'; +SET parallel_setup_cost TO 0; + +-- Full aggregation at level 1 as GROUP BY clause matches with PARTITION KEY +-- for level 1 only. For subpartitions, GROUP BY clause does not match with +-- PARTITION KEY, thus we will have a partial aggregation for them. +EXPLAIN (COSTS OFF) +SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER BY 1, 2, 3; +SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a HAVING avg(b) < 3 ORDER BY 1, 2, 3; + +-- Partial aggregation at all levels as GROUP BY clause does not match with +-- PARTITION KEY +EXPLAIN (COSTS OFF) +SELECT b, sum(a), count(*) FROM pagg_tab_ml GROUP BY b ORDER BY 1, 2, 3; +SELECT b, sum(a), count(*) FROM pagg_tab_ml GROUP BY b HAVING avg(a) < 15 ORDER BY 1, 2, 3; + +-- Full aggregation at all levels as GROUP BY clause matches with PARTITION KEY +EXPLAIN (COSTS OFF) +SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a, b, c HAVING avg(b) > 7 ORDER BY 1, 2, 3; +SELECT a, sum(b), count(*) FROM pagg_tab_ml GROUP BY a, b, c HAVING avg(b) > 7 ORDER BY 1, 2, 3; + + +-- Parallelism within partitionwise aggregates (single level) + +-- Add few parallel setup cost, so that we will see a plan which gathers +-- partially created paths even for full aggregation and sticks a single Gather +-- followed by finalization step. +-- Without this, the cost of doing partial aggregation + Gather + finalization +-- for each partition and then Append over it turns out to be same and this +-- wins as we add it first. This parallel_setup_cost plays a vital role in +-- costing such plans. +SET parallel_setup_cost TO 10; + +CREATE TABLE pagg_tab_para(x int, y int) PARTITION BY RANGE(x); +CREATE TABLE pagg_tab_para_p1 PARTITION OF pagg_tab_para FOR VALUES FROM (0) TO (12); +CREATE TABLE pagg_tab_para_p2 PARTITION OF pagg_tab_para FOR VALUES FROM (12) TO (22); +CREATE TABLE pagg_tab_para_p3 PARTITION OF pagg_tab_para FOR VALUES FROM (22) TO (30); + +INSERT INTO pagg_tab_para SELECT i % 30, i % 20 FROM generate_series(0, 29999) i; + +ANALYZE pagg_tab_para; + +-- When GROUP BY clause matches; full aggregation is performed for each partition. +EXPLAIN (COSTS OFF) +SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; +SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; + +-- When GROUP BY clause does not match; partial aggregation is performed for each partition. +EXPLAIN (COSTS OFF) +SELECT y, sum(x), avg(x), count(*) FROM pagg_tab_para GROUP BY y HAVING avg(x) < 12 ORDER BY 1, 2, 3; +SELECT y, sum(x), avg(x), count(*) FROM pagg_tab_para GROUP BY y HAVING avg(x) < 12 ORDER BY 1, 2, 3; + +-- Test when parent can produce parallel paths but not any (or some) of its children +ALTER TABLE pagg_tab_para_p1 SET (parallel_workers = 0); +ALTER TABLE pagg_tab_para_p3 SET (parallel_workers = 0); +ANALYZE pagg_tab_para; + +EXPLAIN (COSTS OFF) +SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; +SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; + +ALTER TABLE pagg_tab_para_p2 SET (parallel_workers = 0); +ANALYZE pagg_tab_para; + +EXPLAIN (COSTS OFF) +SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; +SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; + +-- Reset parallelism parameters to get partitionwise aggregation plan. +RESET min_parallel_table_scan_size; +RESET parallel_setup_cost; + +EXPLAIN (COSTS OFF) +SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; +SELECT x, sum(y), avg(y), count(*) FROM pagg_tab_para GROUP BY x HAVING avg(y) < 7 ORDER BY 1, 2, 3; diff --git a/postgresql/examples/partition_info.sql b/postgresql/examples/partition_info.sql new file mode 100644 index 0000000..b5060be --- /dev/null +++ b/postgresql/examples/partition_info.sql @@ -0,0 +1,129 @@ +-- +-- Tests for functions providing information about partitions +-- +SELECT * FROM pg_partition_tree(NULL); +SELECT * FROM pg_partition_tree(0); +SELECT * FROM pg_partition_ancestors(NULL); +SELECT * FROM pg_partition_ancestors(0); +SELECT pg_partition_root(NULL); +SELECT pg_partition_root(0); + +-- Test table partition trees +CREATE TABLE ptif_test (a int, b int) PARTITION BY range (a); +CREATE TABLE ptif_test0 PARTITION OF ptif_test + FOR VALUES FROM (minvalue) TO (0) PARTITION BY list (b); +CREATE TABLE ptif_test01 PARTITION OF ptif_test0 FOR VALUES IN (1); +CREATE TABLE ptif_test1 PARTITION OF ptif_test + FOR VALUES FROM (0) TO (100) PARTITION BY list (b); +CREATE TABLE ptif_test11 PARTITION OF ptif_test1 FOR VALUES IN (1); +CREATE TABLE ptif_test2 PARTITION OF ptif_test + FOR VALUES FROM (100) TO (200); +-- This partitioned table should remain with no partitions. +CREATE TABLE ptif_test3 PARTITION OF ptif_test + FOR VALUES FROM (200) TO (maxvalue) PARTITION BY list (b); + +-- Test pg_partition_root for tables +SELECT pg_partition_root('ptif_test'); +SELECT pg_partition_root('ptif_test0'); +SELECT pg_partition_root('ptif_test01'); +SELECT pg_partition_root('ptif_test3'); + +-- Test index partition tree +CREATE INDEX ptif_test_index ON ONLY ptif_test (a); +CREATE INDEX ptif_test0_index ON ONLY ptif_test0 (a); +ALTER INDEX ptif_test_index ATTACH PARTITION ptif_test0_index; +CREATE INDEX ptif_test01_index ON ptif_test01 (a); +ALTER INDEX ptif_test0_index ATTACH PARTITION ptif_test01_index; +CREATE INDEX ptif_test1_index ON ONLY ptif_test1 (a); +ALTER INDEX ptif_test_index ATTACH PARTITION ptif_test1_index; +CREATE INDEX ptif_test11_index ON ptif_test11 (a); +ALTER INDEX ptif_test1_index ATTACH PARTITION ptif_test11_index; +CREATE INDEX ptif_test2_index ON ptif_test2 (a); +ALTER INDEX ptif_test_index ATTACH PARTITION ptif_test2_index; +CREATE INDEX ptif_test3_index ON ptif_test3 (a); +ALTER INDEX ptif_test_index ATTACH PARTITION ptif_test3_index; + +-- Test pg_partition_root for indexes +SELECT pg_partition_root('ptif_test_index'); +SELECT pg_partition_root('ptif_test0_index'); +SELECT pg_partition_root('ptif_test01_index'); +SELECT pg_partition_root('ptif_test3_index'); + +-- List all tables members of the tree +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_test'); +-- List tables from an intermediate level +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_test0') p + JOIN pg_class c ON (p.relid = c.oid); +-- List from leaf table +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_test01') p + JOIN pg_class c ON (p.relid = c.oid); +-- List from partitioned table with no partitions +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_test3') p + JOIN pg_class c ON (p.relid = c.oid); +-- List all ancestors of root and leaf tables +SELECT * FROM pg_partition_ancestors('ptif_test01'); +SELECT * FROM pg_partition_ancestors('ptif_test'); +-- List all members using pg_partition_root with leaf table reference +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree(pg_partition_root('ptif_test01')) p + JOIN pg_class c ON (p.relid = c.oid); + +-- List all indexes members of the tree +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_test_index'); +-- List indexes from an intermediate level +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_test0_index') p + JOIN pg_class c ON (p.relid = c.oid); +-- List from leaf index +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_test01_index') p + JOIN pg_class c ON (p.relid = c.oid); +-- List from partitioned index with no partitions +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_test3_index') p + JOIN pg_class c ON (p.relid = c.oid); +-- List all members using pg_partition_root with leaf index reference +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree(pg_partition_root('ptif_test01_index')) p + JOIN pg_class c ON (p.relid = c.oid); +-- List all ancestors of root and leaf indexes +SELECT * FROM pg_partition_ancestors('ptif_test01_index'); +SELECT * FROM pg_partition_ancestors('ptif_test_index'); + +DROP TABLE ptif_test; + +-- Table that is not part of any partition tree is not listed. +CREATE TABLE ptif_normal_table(a int); +SELECT relid, parentrelid, level, isleaf + FROM pg_partition_tree('ptif_normal_table'); +SELECT * FROM pg_partition_ancestors('ptif_normal_table'); +SELECT pg_partition_root('ptif_normal_table'); +DROP TABLE ptif_normal_table; + +-- Various partitioning-related functions return empty/NULL if passed relations +-- of types that cannot be part of a partition tree; for example, views, +-- materialized views, legacy inheritance children or parents, etc. +CREATE VIEW ptif_test_view AS SELECT 1; +CREATE MATERIALIZED VIEW ptif_test_matview AS SELECT 1; +CREATE TABLE ptif_li_parent (); +CREATE TABLE ptif_li_child () INHERITS (ptif_li_parent); +SELECT * FROM pg_partition_tree('ptif_test_view'); +SELECT * FROM pg_partition_tree('ptif_test_matview'); +SELECT * FROM pg_partition_tree('ptif_li_parent'); +SELECT * FROM pg_partition_tree('ptif_li_child'); +SELECT * FROM pg_partition_ancestors('ptif_test_view'); +SELECT * FROM pg_partition_ancestors('ptif_test_matview'); +SELECT * FROM pg_partition_ancestors('ptif_li_parent'); +SELECT * FROM pg_partition_ancestors('ptif_li_child'); +SELECT pg_partition_root('ptif_test_view'); +SELECT pg_partition_root('ptif_test_matview'); +SELECT pg_partition_root('ptif_li_parent'); +SELECT pg_partition_root('ptif_li_child'); +DROP VIEW ptif_test_view; +DROP MATERIALIZED VIEW ptif_test_matview; +DROP TABLE ptif_li_parent, ptif_li_child; diff --git a/postgresql/examples/partition_join.sql b/postgresql/examples/partition_join.sql new file mode 100644 index 0000000..73606c8 --- /dev/null +++ b/postgresql/examples/partition_join.sql @@ -0,0 +1,1144 @@ +-- +-- PARTITION_JOIN +-- Test partitionwise join between partitioned tables +-- + +-- Enable partitionwise join, which by default is disabled. +SET enable_partitionwise_join to true; + +-- +-- partitioned by a single column +-- +CREATE TABLE prt1 (a int, b int, c varchar) PARTITION BY RANGE(a); +CREATE TABLE prt1_p1 PARTITION OF prt1 FOR VALUES FROM (0) TO (250); +CREATE TABLE prt1_p3 PARTITION OF prt1 FOR VALUES FROM (500) TO (600); +CREATE TABLE prt1_p2 PARTITION OF prt1 FOR VALUES FROM (250) TO (500); +INSERT INTO prt1 SELECT i, i % 25, to_char(i, 'FM0000') FROM generate_series(0, 599) i WHERE i % 2 = 0; +CREATE INDEX iprt1_p1_a on prt1_p1(a); +CREATE INDEX iprt1_p2_a on prt1_p2(a); +CREATE INDEX iprt1_p3_a on prt1_p3(a); +ANALYZE prt1; + +CREATE TABLE prt2 (a int, b int, c varchar) PARTITION BY RANGE(b); +CREATE TABLE prt2_p1 PARTITION OF prt2 FOR VALUES FROM (0) TO (250); +CREATE TABLE prt2_p2 PARTITION OF prt2 FOR VALUES FROM (250) TO (500); +CREATE TABLE prt2_p3 PARTITION OF prt2 FOR VALUES FROM (500) TO (600); +INSERT INTO prt2 SELECT i % 25, i, to_char(i, 'FM0000') FROM generate_series(0, 599) i WHERE i % 3 = 0; +CREATE INDEX iprt2_p1_b on prt2_p1(b); +CREATE INDEX iprt2_p2_b on prt2_p2(b); +CREATE INDEX iprt2_p3_b on prt2_p3(b); +ANALYZE prt2; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.b = 0 ORDER BY t1.a, t2.b; + +-- left outer join, with whole-row reference; partitionwise join does not apply +EXPLAIN (COSTS OFF) +SELECT t1, t2 FROM prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1, t2 FROM prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- right outer join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1 RIGHT JOIN prt2 t2 ON t1.a = t2.b WHERE t2.a = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1 RIGHT JOIN prt2 t2 ON t1.a = t2.b WHERE t2.a = 0 ORDER BY t1.a, t2.b; + +-- full outer join, with placeholder vars +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT 50 phv, * FROM prt1 WHERE prt1.b = 0) t1 FULL JOIN (SELECT 75 phv, * FROM prt2 WHERE prt2.a = 0) t2 ON (t1.a = t2.b) WHERE t1.phv = t1.a OR t2.phv = t2.b ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT 50 phv, * FROM prt1 WHERE prt1.b = 0) t1 FULL JOIN (SELECT 75 phv, * FROM prt2 WHERE prt2.a = 0) t2 ON (t1.a = t2.b) WHERE t1.phv = t1.a OR t2.phv = t2.b ORDER BY t1.a, t2.b; + +-- Join with pruned partitions from joining relations +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.a < 450 AND t2.b > 250 AND t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.a < 450 AND t2.b > 250 AND t1.b = 0 ORDER BY t1.a, t2.b; + +-- Currently we can't do partitioned join if nullable-side partitions are pruned +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a < 450) t1 LEFT JOIN (SELECT * FROM prt2 WHERE b > 250) t2 ON t1.a = t2.b WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a < 450) t1 LEFT JOIN (SELECT * FROM prt2 WHERE b > 250) t2 ON t1.a = t2.b WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- Currently we can't do partitioned join if nullable-side partitions are pruned +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a < 450) t1 FULL JOIN (SELECT * FROM prt2 WHERE b > 250) t2 ON t1.a = t2.b WHERE t1.b = 0 OR t2.a = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a < 450) t1 FULL JOIN (SELECT * FROM prt2 WHERE b > 250) t2 ON t1.a = t2.b WHERE t1.b = 0 OR t2.a = 0 ORDER BY t1.a, t2.b; + +-- Semi-join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t2.b FROM prt2 t2 WHERE t2.a = 0) AND t1.b = 0 ORDER BY t1.a; +SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t2.b FROM prt2 t2 WHERE t2.a = 0) AND t1.b = 0 ORDER BY t1.a; + +-- Anti-join with aggregates +EXPLAIN (COSTS OFF) +SELECT sum(t1.a), avg(t1.a), sum(t1.b), avg(t1.b) FROM prt1 t1 WHERE NOT EXISTS (SELECT 1 FROM prt2 t2 WHERE t1.a = t2.b); +SELECT sum(t1.a), avg(t1.a), sum(t1.b), avg(t1.b) FROM prt1 t1 WHERE NOT EXISTS (SELECT 1 FROM prt2 t2 WHERE t1.a = t2.b); + +-- lateral reference +EXPLAIN (COSTS OFF) +SELECT * FROM prt1 t1 LEFT JOIN LATERAL + (SELECT t2.a AS t2a, t3.a AS t3a, least(t1.a,t2.a,t3.b) FROM prt1 t2 JOIN prt2 t3 ON (t2.a = t3.b)) ss + ON t1.a = ss.t2a WHERE t1.b = 0 ORDER BY t1.a; +SELECT * FROM prt1 t1 LEFT JOIN LATERAL + (SELECT t2.a AS t2a, t3.a AS t3a, least(t1.a,t2.a,t3.b) FROM prt1 t2 JOIN prt2 t3 ON (t2.a = t3.b)) ss + ON t1.a = ss.t2a WHERE t1.b = 0 ORDER BY t1.a; + +EXPLAIN (COSTS OFF) +SELECT t1.a, ss.t2a, ss.t2c FROM prt1 t1 LEFT JOIN LATERAL + (SELECT t2.a AS t2a, t3.a AS t3a, t2.b t2b, t2.c t2c, least(t1.a,t2.a,t3.b) FROM prt1 t2 JOIN prt2 t3 ON (t2.a = t3.b)) ss + ON t1.c = ss.t2c WHERE (t1.b + coalesce(ss.t2b, 0)) = 0 ORDER BY t1.a; +SELECT t1.a, ss.t2a, ss.t2c FROM prt1 t1 LEFT JOIN LATERAL + (SELECT t2.a AS t2a, t3.a AS t3a, t2.b t2b, t2.c t2c, least(t1.a,t2.a,t3.a) FROM prt1 t2 JOIN prt2 t3 ON (t2.a = t3.b)) ss + ON t1.c = ss.t2c WHERE (t1.b + coalesce(ss.t2b, 0)) = 0 ORDER BY t1.a; + +-- bug with inadequate sort key representation +SET enable_partitionwise_aggregate TO true; +SET enable_hashjoin TO false; + +EXPLAIN (COSTS OFF) +SELECT a, b FROM prt1 FULL JOIN prt2 p2(b,a,c) USING(a,b) + WHERE a BETWEEN 490 AND 510 + GROUP BY 1, 2 ORDER BY 1, 2; +SELECT a, b FROM prt1 FULL JOIN prt2 p2(b,a,c) USING(a,b) + WHERE a BETWEEN 490 AND 510 + GROUP BY 1, 2 ORDER BY 1, 2; + +RESET enable_partitionwise_aggregate; +RESET enable_hashjoin; + +-- +-- partitioned by expression +-- +CREATE TABLE prt1_e (a int, b int, c int) PARTITION BY RANGE(((a + b)/2)); +CREATE TABLE prt1_e_p1 PARTITION OF prt1_e FOR VALUES FROM (0) TO (250); +CREATE TABLE prt1_e_p2 PARTITION OF prt1_e FOR VALUES FROM (250) TO (500); +CREATE TABLE prt1_e_p3 PARTITION OF prt1_e FOR VALUES FROM (500) TO (600); +INSERT INTO prt1_e SELECT i, i, i % 25 FROM generate_series(0, 599, 2) i; +CREATE INDEX iprt1_e_p1_ab2 on prt1_e_p1(((a+b)/2)); +CREATE INDEX iprt1_e_p2_ab2 on prt1_e_p2(((a+b)/2)); +CREATE INDEX iprt1_e_p3_ab2 on prt1_e_p3(((a+b)/2)); +ANALYZE prt1_e; + +CREATE TABLE prt2_e (a int, b int, c int) PARTITION BY RANGE(((b + a)/2)); +CREATE TABLE prt2_e_p1 PARTITION OF prt2_e FOR VALUES FROM (0) TO (250); +CREATE TABLE prt2_e_p2 PARTITION OF prt2_e FOR VALUES FROM (250) TO (500); +CREATE TABLE prt2_e_p3 PARTITION OF prt2_e FOR VALUES FROM (500) TO (600); +INSERT INTO prt2_e SELECT i, i, i % 25 FROM generate_series(0, 599, 3) i; +ANALYZE prt2_e; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_e t1, prt2_e t2 WHERE (t1.a + t1.b)/2 = (t2.b + t2.a)/2 AND t1.c = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_e t1, prt2_e t2 WHERE (t1.a + t1.b)/2 = (t2.b + t2.a)/2 AND t1.c = 0 ORDER BY t1.a, t2.b; + +-- +-- N-way join +-- +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM prt1 t1, prt2 t2, prt1_e t3 WHERE t1.a = t2.b AND t1.a = (t3.a + t3.b)/2 AND t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM prt1 t1, prt2 t2, prt1_e t3 WHERE t1.a = t2.b AND t1.a = (t3.a + t3.b)/2 AND t1.b = 0 ORDER BY t1.a, t2.b; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) LEFT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t1.b = 0 ORDER BY t1.a, t2.b, t3.a + t3.b; +SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) LEFT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t1.b = 0 ORDER BY t1.a, t2.b, t3.a + t3.b; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) RIGHT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t3.c = 0 ORDER BY t1.a, t2.b, t3.a + t3.b; +SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) RIGHT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t3.c = 0 ORDER BY t1.a, t2.b, t3.a + t3.b; + +-- +-- 3-way full join +-- +EXPLAIN (COSTS OFF) +SELECT COUNT(*) FROM prt1 FULL JOIN prt2 p2(b,a,c) USING(a,b) FULL JOIN prt2 p3(b,a,c) USING (a, b) + WHERE a BETWEEN 490 AND 510; +SELECT COUNT(*) FROM prt1 FULL JOIN prt2 p2(b,a,c) USING(a,b) FULL JOIN prt2 p3(b,a,c) USING (a, b) + WHERE a BETWEEN 490 AND 510; + +-- +-- 4-way full join +-- +EXPLAIN (COSTS OFF) +SELECT COUNT(*) FROM prt1 FULL JOIN prt2 p2(b,a,c) USING(a,b) FULL JOIN prt2 p3(b,a,c) USING (a, b) FULL JOIN prt1 p4 (a,b,c) USING (a, b) + WHERE a BETWEEN 490 AND 510; +SELECT COUNT(*) FROM prt1 FULL JOIN prt2 p2(b,a,c) USING(a,b) FULL JOIN prt2 p3(b,a,c) USING (a, b) FULL JOIN prt1 p4 (a,b,c) USING (a, b) + WHERE a BETWEEN 490 AND 510; + +-- Cases with non-nullable expressions in subquery results; +-- make sure these go to null as expected +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.phv, t2.b, t2.phv, t3.a + t3.b, t3.phv FROM ((SELECT 50 phv, * FROM prt1 WHERE prt1.b = 0) t1 FULL JOIN (SELECT 75 phv, * FROM prt2 WHERE prt2.a = 0) t2 ON (t1.a = t2.b)) FULL JOIN (SELECT 50 phv, * FROM prt1_e WHERE prt1_e.c = 0) t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t1.a = t1.phv OR t2.b = t2.phv OR (t3.a + t3.b)/2 = t3.phv ORDER BY t1.a, t2.b, t3.a + t3.b; +SELECT t1.a, t1.phv, t2.b, t2.phv, t3.a + t3.b, t3.phv FROM ((SELECT 50 phv, * FROM prt1 WHERE prt1.b = 0) t1 FULL JOIN (SELECT 75 phv, * FROM prt2 WHERE prt2.a = 0) t2 ON (t1.a = t2.b)) FULL JOIN (SELECT 50 phv, * FROM prt1_e WHERE prt1_e.c = 0) t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t1.a = t1.phv OR t2.b = t2.phv OR (t3.a + t3.b)/2 = t3.phv ORDER BY t1.a, t2.b, t3.a + t3.b; + +-- Semi-join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1, prt1_e t2 WHERE t1.a = 0 AND t1.b = (t2.a + t2.b)/2) AND t1.b = 0 ORDER BY t1.a; +SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1, prt1_e t2 WHERE t1.a = 0 AND t1.b = (t2.a + t2.b)/2) AND t1.b = 0 ORDER BY t1.a; + +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1 WHERE t1.b IN (SELECT (t1.a + t1.b)/2 FROM prt1_e t1 WHERE t1.c = 0)) AND t1.b = 0 ORDER BY t1.a; +SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1 WHERE t1.b IN (SELECT (t1.a + t1.b)/2 FROM prt1_e t1 WHERE t1.c = 0)) AND t1.b = 0 ORDER BY t1.a; + +-- test merge joins +SET enable_hashjoin TO off; +SET enable_nestloop TO off; + +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1 WHERE t1.b IN (SELECT (t1.a + t1.b)/2 FROM prt1_e t1 WHERE t1.c = 0)) AND t1.b = 0 ORDER BY t1.a; +SELECT t1.* FROM prt1 t1 WHERE t1.a IN (SELECT t1.b FROM prt2 t1 WHERE t1.b IN (SELECT (t1.a + t1.b)/2 FROM prt1_e t1 WHERE t1.c = 0)) AND t1.b = 0 ORDER BY t1.a; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) RIGHT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t3.c = 0 ORDER BY t1.a, t2.b, t3.a + t3.b; +SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) RIGHT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t3.c = 0 ORDER BY t1.a, t2.b, t3.a + t3.b; + +-- MergeAppend on nullable column +-- This should generate a partitionwise join, but currently fails to +EXPLAIN (COSTS OFF) +SELECT t1.a, t2.b FROM (SELECT * FROM prt1 WHERE a < 450) t1 LEFT JOIN (SELECT * FROM prt2 WHERE b > 250) t2 ON t1.a = t2.b WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t2.b FROM (SELECT * FROM prt1 WHERE a < 450) t1 LEFT JOIN (SELECT * FROM prt2 WHERE b > 250) t2 ON t1.a = t2.b WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- merge join when expression with whole-row reference needs to be sorted; +-- partitionwise join does not apply +EXPLAIN (COSTS OFF) +SELECT t1.a, t2.b FROM prt1 t1, prt2 t2 WHERE t1::text = t2::text AND t1.a = t2.b ORDER BY t1.a; +SELECT t1.a, t2.b FROM prt1 t1, prt2 t2 WHERE t1::text = t2::text AND t1.a = t2.b ORDER BY t1.a; + +RESET enable_hashjoin; +RESET enable_nestloop; + +-- +-- partitioned by multiple columns +-- +CREATE TABLE prt1_m (a int, b int, c int) PARTITION BY RANGE(a, ((a + b)/2)); +CREATE TABLE prt1_m_p1 PARTITION OF prt1_m FOR VALUES FROM (0, 0) TO (250, 250); +CREATE TABLE prt1_m_p2 PARTITION OF prt1_m FOR VALUES FROM (250, 250) TO (500, 500); +CREATE TABLE prt1_m_p3 PARTITION OF prt1_m FOR VALUES FROM (500, 500) TO (600, 600); +INSERT INTO prt1_m SELECT i, i, i % 25 FROM generate_series(0, 599, 2) i; +ANALYZE prt1_m; + +CREATE TABLE prt2_m (a int, b int, c int) PARTITION BY RANGE(((b + a)/2), b); +CREATE TABLE prt2_m_p1 PARTITION OF prt2_m FOR VALUES FROM (0, 0) TO (250, 250); +CREATE TABLE prt2_m_p2 PARTITION OF prt2_m FOR VALUES FROM (250, 250) TO (500, 500); +CREATE TABLE prt2_m_p3 PARTITION OF prt2_m FOR VALUES FROM (500, 500) TO (600, 600); +INSERT INTO prt2_m SELECT i, i, i % 25 FROM generate_series(0, 599, 3) i; +ANALYZE prt2_m; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_m WHERE prt1_m.c = 0) t1 FULL JOIN (SELECT * FROM prt2_m WHERE prt2_m.c = 0) t2 ON (t1.a = (t2.b + t2.a)/2 AND t2.b = (t1.a + t1.b)/2) ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_m WHERE prt1_m.c = 0) t1 FULL JOIN (SELECT * FROM prt2_m WHERE prt2_m.c = 0) t2 ON (t1.a = (t2.b + t2.a)/2 AND t2.b = (t1.a + t1.b)/2) ORDER BY t1.a, t2.b; + +-- +-- tests for list partitioned tables. +-- +CREATE TABLE plt1 (a int, b int, c text) PARTITION BY LIST(c); +CREATE TABLE plt1_p1 PARTITION OF plt1 FOR VALUES IN ('0000', '0003', '0004', '0010'); +CREATE TABLE plt1_p2 PARTITION OF plt1 FOR VALUES IN ('0001', '0005', '0002', '0009'); +CREATE TABLE plt1_p3 PARTITION OF plt1 FOR VALUES IN ('0006', '0007', '0008', '0011'); +INSERT INTO plt1 SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(0, 599, 2) i; +ANALYZE plt1; + +CREATE TABLE plt2 (a int, b int, c text) PARTITION BY LIST(c); +CREATE TABLE plt2_p1 PARTITION OF plt2 FOR VALUES IN ('0000', '0003', '0004', '0010'); +CREATE TABLE plt2_p2 PARTITION OF plt2 FOR VALUES IN ('0001', '0005', '0002', '0009'); +CREATE TABLE plt2_p3 PARTITION OF plt2 FOR VALUES IN ('0006', '0007', '0008', '0011'); +INSERT INTO plt2 SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(0, 599, 3) i; +ANALYZE plt2; + +-- +-- list partitioned by expression +-- +CREATE TABLE plt1_e (a int, b int, c text) PARTITION BY LIST(ltrim(c, 'A')); +CREATE TABLE plt1_e_p1 PARTITION OF plt1_e FOR VALUES IN ('0000', '0003', '0004', '0010'); +CREATE TABLE plt1_e_p2 PARTITION OF plt1_e FOR VALUES IN ('0001', '0005', '0002', '0009'); +CREATE TABLE plt1_e_p3 PARTITION OF plt1_e FOR VALUES IN ('0006', '0007', '0008', '0011'); +INSERT INTO plt1_e SELECT i, i, 'A' || to_char(i/50, 'FM0000') FROM generate_series(0, 599, 2) i; +ANALYZE plt1_e; + +-- test partition matching with N-way join +EXPLAIN (COSTS OFF) +SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM plt1 t1, plt2 t2, plt1_e t3 WHERE t1.b = t2.b AND t1.c = t2.c AND ltrim(t3.c, 'A') = t1.c GROUP BY t1.c, t2.c, t3.c ORDER BY t1.c, t2.c, t3.c; +SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM plt1 t1, plt2 t2, plt1_e t3 WHERE t1.b = t2.b AND t1.c = t2.c AND ltrim(t3.c, 'A') = t1.c GROUP BY t1.c, t2.c, t3.c ORDER BY t1.c, t2.c, t3.c; + +-- joins where one of the relations is proven empty +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.a = 1 AND t1.a = 2; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a = 1 AND a = 2) t1 LEFT JOIN prt2 t2 ON t1.a = t2.b; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a = 1 AND a = 2) t1 RIGHT JOIN prt2 t2 ON t1.a = t2.b, prt1 t3 WHERE t2.b = t3.a; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1 WHERE a = 1 AND a = 2) t1 FULL JOIN prt2 t2 ON t1.a = t2.b WHERE t2.a = 0 ORDER BY t1.a, t2.b; + +-- +-- tests for hash partitioned tables. +-- +CREATE TABLE pht1 (a int, b int, c text) PARTITION BY HASH(c); +CREATE TABLE pht1_p1 PARTITION OF pht1 FOR VALUES WITH (MODULUS 3, REMAINDER 0); +CREATE TABLE pht1_p2 PARTITION OF pht1 FOR VALUES WITH (MODULUS 3, REMAINDER 1); +CREATE TABLE pht1_p3 PARTITION OF pht1 FOR VALUES WITH (MODULUS 3, REMAINDER 2); +INSERT INTO pht1 SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(0, 599, 2) i; +ANALYZE pht1; + +CREATE TABLE pht2 (a int, b int, c text) PARTITION BY HASH(c); +CREATE TABLE pht2_p1 PARTITION OF pht2 FOR VALUES WITH (MODULUS 3, REMAINDER 0); +CREATE TABLE pht2_p2 PARTITION OF pht2 FOR VALUES WITH (MODULUS 3, REMAINDER 1); +CREATE TABLE pht2_p3 PARTITION OF pht2 FOR VALUES WITH (MODULUS 3, REMAINDER 2); +INSERT INTO pht2 SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(0, 599, 3) i; +ANALYZE pht2; + +-- +-- hash partitioned by expression +-- +CREATE TABLE pht1_e (a int, b int, c text) PARTITION BY HASH(ltrim(c, 'A')); +CREATE TABLE pht1_e_p1 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 0); +CREATE TABLE pht1_e_p2 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 1); +CREATE TABLE pht1_e_p3 PARTITION OF pht1_e FOR VALUES WITH (MODULUS 3, REMAINDER 2); +INSERT INTO pht1_e SELECT i, i, 'A' || to_char(i/50, 'FM0000') FROM generate_series(0, 299, 2) i; +ANALYZE pht1_e; + +-- test partition matching with N-way join +EXPLAIN (COSTS OFF) +SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM pht1 t1, pht2 t2, pht1_e t3 WHERE t1.b = t2.b AND t1.c = t2.c AND ltrim(t3.c, 'A') = t1.c GROUP BY t1.c, t2.c, t3.c ORDER BY t1.c, t2.c, t3.c; +SELECT avg(t1.a), avg(t2.b), avg(t3.a + t3.b), t1.c, t2.c, t3.c FROM pht1 t1, pht2 t2, pht1_e t3 WHERE t1.b = t2.b AND t1.c = t2.c AND ltrim(t3.c, 'A') = t1.c GROUP BY t1.c, t2.c, t3.c ORDER BY t1.c, t2.c, t3.c; + +-- test default partition behavior for range +ALTER TABLE prt1 DETACH PARTITION prt1_p3; +ALTER TABLE prt1 ATTACH PARTITION prt1_p3 DEFAULT; +ANALYZE prt1; +ALTER TABLE prt2 DETACH PARTITION prt2_p3; +ALTER TABLE prt2 ATTACH PARTITION prt2_p3 DEFAULT; +ANALYZE prt2; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt2 t2 WHERE t1.a = t2.b AND t1.b = 0 ORDER BY t1.a, t2.b; + +-- test default partition behavior for list +ALTER TABLE plt1 DETACH PARTITION plt1_p3; +ALTER TABLE plt1 ATTACH PARTITION plt1_p3 DEFAULT; +ANALYZE plt1; +ALTER TABLE plt2 DETACH PARTITION plt2_p3; +ALTER TABLE plt2 ATTACH PARTITION plt2_p3 DEFAULT; +ANALYZE plt2; + +EXPLAIN (COSTS OFF) +SELECT avg(t1.a), avg(t2.b), t1.c, t2.c FROM plt1 t1 RIGHT JOIN plt2 t2 ON t1.c = t2.c WHERE t1.a % 25 = 0 GROUP BY t1.c, t2.c ORDER BY t1.c, t2.c; +-- +-- multiple levels of partitioning +-- +CREATE TABLE prt1_l (a int, b int, c varchar) PARTITION BY RANGE(a); +CREATE TABLE prt1_l_p1 PARTITION OF prt1_l FOR VALUES FROM (0) TO (250); +CREATE TABLE prt1_l_p2 PARTITION OF prt1_l FOR VALUES FROM (250) TO (500) PARTITION BY LIST (c); +CREATE TABLE prt1_l_p2_p1 PARTITION OF prt1_l_p2 FOR VALUES IN ('0000', '0001'); +CREATE TABLE prt1_l_p2_p2 PARTITION OF prt1_l_p2 FOR VALUES IN ('0002', '0003'); +CREATE TABLE prt1_l_p3 PARTITION OF prt1_l FOR VALUES FROM (500) TO (600) PARTITION BY RANGE (b); +CREATE TABLE prt1_l_p3_p1 PARTITION OF prt1_l_p3 FOR VALUES FROM (0) TO (13); +CREATE TABLE prt1_l_p3_p2 PARTITION OF prt1_l_p3 FOR VALUES FROM (13) TO (25); +INSERT INTO prt1_l SELECT i, i % 25, to_char(i % 4, 'FM0000') FROM generate_series(0, 599, 2) i; +ANALYZE prt1_l; + +CREATE TABLE prt2_l (a int, b int, c varchar) PARTITION BY RANGE(b); +CREATE TABLE prt2_l_p1 PARTITION OF prt2_l FOR VALUES FROM (0) TO (250); +CREATE TABLE prt2_l_p2 PARTITION OF prt2_l FOR VALUES FROM (250) TO (500) PARTITION BY LIST (c); +CREATE TABLE prt2_l_p2_p1 PARTITION OF prt2_l_p2 FOR VALUES IN ('0000', '0001'); +CREATE TABLE prt2_l_p2_p2 PARTITION OF prt2_l_p2 FOR VALUES IN ('0002', '0003'); +CREATE TABLE prt2_l_p3 PARTITION OF prt2_l FOR VALUES FROM (500) TO (600) PARTITION BY RANGE (a); +CREATE TABLE prt2_l_p3_p1 PARTITION OF prt2_l_p3 FOR VALUES FROM (0) TO (13); +CREATE TABLE prt2_l_p3_p2 PARTITION OF prt2_l_p3 FOR VALUES FROM (13) TO (25); +INSERT INTO prt2_l SELECT i % 25, i, to_char(i % 4, 'FM0000') FROM generate_series(0, 599, 3) i; +ANALYZE prt2_l; + +-- inner join, qual covering only top-level partitions +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1, prt2_l t2 WHERE t1.a = t2.b AND t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1, prt2_l t2 WHERE t1.a = t2.b AND t1.b = 0 ORDER BY t1.a, t2.b; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1 LEFT JOIN prt2_l t2 ON t1.a = t2.b AND t1.c = t2.c WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1 LEFT JOIN prt2_l t2 ON t1.a = t2.b AND t1.c = t2.c WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- right join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1 RIGHT JOIN prt2_l t2 ON t1.a = t2.b AND t1.c = t2.c WHERE t2.a = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_l t1 RIGHT JOIN prt2_l t2 ON t1.a = t2.b AND t1.c = t2.c WHERE t2.a = 0 ORDER BY t1.a, t2.b; + +-- full join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_l WHERE prt1_l.b = 0) t1 FULL JOIN (SELECT * FROM prt2_l WHERE prt2_l.a = 0) t2 ON (t1.a = t2.b AND t1.c = t2.c) ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_l WHERE prt1_l.b = 0) t1 FULL JOIN (SELECT * FROM prt2_l WHERE prt2_l.a = 0) t2 ON (t1.a = t2.b AND t1.c = t2.c) ORDER BY t1.a, t2.b; + +-- lateral partitionwise join +EXPLAIN (COSTS OFF) +SELECT * FROM prt1_l t1 LEFT JOIN LATERAL + (SELECT t2.a AS t2a, t2.c AS t2c, t2.b AS t2b, t3.b AS t3b, least(t1.a,t2.a,t3.b) FROM prt1_l t2 JOIN prt2_l t3 ON (t2.a = t3.b AND t2.c = t3.c)) ss + ON t1.a = ss.t2a AND t1.c = ss.t2c WHERE t1.b = 0 ORDER BY t1.a; +SELECT * FROM prt1_l t1 LEFT JOIN LATERAL + (SELECT t2.a AS t2a, t2.c AS t2c, t2.b AS t2b, t3.b AS t3b, least(t1.a,t2.a,t3.b) FROM prt1_l t2 JOIN prt2_l t3 ON (t2.a = t3.b AND t2.c = t3.c)) ss + ON t1.a = ss.t2a AND t1.c = ss.t2c WHERE t1.b = 0 ORDER BY t1.a; + +-- join with one side empty +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT * FROM prt1_l WHERE a = 1 AND a = 2) t1 RIGHT JOIN prt2_l t2 ON t1.a = t2.b AND t1.b = t2.a AND t1.c = t2.c; + +-- Test case to verify proper handling of subqueries in a partitioned delete. +-- The weird-looking lateral join is just there to force creation of a +-- nestloop parameter within the subquery, which exposes the problem if the +-- planner fails to make multiple copies of the subquery as appropriate. +EXPLAIN (COSTS OFF) +DELETE FROM prt1_l +WHERE EXISTS ( + SELECT 1 + FROM int4_tbl, + LATERAL (SELECT int4_tbl.f1 FROM int8_tbl LIMIT 2) ss + WHERE prt1_l.c IS NULL); + +-- +-- negative testcases +-- +CREATE TABLE prt1_n (a int, b int, c varchar) PARTITION BY RANGE(c); +CREATE TABLE prt1_n_p1 PARTITION OF prt1_n FOR VALUES FROM ('0000') TO ('0250'); +CREATE TABLE prt1_n_p2 PARTITION OF prt1_n FOR VALUES FROM ('0250') TO ('0500'); +INSERT INTO prt1_n SELECT i, i, to_char(i, 'FM0000') FROM generate_series(0, 499, 2) i; +ANALYZE prt1_n; + +CREATE TABLE prt2_n (a int, b int, c text) PARTITION BY LIST(c); +CREATE TABLE prt2_n_p1 PARTITION OF prt2_n FOR VALUES IN ('0000', '0003', '0004', '0010', '0006', '0007'); +CREATE TABLE prt2_n_p2 PARTITION OF prt2_n FOR VALUES IN ('0001', '0005', '0002', '0009', '0008', '0011'); +INSERT INTO prt2_n SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(0, 599, 2) i; +ANALYZE prt2_n; + +CREATE TABLE prt3_n (a int, b int, c text) PARTITION BY LIST(c); +CREATE TABLE prt3_n_p1 PARTITION OF prt3_n FOR VALUES IN ('0000', '0004', '0006', '0007'); +CREATE TABLE prt3_n_p2 PARTITION OF prt3_n FOR VALUES IN ('0001', '0002', '0008', '0010'); +CREATE TABLE prt3_n_p3 PARTITION OF prt3_n FOR VALUES IN ('0003', '0005', '0009', '0011'); +INSERT INTO prt2_n SELECT i, i, to_char(i/50, 'FM0000') FROM generate_series(0, 599, 2) i; +ANALYZE prt3_n; + +CREATE TABLE prt4_n (a int, b int, c text) PARTITION BY RANGE(a); +CREATE TABLE prt4_n_p1 PARTITION OF prt4_n FOR VALUES FROM (0) TO (300); +CREATE TABLE prt4_n_p2 PARTITION OF prt4_n FOR VALUES FROM (300) TO (500); +CREATE TABLE prt4_n_p3 PARTITION OF prt4_n FOR VALUES FROM (500) TO (600); +INSERT INTO prt4_n SELECT i, i, to_char(i, 'FM0000') FROM generate_series(0, 599, 2) i; +ANALYZE prt4_n; + +-- partitionwise join can not be applied if the partition ranges differ +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt4_n t2 WHERE t1.a = t2.a; +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1, prt4_n t2, prt2 t3 WHERE t1.a = t2.a and t1.a = t3.b; + +-- partitionwise join can not be applied if there are no equi-join conditions +-- between partition keys +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1 t1 LEFT JOIN prt2 t2 ON (t1.a < t2.b); + +-- equi-join with join condition on partial keys does not qualify for +-- partitionwise join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_m t1, prt2_m t2 WHERE t1.a = (t2.b + t2.a)/2; + +-- equi-join between out-of-order partition key columns does not qualify for +-- partitionwise join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_m t1 LEFT JOIN prt2_m t2 ON t1.a = t2.b; + +-- equi-join between non-key columns does not qualify for partitionwise join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_m t1 LEFT JOIN prt2_m t2 ON t1.c = t2.c; + +-- partitionwise join can not be applied for a join between list and range +-- partitioned tables +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 LEFT JOIN prt2_n t2 ON (t1.c = t2.c); + +-- partitionwise join can not be applied between tables with different +-- partition lists +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 JOIN prt2_n t2 ON (t1.c = t2.c) JOIN plt1 t3 ON (t1.c = t3.c); + +-- partitionwise join can not be applied for a join between key column and +-- non-key column +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_n t1 FULL JOIN prt1 t2 ON (t1.c = t2.c); + +-- +-- Test some other plan types in a partitionwise join (unfortunately, +-- we need larger tables to get the planner to choose these plan types) +-- +create temp table prtx1 (a integer, b integer, c integer) + partition by range (a); +create temp table prtx1_1 partition of prtx1 for values from (1) to (11); +create temp table prtx1_2 partition of prtx1 for values from (11) to (21); +create temp table prtx1_3 partition of prtx1 for values from (21) to (31); +create temp table prtx2 (a integer, b integer, c integer) + partition by range (a); +create temp table prtx2_1 partition of prtx2 for values from (1) to (11); +create temp table prtx2_2 partition of prtx2 for values from (11) to (21); +create temp table prtx2_3 partition of prtx2 for values from (21) to (31); +insert into prtx1 select 1 + i%30, i, i + from generate_series(1,1000) i; +insert into prtx2 select 1 + i%30, i, i + from generate_series(1,500) i, generate_series(1,10) j; +create index on prtx2 (b); +create index on prtx2 (c); +analyze prtx1; +analyze prtx2; + +explain (costs off) +select * from prtx1 +where not exists (select 1 from prtx2 + where prtx2.a=prtx1.a and prtx2.b=prtx1.b and prtx2.c=123) + and a<20 and c=120; + +select * from prtx1 +where not exists (select 1 from prtx2 + where prtx2.a=prtx1.a and prtx2.b=prtx1.b and prtx2.c=123) + and a<20 and c=120; + +explain (costs off) +select * from prtx1 +where not exists (select 1 from prtx2 + where prtx2.a=prtx1.a and (prtx2.b=prtx1.b+1 or prtx2.c=99)) + and a<20 and c=91; + +select * from prtx1 +where not exists (select 1 from prtx2 + where prtx2.a=prtx1.a and (prtx2.b=prtx1.b+1 or prtx2.c=99)) + and a<20 and c=91; + +-- +-- Test advanced partition-matching algorithm for partitioned join +-- + +-- Tests for range-partitioned tables +CREATE TABLE prt1_adv (a int, b int, c varchar) PARTITION BY RANGE (a); +CREATE TABLE prt1_adv_p1 PARTITION OF prt1_adv FOR VALUES FROM (100) TO (200); +CREATE TABLE prt1_adv_p2 PARTITION OF prt1_adv FOR VALUES FROM (200) TO (300); +CREATE TABLE prt1_adv_p3 PARTITION OF prt1_adv FOR VALUES FROM (300) TO (400); +CREATE INDEX prt1_adv_a_idx ON prt1_adv (a); +INSERT INTO prt1_adv SELECT i, i % 25, to_char(i, 'FM0000') FROM generate_series(100, 399) i; +ANALYZE prt1_adv; + +CREATE TABLE prt2_adv (a int, b int, c varchar) PARTITION BY RANGE (b); +CREATE TABLE prt2_adv_p1 PARTITION OF prt2_adv FOR VALUES FROM (100) TO (150); +CREATE TABLE prt2_adv_p2 PARTITION OF prt2_adv FOR VALUES FROM (200) TO (300); +CREATE TABLE prt2_adv_p3 PARTITION OF prt2_adv FOR VALUES FROM (350) TO (500); +CREATE INDEX prt2_adv_b_idx ON prt2_adv (b); +INSERT INTO prt2_adv_p1 SELECT i % 25, i, to_char(i, 'FM0000') FROM generate_series(100, 149) i; +INSERT INTO prt2_adv_p2 SELECT i % 25, i, to_char(i, 'FM0000') FROM generate_series(200, 299) i; +INSERT INTO prt2_adv_p3 SELECT i % 25, i, to_char(i, 'FM0000') FROM generate_series(350, 499) i; +ANALYZE prt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- semi join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1_adv t1 WHERE EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; +SELECT t1.* FROM prt1_adv t1 WHERE EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 LEFT JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 LEFT JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- anti join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; +SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; + +-- full join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT 175 phv, * FROM prt1_adv WHERE prt1_adv.b = 0) t1 FULL JOIN (SELECT 425 phv, * FROM prt2_adv WHERE prt2_adv.a = 0) t2 ON (t1.a = t2.b) WHERE t1.phv = t1.a OR t2.phv = t2.b ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT 175 phv, * FROM prt1_adv WHERE prt1_adv.b = 0) t1 FULL JOIN (SELECT 425 phv, * FROM prt2_adv WHERE prt2_adv.a = 0) t2 ON (t1.a = t2.b) WHERE t1.phv = t1.a OR t2.phv = t2.b ORDER BY t1.a, t2.b; + +-- Test cases where one side has an extra partition +CREATE TABLE prt2_adv_extra PARTITION OF prt2_adv FOR VALUES FROM (500) TO (MAXVALUE); +INSERT INTO prt2_adv SELECT i % 25, i, to_char(i, 'FM0000') FROM generate_series(500, 599) i; +ANALYZE prt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- semi join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1_adv t1 WHERE EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; +SELECT t1.* FROM prt1_adv t1 WHERE EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 LEFT JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 LEFT JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- left join; currently we can't do partitioned join if there are no matched +-- partitions on the nullable side +EXPLAIN (COSTS OFF) +SELECT t1.b, t1.c, t2.a, t2.c FROM prt2_adv t1 LEFT JOIN prt1_adv t2 ON (t1.b = t2.a) WHERE t1.a = 0 ORDER BY t1.b, t2.a; + +-- anti join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; +SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; + +-- anti join; currently we can't do partitioned join if there are no matched +-- partitions on the nullable side +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt2_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt1_adv t2 WHERE t1.b = t2.a) AND t1.a = 0 ORDER BY t1.b; + +-- full join; currently we can't do partitioned join if there are no matched +-- partitions on the nullable side +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT 175 phv, * FROM prt1_adv WHERE prt1_adv.b = 0) t1 FULL JOIN (SELECT 425 phv, * FROM prt2_adv WHERE prt2_adv.a = 0) t2 ON (t1.a = t2.b) WHERE t1.phv = t1.a OR t2.phv = t2.b ORDER BY t1.a, t2.b; + +-- 3-way join where not every pair of relations can do partitioned join +EXPLAIN (COSTS OFF) +SELECT t1.b, t1.c, t2.a, t2.c, t3.a, t3.c FROM prt2_adv t1 LEFT JOIN prt1_adv t2 ON (t1.b = t2.a) INNER JOIN prt1_adv t3 ON (t1.b = t3.a) WHERE t1.a = 0 ORDER BY t1.b, t2.a, t3.a; +SELECT t1.b, t1.c, t2.a, t2.c, t3.a, t3.c FROM prt2_adv t1 LEFT JOIN prt1_adv t2 ON (t1.b = t2.a) INNER JOIN prt1_adv t3 ON (t1.b = t3.a) WHERE t1.a = 0 ORDER BY t1.b, t2.a, t3.a; + +DROP TABLE prt2_adv_extra; + +-- Test cases where a partition on one side matches multiple partitions on +-- the other side; we currently can't do partitioned join in such cases +ALTER TABLE prt2_adv DETACH PARTITION prt2_adv_p3; +-- Split prt2_adv_p3 into two partitions so that prt1_adv_p3 matches both +CREATE TABLE prt2_adv_p3_1 PARTITION OF prt2_adv FOR VALUES FROM (350) TO (375); +CREATE TABLE prt2_adv_p3_2 PARTITION OF prt2_adv FOR VALUES FROM (375) TO (500); +INSERT INTO prt2_adv SELECT i % 25, i, to_char(i, 'FM0000') FROM generate_series(350, 499) i; +ANALYZE prt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- semi join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1_adv t1 WHERE EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 LEFT JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- anti join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM prt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM prt2_adv t2 WHERE t1.a = t2.b) AND t1.b = 0 ORDER BY t1.a; + +-- full join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM (SELECT 175 phv, * FROM prt1_adv WHERE prt1_adv.b = 0) t1 FULL JOIN (SELECT 425 phv, * FROM prt2_adv WHERE prt2_adv.a = 0) t2 ON (t1.a = t2.b) WHERE t1.phv = t1.a OR t2.phv = t2.b ORDER BY t1.a, t2.b; + +DROP TABLE prt2_adv_p3_1; +DROP TABLE prt2_adv_p3_2; +ANALYZE prt2_adv; + +-- Test default partitions +ALTER TABLE prt1_adv DETACH PARTITION prt1_adv_p1; +-- Change prt1_adv_p1 to the default partition +ALTER TABLE prt1_adv ATTACH PARTITION prt1_adv_p1 DEFAULT; +ALTER TABLE prt1_adv DETACH PARTITION prt1_adv_p3; +ANALYZE prt1_adv; + +-- We can do partitioned join even if only one of relations has the default +-- partition +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +-- Restore prt1_adv_p3 +ALTER TABLE prt1_adv ATTACH PARTITION prt1_adv_p3 FOR VALUES FROM (300) TO (400); +ANALYZE prt1_adv; + +-- Restore prt2_adv_p3 +ALTER TABLE prt2_adv ATTACH PARTITION prt2_adv_p3 FOR VALUES FROM (350) TO (500); +ANALYZE prt2_adv; + +-- Partitioned join can't be applied because the default partition of prt1_adv +-- matches prt2_adv_p1 and prt2_adv_p3 +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +ALTER TABLE prt2_adv DETACH PARTITION prt2_adv_p3; +-- Change prt2_adv_p3 to the default partition +ALTER TABLE prt2_adv ATTACH PARTITION prt2_adv_p3 DEFAULT; +ANALYZE prt2_adv; + +-- Partitioned join can't be applied because the default partition of prt1_adv +-- matches prt2_adv_p1 and prt2_adv_p3 +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.b = 0 ORDER BY t1.a, t2.b; + +DROP TABLE prt1_adv_p3; +ANALYZE prt1_adv; + +DROP TABLE prt2_adv_p3; +ANALYZE prt2_adv; + +CREATE TABLE prt3_adv (a int, b int, c varchar) PARTITION BY RANGE (a); +CREATE TABLE prt3_adv_p1 PARTITION OF prt3_adv FOR VALUES FROM (200) TO (300); +CREATE TABLE prt3_adv_p2 PARTITION OF prt3_adv FOR VALUES FROM (300) TO (400); +CREATE INDEX prt3_adv_a_idx ON prt3_adv (a); +INSERT INTO prt3_adv SELECT i, i % 25, to_char(i, 'FM0000') FROM generate_series(200, 399) i; +ANALYZE prt3_adv; + +-- 3-way join to test the default partition of a join relation +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c, t3.a, t3.c FROM prt1_adv t1 LEFT JOIN prt2_adv t2 ON (t1.a = t2.b) LEFT JOIN prt3_adv t3 ON (t1.a = t3.a) WHERE t1.b = 0 ORDER BY t1.a, t2.b, t3.a; +SELECT t1.a, t1.c, t2.b, t2.c, t3.a, t3.c FROM prt1_adv t1 LEFT JOIN prt2_adv t2 ON (t1.a = t2.b) LEFT JOIN prt3_adv t3 ON (t1.a = t3.a) WHERE t1.b = 0 ORDER BY t1.a, t2.b, t3.a; + +DROP TABLE prt1_adv; +DROP TABLE prt2_adv; +DROP TABLE prt3_adv; + +-- Test interaction of partitioned join with partition pruning +CREATE TABLE prt1_adv (a int, b int, c varchar) PARTITION BY RANGE (a); +CREATE TABLE prt1_adv_p1 PARTITION OF prt1_adv FOR VALUES FROM (100) TO (200); +CREATE TABLE prt1_adv_p2 PARTITION OF prt1_adv FOR VALUES FROM (200) TO (300); +CREATE TABLE prt1_adv_p3 PARTITION OF prt1_adv FOR VALUES FROM (300) TO (400); +CREATE INDEX prt1_adv_a_idx ON prt1_adv (a); +INSERT INTO prt1_adv SELECT i, i % 25, to_char(i, 'FM0000') FROM generate_series(100, 399) i; +ANALYZE prt1_adv; + +CREATE TABLE prt2_adv (a int, b int, c varchar) PARTITION BY RANGE (b); +CREATE TABLE prt2_adv_p1 PARTITION OF prt2_adv FOR VALUES FROM (100) TO (200); +CREATE TABLE prt2_adv_p2 PARTITION OF prt2_adv FOR VALUES FROM (200) TO (400); +CREATE INDEX prt2_adv_b_idx ON prt2_adv (b); +INSERT INTO prt2_adv SELECT i % 25, i, to_char(i, 'FM0000') FROM generate_series(100, 399) i; +ANALYZE prt2_adv; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.a < 300 AND t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.a < 300 AND t1.b = 0 ORDER BY t1.a, t2.b; + +DROP TABLE prt1_adv_p3; +CREATE TABLE prt1_adv_default PARTITION OF prt1_adv DEFAULT; +ANALYZE prt1_adv; + +CREATE TABLE prt2_adv_default PARTITION OF prt2_adv DEFAULT; +ANALYZE prt2_adv; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.a >= 100 AND t1.a < 300 AND t1.b = 0 ORDER BY t1.a, t2.b; +SELECT t1.a, t1.c, t2.b, t2.c FROM prt1_adv t1 INNER JOIN prt2_adv t2 ON (t1.a = t2.b) WHERE t1.a >= 100 AND t1.a < 300 AND t1.b = 0 ORDER BY t1.a, t2.b; + +DROP TABLE prt1_adv; +DROP TABLE prt2_adv; + + +-- Tests for list-partitioned tables +CREATE TABLE plt1_adv (a int, b int, c text) PARTITION BY LIST (c); +CREATE TABLE plt1_adv_p1 PARTITION OF plt1_adv FOR VALUES IN ('0001', '0003'); +CREATE TABLE plt1_adv_p2 PARTITION OF plt1_adv FOR VALUES IN ('0004', '0006'); +CREATE TABLE plt1_adv_p3 PARTITION OF plt1_adv FOR VALUES IN ('0008', '0009'); +INSERT INTO plt1_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (1, 3, 4, 6, 8, 9); +ANALYZE plt1_adv; + +CREATE TABLE plt2_adv (a int, b int, c text) PARTITION BY LIST (c); +CREATE TABLE plt2_adv_p1 PARTITION OF plt2_adv FOR VALUES IN ('0002', '0003'); +CREATE TABLE plt2_adv_p2 PARTITION OF plt2_adv FOR VALUES IN ('0004', '0006'); +CREATE TABLE plt2_adv_p3 PARTITION OF plt2_adv FOR VALUES IN ('0007', '0009'); +INSERT INTO plt2_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (2, 3, 4, 6, 7, 9); +ANALYZE plt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- semi join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt1_adv t1 WHERE EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; +SELECT t1.* FROM plt1_adv t1 WHERE EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- anti join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; +SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- full join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; + +-- Test cases where one side has an extra partition +CREATE TABLE plt2_adv_extra PARTITION OF plt2_adv FOR VALUES IN ('0000'); +INSERT INTO plt2_adv_extra VALUES (0, 0, '0000'); +ANALYZE plt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- semi join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt1_adv t1 WHERE EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; +SELECT t1.* FROM plt1_adv t1 WHERE EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- left join; currently we can't do partitioned join if there are no matched +-- partitions on the nullable side +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt2_adv t1 LEFT JOIN plt1_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- anti join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; +SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- anti join; currently we can't do partitioned join if there are no matched +-- partitions on the nullable side +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt2_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt1_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- full join; currently we can't do partitioned join if there are no matched +-- partitions on the nullable side +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; + +DROP TABLE plt2_adv_extra; + +-- Test cases where a partition on one side matches multiple partitions on +-- the other side; we currently can't do partitioned join in such cases +ALTER TABLE plt2_adv DETACH PARTITION plt2_adv_p2; +-- Split plt2_adv_p2 into two partitions so that plt1_adv_p2 matches both +CREATE TABLE plt2_adv_p2_1 PARTITION OF plt2_adv FOR VALUES IN ('0004'); +CREATE TABLE plt2_adv_p2_2 PARTITION OF plt2_adv FOR VALUES IN ('0006'); +INSERT INTO plt2_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (4, 6); +ANALYZE plt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- semi join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt1_adv t1 WHERE EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- anti join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- full join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; + +DROP TABLE plt2_adv_p2_1; +DROP TABLE plt2_adv_p2_2; +-- Restore plt2_adv_p2 +ALTER TABLE plt2_adv ATTACH PARTITION plt2_adv_p2 FOR VALUES IN ('0004', '0006'); + +-- Test NULL partitions +ALTER TABLE plt1_adv DETACH PARTITION plt1_adv_p1; +-- Change plt1_adv_p1 to the NULL partition +CREATE TABLE plt1_adv_p1_null PARTITION OF plt1_adv FOR VALUES IN (NULL, '0001', '0003'); +INSERT INTO plt1_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (1, 3); +INSERT INTO plt1_adv VALUES (-1, -1, NULL); +ANALYZE plt1_adv; + +ALTER TABLE plt2_adv DETACH PARTITION plt2_adv_p3; +-- Change plt2_adv_p3 to the NULL partition +CREATE TABLE plt2_adv_p3_null PARTITION OF plt2_adv FOR VALUES IN (NULL, '0007', '0009'); +INSERT INTO plt2_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (7, 9); +INSERT INTO plt2_adv VALUES (-1, -1, NULL); +ANALYZE plt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- semi join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt1_adv t1 WHERE EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; +SELECT t1.* FROM plt1_adv t1 WHERE EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- anti join +EXPLAIN (COSTS OFF) +SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; +SELECT t1.* FROM plt1_adv t1 WHERE NOT EXISTS (SELECT 1 FROM plt2_adv t2 WHERE t1.a = t2.a AND t1.c = t2.c) AND t1.b < 10 ORDER BY t1.a; + +-- full join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; + +DROP TABLE plt1_adv_p1_null; +-- Restore plt1_adv_p1 +ALTER TABLE plt1_adv ATTACH PARTITION plt1_adv_p1 FOR VALUES IN ('0001', '0003'); +-- Add to plt1_adv the extra NULL partition containing only NULL values as the +-- key values +CREATE TABLE plt1_adv_extra PARTITION OF plt1_adv FOR VALUES IN (NULL); +INSERT INTO plt1_adv VALUES (-1, -1, NULL); +ANALYZE plt1_adv; + +DROP TABLE plt2_adv_p3_null; +-- Restore plt2_adv_p3 +ALTER TABLE plt2_adv ATTACH PARTITION plt2_adv_p3 FOR VALUES IN ('0007', '0009'); +ANALYZE plt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- left join; currently we can't do partitioned join if there are no matched +-- partitions on the nullable side +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- full join; currently we can't do partitioned join if there are no matched +-- partitions on the nullable side +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; + +-- Add to plt2_adv the extra NULL partition containing only NULL values as the +-- key values +CREATE TABLE plt2_adv_extra PARTITION OF plt2_adv FOR VALUES IN (NULL); +INSERT INTO plt2_adv VALUES (-1, -1, NULL); +ANALYZE plt2_adv; + +-- inner join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- left join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- full join +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 FULL JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE coalesce(t1.b, 0) < 10 AND coalesce(t2.b, 0) < 10 ORDER BY t1.a, t2.a; + +-- 3-way join to test the NULL partition of a join relation +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c, t3.a, t3.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) LEFT JOIN plt1_adv t3 ON (t1.a = t3.a AND t1.c = t3.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c, t3.a, t3.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) LEFT JOIN plt1_adv t3 ON (t1.a = t3.a AND t1.c = t3.c) WHERE t1.b < 10 ORDER BY t1.a; + +DROP TABLE plt1_adv_extra; +DROP TABLE plt2_adv_extra; + +-- Test default partitions +ALTER TABLE plt1_adv DETACH PARTITION plt1_adv_p1; +-- Change plt1_adv_p1 to the default partition +ALTER TABLE plt1_adv ATTACH PARTITION plt1_adv_p1 DEFAULT; +DROP TABLE plt1_adv_p3; +ANALYZE plt1_adv; + +DROP TABLE plt2_adv_p3; +ANALYZE plt2_adv; + +-- We can do partitioned join even if only one of relations has the default +-- partition +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +ALTER TABLE plt2_adv DETACH PARTITION plt2_adv_p2; +-- Change plt2_adv_p2 to contain '0005' in addition to '0004' and '0006' as +-- the key values +CREATE TABLE plt2_adv_p2_ext PARTITION OF plt2_adv FOR VALUES IN ('0004', '0005', '0006'); +INSERT INTO plt2_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (4, 5, 6); +ANALYZE plt2_adv; + +-- Partitioned join can't be applied because the default partition of plt1_adv +-- matches plt2_adv_p1 and plt2_adv_p2_ext +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +ALTER TABLE plt2_adv DETACH PARTITION plt2_adv_p2_ext; +-- Change plt2_adv_p2_ext to the default partition +ALTER TABLE plt2_adv ATTACH PARTITION plt2_adv_p2_ext DEFAULT; +ANALYZE plt2_adv; + +-- Partitioned join can't be applied because the default partition of plt1_adv +-- matches plt2_adv_p1 and plt2_adv_p2_ext +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +DROP TABLE plt2_adv_p2_ext; +-- Restore plt2_adv_p2 +ALTER TABLE plt2_adv ATTACH PARTITION plt2_adv_p2 FOR VALUES IN ('0004', '0006'); +ANALYZE plt2_adv; + +CREATE TABLE plt3_adv (a int, b int, c text) PARTITION BY LIST (c); +CREATE TABLE plt3_adv_p1 PARTITION OF plt3_adv FOR VALUES IN ('0004', '0006'); +CREATE TABLE plt3_adv_p2 PARTITION OF plt3_adv FOR VALUES IN ('0007', '0009'); +INSERT INTO plt3_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (4, 6, 7, 9); +ANALYZE plt3_adv; + +-- 3-way join to test the default partition of a join relation +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c, t3.a, t3.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) LEFT JOIN plt3_adv t3 ON (t1.a = t3.a AND t1.c = t3.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c, t3.a, t3.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) LEFT JOIN plt3_adv t3 ON (t1.a = t3.a AND t1.c = t3.c) WHERE t1.b < 10 ORDER BY t1.a; + +-- Test cases where one side has the default partition while the other side +-- has the NULL partition +DROP TABLE plt2_adv_p1; +-- Add the NULL partition to plt2_adv +CREATE TABLE plt2_adv_p1_null PARTITION OF plt2_adv FOR VALUES IN (NULL, '0001', '0003'); +INSERT INTO plt2_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (1, 3); +INSERT INTO plt2_adv VALUES (-1, -1, NULL); +ANALYZE plt2_adv; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +DROP TABLE plt2_adv_p1_null; +-- Add the NULL partition that contains only NULL values as the key values +CREATE TABLE plt2_adv_p1_null PARTITION OF plt2_adv FOR VALUES IN (NULL); +INSERT INTO plt2_adv VALUES (-1, -1, NULL); +ANALYZE plt2_adv; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.b < 10 ORDER BY t1.a; + +DROP TABLE plt1_adv; +DROP TABLE plt2_adv; +DROP TABLE plt3_adv; + +-- Test interaction of partitioned join with partition pruning +CREATE TABLE plt1_adv (a int, b int, c text) PARTITION BY LIST (c); +CREATE TABLE plt1_adv_p1 PARTITION OF plt1_adv FOR VALUES IN ('0001'); +CREATE TABLE plt1_adv_p2 PARTITION OF plt1_adv FOR VALUES IN ('0002'); +CREATE TABLE plt1_adv_p3 PARTITION OF plt1_adv FOR VALUES IN ('0003'); +CREATE TABLE plt1_adv_p4 PARTITION OF plt1_adv FOR VALUES IN (NULL, '0004', '0005'); +INSERT INTO plt1_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (1, 2, 3, 4, 5); +INSERT INTO plt1_adv VALUES (-1, -1, NULL); +ANALYZE plt1_adv; + +CREATE TABLE plt2_adv (a int, b int, c text) PARTITION BY LIST (c); +CREATE TABLE plt2_adv_p1 PARTITION OF plt2_adv FOR VALUES IN ('0001', '0002'); +CREATE TABLE plt2_adv_p2 PARTITION OF plt2_adv FOR VALUES IN (NULL); +CREATE TABLE plt2_adv_p3 PARTITION OF plt2_adv FOR VALUES IN ('0003'); +CREATE TABLE plt2_adv_p4 PARTITION OF plt2_adv FOR VALUES IN ('0004', '0005'); +INSERT INTO plt2_adv SELECT i, i, to_char(i % 10, 'FM0000') FROM generate_series(1, 299) i WHERE i % 10 IN (1, 2, 3, 4, 5); +INSERT INTO plt2_adv VALUES (-1, -1, NULL); +ANALYZE plt2_adv; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.c IN ('0003', '0004', '0005') AND t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.c IN ('0003', '0004', '0005') AND t1.b < 10 ORDER BY t1.a; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.c IS NULL AND t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.c IS NULL AND t1.b < 10 ORDER BY t1.a; + +CREATE TABLE plt1_adv_default PARTITION OF plt1_adv DEFAULT; +ANALYZE plt1_adv; + +CREATE TABLE plt2_adv_default PARTITION OF plt2_adv DEFAULT; +ANALYZE plt2_adv; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.c IN ('0003', '0004', '0005') AND t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 INNER JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.c IN ('0003', '0004', '0005') AND t1.b < 10 ORDER BY t1.a; + +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.c IS NULL AND t1.b < 10 ORDER BY t1.a; +SELECT t1.a, t1.c, t2.a, t2.c FROM plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE t1.c IS NULL AND t1.b < 10 ORDER BY t1.a; + +DROP TABLE plt1_adv; +DROP TABLE plt2_adv; + +-- Test the process_outer_partition() code path +CREATE TABLE plt1_adv (a int, b int, c text) PARTITION BY LIST (c); +CREATE TABLE plt1_adv_p1 PARTITION OF plt1_adv FOR VALUES IN ('0000', '0001', '0002'); +CREATE TABLE plt1_adv_p2 PARTITION OF plt1_adv FOR VALUES IN ('0003', '0004'); +INSERT INTO plt1_adv SELECT i, i, to_char(i % 5, 'FM0000') FROM generate_series(0, 24) i; +ANALYZE plt1_adv; + +CREATE TABLE plt2_adv (a int, b int, c text) PARTITION BY LIST (c); +CREATE TABLE plt2_adv_p1 PARTITION OF plt2_adv FOR VALUES IN ('0002'); +CREATE TABLE plt2_adv_p2 PARTITION OF plt2_adv FOR VALUES IN ('0003', '0004'); +INSERT INTO plt2_adv SELECT i, i, to_char(i % 5, 'FM0000') FROM generate_series(0, 24) i WHERE i % 5 IN (2, 3, 4); +ANALYZE plt2_adv; + +CREATE TABLE plt3_adv (a int, b int, c text) PARTITION BY LIST (c); +CREATE TABLE plt3_adv_p1 PARTITION OF plt3_adv FOR VALUES IN ('0001'); +CREATE TABLE plt3_adv_p2 PARTITION OF plt3_adv FOR VALUES IN ('0003', '0004'); +INSERT INTO plt3_adv SELECT i, i, to_char(i % 5, 'FM0000') FROM generate_series(0, 24) i WHERE i % 5 IN (1, 3, 4); +ANALYZE plt3_adv; + +-- This tests that when merging partitions from plt1_adv and plt2_adv in +-- merge_list_bounds(), process_outer_partition() returns an already-assigned +-- merged partition when re-called with plt1_adv_p1 for the second list value +-- '0001' of that partitin +EXPLAIN (COSTS OFF) +SELECT t1.a, t1.c, t2.a, t2.c, t3.a, t3.c FROM (plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.c = t2.c)) FULL JOIN plt3_adv t3 ON (t1.c = t3.c) WHERE coalesce(t1.a, 0) % 5 != 3 AND coalesce(t1.a, 0) % 5 != 4 ORDER BY t1.c, t1.a, t2.a, t3.a; +SELECT t1.a, t1.c, t2.a, t2.c, t3.a, t3.c FROM (plt1_adv t1 LEFT JOIN plt2_adv t2 ON (t1.c = t2.c)) FULL JOIN plt3_adv t3 ON (t1.c = t3.c) WHERE coalesce(t1.a, 0) % 5 != 3 AND coalesce(t1.a, 0) % 5 != 4 ORDER BY t1.c, t1.a, t2.a, t3.a; + +DROP TABLE plt1_adv; +DROP TABLE plt2_adv; +DROP TABLE plt3_adv; + + +-- Tests for multi-level partitioned tables +CREATE TABLE alpha (a double precision, b int, c text) PARTITION BY RANGE (a); +CREATE TABLE alpha_neg PARTITION OF alpha FOR VALUES FROM ('-Infinity') TO (0) PARTITION BY RANGE (b); +CREATE TABLE alpha_pos PARTITION OF alpha FOR VALUES FROM (0) TO (10.0) PARTITION BY LIST (c); +CREATE TABLE alpha_neg_p1 PARTITION OF alpha_neg FOR VALUES FROM (100) TO (200); +CREATE TABLE alpha_neg_p2 PARTITION OF alpha_neg FOR VALUES FROM (200) TO (300); +CREATE TABLE alpha_neg_p3 PARTITION OF alpha_neg FOR VALUES FROM (300) TO (400); +CREATE TABLE alpha_pos_p1 PARTITION OF alpha_pos FOR VALUES IN ('0001', '0003'); +CREATE TABLE alpha_pos_p2 PARTITION OF alpha_pos FOR VALUES IN ('0004', '0006'); +CREATE TABLE alpha_pos_p3 PARTITION OF alpha_pos FOR VALUES IN ('0008', '0009'); +INSERT INTO alpha_neg SELECT -1.0, i, to_char(i % 10, 'FM0000') FROM generate_series(100, 399) i WHERE i % 10 IN (1, 3, 4, 6, 8, 9); +INSERT INTO alpha_pos SELECT 1.0, i, to_char(i % 10, 'FM0000') FROM generate_series(100, 399) i WHERE i % 10 IN (1, 3, 4, 6, 8, 9); +ANALYZE alpha; + +CREATE TABLE beta (a double precision, b int, c text) PARTITION BY RANGE (a); +CREATE TABLE beta_neg PARTITION OF beta FOR VALUES FROM (-10.0) TO (0) PARTITION BY RANGE (b); +CREATE TABLE beta_pos PARTITION OF beta FOR VALUES FROM (0) TO ('Infinity') PARTITION BY LIST (c); +CREATE TABLE beta_neg_p1 PARTITION OF beta_neg FOR VALUES FROM (100) TO (150); +CREATE TABLE beta_neg_p2 PARTITION OF beta_neg FOR VALUES FROM (200) TO (300); +CREATE TABLE beta_neg_p3 PARTITION OF beta_neg FOR VALUES FROM (350) TO (500); +CREATE TABLE beta_pos_p1 PARTITION OF beta_pos FOR VALUES IN ('0002', '0003'); +CREATE TABLE beta_pos_p2 PARTITION OF beta_pos FOR VALUES IN ('0004', '0006'); +CREATE TABLE beta_pos_p3 PARTITION OF beta_pos FOR VALUES IN ('0007', '0009'); +INSERT INTO beta_neg SELECT -1.0, i, to_char(i % 10, 'FM0000') FROM generate_series(100, 149) i WHERE i % 10 IN (2, 3, 4, 6, 7, 9); +INSERT INTO beta_neg SELECT -1.0, i, to_char(i % 10, 'FM0000') FROM generate_series(200, 299) i WHERE i % 10 IN (2, 3, 4, 6, 7, 9); +INSERT INTO beta_neg SELECT -1.0, i, to_char(i % 10, 'FM0000') FROM generate_series(350, 499) i WHERE i % 10 IN (2, 3, 4, 6, 7, 9); +INSERT INTO beta_pos SELECT 1.0, i, to_char(i % 10, 'FM0000') FROM generate_series(100, 149) i WHERE i % 10 IN (2, 3, 4, 6, 7, 9); +INSERT INTO beta_pos SELECT 1.0, i, to_char(i % 10, 'FM0000') FROM generate_series(200, 299) i WHERE i % 10 IN (2, 3, 4, 6, 7, 9); +INSERT INTO beta_pos SELECT 1.0, i, to_char(i % 10, 'FM0000') FROM generate_series(350, 499) i WHERE i % 10 IN (2, 3, 4, 6, 7, 9); +ANALYZE beta; + +EXPLAIN (COSTS OFF) +SELECT t1.*, t2.* FROM alpha t1 INNER JOIN beta t2 ON (t1.a = t2.a AND t1.b = t2.b) WHERE t1.b >= 125 AND t1.b < 225 ORDER BY t1.a, t1.b; +SELECT t1.*, t2.* FROM alpha t1 INNER JOIN beta t2 ON (t1.a = t2.a AND t1.b = t2.b) WHERE t1.b >= 125 AND t1.b < 225 ORDER BY t1.a, t1.b; + +EXPLAIN (COSTS OFF) +SELECT t1.*, t2.* FROM alpha t1 INNER JOIN beta t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE ((t1.b >= 100 AND t1.b < 110) OR (t1.b >= 200 AND t1.b < 210)) AND ((t2.b >= 100 AND t2.b < 110) OR (t2.b >= 200 AND t2.b < 210)) AND t1.c IN ('0004', '0009') ORDER BY t1.a, t1.b, t2.b; +SELECT t1.*, t2.* FROM alpha t1 INNER JOIN beta t2 ON (t1.a = t2.a AND t1.c = t2.c) WHERE ((t1.b >= 100 AND t1.b < 110) OR (t1.b >= 200 AND t1.b < 210)) AND ((t2.b >= 100 AND t2.b < 110) OR (t2.b >= 200 AND t2.b < 210)) AND t1.c IN ('0004', '0009') ORDER BY t1.a, t1.b, t2.b; + +EXPLAIN (COSTS OFF) +SELECT t1.*, t2.* FROM alpha t1 INNER JOIN beta t2 ON (t1.a = t2.a AND t1.b = t2.b AND t1.c = t2.c) WHERE ((t1.b >= 100 AND t1.b < 110) OR (t1.b >= 200 AND t1.b < 210)) AND ((t2.b >= 100 AND t2.b < 110) OR (t2.b >= 200 AND t2.b < 210)) AND t1.c IN ('0004', '0009') ORDER BY t1.a, t1.b; +SELECT t1.*, t2.* FROM alpha t1 INNER JOIN beta t2 ON (t1.a = t2.a AND t1.b = t2.b AND t1.c = t2.c) WHERE ((t1.b >= 100 AND t1.b < 110) OR (t1.b >= 200 AND t1.b < 210)) AND ((t2.b >= 100 AND t2.b < 110) OR (t2.b >= 200 AND t2.b < 210)) AND t1.c IN ('0004', '0009') ORDER BY t1.a, t1.b; diff --git a/postgresql/examples/partition_prune.sql b/postgresql/examples/partition_prune.sql new file mode 100644 index 0000000..6658455 --- /dev/null +++ b/postgresql/examples/partition_prune.sql @@ -0,0 +1,1052 @@ +-- +-- Test partitioning planner code +-- + +-- Force generic plans to be used for all prepared statements in this file. +set plan_cache_mode = force_generic_plan; + +create table lp (a char) partition by list (a); +create table lp_default partition of lp default; +create table lp_ef partition of lp for values in ('e', 'f'); +create table lp_ad partition of lp for values in ('a', 'd'); +create table lp_bc partition of lp for values in ('b', 'c'); +create table lp_g partition of lp for values in ('g'); +create table lp_null partition of lp for values in (null); +explain (costs off) select * from lp; +explain (costs off) select * from lp where a > 'a' and a < 'd'; +explain (costs off) select * from lp where a > 'a' and a <= 'd'; +explain (costs off) select * from lp where a = 'a'; +explain (costs off) select * from lp where 'a' = a; /* commuted */ +explain (costs off) select * from lp where a is not null; +explain (costs off) select * from lp where a is null; +explain (costs off) select * from lp where a = 'a' or a = 'c'; +explain (costs off) select * from lp where a is not null and (a = 'a' or a = 'c'); +explain (costs off) select * from lp where a <> 'g'; +explain (costs off) select * from lp where a <> 'a' and a <> 'd'; +explain (costs off) select * from lp where a not in ('a', 'd'); + +-- collation matches the partitioning collation, pruning works +create table coll_pruning (a text collate "C") partition by list (a); +create table coll_pruning_a partition of coll_pruning for values in ('a'); +create table coll_pruning_b partition of coll_pruning for values in ('b'); +create table coll_pruning_def partition of coll_pruning default; +explain (costs off) select * from coll_pruning where a collate "C" = 'a' collate "C"; +-- collation doesn't match the partitioning collation, no pruning occurs +explain (costs off) select * from coll_pruning where a collate "POSIX" = 'a' collate "POSIX"; + +create table rlp (a int, b varchar) partition by range (a); +create table rlp_default partition of rlp default partition by list (a); +create table rlp_default_default partition of rlp_default default; +create table rlp_default_10 partition of rlp_default for values in (10); +create table rlp_default_30 partition of rlp_default for values in (30); +create table rlp_default_null partition of rlp_default for values in (null); +create table rlp1 partition of rlp for values from (minvalue) to (1); +create table rlp2 partition of rlp for values from (1) to (10); + +create table rlp3 (b varchar, a int) partition by list (b varchar_ops); +create table rlp3_default partition of rlp3 default; +create table rlp3abcd partition of rlp3 for values in ('ab', 'cd'); +create table rlp3efgh partition of rlp3 for values in ('ef', 'gh'); +create table rlp3nullxy partition of rlp3 for values in (null, 'xy'); +alter table rlp attach partition rlp3 for values from (15) to (20); + +create table rlp4 partition of rlp for values from (20) to (30) partition by range (a); +create table rlp4_default partition of rlp4 default; +create table rlp4_1 partition of rlp4 for values from (20) to (25); +create table rlp4_2 partition of rlp4 for values from (25) to (29); + +create table rlp5 partition of rlp for values from (31) to (maxvalue) partition by range (a); +create table rlp5_default partition of rlp5 default; +create table rlp5_1 partition of rlp5 for values from (31) to (40); + +explain (costs off) select * from rlp where a < 1; +explain (costs off) select * from rlp where 1 > a; /* commuted */ +explain (costs off) select * from rlp where a <= 1; +explain (costs off) select * from rlp where a = 1; +explain (costs off) select * from rlp where a = 1::bigint; /* same as above */ +explain (costs off) select * from rlp where a = 1::numeric; /* no pruning */ +explain (costs off) select * from rlp where a <= 10; +explain (costs off) select * from rlp where a > 10; +explain (costs off) select * from rlp where a < 15; +explain (costs off) select * from rlp where a <= 15; +explain (costs off) select * from rlp where a > 15 and b = 'ab'; +explain (costs off) select * from rlp where a = 16; +explain (costs off) select * from rlp where a = 16 and b in ('not', 'in', 'here'); +explain (costs off) select * from rlp where a = 16 and b < 'ab'; +explain (costs off) select * from rlp where a = 16 and b <= 'ab'; +explain (costs off) select * from rlp where a = 16 and b is null; +explain (costs off) select * from rlp where a = 16 and b is not null; +explain (costs off) select * from rlp where a is null; +explain (costs off) select * from rlp where a is not null; +explain (costs off) select * from rlp where a > 30; +explain (costs off) select * from rlp where a = 30; /* only default is scanned */ +explain (costs off) select * from rlp where a <= 31; +explain (costs off) select * from rlp where a = 1 or a = 7; +explain (costs off) select * from rlp where a = 1 or b = 'ab'; + +explain (costs off) select * from rlp where a > 20 and a < 27; +explain (costs off) select * from rlp where a = 29; +explain (costs off) select * from rlp where a >= 29; +explain (costs off) select * from rlp where a < 1 or (a > 20 and a < 25); + +-- where clause contradicts sub-partition's constraint +explain (costs off) select * from rlp where a = 20 or a = 40; +explain (costs off) select * from rlp3 where a = 20; /* empty */ + +-- redundant clauses are eliminated +explain (costs off) select * from rlp where a > 1 and a = 10; /* only default */ +explain (costs off) select * from rlp where a > 1 and a >=15; /* rlp3 onwards, including default */ +explain (costs off) select * from rlp where a = 1 and a = 3; /* empty */ +explain (costs off) select * from rlp where (a = 1 and a = 3) or (a > 1 and a = 15); + +-- multi-column keys +create table mc3p (a int, b int, c int) partition by range (a, abs(b), c); +create table mc3p_default partition of mc3p default; +create table mc3p0 partition of mc3p for values from (minvalue, minvalue, minvalue) to (1, 1, 1); +create table mc3p1 partition of mc3p for values from (1, 1, 1) to (10, 5, 10); +create table mc3p2 partition of mc3p for values from (10, 5, 10) to (10, 10, 10); +create table mc3p3 partition of mc3p for values from (10, 10, 10) to (10, 10, 20); +create table mc3p4 partition of mc3p for values from (10, 10, 20) to (10, maxvalue, maxvalue); +create table mc3p5 partition of mc3p for values from (11, 1, 1) to (20, 10, 10); +create table mc3p6 partition of mc3p for values from (20, 10, 10) to (20, 20, 20); +create table mc3p7 partition of mc3p for values from (20, 20, 20) to (maxvalue, maxvalue, maxvalue); + +explain (costs off) select * from mc3p where a = 1; +explain (costs off) select * from mc3p where a = 1 and abs(b) < 1; +explain (costs off) select * from mc3p where a = 1 and abs(b) = 1; +explain (costs off) select * from mc3p where a = 1 and abs(b) = 1 and c < 8; +explain (costs off) select * from mc3p where a = 10 and abs(b) between 5 and 35; +explain (costs off) select * from mc3p where a > 10; +explain (costs off) select * from mc3p where a >= 10; +explain (costs off) select * from mc3p where a < 10; +explain (costs off) select * from mc3p where a <= 10 and abs(b) < 10; +explain (costs off) select * from mc3p where a = 11 and abs(b) = 0; +explain (costs off) select * from mc3p where a = 20 and abs(b) = 10 and c = 100; +explain (costs off) select * from mc3p where a > 20; +explain (costs off) select * from mc3p where a >= 20; +explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1 and c = 1) or (a = 10 and abs(b) = 5 and c = 10) or (a > 11 and a < 20); +explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1 and c = 1) or (a = 10 and abs(b) = 5 and c = 10) or (a > 11 and a < 20) or a < 1; +explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1 and c = 1) or (a = 10 and abs(b) = 5 and c = 10) or (a > 11 and a < 20) or a < 1 or a = 1; +explain (costs off) select * from mc3p where a = 1 or abs(b) = 1 or c = 1; +explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1) or (a = 10 and abs(b) = 10); +explain (costs off) select * from mc3p where (a = 1 and abs(b) = 1) or (a = 10 and abs(b) = 9); + +-- a simpler multi-column keys case +create table mc2p (a int, b int) partition by range (a, b); +create table mc2p_default partition of mc2p default; +create table mc2p0 partition of mc2p for values from (minvalue, minvalue) to (1, minvalue); +create table mc2p1 partition of mc2p for values from (1, minvalue) to (1, 1); +create table mc2p2 partition of mc2p for values from (1, 1) to (2, minvalue); +create table mc2p3 partition of mc2p for values from (2, minvalue) to (2, 1); +create table mc2p4 partition of mc2p for values from (2, 1) to (2, maxvalue); +create table mc2p5 partition of mc2p for values from (2, maxvalue) to (maxvalue, maxvalue); + +explain (costs off) select * from mc2p where a < 2; +explain (costs off) select * from mc2p where a = 2 and b < 1; +explain (costs off) select * from mc2p where a > 1; +explain (costs off) select * from mc2p where a = 1 and b > 1; + +-- all partitions but the default one should be pruned +explain (costs off) select * from mc2p where a = 1 and b is null; +explain (costs off) select * from mc2p where a is null and b is null; +explain (costs off) select * from mc2p where a is null and b = 1; +explain (costs off) select * from mc2p where a is null; +explain (costs off) select * from mc2p where b is null; + +-- boolean partitioning +create table boolpart (a bool) partition by list (a); +create table boolpart_default partition of boolpart default; +create table boolpart_t partition of boolpart for values in ('true'); +create table boolpart_f partition of boolpart for values in ('false'); + +explain (costs off) select * from boolpart where a in (true, false); +explain (costs off) select * from boolpart where a = false; +explain (costs off) select * from boolpart where not a = false; +explain (costs off) select * from boolpart where a is true or a is not true; +explain (costs off) select * from boolpart where a is not true; +explain (costs off) select * from boolpart where a is not true and a is not false; +explain (costs off) select * from boolpart where a is unknown; +explain (costs off) select * from boolpart where a is not unknown; + +create table boolrangep (a bool, b bool, c int) partition by range (a,b,c); +create table boolrangep_tf partition of boolrangep for values from ('true', 'false', 0) to ('true', 'false', 100); +create table boolrangep_ft partition of boolrangep for values from ('false', 'true', 0) to ('false', 'true', 100); +create table boolrangep_ff1 partition of boolrangep for values from ('false', 'false', 0) to ('false', 'false', 50); +create table boolrangep_ff2 partition of boolrangep for values from ('false', 'false', 50) to ('false', 'false', 100); + +-- try a more complex case that's been known to trip up pruning in the past +explain (costs off) select * from boolrangep where not a and not b and c = 25; + +-- test scalar-to-array operators +create table coercepart (a varchar) partition by list (a); +create table coercepart_ab partition of coercepart for values in ('ab'); +create table coercepart_bc partition of coercepart for values in ('bc'); +create table coercepart_cd partition of coercepart for values in ('cd'); + +explain (costs off) select * from coercepart where a in ('ab', to_char(125, '999')); +explain (costs off) select * from coercepart where a ~ any ('{ab}'); +explain (costs off) select * from coercepart where a !~ all ('{ab}'); +explain (costs off) select * from coercepart where a ~ any ('{ab,bc}'); +explain (costs off) select * from coercepart where a !~ all ('{ab,bc}'); +explain (costs off) select * from coercepart where a = any ('{ab,bc}'); +explain (costs off) select * from coercepart where a = any ('{ab,null}'); +explain (costs off) select * from coercepart where a = any (null::text[]); +explain (costs off) select * from coercepart where a = all ('{ab}'); +explain (costs off) select * from coercepart where a = all ('{ab,bc}'); +explain (costs off) select * from coercepart where a = all ('{ab,null}'); +explain (costs off) select * from coercepart where a = all (null::text[]); + +drop table coercepart; + +CREATE TABLE part (a INT, b INT) PARTITION BY LIST (a); +CREATE TABLE part_p1 PARTITION OF part FOR VALUES IN (-2,-1,0,1,2); +CREATE TABLE part_p2 PARTITION OF part DEFAULT PARTITION BY RANGE(a); +CREATE TABLE part_p2_p1 PARTITION OF part_p2 DEFAULT; +CREATE TABLE part_rev (b INT, c INT, a INT); +ALTER TABLE part ATTACH PARTITION part_rev FOR VALUES IN (3); -- fail +ALTER TABLE part_rev DROP COLUMN c; +ALTER TABLE part ATTACH PARTITION part_rev FOR VALUES IN (3); -- now it's ok +INSERT INTO part VALUES (-1,-1), (1,1), (2,NULL), (NULL,-2),(NULL,NULL); +EXPLAIN (COSTS OFF) SELECT tableoid::regclass as part, a, b FROM part WHERE a IS NULL ORDER BY 1, 2, 3; +EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM part p(x) ORDER BY x; + +-- +-- some more cases +-- + +-- +-- pruning for partitioned table appearing inside a sub-query +-- +-- pruning won't work for mc3p, because some keys are Params +explain (costs off) select * from mc2p t1, lateral (select count(*) from mc3p t2 where t2.a = t1.b and abs(t2.b) = 1 and t2.c = 1) s where t1.a = 1; + +-- pruning should work fine, because values for a prefix of keys (a, b) are +-- available +explain (costs off) select * from mc2p t1, lateral (select count(*) from mc3p t2 where t2.c = t1.b and abs(t2.b) = 1 and t2.a = 1) s where t1.a = 1; + +-- also here, because values for all keys are provided +explain (costs off) select * from mc2p t1, lateral (select count(*) from mc3p t2 where t2.a = 1 and abs(t2.b) = 1 and t2.c = 1) s where t1.a = 1; + +-- +-- pruning with clauses containing <> operator +-- + +-- doesn't prune range partitions +create table rp (a int) partition by range (a); +create table rp0 partition of rp for values from (minvalue) to (1); +create table rp1 partition of rp for values from (1) to (2); +create table rp2 partition of rp for values from (2) to (maxvalue); + +explain (costs off) select * from rp where a <> 1; +explain (costs off) select * from rp where a <> 1 and a <> 2; + +-- null partition should be eliminated due to strict <> clause. +explain (costs off) select * from lp where a <> 'a'; + +-- ensure we detect contradictions in clauses; a can't be NULL and NOT NULL. +explain (costs off) select * from lp where a <> 'a' and a is null; +explain (costs off) select * from lp where (a <> 'a' and a <> 'd') or a is null; + +-- check that it also works for a partitioned table that's not root, +-- which in this case are partitions of rlp that are themselves +-- list-partitioned on b +explain (costs off) select * from rlp where a = 15 and b <> 'ab' and b <> 'cd' and b <> 'xy' and b is not null; + +-- +-- different collations for different keys with same expression +-- +create table coll_pruning_multi (a text) partition by range (substr(a, 1) collate "POSIX", substr(a, 1) collate "C"); +create table coll_pruning_multi1 partition of coll_pruning_multi for values from ('a', 'a') to ('a', 'e'); +create table coll_pruning_multi2 partition of coll_pruning_multi for values from ('a', 'e') to ('a', 'z'); +create table coll_pruning_multi3 partition of coll_pruning_multi for values from ('b', 'a') to ('b', 'e'); + +-- no pruning, because no value for the leading key +explain (costs off) select * from coll_pruning_multi where substr(a, 1) = 'e' collate "C"; + +-- pruning, with a value provided for the leading key +explain (costs off) select * from coll_pruning_multi where substr(a, 1) = 'a' collate "POSIX"; + +-- pruning, with values provided for both keys +explain (costs off) select * from coll_pruning_multi where substr(a, 1) = 'e' collate "C" and substr(a, 1) = 'a' collate "POSIX"; + +-- +-- LIKE operators don't prune +-- +create table like_op_noprune (a text) partition by list (a); +create table like_op_noprune1 partition of like_op_noprune for values in ('ABC'); +create table like_op_noprune2 partition of like_op_noprune for values in ('BCD'); +explain (costs off) select * from like_op_noprune where a like '%BC'; + +-- +-- tests wherein clause value requires a cross-type comparison function +-- +create table lparted_by_int2 (a smallint) partition by list (a); +create table lparted_by_int2_1 partition of lparted_by_int2 for values in (1); +create table lparted_by_int2_16384 partition of lparted_by_int2 for values in (16384); +explain (costs off) select * from lparted_by_int2 where a = 100000000000000; + +create table rparted_by_int2 (a smallint) partition by range (a); +create table rparted_by_int2_1 partition of rparted_by_int2 for values from (1) to (10); +create table rparted_by_int2_16384 partition of rparted_by_int2 for values from (10) to (16384); +-- all partitions pruned +explain (costs off) select * from rparted_by_int2 where a > 100000000000000; +create table rparted_by_int2_maxvalue partition of rparted_by_int2 for values from (16384) to (maxvalue); +-- all partitions but rparted_by_int2_maxvalue pruned +explain (costs off) select * from rparted_by_int2 where a > 100000000000000; + +drop table lp, coll_pruning, rlp, mc3p, mc2p, boolpart, boolrangep, rp, coll_pruning_multi, like_op_noprune, lparted_by_int2, rparted_by_int2; + +-- +-- Test Partition pruning for HASH partitioning +-- +-- Use hand-rolled hash functions and operator classes to get predictable +-- result on different machines. See the definitions of +-- part_part_test_int4_ops and part_test_text_ops in insert.sql. +-- + +create table hp (a int, b text) partition by hash (a part_test_int4_ops, b part_test_text_ops); +create table hp0 partition of hp for values with (modulus 4, remainder 0); +create table hp3 partition of hp for values with (modulus 4, remainder 3); +create table hp1 partition of hp for values with (modulus 4, remainder 1); +create table hp2 partition of hp for values with (modulus 4, remainder 2); + +insert into hp values (null, null); +insert into hp values (1, null); +insert into hp values (1, 'xxx'); +insert into hp values (null, 'xxx'); +insert into hp values (2, 'xxx'); +insert into hp values (1, 'abcde'); +select tableoid::regclass, * from hp order by 1; + +-- partial keys won't prune, nor would non-equality conditions +explain (costs off) select * from hp where a = 1; +explain (costs off) select * from hp where b = 'xxx'; +explain (costs off) select * from hp where a is null; +explain (costs off) select * from hp where b is null; +explain (costs off) select * from hp where a < 1 and b = 'xxx'; +explain (costs off) select * from hp where a <> 1 and b = 'yyy'; +explain (costs off) select * from hp where a <> 1 and b <> 'xxx'; + +-- pruning should work if either a value or a IS NULL clause is provided for +-- each of the keys +explain (costs off) select * from hp where a is null and b is null; +explain (costs off) select * from hp where a = 1 and b is null; +explain (costs off) select * from hp where a = 1 and b = 'xxx'; +explain (costs off) select * from hp where a is null and b = 'xxx'; +explain (costs off) select * from hp where a = 2 and b = 'xxx'; +explain (costs off) select * from hp where a = 1 and b = 'abcde'; +explain (costs off) select * from hp where (a = 1 and b = 'abcde') or (a = 2 and b = 'xxx') or (a is null and b is null); + +drop table hp; + +-- +-- Test runtime partition pruning +-- +create table ab (a int not null, b int not null) partition by list (a); +create table ab_a2 partition of ab for values in(2) partition by list (b); +create table ab_a2_b1 partition of ab_a2 for values in (1); +create table ab_a2_b2 partition of ab_a2 for values in (2); +create table ab_a2_b3 partition of ab_a2 for values in (3); +create table ab_a1 partition of ab for values in(1) partition by list (b); +create table ab_a1_b1 partition of ab_a1 for values in (1); +create table ab_a1_b2 partition of ab_a1 for values in (2); +create table ab_a1_b3 partition of ab_a1 for values in (3); +create table ab_a3 partition of ab for values in(3) partition by list (b); +create table ab_a3_b1 partition of ab_a3 for values in (1); +create table ab_a3_b2 partition of ab_a3 for values in (2); +create table ab_a3_b3 partition of ab_a3 for values in (3); + +-- Disallow index only scans as concurrent transactions may stop visibility +-- bits being set causing "Heap Fetches" to be unstable in the EXPLAIN ANALYZE +-- output. +set enable_indexonlyscan = off; + +prepare ab_q1 (int, int, int) as +select * from ab where a between $1 and $2 and b <= $3; + +explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2, 3); +explain (analyze, costs off, summary off, timing off) execute ab_q1 (1, 2, 3); + +deallocate ab_q1; + +-- Runtime pruning after optimizer pruning +prepare ab_q1 (int, int) as +select a from ab where a between $1 and $2 and b < 3; + +explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 2); +explain (analyze, costs off, summary off, timing off) execute ab_q1 (2, 4); + +-- Ensure a mix of PARAM_EXTERN and PARAM_EXEC Params work together at +-- different levels of partitioning. +prepare ab_q2 (int, int) as +select a from ab where a between $1 and $2 and b < (select 3); + +explain (analyze, costs off, summary off, timing off) execute ab_q2 (2, 2); + +-- As above, but swap the PARAM_EXEC Param to the first partition level +prepare ab_q3 (int, int) as +select a from ab where b between $1 and $2 and a < (select 3); + +explain (analyze, costs off, summary off, timing off) execute ab_q3 (2, 2); + +-- Test a backwards Append scan +create table list_part (a int) partition by list (a); +create table list_part1 partition of list_part for values in (1); +create table list_part2 partition of list_part for values in (2); +create table list_part3 partition of list_part for values in (3); +create table list_part4 partition of list_part for values in (4); + +insert into list_part select generate_series(1,4); + +begin; + +-- Don't select an actual value out of the table as the order of the Append's +-- subnodes may not be stable. +declare cur SCROLL CURSOR for select 1 from list_part where a > (select 1) and a < (select 4); + +-- move beyond the final row +move 3 from cur; + +-- Ensure we get two rows. +fetch backward all from cur; + +commit; + +begin; + +-- Test run-time pruning using stable functions +create function list_part_fn(int) returns int as $$ begin return $1; end;$$ language plpgsql stable; + +-- Ensure pruning works using a stable function containing no Vars +explain (analyze, costs off, summary off, timing off) select * from list_part where a = list_part_fn(1); + +-- Ensure pruning does not take place when the function has a Var parameter +explain (analyze, costs off, summary off, timing off) select * from list_part where a = list_part_fn(a); + +-- Ensure pruning does not take place when the expression contains a Var. +explain (analyze, costs off, summary off, timing off) select * from list_part where a = list_part_fn(1) + a; + +rollback; + +drop table list_part; + +-- Parallel append + +-- Parallel queries won't necessarily get as many workers as the planner +-- asked for. This affects not only the "Workers Launched:" field of EXPLAIN +-- results, but also row counts and loop counts for parallel scans, Gathers, +-- and everything in between. This function filters out the values we can't +-- rely on to be stable. +-- This removes enough info that you might wonder why bother with EXPLAIN +-- ANALYZE at all. The answer is that we need to see '(never executed)' +-- notations because that's the only way to verify runtime pruning. +create function explain_parallel_append(text) returns setof text +language plpgsql as +$$ +declare + ln text; +begin + for ln in + execute format('explain (analyze, costs off, summary off, timing off) %s', + $1) + loop + ln := regexp_replace(ln, 'Workers Launched: \d+', 'Workers Launched: N'); + ln := regexp_replace(ln, 'actual rows=\d+ loops=\d+', 'actual rows=N loops=N'); + ln := regexp_replace(ln, 'Rows Removed by Filter: \d+', 'Rows Removed by Filter: N'); + return next ln; + end loop; +end; +$$; + +prepare ab_q4 (int, int) as +select avg(a) from ab where a between $1 and $2 and b < 4; + +-- Encourage use of parallel plans +set parallel_setup_cost = 0; +set parallel_tuple_cost = 0; +set min_parallel_table_scan_size = 0; +set max_parallel_workers_per_gather = 2; + +select explain_parallel_append('execute ab_q4 (2, 2)'); + +-- Test run-time pruning with IN lists. +prepare ab_q5 (int, int, int) as +select avg(a) from ab where a in($1,$2,$3) and b < 4; + +select explain_parallel_append('execute ab_q5 (1, 1, 1)'); +select explain_parallel_append('execute ab_q5 (2, 3, 3)'); + +-- Try some params whose values do not belong to any partition. +select explain_parallel_append('execute ab_q5 (33, 44, 55)'); + +-- Test Parallel Append with PARAM_EXEC Params +select explain_parallel_append('select count(*) from ab where (a = (select 1) or a = (select 3)) and b = 2'); + +-- Test pruning during parallel nested loop query +create table lprt_a (a int not null); +-- Insert some values we won't find in ab +insert into lprt_a select 0 from generate_series(1,100); + +-- and insert some values that we should find. +insert into lprt_a values(1),(1); + +analyze lprt_a; + +create index ab_a2_b1_a_idx on ab_a2_b1 (a); +create index ab_a2_b2_a_idx on ab_a2_b2 (a); +create index ab_a2_b3_a_idx on ab_a2_b3 (a); +create index ab_a1_b1_a_idx on ab_a1_b1 (a); +create index ab_a1_b2_a_idx on ab_a1_b2 (a); +create index ab_a1_b3_a_idx on ab_a1_b3 (a); +create index ab_a3_b1_a_idx on ab_a3_b1 (a); +create index ab_a3_b2_a_idx on ab_a3_b2 (a); +create index ab_a3_b3_a_idx on ab_a3_b3 (a); + +set enable_hashjoin = 0; +set enable_mergejoin = 0; + +select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on ab.a = a.a where a.a in(0, 0, 1)'); + +-- Ensure the same partitions are pruned when we make the nested loop +-- parameter an Expr rather than a plain Param. +select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on ab.a = a.a + 0 where a.a in(0, 0, 1)'); + +insert into lprt_a values(3),(3); + +select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on ab.a = a.a where a.a in(1, 0, 3)'); +select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on ab.a = a.a where a.a in(1, 0, 0)'); + +delete from lprt_a where a = 1; + +select explain_parallel_append('select avg(ab.a) from ab inner join lprt_a a on ab.a = a.a where a.a in(1, 0, 0)'); + +reset enable_hashjoin; +reset enable_mergejoin; +reset parallel_setup_cost; +reset parallel_tuple_cost; +reset min_parallel_table_scan_size; +reset max_parallel_workers_per_gather; + +-- Test run-time partition pruning with an initplan +explain (analyze, costs off, summary off, timing off) +select * from ab where a = (select max(a) from lprt_a) and b = (select max(a)-1 from lprt_a); + +-- Test run-time partition pruning with UNION ALL parents +explain (analyze, costs off, summary off, timing off) +select * from (select * from ab where a = 1 union all select * from ab) ab where b = (select 1); + +-- A case containing a UNION ALL with a non-partitioned child. +explain (analyze, costs off, summary off, timing off) +select * from (select * from ab where a = 1 union all (values(10,5)) union all select * from ab) ab where b = (select 1); + +-- Another UNION ALL test, but containing a mix of exec init and exec run-time pruning. +create table xy_1 (x int, y int); +insert into xy_1 values(100,-10); + +set enable_bitmapscan = 0; +set enable_indexscan = 0; + +prepare ab_q6 as +select * from ( + select tableoid::regclass,a,b from ab +union all + select tableoid::regclass,x,y from xy_1 +union all + select tableoid::regclass,a,b from ab +) ab where a = $1 and b = (select -10); + +-- Ensure the xy_1 subplan is not pruned. +explain (analyze, costs off, summary off, timing off) execute ab_q6(1); + +-- Ensure we see just the xy_1 row. +execute ab_q6(100); + +reset enable_bitmapscan; +reset enable_indexscan; + +deallocate ab_q1; +deallocate ab_q2; +deallocate ab_q3; +deallocate ab_q4; +deallocate ab_q5; +deallocate ab_q6; + +-- UPDATE on a partition subtree has been seen to have problems. +insert into ab values (1,2); +explain (analyze, costs off, summary off, timing off) +update ab_a1 set b = 3 from ab where ab.a = 1 and ab.a = ab_a1.a; +table ab; + +-- Test UPDATE where source relation has run-time pruning enabled +truncate ab; +insert into ab values (1, 1), (1, 2), (1, 3), (2, 1); +explain (analyze, costs off, summary off, timing off) +update ab_a1 set b = 3 from ab_a2 where ab_a2.b = (select 1); +select tableoid::regclass, * from ab; + +drop table ab, lprt_a; + +-- Join +create table tbl1(col1 int); +insert into tbl1 values (501), (505); + +-- Basic table +create table tprt (col1 int) partition by range (col1); +create table tprt_1 partition of tprt for values from (1) to (501); +create table tprt_2 partition of tprt for values from (501) to (1001); +create table tprt_3 partition of tprt for values from (1001) to (2001); +create table tprt_4 partition of tprt for values from (2001) to (3001); +create table tprt_5 partition of tprt for values from (3001) to (4001); +create table tprt_6 partition of tprt for values from (4001) to (5001); + +create index tprt1_idx on tprt_1 (col1); +create index tprt2_idx on tprt_2 (col1); +create index tprt3_idx on tprt_3 (col1); +create index tprt4_idx on tprt_4 (col1); +create index tprt5_idx on tprt_5 (col1); +create index tprt6_idx on tprt_6 (col1); + +insert into tprt values (10), (20), (501), (502), (505), (1001), (4500); + +set enable_hashjoin = off; +set enable_mergejoin = off; + +explain (analyze, costs off, summary off, timing off) +select * from tbl1 join tprt on tbl1.col1 > tprt.col1; + +explain (analyze, costs off, summary off, timing off) +select * from tbl1 join tprt on tbl1.col1 = tprt.col1; + +select tbl1.col1, tprt.col1 from tbl1 +inner join tprt on tbl1.col1 > tprt.col1 +order by tbl1.col1, tprt.col1; + +select tbl1.col1, tprt.col1 from tbl1 +inner join tprt on tbl1.col1 = tprt.col1 +order by tbl1.col1, tprt.col1; + +-- Multiple partitions +insert into tbl1 values (1001), (1010), (1011); +explain (analyze, costs off, summary off, timing off) +select * from tbl1 inner join tprt on tbl1.col1 > tprt.col1; + +explain (analyze, costs off, summary off, timing off) +select * from tbl1 inner join tprt on tbl1.col1 = tprt.col1; + +select tbl1.col1, tprt.col1 from tbl1 +inner join tprt on tbl1.col1 > tprt.col1 +order by tbl1.col1, tprt.col1; + +select tbl1.col1, tprt.col1 from tbl1 +inner join tprt on tbl1.col1 = tprt.col1 +order by tbl1.col1, tprt.col1; + +-- Last partition +delete from tbl1; +insert into tbl1 values (4400); +explain (analyze, costs off, summary off, timing off) +select * from tbl1 join tprt on tbl1.col1 < tprt.col1; + +select tbl1.col1, tprt.col1 from tbl1 +inner join tprt on tbl1.col1 < tprt.col1 +order by tbl1.col1, tprt.col1; + +-- No matching partition +delete from tbl1; +insert into tbl1 values (10000); +explain (analyze, costs off, summary off, timing off) +select * from tbl1 join tprt on tbl1.col1 = tprt.col1; + +select tbl1.col1, tprt.col1 from tbl1 +inner join tprt on tbl1.col1 = tprt.col1 +order by tbl1.col1, tprt.col1; + +drop table tbl1, tprt; + +-- Test with columns defined in varying orders between each level +create table part_abc (a int not null, b int not null, c int not null) partition by list (a); +create table part_bac (b int not null, a int not null, c int not null) partition by list (b); +create table part_cab (c int not null, a int not null, b int not null) partition by list (c); +create table part_abc_p1 (a int not null, b int not null, c int not null); + +alter table part_abc attach partition part_bac for values in(1); +alter table part_bac attach partition part_cab for values in(2); +alter table part_cab attach partition part_abc_p1 for values in(3); + +prepare part_abc_q1 (int, int, int) as +select * from part_abc where a = $1 and b = $2 and c = $3; + +-- Single partition should be scanned. +explain (analyze, costs off, summary off, timing off) execute part_abc_q1 (1, 2, 3); + +deallocate part_abc_q1; + +drop table part_abc; + +-- Ensure that an Append node properly handles a sub-partitioned table +-- matching without any of its leaf partitions matching the clause. +create table listp (a int, b int) partition by list (a); +create table listp_1 partition of listp for values in(1) partition by list (b); +create table listp_1_1 partition of listp_1 for values in(1); +create table listp_2 partition of listp for values in(2) partition by list (b); +create table listp_2_1 partition of listp_2 for values in(2); +select * from listp where b = 1; + +-- Ensure that an Append node properly can handle selection of all first level +-- partitions before finally detecting the correct set of 2nd level partitions +-- which match the given parameter. +prepare q1 (int,int) as select * from listp where b in ($1,$2); + +explain (analyze, costs off, summary off, timing off) execute q1 (1,1); + +explain (analyze, costs off, summary off, timing off) execute q1 (2,2); + +-- Try with no matching partitions. +explain (analyze, costs off, summary off, timing off) execute q1 (0,0); + +deallocate q1; + +-- Test more complex cases where a not-equal condition further eliminates partitions. +prepare q1 (int,int,int,int) as select * from listp where b in($1,$2) and $3 <> b and $4 <> b; + +-- Both partitions allowed by IN clause, but one disallowed by <> clause +explain (analyze, costs off, summary off, timing off) execute q1 (1,2,2,0); + +-- Both partitions allowed by IN clause, then both excluded again by <> clauses. +explain (analyze, costs off, summary off, timing off) execute q1 (1,2,2,1); + +-- Ensure Params that evaluate to NULL properly prune away all partitions +explain (analyze, costs off, summary off, timing off) +select * from listp where a = (select null::int); + +drop table listp; + +-- +-- check that stable query clauses are only used in run-time pruning +-- +create table stable_qual_pruning (a timestamp) partition by range (a); +create table stable_qual_pruning1 partition of stable_qual_pruning + for values from ('2000-01-01') to ('2000-02-01'); +create table stable_qual_pruning2 partition of stable_qual_pruning + for values from ('2000-02-01') to ('2000-03-01'); +create table stable_qual_pruning3 partition of stable_qual_pruning + for values from ('3000-02-01') to ('3000-03-01'); + +-- comparison against a stable value requires run-time pruning +explain (analyze, costs off, summary off, timing off) +select * from stable_qual_pruning where a < localtimestamp; + +-- timestamp < timestamptz comparison is only stable, not immutable +explain (analyze, costs off, summary off, timing off) +select * from stable_qual_pruning where a < '2000-02-01'::timestamptz; + +-- check ScalarArrayOp cases +explain (analyze, costs off, summary off, timing off) +select * from stable_qual_pruning + where a = any(array['2010-02-01', '2020-01-01']::timestamp[]); +explain (analyze, costs off, summary off, timing off) +select * from stable_qual_pruning + where a = any(array['2000-02-01', '2010-01-01']::timestamp[]); +explain (analyze, costs off, summary off, timing off) +select * from stable_qual_pruning + where a = any(array['2000-02-01', localtimestamp]::timestamp[]); +explain (analyze, costs off, summary off, timing off) +select * from stable_qual_pruning + where a = any(array['2010-02-01', '2020-01-01']::timestamptz[]); +explain (analyze, costs off, summary off, timing off) +select * from stable_qual_pruning + where a = any(array['2000-02-01', '2010-01-01']::timestamptz[]); +explain (analyze, costs off, summary off, timing off) +select * from stable_qual_pruning + where a = any(null::timestamptz[]); + +drop table stable_qual_pruning; + +-- +-- Check that pruning with composite range partitioning works correctly when +-- it must ignore clauses for trailing keys once it has seen a clause with +-- non-inclusive operator for an earlier key +-- +create table mc3p (a int, b int, c int) partition by range (a, abs(b), c); +create table mc3p0 partition of mc3p + for values from (0, 0, 0) to (0, maxvalue, maxvalue); +create table mc3p1 partition of mc3p + for values from (1, 1, 1) to (2, minvalue, minvalue); +create table mc3p2 partition of mc3p + for values from (2, minvalue, minvalue) to (3, maxvalue, maxvalue); +insert into mc3p values (0, 1, 1), (1, 1, 1), (2, 1, 1); + +explain (analyze, costs off, summary off, timing off) +select * from mc3p where a < 3 and abs(b) = 1; + +-- +-- Check that pruning with composite range partitioning works correctly when +-- a combination of runtime parameters is specified, not all of whose values +-- are available at the same time +-- +prepare ps1 as + select * from mc3p where a = $1 and abs(b) < (select 3); +explain (analyze, costs off, summary off, timing off) +execute ps1(1); +deallocate ps1; +prepare ps2 as + select * from mc3p where a <= $1 and abs(b) < (select 3); +explain (analyze, costs off, summary off, timing off) +execute ps2(1); +deallocate ps2; + +drop table mc3p; + +-- Ensure runtime pruning works with initplans params with boolean types +create table boolvalues (value bool not null); +insert into boolvalues values('t'),('f'); + +create table boolp (a bool) partition by list (a); +create table boolp_t partition of boolp for values in('t'); +create table boolp_f partition of boolp for values in('f'); + +explain (analyze, costs off, summary off, timing off) +select * from boolp where a = (select value from boolvalues where value); + +explain (analyze, costs off, summary off, timing off) +select * from boolp where a = (select value from boolvalues where not value); + +drop table boolp; + +-- +-- Test run-time pruning of MergeAppend subnodes +-- +set enable_seqscan = off; +set enable_sort = off; +create table ma_test (a int, b int) partition by range (a); +create table ma_test_p1 partition of ma_test for values from (0) to (10); +create table ma_test_p2 partition of ma_test for values from (10) to (20); +create table ma_test_p3 partition of ma_test for values from (20) to (30); +insert into ma_test select x,x from generate_series(0,29) t(x); +create index on ma_test (b); + +analyze ma_test; +prepare mt_q1 (int) as select a from ma_test where a >= $1 and a % 10 = 5 order by b; + +explain (analyze, costs off, summary off, timing off) execute mt_q1(15); +execute mt_q1(15); +explain (analyze, costs off, summary off, timing off) execute mt_q1(25); +execute mt_q1(25); +-- Ensure MergeAppend behaves correctly when no subplans match +explain (analyze, costs off, summary off, timing off) execute mt_q1(35); +execute mt_q1(35); + +deallocate mt_q1; + +prepare mt_q2 (int) as select * from ma_test where a >= $1 order by b limit 1; + +-- Ensure output list looks sane when the MergeAppend has no subplans. +explain (analyze, verbose, costs off, summary off, timing off) execute mt_q2 (35); + +deallocate mt_q2; + +-- ensure initplan params properly prune partitions +explain (analyze, costs off, summary off, timing off) select * from ma_test where a >= (select min(b) from ma_test_p2) order by b; + +reset enable_seqscan; +reset enable_sort; + +drop table ma_test; + +reset enable_indexonlyscan; + +-- +-- check that pruning works properly when the partition key is of a +-- pseudotype +-- + +-- array type list partition key +create table pp_arrpart (a int[]) partition by list (a); +create table pp_arrpart1 partition of pp_arrpart for values in ('{1}'); +create table pp_arrpart2 partition of pp_arrpart for values in ('{2, 3}', '{4, 5}'); +explain (costs off) select * from pp_arrpart where a = '{1}'; +explain (costs off) select * from pp_arrpart where a = '{1, 2}'; +explain (costs off) select * from pp_arrpart where a in ('{4, 5}', '{1}'); +explain (costs off) update pp_arrpart set a = a where a = '{1}'; +explain (costs off) delete from pp_arrpart where a = '{1}'; +drop table pp_arrpart; + +-- array type hash partition key +create table pph_arrpart (a int[]) partition by hash (a); +create table pph_arrpart1 partition of pph_arrpart for values with (modulus 2, remainder 0); +create table pph_arrpart2 partition of pph_arrpart for values with (modulus 2, remainder 1); +insert into pph_arrpart values ('{1}'), ('{1, 2}'), ('{4, 5}'); +select tableoid::regclass, * from pph_arrpart order by 1; +explain (costs off) select * from pph_arrpart where a = '{1}'; +explain (costs off) select * from pph_arrpart where a = '{1, 2}'; +explain (costs off) select * from pph_arrpart where a in ('{4, 5}', '{1}'); +drop table pph_arrpart; + +-- enum type list partition key +create type pp_colors as enum ('green', 'blue', 'black'); +create table pp_enumpart (a pp_colors) partition by list (a); +create table pp_enumpart_green partition of pp_enumpart for values in ('green'); +create table pp_enumpart_blue partition of pp_enumpart for values in ('blue'); +explain (costs off) select * from pp_enumpart where a = 'blue'; +explain (costs off) select * from pp_enumpart where a = 'black'; +drop table pp_enumpart; +drop type pp_colors; + +-- record type as partition key +create type pp_rectype as (a int, b int); +create table pp_recpart (a pp_rectype) partition by list (a); +create table pp_recpart_11 partition of pp_recpart for values in ('(1,1)'); +create table pp_recpart_23 partition of pp_recpart for values in ('(2,3)'); +explain (costs off) select * from pp_recpart where a = '(1,1)'::pp_rectype; +explain (costs off) select * from pp_recpart where a = '(1,2)'::pp_rectype; +drop table pp_recpart; +drop type pp_rectype; + +-- range type partition key +create table pp_intrangepart (a int4range) partition by list (a); +create table pp_intrangepart12 partition of pp_intrangepart for values in ('[1,2]'); +create table pp_intrangepart2inf partition of pp_intrangepart for values in ('[2,)'); +explain (costs off) select * from pp_intrangepart where a = '[1,2]'::int4range; +explain (costs off) select * from pp_intrangepart where a = '(1,2)'::int4range; +drop table pp_intrangepart; + +-- +-- Ensure the enable_partition_prune GUC properly disables partition pruning. +-- + +create table pp_lp (a int, value int) partition by list (a); +create table pp_lp1 partition of pp_lp for values in(1); +create table pp_lp2 partition of pp_lp for values in(2); + +explain (costs off) select * from pp_lp where a = 1; +explain (costs off) update pp_lp set value = 10 where a = 1; +explain (costs off) delete from pp_lp where a = 1; + +set enable_partition_pruning = off; + +set constraint_exclusion = 'partition'; -- this should not affect the result. + +explain (costs off) select * from pp_lp where a = 1; +explain (costs off) update pp_lp set value = 10 where a = 1; +explain (costs off) delete from pp_lp where a = 1; + +set constraint_exclusion = 'off'; -- this should not affect the result. + +explain (costs off) select * from pp_lp where a = 1; +explain (costs off) update pp_lp set value = 10 where a = 1; +explain (costs off) delete from pp_lp where a = 1; + +drop table pp_lp; + +-- Ensure enable_partition_prune does not affect non-partitioned tables. + +create table inh_lp (a int, value int); +create table inh_lp1 (a int, value int, check(a = 1)) inherits (inh_lp); +create table inh_lp2 (a int, value int, check(a = 2)) inherits (inh_lp); + +set constraint_exclusion = 'partition'; + +-- inh_lp2 should be removed in the following 3 cases. +explain (costs off) select * from inh_lp where a = 1; +explain (costs off) update inh_lp set value = 10 where a = 1; +explain (costs off) delete from inh_lp where a = 1; + +-- Ensure we don't exclude normal relations when we only expect to exclude +-- inheritance children +explain (costs off) update inh_lp1 set value = 10 where a = 2; + +drop table inh_lp cascade; + +reset enable_partition_pruning; +reset constraint_exclusion; + +-- Check pruning for a partition tree containing only temporary relations +create temp table pp_temp_parent (a int) partition by list (a); +create temp table pp_temp_part_1 partition of pp_temp_parent for values in (1); +create temp table pp_temp_part_def partition of pp_temp_parent default; +explain (costs off) select * from pp_temp_parent where true; +explain (costs off) select * from pp_temp_parent where a = 2; +drop table pp_temp_parent; + +-- Stress run-time partition pruning a bit more, per bug reports +create temp table p (a int, b int, c int) partition by list (a); +create temp table p1 partition of p for values in (1); +create temp table p2 partition of p for values in (2); +create temp table q (a int, b int, c int) partition by list (a); +create temp table q1 partition of q for values in (1) partition by list (b); +create temp table q11 partition of q1 for values in (1) partition by list (c); +create temp table q111 partition of q11 for values in (1); +create temp table q2 partition of q for values in (2) partition by list (b); +create temp table q21 partition of q2 for values in (1); +create temp table q22 partition of q2 for values in (2); + +insert into q22 values (2, 2, 3); + +explain (costs off) +select * +from ( + select * from p + union all + select * from q1 + union all + select 1, 1, 1 + ) s(a, b, c) +where s.a = 1 and s.b = 1 and s.c = (select 1); + +select * +from ( + select * from p + union all + select * from q1 + union all + select 1, 1, 1 + ) s(a, b, c) +where s.a = 1 and s.b = 1 and s.c = (select 1); + +prepare q (int, int) as +select * +from ( + select * from p + union all + select * from q1 + union all + select 1, 1, 1 + ) s(a, b, c) +where s.a = $1 and s.b = $2 and s.c = (select 1); + +explain (costs off) execute q (1, 1); +execute q (1, 1); + +drop table p, q; + +-- Ensure run-time pruning works correctly when we match a partitioned table +-- on the first level but find no matching partitions on the second level. +create table listp (a int, b int) partition by list (a); +create table listp1 partition of listp for values in(1); +create table listp2 partition of listp for values in(2) partition by list(b); +create table listp2_10 partition of listp2 for values in (10); + +explain (analyze, costs off, summary off, timing off) +select * from listp where a = (select 2) and b <> 10; + +-- +-- check that a partition directly accessed in a query is excluded with +-- constraint_exclusion = on +-- + +-- turn off partition pruning, so that it doesn't interfere +set enable_partition_pruning to off; + +-- setting constraint_exclusion to 'partition' disables exclusion +set constraint_exclusion to 'partition'; +explain (costs off) select * from listp1 where a = 2; +explain (costs off) update listp1 set a = 1 where a = 2; +-- constraint exclusion enabled +set constraint_exclusion to 'on'; +explain (costs off) select * from listp1 where a = 2; +explain (costs off) update listp1 set a = 1 where a = 2; + +reset constraint_exclusion; +reset enable_partition_pruning; + +drop table listp; diff --git a/postgresql/examples/password.sql b/postgresql/examples/password.sql new file mode 100644 index 0000000..98f4991 --- /dev/null +++ b/postgresql/examples/password.sql @@ -0,0 +1,109 @@ +-- +-- Tests for password types +-- + +-- Tests for GUC password_encryption +SET password_encryption = 'novalue'; -- error +SET password_encryption = true; -- error +SET password_encryption = 'md5'; -- ok +SET password_encryption = 'scram-sha-256'; -- ok + +-- consistency of password entries +SET password_encryption = 'md5'; +CREATE ROLE regress_passwd1 PASSWORD 'role_pwd1'; +CREATE ROLE regress_passwd2 PASSWORD 'role_pwd2'; +SET password_encryption = 'scram-sha-256'; +CREATE ROLE regress_passwd3 PASSWORD 'role_pwd3'; +CREATE ROLE regress_passwd4 PASSWORD NULL; + +-- check list of created entries +-- +-- The scram secret will look something like: +-- SCRAM-SHA-256$4096:E4HxLGtnRzsYwg==$6YtlR4t69SguDiwFvbVgVZtuz6gpJQQqUMZ7IQJK5yI=:ps75jrHeYU4lXCcXI4O8oIdJ3eO8o2jirjruw9phBTo= +-- +-- Since the salt is random, the exact value stored will be different on every test +-- run. Use a regular expression to mask the changing parts. +SELECT rolname, regexp_replace(rolpassword, '(SCRAM-SHA-256)\$(\d+):([a-zA-Z0-9+/=]+)\$([a-zA-Z0-9+=/]+):([a-zA-Z0-9+/=]+)', '\1$\2:$:') as rolpassword_masked + FROM pg_authid + WHERE rolname LIKE 'regress_passwd%' + ORDER BY rolname, rolpassword; + +-- Rename a role +ALTER ROLE regress_passwd2 RENAME TO regress_passwd2_new; +-- md5 entry should have been removed +SELECT rolname, rolpassword + FROM pg_authid + WHERE rolname LIKE 'regress_passwd2_new' + ORDER BY rolname, rolpassword; +ALTER ROLE regress_passwd2_new RENAME TO regress_passwd2; + +-- Change passwords with ALTER USER. With plaintext or already-encrypted +-- passwords. +SET password_encryption = 'md5'; + +-- encrypt with MD5 +ALTER ROLE regress_passwd2 PASSWORD 'foo'; +-- already encrypted, use as they are +ALTER ROLE regress_passwd1 PASSWORD 'md5cd3578025fe2c3d7ed1b9a9b26238b70'; +ALTER ROLE regress_passwd3 PASSWORD 'SCRAM-SHA-256$4096:VLK4RMaQLCvNtQ==$6YtlR4t69SguDiwFvbVgVZtuz6gpJQQqUMZ7IQJK5yI=:ps75jrHeYU4lXCcXI4O8oIdJ3eO8o2jirjruw9phBTo='; + +SET password_encryption = 'scram-sha-256'; +-- create SCRAM secret +ALTER ROLE regress_passwd4 PASSWORD 'foo'; +-- already encrypted with MD5, use as it is +CREATE ROLE regress_passwd5 PASSWORD 'md5e73a4b11df52a6068f8b39f90be36023'; + +-- This looks like a valid SCRAM-SHA-256 secret, but it is not +-- so it should be hashed with SCRAM-SHA-256. +CREATE ROLE regress_passwd6 PASSWORD 'SCRAM-SHA-256$1234'; +-- These may look like valid MD5 secrets, but they are not, so they +-- should be hashed with SCRAM-SHA-256. +-- trailing garbage at the end +CREATE ROLE regress_passwd7 PASSWORD 'md5012345678901234567890123456789zz'; +-- invalid length +CREATE ROLE regress_passwd8 PASSWORD 'md501234567890123456789012345678901zz'; + +SELECT rolname, regexp_replace(rolpassword, '(SCRAM-SHA-256)\$(\d+):([a-zA-Z0-9+/=]+)\$([a-zA-Z0-9+=/]+):([a-zA-Z0-9+/=]+)', '\1$\2:$:') as rolpassword_masked + FROM pg_authid + WHERE rolname LIKE 'regress_passwd%' + ORDER BY rolname, rolpassword; + +-- An empty password is not allowed, in any form +CREATE ROLE regress_passwd_empty PASSWORD ''; +ALTER ROLE regress_passwd_empty PASSWORD 'md585939a5ce845f1a1b620742e3c659e0a'; +ALTER ROLE regress_passwd_empty PASSWORD 'SCRAM-SHA-256$4096:hpFyHTUsSWcR7O9P$LgZFIt6Oqdo27ZFKbZ2nV+vtnYM995pDh9ca6WSi120=:qVV5NeluNfUPkwm7Vqat25RjSPLkGeoZBQs6wVv+um4='; +SELECT rolpassword FROM pg_authid WHERE rolname='regress_passwd_empty'; + +-- Test with invalid stored and server keys. +-- +-- The first is valid, to act as a control. The others have too long +-- stored/server keys. They will be re-hashed. +CREATE ROLE regress_passwd_sha_len0 PASSWORD 'SCRAM-SHA-256$4096:A6xHKoH/494E941doaPOYg==$Ky+A30sewHIH3VHQLRN9vYsuzlgNyGNKCh37dy96Rqw=:COPdlNiIkrsacU5QoxydEuOH6e/KfiipeETb/bPw8ZI='; +CREATE ROLE regress_passwd_sha_len1 PASSWORD 'SCRAM-SHA-256$4096:A6xHKoH/494E941doaPOYg==$Ky+A30sewHIH3VHQLRN9vYsuzlgNyGNKCh37dy96RqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=:COPdlNiIkrsacU5QoxydEuOH6e/KfiipeETb/bPw8ZI='; +CREATE ROLE regress_passwd_sha_len2 PASSWORD 'SCRAM-SHA-256$4096:A6xHKoH/494E941doaPOYg==$Ky+A30sewHIH3VHQLRN9vYsuzlgNyGNKCh37dy96Rqw=:COPdlNiIkrsacU5QoxydEuOH6e/KfiipeETb/bPw8ZIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='; + +-- Check that the invalid secrets were re-hashed. A re-hashed secret +-- should not contain the original salt. +SELECT rolname, rolpassword not like '%A6xHKoH/494E941doaPOYg==%' as is_rolpassword_rehashed + FROM pg_authid + WHERE rolname LIKE 'regress_passwd_sha_len%' + ORDER BY rolname; + +DROP ROLE regress_passwd1; +DROP ROLE regress_passwd2; +DROP ROLE regress_passwd3; +DROP ROLE regress_passwd4; +DROP ROLE regress_passwd5; +DROP ROLE regress_passwd6; +DROP ROLE regress_passwd7; +DROP ROLE regress_passwd8; +DROP ROLE regress_passwd_empty; +DROP ROLE regress_passwd_sha_len0; +DROP ROLE regress_passwd_sha_len1; +DROP ROLE regress_passwd_sha_len2; + +-- all entries should have been removed +SELECT rolname, rolpassword + FROM pg_authid + WHERE rolname LIKE 'regress_passwd%' + ORDER BY rolname, rolpassword; diff --git a/postgresql/examples/path.sql b/postgresql/examples/path.sql new file mode 100644 index 0000000..318decf --- /dev/null +++ b/postgresql/examples/path.sql @@ -0,0 +1,44 @@ +-- +-- PATH +-- + +--DROP TABLE PATH_TBL; + +CREATE TABLE PATH_TBL (f1 path); + +INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]'); + +INSERT INTO PATH_TBL VALUES (' ( ( 1 , 2 ) , ( 3 , 4 ) ) '); + +INSERT INTO PATH_TBL VALUES ('[ (0,0),(3,0),(4,5),(1,6) ]'); + +INSERT INTO PATH_TBL VALUES ('((1,2) ,(3,4 ))'); + +INSERT INTO PATH_TBL VALUES ('1,2 ,3,4 '); + +INSERT INTO PATH_TBL VALUES (' [1,2,3, 4] '); + +INSERT INTO PATH_TBL VALUES ('((10,20))'); -- Only one point + +INSERT INTO PATH_TBL VALUES ('[ 11,12,13,14 ]'); + +INSERT INTO PATH_TBL VALUES ('( 11,12,13,14) '); + +-- bad values for parser testing +INSERT INTO PATH_TBL VALUES ('[]'); + +INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]'); + +INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)'); + +INSERT INTO PATH_TBL VALUES ('(1,2,3,4'); + +INSERT INTO PATH_TBL VALUES ('(1,2),(3,4)]'); + +SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1); + +SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1); + +SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL; + +SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL; diff --git a/postgresql/examples/pg_lsn.sql b/postgresql/examples/pg_lsn.sql new file mode 100644 index 0000000..615368b --- /dev/null +++ b/postgresql/examples/pg_lsn.sql @@ -0,0 +1,56 @@ +-- +-- PG_LSN +-- + +CREATE TABLE PG_LSN_TBL (f1 pg_lsn); + +-- Largest and smallest input +INSERT INTO PG_LSN_TBL VALUES ('0/0'); +INSERT INTO PG_LSN_TBL VALUES ('FFFFFFFF/FFFFFFFF'); + +-- Incorrect input +INSERT INTO PG_LSN_TBL VALUES ('G/0'); +INSERT INTO PG_LSN_TBL VALUES ('-1/0'); +INSERT INTO PG_LSN_TBL VALUES (' 0/12345678'); +INSERT INTO PG_LSN_TBL VALUES ('ABCD/'); +INSERT INTO PG_LSN_TBL VALUES ('/ABCD'); + +-- Min/Max aggregation +SELECT MIN(f1), MAX(f1) FROM PG_LSN_TBL; + +DROP TABLE PG_LSN_TBL; + +-- Operators +SELECT '0/16AE7F8' = '0/16AE7F8'::pg_lsn; +SELECT '0/16AE7F8'::pg_lsn != '0/16AE7F7'; +SELECT '0/16AE7F7' < '0/16AE7F8'::pg_lsn; +SELECT '0/16AE7F8' > pg_lsn '0/16AE7F7'; +SELECT '0/16AE7F7'::pg_lsn - '0/16AE7F8'::pg_lsn; +SELECT '0/16AE7F8'::pg_lsn - '0/16AE7F7'::pg_lsn; +SELECT '0/16AE7F7'::pg_lsn + 16::numeric; +SELECT 16::numeric + '0/16AE7F7'::pg_lsn; +SELECT '0/16AE7F7'::pg_lsn - 16::numeric; +SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 1::numeric; +SELECT 'FFFFFFFF/FFFFFFFE'::pg_lsn + 2::numeric; -- out of range error +SELECT '0/1'::pg_lsn - 1::numeric; +SELECT '0/1'::pg_lsn - 2::numeric; -- out of range error +SELECT '0/0'::pg_lsn + ('FFFFFFFF/FFFFFFFF'::pg_lsn - '0/0'::pg_lsn); +SELECT 'FFFFFFFF/FFFFFFFF'::pg_lsn - ('FFFFFFFF/FFFFFFFF'::pg_lsn - '0/0'::pg_lsn); +SELECT '0/16AE7F7'::pg_lsn + 'NaN'::numeric; +SELECT '0/16AE7F7'::pg_lsn - 'NaN'::numeric; + +-- Check btree and hash opclasses +EXPLAIN (COSTS OFF) +SELECT DISTINCT (i || '/' || j)::pg_lsn f + FROM generate_series(1, 10) i, + generate_series(1, 10) j, + generate_series(1, 5) k + WHERE i <= 10 AND j > 0 AND j <= 10 + ORDER BY f; + +SELECT DISTINCT (i || '/' || j)::pg_lsn f + FROM generate_series(1, 10) i, + generate_series(1, 10) j, + generate_series(1, 5) k + WHERE i <= 10 AND j > 0 AND j <= 10 + ORDER BY f; diff --git a/postgresql/examples/plancache.sql b/postgresql/examples/plancache.sql new file mode 100644 index 0000000..4b2f11d --- /dev/null +++ b/postgresql/examples/plancache.sql @@ -0,0 +1,225 @@ +-- +-- Tests to exercise the plan caching/invalidation mechanism +-- + +CREATE TEMP TABLE pcachetest AS SELECT * FROM int8_tbl; + +-- create and use a cached plan +PREPARE prepstmt AS SELECT * FROM pcachetest; + +EXECUTE prepstmt; + +-- and one with parameters +PREPARE prepstmt2(bigint) AS SELECT * FROM pcachetest WHERE q1 = $1; + +EXECUTE prepstmt2(123); + +-- invalidate the plans and see what happens +DROP TABLE pcachetest; + +EXECUTE prepstmt; +EXECUTE prepstmt2(123); + +-- recreate the temp table (this demonstrates that the raw plan is +-- purely textual and doesn't depend on OIDs, for instance) +CREATE TEMP TABLE pcachetest AS SELECT * FROM int8_tbl ORDER BY 2; + +EXECUTE prepstmt; +EXECUTE prepstmt2(123); + +-- prepared statements should prevent change in output tupdesc, +-- since clients probably aren't expecting that to change on the fly +ALTER TABLE pcachetest ADD COLUMN q3 bigint; + +EXECUTE prepstmt; +EXECUTE prepstmt2(123); + +-- but we're nice guys and will let you undo your mistake +ALTER TABLE pcachetest DROP COLUMN q3; + +EXECUTE prepstmt; +EXECUTE prepstmt2(123); + +-- Try it with a view, which isn't directly used in the resulting plan +-- but should trigger invalidation anyway +CREATE TEMP VIEW pcacheview AS + SELECT * FROM pcachetest; + +PREPARE vprep AS SELECT * FROM pcacheview; + +EXECUTE vprep; + +CREATE OR REPLACE TEMP VIEW pcacheview AS + SELECT q1, q2/2 AS q2 FROM pcachetest; + +EXECUTE vprep; + +-- Check basic SPI plan invalidation + +create function cache_test(int) returns int as $$ +declare total int; +begin + create temp table t1(f1 int); + insert into t1 values($1); + insert into t1 values(11); + insert into t1 values(12); + insert into t1 values(13); + select sum(f1) into total from t1; + drop table t1; + return total; +end +$$ language plpgsql; + +select cache_test(1); +select cache_test(2); +select cache_test(3); + +-- Check invalidation of plpgsql "simple expression" + +create temp view v1 as + select 2+2 as f1; + +create function cache_test_2() returns int as $$ +begin + return f1 from v1; +end$$ language plpgsql; + +select cache_test_2(); + +create or replace temp view v1 as + select 2+2+4 as f1; +select cache_test_2(); + +create or replace temp view v1 as + select 2+2+4+(select max(unique1) from tenk1) as f1; +select cache_test_2(); + +--- Check that change of search_path is honored when re-using cached plan + +create schema s1 + create table abc (f1 int); + +create schema s2 + create table abc (f1 int); + +insert into s1.abc values(123); +insert into s2.abc values(456); + +set search_path = s1; + +prepare p1 as select f1 from abc; + +execute p1; + +set search_path = s2; + +select f1 from abc; + +execute p1; + +alter table s1.abc add column f2 float8; -- force replan + +execute p1; + +drop schema s1 cascade; +drop schema s2 cascade; + +reset search_path; + +-- Check that invalidation deals with regclass constants + +create temp sequence seq; + +prepare p2 as select nextval('seq'); + +execute p2; + +drop sequence seq; + +create temp sequence seq; + +execute p2; + +-- Check DDL via SPI, immediately followed by SPI plan re-use +-- (bug in original coding) + +create function cachebug() returns void as $$ +declare r int; +begin + drop table if exists temptable cascade; + create temp table temptable as select * from generate_series(1,3) as f1; + create temp view vv as select * from temptable; + for r in select * from vv loop + raise notice '%', r; + end loop; +end$$ language plpgsql; + +select cachebug(); +select cachebug(); + +-- Check that addition or removal of any partition is correctly dealt with by +-- default partition table when it is being used in prepared statement. +create table pc_list_parted (a int) partition by list(a); +create table pc_list_part_null partition of pc_list_parted for values in (null); +create table pc_list_part_1 partition of pc_list_parted for values in (1); +create table pc_list_part_def partition of pc_list_parted default; +prepare pstmt_def_insert (int) as insert into pc_list_part_def values($1); +-- should fail +execute pstmt_def_insert(null); +execute pstmt_def_insert(1); +create table pc_list_part_2 partition of pc_list_parted for values in (2); +execute pstmt_def_insert(2); +alter table pc_list_parted detach partition pc_list_part_null; +-- should be ok +execute pstmt_def_insert(null); +drop table pc_list_part_1; +-- should be ok +execute pstmt_def_insert(1); +drop table pc_list_parted, pc_list_part_null; +deallocate pstmt_def_insert; + +-- Test plan_cache_mode + +create table test_mode (a int); +insert into test_mode select 1 from generate_series(1,1000) union all select 2; +create index on test_mode (a); +analyze test_mode; + +prepare test_mode_pp (int) as select count(*) from test_mode where a = $1; +select name, generic_plans, custom_plans from pg_prepared_statements + where name = 'test_mode_pp'; + +-- up to 5 executions, custom plan is used +set plan_cache_mode to auto; +explain (costs off) execute test_mode_pp(2); +select name, generic_plans, custom_plans from pg_prepared_statements + where name = 'test_mode_pp'; + +-- force generic plan +set plan_cache_mode to force_generic_plan; +explain (costs off) execute test_mode_pp(2); +select name, generic_plans, custom_plans from pg_prepared_statements + where name = 'test_mode_pp'; + +-- get to generic plan by 5 executions +set plan_cache_mode to auto; +execute test_mode_pp(1); -- 1x +execute test_mode_pp(1); -- 2x +execute test_mode_pp(1); -- 3x +execute test_mode_pp(1); -- 4x +select name, generic_plans, custom_plans from pg_prepared_statements + where name = 'test_mode_pp'; +execute test_mode_pp(1); -- 5x +select name, generic_plans, custom_plans from pg_prepared_statements + where name = 'test_mode_pp'; + +-- we should now get a really bad plan +explain (costs off) execute test_mode_pp(2); + +-- but we can force a custom plan +set plan_cache_mode to force_custom_plan; +explain (costs off) execute test_mode_pp(2); +select name, generic_plans, custom_plans from pg_prepared_statements + where name = 'test_mode_pp'; + +drop table test_mode; diff --git a/postgresql/examples/plpgsql-control-structures.sql b/postgresql/examples/plpgsql-control-structures.sql new file mode 100644 index 0000000..3a5f540 --- /dev/null +++ b/postgresql/examples/plpgsql-control-structures.sql @@ -0,0 +1,206 @@ +CREATE OR REPLACE FUNCTION getAllFoo() RETURNS SETOF foo AS +$BODY$ +DECLARE + r foo%rowtype; +BEGIN + FOR r IN SELECT * FROM foo + WHERE fooid > 0 + LOOP + -- can do some processing here + RETURN NEXT r; -- return current row of SELECT + END LOOP; + RETURN; +IF parentid IS NULL OR parentid = '' +THEN + RETURN fullname; +ELSE + RETURN hp_true_filename(parentid) || '/' || fullname; +END IF; + +IF v_count > 0 THEN + INSERT INTO users_count (count) VALUES (v_count); + RETURN 't'; +ELSE + RETURN 'f'; +END IF; +IF number = 0 THEN + result := 'zero'; +ELSIF number > 0 THEN + result := 'positive'; +ELSIF number < 0 THEN + result := 'negative'; +ELSE + -- hmm, the only other possibility is that number is null + result := 'NULL'; +END IF; +IF demo_row.sex = 'm' THEN + pretty_sex := 'man'; +ELSE + IF demo_row.sex = 'f' THEN + pretty_sex := 'woman'; + END IF; +END IF; + +CASE x + WHEN 1, 2 THEN + msg := 'one or two'; + ELSE + msg := 'other value than one or two'; +END CASE; + +CASE + WHEN x BETWEEN 0 AND 10 THEN + msg := 'value is between zero and ten'; + WHEN x BETWEEN 11 AND 20 THEN + msg := 'value is between eleven and twenty'; +END CASE; + +LOOP + -- some computations + IF count > 0 THEN + EXIT; -- exit loop + END IF; +END LOOP; + +LOOP + -- some computations + EXIT WHEN count > 0; -- same result as previous example +END LOOP; + +<> +BEGIN + -- some computations + IF stocks > 100000 THEN + EXIT ablock; -- causes exit from the BEGIN block + END IF; + -- computations here will be skipped when stocks > 100000 +END; + + +LOOP + -- some computations + EXIT WHEN count > 100; + CONTINUE WHEN count < 50; + -- some computations for count IN [50 .. 100] +END LOOP; + +WHILE amount_owed > 0 AND gift_certificate_balance > 0 LOOP + EXIT WHEN count > 100; + -- some computations here +END LOOP; + +WHILE NOT done LOOP + EXIT WHEN count > 100; + -- some computations here +END LOOP; + +FOR i IN 1..10 LOOP + -- i will take on the values 1,2,3,4,5,6,7,8,9,10 within the loop +END LOOP; + +FOR i IN REVERSE 10..1 LOOP + -- i will take on the values 10,9,8,7,6,5,4,3,2,1 within the loop +END LOOP; + +FOR i IN REVERSE 10..1 BY 2 LOOP + -- i will take on the values 10,8,6,4,2 within the loop +END LOOP; + +END +$BODY$ +LANGUAGE plpgsql; + + + + +CREATE FUNCTION cs_refresh_mviews() RETURNS integer AS $$ +DECLARE + mviews RECORD; +BEGIN + RAISE NOTICE 'Refreshing materialized views...'; + + FOR mviews IN SELECT * FROM cs_materialized_views ORDER BY sort_key LOOP + + -- Now "mviews" has one record from cs_materialized_views + + RAISE NOTICE 'Refreshing materialized view %s ...', quote_ident(mviews.mv_name); + EXECUTE 'TRUNCATE TABLE ' || quote_ident(mviews.mv_name); + EXECUTE 'INSERT INTO ' + || quote_ident(mviews.mv_name) || ' ' + || mviews.mv_query; + END LOOP; + + RAISE NOTICE 'Done refreshing materialized views.'; + RETURN 1; +END; +$$ LANGUAGE plpgsql; + + +CREATE FUNCTION sum(int[]) RETURNS int8 AS $$ +DECLARE + s int8 := 0; + x int; +BEGIN + FOREACH x IN ARRAY $1 + LOOP + s := s + x; + END LOOP; + RETURN s; +END; +$$ LANGUAGE plpgsql; + + +CREATE FUNCTION scan_rows(int[]) RETURNS void AS $$ +DECLARE + x int[]; +BEGIN + FOREACH x SLICE 1 IN ARRAY $1 + LOOP + RAISE NOTICE 'row = %', x; + END LOOP; + +BEGIN + UPDATE mytab SET firstname = 'Joe' WHERE lastname = 'Jones'; + x := x + 1; + y := x / 0; +EXCEPTION + WHEN division_by_zero THEN + RAISE NOTICE 'caught division_by_zero'; + RETURN x; +END; + +END; +$$ LANGUAGE plpgsql; + + +CREATE FUNCTION merge_db(key INT, data TEXT) RETURNS VOID AS +$$ +BEGIN + LOOP + -- first try to update the key + UPDATE db SET b = data WHERE a = key; + IF found THEN + RETURN; + END IF; + -- not there, so try to insert the key + -- if someone else inserts the same key concurrently, + -- we could get a unique-key failure + BEGIN + INSERT INTO db(a,b) VALUES (key, data); + RETURN; + EXCEPTION WHEN unique_violation THEN + -- Do nothing, and loop to try the UPDATE again. + END; + END LOOP; +BEGIN + -- some processing which might cause an exception + NULL; +EXCEPTION WHEN OTHERS THEN + GET STACKED DIAGNOSTICS text_var1 = MESSAGE_TEXT, + text_var2 = PG_EXCEPTION_DETAIL, + text_var3 = PG_EXCEPTION_HINT; +END; +END; +$$ +LANGUAGE plpgsql; + diff --git a/postgresql/examples/plpgsql-cursors.sql b/postgresql/examples/plpgsql-cursors.sql new file mode 100644 index 0000000..b1fe0c9 --- /dev/null +++ b/postgresql/examples/plpgsql-cursors.sql @@ -0,0 +1,59 @@ +CREATE FUNCTION dummy() RETURNS VOID AS +$$ +DECLARE + curs1 refcursor; + curs2 CURSOR FOR SELECT * FROM tenk1; + curs3 CURSOR (key integer) FOR SELECT * FROM tenk1 WHERE unique1 = key; +BEGIN +OPEN curs1 FOR EXECUTE 'SELECT * FROM ' || quote_ident(tabname) + || ' WHERE col1 = $1' USING keyvalue; +OPEN curs2; +OPEN curs3(42); +OPEN curs3(key := 42); + +FETCH curs1 INTO rowvar; +FETCH curs2 INTO foo, bar, baz; +FETCH LAST FROM curs3 INTO x, y; +FETCH RELATIVE -2 FROM curs4 INTO x; + +MOVE curs1; +MOVE LAST FROM curs3; +MOVE RELATIVE -2 FROM curs4; +MOVE FORWARD 2 FROM curs4; + +UPDATE foo SET dataval = myval WHERE CURRENT OF curs1; +CLOSE curs1; + + + +END; +$$ +LANGUAGE plpgsql; + + + +CREATE FUNCTION reffunc(refcursor) RETURNS refcursor AS ' +BEGIN + OPEN $1 FOR SELECT col FROM test; + RETURN $1; +END; +' LANGUAGE plpgsql; + +CREATE FUNCTION reffunc2() RETURNS refcursor AS ' +DECLARE + ref refcursor; +BEGIN + OPEN ref FOR SELECT col FROM test; + RETURN ref; +END; +' LANGUAGE plpgsql; + +CREATE FUNCTION myfunc(refcursor, refcursor) RETURNS SETOF refcursor AS $$ +BEGIN + OPEN $1 FOR SELECT * FROM table_1; + RETURN NEXT $1; + OPEN $2 FOR SELECT * FROM table_2; + RETURN NEXT $2; +END; +$$ LANGUAGE plpgsql; + diff --git a/postgresql/examples/plpgsql-declarations.sql b/postgresql/examples/plpgsql-declarations.sql new file mode 100644 index 0000000..d8cebc3 --- /dev/null +++ b/postgresql/examples/plpgsql-declarations.sql @@ -0,0 +1,96 @@ +CREATE FUNCTION sales_tax(subtotal real) RETURNS real AS $$ +BEGIN + RETURN subtotal * 0.06; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION sales_tax(real) RETURNS real AS $$ +DECLARE + subtotal ALIAS FOR $1; +BEGIN + RETURN subtotal * 0.06; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION instr(varchar, integer) RETURNS integer AS $$ +DECLARE + v_string ALIAS FOR $1; + index ALIAS FOR $2; +BEGIN + -- some computations using v_string and index here +END; +$$ LANGUAGE plpgsql; + + +CREATE FUNCTION concat_selected_fields(in_t sometablename) RETURNS text AS $$ +BEGIN + RETURN in_t.f1 || in_t.f3 || in_t.f5 || in_t.f7; +END; +$$ LANGUAGE plpgsql; +CREATE FUNCTION sales_tax(subtotal real, OUT tax real) AS $$ +BEGIN + tax := subtotal * 0.06; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION sum_n_product(x int, y int, OUT sum int, OUT prod int) AS $$ +BEGIN + sum := x + y; + prod := x * y; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION extended_sales(p_itemno int) +RETURNS TABLE(quantity int, total numeric) AS $$ +BEGIN + RETURN QUERY SELECT s.quantity, s.quantity * s.price FROM sales AS s + WHERE s.itemno = p_itemno; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION add_three_values(v1 anyelement, v2 anyelement, v3 anyelement) +RETURNS anyelement AS $$ +DECLARE + result ALIAS FOR $0; +BEGIN + result := v1 + v2 + v3; + RETURN result; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION add_three_values(v1 anyelement, v2 anyelement, v3 anyelement, + OUT sum anyelement) +AS $$ +BEGIN + sum := v1 + v2 + v3; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION add_three_values(v1 anyelement, v2 anyelement, v3 anyelement, + OUT sum anyelement) +AS $$ +BEGIN + sum := v1 + v2 + v3; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION less_than(a text, b text) RETURNS boolean AS $$ +BEGIN + RETURN a < b; +END; +$$ LANGUAGE plpgsql; + + +CREATE FUNCTION less_than(a text, b text) RETURNS boolean AS $$ +DECLARE + local_a text := a; + local_b text := b; +BEGIN + RETURN local_a < local_b; +END; +$$ LANGUAGE plpgsql; +CREATE FUNCTION less_than_c(a text, b text) RETURNS boolean AS $$ +BEGIN + RETURN a < b COLLATE "C"; +END; +$$ LANGUAGE plpgsql; diff --git a/postgresql/examples/plpgsql-errors-and-messages.sql b/postgresql/examples/plpgsql-errors-and-messages.sql new file mode 100644 index 0000000..9eb06ae --- /dev/null +++ b/postgresql/examples/plpgsql-errors-and-messages.sql @@ -0,0 +1,15 @@ +CREATE FUNCTION dummy() RETURNS VOID AS +$$ +BEGIN + RAISE NOTICE 'Calling cs_create_job(%)', v_job_id; +RAISE EXCEPTION 'Nonexistent ID --> %', user_id + USING HINT = 'Please check your user ID'; +RAISE 'Duplicate user ID: %', user_id USING ERRCODE = 'unique_violation'; +RAISE 'Duplicate user ID: %', user_id USING ERRCODE = '23505'; +RAISE division_by_zero; +RAISE SQLSTATE '22012'; +RAISE unique_violation USING MESSAGE = 'Duplicate user ID: ' || user_id; + +END; +$$ +LANGUAGE plpgsql; diff --git a/postgresql/examples/plpgsql-implementation.sql b/postgresql/examples/plpgsql-implementation.sql new file mode 100644 index 0000000..518444b --- /dev/null +++ b/postgresql/examples/plpgsql-implementation.sql @@ -0,0 +1,32 @@ +CREATE FUNCTION stamp_user(id int, comment text) RETURNS void AS $$ + #variable_conflict use_variable + DECLARE + curtime timestamp := now(); + BEGIN + UPDATE users SET last_modified = curtime, comment = comment + WHERE users.id = id; + END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION stamp_user(id int, comment text) RETURNS void AS $$ + <> + DECLARE + curtime timestamp := now(); + BEGIN + UPDATE users SET last_modified = fn.curtime, comment = stamp_user.comment + WHERE users.id = stamp_user.id; + END; +$$ LANGUAGE plpgsql; +CREATE FUNCTION logfunc1(logtxt text) RETURNS void AS $$ + BEGIN + INSERT INTO logtable VALUES (logtxt, 'now'); + END; +$$ LANGUAGE plpgsql; +CREATE FUNCTION logfunc2(logtxt text) RETURNS void AS $$ + DECLARE + curtime timestamp; + BEGIN + curtime := 'now'; + INSERT INTO logtable VALUES (logtxt, curtime); + END; +$$ LANGUAGE plpgsql; diff --git a/postgresql/examples/plpgsql-structure.sql b/postgresql/examples/plpgsql-structure.sql new file mode 100644 index 0000000..a9d3d22 --- /dev/null +++ b/postgresql/examples/plpgsql-structure.sql @@ -0,0 +1,23 @@ +CREATE FUNCTION somefunc() RETURNS integer AS $$ +<< outerblock >> +DECLARE + quantity integer := 30; +BEGIN + RAISE NOTICE 'Quantity here is %', quantity; -- Prints 30 + quantity := 50; + -- + -- Create a subblock + -- + DECLARE + quantity integer := 80; + BEGIN + RAISE NOTICE 'Quantity here is %', quantity; -- Prints 80 + RAISE NOTICE 'Outer quantity here is %', outerblock.quantity; -- Prints 50 + END; + + RAISE NOTICE 'Quantity here is %', quantity; -- Prints 50 + + RETURN quantity; +END; +$$ LANGUAGE plpgsql; + diff --git a/postgresql/examples/plpgsql-trigger.sql b/postgresql/examples/plpgsql-trigger.sql new file mode 100644 index 0000000..5fa10d7 --- /dev/null +++ b/postgresql/examples/plpgsql-trigger.sql @@ -0,0 +1,161 @@ +CREATE FUNCTION emp_stamp() RETURNS trigger AS $emp_stamp$ + BEGIN + -- Check that empname and salary are given + IF NEW.empname IS NULL THEN + RAISE EXCEPTION 'empname cannot be null'; + END IF; + IF NEW.salary IS NULL THEN + RAISE EXCEPTION '% cannot have null salary', NEW.empname; + END IF; + + -- Who works for us when she must pay for it? + IF NEW.salary < 0 THEN + RAISE EXCEPTION '% cannot have a negative salary', NEW.empname; + END IF; + + -- Remember who changed the payroll when + NEW.last_date := current_timestamp; + NEW.last_user := current_user; + RETURN NEW; + END; +$emp_stamp$ LANGUAGE plpgsql; +CREATE OR REPLACE FUNCTION process_emp_audit() RETURNS TRIGGER AS $emp_audit$ + BEGIN + -- + -- Create a row in emp_audit to reflect the operation performed on emp, + -- make use of the special variable TG_OP to work out the operation. + -- + IF (TG_OP = 'DELETE') THEN + INSERT INTO emp_audit SELECT 'D', now(), user, OLD.*; + RETURN OLD; + ELSIF (TG_OP = 'UPDATE') THEN + INSERT INTO emp_audit SELECT 'U', now(), user, NEW.*; + RETURN NEW; + ELSIF (TG_OP = 'INSERT') THEN + INSERT INTO emp_audit SELECT 'I', now(), user, NEW.*; + RETURN NEW; + END IF; + RETURN NULL; -- result is ignored since this is an AFTER trigger + END; +$emp_audit$ LANGUAGE plpgsql; + +CREATE TRIGGER emp_audit +AFTER INSERT OR UPDATE OR DELETE ON emp + FOR EACH ROW EXECUTE PROCEDURE process_emp_audit(); + +CREATE OR REPLACE FUNCTION update_emp_view() RETURNS TRIGGER AS $$ + BEGIN + -- + -- Perform the required operation on emp, and create a row in emp_audit + -- to reflect the change made to emp. + -- + IF (TG_OP = 'DELETE') THEN + DELETE FROM emp WHERE empname = OLD.empname; + IF NOT FOUND THEN RETURN NULL; END IF; + + OLD.last_updated = now(); + INSERT INTO emp_audit VALUES('D', user, OLD.*); + RETURN OLD; + ELSIF (TG_OP = 'UPDATE') THEN + UPDATE emp SET salary = NEW.salary WHERE empname = OLD.empname; + IF NOT FOUND THEN RETURN NULL; END IF; + + NEW.last_updated = now(); + INSERT INTO emp_audit VALUES('U', user, NEW.*); + RETURN NEW; + ELSIF (TG_OP = 'INSERT') THEN + INSERT INTO emp VALUES(NEW.empname, NEW.salary); + + NEW.last_updated = now(); + INSERT INTO emp_audit VALUES('I', user, NEW.*); + RETURN NEW; + END IF; + END; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER emp_audit +INSTEAD OF INSERT OR UPDATE OR DELETE ON emp_view + FOR EACH ROW EXECUTE PROCEDURE update_emp_view(); + +CREATE OR REPLACE FUNCTION maint_sales_summary_bytime() RETURNS TRIGGER +AS $maint_sales_summary_bytime$ + DECLARE + delta_time_key integer; + delta_amount_sold numeric(15,2); + delta_units_sold numeric(12); + delta_amount_cost numeric(15,2); + BEGIN + + -- Work out the increment/decrement amount(s). + IF (TG_OP = 'DELETE') THEN + + delta_time_key = OLD.time_key; + delta_amount_sold = -1 * OLD.amount_sold; + delta_units_sold = -1 * OLD.units_sold; + delta_amount_cost = -1 * OLD.amount_cost; + + ELSIF (TG_OP = 'UPDATE') THEN + + -- forbid updates that change the time_key - + -- (probably not too onerous, as DELETE + INSERT is how most + -- changes will be made). + IF ( OLD.time_key != NEW.time_key) THEN + RAISE EXCEPTION 'Update of time_key : % -> % not allowed', + OLD.time_key, NEW.time_key; + END IF; + + delta_time_key = OLD.time_key; + delta_amount_sold = NEW.amount_sold - OLD.amount_sold; + delta_units_sold = NEW.units_sold - OLD.units_sold; + delta_amount_cost = NEW.amount_cost - OLD.amount_cost; + + ELSIF (TG_OP = 'INSERT') THEN + + delta_time_key = NEW.time_key; + delta_amount_sold = NEW.amount_sold; + delta_units_sold = NEW.units_sold; + delta_amount_cost = NEW.amount_cost; + + END IF; + + + -- Insert or update the summary row with the new values. + <> + LOOP + UPDATE sales_summary_bytime + SET amount_sold = amount_sold + delta_amount_sold, + units_sold = units_sold + delta_units_sold, + amount_cost = amount_cost + delta_amount_cost + WHERE time_key = delta_time_key; + + EXIT insert_update WHEN found; + + BEGIN + INSERT INTO sales_summary_bytime ( + time_key, + amount_sold, + units_sold, + amount_cost) + VALUES ( + delta_time_key, + delta_amount_sold, + delta_units_sold, + delta_amount_cost + ); + + EXIT insert_update; + + EXCEPTION + WHEN UNIQUE_VIOLATION THEN + -- do nothing + END; + END LOOP insert_update; + + RETURN NULL; + + END; +$maint_sales_summary_bytime$ LANGUAGE plpgsql; + +CREATE TRIGGER maint_sales_summary_bytime +AFTER INSERT OR UPDATE OR DELETE ON sales_fact + FOR EACH ROW EXECUTE PROCEDURE maint_sales_summary_bytime(); diff --git a/postgresql/examples/plpgsql.sql b/postgresql/examples/plpgsql.sql new file mode 100644 index 0000000..c32dd4a --- /dev/null +++ b/postgresql/examples/plpgsql.sql @@ -0,0 +1,4651 @@ +-- +-- PLPGSQL +-- +-- Scenario: +-- +-- A building with a modern TP cable installation where any +-- of the wall connectors can be used to plug in phones, +-- ethernet interfaces or local office hubs. The backside +-- of the wall connectors is wired to one of several patch- +-- fields in the building. +-- +-- In the patchfields, there are hubs and all the slots +-- representing the wall connectors. In addition there are +-- slots that can represent a phone line from the central +-- phone system. +-- +-- Triggers ensure consistency of the patching information. +-- +-- Functions are used to build up powerful views that let +-- you look behind the wall when looking at a patchfield +-- or into a room. +-- + + +create table Room ( + roomno char(8), + comment text +); + +create unique index Room_rno on Room using btree (roomno bpchar_ops); + + +create table WSlot ( + slotname char(20), + roomno char(8), + slotlink char(20), + backlink char(20) +); + +create unique index WSlot_name on WSlot using btree (slotname bpchar_ops); + + +create table PField ( + name text, + comment text +); + +create unique index PField_name on PField using btree (name text_ops); + + +create table PSlot ( + slotname char(20), + pfname text, + slotlink char(20), + backlink char(20) +); + +create unique index PSlot_name on PSlot using btree (slotname bpchar_ops); + + +create table PLine ( + slotname char(20), + phonenumber char(20), + comment text, + backlink char(20) +); + +create unique index PLine_name on PLine using btree (slotname bpchar_ops); + + +create table Hub ( + name char(14), + comment text, + nslots integer +); + +create unique index Hub_name on Hub using btree (name bpchar_ops); + + +create table HSlot ( + slotname char(20), + hubname char(14), + slotno integer, + slotlink char(20) +); + +create unique index HSlot_name on HSlot using btree (slotname bpchar_ops); +create index HSlot_hubname on HSlot using btree (hubname bpchar_ops); + + +create table System ( + name text, + comment text +); + +create unique index System_name on System using btree (name text_ops); + + +create table IFace ( + slotname char(20), + sysname text, + ifname text, + slotlink char(20) +); + +create unique index IFace_name on IFace using btree (slotname bpchar_ops); + + +create table PHone ( + slotname char(20), + comment text, + slotlink char(20) +); + +create unique index PHone_name on PHone using btree (slotname bpchar_ops); + + +-- ************************************************************ +-- * +-- * Trigger procedures and functions for the patchfield +-- * test of PL/pgSQL +-- * +-- ************************************************************ + + +-- ************************************************************ +-- * AFTER UPDATE on Room +-- * - If room no changes let wall slots follow +-- ************************************************************ +create function tg_room_au() returns trigger as ' +begin + if new.roomno != old.roomno then + update WSlot set roomno = new.roomno where roomno = old.roomno; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_room_au after update + on Room for each row execute procedure tg_room_au(); + + +-- ************************************************************ +-- * AFTER DELETE on Room +-- * - delete wall slots in this room +-- ************************************************************ +create function tg_room_ad() returns trigger as ' +begin + delete from WSlot where roomno = old.roomno; + return old; +end; +' language plpgsql; + +create trigger tg_room_ad after delete + on Room for each row execute procedure tg_room_ad(); + + +-- ************************************************************ +-- * BEFORE INSERT or UPDATE on WSlot +-- * - Check that room exists +-- ************************************************************ +create function tg_wslot_biu() returns trigger as $$ +begin + if count(*) = 0 from Room where roomno = new.roomno then + raise exception 'Room % does not exist', new.roomno; + end if; + return new; +end; +$$ language plpgsql; + +create trigger tg_wslot_biu before insert or update + on WSlot for each row execute procedure tg_wslot_biu(); + + +-- ************************************************************ +-- * AFTER UPDATE on PField +-- * - Let PSlots of this field follow +-- ************************************************************ +create function tg_pfield_au() returns trigger as ' +begin + if new.name != old.name then + update PSlot set pfname = new.name where pfname = old.name; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_pfield_au after update + on PField for each row execute procedure tg_pfield_au(); + + +-- ************************************************************ +-- * AFTER DELETE on PField +-- * - Remove all slots of this patchfield +-- ************************************************************ +create function tg_pfield_ad() returns trigger as ' +begin + delete from PSlot where pfname = old.name; + return old; +end; +' language plpgsql; + +create trigger tg_pfield_ad after delete + on PField for each row execute procedure tg_pfield_ad(); + + +-- ************************************************************ +-- * BEFORE INSERT or UPDATE on PSlot +-- * - Ensure that our patchfield does exist +-- ************************************************************ + +create trigger tg_pslot_biu before insert or update + on PSlot for each row execute procedure tg_pslot_biu(); + + +-- ************************************************************ +-- * AFTER UPDATE on System +-- * - If system name changes let interfaces follow +-- ************************************************************ +create function tg_system_au() returns trigger as ' +begin + if new.name != old.name then + update IFace set sysname = new.name where sysname = old.name; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_system_au after update + on System for each row execute procedure tg_system_au(); + + +-- ************************************************************ +-- * BEFORE INSERT or UPDATE on IFace +-- * - set the slotname to IF.sysname.ifname +-- ************************************************************ +create function tg_iface_biu() returns trigger as $$ +declare + sname text; + sysrec record; +begin + select into sysrec * from system where name = new.sysname; + if not found then + raise exception $q$system "%" does not exist$q$, new.sysname; + end if; + sname := 'IF.' || new.sysname; + sname := sname || '.'; + sname := sname || new.ifname; + if length(sname) > 20 then + raise exception 'IFace slotname "%" too long (20 char max)', sname; + end if; + new.slotname := sname; + return new; +end; +$$ language plpgsql; + +create trigger tg_iface_biu before insert or update + on IFace for each row execute procedure tg_iface_biu(); + + +-- ************************************************************ +-- * AFTER INSERT or UPDATE or DELETE on Hub +-- * - insert/delete/rename slots as required +-- ************************************************************ +create function tg_hub_a() returns trigger as ' +declare + hname text; + dummy integer; +begin + if tg_op = ''INSERT'' then + dummy := tg_hub_adjustslots(new.name, 0, new.nslots); + return new; + end if; + if tg_op = ''UPDATE'' then + if new.name != old.name then + update HSlot set hubname = new.name where hubname = old.name; + end if; + dummy := tg_hub_adjustslots(new.name, old.nslots, new.nslots); + return new; + end if; + if tg_op = ''DELETE'' then + dummy := tg_hub_adjustslots(old.name, old.nslots, 0); + return old; + end if; +end; +' language plpgsql; + +create trigger tg_hub_a after insert or update or delete + on Hub for each row execute procedure tg_hub_a(); + + +-- ************************************************************ +-- * Support function to add/remove slots of Hub +-- ************************************************************ +create function tg_hub_adjustslots(hname bpchar, + oldnslots integer, + newnslots integer) +returns integer as ' +begin + if newnslots = oldnslots then + return 0; + end if; + if newnslots < oldnslots then + delete from HSlot where hubname = hname and slotno > newnslots; + return 0; + end if; + for i in oldnslots + 1 .. newnslots loop + insert into HSlot (slotname, hubname, slotno, slotlink) + values (''HS.dummy'', hname, i, ''''); + end loop; + return 0; +end +' language plpgsql; + +-- Test comments +COMMENT ON FUNCTION tg_hub_adjustslots_wrong(bpchar, integer, integer) IS 'function with args'; +COMMENT ON FUNCTION tg_hub_adjustslots(bpchar, integer, integer) IS 'function with args'; +COMMENT ON FUNCTION tg_hub_adjustslots(bpchar, integer, integer) IS NULL; + +-- ************************************************************ +-- * BEFORE INSERT or UPDATE on HSlot +-- * - prevent from manual manipulation +-- * - set the slotname to HS.hubname.slotno +-- ************************************************************ +create function tg_hslot_biu() returns trigger as ' +declare + sname text; + xname HSlot.slotname%TYPE; + hubrec record; +begin + select into hubrec * from Hub where name = new.hubname; + if not found then + raise exception ''no manual manipulation of HSlot''; + end if; + if new.slotno < 1 or new.slotno > hubrec.nslots then + raise exception ''no manual manipulation of HSlot''; + end if; + if tg_op = ''UPDATE'' and new.hubname != old.hubname then + if count(*) > 0 from Hub where name = old.hubname then + raise exception ''no manual manipulation of HSlot''; + end if; + end if; + sname := ''HS.'' || trim(new.hubname); + sname := sname || ''.''; + sname := sname || new.slotno::text; + if length(sname) > 20 then + raise exception ''HSlot slotname "%" too long (20 char max)'', sname; + end if; + new.slotname := sname; + return new; +end; +' language plpgsql; + +create trigger tg_hslot_biu before insert or update + on HSlot for each row execute procedure tg_hslot_biu(); + + +-- ************************************************************ +-- * BEFORE DELETE on HSlot +-- * - prevent from manual manipulation +-- ************************************************************ +create function tg_hslot_bd() returns trigger as ' +declare + hubrec record; +begin + select into hubrec * from Hub where name = old.hubname; + if not found then + return old; + end if; + if old.slotno > hubrec.nslots then + return old; + end if; + raise exception ''no manual manipulation of HSlot''; +end; +' language plpgsql; + +create trigger tg_hslot_bd before delete + on HSlot for each row execute procedure tg_hslot_bd(); + + +-- ************************************************************ +-- * BEFORE INSERT on all slots +-- * - Check name prefix +-- ************************************************************ +create function tg_chkslotname() returns trigger as ' +begin + if substr(new.slotname, 1, 2) != tg_argv[0] then + raise exception ''slotname must begin with %'', tg_argv[0]; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_chkslotname before insert + on PSlot for each row execute procedure tg_chkslotname('PS'); + +create trigger tg_chkslotname before insert + on WSlot for each row execute procedure tg_chkslotname('WS'); + +create trigger tg_chkslotname before insert + on PLine for each row execute procedure tg_chkslotname('PL'); + +create trigger tg_chkslotname before insert + on IFace for each row execute procedure tg_chkslotname('IF'); + +create trigger tg_chkslotname before insert + on PHone for each row execute procedure tg_chkslotname('PH'); + + +-- ************************************************************ +-- * BEFORE INSERT or UPDATE on all slots with slotlink +-- * - Set slotlink to empty string if NULL value given +-- ************************************************************ +create function tg_chkslotlink() returns trigger as ' +begin + if new.slotlink isnull then + new.slotlink := ''''; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_chkslotlink before insert or update + on PSlot for each row execute procedure tg_chkslotlink(); + +create trigger tg_chkslotlink before insert or update + on WSlot for each row execute procedure tg_chkslotlink(); + +create trigger tg_chkslotlink before insert or update + on IFace for each row execute procedure tg_chkslotlink(); + +create trigger tg_chkslotlink before insert or update + on HSlot for each row execute procedure tg_chkslotlink(); + +create trigger tg_chkslotlink before insert or update + on PHone for each row execute procedure tg_chkslotlink(); + + +-- ************************************************************ +-- * BEFORE INSERT or UPDATE on all slots with backlink +-- * - Set backlink to empty string if NULL value given +-- ************************************************************ +create function tg_chkbacklink() returns trigger as ' +begin + if new.backlink isnull then + new.backlink := ''''; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_chkbacklink before insert or update + on PSlot for each row execute procedure tg_chkbacklink(); + +create trigger tg_chkbacklink before insert or update + on WSlot for each row execute procedure tg_chkbacklink(); + +create trigger tg_chkbacklink before insert or update + on PLine for each row execute procedure tg_chkbacklink(); + + +-- ************************************************************ +-- * BEFORE UPDATE on PSlot +-- * - do delete/insert instead of update if name changes +-- ************************************************************ +create function tg_pslot_bu() returns trigger as ' +begin + if new.slotname != old.slotname then + delete from PSlot where slotname = old.slotname; + insert into PSlot ( + slotname, + pfname, + slotlink, + backlink + ) values ( + new.slotname, + new.pfname, + new.slotlink, + new.backlink + ); + return null; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_pslot_bu before update + on PSlot for each row execute procedure tg_pslot_bu(); + + +-- ************************************************************ +-- * BEFORE UPDATE on WSlot +-- * - do delete/insert instead of update if name changes +-- ************************************************************ +create function tg_wslot_bu() returns trigger as ' +begin + if new.slotname != old.slotname then + delete from WSlot where slotname = old.slotname; + insert into WSlot ( + slotname, + roomno, + slotlink, + backlink + ) values ( + new.slotname, + new.roomno, + new.slotlink, + new.backlink + ); + return null; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_wslot_bu before update + on WSlot for each row execute procedure tg_Wslot_bu(); + + +-- ************************************************************ +-- * BEFORE UPDATE on PLine +-- * - do delete/insert instead of update if name changes +-- ************************************************************ +create function tg_pline_bu() returns trigger as ' +begin + if new.slotname != old.slotname then + delete from PLine where slotname = old.slotname; + insert into PLine ( + slotname, + phonenumber, + comment, + backlink + ) values ( + new.slotname, + new.phonenumber, + new.comment, + new.backlink + ); + return null; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_pline_bu before update + on PLine for each row execute procedure tg_pline_bu(); + + +-- ************************************************************ +-- * BEFORE UPDATE on IFace +-- * - do delete/insert instead of update if name changes +-- ************************************************************ +create function tg_iface_bu() returns trigger as ' +begin + if new.slotname != old.slotname then + delete from IFace where slotname = old.slotname; + insert into IFace ( + slotname, + sysname, + ifname, + slotlink + ) values ( + new.slotname, + new.sysname, + new.ifname, + new.slotlink + ); + return null; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_iface_bu before update + on IFace for each row execute procedure tg_iface_bu(); + + +-- ************************************************************ +-- * BEFORE UPDATE on HSlot +-- * - do delete/insert instead of update if name changes +-- ************************************************************ +create function tg_hslot_bu() returns trigger as ' +begin + if new.slotname != old.slotname or new.hubname != old.hubname then + delete from HSlot where slotname = old.slotname; + insert into HSlot ( + slotname, + hubname, + slotno, + slotlink + ) values ( + new.slotname, + new.hubname, + new.slotno, + new.slotlink + ); + return null; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_hslot_bu before update + on HSlot for each row execute procedure tg_hslot_bu(); + + +-- ************************************************************ +-- * BEFORE UPDATE on PHone +-- * - do delete/insert instead of update if name changes +-- ************************************************************ +create function tg_phone_bu() returns trigger as ' +begin + if new.slotname != old.slotname then + delete from PHone where slotname = old.slotname; + insert into PHone ( + slotname, + comment, + slotlink + ) values ( + new.slotname, + new.comment, + new.slotlink + ); + return null; + end if; + return new; +end; +' language plpgsql; + +create trigger tg_phone_bu before update + on PHone for each row execute procedure tg_phone_bu(); + + +-- ************************************************************ +-- * AFTER INSERT or UPDATE or DELETE on slot with backlink +-- * - Ensure that the opponent correctly points back to us +-- ************************************************************ +create function tg_backlink_a() returns trigger as ' +declare + dummy integer; +begin + if tg_op = ''INSERT'' then + if new.backlink != '''' then + dummy := tg_backlink_set(new.backlink, new.slotname); + end if; + return new; + end if; + if tg_op = ''UPDATE'' then + if new.backlink != old.backlink then + if old.backlink != '''' then + dummy := tg_backlink_unset(old.backlink, old.slotname); + end if; + if new.backlink != '''' then + dummy := tg_backlink_set(new.backlink, new.slotname); + end if; + else + if new.slotname != old.slotname and new.backlink != '''' then + dummy := tg_slotlink_set(new.backlink, new.slotname); + end if; + end if; + return new; + end if; + if tg_op = ''DELETE'' then + if old.backlink != '''' then + dummy := tg_backlink_unset(old.backlink, old.slotname); + end if; + return old; + end if; +end; +' language plpgsql; + + +create trigger tg_backlink_a after insert or update or delete + on PSlot for each row execute procedure tg_backlink_a('PS'); + +create trigger tg_backlink_a after insert or update or delete + on WSlot for each row execute procedure tg_backlink_a('WS'); + +create trigger tg_backlink_a after insert or update or delete + on PLine for each row execute procedure tg_backlink_a('PL'); + + +-- ************************************************************ +-- * Support function to set the opponents backlink field +-- * if it does not already point to the requested slot +-- ************************************************************ +create function tg_backlink_set(myname bpchar, blname bpchar) +returns integer as ' +declare + mytype char(2); + link char(4); + rec record; +begin + mytype := substr(myname, 1, 2); + link := mytype || substr(blname, 1, 2); + if link = ''PLPL'' then + raise exception + ''backlink between two phone lines does not make sense''; + end if; + if link in (''PLWS'', ''WSPL'') then + raise exception + ''direct link of phone line to wall slot not permitted''; + end if; + if mytype = ''PS'' then + select into rec * from PSlot where slotname = myname; + if not found then + raise exception ''% does not exist'', myname; + end if; + if rec.backlink != blname then + update PSlot set backlink = blname where slotname = myname; + end if; + return 0; + end if; + if mytype = ''WS'' then + select into rec * from WSlot where slotname = myname; + if not found then + raise exception ''% does not exist'', myname; + end if; + if rec.backlink != blname then + update WSlot set backlink = blname where slotname = myname; + end if; + return 0; + end if; + if mytype = ''PL'' then + select into rec * from PLine where slotname = myname; + if not found then + raise exception ''% does not exist'', myname; + end if; + if rec.backlink != blname then + update PLine set backlink = blname where slotname = myname; + end if; + return 0; + end if; + raise exception ''illegal backlink beginning with %'', mytype; +end; +' language plpgsql; + + +-- ************************************************************ +-- * Support function to clear out the backlink field if +-- * it still points to specific slot +-- ************************************************************ +create function tg_backlink_unset(bpchar, bpchar) +returns integer as ' +declare + myname alias for $1; + blname alias for $2; + mytype char(2); + rec record; +begin + mytype := substr(myname, 1, 2); + if mytype = ''PS'' then + select into rec * from PSlot where slotname = myname; + if not found then + return 0; + end if; + if rec.backlink = blname then + update PSlot set backlink = '''' where slotname = myname; + end if; + return 0; + end if; + if mytype = ''WS'' then + select into rec * from WSlot where slotname = myname; + if not found then + return 0; + end if; + if rec.backlink = blname then + update WSlot set backlink = '''' where slotname = myname; + end if; + return 0; + end if; + if mytype = ''PL'' then + select into rec * from PLine where slotname = myname; + if not found then + return 0; + end if; + if rec.backlink = blname then + update PLine set backlink = '''' where slotname = myname; + end if; + return 0; + end if; +end +' language plpgsql; + + +-- ************************************************************ +-- * AFTER INSERT or UPDATE or DELETE on slot with slotlink +-- * - Ensure that the opponent correctly points back to us +-- ************************************************************ +create function tg_slotlink_a() returns trigger as ' +declare + dummy integer; +begin + if tg_op = ''INSERT'' then + if new.slotlink != '''' then + dummy := tg_slotlink_set(new.slotlink, new.slotname); + end if; + return new; + end if; + if tg_op = ''UPDATE'' then + if new.slotlink != old.slotlink then + if old.slotlink != '''' then + dummy := tg_slotlink_unset(old.slotlink, old.slotname); + end if; + if new.slotlink != '''' then + dummy := tg_slotlink_set(new.slotlink, new.slotname); + end if; + else + if new.slotname != old.slotname and new.slotlink != '''' then + dummy := tg_slotlink_set(new.slotlink, new.slotname); + end if; + end if; + return new; + end if; + if tg_op = ''DELETE'' then + if old.slotlink != '''' then + dummy := tg_slotlink_unset(old.slotlink, old.slotname); + end if; + return old; + end if; +end; +' language plpgsql; + + +create trigger tg_slotlink_a after insert or update or delete + on PSlot for each row execute procedure tg_slotlink_a('PS'); + +create trigger tg_slotlink_a after insert or update or delete + on WSlot for each row execute procedure tg_slotlink_a('WS'); + +create trigger tg_slotlink_a after insert or update or delete + on IFace for each row execute procedure tg_slotlink_a('IF'); + +create trigger tg_slotlink_a after insert or update or delete + on HSlot for each row execute procedure tg_slotlink_a('HS'); + +create trigger tg_slotlink_a after insert or update or delete + on PHone for each row execute procedure tg_slotlink_a('PH'); + + +-- ************************************************************ +-- * Support function to set the opponents slotlink field +-- * if it does not already point to the requested slot +-- ************************************************************ +create function tg_slotlink_set(bpchar, bpchar) +returns integer as ' +declare + myname alias for $1; + blname alias for $2; + mytype char(2); + link char(4); + rec record; +begin + mytype := substr(myname, 1, 2); + link := mytype || substr(blname, 1, 2); + if link = ''PHPH'' then + raise exception + ''slotlink between two phones does not make sense''; + end if; + if link in (''PHHS'', ''HSPH'') then + raise exception + ''link of phone to hub does not make sense''; + end if; + if link in (''PHIF'', ''IFPH'') then + raise exception + ''link of phone to hub does not make sense''; + end if; + if link in (''PSWS'', ''WSPS'') then + raise exception + ''slotlink from patchslot to wallslot not permitted''; + end if; + if mytype = ''PS'' then + select into rec * from PSlot where slotname = myname; + if not found then + raise exception ''% does not exist'', myname; + end if; + if rec.slotlink != blname then + update PSlot set slotlink = blname where slotname = myname; + end if; + return 0; + end if; + if mytype = ''WS'' then + select into rec * from WSlot where slotname = myname; + if not found then + raise exception ''% does not exist'', myname; + end if; + if rec.slotlink != blname then + update WSlot set slotlink = blname where slotname = myname; + end if; + return 0; + end if; + if mytype = ''IF'' then + select into rec * from IFace where slotname = myname; + if not found then + raise exception ''% does not exist'', myname; + end if; + if rec.slotlink != blname then + update IFace set slotlink = blname where slotname = myname; + end if; + return 0; + end if; + if mytype = ''HS'' then + select into rec * from HSlot where slotname = myname; + if not found then + raise exception ''% does not exist'', myname; + end if; + if rec.slotlink != blname then + update HSlot set slotlink = blname where slotname = myname; + end if; + return 0; + end if; + if mytype = ''PH'' then + select into rec * from PHone where slotname = myname; + if not found then + raise exception ''% does not exist'', myname; + end if; + if rec.slotlink != blname then + update PHone set slotlink = blname where slotname = myname; + end if; + return 0; + end if; + raise exception ''illegal slotlink beginning with %'', mytype; +end; +' language plpgsql; + + +-- ************************************************************ +-- * Support function to clear out the slotlink field if +-- * it still points to specific slot +-- ************************************************************ +create function tg_slotlink_unset(bpchar, bpchar) +returns integer as ' +declare + myname alias for $1; + blname alias for $2; + mytype char(2); + rec record; +begin + mytype := substr(myname, 1, 2); + if mytype = ''PS'' then + select into rec * from PSlot where slotname = myname; + if not found then + return 0; + end if; + if rec.slotlink = blname then + update PSlot set slotlink = '''' where slotname = myname; + end if; + return 0; + end if; + if mytype = ''WS'' then + select into rec * from WSlot where slotname = myname; + if not found then + return 0; + end if; + if rec.slotlink = blname then + update WSlot set slotlink = '''' where slotname = myname; + end if; + return 0; + end if; + if mytype = ''IF'' then + select into rec * from IFace where slotname = myname; + if not found then + return 0; + end if; + if rec.slotlink = blname then + update IFace set slotlink = '''' where slotname = myname; + end if; + return 0; + end if; + if mytype = ''HS'' then + select into rec * from HSlot where slotname = myname; + if not found then + return 0; + end if; + if rec.slotlink = blname then + update HSlot set slotlink = '''' where slotname = myname; + end if; + return 0; + end if; + if mytype = ''PH'' then + select into rec * from PHone where slotname = myname; + if not found then + return 0; + end if; + if rec.slotlink = blname then + update PHone set slotlink = '''' where slotname = myname; + end if; + return 0; + end if; +end; +' language plpgsql; + + +-- ************************************************************ +-- * Describe the backside of a patchfield slot +-- ************************************************************ +create function pslot_backlink_view(bpchar) +returns text as ' +<> +declare + rec record; + bltype char(2); + retval text; +begin + select into rec * from PSlot where slotname = $1; + if not found then + return ''''; + end if; + if rec.backlink = '''' then + return ''-''; + end if; + bltype := substr(rec.backlink, 1, 2); + if bltype = ''PL'' then + declare + rec record; + begin + select into rec * from PLine where slotname = "outer".rec.backlink; + retval := ''Phone line '' || trim(rec.phonenumber); + if rec.comment != '''' then + retval := retval || '' (''; + retval := retval || rec.comment; + retval := retval || '')''; + end if; + return retval; + end; + end if; + if bltype = ''WS'' then + select into rec * from WSlot where slotname = rec.backlink; + retval := trim(rec.slotname) || '' in room ''; + retval := retval || trim(rec.roomno); + retval := retval || '' -> ''; + return retval || wslot_slotlink_view(rec.slotname); + end if; + return rec.backlink; +end; +' language plpgsql; + + +-- ************************************************************ +-- * Describe the front of a patchfield slot +-- ************************************************************ +create function pslot_slotlink_view(bpchar) +returns text as ' +declare + psrec record; + sltype char(2); + retval text; +begin + select into psrec * from PSlot where slotname = $1; + if not found then + return ''''; + end if; + if psrec.slotlink = '''' then + return ''-''; + end if; + sltype := substr(psrec.slotlink, 1, 2); + if sltype = ''PS'' then + retval := trim(psrec.slotlink) || '' -> ''; + return retval || pslot_backlink_view(psrec.slotlink); + end if; + if sltype = ''HS'' then + retval := comment from Hub H, HSlot HS + where HS.slotname = psrec.slotlink + and H.name = HS.hubname; + retval := retval || '' slot ''; + retval := retval || slotno::text from HSlot + where slotname = psrec.slotlink; + return retval; + end if; + return psrec.slotlink; +end; +' language plpgsql; + + +-- ************************************************************ +-- * Describe the front of a wall connector slot +-- ************************************************************ +create function wslot_slotlink_view(bpchar) +returns text as ' +declare + rec record; + sltype char(2); + retval text; +begin + select into rec * from WSlot where slotname = $1; + if not found then + return ''''; + end if; + if rec.slotlink = '''' then + return ''-''; + end if; + sltype := substr(rec.slotlink, 1, 2); + if sltype = ''PH'' then + select into rec * from PHone where slotname = rec.slotlink; + retval := ''Phone '' || trim(rec.slotname); + if rec.comment != '''' then + retval := retval || '' (''; + retval := retval || rec.comment; + retval := retval || '')''; + end if; + return retval; + end if; + if sltype = ''IF'' then + declare + syrow System%RowType; + ifrow IFace%ROWTYPE; + begin + select into ifrow * from IFace where slotname = rec.slotlink; + select into syrow * from System where name = ifrow.sysname; + retval := syrow.name || '' IF ''; + retval := retval || ifrow.ifname; + if syrow.comment != '''' then + retval := retval || '' (''; + retval := retval || syrow.comment; + retval := retval || '')''; + end if; + return retval; + end; + end if; + return rec.slotlink; +end; +' language plpgsql; + + + +-- ************************************************************ +-- * View of a patchfield describing backside and patches +-- ************************************************************ +create view Pfield_v1 as select PF.pfname, PF.slotname, + pslot_backlink_view(PF.slotname) as backside, + pslot_slotlink_view(PF.slotname) as patch + from PSlot PF; + + +-- +-- First we build the house - so we create the rooms +-- +insert into Room values ('001', 'Entrance'); +insert into Room values ('002', 'Office'); +insert into Room values ('003', 'Office'); +insert into Room values ('004', 'Technical'); +insert into Room values ('101', 'Office'); +insert into Room values ('102', 'Conference'); +insert into Room values ('103', 'Restroom'); +insert into Room values ('104', 'Technical'); +insert into Room values ('105', 'Office'); +insert into Room values ('106', 'Office'); + +-- +-- Second we install the wall connectors +-- +insert into WSlot values ('WS.001.1a', '001', '', ''); +insert into WSlot values ('WS.001.1b', '001', '', ''); +insert into WSlot values ('WS.001.2a', '001', '', ''); +insert into WSlot values ('WS.001.2b', '001', '', ''); +insert into WSlot values ('WS.001.3a', '001', '', ''); +insert into WSlot values ('WS.001.3b', '001', '', ''); + +insert into WSlot values ('WS.002.1a', '002', '', ''); +insert into WSlot values ('WS.002.1b', '002', '', ''); +insert into WSlot values ('WS.002.2a', '002', '', ''); +insert into WSlot values ('WS.002.2b', '002', '', ''); +insert into WSlot values ('WS.002.3a', '002', '', ''); +insert into WSlot values ('WS.002.3b', '002', '', ''); + +insert into WSlot values ('WS.003.1a', '003', '', ''); +insert into WSlot values ('WS.003.1b', '003', '', ''); +insert into WSlot values ('WS.003.2a', '003', '', ''); +insert into WSlot values ('WS.003.2b', '003', '', ''); +insert into WSlot values ('WS.003.3a', '003', '', ''); +insert into WSlot values ('WS.003.3b', '003', '', ''); + +insert into WSlot values ('WS.101.1a', '101', '', ''); +insert into WSlot values ('WS.101.1b', '101', '', ''); +insert into WSlot values ('WS.101.2a', '101', '', ''); +insert into WSlot values ('WS.101.2b', '101', '', ''); +insert into WSlot values ('WS.101.3a', '101', '', ''); +insert into WSlot values ('WS.101.3b', '101', '', ''); + +insert into WSlot values ('WS.102.1a', '102', '', ''); +insert into WSlot values ('WS.102.1b', '102', '', ''); +insert into WSlot values ('WS.102.2a', '102', '', ''); +insert into WSlot values ('WS.102.2b', '102', '', ''); +insert into WSlot values ('WS.102.3a', '102', '', ''); +insert into WSlot values ('WS.102.3b', '102', '', ''); + +insert into WSlot values ('WS.105.1a', '105', '', ''); +insert into WSlot values ('WS.105.1b', '105', '', ''); +insert into WSlot values ('WS.105.2a', '105', '', ''); +insert into WSlot values ('WS.105.2b', '105', '', ''); +insert into WSlot values ('WS.105.3a', '105', '', ''); +insert into WSlot values ('WS.105.3b', '105', '', ''); + +insert into WSlot values ('WS.106.1a', '106', '', ''); +insert into WSlot values ('WS.106.1b', '106', '', ''); +insert into WSlot values ('WS.106.2a', '106', '', ''); +insert into WSlot values ('WS.106.2b', '106', '', ''); +insert into WSlot values ('WS.106.3a', '106', '', ''); +insert into WSlot values ('WS.106.3b', '106', '', ''); + +-- +-- Now create the patch fields and their slots +-- +insert into PField values ('PF0_1', 'Wallslots basement'); + +-- +-- The cables for these will be made later, so they are unconnected for now +-- +insert into PSlot values ('PS.base.a1', 'PF0_1', '', ''); +insert into PSlot values ('PS.base.a2', 'PF0_1', '', ''); +insert into PSlot values ('PS.base.a3', 'PF0_1', '', ''); +insert into PSlot values ('PS.base.a4', 'PF0_1', '', ''); +insert into PSlot values ('PS.base.a5', 'PF0_1', '', ''); +insert into PSlot values ('PS.base.a6', 'PF0_1', '', ''); + +-- +-- These are already wired to the wall connectors +-- +insert into PSlot values ('PS.base.b1', 'PF0_1', '', 'WS.002.1a'); +insert into PSlot values ('PS.base.b2', 'PF0_1', '', 'WS.002.1b'); +insert into PSlot values ('PS.base.b3', 'PF0_1', '', 'WS.002.2a'); +insert into PSlot values ('PS.base.b4', 'PF0_1', '', 'WS.002.2b'); +insert into PSlot values ('PS.base.b5', 'PF0_1', '', 'WS.002.3a'); +insert into PSlot values ('PS.base.b6', 'PF0_1', '', 'WS.002.3b'); + +insert into PSlot values ('PS.base.c1', 'PF0_1', '', 'WS.003.1a'); +insert into PSlot values ('PS.base.c2', 'PF0_1', '', 'WS.003.1b'); +insert into PSlot values ('PS.base.c3', 'PF0_1', '', 'WS.003.2a'); +insert into PSlot values ('PS.base.c4', 'PF0_1', '', 'WS.003.2b'); +insert into PSlot values ('PS.base.c5', 'PF0_1', '', 'WS.003.3a'); +insert into PSlot values ('PS.base.c6', 'PF0_1', '', 'WS.003.3b'); + +-- +-- This patchfield will be renamed later into PF0_2 - so its +-- slots references in pfname should follow +-- +insert into PField values ('PF0_X', 'Phonelines basement'); + +insert into PSlot values ('PS.base.ta1', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.ta2', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.ta3', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.ta4', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.ta5', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.ta6', 'PF0_X', '', ''); + +insert into PSlot values ('PS.base.tb1', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.tb2', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.tb3', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.tb4', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.tb5', 'PF0_X', '', ''); +insert into PSlot values ('PS.base.tb6', 'PF0_X', '', ''); + +insert into PField values ('PF1_1', 'Wallslots first floor'); + +insert into PSlot values ('PS.first.a1', 'PF1_1', '', 'WS.101.1a'); +insert into PSlot values ('PS.first.a2', 'PF1_1', '', 'WS.101.1b'); +insert into PSlot values ('PS.first.a3', 'PF1_1', '', 'WS.101.2a'); +insert into PSlot values ('PS.first.a4', 'PF1_1', '', 'WS.101.2b'); +insert into PSlot values ('PS.first.a5', 'PF1_1', '', 'WS.101.3a'); +insert into PSlot values ('PS.first.a6', 'PF1_1', '', 'WS.101.3b'); + +insert into PSlot values ('PS.first.b1', 'PF1_1', '', 'WS.102.1a'); +insert into PSlot values ('PS.first.b2', 'PF1_1', '', 'WS.102.1b'); +insert into PSlot values ('PS.first.b3', 'PF1_1', '', 'WS.102.2a'); +insert into PSlot values ('PS.first.b4', 'PF1_1', '', 'WS.102.2b'); +insert into PSlot values ('PS.first.b5', 'PF1_1', '', 'WS.102.3a'); +insert into PSlot values ('PS.first.b6', 'PF1_1', '', 'WS.102.3b'); + +insert into PSlot values ('PS.first.c1', 'PF1_1', '', 'WS.105.1a'); +insert into PSlot values ('PS.first.c2', 'PF1_1', '', 'WS.105.1b'); +insert into PSlot values ('PS.first.c3', 'PF1_1', '', 'WS.105.2a'); +insert into PSlot values ('PS.first.c4', 'PF1_1', '', 'WS.105.2b'); +insert into PSlot values ('PS.first.c5', 'PF1_1', '', 'WS.105.3a'); +insert into PSlot values ('PS.first.c6', 'PF1_1', '', 'WS.105.3b'); + +insert into PSlot values ('PS.first.d1', 'PF1_1', '', 'WS.106.1a'); +insert into PSlot values ('PS.first.d2', 'PF1_1', '', 'WS.106.1b'); +insert into PSlot values ('PS.first.d3', 'PF1_1', '', 'WS.106.2a'); +insert into PSlot values ('PS.first.d4', 'PF1_1', '', 'WS.106.2b'); +insert into PSlot values ('PS.first.d5', 'PF1_1', '', 'WS.106.3a'); +insert into PSlot values ('PS.first.d6', 'PF1_1', '', 'WS.106.3b'); + +-- +-- Now we wire the wall connectors 1a-2a in room 001 to the +-- patchfield. In the second update we make an error, and +-- correct it after +-- +update PSlot set backlink = 'WS.001.1a' where slotname = 'PS.base.a1'; +update PSlot set backlink = 'WS.001.1b' where slotname = 'PS.base.a3'; +select * from WSlot where roomno = '001' order by slotname; +select * from PSlot where slotname ~ 'PS.base.a' order by slotname; +update PSlot set backlink = 'WS.001.2a' where slotname = 'PS.base.a3'; +select * from WSlot where roomno = '001' order by slotname; +select * from PSlot where slotname ~ 'PS.base.a' order by slotname; +update PSlot set backlink = 'WS.001.1b' where slotname = 'PS.base.a2'; +select * from WSlot where roomno = '001' order by slotname; +select * from PSlot where slotname ~ 'PS.base.a' order by slotname; + +-- +-- Same procedure for 2b-3b but this time updating the WSlot instead +-- of the PSlot. Due to the triggers the result is the same: +-- WSlot and corresponding PSlot point to each other. +-- +update WSlot set backlink = 'PS.base.a4' where slotname = 'WS.001.2b'; +update WSlot set backlink = 'PS.base.a6' where slotname = 'WS.001.3a'; +select * from WSlot where roomno = '001' order by slotname; +select * from PSlot where slotname ~ 'PS.base.a' order by slotname; +update WSlot set backlink = 'PS.base.a6' where slotname = 'WS.001.3b'; +select * from WSlot where roomno = '001' order by slotname; +select * from PSlot where slotname ~ 'PS.base.a' order by slotname; +update WSlot set backlink = 'PS.base.a5' where slotname = 'WS.001.3a'; +select * from WSlot where roomno = '001' order by slotname; +select * from PSlot where slotname ~ 'PS.base.a' order by slotname; + +insert into PField values ('PF1_2', 'Phonelines first floor'); + +insert into PSlot values ('PS.first.ta1', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.ta2', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.ta3', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.ta4', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.ta5', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.ta6', 'PF1_2', '', ''); + +insert into PSlot values ('PS.first.tb1', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.tb2', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.tb3', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.tb4', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.tb5', 'PF1_2', '', ''); +insert into PSlot values ('PS.first.tb6', 'PF1_2', '', ''); + +-- +-- Fix the wrong name for patchfield PF0_2 +-- +update PField set name = 'PF0_2' where name = 'PF0_X'; + +select * from PSlot order by slotname; +select * from WSlot order by slotname; + +-- +-- Install the central phone system and create the phone numbers. +-- They are wired on insert to the patchfields. Again the +-- triggers automatically tell the PSlots to update their +-- backlink field. +-- +insert into PLine values ('PL.001', '-0', 'Central call', 'PS.base.ta1'); +insert into PLine values ('PL.002', '-101', '', 'PS.base.ta2'); +insert into PLine values ('PL.003', '-102', '', 'PS.base.ta3'); +insert into PLine values ('PL.004', '-103', '', 'PS.base.ta5'); +insert into PLine values ('PL.005', '-104', '', 'PS.base.ta6'); +insert into PLine values ('PL.006', '-106', '', 'PS.base.tb2'); +insert into PLine values ('PL.007', '-108', '', 'PS.base.tb3'); +insert into PLine values ('PL.008', '-109', '', 'PS.base.tb4'); +insert into PLine values ('PL.009', '-121', '', 'PS.base.tb5'); +insert into PLine values ('PL.010', '-122', '', 'PS.base.tb6'); +insert into PLine values ('PL.015', '-134', '', 'PS.first.ta1'); +insert into PLine values ('PL.016', '-137', '', 'PS.first.ta3'); +insert into PLine values ('PL.017', '-139', '', 'PS.first.ta4'); +insert into PLine values ('PL.018', '-362', '', 'PS.first.tb1'); +insert into PLine values ('PL.019', '-363', '', 'PS.first.tb2'); +insert into PLine values ('PL.020', '-364', '', 'PS.first.tb3'); +insert into PLine values ('PL.021', '-365', '', 'PS.first.tb5'); +insert into PLine values ('PL.022', '-367', '', 'PS.first.tb6'); +insert into PLine values ('PL.028', '-501', 'Fax entrance', 'PS.base.ta2'); +insert into PLine values ('PL.029', '-502', 'Fax first floor', 'PS.first.ta1'); + +-- +-- Buy some phones, plug them into the wall and patch the +-- phone lines to the corresponding patchfield slots. +-- +insert into PHone values ('PH.hc001', 'Hicom standard', 'WS.001.1a'); +update PSlot set slotlink = 'PS.base.ta1' where slotname = 'PS.base.a1'; +insert into PHone values ('PH.hc002', 'Hicom standard', 'WS.002.1a'); +update PSlot set slotlink = 'PS.base.ta5' where slotname = 'PS.base.b1'; +insert into PHone values ('PH.hc003', 'Hicom standard', 'WS.002.2a'); +update PSlot set slotlink = 'PS.base.tb2' where slotname = 'PS.base.b3'; +insert into PHone values ('PH.fax001', 'Canon fax', 'WS.001.2a'); +update PSlot set slotlink = 'PS.base.ta2' where slotname = 'PS.base.a3'; + +-- +-- Install a hub at one of the patchfields, plug a computers +-- ethernet interface into the wall and patch it to the hub. +-- +insert into Hub values ('base.hub1', 'Patchfield PF0_1 hub', 16); +insert into System values ('orion', 'PC'); +insert into IFace values ('IF', 'orion', 'eth0', 'WS.002.1b'); +update PSlot set slotlink = 'HS.base.hub1.1' where slotname = 'PS.base.b2'; + +-- +-- Now we take a look at the patchfield +-- +select * from PField_v1 where pfname = 'PF0_1' order by slotname; +select * from PField_v1 where pfname = 'PF0_2' order by slotname; + +-- +-- Finally we want errors +-- +insert into PField values ('PF1_1', 'should fail due to unique index'); +update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1'; +update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1'; +update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1'; +update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1'; +insert into HSlot values ('HS', 'base.hub1', 1, ''); +insert into HSlot values ('HS', 'base.hub1', 20, ''); +delete from HSlot; +insert into IFace values ('IF', 'notthere', 'eth0', ''); +insert into IFace values ('IF', 'orion', 'ethernet_interface_name_too_long', ''); + + +-- +-- The following tests are unrelated to the scenario outlined above; +-- they merely exercise specific parts of PL/pgSQL +-- + +-- +-- Test recursion, per bug report 7-Sep-01 +-- +CREATE FUNCTION recursion_test(int,int) RETURNS text AS ' +DECLARE rslt text; +BEGIN + IF $1 <= 0 THEN + rslt = CAST($2 AS TEXT); + ELSE + rslt = CAST($1 AS TEXT) || '','' || recursion_test($1 - 1, $2); + END IF; + RETURN rslt; +END;' LANGUAGE plpgsql; + +SELECT recursion_test(4,3); + +-- +-- Test the FOUND magic variable +-- +CREATE TABLE found_test_tbl (a int); + +create function test_found() + returns boolean as ' + declare + begin + insert into found_test_tbl values (1); + if FOUND then + insert into found_test_tbl values (2); + end if; + + update found_test_tbl set a = 100 where a = 1; + if FOUND then + insert into found_test_tbl values (3); + end if; + + delete from found_test_tbl where a = 9999; -- matches no rows + if not FOUND then + insert into found_test_tbl values (4); + end if; + + for i in 1 .. 10 loop + -- no need to do anything + end loop; + if FOUND then + insert into found_test_tbl values (5); + end if; + + -- never executes the loop + for i in 2 .. 1 loop + -- no need to do anything + end loop; + if not FOUND then + insert into found_test_tbl values (6); + end if; + return true; + end;' language plpgsql; + +select test_found(); +select * from found_test_tbl; + +-- +-- Test set-returning functions for PL/pgSQL +-- + +create function test_table_func_rec() returns setof found_test_tbl as ' +DECLARE + rec RECORD; +BEGIN + FOR rec IN select * from found_test_tbl LOOP + RETURN NEXT rec; + END LOOP; + RETURN; +END;' language plpgsql; + +select * from test_table_func_rec(); + +create function test_table_func_row() returns setof found_test_tbl as ' +DECLARE + row found_test_tbl%ROWTYPE; +BEGIN + FOR row IN select * from found_test_tbl LOOP + RETURN NEXT row; + END LOOP; + RETURN; +END;' language plpgsql; + +select * from test_table_func_row(); + +create function test_ret_set_scalar(int,int) returns setof int as ' +DECLARE + i int; +BEGIN + FOR i IN $1 .. $2 LOOP + RETURN NEXT i + 1; + END LOOP; + RETURN; +END;' language plpgsql; + +select * from test_ret_set_scalar(1,10); + +create function test_ret_set_rec_dyn(int) returns setof record as ' +DECLARE + retval RECORD; +BEGIN + IF $1 > 10 THEN + SELECT INTO retval 5, 10, 15; + RETURN NEXT retval; + RETURN NEXT retval; + ELSE + SELECT INTO retval 50, 5::numeric, ''xxx''::text; + RETURN NEXT retval; + RETURN NEXT retval; + END IF; + RETURN; +END;' language plpgsql; + +SELECT * FROM test_ret_set_rec_dyn(1500) AS (a int, b int, c int); +SELECT * FROM test_ret_set_rec_dyn(5) AS (a int, b numeric, c text); + +create function test_ret_rec_dyn(int) returns record as ' +DECLARE + retval RECORD; +BEGIN + IF $1 > 10 THEN + SELECT INTO retval 5, 10, 15; + RETURN retval; + ELSE + SELECT INTO retval 50, 5::numeric, ''xxx''::text; + RETURN retval; + END IF; +END;' language plpgsql; + +SELECT * FROM test_ret_rec_dyn(1500) AS (a int, b int, c int); +SELECT * FROM test_ret_rec_dyn(5) AS (a int, b numeric, c text); + +-- +-- Test some simple polymorphism cases. +-- + +create function f1(x anyelement) returns anyelement as $$ +begin + return x + 1; +end$$ language plpgsql; + +select f1(42) as int, f1(4.5) as num; +select f1(point(3,4)); -- fail for lack of + operator + +drop function f1(x anyelement); + +create function f1(x anyelement) returns anyarray as $$ +begin + return array[x + 1, x + 2]; +end$$ language plpgsql; + +select f1(42) as int, f1(4.5) as num; + +drop function f1(x anyelement); + +create function f1(x anyarray) returns anyelement as $$ +begin + return x[1]; +end$$ language plpgsql; + +select f1(array[2,4]) as int, f1(array[4.5, 7.7]) as num; + +select f1(stavalues1) from pg_statistic; -- fail, can't infer element type + +drop function f1(x anyarray); + +create function f1(x anyarray) returns anyarray as $$ +begin + return x; +end$$ language plpgsql; + +select f1(array[2,4]) as int, f1(array[4.5, 7.7]) as num; + +select f1(stavalues1) from pg_statistic; -- fail, can't infer element type + +drop function f1(x anyarray); + +-- fail, can't infer type: +create function f1(x anyelement) returns anyrange as $$ +begin + return array[x + 1, x + 2]; +end$$ language plpgsql; + +create function f1(x anyrange) returns anyarray as $$ +begin + return array[lower(x), upper(x)]; +end$$ language plpgsql; + +select f1(int4range(42, 49)) as int, f1(float8range(4.5, 7.8)) as num; + +drop function f1(x anyrange); + +create function f1(x anycompatible, y anycompatible) returns anycompatiblearray as $$ +begin + return array[x, y]; +end$$ language plpgsql; + +select f1(2, 4) as int, f1(2, 4.5) as num; + +drop function f1(x anycompatible, y anycompatible); + +create function f1(x anycompatiblerange, y anycompatible, z anycompatible) returns anycompatiblearray as $$ +begin + return array[lower(x), upper(x), y, z]; +end$$ language plpgsql; + +select f1(int4range(42, 49), 11, 2::smallint) as int, f1(float8range(4.5, 7.8), 7.8, 11::real) as num; + +select f1(int4range(42, 49), 11, 4.5) as fail; -- range type doesn't fit + +drop function f1(x anycompatiblerange, y anycompatible, z anycompatible); + +-- fail, can't infer type: +create function f1(x anycompatible) returns anycompatiblerange as $$ +begin + return array[x + 1, x + 2]; +end$$ language plpgsql; + +create function f1(x anycompatiblerange, y anycompatiblearray) returns anycompatiblerange as $$ +begin + return x; +end$$ language plpgsql; + +select f1(int4range(42, 49), array[11]) as int, f1(float8range(4.5, 7.8), array[7]) as num; + +drop function f1(x anycompatiblerange, y anycompatiblearray); + +create function f1(a anyelement, b anyarray, + c anycompatible, d anycompatible, + OUT x anyarray, OUT y anycompatiblearray) +as $$ +begin + x := a || b; + y := array[c, d]; +end$$ language plpgsql; + +select x, pg_typeof(x), y, pg_typeof(y) + from f1(11, array[1, 2], 42, 34.5); +select x, pg_typeof(x), y, pg_typeof(y) + from f1(11, array[1, 2], point(1,2), point(3,4)); +select x, pg_typeof(x), y, pg_typeof(y) + from f1(11, '{1,2}', point(1,2), '(3,4)'); +select x, pg_typeof(x), y, pg_typeof(y) + from f1(11, array[1, 2.2], 42, 34.5); -- fail + +drop function f1(a anyelement, b anyarray, + c anycompatible, d anycompatible); + +-- +-- Test handling of OUT parameters, including polymorphic cases. +-- Note that RETURN is optional with OUT params; we try both ways. +-- + +-- wrong way to do it: +create function f1(in i int, out j int) returns int as $$ +begin + return i+1; +end$$ language plpgsql; + +create function f1(in i int, out j int) as $$ +begin + j := i+1; + return; +end$$ language plpgsql; + +select f1(42); +select * from f1(42); + +create or replace function f1(inout i int) as $$ +begin + i := i+1; +end$$ language plpgsql; + +select f1(42); +select * from f1(42); + +drop function f1(int); + +create function f1(in i int, out j int) returns setof int as $$ +begin + j := i+1; + return next; + j := i+2; + return next; + return; +end$$ language plpgsql; + +select * from f1(42); + +drop function f1(int); + +create function f1(in i int, out j int, out k text) as $$ +begin + j := i; + j := j+1; + k := 'foo'; +end$$ language plpgsql; + +select f1(42); +select * from f1(42); + +drop function f1(int); + +create function f1(in i int, out j int, out k text) returns setof record as $$ +begin + j := i+1; + k := 'foo'; + return next; + j := j+1; + k := 'foot'; + return next; +end$$ language plpgsql; + +select * from f1(42); + +drop function f1(int); + +create function duplic(in i anyelement, out j anyelement, out k anyarray) as $$ +begin + j := i; + k := array[j,j]; + return; +end$$ language plpgsql; + +select * from duplic(42); +select * from duplic('foo'::text); + +drop function duplic(anyelement); + +create function duplic(in i anycompatiblerange, out j anycompatible, out k anycompatiblearray) as $$ +begin + j := lower(i); + k := array[lower(i),upper(i)]; + return; +end$$ language plpgsql; + +select * from duplic(int4range(42,49)); +select * from duplic(textrange('aaa', 'bbb')); + +drop function duplic(anycompatiblerange); + +-- +-- test PERFORM +-- + +create table perform_test ( + a INT, + b INT +); + +create function perform_simple_func(int) returns boolean as ' +BEGIN + IF $1 < 20 THEN + INSERT INTO perform_test VALUES ($1, $1 + 10); + RETURN TRUE; + ELSE + RETURN FALSE; + END IF; +END;' language plpgsql; + +create function perform_test_func() returns void as ' +BEGIN + IF FOUND then + INSERT INTO perform_test VALUES (100, 100); + END IF; + + PERFORM perform_simple_func(5); + + IF FOUND then + INSERT INTO perform_test VALUES (100, 100); + END IF; + + PERFORM perform_simple_func(50); + + IF FOUND then + INSERT INTO perform_test VALUES (100, 100); + END IF; + + RETURN; +END;' language plpgsql; + +SELECT perform_test_func(); +SELECT * FROM perform_test; + +drop table perform_test; + +-- +-- Test proper snapshot handling in simple expressions +-- + +create temp table users(login text, id serial); + +create function sp_id_user(a_login text) returns int as $$ +declare x int; +begin + select into x id from users where login = a_login; + if found then return x; end if; + return 0; +end$$ language plpgsql stable; + +insert into users values('user1'); + +select sp_id_user('user1'); +select sp_id_user('userx'); + +create function sp_add_user(a_login text) returns int as $$ +declare my_id_user int; +begin + my_id_user = sp_id_user( a_login ); + IF my_id_user > 0 THEN + RETURN -1; -- error code for existing user + END IF; + INSERT INTO users ( login ) VALUES ( a_login ); + my_id_user = sp_id_user( a_login ); + IF my_id_user = 0 THEN + RETURN -2; -- error code for insertion failure + END IF; + RETURN my_id_user; +end$$ language plpgsql; + +select sp_add_user('user1'); +select sp_add_user('user2'); +select sp_add_user('user2'); +select sp_add_user('user3'); +select sp_add_user('user3'); + +drop function sp_add_user(text); +drop function sp_id_user(text); + +-- +-- tests for refcursors +-- +create table rc_test (a int, b int); +copy rc_test from stdin; + +create function return_unnamed_refcursor() returns refcursor as $$ +declare + rc refcursor; +begin + open rc for select a from rc_test; + return rc; +end +$$ language plpgsql; + +create function use_refcursor(rc refcursor) returns int as $$ +declare + rc refcursor; + x record; +begin + rc := return_unnamed_refcursor(); + fetch next from rc into x; + return x.a; +end +$$ language plpgsql; + +select use_refcursor(return_unnamed_refcursor()); + +create function return_refcursor(rc refcursor) returns refcursor as $$ +begin + open rc for select a from rc_test; + return rc; +end +$$ language plpgsql; + +create function refcursor_test1(refcursor) returns refcursor as $$ +begin + perform return_refcursor($1); + return $1; +end +$$ language plpgsql; + +begin; + +select refcursor_test1('test1'); +fetch next in test1; + +select refcursor_test1('test2'); +fetch all from test2; + +commit; + +-- should fail +fetch next from test1; + +create function refcursor_test2(int, int) returns boolean as $$ +declare + c1 cursor (param1 int, param2 int) for select * from rc_test where a > param1 and b > param2; + nonsense record; +begin + open c1($1, $2); + fetch c1 into nonsense; + close c1; + if found then + return true; + else + return false; + end if; +end +$$ language plpgsql; + +select refcursor_test2(20000, 20000) as "Should be false", + refcursor_test2(20, 20) as "Should be true"; + +-- +-- tests for cursors with named parameter arguments +-- +create function namedparmcursor_test1(int, int) returns boolean as $$ +declare + c1 cursor (param1 int, param12 int) for select * from rc_test where a > param1 and b > param12; + nonsense record; +begin + open c1(param12 := $2, param1 := $1); + fetch c1 into nonsense; + close c1; + if found then + return true; + else + return false; + end if; +end +$$ language plpgsql; + +select namedparmcursor_test1(20000, 20000) as "Should be false", + namedparmcursor_test1(20, 20) as "Should be true"; + +-- mixing named and positional argument notations +create function namedparmcursor_test2(int, int) returns boolean as $$ +declare + c1 cursor (param1 int, param2 int) for select * from rc_test where a > param1 and b > param2; + nonsense record; +begin + open c1(param1 := $1, $2); + fetch c1 into nonsense; + close c1; + if found then + return true; + else + return false; + end if; +end +$$ language plpgsql; +select namedparmcursor_test2(20, 20); + +-- mixing named and positional: param2 is given twice, once in named notation +-- and second time in positional notation. Should throw an error at parse time +create function namedparmcursor_test3() returns void as $$ +declare + c1 cursor (param1 int, param2 int) for select * from rc_test where a > param1 and b > param2; +begin + open c1(param2 := 20, 21); +end +$$ language plpgsql; + +-- mixing named and positional: same as previous test, but param1 is duplicated +create function namedparmcursor_test4() returns void as $$ +declare + c1 cursor (param1 int, param2 int) for select * from rc_test where a > param1 and b > param2; +begin + open c1(20, param1 := 21); +end +$$ language plpgsql; + +-- duplicate named parameter, should throw an error at parse time +create function namedparmcursor_test5() returns void as $$ +declare + c1 cursor (p1 int, p2 int) for + select * from tenk1 where thousand = p1 and tenthous = p2; +begin + open c1 (p2 := 77, p2 := 42); +end +$$ language plpgsql; + +-- not enough parameters, should throw an error at parse time +create function namedparmcursor_test6() returns void as $$ +declare + c1 cursor (p1 int, p2 int) for + select * from tenk1 where thousand = p1 and tenthous = p2; +begin + open c1 (p2 := 77); +end +$$ language plpgsql; + +-- division by zero runtime error, the context given in the error message +-- should be sensible +create function namedparmcursor_test7() returns void as $$ +declare + c1 cursor (p1 int, p2 int) for + select * from tenk1 where thousand = p1 and tenthous = p2; +begin + open c1 (p2 := 77, p1 := 42/0); +end $$ language plpgsql; +select namedparmcursor_test7(); + +-- check that line comments work correctly within the argument list (there +-- is some special handling of this case in the code: the newline after the +-- comment must be preserved when the argument-evaluating query is +-- constructed, otherwise the comment effectively comments out the next +-- argument, too) +create function namedparmcursor_test8() returns int4 as $$ +declare + c1 cursor (p1 int, p2 int) for + select count(*) from tenk1 where thousand = p1 and tenthous = p2; + n int4; +begin + open c1 (77 -- test + , 42); + fetch c1 into n; + return n; +end $$ language plpgsql; +select namedparmcursor_test8(); + +-- cursor parameter name can match plpgsql variable or unreserved keyword +create function namedparmcursor_test9(p1 int) returns int4 as $$ +declare + c1 cursor (p1 int, p2 int, debug int) for + select count(*) from tenk1 where thousand = p1 and tenthous = p2 + and four = debug; + p2 int4 := 1006; + n int4; +begin + open c1 (p1 := p1, p2 := p2, debug := 2); + fetch c1 into n; + return n; +end $$ language plpgsql; +select namedparmcursor_test9(6); + +-- +-- tests for "raise" processing +-- +create function raise_test1(int) returns int as $$ +begin + raise notice 'This message has too many parameters!', $1; + return $1; +end; +$$ language plpgsql; + +create function raise_test2(int) returns int as $$ +begin + raise notice 'This message has too few parameters: %, %, %', $1, $1; + return $1; +end; +$$ language plpgsql; + +create function raise_test3(int) returns int as $$ +begin + raise notice 'This message has no parameters (despite having %% signs in it)!'; + return $1; +end; +$$ language plpgsql; + +select raise_test3(1); + +-- Test re-RAISE inside a nested exception block. This case is allowed +-- by Oracle's PL/SQL but was handled differently by PG before 9.1. + +CREATE FUNCTION reraise_test() RETURNS void AS $$ +BEGIN + BEGIN + RAISE syntax_error; + EXCEPTION + WHEN syntax_error THEN + BEGIN + raise notice 'exception % thrown in inner block, reraising', sqlerrm; + RAISE; + EXCEPTION + WHEN OTHERS THEN + raise notice 'RIGHT - exception % caught in inner block', sqlerrm; + END; + END; +EXCEPTION + WHEN OTHERS THEN + raise notice 'WRONG - exception % caught in outer block', sqlerrm; +END; +$$ LANGUAGE plpgsql; + +SELECT reraise_test(); + +-- +-- reject function definitions that contain malformed SQL queries at +-- compile-time, where possible + +/*-- +create function bad_sql1() returns int as $$ +declare a int; +begin + a := 5; + Johnny Yuma; + a := 10; + return a; +end$$ language plpgsql; +*/ +/* +create function bad_sql2() returns int as $$ +declare r record; +begin + for r in select I fought the law, the law won LOOP + raise notice 'in loop'; + end loop; + return 5; +end;$$ language plpgsql; +*/ + +-- a RETURN expression is mandatory, except for void-returning +-- functions, where it is not allowed +create function missing_return_expr() returns int as $$ +begin + return ; +end;$$ language plpgsql; + +create function void_return_expr() returns void as $$ +begin + return 5; +end;$$ language plpgsql; + +-- VOID functions are allowed to omit RETURN +create function void_return_expr() returns void as $$ +begin + perform 2+2; +end;$$ language plpgsql; + +select void_return_expr(); + +-- but ordinary functions are not +create function missing_return_expr() returns int as $$ +begin + perform 2+2; +end;$$ language plpgsql; + +select missing_return_expr(); + +drop function void_return_expr(); +drop function missing_return_expr(); + +-- +-- EXECUTE ... INTO test +-- + +create table eifoo (i integer, y integer); +create type eitype as (i integer, y integer); + +create or replace function execute_into_test(varchar) returns record as $$ +declare + _r record; + _rt eifoo%rowtype; + _v eitype; + i int; + j int; + k int; +begin + execute 'insert into '||$1||' values(10,15)'; + execute 'select (row).* from (select row(10,1)::eifoo) s' into _r; + raise notice '% %', _r.i, _r.y; + execute 'select * from '||$1||' limit 1' into _rt; + raise notice '% %', _rt.i, _rt.y; + execute 'select *, 20 from '||$1||' limit 1' into i, j, k; + raise notice '% % %', i, j, k; + execute 'select 1,2' into _v; + return _v; +end; $$ language plpgsql; + +select execute_into_test('eifoo'); + +drop table eifoo cascade; +drop type eitype cascade; + +-- +-- SQLSTATE and SQLERRM test +-- + +create function excpt_test1() returns void as $$ +begin + raise notice '% %', sqlstate, sqlerrm; +end; $$ language plpgsql; +-- should fail: SQLSTATE and SQLERRM are only in defined EXCEPTION +-- blocks +select excpt_test1(); + +create function excpt_test2() returns void as $$ +begin + begin + begin + raise notice '% %', sqlstate, sqlerrm; + end; + end; +end; $$ language plpgsql; +-- should fail +select excpt_test2(); + +create function excpt_test3() returns void as $$ +begin + begin + raise exception 'user exception'; + exception when others then + raise notice 'caught exception % %', sqlstate, sqlerrm; + begin + raise notice '% %', sqlstate, sqlerrm; + perform 10/0; + exception + when substring_error then + -- this exception handler shouldn't be invoked + raise notice 'unexpected exception: % %', sqlstate, sqlerrm; + when division_by_zero then + raise notice 'caught exception % %', sqlstate, sqlerrm; + end; + raise notice '% %', sqlstate, sqlerrm; + end; +end; $$ language plpgsql; +select excpt_test3(); + +create function excpt_test4() returns text as $$ +begin + begin perform 1/0; + exception when others then return sqlerrm; end; +end; $$ language plpgsql; +select excpt_test4(); + +drop function excpt_test1(); +drop function excpt_test2(); +drop function excpt_test3(); +drop function excpt_test4(); + +-- parameters of raise stmt can be expressions +create function raise_exprs() returns void as $$ +declare + a integer[] = '{10,20,30}'; + c varchar = 'xyz'; + i integer; +begin + i := 2; + raise notice '%; %; %; %; %; %', a, a[i], c, (select c || 'abc'), row(10,'aaa',NULL,30), NULL; +end;$$ language plpgsql; + +select raise_exprs(); +drop function raise_exprs(); + +-- regression test: verify that multiple uses of same plpgsql datum within +-- a SQL command all get mapped to the same $n parameter. The return value +-- of the SELECT is not important, we only care that it doesn't fail with +-- a complaint about an ungrouped column reference. +create function multi_datum_use(p1 int) returns bool as $$ +declare + x int; + y int; +begin + select into x,y unique1/p1, unique1/$1 from tenk1 group by unique1/p1; + return x = y; +end$$ language plpgsql; + +select multi_datum_use(42); + +-- +-- Test STRICT limiter in both planned and EXECUTE invocations. +-- Note that a data-modifying query is quasi strict (disallow multi rows) +-- by default in the planned case, but not in EXECUTE. +-- + +create temp table foo (f1 int, f2 int); + +insert into foo values (1,2), (3,4); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should work + insert into foo values(5,6) returning * into x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should fail due to implicit strict + insert into foo values(7,8),(9,10) returning * into x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should work + execute 'insert into foo values(5,6) returning *' into x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- this should work since EXECUTE isn't as picky + execute 'insert into foo values(7,8),(9,10) returning *' into x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +select * from foo; + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should work + select * from foo where f1 = 3 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should fail, no rows + select * from foo where f1 = 0 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should fail, too many rows + select * from foo where f1 > 3 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should work + execute 'select * from foo where f1 = 3' into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should fail, no rows + execute 'select * from foo where f1 = 0' into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- should fail, too many rows + execute 'select * from foo where f1 > 3' into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +drop function stricttest(); + +-- test printing parameters after failure due to STRICT + +set plpgsql.print_strict_params to true; + +create or replace function stricttest() returns void as $$ +declare +x record; +p1 int := 2; +p3 text := 'foo'; +begin + -- no rows + select * from foo where f1 = p1 and f1::text = p3 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare +x record; +p1 int := 2; +p3 text := $a$'Valame Dios!' dijo Sancho; 'no le dije yo a vuestra merced que mirase bien lo que hacia?'$a$; +begin + -- no rows + select * from foo where f1 = p1 and f1::text = p3 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare +x record; +p1 int := 2; +p3 text := 'foo'; +begin + -- too many rows + select * from foo where f1 > p1 or f1::text = p3 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- too many rows, no params + select * from foo where f1 > 3 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- no rows + execute 'select * from foo where f1 = $1 or f1::text = $2' using 0, 'foo' into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- too many rows + execute 'select * from foo where f1 > $1' using 1 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +declare x record; +begin + -- too many rows, no parameters + execute 'select * from foo where f1 > 3' into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +create or replace function stricttest() returns void as $$ +-- override the global +#print_strict_params off +declare +x record; +p1 int := 2; +p3 text := 'foo'; +begin + -- too many rows + select * from foo where f1 > p1 or f1::text = p3 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +reset plpgsql.print_strict_params; + +create or replace function stricttest() returns void as $$ +-- override the global +#print_strict_params on +declare +x record; +p1 int := 2; +p3 text := 'foo'; +begin + -- too many rows + select * from foo where f1 > p1 or f1::text = p3 into strict x; + raise notice 'x.f1 = %, x.f2 = %', x.f1, x.f2; +end$$ language plpgsql; + +select stricttest(); + +-- test warnings and errors +set plpgsql.extra_warnings to 'all'; +set plpgsql.extra_warnings to 'none'; +set plpgsql.extra_errors to 'all'; +set plpgsql.extra_errors to 'none'; + +-- test warnings when shadowing a variable + +set plpgsql.extra_warnings to 'shadowed_variables'; + +-- simple shadowing of input and output parameters +create or replace function shadowtest(in1 int) + returns table (out1 int) as $$ +declare +in1 int; +out1 int; +begin +end +$$ language plpgsql; +select shadowtest(1); + +set plpgsql.extra_warnings to 'shadowed_variables'; +select shadowtest(1); +create or replace function shadowtest(in1 int) + returns table (out1 int) as $$ +declare +in1 int; +out1 int; +begin +end +$$ language plpgsql; +select shadowtest(1); +drop function shadowtest(int); + +-- shadowing in a second DECLARE block +create or replace function shadowtest() + returns void as $$ +declare +f1 int; +begin + declare + f1 int; + begin + end; +end$$ language plpgsql; +drop function shadowtest(); + +-- several levels of shadowing +create or replace function shadowtest(in1 int) + returns void as $$ +declare +in1 int; +begin + declare + in1 int; + begin + end; +end$$ language plpgsql; +drop function shadowtest(int); + +-- shadowing in cursor definitions +create or replace function shadowtest() + returns void as $$ +declare +f1 int; +c1 cursor (f1 int) for select 1; +begin +end$$ language plpgsql; +drop function shadowtest(); + +-- test errors when shadowing a variable + +set plpgsql.extra_errors to 'shadowed_variables'; + +create or replace function shadowtest(f1 int) + returns boolean as $$ +declare f1 int; begin return 1; end $$ language plpgsql; + +select shadowtest(1); + +reset plpgsql.extra_errors; +reset plpgsql.extra_warnings; + +create or replace function shadowtest(f1 int) + returns boolean as $$ +declare f1 int; begin return 1; end $$ language plpgsql; + +select shadowtest(1); + +-- runtime extra checks +set plpgsql.extra_warnings to 'too_many_rows'; + +do $$ +declare x int; +begin + select v from generate_series(1,2) g(v) into x; +end; +$$; + +set plpgsql.extra_errors to 'too_many_rows'; + +do $$ +declare x int; +begin + select v from generate_series(1,2) g(v) into x; +end; +$$; + +reset plpgsql.extra_errors; +reset plpgsql.extra_warnings; + +set plpgsql.extra_warnings to 'strict_multi_assignment'; + +do $$ +declare + x int; + y int; +begin + select 1 into x, y; + select 1,2 into x, y; + select 1,2,3 into x, y; +end +$$; + +set plpgsql.extra_errors to 'strict_multi_assignment'; + +do $$ +declare + x int; + y int; +begin + select 1 into x, y; + select 1,2 into x, y; + select 1,2,3 into x, y; +end +$$; + +create table test_01(a int, b int, c int); + +alter table test_01 drop column a; + +-- the check is active only when source table is not empty +insert into test_01 values(10,20); + +do $$ +declare + x int; + y int; +begin + select * from test_01 into x, y; -- should be ok + raise notice 'ok'; + select * from test_01 into x; -- should to fail +end; +$$; + +do $$ +declare + t test_01; +begin + select 1, 2 into t; -- should be ok + raise notice 'ok'; + select 1, 2, 3 into t; -- should fail; +end; +$$; + +do $$ +declare + t test_01; +begin + select 1 into t; -- should fail; +end; +$$; + +drop table test_01; + +reset plpgsql.extra_errors; +reset plpgsql.extra_warnings; + +-- test scrollable cursor support + +create function sc_test() returns setof integer as $$ +declare + c scroll cursor for select f1 from int4_tbl; + x integer; +begin + open c; + fetch last from c into x; + while found loop + return next x; + fetch prior from c into x; + end loop; + close c; +end; +$$ language plpgsql; + +select * from sc_test(); + +create or replace function sc_test() returns setof integer as $$ +declare + c no scroll cursor for select f1 from int4_tbl; + x integer; +begin + open c; + fetch last from c into x; + while found loop + return next x; + fetch prior from c into x; + end loop; + close c; +end; +$$ language plpgsql; + +select * from sc_test(); -- fails because of NO SCROLL specification + +create or replace function sc_test() returns setof integer as $$ +declare + c refcursor; + x integer; +begin + open c scroll for select f1 from int4_tbl; + fetch last from c into x; + while found loop + return next x; + fetch prior from c into x; + end loop; + close c; +end; +$$ language plpgsql; + +select * from sc_test(); + +create or replace function sc_test() returns setof integer as $$ +declare + c refcursor; + x integer; +begin + open c scroll for execute 'select f1 from int4_tbl'; + fetch last from c into x; + while found loop + return next x; + fetch relative -2 from c into x; + end loop; + close c; +end; +$$ language plpgsql; + +select * from sc_test(); + +create or replace function sc_test() returns setof integer as $$ +declare + c refcursor; + x integer; +begin + open c scroll for execute 'select f1 from int4_tbl'; + fetch last from c into x; + while found loop + return next x; + move backward 2 from c; + fetch relative -1 from c into x; + end loop; + close c; +end; +$$ language plpgsql; + +select * from sc_test(); + +create or replace function sc_test() returns setof integer as $$ +declare + c cursor for select * from generate_series(1, 10); + x integer; +begin + open c; + loop + move relative 2 in c; + if not found then + exit; + end if; + fetch next from c into x; + if found then + return next x; + end if; + end loop; + close c; +end; +$$ language plpgsql; + +select * from sc_test(); + +create or replace function sc_test() returns setof integer as $$ +declare + c cursor for select * from generate_series(1, 10); + x integer; +begin + open c; + move forward all in c; + fetch backward from c into x; + if found then + return next x; + end if; + close c; +end; +$$ language plpgsql; + +select * from sc_test(); + +drop function sc_test(); + +-- test qualified variable names + +create function pl_qual_names (param1 int) returns void as $$ +<> +declare + param1 int := 1; +begin + <> + declare + param1 int := 2; + begin + raise notice 'param1 = %', param1; + raise notice 'pl_qual_names.param1 = %', pl_qual_names.param1; + raise notice 'outerblock.param1 = %', outerblock.param1; + raise notice 'innerblock.param1 = %', innerblock.param1; + end; +end; +$$ language plpgsql; + +select pl_qual_names(42); + +drop function pl_qual_names(int); + +-- tests for RETURN QUERY +create function ret_query1(out int, out int) returns setof record as $$ +begin + $1 := -1; + $2 := -2; + return next; + return query select x + 1, x * 10 from generate_series(0, 10) s (x); + return next; +end; +$$ language plpgsql; + +select * from ret_query1(); + +create type record_type as (x text, y int, z boolean); + +create or replace function ret_query2(lim int) returns setof record_type as $$ +begin + return query select md5(s.x::text), s.x, s.x > 0 + from generate_series(-8, lim) s (x) where s.x % 2 = 0; +end; +$$ language plpgsql; + +select * from ret_query2(8); + +-- test EXECUTE USING +create function exc_using(int, text) returns int as $$ +declare i int; +begin + for i in execute 'select * from generate_series(1,$1)' using $1+1 loop + raise notice '%', i; + end loop; + execute 'select $2 + $2*3 + length($1)' into i using $2,$1; + return i; +end +$$ language plpgsql; + +select exc_using(5, 'foobar'); + +drop function exc_using(int, text); + +create or replace function exc_using(int) returns void as $$ +declare + c refcursor; + i int; +begin + open c for execute 'select * from generate_series(1,$1)' using $1+1; + loop + fetch c into i; + exit when not found; + raise notice '%', i; + end loop; + close c; + return; +end; +$$ language plpgsql; + +select exc_using(5); + +drop function exc_using(int); + +-- test FOR-over-cursor + +create or replace function forc01() returns void as $$ +declare + c cursor(r1 integer, r2 integer) + for select * from generate_series(r1,r2) i; + c2 cursor + for select * from generate_series(41,43) i; +begin + for r in c(5,7) loop + raise notice '% from %', r.i, c; + end loop; + -- again, to test if cursor was closed properly + for r in c(9,10) loop + raise notice '% from %', r.i, c; + end loop; + -- and test a parameterless cursor + for r in c2 loop + raise notice '% from %', r.i, c2; + end loop; + -- and try it with a hand-assigned name + raise notice 'after loop, c2 = %', c2; + c2 := 'special_name'; + for r in c2 loop + raise notice '% from %', r.i, c2; + end loop; + raise notice 'after loop, c2 = %', c2; + -- and try it with a generated name + -- (which we can't show in the output because it's variable) + c2 := null; + for r in c2 loop + raise notice '%', r.i; + end loop; + raise notice 'after loop, c2 = %', c2; + return; +end; +$$ language plpgsql; + +select forc01(); + +-- try updating the cursor's current row + +create temp table forc_test as + select n as i, n as j from generate_series(1,10) n; + +create or replace function forc01() returns void as $$ +declare + c cursor for select * from forc_test; +begin + for r in c loop + raise notice '%, %', r.i, r.j; + update forc_test set i = i * 100, j = r.j * 2 where current of c; + end loop; +end; +$$ language plpgsql; + +select forc01(); + +select * from forc_test; + +-- same, with a cursor whose portal name doesn't match variable name +create or replace function forc01() returns void as $$ +declare + c refcursor := 'fooled_ya'; + r record; +begin + open c for select * from forc_test; + loop + fetch c into r; + exit when not found; + raise notice '%, %', r.i, r.j; + update forc_test set i = i * 100, j = r.j * 2 where current of c; + end loop; +end; +$$ language plpgsql; + +select forc01(); + +select * from forc_test; + +drop function forc01(); + +-- fail because cursor has no query bound to it + +create or replace function forc_bad() returns void as $$ +declare + c refcursor; +begin + for r in c loop + raise notice '%', r.i; + end loop; +end; +$$ language plpgsql; + +-- test RETURN QUERY EXECUTE + +create or replace function return_dquery() +returns setof int as $$ +begin + return query execute 'select * from (values(10),(20)) f'; + return query execute 'select * from (values($1),($2)) f' using 40,50; +end; +$$ language plpgsql; + +select * from return_dquery(); + +drop function return_dquery(); + +-- test RETURN QUERY with dropped columns + +create table tabwithcols(a int, b int, c int, d int); +insert into tabwithcols values(10,20,30,40),(50,60,70,80); + +create or replace function returnqueryf() +returns setof tabwithcols as $$ +begin + return query select * from tabwithcols; + return query execute 'select * from tabwithcols'; +end; +$$ language plpgsql; + +select * from returnqueryf(); + +alter table tabwithcols drop column b; + +select * from returnqueryf(); + +alter table tabwithcols drop column d; + +select * from returnqueryf(); + +alter table tabwithcols add column d int; + +select * from returnqueryf(); + +drop function returnqueryf(); +drop table tabwithcols; + +-- +-- Tests for composite-type results +-- + +create type compostype as (x int, y varchar); + +-- test: use of variable of composite type in return statement +create or replace function compos() returns compostype as $$ +declare + v compostype; +begin + v := (1, 'hello'); + return v; +end; +$$ language plpgsql; + +select compos(); + +-- test: use of variable of record type in return statement +create or replace function compos() returns compostype as $$ +declare + v record; +begin + v := (1, 'hello'::varchar); + return v; +end; +$$ language plpgsql; + +select compos(); + +-- test: use of row expr in return statement +create or replace function compos() returns compostype as $$ +begin + return (1, 'hello'::varchar); +end; +$$ language plpgsql; + +select compos(); + +-- this does not work currently (no implicit casting) +create or replace function compos() returns compostype as $$ +begin + return (1, 'hello'); +end; +$$ language plpgsql; + +select compos(); + +-- ... but this does +create or replace function compos() returns compostype as $$ +begin + return (1, 'hello')::compostype; +end; +$$ language plpgsql; + +select compos(); + +drop function compos(); + +-- test: return a row expr as record. +create or replace function composrec() returns record as $$ +declare + v record; +begin + v := (1, 'hello'); + return v; +end; +$$ language plpgsql; + +select composrec(); + +-- test: return row expr in return statement. +create or replace function composrec() returns record as $$ +begin + return (1, 'hello'); +end; +$$ language plpgsql; + +select composrec(); + +drop function composrec(); + +-- test: row expr in RETURN NEXT statement. +create or replace function compos() returns setof compostype as $$ +begin + for i in 1..3 + loop + return next (1, 'hello'::varchar); + end loop; + return next null::compostype; + return next (2, 'goodbye')::compostype; +end; +$$ language plpgsql; + +select * from compos(); + +drop function compos(); + +-- test: use invalid expr in return statement. +create or replace function compos() returns compostype as $$ +begin + return 1 + 1; +end; +$$ language plpgsql; + +select compos(); + +-- RETURN variable is a different code path ... +create or replace function compos() returns compostype as $$ +declare x int := 42; +begin + return x; +end; +$$ language plpgsql; + +select * from compos(); + +drop function compos(); + +-- test: invalid use of composite variable in scalar-returning function +create or replace function compos() returns int as $$ +declare + v compostype; +begin + v := (1, 'hello'); + return v; +end; +$$ language plpgsql; + +select compos(); + +-- test: invalid use of composite expression in scalar-returning function +create or replace function compos() returns int as $$ +begin + return (1, 'hello')::compostype; +end; +$$ language plpgsql; + +select compos(); + +drop function compos(); +drop type compostype; + +-- +-- Tests for 8.4's new RAISE features +-- + +create or replace function raise_test() returns void as $$ +begin + raise notice '% % %', 1, 2, 3 + using errcode = '55001', detail = 'some detail info', hint = 'some hint'; + raise '% % %', 1, 2, 3 + using errcode = 'division_by_zero', detail = 'some detail info'; +end; +$$ language plpgsql; + +select raise_test(); + +-- Since we can't actually see the thrown SQLSTATE in default psql output, +-- test it like this; this also tests re-RAISE + +create or replace function raise_test() returns void as $$ +begin + raise 'check me' + using errcode = 'division_by_zero', detail = 'some detail info'; + exception + when others then + raise notice 'SQLSTATE: % SQLERRM: %', sqlstate, sqlerrm; + raise; +end; +$$ language plpgsql; + +select raise_test(); + +create or replace function raise_test() returns void as $$ +begin + raise 'check me' + using errcode = '1234F', detail = 'some detail info'; + exception + when others then + raise notice 'SQLSTATE: % SQLERRM: %', sqlstate, sqlerrm; + raise; +end; +$$ language plpgsql; + +select raise_test(); + +-- SQLSTATE specification in WHEN +create or replace function raise_test() returns void as $$ +begin + raise 'check me' + using errcode = '1234F', detail = 'some detail info'; + exception + when sqlstate '1234F' then + raise notice 'SQLSTATE: % SQLERRM: %', sqlstate, sqlerrm; + raise; +end; +$$ language plpgsql; + +select raise_test(); + +create or replace function raise_test() returns void as $$ +begin + raise division_by_zero using detail = 'some detail info'; + exception + when others then + raise notice 'SQLSTATE: % SQLERRM: %', sqlstate, sqlerrm; + raise; +end; +$$ language plpgsql; + +select raise_test(); + +create or replace function raise_test() returns void as $$ +begin + raise division_by_zero; +end; +$$ language plpgsql; + +select raise_test(); + +create or replace function raise_test() returns void as $$ +begin + raise sqlstate '1234F'; +end; +$$ language plpgsql; + +select raise_test(); + +create or replace function raise_test() returns void as $$ +begin + raise division_by_zero using message = 'custom' || ' message'; +end; +$$ language plpgsql; + +select raise_test(); + +create or replace function raise_test() returns void as $$ +begin + raise using message = 'custom' || ' message', errcode = '22012'; +end; +$$ language plpgsql; + +select raise_test(); + +-- conflict on message +create or replace function raise_test() returns void as $$ +begin + raise notice 'some message' using message = 'custom' || ' message', errcode = '22012'; +end; +$$ language plpgsql; + +select raise_test(); + +-- conflict on errcode +create or replace function raise_test() returns void as $$ +begin + raise division_by_zero using message = 'custom' || ' message', errcode = '22012'; +end; +$$ language plpgsql; + +select raise_test(); + +-- nothing to re-RAISE +create or replace function raise_test() returns void as $$ +begin + raise; +end; +$$ language plpgsql; + +select raise_test(); + +-- test access to exception data +create function zero_divide() returns int as $$ +declare v int := 0; +begin + return 10 / v; +end; +$$ language plpgsql; + +create or replace function raise_test() returns void as $$ +begin + raise exception 'custom exception' + using detail = 'some detail of custom exception', + hint = 'some hint related to custom exception'; +end; +$$ language plpgsql; + +create function stacked_diagnostics_test() returns void as $$ +declare _sqlstate text; + _message text; + _context text; +begin + perform zero_divide(); +exception when others then + get stacked diagnostics + _sqlstate = returned_sqlstate, + _message = message_text, + _context = pg_exception_context; + raise notice 'sqlstate: %, message: %, context: [%]', + _sqlstate, _message, replace(_context, E'\n', ' <- '); +end; +$$ language plpgsql; + +select stacked_diagnostics_test(); + +create or replace function stacked_diagnostics_test() returns void as $$ +declare _detail text; + _hint text; + _message text; +begin + perform raise_test(); +exception when others then + get stacked diagnostics + _message = message_text, + _detail = pg_exception_detail, + _hint = pg_exception_hint; + raise notice 'message: %, detail: %, hint: %', _message, _detail, _hint; +end; +$$ language plpgsql; + +select stacked_diagnostics_test(); + +-- fail, cannot use stacked diagnostics statement outside handler +create or replace function stacked_diagnostics_test() returns void as $$ +declare _detail text; + _hint text; + _message text; +begin + get stacked diagnostics + _message = message_text, + _detail = pg_exception_detail, + _hint = pg_exception_hint; + raise notice 'message: %, detail: %, hint: %', _message, _detail, _hint; +end; +$$ language plpgsql; + +select stacked_diagnostics_test(); + +drop function zero_divide(); +drop function stacked_diagnostics_test(); + +-- check cases where implicit SQLSTATE variable could be confused with +-- SQLSTATE as a keyword, cf bug #5524 +create or replace function raise_test() returns void as $$ +begin + perform 1/0; +exception + when sqlstate '22012' then + raise notice using message = sqlstate; + raise sqlstate '22012' using message = 'substitute message'; +end; +$$ language plpgsql; + +select raise_test(); + +drop function raise_test(); + +-- test passing column_name, constraint_name, datatype_name, table_name +-- and schema_name error fields + +create or replace function stacked_diagnostics_test() returns void as $$ +declare _column_name text; + _constraint_name text; + _datatype_name text; + _table_name text; + _schema_name text; +begin + raise exception using + column = '>>some column name<<', + constraint = '>>some constraint name<<', + datatype = '>>some datatype name<<', + table = '>>some table name<<', + schema = '>>some schema name<<'; +exception when others then + get stacked diagnostics + _column_name = column_name, + _constraint_name = constraint_name, + _datatype_name = pg_datatype_name, + _table_name = table_name, + _schema_name = schema_name; + raise notice 'column %, constraint %, type %, table %, schema %', + _column_name, _constraint_name, _datatype_name, _table_name, _schema_name; +end; +$$ language plpgsql; + +select stacked_diagnostics_test(); + +drop function stacked_diagnostics_test(); + +-- test variadic functions + +create or replace function vari(variadic int[]) +returns void as $$ +begin + for i in array_lower($1,1)..array_upper($1,1) loop + raise notice '%', $1[i]; + end loop; end; +$$ language plpgsql; + +select vari(1,2,3,4,5); +select vari(3,4,5); +select vari(variadic array[5,6,7]); + +drop function vari(int[]); + +-- coercion test +create or replace function pleast(variadic numeric[]) +returns numeric as $$ +declare aux numeric = $1[array_lower($1,1)]; +begin + for i in array_lower($1,1)+1..array_upper($1,1) loop + if $1[i] < aux then aux := $1[i]; end if; + end loop; + return aux; +end; +$$ language plpgsql immutable strict; + +select pleast(10,1,2,3,-16); +select pleast(10.2,2.2,-1.1); +select pleast(10.2,10, -20); +select pleast(10,20, -1.0); + +-- in case of conflict, non-variadic version is preferred +create or replace function pleast(numeric) +returns numeric as $$ +begin + raise notice 'non-variadic function called'; + return $1; +end; +$$ language plpgsql immutable strict; + +select pleast(10); + +drop function pleast(numeric[]); +drop function pleast(numeric); + +-- test table functions + +create function tftest(int) returns table(a int, b int) as $$ +begin + return query select $1, $1+i from generate_series(1,5) g(i); +end; +$$ language plpgsql immutable strict; + +select * from tftest(10); + +create or replace function tftest(a1 int) returns table(a int, b int) as $$ +begin + a := a1; b := a1 + 1; + return next; + a := a1 * 10; b := a1 * 10 + 1; + return next; +end; +$$ language plpgsql immutable strict; + +select * from tftest(10); + +drop function tftest(int); + +create or replace function rttest() +returns setof int as $$ +declare rc int; + rca int[]; +begin + return query values(10),(20); + get diagnostics rc = row_count; + raise notice '% %', found, rc; + return query select * from (values(10),(20)) f(a) where false; + get diagnostics rc = row_count; + raise notice '% %', found, rc; + return query execute 'values(10),(20)'; + -- just for fun, let's use array elements as targets + get diagnostics rca[1] = row_count; + raise notice '% %', found, rca[1]; + return query execute 'select * from (values(10),(20)) f(a) where false'; + get diagnostics rca[2] = row_count; + raise notice '% %', found, rca[2]; +end; +$$ language plpgsql; + +select * from rttest(); + +drop function rttest(); + +-- Test for proper cleanup at subtransaction exit. This example +-- exposed a bug in PG 8.2. + +CREATE FUNCTION leaker_1(fail BOOL) RETURNS INTEGER AS $$ +DECLARE + v_var INTEGER; +BEGIN + BEGIN + v_var := (leaker_2(fail)).error_code; + EXCEPTION + WHEN others THEN RETURN 0; + END; + RETURN 1; +END; +$$ LANGUAGE plpgsql; + +CREATE FUNCTION leaker_2(fail BOOL, OUT error_code INTEGER, OUT new_id INTEGER) + RETURNS RECORD AS $$ +BEGIN + IF fail THEN + RAISE EXCEPTION 'fail ...'; + END IF; + error_code := 1; + new_id := 1; + RETURN; +END; +$$ LANGUAGE plpgsql; + +SELECT * FROM leaker_1(false); +SELECT * FROM leaker_1(true); + +DROP FUNCTION leaker_1(bool); +DROP FUNCTION leaker_2(bool); + +-- Test for appropriate cleanup of non-simple expression evaluations +-- (bug in all versions prior to August 2010) + +CREATE FUNCTION nonsimple_expr_test() RETURNS text[] AS $$ +DECLARE + arr text[]; + lr text; + i integer; +BEGIN + arr := array[array['foo','bar'], array['baz', 'quux']]; + lr := 'fool'; + i := 1; + -- use sub-SELECTs to make expressions non-simple + arr[(SELECT i)][(SELECT i+1)] := (SELECT lr); + RETURN arr; +END; +$$ LANGUAGE plpgsql; + +SELECT nonsimple_expr_test(); + +DROP FUNCTION nonsimple_expr_test(); + +CREATE FUNCTION nonsimple_expr_test() RETURNS integer AS $$ +declare + i integer NOT NULL := 0; +begin + begin + i := (SELECT NULL::integer); -- should throw error + exception + WHEN OTHERS THEN + i := (SELECT 1::integer); + end; + return i; +end; +$$ LANGUAGE plpgsql; + +SELECT nonsimple_expr_test(); + +DROP FUNCTION nonsimple_expr_test(); + +-- +-- Test cases involving recursion and error recovery in simple expressions +-- (bugs in all versions before October 2010). The problems are most +-- easily exposed by mutual recursion between plpgsql and sql functions. +-- + +create function recurse(float8) returns float8 as +$$ +begin + if ($1 > 0) then + return sql_recurse($1 - 1); + else + return $1; + end if; +end; +$$ language plpgsql; + +-- "limit" is to prevent this from being inlined +create function sql_recurse(float8) returns float8 as +$$ select recurse($1) limit 1; $$ language sql; + +select recurse(10); + +create function error1(text) returns text language sql as +$$ SELECT relname::text FROM pg_class c WHERE c.oid = $1::regclass $$; + +create function error2(p_name_table text) returns text language plpgsql as $$ +begin + return error1(p_name_table); +end$$; + +BEGIN; +create table public.stuffs (stuff text); +SAVEPOINT a; +select error2('nonexistent.stuffs'); +ROLLBACK TO a; +select error2('public.stuffs'); +rollback; + +drop function error2(p_name_table text); +drop function error1(text); + +-- Test for proper handling of cast-expression caching + +create function sql_to_date(integer) returns date as $$ +select $1::text::date +$$ language sql immutable strict; + +create cast (integer as date) with function sql_to_date(integer) as assignment; + +create function cast_invoker(integer) returns date as $$ +begin + return $1; +end$$ language plpgsql; + +select cast_invoker(20150717); +select cast_invoker(20150718); -- second call crashed in pre-release 9.5 + +begin; +select cast_invoker(20150717); +select cast_invoker(20150718); +savepoint s1; +select cast_invoker(20150718); +select cast_invoker(-1); -- fails +rollback to savepoint s1; +select cast_invoker(20150719); +select cast_invoker(20150720); +commit; + +drop function cast_invoker(integer); +drop function sql_to_date(integer) cascade; + +-- Test handling of cast cache inside DO blocks +-- (to check the original crash case, this must be a cast not previously +-- used in this session) + +begin; +do $$ declare x text[]; begin x := '{1.23, 4.56}'::numeric[]; end $$; +do $$ declare x text[]; begin x := '{1.23, 4.56}'::numeric[]; end $$; +end; + +-- Test for consistent reporting of error context + +create function fail() returns int language plpgsql as $$ +begin + return 1/0; +end +$$; + +select fail(); +select fail(); + +drop function fail(); + +-- Test handling of string literals. + +set standard_conforming_strings = off; + +create or replace function strtest() returns text as $$ +begin + raise notice 'foo\\bar\041baz'; + return 'foo\\bar\041baz'; +end +$$ language plpgsql; + +select strtest(); + +create or replace function strtest() returns text as $$ +begin + raise notice E'foo\\bar\041baz'; + return E'foo\\bar\041baz'; +end +$$ language plpgsql; + +select strtest(); + +set standard_conforming_strings = on; + +create or replace function strtest() returns text as $$ +begin + raise notice 'foo\\bar\041baz\'; + return 'foo\\bar\041baz\'; +end +$$ language plpgsql; + +select strtest(); + +create or replace function strtest() returns text as $$ +begin + raise notice E'foo\\bar\041baz'; + return E'foo\\bar\041baz'; +end +$$ language plpgsql; + +select strtest(); + +drop function strtest(); + +-- Test anonymous code blocks. + +DO $$ +DECLARE r record; +BEGIN + FOR r IN SELECT rtrim(roomno) AS roomno, comment FROM Room ORDER BY roomno + LOOP + RAISE NOTICE '%, %', r.roomno, r.comment; + END LOOP; +END$$; + +-- these are to check syntax error reporting +DO LANGUAGE plpgsql $$begin return 1; end$$; + +DO $$ +DECLARE r record; +BEGIN + FOR r IN SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomno + LOOP + RAISE NOTICE '%, %', r.roomno, r.comment; + END LOOP; +END$$; + + +-- Check variable scoping -- a var is not available in its own or prior +-- default expressions. + +create function scope_test() returns int as $$ +declare x int := 42; +begin + declare y int := x + 1; + x int := x + 2; + begin + return x * 100 + y; + end; +end; +$$ language plpgsql; + +select scope_test(); + +drop function scope_test(); + +-- Check handling of conflicts between plpgsql vars and table columns. + + + +create function conflict_test() returns setof int8_tbl as $$ +declare r record; + q1 bigint := 42; +begin + for r in select q1,q2 from int8_tbl loop + return next r; + end loop; +end; +$$ language plpgsql; + +select * from conflict_test(); + +create or replace function conflict_test() returns setof int8_tbl as $$ +#variable_conflict use_variable +declare r record; + q1 bigint := 42; +begin + for r in select q1,q2 from int8_tbl loop + return next r; + end loop; +end; +$$ language plpgsql; + +select * from conflict_test(); + +create or replace function conflict_test() returns setof int8_tbl as $$ +#variable_conflict use_column +declare r record; + q1 bigint := 42; +begin + for r in select q1,q2 from int8_tbl loop + return next r; + end loop; +end; +$$ language plpgsql; + +select * from conflict_test(); + +drop function conflict_test(); + +-- Check that an unreserved keyword can be used as a variable name + +create function unreserved_test() returns int as $$ +declare + forward int := 21; +begin + forward := forward * 2; + return forward; +end +$$ language plpgsql; + +select unreserved_test(); + +create or replace function unreserved_test() returns int as $$ +declare + return int := 42; +begin + return := return + 1; + return return; +end +$$ language plpgsql; + +select unreserved_test(); + +create or replace function unreserved_test() returns int as $$ +declare + comment int := 21; +begin + comment := comment * 2; + comment on function unreserved_test() is 'this is a test'; + return comment; +end +$$ language plpgsql; + +select unreserved_test(); + +select obj_description('unreserved_test()'::regprocedure, 'pg_proc'); + +drop function unreserved_test(); + +-- +-- Test FOREACH over arrays +-- + +create function foreach_test(anyarray) +returns void as $$ +declare x int; +begin + foreach x in array $1 + loop + raise notice '%', x; + end loop; + end; +$$ language plpgsql; + +select foreach_test(ARRAY[1,2,3,4]); +select foreach_test(ARRAY[[1,2],[3,4]]); + +create or replace function foreach_test(anyarray) +returns void as $$ +declare x int; +begin + foreach x slice 1 in array $1 + loop + raise notice '%', x; + end loop; + end; +$$ language plpgsql; + +-- should fail +select foreach_test(ARRAY[1,2,3,4]); +select foreach_test(ARRAY[[1,2],[3,4]]); + +create or replace function foreach_test(anyarray) +returns void as $$ +declare x int[]; +begin + foreach x slice 1 in array $1 + loop + raise notice '%', x; + end loop; + end; +$$ language plpgsql; + +select foreach_test(ARRAY[1,2,3,4]); +select foreach_test(ARRAY[[1,2],[3,4]]); + +-- higher level of slicing +create or replace function foreach_test(anyarray) +returns void as $$ +declare x int[]; +begin + foreach x slice 2 in array $1 + loop + raise notice '%', x; + end loop; + end; +$$ language plpgsql; + +-- should fail +select foreach_test(ARRAY[1,2,3,4]); +-- ok +select foreach_test(ARRAY[[1,2],[3,4]]); +select foreach_test(ARRAY[[[1,2]],[[3,4]]]); + +create type xy_tuple AS (x int, y int); + +-- iteration over array of records +create or replace function foreach_test(anyarray) +returns void as $$ +declare r record; +begin + foreach r in array $1 + loop + raise notice '%', r; + end loop; + end; +$$ language plpgsql; + +select foreach_test(ARRAY[(10,20),(40,69),(35,78)]::xy_tuple[]); +select foreach_test(ARRAY[[(10,20),(40,69)],[(35,78),(88,76)]]::xy_tuple[]); + +create or replace function foreach_test(anyarray) +returns void as $$ +declare x int; y int; +begin + foreach x, y in array $1 + loop + raise notice 'x = %, y = %', x, y; + end loop; + end; +$$ language plpgsql; + +select foreach_test(ARRAY[(10,20),(40,69),(35,78)]::xy_tuple[]); +select foreach_test(ARRAY[[(10,20),(40,69)],[(35,78),(88,76)]]::xy_tuple[]); + +-- slicing over array of composite types +create or replace function foreach_test(anyarray) +returns void as $$ +declare x xy_tuple[]; +begin + foreach x slice 1 in array $1 + loop + raise notice '%', x; + end loop; + end; +$$ language plpgsql; + +select foreach_test(ARRAY[(10,20),(40,69),(35,78)]::xy_tuple[]); +select foreach_test(ARRAY[[(10,20),(40,69)],[(35,78),(88,76)]]::xy_tuple[]); + +drop function foreach_test(anyarray); +drop type xy_tuple; + +-- +-- Assorted tests for array subscript assignment +-- + +create temp table rtype (id int, ar text[]); + +create function arrayassign1() returns text[] language plpgsql as $$ +declare + r record; +begin + r := row(12, '{foo,bar,baz}')::rtype; + r.ar[2] := 'replace'; + return r.ar; +end$$; + +select arrayassign1(); +select arrayassign1(); -- try again to exercise internal caching + +create domain orderedarray as int[2] + constraint sorted check (value[1] < value[2]); + +select '{1,2}'::orderedarray; +select '{2,1}'::orderedarray; -- fail + +create function testoa(x1 int, x2 int, x3 int) returns orderedarray +language plpgsql as $$ +declare res orderedarray; +begin + res := array[x1, x2]; + res[2] := x3; + return res; +end$$; + +select testoa(1,2,3); +select testoa(1,2,3); -- try again to exercise internal caching +select testoa(2,1,3); -- fail at initial assign +select testoa(1,2,1); -- fail at update + +drop function arrayassign1(); +drop function testoa(x1 int, x2 int, x3 int); + + +-- +-- Test handling of expanded arrays +-- + +create function returns_rw_array(int) returns int[] +language plpgsql as $$ + declare r int[]; + begin r := array[$1, $1]; return r; end; +$$ stable; + +create function consumes_rw_array(int[]) returns int +language plpgsql as $$ + begin return $1[1]; end; +$$ stable; + +select consumes_rw_array(returns_rw_array(42)); + +-- bug #14174 +explain (verbose, costs off) +select i, a from + (select returns_rw_array(1) as a offset 0) ss, + lateral consumes_rw_array(a) i; + +select i, a from + (select returns_rw_array(1) as a offset 0) ss, + lateral consumes_rw_array(a) i; + +explain (verbose, costs off) +select consumes_rw_array(a), a from returns_rw_array(1) a; + +select consumes_rw_array(a), a from returns_rw_array(1) a; + +explain (verbose, costs off) +select consumes_rw_array(a), a from + (values (returns_rw_array(1)), (returns_rw_array(2))) v(a); + +select consumes_rw_array(a), a from + (values (returns_rw_array(1)), (returns_rw_array(2))) v(a); + +do $$ +declare a int[] := array[1,2]; +begin + a := a || 3; + raise notice 'a = %', a; +end$$; + + +-- +-- Test access to call stack +-- + +create function inner_func(int) +returns int as $$ +declare _context text; +begin + get diagnostics _context = pg_context; + raise notice '***%***', _context; + -- lets do it again, just for fun.. + get diagnostics _context = pg_context; + raise notice '***%***', _context; + raise notice 'lets make sure we didnt break anything'; + return 2 * $1; +end; +$$ language plpgsql; + +create or replace function outer_func(int) +returns int as $$ +declare + myresult int; +begin + raise notice 'calling down into inner_func()'; + myresult := inner_func($1); + raise notice 'inner_func() done'; + return myresult; +end; +$$ language plpgsql; + +create or replace function outer_outer_func(int) +returns int as $$ +declare + myresult int; +begin + raise notice 'calling down into outer_func()'; + myresult := outer_func($1); + raise notice 'outer_func() done'; + return myresult; +end; +$$ language plpgsql; + +select outer_outer_func(10); +-- repeated call should to work +select outer_outer_func(20); + +drop function outer_outer_func(int); +drop function outer_func(int); +drop function inner_func(int); + +-- access to call stack from exception +create function inner_func(int) +returns int as $$ +declare + _context text; + sx int := 5; +begin + begin + perform sx / 0; + exception + when division_by_zero then + get diagnostics _context = pg_context; + raise notice '***%***', _context; + end; + + -- lets do it again, just for fun.. + get diagnostics _context = pg_context; + raise notice '***%***', _context; + raise notice 'lets make sure we didnt break anything'; + return 2 * $1; +end; +$$ language plpgsql; + +create or replace function outer_func(int) +returns int as $$ +declare + myresult int; +begin + raise notice 'calling down into inner_func()'; + myresult := inner_func($1); + raise notice 'inner_func() done'; + return myresult; +end; +$$ language plpgsql; + +create or replace function outer_outer_func(int) +returns int as $$ +declare + myresult int; +begin + raise notice 'calling down into outer_func()'; + myresult := outer_func($1); + raise notice 'outer_func() done'; + return myresult; +end; +$$ language plpgsql; + +select outer_outer_func(10); +-- repeated call should to work +select outer_outer_func(20); + +drop function outer_outer_func(int); +drop function outer_func(int); +drop function inner_func(int); + +-- +-- Test ASSERT +-- + +do $$ +begin + assert 1=1; -- should succeed +end; +$$; + +do $$ +begin + assert 1=0; -- should fail +end; +$$; + +do $$ +begin + assert NULL; -- should fail +end; +$$; + +-- check controlling GUC +set plpgsql.check_asserts = off; +do $$ +begin + assert 1=0; -- won't be tested +end; +$$; +reset plpgsql.check_asserts; + +-- test custom message +do $$ +declare var text := 'some value'; +begin + assert 1=0, format('assertion failed, var = "%s"', var); +end; +$$; + +-- ensure assertions are not trapped by 'others' +do $$ +begin + assert 1=0, 'unhandled assertion'; +exception when others then + null; -- do nothing +end; +$$; + +-- Test use of plpgsql in a domain check constraint (cf. bug #14414) + +create function plpgsql_domain_check(val int) returns boolean as $$ +begin return val > 0; end +$$ language plpgsql immutable; + +create domain plpgsql_domain as integer check(plpgsql_domain_check(value)); + +do $$ +declare v_test plpgsql_domain; +begin + v_test := 1; +end; +$$; + +do $$ +declare v_test plpgsql_domain := 1; +begin + v_test := 0; -- fail +end; +$$; + +-- Test handling of expanded array passed to a domain constraint (bug #14472) + +create function plpgsql_arr_domain_check(val int[]) returns boolean as $$ +begin return val[1] > 0; end +$$ language plpgsql immutable; + +create domain plpgsql_arr_domain as int[] check(plpgsql_arr_domain_check(value)); + +do $$ +declare v_test plpgsql_arr_domain; +begin + v_test := array[1]; + v_test := v_test || 2; +end; +$$; + +do $$ +declare v_test plpgsql_arr_domain := array[1]; +begin + v_test := 0 || v_test; -- fail +end; +$$; + +-- +-- test usage of transition tables in AFTER triggers +-- + +CREATE TABLE transition_table_base (id int PRIMARY KEY, val text); + +CREATE FUNCTION transition_table_base_ins_func() + RETURNS trigger + LANGUAGE plpgsql +AS $$ +DECLARE + t text; + l text; +BEGIN + t = ''; + FOR l IN EXECUTE + $q$ + EXPLAIN (TIMING off, COSTS off, VERBOSE on) + SELECT * FROM newtable + $q$ LOOP + t = t || l || E'\n'; + END LOOP; + + RAISE INFO '%', t; + RETURN new; +END; +$$; + +CREATE TRIGGER transition_table_base_ins_trig + AFTER INSERT ON transition_table_base + REFERENCING OLD TABLE AS oldtable NEW TABLE AS newtable + FOR EACH STATEMENT + EXECUTE PROCEDURE transition_table_base_ins_func(); + +CREATE TRIGGER transition_table_base_ins_trig + AFTER INSERT ON transition_table_base + REFERENCING NEW TABLE AS newtable + FOR EACH STATEMENT + EXECUTE PROCEDURE transition_table_base_ins_func(); + +INSERT INTO transition_table_base VALUES (1, 'One'), (2, 'Two'); +INSERT INTO transition_table_base VALUES (3, 'Three'), (4, 'Four'); + +CREATE OR REPLACE FUNCTION transition_table_base_upd_func() + RETURNS trigger + LANGUAGE plpgsql +AS $$ +DECLARE + t text; + l text; +BEGIN + t = ''; + FOR l IN EXECUTE + $q$ + EXPLAIN (TIMING off, COSTS off, VERBOSE on) + SELECT * FROM oldtable ot FULL JOIN newtable nt USING (id) + $q$ LOOP + t = t || l || E'\n'; + END LOOP; + + RAISE INFO '%', t; + RETURN new; +END; +$$; + +CREATE TRIGGER transition_table_base_upd_trig + AFTER UPDATE ON transition_table_base + REFERENCING OLD TABLE AS oldtable NEW TABLE AS newtable + FOR EACH STATEMENT + EXECUTE PROCEDURE transition_table_base_upd_func(); + +UPDATE transition_table_base + SET val = '*' || val || '*' + WHERE id BETWEEN 2 AND 3; + +CREATE TABLE transition_table_level1 +( + level1_no serial NOT NULL , + level1_node_name varchar(255), + PRIMARY KEY (level1_no) +) WITHOUT OIDS; + +CREATE TABLE transition_table_level2 +( + level2_no serial NOT NULL , + parent_no int NOT NULL, + level1_node_name varchar(255), + PRIMARY KEY (level2_no) +) WITHOUT OIDS; + +CREATE TABLE transition_table_status +( + level int NOT NULL, + node_no int NOT NULL, + status int, + PRIMARY KEY (level, node_no) +) WITHOUT OIDS; + +CREATE FUNCTION transition_table_level1_ri_parent_del_func() + RETURNS TRIGGER + LANGUAGE plpgsql +AS $$ + DECLARE n bigint; + BEGIN + PERFORM FROM p JOIN transition_table_level2 c ON c.parent_no = p.level1_no; + IF FOUND THEN + RAISE EXCEPTION 'RI error'; + END IF; + RETURN NULL; + END; +$$; + +CREATE TRIGGER transition_table_level1_ri_parent_del_trigger + AFTER DELETE ON transition_table_level1 + REFERENCING OLD TABLE AS p + FOR EACH STATEMENT EXECUTE PROCEDURE + transition_table_level1_ri_parent_del_func(); + +CREATE FUNCTION transition_table_level1_ri_parent_upd_func() + RETURNS TRIGGER + LANGUAGE plpgsql +AS $$ + DECLARE + x int; + BEGIN + WITH p AS (SELECT level1_no, sum(delta) cnt + FROM (SELECT level1_no, 1 AS delta FROM i + UNION ALL + SELECT level1_no, -1 AS delta FROM d) w + GROUP BY level1_no + HAVING sum(delta) < 0) + SELECT level1_no + FROM p JOIN transition_table_level2 c ON c.parent_no = p.level1_no + INTO x; + IF FOUND THEN + RAISE EXCEPTION 'RI error'; + END IF; + RETURN NULL; + END; +$$; + +CREATE TRIGGER transition_table_level1_ri_parent_upd_trigger + AFTER UPDATE ON transition_table_level1 + REFERENCING OLD TABLE AS d NEW TABLE AS i + FOR EACH STATEMENT EXECUTE PROCEDURE + transition_table_level1_ri_parent_upd_func(); + +CREATE FUNCTION transition_table_level2_ri_child_insupd_func() + RETURNS TRIGGER + LANGUAGE plpgsql +AS $$ + BEGIN + PERFORM FROM i + LEFT JOIN transition_table_level1 p + ON p.level1_no IS NOT NULL AND p.level1_no = i.parent_no + WHERE p.level1_no IS NULL; + IF FOUND THEN + RAISE EXCEPTION 'RI error'; + END IF; + RETURN NULL; + END; +$$; + +CREATE TRIGGER transition_table_level2_ri_child_ins_trigger + AFTER INSERT ON transition_table_level2 + REFERENCING NEW TABLE AS i + FOR EACH STATEMENT EXECUTE PROCEDURE + transition_table_level2_ri_child_insupd_func(); + +CREATE TRIGGER transition_table_level2_ri_child_upd_trigger + AFTER UPDATE ON transition_table_level2 + REFERENCING NEW TABLE AS i + FOR EACH STATEMENT EXECUTE PROCEDURE + transition_table_level2_ri_child_insupd_func(); + +-- create initial test data +INSERT INTO transition_table_level1 (level1_no) + SELECT generate_series(1,200); +ANALYZE transition_table_level1; + +INSERT INTO transition_table_level2 (level2_no, parent_no) + SELECT level2_no, level2_no / 50 + 1 AS parent_no + FROM generate_series(1,9999) level2_no; +ANALYZE transition_table_level2; + +INSERT INTO transition_table_status (level, node_no, status) + SELECT 1, level1_no, 0 FROM transition_table_level1; + +INSERT INTO transition_table_status (level, node_no, status) + SELECT 2, level2_no, 0 FROM transition_table_level2; +ANALYZE transition_table_status; + +INSERT INTO transition_table_level1(level1_no) + SELECT generate_series(201,1000); +ANALYZE transition_table_level1; + +-- behave reasonably if someone tries to modify a transition table +CREATE FUNCTION transition_table_level2_bad_usage_func() + RETURNS TRIGGER + LANGUAGE plpgsql +AS $$ + BEGIN + INSERT INTO dx VALUES (1000000, 1000000, 'x'); + RETURN NULL; + END; +$$; + +CREATE TRIGGER transition_table_level2_bad_usage_trigger + AFTER DELETE ON transition_table_level2 + REFERENCING OLD TABLE AS dx + FOR EACH STATEMENT EXECUTE PROCEDURE + transition_table_level2_bad_usage_func(); + +DELETE FROM transition_table_level2 + WHERE level2_no BETWEEN 301 AND 305; + +DROP TRIGGER transition_table_level2_bad_usage_trigger + ON transition_table_level2; + +-- attempt modifications which would break RI (should all fail) +DELETE FROM transition_table_level1 + WHERE level1_no = 25; + +UPDATE transition_table_level1 SET level1_no = -1 + WHERE level1_no = 30; + +INSERT INTO transition_table_level2 (level2_no, parent_no) + VALUES (10000, 10000); + +UPDATE transition_table_level2 SET parent_no = 2000 + WHERE level2_no = 40; + + +-- attempt modifications which would not break RI (should all succeed) +DELETE FROM transition_table_level1 + WHERE level1_no BETWEEN 201 AND 1000; + +DELETE FROM transition_table_level1 + WHERE level1_no BETWEEN 100000000 AND 100000010; + +SELECT count(*) FROM transition_table_level1; + +DELETE FROM transition_table_level2 + WHERE level2_no BETWEEN 211 AND 220; + +SELECT count(*) FROM transition_table_level2; + +CREATE TABLE alter_table_under_transition_tables +( + id int PRIMARY KEY, + name text +); + +CREATE FUNCTION alter_table_under_transition_tables_upd_func() + RETURNS TRIGGER + LANGUAGE plpgsql +AS $$ +BEGIN + RAISE WARNING 'old table = %, new table = %', + (SELECT string_agg(id || '=' || name, ',') FROM d), + (SELECT string_agg(id || '=' || name, ',') FROM i); + RAISE NOTICE 'one = %', (SELECT 1 FROM alter_table_under_transition_tables LIMIT 1); + RETURN NULL; +END; +$$; + +-- should fail, TRUNCATE is not compatible with transition tables +CREATE TRIGGER alter_table_under_transition_tables_upd_trigger + AFTER TRUNCATE OR UPDATE ON alter_table_under_transition_tables + REFERENCING OLD TABLE AS d NEW TABLE AS i + FOR EACH STATEMENT EXECUTE PROCEDURE + alter_table_under_transition_tables_upd_func(); + +-- should work +CREATE TRIGGER alter_table_under_transition_tables_upd_trigger + AFTER UPDATE ON alter_table_under_transition_tables + REFERENCING OLD TABLE AS d NEW TABLE AS i + FOR EACH STATEMENT EXECUTE PROCEDURE + alter_table_under_transition_tables_upd_func(); + +INSERT INTO alter_table_under_transition_tables + VALUES (1, '1'), (2, '2'), (3, '3'); +UPDATE alter_table_under_transition_tables + SET name = name || name; + +-- now change 'name' to an integer to see what happens... +ALTER TABLE alter_table_under_transition_tables + ALTER COLUMN name TYPE int USING name::integer; +UPDATE alter_table_under_transition_tables + SET name = (name::text || name::text)::integer; + +-- now drop column 'name' +ALTER TABLE alter_table_under_transition_tables + DROP column name; +UPDATE alter_table_under_transition_tables + SET id = id; + +-- +-- Test multiple reference to a transition table +-- + +CREATE TABLE multi_test (i int); +INSERT INTO multi_test VALUES (1); + +CREATE OR REPLACE FUNCTION multi_test_trig() RETURNS trigger +LANGUAGE plpgsql AS $$ +BEGIN + RAISE NOTICE 'count = %', (SELECT COUNT(*) FROM new_test); + RAISE NOTICE 'count union = %', + (SELECT COUNT(*) + FROM (SELECT * FROM new_test UNION ALL SELECT * FROM new_test) ss); + RETURN NULL; +END$$; + +CREATE TRIGGER my_trigger AFTER UPDATE ON multi_test + REFERENCING NEW TABLE AS new_test OLD TABLE as old_test + FOR EACH STATEMENT EXECUTE PROCEDURE multi_test_trig(); + +UPDATE multi_test SET i = i; + +DROP TABLE multi_test; +DROP FUNCTION multi_test_trig(); + +-- +-- Check type parsing and record fetching from partitioned tables +-- + +CREATE TABLE partitioned_table (a int, b text) PARTITION BY LIST (a); +CREATE TABLE pt_part1 PARTITION OF partitioned_table FOR VALUES IN (1); +CREATE TABLE pt_part2 PARTITION OF partitioned_table FOR VALUES IN (2); + +INSERT INTO partitioned_table VALUES (1, 'Row 1'); +INSERT INTO partitioned_table VALUES (2, 'Row 2'); + +CREATE OR REPLACE FUNCTION get_from_partitioned_table(partitioned_table.a%type) +RETURNS partitioned_table AS $$ +DECLARE + a_val partitioned_table.a%TYPE; + result partitioned_table%ROWTYPE; +BEGIN + a_val := $1; + SELECT * INTO result FROM partitioned_table WHERE a = a_val; + RETURN result; +END; $$ LANGUAGE plpgsql; + +SELECT * FROM get_from_partitioned_table(1) AS t; + +CREATE OR REPLACE FUNCTION list_partitioned_table() +RETURNS SETOF partitioned_table.a%TYPE AS $$ +DECLARE + row partitioned_table%ROWTYPE; + a_val partitioned_table.a%TYPE; +BEGIN + FOR row IN SELECT * FROM partitioned_table ORDER BY a LOOP + a_val := row.a; + RETURN NEXT a_val; + END LOOP; + RETURN; +END; $$ LANGUAGE plpgsql; + +SELECT * FROM list_partitioned_table() AS t; + +-- +-- Check argument name is used instead of $n in error message +-- +CREATE FUNCTION fx(x WSlot) RETURNS void AS $$ +BEGIN + GET DIAGNOSTICS x = ROW_COUNT; + RETURN; +END; $$ LANGUAGE plpgsql; +create function tg_pslot_biu() returns trigger as $proc$ +declare + pfrec record; + ps alias for new; +begin + select into pfrec * from PField where name = ps.pfname; + if not found then + raise exception $$Patchfield "%" does not exist$$, ps.pfname; + end if; + return ps; +end; +$proc$ language plpgsql; + +-- Check handling of errors thrown from/into anonymous code blocks. +do $outer$ +begin + for i in 1..10 loop + begin + execute $ex$ + do $$ + declare x int = 0; + begin + x := 1 / x; + end; + $$; + $ex$; + exception when division_by_zero then + raise notice 'caught division by zero'; + end; + end loop; +end; +$outer$; + +set plpgsql.variable_conflict = error; diff --git a/postgresql/examples/point.sql b/postgresql/examples/point.sql new file mode 100644 index 0000000..d3737e5 --- /dev/null +++ b/postgresql/examples/point.sql @@ -0,0 +1,117 @@ +-- +-- POINT +-- + +-- avoid bit-exact output here because operations may not be bit-exact. +SET extra_float_digits = 0; + +CREATE TABLE POINT_TBL(f1 point); + +INSERT INTO POINT_TBL(f1) VALUES ('(0.0,0.0)'); + +INSERT INTO POINT_TBL(f1) VALUES ('(-10.0,0.0)'); + +INSERT INTO POINT_TBL(f1) VALUES ('(-3.0,4.0)'); + +INSERT INTO POINT_TBL(f1) VALUES ('(5.1, 34.5)'); + +INSERT INTO POINT_TBL(f1) VALUES ('(-5.0,-12.0)'); + +INSERT INTO POINT_TBL(f1) VALUES ('(1e-300,-1e-300)'); -- To underflow + +INSERT INTO POINT_TBL(f1) VALUES ('(1e+300,Inf)'); -- To overflow + +INSERT INTO POINT_TBL(f1) VALUES (' ( Nan , NaN ) '); + +-- bad format points +INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf'); + +INSERT INTO POINT_TBL(f1) VALUES ('10.0,10.0'); + +INSERT INTO POINT_TBL(f1) VALUES ('(10.0 10.0)'); + +INSERT INTO POINT_TBL(f1) VALUES ('(10.0, 10.0) x'); + +INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0'); + +INSERT INTO POINT_TBL(f1) VALUES ('(10.0, 1e+500)'); -- Out of range + + +SELECT '' AS six, * FROM POINT_TBL; + + +-- above +SELECT '' AS one, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >^ p.f1; + +-- below +SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 <^ '(0.0, 0.0)'; + +-- equal +SELECT '' AS one, p.* FROM POINT_TBL p WHERE p.f1 ~= '(5.1, 34.5)'; + +-- point in box +SELECT '' AS three, p.* FROM POINT_TBL p + WHERE p.f1 <@ box '(0,0,100,100)'; + +SELECT '' AS three, p.* FROM POINT_TBL p + WHERE box '(0,0,100,100)' @> p.f1; + +SELECT '' AS three, p.* FROM POINT_TBL p + WHERE not p.f1 <@ box '(0,0,100,100)'; + +SELECT '' AS two, p.* FROM POINT_TBL p + WHERE p.f1 <@ path '[(0,0),(-10,0),(-10,10)]'; + +SELECT '' AS three, p.* FROM POINT_TBL p + WHERE not box '(0,0,100,100)' @> p.f1; + +SELECT '' AS six, p.f1, p.f1 <-> point '(0,0)' AS dist + FROM POINT_TBL p + ORDER BY dist; + +SELECT '' AS thirtysix, p1.f1 AS point1, p2.f1 AS point2, p1.f1 <-> p2.f1 AS dist + FROM POINT_TBL p1, POINT_TBL p2 + ORDER BY dist, p1.f1[0], p2.f1[0]; + +SELECT '' AS thirty, p1.f1 AS point1, p2.f1 AS point2 + FROM POINT_TBL p1, POINT_TBL p2 + WHERE (p1.f1 <-> p2.f1) > 3; + + +-- Test that GiST indexes provide same behavior as sequential scan +CREATE TEMP TABLE point_gist_tbl(f1 point); +INSERT INTO point_gist_tbl SELECT '(0,0)' FROM generate_series(0,1000); +CREATE INDEX point_gist_tbl_index ON point_gist_tbl USING gist (f1); +INSERT INTO point_gist_tbl VALUES ('(0.0000009,0.0000009)'); +SET enable_seqscan TO true; +SET enable_indexscan TO false; +SET enable_bitmapscan TO false; +SELECT COUNT(*) FROM point_gist_tbl WHERE f1 ~= '(0.0000009,0.0000009)'::point; +SELECT COUNT(*) FROM point_gist_tbl WHERE f1 <@ '(0.0000009,0.0000009),(0.0000009,0.0000009)'::box; +SELECT COUNT(*) FROM point_gist_tbl WHERE f1 ~= '(0.0000018,0.0000018)'::point; +SET enable_seqscan TO false; +SET enable_indexscan TO true; +SET enable_bitmapscan TO true; +SELECT COUNT(*) FROM point_gist_tbl WHERE f1 ~= '(0.0000009,0.0000009)'::point; +SELECT COUNT(*) FROM point_gist_tbl WHERE f1 <@ '(0.0000009,0.0000009),(0.0000009,0.0000009)'::box; +SELECT COUNT(*) FROM point_gist_tbl WHERE f1 ~= '(0.0000018,0.0000018)'::point; +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; +-- left of +SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)'; + +-- right of +SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1; + +-- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10 +SELECT '' AS fifteen, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance + FROM POINT_TBL p1, POINT_TBL p2 + WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 + ORDER BY distance, p1.f1[0], p2.f1[0]; + +-- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10 +SELECT '' AS three, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance + FROM POINT_TBL p1, POINT_TBL p2 + WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 >^ p2.f1 + ORDER BY distance; diff --git a/postgresql/examples/polygon.sql b/postgresql/examples/polygon.sql new file mode 100644 index 0000000..7494f24 --- /dev/null +++ b/postgresql/examples/polygon.sql @@ -0,0 +1,143 @@ +-- +-- POLYGON +-- +-- polygon logic +-- + +CREATE TABLE POLYGON_TBL(f1 polygon); + + +INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,0.0),(2.0,4.0),(0.0,0.0)'); + +INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)'); + +INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(3,4),(5,6),(7,8)'); +INSERT INTO POLYGON_TBL(f1) VALUES ('(7,8),(5,6),(3,4),(1,2)'); -- Reverse +INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(7,8),(5,6),(3,-4)'); + +-- degenerate polygons +INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)'); + +INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)'); + +-- bad polygon input strings +INSERT INTO POLYGON_TBL(f1) VALUES ('0.0'); + +INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0'); + +INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)'); + +INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3'); + +INSERT INTO POLYGON_TBL(f1) VALUES ('asdf'); + + +SELECT '' AS four, * FROM POLYGON_TBL; + +-- +-- Test the SP-GiST index +-- + +CREATE TABLE quad_poly_tbl (id int, p polygon); + +INSERT INTO quad_poly_tbl + SELECT (x - 1) * 100 + y, polygon(circle(point(x * 10, y * 10), 1 + (x + y) % 10)) + FROM generate_series(1, 100) x, + generate_series(1, 100) y; + +INSERT INTO quad_poly_tbl + SELECT i, polygon '((200, 300),(210, 310),(230, 290))' + FROM generate_series(10001, 11000) AS i; + +INSERT INTO quad_poly_tbl + VALUES + (11001, NULL), + (11002, NULL), + (11003, NULL); + +CREATE INDEX quad_poly_tbl_idx ON quad_poly_tbl USING spgist(p); + +-- get reference results for ORDER BY distance from seq scan +SET enable_seqscan = ON; +SET enable_indexscan = OFF; +SET enable_bitmapscan = OFF; + +CREATE TEMP TABLE quad_poly_tbl_ord_seq2 AS +SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id +FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))'; + +-- check results from index scan +SET enable_seqscan = OFF; +SET enable_indexscan = OFF; +SET enable_bitmapscan = ON; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p &< polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p &< polygon '((300,300),(400,600),(600,500),(700,200))'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p && polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p && polygon '((300,300),(400,600),(600,500),(700,200))'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p &> polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p &> polygon '((300,300),(400,600),(600,500),(700,200))'; + + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p <<| polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p <<| polygon '((300,300),(400,600),(600,500),(700,200))'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p &<| polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p &<| polygon '((300,300),(400,600),(600,500),(700,200))'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p |&> polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p |&> polygon '((300,300),(400,600),(600,500),(700,200))'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p |>> polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p |>> polygon '((300,300),(400,600),(600,500),(700,200))'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p @> polygon '((340,550),(343,552),(341,553))'; +SELECT count(*) FROM quad_poly_tbl WHERE p @> polygon '((340,550),(343,552),(341,553))'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p ~= polygon '((200, 300),(210, 310),(230, 290))'; +SELECT count(*) FROM quad_poly_tbl WHERE p ~= polygon '((200, 300),(210, 310),(230, 290))'; + +-- test ORDER BY distance +SET enable_indexscan = ON; +SET enable_bitmapscan = OFF; + +EXPLAIN (COSTS OFF) +SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id +FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))'; + +CREATE TEMP TABLE quad_poly_tbl_ord_idx2 AS +SELECT rank() OVER (ORDER BY p <-> point '123,456') n, p <-> point '123,456' dist, id +FROM quad_poly_tbl WHERE p <@ polygon '((300,300),(400,600),(600,500),(700,200))'; + +SELECT * +FROM quad_poly_tbl_ord_seq2 seq FULL JOIN quad_poly_tbl_ord_idx2 idx + ON seq.n = idx.n AND seq.id = idx.id AND + (seq.dist = idx.dist OR seq.dist IS NULL AND idx.dist IS NULL) +WHERE seq.id IS NULL OR idx.id IS NULL; + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p << polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p << polygon '((300,300),(400,600),(600,500),(700,200))'; + + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM quad_poly_tbl WHERE p >> polygon '((300,300),(400,600),(600,500),(700,200))'; +SELECT count(*) FROM quad_poly_tbl WHERE p >> polygon '((300,300),(400,600),(600,500),(700,200))'; diff --git a/postgresql/examples/polymorphism.sql b/postgresql/examples/polymorphism.sql new file mode 100644 index 0000000..7d690db --- /dev/null +++ b/postgresql/examples/polymorphism.sql @@ -0,0 +1,1035 @@ +-- +-- Tests for polymorphic SQL functions and aggregates based on them. +-- Tests for other features related to function-calling have snuck in, too. +-- + +create function polyf(x anyelement) returns anyelement as $$ + select x + 1 +$$ language sql; + +select polyf(42) as int, polyf(4.5) as num; +select polyf(point(3,4)); -- fail for lack of + operator + +drop function polyf(x anyelement); + +create function polyf(x anyelement) returns anyarray as $$ + select array[x + 1, x + 2] +$$ language sql; + +select polyf(42) as int, polyf(4.5) as num; + +drop function polyf(x anyelement); + +create function polyf(x anyarray) returns anyelement as $$ + select x[1] +$$ language sql; + +select polyf(array[2,4]) as int, polyf(array[4.5, 7.7]) as num; + +select polyf(stavalues1) from pg_statistic; -- fail, can't infer element type + +drop function polyf(x anyarray); + +create function polyf(x anyarray) returns anyarray as $$ + select x +$$ language sql; + +select polyf(array[2,4]) as int, polyf(array[4.5, 7.7]) as num; + +select polyf(stavalues1) from pg_statistic; -- fail, can't infer element type + +drop function polyf(x anyarray); + +-- fail, can't infer type: +create function polyf(x anyelement) returns anyrange as $$ + select array[x + 1, x + 2] +$$ language sql; + +create function polyf(x anyrange) returns anyarray as $$ + select array[lower(x), upper(x)] +$$ language sql; + +select polyf(int4range(42, 49)) as int, polyf(float8range(4.5, 7.8)) as num; + +drop function polyf(x anyrange); + +create function polyf(x anycompatible, y anycompatible) returns anycompatiblearray as $$ + select array[x, y] +$$ language sql; + +select polyf(2, 4) as int, polyf(2, 4.5) as num; + +drop function polyf(x anycompatible, y anycompatible); + +create function polyf(x anycompatiblerange, y anycompatible, z anycompatible) returns anycompatiblearray as $$ + select array[lower(x), upper(x), y, z] +$$ language sql; + +select polyf(int4range(42, 49), 11, 2::smallint) as int, polyf(float8range(4.5, 7.8), 7.8, 11::real) as num; + +select polyf(int4range(42, 49), 11, 4.5) as fail; -- range type doesn't fit + +drop function polyf(x anycompatiblerange, y anycompatible, z anycompatible); + +-- fail, can't infer type: +create function polyf(x anycompatible) returns anycompatiblerange as $$ + select array[x + 1, x + 2] +$$ language sql; + +create function polyf(x anycompatiblerange, y anycompatiblearray) returns anycompatiblerange as $$ + select x +$$ language sql; + +select polyf(int4range(42, 49), array[11]) as int, polyf(float8range(4.5, 7.8), array[7]) as num; + +drop function polyf(x anycompatiblerange, y anycompatiblearray); + +create function polyf(a anyelement, b anyarray, + c anycompatible, d anycompatible, + OUT x anyarray, OUT y anycompatiblearray) +as $$ + select a || b, array[c, d] +$$ language sql; + +select x, pg_typeof(x), y, pg_typeof(y) + from polyf(11, array[1, 2], 42, 34.5); +select x, pg_typeof(x), y, pg_typeof(y) + from polyf(11, array[1, 2], point(1,2), point(3,4)); +select x, pg_typeof(x), y, pg_typeof(y) + from polyf(11, '{1,2}', point(1,2), '(3,4)'); +select x, pg_typeof(x), y, pg_typeof(y) + from polyf(11, array[1, 2.2], 42, 34.5); -- fail + +drop function polyf(a anyelement, b anyarray, + c anycompatible, d anycompatible); + + +-- +-- Polymorphic aggregate tests +-- +-- Legend: +----------- +-- A = type is ANY +-- P = type is polymorphic +-- N = type is non-polymorphic +-- B = aggregate base type +-- S = aggregate state type +-- R = aggregate return type +-- 1 = arg1 of a function +-- 2 = arg2 of a function +-- ag = aggregate +-- tf = trans (state) function +-- ff = final function +-- rt = return type of a function +-- -> = implies +-- => = allowed +-- !> = not allowed +-- E = exists +-- NE = not-exists +-- +-- Possible states: +-- ---------------- +-- B = (A || P || N) +-- when (B = A) -> (tf2 = NE) +-- S = (P || N) +-- ff = (E || NE) +-- tf1 = (P || N) +-- tf2 = (NE || P || N) +-- R = (P || N) + +-- create functions for use as tf and ff with the needed combinations of +-- argument polymorphism, but within the constraints of valid aggregate +-- functions, i.e. tf arg1 and tf return type must match + +-- polymorphic single arg transfn +CREATE FUNCTION stfp(anyarray) RETURNS anyarray AS +'select $1' LANGUAGE SQL; +-- non-polymorphic single arg transfn +CREATE FUNCTION stfnp(int[]) RETURNS int[] AS +'select $1' LANGUAGE SQL; + +-- dual polymorphic transfn +CREATE FUNCTION tfp(anyarray,anyelement) RETURNS anyarray AS +'select $1 || $2' LANGUAGE SQL; +-- dual non-polymorphic transfn +CREATE FUNCTION tfnp(int[],int) RETURNS int[] AS +'select $1 || $2' LANGUAGE SQL; + +-- arg1 only polymorphic transfn +CREATE FUNCTION tf1p(anyarray,int) RETURNS anyarray AS +'select $1' LANGUAGE SQL; +-- arg2 only polymorphic transfn +CREATE FUNCTION tf2p(int[],anyelement) RETURNS int[] AS +'select $1' LANGUAGE SQL; + +-- multi-arg polymorphic +CREATE FUNCTION sum3(anyelement,anyelement,anyelement) returns anyelement AS +'select $1+$2+$3' language sql strict; + +-- finalfn polymorphic +CREATE FUNCTION ffp(anyarray) RETURNS anyarray AS +'select $1' LANGUAGE SQL; +-- finalfn non-polymorphic +CREATE FUNCTION ffnp(int[]) returns int[] as +'select $1' LANGUAGE SQL; + +-- Try to cover all the possible states: +-- +-- Note: in Cases 1 & 2, we are trying to return P. Therefore, if the transfn +-- is stfnp, tfnp, or tf2p, we must use ffp as finalfn, because stfnp, tfnp, +-- and tf2p do not return P. Conversely, in Cases 3 & 4, we are trying to +-- return N. Therefore, if the transfn is stfp, tfp, or tf1p, we must use ffnp +-- as finalfn, because stfp, tfp, and tf1p do not return N. +-- +-- Case1 (R = P) && (B = A) +-- ------------------------ +-- S tf1 +-- ------- +-- N N +-- should CREATE +CREATE AGGREGATE myaggp01a(*) (SFUNC = stfnp, STYPE = int4[], + FINALFUNC = ffp, INITCOND = '{}'); + +-- P N +-- should ERROR: stfnp(anyarray) not matched by stfnp(int[]) +CREATE AGGREGATE myaggp02a(*) (SFUNC = stfnp, STYPE = anyarray, + FINALFUNC = ffp, INITCOND = '{}'); + +-- N P +-- should CREATE +CREATE AGGREGATE myaggp03a(*) (SFUNC = stfp, STYPE = int4[], + FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp03b(*) (SFUNC = stfp, STYPE = int4[], + INITCOND = '{}'); + +-- P P +-- should ERROR: we have no way to resolve S +CREATE AGGREGATE myaggp04a(*) (SFUNC = stfp, STYPE = anyarray, + FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp04b(*) (SFUNC = stfp, STYPE = anyarray, + INITCOND = '{}'); + + +-- Case2 (R = P) && ((B = P) || (B = N)) +-- ------------------------------------- +-- S tf1 B tf2 +-- ----------------------- +-- N N N N +-- should CREATE +CREATE AGGREGATE myaggp05a(BASETYPE = int, SFUNC = tfnp, STYPE = int[], + FINALFUNC = ffp, INITCOND = '{}'); + +-- N N N P +-- should CREATE +CREATE AGGREGATE myaggp06a(BASETYPE = int, SFUNC = tf2p, STYPE = int[], + FINALFUNC = ffp, INITCOND = '{}'); + +-- N N P N +-- should ERROR: tfnp(int[], anyelement) not matched by tfnp(int[], int) +CREATE AGGREGATE myaggp07a(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[], + FINALFUNC = ffp, INITCOND = '{}'); + +-- N N P P +-- should CREATE +CREATE AGGREGATE myaggp08a(BASETYPE = anyelement, SFUNC = tf2p, STYPE = int[], + FINALFUNC = ffp, INITCOND = '{}'); + +-- N P N N +-- should CREATE +CREATE AGGREGATE myaggp09a(BASETYPE = int, SFUNC = tf1p, STYPE = int[], + FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp09b(BASETYPE = int, SFUNC = tf1p, STYPE = int[], + INITCOND = '{}'); + +-- N P N P +-- should CREATE +CREATE AGGREGATE myaggp10a(BASETYPE = int, SFUNC = tfp, STYPE = int[], + FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp10b(BASETYPE = int, SFUNC = tfp, STYPE = int[], + INITCOND = '{}'); + +-- N P P N +-- should ERROR: tf1p(int[],anyelement) not matched by tf1p(anyarray,int) +CREATE AGGREGATE myaggp11a(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[], + FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp11b(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[], + INITCOND = '{}'); + +-- N P P P +-- should ERROR: tfp(int[],anyelement) not matched by tfp(anyarray,anyelement) +CREATE AGGREGATE myaggp12a(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[], + FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp12b(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[], + INITCOND = '{}'); + +-- P N N N +-- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int) +CREATE AGGREGATE myaggp13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray, + FINALFUNC = ffp, INITCOND = '{}'); + +-- P N N P +-- should ERROR: tf2p(anyarray, int) not matched by tf2p(int[],anyelement) +CREATE AGGREGATE myaggp14a(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray, + FINALFUNC = ffp, INITCOND = '{}'); + +-- P N P N +-- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int) +CREATE AGGREGATE myaggp15a(BASETYPE = anyelement, SFUNC = tfnp, + STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}'); + +-- P N P P +-- should ERROR: tf2p(anyarray, anyelement) not matched by tf2p(int[],anyelement) +CREATE AGGREGATE myaggp16a(BASETYPE = anyelement, SFUNC = tf2p, + STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}'); + +-- P P N N +-- should ERROR: we have no way to resolve S +CREATE AGGREGATE myaggp17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray, + FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp17b(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray, + INITCOND = '{}'); + +-- P P N P +-- should ERROR: tfp(anyarray, int) not matched by tfp(anyarray, anyelement) +CREATE AGGREGATE myaggp18a(BASETYPE = int, SFUNC = tfp, STYPE = anyarray, + FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp18b(BASETYPE = int, SFUNC = tfp, STYPE = anyarray, + INITCOND = '{}'); + +-- P P P N +-- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int) +CREATE AGGREGATE myaggp19a(BASETYPE = anyelement, SFUNC = tf1p, + STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp19b(BASETYPE = anyelement, SFUNC = tf1p, + STYPE = anyarray, INITCOND = '{}'); + +-- P P P P +-- should CREATE +CREATE AGGREGATE myaggp20a(BASETYPE = anyelement, SFUNC = tfp, + STYPE = anyarray, FINALFUNC = ffp, INITCOND = '{}'); +CREATE AGGREGATE myaggp20b(BASETYPE = anyelement, SFUNC = tfp, + STYPE = anyarray, INITCOND = '{}'); + +-- Case3 (R = N) && (B = A) +-- ------------------------ +-- S tf1 +-- ------- +-- N N +-- should CREATE +CREATE AGGREGATE myaggn01a(*) (SFUNC = stfnp, STYPE = int4[], + FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn01b(*) (SFUNC = stfnp, STYPE = int4[], + INITCOND = '{}'); + +-- P N +-- should ERROR: stfnp(anyarray) not matched by stfnp(int[]) +CREATE AGGREGATE myaggn02a(*) (SFUNC = stfnp, STYPE = anyarray, + FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn02b(*) (SFUNC = stfnp, STYPE = anyarray, + INITCOND = '{}'); + +-- N P +-- should CREATE +CREATE AGGREGATE myaggn03a(*) (SFUNC = stfp, STYPE = int4[], + FINALFUNC = ffnp, INITCOND = '{}'); + +-- P P +-- should ERROR: ffnp(anyarray) not matched by ffnp(int[]) +CREATE AGGREGATE myaggn04a(*) (SFUNC = stfp, STYPE = anyarray, + FINALFUNC = ffnp, INITCOND = '{}'); + + +-- Case4 (R = N) && ((B = P) || (B = N)) +-- ------------------------------------- +-- S tf1 B tf2 +-- ----------------------- +-- N N N N +-- should CREATE +CREATE AGGREGATE myaggn05a(BASETYPE = int, SFUNC = tfnp, STYPE = int[], + FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn05b(BASETYPE = int, SFUNC = tfnp, STYPE = int[], + INITCOND = '{}'); + +-- N N N P +-- should CREATE +CREATE AGGREGATE myaggn06a(BASETYPE = int, SFUNC = tf2p, STYPE = int[], + FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn06b(BASETYPE = int, SFUNC = tf2p, STYPE = int[], + INITCOND = '{}'); + +-- N N P N +-- should ERROR: tfnp(int[], anyelement) not matched by tfnp(int[], int) +CREATE AGGREGATE myaggn07a(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[], + FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn07b(BASETYPE = anyelement, SFUNC = tfnp, STYPE = int[], + INITCOND = '{}'); + +-- N N P P +-- should CREATE +CREATE AGGREGATE myaggn08a(BASETYPE = anyelement, SFUNC = tf2p, STYPE = int[], + FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn08b(BASETYPE = anyelement, SFUNC = tf2p, STYPE = int[], + INITCOND = '{}'); + +-- N P N N +-- should CREATE +CREATE AGGREGATE myaggn09a(BASETYPE = int, SFUNC = tf1p, STYPE = int[], + FINALFUNC = ffnp, INITCOND = '{}'); + +-- N P N P +-- should CREATE +CREATE AGGREGATE myaggn10a(BASETYPE = int, SFUNC = tfp, STYPE = int[], + FINALFUNC = ffnp, INITCOND = '{}'); + +-- N P P N +-- should ERROR: tf1p(int[],anyelement) not matched by tf1p(anyarray,int) +CREATE AGGREGATE myaggn11a(BASETYPE = anyelement, SFUNC = tf1p, STYPE = int[], + FINALFUNC = ffnp, INITCOND = '{}'); + +-- N P P P +-- should ERROR: tfp(int[],anyelement) not matched by tfp(anyarray,anyelement) +CREATE AGGREGATE myaggn12a(BASETYPE = anyelement, SFUNC = tfp, STYPE = int[], + FINALFUNC = ffnp, INITCOND = '{}'); + +-- P N N N +-- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int) +CREATE AGGREGATE myaggn13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray, + FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn13b(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray, + INITCOND = '{}'); + +-- P N N P +-- should ERROR: tf2p(anyarray, int) not matched by tf2p(int[],anyelement) +CREATE AGGREGATE myaggn14a(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray, + FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn14b(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray, + INITCOND = '{}'); + +-- P N P N +-- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int) +CREATE AGGREGATE myaggn15a(BASETYPE = anyelement, SFUNC = tfnp, + STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn15b(BASETYPE = anyelement, SFUNC = tfnp, + STYPE = anyarray, INITCOND = '{}'); + +-- P N P P +-- should ERROR: tf2p(anyarray, anyelement) not matched by tf2p(int[],anyelement) +CREATE AGGREGATE myaggn16a(BASETYPE = anyelement, SFUNC = tf2p, + STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}'); +CREATE AGGREGATE myaggn16b(BASETYPE = anyelement, SFUNC = tf2p, + STYPE = anyarray, INITCOND = '{}'); + +-- P P N N +-- should ERROR: ffnp(anyarray) not matched by ffnp(int[]) +CREATE AGGREGATE myaggn17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray, + FINALFUNC = ffnp, INITCOND = '{}'); + +-- P P N P +-- should ERROR: tfp(anyarray, int) not matched by tfp(anyarray, anyelement) +CREATE AGGREGATE myaggn18a(BASETYPE = int, SFUNC = tfp, STYPE = anyarray, + FINALFUNC = ffnp, INITCOND = '{}'); + +-- P P P N +-- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int) +CREATE AGGREGATE myaggn19a(BASETYPE = anyelement, SFUNC = tf1p, + STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}'); + +-- P P P P +-- should ERROR: ffnp(anyarray) not matched by ffnp(int[]) +CREATE AGGREGATE myaggn20a(BASETYPE = anyelement, SFUNC = tfp, + STYPE = anyarray, FINALFUNC = ffnp, INITCOND = '{}'); + +-- multi-arg polymorphic +CREATE AGGREGATE mysum2(anyelement,anyelement) (SFUNC = sum3, + STYPE = anyelement, INITCOND = '0'); + +-- create test data for polymorphic aggregates +create temp table t(f1 int, f2 int[], f3 text); +insert into t values(1,array[1],'a'); +insert into t values(1,array[11],'b'); +insert into t values(1,array[111],'c'); +insert into t values(2,array[2],'a'); +insert into t values(2,array[22],'b'); +insert into t values(2,array[222],'c'); +insert into t values(3,array[3],'a'); +insert into t values(3,array[3],'b'); + +-- test the successfully created polymorphic aggregates +select f3, myaggp01a(*) from t group by f3 order by f3; +select f3, myaggp03a(*) from t group by f3 order by f3; +select f3, myaggp03b(*) from t group by f3 order by f3; +select f3, myaggp05a(f1) from t group by f3 order by f3; +select f3, myaggp06a(f1) from t group by f3 order by f3; +select f3, myaggp08a(f1) from t group by f3 order by f3; +select f3, myaggp09a(f1) from t group by f3 order by f3; +select f3, myaggp09b(f1) from t group by f3 order by f3; +select f3, myaggp10a(f1) from t group by f3 order by f3; +select f3, myaggp10b(f1) from t group by f3 order by f3; +select f3, myaggp20a(f1) from t group by f3 order by f3; +select f3, myaggp20b(f1) from t group by f3 order by f3; +select f3, myaggn01a(*) from t group by f3 order by f3; +select f3, myaggn01b(*) from t group by f3 order by f3; +select f3, myaggn03a(*) from t group by f3 order by f3; +select f3, myaggn05a(f1) from t group by f3 order by f3; +select f3, myaggn05b(f1) from t group by f3 order by f3; +select f3, myaggn06a(f1) from t group by f3 order by f3; +select f3, myaggn06b(f1) from t group by f3 order by f3; +select f3, myaggn08a(f1) from t group by f3 order by f3; +select f3, myaggn08b(f1) from t group by f3 order by f3; +select f3, myaggn09a(f1) from t group by f3 order by f3; +select f3, myaggn10a(f1) from t group by f3 order by f3; +select mysum2(f1, f1 + 1) from t; + +-- test inlining of polymorphic SQL functions +create function bleat(int) returns int as $$ +begin + raise notice 'bleat %', $1; + return $1; +end$$ language plpgsql; + +create function sql_if(bool, anyelement, anyelement) returns anyelement as $$ +select case when $1 then $2 else $3 end $$ language sql; + +-- Note this would fail with integer overflow, never mind wrong bleat() output, +-- if the CASE expression were not successfully inlined +select f1, sql_if(f1 > 0, bleat(f1), bleat(f1 + 1)) from int4_tbl; + +select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl; + +-- another sort of polymorphic aggregate + +CREATE AGGREGATE array_cat_accum (anyarray) +( + sfunc = array_cat, + stype = anyarray, + initcond = '{}' +); + +SELECT array_cat_accum(i) +FROM (VALUES (ARRAY[1,2]), (ARRAY[3,4])) as t(i); + +SELECT array_cat_accum(i) +FROM (VALUES (ARRAY[row(1,2),row(3,4)]), (ARRAY[row(5,6),row(7,8)])) as t(i); + +-- another kind of polymorphic aggregate + +create function add_group(grp anyarray, ad anyelement, size integer) + returns anyarray + as $$ +begin + if grp is null then + return array[ad]; + end if; + if array_upper(grp, 1) < size then + return grp || ad; + end if; + return grp; +end; +$$ + language plpgsql immutable; + +create aggregate build_group(anyelement, integer) ( + SFUNC = add_group, + STYPE = anyarray +); + +select build_group(q1,3) from int8_tbl; + +-- this should fail because stype isn't compatible with arg +create aggregate build_group(int8, integer) ( + SFUNC = add_group, + STYPE = int2[] +); + +-- but we can make a non-poly agg from a poly sfunc if types are OK +create aggregate build_group(int8, integer) ( + SFUNC = add_group, + STYPE = int8[] +); + +-- check proper resolution of data types for polymorphic transfn/finalfn + +create function first_el(anyarray) returns anyelement as +'select $1[1]' language sql strict immutable; + +create aggregate first_el_agg_f8(float8) ( + SFUNC = array_append, + STYPE = float8[], + FINALFUNC = first_el +); + +create aggregate first_el_agg_any(anyelement) ( + SFUNC = array_append, + STYPE = anyarray, + FINALFUNC = first_el +); + +select first_el_agg_f8(x::float8) from generate_series(1,10) x; +select first_el_agg_any(x) from generate_series(1,10) x; +select first_el_agg_f8(x::float8) over(order by x) from generate_series(1,10) x; +select first_el_agg_any(x) over(order by x) from generate_series(1,10) x; + +-- check that we can apply functions taking ANYARRAY to pg_stats +select distinct array_ndims(histogram_bounds) from pg_stats +where histogram_bounds is not null; + +-- such functions must protect themselves if varying element type isn't OK +-- (WHERE clause here is to avoid possibly getting a collation error instead) +select max(histogram_bounds) from pg_stats where tablename = 'pg_am'; + +-- another corner case is the input functions for polymorphic pseudotypes +select array_in('{1,2,3}','int4'::regtype,-1); -- this has historically worked +select * from array_in('{1,2,3}','int4'::regtype,-1); -- this not +select anyrange_in('[10,20)','int4range'::regtype,-1); + +-- test variadic polymorphic functions + +create function myleast(variadic anyarray) returns anyelement as $$ + select min($1[i]) from generate_subscripts($1,1) g(i) +$$ language sql immutable strict; + +select myleast(10, 1, 20, 33); +select myleast(1.1, 0.22, 0.55); +select myleast('z'::text); +select myleast(); -- fail + +-- test with variadic call parameter +select myleast(variadic array[1,2,3,4,-1]); +select myleast(variadic array[1.1, -5.5]); + +--test with empty variadic call parameter +select myleast(variadic array[]::int[]); + +-- an example with some ordinary arguments too +create function concat(text, variadic anyarray) returns text as $$ + select array_to_string($2, $1); +$$ language sql immutable strict; + +select concat('%', 1, 2, 3, 4, 5); +select concat('|', 'a'::text, 'b', 'c'); +select concat('|', variadic array[1,2,33]); +select concat('|', variadic array[]::int[]); + +drop function concat(text, anyarray); + +-- mix variadic with anyelement +create function formarray(anyelement, variadic anyarray) returns anyarray as $$ + select array_prepend($1, $2); +$$ language sql immutable strict; + +select formarray(1,2,3,4,5); +select formarray(1.1, variadic array[1.2,55.5]); +select formarray(1.1, array[1.2,55.5]); -- fail without variadic +select formarray(1, 'x'::text); -- fail, type mismatch +select formarray(1, variadic array['x'::text]); -- fail, type mismatch + +drop function formarray(anyelement, variadic anyarray); + +-- test pg_typeof() function +select pg_typeof(null); -- unknown +select pg_typeof(0); -- integer +select pg_typeof(0.0); -- numeric +select pg_typeof(1+1 = 2); -- boolean +select pg_typeof('x'); -- unknown +select pg_typeof('' || ''); -- text +select pg_typeof(pg_typeof(0)); -- regtype +select pg_typeof(array[1.2,55.5]); -- numeric[] +select pg_typeof(myleast(10, 1, 20, 33)); -- polymorphic input + +-- test functions with default parameters + +-- test basic functionality +create function dfunc(a int = 1, int = 2) returns int as $$ + select $1 + $2; +$$ language sql; + +select dfunc(); +select dfunc(10); +select dfunc(10, 20); +select dfunc(10, 20, 30); -- fail + +drop function dfunc(); -- fail +drop function dfunc(int); -- fail +drop function dfunc(int, int); -- ok + +-- fail: defaults must be at end of argument list +create function dfunc(a int = 1, b int) returns int as $$ + select $1 + $2; +$$ language sql; + +-- however, this should work: +create function dfunc(a int = 1, out sum int, b int = 2) as $$ + select $1 + $2; +$$ language sql; + +select dfunc(); + +-- verify it lists properly +\df dfunc + +drop function dfunc(int, int); + +-- check implicit coercion +create function dfunc(a int DEFAULT 1.0, int DEFAULT '-1') returns int as $$ + select $1 + $2; +$$ language sql; +select dfunc(); + +create function dfunc(a text DEFAULT 'Hello', b text DEFAULT 'World') returns text as $$ + select $1 || ', ' || $2; +$$ language sql; + +select dfunc(); -- fail: which dfunc should be called? int or text +select dfunc('Hi'); -- ok +select dfunc('Hi', 'City'); -- ok +select dfunc(0); -- ok +select dfunc(10, 20); -- ok + +drop function dfunc(int, int); +drop function dfunc(text, text); + +create function dfunc(int = 1, int = 2) returns int as $$ + select 2; +$$ language sql; + +create function dfunc(int = 1, int = 2, int = 3, int = 4) returns int as $$ + select 4; +$$ language sql; + +-- Now, dfunc(nargs = 2) and dfunc(nargs = 4) are ambiguous when called +-- with 0 to 2 arguments. + +select dfunc(); -- fail +select dfunc(1); -- fail +select dfunc(1, 2); -- fail +select dfunc(1, 2, 3); -- ok +select dfunc(1, 2, 3, 4); -- ok + +drop function dfunc(int, int); +drop function dfunc(int, int, int, int); + +-- default values are not allowed for output parameters +create function dfunc(out int = 20) returns int as $$ + select 1; +$$ language sql; + +-- polymorphic parameter test +create function dfunc(anyelement = 'World'::text) returns text as $$ + select 'Hello, ' || $1::text; +$$ language sql; + +select dfunc(); +select dfunc(0); +select dfunc(to_date('20081215','YYYYMMDD')); +select dfunc('City'::text); + +drop function dfunc(anyelement); + +-- check defaults for variadics + +create function dfunc(a variadic int[]) returns int as +$$ select array_upper($1, 1) $$ language sql; + +select dfunc(); -- fail +select dfunc(10); +select dfunc(10,20); + +create or replace function dfunc(a variadic int[] default array[]::int[]) returns int as +$$ select array_upper($1, 1) $$ language sql; + +select dfunc(); -- now ok +select dfunc(10); +select dfunc(10,20); + +-- can't remove the default once it exists +create or replace function dfunc(a variadic int[]) returns int as +$$ select array_upper($1, 1) $$ language sql; + +\df dfunc + +drop function dfunc(a variadic int[]); + +-- Ambiguity should be reported only if there's not a better match available + +create function dfunc(int = 1, int = 2, int = 3) returns int as $$ + select 3; +$$ language sql; + +create function dfunc(int = 1, int = 2) returns int as $$ + select 2; +$$ language sql; + +create function dfunc(text) returns text as $$ + select $1; +$$ language sql; + +-- dfunc(narg=2) and dfunc(narg=3) are ambiguous +select dfunc(1); -- fail + +-- but this works since the ambiguous functions aren't preferred anyway +select dfunc('Hi'); + +drop function dfunc(int, int, int); +drop function dfunc(int, int); +drop function dfunc(text); + +-- +-- Tests for named- and mixed-notation function calling +-- + +create function dfunc(a int, b int, c int = 0, d int = 0) + returns table (a int, b int, c int, d int) as $$ + select $1, $2, $3, $4; +$$ language sql; + +select (dfunc(10,20,30)).*; +select (dfunc(a := 10, b := 20, c := 30)).*; +select * from dfunc(a := 10, b := 20); +select * from dfunc(b := 10, a := 20); +select * from dfunc(0); -- fail +select * from dfunc(1,2); +select * from dfunc(1,2,c := 3); +select * from dfunc(1,2,d := 3); + +select * from dfunc(x := 20, b := 10, x := 30); -- fail, duplicate name +select * from dfunc(10, b := 20, 30); -- fail, named args must be last +select * from dfunc(x := 10, b := 20, c := 30); -- fail, unknown param +select * from dfunc(10, 10, a := 20); -- fail, a overlaps positional parameter +select * from dfunc(1,c := 2,d := 3); -- fail, no value for b + +drop function dfunc(int, int, int, int); + +-- test with different parameter types +create function dfunc(a varchar, b numeric, c date = current_date) + returns table (a varchar, b numeric, c date) as $$ + select $1, $2, $3; +$$ language sql; + +select (dfunc('Hello World', 20, '2009-07-25'::date)).*; +select * from dfunc('Hello World', 20, '2009-07-25'::date); +select * from dfunc(c := '2009-07-25'::date, a := 'Hello World', b := 20); +select * from dfunc('Hello World', b := 20, c := '2009-07-25'::date); +select * from dfunc('Hello World', c := '2009-07-25'::date, b := 20); +select * from dfunc('Hello World', c := 20, b := '2009-07-25'::date); -- fail + +drop function dfunc(varchar, numeric, date); + +-- test out parameters with named params +create function dfunc(a varchar = 'def a', out _a varchar, c numeric = NULL, out _c numeric) +returns record as $$ + select $1, $2; +$$ language sql; + +select (dfunc()).*; +select * from dfunc(); +select * from dfunc('Hello', 100); +select * from dfunc(a := 'Hello', c := 100); +select * from dfunc(c := 100, a := 'Hello'); +select * from dfunc('Hello'); +select * from dfunc('Hello', c := 100); +select * from dfunc(c := 100); + +-- fail, can no longer change an input parameter's name +create or replace function dfunc(a varchar = 'def a', out _a varchar, x numeric = NULL, out _c numeric) +returns record as $$ + select $1, $2; +$$ language sql; + +create or replace function dfunc(a varchar = 'def a', out _a varchar, numeric = NULL, out _c numeric) +returns record as $$ + select $1, $2; +$$ language sql; + +drop function dfunc(varchar, numeric); + +--fail, named parameters are not unique +create function testpolym(a int, a int) returns int as $$ select 1;$$ language sql; +create function testpolym(int, out a int, out a int) returns int as $$ select 1;$$ language sql; +create function testpolym(out a int, inout a int) returns int as $$ select 1;$$ language sql; +create function testpolym(a int, inout a int) returns int as $$ select 1;$$ language sql; + +-- valid +create function testpolym(a int, out a int) returns int as $$ select $1;$$ language sql; +select testpolym(37); +drop function testpolym(int); +create function testpolym(a int) returns table(a int) as $$ select $1;$$ language sql; +select * from testpolym(37); +drop function testpolym(int); + +-- test polymorphic params and defaults +create function dfunc(a anyelement, b anyelement = null, flag bool = true) +returns anyelement as $$ + select case when $3 then $1 else $2 end; +$$ language sql; + +select dfunc(1,2); +select dfunc('a'::text, 'b'); -- positional notation with default + +select dfunc(a := 1, b := 2); +select dfunc(a := 'a'::text, b := 'b'); +select dfunc(a := 'a'::text, b := 'b', flag := false); -- named notation + +select dfunc(b := 'b'::text, a := 'a'); -- named notation with default +select dfunc(a := 'a'::text, flag := true); -- named notation with default +select dfunc(a := 'a'::text, flag := false); -- named notation with default +select dfunc(b := 'b'::text, a := 'a', flag := true); -- named notation + +select dfunc('a'::text, 'b', false); -- full positional notation +select dfunc('a'::text, 'b', flag := false); -- mixed notation +select dfunc('a'::text, 'b', true); -- full positional notation +select dfunc('a'::text, 'b', flag := true); -- mixed notation + +-- ansi/sql syntax +select dfunc(a => 1, b => 2); +select dfunc(a => 'a'::text, b => 'b'); +select dfunc(a => 'a'::text, b => 'b', flag => false); -- named notation + +select dfunc(b => 'b'::text, a => 'a'); -- named notation with default +select dfunc(a => 'a'::text, flag => true); -- named notation with default +select dfunc(a => 'a'::text, flag => false); -- named notation with default +select dfunc(b => 'b'::text, a => 'a', flag => true); -- named notation + +select dfunc('a'::text, 'b', false); -- full positional notation +select dfunc('a'::text, 'b', flag => false); -- mixed notation +select dfunc('a'::text, 'b', true); -- full positional notation +select dfunc('a'::text, 'b', flag => true); -- mixed notation + +-- this tests lexer edge cases around => +select dfunc(a =>-1); +select dfunc(a =>+1); +select dfunc(a =>/**/1); +-- need DO to protect the -- from psql +do $$ + declare r integer; + begin + select dfunc(a=>-- comment + 1) into r; + raise info 'r = %', r; + end; +$$; + +-- check reverse-listing of named-arg calls +CREATE VIEW dfview AS + SELECT q1, q2, + dfunc(q1,q2, flag := q1>q2) as c3, + dfunc(q1, flag := q1--comment to be removed by psql + 1); + diff --git a/postgresql/examples/portals.sql b/postgresql/examples/portals.sql new file mode 100644 index 0000000..52560ac --- /dev/null +++ b/postgresql/examples/portals.sql @@ -0,0 +1,536 @@ +-- +-- Cursor regression tests +-- + +BEGIN; + +DECLARE foo1 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo2 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo3 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo4 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo5 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo6 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo7 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo8 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo9 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo10 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo11 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo12 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo13 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo14 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo15 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo16 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo17 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo18 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo19 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo20 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo21 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +DECLARE foo22 SCROLL CURSOR FOR SELECT * FROM tenk2; + +DECLARE foo23 SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +FETCH 1 in foo1; + +FETCH 2 in foo2; + +FETCH 3 in foo3; + +FETCH 4 in foo4; + +FETCH 5 in foo5; + +FETCH 6 in foo6; + +FETCH 7 in foo7; + +FETCH 8 in foo8; + +FETCH 9 in foo9; + +FETCH 10 in foo10; + +FETCH 11 in foo11; + +FETCH 12 in foo12; + +FETCH 13 in foo13; + +FETCH 14 in foo14; + +FETCH 15 in foo15; + +FETCH 16 in foo16; + +FETCH 17 in foo17; + +FETCH 18 in foo18; + +FETCH 19 in foo19; + +FETCH 20 in foo20; + +FETCH 21 in foo21; + +FETCH 22 in foo22; + +FETCH 23 in foo23; + +FETCH backward 1 in foo23; + +FETCH backward 2 in foo22; + +FETCH backward 3 in foo21; + +FETCH backward 4 in foo20; + +FETCH backward 5 in foo19; + +FETCH backward 6 in foo18; + +FETCH backward 7 in foo17; + +FETCH backward 8 in foo16; + +FETCH backward 9 in foo15; + +FETCH backward 10 in foo14; + +FETCH backward 11 in foo13; + +FETCH backward 12 in foo12; + +FETCH backward 13 in foo11; + +FETCH backward 14 in foo10; + +FETCH backward 15 in foo9; + +FETCH backward 16 in foo8; + +FETCH backward 17 in foo7; + +FETCH backward 18 in foo6; + +FETCH backward 19 in foo5; + +FETCH backward 20 in foo4; + +FETCH backward 21 in foo3; + +FETCH backward 22 in foo2; + +FETCH backward 23 in foo1; + +CLOSE foo1; + +CLOSE foo2; + +CLOSE foo3; + +CLOSE foo4; + +CLOSE foo5; + +CLOSE foo6; + +CLOSE foo7; + +CLOSE foo8; + +CLOSE foo9; + +CLOSE foo10; + +CLOSE foo11; + +CLOSE foo12; + +-- leave some cursors open, to test that auto-close works. + +-- record this in the system view as well (don't query the time field there +-- however) +SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors ORDER BY 1; + +END; + +SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; + +-- +-- NO SCROLL disallows backward fetching +-- + +BEGIN; + +DECLARE foo24 NO SCROLL CURSOR FOR SELECT * FROM tenk1 ORDER BY unique2; + +FETCH 1 FROM foo24; + +FETCH BACKWARD 1 FROM foo24; -- should fail + +END; + +-- +-- Cursors outside transaction blocks +-- + + +SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; + +BEGIN; + +DECLARE foo25 SCROLL CURSOR WITH HOLD FOR SELECT * FROM tenk2; + +FETCH FROM foo25; + +FETCH FROM foo25; + +COMMIT; + +FETCH FROM foo25; + +FETCH BACKWARD FROM foo25; + +FETCH ABSOLUTE -1 FROM foo25; + +SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; + +CLOSE foo25; + +-- +-- ROLLBACK should close holdable cursors +-- + +BEGIN; + +DECLARE foo26 CURSOR WITH HOLD FOR SELECT * FROM tenk1 ORDER BY unique2; + +ROLLBACK; + +-- should fail +FETCH FROM foo26; + +-- +-- Parameterized DECLARE needs to insert param values into the cursor portal +-- + +BEGIN; + +CREATE FUNCTION declares_cursor(text) + RETURNS void + AS 'DECLARE c CURSOR FOR SELECT stringu1 FROM tenk1 WHERE stringu1 LIKE $1;' + LANGUAGE SQL; + +SELECT declares_cursor('AB%'); + +FETCH ALL FROM c; + +ROLLBACK; + +-- +-- Test behavior of both volatile and stable functions inside a cursor; +-- in particular we want to see what happens during commit of a holdable +-- cursor +-- + +create temp table tt1(f1 int); + +create function count_tt1_v() returns int8 as +'select count(*) from tt1' language sql volatile; + +create function count_tt1_s() returns int8 as +'select count(*) from tt1' language sql stable; + +begin; + +insert into tt1 values(1); + +declare c1 cursor for select count_tt1_v(), count_tt1_s(); + +insert into tt1 values(2); + +fetch all from c1; + +rollback; + +begin; + +insert into tt1 values(1); + +declare c2 cursor with hold for select count_tt1_v(), count_tt1_s(); + +insert into tt1 values(2); + +commit; + +delete from tt1; + +fetch all from c2; + +drop function count_tt1_v(); +drop function count_tt1_s(); + + +-- Create a cursor with the BINARY option and check the pg_cursors view +BEGIN; +SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; +DECLARE bc BINARY CURSOR FOR SELECT * FROM tenk1; +SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors ORDER BY 1; +ROLLBACK; + +-- We should not see the portal that is created internally to +-- implement EXECUTE in pg_cursors +PREPARE cprep AS + SELECT name, statement, is_holdable, is_binary, is_scrollable FROM pg_cursors; +EXECUTE cprep; + +-- test CLOSE ALL; +SELECT name FROM pg_cursors ORDER BY 1; +CLOSE ALL; +SELECT name FROM pg_cursors ORDER BY 1; +BEGIN; +DECLARE foo1 CURSOR WITH HOLD FOR SELECT 1; +DECLARE foo2 CURSOR WITHOUT HOLD FOR SELECT 1; +SELECT name FROM pg_cursors ORDER BY 1; +CLOSE ALL; +SELECT name FROM pg_cursors ORDER BY 1; +COMMIT; + +-- +-- Tests for updatable cursors +-- + +CREATE TEMP TABLE uctest(f1 int, f2 text); +INSERT INTO uctest VALUES (1, 'one'), (2, 'two'), (3, 'three'); +SELECT * FROM uctest; + +-- Check DELETE WHERE CURRENT +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest; +FETCH 2 FROM c1; +DELETE FROM uctest WHERE CURRENT OF c1; +-- should show deletion +SELECT * FROM uctest; +-- cursor did not move +FETCH ALL FROM c1; +-- cursor is insensitive +MOVE BACKWARD ALL IN c1; +FETCH ALL FROM c1; +COMMIT; +-- should still see deletion +SELECT * FROM uctest; + +-- Check UPDATE WHERE CURRENT; this time use FOR UPDATE +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; +FETCH c1; +UPDATE uctest SET f1 = 8 WHERE CURRENT OF c1; +SELECT * FROM uctest; +COMMIT; +SELECT * FROM uctest; + +-- Check repeated-update and update-then-delete cases +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest; +FETCH c1; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +SELECT * FROM uctest; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +SELECT * FROM uctest; +-- insensitive cursor should not show effects of updates or deletes +FETCH RELATIVE 0 FROM c1; +DELETE FROM uctest WHERE CURRENT OF c1; +SELECT * FROM uctest; +DELETE FROM uctest WHERE CURRENT OF c1; -- no-op +SELECT * FROM uctest; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- no-op +SELECT * FROM uctest; +FETCH RELATIVE 0 FROM c1; +ROLLBACK; +SELECT * FROM uctest; + +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; +FETCH c1; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +SELECT * FROM uctest; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +SELECT * FROM uctest; +DELETE FROM uctest WHERE CURRENT OF c1; +SELECT * FROM uctest; +DELETE FROM uctest WHERE CURRENT OF c1; -- no-op +SELECT * FROM uctest; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- no-op +SELECT * FROM uctest; +--- sensitive cursors can't currently scroll back, so this is an error: +FETCH RELATIVE 0 FROM c1; +ROLLBACK; +SELECT * FROM uctest; + +-- Check inheritance cases +CREATE TEMP TABLE ucchild () inherits (uctest); +INSERT INTO ucchild values(100, 'hundred'); +SELECT * FROM uctest; + +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest FOR UPDATE; +FETCH 1 FROM c1; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +FETCH 1 FROM c1; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +FETCH 1 FROM c1; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +FETCH 1 FROM c1; +COMMIT; +SELECT * FROM uctest; + +-- Can update from a self-join, but only if FOR UPDATE says which to use +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5; +FETCH 1 FROM c1; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- fail +ROLLBACK; +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5 FOR UPDATE; +FETCH 1 FROM c1; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; -- fail +ROLLBACK; +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest a, uctest b WHERE a.f1 = b.f1 + 5 FOR SHARE OF a; +FETCH 1 FROM c1; +UPDATE uctest SET f1 = f1 + 10 WHERE CURRENT OF c1; +SELECT * FROM uctest; +ROLLBACK; + +-- Check various error cases + +DELETE FROM uctest WHERE CURRENT OF c1; -- fail, no such cursor +DECLARE cx CURSOR WITH HOLD FOR SELECT * FROM uctest; +DELETE FROM uctest WHERE CURRENT OF cx; -- fail, can't use held cursor +BEGIN; +DECLARE c CURSOR FOR SELECT * FROM tenk2; +DELETE FROM uctest WHERE CURRENT OF c; -- fail, cursor on wrong table +ROLLBACK; +BEGIN; +DECLARE c CURSOR FOR SELECT * FROM tenk2 FOR SHARE; +DELETE FROM uctest WHERE CURRENT OF c; -- fail, cursor on wrong table +ROLLBACK; +BEGIN; +DECLARE c CURSOR FOR SELECT * FROM tenk1 JOIN tenk2 USING (unique1); +DELETE FROM tenk1 WHERE CURRENT OF c; -- fail, cursor is on a join +ROLLBACK; +BEGIN; +DECLARE c CURSOR FOR SELECT f1,count(*) FROM uctest GROUP BY f1; +DELETE FROM uctest WHERE CURRENT OF c; -- fail, cursor is on aggregation +ROLLBACK; +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM uctest; +DELETE FROM uctest WHERE CURRENT OF c1; -- fail, no current row +ROLLBACK; +BEGIN; +DECLARE c1 CURSOR FOR SELECT MIN(f1) FROM uctest FOR UPDATE; +ROLLBACK; + +-- WHERE CURRENT OF may someday work with views, but today is not that day. +-- For now, just make sure it errors out cleanly. +CREATE TEMP VIEW ucview AS SELECT * FROM uctest; +CREATE RULE ucrule AS ON DELETE TO ucview DO INSTEAD + DELETE FROM uctest WHERE f1 = OLD.f1; +BEGIN; +DECLARE c1 CURSOR FOR SELECT * FROM ucview; +FETCH FROM c1; +DELETE FROM ucview WHERE CURRENT OF c1; -- fail, views not supported +ROLLBACK; + +-- Check WHERE CURRENT OF with an index-only scan +BEGIN; +EXPLAIN (costs off) +DECLARE c1 CURSOR FOR SELECT stringu1 FROM onek WHERE stringu1 = 'DZAAAA'; +DECLARE c1 CURSOR FOR SELECT stringu1 FROM onek WHERE stringu1 = 'DZAAAA'; +FETCH FROM c1; +DELETE FROM onek WHERE CURRENT OF c1; +SELECT stringu1 FROM onek WHERE stringu1 = 'DZAAAA'; +ROLLBACK; + +-- Check behavior with rewinding to a previous child scan node, +-- as per bug #15395 +BEGIN; +CREATE TABLE current_check (currentid int, payload text); +CREATE TABLE current_check_1 () INHERITS (current_check); +CREATE TABLE current_check_2 () INHERITS (current_check); +INSERT INTO current_check_1 SELECT i, 'p' || i FROM generate_series(1,9) i; +INSERT INTO current_check_2 SELECT i, 'P' || i FROM generate_series(10,19) i; + +DECLARE c1 SCROLL CURSOR FOR SELECT * FROM current_check; + +-- This tests the fetch-backwards code path +FETCH ABSOLUTE 12 FROM c1; +FETCH ABSOLUTE 8 FROM c1; +DELETE FROM current_check WHERE CURRENT OF c1 RETURNING *; + +-- This tests the ExecutorRewind code path +FETCH ABSOLUTE 13 FROM c1; +FETCH ABSOLUTE 1 FROM c1; +DELETE FROM current_check WHERE CURRENT OF c1 RETURNING *; + +SELECT * FROM current_check; +ROLLBACK; + +-- Make sure snapshot management works okay, per bug report in +-- 235395b90909301035v7228ce63q392931f15aa74b31@mail.gmail.com +BEGIN; +SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; +CREATE TABLE cursor (a int); +INSERT INTO cursor VALUES (1); +DECLARE c1 NO SCROLL CURSOR FOR SELECT * FROM cursor FOR UPDATE; +UPDATE cursor SET a = 2; +FETCH ALL FROM c1; +COMMIT; +DROP TABLE cursor; + +-- Check rewinding a cursor containing a stable function in LIMIT, +-- per bug report in 8336843.9833.1399385291498.JavaMail.root@quick +begin; +create function nochange(int) returns int + as 'select $1 limit 1' language sql stable; +declare c cursor for select * from int8_tbl limit nochange(3); +fetch all from c; +move backward all in c; +fetch all from c; +rollback; + +-- Check handling of non-backwards-scan-capable plans with scroll cursors +begin; +explain (costs off) declare c1 cursor for select (select 42) as x; +explain (costs off) declare c1 scroll cursor for select (select 42) as x; +declare c1 scroll cursor for select (select 42) as x; +fetch all in c1; +fetch backward all in c1; +rollback; +begin; +explain (costs off) declare c2 cursor for select generate_series(1,3) as g; +explain (costs off) declare c2 scroll cursor for select generate_series(1,3) as g; +declare c2 scroll cursor for select generate_series(1,3) as g; +fetch all in c2; +fetch backward all in c2; +rollback; diff --git a/postgresql/examples/portals_p2.sql b/postgresql/examples/portals_p2.sql new file mode 100644 index 0000000..555820d --- /dev/null +++ b/postgresql/examples/portals_p2.sql @@ -0,0 +1,98 @@ +-- +-- PORTALS_P2 +-- + +BEGIN; + +DECLARE foo13 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 50; + +DECLARE foo14 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 51; + +DECLARE foo15 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 52; + +DECLARE foo16 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 53; + +DECLARE foo17 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 54; + +DECLARE foo18 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 55; + +DECLARE foo19 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 56; + +DECLARE foo20 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 57; + +DECLARE foo21 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 58; + +DECLARE foo22 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 59; + +DECLARE foo23 CURSOR FOR + SELECT * FROM onek WHERE unique1 = 60; + +DECLARE foo24 CURSOR FOR + SELECT * FROM onek2 WHERE unique1 = 50; + +DECLARE foo25 CURSOR FOR + SELECT * FROM onek2 WHERE unique1 = 60; + +FETCH all in foo13; + +FETCH all in foo14; + +FETCH all in foo15; + +FETCH all in foo16; + +FETCH all in foo17; + +FETCH all in foo18; + +FETCH all in foo19; + +FETCH all in foo20; + +FETCH all in foo21; + +FETCH all in foo22; + +FETCH all in foo23; + +FETCH all in foo24; + +FETCH all in foo25; + +CLOSE foo13; + +CLOSE foo14; + +CLOSE foo15; + +CLOSE foo16; + +CLOSE foo17; + +CLOSE foo18; + +CLOSE foo19; + +CLOSE foo20; + +CLOSE foo21; + +CLOSE foo22; + +CLOSE foo23; + +CLOSE foo24; + +CLOSE foo25; + +END; diff --git a/postgresql/examples/prepare.sql b/postgresql/examples/prepare.sql new file mode 100644 index 0000000..985d0f0 --- /dev/null +++ b/postgresql/examples/prepare.sql @@ -0,0 +1,80 @@ +-- Regression tests for prepareable statements. We query the content +-- of the pg_prepared_statements view as prepared statements are +-- created and removed. + +SELECT name, statement, parameter_types FROM pg_prepared_statements; + +PREPARE q1 AS SELECT 1 AS a; +EXECUTE q1; + +SELECT name, statement, parameter_types FROM pg_prepared_statements; + +-- should fail +PREPARE q1 AS SELECT 2; + +-- should succeed +DEALLOCATE q1; +PREPARE q1 AS SELECT 2; +EXECUTE q1; + +PREPARE q2 AS SELECT 2 AS b; +SELECT name, statement, parameter_types FROM pg_prepared_statements; + +-- sql92 syntax +DEALLOCATE PREPARE q1; + +SELECT name, statement, parameter_types FROM pg_prepared_statements; + +DEALLOCATE PREPARE q2; +-- the view should return the empty set again +SELECT name, statement, parameter_types FROM pg_prepared_statements; + +-- parameterized queries +PREPARE q2(text) AS + SELECT datname, datistemplate, datallowconn + FROM pg_database WHERE datname = $1; + +EXECUTE q2('postgres'); + +PREPARE q3(text, int, float, boolean, smallint) AS + SELECT * FROM tenk1 WHERE string4 = $1 AND (four = $2 OR + ten = $3::bigint OR true = $4 OR odd = $5::int) + ORDER BY unique1; + +EXECUTE q3('AAAAxx', 5::smallint, 10.5::float, false, 4::bigint); + +-- too few params +EXECUTE q3('bool'); + +-- too many params +EXECUTE q3('bytea', 5::smallint, 10.5::float, false, 4::bigint, true); + +-- wrong param types +EXECUTE q3(5::smallint, 10.5::float, false, 4::bigint, 'bytea'); + +-- invalid type +PREPARE q4(nonexistenttype) AS SELECT $1; + +-- create table as execute +PREPARE q5(int, text) AS + SELECT * FROM tenk1 WHERE unique1 = $1 OR stringu1 = $2 + ORDER BY unique1; +CREATE TEMPORARY TABLE q5_prep_results AS EXECUTE q5(200, 'DTAAAA'); +SELECT * FROM q5_prep_results; +CREATE TEMPORARY TABLE q5_prep_nodata AS EXECUTE q5(200, 'DTAAAA') + WITH NO DATA; +SELECT * FROM q5_prep_nodata; + +-- unknown or unspecified parameter types: should succeed +PREPARE q6 AS + SELECT * FROM tenk1 WHERE unique1 = $1 AND stringu1 = $2; +PREPARE q7(unknown) AS + SELECT * FROM road WHERE thepath = $1; + +SELECT name, statement, parameter_types FROM pg_prepared_statements + ORDER BY name; + +-- test DEALLOCATE ALL; +DEALLOCATE ALL; +SELECT name, statement, parameter_types FROM pg_prepared_statements + ORDER BY name; diff --git a/postgresql/examples/prepared_xacts.sql b/postgresql/examples/prepared_xacts.sql new file mode 100644 index 0000000..d8249a2 --- /dev/null +++ b/postgresql/examples/prepared_xacts.sql @@ -0,0 +1,158 @@ +-- +-- PREPARED TRANSACTIONS (two-phase commit) +-- +-- We can't readily test persistence of prepared xacts within the +-- regression script framework, unfortunately. Note that a crash +-- isn't really needed ... stopping and starting the postmaster would +-- be enough, but we can't even do that here. + + +-- create a simple table that we'll use in the tests +CREATE TABLE pxtest1 (foobar VARCHAR(10)); + +INSERT INTO pxtest1 VALUES ('aaa'); + + +-- Test PREPARE TRANSACTION +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; +UPDATE pxtest1 SET foobar = 'bbb' WHERE foobar = 'aaa'; +SELECT * FROM pxtest1; +PREPARE TRANSACTION 'foo1'; + +SELECT * FROM pxtest1; + +-- Test pg_prepared_xacts system view +SELECT gid FROM pg_prepared_xacts; + +-- Test ROLLBACK PREPARED +ROLLBACK PREPARED 'foo1'; + +SELECT * FROM pxtest1; + +SELECT gid FROM pg_prepared_xacts; + + +-- Test COMMIT PREPARED +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; +INSERT INTO pxtest1 VALUES ('ddd'); +SELECT * FROM pxtest1; +PREPARE TRANSACTION 'foo2'; + +SELECT * FROM pxtest1; + +COMMIT PREPARED 'foo2'; + +SELECT * FROM pxtest1; + +-- Test duplicate gids +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; +UPDATE pxtest1 SET foobar = 'eee' WHERE foobar = 'ddd'; +SELECT * FROM pxtest1; +PREPARE TRANSACTION 'foo3'; + +SELECT gid FROM pg_prepared_xacts; + +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; +INSERT INTO pxtest1 VALUES ('fff'); + +-- This should fail, because the gid foo3 is already in use +PREPARE TRANSACTION 'foo3'; + +SELECT * FROM pxtest1; + +ROLLBACK PREPARED 'foo3'; + +SELECT * FROM pxtest1; + +-- Test serialization failure (SSI) +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; +UPDATE pxtest1 SET foobar = 'eee' WHERE foobar = 'ddd'; +SELECT * FROM pxtest1; +PREPARE TRANSACTION 'foo4'; + +SELECT gid FROM pg_prepared_xacts; + +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; +SELECT * FROM pxtest1; + +-- This should fail, because the two transactions have a write-skew anomaly +INSERT INTO pxtest1 VALUES ('fff'); +PREPARE TRANSACTION 'foo5'; + +SELECT gid FROM pg_prepared_xacts; + +ROLLBACK PREPARED 'foo4'; + +SELECT gid FROM pg_prepared_xacts; + +-- Clean up +DROP TABLE pxtest1; + +-- Test subtransactions +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; + CREATE TABLE pxtest2 (a int); + INSERT INTO pxtest2 VALUES (1); + SAVEPOINT a; + INSERT INTO pxtest2 VALUES (2); + ROLLBACK TO a; + SAVEPOINT b; + INSERT INTO pxtest2 VALUES (3); +PREPARE TRANSACTION 'regress-one'; + +CREATE TABLE pxtest3(fff int); + +-- Test shared invalidation +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; + DROP TABLE pxtest3; + CREATE TABLE pxtest4 (a int); + INSERT INTO pxtest4 VALUES (1); + INSERT INTO pxtest4 VALUES (2); + DECLARE foo CURSOR FOR SELECT * FROM pxtest4; + -- Fetch 1 tuple, keeping the cursor open + FETCH 1 FROM foo; +PREPARE TRANSACTION 'regress-two'; + +-- No such cursor +FETCH 1 FROM foo; + +-- Table doesn't exist, the creation hasn't been committed yet +SELECT * FROM pxtest2; + +-- There should be two prepared transactions +SELECT gid FROM pg_prepared_xacts; + +-- pxtest3 should be locked because of the pending DROP +begin; +lock table pxtest3 in access share mode nowait; +rollback; + +-- Disconnect, we will continue testing in a different backend +\c - + +-- There should still be two prepared transactions +SELECT gid FROM pg_prepared_xacts; + +-- pxtest3 should still be locked because of the pending DROP +begin; +lock table pxtest3 in access share mode nowait; +rollback; + +-- Commit table creation +COMMIT PREPARED 'regress-one'; +\d pxtest2 +SELECT * FROM pxtest2; + +-- There should be one prepared transaction +SELECT gid FROM pg_prepared_xacts; + +-- Commit table drop +COMMIT PREPARED 'regress-two'; +SELECT * FROM pxtest3; + +-- There should be no prepared transactions +SELECT gid FROM pg_prepared_xacts; + +-- Clean up +DROP TABLE pxtest2; +DROP TABLE pxtest3; -- will still be there if prepared xacts are disabled +DROP TABLE pxtest4; diff --git a/postgresql/examples/privileges.sql b/postgresql/examples/privileges.sql new file mode 100644 index 0000000..334f5e9 --- /dev/null +++ b/postgresql/examples/privileges.sql @@ -0,0 +1,1297 @@ +-- +-- Test access privileges +-- + +-- Clean up in case a prior regression run failed + +-- Suppress NOTICE messages when users/groups don't exist +SET client_min_messages TO 'warning'; + +DROP ROLE IF EXISTS regress_priv_group1; +DROP ROLE IF EXISTS regress_priv_group2; + +DROP ROLE IF EXISTS regress_priv_user1; +DROP ROLE IF EXISTS regress_priv_user2; +DROP ROLE IF EXISTS regress_priv_user3; +DROP ROLE IF EXISTS regress_priv_user4; +DROP ROLE IF EXISTS regress_priv_user5; +DROP ROLE IF EXISTS regress_priv_user6; + +SELECT lo_unlink(oid) FROM pg_largeobject_metadata WHERE oid >= 1000 AND oid < 3000 ORDER BY oid; + +RESET client_min_messages; + +-- test proper begins here + +CREATE USER regress_priv_user1; +CREATE USER regress_priv_user2; +CREATE USER regress_priv_user3; +CREATE USER regress_priv_user4; +CREATE USER regress_priv_user5; +CREATE USER regress_priv_user5; -- duplicate + +CREATE GROUP regress_priv_group1; +CREATE GROUP regress_priv_group2 WITH USER regress_priv_user1, regress_priv_user2; + +ALTER GROUP regress_priv_group1 ADD USER regress_priv_user4; + +ALTER GROUP regress_priv_group2 ADD USER regress_priv_user2; -- duplicate +ALTER GROUP regress_priv_group2 DROP USER regress_priv_user2; +GRANT regress_priv_group2 TO regress_priv_user4 WITH ADMIN OPTION; + +-- test owner privileges + +SET SESSION AUTHORIZATION regress_priv_user1; +SELECT session_user, current_user; + +CREATE TABLE atest1 ( a int, b text ); +SELECT * FROM atest1; +INSERT INTO atest1 VALUES (1, 'one'); +DELETE FROM atest1; +UPDATE atest1 SET a = 1 WHERE b = 'blech'; +TRUNCATE atest1; +BEGIN; +LOCK atest1 IN ACCESS EXCLUSIVE MODE; +COMMIT; + +REVOKE ALL ON atest1 FROM PUBLIC; +SELECT * FROM atest1; + +GRANT ALL ON atest1 TO regress_priv_user2; +GRANT SELECT ON atest1 TO regress_priv_user3, regress_priv_user4; +SELECT * FROM atest1; + +CREATE TABLE atest2 (col1 varchar(10), col2 boolean); +GRANT SELECT ON atest2 TO regress_priv_user2; +GRANT UPDATE ON atest2 TO regress_priv_user3; +GRANT INSERT ON atest2 TO regress_priv_user4; +GRANT TRUNCATE ON atest2 TO regress_priv_user5; + + +SET SESSION AUTHORIZATION regress_priv_user2; +SELECT session_user, current_user; + +-- try various combinations of queries on atest1 and atest2 + +SELECT * FROM atest1; -- ok +SELECT * FROM atest2; -- ok +INSERT INTO atest1 VALUES (2, 'two'); -- ok +INSERT INTO atest2 VALUES ('foo', true); -- fail +INSERT INTO atest1 SELECT 1, b FROM atest1; -- ok +UPDATE atest1 SET a = 1 WHERE a = 2; -- ok +UPDATE atest2 SET col2 = NOT col2; -- fail +SELECT * FROM atest1 FOR UPDATE; -- ok +SELECT * FROM atest2 FOR UPDATE; -- fail +DELETE FROM atest2; -- fail +TRUNCATE atest2; -- fail +BEGIN; +LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- fail +COMMIT; +COPY atest2 FROM stdin; -- fail +GRANT ALL ON atest1 TO PUBLIC; -- fail + +-- checks in subquery, both ok +SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) ); +SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) ); + + +SET SESSION AUTHORIZATION regress_priv_user3; +SELECT session_user, current_user; + +SELECT * FROM atest1; -- ok +SELECT * FROM atest2; -- fail +INSERT INTO atest1 VALUES (2, 'two'); -- fail +INSERT INTO atest2 VALUES ('foo', true); -- fail +INSERT INTO atest1 SELECT 1, b FROM atest1; -- fail +UPDATE atest1 SET a = 1 WHERE a = 2; -- fail +UPDATE atest2 SET col2 = NULL; -- ok +UPDATE atest2 SET col2 = NOT col2; -- fails; requires SELECT on atest2 +UPDATE atest2 SET col2 = true FROM atest1 WHERE atest1.a = 5; -- ok +SELECT * FROM atest1 FOR UPDATE; -- fail +SELECT * FROM atest2 FOR UPDATE; -- fail +DELETE FROM atest2; -- fail +TRUNCATE atest2; -- fail +BEGIN; +LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- ok +COMMIT; +COPY atest2 FROM stdin; -- fail + +-- checks in subquery, both fail +SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) ); +SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) ); + +SET SESSION AUTHORIZATION regress_priv_user4; +COPY atest2 FROM stdin; -- ok + +\. +SELECT * FROM atest1; -- ok + + +-- test leaky-function protections in selfuncs + +-- regress_priv_user1 will own a table and provide views for it. +SET SESSION AUTHORIZATION regress_priv_user1; + +CREATE TABLE atest12 as + SELECT x AS a, 10001 - x AS b FROM generate_series(1,10000) x; +CREATE INDEX ON atest12 (a); +CREATE INDEX ON atest12 (abs(a)); +-- results below depend on having quite accurate stats for atest12, so... +ALTER TABLE atest12 SET (autovacuum_enabled = off); +SET default_statistics_target = 10000; +VACUUM ANALYZE atest12; +RESET default_statistics_target; + +CREATE FUNCTION leak(integer,integer) RETURNS boolean + AS $$begin return $1 < $2; end$$ + LANGUAGE plpgsql immutable; +CREATE OPERATOR <<< (procedure = leak, leftarg = integer, rightarg = integer, + restrict = scalarltsel); + +-- views with leaky operator +CREATE VIEW atest12v AS + SELECT * FROM atest12 WHERE b <<< 5; +CREATE VIEW atest12sbv WITH (security_barrier=true) AS + SELECT * FROM atest12 WHERE b <<< 5; +GRANT SELECT ON atest12v TO PUBLIC; +GRANT SELECT ON atest12sbv TO PUBLIC; + +-- This plan should use nestloop, knowing that few rows will be selected. +EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b; + +-- And this one. +EXPLAIN (COSTS OFF) SELECT * FROM atest12 x, atest12 y + WHERE x.a = y.b and abs(y.a) <<< 5; + +-- This should also be a nestloop, but the security barrier forces the inner +-- scan to be materialized +EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b; + +-- Check if regress_priv_user2 can break security. +SET SESSION AUTHORIZATION regress_priv_user2; + +CREATE FUNCTION leak2(integer,integer) RETURNS boolean + AS $$begin raise notice 'leak % %', $1, $2; return $1 > $2; end$$ + LANGUAGE plpgsql immutable; +CREATE OPERATOR >>> (procedure = leak2, leftarg = integer, rightarg = integer, + restrict = scalargtsel); + +-- This should not show any "leak" notices before failing. +EXPLAIN (COSTS OFF) SELECT * FROM atest12 WHERE a >>> 0; + +-- These plans should continue to use a nestloop, since they execute with the +-- privileges of the view owner. +EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b; +EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b; + +-- A non-security barrier view does not guard against information leakage. +EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y + WHERE x.a = y.b and abs(y.a) <<< 5; + +-- But a security barrier view isolates the leaky operator. +EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y + WHERE x.a = y.b and abs(y.a) <<< 5; + +-- Now regress_priv_user1 grants sufficient access to regress_priv_user2. +SET SESSION AUTHORIZATION regress_priv_user1; +GRANT SELECT (a, b) ON atest12 TO PUBLIC; +SET SESSION AUTHORIZATION regress_priv_user2; + +-- regress_priv_user2 should continue to get a good row estimate. +EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b; + +-- But not for this, due to lack of table-wide permissions needed +-- to make use of the expression index's statistics. +EXPLAIN (COSTS OFF) SELECT * FROM atest12 x, atest12 y + WHERE x.a = y.b and abs(y.a) <<< 5; + +-- clean up (regress_priv_user1's objects are all dropped later) +DROP FUNCTION leak2(integer, integer) CASCADE; + + +-- groups + +SET SESSION AUTHORIZATION regress_priv_user3; +CREATE TABLE atest3 (one int, two int, three int); +GRANT DELETE ON atest3 TO GROUP regress_priv_group2; + +SET SESSION AUTHORIZATION regress_priv_user1; + +SELECT * FROM atest3; -- fail +DELETE FROM atest3; -- ok + + +-- views + +SET SESSION AUTHORIZATION regress_priv_user3; + +CREATE VIEW atestv1 AS SELECT * FROM atest1; -- ok +/* The next *should* fail, but it's not implemented that way yet. */ +CREATE VIEW atestv2 AS SELECT * FROM atest2; +CREATE VIEW atestv3 AS SELECT * FROM atest3; -- ok +/* Empty view is a corner case that failed in 9.2. */ +CREATE VIEW atestv0 AS SELECT 0 as x WHERE false; -- ok + +SELECT * FROM atestv1; -- ok +SELECT * FROM atestv2; -- fail +GRANT SELECT ON atestv1, atestv3 TO regress_priv_user4; +GRANT SELECT ON atestv2 TO regress_priv_user2; + +SET SESSION AUTHORIZATION regress_priv_user4; + +SELECT * FROM atestv1; -- ok +SELECT * FROM atestv2; -- fail +SELECT * FROM atestv3; -- ok +SELECT * FROM atestv0; -- fail + +-- Appendrels excluded by constraints failed to check permissions in 8.4-9.2. +select * from + ((select a.q1 as x from int8_tbl a offset 0) + union all + (select b.q2 as x from int8_tbl b offset 0)) ss +where false; + +set constraint_exclusion = on; +select * from + ((select a.q1 as x, random() from int8_tbl a where q1 > 0) + union all + (select b.q2 as x, random() from int8_tbl b where q2 > 0)) ss +where x < 0; +reset constraint_exclusion; + +CREATE VIEW atestv4 AS SELECT * FROM atestv3; -- nested view +SELECT * FROM atestv4; -- ok +GRANT SELECT ON atestv4 TO regress_priv_user2; + +SET SESSION AUTHORIZATION regress_priv_user2; + +-- Two complex cases: + +SELECT * FROM atestv3; -- fail +SELECT * FROM atestv4; -- ok (even though regress_priv_user2 cannot access underlying atestv3) + +SELECT * FROM atest2; -- ok +SELECT * FROM atestv2; -- fail (even though regress_priv_user2 can access underlying atest2) + +-- Test column level permissions + +SET SESSION AUTHORIZATION regress_priv_user1; +CREATE TABLE atest5 (one int, two int unique, three int, four int unique); +CREATE TABLE atest6 (one int, two int, blue int); +GRANT SELECT (one), INSERT (two), UPDATE (three) ON atest5 TO regress_priv_user4; +GRANT ALL (one) ON atest5 TO regress_priv_user3; + +INSERT INTO atest5 VALUES (1,2,3); + +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT * FROM atest5; -- fail +SELECT one FROM atest5; -- ok +COPY atest5 (one) TO stdout; -- ok +SELECT two FROM atest5; -- fail +COPY atest5 (two) TO stdout; -- fail +SELECT atest5 FROM atest5; -- fail +COPY atest5 (one,two) TO stdout; -- fail +SELECT 1 FROM atest5; -- ok +SELECT 1 FROM atest5 a JOIN atest5 b USING (one); -- ok +SELECT 1 FROM atest5 a JOIN atest5 b USING (two); -- fail +SELECT 1 FROM atest5 a NATURAL JOIN atest5 b; -- fail +SELECT (j.*) IS NULL FROM (atest5 a JOIN atest5 b USING (one)) j; -- fail +SELECT 1 FROM atest5 WHERE two = 2; -- fail +SELECT * FROM atest1, atest5; -- fail +SELECT atest1.* FROM atest1, atest5; -- ok +SELECT atest1.*,atest5.one FROM atest1, atest5; -- ok +SELECT atest1.*,atest5.one FROM atest1 JOIN atest5 ON (atest1.a = atest5.two); -- fail +SELECT atest1.*,atest5.one FROM atest1 JOIN atest5 ON (atest1.a = atest5.one); -- ok +SELECT one, two FROM atest5; -- fail + +SET SESSION AUTHORIZATION regress_priv_user1; +GRANT SELECT (one,two) ON atest6 TO regress_priv_user4; + +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT one, two FROM atest5 NATURAL JOIN atest6; -- fail still + +SET SESSION AUTHORIZATION regress_priv_user1; +GRANT SELECT (two) ON atest5 TO regress_priv_user4; + +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT one, two FROM atest5 NATURAL JOIN atest6; -- ok now + +-- test column-level privileges for INSERT and UPDATE +INSERT INTO atest5 (two) VALUES (3); -- ok +COPY atest5 FROM stdin; -- fail +COPY atest5 (two) FROM stdin; -- ok + +\. +INSERT INTO atest5 (three) VALUES (4); -- fail +INSERT INTO atest5 VALUES (5,5,5); -- fail +UPDATE atest5 SET three = 10; -- ok +UPDATE atest5 SET one = 8; -- fail +UPDATE atest5 SET three = 5, one = 2; -- fail +-- Check that column level privs are enforced in RETURNING +-- Ok. +INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = 10; +-- Error. No SELECT on column three. +INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = 10 RETURNING atest5.three; +-- Ok. May SELECT on column "one": +INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = 10 RETURNING atest5.one; +-- Check that column level privileges are enforced for EXCLUDED +-- Ok. we may select one +INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = EXCLUDED.one; +-- Error. No select rights on three +INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set three = EXCLUDED.three; +INSERT INTO atest5(two) VALUES (6) ON CONFLICT (two) DO UPDATE set one = 8; -- fails (due to UPDATE) +INSERT INTO atest5(three) VALUES (4) ON CONFLICT (two) DO UPDATE set three = 10; -- fails (due to INSERT) + +-- Check that the columns in the inference require select privileges +INSERT INTO atest5(four) VALUES (4); -- fail + +SET SESSION AUTHORIZATION regress_priv_user1; +GRANT INSERT (four) ON atest5 TO regress_priv_user4; +SET SESSION AUTHORIZATION regress_priv_user4; + +INSERT INTO atest5(four) VALUES (4) ON CONFLICT (four) DO UPDATE set three = 3; -- fails (due to SELECT) +INSERT INTO atest5(four) VALUES (4) ON CONFLICT ON CONSTRAINT atest5_four_key DO UPDATE set three = 3; -- fails (due to SELECT) +INSERT INTO atest5(four) VALUES (4); -- ok + +SET SESSION AUTHORIZATION regress_priv_user1; +GRANT SELECT (four) ON atest5 TO regress_priv_user4; +SET SESSION AUTHORIZATION regress_priv_user4; + +INSERT INTO atest5(four) VALUES (4) ON CONFLICT (four) DO UPDATE set three = 3; -- ok +INSERT INTO atest5(four) VALUES (4) ON CONFLICT ON CONSTRAINT atest5_four_key DO UPDATE set three = 3; -- ok + +SET SESSION AUTHORIZATION regress_priv_user1; +REVOKE ALL (one) ON atest5 FROM regress_priv_user4; +GRANT SELECT (one,two,blue) ON atest6 TO regress_priv_user4; + +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT one FROM atest5; -- fail +UPDATE atest5 SET one = 1; -- fail +SELECT atest6 FROM atest6; -- ok +COPY atest6 TO stdout; -- ok + +-- check error reporting with column privs +SET SESSION AUTHORIZATION regress_priv_user1; +CREATE TABLE t1 (c1 int, c2 int, c3 int check (c3 < 5), primary key (c1, c2)); +GRANT SELECT (c1) ON t1 TO regress_priv_user2; +GRANT INSERT (c1, c2, c3) ON t1 TO regress_priv_user2; +GRANT UPDATE (c1, c2, c3) ON t1 TO regress_priv_user2; + +-- seed data +INSERT INTO t1 VALUES (1, 1, 1); +INSERT INTO t1 VALUES (1, 2, 1); +INSERT INTO t1 VALUES (2, 1, 2); +INSERT INTO t1 VALUES (2, 2, 2); +INSERT INTO t1 VALUES (3, 1, 3); + +SET SESSION AUTHORIZATION regress_priv_user2; +INSERT INTO t1 (c1, c2) VALUES (1, 1); -- fail, but row not shown +UPDATE t1 SET c2 = 1; -- fail, but row not shown +INSERT INTO t1 (c1, c2) VALUES (null, null); -- fail, but see columns being inserted +INSERT INTO t1 (c3) VALUES (null); -- fail, but see columns being inserted or have SELECT +INSERT INTO t1 (c1) VALUES (5); -- fail, but see columns being inserted or have SELECT +UPDATE t1 SET c3 = 10; -- fail, but see columns with SELECT rights, or being modified + +SET SESSION AUTHORIZATION regress_priv_user1; +DROP TABLE t1; + +-- test column-level privileges when involved with DELETE +SET SESSION AUTHORIZATION regress_priv_user1; +ALTER TABLE atest6 ADD COLUMN three integer; +GRANT DELETE ON atest5 TO regress_priv_user3; +GRANT SELECT (two) ON atest5 TO regress_priv_user3; +REVOKE ALL (one) ON atest5 FROM regress_priv_user3; +GRANT SELECT (one) ON atest5 TO regress_priv_user4; + +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT atest6 FROM atest6; -- fail +SELECT one FROM atest5 NATURAL JOIN atest6; -- fail + +SET SESSION AUTHORIZATION regress_priv_user1; +ALTER TABLE atest6 DROP COLUMN three; + +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT atest6 FROM atest6; -- ok +SELECT one FROM atest5 NATURAL JOIN atest6; -- ok + +SET SESSION AUTHORIZATION regress_priv_user1; +ALTER TABLE atest6 DROP COLUMN two; +REVOKE SELECT (one,blue) ON atest6 FROM regress_priv_user4; + +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT * FROM atest6; -- fail +SELECT 1 FROM atest6; -- fail + +SET SESSION AUTHORIZATION regress_priv_user3; +DELETE FROM atest5 WHERE one = 1; -- fail +DELETE FROM atest5 WHERE two = 2; -- ok + +-- check inheritance cases +SET SESSION AUTHORIZATION regress_priv_user1; +CREATE TABLE atestp1 (f1 int, f2 int); +CREATE TABLE atestp2 (fx int, fy int); +CREATE TABLE atestc (fz int) INHERITS (atestp1, atestp2); +GRANT SELECT(fx,fy,tableoid) ON atestp2 TO regress_priv_user2; +GRANT SELECT(fx) ON atestc TO regress_priv_user2; + +SET SESSION AUTHORIZATION regress_priv_user2; +SELECT fx FROM atestp2; -- ok +SELECT fy FROM atestp2; -- ok +SELECT atestp2 FROM atestp2; -- ok +SELECT tableoid FROM atestp2; -- ok +SELECT fy FROM atestc; -- fail + +SET SESSION AUTHORIZATION regress_priv_user1; +GRANT SELECT(fy,tableoid) ON atestc TO regress_priv_user2; + +SET SESSION AUTHORIZATION regress_priv_user2; +SELECT fx FROM atestp2; -- still ok +SELECT fy FROM atestp2; -- ok +SELECT atestp2 FROM atestp2; -- ok +SELECT tableoid FROM atestp2; -- ok + +-- child's permissions do not apply when operating on parent +SET SESSION AUTHORIZATION regress_priv_user1; +REVOKE ALL ON atestc FROM regress_priv_user2; +GRANT ALL ON atestp1 TO regress_priv_user2; +SET SESSION AUTHORIZATION regress_priv_user2; +SELECT f2 FROM atestp1; -- ok +SELECT f2 FROM atestc; -- fail +DELETE FROM atestp1; -- ok +DELETE FROM atestc; -- fail +UPDATE atestp1 SET f1 = 1; -- ok +UPDATE atestc SET f1 = 1; -- fail +TRUNCATE atestp1; -- ok +TRUNCATE atestc; -- fail +BEGIN; +LOCK atestp1; +END; +BEGIN; +LOCK atestc; +END; + +-- privileges on functions, languages + +-- switch to superuser +\c - + +REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC; +GRANT USAGE ON LANGUAGE sql TO regress_priv_user1; -- ok +GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail + +SET SESSION AUTHORIZATION regress_priv_user1; +GRANT USAGE ON LANGUAGE sql TO regress_priv_user2; -- fail +CREATE FUNCTION priv_testfunc1(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql; +CREATE FUNCTION priv_testfunc2(int) RETURNS int AS 'select 3 * $1;' LANGUAGE sql; +CREATE AGGREGATE priv_testagg1(int) (sfunc = int4pl, stype = int4); +CREATE PROCEDURE priv_testproc1(int) AS 'select $1;' LANGUAGE sql; + +REVOKE ALL ON FUNCTION priv_testfunc1(int), priv_testfunc2(int), priv_testagg1(int) FROM PUBLIC; +GRANT EXECUTE ON FUNCTION priv_testfunc1(int), priv_testfunc2(int), priv_testagg1(int) TO regress_priv_user2; +REVOKE ALL ON FUNCTION priv_testproc1(int) FROM PUBLIC; -- fail, not a function +REVOKE ALL ON PROCEDURE priv_testproc1(int) FROM PUBLIC; +GRANT EXECUTE ON PROCEDURE priv_testproc1(int) TO regress_priv_user2; +GRANT USAGE ON FUNCTION priv_testfunc1(int) TO regress_priv_user3; -- semantic error +GRANT USAGE ON FUNCTION priv_testagg1(int) TO regress_priv_user3; -- semantic error +GRANT USAGE ON PROCEDURE priv_testproc1(int) TO regress_priv_user3; -- semantic error +GRANT ALL PRIVILEGES ON FUNCTION priv_testfunc1(int) TO regress_priv_user4; +GRANT ALL PRIVILEGES ON FUNCTION priv_testfunc_nosuch(int) TO regress_priv_user4; +GRANT ALL PRIVILEGES ON FUNCTION priv_testagg1(int) TO regress_priv_user4; +GRANT ALL PRIVILEGES ON PROCEDURE priv_testproc1(int) TO regress_priv_user4; + +CREATE FUNCTION priv_testfunc4(boolean) RETURNS text + AS 'select col1 from atest2 where col2 = $1;' + LANGUAGE sql SECURITY DEFINER; +GRANT EXECUTE ON FUNCTION priv_testfunc4(boolean) TO regress_priv_user3; + +SET SESSION AUTHORIZATION regress_priv_user2; +SELECT priv_testfunc1(5), priv_testfunc2(5); -- ok +CREATE FUNCTION priv_testfunc3(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql; -- fail +SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- ok +CALL priv_testproc1(6); -- ok + +SET SESSION AUTHORIZATION regress_priv_user3; +SELECT priv_testfunc1(5); -- fail +SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- fail +CALL priv_testproc1(6); -- fail +SELECT col1 FROM atest2 WHERE col2 = true; -- fail +SELECT priv_testfunc4(true); -- ok + +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT priv_testfunc1(5); -- ok +SELECT priv_testagg1(x) FROM (VALUES (1), (2), (3)) _(x); -- ok +CALL priv_testproc1(6); -- ok + +DROP FUNCTION priv_testfunc1(int); -- fail +DROP AGGREGATE priv_testagg1(int); -- fail +DROP PROCEDURE priv_testproc1(int); -- fail + +\c - + +DROP FUNCTION priv_testfunc1(int); -- ok +-- restore to sanity +GRANT ALL PRIVILEGES ON LANGUAGE sql TO PUBLIC; + +-- verify privilege checks on array-element coercions +BEGIN; +SELECT '{1}'::int4[]::int8[]; +REVOKE ALL ON FUNCTION int8(integer) FROM PUBLIC; +SELECT '{1}'::int4[]::int8[]; --superuser, succeed +SET SESSION AUTHORIZATION regress_priv_user4; +SELECT '{1}'::int4[]::int8[]; --other user, fail +ROLLBACK; + +-- privileges on types + +-- switch to superuser +\c - + +CREATE TYPE priv_testtype1 AS (a int, b text); +REVOKE USAGE ON TYPE priv_testtype1 FROM PUBLIC; +GRANT USAGE ON TYPE priv_testtype1 TO regress_priv_user2; +GRANT USAGE ON TYPE _priv_testtype1 TO regress_priv_user2; -- fail +GRANT USAGE ON DOMAIN priv_testtype1 TO regress_priv_user2; -- fail + +CREATE DOMAIN priv_testdomain1 AS int; +REVOKE USAGE on DOMAIN priv_testdomain1 FROM PUBLIC; +GRANT USAGE ON DOMAIN priv_testdomain1 TO regress_priv_user2; +GRANT USAGE ON TYPE priv_testdomain1 TO regress_priv_user2; -- ok + +SET SESSION AUTHORIZATION regress_priv_user1; + +-- commands that should fail + +CREATE AGGREGATE priv_testagg1a(priv_testdomain1) (sfunc = int4_sum, stype = bigint); + +CREATE DOMAIN priv_testdomain2a AS priv_testdomain1; + +CREATE DOMAIN priv_testdomain3a AS int; +CREATE FUNCTION castfunc(int) RETURNS priv_testdomain3a AS $$ SELECT $1::priv_testdomain3a $$ LANGUAGE SQL; +CREATE CAST (priv_testdomain1 AS priv_testdomain3a) WITH FUNCTION castfunc(int); +DROP FUNCTION castfunc(int) CASCADE; +DROP DOMAIN priv_testdomain3a; + +CREATE FUNCTION priv_testfunc5a(a priv_testdomain1) RETURNS int LANGUAGE SQL AS $$ SELECT $1 $$; +CREATE FUNCTION priv_testfunc6a(b int) RETURNS priv_testdomain1 LANGUAGE SQL AS $$ SELECT $1::priv_testdomain1 $$; + +CREATE OPERATOR !+! (PROCEDURE = int4pl, LEFTARG = priv_testdomain1, RIGHTARG = priv_testdomain1); + +CREATE TABLE test5a (a int, b priv_testdomain1); +CREATE TABLE test6a OF priv_testtype1; +CREATE TABLE test10a (a int[], b priv_testtype1[]); + +CREATE TABLE test9a (a int, b int); +ALTER TABLE test9a ADD COLUMN c priv_testdomain1; +ALTER TABLE test9a ALTER COLUMN b TYPE priv_testdomain1; + +CREATE TYPE test7a AS (a int, b priv_testdomain1); + +CREATE TYPE test8a AS (a int, b int); +ALTER TYPE test8a ADD ATTRIBUTE c priv_testdomain1; +ALTER TYPE test8a ALTER ATTRIBUTE b TYPE priv_testdomain1; + +CREATE TABLE test11a AS (SELECT 1::priv_testdomain1 AS a); + +REVOKE ALL ON TYPE priv_testtype1 FROM PUBLIC; + +SET SESSION AUTHORIZATION regress_priv_user2; + +-- commands that should succeed + +CREATE AGGREGATE priv_testagg1b(priv_testdomain1) (sfunc = int4_sum, stype = bigint); + +CREATE DOMAIN priv_testdomain2b AS priv_testdomain1; + +CREATE DOMAIN priv_testdomain3b AS int; +CREATE FUNCTION castfunc(int) RETURNS priv_testdomain3b AS $$ SELECT $1::priv_testdomain3b $$ LANGUAGE SQL; +CREATE CAST (priv_testdomain1 AS priv_testdomain3b) WITH FUNCTION castfunc(int); + +CREATE FUNCTION priv_testfunc5b(a priv_testdomain1) RETURNS int LANGUAGE SQL AS $$ SELECT $1 $$; +CREATE FUNCTION priv_testfunc6b(b int) RETURNS priv_testdomain1 LANGUAGE SQL AS $$ SELECT $1::priv_testdomain1 $$; + +CREATE OPERATOR !! (PROCEDURE = priv_testfunc5b, RIGHTARG = priv_testdomain1); + +CREATE TABLE test5b (a int, b priv_testdomain1); +CREATE TABLE test6b OF priv_testtype1; +CREATE TABLE test10b (a int[], b priv_testtype1[]); + +CREATE TABLE test9b (a int, b int); +ALTER TABLE test9b ADD COLUMN c priv_testdomain1; +ALTER TABLE test9b ALTER COLUMN b TYPE priv_testdomain1; + +CREATE TYPE test7b AS (a int, b priv_testdomain1); + +CREATE TYPE test8b AS (a int, b int); +ALTER TYPE test8b ADD ATTRIBUTE c priv_testdomain1; +ALTER TYPE test8b ALTER ATTRIBUTE b TYPE priv_testdomain1; + +CREATE TABLE test11b AS (SELECT 1::priv_testdomain1 AS a); + +REVOKE ALL ON TYPE priv_testtype1 FROM PUBLIC; + +\c - +DROP AGGREGATE priv_testagg1b(priv_testdomain1); +DROP DOMAIN priv_testdomain2b; +DROP OPERATOR !! (NONE, priv_testdomain1); +DROP FUNCTION priv_testfunc5b(a priv_testdomain1); +DROP FUNCTION priv_testfunc6b(b int); +DROP TABLE test5b; +DROP TABLE test6b; +DROP TABLE test9b; +DROP TABLE test10b; +DROP TYPE test7b; +DROP TYPE test8b; +DROP CAST (priv_testdomain1 AS priv_testdomain3b); +DROP FUNCTION castfunc(int) CASCADE; +DROP DOMAIN priv_testdomain3b; +DROP TABLE test11b; + +DROP TYPE priv_testtype1; -- ok +DROP DOMAIN priv_testdomain1; -- ok + + +-- truncate +SET SESSION AUTHORIZATION regress_priv_user5; +TRUNCATE atest2; -- ok +TRUNCATE atest3; -- fail + +-- has_table_privilege function + +-- bad-input checks +select has_table_privilege(NULL,'pg_authid','select'); +select has_table_privilege('pg_shad','select'); +select has_table_privilege('nosuchuser','pg_authid','select'); +select has_table_privilege('pg_authid','sel'); +select has_table_privilege(-999999,'pg_authid','update'); +select has_table_privilege(1,'select'); + +-- superuser +\c - + +select has_table_privilege(current_user,'pg_authid','select'); +select has_table_privilege(current_user,'pg_authid','insert'); + +select has_table_privilege(t2.oid,'pg_authid','update') +from (select oid from pg_roles where rolname = current_user) as t2; +select has_table_privilege(t2.oid,'pg_authid','delete') +from (select oid from pg_roles where rolname = current_user) as t2; + +-- 'rule' privilege no longer exists, but for backwards compatibility +-- has_table_privilege still recognizes the keyword and says FALSE +select has_table_privilege(current_user,t1.oid,'rule') +from (select oid from pg_class where relname = 'pg_authid') as t1; +select has_table_privilege(current_user,t1.oid,'references') +from (select oid from pg_class where relname = 'pg_authid') as t1; + +select has_table_privilege(t2.oid,t1.oid,'select') +from (select oid from pg_class where relname = 'pg_authid') as t1, + (select oid from pg_roles where rolname = current_user) as t2; +select has_table_privilege(t2.oid,t1.oid,'insert') +from (select oid from pg_class where relname = 'pg_authid') as t1, + (select oid from pg_roles where rolname = current_user) as t2; + +select has_table_privilege('pg_authid','update'); +select has_table_privilege('pg_authid','delete'); +select has_table_privilege('pg_authid','truncate'); + +select has_table_privilege(t1.oid,'select') +from (select oid from pg_class where relname = 'pg_authid') as t1; +select has_table_privilege(t1.oid,'trigger') +from (select oid from pg_class where relname = 'pg_authid') as t1; + +-- non-superuser +SET SESSION AUTHORIZATION regress_priv_user3; + +select has_table_privilege(current_user,'pg_class','select'); +select has_table_privilege(current_user,'pg_class','insert'); + +select has_table_privilege(t2.oid,'pg_class','update') +from (select oid from pg_roles where rolname = current_user) as t2; +select has_table_privilege(t2.oid,'pg_class','delete') +from (select oid from pg_roles where rolname = current_user) as t2; + +select has_table_privilege(current_user,t1.oid,'references') +from (select oid from pg_class where relname = 'pg_class') as t1; + +select has_table_privilege(t2.oid,t1.oid,'select') +from (select oid from pg_class where relname = 'pg_class') as t1, + (select oid from pg_roles where rolname = current_user) as t2; +select has_table_privilege(t2.oid,t1.oid,'insert') +from (select oid from pg_class where relname = 'pg_class') as t1, + (select oid from pg_roles where rolname = current_user) as t2; + +select has_table_privilege('pg_class','update'); +select has_table_privilege('pg_class','delete'); +select has_table_privilege('pg_class','truncate'); + +select has_table_privilege(t1.oid,'select') +from (select oid from pg_class where relname = 'pg_class') as t1; +select has_table_privilege(t1.oid,'trigger') +from (select oid from pg_class where relname = 'pg_class') as t1; + +select has_table_privilege(current_user,'atest1','select'); +select has_table_privilege(current_user,'atest1','insert'); + +select has_table_privilege(t2.oid,'atest1','update') +from (select oid from pg_roles where rolname = current_user) as t2; +select has_table_privilege(t2.oid,'atest1','delete') +from (select oid from pg_roles where rolname = current_user) as t2; + +select has_table_privilege(current_user,t1.oid,'references') +from (select oid from pg_class where relname = 'atest1') as t1; + +select has_table_privilege(t2.oid,t1.oid,'select') +from (select oid from pg_class where relname = 'atest1') as t1, + (select oid from pg_roles where rolname = current_user) as t2; +select has_table_privilege(t2.oid,t1.oid,'insert') +from (select oid from pg_class where relname = 'atest1') as t1, + (select oid from pg_roles where rolname = current_user) as t2; + +select has_table_privilege('atest1','update'); +select has_table_privilege('atest1','delete'); +select has_table_privilege('atest1','truncate'); + +select has_table_privilege(t1.oid,'select') +from (select oid from pg_class where relname = 'atest1') as t1; +select has_table_privilege(t1.oid,'trigger') +from (select oid from pg_class where relname = 'atest1') as t1; + +-- has_column_privilege function + +-- bad-input checks (as non-super-user) +select has_column_privilege('pg_authid',NULL,'select'); +select has_column_privilege('pg_authid','nosuchcol','select'); +select has_column_privilege(9999,'nosuchcol','select'); +select has_column_privilege(9999,99::int2,'select'); +select has_column_privilege('pg_authid',99::int2,'select'); +select has_column_privilege(9999,99::int2,'select'); + +create temp table mytable(f1 int, f2 int, f3 int); +alter table mytable drop column f2; +select has_column_privilege('mytable','f2','select'); +select has_column_privilege('mytable','........pg.dropped.2........','select'); +select has_column_privilege('mytable',2::int2,'select'); +revoke select on table mytable from regress_priv_user3; +select has_column_privilege('mytable',2::int2,'select'); +drop table mytable; + +-- Grant options + +SET SESSION AUTHORIZATION regress_priv_user1; + +CREATE TABLE atest4 (a int); + +GRANT SELECT ON atest4 TO regress_priv_user2 WITH GRANT OPTION; +GRANT UPDATE ON atest4 TO regress_priv_user2; +GRANT SELECT ON atest4 TO GROUP regress_priv_group1 WITH GRANT OPTION; + +SET SESSION AUTHORIZATION regress_priv_user2; + +GRANT SELECT ON atest4 TO regress_priv_user3; +GRANT UPDATE ON atest4 TO regress_priv_user3; -- fail + +SET SESSION AUTHORIZATION regress_priv_user1; + +REVOKE SELECT ON atest4 FROM regress_priv_user3; -- does nothing +SELECT has_table_privilege('regress_priv_user3', 'atest4', 'SELECT'); -- true +REVOKE SELECT ON atest4 FROM regress_priv_user2; -- fail +REVOKE GRANT OPTION FOR SELECT ON atest4 FROM regress_priv_user2 CASCADE; -- ok +SELECT has_table_privilege('regress_priv_user2', 'atest4', 'SELECT'); -- true +SELECT has_table_privilege('regress_priv_user3', 'atest4', 'SELECT'); -- false + +SELECT has_table_privilege('regress_priv_user1', 'atest4', 'SELECT WITH GRANT OPTION'); -- true + + +-- Admin options + +SET SESSION AUTHORIZATION regress_priv_user4; +CREATE FUNCTION dogrant_ok() RETURNS void LANGUAGE sql SECURITY DEFINER AS + 'GRANT regress_priv_group2 TO regress_priv_user5'; +GRANT regress_priv_group2 TO regress_priv_user5; -- ok: had ADMIN OPTION +SET ROLE regress_priv_group2; +GRANT regress_priv_group2 TO regress_priv_user5; -- fails: SET ROLE suspended privilege + +SET SESSION AUTHORIZATION regress_priv_user1; +GRANT regress_priv_group2 TO regress_priv_user5; -- fails: no ADMIN OPTION +SELECT dogrant_ok(); -- ok: SECURITY DEFINER conveys ADMIN +SET ROLE regress_priv_group2; +GRANT regress_priv_group2 TO regress_priv_user5; -- fails: SET ROLE did not help + +SET SESSION AUTHORIZATION regress_priv_group2; +GRANT regress_priv_group2 TO regress_priv_user5; -- ok: a role can self-admin +CREATE FUNCTION dogrant_fails() RETURNS void LANGUAGE sql SECURITY DEFINER AS + 'GRANT regress_priv_group2 TO regress_priv_user5'; +SELECT dogrant_fails(); -- fails: no self-admin in SECURITY DEFINER +DROP FUNCTION dogrant_fails(); + +SET SESSION AUTHORIZATION regress_priv_user4; +DROP FUNCTION dogrant_ok(); +REVOKE regress_priv_group2 FROM regress_priv_user5; + + +-- has_sequence_privilege tests +\c - + +CREATE SEQUENCE x_seq; + +GRANT USAGE on x_seq to regress_priv_user2; + +SELECT has_sequence_privilege('regress_priv_user1', 'atest1', 'SELECT'); +SELECT has_sequence_privilege('regress_priv_user1', 'x_seq', 'INSERT'); +SELECT has_sequence_privilege('regress_priv_user1', 'x_seq', 'SELECT'); + +SET SESSION AUTHORIZATION regress_priv_user2; + +SELECT has_sequence_privilege('x_seq', 'USAGE'); + +-- largeobject privilege tests +\c - +SET SESSION AUTHORIZATION regress_priv_user1; + +SELECT lo_create(1001); +SELECT lo_create(1002); +SELECT lo_create(1003); +SELECT lo_create(1004); +SELECT lo_create(1005); + +GRANT ALL ON LARGE OBJECT 1001 TO PUBLIC; +GRANT SELECT ON LARGE OBJECT 1003 TO regress_priv_user2; +GRANT SELECT,UPDATE ON LARGE OBJECT 1004 TO regress_priv_user2; +GRANT ALL ON LARGE OBJECT 1005 TO regress_priv_user2; +GRANT SELECT ON LARGE OBJECT 1005 TO regress_priv_user2 WITH GRANT OPTION; + +GRANT SELECT, INSERT ON LARGE OBJECT 1001 TO PUBLIC; -- to be failed +GRANT SELECT, UPDATE ON LARGE OBJECT 1001 TO nosuchuser; -- to be failed +GRANT SELECT, UPDATE ON LARGE OBJECT 999 TO PUBLIC; -- to be failed + +\c - +SET SESSION AUTHORIZATION regress_priv_user2; + +SELECT lo_create(2001); +SELECT lo_create(2002); + +SELECT loread(lo_open(1001, x'20000'::int), 32); -- allowed, for now +SELECT lowrite(lo_open(1001, x'40000'::int), 'abcd'); -- fail, wrong mode + +SELECT loread(lo_open(1001, x'40000'::int), 32); +SELECT loread(lo_open(1002, x'40000'::int), 32); -- to be denied +SELECT loread(lo_open(1003, x'40000'::int), 32); +SELECT loread(lo_open(1004, x'40000'::int), 32); + +SELECT lowrite(lo_open(1001, x'20000'::int), 'abcd'); +SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); -- to be denied +SELECT lowrite(lo_open(1003, x'20000'::int), 'abcd'); -- to be denied +SELECT lowrite(lo_open(1004, x'20000'::int), 'abcd'); + +GRANT SELECT ON LARGE OBJECT 1005 TO regress_priv_user3; +GRANT UPDATE ON LARGE OBJECT 1006 TO regress_priv_user3; -- to be denied +REVOKE ALL ON LARGE OBJECT 2001, 2002 FROM PUBLIC; +GRANT ALL ON LARGE OBJECT 2001 TO regress_priv_user3; + +SELECT lo_unlink(1001); -- to be denied +SELECT lo_unlink(2002); + +\c - +-- confirm ACL setting +SELECT oid, pg_get_userbyid(lomowner) ownername, lomacl FROM pg_largeobject_metadata WHERE oid >= 1000 AND oid < 3000 ORDER BY oid; + +SET SESSION AUTHORIZATION regress_priv_user3; + +SELECT loread(lo_open(1001, x'40000'::int), 32); +SELECT loread(lo_open(1003, x'40000'::int), 32); -- to be denied +SELECT loread(lo_open(1005, x'40000'::int), 32); + +SELECT lo_truncate(lo_open(1005, x'20000'::int), 10); -- to be denied +SELECT lo_truncate(lo_open(2001, x'20000'::int), 10); + +-- compatibility mode in largeobject permission +\c - +SET lo_compat_privileges = false; -- default setting +SET SESSION AUTHORIZATION regress_priv_user4; + +SELECT loread(lo_open(1002, x'40000'::int), 32); -- to be denied +SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); -- to be denied +SELECT lo_truncate(lo_open(1002, x'20000'::int), 10); -- to be denied +SELECT lo_put(1002, 1, 'abcd'); -- to be denied +SELECT lo_unlink(1002); -- to be denied +SELECT lo_export(1001, '/dev/null'); -- to be denied +SELECT lo_import('/dev/null'); -- to be denied +SELECT lo_import('/dev/null', 2003); -- to be denied + +\c - +SET lo_compat_privileges = true; -- compatibility mode +SET SESSION AUTHORIZATION regress_priv_user4; + +SELECT loread(lo_open(1002, x'40000'::int), 32); +SELECT lowrite(lo_open(1002, x'20000'::int), 'abcd'); +SELECT lo_truncate(lo_open(1002, x'20000'::int), 10); +SELECT lo_unlink(1002); +SELECT lo_export(1001, '/dev/null'); -- to be denied + +-- don't allow unpriv users to access pg_largeobject contents +\c - +SELECT * FROM pg_largeobject LIMIT 0; + +SET SESSION AUTHORIZATION regress_priv_user1; +SELECT * FROM pg_largeobject LIMIT 0; -- to be denied + +-- test default ACLs +\c - + +CREATE SCHEMA testns; +GRANT ALL ON SCHEMA testns TO regress_priv_user1; + +CREATE TABLE testns.acltest1 (x int); +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- no +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no + +ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT SELECT ON TABLES TO public; + +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- no +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no + +DROP TABLE testns.acltest1; +CREATE TABLE testns.acltest1 (x int); + +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no + +ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT INSERT ON TABLES TO regress_priv_user1; + +DROP TABLE testns.acltest1; +CREATE TABLE testns.acltest1 (x int); + +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- yes + +ALTER DEFAULT PRIVILEGES IN SCHEMA testns REVOKE INSERT ON TABLES FROM regress_priv_user1; + +DROP TABLE testns.acltest1; +CREATE TABLE testns.acltest1 (x int); + +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'SELECT'); -- yes +SELECT has_table_privilege('regress_priv_user1', 'testns.acltest1', 'INSERT'); -- no + +ALTER DEFAULT PRIVILEGES FOR ROLE regress_priv_user1 REVOKE EXECUTE ON FUNCTIONS FROM public; + +ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT USAGE ON SCHEMAS TO regress_priv_user2; -- error + +-- +-- Testing blanket default grants is very hazardous since it might change +-- the privileges attached to objects created by concurrent regression tests. +-- To avoid that, be sure to revoke the privileges again before committing. +-- +BEGIN; + +ALTER DEFAULT PRIVILEGES GRANT USAGE ON SCHEMAS TO regress_priv_user2; + +CREATE SCHEMA testns2; + +SELECT has_schema_privilege('regress_priv_user2', 'testns2', 'USAGE'); -- yes +SELECT has_schema_privilege('regress_priv_user2', 'testns2', 'CREATE'); -- no + +ALTER DEFAULT PRIVILEGES REVOKE USAGE ON SCHEMAS FROM regress_priv_user2; + +CREATE SCHEMA testns3; + +SELECT has_schema_privilege('regress_priv_user2', 'testns3', 'USAGE'); -- no +SELECT has_schema_privilege('regress_priv_user2', 'testns3', 'CREATE'); -- no + +ALTER DEFAULT PRIVILEGES GRANT ALL ON SCHEMAS TO regress_priv_user2; + +CREATE SCHEMA testns4; + +SELECT has_schema_privilege('regress_priv_user2', 'testns4', 'USAGE'); -- yes +SELECT has_schema_privilege('regress_priv_user2', 'testns4', 'CREATE'); -- yes + +ALTER DEFAULT PRIVILEGES REVOKE ALL ON SCHEMAS FROM regress_priv_user2; + +COMMIT; + +CREATE SCHEMA testns5; + +SELECT has_schema_privilege('regress_priv_user2', 'testns5', 'USAGE'); -- no +SELECT has_schema_privilege('regress_priv_user2', 'testns5', 'CREATE'); -- no + +SET ROLE regress_priv_user1; + +CREATE FUNCTION testns.foo() RETURNS int AS 'select 1' LANGUAGE sql; +CREATE AGGREGATE testns.agg1(int) (sfunc = int4pl, stype = int4); +CREATE PROCEDURE testns.bar() AS 'select 1' LANGUAGE sql; + +SELECT has_function_privilege('regress_priv_user2', 'testns.foo()', 'EXECUTE'); -- no +SELECT has_function_privilege('regress_priv_user2', 'testns.agg1(int)', 'EXECUTE'); -- no +SELECT has_function_privilege('regress_priv_user2', 'testns.bar()', 'EXECUTE'); -- no + +ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT EXECUTE ON ROUTINES to public; + +DROP FUNCTION testns.foo(); +CREATE FUNCTION testns.foo() RETURNS int AS 'select 1' LANGUAGE sql; +DROP AGGREGATE testns.agg1(int); +CREATE AGGREGATE testns.agg1(int) (sfunc = int4pl, stype = int4); +DROP PROCEDURE testns.bar(); +CREATE PROCEDURE testns.bar() AS 'select 1' LANGUAGE sql; + +SELECT has_function_privilege('regress_priv_user2', 'testns.foo()', 'EXECUTE'); -- yes +SELECT has_function_privilege('regress_priv_user2', 'testns.agg1(int)', 'EXECUTE'); -- yes +SELECT has_function_privilege('regress_priv_user2', 'testns.bar()', 'EXECUTE'); -- yes (counts as function here) + +DROP FUNCTION testns.foo(); +DROP AGGREGATE testns.agg1(int); +DROP PROCEDURE testns.bar(); + +ALTER DEFAULT PRIVILEGES FOR ROLE regress_priv_user1 REVOKE USAGE ON TYPES FROM public; + +CREATE DOMAIN testns.priv_testdomain1 AS int; + +SELECT has_type_privilege('regress_priv_user2', 'testns.priv_testdomain1', 'USAGE'); -- no + +ALTER DEFAULT PRIVILEGES IN SCHEMA testns GRANT USAGE ON TYPES to public; + +DROP DOMAIN testns.priv_testdomain1; +CREATE DOMAIN testns.priv_testdomain1 AS int; + +SELECT has_type_privilege('regress_priv_user2', 'testns.priv_testdomain1', 'USAGE'); -- yes + +DROP DOMAIN testns.priv_testdomain1; + +RESET ROLE; + +SELECT count(*) + FROM pg_default_acl d LEFT JOIN pg_namespace n ON defaclnamespace = n.oid + WHERE nspname = 'testns'; + +DROP SCHEMA testns CASCADE; +DROP SCHEMA testns2 CASCADE; +DROP SCHEMA testns3 CASCADE; +DROP SCHEMA testns4 CASCADE; +DROP SCHEMA testns5 CASCADE; + +SELECT d.* -- check that entries went away + FROM pg_default_acl d LEFT JOIN pg_namespace n ON defaclnamespace = n.oid + WHERE nspname IS NULL AND defaclnamespace != 0; + + +-- Grant on all objects of given type in a schema +\c - + +CREATE SCHEMA testns; +CREATE TABLE testns.t1 (f1 int); +CREATE TABLE testns.t2 (f1 int); + +SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- false + +GRANT ALL ON ALL TABLES IN SCHEMA testns TO regress_priv_user1; + +SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- true +SELECT has_table_privilege('regress_priv_user1', 'testns.t2', 'SELECT'); -- true + +REVOKE ALL ON ALL TABLES IN SCHEMA testns FROM regress_priv_user1; + +SELECT has_table_privilege('regress_priv_user1', 'testns.t1', 'SELECT'); -- false +SELECT has_table_privilege('regress_priv_user1', 'testns.t2', 'SELECT'); -- false + +CREATE FUNCTION testns.priv_testfunc(int) RETURNS int AS 'select 3 * $1;' LANGUAGE sql; +CREATE AGGREGATE testns.priv_testagg(int) (sfunc = int4pl, stype = int4); +CREATE PROCEDURE testns.priv_testproc(int) AS 'select 3' LANGUAGE sql; + +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- true by default +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- true by default +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- true by default + +REVOKE ALL ON ALL FUNCTIONS IN SCHEMA testns FROM PUBLIC; + +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- false +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- false +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- still true, not a function + +REVOKE ALL ON ALL PROCEDURES IN SCHEMA testns FROM PUBLIC; + +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- now false + +GRANT ALL ON ALL ROUTINES IN SCHEMA testns TO PUBLIC; + +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testfunc(int)', 'EXECUTE'); -- true +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testagg(int)', 'EXECUTE'); -- true +SELECT has_function_privilege('regress_priv_user1', 'testns.priv_testproc(int)', 'EXECUTE'); -- true + +DROP SCHEMA testns CASCADE; + + +-- Change owner of the schema & and rename of new schema owner +\c - + +CREATE ROLE regress_schemauser1 superuser login; +CREATE ROLE regress_schemauser2 superuser login; + +SET SESSION ROLE regress_schemauser1; +CREATE SCHEMA testns; + +SELECT nspname, rolname FROM pg_namespace, pg_roles WHERE pg_namespace.nspname = 'testns' AND pg_namespace.nspowner = pg_roles.oid; + +ALTER SCHEMA testns OWNER TO regress_schemauser2; +ALTER ROLE regress_schemauser2 RENAME TO regress_schemauser_renamed; +SELECT nspname, rolname FROM pg_namespace, pg_roles WHERE pg_namespace.nspname = 'testns' AND pg_namespace.nspowner = pg_roles.oid; + +set session role regress_schemauser_renamed; +DROP SCHEMA testns CASCADE; + +-- clean up +\c - + +DROP ROLE regress_schemauser1; +DROP ROLE regress_schemauser_renamed; + + +-- test that dependent privileges are revoked (or not) properly +\c - + +set session role regress_priv_user1; +create table dep_priv_test (a int); +grant select on dep_priv_test to regress_priv_user2 with grant option; +grant select on dep_priv_test to regress_priv_user3 with grant option; +set session role regress_priv_user2; +grant select on dep_priv_test to regress_priv_user4 with grant option; +set session role regress_priv_user3; +grant select on dep_priv_test to regress_priv_user4 with grant option; +set session role regress_priv_user4; +grant select on dep_priv_test to regress_priv_user5; +\dp dep_priv_test +set session role regress_priv_user2; +revoke select on dep_priv_test from regress_priv_user4 cascade; +\dp dep_priv_test +set session role regress_priv_user3; +revoke select on dep_priv_test from regress_priv_user4 cascade; +\dp dep_priv_test +set session role regress_priv_user1; +drop table dep_priv_test; + + +-- clean up + +\c + +drop sequence x_seq; + +DROP AGGREGATE priv_testagg1(int); +DROP FUNCTION priv_testfunc2(int); +DROP FUNCTION priv_testfunc4(boolean); +DROP PROCEDURE priv_testproc1(int); + +DROP VIEW atestv0; +DROP VIEW atestv1; +DROP VIEW atestv2; +-- this should cascade to drop atestv4 +DROP VIEW atestv3 CASCADE; +-- this should complain "does not exist" +DROP VIEW atestv4; + +DROP TABLE atest1; +DROP TABLE atest2; +DROP TABLE atest3; +DROP TABLE atest4; +DROP TABLE atest5; +DROP TABLE atest6; +DROP TABLE atestc; +DROP TABLE atestp1; +DROP TABLE atestp2; + +SELECT lo_unlink(oid) FROM pg_largeobject_metadata WHERE oid >= 1000 AND oid < 3000 ORDER BY oid; + +DROP GROUP regress_priv_group1; +DROP GROUP regress_priv_group2; + +-- these are needed to clean up permissions +REVOKE USAGE ON LANGUAGE sql FROM regress_priv_user1; +DROP OWNED BY regress_priv_user1; + +DROP USER regress_priv_user1; +DROP USER regress_priv_user2; +DROP USER regress_priv_user3; +DROP USER regress_priv_user4; +DROP USER regress_priv_user5; +DROP USER regress_priv_user6; + + +-- permissions with LOCK TABLE +CREATE USER regress_locktable_user; +CREATE TABLE lock_table (a int); + +-- LOCK TABLE and SELECT permission +GRANT SELECT ON lock_table TO regress_locktable_user; +SET SESSION AUTHORIZATION regress_locktable_user; +BEGIN; +LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should fail +ROLLBACK; +BEGIN; +LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should pass +COMMIT; +BEGIN; +LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should fail +ROLLBACK; +\c +REVOKE SELECT ON lock_table FROM regress_locktable_user; + +-- LOCK TABLE and INSERT permission +GRANT INSERT ON lock_table TO regress_locktable_user; +SET SESSION AUTHORIZATION regress_locktable_user; +BEGIN; +LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass +COMMIT; +BEGIN; +LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail +ROLLBACK; +BEGIN; +LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should fail +ROLLBACK; +\c +REVOKE INSERT ON lock_table FROM regress_locktable_user; + +-- LOCK TABLE and UPDATE permission +GRANT UPDATE ON lock_table TO regress_locktable_user; +SET SESSION AUTHORIZATION regress_locktable_user; +BEGIN; +LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass +COMMIT; +BEGIN; +LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail +ROLLBACK; +BEGIN; +LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass +COMMIT; +\c +REVOKE UPDATE ON lock_table FROM regress_locktable_user; + +-- LOCK TABLE and DELETE permission +GRANT DELETE ON lock_table TO regress_locktable_user; +SET SESSION AUTHORIZATION regress_locktable_user; +BEGIN; +LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass +COMMIT; +BEGIN; +LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail +ROLLBACK; +BEGIN; +LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass +COMMIT; +\c +REVOKE DELETE ON lock_table FROM regress_locktable_user; + +-- LOCK TABLE and TRUNCATE permission +GRANT TRUNCATE ON lock_table TO regress_locktable_user; +SET SESSION AUTHORIZATION regress_locktable_user; +BEGIN; +LOCK TABLE lock_table IN ROW EXCLUSIVE MODE; -- should pass +COMMIT; +BEGIN; +LOCK TABLE lock_table IN ACCESS SHARE MODE; -- should fail +ROLLBACK; +BEGIN; +LOCK TABLE lock_table IN ACCESS EXCLUSIVE MODE; -- should pass +COMMIT; +\c +REVOKE TRUNCATE ON lock_table FROM regress_locktable_user; + +-- clean up +DROP TABLE lock_table; +DROP USER regress_locktable_user; diff --git a/postgresql/examples/psql_crosstab.sql b/postgresql/examples/psql_crosstab.sql new file mode 100644 index 0000000..5a45113 --- /dev/null +++ b/postgresql/examples/psql_crosstab.sql @@ -0,0 +1,124 @@ +-- +-- \crosstabview +-- + +CREATE TABLE ctv_data (v, h, c, i, d) AS +VALUES + ('v1','h2','foo', 3, '2015-04-01'::date), + ('v2','h1','bar', 3, '2015-01-02'), + ('v1','h0','baz', NULL, '2015-07-12'), + ('v0','h4','qux', 4, '2015-07-15'), + ('v0','h4','dbl', -3, '2014-12-15'), + ('v0',NULL,'qux', 5, '2014-07-15'), + ('v1','h2','quux',7, '2015-04-04'); + +-- make plans more stable +ANALYZE ctv_data; + +-- running \crosstabview after query uses query in buffer +SELECT v, EXTRACT(year FROM d), count(*) + FROM ctv_data + GROUP BY 1, 2 + ORDER BY 1, 2; +-- basic usage with 3 columns + \crosstabview + +-- ordered months in horizontal header, quoted column name +SELECT v, to_char(d, 'Mon') AS "month name", EXTRACT(month FROM d) AS num, + count(*) FROM ctv_data GROUP BY 1,2,3 ORDER BY 1 + \crosstabview v "month name" 4 num + +-- ordered months in vertical header, ordered years in horizontal header +SELECT EXTRACT(year FROM d) AS year, to_char(d,'Mon') AS """month"" name", + EXTRACT(month FROM d) AS month, + format('sum=%s avg=%s', sum(i), avg(i)::numeric(2,1)) + FROM ctv_data + GROUP BY EXTRACT(year FROM d), to_char(d,'Mon'), EXTRACT(month FROM d) +ORDER BY month +\crosstabview """month"" name" year format year + +-- combine contents vertically into the same cell (V/H duplicates) +SELECT v, h, string_agg(c, E'\n') FROM ctv_data GROUP BY v, h ORDER BY 1,2,3 + \crosstabview 1 2 3 + +-- horizontal ASC order from window function +SELECT v,h, string_agg(c, E'\n') AS c, row_number() OVER(ORDER BY h) AS r +FROM ctv_data GROUP BY v, h ORDER BY 1,3,2 + \crosstabview v h c r + +-- horizontal DESC order from window function +SELECT v, h, string_agg(c, E'\n') AS c, row_number() OVER(ORDER BY h DESC) AS r +FROM ctv_data GROUP BY v, h ORDER BY 1,3,2 + \crosstabview v h c r + +-- horizontal ASC order from window function, NULLs pushed rightmost +SELECT v,h, string_agg(c, E'\n') AS c, row_number() OVER(ORDER BY h NULLS LAST) AS r +FROM ctv_data GROUP BY v, h ORDER BY 1,3,2 + \crosstabview v h c r + +-- only null, no column name, 2 columns: error +SELECT null,null \crosstabview + +-- only null, no column name, 3 columns: works +SELECT null,null,null \crosstabview + +-- null display +\pset null '#null#' +SELECT v,h, string_agg(i::text, E'\n') AS i FROM ctv_data +GROUP BY v, h ORDER BY h,v + \crosstabview v h i +\pset null '' + +-- refer to columns by position +SELECT v,h,string_agg(i::text, E'\n'), string_agg(c, E'\n') +FROM ctv_data GROUP BY v, h ORDER BY h,v + \crosstabview 2 1 4 + +-- refer to columns by positions and names mixed +SELECT v,h, string_agg(i::text, E'\n') AS i, string_agg(c, E'\n') AS c +FROM ctv_data GROUP BY v, h ORDER BY h,v + \crosstabview 1 "h" 4 + +-- refer to columns by quoted names, check downcasing of unquoted name +SELECT 1 as "22", 2 as b, 3 as "Foo" + \crosstabview "22" B "Foo" + +-- error: bad column name +SELECT v,h,c,i FROM ctv_data + \crosstabview v h j + +-- error: need to quote name +SELECT 1 as "22", 2 as b, 3 as "Foo" + \crosstabview 1 2 Foo + +-- error: need to not quote name +SELECT 1 as "22", 2 as b, 3 as "Foo" + \crosstabview 1 "B" "Foo" + +-- error: bad column number +SELECT v,h,i,c FROM ctv_data + \crosstabview 2 1 5 + +-- error: same H and V columns +SELECT v,h,i,c FROM ctv_data + \crosstabview 2 h 4 + +-- error: too many columns +SELECT a,a,1 FROM generate_series(1,3000) AS a + \crosstabview + +-- error: only one column +SELECT 1 \crosstabview + +DROP TABLE ctv_data; + +-- check error reporting (bug #14476) +CREATE TABLE ctv_data (x int, y int, v text); + +INSERT INTO ctv_data SELECT 1, x, '*' || x FROM generate_series(1,10) x; +SELECT * FROM ctv_data \crosstabview + +INSERT INTO ctv_data VALUES (1, 10, '*'); -- duplicate data to cause error +SELECT * FROM ctv_data \crosstabview + +DROP TABLE ctv_data; diff --git a/postgresql/examples/publication.sql b/postgresql/examples/publication.sql new file mode 100644 index 0000000..d844075 --- /dev/null +++ b/postgresql/examples/publication.sql @@ -0,0 +1,180 @@ +-- +-- PUBLICATION +-- +CREATE ROLE regress_publication_user LOGIN SUPERUSER; +CREATE ROLE regress_publication_user2; +CREATE ROLE regress_publication_user_dummy LOGIN NOSUPERUSER; +SET SESSION AUTHORIZATION 'regress_publication_user'; + +-- suppress warning that depends on wal_level +SET client_min_messages = 'ERROR'; +CREATE PUBLICATION testpub_default; +RESET client_min_messages; + +COMMENT ON PUBLICATION testpub_default IS 'test publication'; +SELECT obj_description(p.oid, 'pg_publication') FROM pg_publication p; + +SET client_min_messages = 'ERROR'; +CREATE PUBLICATION testpib_ins_trunct WITH (publish = insert); +RESET client_min_messages; + +ALTER PUBLICATION testpub_default SET (publish = update); + +-- error cases +CREATE PUBLICATION testpub_xxx WITH (foo); +CREATE PUBLICATION testpub_xxx WITH (publish = 'cluster, vacuum'); +CREATE PUBLICATION testpub_xxx WITH (publish_via_partition_root = 'true', publish_via_partition_root = '0'); + +\dRp + +ALTER PUBLICATION testpub_default SET (publish = 'insert, update, delete'); + +\dRp + +--- adding tables +CREATE SCHEMA pub_test; +CREATE TABLE testpub_tbl1 (id serial primary key, data text); +CREATE TABLE pub_test.testpub_nopk (foo int, bar int); +CREATE VIEW testpub_view AS SELECT 1; +CREATE TABLE testpub_parted (a int) PARTITION BY LIST (a); + +SET client_min_messages = 'ERROR'; +CREATE PUBLICATION testpub_foralltables FOR ALL TABLES WITH (publish = 'insert'); +RESET client_min_messages; +ALTER PUBLICATION testpub_foralltables SET (publish = 'insert, update'); + +CREATE TABLE testpub_tbl2 (id serial primary key, data text); +-- fail - can't add to for all tables publication +ALTER PUBLICATION testpub_foralltables ADD TABLE testpub_tbl2; +-- fail - can't drop from all tables publication +ALTER PUBLICATION testpub_foralltables DROP TABLE testpub_tbl2; +-- fail - can't add to for all tables publication +ALTER PUBLICATION testpub_foralltables SET TABLE pub_test.testpub_nopk; + +SELECT pubname, puballtables FROM pg_publication WHERE pubname = 'testpub_foralltables'; +\d+ testpub_tbl2 +\dRp+ testpub_foralltables + +DROP TABLE testpub_tbl2; +DROP PUBLICATION testpub_foralltables; + +CREATE TABLE testpub_tbl3 (a int); +CREATE TABLE testpub_tbl3a (b text) INHERITS (testpub_tbl3); +SET client_min_messages = 'ERROR'; +CREATE PUBLICATION testpub3 FOR TABLE testpub_tbl3; +CREATE PUBLICATION testpub4 FOR TABLE ONLY testpub_tbl3; +RESET client_min_messages; +\dRp+ testpub3 +\dRp+ testpub4 + +DROP TABLE testpub_tbl3, testpub_tbl3a; +DROP PUBLICATION testpub3, testpub4; + +-- Tests for partitioned tables +SET client_min_messages = 'ERROR'; +CREATE PUBLICATION testpub_forparted; +CREATE PUBLICATION testpub_forparted1; +RESET client_min_messages; +CREATE TABLE testpub_parted1 (LIKE testpub_parted); +ALTER PUBLICATION testpub_forparted1 SET (publish='insert'); +-- works despite missing REPLICA IDENTITY, because updates are not replicated +UPDATE testpub_parted1 SET a = 1; +ALTER TABLE testpub_parted ATTACH PARTITION testpub_parted1 FOR VALUES IN (1); +-- only parent is listed as being in publication, not the partition +ALTER PUBLICATION testpub_forparted ADD TABLE testpub_parted; +\dRp+ testpub_forparted +-- should now fail, because parent's publication replicates updates +UPDATE testpub_parted1 SET a = 1; +ALTER TABLE testpub_parted DETACH PARTITION testpub_parted1; +-- works again, because parent's publication is no longer considered +UPDATE testpub_parted1 SET a = 1; +ALTER PUBLICATION testpub_forparted SET (publish_via_partition_root = true); +\dRp+ testpub_forparted +DROP TABLE testpub_parted1; +DROP PUBLICATION testpub_forparted, testpub_forparted1; + +-- fail - view +CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_view; +SET client_min_messages = 'ERROR'; +CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_tbl1, pub_test.testpub_nopk; +RESET client_min_messages; +-- fail - already added +ALTER PUBLICATION testpub_fortbl ADD TABLE testpub_tbl1; +-- fail - already added +CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_tbl1; + +\dRp+ testpub_fortbl + +-- fail - view +ALTER PUBLICATION testpub_default ADD TABLE testpub_view; + +ALTER PUBLICATION testpub_default ADD TABLE testpub_tbl1; +ALTER PUBLICATION testpub_default SET TABLE testpub_tbl1; +ALTER PUBLICATION testpub_default ADD TABLE pub_test.testpub_nopk; + +ALTER PUBLICATION testpib_ins_trunct ADD TABLE pub_test.testpub_nopk, testpub_tbl1; + +\d+ pub_test.testpub_nopk +\d+ testpub_tbl1 +\dRp+ testpub_default + +ALTER PUBLICATION testpub_default DROP TABLE testpub_tbl1, pub_test.testpub_nopk; +-- fail - nonexistent +ALTER PUBLICATION testpub_default DROP TABLE pub_test.testpub_nopk; + +\d+ testpub_tbl1 + +-- permissions +SET ROLE regress_publication_user2; +CREATE PUBLICATION testpub2; -- fail + +SET ROLE regress_publication_user; +GRANT CREATE ON DATABASE regression TO regress_publication_user2; +SET ROLE regress_publication_user2; +SET client_min_messages = 'ERROR'; +CREATE PUBLICATION testpub2; -- ok +RESET client_min_messages; + +ALTER PUBLICATION testpub2 ADD TABLE testpub_tbl1; -- fail + +SET ROLE regress_publication_user; +GRANT regress_publication_user TO regress_publication_user2; +SET ROLE regress_publication_user2; +ALTER PUBLICATION testpub2 ADD TABLE testpub_tbl1; -- ok + +DROP PUBLICATION testpub2; + +SET ROLE regress_publication_user; +REVOKE CREATE ON DATABASE regression FROM regress_publication_user2; + +DROP TABLE testpub_parted; +DROP VIEW testpub_view; +DROP TABLE testpub_tbl1; + +\dRp+ testpub_default + +-- fail - must be owner of publication +SET ROLE regress_publication_user_dummy; +ALTER PUBLICATION testpub_default RENAME TO testpub_dummy; +RESET ROLE; + +ALTER PUBLICATION testpub_default RENAME TO testpub_foo; + +\dRp testpub_foo + +-- rename back to keep the rest simple +ALTER PUBLICATION testpub_foo RENAME TO testpub_default; + +ALTER PUBLICATION testpub_default OWNER TO regress_publication_user2; + +\dRp testpub_default + +DROP PUBLICATION testpub_default; +DROP PUBLICATION testpib_ins_trunct; +DROP PUBLICATION testpub_fortbl; + +DROP SCHEMA pub_test CASCADE; + +RESET SESSION AUTHORIZATION; +DROP ROLE regress_publication_user, regress_publication_user2; +DROP ROLE regress_publication_user_dummy; diff --git a/postgresql/examples/random.sql b/postgresql/examples/random.sql new file mode 100644 index 0000000..ae6b70a --- /dev/null +++ b/postgresql/examples/random.sql @@ -0,0 +1,43 @@ +-- +-- RANDOM +-- Test the random function +-- + +-- count the number of tuples originally, should be 1000 +SELECT count(*) FROM onek; + +-- pick three random rows, they shouldn't match +(SELECT unique1 AS random + FROM onek ORDER BY random() LIMIT 1) +INTERSECT +(SELECT unique1 AS random + FROM onek ORDER BY random() LIMIT 1) +INTERSECT +(SELECT unique1 AS random + FROM onek ORDER BY random() LIMIT 1); + +-- count roughly 1/10 of the tuples +SELECT count(*) AS random INTO RANDOM_TBL + FROM onek WHERE random() < 1.0/10; + +-- select again, the count should be different +INSERT INTO RANDOM_TBL (random) + SELECT count(*) + FROM onek WHERE random() < 1.0/10; + +-- select again, the count should be different +INSERT INTO RANDOM_TBL (random) + SELECT count(*) + FROM onek WHERE random() < 1.0/10; + +-- select again, the count should be different +INSERT INTO RANDOM_TBL (random) + SELECT count(*) + FROM onek WHERE random() < 1.0/10; + +-- now test that they are different counts +SELECT random, count(random) FROM RANDOM_TBL + GROUP BY random HAVING count(random) > 3; + +SELECT AVG(random) FROM RANDOM_TBL + HAVING AVG(random) NOT BETWEEN 80 AND 120; diff --git a/postgresql/examples/rangefuncs.sql b/postgresql/examples/rangefuncs.sql new file mode 100644 index 0000000..ae3119a --- /dev/null +++ b/postgresql/examples/rangefuncs.sql @@ -0,0 +1,753 @@ +CREATE TABLE rngfunc2(rngfuncid int, f2 int); +INSERT INTO rngfunc2 VALUES(1, 11); +INSERT INTO rngfunc2 VALUES(2, 22); +INSERT INTO rngfunc2 VALUES(1, 111); + +CREATE FUNCTION rngfunct(int) returns setof rngfunc2 as 'SELECT * FROM rngfunc2 WHERE rngfuncid = $1 ORDER BY f2;' LANGUAGE SQL; + +-- function with ORDINALITY +select * from rngfunct(1) with ordinality as z(a,b,ord); +select * from rngfunct(1) with ordinality as z(a,b,ord) where b > 100; -- ordinal 2, not 1 +-- ordinality vs. column names and types +select a,b,ord from rngfunct(1) with ordinality as z(a,b,ord); +select a,ord from unnest(array['a','b']) with ordinality as z(a,ord); +select * from unnest(array['a','b']) with ordinality as z(a,ord); +select a,ord from unnest(array[1.0::float8]) with ordinality as z(a,ord); +select * from unnest(array[1.0::float8]) with ordinality as z(a,ord); +select row_to_json(s.*) from generate_series(11,14) with ordinality s; +-- ordinality vs. views +create temporary view vw_ord as select * from (values (1)) v(n) join rngfunct(1) with ordinality as z(a,b,ord) on (n=ord); +select * from vw_ord; +select definition from pg_views where viewname='vw_ord'; +drop view vw_ord; + +-- multiple functions +select * from rows from(rngfunct(1),rngfunct(2)) with ordinality as z(a,b,c,d,ord); +create temporary view vw_ord as select * from (values (1)) v(n) join rows from(rngfunct(1),rngfunct(2)) with ordinality as z(a,b,c,d,ord) on (n=ord); +select * from vw_ord; +select definition from pg_views where viewname='vw_ord'; +drop view vw_ord; + +-- expansions of unnest() +select * from unnest(array[10,20],array['foo','bar'],array[1.0]); +select * from unnest(array[10,20],array['foo','bar'],array[1.0]) with ordinality as z(a,b,c,ord); +select * from rows from(unnest(array[10,20],array['foo','bar'],array[1.0])) with ordinality as z(a,b,c,ord); +select * from rows from(unnest(array[10,20],array['foo','bar']), generate_series(101,102)) with ordinality as z(a,b,c,ord); +create temporary view vw_ord as select * from unnest(array[10,20],array['foo','bar'],array[1.0]) as z(a,b,c); +select * from vw_ord; +select definition from pg_views where viewname='vw_ord'; +drop view vw_ord; +create temporary view vw_ord as select * from rows from(unnest(array[10,20],array['foo','bar'],array[1.0])) as z(a,b,c); +select * from vw_ord; +select definition from pg_views where viewname='vw_ord'; +drop view vw_ord; +create temporary view vw_ord as select * from rows from(unnest(array[10,20],array['foo','bar']), generate_series(1,2)) as z(a,b,c); +select * from vw_ord; +select definition from pg_views where viewname='vw_ord'; +drop view vw_ord; + +-- ordinality and multiple functions vs. rewind and reverse scan +begin; +declare rf_cur scroll cursor for select * from rows from(generate_series(1,5),generate_series(1,2)) with ordinality as g(i,j,o); +fetch all from rf_cur; +fetch backward all from rf_cur; +fetch all from rf_cur; +fetch next from rf_cur; +fetch next from rf_cur; +fetch prior from rf_cur; +fetch absolute 1 from rf_cur; +fetch next from rf_cur; +fetch next from rf_cur; +fetch next from rf_cur; +fetch prior from rf_cur; +fetch prior from rf_cur; +fetch prior from rf_cur; +commit; + +-- function with implicit LATERAL +select * from rngfunc2, rngfunct(rngfunc2.rngfuncid) z where rngfunc2.f2 = z.f2; + +-- function with implicit LATERAL and explicit ORDINALITY +select * from rngfunc2, rngfunct(rngfunc2.rngfuncid) with ordinality as z(rngfuncid,f2,ord) where rngfunc2.f2 = z.f2; + +-- function in subselect +select * from rngfunc2 where f2 in (select f2 from rngfunct(rngfunc2.rngfuncid) z where z.rngfuncid = rngfunc2.rngfuncid) ORDER BY 1,2; + +-- function in subselect +select * from rngfunc2 where f2 in (select f2 from rngfunct(1) z where z.rngfuncid = rngfunc2.rngfuncid) ORDER BY 1,2; + +-- function in subselect +select * from rngfunc2 where f2 in (select f2 from rngfunct(rngfunc2.rngfuncid) z where z.rngfuncid = 1) ORDER BY 1,2; + +-- nested functions +select rngfunct.rngfuncid, rngfunct.f2 from rngfunct(sin(pi()/2)::int) ORDER BY 1,2; + +CREATE TABLE rngfunc (rngfuncid int, rngfuncsubid int, rngfuncname text, primary key(rngfuncid,rngfuncsubid)); +INSERT INTO rngfunc VALUES(1,1,'Joe'); +INSERT INTO rngfunc VALUES(1,2,'Ed'); +INSERT INTO rngfunc VALUES(2,1,'Mary'); + +-- sql, proretset = f, prorettype = b +CREATE FUNCTION getrngfunc1(int) RETURNS int AS 'SELECT $1;' LANGUAGE SQL; +SELECT * FROM getrngfunc1(1) AS t1; +SELECT * FROM getrngfunc1(1) WITH ORDINALITY AS t1(v,o); +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc1(1); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc1(1) WITH ORDINALITY as t1(v,o); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- sql, proretset = t, prorettype = b +CREATE FUNCTION getrngfunc2(int) RETURNS setof int AS 'SELECT rngfuncid FROM rngfunc WHERE rngfuncid = $1;' LANGUAGE SQL; +SELECT * FROM getrngfunc2(1) AS t1; +SELECT * FROM getrngfunc2(1) WITH ORDINALITY AS t1(v,o); +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc2(1); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc2(1) WITH ORDINALITY AS t1(v,o); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- sql, proretset = t, prorettype = b +CREATE FUNCTION getrngfunc3(int) RETURNS setof text AS 'SELECT rngfuncname FROM rngfunc WHERE rngfuncid = $1;' LANGUAGE SQL; +SELECT * FROM getrngfunc3(1) AS t1; +SELECT * FROM getrngfunc3(1) WITH ORDINALITY AS t1(v,o); +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc3(1); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc3(1) WITH ORDINALITY AS t1(v,o); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- sql, proretset = f, prorettype = c +CREATE FUNCTION getrngfunc4(int) RETURNS rngfunc AS 'SELECT * FROM rngfunc WHERE rngfuncid = $1;' LANGUAGE SQL; +SELECT * FROM getrngfunc4(1) AS t1; +SELECT * FROM getrngfunc4(1) WITH ORDINALITY AS t1(a,b,c,o); +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc4(1); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc4(1) WITH ORDINALITY AS t1(a,b,c,o); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- sql, proretset = t, prorettype = c +CREATE FUNCTION getrngfunc5(int) RETURNS setof rngfunc AS 'SELECT * FROM rngfunc WHERE rngfuncid = $1;' LANGUAGE SQL; +SELECT * FROM getrngfunc5(1) AS t1; +SELECT * FROM getrngfunc5(1) WITH ORDINALITY AS t1(a,b,c,o); +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc5(1); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc5(1) WITH ORDINALITY AS t1(a,b,c,o); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- sql, proretset = f, prorettype = record +CREATE FUNCTION getrngfunc6(int) RETURNS RECORD AS 'SELECT * FROM rngfunc WHERE rngfuncid = $1;' LANGUAGE SQL; +SELECT * FROM getrngfunc6(1) AS t1(rngfuncid int, rngfuncsubid int, rngfuncname text); +SELECT * FROM ROWS FROM( getrngfunc6(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text) ) WITH ORDINALITY; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc6(1) AS +(rngfuncid int, rngfuncsubid int, rngfuncname text); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS + SELECT * FROM ROWS FROM( getrngfunc6(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text) ) + WITH ORDINALITY; +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- sql, proretset = t, prorettype = record +CREATE FUNCTION getrngfunc7(int) RETURNS setof record AS 'SELECT * FROM rngfunc WHERE rngfuncid = $1;' LANGUAGE SQL; +SELECT * FROM getrngfunc7(1) AS t1(rngfuncid int, rngfuncsubid int, rngfuncname text); +SELECT * FROM ROWS FROM( getrngfunc7(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text) ) WITH ORDINALITY; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc7(1) AS +(rngfuncid int, rngfuncsubid int, rngfuncname text); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS + SELECT * FROM ROWS FROM( getrngfunc7(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text) ) + WITH ORDINALITY; +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- plpgsql, proretset = f, prorettype = b +CREATE FUNCTION getrngfunc8(int) RETURNS int AS 'DECLARE rngfuncint int; BEGIN SELECT rngfuncid into rngfuncint FROM rngfunc WHERE rngfuncid = $1; RETURN rngfuncint; END;' LANGUAGE plpgsql; +SELECT * FROM getrngfunc8(1) AS t1; +SELECT * FROM getrngfunc8(1) WITH ORDINALITY AS t1(v,o); +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc8(1); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc8(1) WITH ORDINALITY AS t1(v,o); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- plpgsql, proretset = f, prorettype = c +CREATE FUNCTION getrngfunc9(int) RETURNS rngfunc AS 'DECLARE rngfunctup rngfunc%ROWTYPE; BEGIN SELECT * into rngfunctup FROM rngfunc WHERE rngfuncid = $1; RETURN rngfunctup; END;' LANGUAGE plpgsql; +SELECT * FROM getrngfunc9(1) AS t1; +SELECT * FROM getrngfunc9(1) WITH ORDINALITY AS t1(a,b,c,o); +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc9(1); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; +CREATE VIEW vw_getrngfunc AS SELECT * FROM getrngfunc9(1) WITH ORDINALITY AS t1(a,b,c,o); +SELECT * FROM vw_getrngfunc; +DROP VIEW vw_getrngfunc; + +-- mix 'n match kinds, to exercise expandRTE and related logic + +select * from rows from(getrngfunc1(1),getrngfunc2(1),getrngfunc3(1),getrngfunc4(1),getrngfunc5(1), + getrngfunc6(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text), + getrngfunc7(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text), + getrngfunc8(1),getrngfunc9(1)) + with ordinality as t1(a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u); +select * from rows from(getrngfunc9(1),getrngfunc8(1), + getrngfunc7(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text), + getrngfunc6(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text), + getrngfunc5(1),getrngfunc4(1),getrngfunc3(1),getrngfunc2(1),getrngfunc1(1)) + with ordinality as t1(a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u); + +create temporary view vw_rngfunc as + select * from rows from(getrngfunc9(1), + getrngfunc7(1) AS (rngfuncid int, rngfuncsubid int, rngfuncname text), + getrngfunc1(1)) + with ordinality as t1(a,b,c,d,e,f,g,n); +select * from vw_rngfunc; +select pg_get_viewdef('vw_rngfunc'); +drop view vw_rngfunc; + +DROP FUNCTION getrngfunc1(int); +DROP FUNCTION getrngfunc2(int); +DROP FUNCTION getrngfunc3(int); +DROP FUNCTION getrngfunc4(int); +DROP FUNCTION getrngfunc5(int); +DROP FUNCTION getrngfunc6(int); +DROP FUNCTION getrngfunc7(int); +DROP FUNCTION getrngfunc8(int); +DROP FUNCTION getrngfunc9(int); +DROP FUNCTION rngfunct(int); +DROP TABLE rngfunc2; +DROP TABLE rngfunc; + +-- Rescan tests -- +CREATE TEMPORARY SEQUENCE rngfunc_rescan_seq1; +CREATE TEMPORARY SEQUENCE rngfunc_rescan_seq2; +CREATE TYPE rngfunc_rescan_t AS (i integer, s bigint); + +CREATE FUNCTION rngfunc_sql(int,int) RETURNS setof rngfunc_rescan_t AS 'SELECT i, nextval(''rngfunc_rescan_seq1'') FROM generate_series($1,$2) i;' LANGUAGE SQL; +-- plpgsql functions use materialize mode +CREATE FUNCTION rngfunc_mat(int,int) RETURNS setof rngfunc_rescan_t AS 'begin for i in $1..$2 loop return next (i, nextval(''rngfunc_rescan_seq2'')); end loop; end;' LANGUAGE plpgsql; + +--invokes ExecReScanFunctionScan - all these cases should materialize the function only once +-- LEFT JOIN on a condition that the planner can't prove to be true is used to ensure the function +-- is on the inner path of a nestloop join + +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN rngfunc_sql(11,13) ON (r+i)<100; +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN rngfunc_sql(11,13) WITH ORDINALITY AS f(i,s,o) ON (r+i)<100; + +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN rngfunc_mat(11,13) ON (r+i)<100; +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN rngfunc_mat(11,13) WITH ORDINALITY AS f(i,s,o) ON (r+i)<100; +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN ROWS FROM( rngfunc_sql(11,13), rngfunc_mat(11,13) ) WITH ORDINALITY AS f(i1,s1,i2,s2,o) ON (r+i1+i2)<100; + +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN generate_series(11,13) f(i) ON (r+i)<100; +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN generate_series(11,13) WITH ORDINALITY AS f(i,o) ON (r+i)<100; + +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN unnest(array[10,20,30]) f(i) ON (r+i)<100; +SELECT * FROM (VALUES (1),(2),(3)) v(r) LEFT JOIN unnest(array[10,20,30]) WITH ORDINALITY AS f(i,o) ON (r+i)<100; + +--invokes ExecReScanFunctionScan with chgParam != NULL (using implied LATERAL) + +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), rngfunc_sql(10+r,13); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), rngfunc_sql(10+r,13) WITH ORDINALITY AS f(i,s,o); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), rngfunc_sql(11,10+r); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), rngfunc_sql(11,10+r) WITH ORDINALITY AS f(i,s,o); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (11,12),(13,15),(16,20)) v(r1,r2), rngfunc_sql(r1,r2); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (11,12),(13,15),(16,20)) v(r1,r2), rngfunc_sql(r1,r2) WITH ORDINALITY AS f(i,s,o); + +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), rngfunc_mat(10+r,13); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), rngfunc_mat(10+r,13) WITH ORDINALITY AS f(i,s,o); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), rngfunc_mat(11,10+r); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), rngfunc_mat(11,10+r) WITH ORDINALITY AS f(i,s,o); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (11,12),(13,15),(16,20)) v(r1,r2), rngfunc_mat(r1,r2); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (11,12),(13,15),(16,20)) v(r1,r2), rngfunc_mat(r1,r2) WITH ORDINALITY AS f(i,s,o); + +-- selective rescan of multiple functions: + +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), ROWS FROM( rngfunc_sql(11,11), rngfunc_mat(10+r,13) ); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), ROWS FROM( rngfunc_sql(10+r,13), rngfunc_mat(11,11) ); +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM (VALUES (1),(2),(3)) v(r), ROWS FROM( rngfunc_sql(10+r,13), rngfunc_mat(10+r,13) ); + +SELECT setval('rngfunc_rescan_seq1',1,false),setval('rngfunc_rescan_seq2',1,false); +SELECT * FROM generate_series(1,2) r1, generate_series(r1,3) r2, ROWS FROM( rngfunc_sql(10+r1,13), rngfunc_mat(10+r2,13) ); + +SELECT * FROM (VALUES (1),(2),(3)) v(r), generate_series(10+r,20-r) f(i); +SELECT * FROM (VALUES (1),(2),(3)) v(r), generate_series(10+r,20-r) WITH ORDINALITY AS f(i,o); + +SELECT * FROM (VALUES (1),(2),(3)) v(r), unnest(array[r*10,r*20,r*30]) f(i); +SELECT * FROM (VALUES (1),(2),(3)) v(r), unnest(array[r*10,r*20,r*30]) WITH ORDINALITY AS f(i,o); + +-- deep nesting + +SELECT * FROM (VALUES (1),(2),(3)) v1(r1), + LATERAL (SELECT r1, * FROM (VALUES (10),(20),(30)) v2(r2) + LEFT JOIN generate_series(21,23) f(i) ON ((r2+i)<100) OFFSET 0) s1; +SELECT * FROM (VALUES (1),(2),(3)) v1(r1), + LATERAL (SELECT r1, * FROM (VALUES (10),(20),(30)) v2(r2) + LEFT JOIN generate_series(20+r1,23) f(i) ON ((r2+i)<100) OFFSET 0) s1; +SELECT * FROM (VALUES (1),(2),(3)) v1(r1), + LATERAL (SELECT r1, * FROM (VALUES (10),(20),(30)) v2(r2) + LEFT JOIN generate_series(r2,r2+3) f(i) ON ((r2+i)<100) OFFSET 0) s1; +SELECT * FROM (VALUES (1),(2),(3)) v1(r1), + LATERAL (SELECT r1, * FROM (VALUES (10),(20),(30)) v2(r2) + LEFT JOIN generate_series(r1,2+r2/5) f(i) ON ((r2+i)<100) OFFSET 0) s1; + +-- check handling of FULL JOIN with multiple lateral references (bug #15741) + +SELECT * +FROM (VALUES (1),(2)) v1(r1) + LEFT JOIN LATERAL ( + SELECT * + FROM generate_series(1, v1.r1) AS gs1 + LEFT JOIN LATERAL ( + SELECT * + FROM generate_series(1, gs1) AS gs2 + LEFT JOIN generate_series(1, gs2) AS gs3 ON TRUE + ) AS ss1 ON TRUE + FULL JOIN generate_series(1, v1.r1) AS gs4 ON FALSE + ) AS ss0 ON TRUE; + +DROP FUNCTION rngfunc_sql(int,int); +DROP FUNCTION rngfunc_mat(int,int); +DROP SEQUENCE rngfunc_rescan_seq1; +DROP SEQUENCE rngfunc_rescan_seq2; + +-- +-- Test cases involving OUT parameters +-- + +CREATE FUNCTION rngfunc(in f1 int, out f2 int) +AS 'select $1+1' LANGUAGE sql; +SELECT rngfunc(42); +SELECT * FROM rngfunc(42); +SELECT * FROM rngfunc(42) AS p(x); + +-- explicit spec of return type is OK +CREATE OR REPLACE FUNCTION rngfunc(in f1 int, out f2 int) RETURNS int +AS 'select $1+1' LANGUAGE sql; +-- error, wrong result type +CREATE OR REPLACE FUNCTION rngfunc(in f1 int, out f2 int) RETURNS float +AS 'select $1+1' LANGUAGE sql; +-- with multiple OUT params you must get a RECORD result +CREATE OR REPLACE FUNCTION rngfunc(in f1 int, out f2 int, out f3 text) RETURNS int +AS 'select $1+1' LANGUAGE sql; +CREATE OR REPLACE FUNCTION rngfunc(in f1 int, out f2 int, out f3 text) +RETURNS record +AS 'select $1+1' LANGUAGE sql; + +CREATE OR REPLACE FUNCTION rngfuncr(in f1 int, out f2 int, out text) +AS $$select $1-1, $1::text || 'z'$$ LANGUAGE sql; +SELECT f1, rngfuncr(f1) FROM int4_tbl; +SELECT * FROM rngfuncr(42); +SELECT * FROM rngfuncr(42) AS p(a,b); + +CREATE OR REPLACE FUNCTION rngfuncb(in f1 int, inout f2 int, out text) +AS $$select $2-1, $1::text || 'z'$$ LANGUAGE sql; +SELECT f1, rngfuncb(f1, f1/2) FROM int4_tbl; +SELECT * FROM rngfuncb(42, 99); +SELECT * FROM rngfuncb(42, 99) AS p(a,b); + +-- Can reference function with or without OUT params for DROP, etc +DROP FUNCTION rngfunc(int); +DROP FUNCTION rngfuncr(in f2 int, out f1 int, out text); +DROP FUNCTION rngfuncb(in f1 int, inout f2 int); + +-- +-- For my next trick, polymorphic OUT parameters +-- + +CREATE FUNCTION dup (f1 anyelement, f2 out anyelement, f3 out anyarray) +AS 'select $1, array[$1,$1]' LANGUAGE sql; +SELECT dup(22); +SELECT dup('xyz'); -- fails +SELECT dup('xyz'::text); +SELECT * FROM dup('xyz'::text); + +-- fails, as we are attempting to rename first argument +CREATE OR REPLACE FUNCTION dup (inout f2 anyelement, out f3 anyarray) +AS 'select $1, array[$1,$1]' LANGUAGE sql; + +DROP FUNCTION dup(anyelement); + +-- equivalent behavior, though different name exposed for input arg +CREATE OR REPLACE FUNCTION dup (inout f2 anyelement, out f3 anyarray) +AS 'select $1, array[$1,$1]' LANGUAGE sql; +SELECT dup(22); + +DROP FUNCTION dup(anyelement); + +-- fails, no way to deduce outputs +CREATE FUNCTION bad (f1 int, out f2 anyelement, out f3 anyarray) +AS 'select $1, array[$1,$1]' LANGUAGE sql; + +CREATE FUNCTION dup (f1 anycompatible, f2 anycompatiblearray, f3 out anycompatible, f4 out anycompatiblearray) +AS 'select $1, $2' LANGUAGE sql; +SELECT dup(22, array[44]); +SELECT dup(4.5, array[44]); +SELECT dup(22, array[44::bigint]); +SELECT *, pg_typeof(f3), pg_typeof(f4) FROM dup(22, array[44::bigint]); + +DROP FUNCTION dup(f1 anycompatible, f2 anycompatiblearray); + +CREATE FUNCTION dup (f1 anycompatiblerange, f2 out anycompatible, f3 out anycompatiblearray, f4 out anycompatiblerange) +AS 'select lower($1), array[lower($1), upper($1)], $1' LANGUAGE sql; +SELECT dup(int4range(4,7)); +SELECT dup(numrange(4,7)); +SELECT dup(textrange('aaa', 'bbb')); + +DROP FUNCTION dup(f1 anycompatiblerange); + +-- fails, no way to deduce outputs +CREATE FUNCTION bad (f1 anyarray, out f2 anycompatible, out f3 anycompatiblearray) +AS 'select $1, array[$1,$1]' LANGUAGE sql; + +-- +-- table functions +-- + +CREATE OR REPLACE FUNCTION rngfunc() +RETURNS TABLE(a int) +AS $$ SELECT a FROM generate_series(1,5) a(a) $$ LANGUAGE sql; +SELECT * FROM rngfunc(); +DROP FUNCTION rngfunc(); + +CREATE OR REPLACE FUNCTION rngfunc(int) +RETURNS TABLE(a int, b int) +AS $$ SELECT a, b + FROM generate_series(1,$1) a(a), + generate_series(1,$1) b(b) $$ LANGUAGE sql; +SELECT * FROM rngfunc(3); +DROP FUNCTION rngfunc(int); + +-- case that causes change of typmod knowledge during inlining +CREATE OR REPLACE FUNCTION rngfunc() +RETURNS TABLE(a varchar(5)) +AS $$ SELECT 'hello'::varchar(5) $$ LANGUAGE sql STABLE; +SELECT * FROM rngfunc() GROUP BY 1; +DROP FUNCTION rngfunc(); + +-- +-- some tests on SQL functions with RETURNING +-- + +create temp table tt(f1 serial, data text); + +create function insert_tt(text) returns int as +$$ insert into tt(data) values($1) returning f1 $$ +language sql; + +select insert_tt('foo'); +select insert_tt('bar'); +select * from tt; + +-- insert will execute to completion even if function needs just 1 row +create or replace function insert_tt(text) returns int as +$$ insert into tt(data) values($1),($1||$1) returning f1 $$ +language sql; + +select insert_tt('fool'); +select * from tt; + +-- setof does what's expected +create or replace function insert_tt2(text,text) returns setof int as +$$ insert into tt(data) values($1),($2) returning f1 $$ +language sql; + +select insert_tt2('foolish','barrish'); +select * from insert_tt2('baz','quux'); +select * from tt; + +-- limit doesn't prevent execution to completion +select insert_tt2('foolish','barrish') limit 1; +select * from tt; + +-- triggers will fire, too +create function noticetrigger() returns trigger as $$ +begin + raise notice 'noticetrigger % %', new.f1, new.data; + return null; +end $$ language plpgsql; +create trigger tnoticetrigger after insert on tt for each row +execute procedure noticetrigger(); + +select insert_tt2('foolme','barme') limit 1; +select * from tt; + +-- and rules work +create temp table tt_log(f1 int, data text); + +create rule insert_tt_rule as on insert to tt do also + insert into tt_log values(new.*); + +select insert_tt2('foollog','barlog') limit 1; +select * from tt; +-- note that nextval() gets executed a second time in the rule expansion, +-- which is expected. +select * from tt_log; + +-- test case for a whole-row-variable bug +create function rngfunc1(n integer, out a text, out b text) + returns setof record + language sql + as $$ select 'foo ' || i, 'bar ' || i from generate_series(1,$1) i $$; + +set work_mem='64kB'; +select t.a, t, t.a from rngfunc1(10000) t limit 1; +reset work_mem; +select t.a, t, t.a from rngfunc1(10000) t limit 1; + +drop function rngfunc1(n integer); + +-- test use of SQL functions returning record +-- this is supported in some cases where the query doesn't specify +-- the actual record type ... + +create function array_to_set(anyarray) returns setof record as $$ + select i AS "index", $1[i] AS "value" from generate_subscripts($1, 1) i +$$ language sql strict immutable; + +select array_to_set(array['one', 'two']); +select * from array_to_set(array['one', 'two']) as t(f1 int,f2 text); +select * from array_to_set(array['one', 'two']); -- fail +-- after-the-fact coercion of the columns is now possible, too +select * from array_to_set(array['one', 'two']) as t(f1 numeric(4,2),f2 text); +-- and if it doesn't work, you get a compile-time not run-time error +select * from array_to_set(array['one', 'two']) as t(f1 point,f2 text); + +-- with "strict", this function can't be inlined in FROM +explain (verbose, costs off) + select * from array_to_set(array['one', 'two']) as t(f1 numeric(4,2),f2 text); + +-- but without, it can be: + +create or replace function array_to_set(anyarray) returns setof record as $$ + select i AS "index", $1[i] AS "value" from generate_subscripts($1, 1) i +$$ language sql immutable; + +select array_to_set(array['one', 'two']); +select * from array_to_set(array['one', 'two']) as t(f1 int,f2 text); +select * from array_to_set(array['one', 'two']) as t(f1 numeric(4,2),f2 text); +select * from array_to_set(array['one', 'two']) as t(f1 point,f2 text); +explain (verbose, costs off) + select * from array_to_set(array['one', 'two']) as t(f1 numeric(4,2),f2 text); + +create temp table rngfunc(f1 int8, f2 int8); + +create function testrngfunc() returns record as $$ + insert into rngfunc values (1,2) returning *; +$$ language sql; + +select testrngfunc(); +select * from testrngfunc() as t(f1 int8,f2 int8); +select * from testrngfunc(); -- fail + +drop function testrngfunc(); + +create function testrngfunc() returns setof record as $$ + insert into rngfunc values (1,2), (3,4) returning *; +$$ language sql; + +select testrngfunc(); +select * from testrngfunc() as t(f1 int8,f2 int8); +select * from testrngfunc(); -- fail + +drop function testrngfunc(); + +-- Check that typmod imposed by a composite type is honored +create type rngfunc_type as (f1 numeric(35,6), f2 numeric(35,2)); + +create function testrngfunc() returns rngfunc_type as $$ + select 7.136178319899999964, 7.136178319899999964; +$$ language sql immutable; + +explain (verbose, costs off) +select testrngfunc(); +select testrngfunc(); +explain (verbose, costs off) +select * from testrngfunc(); +select * from testrngfunc(); + +create or replace function testrngfunc() returns rngfunc_type as $$ + select 7.136178319899999964, 7.136178319899999964; +$$ language sql volatile; + +explain (verbose, costs off) +select testrngfunc(); +select testrngfunc(); +explain (verbose, costs off) +select * from testrngfunc(); +select * from testrngfunc(); + +drop function testrngfunc(); + +create function testrngfunc() returns setof rngfunc_type as $$ + select 7.136178319899999964, 7.136178319899999964; +$$ language sql immutable; + +explain (verbose, costs off) +select testrngfunc(); +select testrngfunc(); +explain (verbose, costs off) +select * from testrngfunc(); +select * from testrngfunc(); + +create or replace function testrngfunc() returns setof rngfunc_type as $$ + select 7.136178319899999964, 7.136178319899999964; +$$ language sql volatile; + +explain (verbose, costs off) +select testrngfunc(); +select testrngfunc(); +explain (verbose, costs off) +select * from testrngfunc(); +select * from testrngfunc(); + +drop type rngfunc_type cascade; + +-- +-- Check some cases involving added/dropped columns in a rowtype result +-- + +create temp table users (userid text, seq int, email text, todrop bool, moredrop int, enabled bool); +insert into users values ('id',1,'email',true,11,true); +insert into users values ('id2',2,'email2',true,12,true); +alter table users drop column todrop; + +create or replace function get_first_user() returns users as +$$ SELECT * FROM users ORDER BY userid LIMIT 1; $$ +language sql stable; + +SELECT get_first_user(); +SELECT * FROM get_first_user(); + +create or replace function get_users() returns setof users as +$$ SELECT * FROM users ORDER BY userid; $$ +language sql stable; + +SELECT get_users(); +SELECT * FROM get_users(); +SELECT * FROM get_users() WITH ORDINALITY; -- make sure ordinality copes + +-- multiple functions vs. dropped columns +SELECT * FROM ROWS FROM(generate_series(10,11), get_users()) WITH ORDINALITY; +SELECT * FROM ROWS FROM(get_users(), generate_series(10,11)) WITH ORDINALITY; + +-- check that we can cope with post-parsing changes in rowtypes +create temp view usersview as +SELECT * FROM ROWS FROM(get_users(), generate_series(10,11)) WITH ORDINALITY; + +select * from usersview; +alter table users add column junk text; +select * from usersview; +begin; +alter table users drop column moredrop; +select * from usersview; -- expect clean failure +rollback; +alter table users alter column seq type numeric; +select * from usersview; -- expect clean failure + +drop view usersview; +drop function get_first_user(); +drop function get_users(); +drop table users; + +-- check behavior with type coercion required for a set-op + +create or replace function rngfuncbar() returns setof text as +$$ select 'foo'::varchar union all select 'bar'::varchar ; $$ +language sql stable; + +select rngfuncbar(); +select * from rngfuncbar(); +-- this function is now inlinable, too: +explain (verbose, costs off) select * from rngfuncbar(); + +drop function rngfuncbar(); + +-- check handling of a SQL function with multiple OUT params (bug #5777) + +create or replace function rngfuncbar(out integer, out numeric) as +$$ select (1, 2.1) $$ language sql; + +select * from rngfuncbar(); + +create or replace function rngfuncbar(out integer, out numeric) as +$$ select (1, 2) $$ language sql; + +select * from rngfuncbar(); -- fail + +create or replace function rngfuncbar(out integer, out numeric) as +$$ select (1, 2.1, 3) $$ language sql; + +select * from rngfuncbar(); -- fail + +drop function rngfuncbar(); + +-- check whole-row-Var handling in nested lateral functions (bug #11703) + +create function extractq2(t int8_tbl) returns int8 as $$ + select t.q2 +$$ language sql immutable; + +explain (verbose, costs off) +select x from int8_tbl, extractq2(int8_tbl) f(x); + +select x from int8_tbl, extractq2(int8_tbl) f(x); + +create function extractq2_2(t int8_tbl) returns table(ret1 int8) as $$ + select extractq2(t) offset 0 +$$ language sql immutable; + +explain (verbose, costs off) +select x from int8_tbl, extractq2_2(int8_tbl) f(x); + +select x from int8_tbl, extractq2_2(int8_tbl) f(x); + +-- without the "offset 0", this function gets optimized quite differently + +create function extractq2_2_opt(t int8_tbl) returns table(ret1 int8) as $$ + select extractq2(t) +$$ language sql immutable; + +explain (verbose, costs off) +select x from int8_tbl, extractq2_2_opt(int8_tbl) f(x); + +select x from int8_tbl, extractq2_2_opt(int8_tbl) f(x); + +-- check handling of nulls in SRF results (bug #7808) + +create type rngfunc2 as (a integer, b text); + +select *, row_to_json(u) from unnest(array[(1,'foo')::rngfunc2, null::rngfunc2]) u; +select *, row_to_json(u) from unnest(array[null::rngfunc2, null::rngfunc2]) u; +select *, row_to_json(u) from unnest(array[null::rngfunc2, (1,'foo')::rngfunc2, null::rngfunc2]) u; +select *, row_to_json(u) from unnest(array[]::rngfunc2[]) u; + +drop type rngfunc2; diff --git a/postgresql/examples/rangetypes.sql b/postgresql/examples/rangetypes.sql new file mode 100644 index 0000000..d63507d --- /dev/null +++ b/postgresql/examples/rangetypes.sql @@ -0,0 +1,565 @@ +-- Tests for range data types. + +create type textrange as range (subtype=text, collation="C"); + +-- +-- test input parser +-- + +-- negative tests; should fail +select ''::textrange; +select '-[a,z)'::textrange; +select '[a,z) - '::textrange; +select '(",a)'::textrange; +select '(,,a)'::textrange; +select '(),a)'::textrange; +select '(a,))'::textrange; +select '(],a)'::textrange; +select '(a,])'::textrange; +select '[z,a]'::textrange; + +-- should succeed +select ' empty '::textrange; +select ' ( empty, empty ) '::textrange; +select ' ( " a " " a ", " z " " z " ) '::textrange; +select '(,z)'::textrange; +select '(a,)'::textrange; +select '[,z]'::textrange; +select '[a,]'::textrange; +select '(,)'::textrange; +select '[ , ]'::textrange; +select '["",""]'::textrange; +select '[",",","]'::textrange; +select '["\\","\\"]'::textrange; +select '(\\,a)'::textrange; +select '((,z)'::textrange; +select '([,z)'::textrange; +select '(!,()'::textrange; +select '(!,[)'::textrange; +select '[a,a]'::textrange; +-- these are allowed but normalize to empty: +select '[a,a)'::textrange; +select '(a,a]'::textrange; +select '(a,a)'::textrange; + +-- +-- create some test data and test the operators +-- + +CREATE TABLE numrange_test (nr NUMRANGE); +create index numrange_test_btree on numrange_test(nr); + +INSERT INTO numrange_test VALUES('[,)'); +INSERT INTO numrange_test VALUES('[3,]'); +INSERT INTO numrange_test VALUES('[, 5)'); +INSERT INTO numrange_test VALUES(numrange(1.1, 2.2)); +INSERT INTO numrange_test VALUES('empty'); +INSERT INTO numrange_test VALUES(numrange(1.7, 1.7, '[]')); + +SELECT nr, isempty(nr), lower(nr), upper(nr) FROM numrange_test; +SELECT nr, lower_inc(nr), lower_inf(nr), upper_inc(nr), upper_inf(nr) FROM numrange_test; + +SELECT * FROM numrange_test WHERE range_contains(nr, numrange(1.9,1.91)); +SELECT * FROM numrange_test WHERE nr @> numrange(1.0,10000.1); +SELECT * FROM numrange_test WHERE range_contained_by(numrange(-1e7,-10000.1), nr); +SELECT * FROM numrange_test WHERE 1.9 <@ nr; + +select * from numrange_test where nr = 'empty'; +select * from numrange_test where nr = '(1.1, 2.2)'; +select * from numrange_test where nr = '[1.1, 2.2)'; +select * from numrange_test where nr < 'empty'; +select * from numrange_test where nr < numrange(-1000.0, -1000.0,'[]'); +select * from numrange_test where nr < numrange(0.0, 1.0,'[]'); +select * from numrange_test where nr < numrange(1000.0, 1001.0,'[]'); +select * from numrange_test where nr <= 'empty'; +select * from numrange_test where nr >= 'empty'; +select * from numrange_test where nr > 'empty'; +select * from numrange_test where nr > numrange(-1001.0, -1000.0,'[]'); +select * from numrange_test where nr > numrange(0.0, 1.0,'[]'); +select * from numrange_test where nr > numrange(1000.0, 1000.0,'[]'); + +select numrange(2.0, 1.0); + +select numrange(2.0, 3.0) -|- numrange(3.0, 4.0); +select range_adjacent(numrange(2.0, 3.0), numrange(3.1, 4.0)); +select range_adjacent(numrange(2.0, 3.0), numrange(3.1, null)); +select numrange(2.0, 3.0, '[]') -|- numrange(3.0, 4.0, '()'); +select numrange(1.0, 2.0) -|- numrange(2.0, 3.0,'[]'); +select range_adjacent(numrange(2.0, 3.0, '(]'), numrange(1.0, 2.0, '(]')); + +select numrange(1.1, 3.3) <@ numrange(0.1,10.1); +select numrange(0.1, 10.1) <@ numrange(1.1,3.3); + +select numrange(1.1, 2.2) - numrange(2.0, 3.0); +select numrange(1.1, 2.2) - numrange(2.2, 3.0); +select numrange(1.1, 2.2,'[]') - numrange(2.0, 3.0); +select range_minus(numrange(10.1,12.2,'[]'), numrange(110.0,120.2,'(]')); +select range_minus(numrange(10.1,12.2,'[]'), numrange(0.0,120.2,'(]')); + +select numrange(4.5, 5.5, '[]') && numrange(5.5, 6.5); +select numrange(3.0, 70.0) &< numrange(6.6, 100.0); + +select numrange(1.1, 2.2) < numrange(1.0, 200.2); +select numrange(1.1, 2.2) < numrange(1.1, 1.2); + +select numrange(1.0, 2.0) + numrange(2.0, 3.0); +select numrange(1.0, 2.0) + numrange(1.5, 3.0); +select numrange(1.0, 2.0) + numrange(2.5, 3.0); -- should fail + +select range_merge(numrange(1.0, 2.0), numrange(2.0, 3.0)); +select range_merge(numrange(1.0, 2.0), numrange(1.5, 3.0)); +select range_merge(numrange(1.0, 2.0), numrange(2.5, 3.0)); -- shouldn't fail + +select numrange(1.0, 2.0) * numrange(2.0, 3.0); +select numrange(1.0, 2.0) * numrange(1.5, 3.0); +select numrange(1.0, 2.0) * numrange(2.5, 3.0); + +create table numrange_test2(nr numrange); +create index numrange_test2_hash_idx on numrange_test2 using hash (nr); + +INSERT INTO numrange_test2 VALUES('[, 5)'); +INSERT INTO numrange_test2 VALUES(numrange(1.1, 2.2)); +INSERT INTO numrange_test2 VALUES(numrange(1.1, 2.2)); +INSERT INTO numrange_test2 VALUES(numrange(1.1, 2.2,'()')); +INSERT INTO numrange_test2 VALUES('empty'); + +select * from numrange_test2 where nr = 'empty'::numrange; +select * from numrange_test2 where nr = numrange(1.1, 2.2); +select * from numrange_test2 where nr = numrange(1.1, 2.3); + +set enable_nestloop=t; +set enable_hashjoin=f; +set enable_mergejoin=f; +select * from numrange_test natural join numrange_test2 order by nr; +set enable_nestloop=f; +set enable_hashjoin=t; +set enable_mergejoin=f; +select * from numrange_test natural join numrange_test2 order by nr; +set enable_nestloop=f; +set enable_hashjoin=f; +set enable_mergejoin=t; +select * from numrange_test natural join numrange_test2 order by nr; + +set enable_nestloop to default; +set enable_hashjoin to default; +set enable_mergejoin to default; + +-- keep numrange_test around to help exercise dump/reload +DROP TABLE numrange_test2; + +-- +-- Apply a subset of the above tests on a collatable type, too +-- + +CREATE TABLE textrange_test (tr textrange); +create index textrange_test_btree on textrange_test(tr); + +INSERT INTO textrange_test VALUES('[,)'); +INSERT INTO textrange_test VALUES('["a",]'); +INSERT INTO textrange_test VALUES('[,"q")'); +INSERT INTO textrange_test VALUES(textrange('b', 'g')); +INSERT INTO textrange_test VALUES('empty'); +INSERT INTO textrange_test VALUES(textrange('d', 'd', '[]')); + +SELECT tr, isempty(tr), lower(tr), upper(tr) FROM textrange_test; +SELECT tr, lower_inc(tr), lower_inf(tr), upper_inc(tr), upper_inf(tr) FROM textrange_test; + +SELECT * FROM textrange_test WHERE range_contains(tr, textrange('f', 'fx')); +SELECT * FROM textrange_test WHERE tr @> textrange('a', 'z'); +SELECT * FROM textrange_test WHERE range_contained_by(textrange('0','9'), tr); +SELECT * FROM textrange_test WHERE 'e'::text <@ tr; + +select * from textrange_test where tr = 'empty'; +select * from textrange_test where tr = '("b","g")'; +select * from textrange_test where tr = '["b","g")'; +select * from textrange_test where tr < 'empty'; + + +-- test canonical form for int4range +select int4range(1, 10, '[]'); +select int4range(1, 10, '[)'); +select int4range(1, 10, '(]'); +select int4range(1, 10, '()'); +select int4range(1, 2, '()'); + +-- test canonical form for daterange +select daterange('2000-01-10'::date, '2000-01-20'::date, '[]'); +select daterange('2000-01-10'::date, '2000-01-20'::date, '[)'); +select daterange('2000-01-10'::date, '2000-01-20'::date, '(]'); +select daterange('2000-01-10'::date, '2000-01-20'::date, '()'); +select daterange('2000-01-10'::date, '2000-01-11'::date, '()'); +select daterange('2000-01-10'::date, '2000-01-11'::date, '(]'); +select daterange('-infinity'::date, '2000-01-01'::date, '()'); +select daterange('-infinity'::date, '2000-01-01'::date, '[)'); +select daterange('2000-01-01'::date, 'infinity'::date, '[)'); +select daterange('2000-01-01'::date, 'infinity'::date, '[]'); + +-- test GiST index that's been built incrementally +create table test_range_gist(ir int4range); +create index test_range_gist_idx on test_range_gist using gist (ir); + +insert into test_range_gist select int4range(g, g+10) from generate_series(1,2000) g; +insert into test_range_gist select 'empty'::int4range from generate_series(1,500) g; +insert into test_range_gist select int4range(g, g+10000) from generate_series(1,1000) g; +insert into test_range_gist select 'empty'::int4range from generate_series(1,500) g; +insert into test_range_gist select int4range(NULL,g*10,'(]') from generate_series(1,100) g; +insert into test_range_gist select int4range(g*10,NULL,'(]') from generate_series(1,100) g; +insert into test_range_gist select int4range(g, g+10) from generate_series(1,2000) g; + +-- first, verify non-indexed results +SET enable_seqscan = t; +SET enable_indexscan = f; +SET enable_bitmapscan = f; + +select count(*) from test_range_gist where ir @> 'empty'::int4range; +select count(*) from test_range_gist where ir = int4range(10,20); +select count(*) from test_range_gist where ir @> 10; +select count(*) from test_range_gist where ir @> int4range(10,20); +select count(*) from test_range_gist where ir && int4range(10,20); +select count(*) from test_range_gist where ir <@ int4range(10,50); +select count(*) from test_range_gist where ir &< int4range(100,500); +select count(*) from test_range_gist where ir &> int4range(100,500); +select count(*) from test_range_gist where ir -|- int4range(100,500); + +-- now check same queries using index +SET enable_seqscan = f; +SET enable_indexscan = t; +SET enable_bitmapscan = f; + +select count(*) from test_range_gist where ir @> 'empty'::int4range; +select count(*) from test_range_gist where ir = int4range(10,20); +select count(*) from test_range_gist where ir @> 10; +select count(*) from test_range_gist where ir @> int4range(10,20); +select count(*) from test_range_gist where ir && int4range(10,20); +select count(*) from test_range_gist where ir <@ int4range(10,50); +select count(*) from test_range_gist where ir &< int4range(100,500); +select count(*) from test_range_gist where ir &> int4range(100,500); +select count(*) from test_range_gist where ir -|- int4range(100,500); + +-- now check same queries using a bulk-loaded index +drop index test_range_gist_idx; +create index test_range_gist_idx on test_range_gist using gist (ir); + +select count(*) from test_range_gist where ir @> 'empty'::int4range; +select count(*) from test_range_gist where ir = int4range(10,20); +select count(*) from test_range_gist where ir @> 10; +select count(*) from test_range_gist where ir @> int4range(10,20); +select count(*) from test_range_gist where ir && int4range(10,20); +select count(*) from test_range_gist where ir <@ int4range(10,50); +select count(*) from test_range_gist where ir &< int4range(100,500); +select count(*) from test_range_gist where ir &> int4range(100,500); +select count(*) from test_range_gist where ir -|- int4range(100,500); + +-- test SP-GiST index that's been built incrementally +create table test_range_spgist(ir int4range); +create index test_range_spgist_idx on test_range_spgist using spgist (ir); + +insert into test_range_spgist select int4range(g, g+10) from generate_series(1,2000) g; +insert into test_range_spgist select 'empty'::int4range from generate_series(1,500) g; +insert into test_range_spgist select int4range(g, g+10000) from generate_series(1,1000) g; +insert into test_range_spgist select 'empty'::int4range from generate_series(1,500) g; +insert into test_range_spgist select int4range(NULL,g*10,'(]') from generate_series(1,100) g; +insert into test_range_spgist select int4range(g*10,NULL,'(]') from generate_series(1,100) g; +insert into test_range_spgist select int4range(g, g+10) from generate_series(1,2000) g; + +-- first, verify non-indexed results +SET enable_seqscan = t; +SET enable_indexscan = f; +SET enable_bitmapscan = f; + +select count(*) from test_range_spgist where ir @> 'empty'::int4range; +select count(*) from test_range_spgist where ir = int4range(10,20); +select count(*) from test_range_spgist where ir @> 10; +select count(*) from test_range_spgist where ir @> int4range(10,20); +select count(*) from test_range_spgist where ir && int4range(10,20); +select count(*) from test_range_spgist where ir <@ int4range(10,50); +select count(*) from test_range_spgist where ir &< int4range(100,500); +select count(*) from test_range_spgist where ir &> int4range(100,500); +select count(*) from test_range_spgist where ir -|- int4range(100,500); + +-- now check same queries using index +SET enable_seqscan = f; +SET enable_indexscan = t; +SET enable_bitmapscan = f; + +select count(*) from test_range_spgist where ir @> 'empty'::int4range; +select count(*) from test_range_spgist where ir = int4range(10,20); +select count(*) from test_range_spgist where ir @> 10; +select count(*) from test_range_spgist where ir @> int4range(10,20); +select count(*) from test_range_spgist where ir && int4range(10,20); +select count(*) from test_range_spgist where ir <@ int4range(10,50); +select count(*) from test_range_spgist where ir &< int4range(100,500); +select count(*) from test_range_spgist where ir &> int4range(100,500); +select count(*) from test_range_spgist where ir -|- int4range(100,500); + +-- now check same queries using a bulk-loaded index +drop index test_range_spgist_idx; +create index test_range_spgist_idx on test_range_spgist using spgist (ir); + +select count(*) from test_range_spgist where ir @> 'empty'::int4range; +select count(*) from test_range_spgist where ir = int4range(10,20); +select count(*) from test_range_spgist where ir @> 10; +select count(*) from test_range_spgist where ir @> int4range(10,20); +select count(*) from test_range_spgist where ir && int4range(10,20); +select count(*) from test_range_spgist where ir <@ int4range(10,50); +select count(*) from test_range_spgist where ir &< int4range(100,500); +select count(*) from test_range_spgist where ir &> int4range(100,500); +select count(*) from test_range_spgist where ir -|- int4range(100,500); + +-- test index-only scans +explain (costs off) +select ir from test_range_spgist where ir -|- int4range(10,20) order by ir; +select ir from test_range_spgist where ir -|- int4range(10,20) order by ir; + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; + +-- test elem <@ range operator +create table test_range_elem(i int4); +create index test_range_elem_idx on test_range_elem (i); +insert into test_range_elem select i from generate_series(1,100) i; + +select count(*) from test_range_elem where i <@ int4range(10,50); + +drop table test_range_elem; + +-- +-- Btree_gist is not included by default, so to test exclusion +-- constraints with range types, use singleton int ranges for the "=" +-- portion of the constraint. +-- + +create table test_range_excl( + room int4range, + speaker int4range, + during tsrange, + exclude using gist (room with =, during with &&), + exclude using gist (speaker with =, during with &&) +); + +insert into test_range_excl + values(int4range(123, 123, '[]'), int4range(1, 1, '[]'), '[2010-01-02 10:00, 2010-01-02 11:00)'); +insert into test_range_excl + values(int4range(123, 123, '[]'), int4range(2, 2, '[]'), '[2010-01-02 11:00, 2010-01-02 12:00)'); +insert into test_range_excl + values(int4range(123, 123, '[]'), int4range(3, 3, '[]'), '[2010-01-02 10:10, 2010-01-02 11:00)'); +insert into test_range_excl + values(int4range(124, 124, '[]'), int4range(3, 3, '[]'), '[2010-01-02 10:10, 2010-01-02 11:10)'); +insert into test_range_excl + values(int4range(125, 125, '[]'), int4range(1, 1, '[]'), '[2010-01-02 10:10, 2010-01-02 11:00)'); + +-- test bigint ranges +select int8range(10000000000::int8, 20000000000::int8,'(]'); +-- test tstz ranges +set timezone to '-08'; +select '[2010-01-01 01:00:00 -05, 2010-01-01 02:00:00 -08)'::tstzrange; +-- should fail +select '[2010-01-01 01:00:00 -08, 2010-01-01 02:00:00 -05)'::tstzrange; +set timezone to default; + +-- +-- Test user-defined range of floats +-- + +--should fail +create type float8range as range (subtype=float8, subtype_diff=float4mi); + +--should succeed +create type float8range as range (subtype=float8, subtype_diff=float8mi); +select '[123.001, 5.e9)'::float8range @> 888.882::float8; +create table float8range_test(f8r float8range, i int); +insert into float8range_test values(float8range(-100.00007, '1.111113e9'), 42); +select * from float8range_test; +drop table float8range_test; + +-- +-- Test range types over domains +-- + +create domain mydomain as int4; +create type mydomainrange as range(subtype=mydomain); +select '[4,50)'::mydomainrange @> 7::mydomain; +drop domain mydomain; -- fail +drop domain mydomain cascade; + +-- +-- Test domains over range types +-- + +create domain restrictedrange as int4range check (upper(value) < 10); +select '[4,5)'::restrictedrange @> 7; +select '[4,50)'::restrictedrange @> 7; -- should fail +drop domain restrictedrange; + +-- +-- Test multiple range types over the same subtype +-- + +create type textrange1 as range(subtype=text, collation="C"); +create type textrange2 as range(subtype=text, collation="C"); + +select textrange1('a','Z') @> 'b'::text; +select textrange2('a','z') @> 'b'::text; + +drop type textrange1; +drop type textrange2; + +-- +-- Test polymorphic type system +-- + +create function anyarray_anyrange_func(a anyarray, r anyrange) + returns anyelement as 'select $1[1] + lower($2);' language sql; + +select anyarray_anyrange_func(ARRAY[1,2], int4range(10,20)); + +-- should fail +select anyarray_anyrange_func(ARRAY[1,2], numrange(10,20)); + +drop function anyarray_anyrange_func(anyarray, anyrange); + +-- should fail +create function bogus_func(anyelement) + returns anyrange as 'select int4range(1,10)' language sql; + +-- should fail +create function bogus_func(int) + returns anyrange as 'select int4range(1,10)' language sql; + +create function range_add_bounds(anyrange) + returns anyelement as 'select lower($1) + upper($1)' language sql; + +select range_add_bounds(int4range(1, 17)); +select range_add_bounds(numrange(1.0001, 123.123)); + +create function rangetypes_sql(q anyrange, b anyarray, out c anyelement) + as $$ select upper($1) + $2[1] $$ + language sql; + +select rangetypes_sql(int4range(1,10), ARRAY[2,20]); +select rangetypes_sql(numrange(1,10), ARRAY[2,20]); -- match failure + +create function anycompatiblearray_anycompatiblerange_func(a anycompatiblearray, r anycompatiblerange) + returns anycompatible as 'select $1[1] + lower($2);' language sql; + +select anycompatiblearray_anycompatiblerange_func(ARRAY[1,2], int4range(10,20)); + +select anycompatiblearray_anycompatiblerange_func(ARRAY[1,2], numrange(10,20)); + +-- should fail +select anycompatiblearray_anycompatiblerange_func(ARRAY[1.1,2], int4range(10,20)); + +drop function anycompatiblearray_anycompatiblerange_func(anycompatiblearray, anycompatiblerange); + +-- should fail +create function bogus_func(anycompatible) + returns anycompatiblerange as 'select int4range(1,10)' language sql; + +-- +-- Arrays of ranges +-- + +select ARRAY[numrange(1.1, 1.2), numrange(12.3, 155.5)]; + +create table i8r_array (f1 int, f2 int8range[]); +insert into i8r_array values (42, array[int8range(1,10), int8range(2,20)]); +select * from i8r_array; +drop table i8r_array; + +-- +-- Ranges of arrays +-- + +create type arrayrange as range (subtype=int4[]); + +select arrayrange(ARRAY[1,2], ARRAY[2,1]); +select arrayrange(ARRAY[2,1], ARRAY[1,2]); -- fail + +select array[1,1] <@ arrayrange(array[1,2], array[2,1]); +select array[1,3] <@ arrayrange(array[1,2], array[2,1]); + +-- +-- Ranges of composites +-- + +create type two_ints as (a int, b int); +create type two_ints_range as range (subtype = two_ints); + +-- with force_parallel_mode on, this exercises tqueue.c's range remapping +select *, row_to_json(upper(t)) as u from + (values (two_ints_range(row(1,2), row(3,4))), + (two_ints_range(row(5,6), row(7,8)))) v(t); + +-- this must be rejected to avoid self-inclusion issues: +alter type two_ints add attribute c two_ints_range; + +drop type two_ints cascade; + +-- +-- Check behavior when subtype lacks a hash function +-- + +create type cashrange as range (subtype = money); + +set enable_sort = off; -- try to make it pick a hash setop implementation + +select '(2,5)'::cashrange except select '(5,6)'::cashrange; + +reset enable_sort; + +-- +-- OUT/INOUT/TABLE functions +-- + +create function outparam_succeed(i anyrange, out r anyrange, out t text) + as $$ select $1, 'foo'::text $$ language sql; + +select * from outparam_succeed(int4range(1,2)); + +create function outparam2_succeed(r anyrange, out lu anyarray, out ul anyarray) + as $$ select array[lower($1), upper($1)], array[upper($1), lower($1)] $$ + language sql; + +select * from outparam2_succeed(int4range(1,11)); + +create function inoutparam_succeed(out i anyelement, inout r anyrange) + as $$ select upper($1), $1 $$ language sql; + +select * from inoutparam_succeed(int4range(1,2)); + +create function table_succeed(r anyrange) + returns table(l anyelement, u anyelement) + as $$ select lower($1), upper($1) $$ + language sql; + +select * from table_succeed(int4range(1,11)); + +-- should fail +create function outparam_fail(i anyelement, out r anyrange, out t text) + as $$ select '[1,10]', 'foo' $$ language sql; + +--should fail +create function inoutparam_fail(inout i anyelement, out r anyrange) + as $$ select $1, '[1,10]' $$ language sql; + +--should fail +create function table_fail(i anyelement) returns table(i anyelement, r anyrange) + as $$ select $1, '[1,10]' $$ language sql; +select numrange(1.0, 2.0) << numrange(3.0, 4.0); +select numrange(1.0, 3.0,'[]') << numrange(3.0, 4.0,'[]'); +select numrange(1.0, 3.0,'()') << numrange(3.0, 4.0,'()'); +select numrange(1.0, 2.0) >> numrange(3.0, 4.0); + +select count(*) from test_range_gist where ir << int4range(100,500); +select count(*) from test_range_gist where ir >> int4range(100,500); +select count(*) from test_range_gist where ir << int4range(100,500); +select count(*) from test_range_gist where ir >> int4range(100,500); +select count(*) from test_range_gist where ir << int4range(100,500); +select count(*) from test_range_gist where ir >> int4range(100,500); +select count(*) from test_range_spgist where ir << int4range(100,500); +select count(*) from test_range_spgist where ir >> int4range(100,500); +select count(*) from test_range_spgist where ir << int4range(100,500); +select count(*) from test_range_spgist where ir >> int4range(100,500); +select count(*) from test_range_spgist where ir << int4range(100,500); +select count(*) from test_range_spgist where ir >> int4range(100,500); diff --git a/postgresql/examples/regex.sql b/postgresql/examples/regex.sql new file mode 100644 index 0000000..a174224 --- /dev/null +++ b/postgresql/examples/regex.sql @@ -0,0 +1,141 @@ +-- +-- Regular expression tests +-- + +-- Don't want to have to double backslashes in regexes +set standard_conforming_strings = on; + +-- Test simple quantified backrefs +select 'bbbbb' ~ '^([bc])\1*$' as t; +select 'ccc' ~ '^([bc])\1*$' as t; +select 'xxx' ~ '^([bc])\1*$' as f; +select 'bbc' ~ '^([bc])\1*$' as f; +select 'b' ~ '^([bc])\1*$' as t; + +-- Test quantified backref within a larger expression +select 'abc abc abc' ~ '^(\w+)( \1)+$' as t; +select 'abc abd abc' ~ '^(\w+)( \1)+$' as f; +select 'abc abc abd' ~ '^(\w+)( \1)+$' as f; +select 'abc abc abc' ~ '^(.+)( \1)+$' as t; +select 'abc abd abc' ~ '^(.+)( \1)+$' as f; +select 'abc abc abd' ~ '^(.+)( \1)+$' as f; + +-- Test some cases that crashed in 9.2beta1 due to pmatch[] array overrun +select substring('asd TO foo' from ' TO (([a-z0-9._]+|"([^"]+|"")+")+)'); +select substring('a' from '((a))+'); +select substring('a' from '((a)+)'); + +-- Test regexp_match() +select regexp_match('abc', ''); +select regexp_match('abc', 'bc'); +select regexp_match('abc', 'd') is null; +select regexp_match('abc', '(B)(c)', 'i'); +select regexp_match('abc', 'Bd', 'ig'); -- error + +-- Test lookahead constraints +select regexp_matches('ab', 'a(?=b)b*'); +select regexp_matches('a', 'a(?=b)b*'); +select regexp_matches('abc', 'a(?=b)b*(?=c)c*'); +select regexp_matches('ab', 'a(?=b)b*(?=c)c*'); +select regexp_matches('ab', 'a(?!b)b*'); +select regexp_matches('a', 'a(?!b)b*'); +select regexp_matches('b', '(?=b)b'); +select regexp_matches('a', '(?=b)b'); + +-- Test lookbehind constraints +select regexp_matches('abb', '(?<=a)b*'); +select regexp_matches('a', 'a(?<=a)b*'); +select regexp_matches('abc', 'a(?<=a)b*(?<=b)c*'); +select regexp_matches('ab', 'a(?<=a)b*(?<=b)c*'); +select regexp_matches('ab', 'a*(? 0; + +SELECT reloptions FROM pg_class WHERE oid = + (SELECT reltoastrelid FROM pg_class + WHERE oid = 'reloptions_test'::regclass); + +ALTER TABLE reloptions_test RESET (vacuum_truncate); +SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass; +INSERT INTO reloptions_test VALUES (1, NULL), (NULL, NULL); +VACUUM reloptions_test; +SELECT pg_relation_size('reloptions_test') = 0; + +-- Test toast.* options +DROP TABLE reloptions_test; + +CREATE TABLE reloptions_test (s VARCHAR) + WITH (toast.autovacuum_vacuum_cost_delay = 23); + +ALTER TABLE reloptions_test SET (toast.autovacuum_vacuum_cost_delay = 24); + + +ALTER TABLE reloptions_test RESET (toast.autovacuum_vacuum_cost_delay); + + +-- Fail on non-existent options in toast namespace +CREATE TABLE reloptions_test2 (i int) WITH (toast.not_existing_option = 42); + +-- Mix TOAST & heap +DROP TABLE reloptions_test; + +CREATE TABLE reloptions_test (s VARCHAR) WITH + (toast.autovacuum_vacuum_cost_delay = 23, + autovacuum_vacuum_cost_delay = 24, fillfactor = 40); + +SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass; +SELECT reloptions FROM pg_class WHERE oid = ( + SELECT reltoastrelid FROM pg_class WHERE oid = 'reloptions_test'::regclass); + +-- +-- CREATE INDEX, ALTER INDEX for btrees +-- + +CREATE INDEX reloptions_test_idx ON reloptions_test (s) WITH (fillfactor=30); +SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test_idx'::regclass; + +-- Fail when option and namespace do not exist +CREATE INDEX reloptions_test_idx ON reloptions_test (s) + WITH (not_existing_option=2); +CREATE INDEX reloptions_test_idx ON reloptions_test (s) + WITH (not_existing_ns.fillfactor=2); + +-- Check allowed ranges +CREATE INDEX reloptions_test_idx2 ON reloptions_test (s) WITH (fillfactor=1); +CREATE INDEX reloptions_test_idx2 ON reloptions_test (s) WITH (fillfactor=130); + +-- Check ALTER +ALTER INDEX reloptions_test_idx SET (fillfactor=40); +SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test_idx'::regclass; + +-- Check ALTER on empty reloption list +CREATE INDEX reloptions_test_idx3 ON reloptions_test (s); +ALTER INDEX reloptions_test_idx3 SET (fillfactor=40); +SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test_idx3'::regclass; + + +SELECT reltoastrelid as toast_oid + FROM pg_class WHERE oid = 'reloptions_test'::regclass \gset +SELECT reloptions FROM pg_class WHERE oid = :toast_oid; + + + +SELECT reloptions FROM pg_class WHERE oid = :toast_oid; +SELECT reloptions FROM pg_class WHERE oid = :toast_oid; diff --git a/postgresql/examples/replica_identity.sql b/postgresql/examples/replica_identity.sql new file mode 100644 index 0000000..a5ac8f5 --- /dev/null +++ b/postgresql/examples/replica_identity.sql @@ -0,0 +1,100 @@ +CREATE TABLE test_replica_identity ( + id serial primary key, + keya text not null, + keyb text not null, + nonkey text, + CONSTRAINT test_replica_identity_unique_defer UNIQUE (keya, keyb) DEFERRABLE, + CONSTRAINT test_replica_identity_unique_nondefer UNIQUE (keya, keyb) +) ; + +CREATE TABLE test_replica_identity_othertable (id serial primary key); + +CREATE INDEX test_replica_identity_keyab ON test_replica_identity (keya, keyb); +CREATE UNIQUE INDEX test_replica_identity_keyab_key ON test_replica_identity (keya, keyb); +CREATE UNIQUE INDEX test_replica_identity_nonkey ON test_replica_identity (keya, nonkey); +CREATE INDEX test_replica_identity_hash ON test_replica_identity USING hash (nonkey); +CREATE UNIQUE INDEX test_replica_identity_expr ON test_replica_identity (keya, keyb, (3)); +CREATE UNIQUE INDEX test_replica_identity_partial ON test_replica_identity (keya, keyb) WHERE keyb != '3'; + +-- default is 'd'/DEFAULT for user created tables +SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; +-- but 'none' for system tables +SELECT relreplident FROM pg_class WHERE oid = 'pg_class'::regclass; +SELECT relreplident FROM pg_class WHERE oid = 'pg_constraint'::regclass; + +---- +-- Make sure we detect ineligible indexes +---- + +-- fail, not unique +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_keyab; +-- fail, not a candidate key, nullable column +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_nonkey; +-- fail, hash indexes cannot do uniqueness +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_hash; +-- fail, expression index +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_expr; +-- fail, partial index +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_partial; +-- fail, not our index +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_othertable_pkey; +-- fail, deferrable +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_unique_defer; + +SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; + +---- +-- Make sure index cases succeed +---- + +-- succeed, primary key +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_pkey; +SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; +\d test_replica_identity + +-- succeed, nondeferrable unique constraint over nonnullable cols +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_unique_nondefer; + +-- succeed unique index over nonnullable cols +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_keyab_key; +ALTER TABLE test_replica_identity REPLICA IDENTITY USING INDEX test_replica_identity_keyab_key; +SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; +\d test_replica_identity +SELECT count(*) FROM pg_index WHERE indrelid = 'test_replica_identity'::regclass AND indisreplident; + +---- +-- Make sure non index cases work +---- +ALTER TABLE test_replica_identity REPLICA IDENTITY DEFAULT; +SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; +SELECT count(*) FROM pg_index WHERE indrelid = 'test_replica_identity'::regclass AND indisreplident; + +ALTER TABLE test_replica_identity REPLICA IDENTITY FULL; +SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; +\d+ test_replica_identity +ALTER TABLE test_replica_identity REPLICA IDENTITY NOTHING; +SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass; + +--- +-- Test that ALTER TABLE rewrite preserves nondefault replica identity +--- + +-- constraint variant +CREATE TABLE test_replica_identity2 (id int UNIQUE NOT NULL); +ALTER TABLE test_replica_identity2 REPLICA IDENTITY USING INDEX test_replica_identity2_id_key; +\d test_replica_identity2 +ALTER TABLE test_replica_identity2 ALTER COLUMN id TYPE bigint; +\d test_replica_identity2 + +-- straight index variant +CREATE TABLE test_replica_identity3 (id int NOT NULL); +CREATE UNIQUE INDEX test_replica_identity3_id_key ON test_replica_identity3 (id); +ALTER TABLE test_replica_identity3 REPLICA IDENTITY USING INDEX test_replica_identity3_id_key; +\d test_replica_identity3 +ALTER TABLE test_replica_identity3 ALTER COLUMN id TYPE bigint; +\d test_replica_identity3 + +DROP TABLE test_replica_identity; +DROP TABLE test_replica_identity2; +DROP TABLE test_replica_identity3; +DROP TABLE test_replica_identity_othertable; diff --git a/postgresql/examples/returning.sql b/postgresql/examples/returning.sql new file mode 100644 index 0000000..a460f82 --- /dev/null +++ b/postgresql/examples/returning.sql @@ -0,0 +1,162 @@ +-- +-- Test INSERT/UPDATE/DELETE RETURNING +-- + +-- Simple cases + +CREATE TEMP TABLE foo (f1 serial, f2 text, f3 int default 42); + +INSERT INTO foo (f2,f3) + VALUES ('test', DEFAULT), ('More', 11), (upper('more'), 7+9) + RETURNING *, f1+f3 AS sum; + +SELECT * FROM foo; + +UPDATE foo SET f2 = lower(f2), f3 = DEFAULT RETURNING foo.*, f1+f3 AS sum13; + +SELECT * FROM foo; + +DELETE FROM foo WHERE f1 > 2 RETURNING f3, f2, f1, least(f1,f3); + +SELECT * FROM foo; + +-- Subplans and initplans in the RETURNING list + +INSERT INTO foo SELECT f1+10, f2, f3+99 FROM foo + RETURNING *, f1+112 IN (SELECT q1 FROM int8_tbl) AS subplan, + EXISTS(SELECT * FROM int4_tbl) AS initplan; + +UPDATE foo SET f3 = f3 * 2 + WHERE f1 > 10 + RETURNING *, f1+112 IN (SELECT q1 FROM int8_tbl) AS subplan, + EXISTS(SELECT * FROM int4_tbl) AS initplan; + +DELETE FROM foo + WHERE f1 > 10 + RETURNING *, f1+112 IN (SELECT q1 FROM int8_tbl) AS subplan, + EXISTS(SELECT * FROM int4_tbl) AS initplan; + +-- Joins + +UPDATE foo SET f3 = f3*2 + FROM int4_tbl i + WHERE foo.f1 + 123455 = i.f1 + RETURNING foo.*, i.f1 as "i.f1"; + +SELECT * FROM foo; + +DELETE FROM foo + USING int4_tbl i + WHERE foo.f1 + 123455 = i.f1 + RETURNING foo.*, i.f1 as "i.f1"; + +SELECT * FROM foo; + +-- Check inheritance cases + +CREATE TEMP TABLE foochild (fc int) INHERITS (foo); + +INSERT INTO foochild VALUES(123,'child',999,-123); + +ALTER TABLE foo ADD COLUMN f4 int8 DEFAULT 99; + +SELECT * FROM foo; +SELECT * FROM foochild; + +UPDATE foo SET f4 = f4 + f3 WHERE f4 = 99 RETURNING *; + +SELECT * FROM foo; +SELECT * FROM foochild; + +UPDATE foo SET f3 = f3*2 + FROM int8_tbl i + WHERE foo.f1 = i.q2 + RETURNING *; + +SELECT * FROM foo; +SELECT * FROM foochild; + +DELETE FROM foo + USING int8_tbl i + WHERE foo.f1 = i.q2 + RETURNING *; + +SELECT * FROM foo; +SELECT * FROM foochild; + +DROP TABLE foochild; + +-- Rules and views + +CREATE TEMP VIEW voo AS SELECT f1, f2 FROM foo; + +CREATE RULE voo_i AS ON INSERT TO voo DO INSTEAD + INSERT INTO foo VALUES(new.*, 57); + +INSERT INTO voo VALUES(11,'zit'); +-- fails: +INSERT INTO voo VALUES(12,'zoo') RETURNING *, f1*2; + +-- fails, incompatible list: +CREATE OR REPLACE RULE voo_i AS ON INSERT TO voo DO INSTEAD + INSERT INTO foo VALUES(new.*, 57) RETURNING *; + +CREATE OR REPLACE RULE voo_i AS ON INSERT TO voo DO INSTEAD + INSERT INTO foo VALUES(new.*, 57) RETURNING f1, f2; + +-- should still work +INSERT INTO voo VALUES(13,'zit2'); +-- works now +INSERT INTO voo VALUES(14,'zoo2') RETURNING *; + +SELECT * FROM foo; +SELECT * FROM voo; + +CREATE OR REPLACE RULE voo_u AS ON UPDATE TO voo DO INSTEAD + UPDATE foo SET f1 = new.f1, f2 = new.f2 WHERE f1 = old.f1 + RETURNING f1, f2; + +update voo set f1 = f1 + 1 where f2 = 'zoo2'; +update voo set f1 = f1 + 1 where f2 = 'zoo2' RETURNING *, f1*2; + +SELECT * FROM foo; +SELECT * FROM voo; + +CREATE OR REPLACE RULE voo_d AS ON DELETE TO voo DO INSTEAD + DELETE FROM foo WHERE f1 = old.f1 + RETURNING f1, f2; + +DELETE FROM foo WHERE f1 = 13; +DELETE FROM foo WHERE f2 = 'zit' RETURNING *; + +SELECT * FROM foo; +SELECT * FROM voo; + +-- Try a join case + +CREATE TEMP TABLE joinme (f2j text, other int); +INSERT INTO joinme VALUES('more', 12345); +INSERT INTO joinme VALUES('zoo2', 54321); +INSERT INTO joinme VALUES('other', 0); + +CREATE TEMP VIEW joinview AS + SELECT foo.*, other FROM foo JOIN joinme ON (f2 = f2j); + +SELECT * FROM joinview; + +CREATE RULE joinview_u AS ON UPDATE TO joinview DO INSTEAD + UPDATE foo SET f1 = new.f1, f3 = new.f3 + FROM joinme WHERE f2 = f2j AND f2 = old.f2 + RETURNING foo.*, other; + +UPDATE joinview SET f1 = f1 + 1 WHERE f3 = 57 RETURNING *, other + 1; + +SELECT * FROM joinview; +SELECT * FROM foo; +SELECT * FROM voo; + +-- Check aliased target relation +INSERT INTO foo AS bar DEFAULT VALUES RETURNING *; -- ok +INSERT INTO foo AS bar DEFAULT VALUES RETURNING foo.*; -- fails, wrong name +INSERT INTO foo AS bar DEFAULT VALUES RETURNING bar.*; -- ok +INSERT INTO foo AS bar DEFAULT VALUES RETURNING bar.f3; -- ok diff --git a/postgresql/examples/roleattributes.sql b/postgresql/examples/roleattributes.sql new file mode 100644 index 0000000..c961b2d --- /dev/null +++ b/postgresql/examples/roleattributes.sql @@ -0,0 +1,98 @@ +-- default for superuser is false +CREATE ROLE regress_test_def_superuser; + +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_def_superuser'; +CREATE ROLE regress_test_superuser WITH SUPERUSER; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_superuser'; +ALTER ROLE regress_test_superuser WITH NOSUPERUSER; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_superuser'; +ALTER ROLE regress_test_superuser WITH SUPERUSER; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_superuser'; + +-- default for inherit is true +CREATE ROLE regress_test_def_inherit; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_def_inherit'; +CREATE ROLE regress_test_inherit WITH NOINHERIT; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_inherit'; +ALTER ROLE regress_test_inherit WITH INHERIT; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_inherit'; +ALTER ROLE regress_test_inherit WITH NOINHERIT; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_inherit'; + +-- default for create role is false +CREATE ROLE regress_test_def_createrole; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_def_createrole'; +CREATE ROLE regress_test_createrole WITH CREATEROLE; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_createrole'; +ALTER ROLE regress_test_createrole WITH NOCREATEROLE; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_createrole'; +ALTER ROLE regress_test_createrole WITH CREATEROLE; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_createrole'; + +-- default for create database is false +CREATE ROLE regress_test_def_createdb; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_def_createdb'; +CREATE ROLE regress_test_createdb WITH CREATEDB; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_createdb'; +ALTER ROLE regress_test_createdb WITH NOCREATEDB; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_createdb'; +ALTER ROLE regress_test_createdb WITH CREATEDB; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_createdb'; + +-- default for can login is false for role +CREATE ROLE regress_test_def_role_canlogin; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_def_role_canlogin'; +CREATE ROLE regress_test_role_canlogin WITH LOGIN; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_role_canlogin'; +ALTER ROLE regress_test_role_canlogin WITH NOLOGIN; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_role_canlogin'; +ALTER ROLE regress_test_role_canlogin WITH LOGIN; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_role_canlogin'; + +-- default for can login is true for user +CREATE USER regress_test_def_user_canlogin; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_def_user_canlogin'; +CREATE USER regress_test_user_canlogin WITH NOLOGIN; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_user_canlogin'; +ALTER USER regress_test_user_canlogin WITH LOGIN; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_user_canlogin'; +ALTER USER regress_test_user_canlogin WITH NOLOGIN; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_user_canlogin'; + +-- default for replication is false +CREATE ROLE regress_test_def_replication; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_def_replication'; +CREATE ROLE regress_test_replication WITH REPLICATION; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_replication'; +ALTER ROLE regress_test_replication WITH NOREPLICATION; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_replication'; +ALTER ROLE regress_test_replication WITH REPLICATION; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_replication'; + +-- default for bypassrls is false +CREATE ROLE regress_test_def_bypassrls; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_def_bypassrls'; +CREATE ROLE regress_test_bypassrls WITH BYPASSRLS; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_bypassrls'; +ALTER ROLE regress_test_bypassrls WITH NOBYPASSRLS; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_bypassrls'; +ALTER ROLE regress_test_bypassrls WITH BYPASSRLS; +SELECT rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolreplication, rolbypassrls, rolconnlimit, rolpassword, rolvaliduntil FROM pg_authid WHERE rolname = 'regress_test_bypassrls'; + +-- clean up roles +DROP ROLE regress_test_def_superuser; +DROP ROLE regress_test_superuser; +DROP ROLE regress_test_def_inherit; +DROP ROLE regress_test_inherit; +DROP ROLE regress_test_def_createrole; +DROP ROLE regress_test_createrole; +DROP ROLE regress_test_def_createdb; +DROP ROLE regress_test_createdb; +DROP ROLE regress_test_def_role_canlogin; +DROP ROLE regress_test_role_canlogin; +DROP USER regress_test_def_user_canlogin; +DROP USER regress_test_user_canlogin; +DROP ROLE regress_test_def_replication; +DROP ROLE regress_test_replication; +DROP ROLE regress_test_def_bypassrls; +DROP ROLE regress_test_bypassrls; diff --git a/postgresql/examples/rowsecurity.sql b/postgresql/examples/rowsecurity.sql new file mode 100644 index 0000000..5888f97 --- /dev/null +++ b/postgresql/examples/rowsecurity.sql @@ -0,0 +1,1834 @@ +-- +-- Test of Row-level security feature +-- + +-- Clean up in case a prior regression run failed + +-- Suppress NOTICE messages when users/groups don't exist +SET client_min_messages TO 'warning'; + +DROP USER IF EXISTS regress_rls_alice; +DROP USER IF EXISTS regress_rls_bob; +DROP USER IF EXISTS regress_rls_carol; +DROP USER IF EXISTS regress_rls_dave; +DROP USER IF EXISTS regress_rls_exempt_user; +DROP ROLE IF EXISTS regress_rls_group1; +DROP ROLE IF EXISTS regress_rls_group2; + +DROP SCHEMA IF EXISTS regress_rls_schema CASCADE; + +RESET client_min_messages; + +-- initial setup +CREATE USER regress_rls_alice NOLOGIN; +CREATE USER regress_rls_bob NOLOGIN; +CREATE USER regress_rls_carol NOLOGIN; +CREATE USER regress_rls_dave NOLOGIN; +CREATE USER regress_rls_exempt_user BYPASSRLS NOLOGIN; +CREATE ROLE regress_rls_group1 NOLOGIN; +CREATE ROLE regress_rls_group2 NOLOGIN; + +GRANT regress_rls_group1 TO regress_rls_bob; +GRANT regress_rls_group2 TO regress_rls_carol; + +CREATE SCHEMA regress_rls_schema; +GRANT ALL ON SCHEMA regress_rls_schema to public; +SET search_path = regress_rls_schema; + +-- setup of malicious function +CREATE OR REPLACE FUNCTION f_leak(text) RETURNS bool + COST 0.0000001 LANGUAGE plpgsql + AS 'BEGIN RAISE NOTICE ''f_leak => %'', $1; RETURN true; END'; +GRANT EXECUTE ON FUNCTION f_leak(text) TO public; + +-- BASIC Row-Level Security Scenario + +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE uaccount ( + pguser name primary key, + seclv int +); +GRANT SELECT ON uaccount TO public; +INSERT INTO uaccount VALUES + ('regress_rls_alice', 99), + ('regress_rls_bob', 1), + ('regress_rls_carol', 2), + ('regress_rls_dave', 3); + +CREATE TABLE category ( + cid int primary key, + cname text +); +GRANT ALL ON category TO public; +INSERT INTO category VALUES + (11, 'novel'), + (22, 'science fiction'), + (33, 'technology'), + (44, 'manga'); + +CREATE TABLE document ( + did int primary key, + cid int references category(cid), + dlevel int not null, + dauthor name, + dtitle text +); +GRANT ALL ON document TO public; +INSERT INTO document VALUES + ( 1, 11, 1, 'regress_rls_bob', 'my first novel'), + ( 2, 11, 2, 'regress_rls_bob', 'my second novel'), + ( 3, 22, 2, 'regress_rls_bob', 'my science fiction'), + ( 4, 44, 1, 'regress_rls_bob', 'my first manga'), + ( 5, 44, 2, 'regress_rls_bob', 'my second manga'), + ( 6, 22, 1, 'regress_rls_carol', 'great science fiction'), + ( 7, 33, 2, 'regress_rls_carol', 'great technology book'), + ( 8, 44, 1, 'regress_rls_carol', 'great manga'), + ( 9, 22, 1, 'regress_rls_dave', 'awesome science fiction'), + (10, 33, 2, 'regress_rls_dave', 'awesome technology book'); + +ALTER TABLE document ENABLE ROW LEVEL SECURITY; + +-- user's security level must be higher than or equal to document's +CREATE POLICY p1 ON document AS PERMISSIVE + USING (dlevel <= (SELECT seclv FROM uaccount WHERE pguser = current_user)); + +-- try to create a policy of bogus type +CREATE POLICY p1 ON document AS UGLY + USING (dlevel <= (SELECT seclv FROM uaccount WHERE pguser = current_user)); + +-- but Dave isn't allowed to anything at cid 50 or above +-- this is to make sure that we sort the policies by name first +-- when applying WITH CHECK, a later INSERT by Dave should fail due +-- to p1r first +CREATE POLICY p2r ON document AS RESTRICTIVE TO regress_rls_dave + USING (cid <> 44 AND cid < 50); + +-- and Dave isn't allowed to see manga documents +CREATE POLICY p1r ON document AS RESTRICTIVE TO regress_rls_dave + USING (cid <> 44); + +\dp +\d document +SELECT * FROM pg_policies WHERE schemaname = 'regress_rls_schema' AND tablename = 'document' ORDER BY policyname; + +-- viewpoint from regress_rls_bob +SET SESSION AUTHORIZATION regress_rls_bob; +SET row_security TO ON; +SELECT * FROM document WHERE f_leak(dtitle) ORDER BY did; +SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle) ORDER BY did; + +-- try a sampled version +SELECT * FROM document TABLESAMPLE BERNOULLI(50) REPEATABLE(0) + WHERE f_leak(dtitle) ORDER BY did; + +-- viewpoint from regress_rls_carol +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM document WHERE f_leak(dtitle) ORDER BY did; +SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle) ORDER BY did; + +-- try a sampled version +SELECT * FROM document TABLESAMPLE BERNOULLI(50) REPEATABLE(0) + WHERE f_leak(dtitle) ORDER BY did; + +EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle); +EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle); + +-- viewpoint from regress_rls_dave +SET SESSION AUTHORIZATION regress_rls_dave; +SELECT * FROM document WHERE f_leak(dtitle) ORDER BY did; +SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle) ORDER BY did; + +EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle); +EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle); + +-- 44 would technically fail for both p2r and p1r, but we should get an error +-- back from p1r for this because it sorts first +INSERT INTO document VALUES (100, 44, 1, 'regress_rls_dave', 'testing sorting of policies'); -- fail +-- Just to see a p2r error +INSERT INTO document VALUES (100, 55, 1, 'regress_rls_dave', 'testing sorting of policies'); -- fail + +-- only owner can change policies +ALTER POLICY p1 ON document USING (true); --fail +DROP POLICY p1 ON document; --fail + +SET SESSION AUTHORIZATION regress_rls_alice; +ALTER POLICY p1 ON document USING (dauthor = current_user); + +-- viewpoint from regress_rls_bob again +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM document WHERE f_leak(dtitle) ORDER BY did; +SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle) ORDER by did; + +-- viewpoint from rls_regres_carol again +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM document WHERE f_leak(dtitle) ORDER BY did; +SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle) ORDER by did; + +EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle); +EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle); + +-- interaction of FK/PK constraints +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE POLICY p2 ON category + USING (CASE WHEN current_user = 'regress_rls_bob' THEN cid IN (11, 33) + WHEN current_user = 'regress_rls_carol' THEN cid IN (22, 44) + ELSE false END); + +ALTER TABLE category ENABLE ROW LEVEL SECURITY; + +-- cannot delete PK referenced by invisible FK +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM document d FULL OUTER JOIN category c on d.cid = c.cid ORDER BY d.did, c.cid; +DELETE FROM category WHERE cid = 33; -- fails with FK violation + +-- can insert FK referencing invisible PK +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM document d FULL OUTER JOIN category c on d.cid = c.cid ORDER BY d.did, c.cid; +INSERT INTO document VALUES (11, 33, 1, current_user, 'hoge'); + +-- UNIQUE or PRIMARY KEY constraint violation DOES reveal presence of row +SET SESSION AUTHORIZATION regress_rls_bob; +INSERT INTO document VALUES (8, 44, 1, 'regress_rls_bob', 'my third manga'); -- Must fail with unique violation, revealing presence of did we can't see +SELECT * FROM document WHERE did = 8; -- and confirm we can't see it + +-- RLS policies are checked before constraints +INSERT INTO document VALUES (8, 44, 1, 'regress_rls_carol', 'my third manga'); -- Should fail with RLS check violation, not duplicate key violation +UPDATE document SET did = 8, dauthor = 'regress_rls_carol' WHERE did = 5; -- Should fail with RLS check violation, not duplicate key violation + +-- database superuser does bypass RLS policy when enabled +RESET SESSION AUTHORIZATION; +SET row_security TO ON; +SELECT * FROM document; +SELECT * FROM category; + +-- database superuser does bypass RLS policy when disabled +RESET SESSION AUTHORIZATION; +SET row_security TO OFF; +SELECT * FROM document; +SELECT * FROM category; + +-- database non-superuser with bypass privilege can bypass RLS policy when disabled +SET SESSION AUTHORIZATION regress_rls_exempt_user; +SET row_security TO OFF; +SELECT * FROM document; +SELECT * FROM category; + +-- RLS policy does not apply to table owner when RLS enabled. +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security TO ON; +SELECT * FROM document; +SELECT * FROM category; + +-- RLS policy does not apply to table owner when RLS disabled. +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security TO OFF; +SELECT * FROM document; +SELECT * FROM category; + +-- +-- Table inheritance and RLS policy +-- +SET SESSION AUTHORIZATION regress_rls_alice; + +SET row_security TO ON; + +CREATE TABLE t1 (id int not null primary key, a int, junk1 text, b text); +ALTER TABLE t1 DROP COLUMN junk1; -- just a disturbing factor +GRANT ALL ON t1 TO public; + +COPY t1 FROM stdin WITH ; + +CREATE TABLE t2 (c float) INHERITS (t1); +GRANT ALL ON t2 TO public; + +COPY t2 FROM stdin; + +CREATE TABLE t3 (id int not null primary key, c text, b text, a int); +ALTER TABLE t3 INHERIT t1; +GRANT ALL ON t3 TO public; + +COPY t3(id, a,b,c) FROM stdin; + +CREATE POLICY p1 ON t1 FOR ALL TO PUBLIC USING (a % 2 = 0); -- be even number +CREATE POLICY p2 ON t2 FOR ALL TO PUBLIC USING (a % 2 = 1); -- be odd number + +ALTER TABLE t1 ENABLE ROW LEVEL SECURITY; +ALTER TABLE t2 ENABLE ROW LEVEL SECURITY; + +SET SESSION AUTHORIZATION regress_rls_bob; + +SELECT * FROM t1; +EXPLAIN (COSTS OFF) SELECT * FROM t1; + +SELECT * FROM t1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b); + +-- reference to system column +SELECT tableoid::regclass, * FROM t1; +EXPLAIN (COSTS OFF) SELECT *, t1 FROM t1; + +-- reference to whole-row reference +SELECT *, t1 FROM t1; +EXPLAIN (COSTS OFF) SELECT *, t1 FROM t1; + +-- for share/update lock +SELECT * FROM t1 FOR SHARE; +EXPLAIN (COSTS OFF) SELECT * FROM t1 FOR SHARE; + +SELECT * FROM t1 WHERE f_leak(b) FOR SHARE; +EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b) FOR SHARE; + +-- union all query +SELECT a, b, tableoid::regclass FROM t2 UNION ALL SELECT a, b, tableoid::regclass FROM t3; +EXPLAIN (COSTS OFF) SELECT a, b, tableoid::regclass FROM t2 UNION ALL SELECT a, b, tableoid::regclass FROM t3; + +-- superuser is allowed to bypass RLS checks +RESET SESSION AUTHORIZATION; +SET row_security TO OFF; +SELECT * FROM t1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b); + +-- non-superuser with bypass privilege can bypass RLS policy when disabled +SET SESSION AUTHORIZATION regress_rls_exempt_user; +SET row_security TO OFF; +SELECT * FROM t1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b); + +-- +-- Partitioned Tables +-- + +SET SESSION AUTHORIZATION regress_rls_alice; + +CREATE TABLE part_document ( + did int, + cid int, + dlevel int not null, + dauthor name, + dtitle text +) PARTITION BY RANGE (cid); +GRANT ALL ON part_document TO public; + +-- Create partitions for document categories +CREATE TABLE part_document_fiction PARTITION OF part_document FOR VALUES FROM (11) to (12); +CREATE TABLE part_document_satire PARTITION OF part_document FOR VALUES FROM (55) to (56); +CREATE TABLE part_document_nonfiction PARTITION OF part_document FOR VALUES FROM (99) to (100); + +GRANT ALL ON part_document_fiction TO public; +GRANT ALL ON part_document_satire TO public; +GRANT ALL ON part_document_nonfiction TO public; + +INSERT INTO part_document VALUES + ( 1, 11, 1, 'regress_rls_bob', 'my first novel'), + ( 2, 11, 2, 'regress_rls_bob', 'my second novel'), + ( 3, 99, 2, 'regress_rls_bob', 'my science textbook'), + ( 4, 55, 1, 'regress_rls_bob', 'my first satire'), + ( 5, 99, 2, 'regress_rls_bob', 'my history book'), + ( 6, 11, 1, 'regress_rls_carol', 'great science fiction'), + ( 7, 99, 2, 'regress_rls_carol', 'great technology book'), + ( 8, 55, 2, 'regress_rls_carol', 'great satire'), + ( 9, 11, 1, 'regress_rls_dave', 'awesome science fiction'), + (10, 99, 2, 'regress_rls_dave', 'awesome technology book'); + +ALTER TABLE part_document ENABLE ROW LEVEL SECURITY; + +-- Create policy on parent +-- user's security level must be higher than or equal to document's +CREATE POLICY pp1 ON part_document AS PERMISSIVE + USING (dlevel <= (SELECT seclv FROM uaccount WHERE pguser = current_user)); + +-- Dave is only allowed to see cid < 55 +CREATE POLICY pp1r ON part_document AS RESTRICTIVE TO regress_rls_dave + USING (cid < 55); + +\d+ part_document +SELECT * FROM pg_policies WHERE schemaname = 'regress_rls_schema' AND tablename like '%part_document%' ORDER BY policyname; + +-- viewpoint from regress_rls_bob +SET SESSION AUTHORIZATION regress_rls_bob; +SET row_security TO ON; +SELECT * FROM part_document WHERE f_leak(dtitle) ORDER BY did; +EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); + +-- viewpoint from regress_rls_carol +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM part_document WHERE f_leak(dtitle) ORDER BY did; +EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); + +-- viewpoint from regress_rls_dave +SET SESSION AUTHORIZATION regress_rls_dave; +SELECT * FROM part_document WHERE f_leak(dtitle) ORDER BY did; +EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); + +-- pp1 ERROR +INSERT INTO part_document VALUES (100, 11, 5, 'regress_rls_dave', 'testing pp1'); -- fail +-- pp1r ERROR +INSERT INTO part_document VALUES (100, 99, 1, 'regress_rls_dave', 'testing pp1r'); -- fail + +-- Show that RLS policy does not apply for direct inserts to children +-- This should fail with RLS POLICY pp1r violation. +INSERT INTO part_document VALUES (100, 55, 1, 'regress_rls_dave', 'testing RLS with partitions'); -- fail +-- But this should succeed. +INSERT INTO part_document_satire VALUES (100, 55, 1, 'regress_rls_dave', 'testing RLS with partitions'); -- success +-- We still cannot see the row using the parent +SELECT * FROM part_document WHERE f_leak(dtitle) ORDER BY did; +-- But we can if we look directly +SELECT * FROM part_document_satire WHERE f_leak(dtitle) ORDER BY did; + +-- Turn on RLS and create policy on child to show RLS is checked before constraints +SET SESSION AUTHORIZATION regress_rls_alice; +ALTER TABLE part_document_satire ENABLE ROW LEVEL SECURITY; +CREATE POLICY pp3 ON part_document_satire AS RESTRICTIVE + USING (cid < 55); +-- This should fail with RLS violation now. +SET SESSION AUTHORIZATION regress_rls_dave; +INSERT INTO part_document_satire VALUES (101, 55, 1, 'regress_rls_dave', 'testing RLS with partitions'); -- fail +-- And now we cannot see directly into the partition either, due to RLS +SELECT * FROM part_document_satire WHERE f_leak(dtitle) ORDER BY did; +-- The parent looks same as before +-- viewpoint from regress_rls_dave +SELECT * FROM part_document WHERE f_leak(dtitle) ORDER BY did; +EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); + +-- viewpoint from regress_rls_carol +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM part_document WHERE f_leak(dtitle) ORDER BY did; +EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); + +-- only owner can change policies +ALTER POLICY pp1 ON part_document USING (true); --fail +DROP POLICY pp1 ON part_document; --fail + +SET SESSION AUTHORIZATION regress_rls_alice; +ALTER POLICY pp1 ON part_document USING (dauthor = current_user); + +-- viewpoint from regress_rls_bob again +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM part_document WHERE f_leak(dtitle) ORDER BY did; + +-- viewpoint from rls_regres_carol again +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM part_document WHERE f_leak(dtitle) ORDER BY did; + +EXPLAIN (COSTS OFF) SELECT * FROM part_document WHERE f_leak(dtitle); + +-- database superuser does bypass RLS policy when enabled +RESET SESSION AUTHORIZATION; +SET row_security TO ON; +SELECT * FROM part_document ORDER BY did; +SELECT * FROM part_document_satire ORDER by did; + +-- database non-superuser with bypass privilege can bypass RLS policy when disabled +SET SESSION AUTHORIZATION regress_rls_exempt_user; +SET row_security TO OFF; +SELECT * FROM part_document ORDER BY did; +SELECT * FROM part_document_satire ORDER by did; + +-- RLS policy does not apply to table owner when RLS enabled. +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security TO ON; +SELECT * FROM part_document ORDER by did; +SELECT * FROM part_document_satire ORDER by did; + +-- When RLS disabled, other users get ERROR. +SET SESSION AUTHORIZATION regress_rls_dave; +SET row_security TO OFF; +SELECT * FROM part_document ORDER by did; +SELECT * FROM part_document_satire ORDER by did; + +-- Check behavior with a policy that uses a SubPlan not an InitPlan. +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security TO ON; +CREATE POLICY pp3 ON part_document AS RESTRICTIVE + USING ((SELECT dlevel <= seclv FROM uaccount WHERE pguser = current_user)); + +SET SESSION AUTHORIZATION regress_rls_carol; +INSERT INTO part_document VALUES (100, 11, 5, 'regress_rls_carol', 'testing pp3'); -- fail + +----- Dependencies ----- +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security TO ON; + +CREATE TABLE dependee (x integer, y integer); + +CREATE TABLE dependent (x integer, y integer); +CREATE POLICY d1 ON dependent FOR ALL + TO PUBLIC + USING (x = (SELECT d.x FROM dependee d WHERE d.y = y)); + +DROP TABLE dependee; -- Should fail without CASCADE due to dependency on row security qual? + +DROP TABLE dependee CASCADE; + +EXPLAIN (COSTS OFF) SELECT * FROM dependent; -- After drop, should be unqualified + +----- RECURSION ---- + +-- +-- Simple recursion +-- +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE rec1 (x integer, y integer); +CREATE POLICY r1 ON rec1 USING (x = (SELECT r.x FROM rec1 r WHERE y = r.y)); +ALTER TABLE rec1 ENABLE ROW LEVEL SECURITY; +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM rec1; -- fail, direct recursion + +-- +-- Mutual recursion +-- +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE rec2 (a integer, b integer); +ALTER POLICY r1 ON rec1 USING (x = (SELECT a FROM rec2 WHERE b = y)); +CREATE POLICY r2 ON rec2 USING (a = (SELECT x FROM rec1 WHERE y = b)); +ALTER TABLE rec2 ENABLE ROW LEVEL SECURITY; + +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM rec1; -- fail, mutual recursion + +-- +-- Mutual recursion via views +-- +SET SESSION AUTHORIZATION regress_rls_bob; +CREATE VIEW rec1v AS SELECT * FROM rec1; +CREATE VIEW rec2v AS SELECT * FROM rec2; +SET SESSION AUTHORIZATION regress_rls_alice; +ALTER POLICY r1 ON rec1 USING (x = (SELECT a FROM rec2v WHERE b = y)); +ALTER POLICY r2 ON rec2 USING (a = (SELECT x FROM rec1v WHERE y = b)); + +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM rec1; -- fail, mutual recursion via views + +-- +-- Mutual recursion via .s.b views +-- +SET SESSION AUTHORIZATION regress_rls_bob; + +DROP VIEW rec1v, rec2v CASCADE; + +CREATE VIEW rec1v WITH (security_barrier) AS SELECT * FROM rec1; +CREATE VIEW rec2v WITH (security_barrier) AS SELECT * FROM rec2; +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE POLICY r1 ON rec1 USING (x = (SELECT a FROM rec2v WHERE b = y)); +CREATE POLICY r2 ON rec2 USING (a = (SELECT x FROM rec1v WHERE y = b)); + +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM rec1; -- fail, mutual recursion via s.b. views + +-- +-- recursive RLS and VIEWs in policy +-- +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE s1 (a int, b text); +INSERT INTO s1 (SELECT x, md5(x::text) FROM generate_series(-10,10) x); + +CREATE TABLE s2 (x int, y text); +INSERT INTO s2 (SELECT x, md5(x::text) FROM generate_series(-6,6) x); + +GRANT SELECT ON s1, s2 TO regress_rls_bob; + +CREATE POLICY p1 ON s1 USING (a in (select x from s2 where y like '%2f%')); +CREATE POLICY p2 ON s2 USING (x in (select a from s1 where b like '%22%')); +CREATE POLICY p3 ON s1 FOR INSERT WITH CHECK (a = (SELECT a FROM s1)); + +ALTER TABLE s1 ENABLE ROW LEVEL SECURITY; +ALTER TABLE s2 ENABLE ROW LEVEL SECURITY; + +SET SESSION AUTHORIZATION regress_rls_bob; +CREATE VIEW v2 AS SELECT * FROM s2 WHERE y like '%af%'; +SELECT * FROM s1 WHERE f_leak(b); -- fail (infinite recursion) + +INSERT INTO s1 VALUES (1, 'foo'); -- fail (infinite recursion) + +SET SESSION AUTHORIZATION regress_rls_alice; +DROP POLICY p3 on s1; +ALTER POLICY p2 ON s2 USING (x % 2 = 0); + +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM s1 WHERE f_leak(b); -- OK +EXPLAIN (COSTS OFF) SELECT * FROM only s1 WHERE f_leak(b); + +SET SESSION AUTHORIZATION regress_rls_alice; +ALTER POLICY p1 ON s1 USING (a in (select x from v2)); -- using VIEW in RLS policy +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM s1 WHERE f_leak(b); -- OK +EXPLAIN (COSTS OFF) SELECT * FROM s1 WHERE f_leak(b); + +SELECT (SELECT x FROM s1 LIMIT 1) xx, * FROM s2 WHERE y like '%28%'; +EXPLAIN (COSTS OFF) SELECT (SELECT x FROM s1 LIMIT 1) xx, * FROM s2 WHERE y like '%28%'; + +SET SESSION AUTHORIZATION regress_rls_alice; +ALTER POLICY p2 ON s2 USING (x in (select a from s1 where b like '%d2%')); +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM s1 WHERE f_leak(b); -- fail (infinite recursion via view) + +-- prepared statement with regress_rls_alice privilege +PREPARE p1(int) AS SELECT * FROM t1 WHERE a <= $1; +EXECUTE p1(2); +EXPLAIN (COSTS OFF) EXECUTE p1(2); + +-- superuser is allowed to bypass RLS checks +RESET SESSION AUTHORIZATION; +SET row_security TO OFF; +SELECT * FROM t1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM t1 WHERE f_leak(b); + +-- plan cache should be invalidated +EXECUTE p1(2); +EXPLAIN (COSTS OFF) EXECUTE p1(2); + +PREPARE p2(int) AS SELECT * FROM t1 WHERE a = $1; +EXECUTE p2(2); +EXPLAIN (COSTS OFF) EXECUTE p2(2); + +-- also, case when privilege switch from superuser +SET SESSION AUTHORIZATION regress_rls_bob; +SET row_security TO ON; +EXECUTE p2(2); +EXPLAIN (COSTS OFF) EXECUTE p2(2); + +-- +-- UPDATE / DELETE and Row-level security +-- +SET SESSION AUTHORIZATION regress_rls_bob; +EXPLAIN (COSTS OFF) UPDATE t1 SET b = b || b WHERE f_leak(b); +UPDATE t1 SET b = b || b WHERE f_leak(b); + +EXPLAIN (COSTS OFF) UPDATE only t1 SET b = b || '_updt' WHERE f_leak(b); +UPDATE only t1 SET b = b || '_updt' WHERE f_leak(b); + +-- returning clause with system column +UPDATE only t1 SET b = b WHERE f_leak(b) RETURNING tableoid::regclass, *, t1; +UPDATE t1 SET b = b WHERE f_leak(b) RETURNING *; +UPDATE t1 SET b = b WHERE f_leak(b) RETURNING tableoid::regclass, *, t1; + +-- updates with from clause +EXPLAIN (COSTS OFF) UPDATE t2 SET b=t2.b FROM t3 +WHERE t2.a = 3 and t3.a = 2 AND f_leak(t2.b) AND f_leak(t3.b); + +UPDATE t2 SET b=t2.b FROM t3 +WHERE t2.a = 3 and t3.a = 2 AND f_leak(t2.b) AND f_leak(t3.b); + +EXPLAIN (COSTS OFF) UPDATE t1 SET b=t1.b FROM t2 +WHERE t1.a = 3 and t2.a = 3 AND f_leak(t1.b) AND f_leak(t2.b); + +UPDATE t1 SET b=t1.b FROM t2 +WHERE t1.a = 3 and t2.a = 3 AND f_leak(t1.b) AND f_leak(t2.b); + +EXPLAIN (COSTS OFF) UPDATE t2 SET b=t2.b FROM t1 +WHERE t1.a = 3 and t2.a = 3 AND f_leak(t1.b) AND f_leak(t2.b); + +UPDATE t2 SET b=t2.b FROM t1 +WHERE t1.a = 3 and t2.a = 3 AND f_leak(t1.b) AND f_leak(t2.b); + +-- updates with from clause self join +EXPLAIN (COSTS OFF) UPDATE t2 t2_1 SET b = t2_2.b FROM t2 t2_2 +WHERE t2_1.a = 3 AND t2_2.a = t2_1.a AND t2_2.b = t2_1.b +AND f_leak(t2_1.b) AND f_leak(t2_2.b) RETURNING *, t2_1, t2_2; + +UPDATE t2 t2_1 SET b = t2_2.b FROM t2 t2_2 +WHERE t2_1.a = 3 AND t2_2.a = t2_1.a AND t2_2.b = t2_1.b +AND f_leak(t2_1.b) AND f_leak(t2_2.b) RETURNING *, t2_1, t2_2; + +EXPLAIN (COSTS OFF) UPDATE t1 t1_1 SET b = t1_2.b FROM t1 t1_2 +WHERE t1_1.a = 4 AND t1_2.a = t1_1.a AND t1_2.b = t1_1.b +AND f_leak(t1_1.b) AND f_leak(t1_2.b) RETURNING *, t1_1, t1_2; + +UPDATE t1 t1_1 SET b = t1_2.b FROM t1 t1_2 +WHERE t1_1.a = 4 AND t1_2.a = t1_1.a AND t1_2.b = t1_1.b +AND f_leak(t1_1.b) AND f_leak(t1_2.b) RETURNING *, t1_1, t1_2; + +RESET SESSION AUTHORIZATION; +SET row_security TO OFF; +SELECT * FROM t1 ORDER BY a,b; + +SET SESSION AUTHORIZATION regress_rls_bob; +SET row_security TO ON; +EXPLAIN (COSTS OFF) DELETE FROM only t1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) DELETE FROM t1 WHERE f_leak(b); + +DELETE FROM only t1 WHERE f_leak(b) RETURNING tableoid::regclass, *, t1; +DELETE FROM t1 WHERE f_leak(b) RETURNING tableoid::regclass, *, t1; + +-- +-- S.b. view on top of Row-level security +-- +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE b1 (a int, b text); +INSERT INTO b1 (SELECT x, md5(x::text) FROM generate_series(-10,10) x); + +CREATE POLICY p1 ON b1 USING (a % 2 = 0); +ALTER TABLE b1 ENABLE ROW LEVEL SECURITY; +GRANT ALL ON b1 TO regress_rls_bob; + +SET SESSION AUTHORIZATION regress_rls_bob; +CREATE VIEW bv1 WITH (security_barrier) AS SELECT * FROM b1 WHERE a > 0 WITH CHECK OPTION; +GRANT ALL ON bv1 TO regress_rls_carol; + +SET SESSION AUTHORIZATION regress_rls_carol; + +EXPLAIN (COSTS OFF) SELECT * FROM bv1 WHERE f_leak(b); +SELECT * FROM bv1 WHERE f_leak(b); + +INSERT INTO bv1 VALUES (-1, 'xxx'); -- should fail view WCO +INSERT INTO bv1 VALUES (11, 'xxx'); -- should fail RLS check +INSERT INTO bv1 VALUES (12, 'xxx'); -- ok + +EXPLAIN (COSTS OFF) UPDATE bv1 SET b = 'yyy' WHERE a = 4 AND f_leak(b); +UPDATE bv1 SET b = 'yyy' WHERE a = 4 AND f_leak(b); + +EXPLAIN (COSTS OFF) DELETE FROM bv1 WHERE a = 6 AND f_leak(b); +DELETE FROM bv1 WHERE a = 6 AND f_leak(b); + +SET SESSION AUTHORIZATION regress_rls_alice; +SELECT * FROM b1; +-- +-- INSERT ... ON CONFLICT DO UPDATE and Row-level security +-- + +SET SESSION AUTHORIZATION regress_rls_alice; +DROP POLICY p1 ON document; +DROP POLICY p1r ON document; + +CREATE POLICY p1 ON document FOR SELECT USING (true); +CREATE POLICY p2 ON document FOR INSERT WITH CHECK (dauthor = current_user); +CREATE POLICY p3 ON document FOR UPDATE + USING (cid = (SELECT cid from category WHERE cname = 'novel')) + WITH CHECK (dauthor = current_user); + +SET SESSION AUTHORIZATION regress_rls_bob; + +-- Exists... +SELECT * FROM document WHERE did = 2; + +-- ...so violates actual WITH CHECK OPTION within UPDATE (not INSERT, since +-- alternative UPDATE path happens to be taken): +INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_carol', 'my first novel') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, dauthor = EXCLUDED.dauthor; + +-- Violates USING qual for UPDATE policy p3. +-- +-- UPDATE path is taken, but UPDATE fails purely because *existing* row to be +-- updated is not a "novel"/cid 11 (row is not leaked, even though we have +-- SELECT privileges sufficient to see the row in this instance): +INSERT INTO document VALUES (33, 22, 1, 'regress_rls_bob', 'okay science fiction'); -- preparation for next statement +INSERT INTO document VALUES (33, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_bob', 'Some novel, replaces sci-fi') -- takes UPDATE path + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle; +-- Fine (we UPDATE, since INSERT WCOs and UPDATE security barrier quals + WCOs +-- not violated): +INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_bob', 'my first novel') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle RETURNING *; +-- Fine (we INSERT, so "cid = 33" ("technology") isn't evaluated): +INSERT INTO document VALUES (78, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_bob', 'some technology novel') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, cid = 33 RETURNING *; +-- Fine (same query, but we UPDATE, so "cid = 33", ("technology") is not the +-- case in respect of *existing* tuple): +INSERT INTO document VALUES (78, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_bob', 'some technology novel') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, cid = 33 RETURNING *; +-- Same query a third time, but now fails due to existing tuple finally not +-- passing quals: +INSERT INTO document VALUES (78, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_bob', 'some technology novel') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, cid = 33 RETURNING *; +-- Don't fail just because INSERT doesn't satisfy WITH CHECK option that +-- originated as a barrier/USING() qual from the UPDATE. Note that the UPDATE +-- path *isn't* taken, and so UPDATE-related policy does not apply: +INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'technology'), 1, 'regress_rls_bob', 'technology book, can only insert') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle RETURNING *; +-- But this time, the same statement fails, because the UPDATE path is taken, +-- and updating the row just inserted falls afoul of security barrier qual +-- (enforced as WCO) -- what we might have updated target tuple to is +-- irrelevant, in fact. +INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'technology'), 1, 'regress_rls_bob', 'technology book, can only insert') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle RETURNING *; + +-- Test default USING qual enforced as WCO +SET SESSION AUTHORIZATION regress_rls_alice; +DROP POLICY p1 ON document; +DROP POLICY p2 ON document; +DROP POLICY p3 ON document; + +CREATE POLICY p3_with_default ON document FOR UPDATE + USING (cid = (SELECT cid from category WHERE cname = 'novel')); + +SET SESSION AUTHORIZATION regress_rls_bob; +-- Just because WCO-style enforcement of USING quals occurs with +-- existing/target tuple does not mean that the implementation can be allowed +-- to fail to also enforce this qual against the final tuple appended to +-- relation (since in the absence of an explicit WCO, this is also interpreted +-- as an UPDATE/ALL WCO in general). +-- +-- UPDATE path is taken here (fails due to existing tuple). Note that this is +-- not reported as a "USING expression", because it's an RLS UPDATE check that originated as +-- a USING qual for the purposes of RLS in general, as opposed to an explicit +-- USING qual that is ordinarily a security barrier. We leave it up to the +-- UPDATE to make this fail: +INSERT INTO document VALUES (79, (SELECT cid from category WHERE cname = 'technology'), 1, 'regress_rls_bob', 'technology book, can only insert') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle RETURNING *; + +-- UPDATE path is taken here. Existing tuple passes, since its cid +-- corresponds to "novel", but default USING qual is enforced against +-- post-UPDATE tuple too (as always when updating with a policy that lacks an +-- explicit WCO), and so this fails: +INSERT INTO document VALUES (2, (SELECT cid from category WHERE cname = 'technology'), 1, 'regress_rls_bob', 'my first novel') + ON CONFLICT (did) DO UPDATE SET cid = EXCLUDED.cid, dtitle = EXCLUDED.dtitle RETURNING *; + +SET SESSION AUTHORIZATION regress_rls_alice; +DROP POLICY p3_with_default ON document; + +-- +-- Test ALL policies with ON CONFLICT DO UPDATE (much the same as existing UPDATE +-- tests) +-- +CREATE POLICY p3_with_all ON document FOR ALL + USING (cid = (SELECT cid from category WHERE cname = 'novel')) + WITH CHECK (dauthor = current_user); + +SET SESSION AUTHORIZATION regress_rls_bob; + +-- Fails, since ALL WCO is enforced in insert path: +INSERT INTO document VALUES (80, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_carol', 'my first novel') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle, cid = 33; +-- Fails, since ALL policy USING qual is enforced (existing, target tuple is in +-- violation, since it has the "manga" cid): +INSERT INTO document VALUES (4, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_bob', 'my first novel') + ON CONFLICT (did) DO UPDATE SET dtitle = EXCLUDED.dtitle; +-- Fails, since ALL WCO are enforced: +INSERT INTO document VALUES (1, (SELECT cid from category WHERE cname = 'novel'), 1, 'regress_rls_bob', 'my first novel') + ON CONFLICT (did) DO UPDATE SET dauthor = 'regress_rls_carol'; + +-- +-- ROLE/GROUP +-- +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE z1 (a int, b text); +CREATE TABLE z2 (a int, b text); + +GRANT SELECT ON z1,z2 TO regress_rls_group1, regress_rls_group2, + regress_rls_bob, regress_rls_carol; + +INSERT INTO z1 VALUES + (1, 'aba'), + (2, 'bbb'), + (3, 'ccc'), + (4, 'dad'); + +CREATE POLICY p1 ON z1 TO regress_rls_group1 USING (a % 2 = 0); +CREATE POLICY p2 ON z1 TO regress_rls_group2 USING (a % 2 = 1); + +ALTER TABLE z1 ENABLE ROW LEVEL SECURITY; + +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM z1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM z1 WHERE f_leak(b); + +PREPARE plancache_test AS SELECT * FROM z1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) EXECUTE plancache_test; + +PREPARE plancache_test2 AS WITH q AS MATERIALIZED (SELECT * FROM z1 WHERE f_leak(b)) SELECT * FROM q,z2; +EXPLAIN (COSTS OFF) EXECUTE plancache_test2; + +PREPARE plancache_test3 AS WITH q AS MATERIALIZED (SELECT * FROM z2) SELECT * FROM q,z1 WHERE f_leak(z1.b); +EXPLAIN (COSTS OFF) EXECUTE plancache_test3; + +SET ROLE regress_rls_group1; +SELECT * FROM z1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM z1 WHERE f_leak(b); + +EXPLAIN (COSTS OFF) EXECUTE plancache_test; +EXPLAIN (COSTS OFF) EXECUTE plancache_test2; +EXPLAIN (COSTS OFF) EXECUTE plancache_test3; + +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM z1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM z1 WHERE f_leak(b); + +EXPLAIN (COSTS OFF) EXECUTE plancache_test; +EXPLAIN (COSTS OFF) EXECUTE plancache_test2; +EXPLAIN (COSTS OFF) EXECUTE plancache_test3; + +SET ROLE regress_rls_group2; +SELECT * FROM z1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM z1 WHERE f_leak(b); + +EXPLAIN (COSTS OFF) EXECUTE plancache_test; +EXPLAIN (COSTS OFF) EXECUTE plancache_test2; +EXPLAIN (COSTS OFF) EXECUTE plancache_test3; + +-- +-- Views should follow policy for view owner. +-- +-- View and Table owner are the same. +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE VIEW rls_view AS SELECT * FROM z1 WHERE f_leak(b); +GRANT SELECT ON rls_view TO regress_rls_bob; + +-- Query as role that is not owner of view or table. Should return all records. +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM rls_view; +EXPLAIN (COSTS OFF) SELECT * FROM rls_view; + +-- Query as view/table owner. Should return all records. +SET SESSION AUTHORIZATION regress_rls_alice; +SELECT * FROM rls_view; +EXPLAIN (COSTS OFF) SELECT * FROM rls_view; +DROP VIEW rls_view; + +-- View and Table owners are different. +SET SESSION AUTHORIZATION regress_rls_bob; +CREATE VIEW rls_view AS SELECT * FROM z1 WHERE f_leak(b); +GRANT SELECT ON rls_view TO regress_rls_alice; + +-- Query as role that is not owner of view but is owner of table. +-- Should return records based on view owner policies. +SET SESSION AUTHORIZATION regress_rls_alice; +SELECT * FROM rls_view; +EXPLAIN (COSTS OFF) SELECT * FROM rls_view; + +-- Query as role that is not owner of table but is owner of view. +-- Should return records based on view owner policies. +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM rls_view; +EXPLAIN (COSTS OFF) SELECT * FROM rls_view; + +-- Query as role that is not the owner of the table or view without permissions. +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM rls_view; --fail - permission denied. +EXPLAIN (COSTS OFF) SELECT * FROM rls_view; --fail - permission denied. + +-- Query as role that is not the owner of the table or view with permissions. +SET SESSION AUTHORIZATION regress_rls_bob; +GRANT SELECT ON rls_view TO regress_rls_carol; +SELECT * FROM rls_view; +EXPLAIN (COSTS OFF) SELECT * FROM rls_view; + +SET SESSION AUTHORIZATION regress_rls_bob; +DROP VIEW rls_view; + +-- +-- Command specific +-- +SET SESSION AUTHORIZATION regress_rls_alice; + +CREATE TABLE x1 (a int, b text, c text); +GRANT ALL ON x1 TO PUBLIC; + +INSERT INTO x1 VALUES + (1, 'abc', 'regress_rls_bob'), + (2, 'bcd', 'regress_rls_bob'), + (3, 'cde', 'regress_rls_carol'), + (4, 'def', 'regress_rls_carol'), + (5, 'efg', 'regress_rls_bob'), + (6, 'fgh', 'regress_rls_bob'), + (7, 'fgh', 'regress_rls_carol'), + (8, 'fgh', 'regress_rls_carol'); + +CREATE POLICY p0 ON x1 FOR ALL USING (c = current_user); +CREATE POLICY p1 ON x1 FOR SELECT USING (a % 2 = 0); +CREATE POLICY p2 ON x1 FOR INSERT WITH CHECK (a % 2 = 1); +CREATE POLICY p3 ON x1 FOR UPDATE USING (a % 2 = 0); +CREATE POLICY p4 ON x1 FOR DELETE USING (a < 8); + +ALTER TABLE x1 ENABLE ROW LEVEL SECURITY; + +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM x1 WHERE f_leak(b) ORDER BY a ASC; +UPDATE x1 SET b = b || '_updt' WHERE f_leak(b) RETURNING *; + +SET SESSION AUTHORIZATION regress_rls_carol; +SELECT * FROM x1 WHERE f_leak(b) ORDER BY a ASC; +UPDATE x1 SET b = b || '_updt' WHERE f_leak(b) RETURNING *; +DELETE FROM x1 WHERE f_leak(b) RETURNING *; + +-- +-- Duplicate Policy Names +-- +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE y1 (a int, b text); +CREATE TABLE y2 (a int, b text); + +GRANT ALL ON y1, y2 TO regress_rls_bob; + +CREATE POLICY p1 ON y1 FOR ALL USING (a % 2 = 0); +CREATE POLICY p2 ON y1 FOR SELECT USING (a > 2); +CREATE POLICY p1 ON y1 FOR SELECT USING (a % 2 = 1); --fail +CREATE POLICY p1 ON y2 FOR ALL USING (a % 2 = 0); --OK + +ALTER TABLE y1 ENABLE ROW LEVEL SECURITY; +ALTER TABLE y2 ENABLE ROW LEVEL SECURITY; + +-- +-- Expression structure with SBV +-- +-- Create view as table owner. RLS should NOT be applied. +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE VIEW rls_sbv WITH (security_barrier) AS + SELECT * FROM y1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM rls_sbv WHERE (a = 1); +DROP VIEW rls_sbv; + +-- Create view as role that does not own table. RLS should be applied. +SET SESSION AUTHORIZATION regress_rls_bob; +CREATE VIEW rls_sbv WITH (security_barrier) AS + SELECT * FROM y1 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM rls_sbv WHERE (a = 1); +DROP VIEW rls_sbv; + +-- +-- Expression structure +-- +SET SESSION AUTHORIZATION regress_rls_alice; +INSERT INTO y2 (SELECT x, md5(x::text) FROM generate_series(0,20) x); +CREATE POLICY p2 ON y2 USING (a % 3 = 0); +CREATE POLICY p3 ON y2 USING (a % 4 = 0); + +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM y2 WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM y2 WHERE f_leak(b); + +-- +-- Qual push-down of leaky functions, when not referring to table +-- +SELECT * FROM y2 WHERE f_leak('abc'); +EXPLAIN (COSTS OFF) SELECT * FROM y2 WHERE f_leak('abc'); + +CREATE TABLE test_qual_pushdown ( + abc text +); + +INSERT INTO test_qual_pushdown VALUES ('abc'),('def'); + +SELECT * FROM y2 JOIN test_qual_pushdown ON (b = abc) WHERE f_leak(abc); +EXPLAIN (COSTS OFF) SELECT * FROM y2 JOIN test_qual_pushdown ON (b = abc) WHERE f_leak(abc); + +SELECT * FROM y2 JOIN test_qual_pushdown ON (b = abc) WHERE f_leak(b); +EXPLAIN (COSTS OFF) SELECT * FROM y2 JOIN test_qual_pushdown ON (b = abc) WHERE f_leak(b); + +DROP TABLE test_qual_pushdown; + +-- +-- Plancache invalidate on user change. +-- +RESET SESSION AUTHORIZATION; + +DROP TABLE t1 CASCADE; + +CREATE TABLE t1 (a integer); + +GRANT SELECT ON t1 TO regress_rls_bob, regress_rls_carol; + +CREATE POLICY p1 ON t1 TO regress_rls_bob USING ((a % 2) = 0); +CREATE POLICY p2 ON t1 TO regress_rls_carol USING ((a % 4) = 0); + +ALTER TABLE t1 ENABLE ROW LEVEL SECURITY; + +-- Prepare as regress_rls_bob +SET ROLE regress_rls_bob; +PREPARE role_inval AS SELECT * FROM t1; +-- Check plan +EXPLAIN (COSTS OFF) EXECUTE role_inval; + +-- Change to regress_rls_carol +SET ROLE regress_rls_carol; +-- Check plan- should be different +EXPLAIN (COSTS OFF) EXECUTE role_inval; + +-- Change back to regress_rls_bob +SET ROLE regress_rls_bob; +-- Check plan- should be back to original +EXPLAIN (COSTS OFF) EXECUTE role_inval; + +-- +-- CTE and RLS +-- +RESET SESSION AUTHORIZATION; +DROP TABLE t1 CASCADE; +CREATE TABLE t1 (a integer, b text); +CREATE POLICY p1 ON t1 USING (a % 2 = 0); + +ALTER TABLE t1 ENABLE ROW LEVEL SECURITY; + +GRANT ALL ON t1 TO regress_rls_bob; + +INSERT INTO t1 (SELECT x, md5(x::text) FROM generate_series(0,20) x); + +SET SESSION AUTHORIZATION regress_rls_bob; + +WITH cte1 AS MATERIALIZED (SELECT * FROM t1 WHERE f_leak(b)) SELECT * FROM cte1; +EXPLAIN (COSTS OFF) +WITH cte1 AS MATERIALIZED (SELECT * FROM t1 WHERE f_leak(b)) SELECT * FROM cte1; + +WITH cte1 AS (UPDATE t1 SET a = a + 1 RETURNING *) SELECT * FROM cte1; --fail +WITH cte1 AS (UPDATE t1 SET a = a RETURNING *) SELECT * FROM cte1; --ok + +WITH cte1 AS (INSERT INTO t1 VALUES (21, 'Fail') RETURNING *) SELECT * FROM cte1; --fail +WITH cte1 AS (INSERT INTO t1 VALUES (20, 'Success') RETURNING *) SELECT * FROM cte1; --ok + +-- +-- Rename Policy +-- +RESET SESSION AUTHORIZATION; +ALTER POLICY p1 ON t1 RENAME TO p1; --fail + +SELECT polname, relname + FROM pg_policy pol + JOIN pg_class pc ON (pc.oid = pol.polrelid) + WHERE relname = 't1'; + +ALTER POLICY p1 ON t1 RENAME TO p2; --ok + +SELECT polname, relname + FROM pg_policy pol + JOIN pg_class pc ON (pc.oid = pol.polrelid) + WHERE relname = 't1'; + +-- +-- Check INSERT SELECT +-- +SET SESSION AUTHORIZATION regress_rls_bob; +CREATE TABLE t2 (a integer, b text); +INSERT INTO t2 (SELECT * FROM t1); +EXPLAIN (COSTS OFF) INSERT INTO t2 (SELECT * FROM t1); +SELECT * FROM t2; +EXPLAIN (COSTS OFF) SELECT * FROM t2; +CREATE TABLE t3 AS SELECT * FROM t1; +SELECT * FROM t3; +SELECT * INTO t4 FROM t1; +SELECT * FROM t4; + +-- +-- RLS with JOIN +-- +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE blog (id integer, author text, post text); +CREATE TABLE comment (blog_id integer, message text); + +GRANT ALL ON blog, comment TO regress_rls_bob; + +CREATE POLICY blog_1 ON blog USING (id % 2 = 0); + +ALTER TABLE blog ENABLE ROW LEVEL SECURITY; + +INSERT INTO blog VALUES + (1, 'alice', 'blog #1'), + (2, 'bob', 'blog #1'), + (3, 'alice', 'blog #2'), + (4, 'alice', 'blog #3'), + (5, 'john', 'blog #1'); + +INSERT INTO comment VALUES + (1, 'cool blog'), + (1, 'fun blog'), + (3, 'crazy blog'), + (5, 'what?'), + (4, 'insane!'), + (2, 'who did it?'); + +SET SESSION AUTHORIZATION regress_rls_bob; +-- Check RLS JOIN with Non-RLS. +SELECT id, author, message FROM blog JOIN comment ON id = blog_id; +-- Check Non-RLS JOIN with RLS. +SELECT id, author, message FROM comment JOIN blog ON id = blog_id; + +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE POLICY comment_1 ON comment USING (blog_id < 4); + +ALTER TABLE comment ENABLE ROW LEVEL SECURITY; + +SET SESSION AUTHORIZATION regress_rls_bob; +-- Check RLS JOIN RLS +SELECT id, author, message FROM blog JOIN comment ON id = blog_id; +SELECT id, author, message FROM comment JOIN blog ON id = blog_id; + +SET SESSION AUTHORIZATION regress_rls_alice; +DROP TABLE blog, comment; + +-- +-- Default Deny Policy +-- +RESET SESSION AUTHORIZATION; +DROP POLICY p2 ON t1; +ALTER TABLE t1 OWNER TO regress_rls_alice; + +-- Check that default deny does not apply to superuser. +RESET SESSION AUTHORIZATION; +SELECT * FROM t1; +EXPLAIN (COSTS OFF) SELECT * FROM t1; + +-- Check that default deny does not apply to table owner. +SET SESSION AUTHORIZATION regress_rls_alice; +SELECT * FROM t1; +EXPLAIN (COSTS OFF) SELECT * FROM t1; + +-- Check that default deny applies to non-owner/non-superuser when RLS on. +SET SESSION AUTHORIZATION regress_rls_bob; +SET row_security TO ON; +SELECT * FROM t1; +EXPLAIN (COSTS OFF) SELECT * FROM t1; +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM t1; +EXPLAIN (COSTS OFF) SELECT * FROM t1; + +-- +-- COPY TO/FROM +-- + +RESET SESSION AUTHORIZATION; +DROP TABLE copy_t CASCADE; +CREATE TABLE copy_t (a integer, b text); +CREATE POLICY p1 ON copy_t USING (a % 2 = 0); + +ALTER TABLE copy_t ENABLE ROW LEVEL SECURITY; + +GRANT ALL ON copy_t TO regress_rls_bob, regress_rls_exempt_user; + +INSERT INTO copy_t (SELECT x, md5(x::text) FROM generate_series(0,10) x); + +-- Check COPY TO as Superuser/owner. +RESET SESSION AUTHORIZATION; +SET row_security TO OFF; +COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; +SET row_security TO ON; +COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; + +-- Check COPY TO as user with permissions. +SET SESSION AUTHORIZATION regress_rls_bob; +SET row_security TO OFF; +COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - would be affected by RLS +SET row_security TO ON; +COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --ok + +-- Check COPY TO as user with permissions and BYPASSRLS +SET SESSION AUTHORIZATION regress_rls_exempt_user; +SET row_security TO OFF; +COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --ok +SET row_security TO ON; +COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --ok + +-- Check COPY TO as user without permissions. SET row_security TO OFF; +SET SESSION AUTHORIZATION regress_rls_carol; +SET row_security TO OFF; +COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - would be affected by RLS +SET row_security TO ON; +COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - permission denied + +-- Check COPY relation TO; keep it just one row to avoid reordering issues +RESET SESSION AUTHORIZATION; +SET row_security TO ON; +CREATE TABLE copy_rel_to (a integer, b text); +CREATE POLICY p1 ON copy_rel_to USING (a % 2 = 0); + +ALTER TABLE copy_rel_to ENABLE ROW LEVEL SECURITY; + +GRANT ALL ON copy_rel_to TO regress_rls_bob, regress_rls_exempt_user; + +INSERT INTO copy_rel_to VALUES (1, md5('1')); + +-- Check COPY TO as Superuser/owner. +RESET SESSION AUTHORIZATION; +SET row_security TO OFF; +COPY copy_rel_to TO STDOUT WITH DELIMITER ','; +SET row_security TO ON; +COPY copy_rel_to TO STDOUT WITH DELIMITER ','; + +-- Check COPY TO as user with permissions. +SET SESSION AUTHORIZATION regress_rls_bob; +SET row_security TO OFF; +COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --fail - would be affected by RLS +SET row_security TO ON; +COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --ok + +-- Check COPY TO as user with permissions and BYPASSRLS +SET SESSION AUTHORIZATION regress_rls_exempt_user; +SET row_security TO OFF; +COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --ok +SET row_security TO ON; +COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --ok + +-- Check COPY TO as user without permissions. SET row_security TO OFF; +SET SESSION AUTHORIZATION regress_rls_carol; +SET row_security TO OFF; +COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --fail - permission denied +SET row_security TO ON; +COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --fail - permission denied + +-- Check COPY FROM as Superuser/owner. +RESET SESSION AUTHORIZATION; +SET row_security TO OFF; +COPY copy_t FROM STDIN; --ok +SET row_security TO ON; +COPY copy_t FROM STDIN; --ok + +-- Check COPY FROM as user with permissions. +SET SESSION AUTHORIZATION regress_rls_bob; +SET row_security TO OFF; +COPY copy_t FROM STDIN; --fail - would be affected by RLS. +SET row_security TO ON; +COPY copy_t FROM STDIN; --fail - COPY FROM not supported by RLS. + +-- Check COPY FROM as user with permissions and BYPASSRLS +SET SESSION AUTHORIZATION regress_rls_exempt_user; +SET row_security TO ON; +COPY copy_t FROM STDIN; --ok + +-- Check COPY FROM as user without permissions. +SET SESSION AUTHORIZATION regress_rls_carol; +SET row_security TO OFF; +COPY copy_t FROM STDIN; --fail - permission denied. +SET row_security TO ON; +COPY copy_t FROM STDIN; --fail - permission denied. + +RESET SESSION AUTHORIZATION; +DROP TABLE copy_t; +DROP TABLE copy_rel_to CASCADE; + +-- Check WHERE CURRENT OF +SET SESSION AUTHORIZATION regress_rls_alice; + +CREATE TABLE current_check (currentid int, payload text, rlsuser text); +GRANT ALL ON current_check TO PUBLIC; + +INSERT INTO current_check VALUES + (1, 'abc', 'regress_rls_bob'), + (2, 'bcd', 'regress_rls_bob'), + (3, 'cde', 'regress_rls_bob'), + (4, 'def', 'regress_rls_bob'); + +CREATE POLICY p1 ON current_check FOR SELECT USING (currentid % 2 = 0); +CREATE POLICY p2 ON current_check FOR DELETE USING (currentid = 4 AND rlsuser = current_user); +CREATE POLICY p3 ON current_check FOR UPDATE USING (currentid = 4) WITH CHECK (rlsuser = current_user); + +ALTER TABLE current_check ENABLE ROW LEVEL SECURITY; + +SET SESSION AUTHORIZATION regress_rls_bob; + +-- Can SELECT even rows +SELECT * FROM current_check; + +-- Cannot UPDATE row 2 +UPDATE current_check SET payload = payload || '_new' WHERE currentid = 2 RETURNING *; + +BEGIN; + +DECLARE current_check_cursor SCROLL CURSOR FOR SELECT * FROM current_check; +-- Returns rows that can be seen according to SELECT policy, like plain SELECT +-- above (even rows) +FETCH ABSOLUTE 1 FROM current_check_cursor; +-- Still cannot UPDATE row 2 through cursor +UPDATE current_check SET payload = payload || '_new' WHERE CURRENT OF current_check_cursor RETURNING *; +-- Can update row 4 through cursor, which is the next visible row +FETCH RELATIVE 1 FROM current_check_cursor; +UPDATE current_check SET payload = payload || '_new' WHERE CURRENT OF current_check_cursor RETURNING *; +SELECT * FROM current_check; +-- Plan should be a subquery TID scan +EXPLAIN (COSTS OFF) UPDATE current_check SET payload = payload WHERE CURRENT OF current_check_cursor; +-- Similarly can only delete row 4 +FETCH ABSOLUTE 1 FROM current_check_cursor; +DELETE FROM current_check WHERE CURRENT OF current_check_cursor RETURNING *; +FETCH RELATIVE 1 FROM current_check_cursor; +DELETE FROM current_check WHERE CURRENT OF current_check_cursor RETURNING *; +SELECT * FROM current_check; + +COMMIT; + +-- +-- check pg_stats view filtering +-- +SET row_security TO ON; +SET SESSION AUTHORIZATION regress_rls_alice; +ANALYZE current_check; +-- Stats visible +SELECT row_security_active('current_check'); +SELECT attname, most_common_vals FROM pg_stats + WHERE tablename = 'current_check' + ORDER BY 1; + +SET SESSION AUTHORIZATION regress_rls_bob; +-- Stats not visible +SELECT row_security_active('current_check'); +SELECT attname, most_common_vals FROM pg_stats + WHERE tablename = 'current_check' + ORDER BY 1; + +-- +-- Collation support +-- +BEGIN; +CREATE TABLE coll_t (c) AS VALUES ('bar'::text); +CREATE POLICY coll_p ON coll_t USING (c < ('foo'::text COLLATE "C")); +ALTER TABLE coll_t ENABLE ROW LEVEL SECURITY; +GRANT SELECT ON coll_t TO regress_rls_alice; +SELECT (string_to_array(polqual, ':'))[7] AS inputcollid FROM pg_policy WHERE polrelid = 'coll_t'::regclass; +SET SESSION AUTHORIZATION regress_rls_alice; +SELECT * FROM coll_t; +ROLLBACK; + +-- +-- Shared Object Dependencies +-- +RESET SESSION AUTHORIZATION; +BEGIN; +CREATE ROLE regress_rls_eve; +CREATE ROLE regress_rls_frank; +CREATE TABLE tbl1 (c) AS VALUES ('bar'::text); +GRANT SELECT ON TABLE tbl1 TO regress_rls_eve; +CREATE POLICY P ON tbl1 TO regress_rls_eve, regress_rls_frank USING (true); +SELECT refclassid::regclass, deptype + FROM pg_depend + WHERE classid = 'pg_policy'::regclass + AND refobjid = 'tbl1'::regclass; +SELECT refclassid::regclass, deptype + FROM pg_shdepend + WHERE classid = 'pg_policy'::regclass + AND refobjid IN ('regress_rls_eve'::regrole, 'regress_rls_frank'::regrole); + +SAVEPOINT q; +DROP ROLE regress_rls_eve; --fails due to dependency on POLICY p +ROLLBACK TO q; + +ALTER POLICY p ON tbl1 TO regress_rls_frank USING (true); +SAVEPOINT q; +DROP ROLE regress_rls_eve; --fails due to dependency on GRANT SELECT +ROLLBACK TO q; + +REVOKE ALL ON TABLE tbl1 FROM regress_rls_eve; +SAVEPOINT q; +DROP ROLE regress_rls_eve; --succeeds +ROLLBACK TO q; + +SAVEPOINT q; +DROP ROLE regress_rls_frank; --fails due to dependency on POLICY p +ROLLBACK TO q; + +DROP POLICY p ON tbl1; +SAVEPOINT q; +DROP ROLE regress_rls_frank; -- succeeds +ROLLBACK TO q; + +ROLLBACK; -- cleanup + +-- +-- Converting table to view +-- +BEGIN; +CREATE TABLE t (c int); +CREATE POLICY p ON t USING (c % 2 = 1); +ALTER TABLE t ENABLE ROW LEVEL SECURITY; + +SAVEPOINT q; +CREATE RULE "_RETURN" AS ON SELECT TO t DO INSTEAD + SELECT * FROM generate_series(1,5) t0(c); -- fails due to row level security enabled +ROLLBACK TO q; + +ALTER TABLE t DISABLE ROW LEVEL SECURITY; +SAVEPOINT q; +CREATE RULE "_RETURN" AS ON SELECT TO t DO INSTEAD + SELECT * FROM generate_series(1,5) t0(c); -- fails due to policy p on t +ROLLBACK TO q; + +DROP POLICY p ON t; +CREATE RULE "_RETURN" AS ON SELECT TO t DO INSTEAD + SELECT * FROM generate_series(1,5) t0(c); -- succeeds +ROLLBACK; + +-- +-- Policy expression handling +-- +BEGIN; +CREATE TABLE t (c) AS VALUES ('bar'::text); +CREATE POLICY p ON t USING (max(c)); -- fails: aggregate functions are not allowed in policy expressions +ROLLBACK; + +-- +-- Non-target relations are only subject to SELECT policies +-- +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE r1 (a int); +CREATE TABLE r2 (a int); +INSERT INTO r1 VALUES (10), (20); +INSERT INTO r2 VALUES (10), (20); + +GRANT ALL ON r1, r2 TO regress_rls_bob; + +CREATE POLICY p1 ON r1 USING (true); +ALTER TABLE r1 ENABLE ROW LEVEL SECURITY; + +CREATE POLICY p1 ON r2 FOR SELECT USING (true); +CREATE POLICY p2 ON r2 FOR INSERT WITH CHECK (false); +CREATE POLICY p3 ON r2 FOR UPDATE USING (false); +CREATE POLICY p4 ON r2 FOR DELETE USING (false); +ALTER TABLE r2 ENABLE ROW LEVEL SECURITY; + +SET SESSION AUTHORIZATION regress_rls_bob; +SELECT * FROM r1; +SELECT * FROM r2; + +-- r2 is read-only +INSERT INTO r2 VALUES (2); -- Not allowed +UPDATE r2 SET a = 2 RETURNING *; -- Updates nothing +DELETE FROM r2 RETURNING *; -- Deletes nothing + +-- r2 can be used as a non-target relation in DML +INSERT INTO r1 SELECT a + 1 FROM r2 RETURNING *; -- OK +UPDATE r1 SET a = r2.a + 2 FROM r2 WHERE r1.a = r2.a RETURNING *; -- OK +DELETE FROM r1 USING r2 WHERE r1.a = r2.a + 2 RETURNING *; -- OK +SELECT * FROM r1; +SELECT * FROM r2; + +SET SESSION AUTHORIZATION regress_rls_alice; +DROP TABLE r1; +DROP TABLE r2; + +-- +-- FORCE ROW LEVEL SECURITY applies RLS to owners too +-- +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security = on; +CREATE TABLE r1 (a int); +INSERT INTO r1 VALUES (10), (20); + +CREATE POLICY p1 ON r1 USING (false); +ALTER TABLE r1 ENABLE ROW LEVEL SECURITY; +ALTER TABLE r1 FORCE ROW LEVEL SECURITY; + +-- No error, but no rows +TABLE r1; + +-- RLS error +INSERT INTO r1 VALUES (1); + +-- No error (unable to see any rows to update) +UPDATE r1 SET a = 1; +TABLE r1; + +-- No error (unable to see any rows to delete) +DELETE FROM r1; +TABLE r1; + +SET row_security = off; +-- these all fail, would be affected by RLS +TABLE r1; +UPDATE r1 SET a = 1; +DELETE FROM r1; + +DROP TABLE r1; + +-- +-- FORCE ROW LEVEL SECURITY does not break RI +-- +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security = on; +CREATE TABLE r1 (a int PRIMARY KEY); +CREATE TABLE r2 (a int REFERENCES r1); +INSERT INTO r1 VALUES (10), (20); +INSERT INTO r2 VALUES (10), (20); + +-- Create policies on r2 which prevent the +-- owner from seeing any rows, but RI should +-- still see them. +CREATE POLICY p1 ON r2 USING (false); +ALTER TABLE r2 ENABLE ROW LEVEL SECURITY; +ALTER TABLE r2 FORCE ROW LEVEL SECURITY; + +-- Errors due to rows in r2 +DELETE FROM r1; + +-- Reset r2 to no-RLS +DROP POLICY p1 ON r2; +ALTER TABLE r2 NO FORCE ROW LEVEL SECURITY; +ALTER TABLE r2 DISABLE ROW LEVEL SECURITY; + +-- clean out r2 for INSERT test below +DELETE FROM r2; + +-- Change r1 to not allow rows to be seen +CREATE POLICY p1 ON r1 USING (false); +ALTER TABLE r1 ENABLE ROW LEVEL SECURITY; +ALTER TABLE r1 FORCE ROW LEVEL SECURITY; + +-- No rows seen +TABLE r1; + +-- No error, RI still sees that row exists in r1 +INSERT INTO r2 VALUES (10); + +DROP TABLE r2; +DROP TABLE r1; + +-- Ensure cascaded DELETE works +CREATE TABLE r1 (a int PRIMARY KEY); +CREATE TABLE r2 (a int REFERENCES r1 ON DELETE CASCADE); +INSERT INTO r1 VALUES (10), (20); +INSERT INTO r2 VALUES (10), (20); + +-- Create policies on r2 which prevent the +-- owner from seeing any rows, but RI should +-- still see them. +CREATE POLICY p1 ON r2 USING (false); +ALTER TABLE r2 ENABLE ROW LEVEL SECURITY; +ALTER TABLE r2 FORCE ROW LEVEL SECURITY; + +-- Deletes all records from both +DELETE FROM r1; + +-- Remove FORCE from r2 +ALTER TABLE r2 NO FORCE ROW LEVEL SECURITY; + +-- As owner, we now bypass RLS +-- verify no rows in r2 now +TABLE r2; + +DROP TABLE r2; +DROP TABLE r1; + +-- Ensure cascaded UPDATE works +CREATE TABLE r1 (a int PRIMARY KEY); +CREATE TABLE r2 (a int REFERENCES r1 ON UPDATE CASCADE); +INSERT INTO r1 VALUES (10), (20); +INSERT INTO r2 VALUES (10), (20); + +-- Create policies on r2 which prevent the +-- owner from seeing any rows, but RI should +-- still see them. +CREATE POLICY p1 ON r2 USING (false); +ALTER TABLE r2 ENABLE ROW LEVEL SECURITY; +ALTER TABLE r2 FORCE ROW LEVEL SECURITY; + +-- Updates records in both +UPDATE r1 SET a = a+5; + +-- Remove FORCE from r2 +ALTER TABLE r2 NO FORCE ROW LEVEL SECURITY; + +-- As owner, we now bypass RLS +-- verify records in r2 updated +TABLE r2; + +DROP TABLE r2; +DROP TABLE r1; + +-- +-- Test INSERT+RETURNING applies SELECT policies as +-- WithCheckOptions (meaning an error is thrown) +-- +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security = on; +CREATE TABLE r1 (a int); + +CREATE POLICY p1 ON r1 FOR SELECT USING (false); +CREATE POLICY p2 ON r1 FOR INSERT WITH CHECK (true); +ALTER TABLE r1 ENABLE ROW LEVEL SECURITY; +ALTER TABLE r1 FORCE ROW LEVEL SECURITY; + +-- Works fine +INSERT INTO r1 VALUES (10), (20); + +-- No error, but no rows +TABLE r1; + +SET row_security = off; +-- fail, would be affected by RLS +TABLE r1; + +SET row_security = on; + +-- Error +INSERT INTO r1 VALUES (10), (20) RETURNING *; + +DROP TABLE r1; + +-- +-- Test UPDATE+RETURNING applies SELECT policies as +-- WithCheckOptions (meaning an error is thrown) +-- +SET SESSION AUTHORIZATION regress_rls_alice; +SET row_security = on; +CREATE TABLE r1 (a int PRIMARY KEY); + +CREATE POLICY p1 ON r1 FOR SELECT USING (a < 20); +CREATE POLICY p2 ON r1 FOR UPDATE USING (a < 20) WITH CHECK (true); +CREATE POLICY p3 ON r1 FOR INSERT WITH CHECK (true); +INSERT INTO r1 VALUES (10); +ALTER TABLE r1 ENABLE ROW LEVEL SECURITY; +ALTER TABLE r1 FORCE ROW LEVEL SECURITY; + +-- Works fine +UPDATE r1 SET a = 30; + +-- Show updated rows +ALTER TABLE r1 NO FORCE ROW LEVEL SECURITY; +TABLE r1; +-- reset value in r1 for test with RETURNING +UPDATE r1 SET a = 10; + +-- Verify row reset +TABLE r1; + +ALTER TABLE r1 FORCE ROW LEVEL SECURITY; + +-- Error +UPDATE r1 SET a = 30 RETURNING *; + +-- UPDATE path of INSERT ... ON CONFLICT DO UPDATE should also error out +INSERT INTO r1 VALUES (10) + ON CONFLICT (a) DO UPDATE SET a = 30 RETURNING *; + +-- Should still error out without RETURNING (use of arbiter always requires +-- SELECT permissions) +INSERT INTO r1 VALUES (10) + ON CONFLICT (a) DO UPDATE SET a = 30; +INSERT INTO r1 VALUES (10) + ON CONFLICT ON CONSTRAINT r1_pkey DO UPDATE SET a = 30; + +DROP TABLE r1; + +-- Check dependency handling +RESET SESSION AUTHORIZATION; +CREATE TABLE dep1 (c1 int); +CREATE TABLE dep2 (c1 int); + +CREATE POLICY dep_p1 ON dep1 TO regress_rls_bob USING (c1 > (select max(dep2.c1) from dep2)); +ALTER POLICY dep_p1 ON dep1 TO regress_rls_bob,regress_rls_carol; + +-- Should return one +SELECT count(*) = 1 FROM pg_depend + WHERE objid = (SELECT oid FROM pg_policy WHERE polname = 'dep_p1') + AND refobjid = (SELECT oid FROM pg_class WHERE relname = 'dep2'); + +ALTER POLICY dep_p1 ON dep1 USING (true); + +-- Should return one +SELECT count(*) = 1 FROM pg_shdepend + WHERE objid = (SELECT oid FROM pg_policy WHERE polname = 'dep_p1') + AND refobjid = (SELECT oid FROM pg_authid WHERE rolname = 'regress_rls_bob'); + +-- Should return one +SELECT count(*) = 1 FROM pg_shdepend + WHERE objid = (SELECT oid FROM pg_policy WHERE polname = 'dep_p1') + AND refobjid = (SELECT oid FROM pg_authid WHERE rolname = 'regress_rls_carol'); + +-- Should return zero +SELECT count(*) = 0 FROM pg_depend + WHERE objid = (SELECT oid FROM pg_policy WHERE polname = 'dep_p1') + AND refobjid = (SELECT oid FROM pg_class WHERE relname = 'dep2'); + +-- DROP OWNED BY testing +RESET SESSION AUTHORIZATION; + +CREATE ROLE regress_rls_dob_role1; +CREATE ROLE regress_rls_dob_role2; + +CREATE TABLE dob_t1 (c1 int); +CREATE TABLE dob_t2 (c1 int) PARTITION BY RANGE (c1); + +CREATE POLICY p1 ON dob_t1 TO regress_rls_dob_role1 USING (true); +DROP OWNED BY regress_rls_dob_role1; +DROP POLICY p1 ON dob_t1; -- should fail, already gone + +CREATE POLICY p1 ON dob_t1 TO regress_rls_dob_role1,regress_rls_dob_role2 USING (true); +DROP OWNED BY regress_rls_dob_role1; +DROP POLICY p1 ON dob_t1; -- should succeed + +CREATE POLICY p1 ON dob_t2 TO regress_rls_dob_role1,regress_rls_dob_role2 USING (true); +DROP OWNED BY regress_rls_dob_role1; +DROP POLICY p1 ON dob_t2; -- should succeed + +DROP USER regress_rls_dob_role1; +DROP USER regress_rls_dob_role2; + +-- Bug #15708: view + table with RLS should check policies as view owner +CREATE TABLE ref_tbl (a int); +INSERT INTO ref_tbl VALUES (1); + +CREATE TABLE rls_tbl (a int); +INSERT INTO rls_tbl VALUES (10); +ALTER TABLE rls_tbl ENABLE ROW LEVEL SECURITY; +CREATE POLICY p1 ON rls_tbl USING (EXISTS (SELECT 1 FROM ref_tbl)); + +GRANT SELECT ON ref_tbl TO regress_rls_bob; +GRANT SELECT ON rls_tbl TO regress_rls_bob; + +CREATE VIEW rls_view AS SELECT * FROM rls_tbl; +ALTER VIEW rls_view OWNER TO regress_rls_bob; +GRANT SELECT ON rls_view TO regress_rls_alice; + +SET SESSION AUTHORIZATION regress_rls_alice; +SELECT * FROM ref_tbl; -- Permission denied +SELECT * FROM rls_tbl; -- Permission denied +SELECT * FROM rls_view; -- OK +RESET SESSION AUTHORIZATION; + +DROP VIEW rls_view; +DROP TABLE rls_tbl; +DROP TABLE ref_tbl; + +-- Leaky operator test +CREATE TABLE rls_tbl (a int); +INSERT INTO rls_tbl SELECT x/10 FROM generate_series(1, 100) x; +ANALYZE rls_tbl; + +ALTER TABLE rls_tbl ENABLE ROW LEVEL SECURITY; +GRANT SELECT ON rls_tbl TO regress_rls_alice; + +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE FUNCTION op_leak(int, int) RETURNS bool + AS 'BEGIN RAISE NOTICE ''op_leak => %, %'', $1, $2; RETURN $1 < $2; END' + LANGUAGE plpgsql; +CREATE OPERATOR <<< (procedure = op_leak, leftarg = int, rightarg = int, + restrict = scalarltsel); +SELECT * FROM rls_tbl WHERE a <<< 1000; +DROP OPERATOR <<< (int, int); +DROP FUNCTION op_leak(int, int); +RESET SESSION AUTHORIZATION; +DROP TABLE rls_tbl; + +-- Bug #16006: whole-row Vars in a policy don't play nice with sub-selects +SET SESSION AUTHORIZATION regress_rls_alice; +CREATE TABLE rls_tbl (a int, b int, c int); +CREATE POLICY p1 ON rls_tbl USING (rls_tbl >= ROW(1,1,1)); + +ALTER TABLE rls_tbl ENABLE ROW LEVEL SECURITY; +ALTER TABLE rls_tbl FORCE ROW LEVEL SECURITY; + +INSERT INTO rls_tbl SELECT 10, 20, 30; +EXPLAIN (VERBOSE, COSTS OFF) +INSERT INTO rls_tbl + SELECT * FROM (SELECT b, c FROM rls_tbl ORDER BY a) ss; +INSERT INTO rls_tbl + SELECT * FROM (SELECT b, c FROM rls_tbl ORDER BY a) ss; +SELECT * FROM rls_tbl; + +DROP TABLE rls_tbl; +RESET SESSION AUTHORIZATION; + +-- +-- Clean up objects +-- +RESET SESSION AUTHORIZATION; + +DROP SCHEMA regress_rls_schema CASCADE; + +DROP USER regress_rls_alice; +DROP USER regress_rls_bob; +DROP USER regress_rls_carol; +DROP USER regress_rls_dave; +DROP USER regress_rls_exempt_user; +DROP ROLE regress_rls_group1; +DROP ROLE regress_rls_group2; + +-- Arrange to have a few policies left over, for testing +-- pg_dump/pg_restore +CREATE SCHEMA regress_rls_schema; +CREATE TABLE rls_tbl (c1 int); +ALTER TABLE rls_tbl ENABLE ROW LEVEL SECURITY; +CREATE POLICY p1 ON rls_tbl USING (c1 > 5); +CREATE POLICY p2 ON rls_tbl FOR SELECT USING (c1 <= 3); +CREATE POLICY p3 ON rls_tbl FOR UPDATE USING (c1 <= 3) WITH CHECK (c1 > 5); +CREATE POLICY p4 ON rls_tbl FOR DELETE USING (c1 <= 3); + +CREATE TABLE rls_tbl_force (c1 int); +ALTER TABLE rls_tbl_force ENABLE ROW LEVEL SECURITY; +ALTER TABLE rls_tbl_force FORCE ROW LEVEL SECURITY; +CREATE POLICY p1 ON rls_tbl_force USING (c1 = 5) WITH CHECK (c1 < 5); +CREATE POLICY p2 ON rls_tbl_force FOR SELECT USING (c1 = 8); +CREATE POLICY p3 ON rls_tbl_force FOR UPDATE USING (c1 = 8) WITH CHECK (c1 >= 5); +CREATE POLICY p4 ON rls_tbl_force FOR DELETE USING (c1 = 8); diff --git a/postgresql/examples/rowtypes.sql b/postgresql/examples/rowtypes.sql new file mode 100644 index 0000000..cd4e9d4 --- /dev/null +++ b/postgresql/examples/rowtypes.sql @@ -0,0 +1,505 @@ +-- +-- ROWTYPES +-- + +-- Make both a standalone composite type and a table rowtype + +create type complex as (r float8, i float8); + +create temp table fullname (first text, last text); + +-- Nested composite + +create type quad as (c1 complex, c2 complex); + +-- Some simple tests of I/O conversions and row construction + +select (1.1,2.2)::complex, row((3.3,4.4),(5.5,null))::quad; + +select row('Joe', 'Blow')::fullname, '(Joe,Blow)'::fullname; + +select '(Joe,von Blow)'::fullname, '(Joe,d''Blow)'::fullname; + +select '(Joe,"von""Blow")'::fullname, E'(Joe,d\\\\Blow)'::fullname; + +select '(Joe,"Blow,Jr")'::fullname; + +select '(Joe,)'::fullname; -- ok, null 2nd column +select '(Joe)'::fullname; -- bad +select '(Joe,,)'::fullname; -- bad +select '[]'::fullname; -- bad +select ' (Joe,Blow) '::fullname; -- ok, extra whitespace +select '(Joe,Blow) /'::fullname; -- bad + +create temp table quadtable(f1 int, q quad); + +insert into quadtable values (1, ((3.3,4.4),(5.5,6.6))); +insert into quadtable values (2, ((null,4.4),(5.5,6.6))); + +select * from quadtable; + +select f1, q.c1 from quadtable; -- fails, q is a table reference + +select f1, (q).c1, (qq.q).c1.i from quadtable qq; + +create temp table people (fn fullname, bd date); + +insert into people values ('(Joe,Blow)', '1984-01-10'); + +select * from people; + +-- at the moment this will not work due to ALTER TABLE inadequacy: +alter table fullname add column suffix text default ''; + +-- but this should work: +alter table fullname add column suffix text default null; + +select * from people; + +-- test insertion/updating of subfields +update people set fn.suffix = 'Jr'; + +select * from people; + +insert into quadtable (f1, q.c1.r, q.c2.i) values(44,55,66); + +select * from quadtable; + +-- The object here is to ensure that toasted references inside +-- composite values don't cause problems. The large f1 value will +-- be toasted inside pp, it must still work after being copied to people. + +create temp table pp (f1 text); +insert into pp values (repeat('abcdefghijkl', 100000)); + +insert into people select ('Jim', f1, null)::fullname, current_date from pp; + +select (fn).first, substr((fn).last, 1, 20), length((fn).last) from people; + +-- Test row comparison semantics. Prior to PG 8.2 we did this in a totally +-- non-spec-compliant way. + +select ROW(1,2) < ROW(1,3) as true; +select ROW(1,2) < ROW(1,1) as false; +select ROW(1,2) < ROW(1,NULL) as null; +select ROW(1,2,3) < ROW(1,3,NULL) as true; -- the NULL is not examined +select ROW(11,'ABC') < ROW(11,'DEF') as true; +select ROW(11,'ABC') > ROW(11,'DEF') as false; +select ROW(12,'ABC') > ROW(11,'DEF') as true; + +-- = and <> have different NULL-behavior than < etc +select ROW(1,2,3) < ROW(1,NULL,4) as null; +select ROW(1,2,3) = ROW(1,NULL,4) as false; +select ROW(1,2,3) <> ROW(1,NULL,4) as true; + +-- We allow operators beyond the six standard ones, if they have btree +-- operator classes. +select ROW('ABC','DEF') ~<=~ ROW('DEF','ABC') as true; +select ROW('ABC','DEF') ~>=~ ROW('DEF','ABC') as false; +select ROW('ABC','DEF') ~~ ROW('DEF','ABC') as fail; + +-- Comparisons of ROW() expressions can cope with some type mismatches +select ROW(1,2) = ROW(1,2::int8); +select ROW(1,2) in (ROW(3,4), ROW(1,2)); +select ROW(1,2) in (ROW(3,4), ROW(1,2::int8)); + +-- Check row comparison with a subselect +select unique1, unique2 from tenk1 +where (unique1, unique2) < any (select ten, ten from tenk1 where hundred < 3) + and unique1 <= 20 +order by 1; + +-- Also check row comparison with an indexable condition +explain (costs off) +select thousand, tenthous from tenk1 +where (thousand, tenthous) >= (997, 5000) +order by thousand, tenthous; + +select thousand, tenthous from tenk1 +where (thousand, tenthous) >= (997, 5000) +order by thousand, tenthous; + +explain (costs off) +select thousand, tenthous, four from tenk1 +where (thousand, tenthous, four) > (998, 5000, 3) +order by thousand, tenthous; + +select thousand, tenthous, four from tenk1 +where (thousand, tenthous, four) > (998, 5000, 3) +order by thousand, tenthous; + +explain (costs off) +select thousand, tenthous from tenk1 +where (998, 5000) < (thousand, tenthous) +order by thousand, tenthous; + +select thousand, tenthous from tenk1 +where (998, 5000) < (thousand, tenthous) +order by thousand, tenthous; + +explain (costs off) +select thousand, hundred from tenk1 +where (998, 5000) < (thousand, hundred) +order by thousand, hundred; + +select thousand, hundred from tenk1 +where (998, 5000) < (thousand, hundred) +order by thousand, hundred; + +-- Test case for bug #14010: indexed row comparisons fail with nulls +create temp table test_table (a text, b text); +insert into test_table values ('a', 'b'); +insert into test_table select 'a', null from generate_series(1,1000); +insert into test_table values ('b', 'a'); +create index on test_table (a,b); +set enable_sort = off; + +explain (costs off) +select a,b from test_table where (a,b) > ('a','a') order by a,b; + +select a,b from test_table where (a,b) > ('a','a') order by a,b; + +reset enable_sort; + +-- Check row comparisons with IN +select * from int8_tbl i8 where i8 in (row(123,456)); -- fail, type mismatch + +explain (costs off) +select * from int8_tbl i8 +where i8 in (row(123,456)::int8_tbl, '(4567890123456789,123)'); + +select * from int8_tbl i8 +where i8 in (row(123,456)::int8_tbl, '(4567890123456789,123)'); + +-- Check ability to select columns from an anonymous rowtype +select (row(1, 2.0)).f1; +select (row(1, 2.0)).f2; +select (row(1, 2.0)).nosuch; -- fail +select (row(1, 2.0)).*; +select (r).f1 from (select row(1, 2.0) as r) ss; +select (r).f3 from (select row(1, 2.0) as r) ss; -- fail +select (r).* from (select row(1, 2.0) as r) ss; + +-- Check some corner cases involving empty rowtypes +select ROW(); +select ROW() IS NULL; +select ROW() = ROW(); + +-- Check ability to create arrays of anonymous rowtypes +select array[ row(1,2), row(3,4), row(5,6) ]; + +-- Check ability to compare an anonymous row to elements of an array +select row(1,1.1) = any (array[ row(7,7.7), row(1,1.1), row(0,0.0) ]); +select row(1,1.1) = any (array[ row(7,7.7), row(1,1.0), row(0,0.0) ]); + +-- Check behavior with a non-comparable rowtype +create type cantcompare as (p point, r float8); +create temp table cc (f1 cantcompare); +insert into cc values('("(1,2)",3)'); +insert into cc values('("(4,5)",6)'); +select * from cc order by f1; -- fail, but should complain about cantcompare + +-- +-- Tests for record_{eq,cmp} +-- + +create type testtype1 as (a int, b int); + +-- all true +select row(1, 2)::testtype1 < row(1, 3)::testtype1; +select row(1, 2)::testtype1 <= row(1, 3)::testtype1; +select row(1, 2)::testtype1 = row(1, 2)::testtype1; +select row(1, 2)::testtype1 <> row(1, 3)::testtype1; +select row(1, 3)::testtype1 >= row(1, 2)::testtype1; +select row(1, 3)::testtype1 > row(1, 2)::testtype1; + +-- all false +select row(1, -2)::testtype1 < row(1, -3)::testtype1; +select row(1, -2)::testtype1 <= row(1, -3)::testtype1; +select row(1, -2)::testtype1 = row(1, -3)::testtype1; +select row(1, -2)::testtype1 <> row(1, -2)::testtype1; +select row(1, -3)::testtype1 >= row(1, -2)::testtype1; +select row(1, -3)::testtype1 > row(1, -2)::testtype1; + +-- true, but see *< below +select row(1, -2)::testtype1 < row(1, 3)::testtype1; + +-- mismatches +create type testtype3 as (a int, b text); +select row(1, 2)::testtype1 < row(1, 'abc')::testtype3; +select row(1, 2)::testtype1 <> row(1, 'abc')::testtype3; +create type testtype5 as (a int); +select row(1, 2)::testtype1 < row(1)::testtype5; +select row(1, 2)::testtype1 <> row(1)::testtype5; + +-- non-comparable types +create type testtype6 as (a int, b point); +select row(1, '(1,2)')::testtype6 < row(1, '(1,3)')::testtype6; +select row(1, '(1,2)')::testtype6 <> row(1, '(1,3)')::testtype6; + +drop type testtype1, testtype3, testtype5, testtype6; + +-- +-- Tests for record_image_{eq,cmp} +-- + +create type testtype1 as (a int, b int); + +-- all true +select row(1, 2)::testtype1 *< row(1, 3)::testtype1; +select row(1, 2)::testtype1 *<= row(1, 3)::testtype1; +select row(1, 2)::testtype1 *<> row(1, 3)::testtype1; +select row(1, 3)::testtype1 *>= row(1, 2)::testtype1; +select row(1, 3)::testtype1 *> row(1, 2)::testtype1; + +-- all false +select row(1, -2)::testtype1 *< row(1, -3)::testtype1; +select row(1, -2)::testtype1 *<= row(1, -3)::testtype1; +select row(1, -2)::testtype1 *<> row(1, -2)::testtype1; +select row(1, -3)::testtype1 *>= row(1, -2)::testtype1; +select row(1, -3)::testtype1 *> row(1, -2)::testtype1; + +-- This returns the "wrong" order because record_image_cmp works on +-- unsigned datums without knowing about the actual data type. +select row(1, -2)::testtype1 *< row(1, 3)::testtype1; + +-- other types +create type testtype2 as (a smallint, b bool); -- byval different sizes +select row(1, true)::testtype2 *< row(2, true)::testtype2; +select row(-2, true)::testtype2 *< row(-1, true)::testtype2; +select row(0, false)::testtype2 *< row(0, true)::testtype2; +select row(0, false)::testtype2 *<> row(0, true)::testtype2; + +create type testtype3 as (a int, b text); -- variable length +select row(1, 'abc')::testtype3 *< row(1, 'abd')::testtype3; +select row(1, 'abc')::testtype3 *< row(1, 'abcd')::testtype3; +select row(1, 'abc')::testtype3 *> row(1, 'abd')::testtype3; +select row(1, 'abc')::testtype3 *<> row(1, 'abd')::testtype3; + +create type testtype4 as (a int, b point); -- by ref, fixed length +select row(1, '(1,2)')::testtype4 *< row(1, '(1,3)')::testtype4; +select row(1, '(1,2)')::testtype4 *<> row(1, '(1,3)')::testtype4; + +-- mismatches +select row(1, 2)::testtype1 *< row(1, 'abc')::testtype3; +select row(1, 2)::testtype1 *<> row(1, 'abc')::testtype3; +create type testtype5 as (a int); +select row(1, 2)::testtype1 *< row(1)::testtype5; +select row(1, 2)::testtype1 *<> row(1)::testtype5; + +-- non-comparable types +create type testtype6 as (a int, b point); +select row(1, '(1,2)')::testtype6 *< row(1, '(1,3)')::testtype6; +select row(1, '(1,2)')::testtype6 *>= row(1, '(1,3)')::testtype6; +select row(1, '(1,2)')::testtype6 *<> row(1, '(1,3)')::testtype6; + +-- anonymous rowtypes in coldeflists +select q.a, q.b = row(2), q.c = array[row(3)], q.d = row(row(4)) from + unnest(array[row(1, row(2), array[row(3)], row(row(4))), + row(2, row(3), array[row(4)], row(row(5)))]) + as q(a int, b record, c record[], d record); + +drop type testtype1, testtype2, testtype3, testtype4, testtype5, testtype6; + + +-- +-- Test case derived from bug #5716: check multiple uses of a rowtype result +-- + +BEGIN; + +CREATE TABLE price ( + id SERIAL PRIMARY KEY, + active BOOLEAN NOT NULL, + price NUMERIC +); + +CREATE TYPE price_input AS ( + id INTEGER, + price NUMERIC +); + +CREATE TYPE price_key AS ( + id INTEGER +); + +CREATE FUNCTION price_key_from_table(price) RETURNS price_key AS $$ + SELECT $1.id +$$ LANGUAGE SQL; + +CREATE FUNCTION price_key_from_input(price_input) RETURNS price_key AS $$ + SELECT $1.id +$$ LANGUAGE SQL; + +insert into price values (1,false,42), (10,false,100), (11,true,17.99); + +UPDATE price + SET active = true, price = input_prices.price + FROM unnest(ARRAY[(10, 123.00), (11, 99.99)]::price_input[]) input_prices + WHERE price_key_from_table(price.*) = price_key_from_input(input_prices.*); + +select * from price; + +rollback; + +-- +-- Test case derived from bug #9085: check * qualification of composite +-- parameters for SQL functions +-- + +create temp table compos (f1 int, f2 text); + +create function fcompos1(v compos) returns void as $$ +insert into compos values (v); -- fail +$$ language sql; + +create function fcompos1(v compos) returns void as $$ +insert into compos values (v.*); +$$ language sql; + +create function fcompos2(v compos) returns void as $$ +select fcompos1(v); +$$ language sql; + +create function fcompos3(v compos) returns void as $$ +select fcompos1(fcompos3.v.*); +$$ language sql; + +select fcompos1(row(1,'one')); +select fcompos2(row(2,'two')); +select fcompos3(row(3,'three')); +select * from compos; + +-- +-- We allow I/O conversion casts from composite types to strings to be +-- invoked via cast syntax, but not functional syntax. This is because +-- the latter is too prone to be invoked unintentionally. +-- +select cast (fullname as text) from fullname; +select fullname::text from fullname; +select text(fullname) from fullname; -- error +select fullname.text from fullname; -- error +-- same, but RECORD instead of named composite type: +select cast (row('Jim', 'Beam') as text); +select (row('Jim', 'Beam'))::text; +select text(row('Jim', 'Beam')); -- error +select (row('Jim', 'Beam')).text; -- error + +-- +-- Check the equivalence of functional and column notation +-- +insert into fullname values ('Joe', 'Blow'); + +select f.last from fullname f; +select last(f) from fullname f; + +create function longname(fullname) returns text language sql +as $$select $1.first || ' ' || $1.last$$; + +select f.longname from fullname f; +select longname(f) from fullname f; + +-- Starting in v11, the notational form does matter if there's ambiguity +alter table fullname add column longname text; + +select f.longname from fullname f; +select longname(f) from fullname f; + +-- +-- Test that composite values are seen to have the correct column names +-- (bug #11210 and other reports) +-- + +select row_to_json(i) from int8_tbl i; +select row_to_json(i) from int8_tbl i(x,y); + +create temp view vv1 as select * from int8_tbl; +select row_to_json(i) from vv1 i; +select row_to_json(i) from vv1 i(x,y); + +select row_to_json(ss) from + (select q1, q2 from int8_tbl) as ss; +select row_to_json(ss) from + (select q1, q2 from int8_tbl offset 0) as ss; +select row_to_json(ss) from + (select q1 as a, q2 as b from int8_tbl) as ss; +select row_to_json(ss) from + (select q1 as a, q2 as b from int8_tbl offset 0) as ss; +select row_to_json(ss) from + (select q1 as a, q2 as b from int8_tbl) as ss(x,y); +select row_to_json(ss) from + (select q1 as a, q2 as b from int8_tbl offset 0) as ss(x,y); + +explain (costs off) +select row_to_json(q) from + (select thousand, tenthous from tenk1 + where thousand = 42 and tenthous < 2000 offset 0) q; +select row_to_json(q) from + (select thousand, tenthous from tenk1 + where thousand = 42 and tenthous < 2000 offset 0) q; +select row_to_json(q) from + (select thousand as x, tenthous as y from tenk1 + where thousand = 42 and tenthous < 2000 offset 0) q; +select row_to_json(q) from + (select thousand as x, tenthous as y from tenk1 + where thousand = 42 and tenthous < 2000 offset 0) q(a,b); + +create temp table tt1 as select * from int8_tbl limit 2; +create temp table tt2 () inherits(tt1); +insert into tt2 values(0,0); +select row_to_json(r) from (select q2,q1 from tt1 offset 0) r; + +-- check no-op rowtype conversions +create temp table tt3 () inherits(tt2); +insert into tt3 values(33,44); +select row_to_json(tt3::tt2::tt1) from tt3; + +-- +-- IS [NOT] NULL should not recurse into nested composites (bug #14235) +-- + +explain (verbose, costs off) +select r, r is null as isnull, r is not null as isnotnull +from (values (1,row(1,2)), (1,row(null,null)), (1,null), + (null,row(1,2)), (null,row(null,null)), (null,null) ) r(a,b); + +select r, r is null as isnull, r is not null as isnotnull +from (values (1,row(1,2)), (1,row(null,null)), (1,null), + (null,row(1,2)), (null,row(null,null)), (null,null) ) r(a,b); + +explain (verbose, costs off) +with r(a,b) as materialized + (values (1,row(1,2)), (1,row(null,null)), (1,null), + (null,row(1,2)), (null,row(null,null)), (null,null) ) +select r, r is null as isnull, r is not null as isnotnull from r; + +with r(a,b) as materialized + (values (1,row(1,2)), (1,row(null,null)), (1,null), + (null,row(1,2)), (null,row(null,null)), (null,null) ) +select r, r is null as isnull, r is not null as isnotnull from r; + + +-- +-- Tests for component access / FieldSelect +-- +CREATE TABLE compositetable(a text, b text); +INSERT INTO compositetable(a, b) VALUES('fa', 'fb'); + +-- composite type columns can't directly be accessed (error) +SELECT d.a FROM (SELECT compositetable AS d FROM compositetable) s; +-- but can be accessed with proper parens +SELECT (d).a, (d).b FROM (SELECT compositetable AS d FROM compositetable) s; +-- system columns can't be accessed in composite types (error) +SELECT (d).ctid FROM (SELECT compositetable AS d FROM compositetable) s; + +-- accessing non-existing column in NULL datum errors out +SELECT (NULL::compositetable).nonexistent; +-- existing column in a NULL composite yield NULL +SELECT (NULL::compositetable).a; +-- oids can't be accessed in composite types (error) +SELECT (NULL::compositetable).oid; + +DROP TABLE compositetable; +select row(1, 2)::testtype1 *= row(1, 2)::testtype1; + +select row(1, -2)::testtype1 *= row(1, -3)::testtype1; diff --git a/postgresql/examples/rules.sql b/postgresql/examples/rules.sql new file mode 100644 index 0000000..ec92006 --- /dev/null +++ b/postgresql/examples/rules.sql @@ -0,0 +1,1233 @@ +-- +-- RULES +-- From Jan's original setup_ruletest.sql and run_ruletest.sql +-- - thomas 1998-09-13 +-- + +-- +-- Tables and rules for the view test +-- +create table rtest_t1 (a int4, b int4); +create table rtest_t2 (a int4, b int4); +create table rtest_t3 (a int4, b int4); + +create view rtest_v1 as select * from rtest_t1; +create rule rtest_v1_ins as on insert to rtest_v1 do instead + insert into rtest_t1 values (new.a, new.b); +create rule rtest_v1_upd as on update to rtest_v1 do instead + update rtest_t1 set a = new.a, b = new.b + where a = old.a; +create rule rtest_v1_del as on delete to rtest_v1 do instead + delete from rtest_t1 where a = old.a; +-- Test comments +COMMENT ON RULE rtest_v1_bad ON rtest_v1 IS 'bad rule'; +COMMENT ON RULE rtest_v1_del ON rtest_v1 IS 'delete rule'; +COMMENT ON RULE rtest_v1_del ON rtest_v1 IS NULL; +-- +-- Tables and rules for the constraint update/delete test +-- +-- Note: +-- Now that we have multiple action rule support, we check +-- both possible syntaxes to define them (The last action +-- can but must not have a semicolon at the end). +-- +create table rtest_system (sysname text, sysdesc text); +create table rtest_interface (sysname text, ifname text); +create table rtest_person (pname text, pdesc text); +create table rtest_admin (pname text, sysname text); + +create rule rtest_sys_upd as on update to rtest_system do also ( + update rtest_interface set sysname = new.sysname + where sysname = old.sysname; + update rtest_admin set sysname = new.sysname + where sysname = old.sysname + ); + +create rule rtest_sys_del as on delete to rtest_system do also ( + delete from rtest_interface where sysname = old.sysname; + delete from rtest_admin where sysname = old.sysname; + ); + +create rule rtest_pers_upd as on update to rtest_person do also + update rtest_admin set pname = new.pname where pname = old.pname; + +create rule rtest_pers_del as on delete to rtest_person do also + delete from rtest_admin where pname = old.pname; + +-- +-- Tables and rules for the logging test +-- +create table rtest_emp (ename char(20), salary money); +create table rtest_emplog (ename char(20), who name, action char(10), newsal money, oldsal money); +create table rtest_empmass (ename char(20), salary money); + +create rule rtest_emp_ins as on insert to rtest_emp do + insert into rtest_emplog values (new.ename, current_user, + 'hired', new.salary, '0.00'); + +create rule rtest_emp_upd as on update to rtest_emp where new.salary != old.salary do + insert into rtest_emplog values (new.ename, current_user, + 'honored', new.salary, old.salary); + +create rule rtest_emp_del as on delete to rtest_emp do + insert into rtest_emplog values (old.ename, current_user, + 'fired', '0.00', old.salary); + +-- +-- Tables and rules for the multiple cascaded qualified instead +-- rule test +-- +create table rtest_t4 (a int4, b text); +create table rtest_t5 (a int4, b text); +create table rtest_t6 (a int4, b text); +create table rtest_t7 (a int4, b text); +create table rtest_t8 (a int4, b text); +create table rtest_t9 (a int4, b text); + +create rule rtest_t4_ins1 as on insert to rtest_t4 + where new.a >= 10 and new.a < 20 do instead + insert into rtest_t5 values (new.a, new.b); + +create rule rtest_t4_ins2 as on insert to rtest_t4 + where new.a >= 20 and new.a < 30 do + insert into rtest_t6 values (new.a, new.b); + +create rule rtest_t5_ins as on insert to rtest_t5 + where new.a > 15 do + insert into rtest_t7 values (new.a, new.b); + +create rule rtest_t6_ins as on insert to rtest_t6 + where new.a > 25 do instead + insert into rtest_t8 values (new.a, new.b); + +-- +-- Tables and rules for the rule fire order test +-- +-- As of PG 7.3, the rules should fire in order by name, regardless +-- of INSTEAD attributes or creation order. +-- +create table rtest_order1 (a int4); +create table rtest_order2 (a int4, b int4, c text); + +create sequence rtest_seq; + +create rule rtest_order_r3 as on insert to rtest_order1 do instead + insert into rtest_order2 values (new.a, nextval('rtest_seq'), + 'rule 3 - this should run 3rd'); + +create rule rtest_order_r4 as on insert to rtest_order1 + where a < 100 do instead + insert into rtest_order2 values (new.a, nextval('rtest_seq'), + 'rule 4 - this should run 4th'); + +create rule rtest_order_r2 as on insert to rtest_order1 do + insert into rtest_order2 values (new.a, nextval('rtest_seq'), + 'rule 2 - this should run 2nd'); + +create rule rtest_order_r1 as on insert to rtest_order1 do instead + insert into rtest_order2 values (new.a, nextval('rtest_seq'), + 'rule 1 - this should run 1st'); + +-- +-- Tables and rules for the instead nothing test +-- +create table rtest_nothn1 (a int4, b text); +create table rtest_nothn2 (a int4, b text); +create table rtest_nothn3 (a int4, b text); +create table rtest_nothn4 (a int4, b text); + +create rule rtest_nothn_r1 as on insert to rtest_nothn1 + where new.a >= 10 and new.a < 20 do instead nothing; + +create rule rtest_nothn_r2 as on insert to rtest_nothn1 + where new.a >= 30 and new.a < 40 do instead nothing; + +create rule rtest_nothn_r3 as on insert to rtest_nothn2 + where new.a >= 100 do instead + insert into rtest_nothn3 values (new.a, new.b); + +create rule rtest_nothn_r4 as on insert to rtest_nothn2 + do instead nothing; + +-- +-- Tests on a view that is select * of a table +-- and has insert/update/delete instead rules to +-- behave close like the real table. +-- + +-- +-- We need test date later +-- +insert into rtest_t2 values (1, 21); +insert into rtest_t2 values (2, 22); +insert into rtest_t2 values (3, 23); + +insert into rtest_t3 values (1, 31); +insert into rtest_t3 values (2, 32); +insert into rtest_t3 values (3, 33); +insert into rtest_t3 values (4, 34); +insert into rtest_t3 values (5, 35); + +-- insert values +insert into rtest_v1 values (1, 11); +insert into rtest_v1 values (2, 12); +select * from rtest_v1; + +-- delete with constant expression +delete from rtest_v1 where a = 1; +select * from rtest_v1; +insert into rtest_v1 values (1, 11); +delete from rtest_v1 where b = 12; +select * from rtest_v1; +insert into rtest_v1 values (2, 12); +insert into rtest_v1 values (2, 13); +select * from rtest_v1; +/** Remember the delete rule on rtest_v1: It says +** DO INSTEAD DELETE FROM rtest_t1 WHERE a = old.a +** So this time both rows with a = 2 must get deleted*/ +\p +\r +delete from rtest_v1 where b = 12; +select * from rtest_v1; +delete from rtest_v1; + +-- insert select +insert into rtest_v1 select * from rtest_t2; +select * from rtest_v1; +delete from rtest_v1; + +-- same with swapped targetlist +insert into rtest_v1 (b, a) select b, a from rtest_t2; +select * from rtest_v1; + +-- now with only one target attribute +insert into rtest_v1 (a) select a from rtest_t3; +select * from rtest_v1; +select * from rtest_v1 where b isnull; + +-- let attribute a differ (must be done on rtest_t1 - see above) +update rtest_t1 set a = a + 10 where b isnull; +delete from rtest_v1 where b isnull; +select * from rtest_v1; + +-- now updates with constant expression +update rtest_v1 set b = 42 where a = 2; +select * from rtest_v1; +update rtest_v1 set b = 99 where b = 42; +select * from rtest_v1; +update rtest_v1 set b = 88 where b < 50; +select * from rtest_v1; +delete from rtest_v1; +insert into rtest_v1 select rtest_t2.a, rtest_t3.b + from rtest_t2, rtest_t3 + where rtest_t2.a = rtest_t3.a; +select * from rtest_v1; + +-- updates in a mergejoin +update rtest_v1 set b = rtest_t2.b from rtest_t2 where rtest_v1.a = rtest_t2.a; +select * from rtest_v1; +insert into rtest_v1 select * from rtest_t3; +select * from rtest_v1; +update rtest_t1 set a = a + 10 where b > 30; +select * from rtest_v1; +update rtest_v1 set a = rtest_t3.a + 20 from rtest_t3 where rtest_v1.b = rtest_t3.b; +select * from rtest_v1; + +-- +-- Test for constraint updates/deletes +-- +insert into rtest_system values ('orion', 'Linux Jan Wieck'); +insert into rtest_system values ('notjw', 'WinNT Jan Wieck (notebook)'); +insert into rtest_system values ('neptun', 'Fileserver'); + +insert into rtest_interface values ('orion', 'eth0'); +insert into rtest_interface values ('orion', 'eth1'); +insert into rtest_interface values ('notjw', 'eth0'); +insert into rtest_interface values ('neptun', 'eth0'); + +insert into rtest_person values ('jw', 'Jan Wieck'); +insert into rtest_person values ('bm', 'Bruce Momjian'); + +insert into rtest_admin values ('jw', 'orion'); +insert into rtest_admin values ('jw', 'notjw'); +insert into rtest_admin values ('bm', 'neptun'); + +update rtest_system set sysname = 'pluto' where sysname = 'neptun'; + +select * from rtest_interface; +select * from rtest_admin; + +update rtest_person set pname = 'jwieck' where pdesc = 'Jan Wieck'; + +-- Note: use ORDER BY here to ensure consistent output across all systems. +-- The above UPDATE affects two rows with equal keys, so they could be +-- updated in either order depending on the whim of the local qsort(). + +select * from rtest_admin order by pname, sysname; + +delete from rtest_system where sysname = 'orion'; + +select * from rtest_interface; +select * from rtest_admin; + +-- +-- Rule qualification test +-- +insert into rtest_emp values ('wiecc', '5000.00'); +insert into rtest_emp values ('gates', '80000.00'); +update rtest_emp set ename = 'wiecx' where ename = 'wiecc'; +update rtest_emp set ename = 'wieck', salary = '6000.00' where ename = 'wiecx'; +update rtest_emp set salary = '7000.00' where ename = 'wieck'; +delete from rtest_emp where ename = 'gates'; + +select ename, who = current_user as "matches user", action, newsal, oldsal from rtest_emplog order by ename, action, newsal; +insert into rtest_empmass values ('meyer', '4000.00'); +insert into rtest_empmass values ('maier', '5000.00'); +insert into rtest_empmass values ('mayr', '6000.00'); +insert into rtest_emp select * from rtest_empmass; +select ename, who = current_user as "matches user", action, newsal, oldsal from rtest_emplog order by ename, action, newsal; +update rtest_empmass set salary = salary + '1000.00'; +update rtest_emp set salary = rtest_empmass.salary from rtest_empmass where rtest_emp.ename = rtest_empmass.ename; +select ename, who = current_user as "matches user", action, newsal, oldsal from rtest_emplog order by ename, action, newsal; +delete from rtest_emp using rtest_empmass where rtest_emp.ename = rtest_empmass.ename; +select ename, who = current_user as "matches user", action, newsal, oldsal from rtest_emplog order by ename, action, newsal; + +-- +-- Multiple cascaded qualified instead rule test +-- +insert into rtest_t4 values (1, 'Record should go to rtest_t4'); +insert into rtest_t4 values (2, 'Record should go to rtest_t4'); +insert into rtest_t4 values (10, 'Record should go to rtest_t5'); +insert into rtest_t4 values (15, 'Record should go to rtest_t5'); +insert into rtest_t4 values (19, 'Record should go to rtest_t5 and t7'); +insert into rtest_t4 values (20, 'Record should go to rtest_t4 and t6'); +insert into rtest_t4 values (26, 'Record should go to rtest_t4 and t8'); +insert into rtest_t4 values (28, 'Record should go to rtest_t4 and t8'); +insert into rtest_t4 values (30, 'Record should go to rtest_t4'); +insert into rtest_t4 values (40, 'Record should go to rtest_t4'); + +select * from rtest_t4; +select * from rtest_t5; +select * from rtest_t6; +select * from rtest_t7; +select * from rtest_t8; + +delete from rtest_t4; +delete from rtest_t5; +delete from rtest_t6; +delete from rtest_t7; +delete from rtest_t8; + +insert into rtest_t9 values (1, 'Record should go to rtest_t4'); +insert into rtest_t9 values (2, 'Record should go to rtest_t4'); +insert into rtest_t9 values (10, 'Record should go to rtest_t5'); +insert into rtest_t9 values (15, 'Record should go to rtest_t5'); +insert into rtest_t9 values (19, 'Record should go to rtest_t5 and t7'); +insert into rtest_t9 values (20, 'Record should go to rtest_t4 and t6'); +insert into rtest_t9 values (26, 'Record should go to rtest_t4 and t8'); +insert into rtest_t9 values (28, 'Record should go to rtest_t4 and t8'); +insert into rtest_t9 values (30, 'Record should go to rtest_t4'); +insert into rtest_t9 values (40, 'Record should go to rtest_t4'); + +insert into rtest_t4 select * from rtest_t9 where a < 20; + +select * from rtest_t4; +select * from rtest_t5; +select * from rtest_t6; +select * from rtest_t7; +select * from rtest_t8; + +insert into rtest_t4 select * from rtest_t9 where b ~ 'and t8'; + +select * from rtest_t4; +select * from rtest_t5; +select * from rtest_t6; +select * from rtest_t7; +select * from rtest_t8; + +insert into rtest_t4 select a + 1, b from rtest_t9 where a in (20, 30, 40); + +select * from rtest_t4; +select * from rtest_t5; +select * from rtest_t6; +select * from rtest_t7; +select * from rtest_t8; + +-- +-- Check that the ordering of rules fired is correct +-- +insert into rtest_order1 values (1); +select * from rtest_order2; + +-- +-- Check if instead nothing w/without qualification works +-- +insert into rtest_nothn1 values (1, 'want this'); +insert into rtest_nothn1 values (2, 'want this'); +insert into rtest_nothn1 values (10, 'don''t want this'); +insert into rtest_nothn1 values (19, 'don''t want this'); +insert into rtest_nothn1 values (20, 'want this'); +insert into rtest_nothn1 values (29, 'want this'); +insert into rtest_nothn1 values (30, 'don''t want this'); +insert into rtest_nothn1 values (39, 'don''t want this'); +insert into rtest_nothn1 values (40, 'want this'); +insert into rtest_nothn1 values (50, 'want this'); +insert into rtest_nothn1 values (60, 'want this'); + +select * from rtest_nothn1; + +insert into rtest_nothn2 values (10, 'too small'); +insert into rtest_nothn2 values (50, 'too small'); +insert into rtest_nothn2 values (100, 'OK'); +insert into rtest_nothn2 values (200, 'OK'); + +select * from rtest_nothn2; +select * from rtest_nothn3; + +delete from rtest_nothn1; +delete from rtest_nothn2; +delete from rtest_nothn3; + +insert into rtest_nothn4 values (1, 'want this'); +insert into rtest_nothn4 values (2, 'want this'); +insert into rtest_nothn4 values (10, 'don''t want this'); +insert into rtest_nothn4 values (19, 'don''t want this'); +insert into rtest_nothn4 values (20, 'want this'); +insert into rtest_nothn4 values (29, 'want this'); +insert into rtest_nothn4 values (30, 'don''t want this'); +insert into rtest_nothn4 values (39, 'don''t want this'); +insert into rtest_nothn4 values (40, 'want this'); +insert into rtest_nothn4 values (50, 'want this'); +insert into rtest_nothn4 values (60, 'want this'); + +insert into rtest_nothn1 select * from rtest_nothn4; + +select * from rtest_nothn1; + +delete from rtest_nothn4; + +insert into rtest_nothn4 values (10, 'too small'); +insert into rtest_nothn4 values (50, 'too small'); +insert into rtest_nothn4 values (100, 'OK'); +insert into rtest_nothn4 values (200, 'OK'); + +insert into rtest_nothn2 select * from rtest_nothn4; + +select * from rtest_nothn2; +select * from rtest_nothn3; + +create table rtest_view1 (a int4, b text, v bool); +create table rtest_view2 (a int4); +create table rtest_view3 (a int4, b text); +create table rtest_view4 (a int4, b text, c int4); +create view rtest_vview1 as select a, b from rtest_view1 X + where 0 < (select count(*) from rtest_view2 Y where Y.a = X.a); +create view rtest_vview2 as select a, b from rtest_view1 where v; +create view rtest_vview3 as select a, b from rtest_vview2 X + where 0 < (select count(*) from rtest_view2 Y where Y.a = X.a); +create view rtest_vview4 as select X.a, X.b, count(Y.a) as refcount + from rtest_view1 X, rtest_view2 Y + where X.a = Y.a + group by X.a, X.b; +create function rtest_viewfunc1(int4) returns int4 as + 'select count(*)::int4 from rtest_view2 where a = $1' + language sql; +create view rtest_vview5 as select a, b, rtest_viewfunc1(a) as refcount + from rtest_view1; + +insert into rtest_view1 values (1, 'item 1', 't'); +insert into rtest_view1 values (2, 'item 2', 't'); +insert into rtest_view1 values (3, 'item 3', 't'); +insert into rtest_view1 values (4, 'item 4', 'f'); +insert into rtest_view1 values (5, 'item 5', 't'); +insert into rtest_view1 values (6, 'item 6', 'f'); +insert into rtest_view1 values (7, 'item 7', 't'); +insert into rtest_view1 values (8, 'item 8', 't'); + +insert into rtest_view2 values (2); +insert into rtest_view2 values (2); +insert into rtest_view2 values (4); +insert into rtest_view2 values (5); +insert into rtest_view2 values (7); +insert into rtest_view2 values (7); +insert into rtest_view2 values (7); +insert into rtest_view2 values (7); + +select * from rtest_vview1; +select * from rtest_vview2; +select * from rtest_vview3; +select * from rtest_vview4 order by a, b; +select * from rtest_vview5; + +insert into rtest_view3 select * from rtest_vview1 where a < 7; +select * from rtest_view3; +delete from rtest_view3; + +insert into rtest_view3 select * from rtest_vview2 where a != 5 and b !~ '2'; +select * from rtest_view3; +delete from rtest_view3; + +insert into rtest_view3 select * from rtest_vview3; +select * from rtest_view3; +delete from rtest_view3; + +insert into rtest_view4 select * from rtest_vview4 where 3 > refcount; +select * from rtest_view4 order by a, b; +delete from rtest_view4; + +insert into rtest_view4 select * from rtest_vview5 where a > 2 and refcount = 0; +select * from rtest_view4; +delete from rtest_view4; +-- +-- Test for computations in views +-- +create table rtest_comp ( + part text, + unit char(4), + size float +); + + +create table rtest_unitfact ( + unit char(4), + factor float +); + +create view rtest_vcomp as + select X.part, (X.size * Y.factor) as size_in_cm + from rtest_comp X, rtest_unitfact Y + where X.unit = Y.unit; + + +insert into rtest_unitfact values ('m', 100.0); +insert into rtest_unitfact values ('cm', 1.0); +insert into rtest_unitfact values ('inch', 2.54); + +insert into rtest_comp values ('p1', 'm', 5.0); +insert into rtest_comp values ('p2', 'm', 3.0); +insert into rtest_comp values ('p3', 'cm', 5.0); +insert into rtest_comp values ('p4', 'cm', 15.0); +insert into rtest_comp values ('p5', 'inch', 7.0); +insert into rtest_comp values ('p6', 'inch', 4.4); + +select * from rtest_vcomp order by part; + +select * from rtest_vcomp where size_in_cm > 10.0 order by size_in_cm using >; + +-- +-- In addition run the (slightly modified) queries from the +-- programmers manual section on the rule system. +-- +CREATE TABLE shoe_data ( + shoename char(10), -- primary key + sh_avail integer, -- available # of pairs + slcolor char(10), -- preferred shoelace color + slminlen float, -- minimum shoelace length + slmaxlen float, -- maximum shoelace length + slunit char(8) -- length unit +); + +CREATE TABLE shoelace_data ( + sl_name char(10), -- primary key + sl_avail integer, -- available # of pairs + sl_color char(10), -- shoelace color + sl_len float, -- shoelace length + sl_unit char(8) -- length unit +); + +CREATE TABLE unit ( + un_name char(8), -- the primary key + un_fact float -- factor to transform to cm +); + +CREATE VIEW shoe AS + SELECT sh.shoename, + sh.sh_avail, + sh.slcolor, + sh.slminlen, + sh.slminlen * un.un_fact AS slminlen_cm, + sh.slmaxlen, + sh.slmaxlen * un.un_fact AS slmaxlen_cm, + sh.slunit + FROM shoe_data sh, unit un + WHERE sh.slunit = un.un_name; + +CREATE VIEW shoelace AS + SELECT s.sl_name, + s.sl_avail, + s.sl_color, + s.sl_len, + s.sl_unit, + s.sl_len * u.un_fact AS sl_len_cm + FROM shoelace_data s, unit u + WHERE s.sl_unit = u.un_name; + +CREATE VIEW shoe_ready AS + SELECT rsh.shoename, + rsh.sh_avail, + rsl.sl_name, + rsl.sl_avail, + int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail + FROM shoe rsh, shoelace rsl + WHERE rsl.sl_color = rsh.slcolor + AND rsl.sl_len_cm >= rsh.slminlen_cm + AND rsl.sl_len_cm <= rsh.slmaxlen_cm; + +INSERT INTO unit VALUES ('cm', 1.0); +INSERT INTO unit VALUES ('m', 100.0); +INSERT INTO unit VALUES ('inch', 2.54); + +INSERT INTO shoe_data VALUES ('sh1', 2, 'black', 70.0, 90.0, 'cm'); +INSERT INTO shoe_data VALUES ('sh2', 0, 'black', 30.0, 40.0, 'inch'); +INSERT INTO shoe_data VALUES ('sh3', 4, 'brown', 50.0, 65.0, 'cm'); +INSERT INTO shoe_data VALUES ('sh4', 3, 'brown', 40.0, 50.0, 'inch'); + +INSERT INTO shoelace_data VALUES ('sl1', 5, 'black', 80.0, 'cm'); +INSERT INTO shoelace_data VALUES ('sl2', 6, 'black', 100.0, 'cm'); +INSERT INTO shoelace_data VALUES ('sl3', 0, 'black', 35.0 , 'inch'); +INSERT INTO shoelace_data VALUES ('sl4', 8, 'black', 40.0 , 'inch'); +INSERT INTO shoelace_data VALUES ('sl5', 4, 'brown', 1.0 , 'm'); +INSERT INTO shoelace_data VALUES ('sl6', 0, 'brown', 0.9 , 'm'); +INSERT INTO shoelace_data VALUES ('sl7', 7, 'brown', 60 , 'cm'); +INSERT INTO shoelace_data VALUES ('sl8', 1, 'brown', 40 , 'inch'); + +-- SELECTs in doc +SELECT * FROM shoelace ORDER BY sl_name; +SELECT * FROM shoe_ready WHERE total_avail >= 2 ORDER BY 1; + + CREATE TABLE shoelace_log ( + sl_name char(10), -- shoelace changed + sl_avail integer, -- new available value + log_who name, -- who did it + log_when timestamp -- when + ); + +-- Want "log_who" to be CURRENT_USER, +-- but that is non-portable for the regression test +-- - thomas 1999-02-21 + + CREATE RULE log_shoelace AS ON UPDATE TO shoelace_data + WHERE NEW.sl_avail != OLD.sl_avail + DO INSERT INTO shoelace_log VALUES ( + NEW.sl_name, + NEW.sl_avail, + 'Al Bundy', + 'epoch' + ); + +UPDATE shoelace_data SET sl_avail = 6 WHERE sl_name = 'sl7'; + +SELECT * FROM shoelace_log; + + CREATE RULE shoelace_ins AS ON INSERT TO shoelace + DO INSTEAD + INSERT INTO shoelace_data VALUES ( + NEW.sl_name, + NEW.sl_avail, + NEW.sl_color, + NEW.sl_len, + NEW.sl_unit); + + CREATE RULE shoelace_upd AS ON UPDATE TO shoelace + DO INSTEAD + UPDATE shoelace_data SET + sl_name = NEW.sl_name, + sl_avail = NEW.sl_avail, + sl_color = NEW.sl_color, + sl_len = NEW.sl_len, + sl_unit = NEW.sl_unit + WHERE sl_name = OLD.sl_name; + + CREATE RULE shoelace_del AS ON DELETE TO shoelace + DO INSTEAD + DELETE FROM shoelace_data + WHERE sl_name = OLD.sl_name; + + CREATE TABLE shoelace_arrive ( + arr_name char(10), + arr_quant integer + ); + + CREATE TABLE shoelace_ok ( + ok_name char(10), + ok_quant integer + ); + + CREATE RULE shoelace_ok_ins AS ON INSERT TO shoelace_ok + DO INSTEAD + UPDATE shoelace SET + sl_avail = sl_avail + NEW.ok_quant + WHERE sl_name = NEW.ok_name; + +INSERT INTO shoelace_arrive VALUES ('sl3', 10); +INSERT INTO shoelace_arrive VALUES ('sl6', 20); +INSERT INTO shoelace_arrive VALUES ('sl8', 20); + +SELECT * FROM shoelace ORDER BY sl_name; + +insert into shoelace_ok select * from shoelace_arrive; + +SELECT * FROM shoelace ORDER BY sl_name; + +SELECT * FROM shoelace_log ORDER BY sl_name; + + CREATE VIEW shoelace_obsolete AS + SELECT * FROM shoelace WHERE NOT EXISTS + (SELECT shoename FROM shoe WHERE slcolor = sl_color); + + CREATE VIEW shoelace_candelete AS + SELECT * FROM shoelace_obsolete WHERE sl_avail = 0; + +insert into shoelace values ('sl9', 0, 'pink', 35.0, 'inch', 0.0); +insert into shoelace values ('sl10', 1000, 'magenta', 40.0, 'inch', 0.0); +-- Unsupported (even though a similar updatable view construct is) +insert into shoelace values ('sl10', 1000, 'magenta', 40.0, 'inch', 0.0) + on conflict do nothing; + +SELECT * FROM shoelace_obsolete ORDER BY sl_len_cm; +SELECT * FROM shoelace_candelete; + +DELETE FROM shoelace WHERE EXISTS + (SELECT * FROM shoelace_candelete + WHERE sl_name = shoelace.sl_name); + +SELECT * FROM shoelace ORDER BY sl_name; + +SELECT * FROM shoe ORDER BY shoename; +SELECT count(*) FROM shoe; + + +-- +-- Simple test of qualified ON INSERT ... this did not work in 7.0 ... +-- +create table rules_foo (f1 int); +create table rules_foo2 (f1 int); + +create rule rules_foorule as on insert to rules_foo where f1 < 100 +do instead nothing; + +insert into rules_foo values(1); +insert into rules_foo values(1001); +select * from rules_foo; + +drop rule rules_foorule on rules_foo; + +-- this should fail because f1 is not exposed for unqualified reference: +create rule rules_foorule as on insert to rules_foo where f1 < 100 +do instead insert into rules_foo2 values (f1); +-- this is the correct way: +create rule rules_foorule as on insert to rules_foo where f1 < 100 +do instead insert into rules_foo2 values (new.f1); + +insert into rules_foo values(2); +insert into rules_foo values(100); + +select * from rules_foo; +select * from rules_foo2; + +drop rule rules_foorule on rules_foo; +drop table rules_foo; +drop table rules_foo2; + + +-- +-- Test rules containing INSERT ... SELECT, which is a very ugly special +-- case as of 7.1. Example is based on bug report from Joel Burton. +-- +create table pparent (pid int, txt text); +insert into pparent values (1,'parent1'); +insert into pparent values (2,'parent2'); + +create table cchild (pid int, descrip text); +insert into cchild values (1,'descrip1'); + +create view vview as + select pparent.pid, txt, descrip from + pparent left join cchild using (pid); + +create rule rrule as + on update to vview do instead +( + insert into cchild (pid, descrip) + select old.pid, new.descrip where old.descrip isnull; + update cchild set descrip = new.descrip where cchild.pid = old.pid; +); + +select * from vview; +update vview set descrip='test1' where pid=1; +select * from vview; +update vview set descrip='test2' where pid=2; +select * from vview; +update vview set descrip='test3' where pid=3; +select * from vview; +select * from cchild; + +drop rule rrule on vview; +drop view vview; +drop table pparent; +drop table cchild; + + +-- +-- Check that ruleutils are working +-- + +-- temporarily disable fancy output, so view changes create less diff noise +\a\t + +SELECT viewname, definition FROM pg_views +WHERE schemaname IN ('pg_catalog', 'public') +ORDER BY viewname; + +SELECT tablename, rulename, definition FROM pg_rules +WHERE schemaname IN ('pg_catalog', 'public') +ORDER BY tablename, rulename; + +-- restore normal output mode +\a\t + +-- +-- CREATE OR REPLACE RULE +-- + +CREATE TABLE ruletest_tbl (a int, b int); +CREATE TABLE ruletest_tbl2 (a int, b int); + +CREATE OR REPLACE RULE myrule AS ON INSERT TO ruletest_tbl + DO INSTEAD INSERT INTO ruletest_tbl2 VALUES (10, 10); + +INSERT INTO ruletest_tbl VALUES (99, 99); + +CREATE OR REPLACE RULE myrule AS ON INSERT TO ruletest_tbl + DO INSTEAD INSERT INTO ruletest_tbl2 VALUES (1000, 1000); + +INSERT INTO ruletest_tbl VALUES (99, 99); + +SELECT * FROM ruletest_tbl2; + +-- Check that rewrite rules splitting one INSERT into multiple +-- conditional statements does not disable FK checking. +create table rule_and_refint_t1 ( + id1a integer, + id1b integer, + + primary key (id1a, id1b) +); + +create table rule_and_refint_t2 ( + id2a integer, + id2c integer, + + primary key (id2a, id2c) +); + +create table rule_and_refint_t3 ( + id3a integer, + id3b integer, + id3c integer, + data text, + + primary key (id3a, id3b, id3c), + + foreign key (id3a, id3b) references rule_and_refint_t1 (id1a, id1b), + foreign key (id3a, id3c) references rule_and_refint_t2 (id2a, id2c) +); + + +insert into rule_and_refint_t1 values (1, 11); +insert into rule_and_refint_t1 values (1, 12); +insert into rule_and_refint_t1 values (2, 21); +insert into rule_and_refint_t1 values (2, 22); + +insert into rule_and_refint_t2 values (1, 11); +insert into rule_and_refint_t2 values (1, 12); +insert into rule_and_refint_t2 values (2, 21); +insert into rule_and_refint_t2 values (2, 22); + +insert into rule_and_refint_t3 values (1, 11, 11, 'row1'); +insert into rule_and_refint_t3 values (1, 11, 12, 'row2'); +insert into rule_and_refint_t3 values (1, 12, 11, 'row3'); +insert into rule_and_refint_t3 values (1, 12, 12, 'row4'); +insert into rule_and_refint_t3 values (1, 11, 13, 'row5'); +insert into rule_and_refint_t3 values (1, 13, 11, 'row6'); +-- Ordinary table +insert into rule_and_refint_t3 values (1, 13, 11, 'row6') + on conflict do nothing; +-- rule not fired, so fk violation +insert into rule_and_refint_t3 values (1, 13, 11, 'row6') + on conflict (id3a, id3b, id3c) do update + set id3b = excluded.id3b; +-- rule fired, so unsupported +insert into shoelace values ('sl9', 0, 'pink', 35.0, 'inch', 0.0) + on conflict (sl_name) do update + set sl_avail = excluded.sl_avail; + +create rule rule_and_refint_t3_ins as on insert to rule_and_refint_t3 + where (exists (select 1 from rule_and_refint_t3 + where (((rule_and_refint_t3.id3a = new.id3a) + and (rule_and_refint_t3.id3b = new.id3b)) + and (rule_and_refint_t3.id3c = new.id3c)))) + do instead update rule_and_refint_t3 set data = new.data + where (((rule_and_refint_t3.id3a = new.id3a) + and (rule_and_refint_t3.id3b = new.id3b)) + and (rule_and_refint_t3.id3c = new.id3c)); + +insert into rule_and_refint_t3 values (1, 11, 13, 'row7'); +insert into rule_and_refint_t3 values (1, 13, 11, 'row8'); + +-- +-- disallow dropping a view's rule (bug #5072) +-- + +create view rules_fooview as select 'rules_foo'::text; +drop rule "_RETURN" on rules_fooview; +drop view rules_fooview; + +-- +-- test conversion of table to view (needed to load some pg_dump files) +-- + +create table rules_fooview (x int, y text); +select xmin, * from rules_fooview; + +create rule "_RETURN" as on select to rules_fooview do instead + select 1 as x, 'aaa'::text as y; + +select * from rules_fooview; +select xmin, * from rules_fooview; -- fail, views don't have such a column + +select reltoastrelid, relkind, relfrozenxid + from pg_class where oid = 'rules_fooview'::regclass; + +drop view rules_fooview; + +-- trying to convert a partitioned table to view is not allowed +create table rules_fooview (x int, y text) partition by list (x); +create rule "_RETURN" as on select to rules_fooview do instead + select 1 as x, 'aaa'::text as y; + +-- nor can one convert a partition to view +create table rules_fooview_part partition of rules_fooview for values in (1); +create rule "_RETURN" as on select to rules_fooview_part do instead + select 1 as x, 'aaa'::text as y; + +-- +-- check for planner problems with complex inherited UPDATES +-- + +create table id (id serial primary key, name text); +-- currently, must respecify PKEY for each inherited subtable +create table test_1 (id integer primary key) inherits (id); +create table test_2 (id integer primary key) inherits (id); +create table test_3 (id integer primary key) inherits (id); + +insert into test_1 (name) values ('Test 1'); +insert into test_1 (name) values ('Test 2'); +insert into test_2 (name) values ('Test 3'); +insert into test_2 (name) values ('Test 4'); +insert into test_3 (name) values ('Test 5'); +insert into test_3 (name) values ('Test 6'); + +create view id_ordered as select * from id order by id; + +create rule update_id_ordered as on update to id_ordered + do instead update id set name = new.name where id = old.id; + +select * from id_ordered; +update id_ordered set name = 'update 2' where id = 2; +update id_ordered set name = 'update 4' where id = 4; +update id_ordered set name = 'update 5' where id = 5; +select * from id_ordered; + +drop table id cascade; + +-- +-- check corner case where an entirely-dummy subplan is created by +-- constraint exclusion +-- + +create temp table t1 (a integer primary key); + +create temp table t1_1 (check (a >= 0 and a < 10)) inherits (t1); +create temp table t1_2 (check (a >= 10 and a < 20)) inherits (t1); + +create rule t1_ins_1 as on insert to t1 + where new.a >= 0 and new.a < 10 + do instead + insert into t1_1 values (new.a); +create rule t1_ins_2 as on insert to t1 + where new.a >= 10 and new.a < 20 + do instead + insert into t1_2 values (new.a); + +create rule t1_upd_1 as on update to t1 + where old.a >= 0 and old.a < 10 + do instead + update t1_1 set a = new.a where a = old.a; +create rule t1_upd_2 as on update to t1 + where old.a >= 10 and old.a < 20 + do instead + update t1_2 set a = new.a where a = old.a; + +set constraint_exclusion = on; + +insert into t1 select * from generate_series(5,19,1) g; +update t1 set a = 4 where a = 5; + +select * from only t1; +select * from only t1_1; +select * from only t1_2; + +reset constraint_exclusion; + +-- test various flavors of pg_get_viewdef() + +select pg_get_viewdef('shoe'::regclass) as unpretty; +select pg_get_viewdef('shoe'::regclass,true) as pretty; +select pg_get_viewdef('shoe'::regclass,0) as prettier; + +-- +-- check multi-row VALUES in rules +-- + +create table rules_src(f1 int, f2 int); +create table rules_log(f1 int, f2 int, tag text); +insert into rules_src values(1,2), (11,12); +create rule r1 as on update to rules_src do also + insert into rules_log values(old.*, 'old'), (new.*, 'new'); +update rules_src set f2 = f2 + 1; +update rules_src set f2 = f2 * 10; +select * from rules_src; +select * from rules_log; +create rule r2 as on update to rules_src do also + values(old.*, 'old'), (new.*, 'new'); +update rules_src set f2 = f2 / 10; +select * from rules_src; +select * from rules_log; +create rule r3 as on delete to rules_src do notify rules_src_deletion; +\d+ rules_src + +-- +-- Ensure an aliased target relation for insert is correctly deparsed. +-- +create rule r4 as on insert to rules_src do instead insert into rules_log AS trgt SELECT NEW.* RETURNING trgt.f1, trgt.f2; +create rule r5 as on update to rules_src do instead UPDATE rules_log AS trgt SET tag = 'updated' WHERE trgt.f1 = new.f1; +\d+ rules_src + +-- +-- Also check multiassignment deparsing. +-- +create table rule_t1(f1 int, f2 int); +create table rule_dest(f1 int, f2 int[], tag text); +create rule rr as on update to rule_t1 do instead UPDATE rule_dest trgt + SET (f2[1], f1, tag) = (SELECT new.f2, new.f1, 'updated'::varchar) + WHERE trgt.f1 = new.f1 RETURNING new.*; +\d+ rule_t1 +drop table rule_t1, rule_dest; + +-- +-- check alter rename rule +-- +CREATE TABLE rule_t1 (a INT); +CREATE VIEW rule_v1 AS SELECT * FROM rule_t1; + +CREATE RULE InsertRule AS + ON INSERT TO rule_v1 + DO INSTEAD + INSERT INTO rule_t1 VALUES(new.a); + +ALTER RULE InsertRule ON rule_v1 RENAME to NewInsertRule; + +INSERT INTO rule_v1 VALUES(1); +SELECT * FROM rule_v1; + +\d+ rule_v1 + +-- +-- error conditions for alter rename rule +-- +ALTER RULE InsertRule ON rule_v1 RENAME TO NewInsertRule; -- doesn't exist +ALTER RULE NewInsertRule ON rule_v1 RENAME TO "_RETURN"; -- already exists +ALTER RULE "_RETURN" ON rule_v1 RENAME TO abc; -- ON SELECT rule cannot be renamed + +DROP VIEW rule_v1; +DROP TABLE rule_t1; + +-- +-- check display of VALUES in view definitions +-- +create view rule_v1 as values(1,2); +\d+ rule_v1 +alter table rule_v1 rename column column2 to q2; +\d+ rule_v1 +drop view rule_v1; +create view rule_v1(x) as values(1,2); +\d+ rule_v1 +drop view rule_v1; +create view rule_v1(x) as select * from (values(1,2)) v; +\d+ rule_v1 +drop view rule_v1; +create view rule_v1(x) as select * from (values(1,2)) v(q,w); +\d+ rule_v1 +drop view rule_v1; + +-- +-- Check DO INSTEAD rules with ON CONFLICT +-- +CREATE TABLE hats ( + hat_name char(10) primary key, + hat_color char(10) -- hat color +); + +CREATE TABLE hat_data ( + hat_name char(10), + hat_color char(10) -- hat color +); +create unique index hat_data_unique_idx + on hat_data (hat_name COLLATE "C" bpchar_pattern_ops); + +-- DO NOTHING with ON CONFLICT +CREATE RULE hat_nosert AS ON INSERT TO hats + DO INSTEAD + INSERT INTO hat_data VALUES ( + NEW.hat_name, + NEW.hat_color) + ON CONFLICT (hat_name COLLATE "C" bpchar_pattern_ops) WHERE hat_color = 'green' + DO NOTHING + RETURNING *; +SELECT definition FROM pg_rules WHERE tablename = 'hats' ORDER BY rulename; + +-- Works (projects row) +INSERT INTO hats VALUES ('h7', 'black') RETURNING *; +-- Works (does nothing) +INSERT INTO hats VALUES ('h7', 'black') RETURNING *; +SELECT tablename, rulename, definition FROM pg_rules + WHERE tablename = 'hats'; +DROP RULE hat_nosert ON hats; + +-- DO NOTHING without ON CONFLICT +CREATE RULE hat_nosert_all AS ON INSERT TO hats + DO INSTEAD + INSERT INTO hat_data VALUES ( + NEW.hat_name, + NEW.hat_color) + ON CONFLICT + DO NOTHING + RETURNING *; +SELECT definition FROM pg_rules WHERE tablename = 'hats' ORDER BY rulename; +DROP RULE hat_nosert_all ON hats; + +-- Works (does nothing) +INSERT INTO hats VALUES ('h7', 'black') RETURNING *; + +-- DO UPDATE with a WHERE clause +CREATE RULE hat_upsert AS ON INSERT TO hats + DO INSTEAD + INSERT INTO hat_data VALUES ( + NEW.hat_name, + NEW.hat_color) + ON CONFLICT (hat_name) + DO UPDATE + SET hat_name = hat_data.hat_name, hat_color = excluded.hat_color + WHERE excluded.hat_color <> 'forbidden' AND hat_data.* != excluded.* + RETURNING *; +SELECT definition FROM pg_rules WHERE tablename = 'hats' ORDER BY rulename; + +-- Works (does upsert) +INSERT INTO hats VALUES ('h8', 'black') RETURNING *; +SELECT * FROM hat_data WHERE hat_name = 'h8'; +INSERT INTO hats VALUES ('h8', 'white') RETURNING *; +SELECT * FROM hat_data WHERE hat_name = 'h8'; +INSERT INTO hats VALUES ('h8', 'forbidden') RETURNING *; +SELECT * FROM hat_data WHERE hat_name = 'h8'; +SELECT tablename, rulename, definition FROM pg_rules + WHERE tablename = 'hats'; +-- ensure explain works for on insert conflict rules +explain (costs off) INSERT INTO hats VALUES ('h8', 'forbidden') RETURNING *; + +-- ensure upserting into a rule, with a CTE (different offsets!) works +WITH data(hat_name, hat_color) AS MATERIALIZED ( + VALUES ('h8', 'green'), + ('h9', 'blue'), + ('h7', 'forbidden') +) +INSERT INTO hats + SELECT * FROM data +RETURNING *; +EXPLAIN (costs off) +WITH data(hat_name, hat_color) AS MATERIALIZED ( + VALUES ('h8', 'green'), + ('h9', 'blue'), + ('h7', 'forbidden') +) +INSERT INTO hats + SELECT * FROM data +RETURNING *; +SELECT * FROM hat_data WHERE hat_name IN ('h8', 'h9', 'h7') ORDER BY hat_name; + +DROP RULE hat_upsert ON hats; + +drop table hats; +drop table hat_data; + +-- test for pg_get_functiondef properly regurgitating SET parameters +-- Note that the function is kept around to stress pg_dump. +CREATE FUNCTION func_with_set_params() RETURNS integer + AS 'select 1;' + LANGUAGE SQL + SET search_path TO PG_CATALOG + SET extra_float_digits TO 2 + SET work_mem TO '4MB' + SET datestyle to iso, mdy + SET local_preload_libraries TO "Mixed/Case", 'c:/''a"/path', '', '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' + IMMUTABLE STRICT; +SELECT pg_get_functiondef('func_with_set_params()'::regprocedure); + +-- tests for pg_get_*def with invalid objects +SELECT pg_get_constraintdef(0); +SELECT pg_get_functiondef(0); +SELECT pg_get_indexdef(0); +SELECT pg_get_ruledef(0); +SELECT pg_get_statisticsobjdef(0); +SELECT pg_get_triggerdef(0); +SELECT pg_get_viewdef(0); +SELECT pg_get_function_arguments(0); +SELECT pg_get_function_identity_arguments(0); +SELECT pg_get_function_result(0); +SELECT pg_get_function_arg_default(0, 0); +SELECT pg_get_function_arg_default('pg_class'::regclass, 0); +SELECT pg_get_partkeydef(0); + +-- test rename for a rule defined on a partitioned table +CREATE TABLE rules_parted_table (a int) PARTITION BY LIST (a); +CREATE TABLE rules_parted_table_1 PARTITION OF rules_parted_table FOR VALUES IN (1); +CREATE RULE rules_parted_table_insert AS ON INSERT to rules_parted_table + DO INSTEAD INSERT INTO rules_parted_table_1 VALUES (NEW.*); +ALTER RULE rules_parted_table_insert ON rules_parted_table RENAME TO rules_parted_table_insert_redirect; +DROP TABLE rules_parted_table; + +-- +-- Test enabling/disabling +-- +CREATE TABLE ruletest1 (a int); +CREATE TABLE ruletest2 (b int); + +CREATE RULE rule1 AS ON INSERT TO ruletest1 + DO INSTEAD INSERT INTO ruletest2 VALUES (NEW.*); + +INSERT INTO ruletest1 VALUES (1); +ALTER TABLE ruletest1 DISABLE RULE rule1; +INSERT INTO ruletest1 VALUES (2); +ALTER TABLE ruletest1 ENABLE RULE rule1; +SET session_replication_role = replica; +INSERT INTO ruletest1 VALUES (3); +ALTER TABLE ruletest1 ENABLE REPLICA RULE rule1; +INSERT INTO ruletest1 VALUES (4); +RESET session_replication_role; +INSERT INTO ruletest1 VALUES (5); + +SELECT * FROM ruletest1; +SELECT * FROM ruletest2; + +DROP TABLE ruletest1; +DROP TABLE ruletest2; diff --git a/postgresql/examples/sanity_check.sql b/postgresql/examples/sanity_check.sql new file mode 100644 index 0000000..a4ec003 --- /dev/null +++ b/postgresql/examples/sanity_check.sql @@ -0,0 +1,39 @@ +VACUUM; + +-- +-- sanity check, if we don't have indices the test will take years to +-- complete. But skip TOAST relations (since they will have varying +-- names depending on the current OID counter) as well as temp tables +-- of other backends (to avoid timing-dependent behavior). +-- + +-- temporarily disable fancy output, so catalog changes create less diff noise +\a\t + +SELECT relname, relhasindex + FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace + WHERE relkind IN ('r', 'p') AND (nspname ~ '^pg_temp_') IS NOT TRUE + ORDER BY relname; + +-- restore normal output mode +\a\t + +-- +-- another sanity check: every system catalog that has OIDs should have +-- a unique index on OID. This ensures that the OIDs will be unique, +-- even after the OID counter wraps around. +-- We exclude non-system tables from the check by looking at nspname. +-- +SELECT relname, nspname + FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace JOIN pg_attribute a ON (attrelid = c.oid AND attname = 'oid') + WHERE relkind = 'r' and c.oid < 16384 + AND ((nspname ~ '^pg_') IS NOT FALSE) + AND NOT EXISTS (SELECT 1 FROM pg_index i WHERE indrelid = c.oid + AND indkey[0] = a.attnum AND indnatts = 1 + AND indisunique AND indimmediate); + +-- check that relations without storage don't have relfilenode +SELECT relname, relkind + FROM pg_class + WHERE relkind IN ('v', 'c', 'f', 'p', 'I') + AND relfilenode <> 0; diff --git a/postgresql/examples/security_label.sql b/postgresql/examples/security_label.sql new file mode 100644 index 0000000..98e6a5f --- /dev/null +++ b/postgresql/examples/security_label.sql @@ -0,0 +1,45 @@ +-- +-- Test for facilities of security label +-- + +-- initial setups +SET client_min_messages TO 'warning'; + +DROP ROLE IF EXISTS regress_seclabel_user1; +DROP ROLE IF EXISTS regress_seclabel_user2; + +RESET client_min_messages; + +CREATE USER regress_seclabel_user1 WITH CREATEROLE; +CREATE USER regress_seclabel_user2; + +CREATE TABLE seclabel_tbl1 (a int, b text); +CREATE TABLE seclabel_tbl2 (x int, y text); +CREATE VIEW seclabel_view1 AS SELECT * FROM seclabel_tbl2; +CREATE FUNCTION seclabel_four() RETURNS integer AS $$SELECT 4$$ language sql; +CREATE DOMAIN seclabel_domain AS text; + +ALTER TABLE seclabel_tbl1 OWNER TO regress_seclabel_user1; +ALTER TABLE seclabel_tbl2 OWNER TO regress_seclabel_user2; + +-- +-- Test of SECURITY LABEL statement without a plugin +-- +SECURITY LABEL ON TABLE seclabel_tbl1 IS 'classified'; -- fail +SECURITY LABEL FOR 'dummy' ON TABLE seclabel_tbl1 IS 'classified'; -- fail +SECURITY LABEL ON TABLE seclabel_tbl1 IS '...invalid label...'; -- fail +SECURITY LABEL ON TABLE seclabel_tbl3 IS 'unclassified'; -- fail + +SECURITY LABEL ON ROLE regress_seclabel_user1 IS 'classified'; -- fail +SECURITY LABEL FOR 'dummy' ON ROLE regress_seclabel_user1 IS 'classified'; -- fail +SECURITY LABEL ON ROLE regress_seclabel_user1 IS '...invalid label...'; -- fail +SECURITY LABEL ON ROLE regress_seclabel_user3 IS 'unclassified'; -- fail + +-- clean up objects +DROP FUNCTION seclabel_four(); +DROP DOMAIN seclabel_domain; +DROP VIEW seclabel_view1; +DROP TABLE seclabel_tbl1; +DROP TABLE seclabel_tbl2; +DROP USER regress_seclabel_user1; +DROP USER regress_seclabel_user2; diff --git a/postgresql/examples/select.sql b/postgresql/examples/select.sql new file mode 100644 index 0000000..b5929b2 --- /dev/null +++ b/postgresql/examples/select.sql @@ -0,0 +1,264 @@ +-- +-- SELECT +-- + +-- btree index +-- awk '{if($1<10){print;}else{next;}}' onek.data | sort +0n -1 +-- +SELECT * FROM onek + WHERE onek.unique1 < 10 + ORDER BY onek.unique1; + +-- +-- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 +-- +SELECT onek.unique1, onek.stringu1 FROM onek + WHERE onek.unique1 < 20 + ORDER BY unique1 using >; + +-- +-- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 +-- +SELECT onek.unique1, onek.stringu1 FROM onek + WHERE onek.unique1 > 980 + ORDER BY stringu1 using <; + +-- +-- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data | +-- sort +1d -2 +0nr -1 +-- +SELECT onek.unique1, onek.string4 FROM onek + WHERE onek.unique1 > 980 + ORDER BY string4 using <, unique1 using >; + +-- +-- awk '{if($1>980){print $1,$16;}else{next;}}' onek.data | +-- sort +1dr -2 +0n -1 +-- +SELECT onek.unique1, onek.string4 FROM onek + WHERE onek.unique1 > 980 + ORDER BY string4 using >, unique1 using <; + +-- +-- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data | +-- sort +0nr -1 +1d -2 +-- +SELECT onek.unique1, onek.string4 FROM onek + WHERE onek.unique1 < 20 + ORDER BY unique1 using >, string4 using <; + +-- +-- awk '{if($1<20){print $1,$16;}else{next;}}' onek.data | +-- sort +0n -1 +1dr -2 +-- +SELECT onek.unique1, onek.string4 FROM onek + WHERE onek.unique1 < 20 + ORDER BY unique1 using <, string4 using >; + +-- +-- test partial btree indexes +-- +-- As of 7.2, planner probably won't pick an indexscan without stats, +-- so ANALYZE first. Also, we want to prevent it from picking a bitmapscan +-- followed by sort, because that could hide index ordering problems. +-- +ANALYZE onek2; + +SET enable_seqscan TO off; +SET enable_bitmapscan TO off; +SET enable_sort TO off; + +-- +-- awk '{if($1<10){print $0;}else{next;}}' onek.data | sort +0n -1 +-- +SELECT onek2.* FROM onek2 WHERE onek2.unique1 < 10; + +-- +-- awk '{if($1<20){print $1,$14;}else{next;}}' onek.data | sort +0nr -1 +-- +SELECT onek2.unique1, onek2.stringu1 FROM onek2 + WHERE onek2.unique1 < 20 + ORDER BY unique1 using >; + +-- +-- awk '{if($1>980){print $1,$14;}else{next;}}' onek.data | sort +1d -2 +-- +SELECT onek2.unique1, onek2.stringu1 FROM onek2 + WHERE onek2.unique1 > 980; + +RESET enable_seqscan; +RESET enable_bitmapscan; +RESET enable_sort; + + +SELECT two, stringu1, ten, string4 + INTO TABLE tmp + FROM onek; + +-- +-- awk '{print $1,$2;}' person.data | +-- awk '{if(NF!=2){print $3,$2;}else{print;}}' - emp.data | +-- awk '{if(NF!=2){print $3,$2;}else{print;}}' - student.data | +-- awk 'BEGIN{FS=" ";}{if(NF!=2){print $4,$5;}else{print;}}' - stud_emp.data +-- +-- SELECT name, age FROM person*; ??? check if different +SELECT p.name, p.age FROM person* p; + +-- +-- awk '{print $1,$2;}' person.data | +-- awk '{if(NF!=2){print $3,$2;}else{print;}}' - emp.data | +-- awk '{if(NF!=2){print $3,$2;}else{print;}}' - student.data | +-- awk 'BEGIN{FS=" ";}{if(NF!=1){print $4,$5;}else{print;}}' - stud_emp.data | +-- sort +1nr -2 +-- +SELECT p.name, p.age FROM person* p ORDER BY age using >, name; + +-- +-- Test some cases involving whole-row Var referencing a subquery +-- +select foo from (select 1 offset 0) as foo; +select foo from (select null offset 0) as foo; +select foo from (select 'xyzzy',1,null offset 0) as foo; + +-- +-- Test VALUES lists +-- +select * from onek, (values(147, 'RFAAAA'), (931, 'VJAAAA')) as v (i, j) + WHERE onek.unique1 = v.i and onek.stringu1 = v.j; + +-- a more complex case +-- looks like we're coding lisp :-) +select * from onek, + (values ((select i from + (values(10000), (2), (389), (1000), (2000), ((select 10029))) as foo(i) + order by i asc limit 1))) bar (i) + where onek.unique1 = bar.i; + +-- try VALUES in a subquery +select * from onek + where (unique1,ten) in (values (1,1), (20,0), (99,9), (17,99)) + order by unique1; + +-- VALUES is also legal as a standalone query or a set-operation member +VALUES (1,2), (3,4+4), (7,77.7); + +VALUES (1,2), (3,4+4), (7,77.7) +UNION ALL +SELECT 2+2, 57 +UNION ALL +TABLE int8_tbl; + +-- +-- Test ORDER BY options +-- + +CREATE TEMP TABLE foo (f1 int); + +INSERT INTO foo VALUES (42),(3),(10),(7),(null),(null),(1); + +SELECT * FROM foo ORDER BY f1; +SELECT * FROM foo ORDER BY f1 ASC; -- same thing +SELECT * FROM foo ORDER BY f1 NULLS FIRST; +SELECT * FROM foo ORDER BY f1 DESC; +SELECT * FROM foo ORDER BY f1 DESC NULLS LAST; + +-- check if indexscans do the right things +CREATE INDEX fooi ON foo (f1); +SET enable_sort = false; + +SELECT * FROM foo ORDER BY f1; +SELECT * FROM foo ORDER BY f1 NULLS FIRST; +SELECT * FROM foo ORDER BY f1 DESC; +SELECT * FROM foo ORDER BY f1 DESC NULLS LAST; + +DROP INDEX fooi; +CREATE INDEX fooi ON foo (f1 DESC); + +SELECT * FROM foo ORDER BY f1; +SELECT * FROM foo ORDER BY f1 NULLS FIRST; +SELECT * FROM foo ORDER BY f1 DESC; +SELECT * FROM foo ORDER BY f1 DESC NULLS LAST; + +DROP INDEX fooi; +CREATE INDEX fooi ON foo (f1 DESC NULLS LAST); + +SELECT * FROM foo ORDER BY f1; +SELECT * FROM foo ORDER BY f1 NULLS FIRST; +SELECT * FROM foo ORDER BY f1 DESC; +SELECT * FROM foo ORDER BY f1 DESC NULLS LAST; + +-- +-- Test planning of some cases with partial indexes +-- + +-- partial index is usable +explain (costs off) +select * from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; +select * from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; +-- actually run the query with an analyze to use the partial index +explain (costs off, analyze on, timing off, summary off) +select * from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; +explain (costs off) +select unique2 from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; +select unique2 from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; +-- partial index predicate implies clause, so no need for retest +explain (costs off) +select * from onek2 where unique2 = 11 and stringu1 < 'B'; +select * from onek2 where unique2 = 11 and stringu1 < 'B'; +explain (costs off) +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; +-- but if it's an update target, must retest anyway +explain (costs off) +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B' for update; +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B' for update; +-- partial index is not applicable +explain (costs off) +select unique2 from onek2 where unique2 = 11 and stringu1 < 'C'; +select unique2 from onek2 where unique2 = 11 and stringu1 < 'C'; +-- partial index implies clause, but bitmap scan must recheck predicate anyway +SET enable_indexscan TO off; +explain (costs off) +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; +RESET enable_indexscan; +-- check multi-index cases too +explain (costs off) +select unique1, unique2 from onek2 + where (unique2 = 11 or unique1 = 0) and stringu1 < 'B'; +select unique1, unique2 from onek2 + where (unique2 = 11 or unique1 = 0) and stringu1 < 'B'; +explain (costs off) +select unique1, unique2 from onek2 + where (unique2 = 11 and stringu1 < 'B') or unique1 = 0; +select unique1, unique2 from onek2 + where (unique2 = 11 and stringu1 < 'B') or unique1 = 0; + +-- +-- Test some corner cases that have been known to confuse the planner +-- + +-- ORDER BY on a constant doesn't really need any sorting +SELECT 1 AS x ORDER BY x; + +-- But ORDER BY on a set-valued expression does +create function sillysrf(int) returns setof int as + 'values (1),(10),(2),($1)' language sql immutable; + +select sillysrf(42); +select sillysrf(-1) order by 1; + +drop function sillysrf(int); + +-- X = X isn't a no-op, it's effectively X IS NOT NULL assuming = is strict +-- (see bug #5084) +select * from (values (2),(null),(1)) v(k) where k = k order by k; +select * from (values (2),(null),(1)) v(k) where k = k; + +-- Test partitioned tables with no partitions, which should be handled the +-- same as the non-inheritance case when expanding its RTE. +create table list_parted_tbl (a int,b int) partition by list (a); +create table list_parted_tbl1 partition of list_parted_tbl + for values in (1) partition by list(b); +explain (costs off) select * from list_parted_tbl; +drop table list_parted_tbl; diff --git a/postgresql/examples/select_distinct.sql b/postgresql/examples/select_distinct.sql new file mode 100644 index 0000000..3310274 --- /dev/null +++ b/postgresql/examples/select_distinct.sql @@ -0,0 +1,137 @@ +-- +-- SELECT_DISTINCT +-- + +-- +-- awk '{print $3;}' onek.data | sort -n | uniq +-- +SELECT DISTINCT two FROM tmp ORDER BY 1; + +-- +-- awk '{print $5;}' onek.data | sort -n | uniq +-- +SELECT DISTINCT ten FROM tmp ORDER BY 1; + +-- +-- awk '{print $16;}' onek.data | sort -d | uniq +-- +SELECT DISTINCT string4 FROM tmp ORDER BY 1; + +-- +-- awk '{print $3,$16,$5;}' onek.data | sort -d | uniq | +-- sort +0n -1 +1d -2 +2n -3 +-- +SELECT DISTINCT two, string4, ten + FROM tmp + ORDER BY two using <, string4 using <, ten using <; + +-- +-- awk '{print $2;}' person.data | +-- awk '{if(NF!=1){print $2;}else{print;}}' - emp.data | +-- awk '{if(NF!=1){print $2;}else{print;}}' - student.data | +-- awk 'BEGIN{FS=" ";}{if(NF!=1){print $5;}else{print;}}' - stud_emp.data | +-- sort -n -r | uniq +-- +SELECT DISTINCT p.age FROM person* p ORDER BY age using >; + +-- +-- Check mentioning same column more than once +-- + +EXPLAIN (VERBOSE, COSTS OFF) +SELECT count(*) FROM + (SELECT DISTINCT two, four, two FROM tenk1) ss; + +SELECT count(*) FROM + (SELECT DISTINCT two, four, two FROM tenk1) ss; + +-- +-- Compare results between plans using sorting and plans using hash +-- aggregation. Force spilling in both cases by setting work_mem low. +-- + +SET work_mem='64kB'; + +-- Produce results with sorting. + +SET enable_hashagg=FALSE; + +SET jit_above_cost=0; + +EXPLAIN (costs off) +SELECT DISTINCT g%1000 FROM generate_series(0,9999) g; + +CREATE TABLE distinct_group_1 AS +SELECT DISTINCT g%1000 FROM generate_series(0,9999) g; + +SET jit_above_cost TO DEFAULT; + +CREATE TABLE distinct_group_2 AS +SELECT DISTINCT (g%1000)::text FROM generate_series(0,9999) g; + +SET enable_hashagg=TRUE; + +-- Produce results with hash aggregation. + +SET enable_sort=FALSE; + +SET jit_above_cost=0; + +EXPLAIN (costs off) +SELECT DISTINCT g%1000 FROM generate_series(0,9999) g; + +CREATE TABLE distinct_hash_1 AS +SELECT DISTINCT g%1000 FROM generate_series(0,9999) g; + +SET jit_above_cost TO DEFAULT; + +CREATE TABLE distinct_hash_2 AS +SELECT DISTINCT (g%1000)::text FROM generate_series(0,9999) g; + +SET enable_sort=TRUE; + +SET work_mem TO DEFAULT; + +-- Compare results + +(SELECT * FROM distinct_hash_1 EXCEPT SELECT * FROM distinct_group_1) + UNION ALL +(SELECT * FROM distinct_group_1 EXCEPT SELECT * FROM distinct_hash_1); + +(SELECT * FROM distinct_hash_1 EXCEPT SELECT * FROM distinct_group_1) + UNION ALL +(SELECT * FROM distinct_group_1 EXCEPT SELECT * FROM distinct_hash_1); + +DROP TABLE distinct_hash_1; +DROP TABLE distinct_hash_2; +DROP TABLE distinct_group_1; +DROP TABLE distinct_group_2; + +-- +-- Also, some tests of IS DISTINCT FROM, which doesn't quite deserve its +-- very own regression file. +-- + +CREATE TEMP TABLE disttable (f1 integer); +INSERT INTO DISTTABLE VALUES(1); +INSERT INTO DISTTABLE VALUES(2); +INSERT INTO DISTTABLE VALUES(3); +INSERT INTO DISTTABLE VALUES(NULL); + +-- basic cases +SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable; +SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable; +SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable; +SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable; + +-- check that optimizer constant-folds it properly +SELECT 1 IS DISTINCT FROM 2 as "yes"; +SELECT 2 IS DISTINCT FROM 2 as "no"; +SELECT 2 IS DISTINCT FROM null as "yes"; +SELECT null IS DISTINCT FROM null as "no"; + +-- negated form +SELECT 1 IS NOT DISTINCT FROM 2 as "no"; +SELECT 2 IS NOT DISTINCT FROM 2 as "yes"; +SELECT 2 IS NOT DISTINCT FROM null as "no"; +SELECT null IS NOT DISTINCT FROM null as "yes"; diff --git a/postgresql/examples/select_distinct_on.sql b/postgresql/examples/select_distinct_on.sql new file mode 100644 index 0000000..d18733d --- /dev/null +++ b/postgresql/examples/select_distinct_on.sql @@ -0,0 +1,19 @@ +-- +-- SELECT_DISTINCT_ON +-- + +SELECT DISTINCT ON (string4) string4, two, ten + FROM tmp + ORDER BY string4 using <, two using >, ten using <; + +-- this will fail due to conflict of ordering requirements +SELECT DISTINCT ON (string4, ten) string4, two, ten + FROM tmp + ORDER BY string4 using <, two using <, ten using <; + +SELECT DISTINCT ON (string4, ten) string4, ten, two + FROM tmp + ORDER BY string4 using <, ten using >, two using <; + +-- bug #5049: early 8.4.x chokes on volatile DISTINCT ON clauses +select distinct on (1) floor(random()) as r, f1 from int4_tbl order by 1,2; diff --git a/postgresql/examples/select_having.sql b/postgresql/examples/select_having.sql new file mode 100644 index 0000000..bc0cdc0 --- /dev/null +++ b/postgresql/examples/select_having.sql @@ -0,0 +1,50 @@ +-- +-- SELECT_HAVING +-- + +-- load test data +CREATE TABLE test_having (a int, b int, c char(8), d char); +INSERT INTO test_having VALUES (0, 1, 'XXXX', 'A'); +INSERT INTO test_having VALUES (1, 2, 'AAAA', 'b'); +INSERT INTO test_having VALUES (2, 2, 'AAAA', 'c'); +INSERT INTO test_having VALUES (3, 3, 'BBBB', 'D'); +INSERT INTO test_having VALUES (4, 3, 'BBBB', 'e'); +INSERT INTO test_having VALUES (5, 3, 'bbbb', 'F'); +INSERT INTO test_having VALUES (6, 4, 'cccc', 'g'); +INSERT INTO test_having VALUES (7, 4, 'cccc', 'h'); +INSERT INTO test_having VALUES (8, 4, 'CCCC', 'I'); +INSERT INTO test_having VALUES (9, 4, 'CCCC', 'j'); + +SELECT b, c FROM test_having + GROUP BY b, c HAVING count(*) = 1 ORDER BY b, c; + +-- HAVING is effectively equivalent to WHERE in this case +SELECT b, c FROM test_having + GROUP BY b, c HAVING b = 3 ORDER BY b, c; + +SELECT lower(c), count(c) FROM test_having + GROUP BY lower(c) HAVING count(*) > 2 OR min(a) = max(a) + ORDER BY lower(c); + +SELECT c, max(a) FROM test_having + GROUP BY c HAVING count(*) > 2 OR min(a) = max(a) + ORDER BY c; + +-- test degenerate cases involving HAVING without GROUP BY +-- Per SQL spec, these should generate 0 or 1 row, even without aggregates + +SELECT min(a), max(a) FROM test_having HAVING min(a) = max(a); +SELECT min(a), max(a) FROM test_having HAVING min(a) < max(a); + +-- errors: ungrouped column references +SELECT a FROM test_having HAVING min(a) < max(a); +SELECT 1 AS one FROM test_having HAVING a > 1; + +-- the really degenerate case: need not scan table at all +SELECT 1 AS one FROM test_having HAVING 1 > 2; +SELECT 1 AS one FROM test_having HAVING 1 < 2; + +-- and just to prove that we aren't scanning the table: +SELECT 1 AS one FROM test_having WHERE 1/a = 1 HAVING 1 < 2; + +DROP TABLE test_having; diff --git a/postgresql/examples/select_implicit.sql b/postgresql/examples/select_implicit.sql new file mode 100644 index 0000000..d815504 --- /dev/null +++ b/postgresql/examples/select_implicit.sql @@ -0,0 +1,154 @@ +-- +-- SELECT_IMPLICIT +-- Test cases for queries with ordering terms missing from the target list. +-- This used to be called "junkfilter.sql". +-- The parser uses the term "resjunk" to handle these cases. +-- - thomas 1998-07-09 +-- + +-- load test data +CREATE TABLE test_missing_target (a int, b int, c char(8), d char); +INSERT INTO test_missing_target VALUES (0, 1, 'XXXX', 'A'); +INSERT INTO test_missing_target VALUES (1, 2, 'ABAB', 'b'); +INSERT INTO test_missing_target VALUES (2, 2, 'ABAB', 'c'); +INSERT INTO test_missing_target VALUES (3, 3, 'BBBB', 'D'); +INSERT INTO test_missing_target VALUES (4, 3, 'BBBB', 'e'); +INSERT INTO test_missing_target VALUES (5, 3, 'bbbb', 'F'); +INSERT INTO test_missing_target VALUES (6, 4, 'cccc', 'g'); +INSERT INTO test_missing_target VALUES (7, 4, 'cccc', 'h'); +INSERT INTO test_missing_target VALUES (8, 4, 'CCCC', 'I'); +INSERT INTO test_missing_target VALUES (9, 4, 'CCCC', 'j'); + + +-- w/ existing GROUP BY target +SELECT c, count(*) FROM test_missing_target GROUP BY test_missing_target.c ORDER BY c; + +-- w/o existing GROUP BY target using a relation name in GROUP BY clause +SELECT count(*) FROM test_missing_target GROUP BY test_missing_target.c ORDER BY c; + +-- w/o existing GROUP BY target and w/o existing a different ORDER BY target +-- failure expected +SELECT count(*) FROM test_missing_target GROUP BY a ORDER BY b; + +-- w/o existing GROUP BY target and w/o existing same ORDER BY target +SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b; + +-- w/ existing GROUP BY target using a relation name in target +SELECT test_missing_target.b, count(*) + FROM test_missing_target GROUP BY b ORDER BY b; + +-- w/o existing GROUP BY target +SELECT c FROM test_missing_target ORDER BY a; + +-- w/o existing ORDER BY target +SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b desc; + +-- group using reference number +SELECT count(*) FROM test_missing_target ORDER BY 1 desc; + +-- order using reference number +SELECT c, count(*) FROM test_missing_target GROUP BY 1 ORDER BY 1; + +-- group using reference number out of range +-- failure expected +SELECT c, count(*) FROM test_missing_target GROUP BY 3; + +-- group w/o existing GROUP BY and ORDER BY target under ambiguous condition +-- failure expected +SELECT count(*) FROM test_missing_target x, test_missing_target y + WHERE x.a = y.a + GROUP BY b ORDER BY b; + +-- order w/ target under ambiguous condition +-- failure NOT expected +SELECT a, a FROM test_missing_target + ORDER BY a; + +-- order expression w/ target under ambiguous condition +-- failure NOT expected +SELECT a/2, a/2 FROM test_missing_target + ORDER BY a/2; + +-- group expression w/ target under ambiguous condition +-- failure NOT expected +SELECT a/2, a/2 FROM test_missing_target + GROUP BY a/2 ORDER BY a/2; + +-- group w/ existing GROUP BY target under ambiguous condition +SELECT x.b, count(*) FROM test_missing_target x, test_missing_target y + WHERE x.a = y.a + GROUP BY x.b ORDER BY x.b; + +-- group w/o existing GROUP BY target under ambiguous condition +SELECT count(*) FROM test_missing_target x, test_missing_target y + WHERE x.a = y.a + GROUP BY x.b ORDER BY x.b; + +-- group w/o existing GROUP BY target under ambiguous condition +-- into a table +SELECT count(*) INTO TABLE test_missing_target2 +FROM test_missing_target x, test_missing_target y + WHERE x.a = y.a + GROUP BY x.b ORDER BY x.b; +SELECT * FROM test_missing_target2; + + +-- Functions and expressions + +-- w/ existing GROUP BY target +SELECT a%2, count(b) FROM test_missing_target +GROUP BY test_missing_target.a%2 +ORDER BY test_missing_target.a%2; + +-- w/o existing GROUP BY target using a relation name in GROUP BY clause +SELECT count(c) FROM test_missing_target +GROUP BY lower(test_missing_target.c) +ORDER BY lower(test_missing_target.c); + +-- w/o existing GROUP BY target and w/o existing a different ORDER BY target +-- failure expected +SELECT count(a) FROM test_missing_target GROUP BY a ORDER BY b; + +-- w/o existing GROUP BY target and w/o existing same ORDER BY target +SELECT count(b) FROM test_missing_target GROUP BY b/2 ORDER BY b/2; + +-- w/ existing GROUP BY target using a relation name in target +SELECT lower(test_missing_target.c), count(c) + FROM test_missing_target GROUP BY lower(c) ORDER BY lower(c); + +-- w/o existing GROUP BY target +SELECT a FROM test_missing_target ORDER BY upper(d); + +-- w/o existing ORDER BY target +SELECT count(b) FROM test_missing_target + GROUP BY (b + 1) / 2 ORDER BY (b + 1) / 2 desc; + +-- group w/o existing GROUP BY and ORDER BY target under ambiguous condition +-- failure expected +SELECT count(x.a) FROM test_missing_target x, test_missing_target y + WHERE x.a = y.a + GROUP BY b/2 ORDER BY b/2; + +-- group w/ existing GROUP BY target under ambiguous condition +SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y + WHERE x.a = y.a + GROUP BY x.b/2 ORDER BY x.b/2; + +-- group w/o existing GROUP BY target under ambiguous condition +-- failure expected due to ambiguous b in count(b) +SELECT count(b) FROM test_missing_target x, test_missing_target y + WHERE x.a = y.a + GROUP BY x.b/2; + +-- group w/o existing GROUP BY target under ambiguous condition +-- into a table +SELECT count(x.b) INTO TABLE test_missing_target3 +FROM test_missing_target x, test_missing_target y + WHERE x.a = y.a + GROUP BY x.b/2 ORDER BY x.b/2; +SELECT * FROM test_missing_target3; + +-- Cleanup +DROP TABLE test_missing_target; +DROP TABLE test_missing_target2; +DROP TABLE test_missing_target3; diff --git a/postgresql/examples/select_into.sql b/postgresql/examples/select_into.sql new file mode 100644 index 0000000..a708fef --- /dev/null +++ b/postgresql/examples/select_into.sql @@ -0,0 +1,106 @@ +-- +-- SELECT_INTO +-- + +SELECT * + INTO TABLE sitmp1 + FROM onek + WHERE onek.unique1 < 2; + +DROP TABLE sitmp1; + +SELECT * + INTO TABLE sitmp1 + FROM onek2 + WHERE onek2.unique1 < 2; + +DROP TABLE sitmp1; + +-- +-- SELECT INTO and INSERT permission, if owner is not allowed to insert. +-- +CREATE SCHEMA selinto_schema; +CREATE USER regress_selinto_user; +ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user + REVOKE INSERT ON TABLES FROM regress_selinto_user; +GRANT ALL ON SCHEMA selinto_schema TO public; + +SET SESSION AUTHORIZATION regress_selinto_user; +SELECT * INTO TABLE selinto_schema.tmp1 + FROM pg_class WHERE relname like '%a%'; -- Error +SELECT oid AS clsoid, relname, relnatts + 10 AS x + INTO selinto_schema.tmp2 + FROM pg_class WHERE relname like '%b%'; -- Error +CREATE TABLE selinto_schema.tmp3 (a,b,c) + AS SELECT oid,relname,relacl FROM pg_class + WHERE relname like '%c%'; -- Error +RESET SESSION AUTHORIZATION; + +ALTER DEFAULT PRIVILEGES FOR ROLE regress_selinto_user + GRANT INSERT ON TABLES TO regress_selinto_user; + +SET SESSION AUTHORIZATION regress_selinto_user; +SELECT * INTO TABLE selinto_schema.tmp1 + FROM pg_class WHERE relname like '%a%'; -- OK +SELECT oid AS clsoid, relname, relnatts + 10 AS x + INTO selinto_schema.tmp2 + FROM pg_class WHERE relname like '%b%'; -- OK +CREATE TABLE selinto_schema.tmp3 (a,b,c) + AS SELECT oid,relname,relacl FROM pg_class + WHERE relname like '%c%'; -- OK +RESET SESSION AUTHORIZATION; + +DROP SCHEMA selinto_schema CASCADE; +DROP USER regress_selinto_user; + +-- Tests for WITH NO DATA and column name consistency +CREATE TABLE ctas_base (i int, j int); +INSERT INTO ctas_base VALUES (1, 2); +CREATE TABLE ctas_nodata (ii, jj, kk) AS SELECT i, j FROM ctas_base; -- Error +CREATE TABLE ctas_nodata (ii, jj, kk) AS SELECT i, j FROM ctas_base WITH NO DATA; -- Error +CREATE TABLE ctas_nodata (ii, jj) AS SELECT i, j FROM ctas_base; -- OK +CREATE TABLE ctas_nodata_2 (ii, jj) AS SELECT i, j FROM ctas_base WITH NO DATA; -- OK +CREATE TABLE ctas_nodata_3 (ii) AS SELECT i, j FROM ctas_base; -- OK +CREATE TABLE ctas_nodata_4 (ii) AS SELECT i, j FROM ctas_base WITH NO DATA; -- OK +SELECT * FROM ctas_nodata; +SELECT * FROM ctas_nodata_2; +SELECT * FROM ctas_nodata_3; +SELECT * FROM ctas_nodata_4; +DROP TABLE ctas_base; +DROP TABLE ctas_nodata; +DROP TABLE ctas_nodata_2; +DROP TABLE ctas_nodata_3; +DROP TABLE ctas_nodata_4; + +-- +-- CREATE TABLE AS/SELECT INTO as last command in a SQL function +-- have been known to cause problems +-- +CREATE FUNCTION make_table() RETURNS VOID +AS $$ + CREATE TABLE created_table AS SELECT * FROM int8_tbl; +$$ LANGUAGE SQL; + +SELECT make_table(); + +SELECT * FROM created_table; + +-- Try EXPLAIN ANALYZE SELECT INTO and EXPLAIN ANALYZE CREATE TABLE AS +-- WITH NO DATA, but hide the outputs since they won't be stable. +DO $$ +BEGIN + EXECUTE 'EXPLAIN ANALYZE SELECT * INTO TABLE easi FROM int8_tbl'; + EXECUTE 'EXPLAIN ANALYZE CREATE TABLE easi2 AS SELECT * FROM int8_tbl WITH NO DATA'; +END$$; + +DROP TABLE created_table; +DROP TABLE easi, easi2; + +-- +-- Disallowed uses of SELECT ... INTO. All should fail +-- +DECLARE foo CURSOR FOR SELECT 1 INTO b; +COPY (SELECT 1 INTO frak UNION SELECT 2) TO 'blob'; +SELECT * FROM (SELECT 1 INTO f) bar; +CREATE VIEW foo AS SELECT 1 INTO b; +INSERT INTO b SELECT 1 INTO f; diff --git a/postgresql/examples/select_parallel.sql b/postgresql/examples/select_parallel.sql new file mode 100644 index 0000000..11e7735 --- /dev/null +++ b/postgresql/examples/select_parallel.sql @@ -0,0 +1,455 @@ +-- +-- PARALLEL +-- + +create function sp_parallel_restricted(int) returns int as + $$begin return $1; end$$ language plpgsql parallel restricted; + +-- Serializable isolation would disable parallel query, so explicitly use an +-- arbitrary other level. +begin isolation level repeatable read; + +-- encourage use of parallel plans +set parallel_setup_cost=0; +set parallel_tuple_cost=0; +set min_parallel_table_scan_size=0; +set max_parallel_workers_per_gather=4; + +-- Parallel Append with partial-subplans +explain (costs off) + select round(avg(aa)), sum(aa) from a_star; +select round(avg(aa)), sum(aa) from a_star a1; + +-- Parallel Append with both partial and non-partial subplans +alter table c_star set (parallel_workers = 0); +alter table d_star set (parallel_workers = 0); +explain (costs off) + select round(avg(aa)), sum(aa) from a_star; +select round(avg(aa)), sum(aa) from a_star a2; + +-- Parallel Append with only non-partial subplans +alter table a_star set (parallel_workers = 0); +alter table b_star set (parallel_workers = 0); +alter table e_star set (parallel_workers = 0); +alter table f_star set (parallel_workers = 0); +explain (costs off) + select round(avg(aa)), sum(aa) from a_star; +select round(avg(aa)), sum(aa) from a_star a3; + +-- Disable Parallel Append +alter table a_star reset (parallel_workers); +alter table b_star reset (parallel_workers); +alter table c_star reset (parallel_workers); +alter table d_star reset (parallel_workers); +alter table e_star reset (parallel_workers); +alter table f_star reset (parallel_workers); +set enable_parallel_append to off; +explain (costs off) + select round(avg(aa)), sum(aa) from a_star; +select round(avg(aa)), sum(aa) from a_star a4; +reset enable_parallel_append; + +-- Parallel Append that runs serially +create function sp_test_func() returns setof text as +$$ select 'foo'::varchar union all select 'bar'::varchar $$ +language sql stable; +select sp_test_func() order by 1; + +-- Parallel Append is not to be used when the subpath depends on the outer param +create table part_pa_test(a int, b int) partition by range(a); +create table part_pa_test_p1 partition of part_pa_test for values from (minvalue) to (0); +create table part_pa_test_p2 partition of part_pa_test for values from (0) to (maxvalue); +explain (costs off) + select (select max((select pa1.b from part_pa_test pa1 where pa1.a = pa2.a))) + from part_pa_test pa2; +drop table part_pa_test; + +-- test with leader participation disabled +set parallel_leader_participation = off; +explain (costs off) + select count(*) from tenk1 where stringu1 = 'GRAAAA'; +select count(*) from tenk1 where stringu1 = 'GRAAAA'; + +-- test with leader participation disabled, but no workers available (so +-- the leader will have to run the plan despite the setting) +set max_parallel_workers = 0; +explain (costs off) + select count(*) from tenk1 where stringu1 = 'GRAAAA'; +select count(*) from tenk1 where stringu1 = 'GRAAAA'; + +reset max_parallel_workers; +reset parallel_leader_participation; + +-- test that parallel_restricted function doesn't run in worker +alter table tenk1 set (parallel_workers = 4); +explain (verbose, costs off) +select sp_parallel_restricted(unique1) from tenk1 + where stringu1 = 'GRAAAA' order by 1; + +-- test parallel plan when group by expression is in target list. +explain (costs off) + select length(stringu1) from tenk1 group by length(stringu1); +select length(stringu1) from tenk1 group by length(stringu1); + +explain (costs off) + select stringu1, count(*) from tenk1 group by stringu1 order by stringu1; + +-- test that parallel plan for aggregates is not selected when +-- target list contains parallel restricted clause. +explain (costs off) + select sum(sp_parallel_restricted(unique1)) from tenk1 + group by(sp_parallel_restricted(unique1)); + +-- test prepared statement +prepare tenk1_count(integer) As select count((unique1)) from tenk1 where hundred > $1; +explain (costs off) execute tenk1_count(1); +execute tenk1_count(1); +deallocate tenk1_count; + +-- test parallel plans for queries containing un-correlated subplans. +alter table tenk2 set (parallel_workers = 0); +explain (costs off) + select count(*) from tenk1 where (two, four) not in + (select hundred, thousand from tenk2 where thousand > 100); +select count(*) from tenk1 where (two, four) not in + (select hundred, thousand from tenk2 where thousand > 100); +-- this is not parallel-safe due to use of random() within SubLink's testexpr: +explain (costs off) + select * from tenk1 where (unique1 + random())::integer not in + (select ten from tenk2); +alter table tenk2 reset (parallel_workers); + +-- test parallel plan for a query containing initplan. +set enable_indexscan = off; +set enable_indexonlyscan = off; +set enable_bitmapscan = off; +alter table tenk2 set (parallel_workers = 2); + +explain (costs off) + select count(*) from tenk1 + where tenk1.unique1 = (Select max(tenk2.unique1) from tenk2); +select count(*) from tenk1 + where tenk1.unique1 = (Select max(tenk2.unique1) from tenk2); + +reset enable_indexscan; +reset enable_indexonlyscan; +reset enable_bitmapscan; +alter table tenk2 reset (parallel_workers); + +-- test parallel index scans. +set enable_seqscan to off; +set enable_bitmapscan to off; + +explain (costs off) + select count((unique1)) from tenk1 where hundred > 1; +select count((unique1)) from tenk1 where hundred > 1; + +-- test parallel index-only scans. +explain (costs off) + select count(*) from tenk1 where thousand > 95; +select count(*) from tenk1 where thousand > 95; + +-- test rescan cases too +set enable_material = false; + +explain (costs off) +select * from + (select count(unique1) from tenk1 where hundred > 10) ss + right join (values (1),(2),(3)) v(x) on true; +select * from + (select count(unique1) from tenk1 where hundred > 10) ss + right join (values (1),(2),(3)) v(x) on true; + +explain (costs off) +select * from + (select count(*) from tenk1 where thousand > 99) ss + right join (values (1),(2),(3)) v(x) on true; +select * from + (select count(*) from tenk1 where thousand > 99) ss + right join (values (1),(2),(3)) v(x) on true; + +-- test rescans for a Limit node with a parallel node beneath it. +reset enable_seqscan; +set enable_indexonlyscan to off; +set enable_indexscan to off; +alter table tenk1 set (parallel_workers = 0); +alter table tenk2 set (parallel_workers = 1); +explain (costs off) +select count(*) from tenk1 + left join (select tenk2.unique1 from tenk2 order by 1 limit 1000) ss + on tenk1.unique1 < ss.unique1 + 1 + where tenk1.unique1 < 2; +select count(*) from tenk1 + left join (select tenk2.unique1 from tenk2 order by 1 limit 1000) ss + on tenk1.unique1 < ss.unique1 + 1 + where tenk1.unique1 < 2; +--reset the value of workers for each table as it was before this test. +alter table tenk1 set (parallel_workers = 4); +alter table tenk2 reset (parallel_workers); + +reset enable_material; +reset enable_bitmapscan; +reset enable_indexonlyscan; +reset enable_indexscan; + +-- test parallel bitmap heap scan. +set enable_seqscan to off; +set enable_indexscan to off; +set enable_hashjoin to off; +set enable_mergejoin to off; +set enable_material to off; +-- test prefetching, if the platform allows it +DO $$ +BEGIN + SET effective_io_concurrency = 50; +EXCEPTION WHEN invalid_parameter_value THEN +END $$; +set work_mem='64kB'; --set small work mem to force lossy pages +explain (costs off) + select count(*) from tenk1, tenk2 where tenk1.hundred > 1 and tenk2.thousand=0; +select count(*) from tenk1, tenk2 where tenk1.hundred > 1 and tenk2.thousand=0; + +create table bmscantest (a int, t text); +insert into bmscantest select r, 'fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' FROM generate_series(1,100000) r; +create index i_bmtest ON bmscantest(a); +select count(*) from bmscantest where a>1; + +-- test accumulation of stats for parallel nodes +reset enable_seqscan; +alter table tenk2 set (parallel_workers = 0); +explain (analyze, timing off, summary off, costs off) + select count(*) from tenk1, tenk2 where tenk1.hundred > 1 + and tenk2.thousand=0; +alter table tenk2 reset (parallel_workers); + +reset work_mem; +create function explain_parallel_sort_stats() returns setof text +language plpgsql as +$$ +declare ln text; +begin + for ln in + explain (analyze, timing off, summary off, costs off) + select * from + (select ten from tenk1 where ten < 100 order by ten) ss + right join (values (1),(2),(3)) v(x) on true + loop + ln := regexp_replace(ln, 'Memory: \S*', 'Memory: xxx'); + return next ln; + end loop; +end; +$$; +select * from explain_parallel_sort_stats(); + +reset enable_indexscan; +reset enable_hashjoin; +reset enable_mergejoin; +reset enable_material; +reset effective_io_concurrency; +drop table bmscantest; +drop function explain_parallel_sort_stats(); + +-- test parallel merge join path. +set enable_hashjoin to off; +set enable_nestloop to off; + +explain (costs off) + select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1; +select count(*) from tenk1, tenk2 where tenk1.unique1 = tenk2.unique1; + +reset enable_hashjoin; +reset enable_nestloop; + +-- test gather merge +set enable_hashagg = false; + +explain (costs off) + select count(*) from tenk1 group by twenty; + +select count(*) from tenk1 group by twenty; + +--test expressions in targetlist are pushed down for gather merge +create function sp_simple_func(var1 integer) returns integer +as $$ +begin + return var1 + 10; +end; +$$ language plpgsql PARALLEL SAFE; + +explain (costs off, verbose) + select ten, sp_simple_func(ten) from tenk1 where ten < 100 order by ten; + +drop function sp_simple_func(integer); + +-- test handling of SRFs in targetlist (bug in 10.0) + +explain (costs off) + select count(*), generate_series(1,2) from tenk1 group by twenty; + +select count(*), generate_series(1,2) from tenk1 group by twenty; + +-- test gather merge with parallel leader participation disabled +set parallel_leader_participation = off; + +explain (costs off) + select count(*) from tenk1 group by twenty; + +select count(*) from tenk1 group by twenty; + +reset parallel_leader_participation; + +--test rescan behavior of gather merge +set enable_material = false; + +explain (costs off) +select * from + (select string4, count(unique2) + from tenk1 group by string4 order by string4) ss + right join (values (1),(2),(3)) v(x) on true; + +select * from + (select string4, count(unique2) + from tenk1 group by string4 order by string4) ss + right join (values (1),(2),(3)) v(x) on true; + +reset enable_material; + +reset enable_hashagg; + +-- check parallelized int8 aggregate (bug #14897) +explain (costs off) +select avg(unique1::int8) from tenk1; + +select avg(unique1::int8) from tenk1; + +-- gather merge test with a LIMIT +explain (costs off) + select fivethous from tenk1 order by fivethous limit 4; + +select fivethous from tenk1 order by fivethous limit 4; + +-- gather merge test with 0 worker +set max_parallel_workers = 0; +explain (costs off) + select string4 from tenk1 order by string4 limit 5; +select string4 from tenk1 order by string4 limit 5; + +-- gather merge test with 0 workers, with parallel leader +-- participation disabled (the leader will have to run the plan +-- despite the setting) +set parallel_leader_participation = off; +explain (costs off) + select string4 from tenk1 order by string4 limit 5; +select string4 from tenk1 order by string4 limit 5; + +reset parallel_leader_participation; +reset max_parallel_workers; + +SAVEPOINT settings; +SET LOCAL force_parallel_mode = 1; +explain (costs off) + select stringu1::int2 from tenk1 where unique1 = 1; +ROLLBACK TO SAVEPOINT settings; + +-- exercise record typmod remapping between backends +CREATE FUNCTION make_record(n int) + RETURNS RECORD LANGUAGE plpgsql PARALLEL SAFE AS +$$ +BEGIN + RETURN CASE n + WHEN 1 THEN ROW(1) + WHEN 2 THEN ROW(1, 2) + WHEN 3 THEN ROW(1, 2, 3) + WHEN 4 THEN ROW(1, 2, 3, 4) + ELSE ROW(1, 2, 3, 4, 5) + END; +END; +$$; +SAVEPOINT settings; +SET LOCAL force_parallel_mode = 1; +SELECT make_record(x) FROM (SELECT generate_series(1, 5) x) ss ORDER BY x; +ROLLBACK TO SAVEPOINT settings; +DROP function make_record(n int); + +-- test the sanity of parallel query after the active role is dropped. +drop role if exists regress_parallel_worker; +create role regress_parallel_worker; +set role regress_parallel_worker; +reset session authorization; +drop role regress_parallel_worker; +set force_parallel_mode = 1; +select count(*) from tenk1; +reset force_parallel_mode; +reset role; + +-- Window function calculation can't be pushed to workers. +explain (costs off, verbose) + select count(*) from tenk1 a where (unique1, two) in + (select unique1, row_number() over() from tenk1 b); + + +-- LIMIT/OFFSET within sub-selects can't be pushed to workers. +explain (costs off) + select * from tenk1 a where two in + (select two from tenk1 b where stringu1 like '%AAAA' limit 3); + +-- to increase the parallel query test coverage +SAVEPOINT settings; +SET LOCAL force_parallel_mode = 1; +EXPLAIN (analyze, timing off, summary off, costs off) SELECT * FROM tenk1; +ROLLBACK TO SAVEPOINT settings; + +-- provoke error in worker +SAVEPOINT settings; +SET LOCAL force_parallel_mode = 1; +select stringu1::int2 from tenk1 where unique1 = 1; +ROLLBACK TO SAVEPOINT settings; + +-- test interaction with set-returning functions +SAVEPOINT settings; + +-- multiple subqueries under a single Gather node +-- must set parallel_setup_cost > 0 to discourage multiple Gather nodes +SET LOCAL parallel_setup_cost = 10; +EXPLAIN (COSTS OFF) +SELECT unique1 FROM tenk1 WHERE fivethous = tenthous + 1 +UNION ALL +SELECT unique1 FROM tenk1 WHERE fivethous = tenthous + 1; +ROLLBACK TO SAVEPOINT settings; + +-- can't use multiple subqueries under a single Gather node due to initPlans +EXPLAIN (COSTS OFF) +SELECT unique1 FROM tenk1 WHERE fivethous = + (SELECT unique1 FROM tenk1 WHERE fivethous = 1 LIMIT 1) +UNION ALL +SELECT unique1 FROM tenk1 WHERE fivethous = + (SELECT unique2 FROM tenk1 WHERE fivethous = 1 LIMIT 1) +ORDER BY 1; + +-- test interaction with SRFs +SELECT * FROM information_schema.foreign_data_wrapper_options +ORDER BY 1, 2, 3; + +-- test passing expanded-value representations to workers +CREATE FUNCTION make_some_array(int,int) returns int[] as +$$declare x int[]; + begin + x[1] := $1; + x[2] := $2; + return x; + end$$ language plpgsql parallel safe; +CREATE TABLE fooarr(f1 text, f2 int[], f3 text); +INSERT INTO fooarr VALUES('1', ARRAY[1,2], 'one'); + +PREPARE pstmt(text, int[]) AS SELECT * FROM fooarr WHERE f1 = $1 AND f2 = $2; +EXPLAIN (COSTS OFF) EXECUTE pstmt('1', make_some_array(1,2)); +EXECUTE pstmt('1', make_some_array(1,2)); +DEALLOCATE pstmt; + +-- test interaction between subquery and partial_paths +CREATE VIEW tenk1_vw_sec WITH (security_barrier) AS SELECT * FROM tenk1; +EXPLAIN (COSTS OFF) +SELECT 1 FROM tenk1_vw_sec + WHERE (SELECT sum(f1) FROM int4_tbl WHERE f1 < unique1) < 100; + +rollback; diff --git a/postgresql/examples/select_views.sql b/postgresql/examples/select_views.sql new file mode 100644 index 0000000..1f61166 --- /dev/null +++ b/postgresql/examples/select_views.sql @@ -0,0 +1,156 @@ +-- +-- SELECT_VIEWS +-- test the views defined in CREATE_VIEWS +-- + +SELECT * FROM street; + + + +SELECT * FROM toyemp WHERE name = 'sharon'; + +-- +-- Test for Leaky view scenario +-- +CREATE ROLE regress_alice; + +CREATE FUNCTION f_leak (text) + RETURNS bool LANGUAGE 'plpgsql' COST 0.0000001 + AS 'BEGIN RAISE NOTICE ''f_leak => %'', $1; RETURN true; END'; + +CREATE TABLE customer ( + cid int primary key, + name text not null, + tel text, + passwd text +); + +CREATE TABLE credit_card ( + cid int references customer(cid), + cnum text, + climit int +); + +CREATE TABLE credit_usage ( + cid int references customer(cid), + ymd date, + usage int +); + +INSERT INTO customer + VALUES (101, 'regress_alice', '+81-12-3456-7890', 'passwd123'), + (102, 'regress_bob', '+01-234-567-8901', 'beafsteak'), + (103, 'regress_eve', '+49-8765-43210', 'hamburger'); +INSERT INTO credit_card + VALUES (101, '1111-2222-3333-4444', 4000), + (102, '5555-6666-7777-8888', 3000), + (103, '9801-2345-6789-0123', 2000); +INSERT INTO credit_usage + VALUES (101, '2011-09-15', 120), + (101, '2011-10-05', 90), + (101, '2011-10-18', 110), + (101, '2011-10-21', 200), + (101, '2011-11-10', 80), + (102, '2011-09-22', 300), + (102, '2011-10-12', 120), + (102, '2011-10-28', 200), + (103, '2011-10-15', 480); + +CREATE VIEW my_property_normal AS + SELECT * FROM customer WHERE name = current_user; +CREATE VIEW my_property_secure WITH (security_barrier) AS + SELECT * FROM customer WHERE name = current_user; + +CREATE VIEW my_credit_card_normal AS + SELECT * FROM customer l NATURAL JOIN credit_card r + WHERE l.name = current_user; +CREATE VIEW my_credit_card_secure WITH (security_barrier) AS + SELECT * FROM customer l NATURAL JOIN credit_card r + WHERE l.name = current_user; + +CREATE VIEW my_credit_card_usage_normal AS + SELECT * FROM my_credit_card_secure l NATURAL JOIN credit_usage r; +CREATE VIEW my_credit_card_usage_secure WITH (security_barrier) AS + SELECT * FROM my_credit_card_secure l NATURAL JOIN credit_usage r; + +GRANT SELECT ON my_property_normal TO public; +GRANT SELECT ON my_property_secure TO public; +GRANT SELECT ON my_credit_card_normal TO public; +GRANT SELECT ON my_credit_card_secure TO public; +GRANT SELECT ON my_credit_card_usage_normal TO public; +GRANT SELECT ON my_credit_card_usage_secure TO public; + +-- +-- Run leaky view scenarios +-- +SET SESSION AUTHORIZATION regress_alice; + +-- +-- scenario: if a qualifier with tiny-cost is given, it shall be launched +-- prior to the security policy of the view. +-- +SELECT * FROM my_property_normal WHERE f_leak(passwd); +EXPLAIN (COSTS OFF) SELECT * FROM my_property_normal WHERE f_leak(passwd); + +SELECT * FROM my_property_secure WHERE f_leak(passwd); +EXPLAIN (COSTS OFF) SELECT * FROM my_property_secure WHERE f_leak(passwd); + +-- +-- scenario: qualifiers can be pushed down if they contain leaky functions, +-- provided they aren't passed data from inside the view. +-- +SELECT * FROM my_property_normal v + WHERE f_leak('passwd') AND f_leak(passwd); +EXPLAIN (COSTS OFF) SELECT * FROM my_property_normal v + WHERE f_leak('passwd') AND f_leak(passwd); + +SELECT * FROM my_property_secure v + WHERE f_leak('passwd') AND f_leak(passwd); +EXPLAIN (COSTS OFF) SELECT * FROM my_property_secure v + WHERE f_leak('passwd') AND f_leak(passwd); + +-- +-- scenario: if a qualifier references only one-side of a particular join- +-- tree, it shall be distributed to the most deep scan plan as +-- possible as we can. +-- +SELECT * FROM my_credit_card_normal WHERE f_leak(cnum); +EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_normal WHERE f_leak(cnum); + +SELECT * FROM my_credit_card_secure WHERE f_leak(cnum); +EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_secure WHERE f_leak(cnum); + +-- +-- scenario: an external qualifier can be pushed-down by in-front-of the +-- views with "security_barrier" attribute, except for operators +-- implemented with leakproof functions. +-- +SELECT * FROM my_credit_card_usage_normal + WHERE f_leak(cnum) AND ymd >= '2011-10-01' AND ymd < '2011-11-01'; +EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_usage_normal + WHERE f_leak(cnum) AND ymd >= '2011-10-01' AND ymd < '2011-11-01'; + +SELECT * FROM my_credit_card_usage_secure + WHERE f_leak(cnum) AND ymd >= '2011-10-01' AND ymd < '2011-11-01'; +EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_usage_secure + WHERE f_leak(cnum) AND ymd >= '2011-10-01' AND ymd < '2011-11-01'; + +-- +-- Test for the case when security_barrier gets changed between rewriter +-- and planner stage. +-- +PREPARE p1 AS SELECT * FROM my_property_normal WHERE f_leak(passwd); +PREPARE p2 AS SELECT * FROM my_property_secure WHERE f_leak(passwd); +EXECUTE p1; +EXECUTE p2; +RESET SESSION AUTHORIZATION; +ALTER VIEW my_property_normal SET (security_barrier=true); +ALTER VIEW my_property_secure SET (security_barrier=false); +SET SESSION AUTHORIZATION regress_alice; +EXECUTE p1; -- To be perform as a view with security-barrier +EXECUTE p2; -- To be perform as a view without security-barrier + +-- Cleanup. +RESET SESSION AUTHORIZATION; +DROP ROLE regress_alice; +SELECT name, #thepath FROM iexit ORDER BY name COLLATE "C", 2; diff --git a/postgresql/examples/sequence.sql b/postgresql/examples/sequence.sql new file mode 100644 index 0000000..7928ee2 --- /dev/null +++ b/postgresql/examples/sequence.sql @@ -0,0 +1,408 @@ +-- +-- CREATE SEQUENCE +-- + +-- various error cases +CREATE UNLOGGED SEQUENCE sequence_testx; +CREATE SEQUENCE sequence_testx INCREMENT BY 0; +CREATE SEQUENCE sequence_testx INCREMENT BY -1 MINVALUE 20; +CREATE SEQUENCE sequence_testx INCREMENT BY 1 MAXVALUE -20; +CREATE SEQUENCE sequence_testx INCREMENT BY -1 START 10; +CREATE SEQUENCE sequence_testx INCREMENT BY 1 START -10; +CREATE SEQUENCE sequence_testx CACHE 0; + +-- OWNED BY errors +CREATE SEQUENCE sequence_testx OWNED BY nobody; -- nonsense word +CREATE SEQUENCE sequence_testx OWNED BY pg_class_oid_index.oid; -- not a table +CREATE SEQUENCE sequence_testx OWNED BY pg_class.relname; -- not same schema +CREATE TABLE sequence_test_table (a int); +CREATE SEQUENCE sequence_testx OWNED BY sequence_test_table.b; -- wrong column +DROP TABLE sequence_test_table; + +-- sequence data types +CREATE SEQUENCE sequence_test5 AS integer; +CREATE SEQUENCE sequence_test6 AS smallint; +CREATE SEQUENCE sequence_test7 AS bigint; +CREATE SEQUENCE sequence_test8 AS integer MAXVALUE 100000; +CREATE SEQUENCE sequence_test9 AS integer INCREMENT BY -1; +CREATE SEQUENCE sequence_test10 AS integer MINVALUE -100000 START 1; +CREATE SEQUENCE sequence_test11 AS smallint; +CREATE SEQUENCE sequence_test12 AS smallint INCREMENT -1; +CREATE SEQUENCE sequence_test13 AS smallint MINVALUE -32768; +CREATE SEQUENCE sequence_test14 AS smallint MAXVALUE 32767 INCREMENT -1; +CREATE SEQUENCE sequence_testx AS text; +CREATE SEQUENCE sequence_testx AS nosuchtype; + +CREATE SEQUENCE sequence_testx AS smallint MAXVALUE 100000; +CREATE SEQUENCE sequence_testx AS smallint MINVALUE -100000; + +ALTER SEQUENCE sequence_test5 AS smallint; -- success, max will be adjusted +ALTER SEQUENCE sequence_test8 AS smallint; -- fail, max has to be adjusted +ALTER SEQUENCE sequence_test8 AS smallint MAXVALUE 20000; -- ok now +ALTER SEQUENCE sequence_test9 AS smallint; -- success, min will be adjusted +ALTER SEQUENCE sequence_test10 AS smallint; -- fail, min has to be adjusted +ALTER SEQUENCE sequence_test10 AS smallint MINVALUE -20000; -- ok now + +ALTER SEQUENCE sequence_test11 AS int; -- max will be adjusted +ALTER SEQUENCE sequence_test12 AS int; -- min will be adjusted +ALTER SEQUENCE sequence_test13 AS int; -- min and max will be adjusted +ALTER SEQUENCE sequence_test14 AS int; -- min and max will be adjusted + +--- +--- test creation of SERIAL column +--- + +CREATE TABLE serialTest1 (f1 text, f2 serial); + +INSERT INTO serialTest1 VALUES ('foo'); +INSERT INTO serialTest1 VALUES ('bar'); +INSERT INTO serialTest1 VALUES ('force', 100); +INSERT INTO serialTest1 VALUES ('wrong', NULL); + +SELECT * FROM serialTest1; + +SELECT pg_get_serial_sequence('serialTest1', 'f2'); + +-- test smallserial / bigserial +CREATE TABLE serialTest2 (f1 text, f2 serial, f3 smallserial, f4 serial2, + f5 bigserial, f6 serial8); + +INSERT INTO serialTest2 (f1) + VALUES ('test_defaults'); + +INSERT INTO serialTest2 (f1, f2, f3, f4, f5, f6) + VALUES ('test_max_vals', 2147483647, 32767, 32767, 9223372036854775807, + 9223372036854775807), + ('test_min_vals', -2147483648, -32768, -32768, -9223372036854775808, + -9223372036854775808); + +-- All these INSERTs should fail: +INSERT INTO serialTest2 (f1, f3) + VALUES ('bogus', -32769); + +INSERT INTO serialTest2 (f1, f4) + VALUES ('bogus', -32769); + +INSERT INTO serialTest2 (f1, f3) + VALUES ('bogus', 32768); + +INSERT INTO serialTest2 (f1, f4) + VALUES ('bogus', 32768); + +INSERT INTO serialTest2 (f1, f5) + VALUES ('bogus', -9223372036854775809); + +INSERT INTO serialTest2 (f1, f6) + VALUES ('bogus', -9223372036854775809); + +INSERT INTO serialTest2 (f1, f5) + VALUES ('bogus', 9223372036854775808); + +INSERT INTO serialTest2 (f1, f6) + VALUES ('bogus', 9223372036854775808); + +SELECT * FROM serialTest2 ORDER BY f2 ASC; + +SELECT nextval('serialTest2_f2_seq'); +SELECT nextval('serialTest2_f3_seq'); +SELECT nextval('serialTest2_f4_seq'); +SELECT nextval('serialTest2_f5_seq'); +SELECT nextval('serialTest2_f6_seq'); + +-- basic sequence operations using both text and oid references +CREATE SEQUENCE sequence_test; +CREATE SEQUENCE IF NOT EXISTS sequence_test; + +SELECT nextval('sequence_test'::text); +SELECT nextval('sequence_test'::regclass); +SELECT currval('sequence_test'::text); +SELECT currval('sequence_test'::regclass); +SELECT setval('sequence_test'::text, 32); +SELECT nextval('sequence_test'::regclass); +SELECT setval('sequence_test'::text, 99, false); +SELECT nextval('sequence_test'::regclass); +SELECT setval('sequence_test'::regclass, 32); +SELECT nextval('sequence_test'::text); +SELECT setval('sequence_test'::regclass, 99, false); +SELECT nextval('sequence_test'::text); +DISCARD SEQUENCES; +SELECT currval('sequence_test'::regclass); + +DROP SEQUENCE sequence_test; + +-- renaming sequences +CREATE SEQUENCE foo_seq; +ALTER TABLE foo_seq RENAME TO foo_seq_new; +SELECT * FROM foo_seq_new; +SELECT nextval('foo_seq_new'); +SELECT nextval('foo_seq_new'); +-- log_cnt can be higher if there is a checkpoint just at the right +-- time, so just test for the expected range +SELECT last_value, log_cnt IN (31, 32) AS log_cnt_ok, is_called FROM foo_seq_new; +DROP SEQUENCE foo_seq_new; + +-- renaming serial sequences +ALTER TABLE serialtest1_f2_seq RENAME TO serialtest1_f2_foo; +INSERT INTO serialTest1 VALUES ('more'); +SELECT * FROM serialTest1; + +-- +-- Check dependencies of serial and ordinary sequences +-- +CREATE TEMP SEQUENCE myseq2; +CREATE TEMP SEQUENCE myseq3; +CREATE TEMP TABLE t1 ( + f1 serial, + f2 int DEFAULT nextval('myseq2'), + f3 int DEFAULT nextval('myseq3'::text) +); +-- Both drops should fail, but with different error messages: +DROP SEQUENCE t1_f1_seq; +DROP SEQUENCE myseq2; +-- This however will work: +DROP SEQUENCE myseq3; +DROP TABLE t1; +-- Fails because no longer existent: +DROP SEQUENCE t1_f1_seq; +-- Now OK: +DROP SEQUENCE myseq2; + +-- +-- Alter sequence +-- + +ALTER SEQUENCE IF EXISTS sequence_test2 RESTART WITH 24 + INCREMENT BY 4 MAXVALUE 36 MINVALUE 5 CYCLE; + +ALTER SEQUENCE serialTest1 CYCLE; -- error, not a sequence + +CREATE SEQUENCE sequence_test2 START WITH 32; +CREATE SEQUENCE sequence_test4 INCREMENT BY -1; + +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test4'); + +ALTER SEQUENCE sequence_test2 RESTART; +SELECT nextval('sequence_test2'); + +ALTER SEQUENCE sequence_test2 RESTART WITH 0; -- error +ALTER SEQUENCE sequence_test4 RESTART WITH 40; -- error + +-- test CYCLE and NO CYCLE +ALTER SEQUENCE sequence_test2 RESTART WITH 24 + INCREMENT BY 4 MAXVALUE 36 MINVALUE 5 CYCLE; +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); -- cycled + +ALTER SEQUENCE sequence_test2 RESTART WITH 24 + NO CYCLE; +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); -- error + +ALTER SEQUENCE sequence_test2 RESTART WITH -24 START WITH -24 + INCREMENT BY -4 MINVALUE -36 MAXVALUE -5 CYCLE; +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); -- cycled + +ALTER SEQUENCE sequence_test2 RESTART WITH -24 + NO CYCLE; +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); +SELECT nextval('sequence_test2'); -- error + +-- reset +ALTER SEQUENCE IF EXISTS sequence_test2 RESTART WITH 32 START WITH 32 + INCREMENT BY 4 MAXVALUE 36 MINVALUE 5 CYCLE; + +SELECT setval('sequence_test2', -100); -- error +SELECT setval('sequence_test2', 100); -- error +SELECT setval('sequence_test2', 5); + +CREATE SEQUENCE sequence_test3; -- not read from, to test is_called + + +-- Information schema +SELECT * FROM information_schema.sequences + WHERE sequence_name ~ ANY(ARRAY['sequence_test', 'serialtest']) + ORDER BY sequence_name ASC; + +SELECT schemaname, sequencename, start_value, min_value, max_value, increment_by, cycle, cache_size, last_value +FROM pg_sequences +WHERE sequencename ~ ANY(ARRAY['sequence_test', 'serialtest']) + ORDER BY sequencename ASC; + + +SELECT * FROM pg_sequence_parameters('sequence_test4'::regclass); + + +\d sequence_test4 +\d serialtest2_f2_seq + + +-- Test comments +COMMENT ON SEQUENCE asdf IS 'won''t work'; +COMMENT ON SEQUENCE sequence_test2 IS 'will work'; +COMMENT ON SEQUENCE sequence_test2 IS NULL; + +-- Test lastval() +CREATE SEQUENCE seq; +SELECT nextval('seq'); +SELECT lastval(); +SELECT setval('seq', 99); +SELECT lastval(); +DISCARD SEQUENCES; +SELECT lastval(); + +CREATE SEQUENCE seq2; +SELECT nextval('seq2'); +SELECT lastval(); + +DROP SEQUENCE seq2; +-- should fail +SELECT lastval(); + +-- Test sequences in read-only transactions +CREATE TEMPORARY SEQUENCE sequence_test_temp1; +START TRANSACTION READ ONLY; +SELECT nextval('sequence_test_temp1'); -- ok +SELECT nextval('sequence_test2'); -- error +ROLLBACK; +START TRANSACTION READ ONLY; +SELECT setval('sequence_test_temp1', 1); -- ok +SELECT setval('sequence_test2', 1); -- error +ROLLBACK; + +-- privileges tests + +CREATE USER regress_seq_user; + +-- nextval +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT SELECT ON seq3 TO regress_seq_user; +SELECT nextval('seq3'); +ROLLBACK; + +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT UPDATE ON seq3 TO regress_seq_user; +SELECT nextval('seq3'); +ROLLBACK; + +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT USAGE ON seq3 TO regress_seq_user; +SELECT nextval('seq3'); +ROLLBACK; + +-- currval +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +SELECT nextval('seq3'); +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT SELECT ON seq3 TO regress_seq_user; +SELECT currval('seq3'); +ROLLBACK; + +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +SELECT nextval('seq3'); +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT UPDATE ON seq3 TO regress_seq_user; +SELECT currval('seq3'); +ROLLBACK; + +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +SELECT nextval('seq3'); +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT USAGE ON seq3 TO regress_seq_user; +SELECT currval('seq3'); +ROLLBACK; + +-- lastval +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +SELECT nextval('seq3'); +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT SELECT ON seq3 TO regress_seq_user; +SELECT lastval(); +ROLLBACK; + +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +SELECT nextval('seq3'); +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT UPDATE ON seq3 TO regress_seq_user; +SELECT lastval(); +ROLLBACK; + +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +SELECT nextval('seq3'); +REVOKE ALL ON seq3 FROM regress_seq_user; +GRANT USAGE ON seq3 TO regress_seq_user; +SELECT lastval(); +ROLLBACK; + +-- setval +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +CREATE SEQUENCE seq3; +REVOKE ALL ON seq3 FROM regress_seq_user; +SAVEPOINT save; +SELECT setval('seq3', 5); +ROLLBACK TO save; +GRANT UPDATE ON seq3 TO regress_seq_user; +SELECT setval('seq3', 5); +SELECT nextval('seq3'); +ROLLBACK; + +-- ALTER SEQUENCE +BEGIN; +SET LOCAL SESSION AUTHORIZATION regress_seq_user; +ALTER SEQUENCE sequence_test2 START WITH 1; +ROLLBACK; + +-- Sequences should get wiped out as well: +DROP TABLE serialTest1, serialTest2; + +-- Make sure sequences are gone: +SELECT * FROM information_schema.sequences WHERE sequence_name IN + ('sequence_test2', 'serialtest2_f2_seq', 'serialtest2_f3_seq', + 'serialtest2_f4_seq', 'serialtest2_f5_seq', 'serialtest2_f6_seq') + ORDER BY sequence_name ASC; + +DROP USER regress_seq_user; +DROP SEQUENCE seq; + +-- cache tests +CREATE SEQUENCE test_seq1 CACHE 10; +SELECT nextval('test_seq1'); +SELECT nextval('test_seq1'); +SELECT nextval('test_seq1'); + +DROP SEQUENCE test_seq1; diff --git a/postgresql/examples/spgist.sql b/postgresql/examples/spgist.sql new file mode 100644 index 0000000..c72cf42 --- /dev/null +++ b/postgresql/examples/spgist.sql @@ -0,0 +1,73 @@ +-- +-- Test SP-GiST indexes. +-- +-- There are other tests to test different SP-GiST opclasses. This is for +-- testing SP-GiST code itself. + +create table spgist_point_tbl(id int4, p point); +create index spgist_point_idx on spgist_point_tbl using spgist(p) with (fillfactor = 75); + +-- Test vacuum-root operation. It gets invoked when the root is also a leaf, +-- i.e. the index is very small. +insert into spgist_point_tbl (id, p) +select g, point(g*10, g*10) from generate_series(1, 10) g; +delete from spgist_point_tbl where id < 5; +vacuum spgist_point_tbl; + +-- Insert more data, to make the index a few levels deep. +insert into spgist_point_tbl (id, p) +select g, point(g*10, g*10) from generate_series(1, 10000) g; +insert into spgist_point_tbl (id, p) +select g+100000, point(g*10+1, g*10+1) from generate_series(1, 10000) g; + +-- To test vacuum, delete some entries from all over the index. +delete from spgist_point_tbl where id % 2 = 1; + +-- And also delete some concentration of values. (SP-GiST doesn't currently +-- attempt to delete pages even when they become empty, but if it did, this +-- would exercise it) +delete from spgist_point_tbl where id < 10000; + +vacuum spgist_point_tbl; + +-- Test rescan paths (cf. bug #15378) +-- use box and && rather than point, so that rescan happens when the +-- traverse stack is non-empty + +create table spgist_box_tbl(id serial, b box); +insert into spgist_box_tbl(b) +select box(point(i,j),point(i+s,j+s)) + from generate_series(1,100,5) i, + generate_series(1,100,5) j, + generate_series(1,10) s; +create index spgist_box_idx on spgist_box_tbl using spgist (b); + +select count(*) + from (values (point(5,5)),(point(8,8)),(point(12,12))) v(p) + where exists(select * from spgist_box_tbl b where b.b && box(v.p,v.p)); + +-- The point opclass's choose method only uses the spgMatchNode action, +-- so the other actions are not tested by the above. Create an index using +-- text opclass, which uses the others actions. + +create table spgist_text_tbl(id int4, t text); +create index spgist_text_idx on spgist_text_tbl using spgist(t); + +insert into spgist_text_tbl (id, t) +select g, 'f' || repeat('o', 100) || g from generate_series(1, 10000) g +union all +select g, 'baaaaaaaaaaaaaar' || g from generate_series(1, 1000) g; + +-- Do a lot of insertions that have to split an existing node. Hopefully +-- one of these will cause the page to run out of space, causing the inner +-- tuple to be moved to another page. +insert into spgist_text_tbl (id, t) +select -g, 'f' || repeat('o', 100-g) || 'surprise' from generate_series(1, 100) g; + +-- Test out-of-range fillfactor values +create index spgist_point_idx2 on spgist_point_tbl using spgist(p) with (fillfactor = 9); +create index spgist_point_idx2 on spgist_point_tbl using spgist(p) with (fillfactor = 101); + +-- Modify fillfactor in existing index +alter index spgist_point_idx set (fillfactor = 90); +reindex index spgist_point_idx; diff --git a/postgresql/examples/stats.sql b/postgresql/examples/stats.sql new file mode 100644 index 0000000..feaaee6 --- /dev/null +++ b/postgresql/examples/stats.sql @@ -0,0 +1,179 @@ +-- +-- Test Statistics Collector +-- +-- Must be run after tenk2 has been created (by create_table), +-- populated (by create_misc) and indexed (by create_index). +-- + +-- conditio sine qua non +SHOW track_counts; -- must be on + +-- ensure that both seqscan and indexscan plans are allowed +SET enable_seqscan TO on; +SET enable_indexscan TO on; +-- for the moment, we don't want index-only scans here +SET enable_indexonlyscan TO off; + +-- save counters +CREATE TABLE prevstats AS +SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch, + (b.heap_blks_read + b.heap_blks_hit) AS heap_blks, + (b.idx_blks_read + b.idx_blks_hit) AS idx_blks, + pg_stat_get_snapshot_timestamp() as snap_ts + FROM pg_catalog.pg_stat_user_tables AS t, + pg_catalog.pg_statio_user_tables AS b + WHERE t.relname='tenk2' AND b.relname='tenk2'; + +-- function to wait for counters to advance +create function wait_for_stats() returns void as $$ +declare + start_time timestamptz := clock_timestamp(); + updated1 bool; + updated2 bool; + updated3 bool; + updated4 bool; +begin + -- we don't want to wait forever; loop will exit after 30 seconds + for i in 1 .. 300 loop + + -- With parallel query, the seqscan and indexscan on tenk2 might be done + -- in parallel worker processes, which will send their stats counters + -- asynchronously to what our own session does. So we must check for + -- those counts to be registered separately from the update counts. + + -- check to see if seqscan has been sensed + SELECT (st.seq_scan >= pr.seq_scan + 1) INTO updated1 + FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr + WHERE st.relname='tenk2' AND cl.relname='tenk2'; + + -- check to see if indexscan has been sensed + SELECT (st.idx_scan >= pr.idx_scan + 1) INTO updated2 + FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr + WHERE st.relname='tenk2' AND cl.relname='tenk2'; + + -- check to see if all updates have been sensed + SELECT (n_tup_ins > 0) INTO updated3 + FROM pg_stat_user_tables WHERE relname='trunc_stats_test4'; + + -- We must also check explicitly that pg_stat_get_snapshot_timestamp has + -- advanced, because that comes from the global stats file which might + -- be older than the per-DB stats file we got the other values from. + SELECT (pr.snap_ts < pg_stat_get_snapshot_timestamp()) INTO updated4 + FROM prevstats AS pr; + + exit when updated1 and updated2 and updated3 and updated4; + + -- wait a little + perform pg_sleep_for('100 milliseconds'); + + -- reset stats snapshot so we can test again + perform pg_stat_clear_snapshot(); + + end loop; + + -- report time waited in postmaster log (where it won't change test output) + raise log 'wait_for_stats delayed % seconds', + extract(epoch from clock_timestamp() - start_time); +end +$$ language plpgsql; + +-- test effects of TRUNCATE on n_live_tup/n_dead_tup counters +CREATE TABLE trunc_stats_test(id serial); +CREATE TABLE trunc_stats_test1(id serial, stuff text); +CREATE TABLE trunc_stats_test2(id serial); +CREATE TABLE trunc_stats_test3(id serial, stuff text); +CREATE TABLE trunc_stats_test4(id serial); + +-- check that n_live_tup is reset to 0 after truncate +INSERT INTO trunc_stats_test DEFAULT VALUES; +INSERT INTO trunc_stats_test DEFAULT VALUES; +INSERT INTO trunc_stats_test DEFAULT VALUES; +TRUNCATE trunc_stats_test; + +-- test involving a truncate in a transaction; 4 ins but only 1 live +INSERT INTO trunc_stats_test1 DEFAULT VALUES; +INSERT INTO trunc_stats_test1 DEFAULT VALUES; +INSERT INTO trunc_stats_test1 DEFAULT VALUES; +UPDATE trunc_stats_test1 SET id = id + 10 WHERE id IN (1, 2); +DELETE FROM trunc_stats_test1 WHERE id = 3; + +BEGIN; +UPDATE trunc_stats_test1 SET id = id + 100; +TRUNCATE trunc_stats_test1; +INSERT INTO trunc_stats_test1 DEFAULT VALUES; +COMMIT; + +-- use a savepoint: 1 insert, 1 live +BEGIN; +INSERT INTO trunc_stats_test2 DEFAULT VALUES; +INSERT INTO trunc_stats_test2 DEFAULT VALUES; +SAVEPOINT p1; +INSERT INTO trunc_stats_test2 DEFAULT VALUES; +TRUNCATE trunc_stats_test2; +INSERT INTO trunc_stats_test2 DEFAULT VALUES; +RELEASE SAVEPOINT p1; +COMMIT; + +-- rollback a savepoint: this should count 4 inserts and have 2 +-- live tuples after commit (and 2 dead ones due to aborted subxact) +BEGIN; +INSERT INTO trunc_stats_test3 DEFAULT VALUES; +INSERT INTO trunc_stats_test3 DEFAULT VALUES; +SAVEPOINT p1; +INSERT INTO trunc_stats_test3 DEFAULT VALUES; +INSERT INTO trunc_stats_test3 DEFAULT VALUES; +TRUNCATE trunc_stats_test3; +INSERT INTO trunc_stats_test3 DEFAULT VALUES; +ROLLBACK TO SAVEPOINT p1; +COMMIT; + +-- rollback a truncate: this should count 2 inserts and produce 2 dead tuples +BEGIN; +INSERT INTO trunc_stats_test4 DEFAULT VALUES; +INSERT INTO trunc_stats_test4 DEFAULT VALUES; +TRUNCATE trunc_stats_test4; +INSERT INTO trunc_stats_test4 DEFAULT VALUES; +ROLLBACK; + +-- do a seqscan +SELECT count(*) FROM tenk2; +-- do an indexscan +-- make sure it is not a bitmap scan, which might skip fetching heap tuples +SET enable_bitmapscan TO off; +SELECT count(*) FROM tenk2 WHERE unique1 = 1; +RESET enable_bitmapscan; + +-- We can't just call wait_for_stats() at this point, because we only +-- transmit stats when the session goes idle, and we probably didn't +-- transmit the last couple of counts yet thanks to the rate-limiting logic +-- in pgstat_report_stat(). But instead of waiting for the rate limiter's +-- timeout to elapse, let's just start a new session. The old one will +-- then send its stats before dying. +\c - + +-- wait for stats collector to update +SELECT wait_for_stats(); + +-- check effects +SELECT relname, n_tup_ins, n_tup_upd, n_tup_del, n_live_tup, n_dead_tup + FROM pg_stat_user_tables + WHERE relname like 'trunc_stats_test%' order by relname; + +SELECT st.seq_scan >= pr.seq_scan + 1, + st.seq_tup_read >= pr.seq_tup_read + cl.reltuples, + st.idx_scan >= pr.idx_scan + 1, + st.idx_tup_fetch >= pr.idx_tup_fetch + 1 + FROM pg_stat_user_tables AS st, pg_class AS cl, prevstats AS pr + WHERE st.relname='tenk2' AND cl.relname='tenk2'; + +SELECT st.heap_blks_read + st.heap_blks_hit >= pr.heap_blks + cl.relpages, + st.idx_blks_read + st.idx_blks_hit >= pr.idx_blks + 1 + FROM pg_statio_user_tables AS st, pg_class AS cl, prevstats AS pr + WHERE st.relname='tenk2' AND cl.relname='tenk2'; + +SELECT pr.snap_ts < pg_stat_get_snapshot_timestamp() as snapshot_newer +FROM prevstats AS pr; + +DROP TABLE trunc_stats_test, trunc_stats_test1, trunc_stats_test2, trunc_stats_test3, trunc_stats_test4; +DROP TABLE prevstats; +-- End of Stats Test diff --git a/postgresql/examples/stats_ext.sql b/postgresql/examples/stats_ext.sql new file mode 100644 index 0000000..e0035bd --- /dev/null +++ b/postgresql/examples/stats_ext.sql @@ -0,0 +1,875 @@ +-- Generic extended statistics support + +-- +-- Note: tables for which we check estimated row counts should be created +-- with autovacuum_enabled = off, so that we don't have unstable results +-- from auto-analyze happening when we didn't expect it. +-- + +-- check the number of estimated/actual rows in the top node +create function check_estimated_rows(text) returns table (estimated int, actual int) +language plpgsql as +$$ +declare + ln text; + tmp text[]; + first_row bool := true; +begin + for ln in + execute format('explain analyze %s', $1) + loop + if first_row then + first_row := false; + tmp := regexp_match(ln, 'rows=(\d*) .* rows=(\d*)'); + return query select tmp[1]::int, tmp[2]::int; + end if; + end loop; +end; +$$; + +-- Verify failures +--CREATE STATISTICS tst; +--CREATE STATISTICS tst ON a, b; +--CREATE STATISTICS tst FROM sometab; +--CREATE STATISTICS tst ON a, b FROM nonexistent; +--CREATE STATISTICS tst ON a, b FROM pg_class; +CREATE STATISTICS tst ON relname, relname, relnatts FROM pg_class; +CREATE STATISTICS tst ON relnatts + relpages FROM pg_class; +CREATE STATISTICS tst ON (relpages, reltuples) FROM pg_class; +CREATE STATISTICS tst (unrecognized) ON relname, relnatts FROM pg_class; + +-- Ensure stats are dropped sanely, and test IF NOT EXISTS while at it +CREATE TABLE ab1 (a INTEGER, b INTEGER, c INTEGER); +CREATE STATISTICS IF NOT EXISTS ab1_a_b_stats ON a, b FROM ab1; +CREATE STATISTICS IF NOT EXISTS ab1_a_b_stats ON a, b FROM ab1; +DROP STATISTICS ab1_a_b_stats; + +CREATE SCHEMA regress_schema_2; +CREATE STATISTICS regress_schema_2.ab1_a_b_stats ON a, b FROM ab1; + +-- Let's also verify the pg_get_statisticsobjdef output looks sane. +SELECT pg_get_statisticsobjdef(oid) FROM pg_statistic_ext WHERE stxname = 'ab1_a_b_stats'; + +DROP STATISTICS regress_schema_2.ab1_a_b_stats; + +-- Ensure statistics are dropped when columns are +CREATE STATISTICS ab1_b_c_stats ON b, c FROM ab1; +CREATE STATISTICS ab1_a_b_c_stats ON a, b, c FROM ab1; +CREATE STATISTICS ab1_b_a_stats ON b, a FROM ab1; +ALTER TABLE ab1 DROP COLUMN a; +\d ab1 +-- Ensure statistics are dropped when table is +SELECT stxname FROM pg_statistic_ext WHERE stxname LIKE 'ab1%'; +DROP TABLE ab1; +SELECT stxname FROM pg_statistic_ext WHERE stxname LIKE 'ab1%'; + +-- Ensure things work sanely with SET STATISTICS 0 +CREATE TABLE ab1 (a INTEGER, b INTEGER); +ALTER TABLE ab1 ALTER a SET STATISTICS 0; +INSERT INTO ab1 SELECT a, a%23 FROM generate_series(1, 1000) a; +CREATE STATISTICS ab1_a_b_stats ON a, b FROM ab1; +ANALYZE ab1; +ALTER TABLE ab1 ALTER a SET STATISTICS -1; +-- setting statistics target 0 skips the statistics, without printing any message, so check catalog +ALTER STATISTICS ab1_a_b_stats SET STATISTICS 0; +ANALYZE ab1; +SELECT stxname, stxdndistinct, stxddependencies, stxdmcv + FROM pg_statistic_ext s, pg_statistic_ext_data d + WHERE s.stxname = 'ab1_a_b_stats' + AND d.stxoid = s.oid; +ALTER STATISTICS ab1_a_b_stats SET STATISTICS -1; +-- partial analyze doesn't build stats either +ANALYZE ab1 (a); +ANALYZE ab1; +DROP TABLE ab1; +ALTER STATISTICS ab1_a_b_stats SET STATISTICS 0; +ALTER STATISTICS IF EXISTS ab1_a_b_stats SET STATISTICS 0; + +-- Ensure we can build statistics for tables with inheritance. +CREATE TABLE ab1 (a INTEGER, b INTEGER); +CREATE TABLE ab1c () INHERITS (ab1); +INSERT INTO ab1 VALUES (1,1); +CREATE STATISTICS ab1_a_b_stats ON a, b FROM ab1; +ANALYZE ab1; +DROP TABLE ab1 CASCADE; + +-- Verify supported object types for extended statistics +CREATE schema tststats; + +CREATE TABLE tststats.t (a int, b int, c text); +CREATE INDEX ti ON tststats.t (a, b); +CREATE SEQUENCE tststats.s; +CREATE VIEW tststats.v AS SELECT * FROM tststats.t; +CREATE MATERIALIZED VIEW tststats.mv AS SELECT * FROM tststats.t; +CREATE TYPE tststats.ty AS (a int, b int, c text); +CREATE FOREIGN DATA WRAPPER extstats_dummy_fdw; +CREATE SERVER extstats_dummy_srv FOREIGN DATA WRAPPER extstats_dummy_fdw; +CREATE FOREIGN TABLE tststats.f (a int, b int, c text) SERVER extstats_dummy_srv; +CREATE TABLE tststats.pt (a int, b int, c text) PARTITION BY RANGE (a, b); +CREATE TABLE tststats.pt1 PARTITION OF tststats.pt FOR VALUES FROM (-10, -10) TO (10, 10); + +CREATE STATISTICS tststats.s1 ON a, b FROM tststats.t; +CREATE STATISTICS tststats.s2 ON a, b FROM tststats.ti; +CREATE STATISTICS tststats.s3 ON a, b FROM tststats.s; +CREATE STATISTICS tststats.s4 ON a, b FROM tststats.v; +CREATE STATISTICS tststats.s5 ON a, b FROM tststats.mv; +CREATE STATISTICS tststats.s6 ON a, b FROM tststats.ty; +CREATE STATISTICS tststats.s7 ON a, b FROM tststats.f; +CREATE STATISTICS tststats.s8 ON a, b FROM tststats.pt; +CREATE STATISTICS tststats.s9 ON a, b FROM tststats.pt1; +DO $$ +DECLARE + relname text := reltoastrelid::regclass FROM pg_class WHERE oid = 'tststats.t'::regclass; +BEGIN + EXECUTE 'CREATE STATISTICS tststats.s10 ON a, b FROM ' || relname; +EXCEPTION WHEN wrong_object_type THEN + RAISE NOTICE 'stats on toast table not created'; +END; +$$; + +DROP SCHEMA tststats CASCADE; +DROP FOREIGN DATA WRAPPER extstats_dummy_fdw CASCADE; + +-- n-distinct tests +CREATE TABLE ndistinct ( + filler1 TEXT, + filler2 NUMERIC, + a INT, + b INT, + filler3 DATE, + c INT, + d INT +) +WITH (autovacuum_enabled = off); + +-- over-estimates when using only per-column statistics +INSERT INTO ndistinct (a, b, c, filler1) + SELECT i/100, i/100, i/100, cash_words((i/100)::money) + FROM generate_series(1,1000) s(i); + +ANALYZE ndistinct; + +-- Group Aggregate, due to over-estimate of the number of groups +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c, d'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d'); + +-- correct command +CREATE STATISTICS s10 ON a, b, c FROM ndistinct; + +ANALYZE ndistinct; + +SELECT s.stxkind, d.stxdndistinct + FROM pg_statistic_ext s, pg_statistic_ext_data d + WHERE s.stxrelid = 'ndistinct'::regclass + AND d.stxoid = s.oid; + +-- minor improvement, make sure the ctid does not break the matching +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY ctid, a, b'); + +-- Hash Aggregate, thanks to estimates improved by the statistic +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c'); + +-- last two plans keep using Group Aggregate, because 'd' is not covered +-- by the statistic and while it's NULL-only we assume 200 values for it +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c, d'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d'); + +TRUNCATE TABLE ndistinct; + +-- under-estimates when using only per-column statistics +INSERT INTO ndistinct (a, b, c, filler1) + SELECT mod(i,50), mod(i,51), mod(i,32), + cash_words(mod(i,33)::int::money) + FROM generate_series(1,5000) s(i); + +ANALYZE ndistinct; + +SELECT s.stxkind, d.stxdndistinct + FROM pg_statistic_ext s, pg_statistic_ext_data d + WHERE s.stxrelid = 'ndistinct'::regclass + AND d.stxoid = s.oid; + +-- correct esimates +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c, d'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, d'); + +DROP STATISTICS s10; + +SELECT s.stxkind, d.stxdndistinct + FROM pg_statistic_ext s, pg_statistic_ext_data d + WHERE s.stxrelid = 'ndistinct'::regclass + AND d.stxoid = s.oid; + +-- dropping the statistics results in under-estimates +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c, d'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d'); + +SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, d'); + +-- functional dependencies tests +CREATE TABLE functional_dependencies ( + filler1 TEXT, + filler2 NUMERIC, + a INT, + b TEXT, + filler3 DATE, + c INT, + d TEXT +) +WITH (autovacuum_enabled = off); + +CREATE INDEX fdeps_ab_idx ON functional_dependencies (a, b); +CREATE INDEX fdeps_abc_idx ON functional_dependencies (a, b, c); + +-- random data (no functional dependencies) +INSERT INTO functional_dependencies (a, b, c, filler1) + SELECT mod(i, 23), mod(i, 29), mod(i, 31), i FROM generate_series(1,5000) s(i); + +ANALYZE functional_dependencies; + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1'); + +-- create statistics +CREATE STATISTICS func_deps_stat (dependencies) ON a, b, c FROM functional_dependencies; + +ANALYZE functional_dependencies; + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1'); + +-- a => b, a => c, b => c +TRUNCATE functional_dependencies; +DROP STATISTICS func_deps_stat; + +INSERT INTO functional_dependencies (a, b, c, filler1) + SELECT mod(i,100), mod(i,50), mod(i,25), i FROM generate_series(1,5000) s(i); + +ANALYZE functional_dependencies; + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1'); + +-- IN +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 51) AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 51) AND b IN (''1'', ''2'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 2, 51, 52) AND b IN (''1'', ''2'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 2, 51, 52) AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 26, 51, 76) AND b IN (''1'', ''26'') AND c = 1'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 26, 51, 76) AND b IN (''1'', ''26'') AND c IN (1)'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 2, 26, 27, 51, 52, 76, 77) AND b IN (''1'', ''2'', ''26'', ''27'') AND c IN (1, 2)'); + +-- OR clauses referencing the same attribute +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE (a = 1 OR a = 51) AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE (a = 1 OR a = 51) AND (b = ''1'' OR b = ''2'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE (a = 1 OR a = 2 OR a = 51 OR a = 52) AND (b = ''1'' OR b = ''2'')'); + +-- OR clauses referencing different attributes +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE (a = 1 OR b = ''1'') AND b = ''1'''); + +-- ANY +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 51]) AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 51]) AND b = ANY (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 2, 51, 52]) AND b = ANY (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 26, 51, 76]) AND b = ANY (ARRAY[''1'', ''26'']) AND c = 1'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 26, 51, 76]) AND b = ANY (ARRAY[''1'', ''26'']) AND c = ANY (ARRAY[1])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 2, 26, 27, 51, 52, 76, 77]) AND b = ANY (ARRAY[''1'', ''2'', ''26'', ''27'']) AND c = ANY (ARRAY[1, 2])'); + +-- ANY with inequalities should not benefit from functional dependencies +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a < ANY (ARRAY[1, 51]) AND b > ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a >= ANY (ARRAY[1, 51]) AND b <= ANY (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a <= ANY (ARRAY[1, 2, 51, 52]) AND b >= ANY (ARRAY[''1'', ''2''])'); + +-- ALL (should not benefit from functional dependencies) +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 51) AND b = ALL (ARRAY[''1''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 51) AND b = ALL (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 2, 51, 52) AND b = ALL (ARRAY[''1'', ''2''])'); + +-- create statistics +CREATE STATISTICS func_deps_stat (dependencies) ON a, b, c FROM functional_dependencies; + +ANALYZE functional_dependencies; + +-- print the detected dependencies +SELECT dependencies FROM pg_stats_ext WHERE statistics_name = 'func_deps_stat'; + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1'); + +-- IN +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 51) AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 51) AND b IN (''1'', ''2'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 2, 51, 52) AND b IN (''1'', ''2'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 2, 51, 52) AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 26, 51, 76) AND b IN (''1'', ''26'') AND c = 1'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 26, 51, 76) AND b IN (''1'', ''26'') AND c IN (1)'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 2, 26, 27, 51, 52, 76, 77) AND b IN (''1'', ''2'', ''26'', ''27'') AND c IN (1, 2)'); + +-- OR clauses referencing the same attribute +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE (a = 1 OR a = 51) AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE (a = 1 OR a = 51) AND (b = ''1'' OR b = ''2'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE (a = 1 OR a = 2 OR a = 51 OR a = 52) AND (b = ''1'' OR b = ''2'')'); + +-- OR clauses referencing different attributes are incompatible +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE (a = 1 OR b = ''1'') AND b = ''1'''); + +-- ANY +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 51]) AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 51]) AND b = ANY (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 2, 51, 52]) AND b = ANY (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 26, 51, 76]) AND b = ANY (ARRAY[''1'', ''26'']) AND c = 1'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 26, 51, 76]) AND b = ANY (ARRAY[''1'', ''26'']) AND c = ANY (ARRAY[1])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = ANY (ARRAY[1, 2, 26, 27, 51, 52, 76, 77]) AND b = ANY (ARRAY[''1'', ''2'', ''26'', ''27'']) AND c = ANY (ARRAY[1, 2])'); + +-- ANY with inequalities should not benefit from functional dependencies +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a < ANY (ARRAY[1, 51]) AND b > ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a >= ANY (ARRAY[1, 51]) AND b <= ANY (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a <= ANY (ARRAY[1, 2, 51, 52]) AND b >= ANY (ARRAY[''1'', ''2''])'); + +-- ALL (should not benefit from functional dependencies) +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 51) AND b = ALL (ARRAY[''1''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 51) AND b = ALL (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a IN (1, 2, 51, 52) AND b = ALL (ARRAY[''1'', ''2''])'); + +-- changing the type of column c causes its single-column stats to be dropped, +-- giving a default estimate of 0.005 * 5000 = 25 for (c = 1); check multiple +-- clauses estimated with functional dependencies does not exceed this +ALTER TABLE functional_dependencies ALTER COLUMN c TYPE numeric; + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1'); + +ANALYZE functional_dependencies; + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1'); + +-- check the ability to use multiple functional dependencies +CREATE TABLE functional_dependencies_multi ( + a INTEGER, + b INTEGER, + c INTEGER, + d INTEGER +) +WITH (autovacuum_enabled = off); + +INSERT INTO functional_dependencies_multi (a, b, c, d) + SELECT + mod(i,7), + mod(i,7), + mod(i,11), + mod(i,11) + FROM generate_series(1,5000) s(i); + +ANALYZE functional_dependencies_multi; + +-- estimates without any functional dependencies +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE a = 0 AND b = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE 0 = a AND 0 = b'); +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE c = 0 AND d = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE a = 0 AND b = 0 AND c = 0 AND d = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE 0 = a AND b = 0 AND 0 = c AND d = 0'); + +-- create separate functional dependencies +CREATE STATISTICS functional_dependencies_multi_1 (dependencies) ON a, b FROM functional_dependencies_multi; +CREATE STATISTICS functional_dependencies_multi_2 (dependencies) ON c, d FROM functional_dependencies_multi; + +ANALYZE functional_dependencies_multi; + +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE a = 0 AND b = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE 0 = a AND 0 = b'); +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE c = 0 AND d = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE a = 0 AND b = 0 AND c = 0 AND d = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies_multi WHERE 0 = a AND b = 0 AND 0 = c AND d = 0'); + +DROP TABLE functional_dependencies_multi; + +-- MCV lists +CREATE TABLE mcv_lists ( + filler1 TEXT, + filler2 NUMERIC, + a INT, + b VARCHAR, + filler3 DATE, + c INT, + d TEXT +) +WITH (autovacuum_enabled = off); + +-- random data (no MCV list) +INSERT INTO mcv_lists (a, b, c, filler1) + SELECT mod(i,37), mod(i,41), mod(i,43), mod(i,47) FROM generate_series(1,5000) s(i); + +ANALYZE mcv_lists; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'' AND c = 1'); + +-- create statistics +CREATE STATISTICS mcv_lists_stats (mcv) ON a, b, c FROM mcv_lists; + +ANALYZE mcv_lists; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'' AND c = 1'); + +-- 100 distinct combinations, all in the MCV list +TRUNCATE mcv_lists; +DROP STATISTICS mcv_lists_stats; + +INSERT INTO mcv_lists (a, b, c, filler1) + SELECT mod(i,100), mod(i,50), mod(i,25), i FROM generate_series(1,5000) s(i); + +ANALYZE mcv_lists; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE 1 = a AND ''1'' = b'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < 1 AND b < ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE 1 > a AND ''1'' > b'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a <= 0 AND b <= ''0'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE 0 >= a AND ''0'' >= b'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'' AND c = 1'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < 5 AND b < ''1'' AND c < 5'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < 5 AND ''1'' > b AND 5 > c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a <= 4 AND b <= ''0'' AND c <= 4'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE 4 >= a AND ''0'' >= b AND 4 >= c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 OR b = ''1'' OR c = 1'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 OR b = ''1'' OR c = 1 OR d IS NOT NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IN (1, 2, 51, 52) AND b IN ( ''1'', ''2'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IN (1, 2, 51, 52, NULL) AND b IN ( ''1'', ''2'', NULL)'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = ANY (ARRAY[1, 2, 51, 52]) AND b = ANY (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = ANY (ARRAY[NULL, 1, 2, 51, 52]) AND b = ANY (ARRAY[''1'', ''2'', NULL])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a <= ANY (ARRAY[1, 2, 3]) AND b IN (''1'', ''2'', ''3'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a <= ANY (ARRAY[1, NULL, 2, 3]) AND b IN (''1'', ''2'', NULL, ''3'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < ALL (ARRAY[4, 5]) AND c > ANY (ARRAY[1, 2, 3])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < ALL (ARRAY[4, 5]) AND c > ANY (ARRAY[1, 2, 3, NULL])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < ALL (ARRAY[4, 5]) AND b IN (''1'', ''2'', ''3'') AND c > ANY (ARRAY[1, 2, 3])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < ALL (ARRAY[4, 5]) AND b IN (''1'', ''2'', NULL, ''3'') AND c > ANY (ARRAY[1, 2, NULL, 3])'); + +-- create statistics +CREATE STATISTICS mcv_lists_stats (mcv) ON a, b, c FROM mcv_lists; + +ANALYZE mcv_lists; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE 1 = a AND ''1'' = b'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < 1 AND b < ''1'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE 1 > a AND ''1'' > b'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a <= 0 AND b <= ''0'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE 0 >= a AND ''0'' >= b'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'' AND c = 1'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < 5 AND b < ''1'' AND c < 5'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < 5 AND ''1'' > b AND 5 > c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a <= 4 AND b <= ''0'' AND c <= 4'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE 4 >= a AND ''0'' >= b AND 4 >= c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 OR b = ''1'' OR c = 1'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IN (1, 2, 51, 52) AND b IN ( ''1'', ''2'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IN (1, 2, 51, 52, NULL) AND b IN ( ''1'', ''2'', NULL)'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = ANY (ARRAY[1, 2, 51, 52]) AND b = ANY (ARRAY[''1'', ''2''])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = ANY (ARRAY[NULL, 1, 2, 51, 52]) AND b = ANY (ARRAY[''1'', ''2'', NULL])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a <= ANY (ARRAY[1, 2, 3]) AND b IN (''1'', ''2'', ''3'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a <= ANY (ARRAY[1, NULL, 2, 3]) AND b IN (''1'', ''2'', NULL, ''3'')'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < ALL (ARRAY[4, 5]) AND c > ANY (ARRAY[1, 2, 3])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < ALL (ARRAY[4, 5]) AND c > ANY (ARRAY[1, 2, 3, NULL])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < ALL (ARRAY[4, 5]) AND b IN (''1'', ''2'', ''3'') AND c > ANY (ARRAY[1, 2, 3])'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a < ALL (ARRAY[4, 5]) AND b IN (''1'', ''2'', NULL, ''3'') AND c > ANY (ARRAY[1, 2, NULL, 3])'); + +-- we can't use the statistic for OR clauses that are not fully covered (missing 'd' attribute) +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 OR b = ''1'' OR c = 1 OR d IS NOT NULL'); + +-- check change of unrelated column type does not reset the MCV statistics +ALTER TABLE mcv_lists ALTER COLUMN d TYPE VARCHAR(64); + +SELECT d.stxdmcv IS NOT NULL + FROM pg_statistic_ext s, pg_statistic_ext_data d + WHERE s.stxname = 'mcv_lists_stats' + AND d.stxoid = s.oid; + +-- check change of column type resets the MCV statistics +ALTER TABLE mcv_lists ALTER COLUMN c TYPE numeric; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'''); + +ANALYZE mcv_lists; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 AND b = ''1'''); + +-- 100 distinct combinations with NULL values, all in the MCV list +TRUNCATE mcv_lists; +DROP STATISTICS mcv_lists_stats; + +INSERT INTO mcv_lists (a, b, c, filler1) + SELECT + (CASE WHEN mod(i,100) = 1 THEN NULL ELSE mod(i,100) END), + (CASE WHEN mod(i,50) = 1 THEN NULL ELSE mod(i,50) END), + (CASE WHEN mod(i,25) = 1 THEN NULL ELSE mod(i,25) END), + i + FROM generate_series(1,5000) s(i); + +ANALYZE mcv_lists; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND b IS NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND b IS NULL AND c IS NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND b IS NOT NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NOT NULL AND b IS NULL AND c IS NOT NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IN (0, 1) AND b IN (''0'', ''1'')'); + +-- create statistics +CREATE STATISTICS mcv_lists_stats (mcv) ON a, b, c FROM mcv_lists; + +ANALYZE mcv_lists; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND b IS NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND b IS NULL AND c IS NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND b IS NOT NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NOT NULL AND b IS NULL AND c IS NOT NULL'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IN (0, 1) AND b IN (''0'', ''1'')'); + +-- test pg_mcv_list_items with a very simple (single item) MCV list +TRUNCATE mcv_lists; +INSERT INTO mcv_lists (a, b, c) SELECT 1, 2, 3 FROM generate_series(1,1000) s(i); +ANALYZE mcv_lists; + +SELECT m.* + FROM pg_statistic_ext s, pg_statistic_ext_data d, + pg_mcv_list_items(d.stxdmcv) m + WHERE s.stxname = 'mcv_lists_stats' + AND d.stxoid = s.oid; + +-- 2 distinct combinations with NULL values, all in the MCV list +TRUNCATE mcv_lists; +DROP STATISTICS mcv_lists_stats; + +INSERT INTO mcv_lists (a, b, c, d) + SELECT + NULL, -- always NULL + (CASE WHEN mod(i,2) = 0 THEN NULL ELSE 'x' END), + (CASE WHEN mod(i,2) = 0 THEN NULL ELSE 0 END), + (CASE WHEN mod(i,2) = 0 THEN NULL ELSE 'x' END) + FROM generate_series(1,5000) s(i); + +ANALYZE mcv_lists; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE b = ''x'' OR d = ''x'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 OR b = ''x'' OR d = ''x'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND (b = ''x'' OR d = ''x'')'); + +-- create statistics +CREATE STATISTICS mcv_lists_stats (mcv) ON a, b, d FROM mcv_lists; + +ANALYZE mcv_lists; + +-- test pg_mcv_list_items with MCV list containing variable-length data and NULLs +SELECT m.* + FROM pg_statistic_ext s, pg_statistic_ext_data d, + pg_mcv_list_items(d.stxdmcv) m + WHERE s.stxname = 'mcv_lists_stats' + AND d.stxoid = s.oid; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE b = ''x'' OR d = ''x'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a = 1 OR b = ''x'' OR d = ''x'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists WHERE a IS NULL AND (b = ''x'' OR d = ''x'')'); + +-- mcv with pass-by-ref fixlen types, e.g. uuid +CREATE TABLE mcv_lists_uuid ( + a UUID, + b UUID, + c UUID +) +WITH (autovacuum_enabled = off); + +INSERT INTO mcv_lists_uuid (a, b, c) + SELECT + md5(mod(i,100)::text)::uuid, + md5(mod(i,50)::text)::uuid, + md5(mod(i,25)::text)::uuid + FROM generate_series(1,5000) s(i); + +ANALYZE mcv_lists_uuid; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_uuid WHERE a = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'' AND b = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_uuid WHERE a = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'' AND b = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'' AND c = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'''); + +CREATE STATISTICS mcv_lists_uuid_stats (mcv) ON a, b, c + FROM mcv_lists_uuid; + +ANALYZE mcv_lists_uuid; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_uuid WHERE a = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'' AND b = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'''); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_uuid WHERE a = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'' AND b = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'' AND c = ''1679091c-5a88-0faf-6fb5-e6087eb1b2dc'''); + +DROP TABLE mcv_lists_uuid; + +-- mcv with arrays +CREATE TABLE mcv_lists_arrays ( + a TEXT[], + b NUMERIC[], + c INT[] +) +WITH (autovacuum_enabled = off); + +INSERT INTO mcv_lists_arrays (a, b, c) + SELECT + ARRAY[md5((i/100)::text), md5((i/100-1)::text), md5((i/100+1)::text)], + ARRAY[(i/100-1)::numeric/1000, (i/100)::numeric/1000, (i/100+1)::numeric/1000], + ARRAY[(i/100-1), i/100, (i/100+1)] + FROM generate_series(1,5000) s(i); + +CREATE STATISTICS mcv_lists_arrays_stats (mcv) ON a, b, c + FROM mcv_lists_arrays; + +ANALYZE mcv_lists_arrays; + +-- mcv with bool +CREATE TABLE mcv_lists_bool ( + a BOOL, + b BOOL, + c BOOL +) +WITH (autovacuum_enabled = off); + +INSERT INTO mcv_lists_bool (a, b, c) + SELECT + (mod(i,2) = 0), (mod(i,4) = 0), (mod(i,8) = 0) + FROM generate_series(1,10000) s(i); + +ANALYZE mcv_lists_bool; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE a AND b AND c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE NOT a AND b AND c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE NOT a AND NOT b AND c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE NOT a AND b AND NOT c'); + +CREATE STATISTICS mcv_lists_bool_stats (mcv) ON a, b, c + FROM mcv_lists_bool; + +ANALYZE mcv_lists_bool; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE a AND b AND c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE NOT a AND b AND c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE NOT a AND NOT b AND c'); + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_bool WHERE NOT a AND b AND NOT c'); + +-- check the ability to use multiple MCV lists +CREATE TABLE mcv_lists_multi ( + a INTEGER, + b INTEGER, + c INTEGER, + d INTEGER +) +WITH (autovacuum_enabled = off); + +INSERT INTO mcv_lists_multi (a, b, c, d) + SELECT + mod(i,5), + mod(i,5), + mod(i,7), + mod(i,7) + FROM generate_series(1,5000) s(i); + +ANALYZE mcv_lists_multi; + +-- estimates without any mcv statistics +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_multi WHERE a = 0 AND b = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_multi WHERE c = 0 AND d = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_multi WHERE a = 0 AND b = 0 AND c = 0 AND d = 0'); + +-- create separate MCV statistics +CREATE STATISTICS mcv_lists_multi_1 (mcv) ON a, b FROM mcv_lists_multi; +CREATE STATISTICS mcv_lists_multi_2 (mcv) ON c, d FROM mcv_lists_multi; + +ANALYZE mcv_lists_multi; + +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_multi WHERE a = 0 AND b = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_multi WHERE c = 0 AND d = 0'); +SELECT * FROM check_estimated_rows('SELECT * FROM mcv_lists_multi WHERE a = 0 AND b = 0 AND c = 0 AND d = 0'); + +DROP TABLE mcv_lists_multi; + +-- Permission tests. Users should not be able to see specific data values in +-- the extended statistics, if they lack permission to see those values in +-- the underlying table. +-- +-- Currently this is only relevant for MCV stats. +CREATE SCHEMA tststats; + +CREATE TABLE tststats.priv_test_tbl ( + a int, + b int +); + +INSERT INTO tststats.priv_test_tbl + SELECT mod(i,5), mod(i,10) FROM generate_series(1,100) s(i); + +CREATE STATISTICS tststats.priv_test_stats (mcv) ON a, b + FROM tststats.priv_test_tbl; + +ANALYZE tststats.priv_test_tbl; + +-- User with no access +CREATE USER regress_stats_user1; +GRANT USAGE ON SCHEMA tststats TO regress_stats_user1; +SET SESSION AUTHORIZATION regress_stats_user1; +SELECT * FROM tststats.priv_test_tbl; -- Permission denied + +-- Attempt to gain access using a leaky operator +CREATE FUNCTION op_leak(int, int) RETURNS bool + AS 'BEGIN RAISE NOTICE ''op_leak => %, %'', $1, $2; RETURN $1 < $2; END' + LANGUAGE plpgsql; +CREATE OPERATOR <<< (procedure = op_leak, leftarg = int, rightarg = int, + restrict = scalarltsel); +SELECT * FROM tststats.priv_test_tbl WHERE a <<< 0 AND b <<< 0; -- Permission denied +DELETE FROM tststats.priv_test_tbl WHERE a <<< 0 AND b <<< 0; -- Permission denied + +-- Grant access via a security barrier view, but hide all data +RESET SESSION AUTHORIZATION; +CREATE VIEW tststats.priv_test_view WITH (security_barrier=true) + AS SELECT * FROM tststats.priv_test_tbl WHERE false; +GRANT SELECT, DELETE ON tststats.priv_test_view TO regress_stats_user1; + +-- Should now have access via the view, but see nothing and leak nothing +SET SESSION AUTHORIZATION regress_stats_user1; +SELECT * FROM tststats.priv_test_view WHERE a <<< 0 AND b <<< 0; -- Should not leak +DELETE FROM tststats.priv_test_view WHERE a <<< 0 AND b <<< 0; -- Should not leak + +-- Grant table access, but hide all data with RLS +RESET SESSION AUTHORIZATION; +ALTER TABLE tststats.priv_test_tbl ENABLE ROW LEVEL SECURITY; +GRANT SELECT, DELETE ON tststats.priv_test_tbl TO regress_stats_user1; + +-- Should now have direct table access, but see nothing and leak nothing +SET SESSION AUTHORIZATION regress_stats_user1; +SELECT * FROM tststats.priv_test_tbl WHERE a <<< 0 AND b <<< 0; -- Should not leak +DELETE FROM tststats.priv_test_tbl WHERE a <<< 0 AND b <<< 0; -- Should not leak + +-- Tidy up +DROP OPERATOR <<< (int, int); +DROP FUNCTION op_leak(int, int); +RESET SESSION AUTHORIZATION; +DROP SCHEMA tststats CASCADE; +DROP USER regress_stats_user1; diff --git a/postgresql/examples/subscription.sql b/postgresql/examples/subscription.sql new file mode 100644 index 0000000..710691c --- /dev/null +++ b/postgresql/examples/subscription.sql @@ -0,0 +1,138 @@ +-- +-- SUBSCRIPTION +-- + +CREATE ROLE regress_subscription_user LOGIN SUPERUSER; +CREATE ROLE regress_subscription_user2; +CREATE ROLE regress_subscription_user_dummy LOGIN NOSUPERUSER; +SET SESSION AUTHORIZATION 'regress_subscription_user'; + +-- fail - no publications +--CREATE SUBSCRIPTION regress_testsub CONNECTION 'foo'; + +-- fail - no connection +--CREATE SUBSCRIPTION regress_testsub PUBLICATION foo; + +-- fail - cannot do CREATE SUBSCRIPTION CREATE SLOT inside transaction block +BEGIN; +CREATE SUBSCRIPTION regress_testsub CONNECTION 'testconn' PUBLICATION testpub WITH (create_slot); +COMMIT; + +-- fail - invalid connection string +CREATE SUBSCRIPTION regress_testsub CONNECTION 'testconn' PUBLICATION testpub; + +-- fail - duplicate publications +CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION foo, testpub, foo WITH (connect = false); + +-- ok +CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false); + +COMMENT ON SUBSCRIPTION regress_testsub IS 'test subscription'; +SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s; + +-- fail - name already exists +CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false); + +-- fail - must be superuser +SET SESSION AUTHORIZATION 'regress_subscription_user2'; +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION foo WITH (connect = false); +SET SESSION AUTHORIZATION 'regress_subscription_user'; + +-- fail - invalid option combinations +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, copy_data = true); +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, enabled = true); +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, create_slot = true); +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = true); +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = true); +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE); +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, enabled = false); +CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, create_slot = false); + +-- ok - with slot_name = NONE +CREATE SUBSCRIPTION regress_testsub3 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false); +-- fail +ALTER SUBSCRIPTION regress_testsub3 ENABLE; +ALTER SUBSCRIPTION regress_testsub3 REFRESH PUBLICATION; + +DROP SUBSCRIPTION regress_testsub3; + +-- fail - invalid connection string +ALTER SUBSCRIPTION regress_testsub CONNECTION 'foobar'; + +\dRs+ + +ALTER SUBSCRIPTION regress_testsub SET PUBLICATION testpub2, testpub3 WITH (refresh = false); +ALTER SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist2'; +ALTER SUBSCRIPTION regress_testsub SET (slot_name = 'newname'); + +-- fail +ALTER SUBSCRIPTION regress_doesnotexist CONNECTION 'dbname=regress_doesnotexist2'; +ALTER SUBSCRIPTION regress_testsub SET (create_slot = false); + +\dRs+ + +BEGIN; +ALTER SUBSCRIPTION regress_testsub ENABLE; + +\dRs + +ALTER SUBSCRIPTION regress_testsub DISABLE; + +\dRs + +COMMIT; + +-- fail - must be owner of subscription +SET ROLE regress_subscription_user_dummy; +ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_dummy; +RESET ROLE; + +ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_foo; +ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local); +ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar); + +\dRs+ + +-- rename back to keep the rest simple +ALTER SUBSCRIPTION regress_testsub_foo RENAME TO regress_testsub; + +-- fail - new owner must be superuser +ALTER SUBSCRIPTION regress_testsub OWNER TO regress_subscription_user2; +ALTER ROLE regress_subscription_user2 SUPERUSER; +-- now it works +ALTER SUBSCRIPTION regress_testsub OWNER TO regress_subscription_user2; + +-- fail - cannot do DROP SUBSCRIPTION inside transaction block with slot name +BEGIN; +DROP SUBSCRIPTION regress_testsub; +COMMIT; + +ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE); + +-- now it works +BEGIN; +DROP SUBSCRIPTION regress_testsub; +COMMIT; + +DROP SUBSCRIPTION IF EXISTS regress_testsub; +DROP SUBSCRIPTION regress_testsub; -- fail + +-- fail - binary must be boolean +CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, binary = foo); + +-- now it works +CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, binary = true); + +\dRs+ + +ALTER SUBSCRIPTION regress_testsub SET (binary = false); +ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE); + +\dRs+ + +DROP SUBSCRIPTION regress_testsub; + +RESET SESSION AUTHORIZATION; +DROP ROLE regress_subscription_user; +DROP ROLE regress_subscription_user2; +DROP ROLE regress_subscription_user_dummy; diff --git a/postgresql/examples/subselect.sql b/postgresql/examples/subselect.sql new file mode 100644 index 0000000..a56057b --- /dev/null +++ b/postgresql/examples/subselect.sql @@ -0,0 +1,859 @@ +-- +-- SUBSELECT +-- + +SELECT 1 AS one WHERE 1 IN (SELECT 1); + +SELECT 1 AS zero WHERE 1 NOT IN (SELECT 1); + +SELECT 1 AS zero WHERE 1 IN (SELECT 2); + +-- Check grammar's handling of extra parens in assorted contexts + +SELECT * FROM (SELECT 1 AS x) ss; +SELECT * FROM ((SELECT 1 AS x)) ss; + +(SELECT 2) UNION SELECT 2; +((SELECT 2)) UNION SELECT 2; + +SELECT ((SELECT 2) UNION SELECT 2); +SELECT (((SELECT 2)) UNION SELECT 2); + +SELECT (SELECT ARRAY[1,2,3])[1]; +SELECT ((SELECT ARRAY[1,2,3]))[2]; +SELECT (((SELECT ARRAY[1,2,3])))[3]; + +-- Set up some simple test tables + +CREATE TABLE SUBSELECT_TBL ( + f1 integer, + f2 integer, + f3 float +); + +INSERT INTO SUBSELECT_TBL VALUES (1, 2, 3); +INSERT INTO SUBSELECT_TBL VALUES (2, 3, 4); +INSERT INTO SUBSELECT_TBL VALUES (3, 4, 5); +INSERT INTO SUBSELECT_TBL VALUES (1, 1, 1); +INSERT INTO SUBSELECT_TBL VALUES (2, 2, 2); +INSERT INTO SUBSELECT_TBL VALUES (3, 3, 3); +INSERT INTO SUBSELECT_TBL VALUES (6, 7, 8); +INSERT INTO SUBSELECT_TBL VALUES (8, 9, NULL); + +SELECT '' AS eight, * FROM SUBSELECT_TBL; + +-- Uncorrelated subselects + +SELECT '' AS two, f1 AS "Constant Select" FROM SUBSELECT_TBL + WHERE f1 IN (SELECT 1); + +SELECT '' AS six, f1 AS "Uncorrelated Field" FROM SUBSELECT_TBL + WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL); + +SELECT '' AS six, f1 AS "Uncorrelated Field" FROM SUBSELECT_TBL + WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL WHERE + f2 IN (SELECT f1 FROM SUBSELECT_TBL)); + +SELECT '' AS three, f1, f2 + FROM SUBSELECT_TBL + WHERE (f1, f2) NOT IN (SELECT f2, CAST(f3 AS int4) FROM SUBSELECT_TBL + WHERE f3 IS NOT NULL); + +-- Correlated subselects + +SELECT '' AS six, f1 AS "Correlated Field", f2 AS "Second Field" + FROM SUBSELECT_TBL upper + WHERE f1 IN (SELECT f2 FROM SUBSELECT_TBL WHERE f1 = upper.f1); + +SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field" + FROM SUBSELECT_TBL upper + WHERE f1 IN + (SELECT f2 FROM SUBSELECT_TBL WHERE CAST(upper.f2 AS float) = f3); + +SELECT '' AS six, f1 AS "Correlated Field", f3 AS "Second Field" + FROM SUBSELECT_TBL upper + WHERE f3 IN (SELECT upper.f1 + f2 FROM SUBSELECT_TBL + WHERE f2 = CAST(f3 AS integer)); + +SELECT '' AS five, f1 AS "Correlated Field" + FROM SUBSELECT_TBL + WHERE (f1, f2) IN (SELECT f2, CAST(f3 AS int4) FROM SUBSELECT_TBL + WHERE f3 IS NOT NULL); + +-- +-- Use some existing tables in the regression test +-- + +SELECT '' AS eight, ss.f1 AS "Correlated Field", ss.f3 AS "Second Field" + FROM SUBSELECT_TBL ss + WHERE f1 NOT IN (SELECT f1+1 FROM INT4_TBL + WHERE f1 != ss.f1 AND f1 < 2147483647); + +select q1, float8(count(*)) / (select count(*) from int8_tbl) +from int8_tbl group by q1 order by q1; + +-- Unspecified-type literals in output columns should resolve as text + +SELECT *, pg_typeof(f1) FROM + (SELECT 'foo' AS f1 FROM generate_series(1,3)) ss ORDER BY 1; + +-- ... unless there's context to suggest differently + +explain (verbose, costs off) select '42' union all select '43'; +explain (verbose, costs off) select '42' union all select 43; + +-- check materialization of an initplan reference (bug #14524) +explain (verbose, costs off) +select 1 = all (select (select 1)); +select 1 = all (select (select 1)); + +-- +-- Check EXISTS simplification with LIMIT +-- +explain (costs off) +select * from int4_tbl o where exists + (select 1 from int4_tbl i where i.f1=o.f1 limit null); +explain (costs off) +select * from int4_tbl o where not exists + (select 1 from int4_tbl i where i.f1=o.f1 limit 1); +explain (costs off) +select * from int4_tbl o where exists + (select 1 from int4_tbl i where i.f1=o.f1 limit 0); + +-- +-- Test cases to catch unpleasant interactions between IN-join processing +-- and subquery pullup. +-- + +select count(*) from + (select 1 from tenk1 a + where unique1 IN (select hundred from tenk1 b)) ss; +select count(distinct ss.ten) from + (select ten from tenk1 a + where unique1 IN (select hundred from tenk1 b)) ss; +select count(*) from + (select 1 from tenk1 a + where unique1 IN (select distinct hundred from tenk1 b)) ss; +select count(distinct ss.ten) from + (select ten from tenk1 a + where unique1 IN (select distinct hundred from tenk1 b)) ss; + +-- +-- Test cases to check for overenthusiastic optimization of +-- "IN (SELECT DISTINCT ...)" and related cases. Per example from +-- Luca Pireddu and Michael Fuhr. +-- + +CREATE TEMP TABLE foo (id integer); +CREATE TEMP TABLE bar (id1 integer, id2 integer); + +INSERT INTO foo VALUES (1); + +INSERT INTO bar VALUES (1, 1); +INSERT INTO bar VALUES (2, 2); +INSERT INTO bar VALUES (3, 1); + +-- These cases require an extra level of distinct-ing above subquery s +SELECT * FROM foo WHERE id IN + (SELECT id2 FROM (SELECT DISTINCT id1, id2 FROM bar) AS s); +SELECT * FROM foo WHERE id IN + (SELECT id2 FROM (SELECT id1,id2 FROM bar GROUP BY id1,id2) AS s); +SELECT * FROM foo WHERE id IN + (SELECT id2 FROM (SELECT id1, id2 FROM bar UNION + SELECT id1, id2 FROM bar) AS s); + +-- These cases do not +SELECT * FROM foo WHERE id IN + (SELECT id2 FROM (SELECT DISTINCT ON (id2) id1, id2 FROM bar) AS s); +SELECT * FROM foo WHERE id IN + (SELECT id2 FROM (SELECT id2 FROM bar GROUP BY id2) AS s); +SELECT * FROM foo WHERE id IN + (SELECT id2 FROM (SELECT id2 FROM bar UNION + SELECT id2 FROM bar) AS s); + +-- +-- Test case to catch problems with multiply nested sub-SELECTs not getting +-- recalculated properly. Per bug report from Didier Moens. +-- + +CREATE TABLE orderstest ( + approver_ref integer, + po_ref integer, + ordercanceled boolean +); + +INSERT INTO orderstest VALUES (1, 1, false); +INSERT INTO orderstest VALUES (66, 5, false); +INSERT INTO orderstest VALUES (66, 6, false); +INSERT INTO orderstest VALUES (66, 7, false); +INSERT INTO orderstest VALUES (66, 1, true); +INSERT INTO orderstest VALUES (66, 8, false); +INSERT INTO orderstest VALUES (66, 1, false); +INSERT INTO orderstest VALUES (77, 1, false); +INSERT INTO orderstest VALUES (1, 1, false); +INSERT INTO orderstest VALUES (66, 1, false); +INSERT INTO orderstest VALUES (1, 1, false); + +CREATE VIEW orders_view AS +SELECT *, +(SELECT CASE + WHEN ord.approver_ref=1 THEN '---' ELSE 'Approved' + END) AS "Approved", +(SELECT CASE + WHEN ord.ordercanceled + THEN 'Canceled' + ELSE + (SELECT CASE + WHEN ord.po_ref=1 + THEN + (SELECT CASE + WHEN ord.approver_ref=1 + THEN '---' + ELSE 'Approved' + END) + ELSE 'PO' + END) +END) AS "Status", +(CASE + WHEN ord.ordercanceled + THEN 'Canceled' + ELSE + (CASE + WHEN ord.po_ref=1 + THEN + (CASE + WHEN ord.approver_ref=1 + THEN '---' + ELSE 'Approved' + END) + ELSE 'PO' + END) +END) AS "Status_OK" +FROM orderstest ord; + +SELECT * FROM orders_view; + +DROP TABLE orderstest cascade; + +-- +-- Test cases to catch situations where rule rewriter fails to propagate +-- hasSubLinks flag correctly. Per example from Kyle Bateman. +-- + +create temp table parts ( + partnum text, + cost float8 +); + +create temp table shipped ( + ttype char(2), + ordnum int4, + partnum text, + value float8 +); + +create temp view shipped_view as + select * from shipped where ttype = 'wt'; + +create rule shipped_view_insert as on insert to shipped_view do instead + insert into shipped values('wt', new.ordnum, new.partnum, new.value); + +insert into parts (partnum, cost) values (1, 1234.56); + +insert into shipped_view (ordnum, partnum, value) + values (0, 1, (select cost from parts where partnum = '1')); + +select * from shipped_view; + +create rule shipped_view_update as on update to shipped_view do instead + update shipped set partnum = new.partnum, value = new.value + where ttype = new.ttype and ordnum = new.ordnum; + +update shipped_view set value = 11 + from int4_tbl a join int4_tbl b + on (a.f1 = (select f1 from int4_tbl c where c.f1=b.f1)) + where ordnum = a.f1; + +select * from shipped_view; + +select f1, ss1 as relabel from + (select *, (select sum(f1) from int4_tbl b where f1 >= a.f1) as ss1 + from int4_tbl a) ss; + +-- +-- Test cases involving PARAM_EXEC parameters and min/max index optimizations. +-- Per bug report from David Sanchez i Gregori. +-- + +select * from ( + select max(unique1) from tenk1 as a + where exists (select 1 from tenk1 as b where b.thousand = a.unique2) +) ss; + +select * from ( + select min(unique1) from tenk1 as a + where not exists (select 1 from tenk1 as b where b.unique2 = 10000) +) ss; + +-- +-- Test that an IN implemented using a UniquePath does unique-ification +-- with the right semantics, as per bug #4113. (Unfortunately we have +-- no simple way to ensure that this test case actually chooses that type +-- of plan, but it does in releases 7.4-8.3. Note that an ordering difference +-- here might mean that some other plan type is being used, rendering the test +-- pointless.) +-- + +create temp table numeric_table (num_col numeric); +insert into numeric_table values (1), (1.000000000000000000001), (2), (3); + +create temp table float_table (float_col float8); +insert into float_table values (1), (2), (3); + +select * from float_table + where float_col in (select num_col from numeric_table); + +select * from numeric_table + where num_col in (select float_col from float_table); + +-- +-- Test case for bug #4290: bogus calculation of subplan param sets +-- + +create temp table ta (id int primary key, val int); + +insert into ta values(1,1); +insert into ta values(2,2); + +create temp table tb (id int primary key, aval int); + +insert into tb values(1,1); +insert into tb values(2,1); +insert into tb values(3,2); +insert into tb values(4,2); + +create temp table tc (id int primary key, aid int); + +insert into tc values(1,1); +insert into tc values(2,2); + +select + ( select min(tb.id) from tb + where tb.aval = (select ta.val from ta where ta.id = tc.aid) ) as min_tb_id +from tc; + +-- +-- Test case for 8.3 "failed to locate grouping columns" bug +-- + +create temp table t1 (f1 numeric(14,0), f2 varchar(30)); + +select * from + (select distinct f1, f2, (select f2 from t1 x where x.f1 = up.f1) as fs + from t1 up) ss +group by f1,f2,fs; + +-- +-- Test case for bug #5514 (mishandling of whole-row Vars in subselects) +-- + +create temp table table_a(id integer); +insert into table_a values (42); + +create temp view view_a as select * from table_a; + +select view_a from view_a; +select (select view_a) from view_a; +select (select (select view_a)) from view_a; +select (select (a.*)::text) from view_a a; + +-- +-- Check that whole-row Vars reading the result of a subselect don't include +-- any junk columns therein +-- + +select q from (select max(f1) from int4_tbl group by f1 order by f1) q; +with q as (select max(f1) from int4_tbl group by f1 order by f1) + select q from q; + +-- +-- Test case for sublinks pulled up into joinaliasvars lists in an +-- inherited update/delete query +-- + +begin; -- this shouldn't delete anything, but be safe + +delete from road +where exists ( + select 1 + from + int4_tbl cross join + ( select f1, array(select q1 from int8_tbl) as arr + from text_tbl ) ss + where road.name = ss.f1 ); + +rollback; + +-- +-- Test case for sublinks pushed down into subselects via join alias expansion +-- + +select + (select sq1) as qq1 +from + (select exists(select 1 from int4_tbl where f1 = q2) as sq1, 42 as dummy + from int8_tbl) sq0 + join + int4_tbl i4 on dummy = i4.f1; + +-- +-- Test case for subselect within UPDATE of INSERT...ON CONFLICT DO UPDATE +-- +create temp table upsert(key int4 primary key, val text); +insert into upsert values(1, 'val') on conflict (key) do update set val = 'not seen'; +insert into upsert values(1, 'val') on conflict (key) do update set val = 'seen with subselect ' || (select f1 from int4_tbl where f1 != 0 limit 1)::text; + +select * from upsert; + +with aa as (select 'int4_tbl' u from int4_tbl limit 1) +insert into upsert values (1, 'x'), (999, 'y') +on conflict (key) do update set val = (select u from aa) +returning *; + +-- +-- Test case for cross-type partial matching in hashed subplan (bug #7597) +-- + +create temp table outer_7597 (f1 int4, f2 int4); +insert into outer_7597 values (0, 0); +insert into outer_7597 values (1, 0); +insert into outer_7597 values (0, null); +insert into outer_7597 values (1, null); + +create temp table inner_7597(c1 int8, c2 int8); +insert into inner_7597 values(0, null); + +select * from outer_7597 where (f1, f2) not in (select * from inner_7597); + +-- +-- Similar test case using text that verifies that collation +-- information is passed through by execTuplesEqual() in nodeSubplan.c +-- (otherwise it would error in texteq()) +-- + +create temp table outer_text (f1 text, f2 text); +insert into outer_text values ('a', 'a'); +insert into outer_text values ('b', 'a'); +insert into outer_text values ('a', null); +insert into outer_text values ('b', null); + +create temp table inner_text (c1 text, c2 text); +insert into inner_text values ('a', null); + +select * from outer_text where (f1, f2) not in (select * from inner_text); + +-- +-- Another test case for cross-type hashed subplans: comparison of +-- inner-side values must be done with appropriate operator +-- + +explain (verbose, costs off) +select 'foo'::text in (select 'bar'::name union all select 'bar'::name); + +select 'foo'::text in (select 'bar'::name union all select 'bar'::name); + +-- +-- Test case for premature memory release during hashing of subplan output +-- + +select '1'::text in (select '1'::name union all select '1'::name); + +-- +-- Test case for planner bug with nested EXISTS handling +-- +select a.thousand from tenk1 a, tenk1 b +where a.thousand = b.thousand + and exists ( select 1 from tenk1 c where b.hundred = c.hundred + and not exists ( select 1 from tenk1 d + where a.thousand = d.thousand ) ); + +-- +-- Check that nested sub-selects are not pulled up if they contain volatiles +-- +explain (verbose, costs off) + select x, x from + (select (select now()) as x from (values(1),(2)) v(y)) ss; +explain (verbose, costs off) + select x, x from + (select (select random()) as x from (values(1),(2)) v(y)) ss; +explain (verbose, costs off) + select x, x from + (select (select now() where y=y) as x from (values(1),(2)) v(y)) ss; +explain (verbose, costs off) + select x, x from + (select (select random() where y=y) as x from (values(1),(2)) v(y)) ss; + +-- +-- Test rescan of a hashed subplan (the use of random() is to prevent the +-- sub-select from being pulled up, which would result in not hashing) +-- +explain (verbose, costs off) +select sum(ss.tst::int) from + onek o cross join lateral ( + select i.ten in (select f1 from int4_tbl where f1 <= o.hundred) as tst, + random() as r + from onek i where i.unique1 = o.unique1 ) ss +where o.ten = 0; + +select sum(ss.tst::int) from + onek o cross join lateral ( + select i.ten in (select f1 from int4_tbl where f1 <= o.hundred) as tst, + random() as r + from onek i where i.unique1 = o.unique1 ) ss +where o.ten = 0; + +-- +-- Test rescan of a SetOp node +-- +explain (costs off) +select count(*) from + onek o cross join lateral ( + select * from onek i1 where i1.unique1 = o.unique1 + except + select * from onek i2 where i2.unique1 = o.unique2 + ) ss +where o.ten = 1; + +select count(*) from + onek o cross join lateral ( + select * from onek i1 where i1.unique1 = o.unique1 + except + select * from onek i2 where i2.unique1 = o.unique2 + ) ss +where o.ten = 1; + +-- +-- Test rescan of a RecursiveUnion node +-- +explain (costs off) +select sum(o.four), sum(ss.a) from + onek o cross join lateral ( + with recursive x(a) as + (select o.four as a + union + select a + 1 from x + where a < 10) + select * from x + ) ss +where o.ten = 1; + +select sum(o.four), sum(ss.a) from + onek o cross join lateral ( + with recursive x(a) as + (select o.four as a + union + select a + 1 from x + where a < 10) + select * from x + ) ss +where o.ten = 1; + +-- +-- Check we don't misoptimize a NOT IN where the subquery returns no rows. +-- +create temp table notinouter (a int); +create temp table notininner (b int not null); +insert into notinouter values (null), (1); + +select * from notinouter where a not in (select b from notininner); + +-- +-- Check we behave sanely in corner case of empty SELECT list (bug #8648) +-- +create temp table nocolumns(); +select exists(select * from nocolumns); + +-- +-- Check behavior with a SubPlan in VALUES (bug #14924) +-- +select val.x + from generate_series(1,10) as s(i), + lateral ( + values ((select s.i + 1)), (s.i + 101) + ) as val(x) +where s.i < 10 and (select val.x) < 110; + +-- another variant of that (bug #16213) +explain (verbose, costs off) +select * from +(values + (3 not in (select * from (values (1), (2)) ss1)), + (false) +) ss; + +select * from +(values + (3 not in (select * from (values (1), (2)) ss1)), + (false) +) ss; + +-- +-- Check sane behavior with nested IN SubLinks +-- +explain (verbose, costs off) +select * from int4_tbl where + (case when f1 in (select unique1 from tenk1 a) then f1 else null end) in + (select ten from tenk1 b); +select * from int4_tbl where + (case when f1 in (select unique1 from tenk1 a) then f1 else null end) in + (select ten from tenk1 b); + +-- +-- Check for incorrect optimization when IN subquery contains a SRF +-- +explain (verbose, costs off) +select * from int4_tbl o where (f1, f1) in + (select f1, generate_series(1,50) / 10 g from int4_tbl i group by f1); +select * from int4_tbl o where (f1, f1) in + (select f1, generate_series(1,50) / 10 g from int4_tbl i group by f1); + +-- +-- check for over-optimization of whole-row Var referencing an Append plan +-- +select (select q from + (select 1,2,3 where f1 > 0 + union all + select 4,5,6.0 where f1 <= 0 + ) q ) +from int4_tbl; + +-- +-- Check for sane handling of a lateral reference in a subquery's quals +-- (most of the complication here is to prevent the test case from being +-- flattened too much) +-- +explain (verbose, costs off) +select * from + int4_tbl i4, + lateral ( + select i4.f1 > 1 as b, 1 as id + from (select random() order by 1) as t1 + union all + select true as b, 2 as id + ) as t2 +where b and f1 >= 0; + +select * from + int4_tbl i4, + lateral ( + select i4.f1 > 1 as b, 1 as id + from (select random() order by 1) as t1 + union all + select true as b, 2 as id + ) as t2 +where b and f1 >= 0; + +-- +-- Check that volatile quals aren't pushed down past a DISTINCT: +-- nextval() should not be called more than the nominal number of times +-- +create temp sequence ts1; + +select * from + (select distinct ten from tenk1) ss + where ten < 10 + nextval('ts1') + order by 1; + +select nextval('ts1'); + +-- +-- Check that volatile quals aren't pushed down past a set-returning function; +-- while a nonvolatile qual can be, if it doesn't reference the SRF. +-- +create function tattle(x int, y int) returns bool +volatile language plpgsql as $$ +begin + raise notice 'x = %, y = %', x, y; + return x > y; +end$$; + +explain (verbose, costs off) +select * from + (select 9 as x, unnest(array[1,2,3,11,12,13]) as u) ss + where tattle(x, 8); + +select * from + (select 9 as x, unnest(array[1,2,3,11,12,13]) as u) ss + where tattle(x, 8); + +-- if we pretend it's stable, we get different results: +alter function tattle(x int, y int) stable; + +explain (verbose, costs off) +select * from + (select 9 as x, unnest(array[1,2,3,11,12,13]) as u) ss + where tattle(x, 8); + +select * from + (select 9 as x, unnest(array[1,2,3,11,12,13]) as u) ss + where tattle(x, 8); + +-- although even a stable qual should not be pushed down if it references SRF +explain (verbose, costs off) +select * from + (select 9 as x, unnest(array[1,2,3,11,12,13]) as u) ss + where tattle(x, u); + +select * from + (select 9 as x, unnest(array[1,2,3,11,12,13]) as u) ss + where tattle(x, u); + +drop function tattle(x int, y int); + +-- +-- Test that LIMIT can be pushed to SORT through a subquery that just projects +-- columns. We check for that having happened by looking to see if EXPLAIN +-- ANALYZE shows that a top-N sort was used. We must suppress or filter away +-- all the non-invariant parts of the EXPLAIN ANALYZE output. +-- +create table sq_limit (pk int primary key, c1 int, c2 int); +insert into sq_limit values + (1, 1, 1), + (2, 2, 2), + (3, 3, 3), + (4, 4, 4), + (5, 1, 1), + (6, 2, 2), + (7, 3, 3), + (8, 4, 4); + +create function explain_sq_limit() returns setof text language plpgsql as +$$ +declare ln text; +begin + for ln in + explain (analyze, summary off, timing off, costs off) + select * from (select pk,c2 from sq_limit order by c1,pk) as x limit 3 + loop + ln := regexp_replace(ln, 'Memory: \S*', 'Memory: xxx'); + return next ln; + end loop; +end; +$$; + +select * from explain_sq_limit(); + +select * from (select pk,c2 from sq_limit order by c1,pk) as x limit 3; + +drop function explain_sq_limit(); + +drop table sq_limit; + +-- +-- Ensure that backward scan direction isn't propagated into +-- expression subqueries (bug #15336) +-- + +begin; + +declare c1 scroll cursor for + select * from generate_series(1,4) i + where i <> all (values (2),(3)); + +move forward all in c1; +fetch backward all in c1; + +commit; + +-- +-- Tests for CTE inlining behavior +-- + +-- Basic subquery that can be inlined +explain (verbose, costs off) +with x as (select * from (select f1 from subselect_tbl) ss) +select * from x where f1 = 1; + +-- Explicitly request materialization +explain (verbose, costs off) +with x as materialized (select * from (select f1 from subselect_tbl) ss) +select * from x where f1 = 1; + +-- Stable functions are safe to inline +explain (verbose, costs off) +with x as (select * from (select f1, now() from subselect_tbl) ss) +select * from x where f1 = 1; + +-- Volatile functions prevent inlining +explain (verbose, costs off) +with x as (select * from (select f1, random() from subselect_tbl) ss) +select * from x where f1 = 1; + +-- SELECT FOR UPDATE cannot be inlined +explain (verbose, costs off) +with x as (select * from (select f1 from subselect_tbl for update) ss) +select * from x where f1 = 1; + +-- Multiply-referenced CTEs are inlined only when requested +explain (verbose, costs off) +with x as (select * from (select f1, now() as n from subselect_tbl) ss) +select * from x, x x2 where x.n = x2.n; + +explain (verbose, costs off) +with x as not materialized (select * from (select f1, now() as n from subselect_tbl) ss) +select * from x, x x2 where x.n = x2.n; + +-- Multiply-referenced CTEs can't be inlined if they contain outer self-refs +explain (verbose, costs off) +with recursive x(a) as + ((values ('a'), ('b')) + union all + (with z as not materialized (select * from x) + select z.a || z1.a as a from z cross join z as z1 + where length(z.a || z1.a) < 5)) +select * from x; + +with recursive x(a) as + ((values ('a'), ('b')) + union all + (with z as not materialized (select * from x) + select z.a || z1.a as a from z cross join z as z1 + where length(z.a || z1.a) < 5)) +select * from x; + +explain (verbose, costs off) +with recursive x(a) as + ((values ('a'), ('b')) + union all + (with z as not materialized (select * from x) + select z.a || z.a as a from z + where length(z.a || z.a) < 5)) +select * from x; + +with recursive x(a) as + ((values ('a'), ('b')) + union all + (with z as not materialized (select * from x) + select z.a || z.a as a from z + where length(z.a || z.a) < 5)) +select * from x; + +-- Check handling of outer references +explain (verbose, costs off) +with x as (select * from int4_tbl) +select * from (with y as (select * from x) select * from y) ss; + +explain (verbose, costs off) +with x as materialized (select * from int4_tbl) +select * from (with y as (select * from x) select * from y) ss; + +-- Ensure that we inline the currect CTE when there are +-- multiple CTEs with the same name +explain (verbose, costs off) +with x as (select 1 as y) +select * from (with x as (select 2 as y) select * from x) ss; + +-- Row marks are not pushed into CTEs +explain (verbose, costs off) +with x as (select * from subselect_tbl) +select * from x for update; diff --git a/postgresql/examples/sysviews.sql b/postgresql/examples/sysviews.sql new file mode 100644 index 0000000..28e412b --- /dev/null +++ b/postgresql/examples/sysviews.sql @@ -0,0 +1,51 @@ +-- +-- Test assorted system views +-- +-- This test is mainly meant to provide some code coverage for the +-- set-returning functions that underlie certain system views. +-- The output of most of these functions is very environment-dependent, +-- so our ability to test with fixed expected output is pretty limited; +-- but even a trivial check of count(*) will exercise the normal code path +-- through the SRF. + +select count(*) >= 0 as ok from pg_available_extension_versions; + +select count(*) >= 0 as ok from pg_available_extensions; + +-- At introduction, pg_config had 23 entries; it may grow +select count(*) > 20 as ok from pg_config; + +-- We expect no cursors in this test; see also portals.sql +select count(*) = 0 as ok from pg_cursors; + +select count(*) >= 0 as ok from pg_file_settings; + +-- There will surely be at least one rule +select count(*) > 0 as ok from pg_hba_file_rules; + +-- There will surely be at least one active lock +select count(*) > 0 as ok from pg_locks; + +-- We expect no prepared statements in this test; see also prepare.sql +select count(*) = 0 as ok from pg_prepared_statements; + +-- See also prepared_xacts.sql +select count(*) >= 0 as ok from pg_prepared_xacts; + +-- This is to record the prevailing planner enable_foo settings during +-- a regression test run. +select name, setting from pg_settings where name like 'enable%'; + +-- Test that the pg_timezone_names and pg_timezone_abbrevs views are +-- more-or-less working. We can't test their contents in any great detail +-- without the outputs changing anytime IANA updates the underlying data, +-- but it seems reasonable to expect at least one entry per major meridian. +-- (At the time of writing, the actual counts are around 38 because of +-- zones using fractional GMT offsets, so this is a pretty loose test.) +select count(distinct utc_offset) >= 24 as ok from pg_timezone_names; +select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; +-- Let's check the non-default timezone abbreviation sets, too +set timezone_abbreviations = 'Australia'; +select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; +set timezone_abbreviations = 'India'; +select count(distinct utc_offset) >= 24 as ok from pg_timezone_abbrevs; diff --git a/postgresql/examples/tablesample.sql b/postgresql/examples/tablesample.sql new file mode 100644 index 0000000..b5f46e1 --- /dev/null +++ b/postgresql/examples/tablesample.sql @@ -0,0 +1,109 @@ +CREATE TABLE test_tablesample (id int, name text) WITH (fillfactor=10); +-- use fillfactor so we don't have to load too much data to get multiple pages + +INSERT INTO test_tablesample + SELECT i, repeat(i::text, 200) FROM generate_series(0, 9) s(i); + +SELECT t.id FROM test_tablesample AS t TABLESAMPLE SYSTEM (50) REPEATABLE (0); +SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (100.0/11) REPEATABLE (0); +SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0); +SELECT id FROM test_tablesample TABLESAMPLE BERNOULLI (50) REPEATABLE (0); +SELECT id FROM test_tablesample TABLESAMPLE BERNOULLI (5.5) REPEATABLE (0); + +-- 100% should give repeatable count results (ie, all rows) in any case +SELECT count(*) FROM test_tablesample TABLESAMPLE SYSTEM (100); +SELECT count(*) FROM test_tablesample TABLESAMPLE SYSTEM (100) REPEATABLE (1+2); +SELECT count(*) FROM test_tablesample TABLESAMPLE SYSTEM (100) REPEATABLE (0.4); + +CREATE VIEW test_tablesample_v1 AS + SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (10*2) REPEATABLE (2); +CREATE VIEW test_tablesample_v2 AS + SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (99); +\d+ test_tablesample_v1 +\d+ test_tablesample_v2 + +-- check a sampled query doesn't affect cursor in progress +BEGIN; +DECLARE tablesample_cur CURSOR FOR + SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0); + +FETCH FIRST FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; + +SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (0); + +FETCH NEXT FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; + +FETCH FIRST FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; +FETCH NEXT FROM tablesample_cur; + +CLOSE tablesample_cur; +END; + +EXPLAIN (COSTS OFF) + SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (2); +EXPLAIN (COSTS OFF) + SELECT * FROM test_tablesample_v1; + +-- check inheritance behavior +explain (costs off) + select count(*) from person tablesample bernoulli (100); +select count(*) from person tablesample bernoulli (100); +select count(*) from person; + +-- check that collations get assigned within the tablesample arguments +SELECT count(*) FROM test_tablesample TABLESAMPLE bernoulli (('1'::text < '0'::text)::int); + +-- check behavior during rescans, as well as correct handling of min/max pct +select * from + (values (0),(100)) v(pct), + lateral (select count(*) from tenk1 tablesample bernoulli (pct)) ss; +select * from + (values (0),(100)) v(pct), + lateral (select count(*) from tenk1 tablesample system (pct)) ss; +explain (costs off) +select pct, count(unique1) from + (values (0),(100)) v(pct), + lateral (select * from tenk1 tablesample bernoulli (pct)) ss + group by pct; +select pct, count(unique1) from + (values (0),(100)) v(pct), + lateral (select * from tenk1 tablesample bernoulli (pct)) ss + group by pct; +select pct, count(unique1) from + (values (0),(100)) v(pct), + lateral (select * from tenk1 tablesample system (pct)) ss + group by pct; + +-- errors +SELECT id FROM test_tablesample TABLESAMPLE FOOBAR (1); + +SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (NULL); +SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (50) REPEATABLE (NULL); + +SELECT id FROM test_tablesample TABLESAMPLE BERNOULLI (-1); +SELECT id FROM test_tablesample TABLESAMPLE BERNOULLI (200); +SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (-1); +SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (200); + +SELECT id FROM test_tablesample_v1 TABLESAMPLE BERNOULLI (1); +INSERT INTO test_tablesample_v1 VALUES(1); + +WITH query_select AS (SELECT * FROM test_tablesample) +SELECT * FROM query_select TABLESAMPLE BERNOULLI (5.5) REPEATABLE (1); + + +-- check partitioned tables support tablesample +create table parted_sample (a int) partition by list (a); +create table parted_sample_1 partition of parted_sample for values in (1); +create table parted_sample_2 partition of parted_sample for values in (2); +explain (costs off) + select * from parted_sample tablesample bernoulli (100); +drop table parted_sample, parted_sample_1, parted_sample_2; diff --git a/postgresql/examples/temp.sql b/postgresql/examples/temp.sql new file mode 100644 index 0000000..424d12b --- /dev/null +++ b/postgresql/examples/temp.sql @@ -0,0 +1,297 @@ +-- +-- TEMP +-- Test temp relations and indexes +-- + +-- test temp table/index masking + +CREATE TABLE temptest(col int); + +CREATE INDEX i_temptest ON temptest(col); + +CREATE TEMP TABLE temptest(tcol int); + +CREATE INDEX i_temptest ON temptest(tcol); + +SELECT * FROM temptest; + +DROP INDEX i_temptest; + +DROP TABLE temptest; + +SELECT * FROM temptest; + +DROP INDEX i_temptest; + +DROP TABLE temptest; + +-- test temp table selects + +CREATE TABLE temptest(col int); + +INSERT INTO temptest VALUES (1); + +CREATE TEMP TABLE temptest(tcol float); + +INSERT INTO temptest VALUES (2.1); + +SELECT * FROM temptest; + +DROP TABLE temptest; + +SELECT * FROM temptest; + +DROP TABLE temptest; + +-- test temp table deletion + +CREATE TEMP TABLE temptest(col int); + +\c + +SELECT * FROM temptest; + +-- Test ON COMMIT DELETE ROWS + +CREATE TEMP TABLE temptest(col int) ON COMMIT DELETE ROWS; + +-- while we're here, verify successful truncation of index with SQL function +CREATE INDEX ON temptest(bit_length('')); + +BEGIN; +INSERT INTO temptest VALUES (1); +INSERT INTO temptest VALUES (2); + +SELECT * FROM temptest; +COMMIT; + +SELECT * FROM temptest; + +DROP TABLE temptest; + +BEGIN; +CREATE TEMP TABLE temptest(col) ON COMMIT DELETE ROWS AS SELECT 1; + +SELECT * FROM temptest; +COMMIT; + +SELECT * FROM temptest; + +DROP TABLE temptest; + +-- Test ON COMMIT DROP + +BEGIN; + +CREATE TEMP TABLE temptest(col int) ON COMMIT DROP; + +INSERT INTO temptest VALUES (1); +INSERT INTO temptest VALUES (2); + +SELECT * FROM temptest; +COMMIT; + +SELECT * FROM temptest; + +BEGIN; +CREATE TEMP TABLE temptest(col) ON COMMIT DROP AS SELECT 1; + +SELECT * FROM temptest; +COMMIT; + +SELECT * FROM temptest; + +-- ON COMMIT is only allowed for TEMP + +CREATE TABLE temptest(col int) ON COMMIT DELETE ROWS; +CREATE TABLE temptest(col) ON COMMIT DELETE ROWS AS SELECT 1; + +-- Test foreign keys +BEGIN; +CREATE TEMP TABLE temptest1(col int PRIMARY KEY); +CREATE TEMP TABLE temptest2(col int REFERENCES temptest1) + ON COMMIT DELETE ROWS; +INSERT INTO temptest1 VALUES (1); +INSERT INTO temptest2 VALUES (1); +COMMIT; +SELECT * FROM temptest1; +SELECT * FROM temptest2; + +BEGIN; +CREATE TEMP TABLE temptest3(col int PRIMARY KEY) ON COMMIT DELETE ROWS; +CREATE TEMP TABLE temptest4(col int REFERENCES temptest3); +COMMIT; + +-- Test manipulation of temp schema's placement in search path + +create table public.whereami (f1 text); +insert into public.whereami values ('public'); + +create temp table whereami (f1 text); +insert into whereami values ('temp'); + +create function public.whoami() returns text + as $$select 'public'::text$$ language sql; + +create function pg_temp.whoami() returns text + as $$select 'temp'::text$$ language sql; + +-- default should have pg_temp implicitly first, but only for tables +select * from whereami; +select whoami(); + +-- can list temp first explicitly, but it still doesn't affect functions +set search_path = pg_temp, public; +select * from whereami; +select whoami(); + +-- or put it last for security +set search_path = public, pg_temp; +select * from whereami; +select whoami(); + +-- you can invoke a temp function explicitly, though +select pg_temp.whoami(); + +drop table public.whereami; + +-- types in temp schema +set search_path = pg_temp, public; +create domain pg_temp.nonempty as text check (value <> ''); +-- function-syntax invocation of types matches rules for functions +select nonempty(''); +select pg_temp.nonempty(''); +-- other syntax matches rules for tables +select ''::nonempty; + +reset search_path; + +-- For partitioned temp tables, ON COMMIT actions ignore storage-less +-- partitioned tables. +begin; +create temp table temp_parted_oncommit (a int) + partition by list (a) on commit delete rows; +create temp table temp_parted_oncommit_1 + partition of temp_parted_oncommit + for values in (1) on commit delete rows; +insert into temp_parted_oncommit values (1); +commit; +-- partitions are emptied by the previous commit +select * from temp_parted_oncommit; +drop table temp_parted_oncommit; + +-- Check dependencies between ON COMMIT actions with a partitioned +-- table and its partitions. Using ON COMMIT DROP on a parent removes +-- the whole set. +begin; +create temp table temp_parted_oncommit_test (a int) + partition by list (a) on commit drop; +create temp table temp_parted_oncommit_test1 + partition of temp_parted_oncommit_test + for values in (1) on commit delete rows; +create temp table temp_parted_oncommit_test2 + partition of temp_parted_oncommit_test + for values in (2) on commit drop; +insert into temp_parted_oncommit_test values (1), (2); +commit; +-- no relations remain in this case. +select relname from pg_class where relname ~ '^temp_parted_oncommit_test'; +-- Using ON COMMIT DELETE on a partitioned table does not remove +-- all rows if partitions preserve their data. +begin; +create temp table temp_parted_oncommit_test (a int) + partition by list (a) on commit delete rows; +create temp table temp_parted_oncommit_test1 + partition of temp_parted_oncommit_test + for values in (1) on commit preserve rows; +create temp table temp_parted_oncommit_test2 + partition of temp_parted_oncommit_test + for values in (2) on commit drop; +insert into temp_parted_oncommit_test values (1), (2); +commit; +-- Data from the remaining partition is still here as its rows are +-- preserved. +select * from temp_parted_oncommit_test; +-- two relations remain in this case. +select relname from pg_class where relname ~ '^temp_parted_oncommit_test' + order by relname; +drop table temp_parted_oncommit_test; + +-- Check dependencies between ON COMMIT actions with inheritance trees. +-- Using ON COMMIT DROP on a parent removes the whole set. +begin; +create temp table temp_inh_oncommit_test (a int) on commit drop; +create temp table temp_inh_oncommit_test1 () + inherits(temp_inh_oncommit_test) on commit delete rows; +insert into temp_inh_oncommit_test1 values (1); +commit; +-- no relations remain in this case +select relname from pg_class where relname ~ '^temp_inh_oncommit_test'; +-- Data on the parent is removed, and the child goes away. +begin; +create temp table temp_inh_oncommit_test (a int) on commit delete rows; +create temp table temp_inh_oncommit_test1 () + inherits(temp_inh_oncommit_test) on commit drop; +insert into temp_inh_oncommit_test1 values (1); +insert into temp_inh_oncommit_test values (1); +commit; +select * from temp_inh_oncommit_test; +-- one relation remains +select relname from pg_class where relname ~ '^temp_inh_oncommit_test'; +drop table temp_inh_oncommit_test; + +-- Tests with two-phase commit +-- Transactions creating objects in a temporary namespace cannot be used +-- with two-phase commit. + +-- These cases generate errors about temporary namespace. +-- Function creation +begin; +create function pg_temp.twophase_func() returns void as + $$ select '2pc_func'::text $$ language sql; +prepare transaction 'twophase_func'; +-- Function drop +create function pg_temp.twophase_func() returns void as + $$ select '2pc_func'::text $$ language sql; +begin; +drop function pg_temp.twophase_func(); +prepare transaction 'twophase_func'; +-- Operator creation +begin; +create operator pg_temp.@@ (leftarg = int4, rightarg = int4, procedure = int4mi); +prepare transaction 'twophase_operator'; + +-- These generate errors about temporary tables. +begin; +create type pg_temp.twophase_type as (a int); +prepare transaction 'twophase_type'; +begin; +create view pg_temp.twophase_view as select 1; +prepare transaction 'twophase_view'; +begin; +create sequence pg_temp.twophase_seq; +prepare transaction 'twophase_sequence'; + +-- Temporary tables cannot be used with two-phase commit. +create temp table twophase_tab (a int); +begin; +select a from twophase_tab; +prepare transaction 'twophase_tab'; +begin; +insert into twophase_tab values (1); +prepare transaction 'twophase_tab'; +begin; +lock twophase_tab in access exclusive mode; +prepare transaction 'twophase_tab'; +begin; +drop table twophase_tab; +prepare transaction 'twophase_tab'; + +-- Corner case: current_schema may create a temporary schema if namespace +-- creation is pending, so check after that. First reset the connection +-- to remove the temporary namespace. +\c - +SET search_path TO 'pg_temp'; +BEGIN; +SELECT current_schema() ~ 'pg_temp' AS is_temp_schema; +PREPARE TRANSACTION 'twophase_search'; diff --git a/postgresql/examples/test.sql b/postgresql/examples/test.sql new file mode 100644 index 0000000..516b285 --- /dev/null +++ b/postgresql/examples/test.sql @@ -0,0 +1 @@ +create table t(a int); -- this is comment \ No newline at end of file diff --git a/postgresql/examples/text.sql b/postgresql/examples/text.sql new file mode 100644 index 0000000..60c15b5 --- /dev/null +++ b/postgresql/examples/text.sql @@ -0,0 +1,118 @@ +-- +-- TEXT +-- + +SELECT text 'this is a text string' = text 'this is a text string' AS true; + +SELECT text 'this is a text string' = text 'this is a text strin' AS false; + +CREATE TABLE TEXT_TBL (f1 text); + +INSERT INTO TEXT_TBL VALUES ('doh!'); +INSERT INTO TEXT_TBL VALUES ('hi de ho neighbor'); + +SELECT '' AS two, * FROM TEXT_TBL; + +-- As of 8.3 we have removed most implicit casts to text, so that for example +-- this no longer works: + +select length(42); + +-- But as a special exception for usability's sake, we still allow implicit +-- casting to text in concatenations, so long as the other input is text or +-- an unknown literal. So these work: + +select 'four: '::text || 2+2; +select 'four: ' || 2+2; + +-- but not this: + +select 3 || 4.0; + +/* + * various string functions + */ +select concat('one'); +select concat(1,2,3,'hello',true, false, to_date('20100309','YYYYMMDD')); +select concat_ws('#','one'); +select concat_ws('#',1,2,3,'hello',true, false, to_date('20100309','YYYYMMDD')); +select concat_ws(',',10,20,null,30); +select concat_ws('',10,20,null,30); +select concat_ws(NULL,10,20,null,30) is null; +select reverse('abcde'); +select i, left('ahoj', i), right('ahoj', i) from generate_series(-5, 5) t(i) order by i; +select quote_literal(''); +select quote_literal('abc'''); +select quote_literal(e'\\'); +-- check variadic labeled argument +select concat(variadic array[1,2,3]); +select concat_ws(',', variadic array[1,2,3]); +select concat_ws(',', variadic NULL::int[]); +select concat(variadic NULL::int[]) is NULL; +select concat(variadic '{}'::int[]) = ''; +--should fail +select concat_ws(',', variadic 10); + +/* + * format + */ +select format(NULL); +select format('Hello'); +select format('Hello %s', 'World'); +select format('Hello %%'); +select format('Hello %%%%'); +-- should fail +select format('Hello %s %s', 'World'); +select format('Hello %s'); +select format('Hello %x', 20); +-- check literal and sql identifiers +select format('INSERT INTO %I VALUES(%L,%L)', 'mytab', 10, 'Hello'); +select format('%s%s%s','Hello', NULL,'World'); +select format('INSERT INTO %I VALUES(%L,%L)', 'mytab', 10, NULL); +select format('INSERT INTO %I VALUES(%L,%L)', 'mytab', NULL, 'Hello'); +-- should fail, sql identifier cannot be NULL +select format('INSERT INTO %I VALUES(%L,%L)', NULL, 10, 'Hello'); +-- check positional placeholders +select format('%1$s %3$s', 1, 2, 3); +select format('%1$s %12$s', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); +-- should fail +select format('%1$s %4$s', 1, 2, 3); +select format('%1$s %13$s', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); +select format('%0$s', 'Hello'); +select format('%*0$s', 'Hello'); +select format('%1$', 1); +select format('%1$1', 1); +-- check mix of positional and ordered placeholders +select format('Hello %s %1$s %s', 'World', 'Hello again'); +select format('Hello %s %s, %2$s %2$s', 'World', 'Hello again'); +-- check variadic labeled arguments +select format('%s, %s', variadic array['Hello','World']); +select format('%s, %s', variadic array[1, 2]); +select format('%s, %s', variadic array[true, false]); +select format('%s, %s', variadic array[true, false]::text[]); +-- check variadic with positional placeholders +select format('%2$s, %1$s', variadic array['first', 'second']); +select format('%2$s, %1$s', variadic array[1, 2]); +-- variadic argument can be array type NULL, but should not be referenced +select format('Hello', variadic NULL::int[]); +-- variadic argument allows simulating more than FUNC_MAX_ARGS parameters +select format(string_agg('%s',','), variadic array_agg(i)) +from generate_series(1,200) g(i); +-- check field widths and left, right alignment +select format('>>%10s<<', 'Hello'); +select format('>>%10s<<', NULL); +select format('>>%10s<<', ''); +select format('>>%-10s<<', ''); +select format('>>%-10s<<', 'Hello'); +select format('>>%-10s<<', NULL); +select format('>>%1$10s<<', 'Hello'); +select format('>>%1$-10I<<', 'Hello'); +select format('>>%2$*1$L<<', 10, 'Hello'); +select format('>>%2$*1$L<<', 10, NULL); +select format('>>%2$*1$L<<', -10, NULL); +select format('>>%*s<<', 10, 'Hello'); +select format('>>%*1$s<<', 10, 'Hello'); +select format('>>%-s<<', 'Hello'); +select format('>>%10L<<', NULL); +select format('>>%2$*1$L<<', NULL, 'Hello'); +select format('>>%2$*1$L<<', 0, 'Hello'); diff --git a/postgresql/examples/tid.sql b/postgresql/examples/tid.sql new file mode 100644 index 0000000..c0d02df --- /dev/null +++ b/postgresql/examples/tid.sql @@ -0,0 +1,63 @@ +-- tests for functions related to TID handling + +CREATE TABLE tid_tab (a int); + +-- min() and max() for TIDs +INSERT INTO tid_tab VALUES (1), (2); +SELECT min(ctid) FROM tid_tab; +SELECT max(ctid) FROM tid_tab; +TRUNCATE tid_tab; + +-- Tests for currtid() and currtid2() with various relation kinds + +-- Materialized view +CREATE MATERIALIZED VIEW tid_matview AS SELECT a FROM tid_tab; +SELECT currtid('tid_matview'::regclass::oid, '(0,1)'::tid); -- fails +SELECT currtid2('tid_matview'::text, '(0,1)'::tid); -- fails +INSERT INTO tid_tab VALUES (1); +REFRESH MATERIALIZED VIEW tid_matview; +SELECT currtid('tid_matview'::regclass::oid, '(0,1)'::tid); -- ok +SELECT currtid2('tid_matview'::text, '(0,1)'::tid); -- ok +DROP MATERIALIZED VIEW tid_matview; +TRUNCATE tid_tab; + +-- Sequence +CREATE SEQUENCE tid_seq; +SELECT currtid('tid_seq'::regclass::oid, '(0,1)'::tid); -- ok +SELECT currtid2('tid_seq'::text, '(0,1)'::tid); -- ok +DROP SEQUENCE tid_seq; + +-- Index, fails with incorrect relation type +CREATE INDEX tid_ind ON tid_tab(a); +SELECT currtid('tid_ind'::regclass::oid, '(0,1)'::tid); -- fails +SELECT currtid2('tid_ind'::text, '(0,1)'::tid); -- fails +DROP INDEX tid_ind; + +-- Partitioned table, no storage +CREATE TABLE tid_part (a int) PARTITION BY RANGE (a); +SELECT currtid('tid_part'::regclass::oid, '(0,1)'::tid); -- fails +SELECT currtid2('tid_part'::text, '(0,1)'::tid); -- fails +DROP TABLE tid_part; + +-- Views +-- ctid not defined in the view +CREATE VIEW tid_view_no_ctid AS SELECT a FROM tid_tab; +SELECT currtid('tid_view_no_ctid'::regclass::oid, '(0,1)'::tid); -- fails +SELECT currtid2('tid_view_no_ctid'::text, '(0,1)'::tid); -- fails +DROP VIEW tid_view_no_ctid; +-- ctid fetched directly from the source table. +CREATE VIEW tid_view_with_ctid AS SELECT ctid, a FROM tid_tab; +SELECT currtid('tid_view_with_ctid'::regclass::oid, '(0,1)'::tid); -- fails +SELECT currtid2('tid_view_with_ctid'::text, '(0,1)'::tid); -- fails +INSERT INTO tid_tab VALUES (1); +SELECT currtid('tid_view_with_ctid'::regclass::oid, '(0,1)'::tid); -- ok +SELECT currtid2('tid_view_with_ctid'::text, '(0,1)'::tid); -- ok +DROP VIEW tid_view_with_ctid; +TRUNCATE tid_tab; +-- ctid attribute with incorrect data type +CREATE VIEW tid_view_fake_ctid AS SELECT 1 AS ctid, 2 AS a; +SELECT currtid('tid_view_fake_ctid'::regclass::oid, '(0,1)'::tid); -- fails +SELECT currtid2('tid_view_fake_ctid'::text, '(0,1)'::tid); -- fails +DROP VIEW tid_view_fake_ctid; + +DROP TABLE tid_tab CASCADE; diff --git a/postgresql/examples/tidscan.sql b/postgresql/examples/tidscan.sql new file mode 100644 index 0000000..313e0fb --- /dev/null +++ b/postgresql/examples/tidscan.sql @@ -0,0 +1,104 @@ +-- tests for tidscans + +CREATE TABLE tidscan(id integer); + +-- only insert a few rows, we don't want to spill onto a second table page +INSERT INTO tidscan VALUES (1), (2), (3); + +-- show ctids +SELECT ctid, * FROM tidscan; + +-- ctid equality - implemented as tidscan +EXPLAIN (COSTS OFF) +SELECT ctid, * FROM tidscan WHERE ctid = '(0,1)'; +SELECT ctid, * FROM tidscan WHERE ctid = '(0,1)'; + +EXPLAIN (COSTS OFF) +SELECT ctid, * FROM tidscan WHERE '(0,1)' = ctid; +SELECT ctid, * FROM tidscan WHERE '(0,1)' = ctid; + +-- OR'd clauses +EXPLAIN (COSTS OFF) +SELECT ctid, * FROM tidscan WHERE ctid = '(0,2)' OR '(0,1)' = ctid; +SELECT ctid, * FROM tidscan WHERE ctid = '(0,2)' OR '(0,1)' = ctid; + +-- ctid = ScalarArrayOp - implemented as tidscan +EXPLAIN (COSTS OFF) +SELECT ctid, * FROM tidscan WHERE ctid = ANY(ARRAY['(0,1)', '(0,2)']::tid[]); +SELECT ctid, * FROM tidscan WHERE ctid = ANY(ARRAY['(0,1)', '(0,2)']::tid[]); + +-- ctid != ScalarArrayOp - can't be implemented as tidscan +EXPLAIN (COSTS OFF) +SELECT ctid, * FROM tidscan WHERE ctid != ANY(ARRAY['(0,1)', '(0,2)']::tid[]); +SELECT ctid, * FROM tidscan WHERE ctid != ANY(ARRAY['(0,1)', '(0,2)']::tid[]); + +-- tid equality extracted from sub-AND clauses +EXPLAIN (COSTS OFF) +SELECT ctid, * FROM tidscan +WHERE (id = 3 AND ctid IN ('(0,2)', '(0,3)')) OR (ctid = '(0,1)' AND id = 1); +SELECT ctid, * FROM tidscan +WHERE (id = 3 AND ctid IN ('(0,2)', '(0,3)')) OR (ctid = '(0,1)' AND id = 1); + +-- nestloop-with-inner-tidscan joins on tid +SET enable_hashjoin TO off; -- otherwise hash join might win +EXPLAIN (COSTS OFF) +SELECT t1.ctid, t1.*, t2.ctid, t2.* +FROM tidscan t1 JOIN tidscan t2 ON t1.ctid = t2.ctid WHERE t1.id = 1; +SELECT t1.ctid, t1.*, t2.ctid, t2.* +FROM tidscan t1 JOIN tidscan t2 ON t1.ctid = t2.ctid WHERE t1.id = 1; +EXPLAIN (COSTS OFF) +SELECT t1.ctid, t1.*, t2.ctid, t2.* +FROM tidscan t1 LEFT JOIN tidscan t2 ON t1.ctid = t2.ctid WHERE t1.id = 1; +SELECT t1.ctid, t1.*, t2.ctid, t2.* +FROM tidscan t1 LEFT JOIN tidscan t2 ON t1.ctid = t2.ctid WHERE t1.id = 1; +RESET enable_hashjoin; + +-- exercise backward scan and rewind +BEGIN; +DECLARE c CURSOR FOR +SELECT ctid, * FROM tidscan WHERE ctid = ANY(ARRAY['(0,1)', '(0,2)']::tid[]); +FETCH ALL FROM c; +FETCH BACKWARD 1 FROM c; +FETCH FIRST FROM c; +ROLLBACK; + +-- tidscan via CURRENT OF +BEGIN; +DECLARE c CURSOR FOR SELECT ctid, * FROM tidscan; +FETCH NEXT FROM c; -- skip one row +FETCH NEXT FROM c; +-- perform update +EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) +UPDATE tidscan SET id = -id WHERE CURRENT OF c RETURNING *; +FETCH NEXT FROM c; +-- perform update +EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) +UPDATE tidscan SET id = -id WHERE CURRENT OF c RETURNING *; +SELECT * FROM tidscan; +-- position cursor past any rows +FETCH NEXT FROM c; +-- should error out +EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) +UPDATE tidscan SET id = -id WHERE CURRENT OF c RETURNING *; +ROLLBACK; + +-- bulk joins on CTID +-- (these plans don't use TID scans, but this still seems like an +-- appropriate place for these tests) +EXPLAIN (COSTS OFF) +SELECT count(*) FROM tenk1 t1 JOIN tenk1 t2 ON t1.ctid = t2.ctid; +SELECT count(*) FROM tenk1 t1 JOIN tenk1 t2 ON t1.ctid = t2.ctid; +SET enable_hashjoin TO off; +EXPLAIN (COSTS OFF) +SELECT count(*) FROM tenk1 t1 JOIN tenk1 t2 ON t1.ctid = t2.ctid; +SELECT count(*) FROM tenk1 t1 JOIN tenk1 t2 ON t1.ctid = t2.ctid; +RESET enable_hashjoin; + +-- check predicate lock on CTID +BEGIN ISOLATION LEVEL SERIALIZABLE; +SELECT * FROM tidscan WHERE ctid = '(0,1)'; +-- locktype should be 'tuple' +SELECT locktype, mode FROM pg_locks WHERE pid = pg_backend_pid() AND mode = 'SIReadLock'; +ROLLBACK; + +DROP TABLE tidscan; diff --git a/postgresql/examples/time.sql b/postgresql/examples/time.sql new file mode 100644 index 0000000..688bd6b --- /dev/null +++ b/postgresql/examples/time.sql @@ -0,0 +1,65 @@ +-- +-- TIME +-- + +CREATE TABLE TIME_TBL (f1 time(2)); + +INSERT INTO TIME_TBL VALUES ('00:00'); +INSERT INTO TIME_TBL VALUES ('01:00'); +-- as of 7.4, timezone spec should be accepted and ignored +INSERT INTO TIME_TBL VALUES ('02:03 PST'); +INSERT INTO TIME_TBL VALUES ('11:59 EDT'); +INSERT INTO TIME_TBL VALUES ('12:00'); +INSERT INTO TIME_TBL VALUES ('12:01'); +INSERT INTO TIME_TBL VALUES ('23:59'); +INSERT INTO TIME_TBL VALUES ('11:59:59.99 PM'); + +INSERT INTO TIME_TBL VALUES ('2003-03-07 15:36:39 America/New_York'); +INSERT INTO TIME_TBL VALUES ('2003-07-07 15:36:39 America/New_York'); +-- this should fail (the timezone offset is not known) +INSERT INTO TIME_TBL VALUES ('15:36:39 America/New_York'); + + +SELECT f1 AS "Time" FROM TIME_TBL; + +SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07'; + +SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07'; + +SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00'; + +SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00'; + +-- Check edge cases +SELECT '23:59:59.999999'::time; +SELECT '23:59:59.9999999'::time; -- rounds up +SELECT '23:59:60'::time; -- rounds up +SELECT '24:00:00'::time; -- allowed +SELECT '24:00:00.01'::time; -- not allowed +SELECT '23:59:60.01'::time; -- not allowed +SELECT '24:01:00'::time; -- not allowed +SELECT '25:00:00'::time; -- not allowed + +-- +-- TIME simple math +-- +-- We now make a distinction between time and intervals, +-- and adding two times together makes no sense at all. +-- Leave in one query to show that it is rejected, +-- and do the rest of the testing in horology.sql +-- where we do mixed-type arithmetic. - thomas 2000-12-02 + +SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL; + +-- +-- test EXTRACT +-- +SELECT EXTRACT(MICROSECOND FROM TIME '2020-05-26 13:30:25.575401'); +SELECT EXTRACT(MILLISECOND FROM TIME '2020-05-26 13:30:25.575401'); +SELECT EXTRACT(SECOND FROM TIME '2020-05-26 13:30:25.575401'); +SELECT EXTRACT(MINUTE FROM TIME '2020-05-26 13:30:25.575401'); +SELECT EXTRACT(HOUR FROM TIME '2020-05-26 13:30:25.575401'); +SELECT EXTRACT(DAY FROM TIME '2020-05-26 13:30:25.575401'); -- error +SELECT EXTRACT(FORTNIGHT FROM TIME '2020-05-26 13:30:25.575401'); -- error +SELECT EXTRACT(TIMEZONE FROM TIME '2020-05-26 13:30:25.575401'); -- error +SELECT EXTRACT(EPOCH FROM TIME '2020-05-26 13:30:25.575401'); diff --git a/postgresql/examples/timestamp.sql b/postgresql/examples/timestamp.sql new file mode 100644 index 0000000..7b58c3c --- /dev/null +++ b/postgresql/examples/timestamp.sql @@ -0,0 +1,243 @@ +-- +-- TIMESTAMP +-- + +CREATE TABLE TIMESTAMP_TBL (d1 timestamp(2) without time zone); + +-- Test shorthand input values +-- We can't just "select" the results since they aren't constants; test for +-- equality instead. We can do that by running the test inside a transaction +-- block, within which the value of 'now' shouldn't change, and so these +-- related values shouldn't either. + +BEGIN; + +INSERT INTO TIMESTAMP_TBL VALUES ('today'); +INSERT INTO TIMESTAMP_TBL VALUES ('yesterday'); +INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow'); +-- time zone should be ignored by this data type +INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow EST'); +INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow zulu'); + +SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'today'; +SELECT count(*) AS Three FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'tomorrow'; +SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'yesterday'; + +COMMIT; + +DELETE FROM TIMESTAMP_TBL; + +-- Verify that 'now' *does* change over a reasonable interval such as 100 msec, +-- and that it doesn't change over the same interval within a transaction block + +INSERT INTO TIMESTAMP_TBL VALUES ('now'); +SELECT pg_sleep(0.1); + +BEGIN; +INSERT INTO TIMESTAMP_TBL VALUES ('now'); +SELECT pg_sleep(0.1); +INSERT INTO TIMESTAMP_TBL VALUES ('now'); +SELECT pg_sleep(0.1); +SELECT count(*) AS two FROM TIMESTAMP_TBL WHERE d1 = timestamp(2) without time zone 'now'; +SELECT count(d1) AS three, count(DISTINCT d1) AS two FROM TIMESTAMP_TBL; +COMMIT; + +TRUNCATE TIMESTAMP_TBL; + +-- Special values +INSERT INTO TIMESTAMP_TBL VALUES ('-infinity'); +INSERT INTO TIMESTAMP_TBL VALUES ('infinity'); +INSERT INTO TIMESTAMP_TBL VALUES ('epoch'); + +-- Postgres v6.0 standard output format +INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST'); + +-- Variations on Postgres v6.1 standard output format +INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01.000001 1997 PST'); +INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01.999999 1997 PST'); +INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01.4 1997 PST'); +INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01.5 1997 PST'); +INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01.6 1997 PST'); + +-- ISO 8601 format +INSERT INTO TIMESTAMP_TBL VALUES ('1997-01-02'); +INSERT INTO TIMESTAMP_TBL VALUES ('1997-01-02 03:04:05'); +INSERT INTO TIMESTAMP_TBL VALUES ('1997-02-10 17:32:01-08'); +INSERT INTO TIMESTAMP_TBL VALUES ('1997-02-10 17:32:01-0800'); +INSERT INTO TIMESTAMP_TBL VALUES ('1997-02-10 17:32:01 -08:00'); +INSERT INTO TIMESTAMP_TBL VALUES ('19970210 173201 -0800'); +INSERT INTO TIMESTAMP_TBL VALUES ('1997-06-10 17:32:01 -07:00'); +INSERT INTO TIMESTAMP_TBL VALUES ('2001-09-22T18:19:20'); + +-- POSIX format (note that the timezone abbrev is just decoration here) +INSERT INTO TIMESTAMP_TBL VALUES ('2000-03-15 08:14:01 GMT+8'); +INSERT INTO TIMESTAMP_TBL VALUES ('2000-03-15 13:14:02 GMT-1'); +INSERT INTO TIMESTAMP_TBL VALUES ('2000-03-15 12:14:03 GMT-2'); +INSERT INTO TIMESTAMP_TBL VALUES ('2000-03-15 03:14:04 PST+8'); +INSERT INTO TIMESTAMP_TBL VALUES ('2000-03-15 02:14:05 MST+7:00'); + +-- Variations for acceptable input formats +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 10 17:32:01 1997 -0800'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 10 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 10 5:32PM 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('1997/02/10 17:32:01-0800'); +INSERT INTO TIMESTAMP_TBL VALUES ('1997-02-10 17:32:01 PST'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb-10-1997 17:32:01 PST'); +INSERT INTO TIMESTAMP_TBL VALUES ('02-10-1997 17:32:01 PST'); +INSERT INTO TIMESTAMP_TBL VALUES ('19970210 173201 PST'); +set datestyle to ymd; +INSERT INTO TIMESTAMP_TBL VALUES ('97FEB10 5:32:01PM UTC'); +INSERT INTO TIMESTAMP_TBL VALUES ('97/02/10 17:32:01 UTC'); +reset datestyle; +INSERT INTO TIMESTAMP_TBL VALUES ('1997.041 17:32:01 UTC'); +INSERT INTO TIMESTAMP_TBL VALUES ('19970210 173201 America/New_York'); +-- this fails (even though TZ is a no-op, we still look it up) +INSERT INTO TIMESTAMP_TBL VALUES ('19970710 173201 America/Does_not_exist'); + +-- Check date conversion and date arithmetic +INSERT INTO TIMESTAMP_TBL VALUES ('1997-06-10 18:32:01 PDT'); + +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 10 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 11 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 12 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 13 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 14 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 15 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 1997'); + +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 0097 BC'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 0097'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 0597'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 1097'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 1697'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 1797'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 1897'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 2097'); + +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 28 17:32:01 1996'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 29 17:32:01 1996'); +INSERT INTO TIMESTAMP_TBL VALUES ('Mar 01 17:32:01 1996'); +INSERT INTO TIMESTAMP_TBL VALUES ('Dec 30 17:32:01 1996'); +INSERT INTO TIMESTAMP_TBL VALUES ('Dec 31 17:32:01 1996'); +INSERT INTO TIMESTAMP_TBL VALUES ('Jan 01 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 28 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 29 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Mar 01 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Dec 30 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Dec 31 17:32:01 1997'); +INSERT INTO TIMESTAMP_TBL VALUES ('Dec 31 17:32:01 1999'); +INSERT INTO TIMESTAMP_TBL VALUES ('Jan 01 17:32:01 2000'); +INSERT INTO TIMESTAMP_TBL VALUES ('Dec 31 17:32:01 2000'); +INSERT INTO TIMESTAMP_TBL VALUES ('Jan 01 17:32:01 2001'); + +-- Currently unsupported syntax and ranges +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 -0097'); +INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 5097 BC'); + +SELECT '' AS "64", d1 FROM TIMESTAMP_TBL; + +-- Check behavior at the lower boundary of the timestamp range +SELECT '4714-11-24 00:00:00 BC'::timestamp; +SELECT '4714-11-23 23:59:59 BC'::timestamp; -- out of range +-- The upper boundary differs between integer and float timestamps, so no check + +-- Demonstrate functions and operators +SELECT '' AS "48", d1 FROM TIMESTAMP_TBL + WHERE d1 > timestamp without time zone '1997-01-02'; + +SELECT '' AS "15", d1 FROM TIMESTAMP_TBL + WHERE d1 < timestamp without time zone '1997-01-02'; + +SELECT '' AS one, d1 FROM TIMESTAMP_TBL + WHERE d1 = timestamp without time zone '1997-01-02'; + +SELECT '' AS "63", d1 FROM TIMESTAMP_TBL + WHERE d1 != timestamp without time zone '1997-01-02'; + +SELECT '' AS "16", d1 FROM TIMESTAMP_TBL + WHERE d1 <= timestamp without time zone '1997-01-02'; + +SELECT '' AS "49", d1 FROM TIMESTAMP_TBL + WHERE d1 >= timestamp without time zone '1997-01-02'; + +SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff + FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + +SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp '2004-02-29 15:44:17.71393' ) AS week_trunc; + +-- Test casting within a BETWEEN qualifier +SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff + FROM TIMESTAMP_TBL + WHERE d1 BETWEEN timestamp without time zone '1902-01-01' + AND timestamp without time zone '2038-01-01'; + +-- DATE_PART (timestamp_part) +SELECT d1 as "timestamp", + date_part( 'year', d1) AS year, date_part( 'month', d1) AS month, + date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour, + date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second + FROM TIMESTAMP_TBL; + +SELECT d1 as "timestamp", + date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec, + date_part( 'usec', d1) AS usec + FROM TIMESTAMP_TBL; + +SELECT d1 as "timestamp", + date_part( 'isoyear', d1) AS isoyear, date_part( 'week', d1) AS week, + date_part( 'isodow', d1) AS isodow, date_part( 'dow', d1) AS dow, + date_part( 'doy', d1) AS doy + FROM TIMESTAMP_TBL; + +SELECT d1 as "timestamp", + date_part( 'decade', d1) AS decade, + date_part( 'century', d1) AS century, + date_part( 'millennium', d1) AS millennium, + round(date_part( 'julian', d1)) AS julian + FROM TIMESTAMP_TBL; + +-- TO_CHAR() +SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth FMRM') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM FMWW FMDDD FMDD FMD FMJ') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between quote marks\\""') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_9, to_char(d1, 'YYYY A.D. YYYY a.d. YYYY bc HH:MI:SS P.M. HH:MI:SS p.m. HH:MI:SS pm') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') + FROM TIMESTAMP_TBL; + +SELECT '' AS to_char_12, to_char(d, 'FF1 FF2 FF3 FF4 FF5 FF6 ff1 ff2 ff3 ff4 ff5 ff6 MS US') + FROM (VALUES + ('2018-11-02 12:34:56'::timestamp), + ('2018-11-02 12:34:56.78'), + ('2018-11-02 12:34:56.78901'), + ('2018-11-02 12:34:56.78901234') + ) d(d); + +-- timestamp numeric fields constructor +SELECT make_timestamp(2014,12,28,6,30,45.887); diff --git a/postgresql/examples/timestamptz.sql b/postgresql/examples/timestamptz.sql new file mode 100644 index 0000000..300302d --- /dev/null +++ b/postgresql/examples/timestamptz.sql @@ -0,0 +1,485 @@ +-- +-- TIMESTAMPTZ +-- + +CREATE TABLE TIMESTAMPTZ_TBL (d1 timestamp(2) with time zone); + +-- Test shorthand input values +-- We can't just "select" the results since they aren't constants; test for +-- equality instead. We can do that by running the test inside a transaction +-- block, within which the value of 'now' shouldn't change, and so these +-- related values shouldn't either. + +BEGIN; + +INSERT INTO TIMESTAMPTZ_TBL VALUES ('today'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('yesterday'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('tomorrow'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('tomorrow EST'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('tomorrow zulu'); + +SELECT count(*) AS One FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp with time zone 'today'; +SELECT count(*) AS One FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp with time zone 'tomorrow'; +SELECT count(*) AS One FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp with time zone 'yesterday'; +SELECT count(*) AS One FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp with time zone 'tomorrow EST'; +SELECT count(*) AS One FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp with time zone 'tomorrow zulu'; + +COMMIT; + +DELETE FROM TIMESTAMPTZ_TBL; + +-- Verify that 'now' *does* change over a reasonable interval such as 100 msec, +-- and that it doesn't change over the same interval within a transaction block + +INSERT INTO TIMESTAMPTZ_TBL VALUES ('now'); +SELECT pg_sleep(0.1); + +BEGIN; +INSERT INTO TIMESTAMPTZ_TBL VALUES ('now'); +SELECT pg_sleep(0.1); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('now'); +SELECT pg_sleep(0.1); +SELECT count(*) AS two FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp(2) with time zone 'now'; +SELECT count(d1) AS three, count(DISTINCT d1) AS two FROM TIMESTAMPTZ_TBL; +COMMIT; + +TRUNCATE TIMESTAMPTZ_TBL; + +-- Special values +INSERT INTO TIMESTAMPTZ_TBL VALUES ('-infinity'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('infinity'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('epoch'); + +-- Postgres v6.0 standard output format +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST'); + +-- Variations on Postgres v6.1 standard output format +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01.000001 1997 PST'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01.999999 1997 PST'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01.4 1997 PST'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01.5 1997 PST'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01.6 1997 PST'); + +-- ISO 8601 format +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-01-02'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-01-02 03:04:05'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-02-10 17:32:01-08'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-02-10 17:32:01-0800'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-02-10 17:32:01 -08:00'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970210 173201 -0800'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 17:32:01 -07:00'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('2001-09-22T18:19:20'); + +-- POSIX format (note that the timezone abbrev is just decoration here) +INSERT INTO TIMESTAMPTZ_TBL VALUES ('2000-03-15 08:14:01 GMT+8'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('2000-03-15 13:14:02 GMT-1'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('2000-03-15 12:14:03 GMT-2'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('2000-03-15 03:14:04 PST+8'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('2000-03-15 02:14:05 MST+7:00'); + +-- Variations for acceptable input formats +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 10 17:32:01 1997 -0800'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 10 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 10 5:32PM 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997/02/10 17:32:01-0800'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-02-10 17:32:01 PST'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb-10-1997 17:32:01 PST'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('02-10-1997 17:32:01 PST'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970210 173201 PST'); +set datestyle to ymd; +INSERT INTO TIMESTAMPTZ_TBL VALUES ('97FEB10 5:32:01PM UTC'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('97/02/10 17:32:01 UTC'); +reset datestyle; +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997.041 17:32:01 UTC'); + +-- timestamps at different timezones +INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970210 173201 America/New_York'); +SELECT '19970210 173201' AT TIME ZONE 'America/New_York'; +INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970710 173201 America/New_York'); +SELECT '19970710 173201' AT TIME ZONE 'America/New_York'; +INSERT INTO TIMESTAMPTZ_TBL VALUES ('19970710 173201 America/Does_not_exist'); +SELECT '19970710 173201' AT TIME ZONE 'America/Does_not_exist'; + +-- Daylight saving time for timestamps beyond 32-bit time_t range. +SELECT '20500710 173201 Europe/Helsinki'::timestamptz; -- DST +SELECT '20500110 173201 Europe/Helsinki'::timestamptz; -- non-DST + +SELECT '205000-07-10 17:32:01 Europe/Helsinki'::timestamptz; -- DST +SELECT '205000-01-10 17:32:01 Europe/Helsinki'::timestamptz; -- non-DST + +-- Check date conversion and date arithmetic +INSERT INTO TIMESTAMPTZ_TBL VALUES ('1997-06-10 18:32:01 PDT'); + +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 10 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 11 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 12 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 13 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 14 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 15 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 1997'); + +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 0097 BC'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 0097'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 0597'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 1097'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 1697'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 1797'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 1897'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 2097'); + +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 28 17:32:01 1996'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 29 17:32:01 1996'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mar 01 17:32:01 1996'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Dec 30 17:32:01 1996'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Dec 31 17:32:01 1996'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Jan 01 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 28 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 29 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mar 01 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Dec 30 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Dec 31 17:32:01 1997'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Dec 31 17:32:01 1999'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Jan 01 17:32:01 2000'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Dec 31 17:32:01 2000'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Jan 01 17:32:01 2001'); + +-- Currently unsupported syntax and ranges +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 -0097'); +INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 5097 BC'); + +-- Alternative field order that we've historically supported (sort of) +-- with regular and POSIXy timezone specs +SELECT 'Wed Jul 11 10:51:14 America/New_York 2001'::timestamptz; +SELECT 'Wed Jul 11 10:51:14 GMT-4 2001'::timestamptz; +SELECT 'Wed Jul 11 10:51:14 GMT+4 2001'::timestamptz; +SELECT 'Wed Jul 11 10:51:14 PST-03:00 2001'::timestamptz; +SELECT 'Wed Jul 11 10:51:14 PST+03:00 2001'::timestamptz; + +SELECT '' AS "64", d1 FROM TIMESTAMPTZ_TBL; + +-- Check behavior at the lower boundary of the timestamp range +SELECT '4714-11-24 00:00:00+00 BC'::timestamptz; +SELECT '4714-11-23 16:00:00-08 BC'::timestamptz; +SELECT 'Sun Nov 23 16:00:00 4714 PST BC'::timestamptz; +SELECT '4714-11-23 23:59:59+00 BC'::timestamptz; -- out of range +-- The upper boundary differs between integer and float timestamps, so no check + +-- Demonstrate functions and operators +SELECT '' AS "48", d1 FROM TIMESTAMPTZ_TBL + WHERE d1 > timestamp with time zone '1997-01-02'; + +SELECT '' AS "15", d1 FROM TIMESTAMPTZ_TBL + WHERE d1 < timestamp with time zone '1997-01-02'; + +SELECT '' AS one, d1 FROM TIMESTAMPTZ_TBL + WHERE d1 = timestamp with time zone '1997-01-02'; + +SELECT '' AS "63", d1 FROM TIMESTAMPTZ_TBL + WHERE d1 != timestamp with time zone '1997-01-02'; + +SELECT '' AS "16", d1 FROM TIMESTAMPTZ_TBL + WHERE d1 <= timestamp with time zone '1997-01-02'; + +SELECT '' AS "49", d1 FROM TIMESTAMPTZ_TBL + WHERE d1 >= timestamp with time zone '1997-01-02'; + +SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff + FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01'; + +SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp with time zone '2004-02-29 15:44:17.71393' ) AS week_trunc; + +SELECT '' AS date_trunc_at_tz, date_trunc('day', timestamp with time zone '2001-02-16 20:38:40+00', 'Australia/Sydney') as sydney_trunc; -- zone name +SELECT '' AS date_trunc_at_tz, date_trunc('day', timestamp with time zone '2001-02-16 20:38:40+00', 'GMT') as gmt_trunc; -- fixed-offset abbreviation +SELECT '' AS date_trunc_at_tz, date_trunc('day', timestamp with time zone '2001-02-16 20:38:40+00', 'VET') as vet_trunc; -- variable-offset abbreviation + +-- Test casting within a BETWEEN qualifier +SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff + FROM TIMESTAMPTZ_TBL + WHERE d1 BETWEEN timestamp with time zone '1902-01-01' AND timestamp with time zone '2038-01-01'; + +-- DATE_PART (timestamptz_part) +SELECT d1 as timestamptz, + date_part( 'year', d1) AS year, date_part( 'month', d1) AS month, + date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour, + date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second + FROM TIMESTAMPTZ_TBL; + +SELECT d1 as timestamptz, + date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec, + date_part( 'usec', d1) AS usec + FROM TIMESTAMPTZ_TBL; + +SELECT d1 as timestamptz, + date_part( 'isoyear', d1) AS isoyear, date_part( 'week', d1) AS week, + date_part( 'isodow', d1) AS isodow, date_part( 'dow', d1) AS dow, + date_part( 'doy', d1) AS doy + FROM TIMESTAMPTZ_TBL; + +SELECT d1 as timestamptz, + date_part( 'decade', d1) AS decade, + date_part( 'century', d1) AS century, + date_part( 'millennium', d1) AS millennium, + round(date_part( 'julian', d1)) AS julian + FROM TIMESTAMPTZ_TBL; + +SELECT d1 as timestamptz, + date_part( 'timezone', d1) AS timezone, + date_part( 'timezone_hour', d1) AS timezone_hour, + date_part( 'timezone_minute', d1) AS timezone_minute + FROM TIMESTAMPTZ_TBL; + +-- TO_CHAR() +SELECT '' AS to_char_1, to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_2, to_char(d1, 'FMDAY FMDay FMday FMMONTH FMMonth FMmonth FMRM') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_3, to_char(d1, 'Y,YYY YYYY YYY YY Y CC Q MM WW DDD DD D J') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_4, to_char(d1, 'FMY,YYY FMYYYY FMYYY FMYY FMY FMCC FMQ FMMM FMWW FMDDD FMDD FMD FMJ') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_5, to_char(d1, 'HH HH12 HH24 MI SS SSSS') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_6, to_char(d1, E'"HH:MI:SS is" HH:MI:SS "\\"text between quote marks\\""') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_7, to_char(d1, 'HH24--text--MI--text--SS') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_8, to_char(d1, 'YYYYTH YYYYth Jth') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_9, to_char(d1, 'YYYY A.D. YYYY a.d. YYYY bc HH:MI:SS P.M. HH:MI:SS p.m. HH:MI:SS pm') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_10, to_char(d1, 'IYYY IYY IY I IW IDDD ID') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_11, to_char(d1, 'FMIYYY FMIYY FMIY FMI FMIW FMIDDD FMID') + FROM TIMESTAMPTZ_TBL; + +SELECT '' AS to_char_12, to_char(d, 'FF1 FF2 FF3 FF4 FF5 FF6 ff1 ff2 ff3 ff4 ff5 ff6 MS US') + FROM (VALUES + ('2018-11-02 12:34:56'::timestamptz), + ('2018-11-02 12:34:56.78'), + ('2018-11-02 12:34:56.78901'), + ('2018-11-02 12:34:56.78901234') + ) d(d); + +-- Check OF, TZH, TZM with various zone offsets, particularly fractional hours +SET timezone = '00:00'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +SET timezone = '+02:00'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +SET timezone = '-13:00'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +SET timezone = '-00:30'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +SET timezone = '00:30'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +SET timezone = '-04:30'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +SET timezone = '04:30'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +SET timezone = '-04:15'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +SET timezone = '04:15'; +SELECT to_char(now(), 'OF') as "OF", to_char(now(), 'TZH:TZM') as "TZH:TZM"; +RESET timezone; + +CREATE TABLE TIMESTAMPTZ_TST (a int , b timestamptz); + +-- Test year field value with len > 4 +INSERT INTO TIMESTAMPTZ_TST VALUES(1, 'Sat Mar 12 23:58:48 1000 IST'); +INSERT INTO TIMESTAMPTZ_TST VALUES(2, 'Sat Mar 12 23:58:48 10000 IST'); +INSERT INTO TIMESTAMPTZ_TST VALUES(3, 'Sat Mar 12 23:58:48 100000 IST'); +INSERT INTO TIMESTAMPTZ_TST VALUES(3, '10000 Mar 12 23:58:48 IST'); +INSERT INTO TIMESTAMPTZ_TST VALUES(4, '100000312 23:58:48 IST'); +INSERT INTO TIMESTAMPTZ_TST VALUES(4, '1000000312 23:58:48 IST'); +--Verify data +SELECT * FROM TIMESTAMPTZ_TST ORDER BY a; +--Cleanup +DROP TABLE TIMESTAMPTZ_TST; + +-- test timestamptz constructors +set TimeZone to 'America/New_York'; + +-- numeric timezone +SELECT make_timestamptz(1973, 07, 15, 08, 15, 55.33); +SELECT make_timestamptz(1973, 07, 15, 08, 15, 55.33, '+2'); +SELECT make_timestamptz(1973, 07, 15, 08, 15, 55.33, '-2'); +WITH tzs (tz) AS (VALUES + ('+1'), ('+1:'), ('+1:0'), ('+100'), ('+1:00'), ('+01:00'), + ('+10'), ('+1000'), ('+10:'), ('+10:0'), ('+10:00'), ('+10:00:'), + ('+10:00:1'), ('+10:00:01'), + ('+10:00:10')) + SELECT make_timestamptz(2010, 2, 27, 3, 45, 00, tz), tz FROM tzs; + +-- these should fail +SELECT make_timestamptz(1973, 07, 15, 08, 15, 55.33, '2'); +SELECT make_timestamptz(2014, 12, 10, 10, 10, 10, '+16'); +SELECT make_timestamptz(2014, 12, 10, 10, 10, 10, '-16'); + +-- should be true +SELECT make_timestamptz(1973, 07, 15, 08, 15, 55.33, '+2') = '1973-07-15 08:15:55.33+02'::timestamptz; + +-- full timezone names +SELECT make_timestamptz(2014, 12, 10, 0, 0, 0, 'Europe/Prague') = timestamptz '2014-12-10 00:00:00 Europe/Prague'; +SELECT make_timestamptz(2014, 12, 10, 0, 0, 0, 'Europe/Prague') AT TIME ZONE 'UTC'; +SELECT make_timestamptz(1846, 12, 10, 0, 0, 0, 'Asia/Manila') AT TIME ZONE 'UTC'; +SELECT make_timestamptz(1881, 12, 10, 0, 0, 0, 'Europe/Paris') AT TIME ZONE 'UTC'; +SELECT make_timestamptz(1910, 12, 24, 0, 0, 0, 'Nehwon/Lankhmar'); + +-- abbreviations +SELECT make_timestamptz(2008, 12, 10, 10, 10, 10, 'EST'); +SELECT make_timestamptz(2008, 12, 10, 10, 10, 10, 'EDT'); +SELECT make_timestamptz(2014, 12, 10, 10, 10, 10, 'PST8PDT'); + +RESET TimeZone; + +-- +-- Test behavior with a dynamic (time-varying) timezone abbreviation. +-- These tests rely on the knowledge that MSK (Europe/Moscow standard time) +-- moved forwards in Mar 2011 and backwards again in Oct 2014. +-- + +SET TimeZone to 'UTC'; + +SELECT '2011-03-27 00:00:00 Europe/Moscow'::timestamptz; +SELECT '2011-03-27 01:00:00 Europe/Moscow'::timestamptz; +SELECT '2011-03-27 01:59:59 Europe/Moscow'::timestamptz; +SELECT '2011-03-27 02:00:00 Europe/Moscow'::timestamptz; +SELECT '2011-03-27 02:00:01 Europe/Moscow'::timestamptz; +SELECT '2011-03-27 02:59:59 Europe/Moscow'::timestamptz; +SELECT '2011-03-27 03:00:00 Europe/Moscow'::timestamptz; +SELECT '2011-03-27 03:00:01 Europe/Moscow'::timestamptz; +SELECT '2011-03-27 04:00:00 Europe/Moscow'::timestamptz; + +SELECT '2011-03-27 00:00:00 MSK'::timestamptz; +SELECT '2011-03-27 01:00:00 MSK'::timestamptz; +SELECT '2011-03-27 01:59:59 MSK'::timestamptz; +SELECT '2011-03-27 02:00:00 MSK'::timestamptz; +SELECT '2011-03-27 02:00:01 MSK'::timestamptz; +SELECT '2011-03-27 02:59:59 MSK'::timestamptz; +SELECT '2011-03-27 03:00:00 MSK'::timestamptz; +SELECT '2011-03-27 03:00:01 MSK'::timestamptz; +SELECT '2011-03-27 04:00:00 MSK'::timestamptz; + +SELECT '2014-10-26 00:00:00 Europe/Moscow'::timestamptz; +SELECT '2014-10-26 00:59:59 Europe/Moscow'::timestamptz; +SELECT '2014-10-26 01:00:00 Europe/Moscow'::timestamptz; +SELECT '2014-10-26 01:00:01 Europe/Moscow'::timestamptz; +SELECT '2014-10-26 02:00:00 Europe/Moscow'::timestamptz; + +SELECT '2014-10-26 00:00:00 MSK'::timestamptz; +SELECT '2014-10-26 00:59:59 MSK'::timestamptz; +SELECT '2014-10-26 01:00:00 MSK'::timestamptz; +SELECT '2014-10-26 01:00:01 MSK'::timestamptz; +SELECT '2014-10-26 02:00:00 MSK'::timestamptz; + +SELECT '2011-03-27 00:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 01:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 01:59:59'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 02:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 02:00:01'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 02:59:59'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 03:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 03:00:01'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 04:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'; + +SELECT '2011-03-27 00:00:00'::timestamp AT TIME ZONE 'MSK'; +SELECT '2011-03-27 01:00:00'::timestamp AT TIME ZONE 'MSK'; +SELECT '2011-03-27 01:59:59'::timestamp AT TIME ZONE 'MSK'; +SELECT '2011-03-27 02:00:00'::timestamp AT TIME ZONE 'MSK'; +SELECT '2011-03-27 02:00:01'::timestamp AT TIME ZONE 'MSK'; +SELECT '2011-03-27 02:59:59'::timestamp AT TIME ZONE 'MSK'; +SELECT '2011-03-27 03:00:00'::timestamp AT TIME ZONE 'MSK'; +SELECT '2011-03-27 03:00:01'::timestamp AT TIME ZONE 'MSK'; +SELECT '2011-03-27 04:00:00'::timestamp AT TIME ZONE 'MSK'; + +SELECT '2014-10-26 00:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2014-10-26 00:59:59'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2014-10-26 01:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2014-10-26 01:00:01'::timestamp AT TIME ZONE 'Europe/Moscow'; +SELECT '2014-10-26 02:00:00'::timestamp AT TIME ZONE 'Europe/Moscow'; + +SELECT '2014-10-26 00:00:00'::timestamp AT TIME ZONE 'MSK'; +SELECT '2014-10-26 00:59:59'::timestamp AT TIME ZONE 'MSK'; +SELECT '2014-10-26 01:00:00'::timestamp AT TIME ZONE 'MSK'; +SELECT '2014-10-26 01:00:01'::timestamp AT TIME ZONE 'MSK'; +SELECT '2014-10-26 02:00:00'::timestamp AT TIME ZONE 'MSK'; + +SELECT make_timestamptz(2014, 10, 26, 0, 0, 0, 'MSK'); +SELECT make_timestamptz(2014, 10, 26, 1, 0, 0, 'MSK'); + +SELECT to_timestamp( 0); -- 1970-01-01 00:00:00+00 +SELECT to_timestamp( 946684800); -- 2000-01-01 00:00:00+00 +SELECT to_timestamp(1262349296.7890123); -- 2010-01-01 12:34:56.789012+00 +-- edge cases +SELECT to_timestamp(-210866803200); -- 4714-11-24 00:00:00+00 BC +-- upper limit varies between integer and float timestamps, so hard to test +-- nonfinite values +SELECT to_timestamp(' Infinity'::float); +SELECT to_timestamp('-Infinity'::float); +SELECT to_timestamp('NaN'::float); + + +SET TimeZone to 'Europe/Moscow'; + +SELECT '2011-03-26 21:00:00 UTC'::timestamptz; +SELECT '2011-03-26 22:00:00 UTC'::timestamptz; +SELECT '2011-03-26 22:59:59 UTC'::timestamptz; +SELECT '2011-03-26 23:00:00 UTC'::timestamptz; +SELECT '2011-03-26 23:00:01 UTC'::timestamptz; +SELECT '2011-03-26 23:59:59 UTC'::timestamptz; +SELECT '2011-03-27 00:00:00 UTC'::timestamptz; + +SELECT '2014-10-25 21:00:00 UTC'::timestamptz; +SELECT '2014-10-25 21:59:59 UTC'::timestamptz; +SELECT '2014-10-25 22:00:00 UTC'::timestamptz; +SELECT '2014-10-25 22:00:01 UTC'::timestamptz; +SELECT '2014-10-25 23:00:00 UTC'::timestamptz; + +RESET TimeZone; + +SELECT '2011-03-26 21:00:00 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-26 22:00:00 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-26 22:59:59 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-26 23:00:00 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-26 23:00:01 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-26 23:59:59 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2011-03-27 00:00:00 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; + +SELECT '2014-10-25 21:00:00 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2014-10-25 21:59:59 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2014-10-25 22:00:00 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2014-10-25 22:00:01 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; +SELECT '2014-10-25 23:00:00 UTC'::timestamptz AT TIME ZONE 'Europe/Moscow'; + +SELECT '2011-03-26 21:00:00 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2011-03-26 22:00:00 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2011-03-26 22:59:59 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2011-03-26 23:00:00 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2011-03-26 23:00:01 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2011-03-26 23:59:59 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2011-03-27 00:00:00 UTC'::timestamptz AT TIME ZONE 'MSK'; + +SELECT '2014-10-25 21:00:00 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2014-10-25 21:59:59 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2014-10-25 22:00:00 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2014-10-25 22:00:01 UTC'::timestamptz AT TIME ZONE 'MSK'; +SELECT '2014-10-25 23:00:00 UTC'::timestamptz AT TIME ZONE 'MSK'; + +-- +-- Test that AT TIME ZONE isn't misoptimized when using an index (bug #14504) +-- +create temp table tmptz (f1 timestamptz primary key); +insert into tmptz values ('2017-01-18 00:00+00'); +explain (costs off) +select * from tmptz where f1 at time zone 'utc' = '2017-01-18 00:00'; +select * from tmptz where f1 at time zone 'utc' = '2017-01-18 00:00'; diff --git a/postgresql/examples/timetz.sql b/postgresql/examples/timetz.sql new file mode 100644 index 0000000..b699e4b --- /dev/null +++ b/postgresql/examples/timetz.sql @@ -0,0 +1,72 @@ +-- +-- TIMETZ +-- + +CREATE TABLE TIMETZ_TBL (f1 time(2) with time zone); + +INSERT INTO TIMETZ_TBL VALUES ('00:01 PDT'); +INSERT INTO TIMETZ_TBL VALUES ('01:00 PDT'); +INSERT INTO TIMETZ_TBL VALUES ('02:03 PDT'); +INSERT INTO TIMETZ_TBL VALUES ('07:07 PST'); +INSERT INTO TIMETZ_TBL VALUES ('08:08 EDT'); +INSERT INTO TIMETZ_TBL VALUES ('11:59 PDT'); +INSERT INTO TIMETZ_TBL VALUES ('12:00 PDT'); +INSERT INTO TIMETZ_TBL VALUES ('12:01 PDT'); +INSERT INTO TIMETZ_TBL VALUES ('23:59 PDT'); +INSERT INTO TIMETZ_TBL VALUES ('11:59:59.99 PM PDT'); + +INSERT INTO TIMETZ_TBL VALUES ('2003-03-07 15:36:39 America/New_York'); +INSERT INTO TIMETZ_TBL VALUES ('2003-07-07 15:36:39 America/New_York'); +-- this should fail (the timezone offset is not known) +INSERT INTO TIMETZ_TBL VALUES ('15:36:39 America/New_York'); +-- this should fail (timezone not specified without a date) +INSERT INTO TIMETZ_TBL VALUES ('15:36:39 m2'); +-- this should fail (dynamic timezone abbreviation without a date) +INSERT INTO TIMETZ_TBL VALUES ('15:36:39 MSK m2'); + + +SELECT f1 AS "Time TZ" FROM TIMETZ_TBL; + +SELECT f1 AS "Three" FROM TIMETZ_TBL WHERE f1 < '05:06:07-07'; + +SELECT f1 AS "Seven" FROM TIMETZ_TBL WHERE f1 > '05:06:07-07'; + +SELECT f1 AS "None" FROM TIMETZ_TBL WHERE f1 < '00:00-07'; + +SELECT f1 AS "Ten" FROM TIMETZ_TBL WHERE f1 >= '00:00-07'; + +-- Check edge cases +SELECT '23:59:59.999999'::timetz; +SELECT '23:59:59.9999999'::timetz; -- rounds up +SELECT '23:59:60'::timetz; -- rounds up +SELECT '24:00:00'::timetz; -- allowed +SELECT '24:00:00.01'::timetz; -- not allowed +SELECT '23:59:60.01'::timetz; -- not allowed +SELECT '24:01:00'::timetz; -- not allowed +SELECT '25:00:00'::timetz; -- not allowed + +-- +-- TIME simple math +-- +-- We now make a distinction between time and intervals, +-- and adding two times together makes no sense at all. +-- Leave in one query to show that it is rejected, +-- and do the rest of the testing in horology.sql +-- where we do mixed-type arithmetic. - thomas 2000-12-02 + +SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL; + +-- +-- test EXTRACT +-- +SELECT EXTRACT(MICROSECOND FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); +SELECT EXTRACT(MILLISECOND FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); +SELECT EXTRACT(SECOND FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); +SELECT EXTRACT(MINUTE FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); +SELECT EXTRACT(HOUR FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); +SELECT EXTRACT(DAY FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); -- error +SELECT EXTRACT(FORTNIGHT FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); -- error +SELECT EXTRACT(TIMEZONE FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); +SELECT EXTRACT(TIMEZONE_HOUR FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); +SELECT EXTRACT(TIMEZONE_MINUTE FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); +SELECT EXTRACT(EPOCH FROM TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04'); diff --git a/postgresql/examples/transactions.sql b/postgresql/examples/transactions.sql new file mode 100644 index 0000000..afd0039 --- /dev/null +++ b/postgresql/examples/transactions.sql @@ -0,0 +1,585 @@ +-- +-- TRANSACTIONS +-- + +BEGIN; + +SELECT * + INTO TABLE xacttest + FROM aggtest; + +INSERT INTO xacttest (a, b) VALUES (777, 777.777); + +END; + +-- should retrieve one value-- +SELECT a FROM xacttest WHERE a > 100; + + +BEGIN; + +CREATE TABLE disappear (a int4); + +DELETE FROM aggtest; + +-- should be empty +SELECT * FROM aggtest; + +ABORT; + +-- should not exist +SELECT oid FROM pg_class WHERE relname = 'disappear'; + +-- should have members again +SELECT * FROM aggtest; + + +-- Read-only tests + +CREATE TABLE writetest (a int); +CREATE TEMPORARY TABLE temptest (a int); + +BEGIN; +SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY, DEFERRABLE; -- ok +SELECT * FROM writetest; -- ok +SET TRANSACTION READ WRITE; --fail +COMMIT; + +BEGIN; +SET TRANSACTION READ ONLY; -- ok +SET TRANSACTION READ WRITE; -- ok +SET TRANSACTION READ ONLY; -- ok +SELECT * FROM writetest; -- ok +SAVEPOINT x; +SET TRANSACTION READ ONLY; -- ok +SELECT * FROM writetest; -- ok +SET TRANSACTION READ ONLY; -- ok +SET TRANSACTION READ WRITE; --fail +COMMIT; + +BEGIN; +SET TRANSACTION READ WRITE; -- ok +SAVEPOINT x; +SET TRANSACTION READ WRITE; -- ok +SET TRANSACTION READ ONLY; -- ok +SELECT * FROM writetest; -- ok +SET TRANSACTION READ ONLY; -- ok +SET TRANSACTION READ WRITE; --fail +COMMIT; + +BEGIN; +SET TRANSACTION READ WRITE; -- ok +SAVEPOINT x; +SET TRANSACTION READ ONLY; -- ok +SELECT * FROM writetest; -- ok +ROLLBACK TO SAVEPOINT x; +SHOW transaction_read_only; -- off +SAVEPOINT y; +SET TRANSACTION READ ONLY; -- ok +SELECT * FROM writetest; -- ok +RELEASE SAVEPOINT y; +SHOW transaction_read_only; -- off +COMMIT; + +SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY; + +DROP TABLE writetest; -- fail +INSERT INTO writetest VALUES (1); -- fail +SELECT * FROM writetest; -- ok +DELETE FROM temptest; -- ok +UPDATE temptest SET a = 0 FROM writetest WHERE temptest.a = 1 AND writetest.a = temptest.a; -- ok +PREPARE test AS UPDATE writetest SET a = 0; -- ok +EXECUTE test; -- fail +SELECT * FROM writetest, temptest; -- ok +CREATE TABLE test AS SELECT * FROM writetest; -- fail + +START TRANSACTION READ WRITE; +DROP TABLE writetest; -- ok +COMMIT; + +-- Subtransactions, basic tests +-- create & drop tables +SET SESSION CHARACTERISTICS AS TRANSACTION READ WRITE; +CREATE TABLE trans_foobar (a int); +BEGIN; + CREATE TABLE trans_foo (a int); + SAVEPOINT one; + DROP TABLE trans_foo; + CREATE TABLE trans_bar (a int); + ROLLBACK TO SAVEPOINT one; + RELEASE SAVEPOINT one; + SAVEPOINT two; + CREATE TABLE trans_baz (a int); + RELEASE SAVEPOINT two; + drop TABLE trans_foobar; + CREATE TABLE trans_barbaz (a int); +COMMIT; +-- should exist: trans_barbaz, trans_baz, trans_foo +SELECT * FROM trans_foo; -- should be empty +SELECT * FROM trans_bar; -- shouldn't exist +SELECT * FROM trans_barbaz; -- should be empty +SELECT * FROM trans_baz; -- should be empty + +-- inserts +BEGIN; + INSERT INTO trans_foo VALUES (1); + SAVEPOINT one; + INSERT into trans_bar VALUES (1); + ROLLBACK TO one; + RELEASE SAVEPOINT one; + SAVEPOINT two; + INSERT into trans_barbaz VALUES (1); + RELEASE two; + SAVEPOINT three; + SAVEPOINT four; + INSERT INTO trans_foo VALUES (2); + RELEASE SAVEPOINT four; + ROLLBACK TO SAVEPOINT three; + RELEASE SAVEPOINT three; + INSERT INTO trans_foo VALUES (3); +COMMIT; +SELECT * FROM trans_foo; -- should have 1 and 3 +SELECT * FROM trans_barbaz; -- should have 1 + +-- test whole-tree commit +BEGIN; + SAVEPOINT one; + SELECT trans_foo; + ROLLBACK TO SAVEPOINT one; + RELEASE SAVEPOINT one; + SAVEPOINT two; + CREATE TABLE savepoints (a int); + SAVEPOINT three; + INSERT INTO savepoints VALUES (1); + SAVEPOINT four; + INSERT INTO savepoints VALUES (2); + SAVEPOINT five; + INSERT INTO savepoints VALUES (3); + ROLLBACK TO SAVEPOINT five; +COMMIT; +COMMIT; -- should not be in a transaction block +SELECT * FROM savepoints; + +-- test whole-tree rollback +BEGIN; + SAVEPOINT one; + DELETE FROM savepoints WHERE a=1; + RELEASE SAVEPOINT one; + SAVEPOINT two; + DELETE FROM savepoints WHERE a=1; + SAVEPOINT three; + DELETE FROM savepoints WHERE a=2; +ROLLBACK; +COMMIT; -- should not be in a transaction block + +SELECT * FROM savepoints; + +-- test whole-tree commit on an aborted subtransaction +BEGIN; + INSERT INTO savepoints VALUES (4); + SAVEPOINT one; + INSERT INTO savepoints VALUES (5); + SELECT trans_foo; +COMMIT; +SELECT * FROM savepoints; + +BEGIN; + INSERT INTO savepoints VALUES (6); + SAVEPOINT one; + INSERT INTO savepoints VALUES (7); + RELEASE SAVEPOINT one; + INSERT INTO savepoints VALUES (8); +COMMIT; +-- rows 6 and 8 should have been created by the same xact +SELECT a.xmin = b.xmin FROM savepoints a, savepoints b WHERE a.a=6 AND b.a=8; +-- rows 6 and 7 should have been created by different xacts +SELECT a.xmin = b.xmin FROM savepoints a, savepoints b WHERE a.a=6 AND b.a=7; + +BEGIN; + INSERT INTO savepoints VALUES (9); + SAVEPOINT one; + INSERT INTO savepoints VALUES (10); + ROLLBACK TO SAVEPOINT one; + INSERT INTO savepoints VALUES (11); +COMMIT; +SELECT a FROM savepoints WHERE a in (9, 10, 11); +-- rows 9 and 11 should have been created by different xacts +SELECT a.xmin = b.xmin FROM savepoints a, savepoints b WHERE a.a=9 AND b.a=11; + +BEGIN; + INSERT INTO savepoints VALUES (12); + SAVEPOINT one; + INSERT INTO savepoints VALUES (13); + SAVEPOINT two; + INSERT INTO savepoints VALUES (14); + ROLLBACK TO SAVEPOINT one; + INSERT INTO savepoints VALUES (15); + SAVEPOINT two; + INSERT INTO savepoints VALUES (16); + SAVEPOINT three; + INSERT INTO savepoints VALUES (17); +COMMIT; +SELECT a FROM savepoints WHERE a BETWEEN 12 AND 17; + +BEGIN; + INSERT INTO savepoints VALUES (18); + SAVEPOINT one; + INSERT INTO savepoints VALUES (19); + SAVEPOINT two; + INSERT INTO savepoints VALUES (20); + ROLLBACK TO SAVEPOINT one; + INSERT INTO savepoints VALUES (21); + ROLLBACK TO SAVEPOINT one; + INSERT INTO savepoints VALUES (22); +COMMIT; +SELECT a FROM savepoints WHERE a BETWEEN 18 AND 22; + +DROP TABLE savepoints; + +-- only in a transaction block: +SAVEPOINT one; +ROLLBACK TO SAVEPOINT one; +RELEASE SAVEPOINT one; + +-- Only "rollback to" allowed in aborted state +BEGIN; + SAVEPOINT one; + SELECT 0/0; + SAVEPOINT two; -- ignored till the end of ... + RELEASE SAVEPOINT one; -- ignored till the end of ... + ROLLBACK TO SAVEPOINT one; + SELECT 1; +COMMIT; +SELECT 1; -- this should work + +-- check non-transactional behavior of cursors +BEGIN; + DECLARE c CURSOR FOR SELECT unique2 FROM tenk1 ORDER BY unique2; + SAVEPOINT one; + FETCH 10 FROM c; + ROLLBACK TO SAVEPOINT one; + FETCH 10 FROM c; + RELEASE SAVEPOINT one; + FETCH 10 FROM c; + CLOSE c; + DECLARE c CURSOR FOR SELECT unique2/0 FROM tenk1 ORDER BY unique2; + SAVEPOINT two; + FETCH 10 FROM c; + ROLLBACK TO SAVEPOINT two; + -- c is now dead to the world ... + FETCH 10 FROM c; + ROLLBACK TO SAVEPOINT two; + RELEASE SAVEPOINT two; + FETCH 10 FROM c; +COMMIT; + +-- +-- Check that "stable" functions are really stable. They should not be +-- able to see the partial results of the calling query. (Ideally we would +-- also check that they don't see commits of concurrent transactions, but +-- that's a mite hard to do within the limitations of pg_regress.) +-- +select * from xacttest; + +create or replace function max_xacttest() returns smallint language sql as +'select max(a) from xacttest' stable; + +begin; +update xacttest set a = max_xacttest() + 10 where a > 0; +select * from xacttest; +rollback; + +-- But a volatile function can see the partial results of the calling query +create or replace function max_xacttest() returns smallint language sql as +'select max(a) from xacttest' volatile; + +begin; +update xacttest set a = max_xacttest() + 10 where a > 0; +select * from xacttest; +rollback; + +-- Now the same test with plpgsql (since it depends on SPI which is different) +create or replace function max_xacttest() returns smallint language plpgsql as +'begin return max(a) from xacttest; end' stable; + +begin; +update xacttest set a = max_xacttest() + 10 where a > 0; +select * from xacttest; +rollback; + +create or replace function max_xacttest() returns smallint language plpgsql as +'begin return max(a) from xacttest; end' volatile; + +begin; +update xacttest set a = max_xacttest() + 10 where a > 0; +select * from xacttest; +rollback; + + +-- test case for problems with dropping an open relation during abort +BEGIN; + savepoint x; + CREATE TABLE koju (a INT UNIQUE); + INSERT INTO koju VALUES (1); + INSERT INTO koju VALUES (1); + rollback to x; + + CREATE TABLE koju (a INT UNIQUE); + INSERT INTO koju VALUES (1); + INSERT INTO koju VALUES (1); +ROLLBACK; + +DROP TABLE trans_foo; +DROP TABLE trans_baz; +DROP TABLE trans_barbaz; + + +-- test case for problems with revalidating an open relation during abort +create function inverse(int) returns float8 as +$$ +begin + analyze revalidate_bug; + return 1::float8/$1; +exception + when division_by_zero then return 0; +end$$ language plpgsql volatile; + +create table revalidate_bug (c float8 unique); +insert into revalidate_bug values (1); +insert into revalidate_bug values (inverse(0)); + +drop table revalidate_bug; +drop function inverse(int); + + +-- verify that cursors created during an aborted subtransaction are +-- closed, but that we do not rollback the effect of any FETCHs +-- performed in the aborted subtransaction +begin; + +savepoint x; +create table abc (a int); +insert into abc values (5); +insert into abc values (10); +declare foo cursor for select * from abc; +fetch from foo; +rollback to x; + +-- should fail +fetch from foo; +commit; + +begin; + +create table abc (a int); +insert into abc values (5); +insert into abc values (10); +insert into abc values (15); +declare foo cursor for select * from abc; + +fetch from foo; + +savepoint x; +fetch from foo; +rollback to x; + +fetch from foo; + +abort; + + +-- Test for proper cleanup after a failure in a cursor portal +-- that was created in an outer subtransaction +CREATE FUNCTION invert(x float8) RETURNS float8 LANGUAGE plpgsql AS +$$ begin return 1/x; end $$; + +CREATE FUNCTION create_temp_tab() RETURNS text +LANGUAGE plpgsql AS $$ +BEGIN + CREATE TEMP TABLE new_table (f1 float8); + -- case of interest is that we fail while holding an open + -- relcache reference to new_table + INSERT INTO new_table SELECT invert(0.0); + RETURN 'foo'; +END $$; + +BEGIN; +DECLARE ok CURSOR FOR SELECT * FROM int8_tbl; +DECLARE ctt CURSOR FOR SELECT create_temp_tab(); +FETCH ok; +SAVEPOINT s1; +FETCH ok; -- should work +FETCH ctt; -- error occurs here +ROLLBACK TO s1; +FETCH ok; -- should work +FETCH ctt; -- must be rejected +COMMIT; + +DROP FUNCTION create_temp_tab(); +DROP FUNCTION invert(x float8); + + +-- Tests for AND CHAIN + +CREATE TABLE abc (a int); + +-- set nondefault value so we have something to override below +SET default_transaction_read_only = on; + +START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE; +SHOW transaction_isolation; +SHOW transaction_read_only; +SHOW transaction_deferrable; +INSERT INTO abc VALUES (1); +INSERT INTO abc VALUES (2); +COMMIT AND CHAIN; -- TBLOCK_END +SHOW transaction_isolation; +SHOW transaction_read_only; +SHOW transaction_deferrable; +INSERT INTO abc VALUES ('error'); +INSERT INTO abc VALUES (3); -- check it's really aborted +COMMIT AND CHAIN; -- TBLOCK_ABORT_END +SHOW transaction_isolation; +SHOW transaction_read_only; +SHOW transaction_deferrable; +INSERT INTO abc VALUES (4); +COMMIT; + +START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE; +SHOW transaction_isolation; +SHOW transaction_read_only; +SHOW transaction_deferrable; +SAVEPOINT x; +INSERT INTO abc VALUES ('error'); +COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING +SHOW transaction_isolation; +SHOW transaction_read_only; +SHOW transaction_deferrable; +INSERT INTO abc VALUES (5); +COMMIT; + +-- different mix of options just for fun +START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE, NOT DEFERRABLE; +SHOW transaction_isolation; +SHOW transaction_read_only; +SHOW transaction_deferrable; +INSERT INTO abc VALUES (6); +ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING +SHOW transaction_isolation; +SHOW transaction_read_only; +SHOW transaction_deferrable; +INSERT INTO abc VALUES ('error'); +ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END +SHOW transaction_isolation; +SHOW transaction_read_only; +SHOW transaction_deferrable; +ROLLBACK; + +-- not allowed outside a transaction block +COMMIT AND CHAIN; -- error +ROLLBACK AND CHAIN; -- error + +SELECT * FROM abc ORDER BY 1; + +RESET default_transaction_read_only; + +DROP TABLE abc; + + +-- Test assorted behaviors around the implicit transaction block created +-- when multiple SQL commands are sent in a single Query message. These +-- tests rely on the fact that psql will not break SQL commands apart at a +-- backslash-quoted semicolon, but will send them as one Query. + +create temp table i_table (f1 int); + +-- psql will show only the last result in a multi-statement Query +SELECT 1\; SELECT 2\; SELECT 3; + +select * from i_table; + +rollback; -- we are not in a transaction at this point + +-- can use regular begin/commit/rollback within a single Query +begin\; insert into i_table values(3)\; commit; +rollback; -- we are not in a transaction at this point +begin\; insert into i_table values(4)\; rollback; +rollback; -- we are not in a transaction at this point + +-- begin converts implicit transaction into a regular one that +-- can extend past the end of the Query +select 1\; begin\; insert into i_table values(5); +commit; +select 1\; begin\; insert into i_table values(6); +rollback; + +-- commit in implicit-transaction state commits but issues a warning. +insert into i_table values(7)\; commit\; insert into i_table values(8)\; select 1/0; +-- similarly, rollback aborts but issues a warning. +insert into i_table values(9)\; rollback\; select 2; + +select * from i_table; + +rollback; -- we are not in a transaction at this point + +-- implicit transaction block is still a transaction block, for e.g. VACUUM +SELECT 1\; VACUUM; +SELECT 1\; COMMIT\; VACUUM; + +-- we disallow savepoint-related commands in implicit-transaction state +SELECT 1\; SAVEPOINT sp; +SELECT 1\; COMMIT\; SAVEPOINT sp; +ROLLBACK TO SAVEPOINT sp\; SELECT 2; +SELECT 2\; RELEASE SAVEPOINT sp\; SELECT 3; + +-- but this is OK, because the BEGIN converts it to a regular xact +SELECT 1\; BEGIN\; SAVEPOINT sp\; ROLLBACK TO SAVEPOINT sp\; COMMIT; + + +-- Tests for AND CHAIN in implicit transaction blocks + +SET TRANSACTION READ ONLY\; COMMIT AND CHAIN; -- error +SHOW transaction_read_only; + +SET TRANSACTION READ ONLY\; ROLLBACK AND CHAIN; -- error +SHOW transaction_read_only; + +CREATE TABLE abc (a int); + +-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN +INSERT INTO abc VALUES (7)\; COMMIT\; INSERT INTO abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error +INSERT INTO abc VALUES (9)\; ROLLBACK\; INSERT INTO abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error + +-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK +INSERT INTO abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached +INSERT INTO abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached + +-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok +SHOW transaction_isolation; -- transaction is active at this point +COMMIT; + +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok +SHOW transaction_isolation; -- transaction is active at this point +ROLLBACK; + +-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error +SHOW transaction_isolation; -- out of transaction block + +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (19)\; ROLLBACK\; INSERT INTO abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error +SHOW transaction_isolation; -- out of transaction block + +SELECT * FROM abc ORDER BY 1; + +DROP TABLE abc; + + +-- Test for successful cleanup of an aborted transaction at session exit. +-- THIS MUST BE THE LAST TEST IN THIS FILE. + +begin; +select 1/0; +rollback to X; + +-- DO NOT ADD ANYTHING HERE. diff --git a/postgresql/examples/triggers.sql b/postgresql/examples/triggers.sql new file mode 100644 index 0000000..28adf5c --- /dev/null +++ b/postgresql/examples/triggers.sql @@ -0,0 +1,2277 @@ +-- +-- TRIGGERS +-- + +create table pkeys (pkey1 int4 not null, pkey2 text not null); +create table fkeys (fkey1 int4, fkey2 text, fkey3 int); +create table fkeys2 (fkey21 int4, fkey22 text, pkey23 int not null); + +create index fkeys_i on fkeys (fkey1, fkey2); +create index fkeys2_i on fkeys2 (fkey21, fkey22); +create index fkeys2p_i on fkeys2 (pkey23); + +insert into pkeys values (10, '1'); +insert into pkeys values (20, '2'); +insert into pkeys values (30, '3'); +insert into pkeys values (40, '4'); +insert into pkeys values (50, '5'); +insert into pkeys values (60, '6'); +create unique index pkeys_i on pkeys (pkey1, pkey2); + +-- +-- For fkeys: +-- (fkey1, fkey2) --> pkeys (pkey1, pkey2) +-- (fkey3) --> fkeys2 (pkey23) +-- +create trigger check_fkeys_pkey_exist + before insert or update on fkeys + for each row + execute function + check_primary_key ('fkey1', 'fkey2', 'pkeys', 'pkey1', 'pkey2'); + +create trigger check_fkeys_pkey2_exist + before insert or update on fkeys + for each row + execute function check_primary_key ('fkey3', 'fkeys2', 'pkey23'); + +-- +-- For fkeys2: +-- (fkey21, fkey22) --> pkeys (pkey1, pkey2) +-- +create trigger check_fkeys2_pkey_exist + before insert or update on fkeys2 + for each row + execute procedure + check_primary_key ('fkey21', 'fkey22', 'pkeys', 'pkey1', 'pkey2'); + +-- Test comments +COMMENT ON TRIGGER check_fkeys2_pkey_bad ON fkeys2 IS 'wrong'; +COMMENT ON TRIGGER check_fkeys2_pkey_exist ON fkeys2 IS 'right'; +COMMENT ON TRIGGER check_fkeys2_pkey_exist ON fkeys2 IS NULL; + +-- +-- For pkeys: +-- ON DELETE/UPDATE (pkey1, pkey2) CASCADE: +-- fkeys (fkey1, fkey2) and fkeys2 (fkey21, fkey22) +-- +create trigger check_pkeys_fkey_cascade + before delete or update on pkeys + for each row + execute procedure + check_foreign_key (2, 'cascade', 'pkey1', 'pkey2', + 'fkeys', 'fkey1', 'fkey2', 'fkeys2', 'fkey21', 'fkey22'); + +-- +-- For fkeys2: +-- ON DELETE/UPDATE (pkey23) RESTRICT: +-- fkeys (fkey3) +-- +create trigger check_fkeys2_fkey_restrict + before delete or update on fkeys2 + for each row + execute procedure check_foreign_key (1, 'restrict', 'pkey23', 'fkeys', 'fkey3'); + +insert into fkeys2 values (10, '1', 1); +insert into fkeys2 values (30, '3', 2); +insert into fkeys2 values (40, '4', 5); +insert into fkeys2 values (50, '5', 3); +-- no key in pkeys +insert into fkeys2 values (70, '5', 3); + +insert into fkeys values (10, '1', 2); +insert into fkeys values (30, '3', 3); +insert into fkeys values (40, '4', 2); +insert into fkeys values (50, '5', 2); +-- no key in pkeys +insert into fkeys values (70, '5', 1); +-- no key in fkeys2 +insert into fkeys values (60, '6', 4); + +delete from pkeys where pkey1 = 30 and pkey2 = '3'; +delete from pkeys where pkey1 = 40 and pkey2 = '4'; +update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 50 and pkey2 = '5'; +update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 10 and pkey2 = '1'; + +SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, + action_order, action_condition, action_orientation, action_timing, + action_reference_old_table, action_reference_new_table + FROM information_schema.triggers + WHERE event_object_table in ('pkeys', 'fkeys', 'fkeys2') + ORDER BY trigger_name COLLATE "C", 2; + +DROP TABLE pkeys; +DROP TABLE fkeys; +DROP TABLE fkeys2; + +-- Check behavior when trigger returns unmodified trigtuple +create table trigtest (f1 int, f2 text); + +create trigger trigger_return_old + before insert or delete or update on trigtest + for each row execute procedure trigger_return_old(); + +insert into trigtest values(1, 'foo'); +select * from trigtest; +update trigtest set f2 = f2 || 'bar'; +select * from trigtest; +delete from trigtest; +select * from trigtest; + +-- Also check what happens when such a trigger runs before or after others +create function f1_times_10() returns trigger as +$$ begin new.f1 := new.f1 * 10; return new; end $$ language plpgsql; + +create trigger trigger_alpha + before insert or update on trigtest + for each row execute procedure f1_times_10(); + +insert into trigtest values(1, 'foo'); +select * from trigtest; +update trigtest set f2 = f2 || 'bar'; +select * from trigtest; +delete from trigtest; +select * from trigtest; + +create trigger trigger_zed + before insert or update on trigtest + for each row execute procedure f1_times_10(); + +insert into trigtest values(1, 'foo'); +select * from trigtest; +update trigtest set f2 = f2 || 'bar'; +select * from trigtest; +delete from trigtest; +select * from trigtest; + +drop trigger trigger_alpha on trigtest; + +insert into trigtest values(1, 'foo'); +select * from trigtest; +update trigtest set f2 = f2 || 'bar'; +select * from trigtest; +delete from trigtest; +select * from trigtest; + +drop table trigtest; + +create sequence ttdummy_seq increment 10 start 0 minvalue 0; + +create table tttest ( + price_id int4, + price_val int4, + price_on int4, + price_off int4 default 999999 +); + +create trigger ttdummy + before delete or update on tttest + for each row + execute procedure + ttdummy (price_on, price_off); + +create trigger ttserial + before insert or update on tttest + for each row + execute procedure + autoinc (price_on, ttdummy_seq); + +insert into tttest values (1, 1, null); +insert into tttest values (2, 2, null); +insert into tttest values (3, 3, 0); + +select * from tttest; +delete from tttest where price_id = 2; +select * from tttest; +-- what do we see ? + +-- get current prices +select * from tttest where price_off = 999999; + +-- change price for price_id == 3 +update tttest set price_val = 30 where price_id = 3; +select * from tttest; + +-- now we want to change pric_id in ALL tuples +-- this gets us not what we need +update tttest set price_id = 5 where price_id = 3; +select * from tttest; + +-- restore data as before last update: +select set_ttdummy(0); +delete from tttest where price_id = 5; +update tttest set price_off = 999999 where price_val = 30; +select * from tttest; + +-- and try change price_id now! +update tttest set price_id = 5 where price_id = 3; +select * from tttest; +-- isn't it what we need ? + +select set_ttdummy(1); + +-- we want to correct some "date" +update tttest set price_on = -1 where price_id = 1; +-- but this doesn't work + +-- try in this way +select set_ttdummy(0); +update tttest set price_on = -1 where price_id = 1; +select * from tttest; +-- isn't it what we need ? + +-- get price for price_id == 5 as it was @ "date" 35 +select * from tttest where price_on <= 35 and price_off > 35 and price_id = 5; + +drop table tttest; +drop sequence ttdummy_seq; + +-- +-- tests for per-statement triggers +-- + +CREATE TABLE log_table (tstamp timestamp default timeofday()::timestamp); + +CREATE TABLE main_table (a int unique, b int); + +COPY main_table (a,b) FROM stdin; +/* +5 10 +20 20 +30 10 +50 35 +80 15 +\. +*/ + +CREATE FUNCTION trigger_func() RETURNS trigger LANGUAGE plpgsql AS ' +BEGIN + RAISE NOTICE ''trigger_func(%) called: action = %, when = %, level = %'', TG_ARGV[0], TG_OP, TG_WHEN, TG_LEVEL; + RETURN NULL; +END;'; + +CREATE TRIGGER before_ins_stmt_trig BEFORE INSERT ON main_table +FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func('before_ins_stmt'); + +CREATE TRIGGER after_ins_stmt_trig AFTER INSERT ON main_table +FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func('after_ins_stmt'); + +-- +-- if neither 'FOR EACH ROW' nor 'FOR EACH STATEMENT' was specified, +-- CREATE TRIGGER should default to 'FOR EACH STATEMENT' +-- +CREATE TRIGGER after_upd_stmt_trig AFTER UPDATE ON main_table +EXECUTE PROCEDURE trigger_func('after_upd_stmt'); + +-- Both insert and update statement level triggers (before and after) should +-- fire. Doesn't fire UPDATE before trigger, but only because one isn't +-- defined. +INSERT INTO main_table (a, b) VALUES (5, 10) ON CONFLICT (a) + DO UPDATE SET b = EXCLUDED.b; + +CREATE TRIGGER after_upd_row_trig AFTER UPDATE ON main_table +FOR EACH ROW EXECUTE PROCEDURE trigger_func('after_upd_row'); + +INSERT INTO main_table DEFAULT VALUES; + +UPDATE main_table SET a = a + 1 WHERE b < 30; +-- UPDATE that effects zero rows should still call per-statement trigger +UPDATE main_table SET a = a + 2 WHERE b > 100; + +-- constraint now unneeded +ALTER TABLE main_table DROP CONSTRAINT main_table_a_key; + +-- COPY should fire per-row and per-statement INSERT triggers +COPY main_table (a, b) FROM stdin; +/* +30 40 +50 60 +\.*/ + +SELECT * FROM main_table ORDER BY a, b; + +-- +-- test triggers with WHEN clause +-- + +CREATE TRIGGER modified_a BEFORE UPDATE OF a ON main_table +FOR EACH ROW WHEN (OLD.a <> NEW.a) EXECUTE PROCEDURE trigger_func('modified_a'); +CREATE TRIGGER modified_any BEFORE UPDATE OF a ON main_table +FOR EACH ROW WHEN (OLD.* IS DISTINCT FROM NEW.*) EXECUTE PROCEDURE trigger_func('modified_any'); +CREATE TRIGGER insert_a AFTER INSERT ON main_table +FOR EACH ROW WHEN (NEW.a = 123) EXECUTE PROCEDURE trigger_func('insert_a'); +CREATE TRIGGER delete_a AFTER DELETE ON main_table +FOR EACH ROW WHEN (OLD.a = 123) EXECUTE PROCEDURE trigger_func('delete_a'); +CREATE TRIGGER insert_when BEFORE INSERT ON main_table +FOR EACH STATEMENT WHEN (true) EXECUTE PROCEDURE trigger_func('insert_when'); +CREATE TRIGGER delete_when AFTER DELETE ON main_table +FOR EACH STATEMENT WHEN (true) EXECUTE PROCEDURE trigger_func('delete_when'); +SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, + action_order, action_condition, action_orientation, action_timing, + action_reference_old_table, action_reference_new_table + FROM information_schema.triggers + WHERE event_object_table IN ('main_table') + ORDER BY trigger_name COLLATE "C", 2; +INSERT INTO main_table (a) VALUES (123), (456); +COPY main_table FROM stdin; +/*123 999 +456 999 +\. +*/ + +DELETE FROM main_table WHERE a IN (123, 456); +UPDATE main_table SET a = 50, b = 60; +SELECT * FROM main_table ORDER BY a, b; +SELECT pg_get_triggerdef(oid, true) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'modified_a'; +SELECT pg_get_triggerdef(oid, false) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'modified_a'; +SELECT pg_get_triggerdef(oid, true) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'modified_any'; + +-- Test RENAME TRIGGER +ALTER TRIGGER modified_a ON main_table RENAME TO modified_modified_a; +SELECT count(*) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'modified_a'; +SELECT count(*) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'modified_modified_a'; + +DROP TRIGGER modified_modified_a ON main_table; +DROP TRIGGER modified_any ON main_table; +DROP TRIGGER insert_a ON main_table; +DROP TRIGGER delete_a ON main_table; +DROP TRIGGER insert_when ON main_table; +DROP TRIGGER delete_when ON main_table; + +-- Test WHEN condition accessing system columns. +create table table_with_oids(a int); +insert into table_with_oids values (1); +create trigger oid_unchanged_trig after update on table_with_oids + for each row + when (new.tableoid = old.tableoid AND new.tableoid <> 0) + execute procedure trigger_func('after_upd_oid_unchanged'); +update table_with_oids set a = a + 1; +drop table table_with_oids; + +-- Test column-level triggers +DROP TRIGGER after_upd_row_trig ON main_table; + +CREATE TRIGGER before_upd_a_row_trig BEFORE UPDATE OF a ON main_table +FOR EACH ROW EXECUTE PROCEDURE trigger_func('before_upd_a_row'); +CREATE TRIGGER after_upd_b_row_trig AFTER UPDATE OF b ON main_table +FOR EACH ROW EXECUTE PROCEDURE trigger_func('after_upd_b_row'); +CREATE TRIGGER after_upd_a_b_row_trig AFTER UPDATE OF a, b ON main_table +FOR EACH ROW EXECUTE PROCEDURE trigger_func('after_upd_a_b_row'); + +CREATE TRIGGER before_upd_a_stmt_trig BEFORE UPDATE OF a ON main_table +FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func('before_upd_a_stmt'); +CREATE TRIGGER after_upd_b_stmt_trig AFTER UPDATE OF b ON main_table +FOR EACH STATEMENT EXECUTE PROCEDURE trigger_func('after_upd_b_stmt'); + +SELECT pg_get_triggerdef(oid) FROM pg_trigger WHERE tgrelid = 'main_table'::regclass AND tgname = 'after_upd_a_b_row_trig'; + +UPDATE main_table SET a = 50; +UPDATE main_table SET b = 10; + +-- +-- Test case for bug with BEFORE trigger followed by AFTER trigger with WHEN +-- + +CREATE TABLE some_t (some_col boolean NOT NULL); +CREATE FUNCTION dummy_update_func() RETURNS trigger AS $$ +BEGIN + RAISE NOTICE 'dummy_update_func(%) called: action = %, old = %, new = %', + TG_ARGV[0], TG_OP, OLD, NEW; + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +CREATE TRIGGER some_trig_before BEFORE UPDATE ON some_t FOR EACH ROW + EXECUTE PROCEDURE dummy_update_func('before'); +CREATE TRIGGER some_trig_aftera AFTER UPDATE ON some_t FOR EACH ROW + WHEN (NOT OLD.some_col AND NEW.some_col) + EXECUTE PROCEDURE dummy_update_func('aftera'); +CREATE TRIGGER some_trig_afterb AFTER UPDATE ON some_t FOR EACH ROW + WHEN (NOT NEW.some_col) + EXECUTE PROCEDURE dummy_update_func('afterb'); +INSERT INTO some_t VALUES (TRUE); +UPDATE some_t SET some_col = TRUE; +UPDATE some_t SET some_col = FALSE; +UPDATE some_t SET some_col = TRUE; +DROP TABLE some_t; + +-- bogus cases +CREATE TRIGGER error_upd_and_col BEFORE UPDATE OR UPDATE OF a ON main_table +FOR EACH ROW EXECUTE PROCEDURE trigger_func('error_upd_and_col'); +CREATE TRIGGER error_upd_a_a BEFORE UPDATE OF a, a ON main_table +FOR EACH ROW EXECUTE PROCEDURE trigger_func('error_upd_a_a'); +CREATE TRIGGER error_ins_when BEFORE INSERT OR UPDATE ON main_table +FOR EACH ROW WHEN (OLD.a <> NEW.a) +EXECUTE PROCEDURE trigger_func('error_ins_old'); +CREATE TRIGGER error_del_when BEFORE DELETE OR UPDATE ON main_table +FOR EACH ROW WHEN (OLD.a <> NEW.a) +EXECUTE PROCEDURE trigger_func('error_del_new'); +CREATE TRIGGER error_del_when BEFORE INSERT OR UPDATE ON main_table +FOR EACH ROW WHEN (NEW.tableoid <> 0) +EXECUTE PROCEDURE trigger_func('error_when_sys_column'); +CREATE TRIGGER error_stmt_when BEFORE UPDATE OF a ON main_table +FOR EACH STATEMENT WHEN (OLD.* IS DISTINCT FROM NEW.*) +EXECUTE PROCEDURE trigger_func('error_stmt_when'); + +-- check dependency restrictions +ALTER TABLE main_table DROP COLUMN b; +-- this should succeed, but we'll roll it back to keep the triggers around +begin; +DROP TRIGGER after_upd_a_b_row_trig ON main_table; +DROP TRIGGER after_upd_b_row_trig ON main_table; +DROP TRIGGER after_upd_b_stmt_trig ON main_table; +ALTER TABLE main_table DROP COLUMN b; +rollback; + +-- Test enable/disable triggers + +create table trigtest (i serial primary key); +-- test that disabling RI triggers works +create table trigtest2 (i int references trigtest(i) on delete cascade); + +create function trigtest() returns trigger as $$ +begin + raise notice '% % % %', TG_RELNAME, TG_OP, TG_WHEN, TG_LEVEL; + return new; +end;$$ language plpgsql; + +create trigger trigtest_b_row_tg before insert or update or delete on trigtest +for each row execute procedure trigtest(); +create trigger trigtest_a_row_tg after insert or update or delete on trigtest +for each row execute procedure trigtest(); +create trigger trigtest_b_stmt_tg before insert or update or delete on trigtest +for each statement execute procedure trigtest(); +create trigger trigtest_a_stmt_tg after insert or update or delete on trigtest +for each statement execute procedure trigtest(); + +insert into trigtest default values; +alter table trigtest disable trigger trigtest_b_row_tg; +insert into trigtest default values; +alter table trigtest disable trigger user; +insert into trigtest default values; +alter table trigtest enable trigger trigtest_a_stmt_tg; +insert into trigtest default values; +set session_replication_role = replica; +insert into trigtest default values; -- does not trigger +alter table trigtest enable always trigger trigtest_a_stmt_tg; +insert into trigtest default values; -- now it does +reset session_replication_role; +insert into trigtest2 values(1); +insert into trigtest2 values(2); +delete from trigtest where i=2; +select * from trigtest2; +alter table trigtest disable trigger all; +delete from trigtest where i=1; +select * from trigtest2; +-- ensure we still insert, even when all triggers are disabled +insert into trigtest default values; +select * from trigtest; +drop table trigtest2; +drop table trigtest; + + +-- dump trigger data +CREATE TABLE trigger_test ( + i int, + v varchar +); + +CREATE OR REPLACE FUNCTION trigger_data() RETURNS trigger +LANGUAGE plpgsql AS $$ + +declare + + argstr text; + relid text; + +begin + + relid := TG_relid::regclass; + + -- plpgsql can't discover its trigger data in a hash like perl and python + -- can, or by a sort of reflection like tcl can, + -- so we have to hard code the names. + raise NOTICE 'TG_NAME: %', TG_name; + raise NOTICE 'TG_WHEN: %', TG_when; + raise NOTICE 'TG_LEVEL: %', TG_level; + raise NOTICE 'TG_OP: %', TG_op; + raise NOTICE 'TG_RELID::regclass: %', relid; + raise NOTICE 'TG_RELNAME: %', TG_relname; + raise NOTICE 'TG_TABLE_NAME: %', TG_table_name; + raise NOTICE 'TG_TABLE_SCHEMA: %', TG_table_schema; + raise NOTICE 'TG_NARGS: %', TG_nargs; + + argstr := '['; + for i in 0 .. TG_nargs - 1 loop + if i > 0 then + argstr := argstr || ', '; + end if; + argstr := argstr || TG_argv[i]; + end loop; + argstr := argstr || ']'; + raise NOTICE 'TG_ARGV: %', argstr; + + if TG_OP != 'INSERT' then + raise NOTICE 'OLD: %', OLD; + end if; + + if TG_OP != 'DELETE' then + raise NOTICE 'NEW: %', NEW; + end if; + + if TG_OP = 'DELETE' then + return OLD; + else + return NEW; + end if; + +end; +$$; + +CREATE TRIGGER show_trigger_data_trig +BEFORE INSERT OR UPDATE OR DELETE ON trigger_test +FOR EACH ROW EXECUTE PROCEDURE trigger_data(23,'skidoo'); + +insert into trigger_test values(1,'insert'); +update trigger_test set v = 'update' where i = 1; +delete from trigger_test; + +DROP TRIGGER show_trigger_data_trig on trigger_test; + +DROP FUNCTION trigger_data(); + +DROP TABLE trigger_test; + +-- +-- Test use of row comparisons on OLD/NEW +-- + +CREATE TABLE trigger_test (f1 int, f2 text, f3 text); + +-- this is the obvious (and wrong...) way to compare rows +CREATE FUNCTION mytrigger() RETURNS trigger LANGUAGE plpgsql as $$ +begin + if row(old.*) = row(new.*) then + raise notice 'row % not changed', new.f1; + else + raise notice 'row % changed', new.f1; + end if; + return new; +end$$; + +CREATE TRIGGER t +BEFORE UPDATE ON trigger_test +FOR EACH ROW EXECUTE PROCEDURE mytrigger(); + +INSERT INTO trigger_test VALUES(1, 'foo', 'bar'); +INSERT INTO trigger_test VALUES(2, 'baz', 'quux'); + +UPDATE trigger_test SET f3 = 'bar'; +UPDATE trigger_test SET f3 = NULL; +-- this demonstrates that the above isn't really working as desired: +UPDATE trigger_test SET f3 = NULL; + +-- the right way when considering nulls is +CREATE OR REPLACE FUNCTION mytrigger() RETURNS trigger LANGUAGE plpgsql as $$ +begin + if row(old.*) is distinct from row(new.*) then + raise notice 'row % changed', new.f1; + else + raise notice 'row % not changed', new.f1; + end if; + return new; +end$$; + +UPDATE trigger_test SET f3 = 'bar'; +UPDATE trigger_test SET f3 = NULL; +UPDATE trigger_test SET f3 = NULL; + +DROP TABLE trigger_test; + +DROP FUNCTION mytrigger(); + +-- Test snapshot management in serializable transactions involving triggers +-- per bug report in 6bc73d4c0910042358k3d1adff3qa36f8df75198ecea@mail.gmail.com +CREATE FUNCTION serializable_update_trig() RETURNS trigger LANGUAGE plpgsql AS +$$ +declare + rec record; +begin + new.description = 'updated in trigger'; + return new; +end; +$$; + +CREATE TABLE serializable_update_tab ( + id int, + filler text, + description text +); + +CREATE TRIGGER serializable_update_trig BEFORE UPDATE ON serializable_update_tab + FOR EACH ROW EXECUTE PROCEDURE serializable_update_trig(); + +INSERT INTO serializable_update_tab SELECT a, repeat('xyzxz', 100), 'new' + FROM generate_series(1, 50) a; + +BEGIN; +SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; +UPDATE serializable_update_tab SET description = 'no no', id = 1 WHERE id = 1; +COMMIT; +SELECT description FROM serializable_update_tab WHERE id = 1; +DROP TABLE serializable_update_tab; + +-- minimal update trigger + +CREATE TABLE min_updates_test ( + f1 text, + f2 int, + f3 int); + +INSERT INTO min_updates_test VALUES ('a',1,2),('b','2',null); + +CREATE TRIGGER z_min_update +BEFORE UPDATE ON min_updates_test +FOR EACH ROW EXECUTE PROCEDURE suppress_redundant_updates_trigger(); + +\set QUIET false + +UPDATE min_updates_test SET f1 = f1; + +UPDATE min_updates_test SET f2 = f2 + 1; + +UPDATE min_updates_test SET f3 = 2 WHERE f3 is null; + +\set QUIET true + +SELECT * FROM min_updates_test; + +DROP TABLE min_updates_test; + +-- +-- Test triggers on views +-- + +CREATE VIEW main_view AS SELECT a, b FROM main_table; + +-- VIEW trigger function +CREATE OR REPLACE FUNCTION view_trigger() RETURNS trigger +LANGUAGE plpgsql AS $$ +declare + argstr text := ''; +begin + for i in 0 .. TG_nargs - 1 loop + if i > 0 then + argstr := argstr || ', '; + end if; + argstr := argstr || TG_argv[i]; + end loop; + + raise notice '% % % % (%)', TG_RELNAME, TG_WHEN, TG_OP, TG_LEVEL, argstr; + + if TG_LEVEL = 'ROW' then + if TG_OP = 'INSERT' then + raise NOTICE 'NEW: %', NEW; + INSERT INTO main_table VALUES (NEW.a, NEW.b); + RETURN NEW; + end if; + + if TG_OP = 'UPDATE' then + raise NOTICE 'OLD: %, NEW: %', OLD, NEW; + UPDATE main_table SET a = NEW.a, b = NEW.b WHERE a = OLD.a AND b = OLD.b; + if NOT FOUND then RETURN NULL; end if; + RETURN NEW; + end if; + + if TG_OP = 'DELETE' then + raise NOTICE 'OLD: %', OLD; + DELETE FROM main_table WHERE a = OLD.a AND b = OLD.b; + if NOT FOUND then RETURN NULL; end if; + RETURN OLD; + end if; + end if; + + RETURN NULL; +end; +$$; + +-- Before row triggers aren't allowed on views +CREATE TRIGGER invalid_trig BEFORE INSERT ON main_view +FOR EACH ROW EXECUTE PROCEDURE trigger_func('before_ins_row'); + +CREATE TRIGGER invalid_trig BEFORE UPDATE ON main_view +FOR EACH ROW EXECUTE PROCEDURE trigger_func('before_upd_row'); + +CREATE TRIGGER invalid_trig BEFORE DELETE ON main_view +FOR EACH ROW EXECUTE PROCEDURE trigger_func('before_del_row'); + +-- After row triggers aren't allowed on views +CREATE TRIGGER invalid_trig AFTER INSERT ON main_view +FOR EACH ROW EXECUTE PROCEDURE trigger_func('before_ins_row'); + +CREATE TRIGGER invalid_trig AFTER UPDATE ON main_view +FOR EACH ROW EXECUTE PROCEDURE trigger_func('before_upd_row'); + +CREATE TRIGGER invalid_trig AFTER DELETE ON main_view +FOR EACH ROW EXECUTE PROCEDURE trigger_func('before_del_row'); + +-- Truncate triggers aren't allowed on views +CREATE TRIGGER invalid_trig BEFORE TRUNCATE ON main_view +EXECUTE PROCEDURE trigger_func('before_tru_row'); + +CREATE TRIGGER invalid_trig AFTER TRUNCATE ON main_view +EXECUTE PROCEDURE trigger_func('before_tru_row'); + +-- INSTEAD OF triggers aren't allowed on tables +CREATE TRIGGER invalid_trig INSTEAD OF INSERT ON main_table +FOR EACH ROW EXECUTE PROCEDURE view_trigger('instead_of_ins'); + +CREATE TRIGGER invalid_trig INSTEAD OF UPDATE ON main_table +FOR EACH ROW EXECUTE PROCEDURE view_trigger('instead_of_upd'); + +CREATE TRIGGER invalid_trig INSTEAD OF DELETE ON main_table +FOR EACH ROW EXECUTE PROCEDURE view_trigger('instead_of_del'); + +-- Don't support WHEN clauses with INSTEAD OF triggers +CREATE TRIGGER invalid_trig INSTEAD OF UPDATE ON main_view +FOR EACH ROW WHEN (OLD.a <> NEW.a) EXECUTE PROCEDURE view_trigger('instead_of_upd'); + +-- Don't support column-level INSTEAD OF triggers +CREATE TRIGGER invalid_trig INSTEAD OF UPDATE OF a ON main_view +FOR EACH ROW EXECUTE PROCEDURE view_trigger('instead_of_upd'); + +-- Don't support statement-level INSTEAD OF triggers +CREATE TRIGGER invalid_trig INSTEAD OF UPDATE ON main_view +EXECUTE PROCEDURE view_trigger('instead_of_upd'); + +-- Valid INSTEAD OF triggers +CREATE TRIGGER instead_of_insert_trig INSTEAD OF INSERT ON main_view +FOR EACH ROW EXECUTE PROCEDURE view_trigger('instead_of_ins'); + +CREATE TRIGGER instead_of_update_trig INSTEAD OF UPDATE ON main_view +FOR EACH ROW EXECUTE PROCEDURE view_trigger('instead_of_upd'); + +CREATE TRIGGER instead_of_delete_trig INSTEAD OF DELETE ON main_view +FOR EACH ROW EXECUTE PROCEDURE view_trigger('instead_of_del'); + +-- Valid BEFORE statement VIEW triggers +CREATE TRIGGER before_ins_stmt_trig BEFORE INSERT ON main_view +FOR EACH STATEMENT EXECUTE PROCEDURE view_trigger('before_view_ins_stmt'); + +CREATE TRIGGER before_upd_stmt_trig BEFORE UPDATE ON main_view +FOR EACH STATEMENT EXECUTE PROCEDURE view_trigger('before_view_upd_stmt'); + +CREATE TRIGGER before_del_stmt_trig BEFORE DELETE ON main_view +FOR EACH STATEMENT EXECUTE PROCEDURE view_trigger('before_view_del_stmt'); + +-- Valid AFTER statement VIEW triggers +CREATE TRIGGER after_ins_stmt_trig AFTER INSERT ON main_view +FOR EACH STATEMENT EXECUTE PROCEDURE view_trigger('after_view_ins_stmt'); + +CREATE TRIGGER after_upd_stmt_trig AFTER UPDATE ON main_view +FOR EACH STATEMENT EXECUTE PROCEDURE view_trigger('after_view_upd_stmt'); + +CREATE TRIGGER after_del_stmt_trig AFTER DELETE ON main_view +FOR EACH STATEMENT EXECUTE PROCEDURE view_trigger('after_view_del_stmt'); + +\set QUIET false + +-- Insert into view using trigger +INSERT INTO main_view VALUES (20, 30); +INSERT INTO main_view VALUES (21, 31) RETURNING a, b; + +-- Table trigger will prevent updates +UPDATE main_view SET b = 31 WHERE a = 20; +UPDATE main_view SET b = 32 WHERE a = 21 AND b = 31 RETURNING a, b; + +-- Remove table trigger to allow updates +DROP TRIGGER before_upd_a_row_trig ON main_table; +UPDATE main_view SET b = 31 WHERE a = 20; +UPDATE main_view SET b = 32 WHERE a = 21 AND b = 31 RETURNING a, b; + +-- Before and after stmt triggers should fire even when no rows are affected +UPDATE main_view SET b = 0 WHERE false; + +-- Delete from view using trigger +DELETE FROM main_view WHERE a IN (20,21); +DELETE FROM main_view WHERE a = 31 RETURNING a, b; + +\set QUIET true + +-- Describe view should list triggers +\d main_view + +-- Test dropping view triggers +DROP TRIGGER instead_of_insert_trig ON main_view; +DROP TRIGGER instead_of_delete_trig ON main_view; +\d+ main_view +DROP VIEW main_view; + +-- +-- Test triggers on a join view +-- +CREATE TABLE country_table ( + country_id serial primary key, + country_name text unique not null, + continent text not null +); + +INSERT INTO country_table (country_name, continent) + VALUES ('Japan', 'Asia'), + ('UK', 'Europe'), + ('USA', 'North America') + RETURNING *; + +CREATE TABLE city_table ( + city_id serial primary key, + city_name text not null, + population bigint, + country_id int references country_table +); + +CREATE VIEW city_view AS + SELECT city_id, city_name, population, country_name, continent + FROM city_table ci + LEFT JOIN country_table co ON co.country_id = ci.country_id; + +CREATE FUNCTION city_insert() RETURNS trigger LANGUAGE plpgsql AS $$ +declare + ctry_id int; +begin + if NEW.country_name IS NOT NULL then + SELECT country_id, continent INTO ctry_id, NEW.continent + FROM country_table WHERE country_name = NEW.country_name; + if NOT FOUND then + raise exception 'No such country: "%"', NEW.country_name; + end if; + else + NEW.continent := NULL; + end if; + + if NEW.city_id IS NOT NULL then + INSERT INTO city_table + VALUES(NEW.city_id, NEW.city_name, NEW.population, ctry_id); + else + INSERT INTO city_table(city_name, population, country_id) + VALUES(NEW.city_name, NEW.population, ctry_id) + RETURNING city_id INTO NEW.city_id; + end if; + + RETURN NEW; +end; +$$; + +CREATE TRIGGER city_insert_trig INSTEAD OF INSERT ON city_view +FOR EACH ROW EXECUTE PROCEDURE city_insert(); + +CREATE FUNCTION city_delete() RETURNS trigger LANGUAGE plpgsql AS $$ +begin + DELETE FROM city_table WHERE city_id = OLD.city_id; + if NOT FOUND then RETURN NULL; end if; + RETURN OLD; +end; +$$; + +CREATE TRIGGER city_delete_trig INSTEAD OF DELETE ON city_view +FOR EACH ROW EXECUTE PROCEDURE city_delete(); + +CREATE FUNCTION city_update() RETURNS trigger LANGUAGE plpgsql AS $$ +declare + ctry_id int; +begin + if NEW.country_name IS DISTINCT FROM OLD.country_name then + SELECT country_id, continent INTO ctry_id, NEW.continent + FROM country_table WHERE country_name = NEW.country_name; + if NOT FOUND then + raise exception 'No such country: "%"', NEW.country_name; + end if; + + UPDATE city_table SET city_name = NEW.city_name, + population = NEW.population, + country_id = ctry_id + WHERE city_id = OLD.city_id; + else + UPDATE city_table SET city_name = NEW.city_name, + population = NEW.population + WHERE city_id = OLD.city_id; + NEW.continent := OLD.continent; + end if; + + if NOT FOUND then RETURN NULL; end if; + RETURN NEW; +end; +$$; + +CREATE TRIGGER city_update_trig INSTEAD OF UPDATE ON city_view +FOR EACH ROW EXECUTE PROCEDURE city_update(); + +\set QUIET false + +-- INSERT .. RETURNING +INSERT INTO city_view(city_name) VALUES('Tokyo') RETURNING *; +INSERT INTO city_view(city_name, population) VALUES('London', 7556900) RETURNING *; +INSERT INTO city_view(city_name, country_name) VALUES('Washington DC', 'USA') RETURNING *; +INSERT INTO city_view(city_id, city_name) VALUES(123456, 'New York') RETURNING *; +INSERT INTO city_view VALUES(234567, 'Birmingham', 1016800, 'UK', 'EU') RETURNING *; + +-- UPDATE .. RETURNING +UPDATE city_view SET country_name = 'Japon' WHERE city_name = 'Tokyo'; -- error +UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Takyo'; -- no match +UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Tokyo' RETURNING *; -- OK + +UPDATE city_view SET population = 13010279 WHERE city_name = 'Tokyo' RETURNING *; +UPDATE city_view SET country_name = 'UK' WHERE city_name = 'New York' RETURNING *; +UPDATE city_view SET country_name = 'USA', population = 8391881 WHERE city_name = 'New York' RETURNING *; +UPDATE city_view SET continent = 'EU' WHERE continent = 'Europe' RETURNING *; +UPDATE city_view v1 SET country_name = v2.country_name FROM city_view v2 + WHERE v2.city_name = 'Birmingham' AND v1.city_name = 'London' RETURNING *; + +-- DELETE .. RETURNING +DELETE FROM city_view WHERE city_name = 'Birmingham' RETURNING *; + +\set QUIET true + +-- read-only view with WHERE clause +CREATE VIEW european_city_view AS + SELECT * FROM city_view WHERE continent = 'Europe'; +SELECT count(*) FROM european_city_view; + +CREATE FUNCTION no_op_trig_fn() RETURNS trigger LANGUAGE plpgsql +AS 'begin RETURN NULL; end'; + +CREATE TRIGGER no_op_trig INSTEAD OF INSERT OR UPDATE OR DELETE +ON european_city_view FOR EACH ROW EXECUTE PROCEDURE no_op_trig_fn(); + +\set QUIET false + +INSERT INTO european_city_view VALUES (0, 'x', 10000, 'y', 'z'); +UPDATE european_city_view SET population = 10000; +DELETE FROM european_city_view; + +\set QUIET true + +-- rules bypassing no-op triggers +CREATE RULE european_city_insert_rule AS ON INSERT TO european_city_view +DO INSTEAD INSERT INTO city_view +VALUES (NEW.city_id, NEW.city_name, NEW.population, NEW.country_name, NEW.continent) +RETURNING *; + +CREATE RULE european_city_update_rule AS ON UPDATE TO european_city_view +DO INSTEAD UPDATE city_view SET + city_name = NEW.city_name, + population = NEW.population, + country_name = NEW.country_name +WHERE city_id = OLD.city_id +RETURNING NEW.*; + +CREATE RULE european_city_delete_rule AS ON DELETE TO european_city_view +DO INSTEAD DELETE FROM city_view WHERE city_id = OLD.city_id RETURNING *; + +\set QUIET false + +-- INSERT not limited by view's WHERE clause, but UPDATE AND DELETE are +INSERT INTO european_city_view(city_name, country_name) + VALUES ('Cambridge', 'USA') RETURNING *; +UPDATE european_city_view SET country_name = 'UK' + WHERE city_name = 'Cambridge'; +DELETE FROM european_city_view WHERE city_name = 'Cambridge'; + +-- UPDATE and DELETE via rule and trigger +UPDATE city_view SET country_name = 'UK' + WHERE city_name = 'Cambridge' RETURNING *; +UPDATE european_city_view SET population = 122800 + WHERE city_name = 'Cambridge' RETURNING *; +DELETE FROM european_city_view WHERE city_name = 'Cambridge' RETURNING *; + +-- join UPDATE test +UPDATE city_view v SET population = 599657 + FROM city_table ci, country_table co + WHERE ci.city_name = 'Washington DC' and co.country_name = 'USA' + AND v.city_id = ci.city_id AND v.country_name = co.country_name + RETURNING co.country_id, v.country_name, + v.city_id, v.city_name, v.population; + +\set QUIET true + +SELECT * FROM city_view; + +DROP TABLE city_table CASCADE; +DROP TABLE country_table; + + +-- Test pg_trigger_depth() + +create table depth_a (id int not null primary key); +create table depth_b (id int not null primary key); +create table depth_c (id int not null primary key); + +create function depth_a_tf() returns trigger + language plpgsql as $$ +begin + raise notice '%: depth = %', tg_name, pg_trigger_depth(); + insert into depth_b values (new.id); + raise notice '%: depth = %', tg_name, pg_trigger_depth(); + return new; +end; +$$; +create trigger depth_a_tr before insert on depth_a + for each row execute procedure depth_a_tf(); + +create function depth_b_tf() returns trigger + language plpgsql as $$ +begin + raise notice '%: depth = %', tg_name, pg_trigger_depth(); + begin + execute 'insert into depth_c values (' || new.id::text || ')'; + exception + when sqlstate 'U9999' then + raise notice 'SQLSTATE = U9999: depth = %', pg_trigger_depth(); + end; + raise notice '%: depth = %', tg_name, pg_trigger_depth(); + if new.id = 1 then + execute 'insert into depth_c values (' || new.id::text || ')'; + end if; + return new; +end; +$$; +create trigger depth_b_tr before insert on depth_b + for each row execute procedure depth_b_tf(); + +create function depth_c_tf() returns trigger + language plpgsql as $$ +begin + raise notice '%: depth = %', tg_name, pg_trigger_depth(); + if new.id = 1 then + raise exception sqlstate 'U9999'; + end if; + raise notice '%: depth = %', tg_name, pg_trigger_depth(); + return new; +end; +$$; +create trigger depth_c_tr before insert on depth_c + for each row execute procedure depth_c_tf(); + +select pg_trigger_depth(); +insert into depth_a values (1); +select pg_trigger_depth(); +insert into depth_a values (2); +select pg_trigger_depth(); + +drop table depth_a, depth_b, depth_c; +drop function depth_a_tf(); +drop function depth_b_tf(); +drop function depth_c_tf(); + +-- +-- Test updates to rows during firing of BEFORE ROW triggers. +-- As of 9.2, such cases should be rejected (see bug #6123). +-- + +create temp table parent ( + aid int not null primary key, + val1 text, + val2 text, + val3 text, + val4 text, + bcnt int not null default 0); +create temp table child ( + bid int not null primary key, + aid int not null, + val1 text); + +create function parent_upd_func() + returns trigger language plpgsql as +$$ +begin + if old.val1 <> new.val1 then + new.val2 = new.val1; + delete from child where child.aid = new.aid and child.val1 = new.val1; + end if; + return new; +end; +$$; +create trigger parent_upd_trig before update on parent + for each row execute procedure parent_upd_func(); + +create function parent_del_func() + returns trigger language plpgsql as +$$ +begin + delete from child where aid = old.aid; + return old; +end; +$$; +create trigger parent_del_trig before delete on parent + for each row execute procedure parent_del_func(); + +create function child_ins_func() + returns trigger language plpgsql as +$$ +begin + update parent set bcnt = bcnt + 1 where aid = new.aid; + return new; +end; +$$; +create trigger child_ins_trig after insert on child + for each row execute procedure child_ins_func(); + +create function child_del_func() + returns trigger language plpgsql as +$$ +begin + update parent set bcnt = bcnt - 1 where aid = old.aid; + return old; +end; +$$; +create trigger child_del_trig after delete on child + for each row execute procedure child_del_func(); + +insert into parent values (1, 'a', 'a', 'a', 'a', 0); +insert into child values (10, 1, 'b'); +select * from parent; select * from child; + +update parent set val1 = 'b' where aid = 1; -- should fail +select * from parent; select * from child; + +delete from parent where aid = 1; -- should fail +select * from parent; select * from child; + +-- replace the trigger function with one that restarts the deletion after +-- having modified a child +create or replace function parent_del_func() + returns trigger language plpgsql as +$$ +begin + delete from child where aid = old.aid; + if found then + delete from parent where aid = old.aid; + return null; -- cancel outer deletion + end if; + return old; +end; +$$; + +delete from parent where aid = 1; +select * from parent; select * from child; + +drop table parent, child; + +drop function parent_upd_func(); +drop function parent_del_func(); +drop function child_ins_func(); +drop function child_del_func(); + +-- similar case, but with a self-referencing FK so that parent and child +-- rows can be affected by a single operation + +create temp table self_ref_trigger ( + id int primary key, + parent int references self_ref_trigger, + data text, + nchildren int not null default 0 +); + +create function self_ref_trigger_ins_func() + returns trigger language plpgsql as +$$ +begin + if new.parent is not null then + update self_ref_trigger set nchildren = nchildren + 1 + where id = new.parent; + end if; + return new; +end; +$$; +create trigger self_ref_trigger_ins_trig before insert on self_ref_trigger + for each row execute procedure self_ref_trigger_ins_func(); + +create function self_ref_trigger_del_func() + returns trigger language plpgsql as +$$ +begin + if old.parent is not null then + update self_ref_trigger set nchildren = nchildren - 1 + where id = old.parent; + end if; + return old; +end; +$$; +create trigger self_ref_trigger_del_trig before delete on self_ref_trigger + for each row execute procedure self_ref_trigger_del_func(); + +insert into self_ref_trigger values (1, null, 'root'); +insert into self_ref_trigger values (2, 1, 'root child A'); +insert into self_ref_trigger values (3, 1, 'root child B'); +insert into self_ref_trigger values (4, 2, 'grandchild 1'); +insert into self_ref_trigger values (5, 3, 'grandchild 2'); + +update self_ref_trigger set data = 'root!' where id = 1; + +select * from self_ref_trigger; + +delete from self_ref_trigger; + +select * from self_ref_trigger; + +drop table self_ref_trigger; +drop function self_ref_trigger_ins_func(); +drop function self_ref_trigger_del_func(); + +-- +-- Check that statement triggers work correctly even with all children excluded +-- + +create table stmt_trig_on_empty_upd (a int); +create table stmt_trig_on_empty_upd1 () inherits (stmt_trig_on_empty_upd); +create function update_stmt_notice() returns trigger as $$ +begin + raise notice 'updating %', TG_TABLE_NAME; + return null; +end; +$$ language plpgsql; +create trigger before_stmt_trigger + before update on stmt_trig_on_empty_upd + execute procedure update_stmt_notice(); +create trigger before_stmt_trigger + before update on stmt_trig_on_empty_upd1 + execute procedure update_stmt_notice(); + +-- inherited no-op update +update stmt_trig_on_empty_upd set a = a where false returning a+1 as aa; +-- simple no-op update +update stmt_trig_on_empty_upd1 set a = a where false returning a+1 as aa; + +drop table stmt_trig_on_empty_upd cascade; +drop function update_stmt_notice(); + +-- +-- Check that index creation (or DDL in general) is prohibited in a trigger +-- + +create table trigger_ddl_table ( + col1 integer, + col2 integer +); + +create function trigger_ddl_func() returns trigger as $$ +begin + alter table trigger_ddl_table add primary key (col1); + return new; +end$$ language plpgsql; + +create trigger trigger_ddl_func before insert on trigger_ddl_table for each row + execute procedure trigger_ddl_func(); + +insert into trigger_ddl_table values (1, 42); -- fail + +create or replace function trigger_ddl_func() returns trigger as $$ +begin + create index on trigger_ddl_table (col2); + return new; +end$$ language plpgsql; + +insert into trigger_ddl_table values (1, 42); -- fail + +drop table trigger_ddl_table; +drop function trigger_ddl_func(); + +-- +-- Verify behavior of before and after triggers with INSERT...ON CONFLICT +-- DO UPDATE +-- +create table upsert (key int4 primary key, color text); + +create function upsert_before_func() + returns trigger language plpgsql as +$$ +begin + if (TG_OP = 'UPDATE') then + raise warning 'before update (old): %', old.*::text; + raise warning 'before update (new): %', new.*::text; + elsif (TG_OP = 'INSERT') then + raise warning 'before insert (new): %', new.*::text; + if new.key % 2 = 0 then + new.key := new.key + 1; + new.color := new.color || ' trig modified'; + raise warning 'before insert (new, modified): %', new.*::text; + end if; + end if; + return new; +end; +$$; +create trigger upsert_before_trig before insert or update on upsert + for each row execute procedure upsert_before_func(); + +create function upsert_after_func() + returns trigger language plpgsql as +$$ +begin + if (TG_OP = 'UPDATE') then + raise warning 'after update (old): %', old.*::text; + raise warning 'after update (new): %', new.*::text; + elsif (TG_OP = 'INSERT') then + raise warning 'after insert (new): %', new.*::text; + end if; + return null; +end; +$$; +create trigger upsert_after_trig after insert or update on upsert + for each row execute procedure upsert_after_func(); + +insert into upsert values(1, 'black') on conflict (key) do update set color = 'updated ' || upsert.color; +insert into upsert values(2, 'red') on conflict (key) do update set color = 'updated ' || upsert.color; +insert into upsert values(3, 'orange') on conflict (key) do update set color = 'updated ' || upsert.color; +insert into upsert values(4, 'green') on conflict (key) do update set color = 'updated ' || upsert.color; +insert into upsert values(5, 'purple') on conflict (key) do update set color = 'updated ' || upsert.color; +insert into upsert values(6, 'white') on conflict (key) do update set color = 'updated ' || upsert.color; +insert into upsert values(7, 'pink') on conflict (key) do update set color = 'updated ' || upsert.color; +insert into upsert values(8, 'yellow') on conflict (key) do update set color = 'updated ' || upsert.color; + +select * from upsert; + +drop table upsert; +drop function upsert_before_func(); +drop function upsert_after_func(); + +-- +-- Verify that triggers with transition tables are not allowed on +-- views +-- + +create table my_table (i int); +create view my_view as select * from my_table; +create function my_trigger_function() returns trigger as $$ begin end; $$ language plpgsql; +create trigger my_trigger after update on my_view referencing old table as old_table + for each statement execute procedure my_trigger_function(); +drop function my_trigger_function(); +drop view my_view; +drop table my_table; + +-- +-- Verify cases that are unsupported with partitioned tables +-- +create table parted_trig (a int) partition by list (a); +create function trigger_nothing() returns trigger + language plpgsql as $$ begin end; $$; +create trigger failed instead of update on parted_trig + for each row execute procedure trigger_nothing(); +create trigger failed after update on parted_trig + referencing old table as old_table + for each row execute procedure trigger_nothing(); +drop table parted_trig; + +-- +-- Verify trigger creation for partitioned tables, and drop behavior +-- +create table trigpart (a int, b int) partition by range (a); +create table trigpart1 partition of trigpart for values from (0) to (1000); +create trigger trg1 after insert on trigpart for each row execute procedure trigger_nothing(); +create table trigpart2 partition of trigpart for values from (1000) to (2000); +create table trigpart3 (like trigpart); +alter table trigpart attach partition trigpart3 for values from (2000) to (3000); +create table trigpart4 partition of trigpart for values from (3000) to (4000) partition by range (a); +create table trigpart41 partition of trigpart4 for values from (3000) to (3500); +create table trigpart42 (like trigpart); +alter table trigpart4 attach partition trigpart42 for values from (3500) to (4000); +select tgrelid::regclass, tgname, tgfoid::regproc from pg_trigger + where tgrelid::regclass::text like 'trigpart%' order by tgrelid::regclass::text; +drop trigger trg1 on trigpart1; -- fail +drop trigger trg1 on trigpart2; -- fail +drop trigger trg1 on trigpart3; -- fail +drop table trigpart2; -- ok, trigger should be gone in that partition +select tgrelid::regclass, tgname, tgfoid::regproc from pg_trigger + where tgrelid::regclass::text like 'trigpart%' order by tgrelid::regclass::text; +drop trigger trg1 on trigpart; -- ok, all gone +select tgrelid::regclass, tgname, tgfoid::regproc from pg_trigger + where tgrelid::regclass::text like 'trigpart%' order by tgrelid::regclass::text; + +-- check detach behavior +create trigger trg1 after insert on trigpart for each row execute procedure trigger_nothing(); +\d trigpart3 +alter table trigpart detach partition trigpart3; +drop trigger trg1 on trigpart3; -- fail due to "does not exist" +alter table trigpart detach partition trigpart4; +drop trigger trg1 on trigpart41; -- fail due to "does not exist" +drop table trigpart4; +alter table trigpart attach partition trigpart3 for values from (2000) to (3000); +alter table trigpart detach partition trigpart3; +alter table trigpart attach partition trigpart3 for values from (2000) to (3000); +drop table trigpart3; + +select tgrelid::regclass::text, tgname, tgfoid::regproc, tgenabled, tgisinternal from pg_trigger + where tgname ~ '^trg1' order by 1; +create table trigpart3 (like trigpart); +create trigger trg1 after insert on trigpart3 for each row execute procedure trigger_nothing(); +\d trigpart3 +alter table trigpart attach partition trigpart3 FOR VALUES FROM (2000) to (3000); -- fail +drop table trigpart3; + +drop table trigpart; +drop function trigger_nothing(); + +-- +-- Verify that triggers are fired for partitioned tables +-- +create table parted_stmt_trig (a int) partition by list (a); +create table parted_stmt_trig1 partition of parted_stmt_trig for values in (1); +create table parted_stmt_trig2 partition of parted_stmt_trig for values in (2); + +create table parted2_stmt_trig (a int) partition by list (a); +create table parted2_stmt_trig1 partition of parted2_stmt_trig for values in (1); +create table parted2_stmt_trig2 partition of parted2_stmt_trig for values in (2); + +create or replace function trigger_notice() returns trigger as $$ + begin + raise notice 'trigger % on % % % for %', TG_NAME, TG_TABLE_NAME, TG_WHEN, TG_OP, TG_LEVEL; + if TG_LEVEL = 'ROW' then + return NEW; + end if; + return null; + end; + $$ language plpgsql; + +-- insert/update/delete statement-level triggers on the parent +create trigger trig_ins_before before insert on parted_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_ins_after after insert on parted_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_upd_before before update on parted_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_upd_after after update on parted_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_del_before before delete on parted_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_del_after after delete on parted_stmt_trig + for each statement execute procedure trigger_notice(); + +-- insert/update/delete row-level triggers on the parent +create trigger trig_ins_after_parent after insert on parted_stmt_trig + for each row execute procedure trigger_notice(); +create trigger trig_upd_after_parent after update on parted_stmt_trig + for each row execute procedure trigger_notice(); +create trigger trig_del_after_parent after delete on parted_stmt_trig + for each row execute procedure trigger_notice(); + +-- insert/update/delete row-level triggers on the first partition +create trigger trig_ins_before_child before insert on parted_stmt_trig1 + for each row execute procedure trigger_notice(); +create trigger trig_ins_after_child after insert on parted_stmt_trig1 + for each row execute procedure trigger_notice(); +create trigger trig_upd_before_child before update on parted_stmt_trig1 + for each row execute procedure trigger_notice(); +create trigger trig_upd_after_child after update on parted_stmt_trig1 + for each row execute procedure trigger_notice(); +create trigger trig_del_before_child before delete on parted_stmt_trig1 + for each row execute procedure trigger_notice(); +create trigger trig_del_after_child after delete on parted_stmt_trig1 + for each row execute procedure trigger_notice(); + +-- insert/update/delete statement-level triggers on the parent +create trigger trig_ins_before_3 before insert on parted2_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_ins_after_3 after insert on parted2_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_upd_before_3 before update on parted2_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_upd_after_3 after update on parted2_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_del_before_3 before delete on parted2_stmt_trig + for each statement execute procedure trigger_notice(); +create trigger trig_del_after_3 after delete on parted2_stmt_trig + for each statement execute procedure trigger_notice(); + +with ins (a) as ( + insert into parted2_stmt_trig values (1), (2) returning a +) insert into parted_stmt_trig select a from ins returning tableoid::regclass, a; + +with upd as ( + update parted2_stmt_trig set a = a +) update parted_stmt_trig set a = a; + +delete from parted_stmt_trig; + +-- insert via copy on the parent +copy parted_stmt_trig(a) from stdin; + +-- insert via copy on the first partition +copy parted_stmt_trig1(a) from stdin; + +-- Disabling a trigger in the parent table should disable children triggers too +alter table parted_stmt_trig disable trigger trig_ins_after_parent; +insert into parted_stmt_trig values (1); +alter table parted_stmt_trig enable trigger trig_ins_after_parent; +insert into parted_stmt_trig values (1); + +drop table parted_stmt_trig, parted2_stmt_trig; + +-- Verify that triggers fire in alphabetical order +create table parted_trig (a int) partition by range (a); +create table parted_trig_1 partition of parted_trig for values from (0) to (1000) + partition by range (a); +create table parted_trig_1_1 partition of parted_trig_1 for values from (0) to (100); +create table parted_trig_2 partition of parted_trig for values from (1000) to (2000); +create trigger zzz after insert on parted_trig for each row execute procedure trigger_notice(); +create trigger mmm after insert on parted_trig_1_1 for each row execute procedure trigger_notice(); +create trigger aaa after insert on parted_trig_1 for each row execute procedure trigger_notice(); +create trigger bbb after insert on parted_trig for each row execute procedure trigger_notice(); +create trigger qqq after insert on parted_trig_1_1 for each row execute procedure trigger_notice(); +insert into parted_trig values (50), (1500); +drop table parted_trig; + +-- Verify propagation of trigger arguments to partitions +create table parted_trig (a int) partition by list (a); +create table parted_trig1 partition of parted_trig for values in (1); +create or replace function trigger_notice() returns trigger as $$ + declare + arg1 text = TG_ARGV[0]; + arg2 integer = TG_ARGV[1]; + begin + raise notice 'trigger % on % % % for % args % %', + TG_NAME, TG_TABLE_NAME, TG_WHEN, TG_OP, TG_LEVEL, arg1, arg2; + return null; + end; + $$ language plpgsql; +create trigger aaa after insert on parted_trig + for each row execute procedure trigger_notice('quirky', 1); + +-- Verify propagation of trigger arguments to partitions attached after creating trigger +create table parted_trig2 partition of parted_trig for values in (2); +create table parted_trig3 (like parted_trig); +alter table parted_trig attach partition parted_trig3 for values in (3); +insert into parted_trig values (1), (2), (3); +drop table parted_trig; + +-- test irregular partitions (i.e., different column definitions), +-- including that the WHEN clause works +create function bark(text) returns bool language plpgsql immutable + as $$ begin raise notice '% <- woof!', $1; return true; end; $$; +create or replace function trigger_notice_ab() returns trigger as $$ + begin + raise notice 'trigger % on % % % for %: (a,b)=(%,%)', + TG_NAME, TG_TABLE_NAME, TG_WHEN, TG_OP, TG_LEVEL, + NEW.a, NEW.b; + if TG_LEVEL = 'ROW' then + return NEW; + end if; + return null; + end; + $$ language plpgsql; +create table parted_irreg_ancestor (fd text, b text, fd2 int, fd3 int, a int) + partition by range (b); +alter table parted_irreg_ancestor drop column fd, + drop column fd2, drop column fd3; +create table parted_irreg (fd int, a int, fd2 int, b text) + partition by range (b); +alter table parted_irreg drop column fd, drop column fd2; +alter table parted_irreg_ancestor attach partition parted_irreg + for values from ('aaaa') to ('zzzz'); +create table parted1_irreg (b text, fd int, a int); +alter table parted1_irreg drop column fd; +alter table parted_irreg attach partition parted1_irreg + for values from ('aaaa') to ('bbbb'); +create trigger parted_trig after insert on parted_irreg + for each row execute procedure trigger_notice_ab(); +create trigger parted_trig_odd after insert on parted_irreg for each row + when (bark(new.b) AND new.a % 2 = 1) execute procedure trigger_notice_ab(); +-- we should hear barking for every insert, but parted_trig_odd only emits +-- noise for odd values of a. parted_trig does it for all inserts. +insert into parted_irreg values (1, 'aardvark'), (2, 'aanimals'); +insert into parted1_irreg values ('aardwolf', 2); +insert into parted_irreg_ancestor values ('aasvogel', 3); +drop table parted_irreg_ancestor; + +-- Before triggers and partitions +create table parted (a int, b int, c text) partition by list (a); +create table parted_1 partition of parted for values in (1) + partition by list (b); +create table parted_1_1 partition of parted_1 for values in (1); +create function parted_trigfunc() returns trigger language plpgsql as $$ +begin + new.a = new.a + 1; + return new; +end; +$$; +insert into parted values (1, 1, 'uno uno v1'); -- works +create trigger t before insert or update or delete on parted + for each row execute function parted_trigfunc(); +insert into parted values (1, 1, 'uno uno v2'); -- fail +update parted set c = c || 'v3'; -- fail +create or replace function parted_trigfunc() returns trigger language plpgsql as $$ +begin + new.b = new.b + 1; + return new; +end; +$$; +insert into parted values (1, 1, 'uno uno v4'); -- fail +update parted set c = c || 'v5'; -- fail +create or replace function parted_trigfunc() returns trigger language plpgsql as $$ +begin + new.c = new.c || ' and so'; + return new; +end; +$$; +insert into parted values (1, 1, 'uno uno'); -- works +update parted set c = c || ' v6'; -- works +select tableoid::regclass, * from parted; + +drop table parted; +create table parted (a int, b int, c text) partition by list ((a + b)); +create or replace function parted_trigfunc() returns trigger language plpgsql as $$ +begin + new.a = new.a + new.b; + return new; +end; +$$; +create table parted_1 partition of parted for values in (1, 2); +create table parted_2 partition of parted for values in (3, 4); +create trigger t before insert or update on parted + for each row execute function parted_trigfunc(); +insert into parted values (0, 1, 'zero win'); +insert into parted values (1, 1, 'one fail'); +insert into parted values (1, 2, 'two fail'); +select * from parted; +drop table parted; +drop function parted_trigfunc(); + +-- +-- Constraint triggers and partitioned tables +create table parted_constr_ancestor (a int, b text) + partition by range (b); +create table parted_constr (a int, b text) + partition by range (b); +alter table parted_constr_ancestor attach partition parted_constr + for values from ('aaaa') to ('zzzz'); +create table parted1_constr (a int, b text); +alter table parted_constr attach partition parted1_constr + for values from ('aaaa') to ('bbbb'); +create constraint trigger parted_trig after insert on parted_constr_ancestor + deferrable + for each row execute procedure trigger_notice_ab(); +create constraint trigger parted_trig_two after insert on parted_constr + deferrable initially deferred + for each row when (bark(new.b) AND new.a % 2 = 1) + execute procedure trigger_notice_ab(); + +-- The immediate constraint is fired immediately; the WHEN clause of the +-- deferred constraint is also called immediately. The deferred constraint +-- is fired at commit time. +begin; +insert into parted_constr values (1, 'aardvark'); +insert into parted1_constr values (2, 'aardwolf'); +insert into parted_constr_ancestor values (3, 'aasvogel'); +commit; + +-- The WHEN clause is immediate, and both constraint triggers are fired at +-- commit time. +begin; +set constraints parted_trig deferred; +insert into parted_constr values (1, 'aardvark'); +insert into parted1_constr values (2, 'aardwolf'), (3, 'aasvogel'); +commit; +drop table parted_constr_ancestor; +drop function bark(text); + +-- Test that the WHEN clause is set properly to partitions +create table parted_trigger (a int, b text) partition by range (a); +create table parted_trigger_1 partition of parted_trigger for values from (0) to (1000); +create table parted_trigger_2 (drp int, a int, b text); +alter table parted_trigger_2 drop column drp; +alter table parted_trigger attach partition parted_trigger_2 for values from (1000) to (2000); +create trigger parted_trigger after update on parted_trigger + for each row when (new.a % 2 = 1 and length(old.b) >= 2) execute procedure trigger_notice_ab(); +create table parted_trigger_3 (b text, a int) partition by range (length(b)); +create table parted_trigger_3_1 partition of parted_trigger_3 for values from (1) to (3); +create table parted_trigger_3_2 partition of parted_trigger_3 for values from (3) to (5); +alter table parted_trigger attach partition parted_trigger_3 for values from (2000) to (3000); +insert into parted_trigger values + (0, 'a'), (1, 'bbb'), (2, 'bcd'), (3, 'c'), + (1000, 'c'), (1001, 'ddd'), (1002, 'efg'), (1003, 'f'), + (2000, 'e'), (2001, 'fff'), (2002, 'ghi'), (2003, 'h'); +update parted_trigger set a = a + 2; -- notice for odd 'a' values, long 'b' values +drop table parted_trigger; + +-- try a constraint trigger, also +create table parted_referenced (a int); +create table unparted_trigger (a int, b text); -- for comparison purposes +create table parted_trigger (a int, b text) partition by range (a); +create table parted_trigger_1 partition of parted_trigger for values from (0) to (1000); +create table parted_trigger_2 (drp int, a int, b text); +alter table parted_trigger_2 drop column drp; +alter table parted_trigger attach partition parted_trigger_2 for values from (1000) to (2000); +create constraint trigger parted_trigger after update on parted_trigger + from parted_referenced + for each row execute procedure trigger_notice_ab(); +create constraint trigger parted_trigger after update on unparted_trigger + from parted_referenced + for each row execute procedure trigger_notice_ab(); +create table parted_trigger_3 (b text, a int) partition by range (length(b)); +create table parted_trigger_3_1 partition of parted_trigger_3 for values from (1) to (3); +create table parted_trigger_3_2 partition of parted_trigger_3 for values from (3) to (5); +alter table parted_trigger attach partition parted_trigger_3 for values from (2000) to (3000); +select tgname, conname, t.tgrelid::regclass, t.tgconstrrelid::regclass, + c.conrelid::regclass, c.confrelid::regclass + from pg_trigger t join pg_constraint c on (t.tgconstraint = c.oid) + where tgname = 'parted_trigger' + order by t.tgrelid::regclass::text; +drop table parted_referenced, parted_trigger, unparted_trigger; + +-- verify that the "AFTER UPDATE OF columns" event is propagated correctly +create table parted_trigger (a int, b text) partition by range (a); +create table parted_trigger_1 partition of parted_trigger for values from (0) to (1000); +create table parted_trigger_2 (drp int, a int, b text); +alter table parted_trigger_2 drop column drp; +alter table parted_trigger attach partition parted_trigger_2 for values from (1000) to (2000); +create trigger parted_trigger after update of b on parted_trigger + for each row execute procedure trigger_notice_ab(); +create table parted_trigger_3 (b text, a int) partition by range (length(b)); +create table parted_trigger_3_1 partition of parted_trigger_3 for values from (1) to (4); +create table parted_trigger_3_2 partition of parted_trigger_3 for values from (4) to (8); +alter table parted_trigger attach partition parted_trigger_3 for values from (2000) to (3000); +insert into parted_trigger values (0, 'a'), (1000, 'c'), (2000, 'e'), (2001, 'eeee'); +update parted_trigger set a = a + 2; -- no notices here +update parted_trigger set b = b || 'b'; -- all triggers should fire +drop table parted_trigger; + +drop function trigger_notice_ab(); + +-- Make sure we don't end up with unnecessary copies of triggers, when +-- cloning them. +create table trg_clone (a int) partition by range (a); +create table trg_clone1 partition of trg_clone for values from (0) to (1000); +alter table trg_clone add constraint uniq unique (a) deferrable; +create table trg_clone2 partition of trg_clone for values from (1000) to (2000); +create table trg_clone3 partition of trg_clone for values from (2000) to (3000) + partition by range (a); +create table trg_clone_3_3 partition of trg_clone3 for values from (2000) to (2100); +select tgrelid::regclass, count(*) from pg_trigger + where tgrelid::regclass in ('trg_clone', 'trg_clone1', 'trg_clone2', + 'trg_clone3', 'trg_clone_3_3') + group by tgrelid::regclass order by tgrelid::regclass; +drop table trg_clone; + +-- +-- Test the interaction between transition tables and both kinds of +-- inheritance. We'll dump the contents of the transition tables in a +-- format that shows the attribute order, so that we can distinguish +-- tuple formats (though not dropped attributes). +-- + +create or replace function dump_insert() returns trigger language plpgsql as +$$ + begin + raise notice 'trigger = %, new table = %', + TG_NAME, + (select string_agg(new_table::text, ', ' order by a) from new_table); + return null; + end; +$$; + +create or replace function dump_update() returns trigger language plpgsql as +$$ + begin + raise notice 'trigger = %, old table = %, new table = %', + TG_NAME, + (select string_agg(old_table::text, ', ' order by a) from old_table), + (select string_agg(new_table::text, ', ' order by a) from new_table); + return null; + end; +$$; + +create or replace function dump_delete() returns trigger language plpgsql as +$$ + begin + raise notice 'trigger = %, old table = %', + TG_NAME, + (select string_agg(old_table::text, ', ' order by a) from old_table); + return null; + end; +$$; + +-- +-- Verify behavior of statement triggers on partition hierarchy with +-- transition tables. Tuples should appear to each trigger in the +-- format of the relation the trigger is attached to. +-- + +-- set up a partition hierarchy with some different TupleDescriptors +create table parent (a text, b int) partition by list (a); + +-- a child matching parent +create table child1 partition of parent for values in ('AAA'); + +-- a child with a dropped column +create table child2 (x int, a text, b int); +alter table child2 drop column x; +alter table parent attach partition child2 for values in ('BBB'); + +-- a child with a different column order +create table child3 (b int, a text); +alter table parent attach partition child3 for values in ('CCC'); + +create trigger parent_insert_trig + after insert on parent referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger parent_update_trig + after update on parent referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger parent_delete_trig + after delete on parent referencing old table as old_table + for each statement execute procedure dump_delete(); + +create trigger child1_insert_trig + after insert on child1 referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger child1_update_trig + after update on child1 referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger child1_delete_trig + after delete on child1 referencing old table as old_table + for each statement execute procedure dump_delete(); + +create trigger child2_insert_trig + after insert on child2 referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger child2_update_trig + after update on child2 referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger child2_delete_trig + after delete on child2 referencing old table as old_table + for each statement execute procedure dump_delete(); + +create trigger child3_insert_trig + after insert on child3 referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger child3_update_trig + after update on child3 referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger child3_delete_trig + after delete on child3 referencing old table as old_table + for each statement execute procedure dump_delete(); + +SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, + action_order, action_condition, action_orientation, action_timing, + action_reference_old_table, action_reference_new_table + FROM information_schema.triggers + WHERE event_object_table IN ('parent', 'child1', 'child2', 'child3') + ORDER BY trigger_name COLLATE "C", 2; + +-- insert directly into children sees respective child-format tuples +insert into child1 values ('AAA', 42); +insert into child2 values ('BBB', 42); +insert into child3 values (42, 'CCC'); + +-- update via parent sees parent-format tuples +update parent set b = b + 1; + +-- delete via parent sees parent-format tuples +delete from parent; + +-- insert into parent sees parent-format tuples +insert into parent values ('AAA', 42); +insert into parent values ('BBB', 42); +insert into parent values ('CCC', 42); + +-- delete from children sees respective child-format tuples +delete from child1; +delete from child2; +delete from child3; + +-- copy into parent sees parent-format tuples +copy parent (a, b) from stdin; + +-- DML affecting parent sees tuples collected from children even if +-- there is no transition table trigger on the children +drop trigger child1_insert_trig on child1; +drop trigger child1_update_trig on child1; +drop trigger child1_delete_trig on child1; +drop trigger child2_insert_trig on child2; +drop trigger child2_update_trig on child2; +drop trigger child2_delete_trig on child2; +drop trigger child3_insert_trig on child3; +drop trigger child3_update_trig on child3; +drop trigger child3_delete_trig on child3; +delete from parent; + +-- copy into parent sees tuples collected from children even if there +-- is no transition-table trigger on the children +copy parent (a, b) from stdin; + +-- insert into parent with a before trigger on a child tuple before +-- insertion, and we capture the newly modified row in parent format +create or replace function intercept_insert() returns trigger language plpgsql as +$$ + begin + new.b = new.b + 1000; + return new; + end; +$$; + +create trigger intercept_insert_child3 + before insert on child3 + for each row execute procedure intercept_insert(); + + +-- insert, parent trigger sees post-modification parent-format tuple +insert into parent values ('AAA', 42), ('BBB', 42), ('CCC', 66); + +-- copy, parent trigger sees post-modification parent-format tuple +copy parent (a, b) from stdin; + +drop table child1, child2, child3, parent; +drop function intercept_insert(); + +-- +-- Verify prohibition of row triggers with transition triggers on +-- partitions +-- +create table parent (a text, b int) partition by list (a); +create table child partition of parent for values in ('AAA'); + +-- adding row trigger with transition table fails +create trigger child_row_trig + after insert on child referencing new table as new_table + for each row execute procedure dump_insert(); + +-- detaching it first works +alter table parent detach partition child; + +create trigger child_row_trig + after insert on child referencing new table as new_table + for each row execute procedure dump_insert(); + +-- but now we're not allowed to reattach it +alter table parent attach partition child for values in ('AAA'); + +-- drop the trigger, and now we're allowed to attach it again +drop trigger child_row_trig on child; +alter table parent attach partition child for values in ('AAA'); + +drop table child, parent; + +-- +-- Verify behavior of statement triggers on (non-partition) +-- inheritance hierarchy with transition tables; similar to the +-- partition case, except there is no rerouting on insertion and child +-- tables can have extra columns +-- + +-- set up inheritance hierarchy with different TupleDescriptors +create table parent (a text, b int); + +-- a child matching parent +create table child1 () inherits (parent); + +-- a child with a different column order +create table child2 (b int, a text); +alter table child2 inherit parent; + +-- a child with an extra column +create table child3 (c text) inherits (parent); + +create trigger parent_insert_trig + after insert on parent referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger parent_update_trig + after update on parent referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger parent_delete_trig + after delete on parent referencing old table as old_table + for each statement execute procedure dump_delete(); + +create trigger child1_insert_trig + after insert on child1 referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger child1_update_trig + after update on child1 referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger child1_delete_trig + after delete on child1 referencing old table as old_table + for each statement execute procedure dump_delete(); + +create trigger child2_insert_trig + after insert on child2 referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger child2_update_trig + after update on child2 referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger child2_delete_trig + after delete on child2 referencing old table as old_table + for each statement execute procedure dump_delete(); + +create trigger child3_insert_trig + after insert on child3 referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger child3_update_trig + after update on child3 referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger child3_delete_trig + after delete on child3 referencing old table as old_table + for each statement execute procedure dump_delete(); + +-- insert directly into children sees respective child-format tuples +insert into child1 values ('AAA', 42); +insert into child2 values (42, 'BBB'); +insert into child3 values ('CCC', 42, 'foo'); + +-- update via parent sees parent-format tuples +update parent set b = b + 1; + +-- delete via parent sees parent-format tuples +delete from parent; + +-- reinsert values into children for next test... +insert into child1 values ('AAA', 42); +insert into child2 values (42, 'BBB'); +insert into child3 values ('CCC', 42, 'foo'); + +-- delete from children sees respective child-format tuples +delete from child1; +delete from child2; +delete from child3; + +-- copy into parent sees parent-format tuples (no rerouting, so these +-- are really inserted into the parent) +copy parent (a, b) from stdin; + +-- same behavior for copy if there is an index (interesting because rows are +-- captured by a different code path in copy.c if there are indexes) +create index on parent(b); +copy parent (a, b) from stdin; + +-- DML affecting parent sees tuples collected from children even if +-- there is no transition table trigger on the children +drop trigger child1_insert_trig on child1; +drop trigger child1_update_trig on child1; +drop trigger child1_delete_trig on child1; +drop trigger child2_insert_trig on child2; +drop trigger child2_update_trig on child2; +drop trigger child2_delete_trig on child2; +drop trigger child3_insert_trig on child3; +drop trigger child3_update_trig on child3; +drop trigger child3_delete_trig on child3; +delete from parent; + +drop table child1, child2, child3, parent; + +-- +-- Verify prohibition of row triggers with transition triggers on +-- inheritance children +-- +create table parent (a text, b int); +create table child () inherits (parent); + +-- adding row trigger with transition table fails +create trigger child_row_trig + after insert on child referencing new table as new_table + for each row execute procedure dump_insert(); + +-- disinheriting it first works +alter table child no inherit parent; + +create trigger child_row_trig + after insert on child referencing new table as new_table + for each row execute procedure dump_insert(); + +-- but now we're not allowed to make it inherit anymore +alter table child inherit parent; + +-- drop the trigger, and now we're allowed to make it inherit again +drop trigger child_row_trig on child; +alter table child inherit parent; + +drop table child, parent; + +-- +-- Verify behavior of queries with wCTEs, where multiple transition +-- tuplestores can be active at the same time because there are +-- multiple DML statements that might fire triggers with transition +-- tables +-- +create table table1 (a int); +create table table2 (a text); +create trigger table1_trig + after insert on table1 referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger table2_trig + after insert on table2 referencing new table as new_table + for each statement execute procedure dump_insert(); + +with wcte as (insert into table1 values (42)) + insert into table2 values ('hello world'); + +with wcte as (insert into table1 values (43)) + insert into table1 values (44); + +select * from table1; +select * from table2; + +drop table table1; +drop table table2; + +-- +-- Verify behavior of INSERT ... ON CONFLICT DO UPDATE ... with +-- transition tables. +-- + +create table my_table (a int primary key, b text); +create trigger my_table_insert_trig + after insert on my_table referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger my_table_update_trig + after update on my_table referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); + +-- inserts only +insert into my_table values (1, 'AAA'), (2, 'BBB') + on conflict (a) do + update set b = my_table.b || ':' || excluded.b; + +-- mixture of inserts and updates +insert into my_table values (1, 'AAA'), (2, 'BBB'), (3, 'CCC'), (4, 'DDD') + on conflict (a) do + update set b = my_table.b || ':' || excluded.b; + +-- updates only +insert into my_table values (3, 'CCC'), (4, 'DDD') + on conflict (a) do + update set b = my_table.b || ':' || excluded.b; + +-- +-- now using a partitioned table +-- + +create table iocdu_tt_parted (a int primary key, b text) partition by list (a); +create table iocdu_tt_parted1 partition of iocdu_tt_parted for values in (1); +create table iocdu_tt_parted2 partition of iocdu_tt_parted for values in (2); +create table iocdu_tt_parted3 partition of iocdu_tt_parted for values in (3); +create table iocdu_tt_parted4 partition of iocdu_tt_parted for values in (4); +create trigger iocdu_tt_parted_insert_trig + after insert on iocdu_tt_parted referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger iocdu_tt_parted_update_trig + after update on iocdu_tt_parted referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); + +-- inserts only +insert into iocdu_tt_parted values (1, 'AAA'), (2, 'BBB') + on conflict (a) do + update set b = iocdu_tt_parted.b || ':' || excluded.b; + +-- mixture of inserts and updates +insert into iocdu_tt_parted values (1, 'AAA'), (2, 'BBB'), (3, 'CCC'), (4, 'DDD') + on conflict (a) do + update set b = iocdu_tt_parted.b || ':' || excluded.b; + +-- updates only +insert into iocdu_tt_parted values (3, 'CCC'), (4, 'DDD') + on conflict (a) do + update set b = iocdu_tt_parted.b || ':' || excluded.b; + +drop table iocdu_tt_parted; + +-- +-- Verify that you can't create a trigger with transition tables for +-- more than one event. +-- + +create trigger my_table_multievent_trig + after insert or update on my_table referencing new table as new_table + for each statement execute procedure dump_insert(); + +-- +-- Verify that you can't create a trigger with transition tables with +-- a column list. +-- + +create trigger my_table_col_update_trig + after update of b on my_table referencing new table as new_table + for each statement execute procedure dump_insert(); + +drop table my_table; + +-- +-- Test firing of triggers with transition tables by foreign key cascades +-- + +create table refd_table (a int primary key, b text); +create table trig_table (a int, b text, + foreign key (a) references refd_table on update cascade on delete cascade +); + +create trigger trig_table_before_trig + before insert or update or delete on trig_table + for each statement execute procedure trigger_func('trig_table'); +create trigger trig_table_insert_trig + after insert on trig_table referencing new table as new_table + for each statement execute procedure dump_insert(); +create trigger trig_table_update_trig + after update on trig_table referencing old table as old_table new table as new_table + for each statement execute procedure dump_update(); +create trigger trig_table_delete_trig + after delete on trig_table referencing old table as old_table + for each statement execute procedure dump_delete(); + +insert into refd_table values + (1, 'one'), + (2, 'two'), + (3, 'three'); +insert into trig_table values + (1, 'one a'), + (1, 'one b'), + (2, 'two a'), + (2, 'two b'), + (3, 'three a'), + (3, 'three b'); + +update refd_table set a = 11 where b = 'one'; + +select * from trig_table; + +delete from refd_table where length(b) = 3; + +select * from trig_table; + +drop table refd_table, trig_table; + +-- +-- self-referential FKs are even more fun +-- + +create table self_ref (a int primary key, + b int references self_ref(a) on delete cascade); + +create trigger self_ref_before_trig + before delete on self_ref + for each statement execute procedure trigger_func('self_ref'); +create trigger self_ref_r_trig + after delete on self_ref referencing old table as old_table + for each row execute procedure dump_delete(); +create trigger self_ref_s_trig + after delete on self_ref referencing old table as old_table + for each statement execute procedure dump_delete(); + +insert into self_ref values (1, null), (2, 1), (3, 2); + +delete from self_ref where a = 1; + +-- without AR trigger, cascaded deletes all end up in one transition table +drop trigger self_ref_r_trig on self_ref; + +insert into self_ref values (1, null), (2, 1), (3, 2), (4, 3); + +delete from self_ref where a = 1; + +drop table self_ref; + +-- cleanup +drop function dump_insert(); +drop function dump_update(); +drop function dump_delete(); + +-- Leave around some objects for other tests +create table trigger_parted (a int primary key) partition by list (a); +create function trigger_parted_trigfunc() returns trigger language plpgsql as + $$ begin end; $$; +create trigger aft_row after insert or update on trigger_parted + for each row execute function trigger_parted_trigfunc(); +create table trigger_parted_p1 partition of trigger_parted for values in (1) + partition by list (a); +create table trigger_parted_p1_1 partition of trigger_parted_p1 for values in (1); diff --git a/postgresql/examples/truncate.sql b/postgresql/examples/truncate.sql new file mode 100644 index 0000000..54f26e3 --- /dev/null +++ b/postgresql/examples/truncate.sql @@ -0,0 +1,329 @@ +-- Test basic TRUNCATE functionality. +CREATE TABLE truncate_a (col1 integer primary key); +INSERT INTO truncate_a VALUES (1); +INSERT INTO truncate_a VALUES (2); +SELECT * FROM truncate_a; +-- Roll truncate back +BEGIN; +TRUNCATE truncate_a; +ROLLBACK; +SELECT * FROM truncate_a; +-- Commit the truncate this time +BEGIN; +TRUNCATE truncate_a; +COMMIT; +SELECT * FROM truncate_a; + +-- Test foreign-key checks +CREATE TABLE trunc_b (a int REFERENCES truncate_a); +CREATE TABLE trunc_c (a serial PRIMARY KEY); +CREATE TABLE trunc_d (a int REFERENCES trunc_c); +CREATE TABLE trunc_e (a int REFERENCES truncate_a, b int REFERENCES trunc_c); + +TRUNCATE TABLE truncate_a; -- fail +TRUNCATE TABLE truncate_a,trunc_b; -- fail +TRUNCATE TABLE truncate_a,trunc_b,trunc_e; -- ok +TRUNCATE TABLE truncate_a,trunc_e; -- fail +TRUNCATE TABLE trunc_c; -- fail +TRUNCATE TABLE trunc_c,trunc_d; -- fail +TRUNCATE TABLE trunc_c,trunc_d,trunc_e; -- ok +TRUNCATE TABLE trunc_c,trunc_d,trunc_e,truncate_a; -- fail +TRUNCATE TABLE trunc_c,trunc_d,trunc_e,truncate_a,trunc_b; -- ok + +TRUNCATE TABLE truncate_a RESTRICT; -- fail +TRUNCATE TABLE truncate_a CASCADE; -- ok + +-- circular references +ALTER TABLE truncate_a ADD FOREIGN KEY (col1) REFERENCES trunc_c; + +-- Add some data to verify that truncating actually works ... +INSERT INTO trunc_c VALUES (1); +INSERT INTO truncate_a VALUES (1); +INSERT INTO trunc_b VALUES (1); +INSERT INTO trunc_d VALUES (1); +INSERT INTO trunc_e VALUES (1,1); +TRUNCATE TABLE trunc_c; +TRUNCATE TABLE trunc_c,truncate_a; +TRUNCATE TABLE trunc_c,truncate_a,trunc_d; +TRUNCATE TABLE trunc_c,truncate_a,trunc_d,trunc_e; +TRUNCATE TABLE trunc_c,truncate_a,trunc_d,trunc_e,trunc_b; + +-- Verify that truncating did actually work +SELECT * FROM truncate_a + UNION ALL + SELECT * FROM trunc_c + UNION ALL + SELECT * FROM trunc_b + UNION ALL + SELECT * FROM trunc_d; +SELECT * FROM trunc_e; + +-- Add data again to test TRUNCATE ... CASCADE +INSERT INTO trunc_c VALUES (1); +INSERT INTO truncate_a VALUES (1); +INSERT INTO trunc_b VALUES (1); +INSERT INTO trunc_d VALUES (1); +INSERT INTO trunc_e VALUES (1,1); + +TRUNCATE TABLE trunc_c CASCADE; -- ok + +SELECT * FROM truncate_a + UNION ALL + SELECT * FROM trunc_c + UNION ALL + SELECT * FROM trunc_b + UNION ALL + SELECT * FROM trunc_d; +SELECT * FROM trunc_e; + +DROP TABLE truncate_a,trunc_c,trunc_b,trunc_d,trunc_e CASCADE; + +-- Test TRUNCATE with inheritance + +CREATE TABLE trunc_f (col1 integer primary key); +INSERT INTO trunc_f VALUES (1); +INSERT INTO trunc_f VALUES (2); + +CREATE TABLE trunc_fa (col2a text) INHERITS (trunc_f); +INSERT INTO trunc_fa VALUES (3, 'three'); + +CREATE TABLE trunc_fb (col2b int) INHERITS (trunc_f); +INSERT INTO trunc_fb VALUES (4, 444); + +CREATE TABLE trunc_faa (col3 text) INHERITS (trunc_fa); +INSERT INTO trunc_faa VALUES (5, 'five', 'FIVE'); + +BEGIN; +SELECT * FROM trunc_f; +TRUNCATE trunc_f; +SELECT * FROM trunc_f; +ROLLBACK; + +BEGIN; +SELECT * FROM trunc_f; +TRUNCATE ONLY trunc_f; +SELECT * FROM trunc_f; +ROLLBACK; + +BEGIN; +SELECT * FROM trunc_f; +SELECT * FROM trunc_fa; +SELECT * FROM trunc_faa; +TRUNCATE ONLY trunc_fb, ONLY trunc_fa; +SELECT * FROM trunc_f; +SELECT * FROM trunc_fa; +SELECT * FROM trunc_faa; +ROLLBACK; + +BEGIN; +SELECT * FROM trunc_f; +SELECT * FROM trunc_fa; +SELECT * FROM trunc_faa; +TRUNCATE ONLY trunc_fb, trunc_fa; +SELECT * FROM trunc_f; +SELECT * FROM trunc_fa; +SELECT * FROM trunc_faa; +ROLLBACK; + +DROP TABLE trunc_f CASCADE; + +-- Test ON TRUNCATE triggers + +CREATE TABLE trunc_trigger_test (f1 int, f2 text, f3 text); +CREATE TABLE trunc_trigger_log (tgop text, tglevel text, tgwhen text, + tgargv text, tgtable name, rowcount bigint); + +CREATE FUNCTION trunctrigger() RETURNS trigger as $$ +declare c bigint; +begin + execute 'select count(*) from ' || quote_ident(tg_table_name) into c; + insert into trunc_trigger_log values + (TG_OP, TG_LEVEL, TG_WHEN, TG_ARGV[0], tg_table_name, c); + return null; +end; +$$ LANGUAGE plpgsql; + +-- basic before trigger +INSERT INTO trunc_trigger_test VALUES(1, 'foo', 'bar'), (2, 'baz', 'quux'); + +CREATE TRIGGER t +BEFORE TRUNCATE ON trunc_trigger_test +FOR EACH STATEMENT +EXECUTE PROCEDURE trunctrigger('before trigger truncate'); + +SELECT count(*) as "Row count in test table" FROM trunc_trigger_test; +SELECT * FROM trunc_trigger_log; +TRUNCATE trunc_trigger_test; +SELECT count(*) as "Row count in test table" FROM trunc_trigger_test; +SELECT * FROM trunc_trigger_log; + +DROP TRIGGER t ON trunc_trigger_test; + +truncate trunc_trigger_log; + +-- same test with an after trigger +INSERT INTO trunc_trigger_test VALUES(1, 'foo', 'bar'), (2, 'baz', 'quux'); + +CREATE TRIGGER tt +AFTER TRUNCATE ON trunc_trigger_test +FOR EACH STATEMENT +EXECUTE PROCEDURE trunctrigger('after trigger truncate'); + +SELECT count(*) as "Row count in test table" FROM trunc_trigger_test; +SELECT * FROM trunc_trigger_log; +TRUNCATE trunc_trigger_test; +SELECT count(*) as "Row count in test table" FROM trunc_trigger_test; +SELECT * FROM trunc_trigger_log; + +DROP TABLE trunc_trigger_test; +DROP TABLE trunc_trigger_log; + +DROP FUNCTION trunctrigger(); + +-- test TRUNCATE ... RESTART IDENTITY +CREATE SEQUENCE truncate_a_id1 START WITH 33; +CREATE TABLE truncate_a (id serial, + id1 integer default nextval('truncate_a_id1')); +ALTER SEQUENCE truncate_a_id1 OWNED BY truncate_a.id1; + +INSERT INTO truncate_a DEFAULT VALUES; +INSERT INTO truncate_a DEFAULT VALUES; +SELECT * FROM truncate_a; + +TRUNCATE truncate_a; + +INSERT INTO truncate_a DEFAULT VALUES; +INSERT INTO truncate_a DEFAULT VALUES; +SELECT * FROM truncate_a; + +TRUNCATE truncate_a RESTART IDENTITY; + +INSERT INTO truncate_a DEFAULT VALUES; +INSERT INTO truncate_a DEFAULT VALUES; +SELECT * FROM truncate_a; + +CREATE TABLE truncate_b (id int GENERATED ALWAYS AS IDENTITY (START WITH 44)); + +INSERT INTO truncate_b DEFAULT VALUES; +INSERT INTO truncate_b DEFAULT VALUES; +SELECT * FROM truncate_b; + +TRUNCATE truncate_b; + +INSERT INTO truncate_b DEFAULT VALUES; +INSERT INTO truncate_b DEFAULT VALUES; +SELECT * FROM truncate_b; + +TRUNCATE truncate_b RESTART IDENTITY; + +INSERT INTO truncate_b DEFAULT VALUES; +INSERT INTO truncate_b DEFAULT VALUES; +SELECT * FROM truncate_b; + +-- check rollback of a RESTART IDENTITY operation +BEGIN; +TRUNCATE truncate_a RESTART IDENTITY; +INSERT INTO truncate_a DEFAULT VALUES; +SELECT * FROM truncate_a; +ROLLBACK; +INSERT INTO truncate_a DEFAULT VALUES; +INSERT INTO truncate_a DEFAULT VALUES; +SELECT * FROM truncate_a; + +DROP TABLE truncate_a; + +SELECT nextval('truncate_a_id1'); -- fail, seq should have been dropped + +-- partitioned table +CREATE TABLE truncparted (a int, b char) PARTITION BY LIST (a); +-- error, can't truncate a partitioned table +TRUNCATE ONLY truncparted; +CREATE TABLE truncparted1 PARTITION OF truncparted FOR VALUES IN (1); +INSERT INTO truncparted VALUES (1, 'a'); +-- error, must truncate partitions +TRUNCATE ONLY truncparted; +TRUNCATE truncparted; +DROP TABLE truncparted; + +-- foreign key on partitioned table: partition key is referencing column. +-- Make sure truncate did execute on all tables +CREATE FUNCTION tp_ins_data() RETURNS void LANGUAGE plpgsql AS $$ + BEGIN + INSERT INTO truncprim VALUES (1), (100), (150); + INSERT INTO truncpart VALUES (1), (100), (150); + END +$$; +CREATE FUNCTION tp_chk_data(OUT pktb regclass, OUT pkval int, OUT fktb regclass, OUT fkval int) + RETURNS SETOF record LANGUAGE plpgsql AS $$ + BEGIN + RETURN QUERY SELECT + pk.tableoid::regclass, pk.a, fk.tableoid::regclass, fk.a + FROM truncprim pk FULL JOIN truncpart fk USING (a) + ORDER BY 2, 4; + END +$$; +CREATE TABLE truncprim (a int PRIMARY KEY); +CREATE TABLE truncpart (a int REFERENCES truncprim) + PARTITION BY RANGE (a); +CREATE TABLE truncpart_1 PARTITION OF truncpart FOR VALUES FROM (0) TO (100); +CREATE TABLE truncpart_2 PARTITION OF truncpart FOR VALUES FROM (100) TO (200) + PARTITION BY RANGE (a); +CREATE TABLE truncpart_2_1 PARTITION OF truncpart_2 FOR VALUES FROM (100) TO (150); +CREATE TABLE truncpart_2_d PARTITION OF truncpart_2 DEFAULT; + +TRUNCATE TABLE truncprim; -- should fail + +select tp_ins_data(); +-- should truncate everything +TRUNCATE TABLE truncprim, truncpart; +select * from tp_chk_data(); + +select tp_ins_data(); +-- should truncate everything +TRUNCATE TABLE truncprim CASCADE; +SELECT * FROM tp_chk_data(); + +SELECT tp_ins_data(); +-- should truncate all partitions +TRUNCATE TABLE truncpart; +SELECT * FROM tp_chk_data(); +DROP TABLE truncprim, truncpart; +DROP FUNCTION tp_ins_data(), tp_chk_data(); + +-- test cascade when referencing a partitioned table +CREATE TABLE trunc_a (a INT PRIMARY KEY) PARTITION BY RANGE (a); +CREATE TABLE trunc_a1 PARTITION OF trunc_a FOR VALUES FROM (0) TO (10); +CREATE TABLE trunc_a2 PARTITION OF trunc_a FOR VALUES FROM (10) TO (20) + PARTITION BY RANGE (a); +CREATE TABLE trunc_a21 PARTITION OF trunc_a2 FOR VALUES FROM (10) TO (12); +CREATE TABLE trunc_a22 PARTITION OF trunc_a2 FOR VALUES FROM (12) TO (16); +CREATE TABLE trunc_a2d PARTITION OF trunc_a2 DEFAULT; +CREATE TABLE trunc_a3 PARTITION OF trunc_a FOR VALUES FROM (20) TO (30); +INSERT INTO trunc_a VALUES (0), (5), (10), (15), (20), (25); + +-- truncate a partition cascading to a table +CREATE TABLE ref_b ( + b INT PRIMARY KEY, + a INT REFERENCES trunc_a(a) ON DELETE CASCADE +); +INSERT INTO ref_b VALUES (10, 0), (50, 5), (100, 10), (150, 15); + +TRUNCATE TABLE trunc_a1 CASCADE; +SELECT a FROM ref_b; + +DROP TABLE ref_b; + +-- truncate a partition cascading to a partitioned table +CREATE TABLE ref_c ( + c INT PRIMARY KEY, + a INT REFERENCES trunc_a(a) ON DELETE CASCADE +) PARTITION BY RANGE (c); +CREATE TABLE ref_c1 PARTITION OF ref_c FOR VALUES FROM (100) TO (200); +CREATE TABLE ref_c2 PARTITION OF ref_c FOR VALUES FROM (200) TO (300); +INSERT INTO ref_c VALUES (100, 10), (150, 15), (200, 20), (250, 25); + +TRUNCATE TABLE trunc_a21 CASCADE; +SELECT a as "from table ref_c" FROM ref_c; +SELECT a as "from table trunc_a" FROM trunc_a ORDER BY a; + +DROP TABLE trunc_a, ref_c; diff --git a/postgresql/examples/tsdicts.sql b/postgresql/examples/tsdicts.sql new file mode 100644 index 0000000..ddc6c7f --- /dev/null +++ b/postgresql/examples/tsdicts.sql @@ -0,0 +1,253 @@ +--Test text search dictionaries and configurations + +-- Test ISpell dictionary with ispell affix file +CREATE TEXT SEARCH DICTIONARY ispell ( + Template=ispell, + DictFile=ispell_sample, + AffFile=ispell_sample +); + +SELECT ts_lexize('ispell', 'skies'); +SELECT ts_lexize('ispell', 'bookings'); +SELECT ts_lexize('ispell', 'booking'); +SELECT ts_lexize('ispell', 'foot'); +SELECT ts_lexize('ispell', 'foots'); +SELECT ts_lexize('ispell', 'rebookings'); +SELECT ts_lexize('ispell', 'rebooking'); +SELECT ts_lexize('ispell', 'rebook'); +SELECT ts_lexize('ispell', 'unbookings'); +SELECT ts_lexize('ispell', 'unbooking'); +SELECT ts_lexize('ispell', 'unbook'); + +SELECT ts_lexize('ispell', 'footklubber'); +SELECT ts_lexize('ispell', 'footballklubber'); +SELECT ts_lexize('ispell', 'ballyklubber'); +SELECT ts_lexize('ispell', 'footballyklubber'); + +-- Test ISpell dictionary with hunspell affix file +CREATE TEXT SEARCH DICTIONARY hunspell ( + Template=ispell, + DictFile=ispell_sample, + AffFile=hunspell_sample +); + +SELECT ts_lexize('hunspell', 'skies'); +SELECT ts_lexize('hunspell', 'bookings'); +SELECT ts_lexize('hunspell', 'booking'); +SELECT ts_lexize('hunspell', 'foot'); +SELECT ts_lexize('hunspell', 'foots'); +SELECT ts_lexize('hunspell', 'rebookings'); +SELECT ts_lexize('hunspell', 'rebooking'); +SELECT ts_lexize('hunspell', 'rebook'); +SELECT ts_lexize('hunspell', 'unbookings'); +SELECT ts_lexize('hunspell', 'unbooking'); +SELECT ts_lexize('hunspell', 'unbook'); + +SELECT ts_lexize('hunspell', 'footklubber'); +SELECT ts_lexize('hunspell', 'footballklubber'); +SELECT ts_lexize('hunspell', 'ballyklubber'); +SELECT ts_lexize('hunspell', 'footballyklubber'); + +-- Test ISpell dictionary with hunspell affix file with FLAG long parameter +CREATE TEXT SEARCH DICTIONARY hunspell_long ( + Template=ispell, + DictFile=hunspell_sample_long, + AffFile=hunspell_sample_long +); + +SELECT ts_lexize('hunspell_long', 'skies'); +SELECT ts_lexize('hunspell_long', 'bookings'); +SELECT ts_lexize('hunspell_long', 'booking'); +SELECT ts_lexize('hunspell_long', 'foot'); +SELECT ts_lexize('hunspell_long', 'foots'); +SELECT ts_lexize('hunspell_long', 'rebookings'); +SELECT ts_lexize('hunspell_long', 'rebooking'); +SELECT ts_lexize('hunspell_long', 'rebook'); +SELECT ts_lexize('hunspell_long', 'unbookings'); +SELECT ts_lexize('hunspell_long', 'unbooking'); +SELECT ts_lexize('hunspell_long', 'unbook'); +SELECT ts_lexize('hunspell_long', 'booked'); + +SELECT ts_lexize('hunspell_long', 'footklubber'); +SELECT ts_lexize('hunspell_long', 'footballklubber'); +SELECT ts_lexize('hunspell_long', 'ballyklubber'); +SELECT ts_lexize('hunspell_long', 'ballsklubber'); +SELECT ts_lexize('hunspell_long', 'footballyklubber'); +SELECT ts_lexize('hunspell_long', 'ex-machina'); + +-- Test ISpell dictionary with hunspell affix file with FLAG num parameter +CREATE TEXT SEARCH DICTIONARY hunspell_num ( + Template=ispell, + DictFile=hunspell_sample_num, + AffFile=hunspell_sample_num +); + +SELECT ts_lexize('hunspell_num', 'skies'); +SELECT ts_lexize('hunspell_num', 'sk'); +SELECT ts_lexize('hunspell_num', 'bookings'); +SELECT ts_lexize('hunspell_num', 'booking'); +SELECT ts_lexize('hunspell_num', 'foot'); +SELECT ts_lexize('hunspell_num', 'foots'); +SELECT ts_lexize('hunspell_num', 'rebookings'); +SELECT ts_lexize('hunspell_num', 'rebooking'); +SELECT ts_lexize('hunspell_num', 'rebook'); +SELECT ts_lexize('hunspell_num', 'unbookings'); +SELECT ts_lexize('hunspell_num', 'unbooking'); +SELECT ts_lexize('hunspell_num', 'unbook'); +SELECT ts_lexize('hunspell_num', 'booked'); + +SELECT ts_lexize('hunspell_num', 'footklubber'); +SELECT ts_lexize('hunspell_num', 'footballklubber'); +SELECT ts_lexize('hunspell_num', 'ballyklubber'); +SELECT ts_lexize('hunspell_num', 'footballyklubber'); + +-- Test suitability of affix and dict files +CREATE TEXT SEARCH DICTIONARY hunspell_err ( + Template=ispell, + DictFile=ispell_sample, + AffFile=hunspell_sample_long +); + +CREATE TEXT SEARCH DICTIONARY hunspell_err ( + Template=ispell, + DictFile=ispell_sample, + AffFile=hunspell_sample_num +); + +CREATE TEXT SEARCH DICTIONARY hunspell_invalid_1 ( + Template=ispell, + DictFile=hunspell_sample_long, + AffFile=ispell_sample +); + +CREATE TEXT SEARCH DICTIONARY hunspell_invalid_2 ( + Template=ispell, + DictFile=hunspell_sample_long, + AffFile=hunspell_sample_num +); + +CREATE TEXT SEARCH DICTIONARY hunspell_invalid_3 ( + Template=ispell, + DictFile=hunspell_sample_num, + AffFile=ispell_sample +); + +CREATE TEXT SEARCH DICTIONARY hunspell_err ( + Template=ispell, + DictFile=hunspell_sample_num, + AffFile=hunspell_sample_long +); + +-- Synonym dictionary +CREATE TEXT SEARCH DICTIONARY synonym ( + Template=synonym, + Synonyms=synonym_sample +); + +SELECT ts_lexize('synonym', 'PoStGrEs'); +SELECT ts_lexize('synonym', 'Gogle'); +SELECT ts_lexize('synonym', 'indices'); + +-- test altering boolean parameters +SELECT dictinitoption FROM pg_ts_dict WHERE dictname = 'synonym'; + +ALTER TEXT SEARCH DICTIONARY synonym (CaseSensitive = 1); +SELECT ts_lexize('synonym', 'PoStGrEs'); +SELECT dictinitoption FROM pg_ts_dict WHERE dictname = 'synonym'; + +ALTER TEXT SEARCH DICTIONARY synonym (CaseSensitive = 2); -- fail + +ALTER TEXT SEARCH DICTIONARY synonym (CaseSensitive = off); +SELECT ts_lexize('synonym', 'PoStGrEs'); +SELECT dictinitoption FROM pg_ts_dict WHERE dictname = 'synonym'; + +-- Create and simple test thesaurus dictionary +-- More tests in configuration checks because ts_lexize() +-- cannot pass more than one word to thesaurus. +CREATE TEXT SEARCH DICTIONARY thesaurus ( + Template=thesaurus, + DictFile=thesaurus_sample, + Dictionary=english_stem +); + +SELECT ts_lexize('thesaurus', 'one'); + +-- Test ispell dictionary in configuration +CREATE TEXT SEARCH CONFIGURATION ispell_tst ( + COPY=english +); + +ALTER TEXT SEARCH CONFIGURATION ispell_tst ALTER MAPPING FOR + word, numword, asciiword, hword, numhword, asciihword, hword_part, hword_numpart, hword_asciipart + WITH ispell, english_stem; + +SELECT to_tsvector('ispell_tst', 'Booking the skies after rebookings for footballklubber from a foot'); +SELECT to_tsquery('ispell_tst', 'footballklubber'); +SELECT to_tsquery('ispell_tst', 'footballyklubber:b & rebookings:A & sky'); + +-- Test ispell dictionary with hunspell affix in configuration +CREATE TEXT SEARCH CONFIGURATION hunspell_tst ( + COPY=ispell_tst +); + +ALTER TEXT SEARCH CONFIGURATION hunspell_tst ALTER MAPPING + REPLACE ispell WITH hunspell; + +SELECT to_tsvector('hunspell_tst', 'Booking the skies after rebookings for footballklubber from a foot'); +SELECT to_tsquery('hunspell_tst', 'footballklubber'); +SELECT to_tsquery('hunspell_tst', 'footballyklubber:b & rebookings:A & sky'); + +SELECT to_tsquery('hunspell_tst', 'footballyklubber:b <-> sky'); +SELECT phraseto_tsquery('hunspell_tst', 'footballyklubber sky'); + +-- Test ispell dictionary with hunspell affix with FLAG long in configuration +ALTER TEXT SEARCH CONFIGURATION hunspell_tst ALTER MAPPING + REPLACE hunspell WITH hunspell_long; + +SELECT to_tsvector('hunspell_tst', 'Booking the skies after rebookings for footballklubber from a foot'); +SELECT to_tsquery('hunspell_tst', 'footballklubber'); +SELECT to_tsquery('hunspell_tst', 'footballyklubber:b & rebookings:A & sky'); + +-- Test ispell dictionary with hunspell affix with FLAG num in configuration +ALTER TEXT SEARCH CONFIGURATION hunspell_tst ALTER MAPPING + REPLACE hunspell_long WITH hunspell_num; + +SELECT to_tsvector('hunspell_tst', 'Booking the skies after rebookings for footballklubber from a foot'); +SELECT to_tsquery('hunspell_tst', 'footballklubber'); +SELECT to_tsquery('hunspell_tst', 'footballyklubber:b & rebookings:A & sky'); + +-- Test synonym dictionary in configuration +CREATE TEXT SEARCH CONFIGURATION synonym_tst ( + COPY=english +); + +ALTER TEXT SEARCH CONFIGURATION synonym_tst ALTER MAPPING FOR + asciiword, hword_asciipart, asciihword + WITH synonym, english_stem; + +SELECT to_tsvector('synonym_tst', 'Postgresql is often called as postgres or pgsql and pronounced as postgre'); +SELECT to_tsvector('synonym_tst', 'Most common mistake is to write Gogle instead of Google'); +SELECT to_tsvector('synonym_tst', 'Indexes or indices - Which is right plural form of index?'); +SELECT to_tsquery('synonym_tst', 'Index & indices'); + +-- test thesaurus in configuration +-- see thesaurus_sample.ths to understand 'odd' resulting tsvector +CREATE TEXT SEARCH CONFIGURATION thesaurus_tst ( + COPY=synonym_tst +); + +ALTER TEXT SEARCH CONFIGURATION thesaurus_tst ALTER MAPPING FOR + asciiword, hword_asciipart, asciihword + WITH synonym, thesaurus, english_stem; + +SELECT to_tsvector('thesaurus_tst', 'one postgres one two one two three one'); +SELECT to_tsvector('thesaurus_tst', 'Supernovae star is very new star and usually called supernovae (abbreviation SN)'); +SELECT to_tsvector('thesaurus_tst', 'Booking tickets is looking like a booking a tickets'); + +-- invalid: non-lowercase quoted identifiers +CREATE TEXT SEARCH DICTIONARY tsdict_case +( + Template = ispell, + "DictFile" = ispell_sample, + "AffFile" = ispell_sample +); diff --git a/postgresql/examples/tsearch.sql b/postgresql/examples/tsearch.sql new file mode 100644 index 0000000..c16df57 --- /dev/null +++ b/postgresql/examples/tsearch.sql @@ -0,0 +1,788 @@ +-- +-- Sanity checks for text search catalogs +-- +-- NB: we assume the oidjoins test will have caught any dangling links, +-- that is OID or REGPROC fields that are not zero and do not match some +-- row in the linked-to table. However, if we want to enforce that a link +-- field can't be 0, we have to check it here. + +-- Find unexpected zero link entries + +SELECT oid, prsname +FROM pg_ts_parser +WHERE prsnamespace = 0 OR prsstart = 0 OR prstoken = 0 OR prsend = 0 OR + -- prsheadline is optional + prslextype = 0; + +SELECT oid, dictname +FROM pg_ts_dict +WHERE dictnamespace = 0 OR dictowner = 0 OR dicttemplate = 0; + +SELECT oid, tmplname +FROM pg_ts_template +WHERE tmplnamespace = 0 OR tmpllexize = 0; -- tmplinit is optional + +SELECT oid, cfgname +FROM pg_ts_config +WHERE cfgnamespace = 0 OR cfgowner = 0 OR cfgparser = 0; + +SELECT mapcfg, maptokentype, mapseqno +FROM pg_ts_config_map +WHERE mapcfg = 0 OR mapdict = 0; + +-- Look for pg_ts_config_map entries that aren't one of parser's token types +SELECT * FROM + ( SELECT oid AS cfgid, (ts_token_type(cfgparser)).tokid AS tokid + FROM pg_ts_config ) AS tt +RIGHT JOIN pg_ts_config_map AS m + ON (tt.cfgid=m.mapcfg AND tt.tokid=m.maptokentype) +WHERE + tt.cfgid IS NULL OR tt.tokid IS NULL; + +-- test basic text search behavior without indexes, then with + +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*'; +SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}'); +SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D'; + +create index wowidx on test_tsvector using gist (a); + +SET enable_seqscan=OFF; +SET enable_indexscan=ON; +SET enable_bitmapscan=OFF; + +explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; + +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*'; +SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}'); +SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D'; + +SET enable_indexscan=OFF; +SET enable_bitmapscan=ON; + +explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; + +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*'; +SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}'); +SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D'; + +-- Test siglen parameter of GiST tsvector_ops +CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(foo=1)); +CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=0)); +CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=2048)); +CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=100,foo='bar')); +CREATE INDEX wowidx1 ON test_tsvector USING gist (a tsvector_ops(siglen=100, siglen = 200)); + +CREATE INDEX wowidx2 ON test_tsvector USING gist (a tsvector_ops(siglen=1)); + +\d test_tsvector + +DROP INDEX wowidx; + +EXPLAIN (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; + +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*'; +SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}'); +SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D'; + +DROP INDEX wowidx2; + +CREATE INDEX wowidx ON test_tsvector USING gist (a tsvector_ops(siglen=484)); + +\d test_tsvector + +EXPLAIN (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; + +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*'; +SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}'); +SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D'; + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; + +DROP INDEX wowidx; + +CREATE INDEX wowidx ON test_tsvector USING gin (a); + +SET enable_seqscan=OFF; +-- GIN only supports bitmapscan, so no need to test plain indexscan + +explain (costs off) SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; + +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr|qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr&qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq&yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'eq|yt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq&yt)|(wr&qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '(eq|yt)&(wr|qh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'w:*|q:*'; +SELECT count(*) FROM test_tsvector WHERE a @@ any ('{wr,qh}'); +SELECT count(*) FROM test_tsvector WHERE a @@ 'no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!no_such_lexeme'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!pl <-> !yh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!yh <-> pl'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!qe <2> qt'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(pl <-> yh)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(yh <-> pl)'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!(qe <2> qt)'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wd:D'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:A'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!wd:D'; + +-- Test optimization of non-empty GIN_SEARCH_MODE_ALL queries +EXPLAIN (COSTS OFF) +SELECT count(*) FROM test_tsvector WHERE a @@ '!qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ '!qh'; + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr' AND a @@ '!qh'; +SELECT count(*) FROM test_tsvector WHERE a @@ 'wr' AND a @@ '!qh'; + +RESET enable_seqscan; + +INSERT INTO test_tsvector VALUES ('???', 'DFG:1A,2B,6C,10 FGH'); +SELECT * FROM ts_stat('SELECT a FROM test_tsvector') ORDER BY ndoc DESC, nentry DESC, word LIMIT 10; +SELECT * FROM ts_stat('SELECT a FROM test_tsvector', 'AB') ORDER BY ndoc DESC, nentry DESC, word; + +--dictionaries and to_tsvector + +SELECT ts_lexize('english_stem', 'skies'); +SELECT ts_lexize('english_stem', 'identity'); + +SELECT * FROM ts_token_type('default'); + +SELECT * FROM ts_parse('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net teodor@123-stack.net 123_teodor@stack.net 123-teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 + wow < jqw <> qwerty'); + +SELECT to_tsvector('english', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net teodor@123-stack.net 123_teodor@stack.net 123-teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 + wow < jqw <> qwerty'); + +SELECT length(to_tsvector('english', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net teodor@123-stack.net 123_teodor@stack.net 123-teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 + wow < jqw <> qwerty')); + +-- ts_debug + +SELECT * from ts_debug('english', 'abc&nm1;def©ghiõjkl'); + +-- check parsing of URLs +SELECT * from ts_debug('english', 'http://www.harewoodsolutions.co.uk/press.aspx'); +SELECT * from ts_debug('english', 'http://aew.wer0c.ewr/id?ad=qwe&dw'); +SELECT * from ts_debug('english', 'http://5aew.werc.ewr:8100/?'); +SELECT * from ts_debug('english', '5aew.werc.ewr:8100/?xx'); +SELECT token, alias, + dictionaries, dictionaries is null as dnull, array_dims(dictionaries) as ddims, + lexemes, lexemes is null as lnull, array_dims(lexemes) as ldims +from ts_debug('english', 'a title'); + +-- to_tsquery + +SELECT to_tsquery('english', 'qwe & sKies '); +SELECT to_tsquery('simple', 'qwe & sKies '); +SELECT to_tsquery('english', '''the wether'':dc & '' sKies '':BC '); +SELECT to_tsquery('english', 'asd&(and|fghj)'); +SELECT to_tsquery('english', '(asd&and)|fghj'); +SELECT to_tsquery('english', '(asd&!and)|fghj'); +SELECT to_tsquery('english', '(the|and&(i&1))&fghj'); + +SELECT plainto_tsquery('english', 'the and z 1))& fghj'); +SELECT plainto_tsquery('english', 'foo bar') && plainto_tsquery('english', 'asd'); +SELECT plainto_tsquery('english', 'foo bar') || plainto_tsquery('english', 'asd fg'); +SELECT plainto_tsquery('english', 'foo bar') || !!plainto_tsquery('english', 'asd fg'); +SELECT plainto_tsquery('english', 'foo bar') && 'asd | fg'; + +-- Check stop word deletion, a and s are stop-words +SELECT to_tsquery('english', '!(a & !b) & c'); +SELECT to_tsquery('english', '!(a & !b)'); + +SELECT to_tsquery('english', '(1 <-> 2) <-> a'); +SELECT to_tsquery('english', '(1 <-> a) <-> 2'); +SELECT to_tsquery('english', '(a <-> 1) <-> 2'); +SELECT to_tsquery('english', 'a <-> (1 <-> 2)'); +SELECT to_tsquery('english', '1 <-> (a <-> 2)'); +SELECT to_tsquery('english', '1 <-> (2 <-> a)'); + +SELECT to_tsquery('english', '(1 <-> 2) <3> a'); +SELECT to_tsquery('english', '(1 <-> a) <3> 2'); +SELECT to_tsquery('english', '(a <-> 1) <3> 2'); +SELECT to_tsquery('english', 'a <3> (1 <-> 2)'); +SELECT to_tsquery('english', '1 <3> (a <-> 2)'); +SELECT to_tsquery('english', '1 <3> (2 <-> a)'); + +SELECT to_tsquery('english', '(1 <3> 2) <-> a'); +SELECT to_tsquery('english', '(1 <3> a) <-> 2'); +SELECT to_tsquery('english', '(a <3> 1) <-> 2'); +SELECT to_tsquery('english', 'a <-> (1 <3> 2)'); +SELECT to_tsquery('english', '1 <-> (a <3> 2)'); +SELECT to_tsquery('english', '1 <-> (2 <3> a)'); + +SELECT to_tsquery('english', '((a <-> 1) <-> 2) <-> s'); +SELECT to_tsquery('english', '(2 <-> (a <-> 1)) <-> s'); +SELECT to_tsquery('english', '((1 <-> a) <-> 2) <-> s'); +SELECT to_tsquery('english', '(2 <-> (1 <-> a)) <-> s'); +SELECT to_tsquery('english', 's <-> ((a <-> 1) <-> 2)'); +SELECT to_tsquery('english', 's <-> (2 <-> (a <-> 1))'); +SELECT to_tsquery('english', 's <-> ((1 <-> a) <-> 2)'); +SELECT to_tsquery('english', 's <-> (2 <-> (1 <-> a))'); + +SELECT to_tsquery('english', '((a <-> 1) <-> s) <-> 2'); +SELECT to_tsquery('english', '(s <-> (a <-> 1)) <-> 2'); +SELECT to_tsquery('english', '((1 <-> a) <-> s) <-> 2'); +SELECT to_tsquery('english', '(s <-> (1 <-> a)) <-> 2'); +SELECT to_tsquery('english', '2 <-> ((a <-> 1) <-> s)'); +SELECT to_tsquery('english', '2 <-> (s <-> (a <-> 1))'); +SELECT to_tsquery('english', '2 <-> ((1 <-> a) <-> s)'); +SELECT to_tsquery('english', '2 <-> (s <-> (1 <-> a))'); + +SELECT to_tsquery('english', 'foo <-> (a <-> (the <-> bar))'); +SELECT to_tsquery('english', '((foo <-> a) <-> the) <-> bar'); +SELECT to_tsquery('english', 'foo <-> a <-> the <-> bar'); +SELECT phraseto_tsquery('english', 'PostgreSQL can be extended by the user in many ways'); + + +SELECT ts_rank_cd(to_tsvector('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +'), to_tsquery('english', 'paint&water')); + +SELECT ts_rank_cd(to_tsvector('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +'), to_tsquery('english', 'breath&motion&water')); + +SELECT ts_rank_cd(to_tsvector('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +'), to_tsquery('english', 'ocean')); + +SELECT ts_rank_cd(to_tsvector('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +'), to_tsquery('english', 'painted <-> Ship')); + +SELECT ts_rank_cd(strip(to_tsvector('both stripped')), + to_tsquery('both & stripped')); + +SELECT ts_rank_cd(to_tsvector('unstripped') || strip(to_tsvector('stripped')), + to_tsquery('unstripped & stripped')); + +--headline tests +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', to_tsquery('english', 'paint&water')); + +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', to_tsquery('english', 'breath&motion&water')); + +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', to_tsquery('english', 'ocean')); + +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', phraseto_tsquery('english', 'painted Ocean')); + +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', phraseto_tsquery('english', 'idle as a painted Ship')); + +SELECT ts_headline('english', +'Lorem ipsum urna. Nullam nullam ullamcorper urna.', +to_tsquery('english','Lorem') && phraseto_tsquery('english','ullamcorper urna'), +'MaxWords=100, MinWords=1'); + +SELECT ts_headline('english', ' + + + +Sea view wow foo bar qq +YES   +ff-bg + + +', +to_tsquery('english', 'sea&foo'), 'HighlightAll=true'); + +SELECT ts_headline('simple', '1 2 3 1 3'::text, '1 <-> 3', 'MaxWords=2, MinWords=1'); +SELECT ts_headline('simple', '1 2 3 1 3'::text, '1 & 3', 'MaxWords=4, MinWords=1'); +SELECT ts_headline('simple', '1 2 3 1 3'::text, '1 <-> 3', 'MaxWords=4, MinWords=1'); + +--Check if headline fragments work +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', to_tsquery('english', 'ocean'), 'MaxFragments=1'); + +--Check if more than one fragments are displayed +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', to_tsquery('english', 'Coleridge & stuck'), 'MaxFragments=2'); + +--Fragments when there all query words are not in the document +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', to_tsquery('english', 'ocean & seahorse'), 'MaxFragments=1'); + +--FragmentDelimiter option +SELECT ts_headline('english', ' +Day after day, day after day, + We stuck, nor breath nor motion, +As idle as a painted Ship + Upon a painted Ocean. +Water, water, every where + And all the boards did shrink; +Water, water, every where, + Nor any drop to drink. +S. T. Coleridge (1772-1834) +', to_tsquery('english', 'Coleridge & stuck'), 'MaxFragments=2,FragmentDelimiter=***'); + +--Fragments with phrase search +SELECT ts_headline('english', +'Lorem ipsum urna. Nullam nullam ullamcorper urna.', +to_tsquery('english','Lorem') && phraseto_tsquery('english','ullamcorper urna'), +'MaxFragments=100, MaxWords=100, MinWords=1'); + +--Rewrite sub system + +CREATE TABLE test_tsquery (txtkeyword TEXT, txtsample TEXT); +\set ECHO none +\copy test_tsquery from stdin +\. +\set ECHO all + +ALTER TABLE test_tsquery ADD COLUMN keyword tsquery; +UPDATE test_tsquery SET keyword = to_tsquery('english', txtkeyword); +ALTER TABLE test_tsquery ADD COLUMN sample tsquery; +UPDATE test_tsquery SET sample = to_tsquery('english', txtsample::text); + + +SELECT COUNT(*) FROM test_tsquery WHERE keyword < 'new & york'; +SELECT COUNT(*) FROM test_tsquery WHERE keyword <= 'new & york'; +SELECT COUNT(*) FROM test_tsquery WHERE keyword = 'new & york'; +SELECT COUNT(*) FROM test_tsquery WHERE keyword >= 'new & york'; +SELECT COUNT(*) FROM test_tsquery WHERE keyword > 'new & york'; + +CREATE UNIQUE INDEX bt_tsq ON test_tsquery (keyword); + +SET enable_seqscan=OFF; + +SELECT COUNT(*) FROM test_tsquery WHERE keyword < 'new & york'; +SELECT COUNT(*) FROM test_tsquery WHERE keyword <= 'new & york'; +SELECT COUNT(*) FROM test_tsquery WHERE keyword = 'new & york'; +SELECT COUNT(*) FROM test_tsquery WHERE keyword >= 'new & york'; +SELECT COUNT(*) FROM test_tsquery WHERE keyword > 'new & york'; + +RESET enable_seqscan; + +SELECT ts_rewrite('foo & bar & qq & new & york', 'new & york'::tsquery, 'big & apple | nyc | new & york & city'); +SELECT ts_rewrite(ts_rewrite('new & !york ', 'york', '!jersey'), + 'jersey', 'mexico'); + +SELECT ts_rewrite('moscow', 'SELECT keyword, sample FROM test_tsquery'::text ); +SELECT ts_rewrite('moscow & hotel', 'SELECT keyword, sample FROM test_tsquery'::text ); +SELECT ts_rewrite('bar & new & qq & foo & york', 'SELECT keyword, sample FROM test_tsquery'::text ); + +SELECT ts_rewrite( 'moscow', 'SELECT keyword, sample FROM test_tsquery'); +SELECT ts_rewrite( 'moscow & hotel', 'SELECT keyword, sample FROM test_tsquery'); +SELECT ts_rewrite( 'bar & new & qq & foo & york', 'SELECT keyword, sample FROM test_tsquery'); + +SELECT ts_rewrite('1 & (2 <-> 3)', 'SELECT keyword, sample FROM test_tsquery'::text ); +SELECT ts_rewrite('1 & (2 <2> 3)', 'SELECT keyword, sample FROM test_tsquery'::text ); +SELECT ts_rewrite('5 <-> (1 & (2 <-> 3))', 'SELECT keyword, sample FROM test_tsquery'::text ); +SELECT ts_rewrite('5 <-> (6 | 8)', 'SELECT keyword, sample FROM test_tsquery'::text ); + +-- Check empty substitution +SELECT ts_rewrite(to_tsquery('5 & (6 | 5)'), to_tsquery('5'), to_tsquery('')); +SELECT ts_rewrite(to_tsquery('!5'), to_tsquery('5'), to_tsquery('')); + +SELECT keyword FROM test_tsquery WHERE keyword @> 'new'; +SELECT keyword FROM test_tsquery WHERE keyword @> 'moscow'; +SELECT keyword FROM test_tsquery WHERE keyword <@ 'new'; +SELECT keyword FROM test_tsquery WHERE keyword <@ 'moscow'; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow & hotel') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'bar & new & qq & foo & york') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow & hotel') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'bar & new & qq & foo & york') AS query; + +CREATE INDEX qq ON test_tsquery USING gist (keyword tsquery_ops); +SET enable_seqscan=OFF; + +SELECT keyword FROM test_tsquery WHERE keyword @> 'new'; +SELECT keyword FROM test_tsquery WHERE keyword @> 'moscow'; +SELECT keyword FROM test_tsquery WHERE keyword <@ 'new'; +SELECT keyword FROM test_tsquery WHERE keyword <@ 'moscow'; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow & hotel') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'bar & new & qq & foo & york') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'moscow & hotel') AS query; +SELECT ts_rewrite( query, 'SELECT keyword, sample FROM test_tsquery' ) FROM to_tsquery('english', 'bar & new & qq & foo & york') AS query; + +SELECT ts_rewrite(tsquery_phrase('foo', 'foo'), 'foo', 'bar | baz'); +SELECT to_tsvector('foo bar') @@ + ts_rewrite(tsquery_phrase('foo', 'foo'), 'foo', 'bar | baz'); +SELECT to_tsvector('bar baz') @@ + ts_rewrite(tsquery_phrase('foo', 'foo'), 'foo', 'bar | baz'); + +RESET enable_seqscan; + +--test GUC +SET default_text_search_config=simple; + +SELECT to_tsvector('SKIES My booKs'); +SELECT plainto_tsquery('SKIES My booKs'); +SELECT to_tsquery('SKIES & My | booKs'); + +SET default_text_search_config=english; + +SELECT to_tsvector('SKIES My booKs'); +SELECT plainto_tsquery('SKIES My booKs'); +SELECT to_tsquery('SKIES & My | booKs'); + +--trigger +CREATE TRIGGER tsvectorupdate +BEFORE UPDATE OR INSERT ON test_tsvector +FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(a, 'pg_catalog.english', t); + +SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); +INSERT INTO test_tsvector (t) VALUES ('345 qwerty'); +SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); +UPDATE test_tsvector SET t = null WHERE t = '345 qwerty'; +SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); + +INSERT INTO test_tsvector (t) VALUES ('345 qwerty'); + +SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); + +-- Test inlining of immutable constant functions + +-- to_tsquery(text) is not immutable, so it won't be inlined +explain (costs off) +select * from test_tsquery, to_tsquery('new') q where txtsample @@ q; + +-- to_tsquery(regconfig, text) is an immutable function. +-- That allows us to get rid of using function scan and join at all. +explain (costs off) +select * from test_tsquery, to_tsquery('english', 'new') q where txtsample @@ q; + +-- test finding items in GIN's pending list +create temp table pendtest (ts tsvector); +create index pendtest_idx on pendtest using gin(ts); +insert into pendtest values (to_tsvector('Lore ipsam')); +insert into pendtest values (to_tsvector('Lore ipsum')); +select * from pendtest where 'ipsu:*'::tsquery @@ ts; +select * from pendtest where 'ipsa:*'::tsquery @@ ts; +select * from pendtest where 'ips:*'::tsquery @@ ts; +select * from pendtest where 'ipt:*'::tsquery @@ ts; +select * from pendtest where 'ipi:*'::tsquery @@ ts; + +--check OP_PHRASE on index +create temp table phrase_index_test(fts tsvector); +insert into phrase_index_test values ('A fat cat has just eaten a rat.'); +insert into phrase_index_test values (to_tsvector('english', 'A fat cat has just eaten a rat.')); +create index phrase_index_test_idx on phrase_index_test using gin(fts); +set enable_seqscan = off; +select * from phrase_index_test where fts @@ phraseto_tsquery('english', 'fat cat'); +set enable_seqscan = on; + +-- test websearch_to_tsquery function +select websearch_to_tsquery('simple', 'I have a fat:*ABCD cat'); +select websearch_to_tsquery('simple', 'orange:**AABBCCDD'); +select websearch_to_tsquery('simple', 'fat:A!cat:B|rat:C<'); +select websearch_to_tsquery('simple', 'fat:A : cat:B'); + +select websearch_to_tsquery('simple', 'fat*rat'); +select websearch_to_tsquery('simple', 'fat-rat'); +select websearch_to_tsquery('simple', 'fat_rat'); + +-- weights are completely ignored +select websearch_to_tsquery('simple', 'abc : def'); +select websearch_to_tsquery('simple', 'abc:def'); +select websearch_to_tsquery('simple', 'a:::b'); +select websearch_to_tsquery('simple', 'abc:d'); +select websearch_to_tsquery('simple', ':'); + +-- these operators are ignored +select websearch_to_tsquery('simple', 'abc & def'); +select websearch_to_tsquery('simple', 'abc | def'); +select websearch_to_tsquery('simple', 'abc <-> def'); +select websearch_to_tsquery('simple', 'abc (pg or class)'); + +-- NOT is ignored in quotes +select websearch_to_tsquery('english', 'My brand new smartphone'); +select websearch_to_tsquery('english', 'My brand "new smartphone"'); +select websearch_to_tsquery('english', 'My brand "new -smartphone"'); + +-- test OR operator +select websearch_to_tsquery('simple', 'cat or rat'); +select websearch_to_tsquery('simple', 'cat OR rat'); +select websearch_to_tsquery('simple', 'cat "OR" rat'); +select websearch_to_tsquery('simple', 'cat OR'); +select websearch_to_tsquery('simple', 'OR rat'); +select websearch_to_tsquery('simple', '"fat cat OR rat"'); +select websearch_to_tsquery('simple', 'fat (cat OR rat'); +select websearch_to_tsquery('simple', 'or OR or'); + +-- OR is an operator here ... +select websearch_to_tsquery('simple', '"fat cat"or"fat rat"'); +select websearch_to_tsquery('simple', 'fat or(rat'); +select websearch_to_tsquery('simple', 'fat or)rat'); +select websearch_to_tsquery('simple', 'fat or&rat'); +select websearch_to_tsquery('simple', 'fat or|rat'); +select websearch_to_tsquery('simple', 'fat or!rat'); +select websearch_to_tsquery('simple', 'fat orrat'); +select websearch_to_tsquery('simple', 'fat or '); + +-- ... but not here +select websearch_to_tsquery('simple', 'abc orange'); +select websearch_to_tsquery('simple', 'abc OR1234'); +select websearch_to_tsquery('simple', 'abc or-abc'); +select websearch_to_tsquery('simple', 'abc OR_abc'); + +-- test quotes +select websearch_to_tsquery('english', '"pg_class pg'); +select websearch_to_tsquery('english', 'pg_class pg"'); +select websearch_to_tsquery('english', '"pg_class pg"'); +select websearch_to_tsquery('english', 'abc "pg_class pg"'); +select websearch_to_tsquery('english', '"pg_class pg" def'); +select websearch_to_tsquery('english', 'abc "pg pg_class pg" def'); +select websearch_to_tsquery('english', ' or "pg pg_class pg" or '); +select websearch_to_tsquery('english', '""pg pg_class pg""'); +select websearch_to_tsquery('english', 'abc """"" def'); +select websearch_to_tsquery('english', 'cat -"fat rat"'); +select websearch_to_tsquery('english', 'cat -"fat rat" cheese'); +select websearch_to_tsquery('english', 'abc "def -"'); +select websearch_to_tsquery('english', 'abc "def :"'); + +select websearch_to_tsquery('english', '"A fat cat" has just eaten a -rat.'); +select websearch_to_tsquery('english', '"A fat cat" has just eaten OR !rat.'); +select websearch_to_tsquery('english', '"A fat cat" has just (+eaten OR -rat)'); + +select websearch_to_tsquery('english', 'this is ----fine'); +select websearch_to_tsquery('english', '(()) )))) this ||| is && -fine, "dear friend" OR good'); +select websearch_to_tsquery('english', 'an old <-> cat " is fine &&& too'); + +select websearch_to_tsquery('english', '"A the" OR just on'); +select websearch_to_tsquery('english', '"a fat cat" ate a rat'); + +select to_tsvector('english', 'A fat cat ate a rat') @@ + websearch_to_tsquery('english', '"a fat cat" ate a rat'); + +select to_tsvector('english', 'A fat grey cat ate a rat') @@ + websearch_to_tsquery('english', '"a fat cat" ate a rat'); + +-- cases handled by gettoken_tsvector() +select websearch_to_tsquery(''''); +select websearch_to_tsquery('''abc''''def'''); +select websearch_to_tsquery('\abc'); +select websearch_to_tsquery('\'); diff --git a/postgresql/examples/tsrf.sql b/postgresql/examples/tsrf.sql new file mode 100644 index 0000000..7c22529 --- /dev/null +++ b/postgresql/examples/tsrf.sql @@ -0,0 +1,185 @@ +-- +-- tsrf - targetlist set returning function tests +-- + +-- simple srf +SELECT generate_series(1, 3); + +-- parallel iteration +SELECT generate_series(1, 3), generate_series(3,5); + +-- parallel iteration, different number of rows +SELECT generate_series(1, 2), generate_series(1,4); + +-- srf, with SRF argument +SELECT generate_series(1, generate_series(1, 3)); + +-- but we've traditionally rejected the same in FROM +SELECT * FROM generate_series(1, generate_series(1, 3)); + +-- srf, with two SRF arguments +SELECT generate_series(generate_series(1,3), generate_series(2, 4)); + +-- check proper nesting of SRFs in different expressions +explain (verbose, costs off) +SELECT generate_series(1, generate_series(1, 3)), generate_series(2, 4); +SELECT generate_series(1, generate_series(1, 3)), generate_series(2, 4); + +CREATE TABLE few(id int, dataa text, datab text); +INSERT INTO few VALUES(1, 'a', 'foo'),(2, 'a', 'bar'),(3, 'b', 'bar'); + +-- SRF with a provably-dummy relation +explain (verbose, costs off) +SELECT unnest(ARRAY[1, 2]) FROM few WHERE false; +SELECT unnest(ARRAY[1, 2]) FROM few WHERE false; + +-- SRF shouldn't prevent upper query from recognizing lower as dummy +explain (verbose, costs off) +SELECT * FROM few f1, + (SELECT unnest(ARRAY[1,2]) FROM few f2 WHERE false OFFSET 0) ss; +SELECT * FROM few f1, + (SELECT unnest(ARRAY[1,2]) FROM few f2 WHERE false OFFSET 0) ss; + +-- SRF output order of sorting is maintained, if SRF is not referenced +SELECT few.id, generate_series(1,3) g FROM few ORDER BY id DESC; + +-- but SRFs can be referenced in sort +SELECT few.id, generate_series(1,3) g FROM few ORDER BY id, g DESC; +SELECT few.id, generate_series(1,3) g FROM few ORDER BY id, generate_series(1,3) DESC; + +-- it's weird to have ORDER BYs that increase the number of results +SELECT few.id FROM few ORDER BY id, generate_series(1,3) DESC; + +-- SRFs are computed after aggregation +SET enable_hashagg TO 0; -- stable output order +SELECT few.dataa, count(*), min(id), max(id), unnest('{1,1,3}'::int[]) FROM few WHERE few.id = 1 GROUP BY few.dataa; +-- unless referenced in GROUP BY clause +SELECT few.dataa, count(*), min(id), max(id), unnest('{1,1,3}'::int[]) FROM few WHERE few.id = 1 GROUP BY few.dataa, unnest('{1,1,3}'::int[]); +SELECT few.dataa, count(*), min(id), max(id), unnest('{1,1,3}'::int[]) FROM few WHERE few.id = 1 GROUP BY few.dataa, 5; +RESET enable_hashagg; + +-- check HAVING works when GROUP BY does [not] reference SRF output +SELECT dataa, generate_series(1,1), count(*) FROM few GROUP BY 1 HAVING count(*) > 1; +SELECT dataa, generate_series(1,1), count(*) FROM few GROUP BY 1, 2 HAVING count(*) > 1; + +-- it's weird to have GROUP BYs that increase the number of results +SELECT few.dataa, count(*) FROM few WHERE dataa = 'a' GROUP BY few.dataa ORDER BY 2; +SELECT few.dataa, count(*) FROM few WHERE dataa = 'a' GROUP BY few.dataa, unnest('{1,1,3}'::int[]) ORDER BY 2; + +-- SRFs are not allowed if they'd need to be conditionally executed +SELECT q1, case when q1 > 0 then generate_series(1,3) else 0 end FROM int8_tbl; +SELECT q1, coalesce(generate_series(1,3), 0) FROM int8_tbl; + +-- SRFs are not allowed in aggregate arguments +SELECT min(generate_series(1, 3)) FROM few; + +-- ... unless they're within a sub-select +SELECT sum((3 = ANY(SELECT generate_series(1,4)))::int); + +SELECT sum((3 = ANY(SELECT lag(x) over(order by x) + FROM generate_series(1,4) x))::int); + +-- SRFs are not allowed in window function arguments, either +SELECT min(generate_series(1, 3)) OVER() FROM few; + +-- SRFs are normally computed after window functions +SELECT id,lag(id) OVER(), count(*) OVER(), generate_series(1,3) FROM few; +-- unless referencing SRFs +SELECT SUM(count(*)) OVER(PARTITION BY generate_series(1,3) ORDER BY generate_series(1,3)), generate_series(1,3) g FROM few GROUP BY g; + +-- sorting + grouping +SELECT few.dataa, count(*), min(id), max(id), generate_series(1,3) FROM few GROUP BY few.dataa ORDER BY 5, 1; + +-- grouping sets are a bit special, they produce NULLs in columns not actually NULL +set enable_hashagg = false; +SELECT dataa, datab b, generate_series(1,2) g, count(*) FROM few GROUP BY CUBE(dataa, datab); +SELECT dataa, datab b, generate_series(1,2) g, count(*) FROM few GROUP BY CUBE(dataa, datab) ORDER BY dataa; +SELECT dataa, datab b, generate_series(1,2) g, count(*) FROM few GROUP BY CUBE(dataa, datab) ORDER BY g; +SELECT dataa, datab b, generate_series(1,2) g, count(*) FROM few GROUP BY CUBE(dataa, datab, g); +SELECT dataa, datab b, generate_series(1,2) g, count(*) FROM few GROUP BY CUBE(dataa, datab, g) ORDER BY dataa; +SELECT dataa, datab b, generate_series(1,2) g, count(*) FROM few GROUP BY CUBE(dataa, datab, g) ORDER BY g; +reset enable_hashagg; + +-- case with degenerate ORDER BY +explain (verbose, costs off) +select 'foo' as f, generate_series(1,2) as g from few order by 1; +select 'foo' as f, generate_series(1,2) as g from few order by 1; + +-- data modification +CREATE TABLE fewmore AS SELECT generate_series(1,3) AS data; +INSERT INTO fewmore VALUES(generate_series(4,5)); +SELECT * FROM fewmore; + +-- SRFs are not allowed in UPDATE (they once were, but it was nonsense) +UPDATE fewmore SET data = generate_series(4,9); + +-- SRFs are not allowed in RETURNING +INSERT INTO fewmore VALUES(1) RETURNING generate_series(1,3); + +-- nor standalone VALUES (but surely this is a bug?) +VALUES(1, generate_series(1,2)); + +-- We allow tSRFs that are not at top level +SELECT int4mul(generate_series(1,2), 10); +SELECT generate_series(1,3) IS DISTINCT FROM 2; + +-- but SRFs in function RTEs must be at top level (annoying restriction) +SELECT * FROM int4mul(generate_series(1,2), 10); + +-- DISTINCT ON is evaluated before tSRF evaluation if SRF is not +-- referenced either in ORDER BY or in the DISTINCT ON list. The ORDER +-- BY reference can be implicitly generated, if there's no other ORDER BY. + +-- implicit reference (via implicit ORDER) to all columns +SELECT DISTINCT ON (a) a, b, generate_series(1,3) g +FROM (VALUES (3, 2), (3,1), (1,1), (1,4), (5,3), (5,1)) AS t(a, b); + +-- unreferenced in DISTINCT ON or ORDER BY +SELECT DISTINCT ON (a) a, b, generate_series(1,3) g +FROM (VALUES (3, 2), (3,1), (1,1), (1,4), (5,3), (5,1)) AS t(a, b) +ORDER BY a, b DESC; + +-- referenced in ORDER BY +SELECT DISTINCT ON (a) a, b, generate_series(1,3) g +FROM (VALUES (3, 2), (3,1), (1,1), (1,4), (5,3), (5,1)) AS t(a, b) +ORDER BY a, b DESC, g DESC; + +-- referenced in ORDER BY and DISTINCT ON +SELECT DISTINCT ON (a, b, g) a, b, generate_series(1,3) g +FROM (VALUES (3, 2), (3,1), (1,1), (1,4), (5,3), (5,1)) AS t(a, b) +ORDER BY a, b DESC, g DESC; + +-- only SRF mentioned in DISTINCT ON +SELECT DISTINCT ON (g) a, b, generate_series(1,3) g +FROM (VALUES (3, 2), (3,1), (1,1), (1,4), (5,3), (5,1)) AS t(a, b); + +-- LIMIT / OFFSET is evaluated after SRF evaluation +SELECT a, generate_series(1,2) FROM (VALUES(1),(2),(3)) r(a) LIMIT 2 OFFSET 2; +-- SRFs are not allowed in LIMIT. +SELECT 1 LIMIT generate_series(1,3); + +-- tSRF in correlated subquery, referencing table outside +SELECT (SELECT generate_series(1,3) LIMIT 1 OFFSET few.id) FROM few; +-- tSRF in correlated subquery, referencing SRF outside +SELECT (SELECT generate_series(1,3) LIMIT 1 OFFSET g.i) FROM generate_series(0,3) g(i); + +-- Operators can return sets too +CREATE OPERATOR |@| (PROCEDURE = unnest, RIGHTARG = ANYARRAY); +SELECT |@|ARRAY[1,2,3]; + +-- Some fun cases involving duplicate SRF calls +explain (verbose, costs off) +select generate_series(1,3) as x, generate_series(1,3) + 1 as xp1; +select generate_series(1,3) as x, generate_series(1,3) + 1 as xp1; +explain (verbose, costs off) +select generate_series(1,3)+1 order by generate_series(1,3); +select generate_series(1,3)+1 order by generate_series(1,3); + +-- Check that SRFs of same nesting level run in lockstep +explain (verbose, costs off) +select generate_series(1,3) as x, generate_series(3,6) + 1 as y; +select generate_series(1,3) as x, generate_series(3,6) + 1 as y; + +-- Clean up +DROP TABLE few; +DROP TABLE fewmore; diff --git a/postgresql/examples/tstypes.sql b/postgresql/examples/tstypes.sql new file mode 100644 index 0000000..30c8c70 --- /dev/null +++ b/postgresql/examples/tstypes.sql @@ -0,0 +1,268 @@ +-- deal with numeric instability of ts_rank +SET extra_float_digits = 0; + +--Base tsvector test + +SELECT '1'::tsvector; +SELECT '1 '::tsvector; +SELECT ' 1'::tsvector; +SELECT ' 1 '::tsvector; +SELECT '1 2'::tsvector; +SELECT '''1 2'''::tsvector; +SELECT E'''1 \\''2'''::tsvector; +SELECT E'''1 \\''2''3'::tsvector; +SELECT E'''1 \\''2'' 3'::tsvector; +SELECT E'''1 \\''2'' '' 3'' 4 '::tsvector; +SELECT $$'\\as' ab\c ab\\c AB\\\c ab\\\\c$$::tsvector; +SELECT tsvectorin(tsvectorout($$'\\as' ab\c ab\\c AB\\\c ab\\\\c$$::tsvector)); +SELECT '''w'':4A,3B,2C,1D,5 a:8'; +SELECT 'a:3A b:2a'::tsvector || 'ba:1234 a:1B'; + +--Base tsquery test +SELECT '1'::tsquery; +SELECT '1 '::tsquery; +SELECT ' 1'::tsquery; +SELECT ' 1 '::tsquery; +SELECT '''1 2'''::tsquery; +SELECT E'''1 \\''2'''::tsquery; +SELECT '!1'::tsquery; +SELECT '1|2'::tsquery; +SELECT '1|!2'::tsquery; +SELECT '!1|2'::tsquery; +SELECT '!1|!2'::tsquery; +SELECT '!(!1|!2)'::tsquery; +SELECT '!(!1|2)'::tsquery; +SELECT '!(1|!2)'::tsquery; +SELECT '!(1|2)'::tsquery; +SELECT '1&2'::tsquery; +SELECT '!1&2'::tsquery; +SELECT '1&!2'::tsquery; +SELECT '!1&!2'::tsquery; +SELECT '(1&2)'::tsquery; +SELECT '1&(2)'::tsquery; +SELECT '!(1)&2'::tsquery; +SELECT '!(1&2)'::tsquery; +SELECT '1|2&3'::tsquery; +SELECT '1|(2&3)'::tsquery; +SELECT '(1|2)&3'::tsquery; +SELECT '1|2&!3'::tsquery; +SELECT '1|!2&3'::tsquery; +SELECT '!1|2&3'::tsquery; +SELECT '!1|(2&3)'::tsquery; +SELECT '!(1|2)&3'::tsquery; +SELECT '(!1|2)&3'::tsquery; +SELECT '1|(2|(4|(5|6)))'::tsquery; +SELECT '1|2|4|5|6'::tsquery; +SELECT '1&(2&(4&(5&6)))'::tsquery; +SELECT '1&2&4&5&6'::tsquery; +SELECT '1&(2&(4&(5|6)))'::tsquery; +SELECT '1&(2&(4&(5|!6)))'::tsquery; +SELECT E'1&(''2''&('' 4''&(\\|5 | ''6 \\'' !|&'')))'::tsquery; +SELECT $$'\\as'$$::tsquery; +SELECT 'a:* & nbb:*ac | doo:a* | goo'::tsquery; +SELECT '!!b'::tsquery; +SELECT '!!!b'::tsquery; +SELECT '!(!b)'::tsquery; +SELECT 'a & !!b'::tsquery; +SELECT '!!a & b'::tsquery; +SELECT '!!a & !!b'::tsquery; + +--comparisons +SELECT 'a' < 'b & c'::tsquery as "true"; +SELECT 'a' > 'b & c'::tsquery as "false"; +SELECT 'a | f' < 'b & c'::tsquery as "false"; +SELECT 'a | ff' < 'b & c'::tsquery as "false"; +SELECT 'a | f | g' < 'b & c'::tsquery as "false"; + +--concatenation +SELECT numnode( 'new'::tsquery ); +SELECT numnode( 'new & york'::tsquery ); +SELECT numnode( 'new & york | qwery'::tsquery ); + +SELECT 'foo & bar'::tsquery && 'asd'; +SELECT 'foo & bar'::tsquery || 'asd & fg'; +SELECT 'foo & bar'::tsquery || !!'asd & fg'::tsquery; +SELECT 'foo & bar'::tsquery && 'asd | fg'; +SELECT 'a' <-> 'b & d'::tsquery; +SELECT 'a & g' <-> 'b & d'::tsquery; +SELECT 'a & g' <-> 'b | d'::tsquery; +SELECT 'a & g' <-> 'b <-> d'::tsquery; +SELECT tsquery_phrase('a <3> g', 'b & d', 10); + +-- tsvector-tsquery operations + +SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca' as "true"; +SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:B' as "true"; +SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:A' as "true"; +SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:C' as "false"; +SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & ca:CB' as "true"; +SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & c:*C' as "false"; +SELECT 'a b:89 ca:23A,64b d:34c'::tsvector @@ 'd:AC & c:*CB' as "true"; +SELECT 'a b:89 ca:23A,64b cb:80c d:34c'::tsvector @@ 'd:AC & c:*C' as "true"; +SELECT 'a b:89 ca:23A,64c cb:80b d:34c'::tsvector @@ 'd:AC & c:*C' as "true"; +SELECT 'a b:89 ca:23A,64c cb:80b d:34c'::tsvector @@ 'd:AC & c:*B' as "true"; +SELECT 'wa:1D wb:2A'::tsvector @@ 'w:*D & w:*A'::tsquery as "true"; +SELECT 'wa:1D wb:2A'::tsvector @@ 'w:*D <-> w:*A'::tsquery as "true"; +SELECT 'wa:1A wb:2D'::tsvector @@ 'w:*D <-> w:*A'::tsquery as "false"; +SELECT 'wa:1A'::tsvector @@ 'w:*A'::tsquery as "true"; +SELECT 'wa:1A'::tsvector @@ 'w:*D'::tsquery as "false"; +SELECT 'wa:1A'::tsvector @@ '!w:*A'::tsquery as "false"; +SELECT 'wa:1A'::tsvector @@ '!w:*D'::tsquery as "true"; +-- historically, a stripped tsvector matches queries ignoring weights: +SELECT strip('wa:1A'::tsvector) @@ 'w:*A'::tsquery as "true"; +SELECT strip('wa:1A'::tsvector) @@ 'w:*D'::tsquery as "true"; +SELECT strip('wa:1A'::tsvector) @@ '!w:*A'::tsquery as "false"; +SELECT strip('wa:1A'::tsvector) @@ '!w:*D'::tsquery as "false"; + +SELECT 'supernova'::tsvector @@ 'super'::tsquery AS "false"; +SELECT 'supeanova supernova'::tsvector @@ 'super'::tsquery AS "false"; +SELECT 'supeznova supernova'::tsvector @@ 'super'::tsquery AS "false"; +SELECT 'supernova'::tsvector @@ 'super:*'::tsquery AS "true"; +SELECT 'supeanova supernova'::tsvector @@ 'super:*'::tsquery AS "true"; +SELECT 'supeznova supernova'::tsvector @@ 'super:*'::tsquery AS "true"; + +--phrase search +SELECT to_tsvector('simple', '1 2 3 1') @@ '1 <-> 2' AS "true"; +SELECT to_tsvector('simple', '1 2 3 1') @@ '1 <2> 2' AS "false"; +SELECT to_tsvector('simple', '1 2 3 1') @@ '1 <-> 3' AS "false"; +SELECT to_tsvector('simple', '1 2 3 1') @@ '1 <2> 3' AS "true"; +SELECT to_tsvector('simple', '1 2 1 2') @@ '1 <3> 2' AS "true"; + +SELECT to_tsvector('simple', '1 2 11 3') @@ '1 <-> 3' AS "false"; +SELECT to_tsvector('simple', '1 2 11 3') @@ '1:* <-> 3' AS "true"; + +SELECT to_tsvector('simple', '1 2 3 4') @@ '1 <-> 2 <-> 3' AS "true"; +SELECT to_tsvector('simple', '1 2 3 4') @@ '(1 <-> 2) <-> 3' AS "true"; +SELECT to_tsvector('simple', '1 2 3 4') @@ '1 <-> (2 <-> 3)' AS "true"; +SELECT to_tsvector('simple', '1 2 3 4') @@ '1 <2> (2 <-> 3)' AS "false"; +SELECT to_tsvector('simple', '1 2 1 2 3 4') @@ '(1 <-> 2) <-> 3' AS "true"; +SELECT to_tsvector('simple', '1 2 1 2 3 4') @@ '1 <-> 2 <-> 3' AS "true"; +-- without position data, phrase search does not match +SELECT strip(to_tsvector('simple', '1 2 3 4')) @@ '1 <-> 2 <-> 3' AS "false"; + +select to_tsvector('simple', 'q x q y') @@ 'q <-> (x & y)' AS "false"; +select to_tsvector('simple', 'q x') @@ 'q <-> (x | y <-> z)' AS "true"; +select to_tsvector('simple', 'q y') @@ 'q <-> (x | y <-> z)' AS "false"; +select to_tsvector('simple', 'q y z') @@ 'q <-> (x | y <-> z)' AS "true"; +select to_tsvector('simple', 'q y x') @@ 'q <-> (x | y <-> z)' AS "false"; +select to_tsvector('simple', 'q x y') @@ 'q <-> (x | y <-> z)' AS "true"; +select to_tsvector('simple', 'q x') @@ '(x | y <-> z) <-> q' AS "false"; +select to_tsvector('simple', 'x q') @@ '(x | y <-> z) <-> q' AS "true"; +select to_tsvector('simple', 'x y q') @@ '(x | y <-> z) <-> q' AS "false"; +select to_tsvector('simple', 'x y z') @@ '(x | y <-> z) <-> q' AS "false"; +select to_tsvector('simple', 'x y z q') @@ '(x | y <-> z) <-> q' AS "true"; +select to_tsvector('simple', 'y z q') @@ '(x | y <-> z) <-> q' AS "true"; +select to_tsvector('simple', 'y y q') @@ '(x | y <-> z) <-> q' AS "false"; +select to_tsvector('simple', 'y y q') @@ '(!x | y <-> z) <-> q' AS "true"; +select to_tsvector('simple', 'x y q') @@ '(!x | y <-> z) <-> q' AS "true"; +select to_tsvector('simple', 'y y q') @@ '(x | y <-> !z) <-> q' AS "true"; +select to_tsvector('simple', 'x q') @@ '(x | y <-> !z) <-> q' AS "true"; +select to_tsvector('simple', 'x q') @@ '(!x | y <-> z) <-> q' AS "false"; +select to_tsvector('simple', 'z q') @@ '(!x | y <-> z) <-> q' AS "true"; +select to_tsvector('simple', 'x y q') @@ '(!x | y) <-> y <-> q' AS "false"; +select to_tsvector('simple', 'x y q') @@ '(!x | !y) <-> y <-> q' AS "true"; +select to_tsvector('simple', 'x y q') @@ '(x | !y) <-> y <-> q' AS "true"; +select to_tsvector('simple', 'x y q') @@ '(x | !!z) <-> y <-> q' AS "true"; +select to_tsvector('simple', 'x y q y') @@ '!x <-> y' AS "true"; +select to_tsvector('simple', 'x y q y') @@ '!x <-> !y' AS "true"; +select to_tsvector('simple', 'x y q y') @@ '!x <-> !!y' AS "true"; +select to_tsvector('simple', 'x y q y') @@ '!(x <-> y)' AS "false"; +select to_tsvector('simple', 'x y q y') @@ '!(x <2> y)' AS "true"; +select strip(to_tsvector('simple', 'x y q y')) @@ '!x <-> y' AS "false"; +select strip(to_tsvector('simple', 'x y q y')) @@ '!x <-> !y' AS "false"; +select strip(to_tsvector('simple', 'x y q y')) @@ '!x <-> !!y' AS "false"; +select strip(to_tsvector('simple', 'x y q y')) @@ '!(x <-> y)' AS "true"; +select strip(to_tsvector('simple', 'x y q y')) @@ '!(x <2> y)' AS "true"; +select to_tsvector('simple', 'x y q y') @@ '!foo' AS "true"; +select to_tsvector('simple', '') @@ '!foo' AS "true"; + +--ranking +SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a | s'); +SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s'); +SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s:*'); +SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | sa:*'); +SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a | s'); +SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a | s'); +SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a & s'); +SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a & s'); +SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a & s'); + +SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a | s'); +SELECT ts_rank_cd(' a:1 sa:2C d g'::tsvector, 'a | s'); +SELECT ts_rank_cd(' a:1 sa:2C d g'::tsvector, 'a | s:*'); +SELECT ts_rank_cd(' a:1 sa:2C d g'::tsvector, 'a | sa:*'); +SELECT ts_rank_cd(' a:1 sa:3C sab:2c d g'::tsvector, 'a | sa:*'); +SELECT ts_rank_cd(' a:1 s:2B d g'::tsvector, 'a | s'); +SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a | s'); +SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a & s'); +SELECT ts_rank_cd(' a:1 s:2B d g'::tsvector, 'a & s'); +SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a & s'); + +SELECT ts_rank_cd(' a:1 s:2A d g'::tsvector, 'a <-> s'); +SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a <-> s'); +SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a <-> s'); +SELECT ts_rank_cd(' a:1 s:2 d:2A g'::tsvector, 'a <-> s'); +SELECT ts_rank_cd(' a:1 s:2,3A d:2A g'::tsvector, 'a <2> s:A'); +SELECT ts_rank_cd(' a:1 b:2 s:3A d:2A g'::tsvector, 'a <2> s:A'); +SELECT ts_rank_cd(' a:1 sa:2D sb:2A g'::tsvector, 'a <-> s:*'); +SELECT ts_rank_cd(' a:1 sa:2A sb:2D g'::tsvector, 'a <-> s:*'); +SELECT ts_rank_cd(' a:1 sa:2A sb:2D g'::tsvector, 'a <-> s:* <-> sa:A'); +SELECT ts_rank_cd(' a:1 sa:2A sb:2D g'::tsvector, 'a <-> s:* <-> sa:B'); + +SELECT 'a:1 b:2'::tsvector @@ 'a <-> b'::tsquery AS "true"; +SELECT 'a:1 b:2'::tsvector @@ 'a <0> b'::tsquery AS "false"; +SELECT 'a:1 b:2'::tsvector @@ 'a <1> b'::tsquery AS "true"; +SELECT 'a:1 b:2'::tsvector @@ 'a <2> b'::tsquery AS "false"; +SELECT 'a:1 b:3'::tsvector @@ 'a <-> b'::tsquery AS "false"; +SELECT 'a:1 b:3'::tsvector @@ 'a <0> b'::tsquery AS "false"; +SELECT 'a:1 b:3'::tsvector @@ 'a <1> b'::tsquery AS "false"; +SELECT 'a:1 b:3'::tsvector @@ 'a <2> b'::tsquery AS "true"; +SELECT 'a:1 b:3'::tsvector @@ 'a <3> b'::tsquery AS "false"; +SELECT 'a:1 b:3'::tsvector @@ 'a <0> a:*'::tsquery AS "true"; + +-- tsvector editing operations + +SELECT strip('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd'::tsvector); +SELECT strip('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT strip('base hidden rebel spaceship strike'::tsvector); + +SELECT ts_delete(to_tsvector('english', 'Rebel spaceships, striking from a hidden base'), 'spaceship'); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'base'); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bas'); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'bases'); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, 'spaceship'); +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, 'spaceship'); + +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','rebel']); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceships','rebel']); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceshi','rebel']); +SELECT ts_delete('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector, ARRAY['spaceship','leya','rebel']); +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel']); +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel','rebel']); +SELECT ts_delete('base hidden rebel spaceship strike'::tsvector, ARRAY['spaceship','leya','rebel', NULL]); + +SELECT unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT unnest('base hidden rebel spaceship strike'::tsvector); +SELECT * FROM unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT * FROM unnest('base hidden rebel spaceship strike'::tsvector); +SELECT lexeme, positions[1] from unnest('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); + +SELECT tsvector_to_array('base:7 hidden:6 rebel:1 spaceship:2,33A,34B,35C,36D strike:3'::tsvector); +SELECT tsvector_to_array('base hidden rebel spaceship strike'::tsvector); + +SELECT array_to_tsvector(ARRAY['base','hidden','rebel','spaceship','strike']); +SELECT array_to_tsvector(ARRAY['base','hidden','rebel','spaceship', NULL]); +-- array_to_tsvector must sort and de-dup +SELECT array_to_tsvector(ARRAY['foo','bar','baz','bar']); + +SELECT setweight('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd zxc:81,567,222A'::tsvector, 'c'); +SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c'); +SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); +SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a}'); +SELECT setweight('a:1,3A asd:1C w:5,6,12B,13A zxc:81,222A,567'::tsvector, 'c', '{a,zxc}'); +SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', '{a,zxc}'); +SELECT setweight('a asd w:5,6,12B,13A zxc'::tsvector, 'c', ARRAY['a', 'zxc', NULL]); + +SELECT ts_filter('base:7A empir:17 evil:15 first:11 galact:16 hidden:6A rebel:1A spaceship:2A strike:3A victori:12 won:9'::tsvector, '{a}'); +SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a}'); +SELECT ts_filter('base hidden rebel spaceship strike'::tsvector, '{a,b,NULL}'); diff --git a/postgresql/examples/tuplesort.sql b/postgresql/examples/tuplesort.sql new file mode 100644 index 0000000..735f403 --- /dev/null +++ b/postgresql/examples/tuplesort.sql @@ -0,0 +1,293 @@ +-- only use parallelism when explicitly intending to do so +SET max_parallel_maintenance_workers = 0; +SET max_parallel_workers = 0; + +-- A table with with contents that, when sorted, triggers abbreviated +-- key aborts. One easy way to achieve that is to use uuids that all +-- have the same prefix, as abbreviated keys for uuids just use the +-- first sizeof(Datum) bytes. +CREATE TEMP TABLE abbrev_abort_uuids ( + id serial not null, + abort_increasing uuid, + abort_decreasing uuid, + noabort_increasing uuid, + noabort_decreasing uuid); + +INSERT INTO abbrev_abort_uuids (abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing) + SELECT + ('00000000-0000-0000-0000-'||to_char(g.i, '000000000000FM'))::uuid abort_increasing, + ('00000000-0000-0000-0000-'||to_char(20000 - g.i, '000000000000FM'))::uuid abort_decreasing, + (to_char(g.i % 10009, '00000000FM')||'-0000-0000-0000-'||to_char(g.i, '000000000000FM'))::uuid noabort_increasing, + (to_char(((20000 - g.i) % 10009), '00000000FM')||'-0000-0000-0000-'||to_char(20000 - g.i, '000000000000FM'))::uuid noabort_decreasing + FROM generate_series(0, 20000, 1) g(i); + +-- and a few NULLs +INSERT INTO abbrev_abort_uuids(id) VALUES(0); +INSERT INTO abbrev_abort_uuids DEFAULT VALUES; +INSERT INTO abbrev_abort_uuids DEFAULT VALUES; + +-- add just a few duplicates +INSERT INTO abbrev_abort_uuids (abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing) + SELECT abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing + FROM abbrev_abort_uuids + WHERE (id < 10 OR id > 19990) AND id % 3 = 0 AND abort_increasing is not null; + +---- +-- Check sort node uses of tuplesort wrt. abbreviated keys +---- + +-- plain sort triggering abbreviated abort +SELECT abort_increasing, abort_decreasing FROM abbrev_abort_uuids ORDER BY abort_increasing OFFSET 20000 - 4; +SELECT abort_increasing, abort_decreasing FROM abbrev_abort_uuids ORDER BY abort_decreasing NULLS FIRST OFFSET 20000 - 4; + +-- plain sort not triggering abbreviated abort +SELECT noabort_increasing, noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_increasing OFFSET 20000 - 4; +SELECT noabort_increasing, noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing NULLS FIRST OFFSET 20000 - 4; + +-- bounded sort (disables abbreviated keys) +SELECT abort_increasing, noabort_increasing FROM abbrev_abort_uuids ORDER BY abort_increasing LIMIT 5; +SELECT abort_increasing, noabort_increasing FROM abbrev_abort_uuids ORDER BY noabort_increasing NULLS FIRST LIMIT 5; + + +---- +-- Check index creation uses of tuplesort wrt. abbreviated keys +---- + +-- index creation using abbreviated keys successfully +CREATE INDEX abbrev_abort_uuids__noabort_increasing_idx ON abbrev_abort_uuids (noabort_increasing); +CREATE INDEX abbrev_abort_uuids__noabort_decreasing_idx ON abbrev_abort_uuids (noabort_decreasing); + +-- verify +EXPLAIN (COSTS OFF) +SELECT id, noabort_increasing, noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_increasing LIMIT 5; +SELECT id, noabort_increasing, noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_increasing LIMIT 5; +EXPLAIN (COSTS OFF) +SELECT id, noabort_increasing, noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing LIMIT 5; +SELECT id, noabort_increasing, noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing LIMIT 5; + +-- index creation using abbreviated keys, hitting abort +CREATE INDEX abbrev_abort_uuids__abort_increasing_idx ON abbrev_abort_uuids (abort_increasing); +CREATE INDEX abbrev_abort_uuids__abort_decreasing_idx ON abbrev_abort_uuids (abort_decreasing); + +-- verify +EXPLAIN (COSTS OFF) +SELECT id, abort_increasing, abort_decreasing FROM abbrev_abort_uuids ORDER BY abort_increasing LIMIT 5; +SELECT id, abort_increasing, abort_decreasing FROM abbrev_abort_uuids ORDER BY abort_increasing LIMIT 5; +EXPLAIN (COSTS OFF) +SELECT id, abort_increasing, abort_decreasing FROM abbrev_abort_uuids ORDER BY abort_decreasing LIMIT 5; +SELECT id, abort_increasing, abort_decreasing FROM abbrev_abort_uuids ORDER BY abort_decreasing LIMIT 5; + + +---- +-- Check CLUSTER uses of tuplesort wrt. abbreviated keys +---- + +-- when aborting, increasing order +BEGIN; +SET LOCAL enable_indexscan = false; +CLUSTER abbrev_abort_uuids USING abbrev_abort_uuids__abort_increasing_idx; + +-- head +SELECT id, abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing +FROM abbrev_abort_uuids +ORDER BY ctid LIMIT 5; + +-- tail +SELECT id, abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing +FROM abbrev_abort_uuids +ORDER BY ctid DESC LIMIT 5; +ROLLBACK; + +-- when aborting, decreasing order +BEGIN; +SET LOCAL enable_indexscan = false; +CLUSTER abbrev_abort_uuids USING abbrev_abort_uuids__abort_decreasing_idx; + +-- head +SELECT id, abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing +FROM abbrev_abort_uuids +ORDER BY ctid LIMIT 5; + +-- tail +SELECT id, abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing +FROM abbrev_abort_uuids +ORDER BY ctid DESC LIMIT 5; +ROLLBACK; + +-- when not aborting, increasing order +BEGIN; +SET LOCAL enable_indexscan = false; +CLUSTER abbrev_abort_uuids USING abbrev_abort_uuids__noabort_increasing_idx; + +-- head +SELECT id, abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing +FROM abbrev_abort_uuids +ORDER BY ctid LIMIT 5; + +-- tail +SELECT id, abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing +FROM abbrev_abort_uuids +ORDER BY ctid DESC LIMIT 5; +ROLLBACK; + +-- when no aborting, decreasing order +BEGIN; +SET LOCAL enable_indexscan = false; +CLUSTER abbrev_abort_uuids USING abbrev_abort_uuids__noabort_decreasing_idx; + +-- head +SELECT id, abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing +FROM abbrev_abort_uuids +ORDER BY ctid LIMIT 5; + +-- tail +SELECT id, abort_increasing, abort_decreasing, noabort_increasing, noabort_decreasing +FROM abbrev_abort_uuids +ORDER BY ctid DESC LIMIT 5; +ROLLBACK; + +---- +-- test forward and backward scans for in-memory and disk based tuplesort +---- + +-- in-memory +BEGIN; +SET LOCAL enable_indexscan = false; +-- unfortunately can't show analyze output confirming sort method, +-- the memory used output wouldn't be stable +EXPLAIN (COSTS OFF) DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing; +DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing; + +-- first and second +FETCH NEXT FROM c; +FETCH NEXT FROM c; + +-- scroll beyond beginning +FETCH BACKWARD FROM c; +FETCH BACKWARD FROM c; +FETCH BACKWARD FROM c; +FETCH BACKWARD FROM c; +FETCH NEXT FROM c; + +-- scroll beyond end end +FETCH LAST FROM c; +FETCH BACKWARD FROM c; +FETCH NEXT FROM c; +FETCH NEXT FROM c; +FETCH NEXT FROM c; +FETCH BACKWARD FROM c; +FETCH NEXT FROM c; + +COMMIT; + +-- disk based +BEGIN; +SET LOCAL enable_indexscan = false; +SET LOCAL work_mem = '100kB'; +-- unfortunately can't show analyze output confirming sort method, +-- the memory used output wouldn't be stable +EXPLAIN (COSTS OFF) DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing; +DECLARE c SCROLL CURSOR FOR SELECT noabort_decreasing FROM abbrev_abort_uuids ORDER BY noabort_decreasing; + +-- first and second +FETCH NEXT FROM c; +FETCH NEXT FROM c; + +-- scroll beyond beginning +FETCH BACKWARD FROM c; +FETCH BACKWARD FROM c; +FETCH BACKWARD FROM c; +FETCH BACKWARD FROM c; +FETCH NEXT FROM c; + +-- scroll beyond end end +FETCH LAST FROM c; +FETCH BACKWARD FROM c; +FETCH NEXT FROM c; +FETCH NEXT FROM c; +FETCH NEXT FROM c; +FETCH BACKWARD FROM c; +FETCH NEXT FROM c; + +COMMIT; + + +---- +-- test tuplesort using both in-memory and disk sort +--- + +-- memory based +SELECT + -- fixed-width by-value datum + (array_agg(id ORDER BY id DESC NULLS FIRST))[0:5], + -- fixed-width by-ref datum + (array_agg(abort_increasing ORDER BY abort_increasing DESC NULLS LAST))[0:5], + -- variable-width datum + (array_agg(id::text ORDER BY id::text DESC NULLS LAST))[0:5], + -- fixed width by-value datum tuplesort + percentile_disc(0.99) WITHIN GROUP (ORDER BY id), + -- ensure state is shared + percentile_disc(0.01) WITHIN GROUP (ORDER BY id), + -- fixed width by-ref datum tuplesort + percentile_disc(0.8) WITHIN GROUP (ORDER BY abort_increasing), + -- variable width by-ref datum tuplesort + percentile_disc(0.2) WITHIN GROUP (ORDER BY id::text), + -- multi-column tuplesort + rank('00000000-0000-0000-0000-000000000000', '2', '2') WITHIN GROUP (ORDER BY noabort_increasing, id, id::text) +FROM ( + SELECT * FROM abbrev_abort_uuids + UNION ALL + SELECT NULL, NULL, NULL, NULL, NULL) s; + +-- disk based (see also above) +BEGIN; +SET LOCAL work_mem = '100kB'; + +SELECT + (array_agg(id ORDER BY id DESC NULLS FIRST))[0:5], + (array_agg(abort_increasing ORDER BY abort_increasing DESC NULLS LAST))[0:5], + (array_agg(id::text ORDER BY id::text DESC NULLS LAST))[0:5], + percentile_disc(0.99) WITHIN GROUP (ORDER BY id), + percentile_disc(0.01) WITHIN GROUP (ORDER BY id), + percentile_disc(0.8) WITHIN GROUP (ORDER BY abort_increasing), + percentile_disc(0.2) WITHIN GROUP (ORDER BY id::text), + rank('00000000-0000-0000-0000-000000000000', '2', '2') WITHIN GROUP (ORDER BY noabort_increasing, id, id::text) +FROM ( + SELECT * FROM abbrev_abort_uuids + UNION ALL + SELECT NULL, NULL, NULL, NULL, NULL) s; + +ROLLBACK; + + +---- +-- test tuplesort mark/restore +--- + +CREATE TEMP TABLE test_mark_restore(col1 int, col2 int, col12 int); +-- need a few duplicates for mark/restore to matter +INSERT INTO test_mark_restore(col1, col2, col12) + SELECT a.i, b.i, a.i * b.i FROM generate_series(1, 500) a(i), generate_series(1, 5) b(i); + +BEGIN; + +SET LOCAL enable_nestloop = off; +SET LOCAL enable_hashjoin = off; +SET LOCAL enable_material = off; + +-- set query into variable once, to avoid repetition of the fairly long query +SELECT $$ + SELECT col12, count(distinct a.col1), count(distinct a.col2), count(distinct b.col1), count(distinct b.col2), count(*) + FROM test_mark_restore a + JOIN test_mark_restore b USING(col12) + GROUP BY 1 + HAVING count(*) > 1 + ORDER BY 2 DESC, 1 DESC, 3 DESC, 4 DESC, 5 DESC, 6 DESC + LIMIT 10 +$$ AS qry; + + +-- test mark/restore with on-disk sorts +SET LOCAL work_mem = '100kB'; + +COMMIT; diff --git a/postgresql/examples/txid.sql b/postgresql/examples/txid.sql new file mode 100644 index 0000000..f5f14d7 --- /dev/null +++ b/postgresql/examples/txid.sql @@ -0,0 +1,95 @@ +-- txid_snapshot data type and related functions +-- Note: these are backward-compatibility functions and types, and have been +-- replaced by new xid8-based variants. See xid.sql. The txid variants will +-- be removed in a future release. + +-- i/o +select '12:13:'::txid_snapshot; +select '12:18:14,16'::txid_snapshot; +select '12:16:14,14'::txid_snapshot; + +-- errors +select '31:12:'::txid_snapshot; +select '0:1:'::txid_snapshot; +select '12:13:0'::txid_snapshot; +select '12:16:14,13'::txid_snapshot; + +create temp table snapshot_test ( + nr integer, + snap txid_snapshot +); + +insert into snapshot_test values (1, '12:13:'); +insert into snapshot_test values (2, '12:20:13,15,18'); +insert into snapshot_test values (3, '100001:100009:100005,100007,100008'); +insert into snapshot_test values (4, '100:150:101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131'); +select snap from snapshot_test order by nr; + +select txid_snapshot_xmin(snap), + txid_snapshot_xmax(snap), + txid_snapshot_xip(snap) +from snapshot_test order by nr; + +select id, txid_visible_in_snapshot(id, snap) +from snapshot_test, generate_series(11, 21) id +where nr = 2; + +-- test bsearch +select id, txid_visible_in_snapshot(id, snap) +from snapshot_test, generate_series(90, 160) id +where nr = 4; + +-- test current values also +select txid_current() >= txid_snapshot_xmin(txid_current_snapshot()); + +-- we can't assume current is always less than xmax, however + +select txid_visible_in_snapshot(txid_current(), txid_current_snapshot()); + +-- test 64bitness + +select txid_snapshot '1000100010001000:1000100010001100:1000100010001012,1000100010001013'; +select txid_visible_in_snapshot('1000100010001012', '1000100010001000:1000100010001100:1000100010001012,1000100010001013'); +select txid_visible_in_snapshot('1000100010001015', '1000100010001000:1000100010001100:1000100010001012,1000100010001013'); + +-- test 64bit overflow +SELECT txid_snapshot '1:9223372036854775807:3'; +SELECT txid_snapshot '1:9223372036854775808:3'; + +-- test txid_current_if_assigned +BEGIN; +SELECT txid_current_if_assigned() IS NULL; +SELECT txid_current(); + +COMMIT; + +-- test xid status functions +BEGIN; +COMMIT; + +BEGIN; +ROLLBACK; + +BEGIN; + +SELECT txid_status(1); -- BootstrapTransactionId is always committed +SELECT txid_status(2); -- FrozenTransactionId is always committed +SELECT txid_status(3); -- in regress testing FirstNormalTransactionId will always be behind oldestXmin + +COMMIT; + +BEGIN; +CREATE FUNCTION test_future_xid_status(bigint) +RETURNS void +LANGUAGE plpgsql +AS +$$ +BEGIN + PERFORM txid_status($1); + RAISE EXCEPTION 'didn''t ERROR at xid in the future as expected'; +EXCEPTION + WHEN invalid_parameter_value THEN + RAISE NOTICE 'Got expected error for xid in the future'; +END; +$$; +ROLLBACK; diff --git a/postgresql/examples/type_sanity.sql b/postgresql/examples/type_sanity.sql new file mode 100644 index 0000000..4b492ce --- /dev/null +++ b/postgresql/examples/type_sanity.sql @@ -0,0 +1,469 @@ +-- +-- TYPE_SANITY +-- Sanity checks for common errors in making type-related system tables: +-- pg_type, pg_class, pg_attribute, pg_range. +-- +-- None of the SELECTs here should ever find any matching entries, +-- so the expected output is easy to maintain ;-). +-- A test failure indicates someone messed up an entry in the system tables. +-- +-- NB: we assume the oidjoins test will have caught any dangling links, +-- that is OID or REGPROC fields that are not zero and do not match some +-- row in the linked-to table. However, if we want to enforce that a link +-- field can't be 0, we have to check it here. + +-- **************** pg_type **************** + +-- Look for illegal values in pg_type fields. + +SELECT p1.oid, p1.typname +FROM pg_type as p1 +WHERE p1.typnamespace = 0 OR + (p1.typlen <= 0 AND p1.typlen != -1 AND p1.typlen != -2) OR + (p1.typtype not in ('b', 'c', 'd', 'e', 'p', 'r')) OR + NOT p1.typisdefined OR + (p1.typalign not in ('c', 's', 'i', 'd')) OR + (p1.typstorage not in ('p', 'x', 'e', 'm')); + +-- Look for "pass by value" types that can't be passed by value. + +SELECT p1.oid, p1.typname +FROM pg_type as p1 +WHERE p1.typbyval AND + (p1.typlen != 1 OR p1.typalign != 'c') AND + (p1.typlen != 2 OR p1.typalign != 's') AND + (p1.typlen != 4 OR p1.typalign != 'i') AND + (p1.typlen != 8 OR p1.typalign != 'd'); + +-- Look for "toastable" types that aren't varlena. + +SELECT p1.oid, p1.typname +FROM pg_type as p1 +WHERE p1.typstorage != 'p' AND + (p1.typbyval OR p1.typlen != -1); + +-- Look for complex types that do not have a typrelid entry, +-- or basic types that do. + +SELECT p1.oid, p1.typname +FROM pg_type as p1 +WHERE (p1.typtype = 'c' AND p1.typrelid = 0) OR + (p1.typtype != 'c' AND p1.typrelid != 0); + +-- Look for types that should have an array type according to their typtype, +-- but don't. We exclude composites here because we have not bothered to +-- make array types corresponding to the system catalogs' rowtypes. +-- NOTE: as of v10, this check finds pg_node_tree, pg_ndistinct, smgr. + +SELECT p1.oid, p1.typname +FROM pg_type as p1 +WHERE p1.typtype not in ('c','d','p') AND p1.typname NOT LIKE E'\\_%' + AND NOT EXISTS + (SELECT 1 FROM pg_type as p2 + WHERE p2.typname = ('_' || p1.typname)::name AND + p2.typelem = p1.oid and p1.typarray = p2.oid); + +-- Make sure typarray points to a varlena array type of our own base +SELECT p1.oid, p1.typname as basetype, p2.typname as arraytype, + p2.typelem, p2.typlen +FROM pg_type p1 LEFT JOIN pg_type p2 ON (p1.typarray = p2.oid) +WHERE p1.typarray <> 0 AND + (p2.oid IS NULL OR p2.typelem <> p1.oid OR p2.typlen <> -1); + +-- Look for range types that do not have a pg_range entry +SELECT p1.oid, p1.typname +FROM pg_type as p1 +WHERE p1.typtype = 'r' AND + NOT EXISTS(SELECT 1 FROM pg_range r WHERE rngtypid = p1.oid); + +-- Look for range types whose typalign isn't sufficient +SELECT p1.oid, p1.typname, p1.typalign, p2.typname, p2.typalign +FROM pg_type as p1 + LEFT JOIN pg_range as r ON rngtypid = p1.oid + LEFT JOIN pg_type as p2 ON rngsubtype = p2.oid +WHERE p1.typtype = 'r' AND + (p1.typalign != (CASE WHEN p2.typalign = 'd' THEN 'd'::"char" + ELSE 'i'::"char" END) + OR p2.oid IS NULL); + +-- Text conversion routines must be provided. + +SELECT p1.oid, p1.typname +FROM pg_type as p1 +WHERE (p1.typinput = 0 OR p1.typoutput = 0); + +-- Check for bogus typinput routines + +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typinput = p2.oid AND NOT + ((p2.pronargs = 1 AND p2.proargtypes[0] = 'cstring'::regtype) OR + (p2.pronargs = 2 AND p2.proargtypes[0] = 'cstring'::regtype AND + p2.proargtypes[1] = 'oid'::regtype) OR + (p2.pronargs = 3 AND p2.proargtypes[0] = 'cstring'::regtype AND + p2.proargtypes[1] = 'oid'::regtype AND + p2.proargtypes[2] = 'int4'::regtype)); + +-- Check for type of the variadic array parameter's elements. +-- provariadic should be ANYOID if the type of the last element is ANYOID, +-- ANYELEMENTOID if the type of the last element is ANYARRAYOID, +-- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID, +-- and otherwise the element type corresponding to the array type. + +SELECT oid::regprocedure, provariadic::regtype, proargtypes::regtype[] +FROM pg_proc +WHERE provariadic != 0 +AND case proargtypes[array_length(proargtypes, 1)-1] + WHEN '"any"'::regtype THEN '"any"'::regtype + WHEN 'anyarray'::regtype THEN 'anyelement'::regtype + WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype + ELSE (SELECT t.oid + FROM pg_type t + WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1]) + END != provariadic; + +-- Check that all and only those functions with a variadic type have +-- a variadic argument. +SELECT oid::regprocedure, proargmodes, provariadic +FROM pg_proc +WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes)) + IS DISTINCT FROM + (provariadic != 0); + +-- As of 8.0, this check finds refcursor, which is borrowing +-- other types' I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typinput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + (p1.typelem != 0 AND p1.typlen < 0) AND NOT + (p2.prorettype = p1.oid AND NOT p2.proretset) +ORDER BY 1; + +-- Varlena array types will point to array_in +-- Exception as of 8.1: int2vector and oidvector have their own I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typinput = p2.oid AND + (p1.typelem != 0 AND p1.typlen < 0) AND NOT + (p2.oid = 'array_in'::regproc) +ORDER BY 1; + +-- typinput routines should not be volatile +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typinput = p2.oid AND p2.provolatile NOT IN ('i', 's'); + +-- Composites, domains, enums, ranges should all use the same input routines +SELECT DISTINCT typtype, typinput +FROM pg_type AS p1 +WHERE p1.typtype not in ('b', 'p') +ORDER BY 1; + +-- Check for bogus typoutput routines + +-- As of 8.0, this check finds refcursor, which is borrowing +-- other types' I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typoutput = p2.oid AND p1.typtype in ('b', 'p') AND NOT + (p2.pronargs = 1 AND + (p2.proargtypes[0] = p1.oid OR + (p2.oid = 'array_out'::regproc AND + p1.typelem != 0 AND p1.typlen = -1))) +ORDER BY 1; + +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typoutput = p2.oid AND NOT + (p2.prorettype = 'cstring'::regtype AND NOT p2.proretset); + +-- typoutput routines should not be volatile +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typoutput = p2.oid AND p2.provolatile NOT IN ('i', 's'); + +-- Composites, enums, ranges should all use the same output routines +SELECT DISTINCT typtype, typoutput +FROM pg_type AS p1 +WHERE p1.typtype not in ('b', 'd', 'p') +ORDER BY 1; + +-- Domains should have same typoutput as their base types +SELECT p1.oid, p1.typname, p2.oid, p2.typname +FROM pg_type AS p1 LEFT JOIN pg_type AS p2 ON p1.typbasetype = p2.oid +WHERE p1.typtype = 'd' AND p1.typoutput IS DISTINCT FROM p2.typoutput; + +-- Check for bogus typreceive routines + +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typreceive = p2.oid AND NOT + ((p2.pronargs = 1 AND p2.proargtypes[0] = 'internal'::regtype) OR + (p2.pronargs = 2 AND p2.proargtypes[0] = 'internal'::regtype AND + p2.proargtypes[1] = 'oid'::regtype) OR + (p2.pronargs = 3 AND p2.proargtypes[0] = 'internal'::regtype AND + p2.proargtypes[1] = 'oid'::regtype AND + p2.proargtypes[2] = 'int4'::regtype)); + +-- As of 7.4, this check finds refcursor, which is borrowing +-- other types' I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typreceive = p2.oid AND p1.typtype in ('b', 'p') AND NOT + (p1.typelem != 0 AND p1.typlen < 0) AND NOT + (p2.prorettype = p1.oid AND NOT p2.proretset) +ORDER BY 1; + +-- Varlena array types will point to array_recv +-- Exception as of 8.1: int2vector and oidvector have their own I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typreceive = p2.oid AND + (p1.typelem != 0 AND p1.typlen < 0) AND NOT + (p2.oid = 'array_recv'::regproc) +ORDER BY 1; + +-- Suspicious if typreceive doesn't take same number of args as typinput +SELECT p1.oid, p1.typname, p2.oid, p2.proname, p3.oid, p3.proname +FROM pg_type AS p1, pg_proc AS p2, pg_proc AS p3 +WHERE p1.typinput = p2.oid AND p1.typreceive = p3.oid AND + p2.pronargs != p3.pronargs; + +-- typreceive routines should not be volatile +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typreceive = p2.oid AND p2.provolatile NOT IN ('i', 's'); + +-- Composites, domains, enums, ranges should all use the same receive routines +SELECT DISTINCT typtype, typreceive +FROM pg_type AS p1 +WHERE p1.typtype not in ('b', 'p') +ORDER BY 1; + +-- Check for bogus typsend routines + +-- As of 7.4, this check finds refcursor, which is borrowing +-- other types' I/O routines +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typsend = p2.oid AND p1.typtype in ('b', 'p') AND NOT + (p2.pronargs = 1 AND + (p2.proargtypes[0] = p1.oid OR + (p2.oid = 'array_send'::regproc AND + p1.typelem != 0 AND p1.typlen = -1))) +ORDER BY 1; + +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typsend = p2.oid AND NOT + (p2.prorettype = 'bytea'::regtype AND NOT p2.proretset); + +-- typsend routines should not be volatile +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typsend = p2.oid AND p2.provolatile NOT IN ('i', 's'); + +-- Composites, enums, ranges should all use the same send routines +SELECT DISTINCT typtype, typsend +FROM pg_type AS p1 +WHERE p1.typtype not in ('b', 'd', 'p') +ORDER BY 1; + +-- Domains should have same typsend as their base types +SELECT p1.oid, p1.typname, p2.oid, p2.typname +FROM pg_type AS p1 LEFT JOIN pg_type AS p2 ON p1.typbasetype = p2.oid +WHERE p1.typtype = 'd' AND p1.typsend IS DISTINCT FROM p2.typsend; + +-- Check for bogus typmodin routines + +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typmodin = p2.oid AND NOT + (p2.pronargs = 1 AND + p2.proargtypes[0] = 'cstring[]'::regtype AND + p2.prorettype = 'int4'::regtype AND NOT p2.proretset); + +-- typmodin routines should not be volatile +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typmodin = p2.oid AND p2.provolatile NOT IN ('i', 's'); + +-- Check for bogus typmodout routines + +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typmodout = p2.oid AND NOT + (p2.pronargs = 1 AND + p2.proargtypes[0] = 'int4'::regtype AND + p2.prorettype = 'cstring'::regtype AND NOT p2.proretset); + +-- typmodout routines should not be volatile +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typmodout = p2.oid AND p2.provolatile NOT IN ('i', 's'); + +-- Array types should have same typmodin/out as their element types + +SELECT p1.oid, p1.typname, p2.oid, p2.typname +FROM pg_type AS p1, pg_type AS p2 +WHERE p1.typelem = p2.oid AND NOT + (p1.typmodin = p2.typmodin AND p1.typmodout = p2.typmodout); + +-- Array types should have same typdelim as their element types + +SELECT p1.oid, p1.typname, p2.oid, p2.typname +FROM pg_type AS p1, pg_type AS p2 +WHERE p1.typarray = p2.oid AND NOT (p1.typdelim = p2.typdelim); + +-- Look for array types whose typalign isn't sufficient + +SELECT p1.oid, p1.typname, p1.typalign, p2.typname, p2.typalign +FROM pg_type AS p1, pg_type AS p2 +WHERE p1.typarray = p2.oid AND + p2.typalign != (CASE WHEN p1.typalign = 'd' THEN 'd'::"char" + ELSE 'i'::"char" END); + +-- Check for bogus typanalyze routines + +SELECT p1.oid, p1.typname, p2.oid, p2.proname +FROM pg_type AS p1, pg_proc AS p2 +WHERE p1.typanalyze = p2.oid AND NOT + (p2.pronargs = 1 AND + p2.proargtypes[0] = 'internal'::regtype AND + p2.prorettype = 'bool'::regtype AND NOT p2.proretset); + +-- there does not seem to be a reason to care about volatility of typanalyze + +-- domains inherit their base type's typanalyze + +SELECT d.oid, d.typname, d.typanalyze, t.oid, t.typname, t.typanalyze +FROM pg_type d JOIN pg_type t ON d.typbasetype = t.oid +WHERE d.typanalyze != t.typanalyze; + +-- range_typanalyze should be used for all and only range types +-- (but exclude domains, which we checked above) + +SELECT t.oid, t.typname, t.typanalyze +FROM pg_type t LEFT JOIN pg_range r on t.oid = r.rngtypid +WHERE t.typbasetype = 0 AND + (t.typanalyze = 'range_typanalyze'::regproc) != (r.rngtypid IS NOT NULL); + +-- array_typanalyze should be used for all and only array types +-- (but exclude domains, which we checked above) +-- As of 9.2 this finds int2vector and oidvector, which are weird anyway + +SELECT t.oid, t.typname, t.typanalyze +FROM pg_type t +WHERE t.typbasetype = 0 AND + (t.typanalyze = 'array_typanalyze'::regproc) != + (typelem != 0 AND typlen < 0) +ORDER BY 1; + +-- **************** pg_class **************** + +-- Look for illegal values in pg_class fields + +SELECT p1.oid, p1.relname +FROM pg_class as p1 +WHERE relkind NOT IN ('r', 'i', 'S', 't', 'v', 'm', 'c', 'f', 'p') OR + relpersistence NOT IN ('p', 'u', 't') OR + relreplident NOT IN ('d', 'n', 'f', 'i'); + +-- All tables and indexes should have an access method. +SELECT p1.oid, p1.relname +FROM pg_class as p1 +WHERE p1.relkind NOT IN ('S', 'v', 'f', 'c') and + p1.relam = 0; + +-- Conversely, sequences, views, types shouldn't have them +SELECT p1.oid, p1.relname +FROM pg_class as p1 +WHERE p1.relkind IN ('S', 'v', 'f', 'c') and + p1.relam != 0; + +-- Indexes should have AMs of type 'i' +SELECT pc.oid, pc.relname, pa.amname, pa.amtype +FROM pg_class as pc JOIN pg_am AS pa ON (pc.relam = pa.oid) +WHERE pc.relkind IN ('i') and + pa.amtype != 'i'; + +-- Tables, matviews etc should have AMs of type 't' +SELECT pc.oid, pc.relname, pa.amname, pa.amtype +FROM pg_class as pc JOIN pg_am AS pa ON (pc.relam = pa.oid) +WHERE pc.relkind IN ('r', 't', 'm') and + pa.amtype != 't'; + +-- **************** pg_attribute **************** + +-- Look for illegal values in pg_attribute fields + +SELECT p1.attrelid, p1.attname +FROM pg_attribute as p1 +WHERE p1.attrelid = 0 OR p1.atttypid = 0 OR p1.attnum = 0 OR + p1.attcacheoff != -1 OR p1.attinhcount < 0 OR + (p1.attinhcount = 0 AND NOT p1.attislocal); + +-- Cross-check attnum against parent relation + +SELECT p1.attrelid, p1.attname, p2.oid, p2.relname +FROM pg_attribute AS p1, pg_class AS p2 +WHERE p1.attrelid = p2.oid AND p1.attnum > p2.relnatts; + +-- Detect missing pg_attribute entries: should have as many non-system +-- attributes as parent relation expects + +SELECT p1.oid, p1.relname +FROM pg_class AS p1 +WHERE p1.relnatts != (SELECT count(*) FROM pg_attribute AS p2 + WHERE p2.attrelid = p1.oid AND p2.attnum > 0); + +-- Cross-check against pg_type entry +-- NOTE: we allow attstorage to be 'plain' even when typstorage is not; +-- this is mainly for toast tables. + +SELECT p1.attrelid, p1.attname, p2.oid, p2.typname +FROM pg_attribute AS p1, pg_type AS p2 +WHERE p1.atttypid = p2.oid AND + (p1.attlen != p2.typlen OR + p1.attalign != p2.typalign OR + p1.attbyval != p2.typbyval OR + (p1.attstorage != p2.typstorage AND p1.attstorage != 'p')); + +-- **************** pg_range **************** + +-- Look for illegal values in pg_range fields. + +SELECT p1.rngtypid, p1.rngsubtype +FROM pg_range as p1 +WHERE p1.rngtypid = 0 OR p1.rngsubtype = 0 OR p1.rngsubopc = 0; + +-- rngcollation should be specified iff subtype is collatable + +SELECT p1.rngtypid, p1.rngsubtype, p1.rngcollation, t.typcollation +FROM pg_range p1 JOIN pg_type t ON t.oid = p1.rngsubtype +WHERE (rngcollation = 0) != (typcollation = 0); + +-- opclass had better be a btree opclass accepting the subtype. +-- We must allow anyarray matches, cf opr_sanity's binary_coercible() + +SELECT p1.rngtypid, p1.rngsubtype, o.opcmethod, o.opcname +FROM pg_range p1 JOIN pg_opclass o ON o.oid = p1.rngsubopc +WHERE o.opcmethod != 403 OR + ((o.opcintype != p1.rngsubtype) AND NOT + (o.opcintype = 'pg_catalog.anyarray'::regtype AND + EXISTS(select 1 from pg_catalog.pg_type where + oid = p1.rngsubtype and typelem != 0 and typlen = -1))); + +-- canonical function, if any, had better match the range type + +SELECT p1.rngtypid, p1.rngsubtype, p.proname +FROM pg_range p1 JOIN pg_proc p ON p.oid = p1.rngcanonical +WHERE pronargs != 1 OR proargtypes[0] != rngtypid OR prorettype != rngtypid; + +-- subdiff function, if any, had better match the subtype + +SELECT p1.rngtypid, p1.rngsubtype, p.proname +FROM pg_range p1 JOIN pg_proc p ON p.oid = p1.rngsubdiff +WHERE pronargs != 2 + OR proargtypes[0] != rngsubtype OR proargtypes[1] != rngsubtype + OR prorettype != 'pg_catalog.float8'::regtype; diff --git a/postgresql/examples/typed_table.sql b/postgresql/examples/typed_table.sql new file mode 100644 index 0000000..9ef0cdf --- /dev/null +++ b/postgresql/examples/typed_table.sql @@ -0,0 +1,75 @@ +CREATE TABLE ttable1 OF nothing; + +CREATE TYPE person_type AS (id int, name text); +CREATE TABLE persons OF person_type; +CREATE TABLE IF NOT EXISTS persons OF person_type; +SELECT * FROM persons; +\d persons + +CREATE FUNCTION get_all_persons() RETURNS SETOF person_type +LANGUAGE SQL +AS $$ + SELECT * FROM persons; +$$; + +SELECT * FROM get_all_persons(); + +-- certain ALTER TABLE operations on typed tables are not allowed +ALTER TABLE persons ADD COLUMN comment text; +ALTER TABLE persons DROP COLUMN name; +ALTER TABLE persons RENAME COLUMN id TO num; +ALTER TABLE persons ALTER COLUMN name TYPE varchar; +CREATE TABLE stuff (id int); +ALTER TABLE persons INHERIT stuff; + +CREATE TABLE personsx OF person_type (myname WITH OPTIONS NOT NULL); -- error + +CREATE TABLE persons2 OF person_type ( + id WITH OPTIONS PRIMARY KEY, + UNIQUE (name) +); + +\d persons2 + +CREATE TABLE persons3 OF person_type ( + PRIMARY KEY (id), + name WITH OPTIONS DEFAULT '' +); + +\d persons3 + +CREATE TABLE persons4 OF person_type ( + name WITH OPTIONS NOT NULL, + name WITH OPTIONS DEFAULT '' -- error, specified more than once +); + +DROP TYPE person_type RESTRICT; +DROP TYPE person_type CASCADE; + +CREATE TABLE persons5 OF stuff; -- only CREATE TYPE AS types may be used + +DROP TABLE stuff; + + +-- implicit casting + +CREATE TYPE person_type AS (id int, name text); +CREATE TABLE persons OF person_type; +INSERT INTO persons VALUES (1, 'test'); + +CREATE FUNCTION namelen(person_type) RETURNS int LANGUAGE SQL AS $$ SELECT length($1.name) $$; +SELECT id, namelen(persons) FROM persons; + +CREATE TABLE persons2 OF person_type ( + id WITH OPTIONS PRIMARY KEY, + UNIQUE (name) +); + +\d persons2 + +CREATE TABLE persons3 OF person_type ( + PRIMARY KEY (id), + name NOT NULL DEFAULT '' +); + +\d persons3 diff --git a/postgresql/examples/unicode.sql b/postgresql/examples/unicode.sql new file mode 100644 index 0000000..ccfc6fa --- /dev/null +++ b/postgresql/examples/unicode.sql @@ -0,0 +1,32 @@ +SELECT getdatabaseencoding() <> 'UTF8' AS skip_test \gset +\if :skip_test +\quit +\endif + +SELECT U&'\0061\0308bc' <> U&'\00E4bc' COLLATE "C" AS sanity_check; + +SELECT normalize(U&'\0061\0308\24D1c') = U&'\00E4\24D1c' COLLATE "C" AS test_default; +SELECT normalize(U&'\0061\0308\24D1c', NFC) = U&'\00E4\24D1c' COLLATE "C" AS test_nfc; +SELECT normalize(U&'\00E4bc', NFC) = U&'\00E4bc' COLLATE "C" AS test_nfc_idem; +SELECT normalize(U&'\00E4\24D1c', NFD) = U&'\0061\0308\24D1c' COLLATE "C" AS test_nfd; +SELECT normalize(U&'\0061\0308\24D1c', NFKC) = U&'\00E4bc' COLLATE "C" AS test_nfkc; +SELECT normalize(U&'\00E4\24D1c', NFKD) = U&'\0061\0308bc' COLLATE "C" AS test_nfkd; + +SELECT "normalize"('abc', 'def'); -- run-time error + +SELECT U&'\00E4\24D1c' IS NORMALIZED AS test_default; +SELECT U&'\00E4\24D1c' IS NFC NORMALIZED AS test_nfc; + +SELECT num, val, + val IS NFC NORMALIZED AS NFC, + val IS NFD NORMALIZED AS NFD, + val IS NFKC NORMALIZED AS NFKC, + val IS NFKD NORMALIZED AS NFKD +FROM + (VALUES (1, U&'\00E4bc'), + (2, U&'\0061\0308bc'), + (3, U&'\00E4\24D1c'), + (4, U&'\0061\0308\24D1c')) vals (num, val) +ORDER BY num; + +SELECT is_normalized('abc', 'def'); -- run-time error diff --git a/postgresql/examples/union.sql b/postgresql/examples/union.sql new file mode 100644 index 0000000..5f4881d --- /dev/null +++ b/postgresql/examples/union.sql @@ -0,0 +1,442 @@ +-- +-- UNION (also INTERSECT, EXCEPT) +-- + +-- Simple UNION constructs + +SELECT 1 AS two UNION SELECT 2 ORDER BY 1; + +SELECT 1 AS one UNION SELECT 1 ORDER BY 1; + +SELECT 1 AS two UNION ALL SELECT 2; + +SELECT 1 AS two UNION ALL SELECT 1; + +SELECT 1 AS three UNION SELECT 2 UNION SELECT 3 ORDER BY 1; + +SELECT 1 AS two UNION SELECT 2 UNION SELECT 2 ORDER BY 1; + +SELECT 1 AS three UNION SELECT 2 UNION ALL SELECT 2 ORDER BY 1; + +SELECT 1.1 AS two UNION SELECT 2.2 ORDER BY 1; + +-- Mixed types + +SELECT 1.1 AS two UNION SELECT 2 ORDER BY 1; + +SELECT 1 AS two UNION SELECT 2.2 ORDER BY 1; + +SELECT 1 AS one UNION SELECT 1.0::float8 ORDER BY 1; + +SELECT 1.1 AS two UNION ALL SELECT 2 ORDER BY 1; + +SELECT 1.0::float8 AS two UNION ALL SELECT 1 ORDER BY 1; + +SELECT 1.1 AS three UNION SELECT 2 UNION SELECT 3 ORDER BY 1; + +SELECT 1.1::float8 AS two UNION SELECT 2 UNION SELECT 2.0::float8 ORDER BY 1; + +SELECT 1.1 AS three UNION SELECT 2 UNION ALL SELECT 2 ORDER BY 1; + +SELECT 1.1 AS two UNION (SELECT 2 UNION ALL SELECT 2) ORDER BY 1; + +-- +-- Try testing from tables... +-- + +SELECT f1 AS five FROM FLOAT8_TBL +UNION +SELECT f1 FROM FLOAT8_TBL +ORDER BY 1; + +SELECT f1 AS ten FROM FLOAT8_TBL +UNION ALL +SELECT f1 FROM FLOAT8_TBL; + +SELECT f1 AS nine FROM FLOAT8_TBL +UNION +SELECT f1 FROM INT4_TBL +ORDER BY 1; + +SELECT f1 AS ten FROM FLOAT8_TBL +UNION ALL +SELECT f1 FROM INT4_TBL; + +SELECT f1 AS five FROM FLOAT8_TBL + WHERE f1 BETWEEN -1e6 AND 1e6 +UNION +SELECT f1 FROM INT4_TBL + WHERE f1 BETWEEN 0 AND 1000000 +ORDER BY 1; + +SELECT CAST(f1 AS char(4)) AS three FROM VARCHAR_TBL +UNION +SELECT f1 FROM CHAR_TBL +ORDER BY 1; + +SELECT f1 AS three FROM VARCHAR_TBL +UNION +SELECT CAST(f1 AS varchar) FROM CHAR_TBL +ORDER BY 1; + +SELECT f1 AS eight FROM VARCHAR_TBL +UNION ALL +SELECT f1 FROM CHAR_TBL; + +SELECT f1 AS five FROM TEXT_TBL +UNION +SELECT f1 FROM VARCHAR_TBL +UNION +SELECT TRIM(TRAILING FROM f1) FROM CHAR_TBL +ORDER BY 1; + +-- +-- INTERSECT and EXCEPT +-- + +SELECT q2 FROM int8_tbl INTERSECT SELECT q1 FROM int8_tbl ORDER BY 1; + +SELECT q2 FROM int8_tbl INTERSECT ALL SELECT q1 FROM int8_tbl ORDER BY 1; + +SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; + +SELECT q2 FROM int8_tbl EXCEPT ALL SELECT q1 FROM int8_tbl ORDER BY 1; + +SELECT q2 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q1 FROM int8_tbl ORDER BY 1; + +SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY 1; + +SELECT q1 FROM int8_tbl EXCEPT ALL SELECT q2 FROM int8_tbl ORDER BY 1; + +SELECT q1 FROM int8_tbl EXCEPT ALL SELECT DISTINCT q2 FROM int8_tbl ORDER BY 1; + +SELECT q1 FROM int8_tbl EXCEPT ALL SELECT q1 FROM int8_tbl FOR NO KEY UPDATE; + +-- nested cases +(SELECT 1,2,3 UNION SELECT 4,5,6) INTERSECT SELECT 4,5,6; +(SELECT 1,2,3 UNION SELECT 4,5,6 ORDER BY 1,2) INTERSECT SELECT 4,5,6; +(SELECT 1,2,3 UNION SELECT 4,5,6) EXCEPT SELECT 4,5,6; +(SELECT 1,2,3 UNION SELECT 4,5,6 ORDER BY 1,2) EXCEPT SELECT 4,5,6; + +-- exercise both hashed and sorted implementations of INTERSECT/EXCEPT + +set enable_hashagg to on; + +explain (costs off) +select count(*) from + ( select unique1 from tenk1 intersect select fivethous from tenk1 ) ss; +select count(*) from + ( select unique1 from tenk1 intersect select fivethous from tenk1 ) ss; + +explain (costs off) +select unique1 from tenk1 except select unique2 from tenk1 where unique2 != 10; +select unique1 from tenk1 except select unique2 from tenk1 where unique2 != 10; + +set enable_hashagg to off; + +explain (costs off) +select count(*) from + ( select unique1 from tenk1 intersect select fivethous from tenk1 ) ss; +select count(*) from + ( select unique1 from tenk1 intersect select fivethous from tenk1 ) ss; + +explain (costs off) +select unique1 from tenk1 except select unique2 from tenk1 where unique2 != 10; +select unique1 from tenk1 except select unique2 from tenk1 where unique2 != 10; + +reset enable_hashagg; + +-- +-- Mixed types +-- + +SELECT f1 FROM float8_tbl INTERSECT SELECT f1 FROM int4_tbl ORDER BY 1; + +SELECT f1 FROM float8_tbl EXCEPT SELECT f1 FROM int4_tbl ORDER BY 1; + +-- +-- Operator precedence and (((((extra))))) parentheses +-- + +SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl ORDER BY 1; + +SELECT q1 FROM int8_tbl INTERSECT (((SELECT q2 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) ORDER BY 1; + +(((SELECT q1 FROM int8_tbl INTERSECT SELECT q2 FROM int8_tbl ORDER BY 1))) UNION ALL SELECT q2 FROM int8_tbl; + +SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; + +SELECT q1 FROM int8_tbl UNION ALL (((SELECT q2 FROM int8_tbl EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1))); + +(((SELECT q1 FROM int8_tbl UNION ALL SELECT q2 FROM int8_tbl))) EXCEPT SELECT q1 FROM int8_tbl ORDER BY 1; + +-- +-- Subqueries with ORDER BY & LIMIT clauses +-- + +-- In this syntax, ORDER BY/LIMIT apply to the result of the EXCEPT +SELECT q1,q2 FROM int8_tbl EXCEPT SELECT q2,q1 FROM int8_tbl +ORDER BY q2,q1; + +-- This should fail, because q2 isn't a name of an EXCEPT output column +SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1; + +-- But this should work: +SELECT q1 FROM int8_tbl EXCEPT (((SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1))) ORDER BY 1; + +-- +-- New syntaxes (7.1) permit new tests +-- + +(((((select * from int8_tbl))))); + +-- +-- Check behavior with empty select list (allowed since 9.4) +-- + +select union select; +select intersect select; +select except select; + +-- check hashed implementation +set enable_hashagg = true; +set enable_sort = false; + +explain (costs off) +select from generate_series(1,5) union select from generate_series(1,3); +explain (costs off) +select from generate_series(1,5) intersect select from generate_series(1,3); + +select from generate_series(1,5) union select from generate_series(1,3); +select from generate_series(1,5) union all select from generate_series(1,3); +select from generate_series(1,5) intersect select from generate_series(1,3); +select from generate_series(1,5) intersect all select from generate_series(1,3); +select from generate_series(1,5) except select from generate_series(1,3); +select from generate_series(1,5) except all select from generate_series(1,3); + +-- check sorted implementation +set enable_hashagg = false; +set enable_sort = true; + +explain (costs off) +select from generate_series(1,5) union select from generate_series(1,3); +explain (costs off) +select from generate_series(1,5) intersect select from generate_series(1,3); + +select from generate_series(1,5) union select from generate_series(1,3); +select from generate_series(1,5) union all select from generate_series(1,3); +select from generate_series(1,5) intersect select from generate_series(1,3); +select from generate_series(1,5) intersect all select from generate_series(1,3); +select from generate_series(1,5) except select from generate_series(1,3); +select from generate_series(1,5) except all select from generate_series(1,3); + +reset enable_hashagg; +reset enable_sort; + +-- +-- Check handling of a case with unknown constants. We don't guarantee +-- an undecorated constant will work in all cases, but historically this +-- usage has worked, so test we don't break it. +-- + +SELECT a.f1 FROM (SELECT 'test' AS f1 FROM varchar_tbl) a +UNION +SELECT b.f1 FROM (SELECT f1 FROM varchar_tbl) b +ORDER BY 1; + +-- This should fail, but it should produce an error cursor +SELECT '3.4'::numeric UNION SELECT 'foo'; + +-- +-- Test that expression-index constraints can be pushed down through +-- UNION or UNION ALL +-- + +CREATE TEMP TABLE t1 (a text, b text); +CREATE INDEX t1_ab_idx on t1 ((a || b)); +CREATE TEMP TABLE t2 (ab text primary key); +INSERT INTO t1 VALUES ('a', 'b'), ('x', 'y'); +INSERT INTO t2 VALUES ('ab'), ('xy'); + +set enable_seqscan = off; +set enable_indexscan = on; +set enable_bitmapscan = off; + +explain (costs off) + SELECT * FROM + (SELECT a || b AS ab FROM t1 + UNION ALL + SELECT * FROM t2) t + WHERE ab = 'ab'; + +explain (costs off) + SELECT * FROM + (SELECT a || b AS ab FROM t1 + UNION + SELECT * FROM t2) t + WHERE ab = 'ab'; + +-- +-- Test that ORDER BY for UNION ALL can be pushed down to inheritance +-- children. +-- + +CREATE TEMP TABLE t1c (b text, a text); +ALTER TABLE t1c INHERIT t1; +CREATE TEMP TABLE t2c (primary key (ab)) INHERITS (t2); +INSERT INTO t1c VALUES ('v', 'w'), ('c', 'd'), ('m', 'n'), ('e', 'f'); +INSERT INTO t2c VALUES ('vw'), ('cd'), ('mn'), ('ef'); +CREATE INDEX t1c_ab_idx on t1c ((a || b)); + +set enable_seqscan = on; +set enable_indexonlyscan = off; + +explain (costs off) + SELECT * FROM + (SELECT a || b AS ab FROM t1 + UNION ALL + SELECT ab FROM t2) t + ORDER BY 1 LIMIT 8; + + SELECT * FROM + (SELECT a || b AS ab FROM t1 + UNION ALL + SELECT ab FROM t2) t + ORDER BY 1 LIMIT 8; + +reset enable_seqscan; +reset enable_indexscan; +reset enable_bitmapscan; + +-- This simpler variant of the above test has been observed to fail differently + +create table events (event_id int primary key); +create table other_events (event_id int primary key); +create table events_child () inherits (events); + +explain (costs off) +select event_id + from (select event_id from events + union all + select event_id from other_events) ss + order by event_id; + +drop table events_child, events, other_events; + +reset enable_indexonlyscan; + +-- Test constraint exclusion of UNION ALL subqueries +explain (costs off) + SELECT * FROM + (SELECT 1 AS t, * FROM tenk1 a + UNION ALL + SELECT 2 AS t, * FROM tenk1 b) c + WHERE t = 2; + +-- Test that we push quals into UNION sub-selects only when it's safe +explain (costs off) +SELECT * FROM + (SELECT 1 AS t, 2 AS x + UNION + SELECT 2 AS t, 4 AS x) ss +WHERE x < 4 +ORDER BY x; + +SELECT * FROM + (SELECT 1 AS t, 2 AS x + UNION + SELECT 2 AS t, 4 AS x) ss +WHERE x < 4 +ORDER BY x; + +explain (costs off) +SELECT * FROM + (SELECT 1 AS t, generate_series(1,10) AS x + UNION + SELECT 2 AS t, 4 AS x) ss +WHERE x < 4 +ORDER BY x; + +SELECT * FROM + (SELECT 1 AS t, generate_series(1,10) AS x + UNION + SELECT 2 AS t, 4 AS x) ss +WHERE x < 4 +ORDER BY x; + +explain (costs off) +SELECT * FROM + (SELECT 1 AS t, (random()*3)::int AS x + UNION + SELECT 2 AS t, 4 AS x) ss +WHERE x > 3 +ORDER BY x; + +SELECT * FROM + (SELECT 1 AS t, (random()*3)::int AS x + UNION + SELECT 2 AS t, 4 AS x) ss +WHERE x > 3 +ORDER BY x; + +-- Test cases where the native ordering of a sub-select has more pathkeys +-- than the outer query cares about +explain (costs off) +select distinct q1 from + (select distinct * from int8_tbl i81 + union all + select distinct * from int8_tbl i82) ss +where q2 = q2; + +select distinct q1 from + (select distinct * from int8_tbl i81 + union all + select distinct * from int8_tbl i82) ss +where q2 = q2; + +explain (costs off) +select distinct q1 from + (select distinct * from int8_tbl i81 + union all + select distinct * from int8_tbl i82) ss +where -q1 = q2; + +select distinct q1 from + (select distinct * from int8_tbl i81 + union all + select distinct * from int8_tbl i82) ss +where -q1 = q2; + +-- Test proper handling of parameterized appendrel paths when the +-- potential join qual is expensive +create function expensivefunc(int) returns int +language plpgsql immutable strict cost 10000 +as $$begin return $1; end$$; + +create temp table t3 as select generate_series(-1000,1000) as x; +create index t3i on t3 (expensivefunc(x)); +analyze t3; + +explain (costs off) +select * from + (select * from t3 a union all select * from t3 b) ss + join int4_tbl on f1 = expensivefunc(x); +select * from + (select * from t3 a union all select * from t3 b) ss + join int4_tbl on f1 = expensivefunc(x); + +drop table t3; +drop function expensivefunc(int); + +-- Test handling of appendrel quals that const-simplify into an AND +explain (costs off) +select * from + (select *, 0 as x from int8_tbl a + union all + select *, 1 as x from int8_tbl b) ss +where (x = 0) or (q1 >= q2 and q1 <= q2); +select * from + (select *, 0 as x from int8_tbl a + union all + select *, 1 as x from int8_tbl b) ss +where (x = 0) or (q1 >= q2 and q1 <= q2); diff --git a/postgresql/examples/updatable_views.sql b/postgresql/examples/updatable_views.sql new file mode 100644 index 0000000..1a0da1d --- /dev/null +++ b/postgresql/examples/updatable_views.sql @@ -0,0 +1,1515 @@ +-- +-- UPDATABLE VIEWS +-- + +-- avoid bit-exact output here because operations may not be bit-exact. +SET extra_float_digits = 0; + +-- check that non-updatable views and columns are rejected with useful error +-- messages + +CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified'); +INSERT INTO base_tbl SELECT i, 'Row ' || i FROM generate_series(-2, 2) g(i); + +CREATE VIEW ro_view1 AS SELECT DISTINCT a, b FROM base_tbl; -- DISTINCT not supported +CREATE VIEW ro_view2 AS SELECT a, b FROM base_tbl GROUP BY a, b; -- GROUP BY not supported +CREATE VIEW ro_view3 AS SELECT 1 FROM base_tbl HAVING max(a) > 0; -- HAVING not supported +CREATE VIEW ro_view4 AS SELECT count(*) FROM base_tbl; -- Aggregate functions not supported +CREATE VIEW ro_view5 AS SELECT a, rank() OVER() FROM base_tbl; -- Window functions not supported +CREATE VIEW ro_view6 AS SELECT a, b FROM base_tbl UNION SELECT -a, b FROM base_tbl; -- Set ops not supported +CREATE VIEW ro_view7 AS WITH t AS (SELECT a, b FROM base_tbl) SELECT * FROM t; -- WITH not supported +CREATE VIEW ro_view8 AS SELECT a, b FROM base_tbl ORDER BY a OFFSET 1; -- OFFSET not supported +CREATE VIEW ro_view9 AS SELECT a, b FROM base_tbl ORDER BY a LIMIT 1; -- LIMIT not supported +CREATE VIEW ro_view10 AS SELECT 1 AS a; -- No base relations +CREATE VIEW ro_view11 AS SELECT b1.a, b2.b FROM base_tbl b1, base_tbl b2; -- Multiple base relations +CREATE VIEW ro_view12 AS SELECT * FROM generate_series(1, 10) AS g(a); -- SRF in rangetable +CREATE VIEW ro_view13 AS SELECT a, b FROM (SELECT * FROM base_tbl) AS t; -- Subselect in rangetable +CREATE VIEW rw_view14 AS SELECT ctid, a, b FROM base_tbl; -- System columns may be part of an updatable view +CREATE VIEW rw_view15 AS SELECT a, upper(b) FROM base_tbl; -- Expression/function may be part of an updatable view +CREATE VIEW rw_view16 AS SELECT a, b, a AS aa FROM base_tbl; -- Repeated column may be part of an updatable view +CREATE VIEW ro_view17 AS SELECT * FROM ro_view1; -- Base relation not updatable +CREATE VIEW ro_view18 AS SELECT * FROM (VALUES(1)) AS tmp(a); -- VALUES in rangetable +CREATE SEQUENCE uv_seq; +CREATE VIEW ro_view19 AS SELECT * FROM uv_seq; -- View based on a sequence +CREATE VIEW ro_view20 AS SELECT a, b, generate_series(1, a) g FROM base_tbl; -- SRF in targetlist not supported + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE E'r_\\_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name LIKE E'r_\\_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE E'r_\\_view%' + ORDER BY table_name, ordinal_position; + +-- Read-only views +DELETE FROM ro_view1; +DELETE FROM ro_view2; +DELETE FROM ro_view3; +DELETE FROM ro_view4; +DELETE FROM ro_view5; +DELETE FROM ro_view6; +UPDATE ro_view7 SET a=a+1; +UPDATE ro_view8 SET a=a+1; +UPDATE ro_view9 SET a=a+1; +UPDATE ro_view10 SET a=a+1; +UPDATE ro_view11 SET a=a+1; +UPDATE ro_view12 SET a=a+1; +INSERT INTO ro_view13 VALUES (3, 'Row 3'); +-- Partially updatable view +INSERT INTO rw_view14 VALUES (null, 3, 'Row 3'); -- should fail +INSERT INTO rw_view14 (a, b) VALUES (3, 'Row 3'); -- should be OK +UPDATE rw_view14 SET ctid=null WHERE a=3; -- should fail +UPDATE rw_view14 SET b='ROW 3' WHERE a=3; -- should be OK +SELECT * FROM base_tbl; +DELETE FROM rw_view14 WHERE a=3; -- should be OK +-- Partially updatable view +INSERT INTO rw_view15 VALUES (3, 'ROW 3'); -- should fail +INSERT INTO rw_view15 (a) VALUES (3); -- should be OK +INSERT INTO rw_view15 (a) VALUES (3) ON CONFLICT DO NOTHING; -- succeeds +SELECT * FROM rw_view15; +INSERT INTO rw_view15 (a) VALUES (3) ON CONFLICT (a) DO NOTHING; -- succeeds +SELECT * FROM rw_view15; +INSERT INTO rw_view15 (a) VALUES (3) ON CONFLICT (a) DO UPDATE set a = excluded.a; -- succeeds +SELECT * FROM rw_view15; +INSERT INTO rw_view15 (a) VALUES (3) ON CONFLICT (a) DO UPDATE set upper = 'blarg'; -- fails +SELECT * FROM rw_view15; +SELECT * FROM rw_view15; +ALTER VIEW rw_view15 ALTER COLUMN upper SET DEFAULT 'NOT SET'; +INSERT INTO rw_view15 (a) VALUES (4); -- should fail +UPDATE rw_view15 SET upper='ROW 3' WHERE a=3; -- should fail +UPDATE rw_view15 SET upper=DEFAULT WHERE a=3; -- should fail +UPDATE rw_view15 SET a=4 WHERE a=3; -- should be OK +SELECT * FROM base_tbl; +DELETE FROM rw_view15 WHERE a=4; -- should be OK +-- Partially updatable view +INSERT INTO rw_view16 VALUES (3, 'Row 3', 3); -- should fail +INSERT INTO rw_view16 (a, b) VALUES (3, 'Row 3'); -- should be OK + + +SELECT * FROM base_tbl; +DELETE FROM rw_view16 WHERE a=-3; -- should be OK +-- Read-only views +INSERT INTO ro_view17 VALUES (3, 'ROW 3'); +DELETE FROM ro_view18; +UPDATE ro_view19 SET last_value=1000; +UPDATE ro_view20 SET b=upper(b); + +-- A view with a conditional INSTEAD rule but no unconditional INSTEAD rules +-- or INSTEAD OF triggers should be non-updatable and generate useful error +-- messages with appropriate detail +CREATE RULE rw_view16_ins_rule AS ON INSERT TO rw_view16 + WHERE NEW.a > 0 DO INSTEAD INSERT INTO base_tbl VALUES (NEW.a, NEW.b); +CREATE RULE rw_view16_upd_rule AS ON UPDATE TO rw_view16 + WHERE OLD.a > 0 DO INSTEAD UPDATE base_tbl SET b=NEW.b WHERE a=OLD.a; +CREATE RULE rw_view16_del_rule AS ON DELETE TO rw_view16 + WHERE OLD.a > 0 DO INSTEAD DELETE FROM base_tbl WHERE a=OLD.a; + +INSERT INTO rw_view16 (a, b) VALUES (3, 'Row 3'); -- should fail +UPDATE rw_view16 SET b='ROW 2' WHERE a=2; -- should fail +DELETE FROM rw_view16 WHERE a=2; -- should fail + +DROP TABLE base_tbl CASCADE; +DROP VIEW ro_view10, ro_view12, ro_view18; +DROP SEQUENCE uv_seq CASCADE; + +-- simple updatable view + +CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified'); +INSERT INTO base_tbl SELECT i, 'Row ' || i FROM generate_series(-2, 2) g(i); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a>0; + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name = 'rw_view1'; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name = 'rw_view1'; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name = 'rw_view1' + ORDER BY ordinal_position; + +INSERT INTO rw_view1 VALUES (3, 'Row 3'); +INSERT INTO rw_view1 (a) VALUES (4); +UPDATE rw_view1 SET a=5 WHERE a=4; +DELETE FROM rw_view1 WHERE b='Row 2'; +SELECT * FROM base_tbl; + +EXPLAIN (costs off) UPDATE rw_view1 SET a=6 WHERE a=5; +EXPLAIN (costs off) DELETE FROM rw_view1 WHERE a=5; + +DROP TABLE base_tbl CASCADE; + +-- view on top of view + +CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified'); +INSERT INTO base_tbl SELECT i, 'Row ' || i FROM generate_series(-2, 2) g(i); + +CREATE VIEW rw_view1 AS SELECT b AS bb, a AS aa FROM base_tbl WHERE a>0; +CREATE VIEW rw_view2 AS SELECT aa AS aaa, bb AS bbb FROM rw_view1 WHERE aa<10; + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name = 'rw_view2'; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name = 'rw_view2'; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name = 'rw_view2' + ORDER BY ordinal_position; + +INSERT INTO rw_view2 VALUES (3, 'Row 3'); +INSERT INTO rw_view2 (aaa) VALUES (4); +SELECT * FROM rw_view2; +UPDATE rw_view2 SET bbb='Row 4' WHERE aaa=4; +DELETE FROM rw_view2 WHERE aaa=2; +SELECT * FROM rw_view2; + +EXPLAIN (costs off) UPDATE rw_view2 SET aaa=5 WHERE aaa=4; +EXPLAIN (costs off) DELETE FROM rw_view2 WHERE aaa=4; + +DROP TABLE base_tbl CASCADE; + +-- view on top of view with rules + +CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified'); +INSERT INTO base_tbl SELECT i, 'Row ' || i FROM generate_series(-2, 2) g(i); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a>0 OFFSET 0; -- not updatable without rules/triggers +CREATE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a<10; + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name, ordinal_position; + +CREATE RULE rw_view1_ins_rule AS ON INSERT TO rw_view1 + DO INSTEAD INSERT INTO base_tbl VALUES (NEW.a, NEW.b) RETURNING *; + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name, ordinal_position; + +CREATE RULE rw_view1_upd_rule AS ON UPDATE TO rw_view1 + DO INSTEAD UPDATE base_tbl SET b=NEW.b WHERE a=OLD.a RETURNING NEW.*; + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name, ordinal_position; + +CREATE RULE rw_view1_del_rule AS ON DELETE TO rw_view1 + DO INSTEAD DELETE FROM base_tbl WHERE a=OLD.a RETURNING OLD.*; + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name, ordinal_position; + +INSERT INTO rw_view2 VALUES (3, 'Row 3') RETURNING *; +UPDATE rw_view2 SET b='Row three' WHERE a=3 RETURNING *; +SELECT * FROM rw_view2; +DELETE FROM rw_view2 WHERE a=3 RETURNING *; +SELECT * FROM rw_view2; + +EXPLAIN (costs off) UPDATE rw_view2 SET a=3 WHERE a=2; +EXPLAIN (costs off) DELETE FROM rw_view2 WHERE a=2; + +DROP TABLE base_tbl CASCADE; + +-- view on top of view with triggers + +CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified'); +INSERT INTO base_tbl SELECT i, 'Row ' || i FROM generate_series(-2, 2) g(i); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a>0 OFFSET 0; -- not updatable without rules/triggers +CREATE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a<10; + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into, + is_trigger_updatable, is_trigger_deletable, + is_trigger_insertable_into + FROM information_schema.views + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name, ordinal_position; + +CREATE FUNCTION rw_view1_trig_fn() +RETURNS trigger AS +$$ +BEGIN + IF TG_OP = 'INSERT' THEN + INSERT INTO base_tbl VALUES (NEW.a, NEW.b); + RETURN NEW; + ELSIF TG_OP = 'UPDATE' THEN + UPDATE base_tbl SET b=NEW.b WHERE a=OLD.a; + RETURN NEW; + ELSIF TG_OP = 'DELETE' THEN + DELETE FROM base_tbl WHERE a=OLD.a; + RETURN OLD; + END IF; +END; +$$ +LANGUAGE plpgsql; + +CREATE TRIGGER rw_view1_ins_trig INSTEAD OF INSERT ON rw_view1 + FOR EACH ROW EXECUTE PROCEDURE rw_view1_trig_fn(); + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into, + is_trigger_updatable, is_trigger_deletable, + is_trigger_insertable_into + FROM information_schema.views + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name, ordinal_position; + +CREATE TRIGGER rw_view1_upd_trig INSTEAD OF UPDATE ON rw_view1 + FOR EACH ROW EXECUTE PROCEDURE rw_view1_trig_fn(); + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into, + is_trigger_updatable, is_trigger_deletable, + is_trigger_insertable_into + FROM information_schema.views + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name, ordinal_position; + +CREATE TRIGGER rw_view1_del_trig INSTEAD OF DELETE ON rw_view1 + FOR EACH ROW EXECUTE PROCEDURE rw_view1_trig_fn(); + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into, + is_trigger_updatable, is_trigger_deletable, + is_trigger_insertable_into + FROM information_schema.views + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE 'rw_view%' + ORDER BY table_name, ordinal_position; + +INSERT INTO rw_view2 VALUES (3, 'Row 3') RETURNING *; +UPDATE rw_view2 SET b='Row three' WHERE a=3 RETURNING *; +SELECT * FROM rw_view2; +DELETE FROM rw_view2 WHERE a=3 RETURNING *; +SELECT * FROM rw_view2; + +EXPLAIN (costs off) UPDATE rw_view2 SET a=3 WHERE a=2; +EXPLAIN (costs off) DELETE FROM rw_view2 WHERE a=2; + +DROP TABLE base_tbl CASCADE; +DROP FUNCTION rw_view1_trig_fn(); + +-- update using whole row from view + +CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified'); +INSERT INTO base_tbl SELECT i, 'Row ' || i FROM generate_series(-2, 2) g(i); + +CREATE VIEW rw_view1 AS SELECT b AS bb, a AS aa FROM base_tbl; + +CREATE FUNCTION rw_view1_aa(x rw_view1) + RETURNS int AS $$ SELECT x.aa $$ LANGUAGE sql; + +UPDATE rw_view1 v SET bb='Updated row 2' WHERE rw_view1_aa(v)=2 + RETURNING rw_view1_aa(v), v.bb; +SELECT * FROM base_tbl; + +EXPLAIN (costs off) +UPDATE rw_view1 v SET bb='Updated row 2' WHERE rw_view1_aa(v)=2 + RETURNING rw_view1_aa(v), v.bb; + +DROP TABLE base_tbl CASCADE; + +-- permissions checks + +CREATE USER regress_view_user1; +CREATE USER regress_view_user2; + +SET SESSION AUTHORIZATION regress_view_user1; +CREATE TABLE base_tbl(a int, b text, c float); +INSERT INTO base_tbl VALUES (1, 'Row 1', 1.0); +CREATE VIEW rw_view1 AS SELECT b AS bb, c AS cc, a AS aa FROM base_tbl; +INSERT INTO rw_view1 VALUES ('Row 2', 2.0, 2); + +GRANT SELECT ON base_tbl TO regress_view_user2; +GRANT SELECT ON rw_view1 TO regress_view_user2; +GRANT UPDATE (a,c) ON base_tbl TO regress_view_user2; +GRANT UPDATE (bb,cc) ON rw_view1 TO regress_view_user2; +RESET SESSION AUTHORIZATION; + +SET SESSION AUTHORIZATION regress_view_user2; +CREATE VIEW rw_view2 AS SELECT b AS bb, c AS cc, a AS aa FROM base_tbl; +SELECT * FROM base_tbl; -- ok +SELECT * FROM rw_view1; -- ok +SELECT * FROM rw_view2; -- ok + +INSERT INTO base_tbl VALUES (3, 'Row 3', 3.0); -- not allowed +INSERT INTO rw_view1 VALUES ('Row 3', 3.0, 3); -- not allowed +INSERT INTO rw_view2 VALUES ('Row 3', 3.0, 3); -- not allowed + +UPDATE base_tbl SET a=a, c=c; -- ok +UPDATE base_tbl SET b=b; -- not allowed +UPDATE rw_view1 SET bb=bb, cc=cc; -- ok +UPDATE rw_view1 SET aa=aa; -- not allowed +UPDATE rw_view2 SET aa=aa, cc=cc; -- ok +UPDATE rw_view2 SET bb=bb; -- not allowed + +DELETE FROM base_tbl; -- not allowed +DELETE FROM rw_view1; -- not allowed +DELETE FROM rw_view2; -- not allowed +RESET SESSION AUTHORIZATION; + +SET SESSION AUTHORIZATION regress_view_user1; +GRANT INSERT, DELETE ON base_tbl TO regress_view_user2; +RESET SESSION AUTHORIZATION; + +SET SESSION AUTHORIZATION regress_view_user2; +INSERT INTO base_tbl VALUES (3, 'Row 3', 3.0); -- ok +INSERT INTO rw_view1 VALUES ('Row 4', 4.0, 4); -- not allowed +INSERT INTO rw_view2 VALUES ('Row 4', 4.0, 4); -- ok +DELETE FROM base_tbl WHERE a=1; -- ok +DELETE FROM rw_view1 WHERE aa=2; -- not allowed +DELETE FROM rw_view2 WHERE aa=2; -- ok +SELECT * FROM base_tbl; +RESET SESSION AUTHORIZATION; + +SET SESSION AUTHORIZATION regress_view_user1; +REVOKE INSERT, DELETE ON base_tbl FROM regress_view_user2; +GRANT INSERT, DELETE ON rw_view1 TO regress_view_user2; +RESET SESSION AUTHORIZATION; + +SET SESSION AUTHORIZATION regress_view_user2; +INSERT INTO base_tbl VALUES (5, 'Row 5', 5.0); -- not allowed +INSERT INTO rw_view1 VALUES ('Row 5', 5.0, 5); -- ok +INSERT INTO rw_view2 VALUES ('Row 6', 6.0, 6); -- not allowed +DELETE FROM base_tbl WHERE a=3; -- not allowed +DELETE FROM rw_view1 WHERE aa=3; -- ok +DELETE FROM rw_view2 WHERE aa=4; -- not allowed +SELECT * FROM base_tbl; +RESET SESSION AUTHORIZATION; + +DROP TABLE base_tbl CASCADE; + +-- nested-view permissions + +CREATE TABLE base_tbl(a int, b text, c float); +INSERT INTO base_tbl VALUES (1, 'Row 1', 1.0); + +SET SESSION AUTHORIZATION regress_view_user1; +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl; +SELECT * FROM rw_view1; -- not allowed +SELECT * FROM rw_view1 FOR UPDATE; -- not allowed +UPDATE rw_view1 SET b = 'foo' WHERE a = 1; -- not allowed + +SET SESSION AUTHORIZATION regress_view_user2; +CREATE VIEW rw_view2 AS SELECT * FROM rw_view1; +SELECT * FROM rw_view2; -- not allowed +SELECT * FROM rw_view2 FOR UPDATE; -- not allowed +UPDATE rw_view2 SET b = 'bar' WHERE a = 1; -- not allowed + +RESET SESSION AUTHORIZATION; +GRANT SELECT ON base_tbl TO regress_view_user1; + +SET SESSION AUTHORIZATION regress_view_user1; +SELECT * FROM rw_view1; +SELECT * FROM rw_view1 FOR UPDATE; -- not allowed +UPDATE rw_view1 SET b = 'foo' WHERE a = 1; -- not allowed + +SET SESSION AUTHORIZATION regress_view_user2; +SELECT * FROM rw_view2; -- not allowed +SELECT * FROM rw_view2 FOR UPDATE; -- not allowed +UPDATE rw_view2 SET b = 'bar' WHERE a = 1; -- not allowed + +SET SESSION AUTHORIZATION regress_view_user1; +GRANT SELECT ON rw_view1 TO regress_view_user2; + +SET SESSION AUTHORIZATION regress_view_user2; +SELECT * FROM rw_view2; +SELECT * FROM rw_view2 FOR UPDATE; -- not allowed +UPDATE rw_view2 SET b = 'bar' WHERE a = 1; -- not allowed + +RESET SESSION AUTHORIZATION; +GRANT UPDATE ON base_tbl TO regress_view_user1; + +SET SESSION AUTHORIZATION regress_view_user1; +SELECT * FROM rw_view1; +SELECT * FROM rw_view1 FOR UPDATE; +UPDATE rw_view1 SET b = 'foo' WHERE a = 1; + +SET SESSION AUTHORIZATION regress_view_user2; +SELECT * FROM rw_view2; +SELECT * FROM rw_view2 FOR UPDATE; -- not allowed +UPDATE rw_view2 SET b = 'bar' WHERE a = 1; -- not allowed + +SET SESSION AUTHORIZATION regress_view_user1; +GRANT UPDATE ON rw_view1 TO regress_view_user2; + +SET SESSION AUTHORIZATION regress_view_user2; +SELECT * FROM rw_view2; +SELECT * FROM rw_view2 FOR UPDATE; +UPDATE rw_view2 SET b = 'bar' WHERE a = 1; + +RESET SESSION AUTHORIZATION; +REVOKE UPDATE ON base_tbl FROM regress_view_user1; + +SET SESSION AUTHORIZATION regress_view_user1; +SELECT * FROM rw_view1; +SELECT * FROM rw_view1 FOR UPDATE; -- not allowed +UPDATE rw_view1 SET b = 'foo' WHERE a = 1; -- not allowed + +SET SESSION AUTHORIZATION regress_view_user2; +SELECT * FROM rw_view2; +SELECT * FROM rw_view2 FOR UPDATE; -- not allowed +UPDATE rw_view2 SET b = 'bar' WHERE a = 1; -- not allowed + +RESET SESSION AUTHORIZATION; + +DROP TABLE base_tbl CASCADE; + +DROP USER regress_view_user1; +DROP USER regress_view_user2; + +-- column defaults + +CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified', c serial); +INSERT INTO base_tbl VALUES (1, 'Row 1'); +INSERT INTO base_tbl VALUES (2, 'Row 2'); +INSERT INTO base_tbl VALUES (3); + +CREATE VIEW rw_view1 AS SELECT a AS aa, b AS bb FROM base_tbl; +ALTER VIEW rw_view1 ALTER COLUMN bb SET DEFAULT 'View default'; + +INSERT INTO rw_view1 VALUES (4, 'Row 4'); +INSERT INTO rw_view1 (aa) VALUES (5); + +SELECT * FROM base_tbl; + +DROP TABLE base_tbl CASCADE; + +-- Table having triggers + +CREATE TABLE base_tbl (a int PRIMARY KEY, b text DEFAULT 'Unspecified'); +INSERT INTO base_tbl VALUES (1, 'Row 1'); +INSERT INTO base_tbl VALUES (2, 'Row 2'); + +CREATE FUNCTION rw_view1_trig_fn() +RETURNS trigger AS +$$ +BEGIN + IF TG_OP = 'INSERT' THEN + UPDATE base_tbl SET b=NEW.b WHERE a=1; + RETURN NULL; + END IF; + RETURN NULL; +END; +$$ +LANGUAGE plpgsql; + +CREATE TRIGGER rw_view1_ins_trig AFTER INSERT ON base_tbl + FOR EACH ROW EXECUTE PROCEDURE rw_view1_trig_fn(); + +CREATE VIEW rw_view1 AS SELECT a AS aa, b AS bb FROM base_tbl; + +INSERT INTO rw_view1 VALUES (3, 'Row 3'); +select * from base_tbl; + +DROP VIEW rw_view1; +DROP TRIGGER rw_view1_ins_trig on base_tbl; +DROP FUNCTION rw_view1_trig_fn(); +DROP TABLE base_tbl; + +-- view with ORDER BY + +CREATE TABLE base_tbl (a int, b int); +INSERT INTO base_tbl VALUES (1,2), (4,5), (3,-3); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl ORDER BY a+b; + +SELECT * FROM rw_view1; + +INSERT INTO rw_view1 VALUES (7,-8); +SELECT * FROM rw_view1; + +EXPLAIN (verbose, costs off) UPDATE rw_view1 SET b = b + 1 RETURNING *; +UPDATE rw_view1 SET b = b + 1 RETURNING *; +SELECT * FROM rw_view1; + +DROP TABLE base_tbl CASCADE; + +-- multiple array-column updates + +CREATE TABLE base_tbl (a int, arr int[]); +INSERT INTO base_tbl VALUES (1,ARRAY[2]), (3,ARRAY[4]); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl; + +UPDATE rw_view1 SET arr[1] = 42, arr[2] = 77 WHERE a = 3; + +SELECT * FROM rw_view1; + +DROP TABLE base_tbl CASCADE; + +-- views with updatable and non-updatable columns + +CREATE TABLE base_tbl(a float); +INSERT INTO base_tbl SELECT i/10.0 FROM generate_series(1,10) g(i); + +CREATE VIEW rw_view1 AS + SELECT ctid, sin(a) s, a, cos(a) c + FROM base_tbl + WHERE a != 0 + ORDER BY abs(a); + +INSERT INTO rw_view1 VALUES (null, null, 1.1, null); -- should fail +INSERT INTO rw_view1 (s, c, a) VALUES (null, null, 1.1); -- should fail +INSERT INTO rw_view1 (a) VALUES (1.1) RETURNING a, s, c; -- OK +UPDATE rw_view1 SET s = s WHERE a = 1.1; -- should fail +UPDATE rw_view1 SET a = 1.05 WHERE a = 1.1 RETURNING s; -- OK +DELETE FROM rw_view1 WHERE a = 1.05; -- OK + +CREATE VIEW rw_view2 AS + SELECT s, c, s/c t, a base_a, ctid + FROM rw_view1; + +INSERT INTO rw_view2 VALUES (null, null, null, 1.1, null); -- should fail +INSERT INTO rw_view2(s, c, base_a) VALUES (null, null, 1.1); -- should fail +INSERT INTO rw_view2(base_a) VALUES (1.1) RETURNING t; -- OK +UPDATE rw_view2 SET s = s WHERE base_a = 1.1; -- should fail +UPDATE rw_view2 SET t = t WHERE base_a = 1.1; -- should fail +UPDATE rw_view2 SET base_a = 1.05 WHERE base_a = 1.1; -- OK +DELETE FROM rw_view2 WHERE base_a = 1.05 RETURNING base_a, s, c, t; -- OK + +CREATE VIEW rw_view3 AS + SELECT s, c, s/c t, ctid + FROM rw_view1; + +INSERT INTO rw_view3 VALUES (null, null, null, null); -- should fail +INSERT INTO rw_view3(s) VALUES (null); -- should fail +UPDATE rw_view3 SET s = s; -- should fail +DELETE FROM rw_view3 WHERE s = sin(0.1); -- should be OK +SELECT * FROM base_tbl ORDER BY a; + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name LIKE E'r_\\_view%' + ORDER BY table_name; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name LIKE E'r_\\_view%' + ORDER BY table_name; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name LIKE E'r_\\_view%' + ORDER BY table_name, ordinal_position; + +SELECT events & 4 != 0 AS upd, + events & 8 != 0 AS ins, + events & 16 != 0 AS del + FROM pg_catalog.pg_relation_is_updatable('rw_view3'::regclass, false) t(events); + +DROP TABLE base_tbl CASCADE; + +-- inheritance tests + +CREATE TABLE base_tbl_parent (a int); +CREATE TABLE base_tbl_child (CHECK (a > 0)) INHERITS (base_tbl_parent); +INSERT INTO base_tbl_parent SELECT * FROM generate_series(-8, -1); +INSERT INTO base_tbl_child SELECT * FROM generate_series(1, 8); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl_parent; +CREATE VIEW rw_view2 AS SELECT * FROM ONLY base_tbl_parent; + +SELECT * FROM rw_view1 ORDER BY a; +SELECT * FROM ONLY rw_view1 ORDER BY a; +SELECT * FROM rw_view2 ORDER BY a; + +INSERT INTO rw_view1 VALUES (-100), (100); +INSERT INTO rw_view2 VALUES (-200), (200); + +UPDATE rw_view1 SET a = a*10 WHERE a IN (-1, 1); -- Should produce -10 and 10 +UPDATE ONLY rw_view1 SET a = a*10 WHERE a IN (-2, 2); -- Should produce -20 and 20 +UPDATE rw_view2 SET a = a*10 WHERE a IN (-3, 3); -- Should produce -30 only +UPDATE ONLY rw_view2 SET a = a*10 WHERE a IN (-4, 4); -- Should produce -40 only + +DELETE FROM rw_view1 WHERE a IN (-5, 5); -- Should delete -5 and 5 +DELETE FROM ONLY rw_view1 WHERE a IN (-6, 6); -- Should delete -6 and 6 +DELETE FROM rw_view2 WHERE a IN (-7, 7); -- Should delete -7 only +DELETE FROM ONLY rw_view2 WHERE a IN (-8, 8); -- Should delete -8 only + +SELECT * FROM ONLY base_tbl_parent ORDER BY a; +SELECT * FROM base_tbl_child ORDER BY a; + +CREATE TABLE other_tbl_parent (id int); +CREATE TABLE other_tbl_child () INHERITS (other_tbl_parent); +INSERT INTO other_tbl_parent VALUES (7),(200); +INSERT INTO other_tbl_child VALUES (8),(100); + +EXPLAIN (costs off) +UPDATE rw_view1 SET a = a + 1000 FROM other_tbl_parent WHERE a = id; +UPDATE rw_view1 SET a = a + 1000 FROM other_tbl_parent WHERE a = id; + +SELECT * FROM ONLY base_tbl_parent ORDER BY a; +SELECT * FROM base_tbl_child ORDER BY a; + +DROP TABLE base_tbl_parent, base_tbl_child CASCADE; +DROP TABLE other_tbl_parent CASCADE; + +-- simple WITH CHECK OPTION + +CREATE TABLE base_tbl (a int, b int DEFAULT 10); +INSERT INTO base_tbl VALUES (1,2), (2,3), (1,-1); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a < b + WITH LOCAL CHECK OPTION; +\d+ rw_view1 +SELECT * FROM information_schema.views WHERE table_name = 'rw_view1'; + +INSERT INTO rw_view1 VALUES(3,4); -- ok +INSERT INTO rw_view1 VALUES(4,3); -- should fail +INSERT INTO rw_view1 VALUES(5,null); -- should fail +UPDATE rw_view1 SET b = 5 WHERE a = 3; -- ok +UPDATE rw_view1 SET b = -5 WHERE a = 3; -- should fail +INSERT INTO rw_view1(a) VALUES (9); -- ok +INSERT INTO rw_view1(a) VALUES (10); -- should fail +SELECT * FROM base_tbl; + +DROP TABLE base_tbl CASCADE; + +-- WITH LOCAL/CASCADED CHECK OPTION + +CREATE TABLE base_tbl (a int); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a > 0; +CREATE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a < 10 + WITH CHECK OPTION; -- implicitly cascaded +\d+ rw_view2 +SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; + +INSERT INTO rw_view2 VALUES (-5); -- should fail +INSERT INTO rw_view2 VALUES (5); -- ok +INSERT INTO rw_view2 VALUES (15); -- should fail +SELECT * FROM base_tbl; + +UPDATE rw_view2 SET a = a - 10; -- should fail +UPDATE rw_view2 SET a = a + 10; -- should fail + +CREATE OR REPLACE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a < 10 + WITH LOCAL CHECK OPTION; +\d+ rw_view2 +SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; + +INSERT INTO rw_view2 VALUES (-10); -- ok, but not in view +INSERT INTO rw_view2 VALUES (20); -- should fail +SELECT * FROM base_tbl; + +ALTER VIEW rw_view1 SET (check_option=here); -- invalid +ALTER VIEW rw_view1 SET (check_option=local); + +INSERT INTO rw_view2 VALUES (-20); -- should fail +INSERT INTO rw_view2 VALUES (30); -- should fail + +ALTER VIEW rw_view2 RESET (check_option); +\d+ rw_view2 +SELECT * FROM information_schema.views WHERE table_name = 'rw_view2'; +INSERT INTO rw_view2 VALUES (30); -- ok, but not in view +SELECT * FROM base_tbl; + +DROP TABLE base_tbl CASCADE; + +-- WITH CHECK OPTION with no local view qual + +CREATE TABLE base_tbl (a int); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WITH CHECK OPTION; +CREATE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a > 0; +CREATE VIEW rw_view3 AS SELECT * FROM rw_view2 WITH CHECK OPTION; +SELECT * FROM information_schema.views WHERE table_name LIKE E'rw\\_view_' ORDER BY table_name; + +INSERT INTO rw_view1 VALUES (-1); -- ok +INSERT INTO rw_view1 VALUES (1); -- ok +INSERT INTO rw_view2 VALUES (-2); -- ok, but not in view +INSERT INTO rw_view2 VALUES (2); -- ok +INSERT INTO rw_view3 VALUES (-3); -- should fail +INSERT INTO rw_view3 VALUES (3); -- ok + +DROP TABLE base_tbl CASCADE; + +-- WITH CHECK OPTION with scalar array ops + +CREATE TABLE base_tbl (a int, b int[]); +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a = ANY (b) + WITH CHECK OPTION; + +INSERT INTO rw_view1 VALUES (1, ARRAY[1,2,3]); -- ok +INSERT INTO rw_view1 VALUES (10, ARRAY[4,5]); -- should fail + +UPDATE rw_view1 SET b[2] = -b[2] WHERE a = 1; -- ok +UPDATE rw_view1 SET b[1] = -b[1] WHERE a = 1; -- should fail + +PREPARE ins(int, int[]) AS INSERT INTO rw_view1 VALUES($1, $2); +EXECUTE ins(2, ARRAY[1,2,3]); -- ok +EXECUTE ins(10, ARRAY[4,5]); -- should fail +DEALLOCATE PREPARE ins; + +DROP TABLE base_tbl CASCADE; + +-- WITH CHECK OPTION with subquery + +CREATE TABLE base_tbl (a int); +CREATE TABLE ref_tbl (a int PRIMARY KEY); +INSERT INTO ref_tbl SELECT * FROM generate_series(1,10); + +CREATE VIEW rw_view1 AS + SELECT * FROM base_tbl b + WHERE EXISTS(SELECT 1 FROM ref_tbl r WHERE r.a = b.a) + WITH CHECK OPTION; + +INSERT INTO rw_view1 VALUES (5); -- ok +INSERT INTO rw_view1 VALUES (15); -- should fail + +UPDATE rw_view1 SET a = a + 5; -- ok +UPDATE rw_view1 SET a = a + 5; -- should fail + +EXPLAIN (costs off) INSERT INTO rw_view1 VALUES (5); +EXPLAIN (costs off) UPDATE rw_view1 SET a = a + 5; + +DROP TABLE base_tbl, ref_tbl CASCADE; + +-- WITH CHECK OPTION with BEFORE trigger on base table + +CREATE TABLE base_tbl (a int, b int); + +CREATE FUNCTION base_tbl_trig_fn() +RETURNS trigger AS +$$ +BEGIN + NEW.b := 10; + RETURN NEW; +END; +$$ +LANGUAGE plpgsql; + +CREATE TRIGGER base_tbl_trig BEFORE INSERT OR UPDATE ON base_tbl + FOR EACH ROW EXECUTE PROCEDURE base_tbl_trig_fn(); + +CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a < b WITH CHECK OPTION; + +INSERT INTO rw_view1 VALUES (5,0); -- ok +INSERT INTO rw_view1 VALUES (15, 20); -- should fail +UPDATE rw_view1 SET a = 20, b = 30; -- should fail + +DROP TABLE base_tbl CASCADE; +DROP FUNCTION base_tbl_trig_fn(); + +-- WITH LOCAL CHECK OPTION with INSTEAD OF trigger on base view + +CREATE TABLE base_tbl (a int, b int); + +CREATE VIEW rw_view1 AS SELECT a FROM base_tbl WHERE a < b; + +CREATE FUNCTION rw_view1_trig_fn() +RETURNS trigger AS +$$ +BEGIN + IF TG_OP = 'INSERT' THEN + INSERT INTO base_tbl VALUES (NEW.a, 10); + RETURN NEW; + ELSIF TG_OP = 'UPDATE' THEN + UPDATE base_tbl SET a=NEW.a WHERE a=OLD.a; + RETURN NEW; + ELSIF TG_OP = 'DELETE' THEN + DELETE FROM base_tbl WHERE a=OLD.a; + RETURN OLD; + END IF; +END; +$$ +LANGUAGE plpgsql; + +CREATE TRIGGER rw_view1_trig + INSTEAD OF INSERT OR UPDATE OR DELETE ON rw_view1 + FOR EACH ROW EXECUTE PROCEDURE rw_view1_trig_fn(); + +CREATE VIEW rw_view2 AS + SELECT * FROM rw_view1 WHERE a > 0 WITH LOCAL CHECK OPTION; + +INSERT INTO rw_view2 VALUES (-5); -- should fail +INSERT INTO rw_view2 VALUES (5); -- ok +INSERT INTO rw_view2 VALUES (50); -- ok, but not in view +UPDATE rw_view2 SET a = a - 10; -- should fail +SELECT * FROM base_tbl; + +-- Check option won't cascade down to base view with INSTEAD OF triggers + +ALTER VIEW rw_view2 SET (check_option=cascaded); +INSERT INTO rw_view2 VALUES (100); -- ok, but not in view (doesn't fail rw_view1's check) +UPDATE rw_view2 SET a = 200 WHERE a = 5; -- ok, but not in view (doesn't fail rw_view1's check) +SELECT * FROM base_tbl; + +-- Neither local nor cascaded check options work with INSTEAD rules + +DROP TRIGGER rw_view1_trig ON rw_view1; +CREATE RULE rw_view1_ins_rule AS ON INSERT TO rw_view1 + DO INSTEAD INSERT INTO base_tbl VALUES (NEW.a, 10); +CREATE RULE rw_view1_upd_rule AS ON UPDATE TO rw_view1 + DO INSTEAD UPDATE base_tbl SET a=NEW.a WHERE a=OLD.a; +INSERT INTO rw_view2 VALUES (-10); -- ok, but not in view (doesn't fail rw_view2's check) +INSERT INTO rw_view2 VALUES (5); -- ok +INSERT INTO rw_view2 VALUES (20); -- ok, but not in view (doesn't fail rw_view1's check) +UPDATE rw_view2 SET a = 30 WHERE a = 5; -- ok, but not in view (doesn't fail rw_view1's check) +INSERT INTO rw_view2 VALUES (5); -- ok +UPDATE rw_view2 SET a = -5 WHERE a = 5; -- ok, but not in view (doesn't fail rw_view2's check) +SELECT * FROM base_tbl; + +DROP TABLE base_tbl CASCADE; +DROP FUNCTION rw_view1_trig_fn(); + +CREATE TABLE base_tbl (a int); +CREATE VIEW rw_view1 AS SELECT a,10 AS b FROM base_tbl; +CREATE RULE rw_view1_ins_rule AS ON INSERT TO rw_view1 + DO INSTEAD INSERT INTO base_tbl VALUES (NEW.a); +CREATE VIEW rw_view2 AS + SELECT * FROM rw_view1 WHERE a > b WITH LOCAL CHECK OPTION; +INSERT INTO rw_view2 VALUES (2,3); -- ok, but not in view (doesn't fail rw_view2's check) +DROP TABLE base_tbl CASCADE; + +-- security barrier view + +CREATE TABLE base_tbl (person text, visibility text); +INSERT INTO base_tbl VALUES ('Tom', 'public'), + ('Dick', 'private'), + ('Harry', 'public'); + +CREATE VIEW rw_view1 AS + SELECT person FROM base_tbl WHERE visibility = 'public'; + +CREATE FUNCTION snoop(anyelement) +RETURNS boolean AS +$$ +BEGIN + RAISE NOTICE 'snooped value: %', $1; + RETURN true; +END; +$$ +LANGUAGE plpgsql COST 0.000001; + +CREATE OR REPLACE FUNCTION leakproof(anyelement) +RETURNS boolean AS +$$ +BEGIN + RETURN true; +END; +$$ +LANGUAGE plpgsql STRICT IMMUTABLE LEAKPROOF; + +SELECT * FROM rw_view1 WHERE snoop(person); +UPDATE rw_view1 SET person=person WHERE snoop(person); +DELETE FROM rw_view1 WHERE NOT snoop(person); + +ALTER VIEW rw_view1 SET (security_barrier = true); + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name = 'rw_view1'; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name = 'rw_view1'; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name = 'rw_view1' + ORDER BY ordinal_position; + +SELECT * FROM rw_view1 WHERE snoop(person); +UPDATE rw_view1 SET person=person WHERE snoop(person); +DELETE FROM rw_view1 WHERE NOT snoop(person); + +EXPLAIN (costs off) SELECT * FROM rw_view1 WHERE snoop(person); +EXPLAIN (costs off) UPDATE rw_view1 SET person=person WHERE snoop(person); +EXPLAIN (costs off) DELETE FROM rw_view1 WHERE NOT snoop(person); + +-- security barrier view on top of security barrier view + +CREATE VIEW rw_view2 WITH (security_barrier = true) AS + SELECT * FROM rw_view1 WHERE snoop(person); + +SELECT table_name, is_insertable_into + FROM information_schema.tables + WHERE table_name = 'rw_view2'; + +SELECT table_name, is_updatable, is_insertable_into + FROM information_schema.views + WHERE table_name = 'rw_view2'; + +SELECT table_name, column_name, is_updatable + FROM information_schema.columns + WHERE table_name = 'rw_view2' + ORDER BY ordinal_position; + +SELECT * FROM rw_view2 WHERE snoop(person); +UPDATE rw_view2 SET person=person WHERE snoop(person); +DELETE FROM rw_view2 WHERE NOT snoop(person); + +EXPLAIN (costs off) SELECT * FROM rw_view2 WHERE snoop(person); +EXPLAIN (costs off) UPDATE rw_view2 SET person=person WHERE snoop(person); +EXPLAIN (costs off) DELETE FROM rw_view2 WHERE NOT snoop(person); + +DROP TABLE base_tbl CASCADE; + +-- security barrier view on top of table with rules + +CREATE TABLE base_tbl(id int PRIMARY KEY, data text, deleted boolean); +INSERT INTO base_tbl VALUES (1, 'Row 1', false), (2, 'Row 2', true); + +CREATE RULE base_tbl_ins_rule AS ON INSERT TO base_tbl + WHERE EXISTS (SELECT 1 FROM base_tbl t WHERE t.id = new.id) + DO INSTEAD + UPDATE base_tbl SET data = new.data, deleted = false WHERE id = new.id; + +CREATE RULE base_tbl_del_rule AS ON DELETE TO base_tbl + DO INSTEAD + UPDATE base_tbl SET deleted = true WHERE id = old.id; + +CREATE VIEW rw_view1 WITH (security_barrier=true) AS + SELECT id, data FROM base_tbl WHERE NOT deleted; + +SELECT * FROM rw_view1; + +EXPLAIN (costs off) DELETE FROM rw_view1 WHERE id = 1 AND snoop(data); +DELETE FROM rw_view1 WHERE id = 1 AND snoop(data); + +EXPLAIN (costs off) INSERT INTO rw_view1 VALUES (2, 'New row 2'); +INSERT INTO rw_view1 VALUES (2, 'New row 2'); + +SELECT * FROM base_tbl; + +DROP TABLE base_tbl CASCADE; + +-- security barrier view based on inheritance set +CREATE TABLE t1 (a int, b float, c text); +CREATE INDEX t1_a_idx ON t1(a); +INSERT INTO t1 +SELECT i,i,'t1' FROM generate_series(1,10) g(i); +ANALYZE t1; + +CREATE TABLE t11 (d text) INHERITS (t1); +CREATE INDEX t11_a_idx ON t11(a); +INSERT INTO t11 +SELECT i,i,'t11','t11d' FROM generate_series(1,10) g(i); +ANALYZE t11; + +CREATE TABLE t12 (e int[]) INHERITS (t1); +CREATE INDEX t12_a_idx ON t12(a); +INSERT INTO t12 +SELECT i,i,'t12','{1,2}'::int[] FROM generate_series(1,10) g(i); +ANALYZE t12; + +CREATE TABLE t111 () INHERITS (t11, t12); +CREATE INDEX t111_a_idx ON t111(a); +INSERT INTO t111 +SELECT i,i,'t111','t111d','{1,1,1}'::int[] FROM generate_series(1,10) g(i); +ANALYZE t111; + +CREATE VIEW v1 WITH (security_barrier=true) AS +SELECT *, (SELECT d FROM t11 WHERE t11.a = t1.a LIMIT 1) AS d +FROM t1 +WHERE a > 5 AND EXISTS(SELECT 1 FROM t12 WHERE t12.a = t1.a); + +SELECT * FROM v1 WHERE a=3; -- should not see anything +SELECT * FROM v1 WHERE a=8; + +EXPLAIN (VERBOSE, COSTS OFF) +UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6; +UPDATE v1 SET a=100 WHERE snoop(a) AND leakproof(a) AND a < 7 AND a != 6; + +SELECT * FROM v1 WHERE a=100; -- Nothing should have been changed to 100 +SELECT * FROM t1 WHERE a=100; -- Nothing should have been changed to 100 + +EXPLAIN (VERBOSE, COSTS OFF) +UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8; +UPDATE v1 SET a=a+1 WHERE snoop(a) AND leakproof(a) AND a = 8; + +SELECT * FROM v1 WHERE b=8; + +DELETE FROM v1 WHERE snoop(a) AND leakproof(a); -- should not delete everything, just where a>5 + +TABLE t1; -- verify all a<=5 are intact + +DROP TABLE t1, t11, t12, t111 CASCADE; +DROP FUNCTION snoop(anyelement); +DROP FUNCTION leakproof(anyelement); + +CREATE TABLE tx1 (a integer); +CREATE TABLE tx2 (b integer); +CREATE TABLE tx3 (c integer); +CREATE VIEW vx1 AS SELECT a FROM tx1 WHERE EXISTS(SELECT 1 FROM tx2 JOIN tx3 ON b=c); +INSERT INTO vx1 values (1); +SELECT * FROM tx1; +SELECT * FROM vx1; + +DROP VIEW vx1; +DROP TABLE tx1; +DROP TABLE tx2; +DROP TABLE tx3; + +CREATE TABLE tx1 (a integer); +CREATE TABLE tx2 (b integer); +CREATE TABLE tx3 (c integer); +CREATE VIEW vx1 AS SELECT a FROM tx1 WHERE EXISTS(SELECT 1 FROM tx2 JOIN tx3 ON b=c); +INSERT INTO vx1 VALUES (1); +INSERT INTO vx1 VALUES (1); +SELECT * FROM tx1; +SELECT * FROM vx1; + +DROP VIEW vx1; +DROP TABLE tx1; +DROP TABLE tx2; +DROP TABLE tx3; + +CREATE TABLE tx1 (a integer, b integer); +CREATE TABLE tx2 (b integer, c integer); +CREATE TABLE tx3 (c integer, d integer); +ALTER TABLE tx1 DROP COLUMN b; +ALTER TABLE tx2 DROP COLUMN c; +ALTER TABLE tx3 DROP COLUMN d; +CREATE VIEW vx1 AS SELECT a FROM tx1 WHERE EXISTS(SELECT 1 FROM tx2 JOIN tx3 ON b=c); +INSERT INTO vx1 VALUES (1); +INSERT INTO vx1 VALUES (1); +SELECT * FROM tx1; +SELECT * FROM vx1; + +DROP VIEW vx1; +DROP TABLE tx1; +DROP TABLE tx2; +DROP TABLE tx3; + +-- +-- Test handling of vars from correlated subqueries in quals from outer +-- security barrier views, per bug #13988 +-- +CREATE TABLE t1 (a int, b text, c int); +INSERT INTO t1 VALUES (1, 'one', 10); + +CREATE TABLE t2 (cc int); +INSERT INTO t2 VALUES (10), (20); + +CREATE VIEW v1 WITH (security_barrier = true) AS + SELECT * FROM t1 WHERE (a > 0) + WITH CHECK OPTION; + +CREATE VIEW v2 WITH (security_barrier = true) AS + SELECT * FROM v1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.cc = v1.c) + WITH CHECK OPTION; + +INSERT INTO v2 VALUES (2, 'two', 20); -- ok +INSERT INTO v2 VALUES (-2, 'minus two', 20); -- not allowed +INSERT INTO v2 VALUES (3, 'three', 30); -- not allowed + +UPDATE v2 SET b = 'ONE' WHERE a = 1; -- ok +UPDATE v2 SET a = -1 WHERE a = 1; -- not allowed +UPDATE v2 SET c = 30 WHERE a = 1; -- not allowed + +DELETE FROM v2 WHERE a = 2; -- ok +SELECT * FROM v2; + +DROP VIEW v2; +DROP VIEW v1; +DROP TABLE t2; +DROP TABLE t1; + +-- +-- Test CREATE OR REPLACE VIEW turning a non-updatable view into an +-- auto-updatable view and adding check options in a single step +-- +CREATE TABLE t1 (a int, b text); +CREATE VIEW v1 AS SELECT null::int AS a; +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1 WHERE a > 0 WITH CHECK OPTION; + +INSERT INTO v1 VALUES (1, 'ok'); -- ok +INSERT INTO v1 VALUES (-1, 'invalid'); -- should fail + +DROP VIEW v1; +DROP TABLE t1; + +-- check that an auto-updatable view on a partitioned table works correctly +create table uv_pt (a int, b int, v varchar) partition by range (a, b); +create table uv_pt1 (b int not null, v varchar, a int not null) partition by range (b); +create table uv_pt11 (like uv_pt1); +alter table uv_pt11 drop a; +alter table uv_pt11 add a int; +alter table uv_pt11 drop a; +alter table uv_pt11 add a int not null; +alter table uv_pt1 attach partition uv_pt11 for values from (2) to (5); +alter table uv_pt attach partition uv_pt1 for values from (1, 2) to (1, 10); + +create view uv_ptv as select * from uv_pt; +select events & 4 != 0 AS upd, + events & 8 != 0 AS ins, + events & 16 != 0 AS del + from pg_catalog.pg_relation_is_updatable('uv_pt'::regclass, false) t(events); +select pg_catalog.pg_column_is_updatable('uv_pt'::regclass, 1::smallint, false); +select pg_catalog.pg_column_is_updatable('uv_pt'::regclass, 2::smallint, false); +select table_name, is_updatable, is_insertable_into + from information_schema.views where table_name = 'uv_ptv'; +select table_name, column_name, is_updatable + from information_schema.columns where table_name = 'uv_ptv' order by column_name; +insert into uv_ptv values (1, 2); +select tableoid::regclass, * from uv_pt; +create view uv_ptv_wco as select * from uv_pt where a = 0 with check option; +insert into uv_ptv_wco values (1, 2); +drop view uv_ptv, uv_ptv_wco; +drop table uv_pt, uv_pt1, uv_pt11; + +-- check that wholerow vars appearing in WITH CHECK OPTION constraint expressions +-- work fine with partitioned tables +create table wcowrtest (a int) partition by list (a); +create table wcowrtest1 partition of wcowrtest for values in (1); +create view wcowrtest_v as select * from wcowrtest where wcowrtest = '(2)'::wcowrtest with check option; +insert into wcowrtest_v values (1); + +alter table wcowrtest add b text; +create table wcowrtest2 (b text, c int, a int); +alter table wcowrtest2 drop c; +alter table wcowrtest attach partition wcowrtest2 for values in (2); + +create table sometable (a int, b text); +insert into sometable values (1, 'a'), (2, 'b'); +create view wcowrtest_v2 as + select * + from wcowrtest r + where r in (select s from sometable s where r.a = s.a) +with check option; + +-- WITH CHECK qual will be processed with wcowrtest2's +-- rowtype after tuple-routing +insert into wcowrtest_v2 values (2, 'no such row in sometable'); + +drop view wcowrtest_v, wcowrtest_v2; +drop table wcowrtest, sometable; + +-- Check INSERT .. ON CONFLICT DO UPDATE works correctly when the view's +-- columns are named and ordered differently than the underlying table's. +create table uv_iocu_tab (a text unique, b float); +insert into uv_iocu_tab values ('xyxyxy', 0); +create view uv_iocu_view as + select b, b+1 as c, a, '2.0'::text as two from uv_iocu_tab; + +insert into uv_iocu_view (a, b) values ('xyxyxy', 1) + on conflict (a) do update set b = uv_iocu_view.b; +select * from uv_iocu_tab; +insert into uv_iocu_view (a, b) values ('xyxyxy', 1) + on conflict (a) do update set b = excluded.b; +select * from uv_iocu_tab; + +-- OK to access view columns that are not present in underlying base +-- relation in the ON CONFLICT portion of the query +insert into uv_iocu_view (a, b) values ('xyxyxy', 3) + on conflict (a) do update set b = cast(excluded.two as float); +select * from uv_iocu_tab; + +explain (costs off) +insert into uv_iocu_view (a, b) values ('xyxyxy', 3) + on conflict (a) do update set b = excluded.b where excluded.c > 0; + +insert into uv_iocu_view (a, b) values ('xyxyxy', 3) + on conflict (a) do update set b = excluded.b where excluded.c > 0; +select * from uv_iocu_tab; + +drop view uv_iocu_view; +drop table uv_iocu_tab; + +-- Test whole-row references to the view +create table uv_iocu_tab (a int unique, b text); +create view uv_iocu_view as + select b as bb, a as aa, uv_iocu_tab::text as cc from uv_iocu_tab; + +insert into uv_iocu_view (aa,bb) values (1,'x'); +explain (costs off) +insert into uv_iocu_view (aa,bb) values (1,'y') + on conflict (aa) do update set bb = 'Rejected: '||excluded.* + where excluded.aa > 0 + and excluded.bb != '' + and excluded.cc is not null; +insert into uv_iocu_view (aa,bb) values (1,'y') + on conflict (aa) do update set bb = 'Rejected: '||excluded.* + where excluded.aa > 0 + and excluded.bb != '' + and excluded.cc is not null; +select * from uv_iocu_view; + +-- Test omitting a column of the base relation +delete from uv_iocu_view; +insert into uv_iocu_view (aa,bb) values (1,'x'); +insert into uv_iocu_view (aa) values (1) + on conflict (aa) do update set bb = 'Rejected: '||excluded.*; +select * from uv_iocu_view; + +alter table uv_iocu_tab alter column b set default 'table default'; +insert into uv_iocu_view (aa) values (1) + on conflict (aa) do update set bb = 'Rejected: '||excluded.*; +select * from uv_iocu_view; + +alter view uv_iocu_view alter column bb set default 'view default'; +insert into uv_iocu_view (aa) values (1) + on conflict (aa) do update set bb = 'Rejected: '||excluded.*; +select * from uv_iocu_view; + +-- Should fail to update non-updatable columns +insert into uv_iocu_view (aa) values (1) + on conflict (aa) do update set cc = 'XXX'; + +drop view uv_iocu_view; +drop table uv_iocu_tab; + +-- ON CONFLICT DO UPDATE permissions checks +create user regress_view_user1; +create user regress_view_user2; + +set session authorization regress_view_user1; +create table base_tbl(a int unique, b text, c float); +insert into base_tbl values (1,'xxx',1.0); +create view rw_view1 as select b as bb, c as cc, a as aa from base_tbl; + +grant select (aa,bb) on rw_view1 to regress_view_user2; +grant insert on rw_view1 to regress_view_user2; +grant update (bb) on rw_view1 to regress_view_user2; + +set session authorization regress_view_user2; +insert into rw_view1 values ('yyy',2.0,1) + on conflict (aa) do update set bb = excluded.cc; -- Not allowed +insert into rw_view1 values ('yyy',2.0,1) + on conflict (aa) do update set bb = rw_view1.cc; -- Not allowed +insert into rw_view1 values ('yyy',2.0,1) + on conflict (aa) do update set bb = excluded.bb; -- OK +insert into rw_view1 values ('zzz',2.0,1) + on conflict (aa) do update set bb = rw_view1.bb||'xxx'; -- OK +insert into rw_view1 values ('zzz',2.0,1) + on conflict (aa) do update set cc = 3.0; -- Not allowed +reset session authorization; +select * from base_tbl; + +set session authorization regress_view_user1; +grant select (a,b) on base_tbl to regress_view_user2; +grant insert (a,b) on base_tbl to regress_view_user2; +grant update (a,b) on base_tbl to regress_view_user2; + +set session authorization regress_view_user2; +create view rw_view2 as select b as bb, c as cc, a as aa from base_tbl; +insert into rw_view2 (aa,bb) values (1,'xxx') + on conflict (aa) do update set bb = excluded.bb; -- Not allowed +create view rw_view3 as select b as bb, a as aa from base_tbl; +insert into rw_view3 (aa,bb) values (1,'xxx') + on conflict (aa) do update set bb = excluded.bb; -- OK +reset session authorization; +select * from base_tbl; + +set session authorization regress_view_user2; +create view rw_view4 as select aa, bb, cc FROM rw_view1; +insert into rw_view4 (aa,bb) values (1,'yyy') + on conflict (aa) do update set bb = excluded.bb; -- Not allowed +create view rw_view5 as select aa, bb FROM rw_view1; +insert into rw_view5 (aa,bb) values (1,'yyy') + on conflict (aa) do update set bb = excluded.bb; -- OK +reset session authorization; +select * from base_tbl; + +drop view rw_view5; +drop view rw_view4; +drop view rw_view3; +drop view rw_view2; +drop view rw_view1; +drop table base_tbl; +drop user regress_view_user1; +drop user regress_view_user2; + +-- Test single- and multi-row inserts with table and view defaults. +-- Table defaults should be used, unless overridden by view defaults. +create table base_tab_def (a int, b text default 'Table default', + c text default 'Table default', d text, e text); +create view base_tab_def_view as select * from base_tab_def; +alter view base_tab_def_view alter b set default 'View default'; +alter view base_tab_def_view alter d set default 'View default'; +insert into base_tab_def values (1); +insert into base_tab_def values (2), (3); +insert into base_tab_def values (4, default, default, default, default); +insert into base_tab_def values (5, default, default, default, default), + (6, default, default, default, default); +insert into base_tab_def_view values (11); +insert into base_tab_def_view values (12), (13); +insert into base_tab_def_view values (14, default, default, default, default); +insert into base_tab_def_view values (15, default, default, default, default), + (16, default, default, default, default); +insert into base_tab_def_view values (17), (default); +select * from base_tab_def order by a; + +-- Adding an INSTEAD OF trigger should cause NULLs to be inserted instead of +-- table defaults, where there are no view defaults. +create function base_tab_def_view_instrig_func() returns trigger +as +$$ +begin + insert into base_tab_def values (new.a, new.b, new.c, new.d, new.e); + return new; +end; +$$ +language plpgsql; +create trigger base_tab_def_view_instrig instead of insert on base_tab_def_view + for each row execute function base_tab_def_view_instrig_func(); +truncate base_tab_def; +insert into base_tab_def values (1); +insert into base_tab_def values (2), (3); +insert into base_tab_def values (4, default, default, default, default); +insert into base_tab_def values (5, default, default, default, default), + (6, default, default, default, default); +insert into base_tab_def_view values (11); +insert into base_tab_def_view values (12), (13); +insert into base_tab_def_view values (14, default, default, default, default); +insert into base_tab_def_view values (15, default, default, default, default), + (16, default, default, default, default); +insert into base_tab_def_view values (17), (default); +select * from base_tab_def order by a; + +-- Using an unconditional DO INSTEAD rule should also cause NULLs to be +-- inserted where there are no view defaults. +drop trigger base_tab_def_view_instrig on base_tab_def_view; +drop function base_tab_def_view_instrig_func; +create rule base_tab_def_view_ins_rule as on insert to base_tab_def_view + do instead insert into base_tab_def values (new.a, new.b, new.c, new.d, new.e); +truncate base_tab_def; +insert into base_tab_def values (1); +insert into base_tab_def values (2), (3); +insert into base_tab_def values (4, default, default, default, default); +insert into base_tab_def values (5, default, default, default, default), + (6, default, default, default, default); +insert into base_tab_def_view values (11); +insert into base_tab_def_view values (12), (13); +insert into base_tab_def_view values (14, default, default, default, default); +insert into base_tab_def_view values (15, default, default, default, default), + (16, default, default, default, default); +insert into base_tab_def_view values (17), (default); +select * from base_tab_def order by a; + +-- A DO ALSO rule should cause each row to be inserted twice. The first +-- insert should behave the same as an auto-updatable view (using table +-- defaults, unless overridden by view defaults). The second insert should +-- behave the same as a rule-updatable view (inserting NULLs where there are +-- no view defaults). +drop rule base_tab_def_view_ins_rule on base_tab_def_view; +create rule base_tab_def_view_ins_rule as on insert to base_tab_def_view + do also insert into base_tab_def values (new.a, new.b, new.c, new.d, new.e); +truncate base_tab_def; +insert into base_tab_def values (1); +insert into base_tab_def values (2), (3); +insert into base_tab_def values (4, default, default, default, default); +insert into base_tab_def values (5, default, default, default, default), + (6, default, default, default, default); +insert into base_tab_def_view values (11); +insert into base_tab_def_view values (12), (13); +insert into base_tab_def_view values (14, default, default, default, default); +insert into base_tab_def_view values (15, default, default, default, default), + (16, default, default, default, default); +insert into base_tab_def_view values (17), (default); +select * from base_tab_def order by a, c NULLS LAST; + +drop view base_tab_def_view; +drop table base_tab_def; + +-- Test defaults with array assignments +create table base_tab (a serial, b int[], c text, d text default 'Table default'); +create view base_tab_view as select c, a, b from base_tab; +alter view base_tab_view alter column c set default 'View default'; +insert into base_tab_view (b[1], b[2], c, b[5], b[4], a, b[3]) +values (1, 2, default, 5, 4, default, 3), (10, 11, 'C value', 14, 13, 100, 12); +select * from base_tab order by a; +drop view base_tab_view; +drop table base_tab; +UPDATE rw_view16 SET a=3, aa=-3 WHERE a=3; -- should fail + UPDATE rw_view16 SET aa=-3 WHERE a=3; -- should be OK diff --git a/postgresql/examples/update.sql b/postgresql/examples/update.sql new file mode 100644 index 0000000..5953d4d --- /dev/null +++ b/postgresql/examples/update.sql @@ -0,0 +1,614 @@ +-- +-- UPDATE syntax tests +-- + +CREATE TABLE update_test ( + a INT DEFAULT 10, + b INT, + c TEXT +); + +CREATE TABLE upsert_test ( + a INT PRIMARY KEY, + b TEXT +); + +INSERT INTO update_test VALUES (5, 10, 'foo'); +INSERT INTO update_test(b, a) VALUES (15, 10); + +SELECT * FROM update_test; + +UPDATE update_test SET a = DEFAULT, b = DEFAULT; + +SELECT * FROM update_test; + +-- aliases for the UPDATE target table +UPDATE update_test AS t SET b = 10 WHERE t.a = 10; + +SELECT * FROM update_test; + +UPDATE update_test t SET b = t.b + 10 WHERE t.a = 10; + +SELECT * FROM update_test; + +-- +-- Test VALUES in FROM +-- + +UPDATE update_test SET a=v.i FROM (VALUES(100, 20)) AS v(i, j) + WHERE update_test.b = v.j; + +SELECT * FROM update_test; + +-- fail, wrong data type: +UPDATE update_test SET a = v.* FROM (VALUES(100, 20)) AS v(i, j) + WHERE update_test.b = v.j; + +-- +-- Test multiple-set-clause syntax +-- + +INSERT INTO update_test SELECT a,b+1,c FROM update_test; +SELECT * FROM update_test; + +UPDATE update_test SET (c,b,a) = ('bugle', b+11, DEFAULT) WHERE c = 'foo'; +SELECT * FROM update_test; +UPDATE update_test SET (c,b) = ('car', a+b), a = a + 1 WHERE a = 10; +SELECT * FROM update_test; +-- fail, multi assignment to same column: +UPDATE update_test SET (c,b) = ('car', a+b), b = a + 1 WHERE a = 10; + +-- uncorrelated sub-select: +UPDATE update_test + SET (b,a) = (select a,b from update_test where b = 41 and c = 'car') + WHERE a = 100 AND b = 20; +SELECT * FROM update_test; +-- correlated sub-select: +UPDATE update_test o + SET (b,a) = (select a+1,b from update_test i + where i.a=o.a and i.b=o.b and i.c is not distinct from o.c); +SELECT * FROM update_test; +-- fail, multiple rows supplied: +UPDATE update_test SET (b,a) = (select a+1,b from update_test); +-- set to null if no rows supplied: +UPDATE update_test SET (b,a) = (select a+1,b from update_test where a = 1000) + WHERE a = 11; +SELECT * FROM update_test; +-- *-expansion should work in this context: +UPDATE update_test SET (a,b) = ROW(v.*) FROM (VALUES(21, 100)) AS v(i, j) + WHERE update_test.a = v.i; +-- you might expect this to work, but syntactically it's not a RowExpr: +UPDATE update_test SET (a,b) = (v.*) FROM (VALUES(21, 101)) AS v(i, j) + WHERE update_test.a = v.i; + +-- if an alias for the target table is specified, don't allow references +-- to the original table name +UPDATE update_test AS t SET b = update_test.b + 10 WHERE t.a = 10; + +-- Make sure that we can update to a TOASTed value. +UPDATE update_test SET c = repeat('x', 10000) WHERE c = 'car'; +SELECT a, b, char_length(c) FROM update_test; + +-- Check multi-assignment with a Result node to handle a one-time filter. +EXPLAIN (VERBOSE, COSTS OFF) +UPDATE update_test t + SET (a, b) = (SELECT b, a FROM update_test s WHERE s.a = t.a) + WHERE CURRENT_USER = SESSION_USER; +UPDATE update_test t + SET (a, b) = (SELECT b, a FROM update_test s WHERE s.a = t.a) + WHERE CURRENT_USER = SESSION_USER; +SELECT a, b, char_length(c) FROM update_test; + +-- Test ON CONFLICT DO UPDATE +INSERT INTO upsert_test VALUES(1, 'Boo'); +-- uncorrelated sub-select: +WITH aaa AS (SELECT 1 AS a, 'Foo' AS b) INSERT INTO upsert_test + VALUES (1, 'Bar') ON CONFLICT(a) + DO UPDATE SET (b, a) = (SELECT b, a FROM aaa) RETURNING *; +-- correlated sub-select: +INSERT INTO upsert_test VALUES (1, 'Baz') ON CONFLICT(a) + DO UPDATE SET (b, a) = (SELECT b || ', Correlated', a from upsert_test i WHERE i.a = upsert_test.a) + RETURNING *; +-- correlated sub-select (EXCLUDED.* alias): +INSERT INTO upsert_test VALUES (1, 'Bat') ON CONFLICT(a) + DO UPDATE SET (b, a) = (SELECT b || ', Excluded', a from upsert_test i WHERE i.a = excluded.a) + RETURNING *; + +-- ON CONFLICT using system attributes in RETURNING, testing both the +-- inserting and updating paths. See bug report at: +-- https://www.postgresql.org/message-id/73436355-6432-49B1-92ED-1FE4F7E7E100%40finefun.com.au +INSERT INTO upsert_test VALUES (2, 'Beeble') ON CONFLICT(a) + DO UPDATE SET (b, a) = (SELECT b || ', Excluded', a from upsert_test i WHERE i.a = excluded.a) + RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid AS xmin_correct, xmax = 0 AS xmax_correct; +-- currently xmax is set after a conflict - that's probably not good, +-- but it seems worthwhile to have to be explicit if that changes. +INSERT INTO upsert_test VALUES (2, 'Brox') ON CONFLICT(a) + DO UPDATE SET (b, a) = (SELECT b || ', Excluded', a from upsert_test i WHERE i.a = excluded.a) + RETURNING tableoid::regclass, xmin = pg_current_xact_id()::xid AS xmin_correct, xmax = pg_current_xact_id()::xid AS xmax_correct; + + +DROP TABLE update_test; +DROP TABLE upsert_test; + + +--------------------------- +-- UPDATE with row movement +--------------------------- + +-- When a partitioned table receives an UPDATE to the partitioned key and the +-- new values no longer meet the partition's bound, the row must be moved to +-- the correct partition for the new partition key (if one exists). We must +-- also ensure that updatable views on partitioned tables properly enforce any +-- WITH CHECK OPTION that is defined. The situation with triggers in this case +-- also requires thorough testing as partition key updates causing row +-- movement convert UPDATEs into DELETE+INSERT. + +CREATE TABLE range_parted ( + a text, + b bigint, + c numeric, + d int, + e varchar +) PARTITION BY RANGE (a, b); + +-- Create partitions intentionally in descending bound order, so as to test +-- that update-row-movement works with the leaf partitions not in bound order. +CREATE TABLE part_b_20_b_30 (e varchar, c numeric, a text, b bigint, d int); +ALTER TABLE range_parted ATTACH PARTITION part_b_20_b_30 FOR VALUES FROM ('b', 20) TO ('b', 30); +CREATE TABLE part_b_10_b_20 (e varchar, c numeric, a text, b bigint, d int) PARTITION BY RANGE (c); +CREATE TABLE part_b_1_b_10 PARTITION OF range_parted FOR VALUES FROM ('b', 1) TO ('b', 10); +ALTER TABLE range_parted ATTACH PARTITION part_b_10_b_20 FOR VALUES FROM ('b', 10) TO ('b', 20); +CREATE TABLE part_a_10_a_20 PARTITION OF range_parted FOR VALUES FROM ('a', 10) TO ('a', 20); +CREATE TABLE part_a_1_a_10 PARTITION OF range_parted FOR VALUES FROM ('a', 1) TO ('a', 10); + +-- Check that partition-key UPDATE works sanely on a partitioned table that +-- does not have any child partitions. +UPDATE part_b_10_b_20 set b = b - 6; + +-- Create some more partitions following the above pattern of descending bound +-- order, but let's make the situation a bit more complex by having the +-- attribute numbers of the columns vary from their parent partition. +CREATE TABLE part_c_100_200 (e varchar, c numeric, a text, b bigint, d int) PARTITION BY range (abs(d)); +ALTER TABLE part_c_100_200 DROP COLUMN e, DROP COLUMN c, DROP COLUMN a; +ALTER TABLE part_c_100_200 ADD COLUMN c numeric, ADD COLUMN e varchar, ADD COLUMN a text; +ALTER TABLE part_c_100_200 DROP COLUMN b; +ALTER TABLE part_c_100_200 ADD COLUMN b bigint; +CREATE TABLE part_d_1_15 PARTITION OF part_c_100_200 FOR VALUES FROM (1) TO (15); +CREATE TABLE part_d_15_20 PARTITION OF part_c_100_200 FOR VALUES FROM (15) TO (20); + +ALTER TABLE part_b_10_b_20 ATTACH PARTITION part_c_100_200 FOR VALUES FROM (100) TO (200); + +CREATE TABLE part_c_1_100 (e varchar, d int, c numeric, b bigint, a text); +ALTER TABLE part_b_10_b_20 ATTACH PARTITION part_c_1_100 FOR VALUES FROM (1) TO (100); + +\set init_range_parted 'truncate range_parted; insert into range_parted VALUES (''a'', 1, 1, 1), (''a'', 10, 200, 1), (''b'', 12, 96, 1), (''b'', 13, 97, 2), (''b'', 15, 105, 16), (''b'', 17, 105, 19)' +\set show_data 'select tableoid::regclass::text COLLATE "C" partname, * from range_parted ORDER BY 1, 2, 3, 4, 5, 6' +----:init_range_parted; +----:show_data; + +-- The order of subplans should be in bound order +EXPLAIN (costs off) UPDATE range_parted set c = c - 50 WHERE c > 97; + +-- fail, row movement happens only within the partition subtree. +UPDATE part_c_100_200 set c = c - 20, d = c WHERE c = 105; +-- fail, no partition key update, so no attempt to move tuple, +-- but "a = 'a'" violates partition constraint enforced by root partition) +UPDATE part_b_10_b_20 set a = 'a'; +-- ok, partition key update, no constraint violation +UPDATE range_parted set d = d - 10 WHERE d > 10; +-- ok, no partition key update, no constraint violation +UPDATE range_parted set e = d; +-- No row found +UPDATE part_c_1_100 set c = c + 20 WHERE c = 98; +-- ok, row movement +UPDATE part_b_10_b_20 set c = c + 20 returning c, b, a; +--:show_data; + +-- fail, row movement happens only within the partition subtree. +UPDATE part_b_10_b_20 set b = b - 6 WHERE c > 116 returning *; +-- ok, row movement, with subset of rows moved into different partition. +UPDATE range_parted set b = b - 6 WHERE c > 116 returning a, b + c; + +----:show_data; + +-- Common table needed for multiple test scenarios. +CREATE TABLE mintab(c1 int); +INSERT into mintab VALUES (120); + +-- update partition key using updatable view. +CREATE VIEW upview AS SELECT * FROM range_parted WHERE (select c > c1 FROM mintab) WITH CHECK OPTION; +-- ok +UPDATE upview set c = 199 WHERE b = 4; +-- fail, check option violation +UPDATE upview set c = 120 WHERE b = 4; +-- fail, row movement with check option violation +UPDATE upview set a = 'b', b = 15, c = 120 WHERE b = 4; +-- ok, row movement, check option passes +UPDATE upview set a = 'b', b = 15 WHERE b = 4; + +--:show_data; + +-- cleanup +DROP VIEW upview; + +-- RETURNING having whole-row vars. +--:init_range_parted; +UPDATE range_parted set c = 95 WHERE a = 'b' and b > 10 and c > 100 returning (range_parted), *; +--:show_data; + + +-- Transition tables with update row movement +----:init_range_parted; + +CREATE FUNCTION trans_updatetrigfunc() RETURNS trigger LANGUAGE plpgsql AS +$$ + begin + raise notice 'trigger = %, old table = %, new table = %', + TG_NAME, + (select string_agg(old_table::text, ', ' ORDER BY a) FROM old_table), + (select string_agg(new_table::text, ', ' ORDER BY a) FROM new_table); + return null; + end; +$$; + +CREATE TRIGGER trans_updatetrig + AFTER UPDATE ON range_parted REFERENCING OLD TABLE AS old_table NEW TABLE AS new_table + FOR EACH STATEMENT EXECUTE PROCEDURE trans_updatetrigfunc(); + +UPDATE range_parted set c = (case when c = 96 then 110 else c + 1 end ) WHERE a = 'b' and b > 10 and c >= 96; +--:show_data; +----:init_range_parted; + +-- Enabling OLD TABLE capture for both DELETE as well as UPDATE stmt triggers +-- should not cause DELETEd rows to be captured twice. Similar thing for +-- INSERT triggers and inserted rows. +CREATE TRIGGER trans_deletetrig + AFTER DELETE ON range_parted REFERENCING OLD TABLE AS old_table + FOR EACH STATEMENT EXECUTE PROCEDURE trans_updatetrigfunc(); +CREATE TRIGGER trans_inserttrig + AFTER INSERT ON range_parted REFERENCING NEW TABLE AS new_table + FOR EACH STATEMENT EXECUTE PROCEDURE trans_updatetrigfunc(); +UPDATE range_parted set c = c + 50 WHERE a = 'b' and b > 10 and c >= 96; +--:show_data; +DROP TRIGGER trans_deletetrig ON range_parted; +DROP TRIGGER trans_inserttrig ON range_parted; +-- Don't drop trans_updatetrig yet. It is required below. + +-- Test with transition tuple conversion happening for rows moved into the +-- new partition. This requires a trigger that references transition table +-- (we already have trans_updatetrig). For inserted rows, the conversion +-- is not usually needed, because the original tuple is already compatible with +-- the desired transition tuple format. But conversion happens when there is a +-- BR trigger because the trigger can change the inserted row. So install a +-- BR triggers on those child partitions where the rows will be moved. +CREATE FUNCTION func_parted_mod_b() RETURNS trigger AS $$ +BEGIN + NEW.b = NEW.b + 1; + return NEW; +END $$ language plpgsql; +CREATE TRIGGER trig_c1_100 BEFORE UPDATE OR INSERT ON part_c_1_100 + FOR EACH ROW EXECUTE PROCEDURE func_parted_mod_b(); +CREATE TRIGGER trig_d1_15 BEFORE UPDATE OR INSERT ON part_d_1_15 + FOR EACH ROW EXECUTE PROCEDURE func_parted_mod_b(); +CREATE TRIGGER trig_d15_20 BEFORE UPDATE OR INSERT ON part_d_15_20 + FOR EACH ROW EXECUTE PROCEDURE func_parted_mod_b(); +----:init_range_parted; +UPDATE range_parted set c = (case when c = 96 then 110 else c + 1 end) WHERE a = 'b' and b > 10 and c >= 96; +--:show_data; +----:init_range_parted; +UPDATE range_parted set c = c + 50 WHERE a = 'b' and b > 10 and c >= 96; +--:show_data; + +-- Case where per-partition tuple conversion map array is allocated, but the +-- map is not required for the particular tuple that is routed, thanks to +-- matching table attributes of the partition and the target table. +----:init_range_parted; +UPDATE range_parted set b = 15 WHERE b = 1; +--:show_data; + +DROP TRIGGER trans_updatetrig ON range_parted; +DROP TRIGGER trig_c1_100 ON part_c_1_100; +DROP TRIGGER trig_d1_15 ON part_d_1_15; +DROP TRIGGER trig_d15_20 ON part_d_15_20; +DROP FUNCTION func_parted_mod_b(); + +-- RLS policies with update-row-movement +----------------------------------------- + +ALTER TABLE range_parted ENABLE ROW LEVEL SECURITY; +CREATE USER regress_range_parted_user; +GRANT ALL ON range_parted, mintab TO regress_range_parted_user; +CREATE POLICY seeall ON range_parted AS PERMISSIVE FOR SELECT USING (true); +CREATE POLICY policy_range_parted ON range_parted for UPDATE USING (true) WITH CHECK (c % 2 = 0); + +----:init_range_parted; +SET SESSION AUTHORIZATION regress_range_parted_user; +-- This should fail with RLS violation error while moving row from +-- part_a_10_a_20 to part_d_1_15, because we are setting 'c' to an odd number. +UPDATE range_parted set a = 'b', c = 151 WHERE a = 'a' and c = 200; + +RESET SESSION AUTHORIZATION; +-- Create a trigger on part_d_1_15 +CREATE FUNCTION func_d_1_15() RETURNS trigger AS $$ +BEGIN + NEW.c = NEW.c + 1; -- Make even numbers odd, or vice versa + return NEW; +END $$ LANGUAGE plpgsql; +CREATE TRIGGER trig_d_1_15 BEFORE INSERT ON part_d_1_15 + FOR EACH ROW EXECUTE PROCEDURE func_d_1_15(); + +----:init_range_parted; +SET SESSION AUTHORIZATION regress_range_parted_user; + +-- Here, RLS checks should succeed while moving row from part_a_10_a_20 to +-- part_d_1_15. Even though the UPDATE is setting 'c' to an odd number, the +-- trigger at the destination partition again makes it an even number. +UPDATE range_parted set a = 'b', c = 151 WHERE a = 'a' and c = 200; + +RESET SESSION AUTHORIZATION; +----:init_range_parted; +SET SESSION AUTHORIZATION regress_range_parted_user; +-- This should fail with RLS violation error. Even though the UPDATE is setting +-- 'c' to an even number, the trigger at the destination partition again makes +-- it an odd number. +UPDATE range_parted set a = 'b', c = 150 WHERE a = 'a' and c = 200; + +-- Cleanup +RESET SESSION AUTHORIZATION; +DROP TRIGGER trig_d_1_15 ON part_d_1_15; +DROP FUNCTION func_d_1_15(); + +-- Policy expression contains SubPlan +RESET SESSION AUTHORIZATION; +----:init_range_parted; +CREATE POLICY policy_range_parted_subplan on range_parted + AS RESTRICTIVE for UPDATE USING (true) + WITH CHECK ((SELECT range_parted.c <= c1 FROM mintab)); +SET SESSION AUTHORIZATION regress_range_parted_user; +-- fail, mintab has row with c1 = 120 +UPDATE range_parted set a = 'b', c = 122 WHERE a = 'a' and c = 200; +-- ok +UPDATE range_parted set a = 'b', c = 120 WHERE a = 'a' and c = 200; + +-- RLS policy expression contains whole row. + +RESET SESSION AUTHORIZATION; +----:init_range_parted; +CREATE POLICY policy_range_parted_wholerow on range_parted AS RESTRICTIVE for UPDATE USING (true) + WITH CHECK (range_parted = row('b', 10, 112, 1, NULL)::range_parted); +SET SESSION AUTHORIZATION regress_range_parted_user; +-- ok, should pass the RLS check +UPDATE range_parted set a = 'b', c = 112 WHERE a = 'a' and c = 200; +RESET SESSION AUTHORIZATION; +----:init_range_parted; +SET SESSION AUTHORIZATION regress_range_parted_user; +-- fail, the whole row RLS check should fail +UPDATE range_parted set a = 'b', c = 116 WHERE a = 'a' and c = 200; + +-- Cleanup +RESET SESSION AUTHORIZATION; +DROP POLICY policy_range_parted ON range_parted; +DROP POLICY policy_range_parted_subplan ON range_parted; +DROP POLICY policy_range_parted_wholerow ON range_parted; +REVOKE ALL ON range_parted, mintab FROM regress_range_parted_user; +DROP USER regress_range_parted_user; +DROP TABLE mintab; + + +-- statement triggers with update row movement +--------------------------------------------------- + +----:init_range_parted; + +CREATE FUNCTION trigfunc() returns trigger language plpgsql as +$$ + begin + raise notice 'trigger = % fired on table % during %', + TG_NAME, TG_TABLE_NAME, TG_OP; + return null; + end; +$$; +-- Triggers on root partition +CREATE TRIGGER parent_delete_trig + AFTER DELETE ON range_parted for each statement execute procedure trigfunc(); +CREATE TRIGGER parent_update_trig + AFTER UPDATE ON range_parted for each statement execute procedure trigfunc(); +CREATE TRIGGER parent_insert_trig + AFTER INSERT ON range_parted for each statement execute procedure trigfunc(); + +-- Triggers on leaf partition part_c_1_100 +CREATE TRIGGER c1_delete_trig + AFTER DELETE ON part_c_1_100 for each statement execute procedure trigfunc(); +CREATE TRIGGER c1_update_trig + AFTER UPDATE ON part_c_1_100 for each statement execute procedure trigfunc(); +CREATE TRIGGER c1_insert_trig + AFTER INSERT ON part_c_1_100 for each statement execute procedure trigfunc(); + +-- Triggers on leaf partition part_d_1_15 +CREATE TRIGGER d1_delete_trig + AFTER DELETE ON part_d_1_15 for each statement execute procedure trigfunc(); +CREATE TRIGGER d1_update_trig + AFTER UPDATE ON part_d_1_15 for each statement execute procedure trigfunc(); +CREATE TRIGGER d1_insert_trig + AFTER INSERT ON part_d_1_15 for each statement execute procedure trigfunc(); +-- Triggers on leaf partition part_d_15_20 +CREATE TRIGGER d15_delete_trig + AFTER DELETE ON part_d_15_20 for each statement execute procedure trigfunc(); +CREATE TRIGGER d15_update_trig + AFTER UPDATE ON part_d_15_20 for each statement execute procedure trigfunc(); +CREATE TRIGGER d15_insert_trig + AFTER INSERT ON part_d_15_20 for each statement execute procedure trigfunc(); + +-- Move all rows from part_c_100_200 to part_c_1_100. None of the delete or +-- insert statement triggers should be fired. +UPDATE range_parted set c = c - 50 WHERE c > 97; +--:show_data; + +DROP TRIGGER parent_delete_trig ON range_parted; +DROP TRIGGER parent_update_trig ON range_parted; +DROP TRIGGER parent_insert_trig ON range_parted; +DROP TRIGGER c1_delete_trig ON part_c_1_100; +DROP TRIGGER c1_update_trig ON part_c_1_100; +DROP TRIGGER c1_insert_trig ON part_c_1_100; +DROP TRIGGER d1_delete_trig ON part_d_1_15; +DROP TRIGGER d1_update_trig ON part_d_1_15; +DROP TRIGGER d1_insert_trig ON part_d_1_15; +DROP TRIGGER d15_delete_trig ON part_d_15_20; +DROP TRIGGER d15_update_trig ON part_d_15_20; +DROP TRIGGER d15_insert_trig ON part_d_15_20; + + +-- Creating default partition for range +----:init_range_parted; +create table part_def partition of range_parted default; +\d+ part_def +insert into range_parted values ('c', 9); +-- ok +update part_def set a = 'd' where a = 'c'; +-- fail +update part_def set a = 'a' where a = 'd'; + +--:show_data; + +-- Update row movement from non-default to default partition. +-- fail, default partition is not under part_a_10_a_20; +UPDATE part_a_10_a_20 set a = 'ad' WHERE a = 'a'; +-- ok +UPDATE range_parted set a = 'ad' WHERE a = 'a'; +UPDATE range_parted set a = 'bd' WHERE a = 'b'; +--:show_data; +-- Update row movement from default to non-default partitions. +-- ok +UPDATE range_parted set a = 'a' WHERE a = 'ad'; +UPDATE range_parted set a = 'b' WHERE a = 'bd'; +--:show_data; + +-- Cleanup: range_parted no longer needed. +DROP TABLE range_parted; + +CREATE TABLE list_parted ( + a text, + b int +) PARTITION BY list (a); +CREATE TABLE list_part1 PARTITION OF list_parted for VALUES in ('a', 'b'); +CREATE TABLE list_default PARTITION OF list_parted default; +INSERT into list_part1 VALUES ('a', 1); +INSERT into list_default VALUES ('d', 10); + +-- fail +UPDATE list_default set a = 'a' WHERE a = 'd'; +-- ok +UPDATE list_default set a = 'x' WHERE a = 'd'; + +DROP TABLE list_parted; + +-------------- +-- Some more update-partition-key test scenarios below. This time use list +-- partitions. +-------------- + +-- Setup for list partitions +CREATE TABLE list_parted (a numeric, b int, c int8) PARTITION BY list (a); +CREATE TABLE sub_parted PARTITION OF list_parted for VALUES in (1) PARTITION BY list (b); + +CREATE TABLE sub_part1(b int, c int8, a numeric); +ALTER TABLE sub_parted ATTACH PARTITION sub_part1 for VALUES in (1); +CREATE TABLE sub_part2(b int, c int8, a numeric); +ALTER TABLE sub_parted ATTACH PARTITION sub_part2 for VALUES in (2); + +CREATE TABLE list_part1(a numeric, b int, c int8); +ALTER TABLE list_parted ATTACH PARTITION list_part1 for VALUES in (2,3); + +INSERT into list_parted VALUES (2,5,50); +INSERT into list_parted VALUES (3,6,60); +INSERT into sub_parted VALUES (1,1,60); +INSERT into sub_parted VALUES (1,2,10); + +-- Test partition constraint violation when intermediate ancestor is used and +-- constraint is inherited from upper root. +UPDATE sub_parted set a = 2 WHERE c = 10; + +-- Test update-partition-key, where the unpruned partitions do not have their +-- partition keys updated. +SELECT tableoid::regclass::text, * FROM list_parted WHERE a = 2 ORDER BY 1; +UPDATE list_parted set b = c + a WHERE a = 2; +SELECT tableoid::regclass::text, * FROM list_parted WHERE a = 2 ORDER BY 1; + + +-- Test the case where BR UPDATE triggers change the partition key. +CREATE FUNCTION func_parted_mod_b() returns trigger as $$ +BEGIN + NEW.b = 2; -- This is changing partition key column. + return NEW; +END $$ LANGUAGE plpgsql; +CREATE TRIGGER parted_mod_b before update on sub_part1 + for each row execute procedure func_parted_mod_b(); + +SELECT tableoid::regclass::text, * FROM list_parted ORDER BY 1, 2, 3, 4; + +-- This should do the tuple routing even though there is no explicit +-- partition-key update, because there is a trigger on sub_part1. +UPDATE list_parted set c = 70 WHERE b = 1; +SELECT tableoid::regclass::text, * FROM list_parted ORDER BY 1, 2, 3, 4; + +DROP TRIGGER parted_mod_b ON sub_part1; + +-- If BR DELETE trigger prevented DELETE from happening, we should also skip +-- the INSERT if that delete is part of UPDATE=>DELETE+INSERT. +CREATE OR REPLACE FUNCTION func_parted_mod_b() returns trigger as $$ +BEGIN + raise notice 'Trigger: Got OLD row %, but returning NULL', OLD; + return NULL; +END $$ LANGUAGE plpgsql; +CREATE TRIGGER trig_skip_delete before delete on sub_part2 + for each row execute procedure func_parted_mod_b(); +UPDATE list_parted set b = 1 WHERE c = 70; +SELECT tableoid::regclass::text, * FROM list_parted ORDER BY 1, 2, 3, 4; +-- Drop the trigger. Now the row should be moved. +DROP TRIGGER trig_skip_delete ON sub_part2; +UPDATE list_parted set b = 1 WHERE c = 70; +SELECT tableoid::regclass::text, * FROM list_parted ORDER BY 1, 2, 3, 4; +DROP FUNCTION func_parted_mod_b(); + +-- UPDATE partition-key with FROM clause. If join produces multiple output +-- rows for the same row to be modified, we should tuple-route the row only +-- once. There should not be any rows inserted. +CREATE TABLE non_parted (id int); +INSERT into non_parted VALUES (1), (1), (1), (2), (2), (2), (3), (3), (3); +UPDATE list_parted t1 set a = 2 FROM non_parted t2 WHERE t1.a = t2.id and a = 1; +SELECT tableoid::regclass::text, * FROM list_parted ORDER BY 1, 2, 3, 4; +DROP TABLE non_parted; + +-- Cleanup: list_parted no longer needed. +DROP TABLE list_parted; + +-- create custom operator class and hash function, for the same reason +-- explained in alter_table.sql +create or replace function dummy_hashint4(a int4, seed int8) returns int8 as +$$ begin return (a + seed); end; $$ language 'plpgsql' immutable; +create operator class custom_opclass for type int4 using hash as +operator 1 = , function 2 dummy_hashint4(int4, int8); + +create table hash_parted ( + a int, + b int +) partition by hash (a custom_opclass, b custom_opclass); +create table hpart1 partition of hash_parted for values with (modulus 2, remainder 1); +create table hpart2 partition of hash_parted for values with (modulus 4, remainder 2); +create table hpart3 partition of hash_parted for values with (modulus 8, remainder 0); +create table hpart4 partition of hash_parted for values with (modulus 8, remainder 4); +insert into hpart1 values (1, 1); +insert into hpart2 values (2, 5); +insert into hpart4 values (3, 4); + +-- fail +update hpart1 set a = 3, b=4 where a = 1; +-- ok, row movement +update hash_parted set b = b - 1 where b = 1; +-- ok +update hash_parted set b = b + 8 where b = 1; + +-- cleanup +drop table hash_parted; +drop operator class custom_opclass using hash; +drop function dummy_hashint4(a int4, seed int8); diff --git a/postgresql/examples/uuid.sql b/postgresql/examples/uuid.sql new file mode 100644 index 0000000..3bd3b35 --- /dev/null +++ b/postgresql/examples/uuid.sql @@ -0,0 +1,85 @@ +-- regression test for the uuid datatype +-- creating test tables +CREATE TABLE guid1 +( + guid_field UUID, + text_field TEXT DEFAULT(now()) +); +CREATE TABLE guid2 +( + guid_field UUID, + text_field TEXT DEFAULT(now()) +); + +-- inserting invalid data tests +-- too long +INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111F'); +-- too short +INSERT INTO guid1(guid_field) VALUES('{11111111-1111-1111-1111-11111111111}'); +-- valid data but invalid format +INSERT INTO guid1(guid_field) VALUES('111-11111-1111-1111-1111-111111111111'); +INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222 '); +-- invalid data +INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-G111-111111111111'); +INSERT INTO guid1(guid_field) VALUES('11+11111-1111-1111-1111-111111111111'); + +--inserting three input formats +INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111'); +INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222}'); +INSERT INTO guid1(guid_field) VALUES('3f3e3c3b3a3039383736353433a2313e'); + +-- retrieving the inserted data +SELECT guid_field FROM guid1; + +-- ordering test +SELECT guid_field FROM guid1 ORDER BY guid_field ASC; +SELECT guid_field FROM guid1 ORDER BY guid_field DESC; + +-- = operator test +SELECT COUNT(*) FROM guid1 WHERE guid_field = '3f3e3c3b-3a30-3938-3736-353433a2313e'; + +-- <> operator test +SELECT COUNT(*) FROM guid1 WHERE guid_field <> '11111111111111111111111111111111'; + +-- < operator test +SELECT COUNT(*) FROM guid1 WHERE guid_field < '22222222-2222-2222-2222-222222222222'; + +-- <= operator test +SELECT COUNT(*) FROM guid1 WHERE guid_field <= '22222222-2222-2222-2222-222222222222'; + +-- > operator test +SELECT COUNT(*) FROM guid1 WHERE guid_field > '22222222-2222-2222-2222-222222222222'; + +-- >= operator test +SELECT COUNT(*) FROM guid1 WHERE guid_field >= '22222222-2222-2222-2222-222222222222'; + +-- btree and hash index creation test +CREATE INDEX guid1_btree ON guid1 USING BTREE (guid_field); +CREATE INDEX guid1_hash ON guid1 USING HASH (guid_field); + +-- unique index test +CREATE UNIQUE INDEX guid1_unique_BTREE ON guid1 USING BTREE (guid_field); +-- should fail +INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111'); + +-- check to see whether the new indexes are actually there +SELECT count(*) FROM pg_class WHERE relkind='i' AND relname LIKE 'guid%'; + +-- populating the test tables with additional records +INSERT INTO guid1(guid_field) VALUES('44444444-4444-4444-4444-444444444444'); +INSERT INTO guid2(guid_field) VALUES('11111111-1111-1111-1111-111111111111'); +INSERT INTO guid2(guid_field) VALUES('{22222222-2222-2222-2222-222222222222}'); +INSERT INTO guid2(guid_field) VALUES('3f3e3c3b3a3039383736353433a2313e'); + +-- join test +SELECT COUNT(*) FROM guid1 g1 INNER JOIN guid2 g2 ON g1.guid_field = g2.guid_field; +SELECT COUNT(*) FROM guid1 g1 LEFT JOIN guid2 g2 ON g1.guid_field = g2.guid_field WHERE g2.guid_field IS NULL; + +-- generation test +TRUNCATE guid1; +INSERT INTO guid1 (guid_field) VALUES (gen_random_uuid()); +INSERT INTO guid1 (guid_field) VALUES (gen_random_uuid()); +SELECT count(DISTINCT guid_field) FROM guid1; + +-- clean up +DROP TABLE guid1, guid2 CASCADE; diff --git a/postgresql/examples/vacuum.sql b/postgresql/examples/vacuum.sql new file mode 100644 index 0000000..e7dcfdc --- /dev/null +++ b/postgresql/examples/vacuum.sql @@ -0,0 +1,296 @@ +-- +-- VACUUM +-- + +CREATE TABLE vactst (i INT); +--INSERT INTO vactst VALUES (1); +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +--INSERT INTO vactst VALUES (0); +--SELECT count(*) FROM vactst; +--DELETE FROM vactst WHERE i != 0; +--SELECT * FROM vactst; +VACUUM FULL vactst; +--UPDATE vactst SET i = i + 1; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst SELECT * FROM vactst; +INSERT INTO vactst VALUES (0); +SELECT count(*) FROM vactst; +DELETE FROM vactst WHERE i != 0; +VACUUM (FULL) vactst; +DELETE FROM vactst; +SELECT * FROM vactst; + +VACUUM (FULL, FREEZE) vactst; +VACUUM (ANALYZE, FULL) vactst; + +CREATE TABLE vaccluster (i INT PRIMARY KEY); +ALTER TABLE vaccluster CLUSTER ON vaccluster_pkey; +CLUSTER vaccluster; + +CREATE FUNCTION do_analyze() RETURNS VOID VOLATILE LANGUAGE SQL + AS 'ANALYZE pg_am'; +CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL + AS 'SELECT $1 FROM do_analyze()'; +CREATE INDEX ON vaccluster(wrap_do_analyze(i)); +INSERT INTO vaccluster VALUES (1), (2); +ANALYZE vaccluster; + +-- Test ANALYZE in transaction, where the transaction surrounding +-- analyze performed modifications. This tests for the bug at +-- https://postgr.es/m/c7988239-d42c-ddc4-41db-171b23b35e4f%40ssinger.info +-- (which hopefully is unlikely to be reintroduced), but also seems +-- independently worthwhile to cover. +INSERT INTO vactst SELECT generate_series(1, 300); +DELETE FROM vactst WHERE i % 7 = 0; -- delete a few rows outside +BEGIN; +INSERT INTO vactst SELECT generate_series(301, 400); +DELETE FROM vactst WHERE i % 5 <> 0; -- delete a few rows inside +ANALYZE vactst; +COMMIT; + +VACUUM FULL pg_am; +VACUUM FULL pg_class; +VACUUM FULL pg_database; +VACUUM FULL vaccluster; +VACUUM FULL vactst; + +VACUUM (DISABLE_PAGE_SKIPPING) vaccluster; + +-- PARALLEL option +CREATE TABLE pvactst (i INT, a INT[], p POINT) with (autovacuum_enabled = off); +INSERT INTO pvactst SELECT i, array[1,2,3], point(i, i+1) FROM generate_series(1,1000) i; +CREATE INDEX btree_pvactst ON pvactst USING btree (i); +CREATE INDEX hash_pvactst ON pvactst USING hash (i); +CREATE INDEX brin_pvactst ON pvactst USING brin (i); +CREATE INDEX gin_pvactst ON pvactst USING gin (a); +CREATE INDEX gist_pvactst ON pvactst USING gist (p); +CREATE INDEX spgist_pvactst ON pvactst USING spgist (p); + +-- VACUUM invokes parallel index cleanup +SET min_parallel_index_scan_size to 0; +VACUUM (PARALLEL 2) pvactst; + +-- VACUUM invokes parallel bulk-deletion +UPDATE pvactst SET i = i WHERE i < 1000; +VACUUM (PARALLEL 2) pvactst; + +UPDATE pvactst SET i = i WHERE i < 1000; +VACUUM (PARALLEL 0) pvactst; -- disable parallel vacuum + +VACUUM (PARALLEL -1) pvactst; -- error +VACUUM (PARALLEL 2, INDEX_CLEANUP FALSE) pvactst; +VACUUM (PARALLEL 2, FULL TRUE) pvactst; -- error, cannot use both PARALLEL and FULL +VACUUM (PARALLEL) pvactst; -- error, cannot use PARALLEL option without parallel degree + +-- Test different combinations of parallel and full options for temporary tables +CREATE TEMPORARY TABLE tmp (a int PRIMARY KEY); +CREATE INDEX tmp_idx1 ON tmp (a); +VACUUM (PARALLEL 1, FULL FALSE) tmp; -- parallel vacuum disabled for temp tables +VACUUM (PARALLEL 0, FULL TRUE) tmp; -- can specify parallel disabled (even though that's implied by FULL) +RESET min_parallel_index_scan_size; +DROP TABLE pvactst; + +-- INDEX_CLEANUP option +CREATE TABLE no_index_cleanup (i INT PRIMARY KEY, t TEXT); +-- Use uncompressed data stored in toast. +CREATE INDEX no_index_cleanup_idx ON no_index_cleanup(t); +ALTER TABLE no_index_cleanup ALTER COLUMN t SET STORAGE EXTERNAL; +INSERT INTO no_index_cleanup(i, t) VALUES (generate_series(1,30), + repeat('1234567890',269)); +-- index cleanup option is ignored if VACUUM FULL +VACUUM (INDEX_CLEANUP TRUE, FULL TRUE) no_index_cleanup; +VACUUM (FULL TRUE) no_index_cleanup; +-- Toast inherits the value from its parent table. +ALTER TABLE no_index_cleanup SET (vacuum_index_cleanup = false); +DELETE FROM no_index_cleanup WHERE i < 15; +-- Nothing is cleaned up. +VACUUM no_index_cleanup; +-- Both parent relation and toast are cleaned up. +ALTER TABLE no_index_cleanup SET (vacuum_index_cleanup = true); +VACUUM no_index_cleanup; +-- Parameter is set for both the parent table and its toast relation. +INSERT INTO no_index_cleanup(i, t) VALUES (generate_series(31,60), + repeat('1234567890',269)); +DELETE FROM no_index_cleanup WHERE i < 45; +-- Only toast index is cleaned up. +ALTER TABLE no_index_cleanup SET (vacuum_index_cleanup = false, + toast.vacuum_index_cleanup = true); +VACUUM no_index_cleanup; +-- Only parent is cleaned up. +ALTER TABLE no_index_cleanup SET (vacuum_index_cleanup = true, + toast.vacuum_index_cleanup = false); +VACUUM no_index_cleanup; +-- Test some extra relations. +VACUUM (INDEX_CLEANUP FALSE) vaccluster; +VACUUM (INDEX_CLEANUP FALSE) vactst; -- index cleanup option is ignored if no indexes +VACUUM (INDEX_CLEANUP FALSE, FREEZE TRUE) vaccluster; + +-- TRUNCATE option +CREATE TABLE vac_truncate_test(i INT NOT NULL, j text) + WITH (vacuum_truncate=true, autovacuum_enabled=false); +INSERT INTO vac_truncate_test VALUES (1, NULL), (NULL, NULL); +VACUUM (TRUNCATE FALSE) vac_truncate_test; +SELECT pg_relation_size('vac_truncate_test') > 0; +VACUUM vac_truncate_test; +SELECT pg_relation_size('vac_truncate_test') = 0; +VACUUM (TRUNCATE FALSE, FULL TRUE) vac_truncate_test; +DROP TABLE vac_truncate_test; + +-- partitioned table +CREATE TABLE vacparted (a int, b char) PARTITION BY LIST (a); +CREATE TABLE vacparted1 PARTITION OF vacparted FOR VALUES IN (1); +INSERT INTO vacparted VALUES (1, 'a'); +UPDATE vacparted SET b = 'b'; +VACUUM (ANALYZE) vacparted; +VACUUM (FULL) vacparted; +VACUUM (FREEZE) vacparted; + +-- check behavior with duplicate column mentions +VACUUM ANALYZE vacparted(a,b,a); +ANALYZE vacparted(a,b,b); + +-- multiple tables specified +VACUUM vaccluster, vactst; +VACUUM vacparted, does_not_exist; +VACUUM (FREEZE) vacparted, vaccluster, vactst; +VACUUM (FREEZE) does_not_exist, vaccluster; +VACUUM ANALYZE vactst, vacparted (a); +VACUUM ANALYZE vactst (does_not_exist), vacparted (b); +VACUUM FULL vacparted, vactst; +VACUUM FULL vactst, vacparted (a, b), vaccluster (i); +ANALYZE vactst, vacparted; +ANALYZE vacparted (b), vactst; +ANALYZE vactst, does_not_exist, vacparted; +ANALYZE vactst (i), vacparted (does_not_exist); +ANALYZE vactst, vactst; +BEGIN; -- ANALYZE behaves differently inside a transaction block +ANALYZE vactst, vactst; +COMMIT; + +-- parenthesized syntax for ANALYZE +ANALYZE (VERBOSE) does_not_exist; +--ANALYZE (nonexistent-arg) does_not_exist; +--ANALYZE (nonexistentarg) does_not_exit; + +-- ensure argument order independence, and that SKIP_LOCKED on non-existing +-- relation still errors out. Suppress WARNING messages caused by concurrent +-- autovacuums. +SET client_min_messages TO 'ERROR'; +ANALYZE (SKIP_LOCKED, VERBOSE) does_not_exist; +ANALYZE (VERBOSE, SKIP_LOCKED) does_not_exist; + +-- SKIP_LOCKED option +VACUUM (SKIP_LOCKED) vactst; +VACUUM (SKIP_LOCKED, FULL) vactst; +ANALYZE (SKIP_LOCKED) vactst; +RESET client_min_messages; + +-- ensure VACUUM and ANALYZE don't have a problem with serializable +SET default_transaction_isolation = serializable; +VACUUM vactst; +ANALYZE vactst; +RESET default_transaction_isolation; +BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; +ANALYZE vactst; +COMMIT; + +DROP TABLE vaccluster; +DROP TABLE vactst; +DROP TABLE vacparted; +DROP TABLE no_index_cleanup; + +-- relation ownership, WARNING logs generated as all are skipped. +CREATE TABLE vacowned (a int); +CREATE TABLE vacowned_parted (a int) PARTITION BY LIST (a); +CREATE TABLE vacowned_part1 PARTITION OF vacowned_parted FOR VALUES IN (1); +CREATE TABLE vacowned_part2 PARTITION OF vacowned_parted FOR VALUES IN (2); +CREATE ROLE regress_vacuum; +SET ROLE regress_vacuum; +-- Simple table +VACUUM vacowned; +ANALYZE vacowned; +VACUUM (ANALYZE) vacowned; +-- Catalog +VACUUM pg_catalog.pg_class; +ANALYZE pg_catalog.pg_class; +VACUUM (ANALYZE) pg_catalog.pg_class; +-- Shared catalog +VACUUM pg_catalog.pg_authid; +ANALYZE pg_catalog.pg_authid; +VACUUM (ANALYZE) pg_catalog.pg_authid; +-- Partitioned table and its partitions, nothing owned by other user. +-- Relations are not listed in a single command to test ownership +-- independently. +VACUUM vacowned_parted; +VACUUM vacowned_part1; +VACUUM vacowned_part2; +ANALYZE vacowned_parted; +ANALYZE vacowned_part1; +ANALYZE vacowned_part2; +VACUUM (ANALYZE) vacowned_parted; +VACUUM (ANALYZE) vacowned_part1; +VACUUM (ANALYZE) vacowned_part2; +RESET ROLE; +-- Partitioned table and one partition owned by other user. +ALTER TABLE vacowned_parted OWNER TO regress_vacuum; +ALTER TABLE vacowned_part1 OWNER TO regress_vacuum; +SET ROLE regress_vacuum; +VACUUM vacowned_parted; +VACUUM vacowned_part1; +VACUUM vacowned_part2; +ANALYZE vacowned_parted; +ANALYZE vacowned_part1; +ANALYZE vacowned_part2; +VACUUM (ANALYZE) vacowned_parted; +VACUUM (ANALYZE) vacowned_part1; +VACUUM (ANALYZE) vacowned_part2; +RESET ROLE; +-- Only one partition owned by other user. +ALTER TABLE vacowned_parted OWNER TO CURRENT_USER; +SET ROLE regress_vacuum; +VACUUM vacowned_parted; +VACUUM vacowned_part1; +VACUUM vacowned_part2; +ANALYZE vacowned_parted; +ANALYZE vacowned_part1; +ANALYZE vacowned_part2; +VACUUM (ANALYZE) vacowned_parted; +VACUUM (ANALYZE) vacowned_part1; +VACUUM (ANALYZE) vacowned_part2; +RESET ROLE; +-- Only partitioned table owned by other user. +ALTER TABLE vacowned_parted OWNER TO regress_vacuum; +ALTER TABLE vacowned_part1 OWNER TO CURRENT_USER; +SET ROLE regress_vacuum; +VACUUM vacowned_parted; +VACUUM vacowned_part1; +VACUUM vacowned_part2; +ANALYZE vacowned_parted; +ANALYZE vacowned_part1; +ANALYZE vacowned_part2; +VACUUM (ANALYZE) vacowned_parted; +VACUUM (ANALYZE) vacowned_part1; +VACUUM (ANALYZE) vacowned_part2; +RESET ROLE; +DROP TABLE vacowned; +DROP TABLE vacowned_parted; +DROP ROLE regress_vacuum; diff --git a/postgresql/examples/vacuum_raw.sql b/postgresql/examples/vacuum_raw.sql new file mode 100644 index 0000000..0de2b38 --- /dev/null +++ b/postgresql/examples/vacuum_raw.sql @@ -0,0 +1,74 @@ +VACUUM FULL vactst; +VACUUM (FULL) vactst; +VACUUM (FULL, FREEZE) vactst; +VACUUM (ANALYZE, FULL) vactst; +VACUUM FULL pg_am; +VACUUM FULL pg_class; +VACUUM FULL pg_database; +VACUUM FULL vaccluster; +VACUUM FULL vactst; +VACUUM (DISABLE_PAGE_SKIPPING) vaccluster; +VACUUM (PARALLEL 2) pvactst; +VACUUM (PARALLEL 2) pvactst; +VACUUM (PARALLEL 0) pvactst; -- disable parallel vacuum +VACUUM (PARALLEL -1) pvactst; -- error +VACUUM (PARALLEL 2, INDEX_CLEANUP FALSE) pvactst; +VACUUM (PARALLEL 2, FULL TRUE) pvactst; -- error, cannot use both PARALLEL and FULL +VACUUM (PARALLEL) pvactst; -- error, cannot use PARALLEL option without parallel degree +VACUUM (PARALLEL 1, FULL FALSE) tmp; -- parallel vacuum disabled for temp tables +VACUUM (PARALLEL 0, FULL TRUE) tmp; -- can specify parallel disabled (even though that's implied by FULL) +VACUUM (INDEX_CLEANUP TRUE, FULL TRUE) no_index_cleanup; +VACUUM (FULL TRUE) no_index_cleanup; +VACUUM no_index_cleanup; +VACUUM no_index_cleanup; +VACUUM (INDEX_CLEANUP FALSE) vaccluster; +VACUUM (INDEX_CLEANUP FALSE) vactst; -- index cleanup option is ignored if no indexes +VACUUM (INDEX_CLEANUP FALSE, FREEZE TRUE) vaccluster; +VACUUM (TRUNCATE FALSE) vac_truncate_test; +VACUUM vac_truncate_test; +VACUUM (TRUNCATE FALSE, FULL TRUE) vac_truncate_test; +VACUUM (ANALYZE) vacparted; +VACUUM (FULL) vacparted; +VACUUM (FREEZE) vacparted; +VACUUM ANALYZE vacparted(a,b,a); +VACUUM vaccluster, vactst; +VACUUM vacparted, does_not_exist; +VACUUM (FREEZE) vacparted, vaccluster, vactst; +VACUUM (FREEZE) does_not_exist, vaccluster; +VACUUM ANALYZE vactst, vacparted (a); +VACUUM ANALYZE vactst (does_not_exist), vacparted (b); +VACUUM FULL vacparted, vactst; +VACUUM FULL vactst, vacparted (a, b), vaccluster (i); +VACUUM (SKIP_LOCKED) vactst; +VACUUM (SKIP_LOCKED, FULL) vactst; +VACUUM vactst; +VACUUM vacowned; +VACUUM (ANALYZE) vacowned; +VACUUM pg_catalog.pg_class; +VACUUM (ANALYZE) pg_catalog.pg_class; +VACUUM pg_catalog.pg_authid; +VACUUM (ANALYZE) pg_catalog.pg_authid; +VACUUM vacowned_parted; +VACUUM vacowned_part1; +VACUUM vacowned_part2; +VACUUM (ANALYZE) vacowned_parted; +VACUUM (ANALYZE) vacowned_part1; +VACUUM (ANALYZE) vacowned_part2; +VACUUM vacowned_parted; +VACUUM vacowned_part1; +VACUUM vacowned_part2; +VACUUM (ANALYZE) vacowned_parted; +VACUUM (ANALYZE) vacowned_part1; +VACUUM (ANALYZE) vacowned_part2; +VACUUM vacowned_parted; +VACUUM vacowned_part1; +VACUUM vacowned_part2; +VACUUM (ANALYZE) vacowned_parted; +VACUUM (ANALYZE) vacowned_part1; +VACUUM (ANALYZE) vacowned_part2; +VACUUM vacowned_parted; +VACUUM vacowned_part1; +VACUUM vacowned_part2; +VACUUM (ANALYZE) vacowned_parted; +VACUUM (ANALYZE) vacowned_part1; +VACUUM (ANALYZE) vacowned_part2; diff --git a/postgresql/examples/varchar.sql b/postgresql/examples/varchar.sql new file mode 100644 index 0000000..58d29ca --- /dev/null +++ b/postgresql/examples/varchar.sql @@ -0,0 +1,66 @@ +-- +-- VARCHAR +-- + +CREATE TABLE VARCHAR_TBL(f1 varchar(1)); + +INSERT INTO VARCHAR_TBL (f1) VALUES ('a'); + +INSERT INTO VARCHAR_TBL (f1) VALUES ('A'); + +-- any of the following three input formats are acceptable +INSERT INTO VARCHAR_TBL (f1) VALUES ('1'); + +INSERT INTO VARCHAR_TBL (f1) VALUES (2); + +INSERT INTO VARCHAR_TBL (f1) VALUES ('3'); + +-- zero-length char +INSERT INTO VARCHAR_TBL (f1) VALUES (''); + +-- try varchar's of greater than 1 length +INSERT INTO VARCHAR_TBL (f1) VALUES ('cd'); +INSERT INTO VARCHAR_TBL (f1) VALUES ('c '); + + +SELECT '' AS seven, * FROM VARCHAR_TBL; + +SELECT '' AS six, c.* + FROM VARCHAR_TBL c + WHERE c.f1 <> 'a'; + +SELECT '' AS one, c.* + FROM VARCHAR_TBL c + WHERE c.f1 = 'a'; + +SELECT '' AS five, c.* + FROM VARCHAR_TBL c + WHERE c.f1 < 'a'; + +SELECT '' AS six, c.* + FROM VARCHAR_TBL c + WHERE c.f1 <= 'a'; + +SELECT '' AS one, c.* + FROM VARCHAR_TBL c + WHERE c.f1 > 'a'; + +SELECT '' AS two, c.* + FROM VARCHAR_TBL c + WHERE c.f1 >= 'a'; + +DROP TABLE VARCHAR_TBL; + +-- +-- Now test longer arrays of char +-- + +CREATE TABLE VARCHAR_TBL(f1 varchar(4)); + +INSERT INTO VARCHAR_TBL (f1) VALUES ('a'); +INSERT INTO VARCHAR_TBL (f1) VALUES ('ab'); +INSERT INTO VARCHAR_TBL (f1) VALUES ('abcd'); +INSERT INTO VARCHAR_TBL (f1) VALUES ('abcde'); +INSERT INTO VARCHAR_TBL (f1) VALUES ('abcd '); + +SELECT '' AS four, * FROM VARCHAR_TBL; diff --git a/postgresql/examples/window.sql b/postgresql/examples/window.sql new file mode 100644 index 0000000..e0ab365 --- /dev/null +++ b/postgresql/examples/window.sql @@ -0,0 +1,1306 @@ +-- +-- WINDOW FUNCTIONS +-- + +CREATE TEMPORARY TABLE empsalary ( + depname varchar, + empno bigint, + salary int, + enroll_date date +); + +INSERT INTO empsalary VALUES +('develop', 10, 5200, '2007-08-01'), +('sales', 1, 5000, '2006-10-01'), +('personnel', 5, 3500, '2007-12-10'), +('sales', 4, 4800, '2007-08-08'), +('personnel', 2, 3900, '2006-12-23'), +('develop', 7, 4200, '2008-01-01'), +('develop', 9, 4500, '2008-01-01'), +('sales', 3, 4800, '2007-08-01'), +('develop', 8, 6000, '2006-10-01'), +('develop', 11, 5200, '2007-08-15'); + +SELECT depname, empno, salary, sum(salary) OVER (PARTITION BY depname) FROM empsalary ORDER BY depname, salary; + +SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary) FROM empsalary; + +-- with GROUP BY +SELECT four, ten, SUM(SUM(four)) OVER (PARTITION BY four), AVG(ten) FROM tenk1 +GROUP BY four, ten ORDER BY four, ten; + +SELECT depname, empno, salary, sum(salary) OVER w FROM empsalary WINDOW w AS (PARTITION BY depname); + +SELECT depname, empno, salary, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary) ORDER BY rank() OVER w; + +-- empty window specification +SELECT COUNT(*) OVER () FROM tenk1 WHERE unique2 < 10; + +SELECT COUNT(*) OVER w FROM tenk1 WHERE unique2 < 10 WINDOW w AS (); + +-- no window operation +SELECT four FROM tenk1 WHERE FALSE WINDOW w AS (PARTITION BY ten); + +-- cumulative aggregate +SELECT sum(four) OVER (PARTITION BY ten ORDER BY unique2) AS sum_1, ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT row_number() OVER (ORDER BY unique2) FROM tenk1 WHERE unique2 < 10; + +SELECT rank() OVER (PARTITION BY four ORDER BY ten) AS rank_1, ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT dense_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT percent_rank() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT cume_dist() OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT ntile(3) OVER (ORDER BY ten, four), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT ntile(NULL) OVER (ORDER BY ten, four), ten, four FROM tenk1 LIMIT 2; + +SELECT lag(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lag(ten, four) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lag(ten, four, 0) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lead(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lead(ten * 2, 1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT lead(ten * 2, 1, -1) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT first_value(ten) OVER (PARTITION BY four ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +-- last_value returns the last row of the frame, which is CURRENT ROW in ORDER BY window. +SELECT last_value(four) OVER (ORDER BY ten), ten, four FROM tenk1 WHERE unique2 < 10; + +SELECT last_value(ten) OVER (PARTITION BY four), ten, four FROM + (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s + ORDER BY four, ten; + +SELECT nth_value(ten, four + 1) OVER (PARTITION BY four), ten, four + FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten)s; + +SELECT ten, two, sum(hundred) AS gsum, sum(sum(hundred)) OVER (PARTITION BY two ORDER BY ten) AS wsum +FROM tenk1 GROUP BY ten, two; + +SELECT count(*) OVER (PARTITION BY four), four FROM (SELECT * FROM tenk1 WHERE two = 1)s WHERE unique2 < 10; + +SELECT (count(*) OVER (PARTITION BY four ORDER BY ten) + + sum(hundred) OVER (PARTITION BY four ORDER BY ten))::varchar AS cntsum + FROM tenk1 WHERE unique2 < 10; + +-- opexpr with different windows evaluation. +SELECT * FROM( + SELECT count(*) OVER (PARTITION BY four ORDER BY ten) + + sum(hundred) OVER (PARTITION BY two ORDER BY ten) AS total, + count(*) OVER (PARTITION BY four ORDER BY ten) AS fourcount, + sum(hundred) OVER (PARTITION BY two ORDER BY ten) AS twosum + FROM tenk1 +)sub +WHERE total <> fourcount + twosum; + +SELECT avg(four) OVER (PARTITION BY four ORDER BY thousand / 100) FROM tenk1 WHERE unique2 < 10; + +SELECT ten, two, sum(hundred) AS gsum, sum(sum(hundred)) OVER win AS wsum +FROM tenk1 GROUP BY ten, two WINDOW win AS (PARTITION BY two ORDER BY ten); + +-- more than one window with GROUP BY +SELECT sum(salary), + row_number() OVER (ORDER BY depname), + sum(sum(salary)) OVER (ORDER BY depname DESC) +FROM empsalary GROUP BY depname; + +-- identical windows with different names +SELECT sum(salary) OVER w1, count(*) OVER w2 +FROM empsalary WINDOW w1 AS (ORDER BY salary), w2 AS (ORDER BY salary); + +-- subplan +SELECT lead(ten, (SELECT two FROM tenk1 WHERE s.unique2 = unique2)) OVER (PARTITION BY four ORDER BY ten) +FROM tenk1 s WHERE unique2 < 10; + +-- empty table +SELECT count(*) OVER (PARTITION BY four) FROM (SELECT * FROM tenk1 WHERE FALSE)s; + +-- mixture of agg/wfunc in the same window +SELECT sum(salary) OVER w, rank() OVER w FROM empsalary WINDOW w AS (PARTITION BY depname ORDER BY salary DESC); + +-- strict aggs +SELECT empno, depname, salary, bonus, depadj, MIN(bonus) OVER (ORDER BY empno), MAX(depadj) OVER () FROM( + SELECT *, + CASE WHEN enroll_date < '2008-01-01' THEN 2008 - extract(YEAR FROM enroll_date) END * 500 AS bonus, + CASE WHEN + AVG(salary) OVER (PARTITION BY depname) < salary + THEN 200 END AS depadj FROM empsalary +)s; + +-- window function over ungrouped agg over empty row set (bug before 9.1) +SELECT SUM(COUNT(f1)) OVER () FROM int4_tbl WHERE f1=42; + +-- window function with ORDER BY an expression involving aggregates (9.1 bug) +select ten, + sum(unique1) + sum(unique2) as res, + rank() over (order by sum(unique1) + sum(unique2)) as rank +from tenk1 +group by ten order by ten; + +-- window and aggregate with GROUP BY expression (9.2 bug) +explain (costs off) +select first_value(max(x)) over (), y + from (select unique1 as x, ten+four as y from tenk1) ss + group by y; + +-- test non-default frame specifications +SELECT four, ten, + sum(ten) over (partition by four order by ten), + last_value(ten) over (partition by four order by ten) +FROM (select distinct ten, four from tenk1) ss; + +SELECT four, ten, + sum(ten) over (partition by four order by ten range between unbounded preceding and current row), + last_value(ten) over (partition by four order by ten range between unbounded preceding and current row) +FROM (select distinct ten, four from tenk1) ss; + +SELECT four, ten, + sum(ten) over (partition by four order by ten range between unbounded preceding and unbounded following), + last_value(ten) over (partition by four order by ten range between unbounded preceding and unbounded following) +FROM (select distinct ten, four from tenk1) ss; + +SELECT four, ten/4 as two, + sum(ten/4) over (partition by four order by ten/4 range between unbounded preceding and current row), + last_value(ten/4) over (partition by four order by ten/4 range between unbounded preceding and current row) +FROM (select distinct ten, four from tenk1) ss; + +SELECT four, ten/4 as two, + sum(ten/4) over (partition by four order by ten/4 rows between unbounded preceding and current row), + last_value(ten/4) over (partition by four order by ten/4 rows between unbounded preceding and current row) +FROM (select distinct ten, four from tenk1) ss; + +SELECT sum(unique1) over (order by four range between current row and unbounded following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between current row and unbounded following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between 2 preceding and 2 following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between 2 preceding and 2 following exclude no others), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between 2 preceding and 2 following exclude current row), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between 2 preceding and 2 following exclude group), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between 2 preceding and 2 following exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT first_value(unique1) over (ORDER BY four rows between current row and 2 following exclude current row), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT first_value(unique1) over (ORDER BY four rows between current row and 2 following exclude group), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT first_value(unique1) over (ORDER BY four rows between current row and 2 following exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT last_value(unique1) over (ORDER BY four rows between current row and 2 following exclude current row), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT last_value(unique1) over (ORDER BY four rows between current row and 2 following exclude group), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT last_value(unique1) over (ORDER BY four rows between current row and 2 following exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between 2 preceding and 1 preceding), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between 1 following and 3 following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (rows between unbounded preceding and 1 following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (w range between current row and unbounded following), + unique1, four +FROM tenk1 WHERE unique1 < 10 WINDOW w AS (order by four); + +SELECT sum(unique1) over (w range between unbounded preceding and current row exclude current row), + unique1, four +FROM tenk1 WHERE unique1 < 10 WINDOW w AS (order by four); + +SELECT sum(unique1) over (w range between unbounded preceding and current row exclude group), + unique1, four +FROM tenk1 WHERE unique1 < 10 WINDOW w AS (order by four); + +SELECT sum(unique1) over (w range between unbounded preceding and current row exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 10 WINDOW w AS (order by four); + +SELECT first_value(unique1) over w, + nth_value(unique1, 2) over w AS nth_2, + last_value(unique1) over w, unique1, four +FROM tenk1 WHERE unique1 < 10 +WINDOW w AS (order by four range between current row and unbounded following); + +SELECT sum(unique1) over + (order by unique1 + rows (SELECT unique1 FROM tenk1 ORDER BY unique1 LIMIT 1) + 1 PRECEDING), + unique1 +FROM tenk1 WHERE unique1 < 10; + +CREATE TEMP VIEW v_window AS + SELECT i, sum(i) over (order by i rows between 1 preceding and 1 following) as sum_rows + FROM generate_series(1, 10) i; + +SELECT * FROM v_window; + +SELECT pg_get_viewdef('v_window'); + +CREATE OR REPLACE TEMP VIEW v_window AS + SELECT i, sum(i) over (order by i rows between 1 preceding and 1 following + exclude current row) as sum_rows FROM generate_series(1, 10) i; + +SELECT * FROM v_window; + +SELECT pg_get_viewdef('v_window'); + +CREATE OR REPLACE TEMP VIEW v_window AS + SELECT i, sum(i) over (order by i rows between 1 preceding and 1 following + exclude group) as sum_rows FROM generate_series(1, 10) i; + +SELECT * FROM v_window; + +SELECT pg_get_viewdef('v_window'); + +CREATE OR REPLACE TEMP VIEW v_window AS + SELECT i, sum(i) over (order by i rows between 1 preceding and 1 following + exclude ties) as sum_rows FROM generate_series(1, 10) i; + +SELECT * FROM v_window; + +SELECT pg_get_viewdef('v_window'); + +CREATE OR REPLACE TEMP VIEW v_window AS + SELECT i, sum(i) over (order by i rows between 1 preceding and 1 following + exclude no others) as sum_rows FROM generate_series(1, 10) i; + +SELECT * FROM v_window; + +SELECT pg_get_viewdef('v_window'); + +CREATE OR REPLACE TEMP VIEW v_window AS + SELECT i, sum(i) over (order by i groups between 1 preceding and 1 following) as sum_rows FROM generate_series(1, 10) i; + +SELECT * FROM v_window; + +SELECT pg_get_viewdef('v_window'); + +DROP VIEW v_window; + +CREATE TEMP VIEW v_window AS + SELECT i, min(i) over (order by i range between '1 day' preceding and '10 days' following) as min_i + FROM generate_series(now(), now()+'100 days'::interval, '1 hour') i; + +SELECT pg_get_viewdef('v_window'); + +-- RANGE offset PRECEDING/FOLLOWING tests + +SELECT sum(unique1) over (order by four range between 2::int8 preceding and 1::int2 preceding), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four desc range between 2::int8 preceding and 1::int2 preceding), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four range between 2::int8 preceding and 1::int2 preceding exclude no others), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four range between 2::int8 preceding and 1::int2 preceding exclude current row), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four range between 2::int8 preceding and 1::int2 preceding exclude group), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four range between 2::int8 preceding and 1::int2 preceding exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four range between 2::int8 preceding and 6::int2 following exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four range between 2::int8 preceding and 6::int2 following exclude group), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (partition by four order by unique1 range between 5::int8 preceding and 6::int2 following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (partition by four order by unique1 range between 5::int8 preceding and 6::int2 following + exclude current row),unique1, four +FROM tenk1 WHERE unique1 < 10; + +select sum(salary) over (order by enroll_date range between '1 year'::interval preceding and '1 year'::interval following), + salary, enroll_date from empsalary; + +select sum(salary) over (order by enroll_date desc range between '1 year'::interval preceding and '1 year'::interval following), + salary, enroll_date from empsalary; + +select sum(salary) over (order by enroll_date desc range between '1 year'::interval following and '1 year'::interval following), + salary, enroll_date from empsalary; + +select sum(salary) over (order by enroll_date range between '1 year'::interval preceding and '1 year'::interval following + exclude current row), salary, enroll_date from empsalary; + +select sum(salary) over (order by enroll_date range between '1 year'::interval preceding and '1 year'::interval following + exclude group), salary, enroll_date from empsalary; + +select sum(salary) over (order by enroll_date range between '1 year'::interval preceding and '1 year'::interval following + exclude ties), salary, enroll_date from empsalary; + +select first_value(salary) over(order by salary range between 1000 preceding and 1000 following), + lead(salary) over(order by salary range between 1000 preceding and 1000 following), + nth_value(salary, 1) over(order by salary range between 1000 preceding and 1000 following), + salary from empsalary; + +select last_value(salary) over(order by salary range between 1000 preceding and 1000 following), + lag(salary) over(order by salary range between 1000 preceding and 1000 following), + salary from empsalary; + +select first_value(salary) over(order by salary range between 1000 following and 3000 following + exclude current row), + lead(salary) over(order by salary range between 1000 following and 3000 following exclude ties), + nth_value(salary, 1) over(order by salary range between 1000 following and 3000 following + exclude ties), + salary from empsalary; + +select last_value(salary) over(order by salary range between 1000 following and 3000 following + exclude group), + lag(salary) over(order by salary range between 1000 following and 3000 following exclude group), + salary from empsalary; + +select first_value(salary) over(order by enroll_date range between unbounded preceding and '1 year'::interval following + exclude ties), + last_value(salary) over(order by enroll_date range between unbounded preceding and '1 year'::interval following), + salary, enroll_date from empsalary; + +select first_value(salary) over(order by enroll_date range between unbounded preceding and '1 year'::interval following + exclude ties), + last_value(salary) over(order by enroll_date range between unbounded preceding and '1 year'::interval following + exclude ties), + salary, enroll_date from empsalary; + +select first_value(salary) over(order by enroll_date range between unbounded preceding and '1 year'::interval following + exclude group), + last_value(salary) over(order by enroll_date range between unbounded preceding and '1 year'::interval following + exclude group), + salary, enroll_date from empsalary; + +select first_value(salary) over(order by enroll_date range between unbounded preceding and '1 year'::interval following + exclude current row), + last_value(salary) over(order by enroll_date range between unbounded preceding and '1 year'::interval following + exclude current row), + salary, enroll_date from empsalary; + +-- RANGE offset PRECEDING/FOLLOWING with null values +select x, y, + first_value(y) over w, + last_value(y) over w +from + (select x, x as y from generate_series(1,5) as x + union all select null, 42 + union all select null, 43) ss +window w as + (order by x asc nulls first range between 2 preceding and 2 following); + +select x, y, + first_value(y) over w, + last_value(y) over w +from + (select x, x as y from generate_series(1,5) as x + union all select null, 42 + union all select null, 43) ss +window w as + (order by x asc nulls last range between 2 preceding and 2 following); + +select x, y, + first_value(y) over w, + last_value(y) over w +from + (select x, x as y from generate_series(1,5) as x + union all select null, 42 + union all select null, 43) ss +window w as + (order by x desc nulls first range between 2 preceding and 2 following); + +select x, y, + first_value(y) over w, + last_value(y) over w +from + (select x, x as y from generate_series(1,5) as x + union all select null, 42 + union all select null, 43) ss +window w as + (order by x desc nulls last range between 2 preceding and 2 following); + +-- Check overflow behavior for various integer sizes + +select x, last_value(x) over (order by x::smallint range between current row and 2147450884 following) +from generate_series(32764, 32766) x; + +select x, last_value(x) over (order by x::smallint desc range between current row and 2147450885 following) +from generate_series(-32766, -32764) x; + +select x, last_value(x) over (order by x range between current row and 4 following) +from generate_series(2147483644, 2147483646) x; + +select x, last_value(x) over (order by x desc range between current row and 5 following) +from generate_series(-2147483646, -2147483644) x; + +select x, last_value(x) over (order by x range between current row and 4 following) +from generate_series(9223372036854775804, 9223372036854775806) x; + +select x, last_value(x) over (order by x desc range between current row and 5 following) +from generate_series(-9223372036854775806, -9223372036854775804) x; + +-- Test in_range for other numeric datatypes + +create temp table numerics( + id int, + f_float4 float4, + f_float8 float8, + f_numeric numeric +); + +insert into numerics values +(0, '-infinity', '-infinity', '-infinity'), +(1, -3, -3, -3), +(2, -1, -1, -1), +(3, 0, 0, 0), +(4, 1.1, 1.1, 1.1), +(5, 1.12, 1.12, 1.12), +(6, 2, 2, 2), +(7, 100, 100, 100), +(8, 'infinity', 'infinity', 'infinity'), +(9, 'NaN', 'NaN', 'NaN'); + +select id, f_float4, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float4 range between + 1 preceding and 1 following); +select id, f_float4, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float4 range between + 1 preceding and 1.1::float4 following); +select id, f_float4, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float4 range between + 'inf' preceding and 'inf' following); +select id, f_float4, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float4 range between + 'inf' preceding and 'inf' preceding); +select id, f_float4, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float4 range between + 'inf' following and 'inf' following); +select id, f_float4, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float4 range between + 1.1 preceding and 'NaN' following); -- error, NaN disallowed + +select id, f_float8, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float8 range between + 1 preceding and 1 following); +select id, f_float8, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float8 range between + 1 preceding and 1.1::float8 following); +select id, f_float8, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float8 range between + 'inf' preceding and 'inf' following); +select id, f_float8, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float8 range between + 'inf' preceding and 'inf' preceding); +select id, f_float8, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float8 range between + 'inf' following and 'inf' following); +select id, f_float8, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_float8 range between + 1.1 preceding and 'NaN' following); -- error, NaN disallowed + +select id, f_numeric, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_numeric range between + 1 preceding and 1 following); +select id, f_numeric, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_numeric range between + 1 preceding and 1.1::numeric following); +select id, f_numeric, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_numeric range between + 1 preceding and 1.1::float8 following); -- currently unsupported +select id, f_numeric, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_numeric range between + 'inf' preceding and 'inf' following); +select id, f_numeric, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_numeric range between + 'inf' preceding and 'inf' preceding); +select id, f_numeric, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_numeric range between + 'inf' following and 'inf' following); +select id, f_numeric, first_value(id) over w, last_value(id) over w +from numerics +window w as (order by f_numeric range between + 1.1 preceding and 'NaN' following); -- error, NaN disallowed + +-- Test in_range for other datetime datatypes + +create temp table datetimes( + id int, + f_time time, + f_timetz timetz, + f_interval interval, + f_timestamptz timestamptz, + f_timestamp timestamp +); + +insert into datetimes values +(1, '11:00', '11:00 BST', '1 year', '2000-10-19 10:23:54+01', '2000-10-19 10:23:54'), +(2, '12:00', '12:00 BST', '2 years', '2001-10-19 10:23:54+01', '2001-10-19 10:23:54'), +(3, '13:00', '13:00 BST', '3 years', '2001-10-19 10:23:54+01', '2001-10-19 10:23:54'), +(4, '14:00', '14:00 BST', '4 years', '2002-10-19 10:23:54+01', '2002-10-19 10:23:54'), +(5, '15:00', '15:00 BST', '5 years', '2003-10-19 10:23:54+01', '2003-10-19 10:23:54'), +(6, '15:00', '15:00 BST', '5 years', '2004-10-19 10:23:54+01', '2004-10-19 10:23:54'), +(7, '17:00', '17:00 BST', '7 years', '2005-10-19 10:23:54+01', '2005-10-19 10:23:54'), +(8, '18:00', '18:00 BST', '8 years', '2006-10-19 10:23:54+01', '2006-10-19 10:23:54'), +(9, '19:00', '19:00 BST', '9 years', '2007-10-19 10:23:54+01', '2007-10-19 10:23:54'), +(10, '20:00', '20:00 BST', '10 years', '2008-10-19 10:23:54+01', '2008-10-19 10:23:54'); + +select id, f_time, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_time range between + '70 min'::interval preceding and '2 hours'::interval following); + +select id, f_time, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_time desc range between + '70 min' preceding and '2 hours' following); + +select id, f_timetz, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_timetz range between + '70 min'::interval preceding and '2 hours'::interval following); + +select id, f_timetz, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_timetz desc range between + '70 min' preceding and '2 hours' following); + +select id, f_interval, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_interval range between + '1 year'::interval preceding and '1 year'::interval following); + +select id, f_interval, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_interval desc range between + '1 year' preceding and '1 year' following); + +select id, f_timestamptz, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_timestamptz range between + '1 year'::interval preceding and '1 year'::interval following); + +select id, f_timestamptz, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_timestamptz desc range between + '1 year' preceding and '1 year' following); + +select id, f_timestamp, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_timestamp range between + '1 year'::interval preceding and '1 year'::interval following); + +select id, f_timestamp, first_value(id) over w, last_value(id) over w +from datetimes +window w as (order by f_timestamp desc range between + '1 year' preceding and '1 year' following); + +-- RANGE offset PRECEDING/FOLLOWING error cases +select sum(salary) over (order by enroll_date, salary range between '1 year'::interval preceding and '2 years'::interval following + exclude ties), salary, enroll_date from empsalary; + +select sum(salary) over (range between '1 year'::interval preceding and '2 years'::interval following + exclude ties), salary, enroll_date from empsalary; + +select sum(salary) over (order by depname range between '1 year'::interval preceding and '2 years'::interval following + exclude ties), salary, enroll_date from empsalary; + +select max(enroll_date) over (order by enroll_date range between 1 preceding and 2 following + exclude ties), salary, enroll_date from empsalary; + +select max(enroll_date) over (order by salary range between -1 preceding and 2 following + exclude ties), salary, enroll_date from empsalary; + +select max(enroll_date) over (order by salary range between 1 preceding and -2 following + exclude ties), salary, enroll_date from empsalary; + +select max(enroll_date) over (order by salary range between '1 year'::interval preceding and '2 years'::interval following + exclude ties), salary, enroll_date from empsalary; + +select max(enroll_date) over (order by enroll_date range between '1 year'::interval preceding and '-2 years'::interval following + exclude ties), salary, enroll_date from empsalary; + +-- GROUPS tests + +SELECT sum(unique1) over (order by four groups between unbounded preceding and current row), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between unbounded preceding and unbounded following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between current row and unbounded following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between 1 preceding and unbounded following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between 1 following and unbounded following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between unbounded preceding and 2 following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between 2 preceding and 1 preceding), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between 2 preceding and 1 following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between 0 preceding and 0 following), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between 2 preceding and 1 following + exclude current row), unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between 2 preceding and 1 following + exclude group), unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (order by four groups between 2 preceding and 1 following + exclude ties), unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (partition by ten + order by four groups between 0 preceding and 0 following),unique1, four, ten +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (partition by ten + order by four groups between 0 preceding and 0 following exclude current row), unique1, four, ten +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (partition by ten + order by four groups between 0 preceding and 0 following exclude group), unique1, four, ten +FROM tenk1 WHERE unique1 < 10; + +SELECT sum(unique1) over (partition by ten + order by four groups between 0 preceding and 0 following exclude ties), unique1, four, ten +FROM tenk1 WHERE unique1 < 10; + +select first_value(salary) over(order by enroll_date groups between 1 preceding and 1 following), + lead(salary) over(order by enroll_date groups between 1 preceding and 1 following), + nth_value(salary, 1) over(order by enroll_date groups between 1 preceding and 1 following), + salary, enroll_date from empsalary; + +select last_value(salary) over(order by enroll_date groups between 1 preceding and 1 following), + lag(salary) over(order by enroll_date groups between 1 preceding and 1 following), + salary, enroll_date from empsalary; + +select first_value(salary) over(order by enroll_date groups between 1 following and 3 following + exclude current row), + lead(salary) over(order by enroll_date groups between 1 following and 3 following exclude ties), + nth_value(salary, 1) over(order by enroll_date groups between 1 following and 3 following + exclude ties), + salary, enroll_date from empsalary; + +select last_value(salary) over(order by enroll_date groups between 1 following and 3 following + exclude group), + lag(salary) over(order by enroll_date groups between 1 following and 3 following exclude group), + salary, enroll_date from empsalary; + +-- Show differences in offset interpretation between ROWS, RANGE, and GROUPS +WITH cte (x) AS ( + SELECT * FROM generate_series(1, 35, 2) +) +SELECT x, (sum(x) over w) +FROM cte +WINDOW w AS (ORDER BY x rows between 1 preceding and 1 following); + +WITH cte (x) AS ( + SELECT * FROM generate_series(1, 35, 2) +) +SELECT x, (sum(x) over w) +FROM cte +WINDOW w AS (ORDER BY x range between 1 preceding and 1 following); + +WITH cte (x) AS ( + SELECT * FROM generate_series(1, 35, 2) +) +SELECT x, (sum(x) over w) +FROM cte +WINDOW w AS (ORDER BY x groups between 1 preceding and 1 following); + +WITH cte (x) AS ( + select 1 union all select 1 union all select 1 union all + SELECT * FROM generate_series(5, 49, 2) +) +SELECT x, (sum(x) over w) +FROM cte +WINDOW w AS (ORDER BY x rows between 1 preceding and 1 following); + +WITH cte (x) AS ( + select 1 union all select 1 union all select 1 union all + SELECT * FROM generate_series(5, 49, 2) +) +SELECT x, (sum(x) over w) +FROM cte +WINDOW w AS (ORDER BY x range between 1 preceding and 1 following); + +WITH cte (x) AS ( + select 1 union all select 1 union all select 1 union all + SELECT * FROM generate_series(5, 49, 2) +) +SELECT x, (sum(x) over w) +FROM cte +WINDOW w AS (ORDER BY x groups between 1 preceding and 1 following); + +-- with UNION +SELECT count(*) OVER (PARTITION BY four) FROM (SELECT * FROM tenk1 UNION ALL SELECT * FROM tenk2)s LIMIT 0; + +-- check some degenerate cases +create temp table t1 (f1 int, f2 int8); +insert into t1 values (1,1),(1,2),(2,2); + +select f1, sum(f1) over (partition by f1 + range between 1 preceding and 1 following) +from t1 where f1 = f2; -- error, must have order by +explain (costs off) +select f1, sum(f1) over (partition by f1 order by f2 + range between 1 preceding and 1 following) +from t1 where f1 = f2; +select f1, sum(f1) over (partition by f1 order by f2 + range between 1 preceding and 1 following) +from t1 where f1 = f2; +select f1, sum(f1) over (partition by f1, f1 order by f2 + range between 2 preceding and 1 preceding) +from t1 where f1 = f2; +select f1, sum(f1) over (partition by f1, f2 order by f2 + range between 1 following and 2 following) +from t1 where f1 = f2; + +select f1, sum(f1) over (partition by f1 + groups between 1 preceding and 1 following) +from t1 where f1 = f2; -- error, must have order by +explain (costs off) +select f1, sum(f1) over (partition by f1 order by f2 + groups between 1 preceding and 1 following) +from t1 where f1 = f2; +select f1, sum(f1) over (partition by f1 order by f2 + groups between 1 preceding and 1 following) +from t1 where f1 = f2; +select f1, sum(f1) over (partition by f1, f1 order by f2 + groups between 2 preceding and 1 preceding) +from t1 where f1 = f2; +select f1, sum(f1) over (partition by f1, f2 order by f2 + groups between 1 following and 2 following) +from t1 where f1 = f2; + +-- ordering by a non-integer constant is allowed +SELECT rank() OVER (ORDER BY length('abc')); + +-- can't order by another window function +SELECT rank() OVER (ORDER BY rank() OVER (ORDER BY random())); + +-- some other errors +SELECT * FROM empsalary WHERE row_number() OVER (ORDER BY salary) < 10; + +SELECT * FROM empsalary INNER JOIN tenk1 ON row_number() OVER (ORDER BY salary) < 10; + +SELECT rank() OVER (ORDER BY 1), count(*) FROM empsalary GROUP BY 1; + +--SELECT * FROM rank() OVER (ORDER BY random()); + +DELETE FROM empsalary WHERE (rank() OVER (ORDER BY random())) > 10; + +DELETE FROM empsalary RETURNING rank() OVER (ORDER BY random()); + +SELECT count(*) OVER w FROM tenk1 WINDOW w AS (ORDER BY unique1), w AS (ORDER BY unique1); + +--SELECT rank() OVER (PARTITION BY four, ORDER BY ten) FROM tenk1; + +SELECT count() OVER () FROM tenk1; + +SELECT generate_series(1, 100) OVER () FROM empsalary; + +SELECT ntile(0) OVER (ORDER BY ten), ten, four FROM tenk1; + +SELECT nth_value(four, 0) OVER (ORDER BY ten), ten, four FROM tenk1; + +-- filter + +SELECT sum(salary), row_number() OVER (ORDER BY depname), sum( + sum(salary) FILTER (WHERE enroll_date > '2007-01-01') +) FILTER (WHERE depname <> 'sales') OVER (ORDER BY depname DESC) AS "filtered_sum", + depname +FROM empsalary GROUP BY depname; + +-- Test pushdown of quals into a subquery containing window functions + +-- pushdown is safe because all PARTITION BY clauses include depname: +EXPLAIN (COSTS OFF) +SELECT * FROM + (SELECT depname, + sum(salary) OVER (PARTITION BY depname) depsalary, + min(salary) OVER (PARTITION BY depname || 'A', depname) depminsalary + FROM empsalary) emp +WHERE depname = 'sales'; + +-- pushdown is unsafe because there's a PARTITION BY clause without depname: +EXPLAIN (COSTS OFF) +SELECT * FROM + (SELECT depname, + sum(salary) OVER (PARTITION BY enroll_date) enroll_salary, + min(salary) OVER (PARTITION BY depname) depminsalary + FROM empsalary) emp +WHERE depname = 'sales'; + +-- Test Sort node collapsing +EXPLAIN (COSTS OFF) +SELECT * FROM + (SELECT depname, + sum(salary) OVER (PARTITION BY depname order by empno) depsalary, + min(salary) OVER (PARTITION BY depname, empno order by enroll_date) depminsalary + FROM empsalary) emp +WHERE depname = 'sales'; + +-- Test Sort node reordering +EXPLAIN (COSTS OFF) +SELECT + lead(1) OVER (PARTITION BY depname ORDER BY salary, enroll_date), + lag(1) OVER (PARTITION BY depname ORDER BY salary,enroll_date,empno) +FROM empsalary; + +-- cleanup +DROP TABLE empsalary; + +-- test user-defined window function with named args and default args +CREATE FUNCTION nth_value_def(val anyelement, n integer = 1) RETURNS anyelement + LANGUAGE internal WINDOW IMMUTABLE STRICT AS 'window_nth_value'; + +SELECT nth_value_def(n := 2, val := ten) OVER (PARTITION BY four), ten, four + FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten) s; + +SELECT nth_value_def(ten) OVER (PARTITION BY four), ten, four + FROM (SELECT * FROM tenk1 WHERE unique2 < 10 ORDER BY four, ten) s; + +-- +-- Test the basic moving-aggregate machinery +-- + +-- create aggregates that record the series of transform calls (these are +-- intentionally not true inverses) + +CREATE FUNCTION logging_sfunc_nonstrict(text, anyelement) RETURNS text AS +$$ SELECT COALESCE($1, '') || '*' || quote_nullable($2) $$ +LANGUAGE SQL IMMUTABLE; + +CREATE FUNCTION logging_msfunc_nonstrict(text, anyelement) RETURNS text AS +$$ SELECT COALESCE($1, '') || '+' || quote_nullable($2) $$ +LANGUAGE SQL IMMUTABLE; + +CREATE FUNCTION logging_minvfunc_nonstrict(text, anyelement) RETURNS text AS +$$ SELECT $1 || '-' || quote_nullable($2) $$ +LANGUAGE SQL IMMUTABLE; + +CREATE AGGREGATE logging_agg_nonstrict (anyelement) +( + stype = text, + sfunc = logging_sfunc_nonstrict, + mstype = text, + msfunc = logging_msfunc_nonstrict, + minvfunc = logging_minvfunc_nonstrict +); + +CREATE AGGREGATE logging_agg_nonstrict_initcond (anyelement) +( + stype = text, + sfunc = logging_sfunc_nonstrict, + mstype = text, + msfunc = logging_msfunc_nonstrict, + minvfunc = logging_minvfunc_nonstrict, + initcond = 'I', + minitcond = 'MI' +); + +CREATE FUNCTION logging_sfunc_strict(text, anyelement) RETURNS text AS +$$ SELECT $1 || '*' || quote_nullable($2) $$ +LANGUAGE SQL STRICT IMMUTABLE; + +CREATE FUNCTION logging_msfunc_strict(text, anyelement) RETURNS text AS +$$ SELECT $1 || '+' || quote_nullable($2) $$ +LANGUAGE SQL STRICT IMMUTABLE; + +CREATE FUNCTION logging_minvfunc_strict(text, anyelement) RETURNS text AS +$$ SELECT $1 || '-' || quote_nullable($2) $$ +LANGUAGE SQL STRICT IMMUTABLE; + +CREATE AGGREGATE logging_agg_strict (text) +( + stype = text, + sfunc = logging_sfunc_strict, + mstype = text, + msfunc = logging_msfunc_strict, + minvfunc = logging_minvfunc_strict +); + +CREATE AGGREGATE logging_agg_strict_initcond (anyelement) +( + stype = text, + sfunc = logging_sfunc_strict, + mstype = text, + msfunc = logging_msfunc_strict, + minvfunc = logging_minvfunc_strict, + initcond = 'I', + minitcond = 'MI' +); + +-- test strict and non-strict cases +SELECT + p::text || ',' || i::text || ':' || COALESCE(v::text, 'NULL') AS row, + logging_agg_nonstrict(v) over wnd as nstrict, + logging_agg_nonstrict_initcond(v) over wnd as nstrict_init, + logging_agg_strict(v::text) over wnd as strict, + logging_agg_strict_initcond(v) over wnd as strict_init +FROM (VALUES + (1, 1, NULL), + (1, 2, 'a'), + (1, 3, 'b'), + (1, 4, NULL), + (1, 5, NULL), + (1, 6, 'c'), + (2, 1, NULL), + (2, 2, 'x'), + (3, 1, 'z') +) AS t(p, i, v) +WINDOW wnd AS (PARTITION BY P ORDER BY i ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) +ORDER BY p, i; + +-- and again, but with filter +SELECT + p::text || ',' || i::text || ':' || + CASE WHEN f THEN COALESCE(v::text, 'NULL') ELSE '-' END as row, + logging_agg_nonstrict(v) filter(where f) over wnd as nstrict_filt, + logging_agg_nonstrict_initcond(v) filter(where f) over wnd as nstrict_init_filt, + logging_agg_strict(v::text) filter(where f) over wnd as strict_filt, + logging_agg_strict_initcond(v) filter(where f) over wnd as strict_init_filt +FROM (VALUES + (1, 1, true, NULL), + (1, 2, false, 'a'), + (1, 3, true, 'b'), + (1, 4, false, NULL), + (1, 5, false, NULL), + (1, 6, false, 'c'), + (2, 1, false, NULL), + (2, 2, true, 'x'), + (3, 1, true, 'z') +) AS t(p, i, f, v) +WINDOW wnd AS (PARTITION BY p ORDER BY i ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) +ORDER BY p, i; + +-- test that volatile arguments disable moving-aggregate mode +SELECT + i::text || ':' || COALESCE(v::text, 'NULL') as row, + logging_agg_strict(v::text) + over wnd as inverse, + logging_agg_strict(v::text || CASE WHEN random() < 0 then '?' ELSE '' END) + over wnd as noinverse +FROM (VALUES + (1, 'a'), + (2, 'b'), + (3, 'c') +) AS t(i, v) +WINDOW wnd AS (ORDER BY i ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) +ORDER BY i; + +SELECT + i::text || ':' || COALESCE(v::text, 'NULL') as row, + logging_agg_strict(v::text) filter(where true) + over wnd as inverse, + logging_agg_strict(v::text) filter(where random() >= 0) + over wnd as noinverse +FROM (VALUES + (1, 'a'), + (2, 'b'), + (3, 'c') +) AS t(i, v) +WINDOW wnd AS (ORDER BY i ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) +ORDER BY i; + +-- test that non-overlapping windows don't use inverse transitions +SELECT + logging_agg_strict(v::text) OVER wnd +FROM (VALUES + (1, 'a'), + (2, 'b'), + (3, 'c') +) AS t(i, v) +WINDOW wnd AS (ORDER BY i ROWS BETWEEN CURRENT ROW AND CURRENT ROW) +ORDER BY i; + +-- test that returning NULL from the inverse transition functions +-- restarts the aggregation from scratch. The second aggregate is supposed +-- to test cases where only some aggregates restart, the third one checks +-- that one aggregate restarting doesn't cause others to restart. + +CREATE FUNCTION sum_int_randrestart_minvfunc(int4, int4) RETURNS int4 AS +$$ SELECT CASE WHEN random() < 0.2 THEN NULL ELSE $1 - $2 END $$ +LANGUAGE SQL STRICT; + +CREATE AGGREGATE sum_int_randomrestart (int4) +( + stype = int4, + sfunc = int4pl, + mstype = int4, + msfunc = int4pl, + minvfunc = sum_int_randrestart_minvfunc +); + +WITH +vs AS ( + SELECT i, (random() * 100)::int4 AS v + FROM generate_series(1, 100) AS i +), +sum_following AS ( + SELECT i, SUM(v) OVER + (ORDER BY i DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS s + FROM vs +) +SELECT DISTINCT + sum_following.s = sum_int_randomrestart(v) OVER fwd AS eq1, + -sum_following.s = sum_int_randomrestart(-v) OVER fwd AS eq2, + 100*3+(vs.i-1)*3 = length(logging_agg_nonstrict(''::text) OVER fwd) AS eq3 +FROM vs +JOIN sum_following ON sum_following.i = vs.i +WINDOW fwd AS ( + ORDER BY vs.i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING +); + +-- +-- Test various built-in aggregates that have moving-aggregate support +-- + +-- test inverse transition functions handle NULLs properly +SELECT i,AVG(v::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,AVG(v::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,AVG(v::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,AVG(v::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1.5),(2,2.5),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,AVG(v::interval) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,'1 sec'),(2,'2 sec'),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,SUM(v::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,SUM(v::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,SUM(v::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,SUM(v::money) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,'1.10'),(2,'2.20'),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,SUM(v::interval) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,'1 sec'),(2,'2 sec'),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,SUM(v::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1.1),(2,2.2),(3,NULL),(4,NULL)) t(i,v); + +SELECT SUM(n::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1.01),(2,2),(3,3)) v(i,n); + +SELECT i,COUNT(v) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,COUNT(*) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT VAR_POP(n::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VAR_POP(n::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VAR_POP(n::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VAR_POP(n::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VAR_SAMP(n::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VAR_SAMP(n::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VAR_SAMP(n::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VAR_SAMP(n::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VARIANCE(n::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VARIANCE(n::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VARIANCE(n::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT VARIANCE(n::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT STDDEV_POP(n::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,NULL),(2,600),(3,470),(4,170),(5,430),(6,300)) r(i,n); + +SELECT STDDEV_POP(n::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,NULL),(2,600),(3,470),(4,170),(5,430),(6,300)) r(i,n); + +SELECT STDDEV_POP(n::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,NULL),(2,600),(3,470),(4,170),(5,430),(6,300)) r(i,n); + +SELECT STDDEV_POP(n::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,NULL),(2,600),(3,470),(4,170),(5,430),(6,300)) r(i,n); + +SELECT STDDEV_SAMP(n::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,NULL),(2,600),(3,470),(4,170),(5,430),(6,300)) r(i,n); + +SELECT STDDEV_SAMP(n::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,NULL),(2,600),(3,470),(4,170),(5,430),(6,300)) r(i,n); + +SELECT STDDEV_SAMP(n::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,NULL),(2,600),(3,470),(4,170),(5,430),(6,300)) r(i,n); + +SELECT STDDEV_SAMP(n::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(1,NULL),(2,600),(3,470),(4,170),(5,430),(6,300)) r(i,n); + +SELECT STDDEV(n::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(0,NULL),(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT STDDEV(n::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(0,NULL),(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT STDDEV(n::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(0,NULL),(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +SELECT STDDEV(n::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) + FROM (VALUES(0,NULL),(1,600),(2,470),(3,170),(4,430),(5,300)) r(i,n); + +-- test that inverse transition functions work with various frame options +SELECT i,SUM(v::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND CURRENT ROW) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,SUM(v::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v); + +SELECT i,SUM(v::int) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) + FROM (VALUES(1,1),(2,2),(3,3),(4,4)) t(i,v); + +-- ensure aggregate over numeric properly recovers from NaN values +SELECT a, b, + SUM(b) OVER(ORDER BY A ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) +FROM (VALUES(1,1::numeric),(2,2),(3,'NaN'),(4,3),(5,4)) t(a,b); + +-- It might be tempting for someone to add an inverse trans function for +-- float and double precision. This should not be done as it can give incorrect +-- results. This test should fail if anyone ever does this without thinking too +-- hard about it. +SELECT to_char(SUM(n::float8) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING),'999999999999999999999D9') + FROM (VALUES(1,1e20),(2,1)) n(i,n); + +SELECT i, b, bool_and(b) OVER w, bool_or(b) OVER w + FROM (VALUES (1,true), (2,true), (3,false), (4,false), (5,true)) v(i,b) + WINDOW w AS (ORDER BY i ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING); + +-- Tests for problems with failure to walk or mutate expressions +-- within window frame clauses. + +-- test walker (fails with collation error if expressions are not walked) +SELECT array_agg(i) OVER w + FROM generate_series(1,5) i +WINDOW w AS (ORDER BY i ROWS BETWEEN (('foo' < 'foobar')::integer) PRECEDING AND CURRENT ROW); + +-- test mutator (fails when inlined if expressions are not mutated) +CREATE FUNCTION pg_temp.f(group_size BIGINT) RETURNS SETOF integer[] +AS $$ + SELECT array_agg(s) OVER w + FROM generate_series(1,5) s + WINDOW w AS (ORDER BY s ROWS BETWEEN CURRENT ROW AND GROUP_SIZE FOLLOWING) +$$ LANGUAGE SQL STABLE; + +EXPLAIN (costs off) SELECT * FROM pg_temp.f(2); +SELECT * FROM pg_temp.f(2); diff --git a/postgresql/examples/with.sql b/postgresql/examples/with.sql new file mode 100644 index 0000000..213c19e --- /dev/null +++ b/postgresql/examples/with.sql @@ -0,0 +1,1041 @@ +-- +-- Tests for common table expressions (WITH query, ... SELECT ...) +-- + +-- Basic WITH +WITH q1(x,y) AS (SELECT 1,2) +SELECT * FROM q1, q1 AS q2; + +-- Multiple uses are evaluated only once +SELECT count(*) FROM ( + WITH q1(x) AS (SELECT random() FROM generate_series(1, 5)) + SELECT * FROM q1 + UNION + SELECT * FROM q1 +) ss; + +-- WITH RECURSIVE + +-- sum of 1..100 +WITH RECURSIVE t(n) AS ( + VALUES (1) +UNION ALL + SELECT n+1 FROM t WHERE n < 100 +) +SELECT sum(n) FROM t; + +WITH RECURSIVE t(n) AS ( + SELECT (VALUES(1)) +UNION ALL + SELECT n+1 FROM t WHERE n < 5 +) +SELECT * FROM t; + +-- recursive view +CREATE RECURSIVE VIEW nums (n) AS + VALUES (1) +UNION ALL + SELECT n+1 FROM nums WHERE n < 5; + +SELECT * FROM nums; + +CREATE OR REPLACE RECURSIVE VIEW nums (n) AS + VALUES (1) +UNION ALL + SELECT n+1 FROM nums WHERE n < 6; + +SELECT * FROM nums; + +-- This is an infinite loop with UNION ALL, but not with UNION +WITH RECURSIVE t(n) AS ( + SELECT 1 +UNION + SELECT 10-n FROM t) +SELECT * FROM t; + +-- This'd be an infinite loop, but outside query reads only as much as needed +WITH RECURSIVE t(n) AS ( + VALUES (1) +UNION ALL + SELECT n+1 FROM t) +SELECT * FROM t LIMIT 10; + +-- UNION case should have same property +WITH RECURSIVE t(n) AS ( + SELECT 1 +UNION + SELECT n+1 FROM t) +SELECT * FROM t LIMIT 10; + +-- Test behavior with an unknown-type literal in the WITH +WITH q AS (SELECT 'foo' AS x) +SELECT x, x IS OF (text) AS is_text FROM q; + +WITH RECURSIVE t(n) AS ( + SELECT 'foo' +UNION ALL + SELECT n || ' bar' FROM t WHERE length(n) < 20 +) +SELECT n, n IS OF (text) AS is_text FROM t; + +-- In a perfect world, this would work and resolve the literal as int ... +-- but for now, we have to be content with resolving to text too soon. +WITH RECURSIVE t(n) AS ( + SELECT '7' +UNION ALL + SELECT n+1 FROM t WHERE n < 10 +) +SELECT n, n IS OF (int) AS is_int FROM t; + +-- +-- Some examples with a tree +-- +-- department structure represented here is as follows: +-- +-- ROOT-+->A-+->B-+->C +-- | | +-- | +->D-+->F +-- +->E-+->G + +CREATE TEMP TABLE department ( + id INTEGER PRIMARY KEY, -- department ID + parent_department INTEGER REFERENCES department, -- upper department ID + name TEXT -- department name +); + +INSERT INTO department VALUES (0, NULL, 'ROOT'); +INSERT INTO department VALUES (1, 0, 'A'); +INSERT INTO department VALUES (2, 1, 'B'); +INSERT INTO department VALUES (3, 2, 'C'); +INSERT INTO department VALUES (4, 2, 'D'); +INSERT INTO department VALUES (5, 0, 'E'); +INSERT INTO department VALUES (6, 4, 'F'); +INSERT INTO department VALUES (7, 5, 'G'); + + +-- extract all departments under 'A'. Result should be A, B, C, D and F +WITH RECURSIVE subdepartment AS +( + -- non recursive term + SELECT name as root_name, * FROM department WHERE name = 'A' + + UNION ALL + + -- recursive term + SELECT sd.root_name, d.* FROM department AS d, subdepartment AS sd + WHERE d.parent_department = sd.id +) +SELECT * FROM subdepartment ORDER BY name; + +-- extract all departments under 'A' with "level" number +WITH RECURSIVE subdepartment(level, id, parent_department, name) AS +( + -- non recursive term + SELECT 1, * FROM department WHERE name = 'A' + + UNION ALL + + -- recursive term + SELECT sd.level + 1, d.* FROM department AS d, subdepartment AS sd + WHERE d.parent_department = sd.id +) +SELECT * FROM subdepartment ORDER BY name; + +-- extract all departments under 'A' with "level" number. +-- Only shows level 2 or more +WITH RECURSIVE subdepartment(level, id, parent_department, name) AS +( + -- non recursive term + SELECT 1, * FROM department WHERE name = 'A' + + UNION ALL + + -- recursive term + SELECT sd.level + 1, d.* FROM department AS d, subdepartment AS sd + WHERE d.parent_department = sd.id +) +SELECT * FROM subdepartment WHERE level >= 2 ORDER BY name; + +-- "RECURSIVE" is ignored if the query has no self-reference +WITH RECURSIVE subdepartment AS +( + -- note lack of recursive UNION structure + SELECT * FROM department WHERE name = 'A' +) +SELECT * FROM subdepartment ORDER BY name; + +-- inside subqueries +SELECT count(*) FROM ( + WITH RECURSIVE t(n) AS ( + SELECT 1 UNION ALL SELECT n + 1 FROM t WHERE n < 500 + ) + SELECT * FROM t) AS t WHERE n < ( + SELECT count(*) FROM ( + WITH RECURSIVE t(n) AS ( + SELECT 1 UNION ALL SELECT n + 1 FROM t WHERE n < 100 + ) + SELECT * FROM t WHERE n < 50000 + ) AS t WHERE n < 100); + +-- use same CTE twice at different subquery levels +WITH q1(x,y) AS ( + SELECT hundred, sum(ten) FROM tenk1 GROUP BY hundred + ) +SELECT count(*) FROM q1 WHERE y > (SELECT sum(y)/100 FROM q1 qsub); + +-- via a VIEW +CREATE TEMPORARY VIEW vsubdepartment AS + WITH RECURSIVE subdepartment AS + ( + -- non recursive term + SELECT * FROM department WHERE name = 'A' + UNION ALL + -- recursive term + SELECT d.* FROM department AS d, subdepartment AS sd + WHERE d.parent_department = sd.id + ) + SELECT * FROM subdepartment; + +SELECT * FROM vsubdepartment ORDER BY name; + +-- Check reverse listing +SELECT pg_get_viewdef('vsubdepartment'::regclass); +SELECT pg_get_viewdef('vsubdepartment'::regclass, true); + +-- Another reverse-listing example +CREATE VIEW sums_1_100 AS +WITH RECURSIVE t(n) AS ( + VALUES (1) +UNION ALL + SELECT n+1 FROM t WHERE n < 100 +) +SELECT sum(n) FROM t; + +\d+ sums_1_100 + +-- corner case in which sub-WITH gets initialized first +with recursive q as ( + select * from department + union all + (with x as (select * from q) + select * from x) + ) +select * from q limit 24; + +with recursive q as ( + select * from department + union all + (with recursive x as ( + select * from department + union all + (select * from q union all select * from x) + ) + select * from x) + ) +select * from q limit 32; + +-- recursive term has sub-UNION +WITH RECURSIVE t(i,j) AS ( + VALUES (1,2) + UNION ALL + SELECT t2.i, t.j+1 FROM + (SELECT 2 AS i UNION ALL SELECT 3 AS i) AS t2 + JOIN t ON (t2.i = t.i+1)) + + SELECT * FROM t; + +-- +-- different tree example +-- +CREATE TEMPORARY TABLE tree( + id INTEGER PRIMARY KEY, + parent_id INTEGER REFERENCES tree(id) +); + +INSERT INTO tree +VALUES (1, NULL), (2, 1), (3,1), (4,2), (5,2), (6,2), (7,3), (8,3), + (9,4), (10,4), (11,7), (12,7), (13,7), (14, 9), (15,11), (16,11); + +-- +-- get all paths from "second level" nodes to leaf nodes +-- +WITH RECURSIVE t(id, path) AS ( + VALUES(1,ARRAY[]::integer[]) +UNION ALL + SELECT tree.id, t.path || tree.id + FROM tree JOIN t ON (tree.parent_id = t.id) +) +SELECT t1.*, t2.* FROM t AS t1 JOIN t AS t2 ON + (t1.path[1] = t2.path[1] AND + array_upper(t1.path,1) = 1 AND + array_upper(t2.path,1) > 1) + ORDER BY t1.id, t2.id; + +-- just count 'em +WITH RECURSIVE t(id, path) AS ( + VALUES(1,ARRAY[]::integer[]) +UNION ALL + SELECT tree.id, t.path || tree.id + FROM tree JOIN t ON (tree.parent_id = t.id) +) +SELECT t1.id, count(t2.*) FROM t AS t1 JOIN t AS t2 ON + (t1.path[1] = t2.path[1] AND + array_upper(t1.path,1) = 1 AND + array_upper(t2.path,1) > 1) + GROUP BY t1.id + ORDER BY t1.id; + +-- this variant tickled a whole-row-variable bug in 8.4devel +WITH RECURSIVE t(id, path) AS ( + VALUES(1,ARRAY[]::integer[]) +UNION ALL + SELECT tree.id, t.path || tree.id + FROM tree JOIN t ON (tree.parent_id = t.id) +) +SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON +(t1.id=t2.id); + +-- +-- test cycle detection +-- +create temp table graph( f int, t int, label text ); + +insert into graph values + (1, 2, 'arc 1 -> 2'), + (1, 3, 'arc 1 -> 3'), + (2, 3, 'arc 2 -> 3'), + (1, 4, 'arc 1 -> 4'), + (4, 5, 'arc 4 -> 5'), + (5, 1, 'arc 5 -> 1'); + +with recursive search_graph(f, t, label, path, cycle) as ( + select *, array[row(g.f, g.t)], false from graph g + union all + select g.*, path || row(g.f, g.t), row(g.f, g.t) = any(path) + from graph g, search_graph sg + where g.f = sg.t and not cycle +) +select * from search_graph; + +-- ordering by the path column has same effect as SEARCH DEPTH FIRST +with recursive search_graph(f, t, label, path, cycle) as ( + select *, array[row(g.f, g.t)], false from graph g + union all + select g.*, path || row(g.f, g.t), row(g.f, g.t) = any(path) + from graph g, search_graph sg + where g.f = sg.t and not cycle +) +select * from search_graph order by path; + +-- +-- test multiple WITH queries +-- +WITH RECURSIVE + y (id) AS (VALUES (1)), + x (id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM x WHERE id < 5) +SELECT * FROM x; + +-- forward reference OK +WITH RECURSIVE + x(id) AS (SELECT * FROM y UNION ALL SELECT id+1 FROM x WHERE id < 5), + y(id) AS (values (1)) + SELECT * FROM x; + +WITH RECURSIVE + x(id) AS + (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 5), + y(id) AS + (VALUES (1) UNION ALL SELECT id+1 FROM y WHERE id < 10) + SELECT y.*, x.* FROM y LEFT JOIN x USING (id); + +WITH RECURSIVE + x(id) AS + (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 5), + y(id) AS + (VALUES (1) UNION ALL SELECT id+1 FROM x WHERE id < 10) + SELECT y.*, x.* FROM y LEFT JOIN x USING (id); + +WITH RECURSIVE + x(id) AS + (SELECT 1 UNION ALL SELECT id+1 FROM x WHERE id < 3 ), + y(id) AS + (SELECT * FROM x UNION ALL SELECT * FROM x), + z(id) AS + (SELECT * FROM x UNION ALL SELECT id+1 FROM z WHERE id < 10) + SELECT * FROM z; + +WITH RECURSIVE + x(id) AS + (SELECT 1 UNION ALL SELECT id+1 FROM x WHERE id < 3 ), + y(id) AS + (SELECT * FROM x UNION ALL SELECT * FROM x), + z(id) AS + (SELECT * FROM y UNION ALL SELECT id+1 FROM z WHERE id < 10) + SELECT * FROM z; + +-- +-- Test WITH attached to a data-modifying statement +-- + +CREATE TEMPORARY TABLE y (a INTEGER); +INSERT INTO y SELECT generate_series(1, 10); + +WITH t AS ( + SELECT a FROM y +) +INSERT INTO y +SELECT a+20 FROM t RETURNING *; + +SELECT * FROM y; + +WITH t AS ( + SELECT a FROM y +) +UPDATE y SET a = y.a-10 FROM t WHERE y.a > 20 AND t.a = y.a RETURNING y.a; + +SELECT * FROM y; + +WITH RECURSIVE t(a) AS ( + SELECT 11 + UNION ALL + SELECT a+1 FROM t WHERE a < 50 +) +DELETE FROM y USING t WHERE t.a = y.a RETURNING y.a; + +SELECT * FROM y; + +DROP TABLE y; + +-- +-- error cases +-- + +-- INTERSECT +WITH RECURSIVE x(n) AS (SELECT 1 INTERSECT SELECT n+1 FROM x) + SELECT * FROM x; + +WITH RECURSIVE x(n) AS (SELECT 1 INTERSECT ALL SELECT n+1 FROM x) + SELECT * FROM x; + +-- EXCEPT +WITH RECURSIVE x(n) AS (SELECT 1 EXCEPT SELECT n+1 FROM x) + SELECT * FROM x; + +WITH RECURSIVE x(n) AS (SELECT 1 EXCEPT ALL SELECT n+1 FROM x) + SELECT * FROM x; + +-- no non-recursive term +WITH RECURSIVE x(n) AS (SELECT n FROM x) + SELECT * FROM x; + +-- recursive term in the left hand side (strictly speaking, should allow this) +WITH RECURSIVE x(n) AS (SELECT n FROM x UNION ALL SELECT 1) + SELECT * FROM x; + +CREATE TEMPORARY TABLE y (a INTEGER); +INSERT INTO y SELECT generate_series(1, 10); + +-- LEFT JOIN + +WITH RECURSIVE x(n) AS (SELECT a FROM y WHERE a = 1 + UNION ALL + SELECT x.n+1 FROM y LEFT JOIN x ON x.n = y.a WHERE n < 10) +SELECT * FROM x; + +-- RIGHT JOIN +WITH RECURSIVE x(n) AS (SELECT a FROM y WHERE a = 1 + UNION ALL + SELECT x.n+1 FROM x RIGHT JOIN y ON x.n = y.a WHERE n < 10) +SELECT * FROM x; + +-- FULL JOIN +WITH RECURSIVE x(n) AS (SELECT a FROM y WHERE a = 1 + UNION ALL + SELECT x.n+1 FROM x FULL JOIN y ON x.n = y.a WHERE n < 10) +SELECT * FROM x; + +-- subquery +WITH RECURSIVE x(n) AS (SELECT 1 UNION ALL SELECT n+1 FROM x + WHERE n IN (SELECT * FROM x)) + SELECT * FROM x; + +-- aggregate functions +WITH RECURSIVE x(n) AS (SELECT 1 UNION ALL SELECT count(*) FROM x) + SELECT * FROM x; + +WITH RECURSIVE x(n) AS (SELECT 1 UNION ALL SELECT sum(n) FROM x) + SELECT * FROM x; + +-- ORDER BY +WITH RECURSIVE x(n) AS (SELECT 1 UNION ALL SELECT n+1 FROM x ORDER BY 1) + SELECT * FROM x; + +-- LIMIT/OFFSET +WITH RECURSIVE x(n) AS (SELECT 1 UNION ALL SELECT n+1 FROM x LIMIT 10 OFFSET 1) + SELECT * FROM x; + +-- FOR UPDATE +WITH RECURSIVE x(n) AS (SELECT 1 UNION ALL SELECT n+1 FROM x FOR UPDATE) + SELECT * FROM x; + +-- target list has a recursive query name +WITH RECURSIVE x(id) AS (values (1) + UNION ALL + SELECT (SELECT * FROM x) FROM x WHERE id < 5 +) SELECT * FROM x; + +-- mutual recursive query (not implemented) +WITH RECURSIVE + x (id) AS (SELECT 1 UNION ALL SELECT id+1 FROM y WHERE id < 5), + y (id) AS (SELECT 1 UNION ALL SELECT id+1 FROM x WHERE id < 5) +SELECT * FROM x; + +-- non-linear recursion is not allowed +WITH RECURSIVE foo(i) AS + (values (1) + UNION ALL + (SELECT i+1 FROM foo WHERE i < 10 + UNION ALL + SELECT i+1 FROM foo WHERE i < 5) +) SELECT * FROM foo; + +WITH RECURSIVE foo(i) AS + (values (1) + UNION ALL + SELECT * FROM + (SELECT i+1 FROM foo WHERE i < 10 + UNION ALL + SELECT i+1 FROM foo WHERE i < 5) AS t +) SELECT * FROM foo; + +WITH RECURSIVE foo(i) AS + (values (1) + UNION ALL + (SELECT i+1 FROM foo WHERE i < 10 + EXCEPT + SELECT i+1 FROM foo WHERE i < 5) +) SELECT * FROM foo; + +WITH RECURSIVE foo(i) AS + (values (1) + UNION ALL + (SELECT i+1 FROM foo WHERE i < 10 + INTERSECT + SELECT i+1 FROM foo WHERE i < 5) +) SELECT * FROM foo; + +-- Wrong type induced from non-recursive term +WITH RECURSIVE foo(i) AS + (SELECT i FROM (VALUES(1),(2)) t(i) + UNION ALL + SELECT (i+1)::numeric(10,0) FROM foo WHERE i < 10) +SELECT * FROM foo; + +-- rejects different typmod, too (should we allow this?) +WITH RECURSIVE foo(i) AS + (SELECT i::numeric(3,0) FROM (VALUES(1),(2)) t(i) + UNION ALL + SELECT (i+1)::numeric(10,0) FROM foo WHERE i < 10) +SELECT * FROM foo; + +-- disallow OLD/NEW reference in CTE +CREATE TEMPORARY TABLE x (n integer); +CREATE RULE r2 AS ON UPDATE TO x DO INSTEAD + WITH t AS (SELECT OLD.*) UPDATE y SET a = t.n FROM t; + +-- +-- test for bug #4902 +-- +with cte(foo) as ( values(42) ) values((select foo from cte)); +with cte(foo) as ( select 42 ) select * from ((select foo from cte)) q; + +-- test CTE referencing an outer-level variable (to see that changed-parameter +-- signaling still works properly after fixing this bug) +select ( with cte(foo) as ( values(f1) ) + select (select foo from cte) ) +from int4_tbl; + +select ( with cte(foo) as ( values(f1) ) + values((select foo from cte)) ) +from int4_tbl; + +-- +-- test for nested-recursive-WITH bug +-- +WITH RECURSIVE t(j) AS ( + WITH RECURSIVE s(i) AS ( + VALUES (1) + UNION ALL + SELECT i+1 FROM s WHERE i < 10 + ) + SELECT i FROM s + UNION ALL + SELECT j+1 FROM t WHERE j < 10 +) +SELECT * FROM t; + +-- +-- test WITH attached to intermediate-level set operation +-- + +WITH outermost(x) AS ( + SELECT 1 + UNION (WITH innermost as (SELECT 2) + SELECT * FROM innermost + UNION SELECT 3) +) +SELECT * FROM outermost ORDER BY 1; + +WITH outermost(x) AS ( + SELECT 1 + UNION (WITH innermost as (SELECT 2) + SELECT * FROM outermost -- fail + UNION SELECT * FROM innermost) +) +SELECT * FROM outermost ORDER BY 1; + +WITH RECURSIVE outermost(x) AS ( + SELECT 1 + UNION (WITH innermost as (SELECT 2) + SELECT * FROM outermost + UNION SELECT * FROM innermost) +) +SELECT * FROM outermost ORDER BY 1; + +WITH RECURSIVE outermost(x) AS ( + WITH innermost as (SELECT 2 FROM outermost) -- fail + SELECT * FROM innermost + UNION SELECT * from outermost +) +SELECT * FROM outermost ORDER BY 1; + +-- +-- This test will fail with the old implementation of PARAM_EXEC parameter +-- assignment, because the "q1" Var passed down to A's targetlist subselect +-- looks exactly like the "A.id" Var passed down to C's subselect, causing +-- the old code to give them the same runtime PARAM_EXEC slot. But the +-- lifespans of the two parameters overlap, thanks to B also reading A. +-- + +with +A as ( select q2 as id, (select q1) as x from int8_tbl ), +B as ( select id, row_number() over (partition by id) as r from A ), +C as ( select A.id, array(select B.id from B where B.id = A.id) from A ) +select * from C; + +-- +-- Test CTEs read in non-initialization orders +-- + +WITH RECURSIVE + tab(id_key,link) AS (VALUES (1,17), (2,17), (3,17), (4,17), (6,17), (5,17)), + iter (id_key, row_type, link) AS ( + SELECT 0, 'base', 17 + UNION ALL ( + WITH remaining(id_key, row_type, link, min) AS ( + SELECT tab.id_key, 'true'::text, iter.link, MIN(tab.id_key) OVER () + FROM tab INNER JOIN iter USING (link) + WHERE tab.id_key > iter.id_key + ), + first_remaining AS ( + SELECT id_key, row_type, link + FROM remaining + WHERE id_key=min + ), + effect AS ( + SELECT tab.id_key, 'new'::text, tab.link + FROM first_remaining e INNER JOIN tab ON e.id_key=tab.id_key + WHERE e.row_type = 'false' + ) + SELECT * FROM first_remaining + UNION ALL SELECT * FROM effect + ) + ) +SELECT * FROM iter; + +WITH RECURSIVE + tab(id_key,link) AS (VALUES (1,17), (2,17), (3,17), (4,17), (6,17), (5,17)), + iter (id_key, row_type, link) AS ( + SELECT 0, 'base', 17 + UNION ( + WITH remaining(id_key, row_type, link, min) AS ( + SELECT tab.id_key, 'true'::text, iter.link, MIN(tab.id_key) OVER () + FROM tab INNER JOIN iter USING (link) + WHERE tab.id_key > iter.id_key + ), + first_remaining AS ( + SELECT id_key, row_type, link + FROM remaining + WHERE id_key=min + ), + effect AS ( + SELECT tab.id_key, 'new'::text, tab.link + FROM first_remaining e INNER JOIN tab ON e.id_key=tab.id_key + WHERE e.row_type = 'false' + ) + SELECT * FROM first_remaining + UNION ALL SELECT * FROM effect + ) + ) +SELECT * FROM iter; + +-- +-- Data-modifying statements in WITH +-- + +-- INSERT ... RETURNING +WITH t AS ( + INSERT INTO y + VALUES + (11), + (12), + (13), + (14), + (15), + (16), + (17), + (18), + (19), + (20) + RETURNING * +) +SELECT * FROM t; + +SELECT * FROM y; + +-- UPDATE ... RETURNING +WITH t AS ( + UPDATE y + SET a=a+1 + RETURNING * +) +SELECT * FROM t; + +SELECT * FROM y; + +-- DELETE ... RETURNING +WITH t AS ( + DELETE FROM y + WHERE a <= 10 + RETURNING * +) +SELECT * FROM t; + +SELECT * FROM y; + +-- forward reference +WITH RECURSIVE t AS ( + INSERT INTO y + SELECT a+5 FROM t2 WHERE a > 5 + RETURNING * +), t2 AS ( + UPDATE y SET a=a-11 RETURNING * +) +SELECT * FROM t +UNION ALL +SELECT * FROM t2; + +SELECT * FROM y; + +-- unconditional DO INSTEAD rule +CREATE RULE y_rule AS ON DELETE TO y DO INSTEAD + INSERT INTO y VALUES(42) RETURNING *; + +WITH t AS ( + DELETE FROM y RETURNING * +) +SELECT * FROM t; + +SELECT * FROM y; + +DROP RULE y_rule ON y; + +-- check merging of outer CTE with CTE in a rule action +CREATE TEMP TABLE bug6051 AS + select i from generate_series(1,3) as t(i); + +SELECT * FROM bug6051; + +WITH t1 AS ( DELETE FROM bug6051 RETURNING * ) +INSERT INTO bug6051 SELECT * FROM t1; + +SELECT * FROM bug6051; + +CREATE TEMP TABLE bug6051_2 (i int); + +CREATE RULE bug6051_ins AS ON INSERT TO bug6051 DO INSTEAD + INSERT INTO bug6051_2 + SELECT NEW.i; + +WITH t1 AS ( DELETE FROM bug6051 RETURNING * ) +INSERT INTO bug6051 SELECT * FROM t1; + +SELECT * FROM bug6051; +SELECT * FROM bug6051_2; + +-- a truly recursive CTE in the same list +WITH RECURSIVE t(a) AS ( + SELECT 0 + UNION ALL + SELECT a+1 FROM t WHERE a+1 < 5 +), t2 as ( + INSERT INTO y + SELECT * FROM t RETURNING * +) +SELECT * FROM t2 JOIN y USING (a) ORDER BY a; + +SELECT * FROM y; + +-- data-modifying WITH in a modifying statement +WITH t AS ( + DELETE FROM y + WHERE a <= 10 + RETURNING * +) +INSERT INTO y SELECT -a FROM t RETURNING *; + +SELECT * FROM y; + +-- check that WITH query is run to completion even if outer query isn't +WITH t AS ( + UPDATE y SET a = a * 100 RETURNING * +) +SELECT * FROM t LIMIT 10; + +SELECT * FROM y; + +-- data-modifying WITH containing INSERT...ON CONFLICT DO UPDATE +CREATE TABLE withz AS SELECT i AS k, (i || ' v')::text v FROM generate_series(1, 16, 3) i; +ALTER TABLE withz ADD UNIQUE (k); + +WITH t AS ( + INSERT INTO withz SELECT i, 'insert' + FROM generate_series(0, 16) i + ON CONFLICT (k) DO UPDATE SET v = withz.v || ', now update' + RETURNING * +) +SELECT * FROM t JOIN y ON t.k = y.a ORDER BY a, k; + +-- Test EXCLUDED.* reference within CTE +WITH aa AS ( + INSERT INTO withz VALUES(1, 5) ON CONFLICT (k) DO UPDATE SET v = EXCLUDED.v + WHERE withz.k != EXCLUDED.k + RETURNING * +) +SELECT * FROM aa; + +-- New query/snapshot demonstrates side-effects of previous query. +SELECT * FROM withz ORDER BY k; + +-- +-- Ensure subqueries within the update clause work, even if they +-- reference outside values +-- +WITH aa AS (SELECT 1 a, 2 b) +INSERT INTO withz VALUES(1, 'insert') +ON CONFLICT (k) DO UPDATE SET v = (SELECT b || ' update' FROM aa WHERE a = 1 LIMIT 1); +WITH aa AS (SELECT 1 a, 2 b) +INSERT INTO withz VALUES(1, 'insert') +ON CONFLICT (k) DO UPDATE SET v = ' update' WHERE withz.k = (SELECT a FROM aa); +WITH aa AS (SELECT 1 a, 2 b) +INSERT INTO withz VALUES(1, 'insert') +ON CONFLICT (k) DO UPDATE SET v = (SELECT b || ' update' FROM aa WHERE a = 1 LIMIT 1); +WITH aa AS (SELECT 'a' a, 'b' b UNION ALL SELECT 'a' a, 'b' b) +INSERT INTO withz VALUES(1, 'insert') +ON CONFLICT (k) DO UPDATE SET v = (SELECT b || ' update' FROM aa WHERE a = 'a' LIMIT 1); +WITH aa AS (SELECT 1 a, 2 b) +INSERT INTO withz VALUES(1, (SELECT b || ' insert' FROM aa WHERE a = 1 )) +ON CONFLICT (k) DO UPDATE SET v = (SELECT b || ' update' FROM aa WHERE a = 1 LIMIT 1); + +-- Update a row more than once, in different parts of a wCTE. That is +-- an allowed, presumably very rare, edge case, but since it was +-- broken in the past, having a test seems worthwhile. +WITH simpletup AS ( + SELECT 2 k, 'Green' v), +upsert_cte AS ( + INSERT INTO withz VALUES(2, 'Blue') ON CONFLICT (k) DO + UPDATE SET (k, v) = (SELECT k, v FROM simpletup WHERE simpletup.k = withz.k) + RETURNING k, v) +INSERT INTO withz VALUES(2, 'Red') ON CONFLICT (k) DO +UPDATE SET (k, v) = (SELECT k, v FROM upsert_cte WHERE upsert_cte.k = withz.k) +RETURNING k, v; + +DROP TABLE withz; + +-- check that run to completion happens in proper ordering + +TRUNCATE TABLE y; +INSERT INTO y SELECT generate_series(1, 3); +CREATE TEMPORARY TABLE yy (a INTEGER); + +WITH RECURSIVE t1 AS ( + INSERT INTO y SELECT * FROM y RETURNING * +), t2 AS ( + INSERT INTO yy SELECT * FROM t1 RETURNING * +) +SELECT 1; + +SELECT * FROM y; +SELECT * FROM yy; + +WITH RECURSIVE t1 AS ( + INSERT INTO yy SELECT * FROM t2 RETURNING * +), t2 AS ( + INSERT INTO y SELECT * FROM y RETURNING * +) +SELECT 1; + +SELECT * FROM y; +SELECT * FROM yy; + +-- triggers + +TRUNCATE TABLE y; +INSERT INTO y SELECT generate_series(1, 10); + +CREATE FUNCTION y_trigger() RETURNS trigger AS $$ +begin + raise notice 'y_trigger: a = %', new.a; + return new; +end; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER y_trig BEFORE INSERT ON y FOR EACH ROW + EXECUTE PROCEDURE y_trigger(); + +WITH t AS ( + INSERT INTO y + VALUES + (21), + (22), + (23) + RETURNING * +) +SELECT * FROM t; + +SELECT * FROM y; + +DROP TRIGGER y_trig ON y; + +CREATE TRIGGER y_trig AFTER INSERT ON y FOR EACH ROW + EXECUTE PROCEDURE y_trigger(); + +WITH t AS ( + INSERT INTO y + VALUES + (31), + (32), + (33) + RETURNING * +) +SELECT * FROM t LIMIT 1; + +SELECT * FROM y; + +DROP TRIGGER y_trig ON y; + +CREATE OR REPLACE FUNCTION y_trigger() RETURNS trigger AS $$ +begin + raise notice 'y_trigger'; + return null; +end; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER y_trig AFTER INSERT ON y FOR EACH STATEMENT + EXECUTE PROCEDURE y_trigger(); + +WITH t AS ( + INSERT INTO y + VALUES + (41), + (42), + (43) + RETURNING * +) +SELECT * FROM t; + +SELECT * FROM y; + +DROP TRIGGER y_trig ON y; +DROP FUNCTION y_trigger(); + +-- WITH attached to inherited UPDATE or DELETE + +CREATE TEMP TABLE parent ( id int, val text ); +CREATE TEMP TABLE child1 ( ) INHERITS ( parent ); +CREATE TEMP TABLE child2 ( ) INHERITS ( parent ); + +INSERT INTO parent VALUES ( 1, 'p1' ); +INSERT INTO child1 VALUES ( 11, 'c11' ),( 12, 'c12' ); +INSERT INTO child2 VALUES ( 23, 'c21' ),( 24, 'c22' ); + +WITH rcte AS ( SELECT sum(id) AS totalid FROM parent ) +UPDATE parent SET id = id + totalid FROM rcte; + +SELECT * FROM parent; + +WITH wcte AS ( INSERT INTO child1 VALUES ( 42, 'new' ) RETURNING id AS newid ) +UPDATE parent SET id = id + newid FROM wcte; + +SELECT * FROM parent; + +WITH rcte AS ( SELECT max(id) AS maxid FROM parent ) +DELETE FROM parent USING rcte WHERE id = maxid; + +SELECT * FROM parent; + +WITH wcte AS ( INSERT INTO child2 VALUES ( 42, 'new2' ) RETURNING id AS newid ) +DELETE FROM parent USING wcte WHERE id = newid; + +SELECT * FROM parent; + +-- check EXPLAIN VERBOSE for a wCTE with RETURNING + +EXPLAIN (VERBOSE, COSTS OFF) +WITH wcte AS ( INSERT INTO int8_tbl VALUES ( 42, 47 ) RETURNING q2 ) +DELETE FROM a USING wcte WHERE aa = q2; + +-- error cases + +-- data-modifying WITH tries to use its own output +WITH RECURSIVE t AS ( + INSERT INTO y + SELECT * FROM t +) +VALUES(FALSE); + +-- no RETURNING in a referenced data-modifying WITH +WITH t AS ( + INSERT INTO y VALUES(0) +) +SELECT * FROM t; + +-- data-modifying WITH allowed only at the top level +SELECT * FROM ( + WITH t AS (UPDATE y SET a=a+1 RETURNING *) + SELECT * FROM t +) ss; + +-- most variants of rules aren't allowed +CREATE RULE y_rule AS ON INSERT TO y WHERE a=0 DO INSTEAD DELETE FROM y; +WITH t AS ( + INSERT INTO y VALUES(0) +) +VALUES(FALSE); +DROP RULE y_rule ON y; + +-- check that parser lookahead for WITH doesn't cause any odd behavior +--create table foo (with baz); -- fail, WITH is a reserved word +--create table foo (with ordinality); -- fail, WITH is a reserved word +with ordinality as (select 1 as x) select * from ordinality; + +-- check sane response to attempt to modify CTE relation +WITH test AS (SELECT 42) INSERT INTO test VALUES (1); + +-- check response to attempt to modify table with same name as a CTE (perhaps +-- surprisingly it works, because CTEs don't hide tables from data-modifying +-- statements) +create temp table test (i int); +with test as (select 42) insert into test select * from test; +select * from test; +drop table test; diff --git a/postgresql/examples/write_parallel.sql b/postgresql/examples/write_parallel.sql new file mode 100644 index 0000000..78b479c --- /dev/null +++ b/postgresql/examples/write_parallel.sql @@ -0,0 +1,42 @@ +-- +-- PARALLEL +-- + +-- Serializable isolation would disable parallel query, so explicitly use an +-- arbitrary other level. +begin isolation level repeatable read; + +-- encourage use of parallel plans +set parallel_setup_cost=0; +set parallel_tuple_cost=0; +set min_parallel_table_scan_size=0; +set max_parallel_workers_per_gather=4; + +-- +-- Test write operations that has an underlying query that is eligble +-- for parallel plans +-- +explain (costs off) create table parallel_write as + select length(stringu1) from tenk1 group by length(stringu1); +create table parallel_write as + select length(stringu1) from tenk1 group by length(stringu1); +drop table parallel_write; + +explain (costs off) select length(stringu1) into parallel_write + from tenk1 group by length(stringu1); +select length(stringu1) into parallel_write + from tenk1 group by length(stringu1); +drop table parallel_write; + +explain (costs off) create materialized view parallel_mat_view as + select length(stringu1) from tenk1 group by length(stringu1); +create materialized view parallel_mat_view as + select length(stringu1) from tenk1 group by length(stringu1); +drop materialized view parallel_mat_view; + +prepare prep_stmt as select length(stringu1) from tenk1 group by length(stringu1); +explain (costs off) create table parallel_write as execute prep_stmt; +create table parallel_write as execute prep_stmt; +drop table parallel_write; + +rollback; diff --git a/postgresql/examples/xid.sql b/postgresql/examples/xid.sql new file mode 100644 index 0000000..703b79a --- /dev/null +++ b/postgresql/examples/xid.sql @@ -0,0 +1,147 @@ +-- xid and xid8 + +-- values in range, in octal, decimal, hex +select '010'::xid, + '42'::xid, + '0xffffffff'::xid, + '-1'::xid, + '010'::xid8, + '42'::xid8, + '0xffffffffffffffff'::xid8, + '-1'::xid8; + +-- garbage values are not yet rejected (perhaps they should be) +select ''::xid; +select 'asdf'::xid; +select ''::xid8; +select 'asdf'::xid8; + +-- equality +select '1'::xid = '1'::xid; +select '1'::xid != '1'::xid; +select '1'::xid8 = '1'::xid8; +select '1'::xid8 != '1'::xid8; + +-- conversion +select '1'::xid = '1'::xid8::xid; +select '1'::xid != '1'::xid8::xid; + +-- we don't want relational operators for xid, due to use of modular arithmetic +select '1'::xid < '2'::xid; +select '1'::xid <= '2'::xid; +select '1'::xid > '2'::xid; +select '1'::xid >= '2'::xid; + +-- we want them for xid8 though +select '1'::xid8 < '2'::xid8, '2'::xid8 < '2'::xid8, '2'::xid8 < '1'::xid8; +select '1'::xid8 <= '2'::xid8, '2'::xid8 <= '2'::xid8, '2'::xid8 <= '1'::xid8; +select '1'::xid8 > '2'::xid8, '2'::xid8 > '2'::xid8, '2'::xid8 > '1'::xid8; +select '1'::xid8 >= '2'::xid8, '2'::xid8 >= '2'::xid8, '2'::xid8 >= '1'::xid8; + +-- we also have a 3way compare for btrees +select xid8cmp('1', '2'), xid8cmp('2', '2'), xid8cmp('2', '1'); + +-- xid8 has btree and hash opclasses +create table xid8_t1 (x xid8); +create index on xid8_t1 using btree(x); +create index on xid8_t1 using hash(x); +drop table xid8_t1; + + +-- pg_snapshot data type and related functions + +-- Note: another set of tests similar to this exists in txid.sql, for a limited +-- time (the relevant functions share C code) + +-- i/o +select '12:13:'::pg_snapshot; +select '12:18:14,16'::pg_snapshot; +select '12:16:14,14'::pg_snapshot; + +-- errors +select '31:12:'::pg_snapshot; +select '0:1:'::pg_snapshot; +select '12:13:0'::pg_snapshot; +select '12:16:14,13'::pg_snapshot; + +create temp table snapshot_test ( + nr integer, + snap pg_snapshot +); + +insert into snapshot_test values (1, '12:13:'); +insert into snapshot_test values (2, '12:20:13,15,18'); +insert into snapshot_test values (3, '100001:100009:100005,100007,100008'); +insert into snapshot_test values (4, '100:150:101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131'); +select snap from snapshot_test order by nr; + +select pg_snapshot_xmin(snap), + pg_snapshot_xmax(snap), + pg_snapshot_xip(snap) +from snapshot_test order by nr; + +select id, pg_visible_in_snapshot(id::text::xid8, snap) +from snapshot_test, generate_series(11, 21) id +where nr = 2; + +-- test bsearch +select id, pg_visible_in_snapshot(id::text::xid8, snap) +from snapshot_test, generate_series(90, 160) id +where nr = 4; + +-- test current values also +select pg_current_xact_id() >= pg_snapshot_xmin(pg_current_snapshot()); + +-- we can't assume current is always less than xmax, however + +select pg_visible_in_snapshot(pg_current_xact_id(), pg_current_snapshot()); + +-- test 64bitness + +select pg_snapshot '1000100010001000:1000100010001100:1000100010001012,1000100010001013'; +select pg_visible_in_snapshot('1000100010001012', '1000100010001000:1000100010001100:1000100010001012,1000100010001013'); +select pg_visible_in_snapshot('1000100010001015', '1000100010001000:1000100010001100:1000100010001012,1000100010001013'); + +-- test 64bit overflow +SELECT pg_snapshot '1:9223372036854775807:3'; +SELECT pg_snapshot '1:9223372036854775808:3'; + +-- test pg_current_xact_id_if_assigned +BEGIN; +SELECT pg_current_xact_id_if_assigned() IS NULL; +SELECT pg_current_xact_id() ; +COMMIT; + +-- test xid status functions +BEGIN; +SELECT pg_current_xact_id() AS committed; +COMMIT; + +BEGIN; +SELECT pg_current_xact_id() AS rolledback; +ROLLBACK; + +BEGIN; +SELECT pg_current_xact_id() AS inprogress; + +SELECT pg_xact_status('1'::xid8); -- BootstrapTransactionId is always committed +SELECT pg_xact_status('2'::xid8); -- FrozenTransactionId is always committed +SELECT pg_xact_status('3'::xid8); -- in regress testing FirstNormalTransactionId will always be behind oldestXmin + +COMMIT; + +BEGIN; +CREATE FUNCTION test_future_xid_status(xid8) +RETURNS void +LANGUAGE plpgsql +AS +$$ +BEGIN + PERFORM pg_xact_status($1); + RAISE EXCEPTION 'didn''t ERROR at xid in the future as expected'; +EXCEPTION + WHEN invalid_parameter_value THEN + RAISE NOTICE 'Got expected error for xid in the future'; +END; +$$; +ROLLBACK; diff --git a/postgresql/examples/xmlmap.sql b/postgresql/examples/xmlmap.sql new file mode 100644 index 0000000..fde1b9e --- /dev/null +++ b/postgresql/examples/xmlmap.sql @@ -0,0 +1,57 @@ +CREATE SCHEMA testxmlschema; + +CREATE TABLE testxmlschema.test1 (a int, b text); +INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null); +CREATE DOMAIN testxmldomain AS varchar; +CREATE TABLE testxmlschema.test2 (z int, y varchar(500), x char(6), w numeric(9,2), v smallint, u bigint, t real, s time, r timestamp, q date, p xml, o testxmldomain, n bool, m bytea, aaa text); +ALTER TABLE testxmlschema.test2 DROP COLUMN aaa; +INSERT INTO testxmlschema.test2 VALUES (55, 'abc', 'def', 98.6, 2, 999, 0, '21:07', '2009-06-08 21:07:30', '2009-06-08', NULL, 'ABC', true, 'XYZ'); + +SELECT table_to_xml('testxmlschema.test1', false, false, ''); +SELECT table_to_xml('testxmlschema.test1', true, false, 'foo'); +SELECT table_to_xml('testxmlschema.test1', false, true, ''); +SELECT table_to_xml('testxmlschema.test1', true, true, ''); +SELECT table_to_xml('testxmlschema.test2', false, false, ''); + +SELECT table_to_xmlschema('testxmlschema.test1', false, false, ''); +SELECT table_to_xmlschema('testxmlschema.test1', true, false, ''); +SELECT table_to_xmlschema('testxmlschema.test1', false, true, 'foo'); +SELECT table_to_xmlschema('testxmlschema.test1', true, true, ''); +SELECT table_to_xmlschema('testxmlschema.test2', false, false, ''); + +SELECT table_to_xml_and_xmlschema('testxmlschema.test1', false, false, ''); +SELECT table_to_xml_and_xmlschema('testxmlschema.test1', true, false, ''); +SELECT table_to_xml_and_xmlschema('testxmlschema.test1', false, true, ''); +SELECT table_to_xml_and_xmlschema('testxmlschema.test1', true, true, 'foo'); + +SELECT query_to_xml('SELECT * FROM testxmlschema.test1', false, false, ''); +SELECT query_to_xmlschema('SELECT * FROM testxmlschema.test1', false, false, ''); +SELECT query_to_xml_and_xmlschema('SELECT * FROM testxmlschema.test1', true, true, ''); + +DECLARE xc CURSOR WITH HOLD FOR SELECT * FROM testxmlschema.test1 ORDER BY 1, 2; +SELECT cursor_to_xml('xc'::refcursor, 5, false, true, ''); +SELECT cursor_to_xmlschema('xc'::refcursor, false, true, ''); +MOVE BACKWARD ALL IN xc; +SELECT cursor_to_xml('xc'::refcursor, 5, true, false, ''); +SELECT cursor_to_xmlschema('xc'::refcursor, true, false, ''); + +SELECT schema_to_xml('testxmlschema', false, true, ''); +SELECT schema_to_xml('testxmlschema', true, false, ''); +SELECT schema_to_xmlschema('testxmlschema', false, true, ''); +SELECT schema_to_xmlschema('testxmlschema', true, false, ''); +SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo'); + + +-- test that domains are transformed like their base types + +CREATE DOMAIN testboolxmldomain AS bool; +CREATE DOMAIN testdatexmldomain AS date; + +CREATE TABLE testxmlschema.test3 + AS SELECT true c1, + true::testboolxmldomain c2, + '2013-02-21'::date c3, + '2013-02-21'::testdatexmldomain c4; + +SELECT xmlforest(c1, c2, c3, c4) FROM testxmlschema.test3; +SELECT table_to_xml('testxmlschema.test3', true, true, ''); diff --git a/postgresql/keywords.go b/postgresql/keywords.go new file mode 100644 index 0000000..a92ced1 --- /dev/null +++ b/postgresql/keywords.go @@ -0,0 +1,855 @@ +package postgresql + +// Keyword represents a SQL keyword with its reserved status. +type Keyword struct { + Keyword string + Reserved bool +} + +// Retrieved from https://www.postgresql.org/docs/current/sql-keywords-appendix.html#KEYWORDS-TABLE +// Reserved is true if it's label is in ["reserved", "reserved, requires as", "reserved (can be function or type)"] +var Keywords = map[string]Keyword{ + "A": {Keyword: "A", Reserved: false}, + "ABORT": {Keyword: "ABORT", Reserved: false}, + "ABS": {Keyword: "ABS", Reserved: false}, + "ABSENT": {Keyword: "ABSENT", Reserved: false}, + "ABSOLUTE": {Keyword: "ABSOLUTE", Reserved: false}, + "ACCESS": {Keyword: "ACCESS", Reserved: false}, + "ACCORDING": {Keyword: "ACCORDING", Reserved: false}, + "ACOS": {Keyword: "ACOS", Reserved: false}, + "ACTION": {Keyword: "ACTION", Reserved: false}, + "ADA": {Keyword: "ADA", Reserved: false}, + "ADD": {Keyword: "ADD", Reserved: false}, + "ADMIN": {Keyword: "ADMIN", Reserved: false}, + "AFTER": {Keyword: "AFTER", Reserved: false}, + "AGGREGATE": {Keyword: "AGGREGATE", Reserved: false}, + "ALL": {Keyword: "ALL", Reserved: true}, + "ALLOCATE": {Keyword: "ALLOCATE", Reserved: false}, + "ALSO": {Keyword: "ALSO", Reserved: false}, + "ALTER": {Keyword: "ALTER", Reserved: false}, + "ALWAYS": {Keyword: "ALWAYS", Reserved: false}, + "ANALYSE": {Keyword: "ANALYSE", Reserved: true}, + "ANALYZE": {Keyword: "ANALYZE", Reserved: true}, + "AND": {Keyword: "AND", Reserved: true}, + "ANY": {Keyword: "ANY", Reserved: true}, + "ANY_VALUE": {Keyword: "ANY_VALUE", Reserved: false}, + "ARE": {Keyword: "ARE", Reserved: false}, + "ARRAY": {Keyword: "ARRAY", Reserved: true}, + "ARRAY_AGG": {Keyword: "ARRAY_AGG", Reserved: false}, + "ARRAY_MAX_CARDINALITY": {Keyword: "ARRAY_MAX_CARDINALITY", Reserved: false}, + "AS": {Keyword: "AS", Reserved: true}, + "ASC": {Keyword: "ASC", Reserved: true}, + "ASENSITIVE": {Keyword: "ASENSITIVE", Reserved: false}, + "ASIN": {Keyword: "ASIN", Reserved: false}, + "ASSERTION": {Keyword: "ASSERTION", Reserved: false}, + "ASSIGNMENT": {Keyword: "ASSIGNMENT", Reserved: false}, + "ASYMMETRIC": {Keyword: "ASYMMETRIC", Reserved: true}, + "AT": {Keyword: "AT", Reserved: false}, + "ATAN": {Keyword: "ATAN", Reserved: false}, + "ATOMIC": {Keyword: "ATOMIC", Reserved: false}, + "ATTACH": {Keyword: "ATTACH", Reserved: false}, + "ATTRIBUTE": {Keyword: "ATTRIBUTE", Reserved: false}, + "ATTRIBUTES": {Keyword: "ATTRIBUTES", Reserved: false}, + "AUTHORIZATION": {Keyword: "AUTHORIZATION", Reserved: true}, + "AVG": {Keyword: "AVG", Reserved: false}, + "BACKWARD": {Keyword: "BACKWARD", Reserved: false}, + "BASE64": {Keyword: "BASE64", Reserved: false}, + "BEFORE": {Keyword: "BEFORE", Reserved: false}, + "BEGIN": {Keyword: "BEGIN", Reserved: false}, + "BEGIN_FRAME": {Keyword: "BEGIN_FRAME", Reserved: false}, + "BEGIN_PARTITION": {Keyword: "BEGIN_PARTITION", Reserved: false}, + "BERNOULLI": {Keyword: "BERNOULLI", Reserved: false}, + "BETWEEN": {Keyword: "BETWEEN", Reserved: false}, + "BIGINT": {Keyword: "BIGINT", Reserved: false}, + "BINARY": {Keyword: "BINARY", Reserved: true}, + "BIT": {Keyword: "BIT", Reserved: false}, + "BIT_LENGTH": {Keyword: "BIT_LENGTH", Reserved: false}, + "BLOB": {Keyword: "BLOB", Reserved: false}, + "BLOCKED": {Keyword: "BLOCKED", Reserved: false}, + "BOM": {Keyword: "BOM", Reserved: false}, + "BOOLEAN": {Keyword: "BOOLEAN", Reserved: false}, + "BOTH": {Keyword: "BOTH", Reserved: true}, + "BREADTH": {Keyword: "BREADTH", Reserved: false}, + "BTRIM": {Keyword: "BTRIM", Reserved: false}, + "BY": {Keyword: "BY", Reserved: false}, + "C": {Keyword: "C", Reserved: false}, + "CACHE": {Keyword: "CACHE", Reserved: false}, + "CALL": {Keyword: "CALL", Reserved: false}, + "CALLED": {Keyword: "CALLED", Reserved: false}, + "CARDINALITY": {Keyword: "CARDINALITY", Reserved: false}, + "CASCADE": {Keyword: "CASCADE", Reserved: false}, + "CASCADED": {Keyword: "CASCADED", Reserved: false}, + "CASE": {Keyword: "CASE", Reserved: true}, + "CAST": {Keyword: "CAST", Reserved: true}, + "CATALOG": {Keyword: "CATALOG", Reserved: false}, + "CATALOG_NAME": {Keyword: "CATALOG_NAME", Reserved: false}, + "CEIL": {Keyword: "CEIL", Reserved: false}, + "CEILING": {Keyword: "CEILING", Reserved: false}, + "CHAIN": {Keyword: "CHAIN", Reserved: false}, + "CHAINING": {Keyword: "CHAINING", Reserved: false}, + "CHAR": {Keyword: "CHAR", Reserved: false}, + "CHARACTER": {Keyword: "CHARACTER", Reserved: false}, + "CHARACTERISTICS": {Keyword: "CHARACTERISTICS", Reserved: false}, + "CHARACTERS": {Keyword: "CHARACTERS", Reserved: false}, + "CHARACTER_LENGTH": {Keyword: "CHARACTER_LENGTH", Reserved: false}, + "CHARACTER_SET_CATALOG": {Keyword: "CHARACTER_SET_CATALOG", Reserved: false}, + "CHARACTER_SET_NAME": {Keyword: "CHARACTER_SET_NAME", Reserved: false}, + "CHARACTER_SET_SCHEMA": {Keyword: "CHARACTER_SET_SCHEMA", Reserved: false}, + "CHAR_LENGTH": {Keyword: "CHAR_LENGTH", Reserved: false}, + "CHECK": {Keyword: "CHECK", Reserved: true}, + "CHECKPOINT": {Keyword: "CHECKPOINT", Reserved: false}, + "CLASS": {Keyword: "CLASS", Reserved: false}, + "CLASSIFIER": {Keyword: "CLASSIFIER", Reserved: false}, + "CLASS_ORIGIN": {Keyword: "CLASS_ORIGIN", Reserved: false}, + "CLOB": {Keyword: "CLOB", Reserved: false}, + "CLOSE": {Keyword: "CLOSE", Reserved: false}, + "CLUSTER": {Keyword: "CLUSTER", Reserved: false}, + "COALESCE": {Keyword: "COALESCE", Reserved: false}, + "COBOL": {Keyword: "COBOL", Reserved: false}, + "COLLATE": {Keyword: "COLLATE", Reserved: true}, + "COLLATION": {Keyword: "COLLATION", Reserved: true}, + "COLLATION_CATALOG": {Keyword: "COLLATION_CATALOG", Reserved: false}, + "COLLATION_NAME": {Keyword: "COLLATION_NAME", Reserved: false}, + "COLLATION_SCHEMA": {Keyword: "COLLATION_SCHEMA", Reserved: false}, + "COLLECT": {Keyword: "COLLECT", Reserved: false}, + "COLUMN": {Keyword: "COLUMN", Reserved: true}, + "COLUMNS": {Keyword: "COLUMNS", Reserved: false}, + "COLUMN_NAME": {Keyword: "COLUMN_NAME", Reserved: false}, + "COMMAND_FUNCTION": {Keyword: "COMMAND_FUNCTION", Reserved: false}, + "COMMAND_FUNCTION_CODE": {Keyword: "COMMAND_FUNCTION_CODE", Reserved: false}, + "COMMENT": {Keyword: "COMMENT", Reserved: false}, + "COMMENTS": {Keyword: "COMMENTS", Reserved: false}, + "COMMIT": {Keyword: "COMMIT", Reserved: false}, + "COMMITTED": {Keyword: "COMMITTED", Reserved: false}, + "COMPRESSION": {Keyword: "COMPRESSION", Reserved: false}, + "CONCURRENTLY": {Keyword: "CONCURRENTLY", Reserved: true}, + "CONDITION": {Keyword: "CONDITION", Reserved: false}, + "CONDITIONAL": {Keyword: "CONDITIONAL", Reserved: false}, + "CONDITION_NUMBER": {Keyword: "CONDITION_NUMBER", Reserved: false}, + "CONFIGURATION": {Keyword: "CONFIGURATION", Reserved: false}, + "CONFLICT": {Keyword: "CONFLICT", Reserved: false}, + "CONNECT": {Keyword: "CONNECT", Reserved: false}, + "CONNECTION": {Keyword: "CONNECTION", Reserved: false}, + "CONNECTION_NAME": {Keyword: "CONNECTION_NAME", Reserved: false}, + "CONSTRAINT": {Keyword: "CONSTRAINT", Reserved: true}, + "CONSTRAINTS": {Keyword: "CONSTRAINTS", Reserved: false}, + "CONSTRAINT_CATALOG": {Keyword: "CONSTRAINT_CATALOG", Reserved: false}, + "CONSTRAINT_NAME": {Keyword: "CONSTRAINT_NAME", Reserved: false}, + "CONSTRAINT_SCHEMA": {Keyword: "CONSTRAINT_SCHEMA", Reserved: false}, + "CONSTRUCTOR": {Keyword: "CONSTRUCTOR", Reserved: false}, + "CONTAINS": {Keyword: "CONTAINS", Reserved: false}, + "CONTENT": {Keyword: "CONTENT", Reserved: false}, + "CONTINUE": {Keyword: "CONTINUE", Reserved: false}, + "CONTROL": {Keyword: "CONTROL", Reserved: false}, + "CONVERSION": {Keyword: "CONVERSION", Reserved: false}, + "CONVERT": {Keyword: "CONVERT", Reserved: false}, + "COPARTITION": {Keyword: "COPARTITION", Reserved: false}, + "COPY": {Keyword: "COPY", Reserved: false}, + "CORR": {Keyword: "CORR", Reserved: false}, + "CORRESPONDING": {Keyword: "CORRESPONDING", Reserved: false}, + "COS": {Keyword: "COS", Reserved: false}, + "COSH": {Keyword: "COSH", Reserved: false}, + "COST": {Keyword: "COST", Reserved: false}, + "COUNT": {Keyword: "COUNT", Reserved: false}, + "COVAR_POP": {Keyword: "COVAR_POP", Reserved: false}, + "COVAR_SAMP": {Keyword: "COVAR_SAMP", Reserved: false}, + "CREATE": {Keyword: "CREATE", Reserved: true}, + "CROSS": {Keyword: "CROSS", Reserved: true}, + "CSV": {Keyword: "CSV", Reserved: false}, + "CUBE": {Keyword: "CUBE", Reserved: false}, + "CUME_DIST": {Keyword: "CUME_DIST", Reserved: false}, + "CURRENT": {Keyword: "CURRENT", Reserved: false}, + "CURRENT_CATALOG": {Keyword: "CURRENT_CATALOG", Reserved: true}, + "CURRENT_DATE": {Keyword: "CURRENT_DATE", Reserved: true}, + "CURRENT_DEFAULT_TRANSFORM_GROUP": {Keyword: "CURRENT_DEFAULT_TRANSFORM_GROUP", Reserved: false}, + "CURRENT_PATH": {Keyword: "CURRENT_PATH", Reserved: false}, + "CURRENT_ROLE": {Keyword: "CURRENT_ROLE", Reserved: true}, + "CURRENT_ROW": {Keyword: "CURRENT_ROW", Reserved: false}, + "CURRENT_SCHEMA": {Keyword: "CURRENT_SCHEMA", Reserved: true}, + "CURRENT_TIME": {Keyword: "CURRENT_TIME", Reserved: true}, + "CURRENT_TIMESTAMP": {Keyword: "CURRENT_TIMESTAMP", Reserved: true}, + "CURRENT_TRANSFORM_GROUP_FOR_TYPE": {Keyword: "CURRENT_TRANSFORM_GROUP_FOR_TYPE", Reserved: false}, + "CURRENT_USER": {Keyword: "CURRENT_USER", Reserved: true}, + "CURSOR": {Keyword: "CURSOR", Reserved: false}, + "CURSOR_NAME": {Keyword: "CURSOR_NAME", Reserved: false}, + "CYCLE": {Keyword: "CYCLE", Reserved: false}, + "DATA": {Keyword: "DATA", Reserved: false}, + "DATABASE": {Keyword: "DATABASE", Reserved: false}, + "DATALINK": {Keyword: "DATALINK", Reserved: false}, + "DATE": {Keyword: "DATE", Reserved: false}, + "DATETIME_INTERVAL_CODE": {Keyword: "DATETIME_INTERVAL_CODE", Reserved: false}, + "DATETIME_INTERVAL_PRECISION": {Keyword: "DATETIME_INTERVAL_PRECISION", Reserved: false}, + "DAY": {Keyword: "DAY", Reserved: false}, + "DB": {Keyword: "DB", Reserved: false}, + "DEALLOCATE": {Keyword: "DEALLOCATE", Reserved: false}, + "DEC": {Keyword: "DEC", Reserved: false}, + "DECFLOAT": {Keyword: "DECFLOAT", Reserved: false}, + "DECIMAL": {Keyword: "DECIMAL", Reserved: false}, + "DECLARE": {Keyword: "DECLARE", Reserved: false}, + "DEFAULT": {Keyword: "DEFAULT", Reserved: true}, + "DEFAULTS": {Keyword: "DEFAULTS", Reserved: false}, + "DEFERRABLE": {Keyword: "DEFERRABLE", Reserved: true}, + "DEFERRED": {Keyword: "DEFERRED", Reserved: false}, + "DEFINE": {Keyword: "DEFINE", Reserved: false}, + "DEFINED": {Keyword: "DEFINED", Reserved: false}, + "DEFINER": {Keyword: "DEFINER", Reserved: false}, + "DEGREE": {Keyword: "DEGREE", Reserved: false}, + "DELETE": {Keyword: "DELETE", Reserved: false}, + "DELIMITER": {Keyword: "DELIMITER", Reserved: false}, + "DELIMITERS": {Keyword: "DELIMITERS", Reserved: false}, + "DENSE_RANK": {Keyword: "DENSE_RANK", Reserved: false}, + "DEPENDS": {Keyword: "DEPENDS", Reserved: false}, + "DEPTH": {Keyword: "DEPTH", Reserved: false}, + "DEREF": {Keyword: "DEREF", Reserved: false}, + "DERIVED": {Keyword: "DERIVED", Reserved: false}, + "DESC": {Keyword: "DESC", Reserved: true}, + "DESCRIBE": {Keyword: "DESCRIBE", Reserved: false}, + "DESCRIPTOR": {Keyword: "DESCRIPTOR", Reserved: false}, + "DETACH": {Keyword: "DETACH", Reserved: false}, + "DETERMINISTIC": {Keyword: "DETERMINISTIC", Reserved: false}, + "DIAGNOSTICS": {Keyword: "DIAGNOSTICS", Reserved: false}, + "DICTIONARY": {Keyword: "DICTIONARY", Reserved: false}, + "DISABLE": {Keyword: "DISABLE", Reserved: false}, + "DISCARD": {Keyword: "DISCARD", Reserved: false}, + "DISCONNECT": {Keyword: "DISCONNECT", Reserved: false}, + "DISPATCH": {Keyword: "DISPATCH", Reserved: false}, + "DISTINCT": {Keyword: "DISTINCT", Reserved: true}, + "DLNEWCOPY": {Keyword: "DLNEWCOPY", Reserved: false}, + "DLPREVIOUSCOPY": {Keyword: "DLPREVIOUSCOPY", Reserved: false}, + "DLURLCOMPLETE": {Keyword: "DLURLCOMPLETE", Reserved: false}, + "DLURLCOMPLETEONLY": {Keyword: "DLURLCOMPLETEONLY", Reserved: false}, + "DLURLCOMPLETEWRITE": {Keyword: "DLURLCOMPLETEWRITE", Reserved: false}, + "DLURLPATH": {Keyword: "DLURLPATH", Reserved: false}, + "DLURLPATHONLY": {Keyword: "DLURLPATHONLY", Reserved: false}, + "DLURLPATHWRITE": {Keyword: "DLURLPATHWRITE", Reserved: false}, + "DLURLSCHEME": {Keyword: "DLURLSCHEME", Reserved: false}, + "DLURLSERVER": {Keyword: "DLURLSERVER", Reserved: false}, + "DLVALUE": {Keyword: "DLVALUE", Reserved: false}, + "DO": {Keyword: "DO", Reserved: true}, + "DOCUMENT": {Keyword: "DOCUMENT", Reserved: false}, + "DOMAIN": {Keyword: "DOMAIN", Reserved: false}, + "DOUBLE": {Keyword: "DOUBLE", Reserved: false}, + "DROP": {Keyword: "DROP", Reserved: false}, + "DYNAMIC": {Keyword: "DYNAMIC", Reserved: false}, + "DYNAMIC_FUNCTION": {Keyword: "DYNAMIC_FUNCTION", Reserved: false}, + "DYNAMIC_FUNCTION_CODE": {Keyword: "DYNAMIC_FUNCTION_CODE", Reserved: false}, + "EACH": {Keyword: "EACH", Reserved: false}, + "ELEMENT": {Keyword: "ELEMENT", Reserved: false}, + "ELSE": {Keyword: "ELSE", Reserved: true}, + "EMPTY": {Keyword: "EMPTY", Reserved: false}, + "ENABLE": {Keyword: "ENABLE", Reserved: false}, + "ENCODING": {Keyword: "ENCODING", Reserved: false}, + "ENCRYPTED": {Keyword: "ENCRYPTED", Reserved: false}, + "END": {Keyword: "END", Reserved: true}, + "END-EXEC": {Keyword: "END-EXEC", Reserved: false}, + "END_FRAME": {Keyword: "END_FRAME", Reserved: false}, + "END_PARTITION": {Keyword: "END_PARTITION", Reserved: false}, + "ENFORCED": {Keyword: "ENFORCED", Reserved: false}, + "ENUM": {Keyword: "ENUM", Reserved: false}, + "EQUALS": {Keyword: "EQUALS", Reserved: false}, + "ERROR": {Keyword: "ERROR", Reserved: false}, + "ESCAPE": {Keyword: "ESCAPE", Reserved: false}, + "EVENT": {Keyword: "EVENT", Reserved: false}, + "EVERY": {Keyword: "EVERY", Reserved: false}, + "EXCEPT": {Keyword: "EXCEPT", Reserved: true}, + "EXCEPTION": {Keyword: "EXCEPTION", Reserved: false}, + "EXCLUDE": {Keyword: "EXCLUDE", Reserved: false}, + "EXCLUDING": {Keyword: "EXCLUDING", Reserved: false}, + "EXCLUSIVE": {Keyword: "EXCLUSIVE", Reserved: false}, + "EXEC": {Keyword: "EXEC", Reserved: false}, + "EXECUTE": {Keyword: "EXECUTE", Reserved: false}, + "EXISTS": {Keyword: "EXISTS", Reserved: false}, + "EXP": {Keyword: "EXP", Reserved: false}, + "EXPLAIN": {Keyword: "EXPLAIN", Reserved: false}, + "EXPRESSION": {Keyword: "EXPRESSION", Reserved: false}, + "EXTENSION": {Keyword: "EXTENSION", Reserved: false}, + "EXTERNAL": {Keyword: "EXTERNAL", Reserved: false}, + "EXTRACT": {Keyword: "EXTRACT", Reserved: false}, + "FALSE": {Keyword: "FALSE", Reserved: true}, + "FAMILY": {Keyword: "FAMILY", Reserved: false}, + "FETCH": {Keyword: "FETCH", Reserved: true}, + "FILE": {Keyword: "FILE", Reserved: false}, + "FILTER": {Keyword: "FILTER", Reserved: false}, + "FINAL": {Keyword: "FINAL", Reserved: false}, + "FINALIZE": {Keyword: "FINALIZE", Reserved: false}, + "FINISH": {Keyword: "FINISH", Reserved: false}, + "FIRST": {Keyword: "FIRST", Reserved: false}, + "FIRST_VALUE": {Keyword: "FIRST_VALUE", Reserved: false}, + "FLAG": {Keyword: "FLAG", Reserved: false}, + "FLOAT": {Keyword: "FLOAT", Reserved: false}, + "FLOOR": {Keyword: "FLOOR", Reserved: false}, + "FOLLOWING": {Keyword: "FOLLOWING", Reserved: false}, + "FOR": {Keyword: "FOR", Reserved: true}, + "FORCE": {Keyword: "FORCE", Reserved: false}, + "FOREIGN": {Keyword: "FOREIGN", Reserved: true}, + "FORMAT": {Keyword: "FORMAT", Reserved: false}, + "FORTRAN": {Keyword: "FORTRAN", Reserved: false}, + "FORWARD": {Keyword: "FORWARD", Reserved: false}, + "FOUND": {Keyword: "FOUND", Reserved: false}, + "FRAME_ROW": {Keyword: "FRAME_ROW", Reserved: false}, + "FREE": {Keyword: "FREE", Reserved: false}, + "FREEZE": {Keyword: "FREEZE", Reserved: true}, + "FROM": {Keyword: "FROM", Reserved: true}, + "FS": {Keyword: "FS", Reserved: false}, + "FULFILL": {Keyword: "FULFILL", Reserved: false}, + "FULL": {Keyword: "FULL", Reserved: true}, + "FUNCTION": {Keyword: "FUNCTION", Reserved: false}, + "FUNCTIONS": {Keyword: "FUNCTIONS", Reserved: false}, + "FUSION": {Keyword: "FUSION", Reserved: false}, + "G": {Keyword: "G", Reserved: false}, + "GENERAL": {Keyword: "GENERAL", Reserved: false}, + "GENERATED": {Keyword: "GENERATED", Reserved: false}, + "GET": {Keyword: "GET", Reserved: false}, + "GLOBAL": {Keyword: "GLOBAL", Reserved: false}, + "GO": {Keyword: "GO", Reserved: false}, + "GOTO": {Keyword: "GOTO", Reserved: false}, + "GRANT": {Keyword: "GRANT", Reserved: true}, + "GRANTED": {Keyword: "GRANTED", Reserved: false}, + "GREATEST": {Keyword: "GREATEST", Reserved: false}, + "GROUP": {Keyword: "GROUP", Reserved: true}, + "GROUPING": {Keyword: "GROUPING", Reserved: false}, + "GROUPS": {Keyword: "GROUPS", Reserved: false}, + "HANDLER": {Keyword: "HANDLER", Reserved: false}, + "HAVING": {Keyword: "HAVING", Reserved: true}, + "HEADER": {Keyword: "HEADER", Reserved: false}, + "HEX": {Keyword: "HEX", Reserved: false}, + "HIERARCHY": {Keyword: "HIERARCHY", Reserved: false}, + "HOLD": {Keyword: "HOLD", Reserved: false}, + "HOUR": {Keyword: "HOUR", Reserved: false}, + "ID": {Keyword: "ID", Reserved: false}, + "IDENTITY": {Keyword: "IDENTITY", Reserved: false}, + "IF": {Keyword: "IF", Reserved: false}, + "IGNORE": {Keyword: "IGNORE", Reserved: false}, + "ILIKE": {Keyword: "ILIKE", Reserved: true}, + "IMMEDIATE": {Keyword: "IMMEDIATE", Reserved: false}, + "IMMEDIATELY": {Keyword: "IMMEDIATELY", Reserved: false}, + "IMMUTABLE": {Keyword: "IMMUTABLE", Reserved: false}, + "IMPLEMENTATION": {Keyword: "IMPLEMENTATION", Reserved: false}, + "IMPLICIT": {Keyword: "IMPLICIT", Reserved: false}, + "IMPORT": {Keyword: "IMPORT", Reserved: false}, + "IN": {Keyword: "IN", Reserved: true}, + "INCLUDE": {Keyword: "INCLUDE", Reserved: false}, + "INCLUDING": {Keyword: "INCLUDING", Reserved: false}, + "INCREMENT": {Keyword: "INCREMENT", Reserved: false}, + "INDENT": {Keyword: "INDENT", Reserved: false}, + "INDEX": {Keyword: "INDEX", Reserved: false}, + "INDEXES": {Keyword: "INDEXES", Reserved: false}, + "INDICATOR": {Keyword: "INDICATOR", Reserved: false}, + "INHERIT": {Keyword: "INHERIT", Reserved: false}, + "INHERITS": {Keyword: "INHERITS", Reserved: false}, + "INITIAL": {Keyword: "INITIAL", Reserved: false}, + "INITIALLY": {Keyword: "INITIALLY", Reserved: true}, + "INLINE": {Keyword: "INLINE", Reserved: false}, + "INNER": {Keyword: "INNER", Reserved: true}, + "INOUT": {Keyword: "INOUT", Reserved: false}, + "INPUT": {Keyword: "INPUT", Reserved: false}, + "INSENSITIVE": {Keyword: "INSENSITIVE", Reserved: false}, + "INSERT": {Keyword: "INSERT", Reserved: false}, + "INSTANCE": {Keyword: "INSTANCE", Reserved: false}, + "INSTANTIABLE": {Keyword: "INSTANTIABLE", Reserved: false}, + "INSTEAD": {Keyword: "INSTEAD", Reserved: false}, + "INT": {Keyword: "INT", Reserved: false}, + "INTEGER": {Keyword: "INTEGER", Reserved: false}, + "INTEGRITY": {Keyword: "INTEGRITY", Reserved: false}, + "INTERSECT": {Keyword: "INTERSECT", Reserved: true}, + "INTERSECTION": {Keyword: "INTERSECTION", Reserved: false}, + "INTERVAL": {Keyword: "INTERVAL", Reserved: false}, + "INTO": {Keyword: "INTO", Reserved: true}, + "INVOKER": {Keyword: "INVOKER", Reserved: false}, + "IS": {Keyword: "IS", Reserved: true}, + "ISNULL": {Keyword: "ISNULL", Reserved: false}, + "ISOLATION": {Keyword: "ISOLATION", Reserved: false}, + "JOIN": {Keyword: "JOIN", Reserved: true}, + "JSON": {Keyword: "JSON", Reserved: false}, + "JSON_ARRAY": {Keyword: "JSON_ARRAY", Reserved: false}, + "JSON_ARRAYAGG": {Keyword: "JSON_ARRAYAGG", Reserved: false}, + "JSON_EXISTS": {Keyword: "JSON_EXISTS", Reserved: false}, + "JSON_OBJECT": {Keyword: "JSON_OBJECT", Reserved: false}, + "JSON_OBJECTAGG": {Keyword: "JSON_OBJECTAGG", Reserved: false}, + "JSON_QUERY": {Keyword: "JSON_QUERY", Reserved: false}, + "JSON_SCALAR": {Keyword: "JSON_SCALAR", Reserved: false}, + "JSON_SERIALIZE": {Keyword: "JSON_SERIALIZE", Reserved: false}, + "JSON_TABLE": {Keyword: "JSON_TABLE", Reserved: false}, + "JSON_TABLE_PRIMITIVE": {Keyword: "JSON_TABLE_PRIMITIVE", Reserved: false}, + "JSON_VALUE": {Keyword: "JSON_VALUE", Reserved: false}, + "K": {Keyword: "K", Reserved: false}, + "KEEP": {Keyword: "KEEP", Reserved: false}, + "KEY": {Keyword: "KEY", Reserved: false}, + "KEYS": {Keyword: "KEYS", Reserved: false}, + "KEY_MEMBER": {Keyword: "KEY_MEMBER", Reserved: false}, + "KEY_TYPE": {Keyword: "KEY_TYPE", Reserved: false}, + "LABEL": {Keyword: "LABEL", Reserved: false}, + "LAG": {Keyword: "LAG", Reserved: false}, + "LANGUAGE": {Keyword: "LANGUAGE", Reserved: false}, + "LARGE": {Keyword: "LARGE", Reserved: false}, + "LAST": {Keyword: "LAST", Reserved: false}, + "LAST_VALUE": {Keyword: "LAST_VALUE", Reserved: false}, + "LATERAL": {Keyword: "LATERAL", Reserved: true}, + "LEAD": {Keyword: "LEAD", Reserved: false}, + "LEADING": {Keyword: "LEADING", Reserved: true}, + "LEAKPROOF": {Keyword: "LEAKPROOF", Reserved: false}, + "LEAST": {Keyword: "LEAST", Reserved: false}, + "LEFT": {Keyword: "LEFT", Reserved: true}, + "LENGTH": {Keyword: "LENGTH", Reserved: false}, + "LEVEL": {Keyword: "LEVEL", Reserved: false}, + "LIBRARY": {Keyword: "LIBRARY", Reserved: false}, + "LIKE": {Keyword: "LIKE", Reserved: true}, + "LIKE_REGEX": {Keyword: "LIKE_REGEX", Reserved: false}, + "LIMIT": {Keyword: "LIMIT", Reserved: true}, + "LINK": {Keyword: "LINK", Reserved: false}, + "LISTAGG": {Keyword: "LISTAGG", Reserved: false}, + "LISTEN": {Keyword: "LISTEN", Reserved: false}, + "LN": {Keyword: "LN", Reserved: false}, + "LOAD": {Keyword: "LOAD", Reserved: false}, + "LOCAL": {Keyword: "LOCAL", Reserved: false}, + "LOCALTIME": {Keyword: "LOCALTIME", Reserved: true}, + "LOCALTIMESTAMP": {Keyword: "LOCALTIMESTAMP", Reserved: true}, + "LOCATION": {Keyword: "LOCATION", Reserved: false}, + "LOCATOR": {Keyword: "LOCATOR", Reserved: false}, + "LOCK": {Keyword: "LOCK", Reserved: false}, + "LOCKED": {Keyword: "LOCKED", Reserved: false}, + "LOG": {Keyword: "LOG", Reserved: false}, + "LOG10": {Keyword: "LOG10", Reserved: false}, + "LOGGED": {Keyword: "LOGGED", Reserved: false}, + "LOWER": {Keyword: "LOWER", Reserved: false}, + "LPAD": {Keyword: "LPAD", Reserved: false}, + "LTRIM": {Keyword: "LTRIM", Reserved: false}, + "M": {Keyword: "M", Reserved: false}, + "MAP": {Keyword: "MAP", Reserved: false}, + "MAPPING": {Keyword: "MAPPING", Reserved: false}, + "MATCH": {Keyword: "MATCH", Reserved: false}, + "MATCHED": {Keyword: "MATCHED", Reserved: false}, + "MATCHES": {Keyword: "MATCHES", Reserved: false}, + "MATCH_NUMBER": {Keyword: "MATCH_NUMBER", Reserved: false}, + "MATCH_RECOGNIZE": {Keyword: "MATCH_RECOGNIZE", Reserved: false}, + "MATERIALIZED": {Keyword: "MATERIALIZED", Reserved: false}, + "MAX": {Keyword: "MAX", Reserved: false}, + "MAXVALUE": {Keyword: "MAXVALUE", Reserved: false}, + "MEASURES": {Keyword: "MEASURES", Reserved: false}, + "MEMBER": {Keyword: "MEMBER", Reserved: false}, + "MERGE": {Keyword: "MERGE", Reserved: false}, + "MERGE_ACTION": {Keyword: "MERGE_ACTION", Reserved: false}, + "MESSAGE_LENGTH": {Keyword: "MESSAGE_LENGTH", Reserved: false}, + "MESSAGE_OCTET_LENGTH": {Keyword: "MESSAGE_OCTET_LENGTH", Reserved: false}, + "MESSAGE_TEXT": {Keyword: "MESSAGE_TEXT", Reserved: false}, + "METHOD": {Keyword: "METHOD", Reserved: false}, + "MIN": {Keyword: "MIN", Reserved: false}, + "MINUTE": {Keyword: "MINUTE", Reserved: false}, + "MINVALUE": {Keyword: "MINVALUE", Reserved: false}, + "MOD": {Keyword: "MOD", Reserved: false}, + "MODE": {Keyword: "MODE", Reserved: false}, + "MODIFIES": {Keyword: "MODIFIES", Reserved: false}, + "MODULE": {Keyword: "MODULE", Reserved: false}, + "MONTH": {Keyword: "MONTH", Reserved: false}, + "MORE": {Keyword: "MORE", Reserved: false}, + "MOVE": {Keyword: "MOVE", Reserved: false}, + "MULTISET": {Keyword: "MULTISET", Reserved: false}, + "MUMPS": {Keyword: "MUMPS", Reserved: false}, + "NAME": {Keyword: "NAME", Reserved: false}, + "NAMES": {Keyword: "NAMES", Reserved: false}, + "NAMESPACE": {Keyword: "NAMESPACE", Reserved: false}, + "NATIONAL": {Keyword: "NATIONAL", Reserved: false}, + "NATURAL": {Keyword: "NATURAL", Reserved: true}, + "NCHAR": {Keyword: "NCHAR", Reserved: false}, + "NCLOB": {Keyword: "NCLOB", Reserved: false}, + "NESTED": {Keyword: "NESTED", Reserved: false}, + "NESTING": {Keyword: "NESTING", Reserved: false}, + "NEW": {Keyword: "NEW", Reserved: false}, + "NEXT": {Keyword: "NEXT", Reserved: false}, + "NFC": {Keyword: "NFC", Reserved: false}, + "NFD": {Keyword: "NFD", Reserved: false}, + "NFKC": {Keyword: "NFKC", Reserved: false}, + "NFKD": {Keyword: "NFKD", Reserved: false}, + "NIL": {Keyword: "NIL", Reserved: false}, + "NO": {Keyword: "NO", Reserved: false}, + "NONE": {Keyword: "NONE", Reserved: false}, + "NORMALIZE": {Keyword: "NORMALIZE", Reserved: false}, + "NORMALIZED": {Keyword: "NORMALIZED", Reserved: false}, + "NOT": {Keyword: "NOT", Reserved: true}, + "NOTHING": {Keyword: "NOTHING", Reserved: false}, + "NOTIFY": {Keyword: "NOTIFY", Reserved: false}, + "NOTNULL": {Keyword: "NOTNULL", Reserved: false}, + "NOWAIT": {Keyword: "NOWAIT", Reserved: false}, + "NTH_VALUE": {Keyword: "NTH_VALUE", Reserved: false}, + "NTILE": {Keyword: "NTILE", Reserved: false}, + "NULL": {Keyword: "NULL", Reserved: true}, + "NULLABLE": {Keyword: "NULLABLE", Reserved: false}, + "NULLIF": {Keyword: "NULLIF", Reserved: false}, + "NULLS": {Keyword: "NULLS", Reserved: false}, + "NULL_ORDERING": {Keyword: "NULL_ORDERING", Reserved: false}, + "NUMBER": {Keyword: "NUMBER", Reserved: false}, + "NUMERIC": {Keyword: "NUMERIC", Reserved: false}, + "OBJECT": {Keyword: "OBJECT", Reserved: false}, + "OCCURRENCE": {Keyword: "OCCURRENCE", Reserved: false}, + "OCCURRENCES_REGEX": {Keyword: "OCCURRENCES_REGEX", Reserved: false}, + "OCTETS": {Keyword: "OCTETS", Reserved: false}, + "OCTET_LENGTH": {Keyword: "OCTET_LENGTH", Reserved: false}, + "OF": {Keyword: "OF", Reserved: false}, + "OFF": {Keyword: "OFF", Reserved: false}, + "OFFSET": {Keyword: "OFFSET", Reserved: true}, + "OIDS": {Keyword: "OIDS", Reserved: false}, + "OLD": {Keyword: "OLD", Reserved: false}, + "OMIT": {Keyword: "OMIT", Reserved: false}, + "ON": {Keyword: "ON", Reserved: true}, + "ONE": {Keyword: "ONE", Reserved: false}, + "ONLY": {Keyword: "ONLY", Reserved: true}, + "OPEN": {Keyword: "OPEN", Reserved: false}, + "OPERATOR": {Keyword: "OPERATOR", Reserved: false}, + "OPTION": {Keyword: "OPTION", Reserved: false}, + "OPTIONS": {Keyword: "OPTIONS", Reserved: false}, + "OR": {Keyword: "OR", Reserved: true}, + "ORDER": {Keyword: "ORDER", Reserved: true}, + "ORDERING": {Keyword: "ORDERING", Reserved: false}, + "ORDINALITY": {Keyword: "ORDINALITY", Reserved: false}, + "OTHERS": {Keyword: "OTHERS", Reserved: false}, + "OUT": {Keyword: "OUT", Reserved: false}, + "OUTER": {Keyword: "OUTER", Reserved: true}, + "OUTPUT": {Keyword: "OUTPUT", Reserved: false}, + "OVER": {Keyword: "OVER", Reserved: false}, + "OVERFLOW": {Keyword: "OVERFLOW", Reserved: false}, + "OVERLAPS": {Keyword: "OVERLAPS", Reserved: false}, + "OVERLAY": {Keyword: "OVERLAY", Reserved: false}, + "OVERRIDING": {Keyword: "OVERRIDING", Reserved: false}, + "OWNED": {Keyword: "OWNED", Reserved: false}, + "OWNER": {Keyword: "OWNER", Reserved: false}, + "P": {Keyword: "P", Reserved: false}, + "PAD": {Keyword: "PAD", Reserved: false}, + "PARALLEL": {Keyword: "PARALLEL", Reserved: false}, + "PARAMETER": {Keyword: "PARAMETER", Reserved: false}, + "PARAMETER_MODE": {Keyword: "PARAMETER_MODE", Reserved: false}, + "PARAMETER_NAME": {Keyword: "PARAMETER_NAME", Reserved: false}, + "PARAMETER_ORDINAL_POSITION": {Keyword: "PARAMETER_ORDINAL_POSITION", Reserved: false}, + "PARAMETER_SPECIFIC_CATALOG": {Keyword: "PARAMETER_SPECIFIC_CATALOG", Reserved: false}, + "PARAMETER_SPECIFIC_NAME": {Keyword: "PARAMETER_SPECIFIC_NAME", Reserved: false}, + "PARAMETER_SPECIFIC_SCHEMA": {Keyword: "PARAMETER_SPECIFIC_SCHEMA", Reserved: false}, + "PARSER": {Keyword: "PARSER", Reserved: false}, + "PARTIAL": {Keyword: "PARTIAL", Reserved: false}, + "PARTITION": {Keyword: "PARTITION", Reserved: false}, + "PASCAL": {Keyword: "PASCAL", Reserved: false}, + "PASS": {Keyword: "PASS", Reserved: false}, + "PASSING": {Keyword: "PASSING", Reserved: false}, + "PASSTHROUGH": {Keyword: "PASSTHROUGH", Reserved: false}, + "PASSWORD": {Keyword: "PASSWORD", Reserved: false}, + "PAST": {Keyword: "PAST", Reserved: false}, + "PATH": {Keyword: "PATH", Reserved: false}, + "PATTERN": {Keyword: "PATTERN", Reserved: false}, + "PER": {Keyword: "PER", Reserved: false}, + "PERCENT": {Keyword: "PERCENT", Reserved: false}, + "PERCENTILE_CONT": {Keyword: "PERCENTILE_CONT", Reserved: false}, + "PERCENTILE_DISC": {Keyword: "PERCENTILE_DISC", Reserved: false}, + "PERCENT_RANK": {Keyword: "PERCENT_RANK", Reserved: false}, + "PERIOD": {Keyword: "PERIOD", Reserved: false}, + "PERMISSION": {Keyword: "PERMISSION", Reserved: false}, + "PERMUTE": {Keyword: "PERMUTE", Reserved: false}, + "PIPE": {Keyword: "PIPE", Reserved: false}, + "PLACING": {Keyword: "PLACING", Reserved: true}, + "PLAN": {Keyword: "PLAN", Reserved: false}, + "PLANS": {Keyword: "PLANS", Reserved: false}, + "PLI": {Keyword: "PLI", Reserved: false}, + "POLICY": {Keyword: "POLICY", Reserved: false}, + "PORTION": {Keyword: "PORTION", Reserved: false}, + "POSITION": {Keyword: "POSITION", Reserved: false}, + "POSITION_REGEX": {Keyword: "POSITION_REGEX", Reserved: false}, + "POWER": {Keyword: "POWER", Reserved: false}, + "PRECEDES": {Keyword: "PRECEDES", Reserved: false}, + "PRECEDING": {Keyword: "PRECEDING", Reserved: false}, + "PRECISION": {Keyword: "PRECISION", Reserved: false}, + "PREPARE": {Keyword: "PREPARE", Reserved: false}, + "PREPARED": {Keyword: "PREPARED", Reserved: false}, + "PRESERVE": {Keyword: "PRESERVE", Reserved: false}, + "PREV": {Keyword: "PREV", Reserved: false}, + "PRIMARY": {Keyword: "PRIMARY", Reserved: true}, + "PRIOR": {Keyword: "PRIOR", Reserved: false}, + "PRIVATE": {Keyword: "PRIVATE", Reserved: false}, + "PRIVILEGES": {Keyword: "PRIVILEGES", Reserved: false}, + "PROCEDURAL": {Keyword: "PROCEDURAL", Reserved: false}, + "PROCEDURE": {Keyword: "PROCEDURE", Reserved: false}, + "PROCEDURES": {Keyword: "PROCEDURES", Reserved: false}, + "PROGRAM": {Keyword: "PROGRAM", Reserved: false}, + "PRUNE": {Keyword: "PRUNE", Reserved: false}, + "PTF": {Keyword: "PTF", Reserved: false}, + "PUBLIC": {Keyword: "PUBLIC", Reserved: false}, + "PUBLICATION": {Keyword: "PUBLICATION", Reserved: false}, + "QUOTE": {Keyword: "QUOTE", Reserved: false}, + "QUOTES": {Keyword: "QUOTES", Reserved: false}, + "RANGE": {Keyword: "RANGE", Reserved: false}, + "RANK": {Keyword: "RANK", Reserved: false}, + "READ": {Keyword: "READ", Reserved: false}, + "READS": {Keyword: "READS", Reserved: false}, + "REAL": {Keyword: "REAL", Reserved: false}, + "REASSIGN": {Keyword: "REASSIGN", Reserved: false}, + "RECHECK": {Keyword: "RECHECK", Reserved: false}, + "RECOVERY": {Keyword: "RECOVERY", Reserved: false}, + "RECURSIVE": {Keyword: "RECURSIVE", Reserved: false}, + "REF": {Keyword: "REF", Reserved: false}, + "REFERENCES": {Keyword: "REFERENCES", Reserved: true}, + "REFERENCING": {Keyword: "REFERENCING", Reserved: false}, + "REFRESH": {Keyword: "REFRESH", Reserved: false}, + "REGR_AVGX": {Keyword: "REGR_AVGX", Reserved: false}, + "REGR_AVGY": {Keyword: "REGR_AVGY", Reserved: false}, + "REGR_COUNT": {Keyword: "REGR_COUNT", Reserved: false}, + "REGR_INTERCEPT": {Keyword: "REGR_INTERCEPT", Reserved: false}, + "REGR_R2": {Keyword: "REGR_R2", Reserved: false}, + "REGR_SLOPE": {Keyword: "REGR_SLOPE", Reserved: false}, + "REGR_SXX": {Keyword: "REGR_SXX", Reserved: false}, + "REGR_SXY": {Keyword: "REGR_SXY", Reserved: false}, + "REGR_SYY": {Keyword: "REGR_SYY", Reserved: false}, + "REINDEX": {Keyword: "REINDEX", Reserved: false}, + "RELATIVE": {Keyword: "RELATIVE", Reserved: false}, + "RELEASE": {Keyword: "RELEASE", Reserved: false}, + "RENAME": {Keyword: "RENAME", Reserved: false}, + "REPEATABLE": {Keyword: "REPEATABLE", Reserved: false}, + "REPLACE": {Keyword: "REPLACE", Reserved: false}, + "REPLICA": {Keyword: "REPLICA", Reserved: false}, + "REQUIRING": {Keyword: "REQUIRING", Reserved: false}, + "RESET": {Keyword: "RESET", Reserved: false}, + "RESPECT": {Keyword: "RESPECT", Reserved: false}, + "RESTART": {Keyword: "RESTART", Reserved: false}, + "RESTORE": {Keyword: "RESTORE", Reserved: false}, + "RESTRICT": {Keyword: "RESTRICT", Reserved: false}, + "RESULT": {Keyword: "RESULT", Reserved: false}, + "RETURN": {Keyword: "RETURN", Reserved: false}, + "RETURNED_CARDINALITY": {Keyword: "RETURNED_CARDINALITY", Reserved: false}, + "RETURNED_LENGTH": {Keyword: "RETURNED_LENGTH", Reserved: false}, + "RETURNED_OCTET_LENGTH": {Keyword: "RETURNED_OCTET_LENGTH", Reserved: false}, + "RETURNED_SQLSTATE": {Keyword: "RETURNED_SQLSTATE", Reserved: false}, + "RETURNING": {Keyword: "RETURNING", Reserved: true}, + "RETURNS": {Keyword: "RETURNS", Reserved: false}, + "REVOKE": {Keyword: "REVOKE", Reserved: false}, + "RIGHT": {Keyword: "RIGHT", Reserved: true}, + "ROLE": {Keyword: "ROLE", Reserved: false}, + "ROLLBACK": {Keyword: "ROLLBACK", Reserved: false}, + "ROLLUP": {Keyword: "ROLLUP", Reserved: false}, + "ROUTINE": {Keyword: "ROUTINE", Reserved: false}, + "ROUTINES": {Keyword: "ROUTINES", Reserved: false}, + "ROUTINE_CATALOG": {Keyword: "ROUTINE_CATALOG", Reserved: false}, + "ROUTINE_NAME": {Keyword: "ROUTINE_NAME", Reserved: false}, + "ROUTINE_SCHEMA": {Keyword: "ROUTINE_SCHEMA", Reserved: false}, + "ROW": {Keyword: "ROW", Reserved: false}, + "ROWS": {Keyword: "ROWS", Reserved: false}, + "ROW_COUNT": {Keyword: "ROW_COUNT", Reserved: false}, + "ROW_NUMBER": {Keyword: "ROW_NUMBER", Reserved: false}, + "RPAD": {Keyword: "RPAD", Reserved: false}, + "RTRIM": {Keyword: "RTRIM", Reserved: false}, + "RULE": {Keyword: "RULE", Reserved: false}, + "RUNNING": {Keyword: "RUNNING", Reserved: false}, + "SAVEPOINT": {Keyword: "SAVEPOINT", Reserved: false}, + "SCALAR": {Keyword: "SCALAR", Reserved: false}, + "SCALE": {Keyword: "SCALE", Reserved: false}, + "SCHEMA": {Keyword: "SCHEMA", Reserved: false}, + "SCHEMAS": {Keyword: "SCHEMAS", Reserved: false}, + "SCHEMA_NAME": {Keyword: "SCHEMA_NAME", Reserved: false}, + "SCOPE": {Keyword: "SCOPE", Reserved: false}, + "SCOPE_CATALOG": {Keyword: "SCOPE_CATALOG", Reserved: false}, + "SCOPE_NAME": {Keyword: "SCOPE_NAME", Reserved: false}, + "SCOPE_SCHEMA": {Keyword: "SCOPE_SCHEMA", Reserved: false}, + "SCROLL": {Keyword: "SCROLL", Reserved: false}, + "SEARCH": {Keyword: "SEARCH", Reserved: false}, + "SECOND": {Keyword: "SECOND", Reserved: false}, + "SECTION": {Keyword: "SECTION", Reserved: false}, + "SECURITY": {Keyword: "SECURITY", Reserved: false}, + "SEEK": {Keyword: "SEEK", Reserved: false}, + "SELECT": {Keyword: "SELECT", Reserved: true}, + "SELECTIVE": {Keyword: "SELECTIVE", Reserved: false}, + "SELF": {Keyword: "SELF", Reserved: false}, + "SEMANTICS": {Keyword: "SEMANTICS", Reserved: false}, + "SENSITIVE": {Keyword: "SENSITIVE", Reserved: false}, + "SEQUENCE": {Keyword: "SEQUENCE", Reserved: false}, + "SEQUENCES": {Keyword: "SEQUENCES", Reserved: false}, + "SERIALIZABLE": {Keyword: "SERIALIZABLE", Reserved: false}, + "SERVER": {Keyword: "SERVER", Reserved: false}, + "SERVER_NAME": {Keyword: "SERVER_NAME", Reserved: false}, + "SESSION": {Keyword: "SESSION", Reserved: false}, + "SESSION_USER": {Keyword: "SESSION_USER", Reserved: true}, + "SET": {Keyword: "SET", Reserved: false}, + "SETOF": {Keyword: "SETOF", Reserved: false}, + "SETS": {Keyword: "SETS", Reserved: false}, + "SHARE": {Keyword: "SHARE", Reserved: false}, + "SHOW": {Keyword: "SHOW", Reserved: false}, + "SIMILAR": {Keyword: "SIMILAR", Reserved: true}, + "SIMPLE": {Keyword: "SIMPLE", Reserved: false}, + "SIN": {Keyword: "SIN", Reserved: false}, + "SINH": {Keyword: "SINH", Reserved: false}, + "SIZE": {Keyword: "SIZE", Reserved: false}, + "SKIP": {Keyword: "SKIP", Reserved: false}, + "SMALLINT": {Keyword: "SMALLINT", Reserved: false}, + "SNAPSHOT": {Keyword: "SNAPSHOT", Reserved: false}, + "SOME": {Keyword: "SOME", Reserved: true}, + "SORT_DIRECTION": {Keyword: "SORT_DIRECTION", Reserved: false}, + "SOURCE": {Keyword: "SOURCE", Reserved: false}, + "SPACE": {Keyword: "SPACE", Reserved: false}, + "SPECIFIC": {Keyword: "SPECIFIC", Reserved: false}, + "SPECIFICTYPE": {Keyword: "SPECIFICTYPE", Reserved: false}, + "SPECIFIC_NAME": {Keyword: "SPECIFIC_NAME", Reserved: false}, + "SQL": {Keyword: "SQL", Reserved: false}, + "SQLCODE": {Keyword: "SQLCODE", Reserved: false}, + "SQLERROR": {Keyword: "SQLERROR", Reserved: false}, + "SQLEXCEPTION": {Keyword: "SQLEXCEPTION", Reserved: false}, + "SQLSTATE": {Keyword: "SQLSTATE", Reserved: false}, + "SQLWARNING": {Keyword: "SQLWARNING", Reserved: false}, + "SQRT": {Keyword: "SQRT", Reserved: false}, + "STABLE": {Keyword: "STABLE", Reserved: false}, + "STANDALONE": {Keyword: "STANDALONE", Reserved: false}, + "START": {Keyword: "START", Reserved: false}, + "STATE": {Keyword: "STATE", Reserved: false}, + "STATEMENT": {Keyword: "STATEMENT", Reserved: false}, + "STATIC": {Keyword: "STATIC", Reserved: false}, + "STATISTICS": {Keyword: "STATISTICS", Reserved: false}, + "STDDEV_POP": {Keyword: "STDDEV_POP", Reserved: false}, + "STDDEV_SAMP": {Keyword: "STDDEV_SAMP", Reserved: false}, + "STDIN": {Keyword: "STDIN", Reserved: false}, + "STDOUT": {Keyword: "STDOUT", Reserved: false}, + "STORAGE": {Keyword: "STORAGE", Reserved: false}, + "STORED": {Keyword: "STORED", Reserved: false}, + "STRICT": {Keyword: "STRICT", Reserved: false}, + "STRING": {Keyword: "STRING", Reserved: false}, + "STRIP": {Keyword: "STRIP", Reserved: false}, + "STRUCTURE": {Keyword: "STRUCTURE", Reserved: false}, + "STYLE": {Keyword: "STYLE", Reserved: false}, + "SUBCLASS_ORIGIN": {Keyword: "SUBCLASS_ORIGIN", Reserved: false}, + "SUBMULTISET": {Keyword: "SUBMULTISET", Reserved: false}, + "SUBSCRIPTION": {Keyword: "SUBSCRIPTION", Reserved: false}, + "SUBSET": {Keyword: "SUBSET", Reserved: false}, + "SUBSTRING": {Keyword: "SUBSTRING", Reserved: false}, + "SUBSTRING_REGEX": {Keyword: "SUBSTRING_REGEX", Reserved: false}, + "SUCCEEDS": {Keyword: "SUCCEEDS", Reserved: false}, + "SUM": {Keyword: "SUM", Reserved: false}, + "SUPPORT": {Keyword: "SUPPORT", Reserved: false}, + "SYMMETRIC": {Keyword: "SYMMETRIC", Reserved: true}, + "SYSID": {Keyword: "SYSID", Reserved: false}, + "SYSTEM": {Keyword: "SYSTEM", Reserved: false}, + "SYSTEM_TIME": {Keyword: "SYSTEM_TIME", Reserved: false}, + "SYSTEM_USER": {Keyword: "SYSTEM_USER", Reserved: true}, + "T": {Keyword: "T", Reserved: false}, + "TABLE": {Keyword: "TABLE", Reserved: true}, + "TABLES": {Keyword: "TABLES", Reserved: false}, + "TABLESAMPLE": {Keyword: "TABLESAMPLE", Reserved: true}, + "TABLESPACE": {Keyword: "TABLESPACE", Reserved: false}, + "TABLE_NAME": {Keyword: "TABLE_NAME", Reserved: false}, + "TAN": {Keyword: "TAN", Reserved: false}, + "TANH": {Keyword: "TANH", Reserved: false}, + "TARGET": {Keyword: "TARGET", Reserved: false}, + "TEMP": {Keyword: "TEMP", Reserved: false}, + "TEMPLATE": {Keyword: "TEMPLATE", Reserved: false}, + "TEMPORARY": {Keyword: "TEMPORARY", Reserved: false}, + "TEXT": {Keyword: "TEXT", Reserved: false}, + "THEN": {Keyword: "THEN", Reserved: true}, + "THROUGH": {Keyword: "THROUGH", Reserved: false}, + "TIES": {Keyword: "TIES", Reserved: false}, + "TIME": {Keyword: "TIME", Reserved: false}, + "TIMESTAMP": {Keyword: "TIMESTAMP", Reserved: false}, + "TIMEZONE_HOUR": {Keyword: "TIMEZONE_HOUR", Reserved: false}, + "TIMEZONE_MINUTE": {Keyword: "TIMEZONE_MINUTE", Reserved: false}, + "TO": {Keyword: "TO", Reserved: true}, + "TOKEN": {Keyword: "TOKEN", Reserved: false}, + "TOP_LEVEL_COUNT": {Keyword: "TOP_LEVEL_COUNT", Reserved: false}, + "TRAILING": {Keyword: "TRAILING", Reserved: true}, + "TRANSACTION": {Keyword: "TRANSACTION", Reserved: false}, + "TRANSACTIONS_COMMITTED": {Keyword: "TRANSACTIONS_COMMITTED", Reserved: false}, + "TRANSACTIONS_ROLLED_BACK": {Keyword: "TRANSACTIONS_ROLLED_BACK", Reserved: false}, + "TRANSACTION_ACTIVE": {Keyword: "TRANSACTION_ACTIVE", Reserved: false}, + "TRANSFORM": {Keyword: "TRANSFORM", Reserved: false}, + "TRANSFORMS": {Keyword: "TRANSFORMS", Reserved: false}, + "TRANSLATE": {Keyword: "TRANSLATE", Reserved: false}, + "TRANSLATE_REGEX": {Keyword: "TRANSLATE_REGEX", Reserved: false}, + "TRANSLATION": {Keyword: "TRANSLATION", Reserved: false}, + "TREAT": {Keyword: "TREAT", Reserved: false}, + "TRIGGER": {Keyword: "TRIGGER", Reserved: false}, + "TRIGGER_CATALOG": {Keyword: "TRIGGER_CATALOG", Reserved: false}, + "TRIGGER_NAME": {Keyword: "TRIGGER_NAME", Reserved: false}, + "TRIGGER_SCHEMA": {Keyword: "TRIGGER_SCHEMA", Reserved: false}, + "TRIM": {Keyword: "TRIM", Reserved: false}, + "TRIM_ARRAY": {Keyword: "TRIM_ARRAY", Reserved: false}, + "TRUE": {Keyword: "TRUE", Reserved: true}, + "TRUNCATE": {Keyword: "TRUNCATE", Reserved: false}, + "TRUSTED": {Keyword: "TRUSTED", Reserved: false}, + "TYPE": {Keyword: "TYPE", Reserved: false}, + "TYPES": {Keyword: "TYPES", Reserved: false}, + "UESCAPE": {Keyword: "UESCAPE", Reserved: false}, + "UNBOUNDED": {Keyword: "UNBOUNDED", Reserved: false}, + "UNCOMMITTED": {Keyword: "UNCOMMITTED", Reserved: false}, + "UNCONDITIONAL": {Keyword: "UNCONDITIONAL", Reserved: false}, + "UNDER": {Keyword: "UNDER", Reserved: false}, + "UNENCRYPTED": {Keyword: "UNENCRYPTED", Reserved: false}, + "UNION": {Keyword: "UNION", Reserved: true}, + "UNIQUE": {Keyword: "UNIQUE", Reserved: true}, + "UNKNOWN": {Keyword: "UNKNOWN", Reserved: false}, + "UNLINK": {Keyword: "UNLINK", Reserved: false}, + "UNLISTEN": {Keyword: "UNLISTEN", Reserved: false}, + "UNLOGGED": {Keyword: "UNLOGGED", Reserved: false}, + "UNMATCHED": {Keyword: "UNMATCHED", Reserved: false}, + "UNNAMED": {Keyword: "UNNAMED", Reserved: false}, + "UNNEST": {Keyword: "UNNEST", Reserved: false}, + "UNTIL": {Keyword: "UNTIL", Reserved: false}, + "UNTYPED": {Keyword: "UNTYPED", Reserved: false}, + "UPDATE": {Keyword: "UPDATE", Reserved: false}, + "UPPER": {Keyword: "UPPER", Reserved: false}, + "URI": {Keyword: "URI", Reserved: false}, + "USAGE": {Keyword: "USAGE", Reserved: false}, + "USER": {Keyword: "USER", Reserved: true}, + "USER_DEFINED_TYPE_CATALOG": {Keyword: "USER_DEFINED_TYPE_CATALOG", Reserved: false}, + "USER_DEFINED_TYPE_CODE": {Keyword: "USER_DEFINED_TYPE_CODE", Reserved: false}, + "USER_DEFINED_TYPE_NAME": {Keyword: "USER_DEFINED_TYPE_NAME", Reserved: false}, + "USER_DEFINED_TYPE_SCHEMA": {Keyword: "USER_DEFINED_TYPE_SCHEMA", Reserved: false}, + "USING": {Keyword: "USING", Reserved: true}, + "UTF16": {Keyword: "UTF16", Reserved: false}, + "UTF32": {Keyword: "UTF32", Reserved: false}, + "UTF8": {Keyword: "UTF8", Reserved: false}, + "VACUUM": {Keyword: "VACUUM", Reserved: false}, + "VALID": {Keyword: "VALID", Reserved: false}, + "VALIDATE": {Keyword: "VALIDATE", Reserved: false}, + "VALIDATOR": {Keyword: "VALIDATOR", Reserved: false}, + "VALUE": {Keyword: "VALUE", Reserved: false}, + "VALUES": {Keyword: "VALUES", Reserved: false}, + "VALUE_OF": {Keyword: "VALUE_OF", Reserved: false}, + "VARBINARY": {Keyword: "VARBINARY", Reserved: false}, + "VARCHAR": {Keyword: "VARCHAR", Reserved: false}, + "VARIADIC": {Keyword: "VARIADIC", Reserved: true}, + "VARYING": {Keyword: "VARYING", Reserved: false}, + "VAR_POP": {Keyword: "VAR_POP", Reserved: false}, + "VAR_SAMP": {Keyword: "VAR_SAMP", Reserved: false}, + "VERBOSE": {Keyword: "VERBOSE", Reserved: true}, + "VERSION": {Keyword: "VERSION", Reserved: false}, + "VERSIONING": {Keyword: "VERSIONING", Reserved: false}, + "VIEW": {Keyword: "VIEW", Reserved: false}, + "VIEWS": {Keyword: "VIEWS", Reserved: false}, + "VOLATILE": {Keyword: "VOLATILE", Reserved: false}, + "WHEN": {Keyword: "WHEN", Reserved: true}, + "WHENEVER": {Keyword: "WHENEVER", Reserved: false}, + "WHERE": {Keyword: "WHERE", Reserved: true}, + "WHITESPACE": {Keyword: "WHITESPACE", Reserved: false}, + "WIDTH_BUCKET": {Keyword: "WIDTH_BUCKET", Reserved: false}, + "WINDOW": {Keyword: "WINDOW", Reserved: true}, + "WITH": {Keyword: "WITH", Reserved: true}, + "WITHIN": {Keyword: "WITHIN", Reserved: false}, + "WITHOUT": {Keyword: "WITHOUT", Reserved: false}, + "WORK": {Keyword: "WORK", Reserved: false}, + "WRAPPER": {Keyword: "WRAPPER", Reserved: false}, + "WRITE": {Keyword: "WRITE", Reserved: false}, + "XML": {Keyword: "XML", Reserved: false}, + "XMLAGG": {Keyword: "XMLAGG", Reserved: false}, + "XMLATTRIBUTES": {Keyword: "XMLATTRIBUTES", Reserved: false}, + "XMLBINARY": {Keyword: "XMLBINARY", Reserved: false}, + "XMLCAST": {Keyword: "XMLCAST", Reserved: false}, + "XMLCOMMENT": {Keyword: "XMLCOMMENT", Reserved: false}, + "XMLCONCAT": {Keyword: "XMLCONCAT", Reserved: false}, + "XMLDECLARATION": {Keyword: "XMLDECLARATION", Reserved: false}, + "XMLDOCUMENT": {Keyword: "XMLDOCUMENT", Reserved: false}, + "XMLELEMENT": {Keyword: "XMLELEMENT", Reserved: false}, + "XMLEXISTS": {Keyword: "XMLEXISTS", Reserved: false}, + "XMLFOREST": {Keyword: "XMLFOREST", Reserved: false}, + "XMLITERATE": {Keyword: "XMLITERATE", Reserved: false}, + "XMLNAMESPACES": {Keyword: "XMLNAMESPACES", Reserved: false}, + "XMLPARSE": {Keyword: "XMLPARSE", Reserved: false}, + "XMLPI": {Keyword: "XMLPI", Reserved: false}, + "XMLQUERY": {Keyword: "XMLQUERY", Reserved: false}, + "XMLROOT": {Keyword: "XMLROOT", Reserved: false}, + "XMLSCHEMA": {Keyword: "XMLSCHEMA", Reserved: false}, + "XMLSERIALIZE": {Keyword: "XMLSERIALIZE", Reserved: false}, + "XMLTABLE": {Keyword: "XMLTABLE", Reserved: false}, + "XMLTEXT": {Keyword: "XMLTEXT", Reserved: false}, + "XMLVALIDATE": {Keyword: "XMLVALIDATE", Reserved: false}, + "YEAR": {Keyword: "YEAR", Reserved: false}, + "YES": {Keyword: "YES", Reserved: false}, + "ZONE": {Keyword: "ZONE", Reserved: false}, +} diff --git a/postgresql/parser_test.go b/postgresql/parser_test.go new file mode 100644 index 0000000..9af103c --- /dev/null +++ b/postgresql/parser_test.go @@ -0,0 +1,223 @@ +package postgresql_test + +import ( + "fmt" + "os" + "path" + "testing" + "time" + + "github.com/antlr4-go/antlr/v4" + pgparser "github.com/bytebase/parser/postgresql" + "github.com/stretchr/testify/require" +) + +type CustomErrorListener struct { + errors int +} + +func NewCustomErrorListener() *CustomErrorListener { + return new(CustomErrorListener) +} + +func (l *CustomErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException) { + l.errors += 1 + antlr.ConsoleErrorListenerINSTANCE.SyntaxError(recognizer, offendingSymbol, line, column, msg, e) +} + +func (l *CustomErrorListener) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) +} + +func (l *CustomErrorListener) ReportAttemptingFullContext(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, conflictingAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) +} + +func (l *CustomErrorListener) ReportContextSensitivity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex, prediction int, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs) +} + +func TestPostgreSQLParser(t *testing.T) { + examples, err := os.ReadDir("examples") + require.NoError(t, err) + + for _, file := range examples { + filePath := path.Join("examples", file.Name()) + t.Run(filePath, func(t *testing.T) { + t.Parallel() + // read all the bytes from the file + data, err := os.ReadFile(filePath) + require.NoError(t, err) + + input := antlr.NewInputStream(string(data)) + + lexer := pgparser.NewPostgreSQLLexer(input) + + stream := antlr.NewCommonTokenStream(lexer, 0) + p := pgparser.NewPostgreSQLParser(stream) + + lexerErrors := &CustomErrorListener{} + lexer.RemoveErrorListeners() + lexer.AddErrorListener(lexerErrors) + + parserErrors := &CustomErrorListener{} + p.RemoveErrorListeners() + p.AddErrorListener(parserErrors) + + p.BuildParseTrees = true + + tree := p.Root() + + require.Equal(t, 0, lexerErrors.errors) + require.Equal(t, 0, parserErrors.errors) + + start := 0 + stop := stream.Size() - 1 + for i := 0; i < stream.Size(); i++ { + if stream.Get(i).GetChannel() == antlr.TokenDefaultChannel { + start = i + break + } + } + for i := stream.Size() - 1; i >= 0; i-- { + if stream.Get(i).GetChannel() == antlr.TokenDefaultChannel && stream.Get(i).GetTokenType() != antlr.TokenEOF { + stop = i + break + } + } + require.Equal(t, start, tree.GetStart().GetTokenIndex()) + require.Equal(t, stop, tree.GetStop().GetTokenIndex()) + // require.Equal(t, string(data), stream.GetTextFromTokens(stream.Get(0), stream.Get(stream.Size()-1))) + }) + } +} + +type ParseService struct { + lexer *pgparser.PostgreSQLLexer + parser *pgparser.PostgreSQLParser + tokens antlr.TokenStream + input antlr.CharStream + errors int +} + +func NewParseService() *ParseService { + s := &ParseService{ + input: antlr.NewInputStream(""), + } + s.lexer = pgparser.NewPostgreSQLLexer(s.input) + s.tokens = antlr.NewCommonTokenStream(s.lexer, 0) + s.parser = pgparser.NewPostgreSQLParser(s.tokens) + return s +} + +func (s *ParseService) Parse(script string, buildTree bool) antlr.RuleContext { + s.errors = 0 + s.input = antlr.NewInputStream(script) + s.lexer.Reset() + s.lexer.SetInputStream(s.input) + s.tokens.SetTokenSource(s.lexer) + // set token stream and reset parser + s.parser.SetTokenStream(s.tokens) + + lexerErrors := &CustomErrorListener{} + s.lexer.RemoveErrorListeners() + s.lexer.AddErrorListener(lexerErrors) + + parserErrors := &CustomErrorListener{} + s.parser.RemoveErrorListeners() + s.parser.AddErrorListener(parserErrors) + + // Set the parser's error strategy to bail on the first error encountered + s.parser.SetErrorHandler(antlr.NewBailErrorStrategy()) + + s.parser.BuildParseTrees = buildTree + + tree := s.parser.Root() + s.errors += lexerErrors.errors + s.errors += parserErrors.errors + return tree +} + +func TestBenchmarkParser(t *testing.T) { + s := NewParseService() + examples, err := os.ReadDir("examples") + require.NoError(t, err) + + var files []string + + for i, file := range examples { + if i > 20 { + break + } + filePath := path.Join("examples", file.Name()) + data, err := os.ReadFile(filePath) + require.NoError(t, err) + + files = append(files, string(data)) + } + + fmt.Printf("Total files: %d\n", len(files)) + + newParserEachFileStartTime := time.Now() + + for _, file := range files { + input := antlr.NewInputStream(file) + + lexer := pgparser.NewPostgreSQLLexer(input) + + stream := antlr.NewCommonTokenStream(lexer, 0) + p := pgparser.NewPostgreSQLParser(stream) + + lexerErrors := &CustomErrorListener{} + lexer.RemoveErrorListeners() + lexer.AddErrorListener(lexerErrors) + + parserErrors := &CustomErrorListener{} + p.RemoveErrorListeners() + p.AddErrorListener(parserErrors) + + p.BuildParseTrees = true + + _ = p.Root() + + require.Equal(t, 0, lexerErrors.errors) + require.Equal(t, 0, parserErrors.errors) + + } + + fmt.Printf("New parser each file took %s\n", time.Since(newParserEachFileStartTime).String()) + + coldStartTime := time.Now() + + for _, file := range files { + _ = s.Parse(string(file), true) + require.Zero(t, s.errors) + } + + fmt.Printf("Parse with cold start took %s\n", time.Since(coldStartTime).String()) + + for i := 0; i < 5; i++ { + for _, file := range files { + _ = s.Parse(string(file), true) + require.Zero(t, s.errors) + } + } + fmt.Println("Finish warm up") + + warmStartTime := time.Now() + for _, file := range files { + _ = s.Parse(string(file), true) + require.Zero(t, s.errors) + } + + fmt.Printf("Parse with warm start took %s\n", time.Since(warmStartTime).String()) + + withoutParseTreeStartTime := time.Now() + + for _, file := range files { + _ = s.Parse(string(file), false) + require.Zero(t, s.errors) + } + + fmt.Printf("Parse without parse tree took %s\n", time.Since(withoutParseTreeStartTime).String()) +} diff --git a/postgresql/postgresql_lexer.go b/postgresql/postgresql_lexer.go new file mode 100644 index 0000000..03152e3 --- /dev/null +++ b/postgresql/postgresql_lexer.go @@ -0,0 +1,4455 @@ +// Code generated from PostgreSQLLexer.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package postgresql + +import ( + "fmt" + "github.com/antlr4-go/antlr/v4" + "sync" + "unicode" +) + +// Suppress unused import error +var _ = fmt.Printf +var _ = sync.Once{} +var _ = unicode.IsLetter + +type PostgreSQLLexer struct { + PostgreSQLLexerBase + channelNames []string + modeNames []string + // TODO: EOF string +} + +var PostgreSQLLexerLexerStaticData struct { + once sync.Once + serializedATN []int32 + ChannelNames []string + ModeNames []string + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache + atn *antlr.ATN + decisionToDFA []*antlr.DFA +} + +func postgresqllexerLexerInit() { + staticData := &PostgreSQLLexerLexerStaticData + staticData.ChannelNames = []string{ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN", + } + staticData.ModeNames = []string{ + "DEFAULT_MODE", "EscapeStringConstantMode", "AfterEscapeStringConstantMode", + "AfterEscapeStringConstantWithNewlineMode", "DollarQuotedStringMode", + } + staticData.LiteralNames = []string{ + "", "'$'", "'('", "')'", "'['", "']'", "','", "';'", "':'", "'*'", "'='", + "'.'", "'+'", "'-'", "'/'", "'^'", "'<'", "'>'", "'<<'", "'>>'", "':='", + "'<='", "'=>'", "'>='", "'..'", "'<>'", "'::'", "'%'", "", "", "'ALL'", + "'ANALYSE'", "'ANALYZE'", "'AND'", "'ANY'", "'ARRAY'", "'AS'", "'ASC'", + "'ASYMMETRIC'", "'BOTH'", "'CASE'", "'CAST'", "'CHECK'", "'COLLATE'", + "'COLUMN'", "'CONSTRAINT'", "'CREATE'", "'CURRENT_CATALOG'", "'CURRENT_DATE'", + "'CURRENT_ROLE'", "'CURRENT_TIME'", "'CURRENT_TIMESTAMP'", "'CURRENT_USER'", + "'DEFAULT'", "'DEFERRABLE'", "'DESC'", "'DISTINCT'", "'DO'", "'ELSE'", + "'EXCEPT'", "'FALSE'", "'FETCH'", "'FOR'", "'FOREIGN'", "'FROM'", "'GRANT'", + "'GROUP'", "'HAVING'", "'IN'", "'INITIALLY'", "'INTERSECT'", "'INTO'", + "'LATERAL'", "'LEADING'", "'LIMIT'", "'LOCALTIME'", "'LOCALTIMESTAMP'", + "'NOT'", "'NULL'", "'OFFSET'", "'ON'", "'ONLY'", "'OR'", "'ORDER'", + "'PLACING'", "'PRIMARY'", "'REFERENCES'", "'RETURNING'", "'SELECT'", + "'SESSION_USER'", "'SOME'", "'SYMMETRIC'", "'TABLE'", "'THEN'", "'TO'", + "'TRAILING'", "'TRUE'", "'UNION'", "'UNIQUE'", "'USER'", "'USING'", + "'VARIADIC'", "'WHEN'", "'WHERE'", "'WINDOW'", "'WITH'", "'AUTHORIZATION'", + "'BINARY'", "'COLLATION'", "'CONCURRENTLY'", "'CROSS'", "'CURRENT_SCHEMA'", + "'FREEZE'", "'FULL'", "'ILIKE'", "'INNER'", "'IS'", "'ISNULL'", "'JOIN'", + "'LEFT'", "'LIKE'", "'NATURAL'", "'NOTNULL'", "'OUTER'", "'OVER'", "'OVERLAPS'", + "'RIGHT'", "'SIMILAR'", "'VERBOSE'", "'ABORT'", "'ABSOLUTE'", "'ACCESS'", + "'ACTION'", "'ADD'", "'ADMIN'", "'AFTER'", "'AGGREGATE'", "'ALSO'", + "'ALTER'", "'ALWAYS'", "'ASSERTION'", "'ASSIGNMENT'", "'AT'", "'ATTRIBUTE'", + "'BACKWARD'", "'BEFORE'", "'BEGIN'", "'BY'", "'CACHE'", "'CALLED'", + "'CASCADE'", "'CASCADED'", "'CATALOG'", "'CHAIN'", "'CHARACTERISTICS'", + "'CHECKPOINT'", "'CLASS'", "'CLOSE'", "'CLUSTER'", "'COMMENT'", "'COMMENTS'", + "'COMMIT'", "'COMMITTED'", "'CONFIGURATION'", "'CONNECTION'", "'CONSTRAINTS'", + "'CONTENT'", "'CONTINUE'", "'CONVERSION'", "'COPY'", "'COST'", "'CSV'", + "'CURSOR'", "'CYCLE'", "'DATA'", "'DATABASE'", "'DAY'", "'DEALLOCATE'", + "'DECLARE'", "'DEFAULTS'", "'DEFERRED'", "'DEFINER'", "'DELETE'", "'DELIMITER'", + "'DELIMITERS'", "'DICTIONARY'", "'DISABLE'", "'DISCARD'", "'DOCUMENT'", + "'DOMAIN'", "'DOUBLE'", "'DROP'", "'EACH'", "'ENABLE'", "'ENCODING'", + "'ENCRYPTED'", "'ENUM'", "'ESCAPE'", "'EVENT'", "'EXCLUDE'", "'EXCLUDING'", + "'EXCLUSIVE'", "'EXECUTE'", "'EXPLAIN'", "'EXTENSION'", "'EXTERNAL'", + "'FAMILY'", "'FIRST'", "'FOLLOWING'", "'FORCE'", "'FORWARD'", "'FUNCTION'", + "'FUNCTIONS'", "'GLOBAL'", "'GRANTED'", "'HANDLER'", "'HEADER'", "'HOLD'", + "'HOUR'", "'IDENTITY'", "'IF'", "'IMMEDIATE'", "'IMMUTABLE'", "'IMPLICIT'", + "'INCLUDING'", "'INCREMENT'", "'INDEX'", "'INDEXES'", "'INHERIT'", "'INHERITS'", + "'INLINE'", "'INSENSITIVE'", "'INSERT'", "'INSTEAD'", "'INVOKER'", "'ISOLATION'", + "'KEY'", "'LABEL'", "'LANGUAGE'", "'LARGE'", "'LAST'", "'LEAKPROOF'", + "'LEVEL'", "'LISTEN'", "'LOAD'", "'LOCAL'", "'LOCATION'", "'LOCK'", + "'MAPPING'", "'MATCH'", "'MATCHED'", "'MATERIALIZED'", "'MAXVALUE'", + "'MERGE'", "'MINUTE'", "'MINVALUE'", "'MODE'", "'MONTH'", "'MOVE'", + "'NAME'", "'NAMES'", "'NEXT'", "'NO'", "'NOTHING'", "'NOTIFY'", "'NOWAIT'", + "'NULLS'", "'OBJECT'", "'OF'", "'OFF'", "'OIDS'", "'OPERATOR'", "'OPTION'", + "'OPTIONS'", "'OWNED'", "'OWNER'", "'PARSER'", "'PARTIAL'", "'PARTITION'", + "'PASSING'", "'PASSWORD'", "'PLANS'", "'PRECEDING'", "'PREPARE'", "'PREPARED'", + "'PRESERVE'", "'PRIOR'", "'PRIVILEGES'", "'PROCEDURAL'", "'PROCEDURE'", + "'PROGRAM'", "'QUOTE'", "'RANGE'", "'READ'", "'REASSIGN'", "'RECHECK'", + "'RECURSIVE'", "'REF'", "'REFRESH'", "'REINDEX'", "'RELATIVE'", "'RELEASE'", + "'RENAME'", "'REPEATABLE'", "'REPLACE'", "'REPLICA'", "'RESET'", "'RESTART'", + "'RESTRICT'", "'RETURNS'", "'REVOKE'", "'ROLE'", "'ROLLBACK'", "'ROWS'", + "'RULE'", "'SAVEPOINT'", "'SCHEMA'", "'SCROLL'", "'SEARCH'", "'SECOND'", + "'SECURITY'", "'SEQUENCE'", "'SEQUENCES'", "'SERIALIZABLE'", "'SERVER'", + "'SESSION'", "'SET'", "'SHARE'", "'SHOW'", "'SIMPLE'", "'SNAPSHOT'", + "'STABLE'", "'STANDALONE'", "'START'", "'STATEMENT'", "'STATISTICS'", + "'STDIN'", "'STDOUT'", "'STORAGE'", "'STRICT'", "'STRIP'", "'SYSID'", + "'SYSTEM'", "'TABLES'", "'TABLESPACE'", "'TEMP'", "'TEMPLATE'", "'TEMPORARY'", + "'TEXT'", "'TRANSACTION'", "'TRIGGER'", "'TRUNCATE'", "'TRUSTED'", "'TYPE'", + "'TYPES'", "'UNBOUNDED'", "'UNCOMMITTED'", "'UNENCRYPTED'", "'UNKNOWN'", + "'UNLISTEN'", "'UNLOGGED'", "'UNTIL'", "'UPDATE'", "'VACUUM'", "'VALID'", + "'VALIDATE'", "'VALIDATOR'", "'VARYING'", "'VERSION'", "'VIEW'", "'VOLATILE'", + "'WHITESPACE'", "'WITHOUT'", "'WORK'", "'WRAPPER'", "'WRITE'", "'XML'", + "'YEAR'", "'YES'", "'ZONE'", "'ATOMIC'", "'BETWEEN'", "'BIGINT'", "'BIT'", + "'BOOLEAN'", "'CHAR'", "'CHARACTER'", "'COALESCE'", "'DEC'", "'DECIMAL'", + "'EXISTS'", "'EXTRACT'", "'FLOAT'", "'GREATEST'", "'INOUT'", "'INT'", + "'INTEGER'", "'INTERVAL'", "'LEAST'", "'NATIONAL'", "'NCHAR'", "'NONE'", + "'NULLIF'", "'NUMERIC'", "'OVERLAY'", "'PARAMETER'", "'POSITION'", "'PRECISION'", + "'REAL'", "'ROW'", "'SETOF'", "'SMALLINT'", "'SUBSTRING'", "'TIME'", + "'TIMESTAMP'", "'TREAT'", "'TRIM'", "'VALUES'", "'VARCHAR'", "'XMLATTRIBUTES'", + "'XMLCOMMENT'", "'XMLAGG'", "'XML_IS_WELL_FORMED'", "'XML_IS_WELL_FORMED_DOCUMENT'", + "'XML_IS_WELL_FORMED_CONTENT'", "'XPATH'", "'XPATH_EXISTS'", "'XMLCONCAT'", + "'XMLELEMENT'", "'XMLEXISTS'", "'XMLFOREST'", "'XMLPARSE'", "'XMLPI'", + "'XMLROOT'", "'XMLSERIALIZE'", "'CALL'", "'CURRENT'", "'ATTACH'", "'DETACH'", + "'EXPRESSION'", "'GENERATED'", "'LOGGED'", "'STORED'", "'INCLUDE'", + "'ROUTINE'", "'TRANSFORM'", "'IMPORT'", "'POLICY'", "'METHOD'", "'REFERENCING'", + "'NEW'", "'OLD'", "'VALUE'", "'SUBSCRIPTION'", "'PUBLICATION'", "'OUT'", + "'END'", "'ROUTINES'", "'SCHEMAS'", "'PROCEDURES'", "'INPUT'", "'SUPPORT'", + "'PARALLEL'", "'SQL'", "'DEPENDS'", "'OVERRIDING'", "'CONFLICT'", "'SKIP'", + "'LOCKED'", "'TIES'", "'ROLLUP'", "'CUBE'", "'GROUPING'", "'SETS'", + "'TABLESAMPLE'", "'ORDINALITY'", "'XMLTABLE'", "'COLUMNS'", "'XMLNAMESPACES'", + "'ROWTYPE'", "'NORMALIZED'", "'WITHIN'", "'FILTER'", "'GROUPS'", "'OTHERS'", + "'NFC'", "'NFD'", "'NFKC'", "'NFKD'", "'UESCAPE'", "'VIEWS'", "'NORMALIZE'", + "'DUMP'", "'PRINT_STRICT_PARAMS'", "'VARIABLE_CONFLICT'", "'ERROR'", + "'USE_VARIABLE'", "'USE_COLUMN'", "'ALIAS'", "'CONSTANT'", "'PERFORM'", + "'GET'", "'DIAGNOSTICS'", "'STACKED'", "'ELSIF'", "'WHILE'", "'REVERSE'", + "'FOREACH'", "'SLICE'", "'EXIT'", "'RETURN'", "'QUERY'", "'RAISE'", + "'SQLSTATE'", "'DEBUG'", "'LOG'", "'INFO'", "'NOTICE'", "'WARNING'", + "'EXCEPTION'", "'ASSERT'", "'LOOP'", "'OPEN'", "'ABS'", "'CBRT'", "'CEIL'", + "'CEILING'", "'DEGREES'", "'DIV'", "'EXP'", "'FACTORIAL'", "'FLOOR'", + "'GCD'", "'LCM'", "'LN'", "'LOG10'", "'MIN_SCALE'", "'MOD'", "'PI'", + "'POWER'", "'RADIANS'", "'ROUND'", "'SCALE'", "'SIGN'", "'SQRT'", "'TRIM_SCALE'", + "'TRUNC'", "'WIDTH_BUCKET'", "'RANDOM'", "'SETSEED'", "'ACOS'", "'ACOSD'", + "'ASIN'", "'ASIND'", "'ATAN'", "'ATAND'", "'ATAN2'", "'ATAN2D'", "'COS'", + "'COSD'", "'COT'", "'COTD'", "'SIN'", "'SIND'", "'TAN'", "'TAND'", "'SINH'", + "'COSH'", "'TANH'", "'ASINH'", "'ACOSH'", "'ATANH'", "'BIT_LENGTH'", + "'CHAR_LENGTH'", "'CHARACTER_LENGTH'", "'LOWER'", "'OCTET_LENGTH'", + "'UPPER'", "'ASCII'", "'BTRIM'", "'CHR'", "'CONCAT'", "'CONCAT_WS'", + "'FORMAT'", "'INITCAP'", "'LENGTH'", "'LPAD'", "'LTRIM'", "'MD5'", "'PARSE_IDENT'", + "'PG_CLIENT_ENCODING'", "'QUOTE_IDENT'", "'QUOTE_LITERAL'", "'QUOTE_NULLABLE'", + "'REGEXP_COUNT'", "'REGEXP_INSTR'", "'REGEXP_LIKE'", "'REGEXP_MATCH'", + "'REGEXP_MATCHES'", "'REGEXP_REPLACE'", "'REGEXP_SPLIT_TO_ARRAY'", "'REGEXP_SPLIT_TO_TABLE'", + "'REGEXP_SUBSTR'", "'REPEAT'", "'RPAD'", "'RTRIM'", "'SPLIT_PART'", + "'STARTS_WITH'", "'STRING_TO_ARRAY'", "'STRING_TO_TABLE'", "'STRPOS'", + "'SUBSTR'", "'TO_ASCII'", "'TO_HEX'", "'TRANSLATE'", "'UNISTR'", "'AGE'", + "'CLOCK_TIMESTAMP'", "'DATE_BIN'", "'DATE_PART'", "'DATE_TRUNC'", "'ISFINITE'", + "'JUSTIFY_DAYS'", "'JUSTIFY_HOURS'", "'JUSTIFY_INTERVAL'", "'MAKE_DATE'", + "'MAKE_INTERVAL'", "'MAKE_TIME'", "'MAKE_TIMESTAMP'", "'MAKE_TIMESTAMPTZ'", + "'NOW'", "'STATEMENT_TIMESTAMP'", "'TIMEOFDAY'", "'TRANSACTION_TIMESTAMP'", + "'TO_TIMESTAMP'", "'TO_CHAR'", "'TO_DATE'", "'TO_NUMBER'", "'ENCODE'", + "'DISTKEY'", "'SORTKEY'", "'CASE_SENSITIVE'", "'CASE_INSENSITIVE'", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "'\\\\'", + "", "", "", "", "", "", "", "", "", "'''", + } + staticData.SymbolicNames = []string{ + "", "Dollar", "OPEN_PAREN", "CLOSE_PAREN", "OPEN_BRACKET", "CLOSE_BRACKET", + "COMMA", "SEMI", "COLON", "STAR", "EQUAL", "DOT", "PLUS", "MINUS", "SLASH", + "CARET", "LT", "GT", "LESS_LESS", "GREATER_GREATER", "COLON_EQUALS", + "LESS_EQUALS", "EQUALS_GREATER", "GREATER_EQUALS", "DOT_DOT", "NOT_EQUALS", + "TYPECAST", "PERCENT", "PARAM", "Operator", "ALL", "ANALYSE", "ANALYZE", + "AND", "ANY", "ARRAY", "AS", "ASC", "ASYMMETRIC", "BOTH", "CASE", "CAST", + "CHECK", "COLLATE", "COLUMN", "CONSTRAINT", "CREATE", "CURRENT_CATALOG", + "CURRENT_DATE", "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP", + "CURRENT_USER", "DEFAULT", "DEFERRABLE", "DESC", "DISTINCT", "DO", "ELSE", + "EXCEPT", "FALSE_P", "FETCH", "FOR", "FOREIGN", "FROM", "GRANT", "GROUP_P", + "HAVING", "IN_P", "INITIALLY", "INTERSECT", "INTO", "LATERAL_P", "LEADING", + "LIMIT", "LOCALTIME", "LOCALTIMESTAMP", "NOT", "NULL_P", "OFFSET", "ON", + "ONLY", "OR", "ORDER", "PLACING", "PRIMARY", "REFERENCES", "RETURNING", + "SELECT", "SESSION_USER", "SOME", "SYMMETRIC", "TABLE", "THEN", "TO", + "TRAILING", "TRUE_P", "UNION", "UNIQUE", "USER", "USING", "VARIADIC", + "WHEN", "WHERE", "WINDOW", "WITH", "AUTHORIZATION", "BINARY", "COLLATION", + "CONCURRENTLY", "CROSS", "CURRENT_SCHEMA", "FREEZE", "FULL", "ILIKE", + "INNER_P", "IS", "ISNULL", "JOIN", "LEFT", "LIKE", "NATURAL", "NOTNULL", + "OUTER_P", "OVER", "OVERLAPS", "RIGHT", "SIMILAR", "VERBOSE", "ABORT_P", + "ABSOLUTE_P", "ACCESS", "ACTION", "ADD_P", "ADMIN", "AFTER", "AGGREGATE", + "ALSO", "ALTER", "ALWAYS", "ASSERTION", "ASSIGNMENT", "AT", "ATTRIBUTE", + "BACKWARD", "BEFORE", "BEGIN_P", "BY", "CACHE", "CALLED", "CASCADE", + "CASCADED", "CATALOG", "CHAIN", "CHARACTERISTICS", "CHECKPOINT", "CLASS", + "CLOSE", "CLUSTER", "COMMENT", "COMMENTS", "COMMIT", "COMMITTED", "CONFIGURATION", + "CONNECTION", "CONSTRAINTS", "CONTENT_P", "CONTINUE_P", "CONVERSION_P", + "COPY", "COST", "CSV", "CURSOR", "CYCLE", "DATA_P", "DATABASE", "DAY_P", + "DEALLOCATE", "DECLARE", "DEFAULTS", "DEFERRED", "DEFINER", "DELETE_P", + "DELIMITER", "DELIMITERS", "DICTIONARY", "DISABLE_P", "DISCARD", "DOCUMENT_P", + "DOMAIN_P", "DOUBLE_P", "DROP", "EACH", "ENABLE_P", "ENCODING", "ENCRYPTED", + "ENUM_P", "ESCAPE", "EVENT", "EXCLUDE", "EXCLUDING", "EXCLUSIVE", "EXECUTE", + "EXPLAIN", "EXTENSION", "EXTERNAL", "FAMILY", "FIRST_P", "FOLLOWING", + "FORCE", "FORWARD", "FUNCTION", "FUNCTIONS", "GLOBAL", "GRANTED", "HANDLER", + "HEADER_P", "HOLD", "HOUR_P", "IDENTITY_P", "IF_P", "IMMEDIATE", "IMMUTABLE", + "IMPLICIT_P", "INCLUDING", "INCREMENT", "INDEX", "INDEXES", "INHERIT", + "INHERITS", "INLINE_P", "INSENSITIVE", "INSERT", "INSTEAD", "INVOKER", + "ISOLATION", "KEY", "LABEL", "LANGUAGE", "LARGE_P", "LAST_P", "LEAKPROOF", + "LEVEL", "LISTEN", "LOAD", "LOCAL", "LOCATION", "LOCK_P", "MAPPING", + "MATCH", "MATCHED", "MATERIALIZED", "MAXVALUE", "MERGE", "MINUTE_P", + "MINVALUE", "MODE", "MONTH_P", "MOVE", "NAME_P", "NAMES", "NEXT", "NO", + "NOTHING", "NOTIFY", "NOWAIT", "NULLS_P", "OBJECT_P", "OF", "OFF", "OIDS", + "OPERATOR", "OPTION", "OPTIONS", "OWNED", "OWNER", "PARSER", "PARTIAL", + "PARTITION", "PASSING", "PASSWORD", "PLANS", "PRECEDING", "PREPARE", + "PREPARED", "PRESERVE", "PRIOR", "PRIVILEGES", "PROCEDURAL", "PROCEDURE", + "PROGRAM", "QUOTE", "RANGE", "READ", "REASSIGN", "RECHECK", "RECURSIVE", + "REF", "REFRESH", "REINDEX", "RELATIVE_P", "RELEASE", "RENAME", "REPEATABLE", + "REPLACE", "REPLICA", "RESET", "RESTART", "RESTRICT", "RETURNS", "REVOKE", + "ROLE", "ROLLBACK", "ROWS", "RULE", "SAVEPOINT", "SCHEMA", "SCROLL", + "SEARCH", "SECOND_P", "SECURITY", "SEQUENCE", "SEQUENCES", "SERIALIZABLE", + "SERVER", "SESSION", "SET", "SHARE", "SHOW", "SIMPLE", "SNAPSHOT", "STABLE", + "STANDALONE_P", "START", "STATEMENT", "STATISTICS", "STDIN", "STDOUT", + "STORAGE", "STRICT_P", "STRIP_P", "SYSID", "SYSTEM_P", "TABLES", "TABLESPACE", + "TEMP", "TEMPLATE", "TEMPORARY", "TEXT_P", "TRANSACTION", "TRIGGER", + "TRUNCATE", "TRUSTED", "TYPE_P", "TYPES_P", "UNBOUNDED", "UNCOMMITTED", + "UNENCRYPTED", "UNKNOWN", "UNLISTEN", "UNLOGGED", "UNTIL", "UPDATE", + "VACUUM", "VALID", "VALIDATE", "VALIDATOR", "VARYING", "VERSION_P", + "VIEW", "VOLATILE", "WHITESPACE_P", "WITHOUT", "WORK", "WRAPPER", "WRITE", + "XML_P", "YEAR_P", "YES_P", "ZONE", "ATOMIC_P", "BETWEEN", "BIGINT", + "BIT", "BOOLEAN_P", "CHAR_P", "CHARACTER", "COALESCE", "DEC", "DECIMAL_P", + "EXISTS", "EXTRACT", "FLOAT_P", "GREATEST", "INOUT", "INT_P", "INTEGER", + "INTERVAL", "LEAST", "NATIONAL", "NCHAR", "NONE", "NULLIF", "NUMERIC", + "OVERLAY", "PARAMETER", "POSITION", "PRECISION", "REAL", "ROW", "SETOF", + "SMALLINT", "SUBSTRING", "TIME", "TIMESTAMP", "TREAT", "TRIM", "VALUES", + "VARCHAR", "XMLATTRIBUTES", "XMLCOMMENT", "XMLAGG", "XML_IS_WELL_FORMED", + "XML_IS_WELL_FORMED_DOCUMENT", "XML_IS_WELL_FORMED_CONTENT", "XPATH", + "XPATH_EXISTS", "XMLCONCAT", "XMLELEMENT", "XMLEXISTS", "XMLFOREST", + "XMLPARSE", "XMLPI", "XMLROOT", "XMLSERIALIZE", "CALL", "CURRENT_P", + "ATTACH", "DETACH", "EXPRESSION", "GENERATED", "LOGGED", "STORED", "INCLUDE", + "ROUTINE", "TRANSFORM", "IMPORT_P", "POLICY", "METHOD", "REFERENCING", + "NEW", "OLD", "VALUE_P", "SUBSCRIPTION", "PUBLICATION", "OUT_P", "END_P", + "ROUTINES", "SCHEMAS", "PROCEDURES", "INPUT_P", "SUPPORT", "PARALLEL", + "SQL_P", "DEPENDS", "OVERRIDING", "CONFLICT", "SKIP_P", "LOCKED", "TIES", + "ROLLUP", "CUBE", "GROUPING", "SETS", "TABLESAMPLE", "ORDINALITY", "XMLTABLE", + "COLUMNS", "XMLNAMESPACES", "ROWTYPE", "NORMALIZED", "WITHIN", "FILTER", + "GROUPS", "OTHERS", "NFC", "NFD", "NFKC", "NFKD", "UESCAPE", "VIEWS", + "NORMALIZE", "DUMP", "PRINT_STRICT_PARAMS", "VARIABLE_CONFLICT", "ERROR", + "USE_VARIABLE", "USE_COLUMN", "ALIAS", "CONSTANT", "PERFORM", "GET", + "DIAGNOSTICS", "STACKED", "ELSIF", "WHILE", "REVERSE", "FOREACH", "SLICE", + "EXIT", "RETURN", "QUERY", "RAISE", "SQLSTATE", "DEBUG", "LOG", "INFO", + "NOTICE", "WARNING", "EXCEPTION", "ASSERT", "LOOP", "OPEN", "ABS", "CBRT", + "CEIL", "CEILING", "DEGREES", "DIV", "EXP", "FACTORIAL", "FLOOR", "GCD", + "LCM", "LN", "LOG10", "MIN_SCALE", "MOD", "PI", "POWER", "RADIANS", + "ROUND", "SCALE", "SIGN", "SQRT", "TRIM_SCALE", "TRUNC", "WIDTH_BUCKET", + "RANDOM", "SETSEED", "ACOS", "ACOSD", "ASIN", "ASIND", "ATAN", "ATAND", + "ATAN2", "ATAN2D", "COS", "COSD", "COT", "COTD", "SIN", "SIND", "TAN", + "TAND", "SINH", "COSH", "TANH", "ASINH", "ACOSH", "ATANH", "BIT_LENGTH", + "CHAR_LENGTH", "CHARACTER_LENGTH", "LOWER", "OCTET_LENGTH", "UPPER", + "ASCII", "BTRIM", "CHR", "CONCAT", "CONCAT_WS", "FORMAT", "INITCAP", + "LENGTH", "LPAD", "LTRIM", "MD5", "PARSE_IDENT", "PG_CLIENT_ENCODING", + "QUOTE_IDENT", "QUOTE_LITERAL", "QUOTE_NULLABLE", "REGEXP_COUNT", "REGEXP_INSTR", + "REGEXP_LIKE", "REGEXP_MATCH", "REGEXP_MATCHES", "REGEXP_REPLACE", "REGEXP_SPLIT_TO_ARRAY", + "REGEXP_SPLIT_TO_TABLE", "REGEXP_SUBSTR", "REPEAT", "RPAD", "RTRIM", + "SPLIT_PART", "STARTS_WITH", "STRING_TO_ARRAY", "STRING_TO_TABLE", "STRPOS", + "SUBSTR", "TO_ASCII", "TO_HEX", "TRANSLATE", "UNISTR", "AGE", "CLOCK_TIMESTAMP", + "DATE_BIN", "DATE_PART", "DATE_TRUNC", "ISFINITE", "JUSTIFY_DAYS", "JUSTIFY_HOURS", + "JUSTIFY_INTERVAL", "MAKE_DATE", "MAKE_INTERVAL", "MAKE_TIME", "MAKE_TIMESTAMP", + "MAKE_TIMESTAMPTZ", "NOW", "STATEMENT_TIMESTAMP", "TIMEOFDAY", "TRANSACTION_TIMESTAMP", + "TO_TIMESTAMP", "TO_CHAR", "TO_DATE", "TO_NUMBER", "ENCODE", "DISTKEY", + "SORTKEY", "CASE_SENSITIVE", "CASE_INSENSITIVE", "Identifier", "QuotedIdentifier", + "UnterminatedQuotedIdentifier", "InvalidQuotedIdentifier", "InvalidUnterminatedQuotedIdentifier", + "UnicodeQuotedIdentifier", "UnterminatedUnicodeQuotedIdentifier", "InvalidUnicodeQuotedIdentifier", + "InvalidUnterminatedUnicodeQuotedIdentifier", "StringConstant", "UnterminatedStringConstant", + "UnicodeEscapeStringConstant", "UnterminatedUnicodeEscapeStringConstant", + "BeginDollarStringConstant", "BinaryStringConstant", "UnterminatedBinaryStringConstant", + "InvalidBinaryStringConstant", "InvalidUnterminatedBinaryStringConstant", + "HexadecimalStringConstant", "UnterminatedHexadecimalStringConstant", + "InvalidHexadecimalStringConstant", "InvalidUnterminatedHexadecimalStringConstant", + "Integral", "NumericFail", "Numeric", "PLSQLVARIABLENAME", "PLSQLIDENTIFIER", + "Whitespace", "Newline", "LineComment", "BlockComment", "UnterminatedBlockComment", + "MetaCommand", "EndMetaCommand", "ErrorCharacter", "EscapeStringConstant", + "UnterminatedEscapeStringConstant", "InvalidEscapeStringConstant", "InvalidUnterminatedEscapeStringConstant", + "AfterEscapeStringConstantMode_NotContinued", "AfterEscapeStringConstantWithNewlineMode_NotContinued", + "DollarText", "EndDollarStringConstant", "AfterEscapeStringConstantWithNewlineMode_Continued", + } + staticData.RuleNames = []string{ + "Dollar", "OPEN_PAREN", "CLOSE_PAREN", "OPEN_BRACKET", "CLOSE_BRACKET", + "COMMA", "SEMI", "COLON", "STAR", "EQUAL", "DOT", "PLUS", "MINUS", "SLASH", + "CARET", "LT", "GT", "LESS_LESS", "GREATER_GREATER", "COLON_EQUALS", + "LESS_EQUALS", "EQUALS_GREATER", "GREATER_EQUALS", "DOT_DOT", "NOT_EQUALS", + "TYPECAST", "PERCENT", "PARAM", "Operator", "OperatorEndingWithPlusMinus", + "OperatorCharacter", "OperatorCharacterNotAllowPlusMinusAtEnd", "OperatorCharacterAllowPlusMinusAtEnd", + "ALL", "ANALYSE", "ANALYZE", "AND", "ANY", "ARRAY", "AS", "ASC", "ASYMMETRIC", + "BOTH", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "CONSTRAINT", + "CREATE", "CURRENT_CATALOG", "CURRENT_DATE", "CURRENT_ROLE", "CURRENT_TIME", + "CURRENT_TIMESTAMP", "CURRENT_USER", "DEFAULT", "DEFERRABLE", "DESC", + "DISTINCT", "DO", "ELSE", "EXCEPT", "FALSE_P", "FETCH", "FOR", "FOREIGN", + "FROM", "GRANT", "GROUP_P", "HAVING", "IN_P", "INITIALLY", "INTERSECT", + "INTO", "LATERAL_P", "LEADING", "LIMIT", "LOCALTIME", "LOCALTIMESTAMP", + "NOT", "NULL_P", "OFFSET", "ON", "ONLY", "OR", "ORDER", "PLACING", "PRIMARY", + "REFERENCES", "RETURNING", "SELECT", "SESSION_USER", "SOME", "SYMMETRIC", + "TABLE", "THEN", "TO", "TRAILING", "TRUE_P", "UNION", "UNIQUE", "USER", + "USING", "VARIADIC", "WHEN", "WHERE", "WINDOW", "WITH", "AUTHORIZATION", + "BINARY", "COLLATION", "CONCURRENTLY", "CROSS", "CURRENT_SCHEMA", "FREEZE", + "FULL", "ILIKE", "INNER_P", "IS", "ISNULL", "JOIN", "LEFT", "LIKE", + "NATURAL", "NOTNULL", "OUTER_P", "OVER", "OVERLAPS", "RIGHT", "SIMILAR", + "VERBOSE", "ABORT_P", "ABSOLUTE_P", "ACCESS", "ACTION", "ADD_P", "ADMIN", + "AFTER", "AGGREGATE", "ALSO", "ALTER", "ALWAYS", "ASSERTION", "ASSIGNMENT", + "AT", "ATTRIBUTE", "BACKWARD", "BEFORE", "BEGIN_P", "BY", "CACHE", "CALLED", + "CASCADE", "CASCADED", "CATALOG", "CHAIN", "CHARACTERISTICS", "CHECKPOINT", + "CLASS", "CLOSE", "CLUSTER", "COMMENT", "COMMENTS", "COMMIT", "COMMITTED", + "CONFIGURATION", "CONNECTION", "CONSTRAINTS", "CONTENT_P", "CONTINUE_P", + "CONVERSION_P", "COPY", "COST", "CSV", "CURSOR", "CYCLE", "DATA_P", + "DATABASE", "DAY_P", "DEALLOCATE", "DECLARE", "DEFAULTS", "DEFERRED", + "DEFINER", "DELETE_P", "DELIMITER", "DELIMITERS", "DICTIONARY", "DISABLE_P", + "DISCARD", "DOCUMENT_P", "DOMAIN_P", "DOUBLE_P", "DROP", "EACH", "ENABLE_P", + "ENCODING", "ENCRYPTED", "ENUM_P", "ESCAPE", "EVENT", "EXCLUDE", "EXCLUDING", + "EXCLUSIVE", "EXECUTE", "EXPLAIN", "EXTENSION", "EXTERNAL", "FAMILY", + "FIRST_P", "FOLLOWING", "FORCE", "FORWARD", "FUNCTION", "FUNCTIONS", + "GLOBAL", "GRANTED", "HANDLER", "HEADER_P", "HOLD", "HOUR_P", "IDENTITY_P", + "IF_P", "IMMEDIATE", "IMMUTABLE", "IMPLICIT_P", "INCLUDING", "INCREMENT", + "INDEX", "INDEXES", "INHERIT", "INHERITS", "INLINE_P", "INSENSITIVE", + "INSERT", "INSTEAD", "INVOKER", "ISOLATION", "KEY", "LABEL", "LANGUAGE", + "LARGE_P", "LAST_P", "LEAKPROOF", "LEVEL", "LISTEN", "LOAD", "LOCAL", + "LOCATION", "LOCK_P", "MAPPING", "MATCH", "MATCHED", "MATERIALIZED", + "MAXVALUE", "MERGE", "MINUTE_P", "MINVALUE", "MODE", "MONTH_P", "MOVE", + "NAME_P", "NAMES", "NEXT", "NO", "NOTHING", "NOTIFY", "NOWAIT", "NULLS_P", + "OBJECT_P", "OF", "OFF", "OIDS", "OPERATOR", "OPTION", "OPTIONS", "OWNED", + "OWNER", "PARSER", "PARTIAL", "PARTITION", "PASSING", "PASSWORD", "PLANS", + "PRECEDING", "PREPARE", "PREPARED", "PRESERVE", "PRIOR", "PRIVILEGES", + "PROCEDURAL", "PROCEDURE", "PROGRAM", "QUOTE", "RANGE", "READ", "REASSIGN", + "RECHECK", "RECURSIVE", "REF", "REFRESH", "REINDEX", "RELATIVE_P", "RELEASE", + "RENAME", "REPEATABLE", "REPLACE", "REPLICA", "RESET", "RESTART", "RESTRICT", + "RETURNS", "REVOKE", "ROLE", "ROLLBACK", "ROWS", "RULE", "SAVEPOINT", + "SCHEMA", "SCROLL", "SEARCH", "SECOND_P", "SECURITY", "SEQUENCE", "SEQUENCES", + "SERIALIZABLE", "SERVER", "SESSION", "SET", "SHARE", "SHOW", "SIMPLE", + "SNAPSHOT", "STABLE", "STANDALONE_P", "START", "STATEMENT", "STATISTICS", + "STDIN", "STDOUT", "STORAGE", "STRICT_P", "STRIP_P", "SYSID", "SYSTEM_P", + "TABLES", "TABLESPACE", "TEMP", "TEMPLATE", "TEMPORARY", "TEXT_P", "TRANSACTION", + "TRIGGER", "TRUNCATE", "TRUSTED", "TYPE_P", "TYPES_P", "UNBOUNDED", + "UNCOMMITTED", "UNENCRYPTED", "UNKNOWN", "UNLISTEN", "UNLOGGED", "UNTIL", + "UPDATE", "VACUUM", "VALID", "VALIDATE", "VALIDATOR", "VARYING", "VERSION_P", + "VIEW", "VOLATILE", "WHITESPACE_P", "WITHOUT", "WORK", "WRAPPER", "WRITE", + "XML_P", "YEAR_P", "YES_P", "ZONE", "ATOMIC_P", "BETWEEN", "BIGINT", + "BIT", "BOOLEAN_P", "CHAR_P", "CHARACTER", "COALESCE", "DEC", "DECIMAL_P", + "EXISTS", "EXTRACT", "FLOAT_P", "GREATEST", "INOUT", "INT_P", "INTEGER", + "INTERVAL", "LEAST", "NATIONAL", "NCHAR", "NONE", "NULLIF", "NUMERIC", + "OVERLAY", "PARAMETER", "POSITION", "PRECISION", "REAL", "ROW", "SETOF", + "SMALLINT", "SUBSTRING", "TIME", "TIMESTAMP", "TREAT", "TRIM", "VALUES", + "VARCHAR", "XMLATTRIBUTES", "XMLCOMMENT", "XMLAGG", "XML_IS_WELL_FORMED", + "XML_IS_WELL_FORMED_DOCUMENT", "XML_IS_WELL_FORMED_CONTENT", "XPATH", + "XPATH_EXISTS", "XMLCONCAT", "XMLELEMENT", "XMLEXISTS", "XMLFOREST", + "XMLPARSE", "XMLPI", "XMLROOT", "XMLSERIALIZE", "CALL", "CURRENT_P", + "ATTACH", "DETACH", "EXPRESSION", "GENERATED", "LOGGED", "STORED", "INCLUDE", + "ROUTINE", "TRANSFORM", "IMPORT_P", "POLICY", "METHOD", "REFERENCING", + "NEW", "OLD", "VALUE_P", "SUBSCRIPTION", "PUBLICATION", "OUT_P", "END_P", + "ROUTINES", "SCHEMAS", "PROCEDURES", "INPUT_P", "SUPPORT", "PARALLEL", + "SQL_P", "DEPENDS", "OVERRIDING", "CONFLICT", "SKIP_P", "LOCKED", "TIES", + "ROLLUP", "CUBE", "GROUPING", "SETS", "TABLESAMPLE", "ORDINALITY", "XMLTABLE", + "COLUMNS", "XMLNAMESPACES", "ROWTYPE", "NORMALIZED", "WITHIN", "FILTER", + "GROUPS", "OTHERS", "NFC", "NFD", "NFKC", "NFKD", "UESCAPE", "VIEWS", + "NORMALIZE", "DUMP", "PRINT_STRICT_PARAMS", "VARIABLE_CONFLICT", "ERROR", + "USE_VARIABLE", "USE_COLUMN", "ALIAS", "CONSTANT", "PERFORM", "GET", + "DIAGNOSTICS", "STACKED", "ELSIF", "WHILE", "REVERSE", "FOREACH", "SLICE", + "EXIT", "RETURN", "QUERY", "RAISE", "SQLSTATE", "DEBUG", "LOG", "INFO", + "NOTICE", "WARNING", "EXCEPTION", "ASSERT", "LOOP", "OPEN", "ABS", "CBRT", + "CEIL", "CEILING", "DEGREES", "DIV", "EXP", "FACTORIAL", "FLOOR", "GCD", + "LCM", "LN", "LOG10", "MIN_SCALE", "MOD", "PI", "POWER", "RADIANS", + "ROUND", "SCALE", "SIGN", "SQRT", "TRIM_SCALE", "TRUNC", "WIDTH_BUCKET", + "RANDOM", "SETSEED", "ACOS", "ACOSD", "ASIN", "ASIND", "ATAN", "ATAND", + "ATAN2", "ATAN2D", "COS", "COSD", "COT", "COTD", "SIN", "SIND", "TAN", + "TAND", "SINH", "COSH", "TANH", "ASINH", "ACOSH", "ATANH", "BIT_LENGTH", + "CHAR_LENGTH", "CHARACTER_LENGTH", "LOWER", "OCTET_LENGTH", "UPPER", + "ASCII", "BTRIM", "CHR", "CONCAT", "CONCAT_WS", "FORMAT", "INITCAP", + "LENGTH", "LPAD", "LTRIM", "MD5", "PARSE_IDENT", "PG_CLIENT_ENCODING", + "QUOTE_IDENT", "QUOTE_LITERAL", "QUOTE_NULLABLE", "REGEXP_COUNT", "REGEXP_INSTR", + "REGEXP_LIKE", "REGEXP_MATCH", "REGEXP_MATCHES", "REGEXP_REPLACE", "REGEXP_SPLIT_TO_ARRAY", + "REGEXP_SPLIT_TO_TABLE", "REGEXP_SUBSTR", "REPEAT", "RPAD", "RTRIM", + "SPLIT_PART", "STARTS_WITH", "STRING_TO_ARRAY", "STRING_TO_TABLE", "STRPOS", + "SUBSTR", "TO_ASCII", "TO_HEX", "TRANSLATE", "UNISTR", "AGE", "CLOCK_TIMESTAMP", + "DATE_BIN", "DATE_PART", "DATE_TRUNC", "ISFINITE", "JUSTIFY_DAYS", "JUSTIFY_HOURS", + "JUSTIFY_INTERVAL", "MAKE_DATE", "MAKE_INTERVAL", "MAKE_TIME", "MAKE_TIMESTAMP", + "MAKE_TIMESTAMPTZ", "NOW", "STATEMENT_TIMESTAMP", "TIMEOFDAY", "TRANSACTION_TIMESTAMP", + "TO_TIMESTAMP", "TO_CHAR", "TO_DATE", "TO_NUMBER", "ENCODE", "DISTKEY", + "SORTKEY", "CASE_SENSITIVE", "CASE_INSENSITIVE", "Identifier", "IdentifierStartChar", + "IdentifierChar", "StrictIdentifierChar", "QuotedIdentifier", "UnterminatedQuotedIdentifier", + "InvalidQuotedIdentifier", "InvalidUnterminatedQuotedIdentifier", "UnicodeQuotedIdentifier", + "UnterminatedUnicodeQuotedIdentifier", "InvalidUnicodeQuotedIdentifier", + "InvalidUnterminatedUnicodeQuotedIdentifier", "StringConstant", "UnterminatedStringConstant", + "BeginEscapeStringConstant", "UnicodeEscapeStringConstant", "UnterminatedUnicodeEscapeStringConstant", + "BeginDollarStringConstant", "Tag", "BinaryStringConstant", "UnterminatedBinaryStringConstant", + "InvalidBinaryStringConstant", "InvalidUnterminatedBinaryStringConstant", + "HexadecimalStringConstant", "UnterminatedHexadecimalStringConstant", + "InvalidHexadecimalStringConstant", "InvalidUnterminatedHexadecimalStringConstant", + "Integral", "NumericFail", "Numeric", "Digits", "PLSQLVARIABLENAME", + "PLSQLIDENTIFIER", "Whitespace", "Newline", "LineComment", "BlockComment", + "UnterminatedBlockComment", "MetaCommand", "EndMetaCommand", "ErrorCharacter", + "EscapeStringConstant", "UnterminatedEscapeStringConstant", "EscapeStringText", + "InvalidEscapeStringConstant", "InvalidUnterminatedEscapeStringConstant", + "InvalidEscapeStringText", "AfterEscapeStringConstantMode_Whitespace", + "AfterEscapeStringConstantMode_Newline", "AfterEscapeStringConstantMode_NotContinued", + "AfterEscapeStringConstantWithNewlineMode_Whitespace", "AfterEscapeStringConstantWithNewlineMode_Newline", + "AfterEscapeStringConstantWithNewlineMode_Continued", "AfterEscapeStringConstantWithNewlineMode_NotContinued", + "DollarText", "EndDollarStringConstant", + } + staticData.PredictionContextCache = antlr.NewPredictionContextCache() + staticData.serializedATN = []int32{ + 4, 0, 686, 6874, 6, -1, 6, -1, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, + 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, + 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, + 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, + 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, + 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, + 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, + 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, + 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, + 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, + 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, + 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, + 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, + 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, + 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, + 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, + 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, + 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, + 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, + 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, + 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, + 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, + 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, + 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, + 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, + 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, + 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, + 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, + 2, 138, 7, 138, 2, 139, 7, 139, 2, 140, 7, 140, 2, 141, 7, 141, 2, 142, + 7, 142, 2, 143, 7, 143, 2, 144, 7, 144, 2, 145, 7, 145, 2, 146, 7, 146, + 2, 147, 7, 147, 2, 148, 7, 148, 2, 149, 7, 149, 2, 150, 7, 150, 2, 151, + 7, 151, 2, 152, 7, 152, 2, 153, 7, 153, 2, 154, 7, 154, 2, 155, 7, 155, + 2, 156, 7, 156, 2, 157, 7, 157, 2, 158, 7, 158, 2, 159, 7, 159, 2, 160, + 7, 160, 2, 161, 7, 161, 2, 162, 7, 162, 2, 163, 7, 163, 2, 164, 7, 164, + 2, 165, 7, 165, 2, 166, 7, 166, 2, 167, 7, 167, 2, 168, 7, 168, 2, 169, + 7, 169, 2, 170, 7, 170, 2, 171, 7, 171, 2, 172, 7, 172, 2, 173, 7, 173, + 2, 174, 7, 174, 2, 175, 7, 175, 2, 176, 7, 176, 2, 177, 7, 177, 2, 178, + 7, 178, 2, 179, 7, 179, 2, 180, 7, 180, 2, 181, 7, 181, 2, 182, 7, 182, + 2, 183, 7, 183, 2, 184, 7, 184, 2, 185, 7, 185, 2, 186, 7, 186, 2, 187, + 7, 187, 2, 188, 7, 188, 2, 189, 7, 189, 2, 190, 7, 190, 2, 191, 7, 191, + 2, 192, 7, 192, 2, 193, 7, 193, 2, 194, 7, 194, 2, 195, 7, 195, 2, 196, + 7, 196, 2, 197, 7, 197, 2, 198, 7, 198, 2, 199, 7, 199, 2, 200, 7, 200, + 2, 201, 7, 201, 2, 202, 7, 202, 2, 203, 7, 203, 2, 204, 7, 204, 2, 205, + 7, 205, 2, 206, 7, 206, 2, 207, 7, 207, 2, 208, 7, 208, 2, 209, 7, 209, + 2, 210, 7, 210, 2, 211, 7, 211, 2, 212, 7, 212, 2, 213, 7, 213, 2, 214, + 7, 214, 2, 215, 7, 215, 2, 216, 7, 216, 2, 217, 7, 217, 2, 218, 7, 218, + 2, 219, 7, 219, 2, 220, 7, 220, 2, 221, 7, 221, 2, 222, 7, 222, 2, 223, + 7, 223, 2, 224, 7, 224, 2, 225, 7, 225, 2, 226, 7, 226, 2, 227, 7, 227, + 2, 228, 7, 228, 2, 229, 7, 229, 2, 230, 7, 230, 2, 231, 7, 231, 2, 232, + 7, 232, 2, 233, 7, 233, 2, 234, 7, 234, 2, 235, 7, 235, 2, 236, 7, 236, + 2, 237, 7, 237, 2, 238, 7, 238, 2, 239, 7, 239, 2, 240, 7, 240, 2, 241, + 7, 241, 2, 242, 7, 242, 2, 243, 7, 243, 2, 244, 7, 244, 2, 245, 7, 245, + 2, 246, 7, 246, 2, 247, 7, 247, 2, 248, 7, 248, 2, 249, 7, 249, 2, 250, + 7, 250, 2, 251, 7, 251, 2, 252, 7, 252, 2, 253, 7, 253, 2, 254, 7, 254, + 2, 255, 7, 255, 2, 256, 7, 256, 2, 257, 7, 257, 2, 258, 7, 258, 2, 259, + 7, 259, 2, 260, 7, 260, 2, 261, 7, 261, 2, 262, 7, 262, 2, 263, 7, 263, + 2, 264, 7, 264, 2, 265, 7, 265, 2, 266, 7, 266, 2, 267, 7, 267, 2, 268, + 7, 268, 2, 269, 7, 269, 2, 270, 7, 270, 2, 271, 7, 271, 2, 272, 7, 272, + 2, 273, 7, 273, 2, 274, 7, 274, 2, 275, 7, 275, 2, 276, 7, 276, 2, 277, + 7, 277, 2, 278, 7, 278, 2, 279, 7, 279, 2, 280, 7, 280, 2, 281, 7, 281, + 2, 282, 7, 282, 2, 283, 7, 283, 2, 284, 7, 284, 2, 285, 7, 285, 2, 286, + 7, 286, 2, 287, 7, 287, 2, 288, 7, 288, 2, 289, 7, 289, 2, 290, 7, 290, + 2, 291, 7, 291, 2, 292, 7, 292, 2, 293, 7, 293, 2, 294, 7, 294, 2, 295, + 7, 295, 2, 296, 7, 296, 2, 297, 7, 297, 2, 298, 7, 298, 2, 299, 7, 299, + 2, 300, 7, 300, 2, 301, 7, 301, 2, 302, 7, 302, 2, 303, 7, 303, 2, 304, + 7, 304, 2, 305, 7, 305, 2, 306, 7, 306, 2, 307, 7, 307, 2, 308, 7, 308, + 2, 309, 7, 309, 2, 310, 7, 310, 2, 311, 7, 311, 2, 312, 7, 312, 2, 313, + 7, 313, 2, 314, 7, 314, 2, 315, 7, 315, 2, 316, 7, 316, 2, 317, 7, 317, + 2, 318, 7, 318, 2, 319, 7, 319, 2, 320, 7, 320, 2, 321, 7, 321, 2, 322, + 7, 322, 2, 323, 7, 323, 2, 324, 7, 324, 2, 325, 7, 325, 2, 326, 7, 326, + 2, 327, 7, 327, 2, 328, 7, 328, 2, 329, 7, 329, 2, 330, 7, 330, 2, 331, + 7, 331, 2, 332, 7, 332, 2, 333, 7, 333, 2, 334, 7, 334, 2, 335, 7, 335, + 2, 336, 7, 336, 2, 337, 7, 337, 2, 338, 7, 338, 2, 339, 7, 339, 2, 340, + 7, 340, 2, 341, 7, 341, 2, 342, 7, 342, 2, 343, 7, 343, 2, 344, 7, 344, + 2, 345, 7, 345, 2, 346, 7, 346, 2, 347, 7, 347, 2, 348, 7, 348, 2, 349, + 7, 349, 2, 350, 7, 350, 2, 351, 7, 351, 2, 352, 7, 352, 2, 353, 7, 353, + 2, 354, 7, 354, 2, 355, 7, 355, 2, 356, 7, 356, 2, 357, 7, 357, 2, 358, + 7, 358, 2, 359, 7, 359, 2, 360, 7, 360, 2, 361, 7, 361, 2, 362, 7, 362, + 2, 363, 7, 363, 2, 364, 7, 364, 2, 365, 7, 365, 2, 366, 7, 366, 2, 367, + 7, 367, 2, 368, 7, 368, 2, 369, 7, 369, 2, 370, 7, 370, 2, 371, 7, 371, + 2, 372, 7, 372, 2, 373, 7, 373, 2, 374, 7, 374, 2, 375, 7, 375, 2, 376, + 7, 376, 2, 377, 7, 377, 2, 378, 7, 378, 2, 379, 7, 379, 2, 380, 7, 380, + 2, 381, 7, 381, 2, 382, 7, 382, 2, 383, 7, 383, 2, 384, 7, 384, 2, 385, + 7, 385, 2, 386, 7, 386, 2, 387, 7, 387, 2, 388, 7, 388, 2, 389, 7, 389, + 2, 390, 7, 390, 2, 391, 7, 391, 2, 392, 7, 392, 2, 393, 7, 393, 2, 394, + 7, 394, 2, 395, 7, 395, 2, 396, 7, 396, 2, 397, 7, 397, 2, 398, 7, 398, + 2, 399, 7, 399, 2, 400, 7, 400, 2, 401, 7, 401, 2, 402, 7, 402, 2, 403, + 7, 403, 2, 404, 7, 404, 2, 405, 7, 405, 2, 406, 7, 406, 2, 407, 7, 407, + 2, 408, 7, 408, 2, 409, 7, 409, 2, 410, 7, 410, 2, 411, 7, 411, 2, 412, + 7, 412, 2, 413, 7, 413, 2, 414, 7, 414, 2, 415, 7, 415, 2, 416, 7, 416, + 2, 417, 7, 417, 2, 418, 7, 418, 2, 419, 7, 419, 2, 420, 7, 420, 2, 421, + 7, 421, 2, 422, 7, 422, 2, 423, 7, 423, 2, 424, 7, 424, 2, 425, 7, 425, + 2, 426, 7, 426, 2, 427, 7, 427, 2, 428, 7, 428, 2, 429, 7, 429, 2, 430, + 7, 430, 2, 431, 7, 431, 2, 432, 7, 432, 2, 433, 7, 433, 2, 434, 7, 434, + 2, 435, 7, 435, 2, 436, 7, 436, 2, 437, 7, 437, 2, 438, 7, 438, 2, 439, + 7, 439, 2, 440, 7, 440, 2, 441, 7, 441, 2, 442, 7, 442, 2, 443, 7, 443, + 2, 444, 7, 444, 2, 445, 7, 445, 2, 446, 7, 446, 2, 447, 7, 447, 2, 448, + 7, 448, 2, 449, 7, 449, 2, 450, 7, 450, 2, 451, 7, 451, 2, 452, 7, 452, + 2, 453, 7, 453, 2, 454, 7, 454, 2, 455, 7, 455, 2, 456, 7, 456, 2, 457, + 7, 457, 2, 458, 7, 458, 2, 459, 7, 459, 2, 460, 7, 460, 2, 461, 7, 461, + 2, 462, 7, 462, 2, 463, 7, 463, 2, 464, 7, 464, 2, 465, 7, 465, 2, 466, + 7, 466, 2, 467, 7, 467, 2, 468, 7, 468, 2, 469, 7, 469, 2, 470, 7, 470, + 2, 471, 7, 471, 2, 472, 7, 472, 2, 473, 7, 473, 2, 474, 7, 474, 2, 475, + 7, 475, 2, 476, 7, 476, 2, 477, 7, 477, 2, 478, 7, 478, 2, 479, 7, 479, + 2, 480, 7, 480, 2, 481, 7, 481, 2, 482, 7, 482, 2, 483, 7, 483, 2, 484, + 7, 484, 2, 485, 7, 485, 2, 486, 7, 486, 2, 487, 7, 487, 2, 488, 7, 488, + 2, 489, 7, 489, 2, 490, 7, 490, 2, 491, 7, 491, 2, 492, 7, 492, 2, 493, + 7, 493, 2, 494, 7, 494, 2, 495, 7, 495, 2, 496, 7, 496, 2, 497, 7, 497, + 2, 498, 7, 498, 2, 499, 7, 499, 2, 500, 7, 500, 2, 501, 7, 501, 2, 502, + 7, 502, 2, 503, 7, 503, 2, 504, 7, 504, 2, 505, 7, 505, 2, 506, 7, 506, + 2, 507, 7, 507, 2, 508, 7, 508, 2, 509, 7, 509, 2, 510, 7, 510, 2, 511, + 7, 511, 2, 512, 7, 512, 2, 513, 7, 513, 2, 514, 7, 514, 2, 515, 7, 515, + 2, 516, 7, 516, 2, 517, 7, 517, 2, 518, 7, 518, 2, 519, 7, 519, 2, 520, + 7, 520, 2, 521, 7, 521, 2, 522, 7, 522, 2, 523, 7, 523, 2, 524, 7, 524, + 2, 525, 7, 525, 2, 526, 7, 526, 2, 527, 7, 527, 2, 528, 7, 528, 2, 529, + 7, 529, 2, 530, 7, 530, 2, 531, 7, 531, 2, 532, 7, 532, 2, 533, 7, 533, + 2, 534, 7, 534, 2, 535, 7, 535, 2, 536, 7, 536, 2, 537, 7, 537, 2, 538, + 7, 538, 2, 539, 7, 539, 2, 540, 7, 540, 2, 541, 7, 541, 2, 542, 7, 542, + 2, 543, 7, 543, 2, 544, 7, 544, 2, 545, 7, 545, 2, 546, 7, 546, 2, 547, + 7, 547, 2, 548, 7, 548, 2, 549, 7, 549, 2, 550, 7, 550, 2, 551, 7, 551, + 2, 552, 7, 552, 2, 553, 7, 553, 2, 554, 7, 554, 2, 555, 7, 555, 2, 556, + 7, 556, 2, 557, 7, 557, 2, 558, 7, 558, 2, 559, 7, 559, 2, 560, 7, 560, + 2, 561, 7, 561, 2, 562, 7, 562, 2, 563, 7, 563, 2, 564, 7, 564, 2, 565, + 7, 565, 2, 566, 7, 566, 2, 567, 7, 567, 2, 568, 7, 568, 2, 569, 7, 569, + 2, 570, 7, 570, 2, 571, 7, 571, 2, 572, 7, 572, 2, 573, 7, 573, 2, 574, + 7, 574, 2, 575, 7, 575, 2, 576, 7, 576, 2, 577, 7, 577, 2, 578, 7, 578, + 2, 579, 7, 579, 2, 580, 7, 580, 2, 581, 7, 581, 2, 582, 7, 582, 2, 583, + 7, 583, 2, 584, 7, 584, 2, 585, 7, 585, 2, 586, 7, 586, 2, 587, 7, 587, + 2, 588, 7, 588, 2, 589, 7, 589, 2, 590, 7, 590, 2, 591, 7, 591, 2, 592, + 7, 592, 2, 593, 7, 593, 2, 594, 7, 594, 2, 595, 7, 595, 2, 596, 7, 596, + 2, 597, 7, 597, 2, 598, 7, 598, 2, 599, 7, 599, 2, 600, 7, 600, 2, 601, + 7, 601, 2, 602, 7, 602, 2, 603, 7, 603, 2, 604, 7, 604, 2, 605, 7, 605, + 2, 606, 7, 606, 2, 607, 7, 607, 2, 608, 7, 608, 2, 609, 7, 609, 2, 610, + 7, 610, 2, 611, 7, 611, 2, 612, 7, 612, 2, 613, 7, 613, 2, 614, 7, 614, + 2, 615, 7, 615, 2, 616, 7, 616, 2, 617, 7, 617, 2, 618, 7, 618, 2, 619, + 7, 619, 2, 620, 7, 620, 2, 621, 7, 621, 2, 622, 7, 622, 2, 623, 7, 623, + 2, 624, 7, 624, 2, 625, 7, 625, 2, 626, 7, 626, 2, 627, 7, 627, 2, 628, + 7, 628, 2, 629, 7, 629, 2, 630, 7, 630, 2, 631, 7, 631, 2, 632, 7, 632, + 2, 633, 7, 633, 2, 634, 7, 634, 2, 635, 7, 635, 2, 636, 7, 636, 2, 637, + 7, 637, 2, 638, 7, 638, 2, 639, 7, 639, 2, 640, 7, 640, 2, 641, 7, 641, + 2, 642, 7, 642, 2, 643, 7, 643, 2, 644, 7, 644, 2, 645, 7, 645, 2, 646, + 7, 646, 2, 647, 7, 647, 2, 648, 7, 648, 2, 649, 7, 649, 2, 650, 7, 650, + 2, 651, 7, 651, 2, 652, 7, 652, 2, 653, 7, 653, 2, 654, 7, 654, 2, 655, + 7, 655, 2, 656, 7, 656, 2, 657, 7, 657, 2, 658, 7, 658, 2, 659, 7, 659, + 2, 660, 7, 660, 2, 661, 7, 661, 2, 662, 7, 662, 2, 663, 7, 663, 2, 664, + 7, 664, 2, 665, 7, 665, 2, 666, 7, 666, 2, 667, 7, 667, 2, 668, 7, 668, + 2, 669, 7, 669, 2, 670, 7, 670, 2, 671, 7, 671, 2, 672, 7, 672, 2, 673, + 7, 673, 2, 674, 7, 674, 2, 675, 7, 675, 2, 676, 7, 676, 2, 677, 7, 677, + 2, 678, 7, 678, 2, 679, 7, 679, 2, 680, 7, 680, 2, 681, 7, 681, 2, 682, + 7, 682, 2, 683, 7, 683, 2, 684, 7, 684, 2, 685, 7, 685, 2, 686, 7, 686, + 2, 687, 7, 687, 2, 688, 7, 688, 2, 689, 7, 689, 2, 690, 7, 690, 2, 691, + 7, 691, 2, 692, 7, 692, 2, 693, 7, 693, 2, 694, 7, 694, 2, 695, 7, 695, + 2, 696, 7, 696, 2, 697, 7, 697, 2, 698, 7, 698, 2, 699, 7, 699, 2, 700, + 7, 700, 2, 701, 7, 701, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, + 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, + 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, + 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 19, + 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, + 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 26, + 1, 26, 1, 27, 1, 27, 4, 27, 1475, 8, 27, 11, 27, 12, 27, 1476, 1, 28, 1, + 28, 1, 28, 1, 28, 4, 28, 1483, 8, 28, 11, 28, 12, 28, 1484, 1, 28, 1, 28, + 1, 28, 3, 28, 1490, 8, 28, 1, 28, 1, 28, 4, 28, 1494, 8, 28, 11, 28, 12, + 28, 1495, 1, 28, 3, 28, 1499, 8, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, + 1, 29, 1, 29, 5, 29, 1508, 8, 29, 10, 29, 12, 29, 1511, 9, 29, 1, 29, 1, + 29, 3, 29, 1515, 8, 29, 1, 29, 1, 29, 1, 29, 4, 29, 1520, 8, 29, 11, 29, + 12, 29, 1521, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, + 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, + 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, + 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, + 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, + 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, + 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, + 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, + 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, + 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, + 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, + 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, + 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, + 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, + 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, + 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, + 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, + 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, 55, 1, + 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, + 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, + 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, + 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, + 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, + 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, + 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, 1, 66, + 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 1, 68, 1, + 68, 1, 68, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 69, 1, 70, 1, 70, 1, 70, + 1, 70, 1, 70, 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 1, + 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, + 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 74, 1, + 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, + 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 77, 1, 77, 1, + 77, 1, 77, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, 1, 78, + 1, 78, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, + 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 79, 1, 80, 1, 80, 1, 80, 1, 80, 1, 81, + 1, 81, 1, 81, 1, 81, 1, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, 82, 1, + 82, 1, 83, 1, 83, 1, 83, 1, 84, 1, 84, 1, 84, 1, 84, 1, 84, 1, 85, 1, 85, + 1, 85, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 1, + 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, 1, 88, + 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, 89, 1, + 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, + 1, 90, 1, 90, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, + 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, 1, 92, + 1, 92, 1, 93, 1, 93, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 1, + 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, + 1, 95, 1, 96, 1, 96, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 98, 1, + 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, + 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 100, 1, 101, 1, + 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, + 102, 1, 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, + 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 105, 1, + 105, 1, 105, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, 1, 106, 1, 106, 1, + 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 108, 1, + 108, 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, + 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, 109, 1, + 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, + 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 111, 1, 112, 1, + 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, + 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, 113, 1, + 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, + 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, + 115, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, + 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, + 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, + 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, + 122, 1, 122, 1, 122, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, + 123, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, 124, 1, + 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, + 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 1, + 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, + 128, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, + 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 130, 1, 131, 1, 131, 1, 131, 1, + 131, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, 1, + 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, + 133, 1, 133, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, 134, 1, + 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, + 136, 1, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 138, 1, + 138, 1, 138, 1, 138, 1, 138, 1, 138, 1, 139, 1, 139, 1, 139, 1, 139, 1, + 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 139, 1, 140, 1, 140, 1, 140, 1, + 140, 1, 140, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 141, 1, 142, 1, + 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, 143, 1, 143, 1, + 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 143, 1, 144, 1, 144, 1, + 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, 144, 1, + 145, 1, 145, 1, 145, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, + 146, 1, 146, 1, 146, 1, 146, 1, 147, 1, 147, 1, 147, 1, 147, 1, 147, 1, + 147, 1, 147, 1, 147, 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, + 148, 1, 148, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 149, 1, 150, 1, + 150, 1, 150, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 151, 1, 152, 1, + 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 152, 1, 153, 1, 153, 1, 153, 1, + 153, 1, 153, 1, 153, 1, 153, 1, 153, 1, 154, 1, 154, 1, 154, 1, 154, 1, + 154, 1, 154, 1, 154, 1, 154, 1, 154, 1, 155, 1, 155, 1, 155, 1, 155, 1, + 155, 1, 155, 1, 155, 1, 155, 1, 156, 1, 156, 1, 156, 1, 156, 1, 156, 1, + 156, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, + 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 157, 1, 158, 1, + 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, 158, 1, + 158, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 159, 1, 160, 1, 160, 1, + 160, 1, 160, 1, 160, 1, 160, 1, 161, 1, 161, 1, 161, 1, 161, 1, 161, 1, + 161, 1, 161, 1, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, + 162, 1, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, + 163, 1, 163, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, 164, 1, + 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, 165, 1, + 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, + 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 167, 1, 167, 1, 167, 1, + 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 168, 1, + 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, + 168, 1, 168, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, 169, 1, + 169, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, 170, 1, + 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, + 171, 1, 171, 1, 171, 1, 172, 1, 172, 1, 172, 1, 172, 1, 172, 1, 173, 1, + 173, 1, 173, 1, 173, 1, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, 1, + 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 175, 1, 176, 1, 176, 1, 176, 1, + 176, 1, 176, 1, 176, 1, 177, 1, 177, 1, 177, 1, 177, 1, 177, 1, 178, 1, + 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 178, 1, 179, 1, + 179, 1, 179, 1, 179, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, + 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 181, 1, 181, 1, 181, 1, 181, 1, + 181, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, 182, 1, 182, 1, 182, 1, + 182, 1, 182, 1, 182, 1, 182, 1, 183, 1, 183, 1, 183, 1, 183, 1, 183, 1, + 183, 1, 183, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, 1, 184, 1, + 184, 1, 184, 1, 184, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, + 185, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, 186, 1, + 186, 1, 186, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, 187, 1, + 187, 1, 187, 1, 187, 1, 187, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, + 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, 1, 189, 1, + 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 190, 1, 190, 1, 190, 1, 190, 1, + 190, 1, 190, 1, 190, 1, 190, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, + 191, 1, 191, 1, 191, 1, 191, 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, + 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, 193, 1, + 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 195, 1, 195, 1, 195, 1, 195, 1, + 195, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 196, 1, 197, 1, + 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 197, 1, 198, 1, + 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, 198, 1, + 199, 1, 199, 1, 199, 1, 199, 1, 199, 1, 200, 1, 200, 1, 200, 1, 200, 1, + 200, 1, 200, 1, 200, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, 201, 1, + 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 203, 1, + 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, 203, 1, + 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, + 204, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, 205, 1, + 206, 1, 206, 1, 206, 1, 206, 1, 206, 1, 206, 1, 206, 1, 206, 1, 207, 1, + 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, 207, 1, + 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, 208, 1, + 209, 1, 209, 1, 209, 1, 209, 1, 209, 1, 209, 1, 209, 1, 210, 1, 210, 1, + 210, 1, 210, 1, 210, 1, 210, 1, 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, + 211, 1, 211, 1, 211, 1, 211, 1, 211, 1, 212, 1, 212, 1, 212, 1, 212, 1, + 212, 1, 212, 1, 213, 1, 213, 1, 213, 1, 213, 1, 213, 1, 213, 1, 213, 1, + 213, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, 214, 1, + 214, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, 215, 1, + 215, 1, 215, 1, 216, 1, 216, 1, 216, 1, 216, 1, 216, 1, 216, 1, 216, 1, + 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, 1, 218, 1, + 218, 1, 218, 1, 218, 1, 218, 1, 218, 1, 218, 1, 218, 1, 219, 1, 219, 1, + 219, 1, 219, 1, 219, 1, 219, 1, 219, 1, 220, 1, 220, 1, 220, 1, 220, 1, + 220, 1, 221, 1, 221, 1, 221, 1, 221, 1, 221, 1, 222, 1, 222, 1, 222, 1, + 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 222, 1, 223, 1, 223, 1, 223, 1, + 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, + 224, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, 225, 1, + 225, 1, 225, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, + 226, 1, 226, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, 227, 1, + 227, 1, 227, 1, 227, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, + 228, 1, 228, 1, 228, 1, 228, 1, 229, 1, 229, 1, 229, 1, 229, 1, 229, 1, + 229, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, + 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 232, 1, + 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 232, 1, 233, 1, + 233, 1, 233, 1, 233, 1, 233, 1, 233, 1, 233, 1, 234, 1, 234, 1, 234, 1, + 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, 234, 1, + 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 236, 1, 236, 1, + 236, 1, 236, 1, 236, 1, 236, 1, 236, 1, 236, 1, 237, 1, 237, 1, 237, 1, + 237, 1, 237, 1, 237, 1, 237, 1, 237, 1, 238, 1, 238, 1, 238, 1, 238, 1, + 238, 1, 238, 1, 238, 1, 238, 1, 238, 1, 238, 1, 239, 1, 239, 1, 239, 1, + 239, 1, 240, 1, 240, 1, 240, 1, 240, 1, 240, 1, 240, 1, 241, 1, 241, 1, + 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 242, 1, 242, 1, + 242, 1, 242, 1, 242, 1, 242, 1, 243, 1, 243, 1, 243, 1, 243, 1, 243, 1, + 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, 244, 1, + 244, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 246, 1, 246, 1, + 246, 1, 246, 1, 246, 1, 246, 1, 246, 1, 247, 1, 247, 1, 247, 1, 247, 1, + 247, 1, 248, 1, 248, 1, 248, 1, 248, 1, 248, 1, 248, 1, 249, 1, 249, 1, + 249, 1, 249, 1, 249, 1, 249, 1, 249, 1, 249, 1, 249, 1, 250, 1, 250, 1, + 250, 1, 250, 1, 250, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, + 251, 1, 251, 1, 252, 1, 252, 1, 252, 1, 252, 1, 252, 1, 252, 1, 253, 1, + 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 254, 1, 254, 1, + 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, + 254, 1, 254, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, + 255, 1, 255, 1, 256, 1, 256, 1, 256, 1, 256, 1, 256, 1, 256, 1, 257, 1, + 257, 1, 257, 1, 257, 1, 257, 1, 257, 1, 257, 1, 258, 1, 258, 1, 258, 1, + 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 259, 1, 259, 1, 259, 1, + 259, 1, 259, 1, 260, 1, 260, 1, 260, 1, 260, 1, 260, 1, 260, 1, 261, 1, + 261, 1, 261, 1, 261, 1, 261, 1, 262, 1, 262, 1, 262, 1, 262, 1, 262, 1, + 263, 1, 263, 1, 263, 1, 263, 1, 263, 1, 263, 1, 264, 1, 264, 1, 264, 1, + 264, 1, 264, 1, 265, 1, 265, 1, 265, 1, 266, 1, 266, 1, 266, 1, 266, 1, + 266, 1, 266, 1, 266, 1, 266, 1, 267, 1, 267, 1, 267, 1, 267, 1, 267, 1, + 267, 1, 267, 1, 268, 1, 268, 1, 268, 1, 268, 1, 268, 1, 268, 1, 268, 1, + 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 270, 1, 270, 1, 270, 1, + 270, 1, 270, 1, 270, 1, 270, 1, 271, 1, 271, 1, 271, 1, 272, 1, 272, 1, + 272, 1, 272, 1, 273, 1, 273, 1, 273, 1, 273, 1, 273, 1, 274, 1, 274, 1, + 274, 1, 274, 1, 274, 1, 274, 1, 274, 1, 274, 1, 274, 1, 275, 1, 275, 1, + 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 276, 1, 276, 1, 276, 1, 276, 1, + 276, 1, 276, 1, 276, 1, 276, 1, 277, 1, 277, 1, 277, 1, 277, 1, 277, 1, + 277, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 1, 279, 1, 279, 1, + 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 280, 1, 280, 1, 280, 1, 280, 1, + 280, 1, 280, 1, 280, 1, 280, 1, 281, 1, 281, 1, 281, 1, 281, 1, 281, 1, + 281, 1, 281, 1, 281, 1, 281, 1, 281, 1, 282, 1, 282, 1, 282, 1, 282, 1, + 282, 1, 282, 1, 282, 1, 282, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, + 283, 1, 283, 1, 283, 1, 283, 1, 284, 1, 284, 1, 284, 1, 284, 1, 284, 1, + 284, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, 285, 1, + 285, 1, 285, 1, 286, 1, 286, 1, 286, 1, 286, 1, 286, 1, 286, 1, 286, 1, + 286, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, 287, 1, + 287, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, 288, 1, + 288, 1, 289, 1, 289, 1, 289, 1, 289, 1, 289, 1, 289, 1, 290, 1, 290, 1, + 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 1, + 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, 291, 1, + 291, 1, 291, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, 292, 1, + 292, 1, 292, 1, 292, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, 1, + 293, 1, 293, 1, 294, 1, 294, 1, 294, 1, 294, 1, 294, 1, 294, 1, 295, 1, + 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 296, 1, 296, 1, 296, 1, 296, 1, + 296, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, 297, 1, + 297, 1, 298, 1, 298, 1, 298, 1, 298, 1, 298, 1, 298, 1, 298, 1, 298, 1, + 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, 299, 1, + 299, 1, 300, 1, 300, 1, 300, 1, 300, 1, 301, 1, 301, 1, 301, 1, 301, 1, + 301, 1, 301, 1, 301, 1, 301, 1, 302, 1, 302, 1, 302, 1, 302, 1, 302, 1, + 302, 1, 302, 1, 302, 1, 303, 1, 303, 1, 303, 1, 303, 1, 303, 1, 303, 1, + 303, 1, 303, 1, 303, 1, 304, 1, 304, 1, 304, 1, 304, 1, 304, 1, 304, 1, + 304, 1, 304, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, + 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, + 306, 1, 306, 1, 307, 1, 307, 1, 307, 1, 307, 1, 307, 1, 307, 1, 307, 1, + 307, 1, 308, 1, 308, 1, 308, 1, 308, 1, 308, 1, 308, 1, 308, 1, 308, 1, + 309, 1, 309, 1, 309, 1, 309, 1, 309, 1, 309, 1, 310, 1, 310, 1, 310, 1, + 310, 1, 310, 1, 310, 1, 310, 1, 310, 1, 311, 1, 311, 1, 311, 1, 311, 1, + 311, 1, 311, 1, 311, 1, 311, 1, 311, 1, 312, 1, 312, 1, 312, 1, 312, 1, + 312, 1, 312, 1, 312, 1, 312, 1, 313, 1, 313, 1, 313, 1, 313, 1, 313, 1, + 313, 1, 313, 1, 314, 1, 314, 1, 314, 1, 314, 1, 314, 1, 315, 1, 315, 1, + 315, 1, 315, 1, 315, 1, 315, 1, 315, 1, 315, 1, 315, 1, 316, 1, 316, 1, + 316, 1, 316, 1, 316, 1, 317, 1, 317, 1, 317, 1, 317, 1, 317, 1, 318, 1, + 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, 318, 1, + 319, 1, 319, 1, 319, 1, 319, 1, 319, 1, 319, 1, 319, 1, 320, 1, 320, 1, + 320, 1, 320, 1, 320, 1, 320, 1, 320, 1, 321, 1, 321, 1, 321, 1, 321, 1, + 321, 1, 321, 1, 321, 1, 322, 1, 322, 1, 322, 1, 322, 1, 322, 1, 322, 1, + 322, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, 323, 1, + 323, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, 324, 1, + 324, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, 325, 1, + 325, 1, 325, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, + 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 326, 1, 327, 1, 327, 1, 327, 1, + 327, 1, 327, 1, 327, 1, 327, 1, 328, 1, 328, 1, 328, 1, 328, 1, 328, 1, + 328, 1, 328, 1, 328, 1, 329, 1, 329, 1, 329, 1, 329, 1, 330, 1, 330, 1, + 330, 1, 330, 1, 330, 1, 330, 1, 331, 1, 331, 1, 331, 1, 331, 1, 331, 1, + 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 333, 1, 333, 1, + 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 334, 1, 334, 1, + 334, 1, 334, 1, 334, 1, 334, 1, 334, 1, 335, 1, 335, 1, 335, 1, 335, 1, + 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 335, 1, 336, 1, 336, 1, + 336, 1, 336, 1, 336, 1, 336, 1, 337, 1, 337, 1, 337, 1, 337, 1, 337, 1, + 337, 1, 337, 1, 337, 1, 337, 1, 337, 1, 338, 1, 338, 1, 338, 1, 338, 1, + 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 338, 1, 339, 1, 339, 1, + 339, 1, 339, 1, 339, 1, 339, 1, 340, 1, 340, 1, 340, 1, 340, 1, 340, 1, + 340, 1, 340, 1, 341, 1, 341, 1, 341, 1, 341, 1, 341, 1, 341, 1, 341, 1, + 341, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 343, 1, + 343, 1, 343, 1, 343, 1, 343, 1, 343, 1, 344, 1, 344, 1, 344, 1, 344, 1, + 344, 1, 344, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, + 346, 1, 346, 1, 346, 1, 346, 1, 346, 1, 346, 1, 346, 1, 347, 1, 347, 1, + 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, 347, 1, + 348, 1, 348, 1, 348, 1, 348, 1, 348, 1, 349, 1, 349, 1, 349, 1, 349, 1, + 349, 1, 349, 1, 349, 1, 349, 1, 349, 1, 350, 1, 350, 1, 350, 1, 350, 1, + 350, 1, 350, 1, 350, 1, 350, 1, 350, 1, 350, 1, 351, 1, 351, 1, 351, 1, + 351, 1, 351, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, + 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 353, 1, 353, 1, 353, 1, 353, 1, + 353, 1, 353, 1, 353, 1, 353, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, + 354, 1, 354, 1, 354, 1, 354, 1, 355, 1, 355, 1, 355, 1, 355, 1, 355, 1, + 355, 1, 355, 1, 355, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 357, 1, + 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 358, 1, 358, 1, 358, 1, 358, 1, + 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 358, 1, 359, 1, 359, 1, 359, 1, + 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, + 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, 360, 1, + 360, 1, 360, 1, 360, 1, 361, 1, 361, 1, 361, 1, 361, 1, 361, 1, 361, 1, + 361, 1, 361, 1, 362, 1, 362, 1, 362, 1, 362, 1, 362, 1, 362, 1, 362, 1, + 362, 1, 362, 1, 363, 1, 363, 1, 363, 1, 363, 1, 363, 1, 363, 1, 363, 1, + 363, 1, 363, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 366, 1, 366, 1, 366, 1, + 366, 1, 366, 1, 366, 1, 366, 1, 367, 1, 367, 1, 367, 1, 367, 1, 367, 1, + 367, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, + 368, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, 369, 1, + 369, 1, 369, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, 371, 1, + 372, 1, 372, 1, 372, 1, 372, 1, 372, 1, 373, 1, 373, 1, 373, 1, 373, 1, + 373, 1, 373, 1, 373, 1, 373, 1, 373, 1, 374, 1, 374, 1, 374, 1, 374, 1, + 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 374, 1, 375, 1, 375, 1, + 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 375, 1, 376, 1, 376, 1, 376, 1, + 376, 1, 376, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, + 377, 1, 378, 1, 378, 1, 378, 1, 378, 1, 378, 1, 378, 1, 379, 1, 379, 1, + 379, 1, 379, 1, 380, 1, 380, 1, 380, 1, 380, 1, 380, 1, 381, 1, 381, 1, + 381, 1, 381, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 1, 383, 1, 383, 1, + 383, 1, 383, 1, 383, 1, 383, 1, 383, 1, 384, 1, 384, 1, 384, 1, 384, 1, + 384, 1, 384, 1, 384, 1, 384, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, + 385, 1, 385, 1, 386, 1, 386, 1, 386, 1, 386, 1, 387, 1, 387, 1, 387, 1, + 387, 1, 387, 1, 387, 1, 387, 1, 387, 1, 388, 1, 388, 1, 388, 1, 388, 1, + 388, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, 389, 1, + 389, 1, 389, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 1, + 390, 1, 390, 1, 391, 1, 391, 1, 391, 1, 391, 1, 392, 1, 392, 1, 392, 1, + 392, 1, 392, 1, 392, 1, 392, 1, 392, 1, 393, 1, 393, 1, 393, 1, 393, 1, + 393, 1, 393, 1, 393, 1, 394, 1, 394, 1, 394, 1, 394, 1, 394, 1, 394, 1, + 394, 1, 394, 1, 395, 1, 395, 1, 395, 1, 395, 1, 395, 1, 395, 1, 396, 1, + 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 396, 1, 397, 1, + 397, 1, 397, 1, 397, 1, 397, 1, 397, 1, 398, 1, 398, 1, 398, 1, 398, 1, + 399, 1, 399, 1, 399, 1, 399, 1, 399, 1, 399, 1, 399, 1, 399, 1, 400, 1, + 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 401, 1, + 401, 1, 401, 1, 401, 1, 401, 1, 401, 1, 402, 1, 402, 1, 402, 1, 402, 1, + 402, 1, 402, 1, 402, 1, 402, 1, 402, 1, 403, 1, 403, 1, 403, 1, 403, 1, + 403, 1, 403, 1, 404, 1, 404, 1, 404, 1, 404, 1, 404, 1, 405, 1, 405, 1, + 405, 1, 405, 1, 405, 1, 405, 1, 405, 1, 406, 1, 406, 1, 406, 1, 406, 1, + 406, 1, 406, 1, 406, 1, 406, 1, 407, 1, 407, 1, 407, 1, 407, 1, 407, 1, + 407, 1, 407, 1, 407, 1, 408, 1, 408, 1, 408, 1, 408, 1, 408, 1, 408, 1, + 408, 1, 408, 1, 408, 1, 408, 1, 409, 1, 409, 1, 409, 1, 409, 1, 409, 1, + 409, 1, 409, 1, 409, 1, 409, 1, 410, 1, 410, 1, 410, 1, 410, 1, 410, 1, + 410, 1, 410, 1, 410, 1, 410, 1, 410, 1, 411, 1, 411, 1, 411, 1, 411, 1, + 411, 1, 412, 1, 412, 1, 412, 1, 412, 1, 413, 1, 413, 1, 413, 1, 413, 1, + 413, 1, 413, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, 414, 1, + 414, 1, 414, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, 415, 1, + 415, 1, 415, 1, 415, 1, 416, 1, 416, 1, 416, 1, 416, 1, 416, 1, 417, 1, + 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, 417, 1, + 418, 1, 418, 1, 418, 1, 418, 1, 418, 1, 418, 1, 419, 1, 419, 1, 419, 1, + 419, 1, 419, 1, 420, 1, 420, 1, 420, 1, 420, 1, 420, 1, 420, 1, 420, 1, + 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 422, 1, + 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, 422, 1, + 422, 1, 422, 1, 422, 1, 422, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, + 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 424, 1, 424, 1, 424, 1, + 424, 1, 424, 1, 424, 1, 424, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, + 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, + 425, 1, 425, 1, 425, 1, 425, 1, 425, 1, 426, 1, 426, 1, 426, 1, 426, 1, + 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, + 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, + 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 427, 1, 427, 1, 427, 1, + 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, + 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, + 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 427, 1, 428, 1, 428, 1, 428, 1, + 428, 1, 428, 1, 428, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, + 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 430, 1, 430, 1, + 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 431, 1, + 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, 431, 1, + 431, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, 432, 1, + 432, 1, 432, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, 433, 1, + 433, 1, 433, 1, 433, 1, 434, 1, 434, 1, 434, 1, 434, 1, 434, 1, 434, 1, + 434, 1, 434, 1, 434, 1, 435, 1, 435, 1, 435, 1, 435, 1, 435, 1, 435, 1, + 436, 1, 436, 1, 436, 1, 436, 1, 436, 1, 436, 1, 436, 1, 436, 1, 437, 1, + 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, 437, 1, + 437, 1, 437, 1, 437, 1, 438, 1, 438, 1, 438, 1, 438, 1, 438, 1, 439, 1, + 439, 1, 439, 1, 439, 1, 439, 1, 439, 1, 439, 1, 439, 1, 440, 1, 440, 1, + 440, 1, 440, 1, 440, 1, 440, 1, 440, 1, 441, 1, 441, 1, 441, 1, 441, 1, + 441, 1, 441, 1, 441, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, + 442, 1, 442, 1, 442, 1, 442, 1, 442, 1, 443, 1, 443, 1, 443, 1, 443, 1, + 443, 1, 443, 1, 443, 1, 443, 1, 443, 1, 443, 1, 444, 1, 444, 1, 444, 1, + 444, 1, 444, 1, 444, 1, 444, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, + 445, 1, 445, 1, 446, 1, 446, 1, 446, 1, 446, 1, 446, 1, 446, 1, 446, 1, + 446, 1, 447, 1, 447, 1, 447, 1, 447, 1, 447, 1, 447, 1, 447, 1, 447, 1, + 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, 448, 1, + 448, 1, 449, 1, 449, 1, 449, 1, 449, 1, 449, 1, 449, 1, 449, 1, 450, 1, + 450, 1, 450, 1, 450, 1, 450, 1, 450, 1, 450, 1, 451, 1, 451, 1, 451, 1, + 451, 1, 451, 1, 451, 1, 451, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, + 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 1, 453, 1, 453, 1, + 453, 1, 453, 1, 454, 1, 454, 1, 454, 1, 454, 1, 455, 1, 455, 1, 455, 1, + 455, 1, 455, 1, 455, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, + 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 457, 1, 457, 1, + 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, 457, 1, + 457, 1, 458, 1, 458, 1, 458, 1, 458, 1, 459, 1, 459, 1, 459, 1, 459, 1, + 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, 460, 1, + 461, 1, 461, 1, 461, 1, 461, 1, 461, 1, 461, 1, 461, 1, 461, 1, 462, 1, + 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, 462, 1, + 462, 1, 463, 1, 463, 1, 463, 1, 463, 1, 463, 1, 463, 1, 464, 1, 464, 1, + 464, 1, 464, 1, 464, 1, 464, 1, 464, 1, 464, 1, 465, 1, 465, 1, 465, 1, + 465, 1, 465, 1, 465, 1, 465, 1, 465, 1, 465, 1, 466, 1, 466, 1, 466, 1, + 466, 1, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, 467, 1, + 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, 468, 1, + 468, 1, 468, 1, 469, 1, 469, 1, 469, 1, 469, 1, 469, 1, 469, 1, 469, 1, + 469, 1, 469, 1, 470, 1, 470, 1, 470, 1, 470, 1, 470, 1, 471, 1, 471, 1, + 471, 1, 471, 1, 471, 1, 471, 1, 471, 1, 472, 1, 472, 1, 472, 1, 472, 1, + 472, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 474, 1, + 474, 1, 474, 1, 474, 1, 474, 1, 475, 1, 475, 1, 475, 1, 475, 1, 475, 1, + 475, 1, 475, 1, 475, 1, 475, 1, 476, 1, 476, 1, 476, 1, 476, 1, 476, 1, + 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, 477, 1, + 477, 1, 477, 1, 477, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, + 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 479, 1, 479, 1, 479, 1, 479, 1, + 479, 1, 479, 1, 479, 1, 479, 1, 479, 1, 480, 1, 480, 1, 480, 1, 480, 1, + 480, 1, 480, 1, 480, 1, 480, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, + 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, 481, 1, + 482, 1, 482, 1, 482, 1, 482, 1, 482, 1, 482, 1, 482, 1, 482, 1, 483, 1, + 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 1, + 483, 1, 484, 1, 484, 1, 484, 1, 484, 1, 484, 1, 484, 1, 484, 1, 485, 1, + 485, 1, 485, 1, 485, 1, 485, 1, 485, 1, 485, 1, 486, 1, 486, 1, 486, 1, + 486, 1, 486, 1, 486, 1, 486, 1, 487, 1, 487, 1, 487, 1, 487, 1, 487, 1, + 487, 1, 487, 1, 488, 1, 488, 1, 488, 1, 488, 1, 489, 1, 489, 1, 489, 1, + 489, 1, 490, 1, 490, 1, 490, 1, 490, 1, 490, 1, 491, 1, 491, 1, 491, 1, + 491, 1, 491, 1, 492, 1, 492, 1, 492, 1, 492, 1, 492, 1, 492, 1, 492, 1, + 492, 1, 493, 1, 493, 1, 493, 1, 493, 1, 493, 1, 493, 1, 494, 1, 494, 1, + 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 494, 1, 495, 1, + 495, 1, 495, 1, 495, 1, 495, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, + 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, + 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 496, 1, 497, 1, 497, 1, 497, 1, + 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, + 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 497, 1, 498, 1, 498, 1, 498, 1, + 498, 1, 498, 1, 498, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, + 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 499, 1, 500, 1, 500, 1, + 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, 500, 1, + 501, 1, 501, 1, 501, 1, 501, 1, 501, 1, 501, 1, 502, 1, 502, 1, 502, 1, + 502, 1, 502, 1, 502, 1, 502, 1, 502, 1, 502, 1, 503, 1, 503, 1, 503, 1, + 503, 1, 503, 1, 503, 1, 503, 1, 503, 1, 504, 1, 504, 1, 504, 1, 504, 1, + 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, 505, 1, + 505, 1, 505, 1, 505, 1, 506, 1, 506, 1, 506, 1, 506, 1, 506, 1, 506, 1, + 506, 1, 506, 1, 507, 1, 507, 1, 507, 1, 507, 1, 507, 1, 507, 1, 508, 1, + 508, 1, 508, 1, 508, 1, 508, 1, 508, 1, 509, 1, 509, 1, 509, 1, 509, 1, + 509, 1, 509, 1, 509, 1, 509, 1, 510, 1, 510, 1, 510, 1, 510, 1, 510, 1, + 510, 1, 510, 1, 510, 1, 511, 1, 511, 1, 511, 1, 511, 1, 511, 1, 511, 1, + 512, 1, 512, 1, 512, 1, 512, 1, 512, 1, 513, 1, 513, 1, 513, 1, 513, 1, + 513, 1, 513, 1, 513, 1, 514, 1, 514, 1, 514, 1, 514, 1, 514, 1, 514, 1, + 515, 1, 515, 1, 515, 1, 515, 1, 515, 1, 515, 1, 516, 1, 516, 1, 516, 1, + 516, 1, 516, 1, 516, 1, 516, 1, 516, 1, 516, 1, 517, 1, 517, 1, 517, 1, + 517, 1, 517, 1, 517, 1, 518, 1, 518, 1, 518, 1, 518, 1, 519, 1, 519, 1, + 519, 1, 519, 1, 519, 1, 520, 1, 520, 1, 520, 1, 520, 1, 520, 1, 520, 1, + 520, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, 521, 1, + 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, + 522, 1, 523, 1, 523, 1, 523, 1, 523, 1, 523, 1, 523, 1, 523, 1, 524, 1, + 524, 1, 524, 1, 524, 1, 524, 1, 525, 1, 525, 1, 525, 1, 525, 1, 525, 1, + 526, 1, 526, 1, 526, 1, 526, 1, 527, 1, 527, 1, 527, 1, 527, 1, 527, 1, + 528, 1, 528, 1, 528, 1, 528, 1, 528, 1, 529, 1, 529, 1, 529, 1, 529, 1, + 529, 1, 529, 1, 529, 1, 529, 1, 530, 1, 530, 1, 530, 1, 530, 1, 530, 1, + 530, 1, 530, 1, 530, 1, 531, 1, 531, 1, 531, 1, 531, 1, 532, 1, 532, 1, + 532, 1, 532, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, 533, 1, + 533, 1, 533, 1, 533, 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 1, + 535, 1, 535, 1, 535, 1, 535, 1, 536, 1, 536, 1, 536, 1, 536, 1, 537, 1, + 537, 1, 537, 1, 538, 1, 538, 1, 538, 1, 538, 1, 538, 1, 538, 1, 539, 1, + 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, 539, 1, + 540, 1, 540, 1, 540, 1, 540, 1, 541, 1, 541, 1, 541, 1, 542, 1, 542, 1, + 542, 1, 542, 1, 542, 1, 542, 1, 543, 1, 543, 1, 543, 1, 543, 1, 543, 1, + 543, 1, 543, 1, 543, 1, 544, 1, 544, 1, 544, 1, 544, 1, 544, 1, 544, 1, + 545, 1, 545, 1, 545, 1, 545, 1, 545, 1, 545, 1, 546, 1, 546, 1, 546, 1, + 546, 1, 546, 1, 547, 1, 547, 1, 547, 1, 547, 1, 547, 1, 548, 1, 548, 1, + 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, 548, 1, + 549, 1, 549, 1, 549, 1, 549, 1, 549, 1, 549, 1, 550, 1, 550, 1, 550, 1, + 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, 550, 1, + 550, 1, 551, 1, 551, 1, 551, 1, 551, 1, 551, 1, 551, 1, 551, 1, 552, 1, + 552, 1, 552, 1, 552, 1, 552, 1, 552, 1, 552, 1, 552, 1, 553, 1, 553, 1, + 553, 1, 553, 1, 553, 1, 554, 1, 554, 1, 554, 1, 554, 1, 554, 1, 554, 1, + 555, 1, 555, 1, 555, 1, 555, 1, 555, 1, 556, 1, 556, 1, 556, 1, 556, 1, + 556, 1, 556, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 558, 1, 558, 1, + 558, 1, 558, 1, 558, 1, 558, 1, 559, 1, 559, 1, 559, 1, 559, 1, 559, 1, + 559, 1, 560, 1, 560, 1, 560, 1, 560, 1, 560, 1, 560, 1, 560, 1, 561, 1, + 561, 1, 561, 1, 561, 1, 562, 1, 562, 1, 562, 1, 562, 1, 562, 1, 563, 1, + 563, 1, 563, 1, 563, 1, 564, 1, 564, 1, 564, 1, 564, 1, 564, 1, 565, 1, + 565, 1, 565, 1, 565, 1, 566, 1, 566, 1, 566, 1, 566, 1, 566, 1, 567, 1, + 567, 1, 567, 1, 567, 1, 568, 1, 568, 1, 568, 1, 568, 1, 568, 1, 569, 1, + 569, 1, 569, 1, 569, 1, 569, 1, 570, 1, 570, 1, 570, 1, 570, 1, 570, 1, + 571, 1, 571, 1, 571, 1, 571, 1, 571, 1, 572, 1, 572, 1, 572, 1, 572, 1, + 572, 1, 572, 1, 573, 1, 573, 1, 573, 1, 573, 1, 573, 1, 573, 1, 574, 1, + 574, 1, 574, 1, 574, 1, 574, 1, 574, 1, 575, 1, 575, 1, 575, 1, 575, 1, + 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 575, 1, 576, 1, 576, 1, + 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, 1, + 576, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, + 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 1, + 578, 1, 578, 1, 578, 1, 578, 1, 578, 1, 578, 1, 579, 1, 579, 1, 579, 1, + 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, 579, 1, + 579, 1, 580, 1, 580, 1, 580, 1, 580, 1, 580, 1, 580, 1, 581, 1, 581, 1, + 581, 1, 581, 1, 581, 1, 581, 1, 582, 1, 582, 1, 582, 1, 582, 1, 582, 1, + 582, 1, 583, 1, 583, 1, 583, 1, 583, 1, 584, 1, 584, 1, 584, 1, 584, 1, + 584, 1, 584, 1, 584, 1, 585, 1, 585, 1, 585, 1, 585, 1, 585, 1, 585, 1, + 585, 1, 585, 1, 585, 1, 585, 1, 586, 1, 586, 1, 586, 1, 586, 1, 586, 1, + 586, 1, 586, 1, 587, 1, 587, 1, 587, 1, 587, 1, 587, 1, 587, 1, 587, 1, + 587, 1, 588, 1, 588, 1, 588, 1, 588, 1, 588, 1, 588, 1, 588, 1, 589, 1, + 589, 1, 589, 1, 589, 1, 589, 1, 590, 1, 590, 1, 590, 1, 590, 1, 590, 1, + 590, 1, 591, 1, 591, 1, 591, 1, 591, 1, 592, 1, 592, 1, 592, 1, 592, 1, + 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 592, 1, 593, 1, + 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, + 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, 593, 1, + 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, 594, 1, + 594, 1, 594, 1, 594, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, + 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 596, 1, + 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, + 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 597, 1, 597, 1, 597, 1, 597, 1, + 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, 597, 1, + 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, 598, 1, + 598, 1, 598, 1, 598, 1, 598, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, + 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 599, 1, 600, 1, 600, 1, + 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, 600, 1, + 600, 1, 600, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, + 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 601, 1, 602, 1, + 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, + 602, 1, 602, 1, 602, 1, 602, 1, 602, 1, 603, 1, 603, 1, 603, 1, 603, 1, + 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, + 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, 603, 1, + 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, + 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, 604, 1, + 604, 1, 604, 1, 604, 1, 604, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, + 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, 605, 1, + 606, 1, 606, 1, 606, 1, 606, 1, 606, 1, 606, 1, 606, 1, 607, 1, 607, 1, + 607, 1, 607, 1, 607, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, + 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, 609, 1, + 609, 1, 609, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, + 610, 1, 610, 1, 610, 1, 610, 1, 610, 1, 611, 1, 611, 1, 611, 1, 611, 1, + 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, 611, 1, + 611, 1, 611, 1, 611, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, + 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, 612, 1, + 612, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 614, 1, + 614, 1, 614, 1, 614, 1, 614, 1, 614, 1, 614, 1, 615, 1, 615, 1, 615, 1, + 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 616, 1, 616, 1, 616, 1, + 616, 1, 616, 1, 616, 1, 616, 1, 617, 1, 617, 1, 617, 1, 617, 1, 617, 1, + 617, 1, 617, 1, 617, 1, 617, 1, 617, 1, 618, 1, 618, 1, 618, 1, 618, 1, + 618, 1, 618, 1, 618, 1, 619, 1, 619, 1, 619, 1, 619, 1, 620, 1, 620, 1, + 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, + 620, 1, 620, 1, 620, 1, 620, 1, 620, 1, 621, 1, 621, 1, 621, 1, 621, 1, + 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 622, 1, 622, 1, 622, 1, 622, 1, + 622, 1, 622, 1, 622, 1, 622, 1, 622, 1, 622, 1, 623, 1, 623, 1, 623, 1, + 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, 1, 624, 1, + 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 625, 1, + 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, 625, 1, + 625, 1, 625, 1, 625, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, + 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 626, 1, 627, 1, + 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, + 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 627, 1, 628, 1, 628, 1, + 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 628, 1, 629, 1, + 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, 629, 1, + 629, 1, 629, 1, 629, 1, 629, 1, 630, 1, 630, 1, 630, 1, 630, 1, 630, 1, + 630, 1, 630, 1, 630, 1, 630, 1, 630, 1, 631, 1, 631, 1, 631, 1, 631, 1, + 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, 631, 1, + 631, 1, 631, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, + 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, 632, 1, + 632, 1, 633, 1, 633, 1, 633, 1, 633, 1, 634, 1, 634, 1, 634, 1, 634, 1, + 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, + 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 635, 1, 635, 1, + 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 636, 1, + 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, + 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 1, + 636, 1, 636, 1, 636, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, + 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 637, 1, 638, 1, 638, 1, + 638, 1, 638, 1, 638, 1, 638, 1, 638, 1, 638, 1, 639, 1, 639, 1, 639, 1, + 639, 1, 639, 1, 639, 1, 639, 1, 639, 1, 640, 1, 640, 1, 640, 1, 640, 1, + 640, 1, 640, 1, 640, 1, 640, 1, 640, 1, 640, 1, 641, 1, 641, 1, 641, 1, + 641, 1, 641, 1, 641, 1, 641, 1, 642, 1, 642, 1, 642, 1, 642, 1, 642, 1, + 642, 1, 642, 1, 642, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, 1, + 643, 1, 643, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, + 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 645, 1, + 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, + 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 645, 1, 646, 1, 646, 5, + 646, 6409, 8, 646, 10, 646, 12, 646, 6412, 9, 646, 1, 647, 1, 647, 1, 647, + 1, 647, 1, 647, 1, 647, 3, 647, 6420, 8, 647, 1, 648, 1, 648, 3, 648, 6424, + 8, 648, 1, 649, 1, 649, 3, 649, 6428, 8, 649, 1, 650, 1, 650, 1, 650, 1, + 651, 1, 651, 1, 651, 1, 651, 5, 651, 6437, 8, 651, 10, 651, 12, 651, 6440, + 9, 651, 1, 652, 1, 652, 1, 652, 1, 653, 1, 653, 1, 653, 1, 653, 5, 653, + 6449, 8, 653, 10, 653, 12, 653, 6452, 9, 653, 1, 654, 1, 654, 1, 654, 1, + 654, 1, 655, 1, 655, 1, 655, 1, 655, 1, 656, 1, 656, 1, 656, 1, 656, 1, + 657, 1, 657, 1, 657, 1, 657, 1, 658, 1, 658, 1, 658, 1, 659, 1, 659, 1, + 659, 1, 659, 5, 659, 6477, 8, 659, 10, 659, 12, 659, 6480, 9, 659, 1, 660, + 1, 660, 1, 660, 1, 660, 1, 660, 1, 660, 1, 661, 1, 661, 1, 661, 1, 662, + 1, 662, 1, 662, 1, 662, 1, 663, 1, 663, 3, 663, 6497, 8, 663, 1, 663, 1, + 663, 1, 663, 1, 663, 1, 663, 1, 664, 1, 664, 5, 664, 6506, 8, 664, 10, + 664, 12, 664, 6509, 9, 664, 1, 665, 1, 665, 1, 665, 1, 666, 1, 666, 1, + 666, 5, 666, 6517, 8, 666, 10, 666, 12, 666, 6520, 9, 666, 1, 667, 1, 667, + 1, 667, 1, 668, 1, 668, 1, 668, 1, 669, 1, 669, 1, 669, 1, 670, 1, 670, + 1, 670, 5, 670, 6534, 8, 670, 10, 670, 12, 670, 6537, 9, 670, 1, 671, 1, + 671, 1, 671, 1, 672, 1, 672, 1, 672, 1, 673, 1, 673, 1, 674, 1, 674, 1, + 674, 1, 674, 1, 674, 1, 674, 1, 675, 1, 675, 1, 675, 3, 675, 6556, 8, 675, + 1, 675, 1, 675, 3, 675, 6560, 8, 675, 1, 675, 3, 675, 6563, 8, 675, 1, + 675, 1, 675, 1, 675, 1, 675, 3, 675, 6569, 8, 675, 1, 675, 3, 675, 6572, + 8, 675, 1, 675, 1, 675, 1, 675, 3, 675, 6577, 8, 675, 1, 675, 1, 675, 3, + 675, 6581, 8, 675, 1, 676, 4, 676, 6584, 8, 676, 11, 676, 12, 676, 6585, + 1, 677, 1, 677, 1, 677, 5, 677, 6591, 8, 677, 10, 677, 12, 677, 6594, 9, + 677, 1, 678, 1, 678, 1, 678, 1, 678, 1, 678, 1, 678, 1, 678, 1, 678, 5, + 678, 6604, 8, 678, 10, 678, 12, 678, 6607, 9, 678, 1, 678, 1, 678, 1, 679, + 1, 679, 1, 679, 1, 679, 1, 680, 1, 680, 3, 680, 6617, 8, 680, 1, 680, 3, + 680, 6620, 8, 680, 1, 680, 1, 680, 1, 681, 1, 681, 1, 681, 1, 681, 5, 681, + 6628, 8, 681, 10, 681, 12, 681, 6631, 9, 681, 1, 681, 1, 681, 1, 682, 1, + 682, 1, 682, 1, 682, 5, 682, 6639, 8, 682, 10, 682, 12, 682, 6642, 9, 682, + 1, 682, 1, 682, 1, 682, 4, 682, 6647, 8, 682, 11, 682, 12, 682, 6648, 1, + 682, 1, 682, 4, 682, 6653, 8, 682, 11, 682, 12, 682, 6654, 1, 682, 5, 682, + 6658, 8, 682, 10, 682, 12, 682, 6661, 9, 682, 1, 682, 5, 682, 6664, 8, + 682, 10, 682, 12, 682, 6667, 9, 682, 1, 682, 1, 682, 1, 682, 1, 682, 1, + 682, 1, 683, 1, 683, 1, 683, 1, 683, 5, 683, 6678, 8, 683, 10, 683, 12, + 683, 6681, 9, 683, 1, 683, 1, 683, 1, 683, 4, 683, 6686, 8, 683, 11, 683, + 12, 683, 6687, 1, 683, 1, 683, 4, 683, 6692, 8, 683, 11, 683, 12, 683, + 6693, 1, 683, 3, 683, 6697, 8, 683, 5, 683, 6699, 8, 683, 10, 683, 12, + 683, 6702, 9, 683, 1, 683, 4, 683, 6705, 8, 683, 11, 683, 12, 683, 6706, + 1, 683, 4, 683, 6710, 8, 683, 11, 683, 12, 683, 6711, 1, 683, 5, 683, 6715, + 8, 683, 10, 683, 12, 683, 6718, 9, 683, 1, 683, 3, 683, 6721, 8, 683, 1, + 683, 1, 683, 1, 684, 1, 684, 1, 684, 1, 684, 5, 684, 6729, 8, 684, 10, + 684, 12, 684, 6732, 9, 684, 1, 684, 5, 684, 6735, 8, 684, 10, 684, 12, + 684, 6738, 9, 684, 1, 684, 1, 684, 5, 684, 6742, 8, 684, 10, 684, 12, 684, + 6745, 9, 684, 3, 684, 6747, 8, 684, 1, 685, 1, 685, 1, 685, 1, 686, 1, + 686, 1, 687, 1, 687, 1, 687, 1, 687, 1, 687, 1, 688, 1, 688, 3, 688, 6761, + 8, 688, 1, 688, 1, 688, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, + 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, + 1, 689, 1, 689, 1, 689, 1, 689, 1, 689, 3, 689, 6785, 8, 689, 1, 689, 5, + 689, 6788, 8, 689, 10, 689, 12, 689, 6791, 9, 689, 1, 690, 1, 690, 1, 690, + 1, 690, 1, 690, 1, 691, 1, 691, 3, 691, 6800, 8, 691, 1, 691, 1, 691, 1, + 692, 1, 692, 1, 692, 1, 692, 1, 692, 5, 692, 6809, 8, 692, 10, 692, 12, + 692, 6812, 9, 692, 1, 693, 1, 693, 1, 693, 1, 693, 1, 693, 1, 694, 1, 694, + 1, 694, 1, 694, 1, 694, 1, 694, 1, 695, 1, 695, 1, 695, 1, 695, 1, 695, + 1, 696, 1, 696, 1, 696, 1, 696, 1, 696, 1, 697, 1, 697, 1, 697, 1, 697, + 1, 697, 1, 698, 1, 698, 1, 698, 1, 698, 1, 698, 1, 699, 1, 699, 1, 699, + 1, 699, 1, 699, 1, 700, 4, 700, 6851, 8, 700, 11, 700, 12, 700, 6852, 1, + 700, 1, 700, 5, 700, 6857, 8, 700, 10, 700, 12, 700, 6860, 9, 700, 3, 700, + 6862, 8, 700, 1, 701, 1, 701, 3, 701, 6866, 8, 701, 1, 701, 1, 701, 1, + 701, 1, 701, 1, 701, 1, 701, 1, 701, 0, 0, 702, 5, 1, 7, 2, 9, 3, 11, 4, + 13, 5, 15, 6, 17, 7, 19, 8, 21, 9, 23, 10, 25, 11, 27, 12, 29, 13, 31, + 14, 33, 15, 35, 16, 37, 17, 39, 18, 41, 19, 43, 20, 45, 21, 47, 22, 49, + 23, 51, 24, 53, 25, 55, 26, 57, 27, 59, 28, 61, 29, 63, 0, 65, 0, 67, 0, + 69, 0, 71, 30, 73, 31, 75, 32, 77, 33, 79, 34, 81, 35, 83, 36, 85, 37, + 87, 38, 89, 39, 91, 40, 93, 41, 95, 42, 97, 43, 99, 44, 101, 45, 103, 46, + 105, 47, 107, 48, 109, 49, 111, 50, 113, 51, 115, 52, 117, 53, 119, 54, + 121, 55, 123, 56, 125, 57, 127, 58, 129, 59, 131, 60, 133, 61, 135, 62, + 137, 63, 139, 64, 141, 65, 143, 66, 145, 67, 147, 68, 149, 69, 151, 70, + 153, 71, 155, 72, 157, 73, 159, 74, 161, 75, 163, 76, 165, 77, 167, 78, + 169, 79, 171, 80, 173, 81, 175, 82, 177, 83, 179, 84, 181, 85, 183, 86, + 185, 87, 187, 88, 189, 89, 191, 90, 193, 91, 195, 92, 197, 93, 199, 94, + 201, 95, 203, 96, 205, 97, 207, 98, 209, 99, 211, 100, 213, 101, 215, 102, + 217, 103, 219, 104, 221, 105, 223, 106, 225, 107, 227, 108, 229, 109, 231, + 110, 233, 111, 235, 112, 237, 113, 239, 114, 241, 115, 243, 116, 245, 117, + 247, 118, 249, 119, 251, 120, 253, 121, 255, 122, 257, 123, 259, 124, 261, + 125, 263, 126, 265, 127, 267, 128, 269, 129, 271, 130, 273, 131, 275, 132, + 277, 133, 279, 134, 281, 135, 283, 136, 285, 137, 287, 138, 289, 139, 291, + 140, 293, 141, 295, 142, 297, 143, 299, 144, 301, 145, 303, 146, 305, 147, + 307, 148, 309, 149, 311, 150, 313, 151, 315, 152, 317, 153, 319, 154, 321, + 155, 323, 156, 325, 157, 327, 158, 329, 159, 331, 160, 333, 161, 335, 162, + 337, 163, 339, 164, 341, 165, 343, 166, 345, 167, 347, 168, 349, 169, 351, + 170, 353, 171, 355, 172, 357, 173, 359, 174, 361, 175, 363, 176, 365, 177, + 367, 178, 369, 179, 371, 180, 373, 181, 375, 182, 377, 183, 379, 184, 381, + 185, 383, 186, 385, 187, 387, 188, 389, 189, 391, 190, 393, 191, 395, 192, + 397, 193, 399, 194, 401, 195, 403, 196, 405, 197, 407, 198, 409, 199, 411, + 200, 413, 201, 415, 202, 417, 203, 419, 204, 421, 205, 423, 206, 425, 207, + 427, 208, 429, 209, 431, 210, 433, 211, 435, 212, 437, 213, 439, 214, 441, + 215, 443, 216, 445, 217, 447, 218, 449, 219, 451, 220, 453, 221, 455, 222, + 457, 223, 459, 224, 461, 225, 463, 226, 465, 227, 467, 228, 469, 229, 471, + 230, 473, 231, 475, 232, 477, 233, 479, 234, 481, 235, 483, 236, 485, 237, + 487, 238, 489, 239, 491, 240, 493, 241, 495, 242, 497, 243, 499, 244, 501, + 245, 503, 246, 505, 247, 507, 248, 509, 249, 511, 250, 513, 251, 515, 252, + 517, 253, 519, 254, 521, 255, 523, 256, 525, 257, 527, 258, 529, 259, 531, + 260, 533, 261, 535, 262, 537, 263, 539, 264, 541, 265, 543, 266, 545, 267, + 547, 268, 549, 269, 551, 270, 553, 271, 555, 272, 557, 273, 559, 274, 561, + 275, 563, 276, 565, 277, 567, 278, 569, 279, 571, 280, 573, 281, 575, 282, + 577, 283, 579, 284, 581, 285, 583, 286, 585, 287, 587, 288, 589, 289, 591, + 290, 593, 291, 595, 292, 597, 293, 599, 294, 601, 295, 603, 296, 605, 297, + 607, 298, 609, 299, 611, 300, 613, 301, 615, 302, 617, 303, 619, 304, 621, + 305, 623, 306, 625, 307, 627, 308, 629, 309, 631, 310, 633, 311, 635, 312, + 637, 313, 639, 314, 641, 315, 643, 316, 645, 317, 647, 318, 649, 319, 651, + 320, 653, 321, 655, 322, 657, 323, 659, 324, 661, 325, 663, 326, 665, 327, + 667, 328, 669, 329, 671, 330, 673, 331, 675, 332, 677, 333, 679, 334, 681, + 335, 683, 336, 685, 337, 687, 338, 689, 339, 691, 340, 693, 341, 695, 342, + 697, 343, 699, 344, 701, 345, 703, 346, 705, 347, 707, 348, 709, 349, 711, + 350, 713, 351, 715, 352, 717, 353, 719, 354, 721, 355, 723, 356, 725, 357, + 727, 358, 729, 359, 731, 360, 733, 361, 735, 362, 737, 363, 739, 364, 741, + 365, 743, 366, 745, 367, 747, 368, 749, 369, 751, 370, 753, 371, 755, 372, + 757, 373, 759, 374, 761, 375, 763, 376, 765, 377, 767, 378, 769, 379, 771, + 380, 773, 381, 775, 382, 777, 383, 779, 384, 781, 385, 783, 386, 785, 387, + 787, 388, 789, 389, 791, 390, 793, 391, 795, 392, 797, 393, 799, 394, 801, + 395, 803, 396, 805, 397, 807, 398, 809, 399, 811, 400, 813, 401, 815, 402, + 817, 403, 819, 404, 821, 405, 823, 406, 825, 407, 827, 408, 829, 409, 831, + 410, 833, 411, 835, 412, 837, 413, 839, 414, 841, 415, 843, 416, 845, 417, + 847, 418, 849, 419, 851, 420, 853, 421, 855, 422, 857, 423, 859, 424, 861, + 425, 863, 426, 865, 427, 867, 428, 869, 429, 871, 430, 873, 431, 875, 432, + 877, 433, 879, 434, 881, 435, 883, 436, 885, 437, 887, 438, 889, 439, 891, + 440, 893, 441, 895, 442, 897, 443, 899, 444, 901, 445, 903, 446, 905, 447, + 907, 448, 909, 449, 911, 450, 913, 451, 915, 452, 917, 453, 919, 454, 921, + 455, 923, 456, 925, 457, 927, 458, 929, 459, 931, 460, 933, 461, 935, 462, + 937, 463, 939, 464, 941, 465, 943, 466, 945, 467, 947, 468, 949, 469, 951, + 470, 953, 471, 955, 472, 957, 473, 959, 474, 961, 475, 963, 476, 965, 477, + 967, 478, 969, 479, 971, 480, 973, 481, 975, 482, 977, 483, 979, 484, 981, + 485, 983, 486, 985, 487, 987, 488, 989, 489, 991, 490, 993, 491, 995, 492, + 997, 493, 999, 494, 1001, 495, 1003, 496, 1005, 497, 1007, 498, 1009, 499, + 1011, 500, 1013, 501, 1015, 502, 1017, 503, 1019, 504, 1021, 505, 1023, + 506, 1025, 507, 1027, 508, 1029, 509, 1031, 510, 1033, 511, 1035, 512, + 1037, 513, 1039, 514, 1041, 515, 1043, 516, 1045, 517, 1047, 518, 1049, + 519, 1051, 520, 1053, 521, 1055, 522, 1057, 523, 1059, 524, 1061, 525, + 1063, 526, 1065, 527, 1067, 528, 1069, 529, 1071, 530, 1073, 531, 1075, + 532, 1077, 533, 1079, 534, 1081, 535, 1083, 536, 1085, 537, 1087, 538, + 1089, 539, 1091, 540, 1093, 541, 1095, 542, 1097, 543, 1099, 544, 1101, + 545, 1103, 546, 1105, 547, 1107, 548, 1109, 549, 1111, 550, 1113, 551, + 1115, 552, 1117, 553, 1119, 554, 1121, 555, 1123, 556, 1125, 557, 1127, + 558, 1129, 559, 1131, 560, 1133, 561, 1135, 562, 1137, 563, 1139, 564, + 1141, 565, 1143, 566, 1145, 567, 1147, 568, 1149, 569, 1151, 570, 1153, + 571, 1155, 572, 1157, 573, 1159, 574, 1161, 575, 1163, 576, 1165, 577, + 1167, 578, 1169, 579, 1171, 580, 1173, 581, 1175, 582, 1177, 583, 1179, + 584, 1181, 585, 1183, 586, 1185, 587, 1187, 588, 1189, 589, 1191, 590, + 1193, 591, 1195, 592, 1197, 593, 1199, 594, 1201, 595, 1203, 596, 1205, + 597, 1207, 598, 1209, 599, 1211, 600, 1213, 601, 1215, 602, 1217, 603, + 1219, 604, 1221, 605, 1223, 606, 1225, 607, 1227, 608, 1229, 609, 1231, + 610, 1233, 611, 1235, 612, 1237, 613, 1239, 614, 1241, 615, 1243, 616, + 1245, 617, 1247, 618, 1249, 619, 1251, 620, 1253, 621, 1255, 622, 1257, + 623, 1259, 624, 1261, 625, 1263, 626, 1265, 627, 1267, 628, 1269, 629, + 1271, 630, 1273, 631, 1275, 632, 1277, 633, 1279, 634, 1281, 635, 1283, + 636, 1285, 637, 1287, 638, 1289, 639, 1291, 640, 1293, 641, 1295, 642, + 1297, 643, 1299, 0, 1301, 0, 1303, 0, 1305, 644, 1307, 645, 1309, 646, + 1311, 647, 1313, 648, 1315, 649, 1317, 650, 1319, 651, 1321, 652, 1323, + 653, 1325, 0, 1327, 654, 1329, 655, 1331, 656, 1333, 0, 1335, 657, 1337, + 658, 1339, 659, 1341, 660, 1343, 661, 1345, 662, 1347, 663, 1349, 664, + 1351, 665, 1353, 666, 1355, 667, 1357, 0, 1359, 668, 1361, 669, 1363, 670, + 1365, 671, 1367, 672, 1369, 673, 1371, 674, 1373, 675, 1375, 676, 1377, + 677, 1379, 678, 1381, 679, 1383, 0, 1385, 680, 1387, 681, 1389, 0, 1391, + 0, 1393, 0, 1395, 682, 1397, 0, 1399, 0, 1401, 686, 1403, 683, 1405, 684, + 1407, 685, 5, 0, 1, 2, 3, 4, 51, 1, 0, 48, 57, 2, 0, 43, 43, 45, 45, 9, + 0, 33, 33, 35, 35, 37, 38, 42, 42, 60, 64, 94, 94, 96, 96, 124, 124, 126, + 126, 2, 0, 42, 43, 60, 62, 8, 0, 33, 33, 35, 35, 37, 38, 63, 64, 94, 94, + 96, 96, 124, 124, 126, 126, 2, 0, 65, 65, 97, 97, 2, 0, 76, 76, 108, 108, + 2, 0, 78, 78, 110, 110, 2, 0, 89, 89, 121, 121, 2, 0, 83, 83, 115, 115, + 2, 0, 69, 69, 101, 101, 2, 0, 90, 90, 122, 122, 2, 0, 68, 68, 100, 100, + 2, 0, 82, 82, 114, 114, 2, 0, 67, 67, 99, 99, 2, 0, 77, 77, 109, 109, 2, + 0, 84, 84, 116, 116, 2, 0, 73, 73, 105, 105, 2, 0, 66, 66, 98, 98, 2, 0, + 79, 79, 111, 111, 2, 0, 72, 72, 104, 104, 2, 0, 75, 75, 107, 107, 2, 0, + 85, 85, 117, 117, 2, 0, 71, 71, 103, 103, 2, 0, 80, 80, 112, 112, 2, 0, + 70, 70, 102, 102, 2, 0, 88, 88, 120, 120, 2, 0, 86, 86, 118, 118, 2, 0, + 81, 81, 113, 113, 2, 0, 87, 87, 119, 119, 2, 0, 74, 74, 106, 106, 9, 0, + 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, + 248, 255, 2, 0, 256, 55295, 57344, 65535, 1, 0, 55296, 56319, 1, 0, 56320, + 57343, 2, 0, 0, 0, 34, 34, 1, 0, 34, 34, 1, 0, 39, 39, 1, 0, 48, 49, 3, + 0, 48, 57, 65, 70, 97, 102, 3, 0, 65, 90, 95, 95, 97, 122, 5, 0, 36, 36, + 48, 57, 65, 90, 95, 95, 97, 122, 2, 0, 34, 34, 92, 92, 2, 0, 9, 9, 32, + 32, 2, 0, 10, 10, 13, 13, 2, 0, 42, 42, 47, 47, 4, 0, 10, 10, 13, 13, 34, + 34, 92, 92, 3, 0, 10, 10, 13, 13, 34, 34, 3, 0, 85, 85, 117, 117, 120, + 120, 2, 0, 39, 39, 92, 92, 1, 0, 36, 36, 6945, 0, 5, 1, 0, 0, 0, 0, 7, + 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, + 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, + 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, + 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, + 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, + 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, + 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, + 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, + 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, + 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, + 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, + 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, + 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, + 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, + 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, + 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, + 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, + 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, + 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, + 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, + 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, + 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, + 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, + 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, + 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, + 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, + 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, + 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, + 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, + 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, + 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, + 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, + 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, + 0, 0, 0, 257, 1, 0, 0, 0, 0, 259, 1, 0, 0, 0, 0, 261, 1, 0, 0, 0, 0, 263, + 1, 0, 0, 0, 0, 265, 1, 0, 0, 0, 0, 267, 1, 0, 0, 0, 0, 269, 1, 0, 0, 0, + 0, 271, 1, 0, 0, 0, 0, 273, 1, 0, 0, 0, 0, 275, 1, 0, 0, 0, 0, 277, 1, + 0, 0, 0, 0, 279, 1, 0, 0, 0, 0, 281, 1, 0, 0, 0, 0, 283, 1, 0, 0, 0, 0, + 285, 1, 0, 0, 0, 0, 287, 1, 0, 0, 0, 0, 289, 1, 0, 0, 0, 0, 291, 1, 0, + 0, 0, 0, 293, 1, 0, 0, 0, 0, 295, 1, 0, 0, 0, 0, 297, 1, 0, 0, 0, 0, 299, + 1, 0, 0, 0, 0, 301, 1, 0, 0, 0, 0, 303, 1, 0, 0, 0, 0, 305, 1, 0, 0, 0, + 0, 307, 1, 0, 0, 0, 0, 309, 1, 0, 0, 0, 0, 311, 1, 0, 0, 0, 0, 313, 1, + 0, 0, 0, 0, 315, 1, 0, 0, 0, 0, 317, 1, 0, 0, 0, 0, 319, 1, 0, 0, 0, 0, + 321, 1, 0, 0, 0, 0, 323, 1, 0, 0, 0, 0, 325, 1, 0, 0, 0, 0, 327, 1, 0, + 0, 0, 0, 329, 1, 0, 0, 0, 0, 331, 1, 0, 0, 0, 0, 333, 1, 0, 0, 0, 0, 335, + 1, 0, 0, 0, 0, 337, 1, 0, 0, 0, 0, 339, 1, 0, 0, 0, 0, 341, 1, 0, 0, 0, + 0, 343, 1, 0, 0, 0, 0, 345, 1, 0, 0, 0, 0, 347, 1, 0, 0, 0, 0, 349, 1, + 0, 0, 0, 0, 351, 1, 0, 0, 0, 0, 353, 1, 0, 0, 0, 0, 355, 1, 0, 0, 0, 0, + 357, 1, 0, 0, 0, 0, 359, 1, 0, 0, 0, 0, 361, 1, 0, 0, 0, 0, 363, 1, 0, + 0, 0, 0, 365, 1, 0, 0, 0, 0, 367, 1, 0, 0, 0, 0, 369, 1, 0, 0, 0, 0, 371, + 1, 0, 0, 0, 0, 373, 1, 0, 0, 0, 0, 375, 1, 0, 0, 0, 0, 377, 1, 0, 0, 0, + 0, 379, 1, 0, 0, 0, 0, 381, 1, 0, 0, 0, 0, 383, 1, 0, 0, 0, 0, 385, 1, + 0, 0, 0, 0, 387, 1, 0, 0, 0, 0, 389, 1, 0, 0, 0, 0, 391, 1, 0, 0, 0, 0, + 393, 1, 0, 0, 0, 0, 395, 1, 0, 0, 0, 0, 397, 1, 0, 0, 0, 0, 399, 1, 0, + 0, 0, 0, 401, 1, 0, 0, 0, 0, 403, 1, 0, 0, 0, 0, 405, 1, 0, 0, 0, 0, 407, + 1, 0, 0, 0, 0, 409, 1, 0, 0, 0, 0, 411, 1, 0, 0, 0, 0, 413, 1, 0, 0, 0, + 0, 415, 1, 0, 0, 0, 0, 417, 1, 0, 0, 0, 0, 419, 1, 0, 0, 0, 0, 421, 1, + 0, 0, 0, 0, 423, 1, 0, 0, 0, 0, 425, 1, 0, 0, 0, 0, 427, 1, 0, 0, 0, 0, + 429, 1, 0, 0, 0, 0, 431, 1, 0, 0, 0, 0, 433, 1, 0, 0, 0, 0, 435, 1, 0, + 0, 0, 0, 437, 1, 0, 0, 0, 0, 439, 1, 0, 0, 0, 0, 441, 1, 0, 0, 0, 0, 443, + 1, 0, 0, 0, 0, 445, 1, 0, 0, 0, 0, 447, 1, 0, 0, 0, 0, 449, 1, 0, 0, 0, + 0, 451, 1, 0, 0, 0, 0, 453, 1, 0, 0, 0, 0, 455, 1, 0, 0, 0, 0, 457, 1, + 0, 0, 0, 0, 459, 1, 0, 0, 0, 0, 461, 1, 0, 0, 0, 0, 463, 1, 0, 0, 0, 0, + 465, 1, 0, 0, 0, 0, 467, 1, 0, 0, 0, 0, 469, 1, 0, 0, 0, 0, 471, 1, 0, + 0, 0, 0, 473, 1, 0, 0, 0, 0, 475, 1, 0, 0, 0, 0, 477, 1, 0, 0, 0, 0, 479, + 1, 0, 0, 0, 0, 481, 1, 0, 0, 0, 0, 483, 1, 0, 0, 0, 0, 485, 1, 0, 0, 0, + 0, 487, 1, 0, 0, 0, 0, 489, 1, 0, 0, 0, 0, 491, 1, 0, 0, 0, 0, 493, 1, + 0, 0, 0, 0, 495, 1, 0, 0, 0, 0, 497, 1, 0, 0, 0, 0, 499, 1, 0, 0, 0, 0, + 501, 1, 0, 0, 0, 0, 503, 1, 0, 0, 0, 0, 505, 1, 0, 0, 0, 0, 507, 1, 0, + 0, 0, 0, 509, 1, 0, 0, 0, 0, 511, 1, 0, 0, 0, 0, 513, 1, 0, 0, 0, 0, 515, + 1, 0, 0, 0, 0, 517, 1, 0, 0, 0, 0, 519, 1, 0, 0, 0, 0, 521, 1, 0, 0, 0, + 0, 523, 1, 0, 0, 0, 0, 525, 1, 0, 0, 0, 0, 527, 1, 0, 0, 0, 0, 529, 1, + 0, 0, 0, 0, 531, 1, 0, 0, 0, 0, 533, 1, 0, 0, 0, 0, 535, 1, 0, 0, 0, 0, + 537, 1, 0, 0, 0, 0, 539, 1, 0, 0, 0, 0, 541, 1, 0, 0, 0, 0, 543, 1, 0, + 0, 0, 0, 545, 1, 0, 0, 0, 0, 547, 1, 0, 0, 0, 0, 549, 1, 0, 0, 0, 0, 551, + 1, 0, 0, 0, 0, 553, 1, 0, 0, 0, 0, 555, 1, 0, 0, 0, 0, 557, 1, 0, 0, 0, + 0, 559, 1, 0, 0, 0, 0, 561, 1, 0, 0, 0, 0, 563, 1, 0, 0, 0, 0, 565, 1, + 0, 0, 0, 0, 567, 1, 0, 0, 0, 0, 569, 1, 0, 0, 0, 0, 571, 1, 0, 0, 0, 0, + 573, 1, 0, 0, 0, 0, 575, 1, 0, 0, 0, 0, 577, 1, 0, 0, 0, 0, 579, 1, 0, + 0, 0, 0, 581, 1, 0, 0, 0, 0, 583, 1, 0, 0, 0, 0, 585, 1, 0, 0, 0, 0, 587, + 1, 0, 0, 0, 0, 589, 1, 0, 0, 0, 0, 591, 1, 0, 0, 0, 0, 593, 1, 0, 0, 0, + 0, 595, 1, 0, 0, 0, 0, 597, 1, 0, 0, 0, 0, 599, 1, 0, 0, 0, 0, 601, 1, + 0, 0, 0, 0, 603, 1, 0, 0, 0, 0, 605, 1, 0, 0, 0, 0, 607, 1, 0, 0, 0, 0, + 609, 1, 0, 0, 0, 0, 611, 1, 0, 0, 0, 0, 613, 1, 0, 0, 0, 0, 615, 1, 0, + 0, 0, 0, 617, 1, 0, 0, 0, 0, 619, 1, 0, 0, 0, 0, 621, 1, 0, 0, 0, 0, 623, + 1, 0, 0, 0, 0, 625, 1, 0, 0, 0, 0, 627, 1, 0, 0, 0, 0, 629, 1, 0, 0, 0, + 0, 631, 1, 0, 0, 0, 0, 633, 1, 0, 0, 0, 0, 635, 1, 0, 0, 0, 0, 637, 1, + 0, 0, 0, 0, 639, 1, 0, 0, 0, 0, 641, 1, 0, 0, 0, 0, 643, 1, 0, 0, 0, 0, + 645, 1, 0, 0, 0, 0, 647, 1, 0, 0, 0, 0, 649, 1, 0, 0, 0, 0, 651, 1, 0, + 0, 0, 0, 653, 1, 0, 0, 0, 0, 655, 1, 0, 0, 0, 0, 657, 1, 0, 0, 0, 0, 659, + 1, 0, 0, 0, 0, 661, 1, 0, 0, 0, 0, 663, 1, 0, 0, 0, 0, 665, 1, 0, 0, 0, + 0, 667, 1, 0, 0, 0, 0, 669, 1, 0, 0, 0, 0, 671, 1, 0, 0, 0, 0, 673, 1, + 0, 0, 0, 0, 675, 1, 0, 0, 0, 0, 677, 1, 0, 0, 0, 0, 679, 1, 0, 0, 0, 0, + 681, 1, 0, 0, 0, 0, 683, 1, 0, 0, 0, 0, 685, 1, 0, 0, 0, 0, 687, 1, 0, + 0, 0, 0, 689, 1, 0, 0, 0, 0, 691, 1, 0, 0, 0, 0, 693, 1, 0, 0, 0, 0, 695, + 1, 0, 0, 0, 0, 697, 1, 0, 0, 0, 0, 699, 1, 0, 0, 0, 0, 701, 1, 0, 0, 0, + 0, 703, 1, 0, 0, 0, 0, 705, 1, 0, 0, 0, 0, 707, 1, 0, 0, 0, 0, 709, 1, + 0, 0, 0, 0, 711, 1, 0, 0, 0, 0, 713, 1, 0, 0, 0, 0, 715, 1, 0, 0, 0, 0, + 717, 1, 0, 0, 0, 0, 719, 1, 0, 0, 0, 0, 721, 1, 0, 0, 0, 0, 723, 1, 0, + 0, 0, 0, 725, 1, 0, 0, 0, 0, 727, 1, 0, 0, 0, 0, 729, 1, 0, 0, 0, 0, 731, + 1, 0, 0, 0, 0, 733, 1, 0, 0, 0, 0, 735, 1, 0, 0, 0, 0, 737, 1, 0, 0, 0, + 0, 739, 1, 0, 0, 0, 0, 741, 1, 0, 0, 0, 0, 743, 1, 0, 0, 0, 0, 745, 1, + 0, 0, 0, 0, 747, 1, 0, 0, 0, 0, 749, 1, 0, 0, 0, 0, 751, 1, 0, 0, 0, 0, + 753, 1, 0, 0, 0, 0, 755, 1, 0, 0, 0, 0, 757, 1, 0, 0, 0, 0, 759, 1, 0, + 0, 0, 0, 761, 1, 0, 0, 0, 0, 763, 1, 0, 0, 0, 0, 765, 1, 0, 0, 0, 0, 767, + 1, 0, 0, 0, 0, 769, 1, 0, 0, 0, 0, 771, 1, 0, 0, 0, 0, 773, 1, 0, 0, 0, + 0, 775, 1, 0, 0, 0, 0, 777, 1, 0, 0, 0, 0, 779, 1, 0, 0, 0, 0, 781, 1, + 0, 0, 0, 0, 783, 1, 0, 0, 0, 0, 785, 1, 0, 0, 0, 0, 787, 1, 0, 0, 0, 0, + 789, 1, 0, 0, 0, 0, 791, 1, 0, 0, 0, 0, 793, 1, 0, 0, 0, 0, 795, 1, 0, + 0, 0, 0, 797, 1, 0, 0, 0, 0, 799, 1, 0, 0, 0, 0, 801, 1, 0, 0, 0, 0, 803, + 1, 0, 0, 0, 0, 805, 1, 0, 0, 0, 0, 807, 1, 0, 0, 0, 0, 809, 1, 0, 0, 0, + 0, 811, 1, 0, 0, 0, 0, 813, 1, 0, 0, 0, 0, 815, 1, 0, 0, 0, 0, 817, 1, + 0, 0, 0, 0, 819, 1, 0, 0, 0, 0, 821, 1, 0, 0, 0, 0, 823, 1, 0, 0, 0, 0, + 825, 1, 0, 0, 0, 0, 827, 1, 0, 0, 0, 0, 829, 1, 0, 0, 0, 0, 831, 1, 0, + 0, 0, 0, 833, 1, 0, 0, 0, 0, 835, 1, 0, 0, 0, 0, 837, 1, 0, 0, 0, 0, 839, + 1, 0, 0, 0, 0, 841, 1, 0, 0, 0, 0, 843, 1, 0, 0, 0, 0, 845, 1, 0, 0, 0, + 0, 847, 1, 0, 0, 0, 0, 849, 1, 0, 0, 0, 0, 851, 1, 0, 0, 0, 0, 853, 1, + 0, 0, 0, 0, 855, 1, 0, 0, 0, 0, 857, 1, 0, 0, 0, 0, 859, 1, 0, 0, 0, 0, + 861, 1, 0, 0, 0, 0, 863, 1, 0, 0, 0, 0, 865, 1, 0, 0, 0, 0, 867, 1, 0, + 0, 0, 0, 869, 1, 0, 0, 0, 0, 871, 1, 0, 0, 0, 0, 873, 1, 0, 0, 0, 0, 875, + 1, 0, 0, 0, 0, 877, 1, 0, 0, 0, 0, 879, 1, 0, 0, 0, 0, 881, 1, 0, 0, 0, + 0, 883, 1, 0, 0, 0, 0, 885, 1, 0, 0, 0, 0, 887, 1, 0, 0, 0, 0, 889, 1, + 0, 0, 0, 0, 891, 1, 0, 0, 0, 0, 893, 1, 0, 0, 0, 0, 895, 1, 0, 0, 0, 0, + 897, 1, 0, 0, 0, 0, 899, 1, 0, 0, 0, 0, 901, 1, 0, 0, 0, 0, 903, 1, 0, + 0, 0, 0, 905, 1, 0, 0, 0, 0, 907, 1, 0, 0, 0, 0, 909, 1, 0, 0, 0, 0, 911, + 1, 0, 0, 0, 0, 913, 1, 0, 0, 0, 0, 915, 1, 0, 0, 0, 0, 917, 1, 0, 0, 0, + 0, 919, 1, 0, 0, 0, 0, 921, 1, 0, 0, 0, 0, 923, 1, 0, 0, 0, 0, 925, 1, + 0, 0, 0, 0, 927, 1, 0, 0, 0, 0, 929, 1, 0, 0, 0, 0, 931, 1, 0, 0, 0, 0, + 933, 1, 0, 0, 0, 0, 935, 1, 0, 0, 0, 0, 937, 1, 0, 0, 0, 0, 939, 1, 0, + 0, 0, 0, 941, 1, 0, 0, 0, 0, 943, 1, 0, 0, 0, 0, 945, 1, 0, 0, 0, 0, 947, + 1, 0, 0, 0, 0, 949, 1, 0, 0, 0, 0, 951, 1, 0, 0, 0, 0, 953, 1, 0, 0, 0, + 0, 955, 1, 0, 0, 0, 0, 957, 1, 0, 0, 0, 0, 959, 1, 0, 0, 0, 0, 961, 1, + 0, 0, 0, 0, 963, 1, 0, 0, 0, 0, 965, 1, 0, 0, 0, 0, 967, 1, 0, 0, 0, 0, + 969, 1, 0, 0, 0, 0, 971, 1, 0, 0, 0, 0, 973, 1, 0, 0, 0, 0, 975, 1, 0, + 0, 0, 0, 977, 1, 0, 0, 0, 0, 979, 1, 0, 0, 0, 0, 981, 1, 0, 0, 0, 0, 983, + 1, 0, 0, 0, 0, 985, 1, 0, 0, 0, 0, 987, 1, 0, 0, 0, 0, 989, 1, 0, 0, 0, + 0, 991, 1, 0, 0, 0, 0, 993, 1, 0, 0, 0, 0, 995, 1, 0, 0, 0, 0, 997, 1, + 0, 0, 0, 0, 999, 1, 0, 0, 0, 0, 1001, 1, 0, 0, 0, 0, 1003, 1, 0, 0, 0, + 0, 1005, 1, 0, 0, 0, 0, 1007, 1, 0, 0, 0, 0, 1009, 1, 0, 0, 0, 0, 1011, + 1, 0, 0, 0, 0, 1013, 1, 0, 0, 0, 0, 1015, 1, 0, 0, 0, 0, 1017, 1, 0, 0, + 0, 0, 1019, 1, 0, 0, 0, 0, 1021, 1, 0, 0, 0, 0, 1023, 1, 0, 0, 0, 0, 1025, + 1, 0, 0, 0, 0, 1027, 1, 0, 0, 0, 0, 1029, 1, 0, 0, 0, 0, 1031, 1, 0, 0, + 0, 0, 1033, 1, 0, 0, 0, 0, 1035, 1, 0, 0, 0, 0, 1037, 1, 0, 0, 0, 0, 1039, + 1, 0, 0, 0, 0, 1041, 1, 0, 0, 0, 0, 1043, 1, 0, 0, 0, 0, 1045, 1, 0, 0, + 0, 0, 1047, 1, 0, 0, 0, 0, 1049, 1, 0, 0, 0, 0, 1051, 1, 0, 0, 0, 0, 1053, + 1, 0, 0, 0, 0, 1055, 1, 0, 0, 0, 0, 1057, 1, 0, 0, 0, 0, 1059, 1, 0, 0, + 0, 0, 1061, 1, 0, 0, 0, 0, 1063, 1, 0, 0, 0, 0, 1065, 1, 0, 0, 0, 0, 1067, + 1, 0, 0, 0, 0, 1069, 1, 0, 0, 0, 0, 1071, 1, 0, 0, 0, 0, 1073, 1, 0, 0, + 0, 0, 1075, 1, 0, 0, 0, 0, 1077, 1, 0, 0, 0, 0, 1079, 1, 0, 0, 0, 0, 1081, + 1, 0, 0, 0, 0, 1083, 1, 0, 0, 0, 0, 1085, 1, 0, 0, 0, 0, 1087, 1, 0, 0, + 0, 0, 1089, 1, 0, 0, 0, 0, 1091, 1, 0, 0, 0, 0, 1093, 1, 0, 0, 0, 0, 1095, + 1, 0, 0, 0, 0, 1097, 1, 0, 0, 0, 0, 1099, 1, 0, 0, 0, 0, 1101, 1, 0, 0, + 0, 0, 1103, 1, 0, 0, 0, 0, 1105, 1, 0, 0, 0, 0, 1107, 1, 0, 0, 0, 0, 1109, + 1, 0, 0, 0, 0, 1111, 1, 0, 0, 0, 0, 1113, 1, 0, 0, 0, 0, 1115, 1, 0, 0, + 0, 0, 1117, 1, 0, 0, 0, 0, 1119, 1, 0, 0, 0, 0, 1121, 1, 0, 0, 0, 0, 1123, + 1, 0, 0, 0, 0, 1125, 1, 0, 0, 0, 0, 1127, 1, 0, 0, 0, 0, 1129, 1, 0, 0, + 0, 0, 1131, 1, 0, 0, 0, 0, 1133, 1, 0, 0, 0, 0, 1135, 1, 0, 0, 0, 0, 1137, + 1, 0, 0, 0, 0, 1139, 1, 0, 0, 0, 0, 1141, 1, 0, 0, 0, 0, 1143, 1, 0, 0, + 0, 0, 1145, 1, 0, 0, 0, 0, 1147, 1, 0, 0, 0, 0, 1149, 1, 0, 0, 0, 0, 1151, + 1, 0, 0, 0, 0, 1153, 1, 0, 0, 0, 0, 1155, 1, 0, 0, 0, 0, 1157, 1, 0, 0, + 0, 0, 1159, 1, 0, 0, 0, 0, 1161, 1, 0, 0, 0, 0, 1163, 1, 0, 0, 0, 0, 1165, + 1, 0, 0, 0, 0, 1167, 1, 0, 0, 0, 0, 1169, 1, 0, 0, 0, 0, 1171, 1, 0, 0, + 0, 0, 1173, 1, 0, 0, 0, 0, 1175, 1, 0, 0, 0, 0, 1177, 1, 0, 0, 0, 0, 1179, + 1, 0, 0, 0, 0, 1181, 1, 0, 0, 0, 0, 1183, 1, 0, 0, 0, 0, 1185, 1, 0, 0, + 0, 0, 1187, 1, 0, 0, 0, 0, 1189, 1, 0, 0, 0, 0, 1191, 1, 0, 0, 0, 0, 1193, + 1, 0, 0, 0, 0, 1195, 1, 0, 0, 0, 0, 1197, 1, 0, 0, 0, 0, 1199, 1, 0, 0, + 0, 0, 1201, 1, 0, 0, 0, 0, 1203, 1, 0, 0, 0, 0, 1205, 1, 0, 0, 0, 0, 1207, + 1, 0, 0, 0, 0, 1209, 1, 0, 0, 0, 0, 1211, 1, 0, 0, 0, 0, 1213, 1, 0, 0, + 0, 0, 1215, 1, 0, 0, 0, 0, 1217, 1, 0, 0, 0, 0, 1219, 1, 0, 0, 0, 0, 1221, + 1, 0, 0, 0, 0, 1223, 1, 0, 0, 0, 0, 1225, 1, 0, 0, 0, 0, 1227, 1, 0, 0, + 0, 0, 1229, 1, 0, 0, 0, 0, 1231, 1, 0, 0, 0, 0, 1233, 1, 0, 0, 0, 0, 1235, + 1, 0, 0, 0, 0, 1237, 1, 0, 0, 0, 0, 1239, 1, 0, 0, 0, 0, 1241, 1, 0, 0, + 0, 0, 1243, 1, 0, 0, 0, 0, 1245, 1, 0, 0, 0, 0, 1247, 1, 0, 0, 0, 0, 1249, + 1, 0, 0, 0, 0, 1251, 1, 0, 0, 0, 0, 1253, 1, 0, 0, 0, 0, 1255, 1, 0, 0, + 0, 0, 1257, 1, 0, 0, 0, 0, 1259, 1, 0, 0, 0, 0, 1261, 1, 0, 0, 0, 0, 1263, + 1, 0, 0, 0, 0, 1265, 1, 0, 0, 0, 0, 1267, 1, 0, 0, 0, 0, 1269, 1, 0, 0, + 0, 0, 1271, 1, 0, 0, 0, 0, 1273, 1, 0, 0, 0, 0, 1275, 1, 0, 0, 0, 0, 1277, + 1, 0, 0, 0, 0, 1279, 1, 0, 0, 0, 0, 1281, 1, 0, 0, 0, 0, 1283, 1, 0, 0, + 0, 0, 1285, 1, 0, 0, 0, 0, 1287, 1, 0, 0, 0, 0, 1289, 1, 0, 0, 0, 0, 1291, + 1, 0, 0, 0, 0, 1293, 1, 0, 0, 0, 0, 1295, 1, 0, 0, 0, 0, 1297, 1, 0, 0, + 0, 0, 1305, 1, 0, 0, 0, 0, 1307, 1, 0, 0, 0, 0, 1309, 1, 0, 0, 0, 0, 1311, + 1, 0, 0, 0, 0, 1313, 1, 0, 0, 0, 0, 1315, 1, 0, 0, 0, 0, 1317, 1, 0, 0, + 0, 0, 1319, 1, 0, 0, 0, 0, 1321, 1, 0, 0, 0, 0, 1323, 1, 0, 0, 0, 0, 1325, + 1, 0, 0, 0, 0, 1327, 1, 0, 0, 0, 0, 1329, 1, 0, 0, 0, 0, 1331, 1, 0, 0, + 0, 0, 1335, 1, 0, 0, 0, 0, 1337, 1, 0, 0, 0, 0, 1339, 1, 0, 0, 0, 0, 1341, + 1, 0, 0, 0, 0, 1343, 1, 0, 0, 0, 0, 1345, 1, 0, 0, 0, 0, 1347, 1, 0, 0, + 0, 0, 1349, 1, 0, 0, 0, 0, 1351, 1, 0, 0, 0, 0, 1353, 1, 0, 0, 0, 0, 1355, + 1, 0, 0, 0, 0, 1359, 1, 0, 0, 0, 0, 1361, 1, 0, 0, 0, 0, 1363, 1, 0, 0, + 0, 0, 1365, 1, 0, 0, 0, 0, 1367, 1, 0, 0, 0, 0, 1369, 1, 0, 0, 0, 0, 1371, + 1, 0, 0, 0, 0, 1373, 1, 0, 0, 0, 0, 1375, 1, 0, 0, 0, 0, 1377, 1, 0, 0, + 0, 1, 1379, 1, 0, 0, 0, 1, 1381, 1, 0, 0, 0, 1, 1385, 1, 0, 0, 0, 1, 1387, + 1, 0, 0, 0, 2, 1391, 1, 0, 0, 0, 2, 1393, 1, 0, 0, 0, 2, 1395, 1, 0, 0, + 0, 3, 1397, 1, 0, 0, 0, 3, 1399, 1, 0, 0, 0, 3, 1401, 1, 0, 0, 0, 3, 1403, + 1, 0, 0, 0, 4, 1405, 1, 0, 0, 0, 4, 1407, 1, 0, 0, 0, 5, 1409, 1, 0, 0, + 0, 7, 1411, 1, 0, 0, 0, 9, 1413, 1, 0, 0, 0, 11, 1415, 1, 0, 0, 0, 13, + 1417, 1, 0, 0, 0, 15, 1419, 1, 0, 0, 0, 17, 1421, 1, 0, 0, 0, 19, 1423, + 1, 0, 0, 0, 21, 1425, 1, 0, 0, 0, 23, 1427, 1, 0, 0, 0, 25, 1429, 1, 0, + 0, 0, 27, 1431, 1, 0, 0, 0, 29, 1433, 1, 0, 0, 0, 31, 1435, 1, 0, 0, 0, + 33, 1437, 1, 0, 0, 0, 35, 1439, 1, 0, 0, 0, 37, 1441, 1, 0, 0, 0, 39, 1443, + 1, 0, 0, 0, 41, 1446, 1, 0, 0, 0, 43, 1449, 1, 0, 0, 0, 45, 1452, 1, 0, + 0, 0, 47, 1455, 1, 0, 0, 0, 49, 1458, 1, 0, 0, 0, 51, 1461, 1, 0, 0, 0, + 53, 1464, 1, 0, 0, 0, 55, 1467, 1, 0, 0, 0, 57, 1470, 1, 0, 0, 0, 59, 1472, + 1, 0, 0, 0, 61, 1498, 1, 0, 0, 0, 63, 1509, 1, 0, 0, 0, 65, 1525, 1, 0, + 0, 0, 67, 1527, 1, 0, 0, 0, 69, 1529, 1, 0, 0, 0, 71, 1531, 1, 0, 0, 0, + 73, 1535, 1, 0, 0, 0, 75, 1543, 1, 0, 0, 0, 77, 1551, 1, 0, 0, 0, 79, 1555, + 1, 0, 0, 0, 81, 1559, 1, 0, 0, 0, 83, 1565, 1, 0, 0, 0, 85, 1568, 1, 0, + 0, 0, 87, 1572, 1, 0, 0, 0, 89, 1583, 1, 0, 0, 0, 91, 1588, 1, 0, 0, 0, + 93, 1593, 1, 0, 0, 0, 95, 1598, 1, 0, 0, 0, 97, 1604, 1, 0, 0, 0, 99, 1612, + 1, 0, 0, 0, 101, 1619, 1, 0, 0, 0, 103, 1630, 1, 0, 0, 0, 105, 1637, 1, + 0, 0, 0, 107, 1653, 1, 0, 0, 0, 109, 1666, 1, 0, 0, 0, 111, 1679, 1, 0, + 0, 0, 113, 1692, 1, 0, 0, 0, 115, 1710, 1, 0, 0, 0, 117, 1723, 1, 0, 0, + 0, 119, 1731, 1, 0, 0, 0, 121, 1742, 1, 0, 0, 0, 123, 1747, 1, 0, 0, 0, + 125, 1756, 1, 0, 0, 0, 127, 1759, 1, 0, 0, 0, 129, 1764, 1, 0, 0, 0, 131, + 1771, 1, 0, 0, 0, 133, 1777, 1, 0, 0, 0, 135, 1783, 1, 0, 0, 0, 137, 1787, + 1, 0, 0, 0, 139, 1795, 1, 0, 0, 0, 141, 1800, 1, 0, 0, 0, 143, 1806, 1, + 0, 0, 0, 145, 1812, 1, 0, 0, 0, 147, 1819, 1, 0, 0, 0, 149, 1822, 1, 0, + 0, 0, 151, 1832, 1, 0, 0, 0, 153, 1842, 1, 0, 0, 0, 155, 1847, 1, 0, 0, + 0, 157, 1855, 1, 0, 0, 0, 159, 1863, 1, 0, 0, 0, 161, 1869, 1, 0, 0, 0, + 163, 1879, 1, 0, 0, 0, 165, 1894, 1, 0, 0, 0, 167, 1898, 1, 0, 0, 0, 169, + 1903, 1, 0, 0, 0, 171, 1910, 1, 0, 0, 0, 173, 1913, 1, 0, 0, 0, 175, 1918, + 1, 0, 0, 0, 177, 1921, 1, 0, 0, 0, 179, 1927, 1, 0, 0, 0, 181, 1935, 1, + 0, 0, 0, 183, 1943, 1, 0, 0, 0, 185, 1954, 1, 0, 0, 0, 187, 1964, 1, 0, + 0, 0, 189, 1971, 1, 0, 0, 0, 191, 1984, 1, 0, 0, 0, 193, 1989, 1, 0, 0, + 0, 195, 1999, 1, 0, 0, 0, 197, 2005, 1, 0, 0, 0, 199, 2010, 1, 0, 0, 0, + 201, 2013, 1, 0, 0, 0, 203, 2022, 1, 0, 0, 0, 205, 2027, 1, 0, 0, 0, 207, + 2033, 1, 0, 0, 0, 209, 2040, 1, 0, 0, 0, 211, 2045, 1, 0, 0, 0, 213, 2051, + 1, 0, 0, 0, 215, 2060, 1, 0, 0, 0, 217, 2065, 1, 0, 0, 0, 219, 2071, 1, + 0, 0, 0, 221, 2078, 1, 0, 0, 0, 223, 2083, 1, 0, 0, 0, 225, 2097, 1, 0, + 0, 0, 227, 2104, 1, 0, 0, 0, 229, 2114, 1, 0, 0, 0, 231, 2127, 1, 0, 0, + 0, 233, 2133, 1, 0, 0, 0, 235, 2148, 1, 0, 0, 0, 237, 2155, 1, 0, 0, 0, + 239, 2160, 1, 0, 0, 0, 241, 2166, 1, 0, 0, 0, 243, 2172, 1, 0, 0, 0, 245, + 2175, 1, 0, 0, 0, 247, 2182, 1, 0, 0, 0, 249, 2187, 1, 0, 0, 0, 251, 2192, + 1, 0, 0, 0, 253, 2197, 1, 0, 0, 0, 255, 2205, 1, 0, 0, 0, 257, 2213, 1, + 0, 0, 0, 259, 2219, 1, 0, 0, 0, 261, 2224, 1, 0, 0, 0, 263, 2233, 1, 0, + 0, 0, 265, 2239, 1, 0, 0, 0, 267, 2247, 1, 0, 0, 0, 269, 2255, 1, 0, 0, + 0, 271, 2261, 1, 0, 0, 0, 273, 2270, 1, 0, 0, 0, 275, 2277, 1, 0, 0, 0, + 277, 2284, 1, 0, 0, 0, 279, 2288, 1, 0, 0, 0, 281, 2294, 1, 0, 0, 0, 283, + 2300, 1, 0, 0, 0, 285, 2310, 1, 0, 0, 0, 287, 2315, 1, 0, 0, 0, 289, 2321, + 1, 0, 0, 0, 291, 2328, 1, 0, 0, 0, 293, 2338, 1, 0, 0, 0, 295, 2349, 1, + 0, 0, 0, 297, 2352, 1, 0, 0, 0, 299, 2362, 1, 0, 0, 0, 301, 2371, 1, 0, + 0, 0, 303, 2378, 1, 0, 0, 0, 305, 2384, 1, 0, 0, 0, 307, 2387, 1, 0, 0, + 0, 309, 2393, 1, 0, 0, 0, 311, 2400, 1, 0, 0, 0, 313, 2408, 1, 0, 0, 0, + 315, 2417, 1, 0, 0, 0, 317, 2425, 1, 0, 0, 0, 319, 2431, 1, 0, 0, 0, 321, + 2447, 1, 0, 0, 0, 323, 2458, 1, 0, 0, 0, 325, 2464, 1, 0, 0, 0, 327, 2470, + 1, 0, 0, 0, 329, 2478, 1, 0, 0, 0, 331, 2486, 1, 0, 0, 0, 333, 2495, 1, + 0, 0, 0, 335, 2502, 1, 0, 0, 0, 337, 2512, 1, 0, 0, 0, 339, 2526, 1, 0, + 0, 0, 341, 2537, 1, 0, 0, 0, 343, 2549, 1, 0, 0, 0, 345, 2557, 1, 0, 0, + 0, 347, 2566, 1, 0, 0, 0, 349, 2577, 1, 0, 0, 0, 351, 2582, 1, 0, 0, 0, + 353, 2587, 1, 0, 0, 0, 355, 2591, 1, 0, 0, 0, 357, 2598, 1, 0, 0, 0, 359, + 2604, 1, 0, 0, 0, 361, 2609, 1, 0, 0, 0, 363, 2618, 1, 0, 0, 0, 365, 2622, + 1, 0, 0, 0, 367, 2633, 1, 0, 0, 0, 369, 2641, 1, 0, 0, 0, 371, 2650, 1, + 0, 0, 0, 373, 2659, 1, 0, 0, 0, 375, 2667, 1, 0, 0, 0, 377, 2674, 1, 0, + 0, 0, 379, 2684, 1, 0, 0, 0, 381, 2695, 1, 0, 0, 0, 383, 2706, 1, 0, 0, + 0, 385, 2714, 1, 0, 0, 0, 387, 2722, 1, 0, 0, 0, 389, 2731, 1, 0, 0, 0, + 391, 2738, 1, 0, 0, 0, 393, 2745, 1, 0, 0, 0, 395, 2750, 1, 0, 0, 0, 397, + 2755, 1, 0, 0, 0, 399, 2762, 1, 0, 0, 0, 401, 2771, 1, 0, 0, 0, 403, 2781, + 1, 0, 0, 0, 405, 2786, 1, 0, 0, 0, 407, 2793, 1, 0, 0, 0, 409, 2799, 1, + 0, 0, 0, 411, 2807, 1, 0, 0, 0, 413, 2817, 1, 0, 0, 0, 415, 2827, 1, 0, + 0, 0, 417, 2835, 1, 0, 0, 0, 419, 2843, 1, 0, 0, 0, 421, 2853, 1, 0, 0, + 0, 423, 2862, 1, 0, 0, 0, 425, 2869, 1, 0, 0, 0, 427, 2875, 1, 0, 0, 0, + 429, 2885, 1, 0, 0, 0, 431, 2891, 1, 0, 0, 0, 433, 2899, 1, 0, 0, 0, 435, + 2908, 1, 0, 0, 0, 437, 2918, 1, 0, 0, 0, 439, 2925, 1, 0, 0, 0, 441, 2933, + 1, 0, 0, 0, 443, 2941, 1, 0, 0, 0, 445, 2948, 1, 0, 0, 0, 447, 2953, 1, + 0, 0, 0, 449, 2958, 1, 0, 0, 0, 451, 2967, 1, 0, 0, 0, 453, 2970, 1, 0, + 0, 0, 455, 2980, 1, 0, 0, 0, 457, 2990, 1, 0, 0, 0, 459, 2999, 1, 0, 0, + 0, 461, 3009, 1, 0, 0, 0, 463, 3019, 1, 0, 0, 0, 465, 3025, 1, 0, 0, 0, + 467, 3033, 1, 0, 0, 0, 469, 3041, 1, 0, 0, 0, 471, 3050, 1, 0, 0, 0, 473, + 3057, 1, 0, 0, 0, 475, 3069, 1, 0, 0, 0, 477, 3076, 1, 0, 0, 0, 479, 3084, + 1, 0, 0, 0, 481, 3092, 1, 0, 0, 0, 483, 3102, 1, 0, 0, 0, 485, 3106, 1, + 0, 0, 0, 487, 3112, 1, 0, 0, 0, 489, 3121, 1, 0, 0, 0, 491, 3127, 1, 0, + 0, 0, 493, 3132, 1, 0, 0, 0, 495, 3142, 1, 0, 0, 0, 497, 3148, 1, 0, 0, + 0, 499, 3155, 1, 0, 0, 0, 501, 3160, 1, 0, 0, 0, 503, 3166, 1, 0, 0, 0, + 505, 3175, 1, 0, 0, 0, 507, 3180, 1, 0, 0, 0, 509, 3188, 1, 0, 0, 0, 511, + 3194, 1, 0, 0, 0, 513, 3202, 1, 0, 0, 0, 515, 3215, 1, 0, 0, 0, 517, 3224, + 1, 0, 0, 0, 519, 3230, 1, 0, 0, 0, 521, 3237, 1, 0, 0, 0, 523, 3246, 1, + 0, 0, 0, 525, 3251, 1, 0, 0, 0, 527, 3257, 1, 0, 0, 0, 529, 3262, 1, 0, + 0, 0, 531, 3267, 1, 0, 0, 0, 533, 3273, 1, 0, 0, 0, 535, 3278, 1, 0, 0, + 0, 537, 3281, 1, 0, 0, 0, 539, 3289, 1, 0, 0, 0, 541, 3296, 1, 0, 0, 0, + 543, 3303, 1, 0, 0, 0, 545, 3309, 1, 0, 0, 0, 547, 3316, 1, 0, 0, 0, 549, + 3319, 1, 0, 0, 0, 551, 3323, 1, 0, 0, 0, 553, 3328, 1, 0, 0, 0, 555, 3337, + 1, 0, 0, 0, 557, 3344, 1, 0, 0, 0, 559, 3352, 1, 0, 0, 0, 561, 3358, 1, + 0, 0, 0, 563, 3364, 1, 0, 0, 0, 565, 3371, 1, 0, 0, 0, 567, 3379, 1, 0, + 0, 0, 569, 3389, 1, 0, 0, 0, 571, 3397, 1, 0, 0, 0, 573, 3406, 1, 0, 0, + 0, 575, 3412, 1, 0, 0, 0, 577, 3422, 1, 0, 0, 0, 579, 3430, 1, 0, 0, 0, + 581, 3439, 1, 0, 0, 0, 583, 3448, 1, 0, 0, 0, 585, 3454, 1, 0, 0, 0, 587, + 3465, 1, 0, 0, 0, 589, 3476, 1, 0, 0, 0, 591, 3486, 1, 0, 0, 0, 593, 3494, + 1, 0, 0, 0, 595, 3500, 1, 0, 0, 0, 597, 3506, 1, 0, 0, 0, 599, 3511, 1, + 0, 0, 0, 601, 3520, 1, 0, 0, 0, 603, 3528, 1, 0, 0, 0, 605, 3538, 1, 0, + 0, 0, 607, 3542, 1, 0, 0, 0, 609, 3550, 1, 0, 0, 0, 611, 3558, 1, 0, 0, + 0, 613, 3567, 1, 0, 0, 0, 615, 3575, 1, 0, 0, 0, 617, 3582, 1, 0, 0, 0, + 619, 3593, 1, 0, 0, 0, 621, 3601, 1, 0, 0, 0, 623, 3609, 1, 0, 0, 0, 625, + 3615, 1, 0, 0, 0, 627, 3623, 1, 0, 0, 0, 629, 3632, 1, 0, 0, 0, 631, 3640, + 1, 0, 0, 0, 633, 3647, 1, 0, 0, 0, 635, 3652, 1, 0, 0, 0, 637, 3661, 1, + 0, 0, 0, 639, 3666, 1, 0, 0, 0, 641, 3671, 1, 0, 0, 0, 643, 3681, 1, 0, + 0, 0, 645, 3688, 1, 0, 0, 0, 647, 3695, 1, 0, 0, 0, 649, 3702, 1, 0, 0, + 0, 651, 3709, 1, 0, 0, 0, 653, 3718, 1, 0, 0, 0, 655, 3727, 1, 0, 0, 0, + 657, 3737, 1, 0, 0, 0, 659, 3750, 1, 0, 0, 0, 661, 3757, 1, 0, 0, 0, 663, + 3765, 1, 0, 0, 0, 665, 3769, 1, 0, 0, 0, 667, 3775, 1, 0, 0, 0, 669, 3780, + 1, 0, 0, 0, 671, 3787, 1, 0, 0, 0, 673, 3796, 1, 0, 0, 0, 675, 3803, 1, + 0, 0, 0, 677, 3814, 1, 0, 0, 0, 679, 3820, 1, 0, 0, 0, 681, 3830, 1, 0, + 0, 0, 683, 3841, 1, 0, 0, 0, 685, 3847, 1, 0, 0, 0, 687, 3854, 1, 0, 0, + 0, 689, 3862, 1, 0, 0, 0, 691, 3869, 1, 0, 0, 0, 693, 3875, 1, 0, 0, 0, + 695, 3881, 1, 0, 0, 0, 697, 3888, 1, 0, 0, 0, 699, 3895, 1, 0, 0, 0, 701, + 3906, 1, 0, 0, 0, 703, 3911, 1, 0, 0, 0, 705, 3920, 1, 0, 0, 0, 707, 3930, + 1, 0, 0, 0, 709, 3935, 1, 0, 0, 0, 711, 3947, 1, 0, 0, 0, 713, 3955, 1, + 0, 0, 0, 715, 3964, 1, 0, 0, 0, 717, 3972, 1, 0, 0, 0, 719, 3977, 1, 0, + 0, 0, 721, 3983, 1, 0, 0, 0, 723, 3993, 1, 0, 0, 0, 725, 4005, 1, 0, 0, + 0, 727, 4017, 1, 0, 0, 0, 729, 4025, 1, 0, 0, 0, 731, 4034, 1, 0, 0, 0, + 733, 4043, 1, 0, 0, 0, 735, 4049, 1, 0, 0, 0, 737, 4056, 1, 0, 0, 0, 739, + 4063, 1, 0, 0, 0, 741, 4069, 1, 0, 0, 0, 743, 4078, 1, 0, 0, 0, 745, 4088, + 1, 0, 0, 0, 747, 4096, 1, 0, 0, 0, 749, 4104, 1, 0, 0, 0, 751, 4109, 1, + 0, 0, 0, 753, 4118, 1, 0, 0, 0, 755, 4129, 1, 0, 0, 0, 757, 4137, 1, 0, + 0, 0, 759, 4142, 1, 0, 0, 0, 761, 4150, 1, 0, 0, 0, 763, 4156, 1, 0, 0, + 0, 765, 4160, 1, 0, 0, 0, 767, 4165, 1, 0, 0, 0, 769, 4169, 1, 0, 0, 0, + 771, 4174, 1, 0, 0, 0, 773, 4181, 1, 0, 0, 0, 775, 4189, 1, 0, 0, 0, 777, + 4196, 1, 0, 0, 0, 779, 4200, 1, 0, 0, 0, 781, 4208, 1, 0, 0, 0, 783, 4213, + 1, 0, 0, 0, 785, 4223, 1, 0, 0, 0, 787, 4232, 1, 0, 0, 0, 789, 4236, 1, + 0, 0, 0, 791, 4244, 1, 0, 0, 0, 793, 4251, 1, 0, 0, 0, 795, 4259, 1, 0, + 0, 0, 797, 4265, 1, 0, 0, 0, 799, 4274, 1, 0, 0, 0, 801, 4280, 1, 0, 0, + 0, 803, 4284, 1, 0, 0, 0, 805, 4292, 1, 0, 0, 0, 807, 4301, 1, 0, 0, 0, + 809, 4307, 1, 0, 0, 0, 811, 4316, 1, 0, 0, 0, 813, 4322, 1, 0, 0, 0, 815, + 4327, 1, 0, 0, 0, 817, 4334, 1, 0, 0, 0, 819, 4342, 1, 0, 0, 0, 821, 4350, + 1, 0, 0, 0, 823, 4360, 1, 0, 0, 0, 825, 4369, 1, 0, 0, 0, 827, 4379, 1, + 0, 0, 0, 829, 4384, 1, 0, 0, 0, 831, 4388, 1, 0, 0, 0, 833, 4394, 1, 0, + 0, 0, 835, 4403, 1, 0, 0, 0, 837, 4413, 1, 0, 0, 0, 839, 4418, 1, 0, 0, + 0, 841, 4428, 1, 0, 0, 0, 843, 4434, 1, 0, 0, 0, 845, 4439, 1, 0, 0, 0, + 847, 4446, 1, 0, 0, 0, 849, 4454, 1, 0, 0, 0, 851, 4468, 1, 0, 0, 0, 853, + 4479, 1, 0, 0, 0, 855, 4486, 1, 0, 0, 0, 857, 4505, 1, 0, 0, 0, 859, 4533, + 1, 0, 0, 0, 861, 4560, 1, 0, 0, 0, 863, 4566, 1, 0, 0, 0, 865, 4579, 1, + 0, 0, 0, 867, 4589, 1, 0, 0, 0, 869, 4600, 1, 0, 0, 0, 871, 4610, 1, 0, + 0, 0, 873, 4620, 1, 0, 0, 0, 875, 4629, 1, 0, 0, 0, 877, 4635, 1, 0, 0, + 0, 879, 4643, 1, 0, 0, 0, 881, 4656, 1, 0, 0, 0, 883, 4661, 1, 0, 0, 0, + 885, 4669, 1, 0, 0, 0, 887, 4676, 1, 0, 0, 0, 889, 4683, 1, 0, 0, 0, 891, + 4694, 1, 0, 0, 0, 893, 4704, 1, 0, 0, 0, 895, 4711, 1, 0, 0, 0, 897, 4718, + 1, 0, 0, 0, 899, 4726, 1, 0, 0, 0, 901, 4734, 1, 0, 0, 0, 903, 4744, 1, + 0, 0, 0, 905, 4751, 1, 0, 0, 0, 907, 4758, 1, 0, 0, 0, 909, 4765, 1, 0, + 0, 0, 911, 4777, 1, 0, 0, 0, 913, 4781, 1, 0, 0, 0, 915, 4785, 1, 0, 0, + 0, 917, 4791, 1, 0, 0, 0, 919, 4804, 1, 0, 0, 0, 921, 4816, 1, 0, 0, 0, + 923, 4820, 1, 0, 0, 0, 925, 4824, 1, 0, 0, 0, 927, 4833, 1, 0, 0, 0, 929, + 4841, 1, 0, 0, 0, 931, 4852, 1, 0, 0, 0, 933, 4858, 1, 0, 0, 0, 935, 4866, + 1, 0, 0, 0, 937, 4875, 1, 0, 0, 0, 939, 4879, 1, 0, 0, 0, 941, 4887, 1, + 0, 0, 0, 943, 4898, 1, 0, 0, 0, 945, 4907, 1, 0, 0, 0, 947, 4912, 1, 0, + 0, 0, 949, 4919, 1, 0, 0, 0, 951, 4924, 1, 0, 0, 0, 953, 4931, 1, 0, 0, + 0, 955, 4936, 1, 0, 0, 0, 957, 4945, 1, 0, 0, 0, 959, 4950, 1, 0, 0, 0, + 961, 4962, 1, 0, 0, 0, 963, 4973, 1, 0, 0, 0, 965, 4982, 1, 0, 0, 0, 967, + 4990, 1, 0, 0, 0, 969, 5004, 1, 0, 0, 0, 971, 5012, 1, 0, 0, 0, 973, 5023, + 1, 0, 0, 0, 975, 5030, 1, 0, 0, 0, 977, 5037, 1, 0, 0, 0, 979, 5044, 1, + 0, 0, 0, 981, 5051, 1, 0, 0, 0, 983, 5055, 1, 0, 0, 0, 985, 5059, 1, 0, + 0, 0, 987, 5064, 1, 0, 0, 0, 989, 5069, 1, 0, 0, 0, 991, 5077, 1, 0, 0, + 0, 993, 5083, 1, 0, 0, 0, 995, 5093, 1, 0, 0, 0, 997, 5098, 1, 0, 0, 0, + 999, 5118, 1, 0, 0, 0, 1001, 5136, 1, 0, 0, 0, 1003, 5142, 1, 0, 0, 0, + 1005, 5155, 1, 0, 0, 0, 1007, 5166, 1, 0, 0, 0, 1009, 5172, 1, 0, 0, 0, + 1011, 5181, 1, 0, 0, 0, 1013, 5189, 1, 0, 0, 0, 1015, 5193, 1, 0, 0, 0, + 1017, 5205, 1, 0, 0, 0, 1019, 5213, 1, 0, 0, 0, 1021, 5219, 1, 0, 0, 0, + 1023, 5225, 1, 0, 0, 0, 1025, 5233, 1, 0, 0, 0, 1027, 5241, 1, 0, 0, 0, + 1029, 5247, 1, 0, 0, 0, 1031, 5252, 1, 0, 0, 0, 1033, 5259, 1, 0, 0, 0, + 1035, 5265, 1, 0, 0, 0, 1037, 5271, 1, 0, 0, 0, 1039, 5280, 1, 0, 0, 0, + 1041, 5286, 1, 0, 0, 0, 1043, 5290, 1, 0, 0, 0, 1045, 5295, 1, 0, 0, 0, + 1047, 5302, 1, 0, 0, 0, 1049, 5310, 1, 0, 0, 0, 1051, 5320, 1, 0, 0, 0, + 1053, 5327, 1, 0, 0, 0, 1055, 5332, 1, 0, 0, 0, 1057, 5337, 1, 0, 0, 0, + 1059, 5341, 1, 0, 0, 0, 1061, 5346, 1, 0, 0, 0, 1063, 5351, 1, 0, 0, 0, + 1065, 5359, 1, 0, 0, 0, 1067, 5367, 1, 0, 0, 0, 1069, 5371, 1, 0, 0, 0, + 1071, 5375, 1, 0, 0, 0, 1073, 5385, 1, 0, 0, 0, 1075, 5391, 1, 0, 0, 0, + 1077, 5395, 1, 0, 0, 0, 1079, 5399, 1, 0, 0, 0, 1081, 5402, 1, 0, 0, 0, + 1083, 5408, 1, 0, 0, 0, 1085, 5418, 1, 0, 0, 0, 1087, 5422, 1, 0, 0, 0, + 1089, 5425, 1, 0, 0, 0, 1091, 5431, 1, 0, 0, 0, 1093, 5439, 1, 0, 0, 0, + 1095, 5445, 1, 0, 0, 0, 1097, 5451, 1, 0, 0, 0, 1099, 5456, 1, 0, 0, 0, + 1101, 5461, 1, 0, 0, 0, 1103, 5472, 1, 0, 0, 0, 1105, 5478, 1, 0, 0, 0, + 1107, 5491, 1, 0, 0, 0, 1109, 5498, 1, 0, 0, 0, 1111, 5506, 1, 0, 0, 0, + 1113, 5511, 1, 0, 0, 0, 1115, 5517, 1, 0, 0, 0, 1117, 5522, 1, 0, 0, 0, + 1119, 5528, 1, 0, 0, 0, 1121, 5533, 1, 0, 0, 0, 1123, 5539, 1, 0, 0, 0, + 1125, 5545, 1, 0, 0, 0, 1127, 5552, 1, 0, 0, 0, 1129, 5556, 1, 0, 0, 0, + 1131, 5561, 1, 0, 0, 0, 1133, 5565, 1, 0, 0, 0, 1135, 5570, 1, 0, 0, 0, + 1137, 5574, 1, 0, 0, 0, 1139, 5579, 1, 0, 0, 0, 1141, 5583, 1, 0, 0, 0, + 1143, 5588, 1, 0, 0, 0, 1145, 5593, 1, 0, 0, 0, 1147, 5598, 1, 0, 0, 0, + 1149, 5603, 1, 0, 0, 0, 1151, 5609, 1, 0, 0, 0, 1153, 5615, 1, 0, 0, 0, + 1155, 5621, 1, 0, 0, 0, 1157, 5632, 1, 0, 0, 0, 1159, 5644, 1, 0, 0, 0, + 1161, 5661, 1, 0, 0, 0, 1163, 5667, 1, 0, 0, 0, 1165, 5680, 1, 0, 0, 0, + 1167, 5686, 1, 0, 0, 0, 1169, 5692, 1, 0, 0, 0, 1171, 5698, 1, 0, 0, 0, + 1173, 5702, 1, 0, 0, 0, 1175, 5709, 1, 0, 0, 0, 1177, 5719, 1, 0, 0, 0, + 1179, 5726, 1, 0, 0, 0, 1181, 5734, 1, 0, 0, 0, 1183, 5741, 1, 0, 0, 0, + 1185, 5746, 1, 0, 0, 0, 1187, 5752, 1, 0, 0, 0, 1189, 5756, 1, 0, 0, 0, + 1191, 5768, 1, 0, 0, 0, 1193, 5787, 1, 0, 0, 0, 1195, 5799, 1, 0, 0, 0, + 1197, 5813, 1, 0, 0, 0, 1199, 5828, 1, 0, 0, 0, 1201, 5841, 1, 0, 0, 0, + 1203, 5854, 1, 0, 0, 0, 1205, 5866, 1, 0, 0, 0, 1207, 5879, 1, 0, 0, 0, + 1209, 5894, 1, 0, 0, 0, 1211, 5909, 1, 0, 0, 0, 1213, 5931, 1, 0, 0, 0, + 1215, 5953, 1, 0, 0, 0, 1217, 5967, 1, 0, 0, 0, 1219, 5974, 1, 0, 0, 0, + 1221, 5979, 1, 0, 0, 0, 1223, 5985, 1, 0, 0, 0, 1225, 5996, 1, 0, 0, 0, + 1227, 6008, 1, 0, 0, 0, 1229, 6024, 1, 0, 0, 0, 1231, 6040, 1, 0, 0, 0, + 1233, 6047, 1, 0, 0, 0, 1235, 6054, 1, 0, 0, 0, 1237, 6063, 1, 0, 0, 0, + 1239, 6070, 1, 0, 0, 0, 1241, 6080, 1, 0, 0, 0, 1243, 6087, 1, 0, 0, 0, + 1245, 6091, 1, 0, 0, 0, 1247, 6107, 1, 0, 0, 0, 1249, 6116, 1, 0, 0, 0, + 1251, 6126, 1, 0, 0, 0, 1253, 6137, 1, 0, 0, 0, 1255, 6146, 1, 0, 0, 0, + 1257, 6159, 1, 0, 0, 0, 1259, 6173, 1, 0, 0, 0, 1261, 6190, 1, 0, 0, 0, + 1263, 6200, 1, 0, 0, 0, 1265, 6214, 1, 0, 0, 0, 1267, 6224, 1, 0, 0, 0, + 1269, 6239, 1, 0, 0, 0, 1271, 6256, 1, 0, 0, 0, 1273, 6260, 1, 0, 0, 0, + 1275, 6280, 1, 0, 0, 0, 1277, 6290, 1, 0, 0, 0, 1279, 6312, 1, 0, 0, 0, + 1281, 6325, 1, 0, 0, 0, 1283, 6333, 1, 0, 0, 0, 1285, 6341, 1, 0, 0, 0, + 1287, 6351, 1, 0, 0, 0, 1289, 6358, 1, 0, 0, 0, 1291, 6366, 1, 0, 0, 0, + 1293, 6374, 1, 0, 0, 0, 1295, 6389, 1, 0, 0, 0, 1297, 6406, 1, 0, 0, 0, + 1299, 6419, 1, 0, 0, 0, 1301, 6423, 1, 0, 0, 0, 1303, 6427, 1, 0, 0, 0, + 1305, 6429, 1, 0, 0, 0, 1307, 6432, 1, 0, 0, 0, 1309, 6441, 1, 0, 0, 0, + 1311, 6444, 1, 0, 0, 0, 1313, 6453, 1, 0, 0, 0, 1315, 6457, 1, 0, 0, 0, + 1317, 6461, 1, 0, 0, 0, 1319, 6465, 1, 0, 0, 0, 1321, 6469, 1, 0, 0, 0, + 1323, 6472, 1, 0, 0, 0, 1325, 6481, 1, 0, 0, 0, 1327, 6487, 1, 0, 0, 0, + 1329, 6490, 1, 0, 0, 0, 1331, 6494, 1, 0, 0, 0, 1333, 6503, 1, 0, 0, 0, + 1335, 6510, 1, 0, 0, 0, 1337, 6513, 1, 0, 0, 0, 1339, 6521, 1, 0, 0, 0, + 1341, 6524, 1, 0, 0, 0, 1343, 6527, 1, 0, 0, 0, 1345, 6530, 1, 0, 0, 0, + 1347, 6538, 1, 0, 0, 0, 1349, 6541, 1, 0, 0, 0, 1351, 6544, 1, 0, 0, 0, + 1353, 6546, 1, 0, 0, 0, 1355, 6580, 1, 0, 0, 0, 1357, 6583, 1, 0, 0, 0, + 1359, 6587, 1, 0, 0, 0, 1361, 6595, 1, 0, 0, 0, 1363, 6610, 1, 0, 0, 0, + 1365, 6619, 1, 0, 0, 0, 1367, 6623, 1, 0, 0, 0, 1369, 6634, 1, 0, 0, 0, + 1371, 6673, 1, 0, 0, 0, 1373, 6724, 1, 0, 0, 0, 1375, 6748, 1, 0, 0, 0, + 1377, 6751, 1, 0, 0, 0, 1379, 6753, 1, 0, 0, 0, 1381, 6758, 1, 0, 0, 0, + 1383, 6789, 1, 0, 0, 0, 1385, 6792, 1, 0, 0, 0, 1387, 6797, 1, 0, 0, 0, + 1389, 6810, 1, 0, 0, 0, 1391, 6813, 1, 0, 0, 0, 1393, 6818, 1, 0, 0, 0, + 1395, 6824, 1, 0, 0, 0, 1397, 6829, 1, 0, 0, 0, 1399, 6834, 1, 0, 0, 0, + 1401, 6839, 1, 0, 0, 0, 1403, 6844, 1, 0, 0, 0, 1405, 6861, 1, 0, 0, 0, + 1407, 6863, 1, 0, 0, 0, 1409, 1410, 5, 36, 0, 0, 1410, 6, 1, 0, 0, 0, 1411, + 1412, 5, 40, 0, 0, 1412, 8, 1, 0, 0, 0, 1413, 1414, 5, 41, 0, 0, 1414, + 10, 1, 0, 0, 0, 1415, 1416, 5, 91, 0, 0, 1416, 12, 1, 0, 0, 0, 1417, 1418, + 5, 93, 0, 0, 1418, 14, 1, 0, 0, 0, 1419, 1420, 5, 44, 0, 0, 1420, 16, 1, + 0, 0, 0, 1421, 1422, 5, 59, 0, 0, 1422, 18, 1, 0, 0, 0, 1423, 1424, 5, + 58, 0, 0, 1424, 20, 1, 0, 0, 0, 1425, 1426, 5, 42, 0, 0, 1426, 22, 1, 0, + 0, 0, 1427, 1428, 5, 61, 0, 0, 1428, 24, 1, 0, 0, 0, 1429, 1430, 5, 46, + 0, 0, 1430, 26, 1, 0, 0, 0, 1431, 1432, 5, 43, 0, 0, 1432, 28, 1, 0, 0, + 0, 1433, 1434, 5, 45, 0, 0, 1434, 30, 1, 0, 0, 0, 1435, 1436, 5, 47, 0, + 0, 1436, 32, 1, 0, 0, 0, 1437, 1438, 5, 94, 0, 0, 1438, 34, 1, 0, 0, 0, + 1439, 1440, 5, 60, 0, 0, 1440, 36, 1, 0, 0, 0, 1441, 1442, 5, 62, 0, 0, + 1442, 38, 1, 0, 0, 0, 1443, 1444, 5, 60, 0, 0, 1444, 1445, 5, 60, 0, 0, + 1445, 40, 1, 0, 0, 0, 1446, 1447, 5, 62, 0, 0, 1447, 1448, 5, 62, 0, 0, + 1448, 42, 1, 0, 0, 0, 1449, 1450, 5, 58, 0, 0, 1450, 1451, 5, 61, 0, 0, + 1451, 44, 1, 0, 0, 0, 1452, 1453, 5, 60, 0, 0, 1453, 1454, 5, 61, 0, 0, + 1454, 46, 1, 0, 0, 0, 1455, 1456, 5, 61, 0, 0, 1456, 1457, 5, 62, 0, 0, + 1457, 48, 1, 0, 0, 0, 1458, 1459, 5, 62, 0, 0, 1459, 1460, 5, 61, 0, 0, + 1460, 50, 1, 0, 0, 0, 1461, 1462, 5, 46, 0, 0, 1462, 1463, 5, 46, 0, 0, + 1463, 52, 1, 0, 0, 0, 1464, 1465, 5, 60, 0, 0, 1465, 1466, 5, 62, 0, 0, + 1466, 54, 1, 0, 0, 0, 1467, 1468, 5, 58, 0, 0, 1468, 1469, 5, 58, 0, 0, + 1469, 56, 1, 0, 0, 0, 1470, 1471, 5, 37, 0, 0, 1471, 58, 1, 0, 0, 0, 1472, + 1474, 5, 36, 0, 0, 1473, 1475, 7, 0, 0, 0, 1474, 1473, 1, 0, 0, 0, 1475, + 1476, 1, 0, 0, 0, 1476, 1474, 1, 0, 0, 0, 1476, 1477, 1, 0, 0, 0, 1477, + 60, 1, 0, 0, 0, 1478, 1494, 3, 65, 30, 0, 1479, 1483, 5, 43, 0, 0, 1480, + 1481, 5, 45, 0, 0, 1481, 1483, 4, 28, 0, 0, 1482, 1479, 1, 0, 0, 0, 1482, + 1480, 1, 0, 0, 0, 1483, 1484, 1, 0, 0, 0, 1484, 1482, 1, 0, 0, 0, 1484, + 1485, 1, 0, 0, 0, 1485, 1489, 1, 0, 0, 0, 1486, 1490, 3, 65, 30, 0, 1487, + 1488, 5, 47, 0, 0, 1488, 1490, 4, 28, 1, 0, 1489, 1486, 1, 0, 0, 0, 1489, + 1487, 1, 0, 0, 0, 1490, 1494, 1, 0, 0, 0, 1491, 1492, 5, 47, 0, 0, 1492, + 1494, 4, 28, 2, 0, 1493, 1478, 1, 0, 0, 0, 1493, 1482, 1, 0, 0, 0, 1493, + 1491, 1, 0, 0, 0, 1494, 1495, 1, 0, 0, 0, 1495, 1493, 1, 0, 0, 0, 1495, + 1496, 1, 0, 0, 0, 1496, 1499, 1, 0, 0, 0, 1497, 1499, 7, 1, 0, 0, 1498, + 1493, 1, 0, 0, 0, 1498, 1497, 1, 0, 0, 0, 1499, 1500, 1, 0, 0, 0, 1500, + 1501, 6, 28, 0, 0, 1501, 62, 1, 0, 0, 0, 1502, 1508, 3, 67, 31, 0, 1503, + 1504, 5, 45, 0, 0, 1504, 1508, 4, 29, 3, 0, 1505, 1506, 5, 47, 0, 0, 1506, + 1508, 4, 29, 4, 0, 1507, 1502, 1, 0, 0, 0, 1507, 1503, 1, 0, 0, 0, 1507, + 1505, 1, 0, 0, 0, 1508, 1511, 1, 0, 0, 0, 1509, 1507, 1, 0, 0, 0, 1509, + 1510, 1, 0, 0, 0, 1510, 1512, 1, 0, 0, 0, 1511, 1509, 1, 0, 0, 0, 1512, + 1514, 3, 69, 32, 0, 1513, 1515, 3, 61, 28, 0, 1514, 1513, 1, 0, 0, 0, 1514, + 1515, 1, 0, 0, 0, 1515, 1519, 1, 0, 0, 0, 1516, 1520, 5, 43, 0, 0, 1517, + 1518, 5, 45, 0, 0, 1518, 1520, 4, 29, 5, 0, 1519, 1516, 1, 0, 0, 0, 1519, + 1517, 1, 0, 0, 0, 1520, 1521, 1, 0, 0, 0, 1521, 1519, 1, 0, 0, 0, 1521, + 1522, 1, 0, 0, 0, 1522, 1523, 1, 0, 0, 0, 1523, 1524, 6, 29, 1, 0, 1524, + 64, 1, 0, 0, 0, 1525, 1526, 7, 2, 0, 0, 1526, 66, 1, 0, 0, 0, 1527, 1528, + 7, 3, 0, 0, 1528, 68, 1, 0, 0, 0, 1529, 1530, 7, 4, 0, 0, 1530, 70, 1, + 0, 0, 0, 1531, 1532, 7, 5, 0, 0, 1532, 1533, 7, 6, 0, 0, 1533, 1534, 7, + 6, 0, 0, 1534, 72, 1, 0, 0, 0, 1535, 1536, 7, 5, 0, 0, 1536, 1537, 7, 7, + 0, 0, 1537, 1538, 7, 5, 0, 0, 1538, 1539, 7, 6, 0, 0, 1539, 1540, 7, 8, + 0, 0, 1540, 1541, 7, 9, 0, 0, 1541, 1542, 7, 10, 0, 0, 1542, 74, 1, 0, + 0, 0, 1543, 1544, 7, 5, 0, 0, 1544, 1545, 7, 7, 0, 0, 1545, 1546, 7, 5, + 0, 0, 1546, 1547, 7, 6, 0, 0, 1547, 1548, 7, 8, 0, 0, 1548, 1549, 7, 11, + 0, 0, 1549, 1550, 7, 10, 0, 0, 1550, 76, 1, 0, 0, 0, 1551, 1552, 7, 5, + 0, 0, 1552, 1553, 7, 7, 0, 0, 1553, 1554, 7, 12, 0, 0, 1554, 78, 1, 0, + 0, 0, 1555, 1556, 7, 5, 0, 0, 1556, 1557, 7, 7, 0, 0, 1557, 1558, 7, 8, + 0, 0, 1558, 80, 1, 0, 0, 0, 1559, 1560, 7, 5, 0, 0, 1560, 1561, 7, 13, + 0, 0, 1561, 1562, 7, 13, 0, 0, 1562, 1563, 7, 5, 0, 0, 1563, 1564, 7, 8, + 0, 0, 1564, 82, 1, 0, 0, 0, 1565, 1566, 7, 5, 0, 0, 1566, 1567, 7, 9, 0, + 0, 1567, 84, 1, 0, 0, 0, 1568, 1569, 7, 5, 0, 0, 1569, 1570, 7, 9, 0, 0, + 1570, 1571, 7, 14, 0, 0, 1571, 86, 1, 0, 0, 0, 1572, 1573, 7, 5, 0, 0, + 1573, 1574, 7, 9, 0, 0, 1574, 1575, 7, 8, 0, 0, 1575, 1576, 7, 15, 0, 0, + 1576, 1577, 7, 15, 0, 0, 1577, 1578, 7, 10, 0, 0, 1578, 1579, 7, 16, 0, + 0, 1579, 1580, 7, 13, 0, 0, 1580, 1581, 7, 17, 0, 0, 1581, 1582, 7, 14, + 0, 0, 1582, 88, 1, 0, 0, 0, 1583, 1584, 7, 18, 0, 0, 1584, 1585, 7, 19, + 0, 0, 1585, 1586, 7, 16, 0, 0, 1586, 1587, 7, 20, 0, 0, 1587, 90, 1, 0, + 0, 0, 1588, 1589, 7, 14, 0, 0, 1589, 1590, 7, 5, 0, 0, 1590, 1591, 7, 9, + 0, 0, 1591, 1592, 7, 10, 0, 0, 1592, 92, 1, 0, 0, 0, 1593, 1594, 7, 14, + 0, 0, 1594, 1595, 7, 5, 0, 0, 1595, 1596, 7, 9, 0, 0, 1596, 1597, 7, 16, + 0, 0, 1597, 94, 1, 0, 0, 0, 1598, 1599, 7, 14, 0, 0, 1599, 1600, 7, 20, + 0, 0, 1600, 1601, 7, 10, 0, 0, 1601, 1602, 7, 14, 0, 0, 1602, 1603, 7, + 21, 0, 0, 1603, 96, 1, 0, 0, 0, 1604, 1605, 7, 14, 0, 0, 1605, 1606, 7, + 19, 0, 0, 1606, 1607, 7, 6, 0, 0, 1607, 1608, 7, 6, 0, 0, 1608, 1609, 7, + 5, 0, 0, 1609, 1610, 7, 16, 0, 0, 1610, 1611, 7, 10, 0, 0, 1611, 98, 1, + 0, 0, 0, 1612, 1613, 7, 14, 0, 0, 1613, 1614, 7, 19, 0, 0, 1614, 1615, + 7, 6, 0, 0, 1615, 1616, 7, 22, 0, 0, 1616, 1617, 7, 15, 0, 0, 1617, 1618, + 7, 7, 0, 0, 1618, 100, 1, 0, 0, 0, 1619, 1620, 7, 14, 0, 0, 1620, 1621, + 7, 19, 0, 0, 1621, 1622, 7, 7, 0, 0, 1622, 1623, 7, 9, 0, 0, 1623, 1624, + 7, 16, 0, 0, 1624, 1625, 7, 13, 0, 0, 1625, 1626, 7, 5, 0, 0, 1626, 1627, + 7, 17, 0, 0, 1627, 1628, 7, 7, 0, 0, 1628, 1629, 7, 16, 0, 0, 1629, 102, + 1, 0, 0, 0, 1630, 1631, 7, 14, 0, 0, 1631, 1632, 7, 13, 0, 0, 1632, 1633, + 7, 10, 0, 0, 1633, 1634, 7, 5, 0, 0, 1634, 1635, 7, 16, 0, 0, 1635, 1636, + 7, 10, 0, 0, 1636, 104, 1, 0, 0, 0, 1637, 1638, 7, 14, 0, 0, 1638, 1639, + 7, 22, 0, 0, 1639, 1640, 7, 13, 0, 0, 1640, 1641, 7, 13, 0, 0, 1641, 1642, + 7, 10, 0, 0, 1642, 1643, 7, 7, 0, 0, 1643, 1644, 7, 16, 0, 0, 1644, 1645, + 5, 95, 0, 0, 1645, 1646, 7, 14, 0, 0, 1646, 1647, 7, 5, 0, 0, 1647, 1648, + 7, 16, 0, 0, 1648, 1649, 7, 5, 0, 0, 1649, 1650, 7, 6, 0, 0, 1650, 1651, + 7, 19, 0, 0, 1651, 1652, 7, 23, 0, 0, 1652, 106, 1, 0, 0, 0, 1653, 1654, + 7, 14, 0, 0, 1654, 1655, 7, 22, 0, 0, 1655, 1656, 7, 13, 0, 0, 1656, 1657, + 7, 13, 0, 0, 1657, 1658, 7, 10, 0, 0, 1658, 1659, 7, 7, 0, 0, 1659, 1660, + 7, 16, 0, 0, 1660, 1661, 5, 95, 0, 0, 1661, 1662, 7, 12, 0, 0, 1662, 1663, + 7, 5, 0, 0, 1663, 1664, 7, 16, 0, 0, 1664, 1665, 7, 10, 0, 0, 1665, 108, + 1, 0, 0, 0, 1666, 1667, 7, 14, 0, 0, 1667, 1668, 7, 22, 0, 0, 1668, 1669, + 7, 13, 0, 0, 1669, 1670, 7, 13, 0, 0, 1670, 1671, 7, 10, 0, 0, 1671, 1672, + 7, 7, 0, 0, 1672, 1673, 7, 16, 0, 0, 1673, 1674, 5, 95, 0, 0, 1674, 1675, + 7, 13, 0, 0, 1675, 1676, 7, 19, 0, 0, 1676, 1677, 7, 6, 0, 0, 1677, 1678, + 7, 10, 0, 0, 1678, 110, 1, 0, 0, 0, 1679, 1680, 7, 14, 0, 0, 1680, 1681, + 7, 22, 0, 0, 1681, 1682, 7, 13, 0, 0, 1682, 1683, 7, 13, 0, 0, 1683, 1684, + 7, 10, 0, 0, 1684, 1685, 7, 7, 0, 0, 1685, 1686, 7, 16, 0, 0, 1686, 1687, + 5, 95, 0, 0, 1687, 1688, 7, 16, 0, 0, 1688, 1689, 7, 17, 0, 0, 1689, 1690, + 7, 15, 0, 0, 1690, 1691, 7, 10, 0, 0, 1691, 112, 1, 0, 0, 0, 1692, 1693, + 7, 14, 0, 0, 1693, 1694, 7, 22, 0, 0, 1694, 1695, 7, 13, 0, 0, 1695, 1696, + 7, 13, 0, 0, 1696, 1697, 7, 10, 0, 0, 1697, 1698, 7, 7, 0, 0, 1698, 1699, + 7, 16, 0, 0, 1699, 1700, 5, 95, 0, 0, 1700, 1701, 7, 16, 0, 0, 1701, 1702, + 7, 17, 0, 0, 1702, 1703, 7, 15, 0, 0, 1703, 1704, 7, 10, 0, 0, 1704, 1705, + 7, 9, 0, 0, 1705, 1706, 7, 16, 0, 0, 1706, 1707, 7, 5, 0, 0, 1707, 1708, + 7, 15, 0, 0, 1708, 1709, 7, 24, 0, 0, 1709, 114, 1, 0, 0, 0, 1710, 1711, + 7, 14, 0, 0, 1711, 1712, 7, 22, 0, 0, 1712, 1713, 7, 13, 0, 0, 1713, 1714, + 7, 13, 0, 0, 1714, 1715, 7, 10, 0, 0, 1715, 1716, 7, 7, 0, 0, 1716, 1717, + 7, 16, 0, 0, 1717, 1718, 5, 95, 0, 0, 1718, 1719, 7, 22, 0, 0, 1719, 1720, + 7, 9, 0, 0, 1720, 1721, 7, 10, 0, 0, 1721, 1722, 7, 13, 0, 0, 1722, 116, + 1, 0, 0, 0, 1723, 1724, 7, 12, 0, 0, 1724, 1725, 7, 10, 0, 0, 1725, 1726, + 7, 25, 0, 0, 1726, 1727, 7, 5, 0, 0, 1727, 1728, 7, 22, 0, 0, 1728, 1729, + 7, 6, 0, 0, 1729, 1730, 7, 16, 0, 0, 1730, 118, 1, 0, 0, 0, 1731, 1732, + 7, 12, 0, 0, 1732, 1733, 7, 10, 0, 0, 1733, 1734, 7, 25, 0, 0, 1734, 1735, + 7, 10, 0, 0, 1735, 1736, 7, 13, 0, 0, 1736, 1737, 7, 13, 0, 0, 1737, 1738, + 7, 5, 0, 0, 1738, 1739, 7, 18, 0, 0, 1739, 1740, 7, 6, 0, 0, 1740, 1741, + 7, 10, 0, 0, 1741, 120, 1, 0, 0, 0, 1742, 1743, 7, 12, 0, 0, 1743, 1744, + 7, 10, 0, 0, 1744, 1745, 7, 9, 0, 0, 1745, 1746, 7, 14, 0, 0, 1746, 122, + 1, 0, 0, 0, 1747, 1748, 7, 12, 0, 0, 1748, 1749, 7, 17, 0, 0, 1749, 1750, + 7, 9, 0, 0, 1750, 1751, 7, 16, 0, 0, 1751, 1752, 7, 17, 0, 0, 1752, 1753, + 7, 7, 0, 0, 1753, 1754, 7, 14, 0, 0, 1754, 1755, 7, 16, 0, 0, 1755, 124, + 1, 0, 0, 0, 1756, 1757, 7, 12, 0, 0, 1757, 1758, 7, 19, 0, 0, 1758, 126, + 1, 0, 0, 0, 1759, 1760, 7, 10, 0, 0, 1760, 1761, 7, 6, 0, 0, 1761, 1762, + 7, 9, 0, 0, 1762, 1763, 7, 10, 0, 0, 1763, 128, 1, 0, 0, 0, 1764, 1765, + 7, 10, 0, 0, 1765, 1766, 7, 26, 0, 0, 1766, 1767, 7, 14, 0, 0, 1767, 1768, + 7, 10, 0, 0, 1768, 1769, 7, 24, 0, 0, 1769, 1770, 7, 16, 0, 0, 1770, 130, + 1, 0, 0, 0, 1771, 1772, 7, 25, 0, 0, 1772, 1773, 7, 5, 0, 0, 1773, 1774, + 7, 6, 0, 0, 1774, 1775, 7, 9, 0, 0, 1775, 1776, 7, 10, 0, 0, 1776, 132, + 1, 0, 0, 0, 1777, 1778, 7, 25, 0, 0, 1778, 1779, 7, 10, 0, 0, 1779, 1780, + 7, 16, 0, 0, 1780, 1781, 7, 14, 0, 0, 1781, 1782, 7, 20, 0, 0, 1782, 134, + 1, 0, 0, 0, 1783, 1784, 7, 25, 0, 0, 1784, 1785, 7, 19, 0, 0, 1785, 1786, + 7, 13, 0, 0, 1786, 136, 1, 0, 0, 0, 1787, 1788, 7, 25, 0, 0, 1788, 1789, + 7, 19, 0, 0, 1789, 1790, 7, 13, 0, 0, 1790, 1791, 7, 10, 0, 0, 1791, 1792, + 7, 17, 0, 0, 1792, 1793, 7, 23, 0, 0, 1793, 1794, 7, 7, 0, 0, 1794, 138, + 1, 0, 0, 0, 1795, 1796, 7, 25, 0, 0, 1796, 1797, 7, 13, 0, 0, 1797, 1798, + 7, 19, 0, 0, 1798, 1799, 7, 15, 0, 0, 1799, 140, 1, 0, 0, 0, 1800, 1801, + 7, 23, 0, 0, 1801, 1802, 7, 13, 0, 0, 1802, 1803, 7, 5, 0, 0, 1803, 1804, + 7, 7, 0, 0, 1804, 1805, 7, 16, 0, 0, 1805, 142, 1, 0, 0, 0, 1806, 1807, + 7, 23, 0, 0, 1807, 1808, 7, 13, 0, 0, 1808, 1809, 7, 19, 0, 0, 1809, 1810, + 7, 22, 0, 0, 1810, 1811, 7, 24, 0, 0, 1811, 144, 1, 0, 0, 0, 1812, 1813, + 7, 20, 0, 0, 1813, 1814, 7, 5, 0, 0, 1814, 1815, 7, 27, 0, 0, 1815, 1816, + 7, 17, 0, 0, 1816, 1817, 7, 7, 0, 0, 1817, 1818, 7, 23, 0, 0, 1818, 146, + 1, 0, 0, 0, 1819, 1820, 7, 17, 0, 0, 1820, 1821, 7, 7, 0, 0, 1821, 148, + 1, 0, 0, 0, 1822, 1823, 7, 17, 0, 0, 1823, 1824, 7, 7, 0, 0, 1824, 1825, + 7, 17, 0, 0, 1825, 1826, 7, 16, 0, 0, 1826, 1827, 7, 17, 0, 0, 1827, 1828, + 7, 5, 0, 0, 1828, 1829, 7, 6, 0, 0, 1829, 1830, 7, 6, 0, 0, 1830, 1831, + 7, 8, 0, 0, 1831, 150, 1, 0, 0, 0, 1832, 1833, 7, 17, 0, 0, 1833, 1834, + 7, 7, 0, 0, 1834, 1835, 7, 16, 0, 0, 1835, 1836, 7, 10, 0, 0, 1836, 1837, + 7, 13, 0, 0, 1837, 1838, 7, 9, 0, 0, 1838, 1839, 7, 10, 0, 0, 1839, 1840, + 7, 14, 0, 0, 1840, 1841, 7, 16, 0, 0, 1841, 152, 1, 0, 0, 0, 1842, 1843, + 7, 17, 0, 0, 1843, 1844, 7, 7, 0, 0, 1844, 1845, 7, 16, 0, 0, 1845, 1846, + 7, 19, 0, 0, 1846, 154, 1, 0, 0, 0, 1847, 1848, 7, 6, 0, 0, 1848, 1849, + 7, 5, 0, 0, 1849, 1850, 7, 16, 0, 0, 1850, 1851, 7, 10, 0, 0, 1851, 1852, + 7, 13, 0, 0, 1852, 1853, 7, 5, 0, 0, 1853, 1854, 7, 6, 0, 0, 1854, 156, + 1, 0, 0, 0, 1855, 1856, 7, 6, 0, 0, 1856, 1857, 7, 10, 0, 0, 1857, 1858, + 7, 5, 0, 0, 1858, 1859, 7, 12, 0, 0, 1859, 1860, 7, 17, 0, 0, 1860, 1861, + 7, 7, 0, 0, 1861, 1862, 7, 23, 0, 0, 1862, 158, 1, 0, 0, 0, 1863, 1864, + 7, 6, 0, 0, 1864, 1865, 7, 17, 0, 0, 1865, 1866, 7, 15, 0, 0, 1866, 1867, + 7, 17, 0, 0, 1867, 1868, 7, 16, 0, 0, 1868, 160, 1, 0, 0, 0, 1869, 1870, + 7, 6, 0, 0, 1870, 1871, 7, 19, 0, 0, 1871, 1872, 7, 14, 0, 0, 1872, 1873, + 7, 5, 0, 0, 1873, 1874, 7, 6, 0, 0, 1874, 1875, 7, 16, 0, 0, 1875, 1876, + 7, 17, 0, 0, 1876, 1877, 7, 15, 0, 0, 1877, 1878, 7, 10, 0, 0, 1878, 162, + 1, 0, 0, 0, 1879, 1880, 7, 6, 0, 0, 1880, 1881, 7, 19, 0, 0, 1881, 1882, + 7, 14, 0, 0, 1882, 1883, 7, 5, 0, 0, 1883, 1884, 7, 6, 0, 0, 1884, 1885, + 7, 16, 0, 0, 1885, 1886, 7, 17, 0, 0, 1886, 1887, 7, 15, 0, 0, 1887, 1888, + 7, 10, 0, 0, 1888, 1889, 7, 9, 0, 0, 1889, 1890, 7, 16, 0, 0, 1890, 1891, + 7, 5, 0, 0, 1891, 1892, 7, 15, 0, 0, 1892, 1893, 7, 24, 0, 0, 1893, 164, + 1, 0, 0, 0, 1894, 1895, 7, 7, 0, 0, 1895, 1896, 7, 19, 0, 0, 1896, 1897, + 7, 16, 0, 0, 1897, 166, 1, 0, 0, 0, 1898, 1899, 7, 7, 0, 0, 1899, 1900, + 7, 22, 0, 0, 1900, 1901, 7, 6, 0, 0, 1901, 1902, 7, 6, 0, 0, 1902, 168, + 1, 0, 0, 0, 1903, 1904, 7, 19, 0, 0, 1904, 1905, 7, 25, 0, 0, 1905, 1906, + 7, 25, 0, 0, 1906, 1907, 7, 9, 0, 0, 1907, 1908, 7, 10, 0, 0, 1908, 1909, + 7, 16, 0, 0, 1909, 170, 1, 0, 0, 0, 1910, 1911, 7, 19, 0, 0, 1911, 1912, + 7, 7, 0, 0, 1912, 172, 1, 0, 0, 0, 1913, 1914, 7, 19, 0, 0, 1914, 1915, + 7, 7, 0, 0, 1915, 1916, 7, 6, 0, 0, 1916, 1917, 7, 8, 0, 0, 1917, 174, + 1, 0, 0, 0, 1918, 1919, 7, 19, 0, 0, 1919, 1920, 7, 13, 0, 0, 1920, 176, + 1, 0, 0, 0, 1921, 1922, 7, 19, 0, 0, 1922, 1923, 7, 13, 0, 0, 1923, 1924, + 7, 12, 0, 0, 1924, 1925, 7, 10, 0, 0, 1925, 1926, 7, 13, 0, 0, 1926, 178, + 1, 0, 0, 0, 1927, 1928, 7, 24, 0, 0, 1928, 1929, 7, 6, 0, 0, 1929, 1930, + 7, 5, 0, 0, 1930, 1931, 7, 14, 0, 0, 1931, 1932, 7, 17, 0, 0, 1932, 1933, + 7, 7, 0, 0, 1933, 1934, 7, 23, 0, 0, 1934, 180, 1, 0, 0, 0, 1935, 1936, + 7, 24, 0, 0, 1936, 1937, 7, 13, 0, 0, 1937, 1938, 7, 17, 0, 0, 1938, 1939, + 7, 15, 0, 0, 1939, 1940, 7, 5, 0, 0, 1940, 1941, 7, 13, 0, 0, 1941, 1942, + 7, 8, 0, 0, 1942, 182, 1, 0, 0, 0, 1943, 1944, 7, 13, 0, 0, 1944, 1945, + 7, 10, 0, 0, 1945, 1946, 7, 25, 0, 0, 1946, 1947, 7, 10, 0, 0, 1947, 1948, + 7, 13, 0, 0, 1948, 1949, 7, 10, 0, 0, 1949, 1950, 7, 7, 0, 0, 1950, 1951, + 7, 14, 0, 0, 1951, 1952, 7, 10, 0, 0, 1952, 1953, 7, 9, 0, 0, 1953, 184, + 1, 0, 0, 0, 1954, 1955, 7, 13, 0, 0, 1955, 1956, 7, 10, 0, 0, 1956, 1957, + 7, 16, 0, 0, 1957, 1958, 7, 22, 0, 0, 1958, 1959, 7, 13, 0, 0, 1959, 1960, + 7, 7, 0, 0, 1960, 1961, 7, 17, 0, 0, 1961, 1962, 7, 7, 0, 0, 1962, 1963, + 7, 23, 0, 0, 1963, 186, 1, 0, 0, 0, 1964, 1965, 7, 9, 0, 0, 1965, 1966, + 7, 10, 0, 0, 1966, 1967, 7, 6, 0, 0, 1967, 1968, 7, 10, 0, 0, 1968, 1969, + 7, 14, 0, 0, 1969, 1970, 7, 16, 0, 0, 1970, 188, 1, 0, 0, 0, 1971, 1972, + 7, 9, 0, 0, 1972, 1973, 7, 10, 0, 0, 1973, 1974, 7, 9, 0, 0, 1974, 1975, + 7, 9, 0, 0, 1975, 1976, 7, 17, 0, 0, 1976, 1977, 7, 19, 0, 0, 1977, 1978, + 7, 7, 0, 0, 1978, 1979, 5, 95, 0, 0, 1979, 1980, 7, 22, 0, 0, 1980, 1981, + 7, 9, 0, 0, 1981, 1982, 7, 10, 0, 0, 1982, 1983, 7, 13, 0, 0, 1983, 190, + 1, 0, 0, 0, 1984, 1985, 7, 9, 0, 0, 1985, 1986, 7, 19, 0, 0, 1986, 1987, + 7, 15, 0, 0, 1987, 1988, 7, 10, 0, 0, 1988, 192, 1, 0, 0, 0, 1989, 1990, + 7, 9, 0, 0, 1990, 1991, 7, 8, 0, 0, 1991, 1992, 7, 15, 0, 0, 1992, 1993, + 7, 15, 0, 0, 1993, 1994, 7, 10, 0, 0, 1994, 1995, 7, 16, 0, 0, 1995, 1996, + 7, 13, 0, 0, 1996, 1997, 7, 17, 0, 0, 1997, 1998, 7, 14, 0, 0, 1998, 194, + 1, 0, 0, 0, 1999, 2000, 7, 16, 0, 0, 2000, 2001, 7, 5, 0, 0, 2001, 2002, + 7, 18, 0, 0, 2002, 2003, 7, 6, 0, 0, 2003, 2004, 7, 10, 0, 0, 2004, 196, + 1, 0, 0, 0, 2005, 2006, 7, 16, 0, 0, 2006, 2007, 7, 20, 0, 0, 2007, 2008, + 7, 10, 0, 0, 2008, 2009, 7, 7, 0, 0, 2009, 198, 1, 0, 0, 0, 2010, 2011, + 7, 16, 0, 0, 2011, 2012, 7, 19, 0, 0, 2012, 200, 1, 0, 0, 0, 2013, 2014, + 7, 16, 0, 0, 2014, 2015, 7, 13, 0, 0, 2015, 2016, 7, 5, 0, 0, 2016, 2017, + 7, 17, 0, 0, 2017, 2018, 7, 6, 0, 0, 2018, 2019, 7, 17, 0, 0, 2019, 2020, + 7, 7, 0, 0, 2020, 2021, 7, 23, 0, 0, 2021, 202, 1, 0, 0, 0, 2022, 2023, + 7, 16, 0, 0, 2023, 2024, 7, 13, 0, 0, 2024, 2025, 7, 22, 0, 0, 2025, 2026, + 7, 10, 0, 0, 2026, 204, 1, 0, 0, 0, 2027, 2028, 7, 22, 0, 0, 2028, 2029, + 7, 7, 0, 0, 2029, 2030, 7, 17, 0, 0, 2030, 2031, 7, 19, 0, 0, 2031, 2032, + 7, 7, 0, 0, 2032, 206, 1, 0, 0, 0, 2033, 2034, 7, 22, 0, 0, 2034, 2035, + 7, 7, 0, 0, 2035, 2036, 7, 17, 0, 0, 2036, 2037, 7, 28, 0, 0, 2037, 2038, + 7, 22, 0, 0, 2038, 2039, 7, 10, 0, 0, 2039, 208, 1, 0, 0, 0, 2040, 2041, + 7, 22, 0, 0, 2041, 2042, 7, 9, 0, 0, 2042, 2043, 7, 10, 0, 0, 2043, 2044, + 7, 13, 0, 0, 2044, 210, 1, 0, 0, 0, 2045, 2046, 7, 22, 0, 0, 2046, 2047, + 7, 9, 0, 0, 2047, 2048, 7, 17, 0, 0, 2048, 2049, 7, 7, 0, 0, 2049, 2050, + 7, 23, 0, 0, 2050, 212, 1, 0, 0, 0, 2051, 2052, 7, 27, 0, 0, 2052, 2053, + 7, 5, 0, 0, 2053, 2054, 7, 13, 0, 0, 2054, 2055, 7, 17, 0, 0, 2055, 2056, + 7, 5, 0, 0, 2056, 2057, 7, 12, 0, 0, 2057, 2058, 7, 17, 0, 0, 2058, 2059, + 7, 14, 0, 0, 2059, 214, 1, 0, 0, 0, 2060, 2061, 7, 29, 0, 0, 2061, 2062, + 7, 20, 0, 0, 2062, 2063, 7, 10, 0, 0, 2063, 2064, 7, 7, 0, 0, 2064, 216, + 1, 0, 0, 0, 2065, 2066, 7, 29, 0, 0, 2066, 2067, 7, 20, 0, 0, 2067, 2068, + 7, 10, 0, 0, 2068, 2069, 7, 13, 0, 0, 2069, 2070, 7, 10, 0, 0, 2070, 218, + 1, 0, 0, 0, 2071, 2072, 7, 29, 0, 0, 2072, 2073, 7, 17, 0, 0, 2073, 2074, + 7, 7, 0, 0, 2074, 2075, 7, 12, 0, 0, 2075, 2076, 7, 19, 0, 0, 2076, 2077, + 7, 29, 0, 0, 2077, 220, 1, 0, 0, 0, 2078, 2079, 7, 29, 0, 0, 2079, 2080, + 7, 17, 0, 0, 2080, 2081, 7, 16, 0, 0, 2081, 2082, 7, 20, 0, 0, 2082, 222, + 1, 0, 0, 0, 2083, 2084, 7, 5, 0, 0, 2084, 2085, 7, 22, 0, 0, 2085, 2086, + 7, 16, 0, 0, 2086, 2087, 7, 20, 0, 0, 2087, 2088, 7, 19, 0, 0, 2088, 2089, + 7, 13, 0, 0, 2089, 2090, 7, 17, 0, 0, 2090, 2091, 7, 11, 0, 0, 2091, 2092, + 7, 5, 0, 0, 2092, 2093, 7, 16, 0, 0, 2093, 2094, 7, 17, 0, 0, 2094, 2095, + 7, 19, 0, 0, 2095, 2096, 7, 7, 0, 0, 2096, 224, 1, 0, 0, 0, 2097, 2098, + 7, 18, 0, 0, 2098, 2099, 7, 17, 0, 0, 2099, 2100, 7, 7, 0, 0, 2100, 2101, + 7, 5, 0, 0, 2101, 2102, 7, 13, 0, 0, 2102, 2103, 7, 8, 0, 0, 2103, 226, + 1, 0, 0, 0, 2104, 2105, 7, 14, 0, 0, 2105, 2106, 7, 19, 0, 0, 2106, 2107, + 7, 6, 0, 0, 2107, 2108, 7, 6, 0, 0, 2108, 2109, 7, 5, 0, 0, 2109, 2110, + 7, 16, 0, 0, 2110, 2111, 7, 17, 0, 0, 2111, 2112, 7, 19, 0, 0, 2112, 2113, + 7, 7, 0, 0, 2113, 228, 1, 0, 0, 0, 2114, 2115, 7, 14, 0, 0, 2115, 2116, + 7, 19, 0, 0, 2116, 2117, 7, 7, 0, 0, 2117, 2118, 7, 14, 0, 0, 2118, 2119, + 7, 22, 0, 0, 2119, 2120, 7, 13, 0, 0, 2120, 2121, 7, 13, 0, 0, 2121, 2122, + 7, 10, 0, 0, 2122, 2123, 7, 7, 0, 0, 2123, 2124, 7, 16, 0, 0, 2124, 2125, + 7, 6, 0, 0, 2125, 2126, 7, 8, 0, 0, 2126, 230, 1, 0, 0, 0, 2127, 2128, + 7, 14, 0, 0, 2128, 2129, 7, 13, 0, 0, 2129, 2130, 7, 19, 0, 0, 2130, 2131, + 7, 9, 0, 0, 2131, 2132, 7, 9, 0, 0, 2132, 232, 1, 0, 0, 0, 2133, 2134, + 7, 14, 0, 0, 2134, 2135, 7, 22, 0, 0, 2135, 2136, 7, 13, 0, 0, 2136, 2137, + 7, 13, 0, 0, 2137, 2138, 7, 10, 0, 0, 2138, 2139, 7, 7, 0, 0, 2139, 2140, + 7, 16, 0, 0, 2140, 2141, 5, 95, 0, 0, 2141, 2142, 7, 9, 0, 0, 2142, 2143, + 7, 14, 0, 0, 2143, 2144, 7, 20, 0, 0, 2144, 2145, 7, 10, 0, 0, 2145, 2146, + 7, 15, 0, 0, 2146, 2147, 7, 5, 0, 0, 2147, 234, 1, 0, 0, 0, 2148, 2149, + 7, 25, 0, 0, 2149, 2150, 7, 13, 0, 0, 2150, 2151, 7, 10, 0, 0, 2151, 2152, + 7, 10, 0, 0, 2152, 2153, 7, 11, 0, 0, 2153, 2154, 7, 10, 0, 0, 2154, 236, + 1, 0, 0, 0, 2155, 2156, 7, 25, 0, 0, 2156, 2157, 7, 22, 0, 0, 2157, 2158, + 7, 6, 0, 0, 2158, 2159, 7, 6, 0, 0, 2159, 238, 1, 0, 0, 0, 2160, 2161, + 7, 17, 0, 0, 2161, 2162, 7, 6, 0, 0, 2162, 2163, 7, 17, 0, 0, 2163, 2164, + 7, 21, 0, 0, 2164, 2165, 7, 10, 0, 0, 2165, 240, 1, 0, 0, 0, 2166, 2167, + 7, 17, 0, 0, 2167, 2168, 7, 7, 0, 0, 2168, 2169, 7, 7, 0, 0, 2169, 2170, + 7, 10, 0, 0, 2170, 2171, 7, 13, 0, 0, 2171, 242, 1, 0, 0, 0, 2172, 2173, + 7, 17, 0, 0, 2173, 2174, 7, 9, 0, 0, 2174, 244, 1, 0, 0, 0, 2175, 2176, + 7, 17, 0, 0, 2176, 2177, 7, 9, 0, 0, 2177, 2178, 7, 7, 0, 0, 2178, 2179, + 7, 22, 0, 0, 2179, 2180, 7, 6, 0, 0, 2180, 2181, 7, 6, 0, 0, 2181, 246, + 1, 0, 0, 0, 2182, 2183, 7, 30, 0, 0, 2183, 2184, 7, 19, 0, 0, 2184, 2185, + 7, 17, 0, 0, 2185, 2186, 7, 7, 0, 0, 2186, 248, 1, 0, 0, 0, 2187, 2188, + 7, 6, 0, 0, 2188, 2189, 7, 10, 0, 0, 2189, 2190, 7, 25, 0, 0, 2190, 2191, + 7, 16, 0, 0, 2191, 250, 1, 0, 0, 0, 2192, 2193, 7, 6, 0, 0, 2193, 2194, + 7, 17, 0, 0, 2194, 2195, 7, 21, 0, 0, 2195, 2196, 7, 10, 0, 0, 2196, 252, + 1, 0, 0, 0, 2197, 2198, 7, 7, 0, 0, 2198, 2199, 7, 5, 0, 0, 2199, 2200, + 7, 16, 0, 0, 2200, 2201, 7, 22, 0, 0, 2201, 2202, 7, 13, 0, 0, 2202, 2203, + 7, 5, 0, 0, 2203, 2204, 7, 6, 0, 0, 2204, 254, 1, 0, 0, 0, 2205, 2206, + 7, 7, 0, 0, 2206, 2207, 7, 19, 0, 0, 2207, 2208, 7, 16, 0, 0, 2208, 2209, + 7, 7, 0, 0, 2209, 2210, 7, 22, 0, 0, 2210, 2211, 7, 6, 0, 0, 2211, 2212, + 7, 6, 0, 0, 2212, 256, 1, 0, 0, 0, 2213, 2214, 7, 19, 0, 0, 2214, 2215, + 7, 22, 0, 0, 2215, 2216, 7, 16, 0, 0, 2216, 2217, 7, 10, 0, 0, 2217, 2218, + 7, 13, 0, 0, 2218, 258, 1, 0, 0, 0, 2219, 2220, 7, 19, 0, 0, 2220, 2221, + 7, 27, 0, 0, 2221, 2222, 7, 10, 0, 0, 2222, 2223, 7, 13, 0, 0, 2223, 260, + 1, 0, 0, 0, 2224, 2225, 7, 19, 0, 0, 2225, 2226, 7, 27, 0, 0, 2226, 2227, + 7, 10, 0, 0, 2227, 2228, 7, 13, 0, 0, 2228, 2229, 7, 6, 0, 0, 2229, 2230, + 7, 5, 0, 0, 2230, 2231, 7, 24, 0, 0, 2231, 2232, 7, 9, 0, 0, 2232, 262, + 1, 0, 0, 0, 2233, 2234, 7, 13, 0, 0, 2234, 2235, 7, 17, 0, 0, 2235, 2236, + 7, 23, 0, 0, 2236, 2237, 7, 20, 0, 0, 2237, 2238, 7, 16, 0, 0, 2238, 264, + 1, 0, 0, 0, 2239, 2240, 7, 9, 0, 0, 2240, 2241, 7, 17, 0, 0, 2241, 2242, + 7, 15, 0, 0, 2242, 2243, 7, 17, 0, 0, 2243, 2244, 7, 6, 0, 0, 2244, 2245, + 7, 5, 0, 0, 2245, 2246, 7, 13, 0, 0, 2246, 266, 1, 0, 0, 0, 2247, 2248, + 7, 27, 0, 0, 2248, 2249, 7, 10, 0, 0, 2249, 2250, 7, 13, 0, 0, 2250, 2251, + 7, 18, 0, 0, 2251, 2252, 7, 19, 0, 0, 2252, 2253, 7, 9, 0, 0, 2253, 2254, + 7, 10, 0, 0, 2254, 268, 1, 0, 0, 0, 2255, 2256, 7, 5, 0, 0, 2256, 2257, + 7, 18, 0, 0, 2257, 2258, 7, 19, 0, 0, 2258, 2259, 7, 13, 0, 0, 2259, 2260, + 7, 16, 0, 0, 2260, 270, 1, 0, 0, 0, 2261, 2262, 7, 5, 0, 0, 2262, 2263, + 7, 18, 0, 0, 2263, 2264, 7, 9, 0, 0, 2264, 2265, 7, 19, 0, 0, 2265, 2266, + 7, 6, 0, 0, 2266, 2267, 7, 22, 0, 0, 2267, 2268, 7, 16, 0, 0, 2268, 2269, + 7, 10, 0, 0, 2269, 272, 1, 0, 0, 0, 2270, 2271, 7, 5, 0, 0, 2271, 2272, + 7, 14, 0, 0, 2272, 2273, 7, 14, 0, 0, 2273, 2274, 7, 10, 0, 0, 2274, 2275, + 7, 9, 0, 0, 2275, 2276, 7, 9, 0, 0, 2276, 274, 1, 0, 0, 0, 2277, 2278, + 7, 5, 0, 0, 2278, 2279, 7, 14, 0, 0, 2279, 2280, 7, 16, 0, 0, 2280, 2281, + 7, 17, 0, 0, 2281, 2282, 7, 19, 0, 0, 2282, 2283, 7, 7, 0, 0, 2283, 276, + 1, 0, 0, 0, 2284, 2285, 7, 5, 0, 0, 2285, 2286, 7, 12, 0, 0, 2286, 2287, + 7, 12, 0, 0, 2287, 278, 1, 0, 0, 0, 2288, 2289, 7, 5, 0, 0, 2289, 2290, + 7, 12, 0, 0, 2290, 2291, 7, 15, 0, 0, 2291, 2292, 7, 17, 0, 0, 2292, 2293, + 7, 7, 0, 0, 2293, 280, 1, 0, 0, 0, 2294, 2295, 7, 5, 0, 0, 2295, 2296, + 7, 25, 0, 0, 2296, 2297, 7, 16, 0, 0, 2297, 2298, 7, 10, 0, 0, 2298, 2299, + 7, 13, 0, 0, 2299, 282, 1, 0, 0, 0, 2300, 2301, 7, 5, 0, 0, 2301, 2302, + 7, 23, 0, 0, 2302, 2303, 7, 23, 0, 0, 2303, 2304, 7, 13, 0, 0, 2304, 2305, + 7, 10, 0, 0, 2305, 2306, 7, 23, 0, 0, 2306, 2307, 7, 5, 0, 0, 2307, 2308, + 7, 16, 0, 0, 2308, 2309, 7, 10, 0, 0, 2309, 284, 1, 0, 0, 0, 2310, 2311, + 7, 5, 0, 0, 2311, 2312, 7, 6, 0, 0, 2312, 2313, 7, 9, 0, 0, 2313, 2314, + 7, 19, 0, 0, 2314, 286, 1, 0, 0, 0, 2315, 2316, 7, 5, 0, 0, 2316, 2317, + 7, 6, 0, 0, 2317, 2318, 7, 16, 0, 0, 2318, 2319, 7, 10, 0, 0, 2319, 2320, + 7, 13, 0, 0, 2320, 288, 1, 0, 0, 0, 2321, 2322, 7, 5, 0, 0, 2322, 2323, + 7, 6, 0, 0, 2323, 2324, 7, 29, 0, 0, 2324, 2325, 7, 5, 0, 0, 2325, 2326, + 7, 8, 0, 0, 2326, 2327, 7, 9, 0, 0, 2327, 290, 1, 0, 0, 0, 2328, 2329, + 7, 5, 0, 0, 2329, 2330, 7, 9, 0, 0, 2330, 2331, 7, 9, 0, 0, 2331, 2332, + 7, 10, 0, 0, 2332, 2333, 7, 13, 0, 0, 2333, 2334, 7, 16, 0, 0, 2334, 2335, + 7, 17, 0, 0, 2335, 2336, 7, 19, 0, 0, 2336, 2337, 7, 7, 0, 0, 2337, 292, + 1, 0, 0, 0, 2338, 2339, 7, 5, 0, 0, 2339, 2340, 7, 9, 0, 0, 2340, 2341, + 7, 9, 0, 0, 2341, 2342, 7, 17, 0, 0, 2342, 2343, 7, 23, 0, 0, 2343, 2344, + 7, 7, 0, 0, 2344, 2345, 7, 15, 0, 0, 2345, 2346, 7, 10, 0, 0, 2346, 2347, + 7, 7, 0, 0, 2347, 2348, 7, 16, 0, 0, 2348, 294, 1, 0, 0, 0, 2349, 2350, + 7, 5, 0, 0, 2350, 2351, 7, 16, 0, 0, 2351, 296, 1, 0, 0, 0, 2352, 2353, + 7, 5, 0, 0, 2353, 2354, 7, 16, 0, 0, 2354, 2355, 7, 16, 0, 0, 2355, 2356, + 7, 13, 0, 0, 2356, 2357, 7, 17, 0, 0, 2357, 2358, 7, 18, 0, 0, 2358, 2359, + 7, 22, 0, 0, 2359, 2360, 7, 16, 0, 0, 2360, 2361, 7, 10, 0, 0, 2361, 298, + 1, 0, 0, 0, 2362, 2363, 7, 18, 0, 0, 2363, 2364, 7, 5, 0, 0, 2364, 2365, + 7, 14, 0, 0, 2365, 2366, 7, 21, 0, 0, 2366, 2367, 7, 29, 0, 0, 2367, 2368, + 7, 5, 0, 0, 2368, 2369, 7, 13, 0, 0, 2369, 2370, 7, 12, 0, 0, 2370, 300, + 1, 0, 0, 0, 2371, 2372, 7, 18, 0, 0, 2372, 2373, 7, 10, 0, 0, 2373, 2374, + 7, 25, 0, 0, 2374, 2375, 7, 19, 0, 0, 2375, 2376, 7, 13, 0, 0, 2376, 2377, + 7, 10, 0, 0, 2377, 302, 1, 0, 0, 0, 2378, 2379, 7, 18, 0, 0, 2379, 2380, + 7, 10, 0, 0, 2380, 2381, 7, 23, 0, 0, 2381, 2382, 7, 17, 0, 0, 2382, 2383, + 7, 7, 0, 0, 2383, 304, 1, 0, 0, 0, 2384, 2385, 7, 18, 0, 0, 2385, 2386, + 7, 8, 0, 0, 2386, 306, 1, 0, 0, 0, 2387, 2388, 7, 14, 0, 0, 2388, 2389, + 7, 5, 0, 0, 2389, 2390, 7, 14, 0, 0, 2390, 2391, 7, 20, 0, 0, 2391, 2392, + 7, 10, 0, 0, 2392, 308, 1, 0, 0, 0, 2393, 2394, 7, 14, 0, 0, 2394, 2395, + 7, 5, 0, 0, 2395, 2396, 7, 6, 0, 0, 2396, 2397, 7, 6, 0, 0, 2397, 2398, + 7, 10, 0, 0, 2398, 2399, 7, 12, 0, 0, 2399, 310, 1, 0, 0, 0, 2400, 2401, + 7, 14, 0, 0, 2401, 2402, 7, 5, 0, 0, 2402, 2403, 7, 9, 0, 0, 2403, 2404, + 7, 14, 0, 0, 2404, 2405, 7, 5, 0, 0, 2405, 2406, 7, 12, 0, 0, 2406, 2407, + 7, 10, 0, 0, 2407, 312, 1, 0, 0, 0, 2408, 2409, 7, 14, 0, 0, 2409, 2410, + 7, 5, 0, 0, 2410, 2411, 7, 9, 0, 0, 2411, 2412, 7, 14, 0, 0, 2412, 2413, + 7, 5, 0, 0, 2413, 2414, 7, 12, 0, 0, 2414, 2415, 7, 10, 0, 0, 2415, 2416, + 7, 12, 0, 0, 2416, 314, 1, 0, 0, 0, 2417, 2418, 7, 14, 0, 0, 2418, 2419, + 7, 5, 0, 0, 2419, 2420, 7, 16, 0, 0, 2420, 2421, 7, 5, 0, 0, 2421, 2422, + 7, 6, 0, 0, 2422, 2423, 7, 19, 0, 0, 2423, 2424, 7, 23, 0, 0, 2424, 316, + 1, 0, 0, 0, 2425, 2426, 7, 14, 0, 0, 2426, 2427, 7, 20, 0, 0, 2427, 2428, + 7, 5, 0, 0, 2428, 2429, 7, 17, 0, 0, 2429, 2430, 7, 7, 0, 0, 2430, 318, + 1, 0, 0, 0, 2431, 2432, 7, 14, 0, 0, 2432, 2433, 7, 20, 0, 0, 2433, 2434, + 7, 5, 0, 0, 2434, 2435, 7, 13, 0, 0, 2435, 2436, 7, 5, 0, 0, 2436, 2437, + 7, 14, 0, 0, 2437, 2438, 7, 16, 0, 0, 2438, 2439, 7, 10, 0, 0, 2439, 2440, + 7, 13, 0, 0, 2440, 2441, 7, 17, 0, 0, 2441, 2442, 7, 9, 0, 0, 2442, 2443, + 7, 16, 0, 0, 2443, 2444, 7, 17, 0, 0, 2444, 2445, 7, 14, 0, 0, 2445, 2446, + 7, 9, 0, 0, 2446, 320, 1, 0, 0, 0, 2447, 2448, 7, 14, 0, 0, 2448, 2449, + 7, 20, 0, 0, 2449, 2450, 7, 10, 0, 0, 2450, 2451, 7, 14, 0, 0, 2451, 2452, + 7, 21, 0, 0, 2452, 2453, 7, 24, 0, 0, 2453, 2454, 7, 19, 0, 0, 2454, 2455, + 7, 17, 0, 0, 2455, 2456, 7, 7, 0, 0, 2456, 2457, 7, 16, 0, 0, 2457, 322, + 1, 0, 0, 0, 2458, 2459, 7, 14, 0, 0, 2459, 2460, 7, 6, 0, 0, 2460, 2461, + 7, 5, 0, 0, 2461, 2462, 7, 9, 0, 0, 2462, 2463, 7, 9, 0, 0, 2463, 324, + 1, 0, 0, 0, 2464, 2465, 7, 14, 0, 0, 2465, 2466, 7, 6, 0, 0, 2466, 2467, + 7, 19, 0, 0, 2467, 2468, 7, 9, 0, 0, 2468, 2469, 7, 10, 0, 0, 2469, 326, + 1, 0, 0, 0, 2470, 2471, 7, 14, 0, 0, 2471, 2472, 7, 6, 0, 0, 2472, 2473, + 7, 22, 0, 0, 2473, 2474, 7, 9, 0, 0, 2474, 2475, 7, 16, 0, 0, 2475, 2476, + 7, 10, 0, 0, 2476, 2477, 7, 13, 0, 0, 2477, 328, 1, 0, 0, 0, 2478, 2479, + 7, 14, 0, 0, 2479, 2480, 7, 19, 0, 0, 2480, 2481, 7, 15, 0, 0, 2481, 2482, + 7, 15, 0, 0, 2482, 2483, 7, 10, 0, 0, 2483, 2484, 7, 7, 0, 0, 2484, 2485, + 7, 16, 0, 0, 2485, 330, 1, 0, 0, 0, 2486, 2487, 7, 14, 0, 0, 2487, 2488, + 7, 19, 0, 0, 2488, 2489, 7, 15, 0, 0, 2489, 2490, 7, 15, 0, 0, 2490, 2491, + 7, 10, 0, 0, 2491, 2492, 7, 7, 0, 0, 2492, 2493, 7, 16, 0, 0, 2493, 2494, + 7, 9, 0, 0, 2494, 332, 1, 0, 0, 0, 2495, 2496, 7, 14, 0, 0, 2496, 2497, + 7, 19, 0, 0, 2497, 2498, 7, 15, 0, 0, 2498, 2499, 7, 15, 0, 0, 2499, 2500, + 7, 17, 0, 0, 2500, 2501, 7, 16, 0, 0, 2501, 334, 1, 0, 0, 0, 2502, 2503, + 7, 14, 0, 0, 2503, 2504, 7, 19, 0, 0, 2504, 2505, 7, 15, 0, 0, 2505, 2506, + 7, 15, 0, 0, 2506, 2507, 7, 17, 0, 0, 2507, 2508, 7, 16, 0, 0, 2508, 2509, + 7, 16, 0, 0, 2509, 2510, 7, 10, 0, 0, 2510, 2511, 7, 12, 0, 0, 2511, 336, + 1, 0, 0, 0, 2512, 2513, 7, 14, 0, 0, 2513, 2514, 7, 19, 0, 0, 2514, 2515, + 7, 7, 0, 0, 2515, 2516, 7, 25, 0, 0, 2516, 2517, 7, 17, 0, 0, 2517, 2518, + 7, 23, 0, 0, 2518, 2519, 7, 22, 0, 0, 2519, 2520, 7, 13, 0, 0, 2520, 2521, + 7, 5, 0, 0, 2521, 2522, 7, 16, 0, 0, 2522, 2523, 7, 17, 0, 0, 2523, 2524, + 7, 19, 0, 0, 2524, 2525, 7, 7, 0, 0, 2525, 338, 1, 0, 0, 0, 2526, 2527, + 7, 14, 0, 0, 2527, 2528, 7, 19, 0, 0, 2528, 2529, 7, 7, 0, 0, 2529, 2530, + 7, 7, 0, 0, 2530, 2531, 7, 10, 0, 0, 2531, 2532, 7, 14, 0, 0, 2532, 2533, + 7, 16, 0, 0, 2533, 2534, 7, 17, 0, 0, 2534, 2535, 7, 19, 0, 0, 2535, 2536, + 7, 7, 0, 0, 2536, 340, 1, 0, 0, 0, 2537, 2538, 7, 14, 0, 0, 2538, 2539, + 7, 19, 0, 0, 2539, 2540, 7, 7, 0, 0, 2540, 2541, 7, 9, 0, 0, 2541, 2542, + 7, 16, 0, 0, 2542, 2543, 7, 13, 0, 0, 2543, 2544, 7, 5, 0, 0, 2544, 2545, + 7, 17, 0, 0, 2545, 2546, 7, 7, 0, 0, 2546, 2547, 7, 16, 0, 0, 2547, 2548, + 7, 9, 0, 0, 2548, 342, 1, 0, 0, 0, 2549, 2550, 7, 14, 0, 0, 2550, 2551, + 7, 19, 0, 0, 2551, 2552, 7, 7, 0, 0, 2552, 2553, 7, 16, 0, 0, 2553, 2554, + 7, 10, 0, 0, 2554, 2555, 7, 7, 0, 0, 2555, 2556, 7, 16, 0, 0, 2556, 344, + 1, 0, 0, 0, 2557, 2558, 7, 14, 0, 0, 2558, 2559, 7, 19, 0, 0, 2559, 2560, + 7, 7, 0, 0, 2560, 2561, 7, 16, 0, 0, 2561, 2562, 7, 17, 0, 0, 2562, 2563, + 7, 7, 0, 0, 2563, 2564, 7, 22, 0, 0, 2564, 2565, 7, 10, 0, 0, 2565, 346, + 1, 0, 0, 0, 2566, 2567, 7, 14, 0, 0, 2567, 2568, 7, 19, 0, 0, 2568, 2569, + 7, 7, 0, 0, 2569, 2570, 7, 27, 0, 0, 2570, 2571, 7, 10, 0, 0, 2571, 2572, + 7, 13, 0, 0, 2572, 2573, 7, 9, 0, 0, 2573, 2574, 7, 17, 0, 0, 2574, 2575, + 7, 19, 0, 0, 2575, 2576, 7, 7, 0, 0, 2576, 348, 1, 0, 0, 0, 2577, 2578, + 7, 14, 0, 0, 2578, 2579, 7, 19, 0, 0, 2579, 2580, 7, 24, 0, 0, 2580, 2581, + 7, 8, 0, 0, 2581, 350, 1, 0, 0, 0, 2582, 2583, 7, 14, 0, 0, 2583, 2584, + 7, 19, 0, 0, 2584, 2585, 7, 9, 0, 0, 2585, 2586, 7, 16, 0, 0, 2586, 352, + 1, 0, 0, 0, 2587, 2588, 7, 14, 0, 0, 2588, 2589, 7, 9, 0, 0, 2589, 2590, + 7, 27, 0, 0, 2590, 354, 1, 0, 0, 0, 2591, 2592, 7, 14, 0, 0, 2592, 2593, + 7, 22, 0, 0, 2593, 2594, 7, 13, 0, 0, 2594, 2595, 7, 9, 0, 0, 2595, 2596, + 7, 19, 0, 0, 2596, 2597, 7, 13, 0, 0, 2597, 356, 1, 0, 0, 0, 2598, 2599, + 7, 14, 0, 0, 2599, 2600, 7, 8, 0, 0, 2600, 2601, 7, 14, 0, 0, 2601, 2602, + 7, 6, 0, 0, 2602, 2603, 7, 10, 0, 0, 2603, 358, 1, 0, 0, 0, 2604, 2605, + 7, 12, 0, 0, 2605, 2606, 7, 5, 0, 0, 2606, 2607, 7, 16, 0, 0, 2607, 2608, + 7, 5, 0, 0, 2608, 360, 1, 0, 0, 0, 2609, 2610, 7, 12, 0, 0, 2610, 2611, + 7, 5, 0, 0, 2611, 2612, 7, 16, 0, 0, 2612, 2613, 7, 5, 0, 0, 2613, 2614, + 7, 18, 0, 0, 2614, 2615, 7, 5, 0, 0, 2615, 2616, 7, 9, 0, 0, 2616, 2617, + 7, 10, 0, 0, 2617, 362, 1, 0, 0, 0, 2618, 2619, 7, 12, 0, 0, 2619, 2620, + 7, 5, 0, 0, 2620, 2621, 7, 8, 0, 0, 2621, 364, 1, 0, 0, 0, 2622, 2623, + 7, 12, 0, 0, 2623, 2624, 7, 10, 0, 0, 2624, 2625, 7, 5, 0, 0, 2625, 2626, + 7, 6, 0, 0, 2626, 2627, 7, 6, 0, 0, 2627, 2628, 7, 19, 0, 0, 2628, 2629, + 7, 14, 0, 0, 2629, 2630, 7, 5, 0, 0, 2630, 2631, 7, 16, 0, 0, 2631, 2632, + 7, 10, 0, 0, 2632, 366, 1, 0, 0, 0, 2633, 2634, 7, 12, 0, 0, 2634, 2635, + 7, 10, 0, 0, 2635, 2636, 7, 14, 0, 0, 2636, 2637, 7, 6, 0, 0, 2637, 2638, + 7, 5, 0, 0, 2638, 2639, 7, 13, 0, 0, 2639, 2640, 7, 10, 0, 0, 2640, 368, + 1, 0, 0, 0, 2641, 2642, 7, 12, 0, 0, 2642, 2643, 7, 10, 0, 0, 2643, 2644, + 7, 25, 0, 0, 2644, 2645, 7, 5, 0, 0, 2645, 2646, 7, 22, 0, 0, 2646, 2647, + 7, 6, 0, 0, 2647, 2648, 7, 16, 0, 0, 2648, 2649, 7, 9, 0, 0, 2649, 370, + 1, 0, 0, 0, 2650, 2651, 7, 12, 0, 0, 2651, 2652, 7, 10, 0, 0, 2652, 2653, + 7, 25, 0, 0, 2653, 2654, 7, 10, 0, 0, 2654, 2655, 7, 13, 0, 0, 2655, 2656, + 7, 13, 0, 0, 2656, 2657, 7, 10, 0, 0, 2657, 2658, 7, 12, 0, 0, 2658, 372, + 1, 0, 0, 0, 2659, 2660, 7, 12, 0, 0, 2660, 2661, 7, 10, 0, 0, 2661, 2662, + 7, 25, 0, 0, 2662, 2663, 7, 17, 0, 0, 2663, 2664, 7, 7, 0, 0, 2664, 2665, + 7, 10, 0, 0, 2665, 2666, 7, 13, 0, 0, 2666, 374, 1, 0, 0, 0, 2667, 2668, + 7, 12, 0, 0, 2668, 2669, 7, 10, 0, 0, 2669, 2670, 7, 6, 0, 0, 2670, 2671, + 7, 10, 0, 0, 2671, 2672, 7, 16, 0, 0, 2672, 2673, 7, 10, 0, 0, 2673, 376, + 1, 0, 0, 0, 2674, 2675, 7, 12, 0, 0, 2675, 2676, 7, 10, 0, 0, 2676, 2677, + 7, 6, 0, 0, 2677, 2678, 7, 17, 0, 0, 2678, 2679, 7, 15, 0, 0, 2679, 2680, + 7, 17, 0, 0, 2680, 2681, 7, 16, 0, 0, 2681, 2682, 7, 10, 0, 0, 2682, 2683, + 7, 13, 0, 0, 2683, 378, 1, 0, 0, 0, 2684, 2685, 7, 12, 0, 0, 2685, 2686, + 7, 10, 0, 0, 2686, 2687, 7, 6, 0, 0, 2687, 2688, 7, 17, 0, 0, 2688, 2689, + 7, 15, 0, 0, 2689, 2690, 7, 17, 0, 0, 2690, 2691, 7, 16, 0, 0, 2691, 2692, + 7, 10, 0, 0, 2692, 2693, 7, 13, 0, 0, 2693, 2694, 7, 9, 0, 0, 2694, 380, + 1, 0, 0, 0, 2695, 2696, 7, 12, 0, 0, 2696, 2697, 7, 17, 0, 0, 2697, 2698, + 7, 14, 0, 0, 2698, 2699, 7, 16, 0, 0, 2699, 2700, 7, 17, 0, 0, 2700, 2701, + 7, 19, 0, 0, 2701, 2702, 7, 7, 0, 0, 2702, 2703, 7, 5, 0, 0, 2703, 2704, + 7, 13, 0, 0, 2704, 2705, 7, 8, 0, 0, 2705, 382, 1, 0, 0, 0, 2706, 2707, + 7, 12, 0, 0, 2707, 2708, 7, 17, 0, 0, 2708, 2709, 7, 9, 0, 0, 2709, 2710, + 7, 5, 0, 0, 2710, 2711, 7, 18, 0, 0, 2711, 2712, 7, 6, 0, 0, 2712, 2713, + 7, 10, 0, 0, 2713, 384, 1, 0, 0, 0, 2714, 2715, 7, 12, 0, 0, 2715, 2716, + 7, 17, 0, 0, 2716, 2717, 7, 9, 0, 0, 2717, 2718, 7, 14, 0, 0, 2718, 2719, + 7, 5, 0, 0, 2719, 2720, 7, 13, 0, 0, 2720, 2721, 7, 12, 0, 0, 2721, 386, + 1, 0, 0, 0, 2722, 2723, 7, 12, 0, 0, 2723, 2724, 7, 19, 0, 0, 2724, 2725, + 7, 14, 0, 0, 2725, 2726, 7, 22, 0, 0, 2726, 2727, 7, 15, 0, 0, 2727, 2728, + 7, 10, 0, 0, 2728, 2729, 7, 7, 0, 0, 2729, 2730, 7, 16, 0, 0, 2730, 388, + 1, 0, 0, 0, 2731, 2732, 7, 12, 0, 0, 2732, 2733, 7, 19, 0, 0, 2733, 2734, + 7, 15, 0, 0, 2734, 2735, 7, 5, 0, 0, 2735, 2736, 7, 17, 0, 0, 2736, 2737, + 7, 7, 0, 0, 2737, 390, 1, 0, 0, 0, 2738, 2739, 7, 12, 0, 0, 2739, 2740, + 7, 19, 0, 0, 2740, 2741, 7, 22, 0, 0, 2741, 2742, 7, 18, 0, 0, 2742, 2743, + 7, 6, 0, 0, 2743, 2744, 7, 10, 0, 0, 2744, 392, 1, 0, 0, 0, 2745, 2746, + 7, 12, 0, 0, 2746, 2747, 7, 13, 0, 0, 2747, 2748, 7, 19, 0, 0, 2748, 2749, + 7, 24, 0, 0, 2749, 394, 1, 0, 0, 0, 2750, 2751, 7, 10, 0, 0, 2751, 2752, + 7, 5, 0, 0, 2752, 2753, 7, 14, 0, 0, 2753, 2754, 7, 20, 0, 0, 2754, 396, + 1, 0, 0, 0, 2755, 2756, 7, 10, 0, 0, 2756, 2757, 7, 7, 0, 0, 2757, 2758, + 7, 5, 0, 0, 2758, 2759, 7, 18, 0, 0, 2759, 2760, 7, 6, 0, 0, 2760, 2761, + 7, 10, 0, 0, 2761, 398, 1, 0, 0, 0, 2762, 2763, 7, 10, 0, 0, 2763, 2764, + 7, 7, 0, 0, 2764, 2765, 7, 14, 0, 0, 2765, 2766, 7, 19, 0, 0, 2766, 2767, + 7, 12, 0, 0, 2767, 2768, 7, 17, 0, 0, 2768, 2769, 7, 7, 0, 0, 2769, 2770, + 7, 23, 0, 0, 2770, 400, 1, 0, 0, 0, 2771, 2772, 7, 10, 0, 0, 2772, 2773, + 7, 7, 0, 0, 2773, 2774, 7, 14, 0, 0, 2774, 2775, 7, 13, 0, 0, 2775, 2776, + 7, 8, 0, 0, 2776, 2777, 7, 24, 0, 0, 2777, 2778, 7, 16, 0, 0, 2778, 2779, + 7, 10, 0, 0, 2779, 2780, 7, 12, 0, 0, 2780, 402, 1, 0, 0, 0, 2781, 2782, + 7, 10, 0, 0, 2782, 2783, 7, 7, 0, 0, 2783, 2784, 7, 22, 0, 0, 2784, 2785, + 7, 15, 0, 0, 2785, 404, 1, 0, 0, 0, 2786, 2787, 7, 10, 0, 0, 2787, 2788, + 7, 9, 0, 0, 2788, 2789, 7, 14, 0, 0, 2789, 2790, 7, 5, 0, 0, 2790, 2791, + 7, 24, 0, 0, 2791, 2792, 7, 10, 0, 0, 2792, 406, 1, 0, 0, 0, 2793, 2794, + 7, 10, 0, 0, 2794, 2795, 7, 27, 0, 0, 2795, 2796, 7, 10, 0, 0, 2796, 2797, + 7, 7, 0, 0, 2797, 2798, 7, 16, 0, 0, 2798, 408, 1, 0, 0, 0, 2799, 2800, + 7, 10, 0, 0, 2800, 2801, 7, 26, 0, 0, 2801, 2802, 7, 14, 0, 0, 2802, 2803, + 7, 6, 0, 0, 2803, 2804, 7, 22, 0, 0, 2804, 2805, 7, 12, 0, 0, 2805, 2806, + 7, 10, 0, 0, 2806, 410, 1, 0, 0, 0, 2807, 2808, 7, 10, 0, 0, 2808, 2809, + 7, 26, 0, 0, 2809, 2810, 7, 14, 0, 0, 2810, 2811, 7, 6, 0, 0, 2811, 2812, + 7, 22, 0, 0, 2812, 2813, 7, 12, 0, 0, 2813, 2814, 7, 17, 0, 0, 2814, 2815, + 7, 7, 0, 0, 2815, 2816, 7, 23, 0, 0, 2816, 412, 1, 0, 0, 0, 2817, 2818, + 7, 10, 0, 0, 2818, 2819, 7, 26, 0, 0, 2819, 2820, 7, 14, 0, 0, 2820, 2821, + 7, 6, 0, 0, 2821, 2822, 7, 22, 0, 0, 2822, 2823, 7, 9, 0, 0, 2823, 2824, + 7, 17, 0, 0, 2824, 2825, 7, 27, 0, 0, 2825, 2826, 7, 10, 0, 0, 2826, 414, + 1, 0, 0, 0, 2827, 2828, 7, 10, 0, 0, 2828, 2829, 7, 26, 0, 0, 2829, 2830, + 7, 10, 0, 0, 2830, 2831, 7, 14, 0, 0, 2831, 2832, 7, 22, 0, 0, 2832, 2833, + 7, 16, 0, 0, 2833, 2834, 7, 10, 0, 0, 2834, 416, 1, 0, 0, 0, 2835, 2836, + 7, 10, 0, 0, 2836, 2837, 7, 26, 0, 0, 2837, 2838, 7, 24, 0, 0, 2838, 2839, + 7, 6, 0, 0, 2839, 2840, 7, 5, 0, 0, 2840, 2841, 7, 17, 0, 0, 2841, 2842, + 7, 7, 0, 0, 2842, 418, 1, 0, 0, 0, 2843, 2844, 7, 10, 0, 0, 2844, 2845, + 7, 26, 0, 0, 2845, 2846, 7, 16, 0, 0, 2846, 2847, 7, 10, 0, 0, 2847, 2848, + 7, 7, 0, 0, 2848, 2849, 7, 9, 0, 0, 2849, 2850, 7, 17, 0, 0, 2850, 2851, + 7, 19, 0, 0, 2851, 2852, 7, 7, 0, 0, 2852, 420, 1, 0, 0, 0, 2853, 2854, + 7, 10, 0, 0, 2854, 2855, 7, 26, 0, 0, 2855, 2856, 7, 16, 0, 0, 2856, 2857, + 7, 10, 0, 0, 2857, 2858, 7, 13, 0, 0, 2858, 2859, 7, 7, 0, 0, 2859, 2860, + 7, 5, 0, 0, 2860, 2861, 7, 6, 0, 0, 2861, 422, 1, 0, 0, 0, 2862, 2863, + 7, 25, 0, 0, 2863, 2864, 7, 5, 0, 0, 2864, 2865, 7, 15, 0, 0, 2865, 2866, + 7, 17, 0, 0, 2866, 2867, 7, 6, 0, 0, 2867, 2868, 7, 8, 0, 0, 2868, 424, + 1, 0, 0, 0, 2869, 2870, 7, 25, 0, 0, 2870, 2871, 7, 17, 0, 0, 2871, 2872, + 7, 13, 0, 0, 2872, 2873, 7, 9, 0, 0, 2873, 2874, 7, 16, 0, 0, 2874, 426, + 1, 0, 0, 0, 2875, 2876, 7, 25, 0, 0, 2876, 2877, 7, 19, 0, 0, 2877, 2878, + 7, 6, 0, 0, 2878, 2879, 7, 6, 0, 0, 2879, 2880, 7, 19, 0, 0, 2880, 2881, + 7, 29, 0, 0, 2881, 2882, 7, 17, 0, 0, 2882, 2883, 7, 7, 0, 0, 2883, 2884, + 7, 23, 0, 0, 2884, 428, 1, 0, 0, 0, 2885, 2886, 7, 25, 0, 0, 2886, 2887, + 7, 19, 0, 0, 2887, 2888, 7, 13, 0, 0, 2888, 2889, 7, 14, 0, 0, 2889, 2890, + 7, 10, 0, 0, 2890, 430, 1, 0, 0, 0, 2891, 2892, 7, 25, 0, 0, 2892, 2893, + 7, 19, 0, 0, 2893, 2894, 7, 13, 0, 0, 2894, 2895, 7, 29, 0, 0, 2895, 2896, + 7, 5, 0, 0, 2896, 2897, 7, 13, 0, 0, 2897, 2898, 7, 12, 0, 0, 2898, 432, + 1, 0, 0, 0, 2899, 2900, 7, 25, 0, 0, 2900, 2901, 7, 22, 0, 0, 2901, 2902, + 7, 7, 0, 0, 2902, 2903, 7, 14, 0, 0, 2903, 2904, 7, 16, 0, 0, 2904, 2905, + 7, 17, 0, 0, 2905, 2906, 7, 19, 0, 0, 2906, 2907, 7, 7, 0, 0, 2907, 434, + 1, 0, 0, 0, 2908, 2909, 7, 25, 0, 0, 2909, 2910, 7, 22, 0, 0, 2910, 2911, + 7, 7, 0, 0, 2911, 2912, 7, 14, 0, 0, 2912, 2913, 7, 16, 0, 0, 2913, 2914, + 7, 17, 0, 0, 2914, 2915, 7, 19, 0, 0, 2915, 2916, 7, 7, 0, 0, 2916, 2917, + 7, 9, 0, 0, 2917, 436, 1, 0, 0, 0, 2918, 2919, 7, 23, 0, 0, 2919, 2920, + 7, 6, 0, 0, 2920, 2921, 7, 19, 0, 0, 2921, 2922, 7, 18, 0, 0, 2922, 2923, + 7, 5, 0, 0, 2923, 2924, 7, 6, 0, 0, 2924, 438, 1, 0, 0, 0, 2925, 2926, + 7, 23, 0, 0, 2926, 2927, 7, 13, 0, 0, 2927, 2928, 7, 5, 0, 0, 2928, 2929, + 7, 7, 0, 0, 2929, 2930, 7, 16, 0, 0, 2930, 2931, 7, 10, 0, 0, 2931, 2932, + 7, 12, 0, 0, 2932, 440, 1, 0, 0, 0, 2933, 2934, 7, 20, 0, 0, 2934, 2935, + 7, 5, 0, 0, 2935, 2936, 7, 7, 0, 0, 2936, 2937, 7, 12, 0, 0, 2937, 2938, + 7, 6, 0, 0, 2938, 2939, 7, 10, 0, 0, 2939, 2940, 7, 13, 0, 0, 2940, 442, + 1, 0, 0, 0, 2941, 2942, 7, 20, 0, 0, 2942, 2943, 7, 10, 0, 0, 2943, 2944, + 7, 5, 0, 0, 2944, 2945, 7, 12, 0, 0, 2945, 2946, 7, 10, 0, 0, 2946, 2947, + 7, 13, 0, 0, 2947, 444, 1, 0, 0, 0, 2948, 2949, 7, 20, 0, 0, 2949, 2950, + 7, 19, 0, 0, 2950, 2951, 7, 6, 0, 0, 2951, 2952, 7, 12, 0, 0, 2952, 446, + 1, 0, 0, 0, 2953, 2954, 7, 20, 0, 0, 2954, 2955, 7, 19, 0, 0, 2955, 2956, + 7, 22, 0, 0, 2956, 2957, 7, 13, 0, 0, 2957, 448, 1, 0, 0, 0, 2958, 2959, + 7, 17, 0, 0, 2959, 2960, 7, 12, 0, 0, 2960, 2961, 7, 10, 0, 0, 2961, 2962, + 7, 7, 0, 0, 2962, 2963, 7, 16, 0, 0, 2963, 2964, 7, 17, 0, 0, 2964, 2965, + 7, 16, 0, 0, 2965, 2966, 7, 8, 0, 0, 2966, 450, 1, 0, 0, 0, 2967, 2968, + 7, 17, 0, 0, 2968, 2969, 7, 25, 0, 0, 2969, 452, 1, 0, 0, 0, 2970, 2971, + 7, 17, 0, 0, 2971, 2972, 7, 15, 0, 0, 2972, 2973, 7, 15, 0, 0, 2973, 2974, + 7, 10, 0, 0, 2974, 2975, 7, 12, 0, 0, 2975, 2976, 7, 17, 0, 0, 2976, 2977, + 7, 5, 0, 0, 2977, 2978, 7, 16, 0, 0, 2978, 2979, 7, 10, 0, 0, 2979, 454, + 1, 0, 0, 0, 2980, 2981, 7, 17, 0, 0, 2981, 2982, 7, 15, 0, 0, 2982, 2983, + 7, 15, 0, 0, 2983, 2984, 7, 22, 0, 0, 2984, 2985, 7, 16, 0, 0, 2985, 2986, + 7, 5, 0, 0, 2986, 2987, 7, 18, 0, 0, 2987, 2988, 7, 6, 0, 0, 2988, 2989, + 7, 10, 0, 0, 2989, 456, 1, 0, 0, 0, 2990, 2991, 7, 17, 0, 0, 2991, 2992, + 7, 15, 0, 0, 2992, 2993, 7, 24, 0, 0, 2993, 2994, 7, 6, 0, 0, 2994, 2995, + 7, 17, 0, 0, 2995, 2996, 7, 14, 0, 0, 2996, 2997, 7, 17, 0, 0, 2997, 2998, + 7, 16, 0, 0, 2998, 458, 1, 0, 0, 0, 2999, 3000, 7, 17, 0, 0, 3000, 3001, + 7, 7, 0, 0, 3001, 3002, 7, 14, 0, 0, 3002, 3003, 7, 6, 0, 0, 3003, 3004, + 7, 22, 0, 0, 3004, 3005, 7, 12, 0, 0, 3005, 3006, 7, 17, 0, 0, 3006, 3007, + 7, 7, 0, 0, 3007, 3008, 7, 23, 0, 0, 3008, 460, 1, 0, 0, 0, 3009, 3010, + 7, 17, 0, 0, 3010, 3011, 7, 7, 0, 0, 3011, 3012, 7, 14, 0, 0, 3012, 3013, + 7, 13, 0, 0, 3013, 3014, 7, 10, 0, 0, 3014, 3015, 7, 15, 0, 0, 3015, 3016, + 7, 10, 0, 0, 3016, 3017, 7, 7, 0, 0, 3017, 3018, 7, 16, 0, 0, 3018, 462, + 1, 0, 0, 0, 3019, 3020, 7, 17, 0, 0, 3020, 3021, 7, 7, 0, 0, 3021, 3022, + 7, 12, 0, 0, 3022, 3023, 7, 10, 0, 0, 3023, 3024, 7, 26, 0, 0, 3024, 464, + 1, 0, 0, 0, 3025, 3026, 7, 17, 0, 0, 3026, 3027, 7, 7, 0, 0, 3027, 3028, + 7, 12, 0, 0, 3028, 3029, 7, 10, 0, 0, 3029, 3030, 7, 26, 0, 0, 3030, 3031, + 7, 10, 0, 0, 3031, 3032, 7, 9, 0, 0, 3032, 466, 1, 0, 0, 0, 3033, 3034, + 7, 17, 0, 0, 3034, 3035, 7, 7, 0, 0, 3035, 3036, 7, 20, 0, 0, 3036, 3037, + 7, 10, 0, 0, 3037, 3038, 7, 13, 0, 0, 3038, 3039, 7, 17, 0, 0, 3039, 3040, + 7, 16, 0, 0, 3040, 468, 1, 0, 0, 0, 3041, 3042, 7, 17, 0, 0, 3042, 3043, + 7, 7, 0, 0, 3043, 3044, 7, 20, 0, 0, 3044, 3045, 7, 10, 0, 0, 3045, 3046, + 7, 13, 0, 0, 3046, 3047, 7, 17, 0, 0, 3047, 3048, 7, 16, 0, 0, 3048, 3049, + 7, 9, 0, 0, 3049, 470, 1, 0, 0, 0, 3050, 3051, 7, 17, 0, 0, 3051, 3052, + 7, 7, 0, 0, 3052, 3053, 7, 6, 0, 0, 3053, 3054, 7, 17, 0, 0, 3054, 3055, + 7, 7, 0, 0, 3055, 3056, 7, 10, 0, 0, 3056, 472, 1, 0, 0, 0, 3057, 3058, + 7, 17, 0, 0, 3058, 3059, 7, 7, 0, 0, 3059, 3060, 7, 9, 0, 0, 3060, 3061, + 7, 10, 0, 0, 3061, 3062, 7, 7, 0, 0, 3062, 3063, 7, 9, 0, 0, 3063, 3064, + 7, 17, 0, 0, 3064, 3065, 7, 16, 0, 0, 3065, 3066, 7, 17, 0, 0, 3066, 3067, + 7, 27, 0, 0, 3067, 3068, 7, 10, 0, 0, 3068, 474, 1, 0, 0, 0, 3069, 3070, + 7, 17, 0, 0, 3070, 3071, 7, 7, 0, 0, 3071, 3072, 7, 9, 0, 0, 3072, 3073, + 7, 10, 0, 0, 3073, 3074, 7, 13, 0, 0, 3074, 3075, 7, 16, 0, 0, 3075, 476, + 1, 0, 0, 0, 3076, 3077, 7, 17, 0, 0, 3077, 3078, 7, 7, 0, 0, 3078, 3079, + 7, 9, 0, 0, 3079, 3080, 7, 16, 0, 0, 3080, 3081, 7, 10, 0, 0, 3081, 3082, + 7, 5, 0, 0, 3082, 3083, 7, 12, 0, 0, 3083, 478, 1, 0, 0, 0, 3084, 3085, + 7, 17, 0, 0, 3085, 3086, 7, 7, 0, 0, 3086, 3087, 7, 27, 0, 0, 3087, 3088, + 7, 19, 0, 0, 3088, 3089, 7, 21, 0, 0, 3089, 3090, 7, 10, 0, 0, 3090, 3091, + 7, 13, 0, 0, 3091, 480, 1, 0, 0, 0, 3092, 3093, 7, 17, 0, 0, 3093, 3094, + 7, 9, 0, 0, 3094, 3095, 7, 19, 0, 0, 3095, 3096, 7, 6, 0, 0, 3096, 3097, + 7, 5, 0, 0, 3097, 3098, 7, 16, 0, 0, 3098, 3099, 7, 17, 0, 0, 3099, 3100, + 7, 19, 0, 0, 3100, 3101, 7, 7, 0, 0, 3101, 482, 1, 0, 0, 0, 3102, 3103, + 7, 21, 0, 0, 3103, 3104, 7, 10, 0, 0, 3104, 3105, 7, 8, 0, 0, 3105, 484, + 1, 0, 0, 0, 3106, 3107, 7, 6, 0, 0, 3107, 3108, 7, 5, 0, 0, 3108, 3109, + 7, 18, 0, 0, 3109, 3110, 7, 10, 0, 0, 3110, 3111, 7, 6, 0, 0, 3111, 486, + 1, 0, 0, 0, 3112, 3113, 7, 6, 0, 0, 3113, 3114, 7, 5, 0, 0, 3114, 3115, + 7, 7, 0, 0, 3115, 3116, 7, 23, 0, 0, 3116, 3117, 7, 22, 0, 0, 3117, 3118, + 7, 5, 0, 0, 3118, 3119, 7, 23, 0, 0, 3119, 3120, 7, 10, 0, 0, 3120, 488, + 1, 0, 0, 0, 3121, 3122, 7, 6, 0, 0, 3122, 3123, 7, 5, 0, 0, 3123, 3124, + 7, 13, 0, 0, 3124, 3125, 7, 23, 0, 0, 3125, 3126, 7, 10, 0, 0, 3126, 490, + 1, 0, 0, 0, 3127, 3128, 7, 6, 0, 0, 3128, 3129, 7, 5, 0, 0, 3129, 3130, + 7, 9, 0, 0, 3130, 3131, 7, 16, 0, 0, 3131, 492, 1, 0, 0, 0, 3132, 3133, + 7, 6, 0, 0, 3133, 3134, 7, 10, 0, 0, 3134, 3135, 7, 5, 0, 0, 3135, 3136, + 7, 21, 0, 0, 3136, 3137, 7, 24, 0, 0, 3137, 3138, 7, 13, 0, 0, 3138, 3139, + 7, 19, 0, 0, 3139, 3140, 7, 19, 0, 0, 3140, 3141, 7, 25, 0, 0, 3141, 494, + 1, 0, 0, 0, 3142, 3143, 7, 6, 0, 0, 3143, 3144, 7, 10, 0, 0, 3144, 3145, + 7, 27, 0, 0, 3145, 3146, 7, 10, 0, 0, 3146, 3147, 7, 6, 0, 0, 3147, 496, + 1, 0, 0, 0, 3148, 3149, 7, 6, 0, 0, 3149, 3150, 7, 17, 0, 0, 3150, 3151, + 7, 9, 0, 0, 3151, 3152, 7, 16, 0, 0, 3152, 3153, 7, 10, 0, 0, 3153, 3154, + 7, 7, 0, 0, 3154, 498, 1, 0, 0, 0, 3155, 3156, 7, 6, 0, 0, 3156, 3157, + 7, 19, 0, 0, 3157, 3158, 7, 5, 0, 0, 3158, 3159, 7, 12, 0, 0, 3159, 500, + 1, 0, 0, 0, 3160, 3161, 7, 6, 0, 0, 3161, 3162, 7, 19, 0, 0, 3162, 3163, + 7, 14, 0, 0, 3163, 3164, 7, 5, 0, 0, 3164, 3165, 7, 6, 0, 0, 3165, 502, + 1, 0, 0, 0, 3166, 3167, 7, 6, 0, 0, 3167, 3168, 7, 19, 0, 0, 3168, 3169, + 7, 14, 0, 0, 3169, 3170, 7, 5, 0, 0, 3170, 3171, 7, 16, 0, 0, 3171, 3172, + 7, 17, 0, 0, 3172, 3173, 7, 19, 0, 0, 3173, 3174, 7, 7, 0, 0, 3174, 504, + 1, 0, 0, 0, 3175, 3176, 7, 6, 0, 0, 3176, 3177, 7, 19, 0, 0, 3177, 3178, + 7, 14, 0, 0, 3178, 3179, 7, 21, 0, 0, 3179, 506, 1, 0, 0, 0, 3180, 3181, + 7, 15, 0, 0, 3181, 3182, 7, 5, 0, 0, 3182, 3183, 7, 24, 0, 0, 3183, 3184, + 7, 24, 0, 0, 3184, 3185, 7, 17, 0, 0, 3185, 3186, 7, 7, 0, 0, 3186, 3187, + 7, 23, 0, 0, 3187, 508, 1, 0, 0, 0, 3188, 3189, 7, 15, 0, 0, 3189, 3190, + 7, 5, 0, 0, 3190, 3191, 7, 16, 0, 0, 3191, 3192, 7, 14, 0, 0, 3192, 3193, + 7, 20, 0, 0, 3193, 510, 1, 0, 0, 0, 3194, 3195, 7, 15, 0, 0, 3195, 3196, + 7, 5, 0, 0, 3196, 3197, 7, 16, 0, 0, 3197, 3198, 7, 14, 0, 0, 3198, 3199, + 7, 20, 0, 0, 3199, 3200, 7, 10, 0, 0, 3200, 3201, 7, 12, 0, 0, 3201, 512, + 1, 0, 0, 0, 3202, 3203, 7, 15, 0, 0, 3203, 3204, 7, 5, 0, 0, 3204, 3205, + 7, 16, 0, 0, 3205, 3206, 7, 10, 0, 0, 3206, 3207, 7, 13, 0, 0, 3207, 3208, + 7, 17, 0, 0, 3208, 3209, 7, 5, 0, 0, 3209, 3210, 7, 6, 0, 0, 3210, 3211, + 7, 17, 0, 0, 3211, 3212, 7, 11, 0, 0, 3212, 3213, 7, 10, 0, 0, 3213, 3214, + 7, 12, 0, 0, 3214, 514, 1, 0, 0, 0, 3215, 3216, 7, 15, 0, 0, 3216, 3217, + 7, 5, 0, 0, 3217, 3218, 7, 26, 0, 0, 3218, 3219, 7, 27, 0, 0, 3219, 3220, + 7, 5, 0, 0, 3220, 3221, 7, 6, 0, 0, 3221, 3222, 7, 22, 0, 0, 3222, 3223, + 7, 10, 0, 0, 3223, 516, 1, 0, 0, 0, 3224, 3225, 7, 15, 0, 0, 3225, 3226, + 7, 10, 0, 0, 3226, 3227, 7, 13, 0, 0, 3227, 3228, 7, 23, 0, 0, 3228, 3229, + 7, 10, 0, 0, 3229, 518, 1, 0, 0, 0, 3230, 3231, 7, 15, 0, 0, 3231, 3232, + 7, 17, 0, 0, 3232, 3233, 7, 7, 0, 0, 3233, 3234, 7, 22, 0, 0, 3234, 3235, + 7, 16, 0, 0, 3235, 3236, 7, 10, 0, 0, 3236, 520, 1, 0, 0, 0, 3237, 3238, + 7, 15, 0, 0, 3238, 3239, 7, 17, 0, 0, 3239, 3240, 7, 7, 0, 0, 3240, 3241, + 7, 27, 0, 0, 3241, 3242, 7, 5, 0, 0, 3242, 3243, 7, 6, 0, 0, 3243, 3244, + 7, 22, 0, 0, 3244, 3245, 7, 10, 0, 0, 3245, 522, 1, 0, 0, 0, 3246, 3247, + 7, 15, 0, 0, 3247, 3248, 7, 19, 0, 0, 3248, 3249, 7, 12, 0, 0, 3249, 3250, + 7, 10, 0, 0, 3250, 524, 1, 0, 0, 0, 3251, 3252, 7, 15, 0, 0, 3252, 3253, + 7, 19, 0, 0, 3253, 3254, 7, 7, 0, 0, 3254, 3255, 7, 16, 0, 0, 3255, 3256, + 7, 20, 0, 0, 3256, 526, 1, 0, 0, 0, 3257, 3258, 7, 15, 0, 0, 3258, 3259, + 7, 19, 0, 0, 3259, 3260, 7, 27, 0, 0, 3260, 3261, 7, 10, 0, 0, 3261, 528, + 1, 0, 0, 0, 3262, 3263, 7, 7, 0, 0, 3263, 3264, 7, 5, 0, 0, 3264, 3265, + 7, 15, 0, 0, 3265, 3266, 7, 10, 0, 0, 3266, 530, 1, 0, 0, 0, 3267, 3268, + 7, 7, 0, 0, 3268, 3269, 7, 5, 0, 0, 3269, 3270, 7, 15, 0, 0, 3270, 3271, + 7, 10, 0, 0, 3271, 3272, 7, 9, 0, 0, 3272, 532, 1, 0, 0, 0, 3273, 3274, + 7, 7, 0, 0, 3274, 3275, 7, 10, 0, 0, 3275, 3276, 7, 26, 0, 0, 3276, 3277, + 7, 16, 0, 0, 3277, 534, 1, 0, 0, 0, 3278, 3279, 7, 7, 0, 0, 3279, 3280, + 7, 19, 0, 0, 3280, 536, 1, 0, 0, 0, 3281, 3282, 7, 7, 0, 0, 3282, 3283, + 7, 19, 0, 0, 3283, 3284, 7, 16, 0, 0, 3284, 3285, 7, 20, 0, 0, 3285, 3286, + 7, 17, 0, 0, 3286, 3287, 7, 7, 0, 0, 3287, 3288, 7, 23, 0, 0, 3288, 538, + 1, 0, 0, 0, 3289, 3290, 7, 7, 0, 0, 3290, 3291, 7, 19, 0, 0, 3291, 3292, + 7, 16, 0, 0, 3292, 3293, 7, 17, 0, 0, 3293, 3294, 7, 25, 0, 0, 3294, 3295, + 7, 8, 0, 0, 3295, 540, 1, 0, 0, 0, 3296, 3297, 7, 7, 0, 0, 3297, 3298, + 7, 19, 0, 0, 3298, 3299, 7, 29, 0, 0, 3299, 3300, 7, 5, 0, 0, 3300, 3301, + 7, 17, 0, 0, 3301, 3302, 7, 16, 0, 0, 3302, 542, 1, 0, 0, 0, 3303, 3304, + 7, 7, 0, 0, 3304, 3305, 7, 22, 0, 0, 3305, 3306, 7, 6, 0, 0, 3306, 3307, + 7, 6, 0, 0, 3307, 3308, 7, 9, 0, 0, 3308, 544, 1, 0, 0, 0, 3309, 3310, + 7, 19, 0, 0, 3310, 3311, 7, 18, 0, 0, 3311, 3312, 7, 30, 0, 0, 3312, 3313, + 7, 10, 0, 0, 3313, 3314, 7, 14, 0, 0, 3314, 3315, 7, 16, 0, 0, 3315, 546, + 1, 0, 0, 0, 3316, 3317, 7, 19, 0, 0, 3317, 3318, 7, 25, 0, 0, 3318, 548, + 1, 0, 0, 0, 3319, 3320, 7, 19, 0, 0, 3320, 3321, 7, 25, 0, 0, 3321, 3322, + 7, 25, 0, 0, 3322, 550, 1, 0, 0, 0, 3323, 3324, 7, 19, 0, 0, 3324, 3325, + 7, 17, 0, 0, 3325, 3326, 7, 12, 0, 0, 3326, 3327, 7, 9, 0, 0, 3327, 552, + 1, 0, 0, 0, 3328, 3329, 7, 19, 0, 0, 3329, 3330, 7, 24, 0, 0, 3330, 3331, + 7, 10, 0, 0, 3331, 3332, 7, 13, 0, 0, 3332, 3333, 7, 5, 0, 0, 3333, 3334, + 7, 16, 0, 0, 3334, 3335, 7, 19, 0, 0, 3335, 3336, 7, 13, 0, 0, 3336, 554, + 1, 0, 0, 0, 3337, 3338, 7, 19, 0, 0, 3338, 3339, 7, 24, 0, 0, 3339, 3340, + 7, 16, 0, 0, 3340, 3341, 7, 17, 0, 0, 3341, 3342, 7, 19, 0, 0, 3342, 3343, + 7, 7, 0, 0, 3343, 556, 1, 0, 0, 0, 3344, 3345, 7, 19, 0, 0, 3345, 3346, + 7, 24, 0, 0, 3346, 3347, 7, 16, 0, 0, 3347, 3348, 7, 17, 0, 0, 3348, 3349, + 7, 19, 0, 0, 3349, 3350, 7, 7, 0, 0, 3350, 3351, 7, 9, 0, 0, 3351, 558, + 1, 0, 0, 0, 3352, 3353, 7, 19, 0, 0, 3353, 3354, 7, 29, 0, 0, 3354, 3355, + 7, 7, 0, 0, 3355, 3356, 7, 10, 0, 0, 3356, 3357, 7, 12, 0, 0, 3357, 560, + 1, 0, 0, 0, 3358, 3359, 7, 19, 0, 0, 3359, 3360, 7, 29, 0, 0, 3360, 3361, + 7, 7, 0, 0, 3361, 3362, 7, 10, 0, 0, 3362, 3363, 7, 13, 0, 0, 3363, 562, + 1, 0, 0, 0, 3364, 3365, 7, 24, 0, 0, 3365, 3366, 7, 5, 0, 0, 3366, 3367, + 7, 13, 0, 0, 3367, 3368, 7, 9, 0, 0, 3368, 3369, 7, 10, 0, 0, 3369, 3370, + 7, 13, 0, 0, 3370, 564, 1, 0, 0, 0, 3371, 3372, 7, 24, 0, 0, 3372, 3373, + 7, 5, 0, 0, 3373, 3374, 7, 13, 0, 0, 3374, 3375, 7, 16, 0, 0, 3375, 3376, + 7, 17, 0, 0, 3376, 3377, 7, 5, 0, 0, 3377, 3378, 7, 6, 0, 0, 3378, 566, + 1, 0, 0, 0, 3379, 3380, 7, 24, 0, 0, 3380, 3381, 7, 5, 0, 0, 3381, 3382, + 7, 13, 0, 0, 3382, 3383, 7, 16, 0, 0, 3383, 3384, 7, 17, 0, 0, 3384, 3385, + 7, 16, 0, 0, 3385, 3386, 7, 17, 0, 0, 3386, 3387, 7, 19, 0, 0, 3387, 3388, + 7, 7, 0, 0, 3388, 568, 1, 0, 0, 0, 3389, 3390, 7, 24, 0, 0, 3390, 3391, + 7, 5, 0, 0, 3391, 3392, 7, 9, 0, 0, 3392, 3393, 7, 9, 0, 0, 3393, 3394, + 7, 17, 0, 0, 3394, 3395, 7, 7, 0, 0, 3395, 3396, 7, 23, 0, 0, 3396, 570, + 1, 0, 0, 0, 3397, 3398, 7, 24, 0, 0, 3398, 3399, 7, 5, 0, 0, 3399, 3400, + 7, 9, 0, 0, 3400, 3401, 7, 9, 0, 0, 3401, 3402, 7, 29, 0, 0, 3402, 3403, + 7, 19, 0, 0, 3403, 3404, 7, 13, 0, 0, 3404, 3405, 7, 12, 0, 0, 3405, 572, + 1, 0, 0, 0, 3406, 3407, 7, 24, 0, 0, 3407, 3408, 7, 6, 0, 0, 3408, 3409, + 7, 5, 0, 0, 3409, 3410, 7, 7, 0, 0, 3410, 3411, 7, 9, 0, 0, 3411, 574, + 1, 0, 0, 0, 3412, 3413, 7, 24, 0, 0, 3413, 3414, 7, 13, 0, 0, 3414, 3415, + 7, 10, 0, 0, 3415, 3416, 7, 14, 0, 0, 3416, 3417, 7, 10, 0, 0, 3417, 3418, + 7, 12, 0, 0, 3418, 3419, 7, 17, 0, 0, 3419, 3420, 7, 7, 0, 0, 3420, 3421, + 7, 23, 0, 0, 3421, 576, 1, 0, 0, 0, 3422, 3423, 7, 24, 0, 0, 3423, 3424, + 7, 13, 0, 0, 3424, 3425, 7, 10, 0, 0, 3425, 3426, 7, 24, 0, 0, 3426, 3427, + 7, 5, 0, 0, 3427, 3428, 7, 13, 0, 0, 3428, 3429, 7, 10, 0, 0, 3429, 578, + 1, 0, 0, 0, 3430, 3431, 7, 24, 0, 0, 3431, 3432, 7, 13, 0, 0, 3432, 3433, + 7, 10, 0, 0, 3433, 3434, 7, 24, 0, 0, 3434, 3435, 7, 5, 0, 0, 3435, 3436, + 7, 13, 0, 0, 3436, 3437, 7, 10, 0, 0, 3437, 3438, 7, 12, 0, 0, 3438, 580, + 1, 0, 0, 0, 3439, 3440, 7, 24, 0, 0, 3440, 3441, 7, 13, 0, 0, 3441, 3442, + 7, 10, 0, 0, 3442, 3443, 7, 9, 0, 0, 3443, 3444, 7, 10, 0, 0, 3444, 3445, + 7, 13, 0, 0, 3445, 3446, 7, 27, 0, 0, 3446, 3447, 7, 10, 0, 0, 3447, 582, + 1, 0, 0, 0, 3448, 3449, 7, 24, 0, 0, 3449, 3450, 7, 13, 0, 0, 3450, 3451, + 7, 17, 0, 0, 3451, 3452, 7, 19, 0, 0, 3452, 3453, 7, 13, 0, 0, 3453, 584, + 1, 0, 0, 0, 3454, 3455, 7, 24, 0, 0, 3455, 3456, 7, 13, 0, 0, 3456, 3457, + 7, 17, 0, 0, 3457, 3458, 7, 27, 0, 0, 3458, 3459, 7, 17, 0, 0, 3459, 3460, + 7, 6, 0, 0, 3460, 3461, 7, 10, 0, 0, 3461, 3462, 7, 23, 0, 0, 3462, 3463, + 7, 10, 0, 0, 3463, 3464, 7, 9, 0, 0, 3464, 586, 1, 0, 0, 0, 3465, 3466, + 7, 24, 0, 0, 3466, 3467, 7, 13, 0, 0, 3467, 3468, 7, 19, 0, 0, 3468, 3469, + 7, 14, 0, 0, 3469, 3470, 7, 10, 0, 0, 3470, 3471, 7, 12, 0, 0, 3471, 3472, + 7, 22, 0, 0, 3472, 3473, 7, 13, 0, 0, 3473, 3474, 7, 5, 0, 0, 3474, 3475, + 7, 6, 0, 0, 3475, 588, 1, 0, 0, 0, 3476, 3477, 7, 24, 0, 0, 3477, 3478, + 7, 13, 0, 0, 3478, 3479, 7, 19, 0, 0, 3479, 3480, 7, 14, 0, 0, 3480, 3481, + 7, 10, 0, 0, 3481, 3482, 7, 12, 0, 0, 3482, 3483, 7, 22, 0, 0, 3483, 3484, + 7, 13, 0, 0, 3484, 3485, 7, 10, 0, 0, 3485, 590, 1, 0, 0, 0, 3486, 3487, + 7, 24, 0, 0, 3487, 3488, 7, 13, 0, 0, 3488, 3489, 7, 19, 0, 0, 3489, 3490, + 7, 23, 0, 0, 3490, 3491, 7, 13, 0, 0, 3491, 3492, 7, 5, 0, 0, 3492, 3493, + 7, 15, 0, 0, 3493, 592, 1, 0, 0, 0, 3494, 3495, 7, 28, 0, 0, 3495, 3496, + 7, 22, 0, 0, 3496, 3497, 7, 19, 0, 0, 3497, 3498, 7, 16, 0, 0, 3498, 3499, + 7, 10, 0, 0, 3499, 594, 1, 0, 0, 0, 3500, 3501, 7, 13, 0, 0, 3501, 3502, + 7, 5, 0, 0, 3502, 3503, 7, 7, 0, 0, 3503, 3504, 7, 23, 0, 0, 3504, 3505, + 7, 10, 0, 0, 3505, 596, 1, 0, 0, 0, 3506, 3507, 7, 13, 0, 0, 3507, 3508, + 7, 10, 0, 0, 3508, 3509, 7, 5, 0, 0, 3509, 3510, 7, 12, 0, 0, 3510, 598, + 1, 0, 0, 0, 3511, 3512, 7, 13, 0, 0, 3512, 3513, 7, 10, 0, 0, 3513, 3514, + 7, 5, 0, 0, 3514, 3515, 7, 9, 0, 0, 3515, 3516, 7, 9, 0, 0, 3516, 3517, + 7, 17, 0, 0, 3517, 3518, 7, 23, 0, 0, 3518, 3519, 7, 7, 0, 0, 3519, 600, + 1, 0, 0, 0, 3520, 3521, 7, 13, 0, 0, 3521, 3522, 7, 10, 0, 0, 3522, 3523, + 7, 14, 0, 0, 3523, 3524, 7, 20, 0, 0, 3524, 3525, 7, 10, 0, 0, 3525, 3526, + 7, 14, 0, 0, 3526, 3527, 7, 21, 0, 0, 3527, 602, 1, 0, 0, 0, 3528, 3529, + 7, 13, 0, 0, 3529, 3530, 7, 10, 0, 0, 3530, 3531, 7, 14, 0, 0, 3531, 3532, + 7, 22, 0, 0, 3532, 3533, 7, 13, 0, 0, 3533, 3534, 7, 9, 0, 0, 3534, 3535, + 7, 17, 0, 0, 3535, 3536, 7, 27, 0, 0, 3536, 3537, 7, 10, 0, 0, 3537, 604, + 1, 0, 0, 0, 3538, 3539, 7, 13, 0, 0, 3539, 3540, 7, 10, 0, 0, 3540, 3541, + 7, 25, 0, 0, 3541, 606, 1, 0, 0, 0, 3542, 3543, 7, 13, 0, 0, 3543, 3544, + 7, 10, 0, 0, 3544, 3545, 7, 25, 0, 0, 3545, 3546, 7, 13, 0, 0, 3546, 3547, + 7, 10, 0, 0, 3547, 3548, 7, 9, 0, 0, 3548, 3549, 7, 20, 0, 0, 3549, 608, + 1, 0, 0, 0, 3550, 3551, 7, 13, 0, 0, 3551, 3552, 7, 10, 0, 0, 3552, 3553, + 7, 17, 0, 0, 3553, 3554, 7, 7, 0, 0, 3554, 3555, 7, 12, 0, 0, 3555, 3556, + 7, 10, 0, 0, 3556, 3557, 7, 26, 0, 0, 3557, 610, 1, 0, 0, 0, 3558, 3559, + 7, 13, 0, 0, 3559, 3560, 7, 10, 0, 0, 3560, 3561, 7, 6, 0, 0, 3561, 3562, + 7, 5, 0, 0, 3562, 3563, 7, 16, 0, 0, 3563, 3564, 7, 17, 0, 0, 3564, 3565, + 7, 27, 0, 0, 3565, 3566, 7, 10, 0, 0, 3566, 612, 1, 0, 0, 0, 3567, 3568, + 7, 13, 0, 0, 3568, 3569, 7, 10, 0, 0, 3569, 3570, 7, 6, 0, 0, 3570, 3571, + 7, 10, 0, 0, 3571, 3572, 7, 5, 0, 0, 3572, 3573, 7, 9, 0, 0, 3573, 3574, + 7, 10, 0, 0, 3574, 614, 1, 0, 0, 0, 3575, 3576, 7, 13, 0, 0, 3576, 3577, + 7, 10, 0, 0, 3577, 3578, 7, 7, 0, 0, 3578, 3579, 7, 5, 0, 0, 3579, 3580, + 7, 15, 0, 0, 3580, 3581, 7, 10, 0, 0, 3581, 616, 1, 0, 0, 0, 3582, 3583, + 7, 13, 0, 0, 3583, 3584, 7, 10, 0, 0, 3584, 3585, 7, 24, 0, 0, 3585, 3586, + 7, 10, 0, 0, 3586, 3587, 7, 5, 0, 0, 3587, 3588, 7, 16, 0, 0, 3588, 3589, + 7, 5, 0, 0, 3589, 3590, 7, 18, 0, 0, 3590, 3591, 7, 6, 0, 0, 3591, 3592, + 7, 10, 0, 0, 3592, 618, 1, 0, 0, 0, 3593, 3594, 7, 13, 0, 0, 3594, 3595, + 7, 10, 0, 0, 3595, 3596, 7, 24, 0, 0, 3596, 3597, 7, 6, 0, 0, 3597, 3598, + 7, 5, 0, 0, 3598, 3599, 7, 14, 0, 0, 3599, 3600, 7, 10, 0, 0, 3600, 620, + 1, 0, 0, 0, 3601, 3602, 7, 13, 0, 0, 3602, 3603, 7, 10, 0, 0, 3603, 3604, + 7, 24, 0, 0, 3604, 3605, 7, 6, 0, 0, 3605, 3606, 7, 17, 0, 0, 3606, 3607, + 7, 14, 0, 0, 3607, 3608, 7, 5, 0, 0, 3608, 622, 1, 0, 0, 0, 3609, 3610, + 7, 13, 0, 0, 3610, 3611, 7, 10, 0, 0, 3611, 3612, 7, 9, 0, 0, 3612, 3613, + 7, 10, 0, 0, 3613, 3614, 7, 16, 0, 0, 3614, 624, 1, 0, 0, 0, 3615, 3616, + 7, 13, 0, 0, 3616, 3617, 7, 10, 0, 0, 3617, 3618, 7, 9, 0, 0, 3618, 3619, + 7, 16, 0, 0, 3619, 3620, 7, 5, 0, 0, 3620, 3621, 7, 13, 0, 0, 3621, 3622, + 7, 16, 0, 0, 3622, 626, 1, 0, 0, 0, 3623, 3624, 7, 13, 0, 0, 3624, 3625, + 7, 10, 0, 0, 3625, 3626, 7, 9, 0, 0, 3626, 3627, 7, 16, 0, 0, 3627, 3628, + 7, 13, 0, 0, 3628, 3629, 7, 17, 0, 0, 3629, 3630, 7, 14, 0, 0, 3630, 3631, + 7, 16, 0, 0, 3631, 628, 1, 0, 0, 0, 3632, 3633, 7, 13, 0, 0, 3633, 3634, + 7, 10, 0, 0, 3634, 3635, 7, 16, 0, 0, 3635, 3636, 7, 22, 0, 0, 3636, 3637, + 7, 13, 0, 0, 3637, 3638, 7, 7, 0, 0, 3638, 3639, 7, 9, 0, 0, 3639, 630, + 1, 0, 0, 0, 3640, 3641, 7, 13, 0, 0, 3641, 3642, 7, 10, 0, 0, 3642, 3643, + 7, 27, 0, 0, 3643, 3644, 7, 19, 0, 0, 3644, 3645, 7, 21, 0, 0, 3645, 3646, + 7, 10, 0, 0, 3646, 632, 1, 0, 0, 0, 3647, 3648, 7, 13, 0, 0, 3648, 3649, + 7, 19, 0, 0, 3649, 3650, 7, 6, 0, 0, 3650, 3651, 7, 10, 0, 0, 3651, 634, + 1, 0, 0, 0, 3652, 3653, 7, 13, 0, 0, 3653, 3654, 7, 19, 0, 0, 3654, 3655, + 7, 6, 0, 0, 3655, 3656, 7, 6, 0, 0, 3656, 3657, 7, 18, 0, 0, 3657, 3658, + 7, 5, 0, 0, 3658, 3659, 7, 14, 0, 0, 3659, 3660, 7, 21, 0, 0, 3660, 636, + 1, 0, 0, 0, 3661, 3662, 7, 13, 0, 0, 3662, 3663, 7, 19, 0, 0, 3663, 3664, + 7, 29, 0, 0, 3664, 3665, 7, 9, 0, 0, 3665, 638, 1, 0, 0, 0, 3666, 3667, + 7, 13, 0, 0, 3667, 3668, 7, 22, 0, 0, 3668, 3669, 7, 6, 0, 0, 3669, 3670, + 7, 10, 0, 0, 3670, 640, 1, 0, 0, 0, 3671, 3672, 7, 9, 0, 0, 3672, 3673, + 7, 5, 0, 0, 3673, 3674, 7, 27, 0, 0, 3674, 3675, 7, 10, 0, 0, 3675, 3676, + 7, 24, 0, 0, 3676, 3677, 7, 19, 0, 0, 3677, 3678, 7, 17, 0, 0, 3678, 3679, + 7, 7, 0, 0, 3679, 3680, 7, 16, 0, 0, 3680, 642, 1, 0, 0, 0, 3681, 3682, + 7, 9, 0, 0, 3682, 3683, 7, 14, 0, 0, 3683, 3684, 7, 20, 0, 0, 3684, 3685, + 7, 10, 0, 0, 3685, 3686, 7, 15, 0, 0, 3686, 3687, 7, 5, 0, 0, 3687, 644, + 1, 0, 0, 0, 3688, 3689, 7, 9, 0, 0, 3689, 3690, 7, 14, 0, 0, 3690, 3691, + 7, 13, 0, 0, 3691, 3692, 7, 19, 0, 0, 3692, 3693, 7, 6, 0, 0, 3693, 3694, + 7, 6, 0, 0, 3694, 646, 1, 0, 0, 0, 3695, 3696, 7, 9, 0, 0, 3696, 3697, + 7, 10, 0, 0, 3697, 3698, 7, 5, 0, 0, 3698, 3699, 7, 13, 0, 0, 3699, 3700, + 7, 14, 0, 0, 3700, 3701, 7, 20, 0, 0, 3701, 648, 1, 0, 0, 0, 3702, 3703, + 7, 9, 0, 0, 3703, 3704, 7, 10, 0, 0, 3704, 3705, 7, 14, 0, 0, 3705, 3706, + 7, 19, 0, 0, 3706, 3707, 7, 7, 0, 0, 3707, 3708, 7, 12, 0, 0, 3708, 650, + 1, 0, 0, 0, 3709, 3710, 7, 9, 0, 0, 3710, 3711, 7, 10, 0, 0, 3711, 3712, + 7, 14, 0, 0, 3712, 3713, 7, 22, 0, 0, 3713, 3714, 7, 13, 0, 0, 3714, 3715, + 7, 17, 0, 0, 3715, 3716, 7, 16, 0, 0, 3716, 3717, 7, 8, 0, 0, 3717, 652, + 1, 0, 0, 0, 3718, 3719, 7, 9, 0, 0, 3719, 3720, 7, 10, 0, 0, 3720, 3721, + 7, 28, 0, 0, 3721, 3722, 7, 22, 0, 0, 3722, 3723, 7, 10, 0, 0, 3723, 3724, + 7, 7, 0, 0, 3724, 3725, 7, 14, 0, 0, 3725, 3726, 7, 10, 0, 0, 3726, 654, + 1, 0, 0, 0, 3727, 3728, 7, 9, 0, 0, 3728, 3729, 7, 10, 0, 0, 3729, 3730, + 7, 28, 0, 0, 3730, 3731, 7, 22, 0, 0, 3731, 3732, 7, 10, 0, 0, 3732, 3733, + 7, 7, 0, 0, 3733, 3734, 7, 14, 0, 0, 3734, 3735, 7, 10, 0, 0, 3735, 3736, + 7, 9, 0, 0, 3736, 656, 1, 0, 0, 0, 3737, 3738, 7, 9, 0, 0, 3738, 3739, + 7, 10, 0, 0, 3739, 3740, 7, 13, 0, 0, 3740, 3741, 7, 17, 0, 0, 3741, 3742, + 7, 5, 0, 0, 3742, 3743, 7, 6, 0, 0, 3743, 3744, 7, 17, 0, 0, 3744, 3745, + 7, 11, 0, 0, 3745, 3746, 7, 5, 0, 0, 3746, 3747, 7, 18, 0, 0, 3747, 3748, + 7, 6, 0, 0, 3748, 3749, 7, 10, 0, 0, 3749, 658, 1, 0, 0, 0, 3750, 3751, + 7, 9, 0, 0, 3751, 3752, 7, 10, 0, 0, 3752, 3753, 7, 13, 0, 0, 3753, 3754, + 7, 27, 0, 0, 3754, 3755, 7, 10, 0, 0, 3755, 3756, 7, 13, 0, 0, 3756, 660, + 1, 0, 0, 0, 3757, 3758, 7, 9, 0, 0, 3758, 3759, 7, 10, 0, 0, 3759, 3760, + 7, 9, 0, 0, 3760, 3761, 7, 9, 0, 0, 3761, 3762, 7, 17, 0, 0, 3762, 3763, + 7, 19, 0, 0, 3763, 3764, 7, 7, 0, 0, 3764, 662, 1, 0, 0, 0, 3765, 3766, + 7, 9, 0, 0, 3766, 3767, 7, 10, 0, 0, 3767, 3768, 7, 16, 0, 0, 3768, 664, + 1, 0, 0, 0, 3769, 3770, 7, 9, 0, 0, 3770, 3771, 7, 20, 0, 0, 3771, 3772, + 7, 5, 0, 0, 3772, 3773, 7, 13, 0, 0, 3773, 3774, 7, 10, 0, 0, 3774, 666, + 1, 0, 0, 0, 3775, 3776, 7, 9, 0, 0, 3776, 3777, 7, 20, 0, 0, 3777, 3778, + 7, 19, 0, 0, 3778, 3779, 7, 29, 0, 0, 3779, 668, 1, 0, 0, 0, 3780, 3781, + 7, 9, 0, 0, 3781, 3782, 7, 17, 0, 0, 3782, 3783, 7, 15, 0, 0, 3783, 3784, + 7, 24, 0, 0, 3784, 3785, 7, 6, 0, 0, 3785, 3786, 7, 10, 0, 0, 3786, 670, + 1, 0, 0, 0, 3787, 3788, 7, 9, 0, 0, 3788, 3789, 7, 7, 0, 0, 3789, 3790, + 7, 5, 0, 0, 3790, 3791, 7, 24, 0, 0, 3791, 3792, 7, 9, 0, 0, 3792, 3793, + 7, 20, 0, 0, 3793, 3794, 7, 19, 0, 0, 3794, 3795, 7, 16, 0, 0, 3795, 672, + 1, 0, 0, 0, 3796, 3797, 7, 9, 0, 0, 3797, 3798, 7, 16, 0, 0, 3798, 3799, + 7, 5, 0, 0, 3799, 3800, 7, 18, 0, 0, 3800, 3801, 7, 6, 0, 0, 3801, 3802, + 7, 10, 0, 0, 3802, 674, 1, 0, 0, 0, 3803, 3804, 7, 9, 0, 0, 3804, 3805, + 7, 16, 0, 0, 3805, 3806, 7, 5, 0, 0, 3806, 3807, 7, 7, 0, 0, 3807, 3808, + 7, 12, 0, 0, 3808, 3809, 7, 5, 0, 0, 3809, 3810, 7, 6, 0, 0, 3810, 3811, + 7, 19, 0, 0, 3811, 3812, 7, 7, 0, 0, 3812, 3813, 7, 10, 0, 0, 3813, 676, + 1, 0, 0, 0, 3814, 3815, 7, 9, 0, 0, 3815, 3816, 7, 16, 0, 0, 3816, 3817, + 7, 5, 0, 0, 3817, 3818, 7, 13, 0, 0, 3818, 3819, 7, 16, 0, 0, 3819, 678, + 1, 0, 0, 0, 3820, 3821, 7, 9, 0, 0, 3821, 3822, 7, 16, 0, 0, 3822, 3823, + 7, 5, 0, 0, 3823, 3824, 7, 16, 0, 0, 3824, 3825, 7, 10, 0, 0, 3825, 3826, + 7, 15, 0, 0, 3826, 3827, 7, 10, 0, 0, 3827, 3828, 7, 7, 0, 0, 3828, 3829, + 7, 16, 0, 0, 3829, 680, 1, 0, 0, 0, 3830, 3831, 7, 9, 0, 0, 3831, 3832, + 7, 16, 0, 0, 3832, 3833, 7, 5, 0, 0, 3833, 3834, 7, 16, 0, 0, 3834, 3835, + 7, 17, 0, 0, 3835, 3836, 7, 9, 0, 0, 3836, 3837, 7, 16, 0, 0, 3837, 3838, + 7, 17, 0, 0, 3838, 3839, 7, 14, 0, 0, 3839, 3840, 7, 9, 0, 0, 3840, 682, + 1, 0, 0, 0, 3841, 3842, 7, 9, 0, 0, 3842, 3843, 7, 16, 0, 0, 3843, 3844, + 7, 12, 0, 0, 3844, 3845, 7, 17, 0, 0, 3845, 3846, 7, 7, 0, 0, 3846, 684, + 1, 0, 0, 0, 3847, 3848, 7, 9, 0, 0, 3848, 3849, 7, 16, 0, 0, 3849, 3850, + 7, 12, 0, 0, 3850, 3851, 7, 19, 0, 0, 3851, 3852, 7, 22, 0, 0, 3852, 3853, + 7, 16, 0, 0, 3853, 686, 1, 0, 0, 0, 3854, 3855, 7, 9, 0, 0, 3855, 3856, + 7, 16, 0, 0, 3856, 3857, 7, 19, 0, 0, 3857, 3858, 7, 13, 0, 0, 3858, 3859, + 7, 5, 0, 0, 3859, 3860, 7, 23, 0, 0, 3860, 3861, 7, 10, 0, 0, 3861, 688, + 1, 0, 0, 0, 3862, 3863, 7, 9, 0, 0, 3863, 3864, 7, 16, 0, 0, 3864, 3865, + 7, 13, 0, 0, 3865, 3866, 7, 17, 0, 0, 3866, 3867, 7, 14, 0, 0, 3867, 3868, + 7, 16, 0, 0, 3868, 690, 1, 0, 0, 0, 3869, 3870, 7, 9, 0, 0, 3870, 3871, + 7, 16, 0, 0, 3871, 3872, 7, 13, 0, 0, 3872, 3873, 7, 17, 0, 0, 3873, 3874, + 7, 24, 0, 0, 3874, 692, 1, 0, 0, 0, 3875, 3876, 7, 9, 0, 0, 3876, 3877, + 7, 8, 0, 0, 3877, 3878, 7, 9, 0, 0, 3878, 3879, 7, 17, 0, 0, 3879, 3880, + 7, 12, 0, 0, 3880, 694, 1, 0, 0, 0, 3881, 3882, 7, 9, 0, 0, 3882, 3883, + 7, 8, 0, 0, 3883, 3884, 7, 9, 0, 0, 3884, 3885, 7, 16, 0, 0, 3885, 3886, + 7, 10, 0, 0, 3886, 3887, 7, 15, 0, 0, 3887, 696, 1, 0, 0, 0, 3888, 3889, + 7, 16, 0, 0, 3889, 3890, 7, 5, 0, 0, 3890, 3891, 7, 18, 0, 0, 3891, 3892, + 7, 6, 0, 0, 3892, 3893, 7, 10, 0, 0, 3893, 3894, 7, 9, 0, 0, 3894, 698, + 1, 0, 0, 0, 3895, 3896, 7, 16, 0, 0, 3896, 3897, 7, 5, 0, 0, 3897, 3898, + 7, 18, 0, 0, 3898, 3899, 7, 6, 0, 0, 3899, 3900, 7, 10, 0, 0, 3900, 3901, + 7, 9, 0, 0, 3901, 3902, 7, 24, 0, 0, 3902, 3903, 7, 5, 0, 0, 3903, 3904, + 7, 14, 0, 0, 3904, 3905, 7, 10, 0, 0, 3905, 700, 1, 0, 0, 0, 3906, 3907, + 7, 16, 0, 0, 3907, 3908, 7, 10, 0, 0, 3908, 3909, 7, 15, 0, 0, 3909, 3910, + 7, 24, 0, 0, 3910, 702, 1, 0, 0, 0, 3911, 3912, 7, 16, 0, 0, 3912, 3913, + 7, 10, 0, 0, 3913, 3914, 7, 15, 0, 0, 3914, 3915, 7, 24, 0, 0, 3915, 3916, + 7, 6, 0, 0, 3916, 3917, 7, 5, 0, 0, 3917, 3918, 7, 16, 0, 0, 3918, 3919, + 7, 10, 0, 0, 3919, 704, 1, 0, 0, 0, 3920, 3921, 7, 16, 0, 0, 3921, 3922, + 7, 10, 0, 0, 3922, 3923, 7, 15, 0, 0, 3923, 3924, 7, 24, 0, 0, 3924, 3925, + 7, 19, 0, 0, 3925, 3926, 7, 13, 0, 0, 3926, 3927, 7, 5, 0, 0, 3927, 3928, + 7, 13, 0, 0, 3928, 3929, 7, 8, 0, 0, 3929, 706, 1, 0, 0, 0, 3930, 3931, + 7, 16, 0, 0, 3931, 3932, 7, 10, 0, 0, 3932, 3933, 7, 26, 0, 0, 3933, 3934, + 7, 16, 0, 0, 3934, 708, 1, 0, 0, 0, 3935, 3936, 7, 16, 0, 0, 3936, 3937, + 7, 13, 0, 0, 3937, 3938, 7, 5, 0, 0, 3938, 3939, 7, 7, 0, 0, 3939, 3940, + 7, 9, 0, 0, 3940, 3941, 7, 5, 0, 0, 3941, 3942, 7, 14, 0, 0, 3942, 3943, + 7, 16, 0, 0, 3943, 3944, 7, 17, 0, 0, 3944, 3945, 7, 19, 0, 0, 3945, 3946, + 7, 7, 0, 0, 3946, 710, 1, 0, 0, 0, 3947, 3948, 7, 16, 0, 0, 3948, 3949, + 7, 13, 0, 0, 3949, 3950, 7, 17, 0, 0, 3950, 3951, 7, 23, 0, 0, 3951, 3952, + 7, 23, 0, 0, 3952, 3953, 7, 10, 0, 0, 3953, 3954, 7, 13, 0, 0, 3954, 712, + 1, 0, 0, 0, 3955, 3956, 7, 16, 0, 0, 3956, 3957, 7, 13, 0, 0, 3957, 3958, + 7, 22, 0, 0, 3958, 3959, 7, 7, 0, 0, 3959, 3960, 7, 14, 0, 0, 3960, 3961, + 7, 5, 0, 0, 3961, 3962, 7, 16, 0, 0, 3962, 3963, 7, 10, 0, 0, 3963, 714, + 1, 0, 0, 0, 3964, 3965, 7, 16, 0, 0, 3965, 3966, 7, 13, 0, 0, 3966, 3967, + 7, 22, 0, 0, 3967, 3968, 7, 9, 0, 0, 3968, 3969, 7, 16, 0, 0, 3969, 3970, + 7, 10, 0, 0, 3970, 3971, 7, 12, 0, 0, 3971, 716, 1, 0, 0, 0, 3972, 3973, + 7, 16, 0, 0, 3973, 3974, 7, 8, 0, 0, 3974, 3975, 7, 24, 0, 0, 3975, 3976, + 7, 10, 0, 0, 3976, 718, 1, 0, 0, 0, 3977, 3978, 7, 16, 0, 0, 3978, 3979, + 7, 8, 0, 0, 3979, 3980, 7, 24, 0, 0, 3980, 3981, 7, 10, 0, 0, 3981, 3982, + 7, 9, 0, 0, 3982, 720, 1, 0, 0, 0, 3983, 3984, 7, 22, 0, 0, 3984, 3985, + 7, 7, 0, 0, 3985, 3986, 7, 18, 0, 0, 3986, 3987, 7, 19, 0, 0, 3987, 3988, + 7, 22, 0, 0, 3988, 3989, 7, 7, 0, 0, 3989, 3990, 7, 12, 0, 0, 3990, 3991, + 7, 10, 0, 0, 3991, 3992, 7, 12, 0, 0, 3992, 722, 1, 0, 0, 0, 3993, 3994, + 7, 22, 0, 0, 3994, 3995, 7, 7, 0, 0, 3995, 3996, 7, 14, 0, 0, 3996, 3997, + 7, 19, 0, 0, 3997, 3998, 7, 15, 0, 0, 3998, 3999, 7, 15, 0, 0, 3999, 4000, + 7, 17, 0, 0, 4000, 4001, 7, 16, 0, 0, 4001, 4002, 7, 16, 0, 0, 4002, 4003, + 7, 10, 0, 0, 4003, 4004, 7, 12, 0, 0, 4004, 724, 1, 0, 0, 0, 4005, 4006, + 7, 22, 0, 0, 4006, 4007, 7, 7, 0, 0, 4007, 4008, 7, 10, 0, 0, 4008, 4009, + 7, 7, 0, 0, 4009, 4010, 7, 14, 0, 0, 4010, 4011, 7, 13, 0, 0, 4011, 4012, + 7, 8, 0, 0, 4012, 4013, 7, 24, 0, 0, 4013, 4014, 7, 16, 0, 0, 4014, 4015, + 7, 10, 0, 0, 4015, 4016, 7, 12, 0, 0, 4016, 726, 1, 0, 0, 0, 4017, 4018, + 7, 22, 0, 0, 4018, 4019, 7, 7, 0, 0, 4019, 4020, 7, 21, 0, 0, 4020, 4021, + 7, 7, 0, 0, 4021, 4022, 7, 19, 0, 0, 4022, 4023, 7, 29, 0, 0, 4023, 4024, + 7, 7, 0, 0, 4024, 728, 1, 0, 0, 0, 4025, 4026, 7, 22, 0, 0, 4026, 4027, + 7, 7, 0, 0, 4027, 4028, 7, 6, 0, 0, 4028, 4029, 7, 17, 0, 0, 4029, 4030, + 7, 9, 0, 0, 4030, 4031, 7, 16, 0, 0, 4031, 4032, 7, 10, 0, 0, 4032, 4033, + 7, 7, 0, 0, 4033, 730, 1, 0, 0, 0, 4034, 4035, 7, 22, 0, 0, 4035, 4036, + 7, 7, 0, 0, 4036, 4037, 7, 6, 0, 0, 4037, 4038, 7, 19, 0, 0, 4038, 4039, + 7, 23, 0, 0, 4039, 4040, 7, 23, 0, 0, 4040, 4041, 7, 10, 0, 0, 4041, 4042, + 7, 12, 0, 0, 4042, 732, 1, 0, 0, 0, 4043, 4044, 7, 22, 0, 0, 4044, 4045, + 7, 7, 0, 0, 4045, 4046, 7, 16, 0, 0, 4046, 4047, 7, 17, 0, 0, 4047, 4048, + 7, 6, 0, 0, 4048, 734, 1, 0, 0, 0, 4049, 4050, 7, 22, 0, 0, 4050, 4051, + 7, 24, 0, 0, 4051, 4052, 7, 12, 0, 0, 4052, 4053, 7, 5, 0, 0, 4053, 4054, + 7, 16, 0, 0, 4054, 4055, 7, 10, 0, 0, 4055, 736, 1, 0, 0, 0, 4056, 4057, + 7, 27, 0, 0, 4057, 4058, 7, 5, 0, 0, 4058, 4059, 7, 14, 0, 0, 4059, 4060, + 7, 22, 0, 0, 4060, 4061, 7, 22, 0, 0, 4061, 4062, 7, 15, 0, 0, 4062, 738, + 1, 0, 0, 0, 4063, 4064, 7, 27, 0, 0, 4064, 4065, 7, 5, 0, 0, 4065, 4066, + 7, 6, 0, 0, 4066, 4067, 7, 17, 0, 0, 4067, 4068, 7, 12, 0, 0, 4068, 740, + 1, 0, 0, 0, 4069, 4070, 7, 27, 0, 0, 4070, 4071, 7, 5, 0, 0, 4071, 4072, + 7, 6, 0, 0, 4072, 4073, 7, 17, 0, 0, 4073, 4074, 7, 12, 0, 0, 4074, 4075, + 7, 5, 0, 0, 4075, 4076, 7, 16, 0, 0, 4076, 4077, 7, 10, 0, 0, 4077, 742, + 1, 0, 0, 0, 4078, 4079, 7, 27, 0, 0, 4079, 4080, 7, 5, 0, 0, 4080, 4081, + 7, 6, 0, 0, 4081, 4082, 7, 17, 0, 0, 4082, 4083, 7, 12, 0, 0, 4083, 4084, + 7, 5, 0, 0, 4084, 4085, 7, 16, 0, 0, 4085, 4086, 7, 19, 0, 0, 4086, 4087, + 7, 13, 0, 0, 4087, 744, 1, 0, 0, 0, 4088, 4089, 7, 27, 0, 0, 4089, 4090, + 7, 5, 0, 0, 4090, 4091, 7, 13, 0, 0, 4091, 4092, 7, 8, 0, 0, 4092, 4093, + 7, 17, 0, 0, 4093, 4094, 7, 7, 0, 0, 4094, 4095, 7, 23, 0, 0, 4095, 746, + 1, 0, 0, 0, 4096, 4097, 7, 27, 0, 0, 4097, 4098, 7, 10, 0, 0, 4098, 4099, + 7, 13, 0, 0, 4099, 4100, 7, 9, 0, 0, 4100, 4101, 7, 17, 0, 0, 4101, 4102, + 7, 19, 0, 0, 4102, 4103, 7, 7, 0, 0, 4103, 748, 1, 0, 0, 0, 4104, 4105, + 7, 27, 0, 0, 4105, 4106, 7, 17, 0, 0, 4106, 4107, 7, 10, 0, 0, 4107, 4108, + 7, 29, 0, 0, 4108, 750, 1, 0, 0, 0, 4109, 4110, 7, 27, 0, 0, 4110, 4111, + 7, 19, 0, 0, 4111, 4112, 7, 6, 0, 0, 4112, 4113, 7, 5, 0, 0, 4113, 4114, + 7, 16, 0, 0, 4114, 4115, 7, 17, 0, 0, 4115, 4116, 7, 6, 0, 0, 4116, 4117, + 7, 10, 0, 0, 4117, 752, 1, 0, 0, 0, 4118, 4119, 7, 29, 0, 0, 4119, 4120, + 7, 20, 0, 0, 4120, 4121, 7, 17, 0, 0, 4121, 4122, 7, 16, 0, 0, 4122, 4123, + 7, 10, 0, 0, 4123, 4124, 7, 9, 0, 0, 4124, 4125, 7, 24, 0, 0, 4125, 4126, + 7, 5, 0, 0, 4126, 4127, 7, 14, 0, 0, 4127, 4128, 7, 10, 0, 0, 4128, 754, + 1, 0, 0, 0, 4129, 4130, 7, 29, 0, 0, 4130, 4131, 7, 17, 0, 0, 4131, 4132, + 7, 16, 0, 0, 4132, 4133, 7, 20, 0, 0, 4133, 4134, 7, 19, 0, 0, 4134, 4135, + 7, 22, 0, 0, 4135, 4136, 7, 16, 0, 0, 4136, 756, 1, 0, 0, 0, 4137, 4138, + 7, 29, 0, 0, 4138, 4139, 7, 19, 0, 0, 4139, 4140, 7, 13, 0, 0, 4140, 4141, + 7, 21, 0, 0, 4141, 758, 1, 0, 0, 0, 4142, 4143, 7, 29, 0, 0, 4143, 4144, + 7, 13, 0, 0, 4144, 4145, 7, 5, 0, 0, 4145, 4146, 7, 24, 0, 0, 4146, 4147, + 7, 24, 0, 0, 4147, 4148, 7, 10, 0, 0, 4148, 4149, 7, 13, 0, 0, 4149, 760, + 1, 0, 0, 0, 4150, 4151, 7, 29, 0, 0, 4151, 4152, 7, 13, 0, 0, 4152, 4153, + 7, 17, 0, 0, 4153, 4154, 7, 16, 0, 0, 4154, 4155, 7, 10, 0, 0, 4155, 762, + 1, 0, 0, 0, 4156, 4157, 7, 26, 0, 0, 4157, 4158, 7, 15, 0, 0, 4158, 4159, + 7, 6, 0, 0, 4159, 764, 1, 0, 0, 0, 4160, 4161, 7, 8, 0, 0, 4161, 4162, + 7, 10, 0, 0, 4162, 4163, 7, 5, 0, 0, 4163, 4164, 7, 13, 0, 0, 4164, 766, + 1, 0, 0, 0, 4165, 4166, 7, 8, 0, 0, 4166, 4167, 7, 10, 0, 0, 4167, 4168, + 7, 9, 0, 0, 4168, 768, 1, 0, 0, 0, 4169, 4170, 7, 11, 0, 0, 4170, 4171, + 7, 19, 0, 0, 4171, 4172, 7, 7, 0, 0, 4172, 4173, 7, 10, 0, 0, 4173, 770, + 1, 0, 0, 0, 4174, 4175, 7, 5, 0, 0, 4175, 4176, 7, 16, 0, 0, 4176, 4177, + 7, 19, 0, 0, 4177, 4178, 7, 15, 0, 0, 4178, 4179, 7, 17, 0, 0, 4179, 4180, + 7, 14, 0, 0, 4180, 772, 1, 0, 0, 0, 4181, 4182, 7, 18, 0, 0, 4182, 4183, + 7, 10, 0, 0, 4183, 4184, 7, 16, 0, 0, 4184, 4185, 7, 29, 0, 0, 4185, 4186, + 7, 10, 0, 0, 4186, 4187, 7, 10, 0, 0, 4187, 4188, 7, 7, 0, 0, 4188, 774, + 1, 0, 0, 0, 4189, 4190, 7, 18, 0, 0, 4190, 4191, 7, 17, 0, 0, 4191, 4192, + 7, 23, 0, 0, 4192, 4193, 7, 17, 0, 0, 4193, 4194, 7, 7, 0, 0, 4194, 4195, + 7, 16, 0, 0, 4195, 776, 1, 0, 0, 0, 4196, 4197, 7, 18, 0, 0, 4197, 4198, + 7, 17, 0, 0, 4198, 4199, 7, 16, 0, 0, 4199, 778, 1, 0, 0, 0, 4200, 4201, + 7, 18, 0, 0, 4201, 4202, 7, 19, 0, 0, 4202, 4203, 7, 19, 0, 0, 4203, 4204, + 7, 6, 0, 0, 4204, 4205, 7, 10, 0, 0, 4205, 4206, 7, 5, 0, 0, 4206, 4207, + 7, 7, 0, 0, 4207, 780, 1, 0, 0, 0, 4208, 4209, 7, 14, 0, 0, 4209, 4210, + 7, 20, 0, 0, 4210, 4211, 7, 5, 0, 0, 4211, 4212, 7, 13, 0, 0, 4212, 782, + 1, 0, 0, 0, 4213, 4214, 7, 14, 0, 0, 4214, 4215, 7, 20, 0, 0, 4215, 4216, + 7, 5, 0, 0, 4216, 4217, 7, 13, 0, 0, 4217, 4218, 7, 5, 0, 0, 4218, 4219, + 7, 14, 0, 0, 4219, 4220, 7, 16, 0, 0, 4220, 4221, 7, 10, 0, 0, 4221, 4222, + 7, 13, 0, 0, 4222, 784, 1, 0, 0, 0, 4223, 4224, 7, 14, 0, 0, 4224, 4225, + 7, 19, 0, 0, 4225, 4226, 7, 5, 0, 0, 4226, 4227, 7, 6, 0, 0, 4227, 4228, + 7, 10, 0, 0, 4228, 4229, 7, 9, 0, 0, 4229, 4230, 7, 14, 0, 0, 4230, 4231, + 7, 10, 0, 0, 4231, 786, 1, 0, 0, 0, 4232, 4233, 7, 12, 0, 0, 4233, 4234, + 7, 10, 0, 0, 4234, 4235, 7, 14, 0, 0, 4235, 788, 1, 0, 0, 0, 4236, 4237, + 7, 12, 0, 0, 4237, 4238, 7, 10, 0, 0, 4238, 4239, 7, 14, 0, 0, 4239, 4240, + 7, 17, 0, 0, 4240, 4241, 7, 15, 0, 0, 4241, 4242, 7, 5, 0, 0, 4242, 4243, + 7, 6, 0, 0, 4243, 790, 1, 0, 0, 0, 4244, 4245, 7, 10, 0, 0, 4245, 4246, + 7, 26, 0, 0, 4246, 4247, 7, 17, 0, 0, 4247, 4248, 7, 9, 0, 0, 4248, 4249, + 7, 16, 0, 0, 4249, 4250, 7, 9, 0, 0, 4250, 792, 1, 0, 0, 0, 4251, 4252, + 7, 10, 0, 0, 4252, 4253, 7, 26, 0, 0, 4253, 4254, 7, 16, 0, 0, 4254, 4255, + 7, 13, 0, 0, 4255, 4256, 7, 5, 0, 0, 4256, 4257, 7, 14, 0, 0, 4257, 4258, + 7, 16, 0, 0, 4258, 794, 1, 0, 0, 0, 4259, 4260, 7, 25, 0, 0, 4260, 4261, + 7, 6, 0, 0, 4261, 4262, 7, 19, 0, 0, 4262, 4263, 7, 5, 0, 0, 4263, 4264, + 7, 16, 0, 0, 4264, 796, 1, 0, 0, 0, 4265, 4266, 7, 23, 0, 0, 4266, 4267, + 7, 13, 0, 0, 4267, 4268, 7, 10, 0, 0, 4268, 4269, 7, 5, 0, 0, 4269, 4270, + 7, 16, 0, 0, 4270, 4271, 7, 10, 0, 0, 4271, 4272, 7, 9, 0, 0, 4272, 4273, + 7, 16, 0, 0, 4273, 798, 1, 0, 0, 0, 4274, 4275, 7, 17, 0, 0, 4275, 4276, + 7, 7, 0, 0, 4276, 4277, 7, 19, 0, 0, 4277, 4278, 7, 22, 0, 0, 4278, 4279, + 7, 16, 0, 0, 4279, 800, 1, 0, 0, 0, 4280, 4281, 7, 17, 0, 0, 4281, 4282, + 7, 7, 0, 0, 4282, 4283, 7, 16, 0, 0, 4283, 802, 1, 0, 0, 0, 4284, 4285, + 7, 17, 0, 0, 4285, 4286, 7, 7, 0, 0, 4286, 4287, 7, 16, 0, 0, 4287, 4288, + 7, 10, 0, 0, 4288, 4289, 7, 23, 0, 0, 4289, 4290, 7, 10, 0, 0, 4290, 4291, + 7, 13, 0, 0, 4291, 804, 1, 0, 0, 0, 4292, 4293, 7, 17, 0, 0, 4293, 4294, + 7, 7, 0, 0, 4294, 4295, 7, 16, 0, 0, 4295, 4296, 7, 10, 0, 0, 4296, 4297, + 7, 13, 0, 0, 4297, 4298, 7, 27, 0, 0, 4298, 4299, 7, 5, 0, 0, 4299, 4300, + 7, 6, 0, 0, 4300, 806, 1, 0, 0, 0, 4301, 4302, 7, 6, 0, 0, 4302, 4303, + 7, 10, 0, 0, 4303, 4304, 7, 5, 0, 0, 4304, 4305, 7, 9, 0, 0, 4305, 4306, + 7, 16, 0, 0, 4306, 808, 1, 0, 0, 0, 4307, 4308, 7, 7, 0, 0, 4308, 4309, + 7, 5, 0, 0, 4309, 4310, 7, 16, 0, 0, 4310, 4311, 7, 17, 0, 0, 4311, 4312, + 7, 19, 0, 0, 4312, 4313, 7, 7, 0, 0, 4313, 4314, 7, 5, 0, 0, 4314, 4315, + 7, 6, 0, 0, 4315, 810, 1, 0, 0, 0, 4316, 4317, 7, 7, 0, 0, 4317, 4318, + 7, 14, 0, 0, 4318, 4319, 7, 20, 0, 0, 4319, 4320, 7, 5, 0, 0, 4320, 4321, + 7, 13, 0, 0, 4321, 812, 1, 0, 0, 0, 4322, 4323, 7, 7, 0, 0, 4323, 4324, + 7, 19, 0, 0, 4324, 4325, 7, 7, 0, 0, 4325, 4326, 7, 10, 0, 0, 4326, 814, + 1, 0, 0, 0, 4327, 4328, 7, 7, 0, 0, 4328, 4329, 7, 22, 0, 0, 4329, 4330, + 7, 6, 0, 0, 4330, 4331, 7, 6, 0, 0, 4331, 4332, 7, 17, 0, 0, 4332, 4333, + 7, 25, 0, 0, 4333, 816, 1, 0, 0, 0, 4334, 4335, 7, 7, 0, 0, 4335, 4336, + 7, 22, 0, 0, 4336, 4337, 7, 15, 0, 0, 4337, 4338, 7, 10, 0, 0, 4338, 4339, + 7, 13, 0, 0, 4339, 4340, 7, 17, 0, 0, 4340, 4341, 7, 14, 0, 0, 4341, 818, + 1, 0, 0, 0, 4342, 4343, 7, 19, 0, 0, 4343, 4344, 7, 27, 0, 0, 4344, 4345, + 7, 10, 0, 0, 4345, 4346, 7, 13, 0, 0, 4346, 4347, 7, 6, 0, 0, 4347, 4348, + 7, 5, 0, 0, 4348, 4349, 7, 8, 0, 0, 4349, 820, 1, 0, 0, 0, 4350, 4351, + 7, 24, 0, 0, 4351, 4352, 7, 5, 0, 0, 4352, 4353, 7, 13, 0, 0, 4353, 4354, + 7, 5, 0, 0, 4354, 4355, 7, 15, 0, 0, 4355, 4356, 7, 10, 0, 0, 4356, 4357, + 7, 16, 0, 0, 4357, 4358, 7, 10, 0, 0, 4358, 4359, 7, 13, 0, 0, 4359, 822, + 1, 0, 0, 0, 4360, 4361, 7, 24, 0, 0, 4361, 4362, 7, 19, 0, 0, 4362, 4363, + 7, 9, 0, 0, 4363, 4364, 7, 17, 0, 0, 4364, 4365, 7, 16, 0, 0, 4365, 4366, + 7, 17, 0, 0, 4366, 4367, 7, 19, 0, 0, 4367, 4368, 7, 7, 0, 0, 4368, 824, + 1, 0, 0, 0, 4369, 4370, 7, 24, 0, 0, 4370, 4371, 7, 13, 0, 0, 4371, 4372, + 7, 10, 0, 0, 4372, 4373, 7, 14, 0, 0, 4373, 4374, 7, 17, 0, 0, 4374, 4375, + 7, 9, 0, 0, 4375, 4376, 7, 17, 0, 0, 4376, 4377, 7, 19, 0, 0, 4377, 4378, + 7, 7, 0, 0, 4378, 826, 1, 0, 0, 0, 4379, 4380, 7, 13, 0, 0, 4380, 4381, + 7, 10, 0, 0, 4381, 4382, 7, 5, 0, 0, 4382, 4383, 7, 6, 0, 0, 4383, 828, + 1, 0, 0, 0, 4384, 4385, 7, 13, 0, 0, 4385, 4386, 7, 19, 0, 0, 4386, 4387, + 7, 29, 0, 0, 4387, 830, 1, 0, 0, 0, 4388, 4389, 7, 9, 0, 0, 4389, 4390, + 7, 10, 0, 0, 4390, 4391, 7, 16, 0, 0, 4391, 4392, 7, 19, 0, 0, 4392, 4393, + 7, 25, 0, 0, 4393, 832, 1, 0, 0, 0, 4394, 4395, 7, 9, 0, 0, 4395, 4396, + 7, 15, 0, 0, 4396, 4397, 7, 5, 0, 0, 4397, 4398, 7, 6, 0, 0, 4398, 4399, + 7, 6, 0, 0, 4399, 4400, 7, 17, 0, 0, 4400, 4401, 7, 7, 0, 0, 4401, 4402, + 7, 16, 0, 0, 4402, 834, 1, 0, 0, 0, 4403, 4404, 7, 9, 0, 0, 4404, 4405, + 7, 22, 0, 0, 4405, 4406, 7, 18, 0, 0, 4406, 4407, 7, 9, 0, 0, 4407, 4408, + 7, 16, 0, 0, 4408, 4409, 7, 13, 0, 0, 4409, 4410, 7, 17, 0, 0, 4410, 4411, + 7, 7, 0, 0, 4411, 4412, 7, 23, 0, 0, 4412, 836, 1, 0, 0, 0, 4413, 4414, + 7, 16, 0, 0, 4414, 4415, 7, 17, 0, 0, 4415, 4416, 7, 15, 0, 0, 4416, 4417, + 7, 10, 0, 0, 4417, 838, 1, 0, 0, 0, 4418, 4419, 7, 16, 0, 0, 4419, 4420, + 7, 17, 0, 0, 4420, 4421, 7, 15, 0, 0, 4421, 4422, 7, 10, 0, 0, 4422, 4423, + 7, 9, 0, 0, 4423, 4424, 7, 16, 0, 0, 4424, 4425, 7, 5, 0, 0, 4425, 4426, + 7, 15, 0, 0, 4426, 4427, 7, 24, 0, 0, 4427, 840, 1, 0, 0, 0, 4428, 4429, + 7, 16, 0, 0, 4429, 4430, 7, 13, 0, 0, 4430, 4431, 7, 10, 0, 0, 4431, 4432, + 7, 5, 0, 0, 4432, 4433, 7, 16, 0, 0, 4433, 842, 1, 0, 0, 0, 4434, 4435, + 7, 16, 0, 0, 4435, 4436, 7, 13, 0, 0, 4436, 4437, 7, 17, 0, 0, 4437, 4438, + 7, 15, 0, 0, 4438, 844, 1, 0, 0, 0, 4439, 4440, 7, 27, 0, 0, 4440, 4441, + 7, 5, 0, 0, 4441, 4442, 7, 6, 0, 0, 4442, 4443, 7, 22, 0, 0, 4443, 4444, + 7, 10, 0, 0, 4444, 4445, 7, 9, 0, 0, 4445, 846, 1, 0, 0, 0, 4446, 4447, + 7, 27, 0, 0, 4447, 4448, 7, 5, 0, 0, 4448, 4449, 7, 13, 0, 0, 4449, 4450, + 7, 14, 0, 0, 4450, 4451, 7, 20, 0, 0, 4451, 4452, 7, 5, 0, 0, 4452, 4453, + 7, 13, 0, 0, 4453, 848, 1, 0, 0, 0, 4454, 4455, 7, 26, 0, 0, 4455, 4456, + 7, 15, 0, 0, 4456, 4457, 7, 6, 0, 0, 4457, 4458, 7, 5, 0, 0, 4458, 4459, + 7, 16, 0, 0, 4459, 4460, 7, 16, 0, 0, 4460, 4461, 7, 13, 0, 0, 4461, 4462, + 7, 17, 0, 0, 4462, 4463, 7, 18, 0, 0, 4463, 4464, 7, 22, 0, 0, 4464, 4465, + 7, 16, 0, 0, 4465, 4466, 7, 10, 0, 0, 4466, 4467, 7, 9, 0, 0, 4467, 850, + 1, 0, 0, 0, 4468, 4469, 7, 26, 0, 0, 4469, 4470, 7, 15, 0, 0, 4470, 4471, + 7, 6, 0, 0, 4471, 4472, 7, 14, 0, 0, 4472, 4473, 7, 19, 0, 0, 4473, 4474, + 7, 15, 0, 0, 4474, 4475, 7, 15, 0, 0, 4475, 4476, 7, 10, 0, 0, 4476, 4477, + 7, 7, 0, 0, 4477, 4478, 7, 16, 0, 0, 4478, 852, 1, 0, 0, 0, 4479, 4480, + 7, 26, 0, 0, 4480, 4481, 7, 15, 0, 0, 4481, 4482, 7, 6, 0, 0, 4482, 4483, + 7, 5, 0, 0, 4483, 4484, 7, 23, 0, 0, 4484, 4485, 7, 23, 0, 0, 4485, 854, + 1, 0, 0, 0, 4486, 4487, 7, 26, 0, 0, 4487, 4488, 7, 15, 0, 0, 4488, 4489, + 7, 6, 0, 0, 4489, 4490, 5, 95, 0, 0, 4490, 4491, 7, 17, 0, 0, 4491, 4492, + 7, 9, 0, 0, 4492, 4493, 5, 95, 0, 0, 4493, 4494, 7, 29, 0, 0, 4494, 4495, + 7, 10, 0, 0, 4495, 4496, 7, 6, 0, 0, 4496, 4497, 7, 6, 0, 0, 4497, 4498, + 5, 95, 0, 0, 4498, 4499, 7, 25, 0, 0, 4499, 4500, 7, 19, 0, 0, 4500, 4501, + 7, 13, 0, 0, 4501, 4502, 7, 15, 0, 0, 4502, 4503, 7, 10, 0, 0, 4503, 4504, + 7, 12, 0, 0, 4504, 856, 1, 0, 0, 0, 4505, 4506, 7, 26, 0, 0, 4506, 4507, + 7, 15, 0, 0, 4507, 4508, 7, 6, 0, 0, 4508, 4509, 5, 95, 0, 0, 4509, 4510, + 7, 17, 0, 0, 4510, 4511, 7, 9, 0, 0, 4511, 4512, 5, 95, 0, 0, 4512, 4513, + 7, 29, 0, 0, 4513, 4514, 7, 10, 0, 0, 4514, 4515, 7, 6, 0, 0, 4515, 4516, + 7, 6, 0, 0, 4516, 4517, 5, 95, 0, 0, 4517, 4518, 7, 25, 0, 0, 4518, 4519, + 7, 19, 0, 0, 4519, 4520, 7, 13, 0, 0, 4520, 4521, 7, 15, 0, 0, 4521, 4522, + 7, 10, 0, 0, 4522, 4523, 7, 12, 0, 0, 4523, 4524, 5, 95, 0, 0, 4524, 4525, + 7, 12, 0, 0, 4525, 4526, 7, 19, 0, 0, 4526, 4527, 7, 14, 0, 0, 4527, 4528, + 7, 22, 0, 0, 4528, 4529, 7, 15, 0, 0, 4529, 4530, 7, 10, 0, 0, 4530, 4531, + 7, 7, 0, 0, 4531, 4532, 7, 16, 0, 0, 4532, 858, 1, 0, 0, 0, 4533, 4534, + 7, 26, 0, 0, 4534, 4535, 7, 15, 0, 0, 4535, 4536, 7, 6, 0, 0, 4536, 4537, + 5, 95, 0, 0, 4537, 4538, 7, 17, 0, 0, 4538, 4539, 7, 9, 0, 0, 4539, 4540, + 5, 95, 0, 0, 4540, 4541, 7, 29, 0, 0, 4541, 4542, 7, 10, 0, 0, 4542, 4543, + 7, 6, 0, 0, 4543, 4544, 7, 6, 0, 0, 4544, 4545, 5, 95, 0, 0, 4545, 4546, + 7, 25, 0, 0, 4546, 4547, 7, 19, 0, 0, 4547, 4548, 7, 13, 0, 0, 4548, 4549, + 7, 15, 0, 0, 4549, 4550, 7, 10, 0, 0, 4550, 4551, 7, 12, 0, 0, 4551, 4552, + 5, 95, 0, 0, 4552, 4553, 7, 14, 0, 0, 4553, 4554, 7, 19, 0, 0, 4554, 4555, + 7, 7, 0, 0, 4555, 4556, 7, 16, 0, 0, 4556, 4557, 7, 10, 0, 0, 4557, 4558, + 7, 7, 0, 0, 4558, 4559, 7, 16, 0, 0, 4559, 860, 1, 0, 0, 0, 4560, 4561, + 7, 26, 0, 0, 4561, 4562, 7, 24, 0, 0, 4562, 4563, 7, 5, 0, 0, 4563, 4564, + 7, 16, 0, 0, 4564, 4565, 7, 20, 0, 0, 4565, 862, 1, 0, 0, 0, 4566, 4567, + 7, 26, 0, 0, 4567, 4568, 7, 24, 0, 0, 4568, 4569, 7, 5, 0, 0, 4569, 4570, + 7, 16, 0, 0, 4570, 4571, 7, 20, 0, 0, 4571, 4572, 5, 95, 0, 0, 4572, 4573, + 7, 10, 0, 0, 4573, 4574, 7, 26, 0, 0, 4574, 4575, 7, 17, 0, 0, 4575, 4576, + 7, 9, 0, 0, 4576, 4577, 7, 16, 0, 0, 4577, 4578, 7, 9, 0, 0, 4578, 864, + 1, 0, 0, 0, 4579, 4580, 7, 26, 0, 0, 4580, 4581, 7, 15, 0, 0, 4581, 4582, + 7, 6, 0, 0, 4582, 4583, 7, 14, 0, 0, 4583, 4584, 7, 19, 0, 0, 4584, 4585, + 7, 7, 0, 0, 4585, 4586, 7, 14, 0, 0, 4586, 4587, 7, 5, 0, 0, 4587, 4588, + 7, 16, 0, 0, 4588, 866, 1, 0, 0, 0, 4589, 4590, 7, 26, 0, 0, 4590, 4591, + 7, 15, 0, 0, 4591, 4592, 7, 6, 0, 0, 4592, 4593, 7, 10, 0, 0, 4593, 4594, + 7, 6, 0, 0, 4594, 4595, 7, 10, 0, 0, 4595, 4596, 7, 15, 0, 0, 4596, 4597, + 7, 10, 0, 0, 4597, 4598, 7, 7, 0, 0, 4598, 4599, 7, 16, 0, 0, 4599, 868, + 1, 0, 0, 0, 4600, 4601, 7, 26, 0, 0, 4601, 4602, 7, 15, 0, 0, 4602, 4603, + 7, 6, 0, 0, 4603, 4604, 7, 10, 0, 0, 4604, 4605, 7, 26, 0, 0, 4605, 4606, + 7, 17, 0, 0, 4606, 4607, 7, 9, 0, 0, 4607, 4608, 7, 16, 0, 0, 4608, 4609, + 7, 9, 0, 0, 4609, 870, 1, 0, 0, 0, 4610, 4611, 7, 26, 0, 0, 4611, 4612, + 7, 15, 0, 0, 4612, 4613, 7, 6, 0, 0, 4613, 4614, 7, 25, 0, 0, 4614, 4615, + 7, 19, 0, 0, 4615, 4616, 7, 13, 0, 0, 4616, 4617, 7, 10, 0, 0, 4617, 4618, + 7, 9, 0, 0, 4618, 4619, 7, 16, 0, 0, 4619, 872, 1, 0, 0, 0, 4620, 4621, + 7, 26, 0, 0, 4621, 4622, 7, 15, 0, 0, 4622, 4623, 7, 6, 0, 0, 4623, 4624, + 7, 24, 0, 0, 4624, 4625, 7, 5, 0, 0, 4625, 4626, 7, 13, 0, 0, 4626, 4627, + 7, 9, 0, 0, 4627, 4628, 7, 10, 0, 0, 4628, 874, 1, 0, 0, 0, 4629, 4630, + 7, 26, 0, 0, 4630, 4631, 7, 15, 0, 0, 4631, 4632, 7, 6, 0, 0, 4632, 4633, + 7, 24, 0, 0, 4633, 4634, 7, 17, 0, 0, 4634, 876, 1, 0, 0, 0, 4635, 4636, + 7, 26, 0, 0, 4636, 4637, 7, 15, 0, 0, 4637, 4638, 7, 6, 0, 0, 4638, 4639, + 7, 13, 0, 0, 4639, 4640, 7, 19, 0, 0, 4640, 4641, 7, 19, 0, 0, 4641, 4642, + 7, 16, 0, 0, 4642, 878, 1, 0, 0, 0, 4643, 4644, 7, 26, 0, 0, 4644, 4645, + 7, 15, 0, 0, 4645, 4646, 7, 6, 0, 0, 4646, 4647, 7, 9, 0, 0, 4647, 4648, + 7, 10, 0, 0, 4648, 4649, 7, 13, 0, 0, 4649, 4650, 7, 17, 0, 0, 4650, 4651, + 7, 5, 0, 0, 4651, 4652, 7, 6, 0, 0, 4652, 4653, 7, 17, 0, 0, 4653, 4654, + 7, 11, 0, 0, 4654, 4655, 7, 10, 0, 0, 4655, 880, 1, 0, 0, 0, 4656, 4657, + 7, 14, 0, 0, 4657, 4658, 7, 5, 0, 0, 4658, 4659, 7, 6, 0, 0, 4659, 4660, + 7, 6, 0, 0, 4660, 882, 1, 0, 0, 0, 4661, 4662, 7, 14, 0, 0, 4662, 4663, + 7, 22, 0, 0, 4663, 4664, 7, 13, 0, 0, 4664, 4665, 7, 13, 0, 0, 4665, 4666, + 7, 10, 0, 0, 4666, 4667, 7, 7, 0, 0, 4667, 4668, 7, 16, 0, 0, 4668, 884, + 1, 0, 0, 0, 4669, 4670, 7, 5, 0, 0, 4670, 4671, 7, 16, 0, 0, 4671, 4672, + 7, 16, 0, 0, 4672, 4673, 7, 5, 0, 0, 4673, 4674, 7, 14, 0, 0, 4674, 4675, + 7, 20, 0, 0, 4675, 886, 1, 0, 0, 0, 4676, 4677, 7, 12, 0, 0, 4677, 4678, + 7, 10, 0, 0, 4678, 4679, 7, 16, 0, 0, 4679, 4680, 7, 5, 0, 0, 4680, 4681, + 7, 14, 0, 0, 4681, 4682, 7, 20, 0, 0, 4682, 888, 1, 0, 0, 0, 4683, 4684, + 7, 10, 0, 0, 4684, 4685, 7, 26, 0, 0, 4685, 4686, 7, 24, 0, 0, 4686, 4687, + 7, 13, 0, 0, 4687, 4688, 7, 10, 0, 0, 4688, 4689, 7, 9, 0, 0, 4689, 4690, + 7, 9, 0, 0, 4690, 4691, 7, 17, 0, 0, 4691, 4692, 7, 19, 0, 0, 4692, 4693, + 7, 7, 0, 0, 4693, 890, 1, 0, 0, 0, 4694, 4695, 7, 23, 0, 0, 4695, 4696, + 7, 10, 0, 0, 4696, 4697, 7, 7, 0, 0, 4697, 4698, 7, 10, 0, 0, 4698, 4699, + 7, 13, 0, 0, 4699, 4700, 7, 5, 0, 0, 4700, 4701, 7, 16, 0, 0, 4701, 4702, + 7, 10, 0, 0, 4702, 4703, 7, 12, 0, 0, 4703, 892, 1, 0, 0, 0, 4704, 4705, + 7, 6, 0, 0, 4705, 4706, 7, 19, 0, 0, 4706, 4707, 7, 23, 0, 0, 4707, 4708, + 7, 23, 0, 0, 4708, 4709, 7, 10, 0, 0, 4709, 4710, 7, 12, 0, 0, 4710, 894, + 1, 0, 0, 0, 4711, 4712, 7, 9, 0, 0, 4712, 4713, 7, 16, 0, 0, 4713, 4714, + 7, 19, 0, 0, 4714, 4715, 7, 13, 0, 0, 4715, 4716, 7, 10, 0, 0, 4716, 4717, + 7, 12, 0, 0, 4717, 896, 1, 0, 0, 0, 4718, 4719, 7, 17, 0, 0, 4719, 4720, + 7, 7, 0, 0, 4720, 4721, 7, 14, 0, 0, 4721, 4722, 7, 6, 0, 0, 4722, 4723, + 7, 22, 0, 0, 4723, 4724, 7, 12, 0, 0, 4724, 4725, 7, 10, 0, 0, 4725, 898, + 1, 0, 0, 0, 4726, 4727, 7, 13, 0, 0, 4727, 4728, 7, 19, 0, 0, 4728, 4729, + 7, 22, 0, 0, 4729, 4730, 7, 16, 0, 0, 4730, 4731, 7, 17, 0, 0, 4731, 4732, + 7, 7, 0, 0, 4732, 4733, 7, 10, 0, 0, 4733, 900, 1, 0, 0, 0, 4734, 4735, + 7, 16, 0, 0, 4735, 4736, 7, 13, 0, 0, 4736, 4737, 7, 5, 0, 0, 4737, 4738, + 7, 7, 0, 0, 4738, 4739, 7, 9, 0, 0, 4739, 4740, 7, 25, 0, 0, 4740, 4741, + 7, 19, 0, 0, 4741, 4742, 7, 13, 0, 0, 4742, 4743, 7, 15, 0, 0, 4743, 902, + 1, 0, 0, 0, 4744, 4745, 7, 17, 0, 0, 4745, 4746, 7, 15, 0, 0, 4746, 4747, + 7, 24, 0, 0, 4747, 4748, 7, 19, 0, 0, 4748, 4749, 7, 13, 0, 0, 4749, 4750, + 7, 16, 0, 0, 4750, 904, 1, 0, 0, 0, 4751, 4752, 7, 24, 0, 0, 4752, 4753, + 7, 19, 0, 0, 4753, 4754, 7, 6, 0, 0, 4754, 4755, 7, 17, 0, 0, 4755, 4756, + 7, 14, 0, 0, 4756, 4757, 7, 8, 0, 0, 4757, 906, 1, 0, 0, 0, 4758, 4759, + 7, 15, 0, 0, 4759, 4760, 7, 10, 0, 0, 4760, 4761, 7, 16, 0, 0, 4761, 4762, + 7, 20, 0, 0, 4762, 4763, 7, 19, 0, 0, 4763, 4764, 7, 12, 0, 0, 4764, 908, + 1, 0, 0, 0, 4765, 4766, 7, 13, 0, 0, 4766, 4767, 7, 10, 0, 0, 4767, 4768, + 7, 25, 0, 0, 4768, 4769, 7, 10, 0, 0, 4769, 4770, 7, 13, 0, 0, 4770, 4771, + 7, 10, 0, 0, 4771, 4772, 7, 7, 0, 0, 4772, 4773, 7, 14, 0, 0, 4773, 4774, + 7, 17, 0, 0, 4774, 4775, 7, 7, 0, 0, 4775, 4776, 7, 23, 0, 0, 4776, 910, + 1, 0, 0, 0, 4777, 4778, 7, 7, 0, 0, 4778, 4779, 7, 10, 0, 0, 4779, 4780, + 7, 29, 0, 0, 4780, 912, 1, 0, 0, 0, 4781, 4782, 7, 19, 0, 0, 4782, 4783, + 7, 6, 0, 0, 4783, 4784, 7, 12, 0, 0, 4784, 914, 1, 0, 0, 0, 4785, 4786, + 7, 27, 0, 0, 4786, 4787, 7, 5, 0, 0, 4787, 4788, 7, 6, 0, 0, 4788, 4789, + 7, 22, 0, 0, 4789, 4790, 7, 10, 0, 0, 4790, 916, 1, 0, 0, 0, 4791, 4792, + 7, 9, 0, 0, 4792, 4793, 7, 22, 0, 0, 4793, 4794, 7, 18, 0, 0, 4794, 4795, + 7, 9, 0, 0, 4795, 4796, 7, 14, 0, 0, 4796, 4797, 7, 13, 0, 0, 4797, 4798, + 7, 17, 0, 0, 4798, 4799, 7, 24, 0, 0, 4799, 4800, 7, 16, 0, 0, 4800, 4801, + 7, 17, 0, 0, 4801, 4802, 7, 19, 0, 0, 4802, 4803, 7, 7, 0, 0, 4803, 918, + 1, 0, 0, 0, 4804, 4805, 7, 24, 0, 0, 4805, 4806, 7, 22, 0, 0, 4806, 4807, + 7, 18, 0, 0, 4807, 4808, 7, 6, 0, 0, 4808, 4809, 7, 17, 0, 0, 4809, 4810, + 7, 14, 0, 0, 4810, 4811, 7, 5, 0, 0, 4811, 4812, 7, 16, 0, 0, 4812, 4813, + 7, 17, 0, 0, 4813, 4814, 7, 19, 0, 0, 4814, 4815, 7, 7, 0, 0, 4815, 920, + 1, 0, 0, 0, 4816, 4817, 7, 19, 0, 0, 4817, 4818, 7, 22, 0, 0, 4818, 4819, + 7, 16, 0, 0, 4819, 922, 1, 0, 0, 0, 4820, 4821, 7, 10, 0, 0, 4821, 4822, + 7, 7, 0, 0, 4822, 4823, 7, 12, 0, 0, 4823, 924, 1, 0, 0, 0, 4824, 4825, + 7, 13, 0, 0, 4825, 4826, 7, 19, 0, 0, 4826, 4827, 7, 22, 0, 0, 4827, 4828, + 7, 16, 0, 0, 4828, 4829, 7, 17, 0, 0, 4829, 4830, 7, 7, 0, 0, 4830, 4831, + 7, 10, 0, 0, 4831, 4832, 7, 9, 0, 0, 4832, 926, 1, 0, 0, 0, 4833, 4834, + 7, 9, 0, 0, 4834, 4835, 7, 14, 0, 0, 4835, 4836, 7, 20, 0, 0, 4836, 4837, + 7, 10, 0, 0, 4837, 4838, 7, 15, 0, 0, 4838, 4839, 7, 5, 0, 0, 4839, 4840, + 7, 9, 0, 0, 4840, 928, 1, 0, 0, 0, 4841, 4842, 7, 24, 0, 0, 4842, 4843, + 7, 13, 0, 0, 4843, 4844, 7, 19, 0, 0, 4844, 4845, 7, 14, 0, 0, 4845, 4846, + 7, 10, 0, 0, 4846, 4847, 7, 12, 0, 0, 4847, 4848, 7, 22, 0, 0, 4848, 4849, + 7, 13, 0, 0, 4849, 4850, 7, 10, 0, 0, 4850, 4851, 7, 9, 0, 0, 4851, 930, + 1, 0, 0, 0, 4852, 4853, 7, 17, 0, 0, 4853, 4854, 7, 7, 0, 0, 4854, 4855, + 7, 24, 0, 0, 4855, 4856, 7, 22, 0, 0, 4856, 4857, 7, 16, 0, 0, 4857, 932, + 1, 0, 0, 0, 4858, 4859, 7, 9, 0, 0, 4859, 4860, 7, 22, 0, 0, 4860, 4861, + 7, 24, 0, 0, 4861, 4862, 7, 24, 0, 0, 4862, 4863, 7, 19, 0, 0, 4863, 4864, + 7, 13, 0, 0, 4864, 4865, 7, 16, 0, 0, 4865, 934, 1, 0, 0, 0, 4866, 4867, + 7, 24, 0, 0, 4867, 4868, 7, 5, 0, 0, 4868, 4869, 7, 13, 0, 0, 4869, 4870, + 7, 5, 0, 0, 4870, 4871, 7, 6, 0, 0, 4871, 4872, 7, 6, 0, 0, 4872, 4873, + 7, 10, 0, 0, 4873, 4874, 7, 6, 0, 0, 4874, 936, 1, 0, 0, 0, 4875, 4876, + 7, 9, 0, 0, 4876, 4877, 7, 28, 0, 0, 4877, 4878, 7, 6, 0, 0, 4878, 938, + 1, 0, 0, 0, 4879, 4880, 7, 12, 0, 0, 4880, 4881, 7, 10, 0, 0, 4881, 4882, + 7, 24, 0, 0, 4882, 4883, 7, 10, 0, 0, 4883, 4884, 7, 7, 0, 0, 4884, 4885, + 7, 12, 0, 0, 4885, 4886, 7, 9, 0, 0, 4886, 940, 1, 0, 0, 0, 4887, 4888, + 7, 19, 0, 0, 4888, 4889, 7, 27, 0, 0, 4889, 4890, 7, 10, 0, 0, 4890, 4891, + 7, 13, 0, 0, 4891, 4892, 7, 13, 0, 0, 4892, 4893, 7, 17, 0, 0, 4893, 4894, + 7, 12, 0, 0, 4894, 4895, 7, 17, 0, 0, 4895, 4896, 7, 7, 0, 0, 4896, 4897, + 7, 23, 0, 0, 4897, 942, 1, 0, 0, 0, 4898, 4899, 7, 14, 0, 0, 4899, 4900, + 7, 19, 0, 0, 4900, 4901, 7, 7, 0, 0, 4901, 4902, 7, 25, 0, 0, 4902, 4903, + 7, 6, 0, 0, 4903, 4904, 7, 17, 0, 0, 4904, 4905, 7, 14, 0, 0, 4905, 4906, + 7, 16, 0, 0, 4906, 944, 1, 0, 0, 0, 4907, 4908, 7, 9, 0, 0, 4908, 4909, + 7, 21, 0, 0, 4909, 4910, 7, 17, 0, 0, 4910, 4911, 7, 24, 0, 0, 4911, 946, + 1, 0, 0, 0, 4912, 4913, 7, 6, 0, 0, 4913, 4914, 7, 19, 0, 0, 4914, 4915, + 7, 14, 0, 0, 4915, 4916, 7, 21, 0, 0, 4916, 4917, 7, 10, 0, 0, 4917, 4918, + 7, 12, 0, 0, 4918, 948, 1, 0, 0, 0, 4919, 4920, 7, 16, 0, 0, 4920, 4921, + 7, 17, 0, 0, 4921, 4922, 7, 10, 0, 0, 4922, 4923, 7, 9, 0, 0, 4923, 950, + 1, 0, 0, 0, 4924, 4925, 7, 13, 0, 0, 4925, 4926, 7, 19, 0, 0, 4926, 4927, + 7, 6, 0, 0, 4927, 4928, 7, 6, 0, 0, 4928, 4929, 7, 22, 0, 0, 4929, 4930, + 7, 24, 0, 0, 4930, 952, 1, 0, 0, 0, 4931, 4932, 7, 14, 0, 0, 4932, 4933, + 7, 22, 0, 0, 4933, 4934, 7, 18, 0, 0, 4934, 4935, 7, 10, 0, 0, 4935, 954, + 1, 0, 0, 0, 4936, 4937, 7, 23, 0, 0, 4937, 4938, 7, 13, 0, 0, 4938, 4939, + 7, 19, 0, 0, 4939, 4940, 7, 22, 0, 0, 4940, 4941, 7, 24, 0, 0, 4941, 4942, + 7, 17, 0, 0, 4942, 4943, 7, 7, 0, 0, 4943, 4944, 7, 23, 0, 0, 4944, 956, + 1, 0, 0, 0, 4945, 4946, 7, 9, 0, 0, 4946, 4947, 7, 10, 0, 0, 4947, 4948, + 7, 16, 0, 0, 4948, 4949, 7, 9, 0, 0, 4949, 958, 1, 0, 0, 0, 4950, 4951, + 7, 16, 0, 0, 4951, 4952, 7, 5, 0, 0, 4952, 4953, 7, 18, 0, 0, 4953, 4954, + 7, 6, 0, 0, 4954, 4955, 7, 10, 0, 0, 4955, 4956, 7, 9, 0, 0, 4956, 4957, + 7, 5, 0, 0, 4957, 4958, 7, 15, 0, 0, 4958, 4959, 7, 24, 0, 0, 4959, 4960, + 7, 6, 0, 0, 4960, 4961, 7, 10, 0, 0, 4961, 960, 1, 0, 0, 0, 4962, 4963, + 7, 19, 0, 0, 4963, 4964, 7, 13, 0, 0, 4964, 4965, 7, 12, 0, 0, 4965, 4966, + 7, 17, 0, 0, 4966, 4967, 7, 7, 0, 0, 4967, 4968, 7, 5, 0, 0, 4968, 4969, + 7, 6, 0, 0, 4969, 4970, 7, 17, 0, 0, 4970, 4971, 7, 16, 0, 0, 4971, 4972, + 7, 8, 0, 0, 4972, 962, 1, 0, 0, 0, 4973, 4974, 7, 26, 0, 0, 4974, 4975, + 7, 15, 0, 0, 4975, 4976, 7, 6, 0, 0, 4976, 4977, 7, 16, 0, 0, 4977, 4978, + 7, 5, 0, 0, 4978, 4979, 7, 18, 0, 0, 4979, 4980, 7, 6, 0, 0, 4980, 4981, + 7, 10, 0, 0, 4981, 964, 1, 0, 0, 0, 4982, 4983, 7, 14, 0, 0, 4983, 4984, + 7, 19, 0, 0, 4984, 4985, 7, 6, 0, 0, 4985, 4986, 7, 22, 0, 0, 4986, 4987, + 7, 15, 0, 0, 4987, 4988, 7, 7, 0, 0, 4988, 4989, 7, 9, 0, 0, 4989, 966, + 1, 0, 0, 0, 4990, 4991, 7, 26, 0, 0, 4991, 4992, 7, 15, 0, 0, 4992, 4993, + 7, 6, 0, 0, 4993, 4994, 7, 7, 0, 0, 4994, 4995, 7, 5, 0, 0, 4995, 4996, + 7, 15, 0, 0, 4996, 4997, 7, 10, 0, 0, 4997, 4998, 7, 9, 0, 0, 4998, 4999, + 7, 24, 0, 0, 4999, 5000, 7, 5, 0, 0, 5000, 5001, 7, 14, 0, 0, 5001, 5002, + 7, 10, 0, 0, 5002, 5003, 7, 9, 0, 0, 5003, 968, 1, 0, 0, 0, 5004, 5005, + 7, 13, 0, 0, 5005, 5006, 7, 19, 0, 0, 5006, 5007, 7, 29, 0, 0, 5007, 5008, + 7, 16, 0, 0, 5008, 5009, 7, 8, 0, 0, 5009, 5010, 7, 24, 0, 0, 5010, 5011, + 7, 10, 0, 0, 5011, 970, 1, 0, 0, 0, 5012, 5013, 7, 7, 0, 0, 5013, 5014, + 7, 19, 0, 0, 5014, 5015, 7, 13, 0, 0, 5015, 5016, 7, 15, 0, 0, 5016, 5017, + 7, 5, 0, 0, 5017, 5018, 7, 6, 0, 0, 5018, 5019, 7, 17, 0, 0, 5019, 5020, + 7, 11, 0, 0, 5020, 5021, 7, 10, 0, 0, 5021, 5022, 7, 12, 0, 0, 5022, 972, + 1, 0, 0, 0, 5023, 5024, 7, 29, 0, 0, 5024, 5025, 7, 17, 0, 0, 5025, 5026, + 7, 16, 0, 0, 5026, 5027, 7, 20, 0, 0, 5027, 5028, 7, 17, 0, 0, 5028, 5029, + 7, 7, 0, 0, 5029, 974, 1, 0, 0, 0, 5030, 5031, 7, 25, 0, 0, 5031, 5032, + 7, 17, 0, 0, 5032, 5033, 7, 6, 0, 0, 5033, 5034, 7, 16, 0, 0, 5034, 5035, + 7, 10, 0, 0, 5035, 5036, 7, 13, 0, 0, 5036, 976, 1, 0, 0, 0, 5037, 5038, + 7, 23, 0, 0, 5038, 5039, 7, 13, 0, 0, 5039, 5040, 7, 19, 0, 0, 5040, 5041, + 7, 22, 0, 0, 5041, 5042, 7, 24, 0, 0, 5042, 5043, 7, 9, 0, 0, 5043, 978, + 1, 0, 0, 0, 5044, 5045, 7, 19, 0, 0, 5045, 5046, 7, 16, 0, 0, 5046, 5047, + 7, 20, 0, 0, 5047, 5048, 7, 10, 0, 0, 5048, 5049, 7, 13, 0, 0, 5049, 5050, + 7, 9, 0, 0, 5050, 980, 1, 0, 0, 0, 5051, 5052, 7, 7, 0, 0, 5052, 5053, + 7, 25, 0, 0, 5053, 5054, 7, 14, 0, 0, 5054, 982, 1, 0, 0, 0, 5055, 5056, + 7, 7, 0, 0, 5056, 5057, 7, 25, 0, 0, 5057, 5058, 7, 12, 0, 0, 5058, 984, + 1, 0, 0, 0, 5059, 5060, 7, 7, 0, 0, 5060, 5061, 7, 25, 0, 0, 5061, 5062, + 7, 21, 0, 0, 5062, 5063, 7, 14, 0, 0, 5063, 986, 1, 0, 0, 0, 5064, 5065, + 7, 7, 0, 0, 5065, 5066, 7, 25, 0, 0, 5066, 5067, 7, 21, 0, 0, 5067, 5068, + 7, 12, 0, 0, 5068, 988, 1, 0, 0, 0, 5069, 5070, 7, 22, 0, 0, 5070, 5071, + 7, 10, 0, 0, 5071, 5072, 7, 9, 0, 0, 5072, 5073, 7, 14, 0, 0, 5073, 5074, + 7, 5, 0, 0, 5074, 5075, 7, 24, 0, 0, 5075, 5076, 7, 10, 0, 0, 5076, 990, + 1, 0, 0, 0, 5077, 5078, 7, 27, 0, 0, 5078, 5079, 7, 17, 0, 0, 5079, 5080, + 7, 10, 0, 0, 5080, 5081, 7, 29, 0, 0, 5081, 5082, 7, 9, 0, 0, 5082, 992, + 1, 0, 0, 0, 5083, 5084, 7, 7, 0, 0, 5084, 5085, 7, 19, 0, 0, 5085, 5086, + 7, 13, 0, 0, 5086, 5087, 7, 15, 0, 0, 5087, 5088, 7, 5, 0, 0, 5088, 5089, + 7, 6, 0, 0, 5089, 5090, 7, 17, 0, 0, 5090, 5091, 7, 11, 0, 0, 5091, 5092, + 7, 10, 0, 0, 5092, 994, 1, 0, 0, 0, 5093, 5094, 7, 12, 0, 0, 5094, 5095, + 7, 22, 0, 0, 5095, 5096, 7, 15, 0, 0, 5096, 5097, 7, 24, 0, 0, 5097, 996, + 1, 0, 0, 0, 5098, 5099, 7, 24, 0, 0, 5099, 5100, 7, 13, 0, 0, 5100, 5101, + 7, 17, 0, 0, 5101, 5102, 7, 7, 0, 0, 5102, 5103, 7, 16, 0, 0, 5103, 5104, + 5, 95, 0, 0, 5104, 5105, 7, 9, 0, 0, 5105, 5106, 7, 16, 0, 0, 5106, 5107, + 7, 13, 0, 0, 5107, 5108, 7, 17, 0, 0, 5108, 5109, 7, 14, 0, 0, 5109, 5110, + 7, 16, 0, 0, 5110, 5111, 5, 95, 0, 0, 5111, 5112, 7, 24, 0, 0, 5112, 5113, + 7, 5, 0, 0, 5113, 5114, 7, 13, 0, 0, 5114, 5115, 7, 5, 0, 0, 5115, 5116, + 7, 15, 0, 0, 5116, 5117, 7, 9, 0, 0, 5117, 998, 1, 0, 0, 0, 5118, 5119, + 7, 27, 0, 0, 5119, 5120, 7, 5, 0, 0, 5120, 5121, 7, 13, 0, 0, 5121, 5122, + 7, 17, 0, 0, 5122, 5123, 7, 5, 0, 0, 5123, 5124, 7, 18, 0, 0, 5124, 5125, + 7, 6, 0, 0, 5125, 5126, 7, 10, 0, 0, 5126, 5127, 5, 95, 0, 0, 5127, 5128, + 7, 14, 0, 0, 5128, 5129, 7, 19, 0, 0, 5129, 5130, 7, 7, 0, 0, 5130, 5131, + 7, 25, 0, 0, 5131, 5132, 7, 6, 0, 0, 5132, 5133, 7, 17, 0, 0, 5133, 5134, + 7, 14, 0, 0, 5134, 5135, 7, 16, 0, 0, 5135, 1000, 1, 0, 0, 0, 5136, 5137, + 7, 10, 0, 0, 5137, 5138, 7, 13, 0, 0, 5138, 5139, 7, 13, 0, 0, 5139, 5140, + 7, 19, 0, 0, 5140, 5141, 7, 13, 0, 0, 5141, 1002, 1, 0, 0, 0, 5142, 5143, + 7, 22, 0, 0, 5143, 5144, 7, 9, 0, 0, 5144, 5145, 7, 10, 0, 0, 5145, 5146, + 5, 95, 0, 0, 5146, 5147, 7, 27, 0, 0, 5147, 5148, 7, 5, 0, 0, 5148, 5149, + 7, 13, 0, 0, 5149, 5150, 7, 17, 0, 0, 5150, 5151, 7, 5, 0, 0, 5151, 5152, + 7, 18, 0, 0, 5152, 5153, 7, 6, 0, 0, 5153, 5154, 7, 10, 0, 0, 5154, 1004, + 1, 0, 0, 0, 5155, 5156, 7, 22, 0, 0, 5156, 5157, 7, 9, 0, 0, 5157, 5158, + 7, 10, 0, 0, 5158, 5159, 5, 95, 0, 0, 5159, 5160, 7, 14, 0, 0, 5160, 5161, + 7, 19, 0, 0, 5161, 5162, 7, 6, 0, 0, 5162, 5163, 7, 22, 0, 0, 5163, 5164, + 7, 15, 0, 0, 5164, 5165, 7, 7, 0, 0, 5165, 1006, 1, 0, 0, 0, 5166, 5167, + 7, 5, 0, 0, 5167, 5168, 7, 6, 0, 0, 5168, 5169, 7, 17, 0, 0, 5169, 5170, + 7, 5, 0, 0, 5170, 5171, 7, 9, 0, 0, 5171, 1008, 1, 0, 0, 0, 5172, 5173, + 7, 14, 0, 0, 5173, 5174, 7, 19, 0, 0, 5174, 5175, 7, 7, 0, 0, 5175, 5176, + 7, 9, 0, 0, 5176, 5177, 7, 16, 0, 0, 5177, 5178, 7, 5, 0, 0, 5178, 5179, + 7, 7, 0, 0, 5179, 5180, 7, 16, 0, 0, 5180, 1010, 1, 0, 0, 0, 5181, 5182, + 7, 24, 0, 0, 5182, 5183, 7, 10, 0, 0, 5183, 5184, 7, 13, 0, 0, 5184, 5185, + 7, 25, 0, 0, 5185, 5186, 7, 19, 0, 0, 5186, 5187, 7, 13, 0, 0, 5187, 5188, + 7, 15, 0, 0, 5188, 1012, 1, 0, 0, 0, 5189, 5190, 7, 23, 0, 0, 5190, 5191, + 7, 10, 0, 0, 5191, 5192, 7, 16, 0, 0, 5192, 1014, 1, 0, 0, 0, 5193, 5194, + 7, 12, 0, 0, 5194, 5195, 7, 17, 0, 0, 5195, 5196, 7, 5, 0, 0, 5196, 5197, + 7, 23, 0, 0, 5197, 5198, 7, 7, 0, 0, 5198, 5199, 7, 19, 0, 0, 5199, 5200, + 7, 9, 0, 0, 5200, 5201, 7, 16, 0, 0, 5201, 5202, 7, 17, 0, 0, 5202, 5203, + 7, 14, 0, 0, 5203, 5204, 7, 9, 0, 0, 5204, 1016, 1, 0, 0, 0, 5205, 5206, + 7, 9, 0, 0, 5206, 5207, 7, 16, 0, 0, 5207, 5208, 7, 5, 0, 0, 5208, 5209, + 7, 14, 0, 0, 5209, 5210, 7, 21, 0, 0, 5210, 5211, 7, 10, 0, 0, 5211, 5212, + 7, 12, 0, 0, 5212, 1018, 1, 0, 0, 0, 5213, 5214, 7, 10, 0, 0, 5214, 5215, + 7, 6, 0, 0, 5215, 5216, 7, 9, 0, 0, 5216, 5217, 7, 17, 0, 0, 5217, 5218, + 7, 25, 0, 0, 5218, 1020, 1, 0, 0, 0, 5219, 5220, 7, 29, 0, 0, 5220, 5221, + 7, 20, 0, 0, 5221, 5222, 7, 17, 0, 0, 5222, 5223, 7, 6, 0, 0, 5223, 5224, + 7, 10, 0, 0, 5224, 1022, 1, 0, 0, 0, 5225, 5226, 7, 13, 0, 0, 5226, 5227, + 7, 10, 0, 0, 5227, 5228, 7, 27, 0, 0, 5228, 5229, 7, 10, 0, 0, 5229, 5230, + 7, 13, 0, 0, 5230, 5231, 7, 9, 0, 0, 5231, 5232, 7, 10, 0, 0, 5232, 1024, + 1, 0, 0, 0, 5233, 5234, 7, 25, 0, 0, 5234, 5235, 7, 19, 0, 0, 5235, 5236, + 7, 13, 0, 0, 5236, 5237, 7, 10, 0, 0, 5237, 5238, 7, 5, 0, 0, 5238, 5239, + 7, 14, 0, 0, 5239, 5240, 7, 20, 0, 0, 5240, 1026, 1, 0, 0, 0, 5241, 5242, + 7, 9, 0, 0, 5242, 5243, 7, 6, 0, 0, 5243, 5244, 7, 17, 0, 0, 5244, 5245, + 7, 14, 0, 0, 5245, 5246, 7, 10, 0, 0, 5246, 1028, 1, 0, 0, 0, 5247, 5248, + 7, 10, 0, 0, 5248, 5249, 7, 26, 0, 0, 5249, 5250, 7, 17, 0, 0, 5250, 5251, + 7, 16, 0, 0, 5251, 1030, 1, 0, 0, 0, 5252, 5253, 7, 13, 0, 0, 5253, 5254, + 7, 10, 0, 0, 5254, 5255, 7, 16, 0, 0, 5255, 5256, 7, 22, 0, 0, 5256, 5257, + 7, 13, 0, 0, 5257, 5258, 7, 7, 0, 0, 5258, 1032, 1, 0, 0, 0, 5259, 5260, + 7, 28, 0, 0, 5260, 5261, 7, 22, 0, 0, 5261, 5262, 7, 10, 0, 0, 5262, 5263, + 7, 13, 0, 0, 5263, 5264, 7, 8, 0, 0, 5264, 1034, 1, 0, 0, 0, 5265, 5266, + 7, 13, 0, 0, 5266, 5267, 7, 5, 0, 0, 5267, 5268, 7, 17, 0, 0, 5268, 5269, + 7, 9, 0, 0, 5269, 5270, 7, 10, 0, 0, 5270, 1036, 1, 0, 0, 0, 5271, 5272, + 7, 9, 0, 0, 5272, 5273, 7, 28, 0, 0, 5273, 5274, 7, 6, 0, 0, 5274, 5275, + 7, 9, 0, 0, 5275, 5276, 7, 16, 0, 0, 5276, 5277, 7, 5, 0, 0, 5277, 5278, + 7, 16, 0, 0, 5278, 5279, 7, 10, 0, 0, 5279, 1038, 1, 0, 0, 0, 5280, 5281, + 7, 12, 0, 0, 5281, 5282, 7, 10, 0, 0, 5282, 5283, 7, 18, 0, 0, 5283, 5284, + 7, 22, 0, 0, 5284, 5285, 7, 23, 0, 0, 5285, 1040, 1, 0, 0, 0, 5286, 5287, + 7, 6, 0, 0, 5287, 5288, 7, 19, 0, 0, 5288, 5289, 7, 23, 0, 0, 5289, 1042, + 1, 0, 0, 0, 5290, 5291, 7, 17, 0, 0, 5291, 5292, 7, 7, 0, 0, 5292, 5293, + 7, 25, 0, 0, 5293, 5294, 7, 19, 0, 0, 5294, 1044, 1, 0, 0, 0, 5295, 5296, + 7, 7, 0, 0, 5296, 5297, 7, 19, 0, 0, 5297, 5298, 7, 16, 0, 0, 5298, 5299, + 7, 17, 0, 0, 5299, 5300, 7, 14, 0, 0, 5300, 5301, 7, 10, 0, 0, 5301, 1046, + 1, 0, 0, 0, 5302, 5303, 7, 29, 0, 0, 5303, 5304, 7, 5, 0, 0, 5304, 5305, + 7, 13, 0, 0, 5305, 5306, 7, 7, 0, 0, 5306, 5307, 7, 17, 0, 0, 5307, 5308, + 7, 7, 0, 0, 5308, 5309, 7, 23, 0, 0, 5309, 1048, 1, 0, 0, 0, 5310, 5311, + 7, 10, 0, 0, 5311, 5312, 7, 26, 0, 0, 5312, 5313, 7, 14, 0, 0, 5313, 5314, + 7, 10, 0, 0, 5314, 5315, 7, 24, 0, 0, 5315, 5316, 7, 16, 0, 0, 5316, 5317, + 7, 17, 0, 0, 5317, 5318, 7, 19, 0, 0, 5318, 5319, 7, 7, 0, 0, 5319, 1050, + 1, 0, 0, 0, 5320, 5321, 7, 5, 0, 0, 5321, 5322, 7, 9, 0, 0, 5322, 5323, + 7, 9, 0, 0, 5323, 5324, 7, 10, 0, 0, 5324, 5325, 7, 13, 0, 0, 5325, 5326, + 7, 16, 0, 0, 5326, 1052, 1, 0, 0, 0, 5327, 5328, 7, 6, 0, 0, 5328, 5329, + 7, 19, 0, 0, 5329, 5330, 7, 19, 0, 0, 5330, 5331, 7, 24, 0, 0, 5331, 1054, + 1, 0, 0, 0, 5332, 5333, 7, 19, 0, 0, 5333, 5334, 7, 24, 0, 0, 5334, 5335, + 7, 10, 0, 0, 5335, 5336, 7, 7, 0, 0, 5336, 1056, 1, 0, 0, 0, 5337, 5338, + 7, 5, 0, 0, 5338, 5339, 7, 18, 0, 0, 5339, 5340, 7, 9, 0, 0, 5340, 1058, + 1, 0, 0, 0, 5341, 5342, 7, 14, 0, 0, 5342, 5343, 7, 18, 0, 0, 5343, 5344, + 7, 13, 0, 0, 5344, 5345, 7, 16, 0, 0, 5345, 1060, 1, 0, 0, 0, 5346, 5347, + 7, 14, 0, 0, 5347, 5348, 7, 10, 0, 0, 5348, 5349, 7, 17, 0, 0, 5349, 5350, + 7, 6, 0, 0, 5350, 1062, 1, 0, 0, 0, 5351, 5352, 7, 14, 0, 0, 5352, 5353, + 7, 10, 0, 0, 5353, 5354, 7, 17, 0, 0, 5354, 5355, 7, 6, 0, 0, 5355, 5356, + 7, 17, 0, 0, 5356, 5357, 7, 7, 0, 0, 5357, 5358, 7, 23, 0, 0, 5358, 1064, + 1, 0, 0, 0, 5359, 5360, 7, 12, 0, 0, 5360, 5361, 7, 10, 0, 0, 5361, 5362, + 7, 23, 0, 0, 5362, 5363, 7, 13, 0, 0, 5363, 5364, 7, 10, 0, 0, 5364, 5365, + 7, 10, 0, 0, 5365, 5366, 7, 9, 0, 0, 5366, 1066, 1, 0, 0, 0, 5367, 5368, + 7, 12, 0, 0, 5368, 5369, 7, 17, 0, 0, 5369, 5370, 7, 27, 0, 0, 5370, 1068, + 1, 0, 0, 0, 5371, 5372, 7, 10, 0, 0, 5372, 5373, 7, 26, 0, 0, 5373, 5374, + 7, 24, 0, 0, 5374, 1070, 1, 0, 0, 0, 5375, 5376, 7, 25, 0, 0, 5376, 5377, + 7, 5, 0, 0, 5377, 5378, 7, 14, 0, 0, 5378, 5379, 7, 16, 0, 0, 5379, 5380, + 7, 19, 0, 0, 5380, 5381, 7, 13, 0, 0, 5381, 5382, 7, 17, 0, 0, 5382, 5383, + 7, 5, 0, 0, 5383, 5384, 7, 6, 0, 0, 5384, 1072, 1, 0, 0, 0, 5385, 5386, + 7, 25, 0, 0, 5386, 5387, 7, 6, 0, 0, 5387, 5388, 7, 19, 0, 0, 5388, 5389, + 7, 19, 0, 0, 5389, 5390, 7, 13, 0, 0, 5390, 1074, 1, 0, 0, 0, 5391, 5392, + 7, 23, 0, 0, 5392, 5393, 7, 14, 0, 0, 5393, 5394, 7, 12, 0, 0, 5394, 1076, + 1, 0, 0, 0, 5395, 5396, 7, 6, 0, 0, 5396, 5397, 7, 14, 0, 0, 5397, 5398, + 7, 15, 0, 0, 5398, 1078, 1, 0, 0, 0, 5399, 5400, 7, 6, 0, 0, 5400, 5401, + 7, 7, 0, 0, 5401, 1080, 1, 0, 0, 0, 5402, 5403, 7, 6, 0, 0, 5403, 5404, + 7, 19, 0, 0, 5404, 5405, 7, 23, 0, 0, 5405, 5406, 5, 49, 0, 0, 5406, 5407, + 5, 48, 0, 0, 5407, 1082, 1, 0, 0, 0, 5408, 5409, 7, 15, 0, 0, 5409, 5410, + 7, 17, 0, 0, 5410, 5411, 7, 7, 0, 0, 5411, 5412, 5, 95, 0, 0, 5412, 5413, + 7, 9, 0, 0, 5413, 5414, 7, 14, 0, 0, 5414, 5415, 7, 5, 0, 0, 5415, 5416, + 7, 6, 0, 0, 5416, 5417, 7, 10, 0, 0, 5417, 1084, 1, 0, 0, 0, 5418, 5419, + 7, 15, 0, 0, 5419, 5420, 7, 19, 0, 0, 5420, 5421, 7, 12, 0, 0, 5421, 1086, + 1, 0, 0, 0, 5422, 5423, 7, 24, 0, 0, 5423, 5424, 7, 17, 0, 0, 5424, 1088, + 1, 0, 0, 0, 5425, 5426, 7, 24, 0, 0, 5426, 5427, 7, 19, 0, 0, 5427, 5428, + 7, 29, 0, 0, 5428, 5429, 7, 10, 0, 0, 5429, 5430, 7, 13, 0, 0, 5430, 1090, + 1, 0, 0, 0, 5431, 5432, 7, 13, 0, 0, 5432, 5433, 7, 5, 0, 0, 5433, 5434, + 7, 12, 0, 0, 5434, 5435, 7, 17, 0, 0, 5435, 5436, 7, 5, 0, 0, 5436, 5437, + 7, 7, 0, 0, 5437, 5438, 7, 9, 0, 0, 5438, 1092, 1, 0, 0, 0, 5439, 5440, + 7, 13, 0, 0, 5440, 5441, 7, 19, 0, 0, 5441, 5442, 7, 22, 0, 0, 5442, 5443, + 7, 7, 0, 0, 5443, 5444, 7, 12, 0, 0, 5444, 1094, 1, 0, 0, 0, 5445, 5446, + 7, 9, 0, 0, 5446, 5447, 7, 14, 0, 0, 5447, 5448, 7, 5, 0, 0, 5448, 5449, + 7, 6, 0, 0, 5449, 5450, 7, 10, 0, 0, 5450, 1096, 1, 0, 0, 0, 5451, 5452, + 7, 9, 0, 0, 5452, 5453, 7, 17, 0, 0, 5453, 5454, 7, 23, 0, 0, 5454, 5455, + 7, 7, 0, 0, 5455, 1098, 1, 0, 0, 0, 5456, 5457, 7, 9, 0, 0, 5457, 5458, + 7, 28, 0, 0, 5458, 5459, 7, 13, 0, 0, 5459, 5460, 7, 16, 0, 0, 5460, 1100, + 1, 0, 0, 0, 5461, 5462, 7, 16, 0, 0, 5462, 5463, 7, 13, 0, 0, 5463, 5464, + 7, 17, 0, 0, 5464, 5465, 7, 15, 0, 0, 5465, 5466, 5, 95, 0, 0, 5466, 5467, + 7, 9, 0, 0, 5467, 5468, 7, 14, 0, 0, 5468, 5469, 7, 5, 0, 0, 5469, 5470, + 7, 6, 0, 0, 5470, 5471, 7, 10, 0, 0, 5471, 1102, 1, 0, 0, 0, 5472, 5473, + 7, 16, 0, 0, 5473, 5474, 7, 13, 0, 0, 5474, 5475, 7, 22, 0, 0, 5475, 5476, + 7, 7, 0, 0, 5476, 5477, 7, 14, 0, 0, 5477, 1104, 1, 0, 0, 0, 5478, 5479, + 7, 29, 0, 0, 5479, 5480, 7, 17, 0, 0, 5480, 5481, 7, 12, 0, 0, 5481, 5482, + 7, 16, 0, 0, 5482, 5483, 7, 20, 0, 0, 5483, 5484, 5, 95, 0, 0, 5484, 5485, + 7, 18, 0, 0, 5485, 5486, 7, 22, 0, 0, 5486, 5487, 7, 14, 0, 0, 5487, 5488, + 7, 21, 0, 0, 5488, 5489, 7, 10, 0, 0, 5489, 5490, 7, 16, 0, 0, 5490, 1106, + 1, 0, 0, 0, 5491, 5492, 7, 13, 0, 0, 5492, 5493, 7, 5, 0, 0, 5493, 5494, + 7, 7, 0, 0, 5494, 5495, 7, 12, 0, 0, 5495, 5496, 7, 19, 0, 0, 5496, 5497, + 7, 15, 0, 0, 5497, 1108, 1, 0, 0, 0, 5498, 5499, 7, 9, 0, 0, 5499, 5500, + 7, 10, 0, 0, 5500, 5501, 7, 16, 0, 0, 5501, 5502, 7, 9, 0, 0, 5502, 5503, + 7, 10, 0, 0, 5503, 5504, 7, 10, 0, 0, 5504, 5505, 7, 12, 0, 0, 5505, 1110, + 1, 0, 0, 0, 5506, 5507, 7, 5, 0, 0, 5507, 5508, 7, 14, 0, 0, 5508, 5509, + 7, 19, 0, 0, 5509, 5510, 7, 9, 0, 0, 5510, 1112, 1, 0, 0, 0, 5511, 5512, + 7, 5, 0, 0, 5512, 5513, 7, 14, 0, 0, 5513, 5514, 7, 19, 0, 0, 5514, 5515, + 7, 9, 0, 0, 5515, 5516, 7, 12, 0, 0, 5516, 1114, 1, 0, 0, 0, 5517, 5518, + 7, 5, 0, 0, 5518, 5519, 7, 9, 0, 0, 5519, 5520, 7, 17, 0, 0, 5520, 5521, + 7, 7, 0, 0, 5521, 1116, 1, 0, 0, 0, 5522, 5523, 7, 5, 0, 0, 5523, 5524, + 7, 9, 0, 0, 5524, 5525, 7, 17, 0, 0, 5525, 5526, 7, 7, 0, 0, 5526, 5527, + 7, 12, 0, 0, 5527, 1118, 1, 0, 0, 0, 5528, 5529, 7, 5, 0, 0, 5529, 5530, + 7, 16, 0, 0, 5530, 5531, 7, 5, 0, 0, 5531, 5532, 7, 7, 0, 0, 5532, 1120, + 1, 0, 0, 0, 5533, 5534, 7, 5, 0, 0, 5534, 5535, 7, 16, 0, 0, 5535, 5536, + 7, 5, 0, 0, 5536, 5537, 7, 7, 0, 0, 5537, 5538, 7, 12, 0, 0, 5538, 1122, + 1, 0, 0, 0, 5539, 5540, 7, 5, 0, 0, 5540, 5541, 7, 16, 0, 0, 5541, 5542, + 7, 5, 0, 0, 5542, 5543, 7, 7, 0, 0, 5543, 5544, 5, 50, 0, 0, 5544, 1124, + 1, 0, 0, 0, 5545, 5546, 7, 5, 0, 0, 5546, 5547, 7, 16, 0, 0, 5547, 5548, + 7, 5, 0, 0, 5548, 5549, 7, 7, 0, 0, 5549, 5550, 5, 50, 0, 0, 5550, 5551, + 7, 12, 0, 0, 5551, 1126, 1, 0, 0, 0, 5552, 5553, 7, 14, 0, 0, 5553, 5554, + 7, 19, 0, 0, 5554, 5555, 7, 9, 0, 0, 5555, 1128, 1, 0, 0, 0, 5556, 5557, + 7, 14, 0, 0, 5557, 5558, 7, 19, 0, 0, 5558, 5559, 7, 9, 0, 0, 5559, 5560, + 7, 12, 0, 0, 5560, 1130, 1, 0, 0, 0, 5561, 5562, 7, 14, 0, 0, 5562, 5563, + 7, 19, 0, 0, 5563, 5564, 7, 16, 0, 0, 5564, 1132, 1, 0, 0, 0, 5565, 5566, + 7, 14, 0, 0, 5566, 5567, 7, 19, 0, 0, 5567, 5568, 7, 16, 0, 0, 5568, 5569, + 7, 12, 0, 0, 5569, 1134, 1, 0, 0, 0, 5570, 5571, 7, 9, 0, 0, 5571, 5572, + 7, 17, 0, 0, 5572, 5573, 7, 7, 0, 0, 5573, 1136, 1, 0, 0, 0, 5574, 5575, + 7, 9, 0, 0, 5575, 5576, 7, 17, 0, 0, 5576, 5577, 7, 7, 0, 0, 5577, 5578, + 7, 12, 0, 0, 5578, 1138, 1, 0, 0, 0, 5579, 5580, 7, 16, 0, 0, 5580, 5581, + 7, 5, 0, 0, 5581, 5582, 7, 7, 0, 0, 5582, 1140, 1, 0, 0, 0, 5583, 5584, + 7, 16, 0, 0, 5584, 5585, 7, 5, 0, 0, 5585, 5586, 7, 7, 0, 0, 5586, 5587, + 7, 12, 0, 0, 5587, 1142, 1, 0, 0, 0, 5588, 5589, 7, 9, 0, 0, 5589, 5590, + 7, 17, 0, 0, 5590, 5591, 7, 7, 0, 0, 5591, 5592, 7, 20, 0, 0, 5592, 1144, + 1, 0, 0, 0, 5593, 5594, 7, 14, 0, 0, 5594, 5595, 7, 19, 0, 0, 5595, 5596, + 7, 9, 0, 0, 5596, 5597, 7, 20, 0, 0, 5597, 1146, 1, 0, 0, 0, 5598, 5599, + 7, 16, 0, 0, 5599, 5600, 7, 5, 0, 0, 5600, 5601, 7, 7, 0, 0, 5601, 5602, + 7, 20, 0, 0, 5602, 1148, 1, 0, 0, 0, 5603, 5604, 7, 5, 0, 0, 5604, 5605, + 7, 9, 0, 0, 5605, 5606, 7, 17, 0, 0, 5606, 5607, 7, 7, 0, 0, 5607, 5608, + 7, 20, 0, 0, 5608, 1150, 1, 0, 0, 0, 5609, 5610, 7, 5, 0, 0, 5610, 5611, + 7, 14, 0, 0, 5611, 5612, 7, 19, 0, 0, 5612, 5613, 7, 9, 0, 0, 5613, 5614, + 7, 20, 0, 0, 5614, 1152, 1, 0, 0, 0, 5615, 5616, 7, 5, 0, 0, 5616, 5617, + 7, 16, 0, 0, 5617, 5618, 7, 5, 0, 0, 5618, 5619, 7, 7, 0, 0, 5619, 5620, + 7, 20, 0, 0, 5620, 1154, 1, 0, 0, 0, 5621, 5622, 7, 18, 0, 0, 5622, 5623, + 7, 17, 0, 0, 5623, 5624, 7, 16, 0, 0, 5624, 5625, 5, 95, 0, 0, 5625, 5626, + 7, 6, 0, 0, 5626, 5627, 7, 10, 0, 0, 5627, 5628, 7, 7, 0, 0, 5628, 5629, + 7, 23, 0, 0, 5629, 5630, 7, 16, 0, 0, 5630, 5631, 7, 20, 0, 0, 5631, 1156, + 1, 0, 0, 0, 5632, 5633, 7, 14, 0, 0, 5633, 5634, 7, 20, 0, 0, 5634, 5635, + 7, 5, 0, 0, 5635, 5636, 7, 13, 0, 0, 5636, 5637, 5, 95, 0, 0, 5637, 5638, + 7, 6, 0, 0, 5638, 5639, 7, 10, 0, 0, 5639, 5640, 7, 7, 0, 0, 5640, 5641, + 7, 23, 0, 0, 5641, 5642, 7, 16, 0, 0, 5642, 5643, 7, 20, 0, 0, 5643, 1158, + 1, 0, 0, 0, 5644, 5645, 7, 14, 0, 0, 5645, 5646, 7, 20, 0, 0, 5646, 5647, + 7, 5, 0, 0, 5647, 5648, 7, 13, 0, 0, 5648, 5649, 7, 5, 0, 0, 5649, 5650, + 7, 14, 0, 0, 5650, 5651, 7, 16, 0, 0, 5651, 5652, 7, 10, 0, 0, 5652, 5653, + 7, 13, 0, 0, 5653, 5654, 5, 95, 0, 0, 5654, 5655, 7, 6, 0, 0, 5655, 5656, + 7, 10, 0, 0, 5656, 5657, 7, 7, 0, 0, 5657, 5658, 7, 23, 0, 0, 5658, 5659, + 7, 16, 0, 0, 5659, 5660, 7, 20, 0, 0, 5660, 1160, 1, 0, 0, 0, 5661, 5662, + 7, 6, 0, 0, 5662, 5663, 7, 19, 0, 0, 5663, 5664, 7, 29, 0, 0, 5664, 5665, + 7, 10, 0, 0, 5665, 5666, 7, 13, 0, 0, 5666, 1162, 1, 0, 0, 0, 5667, 5668, + 7, 19, 0, 0, 5668, 5669, 7, 14, 0, 0, 5669, 5670, 7, 16, 0, 0, 5670, 5671, + 7, 10, 0, 0, 5671, 5672, 7, 16, 0, 0, 5672, 5673, 5, 95, 0, 0, 5673, 5674, + 7, 6, 0, 0, 5674, 5675, 7, 10, 0, 0, 5675, 5676, 7, 7, 0, 0, 5676, 5677, + 7, 23, 0, 0, 5677, 5678, 7, 16, 0, 0, 5678, 5679, 7, 20, 0, 0, 5679, 1164, + 1, 0, 0, 0, 5680, 5681, 7, 22, 0, 0, 5681, 5682, 7, 24, 0, 0, 5682, 5683, + 7, 24, 0, 0, 5683, 5684, 7, 10, 0, 0, 5684, 5685, 7, 13, 0, 0, 5685, 1166, + 1, 0, 0, 0, 5686, 5687, 7, 5, 0, 0, 5687, 5688, 7, 9, 0, 0, 5688, 5689, + 7, 14, 0, 0, 5689, 5690, 7, 17, 0, 0, 5690, 5691, 7, 17, 0, 0, 5691, 1168, + 1, 0, 0, 0, 5692, 5693, 7, 18, 0, 0, 5693, 5694, 7, 16, 0, 0, 5694, 5695, + 7, 13, 0, 0, 5695, 5696, 7, 17, 0, 0, 5696, 5697, 7, 15, 0, 0, 5697, 1170, + 1, 0, 0, 0, 5698, 5699, 7, 14, 0, 0, 5699, 5700, 7, 20, 0, 0, 5700, 5701, + 7, 13, 0, 0, 5701, 1172, 1, 0, 0, 0, 5702, 5703, 7, 14, 0, 0, 5703, 5704, + 7, 19, 0, 0, 5704, 5705, 7, 7, 0, 0, 5705, 5706, 7, 14, 0, 0, 5706, 5707, + 7, 5, 0, 0, 5707, 5708, 7, 16, 0, 0, 5708, 1174, 1, 0, 0, 0, 5709, 5710, + 7, 14, 0, 0, 5710, 5711, 7, 19, 0, 0, 5711, 5712, 7, 7, 0, 0, 5712, 5713, + 7, 14, 0, 0, 5713, 5714, 7, 5, 0, 0, 5714, 5715, 7, 16, 0, 0, 5715, 5716, + 5, 95, 0, 0, 5716, 5717, 7, 29, 0, 0, 5717, 5718, 7, 9, 0, 0, 5718, 1176, + 1, 0, 0, 0, 5719, 5720, 7, 25, 0, 0, 5720, 5721, 7, 19, 0, 0, 5721, 5722, + 7, 13, 0, 0, 5722, 5723, 7, 15, 0, 0, 5723, 5724, 7, 5, 0, 0, 5724, 5725, + 7, 16, 0, 0, 5725, 1178, 1, 0, 0, 0, 5726, 5727, 7, 17, 0, 0, 5727, 5728, + 7, 7, 0, 0, 5728, 5729, 7, 17, 0, 0, 5729, 5730, 7, 16, 0, 0, 5730, 5731, + 7, 14, 0, 0, 5731, 5732, 7, 5, 0, 0, 5732, 5733, 7, 24, 0, 0, 5733, 1180, + 1, 0, 0, 0, 5734, 5735, 7, 6, 0, 0, 5735, 5736, 7, 10, 0, 0, 5736, 5737, + 7, 7, 0, 0, 5737, 5738, 7, 23, 0, 0, 5738, 5739, 7, 16, 0, 0, 5739, 5740, + 7, 20, 0, 0, 5740, 1182, 1, 0, 0, 0, 5741, 5742, 7, 6, 0, 0, 5742, 5743, + 7, 24, 0, 0, 5743, 5744, 7, 5, 0, 0, 5744, 5745, 7, 12, 0, 0, 5745, 1184, + 1, 0, 0, 0, 5746, 5747, 7, 6, 0, 0, 5747, 5748, 7, 16, 0, 0, 5748, 5749, + 7, 13, 0, 0, 5749, 5750, 7, 17, 0, 0, 5750, 5751, 7, 15, 0, 0, 5751, 1186, + 1, 0, 0, 0, 5752, 5753, 7, 15, 0, 0, 5753, 5754, 7, 12, 0, 0, 5754, 5755, + 5, 53, 0, 0, 5755, 1188, 1, 0, 0, 0, 5756, 5757, 7, 24, 0, 0, 5757, 5758, + 7, 5, 0, 0, 5758, 5759, 7, 13, 0, 0, 5759, 5760, 7, 9, 0, 0, 5760, 5761, + 7, 10, 0, 0, 5761, 5762, 5, 95, 0, 0, 5762, 5763, 7, 17, 0, 0, 5763, 5764, + 7, 12, 0, 0, 5764, 5765, 7, 10, 0, 0, 5765, 5766, 7, 7, 0, 0, 5766, 5767, + 7, 16, 0, 0, 5767, 1190, 1, 0, 0, 0, 5768, 5769, 7, 24, 0, 0, 5769, 5770, + 7, 23, 0, 0, 5770, 5771, 5, 95, 0, 0, 5771, 5772, 7, 14, 0, 0, 5772, 5773, + 7, 6, 0, 0, 5773, 5774, 7, 17, 0, 0, 5774, 5775, 7, 10, 0, 0, 5775, 5776, + 7, 7, 0, 0, 5776, 5777, 7, 16, 0, 0, 5777, 5778, 5, 95, 0, 0, 5778, 5779, + 7, 10, 0, 0, 5779, 5780, 7, 7, 0, 0, 5780, 5781, 7, 14, 0, 0, 5781, 5782, + 7, 19, 0, 0, 5782, 5783, 7, 12, 0, 0, 5783, 5784, 7, 17, 0, 0, 5784, 5785, + 7, 7, 0, 0, 5785, 5786, 7, 23, 0, 0, 5786, 1192, 1, 0, 0, 0, 5787, 5788, + 7, 28, 0, 0, 5788, 5789, 7, 22, 0, 0, 5789, 5790, 7, 19, 0, 0, 5790, 5791, + 7, 16, 0, 0, 5791, 5792, 7, 10, 0, 0, 5792, 5793, 5, 95, 0, 0, 5793, 5794, + 7, 17, 0, 0, 5794, 5795, 7, 12, 0, 0, 5795, 5796, 7, 10, 0, 0, 5796, 5797, + 7, 7, 0, 0, 5797, 5798, 7, 16, 0, 0, 5798, 1194, 1, 0, 0, 0, 5799, 5800, + 7, 28, 0, 0, 5800, 5801, 7, 22, 0, 0, 5801, 5802, 7, 19, 0, 0, 5802, 5803, + 7, 16, 0, 0, 5803, 5804, 7, 10, 0, 0, 5804, 5805, 5, 95, 0, 0, 5805, 5806, + 7, 6, 0, 0, 5806, 5807, 7, 17, 0, 0, 5807, 5808, 7, 16, 0, 0, 5808, 5809, + 7, 10, 0, 0, 5809, 5810, 7, 13, 0, 0, 5810, 5811, 7, 5, 0, 0, 5811, 5812, + 7, 6, 0, 0, 5812, 1196, 1, 0, 0, 0, 5813, 5814, 7, 28, 0, 0, 5814, 5815, + 7, 22, 0, 0, 5815, 5816, 7, 19, 0, 0, 5816, 5817, 7, 16, 0, 0, 5817, 5818, + 7, 10, 0, 0, 5818, 5819, 5, 95, 0, 0, 5819, 5820, 7, 7, 0, 0, 5820, 5821, + 7, 22, 0, 0, 5821, 5822, 7, 6, 0, 0, 5822, 5823, 7, 6, 0, 0, 5823, 5824, + 7, 5, 0, 0, 5824, 5825, 7, 18, 0, 0, 5825, 5826, 7, 6, 0, 0, 5826, 5827, + 7, 10, 0, 0, 5827, 1198, 1, 0, 0, 0, 5828, 5829, 7, 13, 0, 0, 5829, 5830, + 7, 10, 0, 0, 5830, 5831, 7, 23, 0, 0, 5831, 5832, 7, 10, 0, 0, 5832, 5833, + 7, 26, 0, 0, 5833, 5834, 7, 24, 0, 0, 5834, 5835, 5, 95, 0, 0, 5835, 5836, + 7, 14, 0, 0, 5836, 5837, 7, 19, 0, 0, 5837, 5838, 7, 22, 0, 0, 5838, 5839, + 7, 7, 0, 0, 5839, 5840, 7, 16, 0, 0, 5840, 1200, 1, 0, 0, 0, 5841, 5842, + 7, 13, 0, 0, 5842, 5843, 7, 10, 0, 0, 5843, 5844, 7, 23, 0, 0, 5844, 5845, + 7, 10, 0, 0, 5845, 5846, 7, 26, 0, 0, 5846, 5847, 7, 24, 0, 0, 5847, 5848, + 5, 95, 0, 0, 5848, 5849, 7, 17, 0, 0, 5849, 5850, 7, 7, 0, 0, 5850, 5851, + 7, 9, 0, 0, 5851, 5852, 7, 16, 0, 0, 5852, 5853, 7, 13, 0, 0, 5853, 1202, + 1, 0, 0, 0, 5854, 5855, 7, 13, 0, 0, 5855, 5856, 7, 10, 0, 0, 5856, 5857, + 7, 23, 0, 0, 5857, 5858, 7, 10, 0, 0, 5858, 5859, 7, 26, 0, 0, 5859, 5860, + 7, 24, 0, 0, 5860, 5861, 5, 95, 0, 0, 5861, 5862, 7, 6, 0, 0, 5862, 5863, + 7, 17, 0, 0, 5863, 5864, 7, 21, 0, 0, 5864, 5865, 7, 10, 0, 0, 5865, 1204, + 1, 0, 0, 0, 5866, 5867, 7, 13, 0, 0, 5867, 5868, 7, 10, 0, 0, 5868, 5869, + 7, 23, 0, 0, 5869, 5870, 7, 10, 0, 0, 5870, 5871, 7, 26, 0, 0, 5871, 5872, + 7, 24, 0, 0, 5872, 5873, 5, 95, 0, 0, 5873, 5874, 7, 15, 0, 0, 5874, 5875, + 7, 5, 0, 0, 5875, 5876, 7, 16, 0, 0, 5876, 5877, 7, 14, 0, 0, 5877, 5878, + 7, 20, 0, 0, 5878, 1206, 1, 0, 0, 0, 5879, 5880, 7, 13, 0, 0, 5880, 5881, + 7, 10, 0, 0, 5881, 5882, 7, 23, 0, 0, 5882, 5883, 7, 10, 0, 0, 5883, 5884, + 7, 26, 0, 0, 5884, 5885, 7, 24, 0, 0, 5885, 5886, 5, 95, 0, 0, 5886, 5887, + 7, 15, 0, 0, 5887, 5888, 7, 5, 0, 0, 5888, 5889, 7, 16, 0, 0, 5889, 5890, + 7, 14, 0, 0, 5890, 5891, 7, 20, 0, 0, 5891, 5892, 7, 10, 0, 0, 5892, 5893, + 7, 9, 0, 0, 5893, 1208, 1, 0, 0, 0, 5894, 5895, 7, 13, 0, 0, 5895, 5896, + 7, 10, 0, 0, 5896, 5897, 7, 23, 0, 0, 5897, 5898, 7, 10, 0, 0, 5898, 5899, + 7, 26, 0, 0, 5899, 5900, 7, 24, 0, 0, 5900, 5901, 5, 95, 0, 0, 5901, 5902, + 7, 13, 0, 0, 5902, 5903, 7, 10, 0, 0, 5903, 5904, 7, 24, 0, 0, 5904, 5905, + 7, 6, 0, 0, 5905, 5906, 7, 5, 0, 0, 5906, 5907, 7, 14, 0, 0, 5907, 5908, + 7, 10, 0, 0, 5908, 1210, 1, 0, 0, 0, 5909, 5910, 7, 13, 0, 0, 5910, 5911, + 7, 10, 0, 0, 5911, 5912, 7, 23, 0, 0, 5912, 5913, 7, 10, 0, 0, 5913, 5914, + 7, 26, 0, 0, 5914, 5915, 7, 24, 0, 0, 5915, 5916, 5, 95, 0, 0, 5916, 5917, + 7, 9, 0, 0, 5917, 5918, 7, 24, 0, 0, 5918, 5919, 7, 6, 0, 0, 5919, 5920, + 7, 17, 0, 0, 5920, 5921, 7, 16, 0, 0, 5921, 5922, 5, 95, 0, 0, 5922, 5923, + 7, 16, 0, 0, 5923, 5924, 7, 19, 0, 0, 5924, 5925, 5, 95, 0, 0, 5925, 5926, + 7, 5, 0, 0, 5926, 5927, 7, 13, 0, 0, 5927, 5928, 7, 13, 0, 0, 5928, 5929, + 7, 5, 0, 0, 5929, 5930, 7, 8, 0, 0, 5930, 1212, 1, 0, 0, 0, 5931, 5932, + 7, 13, 0, 0, 5932, 5933, 7, 10, 0, 0, 5933, 5934, 7, 23, 0, 0, 5934, 5935, + 7, 10, 0, 0, 5935, 5936, 7, 26, 0, 0, 5936, 5937, 7, 24, 0, 0, 5937, 5938, + 5, 95, 0, 0, 5938, 5939, 7, 9, 0, 0, 5939, 5940, 7, 24, 0, 0, 5940, 5941, + 7, 6, 0, 0, 5941, 5942, 7, 17, 0, 0, 5942, 5943, 7, 16, 0, 0, 5943, 5944, + 5, 95, 0, 0, 5944, 5945, 7, 16, 0, 0, 5945, 5946, 7, 19, 0, 0, 5946, 5947, + 5, 95, 0, 0, 5947, 5948, 7, 16, 0, 0, 5948, 5949, 7, 5, 0, 0, 5949, 5950, + 7, 18, 0, 0, 5950, 5951, 7, 6, 0, 0, 5951, 5952, 7, 10, 0, 0, 5952, 1214, + 1, 0, 0, 0, 5953, 5954, 7, 13, 0, 0, 5954, 5955, 7, 10, 0, 0, 5955, 5956, + 7, 23, 0, 0, 5956, 5957, 7, 10, 0, 0, 5957, 5958, 7, 26, 0, 0, 5958, 5959, + 7, 24, 0, 0, 5959, 5960, 5, 95, 0, 0, 5960, 5961, 7, 9, 0, 0, 5961, 5962, + 7, 22, 0, 0, 5962, 5963, 7, 18, 0, 0, 5963, 5964, 7, 9, 0, 0, 5964, 5965, + 7, 16, 0, 0, 5965, 5966, 7, 13, 0, 0, 5966, 1216, 1, 0, 0, 0, 5967, 5968, + 7, 13, 0, 0, 5968, 5969, 7, 10, 0, 0, 5969, 5970, 7, 24, 0, 0, 5970, 5971, + 7, 10, 0, 0, 5971, 5972, 7, 5, 0, 0, 5972, 5973, 7, 16, 0, 0, 5973, 1218, + 1, 0, 0, 0, 5974, 5975, 7, 13, 0, 0, 5975, 5976, 7, 24, 0, 0, 5976, 5977, + 7, 5, 0, 0, 5977, 5978, 7, 12, 0, 0, 5978, 1220, 1, 0, 0, 0, 5979, 5980, + 7, 13, 0, 0, 5980, 5981, 7, 16, 0, 0, 5981, 5982, 7, 13, 0, 0, 5982, 5983, + 7, 17, 0, 0, 5983, 5984, 7, 15, 0, 0, 5984, 1222, 1, 0, 0, 0, 5985, 5986, + 7, 9, 0, 0, 5986, 5987, 7, 24, 0, 0, 5987, 5988, 7, 6, 0, 0, 5988, 5989, + 7, 17, 0, 0, 5989, 5990, 7, 16, 0, 0, 5990, 5991, 5, 95, 0, 0, 5991, 5992, + 7, 24, 0, 0, 5992, 5993, 7, 5, 0, 0, 5993, 5994, 7, 13, 0, 0, 5994, 5995, + 7, 16, 0, 0, 5995, 1224, 1, 0, 0, 0, 5996, 5997, 7, 9, 0, 0, 5997, 5998, + 7, 16, 0, 0, 5998, 5999, 7, 5, 0, 0, 5999, 6000, 7, 13, 0, 0, 6000, 6001, + 7, 16, 0, 0, 6001, 6002, 7, 9, 0, 0, 6002, 6003, 5, 95, 0, 0, 6003, 6004, + 7, 29, 0, 0, 6004, 6005, 7, 17, 0, 0, 6005, 6006, 7, 16, 0, 0, 6006, 6007, + 7, 20, 0, 0, 6007, 1226, 1, 0, 0, 0, 6008, 6009, 7, 9, 0, 0, 6009, 6010, + 7, 16, 0, 0, 6010, 6011, 7, 13, 0, 0, 6011, 6012, 7, 17, 0, 0, 6012, 6013, + 7, 7, 0, 0, 6013, 6014, 7, 23, 0, 0, 6014, 6015, 5, 95, 0, 0, 6015, 6016, + 7, 16, 0, 0, 6016, 6017, 7, 19, 0, 0, 6017, 6018, 5, 95, 0, 0, 6018, 6019, + 7, 5, 0, 0, 6019, 6020, 7, 13, 0, 0, 6020, 6021, 7, 13, 0, 0, 6021, 6022, + 7, 5, 0, 0, 6022, 6023, 7, 8, 0, 0, 6023, 1228, 1, 0, 0, 0, 6024, 6025, + 7, 9, 0, 0, 6025, 6026, 7, 16, 0, 0, 6026, 6027, 7, 13, 0, 0, 6027, 6028, + 7, 17, 0, 0, 6028, 6029, 7, 7, 0, 0, 6029, 6030, 7, 23, 0, 0, 6030, 6031, + 5, 95, 0, 0, 6031, 6032, 7, 16, 0, 0, 6032, 6033, 7, 19, 0, 0, 6033, 6034, + 5, 95, 0, 0, 6034, 6035, 7, 16, 0, 0, 6035, 6036, 7, 5, 0, 0, 6036, 6037, + 7, 18, 0, 0, 6037, 6038, 7, 6, 0, 0, 6038, 6039, 7, 10, 0, 0, 6039, 1230, + 1, 0, 0, 0, 6040, 6041, 7, 9, 0, 0, 6041, 6042, 7, 16, 0, 0, 6042, 6043, + 7, 13, 0, 0, 6043, 6044, 7, 24, 0, 0, 6044, 6045, 7, 19, 0, 0, 6045, 6046, + 7, 9, 0, 0, 6046, 1232, 1, 0, 0, 0, 6047, 6048, 7, 9, 0, 0, 6048, 6049, + 7, 22, 0, 0, 6049, 6050, 7, 18, 0, 0, 6050, 6051, 7, 9, 0, 0, 6051, 6052, + 7, 16, 0, 0, 6052, 6053, 7, 13, 0, 0, 6053, 1234, 1, 0, 0, 0, 6054, 6055, + 7, 16, 0, 0, 6055, 6056, 7, 19, 0, 0, 6056, 6057, 5, 95, 0, 0, 6057, 6058, + 7, 5, 0, 0, 6058, 6059, 7, 9, 0, 0, 6059, 6060, 7, 14, 0, 0, 6060, 6061, + 7, 17, 0, 0, 6061, 6062, 7, 17, 0, 0, 6062, 1236, 1, 0, 0, 0, 6063, 6064, + 7, 16, 0, 0, 6064, 6065, 7, 19, 0, 0, 6065, 6066, 5, 95, 0, 0, 6066, 6067, + 7, 20, 0, 0, 6067, 6068, 7, 10, 0, 0, 6068, 6069, 7, 26, 0, 0, 6069, 1238, + 1, 0, 0, 0, 6070, 6071, 7, 16, 0, 0, 6071, 6072, 7, 13, 0, 0, 6072, 6073, + 7, 5, 0, 0, 6073, 6074, 7, 7, 0, 0, 6074, 6075, 7, 9, 0, 0, 6075, 6076, + 7, 6, 0, 0, 6076, 6077, 7, 5, 0, 0, 6077, 6078, 7, 16, 0, 0, 6078, 6079, + 7, 10, 0, 0, 6079, 1240, 1, 0, 0, 0, 6080, 6081, 7, 22, 0, 0, 6081, 6082, + 7, 7, 0, 0, 6082, 6083, 7, 17, 0, 0, 6083, 6084, 7, 9, 0, 0, 6084, 6085, + 7, 16, 0, 0, 6085, 6086, 7, 13, 0, 0, 6086, 1242, 1, 0, 0, 0, 6087, 6088, + 7, 5, 0, 0, 6088, 6089, 7, 23, 0, 0, 6089, 6090, 7, 10, 0, 0, 6090, 1244, + 1, 0, 0, 0, 6091, 6092, 7, 14, 0, 0, 6092, 6093, 7, 6, 0, 0, 6093, 6094, + 7, 19, 0, 0, 6094, 6095, 7, 14, 0, 0, 6095, 6096, 7, 21, 0, 0, 6096, 6097, + 5, 95, 0, 0, 6097, 6098, 7, 16, 0, 0, 6098, 6099, 7, 17, 0, 0, 6099, 6100, + 7, 15, 0, 0, 6100, 6101, 7, 10, 0, 0, 6101, 6102, 7, 9, 0, 0, 6102, 6103, + 7, 16, 0, 0, 6103, 6104, 7, 5, 0, 0, 6104, 6105, 7, 15, 0, 0, 6105, 6106, + 7, 24, 0, 0, 6106, 1246, 1, 0, 0, 0, 6107, 6108, 7, 12, 0, 0, 6108, 6109, + 7, 5, 0, 0, 6109, 6110, 7, 16, 0, 0, 6110, 6111, 7, 10, 0, 0, 6111, 6112, + 5, 95, 0, 0, 6112, 6113, 7, 18, 0, 0, 6113, 6114, 7, 17, 0, 0, 6114, 6115, + 7, 7, 0, 0, 6115, 1248, 1, 0, 0, 0, 6116, 6117, 7, 12, 0, 0, 6117, 6118, + 7, 5, 0, 0, 6118, 6119, 7, 16, 0, 0, 6119, 6120, 7, 10, 0, 0, 6120, 6121, + 5, 95, 0, 0, 6121, 6122, 7, 24, 0, 0, 6122, 6123, 7, 5, 0, 0, 6123, 6124, + 7, 13, 0, 0, 6124, 6125, 7, 16, 0, 0, 6125, 1250, 1, 0, 0, 0, 6126, 6127, + 7, 12, 0, 0, 6127, 6128, 7, 5, 0, 0, 6128, 6129, 7, 16, 0, 0, 6129, 6130, + 7, 10, 0, 0, 6130, 6131, 5, 95, 0, 0, 6131, 6132, 7, 16, 0, 0, 6132, 6133, + 7, 13, 0, 0, 6133, 6134, 7, 22, 0, 0, 6134, 6135, 7, 7, 0, 0, 6135, 6136, + 7, 14, 0, 0, 6136, 1252, 1, 0, 0, 0, 6137, 6138, 7, 17, 0, 0, 6138, 6139, + 7, 9, 0, 0, 6139, 6140, 7, 25, 0, 0, 6140, 6141, 7, 17, 0, 0, 6141, 6142, + 7, 7, 0, 0, 6142, 6143, 7, 17, 0, 0, 6143, 6144, 7, 16, 0, 0, 6144, 6145, + 7, 10, 0, 0, 6145, 1254, 1, 0, 0, 0, 6146, 6147, 7, 30, 0, 0, 6147, 6148, + 7, 22, 0, 0, 6148, 6149, 7, 9, 0, 0, 6149, 6150, 7, 16, 0, 0, 6150, 6151, + 7, 17, 0, 0, 6151, 6152, 7, 25, 0, 0, 6152, 6153, 7, 8, 0, 0, 6153, 6154, + 5, 95, 0, 0, 6154, 6155, 7, 12, 0, 0, 6155, 6156, 7, 5, 0, 0, 6156, 6157, + 7, 8, 0, 0, 6157, 6158, 7, 9, 0, 0, 6158, 1256, 1, 0, 0, 0, 6159, 6160, + 7, 30, 0, 0, 6160, 6161, 7, 22, 0, 0, 6161, 6162, 7, 9, 0, 0, 6162, 6163, + 7, 16, 0, 0, 6163, 6164, 7, 17, 0, 0, 6164, 6165, 7, 25, 0, 0, 6165, 6166, + 7, 8, 0, 0, 6166, 6167, 5, 95, 0, 0, 6167, 6168, 7, 20, 0, 0, 6168, 6169, + 7, 19, 0, 0, 6169, 6170, 7, 22, 0, 0, 6170, 6171, 7, 13, 0, 0, 6171, 6172, + 7, 9, 0, 0, 6172, 1258, 1, 0, 0, 0, 6173, 6174, 7, 30, 0, 0, 6174, 6175, + 7, 22, 0, 0, 6175, 6176, 7, 9, 0, 0, 6176, 6177, 7, 16, 0, 0, 6177, 6178, + 7, 17, 0, 0, 6178, 6179, 7, 25, 0, 0, 6179, 6180, 7, 8, 0, 0, 6180, 6181, + 5, 95, 0, 0, 6181, 6182, 7, 17, 0, 0, 6182, 6183, 7, 7, 0, 0, 6183, 6184, + 7, 16, 0, 0, 6184, 6185, 7, 10, 0, 0, 6185, 6186, 7, 13, 0, 0, 6186, 6187, + 7, 27, 0, 0, 6187, 6188, 7, 5, 0, 0, 6188, 6189, 7, 6, 0, 0, 6189, 1260, + 1, 0, 0, 0, 6190, 6191, 7, 15, 0, 0, 6191, 6192, 7, 5, 0, 0, 6192, 6193, + 7, 21, 0, 0, 6193, 6194, 7, 10, 0, 0, 6194, 6195, 5, 95, 0, 0, 6195, 6196, + 7, 12, 0, 0, 6196, 6197, 7, 5, 0, 0, 6197, 6198, 7, 16, 0, 0, 6198, 6199, + 7, 10, 0, 0, 6199, 1262, 1, 0, 0, 0, 6200, 6201, 7, 15, 0, 0, 6201, 6202, + 7, 5, 0, 0, 6202, 6203, 7, 21, 0, 0, 6203, 6204, 7, 10, 0, 0, 6204, 6205, + 5, 95, 0, 0, 6205, 6206, 7, 17, 0, 0, 6206, 6207, 7, 7, 0, 0, 6207, 6208, + 7, 16, 0, 0, 6208, 6209, 7, 10, 0, 0, 6209, 6210, 7, 13, 0, 0, 6210, 6211, + 7, 27, 0, 0, 6211, 6212, 7, 5, 0, 0, 6212, 6213, 7, 6, 0, 0, 6213, 1264, + 1, 0, 0, 0, 6214, 6215, 7, 15, 0, 0, 6215, 6216, 7, 5, 0, 0, 6216, 6217, + 7, 21, 0, 0, 6217, 6218, 7, 10, 0, 0, 6218, 6219, 5, 95, 0, 0, 6219, 6220, + 7, 16, 0, 0, 6220, 6221, 7, 17, 0, 0, 6221, 6222, 7, 15, 0, 0, 6222, 6223, + 7, 10, 0, 0, 6223, 1266, 1, 0, 0, 0, 6224, 6225, 7, 15, 0, 0, 6225, 6226, + 7, 5, 0, 0, 6226, 6227, 7, 21, 0, 0, 6227, 6228, 7, 10, 0, 0, 6228, 6229, + 5, 95, 0, 0, 6229, 6230, 7, 16, 0, 0, 6230, 6231, 7, 17, 0, 0, 6231, 6232, + 7, 15, 0, 0, 6232, 6233, 7, 10, 0, 0, 6233, 6234, 7, 9, 0, 0, 6234, 6235, + 7, 16, 0, 0, 6235, 6236, 7, 5, 0, 0, 6236, 6237, 7, 15, 0, 0, 6237, 6238, + 7, 24, 0, 0, 6238, 1268, 1, 0, 0, 0, 6239, 6240, 7, 15, 0, 0, 6240, 6241, + 7, 5, 0, 0, 6241, 6242, 7, 21, 0, 0, 6242, 6243, 7, 10, 0, 0, 6243, 6244, + 5, 95, 0, 0, 6244, 6245, 7, 16, 0, 0, 6245, 6246, 7, 17, 0, 0, 6246, 6247, + 7, 15, 0, 0, 6247, 6248, 7, 10, 0, 0, 6248, 6249, 7, 9, 0, 0, 6249, 6250, + 7, 16, 0, 0, 6250, 6251, 7, 5, 0, 0, 6251, 6252, 7, 15, 0, 0, 6252, 6253, + 7, 24, 0, 0, 6253, 6254, 7, 16, 0, 0, 6254, 6255, 7, 11, 0, 0, 6255, 1270, + 1, 0, 0, 0, 6256, 6257, 7, 7, 0, 0, 6257, 6258, 7, 19, 0, 0, 6258, 6259, + 7, 29, 0, 0, 6259, 1272, 1, 0, 0, 0, 6260, 6261, 7, 9, 0, 0, 6261, 6262, + 7, 16, 0, 0, 6262, 6263, 7, 5, 0, 0, 6263, 6264, 7, 16, 0, 0, 6264, 6265, + 7, 10, 0, 0, 6265, 6266, 7, 15, 0, 0, 6266, 6267, 7, 10, 0, 0, 6267, 6268, + 7, 7, 0, 0, 6268, 6269, 7, 16, 0, 0, 6269, 6270, 5, 95, 0, 0, 6270, 6271, + 7, 16, 0, 0, 6271, 6272, 7, 17, 0, 0, 6272, 6273, 7, 15, 0, 0, 6273, 6274, + 7, 10, 0, 0, 6274, 6275, 7, 9, 0, 0, 6275, 6276, 7, 16, 0, 0, 6276, 6277, + 7, 5, 0, 0, 6277, 6278, 7, 15, 0, 0, 6278, 6279, 7, 24, 0, 0, 6279, 1274, + 1, 0, 0, 0, 6280, 6281, 7, 16, 0, 0, 6281, 6282, 7, 17, 0, 0, 6282, 6283, + 7, 15, 0, 0, 6283, 6284, 7, 10, 0, 0, 6284, 6285, 7, 19, 0, 0, 6285, 6286, + 7, 25, 0, 0, 6286, 6287, 7, 12, 0, 0, 6287, 6288, 7, 5, 0, 0, 6288, 6289, + 7, 8, 0, 0, 6289, 1276, 1, 0, 0, 0, 6290, 6291, 7, 16, 0, 0, 6291, 6292, + 7, 13, 0, 0, 6292, 6293, 7, 5, 0, 0, 6293, 6294, 7, 7, 0, 0, 6294, 6295, + 7, 9, 0, 0, 6295, 6296, 7, 5, 0, 0, 6296, 6297, 7, 14, 0, 0, 6297, 6298, + 7, 16, 0, 0, 6298, 6299, 7, 17, 0, 0, 6299, 6300, 7, 19, 0, 0, 6300, 6301, + 7, 7, 0, 0, 6301, 6302, 5, 95, 0, 0, 6302, 6303, 7, 16, 0, 0, 6303, 6304, + 7, 17, 0, 0, 6304, 6305, 7, 15, 0, 0, 6305, 6306, 7, 10, 0, 0, 6306, 6307, + 7, 9, 0, 0, 6307, 6308, 7, 16, 0, 0, 6308, 6309, 7, 5, 0, 0, 6309, 6310, + 7, 15, 0, 0, 6310, 6311, 7, 24, 0, 0, 6311, 1278, 1, 0, 0, 0, 6312, 6313, + 7, 16, 0, 0, 6313, 6314, 7, 19, 0, 0, 6314, 6315, 5, 95, 0, 0, 6315, 6316, + 7, 16, 0, 0, 6316, 6317, 7, 17, 0, 0, 6317, 6318, 7, 15, 0, 0, 6318, 6319, + 7, 10, 0, 0, 6319, 6320, 7, 9, 0, 0, 6320, 6321, 7, 16, 0, 0, 6321, 6322, + 7, 5, 0, 0, 6322, 6323, 7, 15, 0, 0, 6323, 6324, 7, 24, 0, 0, 6324, 1280, + 1, 0, 0, 0, 6325, 6326, 7, 16, 0, 0, 6326, 6327, 7, 19, 0, 0, 6327, 6328, + 5, 95, 0, 0, 6328, 6329, 7, 14, 0, 0, 6329, 6330, 7, 20, 0, 0, 6330, 6331, + 7, 5, 0, 0, 6331, 6332, 7, 13, 0, 0, 6332, 1282, 1, 0, 0, 0, 6333, 6334, + 7, 16, 0, 0, 6334, 6335, 7, 19, 0, 0, 6335, 6336, 5, 95, 0, 0, 6336, 6337, + 7, 12, 0, 0, 6337, 6338, 7, 5, 0, 0, 6338, 6339, 7, 16, 0, 0, 6339, 6340, + 7, 10, 0, 0, 6340, 1284, 1, 0, 0, 0, 6341, 6342, 7, 16, 0, 0, 6342, 6343, + 7, 19, 0, 0, 6343, 6344, 5, 95, 0, 0, 6344, 6345, 7, 7, 0, 0, 6345, 6346, + 7, 22, 0, 0, 6346, 6347, 7, 15, 0, 0, 6347, 6348, 7, 18, 0, 0, 6348, 6349, + 7, 10, 0, 0, 6349, 6350, 7, 13, 0, 0, 6350, 1286, 1, 0, 0, 0, 6351, 6352, + 7, 10, 0, 0, 6352, 6353, 7, 7, 0, 0, 6353, 6354, 7, 14, 0, 0, 6354, 6355, + 7, 19, 0, 0, 6355, 6356, 7, 12, 0, 0, 6356, 6357, 7, 10, 0, 0, 6357, 1288, + 1, 0, 0, 0, 6358, 6359, 7, 12, 0, 0, 6359, 6360, 7, 17, 0, 0, 6360, 6361, + 7, 9, 0, 0, 6361, 6362, 7, 16, 0, 0, 6362, 6363, 7, 21, 0, 0, 6363, 6364, + 7, 10, 0, 0, 6364, 6365, 7, 8, 0, 0, 6365, 1290, 1, 0, 0, 0, 6366, 6367, + 7, 9, 0, 0, 6367, 6368, 7, 19, 0, 0, 6368, 6369, 7, 13, 0, 0, 6369, 6370, + 7, 16, 0, 0, 6370, 6371, 7, 21, 0, 0, 6371, 6372, 7, 10, 0, 0, 6372, 6373, + 7, 8, 0, 0, 6373, 1292, 1, 0, 0, 0, 6374, 6375, 7, 14, 0, 0, 6375, 6376, + 7, 5, 0, 0, 6376, 6377, 7, 9, 0, 0, 6377, 6378, 7, 10, 0, 0, 6378, 6379, + 5, 95, 0, 0, 6379, 6380, 7, 9, 0, 0, 6380, 6381, 7, 10, 0, 0, 6381, 6382, + 7, 7, 0, 0, 6382, 6383, 7, 9, 0, 0, 6383, 6384, 7, 17, 0, 0, 6384, 6385, + 7, 16, 0, 0, 6385, 6386, 7, 17, 0, 0, 6386, 6387, 7, 27, 0, 0, 6387, 6388, + 7, 10, 0, 0, 6388, 1294, 1, 0, 0, 0, 6389, 6390, 7, 14, 0, 0, 6390, 6391, + 7, 5, 0, 0, 6391, 6392, 7, 9, 0, 0, 6392, 6393, 7, 10, 0, 0, 6393, 6394, + 5, 95, 0, 0, 6394, 6395, 7, 17, 0, 0, 6395, 6396, 7, 7, 0, 0, 6396, 6397, + 7, 9, 0, 0, 6397, 6398, 7, 10, 0, 0, 6398, 6399, 7, 7, 0, 0, 6399, 6400, + 7, 9, 0, 0, 6400, 6401, 7, 17, 0, 0, 6401, 6402, 7, 16, 0, 0, 6402, 6403, + 7, 17, 0, 0, 6403, 6404, 7, 27, 0, 0, 6404, 6405, 7, 10, 0, 0, 6405, 1296, + 1, 0, 0, 0, 6406, 6410, 3, 1299, 647, 0, 6407, 6409, 3, 1301, 648, 0, 6408, + 6407, 1, 0, 0, 0, 6409, 6412, 1, 0, 0, 0, 6410, 6408, 1, 0, 0, 0, 6410, + 6411, 1, 0, 0, 0, 6411, 1298, 1, 0, 0, 0, 6412, 6410, 1, 0, 0, 0, 6413, + 6420, 7, 31, 0, 0, 6414, 6415, 7, 32, 0, 0, 6415, 6420, 4, 647, 6, 0, 6416, + 6417, 7, 33, 0, 0, 6417, 6418, 7, 34, 0, 0, 6418, 6420, 4, 647, 7, 0, 6419, + 6413, 1, 0, 0, 0, 6419, 6414, 1, 0, 0, 0, 6419, 6416, 1, 0, 0, 0, 6420, + 1300, 1, 0, 0, 0, 6421, 6424, 3, 1303, 649, 0, 6422, 6424, 5, 36, 0, 0, + 6423, 6421, 1, 0, 0, 0, 6423, 6422, 1, 0, 0, 0, 6424, 1302, 1, 0, 0, 0, + 6425, 6428, 3, 1299, 647, 0, 6426, 6428, 7, 0, 0, 0, 6427, 6425, 1, 0, + 0, 0, 6427, 6426, 1, 0, 0, 0, 6428, 1304, 1, 0, 0, 0, 6429, 6430, 3, 1307, + 651, 0, 6430, 6431, 5, 34, 0, 0, 6431, 1306, 1, 0, 0, 0, 6432, 6438, 5, + 34, 0, 0, 6433, 6434, 5, 34, 0, 0, 6434, 6437, 5, 34, 0, 0, 6435, 6437, + 8, 35, 0, 0, 6436, 6433, 1, 0, 0, 0, 6436, 6435, 1, 0, 0, 0, 6437, 6440, + 1, 0, 0, 0, 6438, 6436, 1, 0, 0, 0, 6438, 6439, 1, 0, 0, 0, 6439, 1308, + 1, 0, 0, 0, 6440, 6438, 1, 0, 0, 0, 6441, 6442, 3, 1311, 653, 0, 6442, + 6443, 5, 34, 0, 0, 6443, 1310, 1, 0, 0, 0, 6444, 6450, 5, 34, 0, 0, 6445, + 6446, 5, 34, 0, 0, 6446, 6449, 5, 34, 0, 0, 6447, 6449, 8, 36, 0, 0, 6448, + 6445, 1, 0, 0, 0, 6448, 6447, 1, 0, 0, 0, 6449, 6452, 1, 0, 0, 0, 6450, + 6448, 1, 0, 0, 0, 6450, 6451, 1, 0, 0, 0, 6451, 1312, 1, 0, 0, 0, 6452, + 6450, 1, 0, 0, 0, 6453, 6454, 7, 22, 0, 0, 6454, 6455, 5, 38, 0, 0, 6455, + 6456, 3, 1305, 650, 0, 6456, 1314, 1, 0, 0, 0, 6457, 6458, 7, 22, 0, 0, + 6458, 6459, 5, 38, 0, 0, 6459, 6460, 3, 1307, 651, 0, 6460, 1316, 1, 0, + 0, 0, 6461, 6462, 7, 22, 0, 0, 6462, 6463, 5, 38, 0, 0, 6463, 6464, 3, + 1309, 652, 0, 6464, 1318, 1, 0, 0, 0, 6465, 6466, 7, 22, 0, 0, 6466, 6467, + 5, 38, 0, 0, 6467, 6468, 3, 1311, 653, 0, 6468, 1320, 1, 0, 0, 0, 6469, + 6470, 3, 1323, 659, 0, 6470, 6471, 5, 39, 0, 0, 6471, 1322, 1, 0, 0, 0, + 6472, 6478, 5, 39, 0, 0, 6473, 6474, 5, 39, 0, 0, 6474, 6477, 5, 39, 0, + 0, 6475, 6477, 8, 37, 0, 0, 6476, 6473, 1, 0, 0, 0, 6476, 6475, 1, 0, 0, + 0, 6477, 6480, 1, 0, 0, 0, 6478, 6476, 1, 0, 0, 0, 6478, 6479, 1, 0, 0, + 0, 6479, 1324, 1, 0, 0, 0, 6480, 6478, 1, 0, 0, 0, 6481, 6482, 7, 10, 0, + 0, 6482, 6483, 5, 39, 0, 0, 6483, 6484, 1, 0, 0, 0, 6484, 6485, 6, 660, + 2, 0, 6485, 6486, 6, 660, 3, 0, 6486, 1326, 1, 0, 0, 0, 6487, 6488, 3, + 1329, 662, 0, 6488, 6489, 5, 39, 0, 0, 6489, 1328, 1, 0, 0, 0, 6490, 6491, + 7, 22, 0, 0, 6491, 6492, 5, 38, 0, 0, 6492, 6493, 3, 1323, 659, 0, 6493, + 1330, 1, 0, 0, 0, 6494, 6496, 5, 36, 0, 0, 6495, 6497, 3, 1333, 664, 0, + 6496, 6495, 1, 0, 0, 0, 6496, 6497, 1, 0, 0, 0, 6497, 6498, 1, 0, 0, 0, + 6498, 6499, 5, 36, 0, 0, 6499, 6500, 6, 663, 4, 0, 6500, 6501, 1, 0, 0, + 0, 6501, 6502, 6, 663, 5, 0, 6502, 1332, 1, 0, 0, 0, 6503, 6507, 3, 1299, + 647, 0, 6504, 6506, 3, 1303, 649, 0, 6505, 6504, 1, 0, 0, 0, 6506, 6509, + 1, 0, 0, 0, 6507, 6505, 1, 0, 0, 0, 6507, 6508, 1, 0, 0, 0, 6508, 1334, + 1, 0, 0, 0, 6509, 6507, 1, 0, 0, 0, 6510, 6511, 3, 1337, 666, 0, 6511, + 6512, 5, 39, 0, 0, 6512, 1336, 1, 0, 0, 0, 6513, 6514, 7, 18, 0, 0, 6514, + 6518, 5, 39, 0, 0, 6515, 6517, 7, 38, 0, 0, 6516, 6515, 1, 0, 0, 0, 6517, + 6520, 1, 0, 0, 0, 6518, 6516, 1, 0, 0, 0, 6518, 6519, 1, 0, 0, 0, 6519, + 1338, 1, 0, 0, 0, 6520, 6518, 1, 0, 0, 0, 6521, 6522, 3, 1341, 668, 0, + 6522, 6523, 5, 39, 0, 0, 6523, 1340, 1, 0, 0, 0, 6524, 6525, 7, 18, 0, + 0, 6525, 6526, 3, 1323, 659, 0, 6526, 1342, 1, 0, 0, 0, 6527, 6528, 3, + 1345, 670, 0, 6528, 6529, 5, 39, 0, 0, 6529, 1344, 1, 0, 0, 0, 6530, 6531, + 7, 26, 0, 0, 6531, 6535, 5, 39, 0, 0, 6532, 6534, 7, 39, 0, 0, 6533, 6532, + 1, 0, 0, 0, 6534, 6537, 1, 0, 0, 0, 6535, 6533, 1, 0, 0, 0, 6535, 6536, + 1, 0, 0, 0, 6536, 1346, 1, 0, 0, 0, 6537, 6535, 1, 0, 0, 0, 6538, 6539, + 3, 1349, 672, 0, 6539, 6540, 5, 39, 0, 0, 6540, 1348, 1, 0, 0, 0, 6541, + 6542, 7, 26, 0, 0, 6542, 6543, 3, 1323, 659, 0, 6543, 1350, 1, 0, 0, 0, + 6544, 6545, 3, 1357, 676, 0, 6545, 1352, 1, 0, 0, 0, 6546, 6547, 3, 1357, + 676, 0, 6547, 6548, 5, 46, 0, 0, 6548, 6549, 5, 46, 0, 0, 6549, 6550, 1, + 0, 0, 0, 6550, 6551, 6, 674, 6, 0, 6551, 1354, 1, 0, 0, 0, 6552, 6553, + 3, 1357, 676, 0, 6553, 6555, 5, 46, 0, 0, 6554, 6556, 3, 1357, 676, 0, + 6555, 6554, 1, 0, 0, 0, 6555, 6556, 1, 0, 0, 0, 6556, 6562, 1, 0, 0, 0, + 6557, 6559, 7, 10, 0, 0, 6558, 6560, 7, 1, 0, 0, 6559, 6558, 1, 0, 0, 0, + 6559, 6560, 1, 0, 0, 0, 6560, 6561, 1, 0, 0, 0, 6561, 6563, 3, 1357, 676, + 0, 6562, 6557, 1, 0, 0, 0, 6562, 6563, 1, 0, 0, 0, 6563, 6581, 1, 0, 0, + 0, 6564, 6565, 5, 46, 0, 0, 6565, 6571, 3, 1357, 676, 0, 6566, 6568, 7, + 10, 0, 0, 6567, 6569, 7, 1, 0, 0, 6568, 6567, 1, 0, 0, 0, 6568, 6569, 1, + 0, 0, 0, 6569, 6570, 1, 0, 0, 0, 6570, 6572, 3, 1357, 676, 0, 6571, 6566, + 1, 0, 0, 0, 6571, 6572, 1, 0, 0, 0, 6572, 6581, 1, 0, 0, 0, 6573, 6574, + 3, 1357, 676, 0, 6574, 6576, 7, 10, 0, 0, 6575, 6577, 7, 1, 0, 0, 6576, + 6575, 1, 0, 0, 0, 6576, 6577, 1, 0, 0, 0, 6577, 6578, 1, 0, 0, 0, 6578, + 6579, 3, 1357, 676, 0, 6579, 6581, 1, 0, 0, 0, 6580, 6552, 1, 0, 0, 0, + 6580, 6564, 1, 0, 0, 0, 6580, 6573, 1, 0, 0, 0, 6581, 1356, 1, 0, 0, 0, + 6582, 6584, 7, 0, 0, 0, 6583, 6582, 1, 0, 0, 0, 6584, 6585, 1, 0, 0, 0, + 6585, 6583, 1, 0, 0, 0, 6585, 6586, 1, 0, 0, 0, 6586, 1358, 1, 0, 0, 0, + 6587, 6588, 5, 58, 0, 0, 6588, 6592, 7, 40, 0, 0, 6589, 6591, 7, 41, 0, + 0, 6590, 6589, 1, 0, 0, 0, 6591, 6594, 1, 0, 0, 0, 6592, 6590, 1, 0, 0, + 0, 6592, 6593, 1, 0, 0, 0, 6593, 1360, 1, 0, 0, 0, 6594, 6592, 1, 0, 0, + 0, 6595, 6596, 5, 58, 0, 0, 6596, 6597, 5, 34, 0, 0, 6597, 6605, 1, 0, + 0, 0, 6598, 6599, 5, 92, 0, 0, 6599, 6604, 9, 0, 0, 0, 6600, 6601, 5, 34, + 0, 0, 6601, 6604, 5, 34, 0, 0, 6602, 6604, 8, 42, 0, 0, 6603, 6598, 1, + 0, 0, 0, 6603, 6600, 1, 0, 0, 0, 6603, 6602, 1, 0, 0, 0, 6604, 6607, 1, + 0, 0, 0, 6605, 6603, 1, 0, 0, 0, 6605, 6606, 1, 0, 0, 0, 6606, 6608, 1, + 0, 0, 0, 6607, 6605, 1, 0, 0, 0, 6608, 6609, 5, 34, 0, 0, 6609, 1362, 1, + 0, 0, 0, 6610, 6611, 7, 43, 0, 0, 6611, 6612, 1, 0, 0, 0, 6612, 6613, 6, + 679, 7, 0, 6613, 1364, 1, 0, 0, 0, 6614, 6616, 5, 13, 0, 0, 6615, 6617, + 5, 10, 0, 0, 6616, 6615, 1, 0, 0, 0, 6616, 6617, 1, 0, 0, 0, 6617, 6620, + 1, 0, 0, 0, 6618, 6620, 5, 10, 0, 0, 6619, 6614, 1, 0, 0, 0, 6619, 6618, + 1, 0, 0, 0, 6620, 6621, 1, 0, 0, 0, 6621, 6622, 6, 680, 7, 0, 6622, 1366, + 1, 0, 0, 0, 6623, 6624, 5, 45, 0, 0, 6624, 6625, 5, 45, 0, 0, 6625, 6629, + 1, 0, 0, 0, 6626, 6628, 8, 44, 0, 0, 6627, 6626, 1, 0, 0, 0, 6628, 6631, + 1, 0, 0, 0, 6629, 6627, 1, 0, 0, 0, 6629, 6630, 1, 0, 0, 0, 6630, 6632, + 1, 0, 0, 0, 6631, 6629, 1, 0, 0, 0, 6632, 6633, 6, 681, 7, 0, 6633, 1368, + 1, 0, 0, 0, 6634, 6635, 5, 47, 0, 0, 6635, 6636, 5, 42, 0, 0, 6636, 6659, + 1, 0, 0, 0, 6637, 6639, 5, 47, 0, 0, 6638, 6637, 1, 0, 0, 0, 6639, 6642, + 1, 0, 0, 0, 6640, 6638, 1, 0, 0, 0, 6640, 6641, 1, 0, 0, 0, 6641, 6643, + 1, 0, 0, 0, 6642, 6640, 1, 0, 0, 0, 6643, 6658, 3, 1369, 682, 0, 6644, + 6658, 8, 45, 0, 0, 6645, 6647, 5, 47, 0, 0, 6646, 6645, 1, 0, 0, 0, 6647, + 6648, 1, 0, 0, 0, 6648, 6646, 1, 0, 0, 0, 6648, 6649, 1, 0, 0, 0, 6649, + 6650, 1, 0, 0, 0, 6650, 6658, 8, 45, 0, 0, 6651, 6653, 5, 42, 0, 0, 6652, + 6651, 1, 0, 0, 0, 6653, 6654, 1, 0, 0, 0, 6654, 6652, 1, 0, 0, 0, 6654, + 6655, 1, 0, 0, 0, 6655, 6656, 1, 0, 0, 0, 6656, 6658, 8, 45, 0, 0, 6657, + 6640, 1, 0, 0, 0, 6657, 6644, 1, 0, 0, 0, 6657, 6646, 1, 0, 0, 0, 6657, + 6652, 1, 0, 0, 0, 6658, 6661, 1, 0, 0, 0, 6659, 6657, 1, 0, 0, 0, 6659, + 6660, 1, 0, 0, 0, 6660, 6665, 1, 0, 0, 0, 6661, 6659, 1, 0, 0, 0, 6662, + 6664, 5, 42, 0, 0, 6663, 6662, 1, 0, 0, 0, 6664, 6667, 1, 0, 0, 0, 6665, + 6663, 1, 0, 0, 0, 6665, 6666, 1, 0, 0, 0, 6666, 6668, 1, 0, 0, 0, 6667, + 6665, 1, 0, 0, 0, 6668, 6669, 5, 42, 0, 0, 6669, 6670, 5, 47, 0, 0, 6670, + 6671, 1, 0, 0, 0, 6671, 6672, 6, 682, 7, 0, 6672, 1370, 1, 0, 0, 0, 6673, + 6674, 5, 47, 0, 0, 6674, 6675, 5, 42, 0, 0, 6675, 6700, 1, 0, 0, 0, 6676, + 6678, 5, 47, 0, 0, 6677, 6676, 1, 0, 0, 0, 6678, 6681, 1, 0, 0, 0, 6679, + 6677, 1, 0, 0, 0, 6679, 6680, 1, 0, 0, 0, 6680, 6682, 1, 0, 0, 0, 6681, + 6679, 1, 0, 0, 0, 6682, 6699, 3, 1369, 682, 0, 6683, 6699, 8, 45, 0, 0, + 6684, 6686, 5, 47, 0, 0, 6685, 6684, 1, 0, 0, 0, 6686, 6687, 1, 0, 0, 0, + 6687, 6685, 1, 0, 0, 0, 6687, 6688, 1, 0, 0, 0, 6688, 6689, 1, 0, 0, 0, + 6689, 6697, 8, 45, 0, 0, 6690, 6692, 5, 42, 0, 0, 6691, 6690, 1, 0, 0, + 0, 6692, 6693, 1, 0, 0, 0, 6693, 6691, 1, 0, 0, 0, 6693, 6694, 1, 0, 0, + 0, 6694, 6695, 1, 0, 0, 0, 6695, 6697, 8, 45, 0, 0, 6696, 6685, 1, 0, 0, + 0, 6696, 6691, 1, 0, 0, 0, 6697, 6699, 1, 0, 0, 0, 6698, 6679, 1, 0, 0, + 0, 6698, 6683, 1, 0, 0, 0, 6698, 6696, 1, 0, 0, 0, 6699, 6702, 1, 0, 0, + 0, 6700, 6698, 1, 0, 0, 0, 6700, 6701, 1, 0, 0, 0, 6701, 6720, 1, 0, 0, + 0, 6702, 6700, 1, 0, 0, 0, 6703, 6705, 5, 47, 0, 0, 6704, 6703, 1, 0, 0, + 0, 6705, 6706, 1, 0, 0, 0, 6706, 6704, 1, 0, 0, 0, 6706, 6707, 1, 0, 0, + 0, 6707, 6721, 1, 0, 0, 0, 6708, 6710, 5, 42, 0, 0, 6709, 6708, 1, 0, 0, + 0, 6710, 6711, 1, 0, 0, 0, 6711, 6709, 1, 0, 0, 0, 6711, 6712, 1, 0, 0, + 0, 6712, 6721, 1, 0, 0, 0, 6713, 6715, 5, 47, 0, 0, 6714, 6713, 1, 0, 0, + 0, 6715, 6718, 1, 0, 0, 0, 6716, 6714, 1, 0, 0, 0, 6716, 6717, 1, 0, 0, + 0, 6717, 6719, 1, 0, 0, 0, 6718, 6716, 1, 0, 0, 0, 6719, 6721, 3, 1371, + 683, 0, 6720, 6704, 1, 0, 0, 0, 6720, 6709, 1, 0, 0, 0, 6720, 6716, 1, + 0, 0, 0, 6720, 6721, 1, 0, 0, 0, 6721, 6722, 1, 0, 0, 0, 6722, 6723, 6, + 683, 8, 0, 6723, 1372, 1, 0, 0, 0, 6724, 6736, 5, 92, 0, 0, 6725, 6735, + 8, 46, 0, 0, 6726, 6730, 5, 34, 0, 0, 6727, 6729, 8, 47, 0, 0, 6728, 6727, + 1, 0, 0, 0, 6729, 6732, 1, 0, 0, 0, 6730, 6728, 1, 0, 0, 0, 6730, 6731, + 1, 0, 0, 0, 6731, 6733, 1, 0, 0, 0, 6732, 6730, 1, 0, 0, 0, 6733, 6735, + 5, 34, 0, 0, 6734, 6725, 1, 0, 0, 0, 6734, 6726, 1, 0, 0, 0, 6735, 6738, + 1, 0, 0, 0, 6736, 6734, 1, 0, 0, 0, 6736, 6737, 1, 0, 0, 0, 6737, 6746, + 1, 0, 0, 0, 6738, 6736, 1, 0, 0, 0, 6739, 6743, 5, 34, 0, 0, 6740, 6742, + 8, 47, 0, 0, 6741, 6740, 1, 0, 0, 0, 6742, 6745, 1, 0, 0, 0, 6743, 6741, + 1, 0, 0, 0, 6743, 6744, 1, 0, 0, 0, 6744, 6747, 1, 0, 0, 0, 6745, 6743, + 1, 0, 0, 0, 6746, 6739, 1, 0, 0, 0, 6746, 6747, 1, 0, 0, 0, 6747, 1374, + 1, 0, 0, 0, 6748, 6749, 5, 92, 0, 0, 6749, 6750, 5, 92, 0, 0, 6750, 1376, + 1, 0, 0, 0, 6751, 6752, 9, 0, 0, 0, 6752, 1378, 1, 0, 0, 0, 6753, 6754, + 3, 1383, 689, 0, 6754, 6755, 5, 39, 0, 0, 6755, 6756, 1, 0, 0, 0, 6756, + 6757, 6, 687, 9, 0, 6757, 1380, 1, 0, 0, 0, 6758, 6760, 3, 1383, 689, 0, + 6759, 6761, 5, 92, 0, 0, 6760, 6759, 1, 0, 0, 0, 6760, 6761, 1, 0, 0, 0, + 6761, 6762, 1, 0, 0, 0, 6762, 6763, 5, 0, 0, 1, 6763, 1382, 1, 0, 0, 0, + 6764, 6765, 5, 39, 0, 0, 6765, 6788, 5, 39, 0, 0, 6766, 6784, 5, 92, 0, + 0, 6767, 6768, 5, 120, 0, 0, 6768, 6785, 7, 39, 0, 0, 6769, 6770, 5, 117, + 0, 0, 6770, 6771, 7, 39, 0, 0, 6771, 6772, 7, 39, 0, 0, 6772, 6773, 7, + 39, 0, 0, 6773, 6785, 7, 39, 0, 0, 6774, 6775, 5, 85, 0, 0, 6775, 6776, + 7, 39, 0, 0, 6776, 6777, 7, 39, 0, 0, 6777, 6778, 7, 39, 0, 0, 6778, 6779, + 7, 39, 0, 0, 6779, 6780, 7, 39, 0, 0, 6780, 6781, 7, 39, 0, 0, 6781, 6782, + 7, 39, 0, 0, 6782, 6785, 7, 39, 0, 0, 6783, 6785, 8, 48, 0, 0, 6784, 6767, + 1, 0, 0, 0, 6784, 6769, 1, 0, 0, 0, 6784, 6774, 1, 0, 0, 0, 6784, 6783, + 1, 0, 0, 0, 6785, 6788, 1, 0, 0, 0, 6786, 6788, 8, 49, 0, 0, 6787, 6764, + 1, 0, 0, 0, 6787, 6766, 1, 0, 0, 0, 6787, 6786, 1, 0, 0, 0, 6788, 6791, + 1, 0, 0, 0, 6789, 6787, 1, 0, 0, 0, 6789, 6790, 1, 0, 0, 0, 6790, 1384, + 1, 0, 0, 0, 6791, 6789, 1, 0, 0, 0, 6792, 6793, 3, 1389, 692, 0, 6793, + 6794, 5, 39, 0, 0, 6794, 6795, 1, 0, 0, 0, 6795, 6796, 6, 690, 9, 0, 6796, + 1386, 1, 0, 0, 0, 6797, 6799, 3, 1389, 692, 0, 6798, 6800, 5, 92, 0, 0, + 6799, 6798, 1, 0, 0, 0, 6799, 6800, 1, 0, 0, 0, 6800, 6801, 1, 0, 0, 0, + 6801, 6802, 5, 0, 0, 1, 6802, 1388, 1, 0, 0, 0, 6803, 6804, 5, 39, 0, 0, + 6804, 6809, 5, 39, 0, 0, 6805, 6806, 5, 92, 0, 0, 6806, 6809, 9, 0, 0, + 0, 6807, 6809, 8, 49, 0, 0, 6808, 6803, 1, 0, 0, 0, 6808, 6805, 1, 0, 0, + 0, 6808, 6807, 1, 0, 0, 0, 6809, 6812, 1, 0, 0, 0, 6810, 6808, 1, 0, 0, + 0, 6810, 6811, 1, 0, 0, 0, 6811, 1390, 1, 0, 0, 0, 6812, 6810, 1, 0, 0, + 0, 6813, 6814, 3, 1363, 679, 0, 6814, 6815, 1, 0, 0, 0, 6815, 6816, 6, + 693, 10, 0, 6816, 6817, 6, 693, 7, 0, 6817, 1392, 1, 0, 0, 0, 6818, 6819, + 3, 1365, 680, 0, 6819, 6820, 1, 0, 0, 0, 6820, 6821, 6, 694, 11, 0, 6821, + 6822, 6, 694, 7, 0, 6822, 6823, 6, 694, 12, 0, 6823, 1394, 1, 0, 0, 0, + 6824, 6825, 6, 695, 13, 0, 6825, 6826, 1, 0, 0, 0, 6826, 6827, 6, 695, + 14, 0, 6827, 6828, 6, 695, 15, 0, 6828, 1396, 1, 0, 0, 0, 6829, 6830, 3, + 1363, 679, 0, 6830, 6831, 1, 0, 0, 0, 6831, 6832, 6, 696, 10, 0, 6832, + 6833, 6, 696, 7, 0, 6833, 1398, 1, 0, 0, 0, 6834, 6835, 3, 1365, 680, 0, + 6835, 6836, 1, 0, 0, 0, 6836, 6837, 6, 697, 11, 0, 6837, 6838, 6, 697, + 7, 0, 6838, 1400, 1, 0, 0, 0, 6839, 6840, 5, 39, 0, 0, 6840, 6841, 1, 0, + 0, 0, 6841, 6842, 6, 698, 2, 0, 6842, 6843, 6, 698, 16, 0, 6843, 1402, + 1, 0, 0, 0, 6844, 6845, 6, 699, 17, 0, 6845, 6846, 1, 0, 0, 0, 6846, 6847, + 6, 699, 14, 0, 6847, 6848, 6, 699, 15, 0, 6848, 1404, 1, 0, 0, 0, 6849, + 6851, 8, 50, 0, 0, 6850, 6849, 1, 0, 0, 0, 6851, 6852, 1, 0, 0, 0, 6852, + 6850, 1, 0, 0, 0, 6852, 6853, 1, 0, 0, 0, 6853, 6862, 1, 0, 0, 0, 6854, + 6858, 5, 36, 0, 0, 6855, 6857, 8, 50, 0, 0, 6856, 6855, 1, 0, 0, 0, 6857, + 6860, 1, 0, 0, 0, 6858, 6856, 1, 0, 0, 0, 6858, 6859, 1, 0, 0, 0, 6859, + 6862, 1, 0, 0, 0, 6860, 6858, 1, 0, 0, 0, 6861, 6850, 1, 0, 0, 0, 6861, + 6854, 1, 0, 0, 0, 6862, 1406, 1, 0, 0, 0, 6863, 6865, 5, 36, 0, 0, 6864, + 6866, 3, 1333, 664, 0, 6865, 6864, 1, 0, 0, 0, 6865, 6866, 1, 0, 0, 0, + 6866, 6867, 1, 0, 0, 0, 6867, 6868, 5, 36, 0, 0, 6868, 6869, 1, 0, 0, 0, + 6869, 6870, 4, 701, 8, 0, 6870, 6871, 6, 701, 18, 0, 6871, 6872, 1, 0, + 0, 0, 6872, 6873, 6, 701, 15, 0, 6873, 1408, 1, 0, 0, 0, 77, 0, 1, 2, 3, + 4, 1476, 1482, 1484, 1489, 1493, 1495, 1498, 1507, 1509, 1514, 1519, 1521, + 6410, 6419, 6423, 6427, 6436, 6438, 6448, 6450, 6476, 6478, 6496, 6507, + 6518, 6535, 6555, 6559, 6562, 6568, 6571, 6576, 6580, 6585, 6592, 6603, + 6605, 6616, 6619, 6629, 6640, 6648, 6654, 6657, 6659, 6665, 6679, 6687, + 6693, 6696, 6698, 6700, 6706, 6711, 6716, 6720, 6730, 6734, 6736, 6743, + 6746, 6760, 6784, 6787, 6789, 6799, 6808, 6810, 6852, 6858, 6861, 6865, + 19, 1, 28, 0, 7, 29, 0, 3, 0, 0, 5, 1, 0, 1, 663, 1, 5, 4, 0, 1, 674, 2, + 0, 1, 0, 1, 683, 3, 2, 2, 0, 7, 670, 0, 7, 671, 0, 2, 3, 0, 1, 695, 4, + 6, 0, 0, 4, 0, 0, 2, 1, 0, 1, 699, 5, 1, 701, 6, + } + deserializer := antlr.NewATNDeserializer(nil) + staticData.atn = deserializer.Deserialize(staticData.serializedATN) + atn := staticData.atn + staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) + decisionToDFA := staticData.decisionToDFA + for index, state := range atn.DecisionToState { + decisionToDFA[index] = antlr.NewDFA(state, index) + } +} + +// PostgreSQLLexerInit initializes any static state used to implement PostgreSQLLexer. By default the +// static state used to implement the lexer is lazily initialized during the first call to +// NewPostgreSQLLexer(). You can call this function if you wish to initialize the static state ahead +// of time. +func PostgreSQLLexerInit() { + staticData := &PostgreSQLLexerLexerStaticData + staticData.once.Do(postgresqllexerLexerInit) +} + +// NewPostgreSQLLexer produces a new lexer instance for the optional input antlr.CharStream. +func NewPostgreSQLLexer(input antlr.CharStream) *PostgreSQLLexer { + PostgreSQLLexerInit() + l := new(PostgreSQLLexer) + l.BaseLexer = antlr.NewBaseLexer(input) + staticData := &PostgreSQLLexerLexerStaticData + l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + l.channelNames = staticData.ChannelNames + l.modeNames = staticData.ModeNames + l.RuleNames = staticData.RuleNames + l.LiteralNames = staticData.LiteralNames + l.SymbolicNames = staticData.SymbolicNames + l.GrammarFileName = "PostgreSQLLexer.g4" + // TODO: l.EOF = antlr.TokenEOF + + return l +} + +// PostgreSQLLexer tokens. +const ( + PostgreSQLLexerDollar = 1 + PostgreSQLLexerOPEN_PAREN = 2 + PostgreSQLLexerCLOSE_PAREN = 3 + PostgreSQLLexerOPEN_BRACKET = 4 + PostgreSQLLexerCLOSE_BRACKET = 5 + PostgreSQLLexerCOMMA = 6 + PostgreSQLLexerSEMI = 7 + PostgreSQLLexerCOLON = 8 + PostgreSQLLexerSTAR = 9 + PostgreSQLLexerEQUAL = 10 + PostgreSQLLexerDOT = 11 + PostgreSQLLexerPLUS = 12 + PostgreSQLLexerMINUS = 13 + PostgreSQLLexerSLASH = 14 + PostgreSQLLexerCARET = 15 + PostgreSQLLexerLT = 16 + PostgreSQLLexerGT = 17 + PostgreSQLLexerLESS_LESS = 18 + PostgreSQLLexerGREATER_GREATER = 19 + PostgreSQLLexerCOLON_EQUALS = 20 + PostgreSQLLexerLESS_EQUALS = 21 + PostgreSQLLexerEQUALS_GREATER = 22 + PostgreSQLLexerGREATER_EQUALS = 23 + PostgreSQLLexerDOT_DOT = 24 + PostgreSQLLexerNOT_EQUALS = 25 + PostgreSQLLexerTYPECAST = 26 + PostgreSQLLexerPERCENT = 27 + PostgreSQLLexerPARAM = 28 + PostgreSQLLexerOperator = 29 + PostgreSQLLexerALL = 30 + PostgreSQLLexerANALYSE = 31 + PostgreSQLLexerANALYZE = 32 + PostgreSQLLexerAND = 33 + PostgreSQLLexerANY = 34 + PostgreSQLLexerARRAY = 35 + PostgreSQLLexerAS = 36 + PostgreSQLLexerASC = 37 + PostgreSQLLexerASYMMETRIC = 38 + PostgreSQLLexerBOTH = 39 + PostgreSQLLexerCASE = 40 + PostgreSQLLexerCAST = 41 + PostgreSQLLexerCHECK = 42 + PostgreSQLLexerCOLLATE = 43 + PostgreSQLLexerCOLUMN = 44 + PostgreSQLLexerCONSTRAINT = 45 + PostgreSQLLexerCREATE = 46 + PostgreSQLLexerCURRENT_CATALOG = 47 + PostgreSQLLexerCURRENT_DATE = 48 + PostgreSQLLexerCURRENT_ROLE = 49 + PostgreSQLLexerCURRENT_TIME = 50 + PostgreSQLLexerCURRENT_TIMESTAMP = 51 + PostgreSQLLexerCURRENT_USER = 52 + PostgreSQLLexerDEFAULT = 53 + PostgreSQLLexerDEFERRABLE = 54 + PostgreSQLLexerDESC = 55 + PostgreSQLLexerDISTINCT = 56 + PostgreSQLLexerDO = 57 + PostgreSQLLexerELSE = 58 + PostgreSQLLexerEXCEPT = 59 + PostgreSQLLexerFALSE_P = 60 + PostgreSQLLexerFETCH = 61 + PostgreSQLLexerFOR = 62 + PostgreSQLLexerFOREIGN = 63 + PostgreSQLLexerFROM = 64 + PostgreSQLLexerGRANT = 65 + PostgreSQLLexerGROUP_P = 66 + PostgreSQLLexerHAVING = 67 + PostgreSQLLexerIN_P = 68 + PostgreSQLLexerINITIALLY = 69 + PostgreSQLLexerINTERSECT = 70 + PostgreSQLLexerINTO = 71 + PostgreSQLLexerLATERAL_P = 72 + PostgreSQLLexerLEADING = 73 + PostgreSQLLexerLIMIT = 74 + PostgreSQLLexerLOCALTIME = 75 + PostgreSQLLexerLOCALTIMESTAMP = 76 + PostgreSQLLexerNOT = 77 + PostgreSQLLexerNULL_P = 78 + PostgreSQLLexerOFFSET = 79 + PostgreSQLLexerON = 80 + PostgreSQLLexerONLY = 81 + PostgreSQLLexerOR = 82 + PostgreSQLLexerORDER = 83 + PostgreSQLLexerPLACING = 84 + PostgreSQLLexerPRIMARY = 85 + PostgreSQLLexerREFERENCES = 86 + PostgreSQLLexerRETURNING = 87 + PostgreSQLLexerSELECT = 88 + PostgreSQLLexerSESSION_USER = 89 + PostgreSQLLexerSOME = 90 + PostgreSQLLexerSYMMETRIC = 91 + PostgreSQLLexerTABLE = 92 + PostgreSQLLexerTHEN = 93 + PostgreSQLLexerTO = 94 + PostgreSQLLexerTRAILING = 95 + PostgreSQLLexerTRUE_P = 96 + PostgreSQLLexerUNION = 97 + PostgreSQLLexerUNIQUE = 98 + PostgreSQLLexerUSER = 99 + PostgreSQLLexerUSING = 100 + PostgreSQLLexerVARIADIC = 101 + PostgreSQLLexerWHEN = 102 + PostgreSQLLexerWHERE = 103 + PostgreSQLLexerWINDOW = 104 + PostgreSQLLexerWITH = 105 + PostgreSQLLexerAUTHORIZATION = 106 + PostgreSQLLexerBINARY = 107 + PostgreSQLLexerCOLLATION = 108 + PostgreSQLLexerCONCURRENTLY = 109 + PostgreSQLLexerCROSS = 110 + PostgreSQLLexerCURRENT_SCHEMA = 111 + PostgreSQLLexerFREEZE = 112 + PostgreSQLLexerFULL = 113 + PostgreSQLLexerILIKE = 114 + PostgreSQLLexerINNER_P = 115 + PostgreSQLLexerIS = 116 + PostgreSQLLexerISNULL = 117 + PostgreSQLLexerJOIN = 118 + PostgreSQLLexerLEFT = 119 + PostgreSQLLexerLIKE = 120 + PostgreSQLLexerNATURAL = 121 + PostgreSQLLexerNOTNULL = 122 + PostgreSQLLexerOUTER_P = 123 + PostgreSQLLexerOVER = 124 + PostgreSQLLexerOVERLAPS = 125 + PostgreSQLLexerRIGHT = 126 + PostgreSQLLexerSIMILAR = 127 + PostgreSQLLexerVERBOSE = 128 + PostgreSQLLexerABORT_P = 129 + PostgreSQLLexerABSOLUTE_P = 130 + PostgreSQLLexerACCESS = 131 + PostgreSQLLexerACTION = 132 + PostgreSQLLexerADD_P = 133 + PostgreSQLLexerADMIN = 134 + PostgreSQLLexerAFTER = 135 + PostgreSQLLexerAGGREGATE = 136 + PostgreSQLLexerALSO = 137 + PostgreSQLLexerALTER = 138 + PostgreSQLLexerALWAYS = 139 + PostgreSQLLexerASSERTION = 140 + PostgreSQLLexerASSIGNMENT = 141 + PostgreSQLLexerAT = 142 + PostgreSQLLexerATTRIBUTE = 143 + PostgreSQLLexerBACKWARD = 144 + PostgreSQLLexerBEFORE = 145 + PostgreSQLLexerBEGIN_P = 146 + PostgreSQLLexerBY = 147 + PostgreSQLLexerCACHE = 148 + PostgreSQLLexerCALLED = 149 + PostgreSQLLexerCASCADE = 150 + PostgreSQLLexerCASCADED = 151 + PostgreSQLLexerCATALOG = 152 + PostgreSQLLexerCHAIN = 153 + PostgreSQLLexerCHARACTERISTICS = 154 + PostgreSQLLexerCHECKPOINT = 155 + PostgreSQLLexerCLASS = 156 + PostgreSQLLexerCLOSE = 157 + PostgreSQLLexerCLUSTER = 158 + PostgreSQLLexerCOMMENT = 159 + PostgreSQLLexerCOMMENTS = 160 + PostgreSQLLexerCOMMIT = 161 + PostgreSQLLexerCOMMITTED = 162 + PostgreSQLLexerCONFIGURATION = 163 + PostgreSQLLexerCONNECTION = 164 + PostgreSQLLexerCONSTRAINTS = 165 + PostgreSQLLexerCONTENT_P = 166 + PostgreSQLLexerCONTINUE_P = 167 + PostgreSQLLexerCONVERSION_P = 168 + PostgreSQLLexerCOPY = 169 + PostgreSQLLexerCOST = 170 + PostgreSQLLexerCSV = 171 + PostgreSQLLexerCURSOR = 172 + PostgreSQLLexerCYCLE = 173 + PostgreSQLLexerDATA_P = 174 + PostgreSQLLexerDATABASE = 175 + PostgreSQLLexerDAY_P = 176 + PostgreSQLLexerDEALLOCATE = 177 + PostgreSQLLexerDECLARE = 178 + PostgreSQLLexerDEFAULTS = 179 + PostgreSQLLexerDEFERRED = 180 + PostgreSQLLexerDEFINER = 181 + PostgreSQLLexerDELETE_P = 182 + PostgreSQLLexerDELIMITER = 183 + PostgreSQLLexerDELIMITERS = 184 + PostgreSQLLexerDICTIONARY = 185 + PostgreSQLLexerDISABLE_P = 186 + PostgreSQLLexerDISCARD = 187 + PostgreSQLLexerDOCUMENT_P = 188 + PostgreSQLLexerDOMAIN_P = 189 + PostgreSQLLexerDOUBLE_P = 190 + PostgreSQLLexerDROP = 191 + PostgreSQLLexerEACH = 192 + PostgreSQLLexerENABLE_P = 193 + PostgreSQLLexerENCODING = 194 + PostgreSQLLexerENCRYPTED = 195 + PostgreSQLLexerENUM_P = 196 + PostgreSQLLexerESCAPE = 197 + PostgreSQLLexerEVENT = 198 + PostgreSQLLexerEXCLUDE = 199 + PostgreSQLLexerEXCLUDING = 200 + PostgreSQLLexerEXCLUSIVE = 201 + PostgreSQLLexerEXECUTE = 202 + PostgreSQLLexerEXPLAIN = 203 + PostgreSQLLexerEXTENSION = 204 + PostgreSQLLexerEXTERNAL = 205 + PostgreSQLLexerFAMILY = 206 + PostgreSQLLexerFIRST_P = 207 + PostgreSQLLexerFOLLOWING = 208 + PostgreSQLLexerFORCE = 209 + PostgreSQLLexerFORWARD = 210 + PostgreSQLLexerFUNCTION = 211 + PostgreSQLLexerFUNCTIONS = 212 + PostgreSQLLexerGLOBAL = 213 + PostgreSQLLexerGRANTED = 214 + PostgreSQLLexerHANDLER = 215 + PostgreSQLLexerHEADER_P = 216 + PostgreSQLLexerHOLD = 217 + PostgreSQLLexerHOUR_P = 218 + PostgreSQLLexerIDENTITY_P = 219 + PostgreSQLLexerIF_P = 220 + PostgreSQLLexerIMMEDIATE = 221 + PostgreSQLLexerIMMUTABLE = 222 + PostgreSQLLexerIMPLICIT_P = 223 + PostgreSQLLexerINCLUDING = 224 + PostgreSQLLexerINCREMENT = 225 + PostgreSQLLexerINDEX = 226 + PostgreSQLLexerINDEXES = 227 + PostgreSQLLexerINHERIT = 228 + PostgreSQLLexerINHERITS = 229 + PostgreSQLLexerINLINE_P = 230 + PostgreSQLLexerINSENSITIVE = 231 + PostgreSQLLexerINSERT = 232 + PostgreSQLLexerINSTEAD = 233 + PostgreSQLLexerINVOKER = 234 + PostgreSQLLexerISOLATION = 235 + PostgreSQLLexerKEY = 236 + PostgreSQLLexerLABEL = 237 + PostgreSQLLexerLANGUAGE = 238 + PostgreSQLLexerLARGE_P = 239 + PostgreSQLLexerLAST_P = 240 + PostgreSQLLexerLEAKPROOF = 241 + PostgreSQLLexerLEVEL = 242 + PostgreSQLLexerLISTEN = 243 + PostgreSQLLexerLOAD = 244 + PostgreSQLLexerLOCAL = 245 + PostgreSQLLexerLOCATION = 246 + PostgreSQLLexerLOCK_P = 247 + PostgreSQLLexerMAPPING = 248 + PostgreSQLLexerMATCH = 249 + PostgreSQLLexerMATCHED = 250 + PostgreSQLLexerMATERIALIZED = 251 + PostgreSQLLexerMAXVALUE = 252 + PostgreSQLLexerMERGE = 253 + PostgreSQLLexerMINUTE_P = 254 + PostgreSQLLexerMINVALUE = 255 + PostgreSQLLexerMODE = 256 + PostgreSQLLexerMONTH_P = 257 + PostgreSQLLexerMOVE = 258 + PostgreSQLLexerNAME_P = 259 + PostgreSQLLexerNAMES = 260 + PostgreSQLLexerNEXT = 261 + PostgreSQLLexerNO = 262 + PostgreSQLLexerNOTHING = 263 + PostgreSQLLexerNOTIFY = 264 + PostgreSQLLexerNOWAIT = 265 + PostgreSQLLexerNULLS_P = 266 + PostgreSQLLexerOBJECT_P = 267 + PostgreSQLLexerOF = 268 + PostgreSQLLexerOFF = 269 + PostgreSQLLexerOIDS = 270 + PostgreSQLLexerOPERATOR = 271 + PostgreSQLLexerOPTION = 272 + PostgreSQLLexerOPTIONS = 273 + PostgreSQLLexerOWNED = 274 + PostgreSQLLexerOWNER = 275 + PostgreSQLLexerPARSER = 276 + PostgreSQLLexerPARTIAL = 277 + PostgreSQLLexerPARTITION = 278 + PostgreSQLLexerPASSING = 279 + PostgreSQLLexerPASSWORD = 280 + PostgreSQLLexerPLANS = 281 + PostgreSQLLexerPRECEDING = 282 + PostgreSQLLexerPREPARE = 283 + PostgreSQLLexerPREPARED = 284 + PostgreSQLLexerPRESERVE = 285 + PostgreSQLLexerPRIOR = 286 + PostgreSQLLexerPRIVILEGES = 287 + PostgreSQLLexerPROCEDURAL = 288 + PostgreSQLLexerPROCEDURE = 289 + PostgreSQLLexerPROGRAM = 290 + PostgreSQLLexerQUOTE = 291 + PostgreSQLLexerRANGE = 292 + PostgreSQLLexerREAD = 293 + PostgreSQLLexerREASSIGN = 294 + PostgreSQLLexerRECHECK = 295 + PostgreSQLLexerRECURSIVE = 296 + PostgreSQLLexerREF = 297 + PostgreSQLLexerREFRESH = 298 + PostgreSQLLexerREINDEX = 299 + PostgreSQLLexerRELATIVE_P = 300 + PostgreSQLLexerRELEASE = 301 + PostgreSQLLexerRENAME = 302 + PostgreSQLLexerREPEATABLE = 303 + PostgreSQLLexerREPLACE = 304 + PostgreSQLLexerREPLICA = 305 + PostgreSQLLexerRESET = 306 + PostgreSQLLexerRESTART = 307 + PostgreSQLLexerRESTRICT = 308 + PostgreSQLLexerRETURNS = 309 + PostgreSQLLexerREVOKE = 310 + PostgreSQLLexerROLE = 311 + PostgreSQLLexerROLLBACK = 312 + PostgreSQLLexerROWS = 313 + PostgreSQLLexerRULE = 314 + PostgreSQLLexerSAVEPOINT = 315 + PostgreSQLLexerSCHEMA = 316 + PostgreSQLLexerSCROLL = 317 + PostgreSQLLexerSEARCH = 318 + PostgreSQLLexerSECOND_P = 319 + PostgreSQLLexerSECURITY = 320 + PostgreSQLLexerSEQUENCE = 321 + PostgreSQLLexerSEQUENCES = 322 + PostgreSQLLexerSERIALIZABLE = 323 + PostgreSQLLexerSERVER = 324 + PostgreSQLLexerSESSION = 325 + PostgreSQLLexerSET = 326 + PostgreSQLLexerSHARE = 327 + PostgreSQLLexerSHOW = 328 + PostgreSQLLexerSIMPLE = 329 + PostgreSQLLexerSNAPSHOT = 330 + PostgreSQLLexerSTABLE = 331 + PostgreSQLLexerSTANDALONE_P = 332 + PostgreSQLLexerSTART = 333 + PostgreSQLLexerSTATEMENT = 334 + PostgreSQLLexerSTATISTICS = 335 + PostgreSQLLexerSTDIN = 336 + PostgreSQLLexerSTDOUT = 337 + PostgreSQLLexerSTORAGE = 338 + PostgreSQLLexerSTRICT_P = 339 + PostgreSQLLexerSTRIP_P = 340 + PostgreSQLLexerSYSID = 341 + PostgreSQLLexerSYSTEM_P = 342 + PostgreSQLLexerTABLES = 343 + PostgreSQLLexerTABLESPACE = 344 + PostgreSQLLexerTEMP = 345 + PostgreSQLLexerTEMPLATE = 346 + PostgreSQLLexerTEMPORARY = 347 + PostgreSQLLexerTEXT_P = 348 + PostgreSQLLexerTRANSACTION = 349 + PostgreSQLLexerTRIGGER = 350 + PostgreSQLLexerTRUNCATE = 351 + PostgreSQLLexerTRUSTED = 352 + PostgreSQLLexerTYPE_P = 353 + PostgreSQLLexerTYPES_P = 354 + PostgreSQLLexerUNBOUNDED = 355 + PostgreSQLLexerUNCOMMITTED = 356 + PostgreSQLLexerUNENCRYPTED = 357 + PostgreSQLLexerUNKNOWN = 358 + PostgreSQLLexerUNLISTEN = 359 + PostgreSQLLexerUNLOGGED = 360 + PostgreSQLLexerUNTIL = 361 + PostgreSQLLexerUPDATE = 362 + PostgreSQLLexerVACUUM = 363 + PostgreSQLLexerVALID = 364 + PostgreSQLLexerVALIDATE = 365 + PostgreSQLLexerVALIDATOR = 366 + PostgreSQLLexerVARYING = 367 + PostgreSQLLexerVERSION_P = 368 + PostgreSQLLexerVIEW = 369 + PostgreSQLLexerVOLATILE = 370 + PostgreSQLLexerWHITESPACE_P = 371 + PostgreSQLLexerWITHOUT = 372 + PostgreSQLLexerWORK = 373 + PostgreSQLLexerWRAPPER = 374 + PostgreSQLLexerWRITE = 375 + PostgreSQLLexerXML_P = 376 + PostgreSQLLexerYEAR_P = 377 + PostgreSQLLexerYES_P = 378 + PostgreSQLLexerZONE = 379 + PostgreSQLLexerATOMIC_P = 380 + PostgreSQLLexerBETWEEN = 381 + PostgreSQLLexerBIGINT = 382 + PostgreSQLLexerBIT = 383 + PostgreSQLLexerBOOLEAN_P = 384 + PostgreSQLLexerCHAR_P = 385 + PostgreSQLLexerCHARACTER = 386 + PostgreSQLLexerCOALESCE = 387 + PostgreSQLLexerDEC = 388 + PostgreSQLLexerDECIMAL_P = 389 + PostgreSQLLexerEXISTS = 390 + PostgreSQLLexerEXTRACT = 391 + PostgreSQLLexerFLOAT_P = 392 + PostgreSQLLexerGREATEST = 393 + PostgreSQLLexerINOUT = 394 + PostgreSQLLexerINT_P = 395 + PostgreSQLLexerINTEGER = 396 + PostgreSQLLexerINTERVAL = 397 + PostgreSQLLexerLEAST = 398 + PostgreSQLLexerNATIONAL = 399 + PostgreSQLLexerNCHAR = 400 + PostgreSQLLexerNONE = 401 + PostgreSQLLexerNULLIF = 402 + PostgreSQLLexerNUMERIC = 403 + PostgreSQLLexerOVERLAY = 404 + PostgreSQLLexerPARAMETER = 405 + PostgreSQLLexerPOSITION = 406 + PostgreSQLLexerPRECISION = 407 + PostgreSQLLexerREAL = 408 + PostgreSQLLexerROW = 409 + PostgreSQLLexerSETOF = 410 + PostgreSQLLexerSMALLINT = 411 + PostgreSQLLexerSUBSTRING = 412 + PostgreSQLLexerTIME = 413 + PostgreSQLLexerTIMESTAMP = 414 + PostgreSQLLexerTREAT = 415 + PostgreSQLLexerTRIM = 416 + PostgreSQLLexerVALUES = 417 + PostgreSQLLexerVARCHAR = 418 + PostgreSQLLexerXMLATTRIBUTES = 419 + PostgreSQLLexerXMLCOMMENT = 420 + PostgreSQLLexerXMLAGG = 421 + PostgreSQLLexerXML_IS_WELL_FORMED = 422 + PostgreSQLLexerXML_IS_WELL_FORMED_DOCUMENT = 423 + PostgreSQLLexerXML_IS_WELL_FORMED_CONTENT = 424 + PostgreSQLLexerXPATH = 425 + PostgreSQLLexerXPATH_EXISTS = 426 + PostgreSQLLexerXMLCONCAT = 427 + PostgreSQLLexerXMLELEMENT = 428 + PostgreSQLLexerXMLEXISTS = 429 + PostgreSQLLexerXMLFOREST = 430 + PostgreSQLLexerXMLPARSE = 431 + PostgreSQLLexerXMLPI = 432 + PostgreSQLLexerXMLROOT = 433 + PostgreSQLLexerXMLSERIALIZE = 434 + PostgreSQLLexerCALL = 435 + PostgreSQLLexerCURRENT_P = 436 + PostgreSQLLexerATTACH = 437 + PostgreSQLLexerDETACH = 438 + PostgreSQLLexerEXPRESSION = 439 + PostgreSQLLexerGENERATED = 440 + PostgreSQLLexerLOGGED = 441 + PostgreSQLLexerSTORED = 442 + PostgreSQLLexerINCLUDE = 443 + PostgreSQLLexerROUTINE = 444 + PostgreSQLLexerTRANSFORM = 445 + PostgreSQLLexerIMPORT_P = 446 + PostgreSQLLexerPOLICY = 447 + PostgreSQLLexerMETHOD = 448 + PostgreSQLLexerREFERENCING = 449 + PostgreSQLLexerNEW = 450 + PostgreSQLLexerOLD = 451 + PostgreSQLLexerVALUE_P = 452 + PostgreSQLLexerSUBSCRIPTION = 453 + PostgreSQLLexerPUBLICATION = 454 + PostgreSQLLexerOUT_P = 455 + PostgreSQLLexerEND_P = 456 + PostgreSQLLexerROUTINES = 457 + PostgreSQLLexerSCHEMAS = 458 + PostgreSQLLexerPROCEDURES = 459 + PostgreSQLLexerINPUT_P = 460 + PostgreSQLLexerSUPPORT = 461 + PostgreSQLLexerPARALLEL = 462 + PostgreSQLLexerSQL_P = 463 + PostgreSQLLexerDEPENDS = 464 + PostgreSQLLexerOVERRIDING = 465 + PostgreSQLLexerCONFLICT = 466 + PostgreSQLLexerSKIP_P = 467 + PostgreSQLLexerLOCKED = 468 + PostgreSQLLexerTIES = 469 + PostgreSQLLexerROLLUP = 470 + PostgreSQLLexerCUBE = 471 + PostgreSQLLexerGROUPING = 472 + PostgreSQLLexerSETS = 473 + PostgreSQLLexerTABLESAMPLE = 474 + PostgreSQLLexerORDINALITY = 475 + PostgreSQLLexerXMLTABLE = 476 + PostgreSQLLexerCOLUMNS = 477 + PostgreSQLLexerXMLNAMESPACES = 478 + PostgreSQLLexerROWTYPE = 479 + PostgreSQLLexerNORMALIZED = 480 + PostgreSQLLexerWITHIN = 481 + PostgreSQLLexerFILTER = 482 + PostgreSQLLexerGROUPS = 483 + PostgreSQLLexerOTHERS = 484 + PostgreSQLLexerNFC = 485 + PostgreSQLLexerNFD = 486 + PostgreSQLLexerNFKC = 487 + PostgreSQLLexerNFKD = 488 + PostgreSQLLexerUESCAPE = 489 + PostgreSQLLexerVIEWS = 490 + PostgreSQLLexerNORMALIZE = 491 + PostgreSQLLexerDUMP = 492 + PostgreSQLLexerPRINT_STRICT_PARAMS = 493 + PostgreSQLLexerVARIABLE_CONFLICT = 494 + PostgreSQLLexerERROR = 495 + PostgreSQLLexerUSE_VARIABLE = 496 + PostgreSQLLexerUSE_COLUMN = 497 + PostgreSQLLexerALIAS = 498 + PostgreSQLLexerCONSTANT = 499 + PostgreSQLLexerPERFORM = 500 + PostgreSQLLexerGET = 501 + PostgreSQLLexerDIAGNOSTICS = 502 + PostgreSQLLexerSTACKED = 503 + PostgreSQLLexerELSIF = 504 + PostgreSQLLexerWHILE = 505 + PostgreSQLLexerREVERSE = 506 + PostgreSQLLexerFOREACH = 507 + PostgreSQLLexerSLICE = 508 + PostgreSQLLexerEXIT = 509 + PostgreSQLLexerRETURN = 510 + PostgreSQLLexerQUERY = 511 + PostgreSQLLexerRAISE = 512 + PostgreSQLLexerSQLSTATE = 513 + PostgreSQLLexerDEBUG = 514 + PostgreSQLLexerLOG = 515 + PostgreSQLLexerINFO = 516 + PostgreSQLLexerNOTICE = 517 + PostgreSQLLexerWARNING = 518 + PostgreSQLLexerEXCEPTION = 519 + PostgreSQLLexerASSERT = 520 + PostgreSQLLexerLOOP = 521 + PostgreSQLLexerOPEN = 522 + PostgreSQLLexerABS = 523 + PostgreSQLLexerCBRT = 524 + PostgreSQLLexerCEIL = 525 + PostgreSQLLexerCEILING = 526 + PostgreSQLLexerDEGREES = 527 + PostgreSQLLexerDIV = 528 + PostgreSQLLexerEXP = 529 + PostgreSQLLexerFACTORIAL = 530 + PostgreSQLLexerFLOOR = 531 + PostgreSQLLexerGCD = 532 + PostgreSQLLexerLCM = 533 + PostgreSQLLexerLN = 534 + PostgreSQLLexerLOG10 = 535 + PostgreSQLLexerMIN_SCALE = 536 + PostgreSQLLexerMOD = 537 + PostgreSQLLexerPI = 538 + PostgreSQLLexerPOWER = 539 + PostgreSQLLexerRADIANS = 540 + PostgreSQLLexerROUND = 541 + PostgreSQLLexerSCALE = 542 + PostgreSQLLexerSIGN = 543 + PostgreSQLLexerSQRT = 544 + PostgreSQLLexerTRIM_SCALE = 545 + PostgreSQLLexerTRUNC = 546 + PostgreSQLLexerWIDTH_BUCKET = 547 + PostgreSQLLexerRANDOM = 548 + PostgreSQLLexerSETSEED = 549 + PostgreSQLLexerACOS = 550 + PostgreSQLLexerACOSD = 551 + PostgreSQLLexerASIN = 552 + PostgreSQLLexerASIND = 553 + PostgreSQLLexerATAN = 554 + PostgreSQLLexerATAND = 555 + PostgreSQLLexerATAN2 = 556 + PostgreSQLLexerATAN2D = 557 + PostgreSQLLexerCOS = 558 + PostgreSQLLexerCOSD = 559 + PostgreSQLLexerCOT = 560 + PostgreSQLLexerCOTD = 561 + PostgreSQLLexerSIN = 562 + PostgreSQLLexerSIND = 563 + PostgreSQLLexerTAN = 564 + PostgreSQLLexerTAND = 565 + PostgreSQLLexerSINH = 566 + PostgreSQLLexerCOSH = 567 + PostgreSQLLexerTANH = 568 + PostgreSQLLexerASINH = 569 + PostgreSQLLexerACOSH = 570 + PostgreSQLLexerATANH = 571 + PostgreSQLLexerBIT_LENGTH = 572 + PostgreSQLLexerCHAR_LENGTH = 573 + PostgreSQLLexerCHARACTER_LENGTH = 574 + PostgreSQLLexerLOWER = 575 + PostgreSQLLexerOCTET_LENGTH = 576 + PostgreSQLLexerUPPER = 577 + PostgreSQLLexerASCII = 578 + PostgreSQLLexerBTRIM = 579 + PostgreSQLLexerCHR = 580 + PostgreSQLLexerCONCAT = 581 + PostgreSQLLexerCONCAT_WS = 582 + PostgreSQLLexerFORMAT = 583 + PostgreSQLLexerINITCAP = 584 + PostgreSQLLexerLENGTH = 585 + PostgreSQLLexerLPAD = 586 + PostgreSQLLexerLTRIM = 587 + PostgreSQLLexerMD5 = 588 + PostgreSQLLexerPARSE_IDENT = 589 + PostgreSQLLexerPG_CLIENT_ENCODING = 590 + PostgreSQLLexerQUOTE_IDENT = 591 + PostgreSQLLexerQUOTE_LITERAL = 592 + PostgreSQLLexerQUOTE_NULLABLE = 593 + PostgreSQLLexerREGEXP_COUNT = 594 + PostgreSQLLexerREGEXP_INSTR = 595 + PostgreSQLLexerREGEXP_LIKE = 596 + PostgreSQLLexerREGEXP_MATCH = 597 + PostgreSQLLexerREGEXP_MATCHES = 598 + PostgreSQLLexerREGEXP_REPLACE = 599 + PostgreSQLLexerREGEXP_SPLIT_TO_ARRAY = 600 + PostgreSQLLexerREGEXP_SPLIT_TO_TABLE = 601 + PostgreSQLLexerREGEXP_SUBSTR = 602 + PostgreSQLLexerREPEAT = 603 + PostgreSQLLexerRPAD = 604 + PostgreSQLLexerRTRIM = 605 + PostgreSQLLexerSPLIT_PART = 606 + PostgreSQLLexerSTARTS_WITH = 607 + PostgreSQLLexerSTRING_TO_ARRAY = 608 + PostgreSQLLexerSTRING_TO_TABLE = 609 + PostgreSQLLexerSTRPOS = 610 + PostgreSQLLexerSUBSTR = 611 + PostgreSQLLexerTO_ASCII = 612 + PostgreSQLLexerTO_HEX = 613 + PostgreSQLLexerTRANSLATE = 614 + PostgreSQLLexerUNISTR = 615 + PostgreSQLLexerAGE = 616 + PostgreSQLLexerCLOCK_TIMESTAMP = 617 + PostgreSQLLexerDATE_BIN = 618 + PostgreSQLLexerDATE_PART = 619 + PostgreSQLLexerDATE_TRUNC = 620 + PostgreSQLLexerISFINITE = 621 + PostgreSQLLexerJUSTIFY_DAYS = 622 + PostgreSQLLexerJUSTIFY_HOURS = 623 + PostgreSQLLexerJUSTIFY_INTERVAL = 624 + PostgreSQLLexerMAKE_DATE = 625 + PostgreSQLLexerMAKE_INTERVAL = 626 + PostgreSQLLexerMAKE_TIME = 627 + PostgreSQLLexerMAKE_TIMESTAMP = 628 + PostgreSQLLexerMAKE_TIMESTAMPTZ = 629 + PostgreSQLLexerNOW = 630 + PostgreSQLLexerSTATEMENT_TIMESTAMP = 631 + PostgreSQLLexerTIMEOFDAY = 632 + PostgreSQLLexerTRANSACTION_TIMESTAMP = 633 + PostgreSQLLexerTO_TIMESTAMP = 634 + PostgreSQLLexerTO_CHAR = 635 + PostgreSQLLexerTO_DATE = 636 + PostgreSQLLexerTO_NUMBER = 637 + PostgreSQLLexerENCODE = 638 + PostgreSQLLexerDISTKEY = 639 + PostgreSQLLexerSORTKEY = 640 + PostgreSQLLexerCASE_SENSITIVE = 641 + PostgreSQLLexerCASE_INSENSITIVE = 642 + PostgreSQLLexerIdentifier = 643 + PostgreSQLLexerQuotedIdentifier = 644 + PostgreSQLLexerUnterminatedQuotedIdentifier = 645 + PostgreSQLLexerInvalidQuotedIdentifier = 646 + PostgreSQLLexerInvalidUnterminatedQuotedIdentifier = 647 + PostgreSQLLexerUnicodeQuotedIdentifier = 648 + PostgreSQLLexerUnterminatedUnicodeQuotedIdentifier = 649 + PostgreSQLLexerInvalidUnicodeQuotedIdentifier = 650 + PostgreSQLLexerInvalidUnterminatedUnicodeQuotedIdentifier = 651 + PostgreSQLLexerStringConstant = 652 + PostgreSQLLexerUnterminatedStringConstant = 653 + PostgreSQLLexerUnicodeEscapeStringConstant = 654 + PostgreSQLLexerUnterminatedUnicodeEscapeStringConstant = 655 + PostgreSQLLexerBeginDollarStringConstant = 656 + PostgreSQLLexerBinaryStringConstant = 657 + PostgreSQLLexerUnterminatedBinaryStringConstant = 658 + PostgreSQLLexerInvalidBinaryStringConstant = 659 + PostgreSQLLexerInvalidUnterminatedBinaryStringConstant = 660 + PostgreSQLLexerHexadecimalStringConstant = 661 + PostgreSQLLexerUnterminatedHexadecimalStringConstant = 662 + PostgreSQLLexerInvalidHexadecimalStringConstant = 663 + PostgreSQLLexerInvalidUnterminatedHexadecimalStringConstant = 664 + PostgreSQLLexerIntegral = 665 + PostgreSQLLexerNumericFail = 666 + PostgreSQLLexerNumeric = 667 + PostgreSQLLexerPLSQLVARIABLENAME = 668 + PostgreSQLLexerPLSQLIDENTIFIER = 669 + PostgreSQLLexerWhitespace = 670 + PostgreSQLLexerNewline = 671 + PostgreSQLLexerLineComment = 672 + PostgreSQLLexerBlockComment = 673 + PostgreSQLLexerUnterminatedBlockComment = 674 + PostgreSQLLexerMetaCommand = 675 + PostgreSQLLexerEndMetaCommand = 676 + PostgreSQLLexerErrorCharacter = 677 + PostgreSQLLexerEscapeStringConstant = 678 + PostgreSQLLexerUnterminatedEscapeStringConstant = 679 + PostgreSQLLexerInvalidEscapeStringConstant = 680 + PostgreSQLLexerInvalidUnterminatedEscapeStringConstant = 681 + PostgreSQLLexerAfterEscapeStringConstantMode_NotContinued = 682 + PostgreSQLLexerAfterEscapeStringConstantWithNewlineMode_NotContinued = 683 + PostgreSQLLexerDollarText = 684 + PostgreSQLLexerEndDollarStringConstant = 685 + PostgreSQLLexerAfterEscapeStringConstantWithNewlineMode_Continued = 686 +) + +// PostgreSQLLexer modes. +const ( + PostgreSQLLexerEscapeStringConstantMode = iota + 1 + PostgreSQLLexerAfterEscapeStringConstantMode + PostgreSQLLexerAfterEscapeStringConstantWithNewlineMode + PostgreSQLLexerDollarQuotedStringMode +) + +/* This field stores the tags which are used to detect the end of a dollar-quoted string literal. + */ + +func (l *PostgreSQLLexer) Action(localctx antlr.RuleContext, ruleIndex, actionIndex int) { + switch ruleIndex { + case 28: + l.Operator_Action(localctx, actionIndex) + + case 663: + l.BeginDollarStringConstant_Action(localctx, actionIndex) + + case 674: + l.NumericFail_Action(localctx, actionIndex) + + case 683: + l.UnterminatedBlockComment_Action(localctx, actionIndex) + + case 695: + l.AfterEscapeStringConstantMode_NotContinued_Action(localctx, actionIndex) + + case 699: + l.AfterEscapeStringConstantWithNewlineMode_NotContinued_Action(localctx, actionIndex) + + case 701: + l.EndDollarStringConstant_Action(localctx, actionIndex) + + default: + panic("No registered action for: " + fmt.Sprint(ruleIndex)) + } +} + +func (l *PostgreSQLLexer) Operator_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 0: + + l.HandleLessLessGreaterGreater() + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} +func (l *PostgreSQLLexer) BeginDollarStringConstant_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 1: + l.pushTag() + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} +func (l *PostgreSQLLexer) NumericFail_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 2: + l.HandleNumericFail() + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} +func (l *PostgreSQLLexer) UnterminatedBlockComment_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 3: + + l.UnterminatedBlockCommentDebugAssert() + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} +func (l *PostgreSQLLexer) AfterEscapeStringConstantMode_NotContinued_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 4: + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} +func (l *PostgreSQLLexer) AfterEscapeStringConstantWithNewlineMode_NotContinued_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 5: + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} +func (l *PostgreSQLLexer) EndDollarStringConstant_Action(localctx antlr.RuleContext, actionIndex int) { + switch actionIndex { + case 6: + l.popTag() + + default: + panic("No registered action for: " + fmt.Sprint(actionIndex)) + } +} + +func (l *PostgreSQLLexer) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { + switch ruleIndex { + case 28: + return l.Operator_Sempred(localctx, predIndex) + + case 29: + return l.OperatorEndingWithPlusMinus_Sempred(localctx, predIndex) + + case 647: + return l.IdentifierStartChar_Sempred(localctx, predIndex) + + case 701: + return l.EndDollarStringConstant_Sempred(localctx, predIndex) + + default: + panic("No registered predicate for: " + fmt.Sprint(ruleIndex)) + } +} + +func (p *PostgreSQLLexer) Operator_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 0: + return p.checkLA('-') + + case 1: + return p.checkLA('*') + + case 2: + return p.checkLA('*') + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} + +func (p *PostgreSQLLexer) OperatorEndingWithPlusMinus_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 3: + return p.checkLA('-') + + case 4: + return p.checkLA('*') + + case 5: + return p.checkLA('-') + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} + +func (p *PostgreSQLLexer) IdentifierStartChar_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 6: + return p.charIsLetter() + + case 7: + return p.CheckIfUtf32Letter() + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} + +func (p *PostgreSQLLexer) EndDollarStringConstant_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 8: + return p.isTag() + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} diff --git a/postgresql/postgresql_lexer_base.go b/postgresql/postgresql_lexer_base.go new file mode 100644 index 0000000..d60061c --- /dev/null +++ b/postgresql/postgresql_lexer_base.go @@ -0,0 +1,455 @@ +package postgresql + +import ( + "strings" + "unicode" + + "github.com/antlr4-go/antlr/v4" +) + +type PostgreSQLLexerBase struct { + *antlr.BaseLexer + + stack StringStack + reservedKeywordMap map[string]bool +} + +func (receiver *PostgreSQLLexerBase) pushTag() { + receiver.stack.Push(receiver.GetText()) +} + +func (receiver *PostgreSQLLexerBase) isTag() bool { + if receiver.stack.IsEmpty() { + return false + } + return receiver.GetText() == receiver.stack.PeekOrEmpty() +} + +func (receiver *PostgreSQLLexerBase) popTag() { + _, _ = receiver.stack.Pop() +} + +func (receiver *PostgreSQLLexerBase) checkLA(c int) bool { + return receiver.GetInputStream().LA(1) != c +} + +func (receiver *PostgreSQLLexerBase) charIsLetter() bool { + c := receiver.GetInputStream().LA(-1) + return unicode.IsLetter(rune(c)) +} + +func (receiver *PostgreSQLLexerBase) HandleNumericFail() { + index := receiver.GetInputStream().Index() - 2 + receiver.GetInputStream().Seek(index) + receiver.SetType(PostgreSQLLexerIntegral) +} + +func (receiver *PostgreSQLLexerBase) HandleLessLessGreaterGreater() { + if receiver.GetText() == "<<" { + receiver.SetType(PostgreSQLLexerLESS_LESS) + } + if receiver.GetText() == ">>" { + receiver.SetType(PostgreSQLLexerGREATER_GREATER) + } +} + +func (receiver *PostgreSQLLexerBase) UnterminatedBlockCommentDebugAssert() { + //Debug.Assert(InputStream.LA(1) == -1 /*EOF*/); +} + +func (receiver *PostgreSQLLexerBase) CheckIfUtf32Letter() bool { + codePoint := receiver.GetInputStream().LA(-2)<<8 + receiver.GetInputStream().LA(-1) + var c []rune + if codePoint < 0x10000 { + c = []rune{rune(codePoint)} + } else { + codePoint -= 0x10000 + c = []rune{ + (rune)(codePoint/0x400 + 0xd800), + (rune)(codePoint%0x400 + 0xdc00), + } + } + return unicode.IsLetter(c[0]) +} + +func (receiver *PostgreSQLLexerBase) IsIdentifier(tokenType int) bool { + if tokenType == antlr.TokenEOF { + return false + } + + switch tokenType { + case PostgreSQLLexerIdentifier, + PostgreSQLLexerQuotedIdentifier, + PostgreSQLLexerUnicodeQuotedIdentifier, + PostgreSQLLexerPLSQLVARIABLENAME, + PostgreSQLLexerPLSQLIDENTIFIER, + PostgreSQLLexerUnterminatedQuotedIdentifier: + return true + case PostgreSQLLexerABORT_P, // Unreserved Keywords + PostgreSQLLexerABSOLUTE_P, + PostgreSQLLexerACCESS, + PostgreSQLLexerACTION, + PostgreSQLLexerADD_P, + PostgreSQLLexerADMIN, + PostgreSQLLexerAFTER, + PostgreSQLLexerAGGREGATE, + PostgreSQLLexerALSO, + PostgreSQLLexerALTER, + PostgreSQLLexerALWAYS, + PostgreSQLLexerASSERTION, + PostgreSQLLexerASSIGNMENT, + PostgreSQLLexerAT, + PostgreSQLLexerATOMIC_P, + PostgreSQLLexerATTACH, + PostgreSQLLexerATTRIBUTE, + PostgreSQLLexerBACKWARD, + PostgreSQLLexerBEFORE, + PostgreSQLLexerBEGIN_P, + PostgreSQLLexerBY, + PostgreSQLLexerCACHE, + PostgreSQLLexerCALL, + PostgreSQLLexerCALLED, + PostgreSQLLexerCASCADE, + PostgreSQLLexerCASCADED, + PostgreSQLLexerCATALOG, + PostgreSQLLexerCHAIN, + PostgreSQLLexerCHARACTERISTICS, + PostgreSQLLexerCHECKPOINT, + PostgreSQLLexerCLASS, + PostgreSQLLexerCLOSE, + PostgreSQLLexerCLUSTER, + PostgreSQLLexerCOLUMNS, + PostgreSQLLexerCOMMENT, + PostgreSQLLexerCOMMENTS, + PostgreSQLLexerCOMMIT, + PostgreSQLLexerCOMMITTED, + PostgreSQLLexerCONFIGURATION, + PostgreSQLLexerCONFLICT, + PostgreSQLLexerCONNECTION, + PostgreSQLLexerCONSTRAINTS, + PostgreSQLLexerCONTENT_P, + PostgreSQLLexerCONTINUE_P, + PostgreSQLLexerCONVERSION_P, + PostgreSQLLexerCOPY, + PostgreSQLLexerCOST, + PostgreSQLLexerCSV, + PostgreSQLLexerCUBE, + PostgreSQLLexerCURRENT_P, + PostgreSQLLexerCURSOR, + PostgreSQLLexerCYCLE, + PostgreSQLLexerDATA_P, + PostgreSQLLexerDATABASE, + PostgreSQLLexerDAY_P, + PostgreSQLLexerDEALLOCATE, + PostgreSQLLexerDECLARE, + PostgreSQLLexerDEFAULTS, + PostgreSQLLexerDEFERRED, + PostgreSQLLexerDEFINER, + PostgreSQLLexerDELETE_P, + PostgreSQLLexerDELIMITER, + PostgreSQLLexerDELIMITERS, + PostgreSQLLexerDEPENDS, + PostgreSQLLexerDETACH, + PostgreSQLLexerDICTIONARY, + PostgreSQLLexerDISABLE_P, + PostgreSQLLexerDISCARD, + PostgreSQLLexerDOCUMENT_P, + PostgreSQLLexerDOMAIN_P, + PostgreSQLLexerDOUBLE_P, + PostgreSQLLexerDROP, + PostgreSQLLexerEACH, + PostgreSQLLexerENABLE_P, + PostgreSQLLexerENCODING, + PostgreSQLLexerENCRYPTED, + PostgreSQLLexerENUM_P, + PostgreSQLLexerESCAPE, + PostgreSQLLexerEVENT, + PostgreSQLLexerEXCLUDE, + PostgreSQLLexerEXCLUDING, + PostgreSQLLexerEXCLUSIVE, + PostgreSQLLexerEXECUTE, + PostgreSQLLexerEXPLAIN, + PostgreSQLLexerEXPRESSION, + PostgreSQLLexerEXTENSION, + PostgreSQLLexerEXTERNAL, + PostgreSQLLexerFAMILY, + PostgreSQLLexerFILTER, + PostgreSQLLexerFIRST_P, + PostgreSQLLexerFOLLOWING, + PostgreSQLLexerFORCE, + PostgreSQLLexerFORWARD, + PostgreSQLLexerFUNCTION, + PostgreSQLLexerFUNCTIONS, + PostgreSQLLexerGENERATED, + PostgreSQLLexerGLOBAL, + PostgreSQLLexerGRANTED, + PostgreSQLLexerGROUPS, + PostgreSQLLexerHANDLER, + PostgreSQLLexerHEADER_P, + PostgreSQLLexerHOLD, + PostgreSQLLexerHOUR_P, + PostgreSQLLexerIDENTITY_P, + PostgreSQLLexerIF_P, + PostgreSQLLexerIMMEDIATE, + PostgreSQLLexerIMMUTABLE, + PostgreSQLLexerIMPLICIT_P, + PostgreSQLLexerIMPORT_P, + PostgreSQLLexerINCLUDE, + PostgreSQLLexerINCLUDING, + PostgreSQLLexerINCREMENT, + PostgreSQLLexerINDEX, + PostgreSQLLexerINDEXES, + PostgreSQLLexerINHERIT, + PostgreSQLLexerINHERITS, + PostgreSQLLexerINLINE_P, + PostgreSQLLexerINPUT_P, + PostgreSQLLexerINSENSITIVE, + PostgreSQLLexerINSERT, + PostgreSQLLexerINSTEAD, + PostgreSQLLexerINVOKER, + PostgreSQLLexerISOLATION, + PostgreSQLLexerKEY, + PostgreSQLLexerLABEL, + PostgreSQLLexerLANGUAGE, + PostgreSQLLexerLARGE_P, + PostgreSQLLexerLAST_P, + PostgreSQLLexerLEAKPROOF, + PostgreSQLLexerLEVEL, + PostgreSQLLexerLISTEN, + PostgreSQLLexerLOAD, + PostgreSQLLexerLOCAL, + PostgreSQLLexerLOCATION, + PostgreSQLLexerLOCK_P, + PostgreSQLLexerLOCKED, + PostgreSQLLexerLOGGED, + PostgreSQLLexerMAPPING, + PostgreSQLLexerMATCH, + PostgreSQLLexerMATERIALIZED, + PostgreSQLLexerMAXVALUE, + PostgreSQLLexerMETHOD, + PostgreSQLLexerMINUTE_P, + PostgreSQLLexerMINVALUE, + PostgreSQLLexerMODE, + PostgreSQLLexerMONTH_P, + PostgreSQLLexerMOVE, + PostgreSQLLexerNAME_P, + PostgreSQLLexerNAMES, + PostgreSQLLexerNEW, + PostgreSQLLexerNEXT, + PostgreSQLLexerNFC, + PostgreSQLLexerNFD, + PostgreSQLLexerNFKC, + PostgreSQLLexerNFKD, + PostgreSQLLexerNO, + PostgreSQLLexerNORMALIZED, + PostgreSQLLexerNOTHING, + PostgreSQLLexerNOTIFY, + PostgreSQLLexerNOWAIT, + PostgreSQLLexerNULLS_P, + PostgreSQLLexerOBJECT_P, + PostgreSQLLexerOF, + PostgreSQLLexerOFF, + PostgreSQLLexerOIDS, + PostgreSQLLexerOLD, + PostgreSQLLexerOPERATOR, + PostgreSQLLexerOPTION, + PostgreSQLLexerOPTIONS, + PostgreSQLLexerORDINALITY, + PostgreSQLLexerOTHERS, + PostgreSQLLexerOVER, + PostgreSQLLexerOVERRIDING, + PostgreSQLLexerOWNED, + PostgreSQLLexerOWNER, + PostgreSQLLexerPARALLEL, + PostgreSQLLexerPARSER, + PostgreSQLLexerPARTIAL, + PostgreSQLLexerPARTITION, + PostgreSQLLexerPASSING, + PostgreSQLLexerPASSWORD, + PostgreSQLLexerPLANS, + PostgreSQLLexerPOLICY, + PostgreSQLLexerPRECEDING, + PostgreSQLLexerPREPARE, + PostgreSQLLexerPREPARED, + PostgreSQLLexerPRESERVE, + PostgreSQLLexerPRIOR, + PostgreSQLLexerPRIVILEGES, + PostgreSQLLexerPROCEDURAL, + PostgreSQLLexerPROCEDURE, + PostgreSQLLexerPROCEDURES, + PostgreSQLLexerPROGRAM, + PostgreSQLLexerPUBLICATION, + PostgreSQLLexerQUOTE, + PostgreSQLLexerRANGE, + PostgreSQLLexerREAD, + PostgreSQLLexerREASSIGN, + PostgreSQLLexerRECHECK, + PostgreSQLLexerRECURSIVE, + PostgreSQLLexerREF, + PostgreSQLLexerREFERENCING, + PostgreSQLLexerREFRESH, + PostgreSQLLexerREINDEX, + PostgreSQLLexerRELATIVE_P, + PostgreSQLLexerRELEASE, + PostgreSQLLexerRENAME, + PostgreSQLLexerREPEATABLE, + PostgreSQLLexerREPLICA, + PostgreSQLLexerRESET, + PostgreSQLLexerRESTART, + PostgreSQLLexerRESTRICT, + PostgreSQLLexerRETURNS, + PostgreSQLLexerREVOKE, + PostgreSQLLexerROLE, + PostgreSQLLexerROLLBACK, + PostgreSQLLexerROLLUP, + PostgreSQLLexerROUTINE, + PostgreSQLLexerROUTINES, + PostgreSQLLexerROWS, + PostgreSQLLexerRULE, + PostgreSQLLexerSAVEPOINT, + PostgreSQLLexerSCHEMA, + PostgreSQLLexerSCHEMAS, + PostgreSQLLexerSCROLL, + PostgreSQLLexerSEARCH, + PostgreSQLLexerSECOND_P, + PostgreSQLLexerSECURITY, + PostgreSQLLexerSEQUENCE, + PostgreSQLLexerSEQUENCES, + PostgreSQLLexerSERIALIZABLE, + PostgreSQLLexerSERVER, + PostgreSQLLexerSESSION, + PostgreSQLLexerSET, + PostgreSQLLexerSETS, + PostgreSQLLexerSHARE, + PostgreSQLLexerSHOW, + PostgreSQLLexerSIMPLE, + PostgreSQLLexerSKIP_P, + PostgreSQLLexerSNAPSHOT, + PostgreSQLLexerSQL_P, + PostgreSQLLexerSTABLE, + PostgreSQLLexerSTANDALONE_P, + PostgreSQLLexerSTART, + PostgreSQLLexerSTATEMENT, + PostgreSQLLexerSTATISTICS, + PostgreSQLLexerSTDIN, + PostgreSQLLexerSTDOUT, + PostgreSQLLexerSTORAGE, + PostgreSQLLexerSTORED, + PostgreSQLLexerSTRICT_P, + PostgreSQLLexerSTRIP_P, + PostgreSQLLexerSUBSCRIPTION, + PostgreSQLLexerSUPPORT, + PostgreSQLLexerSYSID, + PostgreSQLLexerSYSTEM_P, + PostgreSQLLexerTABLES, + PostgreSQLLexerTABLESPACE, + PostgreSQLLexerTEMP, + PostgreSQLLexerTEMPLATE, + PostgreSQLLexerTEMPORARY, + PostgreSQLLexerTEXT_P, + PostgreSQLLexerTIES, + PostgreSQLLexerTRANSACTION, + PostgreSQLLexerTRANSFORM, + PostgreSQLLexerTRIGGER, + PostgreSQLLexerTRUNCATE, + PostgreSQLLexerTRUSTED, + PostgreSQLLexerTYPE_P, + PostgreSQLLexerTYPES_P, + PostgreSQLLexerUESCAPE, + PostgreSQLLexerUNBOUNDED, + PostgreSQLLexerUNCOMMITTED, + PostgreSQLLexerUNENCRYPTED, + PostgreSQLLexerUNKNOWN, + PostgreSQLLexerUNLISTEN, + PostgreSQLLexerUNLOGGED, + PostgreSQLLexerUNTIL, + PostgreSQLLexerUPDATE, + PostgreSQLLexerVACUUM, + PostgreSQLLexerVALID, + PostgreSQLLexerVALIDATE, + PostgreSQLLexerVALIDATOR, + PostgreSQLLexerVALUE_P, + PostgreSQLLexerVARYING, + PostgreSQLLexerVERSION_P, + PostgreSQLLexerVIEW, + PostgreSQLLexerVIEWS, + PostgreSQLLexerVOLATILE, + PostgreSQLLexerWHITESPACE_P, + PostgreSQLLexerWITHIN, + PostgreSQLLexerWITHOUT, + PostgreSQLLexerWORK, + PostgreSQLLexerWRAPPER, + PostgreSQLLexerWRITE, + PostgreSQLLexerXML_P, + PostgreSQLLexerYEAR_P, + PostgreSQLLexerYES_P, + PostgreSQLLexerZONE: + return true + case PostgreSQLLexerALIAS, // plsql unreserved keywords + PostgreSQLLexerAND, + PostgreSQLLexerARRAY, + PostgreSQLLexerASSERT, + PostgreSQLLexerCOLLATE, + PostgreSQLLexerCOLUMN, + PostgreSQLLexerCONSTANT, + PostgreSQLLexerCONSTRAINT, + PostgreSQLLexerDEBUG, + PostgreSQLLexerDEFAULT, + PostgreSQLLexerDIAGNOSTICS, + PostgreSQLLexerDO, + PostgreSQLLexerDUMP, + PostgreSQLLexerELSIF, + PostgreSQLLexerERROR, + PostgreSQLLexerEXCEPTION, + PostgreSQLLexerEXIT, + PostgreSQLLexerFETCH, + PostgreSQLLexerGET, + PostgreSQLLexerINFO, + PostgreSQLLexerIS, + PostgreSQLLexerNOTICE, + PostgreSQLLexerOPEN, + PostgreSQLLexerPERFORM, + PostgreSQLLexerPRINT_STRICT_PARAMS, + PostgreSQLLexerQUERY, + PostgreSQLLexerRAISE, + PostgreSQLLexerRETURN, + PostgreSQLLexerSLICE, + PostgreSQLLexerSQLSTATE, + PostgreSQLLexerSTACKED, + PostgreSQLLexerTABLE, + PostgreSQLLexerUSE_COLUMN, + PostgreSQLLexerUSE_VARIABLE, + PostgreSQLLexerVARIABLE_CONFLICT, + PostgreSQLLexerWARNING, + PostgreSQLLexerOUTER_P: + return true + } + + symbol := receiver.GetSymbolicNames()[tokenType] + symbol = strings.TrimSuffix(symbol, "_SYMBOL") + if len(symbol) > 0 && !receiver.IsReservedKeyword(symbol) { + return true + } + return false +} + +func (receiver *PostgreSQLLexerBase) IsReservedKeyword(s string) bool { + receiver.initReservedKeywordMap() + + _, exists := receiver.reservedKeywordMap[s] + return exists +} + +func (receiver *PostgreSQLLexerBase) initReservedKeywordMap() { + if receiver.reservedKeywordMap != nil { + return + } + + receiver.reservedKeywordMap = make(map[string]bool) + + for _, keyword := range Keywords { + if keyword.Reserved { + receiver.reservedKeywordMap[keyword.Keyword] = true + } + } +} diff --git a/postgresql/postgresql_parse_error.go b/postgresql/postgresql_parse_error.go new file mode 100644 index 0000000..44a9f3a --- /dev/null +++ b/postgresql/postgresql_parse_error.go @@ -0,0 +1,9 @@ +package postgresql + +type PostgreSQLParseError struct { + Number int + Offset int + Line int + Column int + Message string +} diff --git a/postgresql/postgresql_parser.go b/postgresql/postgresql_parser.go new file mode 100644 index 0000000..4aaca93 --- /dev/null +++ b/postgresql/postgresql_parser.go @@ -0,0 +1,189865 @@ +// Code generated from PostgreSQLParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package postgresql // PostgreSQLParser +import ( + "fmt" + "strconv" + "sync" + + "github.com/antlr4-go/antlr/v4" +) + +// Suppress unused import errors +var _ = fmt.Printf +var _ = strconv.Itoa +var _ = sync.Once{} + +type PostgreSQLParser struct { + PostgreSQLParserBase +} + +var PostgreSQLParserParserStaticData struct { + once sync.Once + serializedATN []int32 + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache + atn *antlr.ATN + decisionToDFA []*antlr.DFA +} + +func postgresqlparserParserInit() { + staticData := &PostgreSQLParserParserStaticData + staticData.LiteralNames = []string{ + "", "'$'", "'('", "')'", "'['", "']'", "','", "';'", "':'", "'*'", "'='", + "'.'", "'+'", "'-'", "'/'", "'^'", "'<'", "'>'", "'<<'", "'>>'", "':='", + "'<='", "'=>'", "'>='", "'..'", "'<>'", "'::'", "'%'", "", "", "'ALL'", + "'ANALYSE'", "'ANALYZE'", "'AND'", "'ANY'", "'ARRAY'", "'AS'", "'ASC'", + "'ASYMMETRIC'", "'BOTH'", "'CASE'", "'CAST'", "'CHECK'", "'COLLATE'", + "'COLUMN'", "'CONSTRAINT'", "'CREATE'", "'CURRENT_CATALOG'", "'CURRENT_DATE'", + "'CURRENT_ROLE'", "'CURRENT_TIME'", "'CURRENT_TIMESTAMP'", "'CURRENT_USER'", + "'DEFAULT'", "'DEFERRABLE'", "'DESC'", "'DISTINCT'", "'DO'", "'ELSE'", + "'EXCEPT'", "'FALSE'", "'FETCH'", "'FOR'", "'FOREIGN'", "'FROM'", "'GRANT'", + "'GROUP'", "'HAVING'", "'IN'", "'INITIALLY'", "'INTERSECT'", "'INTO'", + "'LATERAL'", "'LEADING'", "'LIMIT'", "'LOCALTIME'", "'LOCALTIMESTAMP'", + "'NOT'", "'NULL'", "'OFFSET'", "'ON'", "'ONLY'", "'OR'", "'ORDER'", + "'PLACING'", "'PRIMARY'", "'REFERENCES'", "'RETURNING'", "'SELECT'", + "'SESSION_USER'", "'SOME'", "'SYMMETRIC'", "'TABLE'", "'THEN'", "'TO'", + "'TRAILING'", "'TRUE'", "'UNION'", "'UNIQUE'", "'USER'", "'USING'", + "'VARIADIC'", "'WHEN'", "'WHERE'", "'WINDOW'", "'WITH'", "'AUTHORIZATION'", + "'BINARY'", "'COLLATION'", "'CONCURRENTLY'", "'CROSS'", "'CURRENT_SCHEMA'", + "'FREEZE'", "'FULL'", "'ILIKE'", "'INNER'", "'IS'", "'ISNULL'", "'JOIN'", + "'LEFT'", "'LIKE'", "'NATURAL'", "'NOTNULL'", "'OUTER'", "'OVER'", "'OVERLAPS'", + "'RIGHT'", "'SIMILAR'", "'VERBOSE'", "'ABORT'", "'ABSOLUTE'", "'ACCESS'", + "'ACTION'", "'ADD'", "'ADMIN'", "'AFTER'", "'AGGREGATE'", "'ALSO'", + "'ALTER'", "'ALWAYS'", "'ASSERTION'", "'ASSIGNMENT'", "'AT'", "'ATTRIBUTE'", + "'BACKWARD'", "'BEFORE'", "'BEGIN'", "'BY'", "'CACHE'", "'CALLED'", + "'CASCADE'", "'CASCADED'", "'CATALOG'", "'CHAIN'", "'CHARACTERISTICS'", + "'CHECKPOINT'", "'CLASS'", "'CLOSE'", "'CLUSTER'", "'COMMENT'", "'COMMENTS'", + "'COMMIT'", "'COMMITTED'", "'CONFIGURATION'", "'CONNECTION'", "'CONSTRAINTS'", + "'CONTENT'", "'CONTINUE'", "'CONVERSION'", "'COPY'", "'COST'", "'CSV'", + "'CURSOR'", "'CYCLE'", "'DATA'", "'DATABASE'", "'DAY'", "'DEALLOCATE'", + "'DECLARE'", "'DEFAULTS'", "'DEFERRED'", "'DEFINER'", "'DELETE'", "'DELIMITER'", + "'DELIMITERS'", "'DICTIONARY'", "'DISABLE'", "'DISCARD'", "'DOCUMENT'", + "'DOMAIN'", "'DOUBLE'", "'DROP'", "'EACH'", "'ENABLE'", "'ENCODING'", + "'ENCRYPTED'", "'ENUM'", "'ESCAPE'", "'EVENT'", "'EXCLUDE'", "'EXCLUDING'", + "'EXCLUSIVE'", "'EXECUTE'", "'EXPLAIN'", "'EXTENSION'", "'EXTERNAL'", + "'FAMILY'", "'FIRST'", "'FOLLOWING'", "'FORCE'", "'FORWARD'", "'FUNCTION'", + "'FUNCTIONS'", "'GLOBAL'", "'GRANTED'", "'HANDLER'", "'HEADER'", "'HOLD'", + "'HOUR'", "'IDENTITY'", "'IF'", "'IMMEDIATE'", "'IMMUTABLE'", "'IMPLICIT'", + "'INCLUDING'", "'INCREMENT'", "'INDEX'", "'INDEXES'", "'INHERIT'", "'INHERITS'", + "'INLINE'", "'INSENSITIVE'", "'INSERT'", "'INSTEAD'", "'INVOKER'", "'ISOLATION'", + "'KEY'", "'LABEL'", "'LANGUAGE'", "'LARGE'", "'LAST'", "'LEAKPROOF'", + "'LEVEL'", "'LISTEN'", "'LOAD'", "'LOCAL'", "'LOCATION'", "'LOCK'", + "'MAPPING'", "'MATCH'", "'MATCHED'", "'MATERIALIZED'", "'MAXVALUE'", + "'MERGE'", "'MINUTE'", "'MINVALUE'", "'MODE'", "'MONTH'", "'MOVE'", + "'NAME'", "'NAMES'", "'NEXT'", "'NO'", "'NOTHING'", "'NOTIFY'", "'NOWAIT'", + "'NULLS'", "'OBJECT'", "'OF'", "'OFF'", "'OIDS'", "'OPERATOR'", "'OPTION'", + "'OPTIONS'", "'OWNED'", "'OWNER'", "'PARSER'", "'PARTIAL'", "'PARTITION'", + "'PASSING'", "'PASSWORD'", "'PLANS'", "'PRECEDING'", "'PREPARE'", "'PREPARED'", + "'PRESERVE'", "'PRIOR'", "'PRIVILEGES'", "'PROCEDURAL'", "'PROCEDURE'", + "'PROGRAM'", "'QUOTE'", "'RANGE'", "'READ'", "'REASSIGN'", "'RECHECK'", + "'RECURSIVE'", "'REF'", "'REFRESH'", "'REINDEX'", "'RELATIVE'", "'RELEASE'", + "'RENAME'", "'REPEATABLE'", "'REPLACE'", "'REPLICA'", "'RESET'", "'RESTART'", + "'RESTRICT'", "'RETURNS'", "'REVOKE'", "'ROLE'", "'ROLLBACK'", "'ROWS'", + "'RULE'", "'SAVEPOINT'", "'SCHEMA'", "'SCROLL'", "'SEARCH'", "'SECOND'", + "'SECURITY'", "'SEQUENCE'", "'SEQUENCES'", "'SERIALIZABLE'", "'SERVER'", + "'SESSION'", "'SET'", "'SHARE'", "'SHOW'", "'SIMPLE'", "'SNAPSHOT'", + "'STABLE'", "'STANDALONE'", "'START'", "'STATEMENT'", "'STATISTICS'", + "'STDIN'", "'STDOUT'", "'STORAGE'", "'STRICT'", "'STRIP'", "'SYSID'", + "'SYSTEM'", "'TABLES'", "'TABLESPACE'", "'TEMP'", "'TEMPLATE'", "'TEMPORARY'", + "'TEXT'", "'TRANSACTION'", "'TRIGGER'", "'TRUNCATE'", "'TRUSTED'", "'TYPE'", + "'TYPES'", "'UNBOUNDED'", "'UNCOMMITTED'", "'UNENCRYPTED'", "'UNKNOWN'", + "'UNLISTEN'", "'UNLOGGED'", "'UNTIL'", "'UPDATE'", "'VACUUM'", "'VALID'", + "'VALIDATE'", "'VALIDATOR'", "'VARYING'", "'VERSION'", "'VIEW'", "'VOLATILE'", + "'WHITESPACE'", "'WITHOUT'", "'WORK'", "'WRAPPER'", "'WRITE'", "'XML'", + "'YEAR'", "'YES'", "'ZONE'", "'ATOMIC'", "'BETWEEN'", "'BIGINT'", "'BIT'", + "'BOOLEAN'", "'CHAR'", "'CHARACTER'", "'COALESCE'", "'DEC'", "'DECIMAL'", + "'EXISTS'", "'EXTRACT'", "'FLOAT'", "'GREATEST'", "'INOUT'", "'INT'", + "'INTEGER'", "'INTERVAL'", "'LEAST'", "'NATIONAL'", "'NCHAR'", "'NONE'", + "'NULLIF'", "'NUMERIC'", "'OVERLAY'", "'PARAMETER'", "'POSITION'", "'PRECISION'", + "'REAL'", "'ROW'", "'SETOF'", "'SMALLINT'", "'SUBSTRING'", "'TIME'", + "'TIMESTAMP'", "'TREAT'", "'TRIM'", "'VALUES'", "'VARCHAR'", "'XMLATTRIBUTES'", + "'XMLCOMMENT'", "'XMLAGG'", "'XML_IS_WELL_FORMED'", "'XML_IS_WELL_FORMED_DOCUMENT'", + "'XML_IS_WELL_FORMED_CONTENT'", "'XPATH'", "'XPATH_EXISTS'", "'XMLCONCAT'", + "'XMLELEMENT'", "'XMLEXISTS'", "'XMLFOREST'", "'XMLPARSE'", "'XMLPI'", + "'XMLROOT'", "'XMLSERIALIZE'", "'CALL'", "'CURRENT'", "'ATTACH'", "'DETACH'", + "'EXPRESSION'", "'GENERATED'", "'LOGGED'", "'STORED'", "'INCLUDE'", + "'ROUTINE'", "'TRANSFORM'", "'IMPORT'", "'POLICY'", "'METHOD'", "'REFERENCING'", + "'NEW'", "'OLD'", "'VALUE'", "'SUBSCRIPTION'", "'PUBLICATION'", "'OUT'", + "'END'", "'ROUTINES'", "'SCHEMAS'", "'PROCEDURES'", "'INPUT'", "'SUPPORT'", + "'PARALLEL'", "'SQL'", "'DEPENDS'", "'OVERRIDING'", "'CONFLICT'", "'SKIP'", + "'LOCKED'", "'TIES'", "'ROLLUP'", "'CUBE'", "'GROUPING'", "'SETS'", + "'TABLESAMPLE'", "'ORDINALITY'", "'XMLTABLE'", "'COLUMNS'", "'XMLNAMESPACES'", + "'ROWTYPE'", "'NORMALIZED'", "'WITHIN'", "'FILTER'", "'GROUPS'", "'OTHERS'", + "'NFC'", "'NFD'", "'NFKC'", "'NFKD'", "'UESCAPE'", "'VIEWS'", "'NORMALIZE'", + "'DUMP'", "'PRINT_STRICT_PARAMS'", "'VARIABLE_CONFLICT'", "'ERROR'", + "'USE_VARIABLE'", "'USE_COLUMN'", "'ALIAS'", "'CONSTANT'", "'PERFORM'", + "'GET'", "'DIAGNOSTICS'", "'STACKED'", "'ELSIF'", "'WHILE'", "'REVERSE'", + "'FOREACH'", "'SLICE'", "'EXIT'", "'RETURN'", "'QUERY'", "'RAISE'", + "'SQLSTATE'", "'DEBUG'", "'LOG'", "'INFO'", "'NOTICE'", "'WARNING'", + "'EXCEPTION'", "'ASSERT'", "'LOOP'", "'OPEN'", "'ABS'", "'CBRT'", "'CEIL'", + "'CEILING'", "'DEGREES'", "'DIV'", "'EXP'", "'FACTORIAL'", "'FLOOR'", + "'GCD'", "'LCM'", "'LN'", "'LOG10'", "'MIN_SCALE'", "'MOD'", "'PI'", + "'POWER'", "'RADIANS'", "'ROUND'", "'SCALE'", "'SIGN'", "'SQRT'", "'TRIM_SCALE'", + "'TRUNC'", "'WIDTH_BUCKET'", "'RANDOM'", "'SETSEED'", "'ACOS'", "'ACOSD'", + "'ASIN'", "'ASIND'", "'ATAN'", "'ATAND'", "'ATAN2'", "'ATAN2D'", "'COS'", + "'COSD'", "'COT'", "'COTD'", "'SIN'", "'SIND'", "'TAN'", "'TAND'", "'SINH'", + "'COSH'", "'TANH'", "'ASINH'", "'ACOSH'", "'ATANH'", "'BIT_LENGTH'", + "'CHAR_LENGTH'", "'CHARACTER_LENGTH'", "'LOWER'", "'OCTET_LENGTH'", + "'UPPER'", "'ASCII'", "'BTRIM'", "'CHR'", "'CONCAT'", "'CONCAT_WS'", + "'FORMAT'", "'INITCAP'", "'LENGTH'", "'LPAD'", "'LTRIM'", "'MD5'", "'PARSE_IDENT'", + "'PG_CLIENT_ENCODING'", "'QUOTE_IDENT'", "'QUOTE_LITERAL'", "'QUOTE_NULLABLE'", + "'REGEXP_COUNT'", "'REGEXP_INSTR'", "'REGEXP_LIKE'", "'REGEXP_MATCH'", + "'REGEXP_MATCHES'", "'REGEXP_REPLACE'", "'REGEXP_SPLIT_TO_ARRAY'", "'REGEXP_SPLIT_TO_TABLE'", + "'REGEXP_SUBSTR'", "'REPEAT'", "'RPAD'", "'RTRIM'", "'SPLIT_PART'", + "'STARTS_WITH'", "'STRING_TO_ARRAY'", "'STRING_TO_TABLE'", "'STRPOS'", + "'SUBSTR'", "'TO_ASCII'", "'TO_HEX'", "'TRANSLATE'", "'UNISTR'", "'AGE'", + "'CLOCK_TIMESTAMP'", "'DATE_BIN'", "'DATE_PART'", "'DATE_TRUNC'", "'ISFINITE'", + "'JUSTIFY_DAYS'", "'JUSTIFY_HOURS'", "'JUSTIFY_INTERVAL'", "'MAKE_DATE'", + "'MAKE_INTERVAL'", "'MAKE_TIME'", "'MAKE_TIMESTAMP'", "'MAKE_TIMESTAMPTZ'", + "'NOW'", "'STATEMENT_TIMESTAMP'", "'TIMEOFDAY'", "'TRANSACTION_TIMESTAMP'", + "'TO_TIMESTAMP'", "'TO_CHAR'", "'TO_DATE'", "'TO_NUMBER'", "'ENCODE'", + "'DISTKEY'", "'SORTKEY'", "'CASE_SENSITIVE'", "'CASE_INSENSITIVE'", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "'\\\\'", + "", "", "", "", "", "", "", "", "", "'''", + } + staticData.SymbolicNames = []string{ + "", "Dollar", "OPEN_PAREN", "CLOSE_PAREN", "OPEN_BRACKET", "CLOSE_BRACKET", + "COMMA", "SEMI", "COLON", "STAR", "EQUAL", "DOT", "PLUS", "MINUS", "SLASH", + "CARET", "LT", "GT", "LESS_LESS", "GREATER_GREATER", "COLON_EQUALS", + "LESS_EQUALS", "EQUALS_GREATER", "GREATER_EQUALS", "DOT_DOT", "NOT_EQUALS", + "TYPECAST", "PERCENT", "PARAM", "Operator", "ALL", "ANALYSE", "ANALYZE", + "AND", "ANY", "ARRAY", "AS", "ASC", "ASYMMETRIC", "BOTH", "CASE", "CAST", + "CHECK", "COLLATE", "COLUMN", "CONSTRAINT", "CREATE", "CURRENT_CATALOG", + "CURRENT_DATE", "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP", + "CURRENT_USER", "DEFAULT", "DEFERRABLE", "DESC", "DISTINCT", "DO", "ELSE", + "EXCEPT", "FALSE_P", "FETCH", "FOR", "FOREIGN", "FROM", "GRANT", "GROUP_P", + "HAVING", "IN_P", "INITIALLY", "INTERSECT", "INTO", "LATERAL_P", "LEADING", + "LIMIT", "LOCALTIME", "LOCALTIMESTAMP", "NOT", "NULL_P", "OFFSET", "ON", + "ONLY", "OR", "ORDER", "PLACING", "PRIMARY", "REFERENCES", "RETURNING", + "SELECT", "SESSION_USER", "SOME", "SYMMETRIC", "TABLE", "THEN", "TO", + "TRAILING", "TRUE_P", "UNION", "UNIQUE", "USER", "USING", "VARIADIC", + "WHEN", "WHERE", "WINDOW", "WITH", "AUTHORIZATION", "BINARY", "COLLATION", + "CONCURRENTLY", "CROSS", "CURRENT_SCHEMA", "FREEZE", "FULL", "ILIKE", + "INNER_P", "IS", "ISNULL", "JOIN", "LEFT", "LIKE", "NATURAL", "NOTNULL", + "OUTER_P", "OVER", "OVERLAPS", "RIGHT", "SIMILAR", "VERBOSE", "ABORT_P", + "ABSOLUTE_P", "ACCESS", "ACTION", "ADD_P", "ADMIN", "AFTER", "AGGREGATE", + "ALSO", "ALTER", "ALWAYS", "ASSERTION", "ASSIGNMENT", "AT", "ATTRIBUTE", + "BACKWARD", "BEFORE", "BEGIN_P", "BY", "CACHE", "CALLED", "CASCADE", + "CASCADED", "CATALOG", "CHAIN", "CHARACTERISTICS", "CHECKPOINT", "CLASS", + "CLOSE", "CLUSTER", "COMMENT", "COMMENTS", "COMMIT", "COMMITTED", "CONFIGURATION", + "CONNECTION", "CONSTRAINTS", "CONTENT_P", "CONTINUE_P", "CONVERSION_P", + "COPY", "COST", "CSV", "CURSOR", "CYCLE", "DATA_P", "DATABASE", "DAY_P", + "DEALLOCATE", "DECLARE", "DEFAULTS", "DEFERRED", "DEFINER", "DELETE_P", + "DELIMITER", "DELIMITERS", "DICTIONARY", "DISABLE_P", "DISCARD", "DOCUMENT_P", + "DOMAIN_P", "DOUBLE_P", "DROP", "EACH", "ENABLE_P", "ENCODING", "ENCRYPTED", + "ENUM_P", "ESCAPE", "EVENT", "EXCLUDE", "EXCLUDING", "EXCLUSIVE", "EXECUTE", + "EXPLAIN", "EXTENSION", "EXTERNAL", "FAMILY", "FIRST_P", "FOLLOWING", + "FORCE", "FORWARD", "FUNCTION", "FUNCTIONS", "GLOBAL", "GRANTED", "HANDLER", + "HEADER_P", "HOLD", "HOUR_P", "IDENTITY_P", "IF_P", "IMMEDIATE", "IMMUTABLE", + "IMPLICIT_P", "INCLUDING", "INCREMENT", "INDEX", "INDEXES", "INHERIT", + "INHERITS", "INLINE_P", "INSENSITIVE", "INSERT", "INSTEAD", "INVOKER", + "ISOLATION", "KEY", "LABEL", "LANGUAGE", "LARGE_P", "LAST_P", "LEAKPROOF", + "LEVEL", "LISTEN", "LOAD", "LOCAL", "LOCATION", "LOCK_P", "MAPPING", + "MATCH", "MATCHED", "MATERIALIZED", "MAXVALUE", "MERGE", "MINUTE_P", + "MINVALUE", "MODE", "MONTH_P", "MOVE", "NAME_P", "NAMES", "NEXT", "NO", + "NOTHING", "NOTIFY", "NOWAIT", "NULLS_P", "OBJECT_P", "OF", "OFF", "OIDS", + "OPERATOR", "OPTION", "OPTIONS", "OWNED", "OWNER", "PARSER", "PARTIAL", + "PARTITION", "PASSING", "PASSWORD", "PLANS", "PRECEDING", "PREPARE", + "PREPARED", "PRESERVE", "PRIOR", "PRIVILEGES", "PROCEDURAL", "PROCEDURE", + "PROGRAM", "QUOTE", "RANGE", "READ", "REASSIGN", "RECHECK", "RECURSIVE", + "REF", "REFRESH", "REINDEX", "RELATIVE_P", "RELEASE", "RENAME", "REPEATABLE", + "REPLACE", "REPLICA", "RESET", "RESTART", "RESTRICT", "RETURNS", "REVOKE", + "ROLE", "ROLLBACK", "ROWS", "RULE", "SAVEPOINT", "SCHEMA", "SCROLL", + "SEARCH", "SECOND_P", "SECURITY", "SEQUENCE", "SEQUENCES", "SERIALIZABLE", + "SERVER", "SESSION", "SET", "SHARE", "SHOW", "SIMPLE", "SNAPSHOT", "STABLE", + "STANDALONE_P", "START", "STATEMENT", "STATISTICS", "STDIN", "STDOUT", + "STORAGE", "STRICT_P", "STRIP_P", "SYSID", "SYSTEM_P", "TABLES", "TABLESPACE", + "TEMP", "TEMPLATE", "TEMPORARY", "TEXT_P", "TRANSACTION", "TRIGGER", + "TRUNCATE", "TRUSTED", "TYPE_P", "TYPES_P", "UNBOUNDED", "UNCOMMITTED", + "UNENCRYPTED", "UNKNOWN", "UNLISTEN", "UNLOGGED", "UNTIL", "UPDATE", + "VACUUM", "VALID", "VALIDATE", "VALIDATOR", "VARYING", "VERSION_P", + "VIEW", "VOLATILE", "WHITESPACE_P", "WITHOUT", "WORK", "WRAPPER", "WRITE", + "XML_P", "YEAR_P", "YES_P", "ZONE", "ATOMIC_P", "BETWEEN", "BIGINT", + "BIT", "BOOLEAN_P", "CHAR_P", "CHARACTER", "COALESCE", "DEC", "DECIMAL_P", + "EXISTS", "EXTRACT", "FLOAT_P", "GREATEST", "INOUT", "INT_P", "INTEGER", + "INTERVAL", "LEAST", "NATIONAL", "NCHAR", "NONE", "NULLIF", "NUMERIC", + "OVERLAY", "PARAMETER", "POSITION", "PRECISION", "REAL", "ROW", "SETOF", + "SMALLINT", "SUBSTRING", "TIME", "TIMESTAMP", "TREAT", "TRIM", "VALUES", + "VARCHAR", "XMLATTRIBUTES", "XMLCOMMENT", "XMLAGG", "XML_IS_WELL_FORMED", + "XML_IS_WELL_FORMED_DOCUMENT", "XML_IS_WELL_FORMED_CONTENT", "XPATH", + "XPATH_EXISTS", "XMLCONCAT", "XMLELEMENT", "XMLEXISTS", "XMLFOREST", + "XMLPARSE", "XMLPI", "XMLROOT", "XMLSERIALIZE", "CALL", "CURRENT_P", + "ATTACH", "DETACH", "EXPRESSION", "GENERATED", "LOGGED", "STORED", "INCLUDE", + "ROUTINE", "TRANSFORM", "IMPORT_P", "POLICY", "METHOD", "REFERENCING", + "NEW", "OLD", "VALUE_P", "SUBSCRIPTION", "PUBLICATION", "OUT_P", "END_P", + "ROUTINES", "SCHEMAS", "PROCEDURES", "INPUT_P", "SUPPORT", "PARALLEL", + "SQL_P", "DEPENDS", "OVERRIDING", "CONFLICT", "SKIP_P", "LOCKED", "TIES", + "ROLLUP", "CUBE", "GROUPING", "SETS", "TABLESAMPLE", "ORDINALITY", "XMLTABLE", + "COLUMNS", "XMLNAMESPACES", "ROWTYPE", "NORMALIZED", "WITHIN", "FILTER", + "GROUPS", "OTHERS", "NFC", "NFD", "NFKC", "NFKD", "UESCAPE", "VIEWS", + "NORMALIZE", "DUMP", "PRINT_STRICT_PARAMS", "VARIABLE_CONFLICT", "ERROR", + "USE_VARIABLE", "USE_COLUMN", "ALIAS", "CONSTANT", "PERFORM", "GET", + "DIAGNOSTICS", "STACKED", "ELSIF", "WHILE", "REVERSE", "FOREACH", "SLICE", + "EXIT", "RETURN", "QUERY", "RAISE", "SQLSTATE", "DEBUG", "LOG", "INFO", + "NOTICE", "WARNING", "EXCEPTION", "ASSERT", "LOOP", "OPEN", "ABS", "CBRT", + "CEIL", "CEILING", "DEGREES", "DIV", "EXP", "FACTORIAL", "FLOOR", "GCD", + "LCM", "LN", "LOG10", "MIN_SCALE", "MOD", "PI", "POWER", "RADIANS", + "ROUND", "SCALE", "SIGN", "SQRT", "TRIM_SCALE", "TRUNC", "WIDTH_BUCKET", + "RANDOM", "SETSEED", "ACOS", "ACOSD", "ASIN", "ASIND", "ATAN", "ATAND", + "ATAN2", "ATAN2D", "COS", "COSD", "COT", "COTD", "SIN", "SIND", "TAN", + "TAND", "SINH", "COSH", "TANH", "ASINH", "ACOSH", "ATANH", "BIT_LENGTH", + "CHAR_LENGTH", "CHARACTER_LENGTH", "LOWER", "OCTET_LENGTH", "UPPER", + "ASCII", "BTRIM", "CHR", "CONCAT", "CONCAT_WS", "FORMAT", "INITCAP", + "LENGTH", "LPAD", "LTRIM", "MD5", "PARSE_IDENT", "PG_CLIENT_ENCODING", + "QUOTE_IDENT", "QUOTE_LITERAL", "QUOTE_NULLABLE", "REGEXP_COUNT", "REGEXP_INSTR", + "REGEXP_LIKE", "REGEXP_MATCH", "REGEXP_MATCHES", "REGEXP_REPLACE", "REGEXP_SPLIT_TO_ARRAY", + "REGEXP_SPLIT_TO_TABLE", "REGEXP_SUBSTR", "REPEAT", "RPAD", "RTRIM", + "SPLIT_PART", "STARTS_WITH", "STRING_TO_ARRAY", "STRING_TO_TABLE", "STRPOS", + "SUBSTR", "TO_ASCII", "TO_HEX", "TRANSLATE", "UNISTR", "AGE", "CLOCK_TIMESTAMP", + "DATE_BIN", "DATE_PART", "DATE_TRUNC", "ISFINITE", "JUSTIFY_DAYS", "JUSTIFY_HOURS", + "JUSTIFY_INTERVAL", "MAKE_DATE", "MAKE_INTERVAL", "MAKE_TIME", "MAKE_TIMESTAMP", + "MAKE_TIMESTAMPTZ", "NOW", "STATEMENT_TIMESTAMP", "TIMEOFDAY", "TRANSACTION_TIMESTAMP", + "TO_TIMESTAMP", "TO_CHAR", "TO_DATE", "TO_NUMBER", "ENCODE", "DISTKEY", + "SORTKEY", "CASE_SENSITIVE", "CASE_INSENSITIVE", "Identifier", "QuotedIdentifier", + "UnterminatedQuotedIdentifier", "InvalidQuotedIdentifier", "InvalidUnterminatedQuotedIdentifier", + "UnicodeQuotedIdentifier", "UnterminatedUnicodeQuotedIdentifier", "InvalidUnicodeQuotedIdentifier", + "InvalidUnterminatedUnicodeQuotedIdentifier", "StringConstant", "UnterminatedStringConstant", + "UnicodeEscapeStringConstant", "UnterminatedUnicodeEscapeStringConstant", + "BeginDollarStringConstant", "BinaryStringConstant", "UnterminatedBinaryStringConstant", + "InvalidBinaryStringConstant", "InvalidUnterminatedBinaryStringConstant", + "HexadecimalStringConstant", "UnterminatedHexadecimalStringConstant", + "InvalidHexadecimalStringConstant", "InvalidUnterminatedHexadecimalStringConstant", + "Integral", "NumericFail", "Numeric", "PLSQLVARIABLENAME", "PLSQLIDENTIFIER", + "Whitespace", "Newline", "LineComment", "BlockComment", "UnterminatedBlockComment", + "MetaCommand", "EndMetaCommand", "ErrorCharacter", "EscapeStringConstant", + "UnterminatedEscapeStringConstant", "InvalidEscapeStringConstant", "InvalidUnterminatedEscapeStringConstant", + "AfterEscapeStringConstantMode_NotContinued", "AfterEscapeStringConstantWithNewlineMode_NotContinued", + "DollarText", "EndDollarStringConstant", "AfterEscapeStringConstantWithNewlineMode_Continued", + } + staticData.RuleNames = []string{ + "root", "plsqlroot", "stmtblock", "stmtmulti", "stmt", "plsqlconsolecommand", + "callstmt", "createrolestmt", "opt_with", "optrolelist", "alteroptrolelist", + "alteroptroleelem", "createoptroleelem", "createuserstmt", "alterrolestmt", + "opt_in_database", "alterrolesetstmt", "droprolestmt", "creategroupstmt", + "altergroupstmt", "add_drop", "createschemastmt", "optschemaname", "optschemaeltlist", + "schema_stmt", "variablesetstmt", "set_rest", "generic_set", "set_rest_more", + "var_name", "var_list", "var_value", "iso_level", "opt_boolean_or_string", + "zone_value", "opt_encoding", "nonreservedword_or_sconst", "variableresetstmt", + "reset_rest", "generic_reset", "setresetclause", "functionsetresetclause", + "variableshowstmt", "constraintssetstmt", "constraints_set_list", "constraints_set_mode", + "checkpointstmt", "discardstmt", "altertablestmt", "alter_table_cmds", + "partition_cmd", "index_partition_cmd", "alter_table_cmd", "alter_column_default", + "opt_drop_behavior", "opt_collate_clause", "alter_using", "replica_identity", + "reloptions", "opt_reloptions", "reloption_list", "reloption_elem", + "alter_identity_column_option_list", "alter_identity_column_option", + "partitionboundspec", "hash_partbound_elem", "hash_partbound", "altercompositetypestmt", + "alter_type_cmds", "alter_type_cmd", "closeportalstmt", "copystmt", + "copy_from", "opt_program", "copy_file_name", "copy_options", "copy_opt_list", + "copy_opt_item", "opt_binary", "copy_delimiter", "opt_using", "copy_generic_opt_list", + "copy_generic_opt_elem", "copy_generic_opt_arg", "copy_generic_opt_arg_list", + "copy_generic_opt_arg_list_item", "createstmt", "opttemp", "opttableelementlist", + "opttypedtableelementlist", "tableelementlist", "typedtableelementlist", + "tableelement", "typedtableelement", "columnDef", "rs_colattributes", + "columnOptions", "colquallist", "colconstraint", "colconstraintelem", + "opt_unique_null_treatment", "generated_when", "constraintattr", "tablelikeclause", + "tablelikeoptionlist", "tablelikeoption", "tableconstraint", "constraintelem", + "opt_no_inherit", "opt_column_list", "columnlist", "columnElem", "opt_c_include", + "key_match", "exclusionconstraintlist", "exclusionconstraintelem", "exclusionwhereclause", + "key_actions", "key_update", "key_delete", "key_action", "optinherit", + "optpartitionspec", "partitionspec", "part_params", "part_elem", "table_access_method_clause", + "optwith", "oncommitoption", "opttablespace", "optconstablespace", "existingindex", + "createstatsstmt", "alterstatsstmt", "createasstmt", "create_as_target", + "opt_with_data", "creatematviewstmt", "create_mv_target", "optnolog", + "refreshmatviewstmt", "createseqstmt", "alterseqstmt", "optseqoptlist", + "optparenthesizedseqoptlist", "seqoptlist", "seqoptelem", "opt_by", + "numericonly", "numericonly_list", "createplangstmt", "opt_trusted", + "handler_name", "opt_inline_handler", "validator_clause", "opt_validator", + "opt_procedural", "createtablespacestmt", "opttablespaceowner", "droptablespacestmt", + "createextensionstmt", "create_extension_opt_list", "create_extension_opt_item", + "alterextensionstmt", "alter_extension_opt_list", "alter_extension_opt_item", + "alterextensioncontentsstmt", "createfdwstmt", "fdw_option", "fdw_options", + "opt_fdw_options", "alterfdwstmt", "create_generic_options", "generic_option_list", + "alter_generic_options", "alter_generic_option_list", "alter_generic_option_elem", + "generic_option_elem", "generic_option_name", "generic_option_arg", + "createforeignserverstmt", "opt_type", "foreign_server_version", "opt_foreign_server_version", + "alterforeignserverstmt", "createforeigntablestmt", "importforeignschemastmt", + "import_qualification_type", "import_qualification", "createusermappingstmt", + "auth_ident", "dropusermappingstmt", "alterusermappingstmt", "createpolicystmt", + "alterpolicystmt", "rowsecurityoptionalexpr", "rowsecurityoptionalwithcheck", + "rowsecuritydefaulttorole", "rowsecurityoptionaltorole", "rowsecuritydefaultpermissive", + "rowsecuritydefaultforcmd", "row_security_cmd", "createamstmt", "am_type", + "createtrigstmt", "triggeractiontime", "triggerevents", "triggeroneevent", + "triggerreferencing", "triggertransitions", "triggertransition", "transitionoldornew", + "transitionrowortable", "transitionrelname", "triggerforspec", "triggerforopteach", + "triggerfortype", "triggerwhen", "function_or_procedure", "triggerfuncargs", + "triggerfuncarg", "optconstrfromtable", "constraintattributespec", "constraintattributeElem", + "createeventtrigstmt", "event_trigger_when_list", "event_trigger_when_item", + "event_trigger_value_list", "altereventtrigstmt", "enable_trigger", + "createassertionstmt", "definestmt", "definition", "def_list", "def_elem", + "def_arg", "old_aggr_definition", "old_aggr_list", "old_aggr_elem", + "opt_enum_val_list", "enum_val_list", "alterenumstmt", "opt_if_not_exists", + "createopclassstmt", "opclass_item_list", "opclass_item", "opt_default", + "opt_opfamily", "opclass_purpose", "opt_recheck", "createopfamilystmt", + "alteropfamilystmt", "opclass_drop_list", "opclass_drop", "dropopclassstmt", + "dropopfamilystmt", "dropownedstmt", "reassignownedstmt", "dropstmt", + "object_type_any_name", "object_type_name", "drop_type_name", "object_type_name_on_any_name", + "any_name_list", "any_name", "attrs", "type_name_list", "truncatestmt", + "opt_restart_seqs", "commentstmt", "comment_text", "seclabelstmt", "opt_provider", + "security_label", "fetchstmt", "fetch_args", "from_in", "opt_from_in", + "grantstmt", "revokestmt", "privileges", "privilege_list", "privilege", + "privilege_target", "parameter_name_list", "parameter_name", "grantee_list", + "grantee", "opt_grant_grant_option", "grantrolestmt", "revokerolestmt", + "opt_grant_admin_option", "opt_granted_by", "alterdefaultprivilegesstmt", + "defacloptionlist", "defacloption", "defaclaction", "defacl_privilege_target", + "indexstmt", "opt_unique", "opt_concurrently", "opt_index_name", "access_method_clause", + "index_params", "index_elem_options", "index_elem", "opt_include", "index_including_params", + "opt_collate", "opt_class", "opt_asc_desc", "opt_nulls_order", "createfunctionstmt", + "opt_or_replace", "func_args", "func_args_list", "function_with_argtypes_list", + "function_with_argtypes", "func_args_with_defaults", "func_args_with_defaults_list", + "func_arg", "arg_class", "param_name", "func_return", "func_type", "func_arg_with_default", + "aggr_arg", "aggr_args", "aggr_args_list", "aggregate_with_argtypes", + "aggregate_with_argtypes_list", "createfunc_opt_list", "common_func_opt_item", + "createfunc_opt_item", "func_as", "transform_type_list", "opt_definition", + "table_func_column", "table_func_column_list", "alterfunctionstmt", + "alterfunc_opt_list", "opt_restrict", "removefuncstmt", "removeaggrstmt", + "removeoperstmt", "oper_argtypes", "any_operator", "operator_with_argtypes_list", + "operator_with_argtypes", "dostmt", "dostmt_opt_list", "dostmt_opt_item", + "createcaststmt", "cast_context", "dropcaststmt", "opt_if_exists", "createtransformstmt", + "transform_element_list", "droptransformstmt", "reindexstmt", "reindex_target_type", + "reindex_target_multitable", "reindex_option_list", "reindex_option_elem", + "altertblspcstmt", "renamestmt", "opt_column", "opt_set_data", "alterobjectdependsstmt", + "opt_no", "alterobjectschemastmt", "alteroperatorstmt", "operator_def_list", + "operator_def_elem", "operator_def_arg", "altertypestmt", "alterownerstmt", + "createpublicationstmt", "pub_obj_list", "publication_obj_spec", "opt_where_clause", + "alterpublicationstmt", "createsubscriptionstmt", "publication_name_list", + "publication_name_item", "altersubscriptionstmt", "dropsubscriptionstmt", + "rulestmt", "ruleactionlist", "ruleactionmulti", "ruleactionstmt", "ruleactionstmtOrEmpty", + "event", "opt_instead", "notifystmt", "notify_payload", "listenstmt", + "unlistenstmt", "transactionstmt", "opt_transaction", "transaction_mode_item", + "transaction_mode_list", "transaction_mode_list_or_empty", "opt_transaction_chain", + "viewstmt", "opt_check_option", "loadstmt", "createdbstmt", "createdb_opt_list", + "createdb_opt_items", "createdb_opt_item", "createdb_opt_name", "opt_equal", + "alterdatabasestmt", "alterdatabasesetstmt", "dropdbstmt", "drop_option_list", + "drop_option", "altercollationstmt", "altersystemstmt", "createdomainstmt", + "alterdomainstmt", "opt_as", "altertsdictionarystmt", "altertsconfigurationstmt", + "any_with", "createconversionstmt", "clusterstmt", "cluster_index_specification", + "vacuumstmt", "analyzestmt", "vac_analyze_option_list", "analyze_keyword", + "vac_analyze_option_elem", "vac_analyze_option_name", "vac_analyze_option_arg", + "opt_analyze", "opt_verbose", "opt_full", "opt_freeze", "opt_name_list", + "vacuum_relation", "vacuum_relation_list", "opt_vacuum_relation_list", + "explainstmt", "explainablestmt", "explain_option_list", "explain_option_elem", + "explain_option_name", "explain_option_arg", "preparestmt", "prep_type_clause", + "preparablestmt", "executestmt", "execute_param_clause", "deallocatestmt", + "insertstmt", "insert_target", "insert_rest", "override_kind", "insert_column_list", + "insert_column_item", "opt_on_conflict", "opt_conf_expr", "returning_clause", + "mergestmt", "merge_insert_clause", "merge_update_clause", "merge_delete_clause", + "deletestmt", "using_clause", "lockstmt", "opt_lock", "lock_type", "opt_nowait", + "opt_nowait_or_skip", "updatestmt", "set_clause_list", "set_clause", + "set_target", "set_target_list", "declarecursorstmt", "cursor_name", + "cursor_options", "opt_hold", "selectstmt", "select_with_parens", "select_no_parens", + "select_clause", "simple_select_intersect", "simple_select_pramary", + "with_clause", "cte_list", "common_table_expr", "opt_materialized", + "opt_with_clause", "into_clause", "opt_strict", "opttempTableName", + "opt_table", "all_or_distinct", "distinct_clause", "opt_all_clause", + "opt_sort_clause", "sort_clause", "sortby_list", "sortby", "select_limit", + "opt_select_limit", "limit_clause", "offset_clause", "select_limit_value", + "select_offset_value", "select_fetch_first_value", "i_or_f_const", "row_or_rows", + "first_or_next", "group_clause", "group_by_list", "group_by_item", "empty_grouping_set", + "rollup_clause", "cube_clause", "grouping_sets_clause", "having_clause", + "for_locking_clause", "opt_for_locking_clause", "for_locking_items", + "for_locking_item", "for_locking_strength", "locked_rels_list", "values_clause", + "from_clause", "from_list", "table_ref", "joined_table", "alias_clause", + "opt_alias_clause", "table_alias_clause", "func_alias_clause", "join_type", + "join_qual", "relation_expr", "relation_expr_list", "relation_expr_opt_alias", + "tablesample_clause", "opt_repeatable_clause", "func_table", "rowsfrom_item", + "rowsfrom_list", "opt_col_def_list", "opt_ordinality", "where_clause", + "where_or_current_clause", "opttablefuncelementlist", "tablefuncelementlist", + "tablefuncelement", "xmltable", "xmltable_column_list", "xmltable_column_el", + "xmltable_column_option_list", "xmltable_column_option_el", "xml_namespace_list", + "xml_namespace_el", "typename", "opt_array_bounds", "simpletypename", + "consttypename", "generictype", "opt_type_modifiers", "numeric", "opt_float", + "bit", "constbit", "bitwithlength", "bitwithoutlength", "character", + "constcharacter", "character_c", "opt_varying", "constdatetime", "constinterval", + "opt_timezone", "opt_interval", "interval_second", "opt_escape", "a_expr", + "a_expr_qual", "a_expr_lessless", "a_expr_or", "a_expr_and", "a_expr_between", + "a_expr_in", "a_expr_unary_not", "a_expr_isnull", "a_expr_is_not", "a_expr_compare", + "a_expr_like", "a_expr_qual_op", "a_expr_unary_qualop", "a_expr_add", + "a_expr_mul", "a_expr_caret", "a_expr_unary_sign", "a_expr_at_time_zone", + "a_expr_collate", "a_expr_typecast", "b_expr", "c_expr", "plsqlvariablename", + "func_application", "func_expr", "func_expr_windowless", "func_expr_common_subexpr", + "xml_root_version", "opt_xml_root_standalone", "xml_attributes", "xml_attribute_list", + "xml_attribute_el", "document_or_content", "xml_whitespace_option", + "xmlexists_argument", "xml_passing_mech", "within_group_clause", "filter_clause", + "window_clause", "window_definition_list", "window_definition", "over_clause", + "window_specification", "opt_existing_window_name", "opt_partition_clause", + "opt_frame_clause", "frame_extent", "frame_bound", "opt_window_exclusion_clause", + "row", "explicit_row", "implicit_row", "sub_type", "all_op", "mathop", + "qual_op", "qual_all_op", "subquery_Op", "expr_list", "func_arg_list", + "func_arg_expr", "type_list", "array_expr", "array_expr_list", "extract_list", + "extract_arg", "unicode_normal_form", "overlay_list", "position_list", + "substr_list", "trim_list", "in_expr", "case_expr", "when_clause_list", + "when_clause", "case_default", "case_arg", "columnref", "indirection_el", + "opt_slice_bound", "indirection", "opt_indirection", "opt_target_list", + "target_list", "target_el", "target_alias", "qualified_name_list", "qualified_name", + "name_list", "name", "attr_name", "file_name", "func_name", "aexprconst", + "xconst", "bconst", "fconst", "iconst", "sconst", "anysconst", "opt_uescape", + "signediconst", "roleid", "rolespec", "role_list", "colid", "table_alias", + "type_function_name", "nonreservedword", "collabel", "identifier", "plsqlidentifier", + "unreserved_keyword", "col_name_keyword", "type_func_name_keyword", + "reserved_keyword", "builtin_function_name", "pl_function", "comp_options", + "comp_option", "sharp", "option_value", "opt_semi", "pl_block", "decl_sect", + "decl_start", "decl_stmts", "label_decl", "decl_stmt", "decl_statement", + "opt_scrollable", "decl_cursor_query", "decl_cursor_args", "decl_cursor_arglist", + "decl_cursor_arg", "decl_is_for", "decl_aliasitem", "decl_varname", + "decl_const", "decl_datatype", "decl_collate", "decl_notnull", "decl_defval", + "decl_defkey", "assign_operator", "proc_sect", "proc_stmt", "stmt_perform", + "stmt_call", "opt_expr_list", "stmt_assign", "stmt_getdiag", "getdiag_area_opt", + "getdiag_list", "getdiag_list_item", "getdiag_item", "getdiag_target", + "assign_var", "stmt_if", "stmt_elsifs", "stmt_else", "stmt_case", "opt_expr_until_when", + "case_when_list", "case_when", "opt_case_else", "stmt_loop", "stmt_while", + "stmt_for", "for_control", "opt_for_using_expression", "opt_cursor_parameters", + "opt_reverse", "opt_by_expression", "for_variable", "stmt_foreach_a", + "foreach_slice", "stmt_exit", "exit_type", "stmt_return", "opt_return_result", + "stmt_raise", "opt_stmt_raise_level", "opt_raise_list", "opt_raise_using", + "opt_raise_using_elem", "opt_raise_using_elem_list", "stmt_assert", + "opt_stmt_assert_message", "loop_body", "stmt_execsql", "stmt_dynexecute", + "opt_execute_using", "opt_execute_using_list", "opt_execute_into", "stmt_open", + "opt_open_bound_list_item", "opt_open_bound_list", "opt_open_using", + "opt_scroll_option", "opt_scroll_option_no", "stmt_fetch", "into_target", + "opt_cursor_from", "opt_fetch_direction", "stmt_move", "stmt_close", + "stmt_null", "stmt_commit", "stmt_rollback", "plsql_opt_transaction_chain", + "stmt_set", "cursor_variable", "exception_sect", "proc_exceptions", + "proc_exception", "proc_conditions", "proc_condition", "opt_block_label", + "opt_loop_label", "opt_label", "opt_exitcond", "any_identifier", "plsql_unreserved_keyword", + "sql_expression", "expr_until_then", "expr_until_semi", "expr_until_rightbracket", + "expr_until_loop", "make_execsql_stmt", "opt_returning_clause_into", + } + staticData.PredictionContextCache = antlr.NewPredictionContextCache() + staticData.serializedATN = []int32{ + 4, 1, 686, 11268, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, + 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, + 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, + 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, + 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, + 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, + 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, + 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, + 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, + 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, + 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, + 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, + 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, + 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, + 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, + 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, + 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, + 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, + 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, + 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, + 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, + 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, + 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, + 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, + 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, + 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, + 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, + 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 2, 139, 7, 139, 2, + 140, 7, 140, 2, 141, 7, 141, 2, 142, 7, 142, 2, 143, 7, 143, 2, 144, 7, + 144, 2, 145, 7, 145, 2, 146, 7, 146, 2, 147, 7, 147, 2, 148, 7, 148, 2, + 149, 7, 149, 2, 150, 7, 150, 2, 151, 7, 151, 2, 152, 7, 152, 2, 153, 7, + 153, 2, 154, 7, 154, 2, 155, 7, 155, 2, 156, 7, 156, 2, 157, 7, 157, 2, + 158, 7, 158, 2, 159, 7, 159, 2, 160, 7, 160, 2, 161, 7, 161, 2, 162, 7, + 162, 2, 163, 7, 163, 2, 164, 7, 164, 2, 165, 7, 165, 2, 166, 7, 166, 2, + 167, 7, 167, 2, 168, 7, 168, 2, 169, 7, 169, 2, 170, 7, 170, 2, 171, 7, + 171, 2, 172, 7, 172, 2, 173, 7, 173, 2, 174, 7, 174, 2, 175, 7, 175, 2, + 176, 7, 176, 2, 177, 7, 177, 2, 178, 7, 178, 2, 179, 7, 179, 2, 180, 7, + 180, 2, 181, 7, 181, 2, 182, 7, 182, 2, 183, 7, 183, 2, 184, 7, 184, 2, + 185, 7, 185, 2, 186, 7, 186, 2, 187, 7, 187, 2, 188, 7, 188, 2, 189, 7, + 189, 2, 190, 7, 190, 2, 191, 7, 191, 2, 192, 7, 192, 2, 193, 7, 193, 2, + 194, 7, 194, 2, 195, 7, 195, 2, 196, 7, 196, 2, 197, 7, 197, 2, 198, 7, + 198, 2, 199, 7, 199, 2, 200, 7, 200, 2, 201, 7, 201, 2, 202, 7, 202, 2, + 203, 7, 203, 2, 204, 7, 204, 2, 205, 7, 205, 2, 206, 7, 206, 2, 207, 7, + 207, 2, 208, 7, 208, 2, 209, 7, 209, 2, 210, 7, 210, 2, 211, 7, 211, 2, + 212, 7, 212, 2, 213, 7, 213, 2, 214, 7, 214, 2, 215, 7, 215, 2, 216, 7, + 216, 2, 217, 7, 217, 2, 218, 7, 218, 2, 219, 7, 219, 2, 220, 7, 220, 2, + 221, 7, 221, 2, 222, 7, 222, 2, 223, 7, 223, 2, 224, 7, 224, 2, 225, 7, + 225, 2, 226, 7, 226, 2, 227, 7, 227, 2, 228, 7, 228, 2, 229, 7, 229, 2, + 230, 7, 230, 2, 231, 7, 231, 2, 232, 7, 232, 2, 233, 7, 233, 2, 234, 7, + 234, 2, 235, 7, 235, 2, 236, 7, 236, 2, 237, 7, 237, 2, 238, 7, 238, 2, + 239, 7, 239, 2, 240, 7, 240, 2, 241, 7, 241, 2, 242, 7, 242, 2, 243, 7, + 243, 2, 244, 7, 244, 2, 245, 7, 245, 2, 246, 7, 246, 2, 247, 7, 247, 2, + 248, 7, 248, 2, 249, 7, 249, 2, 250, 7, 250, 2, 251, 7, 251, 2, 252, 7, + 252, 2, 253, 7, 253, 2, 254, 7, 254, 2, 255, 7, 255, 2, 256, 7, 256, 2, + 257, 7, 257, 2, 258, 7, 258, 2, 259, 7, 259, 2, 260, 7, 260, 2, 261, 7, + 261, 2, 262, 7, 262, 2, 263, 7, 263, 2, 264, 7, 264, 2, 265, 7, 265, 2, + 266, 7, 266, 2, 267, 7, 267, 2, 268, 7, 268, 2, 269, 7, 269, 2, 270, 7, + 270, 2, 271, 7, 271, 2, 272, 7, 272, 2, 273, 7, 273, 2, 274, 7, 274, 2, + 275, 7, 275, 2, 276, 7, 276, 2, 277, 7, 277, 2, 278, 7, 278, 2, 279, 7, + 279, 2, 280, 7, 280, 2, 281, 7, 281, 2, 282, 7, 282, 2, 283, 7, 283, 2, + 284, 7, 284, 2, 285, 7, 285, 2, 286, 7, 286, 2, 287, 7, 287, 2, 288, 7, + 288, 2, 289, 7, 289, 2, 290, 7, 290, 2, 291, 7, 291, 2, 292, 7, 292, 2, + 293, 7, 293, 2, 294, 7, 294, 2, 295, 7, 295, 2, 296, 7, 296, 2, 297, 7, + 297, 2, 298, 7, 298, 2, 299, 7, 299, 2, 300, 7, 300, 2, 301, 7, 301, 2, + 302, 7, 302, 2, 303, 7, 303, 2, 304, 7, 304, 2, 305, 7, 305, 2, 306, 7, + 306, 2, 307, 7, 307, 2, 308, 7, 308, 2, 309, 7, 309, 2, 310, 7, 310, 2, + 311, 7, 311, 2, 312, 7, 312, 2, 313, 7, 313, 2, 314, 7, 314, 2, 315, 7, + 315, 2, 316, 7, 316, 2, 317, 7, 317, 2, 318, 7, 318, 2, 319, 7, 319, 2, + 320, 7, 320, 2, 321, 7, 321, 2, 322, 7, 322, 2, 323, 7, 323, 2, 324, 7, + 324, 2, 325, 7, 325, 2, 326, 7, 326, 2, 327, 7, 327, 2, 328, 7, 328, 2, + 329, 7, 329, 2, 330, 7, 330, 2, 331, 7, 331, 2, 332, 7, 332, 2, 333, 7, + 333, 2, 334, 7, 334, 2, 335, 7, 335, 2, 336, 7, 336, 2, 337, 7, 337, 2, + 338, 7, 338, 2, 339, 7, 339, 2, 340, 7, 340, 2, 341, 7, 341, 2, 342, 7, + 342, 2, 343, 7, 343, 2, 344, 7, 344, 2, 345, 7, 345, 2, 346, 7, 346, 2, + 347, 7, 347, 2, 348, 7, 348, 2, 349, 7, 349, 2, 350, 7, 350, 2, 351, 7, + 351, 2, 352, 7, 352, 2, 353, 7, 353, 2, 354, 7, 354, 2, 355, 7, 355, 2, + 356, 7, 356, 2, 357, 7, 357, 2, 358, 7, 358, 2, 359, 7, 359, 2, 360, 7, + 360, 2, 361, 7, 361, 2, 362, 7, 362, 2, 363, 7, 363, 2, 364, 7, 364, 2, + 365, 7, 365, 2, 366, 7, 366, 2, 367, 7, 367, 2, 368, 7, 368, 2, 369, 7, + 369, 2, 370, 7, 370, 2, 371, 7, 371, 2, 372, 7, 372, 2, 373, 7, 373, 2, + 374, 7, 374, 2, 375, 7, 375, 2, 376, 7, 376, 2, 377, 7, 377, 2, 378, 7, + 378, 2, 379, 7, 379, 2, 380, 7, 380, 2, 381, 7, 381, 2, 382, 7, 382, 2, + 383, 7, 383, 2, 384, 7, 384, 2, 385, 7, 385, 2, 386, 7, 386, 2, 387, 7, + 387, 2, 388, 7, 388, 2, 389, 7, 389, 2, 390, 7, 390, 2, 391, 7, 391, 2, + 392, 7, 392, 2, 393, 7, 393, 2, 394, 7, 394, 2, 395, 7, 395, 2, 396, 7, + 396, 2, 397, 7, 397, 2, 398, 7, 398, 2, 399, 7, 399, 2, 400, 7, 400, 2, + 401, 7, 401, 2, 402, 7, 402, 2, 403, 7, 403, 2, 404, 7, 404, 2, 405, 7, + 405, 2, 406, 7, 406, 2, 407, 7, 407, 2, 408, 7, 408, 2, 409, 7, 409, 2, + 410, 7, 410, 2, 411, 7, 411, 2, 412, 7, 412, 2, 413, 7, 413, 2, 414, 7, + 414, 2, 415, 7, 415, 2, 416, 7, 416, 2, 417, 7, 417, 2, 418, 7, 418, 2, + 419, 7, 419, 2, 420, 7, 420, 2, 421, 7, 421, 2, 422, 7, 422, 2, 423, 7, + 423, 2, 424, 7, 424, 2, 425, 7, 425, 2, 426, 7, 426, 2, 427, 7, 427, 2, + 428, 7, 428, 2, 429, 7, 429, 2, 430, 7, 430, 2, 431, 7, 431, 2, 432, 7, + 432, 2, 433, 7, 433, 2, 434, 7, 434, 2, 435, 7, 435, 2, 436, 7, 436, 2, + 437, 7, 437, 2, 438, 7, 438, 2, 439, 7, 439, 2, 440, 7, 440, 2, 441, 7, + 441, 2, 442, 7, 442, 2, 443, 7, 443, 2, 444, 7, 444, 2, 445, 7, 445, 2, + 446, 7, 446, 2, 447, 7, 447, 2, 448, 7, 448, 2, 449, 7, 449, 2, 450, 7, + 450, 2, 451, 7, 451, 2, 452, 7, 452, 2, 453, 7, 453, 2, 454, 7, 454, 2, + 455, 7, 455, 2, 456, 7, 456, 2, 457, 7, 457, 2, 458, 7, 458, 2, 459, 7, + 459, 2, 460, 7, 460, 2, 461, 7, 461, 2, 462, 7, 462, 2, 463, 7, 463, 2, + 464, 7, 464, 2, 465, 7, 465, 2, 466, 7, 466, 2, 467, 7, 467, 2, 468, 7, + 468, 2, 469, 7, 469, 2, 470, 7, 470, 2, 471, 7, 471, 2, 472, 7, 472, 2, + 473, 7, 473, 2, 474, 7, 474, 2, 475, 7, 475, 2, 476, 7, 476, 2, 477, 7, + 477, 2, 478, 7, 478, 2, 479, 7, 479, 2, 480, 7, 480, 2, 481, 7, 481, 2, + 482, 7, 482, 2, 483, 7, 483, 2, 484, 7, 484, 2, 485, 7, 485, 2, 486, 7, + 486, 2, 487, 7, 487, 2, 488, 7, 488, 2, 489, 7, 489, 2, 490, 7, 490, 2, + 491, 7, 491, 2, 492, 7, 492, 2, 493, 7, 493, 2, 494, 7, 494, 2, 495, 7, + 495, 2, 496, 7, 496, 2, 497, 7, 497, 2, 498, 7, 498, 2, 499, 7, 499, 2, + 500, 7, 500, 2, 501, 7, 501, 2, 502, 7, 502, 2, 503, 7, 503, 2, 504, 7, + 504, 2, 505, 7, 505, 2, 506, 7, 506, 2, 507, 7, 507, 2, 508, 7, 508, 2, + 509, 7, 509, 2, 510, 7, 510, 2, 511, 7, 511, 2, 512, 7, 512, 2, 513, 7, + 513, 2, 514, 7, 514, 2, 515, 7, 515, 2, 516, 7, 516, 2, 517, 7, 517, 2, + 518, 7, 518, 2, 519, 7, 519, 2, 520, 7, 520, 2, 521, 7, 521, 2, 522, 7, + 522, 2, 523, 7, 523, 2, 524, 7, 524, 2, 525, 7, 525, 2, 526, 7, 526, 2, + 527, 7, 527, 2, 528, 7, 528, 2, 529, 7, 529, 2, 530, 7, 530, 2, 531, 7, + 531, 2, 532, 7, 532, 2, 533, 7, 533, 2, 534, 7, 534, 2, 535, 7, 535, 2, + 536, 7, 536, 2, 537, 7, 537, 2, 538, 7, 538, 2, 539, 7, 539, 2, 540, 7, + 540, 2, 541, 7, 541, 2, 542, 7, 542, 2, 543, 7, 543, 2, 544, 7, 544, 2, + 545, 7, 545, 2, 546, 7, 546, 2, 547, 7, 547, 2, 548, 7, 548, 2, 549, 7, + 549, 2, 550, 7, 550, 2, 551, 7, 551, 2, 552, 7, 552, 2, 553, 7, 553, 2, + 554, 7, 554, 2, 555, 7, 555, 2, 556, 7, 556, 2, 557, 7, 557, 2, 558, 7, + 558, 2, 559, 7, 559, 2, 560, 7, 560, 2, 561, 7, 561, 2, 562, 7, 562, 2, + 563, 7, 563, 2, 564, 7, 564, 2, 565, 7, 565, 2, 566, 7, 566, 2, 567, 7, + 567, 2, 568, 7, 568, 2, 569, 7, 569, 2, 570, 7, 570, 2, 571, 7, 571, 2, + 572, 7, 572, 2, 573, 7, 573, 2, 574, 7, 574, 2, 575, 7, 575, 2, 576, 7, + 576, 2, 577, 7, 577, 2, 578, 7, 578, 2, 579, 7, 579, 2, 580, 7, 580, 2, + 581, 7, 581, 2, 582, 7, 582, 2, 583, 7, 583, 2, 584, 7, 584, 2, 585, 7, + 585, 2, 586, 7, 586, 2, 587, 7, 587, 2, 588, 7, 588, 2, 589, 7, 589, 2, + 590, 7, 590, 2, 591, 7, 591, 2, 592, 7, 592, 2, 593, 7, 593, 2, 594, 7, + 594, 2, 595, 7, 595, 2, 596, 7, 596, 2, 597, 7, 597, 2, 598, 7, 598, 2, + 599, 7, 599, 2, 600, 7, 600, 2, 601, 7, 601, 2, 602, 7, 602, 2, 603, 7, + 603, 2, 604, 7, 604, 2, 605, 7, 605, 2, 606, 7, 606, 2, 607, 7, 607, 2, + 608, 7, 608, 2, 609, 7, 609, 2, 610, 7, 610, 2, 611, 7, 611, 2, 612, 7, + 612, 2, 613, 7, 613, 2, 614, 7, 614, 2, 615, 7, 615, 2, 616, 7, 616, 2, + 617, 7, 617, 2, 618, 7, 618, 2, 619, 7, 619, 2, 620, 7, 620, 2, 621, 7, + 621, 2, 622, 7, 622, 2, 623, 7, 623, 2, 624, 7, 624, 2, 625, 7, 625, 2, + 626, 7, 626, 2, 627, 7, 627, 2, 628, 7, 628, 2, 629, 7, 629, 2, 630, 7, + 630, 2, 631, 7, 631, 2, 632, 7, 632, 2, 633, 7, 633, 2, 634, 7, 634, 2, + 635, 7, 635, 2, 636, 7, 636, 2, 637, 7, 637, 2, 638, 7, 638, 2, 639, 7, + 639, 2, 640, 7, 640, 2, 641, 7, 641, 2, 642, 7, 642, 2, 643, 7, 643, 2, + 644, 7, 644, 2, 645, 7, 645, 2, 646, 7, 646, 2, 647, 7, 647, 2, 648, 7, + 648, 2, 649, 7, 649, 2, 650, 7, 650, 2, 651, 7, 651, 2, 652, 7, 652, 2, + 653, 7, 653, 2, 654, 7, 654, 2, 655, 7, 655, 2, 656, 7, 656, 2, 657, 7, + 657, 2, 658, 7, 658, 2, 659, 7, 659, 2, 660, 7, 660, 2, 661, 7, 661, 2, + 662, 7, 662, 2, 663, 7, 663, 2, 664, 7, 664, 2, 665, 7, 665, 2, 666, 7, + 666, 2, 667, 7, 667, 2, 668, 7, 668, 2, 669, 7, 669, 2, 670, 7, 670, 2, + 671, 7, 671, 2, 672, 7, 672, 2, 673, 7, 673, 2, 674, 7, 674, 2, 675, 7, + 675, 2, 676, 7, 676, 2, 677, 7, 677, 2, 678, 7, 678, 2, 679, 7, 679, 2, + 680, 7, 680, 2, 681, 7, 681, 2, 682, 7, 682, 2, 683, 7, 683, 2, 684, 7, + 684, 2, 685, 7, 685, 2, 686, 7, 686, 2, 687, 7, 687, 2, 688, 7, 688, 2, + 689, 7, 689, 2, 690, 7, 690, 2, 691, 7, 691, 2, 692, 7, 692, 2, 693, 7, + 693, 2, 694, 7, 694, 2, 695, 7, 695, 2, 696, 7, 696, 2, 697, 7, 697, 2, + 698, 7, 698, 2, 699, 7, 699, 2, 700, 7, 700, 2, 701, 7, 701, 2, 702, 7, + 702, 2, 703, 7, 703, 2, 704, 7, 704, 2, 705, 7, 705, 2, 706, 7, 706, 2, + 707, 7, 707, 2, 708, 7, 708, 2, 709, 7, 709, 2, 710, 7, 710, 2, 711, 7, + 711, 2, 712, 7, 712, 2, 713, 7, 713, 2, 714, 7, 714, 2, 715, 7, 715, 2, + 716, 7, 716, 2, 717, 7, 717, 2, 718, 7, 718, 2, 719, 7, 719, 2, 720, 7, + 720, 2, 721, 7, 721, 2, 722, 7, 722, 2, 723, 7, 723, 2, 724, 7, 724, 2, + 725, 7, 725, 2, 726, 7, 726, 2, 727, 7, 727, 2, 728, 7, 728, 2, 729, 7, + 729, 2, 730, 7, 730, 2, 731, 7, 731, 2, 732, 7, 732, 2, 733, 7, 733, 2, + 734, 7, 734, 2, 735, 7, 735, 2, 736, 7, 736, 2, 737, 7, 737, 2, 738, 7, + 738, 2, 739, 7, 739, 2, 740, 7, 740, 2, 741, 7, 741, 2, 742, 7, 742, 2, + 743, 7, 743, 2, 744, 7, 744, 2, 745, 7, 745, 2, 746, 7, 746, 2, 747, 7, + 747, 2, 748, 7, 748, 2, 749, 7, 749, 2, 750, 7, 750, 2, 751, 7, 751, 2, + 752, 7, 752, 2, 753, 7, 753, 2, 754, 7, 754, 2, 755, 7, 755, 2, 756, 7, + 756, 2, 757, 7, 757, 2, 758, 7, 758, 2, 759, 7, 759, 2, 760, 7, 760, 2, + 761, 7, 761, 2, 762, 7, 762, 2, 763, 7, 763, 2, 764, 7, 764, 2, 765, 7, + 765, 2, 766, 7, 766, 2, 767, 7, 767, 2, 768, 7, 768, 2, 769, 7, 769, 2, + 770, 7, 770, 2, 771, 7, 771, 2, 772, 7, 772, 2, 773, 7, 773, 2, 774, 7, + 774, 2, 775, 7, 775, 2, 776, 7, 776, 2, 777, 7, 777, 2, 778, 7, 778, 2, + 779, 7, 779, 2, 780, 7, 780, 2, 781, 7, 781, 2, 782, 7, 782, 2, 783, 7, + 783, 2, 784, 7, 784, 2, 785, 7, 785, 2, 786, 7, 786, 2, 787, 7, 787, 2, + 788, 7, 788, 2, 789, 7, 789, 2, 790, 7, 790, 2, 791, 7, 791, 2, 792, 7, + 792, 2, 793, 7, 793, 2, 794, 7, 794, 2, 795, 7, 795, 2, 796, 7, 796, 2, + 797, 7, 797, 2, 798, 7, 798, 2, 799, 7, 799, 2, 800, 7, 800, 2, 801, 7, + 801, 2, 802, 7, 802, 2, 803, 7, 803, 2, 804, 7, 804, 2, 805, 7, 805, 2, + 806, 7, 806, 2, 807, 7, 807, 2, 808, 7, 808, 2, 809, 7, 809, 2, 810, 7, + 810, 2, 811, 7, 811, 2, 812, 7, 812, 2, 813, 7, 813, 2, 814, 7, 814, 2, + 815, 7, 815, 2, 816, 7, 816, 2, 817, 7, 817, 1, 0, 1, 0, 1, 0, 1, 1, 1, + 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 1646, 8, 3, 5, 3, 1648, 8, 3, 10, 3, 12, + 3, 1651, 9, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 1778, 8, 4, 1, 5, 1, + 5, 3, 5, 1782, 8, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 1791, + 8, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 5, 9, 1798, 8, 9, 10, 9, 12, 9, 1801, + 9, 9, 1, 10, 5, 10, 1804, 8, 10, 10, 10, 12, 10, 1807, 9, 10, 1, 11, 1, + 11, 1, 11, 3, 11, 1812, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, + 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 1827, 8, 11, 1, + 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, + 1839, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 1845, 8, 13, 1, 13, 1, + 13, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 1853, 8, 14, 1, 14, 1, 14, 1, 15, + 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 3, 16, 1864, 8, 16, 1, 16, 1, + 16, 3, 16, 1868, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, + 1876, 8, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 1884, 8, + 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, + 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 1902, 8, 21, 1, 21, 3, + 21, 1905, 8, 21, 1, 21, 1, 21, 1, 21, 3, 21, 1910, 8, 21, 1, 21, 1, 21, + 1, 22, 1, 22, 1, 23, 5, 23, 1917, 8, 23, 10, 23, 12, 23, 1920, 9, 23, 1, + 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 1928, 8, 24, 1, 25, 1, 25, + 3, 25, 1932, 8, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, + 26, 1, 26, 1, 26, 3, 26, 1944, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, + 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, + 28, 1, 28, 1, 28, 3, 28, 1964, 8, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, + 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 1977, 8, 28, 1, 29, 1, + 29, 1, 29, 5, 29, 1982, 8, 29, 10, 29, 12, 29, 1985, 9, 29, 1, 30, 1, 30, + 1, 30, 5, 30, 1990, 8, 30, 10, 30, 12, 30, 1993, 9, 30, 1, 31, 1, 31, 3, + 31, 1997, 8, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 3, 32, 2004, 8, 32, + 1, 33, 1, 33, 1, 33, 1, 33, 3, 33, 2010, 8, 33, 1, 34, 1, 34, 1, 34, 1, + 34, 1, 34, 3, 34, 2017, 8, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, + 1, 34, 1, 34, 1, 34, 3, 34, 2028, 8, 34, 1, 35, 1, 35, 3, 35, 2032, 8, + 35, 1, 36, 1, 36, 3, 36, 2036, 8, 36, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, + 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 3, 38, 2049, 8, 38, 1, 39, 1, + 39, 3, 39, 2053, 8, 39, 1, 40, 1, 40, 1, 40, 3, 40, 2058, 8, 40, 1, 41, + 1, 41, 1, 41, 3, 41, 2063, 8, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, + 42, 1, 42, 1, 42, 1, 42, 1, 42, 3, 42, 2075, 8, 42, 1, 43, 1, 43, 1, 43, + 1, 43, 1, 43, 1, 44, 1, 44, 3, 44, 2084, 8, 44, 1, 45, 1, 45, 1, 46, 1, + 46, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2097, 8, 48, + 1, 48, 1, 48, 1, 48, 3, 48, 2102, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2113, 8, 48, 1, 48, 1, 48, 1, 48, + 1, 48, 3, 48, 2119, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2125, 8, + 48, 1, 48, 1, 48, 1, 48, 3, 48, 2130, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, + 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2141, 8, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 3, 48, 2147, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2153, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2162, 8, + 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2172, + 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, + 48, 1, 48, 1, 48, 1, 48, 3, 48, 2187, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, + 3, 48, 2193, 8, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 3, 48, 2200, 8, + 48, 1, 48, 1, 48, 1, 48, 3, 48, 2205, 8, 48, 1, 49, 1, 49, 1, 49, 5, 49, + 2210, 8, 49, 10, 49, 12, 49, 2213, 9, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, + 50, 1, 50, 1, 50, 1, 50, 3, 50, 2223, 8, 50, 1, 51, 1, 51, 1, 51, 1, 51, + 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2247, 8, 52, + 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2254, 8, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2263, 8, 52, 1, 52, 1, 52, 1, 52, + 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2272, 8, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 3, 52, 2280, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, + 1, 52, 1, 52, 1, 52, 3, 52, 2290, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 3, 52, 2299, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, + 1, 52, 1, 52, 3, 52, 2308, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 3, 52, 2316, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, + 2324, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2333, + 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2342, 8, + 52, 1, 52, 1, 52, 3, 52, 2346, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, + 3, 52, 2353, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2361, + 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2371, + 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2377, 8, 52, 1, 52, 1, 52, 3, + 52, 2381, 8, 52, 1, 52, 1, 52, 3, 52, 2385, 8, 52, 1, 52, 1, 52, 3, 52, + 2389, 8, 52, 1, 52, 1, 52, 3, 52, 2393, 8, 52, 1, 52, 1, 52, 1, 52, 3, + 52, 2398, 8, 52, 1, 52, 3, 52, 2401, 8, 52, 1, 52, 1, 52, 3, 52, 2405, + 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, + 2426, 8, 52, 1, 52, 1, 52, 1, 52, 1, 52, 3, 52, 2432, 8, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, + 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, + 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, + 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, + 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, + 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, + 1, 52, 3, 52, 2531, 8, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 3, 53, 2538, + 8, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 57, 1, + 57, 1, 57, 1, 57, 1, 57, 1, 57, 3, 57, 2554, 8, 57, 1, 58, 1, 58, 1, 58, + 1, 58, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 5, 60, 2566, 8, 60, 10, + 60, 12, 60, 2569, 9, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, + 3, 61, 2578, 8, 61, 3, 61, 2580, 8, 61, 1, 62, 4, 62, 2583, 8, 62, 11, + 62, 12, 62, 2584, 1, 63, 1, 63, 3, 63, 2589, 8, 63, 1, 63, 3, 63, 2592, + 8, 63, 1, 63, 1, 63, 1, 63, 1, 63, 3, 63, 2598, 8, 63, 3, 63, 2600, 8, + 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, + 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, + 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 3, 64, 2628, 8, 64, 1, 65, 1, 65, + 1, 65, 1, 66, 1, 66, 1, 66, 5, 66, 2636, 8, 66, 10, 66, 12, 66, 2639, 9, + 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 5, 68, 2649, + 8, 68, 10, 68, 12, 68, 2652, 9, 68, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, + 2658, 8, 69, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 2664, 8, 69, 1, 69, 1, + 69, 3, 69, 2668, 8, 69, 1, 69, 1, 69, 1, 69, 1, 69, 3, 69, 2674, 8, 69, + 1, 69, 1, 69, 1, 69, 3, 69, 2679, 8, 69, 1, 69, 3, 69, 2682, 8, 69, 3, + 69, 2684, 8, 69, 1, 70, 1, 70, 1, 70, 3, 70, 2689, 8, 70, 1, 71, 1, 71, + 3, 71, 2693, 8, 71, 1, 71, 1, 71, 3, 71, 2697, 8, 71, 1, 71, 1, 71, 3, + 71, 2701, 8, 71, 1, 71, 1, 71, 3, 71, 2705, 8, 71, 1, 71, 3, 71, 2708, + 8, 71, 1, 71, 1, 71, 3, 71, 2712, 8, 71, 1, 71, 1, 71, 1, 71, 1, 71, 1, + 71, 1, 71, 3, 71, 2720, 8, 71, 1, 71, 1, 71, 3, 71, 2724, 8, 71, 1, 71, + 1, 71, 3, 71, 2728, 8, 71, 1, 72, 1, 72, 1, 73, 1, 73, 1, 74, 1, 74, 1, + 74, 3, 74, 2737, 8, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 3, 75, 2744, + 8, 75, 1, 76, 5, 76, 2747, 8, 76, 10, 76, 12, 76, 2750, 9, 76, 1, 77, 1, + 77, 1, 77, 1, 77, 3, 77, 2756, 8, 77, 1, 77, 1, 77, 1, 77, 3, 77, 2761, + 8, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 2768, 8, 77, 1, 77, 1, + 77, 1, 77, 3, 77, 2773, 8, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, + 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, + 77, 2791, 8, 77, 1, 78, 1, 78, 1, 79, 3, 79, 2796, 8, 79, 1, 79, 1, 79, + 1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 5, 81, 2806, 8, 81, 10, 81, 12, + 81, 2809, 9, 81, 1, 82, 1, 82, 3, 82, 2813, 8, 82, 1, 83, 1, 83, 1, 83, + 1, 83, 1, 83, 1, 83, 1, 83, 3, 83, 2822, 8, 83, 1, 84, 1, 84, 1, 84, 5, + 84, 2827, 8, 84, 10, 84, 12, 84, 2830, 9, 84, 1, 85, 1, 85, 1, 86, 1, 86, + 3, 86, 2836, 8, 86, 1, 86, 1, 86, 1, 86, 1, 86, 3, 86, 2842, 8, 86, 1, + 86, 1, 86, 1, 86, 3, 86, 2847, 8, 86, 1, 86, 1, 86, 3, 86, 2851, 8, 86, + 1, 86, 3, 86, 2854, 8, 86, 1, 86, 3, 86, 2857, 8, 86, 1, 86, 3, 86, 2860, + 8, 86, 1, 86, 3, 86, 2863, 8, 86, 1, 86, 3, 86, 2866, 8, 86, 1, 86, 1, + 86, 1, 86, 3, 86, 2871, 8, 86, 1, 86, 3, 86, 2874, 8, 86, 1, 86, 3, 86, + 2877, 8, 86, 1, 86, 3, 86, 2880, 8, 86, 1, 86, 3, 86, 2883, 8, 86, 1, 86, + 3, 86, 2886, 8, 86, 1, 86, 1, 86, 1, 86, 1, 86, 3, 86, 2892, 8, 86, 1, + 86, 1, 86, 3, 86, 2896, 8, 86, 1, 86, 3, 86, 2899, 8, 86, 1, 86, 3, 86, + 2902, 8, 86, 1, 86, 3, 86, 2905, 8, 86, 1, 86, 3, 86, 2908, 8, 86, 3, 86, + 2910, 8, 86, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 1, 87, 3, 87, 2919, + 8, 87, 1, 88, 1, 88, 1, 89, 1, 89, 1, 89, 1, 89, 1, 90, 1, 90, 1, 90, 5, + 90, 2930, 8, 90, 10, 90, 12, 90, 2933, 9, 90, 1, 91, 1, 91, 1, 91, 5, 91, + 2938, 8, 91, 10, 91, 12, 91, 2941, 9, 91, 1, 92, 1, 92, 1, 92, 3, 92, 2946, + 8, 92, 1, 93, 1, 93, 3, 93, 2950, 8, 93, 1, 94, 1, 94, 1, 94, 1, 94, 3, + 94, 2956, 8, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 3, 94, 2964, + 8, 94, 1, 94, 3, 94, 2967, 8, 94, 1, 94, 1, 94, 3, 94, 2971, 8, 94, 1, + 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, + 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, 95, 1, + 95, 1, 95, 1, 95, 1, 95, 1, 95, 3, 95, 2999, 8, 95, 1, 96, 1, 96, 1, 96, + 3, 96, 3004, 8, 96, 1, 96, 1, 96, 1, 97, 5, 97, 3009, 8, 97, 10, 97, 12, + 97, 3012, 9, 97, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, + 3, 98, 3022, 8, 98, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 3, 99, 3029, 8, + 99, 1, 99, 3, 99, 3032, 8, 99, 1, 99, 3, 99, 3035, 8, 99, 1, 99, 1, 99, + 1, 99, 3, 99, 3040, 8, 99, 1, 99, 3, 99, 3043, 8, 99, 1, 99, 1, 99, 1, + 99, 1, 99, 1, 99, 3, 99, 3050, 8, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, + 1, 99, 1, 99, 3, 99, 3059, 8, 99, 1, 99, 1, 99, 1, 99, 1, 99, 1, 99, 3, + 99, 3066, 8, 99, 1, 99, 1, 99, 1, 99, 3, 99, 3071, 8, 99, 1, 99, 3, 99, + 3074, 8, 99, 1, 99, 3, 99, 3077, 8, 99, 3, 99, 3079, 8, 99, 1, 100, 1, + 100, 3, 100, 3083, 8, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 101, 3, 101, + 3090, 8, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 102, 3, 102, 3097, 8, + 102, 1, 103, 1, 103, 1, 103, 1, 103, 1, 104, 1, 104, 5, 104, 3105, 8, 104, + 10, 104, 12, 104, 3108, 9, 104, 1, 105, 1, 105, 1, 106, 1, 106, 1, 106, + 1, 106, 1, 106, 3, 106, 3117, 8, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, + 107, 1, 107, 1, 107, 1, 107, 3, 107, 3127, 8, 107, 1, 107, 1, 107, 1, 107, + 1, 107, 3, 107, 3133, 8, 107, 1, 107, 3, 107, 3136, 8, 107, 1, 107, 3, + 107, 3139, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3146, + 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3154, 8, + 107, 1, 107, 3, 107, 3157, 8, 107, 1, 107, 3, 107, 3160, 8, 107, 1, 107, + 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3167, 8, 107, 1, 107, 1, 107, 3, + 107, 3171, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 3177, 8, 107, + 1, 107, 3, 107, 3180, 8, 107, 1, 107, 3, 107, 3183, 8, 107, 1, 107, 3, + 107, 3186, 8, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, + 1, 107, 1, 107, 1, 107, 3, 107, 3198, 8, 107, 1, 107, 3, 107, 3201, 8, + 107, 1, 107, 3, 107, 3204, 8, 107, 1, 107, 1, 107, 3, 107, 3208, 8, 107, + 1, 108, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, + 1, 110, 5, 110, 3220, 8, 110, 10, 110, 12, 110, 3223, 9, 110, 1, 111, 1, + 111, 1, 112, 1, 112, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, + 114, 1, 114, 1, 114, 5, 114, 3238, 8, 114, 10, 114, 12, 114, 3241, 9, 114, + 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 1, 115, 3, 115, + 3251, 8, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, + 117, 1, 117, 1, 117, 1, 117, 1, 117, 1, 117, 3, 117, 3266, 8, 117, 1, 118, + 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, + 1, 120, 1, 120, 1, 120, 1, 120, 1, 120, 3, 120, 3283, 8, 120, 3, 120, 3285, + 8, 120, 1, 121, 1, 121, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 123, + 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 1, 124, 1, 124, + 5, 124, 3304, 8, 124, 10, 124, 12, 124, 3307, 9, 124, 1, 125, 1, 125, 3, + 125, 3311, 8, 125, 1, 125, 3, 125, 3314, 8, 125, 1, 125, 1, 125, 3, 125, + 3318, 8, 125, 1, 125, 3, 125, 3321, 8, 125, 1, 125, 1, 125, 1, 125, 1, + 125, 3, 125, 3327, 8, 125, 1, 125, 3, 125, 3330, 8, 125, 3, 125, 3332, + 8, 125, 1, 126, 1, 126, 1, 126, 1, 127, 1, 127, 1, 127, 1, 127, 3, 127, + 3341, 8, 127, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 1, 128, 3, + 128, 3350, 8, 128, 1, 129, 1, 129, 1, 129, 1, 130, 1, 130, 1, 130, 1, 130, + 1, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 1, 132, + 1, 132, 3, 132, 3369, 8, 132, 1, 132, 1, 132, 3, 132, 3373, 8, 132, 1, + 132, 1, 132, 1, 132, 1, 132, 1, 132, 1, 133, 1, 133, 1, 133, 1, 133, 3, + 133, 3384, 8, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 133, 1, 134, 1, 134, + 3, 134, 3393, 8, 134, 1, 134, 1, 134, 1, 134, 1, 134, 3, 134, 3399, 8, + 134, 1, 134, 1, 134, 1, 134, 1, 134, 3, 134, 3405, 8, 134, 1, 135, 1, 135, + 3, 135, 3409, 8, 135, 1, 135, 3, 135, 3412, 8, 135, 1, 135, 3, 135, 3415, + 8, 135, 1, 135, 3, 135, 3418, 8, 135, 1, 135, 3, 135, 3421, 8, 135, 1, + 136, 1, 136, 1, 136, 1, 136, 3, 136, 3427, 8, 136, 1, 137, 1, 137, 3, 137, + 3431, 8, 137, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 3, 137, 3438, 8, + 137, 1, 137, 1, 137, 1, 137, 1, 137, 3, 137, 3444, 8, 137, 1, 138, 1, 138, + 3, 138, 3448, 8, 138, 1, 138, 3, 138, 3451, 8, 138, 1, 138, 3, 138, 3454, + 8, 138, 1, 138, 3, 138, 3457, 8, 138, 1, 139, 1, 139, 1, 140, 1, 140, 1, + 140, 1, 140, 3, 140, 3465, 8, 140, 1, 140, 1, 140, 3, 140, 3469, 8, 140, + 1, 141, 1, 141, 3, 141, 3473, 8, 141, 1, 141, 1, 141, 1, 141, 1, 141, 3, + 141, 3479, 8, 141, 1, 141, 1, 141, 3, 141, 3483, 8, 141, 1, 142, 1, 142, + 1, 142, 1, 142, 3, 142, 3489, 8, 142, 1, 142, 1, 142, 1, 142, 1, 143, 1, + 143, 1, 144, 1, 144, 1, 144, 1, 144, 1, 145, 4, 145, 3501, 8, 145, 11, + 145, 12, 145, 3502, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, + 146, 3, 146, 3512, 8, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, + 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, 1, 146, + 1, 146, 3, 146, 3530, 8, 146, 1, 146, 1, 146, 1, 146, 3, 146, 3535, 8, + 146, 1, 146, 3, 146, 3538, 8, 146, 1, 146, 3, 146, 3541, 8, 146, 1, 147, + 1, 147, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 1, 148, 3, 148, 3551, 8, + 148, 1, 149, 1, 149, 1, 149, 5, 149, 3556, 8, 149, 10, 149, 12, 149, 3559, + 9, 149, 1, 150, 1, 150, 3, 150, 3563, 8, 150, 1, 150, 3, 150, 3566, 8, + 150, 1, 150, 3, 150, 3569, 8, 150, 1, 150, 1, 150, 1, 150, 1, 150, 1, 150, + 3, 150, 3576, 8, 150, 1, 150, 3, 150, 3579, 8, 150, 3, 150, 3581, 8, 150, + 1, 151, 1, 151, 1, 152, 1, 152, 3, 152, 3587, 8, 152, 1, 153, 1, 153, 1, + 153, 1, 154, 1, 154, 1, 154, 1, 154, 3, 154, 3596, 8, 154, 1, 155, 1, 155, + 1, 156, 1, 156, 1, 157, 1, 157, 1, 157, 1, 157, 3, 157, 3606, 8, 157, 1, + 157, 1, 157, 1, 157, 3, 157, 3611, 8, 157, 1, 158, 1, 158, 1, 158, 1, 159, + 1, 159, 1, 159, 1, 159, 3, 159, 3620, 8, 159, 1, 159, 1, 159, 1, 160, 1, + 160, 1, 160, 1, 160, 1, 160, 3, 160, 3629, 8, 160, 1, 160, 1, 160, 3, 160, + 3633, 8, 160, 1, 160, 1, 160, 1, 161, 5, 161, 3638, 8, 161, 10, 161, 12, + 161, 3641, 9, 161, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, 1, 162, + 3, 162, 3650, 8, 162, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, 163, 1, + 164, 5, 164, 3659, 8, 164, 10, 164, 12, 164, 3662, 9, 164, 1, 165, 1, 165, + 1, 165, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, + 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 1, 166, 3, 166, 3771, 8, 166, 1, + 167, 1, 167, 1, 167, 1, 167, 1, 167, 1, 167, 3, 167, 3779, 8, 167, 1, 167, + 3, 167, 3782, 8, 167, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, 168, 1, + 168, 1, 168, 3, 168, 3792, 8, 168, 1, 169, 4, 169, 3795, 8, 169, 11, 169, + 12, 169, 3796, 1, 170, 1, 170, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, + 1, 171, 3, 171, 3807, 8, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, 171, 1, + 171, 1, 171, 1, 171, 1, 171, 3, 171, 3818, 8, 171, 1, 172, 1, 172, 1, 172, + 1, 172, 1, 172, 1, 173, 1, 173, 1, 173, 5, 173, 3828, 8, 173, 10, 173, + 12, 173, 3831, 9, 173, 1, 174, 1, 174, 1, 174, 1, 174, 1, 174, 1, 175, + 1, 175, 1, 175, 5, 175, 3841, 8, 175, 10, 175, 12, 175, 3844, 9, 175, 1, + 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 1, 176, 3, 176, 3853, 8, 176, + 1, 177, 1, 177, 1, 177, 1, 178, 1, 178, 1, 179, 1, 179, 1, 180, 1, 180, + 1, 180, 1, 180, 3, 180, 3866, 8, 180, 1, 180, 3, 180, 3869, 8, 180, 1, + 180, 1, 180, 1, 180, 1, 180, 1, 180, 3, 180, 3876, 8, 180, 1, 180, 1, 180, + 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 3, 180, 3885, 8, 180, 1, 180, 3, + 180, 3888, 8, 180, 1, 180, 1, 180, 1, 180, 1, 180, 1, 180, 3, 180, 3895, + 8, 180, 3, 180, 3897, 8, 180, 1, 181, 1, 181, 1, 181, 1, 182, 1, 182, 1, + 182, 3, 182, 3905, 8, 182, 1, 183, 1, 183, 1, 184, 1, 184, 1, 184, 1, 184, + 1, 184, 1, 184, 3, 184, 3915, 8, 184, 3, 184, 3917, 8, 184, 1, 185, 1, + 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3925, 8, 185, 1, 185, 1, 185, + 3, 185, 3929, 8, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3934, 8, 185, 1, + 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, + 185, 3945, 8, 185, 1, 185, 1, 185, 3, 185, 3949, 8, 185, 1, 185, 1, 185, + 1, 185, 3, 185, 3954, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, + 185, 1, 185, 1, 185, 3, 185, 3964, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, + 3, 185, 3970, 8, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, 185, 1, + 185, 1, 185, 1, 185, 1, 185, 1, 185, 3, 185, 3983, 8, 185, 1, 185, 1, 185, + 1, 185, 1, 185, 3, 185, 3989, 8, 185, 3, 185, 3991, 8, 185, 1, 186, 1, + 186, 1, 186, 1, 186, 1, 186, 3, 186, 3998, 8, 186, 1, 186, 1, 186, 1, 186, + 1, 186, 1, 186, 1, 186, 3, 186, 4006, 8, 186, 1, 187, 1, 187, 1, 187, 3, + 187, 4011, 8, 187, 1, 188, 1, 188, 1, 188, 1, 188, 1, 188, 1, 189, 1, 189, + 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 3, 189, 4026, 8, 189, 1, + 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, 189, 1, + 189, 1, 189, 3, 189, 4039, 8, 189, 3, 189, 4041, 8, 189, 1, 190, 1, 190, + 3, 190, 4045, 8, 190, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, + 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, 191, 1, + 191, 1, 191, 1, 191, 3, 191, 4065, 8, 191, 1, 192, 1, 192, 1, 192, 1, 192, + 1, 192, 1, 192, 1, 192, 1, 192, 1, 192, 1, 193, 1, 193, 1, 193, 1, 193, + 1, 193, 1, 193, 3, 193, 4082, 8, 193, 1, 193, 3, 193, 4085, 8, 193, 1, + 193, 3, 193, 4088, 8, 193, 1, 193, 3, 193, 4091, 8, 193, 1, 193, 3, 193, + 4094, 8, 193, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 1, 194, 3, 194, 4102, + 8, 194, 1, 194, 3, 194, 4105, 8, 194, 1, 194, 3, 194, 4108, 8, 194, 1, + 195, 1, 195, 1, 195, 1, 195, 1, 195, 1, 196, 1, 196, 1, 196, 1, 196, 1, + 196, 1, 196, 1, 197, 1, 197, 1, 197, 1, 198, 1, 198, 1, 198, 1, 199, 1, + 199, 1, 199, 1, 200, 1, 200, 1, 200, 1, 201, 1, 201, 1, 202, 1, 202, 1, + 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 202, 1, 203, 1, 203, 1, + 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 3, 204, 4154, + 8, 204, 1, 204, 3, 204, 4157, 8, 204, 1, 204, 3, 204, 4160, 8, 204, 1, + 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, + 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 3, 204, 4178, 8, 204, + 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 3, 204, 4185, 8, 204, 1, 204, 1, + 204, 1, 204, 1, 204, 1, 204, 1, 204, 1, 204, 3, 204, 4194, 8, 204, 1, 205, + 1, 205, 1, 205, 1, 205, 3, 205, 4200, 8, 205, 1, 206, 1, 206, 1, 206, 5, + 206, 4205, 8, 206, 10, 206, 12, 206, 4208, 9, 206, 1, 207, 1, 207, 1, 207, + 1, 207, 1, 207, 1, 207, 1, 207, 3, 207, 4217, 8, 207, 1, 208, 1, 208, 1, + 208, 1, 209, 4, 209, 4223, 8, 209, 11, 209, 12, 209, 4224, 1, 210, 1, 210, + 1, 210, 3, 210, 4230, 8, 210, 1, 210, 1, 210, 1, 211, 1, 211, 1, 212, 1, + 212, 1, 213, 1, 213, 1, 214, 1, 214, 3, 214, 4242, 8, 214, 1, 214, 1, 214, + 1, 215, 1, 215, 1, 216, 1, 216, 1, 217, 1, 217, 1, 217, 1, 217, 1, 217, + 1, 218, 1, 218, 1, 219, 1, 219, 3, 219, 4259, 8, 219, 1, 219, 1, 219, 5, + 219, 4263, 8, 219, 10, 219, 12, 219, 4266, 9, 219, 1, 220, 1, 220, 1, 220, + 1, 220, 3, 220, 4272, 8, 220, 1, 221, 1, 221, 1, 221, 1, 222, 5, 222, 4278, + 8, 222, 10, 222, 12, 222, 4281, 9, 222, 1, 223, 1, 223, 1, 223, 1, 223, + 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 1, 223, 3, 223, 4294, 8, + 223, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, + 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, + 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 1, 224, 3, + 224, 4322, 8, 224, 1, 225, 1, 225, 1, 225, 5, 225, 4327, 8, 225, 10, 225, + 12, 225, 4330, 9, 225, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, 1, 226, + 1, 227, 1, 227, 1, 227, 5, 227, 4341, 8, 227, 10, 227, 12, 227, 4344, 9, + 227, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 228, 1, 229, 1, 229, 1, + 229, 1, 229, 1, 229, 1, 229, 3, 229, 4358, 8, 229, 1, 230, 1, 230, 1, 230, + 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 230, 1, 231, 1, 231, 3, 231, + 4371, 8, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 3, + 231, 4380, 8, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 3, 231, 4405, 8, + 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, + 231, 3, 231, 4416, 8, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, + 1, 231, 1, 231, 1, 231, 1, 231, 1, 231, 3, 231, 4483, 8, 231, 1, 232, 1, + 232, 1, 232, 1, 232, 1, 233, 1, 233, 1, 233, 5, 233, 4492, 8, 233, 10, + 233, 12, 233, 4495, 9, 233, 1, 234, 1, 234, 1, 234, 3, 234, 4500, 8, 234, + 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 1, 235, 3, 235, 4508, 8, 235, 1, + 236, 1, 236, 1, 236, 1, 236, 1, 237, 1, 237, 1, 237, 5, 237, 4517, 8, 237, + 10, 237, 12, 237, 4520, 9, 237, 1, 238, 1, 238, 1, 238, 1, 238, 1, 239, + 1, 239, 1, 240, 1, 240, 1, 240, 5, 240, 4531, 8, 240, 10, 240, 12, 240, + 4534, 9, 240, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 3, 241, 4542, + 8, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, + 3, 241, 4552, 8, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, + 241, 1, 241, 1, 241, 1, 241, 3, 241, 4564, 8, 241, 1, 241, 1, 241, 1, 241, + 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, 1, 241, + 1, 241, 3, 241, 4579, 8, 241, 1, 242, 1, 242, 1, 242, 1, 242, 1, 243, 1, + 243, 1, 243, 1, 243, 1, 243, 3, 243, 4590, 8, 243, 1, 243, 1, 243, 1, 243, + 1, 243, 1, 243, 1, 243, 3, 243, 4598, 8, 243, 1, 243, 1, 243, 1, 243, 1, + 244, 1, 244, 1, 244, 5, 244, 4606, 8, 244, 10, 244, 12, 244, 4609, 9, 244, + 1, 245, 1, 245, 1, 245, 1, 245, 3, 245, 4615, 8, 245, 1, 245, 3, 245, 4618, + 8, 245, 1, 245, 1, 245, 1, 245, 1, 245, 3, 245, 4624, 8, 245, 1, 245, 3, + 245, 4627, 8, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, + 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 1, 245, 3, 245, 4642, 8, 245, 1, + 246, 1, 246, 1, 247, 1, 247, 1, 247, 1, 248, 1, 248, 1, 248, 1, 248, 1, + 248, 1, 248, 3, 248, 4655, 8, 248, 1, 249, 1, 249, 1, 250, 1, 250, 1, 250, + 1, 250, 1, 250, 1, 250, 1, 250, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, + 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, 1, 251, + 1, 251, 1, 251, 1, 251, 1, 251, 3, 251, 4684, 8, 251, 1, 252, 1, 252, 1, + 252, 5, 252, 4689, 8, 252, 10, 252, 12, 252, 4692, 9, 252, 1, 253, 1, 253, + 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, 1, 253, + 1, 253, 3, 253, 4706, 8, 253, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, + 254, 1, 254, 3, 254, 4715, 8, 254, 1, 254, 1, 254, 1, 254, 1, 254, 1, 254, + 1, 254, 1, 254, 1, 254, 1, 254, 3, 254, 4726, 8, 254, 3, 254, 4728, 8, + 254, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 3, 255, 4737, + 8, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, 1, 255, + 1, 255, 3, 255, 4748, 8, 255, 3, 255, 4750, 8, 255, 1, 256, 1, 256, 1, + 256, 1, 256, 1, 256, 3, 256, 4757, 8, 256, 1, 257, 1, 257, 1, 257, 1, 257, + 1, 257, 1, 257, 1, 257, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, + 3, 258, 4772, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4778, 8, + 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4786, 8, 258, + 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4792, 8, 258, 1, 258, 1, 258, 1, + 258, 1, 258, 1, 258, 1, 258, 3, 258, 4800, 8, 258, 1, 258, 1, 258, 1, 258, + 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4810, 8, 258, 1, 258, 1, + 258, 1, 258, 1, 258, 3, 258, 4816, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, + 1, 258, 1, 258, 3, 258, 4824, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, + 258, 4830, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, + 4838, 8, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4845, 8, + 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 1, 258, 3, 258, 4854, + 8, 258, 3, 258, 4856, 8, 258, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, + 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, + 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 1, 259, 3, + 259, 4881, 8, 259, 1, 260, 1, 260, 1, 260, 1, 260, 1, 260, 3, 260, 4888, + 8, 260, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, 1, 261, + 1, 261, 3, 261, 4899, 8, 261, 1, 261, 1, 261, 1, 261, 1, 261, 3, 261, 4905, + 8, 261, 1, 262, 1, 262, 1, 263, 1, 263, 1, 263, 5, 263, 4912, 8, 263, 10, + 263, 12, 263, 4915, 9, 263, 1, 264, 1, 264, 3, 264, 4919, 8, 264, 1, 265, + 1, 265, 4, 265, 4923, 8, 265, 11, 265, 12, 265, 4924, 1, 266, 1, 266, 1, + 266, 5, 266, 4930, 8, 266, 10, 266, 12, 266, 4933, 9, 266, 1, 267, 1, 267, + 3, 267, 4937, 8, 267, 1, 267, 1, 267, 3, 267, 4941, 8, 267, 1, 267, 3, + 267, 4944, 8, 267, 1, 268, 1, 268, 1, 268, 1, 268, 3, 268, 4950, 8, 268, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, 1, 269, + 1, 269, 1, 269, 1, 269, 3, 269, 5099, 8, 269, 1, 270, 1, 270, 3, 270, 5103, + 8, 270, 1, 271, 1, 271, 1, 271, 3, 271, 5108, 8, 271, 1, 271, 1, 271, 1, + 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5119, 8, 271, + 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, + 3, 271, 5130, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, + 271, 1, 271, 1, 271, 3, 271, 5141, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, + 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5152, 8, 271, 1, 271, 1, + 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5163, + 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, + 1, 271, 3, 271, 5174, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, + 271, 1, 271, 1, 271, 1, 271, 3, 271, 5185, 8, 271, 1, 271, 1, 271, 1, 271, + 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 3, 271, 5197, 8, + 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, + 271, 3, 271, 5208, 8, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, 1, 271, + 3, 271, 5216, 8, 271, 1, 272, 1, 272, 1, 272, 1, 273, 1, 273, 3, 273, 5223, + 8, 273, 1, 274, 1, 274, 1, 274, 1, 274, 3, 274, 5229, 8, 274, 1, 275, 1, + 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5237, 8, 275, 1, 275, 1, 275, + 1, 275, 3, 275, 5242, 8, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5247, 8, + 275, 1, 275, 1, 275, 1, 275, 3, 275, 5252, 8, 275, 1, 275, 1, 275, 1, 275, + 1, 275, 3, 275, 5258, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, + 275, 5265, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5271, 8, 275, + 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5277, 8, 275, 1, 275, 1, 275, 1, + 275, 3, 275, 5282, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5288, + 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5295, 8, 275, 1, + 275, 1, 275, 1, 275, 3, 275, 5300, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, + 3, 275, 5306, 8, 275, 1, 275, 1, 275, 1, 275, 1, 275, 1, 275, 3, 275, 5313, + 8, 275, 1, 275, 3, 275, 5316, 8, 275, 1, 276, 1, 276, 1, 277, 1, 277, 1, + 278, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 1, 278, 3, 278, 5329, 8, 278, + 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 3, 279, 5338, 8, + 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, 279, 1, + 279, 1, 279, 3, 279, 5350, 8, 279, 3, 279, 5352, 8, 279, 1, 280, 1, 280, + 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, 1, 280, + 1, 280, 1, 280, 1, 280, 1, 280, 3, 280, 5369, 8, 280, 1, 281, 1, 281, 1, + 281, 5, 281, 5374, 8, 281, 10, 281, 12, 281, 5377, 9, 281, 1, 282, 1, 282, + 3, 282, 5381, 8, 282, 1, 282, 1, 282, 3, 282, 5385, 8, 282, 1, 282, 1, + 282, 3, 282, 5389, 8, 282, 1, 282, 1, 282, 1, 282, 1, 282, 3, 282, 5395, + 8, 282, 3, 282, 5397, 8, 282, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, + 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, + 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, + 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, + 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, + 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, + 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, 283, 1, + 283, 3, 283, 5459, 8, 283, 1, 284, 1, 284, 1, 284, 5, 284, 5464, 8, 284, + 10, 284, 12, 284, 5467, 9, 284, 1, 285, 1, 285, 1, 285, 3, 285, 5472, 8, + 285, 1, 286, 1, 286, 1, 286, 5, 286, 5477, 8, 286, 10, 286, 12, 286, 5480, + 9, 286, 1, 287, 1, 287, 1, 287, 3, 287, 5485, 8, 287, 1, 288, 1, 288, 1, + 288, 1, 288, 1, 289, 1, 289, 1, 289, 1, 289, 1, 289, 3, 289, 5496, 8, 289, + 1, 289, 3, 289, 5499, 8, 289, 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 3, + 290, 5506, 8, 290, 1, 290, 3, 290, 5509, 8, 290, 1, 290, 1, 290, 1, 290, + 1, 290, 1, 290, 1, 290, 1, 290, 1, 290, 3, 290, 5519, 8, 290, 1, 290, 3, + 290, 5522, 8, 290, 3, 290, 5524, 8, 290, 1, 291, 1, 291, 1, 291, 1, 291, + 1, 292, 1, 292, 1, 292, 1, 292, 1, 293, 1, 293, 1, 293, 1, 293, 1, 293, + 1, 293, 1, 294, 5, 294, 5541, 8, 294, 10, 294, 12, 294, 5544, 9, 294, 1, + 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 1, 295, 3, + 295, 5555, 8, 295, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, + 3, 296, 5564, 8, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, + 296, 3, 296, 5573, 8, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, 1, 296, + 1, 296, 1, 296, 1, 296, 1, 296, 3, 296, 5585, 8, 296, 3, 296, 5587, 8, + 296, 1, 297, 1, 297, 1, 298, 1, 298, 3, 298, 5593, 8, 298, 1, 298, 1, 298, + 3, 298, 5597, 8, 298, 1, 298, 1, 298, 1, 298, 3, 298, 5602, 8, 298, 1, + 298, 3, 298, 5605, 8, 298, 1, 298, 1, 298, 1, 298, 3, 298, 5610, 8, 298, + 1, 298, 1, 298, 1, 298, 1, 298, 3, 298, 5616, 8, 298, 1, 298, 3, 298, 5619, + 8, 298, 1, 298, 3, 298, 5622, 8, 298, 1, 298, 3, 298, 5625, 8, 298, 1, + 298, 3, 298, 5628, 8, 298, 1, 299, 1, 299, 1, 300, 1, 300, 1, 301, 1, 301, + 1, 302, 1, 302, 1, 302, 1, 303, 1, 303, 1, 303, 5, 303, 5642, 8, 303, 10, + 303, 12, 303, 5645, 9, 303, 1, 304, 3, 304, 5648, 8, 304, 1, 304, 3, 304, + 5651, 8, 304, 1, 304, 3, 304, 5654, 8, 304, 1, 304, 3, 304, 5657, 8, 304, + 1, 304, 3, 304, 5660, 8, 304, 1, 304, 1, 304, 1, 304, 3, 304, 5665, 8, + 304, 1, 304, 3, 304, 5668, 8, 304, 3, 304, 5670, 8, 304, 1, 305, 1, 305, + 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, 1, 305, + 3, 305, 5683, 8, 305, 1, 306, 1, 306, 1, 306, 1, 306, 1, 306, 1, 307, 1, + 307, 1, 307, 5, 307, 5693, 8, 307, 10, 307, 12, 307, 5696, 9, 307, 1, 308, + 1, 308, 1, 308, 1, 309, 1, 309, 1, 310, 1, 310, 1, 311, 1, 311, 1, 311, + 1, 311, 3, 311, 5709, 8, 311, 1, 312, 1, 312, 3, 312, 5713, 8, 312, 1, + 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, 312, 1, + 312, 3, 312, 5725, 8, 312, 3, 312, 5727, 8, 312, 1, 312, 1, 312, 1, 313, + 1, 313, 1, 313, 1, 314, 1, 314, 3, 314, 5736, 8, 314, 1, 314, 1, 314, 1, + 315, 1, 315, 1, 315, 5, 315, 5743, 8, 315, 10, 315, 12, 315, 5746, 9, 315, + 1, 316, 1, 316, 1, 316, 5, 316, 5751, 8, 316, 10, 316, 12, 316, 5754, 9, + 316, 1, 317, 1, 317, 1, 317, 1, 317, 1, 317, 1, 317, 3, 317, 5762, 8, 317, + 3, 317, 5764, 8, 317, 1, 318, 1, 318, 3, 318, 5768, 8, 318, 1, 318, 1, + 318, 1, 319, 1, 319, 1, 319, 5, 319, 5775, 8, 319, 10, 319, 12, 319, 5778, + 9, 319, 1, 320, 1, 320, 3, 320, 5782, 8, 320, 1, 320, 1, 320, 1, 320, 1, + 320, 3, 320, 5788, 8, 320, 1, 320, 1, 320, 1, 320, 3, 320, 5793, 8, 320, + 1, 321, 1, 321, 3, 321, 5797, 8, 321, 1, 321, 1, 321, 1, 321, 3, 321, 5802, + 8, 321, 1, 322, 1, 322, 1, 322, 1, 322, 3, 322, 5808, 8, 322, 1, 323, 1, + 323, 1, 324, 1, 324, 3, 324, 5814, 8, 324, 1, 324, 1, 324, 1, 324, 1, 324, + 3, 324, 5820, 8, 324, 1, 324, 1, 324, 1, 324, 1, 324, 3, 324, 5826, 8, + 324, 1, 325, 1, 325, 1, 325, 3, 325, 5831, 8, 325, 1, 326, 1, 326, 1, 327, + 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, 1, 327, + 1, 327, 3, 327, 5846, 8, 327, 1, 327, 1, 327, 1, 328, 1, 328, 1, 328, 5, + 328, 5853, 8, 328, 10, 328, 12, 328, 5856, 9, 328, 1, 329, 1, 329, 1, 329, + 1, 330, 1, 330, 1, 330, 5, 330, 5864, 8, 330, 10, 330, 12, 330, 5867, 9, + 330, 1, 331, 4, 331, 5870, 8, 331, 11, 331, 12, 331, 5871, 1, 331, 1, 331, + 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, + 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, + 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, + 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 1, 332, 3, 332, + 5911, 8, 332, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, + 333, 1, 333, 1, 333, 1, 333, 1, 333, 1, 333, 3, 333, 5926, 8, 333, 1, 334, + 1, 334, 1, 334, 1, 334, 1, 334, 3, 334, 5933, 8, 334, 1, 335, 1, 335, 1, + 335, 1, 335, 1, 335, 1, 335, 1, 335, 5, 335, 5942, 8, 335, 10, 335, 12, + 335, 5945, 9, 335, 1, 336, 1, 336, 1, 336, 1, 337, 1, 337, 1, 337, 1, 338, + 1, 338, 1, 338, 5, 338, 5956, 8, 338, 10, 338, 12, 338, 5959, 9, 338, 1, + 339, 1, 339, 1, 339, 1, 339, 1, 339, 3, 339, 5966, 8, 339, 1, 340, 4, 340, + 5969, 8, 340, 11, 340, 12, 340, 5970, 1, 341, 1, 341, 1, 342, 1, 342, 1, + 342, 1, 342, 3, 342, 5979, 8, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, + 1, 342, 3, 342, 5987, 8, 342, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 5993, + 8, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 6001, 8, + 342, 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 6007, 8, 342, 1, 342, 1, 342, + 1, 342, 1, 342, 1, 342, 1, 342, 3, 342, 6015, 8, 342, 3, 342, 6017, 8, + 342, 1, 343, 1, 343, 1, 343, 1, 343, 3, 343, 6023, 8, 343, 1, 343, 1, 343, + 1, 343, 1, 343, 1, 343, 1, 343, 3, 343, 6031, 8, 343, 3, 343, 6033, 8, + 343, 1, 344, 1, 344, 1, 344, 1, 344, 3, 344, 6039, 8, 344, 1, 344, 1, 344, + 1, 344, 1, 344, 1, 344, 1, 344, 3, 344, 6047, 8, 344, 3, 344, 6049, 8, + 344, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, + 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, 345, 1, + 345, 1, 345, 1, 345, 1, 345, 1, 345, 3, 345, 6073, 8, 345, 1, 346, 1, 346, + 1, 346, 5, 346, 6078, 8, 346, 10, 346, 12, 346, 6081, 9, 346, 1, 346, 1, + 346, 1, 347, 1, 347, 1, 347, 5, 347, 6088, 8, 347, 10, 347, 12, 347, 6091, + 9, 347, 1, 348, 1, 348, 1, 348, 1, 349, 1, 349, 1, 349, 1, 350, 4, 350, + 6100, 8, 350, 11, 350, 12, 350, 6101, 1, 351, 1, 351, 1, 351, 3, 351, 6107, + 8, 351, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, + 1, 352, 1, 352, 1, 352, 3, 352, 6120, 8, 352, 1, 352, 1, 352, 1, 352, 1, + 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 3, 352, 6132, 8, 352, + 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, 1, 352, + 1, 352, 3, 352, 6144, 8, 352, 3, 352, 6146, 8, 352, 1, 353, 1, 353, 1, + 353, 1, 353, 3, 353, 6152, 8, 353, 1, 354, 1, 354, 1, 354, 3, 354, 6157, + 8, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 1, 354, 3, 354, 6165, 8, + 354, 1, 355, 1, 355, 1, 355, 1, 356, 1, 356, 3, 356, 6172, 8, 356, 1, 356, + 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 356, 1, 357, + 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, + 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, + 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, + 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 1, 357, 3, 357, 6217, 8, 357, 1, + 358, 1, 358, 1, 358, 3, 358, 6222, 8, 358, 1, 358, 1, 358, 1, 358, 1, 358, + 1, 358, 3, 358, 6229, 8, 358, 1, 359, 1, 359, 1, 359, 3, 359, 6234, 8, + 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 3, 359, 6241, 8, 359, 1, 359, + 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 3, 359, 6251, 8, + 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 1, 359, 3, + 359, 6261, 8, 359, 1, 359, 1, 359, 3, 359, 6265, 8, 359, 1, 360, 1, 360, + 1, 361, 1, 361, 1, 362, 1, 362, 1, 362, 5, 362, 6274, 8, 362, 10, 362, + 12, 362, 6277, 9, 362, 1, 363, 1, 363, 1, 364, 1, 364, 1, 364, 1, 364, + 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 1, 364, 3, 364, + 6293, 8, 364, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6364, + 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6559, 8, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 3, 365, 6572, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 3, 365, 6583, 8, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6596, + 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 3, 365, 6608, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6622, + 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6654, 8, 365, 1, 365, 1, 365, 1, + 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, + 365, 3, 365, 6668, 8, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, + 1, 365, 1, 365, 1, 365, 1, 365, 1, 365, 3, 365, 6780, 8, 365, 3, 365, 6782, + 8, 365, 1, 366, 1, 366, 1, 367, 1, 367, 1, 367, 1, 368, 1, 368, 1, 368, + 1, 368, 3, 368, 6793, 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, + 368, 1, 368, 1, 368, 1, 368, 3, 368, 6804, 8, 368, 1, 368, 1, 368, 1, 368, + 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6815, 8, 368, 1, + 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, + 368, 1, 368, 3, 368, 6828, 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, + 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6840, 8, 368, 1, 368, 1, + 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6851, + 8, 368, 1, 368, 1, 368, 1, 368, 1, 368, 1, 368, 3, 368, 6858, 8, 368, 1, + 369, 1, 369, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, 370, 1, + 370, 1, 370, 1, 370, 3, 370, 7079, 8, 370, 1, 371, 1, 371, 1, 371, 1, 371, + 1, 371, 1, 371, 1, 371, 1, 371, 1, 372, 1, 372, 1, 372, 5, 372, 7092, 8, + 372, 10, 372, 12, 372, 7095, 9, 372, 1, 373, 1, 373, 1, 373, 1, 373, 1, + 373, 1, 373, 1, 373, 1, 373, 3, 373, 7105, 8, 373, 1, 374, 1, 374, 1, 374, + 1, 374, 1, 374, 3, 374, 7112, 8, 374, 1, 375, 1, 375, 1, 375, 1, 375, 1, + 375, 1, 375, 1, 375, 1, 375, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, + 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, + 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, + 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, + 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, + 376, 1, 376, 1, 376, 3, 376, 7166, 8, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, 1, 376, + 3, 376, 7307, 8, 376, 1, 377, 1, 377, 1, 377, 1, 377, 3, 377, 7313, 8, + 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 3, 377, 7322, + 8, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 1, 377, 3, 377, 7330, 8, + 377, 3, 377, 7332, 8, 377, 1, 378, 1, 378, 1, 378, 5, 378, 7337, 8, 378, + 10, 378, 12, 378, 7340, 9, 378, 1, 379, 1, 379, 1, 379, 3, 379, 7345, 8, + 379, 1, 379, 3, 379, 7348, 8, 379, 1, 379, 1, 379, 1, 379, 1, 379, 1, 379, + 3, 379, 7355, 8, 379, 1, 379, 1, 379, 3, 379, 7359, 8, 379, 1, 379, 3, + 379, 7362, 8, 379, 1, 379, 1, 379, 1, 379, 3, 379, 7367, 8, 379, 1, 379, + 3, 379, 7370, 8, 379, 1, 379, 1, 379, 3, 379, 7374, 8, 379, 1, 379, 3, + 379, 7377, 8, 379, 1, 379, 3, 379, 7380, 8, 379, 1, 380, 1, 380, 1, 380, + 1, 380, 1, 380, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, + 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, + 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 1, 381, 3, 381, + 7411, 8, 381, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 1, 382, 1, + 382, 3, 382, 7421, 8, 382, 1, 383, 1, 383, 1, 383, 5, 383, 7426, 8, 383, + 10, 383, 12, 383, 7429, 9, 383, 1, 384, 1, 384, 1, 385, 1, 385, 1, 385, + 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, + 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 3, 385, 7451, 8, 385, 1, + 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 3, 385, 7460, 8, 385, + 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, + 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 1, 385, 3, 385, 7478, 8, + 385, 1, 386, 1, 386, 1, 386, 1, 386, 3, 386, 7484, 8, 386, 1, 386, 1, 386, + 1, 386, 1, 386, 1, 386, 1, 386, 3, 386, 7492, 8, 386, 3, 386, 7494, 8, + 386, 1, 387, 1, 387, 3, 387, 7498, 8, 387, 1, 387, 1, 387, 1, 387, 1, 387, + 1, 387, 1, 387, 1, 387, 1, 387, 3, 387, 7508, 8, 387, 1, 387, 1, 387, 3, + 387, 7512, 8, 387, 1, 387, 1, 387, 1, 388, 1, 388, 1, 388, 1, 388, 1, 388, + 1, 388, 3, 388, 7522, 8, 388, 1, 389, 3, 389, 7525, 8, 389, 1, 389, 1, + 389, 3, 389, 7529, 8, 389, 5, 389, 7531, 8, 389, 10, 389, 12, 389, 7534, + 9, 389, 1, 390, 1, 390, 1, 390, 1, 390, 1, 390, 3, 390, 7541, 8, 390, 1, + 391, 1, 391, 1, 392, 1, 392, 1, 393, 1, 393, 1, 394, 1, 394, 1, 394, 3, + 394, 7552, 8, 394, 1, 395, 1, 395, 1, 395, 1, 396, 1, 396, 1, 396, 1, 397, + 1, 397, 1, 397, 1, 397, 3, 397, 7564, 8, 397, 1, 398, 1, 398, 3, 398, 7568, + 8, 398, 1, 398, 3, 398, 7571, 8, 398, 1, 398, 1, 398, 3, 398, 7575, 8, + 398, 1, 398, 3, 398, 7578, 8, 398, 1, 398, 1, 398, 1, 398, 3, 398, 7583, + 8, 398, 1, 398, 1, 398, 3, 398, 7587, 8, 398, 1, 398, 3, 398, 7590, 8, + 398, 1, 398, 1, 398, 3, 398, 7594, 8, 398, 1, 398, 3, 398, 7597, 8, 398, + 1, 398, 1, 398, 3, 398, 7601, 8, 398, 1, 398, 3, 398, 7604, 8, 398, 1, + 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 3, + 398, 7615, 8, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 3, 398, 7622, + 8, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, 1, 398, + 1, 398, 1, 398, 1, 398, 3, 398, 7635, 8, 398, 1, 399, 1, 399, 1, 400, 1, + 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 1, 400, 3, + 400, 7649, 8, 400, 1, 401, 1, 401, 3, 401, 7653, 8, 401, 1, 401, 5, 401, + 7656, 8, 401, 10, 401, 12, 401, 7659, 9, 401, 1, 402, 1, 402, 1, 403, 1, + 403, 3, 403, 7665, 8, 403, 1, 403, 1, 403, 1, 404, 1, 404, 1, 404, 3, 404, + 7672, 8, 404, 1, 404, 3, 404, 7675, 8, 404, 1, 404, 1, 404, 1, 404, 3, + 404, 7680, 8, 404, 1, 404, 3, 404, 7683, 8, 404, 1, 404, 1, 404, 1, 404, + 1, 404, 1, 404, 1, 404, 1, 404, 3, 404, 7692, 8, 404, 3, 404, 7694, 8, + 404, 1, 404, 1, 404, 1, 404, 3, 404, 7699, 8, 404, 1, 405, 1, 405, 3, 405, + 7703, 8, 405, 1, 405, 1, 405, 1, 405, 1, 406, 1, 406, 1, 406, 1, 407, 1, + 407, 1, 407, 1, 407, 3, 407, 7715, 8, 407, 1, 407, 3, 407, 7718, 8, 407, + 1, 408, 1, 408, 1, 409, 4, 409, 7723, 8, 409, 11, 409, 12, 409, 7724, 1, + 410, 1, 410, 3, 410, 7729, 8, 410, 1, 410, 1, 410, 1, 410, 3, 410, 7734, + 8, 410, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, 1, 411, + 3, 411, 7744, 8, 411, 1, 412, 1, 412, 1, 413, 1, 413, 1, 413, 1, 413, 1, + 413, 3, 413, 7753, 8, 413, 1, 413, 3, 413, 7756, 8, 413, 1, 413, 1, 413, + 1, 413, 1, 413, 1, 413, 1, 413, 3, 413, 7764, 8, 413, 1, 414, 1, 414, 1, + 414, 1, 414, 1, 414, 1, 415, 1, 415, 1, 415, 1, 415, 3, 415, 7775, 8, 415, + 1, 415, 1, 415, 3, 415, 7779, 8, 415, 1, 415, 1, 415, 1, 415, 1, 415, 3, + 415, 7785, 8, 415, 1, 416, 1, 416, 1, 416, 5, 416, 7790, 8, 416, 10, 416, + 12, 416, 7793, 9, 416, 1, 417, 1, 417, 1, 418, 1, 418, 1, 418, 1, 418, + 1, 418, 1, 418, 1, 419, 1, 419, 1, 419, 1, 419, 1, 419, 1, 420, 1, 420, + 1, 420, 1, 420, 3, 420, 7812, 8, 420, 1, 420, 1, 420, 1, 420, 1, 421, 1, + 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, + 421, 1, 421, 1, 421, 1, 421, 1, 421, 1, 421, 3, 421, 7833, 8, 421, 1, 421, + 1, 421, 3, 421, 7837, 8, 421, 1, 421, 1, 421, 1, 421, 3, 421, 7842, 8, + 421, 1, 422, 1, 422, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, 423, 1, + 423, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, + 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, + 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, + 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, + 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, + 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, + 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, + 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, 424, 1, + 424, 3, 424, 7925, 8, 424, 1, 425, 1, 425, 1, 426, 1, 426, 3, 426, 7931, + 8, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, 1, 426, + 1, 426, 1, 427, 1, 427, 3, 427, 7944, 8, 427, 1, 427, 1, 427, 3, 427, 7948, + 8, 427, 1, 427, 1, 427, 3, 427, 7952, 8, 427, 1, 427, 1, 427, 3, 427, 7956, + 8, 427, 1, 427, 1, 427, 1, 427, 1, 427, 3, 427, 7962, 8, 427, 1, 428, 1, + 428, 1, 428, 1, 429, 1, 429, 3, 429, 7969, 8, 429, 1, 429, 3, 429, 7972, + 8, 429, 1, 429, 3, 429, 7975, 8, 429, 1, 429, 3, 429, 7978, 8, 429, 1, + 429, 3, 429, 7981, 8, 429, 1, 429, 1, 429, 1, 429, 1, 429, 1, 429, 3, 429, + 7988, 8, 429, 3, 429, 7990, 8, 429, 1, 430, 1, 430, 3, 430, 7994, 8, 430, + 1, 430, 3, 430, 7997, 8, 430, 1, 430, 1, 430, 1, 430, 1, 430, 1, 430, 3, + 430, 8004, 8, 430, 3, 430, 8006, 8, 430, 1, 431, 1, 431, 1, 431, 5, 431, + 8011, 8, 431, 10, 431, 12, 431, 8014, 9, 431, 1, 432, 1, 432, 1, 433, 1, + 433, 3, 433, 8020, 8, 433, 1, 434, 1, 434, 3, 434, 8024, 8, 434, 1, 435, + 1, 435, 3, 435, 8028, 8, 435, 1, 436, 1, 436, 1, 437, 1, 437, 1, 438, 1, + 438, 1, 439, 1, 439, 1, 440, 1, 440, 1, 440, 1, 440, 1, 441, 1, 441, 3, + 441, 8044, 8, 441, 1, 442, 1, 442, 1, 442, 5, 442, 8049, 8, 442, 10, 442, + 12, 442, 8052, 9, 442, 1, 443, 1, 443, 1, 444, 1, 444, 1, 444, 1, 444, + 1, 444, 3, 444, 8061, 8, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, + 444, 1, 444, 1, 444, 1, 444, 1, 444, 1, 444, 3, 444, 8074, 8, 444, 1, 445, + 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 1, 445, 3, 445, + 8085, 8, 445, 1, 446, 1, 446, 1, 446, 5, 446, 8090, 8, 446, 10, 446, 12, + 446, 8093, 9, 446, 1, 447, 1, 447, 3, 447, 8097, 8, 447, 1, 448, 1, 448, + 3, 448, 8101, 8, 448, 1, 449, 1, 449, 3, 449, 8105, 8, 449, 1, 450, 1, + 450, 1, 450, 3, 450, 8110, 8, 450, 1, 450, 1, 450, 1, 450, 1, 451, 1, 451, + 1, 451, 1, 451, 1, 452, 1, 452, 1, 452, 1, 452, 1, 452, 3, 452, 8124, 8, + 452, 1, 453, 1, 453, 1, 453, 3, 453, 8129, 8, 453, 1, 453, 1, 453, 3, 453, + 8133, 8, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 3, 453, 8141, + 8, 453, 1, 453, 3, 453, 8144, 8, 453, 1, 453, 1, 453, 3, 453, 8148, 8, + 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, 453, 1, + 453, 3, 453, 8159, 8, 453, 1, 453, 3, 453, 8162, 8, 453, 3, 453, 8164, + 8, 453, 1, 454, 1, 454, 1, 454, 1, 454, 1, 455, 1, 455, 1, 455, 1, 455, + 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 1, 455, 3, 455, 8180, 8, 455, 1, + 456, 3, 456, 8183, 8, 456, 1, 456, 1, 456, 1, 456, 1, 456, 1, 456, 3, 456, + 8190, 8, 456, 1, 456, 3, 456, 8193, 8, 456, 1, 457, 1, 457, 1, 457, 3, + 457, 8198, 8, 457, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, + 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 1, 458, 3, 458, 8213, 8, 458, 1, + 458, 1, 458, 1, 458, 1, 458, 3, 458, 8219, 8, 458, 1, 459, 1, 459, 1, 460, + 1, 460, 1, 460, 5, 460, 8226, 8, 460, 10, 460, 12, 460, 8229, 9, 460, 1, + 461, 1, 461, 1, 461, 1, 462, 1, 462, 1, 462, 3, 462, 8237, 8, 462, 1, 462, + 1, 462, 1, 462, 1, 462, 1, 462, 3, 462, 8244, 8, 462, 1, 462, 3, 462, 8247, + 8, 462, 1, 463, 1, 463, 1, 463, 1, 463, 3, 463, 8253, 8, 463, 1, 463, 1, + 463, 1, 463, 3, 463, 8258, 8, 463, 1, 464, 1, 464, 1, 464, 1, 465, 3, 465, + 8264, 8, 465, 1, 465, 1, 465, 1, 465, 3, 465, 8269, 8, 465, 1, 465, 1, + 465, 3, 465, 8273, 8, 465, 1, 465, 1, 465, 1, 465, 3, 465, 8278, 8, 465, + 1, 465, 3, 465, 8281, 8, 465, 1, 465, 1, 465, 1, 465, 1, 465, 3, 465, 8287, + 8, 465, 1, 465, 1, 465, 3, 465, 8291, 8, 465, 3, 465, 8293, 8, 465, 1, + 465, 3, 465, 8296, 8, 465, 1, 466, 1, 466, 1, 466, 1, 466, 1, 466, 3, 466, + 8303, 8, 466, 1, 466, 3, 466, 8306, 8, 466, 1, 466, 1, 466, 1, 466, 1, + 466, 1, 466, 3, 466, 8313, 8, 466, 1, 466, 1, 466, 1, 467, 1, 467, 1, 467, + 1, 467, 3, 467, 8321, 8, 467, 1, 467, 3, 467, 8324, 8, 467, 1, 467, 1, + 467, 1, 467, 1, 467, 1, 468, 1, 468, 1, 468, 3, 468, 8333, 8, 468, 1, 468, + 1, 468, 1, 469, 3, 469, 8338, 8, 469, 1, 469, 1, 469, 1, 469, 1, 469, 3, + 469, 8344, 8, 469, 1, 469, 3, 469, 8347, 8, 469, 1, 469, 3, 469, 8350, + 8, 469, 1, 470, 1, 470, 1, 470, 1, 471, 1, 471, 3, 471, 8357, 8, 471, 1, + 471, 1, 471, 3, 471, 8361, 8, 471, 1, 471, 3, 471, 8364, 8, 471, 1, 472, + 1, 472, 1, 472, 1, 472, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, 1, 473, + 1, 473, 1, 473, 1, 473, 3, 473, 8379, 8, 473, 1, 473, 3, 473, 8382, 8, + 473, 1, 474, 1, 474, 1, 475, 1, 475, 1, 475, 3, 475, 8389, 8, 475, 1, 476, + 3, 476, 8392, 8, 476, 1, 476, 1, 476, 1, 476, 1, 476, 1, 476, 3, 476, 8399, + 8, 476, 1, 476, 3, 476, 8402, 8, 476, 1, 476, 3, 476, 8405, 8, 476, 1, + 477, 1, 477, 1, 477, 5, 477, 8410, 8, 477, 10, 477, 12, 477, 8413, 9, 477, + 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, 1, 478, + 1, 478, 3, 478, 8425, 8, 478, 1, 479, 1, 479, 1, 479, 1, 480, 1, 480, 1, + 480, 5, 480, 8433, 8, 480, 10, 480, 12, 480, 8436, 9, 480, 1, 481, 1, 481, + 1, 481, 1, 481, 1, 481, 3, 481, 8443, 8, 481, 1, 481, 1, 481, 1, 481, 1, + 482, 1, 482, 1, 483, 1, 483, 1, 483, 1, 483, 1, 483, 5, 483, 8455, 8, 483, + 10, 483, 12, 483, 8458, 9, 483, 1, 484, 1, 484, 1, 484, 1, 484, 3, 484, + 8464, 8, 484, 1, 485, 1, 485, 3, 485, 8468, 8, 485, 1, 486, 1, 486, 1, + 486, 1, 486, 1, 486, 1, 486, 1, 486, 1, 486, 3, 486, 8478, 8, 486, 1, 487, + 1, 487, 3, 487, 8482, 8, 487, 1, 487, 1, 487, 3, 487, 8486, 8, 487, 1, + 487, 1, 487, 3, 487, 8490, 8, 487, 3, 487, 8492, 8, 487, 1, 487, 1, 487, + 1, 487, 3, 487, 8497, 8, 487, 1, 487, 1, 487, 3, 487, 8501, 8, 487, 1, + 487, 1, 487, 3, 487, 8505, 8, 487, 3, 487, 8507, 8, 487, 3, 487, 8509, + 8, 487, 1, 488, 1, 488, 1, 488, 3, 488, 8514, 8, 488, 1, 488, 5, 488, 8517, + 8, 488, 10, 488, 12, 488, 8520, 9, 488, 1, 489, 1, 489, 1, 489, 3, 489, + 8525, 8, 489, 1, 489, 5, 489, 8528, 8, 489, 10, 489, 12, 489, 8531, 9, + 489, 1, 490, 1, 490, 3, 490, 8535, 8, 490, 1, 490, 3, 490, 8538, 8, 490, + 1, 490, 3, 490, 8541, 8, 490, 1, 490, 1, 490, 1, 490, 3, 490, 8546, 8, + 490, 1, 490, 3, 490, 8549, 8, 490, 1, 490, 3, 490, 8552, 8, 490, 1, 490, + 3, 490, 8555, 8, 490, 1, 490, 3, 490, 8558, 8, 490, 1, 490, 3, 490, 8561, + 8, 490, 1, 490, 3, 490, 8564, 8, 490, 1, 490, 1, 490, 1, 490, 1, 490, 3, + 490, 8570, 8, 490, 1, 491, 1, 491, 3, 491, 8574, 8, 491, 1, 491, 1, 491, + 1, 492, 1, 492, 1, 492, 5, 492, 8581, 8, 492, 10, 492, 12, 492, 8584, 9, + 492, 1, 493, 1, 493, 3, 493, 8588, 8, 493, 1, 493, 1, 493, 3, 493, 8592, + 8, 493, 1, 493, 1, 493, 1, 493, 1, 493, 1, 494, 1, 494, 1, 494, 3, 494, + 8601, 8, 494, 1, 495, 1, 495, 1, 496, 1, 496, 3, 496, 8607, 8, 496, 1, + 496, 1, 496, 3, 496, 8611, 8, 496, 1, 497, 1, 497, 1, 498, 3, 498, 8616, + 8, 498, 1, 498, 1, 498, 3, 498, 8620, 8, 498, 1, 498, 1, 498, 1, 498, 3, + 498, 8625, 8, 498, 1, 498, 1, 498, 1, 498, 1, 498, 3, 498, 8631, 8, 498, + 1, 499, 1, 499, 1, 500, 1, 500, 1, 501, 1, 501, 1, 501, 1, 501, 1, 501, + 1, 501, 3, 501, 8643, 8, 501, 1, 502, 1, 502, 1, 503, 1, 503, 1, 504, 1, + 504, 1, 504, 1, 504, 1, 505, 1, 505, 1, 505, 5, 505, 8656, 8, 505, 10, + 505, 12, 505, 8659, 9, 505, 1, 506, 1, 506, 1, 506, 1, 506, 3, 506, 8665, + 8, 506, 3, 506, 8667, 8, 506, 1, 506, 3, 506, 8670, 8, 506, 1, 507, 1, + 507, 3, 507, 8674, 8, 507, 1, 507, 1, 507, 3, 507, 8678, 8, 507, 3, 507, + 8680, 8, 507, 1, 508, 1, 508, 1, 509, 1, 509, 1, 509, 1, 509, 3, 509, 8688, + 8, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 1, 509, 3, 509, + 8697, 8, 509, 1, 509, 1, 509, 1, 509, 1, 509, 3, 509, 8703, 8, 509, 3, + 509, 8705, 8, 509, 3, 509, 8707, 8, 509, 1, 510, 1, 510, 1, 510, 1, 510, + 1, 510, 3, 510, 8714, 8, 510, 1, 511, 1, 511, 3, 511, 8718, 8, 511, 1, + 512, 1, 512, 1, 513, 1, 513, 1, 513, 1, 513, 1, 513, 3, 513, 8727, 8, 513, + 1, 514, 1, 514, 3, 514, 8731, 8, 514, 1, 515, 1, 515, 1, 516, 1, 516, 1, + 517, 1, 517, 1, 517, 1, 517, 1, 518, 1, 518, 1, 518, 5, 518, 8744, 8, 518, + 10, 518, 12, 518, 8747, 9, 518, 1, 519, 1, 519, 1, 519, 1, 519, 1, 519, + 3, 519, 8754, 8, 519, 1, 520, 1, 520, 1, 520, 1, 521, 1, 521, 1, 521, 1, + 521, 1, 521, 1, 522, 1, 522, 1, 522, 1, 522, 1, 522, 1, 523, 1, 523, 1, + 523, 1, 523, 1, 523, 1, 523, 1, 524, 1, 524, 1, 524, 1, 525, 1, 525, 1, + 525, 1, 525, 3, 525, 8782, 8, 525, 1, 526, 1, 526, 1, 527, 4, 527, 8787, + 8, 527, 11, 527, 12, 527, 8788, 1, 528, 1, 528, 3, 528, 8793, 8, 528, 1, + 528, 3, 528, 8796, 8, 528, 1, 529, 1, 529, 1, 529, 3, 529, 8801, 8, 529, + 1, 529, 1, 529, 3, 529, 8805, 8, 529, 1, 529, 3, 529, 8808, 8, 529, 1, + 530, 1, 530, 1, 530, 1, 531, 1, 531, 1, 531, 1, 531, 1, 531, 1, 531, 1, + 531, 1, 531, 1, 531, 5, 531, 8822, 8, 531, 10, 531, 12, 531, 8825, 9, 531, + 1, 532, 1, 532, 1, 532, 1, 533, 1, 533, 1, 533, 5, 533, 8833, 8, 533, 10, + 533, 12, 533, 8836, 9, 533, 1, 534, 1, 534, 3, 534, 8840, 8, 534, 1, 534, + 3, 534, 8843, 8, 534, 1, 534, 1, 534, 3, 534, 8847, 8, 534, 1, 534, 1, + 534, 3, 534, 8851, 8, 534, 1, 534, 1, 534, 3, 534, 8855, 8, 534, 1, 534, + 1, 534, 1, 534, 3, 534, 8860, 8, 534, 1, 534, 1, 534, 3, 534, 8864, 8, + 534, 1, 534, 1, 534, 3, 534, 8868, 8, 534, 3, 534, 8870, 8, 534, 1, 534, + 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 1, 534, 3, 534, 8879, 8, 534, 1, + 534, 1, 534, 1, 534, 3, 534, 8884, 8, 534, 1, 534, 1, 534, 1, 534, 1, 534, + 3, 534, 8890, 8, 534, 1, 534, 1, 534, 3, 534, 8894, 8, 534, 3, 534, 8896, + 8, 534, 1, 534, 5, 534, 8899, 8, 534, 10, 534, 12, 534, 8902, 9, 534, 1, + 535, 3, 535, 8905, 8, 535, 1, 535, 1, 535, 1, 535, 1, 535, 1, 535, 1, 535, + 1, 535, 1, 535, 1, 535, 3, 535, 8916, 8, 535, 1, 535, 1, 535, 3, 535, 8920, + 8, 535, 1, 536, 3, 536, 8923, 8, 536, 1, 536, 1, 536, 1, 536, 1, 536, 1, + 536, 3, 536, 8930, 8, 536, 1, 537, 1, 537, 1, 538, 3, 538, 8935, 8, 538, + 1, 538, 1, 538, 1, 538, 1, 538, 1, 538, 3, 538, 8942, 8, 538, 1, 539, 1, + 539, 1, 539, 3, 539, 8947, 8, 539, 1, 539, 3, 539, 8950, 8, 539, 1, 539, + 1, 539, 1, 539, 1, 539, 3, 539, 8956, 8, 539, 1, 540, 1, 540, 3, 540, 8960, + 8, 540, 1, 541, 1, 541, 1, 541, 1, 541, 1, 541, 1, 541, 1, 541, 3, 541, + 8969, 8, 541, 1, 542, 1, 542, 3, 542, 8973, 8, 542, 1, 542, 1, 542, 1, + 542, 1, 542, 1, 542, 1, 542, 3, 542, 8981, 8, 542, 3, 542, 8983, 8, 542, + 1, 543, 1, 543, 1, 543, 5, 543, 8988, 8, 543, 10, 543, 12, 543, 8991, 9, + 543, 1, 544, 1, 544, 3, 544, 8995, 8, 544, 1, 544, 3, 544, 8998, 8, 544, + 1, 545, 1, 545, 1, 545, 1, 545, 1, 545, 1, 545, 3, 545, 9006, 8, 545, 1, + 546, 1, 546, 1, 546, 1, 546, 1, 546, 1, 547, 1, 547, 3, 547, 9015, 8, 547, + 1, 547, 1, 547, 1, 547, 1, 547, 1, 547, 1, 547, 3, 547, 9023, 8, 547, 3, + 547, 9025, 8, 547, 1, 548, 1, 548, 3, 548, 9029, 8, 548, 1, 549, 1, 549, + 1, 549, 5, 549, 9034, 8, 549, 10, 549, 12, 549, 9037, 9, 549, 1, 550, 1, + 550, 1, 550, 1, 550, 1, 550, 1, 551, 1, 551, 1, 551, 1, 552, 1, 552, 1, + 552, 1, 553, 1, 553, 1, 553, 1, 553, 1, 553, 3, 553, 9055, 8, 553, 1, 554, + 1, 554, 1, 555, 1, 555, 1, 555, 5, 555, 9062, 8, 555, 10, 555, 12, 555, + 9065, 9, 555, 1, 556, 1, 556, 1, 556, 3, 556, 9070, 8, 556, 1, 557, 1, + 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, + 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 1, 557, 3, 557, 9089, 8, 557, + 1, 557, 1, 557, 1, 558, 1, 558, 1, 558, 5, 558, 9096, 8, 558, 10, 558, + 12, 558, 9099, 9, 558, 1, 559, 1, 559, 1, 559, 3, 559, 9104, 8, 559, 1, + 559, 1, 559, 3, 559, 9108, 8, 559, 1, 560, 4, 560, 9111, 8, 560, 11, 560, + 12, 560, 9112, 1, 561, 1, 561, 1, 561, 1, 561, 1, 561, 1, 561, 1, 561, + 1, 561, 3, 561, 9123, 8, 561, 1, 562, 1, 562, 1, 562, 5, 562, 9128, 8, + 562, 10, 562, 12, 562, 9131, 9, 562, 1, 563, 1, 563, 1, 563, 1, 563, 1, + 563, 1, 563, 3, 563, 9139, 8, 563, 1, 564, 3, 564, 9142, 8, 564, 1, 564, + 1, 564, 1, 564, 1, 564, 1, 564, 1, 564, 1, 564, 3, 564, 9151, 8, 564, 3, + 564, 9153, 8, 564, 1, 564, 1, 564, 1, 564, 1, 564, 3, 564, 9159, 8, 564, + 1, 565, 1, 565, 3, 565, 9163, 8, 565, 1, 565, 5, 565, 9166, 8, 565, 10, + 565, 12, 565, 9169, 9, 565, 1, 566, 1, 566, 1, 566, 1, 566, 1, 566, 1, + 566, 1, 566, 3, 566, 9178, 8, 566, 1, 566, 1, 566, 1, 566, 1, 566, 3, 566, + 9184, 8, 566, 3, 566, 9186, 8, 566, 1, 567, 1, 567, 1, 567, 1, 567, 3, + 567, 9192, 8, 567, 1, 568, 1, 568, 1, 568, 1, 568, 3, 568, 9198, 8, 568, + 1, 568, 3, 568, 9201, 8, 568, 1, 568, 3, 568, 9204, 8, 568, 1, 569, 1, + 569, 1, 569, 1, 569, 1, 570, 1, 570, 1, 570, 1, 570, 1, 570, 1, 570, 1, + 570, 3, 570, 9217, 8, 570, 1, 570, 1, 570, 1, 570, 1, 570, 3, 570, 9223, + 8, 570, 1, 570, 1, 570, 3, 570, 9227, 8, 570, 1, 570, 1, 570, 3, 570, 9231, + 8, 570, 1, 570, 3, 570, 9234, 8, 570, 1, 571, 1, 571, 1, 571, 1, 571, 1, + 572, 1, 572, 3, 572, 9242, 8, 572, 1, 573, 1, 573, 3, 573, 9246, 8, 573, + 1, 574, 1, 574, 3, 574, 9250, 8, 574, 1, 574, 1, 574, 1, 574, 1, 574, 1, + 575, 1, 575, 3, 575, 9258, 8, 575, 1, 576, 1, 576, 1, 576, 1, 576, 1, 576, + 3, 576, 9265, 8, 576, 1, 577, 1, 577, 1, 577, 1, 577, 1, 577, 3, 577, 9272, + 8, 577, 1, 578, 1, 578, 3, 578, 9276, 8, 578, 1, 578, 1, 578, 1, 578, 1, + 578, 3, 578, 9282, 8, 578, 3, 578, 9284, 8, 578, 1, 579, 1, 579, 1, 580, + 1, 580, 1, 580, 1, 580, 1, 580, 3, 580, 9293, 8, 580, 1, 580, 3, 580, 9296, + 8, 580, 1, 581, 1, 581, 1, 582, 1, 582, 1, 582, 1, 582, 1, 582, 1, 582, + 3, 582, 9306, 8, 582, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, + 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 1, 583, 3, 583, 9322, + 8, 583, 1, 583, 1, 583, 1, 583, 1, 583, 3, 583, 9328, 8, 583, 1, 583, 1, + 583, 1, 583, 3, 583, 9333, 8, 583, 1, 584, 1, 584, 1, 584, 1, 584, 1, 584, + 3, 584, 9340, 8, 584, 1, 585, 1, 585, 1, 585, 1, 586, 1, 586, 1, 587, 1, + 587, 3, 587, 9349, 8, 587, 1, 588, 1, 588, 1, 588, 5, 588, 9354, 8, 588, + 10, 588, 12, 588, 9357, 9, 588, 1, 589, 1, 589, 1, 589, 5, 589, 9362, 8, + 589, 10, 589, 12, 589, 9365, 9, 589, 1, 590, 1, 590, 1, 590, 5, 590, 9370, + 8, 590, 10, 590, 12, 590, 9373, 9, 590, 1, 591, 1, 591, 3, 591, 9377, 8, + 591, 1, 591, 1, 591, 3, 591, 9381, 8, 591, 1, 591, 1, 591, 1, 591, 1, 591, + 3, 591, 9387, 8, 591, 1, 592, 1, 592, 3, 592, 9391, 8, 592, 1, 592, 1, + 592, 3, 592, 9395, 8, 592, 1, 593, 3, 593, 9398, 8, 593, 1, 593, 1, 593, + 1, 594, 1, 594, 3, 594, 9404, 8, 594, 1, 595, 1, 595, 1, 595, 3, 595, 9409, + 8, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, + 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 1, 595, 3, 595, 9425, 8, 595, 1, + 595, 3, 595, 9428, 8, 595, 3, 595, 9430, 8, 595, 1, 596, 1, 596, 1, 596, + 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 1, 596, 3, 596, 9442, 8, + 596, 3, 596, 9444, 8, 596, 1, 597, 1, 597, 3, 597, 9448, 8, 597, 1, 597, + 1, 597, 1, 597, 1, 597, 3, 597, 9454, 8, 597, 1, 597, 1, 597, 3, 597, 9458, + 8, 597, 3, 597, 9460, 8, 597, 1, 598, 1, 598, 1, 598, 1, 598, 5, 598, 9466, + 8, 598, 10, 598, 12, 598, 9469, 9, 598, 1, 599, 3, 599, 9472, 8, 599, 1, + 599, 1, 599, 1, 600, 1, 600, 1, 600, 5, 600, 9479, 8, 600, 10, 600, 12, + 600, 9482, 9, 600, 1, 601, 1, 601, 1, 601, 5, 601, 9487, 8, 601, 10, 601, + 12, 601, 9490, 9, 601, 1, 602, 1, 602, 1, 602, 3, 602, 9495, 8, 602, 1, + 603, 3, 603, 9498, 8, 603, 1, 603, 1, 603, 1, 604, 1, 604, 1, 604, 1, 604, + 1, 604, 3, 604, 9507, 8, 604, 1, 605, 1, 605, 1, 605, 3, 605, 9512, 8, + 605, 1, 606, 1, 606, 1, 606, 5, 606, 9517, 8, 606, 10, 606, 12, 606, 9520, + 9, 606, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 3, 607, + 9529, 8, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, + 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, + 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 3, 607, 9555, + 8, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, 1, 607, + 1, 607, 3, 607, 9566, 8, 607, 5, 607, 9568, 8, 607, 10, 607, 12, 607, 9571, + 9, 607, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 3, 608, 9578, 8, 608, 1, + 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, + 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, 608, 1, + 608, 1, 608, 1, 608, 3, 608, 9601, 8, 608, 1, 608, 1, 608, 1, 608, 1, 608, + 1, 608, 1, 608, 3, 608, 9609, 8, 608, 1, 609, 1, 609, 1, 610, 1, 610, 1, + 610, 1, 610, 1, 610, 1, 610, 3, 610, 9619, 8, 610, 1, 610, 3, 610, 9622, + 8, 610, 1, 610, 1, 610, 1, 610, 3, 610, 9627, 8, 610, 1, 610, 1, 610, 1, + 610, 3, 610, 9632, 8, 610, 1, 610, 1, 610, 3, 610, 9636, 8, 610, 1, 610, + 1, 610, 1, 611, 1, 611, 3, 611, 9642, 8, 611, 1, 611, 3, 611, 9645, 8, + 611, 1, 611, 3, 611, 9648, 8, 611, 1, 611, 3, 611, 9651, 8, 611, 1, 612, + 1, 612, 3, 612, 9655, 8, 612, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9669, 8, 613, + 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9676, 8, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 3, 613, 9683, 8, 613, 1, 613, 1, 613, 1, 613, + 1, 613, 1, 613, 3, 613, 9690, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 3, 613, 9708, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, + 1, 613, 1, 613, 3, 613, 9716, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9728, 8, 613, 1, 613, + 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, + 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9746, 8, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 3, 613, 9785, 8, 613, 3, 613, 9787, 8, 613, 1, 613, 1, 613, 1, 613, + 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, + 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9807, 8, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9817, + 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, + 1, 613, 3, 613, 9828, 8, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, 613, 1, + 613, 1, 613, 1, 613, 1, 613, 1, 613, 3, 613, 9840, 8, 613, 1, 614, 1, 614, + 1, 614, 1, 614, 1, 614, 3, 614, 9847, 8, 614, 1, 615, 1, 615, 1, 615, 1, + 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 1, 615, 3, 615, 9859, 8, 615, + 1, 616, 1, 616, 1, 616, 1, 616, 1, 616, 1, 617, 1, 617, 1, 617, 5, 617, + 9869, 8, 617, 10, 617, 12, 617, 9872, 9, 617, 1, 618, 1, 618, 1, 618, 3, + 618, 9877, 8, 618, 1, 619, 1, 619, 1, 620, 1, 620, 1, 620, 1, 620, 3, 620, + 9885, 8, 620, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, + 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 1, 621, 3, 621, 9902, + 8, 621, 1, 622, 1, 622, 1, 622, 1, 623, 1, 623, 1, 623, 1, 623, 1, 623, + 1, 623, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 624, 1, 625, 1, 625, + 1, 625, 1, 626, 1, 626, 1, 626, 5, 626, 9925, 8, 626, 10, 626, 12, 626, + 9928, 9, 626, 1, 627, 1, 627, 1, 627, 1, 627, 1, 628, 1, 628, 1, 628, 3, + 628, 9937, 8, 628, 1, 629, 1, 629, 3, 629, 9941, 8, 629, 1, 629, 3, 629, + 9944, 8, 629, 1, 629, 3, 629, 9947, 8, 629, 1, 629, 3, 629, 9950, 8, 629, + 1, 629, 1, 629, 1, 630, 1, 630, 1, 631, 1, 631, 1, 631, 1, 631, 1, 632, + 1, 632, 1, 632, 3, 632, 9963, 8, 632, 1, 632, 1, 632, 1, 632, 3, 632, 9968, + 8, 632, 1, 632, 1, 632, 1, 632, 3, 632, 9973, 8, 632, 3, 632, 9975, 8, + 632, 1, 633, 1, 633, 1, 633, 1, 633, 1, 633, 1, 633, 3, 633, 9983, 8, 633, + 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 1, 634, 3, 634, 9992, 8, + 634, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 1, 635, 3, 635, 10001, + 8, 635, 1, 636, 1, 636, 1, 636, 3, 636, 10006, 8, 636, 1, 636, 1, 636, + 1, 636, 1, 636, 1, 636, 1, 636, 1, 636, 3, 636, 10015, 8, 636, 1, 637, + 1, 637, 1, 637, 3, 637, 10020, 8, 637, 1, 637, 1, 637, 1, 638, 1, 638, + 1, 638, 1, 638, 1, 638, 1, 638, 1, 639, 1, 639, 1, 640, 1, 640, 3, 640, + 10034, 8, 640, 1, 641, 1, 641, 1, 642, 1, 642, 1, 642, 1, 642, 1, 642, + 1, 642, 3, 642, 10044, 8, 642, 1, 643, 1, 643, 1, 643, 1, 643, 1, 643, + 1, 643, 3, 643, 10052, 8, 643, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, + 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 1, 644, 3, 644, 10066, + 8, 644, 1, 645, 1, 645, 1, 645, 5, 645, 10071, 8, 645, 10, 645, 12, 645, + 10074, 9, 645, 1, 646, 1, 646, 1, 646, 5, 646, 10079, 8, 646, 10, 646, + 12, 646, 10082, 9, 646, 1, 647, 1, 647, 1, 647, 1, 647, 1, 647, 3, 647, + 10089, 8, 647, 1, 648, 1, 648, 1, 648, 5, 648, 10094, 8, 648, 10, 648, + 12, 648, 10097, 9, 648, 1, 649, 1, 649, 1, 649, 3, 649, 10102, 8, 649, + 1, 649, 1, 649, 1, 650, 1, 650, 1, 650, 5, 650, 10109, 8, 650, 10, 650, + 12, 650, 10112, 9, 650, 1, 651, 1, 651, 1, 651, 1, 651, 1, 652, 1, 652, + 1, 652, 1, 652, 1, 652, 1, 652, 1, 652, 1, 652, 3, 652, 10126, 8, 652, + 1, 653, 1, 653, 1, 654, 1, 654, 1, 654, 1, 654, 1, 654, 1, 654, 1, 654, + 3, 654, 10137, 8, 654, 1, 655, 1, 655, 1, 655, 1, 655, 1, 656, 1, 656, + 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, + 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, + 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 1, 656, 3, 656, 10170, + 8, 656, 1, 657, 1, 657, 1, 657, 1, 657, 1, 657, 1, 657, 1, 657, 3, 657, + 10179, 8, 657, 1, 658, 1, 658, 1, 658, 1, 658, 1, 658, 3, 658, 10186, 8, + 658, 1, 659, 1, 659, 3, 659, 10190, 8, 659, 1, 659, 1, 659, 3, 659, 10194, + 8, 659, 1, 659, 1, 659, 1, 660, 4, 660, 10199, 8, 660, 11, 660, 12, 660, + 10200, 1, 661, 1, 661, 1, 661, 1, 661, 1, 661, 1, 662, 1, 662, 1, 662, + 1, 663, 1, 663, 1, 664, 1, 664, 3, 664, 10215, 8, 664, 1, 665, 1, 665, + 1, 665, 3, 665, 10220, 8, 665, 1, 665, 1, 665, 1, 665, 3, 665, 10225, 8, + 665, 1, 665, 1, 665, 3, 665, 10229, 8, 665, 3, 665, 10231, 8, 665, 1, 665, + 3, 665, 10234, 8, 665, 1, 666, 1, 666, 1, 667, 4, 667, 10239, 8, 667, 11, + 667, 12, 667, 10240, 1, 668, 5, 668, 10244, 8, 668, 10, 668, 12, 668, 10247, + 9, 668, 1, 669, 1, 669, 1, 670, 1, 670, 1, 670, 5, 670, 10254, 8, 670, + 10, 670, 12, 670, 10257, 9, 670, 1, 671, 1, 671, 3, 671, 10261, 8, 671, + 1, 671, 3, 671, 10264, 8, 671, 1, 672, 1, 672, 1, 672, 3, 672, 10269, 8, + 672, 1, 673, 1, 673, 1, 673, 5, 673, 10274, 8, 673, 10, 673, 12, 673, 10277, + 9, 673, 1, 674, 1, 674, 3, 674, 10281, 8, 674, 1, 675, 1, 675, 1, 675, + 5, 675, 10286, 8, 675, 10, 675, 12, 675, 10289, 9, 675, 1, 676, 1, 676, + 1, 677, 1, 677, 1, 678, 1, 678, 1, 679, 1, 679, 1, 679, 1, 679, 1, 679, + 1, 679, 1, 679, 3, 679, 10304, 8, 679, 1, 680, 1, 680, 1, 680, 1, 680, + 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 1, 680, 3, 680, 10316, 8, 680, + 1, 680, 1, 680, 1, 680, 3, 680, 10321, 8, 680, 1, 680, 1, 680, 1, 680, + 1, 680, 1, 680, 1, 680, 3, 680, 10329, 8, 680, 1, 680, 1, 680, 1, 680, + 1, 680, 1, 680, 3, 680, 10336, 8, 680, 1, 680, 1, 680, 1, 680, 3, 680, + 10341, 8, 680, 1, 681, 1, 681, 1, 682, 1, 682, 1, 683, 1, 683, 1, 684, + 1, 684, 1, 685, 1, 685, 3, 685, 10353, 8, 685, 1, 686, 1, 686, 1, 686, + 1, 686, 5, 686, 10359, 8, 686, 10, 686, 12, 686, 10362, 9, 686, 1, 686, + 1, 686, 3, 686, 10366, 8, 686, 1, 687, 1, 687, 1, 687, 1, 688, 1, 688, + 1, 688, 1, 688, 1, 688, 3, 688, 10376, 8, 688, 1, 689, 1, 689, 1, 690, + 1, 690, 1, 690, 3, 690, 10383, 8, 690, 1, 691, 1, 691, 1, 691, 5, 691, + 10388, 8, 691, 10, 691, 12, 691, 10391, 9, 691, 1, 692, 1, 692, 1, 692, + 1, 692, 1, 692, 1, 692, 3, 692, 10399, 8, 692, 1, 693, 1, 693, 1, 693, + 1, 693, 3, 693, 10405, 8, 693, 1, 694, 1, 694, 1, 694, 1, 694, 3, 694, + 10411, 8, 694, 1, 695, 1, 695, 1, 695, 1, 695, 3, 695, 10417, 8, 695, 1, + 696, 1, 696, 1, 696, 1, 696, 1, 696, 1, 696, 3, 696, 10425, 8, 696, 1, + 697, 1, 697, 3, 697, 10429, 8, 697, 1, 697, 1, 697, 1, 697, 1, 697, 1, + 697, 3, 697, 10436, 8, 697, 1, 698, 1, 698, 1, 699, 1, 699, 1, 700, 1, + 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, + 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, + 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, + 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, + 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, + 700, 1, 700, 1, 700, 1, 700, 1, 700, 1, 700, 3, 700, 10494, 8, 700, 1, + 701, 1, 701, 1, 702, 1, 702, 1, 703, 1, 703, 1, 704, 1, 704, 1, 704, 3, + 704, 10505, 8, 704, 1, 705, 5, 705, 10508, 8, 705, 10, 705, 12, 705, 10511, + 9, 705, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, + 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, 1, 706, + 1, 706, 1, 706, 1, 706, 3, 706, 10533, 8, 706, 1, 707, 1, 707, 1, 708, + 1, 708, 1, 708, 1, 708, 3, 708, 10541, 8, 708, 1, 709, 1, 709, 1, 710, + 1, 710, 1, 710, 1, 710, 3, 710, 10549, 8, 710, 1, 710, 1, 710, 3, 710, + 10553, 8, 710, 1, 711, 3, 711, 10556, 8, 711, 1, 711, 1, 711, 3, 711, 10560, + 8, 711, 3, 711, 10562, 8, 711, 1, 712, 1, 712, 1, 713, 4, 713, 10567, 8, + 713, 11, 713, 12, 713, 10568, 1, 714, 1, 714, 1, 714, 1, 714, 1, 715, 1, + 715, 1, 715, 3, 715, 10578, 8, 715, 1, 716, 1, 716, 1, 716, 1, 716, 1, + 716, 3, 716, 10585, 8, 716, 1, 716, 1, 716, 3, 716, 10589, 8, 716, 1, 716, + 3, 716, 10592, 8, 716, 1, 716, 3, 716, 10595, 8, 716, 1, 716, 3, 716, 10598, + 8, 716, 1, 716, 1, 716, 3, 716, 10602, 8, 716, 1, 716, 1, 716, 1, 716, + 3, 716, 10607, 8, 716, 1, 716, 1, 716, 1, 717, 1, 717, 1, 717, 3, 717, + 10614, 8, 717, 1, 718, 1, 718, 1, 719, 1, 719, 1, 719, 1, 719, 1, 720, + 1, 720, 1, 720, 5, 720, 10625, 8, 720, 10, 720, 12, 720, 10628, 9, 720, + 1, 721, 1, 721, 1, 721, 1, 722, 1, 722, 1, 723, 1, 723, 3, 723, 10637, + 8, 723, 1, 724, 1, 724, 1, 725, 1, 725, 1, 726, 1, 726, 1, 727, 1, 727, + 1, 727, 1, 728, 1, 728, 1, 728, 1, 729, 1, 729, 1, 729, 1, 730, 1, 730, + 3, 730, 10656, 8, 730, 1, 731, 1, 731, 1, 732, 5, 732, 10661, 8, 732, 10, + 732, 12, 732, 10664, 9, 732, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, + 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, + 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, 733, 1, + 733, 1, 733, 1, 733, 1, 733, 3, 733, 10693, 8, 733, 1, 734, 1, 734, 1, + 734, 1, 734, 1, 735, 1, 735, 1, 735, 1, 735, 3, 735, 10703, 8, 735, 1, + 735, 1, 735, 1, 735, 1, 735, 1, 735, 1, 735, 1, 735, 3, 735, 10712, 8, + 735, 1, 735, 1, 735, 1, 735, 3, 735, 10717, 8, 735, 1, 736, 1, 736, 1, + 737, 1, 737, 1, 737, 1, 737, 1, 737, 1, 738, 1, 738, 3, 738, 10728, 8, + 738, 1, 738, 1, 738, 1, 738, 1, 738, 1, 739, 1, 739, 1, 740, 1, 740, 1, + 740, 5, 740, 10739, 8, 740, 10, 740, 12, 740, 10742, 9, 740, 1, 741, 1, + 741, 1, 741, 1, 741, 1, 742, 1, 742, 1, 743, 1, 743, 1, 744, 1, 744, 3, + 744, 10754, 8, 744, 1, 744, 1, 744, 1, 744, 1, 744, 5, 744, 10760, 8, 744, + 10, 744, 12, 744, 10763, 9, 744, 1, 745, 1, 745, 1, 745, 1, 745, 1, 745, + 1, 745, 3, 745, 10771, 8, 745, 1, 745, 1, 745, 1, 745, 1, 745, 1, 746, + 1, 746, 1, 746, 1, 746, 1, 746, 5, 746, 10782, 8, 746, 10, 746, 12, 746, + 10785, 9, 746, 1, 747, 1, 747, 1, 747, 1, 748, 1, 748, 3, 748, 10792, 8, + 748, 1, 748, 1, 748, 3, 748, 10796, 8, 748, 1, 748, 1, 748, 1, 748, 1, + 748, 1, 749, 1, 749, 1, 750, 4, 750, 10805, 8, 750, 11, 750, 12, 750, 10806, + 1, 751, 1, 751, 1, 751, 1, 751, 1, 751, 1, 752, 1, 752, 1, 752, 1, 753, + 3, 753, 10818, 8, 753, 1, 753, 1, 753, 1, 754, 3, 754, 10823, 8, 754, 1, + 754, 1, 754, 1, 754, 1, 754, 1, 755, 3, 755, 10830, 8, 755, 1, 755, 1, + 755, 1, 755, 1, 755, 1, 756, 1, 756, 1, 756, 1, 756, 3, 756, 10840, 8, + 756, 1, 756, 1, 756, 1, 756, 1, 756, 1, 756, 3, 756, 10847, 8, 756, 1, + 756, 3, 756, 10850, 8, 756, 1, 756, 1, 756, 1, 756, 1, 756, 3, 756, 10856, + 8, 756, 3, 756, 10858, 8, 756, 1, 757, 1, 757, 1, 757, 1, 758, 1, 758, + 1, 758, 1, 758, 5, 758, 10867, 8, 758, 10, 758, 12, 758, 10870, 9, 758, + 1, 758, 1, 758, 1, 759, 1, 759, 1, 760, 1, 760, 1, 760, 1, 761, 1, 761, + 1, 762, 3, 762, 10882, 8, 762, 1, 762, 1, 762, 1, 762, 3, 762, 10887, 8, + 762, 1, 762, 1, 762, 1, 762, 1, 762, 1, 762, 1, 763, 1, 763, 1, 763, 1, + 764, 1, 764, 3, 764, 10899, 8, 764, 1, 764, 3, 764, 10902, 8, 764, 1, 764, + 1, 764, 1, 765, 1, 765, 1, 766, 1, 766, 1, 766, 1, 766, 1, 766, 1, 766, + 1, 766, 3, 766, 10915, 8, 766, 1, 766, 3, 766, 10918, 8, 766, 1, 766, 3, + 766, 10921, 8, 766, 3, 766, 10923, 8, 766, 1, 766, 1, 766, 1, 767, 1, 767, + 1, 768, 1, 768, 3, 768, 10931, 8, 768, 1, 768, 1, 768, 3, 768, 10935, 8, + 768, 1, 768, 3, 768, 10938, 8, 768, 1, 768, 1, 768, 1, 768, 1, 768, 3, + 768, 10944, 8, 768, 1, 768, 1, 768, 3, 768, 10948, 8, 768, 1, 768, 1, 768, + 1, 768, 1, 768, 3, 768, 10954, 8, 768, 1, 768, 1, 768, 1, 768, 3, 768, + 10959, 8, 768, 1, 768, 1, 768, 1, 768, 1, 768, 3, 768, 10965, 8, 768, 1, + 768, 3, 768, 10968, 8, 768, 1, 768, 1, 768, 3, 768, 10972, 8, 768, 1, 769, + 1, 769, 1, 770, 1, 770, 4, 770, 10978, 8, 770, 11, 770, 12, 770, 10979, + 1, 771, 1, 771, 1, 771, 1, 772, 1, 772, 1, 772, 1, 772, 1, 773, 1, 773, + 1, 773, 5, 773, 10992, 8, 773, 10, 773, 12, 773, 10995, 9, 773, 1, 774, + 1, 774, 1, 774, 3, 774, 11000, 8, 774, 1, 774, 1, 774, 1, 775, 1, 775, + 1, 775, 1, 776, 1, 776, 1, 776, 1, 776, 1, 776, 3, 776, 11012, 8, 776, + 1, 776, 1, 776, 1, 777, 1, 777, 1, 777, 1, 778, 1, 778, 1, 778, 3, 778, + 11022, 8, 778, 1, 778, 3, 778, 11025, 8, 778, 1, 778, 3, 778, 11028, 8, + 778, 1, 778, 3, 778, 11031, 8, 778, 1, 778, 3, 778, 11034, 8, 778, 1, 778, + 1, 778, 1, 779, 1, 779, 1, 779, 1, 780, 1, 780, 1, 780, 5, 780, 11044, + 8, 780, 10, 780, 12, 780, 11047, 9, 780, 1, 781, 1, 781, 3, 781, 11051, + 8, 781, 1, 781, 1, 781, 1, 782, 1, 782, 1, 782, 3, 782, 11058, 8, 782, + 1, 782, 1, 782, 1, 782, 1, 782, 1, 782, 3, 782, 11065, 8, 782, 3, 782, + 11067, 8, 782, 1, 782, 1, 782, 1, 782, 1, 782, 1, 782, 3, 782, 11074, 8, + 782, 3, 782, 11076, 8, 782, 1, 782, 1, 782, 1, 783, 1, 783, 1, 783, 1, + 783, 1, 783, 3, 783, 11085, 8, 783, 1, 784, 1, 784, 1, 784, 5, 784, 11090, + 8, 784, 10, 784, 12, 784, 11093, 9, 784, 1, 785, 1, 785, 1, 785, 1, 786, + 3, 786, 11099, 8, 786, 1, 786, 1, 786, 1, 787, 1, 787, 1, 788, 1, 788, + 3, 788, 11107, 8, 788, 1, 788, 3, 788, 11110, 8, 788, 1, 788, 1, 788, 1, + 788, 1, 788, 1, 788, 1, 789, 1, 789, 1, 790, 1, 790, 1, 791, 1, 791, 1, + 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, 791, 1, + 791, 1, 791, 3, 791, 11134, 8, 791, 3, 791, 11136, 8, 791, 1, 792, 1, 792, + 3, 792, 11140, 8, 792, 1, 792, 1, 792, 1, 792, 1, 793, 1, 793, 1, 793, + 1, 793, 1, 794, 1, 794, 1, 794, 1, 795, 1, 795, 3, 795, 11154, 8, 795, + 1, 795, 1, 795, 1, 796, 1, 796, 3, 796, 11160, 8, 796, 1, 796, 1, 796, + 1, 797, 1, 797, 3, 797, 11166, 8, 797, 1, 797, 1, 797, 1, 798, 1, 798, + 1, 798, 1, 798, 1, 798, 1, 798, 1, 798, 1, 798, 1, 798, 3, 798, 11179, + 8, 798, 1, 798, 3, 798, 11182, 8, 798, 1, 799, 1, 799, 3, 799, 11186, 8, + 799, 1, 800, 1, 800, 1, 800, 1, 801, 4, 801, 11192, 8, 801, 11, 801, 12, + 801, 11193, 1, 802, 1, 802, 1, 802, 1, 802, 1, 802, 1, 803, 1, 803, 1, + 803, 5, 803, 11204, 8, 803, 10, 803, 12, 803, 11207, 9, 803, 1, 804, 1, + 804, 1, 804, 3, 804, 11212, 8, 804, 1, 805, 1, 805, 1, 806, 1, 806, 1, + 807, 1, 807, 1, 808, 1, 808, 1, 808, 1, 809, 1, 809, 3, 809, 11225, 8, + 809, 1, 810, 1, 810, 1, 811, 3, 811, 11230, 8, 811, 1, 811, 3, 811, 11233, + 8, 811, 1, 811, 3, 811, 11236, 8, 811, 1, 811, 3, 811, 11239, 8, 811, 1, + 811, 3, 811, 11242, 8, 811, 1, 811, 3, 811, 11245, 8, 811, 1, 811, 3, 811, + 11248, 8, 811, 1, 812, 1, 812, 1, 813, 1, 813, 1, 814, 1, 814, 1, 815, + 1, 815, 1, 816, 1, 816, 3, 816, 11260, 8, 816, 1, 817, 1, 817, 3, 817, + 11264, 8, 817, 1, 817, 1, 817, 1, 817, 0, 1, 1214, 818, 0, 2, 4, 6, 8, + 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, + 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, + 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, + 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, + 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, + 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, + 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, + 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, + 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, + 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, + 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, + 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, + 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, + 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, + 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, + 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, + 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, + 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, + 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, + 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, + 624, 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, 646, 648, 650, 652, + 654, 656, 658, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, + 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, + 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, + 744, 746, 748, 750, 752, 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, + 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, + 804, 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, + 834, 836, 838, 840, 842, 844, 846, 848, 850, 852, 854, 856, 858, 860, 862, + 864, 866, 868, 870, 872, 874, 876, 878, 880, 882, 884, 886, 888, 890, 892, + 894, 896, 898, 900, 902, 904, 906, 908, 910, 912, 914, 916, 918, 920, 922, + 924, 926, 928, 930, 932, 934, 936, 938, 940, 942, 944, 946, 948, 950, 952, + 954, 956, 958, 960, 962, 964, 966, 968, 970, 972, 974, 976, 978, 980, 982, + 984, 986, 988, 990, 992, 994, 996, 998, 1000, 1002, 1004, 1006, 1008, 1010, + 1012, 1014, 1016, 1018, 1020, 1022, 1024, 1026, 1028, 1030, 1032, 1034, + 1036, 1038, 1040, 1042, 1044, 1046, 1048, 1050, 1052, 1054, 1056, 1058, + 1060, 1062, 1064, 1066, 1068, 1070, 1072, 1074, 1076, 1078, 1080, 1082, + 1084, 1086, 1088, 1090, 1092, 1094, 1096, 1098, 1100, 1102, 1104, 1106, + 1108, 1110, 1112, 1114, 1116, 1118, 1120, 1122, 1124, 1126, 1128, 1130, + 1132, 1134, 1136, 1138, 1140, 1142, 1144, 1146, 1148, 1150, 1152, 1154, + 1156, 1158, 1160, 1162, 1164, 1166, 1168, 1170, 1172, 1174, 1176, 1178, + 1180, 1182, 1184, 1186, 1188, 1190, 1192, 1194, 1196, 1198, 1200, 1202, + 1204, 1206, 1208, 1210, 1212, 1214, 1216, 1218, 1220, 1222, 1224, 1226, + 1228, 1230, 1232, 1234, 1236, 1238, 1240, 1242, 1244, 1246, 1248, 1250, + 1252, 1254, 1256, 1258, 1260, 1262, 1264, 1266, 1268, 1270, 1272, 1274, + 1276, 1278, 1280, 1282, 1284, 1286, 1288, 1290, 1292, 1294, 1296, 1298, + 1300, 1302, 1304, 1306, 1308, 1310, 1312, 1314, 1316, 1318, 1320, 1322, + 1324, 1326, 1328, 1330, 1332, 1334, 1336, 1338, 1340, 1342, 1344, 1346, + 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362, 1364, 1366, 1368, 1370, + 1372, 1374, 1376, 1378, 1380, 1382, 1384, 1386, 1388, 1390, 1392, 1394, + 1396, 1398, 1400, 1402, 1404, 1406, 1408, 1410, 1412, 1414, 1416, 1418, + 1420, 1422, 1424, 1426, 1428, 1430, 1432, 1434, 1436, 1438, 1440, 1442, + 1444, 1446, 1448, 1450, 1452, 1454, 1456, 1458, 1460, 1462, 1464, 1466, + 1468, 1470, 1472, 1474, 1476, 1478, 1480, 1482, 1484, 1486, 1488, 1490, + 1492, 1494, 1496, 1498, 1500, 1502, 1504, 1506, 1508, 1510, 1512, 1514, + 1516, 1518, 1520, 1522, 1524, 1526, 1528, 1530, 1532, 1534, 1536, 1538, + 1540, 1542, 1544, 1546, 1548, 1550, 1552, 1554, 1556, 1558, 1560, 1562, + 1564, 1566, 1568, 1570, 1572, 1574, 1576, 1578, 1580, 1582, 1584, 1586, + 1588, 1590, 1592, 1594, 1596, 1598, 1600, 1602, 1604, 1606, 1608, 1610, + 1612, 1614, 1616, 1618, 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, + 0, 76, 2, 0, 195, 195, 357, 357, 2, 0, 66, 66, 311, 311, 2, 0, 99, 99, + 311, 311, 3, 0, 66, 66, 99, 99, 311, 311, 2, 0, 133, 133, 191, 191, 2, + 0, 245, 245, 325, 325, 2, 0, 10, 10, 94, 94, 2, 0, 162, 162, 356, 356, + 2, 0, 180, 180, 221, 221, 5, 0, 30, 30, 281, 281, 322, 322, 345, 345, 347, + 347, 2, 0, 150, 150, 308, 308, 2, 0, 64, 64, 94, 94, 2, 0, 345, 345, 347, + 347, 1, 0, 641, 642, 2, 0, 200, 200, 224, 224, 9, 0, 30, 30, 160, 160, + 165, 165, 179, 179, 219, 219, 227, 227, 335, 335, 338, 338, 440, 440, 3, + 0, 113, 113, 277, 277, 329, 329, 2, 0, 53, 53, 78, 78, 3, 0, 173, 173, + 252, 252, 255, 255, 5, 0, 30, 30, 88, 88, 182, 182, 232, 232, 362, 362, + 2, 0, 92, 92, 226, 226, 1, 0, 450, 451, 2, 0, 92, 92, 409, 409, 2, 0, 334, + 334, 409, 409, 2, 0, 211, 211, 289, 289, 3, 0, 314, 314, 350, 350, 447, + 447, 2, 0, 64, 64, 68, 68, 5, 0, 212, 212, 322, 322, 343, 343, 354, 354, + 457, 458, 2, 0, 37, 37, 55, 55, 2, 0, 10, 10, 53, 53, 3, 0, 211, 211, 289, + 289, 444, 444, 5, 0, 92, 92, 175, 175, 226, 226, 316, 316, 342, 342, 3, + 0, 175, 175, 316, 316, 342, 342, 3, 0, 109, 109, 128, 128, 344, 344, 4, + 0, 88, 88, 182, 182, 232, 232, 362, 362, 2, 0, 137, 137, 233, 233, 2, 0, + 349, 349, 373, 373, 2, 0, 151, 151, 245, 245, 2, 0, 306, 306, 326, 326, + 1, 0, 31, 32, 2, 0, 99, 99, 342, 342, 2, 0, 201, 201, 327, 327, 2, 0, 59, + 59, 97, 97, 2, 0, 213, 213, 245, 245, 2, 0, 30, 30, 56, 56, 2, 0, 313, + 313, 409, 409, 2, 0, 207, 207, 261, 261, 4, 0, 113, 113, 115, 115, 119, + 119, 126, 126, 2, 0, 353, 353, 479, 479, 2, 0, 385, 386, 400, 400, 1, 0, + 385, 386, 1, 0, 413, 414, 1, 0, 18, 19, 2, 0, 117, 117, 122, 122, 5, 0, + 10, 10, 16, 17, 21, 21, 23, 23, 25, 25, 1, 0, 12, 13, 3, 0, 9, 9, 14, 14, + 27, 27, 3, 0, 39, 39, 73, 73, 95, 95, 2, 0, 166, 166, 188, 188, 2, 0, 297, + 297, 452, 452, 2, 0, 208, 208, 282, 282, 3, 0, 30, 30, 34, 34, 90, 90, + 6, 0, 9, 10, 12, 17, 21, 21, 23, 23, 25, 25, 27, 27, 2, 0, 20, 20, 22, + 22, 1, 0, 485, 488, 12, 0, 124, 124, 129, 249, 251, 252, 254, 303, 305, + 380, 405, 405, 435, 454, 457, 471, 473, 473, 475, 475, 477, 477, 480, 490, + 5, 0, 106, 118, 120, 123, 125, 125, 127, 128, 474, 474, 4, 0, 30, 52, 54, + 70, 72, 105, 456, 456, 5, 0, 304, 304, 420, 426, 506, 506, 515, 515, 523, + 637, 2, 0, 62, 62, 116, 116, 2, 0, 10, 10, 20, 20, 2, 0, 436, 436, 503, + 503, 2, 0, 167, 167, 509, 509, 1, 0, 514, 519, 2, 0, 144, 144, 210, 210, + 36, 0, 33, 33, 35, 35, 43, 45, 53, 53, 57, 57, 61, 61, 92, 92, 116, 116, + 123, 123, 130, 130, 144, 144, 153, 153, 157, 157, 161, 161, 167, 167, 172, + 172, 207, 207, 210, 210, 232, 232, 240, 240, 258, 258, 261, 262, 272, 272, + 286, 286, 300, 300, 306, 306, 312, 312, 316, 317, 326, 326, 353, 353, 435, + 436, 479, 479, 492, 504, 508, 514, 516, 520, 522, 522, 12479, 0, 1636, + 1, 0, 0, 0, 2, 1639, 1, 0, 0, 0, 4, 1641, 1, 0, 0, 0, 6, 1649, 1, 0, 0, + 0, 8, 1777, 1, 0, 0, 0, 10, 1779, 1, 0, 0, 0, 12, 1783, 1, 0, 0, 0, 14, + 1786, 1, 0, 0, 0, 16, 1794, 1, 0, 0, 0, 18, 1799, 1, 0, 0, 0, 20, 1805, + 1, 0, 0, 0, 22, 1826, 1, 0, 0, 0, 24, 1838, 1, 0, 0, 0, 26, 1840, 1, 0, + 0, 0, 28, 1848, 1, 0, 0, 0, 30, 1856, 1, 0, 0, 0, 32, 1860, 1, 0, 0, 0, + 34, 1871, 1, 0, 0, 0, 36, 1879, 1, 0, 0, 0, 38, 1887, 1, 0, 0, 0, 40, 1894, + 1, 0, 0, 0, 42, 1896, 1, 0, 0, 0, 44, 1913, 1, 0, 0, 0, 46, 1918, 1, 0, + 0, 0, 48, 1927, 1, 0, 0, 0, 50, 1929, 1, 0, 0, 0, 52, 1943, 1, 0, 0, 0, + 54, 1945, 1, 0, 0, 0, 56, 1976, 1, 0, 0, 0, 58, 1978, 1, 0, 0, 0, 60, 1986, + 1, 0, 0, 0, 62, 1996, 1, 0, 0, 0, 64, 2003, 1, 0, 0, 0, 66, 2009, 1, 0, + 0, 0, 68, 2027, 1, 0, 0, 0, 70, 2031, 1, 0, 0, 0, 72, 2035, 1, 0, 0, 0, + 74, 2037, 1, 0, 0, 0, 76, 2048, 1, 0, 0, 0, 78, 2052, 1, 0, 0, 0, 80, 2057, + 1, 0, 0, 0, 82, 2062, 1, 0, 0, 0, 84, 2064, 1, 0, 0, 0, 86, 2076, 1, 0, + 0, 0, 88, 2083, 1, 0, 0, 0, 90, 2085, 1, 0, 0, 0, 92, 2087, 1, 0, 0, 0, + 94, 2089, 1, 0, 0, 0, 96, 2204, 1, 0, 0, 0, 98, 2206, 1, 0, 0, 0, 100, + 2222, 1, 0, 0, 0, 102, 2224, 1, 0, 0, 0, 104, 2530, 1, 0, 0, 0, 106, 2537, + 1, 0, 0, 0, 108, 2539, 1, 0, 0, 0, 110, 2541, 1, 0, 0, 0, 112, 2544, 1, + 0, 0, 0, 114, 2553, 1, 0, 0, 0, 116, 2555, 1, 0, 0, 0, 118, 2559, 1, 0, + 0, 0, 120, 2562, 1, 0, 0, 0, 122, 2570, 1, 0, 0, 0, 124, 2582, 1, 0, 0, + 0, 126, 2599, 1, 0, 0, 0, 128, 2627, 1, 0, 0, 0, 130, 2629, 1, 0, 0, 0, + 132, 2632, 1, 0, 0, 0, 134, 2640, 1, 0, 0, 0, 136, 2645, 1, 0, 0, 0, 138, + 2683, 1, 0, 0, 0, 140, 2685, 1, 0, 0, 0, 142, 2727, 1, 0, 0, 0, 144, 2729, + 1, 0, 0, 0, 146, 2731, 1, 0, 0, 0, 148, 2736, 1, 0, 0, 0, 150, 2743, 1, + 0, 0, 0, 152, 2748, 1, 0, 0, 0, 154, 2790, 1, 0, 0, 0, 156, 2792, 1, 0, + 0, 0, 158, 2795, 1, 0, 0, 0, 160, 2800, 1, 0, 0, 0, 162, 2802, 1, 0, 0, + 0, 164, 2810, 1, 0, 0, 0, 166, 2821, 1, 0, 0, 0, 168, 2823, 1, 0, 0, 0, + 170, 2831, 1, 0, 0, 0, 172, 2833, 1, 0, 0, 0, 174, 2918, 1, 0, 0, 0, 176, + 2920, 1, 0, 0, 0, 178, 2922, 1, 0, 0, 0, 180, 2926, 1, 0, 0, 0, 182, 2934, + 1, 0, 0, 0, 184, 2945, 1, 0, 0, 0, 186, 2949, 1, 0, 0, 0, 188, 2970, 1, + 0, 0, 0, 190, 2998, 1, 0, 0, 0, 192, 3000, 1, 0, 0, 0, 194, 3010, 1, 0, + 0, 0, 196, 3021, 1, 0, 0, 0, 198, 3078, 1, 0, 0, 0, 200, 3080, 1, 0, 0, + 0, 202, 3089, 1, 0, 0, 0, 204, 3096, 1, 0, 0, 0, 206, 3098, 1, 0, 0, 0, + 208, 3106, 1, 0, 0, 0, 210, 3109, 1, 0, 0, 0, 212, 3116, 1, 0, 0, 0, 214, + 3207, 1, 0, 0, 0, 216, 3209, 1, 0, 0, 0, 218, 3212, 1, 0, 0, 0, 220, 3216, + 1, 0, 0, 0, 222, 3224, 1, 0, 0, 0, 224, 3226, 1, 0, 0, 0, 226, 3231, 1, + 0, 0, 0, 228, 3234, 1, 0, 0, 0, 230, 3242, 1, 0, 0, 0, 232, 3252, 1, 0, + 0, 0, 234, 3265, 1, 0, 0, 0, 236, 3267, 1, 0, 0, 0, 238, 3271, 1, 0, 0, + 0, 240, 3284, 1, 0, 0, 0, 242, 3286, 1, 0, 0, 0, 244, 3291, 1, 0, 0, 0, + 246, 3293, 1, 0, 0, 0, 248, 3300, 1, 0, 0, 0, 250, 3331, 1, 0, 0, 0, 252, + 3333, 1, 0, 0, 0, 254, 3340, 1, 0, 0, 0, 256, 3342, 1, 0, 0, 0, 258, 3351, + 1, 0, 0, 0, 260, 3354, 1, 0, 0, 0, 262, 3359, 1, 0, 0, 0, 264, 3363, 1, + 0, 0, 0, 266, 3379, 1, 0, 0, 0, 268, 3390, 1, 0, 0, 0, 270, 3406, 1, 0, + 0, 0, 272, 3422, 1, 0, 0, 0, 274, 3428, 1, 0, 0, 0, 276, 3445, 1, 0, 0, + 0, 278, 3458, 1, 0, 0, 0, 280, 3460, 1, 0, 0, 0, 282, 3470, 1, 0, 0, 0, + 284, 3484, 1, 0, 0, 0, 286, 3493, 1, 0, 0, 0, 288, 3495, 1, 0, 0, 0, 290, + 3500, 1, 0, 0, 0, 292, 3540, 1, 0, 0, 0, 294, 3542, 1, 0, 0, 0, 296, 3550, + 1, 0, 0, 0, 298, 3552, 1, 0, 0, 0, 300, 3560, 1, 0, 0, 0, 302, 3582, 1, + 0, 0, 0, 304, 3584, 1, 0, 0, 0, 306, 3588, 1, 0, 0, 0, 308, 3595, 1, 0, + 0, 0, 310, 3597, 1, 0, 0, 0, 312, 3599, 1, 0, 0, 0, 314, 3601, 1, 0, 0, + 0, 316, 3612, 1, 0, 0, 0, 318, 3615, 1, 0, 0, 0, 320, 3623, 1, 0, 0, 0, + 322, 3639, 1, 0, 0, 0, 324, 3649, 1, 0, 0, 0, 326, 3651, 1, 0, 0, 0, 328, + 3660, 1, 0, 0, 0, 330, 3663, 1, 0, 0, 0, 332, 3770, 1, 0, 0, 0, 334, 3772, + 1, 0, 0, 0, 336, 3791, 1, 0, 0, 0, 338, 3794, 1, 0, 0, 0, 340, 3798, 1, + 0, 0, 0, 342, 3817, 1, 0, 0, 0, 344, 3819, 1, 0, 0, 0, 346, 3824, 1, 0, + 0, 0, 348, 3832, 1, 0, 0, 0, 350, 3837, 1, 0, 0, 0, 352, 3852, 1, 0, 0, + 0, 354, 3854, 1, 0, 0, 0, 356, 3857, 1, 0, 0, 0, 358, 3859, 1, 0, 0, 0, + 360, 3896, 1, 0, 0, 0, 362, 3898, 1, 0, 0, 0, 364, 3901, 1, 0, 0, 0, 366, + 3906, 1, 0, 0, 0, 368, 3908, 1, 0, 0, 0, 370, 3990, 1, 0, 0, 0, 372, 3992, + 1, 0, 0, 0, 374, 4010, 1, 0, 0, 0, 376, 4012, 1, 0, 0, 0, 378, 4040, 1, + 0, 0, 0, 380, 4044, 1, 0, 0, 0, 382, 4064, 1, 0, 0, 0, 384, 4066, 1, 0, + 0, 0, 386, 4075, 1, 0, 0, 0, 388, 4095, 1, 0, 0, 0, 390, 4109, 1, 0, 0, + 0, 392, 4114, 1, 0, 0, 0, 394, 4120, 1, 0, 0, 0, 396, 4123, 1, 0, 0, 0, + 398, 4126, 1, 0, 0, 0, 400, 4129, 1, 0, 0, 0, 402, 4132, 1, 0, 0, 0, 404, + 4134, 1, 0, 0, 0, 406, 4143, 1, 0, 0, 0, 408, 4193, 1, 0, 0, 0, 410, 4199, + 1, 0, 0, 0, 412, 4201, 1, 0, 0, 0, 414, 4216, 1, 0, 0, 0, 416, 4218, 1, + 0, 0, 0, 418, 4222, 1, 0, 0, 0, 420, 4226, 1, 0, 0, 0, 422, 4233, 1, 0, + 0, 0, 424, 4235, 1, 0, 0, 0, 426, 4237, 1, 0, 0, 0, 428, 4239, 1, 0, 0, + 0, 430, 4245, 1, 0, 0, 0, 432, 4247, 1, 0, 0, 0, 434, 4249, 1, 0, 0, 0, + 436, 4254, 1, 0, 0, 0, 438, 4258, 1, 0, 0, 0, 440, 4271, 1, 0, 0, 0, 442, + 4273, 1, 0, 0, 0, 444, 4279, 1, 0, 0, 0, 446, 4293, 1, 0, 0, 0, 448, 4321, + 1, 0, 0, 0, 450, 4323, 1, 0, 0, 0, 452, 4331, 1, 0, 0, 0, 454, 4337, 1, + 0, 0, 0, 456, 4345, 1, 0, 0, 0, 458, 4357, 1, 0, 0, 0, 460, 4359, 1, 0, + 0, 0, 462, 4482, 1, 0, 0, 0, 464, 4484, 1, 0, 0, 0, 466, 4488, 1, 0, 0, + 0, 468, 4496, 1, 0, 0, 0, 470, 4507, 1, 0, 0, 0, 472, 4509, 1, 0, 0, 0, + 474, 4513, 1, 0, 0, 0, 476, 4521, 1, 0, 0, 0, 478, 4525, 1, 0, 0, 0, 480, + 4527, 1, 0, 0, 0, 482, 4578, 1, 0, 0, 0, 484, 4580, 1, 0, 0, 0, 486, 4584, + 1, 0, 0, 0, 488, 4602, 1, 0, 0, 0, 490, 4641, 1, 0, 0, 0, 492, 4643, 1, + 0, 0, 0, 494, 4645, 1, 0, 0, 0, 496, 4654, 1, 0, 0, 0, 498, 4656, 1, 0, + 0, 0, 500, 4658, 1, 0, 0, 0, 502, 4683, 1, 0, 0, 0, 504, 4685, 1, 0, 0, + 0, 506, 4705, 1, 0, 0, 0, 508, 4727, 1, 0, 0, 0, 510, 4749, 1, 0, 0, 0, + 512, 4751, 1, 0, 0, 0, 514, 4758, 1, 0, 0, 0, 516, 4855, 1, 0, 0, 0, 518, + 4880, 1, 0, 0, 0, 520, 4887, 1, 0, 0, 0, 522, 4904, 1, 0, 0, 0, 524, 4906, + 1, 0, 0, 0, 526, 4908, 1, 0, 0, 0, 528, 4916, 1, 0, 0, 0, 530, 4922, 1, + 0, 0, 0, 532, 4926, 1, 0, 0, 0, 534, 4934, 1, 0, 0, 0, 536, 4949, 1, 0, + 0, 0, 538, 5098, 1, 0, 0, 0, 540, 5102, 1, 0, 0, 0, 542, 5215, 1, 0, 0, + 0, 544, 5217, 1, 0, 0, 0, 546, 5222, 1, 0, 0, 0, 548, 5228, 1, 0, 0, 0, + 550, 5315, 1, 0, 0, 0, 552, 5317, 1, 0, 0, 0, 554, 5319, 1, 0, 0, 0, 556, + 5321, 1, 0, 0, 0, 558, 5351, 1, 0, 0, 0, 560, 5368, 1, 0, 0, 0, 562, 5370, + 1, 0, 0, 0, 564, 5396, 1, 0, 0, 0, 566, 5458, 1, 0, 0, 0, 568, 5460, 1, + 0, 0, 0, 570, 5468, 1, 0, 0, 0, 572, 5473, 1, 0, 0, 0, 574, 5484, 1, 0, + 0, 0, 576, 5486, 1, 0, 0, 0, 578, 5490, 1, 0, 0, 0, 580, 5523, 1, 0, 0, + 0, 582, 5525, 1, 0, 0, 0, 584, 5529, 1, 0, 0, 0, 586, 5533, 1, 0, 0, 0, + 588, 5542, 1, 0, 0, 0, 590, 5554, 1, 0, 0, 0, 592, 5586, 1, 0, 0, 0, 594, + 5588, 1, 0, 0, 0, 596, 5590, 1, 0, 0, 0, 598, 5629, 1, 0, 0, 0, 600, 5631, + 1, 0, 0, 0, 602, 5633, 1, 0, 0, 0, 604, 5635, 1, 0, 0, 0, 606, 5638, 1, + 0, 0, 0, 608, 5669, 1, 0, 0, 0, 610, 5682, 1, 0, 0, 0, 612, 5684, 1, 0, + 0, 0, 614, 5689, 1, 0, 0, 0, 616, 5697, 1, 0, 0, 0, 618, 5700, 1, 0, 0, + 0, 620, 5702, 1, 0, 0, 0, 622, 5708, 1, 0, 0, 0, 624, 5710, 1, 0, 0, 0, + 626, 5730, 1, 0, 0, 0, 628, 5733, 1, 0, 0, 0, 630, 5739, 1, 0, 0, 0, 632, + 5747, 1, 0, 0, 0, 634, 5763, 1, 0, 0, 0, 636, 5765, 1, 0, 0, 0, 638, 5771, + 1, 0, 0, 0, 640, 5792, 1, 0, 0, 0, 642, 5801, 1, 0, 0, 0, 644, 5807, 1, + 0, 0, 0, 646, 5809, 1, 0, 0, 0, 648, 5825, 1, 0, 0, 0, 650, 5827, 1, 0, + 0, 0, 652, 5832, 1, 0, 0, 0, 654, 5834, 1, 0, 0, 0, 656, 5849, 1, 0, 0, + 0, 658, 5857, 1, 0, 0, 0, 660, 5860, 1, 0, 0, 0, 662, 5869, 1, 0, 0, 0, + 664, 5910, 1, 0, 0, 0, 666, 5925, 1, 0, 0, 0, 668, 5932, 1, 0, 0, 0, 670, + 5934, 1, 0, 0, 0, 672, 5946, 1, 0, 0, 0, 674, 5949, 1, 0, 0, 0, 676, 5952, + 1, 0, 0, 0, 678, 5960, 1, 0, 0, 0, 680, 5968, 1, 0, 0, 0, 682, 5972, 1, + 0, 0, 0, 684, 6016, 1, 0, 0, 0, 686, 6032, 1, 0, 0, 0, 688, 6048, 1, 0, + 0, 0, 690, 6072, 1, 0, 0, 0, 692, 6079, 1, 0, 0, 0, 694, 6084, 1, 0, 0, + 0, 696, 6092, 1, 0, 0, 0, 698, 6095, 1, 0, 0, 0, 700, 6099, 1, 0, 0, 0, + 702, 6106, 1, 0, 0, 0, 704, 6145, 1, 0, 0, 0, 706, 6151, 1, 0, 0, 0, 708, + 6153, 1, 0, 0, 0, 710, 6166, 1, 0, 0, 0, 712, 6169, 1, 0, 0, 0, 714, 6216, + 1, 0, 0, 0, 716, 6218, 1, 0, 0, 0, 718, 6264, 1, 0, 0, 0, 720, 6266, 1, + 0, 0, 0, 722, 6268, 1, 0, 0, 0, 724, 6270, 1, 0, 0, 0, 726, 6278, 1, 0, + 0, 0, 728, 6292, 1, 0, 0, 0, 730, 6781, 1, 0, 0, 0, 732, 6783, 1, 0, 0, + 0, 734, 6785, 1, 0, 0, 0, 736, 6857, 1, 0, 0, 0, 738, 6859, 1, 0, 0, 0, + 740, 7078, 1, 0, 0, 0, 742, 7080, 1, 0, 0, 0, 744, 7088, 1, 0, 0, 0, 746, + 7104, 1, 0, 0, 0, 748, 7111, 1, 0, 0, 0, 750, 7113, 1, 0, 0, 0, 752, 7306, + 1, 0, 0, 0, 754, 7331, 1, 0, 0, 0, 756, 7333, 1, 0, 0, 0, 758, 7379, 1, + 0, 0, 0, 760, 7381, 1, 0, 0, 0, 762, 7410, 1, 0, 0, 0, 764, 7412, 1, 0, + 0, 0, 766, 7422, 1, 0, 0, 0, 768, 7430, 1, 0, 0, 0, 770, 7477, 1, 0, 0, + 0, 772, 7493, 1, 0, 0, 0, 774, 7495, 1, 0, 0, 0, 776, 7521, 1, 0, 0, 0, + 778, 7524, 1, 0, 0, 0, 780, 7540, 1, 0, 0, 0, 782, 7542, 1, 0, 0, 0, 784, + 7544, 1, 0, 0, 0, 786, 7546, 1, 0, 0, 0, 788, 7548, 1, 0, 0, 0, 790, 7553, + 1, 0, 0, 0, 792, 7556, 1, 0, 0, 0, 794, 7563, 1, 0, 0, 0, 796, 7634, 1, + 0, 0, 0, 798, 7636, 1, 0, 0, 0, 800, 7648, 1, 0, 0, 0, 802, 7650, 1, 0, + 0, 0, 804, 7660, 1, 0, 0, 0, 806, 7662, 1, 0, 0, 0, 808, 7668, 1, 0, 0, + 0, 810, 7700, 1, 0, 0, 0, 812, 7707, 1, 0, 0, 0, 814, 7710, 1, 0, 0, 0, + 816, 7719, 1, 0, 0, 0, 818, 7722, 1, 0, 0, 0, 820, 7726, 1, 0, 0, 0, 822, + 7743, 1, 0, 0, 0, 824, 7745, 1, 0, 0, 0, 826, 7747, 1, 0, 0, 0, 828, 7765, + 1, 0, 0, 0, 830, 7770, 1, 0, 0, 0, 832, 7786, 1, 0, 0, 0, 834, 7794, 1, + 0, 0, 0, 836, 7796, 1, 0, 0, 0, 838, 7802, 1, 0, 0, 0, 840, 7807, 1, 0, + 0, 0, 842, 7816, 1, 0, 0, 0, 844, 7843, 1, 0, 0, 0, 846, 7845, 1, 0, 0, + 0, 848, 7924, 1, 0, 0, 0, 850, 7926, 1, 0, 0, 0, 852, 7928, 1, 0, 0, 0, + 854, 7961, 1, 0, 0, 0, 856, 7963, 1, 0, 0, 0, 858, 7989, 1, 0, 0, 0, 860, + 8005, 1, 0, 0, 0, 862, 8007, 1, 0, 0, 0, 864, 8015, 1, 0, 0, 0, 866, 8017, + 1, 0, 0, 0, 868, 8023, 1, 0, 0, 0, 870, 8027, 1, 0, 0, 0, 872, 8029, 1, + 0, 0, 0, 874, 8031, 1, 0, 0, 0, 876, 8033, 1, 0, 0, 0, 878, 8035, 1, 0, + 0, 0, 880, 8037, 1, 0, 0, 0, 882, 8041, 1, 0, 0, 0, 884, 8045, 1, 0, 0, + 0, 886, 8053, 1, 0, 0, 0, 888, 8073, 1, 0, 0, 0, 890, 8084, 1, 0, 0, 0, + 892, 8086, 1, 0, 0, 0, 894, 8094, 1, 0, 0, 0, 896, 8100, 1, 0, 0, 0, 898, + 8104, 1, 0, 0, 0, 900, 8106, 1, 0, 0, 0, 902, 8114, 1, 0, 0, 0, 904, 8123, + 1, 0, 0, 0, 906, 8163, 1, 0, 0, 0, 908, 8165, 1, 0, 0, 0, 910, 8179, 1, + 0, 0, 0, 912, 8182, 1, 0, 0, 0, 914, 8194, 1, 0, 0, 0, 916, 8218, 1, 0, + 0, 0, 918, 8220, 1, 0, 0, 0, 920, 8222, 1, 0, 0, 0, 922, 8230, 1, 0, 0, + 0, 924, 8233, 1, 0, 0, 0, 926, 8257, 1, 0, 0, 0, 928, 8259, 1, 0, 0, 0, + 930, 8263, 1, 0, 0, 0, 932, 8297, 1, 0, 0, 0, 934, 8316, 1, 0, 0, 0, 936, + 8329, 1, 0, 0, 0, 938, 8337, 1, 0, 0, 0, 940, 8351, 1, 0, 0, 0, 942, 8354, + 1, 0, 0, 0, 944, 8365, 1, 0, 0, 0, 946, 8381, 1, 0, 0, 0, 948, 8383, 1, + 0, 0, 0, 950, 8388, 1, 0, 0, 0, 952, 8391, 1, 0, 0, 0, 954, 8406, 1, 0, + 0, 0, 956, 8424, 1, 0, 0, 0, 958, 8426, 1, 0, 0, 0, 960, 8429, 1, 0, 0, + 0, 962, 8437, 1, 0, 0, 0, 964, 8447, 1, 0, 0, 0, 966, 8456, 1, 0, 0, 0, + 968, 8463, 1, 0, 0, 0, 970, 8467, 1, 0, 0, 0, 972, 8477, 1, 0, 0, 0, 974, + 8508, 1, 0, 0, 0, 976, 8510, 1, 0, 0, 0, 978, 8521, 1, 0, 0, 0, 980, 8569, + 1, 0, 0, 0, 982, 8571, 1, 0, 0, 0, 984, 8577, 1, 0, 0, 0, 986, 8585, 1, + 0, 0, 0, 988, 8600, 1, 0, 0, 0, 990, 8602, 1, 0, 0, 0, 992, 8604, 1, 0, + 0, 0, 994, 8612, 1, 0, 0, 0, 996, 8630, 1, 0, 0, 0, 998, 8632, 1, 0, 0, + 0, 1000, 8634, 1, 0, 0, 0, 1002, 8636, 1, 0, 0, 0, 1004, 8644, 1, 0, 0, + 0, 1006, 8646, 1, 0, 0, 0, 1008, 8648, 1, 0, 0, 0, 1010, 8652, 1, 0, 0, + 0, 1012, 8660, 1, 0, 0, 0, 1014, 8679, 1, 0, 0, 0, 1016, 8681, 1, 0, 0, + 0, 1018, 8706, 1, 0, 0, 0, 1020, 8708, 1, 0, 0, 0, 1022, 8717, 1, 0, 0, + 0, 1024, 8719, 1, 0, 0, 0, 1026, 8726, 1, 0, 0, 0, 1028, 8730, 1, 0, 0, + 0, 1030, 8732, 1, 0, 0, 0, 1032, 8734, 1, 0, 0, 0, 1034, 8736, 1, 0, 0, + 0, 1036, 8740, 1, 0, 0, 0, 1038, 8753, 1, 0, 0, 0, 1040, 8755, 1, 0, 0, + 0, 1042, 8758, 1, 0, 0, 0, 1044, 8763, 1, 0, 0, 0, 1046, 8768, 1, 0, 0, + 0, 1048, 8774, 1, 0, 0, 0, 1050, 8781, 1, 0, 0, 0, 1052, 8783, 1, 0, 0, + 0, 1054, 8786, 1, 0, 0, 0, 1056, 8790, 1, 0, 0, 0, 1058, 8797, 1, 0, 0, + 0, 1060, 8809, 1, 0, 0, 0, 1062, 8812, 1, 0, 0, 0, 1064, 8826, 1, 0, 0, + 0, 1066, 8829, 1, 0, 0, 0, 1068, 8895, 1, 0, 0, 0, 1070, 8919, 1, 0, 0, + 0, 1072, 8922, 1, 0, 0, 0, 1074, 8931, 1, 0, 0, 0, 1076, 8934, 1, 0, 0, + 0, 1078, 8955, 1, 0, 0, 0, 1080, 8957, 1, 0, 0, 0, 1082, 8968, 1, 0, 0, + 0, 1084, 8982, 1, 0, 0, 0, 1086, 8984, 1, 0, 0, 0, 1088, 8992, 1, 0, 0, + 0, 1090, 8999, 1, 0, 0, 0, 1092, 9007, 1, 0, 0, 0, 1094, 9024, 1, 0, 0, + 0, 1096, 9026, 1, 0, 0, 0, 1098, 9030, 1, 0, 0, 0, 1100, 9038, 1, 0, 0, + 0, 1102, 9043, 1, 0, 0, 0, 1104, 9046, 1, 0, 0, 0, 1106, 9049, 1, 0, 0, + 0, 1108, 9056, 1, 0, 0, 0, 1110, 9058, 1, 0, 0, 0, 1112, 9066, 1, 0, 0, + 0, 1114, 9071, 1, 0, 0, 0, 1116, 9092, 1, 0, 0, 0, 1118, 9100, 1, 0, 0, + 0, 1120, 9110, 1, 0, 0, 0, 1122, 9122, 1, 0, 0, 0, 1124, 9124, 1, 0, 0, + 0, 1126, 9138, 1, 0, 0, 0, 1128, 9158, 1, 0, 0, 0, 1130, 9167, 1, 0, 0, + 0, 1132, 9185, 1, 0, 0, 0, 1134, 9191, 1, 0, 0, 0, 1136, 9197, 1, 0, 0, + 0, 1138, 9205, 1, 0, 0, 0, 1140, 9233, 1, 0, 0, 0, 1142, 9235, 1, 0, 0, + 0, 1144, 9241, 1, 0, 0, 0, 1146, 9245, 1, 0, 0, 0, 1148, 9247, 1, 0, 0, + 0, 1150, 9255, 1, 0, 0, 0, 1152, 9259, 1, 0, 0, 0, 1154, 9266, 1, 0, 0, + 0, 1156, 9283, 1, 0, 0, 0, 1158, 9285, 1, 0, 0, 0, 1160, 9287, 1, 0, 0, + 0, 1162, 9297, 1, 0, 0, 0, 1164, 9305, 1, 0, 0, 0, 1166, 9332, 1, 0, 0, + 0, 1168, 9334, 1, 0, 0, 0, 1170, 9341, 1, 0, 0, 0, 1172, 9344, 1, 0, 0, + 0, 1174, 9346, 1, 0, 0, 0, 1176, 9350, 1, 0, 0, 0, 1178, 9358, 1, 0, 0, + 0, 1180, 9366, 1, 0, 0, 0, 1182, 9374, 1, 0, 0, 0, 1184, 9388, 1, 0, 0, + 0, 1186, 9397, 1, 0, 0, 0, 1188, 9401, 1, 0, 0, 0, 1190, 9405, 1, 0, 0, + 0, 1192, 9431, 1, 0, 0, 0, 1194, 9445, 1, 0, 0, 0, 1196, 9461, 1, 0, 0, + 0, 1198, 9471, 1, 0, 0, 0, 1200, 9475, 1, 0, 0, 0, 1202, 9483, 1, 0, 0, + 0, 1204, 9491, 1, 0, 0, 0, 1206, 9497, 1, 0, 0, 0, 1208, 9501, 1, 0, 0, + 0, 1210, 9508, 1, 0, 0, 0, 1212, 9513, 1, 0, 0, 0, 1214, 9528, 1, 0, 0, + 0, 1216, 9608, 1, 0, 0, 0, 1218, 9610, 1, 0, 0, 0, 1220, 9612, 1, 0, 0, + 0, 1222, 9650, 1, 0, 0, 0, 1224, 9654, 1, 0, 0, 0, 1226, 9839, 1, 0, 0, + 0, 1228, 9846, 1, 0, 0, 0, 1230, 9858, 1, 0, 0, 0, 1232, 9860, 1, 0, 0, + 0, 1234, 9865, 1, 0, 0, 0, 1236, 9873, 1, 0, 0, 0, 1238, 9878, 1, 0, 0, + 0, 1240, 9884, 1, 0, 0, 0, 1242, 9901, 1, 0, 0, 0, 1244, 9903, 1, 0, 0, + 0, 1246, 9906, 1, 0, 0, 0, 1248, 9912, 1, 0, 0, 0, 1250, 9918, 1, 0, 0, + 0, 1252, 9921, 1, 0, 0, 0, 1254, 9929, 1, 0, 0, 0, 1256, 9933, 1, 0, 0, + 0, 1258, 9938, 1, 0, 0, 0, 1260, 9953, 1, 0, 0, 0, 1262, 9955, 1, 0, 0, + 0, 1264, 9974, 1, 0, 0, 0, 1266, 9982, 1, 0, 0, 0, 1268, 9991, 1, 0, 0, + 0, 1270, 9993, 1, 0, 0, 0, 1272, 10014, 1, 0, 0, 0, 1274, 10016, 1, 0, + 0, 0, 1276, 10023, 1, 0, 0, 0, 1278, 10029, 1, 0, 0, 0, 1280, 10033, 1, + 0, 0, 0, 1282, 10035, 1, 0, 0, 0, 1284, 10043, 1, 0, 0, 0, 1286, 10051, + 1, 0, 0, 0, 1288, 10065, 1, 0, 0, 0, 1290, 10067, 1, 0, 0, 0, 1292, 10075, + 1, 0, 0, 0, 1294, 10088, 1, 0, 0, 0, 1296, 10090, 1, 0, 0, 0, 1298, 10098, + 1, 0, 0, 0, 1300, 10105, 1, 0, 0, 0, 1302, 10113, 1, 0, 0, 0, 1304, 10125, + 1, 0, 0, 0, 1306, 10127, 1, 0, 0, 0, 1308, 10129, 1, 0, 0, 0, 1310, 10138, + 1, 0, 0, 0, 1312, 10169, 1, 0, 0, 0, 1314, 10178, 1, 0, 0, 0, 1316, 10185, + 1, 0, 0, 0, 1318, 10187, 1, 0, 0, 0, 1320, 10198, 1, 0, 0, 0, 1322, 10202, + 1, 0, 0, 0, 1324, 10207, 1, 0, 0, 0, 1326, 10210, 1, 0, 0, 0, 1328, 10212, + 1, 0, 0, 0, 1330, 10233, 1, 0, 0, 0, 1332, 10235, 1, 0, 0, 0, 1334, 10238, + 1, 0, 0, 0, 1336, 10245, 1, 0, 0, 0, 1338, 10248, 1, 0, 0, 0, 1340, 10250, + 1, 0, 0, 0, 1342, 10263, 1, 0, 0, 0, 1344, 10268, 1, 0, 0, 0, 1346, 10270, + 1, 0, 0, 0, 1348, 10278, 1, 0, 0, 0, 1350, 10282, 1, 0, 0, 0, 1352, 10290, + 1, 0, 0, 0, 1354, 10292, 1, 0, 0, 0, 1356, 10294, 1, 0, 0, 0, 1358, 10303, + 1, 0, 0, 0, 1360, 10340, 1, 0, 0, 0, 1362, 10342, 1, 0, 0, 0, 1364, 10344, + 1, 0, 0, 0, 1366, 10346, 1, 0, 0, 0, 1368, 10348, 1, 0, 0, 0, 1370, 10350, + 1, 0, 0, 0, 1372, 10365, 1, 0, 0, 0, 1374, 10367, 1, 0, 0, 0, 1376, 10375, + 1, 0, 0, 0, 1378, 10377, 1, 0, 0, 0, 1380, 10382, 1, 0, 0, 0, 1382, 10384, + 1, 0, 0, 0, 1384, 10398, 1, 0, 0, 0, 1386, 10404, 1, 0, 0, 0, 1388, 10410, + 1, 0, 0, 0, 1390, 10416, 1, 0, 0, 0, 1392, 10424, 1, 0, 0, 0, 1394, 10435, + 1, 0, 0, 0, 1396, 10437, 1, 0, 0, 0, 1398, 10439, 1, 0, 0, 0, 1400, 10493, + 1, 0, 0, 0, 1402, 10495, 1, 0, 0, 0, 1404, 10497, 1, 0, 0, 0, 1406, 10499, + 1, 0, 0, 0, 1408, 10501, 1, 0, 0, 0, 1410, 10509, 1, 0, 0, 0, 1412, 10532, + 1, 0, 0, 0, 1414, 10534, 1, 0, 0, 0, 1416, 10540, 1, 0, 0, 0, 1418, 10542, + 1, 0, 0, 0, 1420, 10544, 1, 0, 0, 0, 1422, 10555, 1, 0, 0, 0, 1424, 10563, + 1, 0, 0, 0, 1426, 10566, 1, 0, 0, 0, 1428, 10570, 1, 0, 0, 0, 1430, 10577, + 1, 0, 0, 0, 1432, 10579, 1, 0, 0, 0, 1434, 10613, 1, 0, 0, 0, 1436, 10615, + 1, 0, 0, 0, 1438, 10617, 1, 0, 0, 0, 1440, 10621, 1, 0, 0, 0, 1442, 10629, + 1, 0, 0, 0, 1444, 10632, 1, 0, 0, 0, 1446, 10636, 1, 0, 0, 0, 1448, 10638, + 1, 0, 0, 0, 1450, 10640, 1, 0, 0, 0, 1452, 10642, 1, 0, 0, 0, 1454, 10644, + 1, 0, 0, 0, 1456, 10647, 1, 0, 0, 0, 1458, 10650, 1, 0, 0, 0, 1460, 10655, + 1, 0, 0, 0, 1462, 10657, 1, 0, 0, 0, 1464, 10662, 1, 0, 0, 0, 1466, 10692, + 1, 0, 0, 0, 1468, 10694, 1, 0, 0, 0, 1470, 10716, 1, 0, 0, 0, 1472, 10718, + 1, 0, 0, 0, 1474, 10720, 1, 0, 0, 0, 1476, 10725, 1, 0, 0, 0, 1478, 10733, + 1, 0, 0, 0, 1480, 10735, 1, 0, 0, 0, 1482, 10743, 1, 0, 0, 0, 1484, 10747, + 1, 0, 0, 0, 1486, 10749, 1, 0, 0, 0, 1488, 10753, 1, 0, 0, 0, 1490, 10764, + 1, 0, 0, 0, 1492, 10783, 1, 0, 0, 0, 1494, 10786, 1, 0, 0, 0, 1496, 10789, + 1, 0, 0, 0, 1498, 10801, 1, 0, 0, 0, 1500, 10804, 1, 0, 0, 0, 1502, 10808, + 1, 0, 0, 0, 1504, 10813, 1, 0, 0, 0, 1506, 10817, 1, 0, 0, 0, 1508, 10822, + 1, 0, 0, 0, 1510, 10829, 1, 0, 0, 0, 1512, 10835, 1, 0, 0, 0, 1514, 10859, + 1, 0, 0, 0, 1516, 10862, 1, 0, 0, 0, 1518, 10873, 1, 0, 0, 0, 1520, 10875, + 1, 0, 0, 0, 1522, 10878, 1, 0, 0, 0, 1524, 10881, 1, 0, 0, 0, 1526, 10893, + 1, 0, 0, 0, 1528, 10896, 1, 0, 0, 0, 1530, 10905, 1, 0, 0, 0, 1532, 10907, + 1, 0, 0, 0, 1534, 10926, 1, 0, 0, 0, 1536, 10971, 1, 0, 0, 0, 1538, 10973, + 1, 0, 0, 0, 1540, 10977, 1, 0, 0, 0, 1542, 10981, 1, 0, 0, 0, 1544, 10984, + 1, 0, 0, 0, 1546, 10988, 1, 0, 0, 0, 1548, 10996, 1, 0, 0, 0, 1550, 11003, + 1, 0, 0, 0, 1552, 11006, 1, 0, 0, 0, 1554, 11015, 1, 0, 0, 0, 1556, 11018, + 1, 0, 0, 0, 1558, 11037, 1, 0, 0, 0, 1560, 11040, 1, 0, 0, 0, 1562, 11048, + 1, 0, 0, 0, 1564, 11054, 1, 0, 0, 0, 1566, 11084, 1, 0, 0, 0, 1568, 11086, + 1, 0, 0, 0, 1570, 11094, 1, 0, 0, 0, 1572, 11098, 1, 0, 0, 0, 1574, 11102, + 1, 0, 0, 0, 1576, 11104, 1, 0, 0, 0, 1578, 11116, 1, 0, 0, 0, 1580, 11118, + 1, 0, 0, 0, 1582, 11135, 1, 0, 0, 0, 1584, 11137, 1, 0, 0, 0, 1586, 11144, + 1, 0, 0, 0, 1588, 11148, 1, 0, 0, 0, 1590, 11151, 1, 0, 0, 0, 1592, 11157, + 1, 0, 0, 0, 1594, 11163, 1, 0, 0, 0, 1596, 11181, 1, 0, 0, 0, 1598, 11185, + 1, 0, 0, 0, 1600, 11187, 1, 0, 0, 0, 1602, 11191, 1, 0, 0, 0, 1604, 11195, + 1, 0, 0, 0, 1606, 11200, 1, 0, 0, 0, 1608, 11211, 1, 0, 0, 0, 1610, 11213, + 1, 0, 0, 0, 1612, 11215, 1, 0, 0, 0, 1614, 11217, 1, 0, 0, 0, 1616, 11219, + 1, 0, 0, 0, 1618, 11224, 1, 0, 0, 0, 1620, 11226, 1, 0, 0, 0, 1622, 11229, + 1, 0, 0, 0, 1624, 11249, 1, 0, 0, 0, 1626, 11251, 1, 0, 0, 0, 1628, 11253, + 1, 0, 0, 0, 1630, 11255, 1, 0, 0, 0, 1632, 11257, 1, 0, 0, 0, 1634, 11261, + 1, 0, 0, 0, 1636, 1637, 3, 4, 2, 0, 1637, 1638, 5, 0, 0, 1, 1638, 1, 1, + 0, 0, 0, 1639, 1640, 3, 1408, 704, 0, 1640, 3, 1, 0, 0, 0, 1641, 1642, + 3, 6, 3, 0, 1642, 5, 1, 0, 0, 0, 1643, 1645, 3, 8, 4, 0, 1644, 1646, 5, + 7, 0, 0, 1645, 1644, 1, 0, 0, 0, 1645, 1646, 1, 0, 0, 0, 1646, 1648, 1, + 0, 0, 0, 1647, 1643, 1, 0, 0, 0, 1648, 1651, 1, 0, 0, 0, 1649, 1647, 1, + 0, 0, 0, 1649, 1650, 1, 0, 0, 0, 1650, 7, 1, 0, 0, 0, 1651, 1649, 1, 0, + 0, 0, 1652, 1778, 3, 456, 228, 0, 1653, 1778, 3, 836, 418, 0, 1654, 1778, + 3, 826, 413, 0, 1655, 1778, 3, 828, 414, 0, 1656, 1778, 3, 586, 293, 0, + 1657, 1778, 3, 842, 421, 0, 1658, 1778, 3, 482, 241, 0, 1659, 1778, 3, + 326, 163, 0, 1660, 1778, 3, 332, 166, 0, 1661, 1778, 3, 342, 171, 0, 1662, + 1778, 3, 368, 184, 0, 1663, 1778, 3, 678, 339, 0, 1664, 1778, 3, 38, 19, + 0, 1665, 1778, 3, 736, 368, 0, 1666, 1778, 3, 740, 370, 0, 1667, 1778, + 3, 752, 376, 0, 1668, 1778, 3, 742, 371, 0, 1669, 1778, 3, 750, 375, 0, + 1670, 1778, 3, 388, 194, 0, 1671, 1778, 3, 284, 142, 0, 1672, 1778, 3, + 838, 419, 0, 1673, 1778, 3, 96, 48, 0, 1674, 1778, 3, 728, 364, 0, 1675, + 1778, 3, 134, 67, 0, 1676, 1778, 3, 762, 381, 0, 1677, 1778, 3, 32, 16, + 0, 1678, 1778, 3, 28, 14, 0, 1679, 1778, 3, 770, 385, 0, 1680, 1778, 3, + 266, 133, 0, 1681, 1778, 3, 848, 424, 0, 1682, 1778, 3, 846, 423, 0, 1683, + 1778, 3, 384, 192, 0, 1684, 1778, 3, 860, 430, 0, 1685, 1778, 3, 12, 6, + 0, 1686, 1778, 3, 92, 46, 0, 1687, 1778, 3, 140, 70, 0, 1688, 1778, 3, + 854, 427, 0, 1689, 1778, 3, 538, 269, 0, 1690, 1778, 3, 86, 43, 0, 1691, + 1778, 3, 142, 71, 0, 1692, 1778, 3, 404, 202, 0, 1693, 1778, 3, 268, 134, + 0, 1694, 1778, 3, 460, 230, 0, 1695, 1778, 3, 704, 352, 0, 1696, 1778, + 3, 852, 426, 0, 1697, 1778, 3, 840, 420, 0, 1698, 1778, 3, 320, 160, 0, + 1699, 1778, 3, 334, 167, 0, 1700, 1778, 3, 360, 180, 0, 1701, 1778, 3, + 370, 185, 0, 1702, 1778, 3, 624, 312, 0, 1703, 1778, 3, 36, 18, 0, 1704, + 1778, 3, 274, 137, 0, 1705, 1778, 3, 486, 243, 0, 1706, 1778, 3, 500, 250, + 0, 1707, 1778, 3, 754, 377, 0, 1708, 1778, 3, 502, 251, 0, 1709, 1778, + 3, 386, 193, 0, 1710, 1778, 3, 300, 150, 0, 1711, 1778, 3, 42, 21, 0, 1712, + 1778, 3, 282, 141, 0, 1713, 1778, 3, 172, 86, 0, 1714, 1778, 3, 764, 382, + 0, 1715, 1778, 3, 264, 132, 0, 1716, 1778, 3, 314, 157, 0, 1717, 1778, + 3, 712, 356, 0, 1718, 1778, 3, 408, 204, 0, 1719, 1778, 3, 448, 224, 0, + 1720, 1778, 3, 14, 7, 0, 1721, 1778, 3, 26, 13, 0, 1722, 1778, 3, 378, + 189, 0, 1723, 1778, 3, 814, 407, 0, 1724, 1778, 3, 910, 455, 0, 1725, 1778, + 3, 962, 481, 0, 1726, 1778, 3, 462, 231, 0, 1727, 1778, 3, 938, 469, 0, + 1728, 1778, 3, 94, 47, 0, 1729, 1778, 3, 698, 349, 0, 1730, 1778, 3, 708, + 354, 0, 1731, 1778, 3, 508, 254, 0, 1732, 1778, 3, 510, 255, 0, 1733, 1778, + 3, 512, 256, 0, 1734, 1778, 3, 516, 258, 0, 1735, 1778, 3, 772, 386, 0, + 1736, 1778, 3, 318, 159, 0, 1737, 1778, 3, 716, 358, 0, 1738, 1778, 3, + 34, 17, 0, 1739, 1778, 3, 382, 191, 0, 1740, 1778, 3, 830, 415, 0, 1741, + 1778, 3, 906, 453, 0, 1742, 1778, 3, 888, 444, 0, 1743, 1778, 3, 548, 274, + 0, 1744, 1778, 3, 556, 278, 0, 1745, 1778, 3, 578, 289, 0, 1746, 1778, + 3, 372, 186, 0, 1747, 1778, 3, 596, 298, 0, 1748, 1778, 3, 912, 456, 0, + 1749, 1778, 3, 930, 465, 0, 1750, 1778, 3, 792, 396, 0, 1751, 1778, 3, + 280, 140, 0, 1752, 1778, 3, 812, 406, 0, 1753, 1778, 3, 942, 471, 0, 1754, + 1778, 3, 788, 394, 0, 1755, 1778, 3, 900, 450, 0, 1756, 1778, 3, 514, 257, + 0, 1757, 1778, 3, 718, 359, 0, 1758, 1778, 3, 686, 343, 0, 1759, 1778, + 3, 684, 342, 0, 1760, 1778, 3, 688, 344, 0, 1761, 1778, 3, 730, 365, 0, + 1762, 1778, 3, 558, 279, 0, 1763, 1778, 3, 580, 290, 0, 1764, 1778, 3, + 774, 387, 0, 1765, 1778, 3, 542, 271, 0, 1766, 1778, 3, 970, 485, 0, 1767, + 1778, 3, 796, 398, 0, 1768, 1778, 3, 534, 267, 0, 1769, 1778, 3, 794, 397, + 0, 1770, 1778, 3, 952, 476, 0, 1771, 1778, 3, 858, 429, 0, 1772, 1778, + 3, 74, 37, 0, 1773, 1778, 3, 50, 25, 0, 1774, 1778, 3, 84, 42, 0, 1775, + 1778, 3, 808, 404, 0, 1776, 1778, 3, 10, 5, 0, 1777, 1652, 1, 0, 0, 0, + 1777, 1653, 1, 0, 0, 0, 1777, 1654, 1, 0, 0, 0, 1777, 1655, 1, 0, 0, 0, + 1777, 1656, 1, 0, 0, 0, 1777, 1657, 1, 0, 0, 0, 1777, 1658, 1, 0, 0, 0, + 1777, 1659, 1, 0, 0, 0, 1777, 1660, 1, 0, 0, 0, 1777, 1661, 1, 0, 0, 0, + 1777, 1662, 1, 0, 0, 0, 1777, 1663, 1, 0, 0, 0, 1777, 1664, 1, 0, 0, 0, + 1777, 1665, 1, 0, 0, 0, 1777, 1666, 1, 0, 0, 0, 1777, 1667, 1, 0, 0, 0, + 1777, 1668, 1, 0, 0, 0, 1777, 1669, 1, 0, 0, 0, 1777, 1670, 1, 0, 0, 0, + 1777, 1671, 1, 0, 0, 0, 1777, 1672, 1, 0, 0, 0, 1777, 1673, 1, 0, 0, 0, + 1777, 1674, 1, 0, 0, 0, 1777, 1675, 1, 0, 0, 0, 1777, 1676, 1, 0, 0, 0, + 1777, 1677, 1, 0, 0, 0, 1777, 1678, 1, 0, 0, 0, 1777, 1679, 1, 0, 0, 0, + 1777, 1680, 1, 0, 0, 0, 1777, 1681, 1, 0, 0, 0, 1777, 1682, 1, 0, 0, 0, + 1777, 1683, 1, 0, 0, 0, 1777, 1684, 1, 0, 0, 0, 1777, 1685, 1, 0, 0, 0, + 1777, 1686, 1, 0, 0, 0, 1777, 1687, 1, 0, 0, 0, 1777, 1688, 1, 0, 0, 0, + 1777, 1689, 1, 0, 0, 0, 1777, 1690, 1, 0, 0, 0, 1777, 1691, 1, 0, 0, 0, + 1777, 1692, 1, 0, 0, 0, 1777, 1693, 1, 0, 0, 0, 1777, 1694, 1, 0, 0, 0, + 1777, 1695, 1, 0, 0, 0, 1777, 1696, 1, 0, 0, 0, 1777, 1697, 1, 0, 0, 0, + 1777, 1698, 1, 0, 0, 0, 1777, 1699, 1, 0, 0, 0, 1777, 1700, 1, 0, 0, 0, + 1777, 1701, 1, 0, 0, 0, 1777, 1702, 1, 0, 0, 0, 1777, 1703, 1, 0, 0, 0, + 1777, 1704, 1, 0, 0, 0, 1777, 1705, 1, 0, 0, 0, 1777, 1706, 1, 0, 0, 0, + 1777, 1707, 1, 0, 0, 0, 1777, 1708, 1, 0, 0, 0, 1777, 1709, 1, 0, 0, 0, + 1777, 1710, 1, 0, 0, 0, 1777, 1711, 1, 0, 0, 0, 1777, 1712, 1, 0, 0, 0, + 1777, 1713, 1, 0, 0, 0, 1777, 1714, 1, 0, 0, 0, 1777, 1715, 1, 0, 0, 0, + 1777, 1716, 1, 0, 0, 0, 1777, 1717, 1, 0, 0, 0, 1777, 1718, 1, 0, 0, 0, + 1777, 1719, 1, 0, 0, 0, 1777, 1720, 1, 0, 0, 0, 1777, 1721, 1, 0, 0, 0, + 1777, 1722, 1, 0, 0, 0, 1777, 1723, 1, 0, 0, 0, 1777, 1724, 1, 0, 0, 0, + 1777, 1725, 1, 0, 0, 0, 1777, 1726, 1, 0, 0, 0, 1777, 1727, 1, 0, 0, 0, + 1777, 1728, 1, 0, 0, 0, 1777, 1729, 1, 0, 0, 0, 1777, 1730, 1, 0, 0, 0, + 1777, 1731, 1, 0, 0, 0, 1777, 1732, 1, 0, 0, 0, 1777, 1733, 1, 0, 0, 0, + 1777, 1734, 1, 0, 0, 0, 1777, 1735, 1, 0, 0, 0, 1777, 1736, 1, 0, 0, 0, + 1777, 1737, 1, 0, 0, 0, 1777, 1738, 1, 0, 0, 0, 1777, 1739, 1, 0, 0, 0, + 1777, 1740, 1, 0, 0, 0, 1777, 1741, 1, 0, 0, 0, 1777, 1742, 1, 0, 0, 0, + 1777, 1743, 1, 0, 0, 0, 1777, 1744, 1, 0, 0, 0, 1777, 1745, 1, 0, 0, 0, + 1777, 1746, 1, 0, 0, 0, 1777, 1747, 1, 0, 0, 0, 1777, 1748, 1, 0, 0, 0, + 1777, 1749, 1, 0, 0, 0, 1777, 1750, 1, 0, 0, 0, 1777, 1751, 1, 0, 0, 0, + 1777, 1752, 1, 0, 0, 0, 1777, 1753, 1, 0, 0, 0, 1777, 1754, 1, 0, 0, 0, + 1777, 1755, 1, 0, 0, 0, 1777, 1756, 1, 0, 0, 0, 1777, 1757, 1, 0, 0, 0, + 1777, 1758, 1, 0, 0, 0, 1777, 1759, 1, 0, 0, 0, 1777, 1760, 1, 0, 0, 0, + 1777, 1761, 1, 0, 0, 0, 1777, 1762, 1, 0, 0, 0, 1777, 1763, 1, 0, 0, 0, + 1777, 1764, 1, 0, 0, 0, 1777, 1765, 1, 0, 0, 0, 1777, 1766, 1, 0, 0, 0, + 1777, 1767, 1, 0, 0, 0, 1777, 1768, 1, 0, 0, 0, 1777, 1769, 1, 0, 0, 0, + 1777, 1770, 1, 0, 0, 0, 1777, 1771, 1, 0, 0, 0, 1777, 1772, 1, 0, 0, 0, + 1777, 1773, 1, 0, 0, 0, 1777, 1774, 1, 0, 0, 0, 1777, 1775, 1, 0, 0, 0, + 1777, 1776, 1, 0, 0, 0, 1778, 9, 1, 0, 0, 0, 1779, 1781, 5, 675, 0, 0, + 1780, 1782, 5, 676, 0, 0, 1781, 1780, 1, 0, 0, 0, 1781, 1782, 1, 0, 0, + 0, 1782, 11, 1, 0, 0, 0, 1783, 1784, 5, 435, 0, 0, 1784, 1785, 3, 1220, + 610, 0, 1785, 13, 1, 0, 0, 0, 1786, 1787, 5, 46, 0, 0, 1787, 1788, 5, 311, + 0, 0, 1788, 1790, 3, 1378, 689, 0, 1789, 1791, 3, 16, 8, 0, 1790, 1789, + 1, 0, 0, 0, 1790, 1791, 1, 0, 0, 0, 1791, 1792, 1, 0, 0, 0, 1792, 1793, + 3, 18, 9, 0, 1793, 15, 1, 0, 0, 0, 1794, 1795, 5, 105, 0, 0, 1795, 17, + 1, 0, 0, 0, 1796, 1798, 3, 24, 12, 0, 1797, 1796, 1, 0, 0, 0, 1798, 1801, + 1, 0, 0, 0, 1799, 1797, 1, 0, 0, 0, 1799, 1800, 1, 0, 0, 0, 1800, 19, 1, + 0, 0, 0, 1801, 1799, 1, 0, 0, 0, 1802, 1804, 3, 22, 11, 0, 1803, 1802, + 1, 0, 0, 0, 1804, 1807, 1, 0, 0, 0, 1805, 1803, 1, 0, 0, 0, 1805, 1806, + 1, 0, 0, 0, 1806, 21, 1, 0, 0, 0, 1807, 1805, 1, 0, 0, 0, 1808, 1811, 5, + 280, 0, 0, 1809, 1812, 3, 1370, 685, 0, 1810, 1812, 5, 78, 0, 0, 1811, + 1809, 1, 0, 0, 0, 1811, 1810, 1, 0, 0, 0, 1812, 1827, 1, 0, 0, 0, 1813, + 1814, 7, 0, 0, 0, 1814, 1815, 5, 280, 0, 0, 1815, 1827, 3, 1370, 685, 0, + 1816, 1827, 5, 228, 0, 0, 1817, 1818, 5, 164, 0, 0, 1818, 1819, 5, 74, + 0, 0, 1819, 1827, 3, 1376, 688, 0, 1820, 1821, 5, 364, 0, 0, 1821, 1822, + 5, 361, 0, 0, 1822, 1827, 3, 1370, 685, 0, 1823, 1824, 5, 99, 0, 0, 1824, + 1827, 3, 1382, 691, 0, 1825, 1827, 3, 1394, 697, 0, 1826, 1808, 1, 0, 0, + 0, 1826, 1813, 1, 0, 0, 0, 1826, 1816, 1, 0, 0, 0, 1826, 1817, 1, 0, 0, + 0, 1826, 1820, 1, 0, 0, 0, 1826, 1823, 1, 0, 0, 0, 1826, 1825, 1, 0, 0, + 0, 1827, 23, 1, 0, 0, 0, 1828, 1839, 3, 22, 11, 0, 1829, 1830, 5, 341, + 0, 0, 1830, 1839, 3, 1368, 684, 0, 1831, 1832, 5, 134, 0, 0, 1832, 1839, + 3, 1382, 691, 0, 1833, 1834, 5, 311, 0, 0, 1834, 1839, 3, 1382, 691, 0, + 1835, 1836, 5, 68, 0, 0, 1836, 1837, 7, 1, 0, 0, 1837, 1839, 3, 1382, 691, + 0, 1838, 1828, 1, 0, 0, 0, 1838, 1829, 1, 0, 0, 0, 1838, 1831, 1, 0, 0, + 0, 1838, 1833, 1, 0, 0, 0, 1838, 1835, 1, 0, 0, 0, 1839, 25, 1, 0, 0, 0, + 1840, 1841, 5, 46, 0, 0, 1841, 1842, 5, 99, 0, 0, 1842, 1844, 3, 1378, + 689, 0, 1843, 1845, 3, 16, 8, 0, 1844, 1843, 1, 0, 0, 0, 1844, 1845, 1, + 0, 0, 0, 1845, 1846, 1, 0, 0, 0, 1846, 1847, 3, 18, 9, 0, 1847, 27, 1, + 0, 0, 0, 1848, 1849, 5, 138, 0, 0, 1849, 1850, 7, 2, 0, 0, 1850, 1852, + 3, 1380, 690, 0, 1851, 1853, 3, 16, 8, 0, 1852, 1851, 1, 0, 0, 0, 1852, + 1853, 1, 0, 0, 0, 1853, 1854, 1, 0, 0, 0, 1854, 1855, 3, 20, 10, 0, 1855, + 29, 1, 0, 0, 0, 1856, 1857, 5, 68, 0, 0, 1857, 1858, 5, 175, 0, 0, 1858, + 1859, 3, 1352, 676, 0, 1859, 31, 1, 0, 0, 0, 1860, 1861, 5, 138, 0, 0, + 1861, 1863, 7, 2, 0, 0, 1862, 1864, 5, 30, 0, 0, 1863, 1862, 1, 0, 0, 0, + 1863, 1864, 1, 0, 0, 0, 1864, 1865, 1, 0, 0, 0, 1865, 1867, 3, 1380, 690, + 0, 1866, 1868, 3, 30, 15, 0, 1867, 1866, 1, 0, 0, 0, 1867, 1868, 1, 0, + 0, 0, 1868, 1869, 1, 0, 0, 0, 1869, 1870, 3, 80, 40, 0, 1870, 33, 1, 0, + 0, 0, 1871, 1872, 5, 191, 0, 0, 1872, 1875, 7, 3, 0, 0, 1873, 1874, 5, + 220, 0, 0, 1874, 1876, 5, 390, 0, 0, 1875, 1873, 1, 0, 0, 0, 1875, 1876, + 1, 0, 0, 0, 1876, 1877, 1, 0, 0, 0, 1877, 1878, 3, 1382, 691, 0, 1878, + 35, 1, 0, 0, 0, 1879, 1880, 5, 46, 0, 0, 1880, 1881, 5, 66, 0, 0, 1881, + 1883, 3, 1378, 689, 0, 1882, 1884, 3, 16, 8, 0, 1883, 1882, 1, 0, 0, 0, + 1883, 1884, 1, 0, 0, 0, 1884, 1885, 1, 0, 0, 0, 1885, 1886, 3, 18, 9, 0, + 1886, 37, 1, 0, 0, 0, 1887, 1888, 5, 138, 0, 0, 1888, 1889, 5, 66, 0, 0, + 1889, 1890, 3, 1380, 690, 0, 1890, 1891, 3, 40, 20, 0, 1891, 1892, 5, 99, + 0, 0, 1892, 1893, 3, 1382, 691, 0, 1893, 39, 1, 0, 0, 0, 1894, 1895, 7, + 4, 0, 0, 1895, 41, 1, 0, 0, 0, 1896, 1897, 5, 46, 0, 0, 1897, 1901, 5, + 316, 0, 0, 1898, 1899, 5, 220, 0, 0, 1899, 1900, 5, 77, 0, 0, 1900, 1902, + 5, 390, 0, 0, 1901, 1898, 1, 0, 0, 0, 1901, 1902, 1, 0, 0, 0, 1902, 1909, + 1, 0, 0, 0, 1903, 1905, 3, 44, 22, 0, 1904, 1903, 1, 0, 0, 0, 1904, 1905, + 1, 0, 0, 0, 1905, 1906, 1, 0, 0, 0, 1906, 1907, 5, 106, 0, 0, 1907, 1910, + 3, 1380, 690, 0, 1908, 1910, 3, 1384, 692, 0, 1909, 1904, 1, 0, 0, 0, 1909, + 1908, 1, 0, 0, 0, 1910, 1911, 1, 0, 0, 0, 1911, 1912, 3, 46, 23, 0, 1912, + 43, 1, 0, 0, 0, 1913, 1914, 3, 1384, 692, 0, 1914, 45, 1, 0, 0, 0, 1915, + 1917, 3, 48, 24, 0, 1916, 1915, 1, 0, 0, 0, 1917, 1920, 1, 0, 0, 0, 1918, + 1916, 1, 0, 0, 0, 1918, 1919, 1, 0, 0, 0, 1919, 47, 1, 0, 0, 0, 1920, 1918, + 1, 0, 0, 0, 1921, 1928, 3, 172, 86, 0, 1922, 1928, 3, 596, 298, 0, 1923, + 1928, 3, 282, 141, 0, 1924, 1928, 3, 408, 204, 0, 1925, 1928, 3, 556, 278, + 0, 1926, 1928, 3, 808, 404, 0, 1927, 1921, 1, 0, 0, 0, 1927, 1922, 1, 0, + 0, 0, 1927, 1923, 1, 0, 0, 0, 1927, 1924, 1, 0, 0, 0, 1927, 1925, 1, 0, + 0, 0, 1927, 1926, 1, 0, 0, 0, 1928, 49, 1, 0, 0, 0, 1929, 1931, 5, 326, + 0, 0, 1930, 1932, 7, 5, 0, 0, 1931, 1930, 1, 0, 0, 0, 1931, 1932, 1, 0, + 0, 0, 1932, 1933, 1, 0, 0, 0, 1933, 1934, 3, 52, 26, 0, 1934, 51, 1, 0, + 0, 0, 1935, 1936, 5, 349, 0, 0, 1936, 1944, 3, 802, 401, 0, 1937, 1938, + 5, 325, 0, 0, 1938, 1939, 5, 154, 0, 0, 1939, 1940, 5, 36, 0, 0, 1940, + 1941, 5, 349, 0, 0, 1941, 1944, 3, 802, 401, 0, 1942, 1944, 3, 56, 28, + 0, 1943, 1935, 1, 0, 0, 0, 1943, 1937, 1, 0, 0, 0, 1943, 1942, 1, 0, 0, + 0, 1944, 53, 1, 0, 0, 0, 1945, 1946, 3, 58, 29, 0, 1946, 1947, 7, 6, 0, + 0, 1947, 1948, 3, 60, 30, 0, 1948, 55, 1, 0, 0, 0, 1949, 1977, 3, 54, 27, + 0, 1950, 1951, 3, 58, 29, 0, 1951, 1952, 5, 64, 0, 0, 1952, 1953, 5, 436, + 0, 0, 1953, 1977, 1, 0, 0, 0, 1954, 1955, 5, 413, 0, 0, 1955, 1956, 5, + 379, 0, 0, 1956, 1977, 3, 68, 34, 0, 1957, 1958, 5, 152, 0, 0, 1958, 1977, + 3, 1370, 685, 0, 1959, 1960, 5, 316, 0, 0, 1960, 1977, 3, 1370, 685, 0, + 1961, 1963, 5, 260, 0, 0, 1962, 1964, 3, 70, 35, 0, 1963, 1962, 1, 0, 0, + 0, 1963, 1964, 1, 0, 0, 0, 1964, 1977, 1, 0, 0, 0, 1965, 1966, 5, 311, + 0, 0, 1966, 1977, 3, 72, 36, 0, 1967, 1968, 5, 325, 0, 0, 1968, 1969, 5, + 106, 0, 0, 1969, 1977, 3, 72, 36, 0, 1970, 1971, 5, 376, 0, 0, 1971, 1972, + 5, 272, 0, 0, 1972, 1977, 3, 1238, 619, 0, 1973, 1974, 5, 349, 0, 0, 1974, + 1975, 5, 330, 0, 0, 1975, 1977, 3, 1370, 685, 0, 1976, 1949, 1, 0, 0, 0, + 1976, 1950, 1, 0, 0, 0, 1976, 1954, 1, 0, 0, 0, 1976, 1957, 1, 0, 0, 0, + 1976, 1959, 1, 0, 0, 0, 1976, 1961, 1, 0, 0, 0, 1976, 1965, 1, 0, 0, 0, + 1976, 1967, 1, 0, 0, 0, 1976, 1970, 1, 0, 0, 0, 1976, 1973, 1, 0, 0, 0, + 1977, 57, 1, 0, 0, 0, 1978, 1983, 3, 1384, 692, 0, 1979, 1980, 5, 11, 0, + 0, 1980, 1982, 3, 1384, 692, 0, 1981, 1979, 1, 0, 0, 0, 1982, 1985, 1, + 0, 0, 0, 1983, 1981, 1, 0, 0, 0, 1983, 1984, 1, 0, 0, 0, 1984, 59, 1, 0, + 0, 0, 1985, 1983, 1, 0, 0, 0, 1986, 1991, 3, 62, 31, 0, 1987, 1988, 5, + 6, 0, 0, 1988, 1990, 3, 62, 31, 0, 1989, 1987, 1, 0, 0, 0, 1990, 1993, + 1, 0, 0, 0, 1991, 1989, 1, 0, 0, 0, 1991, 1992, 1, 0, 0, 0, 1992, 61, 1, + 0, 0, 0, 1993, 1991, 1, 0, 0, 0, 1994, 1997, 3, 66, 33, 0, 1995, 1997, + 3, 296, 148, 0, 1996, 1994, 1, 0, 0, 0, 1996, 1995, 1, 0, 0, 0, 1997, 63, + 1, 0, 0, 0, 1998, 1999, 5, 293, 0, 0, 1999, 2004, 7, 7, 0, 0, 2000, 2001, + 5, 303, 0, 0, 2001, 2004, 5, 293, 0, 0, 2002, 2004, 5, 323, 0, 0, 2003, + 1998, 1, 0, 0, 0, 2003, 2000, 1, 0, 0, 0, 2003, 2002, 1, 0, 0, 0, 2004, + 65, 1, 0, 0, 0, 2005, 2010, 5, 96, 0, 0, 2006, 2010, 5, 60, 0, 0, 2007, + 2010, 5, 80, 0, 0, 2008, 2010, 3, 72, 36, 0, 2009, 2005, 1, 0, 0, 0, 2009, + 2006, 1, 0, 0, 0, 2009, 2007, 1, 0, 0, 0, 2009, 2008, 1, 0, 0, 0, 2010, + 67, 1, 0, 0, 0, 2011, 2028, 3, 1370, 685, 0, 2012, 2028, 3, 1394, 697, + 0, 2013, 2014, 3, 1162, 581, 0, 2014, 2016, 3, 1370, 685, 0, 2015, 2017, + 3, 1166, 583, 0, 2016, 2015, 1, 0, 0, 0, 2016, 2017, 1, 0, 0, 0, 2017, + 2028, 1, 0, 0, 0, 2018, 2019, 3, 1162, 581, 0, 2019, 2020, 5, 2, 0, 0, + 2020, 2021, 3, 1368, 684, 0, 2021, 2022, 5, 3, 0, 0, 2022, 2023, 3, 1370, + 685, 0, 2023, 2028, 1, 0, 0, 0, 2024, 2028, 3, 296, 148, 0, 2025, 2028, + 5, 53, 0, 0, 2026, 2028, 5, 245, 0, 0, 2027, 2011, 1, 0, 0, 0, 2027, 2012, + 1, 0, 0, 0, 2027, 2013, 1, 0, 0, 0, 2027, 2018, 1, 0, 0, 0, 2027, 2024, + 1, 0, 0, 0, 2027, 2025, 1, 0, 0, 0, 2027, 2026, 1, 0, 0, 0, 2028, 69, 1, + 0, 0, 0, 2029, 2032, 3, 1370, 685, 0, 2030, 2032, 5, 53, 0, 0, 2031, 2029, + 1, 0, 0, 0, 2031, 2030, 1, 0, 0, 0, 2032, 71, 1, 0, 0, 0, 2033, 2036, 3, + 1390, 695, 0, 2034, 2036, 3, 1370, 685, 0, 2035, 2033, 1, 0, 0, 0, 2035, + 2034, 1, 0, 0, 0, 2036, 73, 1, 0, 0, 0, 2037, 2038, 5, 306, 0, 0, 2038, + 2039, 3, 76, 38, 0, 2039, 75, 1, 0, 0, 0, 2040, 2049, 3, 78, 39, 0, 2041, + 2042, 5, 413, 0, 0, 2042, 2049, 5, 379, 0, 0, 2043, 2044, 5, 349, 0, 0, + 2044, 2045, 5, 235, 0, 0, 2045, 2049, 5, 242, 0, 0, 2046, 2047, 5, 325, + 0, 0, 2047, 2049, 5, 106, 0, 0, 2048, 2040, 1, 0, 0, 0, 2048, 2041, 1, + 0, 0, 0, 2048, 2043, 1, 0, 0, 0, 2048, 2046, 1, 0, 0, 0, 2049, 77, 1, 0, + 0, 0, 2050, 2053, 3, 58, 29, 0, 2051, 2053, 5, 30, 0, 0, 2052, 2050, 1, + 0, 0, 0, 2052, 2051, 1, 0, 0, 0, 2053, 79, 1, 0, 0, 0, 2054, 2055, 5, 326, + 0, 0, 2055, 2058, 3, 52, 26, 0, 2056, 2058, 3, 74, 37, 0, 2057, 2054, 1, + 0, 0, 0, 2057, 2056, 1, 0, 0, 0, 2058, 81, 1, 0, 0, 0, 2059, 2060, 5, 326, + 0, 0, 2060, 2063, 3, 56, 28, 0, 2061, 2063, 3, 74, 37, 0, 2062, 2059, 1, + 0, 0, 0, 2062, 2061, 1, 0, 0, 0, 2063, 83, 1, 0, 0, 0, 2064, 2074, 5, 328, + 0, 0, 2065, 2075, 3, 58, 29, 0, 2066, 2067, 5, 413, 0, 0, 2067, 2075, 5, + 379, 0, 0, 2068, 2069, 5, 349, 0, 0, 2069, 2070, 5, 235, 0, 0, 2070, 2075, + 5, 242, 0, 0, 2071, 2072, 5, 325, 0, 0, 2072, 2075, 5, 106, 0, 0, 2073, + 2075, 5, 30, 0, 0, 2074, 2065, 1, 0, 0, 0, 2074, 2066, 1, 0, 0, 0, 2074, + 2068, 1, 0, 0, 0, 2074, 2071, 1, 0, 0, 0, 2074, 2073, 1, 0, 0, 0, 2075, + 85, 1, 0, 0, 0, 2076, 2077, 5, 326, 0, 0, 2077, 2078, 5, 165, 0, 0, 2078, + 2079, 3, 88, 44, 0, 2079, 2080, 3, 90, 45, 0, 2080, 87, 1, 0, 0, 0, 2081, + 2084, 5, 30, 0, 0, 2082, 2084, 3, 1346, 673, 0, 2083, 2081, 1, 0, 0, 0, + 2083, 2082, 1, 0, 0, 0, 2084, 89, 1, 0, 0, 0, 2085, 2086, 7, 8, 0, 0, 2086, + 91, 1, 0, 0, 0, 2087, 2088, 5, 155, 0, 0, 2088, 93, 1, 0, 0, 0, 2089, 2090, + 5, 187, 0, 0, 2090, 2091, 7, 9, 0, 0, 2091, 95, 1, 0, 0, 0, 2092, 2093, + 5, 138, 0, 0, 2093, 2096, 5, 92, 0, 0, 2094, 2095, 5, 220, 0, 0, 2095, + 2097, 5, 390, 0, 0, 2096, 2094, 1, 0, 0, 0, 2096, 2097, 1, 0, 0, 0, 2097, + 2098, 1, 0, 0, 0, 2098, 2101, 3, 1084, 542, 0, 2099, 2102, 3, 98, 49, 0, + 2100, 2102, 3, 100, 50, 0, 2101, 2099, 1, 0, 0, 0, 2101, 2100, 1, 0, 0, + 0, 2102, 2205, 1, 0, 0, 0, 2103, 2104, 5, 138, 0, 0, 2104, 2105, 5, 92, + 0, 0, 2105, 2106, 5, 30, 0, 0, 2106, 2107, 5, 68, 0, 0, 2107, 2108, 5, + 344, 0, 0, 2108, 2112, 3, 1352, 676, 0, 2109, 2110, 5, 274, 0, 0, 2110, + 2111, 5, 147, 0, 0, 2111, 2113, 3, 1382, 691, 0, 2112, 2109, 1, 0, 0, 0, + 2112, 2113, 1, 0, 0, 0, 2113, 2114, 1, 0, 0, 0, 2114, 2115, 5, 326, 0, + 0, 2115, 2116, 5, 344, 0, 0, 2116, 2118, 3, 1352, 676, 0, 2117, 2119, 3, + 948, 474, 0, 2118, 2117, 1, 0, 0, 0, 2118, 2119, 1, 0, 0, 0, 2119, 2205, + 1, 0, 0, 0, 2120, 2121, 5, 138, 0, 0, 2121, 2124, 5, 226, 0, 0, 2122, 2123, + 5, 220, 0, 0, 2123, 2125, 5, 390, 0, 0, 2124, 2122, 1, 0, 0, 0, 2124, 2125, + 1, 0, 0, 0, 2125, 2126, 1, 0, 0, 0, 2126, 2129, 3, 1348, 674, 0, 2127, + 2130, 3, 98, 49, 0, 2128, 2130, 3, 102, 51, 0, 2129, 2127, 1, 0, 0, 0, + 2129, 2128, 1, 0, 0, 0, 2130, 2205, 1, 0, 0, 0, 2131, 2132, 5, 138, 0, + 0, 2132, 2133, 5, 226, 0, 0, 2133, 2134, 5, 30, 0, 0, 2134, 2135, 5, 68, + 0, 0, 2135, 2136, 5, 344, 0, 0, 2136, 2140, 3, 1352, 676, 0, 2137, 2138, + 5, 274, 0, 0, 2138, 2139, 5, 147, 0, 0, 2139, 2141, 3, 1382, 691, 0, 2140, + 2137, 1, 0, 0, 0, 2140, 2141, 1, 0, 0, 0, 2141, 2142, 1, 0, 0, 0, 2142, + 2143, 5, 326, 0, 0, 2143, 2144, 5, 344, 0, 0, 2144, 2146, 3, 1352, 676, + 0, 2145, 2147, 3, 948, 474, 0, 2146, 2145, 1, 0, 0, 0, 2146, 2147, 1, 0, + 0, 0, 2147, 2205, 1, 0, 0, 0, 2148, 2149, 5, 138, 0, 0, 2149, 2152, 5, + 321, 0, 0, 2150, 2151, 5, 220, 0, 0, 2151, 2153, 5, 390, 0, 0, 2152, 2150, + 1, 0, 0, 0, 2152, 2153, 1, 0, 0, 0, 2153, 2154, 1, 0, 0, 0, 2154, 2155, + 3, 1348, 674, 0, 2155, 2156, 3, 98, 49, 0, 2156, 2205, 1, 0, 0, 0, 2157, + 2158, 5, 138, 0, 0, 2158, 2161, 5, 369, 0, 0, 2159, 2160, 5, 220, 0, 0, + 2160, 2162, 5, 390, 0, 0, 2161, 2159, 1, 0, 0, 0, 2161, 2162, 1, 0, 0, + 0, 2162, 2163, 1, 0, 0, 0, 2163, 2164, 3, 1348, 674, 0, 2164, 2165, 3, + 98, 49, 0, 2165, 2205, 1, 0, 0, 0, 2166, 2167, 5, 138, 0, 0, 2167, 2168, + 5, 251, 0, 0, 2168, 2171, 5, 369, 0, 0, 2169, 2170, 5, 220, 0, 0, 2170, + 2172, 5, 390, 0, 0, 2171, 2169, 1, 0, 0, 0, 2171, 2172, 1, 0, 0, 0, 2172, + 2173, 1, 0, 0, 0, 2173, 2174, 3, 1348, 674, 0, 2174, 2175, 3, 98, 49, 0, + 2175, 2205, 1, 0, 0, 0, 2176, 2177, 5, 138, 0, 0, 2177, 2178, 5, 251, 0, + 0, 2178, 2179, 5, 369, 0, 0, 2179, 2180, 5, 30, 0, 0, 2180, 2181, 5, 68, + 0, 0, 2181, 2182, 5, 344, 0, 0, 2182, 2186, 3, 1352, 676, 0, 2183, 2184, + 5, 274, 0, 0, 2184, 2185, 5, 147, 0, 0, 2185, 2187, 3, 1382, 691, 0, 2186, + 2183, 1, 0, 0, 0, 2186, 2187, 1, 0, 0, 0, 2187, 2188, 1, 0, 0, 0, 2188, + 2189, 5, 326, 0, 0, 2189, 2190, 5, 344, 0, 0, 2190, 2192, 3, 1352, 676, + 0, 2191, 2193, 3, 948, 474, 0, 2192, 2191, 1, 0, 0, 0, 2192, 2193, 1, 0, + 0, 0, 2193, 2205, 1, 0, 0, 0, 2194, 2195, 5, 138, 0, 0, 2195, 2196, 5, + 63, 0, 0, 2196, 2199, 5, 92, 0, 0, 2197, 2198, 5, 220, 0, 0, 2198, 2200, + 5, 390, 0, 0, 2199, 2197, 1, 0, 0, 0, 2199, 2200, 1, 0, 0, 0, 2200, 2201, + 1, 0, 0, 0, 2201, 2202, 3, 1084, 542, 0, 2202, 2203, 3, 98, 49, 0, 2203, + 2205, 1, 0, 0, 0, 2204, 2092, 1, 0, 0, 0, 2204, 2103, 1, 0, 0, 0, 2204, + 2120, 1, 0, 0, 0, 2204, 2131, 1, 0, 0, 0, 2204, 2148, 1, 0, 0, 0, 2204, + 2157, 1, 0, 0, 0, 2204, 2166, 1, 0, 0, 0, 2204, 2176, 1, 0, 0, 0, 2204, + 2194, 1, 0, 0, 0, 2205, 97, 1, 0, 0, 0, 2206, 2211, 3, 104, 52, 0, 2207, + 2208, 5, 6, 0, 0, 2208, 2210, 3, 104, 52, 0, 2209, 2207, 1, 0, 0, 0, 2210, + 2213, 1, 0, 0, 0, 2211, 2209, 1, 0, 0, 0, 2211, 2212, 1, 0, 0, 0, 2212, + 99, 1, 0, 0, 0, 2213, 2211, 1, 0, 0, 0, 2214, 2215, 5, 437, 0, 0, 2215, + 2216, 5, 278, 0, 0, 2216, 2217, 3, 1348, 674, 0, 2217, 2218, 3, 128, 64, + 0, 2218, 2223, 1, 0, 0, 0, 2219, 2220, 5, 438, 0, 0, 2220, 2221, 5, 278, + 0, 0, 2221, 2223, 3, 1348, 674, 0, 2222, 2214, 1, 0, 0, 0, 2222, 2219, + 1, 0, 0, 0, 2223, 101, 1, 0, 0, 0, 2224, 2225, 5, 437, 0, 0, 2225, 2226, + 5, 278, 0, 0, 2226, 2227, 3, 1348, 674, 0, 2227, 103, 1, 0, 0, 0, 2228, + 2229, 5, 133, 0, 0, 2229, 2531, 3, 188, 94, 0, 2230, 2231, 5, 133, 0, 0, + 2231, 2232, 5, 220, 0, 0, 2232, 2233, 5, 77, 0, 0, 2233, 2234, 5, 390, + 0, 0, 2234, 2531, 3, 188, 94, 0, 2235, 2236, 5, 133, 0, 0, 2236, 2237, + 5, 44, 0, 0, 2237, 2531, 3, 188, 94, 0, 2238, 2239, 5, 133, 0, 0, 2239, + 2240, 5, 44, 0, 0, 2240, 2241, 5, 220, 0, 0, 2241, 2242, 5, 77, 0, 0, 2242, + 2243, 5, 390, 0, 0, 2243, 2531, 3, 188, 94, 0, 2244, 2246, 5, 138, 0, 0, + 2245, 2247, 3, 732, 366, 0, 2246, 2245, 1, 0, 0, 0, 2246, 2247, 1, 0, 0, + 0, 2247, 2248, 1, 0, 0, 0, 2248, 2249, 3, 1384, 692, 0, 2249, 2250, 3, + 106, 53, 0, 2250, 2531, 1, 0, 0, 0, 2251, 2253, 5, 138, 0, 0, 2252, 2254, + 3, 732, 366, 0, 2253, 2252, 1, 0, 0, 0, 2253, 2254, 1, 0, 0, 0, 2254, 2255, + 1, 0, 0, 0, 2255, 2256, 3, 1384, 692, 0, 2256, 2257, 5, 191, 0, 0, 2257, + 2258, 5, 77, 0, 0, 2258, 2259, 5, 78, 0, 0, 2259, 2531, 1, 0, 0, 0, 2260, + 2262, 5, 138, 0, 0, 2261, 2263, 3, 732, 366, 0, 2262, 2261, 1, 0, 0, 0, + 2262, 2263, 1, 0, 0, 0, 2263, 2264, 1, 0, 0, 0, 2264, 2265, 3, 1384, 692, + 0, 2265, 2266, 5, 326, 0, 0, 2266, 2267, 5, 77, 0, 0, 2267, 2268, 5, 78, + 0, 0, 2268, 2531, 1, 0, 0, 0, 2269, 2271, 5, 138, 0, 0, 2270, 2272, 3, + 732, 366, 0, 2271, 2270, 1, 0, 0, 0, 2271, 2272, 1, 0, 0, 0, 2272, 2273, + 1, 0, 0, 0, 2273, 2274, 3, 1384, 692, 0, 2274, 2275, 5, 191, 0, 0, 2275, + 2276, 5, 439, 0, 0, 2276, 2531, 1, 0, 0, 0, 2277, 2279, 5, 138, 0, 0, 2278, + 2280, 3, 732, 366, 0, 2279, 2278, 1, 0, 0, 0, 2279, 2280, 1, 0, 0, 0, 2280, + 2281, 1, 0, 0, 0, 2281, 2282, 3, 1384, 692, 0, 2282, 2283, 5, 191, 0, 0, + 2283, 2284, 5, 439, 0, 0, 2284, 2285, 5, 220, 0, 0, 2285, 2286, 5, 390, + 0, 0, 2286, 2531, 1, 0, 0, 0, 2287, 2289, 5, 138, 0, 0, 2288, 2290, 3, + 732, 366, 0, 2289, 2288, 1, 0, 0, 0, 2289, 2290, 1, 0, 0, 0, 2290, 2291, + 1, 0, 0, 0, 2291, 2292, 3, 1384, 692, 0, 2292, 2293, 5, 326, 0, 0, 2293, + 2294, 5, 335, 0, 0, 2294, 2295, 3, 1376, 688, 0, 2295, 2531, 1, 0, 0, 0, + 2296, 2298, 5, 138, 0, 0, 2297, 2299, 3, 732, 366, 0, 2298, 2297, 1, 0, + 0, 0, 2298, 2299, 1, 0, 0, 0, 2299, 2300, 1, 0, 0, 0, 2300, 2301, 3, 1368, + 684, 0, 2301, 2302, 5, 326, 0, 0, 2302, 2303, 5, 335, 0, 0, 2303, 2304, + 3, 1376, 688, 0, 2304, 2531, 1, 0, 0, 0, 2305, 2307, 5, 138, 0, 0, 2306, + 2308, 3, 732, 366, 0, 2307, 2306, 1, 0, 0, 0, 2307, 2308, 1, 0, 0, 0, 2308, + 2309, 1, 0, 0, 0, 2309, 2310, 3, 1384, 692, 0, 2310, 2311, 5, 326, 0, 0, + 2311, 2312, 3, 116, 58, 0, 2312, 2531, 1, 0, 0, 0, 2313, 2315, 5, 138, + 0, 0, 2314, 2316, 3, 732, 366, 0, 2315, 2314, 1, 0, 0, 0, 2315, 2316, 1, + 0, 0, 0, 2316, 2317, 1, 0, 0, 0, 2317, 2318, 3, 1384, 692, 0, 2318, 2319, + 5, 306, 0, 0, 2319, 2320, 3, 116, 58, 0, 2320, 2531, 1, 0, 0, 0, 2321, + 2323, 5, 138, 0, 0, 2322, 2324, 3, 732, 366, 0, 2323, 2322, 1, 0, 0, 0, + 2323, 2324, 1, 0, 0, 0, 2324, 2325, 1, 0, 0, 0, 2325, 2326, 3, 1384, 692, + 0, 2326, 2327, 5, 326, 0, 0, 2327, 2328, 5, 338, 0, 0, 2328, 2329, 3, 1384, + 692, 0, 2329, 2531, 1, 0, 0, 0, 2330, 2332, 5, 138, 0, 0, 2331, 2333, 3, + 732, 366, 0, 2332, 2331, 1, 0, 0, 0, 2332, 2333, 1, 0, 0, 0, 2333, 2334, + 1, 0, 0, 0, 2334, 2335, 3, 1384, 692, 0, 2335, 2336, 5, 133, 0, 0, 2336, + 2337, 5, 440, 0, 0, 2337, 2338, 3, 202, 101, 0, 2338, 2339, 5, 36, 0, 0, + 2339, 2341, 5, 219, 0, 0, 2340, 2342, 3, 288, 144, 0, 2341, 2340, 1, 0, + 0, 0, 2341, 2342, 1, 0, 0, 0, 2342, 2531, 1, 0, 0, 0, 2343, 2345, 5, 138, + 0, 0, 2344, 2346, 3, 732, 366, 0, 2345, 2344, 1, 0, 0, 0, 2345, 2346, 1, + 0, 0, 0, 2346, 2347, 1, 0, 0, 0, 2347, 2348, 3, 1384, 692, 0, 2348, 2349, + 3, 124, 62, 0, 2349, 2531, 1, 0, 0, 0, 2350, 2352, 5, 138, 0, 0, 2351, + 2353, 3, 732, 366, 0, 2352, 2351, 1, 0, 0, 0, 2352, 2353, 1, 0, 0, 0, 2353, + 2354, 1, 0, 0, 0, 2354, 2355, 3, 1384, 692, 0, 2355, 2356, 5, 191, 0, 0, + 2356, 2357, 5, 219, 0, 0, 2357, 2531, 1, 0, 0, 0, 2358, 2360, 5, 138, 0, + 0, 2359, 2361, 3, 732, 366, 0, 2360, 2359, 1, 0, 0, 0, 2360, 2361, 1, 0, + 0, 0, 2361, 2362, 1, 0, 0, 0, 2362, 2363, 3, 1384, 692, 0, 2363, 2364, + 5, 191, 0, 0, 2364, 2365, 5, 219, 0, 0, 2365, 2366, 5, 220, 0, 0, 2366, + 2367, 5, 390, 0, 0, 2367, 2531, 1, 0, 0, 0, 2368, 2370, 5, 191, 0, 0, 2369, + 2371, 3, 732, 366, 0, 2370, 2369, 1, 0, 0, 0, 2370, 2371, 1, 0, 0, 0, 2371, + 2372, 1, 0, 0, 0, 2372, 2373, 5, 220, 0, 0, 2373, 2374, 5, 390, 0, 0, 2374, + 2376, 3, 1384, 692, 0, 2375, 2377, 3, 108, 54, 0, 2376, 2375, 1, 0, 0, + 0, 2376, 2377, 1, 0, 0, 0, 2377, 2531, 1, 0, 0, 0, 2378, 2380, 5, 191, + 0, 0, 2379, 2381, 3, 732, 366, 0, 2380, 2379, 1, 0, 0, 0, 2380, 2381, 1, + 0, 0, 0, 2381, 2382, 1, 0, 0, 0, 2382, 2384, 3, 1384, 692, 0, 2383, 2385, + 3, 108, 54, 0, 2384, 2383, 1, 0, 0, 0, 2384, 2385, 1, 0, 0, 0, 2385, 2531, + 1, 0, 0, 0, 2386, 2388, 5, 138, 0, 0, 2387, 2389, 3, 732, 366, 0, 2388, + 2387, 1, 0, 0, 0, 2388, 2389, 1, 0, 0, 0, 2389, 2390, 1, 0, 0, 0, 2390, + 2392, 3, 1384, 692, 0, 2391, 2393, 3, 734, 367, 0, 2392, 2391, 1, 0, 0, + 0, 2392, 2393, 1, 0, 0, 0, 2393, 2394, 1, 0, 0, 0, 2394, 2395, 5, 353, + 0, 0, 2395, 2397, 3, 1128, 564, 0, 2396, 2398, 3, 110, 55, 0, 2397, 2396, + 1, 0, 0, 0, 2397, 2398, 1, 0, 0, 0, 2398, 2400, 1, 0, 0, 0, 2399, 2401, + 3, 112, 56, 0, 2400, 2399, 1, 0, 0, 0, 2400, 2401, 1, 0, 0, 0, 2401, 2531, + 1, 0, 0, 0, 2402, 2404, 5, 138, 0, 0, 2403, 2405, 3, 732, 366, 0, 2404, + 2403, 1, 0, 0, 0, 2404, 2405, 1, 0, 0, 0, 2405, 2406, 1, 0, 0, 0, 2406, + 2407, 3, 1384, 692, 0, 2407, 2408, 3, 348, 174, 0, 2408, 2531, 1, 0, 0, + 0, 2409, 2410, 5, 133, 0, 0, 2410, 2531, 3, 212, 106, 0, 2411, 2412, 5, + 138, 0, 0, 2412, 2413, 5, 45, 0, 0, 2413, 2414, 3, 1352, 676, 0, 2414, + 2415, 3, 444, 222, 0, 2415, 2531, 1, 0, 0, 0, 2416, 2417, 5, 365, 0, 0, + 2417, 2418, 5, 45, 0, 0, 2418, 2531, 3, 1352, 676, 0, 2419, 2420, 5, 191, + 0, 0, 2420, 2421, 5, 45, 0, 0, 2421, 2422, 5, 220, 0, 0, 2422, 2423, 5, + 390, 0, 0, 2423, 2425, 3, 1352, 676, 0, 2424, 2426, 3, 108, 54, 0, 2425, + 2424, 1, 0, 0, 0, 2425, 2426, 1, 0, 0, 0, 2426, 2531, 1, 0, 0, 0, 2427, + 2428, 5, 191, 0, 0, 2428, 2429, 5, 45, 0, 0, 2429, 2431, 3, 1352, 676, + 0, 2430, 2432, 3, 108, 54, 0, 2431, 2430, 1, 0, 0, 0, 2431, 2432, 1, 0, + 0, 0, 2432, 2531, 1, 0, 0, 0, 2433, 2434, 5, 326, 0, 0, 2434, 2435, 5, + 372, 0, 0, 2435, 2531, 5, 270, 0, 0, 2436, 2437, 5, 158, 0, 0, 2437, 2438, + 5, 80, 0, 0, 2438, 2531, 3, 1352, 676, 0, 2439, 2440, 5, 326, 0, 0, 2440, + 2441, 5, 372, 0, 0, 2441, 2531, 5, 158, 0, 0, 2442, 2443, 5, 326, 0, 0, + 2443, 2531, 5, 441, 0, 0, 2444, 2445, 5, 326, 0, 0, 2445, 2531, 5, 360, + 0, 0, 2446, 2447, 5, 193, 0, 0, 2447, 2448, 5, 350, 0, 0, 2448, 2531, 3, + 1352, 676, 0, 2449, 2450, 5, 193, 0, 0, 2450, 2451, 5, 139, 0, 0, 2451, + 2452, 5, 350, 0, 0, 2452, 2531, 3, 1352, 676, 0, 2453, 2454, 5, 193, 0, + 0, 2454, 2455, 5, 305, 0, 0, 2455, 2456, 5, 350, 0, 0, 2456, 2531, 3, 1352, + 676, 0, 2457, 2458, 5, 193, 0, 0, 2458, 2459, 5, 350, 0, 0, 2459, 2531, + 5, 30, 0, 0, 2460, 2461, 5, 193, 0, 0, 2461, 2462, 5, 350, 0, 0, 2462, + 2531, 5, 99, 0, 0, 2463, 2464, 5, 186, 0, 0, 2464, 2465, 5, 350, 0, 0, + 2465, 2531, 3, 1352, 676, 0, 2466, 2467, 5, 186, 0, 0, 2467, 2468, 5, 350, + 0, 0, 2468, 2531, 5, 30, 0, 0, 2469, 2470, 5, 186, 0, 0, 2470, 2471, 5, + 350, 0, 0, 2471, 2531, 5, 99, 0, 0, 2472, 2473, 5, 193, 0, 0, 2473, 2474, + 5, 314, 0, 0, 2474, 2531, 3, 1352, 676, 0, 2475, 2476, 5, 193, 0, 0, 2476, + 2477, 5, 139, 0, 0, 2477, 2478, 5, 314, 0, 0, 2478, 2531, 3, 1352, 676, + 0, 2479, 2480, 5, 193, 0, 0, 2480, 2481, 5, 305, 0, 0, 2481, 2482, 5, 314, + 0, 0, 2482, 2531, 3, 1352, 676, 0, 2483, 2484, 5, 186, 0, 0, 2484, 2485, + 5, 314, 0, 0, 2485, 2531, 3, 1352, 676, 0, 2486, 2487, 5, 228, 0, 0, 2487, + 2531, 3, 1348, 674, 0, 2488, 2489, 5, 262, 0, 0, 2489, 2490, 5, 228, 0, + 0, 2490, 2531, 3, 1348, 674, 0, 2491, 2492, 5, 268, 0, 0, 2492, 2531, 3, + 528, 264, 0, 2493, 2494, 5, 77, 0, 0, 2494, 2531, 5, 268, 0, 0, 2495, 2496, + 5, 275, 0, 0, 2496, 2497, 5, 94, 0, 0, 2497, 2531, 3, 1380, 690, 0, 2498, + 2499, 5, 326, 0, 0, 2499, 2500, 5, 131, 0, 0, 2500, 2501, 5, 448, 0, 0, + 2501, 2531, 3, 1352, 676, 0, 2502, 2503, 5, 326, 0, 0, 2503, 2504, 5, 344, + 0, 0, 2504, 2531, 3, 1352, 676, 0, 2505, 2506, 5, 326, 0, 0, 2506, 2531, + 3, 116, 58, 0, 2507, 2508, 5, 306, 0, 0, 2508, 2531, 3, 116, 58, 0, 2509, + 2510, 5, 305, 0, 0, 2510, 2511, 5, 219, 0, 0, 2511, 2531, 3, 114, 57, 0, + 2512, 2513, 5, 193, 0, 0, 2513, 2514, 5, 409, 0, 0, 2514, 2515, 5, 242, + 0, 0, 2515, 2531, 5, 320, 0, 0, 2516, 2517, 5, 186, 0, 0, 2517, 2518, 5, + 409, 0, 0, 2518, 2519, 5, 242, 0, 0, 2519, 2531, 5, 320, 0, 0, 2520, 2521, + 5, 209, 0, 0, 2521, 2522, 5, 409, 0, 0, 2522, 2523, 5, 242, 0, 0, 2523, + 2531, 5, 320, 0, 0, 2524, 2525, 5, 262, 0, 0, 2525, 2526, 5, 209, 0, 0, + 2526, 2527, 5, 409, 0, 0, 2527, 2528, 5, 242, 0, 0, 2528, 2531, 5, 320, + 0, 0, 2529, 2531, 3, 348, 174, 0, 2530, 2228, 1, 0, 0, 0, 2530, 2230, 1, + 0, 0, 0, 2530, 2235, 1, 0, 0, 0, 2530, 2238, 1, 0, 0, 0, 2530, 2244, 1, + 0, 0, 0, 2530, 2251, 1, 0, 0, 0, 2530, 2260, 1, 0, 0, 0, 2530, 2269, 1, + 0, 0, 0, 2530, 2277, 1, 0, 0, 0, 2530, 2287, 1, 0, 0, 0, 2530, 2296, 1, + 0, 0, 0, 2530, 2305, 1, 0, 0, 0, 2530, 2313, 1, 0, 0, 0, 2530, 2321, 1, + 0, 0, 0, 2530, 2330, 1, 0, 0, 0, 2530, 2343, 1, 0, 0, 0, 2530, 2350, 1, + 0, 0, 0, 2530, 2358, 1, 0, 0, 0, 2530, 2368, 1, 0, 0, 0, 2530, 2378, 1, + 0, 0, 0, 2530, 2386, 1, 0, 0, 0, 2530, 2402, 1, 0, 0, 0, 2530, 2409, 1, + 0, 0, 0, 2530, 2411, 1, 0, 0, 0, 2530, 2416, 1, 0, 0, 0, 2530, 2419, 1, + 0, 0, 0, 2530, 2427, 1, 0, 0, 0, 2530, 2433, 1, 0, 0, 0, 2530, 2436, 1, + 0, 0, 0, 2530, 2439, 1, 0, 0, 0, 2530, 2442, 1, 0, 0, 0, 2530, 2444, 1, + 0, 0, 0, 2530, 2446, 1, 0, 0, 0, 2530, 2449, 1, 0, 0, 0, 2530, 2453, 1, + 0, 0, 0, 2530, 2457, 1, 0, 0, 0, 2530, 2460, 1, 0, 0, 0, 2530, 2463, 1, + 0, 0, 0, 2530, 2466, 1, 0, 0, 0, 2530, 2469, 1, 0, 0, 0, 2530, 2472, 1, + 0, 0, 0, 2530, 2475, 1, 0, 0, 0, 2530, 2479, 1, 0, 0, 0, 2530, 2483, 1, + 0, 0, 0, 2530, 2486, 1, 0, 0, 0, 2530, 2488, 1, 0, 0, 0, 2530, 2491, 1, + 0, 0, 0, 2530, 2493, 1, 0, 0, 0, 2530, 2495, 1, 0, 0, 0, 2530, 2498, 1, + 0, 0, 0, 2530, 2502, 1, 0, 0, 0, 2530, 2505, 1, 0, 0, 0, 2530, 2507, 1, + 0, 0, 0, 2530, 2509, 1, 0, 0, 0, 2530, 2512, 1, 0, 0, 0, 2530, 2516, 1, + 0, 0, 0, 2530, 2520, 1, 0, 0, 0, 2530, 2524, 1, 0, 0, 0, 2530, 2529, 1, + 0, 0, 0, 2531, 105, 1, 0, 0, 0, 2532, 2533, 5, 326, 0, 0, 2533, 2534, 5, + 53, 0, 0, 2534, 2538, 3, 1172, 586, 0, 2535, 2536, 5, 191, 0, 0, 2536, + 2538, 5, 53, 0, 0, 2537, 2532, 1, 0, 0, 0, 2537, 2535, 1, 0, 0, 0, 2538, + 107, 1, 0, 0, 0, 2539, 2540, 7, 10, 0, 0, 2540, 109, 1, 0, 0, 0, 2541, + 2542, 5, 43, 0, 0, 2542, 2543, 3, 528, 264, 0, 2543, 111, 1, 0, 0, 0, 2544, + 2545, 5, 100, 0, 0, 2545, 2546, 3, 1172, 586, 0, 2546, 113, 1, 0, 0, 0, + 2547, 2554, 5, 263, 0, 0, 2548, 2554, 5, 113, 0, 0, 2549, 2554, 5, 53, + 0, 0, 2550, 2551, 5, 100, 0, 0, 2551, 2552, 5, 226, 0, 0, 2552, 2554, 3, + 1352, 676, 0, 2553, 2547, 1, 0, 0, 0, 2553, 2548, 1, 0, 0, 0, 2553, 2549, + 1, 0, 0, 0, 2553, 2550, 1, 0, 0, 0, 2554, 115, 1, 0, 0, 0, 2555, 2556, + 5, 2, 0, 0, 2556, 2557, 3, 120, 60, 0, 2557, 2558, 5, 3, 0, 0, 2558, 117, + 1, 0, 0, 0, 2559, 2560, 5, 105, 0, 0, 2560, 2561, 3, 116, 58, 0, 2561, + 119, 1, 0, 0, 0, 2562, 2567, 3, 122, 61, 0, 2563, 2564, 5, 6, 0, 0, 2564, + 2566, 3, 122, 61, 0, 2565, 2563, 1, 0, 0, 0, 2566, 2569, 1, 0, 0, 0, 2567, + 2565, 1, 0, 0, 0, 2567, 2568, 1, 0, 0, 0, 2568, 121, 1, 0, 0, 0, 2569, + 2567, 1, 0, 0, 0, 2570, 2579, 3, 1392, 696, 0, 2571, 2572, 5, 10, 0, 0, + 2572, 2580, 3, 470, 235, 0, 2573, 2574, 5, 11, 0, 0, 2574, 2577, 3, 1392, + 696, 0, 2575, 2576, 5, 10, 0, 0, 2576, 2578, 3, 470, 235, 0, 2577, 2575, + 1, 0, 0, 0, 2577, 2578, 1, 0, 0, 0, 2578, 2580, 1, 0, 0, 0, 2579, 2571, + 1, 0, 0, 0, 2579, 2573, 1, 0, 0, 0, 2579, 2580, 1, 0, 0, 0, 2580, 123, + 1, 0, 0, 0, 2581, 2583, 3, 126, 63, 0, 2582, 2581, 1, 0, 0, 0, 2583, 2584, + 1, 0, 0, 0, 2584, 2582, 1, 0, 0, 0, 2584, 2585, 1, 0, 0, 0, 2585, 125, + 1, 0, 0, 0, 2586, 2591, 5, 307, 0, 0, 2587, 2589, 3, 16, 8, 0, 2588, 2587, + 1, 0, 0, 0, 2588, 2589, 1, 0, 0, 0, 2589, 2590, 1, 0, 0, 0, 2590, 2592, + 3, 296, 148, 0, 2591, 2588, 1, 0, 0, 0, 2591, 2592, 1, 0, 0, 0, 2592, 2600, + 1, 0, 0, 0, 2593, 2597, 5, 326, 0, 0, 2594, 2598, 3, 292, 146, 0, 2595, + 2596, 5, 440, 0, 0, 2596, 2598, 3, 202, 101, 0, 2597, 2594, 1, 0, 0, 0, + 2597, 2595, 1, 0, 0, 0, 2598, 2600, 1, 0, 0, 0, 2599, 2586, 1, 0, 0, 0, + 2599, 2593, 1, 0, 0, 0, 2600, 127, 1, 0, 0, 0, 2601, 2602, 5, 62, 0, 0, + 2602, 2603, 5, 417, 0, 0, 2603, 2604, 5, 105, 0, 0, 2604, 2605, 5, 2, 0, + 0, 2605, 2606, 3, 132, 66, 0, 2606, 2607, 5, 3, 0, 0, 2607, 2628, 1, 0, + 0, 0, 2608, 2609, 5, 62, 0, 0, 2609, 2610, 5, 417, 0, 0, 2610, 2611, 5, + 68, 0, 0, 2611, 2612, 5, 2, 0, 0, 2612, 2613, 3, 1290, 645, 0, 2613, 2614, + 5, 3, 0, 0, 2614, 2628, 1, 0, 0, 0, 2615, 2616, 5, 62, 0, 0, 2616, 2617, + 5, 417, 0, 0, 2617, 2618, 5, 64, 0, 0, 2618, 2619, 5, 2, 0, 0, 2619, 2620, + 3, 1290, 645, 0, 2620, 2621, 5, 3, 0, 0, 2621, 2622, 5, 94, 0, 0, 2622, + 2623, 5, 2, 0, 0, 2623, 2624, 3, 1290, 645, 0, 2624, 2625, 5, 3, 0, 0, + 2625, 2628, 1, 0, 0, 0, 2626, 2628, 5, 53, 0, 0, 2627, 2601, 1, 0, 0, 0, + 2627, 2608, 1, 0, 0, 0, 2627, 2615, 1, 0, 0, 0, 2627, 2626, 1, 0, 0, 0, + 2628, 129, 1, 0, 0, 0, 2629, 2630, 3, 1390, 695, 0, 2630, 2631, 3, 1368, + 684, 0, 2631, 131, 1, 0, 0, 0, 2632, 2637, 3, 130, 65, 0, 2633, 2634, 5, + 6, 0, 0, 2634, 2636, 3, 130, 65, 0, 2635, 2633, 1, 0, 0, 0, 2636, 2639, + 1, 0, 0, 0, 2637, 2635, 1, 0, 0, 0, 2637, 2638, 1, 0, 0, 0, 2638, 133, + 1, 0, 0, 0, 2639, 2637, 1, 0, 0, 0, 2640, 2641, 5, 138, 0, 0, 2641, 2642, + 5, 353, 0, 0, 2642, 2643, 3, 528, 264, 0, 2643, 2644, 3, 136, 68, 0, 2644, + 135, 1, 0, 0, 0, 2645, 2650, 3, 138, 69, 0, 2646, 2647, 5, 6, 0, 0, 2647, + 2649, 3, 138, 69, 0, 2648, 2646, 1, 0, 0, 0, 2649, 2652, 1, 0, 0, 0, 2650, + 2648, 1, 0, 0, 0, 2650, 2651, 1, 0, 0, 0, 2651, 137, 1, 0, 0, 0, 2652, + 2650, 1, 0, 0, 0, 2653, 2654, 5, 133, 0, 0, 2654, 2655, 5, 143, 0, 0, 2655, + 2657, 3, 1112, 556, 0, 2656, 2658, 3, 108, 54, 0, 2657, 2656, 1, 0, 0, + 0, 2657, 2658, 1, 0, 0, 0, 2658, 2684, 1, 0, 0, 0, 2659, 2660, 5, 191, + 0, 0, 2660, 2663, 5, 143, 0, 0, 2661, 2662, 5, 220, 0, 0, 2662, 2664, 5, + 390, 0, 0, 2663, 2661, 1, 0, 0, 0, 2663, 2664, 1, 0, 0, 0, 2664, 2665, + 1, 0, 0, 0, 2665, 2667, 3, 1384, 692, 0, 2666, 2668, 3, 108, 54, 0, 2667, + 2666, 1, 0, 0, 0, 2667, 2668, 1, 0, 0, 0, 2668, 2684, 1, 0, 0, 0, 2669, + 2670, 5, 138, 0, 0, 2670, 2671, 5, 143, 0, 0, 2671, 2673, 3, 1384, 692, + 0, 2672, 2674, 3, 734, 367, 0, 2673, 2672, 1, 0, 0, 0, 2673, 2674, 1, 0, + 0, 0, 2674, 2675, 1, 0, 0, 0, 2675, 2676, 5, 353, 0, 0, 2676, 2678, 3, + 1128, 564, 0, 2677, 2679, 3, 110, 55, 0, 2678, 2677, 1, 0, 0, 0, 2678, + 2679, 1, 0, 0, 0, 2679, 2681, 1, 0, 0, 0, 2680, 2682, 3, 108, 54, 0, 2681, + 2680, 1, 0, 0, 0, 2681, 2682, 1, 0, 0, 0, 2682, 2684, 1, 0, 0, 0, 2683, + 2653, 1, 0, 0, 0, 2683, 2659, 1, 0, 0, 0, 2683, 2669, 1, 0, 0, 0, 2684, + 139, 1, 0, 0, 0, 2685, 2688, 5, 157, 0, 0, 2686, 2689, 3, 964, 482, 0, + 2687, 2689, 5, 30, 0, 0, 2688, 2686, 1, 0, 0, 0, 2688, 2687, 1, 0, 0, 0, + 2689, 141, 1, 0, 0, 0, 2690, 2692, 5, 169, 0, 0, 2691, 2693, 3, 156, 78, + 0, 2692, 2691, 1, 0, 0, 0, 2692, 2693, 1, 0, 0, 0, 2693, 2694, 1, 0, 0, + 0, 2694, 2696, 3, 1348, 674, 0, 2695, 2697, 3, 218, 109, 0, 2696, 2695, + 1, 0, 0, 0, 2696, 2697, 1, 0, 0, 0, 2697, 2698, 1, 0, 0, 0, 2698, 2700, + 3, 144, 72, 0, 2699, 2701, 3, 146, 73, 0, 2700, 2699, 1, 0, 0, 0, 2700, + 2701, 1, 0, 0, 0, 2701, 2702, 1, 0, 0, 0, 2702, 2704, 3, 148, 74, 0, 2703, + 2705, 3, 158, 79, 0, 2704, 2703, 1, 0, 0, 0, 2704, 2705, 1, 0, 0, 0, 2705, + 2707, 1, 0, 0, 0, 2706, 2708, 3, 16, 8, 0, 2707, 2706, 1, 0, 0, 0, 2707, + 2708, 1, 0, 0, 0, 2708, 2709, 1, 0, 0, 0, 2709, 2711, 3, 150, 75, 0, 2710, + 2712, 3, 1104, 552, 0, 2711, 2710, 1, 0, 0, 0, 2711, 2712, 1, 0, 0, 0, + 2712, 2728, 1, 0, 0, 0, 2713, 2714, 5, 169, 0, 0, 2714, 2715, 5, 2, 0, + 0, 2715, 2716, 3, 904, 452, 0, 2716, 2717, 5, 3, 0, 0, 2717, 2719, 5, 94, + 0, 0, 2718, 2720, 3, 146, 73, 0, 2719, 2718, 1, 0, 0, 0, 2719, 2720, 1, + 0, 0, 0, 2720, 2721, 1, 0, 0, 0, 2721, 2723, 3, 148, 74, 0, 2722, 2724, + 3, 16, 8, 0, 2723, 2722, 1, 0, 0, 0, 2723, 2724, 1, 0, 0, 0, 2724, 2725, + 1, 0, 0, 0, 2725, 2726, 3, 150, 75, 0, 2726, 2728, 1, 0, 0, 0, 2727, 2690, + 1, 0, 0, 0, 2727, 2713, 1, 0, 0, 0, 2728, 143, 1, 0, 0, 0, 2729, 2730, + 7, 11, 0, 0, 2730, 145, 1, 0, 0, 0, 2731, 2732, 5, 290, 0, 0, 2732, 147, + 1, 0, 0, 0, 2733, 2737, 3, 1370, 685, 0, 2734, 2737, 5, 336, 0, 0, 2735, + 2737, 5, 337, 0, 0, 2736, 2733, 1, 0, 0, 0, 2736, 2734, 1, 0, 0, 0, 2736, + 2735, 1, 0, 0, 0, 2737, 149, 1, 0, 0, 0, 2738, 2744, 3, 152, 76, 0, 2739, + 2740, 5, 2, 0, 0, 2740, 2741, 3, 162, 81, 0, 2741, 2742, 5, 3, 0, 0, 2742, + 2744, 1, 0, 0, 0, 2743, 2738, 1, 0, 0, 0, 2743, 2739, 1, 0, 0, 0, 2744, + 151, 1, 0, 0, 0, 2745, 2747, 3, 154, 77, 0, 2746, 2745, 1, 0, 0, 0, 2747, + 2750, 1, 0, 0, 0, 2748, 2746, 1, 0, 0, 0, 2748, 2749, 1, 0, 0, 0, 2749, + 153, 1, 0, 0, 0, 2750, 2748, 1, 0, 0, 0, 2751, 2791, 5, 107, 0, 0, 2752, + 2791, 5, 112, 0, 0, 2753, 2755, 5, 183, 0, 0, 2754, 2756, 3, 844, 422, + 0, 2755, 2754, 1, 0, 0, 0, 2755, 2756, 1, 0, 0, 0, 2756, 2757, 1, 0, 0, + 0, 2757, 2791, 3, 1370, 685, 0, 2758, 2760, 5, 78, 0, 0, 2759, 2761, 3, + 844, 422, 0, 2760, 2759, 1, 0, 0, 0, 2760, 2761, 1, 0, 0, 0, 2761, 2762, + 1, 0, 0, 0, 2762, 2791, 3, 1370, 685, 0, 2763, 2791, 5, 171, 0, 0, 2764, + 2791, 5, 216, 0, 0, 2765, 2767, 5, 291, 0, 0, 2766, 2768, 3, 844, 422, + 0, 2767, 2766, 1, 0, 0, 0, 2767, 2768, 1, 0, 0, 0, 2768, 2769, 1, 0, 0, + 0, 2769, 2791, 3, 1370, 685, 0, 2770, 2772, 5, 197, 0, 0, 2771, 2773, 3, + 844, 422, 0, 2772, 2771, 1, 0, 0, 0, 2772, 2773, 1, 0, 0, 0, 2773, 2774, + 1, 0, 0, 0, 2774, 2791, 3, 1370, 685, 0, 2775, 2776, 5, 209, 0, 0, 2776, + 2777, 5, 291, 0, 0, 2777, 2791, 3, 220, 110, 0, 2778, 2779, 5, 209, 0, + 0, 2779, 2780, 5, 291, 0, 0, 2780, 2791, 5, 9, 0, 0, 2781, 2782, 5, 209, + 0, 0, 2782, 2783, 5, 77, 0, 0, 2783, 2784, 5, 78, 0, 0, 2784, 2791, 3, + 220, 110, 0, 2785, 2786, 5, 209, 0, 0, 2786, 2787, 5, 78, 0, 0, 2787, 2791, + 3, 220, 110, 0, 2788, 2789, 5, 194, 0, 0, 2789, 2791, 3, 1370, 685, 0, + 2790, 2751, 1, 0, 0, 0, 2790, 2752, 1, 0, 0, 0, 2790, 2753, 1, 0, 0, 0, + 2790, 2758, 1, 0, 0, 0, 2790, 2763, 1, 0, 0, 0, 2790, 2764, 1, 0, 0, 0, + 2790, 2765, 1, 0, 0, 0, 2790, 2770, 1, 0, 0, 0, 2790, 2775, 1, 0, 0, 0, + 2790, 2778, 1, 0, 0, 0, 2790, 2781, 1, 0, 0, 0, 2790, 2785, 1, 0, 0, 0, + 2790, 2788, 1, 0, 0, 0, 2791, 155, 1, 0, 0, 0, 2792, 2793, 5, 107, 0, 0, + 2793, 157, 1, 0, 0, 0, 2794, 2796, 3, 160, 80, 0, 2795, 2794, 1, 0, 0, + 0, 2795, 2796, 1, 0, 0, 0, 2796, 2797, 1, 0, 0, 0, 2797, 2798, 5, 184, + 0, 0, 2798, 2799, 3, 1370, 685, 0, 2799, 159, 1, 0, 0, 0, 2800, 2801, 5, + 100, 0, 0, 2801, 161, 1, 0, 0, 0, 2802, 2807, 3, 164, 82, 0, 2803, 2804, + 5, 6, 0, 0, 2804, 2806, 3, 164, 82, 0, 2805, 2803, 1, 0, 0, 0, 2806, 2809, + 1, 0, 0, 0, 2807, 2805, 1, 0, 0, 0, 2807, 2808, 1, 0, 0, 0, 2808, 163, + 1, 0, 0, 0, 2809, 2807, 1, 0, 0, 0, 2810, 2812, 3, 1392, 696, 0, 2811, + 2813, 3, 166, 83, 0, 2812, 2811, 1, 0, 0, 0, 2812, 2813, 1, 0, 0, 0, 2813, + 165, 1, 0, 0, 0, 2814, 2822, 3, 66, 33, 0, 2815, 2822, 3, 296, 148, 0, + 2816, 2822, 5, 9, 0, 0, 2817, 2818, 5, 2, 0, 0, 2818, 2819, 3, 168, 84, + 0, 2819, 2820, 5, 3, 0, 0, 2820, 2822, 1, 0, 0, 0, 2821, 2814, 1, 0, 0, + 0, 2821, 2815, 1, 0, 0, 0, 2821, 2816, 1, 0, 0, 0, 2821, 2817, 1, 0, 0, + 0, 2822, 167, 1, 0, 0, 0, 2823, 2828, 3, 170, 85, 0, 2824, 2825, 5, 6, + 0, 0, 2825, 2827, 3, 170, 85, 0, 2826, 2824, 1, 0, 0, 0, 2827, 2830, 1, + 0, 0, 0, 2828, 2826, 1, 0, 0, 0, 2828, 2829, 1, 0, 0, 0, 2829, 169, 1, + 0, 0, 0, 2830, 2828, 1, 0, 0, 0, 2831, 2832, 3, 66, 33, 0, 2832, 171, 1, + 0, 0, 0, 2833, 2835, 5, 46, 0, 0, 2834, 2836, 3, 174, 87, 0, 2835, 2834, + 1, 0, 0, 0, 2835, 2836, 1, 0, 0, 0, 2836, 2837, 1, 0, 0, 0, 2837, 2841, + 5, 92, 0, 0, 2838, 2839, 5, 220, 0, 0, 2839, 2840, 5, 77, 0, 0, 2840, 2842, + 5, 390, 0, 0, 2841, 2838, 1, 0, 0, 0, 2841, 2842, 1, 0, 0, 0, 2842, 2843, + 1, 0, 0, 0, 2843, 2909, 3, 1348, 674, 0, 2844, 2846, 5, 2, 0, 0, 2845, + 2847, 3, 176, 88, 0, 2846, 2845, 1, 0, 0, 0, 2846, 2847, 1, 0, 0, 0, 2847, + 2848, 1, 0, 0, 0, 2848, 2850, 5, 3, 0, 0, 2849, 2851, 3, 242, 121, 0, 2850, + 2849, 1, 0, 0, 0, 2850, 2851, 1, 0, 0, 0, 2851, 2853, 1, 0, 0, 0, 2852, + 2854, 3, 244, 122, 0, 2853, 2852, 1, 0, 0, 0, 2853, 2854, 1, 0, 0, 0, 2854, + 2856, 1, 0, 0, 0, 2855, 2857, 3, 252, 126, 0, 2856, 2855, 1, 0, 0, 0, 2856, + 2857, 1, 0, 0, 0, 2857, 2859, 1, 0, 0, 0, 2858, 2860, 3, 254, 127, 0, 2859, + 2858, 1, 0, 0, 0, 2859, 2860, 1, 0, 0, 0, 2860, 2862, 1, 0, 0, 0, 2861, + 2863, 3, 256, 128, 0, 2862, 2861, 1, 0, 0, 0, 2862, 2863, 1, 0, 0, 0, 2863, + 2865, 1, 0, 0, 0, 2864, 2866, 3, 258, 129, 0, 2865, 2864, 1, 0, 0, 0, 2865, + 2866, 1, 0, 0, 0, 2866, 2910, 1, 0, 0, 0, 2867, 2868, 5, 268, 0, 0, 2868, + 2870, 3, 528, 264, 0, 2869, 2871, 3, 178, 89, 0, 2870, 2869, 1, 0, 0, 0, + 2870, 2871, 1, 0, 0, 0, 2871, 2873, 1, 0, 0, 0, 2872, 2874, 3, 244, 122, + 0, 2873, 2872, 1, 0, 0, 0, 2873, 2874, 1, 0, 0, 0, 2874, 2876, 1, 0, 0, + 0, 2875, 2877, 3, 252, 126, 0, 2876, 2875, 1, 0, 0, 0, 2876, 2877, 1, 0, + 0, 0, 2877, 2879, 1, 0, 0, 0, 2878, 2880, 3, 254, 127, 0, 2879, 2878, 1, + 0, 0, 0, 2879, 2880, 1, 0, 0, 0, 2880, 2882, 1, 0, 0, 0, 2881, 2883, 3, + 256, 128, 0, 2882, 2881, 1, 0, 0, 0, 2882, 2883, 1, 0, 0, 0, 2883, 2885, + 1, 0, 0, 0, 2884, 2886, 3, 258, 129, 0, 2885, 2884, 1, 0, 0, 0, 2885, 2886, + 1, 0, 0, 0, 2886, 2910, 1, 0, 0, 0, 2887, 2888, 5, 278, 0, 0, 2888, 2889, + 5, 268, 0, 0, 2889, 2891, 3, 1348, 674, 0, 2890, 2892, 3, 178, 89, 0, 2891, + 2890, 1, 0, 0, 0, 2891, 2892, 1, 0, 0, 0, 2892, 2893, 1, 0, 0, 0, 2893, + 2895, 3, 128, 64, 0, 2894, 2896, 3, 244, 122, 0, 2895, 2894, 1, 0, 0, 0, + 2895, 2896, 1, 0, 0, 0, 2896, 2898, 1, 0, 0, 0, 2897, 2899, 3, 252, 126, + 0, 2898, 2897, 1, 0, 0, 0, 2898, 2899, 1, 0, 0, 0, 2899, 2901, 1, 0, 0, + 0, 2900, 2902, 3, 254, 127, 0, 2901, 2900, 1, 0, 0, 0, 2901, 2902, 1, 0, + 0, 0, 2902, 2904, 1, 0, 0, 0, 2903, 2905, 3, 256, 128, 0, 2904, 2903, 1, + 0, 0, 0, 2904, 2905, 1, 0, 0, 0, 2905, 2907, 1, 0, 0, 0, 2906, 2908, 3, + 258, 129, 0, 2907, 2906, 1, 0, 0, 0, 2907, 2908, 1, 0, 0, 0, 2908, 2910, + 1, 0, 0, 0, 2909, 2844, 1, 0, 0, 0, 2909, 2867, 1, 0, 0, 0, 2909, 2887, + 1, 0, 0, 0, 2910, 173, 1, 0, 0, 0, 2911, 2919, 5, 347, 0, 0, 2912, 2919, + 5, 345, 0, 0, 2913, 2914, 5, 245, 0, 0, 2914, 2919, 7, 12, 0, 0, 2915, + 2916, 5, 213, 0, 0, 2916, 2919, 7, 12, 0, 0, 2917, 2919, 5, 360, 0, 0, + 2918, 2911, 1, 0, 0, 0, 2918, 2912, 1, 0, 0, 0, 2918, 2913, 1, 0, 0, 0, + 2918, 2915, 1, 0, 0, 0, 2918, 2917, 1, 0, 0, 0, 2919, 175, 1, 0, 0, 0, + 2920, 2921, 3, 180, 90, 0, 2921, 177, 1, 0, 0, 0, 2922, 2923, 5, 2, 0, + 0, 2923, 2924, 3, 182, 91, 0, 2924, 2925, 5, 3, 0, 0, 2925, 179, 1, 0, + 0, 0, 2926, 2931, 3, 184, 92, 0, 2927, 2928, 5, 6, 0, 0, 2928, 2930, 3, + 184, 92, 0, 2929, 2927, 1, 0, 0, 0, 2930, 2933, 1, 0, 0, 0, 2931, 2929, + 1, 0, 0, 0, 2931, 2932, 1, 0, 0, 0, 2932, 181, 1, 0, 0, 0, 2933, 2931, + 1, 0, 0, 0, 2934, 2939, 3, 186, 93, 0, 2935, 2936, 5, 6, 0, 0, 2936, 2938, + 3, 186, 93, 0, 2937, 2935, 1, 0, 0, 0, 2938, 2941, 1, 0, 0, 0, 2939, 2937, + 1, 0, 0, 0, 2939, 2940, 1, 0, 0, 0, 2940, 183, 1, 0, 0, 0, 2941, 2939, + 1, 0, 0, 0, 2942, 2946, 3, 212, 106, 0, 2943, 2946, 3, 206, 103, 0, 2944, + 2946, 3, 188, 94, 0, 2945, 2942, 1, 0, 0, 0, 2945, 2943, 1, 0, 0, 0, 2945, + 2944, 1, 0, 0, 0, 2946, 185, 1, 0, 0, 0, 2947, 2950, 3, 192, 96, 0, 2948, + 2950, 3, 212, 106, 0, 2949, 2947, 1, 0, 0, 0, 2949, 2948, 1, 0, 0, 0, 2950, + 187, 1, 0, 0, 0, 2951, 2952, 4, 94, 0, 1, 2952, 2953, 3, 1384, 692, 0, + 2953, 2955, 3, 1128, 564, 0, 2954, 2956, 3, 344, 172, 0, 2955, 2954, 1, + 0, 0, 0, 2955, 2956, 1, 0, 0, 0, 2956, 2957, 1, 0, 0, 0, 2957, 2958, 3, + 194, 97, 0, 2958, 2971, 1, 0, 0, 0, 2959, 2960, 4, 94, 1, 1, 2960, 2961, + 3, 1384, 692, 0, 2961, 2963, 3, 1128, 564, 0, 2962, 2964, 3, 344, 172, + 0, 2963, 2962, 1, 0, 0, 0, 2963, 2964, 1, 0, 0, 0, 2964, 2966, 1, 0, 0, + 0, 2965, 2967, 3, 190, 95, 0, 2966, 2965, 1, 0, 0, 0, 2966, 2967, 1, 0, + 0, 0, 2967, 2968, 1, 0, 0, 0, 2968, 2969, 3, 194, 97, 0, 2969, 2971, 1, + 0, 0, 0, 2970, 2951, 1, 0, 0, 0, 2970, 2959, 1, 0, 0, 0, 2971, 189, 1, + 0, 0, 0, 2972, 2973, 5, 53, 0, 0, 2973, 2999, 3, 1214, 607, 0, 2974, 2975, + 5, 219, 0, 0, 2975, 2976, 5, 2, 0, 0, 2976, 2977, 3, 1368, 684, 0, 2977, + 2978, 5, 6, 0, 0, 2978, 2979, 3, 1368, 684, 0, 2979, 2980, 5, 3, 0, 0, + 2980, 2999, 1, 0, 0, 0, 2981, 2982, 5, 440, 0, 0, 2982, 2983, 5, 147, 0, + 0, 2983, 2984, 5, 53, 0, 0, 2984, 2985, 5, 36, 0, 0, 2985, 2986, 5, 219, + 0, 0, 2986, 2987, 5, 2, 0, 0, 2987, 2988, 3, 1368, 684, 0, 2988, 2989, + 5, 6, 0, 0, 2989, 2990, 3, 1368, 684, 0, 2990, 2991, 5, 3, 0, 0, 2991, + 2999, 1, 0, 0, 0, 2992, 2993, 5, 638, 0, 0, 2993, 2999, 5, 652, 0, 0, 2994, + 2999, 5, 639, 0, 0, 2995, 2999, 5, 640, 0, 0, 2996, 2997, 5, 43, 0, 0, + 2997, 2999, 7, 13, 0, 0, 2998, 2972, 1, 0, 0, 0, 2998, 2974, 1, 0, 0, 0, + 2998, 2981, 1, 0, 0, 0, 2998, 2992, 1, 0, 0, 0, 2998, 2994, 1, 0, 0, 0, + 2998, 2995, 1, 0, 0, 0, 2998, 2996, 1, 0, 0, 0, 2999, 191, 1, 0, 0, 0, + 3000, 3003, 3, 1384, 692, 0, 3001, 3002, 5, 105, 0, 0, 3002, 3004, 5, 273, + 0, 0, 3003, 3001, 1, 0, 0, 0, 3003, 3004, 1, 0, 0, 0, 3004, 3005, 1, 0, + 0, 0, 3005, 3006, 3, 194, 97, 0, 3006, 193, 1, 0, 0, 0, 3007, 3009, 3, + 196, 98, 0, 3008, 3007, 1, 0, 0, 0, 3009, 3012, 1, 0, 0, 0, 3010, 3008, + 1, 0, 0, 0, 3010, 3011, 1, 0, 0, 0, 3011, 195, 1, 0, 0, 0, 3012, 3010, + 1, 0, 0, 0, 3013, 3014, 5, 45, 0, 0, 3014, 3015, 3, 1352, 676, 0, 3015, + 3016, 3, 198, 99, 0, 3016, 3022, 1, 0, 0, 0, 3017, 3022, 3, 198, 99, 0, + 3018, 3022, 3, 204, 102, 0, 3019, 3020, 5, 43, 0, 0, 3020, 3022, 3, 528, + 264, 0, 3021, 3013, 1, 0, 0, 0, 3021, 3017, 1, 0, 0, 0, 3021, 3018, 1, + 0, 0, 0, 3021, 3019, 1, 0, 0, 0, 3022, 197, 1, 0, 0, 0, 3023, 3024, 5, + 77, 0, 0, 3024, 3079, 5, 78, 0, 0, 3025, 3079, 5, 78, 0, 0, 3026, 3028, + 5, 98, 0, 0, 3027, 3029, 3, 200, 100, 0, 3028, 3027, 1, 0, 0, 0, 3028, + 3029, 1, 0, 0, 0, 3029, 3031, 1, 0, 0, 0, 3030, 3032, 3, 672, 336, 0, 3031, + 3030, 1, 0, 0, 0, 3031, 3032, 1, 0, 0, 0, 3032, 3034, 1, 0, 0, 0, 3033, + 3035, 3, 260, 130, 0, 3034, 3033, 1, 0, 0, 0, 3034, 3035, 1, 0, 0, 0, 3035, + 3079, 1, 0, 0, 0, 3036, 3037, 5, 85, 0, 0, 3037, 3039, 5, 236, 0, 0, 3038, + 3040, 3, 672, 336, 0, 3039, 3038, 1, 0, 0, 0, 3039, 3040, 1, 0, 0, 0, 3040, + 3042, 1, 0, 0, 0, 3041, 3043, 3, 260, 130, 0, 3042, 3041, 1, 0, 0, 0, 3042, + 3043, 1, 0, 0, 0, 3043, 3079, 1, 0, 0, 0, 3044, 3045, 5, 42, 0, 0, 3045, + 3046, 5, 2, 0, 0, 3046, 3047, 3, 1172, 586, 0, 3047, 3049, 5, 3, 0, 0, + 3048, 3050, 3, 216, 108, 0, 3049, 3048, 1, 0, 0, 0, 3049, 3050, 1, 0, 0, + 0, 3050, 3079, 1, 0, 0, 0, 3051, 3052, 5, 53, 0, 0, 3052, 3079, 3, 1214, + 607, 0, 3053, 3054, 5, 440, 0, 0, 3054, 3055, 3, 202, 101, 0, 3055, 3065, + 5, 36, 0, 0, 3056, 3058, 5, 219, 0, 0, 3057, 3059, 3, 288, 144, 0, 3058, + 3057, 1, 0, 0, 0, 3058, 3059, 1, 0, 0, 0, 3059, 3066, 1, 0, 0, 0, 3060, + 3061, 5, 2, 0, 0, 3061, 3062, 3, 1172, 586, 0, 3062, 3063, 5, 3, 0, 0, + 3063, 3064, 5, 442, 0, 0, 3064, 3066, 1, 0, 0, 0, 3065, 3056, 1, 0, 0, + 0, 3065, 3060, 1, 0, 0, 0, 3066, 3079, 1, 0, 0, 0, 3067, 3068, 5, 86, 0, + 0, 3068, 3070, 3, 1348, 674, 0, 3069, 3071, 3, 218, 109, 0, 3070, 3069, + 1, 0, 0, 0, 3070, 3071, 1, 0, 0, 0, 3071, 3073, 1, 0, 0, 0, 3072, 3074, + 3, 226, 113, 0, 3073, 3072, 1, 0, 0, 0, 3073, 3074, 1, 0, 0, 0, 3074, 3076, + 1, 0, 0, 0, 3075, 3077, 3, 234, 117, 0, 3076, 3075, 1, 0, 0, 0, 3076, 3077, + 1, 0, 0, 0, 3077, 3079, 1, 0, 0, 0, 3078, 3023, 1, 0, 0, 0, 3078, 3025, + 1, 0, 0, 0, 3078, 3026, 1, 0, 0, 0, 3078, 3036, 1, 0, 0, 0, 3078, 3044, + 1, 0, 0, 0, 3078, 3051, 1, 0, 0, 0, 3078, 3053, 1, 0, 0, 0, 3078, 3067, + 1, 0, 0, 0, 3079, 199, 1, 0, 0, 0, 3080, 3082, 5, 266, 0, 0, 3081, 3083, + 5, 77, 0, 0, 3082, 3081, 1, 0, 0, 0, 3082, 3083, 1, 0, 0, 0, 3083, 3084, + 1, 0, 0, 0, 3084, 3085, 5, 56, 0, 0, 3085, 201, 1, 0, 0, 0, 3086, 3090, + 5, 139, 0, 0, 3087, 3088, 5, 147, 0, 0, 3088, 3090, 5, 53, 0, 0, 3089, + 3086, 1, 0, 0, 0, 3089, 3087, 1, 0, 0, 0, 3090, 203, 1, 0, 0, 0, 3091, + 3097, 5, 54, 0, 0, 3092, 3093, 5, 77, 0, 0, 3093, 3097, 5, 54, 0, 0, 3094, + 3095, 5, 69, 0, 0, 3095, 3097, 7, 8, 0, 0, 3096, 3091, 1, 0, 0, 0, 3096, + 3092, 1, 0, 0, 0, 3096, 3094, 1, 0, 0, 0, 3097, 205, 1, 0, 0, 0, 3098, + 3099, 5, 120, 0, 0, 3099, 3100, 3, 1348, 674, 0, 3100, 3101, 3, 208, 104, + 0, 3101, 207, 1, 0, 0, 0, 3102, 3103, 7, 14, 0, 0, 3103, 3105, 3, 210, + 105, 0, 3104, 3102, 1, 0, 0, 0, 3105, 3108, 1, 0, 0, 0, 3106, 3104, 1, + 0, 0, 0, 3106, 3107, 1, 0, 0, 0, 3107, 209, 1, 0, 0, 0, 3108, 3106, 1, + 0, 0, 0, 3109, 3110, 7, 15, 0, 0, 3110, 211, 1, 0, 0, 0, 3111, 3112, 5, + 45, 0, 0, 3112, 3113, 3, 1352, 676, 0, 3113, 3114, 3, 214, 107, 0, 3114, + 3117, 1, 0, 0, 0, 3115, 3117, 3, 214, 107, 0, 3116, 3111, 1, 0, 0, 0, 3116, + 3115, 1, 0, 0, 0, 3117, 213, 1, 0, 0, 0, 3118, 3119, 5, 42, 0, 0, 3119, + 3120, 5, 2, 0, 0, 3120, 3121, 3, 1172, 586, 0, 3121, 3122, 5, 3, 0, 0, + 3122, 3123, 3, 444, 222, 0, 3123, 3208, 1, 0, 0, 0, 3124, 3126, 5, 98, + 0, 0, 3125, 3127, 3, 200, 100, 0, 3126, 3125, 1, 0, 0, 0, 3126, 3127, 1, + 0, 0, 0, 3127, 3145, 1, 0, 0, 0, 3128, 3129, 5, 2, 0, 0, 3129, 3130, 3, + 220, 110, 0, 3130, 3132, 5, 3, 0, 0, 3131, 3133, 3, 224, 112, 0, 3132, + 3131, 1, 0, 0, 0, 3132, 3133, 1, 0, 0, 0, 3133, 3135, 1, 0, 0, 0, 3134, + 3136, 3, 672, 336, 0, 3135, 3134, 1, 0, 0, 0, 3135, 3136, 1, 0, 0, 0, 3136, + 3138, 1, 0, 0, 0, 3137, 3139, 3, 260, 130, 0, 3138, 3137, 1, 0, 0, 0, 3138, + 3139, 1, 0, 0, 0, 3139, 3140, 1, 0, 0, 0, 3140, 3141, 3, 444, 222, 0, 3141, + 3146, 1, 0, 0, 0, 3142, 3143, 3, 262, 131, 0, 3143, 3144, 3, 444, 222, + 0, 3144, 3146, 1, 0, 0, 0, 3145, 3128, 1, 0, 0, 0, 3145, 3142, 1, 0, 0, + 0, 3146, 3208, 1, 0, 0, 0, 3147, 3148, 5, 85, 0, 0, 3148, 3166, 5, 236, + 0, 0, 3149, 3150, 5, 2, 0, 0, 3150, 3151, 3, 220, 110, 0, 3151, 3153, 5, + 3, 0, 0, 3152, 3154, 3, 224, 112, 0, 3153, 3152, 1, 0, 0, 0, 3153, 3154, + 1, 0, 0, 0, 3154, 3156, 1, 0, 0, 0, 3155, 3157, 3, 672, 336, 0, 3156, 3155, + 1, 0, 0, 0, 3156, 3157, 1, 0, 0, 0, 3157, 3159, 1, 0, 0, 0, 3158, 3160, + 3, 260, 130, 0, 3159, 3158, 1, 0, 0, 0, 3159, 3160, 1, 0, 0, 0, 3160, 3161, + 1, 0, 0, 0, 3161, 3162, 3, 444, 222, 0, 3162, 3167, 1, 0, 0, 0, 3163, 3164, + 3, 262, 131, 0, 3164, 3165, 3, 444, 222, 0, 3165, 3167, 1, 0, 0, 0, 3166, + 3149, 1, 0, 0, 0, 3166, 3163, 1, 0, 0, 0, 3167, 3208, 1, 0, 0, 0, 3168, + 3170, 5, 199, 0, 0, 3169, 3171, 3, 604, 302, 0, 3170, 3169, 1, 0, 0, 0, + 3170, 3171, 1, 0, 0, 0, 3171, 3172, 1, 0, 0, 0, 3172, 3173, 5, 2, 0, 0, + 3173, 3174, 3, 228, 114, 0, 3174, 3176, 5, 3, 0, 0, 3175, 3177, 3, 224, + 112, 0, 3176, 3175, 1, 0, 0, 0, 3176, 3177, 1, 0, 0, 0, 3177, 3179, 1, + 0, 0, 0, 3178, 3180, 3, 672, 336, 0, 3179, 3178, 1, 0, 0, 0, 3179, 3180, + 1, 0, 0, 0, 3180, 3182, 1, 0, 0, 0, 3181, 3183, 3, 260, 130, 0, 3182, 3181, + 1, 0, 0, 0, 3182, 3183, 1, 0, 0, 0, 3183, 3185, 1, 0, 0, 0, 3184, 3186, + 3, 232, 116, 0, 3185, 3184, 1, 0, 0, 0, 3185, 3186, 1, 0, 0, 0, 3186, 3187, + 1, 0, 0, 0, 3187, 3188, 3, 444, 222, 0, 3188, 3208, 1, 0, 0, 0, 3189, 3190, + 5, 63, 0, 0, 3190, 3191, 5, 236, 0, 0, 3191, 3192, 5, 2, 0, 0, 3192, 3193, + 3, 220, 110, 0, 3193, 3194, 5, 3, 0, 0, 3194, 3195, 5, 86, 0, 0, 3195, + 3197, 3, 1348, 674, 0, 3196, 3198, 3, 218, 109, 0, 3197, 3196, 1, 0, 0, + 0, 3197, 3198, 1, 0, 0, 0, 3198, 3200, 1, 0, 0, 0, 3199, 3201, 3, 226, + 113, 0, 3200, 3199, 1, 0, 0, 0, 3200, 3201, 1, 0, 0, 0, 3201, 3203, 1, + 0, 0, 0, 3202, 3204, 3, 234, 117, 0, 3203, 3202, 1, 0, 0, 0, 3203, 3204, + 1, 0, 0, 0, 3204, 3205, 1, 0, 0, 0, 3205, 3206, 3, 444, 222, 0, 3206, 3208, + 1, 0, 0, 0, 3207, 3118, 1, 0, 0, 0, 3207, 3124, 1, 0, 0, 0, 3207, 3147, + 1, 0, 0, 0, 3207, 3168, 1, 0, 0, 0, 3207, 3189, 1, 0, 0, 0, 3208, 215, + 1, 0, 0, 0, 3209, 3210, 5, 262, 0, 0, 3210, 3211, 5, 228, 0, 0, 3211, 217, + 1, 0, 0, 0, 3212, 3213, 5, 2, 0, 0, 3213, 3214, 3, 220, 110, 0, 3214, 3215, + 5, 3, 0, 0, 3215, 219, 1, 0, 0, 0, 3216, 3221, 3, 222, 111, 0, 3217, 3218, + 5, 6, 0, 0, 3218, 3220, 3, 222, 111, 0, 3219, 3217, 1, 0, 0, 0, 3220, 3223, + 1, 0, 0, 0, 3221, 3219, 1, 0, 0, 0, 3221, 3222, 1, 0, 0, 0, 3222, 221, + 1, 0, 0, 0, 3223, 3221, 1, 0, 0, 0, 3224, 3225, 3, 1384, 692, 0, 3225, + 223, 1, 0, 0, 0, 3226, 3227, 5, 443, 0, 0, 3227, 3228, 5, 2, 0, 0, 3228, + 3229, 3, 220, 110, 0, 3229, 3230, 5, 3, 0, 0, 3230, 225, 1, 0, 0, 0, 3231, + 3232, 5, 249, 0, 0, 3232, 3233, 7, 16, 0, 0, 3233, 227, 1, 0, 0, 0, 3234, + 3239, 3, 230, 115, 0, 3235, 3236, 5, 6, 0, 0, 3236, 3238, 3, 230, 115, + 0, 3237, 3235, 1, 0, 0, 0, 3238, 3241, 1, 0, 0, 0, 3239, 3237, 1, 0, 0, + 0, 3239, 3240, 1, 0, 0, 0, 3240, 229, 1, 0, 0, 0, 3241, 3239, 1, 0, 0, + 0, 3242, 3243, 3, 610, 305, 0, 3243, 3250, 5, 105, 0, 0, 3244, 3251, 3, + 692, 346, 0, 3245, 3246, 5, 271, 0, 0, 3246, 3247, 5, 2, 0, 0, 3247, 3248, + 3, 692, 346, 0, 3248, 3249, 5, 3, 0, 0, 3249, 3251, 1, 0, 0, 0, 3250, 3244, + 1, 0, 0, 0, 3250, 3245, 1, 0, 0, 0, 3251, 231, 1, 0, 0, 0, 3252, 3253, + 5, 103, 0, 0, 3253, 3254, 5, 2, 0, 0, 3254, 3255, 3, 1172, 586, 0, 3255, + 3256, 5, 3, 0, 0, 3256, 233, 1, 0, 0, 0, 3257, 3266, 3, 236, 118, 0, 3258, + 3266, 3, 238, 119, 0, 3259, 3260, 3, 236, 118, 0, 3260, 3261, 3, 238, 119, + 0, 3261, 3266, 1, 0, 0, 0, 3262, 3263, 3, 238, 119, 0, 3263, 3264, 3, 236, + 118, 0, 3264, 3266, 1, 0, 0, 0, 3265, 3257, 1, 0, 0, 0, 3265, 3258, 1, + 0, 0, 0, 3265, 3259, 1, 0, 0, 0, 3265, 3262, 1, 0, 0, 0, 3266, 235, 1, + 0, 0, 0, 3267, 3268, 5, 80, 0, 0, 3268, 3269, 5, 362, 0, 0, 3269, 3270, + 3, 240, 120, 0, 3270, 237, 1, 0, 0, 0, 3271, 3272, 5, 80, 0, 0, 3272, 3273, + 5, 182, 0, 0, 3273, 3274, 3, 240, 120, 0, 3274, 239, 1, 0, 0, 0, 3275, + 3276, 5, 262, 0, 0, 3276, 3285, 5, 132, 0, 0, 3277, 3285, 5, 308, 0, 0, + 3278, 3285, 5, 150, 0, 0, 3279, 3280, 5, 326, 0, 0, 3280, 3282, 7, 17, + 0, 0, 3281, 3283, 3, 218, 109, 0, 3282, 3281, 1, 0, 0, 0, 3282, 3283, 1, + 0, 0, 0, 3283, 3285, 1, 0, 0, 0, 3284, 3275, 1, 0, 0, 0, 3284, 3277, 1, + 0, 0, 0, 3284, 3278, 1, 0, 0, 0, 3284, 3279, 1, 0, 0, 0, 3285, 241, 1, + 0, 0, 0, 3286, 3287, 5, 229, 0, 0, 3287, 3288, 5, 2, 0, 0, 3288, 3289, + 3, 1346, 673, 0, 3289, 3290, 5, 3, 0, 0, 3290, 243, 1, 0, 0, 0, 3291, 3292, + 3, 246, 123, 0, 3292, 245, 1, 0, 0, 0, 3293, 3294, 5, 278, 0, 0, 3294, + 3295, 5, 147, 0, 0, 3295, 3296, 3, 1384, 692, 0, 3296, 3297, 5, 2, 0, 0, + 3297, 3298, 3, 248, 124, 0, 3298, 3299, 5, 3, 0, 0, 3299, 247, 1, 0, 0, + 0, 3300, 3305, 3, 250, 125, 0, 3301, 3302, 5, 6, 0, 0, 3302, 3304, 3, 250, + 125, 0, 3303, 3301, 1, 0, 0, 0, 3304, 3307, 1, 0, 0, 0, 3305, 3303, 1, + 0, 0, 0, 3305, 3306, 1, 0, 0, 0, 3306, 249, 1, 0, 0, 0, 3307, 3305, 1, + 0, 0, 0, 3308, 3310, 3, 1384, 692, 0, 3309, 3311, 3, 616, 308, 0, 3310, + 3309, 1, 0, 0, 0, 3310, 3311, 1, 0, 0, 0, 3311, 3313, 1, 0, 0, 0, 3312, + 3314, 3, 618, 309, 0, 3313, 3312, 1, 0, 0, 0, 3313, 3314, 1, 0, 0, 0, 3314, + 3332, 1, 0, 0, 0, 3315, 3317, 3, 1224, 612, 0, 3316, 3318, 3, 616, 308, + 0, 3317, 3316, 1, 0, 0, 0, 3317, 3318, 1, 0, 0, 0, 3318, 3320, 1, 0, 0, + 0, 3319, 3321, 3, 618, 309, 0, 3320, 3319, 1, 0, 0, 0, 3320, 3321, 1, 0, + 0, 0, 3321, 3332, 1, 0, 0, 0, 3322, 3323, 5, 2, 0, 0, 3323, 3324, 3, 1172, + 586, 0, 3324, 3326, 5, 3, 0, 0, 3325, 3327, 3, 616, 308, 0, 3326, 3325, + 1, 0, 0, 0, 3326, 3327, 1, 0, 0, 0, 3327, 3329, 1, 0, 0, 0, 3328, 3330, + 3, 618, 309, 0, 3329, 3328, 1, 0, 0, 0, 3329, 3330, 1, 0, 0, 0, 3330, 3332, + 1, 0, 0, 0, 3331, 3308, 1, 0, 0, 0, 3331, 3315, 1, 0, 0, 0, 3331, 3322, + 1, 0, 0, 0, 3332, 251, 1, 0, 0, 0, 3333, 3334, 5, 100, 0, 0, 3334, 3335, + 3, 1352, 676, 0, 3335, 253, 1, 0, 0, 0, 3336, 3337, 5, 105, 0, 0, 3337, + 3341, 3, 116, 58, 0, 3338, 3339, 5, 372, 0, 0, 3339, 3341, 5, 270, 0, 0, + 3340, 3336, 1, 0, 0, 0, 3340, 3338, 1, 0, 0, 0, 3341, 255, 1, 0, 0, 0, + 3342, 3343, 5, 80, 0, 0, 3343, 3349, 5, 161, 0, 0, 3344, 3350, 5, 191, + 0, 0, 3345, 3346, 5, 182, 0, 0, 3346, 3350, 5, 313, 0, 0, 3347, 3348, 5, + 285, 0, 0, 3348, 3350, 5, 313, 0, 0, 3349, 3344, 1, 0, 0, 0, 3349, 3345, + 1, 0, 0, 0, 3349, 3347, 1, 0, 0, 0, 3350, 257, 1, 0, 0, 0, 3351, 3352, + 5, 344, 0, 0, 3352, 3353, 3, 1352, 676, 0, 3353, 259, 1, 0, 0, 0, 3354, + 3355, 5, 100, 0, 0, 3355, 3356, 5, 226, 0, 0, 3356, 3357, 5, 344, 0, 0, + 3357, 3358, 3, 1352, 676, 0, 3358, 261, 1, 0, 0, 0, 3359, 3360, 5, 100, + 0, 0, 3360, 3361, 5, 226, 0, 0, 3361, 3362, 3, 1352, 676, 0, 3362, 263, + 1, 0, 0, 0, 3363, 3364, 5, 46, 0, 0, 3364, 3368, 5, 335, 0, 0, 3365, 3366, + 5, 220, 0, 0, 3366, 3367, 5, 77, 0, 0, 3367, 3369, 5, 390, 0, 0, 3368, + 3365, 1, 0, 0, 0, 3368, 3369, 1, 0, 0, 0, 3369, 3370, 1, 0, 0, 0, 3370, + 3372, 3, 528, 264, 0, 3371, 3373, 3, 880, 440, 0, 3372, 3371, 1, 0, 0, + 0, 3372, 3373, 1, 0, 0, 0, 3373, 3374, 1, 0, 0, 0, 3374, 3375, 5, 80, 0, + 0, 3375, 3376, 3, 1290, 645, 0, 3376, 3377, 5, 64, 0, 0, 3377, 3378, 3, + 1066, 533, 0, 3378, 265, 1, 0, 0, 0, 3379, 3380, 5, 138, 0, 0, 3380, 3383, + 5, 335, 0, 0, 3381, 3382, 5, 220, 0, 0, 3382, 3384, 5, 390, 0, 0, 3383, + 3381, 1, 0, 0, 0, 3383, 3384, 1, 0, 0, 0, 3384, 3385, 1, 0, 0, 0, 3385, + 3386, 3, 528, 264, 0, 3386, 3387, 5, 326, 0, 0, 3387, 3388, 5, 335, 0, + 0, 3388, 3389, 3, 1376, 688, 0, 3389, 267, 1, 0, 0, 0, 3390, 3392, 5, 46, + 0, 0, 3391, 3393, 3, 174, 87, 0, 3392, 3391, 1, 0, 0, 0, 3392, 3393, 1, + 0, 0, 0, 3393, 3394, 1, 0, 0, 0, 3394, 3398, 5, 92, 0, 0, 3395, 3396, 5, + 220, 0, 0, 3396, 3397, 5, 77, 0, 0, 3397, 3399, 5, 390, 0, 0, 3398, 3395, + 1, 0, 0, 0, 3398, 3399, 1, 0, 0, 0, 3399, 3400, 1, 0, 0, 0, 3400, 3401, + 3, 270, 135, 0, 3401, 3402, 5, 36, 0, 0, 3402, 3404, 3, 970, 485, 0, 3403, + 3405, 3, 272, 136, 0, 3404, 3403, 1, 0, 0, 0, 3404, 3405, 1, 0, 0, 0, 3405, + 269, 1, 0, 0, 0, 3406, 3408, 3, 1348, 674, 0, 3407, 3409, 3, 218, 109, + 0, 3408, 3407, 1, 0, 0, 0, 3408, 3409, 1, 0, 0, 0, 3409, 3411, 1, 0, 0, + 0, 3410, 3412, 3, 252, 126, 0, 3411, 3410, 1, 0, 0, 0, 3411, 3412, 1, 0, + 0, 0, 3412, 3414, 1, 0, 0, 0, 3413, 3415, 3, 254, 127, 0, 3414, 3413, 1, + 0, 0, 0, 3414, 3415, 1, 0, 0, 0, 3415, 3417, 1, 0, 0, 0, 3416, 3418, 3, + 256, 128, 0, 3417, 3416, 1, 0, 0, 0, 3417, 3418, 1, 0, 0, 0, 3418, 3420, + 1, 0, 0, 0, 3419, 3421, 3, 258, 129, 0, 3420, 3419, 1, 0, 0, 0, 3420, 3421, + 1, 0, 0, 0, 3421, 271, 1, 0, 0, 0, 3422, 3426, 5, 105, 0, 0, 3423, 3427, + 5, 174, 0, 0, 3424, 3425, 5, 262, 0, 0, 3425, 3427, 5, 174, 0, 0, 3426, + 3423, 1, 0, 0, 0, 3426, 3424, 1, 0, 0, 0, 3427, 273, 1, 0, 0, 0, 3428, + 3430, 5, 46, 0, 0, 3429, 3431, 3, 278, 139, 0, 3430, 3429, 1, 0, 0, 0, + 3430, 3431, 1, 0, 0, 0, 3431, 3432, 1, 0, 0, 0, 3432, 3433, 5, 251, 0, + 0, 3433, 3437, 5, 369, 0, 0, 3434, 3435, 5, 220, 0, 0, 3435, 3436, 5, 77, + 0, 0, 3436, 3438, 5, 390, 0, 0, 3437, 3434, 1, 0, 0, 0, 3437, 3438, 1, + 0, 0, 0, 3438, 3439, 1, 0, 0, 0, 3439, 3440, 3, 276, 138, 0, 3440, 3441, + 5, 36, 0, 0, 3441, 3443, 3, 970, 485, 0, 3442, 3444, 3, 272, 136, 0, 3443, + 3442, 1, 0, 0, 0, 3443, 3444, 1, 0, 0, 0, 3444, 275, 1, 0, 0, 0, 3445, + 3447, 3, 1348, 674, 0, 3446, 3448, 3, 218, 109, 0, 3447, 3446, 1, 0, 0, + 0, 3447, 3448, 1, 0, 0, 0, 3448, 3450, 1, 0, 0, 0, 3449, 3451, 3, 252, + 126, 0, 3450, 3449, 1, 0, 0, 0, 3450, 3451, 1, 0, 0, 0, 3451, 3453, 1, + 0, 0, 0, 3452, 3454, 3, 118, 59, 0, 3453, 3452, 1, 0, 0, 0, 3453, 3454, + 1, 0, 0, 0, 3454, 3456, 1, 0, 0, 0, 3455, 3457, 3, 258, 129, 0, 3456, 3455, + 1, 0, 0, 0, 3456, 3457, 1, 0, 0, 0, 3457, 277, 1, 0, 0, 0, 3458, 3459, + 5, 360, 0, 0, 3459, 279, 1, 0, 0, 0, 3460, 3461, 5, 298, 0, 0, 3461, 3462, + 5, 251, 0, 0, 3462, 3464, 5, 369, 0, 0, 3463, 3465, 3, 600, 300, 0, 3464, + 3463, 1, 0, 0, 0, 3464, 3465, 1, 0, 0, 0, 3465, 3466, 1, 0, 0, 0, 3466, + 3468, 3, 1348, 674, 0, 3467, 3469, 3, 272, 136, 0, 3468, 3467, 1, 0, 0, + 0, 3468, 3469, 1, 0, 0, 0, 3469, 281, 1, 0, 0, 0, 3470, 3472, 5, 46, 0, + 0, 3471, 3473, 3, 174, 87, 0, 3472, 3471, 1, 0, 0, 0, 3472, 3473, 1, 0, + 0, 0, 3473, 3474, 1, 0, 0, 0, 3474, 3478, 5, 321, 0, 0, 3475, 3476, 5, + 220, 0, 0, 3476, 3477, 5, 77, 0, 0, 3477, 3479, 5, 390, 0, 0, 3478, 3475, + 1, 0, 0, 0, 3478, 3479, 1, 0, 0, 0, 3479, 3480, 1, 0, 0, 0, 3480, 3482, + 3, 1348, 674, 0, 3481, 3483, 3, 286, 143, 0, 3482, 3481, 1, 0, 0, 0, 3482, + 3483, 1, 0, 0, 0, 3483, 283, 1, 0, 0, 0, 3484, 3485, 5, 138, 0, 0, 3485, + 3488, 5, 321, 0, 0, 3486, 3487, 5, 220, 0, 0, 3487, 3489, 5, 390, 0, 0, + 3488, 3486, 1, 0, 0, 0, 3488, 3489, 1, 0, 0, 0, 3489, 3490, 1, 0, 0, 0, + 3490, 3491, 3, 1348, 674, 0, 3491, 3492, 3, 290, 145, 0, 3492, 285, 1, + 0, 0, 0, 3493, 3494, 3, 290, 145, 0, 3494, 287, 1, 0, 0, 0, 3495, 3496, + 5, 2, 0, 0, 3496, 3497, 3, 290, 145, 0, 3497, 3498, 5, 3, 0, 0, 3498, 289, + 1, 0, 0, 0, 3499, 3501, 3, 292, 146, 0, 3500, 3499, 1, 0, 0, 0, 3501, 3502, + 1, 0, 0, 0, 3502, 3500, 1, 0, 0, 0, 3502, 3503, 1, 0, 0, 0, 3503, 291, + 1, 0, 0, 0, 3504, 3505, 5, 36, 0, 0, 3505, 3541, 3, 1132, 566, 0, 3506, + 3507, 5, 148, 0, 0, 3507, 3541, 3, 296, 148, 0, 3508, 3541, 5, 173, 0, + 0, 3509, 3511, 5, 225, 0, 0, 3510, 3512, 3, 294, 147, 0, 3511, 3510, 1, + 0, 0, 0, 3511, 3512, 1, 0, 0, 0, 3512, 3513, 1, 0, 0, 0, 3513, 3541, 3, + 296, 148, 0, 3514, 3541, 5, 441, 0, 0, 3515, 3516, 5, 252, 0, 0, 3516, + 3541, 3, 296, 148, 0, 3517, 3518, 5, 255, 0, 0, 3518, 3541, 3, 296, 148, + 0, 3519, 3520, 5, 262, 0, 0, 3520, 3541, 7, 18, 0, 0, 3521, 3522, 5, 274, + 0, 0, 3522, 3523, 5, 147, 0, 0, 3523, 3541, 3, 528, 264, 0, 3524, 3525, + 5, 321, 0, 0, 3525, 3526, 5, 259, 0, 0, 3526, 3541, 3, 528, 264, 0, 3527, + 3529, 5, 333, 0, 0, 3528, 3530, 3, 16, 8, 0, 3529, 3528, 1, 0, 0, 0, 3529, + 3530, 1, 0, 0, 0, 3530, 3531, 1, 0, 0, 0, 3531, 3541, 3, 296, 148, 0, 3532, + 3534, 5, 307, 0, 0, 3533, 3535, 3, 16, 8, 0, 3534, 3533, 1, 0, 0, 0, 3534, + 3535, 1, 0, 0, 0, 3535, 3537, 1, 0, 0, 0, 3536, 3538, 3, 296, 148, 0, 3537, + 3536, 1, 0, 0, 0, 3537, 3538, 1, 0, 0, 0, 3538, 3541, 1, 0, 0, 0, 3539, + 3541, 5, 360, 0, 0, 3540, 3504, 1, 0, 0, 0, 3540, 3506, 1, 0, 0, 0, 3540, + 3508, 1, 0, 0, 0, 3540, 3509, 1, 0, 0, 0, 3540, 3514, 1, 0, 0, 0, 3540, + 3515, 1, 0, 0, 0, 3540, 3517, 1, 0, 0, 0, 3540, 3519, 1, 0, 0, 0, 3540, + 3521, 1, 0, 0, 0, 3540, 3524, 1, 0, 0, 0, 3540, 3527, 1, 0, 0, 0, 3540, + 3532, 1, 0, 0, 0, 3540, 3539, 1, 0, 0, 0, 3541, 293, 1, 0, 0, 0, 3542, + 3543, 5, 147, 0, 0, 3543, 295, 1, 0, 0, 0, 3544, 3551, 3, 1366, 683, 0, + 3545, 3546, 5, 12, 0, 0, 3546, 3551, 3, 1366, 683, 0, 3547, 3548, 5, 13, + 0, 0, 3548, 3551, 3, 1366, 683, 0, 3549, 3551, 3, 1376, 688, 0, 3550, 3544, + 1, 0, 0, 0, 3550, 3545, 1, 0, 0, 0, 3550, 3547, 1, 0, 0, 0, 3550, 3549, + 1, 0, 0, 0, 3551, 297, 1, 0, 0, 0, 3552, 3557, 3, 296, 148, 0, 3553, 3554, + 5, 6, 0, 0, 3554, 3556, 3, 296, 148, 0, 3555, 3553, 1, 0, 0, 0, 3556, 3559, + 1, 0, 0, 0, 3557, 3555, 1, 0, 0, 0, 3557, 3558, 1, 0, 0, 0, 3558, 299, + 1, 0, 0, 0, 3559, 3557, 1, 0, 0, 0, 3560, 3562, 5, 46, 0, 0, 3561, 3563, + 3, 626, 313, 0, 3562, 3561, 1, 0, 0, 0, 3562, 3563, 1, 0, 0, 0, 3563, 3565, + 1, 0, 0, 0, 3564, 3566, 3, 302, 151, 0, 3565, 3564, 1, 0, 0, 0, 3565, 3566, + 1, 0, 0, 0, 3566, 3568, 1, 0, 0, 0, 3567, 3569, 3, 312, 156, 0, 3568, 3567, + 1, 0, 0, 0, 3568, 3569, 1, 0, 0, 0, 3569, 3570, 1, 0, 0, 0, 3570, 3571, + 5, 238, 0, 0, 3571, 3580, 3, 1352, 676, 0, 3572, 3573, 5, 215, 0, 0, 3573, + 3575, 3, 304, 152, 0, 3574, 3576, 3, 306, 153, 0, 3575, 3574, 1, 0, 0, + 0, 3575, 3576, 1, 0, 0, 0, 3576, 3578, 1, 0, 0, 0, 3577, 3579, 3, 310, + 155, 0, 3578, 3577, 1, 0, 0, 0, 3578, 3579, 1, 0, 0, 0, 3579, 3581, 1, + 0, 0, 0, 3580, 3572, 1, 0, 0, 0, 3580, 3581, 1, 0, 0, 0, 3581, 301, 1, + 0, 0, 0, 3582, 3583, 5, 352, 0, 0, 3583, 303, 1, 0, 0, 0, 3584, 3586, 3, + 1352, 676, 0, 3585, 3587, 3, 530, 265, 0, 3586, 3585, 1, 0, 0, 0, 3586, + 3587, 1, 0, 0, 0, 3587, 305, 1, 0, 0, 0, 3588, 3589, 5, 230, 0, 0, 3589, + 3590, 3, 304, 152, 0, 3590, 307, 1, 0, 0, 0, 3591, 3592, 5, 366, 0, 0, + 3592, 3596, 3, 304, 152, 0, 3593, 3594, 5, 262, 0, 0, 3594, 3596, 5, 366, + 0, 0, 3595, 3591, 1, 0, 0, 0, 3595, 3593, 1, 0, 0, 0, 3596, 309, 1, 0, + 0, 0, 3597, 3598, 3, 308, 154, 0, 3598, 311, 1, 0, 0, 0, 3599, 3600, 5, + 288, 0, 0, 3600, 313, 1, 0, 0, 0, 3601, 3602, 5, 46, 0, 0, 3602, 3603, + 5, 344, 0, 0, 3603, 3605, 3, 1352, 676, 0, 3604, 3606, 3, 316, 158, 0, + 3605, 3604, 1, 0, 0, 0, 3605, 3606, 1, 0, 0, 0, 3606, 3607, 1, 0, 0, 0, + 3607, 3608, 5, 246, 0, 0, 3608, 3610, 3, 1370, 685, 0, 3609, 3611, 3, 118, + 59, 0, 3610, 3609, 1, 0, 0, 0, 3610, 3611, 1, 0, 0, 0, 3611, 315, 1, 0, + 0, 0, 3612, 3613, 5, 275, 0, 0, 3613, 3614, 3, 1380, 690, 0, 3614, 317, + 1, 0, 0, 0, 3615, 3616, 5, 191, 0, 0, 3616, 3619, 5, 344, 0, 0, 3617, 3618, + 5, 220, 0, 0, 3618, 3620, 5, 390, 0, 0, 3619, 3617, 1, 0, 0, 0, 3619, 3620, + 1, 0, 0, 0, 3620, 3621, 1, 0, 0, 0, 3621, 3622, 3, 1352, 676, 0, 3622, + 319, 1, 0, 0, 0, 3623, 3624, 5, 46, 0, 0, 3624, 3628, 5, 204, 0, 0, 3625, + 3626, 5, 220, 0, 0, 3626, 3627, 5, 77, 0, 0, 3627, 3629, 5, 390, 0, 0, + 3628, 3625, 1, 0, 0, 0, 3628, 3629, 1, 0, 0, 0, 3629, 3630, 1, 0, 0, 0, + 3630, 3632, 3, 1352, 676, 0, 3631, 3633, 3, 16, 8, 0, 3632, 3631, 1, 0, + 0, 0, 3632, 3633, 1, 0, 0, 0, 3633, 3634, 1, 0, 0, 0, 3634, 3635, 3, 322, + 161, 0, 3635, 321, 1, 0, 0, 0, 3636, 3638, 3, 324, 162, 0, 3637, 3636, + 1, 0, 0, 0, 3638, 3641, 1, 0, 0, 0, 3639, 3637, 1, 0, 0, 0, 3639, 3640, + 1, 0, 0, 0, 3640, 323, 1, 0, 0, 0, 3641, 3639, 1, 0, 0, 0, 3642, 3643, + 5, 316, 0, 0, 3643, 3650, 3, 1352, 676, 0, 3644, 3645, 5, 368, 0, 0, 3645, + 3650, 3, 72, 36, 0, 3646, 3647, 5, 64, 0, 0, 3647, 3650, 3, 72, 36, 0, + 3648, 3650, 5, 150, 0, 0, 3649, 3642, 1, 0, 0, 0, 3649, 3644, 1, 0, 0, + 0, 3649, 3646, 1, 0, 0, 0, 3649, 3648, 1, 0, 0, 0, 3650, 325, 1, 0, 0, + 0, 3651, 3652, 5, 138, 0, 0, 3652, 3653, 5, 204, 0, 0, 3653, 3654, 3, 1352, + 676, 0, 3654, 3655, 5, 362, 0, 0, 3655, 3656, 3, 328, 164, 0, 3656, 327, + 1, 0, 0, 0, 3657, 3659, 3, 330, 165, 0, 3658, 3657, 1, 0, 0, 0, 3659, 3662, + 1, 0, 0, 0, 3660, 3658, 1, 0, 0, 0, 3660, 3661, 1, 0, 0, 0, 3661, 329, + 1, 0, 0, 0, 3662, 3660, 1, 0, 0, 0, 3663, 3664, 5, 94, 0, 0, 3664, 3665, + 3, 72, 36, 0, 3665, 331, 1, 0, 0, 0, 3666, 3667, 5, 138, 0, 0, 3667, 3668, + 5, 204, 0, 0, 3668, 3669, 3, 1352, 676, 0, 3669, 3670, 3, 40, 20, 0, 3670, + 3671, 3, 520, 260, 0, 3671, 3672, 3, 1352, 676, 0, 3672, 3771, 1, 0, 0, + 0, 3673, 3674, 5, 138, 0, 0, 3674, 3675, 5, 204, 0, 0, 3675, 3676, 3, 1352, + 676, 0, 3676, 3677, 3, 40, 20, 0, 3677, 3678, 3, 518, 259, 0, 3678, 3679, + 3, 528, 264, 0, 3679, 3771, 1, 0, 0, 0, 3680, 3681, 5, 138, 0, 0, 3681, + 3682, 5, 204, 0, 0, 3682, 3683, 3, 1352, 676, 0, 3683, 3684, 3, 40, 20, + 0, 3684, 3685, 5, 136, 0, 0, 3685, 3686, 3, 658, 329, 0, 3686, 3771, 1, + 0, 0, 0, 3687, 3688, 5, 138, 0, 0, 3688, 3689, 5, 204, 0, 0, 3689, 3690, + 3, 1352, 676, 0, 3690, 3691, 3, 40, 20, 0, 3691, 3692, 5, 41, 0, 0, 3692, + 3693, 5, 2, 0, 0, 3693, 3694, 3, 1128, 564, 0, 3694, 3695, 5, 36, 0, 0, + 3695, 3696, 3, 1128, 564, 0, 3696, 3697, 5, 3, 0, 0, 3697, 3771, 1, 0, + 0, 0, 3698, 3699, 5, 138, 0, 0, 3699, 3700, 5, 204, 0, 0, 3700, 3701, 3, + 1352, 676, 0, 3701, 3702, 3, 40, 20, 0, 3702, 3703, 5, 189, 0, 0, 3703, + 3704, 3, 1128, 564, 0, 3704, 3771, 1, 0, 0, 0, 3705, 3706, 5, 138, 0, 0, + 3706, 3707, 5, 204, 0, 0, 3707, 3708, 3, 1352, 676, 0, 3708, 3709, 3, 40, + 20, 0, 3709, 3710, 5, 211, 0, 0, 3710, 3711, 3, 634, 317, 0, 3711, 3771, + 1, 0, 0, 0, 3712, 3713, 5, 138, 0, 0, 3713, 3714, 5, 204, 0, 0, 3714, 3715, + 3, 1352, 676, 0, 3715, 3716, 3, 40, 20, 0, 3716, 3717, 5, 271, 0, 0, 3717, + 3718, 3, 696, 348, 0, 3718, 3771, 1, 0, 0, 0, 3719, 3720, 5, 138, 0, 0, + 3720, 3721, 5, 204, 0, 0, 3721, 3722, 3, 1352, 676, 0, 3722, 3723, 3, 40, + 20, 0, 3723, 3724, 5, 271, 0, 0, 3724, 3725, 5, 156, 0, 0, 3725, 3726, + 3, 528, 264, 0, 3726, 3727, 5, 100, 0, 0, 3727, 3728, 3, 1352, 676, 0, + 3728, 3771, 1, 0, 0, 0, 3729, 3730, 5, 138, 0, 0, 3730, 3731, 5, 204, 0, + 0, 3731, 3732, 3, 1352, 676, 0, 3732, 3733, 3, 40, 20, 0, 3733, 3734, 5, + 271, 0, 0, 3734, 3735, 5, 206, 0, 0, 3735, 3736, 3, 528, 264, 0, 3736, + 3737, 5, 100, 0, 0, 3737, 3738, 3, 1352, 676, 0, 3738, 3771, 1, 0, 0, 0, + 3739, 3740, 5, 138, 0, 0, 3740, 3741, 5, 204, 0, 0, 3741, 3742, 3, 1352, + 676, 0, 3742, 3743, 3, 40, 20, 0, 3743, 3744, 5, 289, 0, 0, 3744, 3745, + 3, 634, 317, 0, 3745, 3771, 1, 0, 0, 0, 3746, 3747, 5, 138, 0, 0, 3747, + 3748, 5, 204, 0, 0, 3748, 3749, 3, 1352, 676, 0, 3749, 3750, 3, 40, 20, + 0, 3750, 3751, 5, 444, 0, 0, 3751, 3752, 3, 634, 317, 0, 3752, 3771, 1, + 0, 0, 0, 3753, 3754, 5, 138, 0, 0, 3754, 3755, 5, 204, 0, 0, 3755, 3756, + 3, 1352, 676, 0, 3756, 3757, 3, 40, 20, 0, 3757, 3758, 5, 445, 0, 0, 3758, + 3759, 5, 62, 0, 0, 3759, 3760, 3, 1128, 564, 0, 3760, 3761, 5, 238, 0, + 0, 3761, 3762, 3, 1352, 676, 0, 3762, 3771, 1, 0, 0, 0, 3763, 3764, 5, + 138, 0, 0, 3764, 3765, 5, 204, 0, 0, 3765, 3766, 3, 1352, 676, 0, 3766, + 3767, 3, 40, 20, 0, 3767, 3768, 5, 353, 0, 0, 3768, 3769, 3, 1128, 564, + 0, 3769, 3771, 1, 0, 0, 0, 3770, 3666, 1, 0, 0, 0, 3770, 3673, 1, 0, 0, + 0, 3770, 3680, 1, 0, 0, 0, 3770, 3687, 1, 0, 0, 0, 3770, 3698, 1, 0, 0, + 0, 3770, 3705, 1, 0, 0, 0, 3770, 3712, 1, 0, 0, 0, 3770, 3719, 1, 0, 0, + 0, 3770, 3729, 1, 0, 0, 0, 3770, 3739, 1, 0, 0, 0, 3770, 3746, 1, 0, 0, + 0, 3770, 3753, 1, 0, 0, 0, 3770, 3763, 1, 0, 0, 0, 3771, 333, 1, 0, 0, + 0, 3772, 3773, 5, 46, 0, 0, 3773, 3774, 5, 63, 0, 0, 3774, 3775, 5, 174, + 0, 0, 3775, 3776, 5, 374, 0, 0, 3776, 3778, 3, 1352, 676, 0, 3777, 3779, + 3, 340, 170, 0, 3778, 3777, 1, 0, 0, 0, 3778, 3779, 1, 0, 0, 0, 3779, 3781, + 1, 0, 0, 0, 3780, 3782, 3, 344, 172, 0, 3781, 3780, 1, 0, 0, 0, 3781, 3782, + 1, 0, 0, 0, 3782, 335, 1, 0, 0, 0, 3783, 3784, 5, 215, 0, 0, 3784, 3792, + 3, 304, 152, 0, 3785, 3786, 5, 262, 0, 0, 3786, 3792, 5, 215, 0, 0, 3787, + 3788, 5, 366, 0, 0, 3788, 3792, 3, 304, 152, 0, 3789, 3790, 5, 262, 0, + 0, 3790, 3792, 5, 366, 0, 0, 3791, 3783, 1, 0, 0, 0, 3791, 3785, 1, 0, + 0, 0, 3791, 3787, 1, 0, 0, 0, 3791, 3789, 1, 0, 0, 0, 3792, 337, 1, 0, + 0, 0, 3793, 3795, 3, 336, 168, 0, 3794, 3793, 1, 0, 0, 0, 3795, 3796, 1, + 0, 0, 0, 3796, 3794, 1, 0, 0, 0, 3796, 3797, 1, 0, 0, 0, 3797, 339, 1, + 0, 0, 0, 3798, 3799, 3, 338, 169, 0, 3799, 341, 1, 0, 0, 0, 3800, 3801, + 5, 138, 0, 0, 3801, 3802, 5, 63, 0, 0, 3802, 3803, 5, 174, 0, 0, 3803, + 3804, 5, 374, 0, 0, 3804, 3806, 3, 1352, 676, 0, 3805, 3807, 3, 340, 170, + 0, 3806, 3805, 1, 0, 0, 0, 3806, 3807, 1, 0, 0, 0, 3807, 3808, 1, 0, 0, + 0, 3808, 3809, 3, 348, 174, 0, 3809, 3818, 1, 0, 0, 0, 3810, 3811, 5, 138, + 0, 0, 3811, 3812, 5, 63, 0, 0, 3812, 3813, 5, 174, 0, 0, 3813, 3814, 5, + 374, 0, 0, 3814, 3815, 3, 1352, 676, 0, 3815, 3816, 3, 338, 169, 0, 3816, + 3818, 1, 0, 0, 0, 3817, 3800, 1, 0, 0, 0, 3817, 3810, 1, 0, 0, 0, 3818, + 343, 1, 0, 0, 0, 3819, 3820, 5, 273, 0, 0, 3820, 3821, 5, 2, 0, 0, 3821, + 3822, 3, 346, 173, 0, 3822, 3823, 5, 3, 0, 0, 3823, 345, 1, 0, 0, 0, 3824, + 3829, 3, 354, 177, 0, 3825, 3826, 5, 6, 0, 0, 3826, 3828, 3, 354, 177, + 0, 3827, 3825, 1, 0, 0, 0, 3828, 3831, 1, 0, 0, 0, 3829, 3827, 1, 0, 0, + 0, 3829, 3830, 1, 0, 0, 0, 3830, 347, 1, 0, 0, 0, 3831, 3829, 1, 0, 0, + 0, 3832, 3833, 5, 273, 0, 0, 3833, 3834, 5, 2, 0, 0, 3834, 3835, 3, 350, + 175, 0, 3835, 3836, 5, 3, 0, 0, 3836, 349, 1, 0, 0, 0, 3837, 3842, 3, 352, + 176, 0, 3838, 3839, 5, 6, 0, 0, 3839, 3841, 3, 352, 176, 0, 3840, 3838, + 1, 0, 0, 0, 3841, 3844, 1, 0, 0, 0, 3842, 3840, 1, 0, 0, 0, 3842, 3843, + 1, 0, 0, 0, 3843, 351, 1, 0, 0, 0, 3844, 3842, 1, 0, 0, 0, 3845, 3853, + 3, 354, 177, 0, 3846, 3847, 5, 326, 0, 0, 3847, 3853, 3, 354, 177, 0, 3848, + 3849, 5, 133, 0, 0, 3849, 3853, 3, 354, 177, 0, 3850, 3851, 5, 191, 0, + 0, 3851, 3853, 3, 356, 178, 0, 3852, 3845, 1, 0, 0, 0, 3852, 3846, 1, 0, + 0, 0, 3852, 3848, 1, 0, 0, 0, 3852, 3850, 1, 0, 0, 0, 3853, 353, 1, 0, + 0, 0, 3854, 3855, 3, 356, 178, 0, 3855, 3856, 3, 358, 179, 0, 3856, 355, + 1, 0, 0, 0, 3857, 3858, 3, 1392, 696, 0, 3858, 357, 1, 0, 0, 0, 3859, 3860, + 3, 1370, 685, 0, 3860, 359, 1, 0, 0, 0, 3861, 3862, 5, 46, 0, 0, 3862, + 3863, 5, 324, 0, 0, 3863, 3865, 3, 1352, 676, 0, 3864, 3866, 3, 362, 181, + 0, 3865, 3864, 1, 0, 0, 0, 3865, 3866, 1, 0, 0, 0, 3866, 3868, 1, 0, 0, + 0, 3867, 3869, 3, 366, 183, 0, 3868, 3867, 1, 0, 0, 0, 3868, 3869, 1, 0, + 0, 0, 3869, 3870, 1, 0, 0, 0, 3870, 3871, 5, 63, 0, 0, 3871, 3872, 5, 174, + 0, 0, 3872, 3873, 5, 374, 0, 0, 3873, 3875, 3, 1352, 676, 0, 3874, 3876, + 3, 344, 172, 0, 3875, 3874, 1, 0, 0, 0, 3875, 3876, 1, 0, 0, 0, 3876, 3897, + 1, 0, 0, 0, 3877, 3878, 5, 46, 0, 0, 3878, 3879, 5, 324, 0, 0, 3879, 3880, + 5, 220, 0, 0, 3880, 3881, 5, 77, 0, 0, 3881, 3882, 5, 390, 0, 0, 3882, + 3884, 3, 1352, 676, 0, 3883, 3885, 3, 362, 181, 0, 3884, 3883, 1, 0, 0, + 0, 3884, 3885, 1, 0, 0, 0, 3885, 3887, 1, 0, 0, 0, 3886, 3888, 3, 366, + 183, 0, 3887, 3886, 1, 0, 0, 0, 3887, 3888, 1, 0, 0, 0, 3888, 3889, 1, + 0, 0, 0, 3889, 3890, 5, 63, 0, 0, 3890, 3891, 5, 174, 0, 0, 3891, 3892, + 5, 374, 0, 0, 3892, 3894, 3, 1352, 676, 0, 3893, 3895, 3, 344, 172, 0, + 3894, 3893, 1, 0, 0, 0, 3894, 3895, 1, 0, 0, 0, 3895, 3897, 1, 0, 0, 0, + 3896, 3861, 1, 0, 0, 0, 3896, 3877, 1, 0, 0, 0, 3897, 361, 1, 0, 0, 0, + 3898, 3899, 5, 353, 0, 0, 3899, 3900, 3, 1370, 685, 0, 3900, 363, 1, 0, + 0, 0, 3901, 3904, 5, 368, 0, 0, 3902, 3905, 3, 1370, 685, 0, 3903, 3905, + 5, 78, 0, 0, 3904, 3902, 1, 0, 0, 0, 3904, 3903, 1, 0, 0, 0, 3905, 365, + 1, 0, 0, 0, 3906, 3907, 3, 364, 182, 0, 3907, 367, 1, 0, 0, 0, 3908, 3909, + 5, 138, 0, 0, 3909, 3910, 5, 324, 0, 0, 3910, 3916, 3, 1352, 676, 0, 3911, + 3917, 3, 348, 174, 0, 3912, 3914, 3, 364, 182, 0, 3913, 3915, 3, 348, 174, + 0, 3914, 3913, 1, 0, 0, 0, 3914, 3915, 1, 0, 0, 0, 3915, 3917, 1, 0, 0, + 0, 3916, 3911, 1, 0, 0, 0, 3916, 3912, 1, 0, 0, 0, 3917, 369, 1, 0, 0, + 0, 3918, 3919, 5, 46, 0, 0, 3919, 3920, 5, 63, 0, 0, 3920, 3921, 5, 92, + 0, 0, 3921, 3922, 3, 1348, 674, 0, 3922, 3924, 5, 2, 0, 0, 3923, 3925, + 3, 176, 88, 0, 3924, 3923, 1, 0, 0, 0, 3924, 3925, 1, 0, 0, 0, 3925, 3926, + 1, 0, 0, 0, 3926, 3928, 5, 3, 0, 0, 3927, 3929, 3, 242, 121, 0, 3928, 3927, + 1, 0, 0, 0, 3928, 3929, 1, 0, 0, 0, 3929, 3930, 1, 0, 0, 0, 3930, 3931, + 5, 324, 0, 0, 3931, 3933, 3, 1352, 676, 0, 3932, 3934, 3, 344, 172, 0, + 3933, 3932, 1, 0, 0, 0, 3933, 3934, 1, 0, 0, 0, 3934, 3991, 1, 0, 0, 0, + 3935, 3936, 5, 46, 0, 0, 3936, 3937, 5, 63, 0, 0, 3937, 3938, 5, 92, 0, + 0, 3938, 3939, 5, 220, 0, 0, 3939, 3940, 5, 77, 0, 0, 3940, 3941, 5, 390, + 0, 0, 3941, 3942, 3, 1348, 674, 0, 3942, 3944, 5, 2, 0, 0, 3943, 3945, + 3, 176, 88, 0, 3944, 3943, 1, 0, 0, 0, 3944, 3945, 1, 0, 0, 0, 3945, 3946, + 1, 0, 0, 0, 3946, 3948, 5, 3, 0, 0, 3947, 3949, 3, 242, 121, 0, 3948, 3947, + 1, 0, 0, 0, 3948, 3949, 1, 0, 0, 0, 3949, 3950, 1, 0, 0, 0, 3950, 3951, + 5, 324, 0, 0, 3951, 3953, 3, 1352, 676, 0, 3952, 3954, 3, 344, 172, 0, + 3953, 3952, 1, 0, 0, 0, 3953, 3954, 1, 0, 0, 0, 3954, 3991, 1, 0, 0, 0, + 3955, 3956, 5, 46, 0, 0, 3956, 3957, 5, 63, 0, 0, 3957, 3958, 5, 92, 0, + 0, 3958, 3959, 3, 1348, 674, 0, 3959, 3960, 5, 278, 0, 0, 3960, 3961, 5, + 268, 0, 0, 3961, 3963, 3, 1348, 674, 0, 3962, 3964, 3, 178, 89, 0, 3963, + 3962, 1, 0, 0, 0, 3963, 3964, 1, 0, 0, 0, 3964, 3965, 1, 0, 0, 0, 3965, + 3966, 3, 128, 64, 0, 3966, 3967, 5, 324, 0, 0, 3967, 3969, 3, 1352, 676, + 0, 3968, 3970, 3, 344, 172, 0, 3969, 3968, 1, 0, 0, 0, 3969, 3970, 1, 0, + 0, 0, 3970, 3991, 1, 0, 0, 0, 3971, 3972, 5, 46, 0, 0, 3972, 3973, 5, 63, + 0, 0, 3973, 3974, 5, 92, 0, 0, 3974, 3975, 5, 220, 0, 0, 3975, 3976, 5, + 77, 0, 0, 3976, 3977, 5, 390, 0, 0, 3977, 3978, 3, 1348, 674, 0, 3978, + 3979, 5, 278, 0, 0, 3979, 3980, 5, 268, 0, 0, 3980, 3982, 3, 1348, 674, + 0, 3981, 3983, 3, 178, 89, 0, 3982, 3981, 1, 0, 0, 0, 3982, 3983, 1, 0, + 0, 0, 3983, 3984, 1, 0, 0, 0, 3984, 3985, 3, 128, 64, 0, 3985, 3986, 5, + 324, 0, 0, 3986, 3988, 3, 1352, 676, 0, 3987, 3989, 3, 344, 172, 0, 3988, + 3987, 1, 0, 0, 0, 3988, 3989, 1, 0, 0, 0, 3989, 3991, 1, 0, 0, 0, 3990, + 3918, 1, 0, 0, 0, 3990, 3935, 1, 0, 0, 0, 3990, 3955, 1, 0, 0, 0, 3990, + 3971, 1, 0, 0, 0, 3991, 371, 1, 0, 0, 0, 3992, 3993, 5, 446, 0, 0, 3993, + 3994, 5, 63, 0, 0, 3994, 3995, 5, 316, 0, 0, 3995, 3997, 3, 1352, 676, + 0, 3996, 3998, 3, 376, 188, 0, 3997, 3996, 1, 0, 0, 0, 3997, 3998, 1, 0, + 0, 0, 3998, 3999, 1, 0, 0, 0, 3999, 4000, 5, 64, 0, 0, 4000, 4001, 5, 324, + 0, 0, 4001, 4002, 3, 1352, 676, 0, 4002, 4003, 5, 71, 0, 0, 4003, 4005, + 3, 1352, 676, 0, 4004, 4006, 3, 344, 172, 0, 4005, 4004, 1, 0, 0, 0, 4005, + 4006, 1, 0, 0, 0, 4006, 373, 1, 0, 0, 0, 4007, 4008, 5, 74, 0, 0, 4008, + 4011, 5, 94, 0, 0, 4009, 4011, 5, 59, 0, 0, 4010, 4007, 1, 0, 0, 0, 4010, + 4009, 1, 0, 0, 0, 4011, 375, 1, 0, 0, 0, 4012, 4013, 3, 374, 187, 0, 4013, + 4014, 5, 2, 0, 0, 4014, 4015, 3, 1086, 543, 0, 4015, 4016, 5, 3, 0, 0, + 4016, 377, 1, 0, 0, 0, 4017, 4018, 5, 46, 0, 0, 4018, 4019, 5, 99, 0, 0, + 4019, 4020, 5, 248, 0, 0, 4020, 4021, 5, 62, 0, 0, 4021, 4022, 3, 380, + 190, 0, 4022, 4023, 5, 324, 0, 0, 4023, 4025, 3, 1352, 676, 0, 4024, 4026, + 3, 344, 172, 0, 4025, 4024, 1, 0, 0, 0, 4025, 4026, 1, 0, 0, 0, 4026, 4041, + 1, 0, 0, 0, 4027, 4028, 5, 46, 0, 0, 4028, 4029, 5, 99, 0, 0, 4029, 4030, + 5, 248, 0, 0, 4030, 4031, 5, 220, 0, 0, 4031, 4032, 5, 77, 0, 0, 4032, + 4033, 5, 390, 0, 0, 4033, 4034, 5, 62, 0, 0, 4034, 4035, 3, 380, 190, 0, + 4035, 4036, 5, 324, 0, 0, 4036, 4038, 3, 1352, 676, 0, 4037, 4039, 3, 344, + 172, 0, 4038, 4037, 1, 0, 0, 0, 4038, 4039, 1, 0, 0, 0, 4039, 4041, 1, + 0, 0, 0, 4040, 4017, 1, 0, 0, 0, 4040, 4027, 1, 0, 0, 0, 4041, 379, 1, + 0, 0, 0, 4042, 4045, 3, 1380, 690, 0, 4043, 4045, 5, 99, 0, 0, 4044, 4042, + 1, 0, 0, 0, 4044, 4043, 1, 0, 0, 0, 4045, 381, 1, 0, 0, 0, 4046, 4047, + 5, 191, 0, 0, 4047, 4048, 5, 99, 0, 0, 4048, 4049, 5, 248, 0, 0, 4049, + 4050, 5, 62, 0, 0, 4050, 4051, 3, 380, 190, 0, 4051, 4052, 5, 324, 0, 0, + 4052, 4053, 3, 1352, 676, 0, 4053, 4065, 1, 0, 0, 0, 4054, 4055, 5, 191, + 0, 0, 4055, 4056, 5, 99, 0, 0, 4056, 4057, 5, 248, 0, 0, 4057, 4058, 5, + 220, 0, 0, 4058, 4059, 5, 390, 0, 0, 4059, 4060, 5, 62, 0, 0, 4060, 4061, + 3, 380, 190, 0, 4061, 4062, 5, 324, 0, 0, 4062, 4063, 3, 1352, 676, 0, + 4063, 4065, 1, 0, 0, 0, 4064, 4046, 1, 0, 0, 0, 4064, 4054, 1, 0, 0, 0, + 4065, 383, 1, 0, 0, 0, 4066, 4067, 5, 138, 0, 0, 4067, 4068, 5, 99, 0, + 0, 4068, 4069, 5, 248, 0, 0, 4069, 4070, 5, 62, 0, 0, 4070, 4071, 3, 380, + 190, 0, 4071, 4072, 5, 324, 0, 0, 4072, 4073, 3, 1352, 676, 0, 4073, 4074, + 3, 348, 174, 0, 4074, 385, 1, 0, 0, 0, 4075, 4076, 5, 46, 0, 0, 4076, 4077, + 5, 447, 0, 0, 4077, 4078, 3, 1352, 676, 0, 4078, 4079, 5, 80, 0, 0, 4079, + 4081, 3, 1348, 674, 0, 4080, 4082, 3, 398, 199, 0, 4081, 4080, 1, 0, 0, + 0, 4081, 4082, 1, 0, 0, 0, 4082, 4084, 1, 0, 0, 0, 4083, 4085, 3, 400, + 200, 0, 4084, 4083, 1, 0, 0, 0, 4084, 4085, 1, 0, 0, 0, 4085, 4087, 1, + 0, 0, 0, 4086, 4088, 3, 394, 197, 0, 4087, 4086, 1, 0, 0, 0, 4087, 4088, + 1, 0, 0, 0, 4088, 4090, 1, 0, 0, 0, 4089, 4091, 3, 390, 195, 0, 4090, 4089, + 1, 0, 0, 0, 4090, 4091, 1, 0, 0, 0, 4091, 4093, 1, 0, 0, 0, 4092, 4094, + 3, 392, 196, 0, 4093, 4092, 1, 0, 0, 0, 4093, 4094, 1, 0, 0, 0, 4094, 387, + 1, 0, 0, 0, 4095, 4096, 5, 138, 0, 0, 4096, 4097, 5, 447, 0, 0, 4097, 4098, + 3, 1352, 676, 0, 4098, 4099, 5, 80, 0, 0, 4099, 4101, 3, 1348, 674, 0, + 4100, 4102, 3, 396, 198, 0, 4101, 4100, 1, 0, 0, 0, 4101, 4102, 1, 0, 0, + 0, 4102, 4104, 1, 0, 0, 0, 4103, 4105, 3, 390, 195, 0, 4104, 4103, 1, 0, + 0, 0, 4104, 4105, 1, 0, 0, 0, 4105, 4107, 1, 0, 0, 0, 4106, 4108, 3, 392, + 196, 0, 4107, 4106, 1, 0, 0, 0, 4107, 4108, 1, 0, 0, 0, 4108, 389, 1, 0, + 0, 0, 4109, 4110, 5, 100, 0, 0, 4110, 4111, 5, 2, 0, 0, 4111, 4112, 3, + 1172, 586, 0, 4112, 4113, 5, 3, 0, 0, 4113, 391, 1, 0, 0, 0, 4114, 4115, + 5, 105, 0, 0, 4115, 4116, 5, 42, 0, 0, 4116, 4117, 5, 2, 0, 0, 4117, 4118, + 3, 1172, 586, 0, 4118, 4119, 5, 3, 0, 0, 4119, 393, 1, 0, 0, 0, 4120, 4121, + 5, 94, 0, 0, 4121, 4122, 3, 1382, 691, 0, 4122, 395, 1, 0, 0, 0, 4123, + 4124, 5, 94, 0, 0, 4124, 4125, 3, 1382, 691, 0, 4125, 397, 1, 0, 0, 0, + 4126, 4127, 5, 36, 0, 0, 4127, 4128, 3, 1394, 697, 0, 4128, 399, 1, 0, + 0, 0, 4129, 4130, 5, 62, 0, 0, 4130, 4131, 3, 402, 201, 0, 4131, 401, 1, + 0, 0, 0, 4132, 4133, 7, 19, 0, 0, 4133, 403, 1, 0, 0, 0, 4134, 4135, 5, + 46, 0, 0, 4135, 4136, 5, 131, 0, 0, 4136, 4137, 5, 448, 0, 0, 4137, 4138, + 3, 1352, 676, 0, 4138, 4139, 5, 353, 0, 0, 4139, 4140, 3, 406, 203, 0, + 4140, 4141, 5, 215, 0, 0, 4141, 4142, 3, 304, 152, 0, 4142, 405, 1, 0, + 0, 0, 4143, 4144, 7, 20, 0, 0, 4144, 407, 1, 0, 0, 0, 4145, 4146, 5, 46, + 0, 0, 4146, 4147, 5, 350, 0, 0, 4147, 4148, 3, 1352, 676, 0, 4148, 4149, + 3, 410, 205, 0, 4149, 4150, 3, 412, 206, 0, 4150, 4151, 5, 80, 0, 0, 4151, + 4153, 3, 1348, 674, 0, 4152, 4154, 3, 416, 208, 0, 4153, 4152, 1, 0, 0, + 0, 4153, 4154, 1, 0, 0, 0, 4154, 4156, 1, 0, 0, 0, 4155, 4157, 3, 428, + 214, 0, 4156, 4155, 1, 0, 0, 0, 4156, 4157, 1, 0, 0, 0, 4157, 4159, 1, + 0, 0, 0, 4158, 4160, 3, 434, 217, 0, 4159, 4158, 1, 0, 0, 0, 4159, 4160, + 1, 0, 0, 0, 4160, 4161, 1, 0, 0, 0, 4161, 4162, 5, 202, 0, 0, 4162, 4163, + 3, 436, 218, 0, 4163, 4164, 3, 1358, 679, 0, 4164, 4165, 5, 2, 0, 0, 4165, + 4166, 3, 438, 219, 0, 4166, 4167, 5, 3, 0, 0, 4167, 4194, 1, 0, 0, 0, 4168, + 4169, 5, 46, 0, 0, 4169, 4170, 5, 45, 0, 0, 4170, 4171, 5, 350, 0, 0, 4171, + 4172, 3, 1352, 676, 0, 4172, 4173, 5, 135, 0, 0, 4173, 4174, 3, 412, 206, + 0, 4174, 4175, 5, 80, 0, 0, 4175, 4177, 3, 1348, 674, 0, 4176, 4178, 3, + 442, 221, 0, 4177, 4176, 1, 0, 0, 0, 4177, 4178, 1, 0, 0, 0, 4178, 4179, + 1, 0, 0, 0, 4179, 4180, 3, 444, 222, 0, 4180, 4181, 5, 62, 0, 0, 4181, + 4182, 5, 192, 0, 0, 4182, 4184, 5, 409, 0, 0, 4183, 4185, 3, 434, 217, + 0, 4184, 4183, 1, 0, 0, 0, 4184, 4185, 1, 0, 0, 0, 4185, 4186, 1, 0, 0, + 0, 4186, 4187, 5, 202, 0, 0, 4187, 4188, 3, 436, 218, 0, 4188, 4189, 3, + 1358, 679, 0, 4189, 4190, 5, 2, 0, 0, 4190, 4191, 3, 438, 219, 0, 4191, + 4192, 5, 3, 0, 0, 4192, 4194, 1, 0, 0, 0, 4193, 4145, 1, 0, 0, 0, 4193, + 4168, 1, 0, 0, 0, 4194, 409, 1, 0, 0, 0, 4195, 4200, 5, 145, 0, 0, 4196, + 4200, 5, 135, 0, 0, 4197, 4198, 5, 233, 0, 0, 4198, 4200, 5, 268, 0, 0, + 4199, 4195, 1, 0, 0, 0, 4199, 4196, 1, 0, 0, 0, 4199, 4197, 1, 0, 0, 0, + 4200, 411, 1, 0, 0, 0, 4201, 4206, 3, 414, 207, 0, 4202, 4203, 5, 82, 0, + 0, 4203, 4205, 3, 414, 207, 0, 4204, 4202, 1, 0, 0, 0, 4205, 4208, 1, 0, + 0, 0, 4206, 4204, 1, 0, 0, 0, 4206, 4207, 1, 0, 0, 0, 4207, 413, 1, 0, + 0, 0, 4208, 4206, 1, 0, 0, 0, 4209, 4217, 5, 232, 0, 0, 4210, 4217, 5, + 182, 0, 0, 4211, 4217, 5, 362, 0, 0, 4212, 4213, 5, 362, 0, 0, 4213, 4214, + 5, 268, 0, 0, 4214, 4217, 3, 220, 110, 0, 4215, 4217, 5, 351, 0, 0, 4216, + 4209, 1, 0, 0, 0, 4216, 4210, 1, 0, 0, 0, 4216, 4211, 1, 0, 0, 0, 4216, + 4212, 1, 0, 0, 0, 4216, 4215, 1, 0, 0, 0, 4217, 415, 1, 0, 0, 0, 4218, + 4219, 5, 449, 0, 0, 4219, 4220, 3, 418, 209, 0, 4220, 417, 1, 0, 0, 0, + 4221, 4223, 3, 420, 210, 0, 4222, 4221, 1, 0, 0, 0, 4223, 4224, 1, 0, 0, + 0, 4224, 4222, 1, 0, 0, 0, 4224, 4225, 1, 0, 0, 0, 4225, 419, 1, 0, 0, + 0, 4226, 4227, 3, 422, 211, 0, 4227, 4229, 3, 424, 212, 0, 4228, 4230, + 3, 844, 422, 0, 4229, 4228, 1, 0, 0, 0, 4229, 4230, 1, 0, 0, 0, 4230, 4231, + 1, 0, 0, 0, 4231, 4232, 3, 426, 213, 0, 4232, 421, 1, 0, 0, 0, 4233, 4234, + 7, 21, 0, 0, 4234, 423, 1, 0, 0, 0, 4235, 4236, 7, 22, 0, 0, 4236, 425, + 1, 0, 0, 0, 4237, 4238, 3, 1384, 692, 0, 4238, 427, 1, 0, 0, 0, 4239, 4241, + 5, 62, 0, 0, 4240, 4242, 3, 430, 215, 0, 4241, 4240, 1, 0, 0, 0, 4241, + 4242, 1, 0, 0, 0, 4242, 4243, 1, 0, 0, 0, 4243, 4244, 3, 432, 216, 0, 4244, + 429, 1, 0, 0, 0, 4245, 4246, 5, 192, 0, 0, 4246, 431, 1, 0, 0, 0, 4247, + 4248, 7, 23, 0, 0, 4248, 433, 1, 0, 0, 0, 4249, 4250, 5, 102, 0, 0, 4250, + 4251, 5, 2, 0, 0, 4251, 4252, 3, 1172, 586, 0, 4252, 4253, 5, 3, 0, 0, + 4253, 435, 1, 0, 0, 0, 4254, 4255, 7, 24, 0, 0, 4255, 437, 1, 0, 0, 0, + 4256, 4259, 3, 440, 220, 0, 4257, 4259, 1, 0, 0, 0, 4258, 4256, 1, 0, 0, + 0, 4258, 4257, 1, 0, 0, 0, 4259, 4264, 1, 0, 0, 0, 4260, 4261, 5, 6, 0, + 0, 4261, 4263, 3, 440, 220, 0, 4262, 4260, 1, 0, 0, 0, 4263, 4266, 1, 0, + 0, 0, 4264, 4262, 1, 0, 0, 0, 4264, 4265, 1, 0, 0, 0, 4265, 439, 1, 0, + 0, 0, 4266, 4264, 1, 0, 0, 0, 4267, 4272, 3, 1368, 684, 0, 4268, 4272, + 3, 1366, 683, 0, 4269, 4272, 3, 1370, 685, 0, 4270, 4272, 3, 1392, 696, + 0, 4271, 4267, 1, 0, 0, 0, 4271, 4268, 1, 0, 0, 0, 4271, 4269, 1, 0, 0, + 0, 4271, 4270, 1, 0, 0, 0, 4272, 441, 1, 0, 0, 0, 4273, 4274, 5, 64, 0, + 0, 4274, 4275, 3, 1348, 674, 0, 4275, 443, 1, 0, 0, 0, 4276, 4278, 3, 446, + 223, 0, 4277, 4276, 1, 0, 0, 0, 4278, 4281, 1, 0, 0, 0, 4279, 4277, 1, + 0, 0, 0, 4279, 4280, 1, 0, 0, 0, 4280, 445, 1, 0, 0, 0, 4281, 4279, 1, + 0, 0, 0, 4282, 4283, 5, 77, 0, 0, 4283, 4294, 5, 54, 0, 0, 4284, 4294, + 5, 54, 0, 0, 4285, 4286, 5, 69, 0, 0, 4286, 4294, 5, 221, 0, 0, 4287, 4288, + 5, 69, 0, 0, 4288, 4294, 5, 180, 0, 0, 4289, 4290, 5, 77, 0, 0, 4290, 4294, + 5, 364, 0, 0, 4291, 4292, 5, 262, 0, 0, 4292, 4294, 5, 228, 0, 0, 4293, + 4282, 1, 0, 0, 0, 4293, 4284, 1, 0, 0, 0, 4293, 4285, 1, 0, 0, 0, 4293, + 4287, 1, 0, 0, 0, 4293, 4289, 1, 0, 0, 0, 4293, 4291, 1, 0, 0, 0, 4294, + 447, 1, 0, 0, 0, 4295, 4296, 5, 46, 0, 0, 4296, 4297, 5, 198, 0, 0, 4297, + 4298, 5, 350, 0, 0, 4298, 4299, 3, 1352, 676, 0, 4299, 4300, 5, 80, 0, + 0, 4300, 4301, 3, 1392, 696, 0, 4301, 4302, 5, 202, 0, 0, 4302, 4303, 3, + 436, 218, 0, 4303, 4304, 3, 1358, 679, 0, 4304, 4305, 5, 2, 0, 0, 4305, + 4306, 5, 3, 0, 0, 4306, 4322, 1, 0, 0, 0, 4307, 4308, 5, 46, 0, 0, 4308, + 4309, 5, 198, 0, 0, 4309, 4310, 5, 350, 0, 0, 4310, 4311, 3, 1352, 676, + 0, 4311, 4312, 5, 80, 0, 0, 4312, 4313, 3, 1392, 696, 0, 4313, 4314, 5, + 102, 0, 0, 4314, 4315, 3, 450, 225, 0, 4315, 4316, 5, 202, 0, 0, 4316, + 4317, 3, 436, 218, 0, 4317, 4318, 3, 1358, 679, 0, 4318, 4319, 5, 2, 0, + 0, 4319, 4320, 5, 3, 0, 0, 4320, 4322, 1, 0, 0, 0, 4321, 4295, 1, 0, 0, + 0, 4321, 4307, 1, 0, 0, 0, 4322, 449, 1, 0, 0, 0, 4323, 4328, 3, 452, 226, + 0, 4324, 4325, 5, 33, 0, 0, 4325, 4327, 3, 452, 226, 0, 4326, 4324, 1, + 0, 0, 0, 4327, 4330, 1, 0, 0, 0, 4328, 4326, 1, 0, 0, 0, 4328, 4329, 1, + 0, 0, 0, 4329, 451, 1, 0, 0, 0, 4330, 4328, 1, 0, 0, 0, 4331, 4332, 3, + 1384, 692, 0, 4332, 4333, 5, 68, 0, 0, 4333, 4334, 5, 2, 0, 0, 4334, 4335, + 3, 454, 227, 0, 4335, 4336, 5, 3, 0, 0, 4336, 453, 1, 0, 0, 0, 4337, 4342, + 3, 1370, 685, 0, 4338, 4339, 5, 6, 0, 0, 4339, 4341, 3, 1370, 685, 0, 4340, + 4338, 1, 0, 0, 0, 4341, 4344, 1, 0, 0, 0, 4342, 4340, 1, 0, 0, 0, 4342, + 4343, 1, 0, 0, 0, 4343, 455, 1, 0, 0, 0, 4344, 4342, 1, 0, 0, 0, 4345, + 4346, 5, 138, 0, 0, 4346, 4347, 5, 198, 0, 0, 4347, 4348, 5, 350, 0, 0, + 4348, 4349, 3, 1352, 676, 0, 4349, 4350, 3, 458, 229, 0, 4350, 457, 1, + 0, 0, 0, 4351, 4358, 5, 193, 0, 0, 4352, 4353, 5, 193, 0, 0, 4353, 4358, + 5, 305, 0, 0, 4354, 4355, 5, 193, 0, 0, 4355, 4358, 5, 139, 0, 0, 4356, + 4358, 5, 186, 0, 0, 4357, 4351, 1, 0, 0, 0, 4357, 4352, 1, 0, 0, 0, 4357, + 4354, 1, 0, 0, 0, 4357, 4356, 1, 0, 0, 0, 4358, 459, 1, 0, 0, 0, 4359, + 4360, 5, 46, 0, 0, 4360, 4361, 5, 140, 0, 0, 4361, 4362, 3, 528, 264, 0, + 4362, 4363, 5, 42, 0, 0, 4363, 4364, 5, 2, 0, 0, 4364, 4365, 3, 1172, 586, + 0, 4365, 4366, 5, 3, 0, 0, 4366, 4367, 3, 444, 222, 0, 4367, 461, 1, 0, + 0, 0, 4368, 4370, 5, 46, 0, 0, 4369, 4371, 3, 626, 313, 0, 4370, 4369, + 1, 0, 0, 0, 4370, 4371, 1, 0, 0, 0, 4371, 4372, 1, 0, 0, 0, 4372, 4373, + 5, 136, 0, 0, 4373, 4374, 3, 1358, 679, 0, 4374, 4375, 3, 654, 327, 0, + 4375, 4376, 3, 464, 232, 0, 4376, 4483, 1, 0, 0, 0, 4377, 4379, 5, 46, + 0, 0, 4378, 4380, 3, 626, 313, 0, 4379, 4378, 1, 0, 0, 0, 4379, 4380, 1, + 0, 0, 0, 4380, 4381, 1, 0, 0, 0, 4381, 4382, 5, 136, 0, 0, 4382, 4383, + 3, 1358, 679, 0, 4383, 4384, 3, 472, 236, 0, 4384, 4483, 1, 0, 0, 0, 4385, + 4386, 5, 46, 0, 0, 4386, 4387, 5, 271, 0, 0, 4387, 4388, 3, 692, 346, 0, + 4388, 4389, 3, 464, 232, 0, 4389, 4483, 1, 0, 0, 0, 4390, 4391, 5, 46, + 0, 0, 4391, 4392, 5, 353, 0, 0, 4392, 4393, 3, 528, 264, 0, 4393, 4394, + 3, 464, 232, 0, 4394, 4483, 1, 0, 0, 0, 4395, 4396, 5, 46, 0, 0, 4396, + 4397, 5, 353, 0, 0, 4397, 4483, 3, 528, 264, 0, 4398, 4399, 5, 46, 0, 0, + 4399, 4400, 5, 353, 0, 0, 4400, 4401, 3, 528, 264, 0, 4401, 4402, 5, 36, + 0, 0, 4402, 4404, 5, 2, 0, 0, 4403, 4405, 3, 1108, 554, 0, 4404, 4403, + 1, 0, 0, 0, 4404, 4405, 1, 0, 0, 0, 4405, 4406, 1, 0, 0, 0, 4406, 4407, + 5, 3, 0, 0, 4407, 4483, 1, 0, 0, 0, 4408, 4409, 5, 46, 0, 0, 4409, 4410, + 5, 353, 0, 0, 4410, 4411, 3, 528, 264, 0, 4411, 4412, 5, 36, 0, 0, 4412, + 4413, 5, 196, 0, 0, 4413, 4415, 5, 2, 0, 0, 4414, 4416, 3, 478, 239, 0, + 4415, 4414, 1, 0, 0, 0, 4415, 4416, 1, 0, 0, 0, 4416, 4417, 1, 0, 0, 0, + 4417, 4418, 5, 3, 0, 0, 4418, 4483, 1, 0, 0, 0, 4419, 4420, 5, 46, 0, 0, + 4420, 4421, 5, 353, 0, 0, 4421, 4422, 3, 528, 264, 0, 4422, 4423, 5, 36, + 0, 0, 4423, 4424, 5, 292, 0, 0, 4424, 4425, 3, 464, 232, 0, 4425, 4483, + 1, 0, 0, 0, 4426, 4427, 5, 46, 0, 0, 4427, 4428, 5, 348, 0, 0, 4428, 4429, + 5, 318, 0, 0, 4429, 4430, 5, 276, 0, 0, 4430, 4431, 3, 528, 264, 0, 4431, + 4432, 3, 464, 232, 0, 4432, 4483, 1, 0, 0, 0, 4433, 4434, 5, 46, 0, 0, + 4434, 4435, 5, 348, 0, 0, 4435, 4436, 5, 318, 0, 0, 4436, 4437, 5, 185, + 0, 0, 4437, 4438, 3, 528, 264, 0, 4438, 4439, 3, 464, 232, 0, 4439, 4483, + 1, 0, 0, 0, 4440, 4441, 5, 46, 0, 0, 4441, 4442, 5, 348, 0, 0, 4442, 4443, + 5, 318, 0, 0, 4443, 4444, 5, 346, 0, 0, 4444, 4445, 3, 528, 264, 0, 4445, + 4446, 3, 464, 232, 0, 4446, 4483, 1, 0, 0, 0, 4447, 4448, 5, 46, 0, 0, + 4448, 4449, 5, 348, 0, 0, 4449, 4450, 5, 318, 0, 0, 4450, 4451, 5, 163, + 0, 0, 4451, 4452, 3, 528, 264, 0, 4452, 4453, 3, 464, 232, 0, 4453, 4483, + 1, 0, 0, 0, 4454, 4455, 5, 46, 0, 0, 4455, 4456, 5, 108, 0, 0, 4456, 4457, + 3, 528, 264, 0, 4457, 4458, 3, 464, 232, 0, 4458, 4483, 1, 0, 0, 0, 4459, + 4460, 5, 46, 0, 0, 4460, 4461, 5, 108, 0, 0, 4461, 4462, 5, 220, 0, 0, + 4462, 4463, 5, 77, 0, 0, 4463, 4464, 5, 390, 0, 0, 4464, 4465, 3, 528, + 264, 0, 4465, 4466, 3, 464, 232, 0, 4466, 4483, 1, 0, 0, 0, 4467, 4468, + 5, 46, 0, 0, 4468, 4469, 5, 108, 0, 0, 4469, 4470, 3, 528, 264, 0, 4470, + 4471, 5, 64, 0, 0, 4471, 4472, 3, 528, 264, 0, 4472, 4483, 1, 0, 0, 0, + 4473, 4474, 5, 46, 0, 0, 4474, 4475, 5, 108, 0, 0, 4475, 4476, 5, 220, + 0, 0, 4476, 4477, 5, 77, 0, 0, 4477, 4478, 5, 390, 0, 0, 4478, 4479, 3, + 528, 264, 0, 4479, 4480, 5, 64, 0, 0, 4480, 4481, 3, 528, 264, 0, 4481, + 4483, 1, 0, 0, 0, 4482, 4368, 1, 0, 0, 0, 4482, 4377, 1, 0, 0, 0, 4482, + 4385, 1, 0, 0, 0, 4482, 4390, 1, 0, 0, 0, 4482, 4395, 1, 0, 0, 0, 4482, + 4398, 1, 0, 0, 0, 4482, 4408, 1, 0, 0, 0, 4482, 4419, 1, 0, 0, 0, 4482, + 4426, 1, 0, 0, 0, 4482, 4433, 1, 0, 0, 0, 4482, 4440, 1, 0, 0, 0, 4482, + 4447, 1, 0, 0, 0, 4482, 4454, 1, 0, 0, 0, 4482, 4459, 1, 0, 0, 0, 4482, + 4467, 1, 0, 0, 0, 4482, 4473, 1, 0, 0, 0, 4483, 463, 1, 0, 0, 0, 4484, + 4485, 5, 2, 0, 0, 4485, 4486, 3, 466, 233, 0, 4486, 4487, 5, 3, 0, 0, 4487, + 465, 1, 0, 0, 0, 4488, 4493, 3, 468, 234, 0, 4489, 4490, 5, 6, 0, 0, 4490, + 4492, 3, 468, 234, 0, 4491, 4489, 1, 0, 0, 0, 4492, 4495, 1, 0, 0, 0, 4493, + 4491, 1, 0, 0, 0, 4493, 4494, 1, 0, 0, 0, 4494, 467, 1, 0, 0, 0, 4495, + 4493, 1, 0, 0, 0, 4496, 4499, 3, 1392, 696, 0, 4497, 4498, 5, 10, 0, 0, + 4498, 4500, 3, 470, 235, 0, 4499, 4497, 1, 0, 0, 0, 4499, 4500, 1, 0, 0, + 0, 4500, 469, 1, 0, 0, 0, 4501, 4508, 3, 648, 324, 0, 4502, 4508, 3, 1404, + 702, 0, 4503, 4508, 3, 1286, 643, 0, 4504, 4508, 3, 296, 148, 0, 4505, + 4508, 3, 1370, 685, 0, 4506, 4508, 5, 401, 0, 0, 4507, 4501, 1, 0, 0, 0, + 4507, 4502, 1, 0, 0, 0, 4507, 4503, 1, 0, 0, 0, 4507, 4504, 1, 0, 0, 0, + 4507, 4505, 1, 0, 0, 0, 4507, 4506, 1, 0, 0, 0, 4508, 471, 1, 0, 0, 0, + 4509, 4510, 5, 2, 0, 0, 4510, 4511, 3, 474, 237, 0, 4511, 4512, 5, 3, 0, + 0, 4512, 473, 1, 0, 0, 0, 4513, 4518, 3, 476, 238, 0, 4514, 4515, 5, 6, + 0, 0, 4515, 4517, 3, 476, 238, 0, 4516, 4514, 1, 0, 0, 0, 4517, 4520, 1, + 0, 0, 0, 4518, 4516, 1, 0, 0, 0, 4518, 4519, 1, 0, 0, 0, 4519, 475, 1, + 0, 0, 0, 4520, 4518, 1, 0, 0, 0, 4521, 4522, 3, 1394, 697, 0, 4522, 4523, + 5, 10, 0, 0, 4523, 4524, 3, 470, 235, 0, 4524, 477, 1, 0, 0, 0, 4525, 4526, + 3, 480, 240, 0, 4526, 479, 1, 0, 0, 0, 4527, 4532, 3, 1370, 685, 0, 4528, + 4529, 5, 6, 0, 0, 4529, 4531, 3, 1370, 685, 0, 4530, 4528, 1, 0, 0, 0, + 4531, 4534, 1, 0, 0, 0, 4532, 4530, 1, 0, 0, 0, 4532, 4533, 1, 0, 0, 0, + 4533, 481, 1, 0, 0, 0, 4534, 4532, 1, 0, 0, 0, 4535, 4536, 5, 138, 0, 0, + 4536, 4537, 5, 353, 0, 0, 4537, 4538, 3, 528, 264, 0, 4538, 4539, 5, 133, + 0, 0, 4539, 4541, 5, 452, 0, 0, 4540, 4542, 3, 484, 242, 0, 4541, 4540, + 1, 0, 0, 0, 4541, 4542, 1, 0, 0, 0, 4542, 4543, 1, 0, 0, 0, 4543, 4544, + 3, 1370, 685, 0, 4544, 4579, 1, 0, 0, 0, 4545, 4546, 5, 138, 0, 0, 4546, + 4547, 5, 353, 0, 0, 4547, 4548, 3, 528, 264, 0, 4548, 4549, 5, 133, 0, + 0, 4549, 4551, 5, 452, 0, 0, 4550, 4552, 3, 484, 242, 0, 4551, 4550, 1, + 0, 0, 0, 4551, 4552, 1, 0, 0, 0, 4552, 4553, 1, 0, 0, 0, 4553, 4554, 3, + 1370, 685, 0, 4554, 4555, 5, 145, 0, 0, 4555, 4556, 3, 1370, 685, 0, 4556, + 4579, 1, 0, 0, 0, 4557, 4558, 5, 138, 0, 0, 4558, 4559, 5, 353, 0, 0, 4559, + 4560, 3, 528, 264, 0, 4560, 4561, 5, 133, 0, 0, 4561, 4563, 5, 452, 0, + 0, 4562, 4564, 3, 484, 242, 0, 4563, 4562, 1, 0, 0, 0, 4563, 4564, 1, 0, + 0, 0, 4564, 4565, 1, 0, 0, 0, 4565, 4566, 3, 1370, 685, 0, 4566, 4567, + 5, 135, 0, 0, 4567, 4568, 3, 1370, 685, 0, 4568, 4579, 1, 0, 0, 0, 4569, + 4570, 5, 138, 0, 0, 4570, 4571, 5, 353, 0, 0, 4571, 4572, 3, 528, 264, + 0, 4572, 4573, 5, 302, 0, 0, 4573, 4574, 5, 452, 0, 0, 4574, 4575, 3, 1370, + 685, 0, 4575, 4576, 5, 94, 0, 0, 4576, 4577, 3, 1370, 685, 0, 4577, 4579, + 1, 0, 0, 0, 4578, 4535, 1, 0, 0, 0, 4578, 4545, 1, 0, 0, 0, 4578, 4557, + 1, 0, 0, 0, 4578, 4569, 1, 0, 0, 0, 4579, 483, 1, 0, 0, 0, 4580, 4581, + 5, 220, 0, 0, 4581, 4582, 5, 77, 0, 0, 4582, 4583, 5, 390, 0, 0, 4583, + 485, 1, 0, 0, 0, 4584, 4585, 5, 46, 0, 0, 4585, 4586, 5, 271, 0, 0, 4586, + 4587, 5, 156, 0, 0, 4587, 4589, 3, 528, 264, 0, 4588, 4590, 3, 492, 246, + 0, 4589, 4588, 1, 0, 0, 0, 4589, 4590, 1, 0, 0, 0, 4590, 4591, 1, 0, 0, + 0, 4591, 4592, 5, 62, 0, 0, 4592, 4593, 5, 353, 0, 0, 4593, 4594, 3, 1128, + 564, 0, 4594, 4595, 5, 100, 0, 0, 4595, 4597, 3, 1352, 676, 0, 4596, 4598, + 3, 494, 247, 0, 4597, 4596, 1, 0, 0, 0, 4597, 4598, 1, 0, 0, 0, 4598, 4599, + 1, 0, 0, 0, 4599, 4600, 5, 36, 0, 0, 4600, 4601, 3, 488, 244, 0, 4601, + 487, 1, 0, 0, 0, 4602, 4607, 3, 490, 245, 0, 4603, 4604, 5, 6, 0, 0, 4604, + 4606, 3, 490, 245, 0, 4605, 4603, 1, 0, 0, 0, 4606, 4609, 1, 0, 0, 0, 4607, + 4605, 1, 0, 0, 0, 4607, 4608, 1, 0, 0, 0, 4608, 489, 1, 0, 0, 0, 4609, + 4607, 1, 0, 0, 0, 4610, 4611, 5, 271, 0, 0, 4611, 4612, 3, 1368, 684, 0, + 4612, 4614, 3, 692, 346, 0, 4613, 4615, 3, 496, 248, 0, 4614, 4613, 1, + 0, 0, 0, 4614, 4615, 1, 0, 0, 0, 4615, 4617, 1, 0, 0, 0, 4616, 4618, 3, + 498, 249, 0, 4617, 4616, 1, 0, 0, 0, 4617, 4618, 1, 0, 0, 0, 4618, 4642, + 1, 0, 0, 0, 4619, 4620, 5, 271, 0, 0, 4620, 4621, 3, 1368, 684, 0, 4621, + 4623, 3, 696, 348, 0, 4622, 4624, 3, 496, 248, 0, 4623, 4622, 1, 0, 0, + 0, 4623, 4624, 1, 0, 0, 0, 4624, 4626, 1, 0, 0, 0, 4625, 4627, 3, 498, + 249, 0, 4626, 4625, 1, 0, 0, 0, 4626, 4627, 1, 0, 0, 0, 4627, 4642, 1, + 0, 0, 0, 4628, 4629, 5, 211, 0, 0, 4629, 4630, 3, 1368, 684, 0, 4630, 4631, + 3, 634, 317, 0, 4631, 4642, 1, 0, 0, 0, 4632, 4633, 5, 211, 0, 0, 4633, + 4634, 3, 1368, 684, 0, 4634, 4635, 5, 2, 0, 0, 4635, 4636, 3, 1296, 648, + 0, 4636, 4637, 5, 3, 0, 0, 4637, 4638, 3, 634, 317, 0, 4638, 4642, 1, 0, + 0, 0, 4639, 4640, 5, 338, 0, 0, 4640, 4642, 3, 1128, 564, 0, 4641, 4610, + 1, 0, 0, 0, 4641, 4619, 1, 0, 0, 0, 4641, 4628, 1, 0, 0, 0, 4641, 4632, + 1, 0, 0, 0, 4641, 4639, 1, 0, 0, 0, 4642, 491, 1, 0, 0, 0, 4643, 4644, + 5, 53, 0, 0, 4644, 493, 1, 0, 0, 0, 4645, 4646, 5, 206, 0, 0, 4646, 4647, + 3, 528, 264, 0, 4647, 495, 1, 0, 0, 0, 4648, 4649, 5, 62, 0, 0, 4649, 4655, + 5, 318, 0, 0, 4650, 4651, 5, 62, 0, 0, 4651, 4652, 5, 83, 0, 0, 4652, 4653, + 5, 147, 0, 0, 4653, 4655, 3, 528, 264, 0, 4654, 4648, 1, 0, 0, 0, 4654, + 4650, 1, 0, 0, 0, 4655, 497, 1, 0, 0, 0, 4656, 4657, 5, 295, 0, 0, 4657, + 499, 1, 0, 0, 0, 4658, 4659, 5, 46, 0, 0, 4659, 4660, 5, 271, 0, 0, 4660, + 4661, 5, 206, 0, 0, 4661, 4662, 3, 528, 264, 0, 4662, 4663, 5, 100, 0, + 0, 4663, 4664, 3, 1352, 676, 0, 4664, 501, 1, 0, 0, 0, 4665, 4666, 5, 138, + 0, 0, 4666, 4667, 5, 271, 0, 0, 4667, 4668, 5, 206, 0, 0, 4668, 4669, 3, + 528, 264, 0, 4669, 4670, 5, 100, 0, 0, 4670, 4671, 3, 1352, 676, 0, 4671, + 4672, 5, 133, 0, 0, 4672, 4673, 3, 488, 244, 0, 4673, 4684, 1, 0, 0, 0, + 4674, 4675, 5, 138, 0, 0, 4675, 4676, 5, 271, 0, 0, 4676, 4677, 5, 206, + 0, 0, 4677, 4678, 3, 528, 264, 0, 4678, 4679, 5, 100, 0, 0, 4679, 4680, + 3, 1352, 676, 0, 4680, 4681, 5, 191, 0, 0, 4681, 4682, 3, 504, 252, 0, + 4682, 4684, 1, 0, 0, 0, 4683, 4665, 1, 0, 0, 0, 4683, 4674, 1, 0, 0, 0, + 4684, 503, 1, 0, 0, 0, 4685, 4690, 3, 506, 253, 0, 4686, 4687, 5, 6, 0, + 0, 4687, 4689, 3, 506, 253, 0, 4688, 4686, 1, 0, 0, 0, 4689, 4692, 1, 0, + 0, 0, 4690, 4688, 1, 0, 0, 0, 4690, 4691, 1, 0, 0, 0, 4691, 505, 1, 0, + 0, 0, 4692, 4690, 1, 0, 0, 0, 4693, 4694, 5, 271, 0, 0, 4694, 4695, 3, + 1368, 684, 0, 4695, 4696, 5, 2, 0, 0, 4696, 4697, 3, 1296, 648, 0, 4697, + 4698, 5, 3, 0, 0, 4698, 4706, 1, 0, 0, 0, 4699, 4700, 5, 211, 0, 0, 4700, + 4701, 3, 1368, 684, 0, 4701, 4702, 5, 2, 0, 0, 4702, 4703, 3, 1296, 648, + 0, 4703, 4704, 5, 3, 0, 0, 4704, 4706, 1, 0, 0, 0, 4705, 4693, 1, 0, 0, + 0, 4705, 4699, 1, 0, 0, 0, 4706, 507, 1, 0, 0, 0, 4707, 4708, 5, 191, 0, + 0, 4708, 4709, 5, 271, 0, 0, 4709, 4710, 5, 156, 0, 0, 4710, 4711, 3, 528, + 264, 0, 4711, 4712, 5, 100, 0, 0, 4712, 4714, 3, 1352, 676, 0, 4713, 4715, + 3, 108, 54, 0, 4714, 4713, 1, 0, 0, 0, 4714, 4715, 1, 0, 0, 0, 4715, 4728, + 1, 0, 0, 0, 4716, 4717, 5, 191, 0, 0, 4717, 4718, 5, 271, 0, 0, 4718, 4719, + 5, 156, 0, 0, 4719, 4720, 5, 220, 0, 0, 4720, 4721, 5, 390, 0, 0, 4721, + 4722, 3, 528, 264, 0, 4722, 4723, 5, 100, 0, 0, 4723, 4725, 3, 1352, 676, + 0, 4724, 4726, 3, 108, 54, 0, 4725, 4724, 1, 0, 0, 0, 4725, 4726, 1, 0, + 0, 0, 4726, 4728, 1, 0, 0, 0, 4727, 4707, 1, 0, 0, 0, 4727, 4716, 1, 0, + 0, 0, 4728, 509, 1, 0, 0, 0, 4729, 4730, 5, 191, 0, 0, 4730, 4731, 5, 271, + 0, 0, 4731, 4732, 5, 206, 0, 0, 4732, 4733, 3, 528, 264, 0, 4733, 4734, + 5, 100, 0, 0, 4734, 4736, 3, 1352, 676, 0, 4735, 4737, 3, 108, 54, 0, 4736, + 4735, 1, 0, 0, 0, 4736, 4737, 1, 0, 0, 0, 4737, 4750, 1, 0, 0, 0, 4738, + 4739, 5, 191, 0, 0, 4739, 4740, 5, 271, 0, 0, 4740, 4741, 5, 206, 0, 0, + 4741, 4742, 5, 220, 0, 0, 4742, 4743, 5, 390, 0, 0, 4743, 4744, 3, 528, + 264, 0, 4744, 4745, 5, 100, 0, 0, 4745, 4747, 3, 1352, 676, 0, 4746, 4748, + 3, 108, 54, 0, 4747, 4746, 1, 0, 0, 0, 4747, 4748, 1, 0, 0, 0, 4748, 4750, + 1, 0, 0, 0, 4749, 4729, 1, 0, 0, 0, 4749, 4738, 1, 0, 0, 0, 4750, 511, + 1, 0, 0, 0, 4751, 4752, 5, 191, 0, 0, 4752, 4753, 5, 274, 0, 0, 4753, 4754, + 5, 147, 0, 0, 4754, 4756, 3, 1382, 691, 0, 4755, 4757, 3, 108, 54, 0, 4756, + 4755, 1, 0, 0, 0, 4756, 4757, 1, 0, 0, 0, 4757, 513, 1, 0, 0, 0, 4758, + 4759, 5, 294, 0, 0, 4759, 4760, 5, 274, 0, 0, 4760, 4761, 5, 147, 0, 0, + 4761, 4762, 3, 1382, 691, 0, 4762, 4763, 5, 94, 0, 0, 4763, 4764, 3, 1380, + 690, 0, 4764, 515, 1, 0, 0, 0, 4765, 4766, 5, 191, 0, 0, 4766, 4767, 3, + 518, 259, 0, 4767, 4768, 5, 220, 0, 0, 4768, 4769, 5, 390, 0, 0, 4769, + 4771, 3, 526, 263, 0, 4770, 4772, 3, 108, 54, 0, 4771, 4770, 1, 0, 0, 0, + 4771, 4772, 1, 0, 0, 0, 4772, 4856, 1, 0, 0, 0, 4773, 4774, 5, 191, 0, + 0, 4774, 4775, 3, 518, 259, 0, 4775, 4777, 3, 526, 263, 0, 4776, 4778, + 3, 108, 54, 0, 4777, 4776, 1, 0, 0, 0, 4777, 4778, 1, 0, 0, 0, 4778, 4856, + 1, 0, 0, 0, 4779, 4780, 5, 191, 0, 0, 4780, 4781, 3, 522, 261, 0, 4781, + 4782, 5, 220, 0, 0, 4782, 4783, 5, 390, 0, 0, 4783, 4785, 3, 1350, 675, + 0, 4784, 4786, 3, 108, 54, 0, 4785, 4784, 1, 0, 0, 0, 4785, 4786, 1, 0, + 0, 0, 4786, 4856, 1, 0, 0, 0, 4787, 4788, 5, 191, 0, 0, 4788, 4789, 3, + 522, 261, 0, 4789, 4791, 3, 1350, 675, 0, 4790, 4792, 3, 108, 54, 0, 4791, + 4790, 1, 0, 0, 0, 4791, 4792, 1, 0, 0, 0, 4792, 4856, 1, 0, 0, 0, 4793, + 4794, 5, 191, 0, 0, 4794, 4795, 3, 524, 262, 0, 4795, 4796, 3, 1352, 676, + 0, 4796, 4797, 5, 80, 0, 0, 4797, 4799, 3, 528, 264, 0, 4798, 4800, 3, + 108, 54, 0, 4799, 4798, 1, 0, 0, 0, 4799, 4800, 1, 0, 0, 0, 4800, 4856, + 1, 0, 0, 0, 4801, 4802, 5, 191, 0, 0, 4802, 4803, 3, 524, 262, 0, 4803, + 4804, 5, 220, 0, 0, 4804, 4805, 5, 390, 0, 0, 4805, 4806, 3, 1352, 676, + 0, 4806, 4807, 5, 80, 0, 0, 4807, 4809, 3, 528, 264, 0, 4808, 4810, 3, + 108, 54, 0, 4809, 4808, 1, 0, 0, 0, 4809, 4810, 1, 0, 0, 0, 4810, 4856, + 1, 0, 0, 0, 4811, 4812, 5, 191, 0, 0, 4812, 4813, 5, 353, 0, 0, 4813, 4815, + 3, 532, 266, 0, 4814, 4816, 3, 108, 54, 0, 4815, 4814, 1, 0, 0, 0, 4815, + 4816, 1, 0, 0, 0, 4816, 4856, 1, 0, 0, 0, 4817, 4818, 5, 191, 0, 0, 4818, + 4819, 5, 353, 0, 0, 4819, 4820, 5, 220, 0, 0, 4820, 4821, 5, 390, 0, 0, + 4821, 4823, 3, 532, 266, 0, 4822, 4824, 3, 108, 54, 0, 4823, 4822, 1, 0, + 0, 0, 4823, 4824, 1, 0, 0, 0, 4824, 4856, 1, 0, 0, 0, 4825, 4826, 5, 191, + 0, 0, 4826, 4827, 5, 189, 0, 0, 4827, 4829, 3, 532, 266, 0, 4828, 4830, + 3, 108, 54, 0, 4829, 4828, 1, 0, 0, 0, 4829, 4830, 1, 0, 0, 0, 4830, 4856, + 1, 0, 0, 0, 4831, 4832, 5, 191, 0, 0, 4832, 4833, 5, 189, 0, 0, 4833, 4834, + 5, 220, 0, 0, 4834, 4835, 5, 390, 0, 0, 4835, 4837, 3, 532, 266, 0, 4836, + 4838, 3, 108, 54, 0, 4837, 4836, 1, 0, 0, 0, 4837, 4838, 1, 0, 0, 0, 4838, + 4856, 1, 0, 0, 0, 4839, 4840, 5, 191, 0, 0, 4840, 4841, 5, 226, 0, 0, 4841, + 4842, 5, 109, 0, 0, 4842, 4844, 3, 526, 263, 0, 4843, 4845, 3, 108, 54, + 0, 4844, 4843, 1, 0, 0, 0, 4844, 4845, 1, 0, 0, 0, 4845, 4856, 1, 0, 0, + 0, 4846, 4847, 5, 191, 0, 0, 4847, 4848, 5, 226, 0, 0, 4848, 4849, 5, 109, + 0, 0, 4849, 4850, 5, 220, 0, 0, 4850, 4851, 5, 390, 0, 0, 4851, 4853, 3, + 526, 263, 0, 4852, 4854, 3, 108, 54, 0, 4853, 4852, 1, 0, 0, 0, 4853, 4854, + 1, 0, 0, 0, 4854, 4856, 1, 0, 0, 0, 4855, 4765, 1, 0, 0, 0, 4855, 4773, + 1, 0, 0, 0, 4855, 4779, 1, 0, 0, 0, 4855, 4787, 1, 0, 0, 0, 4855, 4793, + 1, 0, 0, 0, 4855, 4801, 1, 0, 0, 0, 4855, 4811, 1, 0, 0, 0, 4855, 4817, + 1, 0, 0, 0, 4855, 4825, 1, 0, 0, 0, 4855, 4831, 1, 0, 0, 0, 4855, 4839, + 1, 0, 0, 0, 4855, 4846, 1, 0, 0, 0, 4856, 517, 1, 0, 0, 0, 4857, 4881, + 5, 92, 0, 0, 4858, 4881, 5, 321, 0, 0, 4859, 4881, 5, 369, 0, 0, 4860, + 4861, 5, 251, 0, 0, 4861, 4881, 5, 369, 0, 0, 4862, 4881, 5, 226, 0, 0, + 4863, 4864, 5, 63, 0, 0, 4864, 4881, 5, 92, 0, 0, 4865, 4881, 5, 108, 0, + 0, 4866, 4881, 5, 168, 0, 0, 4867, 4881, 5, 335, 0, 0, 4868, 4869, 5, 348, + 0, 0, 4869, 4870, 5, 318, 0, 0, 4870, 4881, 5, 276, 0, 0, 4871, 4872, 5, + 348, 0, 0, 4872, 4873, 5, 318, 0, 0, 4873, 4881, 5, 185, 0, 0, 4874, 4875, + 5, 348, 0, 0, 4875, 4876, 5, 318, 0, 0, 4876, 4881, 5, 346, 0, 0, 4877, + 4878, 5, 348, 0, 0, 4878, 4879, 5, 318, 0, 0, 4879, 4881, 5, 163, 0, 0, + 4880, 4857, 1, 0, 0, 0, 4880, 4858, 1, 0, 0, 0, 4880, 4859, 1, 0, 0, 0, + 4880, 4860, 1, 0, 0, 0, 4880, 4862, 1, 0, 0, 0, 4880, 4863, 1, 0, 0, 0, + 4880, 4865, 1, 0, 0, 0, 4880, 4866, 1, 0, 0, 0, 4880, 4867, 1, 0, 0, 0, + 4880, 4868, 1, 0, 0, 0, 4880, 4871, 1, 0, 0, 0, 4880, 4874, 1, 0, 0, 0, + 4880, 4877, 1, 0, 0, 0, 4881, 519, 1, 0, 0, 0, 4882, 4888, 3, 522, 261, + 0, 4883, 4888, 5, 175, 0, 0, 4884, 4888, 5, 311, 0, 0, 4885, 4888, 5, 453, + 0, 0, 4886, 4888, 5, 344, 0, 0, 4887, 4882, 1, 0, 0, 0, 4887, 4883, 1, + 0, 0, 0, 4887, 4884, 1, 0, 0, 0, 4887, 4885, 1, 0, 0, 0, 4887, 4886, 1, + 0, 0, 0, 4888, 521, 1, 0, 0, 0, 4889, 4890, 5, 131, 0, 0, 4890, 4905, 5, + 448, 0, 0, 4891, 4892, 5, 198, 0, 0, 4892, 4905, 5, 350, 0, 0, 4893, 4905, + 5, 204, 0, 0, 4894, 4895, 5, 63, 0, 0, 4895, 4896, 5, 174, 0, 0, 4896, + 4905, 5, 374, 0, 0, 4897, 4899, 3, 312, 156, 0, 4898, 4897, 1, 0, 0, 0, + 4898, 4899, 1, 0, 0, 0, 4899, 4900, 1, 0, 0, 0, 4900, 4905, 5, 238, 0, + 0, 4901, 4905, 5, 454, 0, 0, 4902, 4905, 5, 316, 0, 0, 4903, 4905, 5, 324, + 0, 0, 4904, 4889, 1, 0, 0, 0, 4904, 4891, 1, 0, 0, 0, 4904, 4893, 1, 0, + 0, 0, 4904, 4894, 1, 0, 0, 0, 4904, 4898, 1, 0, 0, 0, 4904, 4901, 1, 0, + 0, 0, 4904, 4902, 1, 0, 0, 0, 4904, 4903, 1, 0, 0, 0, 4905, 523, 1, 0, + 0, 0, 4906, 4907, 7, 25, 0, 0, 4907, 525, 1, 0, 0, 0, 4908, 4913, 3, 528, + 264, 0, 4909, 4910, 5, 6, 0, 0, 4910, 4912, 3, 528, 264, 0, 4911, 4909, + 1, 0, 0, 0, 4912, 4915, 1, 0, 0, 0, 4913, 4911, 1, 0, 0, 0, 4913, 4914, + 1, 0, 0, 0, 4914, 527, 1, 0, 0, 0, 4915, 4913, 1, 0, 0, 0, 4916, 4918, + 3, 1384, 692, 0, 4917, 4919, 3, 530, 265, 0, 4918, 4917, 1, 0, 0, 0, 4918, + 4919, 1, 0, 0, 0, 4919, 529, 1, 0, 0, 0, 4920, 4921, 5, 11, 0, 0, 4921, + 4923, 3, 1354, 677, 0, 4922, 4920, 1, 0, 0, 0, 4923, 4924, 1, 0, 0, 0, + 4924, 4922, 1, 0, 0, 0, 4924, 4925, 1, 0, 0, 0, 4925, 531, 1, 0, 0, 0, + 4926, 4931, 3, 1128, 564, 0, 4927, 4928, 5, 6, 0, 0, 4928, 4930, 3, 1128, + 564, 0, 4929, 4927, 1, 0, 0, 0, 4930, 4933, 1, 0, 0, 0, 4931, 4929, 1, + 0, 0, 0, 4931, 4932, 1, 0, 0, 0, 4932, 533, 1, 0, 0, 0, 4933, 4931, 1, + 0, 0, 0, 4934, 4936, 5, 351, 0, 0, 4935, 4937, 3, 998, 499, 0, 4936, 4935, + 1, 0, 0, 0, 4936, 4937, 1, 0, 0, 0, 4937, 4938, 1, 0, 0, 0, 4938, 4940, + 3, 1086, 543, 0, 4939, 4941, 3, 536, 268, 0, 4940, 4939, 1, 0, 0, 0, 4940, + 4941, 1, 0, 0, 0, 4941, 4943, 1, 0, 0, 0, 4942, 4944, 3, 108, 54, 0, 4943, + 4942, 1, 0, 0, 0, 4943, 4944, 1, 0, 0, 0, 4944, 535, 1, 0, 0, 0, 4945, + 4946, 5, 167, 0, 0, 4946, 4950, 5, 219, 0, 0, 4947, 4948, 5, 307, 0, 0, + 4948, 4950, 5, 219, 0, 0, 4949, 4945, 1, 0, 0, 0, 4949, 4947, 1, 0, 0, + 0, 4950, 537, 1, 0, 0, 0, 4951, 4952, 5, 159, 0, 0, 4952, 4953, 5, 80, + 0, 0, 4953, 4954, 3, 518, 259, 0, 4954, 4955, 3, 528, 264, 0, 4955, 4956, + 5, 116, 0, 0, 4956, 4957, 3, 540, 270, 0, 4957, 5099, 1, 0, 0, 0, 4958, + 4959, 5, 159, 0, 0, 4959, 4960, 5, 80, 0, 0, 4960, 4961, 5, 44, 0, 0, 4961, + 4962, 3, 528, 264, 0, 4962, 4963, 5, 116, 0, 0, 4963, 4964, 3, 540, 270, + 0, 4964, 5099, 1, 0, 0, 0, 4965, 4966, 5, 159, 0, 0, 4966, 4967, 5, 80, + 0, 0, 4967, 4968, 3, 520, 260, 0, 4968, 4969, 3, 1352, 676, 0, 4969, 4970, + 5, 116, 0, 0, 4970, 4971, 3, 540, 270, 0, 4971, 5099, 1, 0, 0, 0, 4972, + 4973, 5, 159, 0, 0, 4973, 4974, 5, 80, 0, 0, 4974, 4975, 5, 353, 0, 0, + 4975, 4976, 3, 1128, 564, 0, 4976, 4977, 5, 116, 0, 0, 4977, 4978, 3, 540, + 270, 0, 4978, 5099, 1, 0, 0, 0, 4979, 4980, 5, 159, 0, 0, 4980, 4981, 5, + 80, 0, 0, 4981, 4982, 5, 189, 0, 0, 4982, 4983, 3, 1128, 564, 0, 4983, + 4984, 5, 116, 0, 0, 4984, 4985, 3, 540, 270, 0, 4985, 5099, 1, 0, 0, 0, + 4986, 4987, 5, 159, 0, 0, 4987, 4988, 5, 80, 0, 0, 4988, 4989, 5, 136, + 0, 0, 4989, 4990, 3, 658, 329, 0, 4990, 4991, 5, 116, 0, 0, 4991, 4992, + 3, 540, 270, 0, 4992, 5099, 1, 0, 0, 0, 4993, 4994, 5, 159, 0, 0, 4994, + 4995, 5, 80, 0, 0, 4995, 4996, 5, 211, 0, 0, 4996, 4997, 3, 634, 317, 0, + 4997, 4998, 5, 116, 0, 0, 4998, 4999, 3, 540, 270, 0, 4999, 5099, 1, 0, + 0, 0, 5000, 5001, 5, 159, 0, 0, 5001, 5002, 5, 80, 0, 0, 5002, 5003, 5, + 271, 0, 0, 5003, 5004, 3, 696, 348, 0, 5004, 5005, 5, 116, 0, 0, 5005, + 5006, 3, 540, 270, 0, 5006, 5099, 1, 0, 0, 0, 5007, 5008, 5, 159, 0, 0, + 5008, 5009, 5, 80, 0, 0, 5009, 5010, 5, 45, 0, 0, 5010, 5011, 3, 1352, + 676, 0, 5011, 5012, 5, 80, 0, 0, 5012, 5013, 3, 528, 264, 0, 5013, 5014, + 5, 116, 0, 0, 5014, 5015, 3, 540, 270, 0, 5015, 5099, 1, 0, 0, 0, 5016, + 5017, 5, 159, 0, 0, 5017, 5018, 5, 80, 0, 0, 5018, 5019, 5, 45, 0, 0, 5019, + 5020, 3, 1352, 676, 0, 5020, 5021, 5, 80, 0, 0, 5021, 5022, 5, 189, 0, + 0, 5022, 5023, 3, 528, 264, 0, 5023, 5024, 5, 116, 0, 0, 5024, 5025, 3, + 540, 270, 0, 5025, 5099, 1, 0, 0, 0, 5026, 5027, 5, 159, 0, 0, 5027, 5028, + 5, 80, 0, 0, 5028, 5029, 3, 524, 262, 0, 5029, 5030, 3, 1352, 676, 0, 5030, + 5031, 5, 80, 0, 0, 5031, 5032, 3, 528, 264, 0, 5032, 5033, 5, 116, 0, 0, + 5033, 5034, 3, 540, 270, 0, 5034, 5099, 1, 0, 0, 0, 5035, 5036, 5, 159, + 0, 0, 5036, 5037, 5, 80, 0, 0, 5037, 5038, 5, 289, 0, 0, 5038, 5039, 3, + 634, 317, 0, 5039, 5040, 5, 116, 0, 0, 5040, 5041, 3, 540, 270, 0, 5041, + 5099, 1, 0, 0, 0, 5042, 5043, 5, 159, 0, 0, 5043, 5044, 5, 80, 0, 0, 5044, + 5045, 5, 444, 0, 0, 5045, 5046, 3, 634, 317, 0, 5046, 5047, 5, 116, 0, + 0, 5047, 5048, 3, 540, 270, 0, 5048, 5099, 1, 0, 0, 0, 5049, 5050, 5, 159, + 0, 0, 5050, 5051, 5, 80, 0, 0, 5051, 5052, 5, 445, 0, 0, 5052, 5053, 5, + 62, 0, 0, 5053, 5054, 3, 1128, 564, 0, 5054, 5055, 5, 238, 0, 0, 5055, + 5056, 3, 1352, 676, 0, 5056, 5057, 5, 116, 0, 0, 5057, 5058, 3, 540, 270, + 0, 5058, 5099, 1, 0, 0, 0, 5059, 5060, 5, 159, 0, 0, 5060, 5061, 5, 80, + 0, 0, 5061, 5062, 5, 271, 0, 0, 5062, 5063, 5, 156, 0, 0, 5063, 5064, 3, + 528, 264, 0, 5064, 5065, 5, 100, 0, 0, 5065, 5066, 3, 1352, 676, 0, 5066, + 5067, 5, 116, 0, 0, 5067, 5068, 3, 540, 270, 0, 5068, 5099, 1, 0, 0, 0, + 5069, 5070, 5, 159, 0, 0, 5070, 5071, 5, 80, 0, 0, 5071, 5072, 5, 271, + 0, 0, 5072, 5073, 5, 206, 0, 0, 5073, 5074, 3, 528, 264, 0, 5074, 5075, + 5, 100, 0, 0, 5075, 5076, 3, 1352, 676, 0, 5076, 5077, 5, 116, 0, 0, 5077, + 5078, 3, 540, 270, 0, 5078, 5099, 1, 0, 0, 0, 5079, 5080, 5, 159, 0, 0, + 5080, 5081, 5, 80, 0, 0, 5081, 5082, 5, 239, 0, 0, 5082, 5083, 5, 267, + 0, 0, 5083, 5084, 3, 296, 148, 0, 5084, 5085, 5, 116, 0, 0, 5085, 5086, + 3, 540, 270, 0, 5086, 5099, 1, 0, 0, 0, 5087, 5088, 5, 159, 0, 0, 5088, + 5089, 5, 80, 0, 0, 5089, 5090, 5, 41, 0, 0, 5090, 5091, 5, 2, 0, 0, 5091, + 5092, 3, 1128, 564, 0, 5092, 5093, 5, 36, 0, 0, 5093, 5094, 3, 1128, 564, + 0, 5094, 5095, 5, 3, 0, 0, 5095, 5096, 5, 116, 0, 0, 5096, 5097, 3, 540, + 270, 0, 5097, 5099, 1, 0, 0, 0, 5098, 4951, 1, 0, 0, 0, 5098, 4958, 1, + 0, 0, 0, 5098, 4965, 1, 0, 0, 0, 5098, 4972, 1, 0, 0, 0, 5098, 4979, 1, + 0, 0, 0, 5098, 4986, 1, 0, 0, 0, 5098, 4993, 1, 0, 0, 0, 5098, 5000, 1, + 0, 0, 0, 5098, 5007, 1, 0, 0, 0, 5098, 5016, 1, 0, 0, 0, 5098, 5026, 1, + 0, 0, 0, 5098, 5035, 1, 0, 0, 0, 5098, 5042, 1, 0, 0, 0, 5098, 5049, 1, + 0, 0, 0, 5098, 5059, 1, 0, 0, 0, 5098, 5069, 1, 0, 0, 0, 5098, 5079, 1, + 0, 0, 0, 5098, 5087, 1, 0, 0, 0, 5099, 539, 1, 0, 0, 0, 5100, 5103, 3, + 1370, 685, 0, 5101, 5103, 5, 78, 0, 0, 5102, 5100, 1, 0, 0, 0, 5102, 5101, + 1, 0, 0, 0, 5103, 541, 1, 0, 0, 0, 5104, 5105, 5, 320, 0, 0, 5105, 5107, + 5, 237, 0, 0, 5106, 5108, 3, 544, 272, 0, 5107, 5106, 1, 0, 0, 0, 5107, + 5108, 1, 0, 0, 0, 5108, 5109, 1, 0, 0, 0, 5109, 5110, 5, 80, 0, 0, 5110, + 5111, 3, 518, 259, 0, 5111, 5112, 3, 528, 264, 0, 5112, 5113, 5, 116, 0, + 0, 5113, 5114, 3, 546, 273, 0, 5114, 5216, 1, 0, 0, 0, 5115, 5116, 5, 320, + 0, 0, 5116, 5118, 5, 237, 0, 0, 5117, 5119, 3, 544, 272, 0, 5118, 5117, + 1, 0, 0, 0, 5118, 5119, 1, 0, 0, 0, 5119, 5120, 1, 0, 0, 0, 5120, 5121, + 5, 80, 0, 0, 5121, 5122, 5, 44, 0, 0, 5122, 5123, 3, 528, 264, 0, 5123, + 5124, 5, 116, 0, 0, 5124, 5125, 3, 546, 273, 0, 5125, 5216, 1, 0, 0, 0, + 5126, 5127, 5, 320, 0, 0, 5127, 5129, 5, 237, 0, 0, 5128, 5130, 3, 544, + 272, 0, 5129, 5128, 1, 0, 0, 0, 5129, 5130, 1, 0, 0, 0, 5130, 5131, 1, + 0, 0, 0, 5131, 5132, 5, 80, 0, 0, 5132, 5133, 3, 520, 260, 0, 5133, 5134, + 3, 1352, 676, 0, 5134, 5135, 5, 116, 0, 0, 5135, 5136, 3, 546, 273, 0, + 5136, 5216, 1, 0, 0, 0, 5137, 5138, 5, 320, 0, 0, 5138, 5140, 5, 237, 0, + 0, 5139, 5141, 3, 544, 272, 0, 5140, 5139, 1, 0, 0, 0, 5140, 5141, 1, 0, + 0, 0, 5141, 5142, 1, 0, 0, 0, 5142, 5143, 5, 80, 0, 0, 5143, 5144, 5, 353, + 0, 0, 5144, 5145, 3, 1128, 564, 0, 5145, 5146, 5, 116, 0, 0, 5146, 5147, + 3, 546, 273, 0, 5147, 5216, 1, 0, 0, 0, 5148, 5149, 5, 320, 0, 0, 5149, + 5151, 5, 237, 0, 0, 5150, 5152, 3, 544, 272, 0, 5151, 5150, 1, 0, 0, 0, + 5151, 5152, 1, 0, 0, 0, 5152, 5153, 1, 0, 0, 0, 5153, 5154, 5, 80, 0, 0, + 5154, 5155, 5, 189, 0, 0, 5155, 5156, 3, 1128, 564, 0, 5156, 5157, 5, 116, + 0, 0, 5157, 5158, 3, 546, 273, 0, 5158, 5216, 1, 0, 0, 0, 5159, 5160, 5, + 320, 0, 0, 5160, 5162, 5, 237, 0, 0, 5161, 5163, 3, 544, 272, 0, 5162, + 5161, 1, 0, 0, 0, 5162, 5163, 1, 0, 0, 0, 5163, 5164, 1, 0, 0, 0, 5164, + 5165, 5, 80, 0, 0, 5165, 5166, 5, 136, 0, 0, 5166, 5167, 3, 658, 329, 0, + 5167, 5168, 5, 116, 0, 0, 5168, 5169, 3, 546, 273, 0, 5169, 5216, 1, 0, + 0, 0, 5170, 5171, 5, 320, 0, 0, 5171, 5173, 5, 237, 0, 0, 5172, 5174, 3, + 544, 272, 0, 5173, 5172, 1, 0, 0, 0, 5173, 5174, 1, 0, 0, 0, 5174, 5175, + 1, 0, 0, 0, 5175, 5176, 5, 80, 0, 0, 5176, 5177, 5, 211, 0, 0, 5177, 5178, + 3, 634, 317, 0, 5178, 5179, 5, 116, 0, 0, 5179, 5180, 3, 546, 273, 0, 5180, + 5216, 1, 0, 0, 0, 5181, 5182, 5, 320, 0, 0, 5182, 5184, 5, 237, 0, 0, 5183, + 5185, 3, 544, 272, 0, 5184, 5183, 1, 0, 0, 0, 5184, 5185, 1, 0, 0, 0, 5185, + 5186, 1, 0, 0, 0, 5186, 5187, 5, 80, 0, 0, 5187, 5188, 5, 239, 0, 0, 5188, + 5189, 5, 267, 0, 0, 5189, 5190, 3, 296, 148, 0, 5190, 5191, 5, 116, 0, + 0, 5191, 5192, 3, 546, 273, 0, 5192, 5216, 1, 0, 0, 0, 5193, 5194, 5, 320, + 0, 0, 5194, 5196, 5, 237, 0, 0, 5195, 5197, 3, 544, 272, 0, 5196, 5195, + 1, 0, 0, 0, 5196, 5197, 1, 0, 0, 0, 5197, 5198, 1, 0, 0, 0, 5198, 5199, + 5, 80, 0, 0, 5199, 5200, 5, 289, 0, 0, 5200, 5201, 3, 634, 317, 0, 5201, + 5202, 5, 116, 0, 0, 5202, 5203, 3, 546, 273, 0, 5203, 5216, 1, 0, 0, 0, + 5204, 5205, 5, 320, 0, 0, 5205, 5207, 5, 237, 0, 0, 5206, 5208, 3, 544, + 272, 0, 5207, 5206, 1, 0, 0, 0, 5207, 5208, 1, 0, 0, 0, 5208, 5209, 1, + 0, 0, 0, 5209, 5210, 5, 80, 0, 0, 5210, 5211, 5, 444, 0, 0, 5211, 5212, + 3, 634, 317, 0, 5212, 5213, 5, 116, 0, 0, 5213, 5214, 3, 546, 273, 0, 5214, + 5216, 1, 0, 0, 0, 5215, 5104, 1, 0, 0, 0, 5215, 5115, 1, 0, 0, 0, 5215, + 5126, 1, 0, 0, 0, 5215, 5137, 1, 0, 0, 0, 5215, 5148, 1, 0, 0, 0, 5215, + 5159, 1, 0, 0, 0, 5215, 5170, 1, 0, 0, 0, 5215, 5181, 1, 0, 0, 0, 5215, + 5193, 1, 0, 0, 0, 5215, 5204, 1, 0, 0, 0, 5216, 543, 1, 0, 0, 0, 5217, + 5218, 5, 62, 0, 0, 5218, 5219, 3, 72, 36, 0, 5219, 545, 1, 0, 0, 0, 5220, + 5223, 3, 1370, 685, 0, 5221, 5223, 5, 78, 0, 0, 5222, 5220, 1, 0, 0, 0, + 5222, 5221, 1, 0, 0, 0, 5223, 547, 1, 0, 0, 0, 5224, 5225, 5, 61, 0, 0, + 5225, 5229, 3, 550, 275, 0, 5226, 5227, 5, 258, 0, 0, 5227, 5229, 3, 550, + 275, 0, 5228, 5224, 1, 0, 0, 0, 5228, 5226, 1, 0, 0, 0, 5229, 549, 1, 0, + 0, 0, 5230, 5316, 3, 964, 482, 0, 5231, 5232, 3, 552, 276, 0, 5232, 5233, + 3, 964, 482, 0, 5233, 5316, 1, 0, 0, 0, 5234, 5236, 5, 261, 0, 0, 5235, + 5237, 3, 554, 277, 0, 5236, 5235, 1, 0, 0, 0, 5236, 5237, 1, 0, 0, 0, 5237, + 5238, 1, 0, 0, 0, 5238, 5316, 3, 964, 482, 0, 5239, 5241, 5, 286, 0, 0, + 5240, 5242, 3, 554, 277, 0, 5241, 5240, 1, 0, 0, 0, 5241, 5242, 1, 0, 0, + 0, 5242, 5243, 1, 0, 0, 0, 5243, 5316, 3, 964, 482, 0, 5244, 5246, 5, 207, + 0, 0, 5245, 5247, 3, 554, 277, 0, 5246, 5245, 1, 0, 0, 0, 5246, 5247, 1, + 0, 0, 0, 5247, 5248, 1, 0, 0, 0, 5248, 5316, 3, 964, 482, 0, 5249, 5251, + 5, 240, 0, 0, 5250, 5252, 3, 554, 277, 0, 5251, 5250, 1, 0, 0, 0, 5251, + 5252, 1, 0, 0, 0, 5252, 5253, 1, 0, 0, 0, 5253, 5316, 3, 964, 482, 0, 5254, + 5255, 5, 130, 0, 0, 5255, 5257, 3, 1376, 688, 0, 5256, 5258, 3, 554, 277, + 0, 5257, 5256, 1, 0, 0, 0, 5257, 5258, 1, 0, 0, 0, 5258, 5259, 1, 0, 0, + 0, 5259, 5260, 3, 964, 482, 0, 5260, 5316, 1, 0, 0, 0, 5261, 5262, 5, 300, + 0, 0, 5262, 5264, 3, 1376, 688, 0, 5263, 5265, 3, 554, 277, 0, 5264, 5263, + 1, 0, 0, 0, 5264, 5265, 1, 0, 0, 0, 5265, 5266, 1, 0, 0, 0, 5266, 5267, + 3, 964, 482, 0, 5267, 5316, 1, 0, 0, 0, 5268, 5270, 3, 1376, 688, 0, 5269, + 5271, 3, 554, 277, 0, 5270, 5269, 1, 0, 0, 0, 5270, 5271, 1, 0, 0, 0, 5271, + 5272, 1, 0, 0, 0, 5272, 5273, 3, 964, 482, 0, 5273, 5316, 1, 0, 0, 0, 5274, + 5276, 5, 30, 0, 0, 5275, 5277, 3, 554, 277, 0, 5276, 5275, 1, 0, 0, 0, + 5276, 5277, 1, 0, 0, 0, 5277, 5278, 1, 0, 0, 0, 5278, 5316, 3, 964, 482, + 0, 5279, 5281, 5, 210, 0, 0, 5280, 5282, 3, 554, 277, 0, 5281, 5280, 1, + 0, 0, 0, 5281, 5282, 1, 0, 0, 0, 5282, 5283, 1, 0, 0, 0, 5283, 5316, 3, + 964, 482, 0, 5284, 5285, 5, 210, 0, 0, 5285, 5287, 3, 1376, 688, 0, 5286, + 5288, 3, 554, 277, 0, 5287, 5286, 1, 0, 0, 0, 5287, 5288, 1, 0, 0, 0, 5288, + 5289, 1, 0, 0, 0, 5289, 5290, 3, 964, 482, 0, 5290, 5316, 1, 0, 0, 0, 5291, + 5292, 5, 210, 0, 0, 5292, 5294, 5, 30, 0, 0, 5293, 5295, 3, 554, 277, 0, + 5294, 5293, 1, 0, 0, 0, 5294, 5295, 1, 0, 0, 0, 5295, 5296, 1, 0, 0, 0, + 5296, 5316, 3, 964, 482, 0, 5297, 5299, 5, 144, 0, 0, 5298, 5300, 3, 554, + 277, 0, 5299, 5298, 1, 0, 0, 0, 5299, 5300, 1, 0, 0, 0, 5300, 5301, 1, + 0, 0, 0, 5301, 5316, 3, 964, 482, 0, 5302, 5303, 5, 144, 0, 0, 5303, 5305, + 3, 1376, 688, 0, 5304, 5306, 3, 554, 277, 0, 5305, 5304, 1, 0, 0, 0, 5305, + 5306, 1, 0, 0, 0, 5306, 5307, 1, 0, 0, 0, 5307, 5308, 3, 964, 482, 0, 5308, + 5316, 1, 0, 0, 0, 5309, 5310, 5, 144, 0, 0, 5310, 5312, 5, 30, 0, 0, 5311, + 5313, 3, 554, 277, 0, 5312, 5311, 1, 0, 0, 0, 5312, 5313, 1, 0, 0, 0, 5313, + 5314, 1, 0, 0, 0, 5314, 5316, 3, 964, 482, 0, 5315, 5230, 1, 0, 0, 0, 5315, + 5231, 1, 0, 0, 0, 5315, 5234, 1, 0, 0, 0, 5315, 5239, 1, 0, 0, 0, 5315, + 5244, 1, 0, 0, 0, 5315, 5249, 1, 0, 0, 0, 5315, 5254, 1, 0, 0, 0, 5315, + 5261, 1, 0, 0, 0, 5315, 5268, 1, 0, 0, 0, 5315, 5274, 1, 0, 0, 0, 5315, + 5279, 1, 0, 0, 0, 5315, 5284, 1, 0, 0, 0, 5315, 5291, 1, 0, 0, 0, 5315, + 5297, 1, 0, 0, 0, 5315, 5302, 1, 0, 0, 0, 5315, 5309, 1, 0, 0, 0, 5316, + 551, 1, 0, 0, 0, 5317, 5318, 7, 26, 0, 0, 5318, 553, 1, 0, 0, 0, 5319, + 5320, 3, 552, 276, 0, 5320, 555, 1, 0, 0, 0, 5321, 5322, 5, 65, 0, 0, 5322, + 5323, 3, 560, 280, 0, 5323, 5324, 5, 80, 0, 0, 5324, 5325, 3, 566, 283, + 0, 5325, 5326, 5, 94, 0, 0, 5326, 5328, 3, 572, 286, 0, 5327, 5329, 3, + 576, 288, 0, 5328, 5327, 1, 0, 0, 0, 5328, 5329, 1, 0, 0, 0, 5329, 557, + 1, 0, 0, 0, 5330, 5331, 5, 310, 0, 0, 5331, 5332, 3, 560, 280, 0, 5332, + 5333, 5, 80, 0, 0, 5333, 5334, 3, 566, 283, 0, 5334, 5335, 5, 64, 0, 0, + 5335, 5337, 3, 572, 286, 0, 5336, 5338, 3, 108, 54, 0, 5337, 5336, 1, 0, + 0, 0, 5337, 5338, 1, 0, 0, 0, 5338, 5352, 1, 0, 0, 0, 5339, 5340, 5, 310, + 0, 0, 5340, 5341, 5, 65, 0, 0, 5341, 5342, 5, 272, 0, 0, 5342, 5343, 5, + 62, 0, 0, 5343, 5344, 3, 560, 280, 0, 5344, 5345, 5, 80, 0, 0, 5345, 5346, + 3, 566, 283, 0, 5346, 5347, 5, 64, 0, 0, 5347, 5349, 3, 572, 286, 0, 5348, + 5350, 3, 108, 54, 0, 5349, 5348, 1, 0, 0, 0, 5349, 5350, 1, 0, 0, 0, 5350, + 5352, 1, 0, 0, 0, 5351, 5330, 1, 0, 0, 0, 5351, 5339, 1, 0, 0, 0, 5352, + 559, 1, 0, 0, 0, 5353, 5369, 3, 562, 281, 0, 5354, 5369, 5, 30, 0, 0, 5355, + 5356, 5, 30, 0, 0, 5356, 5369, 5, 287, 0, 0, 5357, 5358, 5, 30, 0, 0, 5358, + 5359, 5, 2, 0, 0, 5359, 5360, 3, 220, 110, 0, 5360, 5361, 5, 3, 0, 0, 5361, + 5369, 1, 0, 0, 0, 5362, 5363, 5, 30, 0, 0, 5363, 5364, 5, 287, 0, 0, 5364, + 5365, 5, 2, 0, 0, 5365, 5366, 3, 220, 110, 0, 5366, 5367, 5, 3, 0, 0, 5367, + 5369, 1, 0, 0, 0, 5368, 5353, 1, 0, 0, 0, 5368, 5354, 1, 0, 0, 0, 5368, + 5355, 1, 0, 0, 0, 5368, 5357, 1, 0, 0, 0, 5368, 5362, 1, 0, 0, 0, 5369, + 561, 1, 0, 0, 0, 5370, 5375, 3, 564, 282, 0, 5371, 5372, 5, 6, 0, 0, 5372, + 5374, 3, 564, 282, 0, 5373, 5371, 1, 0, 0, 0, 5374, 5377, 1, 0, 0, 0, 5375, + 5373, 1, 0, 0, 0, 5375, 5376, 1, 0, 0, 0, 5376, 563, 1, 0, 0, 0, 5377, + 5375, 1, 0, 0, 0, 5378, 5380, 5, 88, 0, 0, 5379, 5381, 3, 218, 109, 0, + 5380, 5379, 1, 0, 0, 0, 5380, 5381, 1, 0, 0, 0, 5381, 5397, 1, 0, 0, 0, + 5382, 5384, 5, 86, 0, 0, 5383, 5385, 3, 218, 109, 0, 5384, 5383, 1, 0, + 0, 0, 5384, 5385, 1, 0, 0, 0, 5385, 5397, 1, 0, 0, 0, 5386, 5388, 5, 46, + 0, 0, 5387, 5389, 3, 218, 109, 0, 5388, 5387, 1, 0, 0, 0, 5388, 5389, 1, + 0, 0, 0, 5389, 5397, 1, 0, 0, 0, 5390, 5391, 5, 138, 0, 0, 5391, 5397, + 5, 342, 0, 0, 5392, 5394, 3, 1384, 692, 0, 5393, 5395, 3, 218, 109, 0, + 5394, 5393, 1, 0, 0, 0, 5394, 5395, 1, 0, 0, 0, 5395, 5397, 1, 0, 0, 0, + 5396, 5378, 1, 0, 0, 0, 5396, 5382, 1, 0, 0, 0, 5396, 5386, 1, 0, 0, 0, + 5396, 5390, 1, 0, 0, 0, 5396, 5392, 1, 0, 0, 0, 5397, 565, 1, 0, 0, 0, + 5398, 5459, 3, 1346, 673, 0, 5399, 5400, 5, 92, 0, 0, 5400, 5459, 3, 1346, + 673, 0, 5401, 5402, 5, 321, 0, 0, 5402, 5459, 3, 1346, 673, 0, 5403, 5404, + 5, 63, 0, 0, 5404, 5405, 5, 174, 0, 0, 5405, 5406, 5, 374, 0, 0, 5406, + 5459, 3, 1350, 675, 0, 5407, 5408, 5, 63, 0, 0, 5408, 5409, 5, 324, 0, + 0, 5409, 5459, 3, 1350, 675, 0, 5410, 5411, 5, 211, 0, 0, 5411, 5459, 3, + 632, 316, 0, 5412, 5413, 5, 289, 0, 0, 5413, 5459, 3, 632, 316, 0, 5414, + 5415, 5, 444, 0, 0, 5415, 5459, 3, 632, 316, 0, 5416, 5417, 5, 175, 0, + 0, 5417, 5459, 3, 1350, 675, 0, 5418, 5419, 5, 189, 0, 0, 5419, 5459, 3, + 526, 263, 0, 5420, 5421, 5, 238, 0, 0, 5421, 5459, 3, 1350, 675, 0, 5422, + 5423, 5, 239, 0, 0, 5423, 5424, 5, 267, 0, 0, 5424, 5459, 3, 298, 149, + 0, 5425, 5426, 5, 405, 0, 0, 5426, 5459, 3, 568, 284, 0, 5427, 5428, 5, + 316, 0, 0, 5428, 5459, 3, 1350, 675, 0, 5429, 5430, 5, 344, 0, 0, 5430, + 5459, 3, 1350, 675, 0, 5431, 5432, 5, 353, 0, 0, 5432, 5459, 3, 526, 263, + 0, 5433, 5434, 5, 30, 0, 0, 5434, 5435, 5, 343, 0, 0, 5435, 5436, 5, 68, + 0, 0, 5436, 5437, 5, 316, 0, 0, 5437, 5459, 3, 1350, 675, 0, 5438, 5439, + 5, 30, 0, 0, 5439, 5440, 5, 322, 0, 0, 5440, 5441, 5, 68, 0, 0, 5441, 5442, + 5, 316, 0, 0, 5442, 5459, 3, 1350, 675, 0, 5443, 5444, 5, 30, 0, 0, 5444, + 5445, 5, 212, 0, 0, 5445, 5446, 5, 68, 0, 0, 5446, 5447, 5, 316, 0, 0, + 5447, 5459, 3, 1350, 675, 0, 5448, 5449, 5, 30, 0, 0, 5449, 5450, 5, 459, + 0, 0, 5450, 5451, 5, 68, 0, 0, 5451, 5452, 5, 316, 0, 0, 5452, 5459, 3, + 1350, 675, 0, 5453, 5454, 5, 30, 0, 0, 5454, 5455, 5, 457, 0, 0, 5455, + 5456, 5, 68, 0, 0, 5456, 5457, 5, 316, 0, 0, 5457, 5459, 3, 1350, 675, + 0, 5458, 5398, 1, 0, 0, 0, 5458, 5399, 1, 0, 0, 0, 5458, 5401, 1, 0, 0, + 0, 5458, 5403, 1, 0, 0, 0, 5458, 5407, 1, 0, 0, 0, 5458, 5410, 1, 0, 0, + 0, 5458, 5412, 1, 0, 0, 0, 5458, 5414, 1, 0, 0, 0, 5458, 5416, 1, 0, 0, + 0, 5458, 5418, 1, 0, 0, 0, 5458, 5420, 1, 0, 0, 0, 5458, 5422, 1, 0, 0, + 0, 5458, 5425, 1, 0, 0, 0, 5458, 5427, 1, 0, 0, 0, 5458, 5429, 1, 0, 0, + 0, 5458, 5431, 1, 0, 0, 0, 5458, 5433, 1, 0, 0, 0, 5458, 5438, 1, 0, 0, + 0, 5458, 5443, 1, 0, 0, 0, 5458, 5448, 1, 0, 0, 0, 5458, 5453, 1, 0, 0, + 0, 5459, 567, 1, 0, 0, 0, 5460, 5465, 3, 570, 285, 0, 5461, 5462, 5, 6, + 0, 0, 5462, 5464, 3, 570, 285, 0, 5463, 5461, 1, 0, 0, 0, 5464, 5467, 1, + 0, 0, 0, 5465, 5463, 1, 0, 0, 0, 5465, 5466, 1, 0, 0, 0, 5466, 569, 1, + 0, 0, 0, 5467, 5465, 1, 0, 0, 0, 5468, 5471, 3, 1384, 692, 0, 5469, 5470, + 5, 11, 0, 0, 5470, 5472, 3, 1384, 692, 0, 5471, 5469, 1, 0, 0, 0, 5471, + 5472, 1, 0, 0, 0, 5472, 571, 1, 0, 0, 0, 5473, 5478, 3, 574, 287, 0, 5474, + 5475, 5, 6, 0, 0, 5475, 5477, 3, 574, 287, 0, 5476, 5474, 1, 0, 0, 0, 5477, + 5480, 1, 0, 0, 0, 5478, 5476, 1, 0, 0, 0, 5478, 5479, 1, 0, 0, 0, 5479, + 573, 1, 0, 0, 0, 5480, 5478, 1, 0, 0, 0, 5481, 5485, 3, 1380, 690, 0, 5482, + 5483, 5, 66, 0, 0, 5483, 5485, 3, 1380, 690, 0, 5484, 5481, 1, 0, 0, 0, + 5484, 5482, 1, 0, 0, 0, 5485, 575, 1, 0, 0, 0, 5486, 5487, 5, 105, 0, 0, + 5487, 5488, 5, 65, 0, 0, 5488, 5489, 5, 272, 0, 0, 5489, 577, 1, 0, 0, + 0, 5490, 5491, 5, 65, 0, 0, 5491, 5492, 3, 562, 281, 0, 5492, 5493, 5, + 94, 0, 0, 5493, 5495, 3, 1382, 691, 0, 5494, 5496, 3, 582, 291, 0, 5495, + 5494, 1, 0, 0, 0, 5495, 5496, 1, 0, 0, 0, 5496, 5498, 1, 0, 0, 0, 5497, + 5499, 3, 584, 292, 0, 5498, 5497, 1, 0, 0, 0, 5498, 5499, 1, 0, 0, 0, 5499, + 579, 1, 0, 0, 0, 5500, 5501, 5, 310, 0, 0, 5501, 5502, 3, 562, 281, 0, + 5502, 5503, 5, 64, 0, 0, 5503, 5505, 3, 1382, 691, 0, 5504, 5506, 3, 584, + 292, 0, 5505, 5504, 1, 0, 0, 0, 5505, 5506, 1, 0, 0, 0, 5506, 5508, 1, + 0, 0, 0, 5507, 5509, 3, 108, 54, 0, 5508, 5507, 1, 0, 0, 0, 5508, 5509, + 1, 0, 0, 0, 5509, 5524, 1, 0, 0, 0, 5510, 5511, 5, 310, 0, 0, 5511, 5512, + 5, 134, 0, 0, 5512, 5513, 5, 272, 0, 0, 5513, 5514, 5, 62, 0, 0, 5514, + 5515, 3, 562, 281, 0, 5515, 5516, 5, 64, 0, 0, 5516, 5518, 3, 1382, 691, + 0, 5517, 5519, 3, 584, 292, 0, 5518, 5517, 1, 0, 0, 0, 5518, 5519, 1, 0, + 0, 0, 5519, 5521, 1, 0, 0, 0, 5520, 5522, 3, 108, 54, 0, 5521, 5520, 1, + 0, 0, 0, 5521, 5522, 1, 0, 0, 0, 5522, 5524, 1, 0, 0, 0, 5523, 5500, 1, + 0, 0, 0, 5523, 5510, 1, 0, 0, 0, 5524, 581, 1, 0, 0, 0, 5525, 5526, 5, + 105, 0, 0, 5526, 5527, 5, 134, 0, 0, 5527, 5528, 5, 272, 0, 0, 5528, 583, + 1, 0, 0, 0, 5529, 5530, 5, 214, 0, 0, 5530, 5531, 5, 147, 0, 0, 5531, 5532, + 3, 1380, 690, 0, 5532, 585, 1, 0, 0, 0, 5533, 5534, 5, 138, 0, 0, 5534, + 5535, 5, 53, 0, 0, 5535, 5536, 5, 287, 0, 0, 5536, 5537, 3, 588, 294, 0, + 5537, 5538, 3, 592, 296, 0, 5538, 587, 1, 0, 0, 0, 5539, 5541, 3, 590, + 295, 0, 5540, 5539, 1, 0, 0, 0, 5541, 5544, 1, 0, 0, 0, 5542, 5540, 1, + 0, 0, 0, 5542, 5543, 1, 0, 0, 0, 5543, 589, 1, 0, 0, 0, 5544, 5542, 1, + 0, 0, 0, 5545, 5546, 5, 68, 0, 0, 5546, 5547, 5, 316, 0, 0, 5547, 5555, + 3, 1350, 675, 0, 5548, 5549, 5, 62, 0, 0, 5549, 5550, 5, 311, 0, 0, 5550, + 5555, 3, 1382, 691, 0, 5551, 5552, 5, 62, 0, 0, 5552, 5553, 5, 99, 0, 0, + 5553, 5555, 3, 1382, 691, 0, 5554, 5545, 1, 0, 0, 0, 5554, 5548, 1, 0, + 0, 0, 5554, 5551, 1, 0, 0, 0, 5555, 591, 1, 0, 0, 0, 5556, 5557, 5, 65, + 0, 0, 5557, 5558, 3, 560, 280, 0, 5558, 5559, 5, 80, 0, 0, 5559, 5560, + 3, 594, 297, 0, 5560, 5561, 5, 94, 0, 0, 5561, 5563, 3, 572, 286, 0, 5562, + 5564, 3, 576, 288, 0, 5563, 5562, 1, 0, 0, 0, 5563, 5564, 1, 0, 0, 0, 5564, + 5587, 1, 0, 0, 0, 5565, 5566, 5, 310, 0, 0, 5566, 5567, 3, 560, 280, 0, + 5567, 5568, 5, 80, 0, 0, 5568, 5569, 3, 594, 297, 0, 5569, 5570, 5, 64, + 0, 0, 5570, 5572, 3, 572, 286, 0, 5571, 5573, 3, 108, 54, 0, 5572, 5571, + 1, 0, 0, 0, 5572, 5573, 1, 0, 0, 0, 5573, 5587, 1, 0, 0, 0, 5574, 5575, + 5, 310, 0, 0, 5575, 5576, 5, 65, 0, 0, 5576, 5577, 5, 272, 0, 0, 5577, + 5578, 5, 62, 0, 0, 5578, 5579, 3, 560, 280, 0, 5579, 5580, 5, 80, 0, 0, + 5580, 5581, 3, 594, 297, 0, 5581, 5582, 5, 64, 0, 0, 5582, 5584, 3, 572, + 286, 0, 5583, 5585, 3, 108, 54, 0, 5584, 5583, 1, 0, 0, 0, 5584, 5585, + 1, 0, 0, 0, 5585, 5587, 1, 0, 0, 0, 5586, 5556, 1, 0, 0, 0, 5586, 5565, + 1, 0, 0, 0, 5586, 5574, 1, 0, 0, 0, 5587, 593, 1, 0, 0, 0, 5588, 5589, + 7, 27, 0, 0, 5589, 595, 1, 0, 0, 0, 5590, 5592, 5, 46, 0, 0, 5591, 5593, + 3, 598, 299, 0, 5592, 5591, 1, 0, 0, 0, 5592, 5593, 1, 0, 0, 0, 5593, 5594, + 1, 0, 0, 0, 5594, 5596, 5, 226, 0, 0, 5595, 5597, 3, 600, 300, 0, 5596, + 5595, 1, 0, 0, 0, 5596, 5597, 1, 0, 0, 0, 5597, 5604, 1, 0, 0, 0, 5598, + 5599, 5, 220, 0, 0, 5599, 5600, 5, 77, 0, 0, 5600, 5602, 5, 390, 0, 0, + 5601, 5598, 1, 0, 0, 0, 5601, 5602, 1, 0, 0, 0, 5602, 5603, 1, 0, 0, 0, + 5603, 5605, 3, 1352, 676, 0, 5604, 5601, 1, 0, 0, 0, 5604, 5605, 1, 0, + 0, 0, 5605, 5606, 1, 0, 0, 0, 5606, 5607, 5, 80, 0, 0, 5607, 5609, 3, 1084, + 542, 0, 5608, 5610, 3, 604, 302, 0, 5609, 5608, 1, 0, 0, 0, 5609, 5610, + 1, 0, 0, 0, 5610, 5611, 1, 0, 0, 0, 5611, 5612, 5, 2, 0, 0, 5612, 5613, + 3, 606, 303, 0, 5613, 5615, 5, 3, 0, 0, 5614, 5616, 3, 612, 306, 0, 5615, + 5614, 1, 0, 0, 0, 5615, 5616, 1, 0, 0, 0, 5616, 5618, 1, 0, 0, 0, 5617, + 5619, 3, 200, 100, 0, 5618, 5617, 1, 0, 0, 0, 5618, 5619, 1, 0, 0, 0, 5619, + 5621, 1, 0, 0, 0, 5620, 5622, 3, 118, 59, 0, 5621, 5620, 1, 0, 0, 0, 5621, + 5622, 1, 0, 0, 0, 5622, 5624, 1, 0, 0, 0, 5623, 5625, 3, 258, 129, 0, 5624, + 5623, 1, 0, 0, 0, 5624, 5625, 1, 0, 0, 0, 5625, 5627, 1, 0, 0, 0, 5626, + 5628, 3, 1104, 552, 0, 5627, 5626, 1, 0, 0, 0, 5627, 5628, 1, 0, 0, 0, + 5628, 597, 1, 0, 0, 0, 5629, 5630, 5, 98, 0, 0, 5630, 599, 1, 0, 0, 0, + 5631, 5632, 5, 109, 0, 0, 5632, 601, 1, 0, 0, 0, 5633, 5634, 3, 1352, 676, + 0, 5634, 603, 1, 0, 0, 0, 5635, 5636, 5, 100, 0, 0, 5636, 5637, 3, 1352, + 676, 0, 5637, 605, 1, 0, 0, 0, 5638, 5643, 3, 610, 305, 0, 5639, 5640, + 5, 6, 0, 0, 5640, 5642, 3, 610, 305, 0, 5641, 5639, 1, 0, 0, 0, 5642, 5645, + 1, 0, 0, 0, 5643, 5641, 1, 0, 0, 0, 5643, 5644, 1, 0, 0, 0, 5644, 607, + 1, 0, 0, 0, 5645, 5643, 1, 0, 0, 0, 5646, 5648, 3, 616, 308, 0, 5647, 5646, + 1, 0, 0, 0, 5647, 5648, 1, 0, 0, 0, 5648, 5650, 1, 0, 0, 0, 5649, 5651, + 3, 618, 309, 0, 5650, 5649, 1, 0, 0, 0, 5650, 5651, 1, 0, 0, 0, 5651, 5653, + 1, 0, 0, 0, 5652, 5654, 3, 620, 310, 0, 5653, 5652, 1, 0, 0, 0, 5653, 5654, + 1, 0, 0, 0, 5654, 5656, 1, 0, 0, 0, 5655, 5657, 3, 622, 311, 0, 5656, 5655, + 1, 0, 0, 0, 5656, 5657, 1, 0, 0, 0, 5657, 5670, 1, 0, 0, 0, 5658, 5660, + 3, 616, 308, 0, 5659, 5658, 1, 0, 0, 0, 5659, 5660, 1, 0, 0, 0, 5660, 5661, + 1, 0, 0, 0, 5661, 5662, 3, 528, 264, 0, 5662, 5664, 3, 116, 58, 0, 5663, + 5665, 3, 620, 310, 0, 5664, 5663, 1, 0, 0, 0, 5664, 5665, 1, 0, 0, 0, 5665, + 5667, 1, 0, 0, 0, 5666, 5668, 3, 622, 311, 0, 5667, 5666, 1, 0, 0, 0, 5667, + 5668, 1, 0, 0, 0, 5668, 5670, 1, 0, 0, 0, 5669, 5647, 1, 0, 0, 0, 5669, + 5659, 1, 0, 0, 0, 5670, 609, 1, 0, 0, 0, 5671, 5672, 3, 1384, 692, 0, 5672, + 5673, 3, 608, 304, 0, 5673, 5683, 1, 0, 0, 0, 5674, 5675, 3, 1224, 612, + 0, 5675, 5676, 3, 608, 304, 0, 5676, 5683, 1, 0, 0, 0, 5677, 5678, 5, 2, + 0, 0, 5678, 5679, 3, 1172, 586, 0, 5679, 5680, 5, 3, 0, 0, 5680, 5681, + 3, 608, 304, 0, 5681, 5683, 1, 0, 0, 0, 5682, 5671, 1, 0, 0, 0, 5682, 5674, + 1, 0, 0, 0, 5682, 5677, 1, 0, 0, 0, 5683, 611, 1, 0, 0, 0, 5684, 5685, + 5, 443, 0, 0, 5685, 5686, 5, 2, 0, 0, 5686, 5687, 3, 614, 307, 0, 5687, + 5688, 5, 3, 0, 0, 5688, 613, 1, 0, 0, 0, 5689, 5694, 3, 610, 305, 0, 5690, + 5691, 5, 6, 0, 0, 5691, 5693, 3, 610, 305, 0, 5692, 5690, 1, 0, 0, 0, 5693, + 5696, 1, 0, 0, 0, 5694, 5692, 1, 0, 0, 0, 5694, 5695, 1, 0, 0, 0, 5695, + 615, 1, 0, 0, 0, 5696, 5694, 1, 0, 0, 0, 5697, 5698, 5, 43, 0, 0, 5698, + 5699, 3, 528, 264, 0, 5699, 617, 1, 0, 0, 0, 5700, 5701, 3, 528, 264, 0, + 5701, 619, 1, 0, 0, 0, 5702, 5703, 7, 28, 0, 0, 5703, 621, 1, 0, 0, 0, + 5704, 5705, 5, 266, 0, 0, 5705, 5709, 5, 207, 0, 0, 5706, 5707, 5, 266, + 0, 0, 5707, 5709, 5, 240, 0, 0, 5708, 5704, 1, 0, 0, 0, 5708, 5706, 1, + 0, 0, 0, 5709, 623, 1, 0, 0, 0, 5710, 5712, 5, 46, 0, 0, 5711, 5713, 3, + 626, 313, 0, 5712, 5711, 1, 0, 0, 0, 5712, 5713, 1, 0, 0, 0, 5713, 5714, + 1, 0, 0, 0, 5714, 5715, 7, 24, 0, 0, 5715, 5716, 3, 1358, 679, 0, 5716, + 5726, 3, 636, 318, 0, 5717, 5724, 5, 309, 0, 0, 5718, 5725, 3, 646, 323, + 0, 5719, 5720, 5, 92, 0, 0, 5720, 5721, 5, 2, 0, 0, 5721, 5722, 3, 676, + 338, 0, 5722, 5723, 5, 3, 0, 0, 5723, 5725, 1, 0, 0, 0, 5724, 5718, 1, + 0, 0, 0, 5724, 5719, 1, 0, 0, 0, 5725, 5727, 1, 0, 0, 0, 5726, 5717, 1, + 0, 0, 0, 5726, 5727, 1, 0, 0, 0, 5727, 5728, 1, 0, 0, 0, 5728, 5729, 3, + 662, 331, 0, 5729, 625, 1, 0, 0, 0, 5730, 5731, 5, 82, 0, 0, 5731, 5732, + 5, 304, 0, 0, 5732, 627, 1, 0, 0, 0, 5733, 5735, 5, 2, 0, 0, 5734, 5736, + 3, 630, 315, 0, 5735, 5734, 1, 0, 0, 0, 5735, 5736, 1, 0, 0, 0, 5736, 5737, + 1, 0, 0, 0, 5737, 5738, 5, 3, 0, 0, 5738, 629, 1, 0, 0, 0, 5739, 5744, + 3, 640, 320, 0, 5740, 5741, 5, 6, 0, 0, 5741, 5743, 3, 640, 320, 0, 5742, + 5740, 1, 0, 0, 0, 5743, 5746, 1, 0, 0, 0, 5744, 5742, 1, 0, 0, 0, 5744, + 5745, 1, 0, 0, 0, 5745, 631, 1, 0, 0, 0, 5746, 5744, 1, 0, 0, 0, 5747, + 5752, 3, 634, 317, 0, 5748, 5749, 5, 6, 0, 0, 5749, 5751, 3, 634, 317, + 0, 5750, 5748, 1, 0, 0, 0, 5751, 5754, 1, 0, 0, 0, 5752, 5750, 1, 0, 0, + 0, 5752, 5753, 1, 0, 0, 0, 5753, 633, 1, 0, 0, 0, 5754, 5752, 1, 0, 0, + 0, 5755, 5756, 3, 1358, 679, 0, 5756, 5757, 3, 628, 314, 0, 5757, 5764, + 1, 0, 0, 0, 5758, 5764, 3, 1402, 701, 0, 5759, 5761, 3, 1384, 692, 0, 5760, + 5762, 3, 1334, 667, 0, 5761, 5760, 1, 0, 0, 0, 5761, 5762, 1, 0, 0, 0, + 5762, 5764, 1, 0, 0, 0, 5763, 5755, 1, 0, 0, 0, 5763, 5758, 1, 0, 0, 0, + 5763, 5759, 1, 0, 0, 0, 5764, 635, 1, 0, 0, 0, 5765, 5767, 5, 2, 0, 0, + 5766, 5768, 3, 638, 319, 0, 5767, 5766, 1, 0, 0, 0, 5767, 5768, 1, 0, 0, + 0, 5768, 5769, 1, 0, 0, 0, 5769, 5770, 5, 3, 0, 0, 5770, 637, 1, 0, 0, + 0, 5771, 5776, 3, 650, 325, 0, 5772, 5773, 5, 6, 0, 0, 5773, 5775, 3, 650, + 325, 0, 5774, 5772, 1, 0, 0, 0, 5775, 5778, 1, 0, 0, 0, 5776, 5774, 1, + 0, 0, 0, 5776, 5777, 1, 0, 0, 0, 5777, 639, 1, 0, 0, 0, 5778, 5776, 1, + 0, 0, 0, 5779, 5781, 3, 642, 321, 0, 5780, 5782, 3, 644, 322, 0, 5781, + 5780, 1, 0, 0, 0, 5781, 5782, 1, 0, 0, 0, 5782, 5783, 1, 0, 0, 0, 5783, + 5784, 3, 648, 324, 0, 5784, 5793, 1, 0, 0, 0, 5785, 5787, 3, 644, 322, + 0, 5786, 5788, 3, 642, 321, 0, 5787, 5786, 1, 0, 0, 0, 5787, 5788, 1, 0, + 0, 0, 5788, 5789, 1, 0, 0, 0, 5789, 5790, 3, 648, 324, 0, 5790, 5793, 1, + 0, 0, 0, 5791, 5793, 3, 648, 324, 0, 5792, 5779, 1, 0, 0, 0, 5792, 5785, + 1, 0, 0, 0, 5792, 5791, 1, 0, 0, 0, 5793, 641, 1, 0, 0, 0, 5794, 5796, + 5, 68, 0, 0, 5795, 5797, 5, 455, 0, 0, 5796, 5795, 1, 0, 0, 0, 5796, 5797, + 1, 0, 0, 0, 5797, 5802, 1, 0, 0, 0, 5798, 5802, 5, 455, 0, 0, 5799, 5802, + 5, 394, 0, 0, 5800, 5802, 5, 101, 0, 0, 5801, 5794, 1, 0, 0, 0, 5801, 5798, + 1, 0, 0, 0, 5801, 5799, 1, 0, 0, 0, 5801, 5800, 1, 0, 0, 0, 5802, 643, + 1, 0, 0, 0, 5803, 5808, 3, 1388, 694, 0, 5804, 5808, 3, 1406, 703, 0, 5805, + 5808, 5, 119, 0, 0, 5806, 5808, 5, 126, 0, 0, 5807, 5803, 1, 0, 0, 0, 5807, + 5804, 1, 0, 0, 0, 5807, 5805, 1, 0, 0, 0, 5807, 5806, 1, 0, 0, 0, 5808, + 645, 1, 0, 0, 0, 5809, 5810, 3, 648, 324, 0, 5810, 647, 1, 0, 0, 0, 5811, + 5826, 3, 1128, 564, 0, 5812, 5814, 5, 410, 0, 0, 5813, 5812, 1, 0, 0, 0, + 5813, 5814, 1, 0, 0, 0, 5814, 5819, 1, 0, 0, 0, 5815, 5820, 3, 1406, 703, + 0, 5816, 5820, 3, 1388, 694, 0, 5817, 5820, 5, 119, 0, 0, 5818, 5820, 5, + 126, 0, 0, 5819, 5815, 1, 0, 0, 0, 5819, 5816, 1, 0, 0, 0, 5819, 5817, + 1, 0, 0, 0, 5819, 5818, 1, 0, 0, 0, 5820, 5821, 1, 0, 0, 0, 5821, 5822, + 3, 530, 265, 0, 5822, 5823, 5, 27, 0, 0, 5823, 5824, 5, 353, 0, 0, 5824, + 5826, 1, 0, 0, 0, 5825, 5811, 1, 0, 0, 0, 5825, 5813, 1, 0, 0, 0, 5826, + 649, 1, 0, 0, 0, 5827, 5830, 3, 640, 320, 0, 5828, 5829, 7, 29, 0, 0, 5829, + 5831, 3, 1172, 586, 0, 5830, 5828, 1, 0, 0, 0, 5830, 5831, 1, 0, 0, 0, + 5831, 651, 1, 0, 0, 0, 5832, 5833, 3, 640, 320, 0, 5833, 653, 1, 0, 0, + 0, 5834, 5845, 5, 2, 0, 0, 5835, 5846, 5, 9, 0, 0, 5836, 5846, 3, 656, + 328, 0, 5837, 5838, 5, 83, 0, 0, 5838, 5839, 5, 147, 0, 0, 5839, 5846, + 3, 656, 328, 0, 5840, 5841, 3, 656, 328, 0, 5841, 5842, 5, 83, 0, 0, 5842, + 5843, 5, 147, 0, 0, 5843, 5844, 3, 656, 328, 0, 5844, 5846, 1, 0, 0, 0, + 5845, 5835, 1, 0, 0, 0, 5845, 5836, 1, 0, 0, 0, 5845, 5837, 1, 0, 0, 0, + 5845, 5840, 1, 0, 0, 0, 5846, 5847, 1, 0, 0, 0, 5847, 5848, 5, 3, 0, 0, + 5848, 655, 1, 0, 0, 0, 5849, 5854, 3, 652, 326, 0, 5850, 5851, 5, 6, 0, + 0, 5851, 5853, 3, 652, 326, 0, 5852, 5850, 1, 0, 0, 0, 5853, 5856, 1, 0, + 0, 0, 5854, 5852, 1, 0, 0, 0, 5854, 5855, 1, 0, 0, 0, 5855, 657, 1, 0, + 0, 0, 5856, 5854, 1, 0, 0, 0, 5857, 5858, 3, 1358, 679, 0, 5858, 5859, + 3, 654, 327, 0, 5859, 659, 1, 0, 0, 0, 5860, 5865, 3, 658, 329, 0, 5861, + 5862, 5, 6, 0, 0, 5862, 5864, 3, 658, 329, 0, 5863, 5861, 1, 0, 0, 0, 5864, + 5867, 1, 0, 0, 0, 5865, 5863, 1, 0, 0, 0, 5865, 5866, 1, 0, 0, 0, 5866, + 661, 1, 0, 0, 0, 5867, 5865, 1, 0, 0, 0, 5868, 5870, 3, 666, 333, 0, 5869, + 5868, 1, 0, 0, 0, 5870, 5871, 1, 0, 0, 0, 5871, 5869, 1, 0, 0, 0, 5871, + 5872, 1, 0, 0, 0, 5872, 5873, 1, 0, 0, 0, 5873, 5874, 6, 331, -1, 0, 5874, + 663, 1, 0, 0, 0, 5875, 5876, 5, 149, 0, 0, 5876, 5877, 5, 80, 0, 0, 5877, + 5878, 5, 78, 0, 0, 5878, 5911, 5, 460, 0, 0, 5879, 5880, 5, 309, 0, 0, + 5880, 5881, 5, 78, 0, 0, 5881, 5882, 5, 80, 0, 0, 5882, 5883, 5, 78, 0, + 0, 5883, 5911, 5, 460, 0, 0, 5884, 5911, 5, 339, 0, 0, 5885, 5911, 5, 222, + 0, 0, 5886, 5911, 5, 331, 0, 0, 5887, 5911, 5, 370, 0, 0, 5888, 5889, 5, + 205, 0, 0, 5889, 5890, 5, 320, 0, 0, 5890, 5911, 5, 181, 0, 0, 5891, 5892, + 5, 205, 0, 0, 5892, 5893, 5, 320, 0, 0, 5893, 5911, 5, 234, 0, 0, 5894, + 5895, 5, 320, 0, 0, 5895, 5911, 5, 181, 0, 0, 5896, 5897, 5, 320, 0, 0, + 5897, 5911, 5, 234, 0, 0, 5898, 5911, 5, 241, 0, 0, 5899, 5900, 5, 77, + 0, 0, 5900, 5911, 5, 241, 0, 0, 5901, 5902, 5, 170, 0, 0, 5902, 5911, 3, + 296, 148, 0, 5903, 5904, 5, 313, 0, 0, 5904, 5911, 3, 296, 148, 0, 5905, + 5906, 5, 461, 0, 0, 5906, 5911, 3, 528, 264, 0, 5907, 5911, 3, 82, 41, + 0, 5908, 5909, 5, 462, 0, 0, 5909, 5911, 3, 1384, 692, 0, 5910, 5875, 1, + 0, 0, 0, 5910, 5879, 1, 0, 0, 0, 5910, 5884, 1, 0, 0, 0, 5910, 5885, 1, + 0, 0, 0, 5910, 5886, 1, 0, 0, 0, 5910, 5887, 1, 0, 0, 0, 5910, 5888, 1, + 0, 0, 0, 5910, 5891, 1, 0, 0, 0, 5910, 5894, 1, 0, 0, 0, 5910, 5896, 1, + 0, 0, 0, 5910, 5898, 1, 0, 0, 0, 5910, 5899, 1, 0, 0, 0, 5910, 5901, 1, + 0, 0, 0, 5910, 5903, 1, 0, 0, 0, 5910, 5905, 1, 0, 0, 0, 5910, 5907, 1, + 0, 0, 0, 5910, 5908, 1, 0, 0, 0, 5911, 665, 1, 0, 0, 0, 5912, 5913, 5, + 36, 0, 0, 5913, 5926, 3, 668, 334, 0, 5914, 5915, 5, 146, 0, 0, 5915, 5916, + 5, 380, 0, 0, 5916, 5917, 3, 6, 3, 0, 5917, 5918, 5, 456, 0, 0, 5918, 5926, + 1, 0, 0, 0, 5919, 5920, 5, 238, 0, 0, 5920, 5926, 3, 72, 36, 0, 5921, 5922, + 5, 445, 0, 0, 5922, 5926, 3, 670, 335, 0, 5923, 5926, 5, 104, 0, 0, 5924, + 5926, 3, 664, 332, 0, 5925, 5912, 1, 0, 0, 0, 5925, 5914, 1, 0, 0, 0, 5925, + 5919, 1, 0, 0, 0, 5925, 5921, 1, 0, 0, 0, 5925, 5923, 1, 0, 0, 0, 5925, + 5924, 1, 0, 0, 0, 5926, 667, 1, 0, 0, 0, 5927, 5933, 3, 1370, 685, 0, 5928, + 5929, 3, 1370, 685, 0, 5929, 5930, 5, 6, 0, 0, 5930, 5931, 3, 1370, 685, + 0, 5931, 5933, 1, 0, 0, 0, 5932, 5927, 1, 0, 0, 0, 5932, 5928, 1, 0, 0, + 0, 5933, 669, 1, 0, 0, 0, 5934, 5935, 5, 62, 0, 0, 5935, 5936, 5, 353, + 0, 0, 5936, 5943, 3, 1128, 564, 0, 5937, 5938, 5, 6, 0, 0, 5938, 5939, + 5, 62, 0, 0, 5939, 5940, 5, 353, 0, 0, 5940, 5942, 3, 1128, 564, 0, 5941, + 5937, 1, 0, 0, 0, 5942, 5945, 1, 0, 0, 0, 5943, 5941, 1, 0, 0, 0, 5943, + 5944, 1, 0, 0, 0, 5944, 671, 1, 0, 0, 0, 5945, 5943, 1, 0, 0, 0, 5946, + 5947, 5, 105, 0, 0, 5947, 5948, 3, 464, 232, 0, 5948, 673, 1, 0, 0, 0, + 5949, 5950, 3, 644, 322, 0, 5950, 5951, 3, 648, 324, 0, 5951, 675, 1, 0, + 0, 0, 5952, 5957, 3, 674, 337, 0, 5953, 5954, 5, 6, 0, 0, 5954, 5956, 3, + 674, 337, 0, 5955, 5953, 1, 0, 0, 0, 5956, 5959, 1, 0, 0, 0, 5957, 5955, + 1, 0, 0, 0, 5957, 5958, 1, 0, 0, 0, 5958, 677, 1, 0, 0, 0, 5959, 5957, + 1, 0, 0, 0, 5960, 5961, 5, 138, 0, 0, 5961, 5962, 7, 30, 0, 0, 5962, 5963, + 3, 634, 317, 0, 5963, 5965, 3, 680, 340, 0, 5964, 5966, 3, 682, 341, 0, + 5965, 5964, 1, 0, 0, 0, 5965, 5966, 1, 0, 0, 0, 5966, 679, 1, 0, 0, 0, + 5967, 5969, 3, 664, 332, 0, 5968, 5967, 1, 0, 0, 0, 5969, 5970, 1, 0, 0, + 0, 5970, 5968, 1, 0, 0, 0, 5970, 5971, 1, 0, 0, 0, 5971, 681, 1, 0, 0, + 0, 5972, 5973, 5, 308, 0, 0, 5973, 683, 1, 0, 0, 0, 5974, 5975, 5, 191, + 0, 0, 5975, 5976, 5, 211, 0, 0, 5976, 5978, 3, 632, 316, 0, 5977, 5979, + 3, 108, 54, 0, 5978, 5977, 1, 0, 0, 0, 5978, 5979, 1, 0, 0, 0, 5979, 6017, + 1, 0, 0, 0, 5980, 5981, 5, 191, 0, 0, 5981, 5982, 5, 211, 0, 0, 5982, 5983, + 5, 220, 0, 0, 5983, 5984, 5, 390, 0, 0, 5984, 5986, 3, 632, 316, 0, 5985, + 5987, 3, 108, 54, 0, 5986, 5985, 1, 0, 0, 0, 5986, 5987, 1, 0, 0, 0, 5987, + 6017, 1, 0, 0, 0, 5988, 5989, 5, 191, 0, 0, 5989, 5990, 5, 289, 0, 0, 5990, + 5992, 3, 632, 316, 0, 5991, 5993, 3, 108, 54, 0, 5992, 5991, 1, 0, 0, 0, + 5992, 5993, 1, 0, 0, 0, 5993, 6017, 1, 0, 0, 0, 5994, 5995, 5, 191, 0, + 0, 5995, 5996, 5, 289, 0, 0, 5996, 5997, 5, 220, 0, 0, 5997, 5998, 5, 390, + 0, 0, 5998, 6000, 3, 632, 316, 0, 5999, 6001, 3, 108, 54, 0, 6000, 5999, + 1, 0, 0, 0, 6000, 6001, 1, 0, 0, 0, 6001, 6017, 1, 0, 0, 0, 6002, 6003, + 5, 191, 0, 0, 6003, 6004, 5, 444, 0, 0, 6004, 6006, 3, 632, 316, 0, 6005, + 6007, 3, 108, 54, 0, 6006, 6005, 1, 0, 0, 0, 6006, 6007, 1, 0, 0, 0, 6007, + 6017, 1, 0, 0, 0, 6008, 6009, 5, 191, 0, 0, 6009, 6010, 5, 444, 0, 0, 6010, + 6011, 5, 220, 0, 0, 6011, 6012, 5, 390, 0, 0, 6012, 6014, 3, 632, 316, + 0, 6013, 6015, 3, 108, 54, 0, 6014, 6013, 1, 0, 0, 0, 6014, 6015, 1, 0, + 0, 0, 6015, 6017, 1, 0, 0, 0, 6016, 5974, 1, 0, 0, 0, 6016, 5980, 1, 0, + 0, 0, 6016, 5988, 1, 0, 0, 0, 6016, 5994, 1, 0, 0, 0, 6016, 6002, 1, 0, + 0, 0, 6016, 6008, 1, 0, 0, 0, 6017, 685, 1, 0, 0, 0, 6018, 6019, 5, 191, + 0, 0, 6019, 6020, 5, 136, 0, 0, 6020, 6022, 3, 660, 330, 0, 6021, 6023, + 3, 108, 54, 0, 6022, 6021, 1, 0, 0, 0, 6022, 6023, 1, 0, 0, 0, 6023, 6033, + 1, 0, 0, 0, 6024, 6025, 5, 191, 0, 0, 6025, 6026, 5, 136, 0, 0, 6026, 6027, + 5, 220, 0, 0, 6027, 6028, 5, 390, 0, 0, 6028, 6030, 3, 660, 330, 0, 6029, + 6031, 3, 108, 54, 0, 6030, 6029, 1, 0, 0, 0, 6030, 6031, 1, 0, 0, 0, 6031, + 6033, 1, 0, 0, 0, 6032, 6018, 1, 0, 0, 0, 6032, 6024, 1, 0, 0, 0, 6033, + 687, 1, 0, 0, 0, 6034, 6035, 5, 191, 0, 0, 6035, 6036, 5, 271, 0, 0, 6036, + 6038, 3, 694, 347, 0, 6037, 6039, 3, 108, 54, 0, 6038, 6037, 1, 0, 0, 0, + 6038, 6039, 1, 0, 0, 0, 6039, 6049, 1, 0, 0, 0, 6040, 6041, 5, 191, 0, + 0, 6041, 6042, 5, 271, 0, 0, 6042, 6043, 5, 220, 0, 0, 6043, 6044, 5, 390, + 0, 0, 6044, 6046, 3, 694, 347, 0, 6045, 6047, 3, 108, 54, 0, 6046, 6045, + 1, 0, 0, 0, 6046, 6047, 1, 0, 0, 0, 6047, 6049, 1, 0, 0, 0, 6048, 6034, + 1, 0, 0, 0, 6048, 6040, 1, 0, 0, 0, 6049, 689, 1, 0, 0, 0, 6050, 6051, + 5, 2, 0, 0, 6051, 6052, 3, 1128, 564, 0, 6052, 6053, 5, 3, 0, 0, 6053, + 6073, 1, 0, 0, 0, 6054, 6055, 5, 2, 0, 0, 6055, 6056, 3, 1128, 564, 0, + 6056, 6057, 5, 6, 0, 0, 6057, 6058, 3, 1128, 564, 0, 6058, 6059, 5, 3, + 0, 0, 6059, 6073, 1, 0, 0, 0, 6060, 6061, 5, 2, 0, 0, 6061, 6062, 5, 401, + 0, 0, 6062, 6063, 5, 6, 0, 0, 6063, 6064, 3, 1128, 564, 0, 6064, 6065, + 5, 3, 0, 0, 6065, 6073, 1, 0, 0, 0, 6066, 6067, 5, 2, 0, 0, 6067, 6068, + 3, 1128, 564, 0, 6068, 6069, 5, 6, 0, 0, 6069, 6070, 5, 401, 0, 0, 6070, + 6071, 5, 3, 0, 0, 6071, 6073, 1, 0, 0, 0, 6072, 6050, 1, 0, 0, 0, 6072, + 6054, 1, 0, 0, 0, 6072, 6060, 1, 0, 0, 0, 6072, 6066, 1, 0, 0, 0, 6073, + 691, 1, 0, 0, 0, 6074, 6075, 3, 1384, 692, 0, 6075, 6076, 5, 11, 0, 0, + 6076, 6078, 1, 0, 0, 0, 6077, 6074, 1, 0, 0, 0, 6078, 6081, 1, 0, 0, 0, + 6079, 6077, 1, 0, 0, 0, 6079, 6080, 1, 0, 0, 0, 6080, 6082, 1, 0, 0, 0, + 6081, 6079, 1, 0, 0, 0, 6082, 6083, 3, 1280, 640, 0, 6083, 693, 1, 0, 0, + 0, 6084, 6089, 3, 696, 348, 0, 6085, 6086, 5, 6, 0, 0, 6086, 6088, 3, 696, + 348, 0, 6087, 6085, 1, 0, 0, 0, 6088, 6091, 1, 0, 0, 0, 6089, 6087, 1, + 0, 0, 0, 6089, 6090, 1, 0, 0, 0, 6090, 695, 1, 0, 0, 0, 6091, 6089, 1, + 0, 0, 0, 6092, 6093, 3, 692, 346, 0, 6093, 6094, 3, 690, 345, 0, 6094, + 697, 1, 0, 0, 0, 6095, 6096, 5, 57, 0, 0, 6096, 6097, 3, 700, 350, 0, 6097, + 699, 1, 0, 0, 0, 6098, 6100, 3, 702, 351, 0, 6099, 6098, 1, 0, 0, 0, 6100, + 6101, 1, 0, 0, 0, 6101, 6099, 1, 0, 0, 0, 6101, 6102, 1, 0, 0, 0, 6102, + 701, 1, 0, 0, 0, 6103, 6107, 3, 1370, 685, 0, 6104, 6105, 5, 238, 0, 0, + 6105, 6107, 3, 72, 36, 0, 6106, 6103, 1, 0, 0, 0, 6106, 6104, 1, 0, 0, + 0, 6107, 703, 1, 0, 0, 0, 6108, 6109, 5, 46, 0, 0, 6109, 6110, 5, 41, 0, + 0, 6110, 6111, 5, 2, 0, 0, 6111, 6112, 3, 1128, 564, 0, 6112, 6113, 5, + 36, 0, 0, 6113, 6114, 3, 1128, 564, 0, 6114, 6115, 5, 3, 0, 0, 6115, 6116, + 5, 105, 0, 0, 6116, 6117, 5, 211, 0, 0, 6117, 6119, 3, 634, 317, 0, 6118, + 6120, 3, 706, 353, 0, 6119, 6118, 1, 0, 0, 0, 6119, 6120, 1, 0, 0, 0, 6120, + 6146, 1, 0, 0, 0, 6121, 6122, 5, 46, 0, 0, 6122, 6123, 5, 41, 0, 0, 6123, + 6124, 5, 2, 0, 0, 6124, 6125, 3, 1128, 564, 0, 6125, 6126, 5, 36, 0, 0, + 6126, 6127, 3, 1128, 564, 0, 6127, 6128, 5, 3, 0, 0, 6128, 6129, 5, 372, + 0, 0, 6129, 6131, 5, 211, 0, 0, 6130, 6132, 3, 706, 353, 0, 6131, 6130, + 1, 0, 0, 0, 6131, 6132, 1, 0, 0, 0, 6132, 6146, 1, 0, 0, 0, 6133, 6134, + 5, 46, 0, 0, 6134, 6135, 5, 41, 0, 0, 6135, 6136, 5, 2, 0, 0, 6136, 6137, + 3, 1128, 564, 0, 6137, 6138, 5, 36, 0, 0, 6138, 6139, 3, 1128, 564, 0, + 6139, 6140, 5, 3, 0, 0, 6140, 6141, 5, 105, 0, 0, 6141, 6143, 5, 394, 0, + 0, 6142, 6144, 3, 706, 353, 0, 6143, 6142, 1, 0, 0, 0, 6143, 6144, 1, 0, + 0, 0, 6144, 6146, 1, 0, 0, 0, 6145, 6108, 1, 0, 0, 0, 6145, 6121, 1, 0, + 0, 0, 6145, 6133, 1, 0, 0, 0, 6146, 705, 1, 0, 0, 0, 6147, 6148, 5, 36, + 0, 0, 6148, 6152, 5, 223, 0, 0, 6149, 6150, 5, 36, 0, 0, 6150, 6152, 5, + 141, 0, 0, 6151, 6147, 1, 0, 0, 0, 6151, 6149, 1, 0, 0, 0, 6152, 707, 1, + 0, 0, 0, 6153, 6154, 5, 191, 0, 0, 6154, 6156, 5, 41, 0, 0, 6155, 6157, + 3, 710, 355, 0, 6156, 6155, 1, 0, 0, 0, 6156, 6157, 1, 0, 0, 0, 6157, 6158, + 1, 0, 0, 0, 6158, 6159, 5, 2, 0, 0, 6159, 6160, 3, 1128, 564, 0, 6160, + 6161, 5, 36, 0, 0, 6161, 6162, 3, 1128, 564, 0, 6162, 6164, 5, 3, 0, 0, + 6163, 6165, 3, 108, 54, 0, 6164, 6163, 1, 0, 0, 0, 6164, 6165, 1, 0, 0, + 0, 6165, 709, 1, 0, 0, 0, 6166, 6167, 5, 220, 0, 0, 6167, 6168, 5, 390, + 0, 0, 6168, 711, 1, 0, 0, 0, 6169, 6171, 5, 46, 0, 0, 6170, 6172, 3, 626, + 313, 0, 6171, 6170, 1, 0, 0, 0, 6171, 6172, 1, 0, 0, 0, 6172, 6173, 1, + 0, 0, 0, 6173, 6174, 5, 445, 0, 0, 6174, 6175, 5, 62, 0, 0, 6175, 6176, + 3, 1128, 564, 0, 6176, 6177, 5, 238, 0, 0, 6177, 6178, 3, 1352, 676, 0, + 6178, 6179, 5, 2, 0, 0, 6179, 6180, 3, 714, 357, 0, 6180, 6181, 5, 3, 0, + 0, 6181, 713, 1, 0, 0, 0, 6182, 6183, 5, 64, 0, 0, 6183, 6184, 5, 463, + 0, 0, 6184, 6185, 5, 105, 0, 0, 6185, 6186, 5, 211, 0, 0, 6186, 6187, 3, + 634, 317, 0, 6187, 6188, 5, 6, 0, 0, 6188, 6189, 5, 94, 0, 0, 6189, 6190, + 5, 463, 0, 0, 6190, 6191, 5, 105, 0, 0, 6191, 6192, 5, 211, 0, 0, 6192, + 6193, 3, 634, 317, 0, 6193, 6217, 1, 0, 0, 0, 6194, 6195, 5, 94, 0, 0, + 6195, 6196, 5, 463, 0, 0, 6196, 6197, 5, 105, 0, 0, 6197, 6198, 5, 211, + 0, 0, 6198, 6199, 3, 634, 317, 0, 6199, 6200, 5, 6, 0, 0, 6200, 6201, 5, + 64, 0, 0, 6201, 6202, 5, 463, 0, 0, 6202, 6203, 5, 105, 0, 0, 6203, 6204, + 5, 211, 0, 0, 6204, 6205, 3, 634, 317, 0, 6205, 6217, 1, 0, 0, 0, 6206, + 6207, 5, 64, 0, 0, 6207, 6208, 5, 463, 0, 0, 6208, 6209, 5, 105, 0, 0, + 6209, 6210, 5, 211, 0, 0, 6210, 6217, 3, 634, 317, 0, 6211, 6212, 5, 94, + 0, 0, 6212, 6213, 5, 463, 0, 0, 6213, 6214, 5, 105, 0, 0, 6214, 6215, 5, + 211, 0, 0, 6215, 6217, 3, 634, 317, 0, 6216, 6182, 1, 0, 0, 0, 6216, 6194, + 1, 0, 0, 0, 6216, 6206, 1, 0, 0, 0, 6216, 6211, 1, 0, 0, 0, 6217, 715, + 1, 0, 0, 0, 6218, 6219, 5, 191, 0, 0, 6219, 6221, 5, 445, 0, 0, 6220, 6222, + 3, 710, 355, 0, 6221, 6220, 1, 0, 0, 0, 6221, 6222, 1, 0, 0, 0, 6222, 6223, + 1, 0, 0, 0, 6223, 6224, 5, 62, 0, 0, 6224, 6225, 3, 1128, 564, 0, 6225, + 6226, 5, 238, 0, 0, 6226, 6228, 3, 1352, 676, 0, 6227, 6229, 3, 108, 54, + 0, 6228, 6227, 1, 0, 0, 0, 6228, 6229, 1, 0, 0, 0, 6229, 717, 1, 0, 0, + 0, 6230, 6231, 5, 299, 0, 0, 6231, 6233, 3, 720, 360, 0, 6232, 6234, 3, + 600, 300, 0, 6233, 6232, 1, 0, 0, 0, 6233, 6234, 1, 0, 0, 0, 6234, 6235, + 1, 0, 0, 0, 6235, 6236, 3, 1348, 674, 0, 6236, 6265, 1, 0, 0, 0, 6237, + 6238, 5, 299, 0, 0, 6238, 6240, 3, 722, 361, 0, 6239, 6241, 3, 600, 300, + 0, 6240, 6239, 1, 0, 0, 0, 6240, 6241, 1, 0, 0, 0, 6241, 6242, 1, 0, 0, + 0, 6242, 6243, 3, 1352, 676, 0, 6243, 6265, 1, 0, 0, 0, 6244, 6245, 5, + 299, 0, 0, 6245, 6246, 5, 2, 0, 0, 6246, 6247, 3, 724, 362, 0, 6247, 6248, + 5, 3, 0, 0, 6248, 6250, 3, 720, 360, 0, 6249, 6251, 3, 600, 300, 0, 6250, + 6249, 1, 0, 0, 0, 6250, 6251, 1, 0, 0, 0, 6251, 6252, 1, 0, 0, 0, 6252, + 6253, 3, 1348, 674, 0, 6253, 6265, 1, 0, 0, 0, 6254, 6255, 5, 299, 0, 0, + 6255, 6256, 5, 2, 0, 0, 6256, 6257, 3, 724, 362, 0, 6257, 6258, 5, 3, 0, + 0, 6258, 6260, 3, 722, 361, 0, 6259, 6261, 3, 600, 300, 0, 6260, 6259, + 1, 0, 0, 0, 6260, 6261, 1, 0, 0, 0, 6261, 6262, 1, 0, 0, 0, 6262, 6263, + 3, 1352, 676, 0, 6263, 6265, 1, 0, 0, 0, 6264, 6230, 1, 0, 0, 0, 6264, + 6237, 1, 0, 0, 0, 6264, 6244, 1, 0, 0, 0, 6264, 6254, 1, 0, 0, 0, 6265, + 719, 1, 0, 0, 0, 6266, 6267, 7, 31, 0, 0, 6267, 721, 1, 0, 0, 0, 6268, + 6269, 7, 32, 0, 0, 6269, 723, 1, 0, 0, 0, 6270, 6275, 3, 726, 363, 0, 6271, + 6272, 5, 6, 0, 0, 6272, 6274, 3, 726, 363, 0, 6273, 6271, 1, 0, 0, 0, 6274, + 6277, 1, 0, 0, 0, 6275, 6273, 1, 0, 0, 0, 6275, 6276, 1, 0, 0, 0, 6276, + 725, 1, 0, 0, 0, 6277, 6275, 1, 0, 0, 0, 6278, 6279, 7, 33, 0, 0, 6279, + 727, 1, 0, 0, 0, 6280, 6281, 5, 138, 0, 0, 6281, 6282, 5, 344, 0, 0, 6282, + 6283, 3, 1352, 676, 0, 6283, 6284, 5, 326, 0, 0, 6284, 6285, 3, 116, 58, + 0, 6285, 6293, 1, 0, 0, 0, 6286, 6287, 5, 138, 0, 0, 6287, 6288, 5, 344, + 0, 0, 6288, 6289, 3, 1352, 676, 0, 6289, 6290, 5, 306, 0, 0, 6290, 6291, + 3, 116, 58, 0, 6291, 6293, 1, 0, 0, 0, 6292, 6280, 1, 0, 0, 0, 6292, 6286, + 1, 0, 0, 0, 6293, 729, 1, 0, 0, 0, 6294, 6295, 5, 138, 0, 0, 6295, 6296, + 5, 136, 0, 0, 6296, 6297, 3, 658, 329, 0, 6297, 6298, 5, 302, 0, 0, 6298, + 6299, 5, 94, 0, 0, 6299, 6300, 3, 1352, 676, 0, 6300, 6782, 1, 0, 0, 0, + 6301, 6302, 5, 138, 0, 0, 6302, 6303, 5, 108, 0, 0, 6303, 6304, 3, 528, + 264, 0, 6304, 6305, 5, 302, 0, 0, 6305, 6306, 5, 94, 0, 0, 6306, 6307, + 3, 1352, 676, 0, 6307, 6782, 1, 0, 0, 0, 6308, 6309, 5, 138, 0, 0, 6309, + 6310, 5, 168, 0, 0, 6310, 6311, 3, 528, 264, 0, 6311, 6312, 5, 302, 0, + 0, 6312, 6313, 5, 94, 0, 0, 6313, 6314, 3, 1352, 676, 0, 6314, 6782, 1, + 0, 0, 0, 6315, 6316, 5, 138, 0, 0, 6316, 6317, 5, 175, 0, 0, 6317, 6318, + 3, 1352, 676, 0, 6318, 6319, 5, 302, 0, 0, 6319, 6320, 5, 94, 0, 0, 6320, + 6321, 3, 1352, 676, 0, 6321, 6782, 1, 0, 0, 0, 6322, 6323, 5, 138, 0, 0, + 6323, 6324, 5, 189, 0, 0, 6324, 6325, 3, 528, 264, 0, 6325, 6326, 5, 302, + 0, 0, 6326, 6327, 5, 94, 0, 0, 6327, 6328, 3, 1352, 676, 0, 6328, 6782, + 1, 0, 0, 0, 6329, 6330, 5, 138, 0, 0, 6330, 6331, 5, 189, 0, 0, 6331, 6332, + 3, 528, 264, 0, 6332, 6333, 5, 302, 0, 0, 6333, 6334, 5, 45, 0, 0, 6334, + 6335, 3, 1352, 676, 0, 6335, 6336, 5, 94, 0, 0, 6336, 6337, 3, 1352, 676, + 0, 6337, 6782, 1, 0, 0, 0, 6338, 6339, 5, 138, 0, 0, 6339, 6340, 5, 63, + 0, 0, 6340, 6341, 5, 174, 0, 0, 6341, 6342, 5, 374, 0, 0, 6342, 6343, 3, + 1352, 676, 0, 6343, 6344, 5, 302, 0, 0, 6344, 6345, 5, 94, 0, 0, 6345, + 6346, 3, 1352, 676, 0, 6346, 6782, 1, 0, 0, 0, 6347, 6348, 5, 138, 0, 0, + 6348, 6349, 5, 211, 0, 0, 6349, 6350, 3, 634, 317, 0, 6350, 6351, 5, 302, + 0, 0, 6351, 6352, 5, 94, 0, 0, 6352, 6353, 3, 1352, 676, 0, 6353, 6782, + 1, 0, 0, 0, 6354, 6355, 5, 138, 0, 0, 6355, 6356, 5, 66, 0, 0, 6356, 6357, + 3, 1378, 689, 0, 6357, 6358, 5, 302, 0, 0, 6358, 6359, 5, 94, 0, 0, 6359, + 6360, 3, 1378, 689, 0, 6360, 6782, 1, 0, 0, 0, 6361, 6363, 5, 138, 0, 0, + 6362, 6364, 3, 312, 156, 0, 6363, 6362, 1, 0, 0, 0, 6363, 6364, 1, 0, 0, + 0, 6364, 6365, 1, 0, 0, 0, 6365, 6366, 5, 238, 0, 0, 6366, 6367, 3, 1352, + 676, 0, 6367, 6368, 5, 302, 0, 0, 6368, 6369, 5, 94, 0, 0, 6369, 6370, + 3, 1352, 676, 0, 6370, 6782, 1, 0, 0, 0, 6371, 6372, 5, 138, 0, 0, 6372, + 6373, 5, 271, 0, 0, 6373, 6374, 5, 156, 0, 0, 6374, 6375, 3, 528, 264, + 0, 6375, 6376, 5, 100, 0, 0, 6376, 6377, 3, 1352, 676, 0, 6377, 6378, 5, + 302, 0, 0, 6378, 6379, 5, 94, 0, 0, 6379, 6380, 3, 1352, 676, 0, 6380, + 6782, 1, 0, 0, 0, 6381, 6382, 5, 138, 0, 0, 6382, 6383, 5, 271, 0, 0, 6383, + 6384, 5, 206, 0, 0, 6384, 6385, 3, 528, 264, 0, 6385, 6386, 5, 100, 0, + 0, 6386, 6387, 3, 1352, 676, 0, 6387, 6388, 5, 302, 0, 0, 6388, 6389, 5, + 94, 0, 0, 6389, 6390, 3, 1352, 676, 0, 6390, 6782, 1, 0, 0, 0, 6391, 6392, + 5, 138, 0, 0, 6392, 6393, 5, 447, 0, 0, 6393, 6394, 3, 1352, 676, 0, 6394, + 6395, 5, 80, 0, 0, 6395, 6396, 3, 1348, 674, 0, 6396, 6397, 5, 302, 0, + 0, 6397, 6398, 5, 94, 0, 0, 6398, 6399, 3, 1352, 676, 0, 6399, 6782, 1, + 0, 0, 0, 6400, 6401, 5, 138, 0, 0, 6401, 6402, 5, 447, 0, 0, 6402, 6403, + 5, 220, 0, 0, 6403, 6404, 5, 390, 0, 0, 6404, 6405, 3, 1352, 676, 0, 6405, + 6406, 5, 80, 0, 0, 6406, 6407, 3, 1348, 674, 0, 6407, 6408, 5, 302, 0, + 0, 6408, 6409, 5, 94, 0, 0, 6409, 6410, 3, 1352, 676, 0, 6410, 6782, 1, + 0, 0, 0, 6411, 6412, 5, 138, 0, 0, 6412, 6413, 5, 289, 0, 0, 6413, 6414, + 3, 634, 317, 0, 6414, 6415, 5, 302, 0, 0, 6415, 6416, 5, 94, 0, 0, 6416, + 6417, 3, 1352, 676, 0, 6417, 6782, 1, 0, 0, 0, 6418, 6419, 5, 138, 0, 0, + 6419, 6420, 5, 454, 0, 0, 6420, 6421, 3, 1352, 676, 0, 6421, 6422, 5, 302, + 0, 0, 6422, 6423, 5, 94, 0, 0, 6423, 6424, 3, 1352, 676, 0, 6424, 6782, + 1, 0, 0, 0, 6425, 6426, 5, 138, 0, 0, 6426, 6427, 5, 444, 0, 0, 6427, 6428, + 3, 634, 317, 0, 6428, 6429, 5, 302, 0, 0, 6429, 6430, 5, 94, 0, 0, 6430, + 6431, 3, 1352, 676, 0, 6431, 6782, 1, 0, 0, 0, 6432, 6433, 5, 138, 0, 0, + 6433, 6434, 5, 316, 0, 0, 6434, 6435, 3, 1352, 676, 0, 6435, 6436, 5, 302, + 0, 0, 6436, 6437, 5, 94, 0, 0, 6437, 6438, 3, 1352, 676, 0, 6438, 6782, + 1, 0, 0, 0, 6439, 6440, 5, 138, 0, 0, 6440, 6441, 5, 324, 0, 0, 6441, 6442, + 3, 1352, 676, 0, 6442, 6443, 5, 302, 0, 0, 6443, 6444, 5, 94, 0, 0, 6444, + 6445, 3, 1352, 676, 0, 6445, 6782, 1, 0, 0, 0, 6446, 6447, 5, 138, 0, 0, + 6447, 6448, 5, 453, 0, 0, 6448, 6449, 3, 1352, 676, 0, 6449, 6450, 5, 302, + 0, 0, 6450, 6451, 5, 94, 0, 0, 6451, 6452, 3, 1352, 676, 0, 6452, 6782, + 1, 0, 0, 0, 6453, 6454, 5, 138, 0, 0, 6454, 6455, 5, 92, 0, 0, 6455, 6456, + 3, 1084, 542, 0, 6456, 6457, 5, 302, 0, 0, 6457, 6458, 5, 94, 0, 0, 6458, + 6459, 3, 1352, 676, 0, 6459, 6782, 1, 0, 0, 0, 6460, 6461, 5, 138, 0, 0, + 6461, 6462, 5, 92, 0, 0, 6462, 6463, 5, 220, 0, 0, 6463, 6464, 5, 390, + 0, 0, 6464, 6465, 3, 1084, 542, 0, 6465, 6466, 5, 302, 0, 0, 6466, 6467, + 5, 94, 0, 0, 6467, 6468, 3, 1352, 676, 0, 6468, 6782, 1, 0, 0, 0, 6469, + 6470, 5, 138, 0, 0, 6470, 6471, 5, 321, 0, 0, 6471, 6472, 3, 1348, 674, + 0, 6472, 6473, 5, 302, 0, 0, 6473, 6474, 5, 94, 0, 0, 6474, 6475, 3, 1352, + 676, 0, 6475, 6782, 1, 0, 0, 0, 6476, 6477, 5, 138, 0, 0, 6477, 6478, 5, + 321, 0, 0, 6478, 6479, 5, 220, 0, 0, 6479, 6480, 5, 390, 0, 0, 6480, 6481, + 3, 1348, 674, 0, 6481, 6482, 5, 302, 0, 0, 6482, 6483, 5, 94, 0, 0, 6483, + 6484, 3, 1352, 676, 0, 6484, 6782, 1, 0, 0, 0, 6485, 6486, 5, 138, 0, 0, + 6486, 6487, 5, 369, 0, 0, 6487, 6488, 3, 1348, 674, 0, 6488, 6489, 5, 302, + 0, 0, 6489, 6490, 5, 94, 0, 0, 6490, 6491, 3, 1352, 676, 0, 6491, 6782, + 1, 0, 0, 0, 6492, 6493, 5, 138, 0, 0, 6493, 6494, 5, 369, 0, 0, 6494, 6495, + 5, 220, 0, 0, 6495, 6496, 5, 390, 0, 0, 6496, 6497, 3, 1348, 674, 0, 6497, + 6498, 5, 302, 0, 0, 6498, 6499, 5, 94, 0, 0, 6499, 6500, 3, 1352, 676, + 0, 6500, 6782, 1, 0, 0, 0, 6501, 6502, 5, 138, 0, 0, 6502, 6503, 5, 251, + 0, 0, 6503, 6504, 5, 369, 0, 0, 6504, 6505, 3, 1348, 674, 0, 6505, 6506, + 5, 302, 0, 0, 6506, 6507, 5, 94, 0, 0, 6507, 6508, 3, 1352, 676, 0, 6508, + 6782, 1, 0, 0, 0, 6509, 6510, 5, 138, 0, 0, 6510, 6511, 5, 251, 0, 0, 6511, + 6512, 5, 369, 0, 0, 6512, 6513, 5, 220, 0, 0, 6513, 6514, 5, 390, 0, 0, + 6514, 6515, 3, 1348, 674, 0, 6515, 6516, 5, 302, 0, 0, 6516, 6517, 5, 94, + 0, 0, 6517, 6518, 3, 1352, 676, 0, 6518, 6782, 1, 0, 0, 0, 6519, 6520, + 5, 138, 0, 0, 6520, 6521, 5, 226, 0, 0, 6521, 6522, 3, 1348, 674, 0, 6522, + 6523, 5, 302, 0, 0, 6523, 6524, 5, 94, 0, 0, 6524, 6525, 3, 1352, 676, + 0, 6525, 6782, 1, 0, 0, 0, 6526, 6527, 5, 138, 0, 0, 6527, 6528, 5, 226, + 0, 0, 6528, 6529, 5, 220, 0, 0, 6529, 6530, 5, 390, 0, 0, 6530, 6531, 3, + 1348, 674, 0, 6531, 6532, 5, 302, 0, 0, 6532, 6533, 5, 94, 0, 0, 6533, + 6534, 3, 1352, 676, 0, 6534, 6782, 1, 0, 0, 0, 6535, 6536, 5, 138, 0, 0, + 6536, 6537, 5, 63, 0, 0, 6537, 6538, 5, 92, 0, 0, 6538, 6539, 3, 1084, + 542, 0, 6539, 6540, 5, 302, 0, 0, 6540, 6541, 5, 94, 0, 0, 6541, 6542, + 3, 1352, 676, 0, 6542, 6782, 1, 0, 0, 0, 6543, 6544, 5, 138, 0, 0, 6544, + 6545, 5, 63, 0, 0, 6545, 6546, 5, 92, 0, 0, 6546, 6547, 5, 220, 0, 0, 6547, + 6548, 5, 390, 0, 0, 6548, 6549, 3, 1084, 542, 0, 6549, 6550, 5, 302, 0, + 0, 6550, 6551, 5, 94, 0, 0, 6551, 6552, 3, 1352, 676, 0, 6552, 6782, 1, + 0, 0, 0, 6553, 6554, 5, 138, 0, 0, 6554, 6555, 5, 92, 0, 0, 6555, 6556, + 3, 1084, 542, 0, 6556, 6558, 5, 302, 0, 0, 6557, 6559, 3, 732, 366, 0, + 6558, 6557, 1, 0, 0, 0, 6558, 6559, 1, 0, 0, 0, 6559, 6560, 1, 0, 0, 0, + 6560, 6561, 3, 1352, 676, 0, 6561, 6562, 5, 94, 0, 0, 6562, 6563, 3, 1352, + 676, 0, 6563, 6782, 1, 0, 0, 0, 6564, 6565, 5, 138, 0, 0, 6565, 6566, 5, + 92, 0, 0, 6566, 6567, 5, 220, 0, 0, 6567, 6568, 5, 390, 0, 0, 6568, 6569, + 3, 1084, 542, 0, 6569, 6571, 5, 302, 0, 0, 6570, 6572, 3, 732, 366, 0, + 6571, 6570, 1, 0, 0, 0, 6571, 6572, 1, 0, 0, 0, 6572, 6573, 1, 0, 0, 0, + 6573, 6574, 3, 1352, 676, 0, 6574, 6575, 5, 94, 0, 0, 6575, 6576, 3, 1352, + 676, 0, 6576, 6782, 1, 0, 0, 0, 6577, 6578, 5, 138, 0, 0, 6578, 6579, 5, + 369, 0, 0, 6579, 6580, 3, 1348, 674, 0, 6580, 6582, 5, 302, 0, 0, 6581, + 6583, 3, 732, 366, 0, 6582, 6581, 1, 0, 0, 0, 6582, 6583, 1, 0, 0, 0, 6583, + 6584, 1, 0, 0, 0, 6584, 6585, 3, 1352, 676, 0, 6585, 6586, 5, 94, 0, 0, + 6586, 6587, 3, 1352, 676, 0, 6587, 6782, 1, 0, 0, 0, 6588, 6589, 5, 138, + 0, 0, 6589, 6590, 5, 369, 0, 0, 6590, 6591, 5, 220, 0, 0, 6591, 6592, 5, + 390, 0, 0, 6592, 6593, 3, 1348, 674, 0, 6593, 6595, 5, 302, 0, 0, 6594, + 6596, 3, 732, 366, 0, 6595, 6594, 1, 0, 0, 0, 6595, 6596, 1, 0, 0, 0, 6596, + 6597, 1, 0, 0, 0, 6597, 6598, 3, 1352, 676, 0, 6598, 6599, 5, 94, 0, 0, + 6599, 6600, 3, 1352, 676, 0, 6600, 6782, 1, 0, 0, 0, 6601, 6602, 5, 138, + 0, 0, 6602, 6603, 5, 251, 0, 0, 6603, 6604, 5, 369, 0, 0, 6604, 6605, 3, + 1348, 674, 0, 6605, 6607, 5, 302, 0, 0, 6606, 6608, 3, 732, 366, 0, 6607, + 6606, 1, 0, 0, 0, 6607, 6608, 1, 0, 0, 0, 6608, 6609, 1, 0, 0, 0, 6609, + 6610, 3, 1352, 676, 0, 6610, 6611, 5, 94, 0, 0, 6611, 6612, 3, 1352, 676, + 0, 6612, 6782, 1, 0, 0, 0, 6613, 6614, 5, 138, 0, 0, 6614, 6615, 5, 251, + 0, 0, 6615, 6616, 5, 369, 0, 0, 6616, 6617, 5, 220, 0, 0, 6617, 6618, 5, + 390, 0, 0, 6618, 6619, 3, 1348, 674, 0, 6619, 6621, 5, 302, 0, 0, 6620, + 6622, 3, 732, 366, 0, 6621, 6620, 1, 0, 0, 0, 6621, 6622, 1, 0, 0, 0, 6622, + 6623, 1, 0, 0, 0, 6623, 6624, 3, 1352, 676, 0, 6624, 6625, 5, 94, 0, 0, + 6625, 6626, 3, 1352, 676, 0, 6626, 6782, 1, 0, 0, 0, 6627, 6628, 5, 138, + 0, 0, 6628, 6629, 5, 92, 0, 0, 6629, 6630, 3, 1084, 542, 0, 6630, 6631, + 5, 302, 0, 0, 6631, 6632, 5, 45, 0, 0, 6632, 6633, 3, 1352, 676, 0, 6633, + 6634, 5, 94, 0, 0, 6634, 6635, 3, 1352, 676, 0, 6635, 6782, 1, 0, 0, 0, + 6636, 6637, 5, 138, 0, 0, 6637, 6638, 5, 92, 0, 0, 6638, 6639, 5, 220, + 0, 0, 6639, 6640, 5, 390, 0, 0, 6640, 6641, 3, 1084, 542, 0, 6641, 6642, + 5, 302, 0, 0, 6642, 6643, 5, 45, 0, 0, 6643, 6644, 3, 1352, 676, 0, 6644, + 6645, 5, 94, 0, 0, 6645, 6646, 3, 1352, 676, 0, 6646, 6782, 1, 0, 0, 0, + 6647, 6648, 5, 138, 0, 0, 6648, 6649, 5, 63, 0, 0, 6649, 6650, 5, 92, 0, + 0, 6650, 6651, 3, 1084, 542, 0, 6651, 6653, 5, 302, 0, 0, 6652, 6654, 3, + 732, 366, 0, 6653, 6652, 1, 0, 0, 0, 6653, 6654, 1, 0, 0, 0, 6654, 6655, + 1, 0, 0, 0, 6655, 6656, 3, 1352, 676, 0, 6656, 6657, 5, 94, 0, 0, 6657, + 6658, 3, 1352, 676, 0, 6658, 6782, 1, 0, 0, 0, 6659, 6660, 5, 138, 0, 0, + 6660, 6661, 5, 63, 0, 0, 6661, 6662, 5, 92, 0, 0, 6662, 6663, 5, 220, 0, + 0, 6663, 6664, 5, 390, 0, 0, 6664, 6665, 3, 1084, 542, 0, 6665, 6667, 5, + 302, 0, 0, 6666, 6668, 3, 732, 366, 0, 6667, 6666, 1, 0, 0, 0, 6667, 6668, + 1, 0, 0, 0, 6668, 6669, 1, 0, 0, 0, 6669, 6670, 3, 1352, 676, 0, 6670, + 6671, 5, 94, 0, 0, 6671, 6672, 3, 1352, 676, 0, 6672, 6782, 1, 0, 0, 0, + 6673, 6674, 5, 138, 0, 0, 6674, 6675, 5, 314, 0, 0, 6675, 6676, 3, 1352, + 676, 0, 6676, 6677, 5, 80, 0, 0, 6677, 6678, 3, 1348, 674, 0, 6678, 6679, + 5, 302, 0, 0, 6679, 6680, 5, 94, 0, 0, 6680, 6681, 3, 1352, 676, 0, 6681, + 6782, 1, 0, 0, 0, 6682, 6683, 5, 138, 0, 0, 6683, 6684, 5, 350, 0, 0, 6684, + 6685, 3, 1352, 676, 0, 6685, 6686, 5, 80, 0, 0, 6686, 6687, 3, 1348, 674, + 0, 6687, 6688, 5, 302, 0, 0, 6688, 6689, 5, 94, 0, 0, 6689, 6690, 3, 1352, + 676, 0, 6690, 6782, 1, 0, 0, 0, 6691, 6692, 5, 138, 0, 0, 6692, 6693, 5, + 198, 0, 0, 6693, 6694, 5, 350, 0, 0, 6694, 6695, 3, 1352, 676, 0, 6695, + 6696, 5, 302, 0, 0, 6696, 6697, 5, 94, 0, 0, 6697, 6698, 3, 1352, 676, + 0, 6698, 6782, 1, 0, 0, 0, 6699, 6700, 5, 138, 0, 0, 6700, 6701, 5, 311, + 0, 0, 6701, 6702, 3, 1378, 689, 0, 6702, 6703, 5, 302, 0, 0, 6703, 6704, + 5, 94, 0, 0, 6704, 6705, 3, 1378, 689, 0, 6705, 6782, 1, 0, 0, 0, 6706, + 6707, 5, 138, 0, 0, 6707, 6708, 5, 99, 0, 0, 6708, 6709, 3, 1378, 689, + 0, 6709, 6710, 5, 302, 0, 0, 6710, 6711, 5, 94, 0, 0, 6711, 6712, 3, 1378, + 689, 0, 6712, 6782, 1, 0, 0, 0, 6713, 6714, 5, 138, 0, 0, 6714, 6715, 5, + 344, 0, 0, 6715, 6716, 3, 1352, 676, 0, 6716, 6717, 5, 302, 0, 0, 6717, + 6718, 5, 94, 0, 0, 6718, 6719, 3, 1352, 676, 0, 6719, 6782, 1, 0, 0, 0, + 6720, 6721, 5, 138, 0, 0, 6721, 6722, 5, 335, 0, 0, 6722, 6723, 3, 528, + 264, 0, 6723, 6724, 5, 302, 0, 0, 6724, 6725, 5, 94, 0, 0, 6725, 6726, + 3, 1352, 676, 0, 6726, 6782, 1, 0, 0, 0, 6727, 6728, 5, 138, 0, 0, 6728, + 6729, 5, 348, 0, 0, 6729, 6730, 5, 318, 0, 0, 6730, 6731, 5, 276, 0, 0, + 6731, 6732, 3, 528, 264, 0, 6732, 6733, 5, 302, 0, 0, 6733, 6734, 5, 94, + 0, 0, 6734, 6735, 3, 1352, 676, 0, 6735, 6782, 1, 0, 0, 0, 6736, 6737, + 5, 138, 0, 0, 6737, 6738, 5, 348, 0, 0, 6738, 6739, 5, 318, 0, 0, 6739, + 6740, 5, 185, 0, 0, 6740, 6741, 3, 528, 264, 0, 6741, 6742, 5, 302, 0, + 0, 6742, 6743, 5, 94, 0, 0, 6743, 6744, 3, 1352, 676, 0, 6744, 6782, 1, + 0, 0, 0, 6745, 6746, 5, 138, 0, 0, 6746, 6747, 5, 348, 0, 0, 6747, 6748, + 5, 318, 0, 0, 6748, 6749, 5, 346, 0, 0, 6749, 6750, 3, 528, 264, 0, 6750, + 6751, 5, 302, 0, 0, 6751, 6752, 5, 94, 0, 0, 6752, 6753, 3, 1352, 676, + 0, 6753, 6782, 1, 0, 0, 0, 6754, 6755, 5, 138, 0, 0, 6755, 6756, 5, 348, + 0, 0, 6756, 6757, 5, 318, 0, 0, 6757, 6758, 5, 163, 0, 0, 6758, 6759, 3, + 528, 264, 0, 6759, 6760, 5, 302, 0, 0, 6760, 6761, 5, 94, 0, 0, 6761, 6762, + 3, 1352, 676, 0, 6762, 6782, 1, 0, 0, 0, 6763, 6764, 5, 138, 0, 0, 6764, + 6765, 5, 353, 0, 0, 6765, 6766, 3, 528, 264, 0, 6766, 6767, 5, 302, 0, + 0, 6767, 6768, 5, 94, 0, 0, 6768, 6769, 3, 1352, 676, 0, 6769, 6782, 1, + 0, 0, 0, 6770, 6771, 5, 138, 0, 0, 6771, 6772, 5, 353, 0, 0, 6772, 6773, + 3, 528, 264, 0, 6773, 6774, 5, 302, 0, 0, 6774, 6775, 5, 143, 0, 0, 6775, + 6776, 3, 1352, 676, 0, 6776, 6777, 5, 94, 0, 0, 6777, 6779, 3, 1352, 676, + 0, 6778, 6780, 3, 108, 54, 0, 6779, 6778, 1, 0, 0, 0, 6779, 6780, 1, 0, + 0, 0, 6780, 6782, 1, 0, 0, 0, 6781, 6294, 1, 0, 0, 0, 6781, 6301, 1, 0, + 0, 0, 6781, 6308, 1, 0, 0, 0, 6781, 6315, 1, 0, 0, 0, 6781, 6322, 1, 0, + 0, 0, 6781, 6329, 1, 0, 0, 0, 6781, 6338, 1, 0, 0, 0, 6781, 6347, 1, 0, + 0, 0, 6781, 6354, 1, 0, 0, 0, 6781, 6361, 1, 0, 0, 0, 6781, 6371, 1, 0, + 0, 0, 6781, 6381, 1, 0, 0, 0, 6781, 6391, 1, 0, 0, 0, 6781, 6400, 1, 0, + 0, 0, 6781, 6411, 1, 0, 0, 0, 6781, 6418, 1, 0, 0, 0, 6781, 6425, 1, 0, + 0, 0, 6781, 6432, 1, 0, 0, 0, 6781, 6439, 1, 0, 0, 0, 6781, 6446, 1, 0, + 0, 0, 6781, 6453, 1, 0, 0, 0, 6781, 6460, 1, 0, 0, 0, 6781, 6469, 1, 0, + 0, 0, 6781, 6476, 1, 0, 0, 0, 6781, 6485, 1, 0, 0, 0, 6781, 6492, 1, 0, + 0, 0, 6781, 6501, 1, 0, 0, 0, 6781, 6509, 1, 0, 0, 0, 6781, 6519, 1, 0, + 0, 0, 6781, 6526, 1, 0, 0, 0, 6781, 6535, 1, 0, 0, 0, 6781, 6543, 1, 0, + 0, 0, 6781, 6553, 1, 0, 0, 0, 6781, 6564, 1, 0, 0, 0, 6781, 6577, 1, 0, + 0, 0, 6781, 6588, 1, 0, 0, 0, 6781, 6601, 1, 0, 0, 0, 6781, 6613, 1, 0, + 0, 0, 6781, 6627, 1, 0, 0, 0, 6781, 6636, 1, 0, 0, 0, 6781, 6647, 1, 0, + 0, 0, 6781, 6659, 1, 0, 0, 0, 6781, 6673, 1, 0, 0, 0, 6781, 6682, 1, 0, + 0, 0, 6781, 6691, 1, 0, 0, 0, 6781, 6699, 1, 0, 0, 0, 6781, 6706, 1, 0, + 0, 0, 6781, 6713, 1, 0, 0, 0, 6781, 6720, 1, 0, 0, 0, 6781, 6727, 1, 0, + 0, 0, 6781, 6736, 1, 0, 0, 0, 6781, 6745, 1, 0, 0, 0, 6781, 6754, 1, 0, + 0, 0, 6781, 6763, 1, 0, 0, 0, 6781, 6770, 1, 0, 0, 0, 6782, 731, 1, 0, + 0, 0, 6783, 6784, 5, 44, 0, 0, 6784, 733, 1, 0, 0, 0, 6785, 6786, 5, 326, + 0, 0, 6786, 6787, 5, 174, 0, 0, 6787, 735, 1, 0, 0, 0, 6788, 6789, 5, 138, + 0, 0, 6789, 6790, 5, 211, 0, 0, 6790, 6792, 3, 634, 317, 0, 6791, 6793, + 3, 738, 369, 0, 6792, 6791, 1, 0, 0, 0, 6792, 6793, 1, 0, 0, 0, 6793, 6794, + 1, 0, 0, 0, 6794, 6795, 5, 464, 0, 0, 6795, 6796, 5, 80, 0, 0, 6796, 6797, + 5, 204, 0, 0, 6797, 6798, 3, 1352, 676, 0, 6798, 6858, 1, 0, 0, 0, 6799, + 6800, 5, 138, 0, 0, 6800, 6801, 5, 289, 0, 0, 6801, 6803, 3, 634, 317, + 0, 6802, 6804, 3, 738, 369, 0, 6803, 6802, 1, 0, 0, 0, 6803, 6804, 1, 0, + 0, 0, 6804, 6805, 1, 0, 0, 0, 6805, 6806, 5, 464, 0, 0, 6806, 6807, 5, + 80, 0, 0, 6807, 6808, 5, 204, 0, 0, 6808, 6809, 3, 1352, 676, 0, 6809, + 6858, 1, 0, 0, 0, 6810, 6811, 5, 138, 0, 0, 6811, 6812, 5, 444, 0, 0, 6812, + 6814, 3, 634, 317, 0, 6813, 6815, 3, 738, 369, 0, 6814, 6813, 1, 0, 0, + 0, 6814, 6815, 1, 0, 0, 0, 6815, 6816, 1, 0, 0, 0, 6816, 6817, 5, 464, + 0, 0, 6817, 6818, 5, 80, 0, 0, 6818, 6819, 5, 204, 0, 0, 6819, 6820, 3, + 1352, 676, 0, 6820, 6858, 1, 0, 0, 0, 6821, 6822, 5, 138, 0, 0, 6822, 6823, + 5, 350, 0, 0, 6823, 6824, 3, 1352, 676, 0, 6824, 6825, 5, 80, 0, 0, 6825, + 6827, 3, 1348, 674, 0, 6826, 6828, 3, 738, 369, 0, 6827, 6826, 1, 0, 0, + 0, 6827, 6828, 1, 0, 0, 0, 6828, 6829, 1, 0, 0, 0, 6829, 6830, 5, 464, + 0, 0, 6830, 6831, 5, 80, 0, 0, 6831, 6832, 5, 204, 0, 0, 6832, 6833, 3, + 1352, 676, 0, 6833, 6858, 1, 0, 0, 0, 6834, 6835, 5, 138, 0, 0, 6835, 6836, + 5, 251, 0, 0, 6836, 6837, 5, 369, 0, 0, 6837, 6839, 3, 1348, 674, 0, 6838, + 6840, 3, 738, 369, 0, 6839, 6838, 1, 0, 0, 0, 6839, 6840, 1, 0, 0, 0, 6840, + 6841, 1, 0, 0, 0, 6841, 6842, 5, 464, 0, 0, 6842, 6843, 5, 80, 0, 0, 6843, + 6844, 5, 204, 0, 0, 6844, 6845, 3, 1352, 676, 0, 6845, 6858, 1, 0, 0, 0, + 6846, 6847, 5, 138, 0, 0, 6847, 6848, 5, 226, 0, 0, 6848, 6850, 3, 1348, + 674, 0, 6849, 6851, 3, 738, 369, 0, 6850, 6849, 1, 0, 0, 0, 6850, 6851, + 1, 0, 0, 0, 6851, 6852, 1, 0, 0, 0, 6852, 6853, 5, 464, 0, 0, 6853, 6854, + 5, 80, 0, 0, 6854, 6855, 5, 204, 0, 0, 6855, 6856, 3, 1352, 676, 0, 6856, + 6858, 1, 0, 0, 0, 6857, 6788, 1, 0, 0, 0, 6857, 6799, 1, 0, 0, 0, 6857, + 6810, 1, 0, 0, 0, 6857, 6821, 1, 0, 0, 0, 6857, 6834, 1, 0, 0, 0, 6857, + 6846, 1, 0, 0, 0, 6858, 737, 1, 0, 0, 0, 6859, 6860, 5, 262, 0, 0, 6860, + 739, 1, 0, 0, 0, 6861, 6862, 5, 138, 0, 0, 6862, 6863, 5, 136, 0, 0, 6863, + 6864, 3, 658, 329, 0, 6864, 6865, 5, 326, 0, 0, 6865, 6866, 5, 316, 0, + 0, 6866, 6867, 3, 1352, 676, 0, 6867, 7079, 1, 0, 0, 0, 6868, 6869, 5, + 138, 0, 0, 6869, 6870, 5, 108, 0, 0, 6870, 6871, 3, 528, 264, 0, 6871, + 6872, 5, 326, 0, 0, 6872, 6873, 5, 316, 0, 0, 6873, 6874, 3, 1352, 676, + 0, 6874, 7079, 1, 0, 0, 0, 6875, 6876, 5, 138, 0, 0, 6876, 6877, 5, 168, + 0, 0, 6877, 6878, 3, 528, 264, 0, 6878, 6879, 5, 326, 0, 0, 6879, 6880, + 5, 316, 0, 0, 6880, 6881, 3, 1352, 676, 0, 6881, 7079, 1, 0, 0, 0, 6882, + 6883, 5, 138, 0, 0, 6883, 6884, 5, 189, 0, 0, 6884, 6885, 3, 528, 264, + 0, 6885, 6886, 5, 326, 0, 0, 6886, 6887, 5, 316, 0, 0, 6887, 6888, 3, 1352, + 676, 0, 6888, 7079, 1, 0, 0, 0, 6889, 6890, 5, 138, 0, 0, 6890, 6891, 5, + 204, 0, 0, 6891, 6892, 3, 1352, 676, 0, 6892, 6893, 5, 326, 0, 0, 6893, + 6894, 5, 316, 0, 0, 6894, 6895, 3, 1352, 676, 0, 6895, 7079, 1, 0, 0, 0, + 6896, 6897, 5, 138, 0, 0, 6897, 6898, 5, 211, 0, 0, 6898, 6899, 3, 634, + 317, 0, 6899, 6900, 5, 326, 0, 0, 6900, 6901, 5, 316, 0, 0, 6901, 6902, + 3, 1352, 676, 0, 6902, 7079, 1, 0, 0, 0, 6903, 6904, 5, 138, 0, 0, 6904, + 6905, 5, 271, 0, 0, 6905, 6906, 3, 696, 348, 0, 6906, 6907, 5, 326, 0, + 0, 6907, 6908, 5, 316, 0, 0, 6908, 6909, 3, 1352, 676, 0, 6909, 7079, 1, + 0, 0, 0, 6910, 6911, 5, 138, 0, 0, 6911, 6912, 5, 271, 0, 0, 6912, 6913, + 5, 156, 0, 0, 6913, 6914, 3, 528, 264, 0, 6914, 6915, 5, 100, 0, 0, 6915, + 6916, 3, 1352, 676, 0, 6916, 6917, 5, 326, 0, 0, 6917, 6918, 5, 316, 0, + 0, 6918, 6919, 3, 1352, 676, 0, 6919, 7079, 1, 0, 0, 0, 6920, 6921, 5, + 138, 0, 0, 6921, 6922, 5, 271, 0, 0, 6922, 6923, 5, 206, 0, 0, 6923, 6924, + 3, 528, 264, 0, 6924, 6925, 5, 100, 0, 0, 6925, 6926, 3, 1352, 676, 0, + 6926, 6927, 5, 326, 0, 0, 6927, 6928, 5, 316, 0, 0, 6928, 6929, 3, 1352, + 676, 0, 6929, 7079, 1, 0, 0, 0, 6930, 6931, 5, 138, 0, 0, 6931, 6932, 5, + 289, 0, 0, 6932, 6933, 3, 634, 317, 0, 6933, 6934, 5, 326, 0, 0, 6934, + 6935, 5, 316, 0, 0, 6935, 6936, 3, 1352, 676, 0, 6936, 7079, 1, 0, 0, 0, + 6937, 6938, 5, 138, 0, 0, 6938, 6939, 5, 444, 0, 0, 6939, 6940, 3, 634, + 317, 0, 6940, 6941, 5, 326, 0, 0, 6941, 6942, 5, 316, 0, 0, 6942, 6943, + 3, 1352, 676, 0, 6943, 7079, 1, 0, 0, 0, 6944, 6945, 5, 138, 0, 0, 6945, + 6946, 5, 92, 0, 0, 6946, 6947, 3, 1084, 542, 0, 6947, 6948, 5, 326, 0, + 0, 6948, 6949, 5, 316, 0, 0, 6949, 6950, 3, 1352, 676, 0, 6950, 7079, 1, + 0, 0, 0, 6951, 6952, 5, 138, 0, 0, 6952, 6953, 5, 92, 0, 0, 6953, 6954, + 5, 220, 0, 0, 6954, 6955, 5, 390, 0, 0, 6955, 6956, 3, 1084, 542, 0, 6956, + 6957, 5, 326, 0, 0, 6957, 6958, 5, 316, 0, 0, 6958, 6959, 3, 1352, 676, + 0, 6959, 7079, 1, 0, 0, 0, 6960, 6961, 5, 138, 0, 0, 6961, 6962, 5, 335, + 0, 0, 6962, 6963, 3, 528, 264, 0, 6963, 6964, 5, 326, 0, 0, 6964, 6965, + 5, 316, 0, 0, 6965, 6966, 3, 1352, 676, 0, 6966, 7079, 1, 0, 0, 0, 6967, + 6968, 5, 138, 0, 0, 6968, 6969, 5, 348, 0, 0, 6969, 6970, 5, 318, 0, 0, + 6970, 6971, 5, 276, 0, 0, 6971, 6972, 3, 528, 264, 0, 6972, 6973, 5, 326, + 0, 0, 6973, 6974, 5, 316, 0, 0, 6974, 6975, 3, 1352, 676, 0, 6975, 7079, + 1, 0, 0, 0, 6976, 6977, 5, 138, 0, 0, 6977, 6978, 5, 348, 0, 0, 6978, 6979, + 5, 318, 0, 0, 6979, 6980, 5, 185, 0, 0, 6980, 6981, 3, 528, 264, 0, 6981, + 6982, 5, 326, 0, 0, 6982, 6983, 5, 316, 0, 0, 6983, 6984, 3, 1352, 676, + 0, 6984, 7079, 1, 0, 0, 0, 6985, 6986, 5, 138, 0, 0, 6986, 6987, 5, 348, + 0, 0, 6987, 6988, 5, 318, 0, 0, 6988, 6989, 5, 346, 0, 0, 6989, 6990, 3, + 528, 264, 0, 6990, 6991, 5, 326, 0, 0, 6991, 6992, 5, 316, 0, 0, 6992, + 6993, 3, 1352, 676, 0, 6993, 7079, 1, 0, 0, 0, 6994, 6995, 5, 138, 0, 0, + 6995, 6996, 5, 348, 0, 0, 6996, 6997, 5, 318, 0, 0, 6997, 6998, 5, 163, + 0, 0, 6998, 6999, 3, 528, 264, 0, 6999, 7000, 5, 326, 0, 0, 7000, 7001, + 5, 316, 0, 0, 7001, 7002, 3, 1352, 676, 0, 7002, 7079, 1, 0, 0, 0, 7003, + 7004, 5, 138, 0, 0, 7004, 7005, 5, 321, 0, 0, 7005, 7006, 3, 1348, 674, + 0, 7006, 7007, 5, 326, 0, 0, 7007, 7008, 5, 316, 0, 0, 7008, 7009, 3, 1352, + 676, 0, 7009, 7079, 1, 0, 0, 0, 7010, 7011, 5, 138, 0, 0, 7011, 7012, 5, + 321, 0, 0, 7012, 7013, 5, 220, 0, 0, 7013, 7014, 5, 390, 0, 0, 7014, 7015, + 3, 1348, 674, 0, 7015, 7016, 5, 326, 0, 0, 7016, 7017, 5, 316, 0, 0, 7017, + 7018, 3, 1352, 676, 0, 7018, 7079, 1, 0, 0, 0, 7019, 7020, 5, 138, 0, 0, + 7020, 7021, 5, 369, 0, 0, 7021, 7022, 3, 1348, 674, 0, 7022, 7023, 5, 326, + 0, 0, 7023, 7024, 5, 316, 0, 0, 7024, 7025, 3, 1352, 676, 0, 7025, 7079, + 1, 0, 0, 0, 7026, 7027, 5, 138, 0, 0, 7027, 7028, 5, 369, 0, 0, 7028, 7029, + 5, 220, 0, 0, 7029, 7030, 5, 390, 0, 0, 7030, 7031, 3, 1348, 674, 0, 7031, + 7032, 5, 326, 0, 0, 7032, 7033, 5, 316, 0, 0, 7033, 7034, 3, 1352, 676, + 0, 7034, 7079, 1, 0, 0, 0, 7035, 7036, 5, 138, 0, 0, 7036, 7037, 5, 251, + 0, 0, 7037, 7038, 5, 369, 0, 0, 7038, 7039, 3, 1348, 674, 0, 7039, 7040, + 5, 326, 0, 0, 7040, 7041, 5, 316, 0, 0, 7041, 7042, 3, 1352, 676, 0, 7042, + 7079, 1, 0, 0, 0, 7043, 7044, 5, 138, 0, 0, 7044, 7045, 5, 251, 0, 0, 7045, + 7046, 5, 369, 0, 0, 7046, 7047, 5, 220, 0, 0, 7047, 7048, 5, 390, 0, 0, + 7048, 7049, 3, 1348, 674, 0, 7049, 7050, 5, 326, 0, 0, 7050, 7051, 5, 316, + 0, 0, 7051, 7052, 3, 1352, 676, 0, 7052, 7079, 1, 0, 0, 0, 7053, 7054, + 5, 138, 0, 0, 7054, 7055, 5, 63, 0, 0, 7055, 7056, 5, 92, 0, 0, 7056, 7057, + 3, 1084, 542, 0, 7057, 7058, 5, 326, 0, 0, 7058, 7059, 5, 316, 0, 0, 7059, + 7060, 3, 1352, 676, 0, 7060, 7079, 1, 0, 0, 0, 7061, 7062, 5, 138, 0, 0, + 7062, 7063, 5, 63, 0, 0, 7063, 7064, 5, 92, 0, 0, 7064, 7065, 5, 220, 0, + 0, 7065, 7066, 5, 390, 0, 0, 7066, 7067, 3, 1084, 542, 0, 7067, 7068, 5, + 326, 0, 0, 7068, 7069, 5, 316, 0, 0, 7069, 7070, 3, 1352, 676, 0, 7070, + 7079, 1, 0, 0, 0, 7071, 7072, 5, 138, 0, 0, 7072, 7073, 5, 353, 0, 0, 7073, + 7074, 3, 528, 264, 0, 7074, 7075, 5, 326, 0, 0, 7075, 7076, 5, 316, 0, + 0, 7076, 7077, 3, 1352, 676, 0, 7077, 7079, 1, 0, 0, 0, 7078, 6861, 1, + 0, 0, 0, 7078, 6868, 1, 0, 0, 0, 7078, 6875, 1, 0, 0, 0, 7078, 6882, 1, + 0, 0, 0, 7078, 6889, 1, 0, 0, 0, 7078, 6896, 1, 0, 0, 0, 7078, 6903, 1, + 0, 0, 0, 7078, 6910, 1, 0, 0, 0, 7078, 6920, 1, 0, 0, 0, 7078, 6930, 1, + 0, 0, 0, 7078, 6937, 1, 0, 0, 0, 7078, 6944, 1, 0, 0, 0, 7078, 6951, 1, + 0, 0, 0, 7078, 6960, 1, 0, 0, 0, 7078, 6967, 1, 0, 0, 0, 7078, 6976, 1, + 0, 0, 0, 7078, 6985, 1, 0, 0, 0, 7078, 6994, 1, 0, 0, 0, 7078, 7003, 1, + 0, 0, 0, 7078, 7010, 1, 0, 0, 0, 7078, 7019, 1, 0, 0, 0, 7078, 7026, 1, + 0, 0, 0, 7078, 7035, 1, 0, 0, 0, 7078, 7043, 1, 0, 0, 0, 7078, 7053, 1, + 0, 0, 0, 7078, 7061, 1, 0, 0, 0, 7078, 7071, 1, 0, 0, 0, 7079, 741, 1, + 0, 0, 0, 7080, 7081, 5, 138, 0, 0, 7081, 7082, 5, 271, 0, 0, 7082, 7083, + 3, 696, 348, 0, 7083, 7084, 5, 326, 0, 0, 7084, 7085, 5, 2, 0, 0, 7085, + 7086, 3, 744, 372, 0, 7086, 7087, 5, 3, 0, 0, 7087, 743, 1, 0, 0, 0, 7088, + 7093, 3, 746, 373, 0, 7089, 7090, 5, 6, 0, 0, 7090, 7092, 3, 746, 373, + 0, 7091, 7089, 1, 0, 0, 0, 7092, 7095, 1, 0, 0, 0, 7093, 7091, 1, 0, 0, + 0, 7093, 7094, 1, 0, 0, 0, 7094, 745, 1, 0, 0, 0, 7095, 7093, 1, 0, 0, + 0, 7096, 7097, 3, 1392, 696, 0, 7097, 7098, 5, 10, 0, 0, 7098, 7099, 5, + 401, 0, 0, 7099, 7105, 1, 0, 0, 0, 7100, 7101, 3, 1392, 696, 0, 7101, 7102, + 5, 10, 0, 0, 7102, 7103, 3, 748, 374, 0, 7103, 7105, 1, 0, 0, 0, 7104, + 7096, 1, 0, 0, 0, 7104, 7100, 1, 0, 0, 0, 7105, 747, 1, 0, 0, 0, 7106, + 7112, 3, 648, 324, 0, 7107, 7112, 3, 1404, 702, 0, 7108, 7112, 3, 1286, + 643, 0, 7109, 7112, 3, 296, 148, 0, 7110, 7112, 3, 1370, 685, 0, 7111, + 7106, 1, 0, 0, 0, 7111, 7107, 1, 0, 0, 0, 7111, 7108, 1, 0, 0, 0, 7111, + 7109, 1, 0, 0, 0, 7111, 7110, 1, 0, 0, 0, 7112, 749, 1, 0, 0, 0, 7113, + 7114, 5, 138, 0, 0, 7114, 7115, 5, 353, 0, 0, 7115, 7116, 3, 528, 264, + 0, 7116, 7117, 5, 326, 0, 0, 7117, 7118, 5, 2, 0, 0, 7118, 7119, 3, 744, + 372, 0, 7119, 7120, 5, 3, 0, 0, 7120, 751, 1, 0, 0, 0, 7121, 7122, 5, 138, + 0, 0, 7122, 7123, 5, 136, 0, 0, 7123, 7124, 3, 658, 329, 0, 7124, 7125, + 5, 275, 0, 0, 7125, 7126, 5, 94, 0, 0, 7126, 7127, 3, 1380, 690, 0, 7127, + 7307, 1, 0, 0, 0, 7128, 7129, 5, 138, 0, 0, 7129, 7130, 5, 108, 0, 0, 7130, + 7131, 3, 528, 264, 0, 7131, 7132, 5, 275, 0, 0, 7132, 7133, 5, 94, 0, 0, + 7133, 7134, 3, 1380, 690, 0, 7134, 7307, 1, 0, 0, 0, 7135, 7136, 5, 138, + 0, 0, 7136, 7137, 5, 168, 0, 0, 7137, 7138, 3, 528, 264, 0, 7138, 7139, + 5, 275, 0, 0, 7139, 7140, 5, 94, 0, 0, 7140, 7141, 3, 1380, 690, 0, 7141, + 7307, 1, 0, 0, 0, 7142, 7143, 5, 138, 0, 0, 7143, 7144, 5, 175, 0, 0, 7144, + 7145, 3, 1352, 676, 0, 7145, 7146, 5, 275, 0, 0, 7146, 7147, 5, 94, 0, + 0, 7147, 7148, 3, 1380, 690, 0, 7148, 7307, 1, 0, 0, 0, 7149, 7150, 5, + 138, 0, 0, 7150, 7151, 5, 189, 0, 0, 7151, 7152, 3, 528, 264, 0, 7152, + 7153, 5, 275, 0, 0, 7153, 7154, 5, 94, 0, 0, 7154, 7155, 3, 1380, 690, + 0, 7155, 7307, 1, 0, 0, 0, 7156, 7157, 5, 138, 0, 0, 7157, 7158, 5, 211, + 0, 0, 7158, 7159, 3, 634, 317, 0, 7159, 7160, 5, 275, 0, 0, 7160, 7161, + 5, 94, 0, 0, 7161, 7162, 3, 1380, 690, 0, 7162, 7307, 1, 0, 0, 0, 7163, + 7165, 5, 138, 0, 0, 7164, 7166, 3, 312, 156, 0, 7165, 7164, 1, 0, 0, 0, + 7165, 7166, 1, 0, 0, 0, 7166, 7167, 1, 0, 0, 0, 7167, 7168, 5, 238, 0, + 0, 7168, 7169, 3, 1352, 676, 0, 7169, 7170, 5, 275, 0, 0, 7170, 7171, 5, + 94, 0, 0, 7171, 7172, 3, 1380, 690, 0, 7172, 7307, 1, 0, 0, 0, 7173, 7174, + 5, 138, 0, 0, 7174, 7175, 5, 239, 0, 0, 7175, 7176, 5, 267, 0, 0, 7176, + 7177, 3, 296, 148, 0, 7177, 7178, 5, 275, 0, 0, 7178, 7179, 5, 94, 0, 0, + 7179, 7180, 3, 1380, 690, 0, 7180, 7307, 1, 0, 0, 0, 7181, 7182, 5, 138, + 0, 0, 7182, 7183, 5, 271, 0, 0, 7183, 7184, 3, 696, 348, 0, 7184, 7185, + 5, 275, 0, 0, 7185, 7186, 5, 94, 0, 0, 7186, 7187, 3, 1380, 690, 0, 7187, + 7307, 1, 0, 0, 0, 7188, 7189, 5, 138, 0, 0, 7189, 7190, 5, 271, 0, 0, 7190, + 7191, 5, 156, 0, 0, 7191, 7192, 3, 528, 264, 0, 7192, 7193, 5, 100, 0, + 0, 7193, 7194, 3, 1352, 676, 0, 7194, 7195, 5, 275, 0, 0, 7195, 7196, 5, + 94, 0, 0, 7196, 7197, 3, 1380, 690, 0, 7197, 7307, 1, 0, 0, 0, 7198, 7199, + 5, 138, 0, 0, 7199, 7200, 5, 271, 0, 0, 7200, 7201, 5, 206, 0, 0, 7201, + 7202, 3, 528, 264, 0, 7202, 7203, 5, 100, 0, 0, 7203, 7204, 3, 1352, 676, + 0, 7204, 7205, 5, 275, 0, 0, 7205, 7206, 5, 94, 0, 0, 7206, 7207, 3, 1380, + 690, 0, 7207, 7307, 1, 0, 0, 0, 7208, 7209, 5, 138, 0, 0, 7209, 7210, 5, + 289, 0, 0, 7210, 7211, 3, 634, 317, 0, 7211, 7212, 5, 275, 0, 0, 7212, + 7213, 5, 94, 0, 0, 7213, 7214, 3, 1380, 690, 0, 7214, 7307, 1, 0, 0, 0, + 7215, 7216, 5, 138, 0, 0, 7216, 7217, 5, 444, 0, 0, 7217, 7218, 3, 634, + 317, 0, 7218, 7219, 5, 275, 0, 0, 7219, 7220, 5, 94, 0, 0, 7220, 7221, + 3, 1380, 690, 0, 7221, 7307, 1, 0, 0, 0, 7222, 7223, 5, 138, 0, 0, 7223, + 7224, 5, 316, 0, 0, 7224, 7225, 3, 1352, 676, 0, 7225, 7226, 5, 275, 0, + 0, 7226, 7227, 5, 94, 0, 0, 7227, 7228, 3, 1380, 690, 0, 7228, 7307, 1, + 0, 0, 0, 7229, 7230, 5, 138, 0, 0, 7230, 7231, 5, 353, 0, 0, 7231, 7232, + 3, 528, 264, 0, 7232, 7233, 5, 275, 0, 0, 7233, 7234, 5, 94, 0, 0, 7234, + 7235, 3, 1380, 690, 0, 7235, 7307, 1, 0, 0, 0, 7236, 7237, 5, 138, 0, 0, + 7237, 7238, 5, 344, 0, 0, 7238, 7239, 3, 1352, 676, 0, 7239, 7240, 5, 275, + 0, 0, 7240, 7241, 5, 94, 0, 0, 7241, 7242, 3, 1380, 690, 0, 7242, 7307, + 1, 0, 0, 0, 7243, 7244, 5, 138, 0, 0, 7244, 7245, 5, 335, 0, 0, 7245, 7246, + 3, 528, 264, 0, 7246, 7247, 5, 275, 0, 0, 7247, 7248, 5, 94, 0, 0, 7248, + 7249, 3, 1380, 690, 0, 7249, 7307, 1, 0, 0, 0, 7250, 7251, 5, 138, 0, 0, + 7251, 7252, 5, 348, 0, 0, 7252, 7253, 5, 318, 0, 0, 7253, 7254, 5, 185, + 0, 0, 7254, 7255, 3, 528, 264, 0, 7255, 7256, 5, 275, 0, 0, 7256, 7257, + 5, 94, 0, 0, 7257, 7258, 3, 1380, 690, 0, 7258, 7307, 1, 0, 0, 0, 7259, + 7260, 5, 138, 0, 0, 7260, 7261, 5, 348, 0, 0, 7261, 7262, 5, 318, 0, 0, + 7262, 7263, 5, 163, 0, 0, 7263, 7264, 3, 528, 264, 0, 7264, 7265, 5, 275, + 0, 0, 7265, 7266, 5, 94, 0, 0, 7266, 7267, 3, 1380, 690, 0, 7267, 7307, + 1, 0, 0, 0, 7268, 7269, 5, 138, 0, 0, 7269, 7270, 5, 63, 0, 0, 7270, 7271, + 5, 174, 0, 0, 7271, 7272, 5, 374, 0, 0, 7272, 7273, 3, 1352, 676, 0, 7273, + 7274, 5, 275, 0, 0, 7274, 7275, 5, 94, 0, 0, 7275, 7276, 3, 1380, 690, + 0, 7276, 7307, 1, 0, 0, 0, 7277, 7278, 5, 138, 0, 0, 7278, 7279, 5, 324, + 0, 0, 7279, 7280, 3, 1352, 676, 0, 7280, 7281, 5, 275, 0, 0, 7281, 7282, + 5, 94, 0, 0, 7282, 7283, 3, 1380, 690, 0, 7283, 7307, 1, 0, 0, 0, 7284, + 7285, 5, 138, 0, 0, 7285, 7286, 5, 198, 0, 0, 7286, 7287, 5, 350, 0, 0, + 7287, 7288, 3, 1352, 676, 0, 7288, 7289, 5, 275, 0, 0, 7289, 7290, 5, 94, + 0, 0, 7290, 7291, 3, 1380, 690, 0, 7291, 7307, 1, 0, 0, 0, 7292, 7293, + 5, 138, 0, 0, 7293, 7294, 5, 454, 0, 0, 7294, 7295, 3, 1352, 676, 0, 7295, + 7296, 5, 275, 0, 0, 7296, 7297, 5, 94, 0, 0, 7297, 7298, 3, 1380, 690, + 0, 7298, 7307, 1, 0, 0, 0, 7299, 7300, 5, 138, 0, 0, 7300, 7301, 5, 453, + 0, 0, 7301, 7302, 3, 1352, 676, 0, 7302, 7303, 5, 275, 0, 0, 7303, 7304, + 5, 94, 0, 0, 7304, 7305, 3, 1380, 690, 0, 7305, 7307, 1, 0, 0, 0, 7306, + 7121, 1, 0, 0, 0, 7306, 7128, 1, 0, 0, 0, 7306, 7135, 1, 0, 0, 0, 7306, + 7142, 1, 0, 0, 0, 7306, 7149, 1, 0, 0, 0, 7306, 7156, 1, 0, 0, 0, 7306, + 7163, 1, 0, 0, 0, 7306, 7173, 1, 0, 0, 0, 7306, 7181, 1, 0, 0, 0, 7306, + 7188, 1, 0, 0, 0, 7306, 7198, 1, 0, 0, 0, 7306, 7208, 1, 0, 0, 0, 7306, + 7215, 1, 0, 0, 0, 7306, 7222, 1, 0, 0, 0, 7306, 7229, 1, 0, 0, 0, 7306, + 7236, 1, 0, 0, 0, 7306, 7243, 1, 0, 0, 0, 7306, 7250, 1, 0, 0, 0, 7306, + 7259, 1, 0, 0, 0, 7306, 7268, 1, 0, 0, 0, 7306, 7277, 1, 0, 0, 0, 7306, + 7284, 1, 0, 0, 0, 7306, 7292, 1, 0, 0, 0, 7306, 7299, 1, 0, 0, 0, 7307, + 753, 1, 0, 0, 0, 7308, 7309, 5, 46, 0, 0, 7309, 7310, 5, 454, 0, 0, 7310, + 7312, 3, 1352, 676, 0, 7311, 7313, 3, 672, 336, 0, 7312, 7311, 1, 0, 0, + 0, 7312, 7313, 1, 0, 0, 0, 7313, 7332, 1, 0, 0, 0, 7314, 7315, 5, 46, 0, + 0, 7315, 7316, 5, 454, 0, 0, 7316, 7317, 3, 1352, 676, 0, 7317, 7318, 5, + 62, 0, 0, 7318, 7319, 5, 30, 0, 0, 7319, 7321, 5, 343, 0, 0, 7320, 7322, + 3, 672, 336, 0, 7321, 7320, 1, 0, 0, 0, 7321, 7322, 1, 0, 0, 0, 7322, 7332, + 1, 0, 0, 0, 7323, 7324, 5, 46, 0, 0, 7324, 7325, 5, 454, 0, 0, 7325, 7326, + 3, 1352, 676, 0, 7326, 7327, 5, 62, 0, 0, 7327, 7329, 3, 756, 378, 0, 7328, + 7330, 3, 672, 336, 0, 7329, 7328, 1, 0, 0, 0, 7329, 7330, 1, 0, 0, 0, 7330, + 7332, 1, 0, 0, 0, 7331, 7308, 1, 0, 0, 0, 7331, 7314, 1, 0, 0, 0, 7331, + 7323, 1, 0, 0, 0, 7332, 755, 1, 0, 0, 0, 7333, 7338, 3, 758, 379, 0, 7334, + 7335, 5, 6, 0, 0, 7335, 7337, 3, 758, 379, 0, 7336, 7334, 1, 0, 0, 0, 7337, + 7340, 1, 0, 0, 0, 7338, 7336, 1, 0, 0, 0, 7338, 7339, 1, 0, 0, 0, 7339, + 757, 1, 0, 0, 0, 7340, 7338, 1, 0, 0, 0, 7341, 7342, 5, 92, 0, 0, 7342, + 7344, 3, 1084, 542, 0, 7343, 7345, 3, 218, 109, 0, 7344, 7343, 1, 0, 0, + 0, 7344, 7345, 1, 0, 0, 0, 7345, 7347, 1, 0, 0, 0, 7346, 7348, 3, 760, + 380, 0, 7347, 7346, 1, 0, 0, 0, 7347, 7348, 1, 0, 0, 0, 7348, 7380, 1, + 0, 0, 0, 7349, 7350, 5, 92, 0, 0, 7350, 7351, 5, 68, 0, 0, 7351, 7354, + 5, 316, 0, 0, 7352, 7355, 3, 1384, 692, 0, 7353, 7355, 5, 111, 0, 0, 7354, + 7352, 1, 0, 0, 0, 7354, 7353, 1, 0, 0, 0, 7355, 7380, 1, 0, 0, 0, 7356, + 7358, 3, 1384, 692, 0, 7357, 7359, 3, 218, 109, 0, 7358, 7357, 1, 0, 0, + 0, 7358, 7359, 1, 0, 0, 0, 7359, 7361, 1, 0, 0, 0, 7360, 7362, 3, 760, + 380, 0, 7361, 7360, 1, 0, 0, 0, 7361, 7362, 1, 0, 0, 0, 7362, 7380, 1, + 0, 0, 0, 7363, 7364, 3, 1384, 692, 0, 7364, 7366, 3, 1334, 667, 0, 7365, + 7367, 3, 218, 109, 0, 7366, 7365, 1, 0, 0, 0, 7366, 7367, 1, 0, 0, 0, 7367, + 7369, 1, 0, 0, 0, 7368, 7370, 3, 760, 380, 0, 7369, 7368, 1, 0, 0, 0, 7369, + 7370, 1, 0, 0, 0, 7370, 7380, 1, 0, 0, 0, 7371, 7373, 3, 1084, 542, 0, + 7372, 7374, 3, 218, 109, 0, 7373, 7372, 1, 0, 0, 0, 7373, 7374, 1, 0, 0, + 0, 7374, 7376, 1, 0, 0, 0, 7375, 7377, 3, 760, 380, 0, 7376, 7375, 1, 0, + 0, 0, 7376, 7377, 1, 0, 0, 0, 7377, 7380, 1, 0, 0, 0, 7378, 7380, 5, 111, + 0, 0, 7379, 7341, 1, 0, 0, 0, 7379, 7349, 1, 0, 0, 0, 7379, 7356, 1, 0, + 0, 0, 7379, 7363, 1, 0, 0, 0, 7379, 7371, 1, 0, 0, 0, 7379, 7378, 1, 0, + 0, 0, 7380, 759, 1, 0, 0, 0, 7381, 7382, 5, 103, 0, 0, 7382, 7383, 5, 2, + 0, 0, 7383, 7384, 3, 1172, 586, 0, 7384, 7385, 5, 3, 0, 0, 7385, 761, 1, + 0, 0, 0, 7386, 7387, 5, 138, 0, 0, 7387, 7388, 5, 454, 0, 0, 7388, 7389, + 3, 1352, 676, 0, 7389, 7390, 5, 326, 0, 0, 7390, 7391, 3, 464, 232, 0, + 7391, 7411, 1, 0, 0, 0, 7392, 7393, 5, 138, 0, 0, 7393, 7394, 5, 454, 0, + 0, 7394, 7395, 3, 1352, 676, 0, 7395, 7396, 5, 133, 0, 0, 7396, 7397, 3, + 756, 378, 0, 7397, 7411, 1, 0, 0, 0, 7398, 7399, 5, 138, 0, 0, 7399, 7400, + 5, 454, 0, 0, 7400, 7401, 3, 1352, 676, 0, 7401, 7402, 5, 326, 0, 0, 7402, + 7403, 3, 756, 378, 0, 7403, 7411, 1, 0, 0, 0, 7404, 7405, 5, 138, 0, 0, + 7405, 7406, 5, 454, 0, 0, 7406, 7407, 3, 1352, 676, 0, 7407, 7408, 5, 191, + 0, 0, 7408, 7409, 3, 756, 378, 0, 7409, 7411, 1, 0, 0, 0, 7410, 7386, 1, + 0, 0, 0, 7410, 7392, 1, 0, 0, 0, 7410, 7398, 1, 0, 0, 0, 7410, 7404, 1, + 0, 0, 0, 7411, 763, 1, 0, 0, 0, 7412, 7413, 5, 46, 0, 0, 7413, 7414, 5, + 453, 0, 0, 7414, 7415, 3, 1352, 676, 0, 7415, 7416, 5, 164, 0, 0, 7416, + 7417, 3, 1370, 685, 0, 7417, 7418, 5, 454, 0, 0, 7418, 7420, 3, 766, 383, + 0, 7419, 7421, 3, 672, 336, 0, 7420, 7419, 1, 0, 0, 0, 7420, 7421, 1, 0, + 0, 0, 7421, 765, 1, 0, 0, 0, 7422, 7427, 3, 768, 384, 0, 7423, 7424, 5, + 6, 0, 0, 7424, 7426, 3, 768, 384, 0, 7425, 7423, 1, 0, 0, 0, 7426, 7429, + 1, 0, 0, 0, 7427, 7425, 1, 0, 0, 0, 7427, 7428, 1, 0, 0, 0, 7428, 767, + 1, 0, 0, 0, 7429, 7427, 1, 0, 0, 0, 7430, 7431, 3, 1392, 696, 0, 7431, + 769, 1, 0, 0, 0, 7432, 7433, 5, 138, 0, 0, 7433, 7434, 5, 453, 0, 0, 7434, + 7435, 3, 1352, 676, 0, 7435, 7436, 5, 326, 0, 0, 7436, 7437, 3, 464, 232, + 0, 7437, 7478, 1, 0, 0, 0, 7438, 7439, 5, 138, 0, 0, 7439, 7440, 5, 453, + 0, 0, 7440, 7441, 3, 1352, 676, 0, 7441, 7442, 5, 164, 0, 0, 7442, 7443, + 3, 1370, 685, 0, 7443, 7478, 1, 0, 0, 0, 7444, 7445, 5, 138, 0, 0, 7445, + 7446, 5, 453, 0, 0, 7446, 7447, 3, 1352, 676, 0, 7447, 7448, 5, 298, 0, + 0, 7448, 7450, 5, 454, 0, 0, 7449, 7451, 3, 672, 336, 0, 7450, 7449, 1, + 0, 0, 0, 7450, 7451, 1, 0, 0, 0, 7451, 7478, 1, 0, 0, 0, 7452, 7453, 5, + 138, 0, 0, 7453, 7454, 5, 453, 0, 0, 7454, 7455, 3, 1352, 676, 0, 7455, + 7456, 5, 326, 0, 0, 7456, 7457, 5, 454, 0, 0, 7457, 7459, 3, 766, 383, + 0, 7458, 7460, 3, 672, 336, 0, 7459, 7458, 1, 0, 0, 0, 7459, 7460, 1, 0, + 0, 0, 7460, 7478, 1, 0, 0, 0, 7461, 7462, 5, 138, 0, 0, 7462, 7463, 5, + 453, 0, 0, 7463, 7464, 3, 1352, 676, 0, 7464, 7465, 5, 193, 0, 0, 7465, + 7478, 1, 0, 0, 0, 7466, 7467, 5, 138, 0, 0, 7467, 7468, 5, 453, 0, 0, 7468, + 7469, 3, 1352, 676, 0, 7469, 7470, 5, 186, 0, 0, 7470, 7478, 1, 0, 0, 0, + 7471, 7472, 5, 138, 0, 0, 7472, 7473, 5, 453, 0, 0, 7473, 7474, 3, 1352, + 676, 0, 7474, 7475, 5, 467, 0, 0, 7475, 7476, 3, 464, 232, 0, 7476, 7478, + 1, 0, 0, 0, 7477, 7432, 1, 0, 0, 0, 7477, 7438, 1, 0, 0, 0, 7477, 7444, + 1, 0, 0, 0, 7477, 7452, 1, 0, 0, 0, 7477, 7461, 1, 0, 0, 0, 7477, 7466, + 1, 0, 0, 0, 7477, 7471, 1, 0, 0, 0, 7478, 771, 1, 0, 0, 0, 7479, 7480, + 5, 191, 0, 0, 7480, 7481, 5, 453, 0, 0, 7481, 7483, 3, 1352, 676, 0, 7482, + 7484, 3, 108, 54, 0, 7483, 7482, 1, 0, 0, 0, 7483, 7484, 1, 0, 0, 0, 7484, + 7494, 1, 0, 0, 0, 7485, 7486, 5, 191, 0, 0, 7486, 7487, 5, 453, 0, 0, 7487, + 7488, 5, 220, 0, 0, 7488, 7489, 5, 390, 0, 0, 7489, 7491, 3, 1352, 676, + 0, 7490, 7492, 3, 108, 54, 0, 7491, 7490, 1, 0, 0, 0, 7491, 7492, 1, 0, + 0, 0, 7492, 7494, 1, 0, 0, 0, 7493, 7479, 1, 0, 0, 0, 7493, 7485, 1, 0, + 0, 0, 7494, 773, 1, 0, 0, 0, 7495, 7497, 5, 46, 0, 0, 7496, 7498, 3, 626, + 313, 0, 7497, 7496, 1, 0, 0, 0, 7497, 7498, 1, 0, 0, 0, 7498, 7499, 1, + 0, 0, 0, 7499, 7500, 5, 314, 0, 0, 7500, 7501, 3, 1352, 676, 0, 7501, 7502, + 5, 36, 0, 0, 7502, 7503, 5, 80, 0, 0, 7503, 7504, 3, 784, 392, 0, 7504, + 7505, 5, 94, 0, 0, 7505, 7507, 3, 1348, 674, 0, 7506, 7508, 3, 1104, 552, + 0, 7507, 7506, 1, 0, 0, 0, 7507, 7508, 1, 0, 0, 0, 7508, 7509, 1, 0, 0, + 0, 7509, 7511, 5, 57, 0, 0, 7510, 7512, 3, 786, 393, 0, 7511, 7510, 1, + 0, 0, 0, 7511, 7512, 1, 0, 0, 0, 7512, 7513, 1, 0, 0, 0, 7513, 7514, 3, + 776, 388, 0, 7514, 775, 1, 0, 0, 0, 7515, 7522, 5, 263, 0, 0, 7516, 7522, + 3, 780, 390, 0, 7517, 7518, 5, 2, 0, 0, 7518, 7519, 3, 778, 389, 0, 7519, + 7520, 5, 3, 0, 0, 7520, 7522, 1, 0, 0, 0, 7521, 7515, 1, 0, 0, 0, 7521, + 7516, 1, 0, 0, 0, 7521, 7517, 1, 0, 0, 0, 7522, 777, 1, 0, 0, 0, 7523, + 7525, 3, 782, 391, 0, 7524, 7523, 1, 0, 0, 0, 7524, 7525, 1, 0, 0, 0, 7525, + 7532, 1, 0, 0, 0, 7526, 7528, 5, 7, 0, 0, 7527, 7529, 3, 782, 391, 0, 7528, + 7527, 1, 0, 0, 0, 7528, 7529, 1, 0, 0, 0, 7529, 7531, 1, 0, 0, 0, 7530, + 7526, 1, 0, 0, 0, 7531, 7534, 1, 0, 0, 0, 7532, 7530, 1, 0, 0, 0, 7532, + 7533, 1, 0, 0, 0, 7533, 779, 1, 0, 0, 0, 7534, 7532, 1, 0, 0, 0, 7535, + 7541, 3, 970, 485, 0, 7536, 7541, 3, 912, 456, 0, 7537, 7541, 3, 952, 476, + 0, 7538, 7541, 3, 938, 469, 0, 7539, 7541, 3, 788, 394, 0, 7540, 7535, + 1, 0, 0, 0, 7540, 7536, 1, 0, 0, 0, 7540, 7537, 1, 0, 0, 0, 7540, 7538, + 1, 0, 0, 0, 7540, 7539, 1, 0, 0, 0, 7541, 781, 1, 0, 0, 0, 7542, 7543, + 3, 780, 390, 0, 7543, 783, 1, 0, 0, 0, 7544, 7545, 7, 34, 0, 0, 7545, 785, + 1, 0, 0, 0, 7546, 7547, 7, 35, 0, 0, 7547, 787, 1, 0, 0, 0, 7548, 7549, + 5, 264, 0, 0, 7549, 7551, 3, 1384, 692, 0, 7550, 7552, 3, 790, 395, 0, + 7551, 7550, 1, 0, 0, 0, 7551, 7552, 1, 0, 0, 0, 7552, 789, 1, 0, 0, 0, + 7553, 7554, 5, 6, 0, 0, 7554, 7555, 3, 1370, 685, 0, 7555, 791, 1, 0, 0, + 0, 7556, 7557, 5, 243, 0, 0, 7557, 7558, 3, 1384, 692, 0, 7558, 793, 1, + 0, 0, 0, 7559, 7560, 5, 359, 0, 0, 7560, 7564, 3, 1384, 692, 0, 7561, 7562, + 5, 359, 0, 0, 7562, 7564, 5, 9, 0, 0, 7563, 7559, 1, 0, 0, 0, 7563, 7561, + 1, 0, 0, 0, 7564, 795, 1, 0, 0, 0, 7565, 7567, 5, 129, 0, 0, 7566, 7568, + 3, 798, 399, 0, 7567, 7566, 1, 0, 0, 0, 7567, 7568, 1, 0, 0, 0, 7568, 7570, + 1, 0, 0, 0, 7569, 7571, 3, 806, 403, 0, 7570, 7569, 1, 0, 0, 0, 7570, 7571, + 1, 0, 0, 0, 7571, 7635, 1, 0, 0, 0, 7572, 7574, 5, 146, 0, 0, 7573, 7575, + 3, 798, 399, 0, 7574, 7573, 1, 0, 0, 0, 7574, 7575, 1, 0, 0, 0, 7575, 7577, + 1, 0, 0, 0, 7576, 7578, 3, 804, 402, 0, 7577, 7576, 1, 0, 0, 0, 7577, 7578, + 1, 0, 0, 0, 7578, 7635, 1, 0, 0, 0, 7579, 7580, 5, 333, 0, 0, 7580, 7582, + 5, 349, 0, 0, 7581, 7583, 3, 804, 402, 0, 7582, 7581, 1, 0, 0, 0, 7582, + 7583, 1, 0, 0, 0, 7583, 7635, 1, 0, 0, 0, 7584, 7586, 5, 161, 0, 0, 7585, + 7587, 3, 798, 399, 0, 7586, 7585, 1, 0, 0, 0, 7586, 7587, 1, 0, 0, 0, 7587, + 7589, 1, 0, 0, 0, 7588, 7590, 3, 806, 403, 0, 7589, 7588, 1, 0, 0, 0, 7589, + 7590, 1, 0, 0, 0, 7590, 7635, 1, 0, 0, 0, 7591, 7593, 5, 456, 0, 0, 7592, + 7594, 3, 798, 399, 0, 7593, 7592, 1, 0, 0, 0, 7593, 7594, 1, 0, 0, 0, 7594, + 7596, 1, 0, 0, 0, 7595, 7597, 3, 806, 403, 0, 7596, 7595, 1, 0, 0, 0, 7596, + 7597, 1, 0, 0, 0, 7597, 7635, 1, 0, 0, 0, 7598, 7600, 5, 312, 0, 0, 7599, + 7601, 3, 798, 399, 0, 7600, 7599, 1, 0, 0, 0, 7600, 7601, 1, 0, 0, 0, 7601, + 7603, 1, 0, 0, 0, 7602, 7604, 3, 806, 403, 0, 7603, 7602, 1, 0, 0, 0, 7603, + 7604, 1, 0, 0, 0, 7604, 7635, 1, 0, 0, 0, 7605, 7606, 5, 315, 0, 0, 7606, + 7635, 3, 1384, 692, 0, 7607, 7608, 5, 301, 0, 0, 7608, 7609, 5, 315, 0, + 0, 7609, 7635, 3, 1384, 692, 0, 7610, 7611, 5, 301, 0, 0, 7611, 7635, 3, + 1384, 692, 0, 7612, 7614, 5, 312, 0, 0, 7613, 7615, 3, 798, 399, 0, 7614, + 7613, 1, 0, 0, 0, 7614, 7615, 1, 0, 0, 0, 7615, 7616, 1, 0, 0, 0, 7616, + 7617, 5, 94, 0, 0, 7617, 7618, 5, 315, 0, 0, 7618, 7635, 3, 1384, 692, + 0, 7619, 7621, 5, 312, 0, 0, 7620, 7622, 3, 798, 399, 0, 7621, 7620, 1, + 0, 0, 0, 7621, 7622, 1, 0, 0, 0, 7622, 7623, 1, 0, 0, 0, 7623, 7624, 5, + 94, 0, 0, 7624, 7635, 3, 1384, 692, 0, 7625, 7626, 5, 283, 0, 0, 7626, + 7627, 5, 349, 0, 0, 7627, 7635, 3, 1370, 685, 0, 7628, 7629, 5, 161, 0, + 0, 7629, 7630, 5, 284, 0, 0, 7630, 7635, 3, 1370, 685, 0, 7631, 7632, 5, + 312, 0, 0, 7632, 7633, 5, 284, 0, 0, 7633, 7635, 3, 1370, 685, 0, 7634, + 7565, 1, 0, 0, 0, 7634, 7572, 1, 0, 0, 0, 7634, 7579, 1, 0, 0, 0, 7634, + 7584, 1, 0, 0, 0, 7634, 7591, 1, 0, 0, 0, 7634, 7598, 1, 0, 0, 0, 7634, + 7605, 1, 0, 0, 0, 7634, 7607, 1, 0, 0, 0, 7634, 7610, 1, 0, 0, 0, 7634, + 7612, 1, 0, 0, 0, 7634, 7619, 1, 0, 0, 0, 7634, 7625, 1, 0, 0, 0, 7634, + 7628, 1, 0, 0, 0, 7634, 7631, 1, 0, 0, 0, 7635, 797, 1, 0, 0, 0, 7636, + 7637, 7, 36, 0, 0, 7637, 799, 1, 0, 0, 0, 7638, 7639, 5, 235, 0, 0, 7639, + 7640, 5, 242, 0, 0, 7640, 7649, 3, 64, 32, 0, 7641, 7642, 5, 293, 0, 0, + 7642, 7649, 5, 81, 0, 0, 7643, 7644, 5, 293, 0, 0, 7644, 7649, 5, 375, + 0, 0, 7645, 7649, 5, 54, 0, 0, 7646, 7647, 5, 77, 0, 0, 7647, 7649, 5, + 54, 0, 0, 7648, 7638, 1, 0, 0, 0, 7648, 7641, 1, 0, 0, 0, 7648, 7643, 1, + 0, 0, 0, 7648, 7645, 1, 0, 0, 0, 7648, 7646, 1, 0, 0, 0, 7649, 801, 1, + 0, 0, 0, 7650, 7657, 3, 800, 400, 0, 7651, 7653, 5, 6, 0, 0, 7652, 7651, + 1, 0, 0, 0, 7652, 7653, 1, 0, 0, 0, 7653, 7654, 1, 0, 0, 0, 7654, 7656, + 3, 800, 400, 0, 7655, 7652, 1, 0, 0, 0, 7656, 7659, 1, 0, 0, 0, 7657, 7655, + 1, 0, 0, 0, 7657, 7658, 1, 0, 0, 0, 7658, 803, 1, 0, 0, 0, 7659, 7657, + 1, 0, 0, 0, 7660, 7661, 3, 802, 401, 0, 7661, 805, 1, 0, 0, 0, 7662, 7664, + 5, 33, 0, 0, 7663, 7665, 5, 262, 0, 0, 7664, 7663, 1, 0, 0, 0, 7664, 7665, + 1, 0, 0, 0, 7665, 7666, 1, 0, 0, 0, 7666, 7667, 5, 153, 0, 0, 7667, 807, + 1, 0, 0, 0, 7668, 7671, 5, 46, 0, 0, 7669, 7670, 5, 82, 0, 0, 7670, 7672, + 5, 304, 0, 0, 7671, 7669, 1, 0, 0, 0, 7671, 7672, 1, 0, 0, 0, 7672, 7674, + 1, 0, 0, 0, 7673, 7675, 3, 174, 87, 0, 7674, 7673, 1, 0, 0, 0, 7674, 7675, + 1, 0, 0, 0, 7675, 7693, 1, 0, 0, 0, 7676, 7677, 5, 369, 0, 0, 7677, 7679, + 3, 1348, 674, 0, 7678, 7680, 3, 218, 109, 0, 7679, 7678, 1, 0, 0, 0, 7679, + 7680, 1, 0, 0, 0, 7680, 7682, 1, 0, 0, 0, 7681, 7683, 3, 118, 59, 0, 7682, + 7681, 1, 0, 0, 0, 7682, 7683, 1, 0, 0, 0, 7683, 7694, 1, 0, 0, 0, 7684, + 7685, 5, 296, 0, 0, 7685, 7686, 5, 369, 0, 0, 7686, 7687, 3, 1348, 674, + 0, 7687, 7688, 5, 2, 0, 0, 7688, 7689, 3, 220, 110, 0, 7689, 7691, 5, 3, + 0, 0, 7690, 7692, 3, 118, 59, 0, 7691, 7690, 1, 0, 0, 0, 7691, 7692, 1, + 0, 0, 0, 7692, 7694, 1, 0, 0, 0, 7693, 7676, 1, 0, 0, 0, 7693, 7684, 1, + 0, 0, 0, 7694, 7695, 1, 0, 0, 0, 7695, 7696, 5, 36, 0, 0, 7696, 7698, 3, + 970, 485, 0, 7697, 7699, 3, 810, 405, 0, 7698, 7697, 1, 0, 0, 0, 7698, + 7699, 1, 0, 0, 0, 7699, 809, 1, 0, 0, 0, 7700, 7702, 5, 105, 0, 0, 7701, + 7703, 7, 37, 0, 0, 7702, 7701, 1, 0, 0, 0, 7702, 7703, 1, 0, 0, 0, 7703, + 7704, 1, 0, 0, 0, 7704, 7705, 5, 42, 0, 0, 7705, 7706, 5, 272, 0, 0, 7706, + 811, 1, 0, 0, 0, 7707, 7708, 5, 244, 0, 0, 7708, 7709, 3, 1356, 678, 0, + 7709, 813, 1, 0, 0, 0, 7710, 7711, 5, 46, 0, 0, 7711, 7712, 5, 175, 0, + 0, 7712, 7714, 3, 1352, 676, 0, 7713, 7715, 3, 16, 8, 0, 7714, 7713, 1, + 0, 0, 0, 7714, 7715, 1, 0, 0, 0, 7715, 7717, 1, 0, 0, 0, 7716, 7718, 3, + 816, 408, 0, 7717, 7716, 1, 0, 0, 0, 7717, 7718, 1, 0, 0, 0, 7718, 815, + 1, 0, 0, 0, 7719, 7720, 3, 818, 409, 0, 7720, 817, 1, 0, 0, 0, 7721, 7723, + 3, 820, 410, 0, 7722, 7721, 1, 0, 0, 0, 7723, 7724, 1, 0, 0, 0, 7724, 7722, + 1, 0, 0, 0, 7724, 7725, 1, 0, 0, 0, 7725, 819, 1, 0, 0, 0, 7726, 7728, + 3, 822, 411, 0, 7727, 7729, 3, 824, 412, 0, 7728, 7727, 1, 0, 0, 0, 7728, + 7729, 1, 0, 0, 0, 7729, 7733, 1, 0, 0, 0, 7730, 7734, 3, 1376, 688, 0, + 7731, 7734, 3, 66, 33, 0, 7732, 7734, 5, 53, 0, 0, 7733, 7730, 1, 0, 0, + 0, 7733, 7731, 1, 0, 0, 0, 7733, 7732, 1, 0, 0, 0, 7734, 821, 1, 0, 0, + 0, 7735, 7744, 3, 1394, 697, 0, 7736, 7737, 5, 164, 0, 0, 7737, 7744, 5, + 74, 0, 0, 7738, 7744, 5, 194, 0, 0, 7739, 7744, 5, 246, 0, 0, 7740, 7744, + 5, 275, 0, 0, 7741, 7744, 5, 344, 0, 0, 7742, 7744, 5, 346, 0, 0, 7743, + 7735, 1, 0, 0, 0, 7743, 7736, 1, 0, 0, 0, 7743, 7738, 1, 0, 0, 0, 7743, + 7739, 1, 0, 0, 0, 7743, 7740, 1, 0, 0, 0, 7743, 7741, 1, 0, 0, 0, 7743, + 7742, 1, 0, 0, 0, 7744, 823, 1, 0, 0, 0, 7745, 7746, 5, 10, 0, 0, 7746, + 825, 1, 0, 0, 0, 7747, 7748, 5, 138, 0, 0, 7748, 7749, 5, 175, 0, 0, 7749, + 7763, 3, 1352, 676, 0, 7750, 7752, 5, 105, 0, 0, 7751, 7753, 3, 816, 408, + 0, 7752, 7751, 1, 0, 0, 0, 7752, 7753, 1, 0, 0, 0, 7753, 7764, 1, 0, 0, + 0, 7754, 7756, 3, 816, 408, 0, 7755, 7754, 1, 0, 0, 0, 7755, 7756, 1, 0, + 0, 0, 7756, 7764, 1, 0, 0, 0, 7757, 7758, 5, 326, 0, 0, 7758, 7759, 5, + 344, 0, 0, 7759, 7764, 3, 1352, 676, 0, 7760, 7761, 5, 298, 0, 0, 7761, + 7762, 5, 108, 0, 0, 7762, 7764, 5, 368, 0, 0, 7763, 7750, 1, 0, 0, 0, 7763, + 7755, 1, 0, 0, 0, 7763, 7757, 1, 0, 0, 0, 7763, 7760, 1, 0, 0, 0, 7764, + 827, 1, 0, 0, 0, 7765, 7766, 5, 138, 0, 0, 7766, 7767, 5, 175, 0, 0, 7767, + 7768, 3, 1352, 676, 0, 7768, 7769, 3, 80, 40, 0, 7769, 829, 1, 0, 0, 0, + 7770, 7771, 5, 191, 0, 0, 7771, 7774, 5, 175, 0, 0, 7772, 7773, 5, 220, + 0, 0, 7773, 7775, 5, 390, 0, 0, 7774, 7772, 1, 0, 0, 0, 7774, 7775, 1, + 0, 0, 0, 7775, 7776, 1, 0, 0, 0, 7776, 7784, 3, 1352, 676, 0, 7777, 7779, + 3, 16, 8, 0, 7778, 7777, 1, 0, 0, 0, 7778, 7779, 1, 0, 0, 0, 7779, 7780, + 1, 0, 0, 0, 7780, 7781, 5, 2, 0, 0, 7781, 7782, 3, 832, 416, 0, 7782, 7783, + 5, 3, 0, 0, 7783, 7785, 1, 0, 0, 0, 7784, 7778, 1, 0, 0, 0, 7784, 7785, + 1, 0, 0, 0, 7785, 831, 1, 0, 0, 0, 7786, 7791, 3, 834, 417, 0, 7787, 7788, + 5, 6, 0, 0, 7788, 7790, 3, 834, 417, 0, 7789, 7787, 1, 0, 0, 0, 7790, 7793, + 1, 0, 0, 0, 7791, 7789, 1, 0, 0, 0, 7791, 7792, 1, 0, 0, 0, 7792, 833, + 1, 0, 0, 0, 7793, 7791, 1, 0, 0, 0, 7794, 7795, 5, 209, 0, 0, 7795, 835, + 1, 0, 0, 0, 7796, 7797, 5, 138, 0, 0, 7797, 7798, 5, 108, 0, 0, 7798, 7799, + 3, 528, 264, 0, 7799, 7800, 5, 298, 0, 0, 7800, 7801, 5, 368, 0, 0, 7801, + 837, 1, 0, 0, 0, 7802, 7803, 5, 138, 0, 0, 7803, 7804, 5, 342, 0, 0, 7804, + 7805, 7, 38, 0, 0, 7805, 7806, 3, 54, 27, 0, 7806, 839, 1, 0, 0, 0, 7807, + 7808, 5, 46, 0, 0, 7808, 7809, 5, 189, 0, 0, 7809, 7811, 3, 528, 264, 0, + 7810, 7812, 3, 844, 422, 0, 7811, 7810, 1, 0, 0, 0, 7811, 7812, 1, 0, 0, + 0, 7812, 7813, 1, 0, 0, 0, 7813, 7814, 3, 1128, 564, 0, 7814, 7815, 3, + 194, 97, 0, 7815, 841, 1, 0, 0, 0, 7816, 7817, 5, 138, 0, 0, 7817, 7818, + 5, 189, 0, 0, 7818, 7841, 3, 528, 264, 0, 7819, 7842, 3, 106, 53, 0, 7820, + 7821, 5, 191, 0, 0, 7821, 7822, 5, 77, 0, 0, 7822, 7842, 5, 78, 0, 0, 7823, + 7824, 5, 326, 0, 0, 7824, 7825, 5, 77, 0, 0, 7825, 7842, 5, 78, 0, 0, 7826, + 7827, 5, 133, 0, 0, 7827, 7842, 3, 212, 106, 0, 7828, 7829, 5, 191, 0, + 0, 7829, 7832, 5, 45, 0, 0, 7830, 7831, 5, 220, 0, 0, 7831, 7833, 5, 390, + 0, 0, 7832, 7830, 1, 0, 0, 0, 7832, 7833, 1, 0, 0, 0, 7833, 7834, 1, 0, + 0, 0, 7834, 7836, 3, 1352, 676, 0, 7835, 7837, 3, 108, 54, 0, 7836, 7835, + 1, 0, 0, 0, 7836, 7837, 1, 0, 0, 0, 7837, 7842, 1, 0, 0, 0, 7838, 7839, + 5, 365, 0, 0, 7839, 7840, 5, 45, 0, 0, 7840, 7842, 3, 1352, 676, 0, 7841, + 7819, 1, 0, 0, 0, 7841, 7820, 1, 0, 0, 0, 7841, 7823, 1, 0, 0, 0, 7841, + 7826, 1, 0, 0, 0, 7841, 7828, 1, 0, 0, 0, 7841, 7838, 1, 0, 0, 0, 7842, + 843, 1, 0, 0, 0, 7843, 7844, 5, 36, 0, 0, 7844, 845, 1, 0, 0, 0, 7845, + 7846, 5, 138, 0, 0, 7846, 7847, 5, 348, 0, 0, 7847, 7848, 5, 318, 0, 0, + 7848, 7849, 5, 185, 0, 0, 7849, 7850, 3, 528, 264, 0, 7850, 7851, 3, 464, + 232, 0, 7851, 847, 1, 0, 0, 0, 7852, 7853, 5, 138, 0, 0, 7853, 7854, 5, + 348, 0, 0, 7854, 7855, 5, 318, 0, 0, 7855, 7856, 5, 163, 0, 0, 7856, 7857, + 3, 528, 264, 0, 7857, 7858, 5, 133, 0, 0, 7858, 7859, 5, 248, 0, 0, 7859, + 7860, 5, 62, 0, 0, 7860, 7861, 3, 1350, 675, 0, 7861, 7862, 3, 850, 425, + 0, 7862, 7863, 3, 526, 263, 0, 7863, 7925, 1, 0, 0, 0, 7864, 7865, 5, 138, + 0, 0, 7865, 7866, 5, 348, 0, 0, 7866, 7867, 5, 318, 0, 0, 7867, 7868, 5, + 163, 0, 0, 7868, 7869, 3, 528, 264, 0, 7869, 7870, 5, 138, 0, 0, 7870, + 7871, 5, 248, 0, 0, 7871, 7872, 5, 62, 0, 0, 7872, 7873, 3, 1350, 675, + 0, 7873, 7874, 3, 850, 425, 0, 7874, 7875, 3, 526, 263, 0, 7875, 7925, + 1, 0, 0, 0, 7876, 7877, 5, 138, 0, 0, 7877, 7878, 5, 348, 0, 0, 7878, 7879, + 5, 318, 0, 0, 7879, 7880, 5, 163, 0, 0, 7880, 7881, 3, 528, 264, 0, 7881, + 7882, 5, 138, 0, 0, 7882, 7883, 5, 248, 0, 0, 7883, 7884, 5, 304, 0, 0, + 7884, 7885, 3, 528, 264, 0, 7885, 7886, 3, 850, 425, 0, 7886, 7887, 3, + 528, 264, 0, 7887, 7925, 1, 0, 0, 0, 7888, 7889, 5, 138, 0, 0, 7889, 7890, + 5, 348, 0, 0, 7890, 7891, 5, 318, 0, 0, 7891, 7892, 5, 163, 0, 0, 7892, + 7893, 3, 528, 264, 0, 7893, 7894, 5, 138, 0, 0, 7894, 7895, 5, 248, 0, + 0, 7895, 7896, 5, 62, 0, 0, 7896, 7897, 3, 1350, 675, 0, 7897, 7898, 5, + 304, 0, 0, 7898, 7899, 3, 528, 264, 0, 7899, 7900, 3, 850, 425, 0, 7900, + 7901, 3, 528, 264, 0, 7901, 7925, 1, 0, 0, 0, 7902, 7903, 5, 138, 0, 0, + 7903, 7904, 5, 348, 0, 0, 7904, 7905, 5, 318, 0, 0, 7905, 7906, 5, 163, + 0, 0, 7906, 7907, 3, 528, 264, 0, 7907, 7908, 5, 191, 0, 0, 7908, 7909, + 5, 248, 0, 0, 7909, 7910, 5, 62, 0, 0, 7910, 7911, 3, 1350, 675, 0, 7911, + 7925, 1, 0, 0, 0, 7912, 7913, 5, 138, 0, 0, 7913, 7914, 5, 348, 0, 0, 7914, + 7915, 5, 318, 0, 0, 7915, 7916, 5, 163, 0, 0, 7916, 7917, 3, 528, 264, + 0, 7917, 7918, 5, 191, 0, 0, 7918, 7919, 5, 248, 0, 0, 7919, 7920, 5, 220, + 0, 0, 7920, 7921, 5, 390, 0, 0, 7921, 7922, 5, 62, 0, 0, 7922, 7923, 3, + 1350, 675, 0, 7923, 7925, 1, 0, 0, 0, 7924, 7852, 1, 0, 0, 0, 7924, 7864, + 1, 0, 0, 0, 7924, 7876, 1, 0, 0, 0, 7924, 7888, 1, 0, 0, 0, 7924, 7902, + 1, 0, 0, 0, 7924, 7912, 1, 0, 0, 0, 7925, 849, 1, 0, 0, 0, 7926, 7927, + 5, 105, 0, 0, 7927, 851, 1, 0, 0, 0, 7928, 7930, 5, 46, 0, 0, 7929, 7931, + 3, 492, 246, 0, 7930, 7929, 1, 0, 0, 0, 7930, 7931, 1, 0, 0, 0, 7931, 7932, + 1, 0, 0, 0, 7932, 7933, 5, 168, 0, 0, 7933, 7934, 3, 528, 264, 0, 7934, + 7935, 5, 62, 0, 0, 7935, 7936, 3, 1370, 685, 0, 7936, 7937, 5, 94, 0, 0, + 7937, 7938, 3, 1370, 685, 0, 7938, 7939, 5, 64, 0, 0, 7939, 7940, 3, 528, + 264, 0, 7940, 853, 1, 0, 0, 0, 7941, 7943, 5, 158, 0, 0, 7942, 7944, 3, + 874, 437, 0, 7943, 7942, 1, 0, 0, 0, 7943, 7944, 1, 0, 0, 0, 7944, 7945, + 1, 0, 0, 0, 7945, 7947, 3, 1348, 674, 0, 7946, 7948, 3, 856, 428, 0, 7947, + 7946, 1, 0, 0, 0, 7947, 7948, 1, 0, 0, 0, 7948, 7962, 1, 0, 0, 0, 7949, + 7951, 5, 158, 0, 0, 7950, 7952, 3, 874, 437, 0, 7951, 7950, 1, 0, 0, 0, + 7951, 7952, 1, 0, 0, 0, 7952, 7962, 1, 0, 0, 0, 7953, 7955, 5, 158, 0, + 0, 7954, 7956, 3, 874, 437, 0, 7955, 7954, 1, 0, 0, 0, 7955, 7956, 1, 0, + 0, 0, 7956, 7957, 1, 0, 0, 0, 7957, 7958, 3, 1352, 676, 0, 7958, 7959, + 5, 80, 0, 0, 7959, 7960, 3, 1348, 674, 0, 7960, 7962, 1, 0, 0, 0, 7961, + 7941, 1, 0, 0, 0, 7961, 7949, 1, 0, 0, 0, 7961, 7953, 1, 0, 0, 0, 7962, + 855, 1, 0, 0, 0, 7963, 7964, 5, 100, 0, 0, 7964, 7965, 3, 1352, 676, 0, + 7965, 857, 1, 0, 0, 0, 7966, 7968, 5, 363, 0, 0, 7967, 7969, 3, 876, 438, + 0, 7968, 7967, 1, 0, 0, 0, 7968, 7969, 1, 0, 0, 0, 7969, 7971, 1, 0, 0, + 0, 7970, 7972, 3, 878, 439, 0, 7971, 7970, 1, 0, 0, 0, 7971, 7972, 1, 0, + 0, 0, 7972, 7974, 1, 0, 0, 0, 7973, 7975, 3, 874, 437, 0, 7974, 7973, 1, + 0, 0, 0, 7974, 7975, 1, 0, 0, 0, 7975, 7977, 1, 0, 0, 0, 7976, 7978, 3, + 872, 436, 0, 7977, 7976, 1, 0, 0, 0, 7977, 7978, 1, 0, 0, 0, 7978, 7980, + 1, 0, 0, 0, 7979, 7981, 3, 886, 443, 0, 7980, 7979, 1, 0, 0, 0, 7980, 7981, + 1, 0, 0, 0, 7981, 7990, 1, 0, 0, 0, 7982, 7983, 5, 363, 0, 0, 7983, 7984, + 5, 2, 0, 0, 7984, 7985, 3, 862, 431, 0, 7985, 7987, 5, 3, 0, 0, 7986, 7988, + 3, 886, 443, 0, 7987, 7986, 1, 0, 0, 0, 7987, 7988, 1, 0, 0, 0, 7988, 7990, + 1, 0, 0, 0, 7989, 7966, 1, 0, 0, 0, 7989, 7982, 1, 0, 0, 0, 7990, 859, + 1, 0, 0, 0, 7991, 7993, 3, 864, 432, 0, 7992, 7994, 3, 874, 437, 0, 7993, + 7992, 1, 0, 0, 0, 7993, 7994, 1, 0, 0, 0, 7994, 7996, 1, 0, 0, 0, 7995, + 7997, 3, 886, 443, 0, 7996, 7995, 1, 0, 0, 0, 7996, 7997, 1, 0, 0, 0, 7997, + 8006, 1, 0, 0, 0, 7998, 7999, 3, 864, 432, 0, 7999, 8000, 5, 2, 0, 0, 8000, + 8001, 3, 862, 431, 0, 8001, 8003, 5, 3, 0, 0, 8002, 8004, 3, 886, 443, + 0, 8003, 8002, 1, 0, 0, 0, 8003, 8004, 1, 0, 0, 0, 8004, 8006, 1, 0, 0, + 0, 8005, 7991, 1, 0, 0, 0, 8005, 7998, 1, 0, 0, 0, 8006, 861, 1, 0, 0, + 0, 8007, 8012, 3, 866, 433, 0, 8008, 8009, 5, 6, 0, 0, 8009, 8011, 3, 866, + 433, 0, 8010, 8008, 1, 0, 0, 0, 8011, 8014, 1, 0, 0, 0, 8012, 8010, 1, + 0, 0, 0, 8012, 8013, 1, 0, 0, 0, 8013, 863, 1, 0, 0, 0, 8014, 8012, 1, + 0, 0, 0, 8015, 8016, 7, 39, 0, 0, 8016, 865, 1, 0, 0, 0, 8017, 8019, 3, + 868, 434, 0, 8018, 8020, 3, 870, 435, 0, 8019, 8018, 1, 0, 0, 0, 8019, + 8020, 1, 0, 0, 0, 8020, 867, 1, 0, 0, 0, 8021, 8024, 3, 1390, 695, 0, 8022, + 8024, 3, 864, 432, 0, 8023, 8021, 1, 0, 0, 0, 8023, 8022, 1, 0, 0, 0, 8024, + 869, 1, 0, 0, 0, 8025, 8028, 3, 66, 33, 0, 8026, 8028, 3, 296, 148, 0, + 8027, 8025, 1, 0, 0, 0, 8027, 8026, 1, 0, 0, 0, 8028, 871, 1, 0, 0, 0, + 8029, 8030, 3, 864, 432, 0, 8030, 873, 1, 0, 0, 0, 8031, 8032, 5, 128, + 0, 0, 8032, 875, 1, 0, 0, 0, 8033, 8034, 5, 113, 0, 0, 8034, 877, 1, 0, + 0, 0, 8035, 8036, 5, 112, 0, 0, 8036, 879, 1, 0, 0, 0, 8037, 8038, 5, 2, + 0, 0, 8038, 8039, 3, 1350, 675, 0, 8039, 8040, 5, 3, 0, 0, 8040, 881, 1, + 0, 0, 0, 8041, 8043, 3, 1348, 674, 0, 8042, 8044, 3, 880, 440, 0, 8043, + 8042, 1, 0, 0, 0, 8043, 8044, 1, 0, 0, 0, 8044, 883, 1, 0, 0, 0, 8045, + 8050, 3, 882, 441, 0, 8046, 8047, 5, 6, 0, 0, 8047, 8049, 3, 882, 441, + 0, 8048, 8046, 1, 0, 0, 0, 8049, 8052, 1, 0, 0, 0, 8050, 8048, 1, 0, 0, + 0, 8050, 8051, 1, 0, 0, 0, 8051, 885, 1, 0, 0, 0, 8052, 8050, 1, 0, 0, + 0, 8053, 8054, 3, 884, 442, 0, 8054, 887, 1, 0, 0, 0, 8055, 8056, 5, 203, + 0, 0, 8056, 8074, 3, 890, 445, 0, 8057, 8058, 5, 203, 0, 0, 8058, 8060, + 3, 864, 432, 0, 8059, 8061, 3, 874, 437, 0, 8060, 8059, 1, 0, 0, 0, 8060, + 8061, 1, 0, 0, 0, 8061, 8062, 1, 0, 0, 0, 8062, 8063, 3, 890, 445, 0, 8063, + 8074, 1, 0, 0, 0, 8064, 8065, 5, 203, 0, 0, 8065, 8066, 5, 128, 0, 0, 8066, + 8074, 3, 890, 445, 0, 8067, 8068, 5, 203, 0, 0, 8068, 8069, 5, 2, 0, 0, + 8069, 8070, 3, 892, 446, 0, 8070, 8071, 5, 3, 0, 0, 8071, 8072, 3, 890, + 445, 0, 8072, 8074, 1, 0, 0, 0, 8073, 8055, 1, 0, 0, 0, 8073, 8057, 1, + 0, 0, 0, 8073, 8064, 1, 0, 0, 0, 8073, 8067, 1, 0, 0, 0, 8074, 889, 1, + 0, 0, 0, 8075, 8085, 3, 970, 485, 0, 8076, 8085, 3, 912, 456, 0, 8077, + 8085, 3, 952, 476, 0, 8078, 8085, 3, 938, 469, 0, 8079, 8085, 3, 962, 481, + 0, 8080, 8085, 3, 268, 134, 0, 8081, 8085, 3, 274, 137, 0, 8082, 8085, + 3, 280, 140, 0, 8083, 8085, 3, 906, 453, 0, 8084, 8075, 1, 0, 0, 0, 8084, + 8076, 1, 0, 0, 0, 8084, 8077, 1, 0, 0, 0, 8084, 8078, 1, 0, 0, 0, 8084, + 8079, 1, 0, 0, 0, 8084, 8080, 1, 0, 0, 0, 8084, 8081, 1, 0, 0, 0, 8084, + 8082, 1, 0, 0, 0, 8084, 8083, 1, 0, 0, 0, 8085, 891, 1, 0, 0, 0, 8086, + 8091, 3, 894, 447, 0, 8087, 8088, 5, 6, 0, 0, 8088, 8090, 3, 894, 447, + 0, 8089, 8087, 1, 0, 0, 0, 8090, 8093, 1, 0, 0, 0, 8091, 8089, 1, 0, 0, + 0, 8091, 8092, 1, 0, 0, 0, 8092, 893, 1, 0, 0, 0, 8093, 8091, 1, 0, 0, + 0, 8094, 8096, 3, 896, 448, 0, 8095, 8097, 3, 898, 449, 0, 8096, 8095, + 1, 0, 0, 0, 8096, 8097, 1, 0, 0, 0, 8097, 895, 1, 0, 0, 0, 8098, 8101, + 3, 1390, 695, 0, 8099, 8101, 3, 864, 432, 0, 8100, 8098, 1, 0, 0, 0, 8100, + 8099, 1, 0, 0, 0, 8101, 897, 1, 0, 0, 0, 8102, 8105, 3, 66, 33, 0, 8103, + 8105, 3, 296, 148, 0, 8104, 8102, 1, 0, 0, 0, 8104, 8103, 1, 0, 0, 0, 8105, + 899, 1, 0, 0, 0, 8106, 8107, 5, 283, 0, 0, 8107, 8109, 3, 1352, 676, 0, + 8108, 8110, 3, 902, 451, 0, 8109, 8108, 1, 0, 0, 0, 8109, 8110, 1, 0, 0, + 0, 8110, 8111, 1, 0, 0, 0, 8111, 8112, 5, 36, 0, 0, 8112, 8113, 3, 904, + 452, 0, 8113, 901, 1, 0, 0, 0, 8114, 8115, 5, 2, 0, 0, 8115, 8116, 3, 1296, + 648, 0, 8116, 8117, 5, 3, 0, 0, 8117, 903, 1, 0, 0, 0, 8118, 8124, 3, 970, + 485, 0, 8119, 8124, 3, 912, 456, 0, 8120, 8124, 3, 952, 476, 0, 8121, 8124, + 3, 938, 469, 0, 8122, 8124, 3, 930, 465, 0, 8123, 8118, 1, 0, 0, 0, 8123, + 8119, 1, 0, 0, 0, 8123, 8120, 1, 0, 0, 0, 8123, 8121, 1, 0, 0, 0, 8123, + 8122, 1, 0, 0, 0, 8124, 905, 1, 0, 0, 0, 8125, 8126, 5, 202, 0, 0, 8126, + 8128, 3, 1352, 676, 0, 8127, 8129, 3, 908, 454, 0, 8128, 8127, 1, 0, 0, + 0, 8128, 8129, 1, 0, 0, 0, 8129, 8164, 1, 0, 0, 0, 8130, 8132, 5, 46, 0, + 0, 8131, 8133, 3, 174, 87, 0, 8132, 8131, 1, 0, 0, 0, 8132, 8133, 1, 0, + 0, 0, 8133, 8134, 1, 0, 0, 0, 8134, 8135, 5, 92, 0, 0, 8135, 8136, 3, 270, + 135, 0, 8136, 8137, 5, 36, 0, 0, 8137, 8138, 5, 202, 0, 0, 8138, 8140, + 3, 1352, 676, 0, 8139, 8141, 3, 908, 454, 0, 8140, 8139, 1, 0, 0, 0, 8140, + 8141, 1, 0, 0, 0, 8141, 8143, 1, 0, 0, 0, 8142, 8144, 3, 272, 136, 0, 8143, + 8142, 1, 0, 0, 0, 8143, 8144, 1, 0, 0, 0, 8144, 8164, 1, 0, 0, 0, 8145, + 8147, 5, 46, 0, 0, 8146, 8148, 3, 174, 87, 0, 8147, 8146, 1, 0, 0, 0, 8147, + 8148, 1, 0, 0, 0, 8148, 8149, 1, 0, 0, 0, 8149, 8150, 5, 92, 0, 0, 8150, + 8151, 5, 220, 0, 0, 8151, 8152, 5, 77, 0, 0, 8152, 8153, 5, 390, 0, 0, + 8153, 8154, 3, 270, 135, 0, 8154, 8155, 5, 36, 0, 0, 8155, 8156, 5, 202, + 0, 0, 8156, 8158, 3, 1352, 676, 0, 8157, 8159, 3, 908, 454, 0, 8158, 8157, + 1, 0, 0, 0, 8158, 8159, 1, 0, 0, 0, 8159, 8161, 1, 0, 0, 0, 8160, 8162, + 3, 272, 136, 0, 8161, 8160, 1, 0, 0, 0, 8161, 8162, 1, 0, 0, 0, 8162, 8164, + 1, 0, 0, 0, 8163, 8125, 1, 0, 0, 0, 8163, 8130, 1, 0, 0, 0, 8163, 8145, + 1, 0, 0, 0, 8164, 907, 1, 0, 0, 0, 8165, 8166, 5, 2, 0, 0, 8166, 8167, + 3, 1290, 645, 0, 8167, 8168, 5, 3, 0, 0, 8168, 909, 1, 0, 0, 0, 8169, 8170, + 5, 177, 0, 0, 8170, 8180, 3, 1352, 676, 0, 8171, 8172, 5, 177, 0, 0, 8172, + 8173, 5, 283, 0, 0, 8173, 8180, 3, 1352, 676, 0, 8174, 8175, 5, 177, 0, + 0, 8175, 8180, 5, 30, 0, 0, 8176, 8177, 5, 177, 0, 0, 8177, 8178, 5, 283, + 0, 0, 8178, 8180, 5, 30, 0, 0, 8179, 8169, 1, 0, 0, 0, 8179, 8171, 1, 0, + 0, 0, 8179, 8174, 1, 0, 0, 0, 8179, 8176, 1, 0, 0, 0, 8180, 911, 1, 0, + 0, 0, 8181, 8183, 3, 990, 495, 0, 8182, 8181, 1, 0, 0, 0, 8182, 8183, 1, + 0, 0, 0, 8183, 8184, 1, 0, 0, 0, 8184, 8185, 5, 232, 0, 0, 8185, 8186, + 5, 71, 0, 0, 8186, 8187, 3, 914, 457, 0, 8187, 8189, 3, 916, 458, 0, 8188, + 8190, 3, 924, 462, 0, 8189, 8188, 1, 0, 0, 0, 8189, 8190, 1, 0, 0, 0, 8190, + 8192, 1, 0, 0, 0, 8191, 8193, 3, 928, 464, 0, 8192, 8191, 1, 0, 0, 0, 8192, + 8193, 1, 0, 0, 0, 8193, 913, 1, 0, 0, 0, 8194, 8197, 3, 1348, 674, 0, 8195, + 8196, 5, 36, 0, 0, 8196, 8198, 3, 1384, 692, 0, 8197, 8195, 1, 0, 0, 0, + 8197, 8198, 1, 0, 0, 0, 8198, 915, 1, 0, 0, 0, 8199, 8219, 3, 970, 485, + 0, 8200, 8201, 5, 465, 0, 0, 8201, 8202, 3, 918, 459, 0, 8202, 8203, 5, + 452, 0, 0, 8203, 8204, 3, 970, 485, 0, 8204, 8219, 1, 0, 0, 0, 8205, 8206, + 5, 2, 0, 0, 8206, 8207, 3, 920, 460, 0, 8207, 8212, 5, 3, 0, 0, 8208, 8209, + 5, 465, 0, 0, 8209, 8210, 3, 918, 459, 0, 8210, 8211, 5, 452, 0, 0, 8211, + 8213, 1, 0, 0, 0, 8212, 8208, 1, 0, 0, 0, 8212, 8213, 1, 0, 0, 0, 8213, + 8214, 1, 0, 0, 0, 8214, 8215, 3, 970, 485, 0, 8215, 8219, 1, 0, 0, 0, 8216, + 8217, 5, 53, 0, 0, 8217, 8219, 5, 417, 0, 0, 8218, 8199, 1, 0, 0, 0, 8218, + 8200, 1, 0, 0, 0, 8218, 8205, 1, 0, 0, 0, 8218, 8216, 1, 0, 0, 0, 8219, + 917, 1, 0, 0, 0, 8220, 8221, 7, 40, 0, 0, 8221, 919, 1, 0, 0, 0, 8222, + 8227, 3, 922, 461, 0, 8223, 8224, 5, 6, 0, 0, 8224, 8226, 3, 922, 461, + 0, 8225, 8223, 1, 0, 0, 0, 8226, 8229, 1, 0, 0, 0, 8227, 8225, 1, 0, 0, + 0, 8227, 8228, 1, 0, 0, 0, 8228, 921, 1, 0, 0, 0, 8229, 8227, 1, 0, 0, + 0, 8230, 8231, 3, 1384, 692, 0, 8231, 8232, 3, 1336, 668, 0, 8232, 923, + 1, 0, 0, 0, 8233, 8234, 5, 80, 0, 0, 8234, 8236, 5, 466, 0, 0, 8235, 8237, + 3, 926, 463, 0, 8236, 8235, 1, 0, 0, 0, 8236, 8237, 1, 0, 0, 0, 8237, 8238, + 1, 0, 0, 0, 8238, 8246, 5, 57, 0, 0, 8239, 8240, 5, 362, 0, 0, 8240, 8241, + 5, 326, 0, 0, 8241, 8243, 3, 954, 477, 0, 8242, 8244, 3, 1104, 552, 0, + 8243, 8242, 1, 0, 0, 0, 8243, 8244, 1, 0, 0, 0, 8244, 8247, 1, 0, 0, 0, + 8245, 8247, 5, 263, 0, 0, 8246, 8239, 1, 0, 0, 0, 8246, 8245, 1, 0, 0, + 0, 8247, 925, 1, 0, 0, 0, 8248, 8249, 5, 2, 0, 0, 8249, 8250, 3, 606, 303, + 0, 8250, 8252, 5, 3, 0, 0, 8251, 8253, 3, 1104, 552, 0, 8252, 8251, 1, + 0, 0, 0, 8252, 8253, 1, 0, 0, 0, 8253, 8258, 1, 0, 0, 0, 8254, 8255, 5, + 80, 0, 0, 8255, 8256, 5, 45, 0, 0, 8256, 8258, 3, 1352, 676, 0, 8257, 8248, + 1, 0, 0, 0, 8257, 8254, 1, 0, 0, 0, 8258, 927, 1, 0, 0, 0, 8259, 8260, + 5, 87, 0, 0, 8260, 8261, 3, 1340, 670, 0, 8261, 929, 1, 0, 0, 0, 8262, + 8264, 3, 982, 491, 0, 8263, 8262, 1, 0, 0, 0, 8263, 8264, 1, 0, 0, 0, 8264, + 8265, 1, 0, 0, 0, 8265, 8266, 5, 253, 0, 0, 8266, 8268, 5, 71, 0, 0, 8267, + 8269, 5, 81, 0, 0, 8268, 8267, 1, 0, 0, 0, 8268, 8269, 1, 0, 0, 0, 8269, + 8270, 1, 0, 0, 0, 8270, 8272, 3, 1348, 674, 0, 8271, 8273, 3, 1072, 536, + 0, 8272, 8271, 1, 0, 0, 0, 8272, 8273, 1, 0, 0, 0, 8273, 8274, 1, 0, 0, + 0, 8274, 8277, 5, 100, 0, 0, 8275, 8278, 3, 972, 486, 0, 8276, 8278, 3, + 1348, 674, 0, 8277, 8275, 1, 0, 0, 0, 8277, 8276, 1, 0, 0, 0, 8278, 8280, + 1, 0, 0, 0, 8279, 8281, 3, 1072, 536, 0, 8280, 8279, 1, 0, 0, 0, 8280, + 8281, 1, 0, 0, 0, 8281, 8282, 1, 0, 0, 0, 8282, 8283, 5, 80, 0, 0, 8283, + 8292, 3, 1172, 586, 0, 8284, 8286, 3, 932, 466, 0, 8285, 8287, 3, 934, + 467, 0, 8286, 8285, 1, 0, 0, 0, 8286, 8287, 1, 0, 0, 0, 8287, 8293, 1, + 0, 0, 0, 8288, 8290, 3, 934, 467, 0, 8289, 8291, 3, 932, 466, 0, 8290, + 8289, 1, 0, 0, 0, 8290, 8291, 1, 0, 0, 0, 8291, 8293, 1, 0, 0, 0, 8292, + 8284, 1, 0, 0, 0, 8292, 8288, 1, 0, 0, 0, 8293, 8295, 1, 0, 0, 0, 8294, + 8296, 3, 936, 468, 0, 8295, 8294, 1, 0, 0, 0, 8295, 8296, 1, 0, 0, 0, 8296, + 931, 1, 0, 0, 0, 8297, 8298, 5, 102, 0, 0, 8298, 8299, 5, 77, 0, 0, 8299, + 8302, 5, 250, 0, 0, 8300, 8301, 5, 33, 0, 0, 8301, 8303, 3, 1172, 586, + 0, 8302, 8300, 1, 0, 0, 0, 8302, 8303, 1, 0, 0, 0, 8303, 8305, 1, 0, 0, + 0, 8304, 8306, 5, 93, 0, 0, 8305, 8304, 1, 0, 0, 0, 8305, 8306, 1, 0, 0, + 0, 8306, 8307, 1, 0, 0, 0, 8307, 8312, 5, 232, 0, 0, 8308, 8309, 5, 2, + 0, 0, 8309, 8310, 3, 920, 460, 0, 8310, 8311, 5, 3, 0, 0, 8311, 8313, 1, + 0, 0, 0, 8312, 8308, 1, 0, 0, 0, 8312, 8313, 1, 0, 0, 0, 8313, 8314, 1, + 0, 0, 0, 8314, 8315, 3, 1062, 531, 0, 8315, 933, 1, 0, 0, 0, 8316, 8317, + 5, 102, 0, 0, 8317, 8320, 5, 250, 0, 0, 8318, 8319, 5, 33, 0, 0, 8319, + 8321, 3, 1172, 586, 0, 8320, 8318, 1, 0, 0, 0, 8320, 8321, 1, 0, 0, 0, + 8321, 8323, 1, 0, 0, 0, 8322, 8324, 5, 93, 0, 0, 8323, 8322, 1, 0, 0, 0, + 8323, 8324, 1, 0, 0, 0, 8324, 8325, 1, 0, 0, 0, 8325, 8326, 5, 362, 0, + 0, 8326, 8327, 5, 326, 0, 0, 8327, 8328, 3, 954, 477, 0, 8328, 935, 1, + 0, 0, 0, 8329, 8330, 5, 102, 0, 0, 8330, 8332, 5, 250, 0, 0, 8331, 8333, + 5, 93, 0, 0, 8332, 8331, 1, 0, 0, 0, 8332, 8333, 1, 0, 0, 0, 8333, 8334, + 1, 0, 0, 0, 8334, 8335, 5, 182, 0, 0, 8335, 937, 1, 0, 0, 0, 8336, 8338, + 3, 990, 495, 0, 8337, 8336, 1, 0, 0, 0, 8337, 8338, 1, 0, 0, 0, 8338, 8339, + 1, 0, 0, 0, 8339, 8340, 5, 182, 0, 0, 8340, 8341, 5, 64, 0, 0, 8341, 8343, + 3, 1088, 544, 0, 8342, 8344, 3, 940, 470, 0, 8343, 8342, 1, 0, 0, 0, 8343, + 8344, 1, 0, 0, 0, 8344, 8346, 1, 0, 0, 0, 8345, 8347, 3, 1106, 553, 0, + 8346, 8345, 1, 0, 0, 0, 8346, 8347, 1, 0, 0, 0, 8347, 8349, 1, 0, 0, 0, + 8348, 8350, 3, 928, 464, 0, 8349, 8348, 1, 0, 0, 0, 8349, 8350, 1, 0, 0, + 0, 8350, 939, 1, 0, 0, 0, 8351, 8352, 5, 100, 0, 0, 8352, 8353, 3, 1066, + 533, 0, 8353, 941, 1, 0, 0, 0, 8354, 8356, 5, 247, 0, 0, 8355, 8357, 3, + 998, 499, 0, 8356, 8355, 1, 0, 0, 0, 8356, 8357, 1, 0, 0, 0, 8357, 8358, + 1, 0, 0, 0, 8358, 8360, 3, 1086, 543, 0, 8359, 8361, 3, 944, 472, 0, 8360, + 8359, 1, 0, 0, 0, 8360, 8361, 1, 0, 0, 0, 8361, 8363, 1, 0, 0, 0, 8362, + 8364, 3, 948, 474, 0, 8363, 8362, 1, 0, 0, 0, 8363, 8364, 1, 0, 0, 0, 8364, + 943, 1, 0, 0, 0, 8365, 8366, 5, 68, 0, 0, 8366, 8367, 3, 946, 473, 0, 8367, + 8368, 5, 256, 0, 0, 8368, 945, 1, 0, 0, 0, 8369, 8370, 5, 131, 0, 0, 8370, + 8382, 7, 41, 0, 0, 8371, 8372, 5, 409, 0, 0, 8372, 8382, 7, 41, 0, 0, 8373, + 8378, 5, 327, 0, 0, 8374, 8375, 5, 362, 0, 0, 8375, 8379, 5, 201, 0, 0, + 8376, 8377, 5, 409, 0, 0, 8377, 8379, 5, 201, 0, 0, 8378, 8374, 1, 0, 0, + 0, 8378, 8376, 1, 0, 0, 0, 8378, 8379, 1, 0, 0, 0, 8379, 8382, 1, 0, 0, + 0, 8380, 8382, 5, 201, 0, 0, 8381, 8369, 1, 0, 0, 0, 8381, 8371, 1, 0, + 0, 0, 8381, 8373, 1, 0, 0, 0, 8381, 8380, 1, 0, 0, 0, 8382, 947, 1, 0, + 0, 0, 8383, 8384, 5, 265, 0, 0, 8384, 949, 1, 0, 0, 0, 8385, 8389, 5, 265, + 0, 0, 8386, 8387, 5, 467, 0, 0, 8387, 8389, 5, 468, 0, 0, 8388, 8385, 1, + 0, 0, 0, 8388, 8386, 1, 0, 0, 0, 8389, 951, 1, 0, 0, 0, 8390, 8392, 3, + 990, 495, 0, 8391, 8390, 1, 0, 0, 0, 8391, 8392, 1, 0, 0, 0, 8392, 8393, + 1, 0, 0, 0, 8393, 8394, 5, 362, 0, 0, 8394, 8395, 3, 1088, 544, 0, 8395, + 8396, 5, 326, 0, 0, 8396, 8398, 3, 954, 477, 0, 8397, 8399, 3, 1064, 532, + 0, 8398, 8397, 1, 0, 0, 0, 8398, 8399, 1, 0, 0, 0, 8399, 8401, 1, 0, 0, + 0, 8400, 8402, 3, 1106, 553, 0, 8401, 8400, 1, 0, 0, 0, 8401, 8402, 1, + 0, 0, 0, 8402, 8404, 1, 0, 0, 0, 8403, 8405, 3, 928, 464, 0, 8404, 8403, + 1, 0, 0, 0, 8404, 8405, 1, 0, 0, 0, 8405, 953, 1, 0, 0, 0, 8406, 8411, + 3, 956, 478, 0, 8407, 8408, 5, 6, 0, 0, 8408, 8410, 3, 956, 478, 0, 8409, + 8407, 1, 0, 0, 0, 8410, 8413, 1, 0, 0, 0, 8411, 8409, 1, 0, 0, 0, 8411, + 8412, 1, 0, 0, 0, 8412, 955, 1, 0, 0, 0, 8413, 8411, 1, 0, 0, 0, 8414, + 8415, 3, 958, 479, 0, 8415, 8416, 5, 10, 0, 0, 8416, 8417, 3, 1172, 586, + 0, 8417, 8425, 1, 0, 0, 0, 8418, 8419, 5, 2, 0, 0, 8419, 8420, 3, 960, + 480, 0, 8420, 8421, 5, 3, 0, 0, 8421, 8422, 5, 10, 0, 0, 8422, 8423, 3, + 1172, 586, 0, 8423, 8425, 1, 0, 0, 0, 8424, 8414, 1, 0, 0, 0, 8424, 8418, + 1, 0, 0, 0, 8425, 957, 1, 0, 0, 0, 8426, 8427, 3, 1384, 692, 0, 8427, 8428, + 3, 1336, 668, 0, 8428, 959, 1, 0, 0, 0, 8429, 8434, 3, 958, 479, 0, 8430, + 8431, 5, 6, 0, 0, 8431, 8433, 3, 958, 479, 0, 8432, 8430, 1, 0, 0, 0, 8433, + 8436, 1, 0, 0, 0, 8434, 8432, 1, 0, 0, 0, 8434, 8435, 1, 0, 0, 0, 8435, + 961, 1, 0, 0, 0, 8436, 8434, 1, 0, 0, 0, 8437, 8438, 5, 178, 0, 0, 8438, + 8439, 3, 964, 482, 0, 8439, 8440, 3, 966, 483, 0, 8440, 8442, 5, 172, 0, + 0, 8441, 8443, 3, 968, 484, 0, 8442, 8441, 1, 0, 0, 0, 8442, 8443, 1, 0, + 0, 0, 8443, 8444, 1, 0, 0, 0, 8444, 8445, 5, 62, 0, 0, 8445, 8446, 3, 970, + 485, 0, 8446, 963, 1, 0, 0, 0, 8447, 8448, 3, 1352, 676, 0, 8448, 965, + 1, 0, 0, 0, 8449, 8450, 5, 262, 0, 0, 8450, 8455, 5, 317, 0, 0, 8451, 8455, + 5, 317, 0, 0, 8452, 8455, 5, 107, 0, 0, 8453, 8455, 5, 231, 0, 0, 8454, + 8449, 1, 0, 0, 0, 8454, 8451, 1, 0, 0, 0, 8454, 8452, 1, 0, 0, 0, 8454, + 8453, 1, 0, 0, 0, 8455, 8458, 1, 0, 0, 0, 8456, 8454, 1, 0, 0, 0, 8456, + 8457, 1, 0, 0, 0, 8457, 967, 1, 0, 0, 0, 8458, 8456, 1, 0, 0, 0, 8459, + 8460, 5, 105, 0, 0, 8460, 8464, 5, 217, 0, 0, 8461, 8462, 5, 372, 0, 0, + 8462, 8464, 5, 217, 0, 0, 8463, 8459, 1, 0, 0, 0, 8463, 8461, 1, 0, 0, + 0, 8464, 969, 1, 0, 0, 0, 8465, 8468, 3, 974, 487, 0, 8466, 8468, 3, 972, + 486, 0, 8467, 8465, 1, 0, 0, 0, 8467, 8466, 1, 0, 0, 0, 8468, 971, 1, 0, + 0, 0, 8469, 8470, 5, 2, 0, 0, 8470, 8471, 3, 974, 487, 0, 8471, 8472, 5, + 3, 0, 0, 8472, 8478, 1, 0, 0, 0, 8473, 8474, 5, 2, 0, 0, 8474, 8475, 3, + 972, 486, 0, 8475, 8476, 5, 3, 0, 0, 8476, 8478, 1, 0, 0, 0, 8477, 8469, + 1, 0, 0, 0, 8477, 8473, 1, 0, 0, 0, 8478, 973, 1, 0, 0, 0, 8479, 8481, + 3, 976, 488, 0, 8480, 8482, 3, 1006, 503, 0, 8481, 8480, 1, 0, 0, 0, 8481, + 8482, 1, 0, 0, 0, 8482, 8491, 1, 0, 0, 0, 8483, 8485, 3, 1050, 525, 0, + 8484, 8486, 3, 1016, 508, 0, 8485, 8484, 1, 0, 0, 0, 8485, 8486, 1, 0, + 0, 0, 8486, 8492, 1, 0, 0, 0, 8487, 8489, 3, 1014, 507, 0, 8488, 8490, + 3, 1052, 526, 0, 8489, 8488, 1, 0, 0, 0, 8489, 8490, 1, 0, 0, 0, 8490, + 8492, 1, 0, 0, 0, 8491, 8483, 1, 0, 0, 0, 8491, 8487, 1, 0, 0, 0, 8491, + 8492, 1, 0, 0, 0, 8492, 8509, 1, 0, 0, 0, 8493, 8494, 3, 982, 491, 0, 8494, + 8496, 3, 976, 488, 0, 8495, 8497, 3, 1006, 503, 0, 8496, 8495, 1, 0, 0, + 0, 8496, 8497, 1, 0, 0, 0, 8497, 8506, 1, 0, 0, 0, 8498, 8500, 3, 1050, + 525, 0, 8499, 8501, 3, 1016, 508, 0, 8500, 8499, 1, 0, 0, 0, 8500, 8501, + 1, 0, 0, 0, 8501, 8507, 1, 0, 0, 0, 8502, 8504, 3, 1014, 507, 0, 8503, + 8505, 3, 1052, 526, 0, 8504, 8503, 1, 0, 0, 0, 8504, 8505, 1, 0, 0, 0, + 8505, 8507, 1, 0, 0, 0, 8506, 8498, 1, 0, 0, 0, 8506, 8502, 1, 0, 0, 0, + 8506, 8507, 1, 0, 0, 0, 8507, 8509, 1, 0, 0, 0, 8508, 8479, 1, 0, 0, 0, + 8508, 8493, 1, 0, 0, 0, 8509, 975, 1, 0, 0, 0, 8510, 8518, 3, 978, 489, + 0, 8511, 8513, 7, 42, 0, 0, 8512, 8514, 3, 1000, 500, 0, 8513, 8512, 1, + 0, 0, 0, 8513, 8514, 1, 0, 0, 0, 8514, 8515, 1, 0, 0, 0, 8515, 8517, 3, + 978, 489, 0, 8516, 8511, 1, 0, 0, 0, 8517, 8520, 1, 0, 0, 0, 8518, 8516, + 1, 0, 0, 0, 8518, 8519, 1, 0, 0, 0, 8519, 977, 1, 0, 0, 0, 8520, 8518, + 1, 0, 0, 0, 8521, 8529, 3, 980, 490, 0, 8522, 8524, 5, 70, 0, 0, 8523, + 8525, 3, 1000, 500, 0, 8524, 8523, 1, 0, 0, 0, 8524, 8525, 1, 0, 0, 0, + 8525, 8526, 1, 0, 0, 0, 8526, 8528, 3, 980, 490, 0, 8527, 8522, 1, 0, 0, + 0, 8528, 8531, 1, 0, 0, 0, 8529, 8527, 1, 0, 0, 0, 8529, 8530, 1, 0, 0, + 0, 8530, 979, 1, 0, 0, 0, 8531, 8529, 1, 0, 0, 0, 8532, 8545, 5, 88, 0, + 0, 8533, 8535, 3, 1004, 502, 0, 8534, 8533, 1, 0, 0, 0, 8534, 8535, 1, + 0, 0, 0, 8535, 8537, 1, 0, 0, 0, 8536, 8538, 3, 992, 496, 0, 8537, 8536, + 1, 0, 0, 0, 8537, 8538, 1, 0, 0, 0, 8538, 8540, 1, 0, 0, 0, 8539, 8541, + 3, 1338, 669, 0, 8540, 8539, 1, 0, 0, 0, 8540, 8541, 1, 0, 0, 0, 8541, + 8546, 1, 0, 0, 0, 8542, 8543, 3, 1002, 501, 0, 8543, 8544, 3, 1340, 670, + 0, 8544, 8546, 1, 0, 0, 0, 8545, 8534, 1, 0, 0, 0, 8545, 8542, 1, 0, 0, + 0, 8546, 8548, 1, 0, 0, 0, 8547, 8549, 3, 992, 496, 0, 8548, 8547, 1, 0, + 0, 0, 8548, 8549, 1, 0, 0, 0, 8549, 8551, 1, 0, 0, 0, 8550, 8552, 3, 1064, + 532, 0, 8551, 8550, 1, 0, 0, 0, 8551, 8552, 1, 0, 0, 0, 8552, 8554, 1, + 0, 0, 0, 8553, 8555, 3, 1104, 552, 0, 8554, 8553, 1, 0, 0, 0, 8554, 8555, + 1, 0, 0, 0, 8555, 8557, 1, 0, 0, 0, 8556, 8558, 3, 1034, 517, 0, 8557, + 8556, 1, 0, 0, 0, 8557, 8558, 1, 0, 0, 0, 8558, 8560, 1, 0, 0, 0, 8559, + 8561, 3, 1048, 524, 0, 8560, 8559, 1, 0, 0, 0, 8560, 8561, 1, 0, 0, 0, + 8561, 8563, 1, 0, 0, 0, 8562, 8564, 3, 1250, 625, 0, 8563, 8562, 1, 0, + 0, 0, 8563, 8564, 1, 0, 0, 0, 8564, 8570, 1, 0, 0, 0, 8565, 8570, 3, 1062, + 531, 0, 8566, 8567, 5, 92, 0, 0, 8567, 8570, 3, 1084, 542, 0, 8568, 8570, + 3, 972, 486, 0, 8569, 8532, 1, 0, 0, 0, 8569, 8565, 1, 0, 0, 0, 8569, 8566, + 1, 0, 0, 0, 8569, 8568, 1, 0, 0, 0, 8570, 981, 1, 0, 0, 0, 8571, 8573, + 5, 105, 0, 0, 8572, 8574, 5, 296, 0, 0, 8573, 8572, 1, 0, 0, 0, 8573, 8574, + 1, 0, 0, 0, 8574, 8575, 1, 0, 0, 0, 8575, 8576, 3, 984, 492, 0, 8576, 983, + 1, 0, 0, 0, 8577, 8582, 3, 986, 493, 0, 8578, 8579, 5, 6, 0, 0, 8579, 8581, + 3, 986, 493, 0, 8580, 8578, 1, 0, 0, 0, 8581, 8584, 1, 0, 0, 0, 8582, 8580, + 1, 0, 0, 0, 8582, 8583, 1, 0, 0, 0, 8583, 985, 1, 0, 0, 0, 8584, 8582, + 1, 0, 0, 0, 8585, 8587, 3, 1352, 676, 0, 8586, 8588, 3, 880, 440, 0, 8587, + 8586, 1, 0, 0, 0, 8587, 8588, 1, 0, 0, 0, 8588, 8589, 1, 0, 0, 0, 8589, + 8591, 5, 36, 0, 0, 8590, 8592, 3, 988, 494, 0, 8591, 8590, 1, 0, 0, 0, + 8591, 8592, 1, 0, 0, 0, 8592, 8593, 1, 0, 0, 0, 8593, 8594, 5, 2, 0, 0, + 8594, 8595, 3, 904, 452, 0, 8595, 8596, 5, 3, 0, 0, 8596, 987, 1, 0, 0, + 0, 8597, 8601, 5, 251, 0, 0, 8598, 8599, 5, 77, 0, 0, 8599, 8601, 5, 251, + 0, 0, 8600, 8597, 1, 0, 0, 0, 8600, 8598, 1, 0, 0, 0, 8601, 989, 1, 0, + 0, 0, 8602, 8603, 3, 982, 491, 0, 8603, 991, 1, 0, 0, 0, 8604, 8610, 5, + 71, 0, 0, 8605, 8607, 3, 994, 497, 0, 8606, 8605, 1, 0, 0, 0, 8606, 8607, + 1, 0, 0, 0, 8607, 8608, 1, 0, 0, 0, 8608, 8611, 3, 996, 498, 0, 8609, 8611, + 3, 1578, 789, 0, 8610, 8606, 1, 0, 0, 0, 8610, 8609, 1, 0, 0, 0, 8611, + 993, 1, 0, 0, 0, 8612, 8613, 5, 339, 0, 0, 8613, 995, 1, 0, 0, 0, 8614, + 8616, 7, 43, 0, 0, 8615, 8614, 1, 0, 0, 0, 8615, 8616, 1, 0, 0, 0, 8616, + 8617, 1, 0, 0, 0, 8617, 8619, 7, 12, 0, 0, 8618, 8620, 3, 998, 499, 0, + 8619, 8618, 1, 0, 0, 0, 8619, 8620, 1, 0, 0, 0, 8620, 8621, 1, 0, 0, 0, + 8621, 8631, 3, 1348, 674, 0, 8622, 8624, 5, 360, 0, 0, 8623, 8625, 3, 998, + 499, 0, 8624, 8623, 1, 0, 0, 0, 8624, 8625, 1, 0, 0, 0, 8625, 8626, 1, + 0, 0, 0, 8626, 8631, 3, 1348, 674, 0, 8627, 8628, 5, 92, 0, 0, 8628, 8631, + 3, 1348, 674, 0, 8629, 8631, 3, 1348, 674, 0, 8630, 8615, 1, 0, 0, 0, 8630, + 8622, 1, 0, 0, 0, 8630, 8627, 1, 0, 0, 0, 8630, 8629, 1, 0, 0, 0, 8631, + 997, 1, 0, 0, 0, 8632, 8633, 5, 92, 0, 0, 8633, 999, 1, 0, 0, 0, 8634, + 8635, 7, 44, 0, 0, 8635, 1001, 1, 0, 0, 0, 8636, 8642, 5, 56, 0, 0, 8637, + 8638, 5, 80, 0, 0, 8638, 8639, 5, 2, 0, 0, 8639, 8640, 3, 1290, 645, 0, + 8640, 8641, 5, 3, 0, 0, 8641, 8643, 1, 0, 0, 0, 8642, 8637, 1, 0, 0, 0, + 8642, 8643, 1, 0, 0, 0, 8643, 1003, 1, 0, 0, 0, 8644, 8645, 5, 30, 0, 0, + 8645, 1005, 1, 0, 0, 0, 8646, 8647, 3, 1008, 504, 0, 8647, 1007, 1, 0, + 0, 0, 8648, 8649, 5, 83, 0, 0, 8649, 8650, 5, 147, 0, 0, 8650, 8651, 3, + 1010, 505, 0, 8651, 1009, 1, 0, 0, 0, 8652, 8657, 3, 1012, 506, 0, 8653, + 8654, 5, 6, 0, 0, 8654, 8656, 3, 1012, 506, 0, 8655, 8653, 1, 0, 0, 0, + 8656, 8659, 1, 0, 0, 0, 8657, 8655, 1, 0, 0, 0, 8657, 8658, 1, 0, 0, 0, + 8658, 1011, 1, 0, 0, 0, 8659, 8657, 1, 0, 0, 0, 8660, 8666, 3, 1172, 586, + 0, 8661, 8662, 5, 100, 0, 0, 8662, 8667, 3, 1286, 643, 0, 8663, 8665, 3, + 620, 310, 0, 8664, 8663, 1, 0, 0, 0, 8664, 8665, 1, 0, 0, 0, 8665, 8667, + 1, 0, 0, 0, 8666, 8661, 1, 0, 0, 0, 8666, 8664, 1, 0, 0, 0, 8667, 8669, + 1, 0, 0, 0, 8668, 8670, 3, 622, 311, 0, 8669, 8668, 1, 0, 0, 0, 8669, 8670, + 1, 0, 0, 0, 8670, 1013, 1, 0, 0, 0, 8671, 8673, 3, 1018, 509, 0, 8672, + 8674, 3, 1020, 510, 0, 8673, 8672, 1, 0, 0, 0, 8673, 8674, 1, 0, 0, 0, + 8674, 8680, 1, 0, 0, 0, 8675, 8677, 3, 1020, 510, 0, 8676, 8678, 3, 1018, + 509, 0, 8677, 8676, 1, 0, 0, 0, 8677, 8678, 1, 0, 0, 0, 8678, 8680, 1, + 0, 0, 0, 8679, 8671, 1, 0, 0, 0, 8679, 8675, 1, 0, 0, 0, 8680, 1015, 1, + 0, 0, 0, 8681, 8682, 3, 1014, 507, 0, 8682, 1017, 1, 0, 0, 0, 8683, 8684, + 5, 74, 0, 0, 8684, 8687, 3, 1022, 511, 0, 8685, 8686, 5, 6, 0, 0, 8686, + 8688, 3, 1024, 512, 0, 8687, 8685, 1, 0, 0, 0, 8687, 8688, 1, 0, 0, 0, + 8688, 8707, 1, 0, 0, 0, 8689, 8690, 5, 61, 0, 0, 8690, 8704, 3, 1032, 516, + 0, 8691, 8692, 3, 1026, 513, 0, 8692, 8696, 3, 1030, 515, 0, 8693, 8697, + 5, 81, 0, 0, 8694, 8695, 5, 105, 0, 0, 8695, 8697, 5, 469, 0, 0, 8696, + 8693, 1, 0, 0, 0, 8696, 8694, 1, 0, 0, 0, 8697, 8705, 1, 0, 0, 0, 8698, + 8702, 3, 1030, 515, 0, 8699, 8703, 5, 81, 0, 0, 8700, 8701, 5, 105, 0, + 0, 8701, 8703, 5, 469, 0, 0, 8702, 8699, 1, 0, 0, 0, 8702, 8700, 1, 0, + 0, 0, 8703, 8705, 1, 0, 0, 0, 8704, 8691, 1, 0, 0, 0, 8704, 8698, 1, 0, + 0, 0, 8705, 8707, 1, 0, 0, 0, 8706, 8683, 1, 0, 0, 0, 8706, 8689, 1, 0, + 0, 0, 8707, 1019, 1, 0, 0, 0, 8708, 8713, 5, 79, 0, 0, 8709, 8714, 3, 1024, + 512, 0, 8710, 8711, 3, 1026, 513, 0, 8711, 8712, 3, 1030, 515, 0, 8712, + 8714, 1, 0, 0, 0, 8713, 8709, 1, 0, 0, 0, 8713, 8710, 1, 0, 0, 0, 8714, + 1021, 1, 0, 0, 0, 8715, 8718, 3, 1172, 586, 0, 8716, 8718, 5, 30, 0, 0, + 8717, 8715, 1, 0, 0, 0, 8717, 8716, 1, 0, 0, 0, 8718, 1023, 1, 0, 0, 0, + 8719, 8720, 3, 1172, 586, 0, 8720, 1025, 1, 0, 0, 0, 8721, 8727, 3, 1216, + 608, 0, 8722, 8723, 5, 12, 0, 0, 8723, 8727, 3, 1028, 514, 0, 8724, 8725, + 5, 13, 0, 0, 8725, 8727, 3, 1028, 514, 0, 8726, 8721, 1, 0, 0, 0, 8726, + 8722, 1, 0, 0, 0, 8726, 8724, 1, 0, 0, 0, 8727, 1027, 1, 0, 0, 0, 8728, + 8731, 3, 1368, 684, 0, 8729, 8731, 3, 1366, 683, 0, 8730, 8728, 1, 0, 0, + 0, 8730, 8729, 1, 0, 0, 0, 8731, 1029, 1, 0, 0, 0, 8732, 8733, 7, 45, 0, + 0, 8733, 1031, 1, 0, 0, 0, 8734, 8735, 7, 46, 0, 0, 8735, 1033, 1, 0, 0, + 0, 8736, 8737, 5, 66, 0, 0, 8737, 8738, 5, 147, 0, 0, 8738, 8739, 3, 1036, + 518, 0, 8739, 1035, 1, 0, 0, 0, 8740, 8745, 3, 1038, 519, 0, 8741, 8742, + 5, 6, 0, 0, 8742, 8744, 3, 1038, 519, 0, 8743, 8741, 1, 0, 0, 0, 8744, + 8747, 1, 0, 0, 0, 8745, 8743, 1, 0, 0, 0, 8745, 8746, 1, 0, 0, 0, 8746, + 1037, 1, 0, 0, 0, 8747, 8745, 1, 0, 0, 0, 8748, 8754, 3, 1172, 586, 0, + 8749, 8754, 3, 1040, 520, 0, 8750, 8754, 3, 1044, 522, 0, 8751, 8754, 3, + 1042, 521, 0, 8752, 8754, 3, 1046, 523, 0, 8753, 8748, 1, 0, 0, 0, 8753, + 8749, 1, 0, 0, 0, 8753, 8750, 1, 0, 0, 0, 8753, 8751, 1, 0, 0, 0, 8753, + 8752, 1, 0, 0, 0, 8754, 1039, 1, 0, 0, 0, 8755, 8756, 5, 2, 0, 0, 8756, + 8757, 5, 3, 0, 0, 8757, 1041, 1, 0, 0, 0, 8758, 8759, 5, 470, 0, 0, 8759, + 8760, 5, 2, 0, 0, 8760, 8761, 3, 1290, 645, 0, 8761, 8762, 5, 3, 0, 0, + 8762, 1043, 1, 0, 0, 0, 8763, 8764, 5, 471, 0, 0, 8764, 8765, 5, 2, 0, + 0, 8765, 8766, 3, 1290, 645, 0, 8766, 8767, 5, 3, 0, 0, 8767, 1045, 1, + 0, 0, 0, 8768, 8769, 5, 472, 0, 0, 8769, 8770, 5, 473, 0, 0, 8770, 8771, + 5, 2, 0, 0, 8771, 8772, 3, 1036, 518, 0, 8772, 8773, 5, 3, 0, 0, 8773, + 1047, 1, 0, 0, 0, 8774, 8775, 5, 67, 0, 0, 8775, 8776, 3, 1172, 586, 0, + 8776, 1049, 1, 0, 0, 0, 8777, 8782, 3, 1054, 527, 0, 8778, 8779, 5, 62, + 0, 0, 8779, 8780, 5, 293, 0, 0, 8780, 8782, 5, 81, 0, 0, 8781, 8777, 1, + 0, 0, 0, 8781, 8778, 1, 0, 0, 0, 8782, 1051, 1, 0, 0, 0, 8783, 8784, 3, + 1050, 525, 0, 8784, 1053, 1, 0, 0, 0, 8785, 8787, 3, 1056, 528, 0, 8786, + 8785, 1, 0, 0, 0, 8787, 8788, 1, 0, 0, 0, 8788, 8786, 1, 0, 0, 0, 8788, + 8789, 1, 0, 0, 0, 8789, 1055, 1, 0, 0, 0, 8790, 8792, 3, 1058, 529, 0, + 8791, 8793, 3, 1060, 530, 0, 8792, 8791, 1, 0, 0, 0, 8792, 8793, 1, 0, + 0, 0, 8793, 8795, 1, 0, 0, 0, 8794, 8796, 3, 950, 475, 0, 8795, 8794, 1, + 0, 0, 0, 8795, 8796, 1, 0, 0, 0, 8796, 1057, 1, 0, 0, 0, 8797, 8807, 5, + 62, 0, 0, 8798, 8799, 5, 262, 0, 0, 8799, 8801, 5, 236, 0, 0, 8800, 8798, + 1, 0, 0, 0, 8800, 8801, 1, 0, 0, 0, 8801, 8802, 1, 0, 0, 0, 8802, 8808, + 5, 362, 0, 0, 8803, 8805, 5, 236, 0, 0, 8804, 8803, 1, 0, 0, 0, 8804, 8805, + 1, 0, 0, 0, 8805, 8806, 1, 0, 0, 0, 8806, 8808, 5, 327, 0, 0, 8807, 8800, + 1, 0, 0, 0, 8807, 8804, 1, 0, 0, 0, 8808, 1059, 1, 0, 0, 0, 8809, 8810, + 5, 268, 0, 0, 8810, 8811, 3, 1346, 673, 0, 8811, 1061, 1, 0, 0, 0, 8812, + 8813, 5, 417, 0, 0, 8813, 8814, 5, 2, 0, 0, 8814, 8815, 3, 1290, 645, 0, + 8815, 8823, 5, 3, 0, 0, 8816, 8817, 5, 6, 0, 0, 8817, 8818, 5, 2, 0, 0, + 8818, 8819, 3, 1290, 645, 0, 8819, 8820, 5, 3, 0, 0, 8820, 8822, 1, 0, + 0, 0, 8821, 8816, 1, 0, 0, 0, 8822, 8825, 1, 0, 0, 0, 8823, 8821, 1, 0, + 0, 0, 8823, 8824, 1, 0, 0, 0, 8824, 1063, 1, 0, 0, 0, 8825, 8823, 1, 0, + 0, 0, 8826, 8827, 5, 64, 0, 0, 8827, 8828, 3, 1066, 533, 0, 8828, 1065, + 1, 0, 0, 0, 8829, 8834, 3, 1068, 534, 0, 8830, 8831, 5, 6, 0, 0, 8831, + 8833, 3, 1068, 534, 0, 8832, 8830, 1, 0, 0, 0, 8833, 8836, 1, 0, 0, 0, + 8834, 8832, 1, 0, 0, 0, 8834, 8835, 1, 0, 0, 0, 8835, 1067, 1, 0, 0, 0, + 8836, 8834, 1, 0, 0, 0, 8837, 8839, 3, 1084, 542, 0, 8838, 8840, 3, 1074, + 537, 0, 8839, 8838, 1, 0, 0, 0, 8839, 8840, 1, 0, 0, 0, 8840, 8842, 1, + 0, 0, 0, 8841, 8843, 3, 1090, 545, 0, 8842, 8841, 1, 0, 0, 0, 8842, 8843, + 1, 0, 0, 0, 8843, 8896, 1, 0, 0, 0, 8844, 8846, 3, 1094, 547, 0, 8845, + 8847, 3, 1078, 539, 0, 8846, 8845, 1, 0, 0, 0, 8846, 8847, 1, 0, 0, 0, + 8847, 8896, 1, 0, 0, 0, 8848, 8850, 3, 1114, 557, 0, 8849, 8851, 3, 1074, + 537, 0, 8850, 8849, 1, 0, 0, 0, 8850, 8851, 1, 0, 0, 0, 8851, 8896, 1, + 0, 0, 0, 8852, 8854, 3, 972, 486, 0, 8853, 8855, 3, 1074, 537, 0, 8854, + 8853, 1, 0, 0, 0, 8854, 8855, 1, 0, 0, 0, 8855, 8896, 1, 0, 0, 0, 8856, + 8869, 5, 72, 0, 0, 8857, 8859, 3, 1114, 557, 0, 8858, 8860, 3, 1074, 537, + 0, 8859, 8858, 1, 0, 0, 0, 8859, 8860, 1, 0, 0, 0, 8860, 8870, 1, 0, 0, + 0, 8861, 8863, 3, 1094, 547, 0, 8862, 8864, 3, 1078, 539, 0, 8863, 8862, + 1, 0, 0, 0, 8863, 8864, 1, 0, 0, 0, 8864, 8870, 1, 0, 0, 0, 8865, 8867, + 3, 972, 486, 0, 8866, 8868, 3, 1074, 537, 0, 8867, 8866, 1, 0, 0, 0, 8867, + 8868, 1, 0, 0, 0, 8868, 8870, 1, 0, 0, 0, 8869, 8857, 1, 0, 0, 0, 8869, + 8861, 1, 0, 0, 0, 8869, 8865, 1, 0, 0, 0, 8870, 8896, 1, 0, 0, 0, 8871, + 8872, 5, 2, 0, 0, 8872, 8889, 3, 1068, 534, 0, 8873, 8874, 5, 110, 0, 0, + 8874, 8875, 5, 118, 0, 0, 8875, 8890, 3, 1068, 534, 0, 8876, 8878, 5, 121, + 0, 0, 8877, 8879, 3, 1080, 540, 0, 8878, 8877, 1, 0, 0, 0, 8878, 8879, + 1, 0, 0, 0, 8879, 8880, 1, 0, 0, 0, 8880, 8881, 5, 118, 0, 0, 8881, 8890, + 3, 1068, 534, 0, 8882, 8884, 3, 1080, 540, 0, 8883, 8882, 1, 0, 0, 0, 8883, + 8884, 1, 0, 0, 0, 8884, 8885, 1, 0, 0, 0, 8885, 8886, 5, 118, 0, 0, 8886, + 8887, 3, 1068, 534, 0, 8887, 8888, 3, 1082, 541, 0, 8888, 8890, 1, 0, 0, + 0, 8889, 8873, 1, 0, 0, 0, 8889, 8876, 1, 0, 0, 0, 8889, 8883, 1, 0, 0, + 0, 8889, 8890, 1, 0, 0, 0, 8890, 8891, 1, 0, 0, 0, 8891, 8893, 5, 3, 0, + 0, 8892, 8894, 3, 1074, 537, 0, 8893, 8892, 1, 0, 0, 0, 8893, 8894, 1, + 0, 0, 0, 8894, 8896, 1, 0, 0, 0, 8895, 8837, 1, 0, 0, 0, 8895, 8844, 1, + 0, 0, 0, 8895, 8848, 1, 0, 0, 0, 8895, 8852, 1, 0, 0, 0, 8895, 8856, 1, + 0, 0, 0, 8895, 8871, 1, 0, 0, 0, 8896, 8900, 1, 0, 0, 0, 8897, 8899, 3, + 1070, 535, 0, 8898, 8897, 1, 0, 0, 0, 8899, 8902, 1, 0, 0, 0, 8900, 8898, + 1, 0, 0, 0, 8900, 8901, 1, 0, 0, 0, 8901, 1069, 1, 0, 0, 0, 8902, 8900, + 1, 0, 0, 0, 8903, 8905, 3, 1080, 540, 0, 8904, 8903, 1, 0, 0, 0, 8904, + 8905, 1, 0, 0, 0, 8905, 8906, 1, 0, 0, 0, 8906, 8907, 5, 118, 0, 0, 8907, + 8908, 3, 1068, 534, 0, 8908, 8909, 3, 1082, 541, 0, 8909, 8920, 1, 0, 0, + 0, 8910, 8911, 5, 110, 0, 0, 8911, 8912, 5, 118, 0, 0, 8912, 8920, 3, 1068, + 534, 0, 8913, 8915, 5, 121, 0, 0, 8914, 8916, 3, 1080, 540, 0, 8915, 8914, + 1, 0, 0, 0, 8915, 8916, 1, 0, 0, 0, 8916, 8917, 1, 0, 0, 0, 8917, 8918, + 5, 118, 0, 0, 8918, 8920, 3, 1068, 534, 0, 8919, 8904, 1, 0, 0, 0, 8919, + 8910, 1, 0, 0, 0, 8919, 8913, 1, 0, 0, 0, 8920, 1071, 1, 0, 0, 0, 8921, + 8923, 5, 36, 0, 0, 8922, 8921, 1, 0, 0, 0, 8922, 8923, 1, 0, 0, 0, 8923, + 8924, 1, 0, 0, 0, 8924, 8929, 3, 1384, 692, 0, 8925, 8926, 5, 2, 0, 0, + 8926, 8927, 3, 1350, 675, 0, 8927, 8928, 5, 3, 0, 0, 8928, 8930, 1, 0, + 0, 0, 8929, 8925, 1, 0, 0, 0, 8929, 8930, 1, 0, 0, 0, 8930, 1073, 1, 0, + 0, 0, 8931, 8932, 3, 1076, 538, 0, 8932, 1075, 1, 0, 0, 0, 8933, 8935, + 5, 36, 0, 0, 8934, 8933, 1, 0, 0, 0, 8934, 8935, 1, 0, 0, 0, 8935, 8936, + 1, 0, 0, 0, 8936, 8941, 3, 1386, 693, 0, 8937, 8938, 5, 2, 0, 0, 8938, + 8939, 3, 1350, 675, 0, 8939, 8940, 5, 3, 0, 0, 8940, 8942, 1, 0, 0, 0, + 8941, 8937, 1, 0, 0, 0, 8941, 8942, 1, 0, 0, 0, 8942, 1077, 1, 0, 0, 0, + 8943, 8956, 3, 1072, 536, 0, 8944, 8946, 5, 36, 0, 0, 8945, 8947, 3, 1384, + 692, 0, 8946, 8945, 1, 0, 0, 0, 8946, 8947, 1, 0, 0, 0, 8947, 8950, 1, + 0, 0, 0, 8948, 8950, 3, 1384, 692, 0, 8949, 8944, 1, 0, 0, 0, 8949, 8948, + 1, 0, 0, 0, 8950, 8951, 1, 0, 0, 0, 8951, 8952, 5, 2, 0, 0, 8952, 8953, + 3, 1110, 555, 0, 8953, 8954, 5, 3, 0, 0, 8954, 8956, 1, 0, 0, 0, 8955, + 8943, 1, 0, 0, 0, 8955, 8949, 1, 0, 0, 0, 8956, 1079, 1, 0, 0, 0, 8957, + 8959, 7, 47, 0, 0, 8958, 8960, 5, 123, 0, 0, 8959, 8958, 1, 0, 0, 0, 8959, + 8960, 1, 0, 0, 0, 8960, 1081, 1, 0, 0, 0, 8961, 8962, 5, 100, 0, 0, 8962, + 8963, 5, 2, 0, 0, 8963, 8964, 3, 1350, 675, 0, 8964, 8965, 5, 3, 0, 0, + 8965, 8969, 1, 0, 0, 0, 8966, 8967, 5, 80, 0, 0, 8967, 8969, 3, 1172, 586, + 0, 8968, 8961, 1, 0, 0, 0, 8968, 8966, 1, 0, 0, 0, 8969, 1083, 1, 0, 0, + 0, 8970, 8972, 3, 1348, 674, 0, 8971, 8973, 5, 9, 0, 0, 8972, 8971, 1, + 0, 0, 0, 8972, 8973, 1, 0, 0, 0, 8973, 8983, 1, 0, 0, 0, 8974, 8980, 5, + 81, 0, 0, 8975, 8981, 3, 1348, 674, 0, 8976, 8977, 5, 2, 0, 0, 8977, 8978, + 3, 1348, 674, 0, 8978, 8979, 5, 3, 0, 0, 8979, 8981, 1, 0, 0, 0, 8980, + 8975, 1, 0, 0, 0, 8980, 8976, 1, 0, 0, 0, 8981, 8983, 1, 0, 0, 0, 8982, + 8970, 1, 0, 0, 0, 8982, 8974, 1, 0, 0, 0, 8983, 1085, 1, 0, 0, 0, 8984, + 8989, 3, 1084, 542, 0, 8985, 8986, 5, 6, 0, 0, 8986, 8988, 3, 1084, 542, + 0, 8987, 8985, 1, 0, 0, 0, 8988, 8991, 1, 0, 0, 0, 8989, 8987, 1, 0, 0, + 0, 8989, 8990, 1, 0, 0, 0, 8990, 1087, 1, 0, 0, 0, 8991, 8989, 1, 0, 0, + 0, 8992, 8997, 3, 1084, 542, 0, 8993, 8995, 5, 36, 0, 0, 8994, 8993, 1, + 0, 0, 0, 8994, 8995, 1, 0, 0, 0, 8995, 8996, 1, 0, 0, 0, 8996, 8998, 3, + 1384, 692, 0, 8997, 8994, 1, 0, 0, 0, 8997, 8998, 1, 0, 0, 0, 8998, 1089, + 1, 0, 0, 0, 8999, 9000, 5, 474, 0, 0, 9000, 9001, 3, 1358, 679, 0, 9001, + 9002, 5, 2, 0, 0, 9002, 9003, 3, 1290, 645, 0, 9003, 9005, 5, 3, 0, 0, + 9004, 9006, 3, 1092, 546, 0, 9005, 9004, 1, 0, 0, 0, 9005, 9006, 1, 0, + 0, 0, 9006, 1091, 1, 0, 0, 0, 9007, 9008, 5, 303, 0, 0, 9008, 9009, 5, + 2, 0, 0, 9009, 9010, 3, 1172, 586, 0, 9010, 9011, 5, 3, 0, 0, 9011, 1093, + 1, 0, 0, 0, 9012, 9014, 3, 1224, 612, 0, 9013, 9015, 3, 1102, 551, 0, 9014, + 9013, 1, 0, 0, 0, 9014, 9015, 1, 0, 0, 0, 9015, 9025, 1, 0, 0, 0, 9016, + 9017, 5, 313, 0, 0, 9017, 9018, 5, 64, 0, 0, 9018, 9019, 5, 2, 0, 0, 9019, + 9020, 3, 1098, 549, 0, 9020, 9022, 5, 3, 0, 0, 9021, 9023, 3, 1102, 551, + 0, 9022, 9021, 1, 0, 0, 0, 9022, 9023, 1, 0, 0, 0, 9023, 9025, 1, 0, 0, + 0, 9024, 9012, 1, 0, 0, 0, 9024, 9016, 1, 0, 0, 0, 9025, 1095, 1, 0, 0, + 0, 9026, 9028, 3, 1224, 612, 0, 9027, 9029, 3, 1100, 550, 0, 9028, 9027, + 1, 0, 0, 0, 9028, 9029, 1, 0, 0, 0, 9029, 1097, 1, 0, 0, 0, 9030, 9035, + 3, 1096, 548, 0, 9031, 9032, 5, 6, 0, 0, 9032, 9034, 3, 1096, 548, 0, 9033, + 9031, 1, 0, 0, 0, 9034, 9037, 1, 0, 0, 0, 9035, 9033, 1, 0, 0, 0, 9035, + 9036, 1, 0, 0, 0, 9036, 1099, 1, 0, 0, 0, 9037, 9035, 1, 0, 0, 0, 9038, + 9039, 5, 36, 0, 0, 9039, 9040, 5, 2, 0, 0, 9040, 9041, 3, 1110, 555, 0, + 9041, 9042, 5, 3, 0, 0, 9042, 1101, 1, 0, 0, 0, 9043, 9044, 5, 105, 0, + 0, 9044, 9045, 5, 475, 0, 0, 9045, 1103, 1, 0, 0, 0, 9046, 9047, 5, 103, + 0, 0, 9047, 9048, 3, 1172, 586, 0, 9048, 1105, 1, 0, 0, 0, 9049, 9054, + 5, 103, 0, 0, 9050, 9051, 5, 436, 0, 0, 9051, 9052, 5, 268, 0, 0, 9052, + 9055, 3, 964, 482, 0, 9053, 9055, 3, 1172, 586, 0, 9054, 9050, 1, 0, 0, + 0, 9054, 9053, 1, 0, 0, 0, 9055, 1107, 1, 0, 0, 0, 9056, 9057, 3, 1110, + 555, 0, 9057, 1109, 1, 0, 0, 0, 9058, 9063, 3, 1112, 556, 0, 9059, 9060, + 5, 6, 0, 0, 9060, 9062, 3, 1112, 556, 0, 9061, 9059, 1, 0, 0, 0, 9062, + 9065, 1, 0, 0, 0, 9063, 9061, 1, 0, 0, 0, 9063, 9064, 1, 0, 0, 0, 9064, + 1111, 1, 0, 0, 0, 9065, 9063, 1, 0, 0, 0, 9066, 9067, 3, 1384, 692, 0, + 9067, 9069, 3, 1128, 564, 0, 9068, 9070, 3, 110, 55, 0, 9069, 9068, 1, + 0, 0, 0, 9069, 9070, 1, 0, 0, 0, 9070, 1113, 1, 0, 0, 0, 9071, 9072, 5, + 476, 0, 0, 9072, 9088, 5, 2, 0, 0, 9073, 9074, 3, 1216, 608, 0, 9074, 9075, + 3, 1242, 621, 0, 9075, 9076, 5, 477, 0, 0, 9076, 9077, 3, 1116, 558, 0, + 9077, 9089, 1, 0, 0, 0, 9078, 9079, 5, 478, 0, 0, 9079, 9080, 5, 2, 0, + 0, 9080, 9081, 3, 1124, 562, 0, 9081, 9082, 5, 3, 0, 0, 9082, 9083, 5, + 6, 0, 0, 9083, 9084, 3, 1216, 608, 0, 9084, 9085, 3, 1242, 621, 0, 9085, + 9086, 5, 477, 0, 0, 9086, 9087, 3, 1116, 558, 0, 9087, 9089, 1, 0, 0, 0, + 9088, 9073, 1, 0, 0, 0, 9088, 9078, 1, 0, 0, 0, 9089, 9090, 1, 0, 0, 0, + 9090, 9091, 5, 3, 0, 0, 9091, 1115, 1, 0, 0, 0, 9092, 9097, 3, 1118, 559, + 0, 9093, 9094, 5, 6, 0, 0, 9094, 9096, 3, 1118, 559, 0, 9095, 9093, 1, + 0, 0, 0, 9096, 9099, 1, 0, 0, 0, 9097, 9095, 1, 0, 0, 0, 9097, 9098, 1, + 0, 0, 0, 9098, 1117, 1, 0, 0, 0, 9099, 9097, 1, 0, 0, 0, 9100, 9107, 3, + 1384, 692, 0, 9101, 9103, 3, 1128, 564, 0, 9102, 9104, 3, 1120, 560, 0, + 9103, 9102, 1, 0, 0, 0, 9103, 9104, 1, 0, 0, 0, 9104, 9108, 1, 0, 0, 0, + 9105, 9106, 5, 62, 0, 0, 9106, 9108, 5, 475, 0, 0, 9107, 9101, 1, 0, 0, + 0, 9107, 9105, 1, 0, 0, 0, 9108, 1119, 1, 0, 0, 0, 9109, 9111, 3, 1122, + 561, 0, 9110, 9109, 1, 0, 0, 0, 9111, 9112, 1, 0, 0, 0, 9112, 9110, 1, + 0, 0, 0, 9112, 9113, 1, 0, 0, 0, 9113, 1121, 1, 0, 0, 0, 9114, 9115, 5, + 53, 0, 0, 9115, 9123, 3, 1172, 586, 0, 9116, 9117, 3, 1394, 697, 0, 9117, + 9118, 3, 1172, 586, 0, 9118, 9123, 1, 0, 0, 0, 9119, 9120, 5, 77, 0, 0, + 9120, 9123, 5, 78, 0, 0, 9121, 9123, 5, 78, 0, 0, 9122, 9114, 1, 0, 0, + 0, 9122, 9116, 1, 0, 0, 0, 9122, 9119, 1, 0, 0, 0, 9122, 9121, 1, 0, 0, + 0, 9123, 1123, 1, 0, 0, 0, 9124, 9129, 3, 1126, 563, 0, 9125, 9126, 5, + 6, 0, 0, 9126, 9128, 3, 1126, 563, 0, 9127, 9125, 1, 0, 0, 0, 9128, 9131, + 1, 0, 0, 0, 9129, 9127, 1, 0, 0, 0, 9129, 9130, 1, 0, 0, 0, 9130, 1125, + 1, 0, 0, 0, 9131, 9129, 1, 0, 0, 0, 9132, 9133, 3, 1214, 607, 0, 9133, + 9134, 5, 36, 0, 0, 9134, 9135, 3, 1392, 696, 0, 9135, 9139, 1, 0, 0, 0, + 9136, 9137, 5, 53, 0, 0, 9137, 9139, 3, 1214, 607, 0, 9138, 9132, 1, 0, + 0, 0, 9138, 9136, 1, 0, 0, 0, 9139, 1127, 1, 0, 0, 0, 9140, 9142, 5, 410, + 0, 0, 9141, 9140, 1, 0, 0, 0, 9141, 9142, 1, 0, 0, 0, 9142, 9143, 1, 0, + 0, 0, 9143, 9152, 3, 1132, 566, 0, 9144, 9153, 3, 1130, 565, 0, 9145, 9150, + 5, 35, 0, 0, 9146, 9147, 5, 4, 0, 0, 9147, 9148, 3, 1368, 684, 0, 9148, + 9149, 5, 5, 0, 0, 9149, 9151, 1, 0, 0, 0, 9150, 9146, 1, 0, 0, 0, 9150, + 9151, 1, 0, 0, 0, 9151, 9153, 1, 0, 0, 0, 9152, 9144, 1, 0, 0, 0, 9152, + 9145, 1, 0, 0, 0, 9153, 9159, 1, 0, 0, 0, 9154, 9155, 3, 1348, 674, 0, + 9155, 9156, 5, 27, 0, 0, 9156, 9157, 7, 48, 0, 0, 9157, 9159, 1, 0, 0, + 0, 9158, 9141, 1, 0, 0, 0, 9158, 9154, 1, 0, 0, 0, 9159, 1129, 1, 0, 0, + 0, 9160, 9162, 5, 4, 0, 0, 9161, 9163, 3, 1368, 684, 0, 9162, 9161, 1, + 0, 0, 0, 9162, 9163, 1, 0, 0, 0, 9163, 9164, 1, 0, 0, 0, 9164, 9166, 5, + 5, 0, 0, 9165, 9160, 1, 0, 0, 0, 9166, 9169, 1, 0, 0, 0, 9167, 9165, 1, + 0, 0, 0, 9167, 9168, 1, 0, 0, 0, 9168, 1131, 1, 0, 0, 0, 9169, 9167, 1, + 0, 0, 0, 9170, 9186, 3, 1136, 568, 0, 9171, 9186, 3, 1140, 570, 0, 9172, + 9186, 3, 1144, 572, 0, 9173, 9186, 3, 1152, 576, 0, 9174, 9186, 3, 1160, + 580, 0, 9175, 9183, 3, 1162, 581, 0, 9176, 9178, 3, 1166, 583, 0, 9177, + 9176, 1, 0, 0, 0, 9177, 9178, 1, 0, 0, 0, 9178, 9184, 1, 0, 0, 0, 9179, + 9180, 5, 2, 0, 0, 9180, 9181, 3, 1368, 684, 0, 9181, 9182, 5, 3, 0, 0, + 9182, 9184, 1, 0, 0, 0, 9183, 9177, 1, 0, 0, 0, 9183, 9179, 1, 0, 0, 0, + 9184, 9186, 1, 0, 0, 0, 9185, 9170, 1, 0, 0, 0, 9185, 9171, 1, 0, 0, 0, + 9185, 9172, 1, 0, 0, 0, 9185, 9173, 1, 0, 0, 0, 9185, 9174, 1, 0, 0, 0, + 9185, 9175, 1, 0, 0, 0, 9186, 1133, 1, 0, 0, 0, 9187, 9192, 3, 1140, 570, + 0, 9188, 9192, 3, 1146, 573, 0, 9189, 9192, 3, 1154, 577, 0, 9190, 9192, + 3, 1160, 580, 0, 9191, 9187, 1, 0, 0, 0, 9191, 9188, 1, 0, 0, 0, 9191, + 9189, 1, 0, 0, 0, 9191, 9190, 1, 0, 0, 0, 9192, 1135, 1, 0, 0, 0, 9193, + 9198, 3, 1406, 703, 0, 9194, 9198, 3, 1388, 694, 0, 9195, 9198, 5, 119, + 0, 0, 9196, 9198, 5, 126, 0, 0, 9197, 9193, 1, 0, 0, 0, 9197, 9194, 1, + 0, 0, 0, 9197, 9195, 1, 0, 0, 0, 9197, 9196, 1, 0, 0, 0, 9198, 9200, 1, + 0, 0, 0, 9199, 9201, 3, 530, 265, 0, 9200, 9199, 1, 0, 0, 0, 9200, 9201, + 1, 0, 0, 0, 9201, 9203, 1, 0, 0, 0, 9202, 9204, 3, 1138, 569, 0, 9203, + 9202, 1, 0, 0, 0, 9203, 9204, 1, 0, 0, 0, 9204, 1137, 1, 0, 0, 0, 9205, + 9206, 5, 2, 0, 0, 9206, 9207, 3, 1290, 645, 0, 9207, 9208, 5, 3, 0, 0, + 9208, 1139, 1, 0, 0, 0, 9209, 9234, 5, 395, 0, 0, 9210, 9234, 5, 396, 0, + 0, 9211, 9234, 5, 411, 0, 0, 9212, 9234, 5, 382, 0, 0, 9213, 9234, 5, 408, + 0, 0, 9214, 9216, 5, 392, 0, 0, 9215, 9217, 3, 1142, 571, 0, 9216, 9215, + 1, 0, 0, 0, 9216, 9217, 1, 0, 0, 0, 9217, 9234, 1, 0, 0, 0, 9218, 9219, + 5, 190, 0, 0, 9219, 9234, 5, 407, 0, 0, 9220, 9222, 5, 389, 0, 0, 9221, + 9223, 3, 1138, 569, 0, 9222, 9221, 1, 0, 0, 0, 9222, 9223, 1, 0, 0, 0, + 9223, 9234, 1, 0, 0, 0, 9224, 9226, 5, 388, 0, 0, 9225, 9227, 3, 1138, + 569, 0, 9226, 9225, 1, 0, 0, 0, 9226, 9227, 1, 0, 0, 0, 9227, 9234, 1, + 0, 0, 0, 9228, 9230, 5, 403, 0, 0, 9229, 9231, 3, 1138, 569, 0, 9230, 9229, + 1, 0, 0, 0, 9230, 9231, 1, 0, 0, 0, 9231, 9234, 1, 0, 0, 0, 9232, 9234, + 5, 384, 0, 0, 9233, 9209, 1, 0, 0, 0, 9233, 9210, 1, 0, 0, 0, 9233, 9211, + 1, 0, 0, 0, 9233, 9212, 1, 0, 0, 0, 9233, 9213, 1, 0, 0, 0, 9233, 9214, + 1, 0, 0, 0, 9233, 9218, 1, 0, 0, 0, 9233, 9220, 1, 0, 0, 0, 9233, 9224, + 1, 0, 0, 0, 9233, 9228, 1, 0, 0, 0, 9233, 9232, 1, 0, 0, 0, 9234, 1141, + 1, 0, 0, 0, 9235, 9236, 5, 2, 0, 0, 9236, 9237, 3, 1368, 684, 0, 9237, + 9238, 5, 3, 0, 0, 9238, 1143, 1, 0, 0, 0, 9239, 9242, 3, 1148, 574, 0, + 9240, 9242, 3, 1150, 575, 0, 9241, 9239, 1, 0, 0, 0, 9241, 9240, 1, 0, + 0, 0, 9242, 1145, 1, 0, 0, 0, 9243, 9246, 3, 1148, 574, 0, 9244, 9246, + 3, 1150, 575, 0, 9245, 9243, 1, 0, 0, 0, 9245, 9244, 1, 0, 0, 0, 9246, + 1147, 1, 0, 0, 0, 9247, 9249, 5, 383, 0, 0, 9248, 9250, 3, 1158, 579, 0, + 9249, 9248, 1, 0, 0, 0, 9249, 9250, 1, 0, 0, 0, 9250, 9251, 1, 0, 0, 0, + 9251, 9252, 5, 2, 0, 0, 9252, 9253, 3, 1290, 645, 0, 9253, 9254, 5, 3, + 0, 0, 9254, 1149, 1, 0, 0, 0, 9255, 9257, 5, 383, 0, 0, 9256, 9258, 3, + 1158, 579, 0, 9257, 9256, 1, 0, 0, 0, 9257, 9258, 1, 0, 0, 0, 9258, 1151, + 1, 0, 0, 0, 9259, 9264, 3, 1156, 578, 0, 9260, 9261, 5, 2, 0, 0, 9261, + 9262, 3, 1368, 684, 0, 9262, 9263, 5, 3, 0, 0, 9263, 9265, 1, 0, 0, 0, + 9264, 9260, 1, 0, 0, 0, 9264, 9265, 1, 0, 0, 0, 9265, 1153, 1, 0, 0, 0, + 9266, 9271, 3, 1156, 578, 0, 9267, 9268, 5, 2, 0, 0, 9268, 9269, 3, 1368, + 684, 0, 9269, 9270, 5, 3, 0, 0, 9270, 9272, 1, 0, 0, 0, 9271, 9267, 1, + 0, 0, 0, 9271, 9272, 1, 0, 0, 0, 9272, 1155, 1, 0, 0, 0, 9273, 9275, 7, + 49, 0, 0, 9274, 9276, 3, 1158, 579, 0, 9275, 9274, 1, 0, 0, 0, 9275, 9276, + 1, 0, 0, 0, 9276, 9284, 1, 0, 0, 0, 9277, 9284, 5, 418, 0, 0, 9278, 9279, + 5, 399, 0, 0, 9279, 9281, 7, 50, 0, 0, 9280, 9282, 3, 1158, 579, 0, 9281, + 9280, 1, 0, 0, 0, 9281, 9282, 1, 0, 0, 0, 9282, 9284, 1, 0, 0, 0, 9283, + 9273, 1, 0, 0, 0, 9283, 9277, 1, 0, 0, 0, 9283, 9278, 1, 0, 0, 0, 9284, + 1157, 1, 0, 0, 0, 9285, 9286, 5, 367, 0, 0, 9286, 1159, 1, 0, 0, 0, 9287, + 9292, 7, 51, 0, 0, 9288, 9289, 5, 2, 0, 0, 9289, 9290, 3, 1368, 684, 0, + 9290, 9291, 5, 3, 0, 0, 9291, 9293, 1, 0, 0, 0, 9292, 9288, 1, 0, 0, 0, + 9292, 9293, 1, 0, 0, 0, 9293, 9295, 1, 0, 0, 0, 9294, 9296, 3, 1164, 582, + 0, 9295, 9294, 1, 0, 0, 0, 9295, 9296, 1, 0, 0, 0, 9296, 1161, 1, 0, 0, + 0, 9297, 9298, 5, 397, 0, 0, 9298, 1163, 1, 0, 0, 0, 9299, 9300, 5, 105, + 0, 0, 9300, 9301, 5, 413, 0, 0, 9301, 9306, 5, 379, 0, 0, 9302, 9303, 5, + 372, 0, 0, 9303, 9304, 5, 413, 0, 0, 9304, 9306, 5, 379, 0, 0, 9305, 9299, + 1, 0, 0, 0, 9305, 9302, 1, 0, 0, 0, 9306, 1165, 1, 0, 0, 0, 9307, 9333, + 5, 377, 0, 0, 9308, 9333, 5, 257, 0, 0, 9309, 9333, 5, 176, 0, 0, 9310, + 9333, 5, 218, 0, 0, 9311, 9333, 5, 254, 0, 0, 9312, 9333, 3, 1168, 584, + 0, 9313, 9314, 5, 377, 0, 0, 9314, 9315, 5, 94, 0, 0, 9315, 9333, 5, 257, + 0, 0, 9316, 9317, 5, 176, 0, 0, 9317, 9321, 5, 94, 0, 0, 9318, 9322, 5, + 218, 0, 0, 9319, 9322, 5, 254, 0, 0, 9320, 9322, 3, 1168, 584, 0, 9321, + 9318, 1, 0, 0, 0, 9321, 9319, 1, 0, 0, 0, 9321, 9320, 1, 0, 0, 0, 9322, + 9333, 1, 0, 0, 0, 9323, 9324, 5, 218, 0, 0, 9324, 9327, 5, 94, 0, 0, 9325, + 9328, 5, 254, 0, 0, 9326, 9328, 3, 1168, 584, 0, 9327, 9325, 1, 0, 0, 0, + 9327, 9326, 1, 0, 0, 0, 9328, 9333, 1, 0, 0, 0, 9329, 9330, 5, 254, 0, + 0, 9330, 9331, 5, 94, 0, 0, 9331, 9333, 3, 1168, 584, 0, 9332, 9307, 1, + 0, 0, 0, 9332, 9308, 1, 0, 0, 0, 9332, 9309, 1, 0, 0, 0, 9332, 9310, 1, + 0, 0, 0, 9332, 9311, 1, 0, 0, 0, 9332, 9312, 1, 0, 0, 0, 9332, 9313, 1, + 0, 0, 0, 9332, 9316, 1, 0, 0, 0, 9332, 9323, 1, 0, 0, 0, 9332, 9329, 1, + 0, 0, 0, 9333, 1167, 1, 0, 0, 0, 9334, 9339, 5, 319, 0, 0, 9335, 9336, + 5, 2, 0, 0, 9336, 9337, 3, 1368, 684, 0, 9337, 9338, 5, 3, 0, 0, 9338, + 9340, 1, 0, 0, 0, 9339, 9335, 1, 0, 0, 0, 9339, 9340, 1, 0, 0, 0, 9340, + 1169, 1, 0, 0, 0, 9341, 9342, 5, 197, 0, 0, 9342, 9343, 3, 1172, 586, 0, + 9343, 1171, 1, 0, 0, 0, 9344, 9345, 3, 1174, 587, 0, 9345, 1173, 1, 0, + 0, 0, 9346, 9348, 3, 1176, 588, 0, 9347, 9349, 3, 1284, 642, 0, 9348, 9347, + 1, 0, 0, 0, 9348, 9349, 1, 0, 0, 0, 9349, 1175, 1, 0, 0, 0, 9350, 9355, + 3, 1178, 589, 0, 9351, 9352, 7, 52, 0, 0, 9352, 9354, 3, 1178, 589, 0, + 9353, 9351, 1, 0, 0, 0, 9354, 9357, 1, 0, 0, 0, 9355, 9353, 1, 0, 0, 0, + 9355, 9356, 1, 0, 0, 0, 9356, 1177, 1, 0, 0, 0, 9357, 9355, 1, 0, 0, 0, + 9358, 9363, 3, 1180, 590, 0, 9359, 9360, 5, 82, 0, 0, 9360, 9362, 3, 1180, + 590, 0, 9361, 9359, 1, 0, 0, 0, 9362, 9365, 1, 0, 0, 0, 9363, 9361, 1, + 0, 0, 0, 9363, 9364, 1, 0, 0, 0, 9364, 1179, 1, 0, 0, 0, 9365, 9363, 1, + 0, 0, 0, 9366, 9371, 3, 1182, 591, 0, 9367, 9368, 5, 33, 0, 0, 9368, 9370, + 3, 1182, 591, 0, 9369, 9367, 1, 0, 0, 0, 9370, 9373, 1, 0, 0, 0, 9371, + 9369, 1, 0, 0, 0, 9371, 9372, 1, 0, 0, 0, 9372, 1181, 1, 0, 0, 0, 9373, + 9371, 1, 0, 0, 0, 9374, 9386, 3, 1184, 592, 0, 9375, 9377, 5, 77, 0, 0, + 9376, 9375, 1, 0, 0, 0, 9376, 9377, 1, 0, 0, 0, 9377, 9378, 1, 0, 0, 0, + 9378, 9380, 5, 381, 0, 0, 9379, 9381, 5, 91, 0, 0, 9380, 9379, 1, 0, 0, + 0, 9380, 9381, 1, 0, 0, 0, 9381, 9382, 1, 0, 0, 0, 9382, 9383, 3, 1184, + 592, 0, 9383, 9384, 5, 33, 0, 0, 9384, 9385, 3, 1184, 592, 0, 9385, 9387, + 1, 0, 0, 0, 9386, 9376, 1, 0, 0, 0, 9386, 9387, 1, 0, 0, 0, 9387, 1183, + 1, 0, 0, 0, 9388, 9394, 3, 1186, 593, 0, 9389, 9391, 5, 77, 0, 0, 9390, + 9389, 1, 0, 0, 0, 9390, 9391, 1, 0, 0, 0, 9391, 9392, 1, 0, 0, 0, 9392, + 9393, 5, 68, 0, 0, 9393, 9395, 3, 1316, 658, 0, 9394, 9390, 1, 0, 0, 0, + 9394, 9395, 1, 0, 0, 0, 9395, 1185, 1, 0, 0, 0, 9396, 9398, 5, 77, 0, 0, + 9397, 9396, 1, 0, 0, 0, 9397, 9398, 1, 0, 0, 0, 9398, 9399, 1, 0, 0, 0, + 9399, 9400, 3, 1188, 594, 0, 9400, 1187, 1, 0, 0, 0, 9401, 9403, 3, 1190, + 595, 0, 9402, 9404, 7, 53, 0, 0, 9403, 9402, 1, 0, 0, 0, 9403, 9404, 1, + 0, 0, 0, 9404, 1189, 1, 0, 0, 0, 9405, 9429, 3, 1192, 596, 0, 9406, 9408, + 5, 116, 0, 0, 9407, 9409, 5, 77, 0, 0, 9408, 9407, 1, 0, 0, 0, 9408, 9409, + 1, 0, 0, 0, 9409, 9427, 1, 0, 0, 0, 9410, 9428, 5, 78, 0, 0, 9411, 9428, + 5, 96, 0, 0, 9412, 9428, 5, 60, 0, 0, 9413, 9428, 5, 358, 0, 0, 9414, 9415, + 5, 56, 0, 0, 9415, 9416, 5, 64, 0, 0, 9416, 9428, 3, 1172, 586, 0, 9417, + 9418, 5, 268, 0, 0, 9418, 9419, 5, 2, 0, 0, 9419, 9420, 3, 1296, 648, 0, + 9420, 9421, 5, 3, 0, 0, 9421, 9428, 1, 0, 0, 0, 9422, 9428, 5, 188, 0, + 0, 9423, 9425, 3, 1306, 653, 0, 9424, 9423, 1, 0, 0, 0, 9424, 9425, 1, + 0, 0, 0, 9425, 9426, 1, 0, 0, 0, 9426, 9428, 5, 480, 0, 0, 9427, 9410, + 1, 0, 0, 0, 9427, 9411, 1, 0, 0, 0, 9427, 9412, 1, 0, 0, 0, 9427, 9413, + 1, 0, 0, 0, 9427, 9414, 1, 0, 0, 0, 9427, 9417, 1, 0, 0, 0, 9427, 9422, + 1, 0, 0, 0, 9427, 9424, 1, 0, 0, 0, 9428, 9430, 1, 0, 0, 0, 9429, 9406, + 1, 0, 0, 0, 9429, 9430, 1, 0, 0, 0, 9430, 1191, 1, 0, 0, 0, 9431, 9443, + 3, 1194, 597, 0, 9432, 9433, 7, 54, 0, 0, 9433, 9444, 3, 1194, 597, 0, + 9434, 9435, 3, 1288, 644, 0, 9435, 9441, 3, 1278, 639, 0, 9436, 9442, 3, + 972, 486, 0, 9437, 9438, 5, 2, 0, 0, 9438, 9439, 3, 1172, 586, 0, 9439, + 9440, 5, 3, 0, 0, 9440, 9442, 1, 0, 0, 0, 9441, 9436, 1, 0, 0, 0, 9441, + 9437, 1, 0, 0, 0, 9442, 9444, 1, 0, 0, 0, 9443, 9432, 1, 0, 0, 0, 9443, + 9434, 1, 0, 0, 0, 9443, 9444, 1, 0, 0, 0, 9444, 1193, 1, 0, 0, 0, 9445, + 9459, 3, 1196, 598, 0, 9446, 9448, 5, 77, 0, 0, 9447, 9446, 1, 0, 0, 0, + 9447, 9448, 1, 0, 0, 0, 9448, 9453, 1, 0, 0, 0, 9449, 9454, 5, 120, 0, + 0, 9450, 9454, 5, 114, 0, 0, 9451, 9452, 5, 127, 0, 0, 9452, 9454, 5, 94, + 0, 0, 9453, 9449, 1, 0, 0, 0, 9453, 9450, 1, 0, 0, 0, 9453, 9451, 1, 0, + 0, 0, 9454, 9455, 1, 0, 0, 0, 9455, 9457, 3, 1196, 598, 0, 9456, 9458, + 3, 1170, 585, 0, 9457, 9456, 1, 0, 0, 0, 9457, 9458, 1, 0, 0, 0, 9458, + 9460, 1, 0, 0, 0, 9459, 9447, 1, 0, 0, 0, 9459, 9460, 1, 0, 0, 0, 9460, + 1195, 1, 0, 0, 0, 9461, 9467, 3, 1198, 599, 0, 9462, 9463, 3, 1284, 642, + 0, 9463, 9464, 3, 1198, 599, 0, 9464, 9466, 1, 0, 0, 0, 9465, 9462, 1, + 0, 0, 0, 9466, 9469, 1, 0, 0, 0, 9467, 9465, 1, 0, 0, 0, 9467, 9468, 1, + 0, 0, 0, 9468, 1197, 1, 0, 0, 0, 9469, 9467, 1, 0, 0, 0, 9470, 9472, 3, + 1284, 642, 0, 9471, 9470, 1, 0, 0, 0, 9471, 9472, 1, 0, 0, 0, 9472, 9473, + 1, 0, 0, 0, 9473, 9474, 3, 1200, 600, 0, 9474, 1199, 1, 0, 0, 0, 9475, + 9480, 3, 1202, 601, 0, 9476, 9477, 7, 55, 0, 0, 9477, 9479, 3, 1202, 601, + 0, 9478, 9476, 1, 0, 0, 0, 9479, 9482, 1, 0, 0, 0, 9480, 9478, 1, 0, 0, + 0, 9480, 9481, 1, 0, 0, 0, 9481, 1201, 1, 0, 0, 0, 9482, 9480, 1, 0, 0, + 0, 9483, 9488, 3, 1204, 602, 0, 9484, 9485, 7, 56, 0, 0, 9485, 9487, 3, + 1204, 602, 0, 9486, 9484, 1, 0, 0, 0, 9487, 9490, 1, 0, 0, 0, 9488, 9486, + 1, 0, 0, 0, 9488, 9489, 1, 0, 0, 0, 9489, 1203, 1, 0, 0, 0, 9490, 9488, + 1, 0, 0, 0, 9491, 9494, 3, 1206, 603, 0, 9492, 9493, 5, 15, 0, 0, 9493, + 9495, 3, 1172, 586, 0, 9494, 9492, 1, 0, 0, 0, 9494, 9495, 1, 0, 0, 0, + 9495, 1205, 1, 0, 0, 0, 9496, 9498, 7, 55, 0, 0, 9497, 9496, 1, 0, 0, 0, + 9497, 9498, 1, 0, 0, 0, 9498, 9499, 1, 0, 0, 0, 9499, 9500, 3, 1208, 604, + 0, 9500, 1207, 1, 0, 0, 0, 9501, 9506, 3, 1210, 605, 0, 9502, 9503, 5, + 142, 0, 0, 9503, 9504, 5, 413, 0, 0, 9504, 9505, 5, 379, 0, 0, 9505, 9507, + 3, 1172, 586, 0, 9506, 9502, 1, 0, 0, 0, 9506, 9507, 1, 0, 0, 0, 9507, + 1209, 1, 0, 0, 0, 9508, 9511, 3, 1212, 606, 0, 9509, 9510, 5, 43, 0, 0, + 9510, 9512, 3, 528, 264, 0, 9511, 9509, 1, 0, 0, 0, 9511, 9512, 1, 0, 0, + 0, 9512, 1211, 1, 0, 0, 0, 9513, 9518, 3, 1216, 608, 0, 9514, 9515, 5, + 26, 0, 0, 9515, 9517, 3, 1128, 564, 0, 9516, 9514, 1, 0, 0, 0, 9517, 9520, + 1, 0, 0, 0, 9518, 9516, 1, 0, 0, 0, 9518, 9519, 1, 0, 0, 0, 9519, 1213, + 1, 0, 0, 0, 9520, 9518, 1, 0, 0, 0, 9521, 9522, 6, 607, -1, 0, 9522, 9529, + 3, 1216, 608, 0, 9523, 9524, 7, 55, 0, 0, 9524, 9529, 3, 1214, 607, 9, + 9525, 9526, 3, 1284, 642, 0, 9526, 9527, 3, 1214, 607, 3, 9527, 9529, 1, + 0, 0, 0, 9528, 9521, 1, 0, 0, 0, 9528, 9523, 1, 0, 0, 0, 9528, 9525, 1, + 0, 0, 0, 9529, 9569, 1, 0, 0, 0, 9530, 9531, 10, 8, 0, 0, 9531, 9532, 5, + 15, 0, 0, 9532, 9568, 3, 1214, 607, 9, 9533, 9534, 10, 7, 0, 0, 9534, 9535, + 7, 56, 0, 0, 9535, 9568, 3, 1214, 607, 8, 9536, 9537, 10, 6, 0, 0, 9537, + 9538, 7, 55, 0, 0, 9538, 9568, 3, 1214, 607, 7, 9539, 9540, 10, 5, 0, 0, + 9540, 9541, 3, 1284, 642, 0, 9541, 9542, 3, 1214, 607, 6, 9542, 9568, 1, + 0, 0, 0, 9543, 9544, 10, 4, 0, 0, 9544, 9545, 7, 54, 0, 0, 9545, 9568, + 3, 1214, 607, 5, 9546, 9547, 10, 10, 0, 0, 9547, 9548, 5, 26, 0, 0, 9548, + 9568, 3, 1128, 564, 0, 9549, 9550, 10, 2, 0, 0, 9550, 9568, 3, 1284, 642, + 0, 9551, 9552, 10, 1, 0, 0, 9552, 9554, 5, 116, 0, 0, 9553, 9555, 5, 77, + 0, 0, 9554, 9553, 1, 0, 0, 0, 9554, 9555, 1, 0, 0, 0, 9555, 9565, 1, 0, + 0, 0, 9556, 9557, 5, 56, 0, 0, 9557, 9558, 5, 64, 0, 0, 9558, 9566, 3, + 1214, 607, 0, 9559, 9560, 5, 268, 0, 0, 9560, 9561, 5, 2, 0, 0, 9561, 9562, + 3, 1296, 648, 0, 9562, 9563, 5, 3, 0, 0, 9563, 9566, 1, 0, 0, 0, 9564, + 9566, 5, 188, 0, 0, 9565, 9556, 1, 0, 0, 0, 9565, 9559, 1, 0, 0, 0, 9565, + 9564, 1, 0, 0, 0, 9566, 9568, 1, 0, 0, 0, 9567, 9530, 1, 0, 0, 0, 9567, + 9533, 1, 0, 0, 0, 9567, 9536, 1, 0, 0, 0, 9567, 9539, 1, 0, 0, 0, 9567, + 9543, 1, 0, 0, 0, 9567, 9546, 1, 0, 0, 0, 9567, 9549, 1, 0, 0, 0, 9567, + 9551, 1, 0, 0, 0, 9568, 9571, 1, 0, 0, 0, 9569, 9567, 1, 0, 0, 0, 9569, + 9570, 1, 0, 0, 0, 9570, 1215, 1, 0, 0, 0, 9571, 9569, 1, 0, 0, 0, 9572, + 9573, 5, 390, 0, 0, 9573, 9609, 3, 972, 486, 0, 9574, 9577, 5, 35, 0, 0, + 9575, 9578, 3, 972, 486, 0, 9576, 9578, 3, 1298, 649, 0, 9577, 9575, 1, + 0, 0, 0, 9577, 9576, 1, 0, 0, 0, 9578, 9609, 1, 0, 0, 0, 9579, 9580, 5, + 28, 0, 0, 9580, 9609, 3, 1336, 668, 0, 9581, 9582, 5, 472, 0, 0, 9582, + 9583, 5, 2, 0, 0, 9583, 9584, 3, 1290, 645, 0, 9584, 9585, 5, 3, 0, 0, + 9585, 9609, 1, 0, 0, 0, 9586, 9587, 5, 98, 0, 0, 9587, 9609, 3, 972, 486, + 0, 9588, 9609, 3, 1328, 664, 0, 9589, 9609, 3, 1360, 680, 0, 9590, 9609, + 3, 1218, 609, 0, 9591, 9592, 5, 2, 0, 0, 9592, 9593, 3, 1172, 586, 0, 9593, + 9594, 5, 3, 0, 0, 9594, 9595, 3, 1336, 668, 0, 9595, 9609, 1, 0, 0, 0, + 9596, 9609, 3, 1318, 659, 0, 9597, 9609, 3, 1222, 611, 0, 9598, 9600, 3, + 972, 486, 0, 9599, 9601, 3, 1334, 667, 0, 9600, 9599, 1, 0, 0, 0, 9600, + 9601, 1, 0, 0, 0, 9601, 9609, 1, 0, 0, 0, 9602, 9609, 3, 1274, 637, 0, + 9603, 9609, 3, 1276, 638, 0, 9604, 9605, 3, 1272, 636, 0, 9605, 9606, 5, + 125, 0, 0, 9606, 9607, 3, 1272, 636, 0, 9607, 9609, 1, 0, 0, 0, 9608, 9572, + 1, 0, 0, 0, 9608, 9574, 1, 0, 0, 0, 9608, 9579, 1, 0, 0, 0, 9608, 9581, + 1, 0, 0, 0, 9608, 9586, 1, 0, 0, 0, 9608, 9588, 1, 0, 0, 0, 9608, 9589, + 1, 0, 0, 0, 9608, 9590, 1, 0, 0, 0, 9608, 9591, 1, 0, 0, 0, 9608, 9596, + 1, 0, 0, 0, 9608, 9597, 1, 0, 0, 0, 9608, 9598, 1, 0, 0, 0, 9608, 9602, + 1, 0, 0, 0, 9608, 9603, 1, 0, 0, 0, 9608, 9604, 1, 0, 0, 0, 9609, 1217, + 1, 0, 0, 0, 9610, 9611, 5, 668, 0, 0, 9611, 1219, 1, 0, 0, 0, 9612, 9613, + 3, 1358, 679, 0, 9613, 9635, 5, 2, 0, 0, 9614, 9618, 3, 1292, 646, 0, 9615, + 9616, 5, 6, 0, 0, 9616, 9617, 5, 101, 0, 0, 9617, 9619, 3, 1294, 647, 0, + 9618, 9615, 1, 0, 0, 0, 9618, 9619, 1, 0, 0, 0, 9619, 9621, 1, 0, 0, 0, + 9620, 9622, 3, 1006, 503, 0, 9621, 9620, 1, 0, 0, 0, 9621, 9622, 1, 0, + 0, 0, 9622, 9636, 1, 0, 0, 0, 9623, 9624, 5, 101, 0, 0, 9624, 9626, 3, + 1294, 647, 0, 9625, 9627, 3, 1006, 503, 0, 9626, 9625, 1, 0, 0, 0, 9626, + 9627, 1, 0, 0, 0, 9627, 9636, 1, 0, 0, 0, 9628, 9629, 7, 44, 0, 0, 9629, + 9631, 3, 1292, 646, 0, 9630, 9632, 3, 1006, 503, 0, 9631, 9630, 1, 0, 0, + 0, 9631, 9632, 1, 0, 0, 0, 9632, 9636, 1, 0, 0, 0, 9633, 9636, 5, 9, 0, + 0, 9634, 9636, 1, 0, 0, 0, 9635, 9614, 1, 0, 0, 0, 9635, 9623, 1, 0, 0, + 0, 9635, 9628, 1, 0, 0, 0, 9635, 9633, 1, 0, 0, 0, 9635, 9634, 1, 0, 0, + 0, 9636, 9637, 1, 0, 0, 0, 9637, 9638, 5, 3, 0, 0, 9638, 1221, 1, 0, 0, + 0, 9639, 9641, 3, 1220, 610, 0, 9640, 9642, 3, 1246, 623, 0, 9641, 9640, + 1, 0, 0, 0, 9641, 9642, 1, 0, 0, 0, 9642, 9644, 1, 0, 0, 0, 9643, 9645, + 3, 1248, 624, 0, 9644, 9643, 1, 0, 0, 0, 9644, 9645, 1, 0, 0, 0, 9645, + 9647, 1, 0, 0, 0, 9646, 9648, 3, 1256, 628, 0, 9647, 9646, 1, 0, 0, 0, + 9647, 9648, 1, 0, 0, 0, 9648, 9651, 1, 0, 0, 0, 9649, 9651, 3, 1226, 613, + 0, 9650, 9639, 1, 0, 0, 0, 9650, 9649, 1, 0, 0, 0, 9651, 1223, 1, 0, 0, + 0, 9652, 9655, 3, 1220, 610, 0, 9653, 9655, 3, 1226, 613, 0, 9654, 9652, + 1, 0, 0, 0, 9654, 9653, 1, 0, 0, 0, 9655, 1225, 1, 0, 0, 0, 9656, 9657, + 5, 108, 0, 0, 9657, 9658, 5, 62, 0, 0, 9658, 9659, 5, 2, 0, 0, 9659, 9660, + 3, 1172, 586, 0, 9660, 9661, 5, 3, 0, 0, 9661, 9840, 1, 0, 0, 0, 9662, + 9840, 5, 48, 0, 0, 9663, 9668, 5, 50, 0, 0, 9664, 9665, 5, 2, 0, 0, 9665, + 9666, 3, 1368, 684, 0, 9666, 9667, 5, 3, 0, 0, 9667, 9669, 1, 0, 0, 0, + 9668, 9664, 1, 0, 0, 0, 9668, 9669, 1, 0, 0, 0, 9669, 9840, 1, 0, 0, 0, + 9670, 9675, 5, 51, 0, 0, 9671, 9672, 5, 2, 0, 0, 9672, 9673, 3, 1368, 684, + 0, 9673, 9674, 5, 3, 0, 0, 9674, 9676, 1, 0, 0, 0, 9675, 9671, 1, 0, 0, + 0, 9675, 9676, 1, 0, 0, 0, 9676, 9840, 1, 0, 0, 0, 9677, 9682, 5, 75, 0, + 0, 9678, 9679, 5, 2, 0, 0, 9679, 9680, 3, 1368, 684, 0, 9680, 9681, 5, + 3, 0, 0, 9681, 9683, 1, 0, 0, 0, 9682, 9678, 1, 0, 0, 0, 9682, 9683, 1, + 0, 0, 0, 9683, 9840, 1, 0, 0, 0, 9684, 9689, 5, 76, 0, 0, 9685, 9686, 5, + 2, 0, 0, 9686, 9687, 3, 1368, 684, 0, 9687, 9688, 5, 3, 0, 0, 9688, 9690, + 1, 0, 0, 0, 9689, 9685, 1, 0, 0, 0, 9689, 9690, 1, 0, 0, 0, 9690, 9840, + 1, 0, 0, 0, 9691, 9840, 5, 49, 0, 0, 9692, 9840, 5, 52, 0, 0, 9693, 9840, + 5, 89, 0, 0, 9694, 9840, 5, 99, 0, 0, 9695, 9840, 5, 47, 0, 0, 9696, 9840, + 5, 111, 0, 0, 9697, 9698, 5, 41, 0, 0, 9698, 9699, 5, 2, 0, 0, 9699, 9700, + 3, 1172, 586, 0, 9700, 9701, 5, 36, 0, 0, 9701, 9702, 3, 1128, 564, 0, + 9702, 9703, 5, 3, 0, 0, 9703, 9840, 1, 0, 0, 0, 9704, 9705, 5, 391, 0, + 0, 9705, 9707, 5, 2, 0, 0, 9706, 9708, 3, 1302, 651, 0, 9707, 9706, 1, + 0, 0, 0, 9707, 9708, 1, 0, 0, 0, 9708, 9709, 1, 0, 0, 0, 9709, 9840, 5, + 3, 0, 0, 9710, 9711, 5, 491, 0, 0, 9711, 9712, 5, 2, 0, 0, 9712, 9715, + 3, 1172, 586, 0, 9713, 9714, 5, 6, 0, 0, 9714, 9716, 3, 1306, 653, 0, 9715, + 9713, 1, 0, 0, 0, 9715, 9716, 1, 0, 0, 0, 9716, 9717, 1, 0, 0, 0, 9717, + 9718, 5, 3, 0, 0, 9718, 9840, 1, 0, 0, 0, 9719, 9720, 5, 404, 0, 0, 9720, + 9721, 5, 2, 0, 0, 9721, 9722, 3, 1308, 654, 0, 9722, 9723, 5, 3, 0, 0, + 9723, 9840, 1, 0, 0, 0, 9724, 9725, 5, 406, 0, 0, 9725, 9727, 5, 2, 0, + 0, 9726, 9728, 3, 1310, 655, 0, 9727, 9726, 1, 0, 0, 0, 9727, 9728, 1, + 0, 0, 0, 9728, 9729, 1, 0, 0, 0, 9729, 9840, 5, 3, 0, 0, 9730, 9731, 5, + 412, 0, 0, 9731, 9732, 5, 2, 0, 0, 9732, 9733, 3, 1312, 656, 0, 9733, 9734, + 5, 3, 0, 0, 9734, 9840, 1, 0, 0, 0, 9735, 9736, 5, 415, 0, 0, 9736, 9737, + 5, 2, 0, 0, 9737, 9738, 3, 1172, 586, 0, 9738, 9739, 5, 36, 0, 0, 9739, + 9740, 3, 1128, 564, 0, 9740, 9741, 5, 3, 0, 0, 9741, 9840, 1, 0, 0, 0, + 9742, 9743, 5, 416, 0, 0, 9743, 9745, 5, 2, 0, 0, 9744, 9746, 7, 57, 0, + 0, 9745, 9744, 1, 0, 0, 0, 9745, 9746, 1, 0, 0, 0, 9746, 9747, 1, 0, 0, + 0, 9747, 9748, 3, 1314, 657, 0, 9748, 9749, 5, 3, 0, 0, 9749, 9840, 1, + 0, 0, 0, 9750, 9751, 5, 402, 0, 0, 9751, 9752, 5, 2, 0, 0, 9752, 9753, + 3, 1172, 586, 0, 9753, 9754, 5, 6, 0, 0, 9754, 9755, 3, 1172, 586, 0, 9755, + 9756, 5, 3, 0, 0, 9756, 9840, 1, 0, 0, 0, 9757, 9758, 5, 387, 0, 0, 9758, + 9759, 5, 2, 0, 0, 9759, 9760, 3, 1290, 645, 0, 9760, 9761, 5, 3, 0, 0, + 9761, 9840, 1, 0, 0, 0, 9762, 9763, 5, 393, 0, 0, 9763, 9764, 5, 2, 0, + 0, 9764, 9765, 3, 1290, 645, 0, 9765, 9766, 5, 3, 0, 0, 9766, 9840, 1, + 0, 0, 0, 9767, 9768, 5, 398, 0, 0, 9768, 9769, 5, 2, 0, 0, 9769, 9770, + 3, 1290, 645, 0, 9770, 9771, 5, 3, 0, 0, 9771, 9840, 1, 0, 0, 0, 9772, + 9773, 5, 427, 0, 0, 9773, 9774, 5, 2, 0, 0, 9774, 9775, 3, 1290, 645, 0, + 9775, 9776, 5, 3, 0, 0, 9776, 9840, 1, 0, 0, 0, 9777, 9778, 5, 428, 0, + 0, 9778, 9779, 5, 2, 0, 0, 9779, 9780, 5, 259, 0, 0, 9780, 9786, 3, 1392, + 696, 0, 9781, 9784, 5, 6, 0, 0, 9782, 9785, 3, 1232, 616, 0, 9783, 9785, + 3, 1290, 645, 0, 9784, 9782, 1, 0, 0, 0, 9784, 9783, 1, 0, 0, 0, 9785, + 9787, 1, 0, 0, 0, 9786, 9781, 1, 0, 0, 0, 9786, 9787, 1, 0, 0, 0, 9787, + 9788, 1, 0, 0, 0, 9788, 9789, 5, 3, 0, 0, 9789, 9840, 1, 0, 0, 0, 9790, + 9791, 5, 429, 0, 0, 9791, 9792, 5, 2, 0, 0, 9792, 9793, 3, 1216, 608, 0, + 9793, 9794, 3, 1242, 621, 0, 9794, 9795, 5, 3, 0, 0, 9795, 9840, 1, 0, + 0, 0, 9796, 9797, 5, 430, 0, 0, 9797, 9798, 5, 2, 0, 0, 9798, 9799, 3, + 1234, 617, 0, 9799, 9800, 5, 3, 0, 0, 9800, 9840, 1, 0, 0, 0, 9801, 9802, + 5, 431, 0, 0, 9802, 9803, 5, 2, 0, 0, 9803, 9804, 3, 1238, 619, 0, 9804, + 9806, 3, 1172, 586, 0, 9805, 9807, 3, 1240, 620, 0, 9806, 9805, 1, 0, 0, + 0, 9806, 9807, 1, 0, 0, 0, 9807, 9808, 1, 0, 0, 0, 9808, 9809, 5, 3, 0, + 0, 9809, 9840, 1, 0, 0, 0, 9810, 9811, 5, 432, 0, 0, 9811, 9812, 5, 2, + 0, 0, 9812, 9813, 5, 259, 0, 0, 9813, 9816, 3, 1392, 696, 0, 9814, 9815, + 5, 6, 0, 0, 9815, 9817, 3, 1172, 586, 0, 9816, 9814, 1, 0, 0, 0, 9816, + 9817, 1, 0, 0, 0, 9817, 9818, 1, 0, 0, 0, 9818, 9819, 5, 3, 0, 0, 9819, + 9840, 1, 0, 0, 0, 9820, 9821, 5, 433, 0, 0, 9821, 9822, 5, 2, 0, 0, 9822, + 9823, 5, 376, 0, 0, 9823, 9824, 3, 1172, 586, 0, 9824, 9825, 5, 6, 0, 0, + 9825, 9827, 3, 1228, 614, 0, 9826, 9828, 3, 1230, 615, 0, 9827, 9826, 1, + 0, 0, 0, 9827, 9828, 1, 0, 0, 0, 9828, 9829, 1, 0, 0, 0, 9829, 9830, 5, + 3, 0, 0, 9830, 9840, 1, 0, 0, 0, 9831, 9832, 5, 434, 0, 0, 9832, 9833, + 5, 2, 0, 0, 9833, 9834, 3, 1238, 619, 0, 9834, 9835, 3, 1172, 586, 0, 9835, + 9836, 5, 36, 0, 0, 9836, 9837, 3, 1132, 566, 0, 9837, 9838, 5, 3, 0, 0, + 9838, 9840, 1, 0, 0, 0, 9839, 9656, 1, 0, 0, 0, 9839, 9662, 1, 0, 0, 0, + 9839, 9663, 1, 0, 0, 0, 9839, 9670, 1, 0, 0, 0, 9839, 9677, 1, 0, 0, 0, + 9839, 9684, 1, 0, 0, 0, 9839, 9691, 1, 0, 0, 0, 9839, 9692, 1, 0, 0, 0, + 9839, 9693, 1, 0, 0, 0, 9839, 9694, 1, 0, 0, 0, 9839, 9695, 1, 0, 0, 0, + 9839, 9696, 1, 0, 0, 0, 9839, 9697, 1, 0, 0, 0, 9839, 9704, 1, 0, 0, 0, + 9839, 9710, 1, 0, 0, 0, 9839, 9719, 1, 0, 0, 0, 9839, 9724, 1, 0, 0, 0, + 9839, 9730, 1, 0, 0, 0, 9839, 9735, 1, 0, 0, 0, 9839, 9742, 1, 0, 0, 0, + 9839, 9750, 1, 0, 0, 0, 9839, 9757, 1, 0, 0, 0, 9839, 9762, 1, 0, 0, 0, + 9839, 9767, 1, 0, 0, 0, 9839, 9772, 1, 0, 0, 0, 9839, 9777, 1, 0, 0, 0, + 9839, 9790, 1, 0, 0, 0, 9839, 9796, 1, 0, 0, 0, 9839, 9801, 1, 0, 0, 0, + 9839, 9810, 1, 0, 0, 0, 9839, 9820, 1, 0, 0, 0, 9839, 9831, 1, 0, 0, 0, + 9840, 1227, 1, 0, 0, 0, 9841, 9842, 5, 368, 0, 0, 9842, 9847, 3, 1172, + 586, 0, 9843, 9844, 5, 368, 0, 0, 9844, 9845, 5, 262, 0, 0, 9845, 9847, + 5, 452, 0, 0, 9846, 9841, 1, 0, 0, 0, 9846, 9843, 1, 0, 0, 0, 9847, 1229, + 1, 0, 0, 0, 9848, 9849, 5, 6, 0, 0, 9849, 9850, 5, 332, 0, 0, 9850, 9859, + 5, 378, 0, 0, 9851, 9852, 5, 6, 0, 0, 9852, 9853, 5, 332, 0, 0, 9853, 9859, + 5, 262, 0, 0, 9854, 9855, 5, 6, 0, 0, 9855, 9856, 5, 332, 0, 0, 9856, 9857, + 5, 262, 0, 0, 9857, 9859, 5, 452, 0, 0, 9858, 9848, 1, 0, 0, 0, 9858, 9851, + 1, 0, 0, 0, 9858, 9854, 1, 0, 0, 0, 9859, 1231, 1, 0, 0, 0, 9860, 9861, + 5, 419, 0, 0, 9861, 9862, 5, 2, 0, 0, 9862, 9863, 3, 1234, 617, 0, 9863, + 9864, 5, 3, 0, 0, 9864, 1233, 1, 0, 0, 0, 9865, 9870, 3, 1236, 618, 0, + 9866, 9867, 5, 6, 0, 0, 9867, 9869, 3, 1236, 618, 0, 9868, 9866, 1, 0, + 0, 0, 9869, 9872, 1, 0, 0, 0, 9870, 9868, 1, 0, 0, 0, 9870, 9871, 1, 0, + 0, 0, 9871, 1235, 1, 0, 0, 0, 9872, 9870, 1, 0, 0, 0, 9873, 9876, 3, 1172, + 586, 0, 9874, 9875, 5, 36, 0, 0, 9875, 9877, 3, 1392, 696, 0, 9876, 9874, + 1, 0, 0, 0, 9876, 9877, 1, 0, 0, 0, 9877, 1237, 1, 0, 0, 0, 9878, 9879, + 7, 58, 0, 0, 9879, 1239, 1, 0, 0, 0, 9880, 9881, 5, 285, 0, 0, 9881, 9885, + 5, 371, 0, 0, 9882, 9883, 5, 340, 0, 0, 9883, 9885, 5, 371, 0, 0, 9884, + 9880, 1, 0, 0, 0, 9884, 9882, 1, 0, 0, 0, 9885, 1241, 1, 0, 0, 0, 9886, + 9887, 5, 279, 0, 0, 9887, 9902, 3, 1216, 608, 0, 9888, 9889, 5, 279, 0, + 0, 9889, 9890, 3, 1216, 608, 0, 9890, 9891, 3, 1244, 622, 0, 9891, 9902, + 1, 0, 0, 0, 9892, 9893, 5, 279, 0, 0, 9893, 9894, 3, 1244, 622, 0, 9894, + 9895, 3, 1216, 608, 0, 9895, 9902, 1, 0, 0, 0, 9896, 9897, 5, 279, 0, 0, + 9897, 9898, 3, 1244, 622, 0, 9898, 9899, 3, 1216, 608, 0, 9899, 9900, 3, + 1244, 622, 0, 9900, 9902, 1, 0, 0, 0, 9901, 9886, 1, 0, 0, 0, 9901, 9888, + 1, 0, 0, 0, 9901, 9892, 1, 0, 0, 0, 9901, 9896, 1, 0, 0, 0, 9902, 1243, + 1, 0, 0, 0, 9903, 9904, 5, 147, 0, 0, 9904, 9905, 7, 59, 0, 0, 9905, 1245, + 1, 0, 0, 0, 9906, 9907, 5, 481, 0, 0, 9907, 9908, 5, 66, 0, 0, 9908, 9909, + 5, 2, 0, 0, 9909, 9910, 3, 1008, 504, 0, 9910, 9911, 5, 3, 0, 0, 9911, + 1247, 1, 0, 0, 0, 9912, 9913, 5, 482, 0, 0, 9913, 9914, 5, 2, 0, 0, 9914, + 9915, 5, 103, 0, 0, 9915, 9916, 3, 1172, 586, 0, 9916, 9917, 5, 3, 0, 0, + 9917, 1249, 1, 0, 0, 0, 9918, 9919, 5, 104, 0, 0, 9919, 9920, 3, 1252, + 626, 0, 9920, 1251, 1, 0, 0, 0, 9921, 9926, 3, 1254, 627, 0, 9922, 9923, + 5, 6, 0, 0, 9923, 9925, 3, 1254, 627, 0, 9924, 9922, 1, 0, 0, 0, 9925, + 9928, 1, 0, 0, 0, 9926, 9924, 1, 0, 0, 0, 9926, 9927, 1, 0, 0, 0, 9927, + 1253, 1, 0, 0, 0, 9928, 9926, 1, 0, 0, 0, 9929, 9930, 3, 1384, 692, 0, + 9930, 9931, 5, 36, 0, 0, 9931, 9932, 3, 1258, 629, 0, 9932, 1255, 1, 0, + 0, 0, 9933, 9936, 5, 124, 0, 0, 9934, 9937, 3, 1258, 629, 0, 9935, 9937, + 3, 1384, 692, 0, 9936, 9934, 1, 0, 0, 0, 9936, 9935, 1, 0, 0, 0, 9937, + 1257, 1, 0, 0, 0, 9938, 9940, 5, 2, 0, 0, 9939, 9941, 3, 1260, 630, 0, + 9940, 9939, 1, 0, 0, 0, 9940, 9941, 1, 0, 0, 0, 9941, 9943, 1, 0, 0, 0, + 9942, 9944, 3, 1262, 631, 0, 9943, 9942, 1, 0, 0, 0, 9943, 9944, 1, 0, + 0, 0, 9944, 9946, 1, 0, 0, 0, 9945, 9947, 3, 1006, 503, 0, 9946, 9945, + 1, 0, 0, 0, 9946, 9947, 1, 0, 0, 0, 9947, 9949, 1, 0, 0, 0, 9948, 9950, + 3, 1264, 632, 0, 9949, 9948, 1, 0, 0, 0, 9949, 9950, 1, 0, 0, 0, 9950, + 9951, 1, 0, 0, 0, 9951, 9952, 5, 3, 0, 0, 9952, 1259, 1, 0, 0, 0, 9953, + 9954, 3, 1384, 692, 0, 9954, 1261, 1, 0, 0, 0, 9955, 9956, 5, 278, 0, 0, + 9956, 9957, 5, 147, 0, 0, 9957, 9958, 3, 1290, 645, 0, 9958, 1263, 1, 0, + 0, 0, 9959, 9960, 5, 292, 0, 0, 9960, 9962, 3, 1266, 633, 0, 9961, 9963, + 3, 1270, 635, 0, 9962, 9961, 1, 0, 0, 0, 9962, 9963, 1, 0, 0, 0, 9963, + 9975, 1, 0, 0, 0, 9964, 9965, 5, 313, 0, 0, 9965, 9967, 3, 1266, 633, 0, + 9966, 9968, 3, 1270, 635, 0, 9967, 9966, 1, 0, 0, 0, 9967, 9968, 1, 0, + 0, 0, 9968, 9975, 1, 0, 0, 0, 9969, 9970, 5, 483, 0, 0, 9970, 9972, 3, + 1266, 633, 0, 9971, 9973, 3, 1270, 635, 0, 9972, 9971, 1, 0, 0, 0, 9972, + 9973, 1, 0, 0, 0, 9973, 9975, 1, 0, 0, 0, 9974, 9959, 1, 0, 0, 0, 9974, + 9964, 1, 0, 0, 0, 9974, 9969, 1, 0, 0, 0, 9975, 1265, 1, 0, 0, 0, 9976, + 9983, 3, 1268, 634, 0, 9977, 9978, 5, 381, 0, 0, 9978, 9979, 3, 1268, 634, + 0, 9979, 9980, 5, 33, 0, 0, 9980, 9981, 3, 1268, 634, 0, 9981, 9983, 1, + 0, 0, 0, 9982, 9976, 1, 0, 0, 0, 9982, 9977, 1, 0, 0, 0, 9983, 1267, 1, + 0, 0, 0, 9984, 9985, 5, 355, 0, 0, 9985, 9992, 7, 60, 0, 0, 9986, 9987, + 5, 436, 0, 0, 9987, 9992, 5, 409, 0, 0, 9988, 9989, 3, 1172, 586, 0, 9989, + 9990, 7, 60, 0, 0, 9990, 9992, 1, 0, 0, 0, 9991, 9984, 1, 0, 0, 0, 9991, + 9986, 1, 0, 0, 0, 9991, 9988, 1, 0, 0, 0, 9992, 1269, 1, 0, 0, 0, 9993, + 10000, 5, 199, 0, 0, 9994, 9995, 5, 436, 0, 0, 9995, 10001, 5, 409, 0, + 0, 9996, 10001, 5, 66, 0, 0, 9997, 10001, 5, 469, 0, 0, 9998, 9999, 5, + 262, 0, 0, 9999, 10001, 5, 484, 0, 0, 10000, 9994, 1, 0, 0, 0, 10000, 9996, + 1, 0, 0, 0, 10000, 9997, 1, 0, 0, 0, 10000, 9998, 1, 0, 0, 0, 10001, 1271, + 1, 0, 0, 0, 10002, 10003, 5, 409, 0, 0, 10003, 10005, 5, 2, 0, 0, 10004, + 10006, 3, 1290, 645, 0, 10005, 10004, 1, 0, 0, 0, 10005, 10006, 1, 0, 0, + 0, 10006, 10007, 1, 0, 0, 0, 10007, 10015, 5, 3, 0, 0, 10008, 10009, 5, + 2, 0, 0, 10009, 10010, 3, 1290, 645, 0, 10010, 10011, 5, 6, 0, 0, 10011, + 10012, 3, 1172, 586, 0, 10012, 10013, 5, 3, 0, 0, 10013, 10015, 1, 0, 0, + 0, 10014, 10002, 1, 0, 0, 0, 10014, 10008, 1, 0, 0, 0, 10015, 1273, 1, + 0, 0, 0, 10016, 10017, 5, 409, 0, 0, 10017, 10019, 5, 2, 0, 0, 10018, 10020, + 3, 1290, 645, 0, 10019, 10018, 1, 0, 0, 0, 10019, 10020, 1, 0, 0, 0, 10020, + 10021, 1, 0, 0, 0, 10021, 10022, 5, 3, 0, 0, 10022, 1275, 1, 0, 0, 0, 10023, + 10024, 5, 2, 0, 0, 10024, 10025, 3, 1290, 645, 0, 10025, 10026, 5, 6, 0, + 0, 10026, 10027, 3, 1172, 586, 0, 10027, 10028, 5, 3, 0, 0, 10028, 1277, + 1, 0, 0, 0, 10029, 10030, 7, 61, 0, 0, 10030, 1279, 1, 0, 0, 0, 10031, + 10034, 5, 29, 0, 0, 10032, 10034, 3, 1282, 641, 0, 10033, 10031, 1, 0, + 0, 0, 10033, 10032, 1, 0, 0, 0, 10034, 1281, 1, 0, 0, 0, 10035, 10036, + 7, 62, 0, 0, 10036, 1283, 1, 0, 0, 0, 10037, 10044, 5, 29, 0, 0, 10038, + 10039, 5, 271, 0, 0, 10039, 10040, 5, 2, 0, 0, 10040, 10041, 3, 692, 346, + 0, 10041, 10042, 5, 3, 0, 0, 10042, 10044, 1, 0, 0, 0, 10043, 10037, 1, + 0, 0, 0, 10043, 10038, 1, 0, 0, 0, 10044, 1285, 1, 0, 0, 0, 10045, 10052, + 3, 1280, 640, 0, 10046, 10047, 5, 271, 0, 0, 10047, 10048, 5, 2, 0, 0, + 10048, 10049, 3, 692, 346, 0, 10049, 10050, 5, 3, 0, 0, 10050, 10052, 1, + 0, 0, 0, 10051, 10045, 1, 0, 0, 0, 10051, 10046, 1, 0, 0, 0, 10052, 1287, + 1, 0, 0, 0, 10053, 10066, 3, 1280, 640, 0, 10054, 10055, 5, 271, 0, 0, + 10055, 10056, 5, 2, 0, 0, 10056, 10057, 3, 692, 346, 0, 10057, 10058, 5, + 3, 0, 0, 10058, 10066, 1, 0, 0, 0, 10059, 10066, 5, 120, 0, 0, 10060, 10061, + 5, 77, 0, 0, 10061, 10066, 5, 120, 0, 0, 10062, 10066, 5, 114, 0, 0, 10063, + 10064, 5, 77, 0, 0, 10064, 10066, 5, 114, 0, 0, 10065, 10053, 1, 0, 0, + 0, 10065, 10054, 1, 0, 0, 0, 10065, 10059, 1, 0, 0, 0, 10065, 10060, 1, + 0, 0, 0, 10065, 10062, 1, 0, 0, 0, 10065, 10063, 1, 0, 0, 0, 10066, 1289, + 1, 0, 0, 0, 10067, 10072, 3, 1172, 586, 0, 10068, 10069, 5, 6, 0, 0, 10069, + 10071, 3, 1172, 586, 0, 10070, 10068, 1, 0, 0, 0, 10071, 10074, 1, 0, 0, + 0, 10072, 10070, 1, 0, 0, 0, 10072, 10073, 1, 0, 0, 0, 10073, 1291, 1, + 0, 0, 0, 10074, 10072, 1, 0, 0, 0, 10075, 10080, 3, 1294, 647, 0, 10076, + 10077, 5, 6, 0, 0, 10077, 10079, 3, 1294, 647, 0, 10078, 10076, 1, 0, 0, + 0, 10079, 10082, 1, 0, 0, 0, 10080, 10078, 1, 0, 0, 0, 10080, 10081, 1, + 0, 0, 0, 10081, 1293, 1, 0, 0, 0, 10082, 10080, 1, 0, 0, 0, 10083, 10089, + 3, 1172, 586, 0, 10084, 10085, 3, 644, 322, 0, 10085, 10086, 7, 63, 0, + 0, 10086, 10087, 3, 1172, 586, 0, 10087, 10089, 1, 0, 0, 0, 10088, 10083, + 1, 0, 0, 0, 10088, 10084, 1, 0, 0, 0, 10089, 1295, 1, 0, 0, 0, 10090, 10095, + 3, 1128, 564, 0, 10091, 10092, 5, 6, 0, 0, 10092, 10094, 3, 1128, 564, + 0, 10093, 10091, 1, 0, 0, 0, 10094, 10097, 1, 0, 0, 0, 10095, 10093, 1, + 0, 0, 0, 10095, 10096, 1, 0, 0, 0, 10096, 1297, 1, 0, 0, 0, 10097, 10095, + 1, 0, 0, 0, 10098, 10101, 5, 4, 0, 0, 10099, 10102, 3, 1290, 645, 0, 10100, + 10102, 3, 1300, 650, 0, 10101, 10099, 1, 0, 0, 0, 10101, 10100, 1, 0, 0, + 0, 10101, 10102, 1, 0, 0, 0, 10102, 10103, 1, 0, 0, 0, 10103, 10104, 5, + 5, 0, 0, 10104, 1299, 1, 0, 0, 0, 10105, 10110, 3, 1298, 649, 0, 10106, + 10107, 5, 6, 0, 0, 10107, 10109, 3, 1298, 649, 0, 10108, 10106, 1, 0, 0, + 0, 10109, 10112, 1, 0, 0, 0, 10110, 10108, 1, 0, 0, 0, 10110, 10111, 1, + 0, 0, 0, 10111, 1301, 1, 0, 0, 0, 10112, 10110, 1, 0, 0, 0, 10113, 10114, + 3, 1304, 652, 0, 10114, 10115, 5, 64, 0, 0, 10115, 10116, 3, 1172, 586, + 0, 10116, 1303, 1, 0, 0, 0, 10117, 10126, 3, 1394, 697, 0, 10118, 10126, + 5, 377, 0, 0, 10119, 10126, 5, 257, 0, 0, 10120, 10126, 5, 176, 0, 0, 10121, + 10126, 5, 218, 0, 0, 10122, 10126, 5, 254, 0, 0, 10123, 10126, 5, 319, + 0, 0, 10124, 10126, 3, 1370, 685, 0, 10125, 10117, 1, 0, 0, 0, 10125, 10118, + 1, 0, 0, 0, 10125, 10119, 1, 0, 0, 0, 10125, 10120, 1, 0, 0, 0, 10125, + 10121, 1, 0, 0, 0, 10125, 10122, 1, 0, 0, 0, 10125, 10123, 1, 0, 0, 0, + 10125, 10124, 1, 0, 0, 0, 10126, 1305, 1, 0, 0, 0, 10127, 10128, 7, 64, + 0, 0, 10128, 1307, 1, 0, 0, 0, 10129, 10130, 3, 1172, 586, 0, 10130, 10131, + 5, 84, 0, 0, 10131, 10132, 3, 1172, 586, 0, 10132, 10133, 5, 64, 0, 0, + 10133, 10136, 3, 1172, 586, 0, 10134, 10135, 5, 62, 0, 0, 10135, 10137, + 3, 1172, 586, 0, 10136, 10134, 1, 0, 0, 0, 10136, 10137, 1, 0, 0, 0, 10137, + 1309, 1, 0, 0, 0, 10138, 10139, 3, 1214, 607, 0, 10139, 10140, 5, 68, 0, + 0, 10140, 10141, 3, 1214, 607, 0, 10141, 1311, 1, 0, 0, 0, 10142, 10143, + 3, 1172, 586, 0, 10143, 10144, 5, 64, 0, 0, 10144, 10145, 3, 1172, 586, + 0, 10145, 10146, 5, 62, 0, 0, 10146, 10147, 3, 1172, 586, 0, 10147, 10170, + 1, 0, 0, 0, 10148, 10149, 3, 1172, 586, 0, 10149, 10150, 5, 62, 0, 0, 10150, + 10151, 3, 1172, 586, 0, 10151, 10152, 5, 64, 0, 0, 10152, 10153, 3, 1172, + 586, 0, 10153, 10170, 1, 0, 0, 0, 10154, 10155, 3, 1172, 586, 0, 10155, + 10156, 5, 64, 0, 0, 10156, 10157, 3, 1172, 586, 0, 10157, 10170, 1, 0, + 0, 0, 10158, 10159, 3, 1172, 586, 0, 10159, 10160, 5, 62, 0, 0, 10160, + 10161, 3, 1172, 586, 0, 10161, 10170, 1, 0, 0, 0, 10162, 10163, 3, 1172, + 586, 0, 10163, 10164, 5, 127, 0, 0, 10164, 10165, 3, 1172, 586, 0, 10165, + 10166, 5, 197, 0, 0, 10166, 10167, 3, 1172, 586, 0, 10167, 10170, 1, 0, + 0, 0, 10168, 10170, 3, 1290, 645, 0, 10169, 10142, 1, 0, 0, 0, 10169, 10148, + 1, 0, 0, 0, 10169, 10154, 1, 0, 0, 0, 10169, 10158, 1, 0, 0, 0, 10169, + 10162, 1, 0, 0, 0, 10169, 10168, 1, 0, 0, 0, 10170, 1313, 1, 0, 0, 0, 10171, + 10172, 3, 1172, 586, 0, 10172, 10173, 5, 64, 0, 0, 10173, 10174, 3, 1290, + 645, 0, 10174, 10179, 1, 0, 0, 0, 10175, 10176, 5, 64, 0, 0, 10176, 10179, + 3, 1290, 645, 0, 10177, 10179, 3, 1290, 645, 0, 10178, 10171, 1, 0, 0, + 0, 10178, 10175, 1, 0, 0, 0, 10178, 10177, 1, 0, 0, 0, 10179, 1315, 1, + 0, 0, 0, 10180, 10186, 3, 972, 486, 0, 10181, 10182, 5, 2, 0, 0, 10182, + 10183, 3, 1290, 645, 0, 10183, 10184, 5, 3, 0, 0, 10184, 10186, 1, 0, 0, + 0, 10185, 10180, 1, 0, 0, 0, 10185, 10181, 1, 0, 0, 0, 10186, 1317, 1, + 0, 0, 0, 10187, 10189, 5, 40, 0, 0, 10188, 10190, 3, 1326, 663, 0, 10189, + 10188, 1, 0, 0, 0, 10189, 10190, 1, 0, 0, 0, 10190, 10191, 1, 0, 0, 0, + 10191, 10193, 3, 1320, 660, 0, 10192, 10194, 3, 1324, 662, 0, 10193, 10192, + 1, 0, 0, 0, 10193, 10194, 1, 0, 0, 0, 10194, 10195, 1, 0, 0, 0, 10195, + 10196, 5, 456, 0, 0, 10196, 1319, 1, 0, 0, 0, 10197, 10199, 3, 1322, 661, + 0, 10198, 10197, 1, 0, 0, 0, 10199, 10200, 1, 0, 0, 0, 10200, 10198, 1, + 0, 0, 0, 10200, 10201, 1, 0, 0, 0, 10201, 1321, 1, 0, 0, 0, 10202, 10203, + 5, 102, 0, 0, 10203, 10204, 3, 1172, 586, 0, 10204, 10205, 5, 93, 0, 0, + 10205, 10206, 3, 1172, 586, 0, 10206, 1323, 1, 0, 0, 0, 10207, 10208, 5, + 58, 0, 0, 10208, 10209, 3, 1172, 586, 0, 10209, 1325, 1, 0, 0, 0, 10210, + 10211, 3, 1172, 586, 0, 10211, 1327, 1, 0, 0, 0, 10212, 10214, 3, 1384, + 692, 0, 10213, 10215, 3, 1334, 667, 0, 10214, 10213, 1, 0, 0, 0, 10214, + 10215, 1, 0, 0, 0, 10215, 1329, 1, 0, 0, 0, 10216, 10219, 5, 11, 0, 0, + 10217, 10220, 3, 1354, 677, 0, 10218, 10220, 5, 9, 0, 0, 10219, 10217, + 1, 0, 0, 0, 10219, 10218, 1, 0, 0, 0, 10220, 10234, 1, 0, 0, 0, 10221, + 10230, 5, 4, 0, 0, 10222, 10231, 3, 1172, 586, 0, 10223, 10225, 3, 1332, + 666, 0, 10224, 10223, 1, 0, 0, 0, 10224, 10225, 1, 0, 0, 0, 10225, 10226, + 1, 0, 0, 0, 10226, 10228, 5, 8, 0, 0, 10227, 10229, 3, 1332, 666, 0, 10228, + 10227, 1, 0, 0, 0, 10228, 10229, 1, 0, 0, 0, 10229, 10231, 1, 0, 0, 0, + 10230, 10222, 1, 0, 0, 0, 10230, 10224, 1, 0, 0, 0, 10231, 10232, 1, 0, + 0, 0, 10232, 10234, 5, 5, 0, 0, 10233, 10216, 1, 0, 0, 0, 10233, 10221, + 1, 0, 0, 0, 10234, 1331, 1, 0, 0, 0, 10235, 10236, 3, 1172, 586, 0, 10236, + 1333, 1, 0, 0, 0, 10237, 10239, 3, 1330, 665, 0, 10238, 10237, 1, 0, 0, + 0, 10239, 10240, 1, 0, 0, 0, 10240, 10238, 1, 0, 0, 0, 10240, 10241, 1, + 0, 0, 0, 10241, 1335, 1, 0, 0, 0, 10242, 10244, 3, 1330, 665, 0, 10243, + 10242, 1, 0, 0, 0, 10244, 10247, 1, 0, 0, 0, 10245, 10243, 1, 0, 0, 0, + 10245, 10246, 1, 0, 0, 0, 10246, 1337, 1, 0, 0, 0, 10247, 10245, 1, 0, + 0, 0, 10248, 10249, 3, 1340, 670, 0, 10249, 1339, 1, 0, 0, 0, 10250, 10255, + 3, 1342, 671, 0, 10251, 10252, 5, 6, 0, 0, 10252, 10254, 3, 1342, 671, + 0, 10253, 10251, 1, 0, 0, 0, 10254, 10257, 1, 0, 0, 0, 10255, 10253, 1, + 0, 0, 0, 10255, 10256, 1, 0, 0, 0, 10256, 1341, 1, 0, 0, 0, 10257, 10255, + 1, 0, 0, 0, 10258, 10260, 3, 1172, 586, 0, 10259, 10261, 3, 1344, 672, + 0, 10260, 10259, 1, 0, 0, 0, 10260, 10261, 1, 0, 0, 0, 10261, 10264, 1, + 0, 0, 0, 10262, 10264, 5, 9, 0, 0, 10263, 10258, 1, 0, 0, 0, 10263, 10262, + 1, 0, 0, 0, 10264, 1343, 1, 0, 0, 0, 10265, 10266, 5, 36, 0, 0, 10266, + 10269, 3, 1392, 696, 0, 10267, 10269, 3, 1394, 697, 0, 10268, 10265, 1, + 0, 0, 0, 10268, 10267, 1, 0, 0, 0, 10269, 1345, 1, 0, 0, 0, 10270, 10275, + 3, 1348, 674, 0, 10271, 10272, 5, 6, 0, 0, 10272, 10274, 3, 1348, 674, + 0, 10273, 10271, 1, 0, 0, 0, 10274, 10277, 1, 0, 0, 0, 10275, 10273, 1, + 0, 0, 0, 10275, 10276, 1, 0, 0, 0, 10276, 1347, 1, 0, 0, 0, 10277, 10275, + 1, 0, 0, 0, 10278, 10280, 3, 1384, 692, 0, 10279, 10281, 3, 1334, 667, + 0, 10280, 10279, 1, 0, 0, 0, 10280, 10281, 1, 0, 0, 0, 10281, 1349, 1, + 0, 0, 0, 10282, 10287, 3, 1352, 676, 0, 10283, 10284, 5, 6, 0, 0, 10284, + 10286, 3, 1352, 676, 0, 10285, 10283, 1, 0, 0, 0, 10286, 10289, 1, 0, 0, + 0, 10287, 10285, 1, 0, 0, 0, 10287, 10288, 1, 0, 0, 0, 10288, 1351, 1, + 0, 0, 0, 10289, 10287, 1, 0, 0, 0, 10290, 10291, 3, 1384, 692, 0, 10291, + 1353, 1, 0, 0, 0, 10292, 10293, 3, 1392, 696, 0, 10293, 1355, 1, 0, 0, + 0, 10294, 10295, 3, 1370, 685, 0, 10295, 1357, 1, 0, 0, 0, 10296, 10304, + 3, 1406, 703, 0, 10297, 10304, 3, 1388, 694, 0, 10298, 10299, 3, 1384, + 692, 0, 10299, 10300, 3, 1334, 667, 0, 10300, 10304, 1, 0, 0, 0, 10301, + 10304, 5, 119, 0, 0, 10302, 10304, 5, 126, 0, 0, 10303, 10296, 1, 0, 0, + 0, 10303, 10297, 1, 0, 0, 0, 10303, 10298, 1, 0, 0, 0, 10303, 10301, 1, + 0, 0, 0, 10303, 10302, 1, 0, 0, 0, 10304, 1359, 1, 0, 0, 0, 10305, 10341, + 3, 1368, 684, 0, 10306, 10341, 3, 1366, 683, 0, 10307, 10341, 3, 1370, + 685, 0, 10308, 10341, 3, 1364, 682, 0, 10309, 10341, 3, 1362, 681, 0, 10310, + 10320, 3, 1358, 679, 0, 10311, 10321, 3, 1370, 685, 0, 10312, 10313, 5, + 2, 0, 0, 10313, 10315, 3, 1292, 646, 0, 10314, 10316, 3, 1006, 503, 0, + 10315, 10314, 1, 0, 0, 0, 10315, 10316, 1, 0, 0, 0, 10316, 10317, 1, 0, + 0, 0, 10317, 10318, 5, 3, 0, 0, 10318, 10319, 3, 1370, 685, 0, 10319, 10321, + 1, 0, 0, 0, 10320, 10311, 1, 0, 0, 0, 10320, 10312, 1, 0, 0, 0, 10321, + 10341, 1, 0, 0, 0, 10322, 10323, 3, 1134, 567, 0, 10323, 10324, 3, 1370, + 685, 0, 10324, 10341, 1, 0, 0, 0, 10325, 10335, 3, 1162, 581, 0, 10326, + 10328, 3, 1370, 685, 0, 10327, 10329, 3, 1166, 583, 0, 10328, 10327, 1, + 0, 0, 0, 10328, 10329, 1, 0, 0, 0, 10329, 10336, 1, 0, 0, 0, 10330, 10331, + 5, 2, 0, 0, 10331, 10332, 3, 1368, 684, 0, 10332, 10333, 5, 3, 0, 0, 10333, + 10334, 3, 1370, 685, 0, 10334, 10336, 1, 0, 0, 0, 10335, 10326, 1, 0, 0, + 0, 10335, 10330, 1, 0, 0, 0, 10336, 10341, 1, 0, 0, 0, 10337, 10341, 5, + 96, 0, 0, 10338, 10341, 5, 60, 0, 0, 10339, 10341, 5, 78, 0, 0, 10340, + 10305, 1, 0, 0, 0, 10340, 10306, 1, 0, 0, 0, 10340, 10307, 1, 0, 0, 0, + 10340, 10308, 1, 0, 0, 0, 10340, 10309, 1, 0, 0, 0, 10340, 10310, 1, 0, + 0, 0, 10340, 10322, 1, 0, 0, 0, 10340, 10325, 1, 0, 0, 0, 10340, 10337, + 1, 0, 0, 0, 10340, 10338, 1, 0, 0, 0, 10340, 10339, 1, 0, 0, 0, 10341, + 1361, 1, 0, 0, 0, 10342, 10343, 5, 661, 0, 0, 10343, 1363, 1, 0, 0, 0, + 10344, 10345, 5, 657, 0, 0, 10345, 1365, 1, 0, 0, 0, 10346, 10347, 5, 667, + 0, 0, 10347, 1367, 1, 0, 0, 0, 10348, 10349, 5, 665, 0, 0, 10349, 1369, + 1, 0, 0, 0, 10350, 10352, 3, 1372, 686, 0, 10351, 10353, 3, 1374, 687, + 0, 10352, 10351, 1, 0, 0, 0, 10352, 10353, 1, 0, 0, 0, 10353, 1371, 1, + 0, 0, 0, 10354, 10366, 5, 652, 0, 0, 10355, 10366, 5, 654, 0, 0, 10356, + 10360, 5, 656, 0, 0, 10357, 10359, 5, 684, 0, 0, 10358, 10357, 1, 0, 0, + 0, 10359, 10362, 1, 0, 0, 0, 10360, 10358, 1, 0, 0, 0, 10360, 10361, 1, + 0, 0, 0, 10361, 10363, 1, 0, 0, 0, 10362, 10360, 1, 0, 0, 0, 10363, 10366, + 5, 685, 0, 0, 10364, 10366, 5, 678, 0, 0, 10365, 10354, 1, 0, 0, 0, 10365, + 10355, 1, 0, 0, 0, 10365, 10356, 1, 0, 0, 0, 10365, 10364, 1, 0, 0, 0, + 10366, 1373, 1, 0, 0, 0, 10367, 10368, 5, 489, 0, 0, 10368, 10369, 3, 1372, + 686, 0, 10369, 1375, 1, 0, 0, 0, 10370, 10376, 3, 1368, 684, 0, 10371, + 10372, 5, 12, 0, 0, 10372, 10376, 3, 1368, 684, 0, 10373, 10374, 5, 13, + 0, 0, 10374, 10376, 3, 1368, 684, 0, 10375, 10370, 1, 0, 0, 0, 10375, 10371, + 1, 0, 0, 0, 10375, 10373, 1, 0, 0, 0, 10376, 1377, 1, 0, 0, 0, 10377, 10378, + 3, 1380, 690, 0, 10378, 1379, 1, 0, 0, 0, 10379, 10383, 3, 1390, 695, 0, + 10380, 10383, 5, 52, 0, 0, 10381, 10383, 5, 89, 0, 0, 10382, 10379, 1, + 0, 0, 0, 10382, 10380, 1, 0, 0, 0, 10382, 10381, 1, 0, 0, 0, 10383, 1381, + 1, 0, 0, 0, 10384, 10389, 3, 1380, 690, 0, 10385, 10386, 5, 6, 0, 0, 10386, + 10388, 3, 1380, 690, 0, 10387, 10385, 1, 0, 0, 0, 10388, 10391, 1, 0, 0, + 0, 10389, 10387, 1, 0, 0, 0, 10389, 10390, 1, 0, 0, 0, 10390, 1383, 1, + 0, 0, 0, 10391, 10389, 1, 0, 0, 0, 10392, 10399, 3, 1394, 697, 0, 10393, + 10399, 3, 1398, 699, 0, 10394, 10399, 3, 1400, 700, 0, 10395, 10399, 3, + 1620, 810, 0, 10396, 10399, 5, 119, 0, 0, 10397, 10399, 5, 126, 0, 0, 10398, + 10392, 1, 0, 0, 0, 10398, 10393, 1, 0, 0, 0, 10398, 10394, 1, 0, 0, 0, + 10398, 10395, 1, 0, 0, 0, 10398, 10396, 1, 0, 0, 0, 10398, 10397, 1, 0, + 0, 0, 10399, 1385, 1, 0, 0, 0, 10400, 10405, 3, 1394, 697, 0, 10401, 10405, + 3, 1398, 699, 0, 10402, 10405, 3, 1400, 700, 0, 10403, 10405, 3, 1620, + 810, 0, 10404, 10400, 1, 0, 0, 0, 10404, 10401, 1, 0, 0, 0, 10404, 10402, + 1, 0, 0, 0, 10404, 10403, 1, 0, 0, 0, 10405, 1387, 1, 0, 0, 0, 10406, 10411, + 3, 1394, 697, 0, 10407, 10411, 3, 1398, 699, 0, 10408, 10411, 3, 1620, + 810, 0, 10409, 10411, 3, 1402, 701, 0, 10410, 10406, 1, 0, 0, 0, 10410, + 10407, 1, 0, 0, 0, 10410, 10408, 1, 0, 0, 0, 10410, 10409, 1, 0, 0, 0, + 10411, 1389, 1, 0, 0, 0, 10412, 10417, 3, 1394, 697, 0, 10413, 10417, 3, + 1398, 699, 0, 10414, 10417, 3, 1400, 700, 0, 10415, 10417, 3, 1402, 701, + 0, 10416, 10412, 1, 0, 0, 0, 10416, 10413, 1, 0, 0, 0, 10416, 10414, 1, + 0, 0, 0, 10416, 10415, 1, 0, 0, 0, 10417, 1391, 1, 0, 0, 0, 10418, 10425, + 3, 1394, 697, 0, 10419, 10425, 3, 1620, 810, 0, 10420, 10425, 3, 1398, + 699, 0, 10421, 10425, 3, 1400, 700, 0, 10422, 10425, 3, 1402, 701, 0, 10423, + 10425, 3, 1404, 702, 0, 10424, 10418, 1, 0, 0, 0, 10424, 10419, 1, 0, 0, + 0, 10424, 10420, 1, 0, 0, 0, 10424, 10421, 1, 0, 0, 0, 10424, 10422, 1, + 0, 0, 0, 10424, 10423, 1, 0, 0, 0, 10425, 1393, 1, 0, 0, 0, 10426, 10428, + 5, 643, 0, 0, 10427, 10429, 3, 1374, 687, 0, 10428, 10427, 1, 0, 0, 0, + 10428, 10429, 1, 0, 0, 0, 10429, 10436, 1, 0, 0, 0, 10430, 10436, 5, 644, + 0, 0, 10431, 10436, 5, 648, 0, 0, 10432, 10436, 3, 1218, 609, 0, 10433, + 10436, 3, 1396, 698, 0, 10434, 10436, 3, 1620, 810, 0, 10435, 10426, 1, + 0, 0, 0, 10435, 10430, 1, 0, 0, 0, 10435, 10431, 1, 0, 0, 0, 10435, 10432, + 1, 0, 0, 0, 10435, 10433, 1, 0, 0, 0, 10435, 10434, 1, 0, 0, 0, 10436, + 1395, 1, 0, 0, 0, 10437, 10438, 5, 669, 0, 0, 10438, 1397, 1, 0, 0, 0, + 10439, 10440, 7, 65, 0, 0, 10440, 1399, 1, 0, 0, 0, 10441, 10494, 5, 381, + 0, 0, 10442, 10494, 5, 382, 0, 0, 10443, 10494, 3, 1144, 572, 0, 10444, + 10494, 5, 384, 0, 0, 10445, 10494, 5, 385, 0, 0, 10446, 10494, 3, 1152, + 576, 0, 10447, 10494, 5, 387, 0, 0, 10448, 10494, 5, 388, 0, 0, 10449, + 10494, 5, 389, 0, 0, 10450, 10494, 5, 390, 0, 0, 10451, 10494, 5, 391, + 0, 0, 10452, 10494, 5, 392, 0, 0, 10453, 10494, 5, 393, 0, 0, 10454, 10494, + 5, 472, 0, 0, 10455, 10494, 5, 394, 0, 0, 10456, 10494, 5, 395, 0, 0, 10457, + 10494, 5, 396, 0, 0, 10458, 10494, 5, 397, 0, 0, 10459, 10494, 5, 398, + 0, 0, 10460, 10494, 5, 399, 0, 0, 10461, 10494, 5, 400, 0, 0, 10462, 10494, + 5, 401, 0, 0, 10463, 10494, 5, 491, 0, 0, 10464, 10494, 5, 402, 0, 0, 10465, + 10494, 3, 1140, 570, 0, 10466, 10494, 5, 455, 0, 0, 10467, 10494, 5, 404, + 0, 0, 10468, 10494, 5, 406, 0, 0, 10469, 10494, 5, 407, 0, 0, 10470, 10494, + 5, 408, 0, 0, 10471, 10494, 5, 409, 0, 0, 10472, 10494, 5, 410, 0, 0, 10473, + 10494, 5, 411, 0, 0, 10474, 10494, 5, 412, 0, 0, 10475, 10494, 5, 413, + 0, 0, 10476, 10494, 5, 414, 0, 0, 10477, 10494, 5, 415, 0, 0, 10478, 10494, + 5, 416, 0, 0, 10479, 10494, 5, 417, 0, 0, 10480, 10494, 5, 418, 0, 0, 10481, + 10494, 5, 419, 0, 0, 10482, 10494, 5, 427, 0, 0, 10483, 10494, 5, 428, + 0, 0, 10484, 10494, 5, 429, 0, 0, 10485, 10494, 5, 430, 0, 0, 10486, 10494, + 5, 478, 0, 0, 10487, 10494, 5, 431, 0, 0, 10488, 10494, 5, 432, 0, 0, 10489, + 10494, 5, 433, 0, 0, 10490, 10494, 5, 434, 0, 0, 10491, 10494, 5, 476, + 0, 0, 10492, 10494, 3, 1406, 703, 0, 10493, 10441, 1, 0, 0, 0, 10493, 10442, + 1, 0, 0, 0, 10493, 10443, 1, 0, 0, 0, 10493, 10444, 1, 0, 0, 0, 10493, + 10445, 1, 0, 0, 0, 10493, 10446, 1, 0, 0, 0, 10493, 10447, 1, 0, 0, 0, + 10493, 10448, 1, 0, 0, 0, 10493, 10449, 1, 0, 0, 0, 10493, 10450, 1, 0, + 0, 0, 10493, 10451, 1, 0, 0, 0, 10493, 10452, 1, 0, 0, 0, 10493, 10453, + 1, 0, 0, 0, 10493, 10454, 1, 0, 0, 0, 10493, 10455, 1, 0, 0, 0, 10493, + 10456, 1, 0, 0, 0, 10493, 10457, 1, 0, 0, 0, 10493, 10458, 1, 0, 0, 0, + 10493, 10459, 1, 0, 0, 0, 10493, 10460, 1, 0, 0, 0, 10493, 10461, 1, 0, + 0, 0, 10493, 10462, 1, 0, 0, 0, 10493, 10463, 1, 0, 0, 0, 10493, 10464, + 1, 0, 0, 0, 10493, 10465, 1, 0, 0, 0, 10493, 10466, 1, 0, 0, 0, 10493, + 10467, 1, 0, 0, 0, 10493, 10468, 1, 0, 0, 0, 10493, 10469, 1, 0, 0, 0, + 10493, 10470, 1, 0, 0, 0, 10493, 10471, 1, 0, 0, 0, 10493, 10472, 1, 0, + 0, 0, 10493, 10473, 1, 0, 0, 0, 10493, 10474, 1, 0, 0, 0, 10493, 10475, + 1, 0, 0, 0, 10493, 10476, 1, 0, 0, 0, 10493, 10477, 1, 0, 0, 0, 10493, + 10478, 1, 0, 0, 0, 10493, 10479, 1, 0, 0, 0, 10493, 10480, 1, 0, 0, 0, + 10493, 10481, 1, 0, 0, 0, 10493, 10482, 1, 0, 0, 0, 10493, 10483, 1, 0, + 0, 0, 10493, 10484, 1, 0, 0, 0, 10493, 10485, 1, 0, 0, 0, 10493, 10486, + 1, 0, 0, 0, 10493, 10487, 1, 0, 0, 0, 10493, 10488, 1, 0, 0, 0, 10493, + 10489, 1, 0, 0, 0, 10493, 10490, 1, 0, 0, 0, 10493, 10491, 1, 0, 0, 0, + 10493, 10492, 1, 0, 0, 0, 10494, 1401, 1, 0, 0, 0, 10495, 10496, 7, 66, + 0, 0, 10496, 1403, 1, 0, 0, 0, 10497, 10498, 7, 67, 0, 0, 10498, 1405, + 1, 0, 0, 0, 10499, 10500, 7, 68, 0, 0, 10500, 1407, 1, 0, 0, 0, 10501, + 10502, 3, 1410, 705, 0, 10502, 10504, 3, 1420, 710, 0, 10503, 10505, 3, + 1418, 709, 0, 10504, 10503, 1, 0, 0, 0, 10504, 10505, 1, 0, 0, 0, 10505, + 1409, 1, 0, 0, 0, 10506, 10508, 3, 1412, 706, 0, 10507, 10506, 1, 0, 0, + 0, 10508, 10511, 1, 0, 0, 0, 10509, 10507, 1, 0, 0, 0, 10509, 10510, 1, + 0, 0, 0, 10510, 1411, 1, 0, 0, 0, 10511, 10509, 1, 0, 0, 0, 10512, 10513, + 3, 1414, 707, 0, 10513, 10514, 5, 272, 0, 0, 10514, 10515, 5, 492, 0, 0, + 10515, 10533, 1, 0, 0, 0, 10516, 10517, 3, 1414, 707, 0, 10517, 10518, + 5, 493, 0, 0, 10518, 10519, 3, 1416, 708, 0, 10519, 10533, 1, 0, 0, 0, + 10520, 10521, 3, 1414, 707, 0, 10521, 10522, 5, 494, 0, 0, 10522, 10523, + 5, 495, 0, 0, 10523, 10533, 1, 0, 0, 0, 10524, 10525, 3, 1414, 707, 0, + 10525, 10526, 5, 494, 0, 0, 10526, 10527, 5, 496, 0, 0, 10527, 10533, 1, + 0, 0, 0, 10528, 10529, 3, 1414, 707, 0, 10529, 10530, 5, 494, 0, 0, 10530, + 10531, 5, 497, 0, 0, 10531, 10533, 1, 0, 0, 0, 10532, 10512, 1, 0, 0, 0, + 10532, 10516, 1, 0, 0, 0, 10532, 10520, 1, 0, 0, 0, 10532, 10524, 1, 0, + 0, 0, 10532, 10528, 1, 0, 0, 0, 10533, 1413, 1, 0, 0, 0, 10534, 10535, + 5, 29, 0, 0, 10535, 1415, 1, 0, 0, 0, 10536, 10541, 3, 1370, 685, 0, 10537, + 10541, 3, 1404, 702, 0, 10538, 10541, 3, 1620, 810, 0, 10539, 10541, 3, + 1398, 699, 0, 10540, 10536, 1, 0, 0, 0, 10540, 10537, 1, 0, 0, 0, 10540, + 10538, 1, 0, 0, 0, 10540, 10539, 1, 0, 0, 0, 10541, 1417, 1, 0, 0, 0, 10542, + 10543, 5, 7, 0, 0, 10543, 1419, 1, 0, 0, 0, 10544, 10545, 3, 1422, 711, + 0, 10545, 10546, 5, 146, 0, 0, 10546, 10548, 3, 1464, 732, 0, 10547, 10549, + 3, 1600, 800, 0, 10548, 10547, 1, 0, 0, 0, 10548, 10549, 1, 0, 0, 0, 10549, + 10550, 1, 0, 0, 0, 10550, 10552, 5, 456, 0, 0, 10551, 10553, 3, 1614, 807, + 0, 10552, 10551, 1, 0, 0, 0, 10552, 10553, 1, 0, 0, 0, 10553, 1421, 1, + 0, 0, 0, 10554, 10556, 3, 1610, 805, 0, 10555, 10554, 1, 0, 0, 0, 10555, + 10556, 1, 0, 0, 0, 10556, 10561, 1, 0, 0, 0, 10557, 10559, 3, 1424, 712, + 0, 10558, 10560, 3, 1426, 713, 0, 10559, 10558, 1, 0, 0, 0, 10559, 10560, + 1, 0, 0, 0, 10560, 10562, 1, 0, 0, 0, 10561, 10557, 1, 0, 0, 0, 10561, + 10562, 1, 0, 0, 0, 10562, 1423, 1, 0, 0, 0, 10563, 10564, 5, 178, 0, 0, + 10564, 1425, 1, 0, 0, 0, 10565, 10567, 3, 1430, 715, 0, 10566, 10565, 1, + 0, 0, 0, 10567, 10568, 1, 0, 0, 0, 10568, 10566, 1, 0, 0, 0, 10568, 10569, + 1, 0, 0, 0, 10569, 1427, 1, 0, 0, 0, 10570, 10571, 5, 18, 0, 0, 10571, + 10572, 3, 1618, 809, 0, 10572, 10573, 5, 19, 0, 0, 10573, 1429, 1, 0, 0, + 0, 10574, 10578, 3, 1432, 716, 0, 10575, 10578, 5, 178, 0, 0, 10576, 10578, + 3, 1428, 714, 0, 10577, 10574, 1, 0, 0, 0, 10577, 10575, 1, 0, 0, 0, 10577, + 10576, 1, 0, 0, 0, 10578, 1431, 1, 0, 0, 0, 10579, 10606, 3, 1448, 724, + 0, 10580, 10581, 5, 498, 0, 0, 10581, 10582, 5, 62, 0, 0, 10582, 10607, + 3, 1446, 723, 0, 10583, 10585, 3, 1450, 725, 0, 10584, 10583, 1, 0, 0, + 0, 10584, 10585, 1, 0, 0, 0, 10585, 10586, 1, 0, 0, 0, 10586, 10588, 3, + 1452, 726, 0, 10587, 10589, 3, 1454, 727, 0, 10588, 10587, 1, 0, 0, 0, + 10588, 10589, 1, 0, 0, 0, 10589, 10591, 1, 0, 0, 0, 10590, 10592, 3, 1456, + 728, 0, 10591, 10590, 1, 0, 0, 0, 10591, 10592, 1, 0, 0, 0, 10592, 10594, + 1, 0, 0, 0, 10593, 10595, 3, 1458, 729, 0, 10594, 10593, 1, 0, 0, 0, 10594, + 10595, 1, 0, 0, 0, 10595, 10607, 1, 0, 0, 0, 10596, 10598, 3, 1434, 717, + 0, 10597, 10596, 1, 0, 0, 0, 10597, 10598, 1, 0, 0, 0, 10598, 10599, 1, + 0, 0, 0, 10599, 10601, 5, 172, 0, 0, 10600, 10602, 3, 1438, 719, 0, 10601, + 10600, 1, 0, 0, 0, 10601, 10602, 1, 0, 0, 0, 10602, 10603, 1, 0, 0, 0, + 10603, 10604, 3, 1444, 722, 0, 10604, 10605, 3, 1436, 718, 0, 10605, 10607, + 1, 0, 0, 0, 10606, 10580, 1, 0, 0, 0, 10606, 10584, 1, 0, 0, 0, 10606, + 10597, 1, 0, 0, 0, 10607, 10608, 1, 0, 0, 0, 10608, 10609, 5, 7, 0, 0, + 10609, 1433, 1, 0, 0, 0, 10610, 10611, 5, 262, 0, 0, 10611, 10614, 5, 317, + 0, 0, 10612, 10614, 5, 317, 0, 0, 10613, 10610, 1, 0, 0, 0, 10613, 10612, + 1, 0, 0, 0, 10614, 1435, 1, 0, 0, 0, 10615, 10616, 3, 970, 485, 0, 10616, + 1437, 1, 0, 0, 0, 10617, 10618, 5, 2, 0, 0, 10618, 10619, 3, 1440, 720, + 0, 10619, 10620, 5, 3, 0, 0, 10620, 1439, 1, 0, 0, 0, 10621, 10626, 3, + 1442, 721, 0, 10622, 10623, 5, 6, 0, 0, 10623, 10625, 3, 1442, 721, 0, + 10624, 10622, 1, 0, 0, 0, 10625, 10628, 1, 0, 0, 0, 10626, 10624, 1, 0, + 0, 0, 10626, 10627, 1, 0, 0, 0, 10627, 1441, 1, 0, 0, 0, 10628, 10626, + 1, 0, 0, 0, 10629, 10630, 3, 1448, 724, 0, 10630, 10631, 3, 1452, 726, + 0, 10631, 1443, 1, 0, 0, 0, 10632, 10633, 7, 69, 0, 0, 10633, 1445, 1, + 0, 0, 0, 10634, 10637, 5, 28, 0, 0, 10635, 10637, 3, 1384, 692, 0, 10636, + 10634, 1, 0, 0, 0, 10636, 10635, 1, 0, 0, 0, 10637, 1447, 1, 0, 0, 0, 10638, + 10639, 3, 1618, 809, 0, 10639, 1449, 1, 0, 0, 0, 10640, 10641, 5, 499, + 0, 0, 10641, 1451, 1, 0, 0, 0, 10642, 10643, 3, 1128, 564, 0, 10643, 1453, + 1, 0, 0, 0, 10644, 10645, 5, 43, 0, 0, 10645, 10646, 3, 528, 264, 0, 10646, + 1455, 1, 0, 0, 0, 10647, 10648, 5, 77, 0, 0, 10648, 10649, 5, 78, 0, 0, + 10649, 1457, 1, 0, 0, 0, 10650, 10651, 3, 1460, 730, 0, 10651, 10652, 3, + 1622, 811, 0, 10652, 1459, 1, 0, 0, 0, 10653, 10656, 3, 1462, 731, 0, 10654, + 10656, 5, 53, 0, 0, 10655, 10653, 1, 0, 0, 0, 10655, 10654, 1, 0, 0, 0, + 10656, 1461, 1, 0, 0, 0, 10657, 10658, 7, 70, 0, 0, 10658, 1463, 1, 0, + 0, 0, 10659, 10661, 3, 1466, 733, 0, 10660, 10659, 1, 0, 0, 0, 10661, 10664, + 1, 0, 0, 0, 10662, 10660, 1, 0, 0, 0, 10662, 10663, 1, 0, 0, 0, 10663, + 1465, 1, 0, 0, 0, 10664, 10662, 1, 0, 0, 0, 10665, 10666, 3, 1420, 710, + 0, 10666, 10667, 5, 7, 0, 0, 10667, 10693, 1, 0, 0, 0, 10668, 10693, 3, + 1532, 766, 0, 10669, 10693, 3, 1536, 768, 0, 10670, 10693, 3, 1474, 737, + 0, 10671, 10693, 3, 1490, 745, 0, 10672, 10693, 3, 1496, 748, 0, 10673, + 10693, 3, 1506, 753, 0, 10674, 10693, 3, 1508, 754, 0, 10675, 10693, 3, + 1510, 755, 0, 10676, 10693, 3, 1524, 762, 0, 10677, 10693, 3, 1528, 764, + 0, 10678, 10693, 3, 1548, 774, 0, 10679, 10693, 3, 1554, 777, 0, 10680, + 10693, 3, 1556, 778, 0, 10681, 10693, 3, 1468, 734, 0, 10682, 10693, 3, + 1470, 735, 0, 10683, 10693, 3, 1476, 738, 0, 10684, 10693, 3, 1564, 782, + 0, 10685, 10693, 3, 1576, 788, 0, 10686, 10693, 3, 1584, 792, 0, 10687, + 10693, 3, 1586, 793, 0, 10688, 10693, 3, 1588, 794, 0, 10689, 10693, 3, + 1590, 795, 0, 10690, 10693, 3, 1592, 796, 0, 10691, 10693, 3, 1596, 798, + 0, 10692, 10665, 1, 0, 0, 0, 10692, 10668, 1, 0, 0, 0, 10692, 10669, 1, + 0, 0, 0, 10692, 10670, 1, 0, 0, 0, 10692, 10671, 1, 0, 0, 0, 10692, 10672, + 1, 0, 0, 0, 10692, 10673, 1, 0, 0, 0, 10692, 10674, 1, 0, 0, 0, 10692, + 10675, 1, 0, 0, 0, 10692, 10676, 1, 0, 0, 0, 10692, 10677, 1, 0, 0, 0, + 10692, 10678, 1, 0, 0, 0, 10692, 10679, 1, 0, 0, 0, 10692, 10680, 1, 0, + 0, 0, 10692, 10681, 1, 0, 0, 0, 10692, 10682, 1, 0, 0, 0, 10692, 10683, + 1, 0, 0, 0, 10692, 10684, 1, 0, 0, 0, 10692, 10685, 1, 0, 0, 0, 10692, + 10686, 1, 0, 0, 0, 10692, 10687, 1, 0, 0, 0, 10692, 10688, 1, 0, 0, 0, + 10692, 10689, 1, 0, 0, 0, 10692, 10690, 1, 0, 0, 0, 10692, 10691, 1, 0, + 0, 0, 10693, 1467, 1, 0, 0, 0, 10694, 10695, 5, 500, 0, 0, 10695, 10696, + 3, 1626, 813, 0, 10696, 10697, 5, 7, 0, 0, 10697, 1469, 1, 0, 0, 0, 10698, + 10699, 5, 435, 0, 0, 10699, 10700, 3, 1618, 809, 0, 10700, 10702, 5, 2, + 0, 0, 10701, 10703, 3, 1472, 736, 0, 10702, 10701, 1, 0, 0, 0, 10702, 10703, + 1, 0, 0, 0, 10703, 10704, 1, 0, 0, 0, 10704, 10705, 5, 3, 0, 0, 10705, + 10706, 5, 7, 0, 0, 10706, 10717, 1, 0, 0, 0, 10707, 10708, 5, 57, 0, 0, + 10708, 10709, 3, 1618, 809, 0, 10709, 10711, 5, 2, 0, 0, 10710, 10712, + 3, 1472, 736, 0, 10711, 10710, 1, 0, 0, 0, 10711, 10712, 1, 0, 0, 0, 10712, + 10713, 1, 0, 0, 0, 10713, 10714, 5, 3, 0, 0, 10714, 10715, 5, 7, 0, 0, + 10715, 10717, 1, 0, 0, 0, 10716, 10698, 1, 0, 0, 0, 10716, 10707, 1, 0, + 0, 0, 10717, 1471, 1, 0, 0, 0, 10718, 10719, 3, 1290, 645, 0, 10719, 1473, + 1, 0, 0, 0, 10720, 10721, 3, 1488, 744, 0, 10721, 10722, 3, 1462, 731, + 0, 10722, 10723, 3, 1622, 811, 0, 10723, 10724, 5, 7, 0, 0, 10724, 1475, + 1, 0, 0, 0, 10725, 10727, 5, 501, 0, 0, 10726, 10728, 3, 1478, 739, 0, + 10727, 10726, 1, 0, 0, 0, 10727, 10728, 1, 0, 0, 0, 10728, 10729, 1, 0, + 0, 0, 10729, 10730, 5, 502, 0, 0, 10730, 10731, 3, 1480, 740, 0, 10731, + 10732, 5, 7, 0, 0, 10732, 1477, 1, 0, 0, 0, 10733, 10734, 7, 71, 0, 0, + 10734, 1479, 1, 0, 0, 0, 10735, 10740, 3, 1482, 741, 0, 10736, 10737, 5, + 6, 0, 0, 10737, 10739, 3, 1482, 741, 0, 10738, 10736, 1, 0, 0, 0, 10739, + 10742, 1, 0, 0, 0, 10740, 10738, 1, 0, 0, 0, 10740, 10741, 1, 0, 0, 0, + 10741, 1481, 1, 0, 0, 0, 10742, 10740, 1, 0, 0, 0, 10743, 10744, 3, 1486, + 743, 0, 10744, 10745, 3, 1462, 731, 0, 10745, 10746, 3, 1484, 742, 0, 10746, + 1483, 1, 0, 0, 0, 10747, 10748, 3, 1384, 692, 0, 10748, 1485, 1, 0, 0, + 0, 10749, 10750, 3, 1488, 744, 0, 10750, 1487, 1, 0, 0, 0, 10751, 10754, + 3, 528, 264, 0, 10752, 10754, 5, 28, 0, 0, 10753, 10751, 1, 0, 0, 0, 10753, + 10752, 1, 0, 0, 0, 10754, 10761, 1, 0, 0, 0, 10755, 10756, 5, 4, 0, 0, + 10756, 10757, 3, 1628, 814, 0, 10757, 10758, 5, 5, 0, 0, 10758, 10760, + 1, 0, 0, 0, 10759, 10755, 1, 0, 0, 0, 10760, 10763, 1, 0, 0, 0, 10761, + 10759, 1, 0, 0, 0, 10761, 10762, 1, 0, 0, 0, 10762, 1489, 1, 0, 0, 0, 10763, + 10761, 1, 0, 0, 0, 10764, 10765, 5, 220, 0, 0, 10765, 10766, 3, 1624, 812, + 0, 10766, 10767, 5, 93, 0, 0, 10767, 10768, 3, 1464, 732, 0, 10768, 10770, + 3, 1492, 746, 0, 10769, 10771, 3, 1494, 747, 0, 10770, 10769, 1, 0, 0, + 0, 10770, 10771, 1, 0, 0, 0, 10771, 10772, 1, 0, 0, 0, 10772, 10773, 5, + 456, 0, 0, 10773, 10774, 5, 220, 0, 0, 10774, 10775, 5, 7, 0, 0, 10775, + 1491, 1, 0, 0, 0, 10776, 10777, 5, 504, 0, 0, 10777, 10778, 3, 1172, 586, + 0, 10778, 10779, 5, 93, 0, 0, 10779, 10780, 3, 1464, 732, 0, 10780, 10782, + 1, 0, 0, 0, 10781, 10776, 1, 0, 0, 0, 10782, 10785, 1, 0, 0, 0, 10783, + 10781, 1, 0, 0, 0, 10783, 10784, 1, 0, 0, 0, 10784, 1493, 1, 0, 0, 0, 10785, + 10783, 1, 0, 0, 0, 10786, 10787, 5, 58, 0, 0, 10787, 10788, 3, 1464, 732, + 0, 10788, 1495, 1, 0, 0, 0, 10789, 10791, 5, 40, 0, 0, 10790, 10792, 3, + 1498, 749, 0, 10791, 10790, 1, 0, 0, 0, 10791, 10792, 1, 0, 0, 0, 10792, + 10793, 1, 0, 0, 0, 10793, 10795, 3, 1500, 750, 0, 10794, 10796, 3, 1504, + 752, 0, 10795, 10794, 1, 0, 0, 0, 10795, 10796, 1, 0, 0, 0, 10796, 10797, + 1, 0, 0, 0, 10797, 10798, 5, 456, 0, 0, 10798, 10799, 5, 40, 0, 0, 10799, + 10800, 5, 7, 0, 0, 10800, 1497, 1, 0, 0, 0, 10801, 10802, 3, 1622, 811, + 0, 10802, 1499, 1, 0, 0, 0, 10803, 10805, 3, 1502, 751, 0, 10804, 10803, + 1, 0, 0, 0, 10805, 10806, 1, 0, 0, 0, 10806, 10804, 1, 0, 0, 0, 10806, + 10807, 1, 0, 0, 0, 10807, 1501, 1, 0, 0, 0, 10808, 10809, 5, 102, 0, 0, + 10809, 10810, 3, 1290, 645, 0, 10810, 10811, 5, 93, 0, 0, 10811, 10812, + 3, 1464, 732, 0, 10812, 1503, 1, 0, 0, 0, 10813, 10814, 5, 58, 0, 0, 10814, + 10815, 3, 1464, 732, 0, 10815, 1505, 1, 0, 0, 0, 10816, 10818, 3, 1612, + 806, 0, 10817, 10816, 1, 0, 0, 0, 10817, 10818, 1, 0, 0, 0, 10818, 10819, + 1, 0, 0, 0, 10819, 10820, 3, 1552, 776, 0, 10820, 1507, 1, 0, 0, 0, 10821, + 10823, 3, 1612, 806, 0, 10822, 10821, 1, 0, 0, 0, 10822, 10823, 1, 0, 0, + 0, 10823, 10824, 1, 0, 0, 0, 10824, 10825, 5, 505, 0, 0, 10825, 10826, + 3, 1630, 815, 0, 10826, 10827, 3, 1552, 776, 0, 10827, 1509, 1, 0, 0, 0, + 10828, 10830, 3, 1612, 806, 0, 10829, 10828, 1, 0, 0, 0, 10829, 10830, + 1, 0, 0, 0, 10830, 10831, 1, 0, 0, 0, 10831, 10832, 5, 62, 0, 0, 10832, + 10833, 3, 1512, 756, 0, 10833, 10834, 3, 1552, 776, 0, 10834, 1511, 1, + 0, 0, 0, 10835, 10836, 3, 1522, 761, 0, 10836, 10857, 5, 68, 0, 0, 10837, + 10839, 3, 964, 482, 0, 10838, 10840, 3, 1516, 758, 0, 10839, 10838, 1, + 0, 0, 0, 10839, 10840, 1, 0, 0, 0, 10840, 10858, 1, 0, 0, 0, 10841, 10858, + 3, 970, 485, 0, 10842, 10858, 3, 888, 444, 0, 10843, 10844, 5, 202, 0, + 0, 10844, 10846, 3, 1172, 586, 0, 10845, 10847, 3, 1514, 757, 0, 10846, + 10845, 1, 0, 0, 0, 10846, 10847, 1, 0, 0, 0, 10847, 10858, 1, 0, 0, 0, + 10848, 10850, 3, 1518, 759, 0, 10849, 10848, 1, 0, 0, 0, 10849, 10850, + 1, 0, 0, 0, 10850, 10851, 1, 0, 0, 0, 10851, 10852, 3, 1172, 586, 0, 10852, + 10853, 5, 24, 0, 0, 10853, 10855, 3, 1172, 586, 0, 10854, 10856, 3, 1520, + 760, 0, 10855, 10854, 1, 0, 0, 0, 10855, 10856, 1, 0, 0, 0, 10856, 10858, + 1, 0, 0, 0, 10857, 10837, 1, 0, 0, 0, 10857, 10841, 1, 0, 0, 0, 10857, + 10842, 1, 0, 0, 0, 10857, 10843, 1, 0, 0, 0, 10857, 10849, 1, 0, 0, 0, + 10858, 1513, 1, 0, 0, 0, 10859, 10860, 5, 100, 0, 0, 10860, 10861, 3, 1290, + 645, 0, 10861, 1515, 1, 0, 0, 0, 10862, 10863, 5, 2, 0, 0, 10863, 10868, + 3, 1172, 586, 0, 10864, 10865, 5, 6, 0, 0, 10865, 10867, 3, 1172, 586, + 0, 10866, 10864, 1, 0, 0, 0, 10867, 10870, 1, 0, 0, 0, 10868, 10866, 1, + 0, 0, 0, 10868, 10869, 1, 0, 0, 0, 10869, 10871, 1, 0, 0, 0, 10870, 10868, + 1, 0, 0, 0, 10871, 10872, 5, 3, 0, 0, 10872, 1517, 1, 0, 0, 0, 10873, 10874, + 5, 506, 0, 0, 10874, 1519, 1, 0, 0, 0, 10875, 10876, 5, 147, 0, 0, 10876, + 10877, 3, 1172, 586, 0, 10877, 1521, 1, 0, 0, 0, 10878, 10879, 3, 526, + 263, 0, 10879, 1523, 1, 0, 0, 0, 10880, 10882, 3, 1612, 806, 0, 10881, + 10880, 1, 0, 0, 0, 10881, 10882, 1, 0, 0, 0, 10882, 10883, 1, 0, 0, 0, + 10883, 10884, 5, 507, 0, 0, 10884, 10886, 3, 1522, 761, 0, 10885, 10887, + 3, 1526, 763, 0, 10886, 10885, 1, 0, 0, 0, 10886, 10887, 1, 0, 0, 0, 10887, + 10888, 1, 0, 0, 0, 10888, 10889, 5, 68, 0, 0, 10889, 10890, 5, 35, 0, 0, + 10890, 10891, 3, 1172, 586, 0, 10891, 10892, 3, 1552, 776, 0, 10892, 1525, + 1, 0, 0, 0, 10893, 10894, 5, 508, 0, 0, 10894, 10895, 3, 1368, 684, 0, + 10895, 1527, 1, 0, 0, 0, 10896, 10898, 3, 1530, 765, 0, 10897, 10899, 3, + 1614, 807, 0, 10898, 10897, 1, 0, 0, 0, 10898, 10899, 1, 0, 0, 0, 10899, + 10901, 1, 0, 0, 0, 10900, 10902, 3, 1616, 808, 0, 10901, 10900, 1, 0, 0, + 0, 10901, 10902, 1, 0, 0, 0, 10902, 10903, 1, 0, 0, 0, 10903, 10904, 5, + 7, 0, 0, 10904, 1529, 1, 0, 0, 0, 10905, 10906, 7, 72, 0, 0, 10906, 1531, + 1, 0, 0, 0, 10907, 10922, 5, 510, 0, 0, 10908, 10909, 5, 261, 0, 0, 10909, + 10923, 3, 1622, 811, 0, 10910, 10917, 5, 511, 0, 0, 10911, 10912, 5, 202, + 0, 0, 10912, 10914, 3, 1172, 586, 0, 10913, 10915, 3, 1514, 757, 0, 10914, + 10913, 1, 0, 0, 0, 10914, 10915, 1, 0, 0, 0, 10915, 10918, 1, 0, 0, 0, + 10916, 10918, 3, 970, 485, 0, 10917, 10911, 1, 0, 0, 0, 10917, 10916, 1, + 0, 0, 0, 10918, 10923, 1, 0, 0, 0, 10919, 10921, 3, 1534, 767, 0, 10920, + 10919, 1, 0, 0, 0, 10920, 10921, 1, 0, 0, 0, 10921, 10923, 1, 0, 0, 0, + 10922, 10908, 1, 0, 0, 0, 10922, 10910, 1, 0, 0, 0, 10922, 10920, 1, 0, + 0, 0, 10923, 10924, 1, 0, 0, 0, 10924, 10925, 5, 7, 0, 0, 10925, 1533, + 1, 0, 0, 0, 10926, 10927, 3, 1622, 811, 0, 10927, 1535, 1, 0, 0, 0, 10928, + 10930, 5, 512, 0, 0, 10929, 10931, 3, 1538, 769, 0, 10930, 10929, 1, 0, + 0, 0, 10930, 10931, 1, 0, 0, 0, 10931, 10932, 1, 0, 0, 0, 10932, 10934, + 3, 1370, 685, 0, 10933, 10935, 3, 1540, 770, 0, 10934, 10933, 1, 0, 0, + 0, 10934, 10935, 1, 0, 0, 0, 10935, 10937, 1, 0, 0, 0, 10936, 10938, 3, + 1542, 771, 0, 10937, 10936, 1, 0, 0, 0, 10937, 10938, 1, 0, 0, 0, 10938, + 10939, 1, 0, 0, 0, 10939, 10940, 5, 7, 0, 0, 10940, 10972, 1, 0, 0, 0, + 10941, 10943, 5, 512, 0, 0, 10942, 10944, 3, 1538, 769, 0, 10943, 10942, + 1, 0, 0, 0, 10943, 10944, 1, 0, 0, 0, 10944, 10945, 1, 0, 0, 0, 10945, + 10947, 3, 1394, 697, 0, 10946, 10948, 3, 1542, 771, 0, 10947, 10946, 1, + 0, 0, 0, 10947, 10948, 1, 0, 0, 0, 10948, 10949, 1, 0, 0, 0, 10949, 10950, + 5, 7, 0, 0, 10950, 10972, 1, 0, 0, 0, 10951, 10953, 5, 512, 0, 0, 10952, + 10954, 3, 1538, 769, 0, 10953, 10952, 1, 0, 0, 0, 10953, 10954, 1, 0, 0, + 0, 10954, 10955, 1, 0, 0, 0, 10955, 10956, 5, 513, 0, 0, 10956, 10958, + 3, 1370, 685, 0, 10957, 10959, 3, 1542, 771, 0, 10958, 10957, 1, 0, 0, + 0, 10958, 10959, 1, 0, 0, 0, 10959, 10960, 1, 0, 0, 0, 10960, 10961, 5, + 7, 0, 0, 10961, 10972, 1, 0, 0, 0, 10962, 10964, 5, 512, 0, 0, 10963, 10965, + 3, 1538, 769, 0, 10964, 10963, 1, 0, 0, 0, 10964, 10965, 1, 0, 0, 0, 10965, + 10967, 1, 0, 0, 0, 10966, 10968, 3, 1542, 771, 0, 10967, 10966, 1, 0, 0, + 0, 10967, 10968, 1, 0, 0, 0, 10968, 10969, 1, 0, 0, 0, 10969, 10972, 5, + 7, 0, 0, 10970, 10972, 5, 512, 0, 0, 10971, 10928, 1, 0, 0, 0, 10971, 10941, + 1, 0, 0, 0, 10971, 10951, 1, 0, 0, 0, 10971, 10962, 1, 0, 0, 0, 10971, + 10970, 1, 0, 0, 0, 10972, 1537, 1, 0, 0, 0, 10973, 10974, 7, 73, 0, 0, + 10974, 1539, 1, 0, 0, 0, 10975, 10976, 5, 6, 0, 0, 10976, 10978, 3, 1172, + 586, 0, 10977, 10975, 1, 0, 0, 0, 10978, 10979, 1, 0, 0, 0, 10979, 10977, + 1, 0, 0, 0, 10979, 10980, 1, 0, 0, 0, 10980, 1541, 1, 0, 0, 0, 10981, 10982, + 5, 100, 0, 0, 10982, 10983, 3, 1546, 773, 0, 10983, 1543, 1, 0, 0, 0, 10984, + 10985, 3, 1394, 697, 0, 10985, 10986, 5, 10, 0, 0, 10986, 10987, 3, 1172, + 586, 0, 10987, 1545, 1, 0, 0, 0, 10988, 10993, 3, 1544, 772, 0, 10989, + 10990, 5, 6, 0, 0, 10990, 10992, 3, 1544, 772, 0, 10991, 10989, 1, 0, 0, + 0, 10992, 10995, 1, 0, 0, 0, 10993, 10991, 1, 0, 0, 0, 10993, 10994, 1, + 0, 0, 0, 10994, 1547, 1, 0, 0, 0, 10995, 10993, 1, 0, 0, 0, 10996, 10997, + 5, 520, 0, 0, 10997, 10999, 3, 1622, 811, 0, 10998, 11000, 3, 1550, 775, + 0, 10999, 10998, 1, 0, 0, 0, 10999, 11000, 1, 0, 0, 0, 11000, 11001, 1, + 0, 0, 0, 11001, 11002, 5, 7, 0, 0, 11002, 1549, 1, 0, 0, 0, 11003, 11004, + 5, 6, 0, 0, 11004, 11005, 3, 1622, 811, 0, 11005, 1551, 1, 0, 0, 0, 11006, + 11007, 5, 521, 0, 0, 11007, 11008, 3, 1464, 732, 0, 11008, 11009, 5, 456, + 0, 0, 11009, 11011, 5, 521, 0, 0, 11010, 11012, 3, 1614, 807, 0, 11011, + 11010, 1, 0, 0, 0, 11011, 11012, 1, 0, 0, 0, 11012, 11013, 1, 0, 0, 0, + 11013, 11014, 5, 7, 0, 0, 11014, 1553, 1, 0, 0, 0, 11015, 11016, 3, 1632, + 816, 0, 11016, 11017, 5, 7, 0, 0, 11017, 1555, 1, 0, 0, 0, 11018, 11019, + 5, 202, 0, 0, 11019, 11033, 3, 1172, 586, 0, 11020, 11022, 3, 1562, 781, + 0, 11021, 11020, 1, 0, 0, 0, 11021, 11022, 1, 0, 0, 0, 11022, 11024, 1, + 0, 0, 0, 11023, 11025, 3, 1558, 779, 0, 11024, 11023, 1, 0, 0, 0, 11024, + 11025, 1, 0, 0, 0, 11025, 11034, 1, 0, 0, 0, 11026, 11028, 3, 1558, 779, + 0, 11027, 11026, 1, 0, 0, 0, 11027, 11028, 1, 0, 0, 0, 11028, 11030, 1, + 0, 0, 0, 11029, 11031, 3, 1562, 781, 0, 11030, 11029, 1, 0, 0, 0, 11030, + 11031, 1, 0, 0, 0, 11031, 11034, 1, 0, 0, 0, 11032, 11034, 1, 0, 0, 0, + 11033, 11021, 1, 0, 0, 0, 11033, 11027, 1, 0, 0, 0, 11033, 11032, 1, 0, + 0, 0, 11034, 11035, 1, 0, 0, 0, 11035, 11036, 5, 7, 0, 0, 11036, 1557, + 1, 0, 0, 0, 11037, 11038, 5, 100, 0, 0, 11038, 11039, 3, 1560, 780, 0, + 11039, 1559, 1, 0, 0, 0, 11040, 11045, 3, 1172, 586, 0, 11041, 11042, 5, + 6, 0, 0, 11042, 11044, 3, 1172, 586, 0, 11043, 11041, 1, 0, 0, 0, 11044, + 11047, 1, 0, 0, 0, 11045, 11043, 1, 0, 0, 0, 11045, 11046, 1, 0, 0, 0, + 11046, 1561, 1, 0, 0, 0, 11047, 11045, 1, 0, 0, 0, 11048, 11050, 5, 71, + 0, 0, 11049, 11051, 5, 339, 0, 0, 11050, 11049, 1, 0, 0, 0, 11050, 11051, + 1, 0, 0, 0, 11051, 11052, 1, 0, 0, 0, 11052, 11053, 3, 1578, 789, 0, 11053, + 1563, 1, 0, 0, 0, 11054, 11075, 5, 522, 0, 0, 11055, 11057, 3, 1598, 799, + 0, 11056, 11058, 3, 1572, 786, 0, 11057, 11056, 1, 0, 0, 0, 11057, 11058, + 1, 0, 0, 0, 11058, 11059, 1, 0, 0, 0, 11059, 11066, 5, 62, 0, 0, 11060, + 11067, 3, 970, 485, 0, 11061, 11062, 5, 202, 0, 0, 11062, 11064, 3, 1622, + 811, 0, 11063, 11065, 3, 1570, 785, 0, 11064, 11063, 1, 0, 0, 0, 11064, + 11065, 1, 0, 0, 0, 11065, 11067, 1, 0, 0, 0, 11066, 11060, 1, 0, 0, 0, + 11066, 11061, 1, 0, 0, 0, 11067, 11076, 1, 0, 0, 0, 11068, 11073, 3, 1384, + 692, 0, 11069, 11070, 5, 2, 0, 0, 11070, 11071, 3, 1568, 784, 0, 11071, + 11072, 5, 3, 0, 0, 11072, 11074, 1, 0, 0, 0, 11073, 11069, 1, 0, 0, 0, + 11073, 11074, 1, 0, 0, 0, 11074, 11076, 1, 0, 0, 0, 11075, 11055, 1, 0, + 0, 0, 11075, 11068, 1, 0, 0, 0, 11076, 11077, 1, 0, 0, 0, 11077, 11078, + 5, 7, 0, 0, 11078, 1565, 1, 0, 0, 0, 11079, 11080, 3, 1384, 692, 0, 11080, + 11081, 5, 20, 0, 0, 11081, 11082, 3, 1172, 586, 0, 11082, 11085, 1, 0, + 0, 0, 11083, 11085, 3, 1172, 586, 0, 11084, 11079, 1, 0, 0, 0, 11084, 11083, + 1, 0, 0, 0, 11085, 1567, 1, 0, 0, 0, 11086, 11091, 3, 1566, 783, 0, 11087, + 11088, 5, 6, 0, 0, 11088, 11090, 3, 1566, 783, 0, 11089, 11087, 1, 0, 0, + 0, 11090, 11093, 1, 0, 0, 0, 11091, 11089, 1, 0, 0, 0, 11091, 11092, 1, + 0, 0, 0, 11092, 1569, 1, 0, 0, 0, 11093, 11091, 1, 0, 0, 0, 11094, 11095, + 5, 100, 0, 0, 11095, 11096, 3, 1290, 645, 0, 11096, 1571, 1, 0, 0, 0, 11097, + 11099, 3, 1574, 787, 0, 11098, 11097, 1, 0, 0, 0, 11098, 11099, 1, 0, 0, + 0, 11099, 11100, 1, 0, 0, 0, 11100, 11101, 5, 317, 0, 0, 11101, 1573, 1, + 0, 0, 0, 11102, 11103, 5, 262, 0, 0, 11103, 1575, 1, 0, 0, 0, 11104, 11106, + 5, 61, 0, 0, 11105, 11107, 3, 1582, 791, 0, 11106, 11105, 1, 0, 0, 0, 11106, + 11107, 1, 0, 0, 0, 11107, 11109, 1, 0, 0, 0, 11108, 11110, 3, 1580, 790, + 0, 11109, 11108, 1, 0, 0, 0, 11109, 11110, 1, 0, 0, 0, 11110, 11111, 1, + 0, 0, 0, 11111, 11112, 3, 1598, 799, 0, 11112, 11113, 5, 71, 0, 0, 11113, + 11114, 3, 1578, 789, 0, 11114, 11115, 5, 7, 0, 0, 11115, 1577, 1, 0, 0, + 0, 11116, 11117, 3, 1290, 645, 0, 11117, 1579, 1, 0, 0, 0, 11118, 11119, + 7, 26, 0, 0, 11119, 1581, 1, 0, 0, 0, 11120, 11136, 5, 261, 0, 0, 11121, + 11136, 5, 286, 0, 0, 11122, 11136, 5, 207, 0, 0, 11123, 11136, 5, 240, + 0, 0, 11124, 11125, 5, 130, 0, 0, 11125, 11136, 3, 1172, 586, 0, 11126, + 11127, 5, 300, 0, 0, 11127, 11136, 3, 1172, 586, 0, 11128, 11136, 3, 1172, + 586, 0, 11129, 11136, 5, 30, 0, 0, 11130, 11133, 7, 74, 0, 0, 11131, 11134, + 3, 1172, 586, 0, 11132, 11134, 5, 30, 0, 0, 11133, 11131, 1, 0, 0, 0, 11133, + 11132, 1, 0, 0, 0, 11133, 11134, 1, 0, 0, 0, 11134, 11136, 1, 0, 0, 0, + 11135, 11120, 1, 0, 0, 0, 11135, 11121, 1, 0, 0, 0, 11135, 11122, 1, 0, + 0, 0, 11135, 11123, 1, 0, 0, 0, 11135, 11124, 1, 0, 0, 0, 11135, 11126, + 1, 0, 0, 0, 11135, 11128, 1, 0, 0, 0, 11135, 11129, 1, 0, 0, 0, 11135, + 11130, 1, 0, 0, 0, 11136, 1583, 1, 0, 0, 0, 11137, 11139, 5, 258, 0, 0, + 11138, 11140, 3, 1582, 791, 0, 11139, 11138, 1, 0, 0, 0, 11139, 11140, + 1, 0, 0, 0, 11140, 11141, 1, 0, 0, 0, 11141, 11142, 3, 1598, 799, 0, 11142, + 11143, 5, 7, 0, 0, 11143, 1585, 1, 0, 0, 0, 11144, 11145, 5, 157, 0, 0, + 11145, 11146, 3, 1598, 799, 0, 11146, 11147, 5, 7, 0, 0, 11147, 1587, 1, + 0, 0, 0, 11148, 11149, 5, 78, 0, 0, 11149, 11150, 5, 7, 0, 0, 11150, 1589, + 1, 0, 0, 0, 11151, 11153, 5, 161, 0, 0, 11152, 11154, 3, 1594, 797, 0, + 11153, 11152, 1, 0, 0, 0, 11153, 11154, 1, 0, 0, 0, 11154, 11155, 1, 0, + 0, 0, 11155, 11156, 5, 7, 0, 0, 11156, 1591, 1, 0, 0, 0, 11157, 11159, + 5, 312, 0, 0, 11158, 11160, 3, 1594, 797, 0, 11159, 11158, 1, 0, 0, 0, + 11159, 11160, 1, 0, 0, 0, 11160, 11161, 1, 0, 0, 0, 11161, 11162, 5, 7, + 0, 0, 11162, 1593, 1, 0, 0, 0, 11163, 11165, 5, 33, 0, 0, 11164, 11166, + 5, 262, 0, 0, 11165, 11164, 1, 0, 0, 0, 11165, 11166, 1, 0, 0, 0, 11166, + 11167, 1, 0, 0, 0, 11167, 11168, 5, 153, 0, 0, 11168, 1595, 1, 0, 0, 0, + 11169, 11170, 5, 326, 0, 0, 11170, 11171, 3, 528, 264, 0, 11171, 11172, + 5, 94, 0, 0, 11172, 11173, 5, 53, 0, 0, 11173, 11174, 5, 7, 0, 0, 11174, + 11182, 1, 0, 0, 0, 11175, 11178, 5, 306, 0, 0, 11176, 11179, 3, 528, 264, + 0, 11177, 11179, 5, 30, 0, 0, 11178, 11176, 1, 0, 0, 0, 11178, 11177, 1, + 0, 0, 0, 11179, 11180, 1, 0, 0, 0, 11180, 11182, 5, 7, 0, 0, 11181, 11169, + 1, 0, 0, 0, 11181, 11175, 1, 0, 0, 0, 11182, 1597, 1, 0, 0, 0, 11183, 11186, + 3, 1384, 692, 0, 11184, 11186, 5, 28, 0, 0, 11185, 11183, 1, 0, 0, 0, 11185, + 11184, 1, 0, 0, 0, 11186, 1599, 1, 0, 0, 0, 11187, 11188, 5, 519, 0, 0, + 11188, 11189, 3, 1602, 801, 0, 11189, 1601, 1, 0, 0, 0, 11190, 11192, 3, + 1604, 802, 0, 11191, 11190, 1, 0, 0, 0, 11192, 11193, 1, 0, 0, 0, 11193, + 11191, 1, 0, 0, 0, 11193, 11194, 1, 0, 0, 0, 11194, 1603, 1, 0, 0, 0, 11195, + 11196, 5, 102, 0, 0, 11196, 11197, 3, 1606, 803, 0, 11197, 11198, 5, 93, + 0, 0, 11198, 11199, 3, 1464, 732, 0, 11199, 1605, 1, 0, 0, 0, 11200, 11205, + 3, 1608, 804, 0, 11201, 11202, 5, 82, 0, 0, 11202, 11204, 3, 1608, 804, + 0, 11203, 11201, 1, 0, 0, 0, 11204, 11207, 1, 0, 0, 0, 11205, 11203, 1, + 0, 0, 0, 11205, 11206, 1, 0, 0, 0, 11206, 1607, 1, 0, 0, 0, 11207, 11205, + 1, 0, 0, 0, 11208, 11212, 3, 1618, 809, 0, 11209, 11210, 5, 513, 0, 0, + 11210, 11212, 3, 1370, 685, 0, 11211, 11208, 1, 0, 0, 0, 11211, 11209, + 1, 0, 0, 0, 11212, 1609, 1, 0, 0, 0, 11213, 11214, 3, 1428, 714, 0, 11214, + 1611, 1, 0, 0, 0, 11215, 11216, 3, 1428, 714, 0, 11216, 1613, 1, 0, 0, + 0, 11217, 11218, 3, 1618, 809, 0, 11218, 1615, 1, 0, 0, 0, 11219, 11220, + 5, 102, 0, 0, 11220, 11221, 3, 1626, 813, 0, 11221, 1617, 1, 0, 0, 0, 11222, + 11225, 3, 1384, 692, 0, 11223, 11225, 3, 1620, 810, 0, 11224, 11222, 1, + 0, 0, 0, 11224, 11223, 1, 0, 0, 0, 11225, 1619, 1, 0, 0, 0, 11226, 11227, + 7, 75, 0, 0, 11227, 1621, 1, 0, 0, 0, 11228, 11230, 3, 1338, 669, 0, 11229, + 11228, 1, 0, 0, 0, 11229, 11230, 1, 0, 0, 0, 11230, 11232, 1, 0, 0, 0, + 11231, 11233, 3, 992, 496, 0, 11232, 11231, 1, 0, 0, 0, 11232, 11233, 1, + 0, 0, 0, 11233, 11235, 1, 0, 0, 0, 11234, 11236, 3, 1064, 532, 0, 11235, + 11234, 1, 0, 0, 0, 11235, 11236, 1, 0, 0, 0, 11236, 11238, 1, 0, 0, 0, + 11237, 11239, 3, 1104, 552, 0, 11238, 11237, 1, 0, 0, 0, 11238, 11239, + 1, 0, 0, 0, 11239, 11241, 1, 0, 0, 0, 11240, 11242, 3, 1034, 517, 0, 11241, + 11240, 1, 0, 0, 0, 11241, 11242, 1, 0, 0, 0, 11242, 11244, 1, 0, 0, 0, + 11243, 11245, 3, 1048, 524, 0, 11244, 11243, 1, 0, 0, 0, 11244, 11245, + 1, 0, 0, 0, 11245, 11247, 1, 0, 0, 0, 11246, 11248, 3, 1250, 625, 0, 11247, + 11246, 1, 0, 0, 0, 11247, 11248, 1, 0, 0, 0, 11248, 1623, 1, 0, 0, 0, 11249, + 11250, 3, 1622, 811, 0, 11250, 1625, 1, 0, 0, 0, 11251, 11252, 3, 1622, + 811, 0, 11252, 1627, 1, 0, 0, 0, 11253, 11254, 3, 1172, 586, 0, 11254, + 1629, 1, 0, 0, 0, 11255, 11256, 3, 1172, 586, 0, 11256, 1631, 1, 0, 0, + 0, 11257, 11259, 3, 8, 4, 0, 11258, 11260, 3, 1634, 817, 0, 11259, 11258, + 1, 0, 0, 0, 11259, 11260, 1, 0, 0, 0, 11260, 1633, 1, 0, 0, 0, 11261, 11263, + 5, 71, 0, 0, 11262, 11264, 3, 994, 497, 0, 11263, 11262, 1, 0, 0, 0, 11263, + 11264, 1, 0, 0, 0, 11264, 11265, 1, 0, 0, 0, 11265, 11266, 3, 1578, 789, + 0, 11266, 1635, 1, 0, 0, 0, 1119, 1645, 1649, 1777, 1781, 1790, 1799, 1805, + 1811, 1826, 1838, 1844, 1852, 1863, 1867, 1875, 1883, 1901, 1904, 1909, + 1918, 1927, 1931, 1943, 1963, 1976, 1983, 1991, 1996, 2003, 2009, 2016, + 2027, 2031, 2035, 2048, 2052, 2057, 2062, 2074, 2083, 2096, 2101, 2112, + 2118, 2124, 2129, 2140, 2146, 2152, 2161, 2171, 2186, 2192, 2199, 2204, + 2211, 2222, 2246, 2253, 2262, 2271, 2279, 2289, 2298, 2307, 2315, 2323, + 2332, 2341, 2345, 2352, 2360, 2370, 2376, 2380, 2384, 2388, 2392, 2397, + 2400, 2404, 2425, 2431, 2530, 2537, 2553, 2567, 2577, 2579, 2584, 2588, + 2591, 2597, 2599, 2627, 2637, 2650, 2657, 2663, 2667, 2673, 2678, 2681, + 2683, 2688, 2692, 2696, 2700, 2704, 2707, 2711, 2719, 2723, 2727, 2736, + 2743, 2748, 2755, 2760, 2767, 2772, 2790, 2795, 2807, 2812, 2821, 2828, + 2835, 2841, 2846, 2850, 2853, 2856, 2859, 2862, 2865, 2870, 2873, 2876, + 2879, 2882, 2885, 2891, 2895, 2898, 2901, 2904, 2907, 2909, 2918, 2931, + 2939, 2945, 2949, 2955, 2963, 2966, 2970, 2998, 3003, 3010, 3021, 3028, + 3031, 3034, 3039, 3042, 3049, 3058, 3065, 3070, 3073, 3076, 3078, 3082, + 3089, 3096, 3106, 3116, 3126, 3132, 3135, 3138, 3145, 3153, 3156, 3159, + 3166, 3170, 3176, 3179, 3182, 3185, 3197, 3200, 3203, 3207, 3221, 3239, + 3250, 3265, 3282, 3284, 3305, 3310, 3313, 3317, 3320, 3326, 3329, 3331, + 3340, 3349, 3368, 3372, 3383, 3392, 3398, 3404, 3408, 3411, 3414, 3417, + 3420, 3426, 3430, 3437, 3443, 3447, 3450, 3453, 3456, 3464, 3468, 3472, + 3478, 3482, 3488, 3502, 3511, 3529, 3534, 3537, 3540, 3550, 3557, 3562, + 3565, 3568, 3575, 3578, 3580, 3586, 3595, 3605, 3610, 3619, 3628, 3632, + 3639, 3649, 3660, 3770, 3778, 3781, 3791, 3796, 3806, 3817, 3829, 3842, + 3852, 3865, 3868, 3875, 3884, 3887, 3894, 3896, 3904, 3914, 3916, 3924, + 3928, 3933, 3944, 3948, 3953, 3963, 3969, 3982, 3988, 3990, 3997, 4005, + 4010, 4025, 4038, 4040, 4044, 4064, 4081, 4084, 4087, 4090, 4093, 4101, + 4104, 4107, 4153, 4156, 4159, 4177, 4184, 4193, 4199, 4206, 4216, 4224, + 4229, 4241, 4258, 4264, 4271, 4279, 4293, 4321, 4328, 4342, 4357, 4370, + 4379, 4404, 4415, 4482, 4493, 4499, 4507, 4518, 4532, 4541, 4551, 4563, + 4578, 4589, 4597, 4607, 4614, 4617, 4623, 4626, 4641, 4654, 4683, 4690, + 4705, 4714, 4725, 4727, 4736, 4747, 4749, 4756, 4771, 4777, 4785, 4791, + 4799, 4809, 4815, 4823, 4829, 4837, 4844, 4853, 4855, 4880, 4887, 4898, + 4904, 4913, 4918, 4924, 4931, 4936, 4940, 4943, 4949, 5098, 5102, 5107, + 5118, 5129, 5140, 5151, 5162, 5173, 5184, 5196, 5207, 5215, 5222, 5228, + 5236, 5241, 5246, 5251, 5257, 5264, 5270, 5276, 5281, 5287, 5294, 5299, + 5305, 5312, 5315, 5328, 5337, 5349, 5351, 5368, 5375, 5380, 5384, 5388, + 5394, 5396, 5458, 5465, 5471, 5478, 5484, 5495, 5498, 5505, 5508, 5518, + 5521, 5523, 5542, 5554, 5563, 5572, 5584, 5586, 5592, 5596, 5601, 5604, + 5609, 5615, 5618, 5621, 5624, 5627, 5643, 5647, 5650, 5653, 5656, 5659, + 5664, 5667, 5669, 5682, 5694, 5708, 5712, 5724, 5726, 5735, 5744, 5752, + 5761, 5763, 5767, 5776, 5781, 5787, 5792, 5796, 5801, 5807, 5813, 5819, + 5825, 5830, 5845, 5854, 5865, 5871, 5910, 5925, 5932, 5943, 5957, 5965, + 5970, 5978, 5986, 5992, 6000, 6006, 6014, 6016, 6022, 6030, 6032, 6038, + 6046, 6048, 6072, 6079, 6089, 6101, 6106, 6119, 6131, 6143, 6145, 6151, + 6156, 6164, 6171, 6216, 6221, 6228, 6233, 6240, 6250, 6260, 6264, 6275, + 6292, 6363, 6558, 6571, 6582, 6595, 6607, 6621, 6653, 6667, 6779, 6781, + 6792, 6803, 6814, 6827, 6839, 6850, 6857, 7078, 7093, 7104, 7111, 7165, + 7306, 7312, 7321, 7329, 7331, 7338, 7344, 7347, 7354, 7358, 7361, 7366, + 7369, 7373, 7376, 7379, 7410, 7420, 7427, 7450, 7459, 7477, 7483, 7491, + 7493, 7497, 7507, 7511, 7521, 7524, 7528, 7532, 7540, 7551, 7563, 7567, + 7570, 7574, 7577, 7582, 7586, 7589, 7593, 7596, 7600, 7603, 7614, 7621, + 7634, 7648, 7652, 7657, 7664, 7671, 7674, 7679, 7682, 7691, 7693, 7698, + 7702, 7714, 7717, 7724, 7728, 7733, 7743, 7752, 7755, 7763, 7774, 7778, + 7784, 7791, 7811, 7832, 7836, 7841, 7924, 7930, 7943, 7947, 7951, 7955, + 7961, 7968, 7971, 7974, 7977, 7980, 7987, 7989, 7993, 7996, 8003, 8005, + 8012, 8019, 8023, 8027, 8043, 8050, 8060, 8073, 8084, 8091, 8096, 8100, + 8104, 8109, 8123, 8128, 8132, 8140, 8143, 8147, 8158, 8161, 8163, 8179, + 8182, 8189, 8192, 8197, 8212, 8218, 8227, 8236, 8243, 8246, 8252, 8257, + 8263, 8268, 8272, 8277, 8280, 8286, 8290, 8292, 8295, 8302, 8305, 8312, + 8320, 8323, 8332, 8337, 8343, 8346, 8349, 8356, 8360, 8363, 8378, 8381, + 8388, 8391, 8398, 8401, 8404, 8411, 8424, 8434, 8442, 8454, 8456, 8463, + 8467, 8477, 8481, 8485, 8489, 8491, 8496, 8500, 8504, 8506, 8508, 8513, + 8518, 8524, 8529, 8534, 8537, 8540, 8545, 8548, 8551, 8554, 8557, 8560, + 8563, 8569, 8573, 8582, 8587, 8591, 8600, 8606, 8610, 8615, 8619, 8624, + 8630, 8642, 8657, 8664, 8666, 8669, 8673, 8677, 8679, 8687, 8696, 8702, + 8704, 8706, 8713, 8717, 8726, 8730, 8745, 8753, 8781, 8788, 8792, 8795, + 8800, 8804, 8807, 8823, 8834, 8839, 8842, 8846, 8850, 8854, 8859, 8863, + 8867, 8869, 8878, 8883, 8889, 8893, 8895, 8900, 8904, 8915, 8919, 8922, + 8929, 8934, 8941, 8946, 8949, 8955, 8959, 8968, 8972, 8980, 8982, 8989, + 8994, 8997, 9005, 9014, 9022, 9024, 9028, 9035, 9054, 9063, 9069, 9088, + 9097, 9103, 9107, 9112, 9122, 9129, 9138, 9141, 9150, 9152, 9158, 9162, + 9167, 9177, 9183, 9185, 9191, 9197, 9200, 9203, 9216, 9222, 9226, 9230, + 9233, 9241, 9245, 9249, 9257, 9264, 9271, 9275, 9281, 9283, 9292, 9295, + 9305, 9321, 9327, 9332, 9339, 9348, 9355, 9363, 9371, 9376, 9380, 9386, + 9390, 9394, 9397, 9403, 9408, 9424, 9427, 9429, 9441, 9443, 9447, 9453, + 9457, 9459, 9467, 9471, 9480, 9488, 9494, 9497, 9506, 9511, 9518, 9528, + 9554, 9565, 9567, 9569, 9577, 9600, 9608, 9618, 9621, 9626, 9631, 9635, + 9641, 9644, 9647, 9650, 9654, 9668, 9675, 9682, 9689, 9707, 9715, 9727, + 9745, 9784, 9786, 9806, 9816, 9827, 9839, 9846, 9858, 9870, 9876, 9884, + 9901, 9926, 9936, 9940, 9943, 9946, 9949, 9962, 9967, 9972, 9974, 9982, + 9991, 10000, 10005, 10014, 10019, 10033, 10043, 10051, 10065, 10072, 10080, + 10088, 10095, 10101, 10110, 10125, 10136, 10169, 10178, 10185, 10189, 10193, + 10200, 10214, 10219, 10224, 10228, 10230, 10233, 10240, 10245, 10255, 10260, + 10263, 10268, 10275, 10280, 10287, 10303, 10315, 10320, 10328, 10335, 10340, + 10352, 10360, 10365, 10375, 10382, 10389, 10398, 10404, 10410, 10416, 10424, + 10428, 10435, 10493, 10504, 10509, 10532, 10540, 10548, 10552, 10555, 10559, + 10561, 10568, 10577, 10584, 10588, 10591, 10594, 10597, 10601, 10606, 10613, + 10626, 10636, 10655, 10662, 10692, 10702, 10711, 10716, 10727, 10740, 10753, + 10761, 10770, 10783, 10791, 10795, 10806, 10817, 10822, 10829, 10839, 10846, + 10849, 10855, 10857, 10868, 10881, 10886, 10898, 10901, 10914, 10917, 10920, + 10922, 10930, 10934, 10937, 10943, 10947, 10953, 10958, 10964, 10967, 10971, + 10979, 10993, 10999, 11011, 11021, 11024, 11027, 11030, 11033, 11045, 11050, + 11057, 11064, 11066, 11073, 11075, 11084, 11091, 11098, 11106, 11109, 11133, + 11135, 11139, 11153, 11159, 11165, 11178, 11181, 11185, 11193, 11205, 11211, + 11224, 11229, 11232, 11235, 11238, 11241, 11244, 11247, 11259, 11263, + } + deserializer := antlr.NewATNDeserializer(nil) + staticData.atn = deserializer.Deserialize(staticData.serializedATN) + atn := staticData.atn + staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) + decisionToDFA := staticData.decisionToDFA + for index, state := range atn.DecisionToState { + decisionToDFA[index] = antlr.NewDFA(state, index) + } +} + +// PostgreSQLParserInit initializes any static state used to implement PostgreSQLParser. By default the +// static state used to implement the parser is lazily initialized during the first call to +// NewPostgreSQLParser(). You can call this function if you wish to initialize the static state ahead +// of time. +func PostgreSQLParserInit() { + staticData := &PostgreSQLParserParserStaticData + staticData.once.Do(postgresqlparserParserInit) +} + +// NewPostgreSQLParser produces a new parser instance for the optional input antlr.TokenStream. +func NewPostgreSQLParser(input antlr.TokenStream) *PostgreSQLParser { + PostgreSQLParserInit() + this := new(PostgreSQLParser) + this.BaseParser = antlr.NewBaseParser(input) + staticData := &PostgreSQLParserParserStaticData + this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + this.RuleNames = staticData.RuleNames + this.LiteralNames = staticData.LiteralNames + this.SymbolicNames = staticData.SymbolicNames + this.GrammarFileName = "PostgreSQLParser.g4" + + return this +} + +// Note that '@members' cannot be changed now, but this should have been 'globals' +// If you are looking to have variables for each instance, use '@structmembers' + +// PostgreSQLParser tokens. +const ( + PostgreSQLParserEOF = antlr.TokenEOF + PostgreSQLParserDollar = 1 + PostgreSQLParserOPEN_PAREN = 2 + PostgreSQLParserCLOSE_PAREN = 3 + PostgreSQLParserOPEN_BRACKET = 4 + PostgreSQLParserCLOSE_BRACKET = 5 + PostgreSQLParserCOMMA = 6 + PostgreSQLParserSEMI = 7 + PostgreSQLParserCOLON = 8 + PostgreSQLParserSTAR = 9 + PostgreSQLParserEQUAL = 10 + PostgreSQLParserDOT = 11 + PostgreSQLParserPLUS = 12 + PostgreSQLParserMINUS = 13 + PostgreSQLParserSLASH = 14 + PostgreSQLParserCARET = 15 + PostgreSQLParserLT = 16 + PostgreSQLParserGT = 17 + PostgreSQLParserLESS_LESS = 18 + PostgreSQLParserGREATER_GREATER = 19 + PostgreSQLParserCOLON_EQUALS = 20 + PostgreSQLParserLESS_EQUALS = 21 + PostgreSQLParserEQUALS_GREATER = 22 + PostgreSQLParserGREATER_EQUALS = 23 + PostgreSQLParserDOT_DOT = 24 + PostgreSQLParserNOT_EQUALS = 25 + PostgreSQLParserTYPECAST = 26 + PostgreSQLParserPERCENT = 27 + PostgreSQLParserPARAM = 28 + PostgreSQLParserOperator = 29 + PostgreSQLParserALL = 30 + PostgreSQLParserANALYSE = 31 + PostgreSQLParserANALYZE = 32 + PostgreSQLParserAND = 33 + PostgreSQLParserANY = 34 + PostgreSQLParserARRAY = 35 + PostgreSQLParserAS = 36 + PostgreSQLParserASC = 37 + PostgreSQLParserASYMMETRIC = 38 + PostgreSQLParserBOTH = 39 + PostgreSQLParserCASE = 40 + PostgreSQLParserCAST = 41 + PostgreSQLParserCHECK = 42 + PostgreSQLParserCOLLATE = 43 + PostgreSQLParserCOLUMN = 44 + PostgreSQLParserCONSTRAINT = 45 + PostgreSQLParserCREATE = 46 + PostgreSQLParserCURRENT_CATALOG = 47 + PostgreSQLParserCURRENT_DATE = 48 + PostgreSQLParserCURRENT_ROLE = 49 + PostgreSQLParserCURRENT_TIME = 50 + PostgreSQLParserCURRENT_TIMESTAMP = 51 + PostgreSQLParserCURRENT_USER = 52 + PostgreSQLParserDEFAULT = 53 + PostgreSQLParserDEFERRABLE = 54 + PostgreSQLParserDESC = 55 + PostgreSQLParserDISTINCT = 56 + PostgreSQLParserDO = 57 + PostgreSQLParserELSE = 58 + PostgreSQLParserEXCEPT = 59 + PostgreSQLParserFALSE_P = 60 + PostgreSQLParserFETCH = 61 + PostgreSQLParserFOR = 62 + PostgreSQLParserFOREIGN = 63 + PostgreSQLParserFROM = 64 + PostgreSQLParserGRANT = 65 + PostgreSQLParserGROUP_P = 66 + PostgreSQLParserHAVING = 67 + PostgreSQLParserIN_P = 68 + PostgreSQLParserINITIALLY = 69 + PostgreSQLParserINTERSECT = 70 + PostgreSQLParserINTO = 71 + PostgreSQLParserLATERAL_P = 72 + PostgreSQLParserLEADING = 73 + PostgreSQLParserLIMIT = 74 + PostgreSQLParserLOCALTIME = 75 + PostgreSQLParserLOCALTIMESTAMP = 76 + PostgreSQLParserNOT = 77 + PostgreSQLParserNULL_P = 78 + PostgreSQLParserOFFSET = 79 + PostgreSQLParserON = 80 + PostgreSQLParserONLY = 81 + PostgreSQLParserOR = 82 + PostgreSQLParserORDER = 83 + PostgreSQLParserPLACING = 84 + PostgreSQLParserPRIMARY = 85 + PostgreSQLParserREFERENCES = 86 + PostgreSQLParserRETURNING = 87 + PostgreSQLParserSELECT = 88 + PostgreSQLParserSESSION_USER = 89 + PostgreSQLParserSOME = 90 + PostgreSQLParserSYMMETRIC = 91 + PostgreSQLParserTABLE = 92 + PostgreSQLParserTHEN = 93 + PostgreSQLParserTO = 94 + PostgreSQLParserTRAILING = 95 + PostgreSQLParserTRUE_P = 96 + PostgreSQLParserUNION = 97 + PostgreSQLParserUNIQUE = 98 + PostgreSQLParserUSER = 99 + PostgreSQLParserUSING = 100 + PostgreSQLParserVARIADIC = 101 + PostgreSQLParserWHEN = 102 + PostgreSQLParserWHERE = 103 + PostgreSQLParserWINDOW = 104 + PostgreSQLParserWITH = 105 + PostgreSQLParserAUTHORIZATION = 106 + PostgreSQLParserBINARY = 107 + PostgreSQLParserCOLLATION = 108 + PostgreSQLParserCONCURRENTLY = 109 + PostgreSQLParserCROSS = 110 + PostgreSQLParserCURRENT_SCHEMA = 111 + PostgreSQLParserFREEZE = 112 + PostgreSQLParserFULL = 113 + PostgreSQLParserILIKE = 114 + PostgreSQLParserINNER_P = 115 + PostgreSQLParserIS = 116 + PostgreSQLParserISNULL = 117 + PostgreSQLParserJOIN = 118 + PostgreSQLParserLEFT = 119 + PostgreSQLParserLIKE = 120 + PostgreSQLParserNATURAL = 121 + PostgreSQLParserNOTNULL = 122 + PostgreSQLParserOUTER_P = 123 + PostgreSQLParserOVER = 124 + PostgreSQLParserOVERLAPS = 125 + PostgreSQLParserRIGHT = 126 + PostgreSQLParserSIMILAR = 127 + PostgreSQLParserVERBOSE = 128 + PostgreSQLParserABORT_P = 129 + PostgreSQLParserABSOLUTE_P = 130 + PostgreSQLParserACCESS = 131 + PostgreSQLParserACTION = 132 + PostgreSQLParserADD_P = 133 + PostgreSQLParserADMIN = 134 + PostgreSQLParserAFTER = 135 + PostgreSQLParserAGGREGATE = 136 + PostgreSQLParserALSO = 137 + PostgreSQLParserALTER = 138 + PostgreSQLParserALWAYS = 139 + PostgreSQLParserASSERTION = 140 + PostgreSQLParserASSIGNMENT = 141 + PostgreSQLParserAT = 142 + PostgreSQLParserATTRIBUTE = 143 + PostgreSQLParserBACKWARD = 144 + PostgreSQLParserBEFORE = 145 + PostgreSQLParserBEGIN_P = 146 + PostgreSQLParserBY = 147 + PostgreSQLParserCACHE = 148 + PostgreSQLParserCALLED = 149 + PostgreSQLParserCASCADE = 150 + PostgreSQLParserCASCADED = 151 + PostgreSQLParserCATALOG = 152 + PostgreSQLParserCHAIN = 153 + PostgreSQLParserCHARACTERISTICS = 154 + PostgreSQLParserCHECKPOINT = 155 + PostgreSQLParserCLASS = 156 + PostgreSQLParserCLOSE = 157 + PostgreSQLParserCLUSTER = 158 + PostgreSQLParserCOMMENT = 159 + PostgreSQLParserCOMMENTS = 160 + PostgreSQLParserCOMMIT = 161 + PostgreSQLParserCOMMITTED = 162 + PostgreSQLParserCONFIGURATION = 163 + PostgreSQLParserCONNECTION = 164 + PostgreSQLParserCONSTRAINTS = 165 + PostgreSQLParserCONTENT_P = 166 + PostgreSQLParserCONTINUE_P = 167 + PostgreSQLParserCONVERSION_P = 168 + PostgreSQLParserCOPY = 169 + PostgreSQLParserCOST = 170 + PostgreSQLParserCSV = 171 + PostgreSQLParserCURSOR = 172 + PostgreSQLParserCYCLE = 173 + PostgreSQLParserDATA_P = 174 + PostgreSQLParserDATABASE = 175 + PostgreSQLParserDAY_P = 176 + PostgreSQLParserDEALLOCATE = 177 + PostgreSQLParserDECLARE = 178 + PostgreSQLParserDEFAULTS = 179 + PostgreSQLParserDEFERRED = 180 + PostgreSQLParserDEFINER = 181 + PostgreSQLParserDELETE_P = 182 + PostgreSQLParserDELIMITER = 183 + PostgreSQLParserDELIMITERS = 184 + PostgreSQLParserDICTIONARY = 185 + PostgreSQLParserDISABLE_P = 186 + PostgreSQLParserDISCARD = 187 + PostgreSQLParserDOCUMENT_P = 188 + PostgreSQLParserDOMAIN_P = 189 + PostgreSQLParserDOUBLE_P = 190 + PostgreSQLParserDROP = 191 + PostgreSQLParserEACH = 192 + PostgreSQLParserENABLE_P = 193 + PostgreSQLParserENCODING = 194 + PostgreSQLParserENCRYPTED = 195 + PostgreSQLParserENUM_P = 196 + PostgreSQLParserESCAPE = 197 + PostgreSQLParserEVENT = 198 + PostgreSQLParserEXCLUDE = 199 + PostgreSQLParserEXCLUDING = 200 + PostgreSQLParserEXCLUSIVE = 201 + PostgreSQLParserEXECUTE = 202 + PostgreSQLParserEXPLAIN = 203 + PostgreSQLParserEXTENSION = 204 + PostgreSQLParserEXTERNAL = 205 + PostgreSQLParserFAMILY = 206 + PostgreSQLParserFIRST_P = 207 + PostgreSQLParserFOLLOWING = 208 + PostgreSQLParserFORCE = 209 + PostgreSQLParserFORWARD = 210 + PostgreSQLParserFUNCTION = 211 + PostgreSQLParserFUNCTIONS = 212 + PostgreSQLParserGLOBAL = 213 + PostgreSQLParserGRANTED = 214 + PostgreSQLParserHANDLER = 215 + PostgreSQLParserHEADER_P = 216 + PostgreSQLParserHOLD = 217 + PostgreSQLParserHOUR_P = 218 + PostgreSQLParserIDENTITY_P = 219 + PostgreSQLParserIF_P = 220 + PostgreSQLParserIMMEDIATE = 221 + PostgreSQLParserIMMUTABLE = 222 + PostgreSQLParserIMPLICIT_P = 223 + PostgreSQLParserINCLUDING = 224 + PostgreSQLParserINCREMENT = 225 + PostgreSQLParserINDEX = 226 + PostgreSQLParserINDEXES = 227 + PostgreSQLParserINHERIT = 228 + PostgreSQLParserINHERITS = 229 + PostgreSQLParserINLINE_P = 230 + PostgreSQLParserINSENSITIVE = 231 + PostgreSQLParserINSERT = 232 + PostgreSQLParserINSTEAD = 233 + PostgreSQLParserINVOKER = 234 + PostgreSQLParserISOLATION = 235 + PostgreSQLParserKEY = 236 + PostgreSQLParserLABEL = 237 + PostgreSQLParserLANGUAGE = 238 + PostgreSQLParserLARGE_P = 239 + PostgreSQLParserLAST_P = 240 + PostgreSQLParserLEAKPROOF = 241 + PostgreSQLParserLEVEL = 242 + PostgreSQLParserLISTEN = 243 + PostgreSQLParserLOAD = 244 + PostgreSQLParserLOCAL = 245 + PostgreSQLParserLOCATION = 246 + PostgreSQLParserLOCK_P = 247 + PostgreSQLParserMAPPING = 248 + PostgreSQLParserMATCH = 249 + PostgreSQLParserMATCHED = 250 + PostgreSQLParserMATERIALIZED = 251 + PostgreSQLParserMAXVALUE = 252 + PostgreSQLParserMERGE = 253 + PostgreSQLParserMINUTE_P = 254 + PostgreSQLParserMINVALUE = 255 + PostgreSQLParserMODE = 256 + PostgreSQLParserMONTH_P = 257 + PostgreSQLParserMOVE = 258 + PostgreSQLParserNAME_P = 259 + PostgreSQLParserNAMES = 260 + PostgreSQLParserNEXT = 261 + PostgreSQLParserNO = 262 + PostgreSQLParserNOTHING = 263 + PostgreSQLParserNOTIFY = 264 + PostgreSQLParserNOWAIT = 265 + PostgreSQLParserNULLS_P = 266 + PostgreSQLParserOBJECT_P = 267 + PostgreSQLParserOF = 268 + PostgreSQLParserOFF = 269 + PostgreSQLParserOIDS = 270 + PostgreSQLParserOPERATOR = 271 + PostgreSQLParserOPTION = 272 + PostgreSQLParserOPTIONS = 273 + PostgreSQLParserOWNED = 274 + PostgreSQLParserOWNER = 275 + PostgreSQLParserPARSER = 276 + PostgreSQLParserPARTIAL = 277 + PostgreSQLParserPARTITION = 278 + PostgreSQLParserPASSING = 279 + PostgreSQLParserPASSWORD = 280 + PostgreSQLParserPLANS = 281 + PostgreSQLParserPRECEDING = 282 + PostgreSQLParserPREPARE = 283 + PostgreSQLParserPREPARED = 284 + PostgreSQLParserPRESERVE = 285 + PostgreSQLParserPRIOR = 286 + PostgreSQLParserPRIVILEGES = 287 + PostgreSQLParserPROCEDURAL = 288 + PostgreSQLParserPROCEDURE = 289 + PostgreSQLParserPROGRAM = 290 + PostgreSQLParserQUOTE = 291 + PostgreSQLParserRANGE = 292 + PostgreSQLParserREAD = 293 + PostgreSQLParserREASSIGN = 294 + PostgreSQLParserRECHECK = 295 + PostgreSQLParserRECURSIVE = 296 + PostgreSQLParserREF = 297 + PostgreSQLParserREFRESH = 298 + PostgreSQLParserREINDEX = 299 + PostgreSQLParserRELATIVE_P = 300 + PostgreSQLParserRELEASE = 301 + PostgreSQLParserRENAME = 302 + PostgreSQLParserREPEATABLE = 303 + PostgreSQLParserREPLACE = 304 + PostgreSQLParserREPLICA = 305 + PostgreSQLParserRESET = 306 + PostgreSQLParserRESTART = 307 + PostgreSQLParserRESTRICT = 308 + PostgreSQLParserRETURNS = 309 + PostgreSQLParserREVOKE = 310 + PostgreSQLParserROLE = 311 + PostgreSQLParserROLLBACK = 312 + PostgreSQLParserROWS = 313 + PostgreSQLParserRULE = 314 + PostgreSQLParserSAVEPOINT = 315 + PostgreSQLParserSCHEMA = 316 + PostgreSQLParserSCROLL = 317 + PostgreSQLParserSEARCH = 318 + PostgreSQLParserSECOND_P = 319 + PostgreSQLParserSECURITY = 320 + PostgreSQLParserSEQUENCE = 321 + PostgreSQLParserSEQUENCES = 322 + PostgreSQLParserSERIALIZABLE = 323 + PostgreSQLParserSERVER = 324 + PostgreSQLParserSESSION = 325 + PostgreSQLParserSET = 326 + PostgreSQLParserSHARE = 327 + PostgreSQLParserSHOW = 328 + PostgreSQLParserSIMPLE = 329 + PostgreSQLParserSNAPSHOT = 330 + PostgreSQLParserSTABLE = 331 + PostgreSQLParserSTANDALONE_P = 332 + PostgreSQLParserSTART = 333 + PostgreSQLParserSTATEMENT = 334 + PostgreSQLParserSTATISTICS = 335 + PostgreSQLParserSTDIN = 336 + PostgreSQLParserSTDOUT = 337 + PostgreSQLParserSTORAGE = 338 + PostgreSQLParserSTRICT_P = 339 + PostgreSQLParserSTRIP_P = 340 + PostgreSQLParserSYSID = 341 + PostgreSQLParserSYSTEM_P = 342 + PostgreSQLParserTABLES = 343 + PostgreSQLParserTABLESPACE = 344 + PostgreSQLParserTEMP = 345 + PostgreSQLParserTEMPLATE = 346 + PostgreSQLParserTEMPORARY = 347 + PostgreSQLParserTEXT_P = 348 + PostgreSQLParserTRANSACTION = 349 + PostgreSQLParserTRIGGER = 350 + PostgreSQLParserTRUNCATE = 351 + PostgreSQLParserTRUSTED = 352 + PostgreSQLParserTYPE_P = 353 + PostgreSQLParserTYPES_P = 354 + PostgreSQLParserUNBOUNDED = 355 + PostgreSQLParserUNCOMMITTED = 356 + PostgreSQLParserUNENCRYPTED = 357 + PostgreSQLParserUNKNOWN = 358 + PostgreSQLParserUNLISTEN = 359 + PostgreSQLParserUNLOGGED = 360 + PostgreSQLParserUNTIL = 361 + PostgreSQLParserUPDATE = 362 + PostgreSQLParserVACUUM = 363 + PostgreSQLParserVALID = 364 + PostgreSQLParserVALIDATE = 365 + PostgreSQLParserVALIDATOR = 366 + PostgreSQLParserVARYING = 367 + PostgreSQLParserVERSION_P = 368 + PostgreSQLParserVIEW = 369 + PostgreSQLParserVOLATILE = 370 + PostgreSQLParserWHITESPACE_P = 371 + PostgreSQLParserWITHOUT = 372 + PostgreSQLParserWORK = 373 + PostgreSQLParserWRAPPER = 374 + PostgreSQLParserWRITE = 375 + PostgreSQLParserXML_P = 376 + PostgreSQLParserYEAR_P = 377 + PostgreSQLParserYES_P = 378 + PostgreSQLParserZONE = 379 + PostgreSQLParserATOMIC_P = 380 + PostgreSQLParserBETWEEN = 381 + PostgreSQLParserBIGINT = 382 + PostgreSQLParserBIT = 383 + PostgreSQLParserBOOLEAN_P = 384 + PostgreSQLParserCHAR_P = 385 + PostgreSQLParserCHARACTER = 386 + PostgreSQLParserCOALESCE = 387 + PostgreSQLParserDEC = 388 + PostgreSQLParserDECIMAL_P = 389 + PostgreSQLParserEXISTS = 390 + PostgreSQLParserEXTRACT = 391 + PostgreSQLParserFLOAT_P = 392 + PostgreSQLParserGREATEST = 393 + PostgreSQLParserINOUT = 394 + PostgreSQLParserINT_P = 395 + PostgreSQLParserINTEGER = 396 + PostgreSQLParserINTERVAL = 397 + PostgreSQLParserLEAST = 398 + PostgreSQLParserNATIONAL = 399 + PostgreSQLParserNCHAR = 400 + PostgreSQLParserNONE = 401 + PostgreSQLParserNULLIF = 402 + PostgreSQLParserNUMERIC = 403 + PostgreSQLParserOVERLAY = 404 + PostgreSQLParserPARAMETER = 405 + PostgreSQLParserPOSITION = 406 + PostgreSQLParserPRECISION = 407 + PostgreSQLParserREAL = 408 + PostgreSQLParserROW = 409 + PostgreSQLParserSETOF = 410 + PostgreSQLParserSMALLINT = 411 + PostgreSQLParserSUBSTRING = 412 + PostgreSQLParserTIME = 413 + PostgreSQLParserTIMESTAMP = 414 + PostgreSQLParserTREAT = 415 + PostgreSQLParserTRIM = 416 + PostgreSQLParserVALUES = 417 + PostgreSQLParserVARCHAR = 418 + PostgreSQLParserXMLATTRIBUTES = 419 + PostgreSQLParserXMLCOMMENT = 420 + PostgreSQLParserXMLAGG = 421 + PostgreSQLParserXML_IS_WELL_FORMED = 422 + PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT = 423 + PostgreSQLParserXML_IS_WELL_FORMED_CONTENT = 424 + PostgreSQLParserXPATH = 425 + PostgreSQLParserXPATH_EXISTS = 426 + PostgreSQLParserXMLCONCAT = 427 + PostgreSQLParserXMLELEMENT = 428 + PostgreSQLParserXMLEXISTS = 429 + PostgreSQLParserXMLFOREST = 430 + PostgreSQLParserXMLPARSE = 431 + PostgreSQLParserXMLPI = 432 + PostgreSQLParserXMLROOT = 433 + PostgreSQLParserXMLSERIALIZE = 434 + PostgreSQLParserCALL = 435 + PostgreSQLParserCURRENT_P = 436 + PostgreSQLParserATTACH = 437 + PostgreSQLParserDETACH = 438 + PostgreSQLParserEXPRESSION = 439 + PostgreSQLParserGENERATED = 440 + PostgreSQLParserLOGGED = 441 + PostgreSQLParserSTORED = 442 + PostgreSQLParserINCLUDE = 443 + PostgreSQLParserROUTINE = 444 + PostgreSQLParserTRANSFORM = 445 + PostgreSQLParserIMPORT_P = 446 + PostgreSQLParserPOLICY = 447 + PostgreSQLParserMETHOD = 448 + PostgreSQLParserREFERENCING = 449 + PostgreSQLParserNEW = 450 + PostgreSQLParserOLD = 451 + PostgreSQLParserVALUE_P = 452 + PostgreSQLParserSUBSCRIPTION = 453 + PostgreSQLParserPUBLICATION = 454 + PostgreSQLParserOUT_P = 455 + PostgreSQLParserEND_P = 456 + PostgreSQLParserROUTINES = 457 + PostgreSQLParserSCHEMAS = 458 + PostgreSQLParserPROCEDURES = 459 + PostgreSQLParserINPUT_P = 460 + PostgreSQLParserSUPPORT = 461 + PostgreSQLParserPARALLEL = 462 + PostgreSQLParserSQL_P = 463 + PostgreSQLParserDEPENDS = 464 + PostgreSQLParserOVERRIDING = 465 + PostgreSQLParserCONFLICT = 466 + PostgreSQLParserSKIP_P = 467 + PostgreSQLParserLOCKED = 468 + PostgreSQLParserTIES = 469 + PostgreSQLParserROLLUP = 470 + PostgreSQLParserCUBE = 471 + PostgreSQLParserGROUPING = 472 + PostgreSQLParserSETS = 473 + PostgreSQLParserTABLESAMPLE = 474 + PostgreSQLParserORDINALITY = 475 + PostgreSQLParserXMLTABLE = 476 + PostgreSQLParserCOLUMNS = 477 + PostgreSQLParserXMLNAMESPACES = 478 + PostgreSQLParserROWTYPE = 479 + PostgreSQLParserNORMALIZED = 480 + PostgreSQLParserWITHIN = 481 + PostgreSQLParserFILTER = 482 + PostgreSQLParserGROUPS = 483 + PostgreSQLParserOTHERS = 484 + PostgreSQLParserNFC = 485 + PostgreSQLParserNFD = 486 + PostgreSQLParserNFKC = 487 + PostgreSQLParserNFKD = 488 + PostgreSQLParserUESCAPE = 489 + PostgreSQLParserVIEWS = 490 + PostgreSQLParserNORMALIZE = 491 + PostgreSQLParserDUMP = 492 + PostgreSQLParserPRINT_STRICT_PARAMS = 493 + PostgreSQLParserVARIABLE_CONFLICT = 494 + PostgreSQLParserERROR = 495 + PostgreSQLParserUSE_VARIABLE = 496 + PostgreSQLParserUSE_COLUMN = 497 + PostgreSQLParserALIAS = 498 + PostgreSQLParserCONSTANT = 499 + PostgreSQLParserPERFORM = 500 + PostgreSQLParserGET = 501 + PostgreSQLParserDIAGNOSTICS = 502 + PostgreSQLParserSTACKED = 503 + PostgreSQLParserELSIF = 504 + PostgreSQLParserWHILE = 505 + PostgreSQLParserREVERSE = 506 + PostgreSQLParserFOREACH = 507 + PostgreSQLParserSLICE = 508 + PostgreSQLParserEXIT = 509 + PostgreSQLParserRETURN = 510 + PostgreSQLParserQUERY = 511 + PostgreSQLParserRAISE = 512 + PostgreSQLParserSQLSTATE = 513 + PostgreSQLParserDEBUG = 514 + PostgreSQLParserLOG = 515 + PostgreSQLParserINFO = 516 + PostgreSQLParserNOTICE = 517 + PostgreSQLParserWARNING = 518 + PostgreSQLParserEXCEPTION = 519 + PostgreSQLParserASSERT = 520 + PostgreSQLParserLOOP = 521 + PostgreSQLParserOPEN = 522 + PostgreSQLParserABS = 523 + PostgreSQLParserCBRT = 524 + PostgreSQLParserCEIL = 525 + PostgreSQLParserCEILING = 526 + PostgreSQLParserDEGREES = 527 + PostgreSQLParserDIV = 528 + PostgreSQLParserEXP = 529 + PostgreSQLParserFACTORIAL = 530 + PostgreSQLParserFLOOR = 531 + PostgreSQLParserGCD = 532 + PostgreSQLParserLCM = 533 + PostgreSQLParserLN = 534 + PostgreSQLParserLOG10 = 535 + PostgreSQLParserMIN_SCALE = 536 + PostgreSQLParserMOD = 537 + PostgreSQLParserPI = 538 + PostgreSQLParserPOWER = 539 + PostgreSQLParserRADIANS = 540 + PostgreSQLParserROUND = 541 + PostgreSQLParserSCALE = 542 + PostgreSQLParserSIGN = 543 + PostgreSQLParserSQRT = 544 + PostgreSQLParserTRIM_SCALE = 545 + PostgreSQLParserTRUNC = 546 + PostgreSQLParserWIDTH_BUCKET = 547 + PostgreSQLParserRANDOM = 548 + PostgreSQLParserSETSEED = 549 + PostgreSQLParserACOS = 550 + PostgreSQLParserACOSD = 551 + PostgreSQLParserASIN = 552 + PostgreSQLParserASIND = 553 + PostgreSQLParserATAN = 554 + PostgreSQLParserATAND = 555 + PostgreSQLParserATAN2 = 556 + PostgreSQLParserATAN2D = 557 + PostgreSQLParserCOS = 558 + PostgreSQLParserCOSD = 559 + PostgreSQLParserCOT = 560 + PostgreSQLParserCOTD = 561 + PostgreSQLParserSIN = 562 + PostgreSQLParserSIND = 563 + PostgreSQLParserTAN = 564 + PostgreSQLParserTAND = 565 + PostgreSQLParserSINH = 566 + PostgreSQLParserCOSH = 567 + PostgreSQLParserTANH = 568 + PostgreSQLParserASINH = 569 + PostgreSQLParserACOSH = 570 + PostgreSQLParserATANH = 571 + PostgreSQLParserBIT_LENGTH = 572 + PostgreSQLParserCHAR_LENGTH = 573 + PostgreSQLParserCHARACTER_LENGTH = 574 + PostgreSQLParserLOWER = 575 + PostgreSQLParserOCTET_LENGTH = 576 + PostgreSQLParserUPPER = 577 + PostgreSQLParserASCII = 578 + PostgreSQLParserBTRIM = 579 + PostgreSQLParserCHR = 580 + PostgreSQLParserCONCAT = 581 + PostgreSQLParserCONCAT_WS = 582 + PostgreSQLParserFORMAT = 583 + PostgreSQLParserINITCAP = 584 + PostgreSQLParserLENGTH = 585 + PostgreSQLParserLPAD = 586 + PostgreSQLParserLTRIM = 587 + PostgreSQLParserMD5 = 588 + PostgreSQLParserPARSE_IDENT = 589 + PostgreSQLParserPG_CLIENT_ENCODING = 590 + PostgreSQLParserQUOTE_IDENT = 591 + PostgreSQLParserQUOTE_LITERAL = 592 + PostgreSQLParserQUOTE_NULLABLE = 593 + PostgreSQLParserREGEXP_COUNT = 594 + PostgreSQLParserREGEXP_INSTR = 595 + PostgreSQLParserREGEXP_LIKE = 596 + PostgreSQLParserREGEXP_MATCH = 597 + PostgreSQLParserREGEXP_MATCHES = 598 + PostgreSQLParserREGEXP_REPLACE = 599 + PostgreSQLParserREGEXP_SPLIT_TO_ARRAY = 600 + PostgreSQLParserREGEXP_SPLIT_TO_TABLE = 601 + PostgreSQLParserREGEXP_SUBSTR = 602 + PostgreSQLParserREPEAT = 603 + PostgreSQLParserRPAD = 604 + PostgreSQLParserRTRIM = 605 + PostgreSQLParserSPLIT_PART = 606 + PostgreSQLParserSTARTS_WITH = 607 + PostgreSQLParserSTRING_TO_ARRAY = 608 + PostgreSQLParserSTRING_TO_TABLE = 609 + PostgreSQLParserSTRPOS = 610 + PostgreSQLParserSUBSTR = 611 + PostgreSQLParserTO_ASCII = 612 + PostgreSQLParserTO_HEX = 613 + PostgreSQLParserTRANSLATE = 614 + PostgreSQLParserUNISTR = 615 + PostgreSQLParserAGE = 616 + PostgreSQLParserCLOCK_TIMESTAMP = 617 + PostgreSQLParserDATE_BIN = 618 + PostgreSQLParserDATE_PART = 619 + PostgreSQLParserDATE_TRUNC = 620 + PostgreSQLParserISFINITE = 621 + PostgreSQLParserJUSTIFY_DAYS = 622 + PostgreSQLParserJUSTIFY_HOURS = 623 + PostgreSQLParserJUSTIFY_INTERVAL = 624 + PostgreSQLParserMAKE_DATE = 625 + PostgreSQLParserMAKE_INTERVAL = 626 + PostgreSQLParserMAKE_TIME = 627 + PostgreSQLParserMAKE_TIMESTAMP = 628 + PostgreSQLParserMAKE_TIMESTAMPTZ = 629 + PostgreSQLParserNOW = 630 + PostgreSQLParserSTATEMENT_TIMESTAMP = 631 + PostgreSQLParserTIMEOFDAY = 632 + PostgreSQLParserTRANSACTION_TIMESTAMP = 633 + PostgreSQLParserTO_TIMESTAMP = 634 + PostgreSQLParserTO_CHAR = 635 + PostgreSQLParserTO_DATE = 636 + PostgreSQLParserTO_NUMBER = 637 + PostgreSQLParserENCODE = 638 + PostgreSQLParserDISTKEY = 639 + PostgreSQLParserSORTKEY = 640 + PostgreSQLParserCASE_SENSITIVE = 641 + PostgreSQLParserCASE_INSENSITIVE = 642 + PostgreSQLParserIdentifier = 643 + PostgreSQLParserQuotedIdentifier = 644 + PostgreSQLParserUnterminatedQuotedIdentifier = 645 + PostgreSQLParserInvalidQuotedIdentifier = 646 + PostgreSQLParserInvalidUnterminatedQuotedIdentifier = 647 + PostgreSQLParserUnicodeQuotedIdentifier = 648 + PostgreSQLParserUnterminatedUnicodeQuotedIdentifier = 649 + PostgreSQLParserInvalidUnicodeQuotedIdentifier = 650 + PostgreSQLParserInvalidUnterminatedUnicodeQuotedIdentifier = 651 + PostgreSQLParserStringConstant = 652 + PostgreSQLParserUnterminatedStringConstant = 653 + PostgreSQLParserUnicodeEscapeStringConstant = 654 + PostgreSQLParserUnterminatedUnicodeEscapeStringConstant = 655 + PostgreSQLParserBeginDollarStringConstant = 656 + PostgreSQLParserBinaryStringConstant = 657 + PostgreSQLParserUnterminatedBinaryStringConstant = 658 + PostgreSQLParserInvalidBinaryStringConstant = 659 + PostgreSQLParserInvalidUnterminatedBinaryStringConstant = 660 + PostgreSQLParserHexadecimalStringConstant = 661 + PostgreSQLParserUnterminatedHexadecimalStringConstant = 662 + PostgreSQLParserInvalidHexadecimalStringConstant = 663 + PostgreSQLParserInvalidUnterminatedHexadecimalStringConstant = 664 + PostgreSQLParserIntegral = 665 + PostgreSQLParserNumericFail = 666 + PostgreSQLParserNumeric = 667 + PostgreSQLParserPLSQLVARIABLENAME = 668 + PostgreSQLParserPLSQLIDENTIFIER = 669 + PostgreSQLParserWhitespace = 670 + PostgreSQLParserNewline = 671 + PostgreSQLParserLineComment = 672 + PostgreSQLParserBlockComment = 673 + PostgreSQLParserUnterminatedBlockComment = 674 + PostgreSQLParserMetaCommand = 675 + PostgreSQLParserEndMetaCommand = 676 + PostgreSQLParserErrorCharacter = 677 + PostgreSQLParserEscapeStringConstant = 678 + PostgreSQLParserUnterminatedEscapeStringConstant = 679 + PostgreSQLParserInvalidEscapeStringConstant = 680 + PostgreSQLParserInvalidUnterminatedEscapeStringConstant = 681 + PostgreSQLParserAfterEscapeStringConstantMode_NotContinued = 682 + PostgreSQLParserAfterEscapeStringConstantWithNewlineMode_NotContinued = 683 + PostgreSQLParserDollarText = 684 + PostgreSQLParserEndDollarStringConstant = 685 + PostgreSQLParserAfterEscapeStringConstantWithNewlineMode_Continued = 686 +) + +// PostgreSQLParser rules. +const ( + PostgreSQLParserRULE_root = 0 + PostgreSQLParserRULE_plsqlroot = 1 + PostgreSQLParserRULE_stmtblock = 2 + PostgreSQLParserRULE_stmtmulti = 3 + PostgreSQLParserRULE_stmt = 4 + PostgreSQLParserRULE_plsqlconsolecommand = 5 + PostgreSQLParserRULE_callstmt = 6 + PostgreSQLParserRULE_createrolestmt = 7 + PostgreSQLParserRULE_opt_with = 8 + PostgreSQLParserRULE_optrolelist = 9 + PostgreSQLParserRULE_alteroptrolelist = 10 + PostgreSQLParserRULE_alteroptroleelem = 11 + PostgreSQLParserRULE_createoptroleelem = 12 + PostgreSQLParserRULE_createuserstmt = 13 + PostgreSQLParserRULE_alterrolestmt = 14 + PostgreSQLParserRULE_opt_in_database = 15 + PostgreSQLParserRULE_alterrolesetstmt = 16 + PostgreSQLParserRULE_droprolestmt = 17 + PostgreSQLParserRULE_creategroupstmt = 18 + PostgreSQLParserRULE_altergroupstmt = 19 + PostgreSQLParserRULE_add_drop = 20 + PostgreSQLParserRULE_createschemastmt = 21 + PostgreSQLParserRULE_optschemaname = 22 + PostgreSQLParserRULE_optschemaeltlist = 23 + PostgreSQLParserRULE_schema_stmt = 24 + PostgreSQLParserRULE_variablesetstmt = 25 + PostgreSQLParserRULE_set_rest = 26 + PostgreSQLParserRULE_generic_set = 27 + PostgreSQLParserRULE_set_rest_more = 28 + PostgreSQLParserRULE_var_name = 29 + PostgreSQLParserRULE_var_list = 30 + PostgreSQLParserRULE_var_value = 31 + PostgreSQLParserRULE_iso_level = 32 + PostgreSQLParserRULE_opt_boolean_or_string = 33 + PostgreSQLParserRULE_zone_value = 34 + PostgreSQLParserRULE_opt_encoding = 35 + PostgreSQLParserRULE_nonreservedword_or_sconst = 36 + PostgreSQLParserRULE_variableresetstmt = 37 + PostgreSQLParserRULE_reset_rest = 38 + PostgreSQLParserRULE_generic_reset = 39 + PostgreSQLParserRULE_setresetclause = 40 + PostgreSQLParserRULE_functionsetresetclause = 41 + PostgreSQLParserRULE_variableshowstmt = 42 + PostgreSQLParserRULE_constraintssetstmt = 43 + PostgreSQLParserRULE_constraints_set_list = 44 + PostgreSQLParserRULE_constraints_set_mode = 45 + PostgreSQLParserRULE_checkpointstmt = 46 + PostgreSQLParserRULE_discardstmt = 47 + PostgreSQLParserRULE_altertablestmt = 48 + PostgreSQLParserRULE_alter_table_cmds = 49 + PostgreSQLParserRULE_partition_cmd = 50 + PostgreSQLParserRULE_index_partition_cmd = 51 + PostgreSQLParserRULE_alter_table_cmd = 52 + PostgreSQLParserRULE_alter_column_default = 53 + PostgreSQLParserRULE_opt_drop_behavior = 54 + PostgreSQLParserRULE_opt_collate_clause = 55 + PostgreSQLParserRULE_alter_using = 56 + PostgreSQLParserRULE_replica_identity = 57 + PostgreSQLParserRULE_reloptions = 58 + PostgreSQLParserRULE_opt_reloptions = 59 + PostgreSQLParserRULE_reloption_list = 60 + PostgreSQLParserRULE_reloption_elem = 61 + PostgreSQLParserRULE_alter_identity_column_option_list = 62 + PostgreSQLParserRULE_alter_identity_column_option = 63 + PostgreSQLParserRULE_partitionboundspec = 64 + PostgreSQLParserRULE_hash_partbound_elem = 65 + PostgreSQLParserRULE_hash_partbound = 66 + PostgreSQLParserRULE_altercompositetypestmt = 67 + PostgreSQLParserRULE_alter_type_cmds = 68 + PostgreSQLParserRULE_alter_type_cmd = 69 + PostgreSQLParserRULE_closeportalstmt = 70 + PostgreSQLParserRULE_copystmt = 71 + PostgreSQLParserRULE_copy_from = 72 + PostgreSQLParserRULE_opt_program = 73 + PostgreSQLParserRULE_copy_file_name = 74 + PostgreSQLParserRULE_copy_options = 75 + PostgreSQLParserRULE_copy_opt_list = 76 + PostgreSQLParserRULE_copy_opt_item = 77 + PostgreSQLParserRULE_opt_binary = 78 + PostgreSQLParserRULE_copy_delimiter = 79 + PostgreSQLParserRULE_opt_using = 80 + PostgreSQLParserRULE_copy_generic_opt_list = 81 + PostgreSQLParserRULE_copy_generic_opt_elem = 82 + PostgreSQLParserRULE_copy_generic_opt_arg = 83 + PostgreSQLParserRULE_copy_generic_opt_arg_list = 84 + PostgreSQLParserRULE_copy_generic_opt_arg_list_item = 85 + PostgreSQLParserRULE_createstmt = 86 + PostgreSQLParserRULE_opttemp = 87 + PostgreSQLParserRULE_opttableelementlist = 88 + PostgreSQLParserRULE_opttypedtableelementlist = 89 + PostgreSQLParserRULE_tableelementlist = 90 + PostgreSQLParserRULE_typedtableelementlist = 91 + PostgreSQLParserRULE_tableelement = 92 + PostgreSQLParserRULE_typedtableelement = 93 + PostgreSQLParserRULE_columnDef = 94 + PostgreSQLParserRULE_rs_colattributes = 95 + PostgreSQLParserRULE_columnOptions = 96 + PostgreSQLParserRULE_colquallist = 97 + PostgreSQLParserRULE_colconstraint = 98 + PostgreSQLParserRULE_colconstraintelem = 99 + PostgreSQLParserRULE_opt_unique_null_treatment = 100 + PostgreSQLParserRULE_generated_when = 101 + PostgreSQLParserRULE_constraintattr = 102 + PostgreSQLParserRULE_tablelikeclause = 103 + PostgreSQLParserRULE_tablelikeoptionlist = 104 + PostgreSQLParserRULE_tablelikeoption = 105 + PostgreSQLParserRULE_tableconstraint = 106 + PostgreSQLParserRULE_constraintelem = 107 + PostgreSQLParserRULE_opt_no_inherit = 108 + PostgreSQLParserRULE_opt_column_list = 109 + PostgreSQLParserRULE_columnlist = 110 + PostgreSQLParserRULE_columnElem = 111 + PostgreSQLParserRULE_opt_c_include = 112 + PostgreSQLParserRULE_key_match = 113 + PostgreSQLParserRULE_exclusionconstraintlist = 114 + PostgreSQLParserRULE_exclusionconstraintelem = 115 + PostgreSQLParserRULE_exclusionwhereclause = 116 + PostgreSQLParserRULE_key_actions = 117 + PostgreSQLParserRULE_key_update = 118 + PostgreSQLParserRULE_key_delete = 119 + PostgreSQLParserRULE_key_action = 120 + PostgreSQLParserRULE_optinherit = 121 + PostgreSQLParserRULE_optpartitionspec = 122 + PostgreSQLParserRULE_partitionspec = 123 + PostgreSQLParserRULE_part_params = 124 + PostgreSQLParserRULE_part_elem = 125 + PostgreSQLParserRULE_table_access_method_clause = 126 + PostgreSQLParserRULE_optwith = 127 + PostgreSQLParserRULE_oncommitoption = 128 + PostgreSQLParserRULE_opttablespace = 129 + PostgreSQLParserRULE_optconstablespace = 130 + PostgreSQLParserRULE_existingindex = 131 + PostgreSQLParserRULE_createstatsstmt = 132 + PostgreSQLParserRULE_alterstatsstmt = 133 + PostgreSQLParserRULE_createasstmt = 134 + PostgreSQLParserRULE_create_as_target = 135 + PostgreSQLParserRULE_opt_with_data = 136 + PostgreSQLParserRULE_creatematviewstmt = 137 + PostgreSQLParserRULE_create_mv_target = 138 + PostgreSQLParserRULE_optnolog = 139 + PostgreSQLParserRULE_refreshmatviewstmt = 140 + PostgreSQLParserRULE_createseqstmt = 141 + PostgreSQLParserRULE_alterseqstmt = 142 + PostgreSQLParserRULE_optseqoptlist = 143 + PostgreSQLParserRULE_optparenthesizedseqoptlist = 144 + PostgreSQLParserRULE_seqoptlist = 145 + PostgreSQLParserRULE_seqoptelem = 146 + PostgreSQLParserRULE_opt_by = 147 + PostgreSQLParserRULE_numericonly = 148 + PostgreSQLParserRULE_numericonly_list = 149 + PostgreSQLParserRULE_createplangstmt = 150 + PostgreSQLParserRULE_opt_trusted = 151 + PostgreSQLParserRULE_handler_name = 152 + PostgreSQLParserRULE_opt_inline_handler = 153 + PostgreSQLParserRULE_validator_clause = 154 + PostgreSQLParserRULE_opt_validator = 155 + PostgreSQLParserRULE_opt_procedural = 156 + PostgreSQLParserRULE_createtablespacestmt = 157 + PostgreSQLParserRULE_opttablespaceowner = 158 + PostgreSQLParserRULE_droptablespacestmt = 159 + PostgreSQLParserRULE_createextensionstmt = 160 + PostgreSQLParserRULE_create_extension_opt_list = 161 + PostgreSQLParserRULE_create_extension_opt_item = 162 + PostgreSQLParserRULE_alterextensionstmt = 163 + PostgreSQLParserRULE_alter_extension_opt_list = 164 + PostgreSQLParserRULE_alter_extension_opt_item = 165 + PostgreSQLParserRULE_alterextensioncontentsstmt = 166 + PostgreSQLParserRULE_createfdwstmt = 167 + PostgreSQLParserRULE_fdw_option = 168 + PostgreSQLParserRULE_fdw_options = 169 + PostgreSQLParserRULE_opt_fdw_options = 170 + PostgreSQLParserRULE_alterfdwstmt = 171 + PostgreSQLParserRULE_create_generic_options = 172 + PostgreSQLParserRULE_generic_option_list = 173 + PostgreSQLParserRULE_alter_generic_options = 174 + PostgreSQLParserRULE_alter_generic_option_list = 175 + PostgreSQLParserRULE_alter_generic_option_elem = 176 + PostgreSQLParserRULE_generic_option_elem = 177 + PostgreSQLParserRULE_generic_option_name = 178 + PostgreSQLParserRULE_generic_option_arg = 179 + PostgreSQLParserRULE_createforeignserverstmt = 180 + PostgreSQLParserRULE_opt_type = 181 + PostgreSQLParserRULE_foreign_server_version = 182 + PostgreSQLParserRULE_opt_foreign_server_version = 183 + PostgreSQLParserRULE_alterforeignserverstmt = 184 + PostgreSQLParserRULE_createforeigntablestmt = 185 + PostgreSQLParserRULE_importforeignschemastmt = 186 + PostgreSQLParserRULE_import_qualification_type = 187 + PostgreSQLParserRULE_import_qualification = 188 + PostgreSQLParserRULE_createusermappingstmt = 189 + PostgreSQLParserRULE_auth_ident = 190 + PostgreSQLParserRULE_dropusermappingstmt = 191 + PostgreSQLParserRULE_alterusermappingstmt = 192 + PostgreSQLParserRULE_createpolicystmt = 193 + PostgreSQLParserRULE_alterpolicystmt = 194 + PostgreSQLParserRULE_rowsecurityoptionalexpr = 195 + PostgreSQLParserRULE_rowsecurityoptionalwithcheck = 196 + PostgreSQLParserRULE_rowsecuritydefaulttorole = 197 + PostgreSQLParserRULE_rowsecurityoptionaltorole = 198 + PostgreSQLParserRULE_rowsecuritydefaultpermissive = 199 + PostgreSQLParserRULE_rowsecuritydefaultforcmd = 200 + PostgreSQLParserRULE_row_security_cmd = 201 + PostgreSQLParserRULE_createamstmt = 202 + PostgreSQLParserRULE_am_type = 203 + PostgreSQLParserRULE_createtrigstmt = 204 + PostgreSQLParserRULE_triggeractiontime = 205 + PostgreSQLParserRULE_triggerevents = 206 + PostgreSQLParserRULE_triggeroneevent = 207 + PostgreSQLParserRULE_triggerreferencing = 208 + PostgreSQLParserRULE_triggertransitions = 209 + PostgreSQLParserRULE_triggertransition = 210 + PostgreSQLParserRULE_transitionoldornew = 211 + PostgreSQLParserRULE_transitionrowortable = 212 + PostgreSQLParserRULE_transitionrelname = 213 + PostgreSQLParserRULE_triggerforspec = 214 + PostgreSQLParserRULE_triggerforopteach = 215 + PostgreSQLParserRULE_triggerfortype = 216 + PostgreSQLParserRULE_triggerwhen = 217 + PostgreSQLParserRULE_function_or_procedure = 218 + PostgreSQLParserRULE_triggerfuncargs = 219 + PostgreSQLParserRULE_triggerfuncarg = 220 + PostgreSQLParserRULE_optconstrfromtable = 221 + PostgreSQLParserRULE_constraintattributespec = 222 + PostgreSQLParserRULE_constraintattributeElem = 223 + PostgreSQLParserRULE_createeventtrigstmt = 224 + PostgreSQLParserRULE_event_trigger_when_list = 225 + PostgreSQLParserRULE_event_trigger_when_item = 226 + PostgreSQLParserRULE_event_trigger_value_list = 227 + PostgreSQLParserRULE_altereventtrigstmt = 228 + PostgreSQLParserRULE_enable_trigger = 229 + PostgreSQLParserRULE_createassertionstmt = 230 + PostgreSQLParserRULE_definestmt = 231 + PostgreSQLParserRULE_definition = 232 + PostgreSQLParserRULE_def_list = 233 + PostgreSQLParserRULE_def_elem = 234 + PostgreSQLParserRULE_def_arg = 235 + PostgreSQLParserRULE_old_aggr_definition = 236 + PostgreSQLParserRULE_old_aggr_list = 237 + PostgreSQLParserRULE_old_aggr_elem = 238 + PostgreSQLParserRULE_opt_enum_val_list = 239 + PostgreSQLParserRULE_enum_val_list = 240 + PostgreSQLParserRULE_alterenumstmt = 241 + PostgreSQLParserRULE_opt_if_not_exists = 242 + PostgreSQLParserRULE_createopclassstmt = 243 + PostgreSQLParserRULE_opclass_item_list = 244 + PostgreSQLParserRULE_opclass_item = 245 + PostgreSQLParserRULE_opt_default = 246 + PostgreSQLParserRULE_opt_opfamily = 247 + PostgreSQLParserRULE_opclass_purpose = 248 + PostgreSQLParserRULE_opt_recheck = 249 + PostgreSQLParserRULE_createopfamilystmt = 250 + PostgreSQLParserRULE_alteropfamilystmt = 251 + PostgreSQLParserRULE_opclass_drop_list = 252 + PostgreSQLParserRULE_opclass_drop = 253 + PostgreSQLParserRULE_dropopclassstmt = 254 + PostgreSQLParserRULE_dropopfamilystmt = 255 + PostgreSQLParserRULE_dropownedstmt = 256 + PostgreSQLParserRULE_reassignownedstmt = 257 + PostgreSQLParserRULE_dropstmt = 258 + PostgreSQLParserRULE_object_type_any_name = 259 + PostgreSQLParserRULE_object_type_name = 260 + PostgreSQLParserRULE_drop_type_name = 261 + PostgreSQLParserRULE_object_type_name_on_any_name = 262 + PostgreSQLParserRULE_any_name_list = 263 + PostgreSQLParserRULE_any_name = 264 + PostgreSQLParserRULE_attrs = 265 + PostgreSQLParserRULE_type_name_list = 266 + PostgreSQLParserRULE_truncatestmt = 267 + PostgreSQLParserRULE_opt_restart_seqs = 268 + PostgreSQLParserRULE_commentstmt = 269 + PostgreSQLParserRULE_comment_text = 270 + PostgreSQLParserRULE_seclabelstmt = 271 + PostgreSQLParserRULE_opt_provider = 272 + PostgreSQLParserRULE_security_label = 273 + PostgreSQLParserRULE_fetchstmt = 274 + PostgreSQLParserRULE_fetch_args = 275 + PostgreSQLParserRULE_from_in = 276 + PostgreSQLParserRULE_opt_from_in = 277 + PostgreSQLParserRULE_grantstmt = 278 + PostgreSQLParserRULE_revokestmt = 279 + PostgreSQLParserRULE_privileges = 280 + PostgreSQLParserRULE_privilege_list = 281 + PostgreSQLParserRULE_privilege = 282 + PostgreSQLParserRULE_privilege_target = 283 + PostgreSQLParserRULE_parameter_name_list = 284 + PostgreSQLParserRULE_parameter_name = 285 + PostgreSQLParserRULE_grantee_list = 286 + PostgreSQLParserRULE_grantee = 287 + PostgreSQLParserRULE_opt_grant_grant_option = 288 + PostgreSQLParserRULE_grantrolestmt = 289 + PostgreSQLParserRULE_revokerolestmt = 290 + PostgreSQLParserRULE_opt_grant_admin_option = 291 + PostgreSQLParserRULE_opt_granted_by = 292 + PostgreSQLParserRULE_alterdefaultprivilegesstmt = 293 + PostgreSQLParserRULE_defacloptionlist = 294 + PostgreSQLParserRULE_defacloption = 295 + PostgreSQLParserRULE_defaclaction = 296 + PostgreSQLParserRULE_defacl_privilege_target = 297 + PostgreSQLParserRULE_indexstmt = 298 + PostgreSQLParserRULE_opt_unique = 299 + PostgreSQLParserRULE_opt_concurrently = 300 + PostgreSQLParserRULE_opt_index_name = 301 + PostgreSQLParserRULE_access_method_clause = 302 + PostgreSQLParserRULE_index_params = 303 + PostgreSQLParserRULE_index_elem_options = 304 + PostgreSQLParserRULE_index_elem = 305 + PostgreSQLParserRULE_opt_include = 306 + PostgreSQLParserRULE_index_including_params = 307 + PostgreSQLParserRULE_opt_collate = 308 + PostgreSQLParserRULE_opt_class = 309 + PostgreSQLParserRULE_opt_asc_desc = 310 + PostgreSQLParserRULE_opt_nulls_order = 311 + PostgreSQLParserRULE_createfunctionstmt = 312 + PostgreSQLParserRULE_opt_or_replace = 313 + PostgreSQLParserRULE_func_args = 314 + PostgreSQLParserRULE_func_args_list = 315 + PostgreSQLParserRULE_function_with_argtypes_list = 316 + PostgreSQLParserRULE_function_with_argtypes = 317 + PostgreSQLParserRULE_func_args_with_defaults = 318 + PostgreSQLParserRULE_func_args_with_defaults_list = 319 + PostgreSQLParserRULE_func_arg = 320 + PostgreSQLParserRULE_arg_class = 321 + PostgreSQLParserRULE_param_name = 322 + PostgreSQLParserRULE_func_return = 323 + PostgreSQLParserRULE_func_type = 324 + PostgreSQLParserRULE_func_arg_with_default = 325 + PostgreSQLParserRULE_aggr_arg = 326 + PostgreSQLParserRULE_aggr_args = 327 + PostgreSQLParserRULE_aggr_args_list = 328 + PostgreSQLParserRULE_aggregate_with_argtypes = 329 + PostgreSQLParserRULE_aggregate_with_argtypes_list = 330 + PostgreSQLParserRULE_createfunc_opt_list = 331 + PostgreSQLParserRULE_common_func_opt_item = 332 + PostgreSQLParserRULE_createfunc_opt_item = 333 + PostgreSQLParserRULE_func_as = 334 + PostgreSQLParserRULE_transform_type_list = 335 + PostgreSQLParserRULE_opt_definition = 336 + PostgreSQLParserRULE_table_func_column = 337 + PostgreSQLParserRULE_table_func_column_list = 338 + PostgreSQLParserRULE_alterfunctionstmt = 339 + PostgreSQLParserRULE_alterfunc_opt_list = 340 + PostgreSQLParserRULE_opt_restrict = 341 + PostgreSQLParserRULE_removefuncstmt = 342 + PostgreSQLParserRULE_removeaggrstmt = 343 + PostgreSQLParserRULE_removeoperstmt = 344 + PostgreSQLParserRULE_oper_argtypes = 345 + PostgreSQLParserRULE_any_operator = 346 + PostgreSQLParserRULE_operator_with_argtypes_list = 347 + PostgreSQLParserRULE_operator_with_argtypes = 348 + PostgreSQLParserRULE_dostmt = 349 + PostgreSQLParserRULE_dostmt_opt_list = 350 + PostgreSQLParserRULE_dostmt_opt_item = 351 + PostgreSQLParserRULE_createcaststmt = 352 + PostgreSQLParserRULE_cast_context = 353 + PostgreSQLParserRULE_dropcaststmt = 354 + PostgreSQLParserRULE_opt_if_exists = 355 + PostgreSQLParserRULE_createtransformstmt = 356 + PostgreSQLParserRULE_transform_element_list = 357 + PostgreSQLParserRULE_droptransformstmt = 358 + PostgreSQLParserRULE_reindexstmt = 359 + PostgreSQLParserRULE_reindex_target_type = 360 + PostgreSQLParserRULE_reindex_target_multitable = 361 + PostgreSQLParserRULE_reindex_option_list = 362 + PostgreSQLParserRULE_reindex_option_elem = 363 + PostgreSQLParserRULE_altertblspcstmt = 364 + PostgreSQLParserRULE_renamestmt = 365 + PostgreSQLParserRULE_opt_column = 366 + PostgreSQLParserRULE_opt_set_data = 367 + PostgreSQLParserRULE_alterobjectdependsstmt = 368 + PostgreSQLParserRULE_opt_no = 369 + PostgreSQLParserRULE_alterobjectschemastmt = 370 + PostgreSQLParserRULE_alteroperatorstmt = 371 + PostgreSQLParserRULE_operator_def_list = 372 + PostgreSQLParserRULE_operator_def_elem = 373 + PostgreSQLParserRULE_operator_def_arg = 374 + PostgreSQLParserRULE_altertypestmt = 375 + PostgreSQLParserRULE_alterownerstmt = 376 + PostgreSQLParserRULE_createpublicationstmt = 377 + PostgreSQLParserRULE_pub_obj_list = 378 + PostgreSQLParserRULE_publication_obj_spec = 379 + PostgreSQLParserRULE_opt_where_clause = 380 + PostgreSQLParserRULE_alterpublicationstmt = 381 + PostgreSQLParserRULE_createsubscriptionstmt = 382 + PostgreSQLParserRULE_publication_name_list = 383 + PostgreSQLParserRULE_publication_name_item = 384 + PostgreSQLParserRULE_altersubscriptionstmt = 385 + PostgreSQLParserRULE_dropsubscriptionstmt = 386 + PostgreSQLParserRULE_rulestmt = 387 + PostgreSQLParserRULE_ruleactionlist = 388 + PostgreSQLParserRULE_ruleactionmulti = 389 + PostgreSQLParserRULE_ruleactionstmt = 390 + PostgreSQLParserRULE_ruleactionstmtOrEmpty = 391 + PostgreSQLParserRULE_event = 392 + PostgreSQLParserRULE_opt_instead = 393 + PostgreSQLParserRULE_notifystmt = 394 + PostgreSQLParserRULE_notify_payload = 395 + PostgreSQLParserRULE_listenstmt = 396 + PostgreSQLParserRULE_unlistenstmt = 397 + PostgreSQLParserRULE_transactionstmt = 398 + PostgreSQLParserRULE_opt_transaction = 399 + PostgreSQLParserRULE_transaction_mode_item = 400 + PostgreSQLParserRULE_transaction_mode_list = 401 + PostgreSQLParserRULE_transaction_mode_list_or_empty = 402 + PostgreSQLParserRULE_opt_transaction_chain = 403 + PostgreSQLParserRULE_viewstmt = 404 + PostgreSQLParserRULE_opt_check_option = 405 + PostgreSQLParserRULE_loadstmt = 406 + PostgreSQLParserRULE_createdbstmt = 407 + PostgreSQLParserRULE_createdb_opt_list = 408 + PostgreSQLParserRULE_createdb_opt_items = 409 + PostgreSQLParserRULE_createdb_opt_item = 410 + PostgreSQLParserRULE_createdb_opt_name = 411 + PostgreSQLParserRULE_opt_equal = 412 + PostgreSQLParserRULE_alterdatabasestmt = 413 + PostgreSQLParserRULE_alterdatabasesetstmt = 414 + PostgreSQLParserRULE_dropdbstmt = 415 + PostgreSQLParserRULE_drop_option_list = 416 + PostgreSQLParserRULE_drop_option = 417 + PostgreSQLParserRULE_altercollationstmt = 418 + PostgreSQLParserRULE_altersystemstmt = 419 + PostgreSQLParserRULE_createdomainstmt = 420 + PostgreSQLParserRULE_alterdomainstmt = 421 + PostgreSQLParserRULE_opt_as = 422 + PostgreSQLParserRULE_altertsdictionarystmt = 423 + PostgreSQLParserRULE_altertsconfigurationstmt = 424 + PostgreSQLParserRULE_any_with = 425 + PostgreSQLParserRULE_createconversionstmt = 426 + PostgreSQLParserRULE_clusterstmt = 427 + PostgreSQLParserRULE_cluster_index_specification = 428 + PostgreSQLParserRULE_vacuumstmt = 429 + PostgreSQLParserRULE_analyzestmt = 430 + PostgreSQLParserRULE_vac_analyze_option_list = 431 + PostgreSQLParserRULE_analyze_keyword = 432 + PostgreSQLParserRULE_vac_analyze_option_elem = 433 + PostgreSQLParserRULE_vac_analyze_option_name = 434 + PostgreSQLParserRULE_vac_analyze_option_arg = 435 + PostgreSQLParserRULE_opt_analyze = 436 + PostgreSQLParserRULE_opt_verbose = 437 + PostgreSQLParserRULE_opt_full = 438 + PostgreSQLParserRULE_opt_freeze = 439 + PostgreSQLParserRULE_opt_name_list = 440 + PostgreSQLParserRULE_vacuum_relation = 441 + PostgreSQLParserRULE_vacuum_relation_list = 442 + PostgreSQLParserRULE_opt_vacuum_relation_list = 443 + PostgreSQLParserRULE_explainstmt = 444 + PostgreSQLParserRULE_explainablestmt = 445 + PostgreSQLParserRULE_explain_option_list = 446 + PostgreSQLParserRULE_explain_option_elem = 447 + PostgreSQLParserRULE_explain_option_name = 448 + PostgreSQLParserRULE_explain_option_arg = 449 + PostgreSQLParserRULE_preparestmt = 450 + PostgreSQLParserRULE_prep_type_clause = 451 + PostgreSQLParserRULE_preparablestmt = 452 + PostgreSQLParserRULE_executestmt = 453 + PostgreSQLParserRULE_execute_param_clause = 454 + PostgreSQLParserRULE_deallocatestmt = 455 + PostgreSQLParserRULE_insertstmt = 456 + PostgreSQLParserRULE_insert_target = 457 + PostgreSQLParserRULE_insert_rest = 458 + PostgreSQLParserRULE_override_kind = 459 + PostgreSQLParserRULE_insert_column_list = 460 + PostgreSQLParserRULE_insert_column_item = 461 + PostgreSQLParserRULE_opt_on_conflict = 462 + PostgreSQLParserRULE_opt_conf_expr = 463 + PostgreSQLParserRULE_returning_clause = 464 + PostgreSQLParserRULE_mergestmt = 465 + PostgreSQLParserRULE_merge_insert_clause = 466 + PostgreSQLParserRULE_merge_update_clause = 467 + PostgreSQLParserRULE_merge_delete_clause = 468 + PostgreSQLParserRULE_deletestmt = 469 + PostgreSQLParserRULE_using_clause = 470 + PostgreSQLParserRULE_lockstmt = 471 + PostgreSQLParserRULE_opt_lock = 472 + PostgreSQLParserRULE_lock_type = 473 + PostgreSQLParserRULE_opt_nowait = 474 + PostgreSQLParserRULE_opt_nowait_or_skip = 475 + PostgreSQLParserRULE_updatestmt = 476 + PostgreSQLParserRULE_set_clause_list = 477 + PostgreSQLParserRULE_set_clause = 478 + PostgreSQLParserRULE_set_target = 479 + PostgreSQLParserRULE_set_target_list = 480 + PostgreSQLParserRULE_declarecursorstmt = 481 + PostgreSQLParserRULE_cursor_name = 482 + PostgreSQLParserRULE_cursor_options = 483 + PostgreSQLParserRULE_opt_hold = 484 + PostgreSQLParserRULE_selectstmt = 485 + PostgreSQLParserRULE_select_with_parens = 486 + PostgreSQLParserRULE_select_no_parens = 487 + PostgreSQLParserRULE_select_clause = 488 + PostgreSQLParserRULE_simple_select_intersect = 489 + PostgreSQLParserRULE_simple_select_pramary = 490 + PostgreSQLParserRULE_with_clause = 491 + PostgreSQLParserRULE_cte_list = 492 + PostgreSQLParserRULE_common_table_expr = 493 + PostgreSQLParserRULE_opt_materialized = 494 + PostgreSQLParserRULE_opt_with_clause = 495 + PostgreSQLParserRULE_into_clause = 496 + PostgreSQLParserRULE_opt_strict = 497 + PostgreSQLParserRULE_opttempTableName = 498 + PostgreSQLParserRULE_opt_table = 499 + PostgreSQLParserRULE_all_or_distinct = 500 + PostgreSQLParserRULE_distinct_clause = 501 + PostgreSQLParserRULE_opt_all_clause = 502 + PostgreSQLParserRULE_opt_sort_clause = 503 + PostgreSQLParserRULE_sort_clause = 504 + PostgreSQLParserRULE_sortby_list = 505 + PostgreSQLParserRULE_sortby = 506 + PostgreSQLParserRULE_select_limit = 507 + PostgreSQLParserRULE_opt_select_limit = 508 + PostgreSQLParserRULE_limit_clause = 509 + PostgreSQLParserRULE_offset_clause = 510 + PostgreSQLParserRULE_select_limit_value = 511 + PostgreSQLParserRULE_select_offset_value = 512 + PostgreSQLParserRULE_select_fetch_first_value = 513 + PostgreSQLParserRULE_i_or_f_const = 514 + PostgreSQLParserRULE_row_or_rows = 515 + PostgreSQLParserRULE_first_or_next = 516 + PostgreSQLParserRULE_group_clause = 517 + PostgreSQLParserRULE_group_by_list = 518 + PostgreSQLParserRULE_group_by_item = 519 + PostgreSQLParserRULE_empty_grouping_set = 520 + PostgreSQLParserRULE_rollup_clause = 521 + PostgreSQLParserRULE_cube_clause = 522 + PostgreSQLParserRULE_grouping_sets_clause = 523 + PostgreSQLParserRULE_having_clause = 524 + PostgreSQLParserRULE_for_locking_clause = 525 + PostgreSQLParserRULE_opt_for_locking_clause = 526 + PostgreSQLParserRULE_for_locking_items = 527 + PostgreSQLParserRULE_for_locking_item = 528 + PostgreSQLParserRULE_for_locking_strength = 529 + PostgreSQLParserRULE_locked_rels_list = 530 + PostgreSQLParserRULE_values_clause = 531 + PostgreSQLParserRULE_from_clause = 532 + PostgreSQLParserRULE_from_list = 533 + PostgreSQLParserRULE_table_ref = 534 + PostgreSQLParserRULE_joined_table = 535 + PostgreSQLParserRULE_alias_clause = 536 + PostgreSQLParserRULE_opt_alias_clause = 537 + PostgreSQLParserRULE_table_alias_clause = 538 + PostgreSQLParserRULE_func_alias_clause = 539 + PostgreSQLParserRULE_join_type = 540 + PostgreSQLParserRULE_join_qual = 541 + PostgreSQLParserRULE_relation_expr = 542 + PostgreSQLParserRULE_relation_expr_list = 543 + PostgreSQLParserRULE_relation_expr_opt_alias = 544 + PostgreSQLParserRULE_tablesample_clause = 545 + PostgreSQLParserRULE_opt_repeatable_clause = 546 + PostgreSQLParserRULE_func_table = 547 + PostgreSQLParserRULE_rowsfrom_item = 548 + PostgreSQLParserRULE_rowsfrom_list = 549 + PostgreSQLParserRULE_opt_col_def_list = 550 + PostgreSQLParserRULE_opt_ordinality = 551 + PostgreSQLParserRULE_where_clause = 552 + PostgreSQLParserRULE_where_or_current_clause = 553 + PostgreSQLParserRULE_opttablefuncelementlist = 554 + PostgreSQLParserRULE_tablefuncelementlist = 555 + PostgreSQLParserRULE_tablefuncelement = 556 + PostgreSQLParserRULE_xmltable = 557 + PostgreSQLParserRULE_xmltable_column_list = 558 + PostgreSQLParserRULE_xmltable_column_el = 559 + PostgreSQLParserRULE_xmltable_column_option_list = 560 + PostgreSQLParserRULE_xmltable_column_option_el = 561 + PostgreSQLParserRULE_xml_namespace_list = 562 + PostgreSQLParserRULE_xml_namespace_el = 563 + PostgreSQLParserRULE_typename = 564 + PostgreSQLParserRULE_opt_array_bounds = 565 + PostgreSQLParserRULE_simpletypename = 566 + PostgreSQLParserRULE_consttypename = 567 + PostgreSQLParserRULE_generictype = 568 + PostgreSQLParserRULE_opt_type_modifiers = 569 + PostgreSQLParserRULE_numeric = 570 + PostgreSQLParserRULE_opt_float = 571 + PostgreSQLParserRULE_bit = 572 + PostgreSQLParserRULE_constbit = 573 + PostgreSQLParserRULE_bitwithlength = 574 + PostgreSQLParserRULE_bitwithoutlength = 575 + PostgreSQLParserRULE_character = 576 + PostgreSQLParserRULE_constcharacter = 577 + PostgreSQLParserRULE_character_c = 578 + PostgreSQLParserRULE_opt_varying = 579 + PostgreSQLParserRULE_constdatetime = 580 + PostgreSQLParserRULE_constinterval = 581 + PostgreSQLParserRULE_opt_timezone = 582 + PostgreSQLParserRULE_opt_interval = 583 + PostgreSQLParserRULE_interval_second = 584 + PostgreSQLParserRULE_opt_escape = 585 + PostgreSQLParserRULE_a_expr = 586 + PostgreSQLParserRULE_a_expr_qual = 587 + PostgreSQLParserRULE_a_expr_lessless = 588 + PostgreSQLParserRULE_a_expr_or = 589 + PostgreSQLParserRULE_a_expr_and = 590 + PostgreSQLParserRULE_a_expr_between = 591 + PostgreSQLParserRULE_a_expr_in = 592 + PostgreSQLParserRULE_a_expr_unary_not = 593 + PostgreSQLParserRULE_a_expr_isnull = 594 + PostgreSQLParserRULE_a_expr_is_not = 595 + PostgreSQLParserRULE_a_expr_compare = 596 + PostgreSQLParserRULE_a_expr_like = 597 + PostgreSQLParserRULE_a_expr_qual_op = 598 + PostgreSQLParserRULE_a_expr_unary_qualop = 599 + PostgreSQLParserRULE_a_expr_add = 600 + PostgreSQLParserRULE_a_expr_mul = 601 + PostgreSQLParserRULE_a_expr_caret = 602 + PostgreSQLParserRULE_a_expr_unary_sign = 603 + PostgreSQLParserRULE_a_expr_at_time_zone = 604 + PostgreSQLParserRULE_a_expr_collate = 605 + PostgreSQLParserRULE_a_expr_typecast = 606 + PostgreSQLParserRULE_b_expr = 607 + PostgreSQLParserRULE_c_expr = 608 + PostgreSQLParserRULE_plsqlvariablename = 609 + PostgreSQLParserRULE_func_application = 610 + PostgreSQLParserRULE_func_expr = 611 + PostgreSQLParserRULE_func_expr_windowless = 612 + PostgreSQLParserRULE_func_expr_common_subexpr = 613 + PostgreSQLParserRULE_xml_root_version = 614 + PostgreSQLParserRULE_opt_xml_root_standalone = 615 + PostgreSQLParserRULE_xml_attributes = 616 + PostgreSQLParserRULE_xml_attribute_list = 617 + PostgreSQLParserRULE_xml_attribute_el = 618 + PostgreSQLParserRULE_document_or_content = 619 + PostgreSQLParserRULE_xml_whitespace_option = 620 + PostgreSQLParserRULE_xmlexists_argument = 621 + PostgreSQLParserRULE_xml_passing_mech = 622 + PostgreSQLParserRULE_within_group_clause = 623 + PostgreSQLParserRULE_filter_clause = 624 + PostgreSQLParserRULE_window_clause = 625 + PostgreSQLParserRULE_window_definition_list = 626 + PostgreSQLParserRULE_window_definition = 627 + PostgreSQLParserRULE_over_clause = 628 + PostgreSQLParserRULE_window_specification = 629 + PostgreSQLParserRULE_opt_existing_window_name = 630 + PostgreSQLParserRULE_opt_partition_clause = 631 + PostgreSQLParserRULE_opt_frame_clause = 632 + PostgreSQLParserRULE_frame_extent = 633 + PostgreSQLParserRULE_frame_bound = 634 + PostgreSQLParserRULE_opt_window_exclusion_clause = 635 + PostgreSQLParserRULE_row = 636 + PostgreSQLParserRULE_explicit_row = 637 + PostgreSQLParserRULE_implicit_row = 638 + PostgreSQLParserRULE_sub_type = 639 + PostgreSQLParserRULE_all_op = 640 + PostgreSQLParserRULE_mathop = 641 + PostgreSQLParserRULE_qual_op = 642 + PostgreSQLParserRULE_qual_all_op = 643 + PostgreSQLParserRULE_subquery_Op = 644 + PostgreSQLParserRULE_expr_list = 645 + PostgreSQLParserRULE_func_arg_list = 646 + PostgreSQLParserRULE_func_arg_expr = 647 + PostgreSQLParserRULE_type_list = 648 + PostgreSQLParserRULE_array_expr = 649 + PostgreSQLParserRULE_array_expr_list = 650 + PostgreSQLParserRULE_extract_list = 651 + PostgreSQLParserRULE_extract_arg = 652 + PostgreSQLParserRULE_unicode_normal_form = 653 + PostgreSQLParserRULE_overlay_list = 654 + PostgreSQLParserRULE_position_list = 655 + PostgreSQLParserRULE_substr_list = 656 + PostgreSQLParserRULE_trim_list = 657 + PostgreSQLParserRULE_in_expr = 658 + PostgreSQLParserRULE_case_expr = 659 + PostgreSQLParserRULE_when_clause_list = 660 + PostgreSQLParserRULE_when_clause = 661 + PostgreSQLParserRULE_case_default = 662 + PostgreSQLParserRULE_case_arg = 663 + PostgreSQLParserRULE_columnref = 664 + PostgreSQLParserRULE_indirection_el = 665 + PostgreSQLParserRULE_opt_slice_bound = 666 + PostgreSQLParserRULE_indirection = 667 + PostgreSQLParserRULE_opt_indirection = 668 + PostgreSQLParserRULE_opt_target_list = 669 + PostgreSQLParserRULE_target_list = 670 + PostgreSQLParserRULE_target_el = 671 + PostgreSQLParserRULE_target_alias = 672 + PostgreSQLParserRULE_qualified_name_list = 673 + PostgreSQLParserRULE_qualified_name = 674 + PostgreSQLParserRULE_name_list = 675 + PostgreSQLParserRULE_name = 676 + PostgreSQLParserRULE_attr_name = 677 + PostgreSQLParserRULE_file_name = 678 + PostgreSQLParserRULE_func_name = 679 + PostgreSQLParserRULE_aexprconst = 680 + PostgreSQLParserRULE_xconst = 681 + PostgreSQLParserRULE_bconst = 682 + PostgreSQLParserRULE_fconst = 683 + PostgreSQLParserRULE_iconst = 684 + PostgreSQLParserRULE_sconst = 685 + PostgreSQLParserRULE_anysconst = 686 + PostgreSQLParserRULE_opt_uescape = 687 + PostgreSQLParserRULE_signediconst = 688 + PostgreSQLParserRULE_roleid = 689 + PostgreSQLParserRULE_rolespec = 690 + PostgreSQLParserRULE_role_list = 691 + PostgreSQLParserRULE_colid = 692 + PostgreSQLParserRULE_table_alias = 693 + PostgreSQLParserRULE_type_function_name = 694 + PostgreSQLParserRULE_nonreservedword = 695 + PostgreSQLParserRULE_collabel = 696 + PostgreSQLParserRULE_identifier = 697 + PostgreSQLParserRULE_plsqlidentifier = 698 + PostgreSQLParserRULE_unreserved_keyword = 699 + PostgreSQLParserRULE_col_name_keyword = 700 + PostgreSQLParserRULE_type_func_name_keyword = 701 + PostgreSQLParserRULE_reserved_keyword = 702 + PostgreSQLParserRULE_builtin_function_name = 703 + PostgreSQLParserRULE_pl_function = 704 + PostgreSQLParserRULE_comp_options = 705 + PostgreSQLParserRULE_comp_option = 706 + PostgreSQLParserRULE_sharp = 707 + PostgreSQLParserRULE_option_value = 708 + PostgreSQLParserRULE_opt_semi = 709 + PostgreSQLParserRULE_pl_block = 710 + PostgreSQLParserRULE_decl_sect = 711 + PostgreSQLParserRULE_decl_start = 712 + PostgreSQLParserRULE_decl_stmts = 713 + PostgreSQLParserRULE_label_decl = 714 + PostgreSQLParserRULE_decl_stmt = 715 + PostgreSQLParserRULE_decl_statement = 716 + PostgreSQLParserRULE_opt_scrollable = 717 + PostgreSQLParserRULE_decl_cursor_query = 718 + PostgreSQLParserRULE_decl_cursor_args = 719 + PostgreSQLParserRULE_decl_cursor_arglist = 720 + PostgreSQLParserRULE_decl_cursor_arg = 721 + PostgreSQLParserRULE_decl_is_for = 722 + PostgreSQLParserRULE_decl_aliasitem = 723 + PostgreSQLParserRULE_decl_varname = 724 + PostgreSQLParserRULE_decl_const = 725 + PostgreSQLParserRULE_decl_datatype = 726 + PostgreSQLParserRULE_decl_collate = 727 + PostgreSQLParserRULE_decl_notnull = 728 + PostgreSQLParserRULE_decl_defval = 729 + PostgreSQLParserRULE_decl_defkey = 730 + PostgreSQLParserRULE_assign_operator = 731 + PostgreSQLParserRULE_proc_sect = 732 + PostgreSQLParserRULE_proc_stmt = 733 + PostgreSQLParserRULE_stmt_perform = 734 + PostgreSQLParserRULE_stmt_call = 735 + PostgreSQLParserRULE_opt_expr_list = 736 + PostgreSQLParserRULE_stmt_assign = 737 + PostgreSQLParserRULE_stmt_getdiag = 738 + PostgreSQLParserRULE_getdiag_area_opt = 739 + PostgreSQLParserRULE_getdiag_list = 740 + PostgreSQLParserRULE_getdiag_list_item = 741 + PostgreSQLParserRULE_getdiag_item = 742 + PostgreSQLParserRULE_getdiag_target = 743 + PostgreSQLParserRULE_assign_var = 744 + PostgreSQLParserRULE_stmt_if = 745 + PostgreSQLParserRULE_stmt_elsifs = 746 + PostgreSQLParserRULE_stmt_else = 747 + PostgreSQLParserRULE_stmt_case = 748 + PostgreSQLParserRULE_opt_expr_until_when = 749 + PostgreSQLParserRULE_case_when_list = 750 + PostgreSQLParserRULE_case_when = 751 + PostgreSQLParserRULE_opt_case_else = 752 + PostgreSQLParserRULE_stmt_loop = 753 + PostgreSQLParserRULE_stmt_while = 754 + PostgreSQLParserRULE_stmt_for = 755 + PostgreSQLParserRULE_for_control = 756 + PostgreSQLParserRULE_opt_for_using_expression = 757 + PostgreSQLParserRULE_opt_cursor_parameters = 758 + PostgreSQLParserRULE_opt_reverse = 759 + PostgreSQLParserRULE_opt_by_expression = 760 + PostgreSQLParserRULE_for_variable = 761 + PostgreSQLParserRULE_stmt_foreach_a = 762 + PostgreSQLParserRULE_foreach_slice = 763 + PostgreSQLParserRULE_stmt_exit = 764 + PostgreSQLParserRULE_exit_type = 765 + PostgreSQLParserRULE_stmt_return = 766 + PostgreSQLParserRULE_opt_return_result = 767 + PostgreSQLParserRULE_stmt_raise = 768 + PostgreSQLParserRULE_opt_stmt_raise_level = 769 + PostgreSQLParserRULE_opt_raise_list = 770 + PostgreSQLParserRULE_opt_raise_using = 771 + PostgreSQLParserRULE_opt_raise_using_elem = 772 + PostgreSQLParserRULE_opt_raise_using_elem_list = 773 + PostgreSQLParserRULE_stmt_assert = 774 + PostgreSQLParserRULE_opt_stmt_assert_message = 775 + PostgreSQLParserRULE_loop_body = 776 + PostgreSQLParserRULE_stmt_execsql = 777 + PostgreSQLParserRULE_stmt_dynexecute = 778 + PostgreSQLParserRULE_opt_execute_using = 779 + PostgreSQLParserRULE_opt_execute_using_list = 780 + PostgreSQLParserRULE_opt_execute_into = 781 + PostgreSQLParserRULE_stmt_open = 782 + PostgreSQLParserRULE_opt_open_bound_list_item = 783 + PostgreSQLParserRULE_opt_open_bound_list = 784 + PostgreSQLParserRULE_opt_open_using = 785 + PostgreSQLParserRULE_opt_scroll_option = 786 + PostgreSQLParserRULE_opt_scroll_option_no = 787 + PostgreSQLParserRULE_stmt_fetch = 788 + PostgreSQLParserRULE_into_target = 789 + PostgreSQLParserRULE_opt_cursor_from = 790 + PostgreSQLParserRULE_opt_fetch_direction = 791 + PostgreSQLParserRULE_stmt_move = 792 + PostgreSQLParserRULE_stmt_close = 793 + PostgreSQLParserRULE_stmt_null = 794 + PostgreSQLParserRULE_stmt_commit = 795 + PostgreSQLParserRULE_stmt_rollback = 796 + PostgreSQLParserRULE_plsql_opt_transaction_chain = 797 + PostgreSQLParserRULE_stmt_set = 798 + PostgreSQLParserRULE_cursor_variable = 799 + PostgreSQLParserRULE_exception_sect = 800 + PostgreSQLParserRULE_proc_exceptions = 801 + PostgreSQLParserRULE_proc_exception = 802 + PostgreSQLParserRULE_proc_conditions = 803 + PostgreSQLParserRULE_proc_condition = 804 + PostgreSQLParserRULE_opt_block_label = 805 + PostgreSQLParserRULE_opt_loop_label = 806 + PostgreSQLParserRULE_opt_label = 807 + PostgreSQLParserRULE_opt_exitcond = 808 + PostgreSQLParserRULE_any_identifier = 809 + PostgreSQLParserRULE_plsql_unreserved_keyword = 810 + PostgreSQLParserRULE_sql_expression = 811 + PostgreSQLParserRULE_expr_until_then = 812 + PostgreSQLParserRULE_expr_until_semi = 813 + PostgreSQLParserRULE_expr_until_rightbracket = 814 + PostgreSQLParserRULE_expr_until_loop = 815 + PostgreSQLParserRULE_make_execsql_stmt = 816 + PostgreSQLParserRULE_opt_returning_clause_into = 817 +) + +// IRootContext is an interface to support dynamic dispatch. +type IRootContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Stmtblock() IStmtblockContext + EOF() antlr.TerminalNode + + // IsRootContext differentiates from other interfaces. + IsRootContext() +} + +type RootContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRootContext() *RootContext { + var p = new(RootContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_root + return p +} + +func InitEmptyRootContext(p *RootContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_root +} + +func (*RootContext) IsRootContext() {} + +func NewRootContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RootContext { + var p = new(RootContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_root + + return p +} + +func (s *RootContext) GetParser() antlr.Parser { return s.parser } + +func (s *RootContext) Stmtblock() IStmtblockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmtblockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmtblockContext) +} + +func (s *RootContext) EOF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEOF, 0) +} + +func (s *RootContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RootContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RootContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRoot(s) + } +} + +func (s *RootContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRoot(s) + } +} + +func (s *RootContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRoot(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Root() (localctx IRootContext) { + localctx = NewRootContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 0, PostgreSQLParserRULE_root) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1636) + p.Stmtblock() + } + { + p.SetState(1637) + p.Match(PostgreSQLParserEOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPlsqlrootContext is an interface to support dynamic dispatch. +type IPlsqlrootContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Pl_function() IPl_functionContext + + // IsPlsqlrootContext differentiates from other interfaces. + IsPlsqlrootContext() +} + +type PlsqlrootContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPlsqlrootContext() *PlsqlrootContext { + var p = new(PlsqlrootContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsqlroot + return p +} + +func InitEmptyPlsqlrootContext(p *PlsqlrootContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsqlroot +} + +func (*PlsqlrootContext) IsPlsqlrootContext() {} + +func NewPlsqlrootContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PlsqlrootContext { + var p = new(PlsqlrootContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_plsqlroot + + return p +} + +func (s *PlsqlrootContext) GetParser() antlr.Parser { return s.parser } + +func (s *PlsqlrootContext) Pl_function() IPl_functionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPl_functionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPl_functionContext) +} + +func (s *PlsqlrootContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PlsqlrootContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PlsqlrootContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPlsqlroot(s) + } +} + +func (s *PlsqlrootContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPlsqlroot(s) + } +} + +func (s *PlsqlrootContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPlsqlroot(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Plsqlroot() (localctx IPlsqlrootContext) { + localctx = NewPlsqlrootContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 2, PostgreSQLParserRULE_plsqlroot) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1639) + p.Pl_function() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmtblockContext is an interface to support dynamic dispatch. +type IStmtblockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Stmtmulti() IStmtmultiContext + + // IsStmtblockContext differentiates from other interfaces. + IsStmtblockContext() +} + +type StmtblockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmtblockContext() *StmtblockContext { + var p = new(StmtblockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmtblock + return p +} + +func InitEmptyStmtblockContext(p *StmtblockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmtblock +} + +func (*StmtblockContext) IsStmtblockContext() {} + +func NewStmtblockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StmtblockContext { + var p = new(StmtblockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmtblock + + return p +} + +func (s *StmtblockContext) GetParser() antlr.Parser { return s.parser } + +func (s *StmtblockContext) Stmtmulti() IStmtmultiContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmtmultiContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmtmultiContext) +} + +func (s *StmtblockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *StmtblockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *StmtblockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmtblock(s) + } +} + +func (s *StmtblockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmtblock(s) + } +} + +func (s *StmtblockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmtblock(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmtblock() (localctx IStmtblockContext) { + localctx = NewStmtblockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 4, PostgreSQLParserRULE_stmtblock) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1641) + p.Stmtmulti() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmtmultiContext is an interface to support dynamic dispatch. +type IStmtmultiContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllStmt() []IStmtContext + Stmt(i int) IStmtContext + AllSEMI() []antlr.TerminalNode + SEMI(i int) antlr.TerminalNode + + // IsStmtmultiContext differentiates from other interfaces. + IsStmtmultiContext() +} + +type StmtmultiContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmtmultiContext() *StmtmultiContext { + var p = new(StmtmultiContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmtmulti + return p +} + +func InitEmptyStmtmultiContext(p *StmtmultiContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmtmulti +} + +func (*StmtmultiContext) IsStmtmultiContext() {} + +func NewStmtmultiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StmtmultiContext { + var p = new(StmtmultiContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmtmulti + + return p +} + +func (s *StmtmultiContext) GetParser() antlr.Parser { return s.parser } + +func (s *StmtmultiContext) AllStmt() []IStmtContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IStmtContext); ok { + len++ + } + } + + tst := make([]IStmtContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IStmtContext); ok { + tst[i] = t.(IStmtContext) + i++ + } + } + + return tst +} + +func (s *StmtmultiContext) Stmt(i int) IStmtContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmtContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IStmtContext) +} + +func (s *StmtmultiContext) AllSEMI() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserSEMI) +} + +func (s *StmtmultiContext) SEMI(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, i) +} + +func (s *StmtmultiContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *StmtmultiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *StmtmultiContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmtmulti(s) + } +} + +func (s *StmtmultiContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmtmulti(s) + } +} + +func (s *StmtmultiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmtmulti(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmtmulti() (localctx IStmtmultiContext) { + localctx = NewStmtmultiContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 6, PostgreSQLParserRULE_stmtmulti) + var _la int + + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(1649) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(1643) + p.Stmt() + } + p.SetState(1645) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSEMI { + { + p.SetState(1644) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + + } + p.SetState(1651) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmtContext is an interface to support dynamic dispatch. +type IStmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Altereventtrigstmt() IAltereventtrigstmtContext + Altercollationstmt() IAltercollationstmtContext + Alterdatabasestmt() IAlterdatabasestmtContext + Alterdatabasesetstmt() IAlterdatabasesetstmtContext + Alterdefaultprivilegesstmt() IAlterdefaultprivilegesstmtContext + Alterdomainstmt() IAlterdomainstmtContext + Alterenumstmt() IAlterenumstmtContext + Alterextensionstmt() IAlterextensionstmtContext + Alterextensioncontentsstmt() IAlterextensioncontentsstmtContext + Alterfdwstmt() IAlterfdwstmtContext + Alterforeignserverstmt() IAlterforeignserverstmtContext + Alterfunctionstmt() IAlterfunctionstmtContext + Altergroupstmt() IAltergroupstmtContext + Alterobjectdependsstmt() IAlterobjectdependsstmtContext + Alterobjectschemastmt() IAlterobjectschemastmtContext + Alterownerstmt() IAlterownerstmtContext + Alteroperatorstmt() IAlteroperatorstmtContext + Altertypestmt() IAltertypestmtContext + Alterpolicystmt() IAlterpolicystmtContext + Alterseqstmt() IAlterseqstmtContext + Altersystemstmt() IAltersystemstmtContext + Altertablestmt() IAltertablestmtContext + Altertblspcstmt() IAltertblspcstmtContext + Altercompositetypestmt() IAltercompositetypestmtContext + Alterpublicationstmt() IAlterpublicationstmtContext + Alterrolesetstmt() IAlterrolesetstmtContext + Alterrolestmt() IAlterrolestmtContext + Altersubscriptionstmt() IAltersubscriptionstmtContext + Alterstatsstmt() IAlterstatsstmtContext + Altertsconfigurationstmt() IAltertsconfigurationstmtContext + Altertsdictionarystmt() IAltertsdictionarystmtContext + Alterusermappingstmt() IAlterusermappingstmtContext + Analyzestmt() IAnalyzestmtContext + Callstmt() ICallstmtContext + Checkpointstmt() ICheckpointstmtContext + Closeportalstmt() ICloseportalstmtContext + Clusterstmt() IClusterstmtContext + Commentstmt() ICommentstmtContext + Constraintssetstmt() IConstraintssetstmtContext + Copystmt() ICopystmtContext + Createamstmt() ICreateamstmtContext + Createasstmt() ICreateasstmtContext + Createassertionstmt() ICreateassertionstmtContext + Createcaststmt() ICreatecaststmtContext + Createconversionstmt() ICreateconversionstmtContext + Createdomainstmt() ICreatedomainstmtContext + Createextensionstmt() ICreateextensionstmtContext + Createfdwstmt() ICreatefdwstmtContext + Createforeignserverstmt() ICreateforeignserverstmtContext + Createforeigntablestmt() ICreateforeigntablestmtContext + Createfunctionstmt() ICreatefunctionstmtContext + Creategroupstmt() ICreategroupstmtContext + Creatematviewstmt() ICreatematviewstmtContext + Createopclassstmt() ICreateopclassstmtContext + Createopfamilystmt() ICreateopfamilystmtContext + Createpublicationstmt() ICreatepublicationstmtContext + Alteropfamilystmt() IAlteropfamilystmtContext + Createpolicystmt() ICreatepolicystmtContext + Createplangstmt() ICreateplangstmtContext + Createschemastmt() ICreateschemastmtContext + Createseqstmt() ICreateseqstmtContext + Createstmt() ICreatestmtContext + Createsubscriptionstmt() ICreatesubscriptionstmtContext + Createstatsstmt() ICreatestatsstmtContext + Createtablespacestmt() ICreatetablespacestmtContext + Createtransformstmt() ICreatetransformstmtContext + Createtrigstmt() ICreatetrigstmtContext + Createeventtrigstmt() ICreateeventtrigstmtContext + Createrolestmt() ICreaterolestmtContext + Createuserstmt() ICreateuserstmtContext + Createusermappingstmt() ICreateusermappingstmtContext + Createdbstmt() ICreatedbstmtContext + Deallocatestmt() IDeallocatestmtContext + Declarecursorstmt() IDeclarecursorstmtContext + Definestmt() IDefinestmtContext + Deletestmt() IDeletestmtContext + Discardstmt() IDiscardstmtContext + Dostmt() IDostmtContext + Dropcaststmt() IDropcaststmtContext + Dropopclassstmt() IDropopclassstmtContext + Dropopfamilystmt() IDropopfamilystmtContext + Dropownedstmt() IDropownedstmtContext + Dropstmt() IDropstmtContext + Dropsubscriptionstmt() IDropsubscriptionstmtContext + Droptablespacestmt() IDroptablespacestmtContext + Droptransformstmt() IDroptransformstmtContext + Droprolestmt() IDroprolestmtContext + Dropusermappingstmt() IDropusermappingstmtContext + Dropdbstmt() IDropdbstmtContext + Executestmt() IExecutestmtContext + Explainstmt() IExplainstmtContext + Fetchstmt() IFetchstmtContext + Grantstmt() IGrantstmtContext + Grantrolestmt() IGrantrolestmtContext + Importforeignschemastmt() IImportforeignschemastmtContext + Indexstmt() IIndexstmtContext + Insertstmt() IInsertstmtContext + Mergestmt() IMergestmtContext + Listenstmt() IListenstmtContext + Refreshmatviewstmt() IRefreshmatviewstmtContext + Loadstmt() ILoadstmtContext + Lockstmt() ILockstmtContext + Notifystmt() INotifystmtContext + Preparestmt() IPreparestmtContext + Reassignownedstmt() IReassignownedstmtContext + Reindexstmt() IReindexstmtContext + Removeaggrstmt() IRemoveaggrstmtContext + Removefuncstmt() IRemovefuncstmtContext + Removeoperstmt() IRemoveoperstmtContext + Renamestmt() IRenamestmtContext + Revokestmt() IRevokestmtContext + Revokerolestmt() IRevokerolestmtContext + Rulestmt() IRulestmtContext + Seclabelstmt() ISeclabelstmtContext + Selectstmt() ISelectstmtContext + Transactionstmt() ITransactionstmtContext + Truncatestmt() ITruncatestmtContext + Unlistenstmt() IUnlistenstmtContext + Updatestmt() IUpdatestmtContext + Vacuumstmt() IVacuumstmtContext + Variableresetstmt() IVariableresetstmtContext + Variablesetstmt() IVariablesetstmtContext + Variableshowstmt() IVariableshowstmtContext + Viewstmt() IViewstmtContext + Plsqlconsolecommand() IPlsqlconsolecommandContext + + // IsStmtContext differentiates from other interfaces. + IsStmtContext() +} + +type StmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmtContext() *StmtContext { + var p = new(StmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt + return p +} + +func InitEmptyStmtContext(p *StmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt +} + +func (*StmtContext) IsStmtContext() {} + +func NewStmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StmtContext { + var p = new(StmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt + + return p +} + +func (s *StmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *StmtContext) Altereventtrigstmt() IAltereventtrigstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltereventtrigstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltereventtrigstmtContext) +} + +func (s *StmtContext) Altercollationstmt() IAltercollationstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltercollationstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltercollationstmtContext) +} + +func (s *StmtContext) Alterdatabasestmt() IAlterdatabasestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterdatabasestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterdatabasestmtContext) +} + +func (s *StmtContext) Alterdatabasesetstmt() IAlterdatabasesetstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterdatabasesetstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterdatabasesetstmtContext) +} + +func (s *StmtContext) Alterdefaultprivilegesstmt() IAlterdefaultprivilegesstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterdefaultprivilegesstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterdefaultprivilegesstmtContext) +} + +func (s *StmtContext) Alterdomainstmt() IAlterdomainstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterdomainstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterdomainstmtContext) +} + +func (s *StmtContext) Alterenumstmt() IAlterenumstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterenumstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterenumstmtContext) +} + +func (s *StmtContext) Alterextensionstmt() IAlterextensionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterextensionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterextensionstmtContext) +} + +func (s *StmtContext) Alterextensioncontentsstmt() IAlterextensioncontentsstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterextensioncontentsstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterextensioncontentsstmtContext) +} + +func (s *StmtContext) Alterfdwstmt() IAlterfdwstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterfdwstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterfdwstmtContext) +} + +func (s *StmtContext) Alterforeignserverstmt() IAlterforeignserverstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterforeignserverstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterforeignserverstmtContext) +} + +func (s *StmtContext) Alterfunctionstmt() IAlterfunctionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterfunctionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterfunctionstmtContext) +} + +func (s *StmtContext) Altergroupstmt() IAltergroupstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltergroupstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltergroupstmtContext) +} + +func (s *StmtContext) Alterobjectdependsstmt() IAlterobjectdependsstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterobjectdependsstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterobjectdependsstmtContext) +} + +func (s *StmtContext) Alterobjectschemastmt() IAlterobjectschemastmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterobjectschemastmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterobjectschemastmtContext) +} + +func (s *StmtContext) Alterownerstmt() IAlterownerstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterownerstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterownerstmtContext) +} + +func (s *StmtContext) Alteroperatorstmt() IAlteroperatorstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlteroperatorstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlteroperatorstmtContext) +} + +func (s *StmtContext) Altertypestmt() IAltertypestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltertypestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltertypestmtContext) +} + +func (s *StmtContext) Alterpolicystmt() IAlterpolicystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterpolicystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterpolicystmtContext) +} + +func (s *StmtContext) Alterseqstmt() IAlterseqstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterseqstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterseqstmtContext) +} + +func (s *StmtContext) Altersystemstmt() IAltersystemstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltersystemstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltersystemstmtContext) +} + +func (s *StmtContext) Altertablestmt() IAltertablestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltertablestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltertablestmtContext) +} + +func (s *StmtContext) Altertblspcstmt() IAltertblspcstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltertblspcstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltertblspcstmtContext) +} + +func (s *StmtContext) Altercompositetypestmt() IAltercompositetypestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltercompositetypestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltercompositetypestmtContext) +} + +func (s *StmtContext) Alterpublicationstmt() IAlterpublicationstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterpublicationstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterpublicationstmtContext) +} + +func (s *StmtContext) Alterrolesetstmt() IAlterrolesetstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterrolesetstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterrolesetstmtContext) +} + +func (s *StmtContext) Alterrolestmt() IAlterrolestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterrolestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterrolestmtContext) +} + +func (s *StmtContext) Altersubscriptionstmt() IAltersubscriptionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltersubscriptionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltersubscriptionstmtContext) +} + +func (s *StmtContext) Alterstatsstmt() IAlterstatsstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterstatsstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterstatsstmtContext) +} + +func (s *StmtContext) Altertsconfigurationstmt() IAltertsconfigurationstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltertsconfigurationstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltertsconfigurationstmtContext) +} + +func (s *StmtContext) Altertsdictionarystmt() IAltertsdictionarystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAltertsdictionarystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAltertsdictionarystmtContext) +} + +func (s *StmtContext) Alterusermappingstmt() IAlterusermappingstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterusermappingstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterusermappingstmtContext) +} + +func (s *StmtContext) Analyzestmt() IAnalyzestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAnalyzestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAnalyzestmtContext) +} + +func (s *StmtContext) Callstmt() ICallstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICallstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICallstmtContext) +} + +func (s *StmtContext) Checkpointstmt() ICheckpointstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICheckpointstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICheckpointstmtContext) +} + +func (s *StmtContext) Closeportalstmt() ICloseportalstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICloseportalstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICloseportalstmtContext) +} + +func (s *StmtContext) Clusterstmt() IClusterstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IClusterstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IClusterstmtContext) +} + +func (s *StmtContext) Commentstmt() ICommentstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICommentstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICommentstmtContext) +} + +func (s *StmtContext) Constraintssetstmt() IConstraintssetstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraintssetstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraintssetstmtContext) +} + +func (s *StmtContext) Copystmt() ICopystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopystmtContext) +} + +func (s *StmtContext) Createamstmt() ICreateamstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateamstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateamstmtContext) +} + +func (s *StmtContext) Createasstmt() ICreateasstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateasstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateasstmtContext) +} + +func (s *StmtContext) Createassertionstmt() ICreateassertionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateassertionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateassertionstmtContext) +} + +func (s *StmtContext) Createcaststmt() ICreatecaststmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatecaststmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatecaststmtContext) +} + +func (s *StmtContext) Createconversionstmt() ICreateconversionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateconversionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateconversionstmtContext) +} + +func (s *StmtContext) Createdomainstmt() ICreatedomainstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatedomainstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatedomainstmtContext) +} + +func (s *StmtContext) Createextensionstmt() ICreateextensionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateextensionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateextensionstmtContext) +} + +func (s *StmtContext) Createfdwstmt() ICreatefdwstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatefdwstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatefdwstmtContext) +} + +func (s *StmtContext) Createforeignserverstmt() ICreateforeignserverstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateforeignserverstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateforeignserverstmtContext) +} + +func (s *StmtContext) Createforeigntablestmt() ICreateforeigntablestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateforeigntablestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateforeigntablestmtContext) +} + +func (s *StmtContext) Createfunctionstmt() ICreatefunctionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatefunctionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatefunctionstmtContext) +} + +func (s *StmtContext) Creategroupstmt() ICreategroupstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreategroupstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreategroupstmtContext) +} + +func (s *StmtContext) Creatematviewstmt() ICreatematviewstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatematviewstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatematviewstmtContext) +} + +func (s *StmtContext) Createopclassstmt() ICreateopclassstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateopclassstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateopclassstmtContext) +} + +func (s *StmtContext) Createopfamilystmt() ICreateopfamilystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateopfamilystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateopfamilystmtContext) +} + +func (s *StmtContext) Createpublicationstmt() ICreatepublicationstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatepublicationstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatepublicationstmtContext) +} + +func (s *StmtContext) Alteropfamilystmt() IAlteropfamilystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlteropfamilystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlteropfamilystmtContext) +} + +func (s *StmtContext) Createpolicystmt() ICreatepolicystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatepolicystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatepolicystmtContext) +} + +func (s *StmtContext) Createplangstmt() ICreateplangstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateplangstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateplangstmtContext) +} + +func (s *StmtContext) Createschemastmt() ICreateschemastmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateschemastmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateschemastmtContext) +} + +func (s *StmtContext) Createseqstmt() ICreateseqstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateseqstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateseqstmtContext) +} + +func (s *StmtContext) Createstmt() ICreatestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatestmtContext) +} + +func (s *StmtContext) Createsubscriptionstmt() ICreatesubscriptionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatesubscriptionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatesubscriptionstmtContext) +} + +func (s *StmtContext) Createstatsstmt() ICreatestatsstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatestatsstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatestatsstmtContext) +} + +func (s *StmtContext) Createtablespacestmt() ICreatetablespacestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatetablespacestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatetablespacestmtContext) +} + +func (s *StmtContext) Createtransformstmt() ICreatetransformstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatetransformstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatetransformstmtContext) +} + +func (s *StmtContext) Createtrigstmt() ICreatetrigstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatetrigstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatetrigstmtContext) +} + +func (s *StmtContext) Createeventtrigstmt() ICreateeventtrigstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateeventtrigstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateeventtrigstmtContext) +} + +func (s *StmtContext) Createrolestmt() ICreaterolestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreaterolestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreaterolestmtContext) +} + +func (s *StmtContext) Createuserstmt() ICreateuserstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateuserstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateuserstmtContext) +} + +func (s *StmtContext) Createusermappingstmt() ICreateusermappingstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateusermappingstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateusermappingstmtContext) +} + +func (s *StmtContext) Createdbstmt() ICreatedbstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatedbstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatedbstmtContext) +} + +func (s *StmtContext) Deallocatestmt() IDeallocatestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDeallocatestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDeallocatestmtContext) +} + +func (s *StmtContext) Declarecursorstmt() IDeclarecursorstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDeclarecursorstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDeclarecursorstmtContext) +} + +func (s *StmtContext) Definestmt() IDefinestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefinestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefinestmtContext) +} + +func (s *StmtContext) Deletestmt() IDeletestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDeletestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDeletestmtContext) +} + +func (s *StmtContext) Discardstmt() IDiscardstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDiscardstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDiscardstmtContext) +} + +func (s *StmtContext) Dostmt() IDostmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDostmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDostmtContext) +} + +func (s *StmtContext) Dropcaststmt() IDropcaststmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDropcaststmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDropcaststmtContext) +} + +func (s *StmtContext) Dropopclassstmt() IDropopclassstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDropopclassstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDropopclassstmtContext) +} + +func (s *StmtContext) Dropopfamilystmt() IDropopfamilystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDropopfamilystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDropopfamilystmtContext) +} + +func (s *StmtContext) Dropownedstmt() IDropownedstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDropownedstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDropownedstmtContext) +} + +func (s *StmtContext) Dropstmt() IDropstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDropstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDropstmtContext) +} + +func (s *StmtContext) Dropsubscriptionstmt() IDropsubscriptionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDropsubscriptionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDropsubscriptionstmtContext) +} + +func (s *StmtContext) Droptablespacestmt() IDroptablespacestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDroptablespacestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDroptablespacestmtContext) +} + +func (s *StmtContext) Droptransformstmt() IDroptransformstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDroptransformstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDroptransformstmtContext) +} + +func (s *StmtContext) Droprolestmt() IDroprolestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDroprolestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDroprolestmtContext) +} + +func (s *StmtContext) Dropusermappingstmt() IDropusermappingstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDropusermappingstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDropusermappingstmtContext) +} + +func (s *StmtContext) Dropdbstmt() IDropdbstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDropdbstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDropdbstmtContext) +} + +func (s *StmtContext) Executestmt() IExecutestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExecutestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExecutestmtContext) +} + +func (s *StmtContext) Explainstmt() IExplainstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExplainstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExplainstmtContext) +} + +func (s *StmtContext) Fetchstmt() IFetchstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFetchstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFetchstmtContext) +} + +func (s *StmtContext) Grantstmt() IGrantstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrantstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrantstmtContext) +} + +func (s *StmtContext) Grantrolestmt() IGrantrolestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrantrolestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrantrolestmtContext) +} + +func (s *StmtContext) Importforeignschemastmt() IImportforeignschemastmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IImportforeignschemastmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IImportforeignschemastmtContext) +} + +func (s *StmtContext) Indexstmt() IIndexstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndexstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndexstmtContext) +} + +func (s *StmtContext) Insertstmt() IInsertstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsertstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInsertstmtContext) +} + +func (s *StmtContext) Mergestmt() IMergestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IMergestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IMergestmtContext) +} + +func (s *StmtContext) Listenstmt() IListenstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IListenstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IListenstmtContext) +} + +func (s *StmtContext) Refreshmatviewstmt() IRefreshmatviewstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRefreshmatviewstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRefreshmatviewstmtContext) +} + +func (s *StmtContext) Loadstmt() ILoadstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILoadstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILoadstmtContext) +} + +func (s *StmtContext) Lockstmt() ILockstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILockstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILockstmtContext) +} + +func (s *StmtContext) Notifystmt() INotifystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INotifystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INotifystmtContext) +} + +func (s *StmtContext) Preparestmt() IPreparestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPreparestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPreparestmtContext) +} + +func (s *StmtContext) Reassignownedstmt() IReassignownedstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReassignownedstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReassignownedstmtContext) +} + +func (s *StmtContext) Reindexstmt() IReindexstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReindexstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReindexstmtContext) +} + +func (s *StmtContext) Removeaggrstmt() IRemoveaggrstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRemoveaggrstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRemoveaggrstmtContext) +} + +func (s *StmtContext) Removefuncstmt() IRemovefuncstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRemovefuncstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRemovefuncstmtContext) +} + +func (s *StmtContext) Removeoperstmt() IRemoveoperstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRemoveoperstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRemoveoperstmtContext) +} + +func (s *StmtContext) Renamestmt() IRenamestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRenamestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRenamestmtContext) +} + +func (s *StmtContext) Revokestmt() IRevokestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRevokestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRevokestmtContext) +} + +func (s *StmtContext) Revokerolestmt() IRevokerolestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRevokerolestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRevokerolestmtContext) +} + +func (s *StmtContext) Rulestmt() IRulestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRulestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRulestmtContext) +} + +func (s *StmtContext) Seclabelstmt() ISeclabelstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISeclabelstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISeclabelstmtContext) +} + +func (s *StmtContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *StmtContext) Transactionstmt() ITransactionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransactionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransactionstmtContext) +} + +func (s *StmtContext) Truncatestmt() ITruncatestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITruncatestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITruncatestmtContext) +} + +func (s *StmtContext) Unlistenstmt() IUnlistenstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnlistenstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnlistenstmtContext) +} + +func (s *StmtContext) Updatestmt() IUpdatestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUpdatestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUpdatestmtContext) +} + +func (s *StmtContext) Vacuumstmt() IVacuumstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVacuumstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVacuumstmtContext) +} + +func (s *StmtContext) Variableresetstmt() IVariableresetstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVariableresetstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVariableresetstmtContext) +} + +func (s *StmtContext) Variablesetstmt() IVariablesetstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVariablesetstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVariablesetstmtContext) +} + +func (s *StmtContext) Variableshowstmt() IVariableshowstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVariableshowstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVariableshowstmtContext) +} + +func (s *StmtContext) Viewstmt() IViewstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IViewstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IViewstmtContext) +} + +func (s *StmtContext) Plsqlconsolecommand() IPlsqlconsolecommandContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsqlconsolecommandContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsqlconsolecommandContext) +} + +func (s *StmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *StmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *StmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt(s) + } +} + +func (s *StmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt(s) + } +} + +func (s *StmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt() (localctx IStmtContext) { + localctx = NewStmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 8, PostgreSQLParserRULE_stmt) + p.SetState(1777) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 2, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1652) + p.Altereventtrigstmt() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(1653) + p.Altercollationstmt() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(1654) + p.Alterdatabasestmt() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(1655) + p.Alterdatabasesetstmt() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(1656) + p.Alterdefaultprivilegesstmt() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(1657) + p.Alterdomainstmt() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(1658) + p.Alterenumstmt() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(1659) + p.Alterextensionstmt() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(1660) + p.Alterextensioncontentsstmt() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(1661) + p.Alterfdwstmt() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(1662) + p.Alterforeignserverstmt() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(1663) + p.Alterfunctionstmt() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(1664) + p.Altergroupstmt() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(1665) + p.Alterobjectdependsstmt() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(1666) + p.Alterobjectschemastmt() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(1667) + p.Alterownerstmt() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(1668) + p.Alteroperatorstmt() + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(1669) + p.Altertypestmt() + } + + case 19: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(1670) + p.Alterpolicystmt() + } + + case 20: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(1671) + p.Alterseqstmt() + } + + case 21: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(1672) + p.Altersystemstmt() + } + + case 22: + p.EnterOuterAlt(localctx, 22) + { + p.SetState(1673) + p.Altertablestmt() + } + + case 23: + p.EnterOuterAlt(localctx, 23) + { + p.SetState(1674) + p.Altertblspcstmt() + } + + case 24: + p.EnterOuterAlt(localctx, 24) + { + p.SetState(1675) + p.Altercompositetypestmt() + } + + case 25: + p.EnterOuterAlt(localctx, 25) + { + p.SetState(1676) + p.Alterpublicationstmt() + } + + case 26: + p.EnterOuterAlt(localctx, 26) + { + p.SetState(1677) + p.Alterrolesetstmt() + } + + case 27: + p.EnterOuterAlt(localctx, 27) + { + p.SetState(1678) + p.Alterrolestmt() + } + + case 28: + p.EnterOuterAlt(localctx, 28) + { + p.SetState(1679) + p.Altersubscriptionstmt() + } + + case 29: + p.EnterOuterAlt(localctx, 29) + { + p.SetState(1680) + p.Alterstatsstmt() + } + + case 30: + p.EnterOuterAlt(localctx, 30) + { + p.SetState(1681) + p.Altertsconfigurationstmt() + } + + case 31: + p.EnterOuterAlt(localctx, 31) + { + p.SetState(1682) + p.Altertsdictionarystmt() + } + + case 32: + p.EnterOuterAlt(localctx, 32) + { + p.SetState(1683) + p.Alterusermappingstmt() + } + + case 33: + p.EnterOuterAlt(localctx, 33) + { + p.SetState(1684) + p.Analyzestmt() + } + + case 34: + p.EnterOuterAlt(localctx, 34) + { + p.SetState(1685) + p.Callstmt() + } + + case 35: + p.EnterOuterAlt(localctx, 35) + { + p.SetState(1686) + p.Checkpointstmt() + } + + case 36: + p.EnterOuterAlt(localctx, 36) + { + p.SetState(1687) + p.Closeportalstmt() + } + + case 37: + p.EnterOuterAlt(localctx, 37) + { + p.SetState(1688) + p.Clusterstmt() + } + + case 38: + p.EnterOuterAlt(localctx, 38) + { + p.SetState(1689) + p.Commentstmt() + } + + case 39: + p.EnterOuterAlt(localctx, 39) + { + p.SetState(1690) + p.Constraintssetstmt() + } + + case 40: + p.EnterOuterAlt(localctx, 40) + { + p.SetState(1691) + p.Copystmt() + } + + case 41: + p.EnterOuterAlt(localctx, 41) + { + p.SetState(1692) + p.Createamstmt() + } + + case 42: + p.EnterOuterAlt(localctx, 42) + { + p.SetState(1693) + p.Createasstmt() + } + + case 43: + p.EnterOuterAlt(localctx, 43) + { + p.SetState(1694) + p.Createassertionstmt() + } + + case 44: + p.EnterOuterAlt(localctx, 44) + { + p.SetState(1695) + p.Createcaststmt() + } + + case 45: + p.EnterOuterAlt(localctx, 45) + { + p.SetState(1696) + p.Createconversionstmt() + } + + case 46: + p.EnterOuterAlt(localctx, 46) + { + p.SetState(1697) + p.Createdomainstmt() + } + + case 47: + p.EnterOuterAlt(localctx, 47) + { + p.SetState(1698) + p.Createextensionstmt() + } + + case 48: + p.EnterOuterAlt(localctx, 48) + { + p.SetState(1699) + p.Createfdwstmt() + } + + case 49: + p.EnterOuterAlt(localctx, 49) + { + p.SetState(1700) + p.Createforeignserverstmt() + } + + case 50: + p.EnterOuterAlt(localctx, 50) + { + p.SetState(1701) + p.Createforeigntablestmt() + } + + case 51: + p.EnterOuterAlt(localctx, 51) + { + p.SetState(1702) + p.Createfunctionstmt() + } + + case 52: + p.EnterOuterAlt(localctx, 52) + { + p.SetState(1703) + p.Creategroupstmt() + } + + case 53: + p.EnterOuterAlt(localctx, 53) + { + p.SetState(1704) + p.Creatematviewstmt() + } + + case 54: + p.EnterOuterAlt(localctx, 54) + { + p.SetState(1705) + p.Createopclassstmt() + } + + case 55: + p.EnterOuterAlt(localctx, 55) + { + p.SetState(1706) + p.Createopfamilystmt() + } + + case 56: + p.EnterOuterAlt(localctx, 56) + { + p.SetState(1707) + p.Createpublicationstmt() + } + + case 57: + p.EnterOuterAlt(localctx, 57) + { + p.SetState(1708) + p.Alteropfamilystmt() + } + + case 58: + p.EnterOuterAlt(localctx, 58) + { + p.SetState(1709) + p.Createpolicystmt() + } + + case 59: + p.EnterOuterAlt(localctx, 59) + { + p.SetState(1710) + p.Createplangstmt() + } + + case 60: + p.EnterOuterAlt(localctx, 60) + { + p.SetState(1711) + p.Createschemastmt() + } + + case 61: + p.EnterOuterAlt(localctx, 61) + { + p.SetState(1712) + p.Createseqstmt() + } + + case 62: + p.EnterOuterAlt(localctx, 62) + { + p.SetState(1713) + p.Createstmt() + } + + case 63: + p.EnterOuterAlt(localctx, 63) + { + p.SetState(1714) + p.Createsubscriptionstmt() + } + + case 64: + p.EnterOuterAlt(localctx, 64) + { + p.SetState(1715) + p.Createstatsstmt() + } + + case 65: + p.EnterOuterAlt(localctx, 65) + { + p.SetState(1716) + p.Createtablespacestmt() + } + + case 66: + p.EnterOuterAlt(localctx, 66) + { + p.SetState(1717) + p.Createtransformstmt() + } + + case 67: + p.EnterOuterAlt(localctx, 67) + { + p.SetState(1718) + p.Createtrigstmt() + } + + case 68: + p.EnterOuterAlt(localctx, 68) + { + p.SetState(1719) + p.Createeventtrigstmt() + } + + case 69: + p.EnterOuterAlt(localctx, 69) + { + p.SetState(1720) + p.Createrolestmt() + } + + case 70: + p.EnterOuterAlt(localctx, 70) + { + p.SetState(1721) + p.Createuserstmt() + } + + case 71: + p.EnterOuterAlt(localctx, 71) + { + p.SetState(1722) + p.Createusermappingstmt() + } + + case 72: + p.EnterOuterAlt(localctx, 72) + { + p.SetState(1723) + p.Createdbstmt() + } + + case 73: + p.EnterOuterAlt(localctx, 73) + { + p.SetState(1724) + p.Deallocatestmt() + } + + case 74: + p.EnterOuterAlt(localctx, 74) + { + p.SetState(1725) + p.Declarecursorstmt() + } + + case 75: + p.EnterOuterAlt(localctx, 75) + { + p.SetState(1726) + p.Definestmt() + } + + case 76: + p.EnterOuterAlt(localctx, 76) + { + p.SetState(1727) + p.Deletestmt() + } + + case 77: + p.EnterOuterAlt(localctx, 77) + { + p.SetState(1728) + p.Discardstmt() + } + + case 78: + p.EnterOuterAlt(localctx, 78) + { + p.SetState(1729) + p.Dostmt() + } + + case 79: + p.EnterOuterAlt(localctx, 79) + { + p.SetState(1730) + p.Dropcaststmt() + } + + case 80: + p.EnterOuterAlt(localctx, 80) + { + p.SetState(1731) + p.Dropopclassstmt() + } + + case 81: + p.EnterOuterAlt(localctx, 81) + { + p.SetState(1732) + p.Dropopfamilystmt() + } + + case 82: + p.EnterOuterAlt(localctx, 82) + { + p.SetState(1733) + p.Dropownedstmt() + } + + case 83: + p.EnterOuterAlt(localctx, 83) + { + p.SetState(1734) + p.Dropstmt() + } + + case 84: + p.EnterOuterAlt(localctx, 84) + { + p.SetState(1735) + p.Dropsubscriptionstmt() + } + + case 85: + p.EnterOuterAlt(localctx, 85) + { + p.SetState(1736) + p.Droptablespacestmt() + } + + case 86: + p.EnterOuterAlt(localctx, 86) + { + p.SetState(1737) + p.Droptransformstmt() + } + + case 87: + p.EnterOuterAlt(localctx, 87) + { + p.SetState(1738) + p.Droprolestmt() + } + + case 88: + p.EnterOuterAlt(localctx, 88) + { + p.SetState(1739) + p.Dropusermappingstmt() + } + + case 89: + p.EnterOuterAlt(localctx, 89) + { + p.SetState(1740) + p.Dropdbstmt() + } + + case 90: + p.EnterOuterAlt(localctx, 90) + { + p.SetState(1741) + p.Executestmt() + } + + case 91: + p.EnterOuterAlt(localctx, 91) + { + p.SetState(1742) + p.Explainstmt() + } + + case 92: + p.EnterOuterAlt(localctx, 92) + { + p.SetState(1743) + p.Fetchstmt() + } + + case 93: + p.EnterOuterAlt(localctx, 93) + { + p.SetState(1744) + p.Grantstmt() + } + + case 94: + p.EnterOuterAlt(localctx, 94) + { + p.SetState(1745) + p.Grantrolestmt() + } + + case 95: + p.EnterOuterAlt(localctx, 95) + { + p.SetState(1746) + p.Importforeignschemastmt() + } + + case 96: + p.EnterOuterAlt(localctx, 96) + { + p.SetState(1747) + p.Indexstmt() + } + + case 97: + p.EnterOuterAlt(localctx, 97) + { + p.SetState(1748) + p.Insertstmt() + } + + case 98: + p.EnterOuterAlt(localctx, 98) + { + p.SetState(1749) + p.Mergestmt() + } + + case 99: + p.EnterOuterAlt(localctx, 99) + { + p.SetState(1750) + p.Listenstmt() + } + + case 100: + p.EnterOuterAlt(localctx, 100) + { + p.SetState(1751) + p.Refreshmatviewstmt() + } + + case 101: + p.EnterOuterAlt(localctx, 101) + { + p.SetState(1752) + p.Loadstmt() + } + + case 102: + p.EnterOuterAlt(localctx, 102) + { + p.SetState(1753) + p.Lockstmt() + } + + case 103: + p.EnterOuterAlt(localctx, 103) + { + p.SetState(1754) + p.Notifystmt() + } + + case 104: + p.EnterOuterAlt(localctx, 104) + { + p.SetState(1755) + p.Preparestmt() + } + + case 105: + p.EnterOuterAlt(localctx, 105) + { + p.SetState(1756) + p.Reassignownedstmt() + } + + case 106: + p.EnterOuterAlt(localctx, 106) + { + p.SetState(1757) + p.Reindexstmt() + } + + case 107: + p.EnterOuterAlt(localctx, 107) + { + p.SetState(1758) + p.Removeaggrstmt() + } + + case 108: + p.EnterOuterAlt(localctx, 108) + { + p.SetState(1759) + p.Removefuncstmt() + } + + case 109: + p.EnterOuterAlt(localctx, 109) + { + p.SetState(1760) + p.Removeoperstmt() + } + + case 110: + p.EnterOuterAlt(localctx, 110) + { + p.SetState(1761) + p.Renamestmt() + } + + case 111: + p.EnterOuterAlt(localctx, 111) + { + p.SetState(1762) + p.Revokestmt() + } + + case 112: + p.EnterOuterAlt(localctx, 112) + { + p.SetState(1763) + p.Revokerolestmt() + } + + case 113: + p.EnterOuterAlt(localctx, 113) + { + p.SetState(1764) + p.Rulestmt() + } + + case 114: + p.EnterOuterAlt(localctx, 114) + { + p.SetState(1765) + p.Seclabelstmt() + } + + case 115: + p.EnterOuterAlt(localctx, 115) + { + p.SetState(1766) + p.Selectstmt() + } + + case 116: + p.EnterOuterAlt(localctx, 116) + { + p.SetState(1767) + p.Transactionstmt() + } + + case 117: + p.EnterOuterAlt(localctx, 117) + { + p.SetState(1768) + p.Truncatestmt() + } + + case 118: + p.EnterOuterAlt(localctx, 118) + { + p.SetState(1769) + p.Unlistenstmt() + } + + case 119: + p.EnterOuterAlt(localctx, 119) + { + p.SetState(1770) + p.Updatestmt() + } + + case 120: + p.EnterOuterAlt(localctx, 120) + { + p.SetState(1771) + p.Vacuumstmt() + } + + case 121: + p.EnterOuterAlt(localctx, 121) + { + p.SetState(1772) + p.Variableresetstmt() + } + + case 122: + p.EnterOuterAlt(localctx, 122) + { + p.SetState(1773) + p.Variablesetstmt() + } + + case 123: + p.EnterOuterAlt(localctx, 123) + { + p.SetState(1774) + p.Variableshowstmt() + } + + case 124: + p.EnterOuterAlt(localctx, 124) + { + p.SetState(1775) + p.Viewstmt() + } + + case 125: + p.EnterOuterAlt(localctx, 125) + { + p.SetState(1776) + p.Plsqlconsolecommand() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPlsqlconsolecommandContext is an interface to support dynamic dispatch. +type IPlsqlconsolecommandContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + MetaCommand() antlr.TerminalNode + EndMetaCommand() antlr.TerminalNode + + // IsPlsqlconsolecommandContext differentiates from other interfaces. + IsPlsqlconsolecommandContext() +} + +type PlsqlconsolecommandContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPlsqlconsolecommandContext() *PlsqlconsolecommandContext { + var p = new(PlsqlconsolecommandContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsqlconsolecommand + return p +} + +func InitEmptyPlsqlconsolecommandContext(p *PlsqlconsolecommandContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsqlconsolecommand +} + +func (*PlsqlconsolecommandContext) IsPlsqlconsolecommandContext() {} + +func NewPlsqlconsolecommandContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PlsqlconsolecommandContext { + var p = new(PlsqlconsolecommandContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_plsqlconsolecommand + + return p +} + +func (s *PlsqlconsolecommandContext) GetParser() antlr.Parser { return s.parser } + +func (s *PlsqlconsolecommandContext) MetaCommand() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMetaCommand, 0) +} + +func (s *PlsqlconsolecommandContext) EndMetaCommand() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEndMetaCommand, 0) +} + +func (s *PlsqlconsolecommandContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PlsqlconsolecommandContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PlsqlconsolecommandContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPlsqlconsolecommand(s) + } +} + +func (s *PlsqlconsolecommandContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPlsqlconsolecommand(s) + } +} + +func (s *PlsqlconsolecommandContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPlsqlconsolecommand(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Plsqlconsolecommand() (localctx IPlsqlconsolecommandContext) { + localctx = NewPlsqlconsolecommandContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 10, PostgreSQLParserRULE_plsqlconsolecommand) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1779) + p.Match(PostgreSQLParserMetaCommand) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(1781) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEndMetaCommand { + { + p.SetState(1780) + p.Match(PostgreSQLParserEndMetaCommand) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICallstmtContext is an interface to support dynamic dispatch. +type ICallstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CALL() antlr.TerminalNode + Func_application() IFunc_applicationContext + + // IsCallstmtContext differentiates from other interfaces. + IsCallstmtContext() +} + +type CallstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCallstmtContext() *CallstmtContext { + var p = new(CallstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_callstmt + return p +} + +func InitEmptyCallstmtContext(p *CallstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_callstmt +} + +func (*CallstmtContext) IsCallstmtContext() {} + +func NewCallstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CallstmtContext { + var p = new(CallstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_callstmt + + return p +} + +func (s *CallstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CallstmtContext) CALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCALL, 0) +} + +func (s *CallstmtContext) Func_application() IFunc_applicationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_applicationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_applicationContext) +} + +func (s *CallstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CallstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CallstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCallstmt(s) + } +} + +func (s *CallstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCallstmt(s) + } +} + +func (s *CallstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCallstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Callstmt() (localctx ICallstmtContext) { + localctx = NewCallstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 12, PostgreSQLParserRULE_callstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1783) + p.Match(PostgreSQLParserCALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1784) + p.Func_application() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreaterolestmtContext is an interface to support dynamic dispatch. +type ICreaterolestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + ROLE() antlr.TerminalNode + Roleid() IRoleidContext + Optrolelist() IOptrolelistContext + Opt_with() IOpt_withContext + + // IsCreaterolestmtContext differentiates from other interfaces. + IsCreaterolestmtContext() +} + +type CreaterolestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreaterolestmtContext() *CreaterolestmtContext { + var p = new(CreaterolestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createrolestmt + return p +} + +func InitEmptyCreaterolestmtContext(p *CreaterolestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createrolestmt +} + +func (*CreaterolestmtContext) IsCreaterolestmtContext() {} + +func NewCreaterolestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreaterolestmtContext { + var p = new(CreaterolestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createrolestmt + + return p +} + +func (s *CreaterolestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreaterolestmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreaterolestmtContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *CreaterolestmtContext) Roleid() IRoleidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRoleidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRoleidContext) +} + +func (s *CreaterolestmtContext) Optrolelist() IOptrolelistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptrolelistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptrolelistContext) +} + +func (s *CreaterolestmtContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *CreaterolestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreaterolestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreaterolestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreaterolestmt(s) + } +} + +func (s *CreaterolestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreaterolestmt(s) + } +} + +func (s *CreaterolestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreaterolestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createrolestmt() (localctx ICreaterolestmtContext) { + localctx = NewCreaterolestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 14, PostgreSQLParserRULE_createrolestmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1786) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1787) + p.Match(PostgreSQLParserROLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1788) + p.Roleid() + } + p.SetState(1790) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) == 1 { + { + p.SetState(1789) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(1792) + p.Optrolelist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_withContext is an interface to support dynamic dispatch. +type IOpt_withContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + + // IsOpt_withContext differentiates from other interfaces. + IsOpt_withContext() +} + +type Opt_withContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_withContext() *Opt_withContext { + var p = new(Opt_withContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_with + return p +} + +func InitEmptyOpt_withContext(p *Opt_withContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_with +} + +func (*Opt_withContext) IsOpt_withContext() {} + +func NewOpt_withContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_withContext { + var p = new(Opt_withContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_with + + return p +} + +func (s *Opt_withContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_withContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_withContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_withContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_withContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_with(s) + } +} + +func (s *Opt_withContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_with(s) + } +} + +func (s *Opt_withContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_with(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_with() (localctx IOpt_withContext) { + localctx = NewOpt_withContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 16, PostgreSQLParserRULE_opt_with) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1794) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptrolelistContext is an interface to support dynamic dispatch. +type IOptrolelistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCreateoptroleelem() []ICreateoptroleelemContext + Createoptroleelem(i int) ICreateoptroleelemContext + + // IsOptrolelistContext differentiates from other interfaces. + IsOptrolelistContext() +} + +type OptrolelistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptrolelistContext() *OptrolelistContext { + var p = new(OptrolelistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optrolelist + return p +} + +func InitEmptyOptrolelistContext(p *OptrolelistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optrolelist +} + +func (*OptrolelistContext) IsOptrolelistContext() {} + +func NewOptrolelistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptrolelistContext { + var p = new(OptrolelistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optrolelist + + return p +} + +func (s *OptrolelistContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptrolelistContext) AllCreateoptroleelem() []ICreateoptroleelemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICreateoptroleelemContext); ok { + len++ + } + } + + tst := make([]ICreateoptroleelemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICreateoptroleelemContext); ok { + tst[i] = t.(ICreateoptroleelemContext) + i++ + } + } + + return tst +} + +func (s *OptrolelistContext) Createoptroleelem(i int) ICreateoptroleelemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateoptroleelemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICreateoptroleelemContext) +} + +func (s *OptrolelistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptrolelistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptrolelistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptrolelist(s) + } +} + +func (s *OptrolelistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptrolelist(s) + } +} + +func (s *OptrolelistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptrolelist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optrolelist() (localctx IOptrolelistContext) { + localctx = NewOptrolelistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 18, PostgreSQLParserRULE_optrolelist) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(1799) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(1796) + p.Createoptroleelem() + } + + } + p.SetState(1801) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlteroptrolelistContext is an interface to support dynamic dispatch. +type IAlteroptrolelistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAlteroptroleelem() []IAlteroptroleelemContext + Alteroptroleelem(i int) IAlteroptroleelemContext + + // IsAlteroptrolelistContext differentiates from other interfaces. + IsAlteroptrolelistContext() +} + +type AlteroptrolelistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlteroptrolelistContext() *AlteroptrolelistContext { + var p = new(AlteroptrolelistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alteroptrolelist + return p +} + +func InitEmptyAlteroptrolelistContext(p *AlteroptrolelistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alteroptrolelist +} + +func (*AlteroptrolelistContext) IsAlteroptrolelistContext() {} + +func NewAlteroptrolelistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlteroptrolelistContext { + var p = new(AlteroptrolelistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alteroptrolelist + + return p +} + +func (s *AlteroptrolelistContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlteroptrolelistContext) AllAlteroptroleelem() []IAlteroptroleelemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAlteroptroleelemContext); ok { + len++ + } + } + + tst := make([]IAlteroptroleelemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAlteroptroleelemContext); ok { + tst[i] = t.(IAlteroptroleelemContext) + i++ + } + } + + return tst +} + +func (s *AlteroptrolelistContext) Alteroptroleelem(i int) IAlteroptroleelemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlteroptroleelemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAlteroptroleelemContext) +} + +func (s *AlteroptrolelistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlteroptrolelistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlteroptrolelistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlteroptrolelist(s) + } +} + +func (s *AlteroptrolelistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlteroptrolelist(s) + } +} + +func (s *AlteroptrolelistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlteroptrolelist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alteroptrolelist() (localctx IAlteroptrolelistContext) { + localctx = NewAlteroptrolelistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 20, PostgreSQLParserRULE_alteroptrolelist) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(1805) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 6, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(1802) + p.Alteroptroleelem() + } + + } + p.SetState(1807) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 6, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlteroptroleelemContext is an interface to support dynamic dispatch. +type IAlteroptroleelemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PASSWORD() antlr.TerminalNode + Sconst() ISconstContext + NULL_P() antlr.TerminalNode + ENCRYPTED() antlr.TerminalNode + UNENCRYPTED() antlr.TerminalNode + INHERIT() antlr.TerminalNode + CONNECTION() antlr.TerminalNode + LIMIT() antlr.TerminalNode + Signediconst() ISignediconstContext + VALID() antlr.TerminalNode + UNTIL() antlr.TerminalNode + USER() antlr.TerminalNode + Role_list() IRole_listContext + Identifier() IIdentifierContext + + // IsAlteroptroleelemContext differentiates from other interfaces. + IsAlteroptroleelemContext() +} + +type AlteroptroleelemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlteroptroleelemContext() *AlteroptroleelemContext { + var p = new(AlteroptroleelemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alteroptroleelem + return p +} + +func InitEmptyAlteroptroleelemContext(p *AlteroptroleelemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alteroptroleelem +} + +func (*AlteroptroleelemContext) IsAlteroptroleelemContext() {} + +func NewAlteroptroleelemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlteroptroleelemContext { + var p = new(AlteroptroleelemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alteroptroleelem + + return p +} + +func (s *AlteroptroleelemContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlteroptroleelemContext) PASSWORD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPASSWORD, 0) +} + +func (s *AlteroptroleelemContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *AlteroptroleelemContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *AlteroptroleelemContext) ENCRYPTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENCRYPTED, 0) +} + +func (s *AlteroptroleelemContext) UNENCRYPTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNENCRYPTED, 0) +} + +func (s *AlteroptroleelemContext) INHERIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINHERIT, 0) +} + +func (s *AlteroptroleelemContext) CONNECTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONNECTION, 0) +} + +func (s *AlteroptroleelemContext) LIMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIMIT, 0) +} + +func (s *AlteroptroleelemContext) Signediconst() ISignediconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISignediconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISignediconstContext) +} + +func (s *AlteroptroleelemContext) VALID() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALID, 0) +} + +func (s *AlteroptroleelemContext) UNTIL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNTIL, 0) +} + +func (s *AlteroptroleelemContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *AlteroptroleelemContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *AlteroptroleelemContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *AlteroptroleelemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlteroptroleelemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlteroptroleelemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlteroptroleelem(s) + } +} + +func (s *AlteroptroleelemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlteroptroleelem(s) + } +} + +func (s *AlteroptroleelemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlteroptroleelem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alteroptroleelem() (localctx IAlteroptroleelemContext) { + localctx = NewAlteroptroleelemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 22, PostgreSQLParserRULE_alteroptroleelem) + var _la int + + p.SetState(1826) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserPASSWORD: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1808) + p.Match(PostgreSQLParserPASSWORD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(1811) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + { + p.SetState(1809) + p.Sconst() + } + + case PostgreSQLParserNULL_P: + { + p.SetState(1810) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case PostgreSQLParserENCRYPTED, PostgreSQLParserUNENCRYPTED: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(1813) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserENCRYPTED || _la == PostgreSQLParserUNENCRYPTED) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(1814) + p.Match(PostgreSQLParserPASSWORD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1815) + p.Sconst() + } + + case PostgreSQLParserINHERIT: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(1816) + p.Match(PostgreSQLParserINHERIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCONNECTION: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(1817) + p.Match(PostgreSQLParserCONNECTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1818) + p.Match(PostgreSQLParserLIMIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1819) + p.Signediconst() + } + + case PostgreSQLParserVALID: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(1820) + p.Match(PostgreSQLParserVALID) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1821) + p.Match(PostgreSQLParserUNTIL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1822) + p.Sconst() + } + + case PostgreSQLParserUSER: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(1823) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1824) + p.Role_list() + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserOUTER_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserBACKWARD, PostgreSQLParserCHAIN, PostgreSQLParserCLOSE, PostgreSQLParserCOMMIT, PostgreSQLParserCONTINUE_P, PostgreSQLParserCURSOR, PostgreSQLParserFIRST_P, PostgreSQLParserFORWARD, PostgreSQLParserINSERT, PostgreSQLParserLAST_P, PostgreSQLParserMOVE, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserOPTION, PostgreSQLParserPRIOR, PostgreSQLParserRELATIVE_P, PostgreSQLParserRESET, PostgreSQLParserROLLBACK, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSET, PostgreSQLParserTYPE_P, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserROWTYPE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(1825) + p.Identifier() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateoptroleelemContext is an interface to support dynamic dispatch. +type ICreateoptroleelemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Alteroptroleelem() IAlteroptroleelemContext + SYSID() antlr.TerminalNode + Iconst() IIconstContext + ADMIN() antlr.TerminalNode + Role_list() IRole_listContext + ROLE() antlr.TerminalNode + IN_P() antlr.TerminalNode + GROUP_P() antlr.TerminalNode + + // IsCreateoptroleelemContext differentiates from other interfaces. + IsCreateoptroleelemContext() +} + +type CreateoptroleelemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateoptroleelemContext() *CreateoptroleelemContext { + var p = new(CreateoptroleelemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createoptroleelem + return p +} + +func InitEmptyCreateoptroleelemContext(p *CreateoptroleelemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createoptroleelem +} + +func (*CreateoptroleelemContext) IsCreateoptroleelemContext() {} + +func NewCreateoptroleelemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateoptroleelemContext { + var p = new(CreateoptroleelemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createoptroleelem + + return p +} + +func (s *CreateoptroleelemContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateoptroleelemContext) Alteroptroleelem() IAlteroptroleelemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlteroptroleelemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlteroptroleelemContext) +} + +func (s *CreateoptroleelemContext) SYSID() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYSID, 0) +} + +func (s *CreateoptroleelemContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *CreateoptroleelemContext) ADMIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADMIN, 0) +} + +func (s *CreateoptroleelemContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *CreateoptroleelemContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *CreateoptroleelemContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *CreateoptroleelemContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *CreateoptroleelemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateoptroleelemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateoptroleelemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateoptroleelem(s) + } +} + +func (s *CreateoptroleelemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateoptroleelem(s) + } +} + +func (s *CreateoptroleelemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateoptroleelem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createoptroleelem() (localctx ICreateoptroleelemContext) { + localctx = NewCreateoptroleelemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 24, PostgreSQLParserRULE_createoptroleelem) + var _la int + + p.SetState(1838) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserUSER, PostgreSQLParserIS, PostgreSQLParserOUTER_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserBACKWARD, PostgreSQLParserCHAIN, PostgreSQLParserCLOSE, PostgreSQLParserCOMMIT, PostgreSQLParserCONNECTION, PostgreSQLParserCONTINUE_P, PostgreSQLParserCURSOR, PostgreSQLParserENCRYPTED, PostgreSQLParserFIRST_P, PostgreSQLParserFORWARD, PostgreSQLParserINHERIT, PostgreSQLParserINSERT, PostgreSQLParserLAST_P, PostgreSQLParserMOVE, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserOPTION, PostgreSQLParserPASSWORD, PostgreSQLParserPRIOR, PostgreSQLParserRELATIVE_P, PostgreSQLParserRESET, PostgreSQLParserROLLBACK, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSET, PostgreSQLParserTYPE_P, PostgreSQLParserUNENCRYPTED, PostgreSQLParserVALID, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserROWTYPE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1828) + p.Alteroptroleelem() + } + + case PostgreSQLParserSYSID: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(1829) + p.Match(PostgreSQLParserSYSID) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1830) + p.Iconst() + } + + case PostgreSQLParserADMIN: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(1831) + p.Match(PostgreSQLParserADMIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1832) + p.Role_list() + } + + case PostgreSQLParserROLE: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(1833) + p.Match(PostgreSQLParserROLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1834) + p.Role_list() + } + + case PostgreSQLParserIN_P: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(1835) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1836) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserGROUP_P || _la == PostgreSQLParserROLE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(1837) + p.Role_list() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateuserstmtContext is an interface to support dynamic dispatch. +type ICreateuserstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + USER() antlr.TerminalNode + Roleid() IRoleidContext + Optrolelist() IOptrolelistContext + Opt_with() IOpt_withContext + + // IsCreateuserstmtContext differentiates from other interfaces. + IsCreateuserstmtContext() +} + +type CreateuserstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateuserstmtContext() *CreateuserstmtContext { + var p = new(CreateuserstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createuserstmt + return p +} + +func InitEmptyCreateuserstmtContext(p *CreateuserstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createuserstmt +} + +func (*CreateuserstmtContext) IsCreateuserstmtContext() {} + +func NewCreateuserstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateuserstmtContext { + var p = new(CreateuserstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createuserstmt + + return p +} + +func (s *CreateuserstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateuserstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateuserstmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *CreateuserstmtContext) Roleid() IRoleidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRoleidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRoleidContext) +} + +func (s *CreateuserstmtContext) Optrolelist() IOptrolelistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptrolelistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptrolelistContext) +} + +func (s *CreateuserstmtContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *CreateuserstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateuserstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateuserstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateuserstmt(s) + } +} + +func (s *CreateuserstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateuserstmt(s) + } +} + +func (s *CreateuserstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateuserstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createuserstmt() (localctx ICreateuserstmtContext) { + localctx = NewCreateuserstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 26, PostgreSQLParserRULE_createuserstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1840) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1841) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1842) + p.Roleid() + } + p.SetState(1844) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) == 1 { + { + p.SetState(1843) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(1846) + p.Optrolelist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterrolestmtContext is an interface to support dynamic dispatch. +type IAlterrolestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + Rolespec() IRolespecContext + Alteroptrolelist() IAlteroptrolelistContext + ROLE() antlr.TerminalNode + USER() antlr.TerminalNode + Opt_with() IOpt_withContext + + // IsAlterrolestmtContext differentiates from other interfaces. + IsAlterrolestmtContext() +} + +type AlterrolestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterrolestmtContext() *AlterrolestmtContext { + var p = new(AlterrolestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterrolestmt + return p +} + +func InitEmptyAlterrolestmtContext(p *AlterrolestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterrolestmt +} + +func (*AlterrolestmtContext) IsAlterrolestmtContext() {} + +func NewAlterrolestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterrolestmtContext { + var p = new(AlterrolestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterrolestmt + + return p +} + +func (s *AlterrolestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterrolestmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterrolestmtContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *AlterrolestmtContext) Alteroptrolelist() IAlteroptrolelistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlteroptrolelistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlteroptrolelistContext) +} + +func (s *AlterrolestmtContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *AlterrolestmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *AlterrolestmtContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *AlterrolestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterrolestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterrolestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterrolestmt(s) + } +} + +func (s *AlterrolestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterrolestmt(s) + } +} + +func (s *AlterrolestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterrolestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterrolestmt() (localctx IAlterrolestmtContext) { + localctx = NewAlterrolestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 28, PostgreSQLParserRULE_alterrolestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1848) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1849) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserUSER || _la == PostgreSQLParserROLE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(1850) + p.Rolespec() + } + p.SetState(1852) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) == 1 { + { + p.SetState(1851) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(1854) + p.Alteroptrolelist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_in_databaseContext is an interface to support dynamic dispatch. +type IOpt_in_databaseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IN_P() antlr.TerminalNode + DATABASE() antlr.TerminalNode + Name() INameContext + + // IsOpt_in_databaseContext differentiates from other interfaces. + IsOpt_in_databaseContext() +} + +type Opt_in_databaseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_in_databaseContext() *Opt_in_databaseContext { + var p = new(Opt_in_databaseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_in_database + return p +} + +func InitEmptyOpt_in_databaseContext(p *Opt_in_databaseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_in_database +} + +func (*Opt_in_databaseContext) IsOpt_in_databaseContext() {} + +func NewOpt_in_databaseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_in_databaseContext { + var p = new(Opt_in_databaseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_in_database + + return p +} + +func (s *Opt_in_databaseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_in_databaseContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Opt_in_databaseContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *Opt_in_databaseContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Opt_in_databaseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_in_databaseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_in_databaseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_in_database(s) + } +} + +func (s *Opt_in_databaseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_in_database(s) + } +} + +func (s *Opt_in_databaseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_in_database(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_in_database() (localctx IOpt_in_databaseContext) { + localctx = NewOpt_in_databaseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 30, PostgreSQLParserRULE_opt_in_database) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1856) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1857) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1858) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterrolesetstmtContext is an interface to support dynamic dispatch. +type IAlterrolesetstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + Rolespec() IRolespecContext + Setresetclause() ISetresetclauseContext + ROLE() antlr.TerminalNode + USER() antlr.TerminalNode + ALL() antlr.TerminalNode + Opt_in_database() IOpt_in_databaseContext + + // IsAlterrolesetstmtContext differentiates from other interfaces. + IsAlterrolesetstmtContext() +} + +type AlterrolesetstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterrolesetstmtContext() *AlterrolesetstmtContext { + var p = new(AlterrolesetstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterrolesetstmt + return p +} + +func InitEmptyAlterrolesetstmtContext(p *AlterrolesetstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterrolesetstmt +} + +func (*AlterrolesetstmtContext) IsAlterrolesetstmtContext() {} + +func NewAlterrolesetstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterrolesetstmtContext { + var p = new(AlterrolesetstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterrolesetstmt + + return p +} + +func (s *AlterrolesetstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterrolesetstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterrolesetstmtContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *AlterrolesetstmtContext) Setresetclause() ISetresetclauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISetresetclauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISetresetclauseContext) +} + +func (s *AlterrolesetstmtContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *AlterrolesetstmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *AlterrolesetstmtContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *AlterrolesetstmtContext) Opt_in_database() IOpt_in_databaseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_in_databaseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_in_databaseContext) +} + +func (s *AlterrolesetstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterrolesetstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterrolesetstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterrolesetstmt(s) + } +} + +func (s *AlterrolesetstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterrolesetstmt(s) + } +} + +func (s *AlterrolesetstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterrolesetstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterrolesetstmt() (localctx IAlterrolesetstmtContext) { + localctx = NewAlterrolesetstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 32, PostgreSQLParserRULE_alterrolesetstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1860) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1861) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserUSER || _la == PostgreSQLParserROLE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(1863) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserALL { + { + p.SetState(1862) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(1865) + p.Rolespec() + } + p.SetState(1867) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserIN_P { + { + p.SetState(1866) + p.Opt_in_database() + } + + } + { + p.SetState(1869) + p.Setresetclause() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDroprolestmtContext is an interface to support dynamic dispatch. +type IDroprolestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + Role_list() IRole_listContext + ROLE() antlr.TerminalNode + USER() antlr.TerminalNode + GROUP_P() antlr.TerminalNode + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsDroprolestmtContext differentiates from other interfaces. + IsDroprolestmtContext() +} + +type DroprolestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDroprolestmtContext() *DroprolestmtContext { + var p = new(DroprolestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_droprolestmt + return p +} + +func InitEmptyDroprolestmtContext(p *DroprolestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_droprolestmt +} + +func (*DroprolestmtContext) IsDroprolestmtContext() {} + +func NewDroprolestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DroprolestmtContext { + var p = new(DroprolestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_droprolestmt + + return p +} + +func (s *DroprolestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DroprolestmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DroprolestmtContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *DroprolestmtContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *DroprolestmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *DroprolestmtContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *DroprolestmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DroprolestmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DroprolestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DroprolestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DroprolestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDroprolestmt(s) + } +} + +func (s *DroprolestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDroprolestmt(s) + } +} + +func (s *DroprolestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDroprolestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Droprolestmt() (localctx IDroprolestmtContext) { + localctx = NewDroprolestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 34, PostgreSQLParserRULE_droprolestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1871) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1872) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserGROUP_P || _la == PostgreSQLParserUSER || _la == PostgreSQLParserROLE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(1875) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) == 1 { + { + p.SetState(1873) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1874) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(1877) + p.Role_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreategroupstmtContext is an interface to support dynamic dispatch. +type ICreategroupstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + GROUP_P() antlr.TerminalNode + Roleid() IRoleidContext + Optrolelist() IOptrolelistContext + Opt_with() IOpt_withContext + + // IsCreategroupstmtContext differentiates from other interfaces. + IsCreategroupstmtContext() +} + +type CreategroupstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreategroupstmtContext() *CreategroupstmtContext { + var p = new(CreategroupstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_creategroupstmt + return p +} + +func InitEmptyCreategroupstmtContext(p *CreategroupstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_creategroupstmt +} + +func (*CreategroupstmtContext) IsCreategroupstmtContext() {} + +func NewCreategroupstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreategroupstmtContext { + var p = new(CreategroupstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_creategroupstmt + + return p +} + +func (s *CreategroupstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreategroupstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreategroupstmtContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *CreategroupstmtContext) Roleid() IRoleidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRoleidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRoleidContext) +} + +func (s *CreategroupstmtContext) Optrolelist() IOptrolelistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptrolelistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptrolelistContext) +} + +func (s *CreategroupstmtContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *CreategroupstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreategroupstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreategroupstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreategroupstmt(s) + } +} + +func (s *CreategroupstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreategroupstmt(s) + } +} + +func (s *CreategroupstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreategroupstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Creategroupstmt() (localctx ICreategroupstmtContext) { + localctx = NewCreategroupstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 36, PostgreSQLParserRULE_creategroupstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1879) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1880) + p.Match(PostgreSQLParserGROUP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1881) + p.Roleid() + } + p.SetState(1883) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) == 1 { + { + p.SetState(1882) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(1885) + p.Optrolelist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltergroupstmtContext is an interface to support dynamic dispatch. +type IAltergroupstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + GROUP_P() antlr.TerminalNode + Rolespec() IRolespecContext + Add_drop() IAdd_dropContext + USER() antlr.TerminalNode + Role_list() IRole_listContext + + // IsAltergroupstmtContext differentiates from other interfaces. + IsAltergroupstmtContext() +} + +type AltergroupstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltergroupstmtContext() *AltergroupstmtContext { + var p = new(AltergroupstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altergroupstmt + return p +} + +func InitEmptyAltergroupstmtContext(p *AltergroupstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altergroupstmt +} + +func (*AltergroupstmtContext) IsAltergroupstmtContext() {} + +func NewAltergroupstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltergroupstmtContext { + var p = new(AltergroupstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altergroupstmt + + return p +} + +func (s *AltergroupstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltergroupstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltergroupstmtContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *AltergroupstmtContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *AltergroupstmtContext) Add_drop() IAdd_dropContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAdd_dropContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAdd_dropContext) +} + +func (s *AltergroupstmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *AltergroupstmtContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *AltergroupstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltergroupstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltergroupstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltergroupstmt(s) + } +} + +func (s *AltergroupstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltergroupstmt(s) + } +} + +func (s *AltergroupstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltergroupstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altergroupstmt() (localctx IAltergroupstmtContext) { + localctx = NewAltergroupstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 38, PostgreSQLParserRULE_altergroupstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1887) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1888) + p.Match(PostgreSQLParserGROUP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1889) + p.Rolespec() + } + { + p.SetState(1890) + p.Add_drop() + } + { + p.SetState(1891) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1892) + p.Role_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAdd_dropContext is an interface to support dynamic dispatch. +type IAdd_dropContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ADD_P() antlr.TerminalNode + DROP() antlr.TerminalNode + + // IsAdd_dropContext differentiates from other interfaces. + IsAdd_dropContext() +} + +type Add_dropContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAdd_dropContext() *Add_dropContext { + var p = new(Add_dropContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_add_drop + return p +} + +func InitEmptyAdd_dropContext(p *Add_dropContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_add_drop +} + +func (*Add_dropContext) IsAdd_dropContext() {} + +func NewAdd_dropContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Add_dropContext { + var p = new(Add_dropContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_add_drop + + return p +} + +func (s *Add_dropContext) GetParser() antlr.Parser { return s.parser } + +func (s *Add_dropContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *Add_dropContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *Add_dropContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Add_dropContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Add_dropContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAdd_drop(s) + } +} + +func (s *Add_dropContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAdd_drop(s) + } +} + +func (s *Add_dropContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAdd_drop(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Add_drop() (localctx IAdd_dropContext) { + localctx = NewAdd_dropContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 40, PostgreSQLParserRULE_add_drop) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1894) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserADD_P || _la == PostgreSQLParserDROP) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateschemastmtContext is an interface to support dynamic dispatch. +type ICreateschemastmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + Optschemaeltlist() IOptschemaeltlistContext + AUTHORIZATION() antlr.TerminalNode + Rolespec() IRolespecContext + Colid() IColidContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Optschemaname() IOptschemanameContext + + // IsCreateschemastmtContext differentiates from other interfaces. + IsCreateschemastmtContext() +} + +type CreateschemastmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateschemastmtContext() *CreateschemastmtContext { + var p = new(CreateschemastmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createschemastmt + return p +} + +func InitEmptyCreateschemastmtContext(p *CreateschemastmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createschemastmt +} + +func (*CreateschemastmtContext) IsCreateschemastmtContext() {} + +func NewCreateschemastmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateschemastmtContext { + var p = new(CreateschemastmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createschemastmt + + return p +} + +func (s *CreateschemastmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateschemastmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateschemastmtContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *CreateschemastmtContext) Optschemaeltlist() IOptschemaeltlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptschemaeltlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptschemaeltlistContext) +} + +func (s *CreateschemastmtContext) AUTHORIZATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAUTHORIZATION, 0) +} + +func (s *CreateschemastmtContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *CreateschemastmtContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *CreateschemastmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreateschemastmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreateschemastmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreateschemastmtContext) Optschemaname() IOptschemanameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptschemanameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptschemanameContext) +} + +func (s *CreateschemastmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateschemastmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateschemastmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateschemastmt(s) + } +} + +func (s *CreateschemastmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateschemastmt(s) + } +} + +func (s *CreateschemastmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateschemastmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createschemastmt() (localctx ICreateschemastmtContext) { + localctx = NewCreateschemastmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 42, PostgreSQLParserRULE_createschemastmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1896) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1897) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(1901) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 { + { + p.SetState(1898) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1899) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1900) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(1909) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) { + case 1: + p.SetState(1904) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(1903) + p.Optschemaname() + } + + } + { + p.SetState(1906) + p.Match(PostgreSQLParserAUTHORIZATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1907) + p.Rolespec() + } + + case 2: + { + p.SetState(1908) + p.Colid() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(1911) + p.Optschemaeltlist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptschemanameContext is an interface to support dynamic dispatch. +type IOptschemanameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + + // IsOptschemanameContext differentiates from other interfaces. + IsOptschemanameContext() +} + +type OptschemanameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptschemanameContext() *OptschemanameContext { + var p = new(OptschemanameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optschemaname + return p +} + +func InitEmptyOptschemanameContext(p *OptschemanameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optschemaname +} + +func (*OptschemanameContext) IsOptschemanameContext() {} + +func NewOptschemanameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptschemanameContext { + var p = new(OptschemanameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optschemaname + + return p +} + +func (s *OptschemanameContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptschemanameContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *OptschemanameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptschemanameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptschemanameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptschemaname(s) + } +} + +func (s *OptschemanameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptschemaname(s) + } +} + +func (s *OptschemanameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptschemaname(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optschemaname() (localctx IOptschemanameContext) { + localctx = NewOptschemanameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 44, PostgreSQLParserRULE_optschemaname) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1913) + p.Colid() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptschemaeltlistContext is an interface to support dynamic dispatch. +type IOptschemaeltlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSchema_stmt() []ISchema_stmtContext + Schema_stmt(i int) ISchema_stmtContext + + // IsOptschemaeltlistContext differentiates from other interfaces. + IsOptschemaeltlistContext() +} + +type OptschemaeltlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptschemaeltlistContext() *OptschemaeltlistContext { + var p = new(OptschemaeltlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optschemaeltlist + return p +} + +func InitEmptyOptschemaeltlistContext(p *OptschemaeltlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optschemaeltlist +} + +func (*OptschemaeltlistContext) IsOptschemaeltlistContext() {} + +func NewOptschemaeltlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptschemaeltlistContext { + var p = new(OptschemaeltlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optschemaeltlist + + return p +} + +func (s *OptschemaeltlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptschemaeltlistContext) AllSchema_stmt() []ISchema_stmtContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISchema_stmtContext); ok { + len++ + } + } + + tst := make([]ISchema_stmtContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISchema_stmtContext); ok { + tst[i] = t.(ISchema_stmtContext) + i++ + } + } + + return tst +} + +func (s *OptschemaeltlistContext) Schema_stmt(i int) ISchema_stmtContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISchema_stmtContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISchema_stmtContext) +} + +func (s *OptschemaeltlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptschemaeltlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptschemaeltlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptschemaeltlist(s) + } +} + +func (s *OptschemaeltlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptschemaeltlist(s) + } +} + +func (s *OptschemaeltlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptschemaeltlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optschemaeltlist() (localctx IOptschemaeltlistContext) { + localctx = NewOptschemaeltlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 46, PostgreSQLParserRULE_optschemaeltlist) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(1918) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 19, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(1915) + p.Schema_stmt() + } + + } + p.SetState(1920) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 19, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISchema_stmtContext is an interface to support dynamic dispatch. +type ISchema_stmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Createstmt() ICreatestmtContext + Indexstmt() IIndexstmtContext + Createseqstmt() ICreateseqstmtContext + Createtrigstmt() ICreatetrigstmtContext + Grantstmt() IGrantstmtContext + Viewstmt() IViewstmtContext + + // IsSchema_stmtContext differentiates from other interfaces. + IsSchema_stmtContext() +} + +type Schema_stmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySchema_stmtContext() *Schema_stmtContext { + var p = new(Schema_stmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_schema_stmt + return p +} + +func InitEmptySchema_stmtContext(p *Schema_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_schema_stmt +} + +func (*Schema_stmtContext) IsSchema_stmtContext() {} + +func NewSchema_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Schema_stmtContext { + var p = new(Schema_stmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_schema_stmt + + return p +} + +func (s *Schema_stmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *Schema_stmtContext) Createstmt() ICreatestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatestmtContext) +} + +func (s *Schema_stmtContext) Indexstmt() IIndexstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndexstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndexstmtContext) +} + +func (s *Schema_stmtContext) Createseqstmt() ICreateseqstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateseqstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateseqstmtContext) +} + +func (s *Schema_stmtContext) Createtrigstmt() ICreatetrigstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatetrigstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatetrigstmtContext) +} + +func (s *Schema_stmtContext) Grantstmt() IGrantstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrantstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrantstmtContext) +} + +func (s *Schema_stmtContext) Viewstmt() IViewstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IViewstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IViewstmtContext) +} + +func (s *Schema_stmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Schema_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Schema_stmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSchema_stmt(s) + } +} + +func (s *Schema_stmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSchema_stmt(s) + } +} + +func (s *Schema_stmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSchema_stmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Schema_stmt() (localctx ISchema_stmtContext) { + localctx = NewSchema_stmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 48, PostgreSQLParserRULE_schema_stmt) + p.SetState(1927) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 20, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1921) + p.Createstmt() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(1922) + p.Indexstmt() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(1923) + p.Createseqstmt() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(1924) + p.Createtrigstmt() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(1925) + p.Grantstmt() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(1926) + p.Viewstmt() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVariablesetstmtContext is an interface to support dynamic dispatch. +type IVariablesetstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SET() antlr.TerminalNode + Set_rest() ISet_restContext + LOCAL() antlr.TerminalNode + SESSION() antlr.TerminalNode + + // IsVariablesetstmtContext differentiates from other interfaces. + IsVariablesetstmtContext() +} + +type VariablesetstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVariablesetstmtContext() *VariablesetstmtContext { + var p = new(VariablesetstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_variablesetstmt + return p +} + +func InitEmptyVariablesetstmtContext(p *VariablesetstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_variablesetstmt +} + +func (*VariablesetstmtContext) IsVariablesetstmtContext() {} + +func NewVariablesetstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *VariablesetstmtContext { + var p = new(VariablesetstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_variablesetstmt + + return p +} + +func (s *VariablesetstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *VariablesetstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *VariablesetstmtContext) Set_rest() ISet_restContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_restContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_restContext) +} + +func (s *VariablesetstmtContext) LOCAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCAL, 0) +} + +func (s *VariablesetstmtContext) SESSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION, 0) +} + +func (s *VariablesetstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *VariablesetstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *VariablesetstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVariablesetstmt(s) + } +} + +func (s *VariablesetstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVariablesetstmt(s) + } +} + +func (s *VariablesetstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVariablesetstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Variablesetstmt() (localctx IVariablesetstmtContext) { + localctx = NewVariablesetstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 50, PostgreSQLParserRULE_variablesetstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1929) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(1931) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 21, p.GetParserRuleContext()) == 1 { + { + p.SetState(1930) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserLOCAL || _la == PostgreSQLParserSESSION) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(1933) + p.Set_rest() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISet_restContext is an interface to support dynamic dispatch. +type ISet_restContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TRANSACTION() antlr.TerminalNode + Transaction_mode_list() ITransaction_mode_listContext + SESSION() antlr.TerminalNode + CHARACTERISTICS() antlr.TerminalNode + AS() antlr.TerminalNode + Set_rest_more() ISet_rest_moreContext + + // IsSet_restContext differentiates from other interfaces. + IsSet_restContext() +} + +type Set_restContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySet_restContext() *Set_restContext { + var p = new(Set_restContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_rest + return p +} + +func InitEmptySet_restContext(p *Set_restContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_rest +} + +func (*Set_restContext) IsSet_restContext() {} + +func NewSet_restContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Set_restContext { + var p = new(Set_restContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_set_rest + + return p +} + +func (s *Set_restContext) GetParser() antlr.Parser { return s.parser } + +func (s *Set_restContext) TRANSACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSACTION, 0) +} + +func (s *Set_restContext) Transaction_mode_list() ITransaction_mode_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransaction_mode_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransaction_mode_listContext) +} + +func (s *Set_restContext) SESSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION, 0) +} + +func (s *Set_restContext) CHARACTERISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHARACTERISTICS, 0) +} + +func (s *Set_restContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Set_restContext) Set_rest_more() ISet_rest_moreContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_rest_moreContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_rest_moreContext) +} + +func (s *Set_restContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Set_restContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Set_restContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSet_rest(s) + } +} + +func (s *Set_restContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSet_rest(s) + } +} + +func (s *Set_restContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSet_rest(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Set_rest() (localctx ISet_restContext) { + localctx = NewSet_restContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 52, PostgreSQLParserRULE_set_rest) + p.SetState(1943) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 22, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1935) + p.Match(PostgreSQLParserTRANSACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1936) + p.Transaction_mode_list() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(1937) + p.Match(PostgreSQLParserSESSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1938) + p.Match(PostgreSQLParserCHARACTERISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1939) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1940) + p.Match(PostgreSQLParserTRANSACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1941) + p.Transaction_mode_list() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(1942) + p.Set_rest_more() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGeneric_setContext is an interface to support dynamic dispatch. +type IGeneric_setContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Var_name() IVar_nameContext + Var_list() IVar_listContext + TO() antlr.TerminalNode + EQUAL() antlr.TerminalNode + + // IsGeneric_setContext differentiates from other interfaces. + IsGeneric_setContext() +} + +type Generic_setContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGeneric_setContext() *Generic_setContext { + var p = new(Generic_setContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_set + return p +} + +func InitEmptyGeneric_setContext(p *Generic_setContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_set +} + +func (*Generic_setContext) IsGeneric_setContext() {} + +func NewGeneric_setContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Generic_setContext { + var p = new(Generic_setContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_generic_set + + return p +} + +func (s *Generic_setContext) GetParser() antlr.Parser { return s.parser } + +func (s *Generic_setContext) Var_name() IVar_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVar_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVar_nameContext) +} + +func (s *Generic_setContext) Var_list() IVar_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVar_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVar_listContext) +} + +func (s *Generic_setContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Generic_setContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Generic_setContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Generic_setContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Generic_setContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGeneric_set(s) + } +} + +func (s *Generic_setContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGeneric_set(s) + } +} + +func (s *Generic_setContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGeneric_set(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Generic_set() (localctx IGeneric_setContext) { + localctx = NewGeneric_setContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 54, PostgreSQLParserRULE_generic_set) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1945) + p.Var_name() + } + { + p.SetState(1946) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserEQUAL || _la == PostgreSQLParserTO) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(1947) + p.Var_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISet_rest_moreContext is an interface to support dynamic dispatch. +type ISet_rest_moreContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Generic_set() IGeneric_setContext + Var_name() IVar_nameContext + FROM() antlr.TerminalNode + CURRENT_P() antlr.TerminalNode + TIME() antlr.TerminalNode + ZONE() antlr.TerminalNode + Zone_value() IZone_valueContext + CATALOG() antlr.TerminalNode + Sconst() ISconstContext + SCHEMA() antlr.TerminalNode + NAMES() antlr.TerminalNode + Opt_encoding() IOpt_encodingContext + ROLE() antlr.TerminalNode + Nonreservedword_or_sconst() INonreservedword_or_sconstContext + SESSION() antlr.TerminalNode + AUTHORIZATION() antlr.TerminalNode + XML_P() antlr.TerminalNode + OPTION() antlr.TerminalNode + Document_or_content() IDocument_or_contentContext + TRANSACTION() antlr.TerminalNode + SNAPSHOT() antlr.TerminalNode + + // IsSet_rest_moreContext differentiates from other interfaces. + IsSet_rest_moreContext() +} + +type Set_rest_moreContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySet_rest_moreContext() *Set_rest_moreContext { + var p = new(Set_rest_moreContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_rest_more + return p +} + +func InitEmptySet_rest_moreContext(p *Set_rest_moreContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_rest_more +} + +func (*Set_rest_moreContext) IsSet_rest_moreContext() {} + +func NewSet_rest_moreContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Set_rest_moreContext { + var p = new(Set_rest_moreContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_set_rest_more + + return p +} + +func (s *Set_rest_moreContext) GetParser() antlr.Parser { return s.parser } + +func (s *Set_rest_moreContext) Generic_set() IGeneric_setContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_setContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_setContext) +} + +func (s *Set_rest_moreContext) Var_name() IVar_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVar_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVar_nameContext) +} + +func (s *Set_rest_moreContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Set_rest_moreContext) CURRENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_P, 0) +} + +func (s *Set_rest_moreContext) TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIME, 0) +} + +func (s *Set_rest_moreContext) ZONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserZONE, 0) +} + +func (s *Set_rest_moreContext) Zone_value() IZone_valueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IZone_valueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IZone_valueContext) +} + +func (s *Set_rest_moreContext) CATALOG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCATALOG, 0) +} + +func (s *Set_rest_moreContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Set_rest_moreContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Set_rest_moreContext) NAMES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNAMES, 0) +} + +func (s *Set_rest_moreContext) Opt_encoding() IOpt_encodingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_encodingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_encodingContext) +} + +func (s *Set_rest_moreContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *Set_rest_moreContext) Nonreservedword_or_sconst() INonreservedword_or_sconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedword_or_sconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedword_or_sconstContext) +} + +func (s *Set_rest_moreContext) SESSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION, 0) +} + +func (s *Set_rest_moreContext) AUTHORIZATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAUTHORIZATION, 0) +} + +func (s *Set_rest_moreContext) XML_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXML_P, 0) +} + +func (s *Set_rest_moreContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *Set_rest_moreContext) Document_or_content() IDocument_or_contentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDocument_or_contentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDocument_or_contentContext) +} + +func (s *Set_rest_moreContext) TRANSACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSACTION, 0) +} + +func (s *Set_rest_moreContext) SNAPSHOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSNAPSHOT, 0) +} + +func (s *Set_rest_moreContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Set_rest_moreContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Set_rest_moreContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSet_rest_more(s) + } +} + +func (s *Set_rest_moreContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSet_rest_more(s) + } +} + +func (s *Set_rest_moreContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSet_rest_more(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Set_rest_more() (localctx ISet_rest_moreContext) { + localctx = NewSet_rest_moreContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 56, PostgreSQLParserRULE_set_rest_more) + var _la int + + p.SetState(1976) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 24, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1949) + p.Generic_set() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(1950) + p.Var_name() + } + { + p.SetState(1951) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1952) + p.Match(PostgreSQLParserCURRENT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(1954) + p.Match(PostgreSQLParserTIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1955) + p.Match(PostgreSQLParserZONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1956) + p.Zone_value() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(1957) + p.Match(PostgreSQLParserCATALOG) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1958) + p.Sconst() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(1959) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1960) + p.Sconst() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(1961) + p.Match(PostgreSQLParserNAMES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(1963) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDEFAULT || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67108885) != 0) { + { + p.SetState(1962) + p.Opt_encoding() + } + + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(1965) + p.Match(PostgreSQLParserROLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1966) + p.Nonreservedword_or_sconst() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(1967) + p.Match(PostgreSQLParserSESSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1968) + p.Match(PostgreSQLParserAUTHORIZATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1969) + p.Nonreservedword_or_sconst() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(1970) + p.Match(PostgreSQLParserXML_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1971) + p.Match(PostgreSQLParserOPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1972) + p.Document_or_content() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(1973) + p.Match(PostgreSQLParserTRANSACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1974) + p.Match(PostgreSQLParserSNAPSHOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1975) + p.Sconst() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVar_nameContext is an interface to support dynamic dispatch. +type IVar_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllColid() []IColidContext + Colid(i int) IColidContext + AllDOT() []antlr.TerminalNode + DOT(i int) antlr.TerminalNode + + // IsVar_nameContext differentiates from other interfaces. + IsVar_nameContext() +} + +type Var_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVar_nameContext() *Var_nameContext { + var p = new(Var_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_var_name + return p +} + +func InitEmptyVar_nameContext(p *Var_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_var_name +} + +func (*Var_nameContext) IsVar_nameContext() {} + +func NewVar_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Var_nameContext { + var p = new(Var_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_var_name + + return p +} + +func (s *Var_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Var_nameContext) AllColid() []IColidContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IColidContext); ok { + len++ + } + } + + tst := make([]IColidContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IColidContext); ok { + tst[i] = t.(IColidContext) + i++ + } + } + + return tst +} + +func (s *Var_nameContext) Colid(i int) IColidContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Var_nameContext) AllDOT() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserDOT) +} + +func (s *Var_nameContext) DOT(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOT, i) +} + +func (s *Var_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Var_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Var_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVar_name(s) + } +} + +func (s *Var_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVar_name(s) + } +} + +func (s *Var_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVar_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Var_name() (localctx IVar_nameContext) { + localctx = NewVar_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 58, PostgreSQLParserRULE_var_name) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1978) + p.Colid() + } + p.SetState(1983) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserDOT { + { + p.SetState(1979) + p.Match(PostgreSQLParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1980) + p.Colid() + } + + p.SetState(1985) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVar_listContext is an interface to support dynamic dispatch. +type IVar_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllVar_value() []IVar_valueContext + Var_value(i int) IVar_valueContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsVar_listContext differentiates from other interfaces. + IsVar_listContext() +} + +type Var_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVar_listContext() *Var_listContext { + var p = new(Var_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_var_list + return p +} + +func InitEmptyVar_listContext(p *Var_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_var_list +} + +func (*Var_listContext) IsVar_listContext() {} + +func NewVar_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Var_listContext { + var p = new(Var_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_var_list + + return p +} + +func (s *Var_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Var_listContext) AllVar_value() []IVar_valueContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IVar_valueContext); ok { + len++ + } + } + + tst := make([]IVar_valueContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IVar_valueContext); ok { + tst[i] = t.(IVar_valueContext) + i++ + } + } + + return tst +} + +func (s *Var_listContext) Var_value(i int) IVar_valueContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVar_valueContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IVar_valueContext) +} + +func (s *Var_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Var_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Var_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Var_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Var_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVar_list(s) + } +} + +func (s *Var_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVar_list(s) + } +} + +func (s *Var_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVar_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Var_list() (localctx IVar_listContext) { + localctx = NewVar_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 60, PostgreSQLParserRULE_var_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1986) + p.Var_value() + } + p.SetState(1991) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(1987) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1988) + p.Var_value() + } + + p.SetState(1993) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVar_valueContext is an interface to support dynamic dispatch. +type IVar_valueContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Opt_boolean_or_string() IOpt_boolean_or_stringContext + Numericonly() INumericonlyContext + + // IsVar_valueContext differentiates from other interfaces. + IsVar_valueContext() +} + +type Var_valueContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVar_valueContext() *Var_valueContext { + var p = new(Var_valueContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_var_value + return p +} + +func InitEmptyVar_valueContext(p *Var_valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_var_value +} + +func (*Var_valueContext) IsVar_valueContext() {} + +func NewVar_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Var_valueContext { + var p = new(Var_valueContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_var_value + + return p +} + +func (s *Var_valueContext) GetParser() antlr.Parser { return s.parser } + +func (s *Var_valueContext) Opt_boolean_or_string() IOpt_boolean_or_stringContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_boolean_or_stringContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_boolean_or_stringContext) +} + +func (s *Var_valueContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Var_valueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Var_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Var_valueContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVar_value(s) + } +} + +func (s *Var_valueContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVar_value(s) + } +} + +func (s *Var_valueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVar_value(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Var_value() (localctx IVar_valueContext) { + localctx = NewVar_valueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 62, PostgreSQLParserRULE_var_value) + p.SetState(1996) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserON, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1994) + p.Opt_boolean_or_string() + } + + case PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserIntegral, PostgreSQLParserNumeric: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(1995) + p.Numericonly() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIso_levelContext is an interface to support dynamic dispatch. +type IIso_levelContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + READ() antlr.TerminalNode + UNCOMMITTED() antlr.TerminalNode + COMMITTED() antlr.TerminalNode + REPEATABLE() antlr.TerminalNode + SERIALIZABLE() antlr.TerminalNode + + // IsIso_levelContext differentiates from other interfaces. + IsIso_levelContext() +} + +type Iso_levelContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIso_levelContext() *Iso_levelContext { + var p = new(Iso_levelContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_iso_level + return p +} + +func InitEmptyIso_levelContext(p *Iso_levelContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_iso_level +} + +func (*Iso_levelContext) IsIso_levelContext() {} + +func NewIso_levelContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Iso_levelContext { + var p = new(Iso_levelContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_iso_level + + return p +} + +func (s *Iso_levelContext) GetParser() antlr.Parser { return s.parser } + +func (s *Iso_levelContext) READ() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREAD, 0) +} + +func (s *Iso_levelContext) UNCOMMITTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNCOMMITTED, 0) +} + +func (s *Iso_levelContext) COMMITTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMITTED, 0) +} + +func (s *Iso_levelContext) REPEATABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPEATABLE, 0) +} + +func (s *Iso_levelContext) SERIALIZABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERIALIZABLE, 0) +} + +func (s *Iso_levelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Iso_levelContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Iso_levelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIso_level(s) + } +} + +func (s *Iso_levelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIso_level(s) + } +} + +func (s *Iso_levelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIso_level(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Iso_level() (localctx IIso_levelContext) { + localctx = NewIso_levelContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 64, PostgreSQLParserRULE_iso_level) + var _la int + + p.SetState(2003) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserREAD: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(1998) + p.Match(PostgreSQLParserREAD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(1999) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCOMMITTED || _la == PostgreSQLParserUNCOMMITTED) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case PostgreSQLParserREPEATABLE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2000) + p.Match(PostgreSQLParserREPEATABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2001) + p.Match(PostgreSQLParserREAD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSERIALIZABLE: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2002) + p.Match(PostgreSQLParserSERIALIZABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_boolean_or_stringContext is an interface to support dynamic dispatch. +type IOpt_boolean_or_stringContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TRUE_P() antlr.TerminalNode + FALSE_P() antlr.TerminalNode + ON() antlr.TerminalNode + Nonreservedword_or_sconst() INonreservedword_or_sconstContext + + // IsOpt_boolean_or_stringContext differentiates from other interfaces. + IsOpt_boolean_or_stringContext() +} + +type Opt_boolean_or_stringContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_boolean_or_stringContext() *Opt_boolean_or_stringContext { + var p = new(Opt_boolean_or_stringContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_boolean_or_string + return p +} + +func InitEmptyOpt_boolean_or_stringContext(p *Opt_boolean_or_stringContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_boolean_or_string +} + +func (*Opt_boolean_or_stringContext) IsOpt_boolean_or_stringContext() {} + +func NewOpt_boolean_or_stringContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_boolean_or_stringContext { + var p = new(Opt_boolean_or_stringContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_boolean_or_string + + return p +} + +func (s *Opt_boolean_or_stringContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_boolean_or_stringContext) TRUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUE_P, 0) +} + +func (s *Opt_boolean_or_stringContext) FALSE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFALSE_P, 0) +} + +func (s *Opt_boolean_or_stringContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Opt_boolean_or_stringContext) Nonreservedword_or_sconst() INonreservedword_or_sconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedword_or_sconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedword_or_sconstContext) +} + +func (s *Opt_boolean_or_stringContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_boolean_or_stringContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_boolean_or_stringContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_boolean_or_string(s) + } +} + +func (s *Opt_boolean_or_stringContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_boolean_or_string(s) + } +} + +func (s *Opt_boolean_or_stringContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_boolean_or_string(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_boolean_or_string() (localctx IOpt_boolean_or_stringContext) { + localctx = NewOpt_boolean_or_stringContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 66, PostgreSQLParserRULE_opt_boolean_or_string) + p.SetState(2009) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserTRUE_P: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2005) + p.Match(PostgreSQLParserTRUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserFALSE_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2006) + p.Match(PostgreSQLParserFALSE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserON: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2007) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2008) + p.Nonreservedword_or_sconst() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IZone_valueContext is an interface to support dynamic dispatch. +type IZone_valueContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + Identifier() IIdentifierContext + Constinterval() IConstintervalContext + Opt_interval() IOpt_intervalContext + OPEN_PAREN() antlr.TerminalNode + Iconst() IIconstContext + CLOSE_PAREN() antlr.TerminalNode + Numericonly() INumericonlyContext + DEFAULT() antlr.TerminalNode + LOCAL() antlr.TerminalNode + + // IsZone_valueContext differentiates from other interfaces. + IsZone_valueContext() +} + +type Zone_valueContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyZone_valueContext() *Zone_valueContext { + var p = new(Zone_valueContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_zone_value + return p +} + +func InitEmptyZone_valueContext(p *Zone_valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_zone_value +} + +func (*Zone_valueContext) IsZone_valueContext() {} + +func NewZone_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Zone_valueContext { + var p = new(Zone_valueContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_zone_value + + return p +} + +func (s *Zone_valueContext) GetParser() antlr.Parser { return s.parser } + +func (s *Zone_valueContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Zone_valueContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Zone_valueContext) Constinterval() IConstintervalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstintervalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstintervalContext) +} + +func (s *Zone_valueContext) Opt_interval() IOpt_intervalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_intervalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_intervalContext) +} + +func (s *Zone_valueContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Zone_valueContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Zone_valueContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Zone_valueContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Zone_valueContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Zone_valueContext) LOCAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCAL, 0) +} + +func (s *Zone_valueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Zone_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Zone_valueContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterZone_value(s) + } +} + +func (s *Zone_valueContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitZone_value(s) + } +} + +func (s *Zone_valueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitZone_value(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Zone_value() (localctx IZone_valueContext) { + localctx = NewZone_valueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 68, PostgreSQLParserRULE_zone_value) + var _la int + + p.SetState(2027) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 31, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2011) + p.Sconst() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2012) + p.Identifier() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2013) + p.Constinterval() + } + { + p.SetState(2014) + p.Sconst() + } + p.SetState(2016) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDAY_P || _la == PostgreSQLParserHOUR_P || _la == PostgreSQLParserMINUTE_P || _la == PostgreSQLParserMONTH_P || _la == PostgreSQLParserSECOND_P || _la == PostgreSQLParserYEAR_P { + { + p.SetState(2015) + p.Opt_interval() + } + + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2018) + p.Constinterval() + } + { + p.SetState(2019) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2020) + p.Iconst() + } + { + p.SetState(2021) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2022) + p.Sconst() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(2024) + p.Numericonly() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(2025) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(2026) + p.Match(PostgreSQLParserLOCAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_encodingContext is an interface to support dynamic dispatch. +type IOpt_encodingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + DEFAULT() antlr.TerminalNode + + // IsOpt_encodingContext differentiates from other interfaces. + IsOpt_encodingContext() +} + +type Opt_encodingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_encodingContext() *Opt_encodingContext { + var p = new(Opt_encodingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_encoding + return p +} + +func InitEmptyOpt_encodingContext(p *Opt_encodingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_encoding +} + +func (*Opt_encodingContext) IsOpt_encodingContext() {} + +func NewOpt_encodingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_encodingContext { + var p = new(Opt_encodingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_encoding + + return p +} + +func (s *Opt_encodingContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_encodingContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Opt_encodingContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Opt_encodingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_encodingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_encodingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_encoding(s) + } +} + +func (s *Opt_encodingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_encoding(s) + } +} + +func (s *Opt_encodingContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_encoding(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_encoding() (localctx IOpt_encodingContext) { + localctx = NewOpt_encodingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 70, PostgreSQLParserRULE_opt_encoding) + p.SetState(2031) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2029) + p.Sconst() + } + + case PostgreSQLParserDEFAULT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2030) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INonreservedword_or_sconstContext is an interface to support dynamic dispatch. +type INonreservedword_or_sconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Nonreservedword() INonreservedwordContext + Sconst() ISconstContext + + // IsNonreservedword_or_sconstContext differentiates from other interfaces. + IsNonreservedword_or_sconstContext() +} + +type Nonreservedword_or_sconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNonreservedword_or_sconstContext() *Nonreservedword_or_sconstContext { + var p = new(Nonreservedword_or_sconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_nonreservedword_or_sconst + return p +} + +func InitEmptyNonreservedword_or_sconstContext(p *Nonreservedword_or_sconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_nonreservedword_or_sconst +} + +func (*Nonreservedword_or_sconstContext) IsNonreservedword_or_sconstContext() {} + +func NewNonreservedword_or_sconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Nonreservedword_or_sconstContext { + var p = new(Nonreservedword_or_sconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_nonreservedword_or_sconst + + return p +} + +func (s *Nonreservedword_or_sconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *Nonreservedword_or_sconstContext) Nonreservedword() INonreservedwordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedwordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedwordContext) +} + +func (s *Nonreservedword_or_sconstContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Nonreservedword_or_sconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Nonreservedword_or_sconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Nonreservedword_or_sconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterNonreservedword_or_sconst(s) + } +} + +func (s *Nonreservedword_or_sconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitNonreservedword_or_sconst(s) + } +} + +func (s *Nonreservedword_or_sconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitNonreservedword_or_sconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Nonreservedword_or_sconst() (localctx INonreservedword_or_sconstContext) { + localctx = NewNonreservedword_or_sconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 72, PostgreSQLParserRULE_nonreservedword_or_sconst) + p.SetState(2035) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2033) + p.Nonreservedword() + } + + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2034) + p.Sconst() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVariableresetstmtContext is an interface to support dynamic dispatch. +type IVariableresetstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RESET() antlr.TerminalNode + Reset_rest() IReset_restContext + + // IsVariableresetstmtContext differentiates from other interfaces. + IsVariableresetstmtContext() +} + +type VariableresetstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVariableresetstmtContext() *VariableresetstmtContext { + var p = new(VariableresetstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_variableresetstmt + return p +} + +func InitEmptyVariableresetstmtContext(p *VariableresetstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_variableresetstmt +} + +func (*VariableresetstmtContext) IsVariableresetstmtContext() {} + +func NewVariableresetstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *VariableresetstmtContext { + var p = new(VariableresetstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_variableresetstmt + + return p +} + +func (s *VariableresetstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *VariableresetstmtContext) RESET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESET, 0) +} + +func (s *VariableresetstmtContext) Reset_rest() IReset_restContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReset_restContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReset_restContext) +} + +func (s *VariableresetstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *VariableresetstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *VariableresetstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVariableresetstmt(s) + } +} + +func (s *VariableresetstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVariableresetstmt(s) + } +} + +func (s *VariableresetstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVariableresetstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Variableresetstmt() (localctx IVariableresetstmtContext) { + localctx = NewVariableresetstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 74, PostgreSQLParserRULE_variableresetstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2037) + p.Match(PostgreSQLParserRESET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2038) + p.Reset_rest() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReset_restContext is an interface to support dynamic dispatch. +type IReset_restContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Generic_reset() IGeneric_resetContext + TIME() antlr.TerminalNode + ZONE() antlr.TerminalNode + TRANSACTION() antlr.TerminalNode + ISOLATION() antlr.TerminalNode + LEVEL() antlr.TerminalNode + SESSION() antlr.TerminalNode + AUTHORIZATION() antlr.TerminalNode + + // IsReset_restContext differentiates from other interfaces. + IsReset_restContext() +} + +type Reset_restContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReset_restContext() *Reset_restContext { + var p = new(Reset_restContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reset_rest + return p +} + +func InitEmptyReset_restContext(p *Reset_restContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reset_rest +} + +func (*Reset_restContext) IsReset_restContext() {} + +func NewReset_restContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reset_restContext { + var p = new(Reset_restContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reset_rest + + return p +} + +func (s *Reset_restContext) GetParser() antlr.Parser { return s.parser } + +func (s *Reset_restContext) Generic_reset() IGeneric_resetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_resetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_resetContext) +} + +func (s *Reset_restContext) TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIME, 0) +} + +func (s *Reset_restContext) ZONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserZONE, 0) +} + +func (s *Reset_restContext) TRANSACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSACTION, 0) +} + +func (s *Reset_restContext) ISOLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserISOLATION, 0) +} + +func (s *Reset_restContext) LEVEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEVEL, 0) +} + +func (s *Reset_restContext) SESSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION, 0) +} + +func (s *Reset_restContext) AUTHORIZATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAUTHORIZATION, 0) +} + +func (s *Reset_restContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Reset_restContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Reset_restContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReset_rest(s) + } +} + +func (s *Reset_restContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReset_rest(s) + } +} + +func (s *Reset_restContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReset_rest(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reset_rest() (localctx IReset_restContext) { + localctx = NewReset_restContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 76, PostgreSQLParserRULE_reset_rest) + p.SetState(2048) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 34, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2040) + p.Generic_reset() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2041) + p.Match(PostgreSQLParserTIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2042) + p.Match(PostgreSQLParserZONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2043) + p.Match(PostgreSQLParserTRANSACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2044) + p.Match(PostgreSQLParserISOLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2045) + p.Match(PostgreSQLParserLEVEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2046) + p.Match(PostgreSQLParserSESSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2047) + p.Match(PostgreSQLParserAUTHORIZATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGeneric_resetContext is an interface to support dynamic dispatch. +type IGeneric_resetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Var_name() IVar_nameContext + ALL() antlr.TerminalNode + + // IsGeneric_resetContext differentiates from other interfaces. + IsGeneric_resetContext() +} + +type Generic_resetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGeneric_resetContext() *Generic_resetContext { + var p = new(Generic_resetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_reset + return p +} + +func InitEmptyGeneric_resetContext(p *Generic_resetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_reset +} + +func (*Generic_resetContext) IsGeneric_resetContext() {} + +func NewGeneric_resetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Generic_resetContext { + var p = new(Generic_resetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_generic_reset + + return p +} + +func (s *Generic_resetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Generic_resetContext) Var_name() IVar_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVar_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVar_nameContext) +} + +func (s *Generic_resetContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Generic_resetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Generic_resetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Generic_resetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGeneric_reset(s) + } +} + +func (s *Generic_resetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGeneric_reset(s) + } +} + +func (s *Generic_resetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGeneric_reset(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Generic_reset() (localctx IGeneric_resetContext) { + localctx = NewGeneric_resetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 78, PostgreSQLParserRULE_generic_reset) + p.SetState(2052) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2050) + p.Var_name() + } + + case PostgreSQLParserALL: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2051) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISetresetclauseContext is an interface to support dynamic dispatch. +type ISetresetclauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SET() antlr.TerminalNode + Set_rest() ISet_restContext + Variableresetstmt() IVariableresetstmtContext + + // IsSetresetclauseContext differentiates from other interfaces. + IsSetresetclauseContext() +} + +type SetresetclauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySetresetclauseContext() *SetresetclauseContext { + var p = new(SetresetclauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_setresetclause + return p +} + +func InitEmptySetresetclauseContext(p *SetresetclauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_setresetclause +} + +func (*SetresetclauseContext) IsSetresetclauseContext() {} + +func NewSetresetclauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SetresetclauseContext { + var p = new(SetresetclauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_setresetclause + + return p +} + +func (s *SetresetclauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *SetresetclauseContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *SetresetclauseContext) Set_rest() ISet_restContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_restContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_restContext) +} + +func (s *SetresetclauseContext) Variableresetstmt() IVariableresetstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVariableresetstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVariableresetstmtContext) +} + +func (s *SetresetclauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SetresetclauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SetresetclauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSetresetclause(s) + } +} + +func (s *SetresetclauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSetresetclause(s) + } +} + +func (s *SetresetclauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSetresetclause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Setresetclause() (localctx ISetresetclauseContext) { + localctx = NewSetresetclauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 80, PostgreSQLParserRULE_setresetclause) + p.SetState(2057) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserSET: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2054) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2055) + p.Set_rest() + } + + case PostgreSQLParserRESET: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2056) + p.Variableresetstmt() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunctionsetresetclauseContext is an interface to support dynamic dispatch. +type IFunctionsetresetclauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SET() antlr.TerminalNode + Set_rest_more() ISet_rest_moreContext + Variableresetstmt() IVariableresetstmtContext + + // IsFunctionsetresetclauseContext differentiates from other interfaces. + IsFunctionsetresetclauseContext() +} + +type FunctionsetresetclauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunctionsetresetclauseContext() *FunctionsetresetclauseContext { + var p = new(FunctionsetresetclauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_functionsetresetclause + return p +} + +func InitEmptyFunctionsetresetclauseContext(p *FunctionsetresetclauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_functionsetresetclause +} + +func (*FunctionsetresetclauseContext) IsFunctionsetresetclauseContext() {} + +func NewFunctionsetresetclauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FunctionsetresetclauseContext { + var p = new(FunctionsetresetclauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_functionsetresetclause + + return p +} + +func (s *FunctionsetresetclauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *FunctionsetresetclauseContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *FunctionsetresetclauseContext) Set_rest_more() ISet_rest_moreContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_rest_moreContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_rest_moreContext) +} + +func (s *FunctionsetresetclauseContext) Variableresetstmt() IVariableresetstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVariableresetstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVariableresetstmtContext) +} + +func (s *FunctionsetresetclauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *FunctionsetresetclauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *FunctionsetresetclauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunctionsetresetclause(s) + } +} + +func (s *FunctionsetresetclauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunctionsetresetclause(s) + } +} + +func (s *FunctionsetresetclauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunctionsetresetclause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Functionsetresetclause() (localctx IFunctionsetresetclauseContext) { + localctx = NewFunctionsetresetclauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 82, PostgreSQLParserRULE_functionsetresetclause) + p.SetState(2062) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserSET: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2059) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2060) + p.Set_rest_more() + } + + case PostgreSQLParserRESET: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2061) + p.Variableresetstmt() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVariableshowstmtContext is an interface to support dynamic dispatch. +type IVariableshowstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SHOW() antlr.TerminalNode + Var_name() IVar_nameContext + TIME() antlr.TerminalNode + ZONE() antlr.TerminalNode + TRANSACTION() antlr.TerminalNode + ISOLATION() antlr.TerminalNode + LEVEL() antlr.TerminalNode + SESSION() antlr.TerminalNode + AUTHORIZATION() antlr.TerminalNode + ALL() antlr.TerminalNode + + // IsVariableshowstmtContext differentiates from other interfaces. + IsVariableshowstmtContext() +} + +type VariableshowstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVariableshowstmtContext() *VariableshowstmtContext { + var p = new(VariableshowstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_variableshowstmt + return p +} + +func InitEmptyVariableshowstmtContext(p *VariableshowstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_variableshowstmt +} + +func (*VariableshowstmtContext) IsVariableshowstmtContext() {} + +func NewVariableshowstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *VariableshowstmtContext { + var p = new(VariableshowstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_variableshowstmt + + return p +} + +func (s *VariableshowstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *VariableshowstmtContext) SHOW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSHOW, 0) +} + +func (s *VariableshowstmtContext) Var_name() IVar_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVar_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVar_nameContext) +} + +func (s *VariableshowstmtContext) TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIME, 0) +} + +func (s *VariableshowstmtContext) ZONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserZONE, 0) +} + +func (s *VariableshowstmtContext) TRANSACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSACTION, 0) +} + +func (s *VariableshowstmtContext) ISOLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserISOLATION, 0) +} + +func (s *VariableshowstmtContext) LEVEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEVEL, 0) +} + +func (s *VariableshowstmtContext) SESSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION, 0) +} + +func (s *VariableshowstmtContext) AUTHORIZATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAUTHORIZATION, 0) +} + +func (s *VariableshowstmtContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *VariableshowstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *VariableshowstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *VariableshowstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVariableshowstmt(s) + } +} + +func (s *VariableshowstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVariableshowstmt(s) + } +} + +func (s *VariableshowstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVariableshowstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Variableshowstmt() (localctx IVariableshowstmtContext) { + localctx = NewVariableshowstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 84, PostgreSQLParserRULE_variableshowstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2064) + p.Match(PostgreSQLParserSHOW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2074) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 38, p.GetParserRuleContext()) { + case 1: + { + p.SetState(2065) + p.Var_name() + } + + case 2: + { + p.SetState(2066) + p.Match(PostgreSQLParserTIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2067) + p.Match(PostgreSQLParserZONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + { + p.SetState(2068) + p.Match(PostgreSQLParserTRANSACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2069) + p.Match(PostgreSQLParserISOLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2070) + p.Match(PostgreSQLParserLEVEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + { + p.SetState(2071) + p.Match(PostgreSQLParserSESSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2072) + p.Match(PostgreSQLParserAUTHORIZATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + { + p.SetState(2073) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstraintssetstmtContext is an interface to support dynamic dispatch. +type IConstraintssetstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SET() antlr.TerminalNode + CONSTRAINTS() antlr.TerminalNode + Constraints_set_list() IConstraints_set_listContext + Constraints_set_mode() IConstraints_set_modeContext + + // IsConstraintssetstmtContext differentiates from other interfaces. + IsConstraintssetstmtContext() +} + +type ConstraintssetstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstraintssetstmtContext() *ConstraintssetstmtContext { + var p = new(ConstraintssetstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintssetstmt + return p +} + +func InitEmptyConstraintssetstmtContext(p *ConstraintssetstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintssetstmt +} + +func (*ConstraintssetstmtContext) IsConstraintssetstmtContext() {} + +func NewConstraintssetstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstraintssetstmtContext { + var p = new(ConstraintssetstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constraintssetstmt + + return p +} + +func (s *ConstraintssetstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstraintssetstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *ConstraintssetstmtContext) CONSTRAINTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINTS, 0) +} + +func (s *ConstraintssetstmtContext) Constraints_set_list() IConstraints_set_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraints_set_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraints_set_listContext) +} + +func (s *ConstraintssetstmtContext) Constraints_set_mode() IConstraints_set_modeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraints_set_modeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraints_set_modeContext) +} + +func (s *ConstraintssetstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstraintssetstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstraintssetstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstraintssetstmt(s) + } +} + +func (s *ConstraintssetstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstraintssetstmt(s) + } +} + +func (s *ConstraintssetstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstraintssetstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constraintssetstmt() (localctx IConstraintssetstmtContext) { + localctx = NewConstraintssetstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 86, PostgreSQLParserRULE_constraintssetstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2076) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2077) + p.Match(PostgreSQLParserCONSTRAINTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2078) + p.Constraints_set_list() + } + { + p.SetState(2079) + p.Constraints_set_mode() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstraints_set_listContext is an interface to support dynamic dispatch. +type IConstraints_set_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALL() antlr.TerminalNode + Qualified_name_list() IQualified_name_listContext + + // IsConstraints_set_listContext differentiates from other interfaces. + IsConstraints_set_listContext() +} + +type Constraints_set_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstraints_set_listContext() *Constraints_set_listContext { + var p = new(Constraints_set_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraints_set_list + return p +} + +func InitEmptyConstraints_set_listContext(p *Constraints_set_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraints_set_list +} + +func (*Constraints_set_listContext) IsConstraints_set_listContext() {} + +func NewConstraints_set_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Constraints_set_listContext { + var p = new(Constraints_set_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constraints_set_list + + return p +} + +func (s *Constraints_set_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Constraints_set_listContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Constraints_set_listContext) Qualified_name_list() IQualified_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_name_listContext) +} + +func (s *Constraints_set_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Constraints_set_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Constraints_set_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstraints_set_list(s) + } +} + +func (s *Constraints_set_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstraints_set_list(s) + } +} + +func (s *Constraints_set_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstraints_set_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constraints_set_list() (localctx IConstraints_set_listContext) { + localctx = NewConstraints_set_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 88, PostgreSQLParserRULE_constraints_set_list) + p.SetState(2083) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserALL: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2081) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2082) + p.Qualified_name_list() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstraints_set_modeContext is an interface to support dynamic dispatch. +type IConstraints_set_modeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DEFERRED() antlr.TerminalNode + IMMEDIATE() antlr.TerminalNode + + // IsConstraints_set_modeContext differentiates from other interfaces. + IsConstraints_set_modeContext() +} + +type Constraints_set_modeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstraints_set_modeContext() *Constraints_set_modeContext { + var p = new(Constraints_set_modeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraints_set_mode + return p +} + +func InitEmptyConstraints_set_modeContext(p *Constraints_set_modeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraints_set_mode +} + +func (*Constraints_set_modeContext) IsConstraints_set_modeContext() {} + +func NewConstraints_set_modeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Constraints_set_modeContext { + var p = new(Constraints_set_modeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constraints_set_mode + + return p +} + +func (s *Constraints_set_modeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Constraints_set_modeContext) DEFERRED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFERRED, 0) +} + +func (s *Constraints_set_modeContext) IMMEDIATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMMEDIATE, 0) +} + +func (s *Constraints_set_modeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Constraints_set_modeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Constraints_set_modeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstraints_set_mode(s) + } +} + +func (s *Constraints_set_modeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstraints_set_mode(s) + } +} + +func (s *Constraints_set_modeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstraints_set_mode(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constraints_set_mode() (localctx IConstraints_set_modeContext) { + localctx = NewConstraints_set_modeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 90, PostgreSQLParserRULE_constraints_set_mode) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2085) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserDEFERRED || _la == PostgreSQLParserIMMEDIATE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICheckpointstmtContext is an interface to support dynamic dispatch. +type ICheckpointstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CHECKPOINT() antlr.TerminalNode + + // IsCheckpointstmtContext differentiates from other interfaces. + IsCheckpointstmtContext() +} + +type CheckpointstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCheckpointstmtContext() *CheckpointstmtContext { + var p = new(CheckpointstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_checkpointstmt + return p +} + +func InitEmptyCheckpointstmtContext(p *CheckpointstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_checkpointstmt +} + +func (*CheckpointstmtContext) IsCheckpointstmtContext() {} + +func NewCheckpointstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CheckpointstmtContext { + var p = new(CheckpointstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_checkpointstmt + + return p +} + +func (s *CheckpointstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CheckpointstmtContext) CHECKPOINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHECKPOINT, 0) +} + +func (s *CheckpointstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CheckpointstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CheckpointstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCheckpointstmt(s) + } +} + +func (s *CheckpointstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCheckpointstmt(s) + } +} + +func (s *CheckpointstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCheckpointstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Checkpointstmt() (localctx ICheckpointstmtContext) { + localctx = NewCheckpointstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 92, PostgreSQLParserRULE_checkpointstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2087) + p.Match(PostgreSQLParserCHECKPOINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDiscardstmtContext is an interface to support dynamic dispatch. +type IDiscardstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DISCARD() antlr.TerminalNode + ALL() antlr.TerminalNode + TEMP() antlr.TerminalNode + TEMPORARY() antlr.TerminalNode + PLANS() antlr.TerminalNode + SEQUENCES() antlr.TerminalNode + + // IsDiscardstmtContext differentiates from other interfaces. + IsDiscardstmtContext() +} + +type DiscardstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDiscardstmtContext() *DiscardstmtContext { + var p = new(DiscardstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_discardstmt + return p +} + +func InitEmptyDiscardstmtContext(p *DiscardstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_discardstmt +} + +func (*DiscardstmtContext) IsDiscardstmtContext() {} + +func NewDiscardstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DiscardstmtContext { + var p = new(DiscardstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_discardstmt + + return p +} + +func (s *DiscardstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DiscardstmtContext) DISCARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISCARD, 0) +} + +func (s *DiscardstmtContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *DiscardstmtContext) TEMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMP, 0) +} + +func (s *DiscardstmtContext) TEMPORARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPORARY, 0) +} + +func (s *DiscardstmtContext) PLANS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLANS, 0) +} + +func (s *DiscardstmtContext) SEQUENCES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCES, 0) +} + +func (s *DiscardstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DiscardstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DiscardstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDiscardstmt(s) + } +} + +func (s *DiscardstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDiscardstmt(s) + } +} + +func (s *DiscardstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDiscardstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Discardstmt() (localctx IDiscardstmtContext) { + localctx = NewDiscardstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 94, PostgreSQLParserRULE_discardstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2089) + p.Match(PostgreSQLParserDISCARD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2090) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserALL || _la == PostgreSQLParserPLANS || _la == PostgreSQLParserSEQUENCES || _la == PostgreSQLParserTEMP || _la == PostgreSQLParserTEMPORARY) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltertablestmtContext is an interface to support dynamic dispatch. +type IAltertablestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + TABLE() antlr.TerminalNode + Relation_expr() IRelation_exprContext + Alter_table_cmds() IAlter_table_cmdsContext + Partition_cmd() IPartition_cmdContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + ALL() antlr.TerminalNode + IN_P() antlr.TerminalNode + AllTABLESPACE() []antlr.TerminalNode + TABLESPACE(i int) antlr.TerminalNode + AllName() []INameContext + Name(i int) INameContext + SET() antlr.TerminalNode + OWNED() antlr.TerminalNode + BY() antlr.TerminalNode + Role_list() IRole_listContext + Opt_nowait() IOpt_nowaitContext + INDEX() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Index_partition_cmd() IIndex_partition_cmdContext + SEQUENCE() antlr.TerminalNode + VIEW() antlr.TerminalNode + MATERIALIZED() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + + // IsAltertablestmtContext differentiates from other interfaces. + IsAltertablestmtContext() +} + +type AltertablestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltertablestmtContext() *AltertablestmtContext { + var p = new(AltertablestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertablestmt + return p +} + +func InitEmptyAltertablestmtContext(p *AltertablestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertablestmt +} + +func (*AltertablestmtContext) IsAltertablestmtContext() {} + +func NewAltertablestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltertablestmtContext { + var p = new(AltertablestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altertablestmt + + return p +} + +func (s *AltertablestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltertablestmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltertablestmtContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *AltertablestmtContext) Relation_expr() IRelation_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *AltertablestmtContext) Alter_table_cmds() IAlter_table_cmdsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_table_cmdsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_table_cmdsContext) +} + +func (s *AltertablestmtContext) Partition_cmd() IPartition_cmdContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPartition_cmdContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPartition_cmdContext) +} + +func (s *AltertablestmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *AltertablestmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *AltertablestmtContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *AltertablestmtContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *AltertablestmtContext) AllTABLESPACE() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserTABLESPACE) +} + +func (s *AltertablestmtContext) TABLESPACE(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, i) +} + +func (s *AltertablestmtContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *AltertablestmtContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AltertablestmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AltertablestmtContext) OWNED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNED, 0) +} + +func (s *AltertablestmtContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *AltertablestmtContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *AltertablestmtContext) Opt_nowait() IOpt_nowaitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_nowaitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_nowaitContext) +} + +func (s *AltertablestmtContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *AltertablestmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *AltertablestmtContext) Index_partition_cmd() IIndex_partition_cmdContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndex_partition_cmdContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndex_partition_cmdContext) +} + +func (s *AltertablestmtContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *AltertablestmtContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *AltertablestmtContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *AltertablestmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *AltertablestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltertablestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltertablestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltertablestmt(s) + } +} + +func (s *AltertablestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltertablestmt(s) + } +} + +func (s *AltertablestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltertablestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altertablestmt() (localctx IAltertablestmtContext) { + localctx = NewAltertablestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 96, PostgreSQLParserRULE_altertablestmt) + var _la int + + p.SetState(2204) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 54, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2092) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2093) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2096) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 40, p.GetParserRuleContext()) == 1 { + { + p.SetState(2094) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2095) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2098) + p.Relation_expr() + } + p.SetState(2101) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNOT, PostgreSQLParserADD_P, PostgreSQLParserALTER, PostgreSQLParserCLUSTER, PostgreSQLParserDISABLE_P, PostgreSQLParserDROP, PostgreSQLParserENABLE_P, PostgreSQLParserFORCE, PostgreSQLParserINHERIT, PostgreSQLParserNO, PostgreSQLParserOF, PostgreSQLParserOPTIONS, PostgreSQLParserOWNER, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserSET, PostgreSQLParserVALIDATE: + { + p.SetState(2099) + p.Alter_table_cmds() + } + + case PostgreSQLParserATTACH, PostgreSQLParserDETACH: + { + p.SetState(2100) + p.Partition_cmd() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2103) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2104) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2105) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2106) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2107) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2108) + p.Name() + } + p.SetState(2112) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOWNED { + { + p.SetState(2109) + p.Match(PostgreSQLParserOWNED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2110) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2111) + p.Role_list() + } + + } + { + p.SetState(2114) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2115) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2116) + p.Name() + } + p.SetState(2118) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOWAIT { + { + p.SetState(2117) + p.Opt_nowait() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2120) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2121) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2124) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 44, p.GetParserRuleContext()) == 1 { + { + p.SetState(2122) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2123) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2126) + p.Qualified_name() + } + p.SetState(2129) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNOT, PostgreSQLParserADD_P, PostgreSQLParserALTER, PostgreSQLParserCLUSTER, PostgreSQLParserDISABLE_P, PostgreSQLParserDROP, PostgreSQLParserENABLE_P, PostgreSQLParserFORCE, PostgreSQLParserINHERIT, PostgreSQLParserNO, PostgreSQLParserOF, PostgreSQLParserOPTIONS, PostgreSQLParserOWNER, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserSET, PostgreSQLParserVALIDATE: + { + p.SetState(2127) + p.Alter_table_cmds() + } + + case PostgreSQLParserATTACH: + { + p.SetState(2128) + p.Index_partition_cmd() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2131) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2132) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2133) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2134) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2135) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2136) + p.Name() + } + p.SetState(2140) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOWNED { + { + p.SetState(2137) + p.Match(PostgreSQLParserOWNED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2138) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2139) + p.Role_list() + } + + } + { + p.SetState(2142) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2143) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2144) + p.Name() + } + p.SetState(2146) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOWAIT { + { + p.SetState(2145) + p.Opt_nowait() + } + + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(2148) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2149) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2152) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 48, p.GetParserRuleContext()) == 1 { + { + p.SetState(2150) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2151) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2154) + p.Qualified_name() + } + { + p.SetState(2155) + p.Alter_table_cmds() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(2157) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2158) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2161) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 49, p.GetParserRuleContext()) == 1 { + { + p.SetState(2159) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2160) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2163) + p.Qualified_name() + } + { + p.SetState(2164) + p.Alter_table_cmds() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(2166) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2167) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2168) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2171) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 50, p.GetParserRuleContext()) == 1 { + { + p.SetState(2169) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2170) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2173) + p.Qualified_name() + } + { + p.SetState(2174) + p.Alter_table_cmds() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(2176) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2177) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2178) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2179) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2180) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2181) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2182) + p.Name() + } + p.SetState(2186) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOWNED { + { + p.SetState(2183) + p.Match(PostgreSQLParserOWNED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2184) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2185) + p.Role_list() + } + + } + { + p.SetState(2188) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2189) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2190) + p.Name() + } + p.SetState(2192) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOWAIT { + { + p.SetState(2191) + p.Opt_nowait() + } + + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(2194) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2195) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2196) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2199) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 53, p.GetParserRuleContext()) == 1 { + { + p.SetState(2197) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2198) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2201) + p.Relation_expr() + } + { + p.SetState(2202) + p.Alter_table_cmds() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_table_cmdsContext is an interface to support dynamic dispatch. +type IAlter_table_cmdsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAlter_table_cmd() []IAlter_table_cmdContext + Alter_table_cmd(i int) IAlter_table_cmdContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsAlter_table_cmdsContext differentiates from other interfaces. + IsAlter_table_cmdsContext() +} + +type Alter_table_cmdsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_table_cmdsContext() *Alter_table_cmdsContext { + var p = new(Alter_table_cmdsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_table_cmds + return p +} + +func InitEmptyAlter_table_cmdsContext(p *Alter_table_cmdsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_table_cmds +} + +func (*Alter_table_cmdsContext) IsAlter_table_cmdsContext() {} + +func NewAlter_table_cmdsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_table_cmdsContext { + var p = new(Alter_table_cmdsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_table_cmds + + return p +} + +func (s *Alter_table_cmdsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_table_cmdsContext) AllAlter_table_cmd() []IAlter_table_cmdContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAlter_table_cmdContext); ok { + len++ + } + } + + tst := make([]IAlter_table_cmdContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAlter_table_cmdContext); ok { + tst[i] = t.(IAlter_table_cmdContext) + i++ + } + } + + return tst +} + +func (s *Alter_table_cmdsContext) Alter_table_cmd(i int) IAlter_table_cmdContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_table_cmdContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAlter_table_cmdContext) +} + +func (s *Alter_table_cmdsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Alter_table_cmdsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Alter_table_cmdsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_table_cmdsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_table_cmdsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_table_cmds(s) + } +} + +func (s *Alter_table_cmdsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_table_cmds(s) + } +} + +func (s *Alter_table_cmdsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_table_cmds(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_table_cmds() (localctx IAlter_table_cmdsContext) { + localctx = NewAlter_table_cmdsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 98, PostgreSQLParserRULE_alter_table_cmds) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2206) + p.Alter_table_cmd() + } + p.SetState(2211) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(2207) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2208) + p.Alter_table_cmd() + } + + p.SetState(2213) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPartition_cmdContext is an interface to support dynamic dispatch. +type IPartition_cmdContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ATTACH() antlr.TerminalNode + PARTITION() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Partitionboundspec() IPartitionboundspecContext + DETACH() antlr.TerminalNode + + // IsPartition_cmdContext differentiates from other interfaces. + IsPartition_cmdContext() +} + +type Partition_cmdContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPartition_cmdContext() *Partition_cmdContext { + var p = new(Partition_cmdContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_partition_cmd + return p +} + +func InitEmptyPartition_cmdContext(p *Partition_cmdContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_partition_cmd +} + +func (*Partition_cmdContext) IsPartition_cmdContext() {} + +func NewPartition_cmdContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Partition_cmdContext { + var p = new(Partition_cmdContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_partition_cmd + + return p +} + +func (s *Partition_cmdContext) GetParser() antlr.Parser { return s.parser } + +func (s *Partition_cmdContext) ATTACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATTACH, 0) +} + +func (s *Partition_cmdContext) PARTITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTITION, 0) +} + +func (s *Partition_cmdContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Partition_cmdContext) Partitionboundspec() IPartitionboundspecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPartitionboundspecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPartitionboundspecContext) +} + +func (s *Partition_cmdContext) DETACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDETACH, 0) +} + +func (s *Partition_cmdContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Partition_cmdContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Partition_cmdContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPartition_cmd(s) + } +} + +func (s *Partition_cmdContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPartition_cmd(s) + } +} + +func (s *Partition_cmdContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPartition_cmd(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Partition_cmd() (localctx IPartition_cmdContext) { + localctx = NewPartition_cmdContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 100, PostgreSQLParserRULE_partition_cmd) + p.SetState(2222) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserATTACH: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2214) + p.Match(PostgreSQLParserATTACH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2215) + p.Match(PostgreSQLParserPARTITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2216) + p.Qualified_name() + } + { + p.SetState(2217) + p.Partitionboundspec() + } + + case PostgreSQLParserDETACH: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2219) + p.Match(PostgreSQLParserDETACH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2220) + p.Match(PostgreSQLParserPARTITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2221) + p.Qualified_name() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIndex_partition_cmdContext is an interface to support dynamic dispatch. +type IIndex_partition_cmdContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ATTACH() antlr.TerminalNode + PARTITION() antlr.TerminalNode + Qualified_name() IQualified_nameContext + + // IsIndex_partition_cmdContext differentiates from other interfaces. + IsIndex_partition_cmdContext() +} + +type Index_partition_cmdContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIndex_partition_cmdContext() *Index_partition_cmdContext { + var p = new(Index_partition_cmdContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_partition_cmd + return p +} + +func InitEmptyIndex_partition_cmdContext(p *Index_partition_cmdContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_partition_cmd +} + +func (*Index_partition_cmdContext) IsIndex_partition_cmdContext() {} + +func NewIndex_partition_cmdContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Index_partition_cmdContext { + var p = new(Index_partition_cmdContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_index_partition_cmd + + return p +} + +func (s *Index_partition_cmdContext) GetParser() antlr.Parser { return s.parser } + +func (s *Index_partition_cmdContext) ATTACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATTACH, 0) +} + +func (s *Index_partition_cmdContext) PARTITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTITION, 0) +} + +func (s *Index_partition_cmdContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Index_partition_cmdContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Index_partition_cmdContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Index_partition_cmdContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIndex_partition_cmd(s) + } +} + +func (s *Index_partition_cmdContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIndex_partition_cmd(s) + } +} + +func (s *Index_partition_cmdContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIndex_partition_cmd(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Index_partition_cmd() (localctx IIndex_partition_cmdContext) { + localctx = NewIndex_partition_cmdContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 102, PostgreSQLParserRULE_index_partition_cmd) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2224) + p.Match(PostgreSQLParserATTACH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2225) + p.Match(PostgreSQLParserPARTITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2226) + p.Qualified_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_table_cmdContext is an interface to support dynamic dispatch. +type IAlter_table_cmdContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ADD_P() antlr.TerminalNode + ColumnDef() IColumnDefContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + COLUMN() antlr.TerminalNode + ALTER() antlr.TerminalNode + AllColid() []IColidContext + Colid(i int) IColidContext + Alter_column_default() IAlter_column_defaultContext + Opt_column() IOpt_columnContext + DROP() antlr.TerminalNode + NULL_P() antlr.TerminalNode + SET() antlr.TerminalNode + EXPRESSION() antlr.TerminalNode + STATISTICS() antlr.TerminalNode + Signediconst() ISignediconstContext + Iconst() IIconstContext + Reloptions() IReloptionsContext + RESET() antlr.TerminalNode + STORAGE() antlr.TerminalNode + GENERATED() antlr.TerminalNode + Generated_when() IGenerated_whenContext + AS() antlr.TerminalNode + IDENTITY_P() antlr.TerminalNode + Optparenthesizedseqoptlist() IOptparenthesizedseqoptlistContext + Alter_identity_column_option_list() IAlter_identity_column_option_listContext + Opt_drop_behavior() IOpt_drop_behaviorContext + TYPE_P() antlr.TerminalNode + Typename() ITypenameContext + Opt_set_data() IOpt_set_dataContext + Opt_collate_clause() IOpt_collate_clauseContext + Alter_using() IAlter_usingContext + Alter_generic_options() IAlter_generic_optionsContext + Tableconstraint() ITableconstraintContext + CONSTRAINT() antlr.TerminalNode + Name() INameContext + Constraintattributespec() IConstraintattributespecContext + VALIDATE() antlr.TerminalNode + WITHOUT() antlr.TerminalNode + OIDS() antlr.TerminalNode + CLUSTER() antlr.TerminalNode + ON() antlr.TerminalNode + LOGGED() antlr.TerminalNode + UNLOGGED() antlr.TerminalNode + ENABLE_P() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + ALWAYS() antlr.TerminalNode + REPLICA() antlr.TerminalNode + ALL() antlr.TerminalNode + USER() antlr.TerminalNode + DISABLE_P() antlr.TerminalNode + RULE() antlr.TerminalNode + INHERIT() antlr.TerminalNode + Qualified_name() IQualified_nameContext + NO() antlr.TerminalNode + OF() antlr.TerminalNode + Any_name() IAny_nameContext + OWNER() antlr.TerminalNode + TO() antlr.TerminalNode + Rolespec() IRolespecContext + ACCESS() antlr.TerminalNode + METHOD() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + Replica_identity() IReplica_identityContext + ROW() antlr.TerminalNode + LEVEL() antlr.TerminalNode + SECURITY() antlr.TerminalNode + FORCE() antlr.TerminalNode + + // IsAlter_table_cmdContext differentiates from other interfaces. + IsAlter_table_cmdContext() +} + +type Alter_table_cmdContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_table_cmdContext() *Alter_table_cmdContext { + var p = new(Alter_table_cmdContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_table_cmd + return p +} + +func InitEmptyAlter_table_cmdContext(p *Alter_table_cmdContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_table_cmd +} + +func (*Alter_table_cmdContext) IsAlter_table_cmdContext() {} + +func NewAlter_table_cmdContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_table_cmdContext { + var p = new(Alter_table_cmdContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_table_cmd + + return p +} + +func (s *Alter_table_cmdContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_table_cmdContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *Alter_table_cmdContext) ColumnDef() IColumnDefContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnDefContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnDefContext) +} + +func (s *Alter_table_cmdContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *Alter_table_cmdContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Alter_table_cmdContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *Alter_table_cmdContext) COLUMN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLUMN, 0) +} + +func (s *Alter_table_cmdContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *Alter_table_cmdContext) AllColid() []IColidContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IColidContext); ok { + len++ + } + } + + tst := make([]IColidContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IColidContext); ok { + tst[i] = t.(IColidContext) + i++ + } + } + + return tst +} + +func (s *Alter_table_cmdContext) Colid(i int) IColidContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Alter_table_cmdContext) Alter_column_default() IAlter_column_defaultContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_column_defaultContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_column_defaultContext) +} + +func (s *Alter_table_cmdContext) Opt_column() IOpt_columnContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_columnContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_columnContext) +} + +func (s *Alter_table_cmdContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *Alter_table_cmdContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Alter_table_cmdContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Alter_table_cmdContext) EXPRESSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXPRESSION, 0) +} + +func (s *Alter_table_cmdContext) STATISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, 0) +} + +func (s *Alter_table_cmdContext) Signediconst() ISignediconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISignediconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISignediconstContext) +} + +func (s *Alter_table_cmdContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Alter_table_cmdContext) Reloptions() IReloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReloptionsContext) +} + +func (s *Alter_table_cmdContext) RESET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESET, 0) +} + +func (s *Alter_table_cmdContext) STORAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTORAGE, 0) +} + +func (s *Alter_table_cmdContext) GENERATED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGENERATED, 0) +} + +func (s *Alter_table_cmdContext) Generated_when() IGenerated_whenContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGenerated_whenContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGenerated_whenContext) +} + +func (s *Alter_table_cmdContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Alter_table_cmdContext) IDENTITY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIDENTITY_P, 0) +} + +func (s *Alter_table_cmdContext) Optparenthesizedseqoptlist() IOptparenthesizedseqoptlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptparenthesizedseqoptlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptparenthesizedseqoptlistContext) +} + +func (s *Alter_table_cmdContext) Alter_identity_column_option_list() IAlter_identity_column_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_identity_column_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_identity_column_option_listContext) +} + +func (s *Alter_table_cmdContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *Alter_table_cmdContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *Alter_table_cmdContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Alter_table_cmdContext) Opt_set_data() IOpt_set_dataContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_set_dataContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_set_dataContext) +} + +func (s *Alter_table_cmdContext) Opt_collate_clause() IOpt_collate_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_collate_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_collate_clauseContext) +} + +func (s *Alter_table_cmdContext) Alter_using() IAlter_usingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_usingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_usingContext) +} + +func (s *Alter_table_cmdContext) Alter_generic_options() IAlter_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_generic_optionsContext) +} + +func (s *Alter_table_cmdContext) Tableconstraint() ITableconstraintContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITableconstraintContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITableconstraintContext) +} + +func (s *Alter_table_cmdContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *Alter_table_cmdContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Alter_table_cmdContext) Constraintattributespec() IConstraintattributespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraintattributespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraintattributespecContext) +} + +func (s *Alter_table_cmdContext) VALIDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALIDATE, 0) +} + +func (s *Alter_table_cmdContext) WITHOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITHOUT, 0) +} + +func (s *Alter_table_cmdContext) OIDS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOIDS, 0) +} + +func (s *Alter_table_cmdContext) CLUSTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLUSTER, 0) +} + +func (s *Alter_table_cmdContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Alter_table_cmdContext) LOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOGGED, 0) +} + +func (s *Alter_table_cmdContext) UNLOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNLOGGED, 0) +} + +func (s *Alter_table_cmdContext) ENABLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENABLE_P, 0) +} + +func (s *Alter_table_cmdContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *Alter_table_cmdContext) ALWAYS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALWAYS, 0) +} + +func (s *Alter_table_cmdContext) REPLICA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPLICA, 0) +} + +func (s *Alter_table_cmdContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Alter_table_cmdContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *Alter_table_cmdContext) DISABLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISABLE_P, 0) +} + +func (s *Alter_table_cmdContext) RULE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRULE, 0) +} + +func (s *Alter_table_cmdContext) INHERIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINHERIT, 0) +} + +func (s *Alter_table_cmdContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Alter_table_cmdContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Alter_table_cmdContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *Alter_table_cmdContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Alter_table_cmdContext) OWNER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNER, 0) +} + +func (s *Alter_table_cmdContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Alter_table_cmdContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *Alter_table_cmdContext) ACCESS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACCESS, 0) +} + +func (s *Alter_table_cmdContext) METHOD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMETHOD, 0) +} + +func (s *Alter_table_cmdContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *Alter_table_cmdContext) Replica_identity() IReplica_identityContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReplica_identityContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReplica_identityContext) +} + +func (s *Alter_table_cmdContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *Alter_table_cmdContext) LEVEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEVEL, 0) +} + +func (s *Alter_table_cmdContext) SECURITY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSECURITY, 0) +} + +func (s *Alter_table_cmdContext) FORCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORCE, 0) +} + +func (s *Alter_table_cmdContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_table_cmdContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_table_cmdContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_table_cmd(s) + } +} + +func (s *Alter_table_cmdContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_table_cmd(s) + } +} + +func (s *Alter_table_cmdContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_table_cmd(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_table_cmd() (localctx IAlter_table_cmdContext) { + localctx = NewAlter_table_cmdContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 104, PostgreSQLParserRULE_alter_table_cmd) + var _la int + + p.SetState(2530) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 83, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2228) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2229) + p.ColumnDef() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2230) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2231) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2232) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2233) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2234) + p.ColumnDef() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2235) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2236) + p.Match(PostgreSQLParserCOLUMN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2237) + p.ColumnDef() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2238) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2239) + p.Match(PostgreSQLParserCOLUMN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2240) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2241) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2242) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2243) + p.ColumnDef() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(2244) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2246) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 57, p.GetParserRuleContext()) == 1 { + { + p.SetState(2245) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2248) + p.Colid() + } + { + p.SetState(2249) + p.Alter_column_default() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(2251) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2253) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 58, p.GetParserRuleContext()) == 1 { + { + p.SetState(2252) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2255) + p.Colid() + } + { + p.SetState(2256) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2257) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2258) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(2260) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2262) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 59, p.GetParserRuleContext()) == 1 { + { + p.SetState(2261) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2264) + p.Colid() + } + { + p.SetState(2265) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2266) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2267) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(2269) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2271) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 60, p.GetParserRuleContext()) == 1 { + { + p.SetState(2270) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2273) + p.Colid() + } + { + p.SetState(2274) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2275) + p.Match(PostgreSQLParserEXPRESSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(2277) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2279) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 61, p.GetParserRuleContext()) == 1 { + { + p.SetState(2278) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2281) + p.Colid() + } + { + p.SetState(2282) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2283) + p.Match(PostgreSQLParserEXPRESSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2284) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2285) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(2287) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2289) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 62, p.GetParserRuleContext()) == 1 { + { + p.SetState(2288) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2291) + p.Colid() + } + { + p.SetState(2292) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2293) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2294) + p.Signediconst() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(2296) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2298) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOLUMN { + { + p.SetState(2297) + p.Opt_column() + } + + } + { + p.SetState(2300) + p.Iconst() + } + { + p.SetState(2301) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2302) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2303) + p.Signediconst() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(2305) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2307) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 64, p.GetParserRuleContext()) == 1 { + { + p.SetState(2306) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2309) + p.Colid() + } + { + p.SetState(2310) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2311) + p.Reloptions() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(2313) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2315) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 65, p.GetParserRuleContext()) == 1 { + { + p.SetState(2314) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2317) + p.Colid() + } + { + p.SetState(2318) + p.Match(PostgreSQLParserRESET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2319) + p.Reloptions() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(2321) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2323) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 66, p.GetParserRuleContext()) == 1 { + { + p.SetState(2322) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2325) + p.Colid() + } + { + p.SetState(2326) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2327) + p.Match(PostgreSQLParserSTORAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2328) + p.Colid() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(2330) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2332) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 67, p.GetParserRuleContext()) == 1 { + { + p.SetState(2331) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2334) + p.Colid() + } + { + p.SetState(2335) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2336) + p.Match(PostgreSQLParserGENERATED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2337) + p.Generated_when() + } + { + p.SetState(2338) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2339) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2341) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 68, p.GetParserRuleContext()) == 1 { + { + p.SetState(2340) + p.Optparenthesizedseqoptlist() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(2343) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2345) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 69, p.GetParserRuleContext()) == 1 { + { + p.SetState(2344) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2347) + p.Colid() + } + { + p.SetState(2348) + p.Alter_identity_column_option_list() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(2350) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2352) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 70, p.GetParserRuleContext()) == 1 { + { + p.SetState(2351) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2354) + p.Colid() + } + { + p.SetState(2355) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2356) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(2358) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2360) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 71, p.GetParserRuleContext()) == 1 { + { + p.SetState(2359) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2362) + p.Colid() + } + { + p.SetState(2363) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2364) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2365) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2366) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 19: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(2368) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2370) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOLUMN { + { + p.SetState(2369) + p.Opt_column() + } + + } + { + p.SetState(2372) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2373) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2374) + p.Colid() + } + p.SetState(2376) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(2375) + p.Opt_drop_behavior() + } + + } + + case 20: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(2378) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2380) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 74, p.GetParserRuleContext()) == 1 { + { + p.SetState(2379) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2382) + p.Colid() + } + p.SetState(2384) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(2383) + p.Opt_drop_behavior() + } + + } + + case 21: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(2386) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2388) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 76, p.GetParserRuleContext()) == 1 { + { + p.SetState(2387) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2390) + p.Colid() + } + p.SetState(2392) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSET { + { + p.SetState(2391) + p.Opt_set_data() + } + + } + { + p.SetState(2394) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2395) + p.Typename() + } + p.SetState(2397) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOLLATE { + { + p.SetState(2396) + p.Opt_collate_clause() + } + + } + p.SetState(2400) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(2399) + p.Alter_using() + } + + } + + case 22: + p.EnterOuterAlt(localctx, 22) + { + p.SetState(2402) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2404) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 80, p.GetParserRuleContext()) == 1 { + { + p.SetState(2403) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2406) + p.Colid() + } + { + p.SetState(2407) + p.Alter_generic_options() + } + + case 23: + p.EnterOuterAlt(localctx, 23) + { + p.SetState(2409) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2410) + p.Tableconstraint() + } + + case 24: + p.EnterOuterAlt(localctx, 24) + { + p.SetState(2411) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2412) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2413) + p.Name() + } + { + p.SetState(2414) + p.Constraintattributespec() + } + + case 25: + p.EnterOuterAlt(localctx, 25) + { + p.SetState(2416) + p.Match(PostgreSQLParserVALIDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2417) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2418) + p.Name() + } + + case 26: + p.EnterOuterAlt(localctx, 26) + { + p.SetState(2419) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2420) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2421) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2422) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2423) + p.Name() + } + p.SetState(2425) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(2424) + p.Opt_drop_behavior() + } + + } + + case 27: + p.EnterOuterAlt(localctx, 27) + { + p.SetState(2427) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2428) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2429) + p.Name() + } + p.SetState(2431) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(2430) + p.Opt_drop_behavior() + } + + } + + case 28: + p.EnterOuterAlt(localctx, 28) + { + p.SetState(2433) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2434) + p.Match(PostgreSQLParserWITHOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2435) + p.Match(PostgreSQLParserOIDS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 29: + p.EnterOuterAlt(localctx, 29) + { + p.SetState(2436) + p.Match(PostgreSQLParserCLUSTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2437) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2438) + p.Name() + } + + case 30: + p.EnterOuterAlt(localctx, 30) + { + p.SetState(2439) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2440) + p.Match(PostgreSQLParserWITHOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2441) + p.Match(PostgreSQLParserCLUSTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 31: + p.EnterOuterAlt(localctx, 31) + { + p.SetState(2442) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2443) + p.Match(PostgreSQLParserLOGGED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 32: + p.EnterOuterAlt(localctx, 32) + { + p.SetState(2444) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2445) + p.Match(PostgreSQLParserUNLOGGED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 33: + p.EnterOuterAlt(localctx, 33) + { + p.SetState(2446) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2447) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2448) + p.Name() + } + + case 34: + p.EnterOuterAlt(localctx, 34) + { + p.SetState(2449) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2450) + p.Match(PostgreSQLParserALWAYS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2451) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2452) + p.Name() + } + + case 35: + p.EnterOuterAlt(localctx, 35) + { + p.SetState(2453) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2454) + p.Match(PostgreSQLParserREPLICA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2455) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2456) + p.Name() + } + + case 36: + p.EnterOuterAlt(localctx, 36) + { + p.SetState(2457) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2458) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2459) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 37: + p.EnterOuterAlt(localctx, 37) + { + p.SetState(2460) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2461) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2462) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 38: + p.EnterOuterAlt(localctx, 38) + { + p.SetState(2463) + p.Match(PostgreSQLParserDISABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2464) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2465) + p.Name() + } + + case 39: + p.EnterOuterAlt(localctx, 39) + { + p.SetState(2466) + p.Match(PostgreSQLParserDISABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2467) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2468) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 40: + p.EnterOuterAlt(localctx, 40) + { + p.SetState(2469) + p.Match(PostgreSQLParserDISABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2470) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2471) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 41: + p.EnterOuterAlt(localctx, 41) + { + p.SetState(2472) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2473) + p.Match(PostgreSQLParserRULE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2474) + p.Name() + } + + case 42: + p.EnterOuterAlt(localctx, 42) + { + p.SetState(2475) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2476) + p.Match(PostgreSQLParserALWAYS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2477) + p.Match(PostgreSQLParserRULE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2478) + p.Name() + } + + case 43: + p.EnterOuterAlt(localctx, 43) + { + p.SetState(2479) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2480) + p.Match(PostgreSQLParserREPLICA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2481) + p.Match(PostgreSQLParserRULE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2482) + p.Name() + } + + case 44: + p.EnterOuterAlt(localctx, 44) + { + p.SetState(2483) + p.Match(PostgreSQLParserDISABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2484) + p.Match(PostgreSQLParserRULE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2485) + p.Name() + } + + case 45: + p.EnterOuterAlt(localctx, 45) + { + p.SetState(2486) + p.Match(PostgreSQLParserINHERIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2487) + p.Qualified_name() + } + + case 46: + p.EnterOuterAlt(localctx, 46) + { + p.SetState(2488) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2489) + p.Match(PostgreSQLParserINHERIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2490) + p.Qualified_name() + } + + case 47: + p.EnterOuterAlt(localctx, 47) + { + p.SetState(2491) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2492) + p.Any_name() + } + + case 48: + p.EnterOuterAlt(localctx, 48) + { + p.SetState(2493) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2494) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 49: + p.EnterOuterAlt(localctx, 49) + { + p.SetState(2495) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2496) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2497) + p.Rolespec() + } + + case 50: + p.EnterOuterAlt(localctx, 50) + { + p.SetState(2498) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2499) + p.Match(PostgreSQLParserACCESS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2500) + p.Match(PostgreSQLParserMETHOD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2501) + p.Name() + } + + case 51: + p.EnterOuterAlt(localctx, 51) + { + p.SetState(2502) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2503) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2504) + p.Name() + } + + case 52: + p.EnterOuterAlt(localctx, 52) + { + p.SetState(2505) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2506) + p.Reloptions() + } + + case 53: + p.EnterOuterAlt(localctx, 53) + { + p.SetState(2507) + p.Match(PostgreSQLParserRESET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2508) + p.Reloptions() + } + + case 54: + p.EnterOuterAlt(localctx, 54) + { + p.SetState(2509) + p.Match(PostgreSQLParserREPLICA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2510) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2511) + p.Replica_identity() + } + + case 55: + p.EnterOuterAlt(localctx, 55) + { + p.SetState(2512) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2513) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2514) + p.Match(PostgreSQLParserLEVEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2515) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 56: + p.EnterOuterAlt(localctx, 56) + { + p.SetState(2516) + p.Match(PostgreSQLParserDISABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2517) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2518) + p.Match(PostgreSQLParserLEVEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2519) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 57: + p.EnterOuterAlt(localctx, 57) + { + p.SetState(2520) + p.Match(PostgreSQLParserFORCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2521) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2522) + p.Match(PostgreSQLParserLEVEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2523) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 58: + p.EnterOuterAlt(localctx, 58) + { + p.SetState(2524) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2525) + p.Match(PostgreSQLParserFORCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2526) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2527) + p.Match(PostgreSQLParserLEVEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2528) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 59: + p.EnterOuterAlt(localctx, 59) + { + p.SetState(2529) + p.Alter_generic_options() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_column_defaultContext is an interface to support dynamic dispatch. +type IAlter_column_defaultContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SET() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + A_expr() IA_exprContext + DROP() antlr.TerminalNode + + // IsAlter_column_defaultContext differentiates from other interfaces. + IsAlter_column_defaultContext() +} + +type Alter_column_defaultContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_column_defaultContext() *Alter_column_defaultContext { + var p = new(Alter_column_defaultContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_column_default + return p +} + +func InitEmptyAlter_column_defaultContext(p *Alter_column_defaultContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_column_default +} + +func (*Alter_column_defaultContext) IsAlter_column_defaultContext() {} + +func NewAlter_column_defaultContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_column_defaultContext { + var p = new(Alter_column_defaultContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_column_default + + return p +} + +func (s *Alter_column_defaultContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_column_defaultContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Alter_column_defaultContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Alter_column_defaultContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Alter_column_defaultContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *Alter_column_defaultContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_column_defaultContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_column_defaultContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_column_default(s) + } +} + +func (s *Alter_column_defaultContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_column_default(s) + } +} + +func (s *Alter_column_defaultContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_column_default(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_column_default() (localctx IAlter_column_defaultContext) { + localctx = NewAlter_column_defaultContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 106, PostgreSQLParserRULE_alter_column_default) + p.SetState(2537) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserSET: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2532) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2533) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2534) + p.A_expr() + } + + case PostgreSQLParserDROP: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2535) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2536) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_drop_behaviorContext is an interface to support dynamic dispatch. +type IOpt_drop_behaviorContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CASCADE() antlr.TerminalNode + RESTRICT() antlr.TerminalNode + + // IsOpt_drop_behaviorContext differentiates from other interfaces. + IsOpt_drop_behaviorContext() +} + +type Opt_drop_behaviorContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_drop_behaviorContext() *Opt_drop_behaviorContext { + var p = new(Opt_drop_behaviorContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_drop_behavior + return p +} + +func InitEmptyOpt_drop_behaviorContext(p *Opt_drop_behaviorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_drop_behavior +} + +func (*Opt_drop_behaviorContext) IsOpt_drop_behaviorContext() {} + +func NewOpt_drop_behaviorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_drop_behaviorContext { + var p = new(Opt_drop_behaviorContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_drop_behavior + + return p +} + +func (s *Opt_drop_behaviorContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_drop_behaviorContext) CASCADE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASCADE, 0) +} + +func (s *Opt_drop_behaviorContext) RESTRICT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESTRICT, 0) +} + +func (s *Opt_drop_behaviorContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_drop_behaviorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_drop_behaviorContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_drop_behavior(s) + } +} + +func (s *Opt_drop_behaviorContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_drop_behavior(s) + } +} + +func (s *Opt_drop_behaviorContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_drop_behavior(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_drop_behavior() (localctx IOpt_drop_behaviorContext) { + localctx = NewOpt_drop_behaviorContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 108, PostgreSQLParserRULE_opt_drop_behavior) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2539) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_collate_clauseContext is an interface to support dynamic dispatch. +type IOpt_collate_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COLLATE() antlr.TerminalNode + Any_name() IAny_nameContext + + // IsOpt_collate_clauseContext differentiates from other interfaces. + IsOpt_collate_clauseContext() +} + +type Opt_collate_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_collate_clauseContext() *Opt_collate_clauseContext { + var p = new(Opt_collate_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_collate_clause + return p +} + +func InitEmptyOpt_collate_clauseContext(p *Opt_collate_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_collate_clause +} + +func (*Opt_collate_clauseContext) IsOpt_collate_clauseContext() {} + +func NewOpt_collate_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_collate_clauseContext { + var p = new(Opt_collate_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_collate_clause + + return p +} + +func (s *Opt_collate_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_collate_clauseContext) COLLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATE, 0) +} + +func (s *Opt_collate_clauseContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Opt_collate_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_collate_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_collate_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_collate_clause(s) + } +} + +func (s *Opt_collate_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_collate_clause(s) + } +} + +func (s *Opt_collate_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_collate_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_collate_clause() (localctx IOpt_collate_clauseContext) { + localctx = NewOpt_collate_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 110, PostgreSQLParserRULE_opt_collate_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2541) + p.Match(PostgreSQLParserCOLLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2542) + p.Any_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_usingContext is an interface to support dynamic dispatch. +type IAlter_usingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + A_expr() IA_exprContext + + // IsAlter_usingContext differentiates from other interfaces. + IsAlter_usingContext() +} + +type Alter_usingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_usingContext() *Alter_usingContext { + var p = new(Alter_usingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_using + return p +} + +func InitEmptyAlter_usingContext(p *Alter_usingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_using +} + +func (*Alter_usingContext) IsAlter_usingContext() {} + +func NewAlter_usingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_usingContext { + var p = new(Alter_usingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_using + + return p +} + +func (s *Alter_usingContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_usingContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Alter_usingContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Alter_usingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_usingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_usingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_using(s) + } +} + +func (s *Alter_usingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_using(s) + } +} + +func (s *Alter_usingContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_using(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_using() (localctx IAlter_usingContext) { + localctx = NewAlter_usingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 112, PostgreSQLParserRULE_alter_using) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2544) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2545) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReplica_identityContext is an interface to support dynamic dispatch. +type IReplica_identityContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOTHING() antlr.TerminalNode + FULL() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + USING() antlr.TerminalNode + INDEX() antlr.TerminalNode + Name() INameContext + + // IsReplica_identityContext differentiates from other interfaces. + IsReplica_identityContext() +} + +type Replica_identityContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReplica_identityContext() *Replica_identityContext { + var p = new(Replica_identityContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_replica_identity + return p +} + +func InitEmptyReplica_identityContext(p *Replica_identityContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_replica_identity +} + +func (*Replica_identityContext) IsReplica_identityContext() {} + +func NewReplica_identityContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Replica_identityContext { + var p = new(Replica_identityContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_replica_identity + + return p +} + +func (s *Replica_identityContext) GetParser() antlr.Parser { return s.parser } + +func (s *Replica_identityContext) NOTHING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTHING, 0) +} + +func (s *Replica_identityContext) FULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFULL, 0) +} + +func (s *Replica_identityContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Replica_identityContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Replica_identityContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *Replica_identityContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Replica_identityContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Replica_identityContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Replica_identityContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReplica_identity(s) + } +} + +func (s *Replica_identityContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReplica_identity(s) + } +} + +func (s *Replica_identityContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReplica_identity(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Replica_identity() (localctx IReplica_identityContext) { + localctx = NewReplica_identityContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 114, PostgreSQLParserRULE_replica_identity) + p.SetState(2553) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNOTHING: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2547) + p.Match(PostgreSQLParserNOTHING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserFULL: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2548) + p.Match(PostgreSQLParserFULL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDEFAULT: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2549) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserUSING: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2550) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2551) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2552) + p.Name() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReloptionsContext is an interface to support dynamic dispatch. +type IReloptionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Reloption_list() IReloption_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsReloptionsContext differentiates from other interfaces. + IsReloptionsContext() +} + +type ReloptionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReloptionsContext() *ReloptionsContext { + var p = new(ReloptionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reloptions + return p +} + +func InitEmptyReloptionsContext(p *ReloptionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reloptions +} + +func (*ReloptionsContext) IsReloptionsContext() {} + +func NewReloptionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ReloptionsContext { + var p = new(ReloptionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reloptions + + return p +} + +func (s *ReloptionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *ReloptionsContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ReloptionsContext) Reloption_list() IReloption_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReloption_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReloption_listContext) +} + +func (s *ReloptionsContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ReloptionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ReloptionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ReloptionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReloptions(s) + } +} + +func (s *ReloptionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReloptions(s) + } +} + +func (s *ReloptionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReloptions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reloptions() (localctx IReloptionsContext) { + localctx = NewReloptionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 116, PostgreSQLParserRULE_reloptions) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2555) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2556) + p.Reloption_list() + } + { + p.SetState(2557) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_reloptionsContext is an interface to support dynamic dispatch. +type IOpt_reloptionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + Reloptions() IReloptionsContext + + // IsOpt_reloptionsContext differentiates from other interfaces. + IsOpt_reloptionsContext() +} + +type Opt_reloptionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_reloptionsContext() *Opt_reloptionsContext { + var p = new(Opt_reloptionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_reloptions + return p +} + +func InitEmptyOpt_reloptionsContext(p *Opt_reloptionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_reloptions +} + +func (*Opt_reloptionsContext) IsOpt_reloptionsContext() {} + +func NewOpt_reloptionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_reloptionsContext { + var p = new(Opt_reloptionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_reloptions + + return p +} + +func (s *Opt_reloptionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_reloptionsContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_reloptionsContext) Reloptions() IReloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReloptionsContext) +} + +func (s *Opt_reloptionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_reloptionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_reloptionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_reloptions(s) + } +} + +func (s *Opt_reloptionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_reloptions(s) + } +} + +func (s *Opt_reloptionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_reloptions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_reloptions() (localctx IOpt_reloptionsContext) { + localctx = NewOpt_reloptionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 118, PostgreSQLParserRULE_opt_reloptions) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2559) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2560) + p.Reloptions() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReloption_listContext is an interface to support dynamic dispatch. +type IReloption_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllReloption_elem() []IReloption_elemContext + Reloption_elem(i int) IReloption_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsReloption_listContext differentiates from other interfaces. + IsReloption_listContext() +} + +type Reloption_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReloption_listContext() *Reloption_listContext { + var p = new(Reloption_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reloption_list + return p +} + +func InitEmptyReloption_listContext(p *Reloption_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reloption_list +} + +func (*Reloption_listContext) IsReloption_listContext() {} + +func NewReloption_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reloption_listContext { + var p = new(Reloption_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reloption_list + + return p +} + +func (s *Reloption_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Reloption_listContext) AllReloption_elem() []IReloption_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IReloption_elemContext); ok { + len++ + } + } + + tst := make([]IReloption_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IReloption_elemContext); ok { + tst[i] = t.(IReloption_elemContext) + i++ + } + } + + return tst +} + +func (s *Reloption_listContext) Reloption_elem(i int) IReloption_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReloption_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IReloption_elemContext) +} + +func (s *Reloption_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Reloption_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Reloption_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Reloption_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Reloption_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReloption_list(s) + } +} + +func (s *Reloption_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReloption_list(s) + } +} + +func (s *Reloption_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReloption_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reloption_list() (localctx IReloption_listContext) { + localctx = NewReloption_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 120, PostgreSQLParserRULE_reloption_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2562) + p.Reloption_elem() + } + p.SetState(2567) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(2563) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2564) + p.Reloption_elem() + } + + p.SetState(2569) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReloption_elemContext is an interface to support dynamic dispatch. +type IReloption_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCollabel() []ICollabelContext + Collabel(i int) ICollabelContext + EQUAL() antlr.TerminalNode + Def_arg() IDef_argContext + DOT() antlr.TerminalNode + + // IsReloption_elemContext differentiates from other interfaces. + IsReloption_elemContext() +} + +type Reloption_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReloption_elemContext() *Reloption_elemContext { + var p = new(Reloption_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reloption_elem + return p +} + +func InitEmptyReloption_elemContext(p *Reloption_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reloption_elem +} + +func (*Reloption_elemContext) IsReloption_elemContext() {} + +func NewReloption_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reloption_elemContext { + var p = new(Reloption_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reloption_elem + + return p +} + +func (s *Reloption_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Reloption_elemContext) AllCollabel() []ICollabelContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICollabelContext); ok { + len++ + } + } + + tst := make([]ICollabelContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICollabelContext); ok { + tst[i] = t.(ICollabelContext) + i++ + } + } + + return tst +} + +func (s *Reloption_elemContext) Collabel(i int) ICollabelContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Reloption_elemContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Reloption_elemContext) Def_arg() IDef_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDef_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDef_argContext) +} + +func (s *Reloption_elemContext) DOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOT, 0) +} + +func (s *Reloption_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Reloption_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Reloption_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReloption_elem(s) + } +} + +func (s *Reloption_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReloption_elem(s) + } +} + +func (s *Reloption_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReloption_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reloption_elem() (localctx IReloption_elemContext) { + localctx = NewReloption_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 122, PostgreSQLParserRULE_reloption_elem) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2570) + p.Collabel() + } + p.SetState(2579) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserEQUAL: + { + p.SetState(2571) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2572) + p.Def_arg() + } + + case PostgreSQLParserDOT: + { + p.SetState(2573) + p.Match(PostgreSQLParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2574) + p.Collabel() + } + p.SetState(2577) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEQUAL { + { + p.SetState(2575) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2576) + p.Def_arg() + } + + } + + case PostgreSQLParserCLOSE_PAREN, PostgreSQLParserCOMMA: + + default: + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_identity_column_option_listContext is an interface to support dynamic dispatch. +type IAlter_identity_column_option_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAlter_identity_column_option() []IAlter_identity_column_optionContext + Alter_identity_column_option(i int) IAlter_identity_column_optionContext + + // IsAlter_identity_column_option_listContext differentiates from other interfaces. + IsAlter_identity_column_option_listContext() +} + +type Alter_identity_column_option_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_identity_column_option_listContext() *Alter_identity_column_option_listContext { + var p = new(Alter_identity_column_option_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_identity_column_option_list + return p +} + +func InitEmptyAlter_identity_column_option_listContext(p *Alter_identity_column_option_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_identity_column_option_list +} + +func (*Alter_identity_column_option_listContext) IsAlter_identity_column_option_listContext() {} + +func NewAlter_identity_column_option_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_identity_column_option_listContext { + var p = new(Alter_identity_column_option_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_identity_column_option_list + + return p +} + +func (s *Alter_identity_column_option_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_identity_column_option_listContext) AllAlter_identity_column_option() []IAlter_identity_column_optionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAlter_identity_column_optionContext); ok { + len++ + } + } + + tst := make([]IAlter_identity_column_optionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAlter_identity_column_optionContext); ok { + tst[i] = t.(IAlter_identity_column_optionContext) + i++ + } + } + + return tst +} + +func (s *Alter_identity_column_option_listContext) Alter_identity_column_option(i int) IAlter_identity_column_optionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_identity_column_optionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAlter_identity_column_optionContext) +} + +func (s *Alter_identity_column_option_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_identity_column_option_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_identity_column_option_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_identity_column_option_list(s) + } +} + +func (s *Alter_identity_column_option_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_identity_column_option_list(s) + } +} + +func (s *Alter_identity_column_option_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_identity_column_option_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_identity_column_option_list() (localctx IAlter_identity_column_option_listContext) { + localctx = NewAlter_identity_column_option_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 124, PostgreSQLParserRULE_alter_identity_column_option_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(2582) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(2581) + p.Alter_identity_column_option() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(2584) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 89, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_identity_column_optionContext is an interface to support dynamic dispatch. +type IAlter_identity_column_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RESTART() antlr.TerminalNode + Numericonly() INumericonlyContext + Opt_with() IOpt_withContext + SET() antlr.TerminalNode + Seqoptelem() ISeqoptelemContext + GENERATED() antlr.TerminalNode + Generated_when() IGenerated_whenContext + + // IsAlter_identity_column_optionContext differentiates from other interfaces. + IsAlter_identity_column_optionContext() +} + +type Alter_identity_column_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_identity_column_optionContext() *Alter_identity_column_optionContext { + var p = new(Alter_identity_column_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_identity_column_option + return p +} + +func InitEmptyAlter_identity_column_optionContext(p *Alter_identity_column_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_identity_column_option +} + +func (*Alter_identity_column_optionContext) IsAlter_identity_column_optionContext() {} + +func NewAlter_identity_column_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_identity_column_optionContext { + var p = new(Alter_identity_column_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_identity_column_option + + return p +} + +func (s *Alter_identity_column_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_identity_column_optionContext) RESTART() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESTART, 0) +} + +func (s *Alter_identity_column_optionContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Alter_identity_column_optionContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *Alter_identity_column_optionContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Alter_identity_column_optionContext) Seqoptelem() ISeqoptelemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISeqoptelemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISeqoptelemContext) +} + +func (s *Alter_identity_column_optionContext) GENERATED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGENERATED, 0) +} + +func (s *Alter_identity_column_optionContext) Generated_when() IGenerated_whenContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGenerated_whenContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGenerated_whenContext) +} + +func (s *Alter_identity_column_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_identity_column_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_identity_column_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_identity_column_option(s) + } +} + +func (s *Alter_identity_column_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_identity_column_option(s) + } +} + +func (s *Alter_identity_column_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_identity_column_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_identity_column_option() (localctx IAlter_identity_column_optionContext) { + localctx = NewAlter_identity_column_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 126, PostgreSQLParserRULE_alter_identity_column_option) + var _la int + + p.SetState(2599) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserRESTART: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2586) + p.Match(PostgreSQLParserRESTART) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2591) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 91, p.GetParserRuleContext()) == 1 { + p.SetState(2588) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(2587) + p.Opt_with() + } + + } + { + p.SetState(2590) + p.Numericonly() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserSET: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2593) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2597) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAS, PostgreSQLParserCACHE, PostgreSQLParserCYCLE, PostgreSQLParserINCREMENT, PostgreSQLParserMAXVALUE, PostgreSQLParserMINVALUE, PostgreSQLParserNO, PostgreSQLParserOWNED, PostgreSQLParserRESTART, PostgreSQLParserSEQUENCE, PostgreSQLParserSTART, PostgreSQLParserUNLOGGED, PostgreSQLParserLOGGED: + { + p.SetState(2594) + p.Seqoptelem() + } + + case PostgreSQLParserGENERATED: + { + p.SetState(2595) + p.Match(PostgreSQLParserGENERATED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2596) + p.Generated_when() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPartitionboundspecContext is an interface to support dynamic dispatch. +type IPartitionboundspecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FOR() antlr.TerminalNode + VALUES() antlr.TerminalNode + WITH() antlr.TerminalNode + AllOPEN_PAREN() []antlr.TerminalNode + OPEN_PAREN(i int) antlr.TerminalNode + Hash_partbound() IHash_partboundContext + AllCLOSE_PAREN() []antlr.TerminalNode + CLOSE_PAREN(i int) antlr.TerminalNode + IN_P() antlr.TerminalNode + AllExpr_list() []IExpr_listContext + Expr_list(i int) IExpr_listContext + FROM() antlr.TerminalNode + TO() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + + // IsPartitionboundspecContext differentiates from other interfaces. + IsPartitionboundspecContext() +} + +type PartitionboundspecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPartitionboundspecContext() *PartitionboundspecContext { + var p = new(PartitionboundspecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_partitionboundspec + return p +} + +func InitEmptyPartitionboundspecContext(p *PartitionboundspecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_partitionboundspec +} + +func (*PartitionboundspecContext) IsPartitionboundspecContext() {} + +func NewPartitionboundspecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PartitionboundspecContext { + var p = new(PartitionboundspecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_partitionboundspec + + return p +} + +func (s *PartitionboundspecContext) GetParser() antlr.Parser { return s.parser } + +func (s *PartitionboundspecContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *PartitionboundspecContext) VALUES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUES, 0) +} + +func (s *PartitionboundspecContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *PartitionboundspecContext) AllOPEN_PAREN() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserOPEN_PAREN) +} + +func (s *PartitionboundspecContext) OPEN_PAREN(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, i) +} + +func (s *PartitionboundspecContext) Hash_partbound() IHash_partboundContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHash_partboundContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHash_partboundContext) +} + +func (s *PartitionboundspecContext) AllCLOSE_PAREN() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCLOSE_PAREN) +} + +func (s *PartitionboundspecContext) CLOSE_PAREN(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, i) +} + +func (s *PartitionboundspecContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *PartitionboundspecContext) AllExpr_list() []IExpr_listContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IExpr_listContext); ok { + len++ + } + } + + tst := make([]IExpr_listContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IExpr_listContext); ok { + tst[i] = t.(IExpr_listContext) + i++ + } + } + + return tst +} + +func (s *PartitionboundspecContext) Expr_list(i int) IExpr_listContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *PartitionboundspecContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *PartitionboundspecContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *PartitionboundspecContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *PartitionboundspecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PartitionboundspecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PartitionboundspecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPartitionboundspec(s) + } +} + +func (s *PartitionboundspecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPartitionboundspec(s) + } +} + +func (s *PartitionboundspecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPartitionboundspec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Partitionboundspec() (localctx IPartitionboundspecContext) { + localctx = NewPartitionboundspecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 128, PostgreSQLParserRULE_partitionboundspec) + p.SetState(2627) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 94, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2601) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2602) + p.Match(PostgreSQLParserVALUES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2603) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2604) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2605) + p.Hash_partbound() + } + { + p.SetState(2606) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2608) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2609) + p.Match(PostgreSQLParserVALUES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2610) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2611) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2612) + p.Expr_list() + } + { + p.SetState(2613) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2615) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2616) + p.Match(PostgreSQLParserVALUES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2617) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2618) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2619) + p.Expr_list() + } + { + p.SetState(2620) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2621) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2622) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2623) + p.Expr_list() + } + { + p.SetState(2624) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2626) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IHash_partbound_elemContext is an interface to support dynamic dispatch. +type IHash_partbound_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Nonreservedword() INonreservedwordContext + Iconst() IIconstContext + + // IsHash_partbound_elemContext differentiates from other interfaces. + IsHash_partbound_elemContext() +} + +type Hash_partbound_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyHash_partbound_elemContext() *Hash_partbound_elemContext { + var p = new(Hash_partbound_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_hash_partbound_elem + return p +} + +func InitEmptyHash_partbound_elemContext(p *Hash_partbound_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_hash_partbound_elem +} + +func (*Hash_partbound_elemContext) IsHash_partbound_elemContext() {} + +func NewHash_partbound_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Hash_partbound_elemContext { + var p = new(Hash_partbound_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_hash_partbound_elem + + return p +} + +func (s *Hash_partbound_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Hash_partbound_elemContext) Nonreservedword() INonreservedwordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedwordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedwordContext) +} + +func (s *Hash_partbound_elemContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Hash_partbound_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Hash_partbound_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Hash_partbound_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterHash_partbound_elem(s) + } +} + +func (s *Hash_partbound_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitHash_partbound_elem(s) + } +} + +func (s *Hash_partbound_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitHash_partbound_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Hash_partbound_elem() (localctx IHash_partbound_elemContext) { + localctx = NewHash_partbound_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 130, PostgreSQLParserRULE_hash_partbound_elem) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2629) + p.Nonreservedword() + } + { + p.SetState(2630) + p.Iconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IHash_partboundContext is an interface to support dynamic dispatch. +type IHash_partboundContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllHash_partbound_elem() []IHash_partbound_elemContext + Hash_partbound_elem(i int) IHash_partbound_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsHash_partboundContext differentiates from other interfaces. + IsHash_partboundContext() +} + +type Hash_partboundContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyHash_partboundContext() *Hash_partboundContext { + var p = new(Hash_partboundContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_hash_partbound + return p +} + +func InitEmptyHash_partboundContext(p *Hash_partboundContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_hash_partbound +} + +func (*Hash_partboundContext) IsHash_partboundContext() {} + +func NewHash_partboundContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Hash_partboundContext { + var p = new(Hash_partboundContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_hash_partbound + + return p +} + +func (s *Hash_partboundContext) GetParser() antlr.Parser { return s.parser } + +func (s *Hash_partboundContext) AllHash_partbound_elem() []IHash_partbound_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IHash_partbound_elemContext); ok { + len++ + } + } + + tst := make([]IHash_partbound_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IHash_partbound_elemContext); ok { + tst[i] = t.(IHash_partbound_elemContext) + i++ + } + } + + return tst +} + +func (s *Hash_partboundContext) Hash_partbound_elem(i int) IHash_partbound_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHash_partbound_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IHash_partbound_elemContext) +} + +func (s *Hash_partboundContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Hash_partboundContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Hash_partboundContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Hash_partboundContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Hash_partboundContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterHash_partbound(s) + } +} + +func (s *Hash_partboundContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitHash_partbound(s) + } +} + +func (s *Hash_partboundContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitHash_partbound(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Hash_partbound() (localctx IHash_partboundContext) { + localctx = NewHash_partboundContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 132, PostgreSQLParserRULE_hash_partbound) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2632) + p.Hash_partbound_elem() + } + p.SetState(2637) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(2633) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2634) + p.Hash_partbound_elem() + } + + p.SetState(2639) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltercompositetypestmtContext is an interface to support dynamic dispatch. +type IAltercompositetypestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + Any_name() IAny_nameContext + Alter_type_cmds() IAlter_type_cmdsContext + + // IsAltercompositetypestmtContext differentiates from other interfaces. + IsAltercompositetypestmtContext() +} + +type AltercompositetypestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltercompositetypestmtContext() *AltercompositetypestmtContext { + var p = new(AltercompositetypestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altercompositetypestmt + return p +} + +func InitEmptyAltercompositetypestmtContext(p *AltercompositetypestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altercompositetypestmt +} + +func (*AltercompositetypestmtContext) IsAltercompositetypestmtContext() {} + +func NewAltercompositetypestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltercompositetypestmtContext { + var p = new(AltercompositetypestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altercompositetypestmt + + return p +} + +func (s *AltercompositetypestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltercompositetypestmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltercompositetypestmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *AltercompositetypestmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AltercompositetypestmtContext) Alter_type_cmds() IAlter_type_cmdsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_type_cmdsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_type_cmdsContext) +} + +func (s *AltercompositetypestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltercompositetypestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltercompositetypestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltercompositetypestmt(s) + } +} + +func (s *AltercompositetypestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltercompositetypestmt(s) + } +} + +func (s *AltercompositetypestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltercompositetypestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altercompositetypestmt() (localctx IAltercompositetypestmtContext) { + localctx = NewAltercompositetypestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 134, PostgreSQLParserRULE_altercompositetypestmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2640) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2641) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2642) + p.Any_name() + } + { + p.SetState(2643) + p.Alter_type_cmds() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_type_cmdsContext is an interface to support dynamic dispatch. +type IAlter_type_cmdsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAlter_type_cmd() []IAlter_type_cmdContext + Alter_type_cmd(i int) IAlter_type_cmdContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsAlter_type_cmdsContext differentiates from other interfaces. + IsAlter_type_cmdsContext() +} + +type Alter_type_cmdsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_type_cmdsContext() *Alter_type_cmdsContext { + var p = new(Alter_type_cmdsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_type_cmds + return p +} + +func InitEmptyAlter_type_cmdsContext(p *Alter_type_cmdsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_type_cmds +} + +func (*Alter_type_cmdsContext) IsAlter_type_cmdsContext() {} + +func NewAlter_type_cmdsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_type_cmdsContext { + var p = new(Alter_type_cmdsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_type_cmds + + return p +} + +func (s *Alter_type_cmdsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_type_cmdsContext) AllAlter_type_cmd() []IAlter_type_cmdContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAlter_type_cmdContext); ok { + len++ + } + } + + tst := make([]IAlter_type_cmdContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAlter_type_cmdContext); ok { + tst[i] = t.(IAlter_type_cmdContext) + i++ + } + } + + return tst +} + +func (s *Alter_type_cmdsContext) Alter_type_cmd(i int) IAlter_type_cmdContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_type_cmdContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAlter_type_cmdContext) +} + +func (s *Alter_type_cmdsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Alter_type_cmdsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Alter_type_cmdsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_type_cmdsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_type_cmdsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_type_cmds(s) + } +} + +func (s *Alter_type_cmdsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_type_cmds(s) + } +} + +func (s *Alter_type_cmdsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_type_cmds(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_type_cmds() (localctx IAlter_type_cmdsContext) { + localctx = NewAlter_type_cmdsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 136, PostgreSQLParserRULE_alter_type_cmds) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2645) + p.Alter_type_cmd() + } + p.SetState(2650) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(2646) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2647) + p.Alter_type_cmd() + } + + p.SetState(2652) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_type_cmdContext is an interface to support dynamic dispatch. +type IAlter_type_cmdContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ADD_P() antlr.TerminalNode + ATTRIBUTE() antlr.TerminalNode + Tablefuncelement() ITablefuncelementContext + Opt_drop_behavior() IOpt_drop_behaviorContext + DROP() antlr.TerminalNode + Colid() IColidContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + ALTER() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + Typename() ITypenameContext + Opt_set_data() IOpt_set_dataContext + Opt_collate_clause() IOpt_collate_clauseContext + + // IsAlter_type_cmdContext differentiates from other interfaces. + IsAlter_type_cmdContext() +} + +type Alter_type_cmdContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_type_cmdContext() *Alter_type_cmdContext { + var p = new(Alter_type_cmdContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_type_cmd + return p +} + +func InitEmptyAlter_type_cmdContext(p *Alter_type_cmdContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_type_cmd +} + +func (*Alter_type_cmdContext) IsAlter_type_cmdContext() {} + +func NewAlter_type_cmdContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_type_cmdContext { + var p = new(Alter_type_cmdContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_type_cmd + + return p +} + +func (s *Alter_type_cmdContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_type_cmdContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *Alter_type_cmdContext) ATTRIBUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATTRIBUTE, 0) +} + +func (s *Alter_type_cmdContext) Tablefuncelement() ITablefuncelementContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablefuncelementContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITablefuncelementContext) +} + +func (s *Alter_type_cmdContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *Alter_type_cmdContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *Alter_type_cmdContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Alter_type_cmdContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *Alter_type_cmdContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *Alter_type_cmdContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *Alter_type_cmdContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *Alter_type_cmdContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Alter_type_cmdContext) Opt_set_data() IOpt_set_dataContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_set_dataContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_set_dataContext) +} + +func (s *Alter_type_cmdContext) Opt_collate_clause() IOpt_collate_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_collate_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_collate_clauseContext) +} + +func (s *Alter_type_cmdContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_type_cmdContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_type_cmdContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_type_cmd(s) + } +} + +func (s *Alter_type_cmdContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_type_cmd(s) + } +} + +func (s *Alter_type_cmdContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_type_cmd(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_type_cmd() (localctx IAlter_type_cmdContext) { + localctx = NewAlter_type_cmdContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 138, PostgreSQLParserRULE_alter_type_cmd) + var _la int + + p.SetState(2683) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserADD_P: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2653) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2654) + p.Match(PostgreSQLParserATTRIBUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2655) + p.Tablefuncelement() + } + p.SetState(2657) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(2656) + p.Opt_drop_behavior() + } + + } + + case PostgreSQLParserDROP: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2659) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2660) + p.Match(PostgreSQLParserATTRIBUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2663) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 98, p.GetParserRuleContext()) == 1 { + { + p.SetState(2661) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2662) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2665) + p.Colid() + } + p.SetState(2667) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(2666) + p.Opt_drop_behavior() + } + + } + + case PostgreSQLParserALTER: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2669) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2670) + p.Match(PostgreSQLParserATTRIBUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2671) + p.Colid() + } + p.SetState(2673) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSET { + { + p.SetState(2672) + p.Opt_set_data() + } + + } + { + p.SetState(2675) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2676) + p.Typename() + } + p.SetState(2678) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOLLATE { + { + p.SetState(2677) + p.Opt_collate_clause() + } + + } + p.SetState(2681) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(2680) + p.Opt_drop_behavior() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICloseportalstmtContext is an interface to support dynamic dispatch. +type ICloseportalstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CLOSE() antlr.TerminalNode + Cursor_name() ICursor_nameContext + ALL() antlr.TerminalNode + + // IsCloseportalstmtContext differentiates from other interfaces. + IsCloseportalstmtContext() +} + +type CloseportalstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCloseportalstmtContext() *CloseportalstmtContext { + var p = new(CloseportalstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_closeportalstmt + return p +} + +func InitEmptyCloseportalstmtContext(p *CloseportalstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_closeportalstmt +} + +func (*CloseportalstmtContext) IsCloseportalstmtContext() {} + +func NewCloseportalstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CloseportalstmtContext { + var p = new(CloseportalstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_closeportalstmt + + return p +} + +func (s *CloseportalstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CloseportalstmtContext) CLOSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE, 0) +} + +func (s *CloseportalstmtContext) Cursor_name() ICursor_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_nameContext) +} + +func (s *CloseportalstmtContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *CloseportalstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CloseportalstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CloseportalstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCloseportalstmt(s) + } +} + +func (s *CloseportalstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCloseportalstmt(s) + } +} + +func (s *CloseportalstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCloseportalstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Closeportalstmt() (localctx ICloseportalstmtContext) { + localctx = NewCloseportalstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 140, PostgreSQLParserRULE_closeportalstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2685) + p.Match(PostgreSQLParserCLOSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2688) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(2686) + p.Cursor_name() + } + + case PostgreSQLParserALL: + { + p.SetState(2687) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopystmtContext is an interface to support dynamic dispatch. +type ICopystmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COPY() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Copy_from() ICopy_fromContext + Copy_file_name() ICopy_file_nameContext + Copy_options() ICopy_optionsContext + Opt_binary() IOpt_binaryContext + Opt_column_list() IOpt_column_listContext + Opt_program() IOpt_programContext + Copy_delimiter() ICopy_delimiterContext + Opt_with() IOpt_withContext + Where_clause() IWhere_clauseContext + OPEN_PAREN() antlr.TerminalNode + Preparablestmt() IPreparablestmtContext + CLOSE_PAREN() antlr.TerminalNode + TO() antlr.TerminalNode + + // IsCopystmtContext differentiates from other interfaces. + IsCopystmtContext() +} + +type CopystmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopystmtContext() *CopystmtContext { + var p = new(CopystmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copystmt + return p +} + +func InitEmptyCopystmtContext(p *CopystmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copystmt +} + +func (*CopystmtContext) IsCopystmtContext() {} + +func NewCopystmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CopystmtContext { + var p = new(CopystmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copystmt + + return p +} + +func (s *CopystmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CopystmtContext) COPY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOPY, 0) +} + +func (s *CopystmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *CopystmtContext) Copy_from() ICopy_fromContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_fromContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopy_fromContext) +} + +func (s *CopystmtContext) Copy_file_name() ICopy_file_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_file_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopy_file_nameContext) +} + +func (s *CopystmtContext) Copy_options() ICopy_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopy_optionsContext) +} + +func (s *CopystmtContext) Opt_binary() IOpt_binaryContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_binaryContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_binaryContext) +} + +func (s *CopystmtContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *CopystmtContext) Opt_program() IOpt_programContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_programContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_programContext) +} + +func (s *CopystmtContext) Copy_delimiter() ICopy_delimiterContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_delimiterContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopy_delimiterContext) +} + +func (s *CopystmtContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *CopystmtContext) Where_clause() IWhere_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_clauseContext) +} + +func (s *CopystmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CopystmtContext) Preparablestmt() IPreparablestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPreparablestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPreparablestmtContext) +} + +func (s *CopystmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CopystmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *CopystmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CopystmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CopystmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopystmt(s) + } +} + +func (s *CopystmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopystmt(s) + } +} + +func (s *CopystmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopystmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copystmt() (localctx ICopystmtContext) { + localctx = NewCopystmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 142, PostgreSQLParserRULE_copystmt) + var _la int + + p.SetState(2727) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 113, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2690) + p.Match(PostgreSQLParserCOPY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2692) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserBINARY { + { + p.SetState(2691) + p.Opt_binary() + } + + } + { + p.SetState(2694) + p.Qualified_name() + } + p.SetState(2696) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(2695) + p.Opt_column_list() + } + + } + { + p.SetState(2698) + p.Copy_from() + } + p.SetState(2700) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPROGRAM { + { + p.SetState(2699) + p.Opt_program() + } + + } + { + p.SetState(2702) + p.Copy_file_name() + } + p.SetState(2704) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING || _la == PostgreSQLParserDELIMITERS { + { + p.SetState(2703) + p.Copy_delimiter() + } + + } + p.SetState(2707) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 109, p.GetParserRuleContext()) == 1 { + { + p.SetState(2706) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2709) + p.Copy_options() + } + p.SetState(2711) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(2710) + p.Where_clause() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2713) + p.Match(PostgreSQLParserCOPY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2714) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2715) + p.Preparablestmt() + } + { + p.SetState(2716) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2717) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2719) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPROGRAM { + { + p.SetState(2718) + p.Opt_program() + } + + } + { + p.SetState(2721) + p.Copy_file_name() + } + p.SetState(2723) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 112, p.GetParserRuleContext()) == 1 { + { + p.SetState(2722) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2725) + p.Copy_options() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_fromContext is an interface to support dynamic dispatch. +type ICopy_fromContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FROM() antlr.TerminalNode + TO() antlr.TerminalNode + + // IsCopy_fromContext differentiates from other interfaces. + IsCopy_fromContext() +} + +type Copy_fromContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_fromContext() *Copy_fromContext { + var p = new(Copy_fromContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_from + return p +} + +func InitEmptyCopy_fromContext(p *Copy_fromContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_from +} + +func (*Copy_fromContext) IsCopy_fromContext() {} + +func NewCopy_fromContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_fromContext { + var p = new(Copy_fromContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_from + + return p +} + +func (s *Copy_fromContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_fromContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Copy_fromContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Copy_fromContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_fromContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_fromContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_from(s) + } +} + +func (s *Copy_fromContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_from(s) + } +} + +func (s *Copy_fromContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_from(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_from() (localctx ICopy_fromContext) { + localctx = NewCopy_fromContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 144, PostgreSQLParserRULE_copy_from) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2729) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFROM || _la == PostgreSQLParserTO) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_programContext is an interface to support dynamic dispatch. +type IOpt_programContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PROGRAM() antlr.TerminalNode + + // IsOpt_programContext differentiates from other interfaces. + IsOpt_programContext() +} + +type Opt_programContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_programContext() *Opt_programContext { + var p = new(Opt_programContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_program + return p +} + +func InitEmptyOpt_programContext(p *Opt_programContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_program +} + +func (*Opt_programContext) IsOpt_programContext() {} + +func NewOpt_programContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_programContext { + var p = new(Opt_programContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_program + + return p +} + +func (s *Opt_programContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_programContext) PROGRAM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROGRAM, 0) +} + +func (s *Opt_programContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_programContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_programContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_program(s) + } +} + +func (s *Opt_programContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_program(s) + } +} + +func (s *Opt_programContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_program(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_program() (localctx IOpt_programContext) { + localctx = NewOpt_programContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 146, PostgreSQLParserRULE_opt_program) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2731) + p.Match(PostgreSQLParserPROGRAM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_file_nameContext is an interface to support dynamic dispatch. +type ICopy_file_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + STDIN() antlr.TerminalNode + STDOUT() antlr.TerminalNode + + // IsCopy_file_nameContext differentiates from other interfaces. + IsCopy_file_nameContext() +} + +type Copy_file_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_file_nameContext() *Copy_file_nameContext { + var p = new(Copy_file_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_file_name + return p +} + +func InitEmptyCopy_file_nameContext(p *Copy_file_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_file_name +} + +func (*Copy_file_nameContext) IsCopy_file_nameContext() {} + +func NewCopy_file_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_file_nameContext { + var p = new(Copy_file_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_file_name + + return p +} + +func (s *Copy_file_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_file_nameContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Copy_file_nameContext) STDIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTDIN, 0) +} + +func (s *Copy_file_nameContext) STDOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTDOUT, 0) +} + +func (s *Copy_file_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_file_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_file_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_file_name(s) + } +} + +func (s *Copy_file_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_file_name(s) + } +} + +func (s *Copy_file_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_file_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_file_name() (localctx ICopy_file_nameContext) { + localctx = NewCopy_file_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 148, PostgreSQLParserRULE_copy_file_name) + p.SetState(2736) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2733) + p.Sconst() + } + + case PostgreSQLParserSTDIN: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2734) + p.Match(PostgreSQLParserSTDIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSTDOUT: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2735) + p.Match(PostgreSQLParserSTDOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_optionsContext is an interface to support dynamic dispatch. +type ICopy_optionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Copy_opt_list() ICopy_opt_listContext + OPEN_PAREN() antlr.TerminalNode + Copy_generic_opt_list() ICopy_generic_opt_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsCopy_optionsContext differentiates from other interfaces. + IsCopy_optionsContext() +} + +type Copy_optionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_optionsContext() *Copy_optionsContext { + var p = new(Copy_optionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_options + return p +} + +func InitEmptyCopy_optionsContext(p *Copy_optionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_options +} + +func (*Copy_optionsContext) IsCopy_optionsContext() {} + +func NewCopy_optionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_optionsContext { + var p = new(Copy_optionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_options + + return p +} + +func (s *Copy_optionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_optionsContext) Copy_opt_list() ICopy_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopy_opt_listContext) +} + +func (s *Copy_optionsContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Copy_optionsContext) Copy_generic_opt_list() ICopy_generic_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_generic_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopy_generic_opt_listContext) +} + +func (s *Copy_optionsContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Copy_optionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_optionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_optionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_options(s) + } +} + +func (s *Copy_optionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_options(s) + } +} + +func (s *Copy_optionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_options(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_options() (localctx ICopy_optionsContext) { + localctx = NewCopy_optionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 150, PostgreSQLParserRULE_copy_options) + p.SetState(2743) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 115, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2738) + p.Copy_opt_list() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2739) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2740) + p.Copy_generic_opt_list() + } + { + p.SetState(2741) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_opt_listContext is an interface to support dynamic dispatch. +type ICopy_opt_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCopy_opt_item() []ICopy_opt_itemContext + Copy_opt_item(i int) ICopy_opt_itemContext + + // IsCopy_opt_listContext differentiates from other interfaces. + IsCopy_opt_listContext() +} + +type Copy_opt_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_opt_listContext() *Copy_opt_listContext { + var p = new(Copy_opt_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_opt_list + return p +} + +func InitEmptyCopy_opt_listContext(p *Copy_opt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_opt_list +} + +func (*Copy_opt_listContext) IsCopy_opt_listContext() {} + +func NewCopy_opt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_opt_listContext { + var p = new(Copy_opt_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_opt_list + + return p +} + +func (s *Copy_opt_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_opt_listContext) AllCopy_opt_item() []ICopy_opt_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICopy_opt_itemContext); ok { + len++ + } + } + + tst := make([]ICopy_opt_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICopy_opt_itemContext); ok { + tst[i] = t.(ICopy_opt_itemContext) + i++ + } + } + + return tst +} + +func (s *Copy_opt_listContext) Copy_opt_item(i int) ICopy_opt_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_opt_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICopy_opt_itemContext) +} + +func (s *Copy_opt_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_opt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_opt_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_opt_list(s) + } +} + +func (s *Copy_opt_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_opt_list(s) + } +} + +func (s *Copy_opt_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_opt_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_opt_list() (localctx ICopy_opt_listContext) { + localctx = NewCopy_opt_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 152, PostgreSQLParserRULE_copy_opt_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(2748) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ((int64((_la-78)) & ^0x3f) == 0 && ((int64(1)<<(_la-78))&17716740097) != 0) || ((int64((_la-171)) & ^0x3f) == 0 && ((int64(1)<<(_la-171))&35459325497345) != 0) || _la == PostgreSQLParserQUOTE { + { + p.SetState(2745) + p.Copy_opt_item() + } + + p.SetState(2750) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_opt_itemContext is an interface to support dynamic dispatch. +type ICopy_opt_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BINARY() antlr.TerminalNode + FREEZE() antlr.TerminalNode + DELIMITER() antlr.TerminalNode + Sconst() ISconstContext + Opt_as() IOpt_asContext + NULL_P() antlr.TerminalNode + CSV() antlr.TerminalNode + HEADER_P() antlr.TerminalNode + QUOTE() antlr.TerminalNode + ESCAPE() antlr.TerminalNode + FORCE() antlr.TerminalNode + Columnlist() IColumnlistContext + STAR() antlr.TerminalNode + NOT() antlr.TerminalNode + ENCODING() antlr.TerminalNode + + // IsCopy_opt_itemContext differentiates from other interfaces. + IsCopy_opt_itemContext() +} + +type Copy_opt_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_opt_itemContext() *Copy_opt_itemContext { + var p = new(Copy_opt_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_opt_item + return p +} + +func InitEmptyCopy_opt_itemContext(p *Copy_opt_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_opt_item +} + +func (*Copy_opt_itemContext) IsCopy_opt_itemContext() {} + +func NewCopy_opt_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_opt_itemContext { + var p = new(Copy_opt_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_opt_item + + return p +} + +func (s *Copy_opt_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_opt_itemContext) BINARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBINARY, 0) +} + +func (s *Copy_opt_itemContext) FREEZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFREEZE, 0) +} + +func (s *Copy_opt_itemContext) DELIMITER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELIMITER, 0) +} + +func (s *Copy_opt_itemContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Copy_opt_itemContext) Opt_as() IOpt_asContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_asContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_asContext) +} + +func (s *Copy_opt_itemContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Copy_opt_itemContext) CSV() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCSV, 0) +} + +func (s *Copy_opt_itemContext) HEADER_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHEADER_P, 0) +} + +func (s *Copy_opt_itemContext) QUOTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserQUOTE, 0) +} + +func (s *Copy_opt_itemContext) ESCAPE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserESCAPE, 0) +} + +func (s *Copy_opt_itemContext) FORCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORCE, 0) +} + +func (s *Copy_opt_itemContext) Columnlist() IColumnlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnlistContext) +} + +func (s *Copy_opt_itemContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *Copy_opt_itemContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Copy_opt_itemContext) ENCODING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENCODING, 0) +} + +func (s *Copy_opt_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_opt_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_opt_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_opt_item(s) + } +} + +func (s *Copy_opt_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_opt_item(s) + } +} + +func (s *Copy_opt_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_opt_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_opt_item() (localctx ICopy_opt_itemContext) { + localctx = NewCopy_opt_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 154, PostgreSQLParserRULE_copy_opt_item) + var _la int + + p.SetState(2790) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 121, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2751) + p.Match(PostgreSQLParserBINARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2752) + p.Match(PostgreSQLParserFREEZE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2753) + p.Match(PostgreSQLParserDELIMITER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2755) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(2754) + p.Opt_as() + } + + } + { + p.SetState(2757) + p.Sconst() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2758) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2760) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(2759) + p.Opt_as() + } + + } + { + p.SetState(2762) + p.Sconst() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(2763) + p.Match(PostgreSQLParserCSV) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(2764) + p.Match(PostgreSQLParserHEADER_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(2765) + p.Match(PostgreSQLParserQUOTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2767) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(2766) + p.Opt_as() + } + + } + { + p.SetState(2769) + p.Sconst() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(2770) + p.Match(PostgreSQLParserESCAPE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2772) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(2771) + p.Opt_as() + } + + } + { + p.SetState(2774) + p.Sconst() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(2775) + p.Match(PostgreSQLParserFORCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2776) + p.Match(PostgreSQLParserQUOTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2777) + p.Columnlist() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(2778) + p.Match(PostgreSQLParserFORCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2779) + p.Match(PostgreSQLParserQUOTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2780) + p.Match(PostgreSQLParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(2781) + p.Match(PostgreSQLParserFORCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2782) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2783) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2784) + p.Columnlist() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(2785) + p.Match(PostgreSQLParserFORCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2786) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2787) + p.Columnlist() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(2788) + p.Match(PostgreSQLParserENCODING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2789) + p.Sconst() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_binaryContext is an interface to support dynamic dispatch. +type IOpt_binaryContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BINARY() antlr.TerminalNode + + // IsOpt_binaryContext differentiates from other interfaces. + IsOpt_binaryContext() +} + +type Opt_binaryContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_binaryContext() *Opt_binaryContext { + var p = new(Opt_binaryContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_binary + return p +} + +func InitEmptyOpt_binaryContext(p *Opt_binaryContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_binary +} + +func (*Opt_binaryContext) IsOpt_binaryContext() {} + +func NewOpt_binaryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_binaryContext { + var p = new(Opt_binaryContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_binary + + return p +} + +func (s *Opt_binaryContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_binaryContext) BINARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBINARY, 0) +} + +func (s *Opt_binaryContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_binaryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_binaryContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_binary(s) + } +} + +func (s *Opt_binaryContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_binary(s) + } +} + +func (s *Opt_binaryContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_binary(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_binary() (localctx IOpt_binaryContext) { + localctx = NewOpt_binaryContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 156, PostgreSQLParserRULE_opt_binary) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2792) + p.Match(PostgreSQLParserBINARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_delimiterContext is an interface to support dynamic dispatch. +type ICopy_delimiterContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DELIMITERS() antlr.TerminalNode + Sconst() ISconstContext + Opt_using() IOpt_usingContext + + // IsCopy_delimiterContext differentiates from other interfaces. + IsCopy_delimiterContext() +} + +type Copy_delimiterContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_delimiterContext() *Copy_delimiterContext { + var p = new(Copy_delimiterContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_delimiter + return p +} + +func InitEmptyCopy_delimiterContext(p *Copy_delimiterContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_delimiter +} + +func (*Copy_delimiterContext) IsCopy_delimiterContext() {} + +func NewCopy_delimiterContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_delimiterContext { + var p = new(Copy_delimiterContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_delimiter + + return p +} + +func (s *Copy_delimiterContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_delimiterContext) DELIMITERS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELIMITERS, 0) +} + +func (s *Copy_delimiterContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Copy_delimiterContext) Opt_using() IOpt_usingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_usingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_usingContext) +} + +func (s *Copy_delimiterContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_delimiterContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_delimiterContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_delimiter(s) + } +} + +func (s *Copy_delimiterContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_delimiter(s) + } +} + +func (s *Copy_delimiterContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_delimiter(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_delimiter() (localctx ICopy_delimiterContext) { + localctx = NewCopy_delimiterContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 158, PostgreSQLParserRULE_copy_delimiter) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(2795) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(2794) + p.Opt_using() + } + + } + { + p.SetState(2797) + p.Match(PostgreSQLParserDELIMITERS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2798) + p.Sconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_usingContext is an interface to support dynamic dispatch. +type IOpt_usingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + + // IsOpt_usingContext differentiates from other interfaces. + IsOpt_usingContext() +} + +type Opt_usingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_usingContext() *Opt_usingContext { + var p = new(Opt_usingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_using + return p +} + +func InitEmptyOpt_usingContext(p *Opt_usingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_using +} + +func (*Opt_usingContext) IsOpt_usingContext() {} + +func NewOpt_usingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_usingContext { + var p = new(Opt_usingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_using + + return p +} + +func (s *Opt_usingContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_usingContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Opt_usingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_usingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_usingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_using(s) + } +} + +func (s *Opt_usingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_using(s) + } +} + +func (s *Opt_usingContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_using(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_using() (localctx IOpt_usingContext) { + localctx = NewOpt_usingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 160, PostgreSQLParserRULE_opt_using) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2800) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_generic_opt_listContext is an interface to support dynamic dispatch. +type ICopy_generic_opt_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCopy_generic_opt_elem() []ICopy_generic_opt_elemContext + Copy_generic_opt_elem(i int) ICopy_generic_opt_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsCopy_generic_opt_listContext differentiates from other interfaces. + IsCopy_generic_opt_listContext() +} + +type Copy_generic_opt_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_generic_opt_listContext() *Copy_generic_opt_listContext { + var p = new(Copy_generic_opt_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_list + return p +} + +func InitEmptyCopy_generic_opt_listContext(p *Copy_generic_opt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_list +} + +func (*Copy_generic_opt_listContext) IsCopy_generic_opt_listContext() {} + +func NewCopy_generic_opt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_generic_opt_listContext { + var p = new(Copy_generic_opt_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_list + + return p +} + +func (s *Copy_generic_opt_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_generic_opt_listContext) AllCopy_generic_opt_elem() []ICopy_generic_opt_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICopy_generic_opt_elemContext); ok { + len++ + } + } + + tst := make([]ICopy_generic_opt_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICopy_generic_opt_elemContext); ok { + tst[i] = t.(ICopy_generic_opt_elemContext) + i++ + } + } + + return tst +} + +func (s *Copy_generic_opt_listContext) Copy_generic_opt_elem(i int) ICopy_generic_opt_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_generic_opt_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICopy_generic_opt_elemContext) +} + +func (s *Copy_generic_opt_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Copy_generic_opt_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Copy_generic_opt_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_generic_opt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_generic_opt_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_generic_opt_list(s) + } +} + +func (s *Copy_generic_opt_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_generic_opt_list(s) + } +} + +func (s *Copy_generic_opt_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_generic_opt_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_generic_opt_list() (localctx ICopy_generic_opt_listContext) { + localctx = NewCopy_generic_opt_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 162, PostgreSQLParserRULE_copy_generic_opt_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2802) + p.Copy_generic_opt_elem() + } + p.SetState(2807) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(2803) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2804) + p.Copy_generic_opt_elem() + } + + p.SetState(2809) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_generic_opt_elemContext is an interface to support dynamic dispatch. +type ICopy_generic_opt_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Collabel() ICollabelContext + Copy_generic_opt_arg() ICopy_generic_opt_argContext + + // IsCopy_generic_opt_elemContext differentiates from other interfaces. + IsCopy_generic_opt_elemContext() +} + +type Copy_generic_opt_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_generic_opt_elemContext() *Copy_generic_opt_elemContext { + var p = new(Copy_generic_opt_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_elem + return p +} + +func InitEmptyCopy_generic_opt_elemContext(p *Copy_generic_opt_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_elem +} + +func (*Copy_generic_opt_elemContext) IsCopy_generic_opt_elemContext() {} + +func NewCopy_generic_opt_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_generic_opt_elemContext { + var p = new(Copy_generic_opt_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_elem + + return p +} + +func (s *Copy_generic_opt_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_generic_opt_elemContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Copy_generic_opt_elemContext) Copy_generic_opt_arg() ICopy_generic_opt_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_generic_opt_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopy_generic_opt_argContext) +} + +func (s *Copy_generic_opt_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_generic_opt_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_generic_opt_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_generic_opt_elem(s) + } +} + +func (s *Copy_generic_opt_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_generic_opt_elem(s) + } +} + +func (s *Copy_generic_opt_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_generic_opt_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_generic_opt_elem() (localctx ICopy_generic_opt_elemContext) { + localctx = NewCopy_generic_opt_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 164, PostgreSQLParserRULE_copy_generic_opt_elem) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2810) + p.Collabel() + } + p.SetState(2812) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3611948516751979012) != 0) || ((int64((_la-80)) & ^0x3f) == 0 && ((int64(1)<<(_la-80))&-70918567030783) != 0) || ((int64((_la-144)) & ^0x3f) == 0 && ((int64(1)<<(_la-144))&-1) != 0) || ((int64((_la-208)) & ^0x3f) == 0 && ((int64(1)<<(_la-208))&-39582418599937) != 0) || ((int64((_la-272)) & ^0x3f) == 0 && ((int64(1)<<(_la-272))&-1) != 0) || ((int64((_la-336)) & ^0x3f) == 0 && ((int64(1)<<(_la-336))&-1) != 0) || ((int64((_la-400)) & ^0x3f) == 0 && ((int64(1)<<(_la-400))&-72057594037927937) != 0) || ((int64((_la-464)) & ^0x3f) == 0 && ((int64(1)<<(_la-464))&-144126183192133633) != 0) || ((int64((_la-528)) & ^0x3f) == 0 && ((int64(1)<<(_la-528))&-1) != 0) || ((int64((_la-592)) & ^0x3f) == 0 && ((int64(1)<<(_la-592))&5843490885257396223) != 0) || ((int64((_la-656)) & ^0x3f) == 0 && ((int64(1)<<(_la-656))&4209153) != 0) { + { + p.SetState(2811) + p.Copy_generic_opt_arg() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_generic_opt_argContext is an interface to support dynamic dispatch. +type ICopy_generic_opt_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Opt_boolean_or_string() IOpt_boolean_or_stringContext + Numericonly() INumericonlyContext + STAR() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Copy_generic_opt_arg_list() ICopy_generic_opt_arg_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsCopy_generic_opt_argContext differentiates from other interfaces. + IsCopy_generic_opt_argContext() +} + +type Copy_generic_opt_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_generic_opt_argContext() *Copy_generic_opt_argContext { + var p = new(Copy_generic_opt_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg + return p +} + +func InitEmptyCopy_generic_opt_argContext(p *Copy_generic_opt_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg +} + +func (*Copy_generic_opt_argContext) IsCopy_generic_opt_argContext() {} + +func NewCopy_generic_opt_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_generic_opt_argContext { + var p = new(Copy_generic_opt_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg + + return p +} + +func (s *Copy_generic_opt_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_generic_opt_argContext) Opt_boolean_or_string() IOpt_boolean_or_stringContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_boolean_or_stringContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_boolean_or_stringContext) +} + +func (s *Copy_generic_opt_argContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Copy_generic_opt_argContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *Copy_generic_opt_argContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Copy_generic_opt_argContext) Copy_generic_opt_arg_list() ICopy_generic_opt_arg_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_generic_opt_arg_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICopy_generic_opt_arg_listContext) +} + +func (s *Copy_generic_opt_argContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Copy_generic_opt_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_generic_opt_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_generic_opt_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_generic_opt_arg(s) + } +} + +func (s *Copy_generic_opt_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_generic_opt_arg(s) + } +} + +func (s *Copy_generic_opt_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_generic_opt_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_generic_opt_arg() (localctx ICopy_generic_opt_argContext) { + localctx = NewCopy_generic_opt_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 166, PostgreSQLParserRULE_copy_generic_opt_arg) + p.SetState(2821) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserON, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2814) + p.Opt_boolean_or_string() + } + + case PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserIntegral, PostgreSQLParserNumeric: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2815) + p.Numericonly() + } + + case PostgreSQLParserSTAR: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2816) + p.Match(PostgreSQLParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserOPEN_PAREN: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2817) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2818) + p.Copy_generic_opt_arg_list() + } + { + p.SetState(2819) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_generic_opt_arg_listContext is an interface to support dynamic dispatch. +type ICopy_generic_opt_arg_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCopy_generic_opt_arg_list_item() []ICopy_generic_opt_arg_list_itemContext + Copy_generic_opt_arg_list_item(i int) ICopy_generic_opt_arg_list_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsCopy_generic_opt_arg_listContext differentiates from other interfaces. + IsCopy_generic_opt_arg_listContext() +} + +type Copy_generic_opt_arg_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_generic_opt_arg_listContext() *Copy_generic_opt_arg_listContext { + var p = new(Copy_generic_opt_arg_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg_list + return p +} + +func InitEmptyCopy_generic_opt_arg_listContext(p *Copy_generic_opt_arg_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg_list +} + +func (*Copy_generic_opt_arg_listContext) IsCopy_generic_opt_arg_listContext() {} + +func NewCopy_generic_opt_arg_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_generic_opt_arg_listContext { + var p = new(Copy_generic_opt_arg_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg_list + + return p +} + +func (s *Copy_generic_opt_arg_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_generic_opt_arg_listContext) AllCopy_generic_opt_arg_list_item() []ICopy_generic_opt_arg_list_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICopy_generic_opt_arg_list_itemContext); ok { + len++ + } + } + + tst := make([]ICopy_generic_opt_arg_list_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICopy_generic_opt_arg_list_itemContext); ok { + tst[i] = t.(ICopy_generic_opt_arg_list_itemContext) + i++ + } + } + + return tst +} + +func (s *Copy_generic_opt_arg_listContext) Copy_generic_opt_arg_list_item(i int) ICopy_generic_opt_arg_list_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICopy_generic_opt_arg_list_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICopy_generic_opt_arg_list_itemContext) +} + +func (s *Copy_generic_opt_arg_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Copy_generic_opt_arg_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Copy_generic_opt_arg_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_generic_opt_arg_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_generic_opt_arg_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_generic_opt_arg_list(s) + } +} + +func (s *Copy_generic_opt_arg_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_generic_opt_arg_list(s) + } +} + +func (s *Copy_generic_opt_arg_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_generic_opt_arg_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_generic_opt_arg_list() (localctx ICopy_generic_opt_arg_listContext) { + localctx = NewCopy_generic_opt_arg_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 168, PostgreSQLParserRULE_copy_generic_opt_arg_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2823) + p.Copy_generic_opt_arg_list_item() + } + p.SetState(2828) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(2824) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2825) + p.Copy_generic_opt_arg_list_item() + } + + p.SetState(2830) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICopy_generic_opt_arg_list_itemContext is an interface to support dynamic dispatch. +type ICopy_generic_opt_arg_list_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Opt_boolean_or_string() IOpt_boolean_or_stringContext + + // IsCopy_generic_opt_arg_list_itemContext differentiates from other interfaces. + IsCopy_generic_opt_arg_list_itemContext() +} + +type Copy_generic_opt_arg_list_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCopy_generic_opt_arg_list_itemContext() *Copy_generic_opt_arg_list_itemContext { + var p = new(Copy_generic_opt_arg_list_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg_list_item + return p +} + +func InitEmptyCopy_generic_opt_arg_list_itemContext(p *Copy_generic_opt_arg_list_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg_list_item +} + +func (*Copy_generic_opt_arg_list_itemContext) IsCopy_generic_opt_arg_list_itemContext() {} + +func NewCopy_generic_opt_arg_list_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Copy_generic_opt_arg_list_itemContext { + var p = new(Copy_generic_opt_arg_list_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_copy_generic_opt_arg_list_item + + return p +} + +func (s *Copy_generic_opt_arg_list_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Copy_generic_opt_arg_list_itemContext) Opt_boolean_or_string() IOpt_boolean_or_stringContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_boolean_or_stringContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_boolean_or_stringContext) +} + +func (s *Copy_generic_opt_arg_list_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Copy_generic_opt_arg_list_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Copy_generic_opt_arg_list_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCopy_generic_opt_arg_list_item(s) + } +} + +func (s *Copy_generic_opt_arg_list_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCopy_generic_opt_arg_list_item(s) + } +} + +func (s *Copy_generic_opt_arg_list_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCopy_generic_opt_arg_list_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Copy_generic_opt_arg_list_item() (localctx ICopy_generic_opt_arg_list_itemContext) { + localctx = NewCopy_generic_opt_arg_list_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 170, PostgreSQLParserRULE_copy_generic_opt_arg_list_item) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2831) + p.Opt_boolean_or_string() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatestmtContext is an interface to support dynamic dispatch. +type ICreatestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + TABLE() antlr.TerminalNode + AllQualified_name() []IQualified_nameContext + Qualified_name(i int) IQualified_nameContext + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + OF() antlr.TerminalNode + Any_name() IAny_nameContext + PARTITION() antlr.TerminalNode + Partitionboundspec() IPartitionboundspecContext + Opttemp() IOpttempContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Opttableelementlist() IOpttableelementlistContext + Optinherit() IOptinheritContext + Optpartitionspec() IOptpartitionspecContext + Table_access_method_clause() ITable_access_method_clauseContext + Optwith() IOptwithContext + Oncommitoption() IOncommitoptionContext + Opttablespace() IOpttablespaceContext + Opttypedtableelementlist() IOpttypedtableelementlistContext + + // IsCreatestmtContext differentiates from other interfaces. + IsCreatestmtContext() +} + +type CreatestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatestmtContext() *CreatestmtContext { + var p = new(CreatestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createstmt + return p +} + +func InitEmptyCreatestmtContext(p *CreatestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createstmt +} + +func (*CreatestmtContext) IsCreatestmtContext() {} + +func NewCreatestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatestmtContext { + var p = new(CreatestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createstmt + + return p +} + +func (s *CreatestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatestmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatestmtContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *CreatestmtContext) AllQualified_name() []IQualified_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IQualified_nameContext); ok { + len++ + } + } + + tst := make([]IQualified_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IQualified_nameContext); ok { + tst[i] = t.(IQualified_nameContext) + i++ + } + } + + return tst +} + +func (s *CreatestmtContext) Qualified_name(i int) IQualified_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *CreatestmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CreatestmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CreatestmtContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *CreatestmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *CreatestmtContext) PARTITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTITION, 0) +} + +func (s *CreatestmtContext) Partitionboundspec() IPartitionboundspecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPartitionboundspecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPartitionboundspecContext) +} + +func (s *CreatestmtContext) Opttemp() IOpttempContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttempContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttempContext) +} + +func (s *CreatestmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreatestmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreatestmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreatestmtContext) Opttableelementlist() IOpttableelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttableelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttableelementlistContext) +} + +func (s *CreatestmtContext) Optinherit() IOptinheritContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptinheritContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptinheritContext) +} + +func (s *CreatestmtContext) Optpartitionspec() IOptpartitionspecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptpartitionspecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptpartitionspecContext) +} + +func (s *CreatestmtContext) Table_access_method_clause() ITable_access_method_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_access_method_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITable_access_method_clauseContext) +} + +func (s *CreatestmtContext) Optwith() IOptwithContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptwithContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptwithContext) +} + +func (s *CreatestmtContext) Oncommitoption() IOncommitoptionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOncommitoptionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOncommitoptionContext) +} + +func (s *CreatestmtContext) Opttablespace() IOpttablespaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttablespaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttablespaceContext) +} + +func (s *CreatestmtContext) Opttypedtableelementlist() IOpttypedtableelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttypedtableelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttypedtableelementlistContext) +} + +func (s *CreatestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatestmt(s) + } +} + +func (s *CreatestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatestmt(s) + } +} + +func (s *CreatestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createstmt() (localctx ICreatestmtContext) { + localctx = NewCreatestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 172, PostgreSQLParserRULE_createstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2833) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2835) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGLOBAL || _la == PostgreSQLParserLOCAL || ((int64((_la-345)) & ^0x3f) == 0 && ((int64(1)<<(_la-345))&32773) != 0) { + { + p.SetState(2834) + p.Opttemp() + } + + } + { + p.SetState(2837) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2841) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 128, p.GetParserRuleContext()) == 1 { + { + p.SetState(2838) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2839) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2840) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2843) + p.Qualified_name() + } + p.SetState(2909) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(2844) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2846) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 129, p.GetParserRuleContext()) == 1 { + { + p.SetState(2845) + p.Opttableelementlist() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2848) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(2850) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINHERITS { + { + p.SetState(2849) + p.Optinherit() + } + + } + p.SetState(2853) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPARTITION { + { + p.SetState(2852) + p.Optpartitionspec() + } + + } + p.SetState(2856) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(2855) + p.Table_access_method_clause() + } + + } + p.SetState(2859) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 133, p.GetParserRuleContext()) == 1 { + { + p.SetState(2858) + p.Optwith() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(2862) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserON { + { + p.SetState(2861) + p.Oncommitoption() + } + + } + p.SetState(2865) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTABLESPACE { + { + p.SetState(2864) + p.Opttablespace() + } + + } + + case PostgreSQLParserOF: + { + p.SetState(2867) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2868) + p.Any_name() + } + p.SetState(2870) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 136, p.GetParserRuleContext()) == 1 { + { + p.SetState(2869) + p.Opttypedtableelementlist() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(2873) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPARTITION { + { + p.SetState(2872) + p.Optpartitionspec() + } + + } + p.SetState(2876) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(2875) + p.Table_access_method_clause() + } + + } + p.SetState(2879) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 139, p.GetParserRuleContext()) == 1 { + { + p.SetState(2878) + p.Optwith() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(2882) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserON { + { + p.SetState(2881) + p.Oncommitoption() + } + + } + p.SetState(2885) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTABLESPACE { + { + p.SetState(2884) + p.Opttablespace() + } + + } + + case PostgreSQLParserPARTITION: + { + p.SetState(2887) + p.Match(PostgreSQLParserPARTITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2888) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2889) + p.Qualified_name() + } + p.SetState(2891) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(2890) + p.Opttypedtableelementlist() + } + + } + { + p.SetState(2893) + p.Partitionboundspec() + } + p.SetState(2895) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPARTITION { + { + p.SetState(2894) + p.Optpartitionspec() + } + + } + p.SetState(2898) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(2897) + p.Table_access_method_clause() + } + + } + p.SetState(2901) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 145, p.GetParserRuleContext()) == 1 { + { + p.SetState(2900) + p.Optwith() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(2904) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserON { + { + p.SetState(2903) + p.Oncommitoption() + } + + } + p.SetState(2907) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTABLESPACE { + { + p.SetState(2906) + p.Opttablespace() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpttempContext is an interface to support dynamic dispatch. +type IOpttempContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TEMPORARY() antlr.TerminalNode + TEMP() antlr.TerminalNode + LOCAL() antlr.TerminalNode + GLOBAL() antlr.TerminalNode + UNLOGGED() antlr.TerminalNode + + // IsOpttempContext differentiates from other interfaces. + IsOpttempContext() +} + +type OpttempContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpttempContext() *OpttempContext { + var p = new(OpttempContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttemp + return p +} + +func InitEmptyOpttempContext(p *OpttempContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttemp +} + +func (*OpttempContext) IsOpttempContext() {} + +func NewOpttempContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OpttempContext { + var p = new(OpttempContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opttemp + + return p +} + +func (s *OpttempContext) GetParser() antlr.Parser { return s.parser } + +func (s *OpttempContext) TEMPORARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPORARY, 0) +} + +func (s *OpttempContext) TEMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMP, 0) +} + +func (s *OpttempContext) LOCAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCAL, 0) +} + +func (s *OpttempContext) GLOBAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGLOBAL, 0) +} + +func (s *OpttempContext) UNLOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNLOGGED, 0) +} + +func (s *OpttempContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OpttempContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OpttempContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpttemp(s) + } +} + +func (s *OpttempContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpttemp(s) + } +} + +func (s *OpttempContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpttemp(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opttemp() (localctx IOpttempContext) { + localctx = NewOpttempContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 174, PostgreSQLParserRULE_opttemp) + var _la int + + p.SetState(2918) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserTEMPORARY: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2911) + p.Match(PostgreSQLParserTEMPORARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserTEMP: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2912) + p.Match(PostgreSQLParserTEMP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserLOCAL: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2913) + p.Match(PostgreSQLParserLOCAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2914) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTEMP || _la == PostgreSQLParserTEMPORARY) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case PostgreSQLParserGLOBAL: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2915) + p.Match(PostgreSQLParserGLOBAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2916) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTEMP || _la == PostgreSQLParserTEMPORARY) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case PostgreSQLParserUNLOGGED: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(2917) + p.Match(PostgreSQLParserUNLOGGED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpttableelementlistContext is an interface to support dynamic dispatch. +type IOpttableelementlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Tableelementlist() ITableelementlistContext + + // IsOpttableelementlistContext differentiates from other interfaces. + IsOpttableelementlistContext() +} + +type OpttableelementlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpttableelementlistContext() *OpttableelementlistContext { + var p = new(OpttableelementlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttableelementlist + return p +} + +func InitEmptyOpttableelementlistContext(p *OpttableelementlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttableelementlist +} + +func (*OpttableelementlistContext) IsOpttableelementlistContext() {} + +func NewOpttableelementlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OpttableelementlistContext { + var p = new(OpttableelementlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opttableelementlist + + return p +} + +func (s *OpttableelementlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *OpttableelementlistContext) Tableelementlist() ITableelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITableelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITableelementlistContext) +} + +func (s *OpttableelementlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OpttableelementlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OpttableelementlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpttableelementlist(s) + } +} + +func (s *OpttableelementlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpttableelementlist(s) + } +} + +func (s *OpttableelementlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpttableelementlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opttableelementlist() (localctx IOpttableelementlistContext) { + localctx = NewOpttableelementlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 176, PostgreSQLParserRULE_opttableelementlist) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2920) + p.Tableelementlist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpttypedtableelementlistContext is an interface to support dynamic dispatch. +type IOpttypedtableelementlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Typedtableelementlist() ITypedtableelementlistContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpttypedtableelementlistContext differentiates from other interfaces. + IsOpttypedtableelementlistContext() +} + +type OpttypedtableelementlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpttypedtableelementlistContext() *OpttypedtableelementlistContext { + var p = new(OpttypedtableelementlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttypedtableelementlist + return p +} + +func InitEmptyOpttypedtableelementlistContext(p *OpttypedtableelementlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttypedtableelementlist +} + +func (*OpttypedtableelementlistContext) IsOpttypedtableelementlistContext() {} + +func NewOpttypedtableelementlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OpttypedtableelementlistContext { + var p = new(OpttypedtableelementlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opttypedtableelementlist + + return p +} + +func (s *OpttypedtableelementlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *OpttypedtableelementlistContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *OpttypedtableelementlistContext) Typedtableelementlist() ITypedtableelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypedtableelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypedtableelementlistContext) +} + +func (s *OpttypedtableelementlistContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *OpttypedtableelementlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OpttypedtableelementlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OpttypedtableelementlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpttypedtableelementlist(s) + } +} + +func (s *OpttypedtableelementlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpttypedtableelementlist(s) + } +} + +func (s *OpttypedtableelementlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpttypedtableelementlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opttypedtableelementlist() (localctx IOpttypedtableelementlistContext) { + localctx = NewOpttypedtableelementlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 178, PostgreSQLParserRULE_opttypedtableelementlist) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2922) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2923) + p.Typedtableelementlist() + } + { + p.SetState(2924) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITableelementlistContext is an interface to support dynamic dispatch. +type ITableelementlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTableelement() []ITableelementContext + Tableelement(i int) ITableelementContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsTableelementlistContext differentiates from other interfaces. + IsTableelementlistContext() +} + +type TableelementlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTableelementlistContext() *TableelementlistContext { + var p = new(TableelementlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tableelementlist + return p +} + +func InitEmptyTableelementlistContext(p *TableelementlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tableelementlist +} + +func (*TableelementlistContext) IsTableelementlistContext() {} + +func NewTableelementlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TableelementlistContext { + var p = new(TableelementlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tableelementlist + + return p +} + +func (s *TableelementlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *TableelementlistContext) AllTableelement() []ITableelementContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITableelementContext); ok { + len++ + } + } + + tst := make([]ITableelementContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITableelementContext); ok { + tst[i] = t.(ITableelementContext) + i++ + } + } + + return tst +} + +func (s *TableelementlistContext) Tableelement(i int) ITableelementContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITableelementContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITableelementContext) +} + +func (s *TableelementlistContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *TableelementlistContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *TableelementlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TableelementlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TableelementlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTableelementlist(s) + } +} + +func (s *TableelementlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTableelementlist(s) + } +} + +func (s *TableelementlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTableelementlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tableelementlist() (localctx ITableelementlistContext) { + localctx = NewTableelementlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 180, PostgreSQLParserRULE_tableelementlist) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2926) + p.Tableelement() + } + p.SetState(2931) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(2927) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2928) + p.Tableelement() + } + + p.SetState(2933) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITypedtableelementlistContext is an interface to support dynamic dispatch. +type ITypedtableelementlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTypedtableelement() []ITypedtableelementContext + Typedtableelement(i int) ITypedtableelementContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsTypedtableelementlistContext differentiates from other interfaces. + IsTypedtableelementlistContext() +} + +type TypedtableelementlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTypedtableelementlistContext() *TypedtableelementlistContext { + var p = new(TypedtableelementlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_typedtableelementlist + return p +} + +func InitEmptyTypedtableelementlistContext(p *TypedtableelementlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_typedtableelementlist +} + +func (*TypedtableelementlistContext) IsTypedtableelementlistContext() {} + +func NewTypedtableelementlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypedtableelementlistContext { + var p = new(TypedtableelementlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_typedtableelementlist + + return p +} + +func (s *TypedtableelementlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *TypedtableelementlistContext) AllTypedtableelement() []ITypedtableelementContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypedtableelementContext); ok { + len++ + } + } + + tst := make([]ITypedtableelementContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypedtableelementContext); ok { + tst[i] = t.(ITypedtableelementContext) + i++ + } + } + + return tst +} + +func (s *TypedtableelementlistContext) Typedtableelement(i int) ITypedtableelementContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypedtableelementContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypedtableelementContext) +} + +func (s *TypedtableelementlistContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *TypedtableelementlistContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *TypedtableelementlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TypedtableelementlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TypedtableelementlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTypedtableelementlist(s) + } +} + +func (s *TypedtableelementlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTypedtableelementlist(s) + } +} + +func (s *TypedtableelementlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTypedtableelementlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Typedtableelementlist() (localctx ITypedtableelementlistContext) { + localctx = NewTypedtableelementlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 182, PostgreSQLParserRULE_typedtableelementlist) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2934) + p.Typedtableelement() + } + p.SetState(2939) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(2935) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2936) + p.Typedtableelement() + } + + p.SetState(2941) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITableelementContext is an interface to support dynamic dispatch. +type ITableelementContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Tableconstraint() ITableconstraintContext + Tablelikeclause() ITablelikeclauseContext + ColumnDef() IColumnDefContext + + // IsTableelementContext differentiates from other interfaces. + IsTableelementContext() +} + +type TableelementContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTableelementContext() *TableelementContext { + var p = new(TableelementContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tableelement + return p +} + +func InitEmptyTableelementContext(p *TableelementContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tableelement +} + +func (*TableelementContext) IsTableelementContext() {} + +func NewTableelementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TableelementContext { + var p = new(TableelementContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tableelement + + return p +} + +func (s *TableelementContext) GetParser() antlr.Parser { return s.parser } + +func (s *TableelementContext) Tableconstraint() ITableconstraintContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITableconstraintContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITableconstraintContext) +} + +func (s *TableelementContext) Tablelikeclause() ITablelikeclauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablelikeclauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITablelikeclauseContext) +} + +func (s *TableelementContext) ColumnDef() IColumnDefContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnDefContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnDefContext) +} + +func (s *TableelementContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TableelementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TableelementContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTableelement(s) + } +} + +func (s *TableelementContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTableelement(s) + } +} + +func (s *TableelementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTableelement(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tableelement() (localctx ITableelementContext) { + localctx = NewTableelementContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 184, PostgreSQLParserRULE_tableelement) + p.SetState(2945) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 152, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2942) + p.Tableconstraint() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2943) + p.Tablelikeclause() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2944) + p.ColumnDef() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITypedtableelementContext is an interface to support dynamic dispatch. +type ITypedtableelementContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ColumnOptions() IColumnOptionsContext + Tableconstraint() ITableconstraintContext + + // IsTypedtableelementContext differentiates from other interfaces. + IsTypedtableelementContext() +} + +type TypedtableelementContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTypedtableelementContext() *TypedtableelementContext { + var p = new(TypedtableelementContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_typedtableelement + return p +} + +func InitEmptyTypedtableelementContext(p *TypedtableelementContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_typedtableelement +} + +func (*TypedtableelementContext) IsTypedtableelementContext() {} + +func NewTypedtableelementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypedtableelementContext { + var p = new(TypedtableelementContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_typedtableelement + + return p +} + +func (s *TypedtableelementContext) GetParser() antlr.Parser { return s.parser } + +func (s *TypedtableelementContext) ColumnOptions() IColumnOptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnOptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnOptionsContext) +} + +func (s *TypedtableelementContext) Tableconstraint() ITableconstraintContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITableconstraintContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITableconstraintContext) +} + +func (s *TypedtableelementContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TypedtableelementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TypedtableelementContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTypedtableelement(s) + } +} + +func (s *TypedtableelementContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTypedtableelement(s) + } +} + +func (s *TypedtableelementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTypedtableelement(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Typedtableelement() (localctx ITypedtableelementContext) { + localctx = NewTypedtableelementContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 186, PostgreSQLParserRULE_typedtableelement) + p.SetState(2949) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 153, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2947) + p.ColumnOptions() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2948) + p.Tableconstraint() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColumnDefContext is an interface to support dynamic dispatch. +type IColumnDefContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Typename() ITypenameContext + Colquallist() IColquallistContext + Create_generic_options() ICreate_generic_optionsContext + Rs_colattributes() IRs_colattributesContext + + // IsColumnDefContext differentiates from other interfaces. + IsColumnDefContext() +} + +type ColumnDefContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColumnDefContext() *ColumnDefContext { + var p = new(ColumnDefContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnDef + return p +} + +func InitEmptyColumnDefContext(p *ColumnDefContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnDef +} + +func (*ColumnDefContext) IsColumnDefContext() {} + +func NewColumnDefContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColumnDefContext { + var p = new(ColumnDefContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_columnDef + + return p +} + +func (s *ColumnDefContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColumnDefContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *ColumnDefContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *ColumnDefContext) Colquallist() IColquallistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColquallistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColquallistContext) +} + +func (s *ColumnDefContext) Create_generic_options() ICreate_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_generic_optionsContext) +} + +func (s *ColumnDefContext) Rs_colattributes() IRs_colattributesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRs_colattributesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRs_colattributesContext) +} + +func (s *ColumnDefContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColumnDefContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColumnDefContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColumnDef(s) + } +} + +func (s *ColumnDefContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColumnDef(s) + } +} + +func (s *ColumnDefContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColumnDef(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) ColumnDef() (localctx IColumnDefContext) { + localctx = NewColumnDefContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 188, PostgreSQLParserRULE_columnDef) + var _la int + + p.SetState(2970) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 157, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + p.SetState(2951) + + if !(p.Engine != EngineRedshift) { + p.SetError(antlr.NewFailedPredicateException(p, " $parser.Engine!=EngineRedshift ", "")) + goto errorExit + } + { + p.SetState(2952) + p.Colid() + } + { + p.SetState(2953) + p.Typename() + } + p.SetState(2955) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(2954) + p.Create_generic_options() + } + + } + { + p.SetState(2957) + p.Colquallist() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + p.SetState(2959) + + if !(p.Engine == EngineRedshift) { + p.SetError(antlr.NewFailedPredicateException(p, " $parser.Engine==EngineRedshift ", "")) + goto errorExit + } + { + p.SetState(2960) + p.Colid() + } + { + p.SetState(2961) + p.Typename() + } + p.SetState(2963) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(2962) + p.Create_generic_options() + } + + } + p.SetState(2966) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 156, p.GetParserRuleContext()) == 1 { + { + p.SetState(2965) + p.Rs_colattributes() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(2968) + p.Colquallist() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRs_colattributesContext is an interface to support dynamic dispatch. +type IRs_colattributesContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // GetSeed returns the seed rule contexts. + GetSeed() IIconstContext + + // GetStep returns the step rule contexts. + GetStep() IIconstContext + + // SetSeed sets the seed rule contexts. + SetSeed(IIconstContext) + + // SetStep sets the step rule contexts. + SetStep(IIconstContext) + + // Getter signatures + DEFAULT() antlr.TerminalNode + B_expr() IB_exprContext + IDENTITY_P() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + COMMA() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + AllIconst() []IIconstContext + Iconst(i int) IIconstContext + GENERATED() antlr.TerminalNode + BY() antlr.TerminalNode + AS() antlr.TerminalNode + ENCODE() antlr.TerminalNode + StringConstant() antlr.TerminalNode + DISTKEY() antlr.TerminalNode + SORTKEY() antlr.TerminalNode + COLLATE() antlr.TerminalNode + CASE_SENSITIVE() antlr.TerminalNode + CASE_INSENSITIVE() antlr.TerminalNode + + // IsRs_colattributesContext differentiates from other interfaces. + IsRs_colattributesContext() +} + +type Rs_colattributesContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser + seed IIconstContext + step IIconstContext +} + +func NewEmptyRs_colattributesContext() *Rs_colattributesContext { + var p = new(Rs_colattributesContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rs_colattributes + return p +} + +func InitEmptyRs_colattributesContext(p *Rs_colattributesContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rs_colattributes +} + +func (*Rs_colattributesContext) IsRs_colattributesContext() {} + +func NewRs_colattributesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rs_colattributesContext { + var p = new(Rs_colattributesContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rs_colattributes + + return p +} + +func (s *Rs_colattributesContext) GetParser() antlr.Parser { return s.parser } + +func (s *Rs_colattributesContext) GetSeed() IIconstContext { return s.seed } + +func (s *Rs_colattributesContext) GetStep() IIconstContext { return s.step } + +func (s *Rs_colattributesContext) SetSeed(v IIconstContext) { s.seed = v } + +func (s *Rs_colattributesContext) SetStep(v IIconstContext) { s.step = v } + +func (s *Rs_colattributesContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Rs_colattributesContext) B_expr() IB_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IB_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IB_exprContext) +} + +func (s *Rs_colattributesContext) IDENTITY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIDENTITY_P, 0) +} + +func (s *Rs_colattributesContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Rs_colattributesContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Rs_colattributesContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Rs_colattributesContext) AllIconst() []IIconstContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIconstContext); ok { + len++ + } + } + + tst := make([]IIconstContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIconstContext); ok { + tst[i] = t.(IIconstContext) + i++ + } + } + + return tst +} + +func (s *Rs_colattributesContext) Iconst(i int) IIconstContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Rs_colattributesContext) GENERATED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGENERATED, 0) +} + +func (s *Rs_colattributesContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Rs_colattributesContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Rs_colattributesContext) ENCODE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENCODE, 0) +} + +func (s *Rs_colattributesContext) StringConstant() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserStringConstant, 0) +} + +func (s *Rs_colattributesContext) DISTKEY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISTKEY, 0) +} + +func (s *Rs_colattributesContext) SORTKEY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSORTKEY, 0) +} + +func (s *Rs_colattributesContext) COLLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATE, 0) +} + +func (s *Rs_colattributesContext) CASE_SENSITIVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASE_SENSITIVE, 0) +} + +func (s *Rs_colattributesContext) CASE_INSENSITIVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASE_INSENSITIVE, 0) +} + +func (s *Rs_colattributesContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Rs_colattributesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Rs_colattributesContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRs_colattributes(s) + } +} + +func (s *Rs_colattributesContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRs_colattributes(s) + } +} + +func (s *Rs_colattributesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRs_colattributes(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rs_colattributes() (localctx IRs_colattributesContext) { + localctx = NewRs_colattributesContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 190, PostgreSQLParserRULE_rs_colattributes) + var _la int + + p.SetState(2998) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserDEFAULT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(2972) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2973) + p.b_expr(0) + } + + case PostgreSQLParserIDENTITY_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(2974) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2975) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2976) + + var _x = p.Iconst() + + localctx.(*Rs_colattributesContext).seed = _x + } + { + p.SetState(2977) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2978) + + var _x = p.Iconst() + + localctx.(*Rs_colattributesContext).step = _x + } + { + p.SetState(2979) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserGENERATED: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(2981) + p.Match(PostgreSQLParserGENERATED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2982) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2983) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2984) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2985) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2986) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2987) + + var _x = p.Iconst() + + localctx.(*Rs_colattributesContext).seed = _x + } + { + p.SetState(2988) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2989) + + var _x = p.Iconst() + + localctx.(*Rs_colattributesContext).step = _x + } + { + p.SetState(2990) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserENCODE: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(2992) + p.Match(PostgreSQLParserENCODE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2993) + p.Match(PostgreSQLParserStringConstant) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDISTKEY: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(2994) + p.Match(PostgreSQLParserDISTKEY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSORTKEY: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(2995) + p.Match(PostgreSQLParserSORTKEY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCOLLATE: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(2996) + p.Match(PostgreSQLParserCOLLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(2997) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCASE_SENSITIVE || _la == PostgreSQLParserCASE_INSENSITIVE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColumnOptionsContext is an interface to support dynamic dispatch. +type IColumnOptionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Colquallist() IColquallistContext + WITH() antlr.TerminalNode + OPTIONS() antlr.TerminalNode + + // IsColumnOptionsContext differentiates from other interfaces. + IsColumnOptionsContext() +} + +type ColumnOptionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColumnOptionsContext() *ColumnOptionsContext { + var p = new(ColumnOptionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnOptions + return p +} + +func InitEmptyColumnOptionsContext(p *ColumnOptionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnOptions +} + +func (*ColumnOptionsContext) IsColumnOptionsContext() {} + +func NewColumnOptionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColumnOptionsContext { + var p = new(ColumnOptionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_columnOptions + + return p +} + +func (s *ColumnOptionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColumnOptionsContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *ColumnOptionsContext) Colquallist() IColquallistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColquallistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColquallistContext) +} + +func (s *ColumnOptionsContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *ColumnOptionsContext) OPTIONS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTIONS, 0) +} + +func (s *ColumnOptionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColumnOptionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColumnOptionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColumnOptions(s) + } +} + +func (s *ColumnOptionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColumnOptions(s) + } +} + +func (s *ColumnOptionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColumnOptions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) ColumnOptions() (localctx IColumnOptionsContext) { + localctx = NewColumnOptionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 192, PostgreSQLParserRULE_columnOptions) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3000) + p.Colid() + } + p.SetState(3003) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(3001) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3002) + p.Match(PostgreSQLParserOPTIONS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(3005) + p.Colquallist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColquallistContext is an interface to support dynamic dispatch. +type IColquallistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllColconstraint() []IColconstraintContext + Colconstraint(i int) IColconstraintContext + + // IsColquallistContext differentiates from other interfaces. + IsColquallistContext() +} + +type ColquallistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColquallistContext() *ColquallistContext { + var p = new(ColquallistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_colquallist + return p +} + +func InitEmptyColquallistContext(p *ColquallistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_colquallist +} + +func (*ColquallistContext) IsColquallistContext() {} + +func NewColquallistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColquallistContext { + var p = new(ColquallistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_colquallist + + return p +} + +func (s *ColquallistContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColquallistContext) AllColconstraint() []IColconstraintContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IColconstraintContext); ok { + len++ + } + } + + tst := make([]IColconstraintContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IColconstraintContext); ok { + tst[i] = t.(IColconstraintContext) + i++ + } + } + + return tst +} + +func (s *ColquallistContext) Colconstraint(i int) IColconstraintContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColconstraintContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IColconstraintContext) +} + +func (s *ColquallistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColquallistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColquallistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColquallist(s) + } +} + +func (s *ColquallistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColquallist(s) + } +} + +func (s *ColquallistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColquallist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Colquallist() (localctx IColquallistContext) { + localctx = NewColquallistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 194, PostgreSQLParserRULE_colquallist) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(3010) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ((int64((_la-42)) & ^0x3f) == 0 && ((int64(1)<<(_la-42))&72084085530433547) != 0) || _la == PostgreSQLParserGENERATED { + { + p.SetState(3007) + p.Colconstraint() + } + + p.SetState(3012) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColconstraintContext is an interface to support dynamic dispatch. +type IColconstraintContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CONSTRAINT() antlr.TerminalNode + Name() INameContext + Colconstraintelem() IColconstraintelemContext + Constraintattr() IConstraintattrContext + COLLATE() antlr.TerminalNode + Any_name() IAny_nameContext + + // IsColconstraintContext differentiates from other interfaces. + IsColconstraintContext() +} + +type ColconstraintContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColconstraintContext() *ColconstraintContext { + var p = new(ColconstraintContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_colconstraint + return p +} + +func InitEmptyColconstraintContext(p *ColconstraintContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_colconstraint +} + +func (*ColconstraintContext) IsColconstraintContext() {} + +func NewColconstraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColconstraintContext { + var p = new(ColconstraintContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_colconstraint + + return p +} + +func (s *ColconstraintContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColconstraintContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *ColconstraintContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *ColconstraintContext) Colconstraintelem() IColconstraintelemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColconstraintelemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColconstraintelemContext) +} + +func (s *ColconstraintContext) Constraintattr() IConstraintattrContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraintattrContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraintattrContext) +} + +func (s *ColconstraintContext) COLLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATE, 0) +} + +func (s *ColconstraintContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *ColconstraintContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColconstraintContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColconstraintContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColconstraint(s) + } +} + +func (s *ColconstraintContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColconstraint(s) + } +} + +func (s *ColconstraintContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColconstraint(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Colconstraint() (localctx IColconstraintContext) { + localctx = NewColconstraintContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 196, PostgreSQLParserRULE_colconstraint) + p.SetState(3021) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 161, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3013) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3014) + p.Name() + } + { + p.SetState(3015) + p.Colconstraintelem() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3017) + p.Colconstraintelem() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3018) + p.Constraintattr() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3019) + p.Match(PostgreSQLParserCOLLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3020) + p.Any_name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColconstraintelemContext is an interface to support dynamic dispatch. +type IColconstraintelemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOT() antlr.TerminalNode + NULL_P() antlr.TerminalNode + UNIQUE() antlr.TerminalNode + Opt_unique_null_treatment() IOpt_unique_null_treatmentContext + Opt_definition() IOpt_definitionContext + Optconstablespace() IOptconstablespaceContext + PRIMARY() antlr.TerminalNode + KEY() antlr.TerminalNode + CHECK() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + Opt_no_inherit() IOpt_no_inheritContext + DEFAULT() antlr.TerminalNode + B_expr() IB_exprContext + GENERATED() antlr.TerminalNode + Generated_when() IGenerated_whenContext + AS() antlr.TerminalNode + IDENTITY_P() antlr.TerminalNode + STORED() antlr.TerminalNode + Optparenthesizedseqoptlist() IOptparenthesizedseqoptlistContext + REFERENCES() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Opt_column_list() IOpt_column_listContext + Key_match() IKey_matchContext + Key_actions() IKey_actionsContext + + // IsColconstraintelemContext differentiates from other interfaces. + IsColconstraintelemContext() +} + +type ColconstraintelemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColconstraintelemContext() *ColconstraintelemContext { + var p = new(ColconstraintelemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_colconstraintelem + return p +} + +func InitEmptyColconstraintelemContext(p *ColconstraintelemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_colconstraintelem +} + +func (*ColconstraintelemContext) IsColconstraintelemContext() {} + +func NewColconstraintelemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColconstraintelemContext { + var p = new(ColconstraintelemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_colconstraintelem + + return p +} + +func (s *ColconstraintelemContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColconstraintelemContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *ColconstraintelemContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *ColconstraintelemContext) UNIQUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNIQUE, 0) +} + +func (s *ColconstraintelemContext) Opt_unique_null_treatment() IOpt_unique_null_treatmentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_unique_null_treatmentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_unique_null_treatmentContext) +} + +func (s *ColconstraintelemContext) Opt_definition() IOpt_definitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_definitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_definitionContext) +} + +func (s *ColconstraintelemContext) Optconstablespace() IOptconstablespaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptconstablespaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptconstablespaceContext) +} + +func (s *ColconstraintelemContext) PRIMARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIMARY, 0) +} + +func (s *ColconstraintelemContext) KEY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserKEY, 0) +} + +func (s *ColconstraintelemContext) CHECK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHECK, 0) +} + +func (s *ColconstraintelemContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ColconstraintelemContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *ColconstraintelemContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ColconstraintelemContext) Opt_no_inherit() IOpt_no_inheritContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_no_inheritContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_no_inheritContext) +} + +func (s *ColconstraintelemContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *ColconstraintelemContext) B_expr() IB_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IB_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IB_exprContext) +} + +func (s *ColconstraintelemContext) GENERATED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGENERATED, 0) +} + +func (s *ColconstraintelemContext) Generated_when() IGenerated_whenContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGenerated_whenContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGenerated_whenContext) +} + +func (s *ColconstraintelemContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *ColconstraintelemContext) IDENTITY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIDENTITY_P, 0) +} + +func (s *ColconstraintelemContext) STORED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTORED, 0) +} + +func (s *ColconstraintelemContext) Optparenthesizedseqoptlist() IOptparenthesizedseqoptlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptparenthesizedseqoptlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptparenthesizedseqoptlistContext) +} + +func (s *ColconstraintelemContext) REFERENCES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFERENCES, 0) +} + +func (s *ColconstraintelemContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *ColconstraintelemContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *ColconstraintelemContext) Key_match() IKey_matchContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IKey_matchContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IKey_matchContext) +} + +func (s *ColconstraintelemContext) Key_actions() IKey_actionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IKey_actionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IKey_actionsContext) +} + +func (s *ColconstraintelemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColconstraintelemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColconstraintelemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColconstraintelem(s) + } +} + +func (s *ColconstraintelemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColconstraintelem(s) + } +} + +func (s *ColconstraintelemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColconstraintelem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Colconstraintelem() (localctx IColconstraintelemContext) { + localctx = NewColconstraintelemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 198, PostgreSQLParserRULE_colconstraintelem) + var _la int + + p.SetState(3078) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNOT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3023) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3024) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNULL_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3025) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserUNIQUE: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3026) + p.Match(PostgreSQLParserUNIQUE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3028) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNULLS_P { + { + p.SetState(3027) + p.Opt_unique_null_treatment() + } + + } + p.SetState(3031) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 163, p.GetParserRuleContext()) == 1 { + { + p.SetState(3030) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3034) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(3033) + p.Optconstablespace() + } + + } + + case PostgreSQLParserPRIMARY: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3036) + p.Match(PostgreSQLParserPRIMARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3037) + p.Match(PostgreSQLParserKEY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3039) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 165, p.GetParserRuleContext()) == 1 { + { + p.SetState(3038) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3042) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(3041) + p.Optconstablespace() + } + + } + + case PostgreSQLParserCHECK: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(3044) + p.Match(PostgreSQLParserCHECK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3045) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3046) + p.A_expr() + } + { + p.SetState(3047) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3049) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(3048) + p.Opt_no_inherit() + } + + } + + case PostgreSQLParserDEFAULT: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(3051) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3052) + p.b_expr(0) + } + + case PostgreSQLParserGENERATED: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(3053) + p.Match(PostgreSQLParserGENERATED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3054) + p.Generated_when() + } + { + p.SetState(3055) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3065) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserIDENTITY_P: + { + p.SetState(3056) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3058) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 168, p.GetParserRuleContext()) == 1 { + { + p.SetState(3057) + p.Optparenthesizedseqoptlist() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(3060) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3061) + p.A_expr() + } + { + p.SetState(3062) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3063) + p.Match(PostgreSQLParserSTORED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case PostgreSQLParserREFERENCES: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(3067) + p.Match(PostgreSQLParserREFERENCES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3068) + p.Qualified_name() + } + p.SetState(3070) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 170, p.GetParserRuleContext()) == 1 { + { + p.SetState(3069) + p.Opt_column_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3073) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserMATCH { + { + p.SetState(3072) + p.Key_match() + } + + } + p.SetState(3076) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserON { + { + p.SetState(3075) + p.Key_actions() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_unique_null_treatmentContext is an interface to support dynamic dispatch. +type IOpt_unique_null_treatmentContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NULLS_P() antlr.TerminalNode + DISTINCT() antlr.TerminalNode + NOT() antlr.TerminalNode + + // IsOpt_unique_null_treatmentContext differentiates from other interfaces. + IsOpt_unique_null_treatmentContext() +} + +type Opt_unique_null_treatmentContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_unique_null_treatmentContext() *Opt_unique_null_treatmentContext { + var p = new(Opt_unique_null_treatmentContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_unique_null_treatment + return p +} + +func InitEmptyOpt_unique_null_treatmentContext(p *Opt_unique_null_treatmentContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_unique_null_treatment +} + +func (*Opt_unique_null_treatmentContext) IsOpt_unique_null_treatmentContext() {} + +func NewOpt_unique_null_treatmentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_unique_null_treatmentContext { + var p = new(Opt_unique_null_treatmentContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_unique_null_treatment + + return p +} + +func (s *Opt_unique_null_treatmentContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_unique_null_treatmentContext) NULLS_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULLS_P, 0) +} + +func (s *Opt_unique_null_treatmentContext) DISTINCT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISTINCT, 0) +} + +func (s *Opt_unique_null_treatmentContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Opt_unique_null_treatmentContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_unique_null_treatmentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_unique_null_treatmentContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_unique_null_treatment(s) + } +} + +func (s *Opt_unique_null_treatmentContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_unique_null_treatment(s) + } +} + +func (s *Opt_unique_null_treatmentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_unique_null_treatment(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_unique_null_treatment() (localctx IOpt_unique_null_treatmentContext) { + localctx = NewOpt_unique_null_treatmentContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 200, PostgreSQLParserRULE_opt_unique_null_treatment) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3080) + p.Match(PostgreSQLParserNULLS_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3082) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT { + { + p.SetState(3081) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(3084) + p.Match(PostgreSQLParserDISTINCT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGenerated_whenContext is an interface to support dynamic dispatch. +type IGenerated_whenContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALWAYS() antlr.TerminalNode + BY() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + + // IsGenerated_whenContext differentiates from other interfaces. + IsGenerated_whenContext() +} + +type Generated_whenContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGenerated_whenContext() *Generated_whenContext { + var p = new(Generated_whenContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generated_when + return p +} + +func InitEmptyGenerated_whenContext(p *Generated_whenContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generated_when +} + +func (*Generated_whenContext) IsGenerated_whenContext() {} + +func NewGenerated_whenContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Generated_whenContext { + var p = new(Generated_whenContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_generated_when + + return p +} + +func (s *Generated_whenContext) GetParser() antlr.Parser { return s.parser } + +func (s *Generated_whenContext) ALWAYS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALWAYS, 0) +} + +func (s *Generated_whenContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Generated_whenContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Generated_whenContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Generated_whenContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Generated_whenContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGenerated_when(s) + } +} + +func (s *Generated_whenContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGenerated_when(s) + } +} + +func (s *Generated_whenContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGenerated_when(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Generated_when() (localctx IGenerated_whenContext) { + localctx = NewGenerated_whenContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 202, PostgreSQLParserRULE_generated_when) + p.SetState(3089) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserALWAYS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3086) + p.Match(PostgreSQLParserALWAYS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserBY: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3087) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3088) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstraintattrContext is an interface to support dynamic dispatch. +type IConstraintattrContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DEFERRABLE() antlr.TerminalNode + NOT() antlr.TerminalNode + INITIALLY() antlr.TerminalNode + DEFERRED() antlr.TerminalNode + IMMEDIATE() antlr.TerminalNode + + // IsConstraintattrContext differentiates from other interfaces. + IsConstraintattrContext() +} + +type ConstraintattrContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstraintattrContext() *ConstraintattrContext { + var p = new(ConstraintattrContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintattr + return p +} + +func InitEmptyConstraintattrContext(p *ConstraintattrContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintattr +} + +func (*ConstraintattrContext) IsConstraintattrContext() {} + +func NewConstraintattrContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstraintattrContext { + var p = new(ConstraintattrContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constraintattr + + return p +} + +func (s *ConstraintattrContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstraintattrContext) DEFERRABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFERRABLE, 0) +} + +func (s *ConstraintattrContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *ConstraintattrContext) INITIALLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINITIALLY, 0) +} + +func (s *ConstraintattrContext) DEFERRED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFERRED, 0) +} + +func (s *ConstraintattrContext) IMMEDIATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMMEDIATE, 0) +} + +func (s *ConstraintattrContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstraintattrContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstraintattrContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstraintattr(s) + } +} + +func (s *ConstraintattrContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstraintattr(s) + } +} + +func (s *ConstraintattrContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstraintattr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constraintattr() (localctx IConstraintattrContext) { + localctx = NewConstraintattrContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 204, PostgreSQLParserRULE_constraintattr) + var _la int + + p.SetState(3096) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserDEFERRABLE: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3091) + p.Match(PostgreSQLParserDEFERRABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNOT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3092) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3093) + p.Match(PostgreSQLParserDEFERRABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserINITIALLY: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3094) + p.Match(PostgreSQLParserINITIALLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3095) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserDEFERRED || _la == PostgreSQLParserIMMEDIATE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITablelikeclauseContext is an interface to support dynamic dispatch. +type ITablelikeclauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LIKE() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Tablelikeoptionlist() ITablelikeoptionlistContext + + // IsTablelikeclauseContext differentiates from other interfaces. + IsTablelikeclauseContext() +} + +type TablelikeclauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTablelikeclauseContext() *TablelikeclauseContext { + var p = new(TablelikeclauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablelikeclause + return p +} + +func InitEmptyTablelikeclauseContext(p *TablelikeclauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablelikeclause +} + +func (*TablelikeclauseContext) IsTablelikeclauseContext() {} + +func NewTablelikeclauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TablelikeclauseContext { + var p = new(TablelikeclauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tablelikeclause + + return p +} + +func (s *TablelikeclauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *TablelikeclauseContext) LIKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIKE, 0) +} + +func (s *TablelikeclauseContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *TablelikeclauseContext) Tablelikeoptionlist() ITablelikeoptionlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablelikeoptionlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITablelikeoptionlistContext) +} + +func (s *TablelikeclauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TablelikeclauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TablelikeclauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTablelikeclause(s) + } +} + +func (s *TablelikeclauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTablelikeclause(s) + } +} + +func (s *TablelikeclauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTablelikeclause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tablelikeclause() (localctx ITablelikeclauseContext) { + localctx = NewTablelikeclauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 206, PostgreSQLParserRULE_tablelikeclause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3098) + p.Match(PostgreSQLParserLIKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3099) + p.Qualified_name() + } + { + p.SetState(3100) + p.Tablelikeoptionlist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITablelikeoptionlistContext is an interface to support dynamic dispatch. +type ITablelikeoptionlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTablelikeoption() []ITablelikeoptionContext + Tablelikeoption(i int) ITablelikeoptionContext + AllINCLUDING() []antlr.TerminalNode + INCLUDING(i int) antlr.TerminalNode + AllEXCLUDING() []antlr.TerminalNode + EXCLUDING(i int) antlr.TerminalNode + + // IsTablelikeoptionlistContext differentiates from other interfaces. + IsTablelikeoptionlistContext() +} + +type TablelikeoptionlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTablelikeoptionlistContext() *TablelikeoptionlistContext { + var p = new(TablelikeoptionlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablelikeoptionlist + return p +} + +func InitEmptyTablelikeoptionlistContext(p *TablelikeoptionlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablelikeoptionlist +} + +func (*TablelikeoptionlistContext) IsTablelikeoptionlistContext() {} + +func NewTablelikeoptionlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TablelikeoptionlistContext { + var p = new(TablelikeoptionlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tablelikeoptionlist + + return p +} + +func (s *TablelikeoptionlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *TablelikeoptionlistContext) AllTablelikeoption() []ITablelikeoptionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITablelikeoptionContext); ok { + len++ + } + } + + tst := make([]ITablelikeoptionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITablelikeoptionContext); ok { + tst[i] = t.(ITablelikeoptionContext) + i++ + } + } + + return tst +} + +func (s *TablelikeoptionlistContext) Tablelikeoption(i int) ITablelikeoptionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablelikeoptionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITablelikeoptionContext) +} + +func (s *TablelikeoptionlistContext) AllINCLUDING() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserINCLUDING) +} + +func (s *TablelikeoptionlistContext) INCLUDING(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINCLUDING, i) +} + +func (s *TablelikeoptionlistContext) AllEXCLUDING() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserEXCLUDING) +} + +func (s *TablelikeoptionlistContext) EXCLUDING(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCLUDING, i) +} + +func (s *TablelikeoptionlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TablelikeoptionlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TablelikeoptionlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTablelikeoptionlist(s) + } +} + +func (s *TablelikeoptionlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTablelikeoptionlist(s) + } +} + +func (s *TablelikeoptionlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTablelikeoptionlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tablelikeoptionlist() (localctx ITablelikeoptionlistContext) { + localctx = NewTablelikeoptionlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 208, PostgreSQLParserRULE_tablelikeoptionlist) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(3106) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserEXCLUDING || _la == PostgreSQLParserINCLUDING { + { + p.SetState(3102) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserEXCLUDING || _la == PostgreSQLParserINCLUDING) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(3103) + p.Tablelikeoption() + } + + p.SetState(3108) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITablelikeoptionContext is an interface to support dynamic dispatch. +type ITablelikeoptionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COMMENTS() antlr.TerminalNode + CONSTRAINTS() antlr.TerminalNode + DEFAULTS() antlr.TerminalNode + IDENTITY_P() antlr.TerminalNode + GENERATED() antlr.TerminalNode + INDEXES() antlr.TerminalNode + STATISTICS() antlr.TerminalNode + STORAGE() antlr.TerminalNode + ALL() antlr.TerminalNode + + // IsTablelikeoptionContext differentiates from other interfaces. + IsTablelikeoptionContext() +} + +type TablelikeoptionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTablelikeoptionContext() *TablelikeoptionContext { + var p = new(TablelikeoptionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablelikeoption + return p +} + +func InitEmptyTablelikeoptionContext(p *TablelikeoptionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablelikeoption +} + +func (*TablelikeoptionContext) IsTablelikeoptionContext() {} + +func NewTablelikeoptionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TablelikeoptionContext { + var p = new(TablelikeoptionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tablelikeoption + + return p +} + +func (s *TablelikeoptionContext) GetParser() antlr.Parser { return s.parser } + +func (s *TablelikeoptionContext) COMMENTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMENTS, 0) +} + +func (s *TablelikeoptionContext) CONSTRAINTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINTS, 0) +} + +func (s *TablelikeoptionContext) DEFAULTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULTS, 0) +} + +func (s *TablelikeoptionContext) IDENTITY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIDENTITY_P, 0) +} + +func (s *TablelikeoptionContext) GENERATED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGENERATED, 0) +} + +func (s *TablelikeoptionContext) INDEXES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEXES, 0) +} + +func (s *TablelikeoptionContext) STATISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, 0) +} + +func (s *TablelikeoptionContext) STORAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTORAGE, 0) +} + +func (s *TablelikeoptionContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *TablelikeoptionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TablelikeoptionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TablelikeoptionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTablelikeoption(s) + } +} + +func (s *TablelikeoptionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTablelikeoption(s) + } +} + +func (s *TablelikeoptionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTablelikeoption(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tablelikeoption() (localctx ITablelikeoptionContext) { + localctx = NewTablelikeoptionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 210, PostgreSQLParserRULE_tablelikeoption) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3109) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserALL || ((int64((_la-160)) & ^0x3f) == 0 && ((int64(1)<<(_la-160))&576460752303947809) != 0) || _la == PostgreSQLParserINDEXES || _la == PostgreSQLParserSTATISTICS || _la == PostgreSQLParserSTORAGE || _la == PostgreSQLParserGENERATED) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITableconstraintContext is an interface to support dynamic dispatch. +type ITableconstraintContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CONSTRAINT() antlr.TerminalNode + Name() INameContext + Constraintelem() IConstraintelemContext + + // IsTableconstraintContext differentiates from other interfaces. + IsTableconstraintContext() +} + +type TableconstraintContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTableconstraintContext() *TableconstraintContext { + var p = new(TableconstraintContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tableconstraint + return p +} + +func InitEmptyTableconstraintContext(p *TableconstraintContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tableconstraint +} + +func (*TableconstraintContext) IsTableconstraintContext() {} + +func NewTableconstraintContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TableconstraintContext { + var p = new(TableconstraintContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tableconstraint + + return p +} + +func (s *TableconstraintContext) GetParser() antlr.Parser { return s.parser } + +func (s *TableconstraintContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *TableconstraintContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *TableconstraintContext) Constraintelem() IConstraintelemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraintelemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraintelemContext) +} + +func (s *TableconstraintContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TableconstraintContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TableconstraintContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTableconstraint(s) + } +} + +func (s *TableconstraintContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTableconstraint(s) + } +} + +func (s *TableconstraintContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTableconstraint(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tableconstraint() (localctx ITableconstraintContext) { + localctx = NewTableconstraintContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 212, PostgreSQLParserRULE_tableconstraint) + p.SetState(3116) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserCONSTRAINT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3111) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3112) + p.Name() + } + { + p.SetState(3113) + p.Constraintelem() + } + + case PostgreSQLParserCHECK, PostgreSQLParserFOREIGN, PostgreSQLParserPRIMARY, PostgreSQLParserUNIQUE, PostgreSQLParserEXCLUDE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3115) + p.Constraintelem() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstraintelemContext is an interface to support dynamic dispatch. +type IConstraintelemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CHECK() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + Constraintattributespec() IConstraintattributespecContext + UNIQUE() antlr.TerminalNode + Columnlist() IColumnlistContext + Existingindex() IExistingindexContext + Opt_unique_null_treatment() IOpt_unique_null_treatmentContext + Opt_c_include() IOpt_c_includeContext + Opt_definition() IOpt_definitionContext + Optconstablespace() IOptconstablespaceContext + PRIMARY() antlr.TerminalNode + KEY() antlr.TerminalNode + EXCLUDE() antlr.TerminalNode + Exclusionconstraintlist() IExclusionconstraintlistContext + Access_method_clause() IAccess_method_clauseContext + Exclusionwhereclause() IExclusionwhereclauseContext + FOREIGN() antlr.TerminalNode + REFERENCES() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Opt_column_list() IOpt_column_listContext + Key_match() IKey_matchContext + Key_actions() IKey_actionsContext + + // IsConstraintelemContext differentiates from other interfaces. + IsConstraintelemContext() +} + +type ConstraintelemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstraintelemContext() *ConstraintelemContext { + var p = new(ConstraintelemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintelem + return p +} + +func InitEmptyConstraintelemContext(p *ConstraintelemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintelem +} + +func (*ConstraintelemContext) IsConstraintelemContext() {} + +func NewConstraintelemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstraintelemContext { + var p = new(ConstraintelemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constraintelem + + return p +} + +func (s *ConstraintelemContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstraintelemContext) CHECK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHECK, 0) +} + +func (s *ConstraintelemContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ConstraintelemContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *ConstraintelemContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ConstraintelemContext) Constraintattributespec() IConstraintattributespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraintattributespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraintattributespecContext) +} + +func (s *ConstraintelemContext) UNIQUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNIQUE, 0) +} + +func (s *ConstraintelemContext) Columnlist() IColumnlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnlistContext) +} + +func (s *ConstraintelemContext) Existingindex() IExistingindexContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExistingindexContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExistingindexContext) +} + +func (s *ConstraintelemContext) Opt_unique_null_treatment() IOpt_unique_null_treatmentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_unique_null_treatmentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_unique_null_treatmentContext) +} + +func (s *ConstraintelemContext) Opt_c_include() IOpt_c_includeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_c_includeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_c_includeContext) +} + +func (s *ConstraintelemContext) Opt_definition() IOpt_definitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_definitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_definitionContext) +} + +func (s *ConstraintelemContext) Optconstablespace() IOptconstablespaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptconstablespaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptconstablespaceContext) +} + +func (s *ConstraintelemContext) PRIMARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIMARY, 0) +} + +func (s *ConstraintelemContext) KEY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserKEY, 0) +} + +func (s *ConstraintelemContext) EXCLUDE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCLUDE, 0) +} + +func (s *ConstraintelemContext) Exclusionconstraintlist() IExclusionconstraintlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExclusionconstraintlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExclusionconstraintlistContext) +} + +func (s *ConstraintelemContext) Access_method_clause() IAccess_method_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAccess_method_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAccess_method_clauseContext) +} + +func (s *ConstraintelemContext) Exclusionwhereclause() IExclusionwhereclauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExclusionwhereclauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExclusionwhereclauseContext) +} + +func (s *ConstraintelemContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *ConstraintelemContext) REFERENCES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFERENCES, 0) +} + +func (s *ConstraintelemContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *ConstraintelemContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *ConstraintelemContext) Key_match() IKey_matchContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IKey_matchContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IKey_matchContext) +} + +func (s *ConstraintelemContext) Key_actions() IKey_actionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IKey_actionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IKey_actionsContext) +} + +func (s *ConstraintelemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstraintelemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstraintelemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstraintelem(s) + } +} + +func (s *ConstraintelemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstraintelem(s) + } +} + +func (s *ConstraintelemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstraintelem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constraintelem() (localctx IConstraintelemContext) { + localctx = NewConstraintelemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 214, PostgreSQLParserRULE_constraintelem) + var _la int + + p.SetState(3207) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserCHECK: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3118) + p.Match(PostgreSQLParserCHECK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3119) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3120) + p.A_expr() + } + { + p.SetState(3121) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3122) + p.Constraintattributespec() + } + + case PostgreSQLParserUNIQUE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3124) + p.Match(PostgreSQLParserUNIQUE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3126) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNULLS_P { + { + p.SetState(3125) + p.Opt_unique_null_treatment() + } + + } + p.SetState(3145) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(3128) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3129) + p.Columnlist() + } + { + p.SetState(3130) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3132) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINCLUDE { + { + p.SetState(3131) + p.Opt_c_include() + } + + } + p.SetState(3135) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 181, p.GetParserRuleContext()) == 1 { + { + p.SetState(3134) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3138) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(3137) + p.Optconstablespace() + } + + } + { + p.SetState(3140) + p.Constraintattributespec() + } + + case PostgreSQLParserUSING: + { + p.SetState(3142) + p.Existingindex() + } + { + p.SetState(3143) + p.Constraintattributespec() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case PostgreSQLParserPRIMARY: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3147) + p.Match(PostgreSQLParserPRIMARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3148) + p.Match(PostgreSQLParserKEY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3166) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(3149) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3150) + p.Columnlist() + } + { + p.SetState(3151) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3153) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINCLUDE { + { + p.SetState(3152) + p.Opt_c_include() + } + + } + p.SetState(3156) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 185, p.GetParserRuleContext()) == 1 { + { + p.SetState(3155) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3159) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(3158) + p.Optconstablespace() + } + + } + { + p.SetState(3161) + p.Constraintattributespec() + } + + case PostgreSQLParserUSING: + { + p.SetState(3163) + p.Existingindex() + } + { + p.SetState(3164) + p.Constraintattributespec() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case PostgreSQLParserEXCLUDE: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3168) + p.Match(PostgreSQLParserEXCLUDE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3170) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(3169) + p.Access_method_clause() + } + + } + { + p.SetState(3172) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3173) + p.Exclusionconstraintlist() + } + { + p.SetState(3174) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3176) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINCLUDE { + { + p.SetState(3175) + p.Opt_c_include() + } + + } + p.SetState(3179) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 190, p.GetParserRuleContext()) == 1 { + { + p.SetState(3178) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3182) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(3181) + p.Optconstablespace() + } + + } + p.SetState(3185) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(3184) + p.Exclusionwhereclause() + } + + } + { + p.SetState(3187) + p.Constraintattributespec() + } + + case PostgreSQLParserFOREIGN: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(3189) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3190) + p.Match(PostgreSQLParserKEY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3191) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3192) + p.Columnlist() + } + { + p.SetState(3193) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3194) + p.Match(PostgreSQLParserREFERENCES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3195) + p.Qualified_name() + } + p.SetState(3197) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 193, p.GetParserRuleContext()) == 1 { + { + p.SetState(3196) + p.Opt_column_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3200) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserMATCH { + { + p.SetState(3199) + p.Key_match() + } + + } + p.SetState(3203) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserON { + { + p.SetState(3202) + p.Key_actions() + } + + } + { + p.SetState(3205) + p.Constraintattributespec() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_no_inheritContext is an interface to support dynamic dispatch. +type IOpt_no_inheritContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NO() antlr.TerminalNode + INHERIT() antlr.TerminalNode + + // IsOpt_no_inheritContext differentiates from other interfaces. + IsOpt_no_inheritContext() +} + +type Opt_no_inheritContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_no_inheritContext() *Opt_no_inheritContext { + var p = new(Opt_no_inheritContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_no_inherit + return p +} + +func InitEmptyOpt_no_inheritContext(p *Opt_no_inheritContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_no_inherit +} + +func (*Opt_no_inheritContext) IsOpt_no_inheritContext() {} + +func NewOpt_no_inheritContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_no_inheritContext { + var p = new(Opt_no_inheritContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_no_inherit + + return p +} + +func (s *Opt_no_inheritContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_no_inheritContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Opt_no_inheritContext) INHERIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINHERIT, 0) +} + +func (s *Opt_no_inheritContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_no_inheritContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_no_inheritContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_no_inherit(s) + } +} + +func (s *Opt_no_inheritContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_no_inherit(s) + } +} + +func (s *Opt_no_inheritContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_no_inherit(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_no_inherit() (localctx IOpt_no_inheritContext) { + localctx = NewOpt_no_inheritContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 216, PostgreSQLParserRULE_opt_no_inherit) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3209) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3210) + p.Match(PostgreSQLParserINHERIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_column_listContext is an interface to support dynamic dispatch. +type IOpt_column_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Columnlist() IColumnlistContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_column_listContext differentiates from other interfaces. + IsOpt_column_listContext() +} + +type Opt_column_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_column_listContext() *Opt_column_listContext { + var p = new(Opt_column_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_column_list + return p +} + +func InitEmptyOpt_column_listContext(p *Opt_column_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_column_list +} + +func (*Opt_column_listContext) IsOpt_column_listContext() {} + +func NewOpt_column_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_column_listContext { + var p = new(Opt_column_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_column_list + + return p +} + +func (s *Opt_column_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_column_listContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_column_listContext) Columnlist() IColumnlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnlistContext) +} + +func (s *Opt_column_listContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_column_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_column_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_column_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_column_list(s) + } +} + +func (s *Opt_column_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_column_list(s) + } +} + +func (s *Opt_column_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_column_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_column_list() (localctx IOpt_column_listContext) { + localctx = NewOpt_column_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 218, PostgreSQLParserRULE_opt_column_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3212) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3213) + p.Columnlist() + } + { + p.SetState(3214) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColumnlistContext is an interface to support dynamic dispatch. +type IColumnlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllColumnElem() []IColumnElemContext + ColumnElem(i int) IColumnElemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsColumnlistContext differentiates from other interfaces. + IsColumnlistContext() +} + +type ColumnlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColumnlistContext() *ColumnlistContext { + var p = new(ColumnlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnlist + return p +} + +func InitEmptyColumnlistContext(p *ColumnlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnlist +} + +func (*ColumnlistContext) IsColumnlistContext() {} + +func NewColumnlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColumnlistContext { + var p = new(ColumnlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_columnlist + + return p +} + +func (s *ColumnlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColumnlistContext) AllColumnElem() []IColumnElemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IColumnElemContext); ok { + len++ + } + } + + tst := make([]IColumnElemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IColumnElemContext); ok { + tst[i] = t.(IColumnElemContext) + i++ + } + } + + return tst +} + +func (s *ColumnlistContext) ColumnElem(i int) IColumnElemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnElemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IColumnElemContext) +} + +func (s *ColumnlistContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *ColumnlistContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *ColumnlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColumnlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColumnlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColumnlist(s) + } +} + +func (s *ColumnlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColumnlist(s) + } +} + +func (s *ColumnlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColumnlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Columnlist() (localctx IColumnlistContext) { + localctx = NewColumnlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 220, PostgreSQLParserRULE_columnlist) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3216) + p.ColumnElem() + } + p.SetState(3221) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(3217) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3218) + p.ColumnElem() + } + + p.SetState(3223) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColumnElemContext is an interface to support dynamic dispatch. +type IColumnElemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + + // IsColumnElemContext differentiates from other interfaces. + IsColumnElemContext() +} + +type ColumnElemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColumnElemContext() *ColumnElemContext { + var p = new(ColumnElemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnElem + return p +} + +func InitEmptyColumnElemContext(p *ColumnElemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnElem +} + +func (*ColumnElemContext) IsColumnElemContext() {} + +func NewColumnElemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColumnElemContext { + var p = new(ColumnElemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_columnElem + + return p +} + +func (s *ColumnElemContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColumnElemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *ColumnElemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColumnElemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColumnElemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColumnElem(s) + } +} + +func (s *ColumnElemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColumnElem(s) + } +} + +func (s *ColumnElemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColumnElem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) ColumnElem() (localctx IColumnElemContext) { + localctx = NewColumnElemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 222, PostgreSQLParserRULE_columnElem) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3224) + p.Colid() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_c_includeContext is an interface to support dynamic dispatch. +type IOpt_c_includeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INCLUDE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Columnlist() IColumnlistContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_c_includeContext differentiates from other interfaces. + IsOpt_c_includeContext() +} + +type Opt_c_includeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_c_includeContext() *Opt_c_includeContext { + var p = new(Opt_c_includeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_c_include + return p +} + +func InitEmptyOpt_c_includeContext(p *Opt_c_includeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_c_include +} + +func (*Opt_c_includeContext) IsOpt_c_includeContext() {} + +func NewOpt_c_includeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_c_includeContext { + var p = new(Opt_c_includeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_c_include + + return p +} + +func (s *Opt_c_includeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_c_includeContext) INCLUDE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINCLUDE, 0) +} + +func (s *Opt_c_includeContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_c_includeContext) Columnlist() IColumnlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnlistContext) +} + +func (s *Opt_c_includeContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_c_includeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_c_includeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_c_includeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_c_include(s) + } +} + +func (s *Opt_c_includeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_c_include(s) + } +} + +func (s *Opt_c_includeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_c_include(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_c_include() (localctx IOpt_c_includeContext) { + localctx = NewOpt_c_includeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 224, PostgreSQLParserRULE_opt_c_include) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3226) + p.Match(PostgreSQLParserINCLUDE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3227) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3228) + p.Columnlist() + } + { + p.SetState(3229) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IKey_matchContext is an interface to support dynamic dispatch. +type IKey_matchContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + MATCH() antlr.TerminalNode + FULL() antlr.TerminalNode + PARTIAL() antlr.TerminalNode + SIMPLE() antlr.TerminalNode + + // IsKey_matchContext differentiates from other interfaces. + IsKey_matchContext() +} + +type Key_matchContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyKey_matchContext() *Key_matchContext { + var p = new(Key_matchContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_match + return p +} + +func InitEmptyKey_matchContext(p *Key_matchContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_match +} + +func (*Key_matchContext) IsKey_matchContext() {} + +func NewKey_matchContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Key_matchContext { + var p = new(Key_matchContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_key_match + + return p +} + +func (s *Key_matchContext) GetParser() antlr.Parser { return s.parser } + +func (s *Key_matchContext) MATCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATCH, 0) +} + +func (s *Key_matchContext) FULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFULL, 0) +} + +func (s *Key_matchContext) PARTIAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTIAL, 0) +} + +func (s *Key_matchContext) SIMPLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSIMPLE, 0) +} + +func (s *Key_matchContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Key_matchContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Key_matchContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterKey_match(s) + } +} + +func (s *Key_matchContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitKey_match(s) + } +} + +func (s *Key_matchContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitKey_match(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Key_match() (localctx IKey_matchContext) { + localctx = NewKey_matchContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 226, PostgreSQLParserRULE_key_match) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3231) + p.Match(PostgreSQLParserMATCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3232) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFULL || _la == PostgreSQLParserPARTIAL || _la == PostgreSQLParserSIMPLE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExclusionconstraintlistContext is an interface to support dynamic dispatch. +type IExclusionconstraintlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllExclusionconstraintelem() []IExclusionconstraintelemContext + Exclusionconstraintelem(i int) IExclusionconstraintelemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsExclusionconstraintlistContext differentiates from other interfaces. + IsExclusionconstraintlistContext() +} + +type ExclusionconstraintlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExclusionconstraintlistContext() *ExclusionconstraintlistContext { + var p = new(ExclusionconstraintlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exclusionconstraintlist + return p +} + +func InitEmptyExclusionconstraintlistContext(p *ExclusionconstraintlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exclusionconstraintlist +} + +func (*ExclusionconstraintlistContext) IsExclusionconstraintlistContext() {} + +func NewExclusionconstraintlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExclusionconstraintlistContext { + var p = new(ExclusionconstraintlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_exclusionconstraintlist + + return p +} + +func (s *ExclusionconstraintlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExclusionconstraintlistContext) AllExclusionconstraintelem() []IExclusionconstraintelemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IExclusionconstraintelemContext); ok { + len++ + } + } + + tst := make([]IExclusionconstraintelemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IExclusionconstraintelemContext); ok { + tst[i] = t.(IExclusionconstraintelemContext) + i++ + } + } + + return tst +} + +func (s *ExclusionconstraintlistContext) Exclusionconstraintelem(i int) IExclusionconstraintelemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExclusionconstraintelemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IExclusionconstraintelemContext) +} + +func (s *ExclusionconstraintlistContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *ExclusionconstraintlistContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *ExclusionconstraintlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExclusionconstraintlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExclusionconstraintlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExclusionconstraintlist(s) + } +} + +func (s *ExclusionconstraintlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExclusionconstraintlist(s) + } +} + +func (s *ExclusionconstraintlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExclusionconstraintlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Exclusionconstraintlist() (localctx IExclusionconstraintlistContext) { + localctx = NewExclusionconstraintlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 228, PostgreSQLParserRULE_exclusionconstraintlist) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3234) + p.Exclusionconstraintelem() + } + p.SetState(3239) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(3235) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3236) + p.Exclusionconstraintelem() + } + + p.SetState(3241) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExclusionconstraintelemContext is an interface to support dynamic dispatch. +type IExclusionconstraintelemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Index_elem() IIndex_elemContext + WITH() antlr.TerminalNode + Any_operator() IAny_operatorContext + OPERATOR() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + + // IsExclusionconstraintelemContext differentiates from other interfaces. + IsExclusionconstraintelemContext() +} + +type ExclusionconstraintelemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExclusionconstraintelemContext() *ExclusionconstraintelemContext { + var p = new(ExclusionconstraintelemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exclusionconstraintelem + return p +} + +func InitEmptyExclusionconstraintelemContext(p *ExclusionconstraintelemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exclusionconstraintelem +} + +func (*ExclusionconstraintelemContext) IsExclusionconstraintelemContext() {} + +func NewExclusionconstraintelemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExclusionconstraintelemContext { + var p = new(ExclusionconstraintelemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_exclusionconstraintelem + + return p +} + +func (s *ExclusionconstraintelemContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExclusionconstraintelemContext) Index_elem() IIndex_elemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndex_elemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndex_elemContext) +} + +func (s *ExclusionconstraintelemContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *ExclusionconstraintelemContext) Any_operator() IAny_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_operatorContext) +} + +func (s *ExclusionconstraintelemContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *ExclusionconstraintelemContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ExclusionconstraintelemContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ExclusionconstraintelemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExclusionconstraintelemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExclusionconstraintelemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExclusionconstraintelem(s) + } +} + +func (s *ExclusionconstraintelemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExclusionconstraintelem(s) + } +} + +func (s *ExclusionconstraintelemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExclusionconstraintelem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Exclusionconstraintelem() (localctx IExclusionconstraintelemContext) { + localctx = NewExclusionconstraintelemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 230, PostgreSQLParserRULE_exclusionconstraintelem) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3242) + p.Index_elem() + } + { + p.SetState(3243) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3250) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 199, p.GetParserRuleContext()) { + case 1: + { + p.SetState(3244) + p.Any_operator() + } + + case 2: + { + p.SetState(3245) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3246) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3247) + p.Any_operator() + } + { + p.SetState(3248) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExclusionwhereclauseContext is an interface to support dynamic dispatch. +type IExclusionwhereclauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHERE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsExclusionwhereclauseContext differentiates from other interfaces. + IsExclusionwhereclauseContext() +} + +type ExclusionwhereclauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExclusionwhereclauseContext() *ExclusionwhereclauseContext { + var p = new(ExclusionwhereclauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exclusionwhereclause + return p +} + +func InitEmptyExclusionwhereclauseContext(p *ExclusionwhereclauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exclusionwhereclause +} + +func (*ExclusionwhereclauseContext) IsExclusionwhereclauseContext() {} + +func NewExclusionwhereclauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExclusionwhereclauseContext { + var p = new(ExclusionwhereclauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_exclusionwhereclause + + return p +} + +func (s *ExclusionwhereclauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExclusionwhereclauseContext) WHERE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHERE, 0) +} + +func (s *ExclusionwhereclauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ExclusionwhereclauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *ExclusionwhereclauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ExclusionwhereclauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExclusionwhereclauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExclusionwhereclauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExclusionwhereclause(s) + } +} + +func (s *ExclusionwhereclauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExclusionwhereclause(s) + } +} + +func (s *ExclusionwhereclauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExclusionwhereclause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Exclusionwhereclause() (localctx IExclusionwhereclauseContext) { + localctx = NewExclusionwhereclauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 232, PostgreSQLParserRULE_exclusionwhereclause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3252) + p.Match(PostgreSQLParserWHERE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3253) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3254) + p.A_expr() + } + { + p.SetState(3255) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IKey_actionsContext is an interface to support dynamic dispatch. +type IKey_actionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Key_update() IKey_updateContext + Key_delete() IKey_deleteContext + + // IsKey_actionsContext differentiates from other interfaces. + IsKey_actionsContext() +} + +type Key_actionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyKey_actionsContext() *Key_actionsContext { + var p = new(Key_actionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_actions + return p +} + +func InitEmptyKey_actionsContext(p *Key_actionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_actions +} + +func (*Key_actionsContext) IsKey_actionsContext() {} + +func NewKey_actionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Key_actionsContext { + var p = new(Key_actionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_key_actions + + return p +} + +func (s *Key_actionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Key_actionsContext) Key_update() IKey_updateContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IKey_updateContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IKey_updateContext) +} + +func (s *Key_actionsContext) Key_delete() IKey_deleteContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IKey_deleteContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IKey_deleteContext) +} + +func (s *Key_actionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Key_actionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Key_actionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterKey_actions(s) + } +} + +func (s *Key_actionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitKey_actions(s) + } +} + +func (s *Key_actionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitKey_actions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Key_actions() (localctx IKey_actionsContext) { + localctx = NewKey_actionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 234, PostgreSQLParserRULE_key_actions) + p.SetState(3265) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 200, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3257) + p.Key_update() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3258) + p.Key_delete() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3259) + p.Key_update() + } + { + p.SetState(3260) + p.Key_delete() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3262) + p.Key_delete() + } + { + p.SetState(3263) + p.Key_update() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IKey_updateContext is an interface to support dynamic dispatch. +type IKey_updateContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ON() antlr.TerminalNode + UPDATE() antlr.TerminalNode + Key_action() IKey_actionContext + + // IsKey_updateContext differentiates from other interfaces. + IsKey_updateContext() +} + +type Key_updateContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyKey_updateContext() *Key_updateContext { + var p = new(Key_updateContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_update + return p +} + +func InitEmptyKey_updateContext(p *Key_updateContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_update +} + +func (*Key_updateContext) IsKey_updateContext() {} + +func NewKey_updateContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Key_updateContext { + var p = new(Key_updateContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_key_update + + return p +} + +func (s *Key_updateContext) GetParser() antlr.Parser { return s.parser } + +func (s *Key_updateContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Key_updateContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *Key_updateContext) Key_action() IKey_actionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IKey_actionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IKey_actionContext) +} + +func (s *Key_updateContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Key_updateContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Key_updateContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterKey_update(s) + } +} + +func (s *Key_updateContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitKey_update(s) + } +} + +func (s *Key_updateContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitKey_update(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Key_update() (localctx IKey_updateContext) { + localctx = NewKey_updateContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 236, PostgreSQLParserRULE_key_update) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3267) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3268) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3269) + p.Key_action() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IKey_deleteContext is an interface to support dynamic dispatch. +type IKey_deleteContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ON() antlr.TerminalNode + DELETE_P() antlr.TerminalNode + Key_action() IKey_actionContext + + // IsKey_deleteContext differentiates from other interfaces. + IsKey_deleteContext() +} + +type Key_deleteContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyKey_deleteContext() *Key_deleteContext { + var p = new(Key_deleteContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_delete + return p +} + +func InitEmptyKey_deleteContext(p *Key_deleteContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_delete +} + +func (*Key_deleteContext) IsKey_deleteContext() {} + +func NewKey_deleteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Key_deleteContext { + var p = new(Key_deleteContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_key_delete + + return p +} + +func (s *Key_deleteContext) GetParser() antlr.Parser { return s.parser } + +func (s *Key_deleteContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Key_deleteContext) DELETE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELETE_P, 0) +} + +func (s *Key_deleteContext) Key_action() IKey_actionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IKey_actionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IKey_actionContext) +} + +func (s *Key_deleteContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Key_deleteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Key_deleteContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterKey_delete(s) + } +} + +func (s *Key_deleteContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitKey_delete(s) + } +} + +func (s *Key_deleteContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitKey_delete(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Key_delete() (localctx IKey_deleteContext) { + localctx = NewKey_deleteContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 238, PostgreSQLParserRULE_key_delete) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3271) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3272) + p.Match(PostgreSQLParserDELETE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3273) + p.Key_action() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IKey_actionContext is an interface to support dynamic dispatch. +type IKey_actionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NO() antlr.TerminalNode + ACTION() antlr.TerminalNode + RESTRICT() antlr.TerminalNode + CASCADE() antlr.TerminalNode + SET() antlr.TerminalNode + NULL_P() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + Opt_column_list() IOpt_column_listContext + + // IsKey_actionContext differentiates from other interfaces. + IsKey_actionContext() +} + +type Key_actionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyKey_actionContext() *Key_actionContext { + var p = new(Key_actionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_action + return p +} + +func InitEmptyKey_actionContext(p *Key_actionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_key_action +} + +func (*Key_actionContext) IsKey_actionContext() {} + +func NewKey_actionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Key_actionContext { + var p = new(Key_actionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_key_action + + return p +} + +func (s *Key_actionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Key_actionContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Key_actionContext) ACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACTION, 0) +} + +func (s *Key_actionContext) RESTRICT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESTRICT, 0) +} + +func (s *Key_actionContext) CASCADE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASCADE, 0) +} + +func (s *Key_actionContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Key_actionContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Key_actionContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Key_actionContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *Key_actionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Key_actionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Key_actionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterKey_action(s) + } +} + +func (s *Key_actionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitKey_action(s) + } +} + +func (s *Key_actionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitKey_action(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Key_action() (localctx IKey_actionContext) { + localctx = NewKey_actionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 240, PostgreSQLParserRULE_key_action) + var _la int + + p.SetState(3284) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNO: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3275) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3276) + p.Match(PostgreSQLParserACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserRESTRICT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3277) + p.Match(PostgreSQLParserRESTRICT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCASCADE: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3278) + p.Match(PostgreSQLParserCASCADE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSET: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3279) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3280) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserDEFAULT || _la == PostgreSQLParserNULL_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(3282) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 201, p.GetParserRuleContext()) == 1 { + { + p.SetState(3281) + p.Opt_column_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptinheritContext is an interface to support dynamic dispatch. +type IOptinheritContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INHERITS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Qualified_name_list() IQualified_name_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOptinheritContext differentiates from other interfaces. + IsOptinheritContext() +} + +type OptinheritContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptinheritContext() *OptinheritContext { + var p = new(OptinheritContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optinherit + return p +} + +func InitEmptyOptinheritContext(p *OptinheritContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optinherit +} + +func (*OptinheritContext) IsOptinheritContext() {} + +func NewOptinheritContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptinheritContext { + var p = new(OptinheritContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optinherit + + return p +} + +func (s *OptinheritContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptinheritContext) INHERITS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINHERITS, 0) +} + +func (s *OptinheritContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *OptinheritContext) Qualified_name_list() IQualified_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_name_listContext) +} + +func (s *OptinheritContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *OptinheritContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptinheritContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptinheritContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptinherit(s) + } +} + +func (s *OptinheritContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptinherit(s) + } +} + +func (s *OptinheritContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptinherit(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optinherit() (localctx IOptinheritContext) { + localctx = NewOptinheritContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 242, PostgreSQLParserRULE_optinherit) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3286) + p.Match(PostgreSQLParserINHERITS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3287) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3288) + p.Qualified_name_list() + } + { + p.SetState(3289) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptpartitionspecContext is an interface to support dynamic dispatch. +type IOptpartitionspecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Partitionspec() IPartitionspecContext + + // IsOptpartitionspecContext differentiates from other interfaces. + IsOptpartitionspecContext() +} + +type OptpartitionspecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptpartitionspecContext() *OptpartitionspecContext { + var p = new(OptpartitionspecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optpartitionspec + return p +} + +func InitEmptyOptpartitionspecContext(p *OptpartitionspecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optpartitionspec +} + +func (*OptpartitionspecContext) IsOptpartitionspecContext() {} + +func NewOptpartitionspecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptpartitionspecContext { + var p = new(OptpartitionspecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optpartitionspec + + return p +} + +func (s *OptpartitionspecContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptpartitionspecContext) Partitionspec() IPartitionspecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPartitionspecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPartitionspecContext) +} + +func (s *OptpartitionspecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptpartitionspecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptpartitionspecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptpartitionspec(s) + } +} + +func (s *OptpartitionspecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptpartitionspec(s) + } +} + +func (s *OptpartitionspecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptpartitionspec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optpartitionspec() (localctx IOptpartitionspecContext) { + localctx = NewOptpartitionspecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 244, PostgreSQLParserRULE_optpartitionspec) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3291) + p.Partitionspec() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPartitionspecContext is an interface to support dynamic dispatch. +type IPartitionspecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PARTITION() antlr.TerminalNode + BY() antlr.TerminalNode + Colid() IColidContext + OPEN_PAREN() antlr.TerminalNode + Part_params() IPart_paramsContext + CLOSE_PAREN() antlr.TerminalNode + + // IsPartitionspecContext differentiates from other interfaces. + IsPartitionspecContext() +} + +type PartitionspecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPartitionspecContext() *PartitionspecContext { + var p = new(PartitionspecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_partitionspec + return p +} + +func InitEmptyPartitionspecContext(p *PartitionspecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_partitionspec +} + +func (*PartitionspecContext) IsPartitionspecContext() {} + +func NewPartitionspecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PartitionspecContext { + var p = new(PartitionspecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_partitionspec + + return p +} + +func (s *PartitionspecContext) GetParser() antlr.Parser { return s.parser } + +func (s *PartitionspecContext) PARTITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTITION, 0) +} + +func (s *PartitionspecContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *PartitionspecContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *PartitionspecContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *PartitionspecContext) Part_params() IPart_paramsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPart_paramsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPart_paramsContext) +} + +func (s *PartitionspecContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *PartitionspecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PartitionspecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PartitionspecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPartitionspec(s) + } +} + +func (s *PartitionspecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPartitionspec(s) + } +} + +func (s *PartitionspecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPartitionspec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Partitionspec() (localctx IPartitionspecContext) { + localctx = NewPartitionspecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 246, PostgreSQLParserRULE_partitionspec) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3293) + p.Match(PostgreSQLParserPARTITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3294) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3295) + p.Colid() + } + { + p.SetState(3296) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3297) + p.Part_params() + } + { + p.SetState(3298) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPart_paramsContext is an interface to support dynamic dispatch. +type IPart_paramsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllPart_elem() []IPart_elemContext + Part_elem(i int) IPart_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsPart_paramsContext differentiates from other interfaces. + IsPart_paramsContext() +} + +type Part_paramsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPart_paramsContext() *Part_paramsContext { + var p = new(Part_paramsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_part_params + return p +} + +func InitEmptyPart_paramsContext(p *Part_paramsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_part_params +} + +func (*Part_paramsContext) IsPart_paramsContext() {} + +func NewPart_paramsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Part_paramsContext { + var p = new(Part_paramsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_part_params + + return p +} + +func (s *Part_paramsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Part_paramsContext) AllPart_elem() []IPart_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IPart_elemContext); ok { + len++ + } + } + + tst := make([]IPart_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IPart_elemContext); ok { + tst[i] = t.(IPart_elemContext) + i++ + } + } + + return tst +} + +func (s *Part_paramsContext) Part_elem(i int) IPart_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPart_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IPart_elemContext) +} + +func (s *Part_paramsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Part_paramsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Part_paramsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Part_paramsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Part_paramsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPart_params(s) + } +} + +func (s *Part_paramsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPart_params(s) + } +} + +func (s *Part_paramsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPart_params(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Part_params() (localctx IPart_paramsContext) { + localctx = NewPart_paramsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 248, PostgreSQLParserRULE_part_params) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3300) + p.Part_elem() + } + p.SetState(3305) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(3301) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3302) + p.Part_elem() + } + + p.SetState(3307) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPart_elemContext is an interface to support dynamic dispatch. +type IPart_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Opt_collate() IOpt_collateContext + Opt_class() IOpt_classContext + Func_expr_windowless() IFunc_expr_windowlessContext + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsPart_elemContext differentiates from other interfaces. + IsPart_elemContext() +} + +type Part_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPart_elemContext() *Part_elemContext { + var p = new(Part_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_part_elem + return p +} + +func InitEmptyPart_elemContext(p *Part_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_part_elem +} + +func (*Part_elemContext) IsPart_elemContext() {} + +func NewPart_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Part_elemContext { + var p = new(Part_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_part_elem + + return p +} + +func (s *Part_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Part_elemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Part_elemContext) Opt_collate() IOpt_collateContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_collateContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_collateContext) +} + +func (s *Part_elemContext) Opt_class() IOpt_classContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_classContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_classContext) +} + +func (s *Part_elemContext) Func_expr_windowless() IFunc_expr_windowlessContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_expr_windowlessContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_expr_windowlessContext) +} + +func (s *Part_elemContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Part_elemContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Part_elemContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Part_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Part_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Part_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPart_elem(s) + } +} + +func (s *Part_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPart_elem(s) + } +} + +func (s *Part_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPart_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Part_elem() (localctx IPart_elemContext) { + localctx = NewPart_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 250, PostgreSQLParserRULE_part_elem) + var _la int + + p.SetState(3331) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 210, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3308) + p.Colid() + } + p.SetState(3310) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 204, p.GetParserRuleContext()) == 1 { + { + p.SetState(3309) + p.Opt_collate() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3313) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(3312) + p.Opt_class() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3315) + p.Func_expr_windowless() + } + p.SetState(3317) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 206, p.GetParserRuleContext()) == 1 { + { + p.SetState(3316) + p.Opt_collate() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3320) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(3319) + p.Opt_class() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3322) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3323) + p.A_expr() + } + { + p.SetState(3324) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3326) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 208, p.GetParserRuleContext()) == 1 { + { + p.SetState(3325) + p.Opt_collate() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3329) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(3328) + p.Opt_class() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITable_access_method_clauseContext is an interface to support dynamic dispatch. +type ITable_access_method_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + Name() INameContext + + // IsTable_access_method_clauseContext differentiates from other interfaces. + IsTable_access_method_clauseContext() +} + +type Table_access_method_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTable_access_method_clauseContext() *Table_access_method_clauseContext { + var p = new(Table_access_method_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_access_method_clause + return p +} + +func InitEmptyTable_access_method_clauseContext(p *Table_access_method_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_access_method_clause +} + +func (*Table_access_method_clauseContext) IsTable_access_method_clauseContext() {} + +func NewTable_access_method_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_access_method_clauseContext { + var p = new(Table_access_method_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_table_access_method_clause + + return p +} + +func (s *Table_access_method_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Table_access_method_clauseContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Table_access_method_clauseContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Table_access_method_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Table_access_method_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Table_access_method_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTable_access_method_clause(s) + } +} + +func (s *Table_access_method_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTable_access_method_clause(s) + } +} + +func (s *Table_access_method_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTable_access_method_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Table_access_method_clause() (localctx ITable_access_method_clauseContext) { + localctx = NewTable_access_method_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 252, PostgreSQLParserRULE_table_access_method_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3333) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3334) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptwithContext is an interface to support dynamic dispatch. +type IOptwithContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + Reloptions() IReloptionsContext + WITHOUT() antlr.TerminalNode + OIDS() antlr.TerminalNode + + // IsOptwithContext differentiates from other interfaces. + IsOptwithContext() +} + +type OptwithContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptwithContext() *OptwithContext { + var p = new(OptwithContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optwith + return p +} + +func InitEmptyOptwithContext(p *OptwithContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optwith +} + +func (*OptwithContext) IsOptwithContext() {} + +func NewOptwithContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptwithContext { + var p = new(OptwithContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optwith + + return p +} + +func (s *OptwithContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptwithContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *OptwithContext) Reloptions() IReloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReloptionsContext) +} + +func (s *OptwithContext) WITHOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITHOUT, 0) +} + +func (s *OptwithContext) OIDS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOIDS, 0) +} + +func (s *OptwithContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptwithContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptwithContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptwith(s) + } +} + +func (s *OptwithContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptwith(s) + } +} + +func (s *OptwithContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptwith(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optwith() (localctx IOptwithContext) { + localctx = NewOptwithContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 254, PostgreSQLParserRULE_optwith) + p.SetState(3340) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserWITH: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3336) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3337) + p.Reloptions() + } + + case PostgreSQLParserWITHOUT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3338) + p.Match(PostgreSQLParserWITHOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3339) + p.Match(PostgreSQLParserOIDS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOncommitoptionContext is an interface to support dynamic dispatch. +type IOncommitoptionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ON() antlr.TerminalNode + COMMIT() antlr.TerminalNode + DROP() antlr.TerminalNode + DELETE_P() antlr.TerminalNode + ROWS() antlr.TerminalNode + PRESERVE() antlr.TerminalNode + + // IsOncommitoptionContext differentiates from other interfaces. + IsOncommitoptionContext() +} + +type OncommitoptionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOncommitoptionContext() *OncommitoptionContext { + var p = new(OncommitoptionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_oncommitoption + return p +} + +func InitEmptyOncommitoptionContext(p *OncommitoptionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_oncommitoption +} + +func (*OncommitoptionContext) IsOncommitoptionContext() {} + +func NewOncommitoptionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OncommitoptionContext { + var p = new(OncommitoptionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_oncommitoption + + return p +} + +func (s *OncommitoptionContext) GetParser() antlr.Parser { return s.parser } + +func (s *OncommitoptionContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *OncommitoptionContext) COMMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMIT, 0) +} + +func (s *OncommitoptionContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *OncommitoptionContext) DELETE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELETE_P, 0) +} + +func (s *OncommitoptionContext) ROWS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROWS, 0) +} + +func (s *OncommitoptionContext) PRESERVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRESERVE, 0) +} + +func (s *OncommitoptionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OncommitoptionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OncommitoptionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOncommitoption(s) + } +} + +func (s *OncommitoptionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOncommitoption(s) + } +} + +func (s *OncommitoptionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOncommitoption(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Oncommitoption() (localctx IOncommitoptionContext) { + localctx = NewOncommitoptionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 256, PostgreSQLParserRULE_oncommitoption) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3342) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3343) + p.Match(PostgreSQLParserCOMMIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3349) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserDROP: + { + p.SetState(3344) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDELETE_P: + { + p.SetState(3345) + p.Match(PostgreSQLParserDELETE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3346) + p.Match(PostgreSQLParserROWS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserPRESERVE: + { + p.SetState(3347) + p.Match(PostgreSQLParserPRESERVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3348) + p.Match(PostgreSQLParserROWS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpttablespaceContext is an interface to support dynamic dispatch. +type IOpttablespaceContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TABLESPACE() antlr.TerminalNode + Name() INameContext + + // IsOpttablespaceContext differentiates from other interfaces. + IsOpttablespaceContext() +} + +type OpttablespaceContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpttablespaceContext() *OpttablespaceContext { + var p = new(OpttablespaceContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttablespace + return p +} + +func InitEmptyOpttablespaceContext(p *OpttablespaceContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttablespace +} + +func (*OpttablespaceContext) IsOpttablespaceContext() {} + +func NewOpttablespaceContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OpttablespaceContext { + var p = new(OpttablespaceContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opttablespace + + return p +} + +func (s *OpttablespaceContext) GetParser() antlr.Parser { return s.parser } + +func (s *OpttablespaceContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *OpttablespaceContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *OpttablespaceContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OpttablespaceContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OpttablespaceContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpttablespace(s) + } +} + +func (s *OpttablespaceContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpttablespace(s) + } +} + +func (s *OpttablespaceContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpttablespace(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opttablespace() (localctx IOpttablespaceContext) { + localctx = NewOpttablespaceContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 258, PostgreSQLParserRULE_opttablespace) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3351) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3352) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptconstablespaceContext is an interface to support dynamic dispatch. +type IOptconstablespaceContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + INDEX() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + Name() INameContext + + // IsOptconstablespaceContext differentiates from other interfaces. + IsOptconstablespaceContext() +} + +type OptconstablespaceContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptconstablespaceContext() *OptconstablespaceContext { + var p = new(OptconstablespaceContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optconstablespace + return p +} + +func InitEmptyOptconstablespaceContext(p *OptconstablespaceContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optconstablespace +} + +func (*OptconstablespaceContext) IsOptconstablespaceContext() {} + +func NewOptconstablespaceContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptconstablespaceContext { + var p = new(OptconstablespaceContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optconstablespace + + return p +} + +func (s *OptconstablespaceContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptconstablespaceContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *OptconstablespaceContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *OptconstablespaceContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *OptconstablespaceContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *OptconstablespaceContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptconstablespaceContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptconstablespaceContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptconstablespace(s) + } +} + +func (s *OptconstablespaceContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptconstablespace(s) + } +} + +func (s *OptconstablespaceContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptconstablespace(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optconstablespace() (localctx IOptconstablespaceContext) { + localctx = NewOptconstablespaceContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 260, PostgreSQLParserRULE_optconstablespace) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3354) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3355) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3356) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3357) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExistingindexContext is an interface to support dynamic dispatch. +type IExistingindexContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + INDEX() antlr.TerminalNode + Name() INameContext + + // IsExistingindexContext differentiates from other interfaces. + IsExistingindexContext() +} + +type ExistingindexContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExistingindexContext() *ExistingindexContext { + var p = new(ExistingindexContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_existingindex + return p +} + +func InitEmptyExistingindexContext(p *ExistingindexContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_existingindex +} + +func (*ExistingindexContext) IsExistingindexContext() {} + +func NewExistingindexContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExistingindexContext { + var p = new(ExistingindexContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_existingindex + + return p +} + +func (s *ExistingindexContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExistingindexContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *ExistingindexContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *ExistingindexContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *ExistingindexContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExistingindexContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExistingindexContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExistingindex(s) + } +} + +func (s *ExistingindexContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExistingindex(s) + } +} + +func (s *ExistingindexContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExistingindex(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Existingindex() (localctx IExistingindexContext) { + localctx = NewExistingindexContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 262, PostgreSQLParserRULE_existingindex) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3359) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3360) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3361) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatestatsstmtContext is an interface to support dynamic dispatch. +type ICreatestatsstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + STATISTICS() antlr.TerminalNode + Any_name() IAny_nameContext + ON() antlr.TerminalNode + Expr_list() IExpr_listContext + FROM() antlr.TerminalNode + From_list() IFrom_listContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Opt_name_list() IOpt_name_listContext + + // IsCreatestatsstmtContext differentiates from other interfaces. + IsCreatestatsstmtContext() +} + +type CreatestatsstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatestatsstmtContext() *CreatestatsstmtContext { + var p = new(CreatestatsstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createstatsstmt + return p +} + +func InitEmptyCreatestatsstmtContext(p *CreatestatsstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createstatsstmt +} + +func (*CreatestatsstmtContext) IsCreatestatsstmtContext() {} + +func NewCreatestatsstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatestatsstmtContext { + var p = new(CreatestatsstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createstatsstmt + + return p +} + +func (s *CreatestatsstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatestatsstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatestatsstmtContext) STATISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, 0) +} + +func (s *CreatestatsstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *CreatestatsstmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *CreatestatsstmtContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *CreatestatsstmtContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *CreatestatsstmtContext) From_list() IFrom_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_listContext) +} + +func (s *CreatestatsstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreatestatsstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreatestatsstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreatestatsstmtContext) Opt_name_list() IOpt_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_name_listContext) +} + +func (s *CreatestatsstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatestatsstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatestatsstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatestatsstmt(s) + } +} + +func (s *CreatestatsstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatestatsstmt(s) + } +} + +func (s *CreatestatsstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatestatsstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createstatsstmt() (localctx ICreatestatsstmtContext) { + localctx = NewCreatestatsstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 264, PostgreSQLParserRULE_createstatsstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3363) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3364) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3368) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 213, p.GetParserRuleContext()) == 1 { + { + p.SetState(3365) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3366) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3367) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3370) + p.Any_name() + } + p.SetState(3372) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(3371) + p.Opt_name_list() + } + + } + { + p.SetState(3374) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3375) + p.Expr_list() + } + { + p.SetState(3376) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3377) + p.From_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterstatsstmtContext is an interface to support dynamic dispatch. +type IAlterstatsstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + AllSTATISTICS() []antlr.TerminalNode + STATISTICS(i int) antlr.TerminalNode + Any_name() IAny_nameContext + SET() antlr.TerminalNode + Signediconst() ISignediconstContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsAlterstatsstmtContext differentiates from other interfaces. + IsAlterstatsstmtContext() +} + +type AlterstatsstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterstatsstmtContext() *AlterstatsstmtContext { + var p = new(AlterstatsstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterstatsstmt + return p +} + +func InitEmptyAlterstatsstmtContext(p *AlterstatsstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterstatsstmt +} + +func (*AlterstatsstmtContext) IsAlterstatsstmtContext() {} + +func NewAlterstatsstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterstatsstmtContext { + var p = new(AlterstatsstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterstatsstmt + + return p +} + +func (s *AlterstatsstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterstatsstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterstatsstmtContext) AllSTATISTICS() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserSTATISTICS) +} + +func (s *AlterstatsstmtContext) STATISTICS(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, i) +} + +func (s *AlterstatsstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AlterstatsstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AlterstatsstmtContext) Signediconst() ISignediconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISignediconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISignediconstContext) +} + +func (s *AlterstatsstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *AlterstatsstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *AlterstatsstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterstatsstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterstatsstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterstatsstmt(s) + } +} + +func (s *AlterstatsstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterstatsstmt(s) + } +} + +func (s *AlterstatsstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterstatsstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterstatsstmt() (localctx IAlterstatsstmtContext) { + localctx = NewAlterstatsstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 266, PostgreSQLParserRULE_alterstatsstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3379) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3380) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3383) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 215, p.GetParserRuleContext()) == 1 { + { + p.SetState(3381) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3382) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3385) + p.Any_name() + } + { + p.SetState(3386) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3387) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3388) + p.Signediconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateasstmtContext is an interface to support dynamic dispatch. +type ICreateasstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + TABLE() antlr.TerminalNode + Create_as_target() ICreate_as_targetContext + AS() antlr.TerminalNode + Selectstmt() ISelectstmtContext + Opttemp() IOpttempContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Opt_with_data() IOpt_with_dataContext + + // IsCreateasstmtContext differentiates from other interfaces. + IsCreateasstmtContext() +} + +type CreateasstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateasstmtContext() *CreateasstmtContext { + var p = new(CreateasstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createasstmt + return p +} + +func InitEmptyCreateasstmtContext(p *CreateasstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createasstmt +} + +func (*CreateasstmtContext) IsCreateasstmtContext() {} + +func NewCreateasstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateasstmtContext { + var p = new(CreateasstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createasstmt + + return p +} + +func (s *CreateasstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateasstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateasstmtContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *CreateasstmtContext) Create_as_target() ICreate_as_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_as_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_as_targetContext) +} + +func (s *CreateasstmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *CreateasstmtContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *CreateasstmtContext) Opttemp() IOpttempContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttempContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttempContext) +} + +func (s *CreateasstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreateasstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreateasstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreateasstmtContext) Opt_with_data() IOpt_with_dataContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_with_dataContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_with_dataContext) +} + +func (s *CreateasstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateasstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateasstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateasstmt(s) + } +} + +func (s *CreateasstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateasstmt(s) + } +} + +func (s *CreateasstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateasstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createasstmt() (localctx ICreateasstmtContext) { + localctx = NewCreateasstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 268, PostgreSQLParserRULE_createasstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3390) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3392) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGLOBAL || _la == PostgreSQLParserLOCAL || ((int64((_la-345)) & ^0x3f) == 0 && ((int64(1)<<(_la-345))&32773) != 0) { + { + p.SetState(3391) + p.Opttemp() + } + + } + { + p.SetState(3394) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3398) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 217, p.GetParserRuleContext()) == 1 { + { + p.SetState(3395) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3396) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3397) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3400) + p.Create_as_target() + } + { + p.SetState(3401) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3402) + p.Selectstmt() + } + p.SetState(3404) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 218, p.GetParserRuleContext()) == 1 { + { + p.SetState(3403) + p.Opt_with_data() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreate_as_targetContext is an interface to support dynamic dispatch. +type ICreate_as_targetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Qualified_name() IQualified_nameContext + Opt_column_list() IOpt_column_listContext + Table_access_method_clause() ITable_access_method_clauseContext + Optwith() IOptwithContext + Oncommitoption() IOncommitoptionContext + Opttablespace() IOpttablespaceContext + + // IsCreate_as_targetContext differentiates from other interfaces. + IsCreate_as_targetContext() +} + +type Create_as_targetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreate_as_targetContext() *Create_as_targetContext { + var p = new(Create_as_targetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_as_target + return p +} + +func InitEmptyCreate_as_targetContext(p *Create_as_targetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_as_target +} + +func (*Create_as_targetContext) IsCreate_as_targetContext() {} + +func NewCreate_as_targetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_as_targetContext { + var p = new(Create_as_targetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_create_as_target + + return p +} + +func (s *Create_as_targetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Create_as_targetContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Create_as_targetContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *Create_as_targetContext) Table_access_method_clause() ITable_access_method_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_access_method_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITable_access_method_clauseContext) +} + +func (s *Create_as_targetContext) Optwith() IOptwithContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptwithContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptwithContext) +} + +func (s *Create_as_targetContext) Oncommitoption() IOncommitoptionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOncommitoptionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOncommitoptionContext) +} + +func (s *Create_as_targetContext) Opttablespace() IOpttablespaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttablespaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttablespaceContext) +} + +func (s *Create_as_targetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Create_as_targetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Create_as_targetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreate_as_target(s) + } +} + +func (s *Create_as_targetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreate_as_target(s) + } +} + +func (s *Create_as_targetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreate_as_target(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Create_as_target() (localctx ICreate_as_targetContext) { + localctx = NewCreate_as_targetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 270, PostgreSQLParserRULE_create_as_target) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3406) + p.Qualified_name() + } + p.SetState(3408) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(3407) + p.Opt_column_list() + } + + } + p.SetState(3411) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(3410) + p.Table_access_method_clause() + } + + } + p.SetState(3414) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH || _la == PostgreSQLParserWITHOUT { + { + p.SetState(3413) + p.Optwith() + } + + } + p.SetState(3417) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserON { + { + p.SetState(3416) + p.Oncommitoption() + } + + } + p.SetState(3420) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTABLESPACE { + { + p.SetState(3419) + p.Opttablespace() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_with_dataContext is an interface to support dynamic dispatch. +type IOpt_with_dataContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + DATA_P() antlr.TerminalNode + NO() antlr.TerminalNode + + // IsOpt_with_dataContext differentiates from other interfaces. + IsOpt_with_dataContext() +} + +type Opt_with_dataContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_with_dataContext() *Opt_with_dataContext { + var p = new(Opt_with_dataContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_with_data + return p +} + +func InitEmptyOpt_with_dataContext(p *Opt_with_dataContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_with_data +} + +func (*Opt_with_dataContext) IsOpt_with_dataContext() {} + +func NewOpt_with_dataContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_with_dataContext { + var p = new(Opt_with_dataContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_with_data + + return p +} + +func (s *Opt_with_dataContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_with_dataContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_with_dataContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *Opt_with_dataContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Opt_with_dataContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_with_dataContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_with_dataContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_with_data(s) + } +} + +func (s *Opt_with_dataContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_with_data(s) + } +} + +func (s *Opt_with_dataContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_with_data(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_with_data() (localctx IOpt_with_dataContext) { + localctx = NewOpt_with_dataContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 272, PostgreSQLParserRULE_opt_with_data) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3422) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3426) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserDATA_P: + { + p.SetState(3423) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNO: + { + p.SetState(3424) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3425) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatematviewstmtContext is an interface to support dynamic dispatch. +type ICreatematviewstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + MATERIALIZED() antlr.TerminalNode + VIEW() antlr.TerminalNode + Create_mv_target() ICreate_mv_targetContext + AS() antlr.TerminalNode + Selectstmt() ISelectstmtContext + Optnolog() IOptnologContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Opt_with_data() IOpt_with_dataContext + + // IsCreatematviewstmtContext differentiates from other interfaces. + IsCreatematviewstmtContext() +} + +type CreatematviewstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatematviewstmtContext() *CreatematviewstmtContext { + var p = new(CreatematviewstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_creatematviewstmt + return p +} + +func InitEmptyCreatematviewstmtContext(p *CreatematviewstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_creatematviewstmt +} + +func (*CreatematviewstmtContext) IsCreatematviewstmtContext() {} + +func NewCreatematviewstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatematviewstmtContext { + var p = new(CreatematviewstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_creatematviewstmt + + return p +} + +func (s *CreatematviewstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatematviewstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatematviewstmtContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *CreatematviewstmtContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *CreatematviewstmtContext) Create_mv_target() ICreate_mv_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_mv_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_mv_targetContext) +} + +func (s *CreatematviewstmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *CreatematviewstmtContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *CreatematviewstmtContext) Optnolog() IOptnologContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptnologContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptnologContext) +} + +func (s *CreatematviewstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreatematviewstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreatematviewstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreatematviewstmtContext) Opt_with_data() IOpt_with_dataContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_with_dataContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_with_dataContext) +} + +func (s *CreatematviewstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatematviewstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatematviewstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatematviewstmt(s) + } +} + +func (s *CreatematviewstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatematviewstmt(s) + } +} + +func (s *CreatematviewstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatematviewstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Creatematviewstmt() (localctx ICreatematviewstmtContext) { + localctx = NewCreatematviewstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 274, PostgreSQLParserRULE_creatematviewstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3428) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3430) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUNLOGGED { + { + p.SetState(3429) + p.Optnolog() + } + + } + { + p.SetState(3432) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3433) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3437) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 226, p.GetParserRuleContext()) == 1 { + { + p.SetState(3434) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3435) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3436) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3439) + p.Create_mv_target() + } + { + p.SetState(3440) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3441) + p.Selectstmt() + } + p.SetState(3443) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 227, p.GetParserRuleContext()) == 1 { + { + p.SetState(3442) + p.Opt_with_data() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreate_mv_targetContext is an interface to support dynamic dispatch. +type ICreate_mv_targetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Qualified_name() IQualified_nameContext + Opt_column_list() IOpt_column_listContext + Table_access_method_clause() ITable_access_method_clauseContext + Opt_reloptions() IOpt_reloptionsContext + Opttablespace() IOpttablespaceContext + + // IsCreate_mv_targetContext differentiates from other interfaces. + IsCreate_mv_targetContext() +} + +type Create_mv_targetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreate_mv_targetContext() *Create_mv_targetContext { + var p = new(Create_mv_targetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_mv_target + return p +} + +func InitEmptyCreate_mv_targetContext(p *Create_mv_targetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_mv_target +} + +func (*Create_mv_targetContext) IsCreate_mv_targetContext() {} + +func NewCreate_mv_targetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_mv_targetContext { + var p = new(Create_mv_targetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_create_mv_target + + return p +} + +func (s *Create_mv_targetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Create_mv_targetContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Create_mv_targetContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *Create_mv_targetContext) Table_access_method_clause() ITable_access_method_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_access_method_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITable_access_method_clauseContext) +} + +func (s *Create_mv_targetContext) Opt_reloptions() IOpt_reloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_reloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_reloptionsContext) +} + +func (s *Create_mv_targetContext) Opttablespace() IOpttablespaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttablespaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttablespaceContext) +} + +func (s *Create_mv_targetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Create_mv_targetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Create_mv_targetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreate_mv_target(s) + } +} + +func (s *Create_mv_targetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreate_mv_target(s) + } +} + +func (s *Create_mv_targetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreate_mv_target(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Create_mv_target() (localctx ICreate_mv_targetContext) { + localctx = NewCreate_mv_targetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 276, PostgreSQLParserRULE_create_mv_target) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3445) + p.Qualified_name() + } + p.SetState(3447) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(3446) + p.Opt_column_list() + } + + } + p.SetState(3450) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(3449) + p.Table_access_method_clause() + } + + } + p.SetState(3453) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(3452) + p.Opt_reloptions() + } + + } + p.SetState(3456) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTABLESPACE { + { + p.SetState(3455) + p.Opttablespace() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptnologContext is an interface to support dynamic dispatch. +type IOptnologContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + UNLOGGED() antlr.TerminalNode + + // IsOptnologContext differentiates from other interfaces. + IsOptnologContext() +} + +type OptnologContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptnologContext() *OptnologContext { + var p = new(OptnologContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optnolog + return p +} + +func InitEmptyOptnologContext(p *OptnologContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optnolog +} + +func (*OptnologContext) IsOptnologContext() {} + +func NewOptnologContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptnologContext { + var p = new(OptnologContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optnolog + + return p +} + +func (s *OptnologContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptnologContext) UNLOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNLOGGED, 0) +} + +func (s *OptnologContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptnologContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptnologContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptnolog(s) + } +} + +func (s *OptnologContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptnolog(s) + } +} + +func (s *OptnologContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptnolog(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optnolog() (localctx IOptnologContext) { + localctx = NewOptnologContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 278, PostgreSQLParserRULE_optnolog) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3458) + p.Match(PostgreSQLParserUNLOGGED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRefreshmatviewstmtContext is an interface to support dynamic dispatch. +type IRefreshmatviewstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + REFRESH() antlr.TerminalNode + MATERIALIZED() antlr.TerminalNode + VIEW() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Opt_concurrently() IOpt_concurrentlyContext + Opt_with_data() IOpt_with_dataContext + + // IsRefreshmatviewstmtContext differentiates from other interfaces. + IsRefreshmatviewstmtContext() +} + +type RefreshmatviewstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRefreshmatviewstmtContext() *RefreshmatviewstmtContext { + var p = new(RefreshmatviewstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_refreshmatviewstmt + return p +} + +func InitEmptyRefreshmatviewstmtContext(p *RefreshmatviewstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_refreshmatviewstmt +} + +func (*RefreshmatviewstmtContext) IsRefreshmatviewstmtContext() {} + +func NewRefreshmatviewstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RefreshmatviewstmtContext { + var p = new(RefreshmatviewstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_refreshmatviewstmt + + return p +} + +func (s *RefreshmatviewstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RefreshmatviewstmtContext) REFRESH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFRESH, 0) +} + +func (s *RefreshmatviewstmtContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *RefreshmatviewstmtContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *RefreshmatviewstmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *RefreshmatviewstmtContext) Opt_concurrently() IOpt_concurrentlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_concurrentlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_concurrentlyContext) +} + +func (s *RefreshmatviewstmtContext) Opt_with_data() IOpt_with_dataContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_with_dataContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_with_dataContext) +} + +func (s *RefreshmatviewstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RefreshmatviewstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RefreshmatviewstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRefreshmatviewstmt(s) + } +} + +func (s *RefreshmatviewstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRefreshmatviewstmt(s) + } +} + +func (s *RefreshmatviewstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRefreshmatviewstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Refreshmatviewstmt() (localctx IRefreshmatviewstmtContext) { + localctx = NewRefreshmatviewstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 280, PostgreSQLParserRULE_refreshmatviewstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3460) + p.Match(PostgreSQLParserREFRESH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3461) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3462) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3464) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCONCURRENTLY { + { + p.SetState(3463) + p.Opt_concurrently() + } + + } + { + p.SetState(3466) + p.Qualified_name() + } + p.SetState(3468) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 233, p.GetParserRuleContext()) == 1 { + { + p.SetState(3467) + p.Opt_with_data() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateseqstmtContext is an interface to support dynamic dispatch. +type ICreateseqstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + SEQUENCE() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Opttemp() IOpttempContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Optseqoptlist() IOptseqoptlistContext + + // IsCreateseqstmtContext differentiates from other interfaces. + IsCreateseqstmtContext() +} + +type CreateseqstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateseqstmtContext() *CreateseqstmtContext { + var p = new(CreateseqstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createseqstmt + return p +} + +func InitEmptyCreateseqstmtContext(p *CreateseqstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createseqstmt +} + +func (*CreateseqstmtContext) IsCreateseqstmtContext() {} + +func NewCreateseqstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateseqstmtContext { + var p = new(CreateseqstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createseqstmt + + return p +} + +func (s *CreateseqstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateseqstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateseqstmtContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *CreateseqstmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *CreateseqstmtContext) Opttemp() IOpttempContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttempContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttempContext) +} + +func (s *CreateseqstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreateseqstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreateseqstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreateseqstmtContext) Optseqoptlist() IOptseqoptlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptseqoptlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptseqoptlistContext) +} + +func (s *CreateseqstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateseqstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateseqstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateseqstmt(s) + } +} + +func (s *CreateseqstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateseqstmt(s) + } +} + +func (s *CreateseqstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateseqstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createseqstmt() (localctx ICreateseqstmtContext) { + localctx = NewCreateseqstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 282, PostgreSQLParserRULE_createseqstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3470) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3472) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGLOBAL || _la == PostgreSQLParserLOCAL || ((int64((_la-345)) & ^0x3f) == 0 && ((int64(1)<<(_la-345))&32773) != 0) { + { + p.SetState(3471) + p.Opttemp() + } + + } + { + p.SetState(3474) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3478) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 235, p.GetParserRuleContext()) == 1 { + { + p.SetState(3475) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3476) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3477) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3480) + p.Qualified_name() + } + p.SetState(3482) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 236, p.GetParserRuleContext()) == 1 { + { + p.SetState(3481) + p.Optseqoptlist() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterseqstmtContext is an interface to support dynamic dispatch. +type IAlterseqstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + SEQUENCE() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Seqoptlist() ISeqoptlistContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsAlterseqstmtContext differentiates from other interfaces. + IsAlterseqstmtContext() +} + +type AlterseqstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterseqstmtContext() *AlterseqstmtContext { + var p = new(AlterseqstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterseqstmt + return p +} + +func InitEmptyAlterseqstmtContext(p *AlterseqstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterseqstmt +} + +func (*AlterseqstmtContext) IsAlterseqstmtContext() {} + +func NewAlterseqstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterseqstmtContext { + var p = new(AlterseqstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterseqstmt + + return p +} + +func (s *AlterseqstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterseqstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterseqstmtContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *AlterseqstmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *AlterseqstmtContext) Seqoptlist() ISeqoptlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISeqoptlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISeqoptlistContext) +} + +func (s *AlterseqstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *AlterseqstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *AlterseqstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterseqstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterseqstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterseqstmt(s) + } +} + +func (s *AlterseqstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterseqstmt(s) + } +} + +func (s *AlterseqstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterseqstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterseqstmt() (localctx IAlterseqstmtContext) { + localctx = NewAlterseqstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 284, PostgreSQLParserRULE_alterseqstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3484) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3485) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3488) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 237, p.GetParserRuleContext()) == 1 { + { + p.SetState(3486) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3487) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3490) + p.Qualified_name() + } + { + p.SetState(3491) + p.Seqoptlist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptseqoptlistContext is an interface to support dynamic dispatch. +type IOptseqoptlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Seqoptlist() ISeqoptlistContext + + // IsOptseqoptlistContext differentiates from other interfaces. + IsOptseqoptlistContext() +} + +type OptseqoptlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptseqoptlistContext() *OptseqoptlistContext { + var p = new(OptseqoptlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optseqoptlist + return p +} + +func InitEmptyOptseqoptlistContext(p *OptseqoptlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optseqoptlist +} + +func (*OptseqoptlistContext) IsOptseqoptlistContext() {} + +func NewOptseqoptlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptseqoptlistContext { + var p = new(OptseqoptlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optseqoptlist + + return p +} + +func (s *OptseqoptlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptseqoptlistContext) Seqoptlist() ISeqoptlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISeqoptlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISeqoptlistContext) +} + +func (s *OptseqoptlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptseqoptlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptseqoptlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptseqoptlist(s) + } +} + +func (s *OptseqoptlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptseqoptlist(s) + } +} + +func (s *OptseqoptlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptseqoptlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optseqoptlist() (localctx IOptseqoptlistContext) { + localctx = NewOptseqoptlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 286, PostgreSQLParserRULE_optseqoptlist) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3493) + p.Seqoptlist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptparenthesizedseqoptlistContext is an interface to support dynamic dispatch. +type IOptparenthesizedseqoptlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Seqoptlist() ISeqoptlistContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOptparenthesizedseqoptlistContext differentiates from other interfaces. + IsOptparenthesizedseqoptlistContext() +} + +type OptparenthesizedseqoptlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptparenthesizedseqoptlistContext() *OptparenthesizedseqoptlistContext { + var p = new(OptparenthesizedseqoptlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optparenthesizedseqoptlist + return p +} + +func InitEmptyOptparenthesizedseqoptlistContext(p *OptparenthesizedseqoptlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optparenthesizedseqoptlist +} + +func (*OptparenthesizedseqoptlistContext) IsOptparenthesizedseqoptlistContext() {} + +func NewOptparenthesizedseqoptlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptparenthesizedseqoptlistContext { + var p = new(OptparenthesizedseqoptlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optparenthesizedseqoptlist + + return p +} + +func (s *OptparenthesizedseqoptlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptparenthesizedseqoptlistContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *OptparenthesizedseqoptlistContext) Seqoptlist() ISeqoptlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISeqoptlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISeqoptlistContext) +} + +func (s *OptparenthesizedseqoptlistContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *OptparenthesizedseqoptlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptparenthesizedseqoptlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptparenthesizedseqoptlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptparenthesizedseqoptlist(s) + } +} + +func (s *OptparenthesizedseqoptlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptparenthesizedseqoptlist(s) + } +} + +func (s *OptparenthesizedseqoptlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptparenthesizedseqoptlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optparenthesizedseqoptlist() (localctx IOptparenthesizedseqoptlistContext) { + localctx = NewOptparenthesizedseqoptlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 288, PostgreSQLParserRULE_optparenthesizedseqoptlist) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3495) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3496) + p.Seqoptlist() + } + { + p.SetState(3497) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISeqoptlistContext is an interface to support dynamic dispatch. +type ISeqoptlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSeqoptelem() []ISeqoptelemContext + Seqoptelem(i int) ISeqoptelemContext + + // IsSeqoptlistContext differentiates from other interfaces. + IsSeqoptlistContext() +} + +type SeqoptlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySeqoptlistContext() *SeqoptlistContext { + var p = new(SeqoptlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_seqoptlist + return p +} + +func InitEmptySeqoptlistContext(p *SeqoptlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_seqoptlist +} + +func (*SeqoptlistContext) IsSeqoptlistContext() {} + +func NewSeqoptlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SeqoptlistContext { + var p = new(SeqoptlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_seqoptlist + + return p +} + +func (s *SeqoptlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *SeqoptlistContext) AllSeqoptelem() []ISeqoptelemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISeqoptelemContext); ok { + len++ + } + } + + tst := make([]ISeqoptelemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISeqoptelemContext); ok { + tst[i] = t.(ISeqoptelemContext) + i++ + } + } + + return tst +} + +func (s *SeqoptlistContext) Seqoptelem(i int) ISeqoptelemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISeqoptelemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISeqoptelemContext) +} + +func (s *SeqoptlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SeqoptlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SeqoptlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSeqoptlist(s) + } +} + +func (s *SeqoptlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSeqoptlist(s) + } +} + +func (s *SeqoptlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSeqoptlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Seqoptlist() (localctx ISeqoptlistContext) { + localctx = NewSeqoptlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 290, PostgreSQLParserRULE_seqoptlist) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(3500) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(3499) + p.Seqoptelem() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(3502) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 238, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISeqoptelemContext is an interface to support dynamic dispatch. +type ISeqoptelemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AS() antlr.TerminalNode + Simpletypename() ISimpletypenameContext + CACHE() antlr.TerminalNode + Numericonly() INumericonlyContext + CYCLE() antlr.TerminalNode + INCREMENT() antlr.TerminalNode + Opt_by() IOpt_byContext + LOGGED() antlr.TerminalNode + MAXVALUE() antlr.TerminalNode + MINVALUE() antlr.TerminalNode + NO() antlr.TerminalNode + OWNED() antlr.TerminalNode + BY() antlr.TerminalNode + Any_name() IAny_nameContext + SEQUENCE() antlr.TerminalNode + NAME_P() antlr.TerminalNode + START() antlr.TerminalNode + Opt_with() IOpt_withContext + RESTART() antlr.TerminalNode + UNLOGGED() antlr.TerminalNode + + // IsSeqoptelemContext differentiates from other interfaces. + IsSeqoptelemContext() +} + +type SeqoptelemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySeqoptelemContext() *SeqoptelemContext { + var p = new(SeqoptelemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_seqoptelem + return p +} + +func InitEmptySeqoptelemContext(p *SeqoptelemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_seqoptelem +} + +func (*SeqoptelemContext) IsSeqoptelemContext() {} + +func NewSeqoptelemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SeqoptelemContext { + var p = new(SeqoptelemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_seqoptelem + + return p +} + +func (s *SeqoptelemContext) GetParser() antlr.Parser { return s.parser } + +func (s *SeqoptelemContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *SeqoptelemContext) Simpletypename() ISimpletypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISimpletypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISimpletypenameContext) +} + +func (s *SeqoptelemContext) CACHE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCACHE, 0) +} + +func (s *SeqoptelemContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *SeqoptelemContext) CYCLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCYCLE, 0) +} + +func (s *SeqoptelemContext) INCREMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINCREMENT, 0) +} + +func (s *SeqoptelemContext) Opt_by() IOpt_byContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_byContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_byContext) +} + +func (s *SeqoptelemContext) LOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOGGED, 0) +} + +func (s *SeqoptelemContext) MAXVALUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAXVALUE, 0) +} + +func (s *SeqoptelemContext) MINVALUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINVALUE, 0) +} + +func (s *SeqoptelemContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *SeqoptelemContext) OWNED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNED, 0) +} + +func (s *SeqoptelemContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *SeqoptelemContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *SeqoptelemContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *SeqoptelemContext) NAME_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNAME_P, 0) +} + +func (s *SeqoptelemContext) START() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTART, 0) +} + +func (s *SeqoptelemContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *SeqoptelemContext) RESTART() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESTART, 0) +} + +func (s *SeqoptelemContext) UNLOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNLOGGED, 0) +} + +func (s *SeqoptelemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SeqoptelemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SeqoptelemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSeqoptelem(s) + } +} + +func (s *SeqoptelemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSeqoptelem(s) + } +} + +func (s *SeqoptelemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSeqoptelem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Seqoptelem() (localctx ISeqoptelemContext) { + localctx = NewSeqoptelemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 292, PostgreSQLParserRULE_seqoptelem) + var _la int + + p.SetState(3540) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3504) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3505) + p.Simpletypename() + } + + case PostgreSQLParserCACHE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3506) + p.Match(PostgreSQLParserCACHE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3507) + p.Numericonly() + } + + case PostgreSQLParserCYCLE: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3508) + p.Match(PostgreSQLParserCYCLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserINCREMENT: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3509) + p.Match(PostgreSQLParserINCREMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3511) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserBY { + { + p.SetState(3510) + p.Opt_by() + } + + } + { + p.SetState(3513) + p.Numericonly() + } + + case PostgreSQLParserLOGGED: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(3514) + p.Match(PostgreSQLParserLOGGED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserMAXVALUE: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(3515) + p.Match(PostgreSQLParserMAXVALUE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3516) + p.Numericonly() + } + + case PostgreSQLParserMINVALUE: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(3517) + p.Match(PostgreSQLParserMINVALUE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3518) + p.Numericonly() + } + + case PostgreSQLParserNO: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(3519) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3520) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCYCLE || _la == PostgreSQLParserMAXVALUE || _la == PostgreSQLParserMINVALUE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case PostgreSQLParserOWNED: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(3521) + p.Match(PostgreSQLParserOWNED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3522) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3523) + p.Any_name() + } + + case PostgreSQLParserSEQUENCE: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(3524) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3525) + p.Match(PostgreSQLParserNAME_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3526) + p.Any_name() + } + + case PostgreSQLParserSTART: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(3527) + p.Match(PostgreSQLParserSTART) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3529) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(3528) + p.Opt_with() + } + + } + { + p.SetState(3531) + p.Numericonly() + } + + case PostgreSQLParserRESTART: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(3532) + p.Match(PostgreSQLParserRESTART) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3534) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 241, p.GetParserRuleContext()) == 1 { + { + p.SetState(3533) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(3537) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPLUS || _la == PostgreSQLParserMINUS || _la == PostgreSQLParserIntegral || _la == PostgreSQLParserNumeric { + { + p.SetState(3536) + p.Numericonly() + } + + } + + case PostgreSQLParserUNLOGGED: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(3539) + p.Match(PostgreSQLParserUNLOGGED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_byContext is an interface to support dynamic dispatch. +type IOpt_byContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BY() antlr.TerminalNode + + // IsOpt_byContext differentiates from other interfaces. + IsOpt_byContext() +} + +type Opt_byContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_byContext() *Opt_byContext { + var p = new(Opt_byContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_by + return p +} + +func InitEmptyOpt_byContext(p *Opt_byContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_by +} + +func (*Opt_byContext) IsOpt_byContext() {} + +func NewOpt_byContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_byContext { + var p = new(Opt_byContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_by + + return p +} + +func (s *Opt_byContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_byContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Opt_byContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_byContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_byContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_by(s) + } +} + +func (s *Opt_byContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_by(s) + } +} + +func (s *Opt_byContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_by(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_by() (localctx IOpt_byContext) { + localctx = NewOpt_byContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 294, PostgreSQLParserRULE_opt_by) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3542) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INumericonlyContext is an interface to support dynamic dispatch. +type INumericonlyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Fconst() IFconstContext + PLUS() antlr.TerminalNode + MINUS() antlr.TerminalNode + Signediconst() ISignediconstContext + + // IsNumericonlyContext differentiates from other interfaces. + IsNumericonlyContext() +} + +type NumericonlyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNumericonlyContext() *NumericonlyContext { + var p = new(NumericonlyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_numericonly + return p +} + +func InitEmptyNumericonlyContext(p *NumericonlyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_numericonly +} + +func (*NumericonlyContext) IsNumericonlyContext() {} + +func NewNumericonlyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NumericonlyContext { + var p = new(NumericonlyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_numericonly + + return p +} + +func (s *NumericonlyContext) GetParser() antlr.Parser { return s.parser } + +func (s *NumericonlyContext) Fconst() IFconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFconstContext) +} + +func (s *NumericonlyContext) PLUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLUS, 0) +} + +func (s *NumericonlyContext) MINUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUS, 0) +} + +func (s *NumericonlyContext) Signediconst() ISignediconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISignediconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISignediconstContext) +} + +func (s *NumericonlyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *NumericonlyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *NumericonlyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterNumericonly(s) + } +} + +func (s *NumericonlyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitNumericonly(s) + } +} + +func (s *NumericonlyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitNumericonly(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Numericonly() (localctx INumericonlyContext) { + localctx = NewNumericonlyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 296, PostgreSQLParserRULE_numericonly) + p.SetState(3550) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 244, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3544) + p.Fconst() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3545) + p.Match(PostgreSQLParserPLUS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3546) + p.Fconst() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3547) + p.Match(PostgreSQLParserMINUS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3548) + p.Fconst() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3549) + p.Signediconst() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INumericonly_listContext is an interface to support dynamic dispatch. +type INumericonly_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllNumericonly() []INumericonlyContext + Numericonly(i int) INumericonlyContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsNumericonly_listContext differentiates from other interfaces. + IsNumericonly_listContext() +} + +type Numericonly_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNumericonly_listContext() *Numericonly_listContext { + var p = new(Numericonly_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_numericonly_list + return p +} + +func InitEmptyNumericonly_listContext(p *Numericonly_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_numericonly_list +} + +func (*Numericonly_listContext) IsNumericonly_listContext() {} + +func NewNumericonly_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Numericonly_listContext { + var p = new(Numericonly_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_numericonly_list + + return p +} + +func (s *Numericonly_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Numericonly_listContext) AllNumericonly() []INumericonlyContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INumericonlyContext); ok { + len++ + } + } + + tst := make([]INumericonlyContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INumericonlyContext); ok { + tst[i] = t.(INumericonlyContext) + i++ + } + } + + return tst +} + +func (s *Numericonly_listContext) Numericonly(i int) INumericonlyContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Numericonly_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Numericonly_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Numericonly_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Numericonly_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Numericonly_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterNumericonly_list(s) + } +} + +func (s *Numericonly_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitNumericonly_list(s) + } +} + +func (s *Numericonly_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitNumericonly_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Numericonly_list() (localctx INumericonly_listContext) { + localctx = NewNumericonly_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 298, PostgreSQLParserRULE_numericonly_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3552) + p.Numericonly() + } + p.SetState(3557) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(3553) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3554) + p.Numericonly() + } + + p.SetState(3559) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateplangstmtContext is an interface to support dynamic dispatch. +type ICreateplangstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + LANGUAGE() antlr.TerminalNode + Name() INameContext + Opt_or_replace() IOpt_or_replaceContext + Opt_trusted() IOpt_trustedContext + Opt_procedural() IOpt_proceduralContext + HANDLER() antlr.TerminalNode + Handler_name() IHandler_nameContext + Opt_inline_handler() IOpt_inline_handlerContext + Opt_validator() IOpt_validatorContext + + // IsCreateplangstmtContext differentiates from other interfaces. + IsCreateplangstmtContext() +} + +type CreateplangstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateplangstmtContext() *CreateplangstmtContext { + var p = new(CreateplangstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createplangstmt + return p +} + +func InitEmptyCreateplangstmtContext(p *CreateplangstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createplangstmt +} + +func (*CreateplangstmtContext) IsCreateplangstmtContext() {} + +func NewCreateplangstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateplangstmtContext { + var p = new(CreateplangstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createplangstmt + + return p +} + +func (s *CreateplangstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateplangstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateplangstmtContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *CreateplangstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateplangstmtContext) Opt_or_replace() IOpt_or_replaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_or_replaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_or_replaceContext) +} + +func (s *CreateplangstmtContext) Opt_trusted() IOpt_trustedContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_trustedContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_trustedContext) +} + +func (s *CreateplangstmtContext) Opt_procedural() IOpt_proceduralContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_proceduralContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_proceduralContext) +} + +func (s *CreateplangstmtContext) HANDLER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHANDLER, 0) +} + +func (s *CreateplangstmtContext) Handler_name() IHandler_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHandler_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHandler_nameContext) +} + +func (s *CreateplangstmtContext) Opt_inline_handler() IOpt_inline_handlerContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_inline_handlerContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_inline_handlerContext) +} + +func (s *CreateplangstmtContext) Opt_validator() IOpt_validatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_validatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_validatorContext) +} + +func (s *CreateplangstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateplangstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateplangstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateplangstmt(s) + } +} + +func (s *CreateplangstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateplangstmt(s) + } +} + +func (s *CreateplangstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateplangstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createplangstmt() (localctx ICreateplangstmtContext) { + localctx = NewCreateplangstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 300, PostgreSQLParserRULE_createplangstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3560) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3562) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOR { + { + p.SetState(3561) + p.Opt_or_replace() + } + + } + p.SetState(3565) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTRUSTED { + { + p.SetState(3564) + p.Opt_trusted() + } + + } + p.SetState(3568) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPROCEDURAL { + { + p.SetState(3567) + p.Opt_procedural() + } + + } + { + p.SetState(3570) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3571) + p.Name() + } + p.SetState(3580) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserHANDLER { + { + p.SetState(3572) + p.Match(PostgreSQLParserHANDLER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3573) + p.Handler_name() + } + p.SetState(3575) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINLINE_P { + { + p.SetState(3574) + p.Opt_inline_handler() + } + + } + p.SetState(3578) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO || _la == PostgreSQLParserVALIDATOR { + { + p.SetState(3577) + p.Opt_validator() + } + + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_trustedContext is an interface to support dynamic dispatch. +type IOpt_trustedContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TRUSTED() antlr.TerminalNode + + // IsOpt_trustedContext differentiates from other interfaces. + IsOpt_trustedContext() +} + +type Opt_trustedContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_trustedContext() *Opt_trustedContext { + var p = new(Opt_trustedContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_trusted + return p +} + +func InitEmptyOpt_trustedContext(p *Opt_trustedContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_trusted +} + +func (*Opt_trustedContext) IsOpt_trustedContext() {} + +func NewOpt_trustedContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_trustedContext { + var p = new(Opt_trustedContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_trusted + + return p +} + +func (s *Opt_trustedContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_trustedContext) TRUSTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUSTED, 0) +} + +func (s *Opt_trustedContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_trustedContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_trustedContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_trusted(s) + } +} + +func (s *Opt_trustedContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_trusted(s) + } +} + +func (s *Opt_trustedContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_trusted(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_trusted() (localctx IOpt_trustedContext) { + localctx = NewOpt_trustedContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 302, PostgreSQLParserRULE_opt_trusted) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3582) + p.Match(PostgreSQLParserTRUSTED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IHandler_nameContext is an interface to support dynamic dispatch. +type IHandler_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Name() INameContext + Attrs() IAttrsContext + + // IsHandler_nameContext differentiates from other interfaces. + IsHandler_nameContext() +} + +type Handler_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyHandler_nameContext() *Handler_nameContext { + var p = new(Handler_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_handler_name + return p +} + +func InitEmptyHandler_nameContext(p *Handler_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_handler_name +} + +func (*Handler_nameContext) IsHandler_nameContext() {} + +func NewHandler_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Handler_nameContext { + var p = new(Handler_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_handler_name + + return p +} + +func (s *Handler_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Handler_nameContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Handler_nameContext) Attrs() IAttrsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAttrsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAttrsContext) +} + +func (s *Handler_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Handler_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Handler_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterHandler_name(s) + } +} + +func (s *Handler_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitHandler_name(s) + } +} + +func (s *Handler_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitHandler_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Handler_name() (localctx IHandler_nameContext) { + localctx = NewHandler_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 304, PostgreSQLParserRULE_handler_name) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3584) + p.Name() + } + p.SetState(3586) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDOT { + { + p.SetState(3585) + p.Attrs() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_inline_handlerContext is an interface to support dynamic dispatch. +type IOpt_inline_handlerContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INLINE_P() antlr.TerminalNode + Handler_name() IHandler_nameContext + + // IsOpt_inline_handlerContext differentiates from other interfaces. + IsOpt_inline_handlerContext() +} + +type Opt_inline_handlerContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_inline_handlerContext() *Opt_inline_handlerContext { + var p = new(Opt_inline_handlerContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_inline_handler + return p +} + +func InitEmptyOpt_inline_handlerContext(p *Opt_inline_handlerContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_inline_handler +} + +func (*Opt_inline_handlerContext) IsOpt_inline_handlerContext() {} + +func NewOpt_inline_handlerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_inline_handlerContext { + var p = new(Opt_inline_handlerContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_inline_handler + + return p +} + +func (s *Opt_inline_handlerContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_inline_handlerContext) INLINE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINLINE_P, 0) +} + +func (s *Opt_inline_handlerContext) Handler_name() IHandler_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHandler_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHandler_nameContext) +} + +func (s *Opt_inline_handlerContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_inline_handlerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_inline_handlerContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_inline_handler(s) + } +} + +func (s *Opt_inline_handlerContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_inline_handler(s) + } +} + +func (s *Opt_inline_handlerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_inline_handler(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_inline_handler() (localctx IOpt_inline_handlerContext) { + localctx = NewOpt_inline_handlerContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 306, PostgreSQLParserRULE_opt_inline_handler) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3588) + p.Match(PostgreSQLParserINLINE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3589) + p.Handler_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IValidator_clauseContext is an interface to support dynamic dispatch. +type IValidator_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + VALIDATOR() antlr.TerminalNode + Handler_name() IHandler_nameContext + NO() antlr.TerminalNode + + // IsValidator_clauseContext differentiates from other interfaces. + IsValidator_clauseContext() +} + +type Validator_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyValidator_clauseContext() *Validator_clauseContext { + var p = new(Validator_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_validator_clause + return p +} + +func InitEmptyValidator_clauseContext(p *Validator_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_validator_clause +} + +func (*Validator_clauseContext) IsValidator_clauseContext() {} + +func NewValidator_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Validator_clauseContext { + var p = new(Validator_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_validator_clause + + return p +} + +func (s *Validator_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Validator_clauseContext) VALIDATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALIDATOR, 0) +} + +func (s *Validator_clauseContext) Handler_name() IHandler_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHandler_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHandler_nameContext) +} + +func (s *Validator_clauseContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Validator_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Validator_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Validator_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterValidator_clause(s) + } +} + +func (s *Validator_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitValidator_clause(s) + } +} + +func (s *Validator_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitValidator_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Validator_clause() (localctx IValidator_clauseContext) { + localctx = NewValidator_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 308, PostgreSQLParserRULE_validator_clause) + p.SetState(3595) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserVALIDATOR: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3591) + p.Match(PostgreSQLParserVALIDATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3592) + p.Handler_name() + } + + case PostgreSQLParserNO: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3593) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3594) + p.Match(PostgreSQLParserVALIDATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_validatorContext is an interface to support dynamic dispatch. +type IOpt_validatorContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Validator_clause() IValidator_clauseContext + + // IsOpt_validatorContext differentiates from other interfaces. + IsOpt_validatorContext() +} + +type Opt_validatorContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_validatorContext() *Opt_validatorContext { + var p = new(Opt_validatorContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_validator + return p +} + +func InitEmptyOpt_validatorContext(p *Opt_validatorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_validator +} + +func (*Opt_validatorContext) IsOpt_validatorContext() {} + +func NewOpt_validatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_validatorContext { + var p = new(Opt_validatorContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_validator + + return p +} + +func (s *Opt_validatorContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_validatorContext) Validator_clause() IValidator_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IValidator_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IValidator_clauseContext) +} + +func (s *Opt_validatorContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_validatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_validatorContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_validator(s) + } +} + +func (s *Opt_validatorContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_validator(s) + } +} + +func (s *Opt_validatorContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_validator(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_validator() (localctx IOpt_validatorContext) { + localctx = NewOpt_validatorContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 310, PostgreSQLParserRULE_opt_validator) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3597) + p.Validator_clause() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_proceduralContext is an interface to support dynamic dispatch. +type IOpt_proceduralContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PROCEDURAL() antlr.TerminalNode + + // IsOpt_proceduralContext differentiates from other interfaces. + IsOpt_proceduralContext() +} + +type Opt_proceduralContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_proceduralContext() *Opt_proceduralContext { + var p = new(Opt_proceduralContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_procedural + return p +} + +func InitEmptyOpt_proceduralContext(p *Opt_proceduralContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_procedural +} + +func (*Opt_proceduralContext) IsOpt_proceduralContext() {} + +func NewOpt_proceduralContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_proceduralContext { + var p = new(Opt_proceduralContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_procedural + + return p +} + +func (s *Opt_proceduralContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_proceduralContext) PROCEDURAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURAL, 0) +} + +func (s *Opt_proceduralContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_proceduralContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_proceduralContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_procedural(s) + } +} + +func (s *Opt_proceduralContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_procedural(s) + } +} + +func (s *Opt_proceduralContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_procedural(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_procedural() (localctx IOpt_proceduralContext) { + localctx = NewOpt_proceduralContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 312, PostgreSQLParserRULE_opt_procedural) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3599) + p.Match(PostgreSQLParserPROCEDURAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatetablespacestmtContext is an interface to support dynamic dispatch. +type ICreatetablespacestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + Name() INameContext + LOCATION() antlr.TerminalNode + Sconst() ISconstContext + Opttablespaceowner() IOpttablespaceownerContext + Opt_reloptions() IOpt_reloptionsContext + + // IsCreatetablespacestmtContext differentiates from other interfaces. + IsCreatetablespacestmtContext() +} + +type CreatetablespacestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatetablespacestmtContext() *CreatetablespacestmtContext { + var p = new(CreatetablespacestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createtablespacestmt + return p +} + +func InitEmptyCreatetablespacestmtContext(p *CreatetablespacestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createtablespacestmt +} + +func (*CreatetablespacestmtContext) IsCreatetablespacestmtContext() {} + +func NewCreatetablespacestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatetablespacestmtContext { + var p = new(CreatetablespacestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createtablespacestmt + + return p +} + +func (s *CreatetablespacestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatetablespacestmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatetablespacestmtContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *CreatetablespacestmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreatetablespacestmtContext) LOCATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCATION, 0) +} + +func (s *CreatetablespacestmtContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *CreatetablespacestmtContext) Opttablespaceowner() IOpttablespaceownerContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttablespaceownerContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttablespaceownerContext) +} + +func (s *CreatetablespacestmtContext) Opt_reloptions() IOpt_reloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_reloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_reloptionsContext) +} + +func (s *CreatetablespacestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatetablespacestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatetablespacestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatetablespacestmt(s) + } +} + +func (s *CreatetablespacestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatetablespacestmt(s) + } +} + +func (s *CreatetablespacestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatetablespacestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createtablespacestmt() (localctx ICreatetablespacestmtContext) { + localctx = NewCreatetablespacestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 314, PostgreSQLParserRULE_createtablespacestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3601) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3602) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3603) + p.Name() + } + p.SetState(3605) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOWNER { + { + p.SetState(3604) + p.Opttablespaceowner() + } + + } + { + p.SetState(3607) + p.Match(PostgreSQLParserLOCATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3608) + p.Sconst() + } + p.SetState(3610) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 255, p.GetParserRuleContext()) == 1 { + { + p.SetState(3609) + p.Opt_reloptions() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpttablespaceownerContext is an interface to support dynamic dispatch. +type IOpttablespaceownerContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OWNER() antlr.TerminalNode + Rolespec() IRolespecContext + + // IsOpttablespaceownerContext differentiates from other interfaces. + IsOpttablespaceownerContext() +} + +type OpttablespaceownerContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpttablespaceownerContext() *OpttablespaceownerContext { + var p = new(OpttablespaceownerContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttablespaceowner + return p +} + +func InitEmptyOpttablespaceownerContext(p *OpttablespaceownerContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttablespaceowner +} + +func (*OpttablespaceownerContext) IsOpttablespaceownerContext() {} + +func NewOpttablespaceownerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OpttablespaceownerContext { + var p = new(OpttablespaceownerContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opttablespaceowner + + return p +} + +func (s *OpttablespaceownerContext) GetParser() antlr.Parser { return s.parser } + +func (s *OpttablespaceownerContext) OWNER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNER, 0) +} + +func (s *OpttablespaceownerContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *OpttablespaceownerContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OpttablespaceownerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OpttablespaceownerContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpttablespaceowner(s) + } +} + +func (s *OpttablespaceownerContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpttablespaceowner(s) + } +} + +func (s *OpttablespaceownerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpttablespaceowner(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opttablespaceowner() (localctx IOpttablespaceownerContext) { + localctx = NewOpttablespaceownerContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 316, PostgreSQLParserRULE_opttablespaceowner) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3612) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3613) + p.Rolespec() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDroptablespacestmtContext is an interface to support dynamic dispatch. +type IDroptablespacestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + Name() INameContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsDroptablespacestmtContext differentiates from other interfaces. + IsDroptablespacestmtContext() +} + +type DroptablespacestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDroptablespacestmtContext() *DroptablespacestmtContext { + var p = new(DroptablespacestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_droptablespacestmt + return p +} + +func InitEmptyDroptablespacestmtContext(p *DroptablespacestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_droptablespacestmt +} + +func (*DroptablespacestmtContext) IsDroptablespacestmtContext() {} + +func NewDroptablespacestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DroptablespacestmtContext { + var p = new(DroptablespacestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_droptablespacestmt + + return p +} + +func (s *DroptablespacestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DroptablespacestmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DroptablespacestmtContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *DroptablespacestmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DroptablespacestmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DroptablespacestmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DroptablespacestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DroptablespacestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DroptablespacestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDroptablespacestmt(s) + } +} + +func (s *DroptablespacestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDroptablespacestmt(s) + } +} + +func (s *DroptablespacestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDroptablespacestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Droptablespacestmt() (localctx IDroptablespacestmtContext) { + localctx = NewDroptablespacestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 318, PostgreSQLParserRULE_droptablespacestmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3615) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3616) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3619) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 256, p.GetParserRuleContext()) == 1 { + { + p.SetState(3617) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3618) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3621) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateextensionstmtContext is an interface to support dynamic dispatch. +type ICreateextensionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + EXTENSION() antlr.TerminalNode + Name() INameContext + Create_extension_opt_list() ICreate_extension_opt_listContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Opt_with() IOpt_withContext + + // IsCreateextensionstmtContext differentiates from other interfaces. + IsCreateextensionstmtContext() +} + +type CreateextensionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateextensionstmtContext() *CreateextensionstmtContext { + var p = new(CreateextensionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createextensionstmt + return p +} + +func InitEmptyCreateextensionstmtContext(p *CreateextensionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createextensionstmt +} + +func (*CreateextensionstmtContext) IsCreateextensionstmtContext() {} + +func NewCreateextensionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateextensionstmtContext { + var p = new(CreateextensionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createextensionstmt + + return p +} + +func (s *CreateextensionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateextensionstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateextensionstmtContext) EXTENSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTENSION, 0) +} + +func (s *CreateextensionstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateextensionstmtContext) Create_extension_opt_list() ICreate_extension_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_extension_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_extension_opt_listContext) +} + +func (s *CreateextensionstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreateextensionstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreateextensionstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreateextensionstmtContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *CreateextensionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateextensionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateextensionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateextensionstmt(s) + } +} + +func (s *CreateextensionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateextensionstmt(s) + } +} + +func (s *CreateextensionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateextensionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createextensionstmt() (localctx ICreateextensionstmtContext) { + localctx = NewCreateextensionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 320, PostgreSQLParserRULE_createextensionstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3623) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3624) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3628) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 257, p.GetParserRuleContext()) == 1 { + { + p.SetState(3625) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3626) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3627) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3630) + p.Name() + } + p.SetState(3632) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 258, p.GetParserRuleContext()) == 1 { + { + p.SetState(3631) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3634) + p.Create_extension_opt_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreate_extension_opt_listContext is an interface to support dynamic dispatch. +type ICreate_extension_opt_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCreate_extension_opt_item() []ICreate_extension_opt_itemContext + Create_extension_opt_item(i int) ICreate_extension_opt_itemContext + + // IsCreate_extension_opt_listContext differentiates from other interfaces. + IsCreate_extension_opt_listContext() +} + +type Create_extension_opt_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreate_extension_opt_listContext() *Create_extension_opt_listContext { + var p = new(Create_extension_opt_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_extension_opt_list + return p +} + +func InitEmptyCreate_extension_opt_listContext(p *Create_extension_opt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_extension_opt_list +} + +func (*Create_extension_opt_listContext) IsCreate_extension_opt_listContext() {} + +func NewCreate_extension_opt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_extension_opt_listContext { + var p = new(Create_extension_opt_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_create_extension_opt_list + + return p +} + +func (s *Create_extension_opt_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Create_extension_opt_listContext) AllCreate_extension_opt_item() []ICreate_extension_opt_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICreate_extension_opt_itemContext); ok { + len++ + } + } + + tst := make([]ICreate_extension_opt_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICreate_extension_opt_itemContext); ok { + tst[i] = t.(ICreate_extension_opt_itemContext) + i++ + } + } + + return tst +} + +func (s *Create_extension_opt_listContext) Create_extension_opt_item(i int) ICreate_extension_opt_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_extension_opt_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICreate_extension_opt_itemContext) +} + +func (s *Create_extension_opt_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Create_extension_opt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Create_extension_opt_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreate_extension_opt_list(s) + } +} + +func (s *Create_extension_opt_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreate_extension_opt_list(s) + } +} + +func (s *Create_extension_opt_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreate_extension_opt_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Create_extension_opt_list() (localctx ICreate_extension_opt_listContext) { + localctx = NewCreate_extension_opt_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 322, PostgreSQLParserRULE_create_extension_opt_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(3639) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserFROM || _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserSCHEMA || _la == PostgreSQLParserVERSION_P { + { + p.SetState(3636) + p.Create_extension_opt_item() + } + + p.SetState(3641) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreate_extension_opt_itemContext is an interface to support dynamic dispatch. +type ICreate_extension_opt_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SCHEMA() antlr.TerminalNode + Name() INameContext + VERSION_P() antlr.TerminalNode + Nonreservedword_or_sconst() INonreservedword_or_sconstContext + FROM() antlr.TerminalNode + CASCADE() antlr.TerminalNode + + // IsCreate_extension_opt_itemContext differentiates from other interfaces. + IsCreate_extension_opt_itemContext() +} + +type Create_extension_opt_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreate_extension_opt_itemContext() *Create_extension_opt_itemContext { + var p = new(Create_extension_opt_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_extension_opt_item + return p +} + +func InitEmptyCreate_extension_opt_itemContext(p *Create_extension_opt_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_extension_opt_item +} + +func (*Create_extension_opt_itemContext) IsCreate_extension_opt_itemContext() {} + +func NewCreate_extension_opt_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_extension_opt_itemContext { + var p = new(Create_extension_opt_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_create_extension_opt_item + + return p +} + +func (s *Create_extension_opt_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Create_extension_opt_itemContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Create_extension_opt_itemContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Create_extension_opt_itemContext) VERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERSION_P, 0) +} + +func (s *Create_extension_opt_itemContext) Nonreservedword_or_sconst() INonreservedword_or_sconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedword_or_sconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedword_or_sconstContext) +} + +func (s *Create_extension_opt_itemContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Create_extension_opt_itemContext) CASCADE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASCADE, 0) +} + +func (s *Create_extension_opt_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Create_extension_opt_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Create_extension_opt_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreate_extension_opt_item(s) + } +} + +func (s *Create_extension_opt_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreate_extension_opt_item(s) + } +} + +func (s *Create_extension_opt_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreate_extension_opt_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Create_extension_opt_item() (localctx ICreate_extension_opt_itemContext) { + localctx = NewCreate_extension_opt_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 324, PostgreSQLParserRULE_create_extension_opt_item) + p.SetState(3649) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserSCHEMA: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3642) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3643) + p.Name() + } + + case PostgreSQLParserVERSION_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3644) + p.Match(PostgreSQLParserVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3645) + p.Nonreservedword_or_sconst() + } + + case PostgreSQLParserFROM: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3646) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3647) + p.Nonreservedword_or_sconst() + } + + case PostgreSQLParserCASCADE: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3648) + p.Match(PostgreSQLParserCASCADE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterextensionstmtContext is an interface to support dynamic dispatch. +type IAlterextensionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + EXTENSION() antlr.TerminalNode + Name() INameContext + UPDATE() antlr.TerminalNode + Alter_extension_opt_list() IAlter_extension_opt_listContext + + // IsAlterextensionstmtContext differentiates from other interfaces. + IsAlterextensionstmtContext() +} + +type AlterextensionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterextensionstmtContext() *AlterextensionstmtContext { + var p = new(AlterextensionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterextensionstmt + return p +} + +func InitEmptyAlterextensionstmtContext(p *AlterextensionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterextensionstmt +} + +func (*AlterextensionstmtContext) IsAlterextensionstmtContext() {} + +func NewAlterextensionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterextensionstmtContext { + var p = new(AlterextensionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterextensionstmt + + return p +} + +func (s *AlterextensionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterextensionstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterextensionstmtContext) EXTENSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTENSION, 0) +} + +func (s *AlterextensionstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterextensionstmtContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *AlterextensionstmtContext) Alter_extension_opt_list() IAlter_extension_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_extension_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_extension_opt_listContext) +} + +func (s *AlterextensionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterextensionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterextensionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterextensionstmt(s) + } +} + +func (s *AlterextensionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterextensionstmt(s) + } +} + +func (s *AlterextensionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterextensionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterextensionstmt() (localctx IAlterextensionstmtContext) { + localctx = NewAlterextensionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 326, PostgreSQLParserRULE_alterextensionstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3651) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3652) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3653) + p.Name() + } + { + p.SetState(3654) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3655) + p.Alter_extension_opt_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_extension_opt_listContext is an interface to support dynamic dispatch. +type IAlter_extension_opt_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAlter_extension_opt_item() []IAlter_extension_opt_itemContext + Alter_extension_opt_item(i int) IAlter_extension_opt_itemContext + + // IsAlter_extension_opt_listContext differentiates from other interfaces. + IsAlter_extension_opt_listContext() +} + +type Alter_extension_opt_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_extension_opt_listContext() *Alter_extension_opt_listContext { + var p = new(Alter_extension_opt_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_extension_opt_list + return p +} + +func InitEmptyAlter_extension_opt_listContext(p *Alter_extension_opt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_extension_opt_list +} + +func (*Alter_extension_opt_listContext) IsAlter_extension_opt_listContext() {} + +func NewAlter_extension_opt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_extension_opt_listContext { + var p = new(Alter_extension_opt_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_extension_opt_list + + return p +} + +func (s *Alter_extension_opt_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_extension_opt_listContext) AllAlter_extension_opt_item() []IAlter_extension_opt_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAlter_extension_opt_itemContext); ok { + len++ + } + } + + tst := make([]IAlter_extension_opt_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAlter_extension_opt_itemContext); ok { + tst[i] = t.(IAlter_extension_opt_itemContext) + i++ + } + } + + return tst +} + +func (s *Alter_extension_opt_listContext) Alter_extension_opt_item(i int) IAlter_extension_opt_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_extension_opt_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAlter_extension_opt_itemContext) +} + +func (s *Alter_extension_opt_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_extension_opt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_extension_opt_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_extension_opt_list(s) + } +} + +func (s *Alter_extension_opt_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_extension_opt_list(s) + } +} + +func (s *Alter_extension_opt_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_extension_opt_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_extension_opt_list() (localctx IAlter_extension_opt_listContext) { + localctx = NewAlter_extension_opt_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 328, PostgreSQLParserRULE_alter_extension_opt_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(3660) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserTO { + { + p.SetState(3657) + p.Alter_extension_opt_item() + } + + p.SetState(3662) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_extension_opt_itemContext is an interface to support dynamic dispatch. +type IAlter_extension_opt_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TO() antlr.TerminalNode + Nonreservedword_or_sconst() INonreservedword_or_sconstContext + + // IsAlter_extension_opt_itemContext differentiates from other interfaces. + IsAlter_extension_opt_itemContext() +} + +type Alter_extension_opt_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_extension_opt_itemContext() *Alter_extension_opt_itemContext { + var p = new(Alter_extension_opt_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_extension_opt_item + return p +} + +func InitEmptyAlter_extension_opt_itemContext(p *Alter_extension_opt_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_extension_opt_item +} + +func (*Alter_extension_opt_itemContext) IsAlter_extension_opt_itemContext() {} + +func NewAlter_extension_opt_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_extension_opt_itemContext { + var p = new(Alter_extension_opt_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_extension_opt_item + + return p +} + +func (s *Alter_extension_opt_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_extension_opt_itemContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Alter_extension_opt_itemContext) Nonreservedword_or_sconst() INonreservedword_or_sconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedword_or_sconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedword_or_sconstContext) +} + +func (s *Alter_extension_opt_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_extension_opt_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_extension_opt_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_extension_opt_item(s) + } +} + +func (s *Alter_extension_opt_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_extension_opt_item(s) + } +} + +func (s *Alter_extension_opt_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_extension_opt_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_extension_opt_item() (localctx IAlter_extension_opt_itemContext) { + localctx = NewAlter_extension_opt_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 330, PostgreSQLParserRULE_alter_extension_opt_item) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3663) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3664) + p.Nonreservedword_or_sconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterextensioncontentsstmtContext is an interface to support dynamic dispatch. +type IAlterextensioncontentsstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + EXTENSION() antlr.TerminalNode + AllName() []INameContext + Name(i int) INameContext + Add_drop() IAdd_dropContext + Object_type_name() IObject_type_nameContext + Object_type_any_name() IObject_type_any_nameContext + Any_name() IAny_nameContext + AGGREGATE() antlr.TerminalNode + Aggregate_with_argtypes() IAggregate_with_argtypesContext + CAST() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + AS() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + DOMAIN_P() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + OPERATOR() antlr.TerminalNode + Operator_with_argtypes() IOperator_with_argtypesContext + CLASS() antlr.TerminalNode + USING() antlr.TerminalNode + FAMILY() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + TRANSFORM() antlr.TerminalNode + FOR() antlr.TerminalNode + LANGUAGE() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + + // IsAlterextensioncontentsstmtContext differentiates from other interfaces. + IsAlterextensioncontentsstmtContext() +} + +type AlterextensioncontentsstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterextensioncontentsstmtContext() *AlterextensioncontentsstmtContext { + var p = new(AlterextensioncontentsstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterextensioncontentsstmt + return p +} + +func InitEmptyAlterextensioncontentsstmtContext(p *AlterextensioncontentsstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterextensioncontentsstmt +} + +func (*AlterextensioncontentsstmtContext) IsAlterextensioncontentsstmtContext() {} + +func NewAlterextensioncontentsstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterextensioncontentsstmtContext { + var p = new(AlterextensioncontentsstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterextensioncontentsstmt + + return p +} + +func (s *AlterextensioncontentsstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterextensioncontentsstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterextensioncontentsstmtContext) EXTENSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTENSION, 0) +} + +func (s *AlterextensioncontentsstmtContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *AlterextensioncontentsstmtContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterextensioncontentsstmtContext) Add_drop() IAdd_dropContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAdd_dropContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAdd_dropContext) +} + +func (s *AlterextensioncontentsstmtContext) Object_type_name() IObject_type_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_nameContext) +} + +func (s *AlterextensioncontentsstmtContext) Object_type_any_name() IObject_type_any_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_any_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_any_nameContext) +} + +func (s *AlterextensioncontentsstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AlterextensioncontentsstmtContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *AlterextensioncontentsstmtContext) Aggregate_with_argtypes() IAggregate_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggregate_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggregate_with_argtypesContext) +} + +func (s *AlterextensioncontentsstmtContext) CAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCAST, 0) +} + +func (s *AlterextensioncontentsstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *AlterextensioncontentsstmtContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *AlterextensioncontentsstmtContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *AlterextensioncontentsstmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *AlterextensioncontentsstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *AlterextensioncontentsstmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *AlterextensioncontentsstmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *AlterextensioncontentsstmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *AlterextensioncontentsstmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *AlterextensioncontentsstmtContext) Operator_with_argtypes() IOperator_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_with_argtypesContext) +} + +func (s *AlterextensioncontentsstmtContext) CLASS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLASS, 0) +} + +func (s *AlterextensioncontentsstmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *AlterextensioncontentsstmtContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *AlterextensioncontentsstmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *AlterextensioncontentsstmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *AlterextensioncontentsstmtContext) TRANSFORM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSFORM, 0) +} + +func (s *AlterextensioncontentsstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *AlterextensioncontentsstmtContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *AlterextensioncontentsstmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *AlterextensioncontentsstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterextensioncontentsstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterextensioncontentsstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterextensioncontentsstmt(s) + } +} + +func (s *AlterextensioncontentsstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterextensioncontentsstmt(s) + } +} + +func (s *AlterextensioncontentsstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterextensioncontentsstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterextensioncontentsstmt() (localctx IAlterextensioncontentsstmtContext) { + localctx = NewAlterextensioncontentsstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 332, PostgreSQLParserRULE_alterextensioncontentsstmt) + p.SetState(3770) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 262, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3666) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3667) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3668) + p.Name() + } + { + p.SetState(3669) + p.Add_drop() + } + { + p.SetState(3670) + p.Object_type_name() + } + { + p.SetState(3671) + p.Name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3673) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3674) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3675) + p.Name() + } + { + p.SetState(3676) + p.Add_drop() + } + { + p.SetState(3677) + p.Object_type_any_name() + } + { + p.SetState(3678) + p.Any_name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3680) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3681) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3682) + p.Name() + } + { + p.SetState(3683) + p.Add_drop() + } + { + p.SetState(3684) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3685) + p.Aggregate_with_argtypes() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3687) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3688) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3689) + p.Name() + } + { + p.SetState(3690) + p.Add_drop() + } + { + p.SetState(3691) + p.Match(PostgreSQLParserCAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3692) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3693) + p.Typename() + } + { + p.SetState(3694) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3695) + p.Typename() + } + { + p.SetState(3696) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(3698) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3699) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3700) + p.Name() + } + { + p.SetState(3701) + p.Add_drop() + } + { + p.SetState(3702) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3703) + p.Typename() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(3705) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3706) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3707) + p.Name() + } + { + p.SetState(3708) + p.Add_drop() + } + { + p.SetState(3709) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3710) + p.Function_with_argtypes() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(3712) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3713) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3714) + p.Name() + } + { + p.SetState(3715) + p.Add_drop() + } + { + p.SetState(3716) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3717) + p.Operator_with_argtypes() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(3719) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3720) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3721) + p.Name() + } + { + p.SetState(3722) + p.Add_drop() + } + { + p.SetState(3723) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3724) + p.Match(PostgreSQLParserCLASS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3725) + p.Any_name() + } + { + p.SetState(3726) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3727) + p.Name() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(3729) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3730) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3731) + p.Name() + } + { + p.SetState(3732) + p.Add_drop() + } + { + p.SetState(3733) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3734) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3735) + p.Any_name() + } + { + p.SetState(3736) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3737) + p.Name() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(3739) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3740) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3741) + p.Name() + } + { + p.SetState(3742) + p.Add_drop() + } + { + p.SetState(3743) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3744) + p.Function_with_argtypes() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(3746) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3747) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3748) + p.Name() + } + { + p.SetState(3749) + p.Add_drop() + } + { + p.SetState(3750) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3751) + p.Function_with_argtypes() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(3753) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3754) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3755) + p.Name() + } + { + p.SetState(3756) + p.Add_drop() + } + { + p.SetState(3757) + p.Match(PostgreSQLParserTRANSFORM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3758) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3759) + p.Typename() + } + { + p.SetState(3760) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3761) + p.Name() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(3763) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3764) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3765) + p.Name() + } + { + p.SetState(3766) + p.Add_drop() + } + { + p.SetState(3767) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3768) + p.Typename() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatefdwstmtContext is an interface to support dynamic dispatch. +type ICreatefdwstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + DATA_P() antlr.TerminalNode + WRAPPER() antlr.TerminalNode + Name() INameContext + Opt_fdw_options() IOpt_fdw_optionsContext + Create_generic_options() ICreate_generic_optionsContext + + // IsCreatefdwstmtContext differentiates from other interfaces. + IsCreatefdwstmtContext() +} + +type CreatefdwstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatefdwstmtContext() *CreatefdwstmtContext { + var p = new(CreatefdwstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createfdwstmt + return p +} + +func InitEmptyCreatefdwstmtContext(p *CreatefdwstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createfdwstmt +} + +func (*CreatefdwstmtContext) IsCreatefdwstmtContext() {} + +func NewCreatefdwstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatefdwstmtContext { + var p = new(CreatefdwstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createfdwstmt + + return p +} + +func (s *CreatefdwstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatefdwstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatefdwstmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *CreatefdwstmtContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *CreatefdwstmtContext) WRAPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRAPPER, 0) +} + +func (s *CreatefdwstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreatefdwstmtContext) Opt_fdw_options() IOpt_fdw_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_fdw_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_fdw_optionsContext) +} + +func (s *CreatefdwstmtContext) Create_generic_options() ICreate_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_generic_optionsContext) +} + +func (s *CreatefdwstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatefdwstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatefdwstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatefdwstmt(s) + } +} + +func (s *CreatefdwstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatefdwstmt(s) + } +} + +func (s *CreatefdwstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatefdwstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createfdwstmt() (localctx ICreatefdwstmtContext) { + localctx = NewCreatefdwstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 334, PostgreSQLParserRULE_createfdwstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3772) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3773) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3774) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3775) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3776) + p.Name() + } + p.SetState(3778) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserHANDLER || _la == PostgreSQLParserNO || _la == PostgreSQLParserVALIDATOR { + { + p.SetState(3777) + p.Opt_fdw_options() + } + + } + p.SetState(3781) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(3780) + p.Create_generic_options() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFdw_optionContext is an interface to support dynamic dispatch. +type IFdw_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + HANDLER() antlr.TerminalNode + Handler_name() IHandler_nameContext + NO() antlr.TerminalNode + VALIDATOR() antlr.TerminalNode + + // IsFdw_optionContext differentiates from other interfaces. + IsFdw_optionContext() +} + +type Fdw_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFdw_optionContext() *Fdw_optionContext { + var p = new(Fdw_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fdw_option + return p +} + +func InitEmptyFdw_optionContext(p *Fdw_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fdw_option +} + +func (*Fdw_optionContext) IsFdw_optionContext() {} + +func NewFdw_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Fdw_optionContext { + var p = new(Fdw_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_fdw_option + + return p +} + +func (s *Fdw_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Fdw_optionContext) HANDLER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHANDLER, 0) +} + +func (s *Fdw_optionContext) Handler_name() IHandler_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHandler_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHandler_nameContext) +} + +func (s *Fdw_optionContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Fdw_optionContext) VALIDATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALIDATOR, 0) +} + +func (s *Fdw_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Fdw_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Fdw_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFdw_option(s) + } +} + +func (s *Fdw_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFdw_option(s) + } +} + +func (s *Fdw_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFdw_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Fdw_option() (localctx IFdw_optionContext) { + localctx = NewFdw_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 336, PostgreSQLParserRULE_fdw_option) + p.SetState(3791) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 265, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3783) + p.Match(PostgreSQLParserHANDLER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3784) + p.Handler_name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3785) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3786) + p.Match(PostgreSQLParserHANDLER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3787) + p.Match(PostgreSQLParserVALIDATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3788) + p.Handler_name() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3789) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3790) + p.Match(PostgreSQLParserVALIDATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFdw_optionsContext is an interface to support dynamic dispatch. +type IFdw_optionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllFdw_option() []IFdw_optionContext + Fdw_option(i int) IFdw_optionContext + + // IsFdw_optionsContext differentiates from other interfaces. + IsFdw_optionsContext() +} + +type Fdw_optionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFdw_optionsContext() *Fdw_optionsContext { + var p = new(Fdw_optionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fdw_options + return p +} + +func InitEmptyFdw_optionsContext(p *Fdw_optionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fdw_options +} + +func (*Fdw_optionsContext) IsFdw_optionsContext() {} + +func NewFdw_optionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Fdw_optionsContext { + var p = new(Fdw_optionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_fdw_options + + return p +} + +func (s *Fdw_optionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Fdw_optionsContext) AllFdw_option() []IFdw_optionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFdw_optionContext); ok { + len++ + } + } + + tst := make([]IFdw_optionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFdw_optionContext); ok { + tst[i] = t.(IFdw_optionContext) + i++ + } + } + + return tst +} + +func (s *Fdw_optionsContext) Fdw_option(i int) IFdw_optionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFdw_optionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFdw_optionContext) +} + +func (s *Fdw_optionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Fdw_optionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Fdw_optionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFdw_options(s) + } +} + +func (s *Fdw_optionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFdw_options(s) + } +} + +func (s *Fdw_optionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFdw_options(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Fdw_options() (localctx IFdw_optionsContext) { + localctx = NewFdw_optionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 338, PostgreSQLParserRULE_fdw_options) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(3794) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == PostgreSQLParserHANDLER || _la == PostgreSQLParserNO || _la == PostgreSQLParserVALIDATOR { + { + p.SetState(3793) + p.Fdw_option() + } + + p.SetState(3796) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_fdw_optionsContext is an interface to support dynamic dispatch. +type IOpt_fdw_optionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Fdw_options() IFdw_optionsContext + + // IsOpt_fdw_optionsContext differentiates from other interfaces. + IsOpt_fdw_optionsContext() +} + +type Opt_fdw_optionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_fdw_optionsContext() *Opt_fdw_optionsContext { + var p = new(Opt_fdw_optionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_fdw_options + return p +} + +func InitEmptyOpt_fdw_optionsContext(p *Opt_fdw_optionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_fdw_options +} + +func (*Opt_fdw_optionsContext) IsOpt_fdw_optionsContext() {} + +func NewOpt_fdw_optionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_fdw_optionsContext { + var p = new(Opt_fdw_optionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_fdw_options + + return p +} + +func (s *Opt_fdw_optionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_fdw_optionsContext) Fdw_options() IFdw_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFdw_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFdw_optionsContext) +} + +func (s *Opt_fdw_optionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_fdw_optionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_fdw_optionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_fdw_options(s) + } +} + +func (s *Opt_fdw_optionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_fdw_options(s) + } +} + +func (s *Opt_fdw_optionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_fdw_options(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_fdw_options() (localctx IOpt_fdw_optionsContext) { + localctx = NewOpt_fdw_optionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 340, PostgreSQLParserRULE_opt_fdw_options) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3798) + p.Fdw_options() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterfdwstmtContext is an interface to support dynamic dispatch. +type IAlterfdwstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + DATA_P() antlr.TerminalNode + WRAPPER() antlr.TerminalNode + Name() INameContext + Alter_generic_options() IAlter_generic_optionsContext + Opt_fdw_options() IOpt_fdw_optionsContext + Fdw_options() IFdw_optionsContext + + // IsAlterfdwstmtContext differentiates from other interfaces. + IsAlterfdwstmtContext() +} + +type AlterfdwstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterfdwstmtContext() *AlterfdwstmtContext { + var p = new(AlterfdwstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterfdwstmt + return p +} + +func InitEmptyAlterfdwstmtContext(p *AlterfdwstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterfdwstmt +} + +func (*AlterfdwstmtContext) IsAlterfdwstmtContext() {} + +func NewAlterfdwstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterfdwstmtContext { + var p = new(AlterfdwstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterfdwstmt + + return p +} + +func (s *AlterfdwstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterfdwstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterfdwstmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *AlterfdwstmtContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *AlterfdwstmtContext) WRAPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRAPPER, 0) +} + +func (s *AlterfdwstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterfdwstmtContext) Alter_generic_options() IAlter_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_generic_optionsContext) +} + +func (s *AlterfdwstmtContext) Opt_fdw_options() IOpt_fdw_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_fdw_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_fdw_optionsContext) +} + +func (s *AlterfdwstmtContext) Fdw_options() IFdw_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFdw_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFdw_optionsContext) +} + +func (s *AlterfdwstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterfdwstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterfdwstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterfdwstmt(s) + } +} + +func (s *AlterfdwstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterfdwstmt(s) + } +} + +func (s *AlterfdwstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterfdwstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterfdwstmt() (localctx IAlterfdwstmtContext) { + localctx = NewAlterfdwstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 342, PostgreSQLParserRULE_alterfdwstmt) + var _la int + + p.SetState(3817) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 268, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3800) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3801) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3802) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3803) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3804) + p.Name() + } + p.SetState(3806) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserHANDLER || _la == PostgreSQLParserNO || _la == PostgreSQLParserVALIDATOR { + { + p.SetState(3805) + p.Opt_fdw_options() + } + + } + { + p.SetState(3808) + p.Alter_generic_options() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3810) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3811) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3812) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3813) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3814) + p.Name() + } + { + p.SetState(3815) + p.Fdw_options() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreate_generic_optionsContext is an interface to support dynamic dispatch. +type ICreate_generic_optionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPTIONS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Generic_option_list() IGeneric_option_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsCreate_generic_optionsContext differentiates from other interfaces. + IsCreate_generic_optionsContext() +} + +type Create_generic_optionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreate_generic_optionsContext() *Create_generic_optionsContext { + var p = new(Create_generic_optionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_generic_options + return p +} + +func InitEmptyCreate_generic_optionsContext(p *Create_generic_optionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_create_generic_options +} + +func (*Create_generic_optionsContext) IsCreate_generic_optionsContext() {} + +func NewCreate_generic_optionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_generic_optionsContext { + var p = new(Create_generic_optionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_create_generic_options + + return p +} + +func (s *Create_generic_optionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Create_generic_optionsContext) OPTIONS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTIONS, 0) +} + +func (s *Create_generic_optionsContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Create_generic_optionsContext) Generic_option_list() IGeneric_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_option_listContext) +} + +func (s *Create_generic_optionsContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Create_generic_optionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Create_generic_optionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Create_generic_optionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreate_generic_options(s) + } +} + +func (s *Create_generic_optionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreate_generic_options(s) + } +} + +func (s *Create_generic_optionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreate_generic_options(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Create_generic_options() (localctx ICreate_generic_optionsContext) { + localctx = NewCreate_generic_optionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 344, PostgreSQLParserRULE_create_generic_options) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3819) + p.Match(PostgreSQLParserOPTIONS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3820) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3821) + p.Generic_option_list() + } + { + p.SetState(3822) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGeneric_option_listContext is an interface to support dynamic dispatch. +type IGeneric_option_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllGeneric_option_elem() []IGeneric_option_elemContext + Generic_option_elem(i int) IGeneric_option_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsGeneric_option_listContext differentiates from other interfaces. + IsGeneric_option_listContext() +} + +type Generic_option_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGeneric_option_listContext() *Generic_option_listContext { + var p = new(Generic_option_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_option_list + return p +} + +func InitEmptyGeneric_option_listContext(p *Generic_option_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_option_list +} + +func (*Generic_option_listContext) IsGeneric_option_listContext() {} + +func NewGeneric_option_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Generic_option_listContext { + var p = new(Generic_option_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_generic_option_list + + return p +} + +func (s *Generic_option_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Generic_option_listContext) AllGeneric_option_elem() []IGeneric_option_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IGeneric_option_elemContext); ok { + len++ + } + } + + tst := make([]IGeneric_option_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IGeneric_option_elemContext); ok { + tst[i] = t.(IGeneric_option_elemContext) + i++ + } + } + + return tst +} + +func (s *Generic_option_listContext) Generic_option_elem(i int) IGeneric_option_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_option_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_option_elemContext) +} + +func (s *Generic_option_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Generic_option_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Generic_option_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Generic_option_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Generic_option_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGeneric_option_list(s) + } +} + +func (s *Generic_option_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGeneric_option_list(s) + } +} + +func (s *Generic_option_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGeneric_option_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Generic_option_list() (localctx IGeneric_option_listContext) { + localctx = NewGeneric_option_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 346, PostgreSQLParserRULE_generic_option_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3824) + p.Generic_option_elem() + } + p.SetState(3829) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(3825) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3826) + p.Generic_option_elem() + } + + p.SetState(3831) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_generic_optionsContext is an interface to support dynamic dispatch. +type IAlter_generic_optionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPTIONS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Alter_generic_option_list() IAlter_generic_option_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsAlter_generic_optionsContext differentiates from other interfaces. + IsAlter_generic_optionsContext() +} + +type Alter_generic_optionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_generic_optionsContext() *Alter_generic_optionsContext { + var p = new(Alter_generic_optionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_generic_options + return p +} + +func InitEmptyAlter_generic_optionsContext(p *Alter_generic_optionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_generic_options +} + +func (*Alter_generic_optionsContext) IsAlter_generic_optionsContext() {} + +func NewAlter_generic_optionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_generic_optionsContext { + var p = new(Alter_generic_optionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_generic_options + + return p +} + +func (s *Alter_generic_optionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_generic_optionsContext) OPTIONS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTIONS, 0) +} + +func (s *Alter_generic_optionsContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Alter_generic_optionsContext) Alter_generic_option_list() IAlter_generic_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_generic_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_generic_option_listContext) +} + +func (s *Alter_generic_optionsContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Alter_generic_optionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_generic_optionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_generic_optionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_generic_options(s) + } +} + +func (s *Alter_generic_optionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_generic_options(s) + } +} + +func (s *Alter_generic_optionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_generic_options(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_generic_options() (localctx IAlter_generic_optionsContext) { + localctx = NewAlter_generic_optionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 348, PostgreSQLParserRULE_alter_generic_options) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3832) + p.Match(PostgreSQLParserOPTIONS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3833) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3834) + p.Alter_generic_option_list() + } + { + p.SetState(3835) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_generic_option_listContext is an interface to support dynamic dispatch. +type IAlter_generic_option_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAlter_generic_option_elem() []IAlter_generic_option_elemContext + Alter_generic_option_elem(i int) IAlter_generic_option_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsAlter_generic_option_listContext differentiates from other interfaces. + IsAlter_generic_option_listContext() +} + +type Alter_generic_option_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_generic_option_listContext() *Alter_generic_option_listContext { + var p = new(Alter_generic_option_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_generic_option_list + return p +} + +func InitEmptyAlter_generic_option_listContext(p *Alter_generic_option_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_generic_option_list +} + +func (*Alter_generic_option_listContext) IsAlter_generic_option_listContext() {} + +func NewAlter_generic_option_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_generic_option_listContext { + var p = new(Alter_generic_option_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_generic_option_list + + return p +} + +func (s *Alter_generic_option_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_generic_option_listContext) AllAlter_generic_option_elem() []IAlter_generic_option_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAlter_generic_option_elemContext); ok { + len++ + } + } + + tst := make([]IAlter_generic_option_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAlter_generic_option_elemContext); ok { + tst[i] = t.(IAlter_generic_option_elemContext) + i++ + } + } + + return tst +} + +func (s *Alter_generic_option_listContext) Alter_generic_option_elem(i int) IAlter_generic_option_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_generic_option_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAlter_generic_option_elemContext) +} + +func (s *Alter_generic_option_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Alter_generic_option_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Alter_generic_option_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_generic_option_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_generic_option_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_generic_option_list(s) + } +} + +func (s *Alter_generic_option_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_generic_option_list(s) + } +} + +func (s *Alter_generic_option_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_generic_option_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_generic_option_list() (localctx IAlter_generic_option_listContext) { + localctx = NewAlter_generic_option_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 350, PostgreSQLParserRULE_alter_generic_option_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3837) + p.Alter_generic_option_elem() + } + p.SetState(3842) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(3838) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3839) + p.Alter_generic_option_elem() + } + + p.SetState(3844) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlter_generic_option_elemContext is an interface to support dynamic dispatch. +type IAlter_generic_option_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Generic_option_elem() IGeneric_option_elemContext + SET() antlr.TerminalNode + ADD_P() antlr.TerminalNode + DROP() antlr.TerminalNode + Generic_option_name() IGeneric_option_nameContext + + // IsAlter_generic_option_elemContext differentiates from other interfaces. + IsAlter_generic_option_elemContext() +} + +type Alter_generic_option_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlter_generic_option_elemContext() *Alter_generic_option_elemContext { + var p = new(Alter_generic_option_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_generic_option_elem + return p +} + +func InitEmptyAlter_generic_option_elemContext(p *Alter_generic_option_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alter_generic_option_elem +} + +func (*Alter_generic_option_elemContext) IsAlter_generic_option_elemContext() {} + +func NewAlter_generic_option_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alter_generic_option_elemContext { + var p = new(Alter_generic_option_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alter_generic_option_elem + + return p +} + +func (s *Alter_generic_option_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alter_generic_option_elemContext) Generic_option_elem() IGeneric_option_elemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_option_elemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_option_elemContext) +} + +func (s *Alter_generic_option_elemContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Alter_generic_option_elemContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *Alter_generic_option_elemContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *Alter_generic_option_elemContext) Generic_option_name() IGeneric_option_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_option_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_option_nameContext) +} + +func (s *Alter_generic_option_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alter_generic_option_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alter_generic_option_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlter_generic_option_elem(s) + } +} + +func (s *Alter_generic_option_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlter_generic_option_elem(s) + } +} + +func (s *Alter_generic_option_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlter_generic_option_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alter_generic_option_elem() (localctx IAlter_generic_option_elemContext) { + localctx = NewAlter_generic_option_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 352, PostgreSQLParserRULE_alter_generic_option_elem) + p.SetState(3852) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 271, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3845) + p.Generic_option_elem() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3846) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3847) + p.Generic_option_elem() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3848) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3849) + p.Generic_option_elem() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3850) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3851) + p.Generic_option_name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGeneric_option_elemContext is an interface to support dynamic dispatch. +type IGeneric_option_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Generic_option_name() IGeneric_option_nameContext + Generic_option_arg() IGeneric_option_argContext + + // IsGeneric_option_elemContext differentiates from other interfaces. + IsGeneric_option_elemContext() +} + +type Generic_option_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGeneric_option_elemContext() *Generic_option_elemContext { + var p = new(Generic_option_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_option_elem + return p +} + +func InitEmptyGeneric_option_elemContext(p *Generic_option_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_option_elem +} + +func (*Generic_option_elemContext) IsGeneric_option_elemContext() {} + +func NewGeneric_option_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Generic_option_elemContext { + var p = new(Generic_option_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_generic_option_elem + + return p +} + +func (s *Generic_option_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Generic_option_elemContext) Generic_option_name() IGeneric_option_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_option_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_option_nameContext) +} + +func (s *Generic_option_elemContext) Generic_option_arg() IGeneric_option_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_option_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_option_argContext) +} + +func (s *Generic_option_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Generic_option_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Generic_option_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGeneric_option_elem(s) + } +} + +func (s *Generic_option_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGeneric_option_elem(s) + } +} + +func (s *Generic_option_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGeneric_option_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Generic_option_elem() (localctx IGeneric_option_elemContext) { + localctx = NewGeneric_option_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 354, PostgreSQLParserRULE_generic_option_elem) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3854) + p.Generic_option_name() + } + { + p.SetState(3855) + p.Generic_option_arg() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGeneric_option_nameContext is an interface to support dynamic dispatch. +type IGeneric_option_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Collabel() ICollabelContext + + // IsGeneric_option_nameContext differentiates from other interfaces. + IsGeneric_option_nameContext() +} + +type Generic_option_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGeneric_option_nameContext() *Generic_option_nameContext { + var p = new(Generic_option_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_option_name + return p +} + +func InitEmptyGeneric_option_nameContext(p *Generic_option_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_option_name +} + +func (*Generic_option_nameContext) IsGeneric_option_nameContext() {} + +func NewGeneric_option_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Generic_option_nameContext { + var p = new(Generic_option_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_generic_option_name + + return p +} + +func (s *Generic_option_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Generic_option_nameContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Generic_option_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Generic_option_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Generic_option_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGeneric_option_name(s) + } +} + +func (s *Generic_option_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGeneric_option_name(s) + } +} + +func (s *Generic_option_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGeneric_option_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Generic_option_name() (localctx IGeneric_option_nameContext) { + localctx = NewGeneric_option_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 356, PostgreSQLParserRULE_generic_option_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3857) + p.Collabel() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGeneric_option_argContext is an interface to support dynamic dispatch. +type IGeneric_option_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + + // IsGeneric_option_argContext differentiates from other interfaces. + IsGeneric_option_argContext() +} + +type Generic_option_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGeneric_option_argContext() *Generic_option_argContext { + var p = new(Generic_option_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_option_arg + return p +} + +func InitEmptyGeneric_option_argContext(p *Generic_option_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generic_option_arg +} + +func (*Generic_option_argContext) IsGeneric_option_argContext() {} + +func NewGeneric_option_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Generic_option_argContext { + var p = new(Generic_option_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_generic_option_arg + + return p +} + +func (s *Generic_option_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Generic_option_argContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Generic_option_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Generic_option_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Generic_option_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGeneric_option_arg(s) + } +} + +func (s *Generic_option_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGeneric_option_arg(s) + } +} + +func (s *Generic_option_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGeneric_option_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Generic_option_arg() (localctx IGeneric_option_argContext) { + localctx = NewGeneric_option_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 358, PostgreSQLParserRULE_generic_option_arg) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3859) + p.Sconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateforeignserverstmtContext is an interface to support dynamic dispatch. +type ICreateforeignserverstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + SERVER() antlr.TerminalNode + AllName() []INameContext + Name(i int) INameContext + FOREIGN() antlr.TerminalNode + DATA_P() antlr.TerminalNode + WRAPPER() antlr.TerminalNode + Opt_type() IOpt_typeContext + Opt_foreign_server_version() IOpt_foreign_server_versionContext + Create_generic_options() ICreate_generic_optionsContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsCreateforeignserverstmtContext differentiates from other interfaces. + IsCreateforeignserverstmtContext() +} + +type CreateforeignserverstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateforeignserverstmtContext() *CreateforeignserverstmtContext { + var p = new(CreateforeignserverstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createforeignserverstmt + return p +} + +func InitEmptyCreateforeignserverstmtContext(p *CreateforeignserverstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createforeignserverstmt +} + +func (*CreateforeignserverstmtContext) IsCreateforeignserverstmtContext() {} + +func NewCreateforeignserverstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateforeignserverstmtContext { + var p = new(CreateforeignserverstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createforeignserverstmt + + return p +} + +func (s *CreateforeignserverstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateforeignserverstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateforeignserverstmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *CreateforeignserverstmtContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *CreateforeignserverstmtContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateforeignserverstmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *CreateforeignserverstmtContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *CreateforeignserverstmtContext) WRAPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRAPPER, 0) +} + +func (s *CreateforeignserverstmtContext) Opt_type() IOpt_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_typeContext) +} + +func (s *CreateforeignserverstmtContext) Opt_foreign_server_version() IOpt_foreign_server_versionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_foreign_server_versionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_foreign_server_versionContext) +} + +func (s *CreateforeignserverstmtContext) Create_generic_options() ICreate_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_generic_optionsContext) +} + +func (s *CreateforeignserverstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreateforeignserverstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreateforeignserverstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreateforeignserverstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateforeignserverstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateforeignserverstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateforeignserverstmt(s) + } +} + +func (s *CreateforeignserverstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateforeignserverstmt(s) + } +} + +func (s *CreateforeignserverstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateforeignserverstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createforeignserverstmt() (localctx ICreateforeignserverstmtContext) { + localctx = NewCreateforeignserverstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 360, PostgreSQLParserRULE_createforeignserverstmt) + var _la int + + p.SetState(3896) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 278, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3861) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3862) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3863) + p.Name() + } + p.SetState(3865) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTYPE_P { + { + p.SetState(3864) + p.Opt_type() + } + + } + p.SetState(3868) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVERSION_P { + { + p.SetState(3867) + p.Opt_foreign_server_version() + } + + } + { + p.SetState(3870) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3871) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3872) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3873) + p.Name() + } + p.SetState(3875) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(3874) + p.Create_generic_options() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3877) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3878) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3879) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3880) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3881) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3882) + p.Name() + } + p.SetState(3884) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTYPE_P { + { + p.SetState(3883) + p.Opt_type() + } + + } + p.SetState(3887) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVERSION_P { + { + p.SetState(3886) + p.Opt_foreign_server_version() + } + + } + { + p.SetState(3889) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3890) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3891) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3892) + p.Name() + } + p.SetState(3894) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(3893) + p.Create_generic_options() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_typeContext is an interface to support dynamic dispatch. +type IOpt_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TYPE_P() antlr.TerminalNode + Sconst() ISconstContext + + // IsOpt_typeContext differentiates from other interfaces. + IsOpt_typeContext() +} + +type Opt_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_typeContext() *Opt_typeContext { + var p = new(Opt_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_type + return p +} + +func InitEmptyOpt_typeContext(p *Opt_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_type +} + +func (*Opt_typeContext) IsOpt_typeContext() {} + +func NewOpt_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_typeContext { + var p = new(Opt_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_type + + return p +} + +func (s *Opt_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_typeContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *Opt_typeContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Opt_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_type(s) + } +} + +func (s *Opt_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_type(s) + } +} + +func (s *Opt_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_type() (localctx IOpt_typeContext) { + localctx = NewOpt_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 362, PostgreSQLParserRULE_opt_type) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3898) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3899) + p.Sconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IForeign_server_versionContext is an interface to support dynamic dispatch. +type IForeign_server_versionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + VERSION_P() antlr.TerminalNode + Sconst() ISconstContext + NULL_P() antlr.TerminalNode + + // IsForeign_server_versionContext differentiates from other interfaces. + IsForeign_server_versionContext() +} + +type Foreign_server_versionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyForeign_server_versionContext() *Foreign_server_versionContext { + var p = new(Foreign_server_versionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_foreign_server_version + return p +} + +func InitEmptyForeign_server_versionContext(p *Foreign_server_versionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_foreign_server_version +} + +func (*Foreign_server_versionContext) IsForeign_server_versionContext() {} + +func NewForeign_server_versionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Foreign_server_versionContext { + var p = new(Foreign_server_versionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_foreign_server_version + + return p +} + +func (s *Foreign_server_versionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Foreign_server_versionContext) VERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERSION_P, 0) +} + +func (s *Foreign_server_versionContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Foreign_server_versionContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Foreign_server_versionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Foreign_server_versionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Foreign_server_versionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterForeign_server_version(s) + } +} + +func (s *Foreign_server_versionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitForeign_server_version(s) + } +} + +func (s *Foreign_server_versionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitForeign_server_version(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Foreign_server_version() (localctx IForeign_server_versionContext) { + localctx = NewForeign_server_versionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 364, PostgreSQLParserRULE_foreign_server_version) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3901) + p.Match(PostgreSQLParserVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3904) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + { + p.SetState(3902) + p.Sconst() + } + + case PostgreSQLParserNULL_P: + { + p.SetState(3903) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_foreign_server_versionContext is an interface to support dynamic dispatch. +type IOpt_foreign_server_versionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Foreign_server_version() IForeign_server_versionContext + + // IsOpt_foreign_server_versionContext differentiates from other interfaces. + IsOpt_foreign_server_versionContext() +} + +type Opt_foreign_server_versionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_foreign_server_versionContext() *Opt_foreign_server_versionContext { + var p = new(Opt_foreign_server_versionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_foreign_server_version + return p +} + +func InitEmptyOpt_foreign_server_versionContext(p *Opt_foreign_server_versionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_foreign_server_version +} + +func (*Opt_foreign_server_versionContext) IsOpt_foreign_server_versionContext() {} + +func NewOpt_foreign_server_versionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_foreign_server_versionContext { + var p = new(Opt_foreign_server_versionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_foreign_server_version + + return p +} + +func (s *Opt_foreign_server_versionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_foreign_server_versionContext) Foreign_server_version() IForeign_server_versionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IForeign_server_versionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IForeign_server_versionContext) +} + +func (s *Opt_foreign_server_versionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_foreign_server_versionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_foreign_server_versionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_foreign_server_version(s) + } +} + +func (s *Opt_foreign_server_versionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_foreign_server_version(s) + } +} + +func (s *Opt_foreign_server_versionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_foreign_server_version(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_foreign_server_version() (localctx IOpt_foreign_server_versionContext) { + localctx = NewOpt_foreign_server_versionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 366, PostgreSQLParserRULE_opt_foreign_server_version) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3906) + p.Foreign_server_version() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterforeignserverstmtContext is an interface to support dynamic dispatch. +type IAlterforeignserverstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + SERVER() antlr.TerminalNode + Name() INameContext + Alter_generic_options() IAlter_generic_optionsContext + Foreign_server_version() IForeign_server_versionContext + + // IsAlterforeignserverstmtContext differentiates from other interfaces. + IsAlterforeignserverstmtContext() +} + +type AlterforeignserverstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterforeignserverstmtContext() *AlterforeignserverstmtContext { + var p = new(AlterforeignserverstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterforeignserverstmt + return p +} + +func InitEmptyAlterforeignserverstmtContext(p *AlterforeignserverstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterforeignserverstmt +} + +func (*AlterforeignserverstmtContext) IsAlterforeignserverstmtContext() {} + +func NewAlterforeignserverstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterforeignserverstmtContext { + var p = new(AlterforeignserverstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterforeignserverstmt + + return p +} + +func (s *AlterforeignserverstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterforeignserverstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterforeignserverstmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *AlterforeignserverstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterforeignserverstmtContext) Alter_generic_options() IAlter_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_generic_optionsContext) +} + +func (s *AlterforeignserverstmtContext) Foreign_server_version() IForeign_server_versionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IForeign_server_versionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IForeign_server_versionContext) +} + +func (s *AlterforeignserverstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterforeignserverstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterforeignserverstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterforeignserverstmt(s) + } +} + +func (s *AlterforeignserverstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterforeignserverstmt(s) + } +} + +func (s *AlterforeignserverstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterforeignserverstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterforeignserverstmt() (localctx IAlterforeignserverstmtContext) { + localctx = NewAlterforeignserverstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 368, PostgreSQLParserRULE_alterforeignserverstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3908) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3909) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3910) + p.Name() + } + p.SetState(3916) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPTIONS: + { + p.SetState(3911) + p.Alter_generic_options() + } + + case PostgreSQLParserVERSION_P: + { + p.SetState(3912) + p.Foreign_server_version() + } + p.SetState(3914) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(3913) + p.Alter_generic_options() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateforeigntablestmtContext is an interface to support dynamic dispatch. +type ICreateforeigntablestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + TABLE() antlr.TerminalNode + AllQualified_name() []IQualified_nameContext + Qualified_name(i int) IQualified_nameContext + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + SERVER() antlr.TerminalNode + Name() INameContext + Opttableelementlist() IOpttableelementlistContext + Optinherit() IOptinheritContext + Create_generic_options() ICreate_generic_optionsContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + PARTITION() antlr.TerminalNode + OF() antlr.TerminalNode + Partitionboundspec() IPartitionboundspecContext + Opttypedtableelementlist() IOpttypedtableelementlistContext + + // IsCreateforeigntablestmtContext differentiates from other interfaces. + IsCreateforeigntablestmtContext() +} + +type CreateforeigntablestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateforeigntablestmtContext() *CreateforeigntablestmtContext { + var p = new(CreateforeigntablestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createforeigntablestmt + return p +} + +func InitEmptyCreateforeigntablestmtContext(p *CreateforeigntablestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createforeigntablestmt +} + +func (*CreateforeigntablestmtContext) IsCreateforeigntablestmtContext() {} + +func NewCreateforeigntablestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateforeigntablestmtContext { + var p = new(CreateforeigntablestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createforeigntablestmt + + return p +} + +func (s *CreateforeigntablestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateforeigntablestmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateforeigntablestmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *CreateforeigntablestmtContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *CreateforeigntablestmtContext) AllQualified_name() []IQualified_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IQualified_nameContext); ok { + len++ + } + } + + tst := make([]IQualified_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IQualified_nameContext); ok { + tst[i] = t.(IQualified_nameContext) + i++ + } + } + + return tst +} + +func (s *CreateforeigntablestmtContext) Qualified_name(i int) IQualified_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *CreateforeigntablestmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CreateforeigntablestmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CreateforeigntablestmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *CreateforeigntablestmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateforeigntablestmtContext) Opttableelementlist() IOpttableelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttableelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttableelementlistContext) +} + +func (s *CreateforeigntablestmtContext) Optinherit() IOptinheritContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptinheritContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptinheritContext) +} + +func (s *CreateforeigntablestmtContext) Create_generic_options() ICreate_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_generic_optionsContext) +} + +func (s *CreateforeigntablestmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreateforeigntablestmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreateforeigntablestmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreateforeigntablestmtContext) PARTITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTITION, 0) +} + +func (s *CreateforeigntablestmtContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *CreateforeigntablestmtContext) Partitionboundspec() IPartitionboundspecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPartitionboundspecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPartitionboundspecContext) +} + +func (s *CreateforeigntablestmtContext) Opttypedtableelementlist() IOpttypedtableelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttypedtableelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttypedtableelementlistContext) +} + +func (s *CreateforeigntablestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateforeigntablestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateforeigntablestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateforeigntablestmt(s) + } +} + +func (s *CreateforeigntablestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateforeigntablestmt(s) + } +} + +func (s *CreateforeigntablestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateforeigntablestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createforeigntablestmt() (localctx ICreateforeigntablestmtContext) { + localctx = NewCreateforeigntablestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 370, PostgreSQLParserRULE_createforeigntablestmt) + var _la int + + p.SetState(3990) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 292, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3918) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3919) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3920) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3921) + p.Qualified_name() + } + { + p.SetState(3922) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3924) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 282, p.GetParserRuleContext()) == 1 { + { + p.SetState(3923) + p.Opttableelementlist() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3926) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3928) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINHERITS { + { + p.SetState(3927) + p.Optinherit() + } + + } + { + p.SetState(3930) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3931) + p.Name() + } + p.SetState(3933) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(3932) + p.Create_generic_options() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(3935) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3936) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3937) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3938) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3939) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3940) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3941) + p.Qualified_name() + } + { + p.SetState(3942) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3944) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 285, p.GetParserRuleContext()) == 1 { + { + p.SetState(3943) + p.Opttableelementlist() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(3946) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(3948) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINHERITS { + { + p.SetState(3947) + p.Optinherit() + } + + } + { + p.SetState(3950) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3951) + p.Name() + } + p.SetState(3953) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(3952) + p.Create_generic_options() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(3955) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3956) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3957) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3958) + p.Qualified_name() + } + { + p.SetState(3959) + p.Match(PostgreSQLParserPARTITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3960) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3961) + p.Qualified_name() + } + p.SetState(3963) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(3962) + p.Opttypedtableelementlist() + } + + } + { + p.SetState(3965) + p.Partitionboundspec() + } + { + p.SetState(3966) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3967) + p.Name() + } + p.SetState(3969) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(3968) + p.Create_generic_options() + } + + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(3971) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3972) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3973) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3974) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3975) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3976) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3977) + p.Qualified_name() + } + { + p.SetState(3978) + p.Match(PostgreSQLParserPARTITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3979) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3980) + p.Qualified_name() + } + p.SetState(3982) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(3981) + p.Opttypedtableelementlist() + } + + } + { + p.SetState(3984) + p.Partitionboundspec() + } + { + p.SetState(3985) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3986) + p.Name() + } + p.SetState(3988) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(3987) + p.Create_generic_options() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IImportforeignschemastmtContext is an interface to support dynamic dispatch. +type IImportforeignschemastmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IMPORT_P() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + AllName() []INameContext + Name(i int) INameContext + FROM() antlr.TerminalNode + SERVER() antlr.TerminalNode + INTO() antlr.TerminalNode + Import_qualification() IImport_qualificationContext + Create_generic_options() ICreate_generic_optionsContext + + // IsImportforeignschemastmtContext differentiates from other interfaces. + IsImportforeignschemastmtContext() +} + +type ImportforeignschemastmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyImportforeignschemastmtContext() *ImportforeignschemastmtContext { + var p = new(ImportforeignschemastmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_importforeignschemastmt + return p +} + +func InitEmptyImportforeignschemastmtContext(p *ImportforeignschemastmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_importforeignschemastmt +} + +func (*ImportforeignschemastmtContext) IsImportforeignschemastmtContext() {} + +func NewImportforeignschemastmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImportforeignschemastmtContext { + var p = new(ImportforeignschemastmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_importforeignschemastmt + + return p +} + +func (s *ImportforeignschemastmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ImportforeignschemastmtContext) IMPORT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMPORT_P, 0) +} + +func (s *ImportforeignschemastmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *ImportforeignschemastmtContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *ImportforeignschemastmtContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *ImportforeignschemastmtContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *ImportforeignschemastmtContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *ImportforeignschemastmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *ImportforeignschemastmtContext) INTO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTO, 0) +} + +func (s *ImportforeignschemastmtContext) Import_qualification() IImport_qualificationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IImport_qualificationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IImport_qualificationContext) +} + +func (s *ImportforeignschemastmtContext) Create_generic_options() ICreate_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_generic_optionsContext) +} + +func (s *ImportforeignschemastmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ImportforeignschemastmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ImportforeignschemastmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterImportforeignschemastmt(s) + } +} + +func (s *ImportforeignschemastmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitImportforeignschemastmt(s) + } +} + +func (s *ImportforeignschemastmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitImportforeignschemastmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Importforeignschemastmt() (localctx IImportforeignschemastmtContext) { + localctx = NewImportforeignschemastmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 372, PostgreSQLParserRULE_importforeignschemastmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(3992) + p.Match(PostgreSQLParserIMPORT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3993) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3994) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(3995) + p.Name() + } + p.SetState(3997) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEXCEPT || _la == PostgreSQLParserLIMIT { + { + p.SetState(3996) + p.Import_qualification() + } + + } + { + p.SetState(3999) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4000) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4001) + p.Name() + } + { + p.SetState(4002) + p.Match(PostgreSQLParserINTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4003) + p.Name() + } + p.SetState(4005) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(4004) + p.Create_generic_options() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IImport_qualification_typeContext is an interface to support dynamic dispatch. +type IImport_qualification_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LIMIT() antlr.TerminalNode + TO() antlr.TerminalNode + EXCEPT() antlr.TerminalNode + + // IsImport_qualification_typeContext differentiates from other interfaces. + IsImport_qualification_typeContext() +} + +type Import_qualification_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyImport_qualification_typeContext() *Import_qualification_typeContext { + var p = new(Import_qualification_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_import_qualification_type + return p +} + +func InitEmptyImport_qualification_typeContext(p *Import_qualification_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_import_qualification_type +} + +func (*Import_qualification_typeContext) IsImport_qualification_typeContext() {} + +func NewImport_qualification_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Import_qualification_typeContext { + var p = new(Import_qualification_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_import_qualification_type + + return p +} + +func (s *Import_qualification_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Import_qualification_typeContext) LIMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIMIT, 0) +} + +func (s *Import_qualification_typeContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Import_qualification_typeContext) EXCEPT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCEPT, 0) +} + +func (s *Import_qualification_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Import_qualification_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Import_qualification_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterImport_qualification_type(s) + } +} + +func (s *Import_qualification_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitImport_qualification_type(s) + } +} + +func (s *Import_qualification_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitImport_qualification_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Import_qualification_type() (localctx IImport_qualification_typeContext) { + localctx = NewImport_qualification_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 374, PostgreSQLParserRULE_import_qualification_type) + p.SetState(4010) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserLIMIT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4007) + p.Match(PostgreSQLParserLIMIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4008) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserEXCEPT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4009) + p.Match(PostgreSQLParserEXCEPT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IImport_qualificationContext is an interface to support dynamic dispatch. +type IImport_qualificationContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Import_qualification_type() IImport_qualification_typeContext + OPEN_PAREN() antlr.TerminalNode + Relation_expr_list() IRelation_expr_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsImport_qualificationContext differentiates from other interfaces. + IsImport_qualificationContext() +} + +type Import_qualificationContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyImport_qualificationContext() *Import_qualificationContext { + var p = new(Import_qualificationContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_import_qualification + return p +} + +func InitEmptyImport_qualificationContext(p *Import_qualificationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_import_qualification +} + +func (*Import_qualificationContext) IsImport_qualificationContext() {} + +func NewImport_qualificationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Import_qualificationContext { + var p = new(Import_qualificationContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_import_qualification + + return p +} + +func (s *Import_qualificationContext) GetParser() antlr.Parser { return s.parser } + +func (s *Import_qualificationContext) Import_qualification_type() IImport_qualification_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IImport_qualification_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IImport_qualification_typeContext) +} + +func (s *Import_qualificationContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Import_qualificationContext) Relation_expr_list() IRelation_expr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_expr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_expr_listContext) +} + +func (s *Import_qualificationContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Import_qualificationContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Import_qualificationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Import_qualificationContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterImport_qualification(s) + } +} + +func (s *Import_qualificationContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitImport_qualification(s) + } +} + +func (s *Import_qualificationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitImport_qualification(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Import_qualification() (localctx IImport_qualificationContext) { + localctx = NewImport_qualificationContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 376, PostgreSQLParserRULE_import_qualification) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4012) + p.Import_qualification_type() + } + { + p.SetState(4013) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4014) + p.Relation_expr_list() + } + { + p.SetState(4015) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateusermappingstmtContext is an interface to support dynamic dispatch. +type ICreateusermappingstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + USER() antlr.TerminalNode + MAPPING() antlr.TerminalNode + FOR() antlr.TerminalNode + Auth_ident() IAuth_identContext + SERVER() antlr.TerminalNode + Name() INameContext + Create_generic_options() ICreate_generic_optionsContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsCreateusermappingstmtContext differentiates from other interfaces. + IsCreateusermappingstmtContext() +} + +type CreateusermappingstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateusermappingstmtContext() *CreateusermappingstmtContext { + var p = new(CreateusermappingstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createusermappingstmt + return p +} + +func InitEmptyCreateusermappingstmtContext(p *CreateusermappingstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createusermappingstmt +} + +func (*CreateusermappingstmtContext) IsCreateusermappingstmtContext() {} + +func NewCreateusermappingstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateusermappingstmtContext { + var p = new(CreateusermappingstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createusermappingstmt + + return p +} + +func (s *CreateusermappingstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateusermappingstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateusermappingstmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *CreateusermappingstmtContext) MAPPING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAPPING, 0) +} + +func (s *CreateusermappingstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *CreateusermappingstmtContext) Auth_ident() IAuth_identContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAuth_identContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAuth_identContext) +} + +func (s *CreateusermappingstmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *CreateusermappingstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateusermappingstmtContext) Create_generic_options() ICreate_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_generic_optionsContext) +} + +func (s *CreateusermappingstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *CreateusermappingstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *CreateusermappingstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *CreateusermappingstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateusermappingstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateusermappingstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateusermappingstmt(s) + } +} + +func (s *CreateusermappingstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateusermappingstmt(s) + } +} + +func (s *CreateusermappingstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateusermappingstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createusermappingstmt() (localctx ICreateusermappingstmtContext) { + localctx = NewCreateusermappingstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 378, PostgreSQLParserRULE_createusermappingstmt) + var _la int + + p.SetState(4040) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 298, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4017) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4018) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4019) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4020) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4021) + p.Auth_ident() + } + { + p.SetState(4022) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4023) + p.Name() + } + p.SetState(4025) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(4024) + p.Create_generic_options() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4027) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4028) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4029) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4030) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4031) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4032) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4033) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4034) + p.Auth_ident() + } + { + p.SetState(4035) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4036) + p.Name() + } + p.SetState(4038) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPTIONS { + { + p.SetState(4037) + p.Create_generic_options() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAuth_identContext is an interface to support dynamic dispatch. +type IAuth_identContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Rolespec() IRolespecContext + USER() antlr.TerminalNode + + // IsAuth_identContext differentiates from other interfaces. + IsAuth_identContext() +} + +type Auth_identContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAuth_identContext() *Auth_identContext { + var p = new(Auth_identContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_auth_ident + return p +} + +func InitEmptyAuth_identContext(p *Auth_identContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_auth_ident +} + +func (*Auth_identContext) IsAuth_identContext() {} + +func NewAuth_identContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Auth_identContext { + var p = new(Auth_identContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_auth_ident + + return p +} + +func (s *Auth_identContext) GetParser() antlr.Parser { return s.parser } + +func (s *Auth_identContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *Auth_identContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *Auth_identContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Auth_identContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Auth_identContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAuth_ident(s) + } +} + +func (s *Auth_identContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAuth_ident(s) + } +} + +func (s *Auth_identContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAuth_ident(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Auth_ident() (localctx IAuth_identContext) { + localctx = NewAuth_identContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 380, PostgreSQLParserRULE_auth_ident) + p.SetState(4044) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserSESSION_USER, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4042) + p.Rolespec() + } + + case PostgreSQLParserUSER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4043) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDropusermappingstmtContext is an interface to support dynamic dispatch. +type IDropusermappingstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + USER() antlr.TerminalNode + MAPPING() antlr.TerminalNode + FOR() antlr.TerminalNode + Auth_ident() IAuth_identContext + SERVER() antlr.TerminalNode + Name() INameContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsDropusermappingstmtContext differentiates from other interfaces. + IsDropusermappingstmtContext() +} + +type DropusermappingstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDropusermappingstmtContext() *DropusermappingstmtContext { + var p = new(DropusermappingstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropusermappingstmt + return p +} + +func InitEmptyDropusermappingstmtContext(p *DropusermappingstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropusermappingstmt +} + +func (*DropusermappingstmtContext) IsDropusermappingstmtContext() {} + +func NewDropusermappingstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropusermappingstmtContext { + var p = new(DropusermappingstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dropusermappingstmt + + return p +} + +func (s *DropusermappingstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DropusermappingstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DropusermappingstmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *DropusermappingstmtContext) MAPPING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAPPING, 0) +} + +func (s *DropusermappingstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *DropusermappingstmtContext) Auth_ident() IAuth_identContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAuth_identContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAuth_identContext) +} + +func (s *DropusermappingstmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *DropusermappingstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DropusermappingstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DropusermappingstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DropusermappingstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DropusermappingstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DropusermappingstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDropusermappingstmt(s) + } +} + +func (s *DropusermappingstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDropusermappingstmt(s) + } +} + +func (s *DropusermappingstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDropusermappingstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dropusermappingstmt() (localctx IDropusermappingstmtContext) { + localctx = NewDropusermappingstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 382, PostgreSQLParserRULE_dropusermappingstmt) + p.SetState(4064) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 300, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4046) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4047) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4048) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4049) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4050) + p.Auth_ident() + } + { + p.SetState(4051) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4052) + p.Name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4054) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4055) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4056) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4057) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4058) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4059) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4060) + p.Auth_ident() + } + { + p.SetState(4061) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4062) + p.Name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterusermappingstmtContext is an interface to support dynamic dispatch. +type IAlterusermappingstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + USER() antlr.TerminalNode + MAPPING() antlr.TerminalNode + FOR() antlr.TerminalNode + Auth_ident() IAuth_identContext + SERVER() antlr.TerminalNode + Name() INameContext + Alter_generic_options() IAlter_generic_optionsContext + + // IsAlterusermappingstmtContext differentiates from other interfaces. + IsAlterusermappingstmtContext() +} + +type AlterusermappingstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterusermappingstmtContext() *AlterusermappingstmtContext { + var p = new(AlterusermappingstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterusermappingstmt + return p +} + +func InitEmptyAlterusermappingstmtContext(p *AlterusermappingstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterusermappingstmt +} + +func (*AlterusermappingstmtContext) IsAlterusermappingstmtContext() {} + +func NewAlterusermappingstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterusermappingstmtContext { + var p = new(AlterusermappingstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterusermappingstmt + + return p +} + +func (s *AlterusermappingstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterusermappingstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterusermappingstmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *AlterusermappingstmtContext) MAPPING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAPPING, 0) +} + +func (s *AlterusermappingstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *AlterusermappingstmtContext) Auth_ident() IAuth_identContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAuth_identContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAuth_identContext) +} + +func (s *AlterusermappingstmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *AlterusermappingstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterusermappingstmtContext) Alter_generic_options() IAlter_generic_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_generic_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_generic_optionsContext) +} + +func (s *AlterusermappingstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterusermappingstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterusermappingstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterusermappingstmt(s) + } +} + +func (s *AlterusermappingstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterusermappingstmt(s) + } +} + +func (s *AlterusermappingstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterusermappingstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterusermappingstmt() (localctx IAlterusermappingstmtContext) { + localctx = NewAlterusermappingstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 384, PostgreSQLParserRULE_alterusermappingstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4066) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4067) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4068) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4069) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4070) + p.Auth_ident() + } + { + p.SetState(4071) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4072) + p.Name() + } + { + p.SetState(4073) + p.Alter_generic_options() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatepolicystmtContext is an interface to support dynamic dispatch. +type ICreatepolicystmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + POLICY() antlr.TerminalNode + Name() INameContext + ON() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Rowsecuritydefaultpermissive() IRowsecuritydefaultpermissiveContext + Rowsecuritydefaultforcmd() IRowsecuritydefaultforcmdContext + Rowsecuritydefaulttorole() IRowsecuritydefaulttoroleContext + Rowsecurityoptionalexpr() IRowsecurityoptionalexprContext + Rowsecurityoptionalwithcheck() IRowsecurityoptionalwithcheckContext + + // IsCreatepolicystmtContext differentiates from other interfaces. + IsCreatepolicystmtContext() +} + +type CreatepolicystmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatepolicystmtContext() *CreatepolicystmtContext { + var p = new(CreatepolicystmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createpolicystmt + return p +} + +func InitEmptyCreatepolicystmtContext(p *CreatepolicystmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createpolicystmt +} + +func (*CreatepolicystmtContext) IsCreatepolicystmtContext() {} + +func NewCreatepolicystmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatepolicystmtContext { + var p = new(CreatepolicystmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createpolicystmt + + return p +} + +func (s *CreatepolicystmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatepolicystmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatepolicystmtContext) POLICY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPOLICY, 0) +} + +func (s *CreatepolicystmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreatepolicystmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *CreatepolicystmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *CreatepolicystmtContext) Rowsecuritydefaultpermissive() IRowsecuritydefaultpermissiveContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsecuritydefaultpermissiveContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsecuritydefaultpermissiveContext) +} + +func (s *CreatepolicystmtContext) Rowsecuritydefaultforcmd() IRowsecuritydefaultforcmdContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsecuritydefaultforcmdContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsecuritydefaultforcmdContext) +} + +func (s *CreatepolicystmtContext) Rowsecuritydefaulttorole() IRowsecuritydefaulttoroleContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsecuritydefaulttoroleContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsecuritydefaulttoroleContext) +} + +func (s *CreatepolicystmtContext) Rowsecurityoptionalexpr() IRowsecurityoptionalexprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsecurityoptionalexprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsecurityoptionalexprContext) +} + +func (s *CreatepolicystmtContext) Rowsecurityoptionalwithcheck() IRowsecurityoptionalwithcheckContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsecurityoptionalwithcheckContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsecurityoptionalwithcheckContext) +} + +func (s *CreatepolicystmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatepolicystmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatepolicystmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatepolicystmt(s) + } +} + +func (s *CreatepolicystmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatepolicystmt(s) + } +} + +func (s *CreatepolicystmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatepolicystmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createpolicystmt() (localctx ICreatepolicystmtContext) { + localctx = NewCreatepolicystmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 386, PostgreSQLParserRULE_createpolicystmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4075) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4076) + p.Match(PostgreSQLParserPOLICY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4077) + p.Name() + } + { + p.SetState(4078) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4079) + p.Qualified_name() + } + p.SetState(4081) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(4080) + p.Rowsecuritydefaultpermissive() + } + + } + p.SetState(4084) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(4083) + p.Rowsecuritydefaultforcmd() + } + + } + p.SetState(4087) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTO { + { + p.SetState(4086) + p.Rowsecuritydefaulttorole() + } + + } + p.SetState(4090) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(4089) + p.Rowsecurityoptionalexpr() + } + + } + p.SetState(4093) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 305, p.GetParserRuleContext()) == 1 { + { + p.SetState(4092) + p.Rowsecurityoptionalwithcheck() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterpolicystmtContext is an interface to support dynamic dispatch. +type IAlterpolicystmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + POLICY() antlr.TerminalNode + Name() INameContext + ON() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Rowsecurityoptionaltorole() IRowsecurityoptionaltoroleContext + Rowsecurityoptionalexpr() IRowsecurityoptionalexprContext + Rowsecurityoptionalwithcheck() IRowsecurityoptionalwithcheckContext + + // IsAlterpolicystmtContext differentiates from other interfaces. + IsAlterpolicystmtContext() +} + +type AlterpolicystmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterpolicystmtContext() *AlterpolicystmtContext { + var p = new(AlterpolicystmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterpolicystmt + return p +} + +func InitEmptyAlterpolicystmtContext(p *AlterpolicystmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterpolicystmt +} + +func (*AlterpolicystmtContext) IsAlterpolicystmtContext() {} + +func NewAlterpolicystmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterpolicystmtContext { + var p = new(AlterpolicystmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterpolicystmt + + return p +} + +func (s *AlterpolicystmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterpolicystmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterpolicystmtContext) POLICY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPOLICY, 0) +} + +func (s *AlterpolicystmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterpolicystmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *AlterpolicystmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *AlterpolicystmtContext) Rowsecurityoptionaltorole() IRowsecurityoptionaltoroleContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsecurityoptionaltoroleContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsecurityoptionaltoroleContext) +} + +func (s *AlterpolicystmtContext) Rowsecurityoptionalexpr() IRowsecurityoptionalexprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsecurityoptionalexprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsecurityoptionalexprContext) +} + +func (s *AlterpolicystmtContext) Rowsecurityoptionalwithcheck() IRowsecurityoptionalwithcheckContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsecurityoptionalwithcheckContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsecurityoptionalwithcheckContext) +} + +func (s *AlterpolicystmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterpolicystmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterpolicystmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterpolicystmt(s) + } +} + +func (s *AlterpolicystmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterpolicystmt(s) + } +} + +func (s *AlterpolicystmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterpolicystmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterpolicystmt() (localctx IAlterpolicystmtContext) { + localctx = NewAlterpolicystmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 388, PostgreSQLParserRULE_alterpolicystmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4095) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4096) + p.Match(PostgreSQLParserPOLICY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4097) + p.Name() + } + { + p.SetState(4098) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4099) + p.Qualified_name() + } + p.SetState(4101) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTO { + { + p.SetState(4100) + p.Rowsecurityoptionaltorole() + } + + } + p.SetState(4104) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(4103) + p.Rowsecurityoptionalexpr() + } + + } + p.SetState(4107) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 308, p.GetParserRuleContext()) == 1 { + { + p.SetState(4106) + p.Rowsecurityoptionalwithcheck() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowsecurityoptionalexprContext is an interface to support dynamic dispatch. +type IRowsecurityoptionalexprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsRowsecurityoptionalexprContext differentiates from other interfaces. + IsRowsecurityoptionalexprContext() +} + +type RowsecurityoptionalexprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowsecurityoptionalexprContext() *RowsecurityoptionalexprContext { + var p = new(RowsecurityoptionalexprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionalexpr + return p +} + +func InitEmptyRowsecurityoptionalexprContext(p *RowsecurityoptionalexprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionalexpr +} + +func (*RowsecurityoptionalexprContext) IsRowsecurityoptionalexprContext() {} + +func NewRowsecurityoptionalexprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowsecurityoptionalexprContext { + var p = new(RowsecurityoptionalexprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionalexpr + + return p +} + +func (s *RowsecurityoptionalexprContext) GetParser() antlr.Parser { return s.parser } + +func (s *RowsecurityoptionalexprContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *RowsecurityoptionalexprContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *RowsecurityoptionalexprContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *RowsecurityoptionalexprContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *RowsecurityoptionalexprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RowsecurityoptionalexprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RowsecurityoptionalexprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRowsecurityoptionalexpr(s) + } +} + +func (s *RowsecurityoptionalexprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRowsecurityoptionalexpr(s) + } +} + +func (s *RowsecurityoptionalexprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRowsecurityoptionalexpr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rowsecurityoptionalexpr() (localctx IRowsecurityoptionalexprContext) { + localctx = NewRowsecurityoptionalexprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 390, PostgreSQLParserRULE_rowsecurityoptionalexpr) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4109) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4110) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4111) + p.A_expr() + } + { + p.SetState(4112) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowsecurityoptionalwithcheckContext is an interface to support dynamic dispatch. +type IRowsecurityoptionalwithcheckContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + CHECK() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsRowsecurityoptionalwithcheckContext differentiates from other interfaces. + IsRowsecurityoptionalwithcheckContext() +} + +type RowsecurityoptionalwithcheckContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowsecurityoptionalwithcheckContext() *RowsecurityoptionalwithcheckContext { + var p = new(RowsecurityoptionalwithcheckContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionalwithcheck + return p +} + +func InitEmptyRowsecurityoptionalwithcheckContext(p *RowsecurityoptionalwithcheckContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionalwithcheck +} + +func (*RowsecurityoptionalwithcheckContext) IsRowsecurityoptionalwithcheckContext() {} + +func NewRowsecurityoptionalwithcheckContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowsecurityoptionalwithcheckContext { + var p = new(RowsecurityoptionalwithcheckContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionalwithcheck + + return p +} + +func (s *RowsecurityoptionalwithcheckContext) GetParser() antlr.Parser { return s.parser } + +func (s *RowsecurityoptionalwithcheckContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *RowsecurityoptionalwithcheckContext) CHECK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHECK, 0) +} + +func (s *RowsecurityoptionalwithcheckContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *RowsecurityoptionalwithcheckContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *RowsecurityoptionalwithcheckContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *RowsecurityoptionalwithcheckContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RowsecurityoptionalwithcheckContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RowsecurityoptionalwithcheckContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRowsecurityoptionalwithcheck(s) + } +} + +func (s *RowsecurityoptionalwithcheckContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRowsecurityoptionalwithcheck(s) + } +} + +func (s *RowsecurityoptionalwithcheckContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRowsecurityoptionalwithcheck(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rowsecurityoptionalwithcheck() (localctx IRowsecurityoptionalwithcheckContext) { + localctx = NewRowsecurityoptionalwithcheckContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 392, PostgreSQLParserRULE_rowsecurityoptionalwithcheck) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4114) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4115) + p.Match(PostgreSQLParserCHECK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4116) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4117) + p.A_expr() + } + { + p.SetState(4118) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowsecuritydefaulttoroleContext is an interface to support dynamic dispatch. +type IRowsecuritydefaulttoroleContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TO() antlr.TerminalNode + Role_list() IRole_listContext + + // IsRowsecuritydefaulttoroleContext differentiates from other interfaces. + IsRowsecuritydefaulttoroleContext() +} + +type RowsecuritydefaulttoroleContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowsecuritydefaulttoroleContext() *RowsecuritydefaulttoroleContext { + var p = new(RowsecuritydefaulttoroleContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaulttorole + return p +} + +func InitEmptyRowsecuritydefaulttoroleContext(p *RowsecuritydefaulttoroleContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaulttorole +} + +func (*RowsecuritydefaulttoroleContext) IsRowsecuritydefaulttoroleContext() {} + +func NewRowsecuritydefaulttoroleContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowsecuritydefaulttoroleContext { + var p = new(RowsecuritydefaulttoroleContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaulttorole + + return p +} + +func (s *RowsecuritydefaulttoroleContext) GetParser() antlr.Parser { return s.parser } + +func (s *RowsecuritydefaulttoroleContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *RowsecuritydefaulttoroleContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *RowsecuritydefaulttoroleContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RowsecuritydefaulttoroleContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RowsecuritydefaulttoroleContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRowsecuritydefaulttorole(s) + } +} + +func (s *RowsecuritydefaulttoroleContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRowsecuritydefaulttorole(s) + } +} + +func (s *RowsecuritydefaulttoroleContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRowsecuritydefaulttorole(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rowsecuritydefaulttorole() (localctx IRowsecuritydefaulttoroleContext) { + localctx = NewRowsecuritydefaulttoroleContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 394, PostgreSQLParserRULE_rowsecuritydefaulttorole) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4120) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4121) + p.Role_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowsecurityoptionaltoroleContext is an interface to support dynamic dispatch. +type IRowsecurityoptionaltoroleContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TO() antlr.TerminalNode + Role_list() IRole_listContext + + // IsRowsecurityoptionaltoroleContext differentiates from other interfaces. + IsRowsecurityoptionaltoroleContext() +} + +type RowsecurityoptionaltoroleContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowsecurityoptionaltoroleContext() *RowsecurityoptionaltoroleContext { + var p = new(RowsecurityoptionaltoroleContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionaltorole + return p +} + +func InitEmptyRowsecurityoptionaltoroleContext(p *RowsecurityoptionaltoroleContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionaltorole +} + +func (*RowsecurityoptionaltoroleContext) IsRowsecurityoptionaltoroleContext() {} + +func NewRowsecurityoptionaltoroleContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowsecurityoptionaltoroleContext { + var p = new(RowsecurityoptionaltoroleContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rowsecurityoptionaltorole + + return p +} + +func (s *RowsecurityoptionaltoroleContext) GetParser() antlr.Parser { return s.parser } + +func (s *RowsecurityoptionaltoroleContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *RowsecurityoptionaltoroleContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *RowsecurityoptionaltoroleContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RowsecurityoptionaltoroleContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RowsecurityoptionaltoroleContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRowsecurityoptionaltorole(s) + } +} + +func (s *RowsecurityoptionaltoroleContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRowsecurityoptionaltorole(s) + } +} + +func (s *RowsecurityoptionaltoroleContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRowsecurityoptionaltorole(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rowsecurityoptionaltorole() (localctx IRowsecurityoptionaltoroleContext) { + localctx = NewRowsecurityoptionaltoroleContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 396, PostgreSQLParserRULE_rowsecurityoptionaltorole) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4123) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4124) + p.Role_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowsecuritydefaultpermissiveContext is an interface to support dynamic dispatch. +type IRowsecuritydefaultpermissiveContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AS() antlr.TerminalNode + Identifier() IIdentifierContext + + // IsRowsecuritydefaultpermissiveContext differentiates from other interfaces. + IsRowsecuritydefaultpermissiveContext() +} + +type RowsecuritydefaultpermissiveContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowsecuritydefaultpermissiveContext() *RowsecuritydefaultpermissiveContext { + var p = new(RowsecuritydefaultpermissiveContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaultpermissive + return p +} + +func InitEmptyRowsecuritydefaultpermissiveContext(p *RowsecuritydefaultpermissiveContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaultpermissive +} + +func (*RowsecuritydefaultpermissiveContext) IsRowsecuritydefaultpermissiveContext() {} + +func NewRowsecuritydefaultpermissiveContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowsecuritydefaultpermissiveContext { + var p = new(RowsecuritydefaultpermissiveContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaultpermissive + + return p +} + +func (s *RowsecuritydefaultpermissiveContext) GetParser() antlr.Parser { return s.parser } + +func (s *RowsecuritydefaultpermissiveContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *RowsecuritydefaultpermissiveContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *RowsecuritydefaultpermissiveContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RowsecuritydefaultpermissiveContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RowsecuritydefaultpermissiveContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRowsecuritydefaultpermissive(s) + } +} + +func (s *RowsecuritydefaultpermissiveContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRowsecuritydefaultpermissive(s) + } +} + +func (s *RowsecuritydefaultpermissiveContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRowsecuritydefaultpermissive(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rowsecuritydefaultpermissive() (localctx IRowsecuritydefaultpermissiveContext) { + localctx = NewRowsecuritydefaultpermissiveContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 398, PostgreSQLParserRULE_rowsecuritydefaultpermissive) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4126) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4127) + p.Identifier() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowsecuritydefaultforcmdContext is an interface to support dynamic dispatch. +type IRowsecuritydefaultforcmdContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FOR() antlr.TerminalNode + Row_security_cmd() IRow_security_cmdContext + + // IsRowsecuritydefaultforcmdContext differentiates from other interfaces. + IsRowsecuritydefaultforcmdContext() +} + +type RowsecuritydefaultforcmdContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowsecuritydefaultforcmdContext() *RowsecuritydefaultforcmdContext { + var p = new(RowsecuritydefaultforcmdContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaultforcmd + return p +} + +func InitEmptyRowsecuritydefaultforcmdContext(p *RowsecuritydefaultforcmdContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaultforcmd +} + +func (*RowsecuritydefaultforcmdContext) IsRowsecuritydefaultforcmdContext() {} + +func NewRowsecuritydefaultforcmdContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowsecuritydefaultforcmdContext { + var p = new(RowsecuritydefaultforcmdContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rowsecuritydefaultforcmd + + return p +} + +func (s *RowsecuritydefaultforcmdContext) GetParser() antlr.Parser { return s.parser } + +func (s *RowsecuritydefaultforcmdContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *RowsecuritydefaultforcmdContext) Row_security_cmd() IRow_security_cmdContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRow_security_cmdContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRow_security_cmdContext) +} + +func (s *RowsecuritydefaultforcmdContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RowsecuritydefaultforcmdContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RowsecuritydefaultforcmdContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRowsecuritydefaultforcmd(s) + } +} + +func (s *RowsecuritydefaultforcmdContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRowsecuritydefaultforcmd(s) + } +} + +func (s *RowsecuritydefaultforcmdContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRowsecuritydefaultforcmd(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rowsecuritydefaultforcmd() (localctx IRowsecuritydefaultforcmdContext) { + localctx = NewRowsecuritydefaultforcmdContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 400, PostgreSQLParserRULE_rowsecuritydefaultforcmd) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4129) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4130) + p.Row_security_cmd() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRow_security_cmdContext is an interface to support dynamic dispatch. +type IRow_security_cmdContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALL() antlr.TerminalNode + SELECT() antlr.TerminalNode + INSERT() antlr.TerminalNode + UPDATE() antlr.TerminalNode + DELETE_P() antlr.TerminalNode + + // IsRow_security_cmdContext differentiates from other interfaces. + IsRow_security_cmdContext() +} + +type Row_security_cmdContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRow_security_cmdContext() *Row_security_cmdContext { + var p = new(Row_security_cmdContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_row_security_cmd + return p +} + +func InitEmptyRow_security_cmdContext(p *Row_security_cmdContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_row_security_cmd +} + +func (*Row_security_cmdContext) IsRow_security_cmdContext() {} + +func NewRow_security_cmdContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Row_security_cmdContext { + var p = new(Row_security_cmdContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_row_security_cmd + + return p +} + +func (s *Row_security_cmdContext) GetParser() antlr.Parser { return s.parser } + +func (s *Row_security_cmdContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Row_security_cmdContext) SELECT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSELECT, 0) +} + +func (s *Row_security_cmdContext) INSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSERT, 0) +} + +func (s *Row_security_cmdContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *Row_security_cmdContext) DELETE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELETE_P, 0) +} + +func (s *Row_security_cmdContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Row_security_cmdContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Row_security_cmdContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRow_security_cmd(s) + } +} + +func (s *Row_security_cmdContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRow_security_cmd(s) + } +} + +func (s *Row_security_cmdContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRow_security_cmd(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Row_security_cmd() (localctx IRow_security_cmdContext) { + localctx = NewRow_security_cmdContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 402, PostgreSQLParserRULE_row_security_cmd) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4132) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserALL || _la == PostgreSQLParserSELECT || _la == PostgreSQLParserDELETE_P || _la == PostgreSQLParserINSERT || _la == PostgreSQLParserUPDATE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateamstmtContext is an interface to support dynamic dispatch. +type ICreateamstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + ACCESS() antlr.TerminalNode + METHOD() antlr.TerminalNode + Name() INameContext + TYPE_P() antlr.TerminalNode + Am_type() IAm_typeContext + HANDLER() antlr.TerminalNode + Handler_name() IHandler_nameContext + + // IsCreateamstmtContext differentiates from other interfaces. + IsCreateamstmtContext() +} + +type CreateamstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateamstmtContext() *CreateamstmtContext { + var p = new(CreateamstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createamstmt + return p +} + +func InitEmptyCreateamstmtContext(p *CreateamstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createamstmt +} + +func (*CreateamstmtContext) IsCreateamstmtContext() {} + +func NewCreateamstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateamstmtContext { + var p = new(CreateamstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createamstmt + + return p +} + +func (s *CreateamstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateamstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateamstmtContext) ACCESS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACCESS, 0) +} + +func (s *CreateamstmtContext) METHOD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMETHOD, 0) +} + +func (s *CreateamstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateamstmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *CreateamstmtContext) Am_type() IAm_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAm_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAm_typeContext) +} + +func (s *CreateamstmtContext) HANDLER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHANDLER, 0) +} + +func (s *CreateamstmtContext) Handler_name() IHandler_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHandler_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHandler_nameContext) +} + +func (s *CreateamstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateamstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateamstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateamstmt(s) + } +} + +func (s *CreateamstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateamstmt(s) + } +} + +func (s *CreateamstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateamstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createamstmt() (localctx ICreateamstmtContext) { + localctx = NewCreateamstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 404, PostgreSQLParserRULE_createamstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4134) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4135) + p.Match(PostgreSQLParserACCESS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4136) + p.Match(PostgreSQLParserMETHOD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4137) + p.Name() + } + { + p.SetState(4138) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4139) + p.Am_type() + } + { + p.SetState(4140) + p.Match(PostgreSQLParserHANDLER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4141) + p.Handler_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAm_typeContext is an interface to support dynamic dispatch. +type IAm_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INDEX() antlr.TerminalNode + TABLE() antlr.TerminalNode + + // IsAm_typeContext differentiates from other interfaces. + IsAm_typeContext() +} + +type Am_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAm_typeContext() *Am_typeContext { + var p = new(Am_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_am_type + return p +} + +func InitEmptyAm_typeContext(p *Am_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_am_type +} + +func (*Am_typeContext) IsAm_typeContext() {} + +func NewAm_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Am_typeContext { + var p = new(Am_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_am_type + + return p +} + +func (s *Am_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Am_typeContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *Am_typeContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Am_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Am_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Am_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAm_type(s) + } +} + +func (s *Am_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAm_type(s) + } +} + +func (s *Am_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAm_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Am_type() (localctx IAm_typeContext) { + localctx = NewAm_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 406, PostgreSQLParserRULE_am_type) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4143) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTABLE || _la == PostgreSQLParserINDEX) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatetrigstmtContext is an interface to support dynamic dispatch. +type ICreatetrigstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + Name() INameContext + Triggeractiontime() ITriggeractiontimeContext + Triggerevents() ITriggereventsContext + ON() antlr.TerminalNode + Qualified_name() IQualified_nameContext + EXECUTE() antlr.TerminalNode + Function_or_procedure() IFunction_or_procedureContext + Func_name() IFunc_nameContext + OPEN_PAREN() antlr.TerminalNode + Triggerfuncargs() ITriggerfuncargsContext + CLOSE_PAREN() antlr.TerminalNode + Triggerreferencing() ITriggerreferencingContext + Triggerforspec() ITriggerforspecContext + Triggerwhen() ITriggerwhenContext + CONSTRAINT() antlr.TerminalNode + AFTER() antlr.TerminalNode + Constraintattributespec() IConstraintattributespecContext + FOR() antlr.TerminalNode + EACH() antlr.TerminalNode + ROW() antlr.TerminalNode + Optconstrfromtable() IOptconstrfromtableContext + + // IsCreatetrigstmtContext differentiates from other interfaces. + IsCreatetrigstmtContext() +} + +type CreatetrigstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatetrigstmtContext() *CreatetrigstmtContext { + var p = new(CreatetrigstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createtrigstmt + return p +} + +func InitEmptyCreatetrigstmtContext(p *CreatetrigstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createtrigstmt +} + +func (*CreatetrigstmtContext) IsCreatetrigstmtContext() {} + +func NewCreatetrigstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatetrigstmtContext { + var p = new(CreatetrigstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createtrigstmt + + return p +} + +func (s *CreatetrigstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatetrigstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatetrigstmtContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *CreatetrigstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreatetrigstmtContext) Triggeractiontime() ITriggeractiontimeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggeractiontimeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggeractiontimeContext) +} + +func (s *CreatetrigstmtContext) Triggerevents() ITriggereventsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggereventsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggereventsContext) +} + +func (s *CreatetrigstmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *CreatetrigstmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *CreatetrigstmtContext) EXECUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXECUTE, 0) +} + +func (s *CreatetrigstmtContext) Function_or_procedure() IFunction_or_procedureContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_or_procedureContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_or_procedureContext) +} + +func (s *CreatetrigstmtContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *CreatetrigstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CreatetrigstmtContext) Triggerfuncargs() ITriggerfuncargsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggerfuncargsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggerfuncargsContext) +} + +func (s *CreatetrigstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CreatetrigstmtContext) Triggerreferencing() ITriggerreferencingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggerreferencingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggerreferencingContext) +} + +func (s *CreatetrigstmtContext) Triggerforspec() ITriggerforspecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggerforspecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggerforspecContext) +} + +func (s *CreatetrigstmtContext) Triggerwhen() ITriggerwhenContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggerwhenContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggerwhenContext) +} + +func (s *CreatetrigstmtContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *CreatetrigstmtContext) AFTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAFTER, 0) +} + +func (s *CreatetrigstmtContext) Constraintattributespec() IConstraintattributespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraintattributespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraintattributespecContext) +} + +func (s *CreatetrigstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *CreatetrigstmtContext) EACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEACH, 0) +} + +func (s *CreatetrigstmtContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *CreatetrigstmtContext) Optconstrfromtable() IOptconstrfromtableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOptconstrfromtableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOptconstrfromtableContext) +} + +func (s *CreatetrigstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatetrigstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatetrigstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatetrigstmt(s) + } +} + +func (s *CreatetrigstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatetrigstmt(s) + } +} + +func (s *CreatetrigstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatetrigstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createtrigstmt() (localctx ICreatetrigstmtContext) { + localctx = NewCreatetrigstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 408, PostgreSQLParserRULE_createtrigstmt) + var _la int + + p.SetState(4193) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 314, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4145) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4146) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4147) + p.Name() + } + { + p.SetState(4148) + p.Triggeractiontime() + } + { + p.SetState(4149) + p.Triggerevents() + } + { + p.SetState(4150) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4151) + p.Qualified_name() + } + p.SetState(4153) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserREFERENCING { + { + p.SetState(4152) + p.Triggerreferencing() + } + + } + p.SetState(4156) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(4155) + p.Triggerforspec() + } + + } + p.SetState(4159) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHEN { + { + p.SetState(4158) + p.Triggerwhen() + } + + } + { + p.SetState(4161) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4162) + p.Function_or_procedure() + } + { + p.SetState(4163) + p.Func_name() + } + { + p.SetState(4164) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4165) + p.Triggerfuncargs() + } + { + p.SetState(4166) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4168) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4169) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4170) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4171) + p.Name() + } + { + p.SetState(4172) + p.Match(PostgreSQLParserAFTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4173) + p.Triggerevents() + } + { + p.SetState(4174) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4175) + p.Qualified_name() + } + p.SetState(4177) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM { + { + p.SetState(4176) + p.Optconstrfromtable() + } + + } + { + p.SetState(4179) + p.Constraintattributespec() + } + { + p.SetState(4180) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4181) + p.Match(PostgreSQLParserEACH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4182) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4184) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHEN { + { + p.SetState(4183) + p.Triggerwhen() + } + + } + { + p.SetState(4186) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4187) + p.Function_or_procedure() + } + { + p.SetState(4188) + p.Func_name() + } + { + p.SetState(4189) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4190) + p.Triggerfuncargs() + } + { + p.SetState(4191) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggeractiontimeContext is an interface to support dynamic dispatch. +type ITriggeractiontimeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BEFORE() antlr.TerminalNode + AFTER() antlr.TerminalNode + INSTEAD() antlr.TerminalNode + OF() antlr.TerminalNode + + // IsTriggeractiontimeContext differentiates from other interfaces. + IsTriggeractiontimeContext() +} + +type TriggeractiontimeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggeractiontimeContext() *TriggeractiontimeContext { + var p = new(TriggeractiontimeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggeractiontime + return p +} + +func InitEmptyTriggeractiontimeContext(p *TriggeractiontimeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggeractiontime +} + +func (*TriggeractiontimeContext) IsTriggeractiontimeContext() {} + +func NewTriggeractiontimeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggeractiontimeContext { + var p = new(TriggeractiontimeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggeractiontime + + return p +} + +func (s *TriggeractiontimeContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggeractiontimeContext) BEFORE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBEFORE, 0) +} + +func (s *TriggeractiontimeContext) AFTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAFTER, 0) +} + +func (s *TriggeractiontimeContext) INSTEAD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSTEAD, 0) +} + +func (s *TriggeractiontimeContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *TriggeractiontimeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggeractiontimeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggeractiontimeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggeractiontime(s) + } +} + +func (s *TriggeractiontimeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggeractiontime(s) + } +} + +func (s *TriggeractiontimeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggeractiontime(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggeractiontime() (localctx ITriggeractiontimeContext) { + localctx = NewTriggeractiontimeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 410, PostgreSQLParserRULE_triggeractiontime) + p.SetState(4199) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserBEFORE: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4195) + p.Match(PostgreSQLParserBEFORE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserAFTER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4196) + p.Match(PostgreSQLParserAFTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserINSTEAD: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4197) + p.Match(PostgreSQLParserINSTEAD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4198) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggereventsContext is an interface to support dynamic dispatch. +type ITriggereventsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTriggeroneevent() []ITriggeroneeventContext + Triggeroneevent(i int) ITriggeroneeventContext + AllOR() []antlr.TerminalNode + OR(i int) antlr.TerminalNode + + // IsTriggereventsContext differentiates from other interfaces. + IsTriggereventsContext() +} + +type TriggereventsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggereventsContext() *TriggereventsContext { + var p = new(TriggereventsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerevents + return p +} + +func InitEmptyTriggereventsContext(p *TriggereventsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerevents +} + +func (*TriggereventsContext) IsTriggereventsContext() {} + +func NewTriggereventsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggereventsContext { + var p = new(TriggereventsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggerevents + + return p +} + +func (s *TriggereventsContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggereventsContext) AllTriggeroneevent() []ITriggeroneeventContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITriggeroneeventContext); ok { + len++ + } + } + + tst := make([]ITriggeroneeventContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITriggeroneeventContext); ok { + tst[i] = t.(ITriggeroneeventContext) + i++ + } + } + + return tst +} + +func (s *TriggereventsContext) Triggeroneevent(i int) ITriggeroneeventContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggeroneeventContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITriggeroneeventContext) +} + +func (s *TriggereventsContext) AllOR() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserOR) +} + +func (s *TriggereventsContext) OR(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOR, i) +} + +func (s *TriggereventsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggereventsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggereventsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggerevents(s) + } +} + +func (s *TriggereventsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggerevents(s) + } +} + +func (s *TriggereventsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggerevents(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggerevents() (localctx ITriggereventsContext) { + localctx = NewTriggereventsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 412, PostgreSQLParserRULE_triggerevents) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4201) + p.Triggeroneevent() + } + p.SetState(4206) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserOR { + { + p.SetState(4202) + p.Match(PostgreSQLParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4203) + p.Triggeroneevent() + } + + p.SetState(4208) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggeroneeventContext is an interface to support dynamic dispatch. +type ITriggeroneeventContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INSERT() antlr.TerminalNode + DELETE_P() antlr.TerminalNode + UPDATE() antlr.TerminalNode + OF() antlr.TerminalNode + Columnlist() IColumnlistContext + TRUNCATE() antlr.TerminalNode + + // IsTriggeroneeventContext differentiates from other interfaces. + IsTriggeroneeventContext() +} + +type TriggeroneeventContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggeroneeventContext() *TriggeroneeventContext { + var p = new(TriggeroneeventContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggeroneevent + return p +} + +func InitEmptyTriggeroneeventContext(p *TriggeroneeventContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggeroneevent +} + +func (*TriggeroneeventContext) IsTriggeroneeventContext() {} + +func NewTriggeroneeventContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggeroneeventContext { + var p = new(TriggeroneeventContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggeroneevent + + return p +} + +func (s *TriggeroneeventContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggeroneeventContext) INSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSERT, 0) +} + +func (s *TriggeroneeventContext) DELETE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELETE_P, 0) +} + +func (s *TriggeroneeventContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *TriggeroneeventContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *TriggeroneeventContext) Columnlist() IColumnlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnlistContext) +} + +func (s *TriggeroneeventContext) TRUNCATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUNCATE, 0) +} + +func (s *TriggeroneeventContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggeroneeventContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggeroneeventContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggeroneevent(s) + } +} + +func (s *TriggeroneeventContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggeroneevent(s) + } +} + +func (s *TriggeroneeventContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggeroneevent(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggeroneevent() (localctx ITriggeroneeventContext) { + localctx = NewTriggeroneeventContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 414, PostgreSQLParserRULE_triggeroneevent) + p.SetState(4216) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 317, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4209) + p.Match(PostgreSQLParserINSERT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4210) + p.Match(PostgreSQLParserDELETE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4211) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4212) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4213) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4214) + p.Columnlist() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4215) + p.Match(PostgreSQLParserTRUNCATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggerreferencingContext is an interface to support dynamic dispatch. +type ITriggerreferencingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + REFERENCING() antlr.TerminalNode + Triggertransitions() ITriggertransitionsContext + + // IsTriggerreferencingContext differentiates from other interfaces. + IsTriggerreferencingContext() +} + +type TriggerreferencingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggerreferencingContext() *TriggerreferencingContext { + var p = new(TriggerreferencingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerreferencing + return p +} + +func InitEmptyTriggerreferencingContext(p *TriggerreferencingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerreferencing +} + +func (*TriggerreferencingContext) IsTriggerreferencingContext() {} + +func NewTriggerreferencingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggerreferencingContext { + var p = new(TriggerreferencingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggerreferencing + + return p +} + +func (s *TriggerreferencingContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggerreferencingContext) REFERENCING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFERENCING, 0) +} + +func (s *TriggerreferencingContext) Triggertransitions() ITriggertransitionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggertransitionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggertransitionsContext) +} + +func (s *TriggerreferencingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggerreferencingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggerreferencingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggerreferencing(s) + } +} + +func (s *TriggerreferencingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggerreferencing(s) + } +} + +func (s *TriggerreferencingContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggerreferencing(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggerreferencing() (localctx ITriggerreferencingContext) { + localctx = NewTriggerreferencingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 416, PostgreSQLParserRULE_triggerreferencing) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4218) + p.Match(PostgreSQLParserREFERENCING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4219) + p.Triggertransitions() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggertransitionsContext is an interface to support dynamic dispatch. +type ITriggertransitionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTriggertransition() []ITriggertransitionContext + Triggertransition(i int) ITriggertransitionContext + + // IsTriggertransitionsContext differentiates from other interfaces. + IsTriggertransitionsContext() +} + +type TriggertransitionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggertransitionsContext() *TriggertransitionsContext { + var p = new(TriggertransitionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggertransitions + return p +} + +func InitEmptyTriggertransitionsContext(p *TriggertransitionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggertransitions +} + +func (*TriggertransitionsContext) IsTriggertransitionsContext() {} + +func NewTriggertransitionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggertransitionsContext { + var p = new(TriggertransitionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggertransitions + + return p +} + +func (s *TriggertransitionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggertransitionsContext) AllTriggertransition() []ITriggertransitionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITriggertransitionContext); ok { + len++ + } + } + + tst := make([]ITriggertransitionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITriggertransitionContext); ok { + tst[i] = t.(ITriggertransitionContext) + i++ + } + } + + return tst +} + +func (s *TriggertransitionsContext) Triggertransition(i int) ITriggertransitionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggertransitionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITriggertransitionContext) +} + +func (s *TriggertransitionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggertransitionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggertransitionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggertransitions(s) + } +} + +func (s *TriggertransitionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggertransitions(s) + } +} + +func (s *TriggertransitionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggertransitions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggertransitions() (localctx ITriggertransitionsContext) { + localctx = NewTriggertransitionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 418, PostgreSQLParserRULE_triggertransitions) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(4222) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == PostgreSQLParserNEW || _la == PostgreSQLParserOLD { + { + p.SetState(4221) + p.Triggertransition() + } + + p.SetState(4224) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggertransitionContext is an interface to support dynamic dispatch. +type ITriggertransitionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Transitionoldornew() ITransitionoldornewContext + Transitionrowortable() ITransitionrowortableContext + Transitionrelname() ITransitionrelnameContext + Opt_as() IOpt_asContext + + // IsTriggertransitionContext differentiates from other interfaces. + IsTriggertransitionContext() +} + +type TriggertransitionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggertransitionContext() *TriggertransitionContext { + var p = new(TriggertransitionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggertransition + return p +} + +func InitEmptyTriggertransitionContext(p *TriggertransitionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggertransition +} + +func (*TriggertransitionContext) IsTriggertransitionContext() {} + +func NewTriggertransitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggertransitionContext { + var p = new(TriggertransitionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggertransition + + return p +} + +func (s *TriggertransitionContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggertransitionContext) Transitionoldornew() ITransitionoldornewContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransitionoldornewContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransitionoldornewContext) +} + +func (s *TriggertransitionContext) Transitionrowortable() ITransitionrowortableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransitionrowortableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransitionrowortableContext) +} + +func (s *TriggertransitionContext) Transitionrelname() ITransitionrelnameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransitionrelnameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransitionrelnameContext) +} + +func (s *TriggertransitionContext) Opt_as() IOpt_asContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_asContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_asContext) +} + +func (s *TriggertransitionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggertransitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggertransitionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggertransition(s) + } +} + +func (s *TriggertransitionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggertransition(s) + } +} + +func (s *TriggertransitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggertransition(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggertransition() (localctx ITriggertransitionContext) { + localctx = NewTriggertransitionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 420, PostgreSQLParserRULE_triggertransition) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4226) + p.Transitionoldornew() + } + { + p.SetState(4227) + p.Transitionrowortable() + } + p.SetState(4229) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(4228) + p.Opt_as() + } + + } + { + p.SetState(4231) + p.Transitionrelname() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransitionoldornewContext is an interface to support dynamic dispatch. +type ITransitionoldornewContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NEW() antlr.TerminalNode + OLD() antlr.TerminalNode + + // IsTransitionoldornewContext differentiates from other interfaces. + IsTransitionoldornewContext() +} + +type TransitionoldornewContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransitionoldornewContext() *TransitionoldornewContext { + var p = new(TransitionoldornewContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transitionoldornew + return p +} + +func InitEmptyTransitionoldornewContext(p *TransitionoldornewContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transitionoldornew +} + +func (*TransitionoldornewContext) IsTransitionoldornewContext() {} + +func NewTransitionoldornewContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TransitionoldornewContext { + var p = new(TransitionoldornewContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transitionoldornew + + return p +} + +func (s *TransitionoldornewContext) GetParser() antlr.Parser { return s.parser } + +func (s *TransitionoldornewContext) NEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNEW, 0) +} + +func (s *TransitionoldornewContext) OLD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOLD, 0) +} + +func (s *TransitionoldornewContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TransitionoldornewContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TransitionoldornewContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransitionoldornew(s) + } +} + +func (s *TransitionoldornewContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransitionoldornew(s) + } +} + +func (s *TransitionoldornewContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransitionoldornew(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transitionoldornew() (localctx ITransitionoldornewContext) { + localctx = NewTransitionoldornewContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 422, PostgreSQLParserRULE_transitionoldornew) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4233) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserNEW || _la == PostgreSQLParserOLD) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransitionrowortableContext is an interface to support dynamic dispatch. +type ITransitionrowortableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TABLE() antlr.TerminalNode + ROW() antlr.TerminalNode + + // IsTransitionrowortableContext differentiates from other interfaces. + IsTransitionrowortableContext() +} + +type TransitionrowortableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransitionrowortableContext() *TransitionrowortableContext { + var p = new(TransitionrowortableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transitionrowortable + return p +} + +func InitEmptyTransitionrowortableContext(p *TransitionrowortableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transitionrowortable +} + +func (*TransitionrowortableContext) IsTransitionrowortableContext() {} + +func NewTransitionrowortableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TransitionrowortableContext { + var p = new(TransitionrowortableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transitionrowortable + + return p +} + +func (s *TransitionrowortableContext) GetParser() antlr.Parser { return s.parser } + +func (s *TransitionrowortableContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *TransitionrowortableContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *TransitionrowortableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TransitionrowortableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TransitionrowortableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransitionrowortable(s) + } +} + +func (s *TransitionrowortableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransitionrowortable(s) + } +} + +func (s *TransitionrowortableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransitionrowortable(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transitionrowortable() (localctx ITransitionrowortableContext) { + localctx = NewTransitionrowortableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 424, PostgreSQLParserRULE_transitionrowortable) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4235) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTABLE || _la == PostgreSQLParserROW) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransitionrelnameContext is an interface to support dynamic dispatch. +type ITransitionrelnameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + + // IsTransitionrelnameContext differentiates from other interfaces. + IsTransitionrelnameContext() +} + +type TransitionrelnameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransitionrelnameContext() *TransitionrelnameContext { + var p = new(TransitionrelnameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transitionrelname + return p +} + +func InitEmptyTransitionrelnameContext(p *TransitionrelnameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transitionrelname +} + +func (*TransitionrelnameContext) IsTransitionrelnameContext() {} + +func NewTransitionrelnameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TransitionrelnameContext { + var p = new(TransitionrelnameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transitionrelname + + return p +} + +func (s *TransitionrelnameContext) GetParser() antlr.Parser { return s.parser } + +func (s *TransitionrelnameContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *TransitionrelnameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TransitionrelnameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TransitionrelnameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransitionrelname(s) + } +} + +func (s *TransitionrelnameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransitionrelname(s) + } +} + +func (s *TransitionrelnameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransitionrelname(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transitionrelname() (localctx ITransitionrelnameContext) { + localctx = NewTransitionrelnameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 426, PostgreSQLParserRULE_transitionrelname) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4237) + p.Colid() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggerforspecContext is an interface to support dynamic dispatch. +type ITriggerforspecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FOR() antlr.TerminalNode + Triggerfortype() ITriggerfortypeContext + Triggerforopteach() ITriggerforopteachContext + + // IsTriggerforspecContext differentiates from other interfaces. + IsTriggerforspecContext() +} + +type TriggerforspecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggerforspecContext() *TriggerforspecContext { + var p = new(TriggerforspecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerforspec + return p +} + +func InitEmptyTriggerforspecContext(p *TriggerforspecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerforspec +} + +func (*TriggerforspecContext) IsTriggerforspecContext() {} + +func NewTriggerforspecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggerforspecContext { + var p = new(TriggerforspecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggerforspec + + return p +} + +func (s *TriggerforspecContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggerforspecContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *TriggerforspecContext) Triggerfortype() ITriggerfortypeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggerfortypeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggerfortypeContext) +} + +func (s *TriggerforspecContext) Triggerforopteach() ITriggerforopteachContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggerforopteachContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITriggerforopteachContext) +} + +func (s *TriggerforspecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggerforspecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggerforspecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggerforspec(s) + } +} + +func (s *TriggerforspecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggerforspec(s) + } +} + +func (s *TriggerforspecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggerforspec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggerforspec() (localctx ITriggerforspecContext) { + localctx = NewTriggerforspecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 428, PostgreSQLParserRULE_triggerforspec) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4239) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4241) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEACH { + { + p.SetState(4240) + p.Triggerforopteach() + } + + } + { + p.SetState(4243) + p.Triggerfortype() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggerforopteachContext is an interface to support dynamic dispatch. +type ITriggerforopteachContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EACH() antlr.TerminalNode + + // IsTriggerforopteachContext differentiates from other interfaces. + IsTriggerforopteachContext() +} + +type TriggerforopteachContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggerforopteachContext() *TriggerforopteachContext { + var p = new(TriggerforopteachContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerforopteach + return p +} + +func InitEmptyTriggerforopteachContext(p *TriggerforopteachContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerforopteach +} + +func (*TriggerforopteachContext) IsTriggerforopteachContext() {} + +func NewTriggerforopteachContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggerforopteachContext { + var p = new(TriggerforopteachContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggerforopteach + + return p +} + +func (s *TriggerforopteachContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggerforopteachContext) EACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEACH, 0) +} + +func (s *TriggerforopteachContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggerforopteachContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggerforopteachContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggerforopteach(s) + } +} + +func (s *TriggerforopteachContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggerforopteach(s) + } +} + +func (s *TriggerforopteachContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggerforopteach(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggerforopteach() (localctx ITriggerforopteachContext) { + localctx = NewTriggerforopteachContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 430, PostgreSQLParserRULE_triggerforopteach) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4245) + p.Match(PostgreSQLParserEACH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggerfortypeContext is an interface to support dynamic dispatch. +type ITriggerfortypeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ROW() antlr.TerminalNode + STATEMENT() antlr.TerminalNode + + // IsTriggerfortypeContext differentiates from other interfaces. + IsTriggerfortypeContext() +} + +type TriggerfortypeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggerfortypeContext() *TriggerfortypeContext { + var p = new(TriggerfortypeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerfortype + return p +} + +func InitEmptyTriggerfortypeContext(p *TriggerfortypeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerfortype +} + +func (*TriggerfortypeContext) IsTriggerfortypeContext() {} + +func NewTriggerfortypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggerfortypeContext { + var p = new(TriggerfortypeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggerfortype + + return p +} + +func (s *TriggerfortypeContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggerfortypeContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *TriggerfortypeContext) STATEMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATEMENT, 0) +} + +func (s *TriggerfortypeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggerfortypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggerfortypeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggerfortype(s) + } +} + +func (s *TriggerfortypeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggerfortype(s) + } +} + +func (s *TriggerfortypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggerfortype(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggerfortype() (localctx ITriggerfortypeContext) { + localctx = NewTriggerfortypeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 432, PostgreSQLParserRULE_triggerfortype) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4247) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserSTATEMENT || _la == PostgreSQLParserROW) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggerwhenContext is an interface to support dynamic dispatch. +type ITriggerwhenContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHEN() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsTriggerwhenContext differentiates from other interfaces. + IsTriggerwhenContext() +} + +type TriggerwhenContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggerwhenContext() *TriggerwhenContext { + var p = new(TriggerwhenContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerwhen + return p +} + +func InitEmptyTriggerwhenContext(p *TriggerwhenContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerwhen +} + +func (*TriggerwhenContext) IsTriggerwhenContext() {} + +func NewTriggerwhenContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggerwhenContext { + var p = new(TriggerwhenContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggerwhen + + return p +} + +func (s *TriggerwhenContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggerwhenContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *TriggerwhenContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *TriggerwhenContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *TriggerwhenContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *TriggerwhenContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggerwhenContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggerwhenContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggerwhen(s) + } +} + +func (s *TriggerwhenContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggerwhen(s) + } +} + +func (s *TriggerwhenContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggerwhen(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggerwhen() (localctx ITriggerwhenContext) { + localctx = NewTriggerwhenContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 434, PostgreSQLParserRULE_triggerwhen) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4249) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4250) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4251) + p.A_expr() + } + { + p.SetState(4252) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunction_or_procedureContext is an interface to support dynamic dispatch. +type IFunction_or_procedureContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FUNCTION() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + + // IsFunction_or_procedureContext differentiates from other interfaces. + IsFunction_or_procedureContext() +} + +type Function_or_procedureContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunction_or_procedureContext() *Function_or_procedureContext { + var p = new(Function_or_procedureContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_function_or_procedure + return p +} + +func InitEmptyFunction_or_procedureContext(p *Function_or_procedureContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_function_or_procedure +} + +func (*Function_or_procedureContext) IsFunction_or_procedureContext() {} + +func NewFunction_or_procedureContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Function_or_procedureContext { + var p = new(Function_or_procedureContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_function_or_procedure + + return p +} + +func (s *Function_or_procedureContext) GetParser() antlr.Parser { return s.parser } + +func (s *Function_or_procedureContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *Function_or_procedureContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *Function_or_procedureContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Function_or_procedureContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Function_or_procedureContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunction_or_procedure(s) + } +} + +func (s *Function_or_procedureContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunction_or_procedure(s) + } +} + +func (s *Function_or_procedureContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunction_or_procedure(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Function_or_procedure() (localctx IFunction_or_procedureContext) { + localctx = NewFunction_or_procedureContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 436, PostgreSQLParserRULE_function_or_procedure) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4254) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFUNCTION || _la == PostgreSQLParserPROCEDURE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggerfuncargsContext is an interface to support dynamic dispatch. +type ITriggerfuncargsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTriggerfuncarg() []ITriggerfuncargContext + Triggerfuncarg(i int) ITriggerfuncargContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsTriggerfuncargsContext differentiates from other interfaces. + IsTriggerfuncargsContext() +} + +type TriggerfuncargsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggerfuncargsContext() *TriggerfuncargsContext { + var p = new(TriggerfuncargsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerfuncargs + return p +} + +func InitEmptyTriggerfuncargsContext(p *TriggerfuncargsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerfuncargs +} + +func (*TriggerfuncargsContext) IsTriggerfuncargsContext() {} + +func NewTriggerfuncargsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggerfuncargsContext { + var p = new(TriggerfuncargsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggerfuncargs + + return p +} + +func (s *TriggerfuncargsContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggerfuncargsContext) AllTriggerfuncarg() []ITriggerfuncargContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITriggerfuncargContext); ok { + len++ + } + } + + tst := make([]ITriggerfuncargContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITriggerfuncargContext); ok { + tst[i] = t.(ITriggerfuncargContext) + i++ + } + } + + return tst +} + +func (s *TriggerfuncargsContext) Triggerfuncarg(i int) ITriggerfuncargContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITriggerfuncargContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITriggerfuncargContext) +} + +func (s *TriggerfuncargsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *TriggerfuncargsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *TriggerfuncargsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggerfuncargsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggerfuncargsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggerfuncargs(s) + } +} + +func (s *TriggerfuncargsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggerfuncargs(s) + } +} + +func (s *TriggerfuncargsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggerfuncargs(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggerfuncargs() (localctx ITriggerfuncargsContext) { + localctx = NewTriggerfuncargsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 438, PostgreSQLParserRULE_triggerfuncargs) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(4258) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserALL, PostgreSQLParserANALYSE, PostgreSQLParserANALYZE, PostgreSQLParserAND, PostgreSQLParserANY, PostgreSQLParserARRAY, PostgreSQLParserAS, PostgreSQLParserASC, PostgreSQLParserASYMMETRIC, PostgreSQLParserBOTH, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCHECK, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCREATE, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDEFERRABLE, PostgreSQLParserDESC, PostgreSQLParserDISTINCT, PostgreSQLParserDO, PostgreSQLParserELSE, PostgreSQLParserEXCEPT, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserFOR, PostgreSQLParserFOREIGN, PostgreSQLParserFROM, PostgreSQLParserGRANT, PostgreSQLParserGROUP_P, PostgreSQLParserHAVING, PostgreSQLParserIN_P, PostgreSQLParserINITIALLY, PostgreSQLParserINTERSECT, PostgreSQLParserLATERAL_P, PostgreSQLParserLEADING, PostgreSQLParserLIMIT, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNOT, PostgreSQLParserNULL_P, PostgreSQLParserOFFSET, PostgreSQLParserON, PostgreSQLParserONLY, PostgreSQLParserOR, PostgreSQLParserORDER, PostgreSQLParserPLACING, PostgreSQLParserPRIMARY, PostgreSQLParserREFERENCES, PostgreSQLParserRETURNING, PostgreSQLParserSELECT, PostgreSQLParserSESSION_USER, PostgreSQLParserSOME, PostgreSQLParserSYMMETRIC, PostgreSQLParserTABLE, PostgreSQLParserTHEN, PostgreSQLParserTO, PostgreSQLParserTRAILING, PostgreSQLParserTRUE_P, PostgreSQLParserUNION, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserUSING, PostgreSQLParserVARIADIC, PostgreSQLParserWHEN, PostgreSQLParserWHERE, PostgreSQLParserWINDOW, PostgreSQLParserWITH, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserEND_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserIntegral, PostgreSQLParserNumeric, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + { + p.SetState(4256) + p.Triggerfuncarg() + } + + case PostgreSQLParserCLOSE_PAREN, PostgreSQLParserCOMMA: + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.SetState(4264) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4260) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4261) + p.Triggerfuncarg() + } + + p.SetState(4266) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITriggerfuncargContext is an interface to support dynamic dispatch. +type ITriggerfuncargContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Iconst() IIconstContext + Fconst() IFconstContext + Sconst() ISconstContext + Collabel() ICollabelContext + + // IsTriggerfuncargContext differentiates from other interfaces. + IsTriggerfuncargContext() +} + +type TriggerfuncargContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTriggerfuncargContext() *TriggerfuncargContext { + var p = new(TriggerfuncargContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerfuncarg + return p +} + +func InitEmptyTriggerfuncargContext(p *TriggerfuncargContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_triggerfuncarg +} + +func (*TriggerfuncargContext) IsTriggerfuncargContext() {} + +func NewTriggerfuncargContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TriggerfuncargContext { + var p = new(TriggerfuncargContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_triggerfuncarg + + return p +} + +func (s *TriggerfuncargContext) GetParser() antlr.Parser { return s.parser } + +func (s *TriggerfuncargContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *TriggerfuncargContext) Fconst() IFconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFconstContext) +} + +func (s *TriggerfuncargContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *TriggerfuncargContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *TriggerfuncargContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TriggerfuncargContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TriggerfuncargContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTriggerfuncarg(s) + } +} + +func (s *TriggerfuncargContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTriggerfuncarg(s) + } +} + +func (s *TriggerfuncargContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTriggerfuncarg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Triggerfuncarg() (localctx ITriggerfuncargContext) { + localctx = NewTriggerfuncargContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 440, PostgreSQLParserRULE_triggerfuncarg) + p.SetState(4271) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserIntegral: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4267) + p.Iconst() + } + + case PostgreSQLParserNumeric: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4268) + p.Fconst() + } + + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4269) + p.Sconst() + } + + case PostgreSQLParserALL, PostgreSQLParserANALYSE, PostgreSQLParserANALYZE, PostgreSQLParserAND, PostgreSQLParserANY, PostgreSQLParserARRAY, PostgreSQLParserAS, PostgreSQLParserASC, PostgreSQLParserASYMMETRIC, PostgreSQLParserBOTH, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCHECK, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCREATE, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDEFERRABLE, PostgreSQLParserDESC, PostgreSQLParserDISTINCT, PostgreSQLParserDO, PostgreSQLParserELSE, PostgreSQLParserEXCEPT, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserFOR, PostgreSQLParserFOREIGN, PostgreSQLParserFROM, PostgreSQLParserGRANT, PostgreSQLParserGROUP_P, PostgreSQLParserHAVING, PostgreSQLParserIN_P, PostgreSQLParserINITIALLY, PostgreSQLParserINTERSECT, PostgreSQLParserLATERAL_P, PostgreSQLParserLEADING, PostgreSQLParserLIMIT, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNOT, PostgreSQLParserNULL_P, PostgreSQLParserOFFSET, PostgreSQLParserON, PostgreSQLParserONLY, PostgreSQLParserOR, PostgreSQLParserORDER, PostgreSQLParserPLACING, PostgreSQLParserPRIMARY, PostgreSQLParserREFERENCES, PostgreSQLParserRETURNING, PostgreSQLParserSELECT, PostgreSQLParserSESSION_USER, PostgreSQLParserSOME, PostgreSQLParserSYMMETRIC, PostgreSQLParserTABLE, PostgreSQLParserTHEN, PostgreSQLParserTO, PostgreSQLParserTRAILING, PostgreSQLParserTRUE_P, PostgreSQLParserUNION, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserUSING, PostgreSQLParserVARIADIC, PostgreSQLParserWHEN, PostgreSQLParserWHERE, PostgreSQLParserWINDOW, PostgreSQLParserWITH, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserEND_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4270) + p.Collabel() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOptconstrfromtableContext is an interface to support dynamic dispatch. +type IOptconstrfromtableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FROM() antlr.TerminalNode + Qualified_name() IQualified_nameContext + + // IsOptconstrfromtableContext differentiates from other interfaces. + IsOptconstrfromtableContext() +} + +type OptconstrfromtableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOptconstrfromtableContext() *OptconstrfromtableContext { + var p = new(OptconstrfromtableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optconstrfromtable + return p +} + +func InitEmptyOptconstrfromtableContext(p *OptconstrfromtableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_optconstrfromtable +} + +func (*OptconstrfromtableContext) IsOptconstrfromtableContext() {} + +func NewOptconstrfromtableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OptconstrfromtableContext { + var p = new(OptconstrfromtableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_optconstrfromtable + + return p +} + +func (s *OptconstrfromtableContext) GetParser() antlr.Parser { return s.parser } + +func (s *OptconstrfromtableContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *OptconstrfromtableContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *OptconstrfromtableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OptconstrfromtableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OptconstrfromtableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOptconstrfromtable(s) + } +} + +func (s *OptconstrfromtableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOptconstrfromtable(s) + } +} + +func (s *OptconstrfromtableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOptconstrfromtable(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Optconstrfromtable() (localctx IOptconstrfromtableContext) { + localctx = NewOptconstrfromtableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 442, PostgreSQLParserRULE_optconstrfromtable) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4273) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4274) + p.Qualified_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstraintattributespecContext is an interface to support dynamic dispatch. +type IConstraintattributespecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllConstraintattributeElem() []IConstraintattributeElemContext + ConstraintattributeElem(i int) IConstraintattributeElemContext + + // IsConstraintattributespecContext differentiates from other interfaces. + IsConstraintattributespecContext() +} + +type ConstraintattributespecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstraintattributespecContext() *ConstraintattributespecContext { + var p = new(ConstraintattributespecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintattributespec + return p +} + +func InitEmptyConstraintattributespecContext(p *ConstraintattributespecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintattributespec +} + +func (*ConstraintattributespecContext) IsConstraintattributespecContext() {} + +func NewConstraintattributespecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstraintattributespecContext { + var p = new(ConstraintattributespecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constraintattributespec + + return p +} + +func (s *ConstraintattributespecContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstraintattributespecContext) AllConstraintattributeElem() []IConstraintattributeElemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IConstraintattributeElemContext); ok { + len++ + } + } + + tst := make([]IConstraintattributeElemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IConstraintattributeElemContext); ok { + tst[i] = t.(IConstraintattributeElemContext) + i++ + } + } + + return tst +} + +func (s *ConstraintattributespecContext) ConstraintattributeElem(i int) IConstraintattributeElemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraintattributeElemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IConstraintattributeElemContext) +} + +func (s *ConstraintattributespecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstraintattributespecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstraintattributespecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstraintattributespec(s) + } +} + +func (s *ConstraintattributespecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstraintattributespec(s) + } +} + +func (s *ConstraintattributespecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstraintattributespec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constraintattributespec() (localctx IConstraintattributespecContext) { + localctx = NewConstraintattributespecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 444, PostgreSQLParserRULE_constraintattributespec) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(4279) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ((int64((_la-54)) & ^0x3f) == 0 && ((int64(1)<<(_la-54))&8421377) != 0) || _la == PostgreSQLParserNO { + { + p.SetState(4276) + p.ConstraintattributeElem() + } + + p.SetState(4281) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstraintattributeElemContext is an interface to support dynamic dispatch. +type IConstraintattributeElemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOT() antlr.TerminalNode + DEFERRABLE() antlr.TerminalNode + INITIALLY() antlr.TerminalNode + IMMEDIATE() antlr.TerminalNode + DEFERRED() antlr.TerminalNode + VALID() antlr.TerminalNode + NO() antlr.TerminalNode + INHERIT() antlr.TerminalNode + + // IsConstraintattributeElemContext differentiates from other interfaces. + IsConstraintattributeElemContext() +} + +type ConstraintattributeElemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstraintattributeElemContext() *ConstraintattributeElemContext { + var p = new(ConstraintattributeElemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintattributeElem + return p +} + +func InitEmptyConstraintattributeElemContext(p *ConstraintattributeElemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constraintattributeElem +} + +func (*ConstraintattributeElemContext) IsConstraintattributeElemContext() {} + +func NewConstraintattributeElemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstraintattributeElemContext { + var p = new(ConstraintattributeElemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constraintattributeElem + + return p +} + +func (s *ConstraintattributeElemContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstraintattributeElemContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *ConstraintattributeElemContext) DEFERRABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFERRABLE, 0) +} + +func (s *ConstraintattributeElemContext) INITIALLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINITIALLY, 0) +} + +func (s *ConstraintattributeElemContext) IMMEDIATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMMEDIATE, 0) +} + +func (s *ConstraintattributeElemContext) DEFERRED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFERRED, 0) +} + +func (s *ConstraintattributeElemContext) VALID() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALID, 0) +} + +func (s *ConstraintattributeElemContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *ConstraintattributeElemContext) INHERIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINHERIT, 0) +} + +func (s *ConstraintattributeElemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstraintattributeElemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstraintattributeElemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstraintattributeElem(s) + } +} + +func (s *ConstraintattributeElemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstraintattributeElem(s) + } +} + +func (s *ConstraintattributeElemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstraintattributeElem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) ConstraintattributeElem() (localctx IConstraintattributeElemContext) { + localctx = NewConstraintattributeElemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 446, PostgreSQLParserRULE_constraintattributeElem) + p.SetState(4293) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 325, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4282) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4283) + p.Match(PostgreSQLParserDEFERRABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4284) + p.Match(PostgreSQLParserDEFERRABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4285) + p.Match(PostgreSQLParserINITIALLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4286) + p.Match(PostgreSQLParserIMMEDIATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4287) + p.Match(PostgreSQLParserINITIALLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4288) + p.Match(PostgreSQLParserDEFERRED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4289) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4290) + p.Match(PostgreSQLParserVALID) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(4291) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4292) + p.Match(PostgreSQLParserINHERIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateeventtrigstmtContext is an interface to support dynamic dispatch. +type ICreateeventtrigstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + EVENT() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + Name() INameContext + ON() antlr.TerminalNode + Collabel() ICollabelContext + EXECUTE() antlr.TerminalNode + Function_or_procedure() IFunction_or_procedureContext + Func_name() IFunc_nameContext + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + WHEN() antlr.TerminalNode + Event_trigger_when_list() IEvent_trigger_when_listContext + + // IsCreateeventtrigstmtContext differentiates from other interfaces. + IsCreateeventtrigstmtContext() +} + +type CreateeventtrigstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateeventtrigstmtContext() *CreateeventtrigstmtContext { + var p = new(CreateeventtrigstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createeventtrigstmt + return p +} + +func InitEmptyCreateeventtrigstmtContext(p *CreateeventtrigstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createeventtrigstmt +} + +func (*CreateeventtrigstmtContext) IsCreateeventtrigstmtContext() {} + +func NewCreateeventtrigstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateeventtrigstmtContext { + var p = new(CreateeventtrigstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createeventtrigstmt + + return p +} + +func (s *CreateeventtrigstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateeventtrigstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateeventtrigstmtContext) EVENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEVENT, 0) +} + +func (s *CreateeventtrigstmtContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *CreateeventtrigstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateeventtrigstmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *CreateeventtrigstmtContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *CreateeventtrigstmtContext) EXECUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXECUTE, 0) +} + +func (s *CreateeventtrigstmtContext) Function_or_procedure() IFunction_or_procedureContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_or_procedureContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_or_procedureContext) +} + +func (s *CreateeventtrigstmtContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *CreateeventtrigstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CreateeventtrigstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CreateeventtrigstmtContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *CreateeventtrigstmtContext) Event_trigger_when_list() IEvent_trigger_when_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEvent_trigger_when_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEvent_trigger_when_listContext) +} + +func (s *CreateeventtrigstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateeventtrigstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateeventtrigstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateeventtrigstmt(s) + } +} + +func (s *CreateeventtrigstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateeventtrigstmt(s) + } +} + +func (s *CreateeventtrigstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateeventtrigstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createeventtrigstmt() (localctx ICreateeventtrigstmtContext) { + localctx = NewCreateeventtrigstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 448, PostgreSQLParserRULE_createeventtrigstmt) + p.SetState(4321) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 326, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4295) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4296) + p.Match(PostgreSQLParserEVENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4297) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4298) + p.Name() + } + { + p.SetState(4299) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4300) + p.Collabel() + } + { + p.SetState(4301) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4302) + p.Function_or_procedure() + } + { + p.SetState(4303) + p.Func_name() + } + { + p.SetState(4304) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4305) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4307) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4308) + p.Match(PostgreSQLParserEVENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4309) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4310) + p.Name() + } + { + p.SetState(4311) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4312) + p.Collabel() + } + { + p.SetState(4313) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4314) + p.Event_trigger_when_list() + } + { + p.SetState(4315) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4316) + p.Function_or_procedure() + } + { + p.SetState(4317) + p.Func_name() + } + { + p.SetState(4318) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4319) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEvent_trigger_when_listContext is an interface to support dynamic dispatch. +type IEvent_trigger_when_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllEvent_trigger_when_item() []IEvent_trigger_when_itemContext + Event_trigger_when_item(i int) IEvent_trigger_when_itemContext + AllAND() []antlr.TerminalNode + AND(i int) antlr.TerminalNode + + // IsEvent_trigger_when_listContext differentiates from other interfaces. + IsEvent_trigger_when_listContext() +} + +type Event_trigger_when_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEvent_trigger_when_listContext() *Event_trigger_when_listContext { + var p = new(Event_trigger_when_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_event_trigger_when_list + return p +} + +func InitEmptyEvent_trigger_when_listContext(p *Event_trigger_when_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_event_trigger_when_list +} + +func (*Event_trigger_when_listContext) IsEvent_trigger_when_listContext() {} + +func NewEvent_trigger_when_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Event_trigger_when_listContext { + var p = new(Event_trigger_when_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_event_trigger_when_list + + return p +} + +func (s *Event_trigger_when_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Event_trigger_when_listContext) AllEvent_trigger_when_item() []IEvent_trigger_when_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IEvent_trigger_when_itemContext); ok { + len++ + } + } + + tst := make([]IEvent_trigger_when_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IEvent_trigger_when_itemContext); ok { + tst[i] = t.(IEvent_trigger_when_itemContext) + i++ + } + } + + return tst +} + +func (s *Event_trigger_when_listContext) Event_trigger_when_item(i int) IEvent_trigger_when_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEvent_trigger_when_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IEvent_trigger_when_itemContext) +} + +func (s *Event_trigger_when_listContext) AllAND() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserAND) +} + +func (s *Event_trigger_when_listContext) AND(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, i) +} + +func (s *Event_trigger_when_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Event_trigger_when_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Event_trigger_when_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterEvent_trigger_when_list(s) + } +} + +func (s *Event_trigger_when_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitEvent_trigger_when_list(s) + } +} + +func (s *Event_trigger_when_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitEvent_trigger_when_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Event_trigger_when_list() (localctx IEvent_trigger_when_listContext) { + localctx = NewEvent_trigger_when_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 450, PostgreSQLParserRULE_event_trigger_when_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4323) + p.Event_trigger_when_item() + } + p.SetState(4328) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserAND { + { + p.SetState(4324) + p.Match(PostgreSQLParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4325) + p.Event_trigger_when_item() + } + + p.SetState(4330) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEvent_trigger_when_itemContext is an interface to support dynamic dispatch. +type IEvent_trigger_when_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + IN_P() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Event_trigger_value_list() IEvent_trigger_value_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsEvent_trigger_when_itemContext differentiates from other interfaces. + IsEvent_trigger_when_itemContext() +} + +type Event_trigger_when_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEvent_trigger_when_itemContext() *Event_trigger_when_itemContext { + var p = new(Event_trigger_when_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_event_trigger_when_item + return p +} + +func InitEmptyEvent_trigger_when_itemContext(p *Event_trigger_when_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_event_trigger_when_item +} + +func (*Event_trigger_when_itemContext) IsEvent_trigger_when_itemContext() {} + +func NewEvent_trigger_when_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Event_trigger_when_itemContext { + var p = new(Event_trigger_when_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_event_trigger_when_item + + return p +} + +func (s *Event_trigger_when_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Event_trigger_when_itemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Event_trigger_when_itemContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Event_trigger_when_itemContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Event_trigger_when_itemContext) Event_trigger_value_list() IEvent_trigger_value_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEvent_trigger_value_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEvent_trigger_value_listContext) +} + +func (s *Event_trigger_when_itemContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Event_trigger_when_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Event_trigger_when_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Event_trigger_when_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterEvent_trigger_when_item(s) + } +} + +func (s *Event_trigger_when_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitEvent_trigger_when_item(s) + } +} + +func (s *Event_trigger_when_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitEvent_trigger_when_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Event_trigger_when_item() (localctx IEvent_trigger_when_itemContext) { + localctx = NewEvent_trigger_when_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 452, PostgreSQLParserRULE_event_trigger_when_item) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4331) + p.Colid() + } + { + p.SetState(4332) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4333) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4334) + p.Event_trigger_value_list() + } + { + p.SetState(4335) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEvent_trigger_value_listContext is an interface to support dynamic dispatch. +type IEvent_trigger_value_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSconst() []ISconstContext + Sconst(i int) ISconstContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsEvent_trigger_value_listContext differentiates from other interfaces. + IsEvent_trigger_value_listContext() +} + +type Event_trigger_value_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEvent_trigger_value_listContext() *Event_trigger_value_listContext { + var p = new(Event_trigger_value_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_event_trigger_value_list + return p +} + +func InitEmptyEvent_trigger_value_listContext(p *Event_trigger_value_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_event_trigger_value_list +} + +func (*Event_trigger_value_listContext) IsEvent_trigger_value_listContext() {} + +func NewEvent_trigger_value_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Event_trigger_value_listContext { + var p = new(Event_trigger_value_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_event_trigger_value_list + + return p +} + +func (s *Event_trigger_value_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Event_trigger_value_listContext) AllSconst() []ISconstContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISconstContext); ok { + len++ + } + } + + tst := make([]ISconstContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISconstContext); ok { + tst[i] = t.(ISconstContext) + i++ + } + } + + return tst +} + +func (s *Event_trigger_value_listContext) Sconst(i int) ISconstContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Event_trigger_value_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Event_trigger_value_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Event_trigger_value_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Event_trigger_value_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Event_trigger_value_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterEvent_trigger_value_list(s) + } +} + +func (s *Event_trigger_value_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitEvent_trigger_value_list(s) + } +} + +func (s *Event_trigger_value_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitEvent_trigger_value_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Event_trigger_value_list() (localctx IEvent_trigger_value_listContext) { + localctx = NewEvent_trigger_value_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 454, PostgreSQLParserRULE_event_trigger_value_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4337) + p.Sconst() + } + p.SetState(4342) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4338) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4339) + p.Sconst() + } + + p.SetState(4344) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltereventtrigstmtContext is an interface to support dynamic dispatch. +type IAltereventtrigstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + EVENT() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + Name() INameContext + Enable_trigger() IEnable_triggerContext + + // IsAltereventtrigstmtContext differentiates from other interfaces. + IsAltereventtrigstmtContext() +} + +type AltereventtrigstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltereventtrigstmtContext() *AltereventtrigstmtContext { + var p = new(AltereventtrigstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altereventtrigstmt + return p +} + +func InitEmptyAltereventtrigstmtContext(p *AltereventtrigstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altereventtrigstmt +} + +func (*AltereventtrigstmtContext) IsAltereventtrigstmtContext() {} + +func NewAltereventtrigstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltereventtrigstmtContext { + var p = new(AltereventtrigstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altereventtrigstmt + + return p +} + +func (s *AltereventtrigstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltereventtrigstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltereventtrigstmtContext) EVENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEVENT, 0) +} + +func (s *AltereventtrigstmtContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *AltereventtrigstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AltereventtrigstmtContext) Enable_trigger() IEnable_triggerContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEnable_triggerContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEnable_triggerContext) +} + +func (s *AltereventtrigstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltereventtrigstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltereventtrigstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltereventtrigstmt(s) + } +} + +func (s *AltereventtrigstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltereventtrigstmt(s) + } +} + +func (s *AltereventtrigstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltereventtrigstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altereventtrigstmt() (localctx IAltereventtrigstmtContext) { + localctx = NewAltereventtrigstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 456, PostgreSQLParserRULE_altereventtrigstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4345) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4346) + p.Match(PostgreSQLParserEVENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4347) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4348) + p.Name() + } + { + p.SetState(4349) + p.Enable_trigger() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEnable_triggerContext is an interface to support dynamic dispatch. +type IEnable_triggerContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ENABLE_P() antlr.TerminalNode + REPLICA() antlr.TerminalNode + ALWAYS() antlr.TerminalNode + DISABLE_P() antlr.TerminalNode + + // IsEnable_triggerContext differentiates from other interfaces. + IsEnable_triggerContext() +} + +type Enable_triggerContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEnable_triggerContext() *Enable_triggerContext { + var p = new(Enable_triggerContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_enable_trigger + return p +} + +func InitEmptyEnable_triggerContext(p *Enable_triggerContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_enable_trigger +} + +func (*Enable_triggerContext) IsEnable_triggerContext() {} + +func NewEnable_triggerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Enable_triggerContext { + var p = new(Enable_triggerContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_enable_trigger + + return p +} + +func (s *Enable_triggerContext) GetParser() antlr.Parser { return s.parser } + +func (s *Enable_triggerContext) ENABLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENABLE_P, 0) +} + +func (s *Enable_triggerContext) REPLICA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPLICA, 0) +} + +func (s *Enable_triggerContext) ALWAYS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALWAYS, 0) +} + +func (s *Enable_triggerContext) DISABLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISABLE_P, 0) +} + +func (s *Enable_triggerContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Enable_triggerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Enable_triggerContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterEnable_trigger(s) + } +} + +func (s *Enable_triggerContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitEnable_trigger(s) + } +} + +func (s *Enable_triggerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitEnable_trigger(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Enable_trigger() (localctx IEnable_triggerContext) { + localctx = NewEnable_triggerContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 458, PostgreSQLParserRULE_enable_trigger) + p.SetState(4357) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 329, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4351) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4352) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4353) + p.Match(PostgreSQLParserREPLICA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4354) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4355) + p.Match(PostgreSQLParserALWAYS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4356) + p.Match(PostgreSQLParserDISABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateassertionstmtContext is an interface to support dynamic dispatch. +type ICreateassertionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + ASSERTION() antlr.TerminalNode + Any_name() IAny_nameContext + CHECK() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + Constraintattributespec() IConstraintattributespecContext + + // IsCreateassertionstmtContext differentiates from other interfaces. + IsCreateassertionstmtContext() +} + +type CreateassertionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateassertionstmtContext() *CreateassertionstmtContext { + var p = new(CreateassertionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createassertionstmt + return p +} + +func InitEmptyCreateassertionstmtContext(p *CreateassertionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createassertionstmt +} + +func (*CreateassertionstmtContext) IsCreateassertionstmtContext() {} + +func NewCreateassertionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateassertionstmtContext { + var p = new(CreateassertionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createassertionstmt + + return p +} + +func (s *CreateassertionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateassertionstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateassertionstmtContext) ASSERTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASSERTION, 0) +} + +func (s *CreateassertionstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *CreateassertionstmtContext) CHECK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHECK, 0) +} + +func (s *CreateassertionstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CreateassertionstmtContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *CreateassertionstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CreateassertionstmtContext) Constraintattributespec() IConstraintattributespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstraintattributespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstraintattributespecContext) +} + +func (s *CreateassertionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateassertionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateassertionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateassertionstmt(s) + } +} + +func (s *CreateassertionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateassertionstmt(s) + } +} + +func (s *CreateassertionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateassertionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createassertionstmt() (localctx ICreateassertionstmtContext) { + localctx = NewCreateassertionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 460, PostgreSQLParserRULE_createassertionstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4359) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4360) + p.Match(PostgreSQLParserASSERTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4361) + p.Any_name() + } + { + p.SetState(4362) + p.Match(PostgreSQLParserCHECK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4363) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4364) + p.A_expr() + } + { + p.SetState(4365) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4366) + p.Constraintattributespec() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDefinestmtContext is an interface to support dynamic dispatch. +type IDefinestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + AGGREGATE() antlr.TerminalNode + Func_name() IFunc_nameContext + Aggr_args() IAggr_argsContext + Definition() IDefinitionContext + Opt_or_replace() IOpt_or_replaceContext + Old_aggr_definition() IOld_aggr_definitionContext + OPERATOR() antlr.TerminalNode + Any_operator() IAny_operatorContext + TYPE_P() antlr.TerminalNode + AllAny_name() []IAny_nameContext + Any_name(i int) IAny_nameContext + AS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + Opttablefuncelementlist() IOpttablefuncelementlistContext + ENUM_P() antlr.TerminalNode + Opt_enum_val_list() IOpt_enum_val_listContext + RANGE() antlr.TerminalNode + TEXT_P() antlr.TerminalNode + SEARCH() antlr.TerminalNode + PARSER() antlr.TerminalNode + DICTIONARY() antlr.TerminalNode + TEMPLATE() antlr.TerminalNode + CONFIGURATION() antlr.TerminalNode + COLLATION() antlr.TerminalNode + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + FROM() antlr.TerminalNode + + // IsDefinestmtContext differentiates from other interfaces. + IsDefinestmtContext() +} + +type DefinestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDefinestmtContext() *DefinestmtContext { + var p = new(DefinestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_definestmt + return p +} + +func InitEmptyDefinestmtContext(p *DefinestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_definestmt +} + +func (*DefinestmtContext) IsDefinestmtContext() {} + +func NewDefinestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DefinestmtContext { + var p = new(DefinestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_definestmt + + return p +} + +func (s *DefinestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DefinestmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *DefinestmtContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *DefinestmtContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *DefinestmtContext) Aggr_args() IAggr_argsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggr_argsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggr_argsContext) +} + +func (s *DefinestmtContext) Definition() IDefinitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefinitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefinitionContext) +} + +func (s *DefinestmtContext) Opt_or_replace() IOpt_or_replaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_or_replaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_or_replaceContext) +} + +func (s *DefinestmtContext) Old_aggr_definition() IOld_aggr_definitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOld_aggr_definitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOld_aggr_definitionContext) +} + +func (s *DefinestmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *DefinestmtContext) Any_operator() IAny_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_operatorContext) +} + +func (s *DefinestmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *DefinestmtContext) AllAny_name() []IAny_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAny_nameContext); ok { + len++ + } + } + + tst := make([]IAny_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAny_nameContext); ok { + tst[i] = t.(IAny_nameContext) + i++ + } + } + + return tst +} + +func (s *DefinestmtContext) Any_name(i int) IAny_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *DefinestmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *DefinestmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *DefinestmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *DefinestmtContext) Opttablefuncelementlist() IOpttablefuncelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttablefuncelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttablefuncelementlistContext) +} + +func (s *DefinestmtContext) ENUM_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENUM_P, 0) +} + +func (s *DefinestmtContext) Opt_enum_val_list() IOpt_enum_val_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_enum_val_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_enum_val_listContext) +} + +func (s *DefinestmtContext) RANGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRANGE, 0) +} + +func (s *DefinestmtContext) TEXT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEXT_P, 0) +} + +func (s *DefinestmtContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *DefinestmtContext) PARSER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARSER, 0) +} + +func (s *DefinestmtContext) DICTIONARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDICTIONARY, 0) +} + +func (s *DefinestmtContext) TEMPLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPLATE, 0) +} + +func (s *DefinestmtContext) CONFIGURATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFIGURATION, 0) +} + +func (s *DefinestmtContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *DefinestmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DefinestmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *DefinestmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DefinestmtContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *DefinestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DefinestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DefinestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDefinestmt(s) + } +} + +func (s *DefinestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDefinestmt(s) + } +} + +func (s *DefinestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDefinestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Definestmt() (localctx IDefinestmtContext) { + localctx = NewDefinestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 462, PostgreSQLParserRULE_definestmt) + var _la int + + p.SetState(4482) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 334, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4368) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4370) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOR { + { + p.SetState(4369) + p.Opt_or_replace() + } + + } + { + p.SetState(4372) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4373) + p.Func_name() + } + { + p.SetState(4374) + p.Aggr_args() + } + { + p.SetState(4375) + p.Definition() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4377) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4379) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOR { + { + p.SetState(4378) + p.Opt_or_replace() + } + + } + { + p.SetState(4381) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4382) + p.Func_name() + } + { + p.SetState(4383) + p.Old_aggr_definition() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4385) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4386) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4387) + p.Any_operator() + } + { + p.SetState(4388) + p.Definition() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4390) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4391) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4392) + p.Any_name() + } + { + p.SetState(4393) + p.Definition() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4395) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4396) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4397) + p.Any_name() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(4398) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4399) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4400) + p.Any_name() + } + { + p.SetState(4401) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4402) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4404) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(4403) + p.Opttablefuncelementlist() + } + + } + { + p.SetState(4406) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(4408) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4409) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4410) + p.Any_name() + } + { + p.SetState(4411) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4412) + p.Match(PostgreSQLParserENUM_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4413) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4415) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67108885) != 0 { + { + p.SetState(4414) + p.Opt_enum_val_list() + } + + } + { + p.SetState(4417) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(4419) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4420) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4421) + p.Any_name() + } + { + p.SetState(4422) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4423) + p.Match(PostgreSQLParserRANGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4424) + p.Definition() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(4426) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4427) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4428) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4429) + p.Match(PostgreSQLParserPARSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4430) + p.Any_name() + } + { + p.SetState(4431) + p.Definition() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(4433) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4434) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4435) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4436) + p.Match(PostgreSQLParserDICTIONARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4437) + p.Any_name() + } + { + p.SetState(4438) + p.Definition() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(4440) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4441) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4442) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4443) + p.Match(PostgreSQLParserTEMPLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4444) + p.Any_name() + } + { + p.SetState(4445) + p.Definition() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(4447) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4448) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4449) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4450) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4451) + p.Any_name() + } + { + p.SetState(4452) + p.Definition() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(4454) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4455) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4456) + p.Any_name() + } + { + p.SetState(4457) + p.Definition() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(4459) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4460) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4461) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4462) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4463) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4464) + p.Any_name() + } + { + p.SetState(4465) + p.Definition() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(4467) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4468) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4469) + p.Any_name() + } + { + p.SetState(4470) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4471) + p.Any_name() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(4473) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4474) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4475) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4476) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4477) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4478) + p.Any_name() + } + { + p.SetState(4479) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4480) + p.Any_name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDefinitionContext is an interface to support dynamic dispatch. +type IDefinitionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Def_list() IDef_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsDefinitionContext differentiates from other interfaces. + IsDefinitionContext() +} + +type DefinitionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDefinitionContext() *DefinitionContext { + var p = new(DefinitionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_definition + return p +} + +func InitEmptyDefinitionContext(p *DefinitionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_definition +} + +func (*DefinitionContext) IsDefinitionContext() {} + +func NewDefinitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DefinitionContext { + var p = new(DefinitionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_definition + + return p +} + +func (s *DefinitionContext) GetParser() antlr.Parser { return s.parser } + +func (s *DefinitionContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *DefinitionContext) Def_list() IDef_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDef_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDef_listContext) +} + +func (s *DefinitionContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *DefinitionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DefinitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DefinitionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDefinition(s) + } +} + +func (s *DefinitionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDefinition(s) + } +} + +func (s *DefinitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDefinition(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Definition() (localctx IDefinitionContext) { + localctx = NewDefinitionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 464, PostgreSQLParserRULE_definition) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4484) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4485) + p.Def_list() + } + { + p.SetState(4486) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDef_listContext is an interface to support dynamic dispatch. +type IDef_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllDef_elem() []IDef_elemContext + Def_elem(i int) IDef_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsDef_listContext differentiates from other interfaces. + IsDef_listContext() +} + +type Def_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDef_listContext() *Def_listContext { + var p = new(Def_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_def_list + return p +} + +func InitEmptyDef_listContext(p *Def_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_def_list +} + +func (*Def_listContext) IsDef_listContext() {} + +func NewDef_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Def_listContext { + var p = new(Def_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_def_list + + return p +} + +func (s *Def_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Def_listContext) AllDef_elem() []IDef_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IDef_elemContext); ok { + len++ + } + } + + tst := make([]IDef_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IDef_elemContext); ok { + tst[i] = t.(IDef_elemContext) + i++ + } + } + + return tst +} + +func (s *Def_listContext) Def_elem(i int) IDef_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDef_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IDef_elemContext) +} + +func (s *Def_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Def_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Def_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Def_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Def_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDef_list(s) + } +} + +func (s *Def_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDef_list(s) + } +} + +func (s *Def_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDef_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Def_list() (localctx IDef_listContext) { + localctx = NewDef_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 466, PostgreSQLParserRULE_def_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4488) + p.Def_elem() + } + p.SetState(4493) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4489) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4490) + p.Def_elem() + } + + p.SetState(4495) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDef_elemContext is an interface to support dynamic dispatch. +type IDef_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Collabel() ICollabelContext + EQUAL() antlr.TerminalNode + Def_arg() IDef_argContext + + // IsDef_elemContext differentiates from other interfaces. + IsDef_elemContext() +} + +type Def_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDef_elemContext() *Def_elemContext { + var p = new(Def_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_def_elem + return p +} + +func InitEmptyDef_elemContext(p *Def_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_def_elem +} + +func (*Def_elemContext) IsDef_elemContext() {} + +func NewDef_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Def_elemContext { + var p = new(Def_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_def_elem + + return p +} + +func (s *Def_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Def_elemContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Def_elemContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Def_elemContext) Def_arg() IDef_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDef_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDef_argContext) +} + +func (s *Def_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Def_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Def_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDef_elem(s) + } +} + +func (s *Def_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDef_elem(s) + } +} + +func (s *Def_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDef_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Def_elem() (localctx IDef_elemContext) { + localctx = NewDef_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 468, PostgreSQLParserRULE_def_elem) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4496) + p.Collabel() + } + p.SetState(4499) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEQUAL { + { + p.SetState(4497) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4498) + p.Def_arg() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDef_argContext is an interface to support dynamic dispatch. +type IDef_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_type() IFunc_typeContext + Reserved_keyword() IReserved_keywordContext + Qual_all_op() IQual_all_opContext + Numericonly() INumericonlyContext + Sconst() ISconstContext + NONE() antlr.TerminalNode + + // IsDef_argContext differentiates from other interfaces. + IsDef_argContext() +} + +type Def_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDef_argContext() *Def_argContext { + var p = new(Def_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_def_arg + return p +} + +func InitEmptyDef_argContext(p *Def_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_def_arg +} + +func (*Def_argContext) IsDef_argContext() {} + +func NewDef_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Def_argContext { + var p = new(Def_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_def_arg + + return p +} + +func (s *Def_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Def_argContext) Func_type() IFunc_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_typeContext) +} + +func (s *Def_argContext) Reserved_keyword() IReserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReserved_keywordContext) +} + +func (s *Def_argContext) Qual_all_op() IQual_all_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQual_all_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQual_all_opContext) +} + +func (s *Def_argContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Def_argContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Def_argContext) NONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNONE, 0) +} + +func (s *Def_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Def_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Def_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDef_arg(s) + } +} + +func (s *Def_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDef_arg(s) + } +} + +func (s *Def_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDef_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Def_arg() (localctx IDef_argContext) { + localctx = NewDef_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 470, PostgreSQLParserRULE_def_arg) + p.SetState(4507) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 337, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4501) + p.Func_type() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4502) + p.Reserved_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4503) + p.Qual_all_op() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4504) + p.Numericonly() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4505) + p.Sconst() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(4506) + p.Match(PostgreSQLParserNONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOld_aggr_definitionContext is an interface to support dynamic dispatch. +type IOld_aggr_definitionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Old_aggr_list() IOld_aggr_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOld_aggr_definitionContext differentiates from other interfaces. + IsOld_aggr_definitionContext() +} + +type Old_aggr_definitionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOld_aggr_definitionContext() *Old_aggr_definitionContext { + var p = new(Old_aggr_definitionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_old_aggr_definition + return p +} + +func InitEmptyOld_aggr_definitionContext(p *Old_aggr_definitionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_old_aggr_definition +} + +func (*Old_aggr_definitionContext) IsOld_aggr_definitionContext() {} + +func NewOld_aggr_definitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Old_aggr_definitionContext { + var p = new(Old_aggr_definitionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_old_aggr_definition + + return p +} + +func (s *Old_aggr_definitionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Old_aggr_definitionContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Old_aggr_definitionContext) Old_aggr_list() IOld_aggr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOld_aggr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOld_aggr_listContext) +} + +func (s *Old_aggr_definitionContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Old_aggr_definitionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Old_aggr_definitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Old_aggr_definitionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOld_aggr_definition(s) + } +} + +func (s *Old_aggr_definitionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOld_aggr_definition(s) + } +} + +func (s *Old_aggr_definitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOld_aggr_definition(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Old_aggr_definition() (localctx IOld_aggr_definitionContext) { + localctx = NewOld_aggr_definitionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 472, PostgreSQLParserRULE_old_aggr_definition) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4509) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4510) + p.Old_aggr_list() + } + { + p.SetState(4511) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOld_aggr_listContext is an interface to support dynamic dispatch. +type IOld_aggr_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllOld_aggr_elem() []IOld_aggr_elemContext + Old_aggr_elem(i int) IOld_aggr_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOld_aggr_listContext differentiates from other interfaces. + IsOld_aggr_listContext() +} + +type Old_aggr_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOld_aggr_listContext() *Old_aggr_listContext { + var p = new(Old_aggr_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_old_aggr_list + return p +} + +func InitEmptyOld_aggr_listContext(p *Old_aggr_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_old_aggr_list +} + +func (*Old_aggr_listContext) IsOld_aggr_listContext() {} + +func NewOld_aggr_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Old_aggr_listContext { + var p = new(Old_aggr_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_old_aggr_list + + return p +} + +func (s *Old_aggr_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Old_aggr_listContext) AllOld_aggr_elem() []IOld_aggr_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOld_aggr_elemContext); ok { + len++ + } + } + + tst := make([]IOld_aggr_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOld_aggr_elemContext); ok { + tst[i] = t.(IOld_aggr_elemContext) + i++ + } + } + + return tst +} + +func (s *Old_aggr_listContext) Old_aggr_elem(i int) IOld_aggr_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOld_aggr_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOld_aggr_elemContext) +} + +func (s *Old_aggr_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Old_aggr_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Old_aggr_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Old_aggr_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Old_aggr_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOld_aggr_list(s) + } +} + +func (s *Old_aggr_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOld_aggr_list(s) + } +} + +func (s *Old_aggr_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOld_aggr_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Old_aggr_list() (localctx IOld_aggr_listContext) { + localctx = NewOld_aggr_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 474, PostgreSQLParserRULE_old_aggr_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4513) + p.Old_aggr_elem() + } + p.SetState(4518) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4514) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4515) + p.Old_aggr_elem() + } + + p.SetState(4520) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOld_aggr_elemContext is an interface to support dynamic dispatch. +type IOld_aggr_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + EQUAL() antlr.TerminalNode + Def_arg() IDef_argContext + + // IsOld_aggr_elemContext differentiates from other interfaces. + IsOld_aggr_elemContext() +} + +type Old_aggr_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOld_aggr_elemContext() *Old_aggr_elemContext { + var p = new(Old_aggr_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_old_aggr_elem + return p +} + +func InitEmptyOld_aggr_elemContext(p *Old_aggr_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_old_aggr_elem +} + +func (*Old_aggr_elemContext) IsOld_aggr_elemContext() {} + +func NewOld_aggr_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Old_aggr_elemContext { + var p = new(Old_aggr_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_old_aggr_elem + + return p +} + +func (s *Old_aggr_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Old_aggr_elemContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Old_aggr_elemContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Old_aggr_elemContext) Def_arg() IDef_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDef_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDef_argContext) +} + +func (s *Old_aggr_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Old_aggr_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Old_aggr_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOld_aggr_elem(s) + } +} + +func (s *Old_aggr_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOld_aggr_elem(s) + } +} + +func (s *Old_aggr_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOld_aggr_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Old_aggr_elem() (localctx IOld_aggr_elemContext) { + localctx = NewOld_aggr_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 476, PostgreSQLParserRULE_old_aggr_elem) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4521) + p.Identifier() + } + { + p.SetState(4522) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4523) + p.Def_arg() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_enum_val_listContext is an interface to support dynamic dispatch. +type IOpt_enum_val_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Enum_val_list() IEnum_val_listContext + + // IsOpt_enum_val_listContext differentiates from other interfaces. + IsOpt_enum_val_listContext() +} + +type Opt_enum_val_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_enum_val_listContext() *Opt_enum_val_listContext { + var p = new(Opt_enum_val_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_enum_val_list + return p +} + +func InitEmptyOpt_enum_val_listContext(p *Opt_enum_val_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_enum_val_list +} + +func (*Opt_enum_val_listContext) IsOpt_enum_val_listContext() {} + +func NewOpt_enum_val_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_enum_val_listContext { + var p = new(Opt_enum_val_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_enum_val_list + + return p +} + +func (s *Opt_enum_val_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_enum_val_listContext) Enum_val_list() IEnum_val_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEnum_val_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEnum_val_listContext) +} + +func (s *Opt_enum_val_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_enum_val_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_enum_val_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_enum_val_list(s) + } +} + +func (s *Opt_enum_val_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_enum_val_list(s) + } +} + +func (s *Opt_enum_val_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_enum_val_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_enum_val_list() (localctx IOpt_enum_val_listContext) { + localctx = NewOpt_enum_val_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 478, PostgreSQLParserRULE_opt_enum_val_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4525) + p.Enum_val_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEnum_val_listContext is an interface to support dynamic dispatch. +type IEnum_val_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSconst() []ISconstContext + Sconst(i int) ISconstContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsEnum_val_listContext differentiates from other interfaces. + IsEnum_val_listContext() +} + +type Enum_val_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEnum_val_listContext() *Enum_val_listContext { + var p = new(Enum_val_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_enum_val_list + return p +} + +func InitEmptyEnum_val_listContext(p *Enum_val_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_enum_val_list +} + +func (*Enum_val_listContext) IsEnum_val_listContext() {} + +func NewEnum_val_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Enum_val_listContext { + var p = new(Enum_val_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_enum_val_list + + return p +} + +func (s *Enum_val_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Enum_val_listContext) AllSconst() []ISconstContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISconstContext); ok { + len++ + } + } + + tst := make([]ISconstContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISconstContext); ok { + tst[i] = t.(ISconstContext) + i++ + } + } + + return tst +} + +func (s *Enum_val_listContext) Sconst(i int) ISconstContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Enum_val_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Enum_val_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Enum_val_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Enum_val_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Enum_val_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterEnum_val_list(s) + } +} + +func (s *Enum_val_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitEnum_val_list(s) + } +} + +func (s *Enum_val_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitEnum_val_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Enum_val_list() (localctx IEnum_val_listContext) { + localctx = NewEnum_val_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 480, PostgreSQLParserRULE_enum_val_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4527) + p.Sconst() + } + p.SetState(4532) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4528) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4529) + p.Sconst() + } + + p.SetState(4534) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterenumstmtContext is an interface to support dynamic dispatch. +type IAlterenumstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + Any_name() IAny_nameContext + ADD_P() antlr.TerminalNode + VALUE_P() antlr.TerminalNode + AllSconst() []ISconstContext + Sconst(i int) ISconstContext + Opt_if_not_exists() IOpt_if_not_existsContext + BEFORE() antlr.TerminalNode + AFTER() antlr.TerminalNode + RENAME() antlr.TerminalNode + TO() antlr.TerminalNode + + // IsAlterenumstmtContext differentiates from other interfaces. + IsAlterenumstmtContext() +} + +type AlterenumstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterenumstmtContext() *AlterenumstmtContext { + var p = new(AlterenumstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterenumstmt + return p +} + +func InitEmptyAlterenumstmtContext(p *AlterenumstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterenumstmt +} + +func (*AlterenumstmtContext) IsAlterenumstmtContext() {} + +func NewAlterenumstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterenumstmtContext { + var p = new(AlterenumstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterenumstmt + + return p +} + +func (s *AlterenumstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterenumstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterenumstmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *AlterenumstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AlterenumstmtContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *AlterenumstmtContext) VALUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUE_P, 0) +} + +func (s *AlterenumstmtContext) AllSconst() []ISconstContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISconstContext); ok { + len++ + } + } + + tst := make([]ISconstContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISconstContext); ok { + tst[i] = t.(ISconstContext) + i++ + } + } + + return tst +} + +func (s *AlterenumstmtContext) Sconst(i int) ISconstContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *AlterenumstmtContext) Opt_if_not_exists() IOpt_if_not_existsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_if_not_existsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_if_not_existsContext) +} + +func (s *AlterenumstmtContext) BEFORE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBEFORE, 0) +} + +func (s *AlterenumstmtContext) AFTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAFTER, 0) +} + +func (s *AlterenumstmtContext) RENAME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRENAME, 0) +} + +func (s *AlterenumstmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *AlterenumstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterenumstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterenumstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterenumstmt(s) + } +} + +func (s *AlterenumstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterenumstmt(s) + } +} + +func (s *AlterenumstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterenumstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterenumstmt() (localctx IAlterenumstmtContext) { + localctx = NewAlterenumstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 482, PostgreSQLParserRULE_alterenumstmt) + var _la int + + p.SetState(4578) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 343, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4535) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4536) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4537) + p.Any_name() + } + { + p.SetState(4538) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4539) + p.Match(PostgreSQLParserVALUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4541) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserIF_P { + { + p.SetState(4540) + p.Opt_if_not_exists() + } + + } + { + p.SetState(4543) + p.Sconst() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4545) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4546) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4547) + p.Any_name() + } + { + p.SetState(4548) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4549) + p.Match(PostgreSQLParserVALUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4551) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserIF_P { + { + p.SetState(4550) + p.Opt_if_not_exists() + } + + } + { + p.SetState(4553) + p.Sconst() + } + { + p.SetState(4554) + p.Match(PostgreSQLParserBEFORE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4555) + p.Sconst() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4557) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4558) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4559) + p.Any_name() + } + { + p.SetState(4560) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4561) + p.Match(PostgreSQLParserVALUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4563) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserIF_P { + { + p.SetState(4562) + p.Opt_if_not_exists() + } + + } + { + p.SetState(4565) + p.Sconst() + } + { + p.SetState(4566) + p.Match(PostgreSQLParserAFTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4567) + p.Sconst() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4569) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4570) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4571) + p.Any_name() + } + { + p.SetState(4572) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4573) + p.Match(PostgreSQLParserVALUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4574) + p.Sconst() + } + { + p.SetState(4575) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4576) + p.Sconst() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_if_not_existsContext is an interface to support dynamic dispatch. +type IOpt_if_not_existsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsOpt_if_not_existsContext differentiates from other interfaces. + IsOpt_if_not_existsContext() +} + +type Opt_if_not_existsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_if_not_existsContext() *Opt_if_not_existsContext { + var p = new(Opt_if_not_existsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_if_not_exists + return p +} + +func InitEmptyOpt_if_not_existsContext(p *Opt_if_not_existsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_if_not_exists +} + +func (*Opt_if_not_existsContext) IsOpt_if_not_existsContext() {} + +func NewOpt_if_not_existsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_if_not_existsContext { + var p = new(Opt_if_not_existsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_if_not_exists + + return p +} + +func (s *Opt_if_not_existsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_if_not_existsContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *Opt_if_not_existsContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Opt_if_not_existsContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *Opt_if_not_existsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_if_not_existsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_if_not_existsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_if_not_exists(s) + } +} + +func (s *Opt_if_not_existsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_if_not_exists(s) + } +} + +func (s *Opt_if_not_existsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_if_not_exists(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_if_not_exists() (localctx IOpt_if_not_existsContext) { + localctx = NewOpt_if_not_existsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 484, PostgreSQLParserRULE_opt_if_not_exists) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4580) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4581) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4582) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateopclassstmtContext is an interface to support dynamic dispatch. +type ICreateopclassstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + CLASS() antlr.TerminalNode + Any_name() IAny_nameContext + FOR() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + Typename() ITypenameContext + USING() antlr.TerminalNode + Name() INameContext + AS() antlr.TerminalNode + Opclass_item_list() IOpclass_item_listContext + Opt_default() IOpt_defaultContext + Opt_opfamily() IOpt_opfamilyContext + + // IsCreateopclassstmtContext differentiates from other interfaces. + IsCreateopclassstmtContext() +} + +type CreateopclassstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateopclassstmtContext() *CreateopclassstmtContext { + var p = new(CreateopclassstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createopclassstmt + return p +} + +func InitEmptyCreateopclassstmtContext(p *CreateopclassstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createopclassstmt +} + +func (*CreateopclassstmtContext) IsCreateopclassstmtContext() {} + +func NewCreateopclassstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateopclassstmtContext { + var p = new(CreateopclassstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createopclassstmt + + return p +} + +func (s *CreateopclassstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateopclassstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateopclassstmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *CreateopclassstmtContext) CLASS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLASS, 0) +} + +func (s *CreateopclassstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *CreateopclassstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *CreateopclassstmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *CreateopclassstmtContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *CreateopclassstmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *CreateopclassstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateopclassstmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *CreateopclassstmtContext) Opclass_item_list() IOpclass_item_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpclass_item_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpclass_item_listContext) +} + +func (s *CreateopclassstmtContext) Opt_default() IOpt_defaultContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_defaultContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_defaultContext) +} + +func (s *CreateopclassstmtContext) Opt_opfamily() IOpt_opfamilyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_opfamilyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_opfamilyContext) +} + +func (s *CreateopclassstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateopclassstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateopclassstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateopclassstmt(s) + } +} + +func (s *CreateopclassstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateopclassstmt(s) + } +} + +func (s *CreateopclassstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateopclassstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createopclassstmt() (localctx ICreateopclassstmtContext) { + localctx = NewCreateopclassstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 486, PostgreSQLParserRULE_createopclassstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4584) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4585) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4586) + p.Match(PostgreSQLParserCLASS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4587) + p.Any_name() + } + p.SetState(4589) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDEFAULT { + { + p.SetState(4588) + p.Opt_default() + } + + } + { + p.SetState(4591) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4592) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4593) + p.Typename() + } + { + p.SetState(4594) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4595) + p.Name() + } + p.SetState(4597) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFAMILY { + { + p.SetState(4596) + p.Opt_opfamily() + } + + } + { + p.SetState(4599) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4600) + p.Opclass_item_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpclass_item_listContext is an interface to support dynamic dispatch. +type IOpclass_item_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllOpclass_item() []IOpclass_itemContext + Opclass_item(i int) IOpclass_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOpclass_item_listContext differentiates from other interfaces. + IsOpclass_item_listContext() +} + +type Opclass_item_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpclass_item_listContext() *Opclass_item_listContext { + var p = new(Opclass_item_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_item_list + return p +} + +func InitEmptyOpclass_item_listContext(p *Opclass_item_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_item_list +} + +func (*Opclass_item_listContext) IsOpclass_item_listContext() {} + +func NewOpclass_item_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opclass_item_listContext { + var p = new(Opclass_item_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opclass_item_list + + return p +} + +func (s *Opclass_item_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opclass_item_listContext) AllOpclass_item() []IOpclass_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOpclass_itemContext); ok { + len++ + } + } + + tst := make([]IOpclass_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOpclass_itemContext); ok { + tst[i] = t.(IOpclass_itemContext) + i++ + } + } + + return tst +} + +func (s *Opclass_item_listContext) Opclass_item(i int) IOpclass_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpclass_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOpclass_itemContext) +} + +func (s *Opclass_item_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Opclass_item_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Opclass_item_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opclass_item_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opclass_item_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpclass_item_list(s) + } +} + +func (s *Opclass_item_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpclass_item_list(s) + } +} + +func (s *Opclass_item_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpclass_item_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opclass_item_list() (localctx IOpclass_item_listContext) { + localctx = NewOpclass_item_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 488, PostgreSQLParserRULE_opclass_item_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4602) + p.Opclass_item() + } + p.SetState(4607) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4603) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4604) + p.Opclass_item() + } + + p.SetState(4609) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpclass_itemContext is an interface to support dynamic dispatch. +type IOpclass_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPERATOR() antlr.TerminalNode + Iconst() IIconstContext + Any_operator() IAny_operatorContext + Opclass_purpose() IOpclass_purposeContext + Opt_recheck() IOpt_recheckContext + Operator_with_argtypes() IOperator_with_argtypesContext + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + OPEN_PAREN() antlr.TerminalNode + Type_list() IType_listContext + CLOSE_PAREN() antlr.TerminalNode + STORAGE() antlr.TerminalNode + Typename() ITypenameContext + + // IsOpclass_itemContext differentiates from other interfaces. + IsOpclass_itemContext() +} + +type Opclass_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpclass_itemContext() *Opclass_itemContext { + var p = new(Opclass_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_item + return p +} + +func InitEmptyOpclass_itemContext(p *Opclass_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_item +} + +func (*Opclass_itemContext) IsOpclass_itemContext() {} + +func NewOpclass_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opclass_itemContext { + var p = new(Opclass_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opclass_item + + return p +} + +func (s *Opclass_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opclass_itemContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *Opclass_itemContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Opclass_itemContext) Any_operator() IAny_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_operatorContext) +} + +func (s *Opclass_itemContext) Opclass_purpose() IOpclass_purposeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpclass_purposeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpclass_purposeContext) +} + +func (s *Opclass_itemContext) Opt_recheck() IOpt_recheckContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_recheckContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_recheckContext) +} + +func (s *Opclass_itemContext) Operator_with_argtypes() IOperator_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_with_argtypesContext) +} + +func (s *Opclass_itemContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *Opclass_itemContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *Opclass_itemContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opclass_itemContext) Type_list() IType_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_listContext) +} + +func (s *Opclass_itemContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opclass_itemContext) STORAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTORAGE, 0) +} + +func (s *Opclass_itemContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Opclass_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opclass_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opclass_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpclass_item(s) + } +} + +func (s *Opclass_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpclass_item(s) + } +} + +func (s *Opclass_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpclass_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opclass_item() (localctx IOpclass_itemContext) { + localctx = NewOpclass_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 490, PostgreSQLParserRULE_opclass_item) + var _la int + + p.SetState(4641) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 351, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4610) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4611) + p.Iconst() + } + { + p.SetState(4612) + p.Any_operator() + } + p.SetState(4614) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(4613) + p.Opclass_purpose() + } + + } + p.SetState(4617) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserRECHECK { + { + p.SetState(4616) + p.Opt_recheck() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4619) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4620) + p.Iconst() + } + { + p.SetState(4621) + p.Operator_with_argtypes() + } + p.SetState(4623) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(4622) + p.Opclass_purpose() + } + + } + p.SetState(4626) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserRECHECK { + { + p.SetState(4625) + p.Opt_recheck() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4628) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4629) + p.Iconst() + } + { + p.SetState(4630) + p.Function_with_argtypes() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4632) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4633) + p.Iconst() + } + { + p.SetState(4634) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4635) + p.Type_list() + } + { + p.SetState(4636) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4637) + p.Function_with_argtypes() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4639) + p.Match(PostgreSQLParserSTORAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4640) + p.Typename() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_defaultContext is an interface to support dynamic dispatch. +type IOpt_defaultContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DEFAULT() antlr.TerminalNode + + // IsOpt_defaultContext differentiates from other interfaces. + IsOpt_defaultContext() +} + +type Opt_defaultContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_defaultContext() *Opt_defaultContext { + var p = new(Opt_defaultContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_default + return p +} + +func InitEmptyOpt_defaultContext(p *Opt_defaultContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_default +} + +func (*Opt_defaultContext) IsOpt_defaultContext() {} + +func NewOpt_defaultContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_defaultContext { + var p = new(Opt_defaultContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_default + + return p +} + +func (s *Opt_defaultContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_defaultContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Opt_defaultContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_defaultContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_defaultContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_default(s) + } +} + +func (s *Opt_defaultContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_default(s) + } +} + +func (s *Opt_defaultContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_default(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_default() (localctx IOpt_defaultContext) { + localctx = NewOpt_defaultContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 492, PostgreSQLParserRULE_opt_default) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4643) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_opfamilyContext is an interface to support dynamic dispatch. +type IOpt_opfamilyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FAMILY() antlr.TerminalNode + Any_name() IAny_nameContext + + // IsOpt_opfamilyContext differentiates from other interfaces. + IsOpt_opfamilyContext() +} + +type Opt_opfamilyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_opfamilyContext() *Opt_opfamilyContext { + var p = new(Opt_opfamilyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_opfamily + return p +} + +func InitEmptyOpt_opfamilyContext(p *Opt_opfamilyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_opfamily +} + +func (*Opt_opfamilyContext) IsOpt_opfamilyContext() {} + +func NewOpt_opfamilyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_opfamilyContext { + var p = new(Opt_opfamilyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_opfamily + + return p +} + +func (s *Opt_opfamilyContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_opfamilyContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *Opt_opfamilyContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Opt_opfamilyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_opfamilyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_opfamilyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_opfamily(s) + } +} + +func (s *Opt_opfamilyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_opfamily(s) + } +} + +func (s *Opt_opfamilyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_opfamily(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_opfamily() (localctx IOpt_opfamilyContext) { + localctx = NewOpt_opfamilyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 494, PostgreSQLParserRULE_opt_opfamily) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4645) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4646) + p.Any_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpclass_purposeContext is an interface to support dynamic dispatch. +type IOpclass_purposeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FOR() antlr.TerminalNode + SEARCH() antlr.TerminalNode + ORDER() antlr.TerminalNode + BY() antlr.TerminalNode + Any_name() IAny_nameContext + + // IsOpclass_purposeContext differentiates from other interfaces. + IsOpclass_purposeContext() +} + +type Opclass_purposeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpclass_purposeContext() *Opclass_purposeContext { + var p = new(Opclass_purposeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_purpose + return p +} + +func InitEmptyOpclass_purposeContext(p *Opclass_purposeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_purpose +} + +func (*Opclass_purposeContext) IsOpclass_purposeContext() {} + +func NewOpclass_purposeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opclass_purposeContext { + var p = new(Opclass_purposeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opclass_purpose + + return p +} + +func (s *Opclass_purposeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opclass_purposeContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Opclass_purposeContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *Opclass_purposeContext) ORDER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserORDER, 0) +} + +func (s *Opclass_purposeContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Opclass_purposeContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Opclass_purposeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opclass_purposeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opclass_purposeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpclass_purpose(s) + } +} + +func (s *Opclass_purposeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpclass_purpose(s) + } +} + +func (s *Opclass_purposeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpclass_purpose(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opclass_purpose() (localctx IOpclass_purposeContext) { + localctx = NewOpclass_purposeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 496, PostgreSQLParserRULE_opclass_purpose) + p.SetState(4654) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 352, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4648) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4649) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4650) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4651) + p.Match(PostgreSQLParserORDER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4652) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4653) + p.Any_name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_recheckContext is an interface to support dynamic dispatch. +type IOpt_recheckContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RECHECK() antlr.TerminalNode + + // IsOpt_recheckContext differentiates from other interfaces. + IsOpt_recheckContext() +} + +type Opt_recheckContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_recheckContext() *Opt_recheckContext { + var p = new(Opt_recheckContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_recheck + return p +} + +func InitEmptyOpt_recheckContext(p *Opt_recheckContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_recheck +} + +func (*Opt_recheckContext) IsOpt_recheckContext() {} + +func NewOpt_recheckContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_recheckContext { + var p = new(Opt_recheckContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_recheck + + return p +} + +func (s *Opt_recheckContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_recheckContext) RECHECK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRECHECK, 0) +} + +func (s *Opt_recheckContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_recheckContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_recheckContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_recheck(s) + } +} + +func (s *Opt_recheckContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_recheck(s) + } +} + +func (s *Opt_recheckContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_recheck(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_recheck() (localctx IOpt_recheckContext) { + localctx = NewOpt_recheckContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 498, PostgreSQLParserRULE_opt_recheck) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4656) + p.Match(PostgreSQLParserRECHECK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateopfamilystmtContext is an interface to support dynamic dispatch. +type ICreateopfamilystmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + FAMILY() antlr.TerminalNode + Any_name() IAny_nameContext + USING() antlr.TerminalNode + Name() INameContext + + // IsCreateopfamilystmtContext differentiates from other interfaces. + IsCreateopfamilystmtContext() +} + +type CreateopfamilystmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateopfamilystmtContext() *CreateopfamilystmtContext { + var p = new(CreateopfamilystmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createopfamilystmt + return p +} + +func InitEmptyCreateopfamilystmtContext(p *CreateopfamilystmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createopfamilystmt +} + +func (*CreateopfamilystmtContext) IsCreateopfamilystmtContext() {} + +func NewCreateopfamilystmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateopfamilystmtContext { + var p = new(CreateopfamilystmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createopfamilystmt + + return p +} + +func (s *CreateopfamilystmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateopfamilystmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateopfamilystmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *CreateopfamilystmtContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *CreateopfamilystmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *CreateopfamilystmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *CreateopfamilystmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreateopfamilystmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateopfamilystmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateopfamilystmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateopfamilystmt(s) + } +} + +func (s *CreateopfamilystmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateopfamilystmt(s) + } +} + +func (s *CreateopfamilystmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateopfamilystmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createopfamilystmt() (localctx ICreateopfamilystmtContext) { + localctx = NewCreateopfamilystmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 500, PostgreSQLParserRULE_createopfamilystmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4658) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4659) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4660) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4661) + p.Any_name() + } + { + p.SetState(4662) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4663) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlteropfamilystmtContext is an interface to support dynamic dispatch. +type IAlteropfamilystmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + FAMILY() antlr.TerminalNode + Any_name() IAny_nameContext + USING() antlr.TerminalNode + Name() INameContext + ADD_P() antlr.TerminalNode + Opclass_item_list() IOpclass_item_listContext + DROP() antlr.TerminalNode + Opclass_drop_list() IOpclass_drop_listContext + + // IsAlteropfamilystmtContext differentiates from other interfaces. + IsAlteropfamilystmtContext() +} + +type AlteropfamilystmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlteropfamilystmtContext() *AlteropfamilystmtContext { + var p = new(AlteropfamilystmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alteropfamilystmt + return p +} + +func InitEmptyAlteropfamilystmtContext(p *AlteropfamilystmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alteropfamilystmt +} + +func (*AlteropfamilystmtContext) IsAlteropfamilystmtContext() {} + +func NewAlteropfamilystmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlteropfamilystmtContext { + var p = new(AlteropfamilystmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alteropfamilystmt + + return p +} + +func (s *AlteropfamilystmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlteropfamilystmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlteropfamilystmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *AlteropfamilystmtContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *AlteropfamilystmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AlteropfamilystmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *AlteropfamilystmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlteropfamilystmtContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *AlteropfamilystmtContext) Opclass_item_list() IOpclass_item_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpclass_item_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpclass_item_listContext) +} + +func (s *AlteropfamilystmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *AlteropfamilystmtContext) Opclass_drop_list() IOpclass_drop_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpclass_drop_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpclass_drop_listContext) +} + +func (s *AlteropfamilystmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlteropfamilystmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlteropfamilystmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlteropfamilystmt(s) + } +} + +func (s *AlteropfamilystmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlteropfamilystmt(s) + } +} + +func (s *AlteropfamilystmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlteropfamilystmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alteropfamilystmt() (localctx IAlteropfamilystmtContext) { + localctx = NewAlteropfamilystmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 502, PostgreSQLParserRULE_alteropfamilystmt) + p.SetState(4683) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 353, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4665) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4666) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4667) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4668) + p.Any_name() + } + { + p.SetState(4669) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4670) + p.Name() + } + { + p.SetState(4671) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4672) + p.Opclass_item_list() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4674) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4675) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4676) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4677) + p.Any_name() + } + { + p.SetState(4678) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4679) + p.Name() + } + { + p.SetState(4680) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4681) + p.Opclass_drop_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpclass_drop_listContext is an interface to support dynamic dispatch. +type IOpclass_drop_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllOpclass_drop() []IOpclass_dropContext + Opclass_drop(i int) IOpclass_dropContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOpclass_drop_listContext differentiates from other interfaces. + IsOpclass_drop_listContext() +} + +type Opclass_drop_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpclass_drop_listContext() *Opclass_drop_listContext { + var p = new(Opclass_drop_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_drop_list + return p +} + +func InitEmptyOpclass_drop_listContext(p *Opclass_drop_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_drop_list +} + +func (*Opclass_drop_listContext) IsOpclass_drop_listContext() {} + +func NewOpclass_drop_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opclass_drop_listContext { + var p = new(Opclass_drop_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opclass_drop_list + + return p +} + +func (s *Opclass_drop_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opclass_drop_listContext) AllOpclass_drop() []IOpclass_dropContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOpclass_dropContext); ok { + len++ + } + } + + tst := make([]IOpclass_dropContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOpclass_dropContext); ok { + tst[i] = t.(IOpclass_dropContext) + i++ + } + } + + return tst +} + +func (s *Opclass_drop_listContext) Opclass_drop(i int) IOpclass_dropContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpclass_dropContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOpclass_dropContext) +} + +func (s *Opclass_drop_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Opclass_drop_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Opclass_drop_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opclass_drop_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opclass_drop_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpclass_drop_list(s) + } +} + +func (s *Opclass_drop_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpclass_drop_list(s) + } +} + +func (s *Opclass_drop_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpclass_drop_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opclass_drop_list() (localctx IOpclass_drop_listContext) { + localctx = NewOpclass_drop_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 504, PostgreSQLParserRULE_opclass_drop_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4685) + p.Opclass_drop() + } + p.SetState(4690) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4686) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4687) + p.Opclass_drop() + } + + p.SetState(4692) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpclass_dropContext is an interface to support dynamic dispatch. +type IOpclass_dropContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPERATOR() antlr.TerminalNode + Iconst() IIconstContext + OPEN_PAREN() antlr.TerminalNode + Type_list() IType_listContext + CLOSE_PAREN() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + + // IsOpclass_dropContext differentiates from other interfaces. + IsOpclass_dropContext() +} + +type Opclass_dropContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpclass_dropContext() *Opclass_dropContext { + var p = new(Opclass_dropContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_drop + return p +} + +func InitEmptyOpclass_dropContext(p *Opclass_dropContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opclass_drop +} + +func (*Opclass_dropContext) IsOpclass_dropContext() {} + +func NewOpclass_dropContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opclass_dropContext { + var p = new(Opclass_dropContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opclass_drop + + return p +} + +func (s *Opclass_dropContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opclass_dropContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *Opclass_dropContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Opclass_dropContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opclass_dropContext) Type_list() IType_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_listContext) +} + +func (s *Opclass_dropContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opclass_dropContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *Opclass_dropContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opclass_dropContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opclass_dropContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpclass_drop(s) + } +} + +func (s *Opclass_dropContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpclass_drop(s) + } +} + +func (s *Opclass_dropContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpclass_drop(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opclass_drop() (localctx IOpclass_dropContext) { + localctx = NewOpclass_dropContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 506, PostgreSQLParserRULE_opclass_drop) + p.SetState(4705) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPERATOR: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4693) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4694) + p.Iconst() + } + { + p.SetState(4695) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4696) + p.Type_list() + } + { + p.SetState(4697) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserFUNCTION: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4699) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4700) + p.Iconst() + } + { + p.SetState(4701) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4702) + p.Type_list() + } + { + p.SetState(4703) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDropopclassstmtContext is an interface to support dynamic dispatch. +type IDropopclassstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + CLASS() antlr.TerminalNode + Any_name() IAny_nameContext + USING() antlr.TerminalNode + Name() INameContext + Opt_drop_behavior() IOpt_drop_behaviorContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsDropopclassstmtContext differentiates from other interfaces. + IsDropopclassstmtContext() +} + +type DropopclassstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDropopclassstmtContext() *DropopclassstmtContext { + var p = new(DropopclassstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropopclassstmt + return p +} + +func InitEmptyDropopclassstmtContext(p *DropopclassstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropopclassstmt +} + +func (*DropopclassstmtContext) IsDropopclassstmtContext() {} + +func NewDropopclassstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropopclassstmtContext { + var p = new(DropopclassstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dropopclassstmt + + return p +} + +func (s *DropopclassstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DropopclassstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DropopclassstmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *DropopclassstmtContext) CLASS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLASS, 0) +} + +func (s *DropopclassstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *DropopclassstmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *DropopclassstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DropopclassstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *DropopclassstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DropopclassstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DropopclassstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DropopclassstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DropopclassstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDropopclassstmt(s) + } +} + +func (s *DropopclassstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDropopclassstmt(s) + } +} + +func (s *DropopclassstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDropopclassstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dropopclassstmt() (localctx IDropopclassstmtContext) { + localctx = NewDropopclassstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 508, PostgreSQLParserRULE_dropopclassstmt) + var _la int + + p.SetState(4727) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 358, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4707) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4708) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4709) + p.Match(PostgreSQLParserCLASS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4710) + p.Any_name() + } + { + p.SetState(4711) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4712) + p.Name() + } + p.SetState(4714) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4713) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4716) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4717) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4718) + p.Match(PostgreSQLParserCLASS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4719) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4720) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4721) + p.Any_name() + } + { + p.SetState(4722) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4723) + p.Name() + } + p.SetState(4725) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4724) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDropopfamilystmtContext is an interface to support dynamic dispatch. +type IDropopfamilystmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + FAMILY() antlr.TerminalNode + Any_name() IAny_nameContext + USING() antlr.TerminalNode + Name() INameContext + Opt_drop_behavior() IOpt_drop_behaviorContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsDropopfamilystmtContext differentiates from other interfaces. + IsDropopfamilystmtContext() +} + +type DropopfamilystmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDropopfamilystmtContext() *DropopfamilystmtContext { + var p = new(DropopfamilystmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropopfamilystmt + return p +} + +func InitEmptyDropopfamilystmtContext(p *DropopfamilystmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropopfamilystmt +} + +func (*DropopfamilystmtContext) IsDropopfamilystmtContext() {} + +func NewDropopfamilystmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropopfamilystmtContext { + var p = new(DropopfamilystmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dropopfamilystmt + + return p +} + +func (s *DropopfamilystmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DropopfamilystmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DropopfamilystmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *DropopfamilystmtContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *DropopfamilystmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *DropopfamilystmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *DropopfamilystmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DropopfamilystmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *DropopfamilystmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DropopfamilystmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DropopfamilystmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DropopfamilystmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DropopfamilystmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDropopfamilystmt(s) + } +} + +func (s *DropopfamilystmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDropopfamilystmt(s) + } +} + +func (s *DropopfamilystmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDropopfamilystmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dropopfamilystmt() (localctx IDropopfamilystmtContext) { + localctx = NewDropopfamilystmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 510, PostgreSQLParserRULE_dropopfamilystmt) + var _la int + + p.SetState(4749) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 361, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4729) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4730) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4731) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4732) + p.Any_name() + } + { + p.SetState(4733) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4734) + p.Name() + } + p.SetState(4736) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4735) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4738) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4739) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4740) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4741) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4742) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4743) + p.Any_name() + } + { + p.SetState(4744) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4745) + p.Name() + } + p.SetState(4747) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4746) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDropownedstmtContext is an interface to support dynamic dispatch. +type IDropownedstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + OWNED() antlr.TerminalNode + BY() antlr.TerminalNode + Role_list() IRole_listContext + Opt_drop_behavior() IOpt_drop_behaviorContext + + // IsDropownedstmtContext differentiates from other interfaces. + IsDropownedstmtContext() +} + +type DropownedstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDropownedstmtContext() *DropownedstmtContext { + var p = new(DropownedstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropownedstmt + return p +} + +func InitEmptyDropownedstmtContext(p *DropownedstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropownedstmt +} + +func (*DropownedstmtContext) IsDropownedstmtContext() {} + +func NewDropownedstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropownedstmtContext { + var p = new(DropownedstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dropownedstmt + + return p +} + +func (s *DropownedstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DropownedstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DropownedstmtContext) OWNED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNED, 0) +} + +func (s *DropownedstmtContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *DropownedstmtContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *DropownedstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *DropownedstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DropownedstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DropownedstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDropownedstmt(s) + } +} + +func (s *DropownedstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDropownedstmt(s) + } +} + +func (s *DropownedstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDropownedstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dropownedstmt() (localctx IDropownedstmtContext) { + localctx = NewDropownedstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 512, PostgreSQLParserRULE_dropownedstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4751) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4752) + p.Match(PostgreSQLParserOWNED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4753) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4754) + p.Role_list() + } + p.SetState(4756) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4755) + p.Opt_drop_behavior() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReassignownedstmtContext is an interface to support dynamic dispatch. +type IReassignownedstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + REASSIGN() antlr.TerminalNode + OWNED() antlr.TerminalNode + BY() antlr.TerminalNode + Role_list() IRole_listContext + TO() antlr.TerminalNode + Rolespec() IRolespecContext + + // IsReassignownedstmtContext differentiates from other interfaces. + IsReassignownedstmtContext() +} + +type ReassignownedstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReassignownedstmtContext() *ReassignownedstmtContext { + var p = new(ReassignownedstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reassignownedstmt + return p +} + +func InitEmptyReassignownedstmtContext(p *ReassignownedstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reassignownedstmt +} + +func (*ReassignownedstmtContext) IsReassignownedstmtContext() {} + +func NewReassignownedstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ReassignownedstmtContext { + var p = new(ReassignownedstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reassignownedstmt + + return p +} + +func (s *ReassignownedstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ReassignownedstmtContext) REASSIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREASSIGN, 0) +} + +func (s *ReassignownedstmtContext) OWNED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNED, 0) +} + +func (s *ReassignownedstmtContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *ReassignownedstmtContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *ReassignownedstmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *ReassignownedstmtContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *ReassignownedstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ReassignownedstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ReassignownedstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReassignownedstmt(s) + } +} + +func (s *ReassignownedstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReassignownedstmt(s) + } +} + +func (s *ReassignownedstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReassignownedstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reassignownedstmt() (localctx IReassignownedstmtContext) { + localctx = NewReassignownedstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 514, PostgreSQLParserRULE_reassignownedstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4758) + p.Match(PostgreSQLParserREASSIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4759) + p.Match(PostgreSQLParserOWNED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4760) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4761) + p.Role_list() + } + { + p.SetState(4762) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4763) + p.Rolespec() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDropstmtContext is an interface to support dynamic dispatch. +type IDropstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + Object_type_any_name() IObject_type_any_nameContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Any_name_list() IAny_name_listContext + Opt_drop_behavior() IOpt_drop_behaviorContext + Drop_type_name() IDrop_type_nameContext + Name_list() IName_listContext + Object_type_name_on_any_name() IObject_type_name_on_any_nameContext + Name() INameContext + ON() antlr.TerminalNode + Any_name() IAny_nameContext + TYPE_P() antlr.TerminalNode + Type_name_list() IType_name_listContext + DOMAIN_P() antlr.TerminalNode + INDEX() antlr.TerminalNode + CONCURRENTLY() antlr.TerminalNode + + // IsDropstmtContext differentiates from other interfaces. + IsDropstmtContext() +} + +type DropstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDropstmtContext() *DropstmtContext { + var p = new(DropstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropstmt + return p +} + +func InitEmptyDropstmtContext(p *DropstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropstmt +} + +func (*DropstmtContext) IsDropstmtContext() {} + +func NewDropstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropstmtContext { + var p = new(DropstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dropstmt + + return p +} + +func (s *DropstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DropstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DropstmtContext) Object_type_any_name() IObject_type_any_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_any_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_any_nameContext) +} + +func (s *DropstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DropstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DropstmtContext) Any_name_list() IAny_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_name_listContext) +} + +func (s *DropstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *DropstmtContext) Drop_type_name() IDrop_type_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDrop_type_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDrop_type_nameContext) +} + +func (s *DropstmtContext) Name_list() IName_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IName_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IName_listContext) +} + +func (s *DropstmtContext) Object_type_name_on_any_name() IObject_type_name_on_any_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_name_on_any_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_name_on_any_nameContext) +} + +func (s *DropstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DropstmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *DropstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *DropstmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *DropstmtContext) Type_name_list() IType_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_name_listContext) +} + +func (s *DropstmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *DropstmtContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *DropstmtContext) CONCURRENTLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONCURRENTLY, 0) +} + +func (s *DropstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DropstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DropstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDropstmt(s) + } +} + +func (s *DropstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDropstmt(s) + } +} + +func (s *DropstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDropstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dropstmt() (localctx IDropstmtContext) { + localctx = NewDropstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 516, PostgreSQLParserRULE_dropstmt) + var _la int + + p.SetState(4855) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 375, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4765) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4766) + p.Object_type_any_name() + } + { + p.SetState(4767) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4768) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4769) + p.Any_name_list() + } + p.SetState(4771) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4770) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4773) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4774) + p.Object_type_any_name() + } + { + p.SetState(4775) + p.Any_name_list() + } + p.SetState(4777) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4776) + p.Opt_drop_behavior() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4779) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4780) + p.Drop_type_name() + } + { + p.SetState(4781) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4782) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4783) + p.Name_list() + } + p.SetState(4785) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4784) + p.Opt_drop_behavior() + } + + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4787) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4788) + p.Drop_type_name() + } + { + p.SetState(4789) + p.Name_list() + } + p.SetState(4791) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4790) + p.Opt_drop_behavior() + } + + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4793) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4794) + p.Object_type_name_on_any_name() + } + { + p.SetState(4795) + p.Name() + } + { + p.SetState(4796) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4797) + p.Any_name() + } + p.SetState(4799) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4798) + p.Opt_drop_behavior() + } + + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(4801) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4802) + p.Object_type_name_on_any_name() + } + { + p.SetState(4803) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4804) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4805) + p.Name() + } + { + p.SetState(4806) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4807) + p.Any_name() + } + p.SetState(4809) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4808) + p.Opt_drop_behavior() + } + + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(4811) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4812) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4813) + p.Type_name_list() + } + p.SetState(4815) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4814) + p.Opt_drop_behavior() + } + + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(4817) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4818) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4819) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4820) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4821) + p.Type_name_list() + } + p.SetState(4823) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4822) + p.Opt_drop_behavior() + } + + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(4825) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4826) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4827) + p.Type_name_list() + } + p.SetState(4829) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4828) + p.Opt_drop_behavior() + } + + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(4831) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4832) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4833) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4834) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4835) + p.Type_name_list() + } + p.SetState(4837) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4836) + p.Opt_drop_behavior() + } + + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(4839) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4840) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4841) + p.Match(PostgreSQLParserCONCURRENTLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4842) + p.Any_name_list() + } + p.SetState(4844) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4843) + p.Opt_drop_behavior() + } + + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(4846) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4847) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4848) + p.Match(PostgreSQLParserCONCURRENTLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4849) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4850) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4851) + p.Any_name_list() + } + p.SetState(4853) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4852) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IObject_type_any_nameContext is an interface to support dynamic dispatch. +type IObject_type_any_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TABLE() antlr.TerminalNode + SEQUENCE() antlr.TerminalNode + VIEW() antlr.TerminalNode + MATERIALIZED() antlr.TerminalNode + INDEX() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + COLLATION() antlr.TerminalNode + CONVERSION_P() antlr.TerminalNode + STATISTICS() antlr.TerminalNode + TEXT_P() antlr.TerminalNode + SEARCH() antlr.TerminalNode + PARSER() antlr.TerminalNode + DICTIONARY() antlr.TerminalNode + TEMPLATE() antlr.TerminalNode + CONFIGURATION() antlr.TerminalNode + + // IsObject_type_any_nameContext differentiates from other interfaces. + IsObject_type_any_nameContext() +} + +type Object_type_any_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyObject_type_any_nameContext() *Object_type_any_nameContext { + var p = new(Object_type_any_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_object_type_any_name + return p +} + +func InitEmptyObject_type_any_nameContext(p *Object_type_any_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_object_type_any_name +} + +func (*Object_type_any_nameContext) IsObject_type_any_nameContext() {} + +func NewObject_type_any_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Object_type_any_nameContext { + var p = new(Object_type_any_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_object_type_any_name + + return p +} + +func (s *Object_type_any_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Object_type_any_nameContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Object_type_any_nameContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *Object_type_any_nameContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *Object_type_any_nameContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *Object_type_any_nameContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *Object_type_any_nameContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *Object_type_any_nameContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *Object_type_any_nameContext) CONVERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONVERSION_P, 0) +} + +func (s *Object_type_any_nameContext) STATISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, 0) +} + +func (s *Object_type_any_nameContext) TEXT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEXT_P, 0) +} + +func (s *Object_type_any_nameContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *Object_type_any_nameContext) PARSER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARSER, 0) +} + +func (s *Object_type_any_nameContext) DICTIONARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDICTIONARY, 0) +} + +func (s *Object_type_any_nameContext) TEMPLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPLATE, 0) +} + +func (s *Object_type_any_nameContext) CONFIGURATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFIGURATION, 0) +} + +func (s *Object_type_any_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Object_type_any_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Object_type_any_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterObject_type_any_name(s) + } +} + +func (s *Object_type_any_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitObject_type_any_name(s) + } +} + +func (s *Object_type_any_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitObject_type_any_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Object_type_any_name() (localctx IObject_type_any_nameContext) { + localctx = NewObject_type_any_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 518, PostgreSQLParserRULE_object_type_any_name) + p.SetState(4880) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 376, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4857) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4858) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4859) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4860) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4861) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4862) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(4863) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4864) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(4865) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(4866) + p.Match(PostgreSQLParserCONVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(4867) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(4868) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4869) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4870) + p.Match(PostgreSQLParserPARSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(4871) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4872) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4873) + p.Match(PostgreSQLParserDICTIONARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(4874) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4875) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4876) + p.Match(PostgreSQLParserTEMPLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(4877) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4878) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4879) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IObject_type_nameContext is an interface to support dynamic dispatch. +type IObject_type_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Drop_type_name() IDrop_type_nameContext + DATABASE() antlr.TerminalNode + ROLE() antlr.TerminalNode + SUBSCRIPTION() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + + // IsObject_type_nameContext differentiates from other interfaces. + IsObject_type_nameContext() +} + +type Object_type_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyObject_type_nameContext() *Object_type_nameContext { + var p = new(Object_type_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_object_type_name + return p +} + +func InitEmptyObject_type_nameContext(p *Object_type_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_object_type_name +} + +func (*Object_type_nameContext) IsObject_type_nameContext() {} + +func NewObject_type_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Object_type_nameContext { + var p = new(Object_type_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_object_type_name + + return p +} + +func (s *Object_type_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Object_type_nameContext) Drop_type_name() IDrop_type_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDrop_type_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDrop_type_nameContext) +} + +func (s *Object_type_nameContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *Object_type_nameContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *Object_type_nameContext) SUBSCRIPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSCRIPTION, 0) +} + +func (s *Object_type_nameContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *Object_type_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Object_type_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Object_type_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterObject_type_name(s) + } +} + +func (s *Object_type_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitObject_type_name(s) + } +} + +func (s *Object_type_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitObject_type_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Object_type_name() (localctx IObject_type_nameContext) { + localctx = NewObject_type_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 520, PostgreSQLParserRULE_object_type_name) + p.SetState(4887) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserFOREIGN, PostgreSQLParserACCESS, PostgreSQLParserEVENT, PostgreSQLParserEXTENSION, PostgreSQLParserLANGUAGE, PostgreSQLParserPROCEDURAL, PostgreSQLParserSCHEMA, PostgreSQLParserSERVER, PostgreSQLParserPUBLICATION: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4882) + p.Drop_type_name() + } + + case PostgreSQLParserDATABASE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4883) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserROLE: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4884) + p.Match(PostgreSQLParserROLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSUBSCRIPTION: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4885) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserTABLESPACE: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4886) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDrop_type_nameContext is an interface to support dynamic dispatch. +type IDrop_type_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ACCESS() antlr.TerminalNode + METHOD() antlr.TerminalNode + EVENT() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + EXTENSION() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + DATA_P() antlr.TerminalNode + WRAPPER() antlr.TerminalNode + LANGUAGE() antlr.TerminalNode + Opt_procedural() IOpt_proceduralContext + PUBLICATION() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + SERVER() antlr.TerminalNode + + // IsDrop_type_nameContext differentiates from other interfaces. + IsDrop_type_nameContext() +} + +type Drop_type_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDrop_type_nameContext() *Drop_type_nameContext { + var p = new(Drop_type_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_drop_type_name + return p +} + +func InitEmptyDrop_type_nameContext(p *Drop_type_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_drop_type_name +} + +func (*Drop_type_nameContext) IsDrop_type_nameContext() {} + +func NewDrop_type_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Drop_type_nameContext { + var p = new(Drop_type_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_drop_type_name + + return p +} + +func (s *Drop_type_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Drop_type_nameContext) ACCESS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACCESS, 0) +} + +func (s *Drop_type_nameContext) METHOD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMETHOD, 0) +} + +func (s *Drop_type_nameContext) EVENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEVENT, 0) +} + +func (s *Drop_type_nameContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *Drop_type_nameContext) EXTENSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTENSION, 0) +} + +func (s *Drop_type_nameContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *Drop_type_nameContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *Drop_type_nameContext) WRAPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRAPPER, 0) +} + +func (s *Drop_type_nameContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *Drop_type_nameContext) Opt_procedural() IOpt_proceduralContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_proceduralContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_proceduralContext) +} + +func (s *Drop_type_nameContext) PUBLICATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPUBLICATION, 0) +} + +func (s *Drop_type_nameContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Drop_type_nameContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *Drop_type_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Drop_type_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Drop_type_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDrop_type_name(s) + } +} + +func (s *Drop_type_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDrop_type_name(s) + } +} + +func (s *Drop_type_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDrop_type_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Drop_type_name() (localctx IDrop_type_nameContext) { + localctx = NewDrop_type_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 522, PostgreSQLParserRULE_drop_type_name) + var _la int + + p.SetState(4904) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserACCESS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4889) + p.Match(PostgreSQLParserACCESS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4890) + p.Match(PostgreSQLParserMETHOD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserEVENT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4891) + p.Match(PostgreSQLParserEVENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4892) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserEXTENSION: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4893) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserFOREIGN: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4894) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4895) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4896) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserLANGUAGE, PostgreSQLParserPROCEDURAL: + p.EnterOuterAlt(localctx, 5) + p.SetState(4898) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPROCEDURAL { + { + p.SetState(4897) + p.Opt_procedural() + } + + } + { + p.SetState(4900) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserPUBLICATION: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(4901) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSCHEMA: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(4902) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSERVER: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(4903) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IObject_type_name_on_any_nameContext is an interface to support dynamic dispatch. +type IObject_type_name_on_any_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + POLICY() antlr.TerminalNode + RULE() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + + // IsObject_type_name_on_any_nameContext differentiates from other interfaces. + IsObject_type_name_on_any_nameContext() +} + +type Object_type_name_on_any_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyObject_type_name_on_any_nameContext() *Object_type_name_on_any_nameContext { + var p = new(Object_type_name_on_any_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_object_type_name_on_any_name + return p +} + +func InitEmptyObject_type_name_on_any_nameContext(p *Object_type_name_on_any_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_object_type_name_on_any_name +} + +func (*Object_type_name_on_any_nameContext) IsObject_type_name_on_any_nameContext() {} + +func NewObject_type_name_on_any_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Object_type_name_on_any_nameContext { + var p = new(Object_type_name_on_any_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_object_type_name_on_any_name + + return p +} + +func (s *Object_type_name_on_any_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Object_type_name_on_any_nameContext) POLICY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPOLICY, 0) +} + +func (s *Object_type_name_on_any_nameContext) RULE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRULE, 0) +} + +func (s *Object_type_name_on_any_nameContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *Object_type_name_on_any_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Object_type_name_on_any_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Object_type_name_on_any_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterObject_type_name_on_any_name(s) + } +} + +func (s *Object_type_name_on_any_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitObject_type_name_on_any_name(s) + } +} + +func (s *Object_type_name_on_any_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitObject_type_name_on_any_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Object_type_name_on_any_name() (localctx IObject_type_name_on_any_nameContext) { + localctx = NewObject_type_name_on_any_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 524, PostgreSQLParserRULE_object_type_name_on_any_name) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4906) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserRULE || _la == PostgreSQLParserTRIGGER || _la == PostgreSQLParserPOLICY) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAny_name_listContext is an interface to support dynamic dispatch. +type IAny_name_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAny_name() []IAny_nameContext + Any_name(i int) IAny_nameContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsAny_name_listContext differentiates from other interfaces. + IsAny_name_listContext() +} + +type Any_name_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAny_name_listContext() *Any_name_listContext { + var p = new(Any_name_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_name_list + return p +} + +func InitEmptyAny_name_listContext(p *Any_name_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_name_list +} + +func (*Any_name_listContext) IsAny_name_listContext() {} + +func NewAny_name_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Any_name_listContext { + var p = new(Any_name_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_any_name_list + + return p +} + +func (s *Any_name_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Any_name_listContext) AllAny_name() []IAny_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAny_nameContext); ok { + len++ + } + } + + tst := make([]IAny_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAny_nameContext); ok { + tst[i] = t.(IAny_nameContext) + i++ + } + } + + return tst +} + +func (s *Any_name_listContext) Any_name(i int) IAny_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Any_name_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Any_name_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Any_name_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Any_name_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Any_name_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAny_name_list(s) + } +} + +func (s *Any_name_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAny_name_list(s) + } +} + +func (s *Any_name_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAny_name_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Any_name_list() (localctx IAny_name_listContext) { + localctx = NewAny_name_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 526, PostgreSQLParserRULE_any_name_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4908) + p.Any_name() + } + p.SetState(4913) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4909) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4910) + p.Any_name() + } + + p.SetState(4915) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAny_nameContext is an interface to support dynamic dispatch. +type IAny_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Attrs() IAttrsContext + + // IsAny_nameContext differentiates from other interfaces. + IsAny_nameContext() +} + +type Any_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAny_nameContext() *Any_nameContext { + var p = new(Any_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_name + return p +} + +func InitEmptyAny_nameContext(p *Any_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_name +} + +func (*Any_nameContext) IsAny_nameContext() {} + +func NewAny_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Any_nameContext { + var p = new(Any_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_any_name + + return p +} + +func (s *Any_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Any_nameContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Any_nameContext) Attrs() IAttrsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAttrsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAttrsContext) +} + +func (s *Any_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Any_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Any_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAny_name(s) + } +} + +func (s *Any_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAny_name(s) + } +} + +func (s *Any_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAny_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Any_name() (localctx IAny_nameContext) { + localctx = NewAny_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 528, PostgreSQLParserRULE_any_name) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4916) + p.Colid() + } + p.SetState(4918) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDOT { + { + p.SetState(4917) + p.Attrs() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAttrsContext is an interface to support dynamic dispatch. +type IAttrsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllDOT() []antlr.TerminalNode + DOT(i int) antlr.TerminalNode + AllAttr_name() []IAttr_nameContext + Attr_name(i int) IAttr_nameContext + + // IsAttrsContext differentiates from other interfaces. + IsAttrsContext() +} + +type AttrsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAttrsContext() *AttrsContext { + var p = new(AttrsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_attrs + return p +} + +func InitEmptyAttrsContext(p *AttrsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_attrs +} + +func (*AttrsContext) IsAttrsContext() {} + +func NewAttrsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AttrsContext { + var p = new(AttrsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_attrs + + return p +} + +func (s *AttrsContext) GetParser() antlr.Parser { return s.parser } + +func (s *AttrsContext) AllDOT() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserDOT) +} + +func (s *AttrsContext) DOT(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOT, i) +} + +func (s *AttrsContext) AllAttr_name() []IAttr_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAttr_nameContext); ok { + len++ + } + } + + tst := make([]IAttr_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAttr_nameContext); ok { + tst[i] = t.(IAttr_nameContext) + i++ + } + } + + return tst +} + +func (s *AttrsContext) Attr_name(i int) IAttr_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAttr_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAttr_nameContext) +} + +func (s *AttrsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AttrsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AttrsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAttrs(s) + } +} + +func (s *AttrsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAttrs(s) + } +} + +func (s *AttrsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAttrs(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Attrs() (localctx IAttrsContext) { + localctx = NewAttrsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 530, PostgreSQLParserRULE_attrs) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(4922) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(4920) + p.Match(PostgreSQLParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4921) + p.Attr_name() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(4924) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 382, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IType_name_listContext is an interface to support dynamic dispatch. +type IType_name_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsType_name_listContext differentiates from other interfaces. + IsType_name_listContext() +} + +type Type_name_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyType_name_listContext() *Type_name_listContext { + var p = new(Type_name_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_type_name_list + return p +} + +func InitEmptyType_name_listContext(p *Type_name_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_type_name_list +} + +func (*Type_name_listContext) IsType_name_listContext() {} + +func NewType_name_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_name_listContext { + var p = new(Type_name_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_type_name_list + + return p +} + +func (s *Type_name_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Type_name_listContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *Type_name_listContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Type_name_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Type_name_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Type_name_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Type_name_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Type_name_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterType_name_list(s) + } +} + +func (s *Type_name_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitType_name_list(s) + } +} + +func (s *Type_name_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitType_name_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Type_name_list() (localctx IType_name_listContext) { + localctx = NewType_name_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 532, PostgreSQLParserRULE_type_name_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4926) + p.Typename() + } + p.SetState(4931) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(4927) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4928) + p.Typename() + } + + p.SetState(4933) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITruncatestmtContext is an interface to support dynamic dispatch. +type ITruncatestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TRUNCATE() antlr.TerminalNode + Relation_expr_list() IRelation_expr_listContext + Opt_table() IOpt_tableContext + Opt_restart_seqs() IOpt_restart_seqsContext + Opt_drop_behavior() IOpt_drop_behaviorContext + + // IsTruncatestmtContext differentiates from other interfaces. + IsTruncatestmtContext() +} + +type TruncatestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTruncatestmtContext() *TruncatestmtContext { + var p = new(TruncatestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_truncatestmt + return p +} + +func InitEmptyTruncatestmtContext(p *TruncatestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_truncatestmt +} + +func (*TruncatestmtContext) IsTruncatestmtContext() {} + +func NewTruncatestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TruncatestmtContext { + var p = new(TruncatestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_truncatestmt + + return p +} + +func (s *TruncatestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *TruncatestmtContext) TRUNCATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUNCATE, 0) +} + +func (s *TruncatestmtContext) Relation_expr_list() IRelation_expr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_expr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_expr_listContext) +} + +func (s *TruncatestmtContext) Opt_table() IOpt_tableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_tableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_tableContext) +} + +func (s *TruncatestmtContext) Opt_restart_seqs() IOpt_restart_seqsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_restart_seqsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_restart_seqsContext) +} + +func (s *TruncatestmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *TruncatestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TruncatestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TruncatestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTruncatestmt(s) + } +} + +func (s *TruncatestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTruncatestmt(s) + } +} + +func (s *TruncatestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTruncatestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Truncatestmt() (localctx ITruncatestmtContext) { + localctx = NewTruncatestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 534, PostgreSQLParserRULE_truncatestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4934) + p.Match(PostgreSQLParserTRUNCATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(4936) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 384, p.GetParserRuleContext()) == 1 { + { + p.SetState(4935) + p.Opt_table() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(4938) + p.Relation_expr_list() + } + p.SetState(4940) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCONTINUE_P || _la == PostgreSQLParserRESTART { + { + p.SetState(4939) + p.Opt_restart_seqs() + } + + } + p.SetState(4943) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(4942) + p.Opt_drop_behavior() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_restart_seqsContext is an interface to support dynamic dispatch. +type IOpt_restart_seqsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CONTINUE_P() antlr.TerminalNode + IDENTITY_P() antlr.TerminalNode + RESTART() antlr.TerminalNode + + // IsOpt_restart_seqsContext differentiates from other interfaces. + IsOpt_restart_seqsContext() +} + +type Opt_restart_seqsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_restart_seqsContext() *Opt_restart_seqsContext { + var p = new(Opt_restart_seqsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_restart_seqs + return p +} + +func InitEmptyOpt_restart_seqsContext(p *Opt_restart_seqsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_restart_seqs +} + +func (*Opt_restart_seqsContext) IsOpt_restart_seqsContext() {} + +func NewOpt_restart_seqsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_restart_seqsContext { + var p = new(Opt_restart_seqsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_restart_seqs + + return p +} + +func (s *Opt_restart_seqsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_restart_seqsContext) CONTINUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONTINUE_P, 0) +} + +func (s *Opt_restart_seqsContext) IDENTITY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIDENTITY_P, 0) +} + +func (s *Opt_restart_seqsContext) RESTART() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESTART, 0) +} + +func (s *Opt_restart_seqsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_restart_seqsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_restart_seqsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_restart_seqs(s) + } +} + +func (s *Opt_restart_seqsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_restart_seqs(s) + } +} + +func (s *Opt_restart_seqsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_restart_seqs(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_restart_seqs() (localctx IOpt_restart_seqsContext) { + localctx = NewOpt_restart_seqsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 536, PostgreSQLParserRULE_opt_restart_seqs) + p.SetState(4949) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserCONTINUE_P: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4945) + p.Match(PostgreSQLParserCONTINUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4946) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserRESTART: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4947) + p.Match(PostgreSQLParserRESTART) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4948) + p.Match(PostgreSQLParserIDENTITY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICommentstmtContext is an interface to support dynamic dispatch. +type ICommentstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COMMENT() antlr.TerminalNode + AllON() []antlr.TerminalNode + ON(i int) antlr.TerminalNode + Object_type_any_name() IObject_type_any_nameContext + Any_name() IAny_nameContext + IS() antlr.TerminalNode + Comment_text() IComment_textContext + COLUMN() antlr.TerminalNode + Object_type_name() IObject_type_nameContext + Name() INameContext + TYPE_P() antlr.TerminalNode + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + DOMAIN_P() antlr.TerminalNode + AGGREGATE() antlr.TerminalNode + Aggregate_with_argtypes() IAggregate_with_argtypesContext + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + OPERATOR() antlr.TerminalNode + Operator_with_argtypes() IOperator_with_argtypesContext + CONSTRAINT() antlr.TerminalNode + Object_type_name_on_any_name() IObject_type_name_on_any_nameContext + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + TRANSFORM() antlr.TerminalNode + FOR() antlr.TerminalNode + LANGUAGE() antlr.TerminalNode + CLASS() antlr.TerminalNode + USING() antlr.TerminalNode + FAMILY() antlr.TerminalNode + LARGE_P() antlr.TerminalNode + OBJECT_P() antlr.TerminalNode + Numericonly() INumericonlyContext + CAST() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + AS() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + + // IsCommentstmtContext differentiates from other interfaces. + IsCommentstmtContext() +} + +type CommentstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCommentstmtContext() *CommentstmtContext { + var p = new(CommentstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_commentstmt + return p +} + +func InitEmptyCommentstmtContext(p *CommentstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_commentstmt +} + +func (*CommentstmtContext) IsCommentstmtContext() {} + +func NewCommentstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CommentstmtContext { + var p = new(CommentstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_commentstmt + + return p +} + +func (s *CommentstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CommentstmtContext) COMMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMENT, 0) +} + +func (s *CommentstmtContext) AllON() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserON) +} + +func (s *CommentstmtContext) ON(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, i) +} + +func (s *CommentstmtContext) Object_type_any_name() IObject_type_any_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_any_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_any_nameContext) +} + +func (s *CommentstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *CommentstmtContext) IS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIS, 0) +} + +func (s *CommentstmtContext) Comment_text() IComment_textContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IComment_textContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IComment_textContext) +} + +func (s *CommentstmtContext) COLUMN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLUMN, 0) +} + +func (s *CommentstmtContext) Object_type_name() IObject_type_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_nameContext) +} + +func (s *CommentstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CommentstmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *CommentstmtContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *CommentstmtContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *CommentstmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *CommentstmtContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *CommentstmtContext) Aggregate_with_argtypes() IAggregate_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggregate_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggregate_with_argtypesContext) +} + +func (s *CommentstmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *CommentstmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *CommentstmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *CommentstmtContext) Operator_with_argtypes() IOperator_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_with_argtypesContext) +} + +func (s *CommentstmtContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *CommentstmtContext) Object_type_name_on_any_name() IObject_type_name_on_any_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_name_on_any_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_name_on_any_nameContext) +} + +func (s *CommentstmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *CommentstmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *CommentstmtContext) TRANSFORM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSFORM, 0) +} + +func (s *CommentstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *CommentstmtContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *CommentstmtContext) CLASS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLASS, 0) +} + +func (s *CommentstmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *CommentstmtContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *CommentstmtContext) LARGE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLARGE_P, 0) +} + +func (s *CommentstmtContext) OBJECT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOBJECT_P, 0) +} + +func (s *CommentstmtContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *CommentstmtContext) CAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCAST, 0) +} + +func (s *CommentstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CommentstmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *CommentstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CommentstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CommentstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CommentstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCommentstmt(s) + } +} + +func (s *CommentstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCommentstmt(s) + } +} + +func (s *CommentstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCommentstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Commentstmt() (localctx ICommentstmtContext) { + localctx = NewCommentstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 538, PostgreSQLParserRULE_commentstmt) + p.SetState(5098) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 388, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(4951) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4952) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4953) + p.Object_type_any_name() + } + { + p.SetState(4954) + p.Any_name() + } + { + p.SetState(4955) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4956) + p.Comment_text() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(4958) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4959) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4960) + p.Match(PostgreSQLParserCOLUMN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4961) + p.Any_name() + } + { + p.SetState(4962) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4963) + p.Comment_text() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(4965) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4966) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4967) + p.Object_type_name() + } + { + p.SetState(4968) + p.Name() + } + { + p.SetState(4969) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4970) + p.Comment_text() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(4972) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4973) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4974) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4975) + p.Typename() + } + { + p.SetState(4976) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4977) + p.Comment_text() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(4979) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4980) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4981) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4982) + p.Typename() + } + { + p.SetState(4983) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4984) + p.Comment_text() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(4986) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4987) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4988) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4989) + p.Aggregate_with_argtypes() + } + { + p.SetState(4990) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4991) + p.Comment_text() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(4993) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4994) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4995) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4996) + p.Function_with_argtypes() + } + { + p.SetState(4997) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(4998) + p.Comment_text() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(5000) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5001) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5002) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5003) + p.Operator_with_argtypes() + } + { + p.SetState(5004) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5005) + p.Comment_text() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(5007) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5008) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5009) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5010) + p.Name() + } + { + p.SetState(5011) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5012) + p.Any_name() + } + { + p.SetState(5013) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5014) + p.Comment_text() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(5016) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5017) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5018) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5019) + p.Name() + } + { + p.SetState(5020) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5021) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5022) + p.Any_name() + } + { + p.SetState(5023) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5024) + p.Comment_text() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(5026) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5027) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5028) + p.Object_type_name_on_any_name() + } + { + p.SetState(5029) + p.Name() + } + { + p.SetState(5030) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5031) + p.Any_name() + } + { + p.SetState(5032) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5033) + p.Comment_text() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(5035) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5036) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5037) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5038) + p.Function_with_argtypes() + } + { + p.SetState(5039) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5040) + p.Comment_text() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(5042) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5043) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5044) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5045) + p.Function_with_argtypes() + } + { + p.SetState(5046) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5047) + p.Comment_text() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(5049) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5050) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5051) + p.Match(PostgreSQLParserTRANSFORM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5052) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5053) + p.Typename() + } + { + p.SetState(5054) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5055) + p.Name() + } + { + p.SetState(5056) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5057) + p.Comment_text() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(5059) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5060) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5061) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5062) + p.Match(PostgreSQLParserCLASS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5063) + p.Any_name() + } + { + p.SetState(5064) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5065) + p.Name() + } + { + p.SetState(5066) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5067) + p.Comment_text() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(5069) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5070) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5071) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5072) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5073) + p.Any_name() + } + { + p.SetState(5074) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5075) + p.Name() + } + { + p.SetState(5076) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5077) + p.Comment_text() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(5079) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5080) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5081) + p.Match(PostgreSQLParserLARGE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5082) + p.Match(PostgreSQLParserOBJECT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5083) + p.Numericonly() + } + { + p.SetState(5084) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5085) + p.Comment_text() + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(5087) + p.Match(PostgreSQLParserCOMMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5088) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5089) + p.Match(PostgreSQLParserCAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5090) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5091) + p.Typename() + } + { + p.SetState(5092) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5093) + p.Typename() + } + { + p.SetState(5094) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5095) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5096) + p.Comment_text() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IComment_textContext is an interface to support dynamic dispatch. +type IComment_textContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + NULL_P() antlr.TerminalNode + + // IsComment_textContext differentiates from other interfaces. + IsComment_textContext() +} + +type Comment_textContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyComment_textContext() *Comment_textContext { + var p = new(Comment_textContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_comment_text + return p +} + +func InitEmptyComment_textContext(p *Comment_textContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_comment_text +} + +func (*Comment_textContext) IsComment_textContext() {} + +func NewComment_textContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Comment_textContext { + var p = new(Comment_textContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_comment_text + + return p +} + +func (s *Comment_textContext) GetParser() antlr.Parser { return s.parser } + +func (s *Comment_textContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Comment_textContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Comment_textContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Comment_textContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Comment_textContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterComment_text(s) + } +} + +func (s *Comment_textContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitComment_text(s) + } +} + +func (s *Comment_textContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitComment_text(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Comment_text() (localctx IComment_textContext) { + localctx = NewComment_textContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 540, PostgreSQLParserRULE_comment_text) + p.SetState(5102) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5100) + p.Sconst() + } + + case PostgreSQLParserNULL_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5101) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISeclabelstmtContext is an interface to support dynamic dispatch. +type ISeclabelstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SECURITY() antlr.TerminalNode + LABEL() antlr.TerminalNode + ON() antlr.TerminalNode + Object_type_any_name() IObject_type_any_nameContext + Any_name() IAny_nameContext + IS() antlr.TerminalNode + Security_label() ISecurity_labelContext + Opt_provider() IOpt_providerContext + COLUMN() antlr.TerminalNode + Object_type_name() IObject_type_nameContext + Name() INameContext + TYPE_P() antlr.TerminalNode + Typename() ITypenameContext + DOMAIN_P() antlr.TerminalNode + AGGREGATE() antlr.TerminalNode + Aggregate_with_argtypes() IAggregate_with_argtypesContext + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + LARGE_P() antlr.TerminalNode + OBJECT_P() antlr.TerminalNode + Numericonly() INumericonlyContext + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + + // IsSeclabelstmtContext differentiates from other interfaces. + IsSeclabelstmtContext() +} + +type SeclabelstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySeclabelstmtContext() *SeclabelstmtContext { + var p = new(SeclabelstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_seclabelstmt + return p +} + +func InitEmptySeclabelstmtContext(p *SeclabelstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_seclabelstmt +} + +func (*SeclabelstmtContext) IsSeclabelstmtContext() {} + +func NewSeclabelstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SeclabelstmtContext { + var p = new(SeclabelstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_seclabelstmt + + return p +} + +func (s *SeclabelstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *SeclabelstmtContext) SECURITY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSECURITY, 0) +} + +func (s *SeclabelstmtContext) LABEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLABEL, 0) +} + +func (s *SeclabelstmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *SeclabelstmtContext) Object_type_any_name() IObject_type_any_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_any_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_any_nameContext) +} + +func (s *SeclabelstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *SeclabelstmtContext) IS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIS, 0) +} + +func (s *SeclabelstmtContext) Security_label() ISecurity_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISecurity_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISecurity_labelContext) +} + +func (s *SeclabelstmtContext) Opt_provider() IOpt_providerContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_providerContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_providerContext) +} + +func (s *SeclabelstmtContext) COLUMN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLUMN, 0) +} + +func (s *SeclabelstmtContext) Object_type_name() IObject_type_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_type_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_type_nameContext) +} + +func (s *SeclabelstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *SeclabelstmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *SeclabelstmtContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *SeclabelstmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *SeclabelstmtContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *SeclabelstmtContext) Aggregate_with_argtypes() IAggregate_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggregate_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggregate_with_argtypesContext) +} + +func (s *SeclabelstmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *SeclabelstmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *SeclabelstmtContext) LARGE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLARGE_P, 0) +} + +func (s *SeclabelstmtContext) OBJECT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOBJECT_P, 0) +} + +func (s *SeclabelstmtContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *SeclabelstmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *SeclabelstmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *SeclabelstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SeclabelstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SeclabelstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSeclabelstmt(s) + } +} + +func (s *SeclabelstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSeclabelstmt(s) + } +} + +func (s *SeclabelstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSeclabelstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Seclabelstmt() (localctx ISeclabelstmtContext) { + localctx = NewSeclabelstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 542, PostgreSQLParserRULE_seclabelstmt) + var _la int + + p.SetState(5215) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 400, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5104) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5105) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5107) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5106) + p.Opt_provider() + } + + } + { + p.SetState(5109) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5110) + p.Object_type_any_name() + } + { + p.SetState(5111) + p.Any_name() + } + { + p.SetState(5112) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5113) + p.Security_label() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5115) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5116) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5118) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5117) + p.Opt_provider() + } + + } + { + p.SetState(5120) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5121) + p.Match(PostgreSQLParserCOLUMN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5122) + p.Any_name() + } + { + p.SetState(5123) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5124) + p.Security_label() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5126) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5127) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5129) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5128) + p.Opt_provider() + } + + } + { + p.SetState(5131) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5132) + p.Object_type_name() + } + { + p.SetState(5133) + p.Name() + } + { + p.SetState(5134) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5135) + p.Security_label() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5137) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5138) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5140) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5139) + p.Opt_provider() + } + + } + { + p.SetState(5142) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5143) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5144) + p.Typename() + } + { + p.SetState(5145) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5146) + p.Security_label() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(5148) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5149) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5151) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5150) + p.Opt_provider() + } + + } + { + p.SetState(5153) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5154) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5155) + p.Typename() + } + { + p.SetState(5156) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5157) + p.Security_label() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(5159) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5160) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5162) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5161) + p.Opt_provider() + } + + } + { + p.SetState(5164) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5165) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5166) + p.Aggregate_with_argtypes() + } + { + p.SetState(5167) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5168) + p.Security_label() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(5170) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5171) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5173) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5172) + p.Opt_provider() + } + + } + { + p.SetState(5175) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5176) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5177) + p.Function_with_argtypes() + } + { + p.SetState(5178) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5179) + p.Security_label() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(5181) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5182) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5184) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5183) + p.Opt_provider() + } + + } + { + p.SetState(5186) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5187) + p.Match(PostgreSQLParserLARGE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5188) + p.Match(PostgreSQLParserOBJECT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5189) + p.Numericonly() + } + { + p.SetState(5190) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5191) + p.Security_label() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(5193) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5194) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5196) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5195) + p.Opt_provider() + } + + } + { + p.SetState(5198) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5199) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5200) + p.Function_with_argtypes() + } + { + p.SetState(5201) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5202) + p.Security_label() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(5204) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5205) + p.Match(PostgreSQLParserLABEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5207) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(5206) + p.Opt_provider() + } + + } + { + p.SetState(5209) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5210) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5211) + p.Function_with_argtypes() + } + { + p.SetState(5212) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5213) + p.Security_label() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_providerContext is an interface to support dynamic dispatch. +type IOpt_providerContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FOR() antlr.TerminalNode + Nonreservedword_or_sconst() INonreservedword_or_sconstContext + + // IsOpt_providerContext differentiates from other interfaces. + IsOpt_providerContext() +} + +type Opt_providerContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_providerContext() *Opt_providerContext { + var p = new(Opt_providerContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_provider + return p +} + +func InitEmptyOpt_providerContext(p *Opt_providerContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_provider +} + +func (*Opt_providerContext) IsOpt_providerContext() {} + +func NewOpt_providerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_providerContext { + var p = new(Opt_providerContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_provider + + return p +} + +func (s *Opt_providerContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_providerContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Opt_providerContext) Nonreservedword_or_sconst() INonreservedword_or_sconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedword_or_sconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedword_or_sconstContext) +} + +func (s *Opt_providerContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_providerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_providerContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_provider(s) + } +} + +func (s *Opt_providerContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_provider(s) + } +} + +func (s *Opt_providerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_provider(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_provider() (localctx IOpt_providerContext) { + localctx = NewOpt_providerContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 544, PostgreSQLParserRULE_opt_provider) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5217) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5218) + p.Nonreservedword_or_sconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISecurity_labelContext is an interface to support dynamic dispatch. +type ISecurity_labelContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + NULL_P() antlr.TerminalNode + + // IsSecurity_labelContext differentiates from other interfaces. + IsSecurity_labelContext() +} + +type Security_labelContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySecurity_labelContext() *Security_labelContext { + var p = new(Security_labelContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_security_label + return p +} + +func InitEmptySecurity_labelContext(p *Security_labelContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_security_label +} + +func (*Security_labelContext) IsSecurity_labelContext() {} + +func NewSecurity_labelContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Security_labelContext { + var p = new(Security_labelContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_security_label + + return p +} + +func (s *Security_labelContext) GetParser() antlr.Parser { return s.parser } + +func (s *Security_labelContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Security_labelContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Security_labelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Security_labelContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Security_labelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSecurity_label(s) + } +} + +func (s *Security_labelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSecurity_label(s) + } +} + +func (s *Security_labelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSecurity_label(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Security_label() (localctx ISecurity_labelContext) { + localctx = NewSecurity_labelContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 546, PostgreSQLParserRULE_security_label) + p.SetState(5222) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5220) + p.Sconst() + } + + case PostgreSQLParserNULL_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5221) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFetchstmtContext is an interface to support dynamic dispatch. +type IFetchstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FETCH() antlr.TerminalNode + Fetch_args() IFetch_argsContext + MOVE() antlr.TerminalNode + + // IsFetchstmtContext differentiates from other interfaces. + IsFetchstmtContext() +} + +type FetchstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFetchstmtContext() *FetchstmtContext { + var p = new(FetchstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fetchstmt + return p +} + +func InitEmptyFetchstmtContext(p *FetchstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fetchstmt +} + +func (*FetchstmtContext) IsFetchstmtContext() {} + +func NewFetchstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FetchstmtContext { + var p = new(FetchstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_fetchstmt + + return p +} + +func (s *FetchstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *FetchstmtContext) FETCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFETCH, 0) +} + +func (s *FetchstmtContext) Fetch_args() IFetch_argsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFetch_argsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFetch_argsContext) +} + +func (s *FetchstmtContext) MOVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMOVE, 0) +} + +func (s *FetchstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *FetchstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *FetchstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFetchstmt(s) + } +} + +func (s *FetchstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFetchstmt(s) + } +} + +func (s *FetchstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFetchstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Fetchstmt() (localctx IFetchstmtContext) { + localctx = NewFetchstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 548, PostgreSQLParserRULE_fetchstmt) + p.SetState(5228) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserFETCH: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5224) + p.Match(PostgreSQLParserFETCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5225) + p.Fetch_args() + } + + case PostgreSQLParserMOVE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5226) + p.Match(PostgreSQLParserMOVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5227) + p.Fetch_args() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFetch_argsContext is an interface to support dynamic dispatch. +type IFetch_argsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Cursor_name() ICursor_nameContext + From_in() IFrom_inContext + NEXT() antlr.TerminalNode + Opt_from_in() IOpt_from_inContext + PRIOR() antlr.TerminalNode + FIRST_P() antlr.TerminalNode + LAST_P() antlr.TerminalNode + ABSOLUTE_P() antlr.TerminalNode + Signediconst() ISignediconstContext + RELATIVE_P() antlr.TerminalNode + ALL() antlr.TerminalNode + FORWARD() antlr.TerminalNode + BACKWARD() antlr.TerminalNode + + // IsFetch_argsContext differentiates from other interfaces. + IsFetch_argsContext() +} + +type Fetch_argsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFetch_argsContext() *Fetch_argsContext { + var p = new(Fetch_argsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fetch_args + return p +} + +func InitEmptyFetch_argsContext(p *Fetch_argsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fetch_args +} + +func (*Fetch_argsContext) IsFetch_argsContext() {} + +func NewFetch_argsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Fetch_argsContext { + var p = new(Fetch_argsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_fetch_args + + return p +} + +func (s *Fetch_argsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Fetch_argsContext) Cursor_name() ICursor_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_nameContext) +} + +func (s *Fetch_argsContext) From_in() IFrom_inContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_inContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_inContext) +} + +func (s *Fetch_argsContext) NEXT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNEXT, 0) +} + +func (s *Fetch_argsContext) Opt_from_in() IOpt_from_inContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_from_inContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_from_inContext) +} + +func (s *Fetch_argsContext) PRIOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIOR, 0) +} + +func (s *Fetch_argsContext) FIRST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFIRST_P, 0) +} + +func (s *Fetch_argsContext) LAST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLAST_P, 0) +} + +func (s *Fetch_argsContext) ABSOLUTE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserABSOLUTE_P, 0) +} + +func (s *Fetch_argsContext) Signediconst() ISignediconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISignediconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISignediconstContext) +} + +func (s *Fetch_argsContext) RELATIVE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRELATIVE_P, 0) +} + +func (s *Fetch_argsContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Fetch_argsContext) FORWARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORWARD, 0) +} + +func (s *Fetch_argsContext) BACKWARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBACKWARD, 0) +} + +func (s *Fetch_argsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Fetch_argsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Fetch_argsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFetch_args(s) + } +} + +func (s *Fetch_argsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFetch_args(s) + } +} + +func (s *Fetch_argsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFetch_args(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Fetch_args() (localctx IFetch_argsContext) { + localctx = NewFetch_argsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 550, PostgreSQLParserRULE_fetch_args) + var _la int + + p.SetState(5315) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 417, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5230) + p.Cursor_name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5231) + p.From_in() + } + { + p.SetState(5232) + p.Cursor_name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5234) + p.Match(PostgreSQLParserNEXT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5236) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5235) + p.Opt_from_in() + } + + } + { + p.SetState(5238) + p.Cursor_name() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5239) + p.Match(PostgreSQLParserPRIOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5241) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5240) + p.Opt_from_in() + } + + } + { + p.SetState(5243) + p.Cursor_name() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(5244) + p.Match(PostgreSQLParserFIRST_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5246) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5245) + p.Opt_from_in() + } + + } + { + p.SetState(5248) + p.Cursor_name() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(5249) + p.Match(PostgreSQLParserLAST_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5251) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5250) + p.Opt_from_in() + } + + } + { + p.SetState(5253) + p.Cursor_name() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(5254) + p.Match(PostgreSQLParserABSOLUTE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5255) + p.Signediconst() + } + p.SetState(5257) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5256) + p.Opt_from_in() + } + + } + { + p.SetState(5259) + p.Cursor_name() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(5261) + p.Match(PostgreSQLParserRELATIVE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5262) + p.Signediconst() + } + p.SetState(5264) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5263) + p.Opt_from_in() + } + + } + { + p.SetState(5266) + p.Cursor_name() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(5268) + p.Signediconst() + } + p.SetState(5270) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5269) + p.Opt_from_in() + } + + } + { + p.SetState(5272) + p.Cursor_name() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(5274) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5276) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5275) + p.Opt_from_in() + } + + } + { + p.SetState(5278) + p.Cursor_name() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(5279) + p.Match(PostgreSQLParserFORWARD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5281) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5280) + p.Opt_from_in() + } + + } + { + p.SetState(5283) + p.Cursor_name() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(5284) + p.Match(PostgreSQLParserFORWARD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5285) + p.Signediconst() + } + p.SetState(5287) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5286) + p.Opt_from_in() + } + + } + { + p.SetState(5289) + p.Cursor_name() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(5291) + p.Match(PostgreSQLParserFORWARD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5292) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5294) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5293) + p.Opt_from_in() + } + + } + { + p.SetState(5296) + p.Cursor_name() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(5297) + p.Match(PostgreSQLParserBACKWARD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5299) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5298) + p.Opt_from_in() + } + + } + { + p.SetState(5301) + p.Cursor_name() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(5302) + p.Match(PostgreSQLParserBACKWARD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5303) + p.Signediconst() + } + p.SetState(5305) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5304) + p.Opt_from_in() + } + + } + { + p.SetState(5307) + p.Cursor_name() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(5309) + p.Match(PostgreSQLParserBACKWARD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5310) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5312) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(5311) + p.Opt_from_in() + } + + } + { + p.SetState(5314) + p.Cursor_name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFrom_inContext is an interface to support dynamic dispatch. +type IFrom_inContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FROM() antlr.TerminalNode + IN_P() antlr.TerminalNode + + // IsFrom_inContext differentiates from other interfaces. + IsFrom_inContext() +} + +type From_inContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFrom_inContext() *From_inContext { + var p = new(From_inContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_from_in + return p +} + +func InitEmptyFrom_inContext(p *From_inContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_from_in +} + +func (*From_inContext) IsFrom_inContext() {} + +func NewFrom_inContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *From_inContext { + var p = new(From_inContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_from_in + + return p +} + +func (s *From_inContext) GetParser() antlr.Parser { return s.parser } + +func (s *From_inContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *From_inContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *From_inContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *From_inContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *From_inContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFrom_in(s) + } +} + +func (s *From_inContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFrom_in(s) + } +} + +func (s *From_inContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFrom_in(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) From_in() (localctx IFrom_inContext) { + localctx = NewFrom_inContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 552, PostgreSQLParserRULE_from_in) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5317) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_from_inContext is an interface to support dynamic dispatch. +type IOpt_from_inContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + From_in() IFrom_inContext + + // IsOpt_from_inContext differentiates from other interfaces. + IsOpt_from_inContext() +} + +type Opt_from_inContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_from_inContext() *Opt_from_inContext { + var p = new(Opt_from_inContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_from_in + return p +} + +func InitEmptyOpt_from_inContext(p *Opt_from_inContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_from_in +} + +func (*Opt_from_inContext) IsOpt_from_inContext() {} + +func NewOpt_from_inContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_from_inContext { + var p = new(Opt_from_inContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_from_in + + return p +} + +func (s *Opt_from_inContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_from_inContext) From_in() IFrom_inContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_inContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_inContext) +} + +func (s *Opt_from_inContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_from_inContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_from_inContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_from_in(s) + } +} + +func (s *Opt_from_inContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_from_in(s) + } +} + +func (s *Opt_from_inContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_from_in(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_from_in() (localctx IOpt_from_inContext) { + localctx = NewOpt_from_inContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 554, PostgreSQLParserRULE_opt_from_in) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5319) + p.From_in() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGrantstmtContext is an interface to support dynamic dispatch. +type IGrantstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GRANT() antlr.TerminalNode + Privileges() IPrivilegesContext + ON() antlr.TerminalNode + Privilege_target() IPrivilege_targetContext + TO() antlr.TerminalNode + Grantee_list() IGrantee_listContext + Opt_grant_grant_option() IOpt_grant_grant_optionContext + + // IsGrantstmtContext differentiates from other interfaces. + IsGrantstmtContext() +} + +type GrantstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGrantstmtContext() *GrantstmtContext { + var p = new(GrantstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grantstmt + return p +} + +func InitEmptyGrantstmtContext(p *GrantstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grantstmt +} + +func (*GrantstmtContext) IsGrantstmtContext() {} + +func NewGrantstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GrantstmtContext { + var p = new(GrantstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_grantstmt + + return p +} + +func (s *GrantstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *GrantstmtContext) GRANT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGRANT, 0) +} + +func (s *GrantstmtContext) Privileges() IPrivilegesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilegesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrivilegesContext) +} + +func (s *GrantstmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *GrantstmtContext) Privilege_target() IPrivilege_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilege_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrivilege_targetContext) +} + +func (s *GrantstmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *GrantstmtContext) Grantee_list() IGrantee_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrantee_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrantee_listContext) +} + +func (s *GrantstmtContext) Opt_grant_grant_option() IOpt_grant_grant_optionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_grant_grant_optionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_grant_grant_optionContext) +} + +func (s *GrantstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *GrantstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *GrantstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGrantstmt(s) + } +} + +func (s *GrantstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGrantstmt(s) + } +} + +func (s *GrantstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGrantstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Grantstmt() (localctx IGrantstmtContext) { + localctx = NewGrantstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 556, PostgreSQLParserRULE_grantstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5321) + p.Match(PostgreSQLParserGRANT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5322) + p.Privileges() + } + { + p.SetState(5323) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5324) + p.Privilege_target() + } + { + p.SetState(5325) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5326) + p.Grantee_list() + } + p.SetState(5328) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 418, p.GetParserRuleContext()) == 1 { + { + p.SetState(5327) + p.Opt_grant_grant_option() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRevokestmtContext is an interface to support dynamic dispatch. +type IRevokestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + REVOKE() antlr.TerminalNode + Privileges() IPrivilegesContext + ON() antlr.TerminalNode + Privilege_target() IPrivilege_targetContext + FROM() antlr.TerminalNode + Grantee_list() IGrantee_listContext + Opt_drop_behavior() IOpt_drop_behaviorContext + GRANT() antlr.TerminalNode + OPTION() antlr.TerminalNode + FOR() antlr.TerminalNode + + // IsRevokestmtContext differentiates from other interfaces. + IsRevokestmtContext() +} + +type RevokestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRevokestmtContext() *RevokestmtContext { + var p = new(RevokestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_revokestmt + return p +} + +func InitEmptyRevokestmtContext(p *RevokestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_revokestmt +} + +func (*RevokestmtContext) IsRevokestmtContext() {} + +func NewRevokestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RevokestmtContext { + var p = new(RevokestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_revokestmt + + return p +} + +func (s *RevokestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RevokestmtContext) REVOKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREVOKE, 0) +} + +func (s *RevokestmtContext) Privileges() IPrivilegesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilegesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrivilegesContext) +} + +func (s *RevokestmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *RevokestmtContext) Privilege_target() IPrivilege_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilege_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrivilege_targetContext) +} + +func (s *RevokestmtContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *RevokestmtContext) Grantee_list() IGrantee_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrantee_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrantee_listContext) +} + +func (s *RevokestmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *RevokestmtContext) GRANT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGRANT, 0) +} + +func (s *RevokestmtContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *RevokestmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *RevokestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RevokestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RevokestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRevokestmt(s) + } +} + +func (s *RevokestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRevokestmt(s) + } +} + +func (s *RevokestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRevokestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Revokestmt() (localctx IRevokestmtContext) { + localctx = NewRevokestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 558, PostgreSQLParserRULE_revokestmt) + var _la int + + p.SetState(5351) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 421, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5330) + p.Match(PostgreSQLParserREVOKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5331) + p.Privileges() + } + { + p.SetState(5332) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5333) + p.Privilege_target() + } + { + p.SetState(5334) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5335) + p.Grantee_list() + } + p.SetState(5337) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5336) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5339) + p.Match(PostgreSQLParserREVOKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5340) + p.Match(PostgreSQLParserGRANT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5341) + p.Match(PostgreSQLParserOPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5342) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5343) + p.Privileges() + } + { + p.SetState(5344) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5345) + p.Privilege_target() + } + { + p.SetState(5346) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5347) + p.Grantee_list() + } + p.SetState(5349) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5348) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPrivilegesContext is an interface to support dynamic dispatch. +type IPrivilegesContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Privilege_list() IPrivilege_listContext + ALL() antlr.TerminalNode + PRIVILEGES() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Columnlist() IColumnlistContext + CLOSE_PAREN() antlr.TerminalNode + + // IsPrivilegesContext differentiates from other interfaces. + IsPrivilegesContext() +} + +type PrivilegesContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPrivilegesContext() *PrivilegesContext { + var p = new(PrivilegesContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_privileges + return p +} + +func InitEmptyPrivilegesContext(p *PrivilegesContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_privileges +} + +func (*PrivilegesContext) IsPrivilegesContext() {} + +func NewPrivilegesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PrivilegesContext { + var p = new(PrivilegesContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_privileges + + return p +} + +func (s *PrivilegesContext) GetParser() antlr.Parser { return s.parser } + +func (s *PrivilegesContext) Privilege_list() IPrivilege_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilege_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrivilege_listContext) +} + +func (s *PrivilegesContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *PrivilegesContext) PRIVILEGES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIVILEGES, 0) +} + +func (s *PrivilegesContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *PrivilegesContext) Columnlist() IColumnlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnlistContext) +} + +func (s *PrivilegesContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *PrivilegesContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PrivilegesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PrivilegesContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPrivileges(s) + } +} + +func (s *PrivilegesContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPrivileges(s) + } +} + +func (s *PrivilegesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPrivileges(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Privileges() (localctx IPrivilegesContext) { + localctx = NewPrivilegesContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 560, PostgreSQLParserRULE_privileges) + p.SetState(5368) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 422, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5353) + p.Privilege_list() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5354) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5355) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5356) + p.Match(PostgreSQLParserPRIVILEGES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5357) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5358) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5359) + p.Columnlist() + } + { + p.SetState(5360) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(5362) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5363) + p.Match(PostgreSQLParserPRIVILEGES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5364) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5365) + p.Columnlist() + } + { + p.SetState(5366) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPrivilege_listContext is an interface to support dynamic dispatch. +type IPrivilege_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllPrivilege() []IPrivilegeContext + Privilege(i int) IPrivilegeContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsPrivilege_listContext differentiates from other interfaces. + IsPrivilege_listContext() +} + +type Privilege_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPrivilege_listContext() *Privilege_listContext { + var p = new(Privilege_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_privilege_list + return p +} + +func InitEmptyPrivilege_listContext(p *Privilege_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_privilege_list +} + +func (*Privilege_listContext) IsPrivilege_listContext() {} + +func NewPrivilege_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Privilege_listContext { + var p = new(Privilege_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_privilege_list + + return p +} + +func (s *Privilege_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Privilege_listContext) AllPrivilege() []IPrivilegeContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IPrivilegeContext); ok { + len++ + } + } + + tst := make([]IPrivilegeContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IPrivilegeContext); ok { + tst[i] = t.(IPrivilegeContext) + i++ + } + } + + return tst +} + +func (s *Privilege_listContext) Privilege(i int) IPrivilegeContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilegeContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IPrivilegeContext) +} + +func (s *Privilege_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Privilege_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Privilege_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Privilege_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Privilege_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPrivilege_list(s) + } +} + +func (s *Privilege_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPrivilege_list(s) + } +} + +func (s *Privilege_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPrivilege_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Privilege_list() (localctx IPrivilege_listContext) { + localctx = NewPrivilege_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 562, PostgreSQLParserRULE_privilege_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5370) + p.Privilege() + } + p.SetState(5375) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5371) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5372) + p.Privilege() + } + + p.SetState(5377) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPrivilegeContext is an interface to support dynamic dispatch. +type IPrivilegeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SELECT() antlr.TerminalNode + Opt_column_list() IOpt_column_listContext + REFERENCES() antlr.TerminalNode + CREATE() antlr.TerminalNode + ALTER() antlr.TerminalNode + SYSTEM_P() antlr.TerminalNode + Colid() IColidContext + + // IsPrivilegeContext differentiates from other interfaces. + IsPrivilegeContext() +} + +type PrivilegeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPrivilegeContext() *PrivilegeContext { + var p = new(PrivilegeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_privilege + return p +} + +func InitEmptyPrivilegeContext(p *PrivilegeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_privilege +} + +func (*PrivilegeContext) IsPrivilegeContext() {} + +func NewPrivilegeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PrivilegeContext { + var p = new(PrivilegeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_privilege + + return p +} + +func (s *PrivilegeContext) GetParser() antlr.Parser { return s.parser } + +func (s *PrivilegeContext) SELECT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSELECT, 0) +} + +func (s *PrivilegeContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *PrivilegeContext) REFERENCES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFERENCES, 0) +} + +func (s *PrivilegeContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *PrivilegeContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *PrivilegeContext) SYSTEM_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYSTEM_P, 0) +} + +func (s *PrivilegeContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *PrivilegeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PrivilegeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PrivilegeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPrivilege(s) + } +} + +func (s *PrivilegeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPrivilege(s) + } +} + +func (s *PrivilegeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPrivilege(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Privilege() (localctx IPrivilegeContext) { + localctx = NewPrivilegeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 564, PostgreSQLParserRULE_privilege) + var _la int + + p.SetState(5396) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 428, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5378) + p.Match(PostgreSQLParserSELECT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5380) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(5379) + p.Opt_column_list() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5382) + p.Match(PostgreSQLParserREFERENCES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5384) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(5383) + p.Opt_column_list() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5386) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5388) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(5387) + p.Opt_column_list() + } + + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5390) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5391) + p.Match(PostgreSQLParserSYSTEM_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(5392) + p.Colid() + } + p.SetState(5394) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(5393) + p.Opt_column_list() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPrivilege_targetContext is an interface to support dynamic dispatch. +type IPrivilege_targetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Qualified_name_list() IQualified_name_listContext + TABLE() antlr.TerminalNode + SEQUENCE() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + DATA_P() antlr.TerminalNode + WRAPPER() antlr.TerminalNode + Name_list() IName_listContext + SERVER() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + Function_with_argtypes_list() IFunction_with_argtypes_listContext + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + DATABASE() antlr.TerminalNode + DOMAIN_P() antlr.TerminalNode + Any_name_list() IAny_name_listContext + LANGUAGE() antlr.TerminalNode + LARGE_P() antlr.TerminalNode + OBJECT_P() antlr.TerminalNode + Numericonly_list() INumericonly_listContext + PARAMETER() antlr.TerminalNode + Parameter_name_list() IParameter_name_listContext + SCHEMA() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + ALL() antlr.TerminalNode + TABLES() antlr.TerminalNode + IN_P() antlr.TerminalNode + SEQUENCES() antlr.TerminalNode + FUNCTIONS() antlr.TerminalNode + PROCEDURES() antlr.TerminalNode + ROUTINES() antlr.TerminalNode + + // IsPrivilege_targetContext differentiates from other interfaces. + IsPrivilege_targetContext() +} + +type Privilege_targetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPrivilege_targetContext() *Privilege_targetContext { + var p = new(Privilege_targetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_privilege_target + return p +} + +func InitEmptyPrivilege_targetContext(p *Privilege_targetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_privilege_target +} + +func (*Privilege_targetContext) IsPrivilege_targetContext() {} + +func NewPrivilege_targetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Privilege_targetContext { + var p = new(Privilege_targetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_privilege_target + + return p +} + +func (s *Privilege_targetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Privilege_targetContext) Qualified_name_list() IQualified_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_name_listContext) +} + +func (s *Privilege_targetContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Privilege_targetContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *Privilege_targetContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *Privilege_targetContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *Privilege_targetContext) WRAPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRAPPER, 0) +} + +func (s *Privilege_targetContext) Name_list() IName_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IName_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IName_listContext) +} + +func (s *Privilege_targetContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *Privilege_targetContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *Privilege_targetContext) Function_with_argtypes_list() IFunction_with_argtypes_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypes_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypes_listContext) +} + +func (s *Privilege_targetContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *Privilege_targetContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *Privilege_targetContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *Privilege_targetContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *Privilege_targetContext) Any_name_list() IAny_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_name_listContext) +} + +func (s *Privilege_targetContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *Privilege_targetContext) LARGE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLARGE_P, 0) +} + +func (s *Privilege_targetContext) OBJECT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOBJECT_P, 0) +} + +func (s *Privilege_targetContext) Numericonly_list() INumericonly_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonly_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonly_listContext) +} + +func (s *Privilege_targetContext) PARAMETER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARAMETER, 0) +} + +func (s *Privilege_targetContext) Parameter_name_list() IParameter_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IParameter_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IParameter_name_listContext) +} + +func (s *Privilege_targetContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Privilege_targetContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *Privilege_targetContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *Privilege_targetContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Privilege_targetContext) TABLES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLES, 0) +} + +func (s *Privilege_targetContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Privilege_targetContext) SEQUENCES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCES, 0) +} + +func (s *Privilege_targetContext) FUNCTIONS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTIONS, 0) +} + +func (s *Privilege_targetContext) PROCEDURES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURES, 0) +} + +func (s *Privilege_targetContext) ROUTINES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINES, 0) +} + +func (s *Privilege_targetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Privilege_targetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Privilege_targetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPrivilege_target(s) + } +} + +func (s *Privilege_targetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPrivilege_target(s) + } +} + +func (s *Privilege_targetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPrivilege_target(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Privilege_target() (localctx IPrivilege_targetContext) { + localctx = NewPrivilege_targetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 566, PostgreSQLParserRULE_privilege_target) + p.SetState(5458) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 429, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5398) + p.Qualified_name_list() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5399) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5400) + p.Qualified_name_list() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5401) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5402) + p.Qualified_name_list() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5403) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5404) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5405) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5406) + p.Name_list() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(5407) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5408) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5409) + p.Name_list() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(5410) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5411) + p.Function_with_argtypes_list() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(5412) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5413) + p.Function_with_argtypes_list() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(5414) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5415) + p.Function_with_argtypes_list() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(5416) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5417) + p.Name_list() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(5418) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5419) + p.Any_name_list() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(5420) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5421) + p.Name_list() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(5422) + p.Match(PostgreSQLParserLARGE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5423) + p.Match(PostgreSQLParserOBJECT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5424) + p.Numericonly_list() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(5425) + p.Match(PostgreSQLParserPARAMETER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5426) + p.Parameter_name_list() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(5427) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5428) + p.Name_list() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(5429) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5430) + p.Name_list() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(5431) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5432) + p.Any_name_list() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(5433) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5434) + p.Match(PostgreSQLParserTABLES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5435) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5436) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5437) + p.Name_list() + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(5438) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5439) + p.Match(PostgreSQLParserSEQUENCES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5440) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5441) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5442) + p.Name_list() + } + + case 19: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(5443) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5444) + p.Match(PostgreSQLParserFUNCTIONS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5445) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5446) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5447) + p.Name_list() + } + + case 20: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(5448) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5449) + p.Match(PostgreSQLParserPROCEDURES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5450) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5451) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5452) + p.Name_list() + } + + case 21: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(5453) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5454) + p.Match(PostgreSQLParserROUTINES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5455) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5456) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5457) + p.Name_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IParameter_name_listContext is an interface to support dynamic dispatch. +type IParameter_name_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllParameter_name() []IParameter_nameContext + Parameter_name(i int) IParameter_nameContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsParameter_name_listContext differentiates from other interfaces. + IsParameter_name_listContext() +} + +type Parameter_name_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyParameter_name_listContext() *Parameter_name_listContext { + var p = new(Parameter_name_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_parameter_name_list + return p +} + +func InitEmptyParameter_name_listContext(p *Parameter_name_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_parameter_name_list +} + +func (*Parameter_name_listContext) IsParameter_name_listContext() {} + +func NewParameter_name_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Parameter_name_listContext { + var p = new(Parameter_name_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_parameter_name_list + + return p +} + +func (s *Parameter_name_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Parameter_name_listContext) AllParameter_name() []IParameter_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IParameter_nameContext); ok { + len++ + } + } + + tst := make([]IParameter_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IParameter_nameContext); ok { + tst[i] = t.(IParameter_nameContext) + i++ + } + } + + return tst +} + +func (s *Parameter_name_listContext) Parameter_name(i int) IParameter_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IParameter_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IParameter_nameContext) +} + +func (s *Parameter_name_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Parameter_name_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Parameter_name_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Parameter_name_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Parameter_name_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterParameter_name_list(s) + } +} + +func (s *Parameter_name_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitParameter_name_list(s) + } +} + +func (s *Parameter_name_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitParameter_name_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Parameter_name_list() (localctx IParameter_name_listContext) { + localctx = NewParameter_name_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 568, PostgreSQLParserRULE_parameter_name_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5460) + p.Parameter_name() + } + p.SetState(5465) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5461) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5462) + p.Parameter_name() + } + + p.SetState(5467) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IParameter_nameContext is an interface to support dynamic dispatch. +type IParameter_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllColid() []IColidContext + Colid(i int) IColidContext + DOT() antlr.TerminalNode + + // IsParameter_nameContext differentiates from other interfaces. + IsParameter_nameContext() +} + +type Parameter_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyParameter_nameContext() *Parameter_nameContext { + var p = new(Parameter_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_parameter_name + return p +} + +func InitEmptyParameter_nameContext(p *Parameter_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_parameter_name +} + +func (*Parameter_nameContext) IsParameter_nameContext() {} + +func NewParameter_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Parameter_nameContext { + var p = new(Parameter_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_parameter_name + + return p +} + +func (s *Parameter_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Parameter_nameContext) AllColid() []IColidContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IColidContext); ok { + len++ + } + } + + tst := make([]IColidContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IColidContext); ok { + tst[i] = t.(IColidContext) + i++ + } + } + + return tst +} + +func (s *Parameter_nameContext) Colid(i int) IColidContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Parameter_nameContext) DOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOT, 0) +} + +func (s *Parameter_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Parameter_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Parameter_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterParameter_name(s) + } +} + +func (s *Parameter_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitParameter_name(s) + } +} + +func (s *Parameter_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitParameter_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Parameter_name() (localctx IParameter_nameContext) { + localctx = NewParameter_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 570, PostgreSQLParserRULE_parameter_name) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5468) + p.Colid() + } + p.SetState(5471) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDOT { + { + p.SetState(5469) + p.Match(PostgreSQLParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5470) + p.Colid() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGrantee_listContext is an interface to support dynamic dispatch. +type IGrantee_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllGrantee() []IGranteeContext + Grantee(i int) IGranteeContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsGrantee_listContext differentiates from other interfaces. + IsGrantee_listContext() +} + +type Grantee_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGrantee_listContext() *Grantee_listContext { + var p = new(Grantee_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grantee_list + return p +} + +func InitEmptyGrantee_listContext(p *Grantee_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grantee_list +} + +func (*Grantee_listContext) IsGrantee_listContext() {} + +func NewGrantee_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Grantee_listContext { + var p = new(Grantee_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_grantee_list + + return p +} + +func (s *Grantee_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Grantee_listContext) AllGrantee() []IGranteeContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IGranteeContext); ok { + len++ + } + } + + tst := make([]IGranteeContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IGranteeContext); ok { + tst[i] = t.(IGranteeContext) + i++ + } + } + + return tst +} + +func (s *Grantee_listContext) Grantee(i int) IGranteeContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGranteeContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IGranteeContext) +} + +func (s *Grantee_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Grantee_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Grantee_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Grantee_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Grantee_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGrantee_list(s) + } +} + +func (s *Grantee_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGrantee_list(s) + } +} + +func (s *Grantee_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGrantee_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Grantee_list() (localctx IGrantee_listContext) { + localctx = NewGrantee_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 572, PostgreSQLParserRULE_grantee_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5473) + p.Grantee() + } + p.SetState(5478) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5474) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5475) + p.Grantee() + } + + p.SetState(5480) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGranteeContext is an interface to support dynamic dispatch. +type IGranteeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Rolespec() IRolespecContext + GROUP_P() antlr.TerminalNode + + // IsGranteeContext differentiates from other interfaces. + IsGranteeContext() +} + +type GranteeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGranteeContext() *GranteeContext { + var p = new(GranteeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grantee + return p +} + +func InitEmptyGranteeContext(p *GranteeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grantee +} + +func (*GranteeContext) IsGranteeContext() {} + +func NewGranteeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GranteeContext { + var p = new(GranteeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_grantee + + return p +} + +func (s *GranteeContext) GetParser() antlr.Parser { return s.parser } + +func (s *GranteeContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *GranteeContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *GranteeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *GranteeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *GranteeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGrantee(s) + } +} + +func (s *GranteeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGrantee(s) + } +} + +func (s *GranteeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGrantee(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Grantee() (localctx IGranteeContext) { + localctx = NewGranteeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 574, PostgreSQLParserRULE_grantee) + p.SetState(5484) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserSESSION_USER, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5481) + p.Rolespec() + } + + case PostgreSQLParserGROUP_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5482) + p.Match(PostgreSQLParserGROUP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5483) + p.Rolespec() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_grant_grant_optionContext is an interface to support dynamic dispatch. +type IOpt_grant_grant_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + GRANT() antlr.TerminalNode + OPTION() antlr.TerminalNode + + // IsOpt_grant_grant_optionContext differentiates from other interfaces. + IsOpt_grant_grant_optionContext() +} + +type Opt_grant_grant_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_grant_grant_optionContext() *Opt_grant_grant_optionContext { + var p = new(Opt_grant_grant_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_grant_grant_option + return p +} + +func InitEmptyOpt_grant_grant_optionContext(p *Opt_grant_grant_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_grant_grant_option +} + +func (*Opt_grant_grant_optionContext) IsOpt_grant_grant_optionContext() {} + +func NewOpt_grant_grant_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_grant_grant_optionContext { + var p = new(Opt_grant_grant_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_grant_grant_option + + return p +} + +func (s *Opt_grant_grant_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_grant_grant_optionContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_grant_grant_optionContext) GRANT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGRANT, 0) +} + +func (s *Opt_grant_grant_optionContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *Opt_grant_grant_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_grant_grant_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_grant_grant_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_grant_grant_option(s) + } +} + +func (s *Opt_grant_grant_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_grant_grant_option(s) + } +} + +func (s *Opt_grant_grant_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_grant_grant_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_grant_grant_option() (localctx IOpt_grant_grant_optionContext) { + localctx = NewOpt_grant_grant_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 576, PostgreSQLParserRULE_opt_grant_grant_option) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5486) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5487) + p.Match(PostgreSQLParserGRANT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5488) + p.Match(PostgreSQLParserOPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGrantrolestmtContext is an interface to support dynamic dispatch. +type IGrantrolestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GRANT() antlr.TerminalNode + Privilege_list() IPrivilege_listContext + TO() antlr.TerminalNode + Role_list() IRole_listContext + Opt_grant_admin_option() IOpt_grant_admin_optionContext + Opt_granted_by() IOpt_granted_byContext + + // IsGrantrolestmtContext differentiates from other interfaces. + IsGrantrolestmtContext() +} + +type GrantrolestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGrantrolestmtContext() *GrantrolestmtContext { + var p = new(GrantrolestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grantrolestmt + return p +} + +func InitEmptyGrantrolestmtContext(p *GrantrolestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grantrolestmt +} + +func (*GrantrolestmtContext) IsGrantrolestmtContext() {} + +func NewGrantrolestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GrantrolestmtContext { + var p = new(GrantrolestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_grantrolestmt + + return p +} + +func (s *GrantrolestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *GrantrolestmtContext) GRANT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGRANT, 0) +} + +func (s *GrantrolestmtContext) Privilege_list() IPrivilege_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilege_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrivilege_listContext) +} + +func (s *GrantrolestmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *GrantrolestmtContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *GrantrolestmtContext) Opt_grant_admin_option() IOpt_grant_admin_optionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_grant_admin_optionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_grant_admin_optionContext) +} + +func (s *GrantrolestmtContext) Opt_granted_by() IOpt_granted_byContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_granted_byContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_granted_byContext) +} + +func (s *GrantrolestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *GrantrolestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *GrantrolestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGrantrolestmt(s) + } +} + +func (s *GrantrolestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGrantrolestmt(s) + } +} + +func (s *GrantrolestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGrantrolestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Grantrolestmt() (localctx IGrantrolestmtContext) { + localctx = NewGrantrolestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 578, PostgreSQLParserRULE_grantrolestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5490) + p.Match(PostgreSQLParserGRANT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5491) + p.Privilege_list() + } + { + p.SetState(5492) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5493) + p.Role_list() + } + p.SetState(5495) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 434, p.GetParserRuleContext()) == 1 { + { + p.SetState(5494) + p.Opt_grant_admin_option() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(5498) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGRANTED { + { + p.SetState(5497) + p.Opt_granted_by() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRevokerolestmtContext is an interface to support dynamic dispatch. +type IRevokerolestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + REVOKE() antlr.TerminalNode + Privilege_list() IPrivilege_listContext + FROM() antlr.TerminalNode + Role_list() IRole_listContext + Opt_granted_by() IOpt_granted_byContext + Opt_drop_behavior() IOpt_drop_behaviorContext + ADMIN() antlr.TerminalNode + OPTION() antlr.TerminalNode + FOR() antlr.TerminalNode + + // IsRevokerolestmtContext differentiates from other interfaces. + IsRevokerolestmtContext() +} + +type RevokerolestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRevokerolestmtContext() *RevokerolestmtContext { + var p = new(RevokerolestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_revokerolestmt + return p +} + +func InitEmptyRevokerolestmtContext(p *RevokerolestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_revokerolestmt +} + +func (*RevokerolestmtContext) IsRevokerolestmtContext() {} + +func NewRevokerolestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RevokerolestmtContext { + var p = new(RevokerolestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_revokerolestmt + + return p +} + +func (s *RevokerolestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RevokerolestmtContext) REVOKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREVOKE, 0) +} + +func (s *RevokerolestmtContext) Privilege_list() IPrivilege_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilege_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrivilege_listContext) +} + +func (s *RevokerolestmtContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *RevokerolestmtContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *RevokerolestmtContext) Opt_granted_by() IOpt_granted_byContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_granted_byContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_granted_byContext) +} + +func (s *RevokerolestmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *RevokerolestmtContext) ADMIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADMIN, 0) +} + +func (s *RevokerolestmtContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *RevokerolestmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *RevokerolestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RevokerolestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RevokerolestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRevokerolestmt(s) + } +} + +func (s *RevokerolestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRevokerolestmt(s) + } +} + +func (s *RevokerolestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRevokerolestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Revokerolestmt() (localctx IRevokerolestmtContext) { + localctx = NewRevokerolestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 580, PostgreSQLParserRULE_revokerolestmt) + var _la int + + p.SetState(5523) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 440, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5500) + p.Match(PostgreSQLParserREVOKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5501) + p.Privilege_list() + } + { + p.SetState(5502) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5503) + p.Role_list() + } + p.SetState(5505) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGRANTED { + { + p.SetState(5504) + p.Opt_granted_by() + } + + } + p.SetState(5508) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5507) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5510) + p.Match(PostgreSQLParserREVOKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5511) + p.Match(PostgreSQLParserADMIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5512) + p.Match(PostgreSQLParserOPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5513) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5514) + p.Privilege_list() + } + { + p.SetState(5515) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5516) + p.Role_list() + } + p.SetState(5518) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGRANTED { + { + p.SetState(5517) + p.Opt_granted_by() + } + + } + p.SetState(5521) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5520) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_grant_admin_optionContext is an interface to support dynamic dispatch. +type IOpt_grant_admin_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + ADMIN() antlr.TerminalNode + OPTION() antlr.TerminalNode + + // IsOpt_grant_admin_optionContext differentiates from other interfaces. + IsOpt_grant_admin_optionContext() +} + +type Opt_grant_admin_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_grant_admin_optionContext() *Opt_grant_admin_optionContext { + var p = new(Opt_grant_admin_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_grant_admin_option + return p +} + +func InitEmptyOpt_grant_admin_optionContext(p *Opt_grant_admin_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_grant_admin_option +} + +func (*Opt_grant_admin_optionContext) IsOpt_grant_admin_optionContext() {} + +func NewOpt_grant_admin_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_grant_admin_optionContext { + var p = new(Opt_grant_admin_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_grant_admin_option + + return p +} + +func (s *Opt_grant_admin_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_grant_admin_optionContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_grant_admin_optionContext) ADMIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADMIN, 0) +} + +func (s *Opt_grant_admin_optionContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *Opt_grant_admin_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_grant_admin_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_grant_admin_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_grant_admin_option(s) + } +} + +func (s *Opt_grant_admin_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_grant_admin_option(s) + } +} + +func (s *Opt_grant_admin_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_grant_admin_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_grant_admin_option() (localctx IOpt_grant_admin_optionContext) { + localctx = NewOpt_grant_admin_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 582, PostgreSQLParserRULE_opt_grant_admin_option) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5525) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5526) + p.Match(PostgreSQLParserADMIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5527) + p.Match(PostgreSQLParserOPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_granted_byContext is an interface to support dynamic dispatch. +type IOpt_granted_byContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GRANTED() antlr.TerminalNode + BY() antlr.TerminalNode + Rolespec() IRolespecContext + + // IsOpt_granted_byContext differentiates from other interfaces. + IsOpt_granted_byContext() +} + +type Opt_granted_byContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_granted_byContext() *Opt_granted_byContext { + var p = new(Opt_granted_byContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_granted_by + return p +} + +func InitEmptyOpt_granted_byContext(p *Opt_granted_byContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_granted_by +} + +func (*Opt_granted_byContext) IsOpt_granted_byContext() {} + +func NewOpt_granted_byContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_granted_byContext { + var p = new(Opt_granted_byContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_granted_by + + return p +} + +func (s *Opt_granted_byContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_granted_byContext) GRANTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGRANTED, 0) +} + +func (s *Opt_granted_byContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Opt_granted_byContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *Opt_granted_byContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_granted_byContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_granted_byContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_granted_by(s) + } +} + +func (s *Opt_granted_byContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_granted_by(s) + } +} + +func (s *Opt_granted_byContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_granted_by(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_granted_by() (localctx IOpt_granted_byContext) { + localctx = NewOpt_granted_byContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 584, PostgreSQLParserRULE_opt_granted_by) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5529) + p.Match(PostgreSQLParserGRANTED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5530) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5531) + p.Rolespec() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterdefaultprivilegesstmtContext is an interface to support dynamic dispatch. +type IAlterdefaultprivilegesstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + PRIVILEGES() antlr.TerminalNode + Defacloptionlist() IDefacloptionlistContext + Defaclaction() IDefaclactionContext + + // IsAlterdefaultprivilegesstmtContext differentiates from other interfaces. + IsAlterdefaultprivilegesstmtContext() +} + +type AlterdefaultprivilegesstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterdefaultprivilegesstmtContext() *AlterdefaultprivilegesstmtContext { + var p = new(AlterdefaultprivilegesstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterdefaultprivilegesstmt + return p +} + +func InitEmptyAlterdefaultprivilegesstmtContext(p *AlterdefaultprivilegesstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterdefaultprivilegesstmt +} + +func (*AlterdefaultprivilegesstmtContext) IsAlterdefaultprivilegesstmtContext() {} + +func NewAlterdefaultprivilegesstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterdefaultprivilegesstmtContext { + var p = new(AlterdefaultprivilegesstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterdefaultprivilegesstmt + + return p +} + +func (s *AlterdefaultprivilegesstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterdefaultprivilegesstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterdefaultprivilegesstmtContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *AlterdefaultprivilegesstmtContext) PRIVILEGES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIVILEGES, 0) +} + +func (s *AlterdefaultprivilegesstmtContext) Defacloptionlist() IDefacloptionlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefacloptionlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefacloptionlistContext) +} + +func (s *AlterdefaultprivilegesstmtContext) Defaclaction() IDefaclactionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefaclactionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefaclactionContext) +} + +func (s *AlterdefaultprivilegesstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterdefaultprivilegesstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterdefaultprivilegesstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterdefaultprivilegesstmt(s) + } +} + +func (s *AlterdefaultprivilegesstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterdefaultprivilegesstmt(s) + } +} + +func (s *AlterdefaultprivilegesstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterdefaultprivilegesstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterdefaultprivilegesstmt() (localctx IAlterdefaultprivilegesstmtContext) { + localctx = NewAlterdefaultprivilegesstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 586, PostgreSQLParserRULE_alterdefaultprivilegesstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5533) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5534) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5535) + p.Match(PostgreSQLParserPRIVILEGES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5536) + p.Defacloptionlist() + } + { + p.SetState(5537) + p.Defaclaction() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDefacloptionlistContext is an interface to support dynamic dispatch. +type IDefacloptionlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllDefacloption() []IDefacloptionContext + Defacloption(i int) IDefacloptionContext + + // IsDefacloptionlistContext differentiates from other interfaces. + IsDefacloptionlistContext() +} + +type DefacloptionlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDefacloptionlistContext() *DefacloptionlistContext { + var p = new(DefacloptionlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_defacloptionlist + return p +} + +func InitEmptyDefacloptionlistContext(p *DefacloptionlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_defacloptionlist +} + +func (*DefacloptionlistContext) IsDefacloptionlistContext() {} + +func NewDefacloptionlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DefacloptionlistContext { + var p = new(DefacloptionlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_defacloptionlist + + return p +} + +func (s *DefacloptionlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *DefacloptionlistContext) AllDefacloption() []IDefacloptionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IDefacloptionContext); ok { + len++ + } + } + + tst := make([]IDefacloptionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IDefacloptionContext); ok { + tst[i] = t.(IDefacloptionContext) + i++ + } + } + + return tst +} + +func (s *DefacloptionlistContext) Defacloption(i int) IDefacloptionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefacloptionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IDefacloptionContext) +} + +func (s *DefacloptionlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DefacloptionlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DefacloptionlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDefacloptionlist(s) + } +} + +func (s *DefacloptionlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDefacloptionlist(s) + } +} + +func (s *DefacloptionlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDefacloptionlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Defacloptionlist() (localctx IDefacloptionlistContext) { + localctx = NewDefacloptionlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 588, PostgreSQLParserRULE_defacloptionlist) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(5542) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserFOR || _la == PostgreSQLParserIN_P { + { + p.SetState(5539) + p.Defacloption() + } + + p.SetState(5544) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDefacloptionContext is an interface to support dynamic dispatch. +type IDefacloptionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IN_P() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + Name_list() IName_listContext + FOR() antlr.TerminalNode + ROLE() antlr.TerminalNode + Role_list() IRole_listContext + USER() antlr.TerminalNode + + // IsDefacloptionContext differentiates from other interfaces. + IsDefacloptionContext() +} + +type DefacloptionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDefacloptionContext() *DefacloptionContext { + var p = new(DefacloptionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_defacloption + return p +} + +func InitEmptyDefacloptionContext(p *DefacloptionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_defacloption +} + +func (*DefacloptionContext) IsDefacloptionContext() {} + +func NewDefacloptionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DefacloptionContext { + var p = new(DefacloptionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_defacloption + + return p +} + +func (s *DefacloptionContext) GetParser() antlr.Parser { return s.parser } + +func (s *DefacloptionContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *DefacloptionContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *DefacloptionContext) Name_list() IName_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IName_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IName_listContext) +} + +func (s *DefacloptionContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *DefacloptionContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *DefacloptionContext) Role_list() IRole_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRole_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRole_listContext) +} + +func (s *DefacloptionContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *DefacloptionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DefacloptionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DefacloptionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDefacloption(s) + } +} + +func (s *DefacloptionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDefacloption(s) + } +} + +func (s *DefacloptionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDefacloption(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Defacloption() (localctx IDefacloptionContext) { + localctx = NewDefacloptionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 590, PostgreSQLParserRULE_defacloption) + p.SetState(5554) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 442, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5545) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5546) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5547) + p.Name_list() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5548) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5549) + p.Match(PostgreSQLParserROLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5550) + p.Role_list() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5551) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5552) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5553) + p.Role_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDefaclactionContext is an interface to support dynamic dispatch. +type IDefaclactionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GRANT() antlr.TerminalNode + Privileges() IPrivilegesContext + ON() antlr.TerminalNode + Defacl_privilege_target() IDefacl_privilege_targetContext + TO() antlr.TerminalNode + Grantee_list() IGrantee_listContext + Opt_grant_grant_option() IOpt_grant_grant_optionContext + REVOKE() antlr.TerminalNode + FROM() antlr.TerminalNode + Opt_drop_behavior() IOpt_drop_behaviorContext + OPTION() antlr.TerminalNode + FOR() antlr.TerminalNode + + // IsDefaclactionContext differentiates from other interfaces. + IsDefaclactionContext() +} + +type DefaclactionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDefaclactionContext() *DefaclactionContext { + var p = new(DefaclactionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_defaclaction + return p +} + +func InitEmptyDefaclactionContext(p *DefaclactionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_defaclaction +} + +func (*DefaclactionContext) IsDefaclactionContext() {} + +func NewDefaclactionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DefaclactionContext { + var p = new(DefaclactionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_defaclaction + + return p +} + +func (s *DefaclactionContext) GetParser() antlr.Parser { return s.parser } + +func (s *DefaclactionContext) GRANT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGRANT, 0) +} + +func (s *DefaclactionContext) Privileges() IPrivilegesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrivilegesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrivilegesContext) +} + +func (s *DefaclactionContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *DefaclactionContext) Defacl_privilege_target() IDefacl_privilege_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefacl_privilege_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefacl_privilege_targetContext) +} + +func (s *DefaclactionContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *DefaclactionContext) Grantee_list() IGrantee_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrantee_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrantee_listContext) +} + +func (s *DefaclactionContext) Opt_grant_grant_option() IOpt_grant_grant_optionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_grant_grant_optionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_grant_grant_optionContext) +} + +func (s *DefaclactionContext) REVOKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREVOKE, 0) +} + +func (s *DefaclactionContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *DefaclactionContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *DefaclactionContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *DefaclactionContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *DefaclactionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DefaclactionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DefaclactionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDefaclaction(s) + } +} + +func (s *DefaclactionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDefaclaction(s) + } +} + +func (s *DefaclactionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDefaclaction(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Defaclaction() (localctx IDefaclactionContext) { + localctx = NewDefaclactionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 592, PostgreSQLParserRULE_defaclaction) + var _la int + + p.SetState(5586) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 446, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5556) + p.Match(PostgreSQLParserGRANT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5557) + p.Privileges() + } + { + p.SetState(5558) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5559) + p.Defacl_privilege_target() + } + { + p.SetState(5560) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5561) + p.Grantee_list() + } + p.SetState(5563) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 443, p.GetParserRuleContext()) == 1 { + { + p.SetState(5562) + p.Opt_grant_grant_option() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5565) + p.Match(PostgreSQLParserREVOKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5566) + p.Privileges() + } + { + p.SetState(5567) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5568) + p.Defacl_privilege_target() + } + { + p.SetState(5569) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5570) + p.Grantee_list() + } + p.SetState(5572) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5571) + p.Opt_drop_behavior() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5574) + p.Match(PostgreSQLParserREVOKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5575) + p.Match(PostgreSQLParserGRANT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5576) + p.Match(PostgreSQLParserOPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5577) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5578) + p.Privileges() + } + { + p.SetState(5579) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5580) + p.Defacl_privilege_target() + } + { + p.SetState(5581) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5582) + p.Grantee_list() + } + p.SetState(5584) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5583) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDefacl_privilege_targetContext is an interface to support dynamic dispatch. +type IDefacl_privilege_targetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TABLES() antlr.TerminalNode + FUNCTIONS() antlr.TerminalNode + ROUTINES() antlr.TerminalNode + SEQUENCES() antlr.TerminalNode + TYPES_P() antlr.TerminalNode + SCHEMAS() antlr.TerminalNode + + // IsDefacl_privilege_targetContext differentiates from other interfaces. + IsDefacl_privilege_targetContext() +} + +type Defacl_privilege_targetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDefacl_privilege_targetContext() *Defacl_privilege_targetContext { + var p = new(Defacl_privilege_targetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_defacl_privilege_target + return p +} + +func InitEmptyDefacl_privilege_targetContext(p *Defacl_privilege_targetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_defacl_privilege_target +} + +func (*Defacl_privilege_targetContext) IsDefacl_privilege_targetContext() {} + +func NewDefacl_privilege_targetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Defacl_privilege_targetContext { + var p = new(Defacl_privilege_targetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_defacl_privilege_target + + return p +} + +func (s *Defacl_privilege_targetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Defacl_privilege_targetContext) TABLES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLES, 0) +} + +func (s *Defacl_privilege_targetContext) FUNCTIONS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTIONS, 0) +} + +func (s *Defacl_privilege_targetContext) ROUTINES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINES, 0) +} + +func (s *Defacl_privilege_targetContext) SEQUENCES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCES, 0) +} + +func (s *Defacl_privilege_targetContext) TYPES_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPES_P, 0) +} + +func (s *Defacl_privilege_targetContext) SCHEMAS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMAS, 0) +} + +func (s *Defacl_privilege_targetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Defacl_privilege_targetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Defacl_privilege_targetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDefacl_privilege_target(s) + } +} + +func (s *Defacl_privilege_targetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDefacl_privilege_target(s) + } +} + +func (s *Defacl_privilege_targetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDefacl_privilege_target(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Defacl_privilege_target() (localctx IDefacl_privilege_targetContext) { + localctx = NewDefacl_privilege_targetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 594, PostgreSQLParserRULE_defacl_privilege_target) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5588) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFUNCTIONS || ((int64((_la-322)) & ^0x3f) == 0 && ((int64(1)<<(_la-322))&4297064449) != 0) || _la == PostgreSQLParserROUTINES || _la == PostgreSQLParserSCHEMAS) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIndexstmtContext is an interface to support dynamic dispatch. +type IIndexstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + INDEX() antlr.TerminalNode + ON() antlr.TerminalNode + Relation_expr() IRelation_exprContext + OPEN_PAREN() antlr.TerminalNode + Index_params() IIndex_paramsContext + CLOSE_PAREN() antlr.TerminalNode + Opt_unique() IOpt_uniqueContext + Opt_concurrently() IOpt_concurrentlyContext + Name() INameContext + Access_method_clause() IAccess_method_clauseContext + Opt_include() IOpt_includeContext + Opt_unique_null_treatment() IOpt_unique_null_treatmentContext + Opt_reloptions() IOpt_reloptionsContext + Opttablespace() IOpttablespaceContext + Where_clause() IWhere_clauseContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsIndexstmtContext differentiates from other interfaces. + IsIndexstmtContext() +} + +type IndexstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIndexstmtContext() *IndexstmtContext { + var p = new(IndexstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_indexstmt + return p +} + +func InitEmptyIndexstmtContext(p *IndexstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_indexstmt +} + +func (*IndexstmtContext) IsIndexstmtContext() {} + +func NewIndexstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IndexstmtContext { + var p = new(IndexstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_indexstmt + + return p +} + +func (s *IndexstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *IndexstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *IndexstmtContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *IndexstmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *IndexstmtContext) Relation_expr() IRelation_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *IndexstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *IndexstmtContext) Index_params() IIndex_paramsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndex_paramsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndex_paramsContext) +} + +func (s *IndexstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *IndexstmtContext) Opt_unique() IOpt_uniqueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_uniqueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_uniqueContext) +} + +func (s *IndexstmtContext) Opt_concurrently() IOpt_concurrentlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_concurrentlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_concurrentlyContext) +} + +func (s *IndexstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *IndexstmtContext) Access_method_clause() IAccess_method_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAccess_method_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAccess_method_clauseContext) +} + +func (s *IndexstmtContext) Opt_include() IOpt_includeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_includeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_includeContext) +} + +func (s *IndexstmtContext) Opt_unique_null_treatment() IOpt_unique_null_treatmentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_unique_null_treatmentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_unique_null_treatmentContext) +} + +func (s *IndexstmtContext) Opt_reloptions() IOpt_reloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_reloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_reloptionsContext) +} + +func (s *IndexstmtContext) Opttablespace() IOpttablespaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttablespaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttablespaceContext) +} + +func (s *IndexstmtContext) Where_clause() IWhere_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_clauseContext) +} + +func (s *IndexstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *IndexstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *IndexstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *IndexstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *IndexstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *IndexstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIndexstmt(s) + } +} + +func (s *IndexstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIndexstmt(s) + } +} + +func (s *IndexstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIndexstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Indexstmt() (localctx IIndexstmtContext) { + localctx = NewIndexstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 596, PostgreSQLParserRULE_indexstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5590) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5592) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUNIQUE { + { + p.SetState(5591) + p.Opt_unique() + } + + } + { + p.SetState(5594) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5596) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCONCURRENTLY { + { + p.SetState(5595) + p.Opt_concurrently() + } + + } + p.SetState(5604) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + p.SetState(5601) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 449, p.GetParserRuleContext()) == 1 { + { + p.SetState(5598) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5599) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5600) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(5603) + p.Name() + } + + } + { + p.SetState(5606) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5607) + p.Relation_expr() + } + p.SetState(5609) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(5608) + p.Access_method_clause() + } + + } + { + p.SetState(5611) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5612) + p.Index_params() + } + { + p.SetState(5613) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5615) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINCLUDE { + { + p.SetState(5614) + p.Opt_include() + } + + } + p.SetState(5618) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNULLS_P { + { + p.SetState(5617) + p.Opt_unique_null_treatment() + } + + } + p.SetState(5621) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 454, p.GetParserRuleContext()) == 1 { + { + p.SetState(5620) + p.Opt_reloptions() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(5624) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTABLESPACE { + { + p.SetState(5623) + p.Opttablespace() + } + + } + p.SetState(5627) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(5626) + p.Where_clause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_uniqueContext is an interface to support dynamic dispatch. +type IOpt_uniqueContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + UNIQUE() antlr.TerminalNode + + // IsOpt_uniqueContext differentiates from other interfaces. + IsOpt_uniqueContext() +} + +type Opt_uniqueContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_uniqueContext() *Opt_uniqueContext { + var p = new(Opt_uniqueContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_unique + return p +} + +func InitEmptyOpt_uniqueContext(p *Opt_uniqueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_unique +} + +func (*Opt_uniqueContext) IsOpt_uniqueContext() {} + +func NewOpt_uniqueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_uniqueContext { + var p = new(Opt_uniqueContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_unique + + return p +} + +func (s *Opt_uniqueContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_uniqueContext) UNIQUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNIQUE, 0) +} + +func (s *Opt_uniqueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_uniqueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_uniqueContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_unique(s) + } +} + +func (s *Opt_uniqueContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_unique(s) + } +} + +func (s *Opt_uniqueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_unique(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_unique() (localctx IOpt_uniqueContext) { + localctx = NewOpt_uniqueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 598, PostgreSQLParserRULE_opt_unique) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5629) + p.Match(PostgreSQLParserUNIQUE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_concurrentlyContext is an interface to support dynamic dispatch. +type IOpt_concurrentlyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CONCURRENTLY() antlr.TerminalNode + + // IsOpt_concurrentlyContext differentiates from other interfaces. + IsOpt_concurrentlyContext() +} + +type Opt_concurrentlyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_concurrentlyContext() *Opt_concurrentlyContext { + var p = new(Opt_concurrentlyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_concurrently + return p +} + +func InitEmptyOpt_concurrentlyContext(p *Opt_concurrentlyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_concurrently +} + +func (*Opt_concurrentlyContext) IsOpt_concurrentlyContext() {} + +func NewOpt_concurrentlyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_concurrentlyContext { + var p = new(Opt_concurrentlyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_concurrently + + return p +} + +func (s *Opt_concurrentlyContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_concurrentlyContext) CONCURRENTLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONCURRENTLY, 0) +} + +func (s *Opt_concurrentlyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_concurrentlyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_concurrentlyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_concurrently(s) + } +} + +func (s *Opt_concurrentlyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_concurrently(s) + } +} + +func (s *Opt_concurrentlyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_concurrently(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_concurrently() (localctx IOpt_concurrentlyContext) { + localctx = NewOpt_concurrentlyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 600, PostgreSQLParserRULE_opt_concurrently) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5631) + p.Match(PostgreSQLParserCONCURRENTLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_index_nameContext is an interface to support dynamic dispatch. +type IOpt_index_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Name() INameContext + + // IsOpt_index_nameContext differentiates from other interfaces. + IsOpt_index_nameContext() +} + +type Opt_index_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_index_nameContext() *Opt_index_nameContext { + var p = new(Opt_index_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_index_name + return p +} + +func InitEmptyOpt_index_nameContext(p *Opt_index_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_index_name +} + +func (*Opt_index_nameContext) IsOpt_index_nameContext() {} + +func NewOpt_index_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_index_nameContext { + var p = new(Opt_index_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_index_name + + return p +} + +func (s *Opt_index_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_index_nameContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Opt_index_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_index_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_index_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_index_name(s) + } +} + +func (s *Opt_index_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_index_name(s) + } +} + +func (s *Opt_index_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_index_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_index_name() (localctx IOpt_index_nameContext) { + localctx = NewOpt_index_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 602, PostgreSQLParserRULE_opt_index_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5633) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAccess_method_clauseContext is an interface to support dynamic dispatch. +type IAccess_method_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + Name() INameContext + + // IsAccess_method_clauseContext differentiates from other interfaces. + IsAccess_method_clauseContext() +} + +type Access_method_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAccess_method_clauseContext() *Access_method_clauseContext { + var p = new(Access_method_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_access_method_clause + return p +} + +func InitEmptyAccess_method_clauseContext(p *Access_method_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_access_method_clause +} + +func (*Access_method_clauseContext) IsAccess_method_clauseContext() {} + +func NewAccess_method_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Access_method_clauseContext { + var p = new(Access_method_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_access_method_clause + + return p +} + +func (s *Access_method_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Access_method_clauseContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Access_method_clauseContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Access_method_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Access_method_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Access_method_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAccess_method_clause(s) + } +} + +func (s *Access_method_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAccess_method_clause(s) + } +} + +func (s *Access_method_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAccess_method_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Access_method_clause() (localctx IAccess_method_clauseContext) { + localctx = NewAccess_method_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 604, PostgreSQLParserRULE_access_method_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5635) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5636) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIndex_paramsContext is an interface to support dynamic dispatch. +type IIndex_paramsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIndex_elem() []IIndex_elemContext + Index_elem(i int) IIndex_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsIndex_paramsContext differentiates from other interfaces. + IsIndex_paramsContext() +} + +type Index_paramsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIndex_paramsContext() *Index_paramsContext { + var p = new(Index_paramsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_params + return p +} + +func InitEmptyIndex_paramsContext(p *Index_paramsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_params +} + +func (*Index_paramsContext) IsIndex_paramsContext() {} + +func NewIndex_paramsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Index_paramsContext { + var p = new(Index_paramsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_index_params + + return p +} + +func (s *Index_paramsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Index_paramsContext) AllIndex_elem() []IIndex_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIndex_elemContext); ok { + len++ + } + } + + tst := make([]IIndex_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIndex_elemContext); ok { + tst[i] = t.(IIndex_elemContext) + i++ + } + } + + return tst +} + +func (s *Index_paramsContext) Index_elem(i int) IIndex_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndex_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIndex_elemContext) +} + +func (s *Index_paramsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Index_paramsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Index_paramsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Index_paramsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Index_paramsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIndex_params(s) + } +} + +func (s *Index_paramsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIndex_params(s) + } +} + +func (s *Index_paramsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIndex_params(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Index_params() (localctx IIndex_paramsContext) { + localctx = NewIndex_paramsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 606, PostgreSQLParserRULE_index_params) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5638) + p.Index_elem() + } + p.SetState(5643) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5639) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5640) + p.Index_elem() + } + + p.SetState(5645) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIndex_elem_optionsContext is an interface to support dynamic dispatch. +type IIndex_elem_optionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Opt_collate() IOpt_collateContext + Opt_class() IOpt_classContext + Opt_asc_desc() IOpt_asc_descContext + Opt_nulls_order() IOpt_nulls_orderContext + Any_name() IAny_nameContext + Reloptions() IReloptionsContext + + // IsIndex_elem_optionsContext differentiates from other interfaces. + IsIndex_elem_optionsContext() +} + +type Index_elem_optionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIndex_elem_optionsContext() *Index_elem_optionsContext { + var p = new(Index_elem_optionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_elem_options + return p +} + +func InitEmptyIndex_elem_optionsContext(p *Index_elem_optionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_elem_options +} + +func (*Index_elem_optionsContext) IsIndex_elem_optionsContext() {} + +func NewIndex_elem_optionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Index_elem_optionsContext { + var p = new(Index_elem_optionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_index_elem_options + + return p +} + +func (s *Index_elem_optionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Index_elem_optionsContext) Opt_collate() IOpt_collateContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_collateContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_collateContext) +} + +func (s *Index_elem_optionsContext) Opt_class() IOpt_classContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_classContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_classContext) +} + +func (s *Index_elem_optionsContext) Opt_asc_desc() IOpt_asc_descContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_asc_descContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_asc_descContext) +} + +func (s *Index_elem_optionsContext) Opt_nulls_order() IOpt_nulls_orderContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_nulls_orderContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_nulls_orderContext) +} + +func (s *Index_elem_optionsContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Index_elem_optionsContext) Reloptions() IReloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReloptionsContext) +} + +func (s *Index_elem_optionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Index_elem_optionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Index_elem_optionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIndex_elem_options(s) + } +} + +func (s *Index_elem_optionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIndex_elem_options(s) + } +} + +func (s *Index_elem_optionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIndex_elem_options(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Index_elem_options() (localctx IIndex_elem_optionsContext) { + localctx = NewIndex_elem_optionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 608, PostgreSQLParserRULE_index_elem_options) + var _la int + + p.SetState(5669) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 465, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + p.SetState(5647) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 458, p.GetParserRuleContext()) == 1 { + { + p.SetState(5646) + p.Opt_collate() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(5650) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 459, p.GetParserRuleContext()) == 1 { + { + p.SetState(5649) + p.Opt_class() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(5653) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserASC || _la == PostgreSQLParserDESC { + { + p.SetState(5652) + p.Opt_asc_desc() + } + + } + p.SetState(5656) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNULLS_P { + { + p.SetState(5655) + p.Opt_nulls_order() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + p.SetState(5659) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 462, p.GetParserRuleContext()) == 1 { + { + p.SetState(5658) + p.Opt_collate() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(5661) + p.Any_name() + } + { + p.SetState(5662) + p.Reloptions() + } + p.SetState(5664) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserASC || _la == PostgreSQLParserDESC { + { + p.SetState(5663) + p.Opt_asc_desc() + } + + } + p.SetState(5667) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNULLS_P { + { + p.SetState(5666) + p.Opt_nulls_order() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIndex_elemContext is an interface to support dynamic dispatch. +type IIndex_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Index_elem_options() IIndex_elem_optionsContext + Func_expr_windowless() IFunc_expr_windowlessContext + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsIndex_elemContext differentiates from other interfaces. + IsIndex_elemContext() +} + +type Index_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIndex_elemContext() *Index_elemContext { + var p = new(Index_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_elem + return p +} + +func InitEmptyIndex_elemContext(p *Index_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_elem +} + +func (*Index_elemContext) IsIndex_elemContext() {} + +func NewIndex_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Index_elemContext { + var p = new(Index_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_index_elem + + return p +} + +func (s *Index_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Index_elemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Index_elemContext) Index_elem_options() IIndex_elem_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndex_elem_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndex_elem_optionsContext) +} + +func (s *Index_elemContext) Func_expr_windowless() IFunc_expr_windowlessContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_expr_windowlessContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_expr_windowlessContext) +} + +func (s *Index_elemContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Index_elemContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Index_elemContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Index_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Index_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Index_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIndex_elem(s) + } +} + +func (s *Index_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIndex_elem(s) + } +} + +func (s *Index_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIndex_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Index_elem() (localctx IIndex_elemContext) { + localctx = NewIndex_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 610, PostgreSQLParserRULE_index_elem) + p.SetState(5682) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 466, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5671) + p.Colid() + } + { + p.SetState(5672) + p.Index_elem_options() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5674) + p.Func_expr_windowless() + } + { + p.SetState(5675) + p.Index_elem_options() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5677) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5678) + p.A_expr() + } + { + p.SetState(5679) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5680) + p.Index_elem_options() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_includeContext is an interface to support dynamic dispatch. +type IOpt_includeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INCLUDE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Index_including_params() IIndex_including_paramsContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_includeContext differentiates from other interfaces. + IsOpt_includeContext() +} + +type Opt_includeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_includeContext() *Opt_includeContext { + var p = new(Opt_includeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_include + return p +} + +func InitEmptyOpt_includeContext(p *Opt_includeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_include +} + +func (*Opt_includeContext) IsOpt_includeContext() {} + +func NewOpt_includeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_includeContext { + var p = new(Opt_includeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_include + + return p +} + +func (s *Opt_includeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_includeContext) INCLUDE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINCLUDE, 0) +} + +func (s *Opt_includeContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_includeContext) Index_including_params() IIndex_including_paramsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndex_including_paramsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndex_including_paramsContext) +} + +func (s *Opt_includeContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_includeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_includeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_includeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_include(s) + } +} + +func (s *Opt_includeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_include(s) + } +} + +func (s *Opt_includeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_include(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_include() (localctx IOpt_includeContext) { + localctx = NewOpt_includeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 612, PostgreSQLParserRULE_opt_include) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5684) + p.Match(PostgreSQLParserINCLUDE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5685) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5686) + p.Index_including_params() + } + { + p.SetState(5687) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIndex_including_paramsContext is an interface to support dynamic dispatch. +type IIndex_including_paramsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIndex_elem() []IIndex_elemContext + Index_elem(i int) IIndex_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsIndex_including_paramsContext differentiates from other interfaces. + IsIndex_including_paramsContext() +} + +type Index_including_paramsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIndex_including_paramsContext() *Index_including_paramsContext { + var p = new(Index_including_paramsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_including_params + return p +} + +func InitEmptyIndex_including_paramsContext(p *Index_including_paramsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_index_including_params +} + +func (*Index_including_paramsContext) IsIndex_including_paramsContext() {} + +func NewIndex_including_paramsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Index_including_paramsContext { + var p = new(Index_including_paramsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_index_including_params + + return p +} + +func (s *Index_including_paramsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Index_including_paramsContext) AllIndex_elem() []IIndex_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIndex_elemContext); ok { + len++ + } + } + + tst := make([]IIndex_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIndex_elemContext); ok { + tst[i] = t.(IIndex_elemContext) + i++ + } + } + + return tst +} + +func (s *Index_including_paramsContext) Index_elem(i int) IIndex_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndex_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIndex_elemContext) +} + +func (s *Index_including_paramsContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Index_including_paramsContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Index_including_paramsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Index_including_paramsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Index_including_paramsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIndex_including_params(s) + } +} + +func (s *Index_including_paramsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIndex_including_params(s) + } +} + +func (s *Index_including_paramsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIndex_including_params(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Index_including_params() (localctx IIndex_including_paramsContext) { + localctx = NewIndex_including_paramsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 614, PostgreSQLParserRULE_index_including_params) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5689) + p.Index_elem() + } + p.SetState(5694) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5690) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5691) + p.Index_elem() + } + + p.SetState(5696) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_collateContext is an interface to support dynamic dispatch. +type IOpt_collateContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COLLATE() antlr.TerminalNode + Any_name() IAny_nameContext + + // IsOpt_collateContext differentiates from other interfaces. + IsOpt_collateContext() +} + +type Opt_collateContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_collateContext() *Opt_collateContext { + var p = new(Opt_collateContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_collate + return p +} + +func InitEmptyOpt_collateContext(p *Opt_collateContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_collate +} + +func (*Opt_collateContext) IsOpt_collateContext() {} + +func NewOpt_collateContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_collateContext { + var p = new(Opt_collateContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_collate + + return p +} + +func (s *Opt_collateContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_collateContext) COLLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATE, 0) +} + +func (s *Opt_collateContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Opt_collateContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_collateContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_collateContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_collate(s) + } +} + +func (s *Opt_collateContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_collate(s) + } +} + +func (s *Opt_collateContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_collate(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_collate() (localctx IOpt_collateContext) { + localctx = NewOpt_collateContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 616, PostgreSQLParserRULE_opt_collate) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5697) + p.Match(PostgreSQLParserCOLLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5698) + p.Any_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_classContext is an interface to support dynamic dispatch. +type IOpt_classContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Any_name() IAny_nameContext + + // IsOpt_classContext differentiates from other interfaces. + IsOpt_classContext() +} + +type Opt_classContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_classContext() *Opt_classContext { + var p = new(Opt_classContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_class + return p +} + +func InitEmptyOpt_classContext(p *Opt_classContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_class +} + +func (*Opt_classContext) IsOpt_classContext() {} + +func NewOpt_classContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_classContext { + var p = new(Opt_classContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_class + + return p +} + +func (s *Opt_classContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_classContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Opt_classContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_classContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_classContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_class(s) + } +} + +func (s *Opt_classContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_class(s) + } +} + +func (s *Opt_classContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_class(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_class() (localctx IOpt_classContext) { + localctx = NewOpt_classContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 618, PostgreSQLParserRULE_opt_class) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5700) + p.Any_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_asc_descContext is an interface to support dynamic dispatch. +type IOpt_asc_descContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ASC() antlr.TerminalNode + DESC() antlr.TerminalNode + + // IsOpt_asc_descContext differentiates from other interfaces. + IsOpt_asc_descContext() +} + +type Opt_asc_descContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_asc_descContext() *Opt_asc_descContext { + var p = new(Opt_asc_descContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_asc_desc + return p +} + +func InitEmptyOpt_asc_descContext(p *Opt_asc_descContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_asc_desc +} + +func (*Opt_asc_descContext) IsOpt_asc_descContext() {} + +func NewOpt_asc_descContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_asc_descContext { + var p = new(Opt_asc_descContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_asc_desc + + return p +} + +func (s *Opt_asc_descContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_asc_descContext) ASC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASC, 0) +} + +func (s *Opt_asc_descContext) DESC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDESC, 0) +} + +func (s *Opt_asc_descContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_asc_descContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_asc_descContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_asc_desc(s) + } +} + +func (s *Opt_asc_descContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_asc_desc(s) + } +} + +func (s *Opt_asc_descContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_asc_desc(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_asc_desc() (localctx IOpt_asc_descContext) { + localctx = NewOpt_asc_descContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 620, PostgreSQLParserRULE_opt_asc_desc) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5702) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserASC || _la == PostgreSQLParserDESC) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_nulls_orderContext is an interface to support dynamic dispatch. +type IOpt_nulls_orderContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NULLS_P() antlr.TerminalNode + FIRST_P() antlr.TerminalNode + LAST_P() antlr.TerminalNode + + // IsOpt_nulls_orderContext differentiates from other interfaces. + IsOpt_nulls_orderContext() +} + +type Opt_nulls_orderContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_nulls_orderContext() *Opt_nulls_orderContext { + var p = new(Opt_nulls_orderContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_nulls_order + return p +} + +func InitEmptyOpt_nulls_orderContext(p *Opt_nulls_orderContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_nulls_order +} + +func (*Opt_nulls_orderContext) IsOpt_nulls_orderContext() {} + +func NewOpt_nulls_orderContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_nulls_orderContext { + var p = new(Opt_nulls_orderContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_nulls_order + + return p +} + +func (s *Opt_nulls_orderContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_nulls_orderContext) NULLS_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULLS_P, 0) +} + +func (s *Opt_nulls_orderContext) FIRST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFIRST_P, 0) +} + +func (s *Opt_nulls_orderContext) LAST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLAST_P, 0) +} + +func (s *Opt_nulls_orderContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_nulls_orderContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_nulls_orderContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_nulls_order(s) + } +} + +func (s *Opt_nulls_orderContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_nulls_order(s) + } +} + +func (s *Opt_nulls_orderContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_nulls_order(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_nulls_order() (localctx IOpt_nulls_orderContext) { + localctx = NewOpt_nulls_orderContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 622, PostgreSQLParserRULE_opt_nulls_order) + p.SetState(5708) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 468, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5704) + p.Match(PostgreSQLParserNULLS_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5705) + p.Match(PostgreSQLParserFIRST_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5706) + p.Match(PostgreSQLParserNULLS_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5707) + p.Match(PostgreSQLParserLAST_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatefunctionstmtContext is an interface to support dynamic dispatch. +type ICreatefunctionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + Func_name() IFunc_nameContext + Func_args_with_defaults() IFunc_args_with_defaultsContext + Createfunc_opt_list() ICreatefunc_opt_listContext + FUNCTION() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + Opt_or_replace() IOpt_or_replaceContext + RETURNS() antlr.TerminalNode + Func_return() IFunc_returnContext + TABLE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Table_func_column_list() ITable_func_column_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsCreatefunctionstmtContext differentiates from other interfaces. + IsCreatefunctionstmtContext() +} + +type CreatefunctionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatefunctionstmtContext() *CreatefunctionstmtContext { + var p = new(CreatefunctionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createfunctionstmt + return p +} + +func InitEmptyCreatefunctionstmtContext(p *CreatefunctionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createfunctionstmt +} + +func (*CreatefunctionstmtContext) IsCreatefunctionstmtContext() {} + +func NewCreatefunctionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatefunctionstmtContext { + var p = new(CreatefunctionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createfunctionstmt + + return p +} + +func (s *CreatefunctionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatefunctionstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatefunctionstmtContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *CreatefunctionstmtContext) Func_args_with_defaults() IFunc_args_with_defaultsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_args_with_defaultsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_args_with_defaultsContext) +} + +func (s *CreatefunctionstmtContext) Createfunc_opt_list() ICreatefunc_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatefunc_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatefunc_opt_listContext) +} + +func (s *CreatefunctionstmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *CreatefunctionstmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *CreatefunctionstmtContext) Opt_or_replace() IOpt_or_replaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_or_replaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_or_replaceContext) +} + +func (s *CreatefunctionstmtContext) RETURNS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRETURNS, 0) +} + +func (s *CreatefunctionstmtContext) Func_return() IFunc_returnContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_returnContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_returnContext) +} + +func (s *CreatefunctionstmtContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *CreatefunctionstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CreatefunctionstmtContext) Table_func_column_list() ITable_func_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_func_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITable_func_column_listContext) +} + +func (s *CreatefunctionstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CreatefunctionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatefunctionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatefunctionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatefunctionstmt(s) + } +} + +func (s *CreatefunctionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatefunctionstmt(s) + } +} + +func (s *CreatefunctionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatefunctionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createfunctionstmt() (localctx ICreatefunctionstmtContext) { + localctx = NewCreatefunctionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 624, PostgreSQLParserRULE_createfunctionstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5710) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5712) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOR { + { + p.SetState(5711) + p.Opt_or_replace() + } + + } + { + p.SetState(5714) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFUNCTION || _la == PostgreSQLParserPROCEDURE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(5715) + p.Func_name() + } + { + p.SetState(5716) + p.Func_args_with_defaults() + } + p.SetState(5726) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 471, p.GetParserRuleContext()) == 1 { + { + p.SetState(5717) + p.Match(PostgreSQLParserRETURNS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5724) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 470, p.GetParserRuleContext()) { + case 1: + { + p.SetState(5718) + p.Func_return() + } + + case 2: + { + p.SetState(5719) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5720) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5721) + p.Table_func_column_list() + } + { + p.SetState(5722) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(5728) + p.Createfunc_opt_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_or_replaceContext is an interface to support dynamic dispatch. +type IOpt_or_replaceContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OR() antlr.TerminalNode + REPLACE() antlr.TerminalNode + + // IsOpt_or_replaceContext differentiates from other interfaces. + IsOpt_or_replaceContext() +} + +type Opt_or_replaceContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_or_replaceContext() *Opt_or_replaceContext { + var p = new(Opt_or_replaceContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_or_replace + return p +} + +func InitEmptyOpt_or_replaceContext(p *Opt_or_replaceContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_or_replace +} + +func (*Opt_or_replaceContext) IsOpt_or_replaceContext() {} + +func NewOpt_or_replaceContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_or_replaceContext { + var p = new(Opt_or_replaceContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_or_replace + + return p +} + +func (s *Opt_or_replaceContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_or_replaceContext) OR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOR, 0) +} + +func (s *Opt_or_replaceContext) REPLACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPLACE, 0) +} + +func (s *Opt_or_replaceContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_or_replaceContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_or_replaceContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_or_replace(s) + } +} + +func (s *Opt_or_replaceContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_or_replace(s) + } +} + +func (s *Opt_or_replaceContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_or_replace(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_or_replace() (localctx IOpt_or_replaceContext) { + localctx = NewOpt_or_replaceContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 626, PostgreSQLParserRULE_opt_or_replace) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5730) + p.Match(PostgreSQLParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5731) + p.Match(PostgreSQLParserREPLACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_argsContext is an interface to support dynamic dispatch. +type IFunc_argsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + Func_args_list() IFunc_args_listContext + + // IsFunc_argsContext differentiates from other interfaces. + IsFunc_argsContext() +} + +type Func_argsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_argsContext() *Func_argsContext { + var p = new(Func_argsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_args + return p +} + +func InitEmptyFunc_argsContext(p *Func_argsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_args +} + +func (*Func_argsContext) IsFunc_argsContext() {} + +func NewFunc_argsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_argsContext { + var p = new(Func_argsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_args + + return p +} + +func (s *Func_argsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_argsContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Func_argsContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Func_argsContext) Func_args_list() IFunc_args_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_args_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_args_listContext) +} + +func (s *Func_argsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_argsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_argsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_args(s) + } +} + +func (s *Func_argsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_args(s) + } +} + +func (s *Func_argsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_args(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_args() (localctx IFunc_argsContext) { + localctx = NewFunc_argsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 628, PostgreSQLParserRULE_func_args) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5733) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5735) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460786949430277) != 0) || ((int64((_la-101)) & ^0x3f) == 0 && ((int64(1)<<(_la-101))&-31) != 0) || ((int64((_la-165)) & ^0x3f) == 0 && ((int64(1)<<(_la-165))&-1) != 0) || ((int64((_la-229)) & ^0x3f) == 0 && ((int64(1)<<(_la-229))&-18874369) != 0) || ((int64((_la-293)) & ^0x3f) == 0 && ((int64(1)<<(_la-293))&-1) != 0) || ((int64((_la-357)) & ^0x3f) == 0 && ((int64(1)<<(_la-357))&-1) != 0) || ((int64((_la-421)) & ^0x3f) == 0 && ((int64(1)<<(_la-421))&-34359738369) != 0) || ((int64((_la-485)) & ^0x3f) == 0 && ((int64(1)<<(_la-485))&-68724719617) != 0) || ((int64((_la-549)) & ^0x3f) == 0 && ((int64(1)<<(_la-549))&-1) != 0) || ((int64((_la-613)) & ^0x3f) == 0 && ((int64(1)<<(_la-613))&108086428671410175) != 0) { + { + p.SetState(5734) + p.Func_args_list() + } + + } + { + p.SetState(5737) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_args_listContext is an interface to support dynamic dispatch. +type IFunc_args_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllFunc_arg() []IFunc_argContext + Func_arg(i int) IFunc_argContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsFunc_args_listContext differentiates from other interfaces. + IsFunc_args_listContext() +} + +type Func_args_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_args_listContext() *Func_args_listContext { + var p = new(Func_args_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_args_list + return p +} + +func InitEmptyFunc_args_listContext(p *Func_args_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_args_list +} + +func (*Func_args_listContext) IsFunc_args_listContext() {} + +func NewFunc_args_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_args_listContext { + var p = new(Func_args_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_args_list + + return p +} + +func (s *Func_args_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_args_listContext) AllFunc_arg() []IFunc_argContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFunc_argContext); ok { + len++ + } + } + + tst := make([]IFunc_argContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFunc_argContext); ok { + tst[i] = t.(IFunc_argContext) + i++ + } + } + + return tst +} + +func (s *Func_args_listContext) Func_arg(i int) IFunc_argContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_argContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFunc_argContext) +} + +func (s *Func_args_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Func_args_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Func_args_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_args_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_args_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_args_list(s) + } +} + +func (s *Func_args_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_args_list(s) + } +} + +func (s *Func_args_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_args_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_args_list() (localctx IFunc_args_listContext) { + localctx = NewFunc_args_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 630, PostgreSQLParserRULE_func_args_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5739) + p.Func_arg() + } + p.SetState(5744) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5740) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5741) + p.Func_arg() + } + + p.SetState(5746) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunction_with_argtypes_listContext is an interface to support dynamic dispatch. +type IFunction_with_argtypes_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllFunction_with_argtypes() []IFunction_with_argtypesContext + Function_with_argtypes(i int) IFunction_with_argtypesContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsFunction_with_argtypes_listContext differentiates from other interfaces. + IsFunction_with_argtypes_listContext() +} + +type Function_with_argtypes_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunction_with_argtypes_listContext() *Function_with_argtypes_listContext { + var p = new(Function_with_argtypes_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_function_with_argtypes_list + return p +} + +func InitEmptyFunction_with_argtypes_listContext(p *Function_with_argtypes_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_function_with_argtypes_list +} + +func (*Function_with_argtypes_listContext) IsFunction_with_argtypes_listContext() {} + +func NewFunction_with_argtypes_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Function_with_argtypes_listContext { + var p = new(Function_with_argtypes_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_function_with_argtypes_list + + return p +} + +func (s *Function_with_argtypes_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Function_with_argtypes_listContext) AllFunction_with_argtypes() []IFunction_with_argtypesContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + len++ + } + } + + tst := make([]IFunction_with_argtypesContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFunction_with_argtypesContext); ok { + tst[i] = t.(IFunction_with_argtypesContext) + i++ + } + } + + return tst +} + +func (s *Function_with_argtypes_listContext) Function_with_argtypes(i int) IFunction_with_argtypesContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *Function_with_argtypes_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Function_with_argtypes_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Function_with_argtypes_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Function_with_argtypes_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Function_with_argtypes_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunction_with_argtypes_list(s) + } +} + +func (s *Function_with_argtypes_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunction_with_argtypes_list(s) + } +} + +func (s *Function_with_argtypes_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunction_with_argtypes_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Function_with_argtypes_list() (localctx IFunction_with_argtypes_listContext) { + localctx = NewFunction_with_argtypes_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 632, PostgreSQLParserRULE_function_with_argtypes_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5747) + p.Function_with_argtypes() + } + p.SetState(5752) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5748) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5749) + p.Function_with_argtypes() + } + + p.SetState(5754) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunction_with_argtypesContext is an interface to support dynamic dispatch. +type IFunction_with_argtypesContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_name() IFunc_nameContext + Func_args() IFunc_argsContext + Type_func_name_keyword() IType_func_name_keywordContext + Colid() IColidContext + Indirection() IIndirectionContext + + // IsFunction_with_argtypesContext differentiates from other interfaces. + IsFunction_with_argtypesContext() +} + +type Function_with_argtypesContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunction_with_argtypesContext() *Function_with_argtypesContext { + var p = new(Function_with_argtypesContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_function_with_argtypes + return p +} + +func InitEmptyFunction_with_argtypesContext(p *Function_with_argtypesContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_function_with_argtypes +} + +func (*Function_with_argtypesContext) IsFunction_with_argtypesContext() {} + +func NewFunction_with_argtypesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Function_with_argtypesContext { + var p = new(Function_with_argtypesContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_function_with_argtypes + + return p +} + +func (s *Function_with_argtypesContext) GetParser() antlr.Parser { return s.parser } + +func (s *Function_with_argtypesContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *Function_with_argtypesContext) Func_args() IFunc_argsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_argsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_argsContext) +} + +func (s *Function_with_argtypesContext) Type_func_name_keyword() IType_func_name_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_func_name_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_func_name_keywordContext) +} + +func (s *Function_with_argtypesContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Function_with_argtypesContext) Indirection() IIndirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndirectionContext) +} + +func (s *Function_with_argtypesContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Function_with_argtypesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Function_with_argtypesContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunction_with_argtypes(s) + } +} + +func (s *Function_with_argtypesContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunction_with_argtypes(s) + } +} + +func (s *Function_with_argtypesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunction_with_argtypes(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Function_with_argtypes() (localctx IFunction_with_argtypesContext) { + localctx = NewFunction_with_argtypesContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 634, PostgreSQLParserRULE_function_with_argtypes) + var _la int + + p.SetState(5763) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 476, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5755) + p.Func_name() + } + { + p.SetState(5756) + p.Func_args() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5758) + p.Type_func_name_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5759) + p.Colid() + } + p.SetState(5761) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_BRACKET || _la == PostgreSQLParserDOT { + { + p.SetState(5760) + p.Indirection() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_args_with_defaultsContext is an interface to support dynamic dispatch. +type IFunc_args_with_defaultsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + Func_args_with_defaults_list() IFunc_args_with_defaults_listContext + + // IsFunc_args_with_defaultsContext differentiates from other interfaces. + IsFunc_args_with_defaultsContext() +} + +type Func_args_with_defaultsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_args_with_defaultsContext() *Func_args_with_defaultsContext { + var p = new(Func_args_with_defaultsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_args_with_defaults + return p +} + +func InitEmptyFunc_args_with_defaultsContext(p *Func_args_with_defaultsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_args_with_defaults +} + +func (*Func_args_with_defaultsContext) IsFunc_args_with_defaultsContext() {} + +func NewFunc_args_with_defaultsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_args_with_defaultsContext { + var p = new(Func_args_with_defaultsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_args_with_defaults + + return p +} + +func (s *Func_args_with_defaultsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_args_with_defaultsContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Func_args_with_defaultsContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Func_args_with_defaultsContext) Func_args_with_defaults_list() IFunc_args_with_defaults_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_args_with_defaults_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_args_with_defaults_listContext) +} + +func (s *Func_args_with_defaultsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_args_with_defaultsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_args_with_defaultsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_args_with_defaults(s) + } +} + +func (s *Func_args_with_defaultsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_args_with_defaults(s) + } +} + +func (s *Func_args_with_defaultsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_args_with_defaults(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_args_with_defaults() (localctx IFunc_args_with_defaultsContext) { + localctx = NewFunc_args_with_defaultsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 636, PostgreSQLParserRULE_func_args_with_defaults) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5765) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5767) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460786949430277) != 0) || ((int64((_la-101)) & ^0x3f) == 0 && ((int64(1)<<(_la-101))&-31) != 0) || ((int64((_la-165)) & ^0x3f) == 0 && ((int64(1)<<(_la-165))&-1) != 0) || ((int64((_la-229)) & ^0x3f) == 0 && ((int64(1)<<(_la-229))&-18874369) != 0) || ((int64((_la-293)) & ^0x3f) == 0 && ((int64(1)<<(_la-293))&-1) != 0) || ((int64((_la-357)) & ^0x3f) == 0 && ((int64(1)<<(_la-357))&-1) != 0) || ((int64((_la-421)) & ^0x3f) == 0 && ((int64(1)<<(_la-421))&-34359738369) != 0) || ((int64((_la-485)) & ^0x3f) == 0 && ((int64(1)<<(_la-485))&-68724719617) != 0) || ((int64((_la-549)) & ^0x3f) == 0 && ((int64(1)<<(_la-549))&-1) != 0) || ((int64((_la-613)) & ^0x3f) == 0 && ((int64(1)<<(_la-613))&108086428671410175) != 0) { + { + p.SetState(5766) + p.Func_args_with_defaults_list() + } + + } + { + p.SetState(5769) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_args_with_defaults_listContext is an interface to support dynamic dispatch. +type IFunc_args_with_defaults_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllFunc_arg_with_default() []IFunc_arg_with_defaultContext + Func_arg_with_default(i int) IFunc_arg_with_defaultContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsFunc_args_with_defaults_listContext differentiates from other interfaces. + IsFunc_args_with_defaults_listContext() +} + +type Func_args_with_defaults_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_args_with_defaults_listContext() *Func_args_with_defaults_listContext { + var p = new(Func_args_with_defaults_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_args_with_defaults_list + return p +} + +func InitEmptyFunc_args_with_defaults_listContext(p *Func_args_with_defaults_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_args_with_defaults_list +} + +func (*Func_args_with_defaults_listContext) IsFunc_args_with_defaults_listContext() {} + +func NewFunc_args_with_defaults_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_args_with_defaults_listContext { + var p = new(Func_args_with_defaults_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_args_with_defaults_list + + return p +} + +func (s *Func_args_with_defaults_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_args_with_defaults_listContext) AllFunc_arg_with_default() []IFunc_arg_with_defaultContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFunc_arg_with_defaultContext); ok { + len++ + } + } + + tst := make([]IFunc_arg_with_defaultContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFunc_arg_with_defaultContext); ok { + tst[i] = t.(IFunc_arg_with_defaultContext) + i++ + } + } + + return tst +} + +func (s *Func_args_with_defaults_listContext) Func_arg_with_default(i int) IFunc_arg_with_defaultContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_arg_with_defaultContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFunc_arg_with_defaultContext) +} + +func (s *Func_args_with_defaults_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Func_args_with_defaults_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Func_args_with_defaults_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_args_with_defaults_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_args_with_defaults_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_args_with_defaults_list(s) + } +} + +func (s *Func_args_with_defaults_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_args_with_defaults_list(s) + } +} + +func (s *Func_args_with_defaults_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_args_with_defaults_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_args_with_defaults_list() (localctx IFunc_args_with_defaults_listContext) { + localctx = NewFunc_args_with_defaults_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 638, PostgreSQLParserRULE_func_args_with_defaults_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5771) + p.Func_arg_with_default() + } + p.SetState(5776) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5772) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5773) + p.Func_arg_with_default() + } + + p.SetState(5778) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_argContext is an interface to support dynamic dispatch. +type IFunc_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Arg_class() IArg_classContext + Func_type() IFunc_typeContext + Param_name() IParam_nameContext + + // IsFunc_argContext differentiates from other interfaces. + IsFunc_argContext() +} + +type Func_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_argContext() *Func_argContext { + var p = new(Func_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_arg + return p +} + +func InitEmptyFunc_argContext(p *Func_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_arg +} + +func (*Func_argContext) IsFunc_argContext() {} + +func NewFunc_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_argContext { + var p = new(Func_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_arg + + return p +} + +func (s *Func_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_argContext) Arg_class() IArg_classContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArg_classContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArg_classContext) +} + +func (s *Func_argContext) Func_type() IFunc_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_typeContext) +} + +func (s *Func_argContext) Param_name() IParam_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IParam_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IParam_nameContext) +} + +func (s *Func_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_arg(s) + } +} + +func (s *Func_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_arg(s) + } +} + +func (s *Func_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_arg() (localctx IFunc_argContext) { + localctx = NewFunc_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 640, PostgreSQLParserRULE_func_arg) + p.SetState(5792) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 481, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5779) + p.Arg_class() + } + p.SetState(5781) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 479, p.GetParserRuleContext()) == 1 { + { + p.SetState(5780) + p.Param_name() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(5783) + p.Func_type() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5785) + p.Param_name() + } + p.SetState(5787) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 480, p.GetParserRuleContext()) == 1 { + { + p.SetState(5786) + p.Arg_class() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(5789) + p.Func_type() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5791) + p.Func_type() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IArg_classContext is an interface to support dynamic dispatch. +type IArg_classContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IN_P() antlr.TerminalNode + OUT_P() antlr.TerminalNode + INOUT() antlr.TerminalNode + VARIADIC() antlr.TerminalNode + + // IsArg_classContext differentiates from other interfaces. + IsArg_classContext() +} + +type Arg_classContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyArg_classContext() *Arg_classContext { + var p = new(Arg_classContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_arg_class + return p +} + +func InitEmptyArg_classContext(p *Arg_classContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_arg_class +} + +func (*Arg_classContext) IsArg_classContext() {} + +func NewArg_classContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Arg_classContext { + var p = new(Arg_classContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_arg_class + + return p +} + +func (s *Arg_classContext) GetParser() antlr.Parser { return s.parser } + +func (s *Arg_classContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Arg_classContext) OUT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOUT_P, 0) +} + +func (s *Arg_classContext) INOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINOUT, 0) +} + +func (s *Arg_classContext) VARIADIC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARIADIC, 0) +} + +func (s *Arg_classContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Arg_classContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Arg_classContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterArg_class(s) + } +} + +func (s *Arg_classContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitArg_class(s) + } +} + +func (s *Arg_classContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitArg_class(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Arg_class() (localctx IArg_classContext) { + localctx = NewArg_classContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 642, PostgreSQLParserRULE_arg_class) + p.SetState(5801) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserIN_P: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5794) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5796) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 482, p.GetParserRuleContext()) == 1 { + { + p.SetState(5795) + p.Match(PostgreSQLParserOUT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserOUT_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5798) + p.Match(PostgreSQLParserOUT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserINOUT: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5799) + p.Match(PostgreSQLParserINOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserVARIADIC: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5800) + p.Match(PostgreSQLParserVARIADIC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IParam_nameContext is an interface to support dynamic dispatch. +type IParam_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Type_function_name() IType_function_nameContext + Builtin_function_name() IBuiltin_function_nameContext + LEFT() antlr.TerminalNode + RIGHT() antlr.TerminalNode + + // IsParam_nameContext differentiates from other interfaces. + IsParam_nameContext() +} + +type Param_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyParam_nameContext() *Param_nameContext { + var p = new(Param_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_param_name + return p +} + +func InitEmptyParam_nameContext(p *Param_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_param_name +} + +func (*Param_nameContext) IsParam_nameContext() {} + +func NewParam_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Param_nameContext { + var p = new(Param_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_param_name + + return p +} + +func (s *Param_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Param_nameContext) Type_function_name() IType_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_function_nameContext) +} + +func (s *Param_nameContext) Builtin_function_name() IBuiltin_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBuiltin_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBuiltin_function_nameContext) +} + +func (s *Param_nameContext) LEFT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEFT, 0) +} + +func (s *Param_nameContext) RIGHT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRIGHT, 0) +} + +func (s *Param_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Param_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Param_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterParam_name(s) + } +} + +func (s *Param_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitParam_name(s) + } +} + +func (s *Param_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitParam_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Param_name() (localctx IParam_nameContext) { + localctx = NewParam_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 644, PostgreSQLParserRULE_param_name) + p.SetState(5807) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserPARAMETER, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserCOLUMNS, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5803) + p.Type_function_name() + } + + case PostgreSQLParserREPLACE, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserREVERSE, PostgreSQLParserLOG, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5804) + p.Builtin_function_name() + } + + case PostgreSQLParserLEFT: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5805) + p.Match(PostgreSQLParserLEFT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserRIGHT: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5806) + p.Match(PostgreSQLParserRIGHT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_returnContext is an interface to support dynamic dispatch. +type IFunc_returnContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_type() IFunc_typeContext + + // IsFunc_returnContext differentiates from other interfaces. + IsFunc_returnContext() +} + +type Func_returnContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_returnContext() *Func_returnContext { + var p = new(Func_returnContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_return + return p +} + +func InitEmptyFunc_returnContext(p *Func_returnContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_return +} + +func (*Func_returnContext) IsFunc_returnContext() {} + +func NewFunc_returnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_returnContext { + var p = new(Func_returnContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_return + + return p +} + +func (s *Func_returnContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_returnContext) Func_type() IFunc_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_typeContext) +} + +func (s *Func_returnContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_returnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_returnContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_return(s) + } +} + +func (s *Func_returnContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_return(s) + } +} + +func (s *Func_returnContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_return(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_return() (localctx IFunc_returnContext) { + localctx = NewFunc_returnContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 646, PostgreSQLParserRULE_func_return) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5809) + p.Func_type() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_typeContext is an interface to support dynamic dispatch. +type IFunc_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Typename() ITypenameContext + Attrs() IAttrsContext + PERCENT() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + Builtin_function_name() IBuiltin_function_nameContext + Type_function_name() IType_function_nameContext + LEFT() antlr.TerminalNode + RIGHT() antlr.TerminalNode + SETOF() antlr.TerminalNode + + // IsFunc_typeContext differentiates from other interfaces. + IsFunc_typeContext() +} + +type Func_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_typeContext() *Func_typeContext { + var p = new(Func_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_type + return p +} + +func InitEmptyFunc_typeContext(p *Func_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_type +} + +func (*Func_typeContext) IsFunc_typeContext() {} + +func NewFunc_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_typeContext { + var p = new(Func_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_type + + return p +} + +func (s *Func_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_typeContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Func_typeContext) Attrs() IAttrsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAttrsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAttrsContext) +} + +func (s *Func_typeContext) PERCENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPERCENT, 0) +} + +func (s *Func_typeContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *Func_typeContext) Builtin_function_name() IBuiltin_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBuiltin_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBuiltin_function_nameContext) +} + +func (s *Func_typeContext) Type_function_name() IType_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_function_nameContext) +} + +func (s *Func_typeContext) LEFT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEFT, 0) +} + +func (s *Func_typeContext) RIGHT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRIGHT, 0) +} + +func (s *Func_typeContext) SETOF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSETOF, 0) +} + +func (s *Func_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_type(s) + } +} + +func (s *Func_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_type(s) + } +} + +func (s *Func_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_type() (localctx IFunc_typeContext) { + localctx = NewFunc_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 648, PostgreSQLParserRULE_func_type) + var _la int + + p.SetState(5825) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 487, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5811) + p.Typename() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + p.SetState(5813) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSETOF { + { + p.SetState(5812) + p.Match(PostgreSQLParserSETOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(5819) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserREPLACE, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserREVERSE, PostgreSQLParserLOG, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER: + { + p.SetState(5815) + p.Builtin_function_name() + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserPARAMETER, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserCOLUMNS, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(5816) + p.Type_function_name() + } + + case PostgreSQLParserLEFT: + { + p.SetState(5817) + p.Match(PostgreSQLParserLEFT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserRIGHT: + { + p.SetState(5818) + p.Match(PostgreSQLParserRIGHT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(5821) + p.Attrs() + } + { + p.SetState(5822) + p.Match(PostgreSQLParserPERCENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5823) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_arg_with_defaultContext is an interface to support dynamic dispatch. +type IFunc_arg_with_defaultContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_arg() IFunc_argContext + A_expr() IA_exprContext + DEFAULT() antlr.TerminalNode + EQUAL() antlr.TerminalNode + + // IsFunc_arg_with_defaultContext differentiates from other interfaces. + IsFunc_arg_with_defaultContext() +} + +type Func_arg_with_defaultContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_arg_with_defaultContext() *Func_arg_with_defaultContext { + var p = new(Func_arg_with_defaultContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_arg_with_default + return p +} + +func InitEmptyFunc_arg_with_defaultContext(p *Func_arg_with_defaultContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_arg_with_default +} + +func (*Func_arg_with_defaultContext) IsFunc_arg_with_defaultContext() {} + +func NewFunc_arg_with_defaultContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_arg_with_defaultContext { + var p = new(Func_arg_with_defaultContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_arg_with_default + + return p +} + +func (s *Func_arg_with_defaultContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_arg_with_defaultContext) Func_arg() IFunc_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_argContext) +} + +func (s *Func_arg_with_defaultContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Func_arg_with_defaultContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Func_arg_with_defaultContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Func_arg_with_defaultContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_arg_with_defaultContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_arg_with_defaultContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_arg_with_default(s) + } +} + +func (s *Func_arg_with_defaultContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_arg_with_default(s) + } +} + +func (s *Func_arg_with_defaultContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_arg_with_default(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_arg_with_default() (localctx IFunc_arg_with_defaultContext) { + localctx = NewFunc_arg_with_defaultContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 650, PostgreSQLParserRULE_func_arg_with_default) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5827) + p.Func_arg() + } + p.SetState(5830) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEQUAL || _la == PostgreSQLParserDEFAULT { + { + p.SetState(5828) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserEQUAL || _la == PostgreSQLParserDEFAULT) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(5829) + p.A_expr() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAggr_argContext is an interface to support dynamic dispatch. +type IAggr_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_arg() IFunc_argContext + + // IsAggr_argContext differentiates from other interfaces. + IsAggr_argContext() +} + +type Aggr_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAggr_argContext() *Aggr_argContext { + var p = new(Aggr_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggr_arg + return p +} + +func InitEmptyAggr_argContext(p *Aggr_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggr_arg +} + +func (*Aggr_argContext) IsAggr_argContext() {} + +func NewAggr_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggr_argContext { + var p = new(Aggr_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_aggr_arg + + return p +} + +func (s *Aggr_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Aggr_argContext) Func_arg() IFunc_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_argContext) +} + +func (s *Aggr_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Aggr_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Aggr_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAggr_arg(s) + } +} + +func (s *Aggr_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAggr_arg(s) + } +} + +func (s *Aggr_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAggr_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Aggr_arg() (localctx IAggr_argContext) { + localctx = NewAggr_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 652, PostgreSQLParserRULE_aggr_arg) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5832) + p.Func_arg() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAggr_argsContext is an interface to support dynamic dispatch. +type IAggr_argsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + STAR() antlr.TerminalNode + AllAggr_args_list() []IAggr_args_listContext + Aggr_args_list(i int) IAggr_args_listContext + ORDER() antlr.TerminalNode + BY() antlr.TerminalNode + + // IsAggr_argsContext differentiates from other interfaces. + IsAggr_argsContext() +} + +type Aggr_argsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAggr_argsContext() *Aggr_argsContext { + var p = new(Aggr_argsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggr_args + return p +} + +func InitEmptyAggr_argsContext(p *Aggr_argsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggr_args +} + +func (*Aggr_argsContext) IsAggr_argsContext() {} + +func NewAggr_argsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggr_argsContext { + var p = new(Aggr_argsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_aggr_args + + return p +} + +func (s *Aggr_argsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Aggr_argsContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Aggr_argsContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Aggr_argsContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *Aggr_argsContext) AllAggr_args_list() []IAggr_args_listContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAggr_args_listContext); ok { + len++ + } + } + + tst := make([]IAggr_args_listContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAggr_args_listContext); ok { + tst[i] = t.(IAggr_args_listContext) + i++ + } + } + + return tst +} + +func (s *Aggr_argsContext) Aggr_args_list(i int) IAggr_args_listContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggr_args_listContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAggr_args_listContext) +} + +func (s *Aggr_argsContext) ORDER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserORDER, 0) +} + +func (s *Aggr_argsContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Aggr_argsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Aggr_argsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Aggr_argsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAggr_args(s) + } +} + +func (s *Aggr_argsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAggr_args(s) + } +} + +func (s *Aggr_argsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAggr_args(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Aggr_args() (localctx IAggr_argsContext) { + localctx = NewAggr_argsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 654, PostgreSQLParserRULE_aggr_args) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5834) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(5845) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 489, p.GetParserRuleContext()) { + case 1: + { + p.SetState(5835) + p.Match(PostgreSQLParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + { + p.SetState(5836) + p.Aggr_args_list() + } + + case 3: + { + p.SetState(5837) + p.Match(PostgreSQLParserORDER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5838) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5839) + p.Aggr_args_list() + } + + case 4: + { + p.SetState(5840) + p.Aggr_args_list() + } + { + p.SetState(5841) + p.Match(PostgreSQLParserORDER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5842) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5843) + p.Aggr_args_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(5847) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAggr_args_listContext is an interface to support dynamic dispatch. +type IAggr_args_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAggr_arg() []IAggr_argContext + Aggr_arg(i int) IAggr_argContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsAggr_args_listContext differentiates from other interfaces. + IsAggr_args_listContext() +} + +type Aggr_args_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAggr_args_listContext() *Aggr_args_listContext { + var p = new(Aggr_args_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggr_args_list + return p +} + +func InitEmptyAggr_args_listContext(p *Aggr_args_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggr_args_list +} + +func (*Aggr_args_listContext) IsAggr_args_listContext() {} + +func NewAggr_args_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggr_args_listContext { + var p = new(Aggr_args_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_aggr_args_list + + return p +} + +func (s *Aggr_args_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Aggr_args_listContext) AllAggr_arg() []IAggr_argContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAggr_argContext); ok { + len++ + } + } + + tst := make([]IAggr_argContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAggr_argContext); ok { + tst[i] = t.(IAggr_argContext) + i++ + } + } + + return tst +} + +func (s *Aggr_args_listContext) Aggr_arg(i int) IAggr_argContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggr_argContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAggr_argContext) +} + +func (s *Aggr_args_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Aggr_args_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Aggr_args_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Aggr_args_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Aggr_args_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAggr_args_list(s) + } +} + +func (s *Aggr_args_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAggr_args_list(s) + } +} + +func (s *Aggr_args_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAggr_args_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Aggr_args_list() (localctx IAggr_args_listContext) { + localctx = NewAggr_args_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 656, PostgreSQLParserRULE_aggr_args_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5849) + p.Aggr_arg() + } + p.SetState(5854) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5850) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5851) + p.Aggr_arg() + } + + p.SetState(5856) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAggregate_with_argtypesContext is an interface to support dynamic dispatch. +type IAggregate_with_argtypesContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_name() IFunc_nameContext + Aggr_args() IAggr_argsContext + + // IsAggregate_with_argtypesContext differentiates from other interfaces. + IsAggregate_with_argtypesContext() +} + +type Aggregate_with_argtypesContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAggregate_with_argtypesContext() *Aggregate_with_argtypesContext { + var p = new(Aggregate_with_argtypesContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggregate_with_argtypes + return p +} + +func InitEmptyAggregate_with_argtypesContext(p *Aggregate_with_argtypesContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggregate_with_argtypes +} + +func (*Aggregate_with_argtypesContext) IsAggregate_with_argtypesContext() {} + +func NewAggregate_with_argtypesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggregate_with_argtypesContext { + var p = new(Aggregate_with_argtypesContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_aggregate_with_argtypes + + return p +} + +func (s *Aggregate_with_argtypesContext) GetParser() antlr.Parser { return s.parser } + +func (s *Aggregate_with_argtypesContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *Aggregate_with_argtypesContext) Aggr_args() IAggr_argsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggr_argsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggr_argsContext) +} + +func (s *Aggregate_with_argtypesContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Aggregate_with_argtypesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Aggregate_with_argtypesContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAggregate_with_argtypes(s) + } +} + +func (s *Aggregate_with_argtypesContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAggregate_with_argtypes(s) + } +} + +func (s *Aggregate_with_argtypesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAggregate_with_argtypes(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Aggregate_with_argtypes() (localctx IAggregate_with_argtypesContext) { + localctx = NewAggregate_with_argtypesContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 658, PostgreSQLParserRULE_aggregate_with_argtypes) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5857) + p.Func_name() + } + { + p.SetState(5858) + p.Aggr_args() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAggregate_with_argtypes_listContext is an interface to support dynamic dispatch. +type IAggregate_with_argtypes_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllAggregate_with_argtypes() []IAggregate_with_argtypesContext + Aggregate_with_argtypes(i int) IAggregate_with_argtypesContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsAggregate_with_argtypes_listContext differentiates from other interfaces. + IsAggregate_with_argtypes_listContext() +} + +type Aggregate_with_argtypes_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAggregate_with_argtypes_listContext() *Aggregate_with_argtypes_listContext { + var p = new(Aggregate_with_argtypes_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggregate_with_argtypes_list + return p +} + +func InitEmptyAggregate_with_argtypes_listContext(p *Aggregate_with_argtypes_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aggregate_with_argtypes_list +} + +func (*Aggregate_with_argtypes_listContext) IsAggregate_with_argtypes_listContext() {} + +func NewAggregate_with_argtypes_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Aggregate_with_argtypes_listContext { + var p = new(Aggregate_with_argtypes_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_aggregate_with_argtypes_list + + return p +} + +func (s *Aggregate_with_argtypes_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Aggregate_with_argtypes_listContext) AllAggregate_with_argtypes() []IAggregate_with_argtypesContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAggregate_with_argtypesContext); ok { + len++ + } + } + + tst := make([]IAggregate_with_argtypesContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAggregate_with_argtypesContext); ok { + tst[i] = t.(IAggregate_with_argtypesContext) + i++ + } + } + + return tst +} + +func (s *Aggregate_with_argtypes_listContext) Aggregate_with_argtypes(i int) IAggregate_with_argtypesContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggregate_with_argtypesContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAggregate_with_argtypesContext) +} + +func (s *Aggregate_with_argtypes_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Aggregate_with_argtypes_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Aggregate_with_argtypes_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Aggregate_with_argtypes_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Aggregate_with_argtypes_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAggregate_with_argtypes_list(s) + } +} + +func (s *Aggregate_with_argtypes_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAggregate_with_argtypes_list(s) + } +} + +func (s *Aggregate_with_argtypes_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAggregate_with_argtypes_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Aggregate_with_argtypes_list() (localctx IAggregate_with_argtypes_listContext) { + localctx = NewAggregate_with_argtypes_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 660, PostgreSQLParserRULE_aggregate_with_argtypes_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5860) + p.Aggregate_with_argtypes() + } + p.SetState(5865) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5861) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5862) + p.Aggregate_with_argtypes() + } + + p.SetState(5867) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatefunc_opt_listContext is an interface to support dynamic dispatch. +type ICreatefunc_opt_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCreatefunc_opt_item() []ICreatefunc_opt_itemContext + Createfunc_opt_item(i int) ICreatefunc_opt_itemContext + + // IsCreatefunc_opt_listContext differentiates from other interfaces. + IsCreatefunc_opt_listContext() +} + +type Createfunc_opt_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatefunc_opt_listContext() *Createfunc_opt_listContext { + var p = new(Createfunc_opt_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createfunc_opt_list + return p +} + +func InitEmptyCreatefunc_opt_listContext(p *Createfunc_opt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createfunc_opt_list +} + +func (*Createfunc_opt_listContext) IsCreatefunc_opt_listContext() {} + +func NewCreatefunc_opt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Createfunc_opt_listContext { + var p = new(Createfunc_opt_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createfunc_opt_list + + return p +} + +func (s *Createfunc_opt_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Createfunc_opt_listContext) AllCreatefunc_opt_item() []ICreatefunc_opt_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICreatefunc_opt_itemContext); ok { + len++ + } + } + + tst := make([]ICreatefunc_opt_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICreatefunc_opt_itemContext); ok { + tst[i] = t.(ICreatefunc_opt_itemContext) + i++ + } + } + + return tst +} + +func (s *Createfunc_opt_listContext) Createfunc_opt_item(i int) ICreatefunc_opt_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatefunc_opt_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICreatefunc_opt_itemContext) +} + +func (s *Createfunc_opt_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Createfunc_opt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Createfunc_opt_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatefunc_opt_list(s) + } +} + +func (s *Createfunc_opt_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatefunc_opt_list(s) + } +} + +func (s *Createfunc_opt_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatefunc_opt_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createfunc_opt_list() (localctx ICreatefunc_opt_listContext) { + localctx = NewCreatefunc_opt_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 662, PostgreSQLParserRULE_createfunc_opt_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(5869) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(5868) + p.Createfunc_opt_item() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(5871) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 492, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + + p.ParseRoutineBody(localctx) + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICommon_func_opt_itemContext is an interface to support dynamic dispatch. +type ICommon_func_opt_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CALLED() antlr.TerminalNode + ON() antlr.TerminalNode + AllNULL_P() []antlr.TerminalNode + NULL_P(i int) antlr.TerminalNode + INPUT_P() antlr.TerminalNode + RETURNS() antlr.TerminalNode + STRICT_P() antlr.TerminalNode + IMMUTABLE() antlr.TerminalNode + STABLE() antlr.TerminalNode + VOLATILE() antlr.TerminalNode + EXTERNAL() antlr.TerminalNode + SECURITY() antlr.TerminalNode + DEFINER() antlr.TerminalNode + INVOKER() antlr.TerminalNode + LEAKPROOF() antlr.TerminalNode + NOT() antlr.TerminalNode + COST() antlr.TerminalNode + Numericonly() INumericonlyContext + ROWS() antlr.TerminalNode + SUPPORT() antlr.TerminalNode + Any_name() IAny_nameContext + Functionsetresetclause() IFunctionsetresetclauseContext + PARALLEL() antlr.TerminalNode + Colid() IColidContext + + // IsCommon_func_opt_itemContext differentiates from other interfaces. + IsCommon_func_opt_itemContext() +} + +type Common_func_opt_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCommon_func_opt_itemContext() *Common_func_opt_itemContext { + var p = new(Common_func_opt_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_common_func_opt_item + return p +} + +func InitEmptyCommon_func_opt_itemContext(p *Common_func_opt_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_common_func_opt_item +} + +func (*Common_func_opt_itemContext) IsCommon_func_opt_itemContext() {} + +func NewCommon_func_opt_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Common_func_opt_itemContext { + var p = new(Common_func_opt_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_common_func_opt_item + + return p +} + +func (s *Common_func_opt_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Common_func_opt_itemContext) CALLED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCALLED, 0) +} + +func (s *Common_func_opt_itemContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Common_func_opt_itemContext) AllNULL_P() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserNULL_P) +} + +func (s *Common_func_opt_itemContext) NULL_P(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, i) +} + +func (s *Common_func_opt_itemContext) INPUT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINPUT_P, 0) +} + +func (s *Common_func_opt_itemContext) RETURNS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRETURNS, 0) +} + +func (s *Common_func_opt_itemContext) STRICT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRICT_P, 0) +} + +func (s *Common_func_opt_itemContext) IMMUTABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMMUTABLE, 0) +} + +func (s *Common_func_opt_itemContext) STABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTABLE, 0) +} + +func (s *Common_func_opt_itemContext) VOLATILE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVOLATILE, 0) +} + +func (s *Common_func_opt_itemContext) EXTERNAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTERNAL, 0) +} + +func (s *Common_func_opt_itemContext) SECURITY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSECURITY, 0) +} + +func (s *Common_func_opt_itemContext) DEFINER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFINER, 0) +} + +func (s *Common_func_opt_itemContext) INVOKER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINVOKER, 0) +} + +func (s *Common_func_opt_itemContext) LEAKPROOF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEAKPROOF, 0) +} + +func (s *Common_func_opt_itemContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Common_func_opt_itemContext) COST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOST, 0) +} + +func (s *Common_func_opt_itemContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Common_func_opt_itemContext) ROWS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROWS, 0) +} + +func (s *Common_func_opt_itemContext) SUPPORT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUPPORT, 0) +} + +func (s *Common_func_opt_itemContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Common_func_opt_itemContext) Functionsetresetclause() IFunctionsetresetclauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunctionsetresetclauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunctionsetresetclauseContext) +} + +func (s *Common_func_opt_itemContext) PARALLEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARALLEL, 0) +} + +func (s *Common_func_opt_itemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Common_func_opt_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Common_func_opt_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Common_func_opt_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCommon_func_opt_item(s) + } +} + +func (s *Common_func_opt_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCommon_func_opt_item(s) + } +} + +func (s *Common_func_opt_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCommon_func_opt_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Common_func_opt_item() (localctx ICommon_func_opt_itemContext) { + localctx = NewCommon_func_opt_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 664, PostgreSQLParserRULE_common_func_opt_item) + p.SetState(5910) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 493, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5875) + p.Match(PostgreSQLParserCALLED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5876) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5877) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5878) + p.Match(PostgreSQLParserINPUT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5879) + p.Match(PostgreSQLParserRETURNS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5880) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5881) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5882) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5883) + p.Match(PostgreSQLParserINPUT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5884) + p.Match(PostgreSQLParserSTRICT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5885) + p.Match(PostgreSQLParserIMMUTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(5886) + p.Match(PostgreSQLParserSTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(5887) + p.Match(PostgreSQLParserVOLATILE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(5888) + p.Match(PostgreSQLParserEXTERNAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5889) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5890) + p.Match(PostgreSQLParserDEFINER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(5891) + p.Match(PostgreSQLParserEXTERNAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5892) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5893) + p.Match(PostgreSQLParserINVOKER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(5894) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5895) + p.Match(PostgreSQLParserDEFINER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(5896) + p.Match(PostgreSQLParserSECURITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5897) + p.Match(PostgreSQLParserINVOKER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(5898) + p.Match(PostgreSQLParserLEAKPROOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(5899) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5900) + p.Match(PostgreSQLParserLEAKPROOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(5901) + p.Match(PostgreSQLParserCOST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5902) + p.Numericonly() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(5903) + p.Match(PostgreSQLParserROWS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5904) + p.Numericonly() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(5905) + p.Match(PostgreSQLParserSUPPORT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5906) + p.Any_name() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(5907) + p.Functionsetresetclause() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(5908) + p.Match(PostgreSQLParserPARALLEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5909) + p.Colid() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatefunc_opt_itemContext is an interface to support dynamic dispatch. +type ICreatefunc_opt_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AS() antlr.TerminalNode + Func_as() IFunc_asContext + BEGIN_P() antlr.TerminalNode + ATOMIC_P() antlr.TerminalNode + Stmtmulti() IStmtmultiContext + END_P() antlr.TerminalNode + LANGUAGE() antlr.TerminalNode + Nonreservedword_or_sconst() INonreservedword_or_sconstContext + TRANSFORM() antlr.TerminalNode + Transform_type_list() ITransform_type_listContext + WINDOW() antlr.TerminalNode + Common_func_opt_item() ICommon_func_opt_itemContext + + // IsCreatefunc_opt_itemContext differentiates from other interfaces. + IsCreatefunc_opt_itemContext() +} + +type Createfunc_opt_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatefunc_opt_itemContext() *Createfunc_opt_itemContext { + var p = new(Createfunc_opt_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createfunc_opt_item + return p +} + +func InitEmptyCreatefunc_opt_itemContext(p *Createfunc_opt_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createfunc_opt_item +} + +func (*Createfunc_opt_itemContext) IsCreatefunc_opt_itemContext() {} + +func NewCreatefunc_opt_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Createfunc_opt_itemContext { + var p = new(Createfunc_opt_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createfunc_opt_item + + return p +} + +func (s *Createfunc_opt_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Createfunc_opt_itemContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Createfunc_opt_itemContext) Func_as() IFunc_asContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_asContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_asContext) +} + +func (s *Createfunc_opt_itemContext) BEGIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBEGIN_P, 0) +} + +func (s *Createfunc_opt_itemContext) ATOMIC_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATOMIC_P, 0) +} + +func (s *Createfunc_opt_itemContext) Stmtmulti() IStmtmultiContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmtmultiContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmtmultiContext) +} + +func (s *Createfunc_opt_itemContext) END_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEND_P, 0) +} + +func (s *Createfunc_opt_itemContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *Createfunc_opt_itemContext) Nonreservedword_or_sconst() INonreservedword_or_sconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedword_or_sconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedword_or_sconstContext) +} + +func (s *Createfunc_opt_itemContext) TRANSFORM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSFORM, 0) +} + +func (s *Createfunc_opt_itemContext) Transform_type_list() ITransform_type_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransform_type_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransform_type_listContext) +} + +func (s *Createfunc_opt_itemContext) WINDOW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWINDOW, 0) +} + +func (s *Createfunc_opt_itemContext) Common_func_opt_item() ICommon_func_opt_itemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICommon_func_opt_itemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICommon_func_opt_itemContext) +} + +func (s *Createfunc_opt_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Createfunc_opt_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Createfunc_opt_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatefunc_opt_item(s) + } +} + +func (s *Createfunc_opt_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatefunc_opt_item(s) + } +} + +func (s *Createfunc_opt_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatefunc_opt_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createfunc_opt_item() (localctx ICreatefunc_opt_itemContext) { + localctx = NewCreatefunc_opt_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 666, PostgreSQLParserRULE_createfunc_opt_item) + p.SetState(5925) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5912) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5913) + p.Func_as() + } + + case PostgreSQLParserBEGIN_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5914) + p.Match(PostgreSQLParserBEGIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5915) + p.Match(PostgreSQLParserATOMIC_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5916) + p.Stmtmulti() + } + { + p.SetState(5917) + p.Match(PostgreSQLParserEND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserLANGUAGE: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5919) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5920) + p.Nonreservedword_or_sconst() + } + + case PostgreSQLParserTRANSFORM: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5921) + p.Match(PostgreSQLParserTRANSFORM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5922) + p.Transform_type_list() + } + + case PostgreSQLParserWINDOW: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(5923) + p.Match(PostgreSQLParserWINDOW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNOT, PostgreSQLParserCALLED, PostgreSQLParserCOST, PostgreSQLParserEXTERNAL, PostgreSQLParserIMMUTABLE, PostgreSQLParserLEAKPROOF, PostgreSQLParserRESET, PostgreSQLParserRETURNS, PostgreSQLParserROWS, PostgreSQLParserSECURITY, PostgreSQLParserSET, PostgreSQLParserSTABLE, PostgreSQLParserSTRICT_P, PostgreSQLParserVOLATILE, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(5924) + p.Common_func_opt_item() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_asContext is an interface to support dynamic dispatch. +type IFunc_asContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // GetDef returns the def rule contexts. + GetDef() ISconstContext + + // SetDef sets the def rule contexts. + SetDef(ISconstContext) + + // GetDefinition returns the Definition attribute. + GetDefinition() antlr.ParserRuleContext + + // SetDefinition sets the Definition attribute. + SetDefinition(antlr.ParserRuleContext) + + // Getter signatures + AllSconst() []ISconstContext + Sconst(i int) ISconstContext + COMMA() antlr.TerminalNode + + // IsFunc_asContext differentiates from other interfaces. + IsFunc_asContext() +} + +type Func_asContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser + Definition antlr.ParserRuleContext + def ISconstContext +} + +func NewEmptyFunc_asContext() *Func_asContext { + var p = new(Func_asContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_as + return p +} + +func InitEmptyFunc_asContext(p *Func_asContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_as +} + +func (*Func_asContext) IsFunc_asContext() {} + +func NewFunc_asContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_asContext { + var p = new(Func_asContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_as + + return p +} + +func (s *Func_asContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_asContext) GetDef() ISconstContext { return s.def } + +func (s *Func_asContext) SetDef(v ISconstContext) { s.def = v } + +func (s *Func_asContext) GetDefinition() antlr.ParserRuleContext { return s.Definition } + +func (s *Func_asContext) SetDefinition(v antlr.ParserRuleContext) { s.Definition = v } + +func (s *Func_asContext) AllSconst() []ISconstContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISconstContext); ok { + len++ + } + } + + tst := make([]ISconstContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISconstContext); ok { + tst[i] = t.(ISconstContext) + i++ + } + } + + return tst +} + +func (s *Func_asContext) Sconst(i int) ISconstContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Func_asContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Func_asContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_asContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_asContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_as(s) + } +} + +func (s *Func_asContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_as(s) + } +} + +func (s *Func_asContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_as(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_as() (localctx IFunc_asContext) { + localctx = NewFunc_asContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 668, PostgreSQLParserRULE_func_as) + p.SetState(5932) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 495, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5927) + + var _x = p.Sconst() + + localctx.(*Func_asContext).def = _x + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5928) + p.Sconst() + } + { + p.SetState(5929) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5930) + p.Sconst() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransform_type_listContext is an interface to support dynamic dispatch. +type ITransform_type_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllFOR() []antlr.TerminalNode + FOR(i int) antlr.TerminalNode + AllTYPE_P() []antlr.TerminalNode + TYPE_P(i int) antlr.TerminalNode + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsTransform_type_listContext differentiates from other interfaces. + IsTransform_type_listContext() +} + +type Transform_type_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransform_type_listContext() *Transform_type_listContext { + var p = new(Transform_type_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transform_type_list + return p +} + +func InitEmptyTransform_type_listContext(p *Transform_type_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transform_type_list +} + +func (*Transform_type_listContext) IsTransform_type_listContext() {} + +func NewTransform_type_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Transform_type_listContext { + var p = new(Transform_type_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transform_type_list + + return p +} + +func (s *Transform_type_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Transform_type_listContext) AllFOR() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserFOR) +} + +func (s *Transform_type_listContext) FOR(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, i) +} + +func (s *Transform_type_listContext) AllTYPE_P() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserTYPE_P) +} + +func (s *Transform_type_listContext) TYPE_P(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, i) +} + +func (s *Transform_type_listContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *Transform_type_listContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Transform_type_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Transform_type_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Transform_type_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Transform_type_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Transform_type_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransform_type_list(s) + } +} + +func (s *Transform_type_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransform_type_list(s) + } +} + +func (s *Transform_type_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransform_type_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transform_type_list() (localctx ITransform_type_listContext) { + localctx = NewTransform_type_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 670, PostgreSQLParserRULE_transform_type_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5934) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5935) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5936) + p.Typename() + } + p.SetState(5943) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5937) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5938) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5939) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5940) + p.Typename() + } + + p.SetState(5945) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_definitionContext is an interface to support dynamic dispatch. +type IOpt_definitionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + Definition() IDefinitionContext + + // IsOpt_definitionContext differentiates from other interfaces. + IsOpt_definitionContext() +} + +type Opt_definitionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_definitionContext() *Opt_definitionContext { + var p = new(Opt_definitionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_definition + return p +} + +func InitEmptyOpt_definitionContext(p *Opt_definitionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_definition +} + +func (*Opt_definitionContext) IsOpt_definitionContext() {} + +func NewOpt_definitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_definitionContext { + var p = new(Opt_definitionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_definition + + return p +} + +func (s *Opt_definitionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_definitionContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_definitionContext) Definition() IDefinitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefinitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefinitionContext) +} + +func (s *Opt_definitionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_definitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_definitionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_definition(s) + } +} + +func (s *Opt_definitionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_definition(s) + } +} + +func (s *Opt_definitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_definition(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_definition() (localctx IOpt_definitionContext) { + localctx = NewOpt_definitionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 672, PostgreSQLParserRULE_opt_definition) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5946) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5947) + p.Definition() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITable_func_columnContext is an interface to support dynamic dispatch. +type ITable_func_columnContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Param_name() IParam_nameContext + Func_type() IFunc_typeContext + + // IsTable_func_columnContext differentiates from other interfaces. + IsTable_func_columnContext() +} + +type Table_func_columnContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTable_func_columnContext() *Table_func_columnContext { + var p = new(Table_func_columnContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_func_column + return p +} + +func InitEmptyTable_func_columnContext(p *Table_func_columnContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_func_column +} + +func (*Table_func_columnContext) IsTable_func_columnContext() {} + +func NewTable_func_columnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_func_columnContext { + var p = new(Table_func_columnContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_table_func_column + + return p +} + +func (s *Table_func_columnContext) GetParser() antlr.Parser { return s.parser } + +func (s *Table_func_columnContext) Param_name() IParam_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IParam_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IParam_nameContext) +} + +func (s *Table_func_columnContext) Func_type() IFunc_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_typeContext) +} + +func (s *Table_func_columnContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Table_func_columnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Table_func_columnContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTable_func_column(s) + } +} + +func (s *Table_func_columnContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTable_func_column(s) + } +} + +func (s *Table_func_columnContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTable_func_column(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Table_func_column() (localctx ITable_func_columnContext) { + localctx = NewTable_func_columnContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 674, PostgreSQLParserRULE_table_func_column) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5949) + p.Param_name() + } + { + p.SetState(5950) + p.Func_type() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITable_func_column_listContext is an interface to support dynamic dispatch. +type ITable_func_column_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTable_func_column() []ITable_func_columnContext + Table_func_column(i int) ITable_func_columnContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsTable_func_column_listContext differentiates from other interfaces. + IsTable_func_column_listContext() +} + +type Table_func_column_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTable_func_column_listContext() *Table_func_column_listContext { + var p = new(Table_func_column_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_func_column_list + return p +} + +func InitEmptyTable_func_column_listContext(p *Table_func_column_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_func_column_list +} + +func (*Table_func_column_listContext) IsTable_func_column_listContext() {} + +func NewTable_func_column_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_func_column_listContext { + var p = new(Table_func_column_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_table_func_column_list + + return p +} + +func (s *Table_func_column_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Table_func_column_listContext) AllTable_func_column() []ITable_func_columnContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITable_func_columnContext); ok { + len++ + } + } + + tst := make([]ITable_func_columnContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITable_func_columnContext); ok { + tst[i] = t.(ITable_func_columnContext) + i++ + } + } + + return tst +} + +func (s *Table_func_column_listContext) Table_func_column(i int) ITable_func_columnContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_func_columnContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITable_func_columnContext) +} + +func (s *Table_func_column_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Table_func_column_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Table_func_column_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Table_func_column_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Table_func_column_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTable_func_column_list(s) + } +} + +func (s *Table_func_column_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTable_func_column_list(s) + } +} + +func (s *Table_func_column_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTable_func_column_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Table_func_column_list() (localctx ITable_func_column_listContext) { + localctx = NewTable_func_column_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 676, PostgreSQLParserRULE_table_func_column_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5952) + p.Table_func_column() + } + p.SetState(5957) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(5953) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5954) + p.Table_func_column() + } + + p.SetState(5959) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterfunctionstmtContext is an interface to support dynamic dispatch. +type IAlterfunctionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + Alterfunc_opt_list() IAlterfunc_opt_listContext + FUNCTION() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + Opt_restrict() IOpt_restrictContext + + // IsAlterfunctionstmtContext differentiates from other interfaces. + IsAlterfunctionstmtContext() +} + +type AlterfunctionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterfunctionstmtContext() *AlterfunctionstmtContext { + var p = new(AlterfunctionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterfunctionstmt + return p +} + +func InitEmptyAlterfunctionstmtContext(p *AlterfunctionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterfunctionstmt +} + +func (*AlterfunctionstmtContext) IsAlterfunctionstmtContext() {} + +func NewAlterfunctionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterfunctionstmtContext { + var p = new(AlterfunctionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterfunctionstmt + + return p +} + +func (s *AlterfunctionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterfunctionstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterfunctionstmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *AlterfunctionstmtContext) Alterfunc_opt_list() IAlterfunc_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlterfunc_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlterfunc_opt_listContext) +} + +func (s *AlterfunctionstmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *AlterfunctionstmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *AlterfunctionstmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *AlterfunctionstmtContext) Opt_restrict() IOpt_restrictContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_restrictContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_restrictContext) +} + +func (s *AlterfunctionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterfunctionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterfunctionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterfunctionstmt(s) + } +} + +func (s *AlterfunctionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterfunctionstmt(s) + } +} + +func (s *AlterfunctionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterfunctionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterfunctionstmt() (localctx IAlterfunctionstmtContext) { + localctx = NewAlterfunctionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 678, PostgreSQLParserRULE_alterfunctionstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5960) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5961) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFUNCTION || _la == PostgreSQLParserPROCEDURE || _la == PostgreSQLParserROUTINE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(5962) + p.Function_with_argtypes() + } + { + p.SetState(5963) + p.Alterfunc_opt_list() + } + p.SetState(5965) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserRESTRICT { + { + p.SetState(5964) + p.Opt_restrict() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterfunc_opt_listContext is an interface to support dynamic dispatch. +type IAlterfunc_opt_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCommon_func_opt_item() []ICommon_func_opt_itemContext + Common_func_opt_item(i int) ICommon_func_opt_itemContext + + // IsAlterfunc_opt_listContext differentiates from other interfaces. + IsAlterfunc_opt_listContext() +} + +type Alterfunc_opt_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterfunc_opt_listContext() *Alterfunc_opt_listContext { + var p = new(Alterfunc_opt_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterfunc_opt_list + return p +} + +func InitEmptyAlterfunc_opt_listContext(p *Alterfunc_opt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterfunc_opt_list +} + +func (*Alterfunc_opt_listContext) IsAlterfunc_opt_listContext() {} + +func NewAlterfunc_opt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alterfunc_opt_listContext { + var p = new(Alterfunc_opt_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterfunc_opt_list + + return p +} + +func (s *Alterfunc_opt_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alterfunc_opt_listContext) AllCommon_func_opt_item() []ICommon_func_opt_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICommon_func_opt_itemContext); ok { + len++ + } + } + + tst := make([]ICommon_func_opt_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICommon_func_opt_itemContext); ok { + tst[i] = t.(ICommon_func_opt_itemContext) + i++ + } + } + + return tst +} + +func (s *Alterfunc_opt_listContext) Common_func_opt_item(i int) ICommon_func_opt_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICommon_func_opt_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICommon_func_opt_itemContext) +} + +func (s *Alterfunc_opt_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alterfunc_opt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alterfunc_opt_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterfunc_opt_list(s) + } +} + +func (s *Alterfunc_opt_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterfunc_opt_list(s) + } +} + +func (s *Alterfunc_opt_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterfunc_opt_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterfunc_opt_list() (localctx IAlterfunc_opt_listContext) { + localctx = NewAlterfunc_opt_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 680, PostgreSQLParserRULE_alterfunc_opt_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(5968) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(5967) + p.Common_func_opt_item() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(5970) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 499, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_restrictContext is an interface to support dynamic dispatch. +type IOpt_restrictContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RESTRICT() antlr.TerminalNode + + // IsOpt_restrictContext differentiates from other interfaces. + IsOpt_restrictContext() +} + +type Opt_restrictContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_restrictContext() *Opt_restrictContext { + var p = new(Opt_restrictContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_restrict + return p +} + +func InitEmptyOpt_restrictContext(p *Opt_restrictContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_restrict +} + +func (*Opt_restrictContext) IsOpt_restrictContext() {} + +func NewOpt_restrictContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_restrictContext { + var p = new(Opt_restrictContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_restrict + + return p +} + +func (s *Opt_restrictContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_restrictContext) RESTRICT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESTRICT, 0) +} + +func (s *Opt_restrictContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_restrictContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_restrictContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_restrict(s) + } +} + +func (s *Opt_restrictContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_restrict(s) + } +} + +func (s *Opt_restrictContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_restrict(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_restrict() (localctx IOpt_restrictContext) { + localctx = NewOpt_restrictContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 682, PostgreSQLParserRULE_opt_restrict) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5972) + p.Match(PostgreSQLParserRESTRICT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRemovefuncstmtContext is an interface to support dynamic dispatch. +type IRemovefuncstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + Function_with_argtypes_list() IFunction_with_argtypes_listContext + Opt_drop_behavior() IOpt_drop_behaviorContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + + // IsRemovefuncstmtContext differentiates from other interfaces. + IsRemovefuncstmtContext() +} + +type RemovefuncstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRemovefuncstmtContext() *RemovefuncstmtContext { + var p = new(RemovefuncstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_removefuncstmt + return p +} + +func InitEmptyRemovefuncstmtContext(p *RemovefuncstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_removefuncstmt +} + +func (*RemovefuncstmtContext) IsRemovefuncstmtContext() {} + +func NewRemovefuncstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RemovefuncstmtContext { + var p = new(RemovefuncstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_removefuncstmt + + return p +} + +func (s *RemovefuncstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RemovefuncstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *RemovefuncstmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *RemovefuncstmtContext) Function_with_argtypes_list() IFunction_with_argtypes_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypes_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypes_listContext) +} + +func (s *RemovefuncstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *RemovefuncstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *RemovefuncstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *RemovefuncstmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *RemovefuncstmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *RemovefuncstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RemovefuncstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RemovefuncstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRemovefuncstmt(s) + } +} + +func (s *RemovefuncstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRemovefuncstmt(s) + } +} + +func (s *RemovefuncstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRemovefuncstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Removefuncstmt() (localctx IRemovefuncstmtContext) { + localctx = NewRemovefuncstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 684, PostgreSQLParserRULE_removefuncstmt) + var _la int + + p.SetState(6016) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 506, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(5974) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5975) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5976) + p.Function_with_argtypes_list() + } + p.SetState(5978) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5977) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(5980) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5981) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5982) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5983) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5984) + p.Function_with_argtypes_list() + } + p.SetState(5986) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5985) + p.Opt_drop_behavior() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(5988) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5989) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5990) + p.Function_with_argtypes_list() + } + p.SetState(5992) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5991) + p.Opt_drop_behavior() + } + + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(5994) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5995) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5996) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5997) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(5998) + p.Function_with_argtypes_list() + } + p.SetState(6000) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(5999) + p.Opt_drop_behavior() + } + + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(6002) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6003) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6004) + p.Function_with_argtypes_list() + } + p.SetState(6006) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6005) + p.Opt_drop_behavior() + } + + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(6008) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6009) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6010) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6011) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6012) + p.Function_with_argtypes_list() + } + p.SetState(6014) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6013) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRemoveaggrstmtContext is an interface to support dynamic dispatch. +type IRemoveaggrstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + AGGREGATE() antlr.TerminalNode + Aggregate_with_argtypes_list() IAggregate_with_argtypes_listContext + Opt_drop_behavior() IOpt_drop_behaviorContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsRemoveaggrstmtContext differentiates from other interfaces. + IsRemoveaggrstmtContext() +} + +type RemoveaggrstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRemoveaggrstmtContext() *RemoveaggrstmtContext { + var p = new(RemoveaggrstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_removeaggrstmt + return p +} + +func InitEmptyRemoveaggrstmtContext(p *RemoveaggrstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_removeaggrstmt +} + +func (*RemoveaggrstmtContext) IsRemoveaggrstmtContext() {} + +func NewRemoveaggrstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RemoveaggrstmtContext { + var p = new(RemoveaggrstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_removeaggrstmt + + return p +} + +func (s *RemoveaggrstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RemoveaggrstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *RemoveaggrstmtContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *RemoveaggrstmtContext) Aggregate_with_argtypes_list() IAggregate_with_argtypes_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggregate_with_argtypes_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggregate_with_argtypes_listContext) +} + +func (s *RemoveaggrstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *RemoveaggrstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *RemoveaggrstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *RemoveaggrstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RemoveaggrstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RemoveaggrstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRemoveaggrstmt(s) + } +} + +func (s *RemoveaggrstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRemoveaggrstmt(s) + } +} + +func (s *RemoveaggrstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRemoveaggrstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Removeaggrstmt() (localctx IRemoveaggrstmtContext) { + localctx = NewRemoveaggrstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 686, PostgreSQLParserRULE_removeaggrstmt) + var _la int + + p.SetState(6032) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 509, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6018) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6019) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6020) + p.Aggregate_with_argtypes_list() + } + p.SetState(6022) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6021) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6024) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6025) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6026) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6027) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6028) + p.Aggregate_with_argtypes_list() + } + p.SetState(6030) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6029) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRemoveoperstmtContext is an interface to support dynamic dispatch. +type IRemoveoperstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + Operator_with_argtypes_list() IOperator_with_argtypes_listContext + Opt_drop_behavior() IOpt_drop_behaviorContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsRemoveoperstmtContext differentiates from other interfaces. + IsRemoveoperstmtContext() +} + +type RemoveoperstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRemoveoperstmtContext() *RemoveoperstmtContext { + var p = new(RemoveoperstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_removeoperstmt + return p +} + +func InitEmptyRemoveoperstmtContext(p *RemoveoperstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_removeoperstmt +} + +func (*RemoveoperstmtContext) IsRemoveoperstmtContext() {} + +func NewRemoveoperstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RemoveoperstmtContext { + var p = new(RemoveoperstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_removeoperstmt + + return p +} + +func (s *RemoveoperstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RemoveoperstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *RemoveoperstmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *RemoveoperstmtContext) Operator_with_argtypes_list() IOperator_with_argtypes_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_with_argtypes_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_with_argtypes_listContext) +} + +func (s *RemoveoperstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *RemoveoperstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *RemoveoperstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *RemoveoperstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RemoveoperstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RemoveoperstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRemoveoperstmt(s) + } +} + +func (s *RemoveoperstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRemoveoperstmt(s) + } +} + +func (s *RemoveoperstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRemoveoperstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Removeoperstmt() (localctx IRemoveoperstmtContext) { + localctx = NewRemoveoperstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 688, PostgreSQLParserRULE_removeoperstmt) + var _la int + + p.SetState(6048) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 512, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6034) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6035) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6036) + p.Operator_with_argtypes_list() + } + p.SetState(6038) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6037) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6040) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6041) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6042) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6043) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6044) + p.Operator_with_argtypes_list() + } + p.SetState(6046) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6045) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOper_argtypesContext is an interface to support dynamic dispatch. +type IOper_argtypesContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + CLOSE_PAREN() antlr.TerminalNode + COMMA() antlr.TerminalNode + NONE() antlr.TerminalNode + + // IsOper_argtypesContext differentiates from other interfaces. + IsOper_argtypesContext() +} + +type Oper_argtypesContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOper_argtypesContext() *Oper_argtypesContext { + var p = new(Oper_argtypesContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_oper_argtypes + return p +} + +func InitEmptyOper_argtypesContext(p *Oper_argtypesContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_oper_argtypes +} + +func (*Oper_argtypesContext) IsOper_argtypesContext() {} + +func NewOper_argtypesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Oper_argtypesContext { + var p = new(Oper_argtypesContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_oper_argtypes + + return p +} + +func (s *Oper_argtypesContext) GetParser() antlr.Parser { return s.parser } + +func (s *Oper_argtypesContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Oper_argtypesContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *Oper_argtypesContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Oper_argtypesContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Oper_argtypesContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Oper_argtypesContext) NONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNONE, 0) +} + +func (s *Oper_argtypesContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Oper_argtypesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Oper_argtypesContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOper_argtypes(s) + } +} + +func (s *Oper_argtypesContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOper_argtypes(s) + } +} + +func (s *Oper_argtypesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOper_argtypes(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Oper_argtypes() (localctx IOper_argtypesContext) { + localctx = NewOper_argtypesContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 690, PostgreSQLParserRULE_oper_argtypes) + p.SetState(6072) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 513, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6050) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6051) + p.Typename() + } + { + p.SetState(6052) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6054) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6055) + p.Typename() + } + { + p.SetState(6056) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6057) + p.Typename() + } + { + p.SetState(6058) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(6060) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6061) + p.Match(PostgreSQLParserNONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6062) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6063) + p.Typename() + } + { + p.SetState(6064) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(6066) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6067) + p.Typename() + } + { + p.SetState(6068) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6069) + p.Match(PostgreSQLParserNONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6070) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAny_operatorContext is an interface to support dynamic dispatch. +type IAny_operatorContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + All_op() IAll_opContext + AllColid() []IColidContext + Colid(i int) IColidContext + AllDOT() []antlr.TerminalNode + DOT(i int) antlr.TerminalNode + + // IsAny_operatorContext differentiates from other interfaces. + IsAny_operatorContext() +} + +type Any_operatorContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAny_operatorContext() *Any_operatorContext { + var p = new(Any_operatorContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_operator + return p +} + +func InitEmptyAny_operatorContext(p *Any_operatorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_operator +} + +func (*Any_operatorContext) IsAny_operatorContext() {} + +func NewAny_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Any_operatorContext { + var p = new(Any_operatorContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_any_operator + + return p +} + +func (s *Any_operatorContext) GetParser() antlr.Parser { return s.parser } + +func (s *Any_operatorContext) All_op() IAll_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAll_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAll_opContext) +} + +func (s *Any_operatorContext) AllColid() []IColidContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IColidContext); ok { + len++ + } + } + + tst := make([]IColidContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IColidContext); ok { + tst[i] = t.(IColidContext) + i++ + } + } + + return tst +} + +func (s *Any_operatorContext) Colid(i int) IColidContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Any_operatorContext) AllDOT() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserDOT) +} + +func (s *Any_operatorContext) DOT(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOT, i) +} + +func (s *Any_operatorContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Any_operatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Any_operatorContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAny_operator(s) + } +} + +func (s *Any_operatorContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAny_operator(s) + } +} + +func (s *Any_operatorContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAny_operator(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Any_operator() (localctx IAny_operatorContext) { + localctx = NewAny_operatorContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 692, PostgreSQLParserRULE_any_operator) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(6079) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(6074) + p.Colid() + } + { + p.SetState(6075) + p.Match(PostgreSQLParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + p.SetState(6081) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(6082) + p.All_op() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOperator_with_argtypes_listContext is an interface to support dynamic dispatch. +type IOperator_with_argtypes_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllOperator_with_argtypes() []IOperator_with_argtypesContext + Operator_with_argtypes(i int) IOperator_with_argtypesContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOperator_with_argtypes_listContext differentiates from other interfaces. + IsOperator_with_argtypes_listContext() +} + +type Operator_with_argtypes_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOperator_with_argtypes_listContext() *Operator_with_argtypes_listContext { + var p = new(Operator_with_argtypes_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_with_argtypes_list + return p +} + +func InitEmptyOperator_with_argtypes_listContext(p *Operator_with_argtypes_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_with_argtypes_list +} + +func (*Operator_with_argtypes_listContext) IsOperator_with_argtypes_listContext() {} + +func NewOperator_with_argtypes_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Operator_with_argtypes_listContext { + var p = new(Operator_with_argtypes_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_operator_with_argtypes_list + + return p +} + +func (s *Operator_with_argtypes_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Operator_with_argtypes_listContext) AllOperator_with_argtypes() []IOperator_with_argtypesContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOperator_with_argtypesContext); ok { + len++ + } + } + + tst := make([]IOperator_with_argtypesContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOperator_with_argtypesContext); ok { + tst[i] = t.(IOperator_with_argtypesContext) + i++ + } + } + + return tst +} + +func (s *Operator_with_argtypes_listContext) Operator_with_argtypes(i int) IOperator_with_argtypesContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_with_argtypesContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOperator_with_argtypesContext) +} + +func (s *Operator_with_argtypes_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Operator_with_argtypes_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Operator_with_argtypes_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Operator_with_argtypes_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Operator_with_argtypes_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOperator_with_argtypes_list(s) + } +} + +func (s *Operator_with_argtypes_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOperator_with_argtypes_list(s) + } +} + +func (s *Operator_with_argtypes_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOperator_with_argtypes_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Operator_with_argtypes_list() (localctx IOperator_with_argtypes_listContext) { + localctx = NewOperator_with_argtypes_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 694, PostgreSQLParserRULE_operator_with_argtypes_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6084) + p.Operator_with_argtypes() + } + p.SetState(6089) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(6085) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6086) + p.Operator_with_argtypes() + } + + p.SetState(6091) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOperator_with_argtypesContext is an interface to support dynamic dispatch. +type IOperator_with_argtypesContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Any_operator() IAny_operatorContext + Oper_argtypes() IOper_argtypesContext + + // IsOperator_with_argtypesContext differentiates from other interfaces. + IsOperator_with_argtypesContext() +} + +type Operator_with_argtypesContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOperator_with_argtypesContext() *Operator_with_argtypesContext { + var p = new(Operator_with_argtypesContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_with_argtypes + return p +} + +func InitEmptyOperator_with_argtypesContext(p *Operator_with_argtypesContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_with_argtypes +} + +func (*Operator_with_argtypesContext) IsOperator_with_argtypesContext() {} + +func NewOperator_with_argtypesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Operator_with_argtypesContext { + var p = new(Operator_with_argtypesContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_operator_with_argtypes + + return p +} + +func (s *Operator_with_argtypesContext) GetParser() antlr.Parser { return s.parser } + +func (s *Operator_with_argtypesContext) Any_operator() IAny_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_operatorContext) +} + +func (s *Operator_with_argtypesContext) Oper_argtypes() IOper_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOper_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOper_argtypesContext) +} + +func (s *Operator_with_argtypesContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Operator_with_argtypesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Operator_with_argtypesContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOperator_with_argtypes(s) + } +} + +func (s *Operator_with_argtypesContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOperator_with_argtypes(s) + } +} + +func (s *Operator_with_argtypesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOperator_with_argtypes(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Operator_with_argtypes() (localctx IOperator_with_argtypesContext) { + localctx = NewOperator_with_argtypesContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 696, PostgreSQLParserRULE_operator_with_argtypes) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6092) + p.Any_operator() + } + { + p.SetState(6093) + p.Oper_argtypes() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDostmtContext is an interface to support dynamic dispatch. +type IDostmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DO() antlr.TerminalNode + Dostmt_opt_list() IDostmt_opt_listContext + + // IsDostmtContext differentiates from other interfaces. + IsDostmtContext() +} + +type DostmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDostmtContext() *DostmtContext { + var p = new(DostmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dostmt + return p +} + +func InitEmptyDostmtContext(p *DostmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dostmt +} + +func (*DostmtContext) IsDostmtContext() {} + +func NewDostmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DostmtContext { + var p = new(DostmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dostmt + + return p +} + +func (s *DostmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DostmtContext) DO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDO, 0) +} + +func (s *DostmtContext) Dostmt_opt_list() IDostmt_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDostmt_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDostmt_opt_listContext) +} + +func (s *DostmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DostmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DostmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDostmt(s) + } +} + +func (s *DostmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDostmt(s) + } +} + +func (s *DostmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDostmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dostmt() (localctx IDostmtContext) { + localctx = NewDostmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 698, PostgreSQLParserRULE_dostmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6095) + p.Match(PostgreSQLParserDO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6096) + p.Dostmt_opt_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDostmt_opt_listContext is an interface to support dynamic dispatch. +type IDostmt_opt_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllDostmt_opt_item() []IDostmt_opt_itemContext + Dostmt_opt_item(i int) IDostmt_opt_itemContext + + // IsDostmt_opt_listContext differentiates from other interfaces. + IsDostmt_opt_listContext() +} + +type Dostmt_opt_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDostmt_opt_listContext() *Dostmt_opt_listContext { + var p = new(Dostmt_opt_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dostmt_opt_list + return p +} + +func InitEmptyDostmt_opt_listContext(p *Dostmt_opt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dostmt_opt_list +} + +func (*Dostmt_opt_listContext) IsDostmt_opt_listContext() {} + +func NewDostmt_opt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Dostmt_opt_listContext { + var p = new(Dostmt_opt_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dostmt_opt_list + + return p +} + +func (s *Dostmt_opt_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Dostmt_opt_listContext) AllDostmt_opt_item() []IDostmt_opt_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IDostmt_opt_itemContext); ok { + len++ + } + } + + tst := make([]IDostmt_opt_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IDostmt_opt_itemContext); ok { + tst[i] = t.(IDostmt_opt_itemContext) + i++ + } + } + + return tst +} + +func (s *Dostmt_opt_listContext) Dostmt_opt_item(i int) IDostmt_opt_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDostmt_opt_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IDostmt_opt_itemContext) +} + +func (s *Dostmt_opt_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Dostmt_opt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Dostmt_opt_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDostmt_opt_list(s) + } +} + +func (s *Dostmt_opt_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDostmt_opt_list(s) + } +} + +func (s *Dostmt_opt_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDostmt_opt_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dostmt_opt_list() (localctx IDostmt_opt_listContext) { + localctx = NewDostmt_opt_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 700, PostgreSQLParserRULE_dostmt_opt_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(6099) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == PostgreSQLParserLANGUAGE || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67108885) != 0) { + { + p.SetState(6098) + p.Dostmt_opt_item() + } + + p.SetState(6101) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDostmt_opt_itemContext is an interface to support dynamic dispatch. +type IDostmt_opt_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + LANGUAGE() antlr.TerminalNode + Nonreservedword_or_sconst() INonreservedword_or_sconstContext + + // IsDostmt_opt_itemContext differentiates from other interfaces. + IsDostmt_opt_itemContext() +} + +type Dostmt_opt_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDostmt_opt_itemContext() *Dostmt_opt_itemContext { + var p = new(Dostmt_opt_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dostmt_opt_item + return p +} + +func InitEmptyDostmt_opt_itemContext(p *Dostmt_opt_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dostmt_opt_item +} + +func (*Dostmt_opt_itemContext) IsDostmt_opt_itemContext() {} + +func NewDostmt_opt_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Dostmt_opt_itemContext { + var p = new(Dostmt_opt_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dostmt_opt_item + + return p +} + +func (s *Dostmt_opt_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Dostmt_opt_itemContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Dostmt_opt_itemContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *Dostmt_opt_itemContext) Nonreservedword_or_sconst() INonreservedword_or_sconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedword_or_sconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedword_or_sconstContext) +} + +func (s *Dostmt_opt_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Dostmt_opt_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Dostmt_opt_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDostmt_opt_item(s) + } +} + +func (s *Dostmt_opt_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDostmt_opt_item(s) + } +} + +func (s *Dostmt_opt_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDostmt_opt_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dostmt_opt_item() (localctx IDostmt_opt_itemContext) { + localctx = NewDostmt_opt_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 702, PostgreSQLParserRULE_dostmt_opt_item) + p.SetState(6106) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6103) + p.Sconst() + } + + case PostgreSQLParserLANGUAGE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6104) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6105) + p.Nonreservedword_or_sconst() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatecaststmtContext is an interface to support dynamic dispatch. +type ICreatecaststmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + CAST() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + AS() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + WITH() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + Cast_context() ICast_contextContext + WITHOUT() antlr.TerminalNode + INOUT() antlr.TerminalNode + + // IsCreatecaststmtContext differentiates from other interfaces. + IsCreatecaststmtContext() +} + +type CreatecaststmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatecaststmtContext() *CreatecaststmtContext { + var p = new(CreatecaststmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createcaststmt + return p +} + +func InitEmptyCreatecaststmtContext(p *CreatecaststmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createcaststmt +} + +func (*CreatecaststmtContext) IsCreatecaststmtContext() {} + +func NewCreatecaststmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatecaststmtContext { + var p = new(CreatecaststmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createcaststmt + + return p +} + +func (s *CreatecaststmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatecaststmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatecaststmtContext) CAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCAST, 0) +} + +func (s *CreatecaststmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CreatecaststmtContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *CreatecaststmtContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *CreatecaststmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *CreatecaststmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CreatecaststmtContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *CreatecaststmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *CreatecaststmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *CreatecaststmtContext) Cast_context() ICast_contextContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICast_contextContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICast_contextContext) +} + +func (s *CreatecaststmtContext) WITHOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITHOUT, 0) +} + +func (s *CreatecaststmtContext) INOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINOUT, 0) +} + +func (s *CreatecaststmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatecaststmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatecaststmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatecaststmt(s) + } +} + +func (s *CreatecaststmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatecaststmt(s) + } +} + +func (s *CreatecaststmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatecaststmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createcaststmt() (localctx ICreatecaststmtContext) { + localctx = NewCreatecaststmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 704, PostgreSQLParserRULE_createcaststmt) + var _la int + + p.SetState(6145) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 521, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6108) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6109) + p.Match(PostgreSQLParserCAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6110) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6111) + p.Typename() + } + { + p.SetState(6112) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6113) + p.Typename() + } + { + p.SetState(6114) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6115) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6116) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6117) + p.Function_with_argtypes() + } + p.SetState(6119) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(6118) + p.Cast_context() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6121) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6122) + p.Match(PostgreSQLParserCAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6123) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6124) + p.Typename() + } + { + p.SetState(6125) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6126) + p.Typename() + } + { + p.SetState(6127) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6128) + p.Match(PostgreSQLParserWITHOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6129) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6131) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(6130) + p.Cast_context() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(6133) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6134) + p.Match(PostgreSQLParserCAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6135) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6136) + p.Typename() + } + { + p.SetState(6137) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6138) + p.Typename() + } + { + p.SetState(6139) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6140) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6141) + p.Match(PostgreSQLParserINOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6143) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(6142) + p.Cast_context() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICast_contextContext is an interface to support dynamic dispatch. +type ICast_contextContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AS() antlr.TerminalNode + IMPLICIT_P() antlr.TerminalNode + ASSIGNMENT() antlr.TerminalNode + + // IsCast_contextContext differentiates from other interfaces. + IsCast_contextContext() +} + +type Cast_contextContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCast_contextContext() *Cast_contextContext { + var p = new(Cast_contextContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cast_context + return p +} + +func InitEmptyCast_contextContext(p *Cast_contextContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cast_context +} + +func (*Cast_contextContext) IsCast_contextContext() {} + +func NewCast_contextContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cast_contextContext { + var p = new(Cast_contextContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_cast_context + + return p +} + +func (s *Cast_contextContext) GetParser() antlr.Parser { return s.parser } + +func (s *Cast_contextContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Cast_contextContext) IMPLICIT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMPLICIT_P, 0) +} + +func (s *Cast_contextContext) ASSIGNMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASSIGNMENT, 0) +} + +func (s *Cast_contextContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Cast_contextContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Cast_contextContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCast_context(s) + } +} + +func (s *Cast_contextContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCast_context(s) + } +} + +func (s *Cast_contextContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCast_context(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Cast_context() (localctx ICast_contextContext) { + localctx = NewCast_contextContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 706, PostgreSQLParserRULE_cast_context) + p.SetState(6151) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 522, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6147) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6148) + p.Match(PostgreSQLParserIMPLICIT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6149) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6150) + p.Match(PostgreSQLParserASSIGNMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDropcaststmtContext is an interface to support dynamic dispatch. +type IDropcaststmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + CAST() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + AS() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + Opt_if_exists() IOpt_if_existsContext + Opt_drop_behavior() IOpt_drop_behaviorContext + + // IsDropcaststmtContext differentiates from other interfaces. + IsDropcaststmtContext() +} + +type DropcaststmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDropcaststmtContext() *DropcaststmtContext { + var p = new(DropcaststmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropcaststmt + return p +} + +func InitEmptyDropcaststmtContext(p *DropcaststmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropcaststmt +} + +func (*DropcaststmtContext) IsDropcaststmtContext() {} + +func NewDropcaststmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropcaststmtContext { + var p = new(DropcaststmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dropcaststmt + + return p +} + +func (s *DropcaststmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DropcaststmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DropcaststmtContext) CAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCAST, 0) +} + +func (s *DropcaststmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *DropcaststmtContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *DropcaststmtContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *DropcaststmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *DropcaststmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *DropcaststmtContext) Opt_if_exists() IOpt_if_existsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_if_existsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_if_existsContext) +} + +func (s *DropcaststmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *DropcaststmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DropcaststmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DropcaststmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDropcaststmt(s) + } +} + +func (s *DropcaststmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDropcaststmt(s) + } +} + +func (s *DropcaststmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDropcaststmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dropcaststmt() (localctx IDropcaststmtContext) { + localctx = NewDropcaststmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 708, PostgreSQLParserRULE_dropcaststmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6153) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6154) + p.Match(PostgreSQLParserCAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6156) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserIF_P { + { + p.SetState(6155) + p.Opt_if_exists() + } + + } + { + p.SetState(6158) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6159) + p.Typename() + } + { + p.SetState(6160) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6161) + p.Typename() + } + { + p.SetState(6162) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6164) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6163) + p.Opt_drop_behavior() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_if_existsContext is an interface to support dynamic dispatch. +type IOpt_if_existsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsOpt_if_existsContext differentiates from other interfaces. + IsOpt_if_existsContext() +} + +type Opt_if_existsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_if_existsContext() *Opt_if_existsContext { + var p = new(Opt_if_existsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_if_exists + return p +} + +func InitEmptyOpt_if_existsContext(p *Opt_if_existsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_if_exists +} + +func (*Opt_if_existsContext) IsOpt_if_existsContext() {} + +func NewOpt_if_existsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_if_existsContext { + var p = new(Opt_if_existsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_if_exists + + return p +} + +func (s *Opt_if_existsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_if_existsContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *Opt_if_existsContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *Opt_if_existsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_if_existsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_if_existsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_if_exists(s) + } +} + +func (s *Opt_if_existsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_if_exists(s) + } +} + +func (s *Opt_if_existsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_if_exists(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_if_exists() (localctx IOpt_if_existsContext) { + localctx = NewOpt_if_existsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 710, PostgreSQLParserRULE_opt_if_exists) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6166) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6167) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatetransformstmtContext is an interface to support dynamic dispatch. +type ICreatetransformstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + TRANSFORM() antlr.TerminalNode + FOR() antlr.TerminalNode + Typename() ITypenameContext + LANGUAGE() antlr.TerminalNode + Name() INameContext + OPEN_PAREN() antlr.TerminalNode + Transform_element_list() ITransform_element_listContext + CLOSE_PAREN() antlr.TerminalNode + Opt_or_replace() IOpt_or_replaceContext + + // IsCreatetransformstmtContext differentiates from other interfaces. + IsCreatetransformstmtContext() +} + +type CreatetransformstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatetransformstmtContext() *CreatetransformstmtContext { + var p = new(CreatetransformstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createtransformstmt + return p +} + +func InitEmptyCreatetransformstmtContext(p *CreatetransformstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createtransformstmt +} + +func (*CreatetransformstmtContext) IsCreatetransformstmtContext() {} + +func NewCreatetransformstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatetransformstmtContext { + var p = new(CreatetransformstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createtransformstmt + + return p +} + +func (s *CreatetransformstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatetransformstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatetransformstmtContext) TRANSFORM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSFORM, 0) +} + +func (s *CreatetransformstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *CreatetransformstmtContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *CreatetransformstmtContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *CreatetransformstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreatetransformstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CreatetransformstmtContext) Transform_element_list() ITransform_element_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransform_element_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransform_element_listContext) +} + +func (s *CreatetransformstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CreatetransformstmtContext) Opt_or_replace() IOpt_or_replaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_or_replaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_or_replaceContext) +} + +func (s *CreatetransformstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatetransformstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatetransformstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatetransformstmt(s) + } +} + +func (s *CreatetransformstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatetransformstmt(s) + } +} + +func (s *CreatetransformstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatetransformstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createtransformstmt() (localctx ICreatetransformstmtContext) { + localctx = NewCreatetransformstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 712, PostgreSQLParserRULE_createtransformstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6169) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6171) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOR { + { + p.SetState(6170) + p.Opt_or_replace() + } + + } + { + p.SetState(6173) + p.Match(PostgreSQLParserTRANSFORM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6174) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6175) + p.Typename() + } + { + p.SetState(6176) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6177) + p.Name() + } + { + p.SetState(6178) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6179) + p.Transform_element_list() + } + { + p.SetState(6180) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransform_element_listContext is an interface to support dynamic dispatch. +type ITransform_element_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FROM() antlr.TerminalNode + AllSQL_P() []antlr.TerminalNode + SQL_P(i int) antlr.TerminalNode + AllWITH() []antlr.TerminalNode + WITH(i int) antlr.TerminalNode + AllFUNCTION() []antlr.TerminalNode + FUNCTION(i int) antlr.TerminalNode + AllFunction_with_argtypes() []IFunction_with_argtypesContext + Function_with_argtypes(i int) IFunction_with_argtypesContext + COMMA() antlr.TerminalNode + TO() antlr.TerminalNode + + // IsTransform_element_listContext differentiates from other interfaces. + IsTransform_element_listContext() +} + +type Transform_element_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransform_element_listContext() *Transform_element_listContext { + var p = new(Transform_element_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transform_element_list + return p +} + +func InitEmptyTransform_element_listContext(p *Transform_element_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transform_element_list +} + +func (*Transform_element_listContext) IsTransform_element_listContext() {} + +func NewTransform_element_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Transform_element_listContext { + var p = new(Transform_element_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transform_element_list + + return p +} + +func (s *Transform_element_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Transform_element_listContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Transform_element_listContext) AllSQL_P() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserSQL_P) +} + +func (s *Transform_element_listContext) SQL_P(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSQL_P, i) +} + +func (s *Transform_element_listContext) AllWITH() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserWITH) +} + +func (s *Transform_element_listContext) WITH(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, i) +} + +func (s *Transform_element_listContext) AllFUNCTION() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserFUNCTION) +} + +func (s *Transform_element_listContext) FUNCTION(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, i) +} + +func (s *Transform_element_listContext) AllFunction_with_argtypes() []IFunction_with_argtypesContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + len++ + } + } + + tst := make([]IFunction_with_argtypesContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFunction_with_argtypesContext); ok { + tst[i] = t.(IFunction_with_argtypesContext) + i++ + } + } + + return tst +} + +func (s *Transform_element_listContext) Function_with_argtypes(i int) IFunction_with_argtypesContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *Transform_element_listContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Transform_element_listContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Transform_element_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Transform_element_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Transform_element_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransform_element_list(s) + } +} + +func (s *Transform_element_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransform_element_list(s) + } +} + +func (s *Transform_element_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransform_element_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transform_element_list() (localctx ITransform_element_listContext) { + localctx = NewTransform_element_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 714, PostgreSQLParserRULE_transform_element_list) + p.SetState(6216) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 526, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6182) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6183) + p.Match(PostgreSQLParserSQL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6184) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6185) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6186) + p.Function_with_argtypes() + } + { + p.SetState(6187) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6188) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6189) + p.Match(PostgreSQLParserSQL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6190) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6191) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6192) + p.Function_with_argtypes() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6194) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6195) + p.Match(PostgreSQLParserSQL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6196) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6197) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6198) + p.Function_with_argtypes() + } + { + p.SetState(6199) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6200) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6201) + p.Match(PostgreSQLParserSQL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6202) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6203) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6204) + p.Function_with_argtypes() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(6206) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6207) + p.Match(PostgreSQLParserSQL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6208) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6209) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6210) + p.Function_with_argtypes() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(6211) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6212) + p.Match(PostgreSQLParserSQL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6213) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6214) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6215) + p.Function_with_argtypes() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDroptransformstmtContext is an interface to support dynamic dispatch. +type IDroptransformstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + TRANSFORM() antlr.TerminalNode + FOR() antlr.TerminalNode + Typename() ITypenameContext + LANGUAGE() antlr.TerminalNode + Name() INameContext + Opt_if_exists() IOpt_if_existsContext + Opt_drop_behavior() IOpt_drop_behaviorContext + + // IsDroptransformstmtContext differentiates from other interfaces. + IsDroptransformstmtContext() +} + +type DroptransformstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDroptransformstmtContext() *DroptransformstmtContext { + var p = new(DroptransformstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_droptransformstmt + return p +} + +func InitEmptyDroptransformstmtContext(p *DroptransformstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_droptransformstmt +} + +func (*DroptransformstmtContext) IsDroptransformstmtContext() {} + +func NewDroptransformstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DroptransformstmtContext { + var p = new(DroptransformstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_droptransformstmt + + return p +} + +func (s *DroptransformstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DroptransformstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DroptransformstmtContext) TRANSFORM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSFORM, 0) +} + +func (s *DroptransformstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *DroptransformstmtContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *DroptransformstmtContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *DroptransformstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DroptransformstmtContext) Opt_if_exists() IOpt_if_existsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_if_existsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_if_existsContext) +} + +func (s *DroptransformstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *DroptransformstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DroptransformstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DroptransformstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDroptransformstmt(s) + } +} + +func (s *DroptransformstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDroptransformstmt(s) + } +} + +func (s *DroptransformstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDroptransformstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Droptransformstmt() (localctx IDroptransformstmtContext) { + localctx = NewDroptransformstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 716, PostgreSQLParserRULE_droptransformstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6218) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6219) + p.Match(PostgreSQLParserTRANSFORM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6221) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserIF_P { + { + p.SetState(6220) + p.Opt_if_exists() + } + + } + { + p.SetState(6223) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6224) + p.Typename() + } + { + p.SetState(6225) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6226) + p.Name() + } + p.SetState(6228) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6227) + p.Opt_drop_behavior() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReindexstmtContext is an interface to support dynamic dispatch. +type IReindexstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + REINDEX() antlr.TerminalNode + Reindex_target_type() IReindex_target_typeContext + Qualified_name() IQualified_nameContext + Opt_concurrently() IOpt_concurrentlyContext + Reindex_target_multitable() IReindex_target_multitableContext + Name() INameContext + OPEN_PAREN() antlr.TerminalNode + Reindex_option_list() IReindex_option_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsReindexstmtContext differentiates from other interfaces. + IsReindexstmtContext() +} + +type ReindexstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReindexstmtContext() *ReindexstmtContext { + var p = new(ReindexstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindexstmt + return p +} + +func InitEmptyReindexstmtContext(p *ReindexstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindexstmt +} + +func (*ReindexstmtContext) IsReindexstmtContext() {} + +func NewReindexstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ReindexstmtContext { + var p = new(ReindexstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reindexstmt + + return p +} + +func (s *ReindexstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ReindexstmtContext) REINDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREINDEX, 0) +} + +func (s *ReindexstmtContext) Reindex_target_type() IReindex_target_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReindex_target_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReindex_target_typeContext) +} + +func (s *ReindexstmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *ReindexstmtContext) Opt_concurrently() IOpt_concurrentlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_concurrentlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_concurrentlyContext) +} + +func (s *ReindexstmtContext) Reindex_target_multitable() IReindex_target_multitableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReindex_target_multitableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReindex_target_multitableContext) +} + +func (s *ReindexstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *ReindexstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ReindexstmtContext) Reindex_option_list() IReindex_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReindex_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReindex_option_listContext) +} + +func (s *ReindexstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ReindexstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ReindexstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ReindexstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReindexstmt(s) + } +} + +func (s *ReindexstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReindexstmt(s) + } +} + +func (s *ReindexstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReindexstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reindexstmt() (localctx IReindexstmtContext) { + localctx = NewReindexstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 718, PostgreSQLParserRULE_reindexstmt) + var _la int + + p.SetState(6264) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 533, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6230) + p.Match(PostgreSQLParserREINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6231) + p.Reindex_target_type() + } + p.SetState(6233) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCONCURRENTLY { + { + p.SetState(6232) + p.Opt_concurrently() + } + + } + { + p.SetState(6235) + p.Qualified_name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6237) + p.Match(PostgreSQLParserREINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6238) + p.Reindex_target_multitable() + } + p.SetState(6240) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCONCURRENTLY { + { + p.SetState(6239) + p.Opt_concurrently() + } + + } + { + p.SetState(6242) + p.Name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(6244) + p.Match(PostgreSQLParserREINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6245) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6246) + p.Reindex_option_list() + } + { + p.SetState(6247) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6248) + p.Reindex_target_type() + } + p.SetState(6250) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCONCURRENTLY { + { + p.SetState(6249) + p.Opt_concurrently() + } + + } + { + p.SetState(6252) + p.Qualified_name() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(6254) + p.Match(PostgreSQLParserREINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6255) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6256) + p.Reindex_option_list() + } + { + p.SetState(6257) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6258) + p.Reindex_target_multitable() + } + p.SetState(6260) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCONCURRENTLY { + { + p.SetState(6259) + p.Opt_concurrently() + } + + } + { + p.SetState(6262) + p.Name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReindex_target_typeContext is an interface to support dynamic dispatch. +type IReindex_target_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INDEX() antlr.TerminalNode + TABLE() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + DATABASE() antlr.TerminalNode + SYSTEM_P() antlr.TerminalNode + + // IsReindex_target_typeContext differentiates from other interfaces. + IsReindex_target_typeContext() +} + +type Reindex_target_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReindex_target_typeContext() *Reindex_target_typeContext { + var p = new(Reindex_target_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindex_target_type + return p +} + +func InitEmptyReindex_target_typeContext(p *Reindex_target_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindex_target_type +} + +func (*Reindex_target_typeContext) IsReindex_target_typeContext() {} + +func NewReindex_target_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reindex_target_typeContext { + var p = new(Reindex_target_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reindex_target_type + + return p +} + +func (s *Reindex_target_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Reindex_target_typeContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *Reindex_target_typeContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Reindex_target_typeContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Reindex_target_typeContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *Reindex_target_typeContext) SYSTEM_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYSTEM_P, 0) +} + +func (s *Reindex_target_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Reindex_target_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Reindex_target_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReindex_target_type(s) + } +} + +func (s *Reindex_target_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReindex_target_type(s) + } +} + +func (s *Reindex_target_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReindex_target_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reindex_target_type() (localctx IReindex_target_typeContext) { + localctx = NewReindex_target_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 720, PostgreSQLParserRULE_reindex_target_type) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6266) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTABLE || _la == PostgreSQLParserDATABASE || _la == PostgreSQLParserINDEX || _la == PostgreSQLParserSCHEMA || _la == PostgreSQLParserSYSTEM_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReindex_target_multitableContext is an interface to support dynamic dispatch. +type IReindex_target_multitableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SCHEMA() antlr.TerminalNode + SYSTEM_P() antlr.TerminalNode + DATABASE() antlr.TerminalNode + + // IsReindex_target_multitableContext differentiates from other interfaces. + IsReindex_target_multitableContext() +} + +type Reindex_target_multitableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReindex_target_multitableContext() *Reindex_target_multitableContext { + var p = new(Reindex_target_multitableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindex_target_multitable + return p +} + +func InitEmptyReindex_target_multitableContext(p *Reindex_target_multitableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindex_target_multitable +} + +func (*Reindex_target_multitableContext) IsReindex_target_multitableContext() {} + +func NewReindex_target_multitableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reindex_target_multitableContext { + var p = new(Reindex_target_multitableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reindex_target_multitable + + return p +} + +func (s *Reindex_target_multitableContext) GetParser() antlr.Parser { return s.parser } + +func (s *Reindex_target_multitableContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Reindex_target_multitableContext) SYSTEM_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYSTEM_P, 0) +} + +func (s *Reindex_target_multitableContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *Reindex_target_multitableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Reindex_target_multitableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Reindex_target_multitableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReindex_target_multitable(s) + } +} + +func (s *Reindex_target_multitableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReindex_target_multitable(s) + } +} + +func (s *Reindex_target_multitableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReindex_target_multitable(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reindex_target_multitable() (localctx IReindex_target_multitableContext) { + localctx = NewReindex_target_multitableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 722, PostgreSQLParserRULE_reindex_target_multitable) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6268) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserDATABASE || _la == PostgreSQLParserSCHEMA || _la == PostgreSQLParserSYSTEM_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReindex_option_listContext is an interface to support dynamic dispatch. +type IReindex_option_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllReindex_option_elem() []IReindex_option_elemContext + Reindex_option_elem(i int) IReindex_option_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsReindex_option_listContext differentiates from other interfaces. + IsReindex_option_listContext() +} + +type Reindex_option_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReindex_option_listContext() *Reindex_option_listContext { + var p = new(Reindex_option_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindex_option_list + return p +} + +func InitEmptyReindex_option_listContext(p *Reindex_option_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindex_option_list +} + +func (*Reindex_option_listContext) IsReindex_option_listContext() {} + +func NewReindex_option_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reindex_option_listContext { + var p = new(Reindex_option_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reindex_option_list + + return p +} + +func (s *Reindex_option_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Reindex_option_listContext) AllReindex_option_elem() []IReindex_option_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IReindex_option_elemContext); ok { + len++ + } + } + + tst := make([]IReindex_option_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IReindex_option_elemContext); ok { + tst[i] = t.(IReindex_option_elemContext) + i++ + } + } + + return tst +} + +func (s *Reindex_option_listContext) Reindex_option_elem(i int) IReindex_option_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReindex_option_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IReindex_option_elemContext) +} + +func (s *Reindex_option_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Reindex_option_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Reindex_option_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Reindex_option_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Reindex_option_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReindex_option_list(s) + } +} + +func (s *Reindex_option_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReindex_option_list(s) + } +} + +func (s *Reindex_option_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReindex_option_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reindex_option_list() (localctx IReindex_option_listContext) { + localctx = NewReindex_option_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 724, PostgreSQLParserRULE_reindex_option_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6270) + p.Reindex_option_elem() + } + p.SetState(6275) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(6271) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6272) + p.Reindex_option_elem() + } + + p.SetState(6277) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReindex_option_elemContext is an interface to support dynamic dispatch. +type IReindex_option_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + VERBOSE() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + CONCURRENTLY() antlr.TerminalNode + + // IsReindex_option_elemContext differentiates from other interfaces. + IsReindex_option_elemContext() +} + +type Reindex_option_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReindex_option_elemContext() *Reindex_option_elemContext { + var p = new(Reindex_option_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindex_option_elem + return p +} + +func InitEmptyReindex_option_elemContext(p *Reindex_option_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reindex_option_elem +} + +func (*Reindex_option_elemContext) IsReindex_option_elemContext() {} + +func NewReindex_option_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reindex_option_elemContext { + var p = new(Reindex_option_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reindex_option_elem + + return p +} + +func (s *Reindex_option_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Reindex_option_elemContext) VERBOSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERBOSE, 0) +} + +func (s *Reindex_option_elemContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *Reindex_option_elemContext) CONCURRENTLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONCURRENTLY, 0) +} + +func (s *Reindex_option_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Reindex_option_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Reindex_option_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReindex_option_elem(s) + } +} + +func (s *Reindex_option_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReindex_option_elem(s) + } +} + +func (s *Reindex_option_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReindex_option_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reindex_option_elem() (localctx IReindex_option_elemContext) { + localctx = NewReindex_option_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 726, PostgreSQLParserRULE_reindex_option_elem) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6278) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCONCURRENTLY || _la == PostgreSQLParserVERBOSE || _la == PostgreSQLParserTABLESPACE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltertblspcstmtContext is an interface to support dynamic dispatch. +type IAltertblspcstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + Name() INameContext + SET() antlr.TerminalNode + Reloptions() IReloptionsContext + RESET() antlr.TerminalNode + + // IsAltertblspcstmtContext differentiates from other interfaces. + IsAltertblspcstmtContext() +} + +type AltertblspcstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltertblspcstmtContext() *AltertblspcstmtContext { + var p = new(AltertblspcstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertblspcstmt + return p +} + +func InitEmptyAltertblspcstmtContext(p *AltertblspcstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertblspcstmt +} + +func (*AltertblspcstmtContext) IsAltertblspcstmtContext() {} + +func NewAltertblspcstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltertblspcstmtContext { + var p = new(AltertblspcstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altertblspcstmt + + return p +} + +func (s *AltertblspcstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltertblspcstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltertblspcstmtContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *AltertblspcstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AltertblspcstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AltertblspcstmtContext) Reloptions() IReloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReloptionsContext) +} + +func (s *AltertblspcstmtContext) RESET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESET, 0) +} + +func (s *AltertblspcstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltertblspcstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltertblspcstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltertblspcstmt(s) + } +} + +func (s *AltertblspcstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltertblspcstmt(s) + } +} + +func (s *AltertblspcstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltertblspcstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altertblspcstmt() (localctx IAltertblspcstmtContext) { + localctx = NewAltertblspcstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 728, PostgreSQLParserRULE_altertblspcstmt) + p.SetState(6292) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 535, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6280) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6281) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6282) + p.Name() + } + { + p.SetState(6283) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6284) + p.Reloptions() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6286) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6287) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6288) + p.Name() + } + { + p.SetState(6289) + p.Match(PostgreSQLParserRESET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6290) + p.Reloptions() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRenamestmtContext is an interface to support dynamic dispatch. +type IRenamestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + AGGREGATE() antlr.TerminalNode + Aggregate_with_argtypes() IAggregate_with_argtypesContext + RENAME() antlr.TerminalNode + TO() antlr.TerminalNode + AllName() []INameContext + Name(i int) INameContext + COLLATION() antlr.TerminalNode + Any_name() IAny_nameContext + CONVERSION_P() antlr.TerminalNode + DATABASE() antlr.TerminalNode + DOMAIN_P() antlr.TerminalNode + CONSTRAINT() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + DATA_P() antlr.TerminalNode + WRAPPER() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + GROUP_P() antlr.TerminalNode + AllRoleid() []IRoleidContext + Roleid(i int) IRoleidContext + LANGUAGE() antlr.TerminalNode + Opt_procedural() IOpt_proceduralContext + OPERATOR() antlr.TerminalNode + CLASS() antlr.TerminalNode + USING() antlr.TerminalNode + FAMILY() antlr.TerminalNode + POLICY() antlr.TerminalNode + ON() antlr.TerminalNode + Qualified_name() IQualified_nameContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + PUBLICATION() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + SERVER() antlr.TerminalNode + SUBSCRIPTION() antlr.TerminalNode + TABLE() antlr.TerminalNode + Relation_expr() IRelation_exprContext + SEQUENCE() antlr.TerminalNode + VIEW() antlr.TerminalNode + MATERIALIZED() antlr.TerminalNode + INDEX() antlr.TerminalNode + Opt_column() IOpt_columnContext + RULE() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + EVENT() antlr.TerminalNode + ROLE() antlr.TerminalNode + USER() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + STATISTICS() antlr.TerminalNode + TEXT_P() antlr.TerminalNode + SEARCH() antlr.TerminalNode + PARSER() antlr.TerminalNode + DICTIONARY() antlr.TerminalNode + TEMPLATE() antlr.TerminalNode + CONFIGURATION() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + ATTRIBUTE() antlr.TerminalNode + Opt_drop_behavior() IOpt_drop_behaviorContext + + // IsRenamestmtContext differentiates from other interfaces. + IsRenamestmtContext() +} + +type RenamestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRenamestmtContext() *RenamestmtContext { + var p = new(RenamestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_renamestmt + return p +} + +func InitEmptyRenamestmtContext(p *RenamestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_renamestmt +} + +func (*RenamestmtContext) IsRenamestmtContext() {} + +func NewRenamestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RenamestmtContext { + var p = new(RenamestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_renamestmt + + return p +} + +func (s *RenamestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RenamestmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *RenamestmtContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *RenamestmtContext) Aggregate_with_argtypes() IAggregate_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggregate_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggregate_with_argtypesContext) +} + +func (s *RenamestmtContext) RENAME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRENAME, 0) +} + +func (s *RenamestmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *RenamestmtContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *RenamestmtContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *RenamestmtContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *RenamestmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *RenamestmtContext) CONVERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONVERSION_P, 0) +} + +func (s *RenamestmtContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *RenamestmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *RenamestmtContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *RenamestmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *RenamestmtContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *RenamestmtContext) WRAPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRAPPER, 0) +} + +func (s *RenamestmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *RenamestmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *RenamestmtContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *RenamestmtContext) AllRoleid() []IRoleidContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRoleidContext); ok { + len++ + } + } + + tst := make([]IRoleidContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRoleidContext); ok { + tst[i] = t.(IRoleidContext) + i++ + } + } + + return tst +} + +func (s *RenamestmtContext) Roleid(i int) IRoleidContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRoleidContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRoleidContext) +} + +func (s *RenamestmtContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *RenamestmtContext) Opt_procedural() IOpt_proceduralContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_proceduralContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_proceduralContext) +} + +func (s *RenamestmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *RenamestmtContext) CLASS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLASS, 0) +} + +func (s *RenamestmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *RenamestmtContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *RenamestmtContext) POLICY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPOLICY, 0) +} + +func (s *RenamestmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *RenamestmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *RenamestmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *RenamestmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *RenamestmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *RenamestmtContext) PUBLICATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPUBLICATION, 0) +} + +func (s *RenamestmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *RenamestmtContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *RenamestmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *RenamestmtContext) SUBSCRIPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSCRIPTION, 0) +} + +func (s *RenamestmtContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *RenamestmtContext) Relation_expr() IRelation_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *RenamestmtContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *RenamestmtContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *RenamestmtContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *RenamestmtContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *RenamestmtContext) Opt_column() IOpt_columnContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_columnContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_columnContext) +} + +func (s *RenamestmtContext) RULE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRULE, 0) +} + +func (s *RenamestmtContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *RenamestmtContext) EVENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEVENT, 0) +} + +func (s *RenamestmtContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *RenamestmtContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *RenamestmtContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *RenamestmtContext) STATISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, 0) +} + +func (s *RenamestmtContext) TEXT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEXT_P, 0) +} + +func (s *RenamestmtContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *RenamestmtContext) PARSER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARSER, 0) +} + +func (s *RenamestmtContext) DICTIONARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDICTIONARY, 0) +} + +func (s *RenamestmtContext) TEMPLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPLATE, 0) +} + +func (s *RenamestmtContext) CONFIGURATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFIGURATION, 0) +} + +func (s *RenamestmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *RenamestmtContext) ATTRIBUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATTRIBUTE, 0) +} + +func (s *RenamestmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *RenamestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RenamestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RenamestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRenamestmt(s) + } +} + +func (s *RenamestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRenamestmt(s) + } +} + +func (s *RenamestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRenamestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Renamestmt() (localctx IRenamestmtContext) { + localctx = NewRenamestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 730, PostgreSQLParserRULE_renamestmt) + var _la int + + p.SetState(6781) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 546, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6294) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6295) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6296) + p.Aggregate_with_argtypes() + } + { + p.SetState(6297) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6298) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6299) + p.Name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6301) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6302) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6303) + p.Any_name() + } + { + p.SetState(6304) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6305) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6306) + p.Name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(6308) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6309) + p.Match(PostgreSQLParserCONVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6310) + p.Any_name() + } + { + p.SetState(6311) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6312) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6313) + p.Name() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(6315) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6316) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6317) + p.Name() + } + { + p.SetState(6318) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6319) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6320) + p.Name() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(6322) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6323) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6324) + p.Any_name() + } + { + p.SetState(6325) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6326) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6327) + p.Name() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(6329) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6330) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6331) + p.Any_name() + } + { + p.SetState(6332) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6333) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6334) + p.Name() + } + { + p.SetState(6335) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6336) + p.Name() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(6338) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6339) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6340) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6341) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6342) + p.Name() + } + { + p.SetState(6343) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6344) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6345) + p.Name() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(6347) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6348) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6349) + p.Function_with_argtypes() + } + { + p.SetState(6350) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6351) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6352) + p.Name() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(6354) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6355) + p.Match(PostgreSQLParserGROUP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6356) + p.Roleid() + } + { + p.SetState(6357) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6358) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6359) + p.Roleid() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(6361) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6363) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPROCEDURAL { + { + p.SetState(6362) + p.Opt_procedural() + } + + } + { + p.SetState(6365) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6366) + p.Name() + } + { + p.SetState(6367) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6368) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6369) + p.Name() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(6371) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6372) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6373) + p.Match(PostgreSQLParserCLASS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6374) + p.Any_name() + } + { + p.SetState(6375) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6376) + p.Name() + } + { + p.SetState(6377) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6378) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6379) + p.Name() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(6381) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6382) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6383) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6384) + p.Any_name() + } + { + p.SetState(6385) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6386) + p.Name() + } + { + p.SetState(6387) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6388) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6389) + p.Name() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(6391) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6392) + p.Match(PostgreSQLParserPOLICY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6393) + p.Name() + } + { + p.SetState(6394) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6395) + p.Qualified_name() + } + { + p.SetState(6396) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6397) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6398) + p.Name() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(6400) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6401) + p.Match(PostgreSQLParserPOLICY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6402) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6403) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6404) + p.Name() + } + { + p.SetState(6405) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6406) + p.Qualified_name() + } + { + p.SetState(6407) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6408) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6409) + p.Name() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(6411) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6412) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6413) + p.Function_with_argtypes() + } + { + p.SetState(6414) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6415) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6416) + p.Name() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(6418) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6419) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6420) + p.Name() + } + { + p.SetState(6421) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6422) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6423) + p.Name() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(6425) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6426) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6427) + p.Function_with_argtypes() + } + { + p.SetState(6428) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6429) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6430) + p.Name() + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(6432) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6433) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6434) + p.Name() + } + { + p.SetState(6435) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6436) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6437) + p.Name() + } + + case 19: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(6439) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6440) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6441) + p.Name() + } + { + p.SetState(6442) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6443) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6444) + p.Name() + } + + case 20: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(6446) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6447) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6448) + p.Name() + } + { + p.SetState(6449) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6450) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6451) + p.Name() + } + + case 21: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(6453) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6454) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6455) + p.Relation_expr() + } + { + p.SetState(6456) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6457) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6458) + p.Name() + } + + case 22: + p.EnterOuterAlt(localctx, 22) + { + p.SetState(6460) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6461) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6462) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6463) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6464) + p.Relation_expr() + } + { + p.SetState(6465) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6466) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6467) + p.Name() + } + + case 23: + p.EnterOuterAlt(localctx, 23) + { + p.SetState(6469) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6470) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6471) + p.Qualified_name() + } + { + p.SetState(6472) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6473) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6474) + p.Name() + } + + case 24: + p.EnterOuterAlt(localctx, 24) + { + p.SetState(6476) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6477) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6478) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6479) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6480) + p.Qualified_name() + } + { + p.SetState(6481) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6482) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6483) + p.Name() + } + + case 25: + p.EnterOuterAlt(localctx, 25) + { + p.SetState(6485) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6486) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6487) + p.Qualified_name() + } + { + p.SetState(6488) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6489) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6490) + p.Name() + } + + case 26: + p.EnterOuterAlt(localctx, 26) + { + p.SetState(6492) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6493) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6494) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6495) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6496) + p.Qualified_name() + } + { + p.SetState(6497) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6498) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6499) + p.Name() + } + + case 27: + p.EnterOuterAlt(localctx, 27) + { + p.SetState(6501) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6502) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6503) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6504) + p.Qualified_name() + } + { + p.SetState(6505) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6506) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6507) + p.Name() + } + + case 28: + p.EnterOuterAlt(localctx, 28) + { + p.SetState(6509) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6510) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6511) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6512) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6513) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6514) + p.Qualified_name() + } + { + p.SetState(6515) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6516) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6517) + p.Name() + } + + case 29: + p.EnterOuterAlt(localctx, 29) + { + p.SetState(6519) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6520) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6521) + p.Qualified_name() + } + { + p.SetState(6522) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6523) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6524) + p.Name() + } + + case 30: + p.EnterOuterAlt(localctx, 30) + { + p.SetState(6526) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6527) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6528) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6529) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6530) + p.Qualified_name() + } + { + p.SetState(6531) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6532) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6533) + p.Name() + } + + case 31: + p.EnterOuterAlt(localctx, 31) + { + p.SetState(6535) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6536) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6537) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6538) + p.Relation_expr() + } + { + p.SetState(6539) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6540) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6541) + p.Name() + } + + case 32: + p.EnterOuterAlt(localctx, 32) + { + p.SetState(6543) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6544) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6545) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6546) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6547) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6548) + p.Relation_expr() + } + { + p.SetState(6549) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6550) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6551) + p.Name() + } + + case 33: + p.EnterOuterAlt(localctx, 33) + { + p.SetState(6553) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6554) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6555) + p.Relation_expr() + } + { + p.SetState(6556) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6558) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 537, p.GetParserRuleContext()) == 1 { + { + p.SetState(6557) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(6560) + p.Name() + } + { + p.SetState(6561) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6562) + p.Name() + } + + case 34: + p.EnterOuterAlt(localctx, 34) + { + p.SetState(6564) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6565) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6566) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6567) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6568) + p.Relation_expr() + } + { + p.SetState(6569) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6571) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 538, p.GetParserRuleContext()) == 1 { + { + p.SetState(6570) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(6573) + p.Name() + } + { + p.SetState(6574) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6575) + p.Name() + } + + case 35: + p.EnterOuterAlt(localctx, 35) + { + p.SetState(6577) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6578) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6579) + p.Qualified_name() + } + { + p.SetState(6580) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6582) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 539, p.GetParserRuleContext()) == 1 { + { + p.SetState(6581) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(6584) + p.Name() + } + { + p.SetState(6585) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6586) + p.Name() + } + + case 36: + p.EnterOuterAlt(localctx, 36) + { + p.SetState(6588) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6589) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6590) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6591) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6592) + p.Qualified_name() + } + { + p.SetState(6593) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6595) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 540, p.GetParserRuleContext()) == 1 { + { + p.SetState(6594) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(6597) + p.Name() + } + { + p.SetState(6598) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6599) + p.Name() + } + + case 37: + p.EnterOuterAlt(localctx, 37) + { + p.SetState(6601) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6602) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6603) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6604) + p.Qualified_name() + } + { + p.SetState(6605) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6607) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 541, p.GetParserRuleContext()) == 1 { + { + p.SetState(6606) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(6609) + p.Name() + } + { + p.SetState(6610) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6611) + p.Name() + } + + case 38: + p.EnterOuterAlt(localctx, 38) + { + p.SetState(6613) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6614) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6615) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6616) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6617) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6618) + p.Qualified_name() + } + { + p.SetState(6619) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6621) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 542, p.GetParserRuleContext()) == 1 { + { + p.SetState(6620) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(6623) + p.Name() + } + { + p.SetState(6624) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6625) + p.Name() + } + + case 39: + p.EnterOuterAlt(localctx, 39) + { + p.SetState(6627) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6628) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6629) + p.Relation_expr() + } + { + p.SetState(6630) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6631) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6632) + p.Name() + } + { + p.SetState(6633) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6634) + p.Name() + } + + case 40: + p.EnterOuterAlt(localctx, 40) + { + p.SetState(6636) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6637) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6638) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6639) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6640) + p.Relation_expr() + } + { + p.SetState(6641) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6642) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6643) + p.Name() + } + { + p.SetState(6644) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6645) + p.Name() + } + + case 41: + p.EnterOuterAlt(localctx, 41) + { + p.SetState(6647) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6648) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6649) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6650) + p.Relation_expr() + } + { + p.SetState(6651) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6653) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 543, p.GetParserRuleContext()) == 1 { + { + p.SetState(6652) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(6655) + p.Name() + } + { + p.SetState(6656) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6657) + p.Name() + } + + case 42: + p.EnterOuterAlt(localctx, 42) + { + p.SetState(6659) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6660) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6661) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6662) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6663) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6664) + p.Relation_expr() + } + { + p.SetState(6665) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(6667) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 544, p.GetParserRuleContext()) == 1 { + { + p.SetState(6666) + p.Opt_column() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(6669) + p.Name() + } + { + p.SetState(6670) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6671) + p.Name() + } + + case 43: + p.EnterOuterAlt(localctx, 43) + { + p.SetState(6673) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6674) + p.Match(PostgreSQLParserRULE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6675) + p.Name() + } + { + p.SetState(6676) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6677) + p.Qualified_name() + } + { + p.SetState(6678) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6679) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6680) + p.Name() + } + + case 44: + p.EnterOuterAlt(localctx, 44) + { + p.SetState(6682) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6683) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6684) + p.Name() + } + { + p.SetState(6685) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6686) + p.Qualified_name() + } + { + p.SetState(6687) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6688) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6689) + p.Name() + } + + case 45: + p.EnterOuterAlt(localctx, 45) + { + p.SetState(6691) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6692) + p.Match(PostgreSQLParserEVENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6693) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6694) + p.Name() + } + { + p.SetState(6695) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6696) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6697) + p.Name() + } + + case 46: + p.EnterOuterAlt(localctx, 46) + { + p.SetState(6699) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6700) + p.Match(PostgreSQLParserROLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6701) + p.Roleid() + } + { + p.SetState(6702) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6703) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6704) + p.Roleid() + } + + case 47: + p.EnterOuterAlt(localctx, 47) + { + p.SetState(6706) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6707) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6708) + p.Roleid() + } + { + p.SetState(6709) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6710) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6711) + p.Roleid() + } + + case 48: + p.EnterOuterAlt(localctx, 48) + { + p.SetState(6713) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6714) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6715) + p.Name() + } + { + p.SetState(6716) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6717) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6718) + p.Name() + } + + case 49: + p.EnterOuterAlt(localctx, 49) + { + p.SetState(6720) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6721) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6722) + p.Any_name() + } + { + p.SetState(6723) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6724) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6725) + p.Name() + } + + case 50: + p.EnterOuterAlt(localctx, 50) + { + p.SetState(6727) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6728) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6729) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6730) + p.Match(PostgreSQLParserPARSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6731) + p.Any_name() + } + { + p.SetState(6732) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6733) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6734) + p.Name() + } + + case 51: + p.EnterOuterAlt(localctx, 51) + { + p.SetState(6736) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6737) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6738) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6739) + p.Match(PostgreSQLParserDICTIONARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6740) + p.Any_name() + } + { + p.SetState(6741) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6742) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6743) + p.Name() + } + + case 52: + p.EnterOuterAlt(localctx, 52) + { + p.SetState(6745) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6746) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6747) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6748) + p.Match(PostgreSQLParserTEMPLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6749) + p.Any_name() + } + { + p.SetState(6750) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6751) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6752) + p.Name() + } + + case 53: + p.EnterOuterAlt(localctx, 53) + { + p.SetState(6754) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6755) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6756) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6757) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6758) + p.Any_name() + } + { + p.SetState(6759) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6760) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6761) + p.Name() + } + + case 54: + p.EnterOuterAlt(localctx, 54) + { + p.SetState(6763) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6764) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6765) + p.Any_name() + } + { + p.SetState(6766) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6767) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6768) + p.Name() + } + + case 55: + p.EnterOuterAlt(localctx, 55) + { + p.SetState(6770) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6771) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6772) + p.Any_name() + } + { + p.SetState(6773) + p.Match(PostgreSQLParserRENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6774) + p.Match(PostgreSQLParserATTRIBUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6775) + p.Name() + } + { + p.SetState(6776) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6777) + p.Name() + } + p.SetState(6779) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(6778) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_columnContext is an interface to support dynamic dispatch. +type IOpt_columnContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COLUMN() antlr.TerminalNode + + // IsOpt_columnContext differentiates from other interfaces. + IsOpt_columnContext() +} + +type Opt_columnContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_columnContext() *Opt_columnContext { + var p = new(Opt_columnContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_column + return p +} + +func InitEmptyOpt_columnContext(p *Opt_columnContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_column +} + +func (*Opt_columnContext) IsOpt_columnContext() {} + +func NewOpt_columnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_columnContext { + var p = new(Opt_columnContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_column + + return p +} + +func (s *Opt_columnContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_columnContext) COLUMN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLUMN, 0) +} + +func (s *Opt_columnContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_columnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_columnContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_column(s) + } +} + +func (s *Opt_columnContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_column(s) + } +} + +func (s *Opt_columnContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_column(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_column() (localctx IOpt_columnContext) { + localctx = NewOpt_columnContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 732, PostgreSQLParserRULE_opt_column) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6783) + p.Match(PostgreSQLParserCOLUMN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_set_dataContext is an interface to support dynamic dispatch. +type IOpt_set_dataContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SET() antlr.TerminalNode + DATA_P() antlr.TerminalNode + + // IsOpt_set_dataContext differentiates from other interfaces. + IsOpt_set_dataContext() +} + +type Opt_set_dataContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_set_dataContext() *Opt_set_dataContext { + var p = new(Opt_set_dataContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_set_data + return p +} + +func InitEmptyOpt_set_dataContext(p *Opt_set_dataContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_set_data +} + +func (*Opt_set_dataContext) IsOpt_set_dataContext() {} + +func NewOpt_set_dataContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_set_dataContext { + var p = new(Opt_set_dataContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_set_data + + return p +} + +func (s *Opt_set_dataContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_set_dataContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Opt_set_dataContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *Opt_set_dataContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_set_dataContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_set_dataContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_set_data(s) + } +} + +func (s *Opt_set_dataContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_set_data(s) + } +} + +func (s *Opt_set_dataContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_set_data(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_set_data() (localctx IOpt_set_dataContext) { + localctx = NewOpt_set_dataContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 734, PostgreSQLParserRULE_opt_set_data) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6785) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6786) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterobjectdependsstmtContext is an interface to support dynamic dispatch. +type IAlterobjectdependsstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + DEPENDS() antlr.TerminalNode + AllON() []antlr.TerminalNode + ON(i int) antlr.TerminalNode + EXTENSION() antlr.TerminalNode + AllName() []INameContext + Name(i int) INameContext + Opt_no() IOpt_noContext + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + Qualified_name() IQualified_nameContext + MATERIALIZED() antlr.TerminalNode + VIEW() antlr.TerminalNode + INDEX() antlr.TerminalNode + + // IsAlterobjectdependsstmtContext differentiates from other interfaces. + IsAlterobjectdependsstmtContext() +} + +type AlterobjectdependsstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterobjectdependsstmtContext() *AlterobjectdependsstmtContext { + var p = new(AlterobjectdependsstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterobjectdependsstmt + return p +} + +func InitEmptyAlterobjectdependsstmtContext(p *AlterobjectdependsstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterobjectdependsstmt +} + +func (*AlterobjectdependsstmtContext) IsAlterobjectdependsstmtContext() {} + +func NewAlterobjectdependsstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterobjectdependsstmtContext { + var p = new(AlterobjectdependsstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterobjectdependsstmt + + return p +} + +func (s *AlterobjectdependsstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterobjectdependsstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterobjectdependsstmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *AlterobjectdependsstmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *AlterobjectdependsstmtContext) DEPENDS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEPENDS, 0) +} + +func (s *AlterobjectdependsstmtContext) AllON() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserON) +} + +func (s *AlterobjectdependsstmtContext) ON(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, i) +} + +func (s *AlterobjectdependsstmtContext) EXTENSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTENSION, 0) +} + +func (s *AlterobjectdependsstmtContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *AlterobjectdependsstmtContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterobjectdependsstmtContext) Opt_no() IOpt_noContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_noContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_noContext) +} + +func (s *AlterobjectdependsstmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *AlterobjectdependsstmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *AlterobjectdependsstmtContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *AlterobjectdependsstmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *AlterobjectdependsstmtContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *AlterobjectdependsstmtContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *AlterobjectdependsstmtContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *AlterobjectdependsstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterobjectdependsstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterobjectdependsstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterobjectdependsstmt(s) + } +} + +func (s *AlterobjectdependsstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterobjectdependsstmt(s) + } +} + +func (s *AlterobjectdependsstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterobjectdependsstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterobjectdependsstmt() (localctx IAlterobjectdependsstmtContext) { + localctx = NewAlterobjectdependsstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 736, PostgreSQLParserRULE_alterobjectdependsstmt) + var _la int + + p.SetState(6857) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 553, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6788) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6789) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6790) + p.Function_with_argtypes() + } + p.SetState(6792) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(6791) + p.Opt_no() + } + + } + { + p.SetState(6794) + p.Match(PostgreSQLParserDEPENDS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6795) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6796) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6797) + p.Name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6799) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6800) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6801) + p.Function_with_argtypes() + } + p.SetState(6803) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(6802) + p.Opt_no() + } + + } + { + p.SetState(6805) + p.Match(PostgreSQLParserDEPENDS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6806) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6807) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6808) + p.Name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(6810) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6811) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6812) + p.Function_with_argtypes() + } + p.SetState(6814) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(6813) + p.Opt_no() + } + + } + { + p.SetState(6816) + p.Match(PostgreSQLParserDEPENDS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6817) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6818) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6819) + p.Name() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(6821) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6822) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6823) + p.Name() + } + { + p.SetState(6824) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6825) + p.Qualified_name() + } + p.SetState(6827) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(6826) + p.Opt_no() + } + + } + { + p.SetState(6829) + p.Match(PostgreSQLParserDEPENDS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6830) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6831) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6832) + p.Name() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(6834) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6835) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6836) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6837) + p.Qualified_name() + } + p.SetState(6839) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(6838) + p.Opt_no() + } + + } + { + p.SetState(6841) + p.Match(PostgreSQLParserDEPENDS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6842) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6843) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6844) + p.Name() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(6846) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6847) + p.Match(PostgreSQLParserINDEX) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6848) + p.Qualified_name() + } + p.SetState(6850) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(6849) + p.Opt_no() + } + + } + { + p.SetState(6852) + p.Match(PostgreSQLParserDEPENDS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6853) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6854) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6855) + p.Name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_noContext is an interface to support dynamic dispatch. +type IOpt_noContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NO() antlr.TerminalNode + + // IsOpt_noContext differentiates from other interfaces. + IsOpt_noContext() +} + +type Opt_noContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_noContext() *Opt_noContext { + var p = new(Opt_noContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_no + return p +} + +func InitEmptyOpt_noContext(p *Opt_noContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_no +} + +func (*Opt_noContext) IsOpt_noContext() {} + +func NewOpt_noContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_noContext { + var p = new(Opt_noContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_no + + return p +} + +func (s *Opt_noContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_noContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Opt_noContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_noContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_noContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_no(s) + } +} + +func (s *Opt_noContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_no(s) + } +} + +func (s *Opt_noContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_no(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_no() (localctx IOpt_noContext) { + localctx = NewOpt_noContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 738, PostgreSQLParserRULE_opt_no) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6859) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterobjectschemastmtContext is an interface to support dynamic dispatch. +type IAlterobjectschemastmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + AGGREGATE() antlr.TerminalNode + Aggregate_with_argtypes() IAggregate_with_argtypesContext + SET() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + AllName() []INameContext + Name(i int) INameContext + COLLATION() antlr.TerminalNode + Any_name() IAny_nameContext + CONVERSION_P() antlr.TerminalNode + DOMAIN_P() antlr.TerminalNode + EXTENSION() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + OPERATOR() antlr.TerminalNode + Operator_with_argtypes() IOperator_with_argtypesContext + CLASS() antlr.TerminalNode + USING() antlr.TerminalNode + FAMILY() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + TABLE() antlr.TerminalNode + Relation_expr() IRelation_exprContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + STATISTICS() antlr.TerminalNode + TEXT_P() antlr.TerminalNode + SEARCH() antlr.TerminalNode + PARSER() antlr.TerminalNode + DICTIONARY() antlr.TerminalNode + TEMPLATE() antlr.TerminalNode + CONFIGURATION() antlr.TerminalNode + SEQUENCE() antlr.TerminalNode + Qualified_name() IQualified_nameContext + VIEW() antlr.TerminalNode + MATERIALIZED() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + + // IsAlterobjectschemastmtContext differentiates from other interfaces. + IsAlterobjectschemastmtContext() +} + +type AlterobjectschemastmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterobjectschemastmtContext() *AlterobjectschemastmtContext { + var p = new(AlterobjectschemastmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterobjectschemastmt + return p +} + +func InitEmptyAlterobjectschemastmtContext(p *AlterobjectschemastmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterobjectschemastmt +} + +func (*AlterobjectschemastmtContext) IsAlterobjectschemastmtContext() {} + +func NewAlterobjectschemastmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterobjectschemastmtContext { + var p = new(AlterobjectschemastmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterobjectschemastmt + + return p +} + +func (s *AlterobjectschemastmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterobjectschemastmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterobjectschemastmtContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *AlterobjectschemastmtContext) Aggregate_with_argtypes() IAggregate_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggregate_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggregate_with_argtypesContext) +} + +func (s *AlterobjectschemastmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AlterobjectschemastmtContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *AlterobjectschemastmtContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *AlterobjectschemastmtContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterobjectschemastmtContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *AlterobjectschemastmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AlterobjectschemastmtContext) CONVERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONVERSION_P, 0) +} + +func (s *AlterobjectschemastmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *AlterobjectschemastmtContext) EXTENSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTENSION, 0) +} + +func (s *AlterobjectschemastmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *AlterobjectschemastmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *AlterobjectschemastmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *AlterobjectschemastmtContext) Operator_with_argtypes() IOperator_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_with_argtypesContext) +} + +func (s *AlterobjectschemastmtContext) CLASS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLASS, 0) +} + +func (s *AlterobjectschemastmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *AlterobjectschemastmtContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *AlterobjectschemastmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *AlterobjectschemastmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *AlterobjectschemastmtContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *AlterobjectschemastmtContext) Relation_expr() IRelation_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *AlterobjectschemastmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *AlterobjectschemastmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *AlterobjectschemastmtContext) STATISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, 0) +} + +func (s *AlterobjectschemastmtContext) TEXT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEXT_P, 0) +} + +func (s *AlterobjectschemastmtContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *AlterobjectschemastmtContext) PARSER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARSER, 0) +} + +func (s *AlterobjectschemastmtContext) DICTIONARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDICTIONARY, 0) +} + +func (s *AlterobjectschemastmtContext) TEMPLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPLATE, 0) +} + +func (s *AlterobjectschemastmtContext) CONFIGURATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFIGURATION, 0) +} + +func (s *AlterobjectschemastmtContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *AlterobjectschemastmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *AlterobjectschemastmtContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *AlterobjectschemastmtContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *AlterobjectschemastmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *AlterobjectschemastmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *AlterobjectschemastmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterobjectschemastmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterobjectschemastmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterobjectschemastmt(s) + } +} + +func (s *AlterobjectschemastmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterobjectschemastmt(s) + } +} + +func (s *AlterobjectschemastmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterobjectschemastmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterobjectschemastmt() (localctx IAlterobjectschemastmtContext) { + localctx = NewAlterobjectschemastmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 740, PostgreSQLParserRULE_alterobjectschemastmt) + p.SetState(7078) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 554, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(6861) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6862) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6863) + p.Aggregate_with_argtypes() + } + { + p.SetState(6864) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6865) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6866) + p.Name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(6868) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6869) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6870) + p.Any_name() + } + { + p.SetState(6871) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6872) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6873) + p.Name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(6875) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6876) + p.Match(PostgreSQLParserCONVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6877) + p.Any_name() + } + { + p.SetState(6878) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6879) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6880) + p.Name() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(6882) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6883) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6884) + p.Any_name() + } + { + p.SetState(6885) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6886) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6887) + p.Name() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(6889) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6890) + p.Match(PostgreSQLParserEXTENSION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6891) + p.Name() + } + { + p.SetState(6892) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6893) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6894) + p.Name() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(6896) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6897) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6898) + p.Function_with_argtypes() + } + { + p.SetState(6899) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6900) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6901) + p.Name() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(6903) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6904) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6905) + p.Operator_with_argtypes() + } + { + p.SetState(6906) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6907) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6908) + p.Name() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(6910) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6911) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6912) + p.Match(PostgreSQLParserCLASS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6913) + p.Any_name() + } + { + p.SetState(6914) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6915) + p.Name() + } + { + p.SetState(6916) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6917) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6918) + p.Name() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(6920) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6921) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6922) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6923) + p.Any_name() + } + { + p.SetState(6924) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6925) + p.Name() + } + { + p.SetState(6926) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6927) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6928) + p.Name() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(6930) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6931) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6932) + p.Function_with_argtypes() + } + { + p.SetState(6933) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6934) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6935) + p.Name() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(6937) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6938) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6939) + p.Function_with_argtypes() + } + { + p.SetState(6940) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6941) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6942) + p.Name() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(6944) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6945) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6946) + p.Relation_expr() + } + { + p.SetState(6947) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6948) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6949) + p.Name() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(6951) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6952) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6953) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6954) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6955) + p.Relation_expr() + } + { + p.SetState(6956) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6957) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6958) + p.Name() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(6960) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6961) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6962) + p.Any_name() + } + { + p.SetState(6963) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6964) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6965) + p.Name() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(6967) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6968) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6969) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6970) + p.Match(PostgreSQLParserPARSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6971) + p.Any_name() + } + { + p.SetState(6972) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6973) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6974) + p.Name() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(6976) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6977) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6978) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6979) + p.Match(PostgreSQLParserDICTIONARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6980) + p.Any_name() + } + { + p.SetState(6981) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6982) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6983) + p.Name() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(6985) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6986) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6987) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6988) + p.Match(PostgreSQLParserTEMPLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6989) + p.Any_name() + } + { + p.SetState(6990) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6991) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6992) + p.Name() + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(6994) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6995) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6996) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6997) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(6998) + p.Any_name() + } + { + p.SetState(6999) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7000) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7001) + p.Name() + } + + case 19: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(7003) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7004) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7005) + p.Qualified_name() + } + { + p.SetState(7006) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7007) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7008) + p.Name() + } + + case 20: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(7010) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7011) + p.Match(PostgreSQLParserSEQUENCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7012) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7013) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7014) + p.Qualified_name() + } + { + p.SetState(7015) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7016) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7017) + p.Name() + } + + case 21: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(7019) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7020) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7021) + p.Qualified_name() + } + { + p.SetState(7022) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7023) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7024) + p.Name() + } + + case 22: + p.EnterOuterAlt(localctx, 22) + { + p.SetState(7026) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7027) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7028) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7029) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7030) + p.Qualified_name() + } + { + p.SetState(7031) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7032) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7033) + p.Name() + } + + case 23: + p.EnterOuterAlt(localctx, 23) + { + p.SetState(7035) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7036) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7037) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7038) + p.Qualified_name() + } + { + p.SetState(7039) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7040) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7041) + p.Name() + } + + case 24: + p.EnterOuterAlt(localctx, 24) + { + p.SetState(7043) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7044) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7045) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7046) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7047) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7048) + p.Qualified_name() + } + { + p.SetState(7049) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7050) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7051) + p.Name() + } + + case 25: + p.EnterOuterAlt(localctx, 25) + { + p.SetState(7053) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7054) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7055) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7056) + p.Relation_expr() + } + { + p.SetState(7057) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7058) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7059) + p.Name() + } + + case 26: + p.EnterOuterAlt(localctx, 26) + { + p.SetState(7061) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7062) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7063) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7064) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7065) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7066) + p.Relation_expr() + } + { + p.SetState(7067) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7068) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7069) + p.Name() + } + + case 27: + p.EnterOuterAlt(localctx, 27) + { + p.SetState(7071) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7072) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7073) + p.Any_name() + } + { + p.SetState(7074) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7075) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7076) + p.Name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlteroperatorstmtContext is an interface to support dynamic dispatch. +type IAlteroperatorstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + Operator_with_argtypes() IOperator_with_argtypesContext + SET() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Operator_def_list() IOperator_def_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsAlteroperatorstmtContext differentiates from other interfaces. + IsAlteroperatorstmtContext() +} + +type AlteroperatorstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlteroperatorstmtContext() *AlteroperatorstmtContext { + var p = new(AlteroperatorstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alteroperatorstmt + return p +} + +func InitEmptyAlteroperatorstmtContext(p *AlteroperatorstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alteroperatorstmt +} + +func (*AlteroperatorstmtContext) IsAlteroperatorstmtContext() {} + +func NewAlteroperatorstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlteroperatorstmtContext { + var p = new(AlteroperatorstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alteroperatorstmt + + return p +} + +func (s *AlteroperatorstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlteroperatorstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlteroperatorstmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *AlteroperatorstmtContext) Operator_with_argtypes() IOperator_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_with_argtypesContext) +} + +func (s *AlteroperatorstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AlteroperatorstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *AlteroperatorstmtContext) Operator_def_list() IOperator_def_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_def_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_def_listContext) +} + +func (s *AlteroperatorstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *AlteroperatorstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlteroperatorstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlteroperatorstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlteroperatorstmt(s) + } +} + +func (s *AlteroperatorstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlteroperatorstmt(s) + } +} + +func (s *AlteroperatorstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlteroperatorstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alteroperatorstmt() (localctx IAlteroperatorstmtContext) { + localctx = NewAlteroperatorstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 742, PostgreSQLParserRULE_alteroperatorstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7080) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7081) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7082) + p.Operator_with_argtypes() + } + { + p.SetState(7083) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7084) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7085) + p.Operator_def_list() + } + { + p.SetState(7086) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOperator_def_listContext is an interface to support dynamic dispatch. +type IOperator_def_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllOperator_def_elem() []IOperator_def_elemContext + Operator_def_elem(i int) IOperator_def_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOperator_def_listContext differentiates from other interfaces. + IsOperator_def_listContext() +} + +type Operator_def_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOperator_def_listContext() *Operator_def_listContext { + var p = new(Operator_def_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_def_list + return p +} + +func InitEmptyOperator_def_listContext(p *Operator_def_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_def_list +} + +func (*Operator_def_listContext) IsOperator_def_listContext() {} + +func NewOperator_def_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Operator_def_listContext { + var p = new(Operator_def_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_operator_def_list + + return p +} + +func (s *Operator_def_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Operator_def_listContext) AllOperator_def_elem() []IOperator_def_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOperator_def_elemContext); ok { + len++ + } + } + + tst := make([]IOperator_def_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOperator_def_elemContext); ok { + tst[i] = t.(IOperator_def_elemContext) + i++ + } + } + + return tst +} + +func (s *Operator_def_listContext) Operator_def_elem(i int) IOperator_def_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_def_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOperator_def_elemContext) +} + +func (s *Operator_def_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Operator_def_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Operator_def_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Operator_def_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Operator_def_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOperator_def_list(s) + } +} + +func (s *Operator_def_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOperator_def_list(s) + } +} + +func (s *Operator_def_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOperator_def_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Operator_def_list() (localctx IOperator_def_listContext) { + localctx = NewOperator_def_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 744, PostgreSQLParserRULE_operator_def_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7088) + p.Operator_def_elem() + } + p.SetState(7093) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(7089) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7090) + p.Operator_def_elem() + } + + p.SetState(7095) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOperator_def_elemContext is an interface to support dynamic dispatch. +type IOperator_def_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Collabel() ICollabelContext + EQUAL() antlr.TerminalNode + NONE() antlr.TerminalNode + Operator_def_arg() IOperator_def_argContext + + // IsOperator_def_elemContext differentiates from other interfaces. + IsOperator_def_elemContext() +} + +type Operator_def_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOperator_def_elemContext() *Operator_def_elemContext { + var p = new(Operator_def_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_def_elem + return p +} + +func InitEmptyOperator_def_elemContext(p *Operator_def_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_def_elem +} + +func (*Operator_def_elemContext) IsOperator_def_elemContext() {} + +func NewOperator_def_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Operator_def_elemContext { + var p = new(Operator_def_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_operator_def_elem + + return p +} + +func (s *Operator_def_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Operator_def_elemContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Operator_def_elemContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Operator_def_elemContext) NONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNONE, 0) +} + +func (s *Operator_def_elemContext) Operator_def_arg() IOperator_def_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_def_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_def_argContext) +} + +func (s *Operator_def_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Operator_def_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Operator_def_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOperator_def_elem(s) + } +} + +func (s *Operator_def_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOperator_def_elem(s) + } +} + +func (s *Operator_def_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOperator_def_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Operator_def_elem() (localctx IOperator_def_elemContext) { + localctx = NewOperator_def_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 746, PostgreSQLParserRULE_operator_def_elem) + p.SetState(7104) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 556, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7096) + p.Collabel() + } + { + p.SetState(7097) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7098) + p.Match(PostgreSQLParserNONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7100) + p.Collabel() + } + { + p.SetState(7101) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7102) + p.Operator_def_arg() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOperator_def_argContext is an interface to support dynamic dispatch. +type IOperator_def_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_type() IFunc_typeContext + Reserved_keyword() IReserved_keywordContext + Qual_all_op() IQual_all_opContext + Numericonly() INumericonlyContext + Sconst() ISconstContext + + // IsOperator_def_argContext differentiates from other interfaces. + IsOperator_def_argContext() +} + +type Operator_def_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOperator_def_argContext() *Operator_def_argContext { + var p = new(Operator_def_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_def_arg + return p +} + +func InitEmptyOperator_def_argContext(p *Operator_def_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_operator_def_arg +} + +func (*Operator_def_argContext) IsOperator_def_argContext() {} + +func NewOperator_def_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Operator_def_argContext { + var p = new(Operator_def_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_operator_def_arg + + return p +} + +func (s *Operator_def_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Operator_def_argContext) Func_type() IFunc_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_typeContext) +} + +func (s *Operator_def_argContext) Reserved_keyword() IReserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReserved_keywordContext) +} + +func (s *Operator_def_argContext) Qual_all_op() IQual_all_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQual_all_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQual_all_opContext) +} + +func (s *Operator_def_argContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Operator_def_argContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Operator_def_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Operator_def_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Operator_def_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOperator_def_arg(s) + } +} + +func (s *Operator_def_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOperator_def_arg(s) + } +} + +func (s *Operator_def_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOperator_def_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Operator_def_arg() (localctx IOperator_def_argContext) { + localctx = NewOperator_def_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 748, PostgreSQLParserRULE_operator_def_arg) + p.SetState(7111) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 557, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7106) + p.Func_type() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7107) + p.Reserved_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7108) + p.Qual_all_op() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7109) + p.Numericonly() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7110) + p.Sconst() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltertypestmtContext is an interface to support dynamic dispatch. +type IAltertypestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + Any_name() IAny_nameContext + SET() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Operator_def_list() IOperator_def_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsAltertypestmtContext differentiates from other interfaces. + IsAltertypestmtContext() +} + +type AltertypestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltertypestmtContext() *AltertypestmtContext { + var p = new(AltertypestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertypestmt + return p +} + +func InitEmptyAltertypestmtContext(p *AltertypestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertypestmt +} + +func (*AltertypestmtContext) IsAltertypestmtContext() {} + +func NewAltertypestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltertypestmtContext { + var p = new(AltertypestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altertypestmt + + return p +} + +func (s *AltertypestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltertypestmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltertypestmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *AltertypestmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AltertypestmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AltertypestmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *AltertypestmtContext) Operator_def_list() IOperator_def_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_def_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_def_listContext) +} + +func (s *AltertypestmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *AltertypestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltertypestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltertypestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltertypestmt(s) + } +} + +func (s *AltertypestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltertypestmt(s) + } +} + +func (s *AltertypestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltertypestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altertypestmt() (localctx IAltertypestmtContext) { + localctx = NewAltertypestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 750, PostgreSQLParserRULE_altertypestmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7113) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7114) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7115) + p.Any_name() + } + { + p.SetState(7116) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7117) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7118) + p.Operator_def_list() + } + { + p.SetState(7119) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterownerstmtContext is an interface to support dynamic dispatch. +type IAlterownerstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + AGGREGATE() antlr.TerminalNode + Aggregate_with_argtypes() IAggregate_with_argtypesContext + OWNER() antlr.TerminalNode + TO() antlr.TerminalNode + Rolespec() IRolespecContext + COLLATION() antlr.TerminalNode + Any_name() IAny_nameContext + CONVERSION_P() antlr.TerminalNode + DATABASE() antlr.TerminalNode + Name() INameContext + DOMAIN_P() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + Function_with_argtypes() IFunction_with_argtypesContext + LANGUAGE() antlr.TerminalNode + Opt_procedural() IOpt_proceduralContext + LARGE_P() antlr.TerminalNode + OBJECT_P() antlr.TerminalNode + Numericonly() INumericonlyContext + OPERATOR() antlr.TerminalNode + Operator_with_argtypes() IOperator_with_argtypesContext + CLASS() antlr.TerminalNode + USING() antlr.TerminalNode + FAMILY() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + STATISTICS() antlr.TerminalNode + TEXT_P() antlr.TerminalNode + SEARCH() antlr.TerminalNode + DICTIONARY() antlr.TerminalNode + CONFIGURATION() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + DATA_P() antlr.TerminalNode + WRAPPER() antlr.TerminalNode + SERVER() antlr.TerminalNode + EVENT() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + PUBLICATION() antlr.TerminalNode + SUBSCRIPTION() antlr.TerminalNode + + // IsAlterownerstmtContext differentiates from other interfaces. + IsAlterownerstmtContext() +} + +type AlterownerstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterownerstmtContext() *AlterownerstmtContext { + var p = new(AlterownerstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterownerstmt + return p +} + +func InitEmptyAlterownerstmtContext(p *AlterownerstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterownerstmt +} + +func (*AlterownerstmtContext) IsAlterownerstmtContext() {} + +func NewAlterownerstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterownerstmtContext { + var p = new(AlterownerstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterownerstmt + + return p +} + +func (s *AlterownerstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterownerstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterownerstmtContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *AlterownerstmtContext) Aggregate_with_argtypes() IAggregate_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAggregate_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAggregate_with_argtypesContext) +} + +func (s *AlterownerstmtContext) OWNER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNER, 0) +} + +func (s *AlterownerstmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *AlterownerstmtContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *AlterownerstmtContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *AlterownerstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AlterownerstmtContext) CONVERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONVERSION_P, 0) +} + +func (s *AlterownerstmtContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *AlterownerstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterownerstmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *AlterownerstmtContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *AlterownerstmtContext) Function_with_argtypes() IFunction_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunction_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunction_with_argtypesContext) +} + +func (s *AlterownerstmtContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *AlterownerstmtContext) Opt_procedural() IOpt_proceduralContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_proceduralContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_proceduralContext) +} + +func (s *AlterownerstmtContext) LARGE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLARGE_P, 0) +} + +func (s *AlterownerstmtContext) OBJECT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOBJECT_P, 0) +} + +func (s *AlterownerstmtContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *AlterownerstmtContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *AlterownerstmtContext) Operator_with_argtypes() IOperator_with_argtypesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOperator_with_argtypesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOperator_with_argtypesContext) +} + +func (s *AlterownerstmtContext) CLASS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLASS, 0) +} + +func (s *AlterownerstmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *AlterownerstmtContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *AlterownerstmtContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *AlterownerstmtContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *AlterownerstmtContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *AlterownerstmtContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *AlterownerstmtContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *AlterownerstmtContext) STATISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, 0) +} + +func (s *AlterownerstmtContext) TEXT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEXT_P, 0) +} + +func (s *AlterownerstmtContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *AlterownerstmtContext) DICTIONARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDICTIONARY, 0) +} + +func (s *AlterownerstmtContext) CONFIGURATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFIGURATION, 0) +} + +func (s *AlterownerstmtContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *AlterownerstmtContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *AlterownerstmtContext) WRAPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRAPPER, 0) +} + +func (s *AlterownerstmtContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *AlterownerstmtContext) EVENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEVENT, 0) +} + +func (s *AlterownerstmtContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *AlterownerstmtContext) PUBLICATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPUBLICATION, 0) +} + +func (s *AlterownerstmtContext) SUBSCRIPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSCRIPTION, 0) +} + +func (s *AlterownerstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterownerstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterownerstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterownerstmt(s) + } +} + +func (s *AlterownerstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterownerstmt(s) + } +} + +func (s *AlterownerstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterownerstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterownerstmt() (localctx IAlterownerstmtContext) { + localctx = NewAlterownerstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 752, PostgreSQLParserRULE_alterownerstmt) + var _la int + + p.SetState(7306) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 559, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7121) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7122) + p.Match(PostgreSQLParserAGGREGATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7123) + p.Aggregate_with_argtypes() + } + { + p.SetState(7124) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7125) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7126) + p.Rolespec() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7128) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7129) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7130) + p.Any_name() + } + { + p.SetState(7131) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7132) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7133) + p.Rolespec() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7135) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7136) + p.Match(PostgreSQLParserCONVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7137) + p.Any_name() + } + { + p.SetState(7138) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7139) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7140) + p.Rolespec() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7142) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7143) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7144) + p.Name() + } + { + p.SetState(7145) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7146) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7147) + p.Rolespec() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7149) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7150) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7151) + p.Any_name() + } + { + p.SetState(7152) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7153) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7154) + p.Rolespec() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(7156) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7157) + p.Match(PostgreSQLParserFUNCTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7158) + p.Function_with_argtypes() + } + { + p.SetState(7159) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7160) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7161) + p.Rolespec() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(7163) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7165) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPROCEDURAL { + { + p.SetState(7164) + p.Opt_procedural() + } + + } + { + p.SetState(7167) + p.Match(PostgreSQLParserLANGUAGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7168) + p.Name() + } + { + p.SetState(7169) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7170) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7171) + p.Rolespec() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(7173) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7174) + p.Match(PostgreSQLParserLARGE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7175) + p.Match(PostgreSQLParserOBJECT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7176) + p.Numericonly() + } + { + p.SetState(7177) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7178) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7179) + p.Rolespec() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(7181) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7182) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7183) + p.Operator_with_argtypes() + } + { + p.SetState(7184) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7185) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7186) + p.Rolespec() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(7188) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7189) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7190) + p.Match(PostgreSQLParserCLASS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7191) + p.Any_name() + } + { + p.SetState(7192) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7193) + p.Name() + } + { + p.SetState(7194) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7195) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7196) + p.Rolespec() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(7198) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7199) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7200) + p.Match(PostgreSQLParserFAMILY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7201) + p.Any_name() + } + { + p.SetState(7202) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7203) + p.Name() + } + { + p.SetState(7204) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7205) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7206) + p.Rolespec() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(7208) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7209) + p.Match(PostgreSQLParserPROCEDURE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7210) + p.Function_with_argtypes() + } + { + p.SetState(7211) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7212) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7213) + p.Rolespec() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(7215) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7216) + p.Match(PostgreSQLParserROUTINE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7217) + p.Function_with_argtypes() + } + { + p.SetState(7218) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7219) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7220) + p.Rolespec() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(7222) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7223) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7224) + p.Name() + } + { + p.SetState(7225) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7226) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7227) + p.Rolespec() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(7229) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7230) + p.Match(PostgreSQLParserTYPE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7231) + p.Any_name() + } + { + p.SetState(7232) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7233) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7234) + p.Rolespec() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(7236) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7237) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7238) + p.Name() + } + { + p.SetState(7239) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7240) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7241) + p.Rolespec() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(7243) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7244) + p.Match(PostgreSQLParserSTATISTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7245) + p.Any_name() + } + { + p.SetState(7246) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7247) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7248) + p.Rolespec() + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(7250) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7251) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7252) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7253) + p.Match(PostgreSQLParserDICTIONARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7254) + p.Any_name() + } + { + p.SetState(7255) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7256) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7257) + p.Rolespec() + } + + case 19: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(7259) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7260) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7261) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7262) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7263) + p.Any_name() + } + { + p.SetState(7264) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7265) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7266) + p.Rolespec() + } + + case 20: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(7268) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7269) + p.Match(PostgreSQLParserFOREIGN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7270) + p.Match(PostgreSQLParserDATA_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7271) + p.Match(PostgreSQLParserWRAPPER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7272) + p.Name() + } + { + p.SetState(7273) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7274) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7275) + p.Rolespec() + } + + case 21: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(7277) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7278) + p.Match(PostgreSQLParserSERVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7279) + p.Name() + } + { + p.SetState(7280) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7281) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7282) + p.Rolespec() + } + + case 22: + p.EnterOuterAlt(localctx, 22) + { + p.SetState(7284) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7285) + p.Match(PostgreSQLParserEVENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7286) + p.Match(PostgreSQLParserTRIGGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7287) + p.Name() + } + { + p.SetState(7288) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7289) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7290) + p.Rolespec() + } + + case 23: + p.EnterOuterAlt(localctx, 23) + { + p.SetState(7292) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7293) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7294) + p.Name() + } + { + p.SetState(7295) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7296) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7297) + p.Rolespec() + } + + case 24: + p.EnterOuterAlt(localctx, 24) + { + p.SetState(7299) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7300) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7301) + p.Name() + } + { + p.SetState(7302) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7303) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7304) + p.Rolespec() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatepublicationstmtContext is an interface to support dynamic dispatch. +type ICreatepublicationstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + PUBLICATION() antlr.TerminalNode + Name() INameContext + Opt_definition() IOpt_definitionContext + FOR() antlr.TerminalNode + ALL() antlr.TerminalNode + TABLES() antlr.TerminalNode + Pub_obj_list() IPub_obj_listContext + + // IsCreatepublicationstmtContext differentiates from other interfaces. + IsCreatepublicationstmtContext() +} + +type CreatepublicationstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatepublicationstmtContext() *CreatepublicationstmtContext { + var p = new(CreatepublicationstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createpublicationstmt + return p +} + +func InitEmptyCreatepublicationstmtContext(p *CreatepublicationstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createpublicationstmt +} + +func (*CreatepublicationstmtContext) IsCreatepublicationstmtContext() {} + +func NewCreatepublicationstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatepublicationstmtContext { + var p = new(CreatepublicationstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createpublicationstmt + + return p +} + +func (s *CreatepublicationstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatepublicationstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatepublicationstmtContext) PUBLICATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPUBLICATION, 0) +} + +func (s *CreatepublicationstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreatepublicationstmtContext) Opt_definition() IOpt_definitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_definitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_definitionContext) +} + +func (s *CreatepublicationstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *CreatepublicationstmtContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *CreatepublicationstmtContext) TABLES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLES, 0) +} + +func (s *CreatepublicationstmtContext) Pub_obj_list() IPub_obj_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPub_obj_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPub_obj_listContext) +} + +func (s *CreatepublicationstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatepublicationstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatepublicationstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatepublicationstmt(s) + } +} + +func (s *CreatepublicationstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatepublicationstmt(s) + } +} + +func (s *CreatepublicationstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatepublicationstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createpublicationstmt() (localctx ICreatepublicationstmtContext) { + localctx = NewCreatepublicationstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 754, PostgreSQLParserRULE_createpublicationstmt) + p.SetState(7331) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 563, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7308) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7309) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7310) + p.Name() + } + p.SetState(7312) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 560, p.GetParserRuleContext()) == 1 { + { + p.SetState(7311) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7314) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7315) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7316) + p.Name() + } + { + p.SetState(7317) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7318) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7319) + p.Match(PostgreSQLParserTABLES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7321) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 561, p.GetParserRuleContext()) == 1 { + { + p.SetState(7320) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7323) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7324) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7325) + p.Name() + } + { + p.SetState(7326) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7327) + p.Pub_obj_list() + } + p.SetState(7329) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 562, p.GetParserRuleContext()) == 1 { + { + p.SetState(7328) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPub_obj_listContext is an interface to support dynamic dispatch. +type IPub_obj_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllPublication_obj_spec() []IPublication_obj_specContext + Publication_obj_spec(i int) IPublication_obj_specContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsPub_obj_listContext differentiates from other interfaces. + IsPub_obj_listContext() +} + +type Pub_obj_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPub_obj_listContext() *Pub_obj_listContext { + var p = new(Pub_obj_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_pub_obj_list + return p +} + +func InitEmptyPub_obj_listContext(p *Pub_obj_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_pub_obj_list +} + +func (*Pub_obj_listContext) IsPub_obj_listContext() {} + +func NewPub_obj_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pub_obj_listContext { + var p = new(Pub_obj_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_pub_obj_list + + return p +} + +func (s *Pub_obj_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Pub_obj_listContext) AllPublication_obj_spec() []IPublication_obj_specContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IPublication_obj_specContext); ok { + len++ + } + } + + tst := make([]IPublication_obj_specContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IPublication_obj_specContext); ok { + tst[i] = t.(IPublication_obj_specContext) + i++ + } + } + + return tst +} + +func (s *Pub_obj_listContext) Publication_obj_spec(i int) IPublication_obj_specContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPublication_obj_specContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IPublication_obj_specContext) +} + +func (s *Pub_obj_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Pub_obj_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Pub_obj_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Pub_obj_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Pub_obj_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPub_obj_list(s) + } +} + +func (s *Pub_obj_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPub_obj_list(s) + } +} + +func (s *Pub_obj_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPub_obj_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Pub_obj_list() (localctx IPub_obj_listContext) { + localctx = NewPub_obj_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 756, PostgreSQLParserRULE_pub_obj_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7333) + p.Publication_obj_spec() + } + p.SetState(7338) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(7334) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7335) + p.Publication_obj_spec() + } + + p.SetState(7340) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPublication_obj_specContext is an interface to support dynamic dispatch. +type IPublication_obj_specContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TABLE() antlr.TerminalNode + Relation_expr() IRelation_exprContext + Opt_column_list() IOpt_column_listContext + Opt_where_clause() IOpt_where_clauseContext + IN_P() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + Colid() IColidContext + CURRENT_SCHEMA() antlr.TerminalNode + Indirection() IIndirectionContext + + // IsPublication_obj_specContext differentiates from other interfaces. + IsPublication_obj_specContext() +} + +type Publication_obj_specContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPublication_obj_specContext() *Publication_obj_specContext { + var p = new(Publication_obj_specContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_publication_obj_spec + return p +} + +func InitEmptyPublication_obj_specContext(p *Publication_obj_specContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_publication_obj_spec +} + +func (*Publication_obj_specContext) IsPublication_obj_specContext() {} + +func NewPublication_obj_specContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Publication_obj_specContext { + var p = new(Publication_obj_specContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_publication_obj_spec + + return p +} + +func (s *Publication_obj_specContext) GetParser() antlr.Parser { return s.parser } + +func (s *Publication_obj_specContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Publication_obj_specContext) Relation_expr() IRelation_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *Publication_obj_specContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *Publication_obj_specContext) Opt_where_clause() IOpt_where_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_where_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_where_clauseContext) +} + +func (s *Publication_obj_specContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Publication_obj_specContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Publication_obj_specContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Publication_obj_specContext) CURRENT_SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_SCHEMA, 0) +} + +func (s *Publication_obj_specContext) Indirection() IIndirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndirectionContext) +} + +func (s *Publication_obj_specContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Publication_obj_specContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Publication_obj_specContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPublication_obj_spec(s) + } +} + +func (s *Publication_obj_specContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPublication_obj_spec(s) + } +} + +func (s *Publication_obj_specContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPublication_obj_spec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Publication_obj_spec() (localctx IPublication_obj_specContext) { + localctx = NewPublication_obj_specContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 758, PostgreSQLParserRULE_publication_obj_spec) + var _la int + + p.SetState(7379) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 574, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7341) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7342) + p.Relation_expr() + } + p.SetState(7344) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 565, p.GetParserRuleContext()) == 1 { + { + p.SetState(7343) + p.Opt_column_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(7347) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(7346) + p.Opt_where_clause() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7349) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7350) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7351) + p.Match(PostgreSQLParserSCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7354) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(7352) + p.Colid() + } + + case PostgreSQLParserCURRENT_SCHEMA: + { + p.SetState(7353) + p.Match(PostgreSQLParserCURRENT_SCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7356) + p.Colid() + } + p.SetState(7358) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 568, p.GetParserRuleContext()) == 1 { + { + p.SetState(7357) + p.Opt_column_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(7361) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(7360) + p.Opt_where_clause() + } + + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7363) + p.Colid() + } + { + p.SetState(7364) + p.Indirection() + } + p.SetState(7366) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 570, p.GetParserRuleContext()) == 1 { + { + p.SetState(7365) + p.Opt_column_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(7369) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(7368) + p.Opt_where_clause() + } + + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7371) + p.Relation_expr() + } + p.SetState(7373) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 572, p.GetParserRuleContext()) == 1 { + { + p.SetState(7372) + p.Opt_column_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(7376) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(7375) + p.Opt_where_clause() + } + + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(7378) + p.Match(PostgreSQLParserCURRENT_SCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_where_clauseContext is an interface to support dynamic dispatch. +type IOpt_where_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHERE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_where_clauseContext differentiates from other interfaces. + IsOpt_where_clauseContext() +} + +type Opt_where_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_where_clauseContext() *Opt_where_clauseContext { + var p = new(Opt_where_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_where_clause + return p +} + +func InitEmptyOpt_where_clauseContext(p *Opt_where_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_where_clause +} + +func (*Opt_where_clauseContext) IsOpt_where_clauseContext() {} + +func NewOpt_where_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_where_clauseContext { + var p = new(Opt_where_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_where_clause + + return p +} + +func (s *Opt_where_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_where_clauseContext) WHERE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHERE, 0) +} + +func (s *Opt_where_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_where_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_where_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_where_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_where_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_where_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_where_clause(s) + } +} + +func (s *Opt_where_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_where_clause(s) + } +} + +func (s *Opt_where_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_where_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_where_clause() (localctx IOpt_where_clauseContext) { + localctx = NewOpt_where_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 760, PostgreSQLParserRULE_opt_where_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7381) + p.Match(PostgreSQLParserWHERE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7382) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7383) + p.A_expr() + } + { + p.SetState(7384) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterpublicationstmtContext is an interface to support dynamic dispatch. +type IAlterpublicationstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + PUBLICATION() antlr.TerminalNode + Name() INameContext + SET() antlr.TerminalNode + Definition() IDefinitionContext + ADD_P() antlr.TerminalNode + Pub_obj_list() IPub_obj_listContext + DROP() antlr.TerminalNode + + // IsAlterpublicationstmtContext differentiates from other interfaces. + IsAlterpublicationstmtContext() +} + +type AlterpublicationstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterpublicationstmtContext() *AlterpublicationstmtContext { + var p = new(AlterpublicationstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterpublicationstmt + return p +} + +func InitEmptyAlterpublicationstmtContext(p *AlterpublicationstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterpublicationstmt +} + +func (*AlterpublicationstmtContext) IsAlterpublicationstmtContext() {} + +func NewAlterpublicationstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterpublicationstmtContext { + var p = new(AlterpublicationstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterpublicationstmt + + return p +} + +func (s *AlterpublicationstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterpublicationstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterpublicationstmtContext) PUBLICATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPUBLICATION, 0) +} + +func (s *AlterpublicationstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterpublicationstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AlterpublicationstmtContext) Definition() IDefinitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefinitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefinitionContext) +} + +func (s *AlterpublicationstmtContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *AlterpublicationstmtContext) Pub_obj_list() IPub_obj_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPub_obj_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPub_obj_listContext) +} + +func (s *AlterpublicationstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *AlterpublicationstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterpublicationstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterpublicationstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterpublicationstmt(s) + } +} + +func (s *AlterpublicationstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterpublicationstmt(s) + } +} + +func (s *AlterpublicationstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterpublicationstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterpublicationstmt() (localctx IAlterpublicationstmtContext) { + localctx = NewAlterpublicationstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 762, PostgreSQLParserRULE_alterpublicationstmt) + p.SetState(7410) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 575, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7386) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7387) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7388) + p.Name() + } + { + p.SetState(7389) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7390) + p.Definition() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7392) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7393) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7394) + p.Name() + } + { + p.SetState(7395) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7396) + p.Pub_obj_list() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7398) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7399) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7400) + p.Name() + } + { + p.SetState(7401) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7402) + p.Pub_obj_list() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7404) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7405) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7406) + p.Name() + } + { + p.SetState(7407) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7408) + p.Pub_obj_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatesubscriptionstmtContext is an interface to support dynamic dispatch. +type ICreatesubscriptionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + SUBSCRIPTION() antlr.TerminalNode + Name() INameContext + CONNECTION() antlr.TerminalNode + Sconst() ISconstContext + PUBLICATION() antlr.TerminalNode + Publication_name_list() IPublication_name_listContext + Opt_definition() IOpt_definitionContext + + // IsCreatesubscriptionstmtContext differentiates from other interfaces. + IsCreatesubscriptionstmtContext() +} + +type CreatesubscriptionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatesubscriptionstmtContext() *CreatesubscriptionstmtContext { + var p = new(CreatesubscriptionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createsubscriptionstmt + return p +} + +func InitEmptyCreatesubscriptionstmtContext(p *CreatesubscriptionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createsubscriptionstmt +} + +func (*CreatesubscriptionstmtContext) IsCreatesubscriptionstmtContext() {} + +func NewCreatesubscriptionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatesubscriptionstmtContext { + var p = new(CreatesubscriptionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createsubscriptionstmt + + return p +} + +func (s *CreatesubscriptionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatesubscriptionstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatesubscriptionstmtContext) SUBSCRIPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSCRIPTION, 0) +} + +func (s *CreatesubscriptionstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreatesubscriptionstmtContext) CONNECTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONNECTION, 0) +} + +func (s *CreatesubscriptionstmtContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *CreatesubscriptionstmtContext) PUBLICATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPUBLICATION, 0) +} + +func (s *CreatesubscriptionstmtContext) Publication_name_list() IPublication_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPublication_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPublication_name_listContext) +} + +func (s *CreatesubscriptionstmtContext) Opt_definition() IOpt_definitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_definitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_definitionContext) +} + +func (s *CreatesubscriptionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatesubscriptionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatesubscriptionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatesubscriptionstmt(s) + } +} + +func (s *CreatesubscriptionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatesubscriptionstmt(s) + } +} + +func (s *CreatesubscriptionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatesubscriptionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createsubscriptionstmt() (localctx ICreatesubscriptionstmtContext) { + localctx = NewCreatesubscriptionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 764, PostgreSQLParserRULE_createsubscriptionstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7412) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7413) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7414) + p.Name() + } + { + p.SetState(7415) + p.Match(PostgreSQLParserCONNECTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7416) + p.Sconst() + } + { + p.SetState(7417) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7418) + p.Publication_name_list() + } + p.SetState(7420) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 576, p.GetParserRuleContext()) == 1 { + { + p.SetState(7419) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPublication_name_listContext is an interface to support dynamic dispatch. +type IPublication_name_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllPublication_name_item() []IPublication_name_itemContext + Publication_name_item(i int) IPublication_name_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsPublication_name_listContext differentiates from other interfaces. + IsPublication_name_listContext() +} + +type Publication_name_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPublication_name_listContext() *Publication_name_listContext { + var p = new(Publication_name_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_publication_name_list + return p +} + +func InitEmptyPublication_name_listContext(p *Publication_name_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_publication_name_list +} + +func (*Publication_name_listContext) IsPublication_name_listContext() {} + +func NewPublication_name_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Publication_name_listContext { + var p = new(Publication_name_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_publication_name_list + + return p +} + +func (s *Publication_name_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Publication_name_listContext) AllPublication_name_item() []IPublication_name_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IPublication_name_itemContext); ok { + len++ + } + } + + tst := make([]IPublication_name_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IPublication_name_itemContext); ok { + tst[i] = t.(IPublication_name_itemContext) + i++ + } + } + + return tst +} + +func (s *Publication_name_listContext) Publication_name_item(i int) IPublication_name_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPublication_name_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IPublication_name_itemContext) +} + +func (s *Publication_name_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Publication_name_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Publication_name_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Publication_name_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Publication_name_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPublication_name_list(s) + } +} + +func (s *Publication_name_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPublication_name_list(s) + } +} + +func (s *Publication_name_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPublication_name_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Publication_name_list() (localctx IPublication_name_listContext) { + localctx = NewPublication_name_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 766, PostgreSQLParserRULE_publication_name_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7422) + p.Publication_name_item() + } + p.SetState(7427) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(7423) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7424) + p.Publication_name_item() + } + + p.SetState(7429) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPublication_name_itemContext is an interface to support dynamic dispatch. +type IPublication_name_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Collabel() ICollabelContext + + // IsPublication_name_itemContext differentiates from other interfaces. + IsPublication_name_itemContext() +} + +type Publication_name_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPublication_name_itemContext() *Publication_name_itemContext { + var p = new(Publication_name_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_publication_name_item + return p +} + +func InitEmptyPublication_name_itemContext(p *Publication_name_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_publication_name_item +} + +func (*Publication_name_itemContext) IsPublication_name_itemContext() {} + +func NewPublication_name_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Publication_name_itemContext { + var p = new(Publication_name_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_publication_name_item + + return p +} + +func (s *Publication_name_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Publication_name_itemContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Publication_name_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Publication_name_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Publication_name_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPublication_name_item(s) + } +} + +func (s *Publication_name_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPublication_name_item(s) + } +} + +func (s *Publication_name_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPublication_name_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Publication_name_item() (localctx IPublication_name_itemContext) { + localctx = NewPublication_name_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 768, PostgreSQLParserRULE_publication_name_item) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7430) + p.Collabel() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltersubscriptionstmtContext is an interface to support dynamic dispatch. +type IAltersubscriptionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + SUBSCRIPTION() antlr.TerminalNode + Name() INameContext + SET() antlr.TerminalNode + Definition() IDefinitionContext + CONNECTION() antlr.TerminalNode + Sconst() ISconstContext + REFRESH() antlr.TerminalNode + PUBLICATION() antlr.TerminalNode + Opt_definition() IOpt_definitionContext + Publication_name_list() IPublication_name_listContext + ENABLE_P() antlr.TerminalNode + DISABLE_P() antlr.TerminalNode + SKIP_P() antlr.TerminalNode + + // IsAltersubscriptionstmtContext differentiates from other interfaces. + IsAltersubscriptionstmtContext() +} + +type AltersubscriptionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltersubscriptionstmtContext() *AltersubscriptionstmtContext { + var p = new(AltersubscriptionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altersubscriptionstmt + return p +} + +func InitEmptyAltersubscriptionstmtContext(p *AltersubscriptionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altersubscriptionstmt +} + +func (*AltersubscriptionstmtContext) IsAltersubscriptionstmtContext() {} + +func NewAltersubscriptionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltersubscriptionstmtContext { + var p = new(AltersubscriptionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altersubscriptionstmt + + return p +} + +func (s *AltersubscriptionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltersubscriptionstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltersubscriptionstmtContext) SUBSCRIPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSCRIPTION, 0) +} + +func (s *AltersubscriptionstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AltersubscriptionstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AltersubscriptionstmtContext) Definition() IDefinitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefinitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefinitionContext) +} + +func (s *AltersubscriptionstmtContext) CONNECTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONNECTION, 0) +} + +func (s *AltersubscriptionstmtContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *AltersubscriptionstmtContext) REFRESH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFRESH, 0) +} + +func (s *AltersubscriptionstmtContext) PUBLICATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPUBLICATION, 0) +} + +func (s *AltersubscriptionstmtContext) Opt_definition() IOpt_definitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_definitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_definitionContext) +} + +func (s *AltersubscriptionstmtContext) Publication_name_list() IPublication_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPublication_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPublication_name_listContext) +} + +func (s *AltersubscriptionstmtContext) ENABLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENABLE_P, 0) +} + +func (s *AltersubscriptionstmtContext) DISABLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISABLE_P, 0) +} + +func (s *AltersubscriptionstmtContext) SKIP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSKIP_P, 0) +} + +func (s *AltersubscriptionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltersubscriptionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltersubscriptionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltersubscriptionstmt(s) + } +} + +func (s *AltersubscriptionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltersubscriptionstmt(s) + } +} + +func (s *AltersubscriptionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltersubscriptionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altersubscriptionstmt() (localctx IAltersubscriptionstmtContext) { + localctx = NewAltersubscriptionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 770, PostgreSQLParserRULE_altersubscriptionstmt) + p.SetState(7477) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 580, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7432) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7433) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7434) + p.Name() + } + { + p.SetState(7435) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7436) + p.Definition() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7438) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7439) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7440) + p.Name() + } + { + p.SetState(7441) + p.Match(PostgreSQLParserCONNECTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7442) + p.Sconst() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7444) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7445) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7446) + p.Name() + } + { + p.SetState(7447) + p.Match(PostgreSQLParserREFRESH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7448) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7450) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 578, p.GetParserRuleContext()) == 1 { + { + p.SetState(7449) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7452) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7453) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7454) + p.Name() + } + { + p.SetState(7455) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7456) + p.Match(PostgreSQLParserPUBLICATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7457) + p.Publication_name_list() + } + p.SetState(7459) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 579, p.GetParserRuleContext()) == 1 { + { + p.SetState(7458) + p.Opt_definition() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7461) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7462) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7463) + p.Name() + } + { + p.SetState(7464) + p.Match(PostgreSQLParserENABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(7466) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7467) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7468) + p.Name() + } + { + p.SetState(7469) + p.Match(PostgreSQLParserDISABLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(7471) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7472) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7473) + p.Name() + } + { + p.SetState(7474) + p.Match(PostgreSQLParserSKIP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7475) + p.Definition() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDropsubscriptionstmtContext is an interface to support dynamic dispatch. +type IDropsubscriptionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + SUBSCRIPTION() antlr.TerminalNode + Name() INameContext + Opt_drop_behavior() IOpt_drop_behaviorContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsDropsubscriptionstmtContext differentiates from other interfaces. + IsDropsubscriptionstmtContext() +} + +type DropsubscriptionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDropsubscriptionstmtContext() *DropsubscriptionstmtContext { + var p = new(DropsubscriptionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropsubscriptionstmt + return p +} + +func InitEmptyDropsubscriptionstmtContext(p *DropsubscriptionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropsubscriptionstmt +} + +func (*DropsubscriptionstmtContext) IsDropsubscriptionstmtContext() {} + +func NewDropsubscriptionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropsubscriptionstmtContext { + var p = new(DropsubscriptionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dropsubscriptionstmt + + return p +} + +func (s *DropsubscriptionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DropsubscriptionstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DropsubscriptionstmtContext) SUBSCRIPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSCRIPTION, 0) +} + +func (s *DropsubscriptionstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DropsubscriptionstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *DropsubscriptionstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DropsubscriptionstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DropsubscriptionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DropsubscriptionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DropsubscriptionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDropsubscriptionstmt(s) + } +} + +func (s *DropsubscriptionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDropsubscriptionstmt(s) + } +} + +func (s *DropsubscriptionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDropsubscriptionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dropsubscriptionstmt() (localctx IDropsubscriptionstmtContext) { + localctx = NewDropsubscriptionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 772, PostgreSQLParserRULE_dropsubscriptionstmt) + var _la int + + p.SetState(7493) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 583, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7479) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7480) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7481) + p.Name() + } + p.SetState(7483) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(7482) + p.Opt_drop_behavior() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7485) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7486) + p.Match(PostgreSQLParserSUBSCRIPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7487) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7488) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7489) + p.Name() + } + p.SetState(7491) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(7490) + p.Opt_drop_behavior() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRulestmtContext is an interface to support dynamic dispatch. +type IRulestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + RULE() antlr.TerminalNode + Name() INameContext + AS() antlr.TerminalNode + ON() antlr.TerminalNode + Event() IEventContext + TO() antlr.TerminalNode + Qualified_name() IQualified_nameContext + DO() antlr.TerminalNode + Ruleactionlist() IRuleactionlistContext + Opt_or_replace() IOpt_or_replaceContext + Where_clause() IWhere_clauseContext + Opt_instead() IOpt_insteadContext + + // IsRulestmtContext differentiates from other interfaces. + IsRulestmtContext() +} + +type RulestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRulestmtContext() *RulestmtContext { + var p = new(RulestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rulestmt + return p +} + +func InitEmptyRulestmtContext(p *RulestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rulestmt +} + +func (*RulestmtContext) IsRulestmtContext() {} + +func NewRulestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RulestmtContext { + var p = new(RulestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rulestmt + + return p +} + +func (s *RulestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RulestmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *RulestmtContext) RULE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRULE, 0) +} + +func (s *RulestmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *RulestmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *RulestmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *RulestmtContext) Event() IEventContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEventContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEventContext) +} + +func (s *RulestmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *RulestmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *RulestmtContext) DO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDO, 0) +} + +func (s *RulestmtContext) Ruleactionlist() IRuleactionlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleactionlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleactionlistContext) +} + +func (s *RulestmtContext) Opt_or_replace() IOpt_or_replaceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_or_replaceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_or_replaceContext) +} + +func (s *RulestmtContext) Where_clause() IWhere_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_clauseContext) +} + +func (s *RulestmtContext) Opt_instead() IOpt_insteadContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_insteadContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_insteadContext) +} + +func (s *RulestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RulestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RulestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRulestmt(s) + } +} + +func (s *RulestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRulestmt(s) + } +} + +func (s *RulestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRulestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rulestmt() (localctx IRulestmtContext) { + localctx = NewRulestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 774, PostgreSQLParserRULE_rulestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7495) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7497) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOR { + { + p.SetState(7496) + p.Opt_or_replace() + } + + } + { + p.SetState(7499) + p.Match(PostgreSQLParserRULE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7500) + p.Name() + } + { + p.SetState(7501) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7502) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7503) + p.Event() + } + { + p.SetState(7504) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7505) + p.Qualified_name() + } + p.SetState(7507) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(7506) + p.Where_clause() + } + + } + { + p.SetState(7509) + p.Match(PostgreSQLParserDO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7511) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserALSO || _la == PostgreSQLParserINSTEAD { + { + p.SetState(7510) + p.Opt_instead() + } + + } + { + p.SetState(7513) + p.Ruleactionlist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleactionlistContext is an interface to support dynamic dispatch. +type IRuleactionlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOTHING() antlr.TerminalNode + Ruleactionstmt() IRuleactionstmtContext + OPEN_PAREN() antlr.TerminalNode + Ruleactionmulti() IRuleactionmultiContext + CLOSE_PAREN() antlr.TerminalNode + + // IsRuleactionlistContext differentiates from other interfaces. + IsRuleactionlistContext() +} + +type RuleactionlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleactionlistContext() *RuleactionlistContext { + var p = new(RuleactionlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_ruleactionlist + return p +} + +func InitEmptyRuleactionlistContext(p *RuleactionlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_ruleactionlist +} + +func (*RuleactionlistContext) IsRuleactionlistContext() {} + +func NewRuleactionlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleactionlistContext { + var p = new(RuleactionlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_ruleactionlist + + return p +} + +func (s *RuleactionlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleactionlistContext) NOTHING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTHING, 0) +} + +func (s *RuleactionlistContext) Ruleactionstmt() IRuleactionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleactionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleactionstmtContext) +} + +func (s *RuleactionlistContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *RuleactionlistContext) Ruleactionmulti() IRuleactionmultiContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleactionmultiContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleactionmultiContext) +} + +func (s *RuleactionlistContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *RuleactionlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleactionlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleactionlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRuleactionlist(s) + } +} + +func (s *RuleactionlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRuleactionlist(s) + } +} + +func (s *RuleactionlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRuleactionlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Ruleactionlist() (localctx IRuleactionlistContext) { + localctx = NewRuleactionlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 776, PostgreSQLParserRULE_ruleactionlist) + p.SetState(7521) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 587, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7515) + p.Match(PostgreSQLParserNOTHING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7516) + p.Ruleactionstmt() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7517) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7518) + p.Ruleactionmulti() + } + { + p.SetState(7519) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleactionmultiContext is an interface to support dynamic dispatch. +type IRuleactionmultiContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllRuleactionstmtOrEmpty() []IRuleactionstmtOrEmptyContext + RuleactionstmtOrEmpty(i int) IRuleactionstmtOrEmptyContext + AllSEMI() []antlr.TerminalNode + SEMI(i int) antlr.TerminalNode + + // IsRuleactionmultiContext differentiates from other interfaces. + IsRuleactionmultiContext() +} + +type RuleactionmultiContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleactionmultiContext() *RuleactionmultiContext { + var p = new(RuleactionmultiContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_ruleactionmulti + return p +} + +func InitEmptyRuleactionmultiContext(p *RuleactionmultiContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_ruleactionmulti +} + +func (*RuleactionmultiContext) IsRuleactionmultiContext() {} + +func NewRuleactionmultiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleactionmultiContext { + var p = new(RuleactionmultiContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_ruleactionmulti + + return p +} + +func (s *RuleactionmultiContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleactionmultiContext) AllRuleactionstmtOrEmpty() []IRuleactionstmtOrEmptyContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRuleactionstmtOrEmptyContext); ok { + len++ + } + } + + tst := make([]IRuleactionstmtOrEmptyContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRuleactionstmtOrEmptyContext); ok { + tst[i] = t.(IRuleactionstmtOrEmptyContext) + i++ + } + } + + return tst +} + +func (s *RuleactionmultiContext) RuleactionstmtOrEmpty(i int) IRuleactionstmtOrEmptyContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleactionstmtOrEmptyContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRuleactionstmtOrEmptyContext) +} + +func (s *RuleactionmultiContext) AllSEMI() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserSEMI) +} + +func (s *RuleactionmultiContext) SEMI(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, i) +} + +func (s *RuleactionmultiContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleactionmultiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleactionmultiContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRuleactionmulti(s) + } +} + +func (s *RuleactionmultiContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRuleactionmulti(s) + } +} + +func (s *RuleactionmultiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRuleactionmulti(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Ruleactionmulti() (localctx IRuleactionmultiContext) { + localctx = NewRuleactionmultiContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 778, PostgreSQLParserRULE_ruleactionmulti) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(7524) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN || ((int64((_la-88)) & ^0x3f) == 0 && ((int64(1)<<(_la-88))&131089) != 0) || _la == PostgreSQLParserDELETE_P || _la == PostgreSQLParserINSERT || _la == PostgreSQLParserNOTIFY || _la == PostgreSQLParserUPDATE || _la == PostgreSQLParserVALUES { + { + p.SetState(7523) + p.RuleactionstmtOrEmpty() + } + + } + p.SetState(7532) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserSEMI { + { + p.SetState(7526) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7528) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN || ((int64((_la-88)) & ^0x3f) == 0 && ((int64(1)<<(_la-88))&131089) != 0) || _la == PostgreSQLParserDELETE_P || _la == PostgreSQLParserINSERT || _la == PostgreSQLParserNOTIFY || _la == PostgreSQLParserUPDATE || _la == PostgreSQLParserVALUES { + { + p.SetState(7527) + p.RuleactionstmtOrEmpty() + } + + } + + p.SetState(7534) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleactionstmtContext is an interface to support dynamic dispatch. +type IRuleactionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Selectstmt() ISelectstmtContext + Insertstmt() IInsertstmtContext + Updatestmt() IUpdatestmtContext + Deletestmt() IDeletestmtContext + Notifystmt() INotifystmtContext + + // IsRuleactionstmtContext differentiates from other interfaces. + IsRuleactionstmtContext() +} + +type RuleactionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleactionstmtContext() *RuleactionstmtContext { + var p = new(RuleactionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_ruleactionstmt + return p +} + +func InitEmptyRuleactionstmtContext(p *RuleactionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_ruleactionstmt +} + +func (*RuleactionstmtContext) IsRuleactionstmtContext() {} + +func NewRuleactionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleactionstmtContext { + var p = new(RuleactionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_ruleactionstmt + + return p +} + +func (s *RuleactionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleactionstmtContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *RuleactionstmtContext) Insertstmt() IInsertstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsertstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInsertstmtContext) +} + +func (s *RuleactionstmtContext) Updatestmt() IUpdatestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUpdatestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUpdatestmtContext) +} + +func (s *RuleactionstmtContext) Deletestmt() IDeletestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDeletestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDeletestmtContext) +} + +func (s *RuleactionstmtContext) Notifystmt() INotifystmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INotifystmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INotifystmtContext) +} + +func (s *RuleactionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleactionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleactionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRuleactionstmt(s) + } +} + +func (s *RuleactionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRuleactionstmt(s) + } +} + +func (s *RuleactionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRuleactionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Ruleactionstmt() (localctx IRuleactionstmtContext) { + localctx = NewRuleactionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 780, PostgreSQLParserRULE_ruleactionstmt) + p.SetState(7540) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 591, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7535) + p.Selectstmt() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7536) + p.Insertstmt() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7537) + p.Updatestmt() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7538) + p.Deletestmt() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7539) + p.Notifystmt() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRuleactionstmtOrEmptyContext is an interface to support dynamic dispatch. +type IRuleactionstmtOrEmptyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Ruleactionstmt() IRuleactionstmtContext + + // IsRuleactionstmtOrEmptyContext differentiates from other interfaces. + IsRuleactionstmtOrEmptyContext() +} + +type RuleactionstmtOrEmptyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRuleactionstmtOrEmptyContext() *RuleactionstmtOrEmptyContext { + var p = new(RuleactionstmtOrEmptyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_ruleactionstmtOrEmpty + return p +} + +func InitEmptyRuleactionstmtOrEmptyContext(p *RuleactionstmtOrEmptyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_ruleactionstmtOrEmpty +} + +func (*RuleactionstmtOrEmptyContext) IsRuleactionstmtOrEmptyContext() {} + +func NewRuleactionstmtOrEmptyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RuleactionstmtOrEmptyContext { + var p = new(RuleactionstmtOrEmptyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_ruleactionstmtOrEmpty + + return p +} + +func (s *RuleactionstmtOrEmptyContext) GetParser() antlr.Parser { return s.parser } + +func (s *RuleactionstmtOrEmptyContext) Ruleactionstmt() IRuleactionstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRuleactionstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRuleactionstmtContext) +} + +func (s *RuleactionstmtOrEmptyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RuleactionstmtOrEmptyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RuleactionstmtOrEmptyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRuleactionstmtOrEmpty(s) + } +} + +func (s *RuleactionstmtOrEmptyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRuleactionstmtOrEmpty(s) + } +} + +func (s *RuleactionstmtOrEmptyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRuleactionstmtOrEmpty(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) RuleactionstmtOrEmpty() (localctx IRuleactionstmtOrEmptyContext) { + localctx = NewRuleactionstmtOrEmptyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 782, PostgreSQLParserRULE_ruleactionstmtOrEmpty) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7542) + p.Ruleactionstmt() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEventContext is an interface to support dynamic dispatch. +type IEventContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SELECT() antlr.TerminalNode + UPDATE() antlr.TerminalNode + DELETE_P() antlr.TerminalNode + INSERT() antlr.TerminalNode + + // IsEventContext differentiates from other interfaces. + IsEventContext() +} + +type EventContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEventContext() *EventContext { + var p = new(EventContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_event + return p +} + +func InitEmptyEventContext(p *EventContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_event +} + +func (*EventContext) IsEventContext() {} + +func NewEventContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EventContext { + var p = new(EventContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_event + + return p +} + +func (s *EventContext) GetParser() antlr.Parser { return s.parser } + +func (s *EventContext) SELECT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSELECT, 0) +} + +func (s *EventContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *EventContext) DELETE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELETE_P, 0) +} + +func (s *EventContext) INSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSERT, 0) +} + +func (s *EventContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *EventContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *EventContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterEvent(s) + } +} + +func (s *EventContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitEvent(s) + } +} + +func (s *EventContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitEvent(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Event() (localctx IEventContext) { + localctx = NewEventContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 784, PostgreSQLParserRULE_event) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7544) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserSELECT || _la == PostgreSQLParserDELETE_P || _la == PostgreSQLParserINSERT || _la == PostgreSQLParserUPDATE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_insteadContext is an interface to support dynamic dispatch. +type IOpt_insteadContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INSTEAD() antlr.TerminalNode + ALSO() antlr.TerminalNode + + // IsOpt_insteadContext differentiates from other interfaces. + IsOpt_insteadContext() +} + +type Opt_insteadContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_insteadContext() *Opt_insteadContext { + var p = new(Opt_insteadContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_instead + return p +} + +func InitEmptyOpt_insteadContext(p *Opt_insteadContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_instead +} + +func (*Opt_insteadContext) IsOpt_insteadContext() {} + +func NewOpt_insteadContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_insteadContext { + var p = new(Opt_insteadContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_instead + + return p +} + +func (s *Opt_insteadContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_insteadContext) INSTEAD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSTEAD, 0) +} + +func (s *Opt_insteadContext) ALSO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALSO, 0) +} + +func (s *Opt_insteadContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_insteadContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_insteadContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_instead(s) + } +} + +func (s *Opt_insteadContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_instead(s) + } +} + +func (s *Opt_insteadContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_instead(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_instead() (localctx IOpt_insteadContext) { + localctx = NewOpt_insteadContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 786, PostgreSQLParserRULE_opt_instead) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7546) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserALSO || _la == PostgreSQLParserINSTEAD) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INotifystmtContext is an interface to support dynamic dispatch. +type INotifystmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOTIFY() antlr.TerminalNode + Colid() IColidContext + Notify_payload() INotify_payloadContext + + // IsNotifystmtContext differentiates from other interfaces. + IsNotifystmtContext() +} + +type NotifystmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNotifystmtContext() *NotifystmtContext { + var p = new(NotifystmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_notifystmt + return p +} + +func InitEmptyNotifystmtContext(p *NotifystmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_notifystmt +} + +func (*NotifystmtContext) IsNotifystmtContext() {} + +func NewNotifystmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NotifystmtContext { + var p = new(NotifystmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_notifystmt + + return p +} + +func (s *NotifystmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *NotifystmtContext) NOTIFY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTIFY, 0) +} + +func (s *NotifystmtContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *NotifystmtContext) Notify_payload() INotify_payloadContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INotify_payloadContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INotify_payloadContext) +} + +func (s *NotifystmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *NotifystmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *NotifystmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterNotifystmt(s) + } +} + +func (s *NotifystmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitNotifystmt(s) + } +} + +func (s *NotifystmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitNotifystmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Notifystmt() (localctx INotifystmtContext) { + localctx = NewNotifystmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 788, PostgreSQLParserRULE_notifystmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7548) + p.Match(PostgreSQLParserNOTIFY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7549) + p.Colid() + } + p.SetState(7551) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(7550) + p.Notify_payload() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INotify_payloadContext is an interface to support dynamic dispatch. +type INotify_payloadContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COMMA() antlr.TerminalNode + Sconst() ISconstContext + + // IsNotify_payloadContext differentiates from other interfaces. + IsNotify_payloadContext() +} + +type Notify_payloadContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNotify_payloadContext() *Notify_payloadContext { + var p = new(Notify_payloadContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_notify_payload + return p +} + +func InitEmptyNotify_payloadContext(p *Notify_payloadContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_notify_payload +} + +func (*Notify_payloadContext) IsNotify_payloadContext() {} + +func NewNotify_payloadContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Notify_payloadContext { + var p = new(Notify_payloadContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_notify_payload + + return p +} + +func (s *Notify_payloadContext) GetParser() antlr.Parser { return s.parser } + +func (s *Notify_payloadContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Notify_payloadContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Notify_payloadContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Notify_payloadContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Notify_payloadContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterNotify_payload(s) + } +} + +func (s *Notify_payloadContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitNotify_payload(s) + } +} + +func (s *Notify_payloadContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitNotify_payload(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Notify_payload() (localctx INotify_payloadContext) { + localctx = NewNotify_payloadContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 790, PostgreSQLParserRULE_notify_payload) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7553) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7554) + p.Sconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IListenstmtContext is an interface to support dynamic dispatch. +type IListenstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LISTEN() antlr.TerminalNode + Colid() IColidContext + + // IsListenstmtContext differentiates from other interfaces. + IsListenstmtContext() +} + +type ListenstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyListenstmtContext() *ListenstmtContext { + var p = new(ListenstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_listenstmt + return p +} + +func InitEmptyListenstmtContext(p *ListenstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_listenstmt +} + +func (*ListenstmtContext) IsListenstmtContext() {} + +func NewListenstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ListenstmtContext { + var p = new(ListenstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_listenstmt + + return p +} + +func (s *ListenstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ListenstmtContext) LISTEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLISTEN, 0) +} + +func (s *ListenstmtContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *ListenstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ListenstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ListenstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterListenstmt(s) + } +} + +func (s *ListenstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitListenstmt(s) + } +} + +func (s *ListenstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitListenstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Listenstmt() (localctx IListenstmtContext) { + localctx = NewListenstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 792, PostgreSQLParserRULE_listenstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7556) + p.Match(PostgreSQLParserLISTEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7557) + p.Colid() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IUnlistenstmtContext is an interface to support dynamic dispatch. +type IUnlistenstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + UNLISTEN() antlr.TerminalNode + Colid() IColidContext + STAR() antlr.TerminalNode + + // IsUnlistenstmtContext differentiates from other interfaces. + IsUnlistenstmtContext() +} + +type UnlistenstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyUnlistenstmtContext() *UnlistenstmtContext { + var p = new(UnlistenstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_unlistenstmt + return p +} + +func InitEmptyUnlistenstmtContext(p *UnlistenstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_unlistenstmt +} + +func (*UnlistenstmtContext) IsUnlistenstmtContext() {} + +func NewUnlistenstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *UnlistenstmtContext { + var p = new(UnlistenstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_unlistenstmt + + return p +} + +func (s *UnlistenstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *UnlistenstmtContext) UNLISTEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNLISTEN, 0) +} + +func (s *UnlistenstmtContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *UnlistenstmtContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *UnlistenstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *UnlistenstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *UnlistenstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterUnlistenstmt(s) + } +} + +func (s *UnlistenstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitUnlistenstmt(s) + } +} + +func (s *UnlistenstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitUnlistenstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Unlistenstmt() (localctx IUnlistenstmtContext) { + localctx = NewUnlistenstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 794, PostgreSQLParserRULE_unlistenstmt) + p.SetState(7563) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 593, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7559) + p.Match(PostgreSQLParserUNLISTEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7560) + p.Colid() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7561) + p.Match(PostgreSQLParserUNLISTEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7562) + p.Match(PostgreSQLParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransactionstmtContext is an interface to support dynamic dispatch. +type ITransactionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ABORT_P() antlr.TerminalNode + Opt_transaction() IOpt_transactionContext + Opt_transaction_chain() IOpt_transaction_chainContext + BEGIN_P() antlr.TerminalNode + Transaction_mode_list_or_empty() ITransaction_mode_list_or_emptyContext + START() antlr.TerminalNode + TRANSACTION() antlr.TerminalNode + COMMIT() antlr.TerminalNode + END_P() antlr.TerminalNode + ROLLBACK() antlr.TerminalNode + SAVEPOINT() antlr.TerminalNode + Colid() IColidContext + RELEASE() antlr.TerminalNode + TO() antlr.TerminalNode + PREPARE() antlr.TerminalNode + Sconst() ISconstContext + PREPARED() antlr.TerminalNode + + // IsTransactionstmtContext differentiates from other interfaces. + IsTransactionstmtContext() +} + +type TransactionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransactionstmtContext() *TransactionstmtContext { + var p = new(TransactionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transactionstmt + return p +} + +func InitEmptyTransactionstmtContext(p *TransactionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transactionstmt +} + +func (*TransactionstmtContext) IsTransactionstmtContext() {} + +func NewTransactionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TransactionstmtContext { + var p = new(TransactionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transactionstmt + + return p +} + +func (s *TransactionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *TransactionstmtContext) ABORT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserABORT_P, 0) +} + +func (s *TransactionstmtContext) Opt_transaction() IOpt_transactionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_transactionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_transactionContext) +} + +func (s *TransactionstmtContext) Opt_transaction_chain() IOpt_transaction_chainContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_transaction_chainContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_transaction_chainContext) +} + +func (s *TransactionstmtContext) BEGIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBEGIN_P, 0) +} + +func (s *TransactionstmtContext) Transaction_mode_list_or_empty() ITransaction_mode_list_or_emptyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransaction_mode_list_or_emptyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransaction_mode_list_or_emptyContext) +} + +func (s *TransactionstmtContext) START() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTART, 0) +} + +func (s *TransactionstmtContext) TRANSACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSACTION, 0) +} + +func (s *TransactionstmtContext) COMMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMIT, 0) +} + +func (s *TransactionstmtContext) END_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEND_P, 0) +} + +func (s *TransactionstmtContext) ROLLBACK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLLBACK, 0) +} + +func (s *TransactionstmtContext) SAVEPOINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSAVEPOINT, 0) +} + +func (s *TransactionstmtContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *TransactionstmtContext) RELEASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRELEASE, 0) +} + +func (s *TransactionstmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *TransactionstmtContext) PREPARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPREPARE, 0) +} + +func (s *TransactionstmtContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *TransactionstmtContext) PREPARED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPREPARED, 0) +} + +func (s *TransactionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TransactionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TransactionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransactionstmt(s) + } +} + +func (s *TransactionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransactionstmt(s) + } +} + +func (s *TransactionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransactionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transactionstmt() (localctx ITransactionstmtContext) { + localctx = NewTransactionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 796, PostgreSQLParserRULE_transactionstmt) + var _la int + + p.SetState(7634) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 607, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7565) + p.Match(PostgreSQLParserABORT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7567) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTRANSACTION || _la == PostgreSQLParserWORK { + { + p.SetState(7566) + p.Opt_transaction() + } + + } + p.SetState(7570) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAND { + { + p.SetState(7569) + p.Opt_transaction_chain() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7572) + p.Match(PostgreSQLParserBEGIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7574) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTRANSACTION || _la == PostgreSQLParserWORK { + { + p.SetState(7573) + p.Opt_transaction() + } + + } + p.SetState(7577) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDEFERRABLE || _la == PostgreSQLParserNOT || _la == PostgreSQLParserISOLATION || _la == PostgreSQLParserREAD { + { + p.SetState(7576) + p.Transaction_mode_list_or_empty() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7579) + p.Match(PostgreSQLParserSTART) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7580) + p.Match(PostgreSQLParserTRANSACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7582) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDEFERRABLE || _la == PostgreSQLParserNOT || _la == PostgreSQLParserISOLATION || _la == PostgreSQLParserREAD { + { + p.SetState(7581) + p.Transaction_mode_list_or_empty() + } + + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7584) + p.Match(PostgreSQLParserCOMMIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7586) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTRANSACTION || _la == PostgreSQLParserWORK { + { + p.SetState(7585) + p.Opt_transaction() + } + + } + p.SetState(7589) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAND { + { + p.SetState(7588) + p.Opt_transaction_chain() + } + + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7591) + p.Match(PostgreSQLParserEND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7593) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTRANSACTION || _la == PostgreSQLParserWORK { + { + p.SetState(7592) + p.Opt_transaction() + } + + } + p.SetState(7596) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAND { + { + p.SetState(7595) + p.Opt_transaction_chain() + } + + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(7598) + p.Match(PostgreSQLParserROLLBACK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7600) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTRANSACTION || _la == PostgreSQLParserWORK { + { + p.SetState(7599) + p.Opt_transaction() + } + + } + p.SetState(7603) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAND { + { + p.SetState(7602) + p.Opt_transaction_chain() + } + + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(7605) + p.Match(PostgreSQLParserSAVEPOINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7606) + p.Colid() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(7607) + p.Match(PostgreSQLParserRELEASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7608) + p.Match(PostgreSQLParserSAVEPOINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7609) + p.Colid() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(7610) + p.Match(PostgreSQLParserRELEASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7611) + p.Colid() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(7612) + p.Match(PostgreSQLParserROLLBACK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7614) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTRANSACTION || _la == PostgreSQLParserWORK { + { + p.SetState(7613) + p.Opt_transaction() + } + + } + { + p.SetState(7616) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7617) + p.Match(PostgreSQLParserSAVEPOINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7618) + p.Colid() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(7619) + p.Match(PostgreSQLParserROLLBACK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7621) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTRANSACTION || _la == PostgreSQLParserWORK { + { + p.SetState(7620) + p.Opt_transaction() + } + + } + { + p.SetState(7623) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7624) + p.Colid() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(7625) + p.Match(PostgreSQLParserPREPARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7626) + p.Match(PostgreSQLParserTRANSACTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7627) + p.Sconst() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(7628) + p.Match(PostgreSQLParserCOMMIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7629) + p.Match(PostgreSQLParserPREPARED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7630) + p.Sconst() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(7631) + p.Match(PostgreSQLParserROLLBACK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7632) + p.Match(PostgreSQLParserPREPARED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7633) + p.Sconst() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_transactionContext is an interface to support dynamic dispatch. +type IOpt_transactionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WORK() antlr.TerminalNode + TRANSACTION() antlr.TerminalNode + + // IsOpt_transactionContext differentiates from other interfaces. + IsOpt_transactionContext() +} + +type Opt_transactionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_transactionContext() *Opt_transactionContext { + var p = new(Opt_transactionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_transaction + return p +} + +func InitEmptyOpt_transactionContext(p *Opt_transactionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_transaction +} + +func (*Opt_transactionContext) IsOpt_transactionContext() {} + +func NewOpt_transactionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_transactionContext { + var p = new(Opt_transactionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_transaction + + return p +} + +func (s *Opt_transactionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_transactionContext) WORK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWORK, 0) +} + +func (s *Opt_transactionContext) TRANSACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSACTION, 0) +} + +func (s *Opt_transactionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_transactionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_transactionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_transaction(s) + } +} + +func (s *Opt_transactionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_transaction(s) + } +} + +func (s *Opt_transactionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_transaction(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_transaction() (localctx IOpt_transactionContext) { + localctx = NewOpt_transactionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 798, PostgreSQLParserRULE_opt_transaction) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7636) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTRANSACTION || _la == PostgreSQLParserWORK) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransaction_mode_itemContext is an interface to support dynamic dispatch. +type ITransaction_mode_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ISOLATION() antlr.TerminalNode + LEVEL() antlr.TerminalNode + Iso_level() IIso_levelContext + READ() antlr.TerminalNode + ONLY() antlr.TerminalNode + WRITE() antlr.TerminalNode + DEFERRABLE() antlr.TerminalNode + NOT() antlr.TerminalNode + + // IsTransaction_mode_itemContext differentiates from other interfaces. + IsTransaction_mode_itemContext() +} + +type Transaction_mode_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransaction_mode_itemContext() *Transaction_mode_itemContext { + var p = new(Transaction_mode_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_item + return p +} + +func InitEmptyTransaction_mode_itemContext(p *Transaction_mode_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_item +} + +func (*Transaction_mode_itemContext) IsTransaction_mode_itemContext() {} + +func NewTransaction_mode_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Transaction_mode_itemContext { + var p = new(Transaction_mode_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_item + + return p +} + +func (s *Transaction_mode_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Transaction_mode_itemContext) ISOLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserISOLATION, 0) +} + +func (s *Transaction_mode_itemContext) LEVEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEVEL, 0) +} + +func (s *Transaction_mode_itemContext) Iso_level() IIso_levelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIso_levelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIso_levelContext) +} + +func (s *Transaction_mode_itemContext) READ() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREAD, 0) +} + +func (s *Transaction_mode_itemContext) ONLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserONLY, 0) +} + +func (s *Transaction_mode_itemContext) WRITE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRITE, 0) +} + +func (s *Transaction_mode_itemContext) DEFERRABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFERRABLE, 0) +} + +func (s *Transaction_mode_itemContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Transaction_mode_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Transaction_mode_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Transaction_mode_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransaction_mode_item(s) + } +} + +func (s *Transaction_mode_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransaction_mode_item(s) + } +} + +func (s *Transaction_mode_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransaction_mode_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transaction_mode_item() (localctx ITransaction_mode_itemContext) { + localctx = NewTransaction_mode_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 800, PostgreSQLParserRULE_transaction_mode_item) + p.SetState(7648) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 608, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7638) + p.Match(PostgreSQLParserISOLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7639) + p.Match(PostgreSQLParserLEVEL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7640) + p.Iso_level() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7641) + p.Match(PostgreSQLParserREAD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7642) + p.Match(PostgreSQLParserONLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7643) + p.Match(PostgreSQLParserREAD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7644) + p.Match(PostgreSQLParserWRITE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7645) + p.Match(PostgreSQLParserDEFERRABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7646) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7647) + p.Match(PostgreSQLParserDEFERRABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransaction_mode_listContext is an interface to support dynamic dispatch. +type ITransaction_mode_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTransaction_mode_item() []ITransaction_mode_itemContext + Transaction_mode_item(i int) ITransaction_mode_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsTransaction_mode_listContext differentiates from other interfaces. + IsTransaction_mode_listContext() +} + +type Transaction_mode_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransaction_mode_listContext() *Transaction_mode_listContext { + var p = new(Transaction_mode_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_list + return p +} + +func InitEmptyTransaction_mode_listContext(p *Transaction_mode_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_list +} + +func (*Transaction_mode_listContext) IsTransaction_mode_listContext() {} + +func NewTransaction_mode_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Transaction_mode_listContext { + var p = new(Transaction_mode_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_list + + return p +} + +func (s *Transaction_mode_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Transaction_mode_listContext) AllTransaction_mode_item() []ITransaction_mode_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITransaction_mode_itemContext); ok { + len++ + } + } + + tst := make([]ITransaction_mode_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITransaction_mode_itemContext); ok { + tst[i] = t.(ITransaction_mode_itemContext) + i++ + } + } + + return tst +} + +func (s *Transaction_mode_listContext) Transaction_mode_item(i int) ITransaction_mode_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransaction_mode_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITransaction_mode_itemContext) +} + +func (s *Transaction_mode_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Transaction_mode_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Transaction_mode_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Transaction_mode_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Transaction_mode_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransaction_mode_list(s) + } +} + +func (s *Transaction_mode_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransaction_mode_list(s) + } +} + +func (s *Transaction_mode_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransaction_mode_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transaction_mode_list() (localctx ITransaction_mode_listContext) { + localctx = NewTransaction_mode_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 802, PostgreSQLParserRULE_transaction_mode_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7650) + p.Transaction_mode_item() + } + p.SetState(7657) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA || _la == PostgreSQLParserDEFERRABLE || _la == PostgreSQLParserNOT || _la == PostgreSQLParserISOLATION || _la == PostgreSQLParserREAD { + p.SetState(7652) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(7651) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(7654) + p.Transaction_mode_item() + } + + p.SetState(7659) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITransaction_mode_list_or_emptyContext is an interface to support dynamic dispatch. +type ITransaction_mode_list_or_emptyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Transaction_mode_list() ITransaction_mode_listContext + + // IsTransaction_mode_list_or_emptyContext differentiates from other interfaces. + IsTransaction_mode_list_or_emptyContext() +} + +type Transaction_mode_list_or_emptyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTransaction_mode_list_or_emptyContext() *Transaction_mode_list_or_emptyContext { + var p = new(Transaction_mode_list_or_emptyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_list_or_empty + return p +} + +func InitEmptyTransaction_mode_list_or_emptyContext(p *Transaction_mode_list_or_emptyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_list_or_empty +} + +func (*Transaction_mode_list_or_emptyContext) IsTransaction_mode_list_or_emptyContext() {} + +func NewTransaction_mode_list_or_emptyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Transaction_mode_list_or_emptyContext { + var p = new(Transaction_mode_list_or_emptyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_transaction_mode_list_or_empty + + return p +} + +func (s *Transaction_mode_list_or_emptyContext) GetParser() antlr.Parser { return s.parser } + +func (s *Transaction_mode_list_or_emptyContext) Transaction_mode_list() ITransaction_mode_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITransaction_mode_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITransaction_mode_listContext) +} + +func (s *Transaction_mode_list_or_emptyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Transaction_mode_list_or_emptyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Transaction_mode_list_or_emptyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTransaction_mode_list_or_empty(s) + } +} + +func (s *Transaction_mode_list_or_emptyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTransaction_mode_list_or_empty(s) + } +} + +func (s *Transaction_mode_list_or_emptyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTransaction_mode_list_or_empty(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Transaction_mode_list_or_empty() (localctx ITransaction_mode_list_or_emptyContext) { + localctx = NewTransaction_mode_list_or_emptyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 804, PostgreSQLParserRULE_transaction_mode_list_or_empty) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7660) + p.Transaction_mode_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_transaction_chainContext is an interface to support dynamic dispatch. +type IOpt_transaction_chainContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AND() antlr.TerminalNode + CHAIN() antlr.TerminalNode + NO() antlr.TerminalNode + + // IsOpt_transaction_chainContext differentiates from other interfaces. + IsOpt_transaction_chainContext() +} + +type Opt_transaction_chainContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_transaction_chainContext() *Opt_transaction_chainContext { + var p = new(Opt_transaction_chainContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_transaction_chain + return p +} + +func InitEmptyOpt_transaction_chainContext(p *Opt_transaction_chainContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_transaction_chain +} + +func (*Opt_transaction_chainContext) IsOpt_transaction_chainContext() {} + +func NewOpt_transaction_chainContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_transaction_chainContext { + var p = new(Opt_transaction_chainContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_transaction_chain + + return p +} + +func (s *Opt_transaction_chainContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_transaction_chainContext) AND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, 0) +} + +func (s *Opt_transaction_chainContext) CHAIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHAIN, 0) +} + +func (s *Opt_transaction_chainContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Opt_transaction_chainContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_transaction_chainContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_transaction_chainContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_transaction_chain(s) + } +} + +func (s *Opt_transaction_chainContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_transaction_chain(s) + } +} + +func (s *Opt_transaction_chainContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_transaction_chain(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_transaction_chain() (localctx IOpt_transaction_chainContext) { + localctx = NewOpt_transaction_chainContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 806, PostgreSQLParserRULE_opt_transaction_chain) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7662) + p.Match(PostgreSQLParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7664) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(7663) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(7666) + p.Match(PostgreSQLParserCHAIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IViewstmtContext is an interface to support dynamic dispatch. +type IViewstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + AS() antlr.TerminalNode + Selectstmt() ISelectstmtContext + VIEW() antlr.TerminalNode + Qualified_name() IQualified_nameContext + RECURSIVE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Columnlist() IColumnlistContext + CLOSE_PAREN() antlr.TerminalNode + OR() antlr.TerminalNode + REPLACE() antlr.TerminalNode + Opttemp() IOpttempContext + Opt_check_option() IOpt_check_optionContext + Opt_column_list() IOpt_column_listContext + Opt_reloptions() IOpt_reloptionsContext + + // IsViewstmtContext differentiates from other interfaces. + IsViewstmtContext() +} + +type ViewstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyViewstmtContext() *ViewstmtContext { + var p = new(ViewstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_viewstmt + return p +} + +func InitEmptyViewstmtContext(p *ViewstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_viewstmt +} + +func (*ViewstmtContext) IsViewstmtContext() {} + +func NewViewstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ViewstmtContext { + var p = new(ViewstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_viewstmt + + return p +} + +func (s *ViewstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ViewstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *ViewstmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *ViewstmtContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *ViewstmtContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *ViewstmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *ViewstmtContext) RECURSIVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRECURSIVE, 0) +} + +func (s *ViewstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ViewstmtContext) Columnlist() IColumnlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnlistContext) +} + +func (s *ViewstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ViewstmtContext) OR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOR, 0) +} + +func (s *ViewstmtContext) REPLACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPLACE, 0) +} + +func (s *ViewstmtContext) Opttemp() IOpttempContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttempContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttempContext) +} + +func (s *ViewstmtContext) Opt_check_option() IOpt_check_optionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_check_optionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_check_optionContext) +} + +func (s *ViewstmtContext) Opt_column_list() IOpt_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_column_listContext) +} + +func (s *ViewstmtContext) Opt_reloptions() IOpt_reloptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_reloptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_reloptionsContext) +} + +func (s *ViewstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ViewstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ViewstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterViewstmt(s) + } +} + +func (s *ViewstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitViewstmt(s) + } +} + +func (s *ViewstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitViewstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Viewstmt() (localctx IViewstmtContext) { + localctx = NewViewstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 808, PostgreSQLParserRULE_viewstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7668) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7671) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOR { + { + p.SetState(7669) + p.Match(PostgreSQLParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7670) + p.Match(PostgreSQLParserREPLACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(7674) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGLOBAL || _la == PostgreSQLParserLOCAL || ((int64((_la-345)) & ^0x3f) == 0 && ((int64(1)<<(_la-345))&32773) != 0) { + { + p.SetState(7673) + p.Opttemp() + } + + } + p.SetState(7693) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserVIEW: + { + p.SetState(7676) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7677) + p.Qualified_name() + } + p.SetState(7679) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(7678) + p.Opt_column_list() + } + + } + p.SetState(7682) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(7681) + p.Opt_reloptions() + } + + } + + case PostgreSQLParserRECURSIVE: + { + p.SetState(7684) + p.Match(PostgreSQLParserRECURSIVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7685) + p.Match(PostgreSQLParserVIEW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7686) + p.Qualified_name() + } + { + p.SetState(7687) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7688) + p.Columnlist() + } + { + p.SetState(7689) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7691) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(7690) + p.Opt_reloptions() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(7695) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7696) + p.Selectstmt() + } + p.SetState(7698) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 618, p.GetParserRuleContext()) == 1 { + { + p.SetState(7697) + p.Opt_check_option() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_check_optionContext is an interface to support dynamic dispatch. +type IOpt_check_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + CHECK() antlr.TerminalNode + OPTION() antlr.TerminalNode + CASCADED() antlr.TerminalNode + LOCAL() antlr.TerminalNode + + // IsOpt_check_optionContext differentiates from other interfaces. + IsOpt_check_optionContext() +} + +type Opt_check_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_check_optionContext() *Opt_check_optionContext { + var p = new(Opt_check_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_check_option + return p +} + +func InitEmptyOpt_check_optionContext(p *Opt_check_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_check_option +} + +func (*Opt_check_optionContext) IsOpt_check_optionContext() {} + +func NewOpt_check_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_check_optionContext { + var p = new(Opt_check_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_check_option + + return p +} + +func (s *Opt_check_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_check_optionContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_check_optionContext) CHECK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHECK, 0) +} + +func (s *Opt_check_optionContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *Opt_check_optionContext) CASCADED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASCADED, 0) +} + +func (s *Opt_check_optionContext) LOCAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCAL, 0) +} + +func (s *Opt_check_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_check_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_check_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_check_option(s) + } +} + +func (s *Opt_check_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_check_option(s) + } +} + +func (s *Opt_check_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_check_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_check_option() (localctx IOpt_check_optionContext) { + localctx = NewOpt_check_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 810, PostgreSQLParserRULE_opt_check_option) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7700) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7702) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADED || _la == PostgreSQLParserLOCAL { + { + p.SetState(7701) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCASCADED || _la == PostgreSQLParserLOCAL) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + } + { + p.SetState(7704) + p.Match(PostgreSQLParserCHECK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7705) + p.Match(PostgreSQLParserOPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILoadstmtContext is an interface to support dynamic dispatch. +type ILoadstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LOAD() antlr.TerminalNode + File_name() IFile_nameContext + + // IsLoadstmtContext differentiates from other interfaces. + IsLoadstmtContext() +} + +type LoadstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLoadstmtContext() *LoadstmtContext { + var p = new(LoadstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_loadstmt + return p +} + +func InitEmptyLoadstmtContext(p *LoadstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_loadstmt +} + +func (*LoadstmtContext) IsLoadstmtContext() {} + +func NewLoadstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LoadstmtContext { + var p = new(LoadstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_loadstmt + + return p +} + +func (s *LoadstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *LoadstmtContext) LOAD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOAD, 0) +} + +func (s *LoadstmtContext) File_name() IFile_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFile_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFile_nameContext) +} + +func (s *LoadstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LoadstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LoadstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterLoadstmt(s) + } +} + +func (s *LoadstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitLoadstmt(s) + } +} + +func (s *LoadstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitLoadstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Loadstmt() (localctx ILoadstmtContext) { + localctx = NewLoadstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 812, PostgreSQLParserRULE_loadstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7707) + p.Match(PostgreSQLParserLOAD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7708) + p.File_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatedbstmtContext is an interface to support dynamic dispatch. +type ICreatedbstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + DATABASE() antlr.TerminalNode + Name() INameContext + Opt_with() IOpt_withContext + Createdb_opt_list() ICreatedb_opt_listContext + + // IsCreatedbstmtContext differentiates from other interfaces. + IsCreatedbstmtContext() +} + +type CreatedbstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatedbstmtContext() *CreatedbstmtContext { + var p = new(CreatedbstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdbstmt + return p +} + +func InitEmptyCreatedbstmtContext(p *CreatedbstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdbstmt +} + +func (*CreatedbstmtContext) IsCreatedbstmtContext() {} + +func NewCreatedbstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatedbstmtContext { + var p = new(CreatedbstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createdbstmt + + return p +} + +func (s *CreatedbstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatedbstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatedbstmtContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *CreatedbstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *CreatedbstmtContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *CreatedbstmtContext) Createdb_opt_list() ICreatedb_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatedb_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatedb_opt_listContext) +} + +func (s *CreatedbstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatedbstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatedbstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatedbstmt(s) + } +} + +func (s *CreatedbstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatedbstmt(s) + } +} + +func (s *CreatedbstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatedbstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createdbstmt() (localctx ICreatedbstmtContext) { + localctx = NewCreatedbstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 814, PostgreSQLParserRULE_createdbstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7710) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7711) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7712) + p.Name() + } + p.SetState(7714) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 620, p.GetParserRuleContext()) == 1 { + { + p.SetState(7713) + p.Opt_with() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(7717) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 621, p.GetParserRuleContext()) == 1 { + { + p.SetState(7716) + p.Createdb_opt_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatedb_opt_listContext is an interface to support dynamic dispatch. +type ICreatedb_opt_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Createdb_opt_items() ICreatedb_opt_itemsContext + + // IsCreatedb_opt_listContext differentiates from other interfaces. + IsCreatedb_opt_listContext() +} + +type Createdb_opt_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatedb_opt_listContext() *Createdb_opt_listContext { + var p = new(Createdb_opt_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_list + return p +} + +func InitEmptyCreatedb_opt_listContext(p *Createdb_opt_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_list +} + +func (*Createdb_opt_listContext) IsCreatedb_opt_listContext() {} + +func NewCreatedb_opt_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Createdb_opt_listContext { + var p = new(Createdb_opt_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_list + + return p +} + +func (s *Createdb_opt_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Createdb_opt_listContext) Createdb_opt_items() ICreatedb_opt_itemsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatedb_opt_itemsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatedb_opt_itemsContext) +} + +func (s *Createdb_opt_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Createdb_opt_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Createdb_opt_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatedb_opt_list(s) + } +} + +func (s *Createdb_opt_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatedb_opt_list(s) + } +} + +func (s *Createdb_opt_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatedb_opt_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createdb_opt_list() (localctx ICreatedb_opt_listContext) { + localctx = NewCreatedb_opt_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 816, PostgreSQLParserRULE_createdb_opt_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7719) + p.Createdb_opt_items() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatedb_opt_itemsContext is an interface to support dynamic dispatch. +type ICreatedb_opt_itemsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCreatedb_opt_item() []ICreatedb_opt_itemContext + Createdb_opt_item(i int) ICreatedb_opt_itemContext + + // IsCreatedb_opt_itemsContext differentiates from other interfaces. + IsCreatedb_opt_itemsContext() +} + +type Createdb_opt_itemsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatedb_opt_itemsContext() *Createdb_opt_itemsContext { + var p = new(Createdb_opt_itemsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_items + return p +} + +func InitEmptyCreatedb_opt_itemsContext(p *Createdb_opt_itemsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_items +} + +func (*Createdb_opt_itemsContext) IsCreatedb_opt_itemsContext() {} + +func NewCreatedb_opt_itemsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Createdb_opt_itemsContext { + var p = new(Createdb_opt_itemsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_items + + return p +} + +func (s *Createdb_opt_itemsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Createdb_opt_itemsContext) AllCreatedb_opt_item() []ICreatedb_opt_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICreatedb_opt_itemContext); ok { + len++ + } + } + + tst := make([]ICreatedb_opt_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICreatedb_opt_itemContext); ok { + tst[i] = t.(ICreatedb_opt_itemContext) + i++ + } + } + + return tst +} + +func (s *Createdb_opt_itemsContext) Createdb_opt_item(i int) ICreatedb_opt_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatedb_opt_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICreatedb_opt_itemContext) +} + +func (s *Createdb_opt_itemsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Createdb_opt_itemsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Createdb_opt_itemsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatedb_opt_items(s) + } +} + +func (s *Createdb_opt_itemsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatedb_opt_items(s) + } +} + +func (s *Createdb_opt_itemsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatedb_opt_items(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createdb_opt_items() (localctx ICreatedb_opt_itemsContext) { + localctx = NewCreatedb_opt_itemsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 818, PostgreSQLParserRULE_createdb_opt_items) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(7722) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(7721) + p.Createdb_opt_item() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(7724) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 622, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatedb_opt_itemContext is an interface to support dynamic dispatch. +type ICreatedb_opt_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Createdb_opt_name() ICreatedb_opt_nameContext + Signediconst() ISignediconstContext + Opt_boolean_or_string() IOpt_boolean_or_stringContext + DEFAULT() antlr.TerminalNode + Opt_equal() IOpt_equalContext + + // IsCreatedb_opt_itemContext differentiates from other interfaces. + IsCreatedb_opt_itemContext() +} + +type Createdb_opt_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatedb_opt_itemContext() *Createdb_opt_itemContext { + var p = new(Createdb_opt_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_item + return p +} + +func InitEmptyCreatedb_opt_itemContext(p *Createdb_opt_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_item +} + +func (*Createdb_opt_itemContext) IsCreatedb_opt_itemContext() {} + +func NewCreatedb_opt_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Createdb_opt_itemContext { + var p = new(Createdb_opt_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_item + + return p +} + +func (s *Createdb_opt_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Createdb_opt_itemContext) Createdb_opt_name() ICreatedb_opt_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatedb_opt_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatedb_opt_nameContext) +} + +func (s *Createdb_opt_itemContext) Signediconst() ISignediconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISignediconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISignediconstContext) +} + +func (s *Createdb_opt_itemContext) Opt_boolean_or_string() IOpt_boolean_or_stringContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_boolean_or_stringContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_boolean_or_stringContext) +} + +func (s *Createdb_opt_itemContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Createdb_opt_itemContext) Opt_equal() IOpt_equalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_equalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_equalContext) +} + +func (s *Createdb_opt_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Createdb_opt_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Createdb_opt_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatedb_opt_item(s) + } +} + +func (s *Createdb_opt_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatedb_opt_item(s) + } +} + +func (s *Createdb_opt_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatedb_opt_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createdb_opt_item() (localctx ICreatedb_opt_itemContext) { + localctx = NewCreatedb_opt_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 820, PostgreSQLParserRULE_createdb_opt_item) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7726) + p.Createdb_opt_name() + } + p.SetState(7728) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEQUAL { + { + p.SetState(7727) + p.Opt_equal() + } + + } + p.SetState(7733) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 624, p.GetParserRuleContext()) { + case 1: + { + p.SetState(7730) + p.Signediconst() + } + + case 2: + { + p.SetState(7731) + p.Opt_boolean_or_string() + } + + case 3: + { + p.SetState(7732) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatedb_opt_nameContext is an interface to support dynamic dispatch. +type ICreatedb_opt_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + CONNECTION() antlr.TerminalNode + LIMIT() antlr.TerminalNode + ENCODING() antlr.TerminalNode + LOCATION() antlr.TerminalNode + OWNER() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + TEMPLATE() antlr.TerminalNode + + // IsCreatedb_opt_nameContext differentiates from other interfaces. + IsCreatedb_opt_nameContext() +} + +type Createdb_opt_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatedb_opt_nameContext() *Createdb_opt_nameContext { + var p = new(Createdb_opt_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_name + return p +} + +func InitEmptyCreatedb_opt_nameContext(p *Createdb_opt_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_name +} + +func (*Createdb_opt_nameContext) IsCreatedb_opt_nameContext() {} + +func NewCreatedb_opt_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Createdb_opt_nameContext { + var p = new(Createdb_opt_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createdb_opt_name + + return p +} + +func (s *Createdb_opt_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Createdb_opt_nameContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Createdb_opt_nameContext) CONNECTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONNECTION, 0) +} + +func (s *Createdb_opt_nameContext) LIMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIMIT, 0) +} + +func (s *Createdb_opt_nameContext) ENCODING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENCODING, 0) +} + +func (s *Createdb_opt_nameContext) LOCATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCATION, 0) +} + +func (s *Createdb_opt_nameContext) OWNER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNER, 0) +} + +func (s *Createdb_opt_nameContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *Createdb_opt_nameContext) TEMPLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPLATE, 0) +} + +func (s *Createdb_opt_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Createdb_opt_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Createdb_opt_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatedb_opt_name(s) + } +} + +func (s *Createdb_opt_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatedb_opt_name(s) + } +} + +func (s *Createdb_opt_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatedb_opt_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createdb_opt_name() (localctx ICreatedb_opt_nameContext) { + localctx = NewCreatedb_opt_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 822, PostgreSQLParserRULE_createdb_opt_name) + p.SetState(7743) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserOUTER_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserBACKWARD, PostgreSQLParserCHAIN, PostgreSQLParserCLOSE, PostgreSQLParserCOMMIT, PostgreSQLParserCONTINUE_P, PostgreSQLParserCURSOR, PostgreSQLParserFIRST_P, PostgreSQLParserFORWARD, PostgreSQLParserINSERT, PostgreSQLParserLAST_P, PostgreSQLParserMOVE, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserOPTION, PostgreSQLParserPRIOR, PostgreSQLParserRELATIVE_P, PostgreSQLParserRESET, PostgreSQLParserROLLBACK, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSET, PostgreSQLParserTYPE_P, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserROWTYPE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7735) + p.Identifier() + } + + case PostgreSQLParserCONNECTION: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7736) + p.Match(PostgreSQLParserCONNECTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7737) + p.Match(PostgreSQLParserLIMIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserENCODING: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7738) + p.Match(PostgreSQLParserENCODING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserLOCATION: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7739) + p.Match(PostgreSQLParserLOCATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserOWNER: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7740) + p.Match(PostgreSQLParserOWNER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserTABLESPACE: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(7741) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserTEMPLATE: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(7742) + p.Match(PostgreSQLParserTEMPLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_equalContext is an interface to support dynamic dispatch. +type IOpt_equalContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EQUAL() antlr.TerminalNode + + // IsOpt_equalContext differentiates from other interfaces. + IsOpt_equalContext() +} + +type Opt_equalContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_equalContext() *Opt_equalContext { + var p = new(Opt_equalContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_equal + return p +} + +func InitEmptyOpt_equalContext(p *Opt_equalContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_equal +} + +func (*Opt_equalContext) IsOpt_equalContext() {} + +func NewOpt_equalContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_equalContext { + var p = new(Opt_equalContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_equal + + return p +} + +func (s *Opt_equalContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_equalContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Opt_equalContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_equalContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_equalContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_equal(s) + } +} + +func (s *Opt_equalContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_equal(s) + } +} + +func (s *Opt_equalContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_equal(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_equal() (localctx IOpt_equalContext) { + localctx = NewOpt_equalContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 824, PostgreSQLParserRULE_opt_equal) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7745) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterdatabasestmtContext is an interface to support dynamic dispatch. +type IAlterdatabasestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + DATABASE() antlr.TerminalNode + AllName() []INameContext + Name(i int) INameContext + WITH() antlr.TerminalNode + SET() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + REFRESH() antlr.TerminalNode + COLLATION() antlr.TerminalNode + VERSION_P() antlr.TerminalNode + Createdb_opt_list() ICreatedb_opt_listContext + + // IsAlterdatabasestmtContext differentiates from other interfaces. + IsAlterdatabasestmtContext() +} + +type AlterdatabasestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterdatabasestmtContext() *AlterdatabasestmtContext { + var p = new(AlterdatabasestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterdatabasestmt + return p +} + +func InitEmptyAlterdatabasestmtContext(p *AlterdatabasestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterdatabasestmt +} + +func (*AlterdatabasestmtContext) IsAlterdatabasestmtContext() {} + +func NewAlterdatabasestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterdatabasestmtContext { + var p = new(AlterdatabasestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterdatabasestmt + + return p +} + +func (s *AlterdatabasestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterdatabasestmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterdatabasestmtContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *AlterdatabasestmtContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *AlterdatabasestmtContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterdatabasestmtContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *AlterdatabasestmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AlterdatabasestmtContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *AlterdatabasestmtContext) REFRESH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFRESH, 0) +} + +func (s *AlterdatabasestmtContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *AlterdatabasestmtContext) VERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERSION_P, 0) +} + +func (s *AlterdatabasestmtContext) Createdb_opt_list() ICreatedb_opt_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatedb_opt_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatedb_opt_listContext) +} + +func (s *AlterdatabasestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterdatabasestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterdatabasestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterdatabasestmt(s) + } +} + +func (s *AlterdatabasestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterdatabasestmt(s) + } +} + +func (s *AlterdatabasestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterdatabasestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterdatabasestmt() (localctx IAlterdatabasestmtContext) { + localctx = NewAlterdatabasestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 826, PostgreSQLParserRULE_alterdatabasestmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7747) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7748) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7749) + p.Name() + } + p.SetState(7763) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 628, p.GetParserRuleContext()) { + case 1: + { + p.SetState(7750) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7752) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 626, p.GetParserRuleContext()) == 1 { + { + p.SetState(7751) + p.Createdb_opt_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + p.SetState(7755) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 627, p.GetParserRuleContext()) == 1 { + { + p.SetState(7754) + p.Createdb_opt_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 3: + { + p.SetState(7757) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7758) + p.Match(PostgreSQLParserTABLESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7759) + p.Name() + } + + case 4: + { + p.SetState(7760) + p.Match(PostgreSQLParserREFRESH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7761) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7762) + p.Match(PostgreSQLParserVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterdatabasesetstmtContext is an interface to support dynamic dispatch. +type IAlterdatabasesetstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + DATABASE() antlr.TerminalNode + Name() INameContext + Setresetclause() ISetresetclauseContext + + // IsAlterdatabasesetstmtContext differentiates from other interfaces. + IsAlterdatabasesetstmtContext() +} + +type AlterdatabasesetstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterdatabasesetstmtContext() *AlterdatabasesetstmtContext { + var p = new(AlterdatabasesetstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterdatabasesetstmt + return p +} + +func InitEmptyAlterdatabasesetstmtContext(p *AlterdatabasesetstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterdatabasesetstmt +} + +func (*AlterdatabasesetstmtContext) IsAlterdatabasesetstmtContext() {} + +func NewAlterdatabasesetstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterdatabasesetstmtContext { + var p = new(AlterdatabasesetstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterdatabasesetstmt + + return p +} + +func (s *AlterdatabasesetstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterdatabasesetstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterdatabasesetstmtContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *AlterdatabasesetstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterdatabasesetstmtContext) Setresetclause() ISetresetclauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISetresetclauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISetresetclauseContext) +} + +func (s *AlterdatabasesetstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterdatabasesetstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterdatabasesetstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterdatabasesetstmt(s) + } +} + +func (s *AlterdatabasesetstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterdatabasesetstmt(s) + } +} + +func (s *AlterdatabasesetstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterdatabasesetstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterdatabasesetstmt() (localctx IAlterdatabasesetstmtContext) { + localctx = NewAlterdatabasesetstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 828, PostgreSQLParserRULE_alterdatabasesetstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7765) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7766) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7767) + p.Name() + } + { + p.SetState(7768) + p.Setresetclause() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDropdbstmtContext is an interface to support dynamic dispatch. +type IDropdbstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DROP() antlr.TerminalNode + DATABASE() antlr.TerminalNode + Name() INameContext + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Drop_option_list() IDrop_option_listContext + CLOSE_PAREN() antlr.TerminalNode + Opt_with() IOpt_withContext + + // IsDropdbstmtContext differentiates from other interfaces. + IsDropdbstmtContext() +} + +type DropdbstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDropdbstmtContext() *DropdbstmtContext { + var p = new(DropdbstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropdbstmt + return p +} + +func InitEmptyDropdbstmtContext(p *DropdbstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_dropdbstmt +} + +func (*DropdbstmtContext) IsDropdbstmtContext() {} + +func NewDropdbstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DropdbstmtContext { + var p = new(DropdbstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_dropdbstmt + + return p +} + +func (s *DropdbstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DropdbstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *DropdbstmtContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *DropdbstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DropdbstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *DropdbstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *DropdbstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *DropdbstmtContext) Drop_option_list() IDrop_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDrop_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDrop_option_listContext) +} + +func (s *DropdbstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *DropdbstmtContext) Opt_with() IOpt_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_withContext) +} + +func (s *DropdbstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DropdbstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DropdbstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDropdbstmt(s) + } +} + +func (s *DropdbstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDropdbstmt(s) + } +} + +func (s *DropdbstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDropdbstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Dropdbstmt() (localctx IDropdbstmtContext) { + localctx = NewDropdbstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 830, PostgreSQLParserRULE_dropdbstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7770) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7771) + p.Match(PostgreSQLParserDATABASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7774) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 629, p.GetParserRuleContext()) == 1 { + { + p.SetState(7772) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7773) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(7776) + p.Name() + } + p.SetState(7784) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 631, p.GetParserRuleContext()) == 1 { + p.SetState(7778) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(7777) + p.Opt_with() + } + + } + { + p.SetState(7780) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7781) + p.Drop_option_list() + } + { + p.SetState(7782) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDrop_option_listContext is an interface to support dynamic dispatch. +type IDrop_option_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllDrop_option() []IDrop_optionContext + Drop_option(i int) IDrop_optionContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsDrop_option_listContext differentiates from other interfaces. + IsDrop_option_listContext() +} + +type Drop_option_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDrop_option_listContext() *Drop_option_listContext { + var p = new(Drop_option_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_drop_option_list + return p +} + +func InitEmptyDrop_option_listContext(p *Drop_option_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_drop_option_list +} + +func (*Drop_option_listContext) IsDrop_option_listContext() {} + +func NewDrop_option_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Drop_option_listContext { + var p = new(Drop_option_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_drop_option_list + + return p +} + +func (s *Drop_option_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Drop_option_listContext) AllDrop_option() []IDrop_optionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IDrop_optionContext); ok { + len++ + } + } + + tst := make([]IDrop_optionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IDrop_optionContext); ok { + tst[i] = t.(IDrop_optionContext) + i++ + } + } + + return tst +} + +func (s *Drop_option_listContext) Drop_option(i int) IDrop_optionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDrop_optionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IDrop_optionContext) +} + +func (s *Drop_option_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Drop_option_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Drop_option_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Drop_option_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Drop_option_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDrop_option_list(s) + } +} + +func (s *Drop_option_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDrop_option_list(s) + } +} + +func (s *Drop_option_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDrop_option_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Drop_option_list() (localctx IDrop_option_listContext) { + localctx = NewDrop_option_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 832, PostgreSQLParserRULE_drop_option_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7786) + p.Drop_option() + } + p.SetState(7791) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(7787) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7788) + p.Drop_option() + } + + p.SetState(7793) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDrop_optionContext is an interface to support dynamic dispatch. +type IDrop_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FORCE() antlr.TerminalNode + + // IsDrop_optionContext differentiates from other interfaces. + IsDrop_optionContext() +} + +type Drop_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDrop_optionContext() *Drop_optionContext { + var p = new(Drop_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_drop_option + return p +} + +func InitEmptyDrop_optionContext(p *Drop_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_drop_option +} + +func (*Drop_optionContext) IsDrop_optionContext() {} + +func NewDrop_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Drop_optionContext { + var p = new(Drop_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_drop_option + + return p +} + +func (s *Drop_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Drop_optionContext) FORCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORCE, 0) +} + +func (s *Drop_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Drop_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Drop_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDrop_option(s) + } +} + +func (s *Drop_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDrop_option(s) + } +} + +func (s *Drop_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDrop_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Drop_option() (localctx IDrop_optionContext) { + localctx = NewDrop_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 834, PostgreSQLParserRULE_drop_option) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7794) + p.Match(PostgreSQLParserFORCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltercollationstmtContext is an interface to support dynamic dispatch. +type IAltercollationstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + COLLATION() antlr.TerminalNode + Any_name() IAny_nameContext + REFRESH() antlr.TerminalNode + VERSION_P() antlr.TerminalNode + + // IsAltercollationstmtContext differentiates from other interfaces. + IsAltercollationstmtContext() +} + +type AltercollationstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltercollationstmtContext() *AltercollationstmtContext { + var p = new(AltercollationstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altercollationstmt + return p +} + +func InitEmptyAltercollationstmtContext(p *AltercollationstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altercollationstmt +} + +func (*AltercollationstmtContext) IsAltercollationstmtContext() {} + +func NewAltercollationstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltercollationstmtContext { + var p = new(AltercollationstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altercollationstmt + + return p +} + +func (s *AltercollationstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltercollationstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltercollationstmtContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *AltercollationstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AltercollationstmtContext) REFRESH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFRESH, 0) +} + +func (s *AltercollationstmtContext) VERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERSION_P, 0) +} + +func (s *AltercollationstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltercollationstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltercollationstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltercollationstmt(s) + } +} + +func (s *AltercollationstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltercollationstmt(s) + } +} + +func (s *AltercollationstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltercollationstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altercollationstmt() (localctx IAltercollationstmtContext) { + localctx = NewAltercollationstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 836, PostgreSQLParserRULE_altercollationstmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7796) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7797) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7798) + p.Any_name() + } + { + p.SetState(7799) + p.Match(PostgreSQLParserREFRESH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7800) + p.Match(PostgreSQLParserVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltersystemstmtContext is an interface to support dynamic dispatch. +type IAltersystemstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + SYSTEM_P() antlr.TerminalNode + Generic_set() IGeneric_setContext + SET() antlr.TerminalNode + RESET() antlr.TerminalNode + + // IsAltersystemstmtContext differentiates from other interfaces. + IsAltersystemstmtContext() +} + +type AltersystemstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltersystemstmtContext() *AltersystemstmtContext { + var p = new(AltersystemstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altersystemstmt + return p +} + +func InitEmptyAltersystemstmtContext(p *AltersystemstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altersystemstmt +} + +func (*AltersystemstmtContext) IsAltersystemstmtContext() {} + +func NewAltersystemstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltersystemstmtContext { + var p = new(AltersystemstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altersystemstmt + + return p +} + +func (s *AltersystemstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltersystemstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltersystemstmtContext) SYSTEM_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYSTEM_P, 0) +} + +func (s *AltersystemstmtContext) Generic_set() IGeneric_setContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGeneric_setContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGeneric_setContext) +} + +func (s *AltersystemstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AltersystemstmtContext) RESET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESET, 0) +} + +func (s *AltersystemstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltersystemstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltersystemstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltersystemstmt(s) + } +} + +func (s *AltersystemstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltersystemstmt(s) + } +} + +func (s *AltersystemstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltersystemstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altersystemstmt() (localctx IAltersystemstmtContext) { + localctx = NewAltersystemstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 838, PostgreSQLParserRULE_altersystemstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7802) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7803) + p.Match(PostgreSQLParserSYSTEM_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7804) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserRESET || _la == PostgreSQLParserSET) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(7805) + p.Generic_set() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreatedomainstmtContext is an interface to support dynamic dispatch. +type ICreatedomainstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + DOMAIN_P() antlr.TerminalNode + Any_name() IAny_nameContext + Typename() ITypenameContext + Colquallist() IColquallistContext + Opt_as() IOpt_asContext + + // IsCreatedomainstmtContext differentiates from other interfaces. + IsCreatedomainstmtContext() +} + +type CreatedomainstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreatedomainstmtContext() *CreatedomainstmtContext { + var p = new(CreatedomainstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdomainstmt + return p +} + +func InitEmptyCreatedomainstmtContext(p *CreatedomainstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createdomainstmt +} + +func (*CreatedomainstmtContext) IsCreatedomainstmtContext() {} + +func NewCreatedomainstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreatedomainstmtContext { + var p = new(CreatedomainstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createdomainstmt + + return p +} + +func (s *CreatedomainstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreatedomainstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreatedomainstmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *CreatedomainstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *CreatedomainstmtContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *CreatedomainstmtContext) Colquallist() IColquallistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColquallistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColquallistContext) +} + +func (s *CreatedomainstmtContext) Opt_as() IOpt_asContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_asContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_asContext) +} + +func (s *CreatedomainstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreatedomainstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreatedomainstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreatedomainstmt(s) + } +} + +func (s *CreatedomainstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreatedomainstmt(s) + } +} + +func (s *CreatedomainstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreatedomainstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createdomainstmt() (localctx ICreatedomainstmtContext) { + localctx = NewCreatedomainstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 840, PostgreSQLParserRULE_createdomainstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7807) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7808) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7809) + p.Any_name() + } + p.SetState(7811) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(7810) + p.Opt_as() + } + + } + { + p.SetState(7813) + p.Typename() + } + { + p.SetState(7814) + p.Colquallist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlterdomainstmtContext is an interface to support dynamic dispatch. +type IAlterdomainstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + DOMAIN_P() antlr.TerminalNode + Any_name() IAny_nameContext + Alter_column_default() IAlter_column_defaultContext + DROP() antlr.TerminalNode + NOT() antlr.TerminalNode + NULL_P() antlr.TerminalNode + SET() antlr.TerminalNode + ADD_P() antlr.TerminalNode + Tableconstraint() ITableconstraintContext + CONSTRAINT() antlr.TerminalNode + Name() INameContext + VALIDATE() antlr.TerminalNode + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + Opt_drop_behavior() IOpt_drop_behaviorContext + + // IsAlterdomainstmtContext differentiates from other interfaces. + IsAlterdomainstmtContext() +} + +type AlterdomainstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlterdomainstmtContext() *AlterdomainstmtContext { + var p = new(AlterdomainstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterdomainstmt + return p +} + +func InitEmptyAlterdomainstmtContext(p *AlterdomainstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alterdomainstmt +} + +func (*AlterdomainstmtContext) IsAlterdomainstmtContext() {} + +func NewAlterdomainstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AlterdomainstmtContext { + var p = new(AlterdomainstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alterdomainstmt + + return p +} + +func (s *AlterdomainstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AlterdomainstmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AlterdomainstmtContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *AlterdomainstmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AlterdomainstmtContext) Alter_column_default() IAlter_column_defaultContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlter_column_defaultContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlter_column_defaultContext) +} + +func (s *AlterdomainstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *AlterdomainstmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *AlterdomainstmtContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *AlterdomainstmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *AlterdomainstmtContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *AlterdomainstmtContext) Tableconstraint() ITableconstraintContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITableconstraintContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITableconstraintContext) +} + +func (s *AlterdomainstmtContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *AlterdomainstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *AlterdomainstmtContext) VALIDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALIDATE, 0) +} + +func (s *AlterdomainstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *AlterdomainstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *AlterdomainstmtContext) Opt_drop_behavior() IOpt_drop_behaviorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_drop_behaviorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_drop_behaviorContext) +} + +func (s *AlterdomainstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AlterdomainstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AlterdomainstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlterdomainstmt(s) + } +} + +func (s *AlterdomainstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlterdomainstmt(s) + } +} + +func (s *AlterdomainstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlterdomainstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alterdomainstmt() (localctx IAlterdomainstmtContext) { + localctx = NewAlterdomainstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 842, PostgreSQLParserRULE_alterdomainstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7816) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7817) + p.Match(PostgreSQLParserDOMAIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7818) + p.Any_name() + } + p.SetState(7841) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 636, p.GetParserRuleContext()) { + case 1: + { + p.SetState(7819) + p.Alter_column_default() + } + + case 2: + { + p.SetState(7820) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7821) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7822) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + { + p.SetState(7823) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7824) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7825) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + { + p.SetState(7826) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7827) + p.Tableconstraint() + } + + case 5: + { + p.SetState(7828) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7829) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7832) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 634, p.GetParserRuleContext()) == 1 { + { + p.SetState(7830) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7831) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(7834) + p.Name() + } + p.SetState(7836) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCASCADE || _la == PostgreSQLParserRESTRICT { + { + p.SetState(7835) + p.Opt_drop_behavior() + } + + } + + case 6: + { + p.SetState(7838) + p.Match(PostgreSQLParserVALIDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7839) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7840) + p.Name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_asContext is an interface to support dynamic dispatch. +type IOpt_asContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AS() antlr.TerminalNode + + // IsOpt_asContext differentiates from other interfaces. + IsOpt_asContext() +} + +type Opt_asContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_asContext() *Opt_asContext { + var p = new(Opt_asContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_as + return p +} + +func InitEmptyOpt_asContext(p *Opt_asContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_as +} + +func (*Opt_asContext) IsOpt_asContext() {} + +func NewOpt_asContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_asContext { + var p = new(Opt_asContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_as + + return p +} + +func (s *Opt_asContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_asContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Opt_asContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_asContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_asContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_as(s) + } +} + +func (s *Opt_asContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_as(s) + } +} + +func (s *Opt_asContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_as(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_as() (localctx IOpt_asContext) { + localctx = NewOpt_asContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 844, PostgreSQLParserRULE_opt_as) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7843) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltertsdictionarystmtContext is an interface to support dynamic dispatch. +type IAltertsdictionarystmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALTER() antlr.TerminalNode + TEXT_P() antlr.TerminalNode + SEARCH() antlr.TerminalNode + DICTIONARY() antlr.TerminalNode + Any_name() IAny_nameContext + Definition() IDefinitionContext + + // IsAltertsdictionarystmtContext differentiates from other interfaces. + IsAltertsdictionarystmtContext() +} + +type AltertsdictionarystmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltertsdictionarystmtContext() *AltertsdictionarystmtContext { + var p = new(AltertsdictionarystmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertsdictionarystmt + return p +} + +func InitEmptyAltertsdictionarystmtContext(p *AltertsdictionarystmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertsdictionarystmt +} + +func (*AltertsdictionarystmtContext) IsAltertsdictionarystmtContext() {} + +func NewAltertsdictionarystmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltertsdictionarystmtContext { + var p = new(AltertsdictionarystmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altertsdictionarystmt + + return p +} + +func (s *AltertsdictionarystmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltertsdictionarystmtContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *AltertsdictionarystmtContext) TEXT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEXT_P, 0) +} + +func (s *AltertsdictionarystmtContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *AltertsdictionarystmtContext) DICTIONARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDICTIONARY, 0) +} + +func (s *AltertsdictionarystmtContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AltertsdictionarystmtContext) Definition() IDefinitionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDefinitionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDefinitionContext) +} + +func (s *AltertsdictionarystmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltertsdictionarystmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltertsdictionarystmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltertsdictionarystmt(s) + } +} + +func (s *AltertsdictionarystmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltertsdictionarystmt(s) + } +} + +func (s *AltertsdictionarystmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltertsdictionarystmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altertsdictionarystmt() (localctx IAltertsdictionarystmtContext) { + localctx = NewAltertsdictionarystmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 846, PostgreSQLParserRULE_altertsdictionarystmt) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7845) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7846) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7847) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7848) + p.Match(PostgreSQLParserDICTIONARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7849) + p.Any_name() + } + { + p.SetState(7850) + p.Definition() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAltertsconfigurationstmtContext is an interface to support dynamic dispatch. +type IAltertsconfigurationstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllALTER() []antlr.TerminalNode + ALTER(i int) antlr.TerminalNode + TEXT_P() antlr.TerminalNode + SEARCH() antlr.TerminalNode + CONFIGURATION() antlr.TerminalNode + AllAny_name() []IAny_nameContext + Any_name(i int) IAny_nameContext + ADD_P() antlr.TerminalNode + MAPPING() antlr.TerminalNode + FOR() antlr.TerminalNode + Name_list() IName_listContext + Any_with() IAny_withContext + Any_name_list() IAny_name_listContext + REPLACE() antlr.TerminalNode + DROP() antlr.TerminalNode + IF_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsAltertsconfigurationstmtContext differentiates from other interfaces. + IsAltertsconfigurationstmtContext() +} + +type AltertsconfigurationstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAltertsconfigurationstmtContext() *AltertsconfigurationstmtContext { + var p = new(AltertsconfigurationstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertsconfigurationstmt + return p +} + +func InitEmptyAltertsconfigurationstmtContext(p *AltertsconfigurationstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_altertsconfigurationstmt +} + +func (*AltertsconfigurationstmtContext) IsAltertsconfigurationstmtContext() {} + +func NewAltertsconfigurationstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AltertsconfigurationstmtContext { + var p = new(AltertsconfigurationstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_altertsconfigurationstmt + + return p +} + +func (s *AltertsconfigurationstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AltertsconfigurationstmtContext) AllALTER() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserALTER) +} + +func (s *AltertsconfigurationstmtContext) ALTER(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, i) +} + +func (s *AltertsconfigurationstmtContext) TEXT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEXT_P, 0) +} + +func (s *AltertsconfigurationstmtContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *AltertsconfigurationstmtContext) CONFIGURATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFIGURATION, 0) +} + +func (s *AltertsconfigurationstmtContext) AllAny_name() []IAny_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAny_nameContext); ok { + len++ + } + } + + tst := make([]IAny_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAny_nameContext); ok { + tst[i] = t.(IAny_nameContext) + i++ + } + } + + return tst +} + +func (s *AltertsconfigurationstmtContext) Any_name(i int) IAny_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *AltertsconfigurationstmtContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *AltertsconfigurationstmtContext) MAPPING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAPPING, 0) +} + +func (s *AltertsconfigurationstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *AltertsconfigurationstmtContext) Name_list() IName_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IName_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IName_listContext) +} + +func (s *AltertsconfigurationstmtContext) Any_with() IAny_withContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_withContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_withContext) +} + +func (s *AltertsconfigurationstmtContext) Any_name_list() IAny_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_name_listContext) +} + +func (s *AltertsconfigurationstmtContext) REPLACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPLACE, 0) +} + +func (s *AltertsconfigurationstmtContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *AltertsconfigurationstmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *AltertsconfigurationstmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *AltertsconfigurationstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AltertsconfigurationstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AltertsconfigurationstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAltertsconfigurationstmt(s) + } +} + +func (s *AltertsconfigurationstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAltertsconfigurationstmt(s) + } +} + +func (s *AltertsconfigurationstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAltertsconfigurationstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Altertsconfigurationstmt() (localctx IAltertsconfigurationstmtContext) { + localctx = NewAltertsconfigurationstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 848, PostgreSQLParserRULE_altertsconfigurationstmt) + p.SetState(7924) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 637, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7852) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7853) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7854) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7855) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7856) + p.Any_name() + } + { + p.SetState(7857) + p.Match(PostgreSQLParserADD_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7858) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7859) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7860) + p.Name_list() + } + { + p.SetState(7861) + p.Any_with() + } + { + p.SetState(7862) + p.Any_name_list() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7864) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7865) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7866) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7867) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7868) + p.Any_name() + } + { + p.SetState(7869) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7870) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7871) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7872) + p.Name_list() + } + { + p.SetState(7873) + p.Any_with() + } + { + p.SetState(7874) + p.Any_name_list() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7876) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7877) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7878) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7879) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7880) + p.Any_name() + } + { + p.SetState(7881) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7882) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7883) + p.Match(PostgreSQLParserREPLACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7884) + p.Any_name() + } + { + p.SetState(7885) + p.Any_with() + } + { + p.SetState(7886) + p.Any_name() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(7888) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7889) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7890) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7891) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7892) + p.Any_name() + } + { + p.SetState(7893) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7894) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7895) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7896) + p.Name_list() + } + { + p.SetState(7897) + p.Match(PostgreSQLParserREPLACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7898) + p.Any_name() + } + { + p.SetState(7899) + p.Any_with() + } + { + p.SetState(7900) + p.Any_name() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(7902) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7903) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7904) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7905) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7906) + p.Any_name() + } + { + p.SetState(7907) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7908) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7909) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7910) + p.Name_list() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(7912) + p.Match(PostgreSQLParserALTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7913) + p.Match(PostgreSQLParserTEXT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7914) + p.Match(PostgreSQLParserSEARCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7915) + p.Match(PostgreSQLParserCONFIGURATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7916) + p.Any_name() + } + { + p.SetState(7917) + p.Match(PostgreSQLParserDROP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7918) + p.Match(PostgreSQLParserMAPPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7919) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7920) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7921) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7922) + p.Name_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAny_withContext is an interface to support dynamic dispatch. +type IAny_withContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + + // IsAny_withContext differentiates from other interfaces. + IsAny_withContext() +} + +type Any_withContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAny_withContext() *Any_withContext { + var p = new(Any_withContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_with + return p +} + +func InitEmptyAny_withContext(p *Any_withContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_with +} + +func (*Any_withContext) IsAny_withContext() {} + +func NewAny_withContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Any_withContext { + var p = new(Any_withContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_any_with + + return p +} + +func (s *Any_withContext) GetParser() antlr.Parser { return s.parser } + +func (s *Any_withContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Any_withContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Any_withContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Any_withContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAny_with(s) + } +} + +func (s *Any_withContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAny_with(s) + } +} + +func (s *Any_withContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAny_with(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Any_with() (localctx IAny_withContext) { + localctx = NewAny_withContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 850, PostgreSQLParserRULE_any_with) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7926) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreateconversionstmtContext is an interface to support dynamic dispatch. +type ICreateconversionstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CREATE() antlr.TerminalNode + CONVERSION_P() antlr.TerminalNode + AllAny_name() []IAny_nameContext + Any_name(i int) IAny_nameContext + FOR() antlr.TerminalNode + AllSconst() []ISconstContext + Sconst(i int) ISconstContext + TO() antlr.TerminalNode + FROM() antlr.TerminalNode + Opt_default() IOpt_defaultContext + + // IsCreateconversionstmtContext differentiates from other interfaces. + IsCreateconversionstmtContext() +} + +type CreateconversionstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreateconversionstmtContext() *CreateconversionstmtContext { + var p = new(CreateconversionstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createconversionstmt + return p +} + +func InitEmptyCreateconversionstmtContext(p *CreateconversionstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_createconversionstmt +} + +func (*CreateconversionstmtContext) IsCreateconversionstmtContext() {} + +func NewCreateconversionstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CreateconversionstmtContext { + var p = new(CreateconversionstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_createconversionstmt + + return p +} + +func (s *CreateconversionstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *CreateconversionstmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *CreateconversionstmtContext) CONVERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONVERSION_P, 0) +} + +func (s *CreateconversionstmtContext) AllAny_name() []IAny_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAny_nameContext); ok { + len++ + } + } + + tst := make([]IAny_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAny_nameContext); ok { + tst[i] = t.(IAny_nameContext) + i++ + } + } + + return tst +} + +func (s *CreateconversionstmtContext) Any_name(i int) IAny_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *CreateconversionstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *CreateconversionstmtContext) AllSconst() []ISconstContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISconstContext); ok { + len++ + } + } + + tst := make([]ISconstContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISconstContext); ok { + tst[i] = t.(ISconstContext) + i++ + } + } + + return tst +} + +func (s *CreateconversionstmtContext) Sconst(i int) ISconstContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *CreateconversionstmtContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *CreateconversionstmtContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *CreateconversionstmtContext) Opt_default() IOpt_defaultContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_defaultContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_defaultContext) +} + +func (s *CreateconversionstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CreateconversionstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CreateconversionstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCreateconversionstmt(s) + } +} + +func (s *CreateconversionstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCreateconversionstmt(s) + } +} + +func (s *CreateconversionstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCreateconversionstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Createconversionstmt() (localctx ICreateconversionstmtContext) { + localctx = NewCreateconversionstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 852, PostgreSQLParserRULE_createconversionstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7928) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7930) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDEFAULT { + { + p.SetState(7929) + p.Opt_default() + } + + } + { + p.SetState(7932) + p.Match(PostgreSQLParserCONVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7933) + p.Any_name() + } + { + p.SetState(7934) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7935) + p.Sconst() + } + { + p.SetState(7936) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7937) + p.Sconst() + } + { + p.SetState(7938) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7939) + p.Any_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IClusterstmtContext is an interface to support dynamic dispatch. +type IClusterstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CLUSTER() antlr.TerminalNode + Qualified_name() IQualified_nameContext + Opt_verbose() IOpt_verboseContext + Cluster_index_specification() ICluster_index_specificationContext + Name() INameContext + ON() antlr.TerminalNode + + // IsClusterstmtContext differentiates from other interfaces. + IsClusterstmtContext() +} + +type ClusterstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyClusterstmtContext() *ClusterstmtContext { + var p = new(ClusterstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_clusterstmt + return p +} + +func InitEmptyClusterstmtContext(p *ClusterstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_clusterstmt +} + +func (*ClusterstmtContext) IsClusterstmtContext() {} + +func NewClusterstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ClusterstmtContext { + var p = new(ClusterstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_clusterstmt + + return p +} + +func (s *ClusterstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ClusterstmtContext) CLUSTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLUSTER, 0) +} + +func (s *ClusterstmtContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *ClusterstmtContext) Opt_verbose() IOpt_verboseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_verboseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_verboseContext) +} + +func (s *ClusterstmtContext) Cluster_index_specification() ICluster_index_specificationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICluster_index_specificationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICluster_index_specificationContext) +} + +func (s *ClusterstmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *ClusterstmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *ClusterstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ClusterstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ClusterstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterClusterstmt(s) + } +} + +func (s *ClusterstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitClusterstmt(s) + } +} + +func (s *ClusterstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitClusterstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Clusterstmt() (localctx IClusterstmtContext) { + localctx = NewClusterstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 854, PostgreSQLParserRULE_clusterstmt) + var _la int + + p.SetState(7961) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 643, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7941) + p.Match(PostgreSQLParserCLUSTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7943) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVERBOSE { + { + p.SetState(7942) + p.Opt_verbose() + } + + } + { + p.SetState(7945) + p.Qualified_name() + } + p.SetState(7947) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(7946) + p.Cluster_index_specification() + } + + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7949) + p.Match(PostgreSQLParserCLUSTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7951) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVERBOSE { + { + p.SetState(7950) + p.Opt_verbose() + } + + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(7953) + p.Match(PostgreSQLParserCLUSTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7955) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVERBOSE { + { + p.SetState(7954) + p.Opt_verbose() + } + + } + { + p.SetState(7957) + p.Name() + } + { + p.SetState(7958) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7959) + p.Qualified_name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICluster_index_specificationContext is an interface to support dynamic dispatch. +type ICluster_index_specificationContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + Name() INameContext + + // IsCluster_index_specificationContext differentiates from other interfaces. + IsCluster_index_specificationContext() +} + +type Cluster_index_specificationContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCluster_index_specificationContext() *Cluster_index_specificationContext { + var p = new(Cluster_index_specificationContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cluster_index_specification + return p +} + +func InitEmptyCluster_index_specificationContext(p *Cluster_index_specificationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cluster_index_specification +} + +func (*Cluster_index_specificationContext) IsCluster_index_specificationContext() {} + +func NewCluster_index_specificationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cluster_index_specificationContext { + var p = new(Cluster_index_specificationContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_cluster_index_specification + + return p +} + +func (s *Cluster_index_specificationContext) GetParser() antlr.Parser { return s.parser } + +func (s *Cluster_index_specificationContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Cluster_index_specificationContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Cluster_index_specificationContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Cluster_index_specificationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Cluster_index_specificationContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCluster_index_specification(s) + } +} + +func (s *Cluster_index_specificationContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCluster_index_specification(s) + } +} + +func (s *Cluster_index_specificationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCluster_index_specification(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Cluster_index_specification() (localctx ICluster_index_specificationContext) { + localctx = NewCluster_index_specificationContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 856, PostgreSQLParserRULE_cluster_index_specification) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7963) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7964) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVacuumstmtContext is an interface to support dynamic dispatch. +type IVacuumstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + VACUUM() antlr.TerminalNode + Opt_full() IOpt_fullContext + Opt_freeze() IOpt_freezeContext + Opt_verbose() IOpt_verboseContext + Opt_analyze() IOpt_analyzeContext + Opt_vacuum_relation_list() IOpt_vacuum_relation_listContext + OPEN_PAREN() antlr.TerminalNode + Vac_analyze_option_list() IVac_analyze_option_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsVacuumstmtContext differentiates from other interfaces. + IsVacuumstmtContext() +} + +type VacuumstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVacuumstmtContext() *VacuumstmtContext { + var p = new(VacuumstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vacuumstmt + return p +} + +func InitEmptyVacuumstmtContext(p *VacuumstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vacuumstmt +} + +func (*VacuumstmtContext) IsVacuumstmtContext() {} + +func NewVacuumstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *VacuumstmtContext { + var p = new(VacuumstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_vacuumstmt + + return p +} + +func (s *VacuumstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *VacuumstmtContext) VACUUM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVACUUM, 0) +} + +func (s *VacuumstmtContext) Opt_full() IOpt_fullContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_fullContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_fullContext) +} + +func (s *VacuumstmtContext) Opt_freeze() IOpt_freezeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_freezeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_freezeContext) +} + +func (s *VacuumstmtContext) Opt_verbose() IOpt_verboseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_verboseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_verboseContext) +} + +func (s *VacuumstmtContext) Opt_analyze() IOpt_analyzeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_analyzeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_analyzeContext) +} + +func (s *VacuumstmtContext) Opt_vacuum_relation_list() IOpt_vacuum_relation_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_vacuum_relation_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_vacuum_relation_listContext) +} + +func (s *VacuumstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *VacuumstmtContext) Vac_analyze_option_list() IVac_analyze_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVac_analyze_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVac_analyze_option_listContext) +} + +func (s *VacuumstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *VacuumstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *VacuumstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *VacuumstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVacuumstmt(s) + } +} + +func (s *VacuumstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVacuumstmt(s) + } +} + +func (s *VacuumstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVacuumstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Vacuumstmt() (localctx IVacuumstmtContext) { + localctx = NewVacuumstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 858, PostgreSQLParserRULE_vacuumstmt) + var _la int + + p.SetState(7989) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 650, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7966) + p.Match(PostgreSQLParserVACUUM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7968) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFULL { + { + p.SetState(7967) + p.Opt_full() + } + + } + p.SetState(7971) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFREEZE { + { + p.SetState(7970) + p.Opt_freeze() + } + + } + p.SetState(7974) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVERBOSE { + { + p.SetState(7973) + p.Opt_verbose() + } + + } + p.SetState(7977) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 647, p.GetParserRuleContext()) == 1 { + { + p.SetState(7976) + p.Opt_analyze() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(7980) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 648, p.GetParserRuleContext()) == 1 { + { + p.SetState(7979) + p.Opt_vacuum_relation_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7982) + p.Match(PostgreSQLParserVACUUM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7983) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(7984) + p.Vac_analyze_option_list() + } + { + p.SetState(7985) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(7987) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 649, p.GetParserRuleContext()) == 1 { + { + p.SetState(7986) + p.Opt_vacuum_relation_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAnalyzestmtContext is an interface to support dynamic dispatch. +type IAnalyzestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Analyze_keyword() IAnalyze_keywordContext + Opt_verbose() IOpt_verboseContext + Opt_vacuum_relation_list() IOpt_vacuum_relation_listContext + OPEN_PAREN() antlr.TerminalNode + Vac_analyze_option_list() IVac_analyze_option_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsAnalyzestmtContext differentiates from other interfaces. + IsAnalyzestmtContext() +} + +type AnalyzestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAnalyzestmtContext() *AnalyzestmtContext { + var p = new(AnalyzestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_analyzestmt + return p +} + +func InitEmptyAnalyzestmtContext(p *AnalyzestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_analyzestmt +} + +func (*AnalyzestmtContext) IsAnalyzestmtContext() {} + +func NewAnalyzestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnalyzestmtContext { + var p = new(AnalyzestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_analyzestmt + + return p +} + +func (s *AnalyzestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *AnalyzestmtContext) Analyze_keyword() IAnalyze_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAnalyze_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAnalyze_keywordContext) +} + +func (s *AnalyzestmtContext) Opt_verbose() IOpt_verboseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_verboseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_verboseContext) +} + +func (s *AnalyzestmtContext) Opt_vacuum_relation_list() IOpt_vacuum_relation_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_vacuum_relation_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_vacuum_relation_listContext) +} + +func (s *AnalyzestmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *AnalyzestmtContext) Vac_analyze_option_list() IVac_analyze_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVac_analyze_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVac_analyze_option_listContext) +} + +func (s *AnalyzestmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *AnalyzestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AnalyzestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AnalyzestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAnalyzestmt(s) + } +} + +func (s *AnalyzestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAnalyzestmt(s) + } +} + +func (s *AnalyzestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAnalyzestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Analyzestmt() (localctx IAnalyzestmtContext) { + localctx = NewAnalyzestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 860, PostgreSQLParserRULE_analyzestmt) + var _la int + + p.SetState(8005) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 654, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(7991) + p.Analyze_keyword() + } + p.SetState(7993) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVERBOSE { + { + p.SetState(7992) + p.Opt_verbose() + } + + } + p.SetState(7996) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 652, p.GetParserRuleContext()) == 1 { + { + p.SetState(7995) + p.Opt_vacuum_relation_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(7998) + p.Analyze_keyword() + } + { + p.SetState(7999) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8000) + p.Vac_analyze_option_list() + } + { + p.SetState(8001) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8003) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 653, p.GetParserRuleContext()) == 1 { + { + p.SetState(8002) + p.Opt_vacuum_relation_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVac_analyze_option_listContext is an interface to support dynamic dispatch. +type IVac_analyze_option_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllVac_analyze_option_elem() []IVac_analyze_option_elemContext + Vac_analyze_option_elem(i int) IVac_analyze_option_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsVac_analyze_option_listContext differentiates from other interfaces. + IsVac_analyze_option_listContext() +} + +type Vac_analyze_option_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVac_analyze_option_listContext() *Vac_analyze_option_listContext { + var p = new(Vac_analyze_option_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_list + return p +} + +func InitEmptyVac_analyze_option_listContext(p *Vac_analyze_option_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_list +} + +func (*Vac_analyze_option_listContext) IsVac_analyze_option_listContext() {} + +func NewVac_analyze_option_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Vac_analyze_option_listContext { + var p = new(Vac_analyze_option_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_list + + return p +} + +func (s *Vac_analyze_option_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Vac_analyze_option_listContext) AllVac_analyze_option_elem() []IVac_analyze_option_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IVac_analyze_option_elemContext); ok { + len++ + } + } + + tst := make([]IVac_analyze_option_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IVac_analyze_option_elemContext); ok { + tst[i] = t.(IVac_analyze_option_elemContext) + i++ + } + } + + return tst +} + +func (s *Vac_analyze_option_listContext) Vac_analyze_option_elem(i int) IVac_analyze_option_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVac_analyze_option_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IVac_analyze_option_elemContext) +} + +func (s *Vac_analyze_option_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Vac_analyze_option_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Vac_analyze_option_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Vac_analyze_option_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Vac_analyze_option_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVac_analyze_option_list(s) + } +} + +func (s *Vac_analyze_option_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVac_analyze_option_list(s) + } +} + +func (s *Vac_analyze_option_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVac_analyze_option_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Vac_analyze_option_list() (localctx IVac_analyze_option_listContext) { + localctx = NewVac_analyze_option_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 862, PostgreSQLParserRULE_vac_analyze_option_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8007) + p.Vac_analyze_option_elem() + } + p.SetState(8012) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8008) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8009) + p.Vac_analyze_option_elem() + } + + p.SetState(8014) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAnalyze_keywordContext is an interface to support dynamic dispatch. +type IAnalyze_keywordContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ANALYZE() antlr.TerminalNode + ANALYSE() antlr.TerminalNode + + // IsAnalyze_keywordContext differentiates from other interfaces. + IsAnalyze_keywordContext() +} + +type Analyze_keywordContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAnalyze_keywordContext() *Analyze_keywordContext { + var p = new(Analyze_keywordContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_analyze_keyword + return p +} + +func InitEmptyAnalyze_keywordContext(p *Analyze_keywordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_analyze_keyword +} + +func (*Analyze_keywordContext) IsAnalyze_keywordContext() {} + +func NewAnalyze_keywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Analyze_keywordContext { + var p = new(Analyze_keywordContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_analyze_keyword + + return p +} + +func (s *Analyze_keywordContext) GetParser() antlr.Parser { return s.parser } + +func (s *Analyze_keywordContext) ANALYZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserANALYZE, 0) +} + +func (s *Analyze_keywordContext) ANALYSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserANALYSE, 0) +} + +func (s *Analyze_keywordContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Analyze_keywordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Analyze_keywordContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAnalyze_keyword(s) + } +} + +func (s *Analyze_keywordContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAnalyze_keyword(s) + } +} + +func (s *Analyze_keywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAnalyze_keyword(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Analyze_keyword() (localctx IAnalyze_keywordContext) { + localctx = NewAnalyze_keywordContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 864, PostgreSQLParserRULE_analyze_keyword) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8015) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserANALYSE || _la == PostgreSQLParserANALYZE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVac_analyze_option_elemContext is an interface to support dynamic dispatch. +type IVac_analyze_option_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Vac_analyze_option_name() IVac_analyze_option_nameContext + Vac_analyze_option_arg() IVac_analyze_option_argContext + + // IsVac_analyze_option_elemContext differentiates from other interfaces. + IsVac_analyze_option_elemContext() +} + +type Vac_analyze_option_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVac_analyze_option_elemContext() *Vac_analyze_option_elemContext { + var p = new(Vac_analyze_option_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_elem + return p +} + +func InitEmptyVac_analyze_option_elemContext(p *Vac_analyze_option_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_elem +} + +func (*Vac_analyze_option_elemContext) IsVac_analyze_option_elemContext() {} + +func NewVac_analyze_option_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Vac_analyze_option_elemContext { + var p = new(Vac_analyze_option_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_elem + + return p +} + +func (s *Vac_analyze_option_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Vac_analyze_option_elemContext) Vac_analyze_option_name() IVac_analyze_option_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVac_analyze_option_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVac_analyze_option_nameContext) +} + +func (s *Vac_analyze_option_elemContext) Vac_analyze_option_arg() IVac_analyze_option_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVac_analyze_option_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVac_analyze_option_argContext) +} + +func (s *Vac_analyze_option_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Vac_analyze_option_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Vac_analyze_option_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVac_analyze_option_elem(s) + } +} + +func (s *Vac_analyze_option_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVac_analyze_option_elem(s) + } +} + +func (s *Vac_analyze_option_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVac_analyze_option_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Vac_analyze_option_elem() (localctx IVac_analyze_option_elemContext) { + localctx = NewVac_analyze_option_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 866, PostgreSQLParserRULE_vac_analyze_option_elem) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8017) + p.Vac_analyze_option_name() + } + p.SetState(8019) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3611948516751978496) != 0) || ((int64((_la-80)) & ^0x3f) == 0 && ((int64(1)<<(_la-80))&-70918567030783) != 0) || ((int64((_la-144)) & ^0x3f) == 0 && ((int64(1)<<(_la-144))&-1) != 0) || ((int64((_la-208)) & ^0x3f) == 0 && ((int64(1)<<(_la-208))&-39582418599937) != 0) || ((int64((_la-272)) & ^0x3f) == 0 && ((int64(1)<<(_la-272))&-1) != 0) || ((int64((_la-336)) & ^0x3f) == 0 && ((int64(1)<<(_la-336))&-1) != 0) || ((int64((_la-400)) & ^0x3f) == 0 && ((int64(1)<<(_la-400))&-72057594037927937) != 0) || ((int64((_la-464)) & ^0x3f) == 0 && ((int64(1)<<(_la-464))&-144126183192133633) != 0) || ((int64((_la-528)) & ^0x3f) == 0 && ((int64(1)<<(_la-528))&-1) != 0) || ((int64((_la-592)) & ^0x3f) == 0 && ((int64(1)<<(_la-592))&5843490885257396223) != 0) || ((int64((_la-656)) & ^0x3f) == 0 && ((int64(1)<<(_la-656))&4209153) != 0) { + { + p.SetState(8018) + p.Vac_analyze_option_arg() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVac_analyze_option_nameContext is an interface to support dynamic dispatch. +type IVac_analyze_option_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Nonreservedword() INonreservedwordContext + Analyze_keyword() IAnalyze_keywordContext + + // IsVac_analyze_option_nameContext differentiates from other interfaces. + IsVac_analyze_option_nameContext() +} + +type Vac_analyze_option_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVac_analyze_option_nameContext() *Vac_analyze_option_nameContext { + var p = new(Vac_analyze_option_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_name + return p +} + +func InitEmptyVac_analyze_option_nameContext(p *Vac_analyze_option_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_name +} + +func (*Vac_analyze_option_nameContext) IsVac_analyze_option_nameContext() {} + +func NewVac_analyze_option_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Vac_analyze_option_nameContext { + var p = new(Vac_analyze_option_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_name + + return p +} + +func (s *Vac_analyze_option_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Vac_analyze_option_nameContext) Nonreservedword() INonreservedwordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedwordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedwordContext) +} + +func (s *Vac_analyze_option_nameContext) Analyze_keyword() IAnalyze_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAnalyze_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAnalyze_keywordContext) +} + +func (s *Vac_analyze_option_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Vac_analyze_option_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Vac_analyze_option_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVac_analyze_option_name(s) + } +} + +func (s *Vac_analyze_option_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVac_analyze_option_name(s) + } +} + +func (s *Vac_analyze_option_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVac_analyze_option_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Vac_analyze_option_name() (localctx IVac_analyze_option_nameContext) { + localctx = NewVac_analyze_option_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 868, PostgreSQLParserRULE_vac_analyze_option_name) + p.SetState(8023) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8021) + p.Nonreservedword() + } + + case PostgreSQLParserANALYSE, PostgreSQLParserANALYZE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8022) + p.Analyze_keyword() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVac_analyze_option_argContext is an interface to support dynamic dispatch. +type IVac_analyze_option_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Opt_boolean_or_string() IOpt_boolean_or_stringContext + Numericonly() INumericonlyContext + + // IsVac_analyze_option_argContext differentiates from other interfaces. + IsVac_analyze_option_argContext() +} + +type Vac_analyze_option_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVac_analyze_option_argContext() *Vac_analyze_option_argContext { + var p = new(Vac_analyze_option_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_arg + return p +} + +func InitEmptyVac_analyze_option_argContext(p *Vac_analyze_option_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_arg +} + +func (*Vac_analyze_option_argContext) IsVac_analyze_option_argContext() {} + +func NewVac_analyze_option_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Vac_analyze_option_argContext { + var p = new(Vac_analyze_option_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_vac_analyze_option_arg + + return p +} + +func (s *Vac_analyze_option_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Vac_analyze_option_argContext) Opt_boolean_or_string() IOpt_boolean_or_stringContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_boolean_or_stringContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_boolean_or_stringContext) +} + +func (s *Vac_analyze_option_argContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Vac_analyze_option_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Vac_analyze_option_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Vac_analyze_option_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVac_analyze_option_arg(s) + } +} + +func (s *Vac_analyze_option_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVac_analyze_option_arg(s) + } +} + +func (s *Vac_analyze_option_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVac_analyze_option_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Vac_analyze_option_arg() (localctx IVac_analyze_option_argContext) { + localctx = NewVac_analyze_option_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 870, PostgreSQLParserRULE_vac_analyze_option_arg) + p.SetState(8027) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserON, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8025) + p.Opt_boolean_or_string() + } + + case PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserIntegral, PostgreSQLParserNumeric: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8026) + p.Numericonly() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_analyzeContext is an interface to support dynamic dispatch. +type IOpt_analyzeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Analyze_keyword() IAnalyze_keywordContext + + // IsOpt_analyzeContext differentiates from other interfaces. + IsOpt_analyzeContext() +} + +type Opt_analyzeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_analyzeContext() *Opt_analyzeContext { + var p = new(Opt_analyzeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_analyze + return p +} + +func InitEmptyOpt_analyzeContext(p *Opt_analyzeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_analyze +} + +func (*Opt_analyzeContext) IsOpt_analyzeContext() {} + +func NewOpt_analyzeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_analyzeContext { + var p = new(Opt_analyzeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_analyze + + return p +} + +func (s *Opt_analyzeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_analyzeContext) Analyze_keyword() IAnalyze_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAnalyze_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAnalyze_keywordContext) +} + +func (s *Opt_analyzeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_analyzeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_analyzeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_analyze(s) + } +} + +func (s *Opt_analyzeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_analyze(s) + } +} + +func (s *Opt_analyzeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_analyze(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_analyze() (localctx IOpt_analyzeContext) { + localctx = NewOpt_analyzeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 872, PostgreSQLParserRULE_opt_analyze) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8029) + p.Analyze_keyword() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_verboseContext is an interface to support dynamic dispatch. +type IOpt_verboseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + VERBOSE() antlr.TerminalNode + + // IsOpt_verboseContext differentiates from other interfaces. + IsOpt_verboseContext() +} + +type Opt_verboseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_verboseContext() *Opt_verboseContext { + var p = new(Opt_verboseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_verbose + return p +} + +func InitEmptyOpt_verboseContext(p *Opt_verboseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_verbose +} + +func (*Opt_verboseContext) IsOpt_verboseContext() {} + +func NewOpt_verboseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_verboseContext { + var p = new(Opt_verboseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_verbose + + return p +} + +func (s *Opt_verboseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_verboseContext) VERBOSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERBOSE, 0) +} + +func (s *Opt_verboseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_verboseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_verboseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_verbose(s) + } +} + +func (s *Opt_verboseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_verbose(s) + } +} + +func (s *Opt_verboseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_verbose(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_verbose() (localctx IOpt_verboseContext) { + localctx = NewOpt_verboseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 874, PostgreSQLParserRULE_opt_verbose) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8031) + p.Match(PostgreSQLParserVERBOSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_fullContext is an interface to support dynamic dispatch. +type IOpt_fullContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FULL() antlr.TerminalNode + + // IsOpt_fullContext differentiates from other interfaces. + IsOpt_fullContext() +} + +type Opt_fullContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_fullContext() *Opt_fullContext { + var p = new(Opt_fullContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_full + return p +} + +func InitEmptyOpt_fullContext(p *Opt_fullContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_full +} + +func (*Opt_fullContext) IsOpt_fullContext() {} + +func NewOpt_fullContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_fullContext { + var p = new(Opt_fullContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_full + + return p +} + +func (s *Opt_fullContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_fullContext) FULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFULL, 0) +} + +func (s *Opt_fullContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_fullContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_fullContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_full(s) + } +} + +func (s *Opt_fullContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_full(s) + } +} + +func (s *Opt_fullContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_full(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_full() (localctx IOpt_fullContext) { + localctx = NewOpt_fullContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 876, PostgreSQLParserRULE_opt_full) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8033) + p.Match(PostgreSQLParserFULL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_freezeContext is an interface to support dynamic dispatch. +type IOpt_freezeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FREEZE() antlr.TerminalNode + + // IsOpt_freezeContext differentiates from other interfaces. + IsOpt_freezeContext() +} + +type Opt_freezeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_freezeContext() *Opt_freezeContext { + var p = new(Opt_freezeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_freeze + return p +} + +func InitEmptyOpt_freezeContext(p *Opt_freezeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_freeze +} + +func (*Opt_freezeContext) IsOpt_freezeContext() {} + +func NewOpt_freezeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_freezeContext { + var p = new(Opt_freezeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_freeze + + return p +} + +func (s *Opt_freezeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_freezeContext) FREEZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFREEZE, 0) +} + +func (s *Opt_freezeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_freezeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_freezeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_freeze(s) + } +} + +func (s *Opt_freezeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_freeze(s) + } +} + +func (s *Opt_freezeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_freeze(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_freeze() (localctx IOpt_freezeContext) { + localctx = NewOpt_freezeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 878, PostgreSQLParserRULE_opt_freeze) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8035) + p.Match(PostgreSQLParserFREEZE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_name_listContext is an interface to support dynamic dispatch. +type IOpt_name_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Name_list() IName_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_name_listContext differentiates from other interfaces. + IsOpt_name_listContext() +} + +type Opt_name_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_name_listContext() *Opt_name_listContext { + var p = new(Opt_name_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_name_list + return p +} + +func InitEmptyOpt_name_listContext(p *Opt_name_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_name_list +} + +func (*Opt_name_listContext) IsOpt_name_listContext() {} + +func NewOpt_name_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_name_listContext { + var p = new(Opt_name_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_name_list + + return p +} + +func (s *Opt_name_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_name_listContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_name_listContext) Name_list() IName_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IName_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IName_listContext) +} + +func (s *Opt_name_listContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_name_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_name_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_name_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_name_list(s) + } +} + +func (s *Opt_name_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_name_list(s) + } +} + +func (s *Opt_name_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_name_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_name_list() (localctx IOpt_name_listContext) { + localctx = NewOpt_name_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 880, PostgreSQLParserRULE_opt_name_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8037) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8038) + p.Name_list() + } + { + p.SetState(8039) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVacuum_relationContext is an interface to support dynamic dispatch. +type IVacuum_relationContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Qualified_name() IQualified_nameContext + Opt_name_list() IOpt_name_listContext + + // IsVacuum_relationContext differentiates from other interfaces. + IsVacuum_relationContext() +} + +type Vacuum_relationContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVacuum_relationContext() *Vacuum_relationContext { + var p = new(Vacuum_relationContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vacuum_relation + return p +} + +func InitEmptyVacuum_relationContext(p *Vacuum_relationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vacuum_relation +} + +func (*Vacuum_relationContext) IsVacuum_relationContext() {} + +func NewVacuum_relationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Vacuum_relationContext { + var p = new(Vacuum_relationContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_vacuum_relation + + return p +} + +func (s *Vacuum_relationContext) GetParser() antlr.Parser { return s.parser } + +func (s *Vacuum_relationContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Vacuum_relationContext) Opt_name_list() IOpt_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_name_listContext) +} + +func (s *Vacuum_relationContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Vacuum_relationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Vacuum_relationContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVacuum_relation(s) + } +} + +func (s *Vacuum_relationContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVacuum_relation(s) + } +} + +func (s *Vacuum_relationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVacuum_relation(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Vacuum_relation() (localctx IVacuum_relationContext) { + localctx = NewVacuum_relationContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 882, PostgreSQLParserRULE_vacuum_relation) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8041) + p.Qualified_name() + } + p.SetState(8043) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 659, p.GetParserRuleContext()) == 1 { + { + p.SetState(8042) + p.Opt_name_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IVacuum_relation_listContext is an interface to support dynamic dispatch. +type IVacuum_relation_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllVacuum_relation() []IVacuum_relationContext + Vacuum_relation(i int) IVacuum_relationContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsVacuum_relation_listContext differentiates from other interfaces. + IsVacuum_relation_listContext() +} + +type Vacuum_relation_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyVacuum_relation_listContext() *Vacuum_relation_listContext { + var p = new(Vacuum_relation_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vacuum_relation_list + return p +} + +func InitEmptyVacuum_relation_listContext(p *Vacuum_relation_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_vacuum_relation_list +} + +func (*Vacuum_relation_listContext) IsVacuum_relation_listContext() {} + +func NewVacuum_relation_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Vacuum_relation_listContext { + var p = new(Vacuum_relation_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_vacuum_relation_list + + return p +} + +func (s *Vacuum_relation_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Vacuum_relation_listContext) AllVacuum_relation() []IVacuum_relationContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IVacuum_relationContext); ok { + len++ + } + } + + tst := make([]IVacuum_relationContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IVacuum_relationContext); ok { + tst[i] = t.(IVacuum_relationContext) + i++ + } + } + + return tst +} + +func (s *Vacuum_relation_listContext) Vacuum_relation(i int) IVacuum_relationContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVacuum_relationContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IVacuum_relationContext) +} + +func (s *Vacuum_relation_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Vacuum_relation_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Vacuum_relation_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Vacuum_relation_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Vacuum_relation_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterVacuum_relation_list(s) + } +} + +func (s *Vacuum_relation_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitVacuum_relation_list(s) + } +} + +func (s *Vacuum_relation_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitVacuum_relation_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Vacuum_relation_list() (localctx IVacuum_relation_listContext) { + localctx = NewVacuum_relation_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 884, PostgreSQLParserRULE_vacuum_relation_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8045) + p.Vacuum_relation() + } + p.SetState(8050) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8046) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8047) + p.Vacuum_relation() + } + + p.SetState(8052) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_vacuum_relation_listContext is an interface to support dynamic dispatch. +type IOpt_vacuum_relation_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Vacuum_relation_list() IVacuum_relation_listContext + + // IsOpt_vacuum_relation_listContext differentiates from other interfaces. + IsOpt_vacuum_relation_listContext() +} + +type Opt_vacuum_relation_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_vacuum_relation_listContext() *Opt_vacuum_relation_listContext { + var p = new(Opt_vacuum_relation_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_vacuum_relation_list + return p +} + +func InitEmptyOpt_vacuum_relation_listContext(p *Opt_vacuum_relation_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_vacuum_relation_list +} + +func (*Opt_vacuum_relation_listContext) IsOpt_vacuum_relation_listContext() {} + +func NewOpt_vacuum_relation_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_vacuum_relation_listContext { + var p = new(Opt_vacuum_relation_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_vacuum_relation_list + + return p +} + +func (s *Opt_vacuum_relation_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_vacuum_relation_listContext) Vacuum_relation_list() IVacuum_relation_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IVacuum_relation_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IVacuum_relation_listContext) +} + +func (s *Opt_vacuum_relation_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_vacuum_relation_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_vacuum_relation_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_vacuum_relation_list(s) + } +} + +func (s *Opt_vacuum_relation_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_vacuum_relation_list(s) + } +} + +func (s *Opt_vacuum_relation_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_vacuum_relation_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_vacuum_relation_list() (localctx IOpt_vacuum_relation_listContext) { + localctx = NewOpt_vacuum_relation_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 886, PostgreSQLParserRULE_opt_vacuum_relation_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8053) + p.Vacuum_relation_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExplainstmtContext is an interface to support dynamic dispatch. +type IExplainstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EXPLAIN() antlr.TerminalNode + Explainablestmt() IExplainablestmtContext + Analyze_keyword() IAnalyze_keywordContext + Opt_verbose() IOpt_verboseContext + VERBOSE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Explain_option_list() IExplain_option_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsExplainstmtContext differentiates from other interfaces. + IsExplainstmtContext() +} + +type ExplainstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExplainstmtContext() *ExplainstmtContext { + var p = new(ExplainstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explainstmt + return p +} + +func InitEmptyExplainstmtContext(p *ExplainstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explainstmt +} + +func (*ExplainstmtContext) IsExplainstmtContext() {} + +func NewExplainstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExplainstmtContext { + var p = new(ExplainstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_explainstmt + + return p +} + +func (s *ExplainstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExplainstmtContext) EXPLAIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXPLAIN, 0) +} + +func (s *ExplainstmtContext) Explainablestmt() IExplainablestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExplainablestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExplainablestmtContext) +} + +func (s *ExplainstmtContext) Analyze_keyword() IAnalyze_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAnalyze_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAnalyze_keywordContext) +} + +func (s *ExplainstmtContext) Opt_verbose() IOpt_verboseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_verboseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_verboseContext) +} + +func (s *ExplainstmtContext) VERBOSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERBOSE, 0) +} + +func (s *ExplainstmtContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ExplainstmtContext) Explain_option_list() IExplain_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExplain_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExplain_option_listContext) +} + +func (s *ExplainstmtContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ExplainstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExplainstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExplainstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExplainstmt(s) + } +} + +func (s *ExplainstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExplainstmt(s) + } +} + +func (s *ExplainstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExplainstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Explainstmt() (localctx IExplainstmtContext) { + localctx = NewExplainstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 888, PostgreSQLParserRULE_explainstmt) + var _la int + + p.SetState(8073) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 662, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8055) + p.Match(PostgreSQLParserEXPLAIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8056) + p.Explainablestmt() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8057) + p.Match(PostgreSQLParserEXPLAIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8058) + p.Analyze_keyword() + } + p.SetState(8060) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVERBOSE { + { + p.SetState(8059) + p.Opt_verbose() + } + + } + { + p.SetState(8062) + p.Explainablestmt() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8064) + p.Match(PostgreSQLParserEXPLAIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8065) + p.Match(PostgreSQLParserVERBOSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8066) + p.Explainablestmt() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8067) + p.Match(PostgreSQLParserEXPLAIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8068) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8069) + p.Explain_option_list() + } + { + p.SetState(8070) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8071) + p.Explainablestmt() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExplainablestmtContext is an interface to support dynamic dispatch. +type IExplainablestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Selectstmt() ISelectstmtContext + Insertstmt() IInsertstmtContext + Updatestmt() IUpdatestmtContext + Deletestmt() IDeletestmtContext + Declarecursorstmt() IDeclarecursorstmtContext + Createasstmt() ICreateasstmtContext + Creatematviewstmt() ICreatematviewstmtContext + Refreshmatviewstmt() IRefreshmatviewstmtContext + Executestmt() IExecutestmtContext + + // IsExplainablestmtContext differentiates from other interfaces. + IsExplainablestmtContext() +} + +type ExplainablestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExplainablestmtContext() *ExplainablestmtContext { + var p = new(ExplainablestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explainablestmt + return p +} + +func InitEmptyExplainablestmtContext(p *ExplainablestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explainablestmt +} + +func (*ExplainablestmtContext) IsExplainablestmtContext() {} + +func NewExplainablestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExplainablestmtContext { + var p = new(ExplainablestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_explainablestmt + + return p +} + +func (s *ExplainablestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExplainablestmtContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *ExplainablestmtContext) Insertstmt() IInsertstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsertstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInsertstmtContext) +} + +func (s *ExplainablestmtContext) Updatestmt() IUpdatestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUpdatestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUpdatestmtContext) +} + +func (s *ExplainablestmtContext) Deletestmt() IDeletestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDeletestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDeletestmtContext) +} + +func (s *ExplainablestmtContext) Declarecursorstmt() IDeclarecursorstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDeclarecursorstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDeclarecursorstmtContext) +} + +func (s *ExplainablestmtContext) Createasstmt() ICreateasstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreateasstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreateasstmtContext) +} + +func (s *ExplainablestmtContext) Creatematviewstmt() ICreatematviewstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreatematviewstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreatematviewstmtContext) +} + +func (s *ExplainablestmtContext) Refreshmatviewstmt() IRefreshmatviewstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRefreshmatviewstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRefreshmatviewstmtContext) +} + +func (s *ExplainablestmtContext) Executestmt() IExecutestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExecutestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExecutestmtContext) +} + +func (s *ExplainablestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExplainablestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExplainablestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExplainablestmt(s) + } +} + +func (s *ExplainablestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExplainablestmt(s) + } +} + +func (s *ExplainablestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExplainablestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Explainablestmt() (localctx IExplainablestmtContext) { + localctx = NewExplainablestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 890, PostgreSQLParserRULE_explainablestmt) + p.SetState(8084) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 663, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8075) + p.Selectstmt() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8076) + p.Insertstmt() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8077) + p.Updatestmt() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8078) + p.Deletestmt() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(8079) + p.Declarecursorstmt() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(8080) + p.Createasstmt() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(8081) + p.Creatematviewstmt() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(8082) + p.Refreshmatviewstmt() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(8083) + p.Executestmt() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExplain_option_listContext is an interface to support dynamic dispatch. +type IExplain_option_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllExplain_option_elem() []IExplain_option_elemContext + Explain_option_elem(i int) IExplain_option_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsExplain_option_listContext differentiates from other interfaces. + IsExplain_option_listContext() +} + +type Explain_option_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExplain_option_listContext() *Explain_option_listContext { + var p = new(Explain_option_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explain_option_list + return p +} + +func InitEmptyExplain_option_listContext(p *Explain_option_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explain_option_list +} + +func (*Explain_option_listContext) IsExplain_option_listContext() {} + +func NewExplain_option_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Explain_option_listContext { + var p = new(Explain_option_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_explain_option_list + + return p +} + +func (s *Explain_option_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Explain_option_listContext) AllExplain_option_elem() []IExplain_option_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IExplain_option_elemContext); ok { + len++ + } + } + + tst := make([]IExplain_option_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IExplain_option_elemContext); ok { + tst[i] = t.(IExplain_option_elemContext) + i++ + } + } + + return tst +} + +func (s *Explain_option_listContext) Explain_option_elem(i int) IExplain_option_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExplain_option_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IExplain_option_elemContext) +} + +func (s *Explain_option_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Explain_option_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Explain_option_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Explain_option_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Explain_option_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExplain_option_list(s) + } +} + +func (s *Explain_option_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExplain_option_list(s) + } +} + +func (s *Explain_option_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExplain_option_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Explain_option_list() (localctx IExplain_option_listContext) { + localctx = NewExplain_option_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 892, PostgreSQLParserRULE_explain_option_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8086) + p.Explain_option_elem() + } + p.SetState(8091) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8087) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8088) + p.Explain_option_elem() + } + + p.SetState(8093) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExplain_option_elemContext is an interface to support dynamic dispatch. +type IExplain_option_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Explain_option_name() IExplain_option_nameContext + Explain_option_arg() IExplain_option_argContext + + // IsExplain_option_elemContext differentiates from other interfaces. + IsExplain_option_elemContext() +} + +type Explain_option_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExplain_option_elemContext() *Explain_option_elemContext { + var p = new(Explain_option_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explain_option_elem + return p +} + +func InitEmptyExplain_option_elemContext(p *Explain_option_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explain_option_elem +} + +func (*Explain_option_elemContext) IsExplain_option_elemContext() {} + +func NewExplain_option_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Explain_option_elemContext { + var p = new(Explain_option_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_explain_option_elem + + return p +} + +func (s *Explain_option_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Explain_option_elemContext) Explain_option_name() IExplain_option_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExplain_option_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExplain_option_nameContext) +} + +func (s *Explain_option_elemContext) Explain_option_arg() IExplain_option_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExplain_option_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExplain_option_argContext) +} + +func (s *Explain_option_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Explain_option_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Explain_option_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExplain_option_elem(s) + } +} + +func (s *Explain_option_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExplain_option_elem(s) + } +} + +func (s *Explain_option_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExplain_option_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Explain_option_elem() (localctx IExplain_option_elemContext) { + localctx = NewExplain_option_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 894, PostgreSQLParserRULE_explain_option_elem) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8094) + p.Explain_option_name() + } + p.SetState(8096) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3611948516751978496) != 0) || ((int64((_la-80)) & ^0x3f) == 0 && ((int64(1)<<(_la-80))&-70918567030783) != 0) || ((int64((_la-144)) & ^0x3f) == 0 && ((int64(1)<<(_la-144))&-1) != 0) || ((int64((_la-208)) & ^0x3f) == 0 && ((int64(1)<<(_la-208))&-39582418599937) != 0) || ((int64((_la-272)) & ^0x3f) == 0 && ((int64(1)<<(_la-272))&-1) != 0) || ((int64((_la-336)) & ^0x3f) == 0 && ((int64(1)<<(_la-336))&-1) != 0) || ((int64((_la-400)) & ^0x3f) == 0 && ((int64(1)<<(_la-400))&-72057594037927937) != 0) || ((int64((_la-464)) & ^0x3f) == 0 && ((int64(1)<<(_la-464))&-144126183192133633) != 0) || ((int64((_la-528)) & ^0x3f) == 0 && ((int64(1)<<(_la-528))&-1) != 0) || ((int64((_la-592)) & ^0x3f) == 0 && ((int64(1)<<(_la-592))&5843490885257396223) != 0) || ((int64((_la-656)) & ^0x3f) == 0 && ((int64(1)<<(_la-656))&4209153) != 0) { + { + p.SetState(8095) + p.Explain_option_arg() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExplain_option_nameContext is an interface to support dynamic dispatch. +type IExplain_option_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Nonreservedword() INonreservedwordContext + Analyze_keyword() IAnalyze_keywordContext + + // IsExplain_option_nameContext differentiates from other interfaces. + IsExplain_option_nameContext() +} + +type Explain_option_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExplain_option_nameContext() *Explain_option_nameContext { + var p = new(Explain_option_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explain_option_name + return p +} + +func InitEmptyExplain_option_nameContext(p *Explain_option_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explain_option_name +} + +func (*Explain_option_nameContext) IsExplain_option_nameContext() {} + +func NewExplain_option_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Explain_option_nameContext { + var p = new(Explain_option_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_explain_option_name + + return p +} + +func (s *Explain_option_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Explain_option_nameContext) Nonreservedword() INonreservedwordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedwordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedwordContext) +} + +func (s *Explain_option_nameContext) Analyze_keyword() IAnalyze_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAnalyze_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAnalyze_keywordContext) +} + +func (s *Explain_option_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Explain_option_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Explain_option_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExplain_option_name(s) + } +} + +func (s *Explain_option_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExplain_option_name(s) + } +} + +func (s *Explain_option_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExplain_option_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Explain_option_name() (localctx IExplain_option_nameContext) { + localctx = NewExplain_option_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 896, PostgreSQLParserRULE_explain_option_name) + p.SetState(8100) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8098) + p.Nonreservedword() + } + + case PostgreSQLParserANALYSE, PostgreSQLParserANALYZE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8099) + p.Analyze_keyword() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExplain_option_argContext is an interface to support dynamic dispatch. +type IExplain_option_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Opt_boolean_or_string() IOpt_boolean_or_stringContext + Numericonly() INumericonlyContext + + // IsExplain_option_argContext differentiates from other interfaces. + IsExplain_option_argContext() +} + +type Explain_option_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExplain_option_argContext() *Explain_option_argContext { + var p = new(Explain_option_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explain_option_arg + return p +} + +func InitEmptyExplain_option_argContext(p *Explain_option_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explain_option_arg +} + +func (*Explain_option_argContext) IsExplain_option_argContext() {} + +func NewExplain_option_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Explain_option_argContext { + var p = new(Explain_option_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_explain_option_arg + + return p +} + +func (s *Explain_option_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Explain_option_argContext) Opt_boolean_or_string() IOpt_boolean_or_stringContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_boolean_or_stringContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_boolean_or_stringContext) +} + +func (s *Explain_option_argContext) Numericonly() INumericonlyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericonlyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericonlyContext) +} + +func (s *Explain_option_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Explain_option_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Explain_option_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExplain_option_arg(s) + } +} + +func (s *Explain_option_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExplain_option_arg(s) + } +} + +func (s *Explain_option_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExplain_option_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Explain_option_arg() (localctx IExplain_option_argContext) { + localctx = NewExplain_option_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 898, PostgreSQLParserRULE_explain_option_arg) + p.SetState(8104) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserON, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8102) + p.Opt_boolean_or_string() + } + + case PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserIntegral, PostgreSQLParserNumeric: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8103) + p.Numericonly() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPreparestmtContext is an interface to support dynamic dispatch. +type IPreparestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PREPARE() antlr.TerminalNode + Name() INameContext + AS() antlr.TerminalNode + Preparablestmt() IPreparablestmtContext + Prep_type_clause() IPrep_type_clauseContext + + // IsPreparestmtContext differentiates from other interfaces. + IsPreparestmtContext() +} + +type PreparestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPreparestmtContext() *PreparestmtContext { + var p = new(PreparestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_preparestmt + return p +} + +func InitEmptyPreparestmtContext(p *PreparestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_preparestmt +} + +func (*PreparestmtContext) IsPreparestmtContext() {} + +func NewPreparestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PreparestmtContext { + var p = new(PreparestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_preparestmt + + return p +} + +func (s *PreparestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *PreparestmtContext) PREPARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPREPARE, 0) +} + +func (s *PreparestmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *PreparestmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *PreparestmtContext) Preparablestmt() IPreparablestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPreparablestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPreparablestmtContext) +} + +func (s *PreparestmtContext) Prep_type_clause() IPrep_type_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPrep_type_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPrep_type_clauseContext) +} + +func (s *PreparestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PreparestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PreparestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPreparestmt(s) + } +} + +func (s *PreparestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPreparestmt(s) + } +} + +func (s *PreparestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPreparestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Preparestmt() (localctx IPreparestmtContext) { + localctx = NewPreparestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 900, PostgreSQLParserRULE_preparestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8106) + p.Match(PostgreSQLParserPREPARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8107) + p.Name() + } + p.SetState(8109) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(8108) + p.Prep_type_clause() + } + + } + { + p.SetState(8111) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8112) + p.Preparablestmt() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPrep_type_clauseContext is an interface to support dynamic dispatch. +type IPrep_type_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Type_list() IType_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsPrep_type_clauseContext differentiates from other interfaces. + IsPrep_type_clauseContext() +} + +type Prep_type_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPrep_type_clauseContext() *Prep_type_clauseContext { + var p = new(Prep_type_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_prep_type_clause + return p +} + +func InitEmptyPrep_type_clauseContext(p *Prep_type_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_prep_type_clause +} + +func (*Prep_type_clauseContext) IsPrep_type_clauseContext() {} + +func NewPrep_type_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Prep_type_clauseContext { + var p = new(Prep_type_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_prep_type_clause + + return p +} + +func (s *Prep_type_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Prep_type_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Prep_type_clauseContext) Type_list() IType_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_listContext) +} + +func (s *Prep_type_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Prep_type_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Prep_type_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Prep_type_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPrep_type_clause(s) + } +} + +func (s *Prep_type_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPrep_type_clause(s) + } +} + +func (s *Prep_type_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPrep_type_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Prep_type_clause() (localctx IPrep_type_clauseContext) { + localctx = NewPrep_type_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 902, PostgreSQLParserRULE_prep_type_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8114) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8115) + p.Type_list() + } + { + p.SetState(8116) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPreparablestmtContext is an interface to support dynamic dispatch. +type IPreparablestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Selectstmt() ISelectstmtContext + Insertstmt() IInsertstmtContext + Updatestmt() IUpdatestmtContext + Deletestmt() IDeletestmtContext + Mergestmt() IMergestmtContext + + // IsPreparablestmtContext differentiates from other interfaces. + IsPreparablestmtContext() +} + +type PreparablestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPreparablestmtContext() *PreparablestmtContext { + var p = new(PreparablestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_preparablestmt + return p +} + +func InitEmptyPreparablestmtContext(p *PreparablestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_preparablestmt +} + +func (*PreparablestmtContext) IsPreparablestmtContext() {} + +func NewPreparablestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PreparablestmtContext { + var p = new(PreparablestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_preparablestmt + + return p +} + +func (s *PreparablestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *PreparablestmtContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *PreparablestmtContext) Insertstmt() IInsertstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsertstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInsertstmtContext) +} + +func (s *PreparablestmtContext) Updatestmt() IUpdatestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUpdatestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUpdatestmtContext) +} + +func (s *PreparablestmtContext) Deletestmt() IDeletestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDeletestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDeletestmtContext) +} + +func (s *PreparablestmtContext) Mergestmt() IMergestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IMergestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IMergestmtContext) +} + +func (s *PreparablestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PreparablestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PreparablestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPreparablestmt(s) + } +} + +func (s *PreparablestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPreparablestmt(s) + } +} + +func (s *PreparablestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPreparablestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Preparablestmt() (localctx IPreparablestmtContext) { + localctx = NewPreparablestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 904, PostgreSQLParserRULE_preparablestmt) + p.SetState(8123) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 669, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8118) + p.Selectstmt() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8119) + p.Insertstmt() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8120) + p.Updatestmt() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8121) + p.Deletestmt() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(8122) + p.Mergestmt() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExecutestmtContext is an interface to support dynamic dispatch. +type IExecutestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EXECUTE() antlr.TerminalNode + Name() INameContext + Execute_param_clause() IExecute_param_clauseContext + CREATE() antlr.TerminalNode + TABLE() antlr.TerminalNode + Create_as_target() ICreate_as_targetContext + AS() antlr.TerminalNode + Opttemp() IOpttempContext + Opt_with_data() IOpt_with_dataContext + IF_P() antlr.TerminalNode + NOT() antlr.TerminalNode + EXISTS() antlr.TerminalNode + + // IsExecutestmtContext differentiates from other interfaces. + IsExecutestmtContext() +} + +type ExecutestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExecutestmtContext() *ExecutestmtContext { + var p = new(ExecutestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_executestmt + return p +} + +func InitEmptyExecutestmtContext(p *ExecutestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_executestmt +} + +func (*ExecutestmtContext) IsExecutestmtContext() {} + +func NewExecutestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExecutestmtContext { + var p = new(ExecutestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_executestmt + + return p +} + +func (s *ExecutestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *ExecutestmtContext) EXECUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXECUTE, 0) +} + +func (s *ExecutestmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *ExecutestmtContext) Execute_param_clause() IExecute_param_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExecute_param_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExecute_param_clauseContext) +} + +func (s *ExecutestmtContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *ExecutestmtContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *ExecutestmtContext) Create_as_target() ICreate_as_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_as_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_as_targetContext) +} + +func (s *ExecutestmtContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *ExecutestmtContext) Opttemp() IOpttempContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttempContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttempContext) +} + +func (s *ExecutestmtContext) Opt_with_data() IOpt_with_dataContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_with_dataContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_with_dataContext) +} + +func (s *ExecutestmtContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *ExecutestmtContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *ExecutestmtContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *ExecutestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ExecutestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ExecutestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExecutestmt(s) + } +} + +func (s *ExecutestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExecutestmt(s) + } +} + +func (s *ExecutestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExecutestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Executestmt() (localctx IExecutestmtContext) { + localctx = NewExecutestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 906, PostgreSQLParserRULE_executestmt) + var _la int + + p.SetState(8163) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 677, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8125) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8126) + p.Name() + } + p.SetState(8128) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 670, p.GetParserRuleContext()) == 1 { + { + p.SetState(8127) + p.Execute_param_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8130) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8132) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGLOBAL || _la == PostgreSQLParserLOCAL || ((int64((_la-345)) & ^0x3f) == 0 && ((int64(1)<<(_la-345))&32773) != 0) { + { + p.SetState(8131) + p.Opttemp() + } + + } + { + p.SetState(8134) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8135) + p.Create_as_target() + } + { + p.SetState(8136) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8137) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8138) + p.Name() + } + p.SetState(8140) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 672, p.GetParserRuleContext()) == 1 { + { + p.SetState(8139) + p.Execute_param_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(8143) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 673, p.GetParserRuleContext()) == 1 { + { + p.SetState(8142) + p.Opt_with_data() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8145) + p.Match(PostgreSQLParserCREATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8147) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGLOBAL || _la == PostgreSQLParserLOCAL || ((int64((_la-345)) & ^0x3f) == 0 && ((int64(1)<<(_la-345))&32773) != 0) { + { + p.SetState(8146) + p.Opttemp() + } + + } + { + p.SetState(8149) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8150) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8151) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8152) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8153) + p.Create_as_target() + } + { + p.SetState(8154) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8155) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8156) + p.Name() + } + p.SetState(8158) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 675, p.GetParserRuleContext()) == 1 { + { + p.SetState(8157) + p.Execute_param_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(8161) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 676, p.GetParserRuleContext()) == 1 { + { + p.SetState(8160) + p.Opt_with_data() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExecute_param_clauseContext is an interface to support dynamic dispatch. +type IExecute_param_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsExecute_param_clauseContext differentiates from other interfaces. + IsExecute_param_clauseContext() +} + +type Execute_param_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExecute_param_clauseContext() *Execute_param_clauseContext { + var p = new(Execute_param_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_execute_param_clause + return p +} + +func InitEmptyExecute_param_clauseContext(p *Execute_param_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_execute_param_clause +} + +func (*Execute_param_clauseContext) IsExecute_param_clauseContext() {} + +func NewExecute_param_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Execute_param_clauseContext { + var p = new(Execute_param_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_execute_param_clause + + return p +} + +func (s *Execute_param_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Execute_param_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Execute_param_clauseContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Execute_param_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Execute_param_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Execute_param_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Execute_param_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExecute_param_clause(s) + } +} + +func (s *Execute_param_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExecute_param_clause(s) + } +} + +func (s *Execute_param_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExecute_param_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Execute_param_clause() (localctx IExecute_param_clauseContext) { + localctx = NewExecute_param_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 908, PostgreSQLParserRULE_execute_param_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8165) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8166) + p.Expr_list() + } + { + p.SetState(8167) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDeallocatestmtContext is an interface to support dynamic dispatch. +type IDeallocatestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DEALLOCATE() antlr.TerminalNode + Name() INameContext + PREPARE() antlr.TerminalNode + ALL() antlr.TerminalNode + + // IsDeallocatestmtContext differentiates from other interfaces. + IsDeallocatestmtContext() +} + +type DeallocatestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDeallocatestmtContext() *DeallocatestmtContext { + var p = new(DeallocatestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_deallocatestmt + return p +} + +func InitEmptyDeallocatestmtContext(p *DeallocatestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_deallocatestmt +} + +func (*DeallocatestmtContext) IsDeallocatestmtContext() {} + +func NewDeallocatestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DeallocatestmtContext { + var p = new(DeallocatestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_deallocatestmt + + return p +} + +func (s *DeallocatestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DeallocatestmtContext) DEALLOCATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEALLOCATE, 0) +} + +func (s *DeallocatestmtContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *DeallocatestmtContext) PREPARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPREPARE, 0) +} + +func (s *DeallocatestmtContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *DeallocatestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DeallocatestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DeallocatestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDeallocatestmt(s) + } +} + +func (s *DeallocatestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDeallocatestmt(s) + } +} + +func (s *DeallocatestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDeallocatestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Deallocatestmt() (localctx IDeallocatestmtContext) { + localctx = NewDeallocatestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 910, PostgreSQLParserRULE_deallocatestmt) + p.SetState(8179) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 678, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8169) + p.Match(PostgreSQLParserDEALLOCATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8170) + p.Name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8171) + p.Match(PostgreSQLParserDEALLOCATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8172) + p.Match(PostgreSQLParserPREPARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8173) + p.Name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8174) + p.Match(PostgreSQLParserDEALLOCATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8175) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8176) + p.Match(PostgreSQLParserDEALLOCATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8177) + p.Match(PostgreSQLParserPREPARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8178) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IInsertstmtContext is an interface to support dynamic dispatch. +type IInsertstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INSERT() antlr.TerminalNode + INTO() antlr.TerminalNode + Insert_target() IInsert_targetContext + Insert_rest() IInsert_restContext + Opt_with_clause() IOpt_with_clauseContext + Opt_on_conflict() IOpt_on_conflictContext + Returning_clause() IReturning_clauseContext + + // IsInsertstmtContext differentiates from other interfaces. + IsInsertstmtContext() +} + +type InsertstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInsertstmtContext() *InsertstmtContext { + var p = new(InsertstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insertstmt + return p +} + +func InitEmptyInsertstmtContext(p *InsertstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insertstmt +} + +func (*InsertstmtContext) IsInsertstmtContext() {} + +func NewInsertstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *InsertstmtContext { + var p = new(InsertstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_insertstmt + + return p +} + +func (s *InsertstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *InsertstmtContext) INSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSERT, 0) +} + +func (s *InsertstmtContext) INTO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTO, 0) +} + +func (s *InsertstmtContext) Insert_target() IInsert_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsert_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInsert_targetContext) +} + +func (s *InsertstmtContext) Insert_rest() IInsert_restContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsert_restContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInsert_restContext) +} + +func (s *InsertstmtContext) Opt_with_clause() IOpt_with_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_with_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_with_clauseContext) +} + +func (s *InsertstmtContext) Opt_on_conflict() IOpt_on_conflictContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_on_conflictContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_on_conflictContext) +} + +func (s *InsertstmtContext) Returning_clause() IReturning_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReturning_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReturning_clauseContext) +} + +func (s *InsertstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *InsertstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *InsertstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterInsertstmt(s) + } +} + +func (s *InsertstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitInsertstmt(s) + } +} + +func (s *InsertstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitInsertstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Insertstmt() (localctx IInsertstmtContext) { + localctx = NewInsertstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 912, PostgreSQLParserRULE_insertstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8182) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(8181) + p.Opt_with_clause() + } + + } + { + p.SetState(8184) + p.Match(PostgreSQLParserINSERT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8185) + p.Match(PostgreSQLParserINTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8186) + p.Insert_target() + } + { + p.SetState(8187) + p.Insert_rest() + } + p.SetState(8189) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserON { + { + p.SetState(8188) + p.Opt_on_conflict() + } + + } + p.SetState(8192) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserRETURNING { + { + p.SetState(8191) + p.Returning_clause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IInsert_targetContext is an interface to support dynamic dispatch. +type IInsert_targetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Qualified_name() IQualified_nameContext + AS() antlr.TerminalNode + Colid() IColidContext + + // IsInsert_targetContext differentiates from other interfaces. + IsInsert_targetContext() +} + +type Insert_targetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInsert_targetContext() *Insert_targetContext { + var p = new(Insert_targetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insert_target + return p +} + +func InitEmptyInsert_targetContext(p *Insert_targetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insert_target +} + +func (*Insert_targetContext) IsInsert_targetContext() {} + +func NewInsert_targetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Insert_targetContext { + var p = new(Insert_targetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_insert_target + + return p +} + +func (s *Insert_targetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Insert_targetContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Insert_targetContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Insert_targetContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Insert_targetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Insert_targetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Insert_targetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterInsert_target(s) + } +} + +func (s *Insert_targetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitInsert_target(s) + } +} + +func (s *Insert_targetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitInsert_target(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Insert_target() (localctx IInsert_targetContext) { + localctx = NewInsert_targetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 914, PostgreSQLParserRULE_insert_target) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8194) + p.Qualified_name() + } + p.SetState(8197) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(8195) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8196) + p.Colid() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IInsert_restContext is an interface to support dynamic dispatch. +type IInsert_restContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Selectstmt() ISelectstmtContext + OVERRIDING() antlr.TerminalNode + Override_kind() IOverride_kindContext + VALUE_P() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Insert_column_list() IInsert_column_listContext + CLOSE_PAREN() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + VALUES() antlr.TerminalNode + + // IsInsert_restContext differentiates from other interfaces. + IsInsert_restContext() +} + +type Insert_restContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInsert_restContext() *Insert_restContext { + var p = new(Insert_restContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insert_rest + return p +} + +func InitEmptyInsert_restContext(p *Insert_restContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insert_rest +} + +func (*Insert_restContext) IsInsert_restContext() {} + +func NewInsert_restContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Insert_restContext { + var p = new(Insert_restContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_insert_rest + + return p +} + +func (s *Insert_restContext) GetParser() antlr.Parser { return s.parser } + +func (s *Insert_restContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *Insert_restContext) OVERRIDING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOVERRIDING, 0) +} + +func (s *Insert_restContext) Override_kind() IOverride_kindContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOverride_kindContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOverride_kindContext) +} + +func (s *Insert_restContext) VALUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUE_P, 0) +} + +func (s *Insert_restContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Insert_restContext) Insert_column_list() IInsert_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsert_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInsert_column_listContext) +} + +func (s *Insert_restContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Insert_restContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Insert_restContext) VALUES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUES, 0) +} + +func (s *Insert_restContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Insert_restContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Insert_restContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterInsert_rest(s) + } +} + +func (s *Insert_restContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitInsert_rest(s) + } +} + +func (s *Insert_restContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitInsert_rest(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Insert_rest() (localctx IInsert_restContext) { + localctx = NewInsert_restContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 916, PostgreSQLParserRULE_insert_rest) + var _la int + + p.SetState(8218) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 684, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8199) + p.Selectstmt() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8200) + p.Match(PostgreSQLParserOVERRIDING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8201) + p.Override_kind() + } + { + p.SetState(8202) + p.Match(PostgreSQLParserVALUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8203) + p.Selectstmt() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8205) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8206) + p.Insert_column_list() + } + { + p.SetState(8207) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8212) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOVERRIDING { + { + p.SetState(8208) + p.Match(PostgreSQLParserOVERRIDING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8209) + p.Override_kind() + } + { + p.SetState(8210) + p.Match(PostgreSQLParserVALUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8214) + p.Selectstmt() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8216) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8217) + p.Match(PostgreSQLParserVALUES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOverride_kindContext is an interface to support dynamic dispatch. +type IOverride_kindContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USER() antlr.TerminalNode + SYSTEM_P() antlr.TerminalNode + + // IsOverride_kindContext differentiates from other interfaces. + IsOverride_kindContext() +} + +type Override_kindContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOverride_kindContext() *Override_kindContext { + var p = new(Override_kindContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_override_kind + return p +} + +func InitEmptyOverride_kindContext(p *Override_kindContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_override_kind +} + +func (*Override_kindContext) IsOverride_kindContext() {} + +func NewOverride_kindContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Override_kindContext { + var p = new(Override_kindContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_override_kind + + return p +} + +func (s *Override_kindContext) GetParser() antlr.Parser { return s.parser } + +func (s *Override_kindContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *Override_kindContext) SYSTEM_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYSTEM_P, 0) +} + +func (s *Override_kindContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Override_kindContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Override_kindContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOverride_kind(s) + } +} + +func (s *Override_kindContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOverride_kind(s) + } +} + +func (s *Override_kindContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOverride_kind(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Override_kind() (localctx IOverride_kindContext) { + localctx = NewOverride_kindContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 918, PostgreSQLParserRULE_override_kind) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8220) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserUSER || _la == PostgreSQLParserSYSTEM_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IInsert_column_listContext is an interface to support dynamic dispatch. +type IInsert_column_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllInsert_column_item() []IInsert_column_itemContext + Insert_column_item(i int) IInsert_column_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsInsert_column_listContext differentiates from other interfaces. + IsInsert_column_listContext() +} + +type Insert_column_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInsert_column_listContext() *Insert_column_listContext { + var p = new(Insert_column_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insert_column_list + return p +} + +func InitEmptyInsert_column_listContext(p *Insert_column_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insert_column_list +} + +func (*Insert_column_listContext) IsInsert_column_listContext() {} + +func NewInsert_column_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Insert_column_listContext { + var p = new(Insert_column_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_insert_column_list + + return p +} + +func (s *Insert_column_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Insert_column_listContext) AllInsert_column_item() []IInsert_column_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IInsert_column_itemContext); ok { + len++ + } + } + + tst := make([]IInsert_column_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IInsert_column_itemContext); ok { + tst[i] = t.(IInsert_column_itemContext) + i++ + } + } + + return tst +} + +func (s *Insert_column_listContext) Insert_column_item(i int) IInsert_column_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsert_column_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IInsert_column_itemContext) +} + +func (s *Insert_column_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Insert_column_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Insert_column_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Insert_column_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Insert_column_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterInsert_column_list(s) + } +} + +func (s *Insert_column_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitInsert_column_list(s) + } +} + +func (s *Insert_column_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitInsert_column_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Insert_column_list() (localctx IInsert_column_listContext) { + localctx = NewInsert_column_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 920, PostgreSQLParserRULE_insert_column_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8222) + p.Insert_column_item() + } + p.SetState(8227) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8223) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8224) + p.Insert_column_item() + } + + p.SetState(8229) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IInsert_column_itemContext is an interface to support dynamic dispatch. +type IInsert_column_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Opt_indirection() IOpt_indirectionContext + + // IsInsert_column_itemContext differentiates from other interfaces. + IsInsert_column_itemContext() +} + +type Insert_column_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInsert_column_itemContext() *Insert_column_itemContext { + var p = new(Insert_column_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insert_column_item + return p +} + +func InitEmptyInsert_column_itemContext(p *Insert_column_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_insert_column_item +} + +func (*Insert_column_itemContext) IsInsert_column_itemContext() {} + +func NewInsert_column_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Insert_column_itemContext { + var p = new(Insert_column_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_insert_column_item + + return p +} + +func (s *Insert_column_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Insert_column_itemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Insert_column_itemContext) Opt_indirection() IOpt_indirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_indirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_indirectionContext) +} + +func (s *Insert_column_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Insert_column_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Insert_column_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterInsert_column_item(s) + } +} + +func (s *Insert_column_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitInsert_column_item(s) + } +} + +func (s *Insert_column_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitInsert_column_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Insert_column_item() (localctx IInsert_column_itemContext) { + localctx = NewInsert_column_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 922, PostgreSQLParserRULE_insert_column_item) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8230) + p.Colid() + } + { + p.SetState(8231) + p.Opt_indirection() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_on_conflictContext is an interface to support dynamic dispatch. +type IOpt_on_conflictContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ON() antlr.TerminalNode + CONFLICT() antlr.TerminalNode + DO() antlr.TerminalNode + UPDATE() antlr.TerminalNode + SET() antlr.TerminalNode + Set_clause_list() ISet_clause_listContext + NOTHING() antlr.TerminalNode + Opt_conf_expr() IOpt_conf_exprContext + Where_clause() IWhere_clauseContext + + // IsOpt_on_conflictContext differentiates from other interfaces. + IsOpt_on_conflictContext() +} + +type Opt_on_conflictContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_on_conflictContext() *Opt_on_conflictContext { + var p = new(Opt_on_conflictContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_on_conflict + return p +} + +func InitEmptyOpt_on_conflictContext(p *Opt_on_conflictContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_on_conflict +} + +func (*Opt_on_conflictContext) IsOpt_on_conflictContext() {} + +func NewOpt_on_conflictContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_on_conflictContext { + var p = new(Opt_on_conflictContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_on_conflict + + return p +} + +func (s *Opt_on_conflictContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_on_conflictContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Opt_on_conflictContext) CONFLICT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFLICT, 0) +} + +func (s *Opt_on_conflictContext) DO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDO, 0) +} + +func (s *Opt_on_conflictContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *Opt_on_conflictContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Opt_on_conflictContext) Set_clause_list() ISet_clause_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_clause_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_clause_listContext) +} + +func (s *Opt_on_conflictContext) NOTHING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTHING, 0) +} + +func (s *Opt_on_conflictContext) Opt_conf_expr() IOpt_conf_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_conf_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_conf_exprContext) +} + +func (s *Opt_on_conflictContext) Where_clause() IWhere_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_clauseContext) +} + +func (s *Opt_on_conflictContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_on_conflictContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_on_conflictContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_on_conflict(s) + } +} + +func (s *Opt_on_conflictContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_on_conflict(s) + } +} + +func (s *Opt_on_conflictContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_on_conflict(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_on_conflict() (localctx IOpt_on_conflictContext) { + localctx = NewOpt_on_conflictContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 924, PostgreSQLParserRULE_opt_on_conflict) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8233) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8234) + p.Match(PostgreSQLParserCONFLICT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8236) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN || _la == PostgreSQLParserON { + { + p.SetState(8235) + p.Opt_conf_expr() + } + + } + { + p.SetState(8238) + p.Match(PostgreSQLParserDO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8246) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserUPDATE: + { + p.SetState(8239) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8240) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8241) + p.Set_clause_list() + } + p.SetState(8243) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(8242) + p.Where_clause() + } + + } + + case PostgreSQLParserNOTHING: + { + p.SetState(8245) + p.Match(PostgreSQLParserNOTHING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_conf_exprContext is an interface to support dynamic dispatch. +type IOpt_conf_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Index_params() IIndex_paramsContext + CLOSE_PAREN() antlr.TerminalNode + Where_clause() IWhere_clauseContext + ON() antlr.TerminalNode + CONSTRAINT() antlr.TerminalNode + Name() INameContext + + // IsOpt_conf_exprContext differentiates from other interfaces. + IsOpt_conf_exprContext() +} + +type Opt_conf_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_conf_exprContext() *Opt_conf_exprContext { + var p = new(Opt_conf_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_conf_expr + return p +} + +func InitEmptyOpt_conf_exprContext(p *Opt_conf_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_conf_expr +} + +func (*Opt_conf_exprContext) IsOpt_conf_exprContext() {} + +func NewOpt_conf_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_conf_exprContext { + var p = new(Opt_conf_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_conf_expr + + return p +} + +func (s *Opt_conf_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_conf_exprContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_conf_exprContext) Index_params() IIndex_paramsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndex_paramsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndex_paramsContext) +} + +func (s *Opt_conf_exprContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_conf_exprContext) Where_clause() IWhere_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_clauseContext) +} + +func (s *Opt_conf_exprContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Opt_conf_exprContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *Opt_conf_exprContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Opt_conf_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_conf_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_conf_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_conf_expr(s) + } +} + +func (s *Opt_conf_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_conf_expr(s) + } +} + +func (s *Opt_conf_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_conf_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_conf_expr() (localctx IOpt_conf_exprContext) { + localctx = NewOpt_conf_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 926, PostgreSQLParserRULE_opt_conf_expr) + var _la int + + p.SetState(8257) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8248) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8249) + p.Index_params() + } + { + p.SetState(8250) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8252) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(8251) + p.Where_clause() + } + + } + + case PostgreSQLParserON: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8254) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8255) + p.Match(PostgreSQLParserCONSTRAINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8256) + p.Name() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReturning_clauseContext is an interface to support dynamic dispatch. +type IReturning_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RETURNING() antlr.TerminalNode + Target_list() ITarget_listContext + + // IsReturning_clauseContext differentiates from other interfaces. + IsReturning_clauseContext() +} + +type Returning_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReturning_clauseContext() *Returning_clauseContext { + var p = new(Returning_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_returning_clause + return p +} + +func InitEmptyReturning_clauseContext(p *Returning_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_returning_clause +} + +func (*Returning_clauseContext) IsReturning_clauseContext() {} + +func NewReturning_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Returning_clauseContext { + var p = new(Returning_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_returning_clause + + return p +} + +func (s *Returning_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Returning_clauseContext) RETURNING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRETURNING, 0) +} + +func (s *Returning_clauseContext) Target_list() ITarget_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITarget_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITarget_listContext) +} + +func (s *Returning_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Returning_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Returning_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReturning_clause(s) + } +} + +func (s *Returning_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReturning_clause(s) + } +} + +func (s *Returning_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReturning_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Returning_clause() (localctx IReturning_clauseContext) { + localctx = NewReturning_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 928, PostgreSQLParserRULE_returning_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8259) + p.Match(PostgreSQLParserRETURNING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8260) + p.Target_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IMergestmtContext is an interface to support dynamic dispatch. +type IMergestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + MERGE() antlr.TerminalNode + INTO() antlr.TerminalNode + AllQualified_name() []IQualified_nameContext + Qualified_name(i int) IQualified_nameContext + USING() antlr.TerminalNode + ON() antlr.TerminalNode + A_expr() IA_exprContext + Select_with_parens() ISelect_with_parensContext + Merge_insert_clause() IMerge_insert_clauseContext + Merge_update_clause() IMerge_update_clauseContext + With_clause() IWith_clauseContext + ONLY() antlr.TerminalNode + AllAlias_clause() []IAlias_clauseContext + Alias_clause(i int) IAlias_clauseContext + Merge_delete_clause() IMerge_delete_clauseContext + + // IsMergestmtContext differentiates from other interfaces. + IsMergestmtContext() +} + +type MergestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyMergestmtContext() *MergestmtContext { + var p = new(MergestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_mergestmt + return p +} + +func InitEmptyMergestmtContext(p *MergestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_mergestmt +} + +func (*MergestmtContext) IsMergestmtContext() {} + +func NewMergestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MergestmtContext { + var p = new(MergestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_mergestmt + + return p +} + +func (s *MergestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *MergestmtContext) MERGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMERGE, 0) +} + +func (s *MergestmtContext) INTO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTO, 0) +} + +func (s *MergestmtContext) AllQualified_name() []IQualified_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IQualified_nameContext); ok { + len++ + } + } + + tst := make([]IQualified_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IQualified_nameContext); ok { + tst[i] = t.(IQualified_nameContext) + i++ + } + } + + return tst +} + +func (s *MergestmtContext) Qualified_name(i int) IQualified_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *MergestmtContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *MergestmtContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *MergestmtContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *MergestmtContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *MergestmtContext) Merge_insert_clause() IMerge_insert_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IMerge_insert_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IMerge_insert_clauseContext) +} + +func (s *MergestmtContext) Merge_update_clause() IMerge_update_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IMerge_update_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IMerge_update_clauseContext) +} + +func (s *MergestmtContext) With_clause() IWith_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWith_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWith_clauseContext) +} + +func (s *MergestmtContext) ONLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserONLY, 0) +} + +func (s *MergestmtContext) AllAlias_clause() []IAlias_clauseContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAlias_clauseContext); ok { + len++ + } + } + + tst := make([]IAlias_clauseContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAlias_clauseContext); ok { + tst[i] = t.(IAlias_clauseContext) + i++ + } + } + + return tst +} + +func (s *MergestmtContext) Alias_clause(i int) IAlias_clauseContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlias_clauseContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAlias_clauseContext) +} + +func (s *MergestmtContext) Merge_delete_clause() IMerge_delete_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IMerge_delete_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IMerge_delete_clauseContext) +} + +func (s *MergestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *MergestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *MergestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterMergestmt(s) + } +} + +func (s *MergestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitMergestmt(s) + } +} + +func (s *MergestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitMergestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Mergestmt() (localctx IMergestmtContext) { + localctx = NewMergestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 930, PostgreSQLParserRULE_mergestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8263) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(8262) + p.With_clause() + } + + } + { + p.SetState(8265) + p.Match(PostgreSQLParserMERGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8266) + p.Match(PostgreSQLParserINTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8268) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserONLY { + { + p.SetState(8267) + p.Match(PostgreSQLParserONLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8270) + p.Qualified_name() + } + p.SetState(8272) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691917) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(8271) + p.Alias_clause() + } + + } + { + p.SetState(8274) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8277) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(8275) + p.Select_with_parens() + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(8276) + p.Qualified_name() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.SetState(8280) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691917) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(8279) + p.Alias_clause() + } + + } + { + p.SetState(8282) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8283) + p.A_expr() + } + p.SetState(8292) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 698, p.GetParserRuleContext()) { + case 1: + { + p.SetState(8284) + p.Merge_insert_clause() + } + p.SetState(8286) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 696, p.GetParserRuleContext()) == 1 { + { + p.SetState(8285) + p.Merge_update_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + { + p.SetState(8288) + p.Merge_update_clause() + } + p.SetState(8290) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 697, p.GetParserRuleContext()) == 1 { + { + p.SetState(8289) + p.Merge_insert_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + p.SetState(8295) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHEN { + { + p.SetState(8294) + p.Merge_delete_clause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IMerge_insert_clauseContext is an interface to support dynamic dispatch. +type IMerge_insert_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHEN() antlr.TerminalNode + NOT() antlr.TerminalNode + MATCHED() antlr.TerminalNode + INSERT() antlr.TerminalNode + Values_clause() IValues_clauseContext + AND() antlr.TerminalNode + A_expr() IA_exprContext + THEN() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Insert_column_list() IInsert_column_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsMerge_insert_clauseContext differentiates from other interfaces. + IsMerge_insert_clauseContext() +} + +type Merge_insert_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyMerge_insert_clauseContext() *Merge_insert_clauseContext { + var p = new(Merge_insert_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_merge_insert_clause + return p +} + +func InitEmptyMerge_insert_clauseContext(p *Merge_insert_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_merge_insert_clause +} + +func (*Merge_insert_clauseContext) IsMerge_insert_clauseContext() {} + +func NewMerge_insert_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Merge_insert_clauseContext { + var p = new(Merge_insert_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_merge_insert_clause + + return p +} + +func (s *Merge_insert_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Merge_insert_clauseContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *Merge_insert_clauseContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Merge_insert_clauseContext) MATCHED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATCHED, 0) +} + +func (s *Merge_insert_clauseContext) INSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSERT, 0) +} + +func (s *Merge_insert_clauseContext) Values_clause() IValues_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IValues_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IValues_clauseContext) +} + +func (s *Merge_insert_clauseContext) AND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, 0) +} + +func (s *Merge_insert_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Merge_insert_clauseContext) THEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, 0) +} + +func (s *Merge_insert_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Merge_insert_clauseContext) Insert_column_list() IInsert_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInsert_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInsert_column_listContext) +} + +func (s *Merge_insert_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Merge_insert_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Merge_insert_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Merge_insert_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterMerge_insert_clause(s) + } +} + +func (s *Merge_insert_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitMerge_insert_clause(s) + } +} + +func (s *Merge_insert_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitMerge_insert_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Merge_insert_clause() (localctx IMerge_insert_clauseContext) { + localctx = NewMerge_insert_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 932, PostgreSQLParserRULE_merge_insert_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8297) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8298) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8299) + p.Match(PostgreSQLParserMATCHED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8302) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAND { + { + p.SetState(8300) + p.Match(PostgreSQLParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8301) + p.A_expr() + } + + } + p.SetState(8305) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTHEN { + { + p.SetState(8304) + p.Match(PostgreSQLParserTHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8307) + p.Match(PostgreSQLParserINSERT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8312) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(8308) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8309) + p.Insert_column_list() + } + { + p.SetState(8310) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8314) + p.Values_clause() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IMerge_update_clauseContext is an interface to support dynamic dispatch. +type IMerge_update_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHEN() antlr.TerminalNode + MATCHED() antlr.TerminalNode + UPDATE() antlr.TerminalNode + SET() antlr.TerminalNode + Set_clause_list() ISet_clause_listContext + AND() antlr.TerminalNode + A_expr() IA_exprContext + THEN() antlr.TerminalNode + + // IsMerge_update_clauseContext differentiates from other interfaces. + IsMerge_update_clauseContext() +} + +type Merge_update_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyMerge_update_clauseContext() *Merge_update_clauseContext { + var p = new(Merge_update_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_merge_update_clause + return p +} + +func InitEmptyMerge_update_clauseContext(p *Merge_update_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_merge_update_clause +} + +func (*Merge_update_clauseContext) IsMerge_update_clauseContext() {} + +func NewMerge_update_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Merge_update_clauseContext { + var p = new(Merge_update_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_merge_update_clause + + return p +} + +func (s *Merge_update_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Merge_update_clauseContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *Merge_update_clauseContext) MATCHED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATCHED, 0) +} + +func (s *Merge_update_clauseContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *Merge_update_clauseContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Merge_update_clauseContext) Set_clause_list() ISet_clause_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_clause_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_clause_listContext) +} + +func (s *Merge_update_clauseContext) AND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, 0) +} + +func (s *Merge_update_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Merge_update_clauseContext) THEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, 0) +} + +func (s *Merge_update_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Merge_update_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Merge_update_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterMerge_update_clause(s) + } +} + +func (s *Merge_update_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitMerge_update_clause(s) + } +} + +func (s *Merge_update_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitMerge_update_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Merge_update_clause() (localctx IMerge_update_clauseContext) { + localctx = NewMerge_update_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 934, PostgreSQLParserRULE_merge_update_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8316) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8317) + p.Match(PostgreSQLParserMATCHED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8320) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAND { + { + p.SetState(8318) + p.Match(PostgreSQLParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8319) + p.A_expr() + } + + } + p.SetState(8323) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTHEN { + { + p.SetState(8322) + p.Match(PostgreSQLParserTHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8325) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8326) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8327) + p.Set_clause_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IMerge_delete_clauseContext is an interface to support dynamic dispatch. +type IMerge_delete_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHEN() antlr.TerminalNode + MATCHED() antlr.TerminalNode + DELETE_P() antlr.TerminalNode + THEN() antlr.TerminalNode + + // IsMerge_delete_clauseContext differentiates from other interfaces. + IsMerge_delete_clauseContext() +} + +type Merge_delete_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyMerge_delete_clauseContext() *Merge_delete_clauseContext { + var p = new(Merge_delete_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_merge_delete_clause + return p +} + +func InitEmptyMerge_delete_clauseContext(p *Merge_delete_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_merge_delete_clause +} + +func (*Merge_delete_clauseContext) IsMerge_delete_clauseContext() {} + +func NewMerge_delete_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Merge_delete_clauseContext { + var p = new(Merge_delete_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_merge_delete_clause + + return p +} + +func (s *Merge_delete_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Merge_delete_clauseContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *Merge_delete_clauseContext) MATCHED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATCHED, 0) +} + +func (s *Merge_delete_clauseContext) DELETE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELETE_P, 0) +} + +func (s *Merge_delete_clauseContext) THEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, 0) +} + +func (s *Merge_delete_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Merge_delete_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Merge_delete_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterMerge_delete_clause(s) + } +} + +func (s *Merge_delete_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitMerge_delete_clause(s) + } +} + +func (s *Merge_delete_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitMerge_delete_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Merge_delete_clause() (localctx IMerge_delete_clauseContext) { + localctx = NewMerge_delete_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 936, PostgreSQLParserRULE_merge_delete_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8329) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8330) + p.Match(PostgreSQLParserMATCHED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8332) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTHEN { + { + p.SetState(8331) + p.Match(PostgreSQLParserTHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8334) + p.Match(PostgreSQLParserDELETE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDeletestmtContext is an interface to support dynamic dispatch. +type IDeletestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DELETE_P() antlr.TerminalNode + FROM() antlr.TerminalNode + Relation_expr_opt_alias() IRelation_expr_opt_aliasContext + Opt_with_clause() IOpt_with_clauseContext + Using_clause() IUsing_clauseContext + Where_or_current_clause() IWhere_or_current_clauseContext + Returning_clause() IReturning_clauseContext + + // IsDeletestmtContext differentiates from other interfaces. + IsDeletestmtContext() +} + +type DeletestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDeletestmtContext() *DeletestmtContext { + var p = new(DeletestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_deletestmt + return p +} + +func InitEmptyDeletestmtContext(p *DeletestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_deletestmt +} + +func (*DeletestmtContext) IsDeletestmtContext() {} + +func NewDeletestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DeletestmtContext { + var p = new(DeletestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_deletestmt + + return p +} + +func (s *DeletestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DeletestmtContext) DELETE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELETE_P, 0) +} + +func (s *DeletestmtContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *DeletestmtContext) Relation_expr_opt_alias() IRelation_expr_opt_aliasContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_expr_opt_aliasContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_expr_opt_aliasContext) +} + +func (s *DeletestmtContext) Opt_with_clause() IOpt_with_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_with_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_with_clauseContext) +} + +func (s *DeletestmtContext) Using_clause() IUsing_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUsing_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUsing_clauseContext) +} + +func (s *DeletestmtContext) Where_or_current_clause() IWhere_or_current_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_or_current_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_or_current_clauseContext) +} + +func (s *DeletestmtContext) Returning_clause() IReturning_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReturning_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReturning_clauseContext) +} + +func (s *DeletestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DeletestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DeletestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDeletestmt(s) + } +} + +func (s *DeletestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDeletestmt(s) + } +} + +func (s *DeletestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDeletestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Deletestmt() (localctx IDeletestmtContext) { + localctx = NewDeletestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 938, PostgreSQLParserRULE_deletestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8337) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(8336) + p.Opt_with_clause() + } + + } + { + p.SetState(8339) + p.Match(PostgreSQLParserDELETE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8340) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8341) + p.Relation_expr_opt_alias() + } + p.SetState(8343) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(8342) + p.Using_clause() + } + + } + p.SetState(8346) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(8345) + p.Where_or_current_clause() + } + + } + p.SetState(8349) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserRETURNING { + { + p.SetState(8348) + p.Returning_clause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IUsing_clauseContext is an interface to support dynamic dispatch. +type IUsing_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + From_list() IFrom_listContext + + // IsUsing_clauseContext differentiates from other interfaces. + IsUsing_clauseContext() +} + +type Using_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyUsing_clauseContext() *Using_clauseContext { + var p = new(Using_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_using_clause + return p +} + +func InitEmptyUsing_clauseContext(p *Using_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_using_clause +} + +func (*Using_clauseContext) IsUsing_clauseContext() {} + +func NewUsing_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Using_clauseContext { + var p = new(Using_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_using_clause + + return p +} + +func (s *Using_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Using_clauseContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Using_clauseContext) From_list() IFrom_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_listContext) +} + +func (s *Using_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Using_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Using_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterUsing_clause(s) + } +} + +func (s *Using_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitUsing_clause(s) + } +} + +func (s *Using_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitUsing_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Using_clause() (localctx IUsing_clauseContext) { + localctx = NewUsing_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 940, PostgreSQLParserRULE_using_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8351) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8352) + p.From_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILockstmtContext is an interface to support dynamic dispatch. +type ILockstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LOCK_P() antlr.TerminalNode + Relation_expr_list() IRelation_expr_listContext + Opt_table() IOpt_tableContext + Opt_lock() IOpt_lockContext + Opt_nowait() IOpt_nowaitContext + + // IsLockstmtContext differentiates from other interfaces. + IsLockstmtContext() +} + +type LockstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLockstmtContext() *LockstmtContext { + var p = new(LockstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_lockstmt + return p +} + +func InitEmptyLockstmtContext(p *LockstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_lockstmt +} + +func (*LockstmtContext) IsLockstmtContext() {} + +func NewLockstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LockstmtContext { + var p = new(LockstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_lockstmt + + return p +} + +func (s *LockstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *LockstmtContext) LOCK_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCK_P, 0) +} + +func (s *LockstmtContext) Relation_expr_list() IRelation_expr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_expr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_expr_listContext) +} + +func (s *LockstmtContext) Opt_table() IOpt_tableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_tableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_tableContext) +} + +func (s *LockstmtContext) Opt_lock() IOpt_lockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_lockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_lockContext) +} + +func (s *LockstmtContext) Opt_nowait() IOpt_nowaitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_nowaitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_nowaitContext) +} + +func (s *LockstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *LockstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *LockstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterLockstmt(s) + } +} + +func (s *LockstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitLockstmt(s) + } +} + +func (s *LockstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitLockstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Lockstmt() (localctx ILockstmtContext) { + localctx = NewLockstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 942, PostgreSQLParserRULE_lockstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8354) + p.Match(PostgreSQLParserLOCK_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8356) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 710, p.GetParserRuleContext()) == 1 { + { + p.SetState(8355) + p.Opt_table() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(8358) + p.Relation_expr_list() + } + p.SetState(8360) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserIN_P { + { + p.SetState(8359) + p.Opt_lock() + } + + } + p.SetState(8363) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOWAIT { + { + p.SetState(8362) + p.Opt_nowait() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_lockContext is an interface to support dynamic dispatch. +type IOpt_lockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IN_P() antlr.TerminalNode + Lock_type() ILock_typeContext + MODE() antlr.TerminalNode + + // IsOpt_lockContext differentiates from other interfaces. + IsOpt_lockContext() +} + +type Opt_lockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_lockContext() *Opt_lockContext { + var p = new(Opt_lockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_lock + return p +} + +func InitEmptyOpt_lockContext(p *Opt_lockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_lock +} + +func (*Opt_lockContext) IsOpt_lockContext() {} + +func NewOpt_lockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_lockContext { + var p = new(Opt_lockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_lock + + return p +} + +func (s *Opt_lockContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_lockContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Opt_lockContext) Lock_type() ILock_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILock_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILock_typeContext) +} + +func (s *Opt_lockContext) MODE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMODE, 0) +} + +func (s *Opt_lockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_lockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_lockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_lock(s) + } +} + +func (s *Opt_lockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_lock(s) + } +} + +func (s *Opt_lockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_lock(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_lock() (localctx IOpt_lockContext) { + localctx = NewOpt_lockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 944, PostgreSQLParserRULE_opt_lock) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8365) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8366) + p.Lock_type() + } + { + p.SetState(8367) + p.Match(PostgreSQLParserMODE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILock_typeContext is an interface to support dynamic dispatch. +type ILock_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ACCESS() antlr.TerminalNode + SHARE() antlr.TerminalNode + EXCLUSIVE() antlr.TerminalNode + ROW() antlr.TerminalNode + UPDATE() antlr.TerminalNode + + // IsLock_typeContext differentiates from other interfaces. + IsLock_typeContext() +} + +type Lock_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLock_typeContext() *Lock_typeContext { + var p = new(Lock_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_lock_type + return p +} + +func InitEmptyLock_typeContext(p *Lock_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_lock_type +} + +func (*Lock_typeContext) IsLock_typeContext() {} + +func NewLock_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Lock_typeContext { + var p = new(Lock_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_lock_type + + return p +} + +func (s *Lock_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Lock_typeContext) ACCESS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACCESS, 0) +} + +func (s *Lock_typeContext) SHARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSHARE, 0) +} + +func (s *Lock_typeContext) EXCLUSIVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCLUSIVE, 0) +} + +func (s *Lock_typeContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *Lock_typeContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *Lock_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Lock_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Lock_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterLock_type(s) + } +} + +func (s *Lock_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitLock_type(s) + } +} + +func (s *Lock_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitLock_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Lock_type() (localctx ILock_typeContext) { + localctx = NewLock_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 946, PostgreSQLParserRULE_lock_type) + var _la int + + p.SetState(8381) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserACCESS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8369) + p.Match(PostgreSQLParserACCESS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8370) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserEXCLUSIVE || _la == PostgreSQLParserSHARE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case PostgreSQLParserROW: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8371) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8372) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserEXCLUSIVE || _la == PostgreSQLParserSHARE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case PostgreSQLParserSHARE: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8373) + p.Match(PostgreSQLParserSHARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8378) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserUPDATE: + { + p.SetState(8374) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8375) + p.Match(PostgreSQLParserEXCLUSIVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserROW: + { + p.SetState(8376) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8377) + p.Match(PostgreSQLParserEXCLUSIVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserMODE: + + default: + } + + case PostgreSQLParserEXCLUSIVE: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8380) + p.Match(PostgreSQLParserEXCLUSIVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_nowaitContext is an interface to support dynamic dispatch. +type IOpt_nowaitContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOWAIT() antlr.TerminalNode + + // IsOpt_nowaitContext differentiates from other interfaces. + IsOpt_nowaitContext() +} + +type Opt_nowaitContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_nowaitContext() *Opt_nowaitContext { + var p = new(Opt_nowaitContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_nowait + return p +} + +func InitEmptyOpt_nowaitContext(p *Opt_nowaitContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_nowait +} + +func (*Opt_nowaitContext) IsOpt_nowaitContext() {} + +func NewOpt_nowaitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_nowaitContext { + var p = new(Opt_nowaitContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_nowait + + return p +} + +func (s *Opt_nowaitContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_nowaitContext) NOWAIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOWAIT, 0) +} + +func (s *Opt_nowaitContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_nowaitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_nowaitContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_nowait(s) + } +} + +func (s *Opt_nowaitContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_nowait(s) + } +} + +func (s *Opt_nowaitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_nowait(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_nowait() (localctx IOpt_nowaitContext) { + localctx = NewOpt_nowaitContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 948, PostgreSQLParserRULE_opt_nowait) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8383) + p.Match(PostgreSQLParserNOWAIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_nowait_or_skipContext is an interface to support dynamic dispatch. +type IOpt_nowait_or_skipContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOWAIT() antlr.TerminalNode + SKIP_P() antlr.TerminalNode + LOCKED() antlr.TerminalNode + + // IsOpt_nowait_or_skipContext differentiates from other interfaces. + IsOpt_nowait_or_skipContext() +} + +type Opt_nowait_or_skipContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_nowait_or_skipContext() *Opt_nowait_or_skipContext { + var p = new(Opt_nowait_or_skipContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_nowait_or_skip + return p +} + +func InitEmptyOpt_nowait_or_skipContext(p *Opt_nowait_or_skipContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_nowait_or_skip +} + +func (*Opt_nowait_or_skipContext) IsOpt_nowait_or_skipContext() {} + +func NewOpt_nowait_or_skipContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_nowait_or_skipContext { + var p = new(Opt_nowait_or_skipContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_nowait_or_skip + + return p +} + +func (s *Opt_nowait_or_skipContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_nowait_or_skipContext) NOWAIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOWAIT, 0) +} + +func (s *Opt_nowait_or_skipContext) SKIP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSKIP_P, 0) +} + +func (s *Opt_nowait_or_skipContext) LOCKED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCKED, 0) +} + +func (s *Opt_nowait_or_skipContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_nowait_or_skipContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_nowait_or_skipContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_nowait_or_skip(s) + } +} + +func (s *Opt_nowait_or_skipContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_nowait_or_skip(s) + } +} + +func (s *Opt_nowait_or_skipContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_nowait_or_skip(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_nowait_or_skip() (localctx IOpt_nowait_or_skipContext) { + localctx = NewOpt_nowait_or_skipContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 950, PostgreSQLParserRULE_opt_nowait_or_skip) + p.SetState(8388) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNOWAIT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8385) + p.Match(PostgreSQLParserNOWAIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSKIP_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8386) + p.Match(PostgreSQLParserSKIP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8387) + p.Match(PostgreSQLParserLOCKED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IUpdatestmtContext is an interface to support dynamic dispatch. +type IUpdatestmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + UPDATE() antlr.TerminalNode + Relation_expr_opt_alias() IRelation_expr_opt_aliasContext + SET() antlr.TerminalNode + Set_clause_list() ISet_clause_listContext + Opt_with_clause() IOpt_with_clauseContext + From_clause() IFrom_clauseContext + Where_or_current_clause() IWhere_or_current_clauseContext + Returning_clause() IReturning_clauseContext + + // IsUpdatestmtContext differentiates from other interfaces. + IsUpdatestmtContext() +} + +type UpdatestmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyUpdatestmtContext() *UpdatestmtContext { + var p = new(UpdatestmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_updatestmt + return p +} + +func InitEmptyUpdatestmtContext(p *UpdatestmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_updatestmt +} + +func (*UpdatestmtContext) IsUpdatestmtContext() {} + +func NewUpdatestmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *UpdatestmtContext { + var p = new(UpdatestmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_updatestmt + + return p +} + +func (s *UpdatestmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *UpdatestmtContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *UpdatestmtContext) Relation_expr_opt_alias() IRelation_expr_opt_aliasContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_expr_opt_aliasContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_expr_opt_aliasContext) +} + +func (s *UpdatestmtContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *UpdatestmtContext) Set_clause_list() ISet_clause_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_clause_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_clause_listContext) +} + +func (s *UpdatestmtContext) Opt_with_clause() IOpt_with_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_with_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_with_clauseContext) +} + +func (s *UpdatestmtContext) From_clause() IFrom_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_clauseContext) +} + +func (s *UpdatestmtContext) Where_or_current_clause() IWhere_or_current_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_or_current_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_or_current_clauseContext) +} + +func (s *UpdatestmtContext) Returning_clause() IReturning_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReturning_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReturning_clauseContext) +} + +func (s *UpdatestmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *UpdatestmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *UpdatestmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterUpdatestmt(s) + } +} + +func (s *UpdatestmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitUpdatestmt(s) + } +} + +func (s *UpdatestmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitUpdatestmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Updatestmt() (localctx IUpdatestmtContext) { + localctx = NewUpdatestmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 952, PostgreSQLParserRULE_updatestmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8391) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH { + { + p.SetState(8390) + p.Opt_with_clause() + } + + } + { + p.SetState(8393) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8394) + p.Relation_expr_opt_alias() + } + { + p.SetState(8395) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8396) + p.Set_clause_list() + } + p.SetState(8398) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM { + { + p.SetState(8397) + p.From_clause() + } + + } + p.SetState(8401) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(8400) + p.Where_or_current_clause() + } + + } + p.SetState(8404) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserRETURNING { + { + p.SetState(8403) + p.Returning_clause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISet_clause_listContext is an interface to support dynamic dispatch. +type ISet_clause_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSet_clause() []ISet_clauseContext + Set_clause(i int) ISet_clauseContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsSet_clause_listContext differentiates from other interfaces. + IsSet_clause_listContext() +} + +type Set_clause_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySet_clause_listContext() *Set_clause_listContext { + var p = new(Set_clause_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_clause_list + return p +} + +func InitEmptySet_clause_listContext(p *Set_clause_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_clause_list +} + +func (*Set_clause_listContext) IsSet_clause_listContext() {} + +func NewSet_clause_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Set_clause_listContext { + var p = new(Set_clause_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_set_clause_list + + return p +} + +func (s *Set_clause_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Set_clause_listContext) AllSet_clause() []ISet_clauseContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISet_clauseContext); ok { + len++ + } + } + + tst := make([]ISet_clauseContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISet_clauseContext); ok { + tst[i] = t.(ISet_clauseContext) + i++ + } + } + + return tst +} + +func (s *Set_clause_listContext) Set_clause(i int) ISet_clauseContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_clauseContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISet_clauseContext) +} + +func (s *Set_clause_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Set_clause_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Set_clause_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Set_clause_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Set_clause_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSet_clause_list(s) + } +} + +func (s *Set_clause_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSet_clause_list(s) + } +} + +func (s *Set_clause_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSet_clause_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Set_clause_list() (localctx ISet_clause_listContext) { + localctx = NewSet_clause_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 954, PostgreSQLParserRULE_set_clause_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8406) + p.Set_clause() + } + p.SetState(8411) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8407) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8408) + p.Set_clause() + } + + p.SetState(8413) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISet_clauseContext is an interface to support dynamic dispatch. +type ISet_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Set_target() ISet_targetContext + EQUAL() antlr.TerminalNode + A_expr() IA_exprContext + OPEN_PAREN() antlr.TerminalNode + Set_target_list() ISet_target_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsSet_clauseContext differentiates from other interfaces. + IsSet_clauseContext() +} + +type Set_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySet_clauseContext() *Set_clauseContext { + var p = new(Set_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_clause + return p +} + +func InitEmptySet_clauseContext(p *Set_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_clause +} + +func (*Set_clauseContext) IsSet_clauseContext() {} + +func NewSet_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Set_clauseContext { + var p = new(Set_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_set_clause + + return p +} + +func (s *Set_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Set_clauseContext) Set_target() ISet_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_targetContext) +} + +func (s *Set_clauseContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Set_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Set_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Set_clauseContext) Set_target_list() ISet_target_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_target_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISet_target_listContext) +} + +func (s *Set_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Set_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Set_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Set_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSet_clause(s) + } +} + +func (s *Set_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSet_clause(s) + } +} + +func (s *Set_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSet_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Set_clause() (localctx ISet_clauseContext) { + localctx = NewSet_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 956, PostgreSQLParserRULE_set_clause) + p.SetState(8424) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8414) + p.Set_target() + } + { + p.SetState(8415) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8416) + p.A_expr() + } + + case PostgreSQLParserOPEN_PAREN: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8418) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8419) + p.Set_target_list() + } + { + p.SetState(8420) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8421) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8422) + p.A_expr() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISet_targetContext is an interface to support dynamic dispatch. +type ISet_targetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Opt_indirection() IOpt_indirectionContext + + // IsSet_targetContext differentiates from other interfaces. + IsSet_targetContext() +} + +type Set_targetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySet_targetContext() *Set_targetContext { + var p = new(Set_targetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_target + return p +} + +func InitEmptySet_targetContext(p *Set_targetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_target +} + +func (*Set_targetContext) IsSet_targetContext() {} + +func NewSet_targetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Set_targetContext { + var p = new(Set_targetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_set_target + + return p +} + +func (s *Set_targetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Set_targetContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Set_targetContext) Opt_indirection() IOpt_indirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_indirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_indirectionContext) +} + +func (s *Set_targetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Set_targetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Set_targetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSet_target(s) + } +} + +func (s *Set_targetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSet_target(s) + } +} + +func (s *Set_targetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSet_target(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Set_target() (localctx ISet_targetContext) { + localctx = NewSet_targetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 958, PostgreSQLParserRULE_set_target) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8426) + p.Colid() + } + { + p.SetState(8427) + p.Opt_indirection() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISet_target_listContext is an interface to support dynamic dispatch. +type ISet_target_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSet_target() []ISet_targetContext + Set_target(i int) ISet_targetContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsSet_target_listContext differentiates from other interfaces. + IsSet_target_listContext() +} + +type Set_target_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySet_target_listContext() *Set_target_listContext { + var p = new(Set_target_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_target_list + return p +} + +func InitEmptySet_target_listContext(p *Set_target_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_set_target_list +} + +func (*Set_target_listContext) IsSet_target_listContext() {} + +func NewSet_target_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Set_target_listContext { + var p = new(Set_target_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_set_target_list + + return p +} + +func (s *Set_target_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Set_target_listContext) AllSet_target() []ISet_targetContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISet_targetContext); ok { + len++ + } + } + + tst := make([]ISet_targetContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISet_targetContext); ok { + tst[i] = t.(ISet_targetContext) + i++ + } + } + + return tst +} + +func (s *Set_target_listContext) Set_target(i int) ISet_targetContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISet_targetContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISet_targetContext) +} + +func (s *Set_target_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Set_target_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Set_target_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Set_target_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Set_target_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSet_target_list(s) + } +} + +func (s *Set_target_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSet_target_list(s) + } +} + +func (s *Set_target_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSet_target_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Set_target_list() (localctx ISet_target_listContext) { + localctx = NewSet_target_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 960, PostgreSQLParserRULE_set_target_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8429) + p.Set_target() + } + p.SetState(8434) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8430) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8431) + p.Set_target() + } + + p.SetState(8436) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDeclarecursorstmtContext is an interface to support dynamic dispatch. +type IDeclarecursorstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DECLARE() antlr.TerminalNode + Cursor_name() ICursor_nameContext + Cursor_options() ICursor_optionsContext + CURSOR() antlr.TerminalNode + FOR() antlr.TerminalNode + Selectstmt() ISelectstmtContext + Opt_hold() IOpt_holdContext + + // IsDeclarecursorstmtContext differentiates from other interfaces. + IsDeclarecursorstmtContext() +} + +type DeclarecursorstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDeclarecursorstmtContext() *DeclarecursorstmtContext { + var p = new(DeclarecursorstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_declarecursorstmt + return p +} + +func InitEmptyDeclarecursorstmtContext(p *DeclarecursorstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_declarecursorstmt +} + +func (*DeclarecursorstmtContext) IsDeclarecursorstmtContext() {} + +func NewDeclarecursorstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DeclarecursorstmtContext { + var p = new(DeclarecursorstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_declarecursorstmt + + return p +} + +func (s *DeclarecursorstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *DeclarecursorstmtContext) DECLARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDECLARE, 0) +} + +func (s *DeclarecursorstmtContext) Cursor_name() ICursor_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_nameContext) +} + +func (s *DeclarecursorstmtContext) Cursor_options() ICursor_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_optionsContext) +} + +func (s *DeclarecursorstmtContext) CURSOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURSOR, 0) +} + +func (s *DeclarecursorstmtContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *DeclarecursorstmtContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *DeclarecursorstmtContext) Opt_hold() IOpt_holdContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_holdContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_holdContext) +} + +func (s *DeclarecursorstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *DeclarecursorstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *DeclarecursorstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDeclarecursorstmt(s) + } +} + +func (s *DeclarecursorstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDeclarecursorstmt(s) + } +} + +func (s *DeclarecursorstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDeclarecursorstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Declarecursorstmt() (localctx IDeclarecursorstmtContext) { + localctx = NewDeclarecursorstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 962, PostgreSQLParserRULE_declarecursorstmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8437) + p.Match(PostgreSQLParserDECLARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8438) + p.Cursor_name() + } + { + p.SetState(8439) + p.Cursor_options() + } + { + p.SetState(8440) + p.Match(PostgreSQLParserCURSOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8442) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWITH || _la == PostgreSQLParserWITHOUT { + { + p.SetState(8441) + p.Opt_hold() + } + + } + { + p.SetState(8444) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8445) + p.Selectstmt() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICursor_nameContext is an interface to support dynamic dispatch. +type ICursor_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Name() INameContext + + // IsCursor_nameContext differentiates from other interfaces. + IsCursor_nameContext() +} + +type Cursor_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCursor_nameContext() *Cursor_nameContext { + var p = new(Cursor_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cursor_name + return p +} + +func InitEmptyCursor_nameContext(p *Cursor_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cursor_name +} + +func (*Cursor_nameContext) IsCursor_nameContext() {} + +func NewCursor_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cursor_nameContext { + var p = new(Cursor_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_cursor_name + + return p +} + +func (s *Cursor_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Cursor_nameContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Cursor_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Cursor_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Cursor_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCursor_name(s) + } +} + +func (s *Cursor_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCursor_name(s) + } +} + +func (s *Cursor_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCursor_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Cursor_name() (localctx ICursor_nameContext) { + localctx = NewCursor_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 964, PostgreSQLParserRULE_cursor_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8447) + p.Name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICursor_optionsContext is an interface to support dynamic dispatch. +type ICursor_optionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllNO() []antlr.TerminalNode + NO(i int) antlr.TerminalNode + AllSCROLL() []antlr.TerminalNode + SCROLL(i int) antlr.TerminalNode + AllBINARY() []antlr.TerminalNode + BINARY(i int) antlr.TerminalNode + AllINSENSITIVE() []antlr.TerminalNode + INSENSITIVE(i int) antlr.TerminalNode + + // IsCursor_optionsContext differentiates from other interfaces. + IsCursor_optionsContext() +} + +type Cursor_optionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCursor_optionsContext() *Cursor_optionsContext { + var p = new(Cursor_optionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cursor_options + return p +} + +func InitEmptyCursor_optionsContext(p *Cursor_optionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cursor_options +} + +func (*Cursor_optionsContext) IsCursor_optionsContext() {} + +func NewCursor_optionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cursor_optionsContext { + var p = new(Cursor_optionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_cursor_options + + return p +} + +func (s *Cursor_optionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Cursor_optionsContext) AllNO() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserNO) +} + +func (s *Cursor_optionsContext) NO(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, i) +} + +func (s *Cursor_optionsContext) AllSCROLL() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserSCROLL) +} + +func (s *Cursor_optionsContext) SCROLL(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCROLL, i) +} + +func (s *Cursor_optionsContext) AllBINARY() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserBINARY) +} + +func (s *Cursor_optionsContext) BINARY(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBINARY, i) +} + +func (s *Cursor_optionsContext) AllINSENSITIVE() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserINSENSITIVE) +} + +func (s *Cursor_optionsContext) INSENSITIVE(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSENSITIVE, i) +} + +func (s *Cursor_optionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Cursor_optionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Cursor_optionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCursor_options(s) + } +} + +func (s *Cursor_optionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCursor_options(s) + } +} + +func (s *Cursor_optionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCursor_options(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Cursor_options() (localctx ICursor_optionsContext) { + localctx = NewCursor_optionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 966, PostgreSQLParserRULE_cursor_options) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8456) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserBINARY || _la == PostgreSQLParserINSENSITIVE || _la == PostgreSQLParserNO || _la == PostgreSQLParserSCROLL { + p.SetState(8454) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNO: + { + p.SetState(8449) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8450) + p.Match(PostgreSQLParserSCROLL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSCROLL: + { + p.SetState(8451) + p.Match(PostgreSQLParserSCROLL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserBINARY: + { + p.SetState(8452) + p.Match(PostgreSQLParserBINARY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserINSENSITIVE: + { + p.SetState(8453) + p.Match(PostgreSQLParserINSENSITIVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(8458) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_holdContext is an interface to support dynamic dispatch. +type IOpt_holdContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + HOLD() antlr.TerminalNode + WITHOUT() antlr.TerminalNode + + // IsOpt_holdContext differentiates from other interfaces. + IsOpt_holdContext() +} + +type Opt_holdContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_holdContext() *Opt_holdContext { + var p = new(Opt_holdContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_hold + return p +} + +func InitEmptyOpt_holdContext(p *Opt_holdContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_hold +} + +func (*Opt_holdContext) IsOpt_holdContext() {} + +func NewOpt_holdContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_holdContext { + var p = new(Opt_holdContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_hold + + return p +} + +func (s *Opt_holdContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_holdContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_holdContext) HOLD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHOLD, 0) +} + +func (s *Opt_holdContext) WITHOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITHOUT, 0) +} + +func (s *Opt_holdContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_holdContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_holdContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_hold(s) + } +} + +func (s *Opt_holdContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_hold(s) + } +} + +func (s *Opt_holdContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_hold(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_hold() (localctx IOpt_holdContext) { + localctx = NewOpt_holdContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 968, PostgreSQLParserRULE_opt_hold) + p.SetState(8463) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserWITH: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8459) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8460) + p.Match(PostgreSQLParserHOLD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserWITHOUT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8461) + p.Match(PostgreSQLParserWITHOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8462) + p.Match(PostgreSQLParserHOLD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelectstmtContext is an interface to support dynamic dispatch. +type ISelectstmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Select_no_parens() ISelect_no_parensContext + Select_with_parens() ISelect_with_parensContext + + // IsSelectstmtContext differentiates from other interfaces. + IsSelectstmtContext() +} + +type SelectstmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelectstmtContext() *SelectstmtContext { + var p = new(SelectstmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_selectstmt + return p +} + +func InitEmptySelectstmtContext(p *SelectstmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_selectstmt +} + +func (*SelectstmtContext) IsSelectstmtContext() {} + +func NewSelectstmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SelectstmtContext { + var p = new(SelectstmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_selectstmt + + return p +} + +func (s *SelectstmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *SelectstmtContext) Select_no_parens() ISelect_no_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_no_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_no_parensContext) +} + +func (s *SelectstmtContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *SelectstmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SelectstmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SelectstmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSelectstmt(s) + } +} + +func (s *SelectstmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSelectstmt(s) + } +} + +func (s *SelectstmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSelectstmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Selectstmt() (localctx ISelectstmtContext) { + localctx = NewSelectstmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 970, PostgreSQLParserRULE_selectstmt) + p.SetState(8467) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 727, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8465) + p.Select_no_parens() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8466) + p.Select_with_parens() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelect_with_parensContext is an interface to support dynamic dispatch. +type ISelect_with_parensContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Select_no_parens() ISelect_no_parensContext + CLOSE_PAREN() antlr.TerminalNode + Select_with_parens() ISelect_with_parensContext + + // IsSelect_with_parensContext differentiates from other interfaces. + IsSelect_with_parensContext() +} + +type Select_with_parensContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_with_parensContext() *Select_with_parensContext { + var p = new(Select_with_parensContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_with_parens + return p +} + +func InitEmptySelect_with_parensContext(p *Select_with_parensContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_with_parens +} + +func (*Select_with_parensContext) IsSelect_with_parensContext() {} + +func NewSelect_with_parensContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_with_parensContext { + var p = new(Select_with_parensContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_select_with_parens + + return p +} + +func (s *Select_with_parensContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_with_parensContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Select_with_parensContext) Select_no_parens() ISelect_no_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_no_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_no_parensContext) +} + +func (s *Select_with_parensContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Select_with_parensContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *Select_with_parensContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_with_parensContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_with_parensContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSelect_with_parens(s) + } +} + +func (s *Select_with_parensContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSelect_with_parens(s) + } +} + +func (s *Select_with_parensContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSelect_with_parens(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Select_with_parens() (localctx ISelect_with_parensContext) { + localctx = NewSelect_with_parensContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 972, PostgreSQLParserRULE_select_with_parens) + p.SetState(8477) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 728, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8469) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8470) + p.Select_no_parens() + } + { + p.SetState(8471) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8473) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8474) + p.Select_with_parens() + } + { + p.SetState(8475) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelect_no_parensContext is an interface to support dynamic dispatch. +type ISelect_no_parensContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Select_clause() ISelect_clauseContext + Opt_sort_clause() IOpt_sort_clauseContext + For_locking_clause() IFor_locking_clauseContext + Select_limit() ISelect_limitContext + Opt_select_limit() IOpt_select_limitContext + Opt_for_locking_clause() IOpt_for_locking_clauseContext + With_clause() IWith_clauseContext + + // IsSelect_no_parensContext differentiates from other interfaces. + IsSelect_no_parensContext() +} + +type Select_no_parensContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_no_parensContext() *Select_no_parensContext { + var p = new(Select_no_parensContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_no_parens + return p +} + +func InitEmptySelect_no_parensContext(p *Select_no_parensContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_no_parens +} + +func (*Select_no_parensContext) IsSelect_no_parensContext() {} + +func NewSelect_no_parensContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_no_parensContext { + var p = new(Select_no_parensContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_select_no_parens + + return p +} + +func (s *Select_no_parensContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_no_parensContext) Select_clause() ISelect_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_clauseContext) +} + +func (s *Select_no_parensContext) Opt_sort_clause() IOpt_sort_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_sort_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_sort_clauseContext) +} + +func (s *Select_no_parensContext) For_locking_clause() IFor_locking_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFor_locking_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFor_locking_clauseContext) +} + +func (s *Select_no_parensContext) Select_limit() ISelect_limitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_limitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_limitContext) +} + +func (s *Select_no_parensContext) Opt_select_limit() IOpt_select_limitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_select_limitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_select_limitContext) +} + +func (s *Select_no_parensContext) Opt_for_locking_clause() IOpt_for_locking_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_for_locking_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_for_locking_clauseContext) +} + +func (s *Select_no_parensContext) With_clause() IWith_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWith_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWith_clauseContext) +} + +func (s *Select_no_parensContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_no_parensContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_no_parensContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSelect_no_parens(s) + } +} + +func (s *Select_no_parensContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSelect_no_parens(s) + } +} + +func (s *Select_no_parensContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSelect_no_parens(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Select_no_parens() (localctx ISelect_no_parensContext) { + localctx = NewSelect_no_parensContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 974, PostgreSQLParserRULE_select_no_parens) + var _la int + + p.SetState(8508) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN, PostgreSQLParserSELECT, PostgreSQLParserTABLE, PostgreSQLParserVALUES: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8479) + p.Select_clause() + } + p.SetState(8481) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserORDER { + { + p.SetState(8480) + p.Opt_sort_clause() + } + + } + p.SetState(8491) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 732, p.GetParserRuleContext()) == 1 { + { + p.SetState(8483) + p.For_locking_clause() + } + p.SetState(8485) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 730, p.GetParserRuleContext()) == 1 { + { + p.SetState(8484) + p.Opt_select_limit() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 732, p.GetParserRuleContext()) == 2 { + { + p.SetState(8487) + p.Select_limit() + } + p.SetState(8489) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(8488) + p.Opt_for_locking_clause() + } + + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserWITH: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8493) + p.With_clause() + } + { + p.SetState(8494) + p.Select_clause() + } + p.SetState(8496) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserORDER { + { + p.SetState(8495) + p.Opt_sort_clause() + } + + } + p.SetState(8506) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 736, p.GetParserRuleContext()) == 1 { + { + p.SetState(8498) + p.For_locking_clause() + } + p.SetState(8500) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 734, p.GetParserRuleContext()) == 1 { + { + p.SetState(8499) + p.Opt_select_limit() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 736, p.GetParserRuleContext()) == 2 { + { + p.SetState(8502) + p.Select_limit() + } + p.SetState(8504) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(8503) + p.Opt_for_locking_clause() + } + + } + + } else if p.HasError() { // JIM + goto errorExit + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelect_clauseContext is an interface to support dynamic dispatch. +type ISelect_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSimple_select_intersect() []ISimple_select_intersectContext + Simple_select_intersect(i int) ISimple_select_intersectContext + AllUNION() []antlr.TerminalNode + UNION(i int) antlr.TerminalNode + AllEXCEPT() []antlr.TerminalNode + EXCEPT(i int) antlr.TerminalNode + AllAll_or_distinct() []IAll_or_distinctContext + All_or_distinct(i int) IAll_or_distinctContext + + // IsSelect_clauseContext differentiates from other interfaces. + IsSelect_clauseContext() +} + +type Select_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_clauseContext() *Select_clauseContext { + var p = new(Select_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_clause + return p +} + +func InitEmptySelect_clauseContext(p *Select_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_clause +} + +func (*Select_clauseContext) IsSelect_clauseContext() {} + +func NewSelect_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_clauseContext { + var p = new(Select_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_select_clause + + return p +} + +func (s *Select_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_clauseContext) AllSimple_select_intersect() []ISimple_select_intersectContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISimple_select_intersectContext); ok { + len++ + } + } + + tst := make([]ISimple_select_intersectContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISimple_select_intersectContext); ok { + tst[i] = t.(ISimple_select_intersectContext) + i++ + } + } + + return tst +} + +func (s *Select_clauseContext) Simple_select_intersect(i int) ISimple_select_intersectContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISimple_select_intersectContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISimple_select_intersectContext) +} + +func (s *Select_clauseContext) AllUNION() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserUNION) +} + +func (s *Select_clauseContext) UNION(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNION, i) +} + +func (s *Select_clauseContext) AllEXCEPT() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserEXCEPT) +} + +func (s *Select_clauseContext) EXCEPT(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCEPT, i) +} + +func (s *Select_clauseContext) AllAll_or_distinct() []IAll_or_distinctContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAll_or_distinctContext); ok { + len++ + } + } + + tst := make([]IAll_or_distinctContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAll_or_distinctContext); ok { + tst[i] = t.(IAll_or_distinctContext) + i++ + } + } + + return tst +} + +func (s *Select_clauseContext) All_or_distinct(i int) IAll_or_distinctContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAll_or_distinctContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAll_or_distinctContext) +} + +func (s *Select_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSelect_clause(s) + } +} + +func (s *Select_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSelect_clause(s) + } +} + +func (s *Select_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSelect_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Select_clause() (localctx ISelect_clauseContext) { + localctx = NewSelect_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 976, PostgreSQLParserRULE_select_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8510) + p.Simple_select_intersect() + } + p.SetState(8518) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserEXCEPT || _la == PostgreSQLParserUNION { + { + p.SetState(8511) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserEXCEPT || _la == PostgreSQLParserUNION) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(8513) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserALL || _la == PostgreSQLParserDISTINCT { + { + p.SetState(8512) + p.All_or_distinct() + } + + } + { + p.SetState(8515) + p.Simple_select_intersect() + } + + p.SetState(8520) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISimple_select_intersectContext is an interface to support dynamic dispatch. +type ISimple_select_intersectContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSimple_select_pramary() []ISimple_select_pramaryContext + Simple_select_pramary(i int) ISimple_select_pramaryContext + AllINTERSECT() []antlr.TerminalNode + INTERSECT(i int) antlr.TerminalNode + AllAll_or_distinct() []IAll_or_distinctContext + All_or_distinct(i int) IAll_or_distinctContext + + // IsSimple_select_intersectContext differentiates from other interfaces. + IsSimple_select_intersectContext() +} + +type Simple_select_intersectContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySimple_select_intersectContext() *Simple_select_intersectContext { + var p = new(Simple_select_intersectContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_simple_select_intersect + return p +} + +func InitEmptySimple_select_intersectContext(p *Simple_select_intersectContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_simple_select_intersect +} + +func (*Simple_select_intersectContext) IsSimple_select_intersectContext() {} + +func NewSimple_select_intersectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Simple_select_intersectContext { + var p = new(Simple_select_intersectContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_simple_select_intersect + + return p +} + +func (s *Simple_select_intersectContext) GetParser() antlr.Parser { return s.parser } + +func (s *Simple_select_intersectContext) AllSimple_select_pramary() []ISimple_select_pramaryContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISimple_select_pramaryContext); ok { + len++ + } + } + + tst := make([]ISimple_select_pramaryContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISimple_select_pramaryContext); ok { + tst[i] = t.(ISimple_select_pramaryContext) + i++ + } + } + + return tst +} + +func (s *Simple_select_intersectContext) Simple_select_pramary(i int) ISimple_select_pramaryContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISimple_select_pramaryContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISimple_select_pramaryContext) +} + +func (s *Simple_select_intersectContext) AllINTERSECT() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserINTERSECT) +} + +func (s *Simple_select_intersectContext) INTERSECT(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTERSECT, i) +} + +func (s *Simple_select_intersectContext) AllAll_or_distinct() []IAll_or_distinctContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IAll_or_distinctContext); ok { + len++ + } + } + + tst := make([]IAll_or_distinctContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IAll_or_distinctContext); ok { + tst[i] = t.(IAll_or_distinctContext) + i++ + } + } + + return tst +} + +func (s *Simple_select_intersectContext) All_or_distinct(i int) IAll_or_distinctContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAll_or_distinctContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IAll_or_distinctContext) +} + +func (s *Simple_select_intersectContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Simple_select_intersectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Simple_select_intersectContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSimple_select_intersect(s) + } +} + +func (s *Simple_select_intersectContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSimple_select_intersect(s) + } +} + +func (s *Simple_select_intersectContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSimple_select_intersect(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Simple_select_intersect() (localctx ISimple_select_intersectContext) { + localctx = NewSimple_select_intersectContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 978, PostgreSQLParserRULE_simple_select_intersect) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8521) + p.Simple_select_pramary() + } + p.SetState(8529) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserINTERSECT { + { + p.SetState(8522) + p.Match(PostgreSQLParserINTERSECT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8524) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserALL || _la == PostgreSQLParserDISTINCT { + { + p.SetState(8523) + p.All_or_distinct() + } + + } + { + p.SetState(8526) + p.Simple_select_pramary() + } + + p.SetState(8531) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISimple_select_pramaryContext is an interface to support dynamic dispatch. +type ISimple_select_pramaryContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SELECT() antlr.TerminalNode + Distinct_clause() IDistinct_clauseContext + Target_list() ITarget_listContext + AllInto_clause() []IInto_clauseContext + Into_clause(i int) IInto_clauseContext + From_clause() IFrom_clauseContext + Where_clause() IWhere_clauseContext + Group_clause() IGroup_clauseContext + Having_clause() IHaving_clauseContext + Window_clause() IWindow_clauseContext + Opt_all_clause() IOpt_all_clauseContext + Opt_target_list() IOpt_target_listContext + Values_clause() IValues_clauseContext + TABLE() antlr.TerminalNode + Relation_expr() IRelation_exprContext + Select_with_parens() ISelect_with_parensContext + + // IsSimple_select_pramaryContext differentiates from other interfaces. + IsSimple_select_pramaryContext() +} + +type Simple_select_pramaryContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySimple_select_pramaryContext() *Simple_select_pramaryContext { + var p = new(Simple_select_pramaryContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_simple_select_pramary + return p +} + +func InitEmptySimple_select_pramaryContext(p *Simple_select_pramaryContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_simple_select_pramary +} + +func (*Simple_select_pramaryContext) IsSimple_select_pramaryContext() {} + +func NewSimple_select_pramaryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Simple_select_pramaryContext { + var p = new(Simple_select_pramaryContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_simple_select_pramary + + return p +} + +func (s *Simple_select_pramaryContext) GetParser() antlr.Parser { return s.parser } + +func (s *Simple_select_pramaryContext) SELECT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSELECT, 0) +} + +func (s *Simple_select_pramaryContext) Distinct_clause() IDistinct_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDistinct_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDistinct_clauseContext) +} + +func (s *Simple_select_pramaryContext) Target_list() ITarget_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITarget_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITarget_listContext) +} + +func (s *Simple_select_pramaryContext) AllInto_clause() []IInto_clauseContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IInto_clauseContext); ok { + len++ + } + } + + tst := make([]IInto_clauseContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IInto_clauseContext); ok { + tst[i] = t.(IInto_clauseContext) + i++ + } + } + + return tst +} + +func (s *Simple_select_pramaryContext) Into_clause(i int) IInto_clauseContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInto_clauseContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IInto_clauseContext) +} + +func (s *Simple_select_pramaryContext) From_clause() IFrom_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_clauseContext) +} + +func (s *Simple_select_pramaryContext) Where_clause() IWhere_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_clauseContext) +} + +func (s *Simple_select_pramaryContext) Group_clause() IGroup_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGroup_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGroup_clauseContext) +} + +func (s *Simple_select_pramaryContext) Having_clause() IHaving_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHaving_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHaving_clauseContext) +} + +func (s *Simple_select_pramaryContext) Window_clause() IWindow_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWindow_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWindow_clauseContext) +} + +func (s *Simple_select_pramaryContext) Opt_all_clause() IOpt_all_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_all_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_all_clauseContext) +} + +func (s *Simple_select_pramaryContext) Opt_target_list() IOpt_target_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_target_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_target_listContext) +} + +func (s *Simple_select_pramaryContext) Values_clause() IValues_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IValues_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IValues_clauseContext) +} + +func (s *Simple_select_pramaryContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Simple_select_pramaryContext) Relation_expr() IRelation_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *Simple_select_pramaryContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *Simple_select_pramaryContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Simple_select_pramaryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Simple_select_pramaryContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSimple_select_pramary(s) + } +} + +func (s *Simple_select_pramaryContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSimple_select_pramary(s) + } +} + +func (s *Simple_select_pramaryContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSimple_select_pramary(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Simple_select_pramary() (localctx ISimple_select_pramaryContext) { + localctx = NewSimple_select_pramaryContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 980, PostgreSQLParserRULE_simple_select_pramary) + var _la int + + p.SetState(8569) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserSELECT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8532) + p.Match(PostgreSQLParserSELECT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8545) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserEOF, PostgreSQLParserOPEN_PAREN, PostgreSQLParserCLOSE_PAREN, PostgreSQLParserSEMI, PostgreSQLParserSTAR, PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserPARAM, PostgreSQLParserOperator, PostgreSQLParserALL, PostgreSQLParserANALYSE, PostgreSQLParserANALYZE, PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCREATE, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserEXCEPT, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserFOR, PostgreSQLParserFROM, PostgreSQLParserGRANT, PostgreSQLParserGROUP_P, PostgreSQLParserHAVING, PostgreSQLParserINTERSECT, PostgreSQLParserINTO, PostgreSQLParserLIMIT, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNOT, PostgreSQLParserNULL_P, PostgreSQLParserOFFSET, PostgreSQLParserON, PostgreSQLParserORDER, PostgreSQLParserRETURNING, PostgreSQLParserSELECT, PostgreSQLParserSESSION_USER, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserUNION, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserWHERE, PostgreSQLParserWINDOW, PostgreSQLParserWITH, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserRIGHT, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMERGE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserEND_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserLOOP, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserBinaryStringConstant, PostgreSQLParserHexadecimalStringConstant, PostgreSQLParserIntegral, PostgreSQLParserNumeric, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserMetaCommand, PostgreSQLParserEscapeStringConstant: + p.SetState(8534) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserALL { + { + p.SetState(8533) + p.Opt_all_clause() + } + + } + p.SetState(8537) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 743, p.GetParserRuleContext()) == 1 { + { + p.SetState(8536) + p.Into_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(8540) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 744, p.GetParserRuleContext()) == 1 { + { + p.SetState(8539) + p.Opt_target_list() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserDISTINCT: + { + p.SetState(8542) + p.Distinct_clause() + } + { + p.SetState(8543) + p.Target_list() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.SetState(8548) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 746, p.GetParserRuleContext()) == 1 { + { + p.SetState(8547) + p.Into_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(8551) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM { + { + p.SetState(8550) + p.From_clause() + } + + } + p.SetState(8554) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(8553) + p.Where_clause() + } + + } + p.SetState(8557) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGROUP_P { + { + p.SetState(8556) + p.Group_clause() + } + + } + p.SetState(8560) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserHAVING { + { + p.SetState(8559) + p.Having_clause() + } + + } + p.SetState(8563) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWINDOW { + { + p.SetState(8562) + p.Window_clause() + } + + } + + case PostgreSQLParserVALUES: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8565) + p.Values_clause() + } + + case PostgreSQLParserTABLE: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8566) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8567) + p.Relation_expr() + } + + case PostgreSQLParserOPEN_PAREN: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8568) + p.Select_with_parens() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWith_clauseContext is an interface to support dynamic dispatch. +type IWith_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + Cte_list() ICte_listContext + RECURSIVE() antlr.TerminalNode + + // IsWith_clauseContext differentiates from other interfaces. + IsWith_clauseContext() +} + +type With_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWith_clauseContext() *With_clauseContext { + var p = new(With_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_with_clause + return p +} + +func InitEmptyWith_clauseContext(p *With_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_with_clause +} + +func (*With_clauseContext) IsWith_clauseContext() {} + +func NewWith_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *With_clauseContext { + var p = new(With_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_with_clause + + return p +} + +func (s *With_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *With_clauseContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *With_clauseContext) Cte_list() ICte_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICte_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICte_listContext) +} + +func (s *With_clauseContext) RECURSIVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRECURSIVE, 0) +} + +func (s *With_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *With_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *With_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWith_clause(s) + } +} + +func (s *With_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWith_clause(s) + } +} + +func (s *With_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWith_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) With_clause() (localctx IWith_clauseContext) { + localctx = NewWith_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 982, PostgreSQLParserRULE_with_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8571) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8573) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 753, p.GetParserRuleContext()) == 1 { + { + p.SetState(8572) + p.Match(PostgreSQLParserRECURSIVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(8575) + p.Cte_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICte_listContext is an interface to support dynamic dispatch. +type ICte_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCommon_table_expr() []ICommon_table_exprContext + Common_table_expr(i int) ICommon_table_exprContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsCte_listContext differentiates from other interfaces. + IsCte_listContext() +} + +type Cte_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCte_listContext() *Cte_listContext { + var p = new(Cte_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cte_list + return p +} + +func InitEmptyCte_listContext(p *Cte_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cte_list +} + +func (*Cte_listContext) IsCte_listContext() {} + +func NewCte_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cte_listContext { + var p = new(Cte_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_cte_list + + return p +} + +func (s *Cte_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Cte_listContext) AllCommon_table_expr() []ICommon_table_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICommon_table_exprContext); ok { + len++ + } + } + + tst := make([]ICommon_table_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICommon_table_exprContext); ok { + tst[i] = t.(ICommon_table_exprContext) + i++ + } + } + + return tst +} + +func (s *Cte_listContext) Common_table_expr(i int) ICommon_table_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICommon_table_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICommon_table_exprContext) +} + +func (s *Cte_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Cte_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Cte_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Cte_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Cte_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCte_list(s) + } +} + +func (s *Cte_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCte_list(s) + } +} + +func (s *Cte_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCte_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Cte_list() (localctx ICte_listContext) { + localctx = NewCte_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 984, PostgreSQLParserRULE_cte_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8577) + p.Common_table_expr() + } + p.SetState(8582) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8578) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8579) + p.Common_table_expr() + } + + p.SetState(8584) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICommon_table_exprContext is an interface to support dynamic dispatch. +type ICommon_table_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Name() INameContext + AS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Preparablestmt() IPreparablestmtContext + CLOSE_PAREN() antlr.TerminalNode + Opt_name_list() IOpt_name_listContext + Opt_materialized() IOpt_materializedContext + + // IsCommon_table_exprContext differentiates from other interfaces. + IsCommon_table_exprContext() +} + +type Common_table_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCommon_table_exprContext() *Common_table_exprContext { + var p = new(Common_table_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_common_table_expr + return p +} + +func InitEmptyCommon_table_exprContext(p *Common_table_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_common_table_expr +} + +func (*Common_table_exprContext) IsCommon_table_exprContext() {} + +func NewCommon_table_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Common_table_exprContext { + var p = new(Common_table_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_common_table_expr + + return p +} + +func (s *Common_table_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *Common_table_exprContext) Name() INameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Common_table_exprContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Common_table_exprContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Common_table_exprContext) Preparablestmt() IPreparablestmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPreparablestmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPreparablestmtContext) +} + +func (s *Common_table_exprContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Common_table_exprContext) Opt_name_list() IOpt_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_name_listContext) +} + +func (s *Common_table_exprContext) Opt_materialized() IOpt_materializedContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_materializedContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_materializedContext) +} + +func (s *Common_table_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Common_table_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Common_table_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCommon_table_expr(s) + } +} + +func (s *Common_table_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCommon_table_expr(s) + } +} + +func (s *Common_table_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCommon_table_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Common_table_expr() (localctx ICommon_table_exprContext) { + localctx = NewCommon_table_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 986, PostgreSQLParserRULE_common_table_expr) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8585) + p.Name() + } + p.SetState(8587) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(8586) + p.Opt_name_list() + } + + } + { + p.SetState(8589) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8591) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT || _la == PostgreSQLParserMATERIALIZED { + { + p.SetState(8590) + p.Opt_materialized() + } + + } + { + p.SetState(8593) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8594) + p.Preparablestmt() + } + { + p.SetState(8595) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_materializedContext is an interface to support dynamic dispatch. +type IOpt_materializedContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + MATERIALIZED() antlr.TerminalNode + NOT() antlr.TerminalNode + + // IsOpt_materializedContext differentiates from other interfaces. + IsOpt_materializedContext() +} + +type Opt_materializedContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_materializedContext() *Opt_materializedContext { + var p = new(Opt_materializedContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_materialized + return p +} + +func InitEmptyOpt_materializedContext(p *Opt_materializedContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_materialized +} + +func (*Opt_materializedContext) IsOpt_materializedContext() {} + +func NewOpt_materializedContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_materializedContext { + var p = new(Opt_materializedContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_materialized + + return p +} + +func (s *Opt_materializedContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_materializedContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *Opt_materializedContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Opt_materializedContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_materializedContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_materializedContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_materialized(s) + } +} + +func (s *Opt_materializedContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_materialized(s) + } +} + +func (s *Opt_materializedContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_materialized(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_materialized() (localctx IOpt_materializedContext) { + localctx = NewOpt_materializedContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 988, PostgreSQLParserRULE_opt_materialized) + p.SetState(8600) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserMATERIALIZED: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8597) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNOT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8598) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8599) + p.Match(PostgreSQLParserMATERIALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_with_clauseContext is an interface to support dynamic dispatch. +type IOpt_with_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + With_clause() IWith_clauseContext + + // IsOpt_with_clauseContext differentiates from other interfaces. + IsOpt_with_clauseContext() +} + +type Opt_with_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_with_clauseContext() *Opt_with_clauseContext { + var p = new(Opt_with_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_with_clause + return p +} + +func InitEmptyOpt_with_clauseContext(p *Opt_with_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_with_clause +} + +func (*Opt_with_clauseContext) IsOpt_with_clauseContext() {} + +func NewOpt_with_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_with_clauseContext { + var p = new(Opt_with_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_with_clause + + return p +} + +func (s *Opt_with_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_with_clauseContext) With_clause() IWith_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWith_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWith_clauseContext) +} + +func (s *Opt_with_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_with_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_with_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_with_clause(s) + } +} + +func (s *Opt_with_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_with_clause(s) + } +} + +func (s *Opt_with_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_with_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_with_clause() (localctx IOpt_with_clauseContext) { + localctx = NewOpt_with_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 990, PostgreSQLParserRULE_opt_with_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8602) + p.With_clause() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IInto_clauseContext is an interface to support dynamic dispatch. +type IInto_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INTO() antlr.TerminalNode + OpttempTableName() IOpttempTableNameContext + Into_target() IInto_targetContext + Opt_strict() IOpt_strictContext + + // IsInto_clauseContext differentiates from other interfaces. + IsInto_clauseContext() +} + +type Into_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInto_clauseContext() *Into_clauseContext { + var p = new(Into_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_into_clause + return p +} + +func InitEmptyInto_clauseContext(p *Into_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_into_clause +} + +func (*Into_clauseContext) IsInto_clauseContext() {} + +func NewInto_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Into_clauseContext { + var p = new(Into_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_into_clause + + return p +} + +func (s *Into_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Into_clauseContext) INTO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTO, 0) +} + +func (s *Into_clauseContext) OpttempTableName() IOpttempTableNameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpttempTableNameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpttempTableNameContext) +} + +func (s *Into_clauseContext) Into_target() IInto_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInto_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInto_targetContext) +} + +func (s *Into_clauseContext) Opt_strict() IOpt_strictContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_strictContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_strictContext) +} + +func (s *Into_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Into_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Into_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterInto_clause(s) + } +} + +func (s *Into_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitInto_clause(s) + } +} + +func (s *Into_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitInto_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Into_clause() (localctx IInto_clauseContext) { + localctx = NewInto_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 992, PostgreSQLParserRULE_into_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8604) + p.Match(PostgreSQLParserINTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8610) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 759, p.GetParserRuleContext()) { + case 1: + p.SetState(8606) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 758, p.GetParserRuleContext()) == 1 { + { + p.SetState(8605) + p.Opt_strict() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(8608) + p.OpttempTableName() + } + + case 2: + { + p.SetState(8609) + p.Into_target() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_strictContext is an interface to support dynamic dispatch. +type IOpt_strictContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + STRICT_P() antlr.TerminalNode + + // IsOpt_strictContext differentiates from other interfaces. + IsOpt_strictContext() +} + +type Opt_strictContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_strictContext() *Opt_strictContext { + var p = new(Opt_strictContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_strict + return p +} + +func InitEmptyOpt_strictContext(p *Opt_strictContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_strict +} + +func (*Opt_strictContext) IsOpt_strictContext() {} + +func NewOpt_strictContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_strictContext { + var p = new(Opt_strictContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_strict + + return p +} + +func (s *Opt_strictContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_strictContext) STRICT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRICT_P, 0) +} + +func (s *Opt_strictContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_strictContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_strictContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_strict(s) + } +} + +func (s *Opt_strictContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_strict(s) + } +} + +func (s *Opt_strictContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_strict(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_strict() (localctx IOpt_strictContext) { + localctx = NewOpt_strictContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 994, PostgreSQLParserRULE_opt_strict) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8612) + p.Match(PostgreSQLParserSTRICT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpttempTableNameContext is an interface to support dynamic dispatch. +type IOpttempTableNameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Qualified_name() IQualified_nameContext + TEMPORARY() antlr.TerminalNode + TEMP() antlr.TerminalNode + Opt_table() IOpt_tableContext + LOCAL() antlr.TerminalNode + GLOBAL() antlr.TerminalNode + UNLOGGED() antlr.TerminalNode + TABLE() antlr.TerminalNode + + // IsOpttempTableNameContext differentiates from other interfaces. + IsOpttempTableNameContext() +} + +type OpttempTableNameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpttempTableNameContext() *OpttempTableNameContext { + var p = new(OpttempTableNameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttempTableName + return p +} + +func InitEmptyOpttempTableNameContext(p *OpttempTableNameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttempTableName +} + +func (*OpttempTableNameContext) IsOpttempTableNameContext() {} + +func NewOpttempTableNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OpttempTableNameContext { + var p = new(OpttempTableNameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opttempTableName + + return p +} + +func (s *OpttempTableNameContext) GetParser() antlr.Parser { return s.parser } + +func (s *OpttempTableNameContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *OpttempTableNameContext) TEMPORARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPORARY, 0) +} + +func (s *OpttempTableNameContext) TEMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMP, 0) +} + +func (s *OpttempTableNameContext) Opt_table() IOpt_tableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_tableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_tableContext) +} + +func (s *OpttempTableNameContext) LOCAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCAL, 0) +} + +func (s *OpttempTableNameContext) GLOBAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGLOBAL, 0) +} + +func (s *OpttempTableNameContext) UNLOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNLOGGED, 0) +} + +func (s *OpttempTableNameContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *OpttempTableNameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OpttempTableNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OpttempTableNameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpttempTableName(s) + } +} + +func (s *OpttempTableNameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpttempTableName(s) + } +} + +func (s *OpttempTableNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpttempTableName(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) OpttempTableName() (localctx IOpttempTableNameContext) { + localctx = NewOpttempTableNameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 996, PostgreSQLParserRULE_opttempTableName) + var _la int + + p.SetState(8630) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 763, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + p.SetState(8615) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGLOBAL || _la == PostgreSQLParserLOCAL { + { + p.SetState(8614) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserGLOBAL || _la == PostgreSQLParserLOCAL) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + } + { + p.SetState(8617) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTEMP || _la == PostgreSQLParserTEMPORARY) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(8619) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 761, p.GetParserRuleContext()) == 1 { + { + p.SetState(8618) + p.Opt_table() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(8621) + p.Qualified_name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8622) + p.Match(PostgreSQLParserUNLOGGED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8624) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 762, p.GetParserRuleContext()) == 1 { + { + p.SetState(8623) + p.Opt_table() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(8626) + p.Qualified_name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8627) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8628) + p.Qualified_name() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8629) + p.Qualified_name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_tableContext is an interface to support dynamic dispatch. +type IOpt_tableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TABLE() antlr.TerminalNode + + // IsOpt_tableContext differentiates from other interfaces. + IsOpt_tableContext() +} + +type Opt_tableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_tableContext() *Opt_tableContext { + var p = new(Opt_tableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_table + return p +} + +func InitEmptyOpt_tableContext(p *Opt_tableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_table +} + +func (*Opt_tableContext) IsOpt_tableContext() {} + +func NewOpt_tableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_tableContext { + var p = new(Opt_tableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_table + + return p +} + +func (s *Opt_tableContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_tableContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Opt_tableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_tableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_tableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_table(s) + } +} + +func (s *Opt_tableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_table(s) + } +} + +func (s *Opt_tableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_table(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_table() (localctx IOpt_tableContext) { + localctx = NewOpt_tableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 998, PostgreSQLParserRULE_opt_table) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8632) + p.Match(PostgreSQLParserTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAll_or_distinctContext is an interface to support dynamic dispatch. +type IAll_or_distinctContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALL() antlr.TerminalNode + DISTINCT() antlr.TerminalNode + + // IsAll_or_distinctContext differentiates from other interfaces. + IsAll_or_distinctContext() +} + +type All_or_distinctContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAll_or_distinctContext() *All_or_distinctContext { + var p = new(All_or_distinctContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_all_or_distinct + return p +} + +func InitEmptyAll_or_distinctContext(p *All_or_distinctContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_all_or_distinct +} + +func (*All_or_distinctContext) IsAll_or_distinctContext() {} + +func NewAll_or_distinctContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *All_or_distinctContext { + var p = new(All_or_distinctContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_all_or_distinct + + return p +} + +func (s *All_or_distinctContext) GetParser() antlr.Parser { return s.parser } + +func (s *All_or_distinctContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *All_or_distinctContext) DISTINCT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISTINCT, 0) +} + +func (s *All_or_distinctContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *All_or_distinctContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *All_or_distinctContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAll_or_distinct(s) + } +} + +func (s *All_or_distinctContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAll_or_distinct(s) + } +} + +func (s *All_or_distinctContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAll_or_distinct(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) All_or_distinct() (localctx IAll_or_distinctContext) { + localctx = NewAll_or_distinctContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1000, PostgreSQLParserRULE_all_or_distinct) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8634) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserALL || _la == PostgreSQLParserDISTINCT) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDistinct_clauseContext is an interface to support dynamic dispatch. +type IDistinct_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DISTINCT() antlr.TerminalNode + ON() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsDistinct_clauseContext differentiates from other interfaces. + IsDistinct_clauseContext() +} + +type Distinct_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDistinct_clauseContext() *Distinct_clauseContext { + var p = new(Distinct_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_distinct_clause + return p +} + +func InitEmptyDistinct_clauseContext(p *Distinct_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_distinct_clause +} + +func (*Distinct_clauseContext) IsDistinct_clauseContext() {} + +func NewDistinct_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Distinct_clauseContext { + var p = new(Distinct_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_distinct_clause + + return p +} + +func (s *Distinct_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Distinct_clauseContext) DISTINCT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISTINCT, 0) +} + +func (s *Distinct_clauseContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Distinct_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Distinct_clauseContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Distinct_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Distinct_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Distinct_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Distinct_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDistinct_clause(s) + } +} + +func (s *Distinct_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDistinct_clause(s) + } +} + +func (s *Distinct_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDistinct_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Distinct_clause() (localctx IDistinct_clauseContext) { + localctx = NewDistinct_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1002, PostgreSQLParserRULE_distinct_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8636) + p.Match(PostgreSQLParserDISTINCT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8642) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserON { + { + p.SetState(8637) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8638) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8639) + p.Expr_list() + } + { + p.SetState(8640) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_all_clauseContext is an interface to support dynamic dispatch. +type IOpt_all_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALL() antlr.TerminalNode + + // IsOpt_all_clauseContext differentiates from other interfaces. + IsOpt_all_clauseContext() +} + +type Opt_all_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_all_clauseContext() *Opt_all_clauseContext { + var p = new(Opt_all_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_all_clause + return p +} + +func InitEmptyOpt_all_clauseContext(p *Opt_all_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_all_clause +} + +func (*Opt_all_clauseContext) IsOpt_all_clauseContext() {} + +func NewOpt_all_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_all_clauseContext { + var p = new(Opt_all_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_all_clause + + return p +} + +func (s *Opt_all_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_all_clauseContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Opt_all_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_all_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_all_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_all_clause(s) + } +} + +func (s *Opt_all_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_all_clause(s) + } +} + +func (s *Opt_all_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_all_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_all_clause() (localctx IOpt_all_clauseContext) { + localctx = NewOpt_all_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1004, PostgreSQLParserRULE_opt_all_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8644) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_sort_clauseContext is an interface to support dynamic dispatch. +type IOpt_sort_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sort_clause() ISort_clauseContext + + // IsOpt_sort_clauseContext differentiates from other interfaces. + IsOpt_sort_clauseContext() +} + +type Opt_sort_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_sort_clauseContext() *Opt_sort_clauseContext { + var p = new(Opt_sort_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_sort_clause + return p +} + +func InitEmptyOpt_sort_clauseContext(p *Opt_sort_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_sort_clause +} + +func (*Opt_sort_clauseContext) IsOpt_sort_clauseContext() {} + +func NewOpt_sort_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_sort_clauseContext { + var p = new(Opt_sort_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_sort_clause + + return p +} + +func (s *Opt_sort_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_sort_clauseContext) Sort_clause() ISort_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISort_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISort_clauseContext) +} + +func (s *Opt_sort_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_sort_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_sort_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_sort_clause(s) + } +} + +func (s *Opt_sort_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_sort_clause(s) + } +} + +func (s *Opt_sort_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_sort_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_sort_clause() (localctx IOpt_sort_clauseContext) { + localctx = NewOpt_sort_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1006, PostgreSQLParserRULE_opt_sort_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8646) + p.Sort_clause() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISort_clauseContext is an interface to support dynamic dispatch. +type ISort_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ORDER() antlr.TerminalNode + BY() antlr.TerminalNode + Sortby_list() ISortby_listContext + + // IsSort_clauseContext differentiates from other interfaces. + IsSort_clauseContext() +} + +type Sort_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySort_clauseContext() *Sort_clauseContext { + var p = new(Sort_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sort_clause + return p +} + +func InitEmptySort_clauseContext(p *Sort_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sort_clause +} + +func (*Sort_clauseContext) IsSort_clauseContext() {} + +func NewSort_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Sort_clauseContext { + var p = new(Sort_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_sort_clause + + return p +} + +func (s *Sort_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Sort_clauseContext) ORDER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserORDER, 0) +} + +func (s *Sort_clauseContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Sort_clauseContext) Sortby_list() ISortby_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISortby_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISortby_listContext) +} + +func (s *Sort_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Sort_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Sort_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSort_clause(s) + } +} + +func (s *Sort_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSort_clause(s) + } +} + +func (s *Sort_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSort_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Sort_clause() (localctx ISort_clauseContext) { + localctx = NewSort_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1008, PostgreSQLParserRULE_sort_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8648) + p.Match(PostgreSQLParserORDER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8649) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8650) + p.Sortby_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISortby_listContext is an interface to support dynamic dispatch. +type ISortby_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllSortby() []ISortbyContext + Sortby(i int) ISortbyContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsSortby_listContext differentiates from other interfaces. + IsSortby_listContext() +} + +type Sortby_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySortby_listContext() *Sortby_listContext { + var p = new(Sortby_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sortby_list + return p +} + +func InitEmptySortby_listContext(p *Sortby_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sortby_list +} + +func (*Sortby_listContext) IsSortby_listContext() {} + +func NewSortby_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Sortby_listContext { + var p = new(Sortby_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_sortby_list + + return p +} + +func (s *Sortby_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Sortby_listContext) AllSortby() []ISortbyContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ISortbyContext); ok { + len++ + } + } + + tst := make([]ISortbyContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ISortbyContext); ok { + tst[i] = t.(ISortbyContext) + i++ + } + } + + return tst +} + +func (s *Sortby_listContext) Sortby(i int) ISortbyContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISortbyContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ISortbyContext) +} + +func (s *Sortby_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Sortby_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Sortby_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Sortby_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Sortby_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSortby_list(s) + } +} + +func (s *Sortby_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSortby_list(s) + } +} + +func (s *Sortby_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSortby_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Sortby_list() (localctx ISortby_listContext) { + localctx = NewSortby_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1010, PostgreSQLParserRULE_sortby_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8652) + p.Sortby() + } + p.SetState(8657) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8653) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8654) + p.Sortby() + } + + p.SetState(8659) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISortbyContext is an interface to support dynamic dispatch. +type ISortbyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + USING() antlr.TerminalNode + Qual_all_op() IQual_all_opContext + Opt_nulls_order() IOpt_nulls_orderContext + Opt_asc_desc() IOpt_asc_descContext + + // IsSortbyContext differentiates from other interfaces. + IsSortbyContext() +} + +type SortbyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySortbyContext() *SortbyContext { + var p = new(SortbyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sortby + return p +} + +func InitEmptySortbyContext(p *SortbyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sortby +} + +func (*SortbyContext) IsSortbyContext() {} + +func NewSortbyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SortbyContext { + var p = new(SortbyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_sortby + + return p +} + +func (s *SortbyContext) GetParser() antlr.Parser { return s.parser } + +func (s *SortbyContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *SortbyContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *SortbyContext) Qual_all_op() IQual_all_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQual_all_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQual_all_opContext) +} + +func (s *SortbyContext) Opt_nulls_order() IOpt_nulls_orderContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_nulls_orderContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_nulls_orderContext) +} + +func (s *SortbyContext) Opt_asc_desc() IOpt_asc_descContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_asc_descContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_asc_descContext) +} + +func (s *SortbyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SortbyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SortbyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSortby(s) + } +} + +func (s *SortbyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSortby(s) + } +} + +func (s *SortbyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSortby(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Sortby() (localctx ISortbyContext) { + localctx = NewSortbyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1012, PostgreSQLParserRULE_sortby) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8660) + p.A_expr() + } + p.SetState(8666) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserUSING: + { + p.SetState(8661) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8662) + p.Qual_all_op() + } + + case PostgreSQLParserEOF, PostgreSQLParserOPEN_PAREN, PostgreSQLParserCLOSE_PAREN, PostgreSQLParserCOMMA, PostgreSQLParserSEMI, PostgreSQLParserANALYSE, PostgreSQLParserANALYZE, PostgreSQLParserASC, PostgreSQLParserCREATE, PostgreSQLParserDESC, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserFOR, PostgreSQLParserGRANT, PostgreSQLParserINTO, PostgreSQLParserLIMIT, PostgreSQLParserOFFSET, PostgreSQLParserON, PostgreSQLParserRETURNING, PostgreSQLParserSELECT, PostgreSQLParserTABLE, PostgreSQLParserWITH, PostgreSQLParserABORT_P, PostgreSQLParserALTER, PostgreSQLParserBEGIN_P, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMIT, PostgreSQLParserCOPY, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDELETE_P, PostgreSQLParserDISCARD, PostgreSQLParserDROP, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserINSERT, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCK_P, PostgreSQLParserMERGE, PostgreSQLParserMOVE, PostgreSQLParserNOTIFY, PostgreSQLParserNULLS_P, PostgreSQLParserPREPARE, PostgreSQLParserRANGE, PostgreSQLParserREASSIGN, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELEASE, PostgreSQLParserRESET, PostgreSQLParserREVOKE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserSAVEPOINT, PostgreSQLParserSECURITY, PostgreSQLParserSET, PostgreSQLParserSHOW, PostgreSQLParserSTART, PostgreSQLParserTRUNCATE, PostgreSQLParserUNLISTEN, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALUES, PostgreSQLParserCALL, PostgreSQLParserIMPORT_P, PostgreSQLParserEND_P, PostgreSQLParserGROUPS, PostgreSQLParserLOOP, PostgreSQLParserMetaCommand: + p.SetState(8664) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserASC || _la == PostgreSQLParserDESC { + { + p.SetState(8663) + p.Opt_asc_desc() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.SetState(8669) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNULLS_P { + { + p.SetState(8668) + p.Opt_nulls_order() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelect_limitContext is an interface to support dynamic dispatch. +type ISelect_limitContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Limit_clause() ILimit_clauseContext + Offset_clause() IOffset_clauseContext + + // IsSelect_limitContext differentiates from other interfaces. + IsSelect_limitContext() +} + +type Select_limitContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_limitContext() *Select_limitContext { + var p = new(Select_limitContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_limit + return p +} + +func InitEmptySelect_limitContext(p *Select_limitContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_limit +} + +func (*Select_limitContext) IsSelect_limitContext() {} + +func NewSelect_limitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_limitContext { + var p = new(Select_limitContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_select_limit + + return p +} + +func (s *Select_limitContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_limitContext) Limit_clause() ILimit_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILimit_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILimit_clauseContext) +} + +func (s *Select_limitContext) Offset_clause() IOffset_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOffset_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOffset_clauseContext) +} + +func (s *Select_limitContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_limitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_limitContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSelect_limit(s) + } +} + +func (s *Select_limitContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSelect_limit(s) + } +} + +func (s *Select_limitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSelect_limit(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Select_limit() (localctx ISelect_limitContext) { + localctx = NewSelect_limitContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1014, PostgreSQLParserRULE_select_limit) + var _la int + + p.SetState(8679) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserFETCH, PostgreSQLParserLIMIT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8671) + p.Limit_clause() + } + p.SetState(8673) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOFFSET { + { + p.SetState(8672) + p.Offset_clause() + } + + } + + case PostgreSQLParserOFFSET: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8675) + p.Offset_clause() + } + p.SetState(8677) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 770, p.GetParserRuleContext()) == 1 { + { + p.SetState(8676) + p.Limit_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_select_limitContext is an interface to support dynamic dispatch. +type IOpt_select_limitContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Select_limit() ISelect_limitContext + + // IsOpt_select_limitContext differentiates from other interfaces. + IsOpt_select_limitContext() +} + +type Opt_select_limitContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_select_limitContext() *Opt_select_limitContext { + var p = new(Opt_select_limitContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_select_limit + return p +} + +func InitEmptyOpt_select_limitContext(p *Opt_select_limitContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_select_limit +} + +func (*Opt_select_limitContext) IsOpt_select_limitContext() {} + +func NewOpt_select_limitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_select_limitContext { + var p = new(Opt_select_limitContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_select_limit + + return p +} + +func (s *Opt_select_limitContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_select_limitContext) Select_limit() ISelect_limitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_limitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_limitContext) +} + +func (s *Opt_select_limitContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_select_limitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_select_limitContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_select_limit(s) + } +} + +func (s *Opt_select_limitContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_select_limit(s) + } +} + +func (s *Opt_select_limitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_select_limit(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_select_limit() (localctx IOpt_select_limitContext) { + localctx = NewOpt_select_limitContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1016, PostgreSQLParserRULE_opt_select_limit) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8681) + p.Select_limit() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILimit_clauseContext is an interface to support dynamic dispatch. +type ILimit_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LIMIT() antlr.TerminalNode + Select_limit_value() ISelect_limit_valueContext + COMMA() antlr.TerminalNode + Select_offset_value() ISelect_offset_valueContext + FETCH() antlr.TerminalNode + First_or_next() IFirst_or_nextContext + Select_fetch_first_value() ISelect_fetch_first_valueContext + Row_or_rows() IRow_or_rowsContext + ONLY() antlr.TerminalNode + WITH() antlr.TerminalNode + TIES() antlr.TerminalNode + + // IsLimit_clauseContext differentiates from other interfaces. + IsLimit_clauseContext() +} + +type Limit_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLimit_clauseContext() *Limit_clauseContext { + var p = new(Limit_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_limit_clause + return p +} + +func InitEmptyLimit_clauseContext(p *Limit_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_limit_clause +} + +func (*Limit_clauseContext) IsLimit_clauseContext() {} + +func NewLimit_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Limit_clauseContext { + var p = new(Limit_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_limit_clause + + return p +} + +func (s *Limit_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Limit_clauseContext) LIMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIMIT, 0) +} + +func (s *Limit_clauseContext) Select_limit_value() ISelect_limit_valueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_limit_valueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_limit_valueContext) +} + +func (s *Limit_clauseContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Limit_clauseContext) Select_offset_value() ISelect_offset_valueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_offset_valueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_offset_valueContext) +} + +func (s *Limit_clauseContext) FETCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFETCH, 0) +} + +func (s *Limit_clauseContext) First_or_next() IFirst_or_nextContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFirst_or_nextContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFirst_or_nextContext) +} + +func (s *Limit_clauseContext) Select_fetch_first_value() ISelect_fetch_first_valueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_fetch_first_valueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_fetch_first_valueContext) +} + +func (s *Limit_clauseContext) Row_or_rows() IRow_or_rowsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRow_or_rowsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRow_or_rowsContext) +} + +func (s *Limit_clauseContext) ONLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserONLY, 0) +} + +func (s *Limit_clauseContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Limit_clauseContext) TIES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIES, 0) +} + +func (s *Limit_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Limit_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Limit_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterLimit_clause(s) + } +} + +func (s *Limit_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitLimit_clause(s) + } +} + +func (s *Limit_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitLimit_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Limit_clause() (localctx ILimit_clauseContext) { + localctx = NewLimit_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1018, PostgreSQLParserRULE_limit_clause) + var _la int + + p.SetState(8706) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserLIMIT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8683) + p.Match(PostgreSQLParserLIMIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8684) + p.Select_limit_value() + } + p.SetState(8687) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(8685) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8686) + p.Select_offset_value() + } + + } + + case PostgreSQLParserFETCH: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8689) + p.Match(PostgreSQLParserFETCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8690) + p.First_or_next() + } + p.SetState(8704) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 775, p.GetParserRuleContext()) { + case 1: + { + p.SetState(8691) + p.Select_fetch_first_value() + } + { + p.SetState(8692) + p.Row_or_rows() + } + p.SetState(8696) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserONLY: + { + p.SetState(8693) + p.Match(PostgreSQLParserONLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserWITH: + { + p.SetState(8694) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8695) + p.Match(PostgreSQLParserTIES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 2: + { + p.SetState(8698) + p.Row_or_rows() + } + p.SetState(8702) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserONLY: + { + p.SetState(8699) + p.Match(PostgreSQLParserONLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserWITH: + { + p.SetState(8700) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8701) + p.Match(PostgreSQLParserTIES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOffset_clauseContext is an interface to support dynamic dispatch. +type IOffset_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OFFSET() antlr.TerminalNode + Select_offset_value() ISelect_offset_valueContext + Select_fetch_first_value() ISelect_fetch_first_valueContext + Row_or_rows() IRow_or_rowsContext + + // IsOffset_clauseContext differentiates from other interfaces. + IsOffset_clauseContext() +} + +type Offset_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOffset_clauseContext() *Offset_clauseContext { + var p = new(Offset_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_offset_clause + return p +} + +func InitEmptyOffset_clauseContext(p *Offset_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_offset_clause +} + +func (*Offset_clauseContext) IsOffset_clauseContext() {} + +func NewOffset_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Offset_clauseContext { + var p = new(Offset_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_offset_clause + + return p +} + +func (s *Offset_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Offset_clauseContext) OFFSET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOFFSET, 0) +} + +func (s *Offset_clauseContext) Select_offset_value() ISelect_offset_valueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_offset_valueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_offset_valueContext) +} + +func (s *Offset_clauseContext) Select_fetch_first_value() ISelect_fetch_first_valueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_fetch_first_valueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_fetch_first_valueContext) +} + +func (s *Offset_clauseContext) Row_or_rows() IRow_or_rowsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRow_or_rowsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRow_or_rowsContext) +} + +func (s *Offset_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Offset_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Offset_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOffset_clause(s) + } +} + +func (s *Offset_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOffset_clause(s) + } +} + +func (s *Offset_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOffset_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Offset_clause() (localctx IOffset_clauseContext) { + localctx = NewOffset_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1020, PostgreSQLParserRULE_offset_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8708) + p.Match(PostgreSQLParserOFFSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8713) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 777, p.GetParserRuleContext()) { + case 1: + { + p.SetState(8709) + p.Select_offset_value() + } + + case 2: + { + p.SetState(8710) + p.Select_fetch_first_value() + } + { + p.SetState(8711) + p.Row_or_rows() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelect_limit_valueContext is an interface to support dynamic dispatch. +type ISelect_limit_valueContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + ALL() antlr.TerminalNode + + // IsSelect_limit_valueContext differentiates from other interfaces. + IsSelect_limit_valueContext() +} + +type Select_limit_valueContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_limit_valueContext() *Select_limit_valueContext { + var p = new(Select_limit_valueContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_limit_value + return p +} + +func InitEmptySelect_limit_valueContext(p *Select_limit_valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_limit_value +} + +func (*Select_limit_valueContext) IsSelect_limit_valueContext() {} + +func NewSelect_limit_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_limit_valueContext { + var p = new(Select_limit_valueContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_select_limit_value + + return p +} + +func (s *Select_limit_valueContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_limit_valueContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Select_limit_valueContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Select_limit_valueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_limit_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_limit_valueContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSelect_limit_value(s) + } +} + +func (s *Select_limit_valueContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSelect_limit_value(s) + } +} + +func (s *Select_limit_valueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSelect_limit_value(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Select_limit_value() (localctx ISelect_limit_valueContext) { + localctx = NewSelect_limit_valueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1022, PostgreSQLParserRULE_select_limit_value) + p.SetState(8717) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN, PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserPARAM, PostgreSQLParserOperator, PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNOT, PostgreSQLParserNULL_P, PostgreSQLParserSESSION_USER, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserRIGHT, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserBinaryStringConstant, PostgreSQLParserHexadecimalStringConstant, PostgreSQLParserIntegral, PostgreSQLParserNumeric, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8715) + p.A_expr() + } + + case PostgreSQLParserALL: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8716) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelect_offset_valueContext is an interface to support dynamic dispatch. +type ISelect_offset_valueContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + + // IsSelect_offset_valueContext differentiates from other interfaces. + IsSelect_offset_valueContext() +} + +type Select_offset_valueContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_offset_valueContext() *Select_offset_valueContext { + var p = new(Select_offset_valueContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_offset_value + return p +} + +func InitEmptySelect_offset_valueContext(p *Select_offset_valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_offset_value +} + +func (*Select_offset_valueContext) IsSelect_offset_valueContext() {} + +func NewSelect_offset_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_offset_valueContext { + var p = new(Select_offset_valueContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_select_offset_value + + return p +} + +func (s *Select_offset_valueContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_offset_valueContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Select_offset_valueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_offset_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_offset_valueContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSelect_offset_value(s) + } +} + +func (s *Select_offset_valueContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSelect_offset_value(s) + } +} + +func (s *Select_offset_valueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSelect_offset_value(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Select_offset_value() (localctx ISelect_offset_valueContext) { + localctx = NewSelect_offset_valueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1024, PostgreSQLParserRULE_select_offset_value) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8719) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISelect_fetch_first_valueContext is an interface to support dynamic dispatch. +type ISelect_fetch_first_valueContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + C_expr() IC_exprContext + PLUS() antlr.TerminalNode + I_or_f_const() II_or_f_constContext + MINUS() antlr.TerminalNode + + // IsSelect_fetch_first_valueContext differentiates from other interfaces. + IsSelect_fetch_first_valueContext() +} + +type Select_fetch_first_valueContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_fetch_first_valueContext() *Select_fetch_first_valueContext { + var p = new(Select_fetch_first_valueContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_fetch_first_value + return p +} + +func InitEmptySelect_fetch_first_valueContext(p *Select_fetch_first_valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_select_fetch_first_value +} + +func (*Select_fetch_first_valueContext) IsSelect_fetch_first_valueContext() {} + +func NewSelect_fetch_first_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_fetch_first_valueContext { + var p = new(Select_fetch_first_valueContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_select_fetch_first_value + + return p +} + +func (s *Select_fetch_first_valueContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_fetch_first_valueContext) C_expr() IC_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IC_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IC_exprContext) +} + +func (s *Select_fetch_first_valueContext) PLUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLUS, 0) +} + +func (s *Select_fetch_first_valueContext) I_or_f_const() II_or_f_constContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(II_or_f_constContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(II_or_f_constContext) +} + +func (s *Select_fetch_first_valueContext) MINUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUS, 0) +} + +func (s *Select_fetch_first_valueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_fetch_first_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_fetch_first_valueContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSelect_fetch_first_value(s) + } +} + +func (s *Select_fetch_first_valueContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSelect_fetch_first_value(s) + } +} + +func (s *Select_fetch_first_valueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSelect_fetch_first_value(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Select_fetch_first_value() (localctx ISelect_fetch_first_valueContext) { + localctx = NewSelect_fetch_first_valueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1026, PostgreSQLParserRULE_select_fetch_first_value) + p.SetState(8726) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN, PostgreSQLParserPARAM, PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNULL_P, PostgreSQLParserSESSION_USER, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserRIGHT, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserBinaryStringConstant, PostgreSQLParserHexadecimalStringConstant, PostgreSQLParserIntegral, PostgreSQLParserNumeric, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8721) + p.C_expr() + } + + case PostgreSQLParserPLUS: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8722) + p.Match(PostgreSQLParserPLUS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8723) + p.I_or_f_const() + } + + case PostgreSQLParserMINUS: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8724) + p.Match(PostgreSQLParserMINUS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8725) + p.I_or_f_const() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// II_or_f_constContext is an interface to support dynamic dispatch. +type II_or_f_constContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Iconst() IIconstContext + Fconst() IFconstContext + + // IsI_or_f_constContext differentiates from other interfaces. + IsI_or_f_constContext() +} + +type I_or_f_constContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyI_or_f_constContext() *I_or_f_constContext { + var p = new(I_or_f_constContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_i_or_f_const + return p +} + +func InitEmptyI_or_f_constContext(p *I_or_f_constContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_i_or_f_const +} + +func (*I_or_f_constContext) IsI_or_f_constContext() {} + +func NewI_or_f_constContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *I_or_f_constContext { + var p = new(I_or_f_constContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_i_or_f_const + + return p +} + +func (s *I_or_f_constContext) GetParser() antlr.Parser { return s.parser } + +func (s *I_or_f_constContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *I_or_f_constContext) Fconst() IFconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFconstContext) +} + +func (s *I_or_f_constContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *I_or_f_constContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *I_or_f_constContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterI_or_f_const(s) + } +} + +func (s *I_or_f_constContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitI_or_f_const(s) + } +} + +func (s *I_or_f_constContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitI_or_f_const(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) I_or_f_const() (localctx II_or_f_constContext) { + localctx = NewI_or_f_constContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1028, PostgreSQLParserRULE_i_or_f_const) + p.SetState(8730) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserIntegral: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8728) + p.Iconst() + } + + case PostgreSQLParserNumeric: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8729) + p.Fconst() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRow_or_rowsContext is an interface to support dynamic dispatch. +type IRow_or_rowsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ROW() antlr.TerminalNode + ROWS() antlr.TerminalNode + + // IsRow_or_rowsContext differentiates from other interfaces. + IsRow_or_rowsContext() +} + +type Row_or_rowsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRow_or_rowsContext() *Row_or_rowsContext { + var p = new(Row_or_rowsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_row_or_rows + return p +} + +func InitEmptyRow_or_rowsContext(p *Row_or_rowsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_row_or_rows +} + +func (*Row_or_rowsContext) IsRow_or_rowsContext() {} + +func NewRow_or_rowsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Row_or_rowsContext { + var p = new(Row_or_rowsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_row_or_rows + + return p +} + +func (s *Row_or_rowsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Row_or_rowsContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *Row_or_rowsContext) ROWS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROWS, 0) +} + +func (s *Row_or_rowsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Row_or_rowsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Row_or_rowsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRow_or_rows(s) + } +} + +func (s *Row_or_rowsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRow_or_rows(s) + } +} + +func (s *Row_or_rowsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRow_or_rows(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Row_or_rows() (localctx IRow_or_rowsContext) { + localctx = NewRow_or_rowsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1030, PostgreSQLParserRULE_row_or_rows) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8732) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserROWS || _la == PostgreSQLParserROW) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFirst_or_nextContext is an interface to support dynamic dispatch. +type IFirst_or_nextContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FIRST_P() antlr.TerminalNode + NEXT() antlr.TerminalNode + + // IsFirst_or_nextContext differentiates from other interfaces. + IsFirst_or_nextContext() +} + +type First_or_nextContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFirst_or_nextContext() *First_or_nextContext { + var p = new(First_or_nextContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_first_or_next + return p +} + +func InitEmptyFirst_or_nextContext(p *First_or_nextContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_first_or_next +} + +func (*First_or_nextContext) IsFirst_or_nextContext() {} + +func NewFirst_or_nextContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *First_or_nextContext { + var p = new(First_or_nextContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_first_or_next + + return p +} + +func (s *First_or_nextContext) GetParser() antlr.Parser { return s.parser } + +func (s *First_or_nextContext) FIRST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFIRST_P, 0) +} + +func (s *First_or_nextContext) NEXT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNEXT, 0) +} + +func (s *First_or_nextContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *First_or_nextContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *First_or_nextContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFirst_or_next(s) + } +} + +func (s *First_or_nextContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFirst_or_next(s) + } +} + +func (s *First_or_nextContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFirst_or_next(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) First_or_next() (localctx IFirst_or_nextContext) { + localctx = NewFirst_or_nextContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1032, PostgreSQLParserRULE_first_or_next) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8734) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFIRST_P || _la == PostgreSQLParserNEXT) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGroup_clauseContext is an interface to support dynamic dispatch. +type IGroup_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GROUP_P() antlr.TerminalNode + BY() antlr.TerminalNode + Group_by_list() IGroup_by_listContext + + // IsGroup_clauseContext differentiates from other interfaces. + IsGroup_clauseContext() +} + +type Group_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGroup_clauseContext() *Group_clauseContext { + var p = new(Group_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_group_clause + return p +} + +func InitEmptyGroup_clauseContext(p *Group_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_group_clause +} + +func (*Group_clauseContext) IsGroup_clauseContext() {} + +func NewGroup_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Group_clauseContext { + var p = new(Group_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_group_clause + + return p +} + +func (s *Group_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Group_clauseContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *Group_clauseContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Group_clauseContext) Group_by_list() IGroup_by_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGroup_by_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGroup_by_listContext) +} + +func (s *Group_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Group_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Group_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGroup_clause(s) + } +} + +func (s *Group_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGroup_clause(s) + } +} + +func (s *Group_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGroup_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Group_clause() (localctx IGroup_clauseContext) { + localctx = NewGroup_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1034, PostgreSQLParserRULE_group_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8736) + p.Match(PostgreSQLParserGROUP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8737) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8738) + p.Group_by_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGroup_by_listContext is an interface to support dynamic dispatch. +type IGroup_by_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllGroup_by_item() []IGroup_by_itemContext + Group_by_item(i int) IGroup_by_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsGroup_by_listContext differentiates from other interfaces. + IsGroup_by_listContext() +} + +type Group_by_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGroup_by_listContext() *Group_by_listContext { + var p = new(Group_by_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_group_by_list + return p +} + +func InitEmptyGroup_by_listContext(p *Group_by_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_group_by_list +} + +func (*Group_by_listContext) IsGroup_by_listContext() {} + +func NewGroup_by_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Group_by_listContext { + var p = new(Group_by_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_group_by_list + + return p +} + +func (s *Group_by_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Group_by_listContext) AllGroup_by_item() []IGroup_by_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IGroup_by_itemContext); ok { + len++ + } + } + + tst := make([]IGroup_by_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IGroup_by_itemContext); ok { + tst[i] = t.(IGroup_by_itemContext) + i++ + } + } + + return tst +} + +func (s *Group_by_listContext) Group_by_item(i int) IGroup_by_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGroup_by_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IGroup_by_itemContext) +} + +func (s *Group_by_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Group_by_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Group_by_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Group_by_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Group_by_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGroup_by_list(s) + } +} + +func (s *Group_by_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGroup_by_list(s) + } +} + +func (s *Group_by_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGroup_by_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Group_by_list() (localctx IGroup_by_listContext) { + localctx = NewGroup_by_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1036, PostgreSQLParserRULE_group_by_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8740) + p.Group_by_item() + } + p.SetState(8745) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 781, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(8741) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8742) + p.Group_by_item() + } + + } + p.SetState(8747) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 781, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGroup_by_itemContext is an interface to support dynamic dispatch. +type IGroup_by_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + Empty_grouping_set() IEmpty_grouping_setContext + Cube_clause() ICube_clauseContext + Rollup_clause() IRollup_clauseContext + Grouping_sets_clause() IGrouping_sets_clauseContext + + // IsGroup_by_itemContext differentiates from other interfaces. + IsGroup_by_itemContext() +} + +type Group_by_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGroup_by_itemContext() *Group_by_itemContext { + var p = new(Group_by_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_group_by_item + return p +} + +func InitEmptyGroup_by_itemContext(p *Group_by_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_group_by_item +} + +func (*Group_by_itemContext) IsGroup_by_itemContext() {} + +func NewGroup_by_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Group_by_itemContext { + var p = new(Group_by_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_group_by_item + + return p +} + +func (s *Group_by_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Group_by_itemContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Group_by_itemContext) Empty_grouping_set() IEmpty_grouping_setContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IEmpty_grouping_setContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IEmpty_grouping_setContext) +} + +func (s *Group_by_itemContext) Cube_clause() ICube_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICube_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICube_clauseContext) +} + +func (s *Group_by_itemContext) Rollup_clause() IRollup_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRollup_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRollup_clauseContext) +} + +func (s *Group_by_itemContext) Grouping_sets_clause() IGrouping_sets_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGrouping_sets_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGrouping_sets_clauseContext) +} + +func (s *Group_by_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Group_by_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Group_by_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGroup_by_item(s) + } +} + +func (s *Group_by_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGroup_by_item(s) + } +} + +func (s *Group_by_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGroup_by_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Group_by_item() (localctx IGroup_by_itemContext) { + localctx = NewGroup_by_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1038, PostgreSQLParserRULE_group_by_item) + p.SetState(8753) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 782, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8748) + p.A_expr() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8749) + p.Empty_grouping_set() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8750) + p.Cube_clause() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(8751) + p.Rollup_clause() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(8752) + p.Grouping_sets_clause() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IEmpty_grouping_setContext is an interface to support dynamic dispatch. +type IEmpty_grouping_setContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + + // IsEmpty_grouping_setContext differentiates from other interfaces. + IsEmpty_grouping_setContext() +} + +type Empty_grouping_setContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyEmpty_grouping_setContext() *Empty_grouping_setContext { + var p = new(Empty_grouping_setContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_empty_grouping_set + return p +} + +func InitEmptyEmpty_grouping_setContext(p *Empty_grouping_setContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_empty_grouping_set +} + +func (*Empty_grouping_setContext) IsEmpty_grouping_setContext() {} + +func NewEmpty_grouping_setContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Empty_grouping_setContext { + var p = new(Empty_grouping_setContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_empty_grouping_set + + return p +} + +func (s *Empty_grouping_setContext) GetParser() antlr.Parser { return s.parser } + +func (s *Empty_grouping_setContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Empty_grouping_setContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Empty_grouping_setContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Empty_grouping_setContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Empty_grouping_setContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterEmpty_grouping_set(s) + } +} + +func (s *Empty_grouping_setContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitEmpty_grouping_set(s) + } +} + +func (s *Empty_grouping_setContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitEmpty_grouping_set(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Empty_grouping_set() (localctx IEmpty_grouping_setContext) { + localctx = NewEmpty_grouping_setContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1040, PostgreSQLParserRULE_empty_grouping_set) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8755) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8756) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRollup_clauseContext is an interface to support dynamic dispatch. +type IRollup_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ROLLUP() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsRollup_clauseContext differentiates from other interfaces. + IsRollup_clauseContext() +} + +type Rollup_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRollup_clauseContext() *Rollup_clauseContext { + var p = new(Rollup_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rollup_clause + return p +} + +func InitEmptyRollup_clauseContext(p *Rollup_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rollup_clause +} + +func (*Rollup_clauseContext) IsRollup_clauseContext() {} + +func NewRollup_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rollup_clauseContext { + var p = new(Rollup_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rollup_clause + + return p +} + +func (s *Rollup_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Rollup_clauseContext) ROLLUP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLLUP, 0) +} + +func (s *Rollup_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Rollup_clauseContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Rollup_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Rollup_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Rollup_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Rollup_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRollup_clause(s) + } +} + +func (s *Rollup_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRollup_clause(s) + } +} + +func (s *Rollup_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRollup_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rollup_clause() (localctx IRollup_clauseContext) { + localctx = NewRollup_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1042, PostgreSQLParserRULE_rollup_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8758) + p.Match(PostgreSQLParserROLLUP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8759) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8760) + p.Expr_list() + } + { + p.SetState(8761) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICube_clauseContext is an interface to support dynamic dispatch. +type ICube_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CUBE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsCube_clauseContext differentiates from other interfaces. + IsCube_clauseContext() +} + +type Cube_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCube_clauseContext() *Cube_clauseContext { + var p = new(Cube_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cube_clause + return p +} + +func InitEmptyCube_clauseContext(p *Cube_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cube_clause +} + +func (*Cube_clauseContext) IsCube_clauseContext() {} + +func NewCube_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cube_clauseContext { + var p = new(Cube_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_cube_clause + + return p +} + +func (s *Cube_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Cube_clauseContext) CUBE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCUBE, 0) +} + +func (s *Cube_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Cube_clauseContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Cube_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Cube_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Cube_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Cube_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCube_clause(s) + } +} + +func (s *Cube_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCube_clause(s) + } +} + +func (s *Cube_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCube_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Cube_clause() (localctx ICube_clauseContext) { + localctx = NewCube_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1044, PostgreSQLParserRULE_cube_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8763) + p.Match(PostgreSQLParserCUBE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8764) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8765) + p.Expr_list() + } + { + p.SetState(8766) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGrouping_sets_clauseContext is an interface to support dynamic dispatch. +type IGrouping_sets_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GROUPING() antlr.TerminalNode + SETS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Group_by_list() IGroup_by_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsGrouping_sets_clauseContext differentiates from other interfaces. + IsGrouping_sets_clauseContext() +} + +type Grouping_sets_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGrouping_sets_clauseContext() *Grouping_sets_clauseContext { + var p = new(Grouping_sets_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grouping_sets_clause + return p +} + +func InitEmptyGrouping_sets_clauseContext(p *Grouping_sets_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_grouping_sets_clause +} + +func (*Grouping_sets_clauseContext) IsGrouping_sets_clauseContext() {} + +func NewGrouping_sets_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Grouping_sets_clauseContext { + var p = new(Grouping_sets_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_grouping_sets_clause + + return p +} + +func (s *Grouping_sets_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Grouping_sets_clauseContext) GROUPING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUPING, 0) +} + +func (s *Grouping_sets_clauseContext) SETS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSETS, 0) +} + +func (s *Grouping_sets_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Grouping_sets_clauseContext) Group_by_list() IGroup_by_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGroup_by_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGroup_by_listContext) +} + +func (s *Grouping_sets_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Grouping_sets_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Grouping_sets_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Grouping_sets_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGrouping_sets_clause(s) + } +} + +func (s *Grouping_sets_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGrouping_sets_clause(s) + } +} + +func (s *Grouping_sets_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGrouping_sets_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Grouping_sets_clause() (localctx IGrouping_sets_clauseContext) { + localctx = NewGrouping_sets_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1046, PostgreSQLParserRULE_grouping_sets_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8768) + p.Match(PostgreSQLParserGROUPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8769) + p.Match(PostgreSQLParserSETS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8770) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8771) + p.Group_by_list() + } + { + p.SetState(8772) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IHaving_clauseContext is an interface to support dynamic dispatch. +type IHaving_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + HAVING() antlr.TerminalNode + A_expr() IA_exprContext + + // IsHaving_clauseContext differentiates from other interfaces. + IsHaving_clauseContext() +} + +type Having_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyHaving_clauseContext() *Having_clauseContext { + var p = new(Having_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_having_clause + return p +} + +func InitEmptyHaving_clauseContext(p *Having_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_having_clause +} + +func (*Having_clauseContext) IsHaving_clauseContext() {} + +func NewHaving_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Having_clauseContext { + var p = new(Having_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_having_clause + + return p +} + +func (s *Having_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Having_clauseContext) HAVING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHAVING, 0) +} + +func (s *Having_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Having_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Having_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Having_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterHaving_clause(s) + } +} + +func (s *Having_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitHaving_clause(s) + } +} + +func (s *Having_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitHaving_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Having_clause() (localctx IHaving_clauseContext) { + localctx = NewHaving_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1048, PostgreSQLParserRULE_having_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8774) + p.Match(PostgreSQLParserHAVING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8775) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFor_locking_clauseContext is an interface to support dynamic dispatch. +type IFor_locking_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + For_locking_items() IFor_locking_itemsContext + FOR() antlr.TerminalNode + READ() antlr.TerminalNode + ONLY() antlr.TerminalNode + + // IsFor_locking_clauseContext differentiates from other interfaces. + IsFor_locking_clauseContext() +} + +type For_locking_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFor_locking_clauseContext() *For_locking_clauseContext { + var p = new(For_locking_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_locking_clause + return p +} + +func InitEmptyFor_locking_clauseContext(p *For_locking_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_locking_clause +} + +func (*For_locking_clauseContext) IsFor_locking_clauseContext() {} + +func NewFor_locking_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *For_locking_clauseContext { + var p = new(For_locking_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_for_locking_clause + + return p +} + +func (s *For_locking_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *For_locking_clauseContext) For_locking_items() IFor_locking_itemsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFor_locking_itemsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFor_locking_itemsContext) +} + +func (s *For_locking_clauseContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *For_locking_clauseContext) READ() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREAD, 0) +} + +func (s *For_locking_clauseContext) ONLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserONLY, 0) +} + +func (s *For_locking_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *For_locking_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *For_locking_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFor_locking_clause(s) + } +} + +func (s *For_locking_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFor_locking_clause(s) + } +} + +func (s *For_locking_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFor_locking_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) For_locking_clause() (localctx IFor_locking_clauseContext) { + localctx = NewFor_locking_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1050, PostgreSQLParserRULE_for_locking_clause) + p.SetState(8781) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 783, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8777) + p.For_locking_items() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8778) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8779) + p.Match(PostgreSQLParserREAD) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8780) + p.Match(PostgreSQLParserONLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_for_locking_clauseContext is an interface to support dynamic dispatch. +type IOpt_for_locking_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + For_locking_clause() IFor_locking_clauseContext + + // IsOpt_for_locking_clauseContext differentiates from other interfaces. + IsOpt_for_locking_clauseContext() +} + +type Opt_for_locking_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_for_locking_clauseContext() *Opt_for_locking_clauseContext { + var p = new(Opt_for_locking_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_for_locking_clause + return p +} + +func InitEmptyOpt_for_locking_clauseContext(p *Opt_for_locking_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_for_locking_clause +} + +func (*Opt_for_locking_clauseContext) IsOpt_for_locking_clauseContext() {} + +func NewOpt_for_locking_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_for_locking_clauseContext { + var p = new(Opt_for_locking_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_for_locking_clause + + return p +} + +func (s *Opt_for_locking_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_for_locking_clauseContext) For_locking_clause() IFor_locking_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFor_locking_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFor_locking_clauseContext) +} + +func (s *Opt_for_locking_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_for_locking_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_for_locking_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_for_locking_clause(s) + } +} + +func (s *Opt_for_locking_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_for_locking_clause(s) + } +} + +func (s *Opt_for_locking_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_for_locking_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_for_locking_clause() (localctx IOpt_for_locking_clauseContext) { + localctx = NewOpt_for_locking_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1052, PostgreSQLParserRULE_opt_for_locking_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8783) + p.For_locking_clause() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFor_locking_itemsContext is an interface to support dynamic dispatch. +type IFor_locking_itemsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllFor_locking_item() []IFor_locking_itemContext + For_locking_item(i int) IFor_locking_itemContext + + // IsFor_locking_itemsContext differentiates from other interfaces. + IsFor_locking_itemsContext() +} + +type For_locking_itemsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFor_locking_itemsContext() *For_locking_itemsContext { + var p = new(For_locking_itemsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_locking_items + return p +} + +func InitEmptyFor_locking_itemsContext(p *For_locking_itemsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_locking_items +} + +func (*For_locking_itemsContext) IsFor_locking_itemsContext() {} + +func NewFor_locking_itemsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *For_locking_itemsContext { + var p = new(For_locking_itemsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_for_locking_items + + return p +} + +func (s *For_locking_itemsContext) GetParser() antlr.Parser { return s.parser } + +func (s *For_locking_itemsContext) AllFor_locking_item() []IFor_locking_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFor_locking_itemContext); ok { + len++ + } + } + + tst := make([]IFor_locking_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFor_locking_itemContext); ok { + tst[i] = t.(IFor_locking_itemContext) + i++ + } + } + + return tst +} + +func (s *For_locking_itemsContext) For_locking_item(i int) IFor_locking_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFor_locking_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFor_locking_itemContext) +} + +func (s *For_locking_itemsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *For_locking_itemsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *For_locking_itemsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFor_locking_items(s) + } +} + +func (s *For_locking_itemsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFor_locking_items(s) + } +} + +func (s *For_locking_itemsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFor_locking_items(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) For_locking_items() (localctx IFor_locking_itemsContext) { + localctx = NewFor_locking_itemsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1054, PostgreSQLParserRULE_for_locking_items) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8786) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == PostgreSQLParserFOR { + { + p.SetState(8785) + p.For_locking_item() + } + + p.SetState(8788) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFor_locking_itemContext is an interface to support dynamic dispatch. +type IFor_locking_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + For_locking_strength() IFor_locking_strengthContext + Locked_rels_list() ILocked_rels_listContext + Opt_nowait_or_skip() IOpt_nowait_or_skipContext + + // IsFor_locking_itemContext differentiates from other interfaces. + IsFor_locking_itemContext() +} + +type For_locking_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFor_locking_itemContext() *For_locking_itemContext { + var p = new(For_locking_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_locking_item + return p +} + +func InitEmptyFor_locking_itemContext(p *For_locking_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_locking_item +} + +func (*For_locking_itemContext) IsFor_locking_itemContext() {} + +func NewFor_locking_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *For_locking_itemContext { + var p = new(For_locking_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_for_locking_item + + return p +} + +func (s *For_locking_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *For_locking_itemContext) For_locking_strength() IFor_locking_strengthContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFor_locking_strengthContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFor_locking_strengthContext) +} + +func (s *For_locking_itemContext) Locked_rels_list() ILocked_rels_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILocked_rels_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILocked_rels_listContext) +} + +func (s *For_locking_itemContext) Opt_nowait_or_skip() IOpt_nowait_or_skipContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_nowait_or_skipContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_nowait_or_skipContext) +} + +func (s *For_locking_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *For_locking_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *For_locking_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFor_locking_item(s) + } +} + +func (s *For_locking_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFor_locking_item(s) + } +} + +func (s *For_locking_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFor_locking_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) For_locking_item() (localctx IFor_locking_itemContext) { + localctx = NewFor_locking_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1056, PostgreSQLParserRULE_for_locking_item) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8790) + p.For_locking_strength() + } + p.SetState(8792) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOF { + { + p.SetState(8791) + p.Locked_rels_list() + } + + } + p.SetState(8795) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOWAIT || _la == PostgreSQLParserSKIP_P { + { + p.SetState(8794) + p.Opt_nowait_or_skip() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFor_locking_strengthContext is an interface to support dynamic dispatch. +type IFor_locking_strengthContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FOR() antlr.TerminalNode + UPDATE() antlr.TerminalNode + SHARE() antlr.TerminalNode + NO() antlr.TerminalNode + KEY() antlr.TerminalNode + + // IsFor_locking_strengthContext differentiates from other interfaces. + IsFor_locking_strengthContext() +} + +type For_locking_strengthContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFor_locking_strengthContext() *For_locking_strengthContext { + var p = new(For_locking_strengthContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_locking_strength + return p +} + +func InitEmptyFor_locking_strengthContext(p *For_locking_strengthContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_locking_strength +} + +func (*For_locking_strengthContext) IsFor_locking_strengthContext() {} + +func NewFor_locking_strengthContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *For_locking_strengthContext { + var p = new(For_locking_strengthContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_for_locking_strength + + return p +} + +func (s *For_locking_strengthContext) GetParser() antlr.Parser { return s.parser } + +func (s *For_locking_strengthContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *For_locking_strengthContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *For_locking_strengthContext) SHARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSHARE, 0) +} + +func (s *For_locking_strengthContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *For_locking_strengthContext) KEY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserKEY, 0) +} + +func (s *For_locking_strengthContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *For_locking_strengthContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *For_locking_strengthContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFor_locking_strength(s) + } +} + +func (s *For_locking_strengthContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFor_locking_strength(s) + } +} + +func (s *For_locking_strengthContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFor_locking_strength(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) For_locking_strength() (localctx IFor_locking_strengthContext) { + localctx = NewFor_locking_strengthContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1058, PostgreSQLParserRULE_for_locking_strength) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8797) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8807) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNO, PostgreSQLParserUPDATE: + p.SetState(8800) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(8798) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8799) + p.Match(PostgreSQLParserKEY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8802) + p.Match(PostgreSQLParserUPDATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserKEY, PostgreSQLParserSHARE: + p.SetState(8804) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserKEY { + { + p.SetState(8803) + p.Match(PostgreSQLParserKEY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8806) + p.Match(PostgreSQLParserSHARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILocked_rels_listContext is an interface to support dynamic dispatch. +type ILocked_rels_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OF() antlr.TerminalNode + Qualified_name_list() IQualified_name_listContext + + // IsLocked_rels_listContext differentiates from other interfaces. + IsLocked_rels_listContext() +} + +type Locked_rels_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLocked_rels_listContext() *Locked_rels_listContext { + var p = new(Locked_rels_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_locked_rels_list + return p +} + +func InitEmptyLocked_rels_listContext(p *Locked_rels_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_locked_rels_list +} + +func (*Locked_rels_listContext) IsLocked_rels_listContext() {} + +func NewLocked_rels_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Locked_rels_listContext { + var p = new(Locked_rels_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_locked_rels_list + + return p +} + +func (s *Locked_rels_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Locked_rels_listContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *Locked_rels_listContext) Qualified_name_list() IQualified_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_name_listContext) +} + +func (s *Locked_rels_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Locked_rels_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Locked_rels_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterLocked_rels_list(s) + } +} + +func (s *Locked_rels_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitLocked_rels_list(s) + } +} + +func (s *Locked_rels_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitLocked_rels_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Locked_rels_list() (localctx ILocked_rels_listContext) { + localctx = NewLocked_rels_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1060, PostgreSQLParserRULE_locked_rels_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8809) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8810) + p.Qualified_name_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IValues_clauseContext is an interface to support dynamic dispatch. +type IValues_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + VALUES() antlr.TerminalNode + AllOPEN_PAREN() []antlr.TerminalNode + OPEN_PAREN(i int) antlr.TerminalNode + AllExpr_list() []IExpr_listContext + Expr_list(i int) IExpr_listContext + AllCLOSE_PAREN() []antlr.TerminalNode + CLOSE_PAREN(i int) antlr.TerminalNode + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsValues_clauseContext differentiates from other interfaces. + IsValues_clauseContext() +} + +type Values_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyValues_clauseContext() *Values_clauseContext { + var p = new(Values_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_values_clause + return p +} + +func InitEmptyValues_clauseContext(p *Values_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_values_clause +} + +func (*Values_clauseContext) IsValues_clauseContext() {} + +func NewValues_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Values_clauseContext { + var p = new(Values_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_values_clause + + return p +} + +func (s *Values_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Values_clauseContext) VALUES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUES, 0) +} + +func (s *Values_clauseContext) AllOPEN_PAREN() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserOPEN_PAREN) +} + +func (s *Values_clauseContext) OPEN_PAREN(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, i) +} + +func (s *Values_clauseContext) AllExpr_list() []IExpr_listContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IExpr_listContext); ok { + len++ + } + } + + tst := make([]IExpr_listContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IExpr_listContext); ok { + tst[i] = t.(IExpr_listContext) + i++ + } + } + + return tst +} + +func (s *Values_clauseContext) Expr_list(i int) IExpr_listContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Values_clauseContext) AllCLOSE_PAREN() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCLOSE_PAREN) +} + +func (s *Values_clauseContext) CLOSE_PAREN(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, i) +} + +func (s *Values_clauseContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Values_clauseContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Values_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Values_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Values_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterValues_clause(s) + } +} + +func (s *Values_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitValues_clause(s) + } +} + +func (s *Values_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitValues_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Values_clause() (localctx IValues_clauseContext) { + localctx = NewValues_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1062, PostgreSQLParserRULE_values_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8812) + p.Match(PostgreSQLParserVALUES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8813) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8814) + p.Expr_list() + } + { + p.SetState(8815) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8823) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8816) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8817) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8818) + p.Expr_list() + } + { + p.SetState(8819) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + p.SetState(8825) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFrom_clauseContext is an interface to support dynamic dispatch. +type IFrom_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FROM() antlr.TerminalNode + From_list() IFrom_listContext + + // IsFrom_clauseContext differentiates from other interfaces. + IsFrom_clauseContext() +} + +type From_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFrom_clauseContext() *From_clauseContext { + var p = new(From_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_from_clause + return p +} + +func InitEmptyFrom_clauseContext(p *From_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_from_clause +} + +func (*From_clauseContext) IsFrom_clauseContext() {} + +func NewFrom_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *From_clauseContext { + var p = new(From_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_from_clause + + return p +} + +func (s *From_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *From_clauseContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *From_clauseContext) From_list() IFrom_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_listContext) +} + +func (s *From_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *From_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *From_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFrom_clause(s) + } +} + +func (s *From_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFrom_clause(s) + } +} + +func (s *From_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFrom_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) From_clause() (localctx IFrom_clauseContext) { + localctx = NewFrom_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1064, PostgreSQLParserRULE_from_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8826) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8827) + p.From_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFrom_listContext is an interface to support dynamic dispatch. +type IFrom_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTable_ref() []ITable_refContext + Table_ref(i int) ITable_refContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsFrom_listContext differentiates from other interfaces. + IsFrom_listContext() +} + +type From_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFrom_listContext() *From_listContext { + var p = new(From_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_from_list + return p +} + +func InitEmptyFrom_listContext(p *From_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_from_list +} + +func (*From_listContext) IsFrom_listContext() {} + +func NewFrom_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *From_listContext { + var p = new(From_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_from_list + + return p +} + +func (s *From_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *From_listContext) AllTable_ref() []ITable_refContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITable_refContext); ok { + len++ + } + } + + tst := make([]ITable_refContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITable_refContext); ok { + tst[i] = t.(ITable_refContext) + i++ + } + } + + return tst +} + +func (s *From_listContext) Table_ref(i int) ITable_refContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_refContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITable_refContext) +} + +func (s *From_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *From_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *From_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *From_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *From_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFrom_list(s) + } +} + +func (s *From_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFrom_list(s) + } +} + +func (s *From_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFrom_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) From_list() (localctx IFrom_listContext) { + localctx = NewFrom_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1066, PostgreSQLParserRULE_from_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8829) + p.Table_ref() + } + p.SetState(8834) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 791, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(8830) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8831) + p.Table_ref() + } + + } + p.SetState(8836) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 791, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITable_refContext is an interface to support dynamic dispatch. +type ITable_refContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Relation_expr() IRelation_exprContext + Func_table() IFunc_tableContext + Xmltable() IXmltableContext + Select_with_parens() ISelect_with_parensContext + LATERAL_P() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + AllTable_ref() []ITable_refContext + Table_ref(i int) ITable_refContext + CLOSE_PAREN() antlr.TerminalNode + AllJoined_table() []IJoined_tableContext + Joined_table(i int) IJoined_tableContext + Opt_alias_clause() IOpt_alias_clauseContext + Tablesample_clause() ITablesample_clauseContext + Func_alias_clause() IFunc_alias_clauseContext + CROSS() antlr.TerminalNode + JOIN() antlr.TerminalNode + NATURAL() antlr.TerminalNode + Join_qual() IJoin_qualContext + Join_type() IJoin_typeContext + + // IsTable_refContext differentiates from other interfaces. + IsTable_refContext() +} + +type Table_refContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTable_refContext() *Table_refContext { + var p = new(Table_refContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_ref + return p +} + +func InitEmptyTable_refContext(p *Table_refContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_ref +} + +func (*Table_refContext) IsTable_refContext() {} + +func NewTable_refContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_refContext { + var p = new(Table_refContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_table_ref + + return p +} + +func (s *Table_refContext) GetParser() antlr.Parser { return s.parser } + +func (s *Table_refContext) Relation_expr() IRelation_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *Table_refContext) Func_table() IFunc_tableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_tableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_tableContext) +} + +func (s *Table_refContext) Xmltable() IXmltableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXmltableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXmltableContext) +} + +func (s *Table_refContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *Table_refContext) LATERAL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLATERAL_P, 0) +} + +func (s *Table_refContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Table_refContext) AllTable_ref() []ITable_refContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITable_refContext); ok { + len++ + } + } + + tst := make([]ITable_refContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITable_refContext); ok { + tst[i] = t.(ITable_refContext) + i++ + } + } + + return tst +} + +func (s *Table_refContext) Table_ref(i int) ITable_refContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_refContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITable_refContext) +} + +func (s *Table_refContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Table_refContext) AllJoined_table() []IJoined_tableContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IJoined_tableContext); ok { + len++ + } + } + + tst := make([]IJoined_tableContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IJoined_tableContext); ok { + tst[i] = t.(IJoined_tableContext) + i++ + } + } + + return tst +} + +func (s *Table_refContext) Joined_table(i int) IJoined_tableContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IJoined_tableContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IJoined_tableContext) +} + +func (s *Table_refContext) Opt_alias_clause() IOpt_alias_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_alias_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_alias_clauseContext) +} + +func (s *Table_refContext) Tablesample_clause() ITablesample_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablesample_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITablesample_clauseContext) +} + +func (s *Table_refContext) Func_alias_clause() IFunc_alias_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_alias_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_alias_clauseContext) +} + +func (s *Table_refContext) CROSS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCROSS, 0) +} + +func (s *Table_refContext) JOIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserJOIN, 0) +} + +func (s *Table_refContext) NATURAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNATURAL, 0) +} + +func (s *Table_refContext) Join_qual() IJoin_qualContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IJoin_qualContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IJoin_qualContext) +} + +func (s *Table_refContext) Join_type() IJoin_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IJoin_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IJoin_typeContext) +} + +func (s *Table_refContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Table_refContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Table_refContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTable_ref(s) + } +} + +func (s *Table_refContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTable_ref(s) + } +} + +func (s *Table_refContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTable_ref(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Table_ref() (localctx ITable_refContext) { + localctx = NewTable_refContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1068, PostgreSQLParserRULE_table_ref) + var _la int + + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8895) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 805, p.GetParserRuleContext()) { + case 1: + { + p.SetState(8837) + p.Relation_expr() + } + p.SetState(8839) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 792, p.GetParserRuleContext()) == 1 { + { + p.SetState(8838) + p.Opt_alias_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(8842) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserTABLESAMPLE { + { + p.SetState(8841) + p.Tablesample_clause() + } + + } + + case 2: + { + p.SetState(8844) + p.Func_table() + } + p.SetState(8846) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 794, p.GetParserRuleContext()) == 1 { + { + p.SetState(8845) + p.Func_alias_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 3: + { + p.SetState(8848) + p.Xmltable() + } + p.SetState(8850) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 795, p.GetParserRuleContext()) == 1 { + { + p.SetState(8849) + p.Opt_alias_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 4: + { + p.SetState(8852) + p.Select_with_parens() + } + p.SetState(8854) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 796, p.GetParserRuleContext()) == 1 { + { + p.SetState(8853) + p.Opt_alias_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 5: + { + p.SetState(8856) + p.Match(PostgreSQLParserLATERAL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8869) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 800, p.GetParserRuleContext()) { + case 1: + { + p.SetState(8857) + p.Xmltable() + } + p.SetState(8859) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 797, p.GetParserRuleContext()) == 1 { + { + p.SetState(8858) + p.Opt_alias_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + { + p.SetState(8861) + p.Func_table() + } + p.SetState(8863) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 798, p.GetParserRuleContext()) == 1 { + { + p.SetState(8862) + p.Func_alias_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 3: + { + p.SetState(8865) + p.Select_with_parens() + } + p.SetState(8867) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 799, p.GetParserRuleContext()) == 1 { + { + p.SetState(8866) + p.Opt_alias_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + case 6: + { + p.SetState(8871) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8872) + p.Table_ref() + } + p.SetState(8889) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserCROSS: + { + p.SetState(8873) + p.Match(PostgreSQLParserCROSS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8874) + p.Match(PostgreSQLParserJOIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8875) + p.Table_ref() + } + + case PostgreSQLParserNATURAL: + { + p.SetState(8876) + p.Match(PostgreSQLParserNATURAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8878) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-113)) & ^0x3f) == 0 && ((int64(1)<<(_la-113))&8261) != 0 { + { + p.SetState(8877) + p.Join_type() + } + + } + { + p.SetState(8880) + p.Match(PostgreSQLParserJOIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8881) + p.Table_ref() + } + + case PostgreSQLParserFULL, PostgreSQLParserINNER_P, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserRIGHT: + p.SetState(8883) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-113)) & ^0x3f) == 0 && ((int64(1)<<(_la-113))&8261) != 0 { + { + p.SetState(8882) + p.Join_type() + } + + } + { + p.SetState(8885) + p.Match(PostgreSQLParserJOIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8886) + p.Table_ref() + } + { + p.SetState(8887) + p.Join_qual() + } + + case PostgreSQLParserCLOSE_PAREN: + + default: + } + { + p.SetState(8891) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8893) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 804, p.GetParserRuleContext()) == 1 { + { + p.SetState(8892) + p.Opt_alias_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + p.SetState(8900) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 806, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(8897) + p.Joined_table() + } + + } + p.SetState(8902) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 806, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IJoined_tableContext is an interface to support dynamic dispatch. +type IJoined_tableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + JOIN() antlr.TerminalNode + Table_ref() ITable_refContext + Join_qual() IJoin_qualContext + Join_type() IJoin_typeContext + CROSS() antlr.TerminalNode + NATURAL() antlr.TerminalNode + + // IsJoined_tableContext differentiates from other interfaces. + IsJoined_tableContext() +} + +type Joined_tableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyJoined_tableContext() *Joined_tableContext { + var p = new(Joined_tableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_joined_table + return p +} + +func InitEmptyJoined_tableContext(p *Joined_tableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_joined_table +} + +func (*Joined_tableContext) IsJoined_tableContext() {} + +func NewJoined_tableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Joined_tableContext { + var p = new(Joined_tableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_joined_table + + return p +} + +func (s *Joined_tableContext) GetParser() antlr.Parser { return s.parser } + +func (s *Joined_tableContext) JOIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserJOIN, 0) +} + +func (s *Joined_tableContext) Table_ref() ITable_refContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_refContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITable_refContext) +} + +func (s *Joined_tableContext) Join_qual() IJoin_qualContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IJoin_qualContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IJoin_qualContext) +} + +func (s *Joined_tableContext) Join_type() IJoin_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IJoin_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IJoin_typeContext) +} + +func (s *Joined_tableContext) CROSS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCROSS, 0) +} + +func (s *Joined_tableContext) NATURAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNATURAL, 0) +} + +func (s *Joined_tableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Joined_tableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Joined_tableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterJoined_table(s) + } +} + +func (s *Joined_tableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitJoined_table(s) + } +} + +func (s *Joined_tableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitJoined_table(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Joined_table() (localctx IJoined_tableContext) { + localctx = NewJoined_tableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1070, PostgreSQLParserRULE_joined_table) + var _la int + + p.SetState(8919) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserFULL, PostgreSQLParserINNER_P, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserRIGHT: + p.EnterOuterAlt(localctx, 1) + p.SetState(8904) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-113)) & ^0x3f) == 0 && ((int64(1)<<(_la-113))&8261) != 0 { + { + p.SetState(8903) + p.Join_type() + } + + } + { + p.SetState(8906) + p.Match(PostgreSQLParserJOIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8907) + p.Table_ref() + } + { + p.SetState(8908) + p.Join_qual() + } + + case PostgreSQLParserCROSS: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8910) + p.Match(PostgreSQLParserCROSS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8911) + p.Match(PostgreSQLParserJOIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8912) + p.Table_ref() + } + + case PostgreSQLParserNATURAL: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(8913) + p.Match(PostgreSQLParserNATURAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8915) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-113)) & ^0x3f) == 0 && ((int64(1)<<(_la-113))&8261) != 0 { + { + p.SetState(8914) + p.Join_type() + } + + } + { + p.SetState(8917) + p.Match(PostgreSQLParserJOIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8918) + p.Table_ref() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAlias_clauseContext is an interface to support dynamic dispatch. +type IAlias_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + AS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Name_list() IName_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsAlias_clauseContext differentiates from other interfaces. + IsAlias_clauseContext() +} + +type Alias_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAlias_clauseContext() *Alias_clauseContext { + var p = new(Alias_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alias_clause + return p +} + +func InitEmptyAlias_clauseContext(p *Alias_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_alias_clause +} + +func (*Alias_clauseContext) IsAlias_clauseContext() {} + +func NewAlias_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Alias_clauseContext { + var p = new(Alias_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_alias_clause + + return p +} + +func (s *Alias_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Alias_clauseContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Alias_clauseContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Alias_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Alias_clauseContext) Name_list() IName_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IName_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IName_listContext) +} + +func (s *Alias_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Alias_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Alias_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Alias_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAlias_clause(s) + } +} + +func (s *Alias_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAlias_clause(s) + } +} + +func (s *Alias_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAlias_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Alias_clause() (localctx IAlias_clauseContext) { + localctx = NewAlias_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1072, PostgreSQLParserRULE_alias_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8922) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(8921) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8924) + p.Colid() + } + p.SetState(8929) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 811, p.GetParserRuleContext()) == 1 { + { + p.SetState(8925) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8926) + p.Name_list() + } + { + p.SetState(8927) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_alias_clauseContext is an interface to support dynamic dispatch. +type IOpt_alias_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Table_alias_clause() ITable_alias_clauseContext + + // IsOpt_alias_clauseContext differentiates from other interfaces. + IsOpt_alias_clauseContext() +} + +type Opt_alias_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_alias_clauseContext() *Opt_alias_clauseContext { + var p = new(Opt_alias_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_alias_clause + return p +} + +func InitEmptyOpt_alias_clauseContext(p *Opt_alias_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_alias_clause +} + +func (*Opt_alias_clauseContext) IsOpt_alias_clauseContext() {} + +func NewOpt_alias_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_alias_clauseContext { + var p = new(Opt_alias_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_alias_clause + + return p +} + +func (s *Opt_alias_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_alias_clauseContext) Table_alias_clause() ITable_alias_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_alias_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITable_alias_clauseContext) +} + +func (s *Opt_alias_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_alias_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_alias_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_alias_clause(s) + } +} + +func (s *Opt_alias_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_alias_clause(s) + } +} + +func (s *Opt_alias_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_alias_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_alias_clause() (localctx IOpt_alias_clauseContext) { + localctx = NewOpt_alias_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1074, PostgreSQLParserRULE_opt_alias_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8931) + p.Table_alias_clause() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITable_alias_clauseContext is an interface to support dynamic dispatch. +type ITable_alias_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Table_alias() ITable_aliasContext + AS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Name_list() IName_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsTable_alias_clauseContext differentiates from other interfaces. + IsTable_alias_clauseContext() +} + +type Table_alias_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTable_alias_clauseContext() *Table_alias_clauseContext { + var p = new(Table_alias_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_alias_clause + return p +} + +func InitEmptyTable_alias_clauseContext(p *Table_alias_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_alias_clause +} + +func (*Table_alias_clauseContext) IsTable_alias_clauseContext() {} + +func NewTable_alias_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_alias_clauseContext { + var p = new(Table_alias_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_table_alias_clause + + return p +} + +func (s *Table_alias_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Table_alias_clauseContext) Table_alias() ITable_aliasContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITable_aliasContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITable_aliasContext) +} + +func (s *Table_alias_clauseContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Table_alias_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Table_alias_clauseContext) Name_list() IName_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IName_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IName_listContext) +} + +func (s *Table_alias_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Table_alias_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Table_alias_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Table_alias_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTable_alias_clause(s) + } +} + +func (s *Table_alias_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTable_alias_clause(s) + } +} + +func (s *Table_alias_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTable_alias_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Table_alias_clause() (localctx ITable_alias_clauseContext) { + localctx = NewTable_alias_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1076, PostgreSQLParserRULE_table_alias_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(8934) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(8933) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8936) + p.Table_alias() + } + p.SetState(8941) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 813, p.GetParserRuleContext()) == 1 { + { + p.SetState(8937) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8938) + p.Name_list() + } + { + p.SetState(8939) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_alias_clauseContext is an interface to support dynamic dispatch. +type IFunc_alias_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Alias_clause() IAlias_clauseContext + OPEN_PAREN() antlr.TerminalNode + Tablefuncelementlist() ITablefuncelementlistContext + CLOSE_PAREN() antlr.TerminalNode + AS() antlr.TerminalNode + Colid() IColidContext + + // IsFunc_alias_clauseContext differentiates from other interfaces. + IsFunc_alias_clauseContext() +} + +type Func_alias_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_alias_clauseContext() *Func_alias_clauseContext { + var p = new(Func_alias_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_alias_clause + return p +} + +func InitEmptyFunc_alias_clauseContext(p *Func_alias_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_alias_clause +} + +func (*Func_alias_clauseContext) IsFunc_alias_clauseContext() {} + +func NewFunc_alias_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_alias_clauseContext { + var p = new(Func_alias_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_alias_clause + + return p +} + +func (s *Func_alias_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_alias_clauseContext) Alias_clause() IAlias_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAlias_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAlias_clauseContext) +} + +func (s *Func_alias_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Func_alias_clauseContext) Tablefuncelementlist() ITablefuncelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablefuncelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITablefuncelementlistContext) +} + +func (s *Func_alias_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Func_alias_clauseContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Func_alias_clauseContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Func_alias_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_alias_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_alias_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_alias_clause(s) + } +} + +func (s *Func_alias_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_alias_clause(s) + } +} + +func (s *Func_alias_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_alias_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_alias_clause() (localctx IFunc_alias_clauseContext) { + localctx = NewFunc_alias_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1078, PostgreSQLParserRULE_func_alias_clause) + var _la int + + p.SetState(8955) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 816, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8943) + p.Alias_clause() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + p.SetState(8949) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAS: + { + p.SetState(8944) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8946) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(8945) + p.Colid() + } + + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(8948) + p.Colid() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(8951) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8952) + p.Tablefuncelementlist() + } + { + p.SetState(8953) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IJoin_typeContext is an interface to support dynamic dispatch. +type IJoin_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FULL() antlr.TerminalNode + LEFT() antlr.TerminalNode + RIGHT() antlr.TerminalNode + INNER_P() antlr.TerminalNode + OUTER_P() antlr.TerminalNode + + // IsJoin_typeContext differentiates from other interfaces. + IsJoin_typeContext() +} + +type Join_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyJoin_typeContext() *Join_typeContext { + var p = new(Join_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_join_type + return p +} + +func InitEmptyJoin_typeContext(p *Join_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_join_type +} + +func (*Join_typeContext) IsJoin_typeContext() {} + +func NewJoin_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Join_typeContext { + var p = new(Join_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_join_type + + return p +} + +func (s *Join_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Join_typeContext) FULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFULL, 0) +} + +func (s *Join_typeContext) LEFT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEFT, 0) +} + +func (s *Join_typeContext) RIGHT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRIGHT, 0) +} + +func (s *Join_typeContext) INNER_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINNER_P, 0) +} + +func (s *Join_typeContext) OUTER_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOUTER_P, 0) +} + +func (s *Join_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Join_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Join_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterJoin_type(s) + } +} + +func (s *Join_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitJoin_type(s) + } +} + +func (s *Join_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitJoin_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Join_type() (localctx IJoin_typeContext) { + localctx = NewJoin_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1080, PostgreSQLParserRULE_join_type) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8957) + _la = p.GetTokenStream().LA(1) + + if !((int64((_la-113)) & ^0x3f) == 0 && ((int64(1)<<(_la-113))&8261) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(8959) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOUTER_P { + { + p.SetState(8958) + p.Match(PostgreSQLParserOUTER_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IJoin_qualContext is an interface to support dynamic dispatch. +type IJoin_qualContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Name_list() IName_listContext + CLOSE_PAREN() antlr.TerminalNode + ON() antlr.TerminalNode + A_expr() IA_exprContext + + // IsJoin_qualContext differentiates from other interfaces. + IsJoin_qualContext() +} + +type Join_qualContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyJoin_qualContext() *Join_qualContext { + var p = new(Join_qualContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_join_qual + return p +} + +func InitEmptyJoin_qualContext(p *Join_qualContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_join_qual +} + +func (*Join_qualContext) IsJoin_qualContext() {} + +func NewJoin_qualContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Join_qualContext { + var p = new(Join_qualContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_join_qual + + return p +} + +func (s *Join_qualContext) GetParser() antlr.Parser { return s.parser } + +func (s *Join_qualContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Join_qualContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Join_qualContext) Name_list() IName_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IName_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IName_listContext) +} + +func (s *Join_qualContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Join_qualContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Join_qualContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Join_qualContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Join_qualContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Join_qualContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterJoin_qual(s) + } +} + +func (s *Join_qualContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitJoin_qual(s) + } +} + +func (s *Join_qualContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitJoin_qual(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Join_qual() (localctx IJoin_qualContext) { + localctx = NewJoin_qualContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1082, PostgreSQLParserRULE_join_qual) + p.SetState(8968) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserUSING: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8961) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8962) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8963) + p.Name_list() + } + { + p.SetState(8964) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserON: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8966) + p.Match(PostgreSQLParserON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8967) + p.A_expr() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRelation_exprContext is an interface to support dynamic dispatch. +type IRelation_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Qualified_name() IQualified_nameContext + STAR() antlr.TerminalNode + ONLY() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + + // IsRelation_exprContext differentiates from other interfaces. + IsRelation_exprContext() +} + +type Relation_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRelation_exprContext() *Relation_exprContext { + var p = new(Relation_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_relation_expr + return p +} + +func InitEmptyRelation_exprContext(p *Relation_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_relation_expr +} + +func (*Relation_exprContext) IsRelation_exprContext() {} + +func NewRelation_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Relation_exprContext { + var p = new(Relation_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_relation_expr + + return p +} + +func (s *Relation_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *Relation_exprContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Relation_exprContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *Relation_exprContext) ONLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserONLY, 0) +} + +func (s *Relation_exprContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Relation_exprContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Relation_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Relation_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Relation_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRelation_expr(s) + } +} + +func (s *Relation_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRelation_expr(s) + } +} + +func (s *Relation_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRelation_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Relation_expr() (localctx IRelation_exprContext) { + localctx = NewRelation_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1084, PostgreSQLParserRULE_relation_expr) + var _la int + + p.SetState(8982) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8970) + p.Qualified_name() + } + p.SetState(8972) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSTAR { + { + p.SetState(8971) + p.Match(PostgreSQLParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + + case PostgreSQLParserONLY: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(8974) + p.Match(PostgreSQLParserONLY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(8980) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(8975) + p.Qualified_name() + } + + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(8976) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8977) + p.Qualified_name() + } + { + p.SetState(8978) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRelation_expr_listContext is an interface to support dynamic dispatch. +type IRelation_expr_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllRelation_expr() []IRelation_exprContext + Relation_expr(i int) IRelation_exprContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsRelation_expr_listContext differentiates from other interfaces. + IsRelation_expr_listContext() +} + +type Relation_expr_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRelation_expr_listContext() *Relation_expr_listContext { + var p = new(Relation_expr_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_relation_expr_list + return p +} + +func InitEmptyRelation_expr_listContext(p *Relation_expr_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_relation_expr_list +} + +func (*Relation_expr_listContext) IsRelation_expr_listContext() {} + +func NewRelation_expr_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Relation_expr_listContext { + var p = new(Relation_expr_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_relation_expr_list + + return p +} + +func (s *Relation_expr_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Relation_expr_listContext) AllRelation_expr() []IRelation_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRelation_exprContext); ok { + len++ + } + } + + tst := make([]IRelation_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRelation_exprContext); ok { + tst[i] = t.(IRelation_exprContext) + i++ + } + } + + return tst +} + +func (s *Relation_expr_listContext) Relation_expr(i int) IRelation_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *Relation_expr_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Relation_expr_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Relation_expr_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Relation_expr_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Relation_expr_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRelation_expr_list(s) + } +} + +func (s *Relation_expr_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRelation_expr_list(s) + } +} + +func (s *Relation_expr_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRelation_expr_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Relation_expr_list() (localctx IRelation_expr_listContext) { + localctx = NewRelation_expr_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1086, PostgreSQLParserRULE_relation_expr_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8984) + p.Relation_expr() + } + p.SetState(8989) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(8985) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(8986) + p.Relation_expr() + } + + p.SetState(8991) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRelation_expr_opt_aliasContext is an interface to support dynamic dispatch. +type IRelation_expr_opt_aliasContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Relation_expr() IRelation_exprContext + Colid() IColidContext + AS() antlr.TerminalNode + + // IsRelation_expr_opt_aliasContext differentiates from other interfaces. + IsRelation_expr_opt_aliasContext() +} + +type Relation_expr_opt_aliasContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRelation_expr_opt_aliasContext() *Relation_expr_opt_aliasContext { + var p = new(Relation_expr_opt_aliasContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_relation_expr_opt_alias + return p +} + +func InitEmptyRelation_expr_opt_aliasContext(p *Relation_expr_opt_aliasContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_relation_expr_opt_alias +} + +func (*Relation_expr_opt_aliasContext) IsRelation_expr_opt_aliasContext() {} + +func NewRelation_expr_opt_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Relation_expr_opt_aliasContext { + var p = new(Relation_expr_opt_aliasContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_relation_expr_opt_alias + + return p +} + +func (s *Relation_expr_opt_aliasContext) GetParser() antlr.Parser { return s.parser } + +func (s *Relation_expr_opt_aliasContext) Relation_expr() IRelation_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelation_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRelation_exprContext) +} + +func (s *Relation_expr_opt_aliasContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Relation_expr_opt_aliasContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Relation_expr_opt_aliasContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Relation_expr_opt_aliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Relation_expr_opt_aliasContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRelation_expr_opt_alias(s) + } +} + +func (s *Relation_expr_opt_aliasContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRelation_expr_opt_alias(s) + } +} + +func (s *Relation_expr_opt_aliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRelation_expr_opt_alias(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Relation_expr_opt_alias() (localctx IRelation_expr_opt_aliasContext) { + localctx = NewRelation_expr_opt_aliasContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1088, PostgreSQLParserRULE_relation_expr_opt_alias) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8992) + p.Relation_expr() + } + p.SetState(8997) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 824, p.GetParserRuleContext()) == 1 { + p.SetState(8994) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(8993) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(8996) + p.Colid() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITablesample_clauseContext is an interface to support dynamic dispatch. +type ITablesample_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TABLESAMPLE() antlr.TerminalNode + Func_name() IFunc_nameContext + OPEN_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + CLOSE_PAREN() antlr.TerminalNode + Opt_repeatable_clause() IOpt_repeatable_clauseContext + + // IsTablesample_clauseContext differentiates from other interfaces. + IsTablesample_clauseContext() +} + +type Tablesample_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTablesample_clauseContext() *Tablesample_clauseContext { + var p = new(Tablesample_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablesample_clause + return p +} + +func InitEmptyTablesample_clauseContext(p *Tablesample_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablesample_clause +} + +func (*Tablesample_clauseContext) IsTablesample_clauseContext() {} + +func NewTablesample_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Tablesample_clauseContext { + var p = new(Tablesample_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tablesample_clause + + return p +} + +func (s *Tablesample_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Tablesample_clauseContext) TABLESAMPLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESAMPLE, 0) +} + +func (s *Tablesample_clauseContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *Tablesample_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Tablesample_clauseContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Tablesample_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Tablesample_clauseContext) Opt_repeatable_clause() IOpt_repeatable_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_repeatable_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_repeatable_clauseContext) +} + +func (s *Tablesample_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Tablesample_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Tablesample_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTablesample_clause(s) + } +} + +func (s *Tablesample_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTablesample_clause(s) + } +} + +func (s *Tablesample_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTablesample_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tablesample_clause() (localctx ITablesample_clauseContext) { + localctx = NewTablesample_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1090, PostgreSQLParserRULE_tablesample_clause) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(8999) + p.Match(PostgreSQLParserTABLESAMPLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9000) + p.Func_name() + } + { + p.SetState(9001) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9002) + p.Expr_list() + } + { + p.SetState(9003) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9005) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserREPEATABLE { + { + p.SetState(9004) + p.Opt_repeatable_clause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_repeatable_clauseContext is an interface to support dynamic dispatch. +type IOpt_repeatable_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + REPEATABLE() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_repeatable_clauseContext differentiates from other interfaces. + IsOpt_repeatable_clauseContext() +} + +type Opt_repeatable_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_repeatable_clauseContext() *Opt_repeatable_clauseContext { + var p = new(Opt_repeatable_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_repeatable_clause + return p +} + +func InitEmptyOpt_repeatable_clauseContext(p *Opt_repeatable_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_repeatable_clause +} + +func (*Opt_repeatable_clauseContext) IsOpt_repeatable_clauseContext() {} + +func NewOpt_repeatable_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_repeatable_clauseContext { + var p = new(Opt_repeatable_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_repeatable_clause + + return p +} + +func (s *Opt_repeatable_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_repeatable_clauseContext) REPEATABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPEATABLE, 0) +} + +func (s *Opt_repeatable_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_repeatable_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_repeatable_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_repeatable_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_repeatable_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_repeatable_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_repeatable_clause(s) + } +} + +func (s *Opt_repeatable_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_repeatable_clause(s) + } +} + +func (s *Opt_repeatable_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_repeatable_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_repeatable_clause() (localctx IOpt_repeatable_clauseContext) { + localctx = NewOpt_repeatable_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1092, PostgreSQLParserRULE_opt_repeatable_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9007) + p.Match(PostgreSQLParserREPEATABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9008) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9009) + p.A_expr() + } + { + p.SetState(9010) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_tableContext is an interface to support dynamic dispatch. +type IFunc_tableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_expr_windowless() IFunc_expr_windowlessContext + Opt_ordinality() IOpt_ordinalityContext + ROWS() antlr.TerminalNode + FROM() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Rowsfrom_list() IRowsfrom_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsFunc_tableContext differentiates from other interfaces. + IsFunc_tableContext() +} + +type Func_tableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_tableContext() *Func_tableContext { + var p = new(Func_tableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_table + return p +} + +func InitEmptyFunc_tableContext(p *Func_tableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_table +} + +func (*Func_tableContext) IsFunc_tableContext() {} + +func NewFunc_tableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_tableContext { + var p = new(Func_tableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_table + + return p +} + +func (s *Func_tableContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_tableContext) Func_expr_windowless() IFunc_expr_windowlessContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_expr_windowlessContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_expr_windowlessContext) +} + +func (s *Func_tableContext) Opt_ordinality() IOpt_ordinalityContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_ordinalityContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_ordinalityContext) +} + +func (s *Func_tableContext) ROWS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROWS, 0) +} + +func (s *Func_tableContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Func_tableContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Func_tableContext) Rowsfrom_list() IRowsfrom_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsfrom_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRowsfrom_listContext) +} + +func (s *Func_tableContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Func_tableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_tableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_tableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_table(s) + } +} + +func (s *Func_tableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_table(s) + } +} + +func (s *Func_tableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_table(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_table() (localctx IFunc_tableContext) { + localctx = NewFunc_tableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1094, PostgreSQLParserRULE_func_table) + p.SetState(9024) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 828, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9012) + p.Func_expr_windowless() + } + p.SetState(9014) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 826, p.GetParserRuleContext()) == 1 { + { + p.SetState(9013) + p.Opt_ordinality() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9016) + p.Match(PostgreSQLParserROWS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9017) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9018) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9019) + p.Rowsfrom_list() + } + { + p.SetState(9020) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9022) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 827, p.GetParserRuleContext()) == 1 { + { + p.SetState(9021) + p.Opt_ordinality() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowsfrom_itemContext is an interface to support dynamic dispatch. +type IRowsfrom_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_expr_windowless() IFunc_expr_windowlessContext + Opt_col_def_list() IOpt_col_def_listContext + + // IsRowsfrom_itemContext differentiates from other interfaces. + IsRowsfrom_itemContext() +} + +type Rowsfrom_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowsfrom_itemContext() *Rowsfrom_itemContext { + var p = new(Rowsfrom_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsfrom_item + return p +} + +func InitEmptyRowsfrom_itemContext(p *Rowsfrom_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsfrom_item +} + +func (*Rowsfrom_itemContext) IsRowsfrom_itemContext() {} + +func NewRowsfrom_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rowsfrom_itemContext { + var p = new(Rowsfrom_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rowsfrom_item + + return p +} + +func (s *Rowsfrom_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Rowsfrom_itemContext) Func_expr_windowless() IFunc_expr_windowlessContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_expr_windowlessContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_expr_windowlessContext) +} + +func (s *Rowsfrom_itemContext) Opt_col_def_list() IOpt_col_def_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_col_def_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_col_def_listContext) +} + +func (s *Rowsfrom_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Rowsfrom_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Rowsfrom_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRowsfrom_item(s) + } +} + +func (s *Rowsfrom_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRowsfrom_item(s) + } +} + +func (s *Rowsfrom_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRowsfrom_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rowsfrom_item() (localctx IRowsfrom_itemContext) { + localctx = NewRowsfrom_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1096, PostgreSQLParserRULE_rowsfrom_item) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9026) + p.Func_expr_windowless() + } + p.SetState(9028) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(9027) + p.Opt_col_def_list() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowsfrom_listContext is an interface to support dynamic dispatch. +type IRowsfrom_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllRowsfrom_item() []IRowsfrom_itemContext + Rowsfrom_item(i int) IRowsfrom_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsRowsfrom_listContext differentiates from other interfaces. + IsRowsfrom_listContext() +} + +type Rowsfrom_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowsfrom_listContext() *Rowsfrom_listContext { + var p = new(Rowsfrom_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsfrom_list + return p +} + +func InitEmptyRowsfrom_listContext(p *Rowsfrom_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rowsfrom_list +} + +func (*Rowsfrom_listContext) IsRowsfrom_listContext() {} + +func NewRowsfrom_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Rowsfrom_listContext { + var p = new(Rowsfrom_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rowsfrom_list + + return p +} + +func (s *Rowsfrom_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Rowsfrom_listContext) AllRowsfrom_item() []IRowsfrom_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRowsfrom_itemContext); ok { + len++ + } + } + + tst := make([]IRowsfrom_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRowsfrom_itemContext); ok { + tst[i] = t.(IRowsfrom_itemContext) + i++ + } + } + + return tst +} + +func (s *Rowsfrom_listContext) Rowsfrom_item(i int) IRowsfrom_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowsfrom_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRowsfrom_itemContext) +} + +func (s *Rowsfrom_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Rowsfrom_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Rowsfrom_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Rowsfrom_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Rowsfrom_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRowsfrom_list(s) + } +} + +func (s *Rowsfrom_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRowsfrom_list(s) + } +} + +func (s *Rowsfrom_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRowsfrom_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rowsfrom_list() (localctx IRowsfrom_listContext) { + localctx = NewRowsfrom_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1098, PostgreSQLParserRULE_rowsfrom_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9030) + p.Rowsfrom_item() + } + p.SetState(9035) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(9031) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9032) + p.Rowsfrom_item() + } + + p.SetState(9037) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_col_def_listContext is an interface to support dynamic dispatch. +type IOpt_col_def_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AS() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Tablefuncelementlist() ITablefuncelementlistContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_col_def_listContext differentiates from other interfaces. + IsOpt_col_def_listContext() +} + +type Opt_col_def_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_col_def_listContext() *Opt_col_def_listContext { + var p = new(Opt_col_def_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_col_def_list + return p +} + +func InitEmptyOpt_col_def_listContext(p *Opt_col_def_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_col_def_list +} + +func (*Opt_col_def_listContext) IsOpt_col_def_listContext() {} + +func NewOpt_col_def_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_col_def_listContext { + var p = new(Opt_col_def_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_col_def_list + + return p +} + +func (s *Opt_col_def_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_col_def_listContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Opt_col_def_listContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_col_def_listContext) Tablefuncelementlist() ITablefuncelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablefuncelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITablefuncelementlistContext) +} + +func (s *Opt_col_def_listContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_col_def_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_col_def_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_col_def_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_col_def_list(s) + } +} + +func (s *Opt_col_def_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_col_def_list(s) + } +} + +func (s *Opt_col_def_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_col_def_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_col_def_list() (localctx IOpt_col_def_listContext) { + localctx = NewOpt_col_def_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1100, PostgreSQLParserRULE_opt_col_def_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9038) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9039) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9040) + p.Tablefuncelementlist() + } + { + p.SetState(9041) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_ordinalityContext is an interface to support dynamic dispatch. +type IOpt_ordinalityContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + ORDINALITY() antlr.TerminalNode + + // IsOpt_ordinalityContext differentiates from other interfaces. + IsOpt_ordinalityContext() +} + +type Opt_ordinalityContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_ordinalityContext() *Opt_ordinalityContext { + var p = new(Opt_ordinalityContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_ordinality + return p +} + +func InitEmptyOpt_ordinalityContext(p *Opt_ordinalityContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_ordinality +} + +func (*Opt_ordinalityContext) IsOpt_ordinalityContext() {} + +func NewOpt_ordinalityContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_ordinalityContext { + var p = new(Opt_ordinalityContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_ordinality + + return p +} + +func (s *Opt_ordinalityContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_ordinalityContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_ordinalityContext) ORDINALITY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserORDINALITY, 0) +} + +func (s *Opt_ordinalityContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_ordinalityContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_ordinalityContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_ordinality(s) + } +} + +func (s *Opt_ordinalityContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_ordinality(s) + } +} + +func (s *Opt_ordinalityContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_ordinality(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_ordinality() (localctx IOpt_ordinalityContext) { + localctx = NewOpt_ordinalityContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1102, PostgreSQLParserRULE_opt_ordinality) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9043) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9044) + p.Match(PostgreSQLParserORDINALITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWhere_clauseContext is an interface to support dynamic dispatch. +type IWhere_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHERE() antlr.TerminalNode + A_expr() IA_exprContext + + // IsWhere_clauseContext differentiates from other interfaces. + IsWhere_clauseContext() +} + +type Where_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWhere_clauseContext() *Where_clauseContext { + var p = new(Where_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_where_clause + return p +} + +func InitEmptyWhere_clauseContext(p *Where_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_where_clause +} + +func (*Where_clauseContext) IsWhere_clauseContext() {} + +func NewWhere_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Where_clauseContext { + var p = new(Where_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_where_clause + + return p +} + +func (s *Where_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Where_clauseContext) WHERE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHERE, 0) +} + +func (s *Where_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Where_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Where_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Where_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWhere_clause(s) + } +} + +func (s *Where_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWhere_clause(s) + } +} + +func (s *Where_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWhere_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Where_clause() (localctx IWhere_clauseContext) { + localctx = NewWhere_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1104, PostgreSQLParserRULE_where_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9046) + p.Match(PostgreSQLParserWHERE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9047) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWhere_or_current_clauseContext is an interface to support dynamic dispatch. +type IWhere_or_current_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHERE() antlr.TerminalNode + CURRENT_P() antlr.TerminalNode + OF() antlr.TerminalNode + Cursor_name() ICursor_nameContext + A_expr() IA_exprContext + + // IsWhere_or_current_clauseContext differentiates from other interfaces. + IsWhere_or_current_clauseContext() +} + +type Where_or_current_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWhere_or_current_clauseContext() *Where_or_current_clauseContext { + var p = new(Where_or_current_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_where_or_current_clause + return p +} + +func InitEmptyWhere_or_current_clauseContext(p *Where_or_current_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_where_or_current_clause +} + +func (*Where_or_current_clauseContext) IsWhere_or_current_clauseContext() {} + +func NewWhere_or_current_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Where_or_current_clauseContext { + var p = new(Where_or_current_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_where_or_current_clause + + return p +} + +func (s *Where_or_current_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Where_or_current_clauseContext) WHERE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHERE, 0) +} + +func (s *Where_or_current_clauseContext) CURRENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_P, 0) +} + +func (s *Where_or_current_clauseContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *Where_or_current_clauseContext) Cursor_name() ICursor_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_nameContext) +} + +func (s *Where_or_current_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Where_or_current_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Where_or_current_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Where_or_current_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWhere_or_current_clause(s) + } +} + +func (s *Where_or_current_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWhere_or_current_clause(s) + } +} + +func (s *Where_or_current_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWhere_or_current_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Where_or_current_clause() (localctx IWhere_or_current_clauseContext) { + localctx = NewWhere_or_current_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1106, PostgreSQLParserRULE_where_or_current_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9049) + p.Match(PostgreSQLParserWHERE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9054) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 831, p.GetParserRuleContext()) { + case 1: + { + p.SetState(9050) + p.Match(PostgreSQLParserCURRENT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9051) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9052) + p.Cursor_name() + } + + case 2: + { + p.SetState(9053) + p.A_expr() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpttablefuncelementlistContext is an interface to support dynamic dispatch. +type IOpttablefuncelementlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Tablefuncelementlist() ITablefuncelementlistContext + + // IsOpttablefuncelementlistContext differentiates from other interfaces. + IsOpttablefuncelementlistContext() +} + +type OpttablefuncelementlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpttablefuncelementlistContext() *OpttablefuncelementlistContext { + var p = new(OpttablefuncelementlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttablefuncelementlist + return p +} + +func InitEmptyOpttablefuncelementlistContext(p *OpttablefuncelementlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opttablefuncelementlist +} + +func (*OpttablefuncelementlistContext) IsOpttablefuncelementlistContext() {} + +func NewOpttablefuncelementlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OpttablefuncelementlistContext { + var p = new(OpttablefuncelementlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opttablefuncelementlist + + return p +} + +func (s *OpttablefuncelementlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *OpttablefuncelementlistContext) Tablefuncelementlist() ITablefuncelementlistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablefuncelementlistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITablefuncelementlistContext) +} + +func (s *OpttablefuncelementlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *OpttablefuncelementlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *OpttablefuncelementlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpttablefuncelementlist(s) + } +} + +func (s *OpttablefuncelementlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpttablefuncelementlist(s) + } +} + +func (s *OpttablefuncelementlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpttablefuncelementlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opttablefuncelementlist() (localctx IOpttablefuncelementlistContext) { + localctx = NewOpttablefuncelementlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1108, PostgreSQLParserRULE_opttablefuncelementlist) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9056) + p.Tablefuncelementlist() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITablefuncelementlistContext is an interface to support dynamic dispatch. +type ITablefuncelementlistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTablefuncelement() []ITablefuncelementContext + Tablefuncelement(i int) ITablefuncelementContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsTablefuncelementlistContext differentiates from other interfaces. + IsTablefuncelementlistContext() +} + +type TablefuncelementlistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTablefuncelementlistContext() *TablefuncelementlistContext { + var p = new(TablefuncelementlistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablefuncelementlist + return p +} + +func InitEmptyTablefuncelementlistContext(p *TablefuncelementlistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablefuncelementlist +} + +func (*TablefuncelementlistContext) IsTablefuncelementlistContext() {} + +func NewTablefuncelementlistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TablefuncelementlistContext { + var p = new(TablefuncelementlistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tablefuncelementlist + + return p +} + +func (s *TablefuncelementlistContext) GetParser() antlr.Parser { return s.parser } + +func (s *TablefuncelementlistContext) AllTablefuncelement() []ITablefuncelementContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITablefuncelementContext); ok { + len++ + } + } + + tst := make([]ITablefuncelementContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITablefuncelementContext); ok { + tst[i] = t.(ITablefuncelementContext) + i++ + } + } + + return tst +} + +func (s *TablefuncelementlistContext) Tablefuncelement(i int) ITablefuncelementContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITablefuncelementContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITablefuncelementContext) +} + +func (s *TablefuncelementlistContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *TablefuncelementlistContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *TablefuncelementlistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TablefuncelementlistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TablefuncelementlistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTablefuncelementlist(s) + } +} + +func (s *TablefuncelementlistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTablefuncelementlist(s) + } +} + +func (s *TablefuncelementlistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTablefuncelementlist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tablefuncelementlist() (localctx ITablefuncelementlistContext) { + localctx = NewTablefuncelementlistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1110, PostgreSQLParserRULE_tablefuncelementlist) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9058) + p.Tablefuncelement() + } + p.SetState(9063) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(9059) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9060) + p.Tablefuncelement() + } + + p.SetState(9065) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITablefuncelementContext is an interface to support dynamic dispatch. +type ITablefuncelementContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Typename() ITypenameContext + Opt_collate_clause() IOpt_collate_clauseContext + + // IsTablefuncelementContext differentiates from other interfaces. + IsTablefuncelementContext() +} + +type TablefuncelementContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTablefuncelementContext() *TablefuncelementContext { + var p = new(TablefuncelementContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablefuncelement + return p +} + +func InitEmptyTablefuncelementContext(p *TablefuncelementContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_tablefuncelement +} + +func (*TablefuncelementContext) IsTablefuncelementContext() {} + +func NewTablefuncelementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TablefuncelementContext { + var p = new(TablefuncelementContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_tablefuncelement + + return p +} + +func (s *TablefuncelementContext) GetParser() antlr.Parser { return s.parser } + +func (s *TablefuncelementContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *TablefuncelementContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *TablefuncelementContext) Opt_collate_clause() IOpt_collate_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_collate_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_collate_clauseContext) +} + +func (s *TablefuncelementContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TablefuncelementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TablefuncelementContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTablefuncelement(s) + } +} + +func (s *TablefuncelementContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTablefuncelement(s) + } +} + +func (s *TablefuncelementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTablefuncelement(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Tablefuncelement() (localctx ITablefuncelementContext) { + localctx = NewTablefuncelementContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1112, PostgreSQLParserRULE_tablefuncelement) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9066) + p.Colid() + } + { + p.SetState(9067) + p.Typename() + } + p.SetState(9069) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOLLATE { + { + p.SetState(9068) + p.Opt_collate_clause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXmltableContext is an interface to support dynamic dispatch. +type IXmltableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + XMLTABLE() antlr.TerminalNode + AllOPEN_PAREN() []antlr.TerminalNode + OPEN_PAREN(i int) antlr.TerminalNode + AllCLOSE_PAREN() []antlr.TerminalNode + CLOSE_PAREN(i int) antlr.TerminalNode + C_expr() IC_exprContext + Xmlexists_argument() IXmlexists_argumentContext + COLUMNS() antlr.TerminalNode + Xmltable_column_list() IXmltable_column_listContext + XMLNAMESPACES() antlr.TerminalNode + Xml_namespace_list() IXml_namespace_listContext + COMMA() antlr.TerminalNode + + // IsXmltableContext differentiates from other interfaces. + IsXmltableContext() +} + +type XmltableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXmltableContext() *XmltableContext { + var p = new(XmltableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable + return p +} + +func InitEmptyXmltableContext(p *XmltableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable +} + +func (*XmltableContext) IsXmltableContext() {} + +func NewXmltableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *XmltableContext { + var p = new(XmltableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xmltable + + return p +} + +func (s *XmltableContext) GetParser() antlr.Parser { return s.parser } + +func (s *XmltableContext) XMLTABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLTABLE, 0) +} + +func (s *XmltableContext) AllOPEN_PAREN() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserOPEN_PAREN) +} + +func (s *XmltableContext) OPEN_PAREN(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, i) +} + +func (s *XmltableContext) AllCLOSE_PAREN() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCLOSE_PAREN) +} + +func (s *XmltableContext) CLOSE_PAREN(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, i) +} + +func (s *XmltableContext) C_expr() IC_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IC_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IC_exprContext) +} + +func (s *XmltableContext) Xmlexists_argument() IXmlexists_argumentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXmlexists_argumentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXmlexists_argumentContext) +} + +func (s *XmltableContext) COLUMNS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLUMNS, 0) +} + +func (s *XmltableContext) Xmltable_column_list() IXmltable_column_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXmltable_column_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXmltable_column_listContext) +} + +func (s *XmltableContext) XMLNAMESPACES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLNAMESPACES, 0) +} + +func (s *XmltableContext) Xml_namespace_list() IXml_namespace_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_namespace_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXml_namespace_listContext) +} + +func (s *XmltableContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *XmltableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *XmltableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *XmltableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXmltable(s) + } +} + +func (s *XmltableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXmltable(s) + } +} + +func (s *XmltableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXmltable(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xmltable() (localctx IXmltableContext) { + localctx = NewXmltableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1114, PostgreSQLParserRULE_xmltable) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9071) + p.Match(PostgreSQLParserXMLTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9072) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9088) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 834, p.GetParserRuleContext()) { + case 1: + { + p.SetState(9073) + p.C_expr() + } + { + p.SetState(9074) + p.Xmlexists_argument() + } + { + p.SetState(9075) + p.Match(PostgreSQLParserCOLUMNS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9076) + p.Xmltable_column_list() + } + + case 2: + { + p.SetState(9078) + p.Match(PostgreSQLParserXMLNAMESPACES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9079) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9080) + p.Xml_namespace_list() + } + { + p.SetState(9081) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9082) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9083) + p.C_expr() + } + { + p.SetState(9084) + p.Xmlexists_argument() + } + { + p.SetState(9085) + p.Match(PostgreSQLParserCOLUMNS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9086) + p.Xmltable_column_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(9090) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXmltable_column_listContext is an interface to support dynamic dispatch. +type IXmltable_column_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllXmltable_column_el() []IXmltable_column_elContext + Xmltable_column_el(i int) IXmltable_column_elContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsXmltable_column_listContext differentiates from other interfaces. + IsXmltable_column_listContext() +} + +type Xmltable_column_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXmltable_column_listContext() *Xmltable_column_listContext { + var p = new(Xmltable_column_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_list + return p +} + +func InitEmptyXmltable_column_listContext(p *Xmltable_column_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_list +} + +func (*Xmltable_column_listContext) IsXmltable_column_listContext() {} + +func NewXmltable_column_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xmltable_column_listContext { + var p = new(Xmltable_column_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_list + + return p +} + +func (s *Xmltable_column_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xmltable_column_listContext) AllXmltable_column_el() []IXmltable_column_elContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IXmltable_column_elContext); ok { + len++ + } + } + + tst := make([]IXmltable_column_elContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IXmltable_column_elContext); ok { + tst[i] = t.(IXmltable_column_elContext) + i++ + } + } + + return tst +} + +func (s *Xmltable_column_listContext) Xmltable_column_el(i int) IXmltable_column_elContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXmltable_column_elContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IXmltable_column_elContext) +} + +func (s *Xmltable_column_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Xmltable_column_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Xmltable_column_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xmltable_column_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xmltable_column_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXmltable_column_list(s) + } +} + +func (s *Xmltable_column_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXmltable_column_list(s) + } +} + +func (s *Xmltable_column_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXmltable_column_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xmltable_column_list() (localctx IXmltable_column_listContext) { + localctx = NewXmltable_column_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1116, PostgreSQLParserRULE_xmltable_column_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9092) + p.Xmltable_column_el() + } + p.SetState(9097) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(9093) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9094) + p.Xmltable_column_el() + } + + p.SetState(9099) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXmltable_column_elContext is an interface to support dynamic dispatch. +type IXmltable_column_elContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Typename() ITypenameContext + FOR() antlr.TerminalNode + ORDINALITY() antlr.TerminalNode + Xmltable_column_option_list() IXmltable_column_option_listContext + + // IsXmltable_column_elContext differentiates from other interfaces. + IsXmltable_column_elContext() +} + +type Xmltable_column_elContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXmltable_column_elContext() *Xmltable_column_elContext { + var p = new(Xmltable_column_elContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_el + return p +} + +func InitEmptyXmltable_column_elContext(p *Xmltable_column_elContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_el +} + +func (*Xmltable_column_elContext) IsXmltable_column_elContext() {} + +func NewXmltable_column_elContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xmltable_column_elContext { + var p = new(Xmltable_column_elContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_el + + return p +} + +func (s *Xmltable_column_elContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xmltable_column_elContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Xmltable_column_elContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Xmltable_column_elContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Xmltable_column_elContext) ORDINALITY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserORDINALITY, 0) +} + +func (s *Xmltable_column_elContext) Xmltable_column_option_list() IXmltable_column_option_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXmltable_column_option_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXmltable_column_option_listContext) +} + +func (s *Xmltable_column_elContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xmltable_column_elContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xmltable_column_elContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXmltable_column_el(s) + } +} + +func (s *Xmltable_column_elContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXmltable_column_el(s) + } +} + +func (s *Xmltable_column_elContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXmltable_column_el(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xmltable_column_el() (localctx IXmltable_column_elContext) { + localctx = NewXmltable_column_elContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1118, PostgreSQLParserRULE_xmltable_column_el) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9100) + p.Colid() + } + p.SetState(9107) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserRIGHT, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(9101) + p.Typename() + } + p.SetState(9103) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576513529147825157) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&74346914954363009) != 0) || ((int64((_la-207)) & ^0x3f) == 0 && ((int64(1)<<(_la-207))&56295003965620233) != 0) || ((int64((_la-272)) & ^0x3f) == 0 && ((int64(1)<<(_la-272))&18068292027564033) != 0) || _la == PostgreSQLParserTYPE_P || ((int64((_la-435)) & ^0x3f) == 0 && ((int64(1)<<(_la-435))&-144097595889811453) != 0) || ((int64((_la-499)) & ^0x3f) == 0 && ((int64(1)<<(_la-499))&12516927) != 0) || ((int64((_la-643)) & ^0x3f) == 0 && ((int64(1)<<(_la-643))&100663331) != 0) { + { + p.SetState(9102) + p.Xmltable_column_option_list() + } + + } + + case PostgreSQLParserFOR: + { + p.SetState(9105) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9106) + p.Match(PostgreSQLParserORDINALITY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXmltable_column_option_listContext is an interface to support dynamic dispatch. +type IXmltable_column_option_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllXmltable_column_option_el() []IXmltable_column_option_elContext + Xmltable_column_option_el(i int) IXmltable_column_option_elContext + + // IsXmltable_column_option_listContext differentiates from other interfaces. + IsXmltable_column_option_listContext() +} + +type Xmltable_column_option_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXmltable_column_option_listContext() *Xmltable_column_option_listContext { + var p = new(Xmltable_column_option_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_option_list + return p +} + +func InitEmptyXmltable_column_option_listContext(p *Xmltable_column_option_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_option_list +} + +func (*Xmltable_column_option_listContext) IsXmltable_column_option_listContext() {} + +func NewXmltable_column_option_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xmltable_column_option_listContext { + var p = new(Xmltable_column_option_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_option_list + + return p +} + +func (s *Xmltable_column_option_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xmltable_column_option_listContext) AllXmltable_column_option_el() []IXmltable_column_option_elContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IXmltable_column_option_elContext); ok { + len++ + } + } + + tst := make([]IXmltable_column_option_elContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IXmltable_column_option_elContext); ok { + tst[i] = t.(IXmltable_column_option_elContext) + i++ + } + } + + return tst +} + +func (s *Xmltable_column_option_listContext) Xmltable_column_option_el(i int) IXmltable_column_option_elContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXmltable_column_option_elContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IXmltable_column_option_elContext) +} + +func (s *Xmltable_column_option_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xmltable_column_option_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xmltable_column_option_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXmltable_column_option_list(s) + } +} + +func (s *Xmltable_column_option_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXmltable_column_option_list(s) + } +} + +func (s *Xmltable_column_option_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXmltable_column_option_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xmltable_column_option_list() (localctx IXmltable_column_option_listContext) { + localctx = NewXmltable_column_option_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1120, PostgreSQLParserRULE_xmltable_column_option_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(9110) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576513529147825157) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&74346914954363009) != 0) || ((int64((_la-207)) & ^0x3f) == 0 && ((int64(1)<<(_la-207))&56295003965620233) != 0) || ((int64((_la-272)) & ^0x3f) == 0 && ((int64(1)<<(_la-272))&18068292027564033) != 0) || _la == PostgreSQLParserTYPE_P || ((int64((_la-435)) & ^0x3f) == 0 && ((int64(1)<<(_la-435))&-144097595889811453) != 0) || ((int64((_la-499)) & ^0x3f) == 0 && ((int64(1)<<(_la-499))&12516927) != 0) || ((int64((_la-643)) & ^0x3f) == 0 && ((int64(1)<<(_la-643))&100663331) != 0) { + { + p.SetState(9109) + p.Xmltable_column_option_el() + } + + p.SetState(9112) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXmltable_column_option_elContext is an interface to support dynamic dispatch. +type IXmltable_column_option_elContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DEFAULT() antlr.TerminalNode + A_expr() IA_exprContext + Identifier() IIdentifierContext + NOT() antlr.TerminalNode + NULL_P() antlr.TerminalNode + + // IsXmltable_column_option_elContext differentiates from other interfaces. + IsXmltable_column_option_elContext() +} + +type Xmltable_column_option_elContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXmltable_column_option_elContext() *Xmltable_column_option_elContext { + var p = new(Xmltable_column_option_elContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_option_el + return p +} + +func InitEmptyXmltable_column_option_elContext(p *Xmltable_column_option_elContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_option_el +} + +func (*Xmltable_column_option_elContext) IsXmltable_column_option_elContext() {} + +func NewXmltable_column_option_elContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xmltable_column_option_elContext { + var p = new(Xmltable_column_option_elContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xmltable_column_option_el + + return p +} + +func (s *Xmltable_column_option_elContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xmltable_column_option_elContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Xmltable_column_option_elContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Xmltable_column_option_elContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Xmltable_column_option_elContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Xmltable_column_option_elContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Xmltable_column_option_elContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xmltable_column_option_elContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xmltable_column_option_elContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXmltable_column_option_el(s) + } +} + +func (s *Xmltable_column_option_elContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXmltable_column_option_el(s) + } +} + +func (s *Xmltable_column_option_elContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXmltable_column_option_el(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xmltable_column_option_el() (localctx IXmltable_column_option_elContext) { + localctx = NewXmltable_column_option_elContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1122, PostgreSQLParserRULE_xmltable_column_option_el) + p.SetState(9122) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 839, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9114) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9115) + p.A_expr() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9116) + p.Identifier() + } + { + p.SetState(9117) + p.A_expr() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9119) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9120) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(9121) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXml_namespace_listContext is an interface to support dynamic dispatch. +type IXml_namespace_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllXml_namespace_el() []IXml_namespace_elContext + Xml_namespace_el(i int) IXml_namespace_elContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsXml_namespace_listContext differentiates from other interfaces. + IsXml_namespace_listContext() +} + +type Xml_namespace_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXml_namespace_listContext() *Xml_namespace_listContext { + var p = new(Xml_namespace_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_namespace_list + return p +} + +func InitEmptyXml_namespace_listContext(p *Xml_namespace_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_namespace_list +} + +func (*Xml_namespace_listContext) IsXml_namespace_listContext() {} + +func NewXml_namespace_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xml_namespace_listContext { + var p = new(Xml_namespace_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xml_namespace_list + + return p +} + +func (s *Xml_namespace_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xml_namespace_listContext) AllXml_namespace_el() []IXml_namespace_elContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IXml_namespace_elContext); ok { + len++ + } + } + + tst := make([]IXml_namespace_elContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IXml_namespace_elContext); ok { + tst[i] = t.(IXml_namespace_elContext) + i++ + } + } + + return tst +} + +func (s *Xml_namespace_listContext) Xml_namespace_el(i int) IXml_namespace_elContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_namespace_elContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IXml_namespace_elContext) +} + +func (s *Xml_namespace_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Xml_namespace_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Xml_namespace_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xml_namespace_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xml_namespace_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXml_namespace_list(s) + } +} + +func (s *Xml_namespace_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXml_namespace_list(s) + } +} + +func (s *Xml_namespace_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXml_namespace_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xml_namespace_list() (localctx IXml_namespace_listContext) { + localctx = NewXml_namespace_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1124, PostgreSQLParserRULE_xml_namespace_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9124) + p.Xml_namespace_el() + } + p.SetState(9129) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(9125) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9126) + p.Xml_namespace_el() + } + + p.SetState(9131) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXml_namespace_elContext is an interface to support dynamic dispatch. +type IXml_namespace_elContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + B_expr() IB_exprContext + AS() antlr.TerminalNode + Collabel() ICollabelContext + DEFAULT() antlr.TerminalNode + + // IsXml_namespace_elContext differentiates from other interfaces. + IsXml_namespace_elContext() +} + +type Xml_namespace_elContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXml_namespace_elContext() *Xml_namespace_elContext { + var p = new(Xml_namespace_elContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_namespace_el + return p +} + +func InitEmptyXml_namespace_elContext(p *Xml_namespace_elContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_namespace_el +} + +func (*Xml_namespace_elContext) IsXml_namespace_elContext() {} + +func NewXml_namespace_elContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xml_namespace_elContext { + var p = new(Xml_namespace_elContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xml_namespace_el + + return p +} + +func (s *Xml_namespace_elContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xml_namespace_elContext) B_expr() IB_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IB_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IB_exprContext) +} + +func (s *Xml_namespace_elContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Xml_namespace_elContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Xml_namespace_elContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Xml_namespace_elContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xml_namespace_elContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xml_namespace_elContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXml_namespace_el(s) + } +} + +func (s *Xml_namespace_elContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXml_namespace_el(s) + } +} + +func (s *Xml_namespace_elContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXml_namespace_el(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xml_namespace_el() (localctx IXml_namespace_elContext) { + localctx = NewXml_namespace_elContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1126, PostgreSQLParserRULE_xml_namespace_el) + p.SetState(9138) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 841, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9132) + p.b_expr(0) + } + { + p.SetState(9133) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9134) + p.Collabel() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9136) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9137) + p.b_expr(0) + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITypenameContext is an interface to support dynamic dispatch. +type ITypenameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Simpletypename() ISimpletypenameContext + Opt_array_bounds() IOpt_array_boundsContext + ARRAY() antlr.TerminalNode + SETOF() antlr.TerminalNode + OPEN_BRACKET() antlr.TerminalNode + Iconst() IIconstContext + CLOSE_BRACKET() antlr.TerminalNode + Qualified_name() IQualified_nameContext + PERCENT() antlr.TerminalNode + ROWTYPE() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + + // IsTypenameContext differentiates from other interfaces. + IsTypenameContext() +} + +type TypenameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTypenameContext() *TypenameContext { + var p = new(TypenameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_typename + return p +} + +func InitEmptyTypenameContext(p *TypenameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_typename +} + +func (*TypenameContext) IsTypenameContext() {} + +func NewTypenameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypenameContext { + var p = new(TypenameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_typename + + return p +} + +func (s *TypenameContext) GetParser() antlr.Parser { return s.parser } + +func (s *TypenameContext) Simpletypename() ISimpletypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISimpletypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISimpletypenameContext) +} + +func (s *TypenameContext) Opt_array_bounds() IOpt_array_boundsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_array_boundsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_array_boundsContext) +} + +func (s *TypenameContext) ARRAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserARRAY, 0) +} + +func (s *TypenameContext) SETOF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSETOF, 0) +} + +func (s *TypenameContext) OPEN_BRACKET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_BRACKET, 0) +} + +func (s *TypenameContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *TypenameContext) CLOSE_BRACKET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_BRACKET, 0) +} + +func (s *TypenameContext) Qualified_name() IQualified_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *TypenameContext) PERCENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPERCENT, 0) +} + +func (s *TypenameContext) ROWTYPE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROWTYPE, 0) +} + +func (s *TypenameContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *TypenameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *TypenameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *TypenameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTypename(s) + } +} + +func (s *TypenameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTypename(s) + } +} + +func (s *TypenameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTypename(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Typename() (localctx ITypenameContext) { + localctx = NewTypenameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1128, PostgreSQLParserRULE_typename) + var _la int + + p.SetState(9158) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 845, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + p.SetState(9141) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSETOF { + { + p.SetState(9140) + p.Match(PostgreSQLParserSETOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(9143) + p.Simpletypename() + } + p.SetState(9152) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 844, p.GetParserRuleContext()) { + case 1: + { + p.SetState(9144) + p.Opt_array_bounds() + } + + case 2: + { + p.SetState(9145) + p.Match(PostgreSQLParserARRAY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9150) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 843, p.GetParserRuleContext()) == 1 { + { + p.SetState(9146) + p.Match(PostgreSQLParserOPEN_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9147) + p.Iconst() + } + { + p.SetState(9148) + p.Match(PostgreSQLParserCLOSE_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9154) + p.Qualified_name() + } + { + p.SetState(9155) + p.Match(PostgreSQLParserPERCENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9156) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTYPE_P || _la == PostgreSQLParserROWTYPE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_array_boundsContext is an interface to support dynamic dispatch. +type IOpt_array_boundsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllOPEN_BRACKET() []antlr.TerminalNode + OPEN_BRACKET(i int) antlr.TerminalNode + AllCLOSE_BRACKET() []antlr.TerminalNode + CLOSE_BRACKET(i int) antlr.TerminalNode + AllIconst() []IIconstContext + Iconst(i int) IIconstContext + + // IsOpt_array_boundsContext differentiates from other interfaces. + IsOpt_array_boundsContext() +} + +type Opt_array_boundsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_array_boundsContext() *Opt_array_boundsContext { + var p = new(Opt_array_boundsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_array_bounds + return p +} + +func InitEmptyOpt_array_boundsContext(p *Opt_array_boundsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_array_bounds +} + +func (*Opt_array_boundsContext) IsOpt_array_boundsContext() {} + +func NewOpt_array_boundsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_array_boundsContext { + var p = new(Opt_array_boundsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_array_bounds + + return p +} + +func (s *Opt_array_boundsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_array_boundsContext) AllOPEN_BRACKET() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserOPEN_BRACKET) +} + +func (s *Opt_array_boundsContext) OPEN_BRACKET(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_BRACKET, i) +} + +func (s *Opt_array_boundsContext) AllCLOSE_BRACKET() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCLOSE_BRACKET) +} + +func (s *Opt_array_boundsContext) CLOSE_BRACKET(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_BRACKET, i) +} + +func (s *Opt_array_boundsContext) AllIconst() []IIconstContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIconstContext); ok { + len++ + } + } + + tst := make([]IIconstContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIconstContext); ok { + tst[i] = t.(IIconstContext) + i++ + } + } + + return tst +} + +func (s *Opt_array_boundsContext) Iconst(i int) IIconstContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Opt_array_boundsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_array_boundsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_array_boundsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_array_bounds(s) + } +} + +func (s *Opt_array_boundsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_array_bounds(s) + } +} + +func (s *Opt_array_boundsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_array_bounds(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_array_bounds() (localctx IOpt_array_boundsContext) { + localctx = NewOpt_array_boundsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1130, PostgreSQLParserRULE_opt_array_bounds) + var _la int + + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(9167) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 847, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(9160) + p.Match(PostgreSQLParserOPEN_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9162) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserIntegral { + { + p.SetState(9161) + p.Iconst() + } + + } + { + p.SetState(9164) + p.Match(PostgreSQLParserCLOSE_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(9169) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 847, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISimpletypenameContext is an interface to support dynamic dispatch. +type ISimpletypenameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Generictype() IGenerictypeContext + Numeric() INumericContext + Bit() IBitContext + Character() ICharacterContext + Constdatetime() IConstdatetimeContext + Constinterval() IConstintervalContext + OPEN_PAREN() antlr.TerminalNode + Iconst() IIconstContext + CLOSE_PAREN() antlr.TerminalNode + Opt_interval() IOpt_intervalContext + + // IsSimpletypenameContext differentiates from other interfaces. + IsSimpletypenameContext() +} + +type SimpletypenameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySimpletypenameContext() *SimpletypenameContext { + var p = new(SimpletypenameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_simpletypename + return p +} + +func InitEmptySimpletypenameContext(p *SimpletypenameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_simpletypename +} + +func (*SimpletypenameContext) IsSimpletypenameContext() {} + +func NewSimpletypenameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SimpletypenameContext { + var p = new(SimpletypenameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_simpletypename + + return p +} + +func (s *SimpletypenameContext) GetParser() antlr.Parser { return s.parser } + +func (s *SimpletypenameContext) Generictype() IGenerictypeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGenerictypeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGenerictypeContext) +} + +func (s *SimpletypenameContext) Numeric() INumericContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericContext) +} + +func (s *SimpletypenameContext) Bit() IBitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBitContext) +} + +func (s *SimpletypenameContext) Character() ICharacterContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICharacterContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICharacterContext) +} + +func (s *SimpletypenameContext) Constdatetime() IConstdatetimeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstdatetimeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstdatetimeContext) +} + +func (s *SimpletypenameContext) Constinterval() IConstintervalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstintervalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstintervalContext) +} + +func (s *SimpletypenameContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *SimpletypenameContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *SimpletypenameContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *SimpletypenameContext) Opt_interval() IOpt_intervalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_intervalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_intervalContext) +} + +func (s *SimpletypenameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SimpletypenameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SimpletypenameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSimpletypename(s) + } +} + +func (s *SimpletypenameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSimpletypename(s) + } +} + +func (s *SimpletypenameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSimpletypename(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Simpletypename() (localctx ISimpletypenameContext) { + localctx = NewSimpletypenameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1132, PostgreSQLParserRULE_simpletypename) + p.SetState(9185) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 850, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9170) + p.Generictype() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9171) + p.Numeric() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9172) + p.Bit() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(9173) + p.Character() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(9174) + p.Constdatetime() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(9175) + p.Constinterval() + } + p.SetState(9183) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 849, p.GetParserRuleContext()) { + case 1: + p.SetState(9177) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 848, p.GetParserRuleContext()) == 1 { + { + p.SetState(9176) + p.Opt_interval() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + { + p.SetState(9179) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9180) + p.Iconst() + } + { + p.SetState(9181) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConsttypenameContext is an interface to support dynamic dispatch. +type IConsttypenameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Numeric() INumericContext + Constbit() IConstbitContext + Constcharacter() IConstcharacterContext + Constdatetime() IConstdatetimeContext + + // IsConsttypenameContext differentiates from other interfaces. + IsConsttypenameContext() +} + +type ConsttypenameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConsttypenameContext() *ConsttypenameContext { + var p = new(ConsttypenameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_consttypename + return p +} + +func InitEmptyConsttypenameContext(p *ConsttypenameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_consttypename +} + +func (*ConsttypenameContext) IsConsttypenameContext() {} + +func NewConsttypenameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConsttypenameContext { + var p = new(ConsttypenameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_consttypename + + return p +} + +func (s *ConsttypenameContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConsttypenameContext) Numeric() INumericContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericContext) +} + +func (s *ConsttypenameContext) Constbit() IConstbitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstbitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstbitContext) +} + +func (s *ConsttypenameContext) Constcharacter() IConstcharacterContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstcharacterContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstcharacterContext) +} + +func (s *ConsttypenameContext) Constdatetime() IConstdatetimeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstdatetimeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstdatetimeContext) +} + +func (s *ConsttypenameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConsttypenameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConsttypenameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConsttypename(s) + } +} + +func (s *ConsttypenameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConsttypename(s) + } +} + +func (s *ConsttypenameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConsttypename(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Consttypename() (localctx IConsttypenameContext) { + localctx = NewConsttypenameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1134, PostgreSQLParserRULE_consttypename) + p.SetState(9191) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserDOUBLE_P, PostgreSQLParserBIGINT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserFLOAT_P, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserNUMERIC, PostgreSQLParserREAL, PostgreSQLParserSMALLINT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9187) + p.Numeric() + } + + case PostgreSQLParserBIT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9188) + p.Constbit() + } + + case PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserVARCHAR: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9189) + p.Constcharacter() + } + + case PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(9190) + p.Constdatetime() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGenerictypeContext is an interface to support dynamic dispatch. +type IGenerictypeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Builtin_function_name() IBuiltin_function_nameContext + Type_function_name() IType_function_nameContext + LEFT() antlr.TerminalNode + RIGHT() antlr.TerminalNode + Attrs() IAttrsContext + Opt_type_modifiers() IOpt_type_modifiersContext + + // IsGenerictypeContext differentiates from other interfaces. + IsGenerictypeContext() +} + +type GenerictypeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGenerictypeContext() *GenerictypeContext { + var p = new(GenerictypeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generictype + return p +} + +func InitEmptyGenerictypeContext(p *GenerictypeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_generictype +} + +func (*GenerictypeContext) IsGenerictypeContext() {} + +func NewGenerictypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GenerictypeContext { + var p = new(GenerictypeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_generictype + + return p +} + +func (s *GenerictypeContext) GetParser() antlr.Parser { return s.parser } + +func (s *GenerictypeContext) Builtin_function_name() IBuiltin_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBuiltin_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBuiltin_function_nameContext) +} + +func (s *GenerictypeContext) Type_function_name() IType_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_function_nameContext) +} + +func (s *GenerictypeContext) LEFT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEFT, 0) +} + +func (s *GenerictypeContext) RIGHT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRIGHT, 0) +} + +func (s *GenerictypeContext) Attrs() IAttrsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAttrsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAttrsContext) +} + +func (s *GenerictypeContext) Opt_type_modifiers() IOpt_type_modifiersContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_type_modifiersContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_type_modifiersContext) +} + +func (s *GenerictypeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *GenerictypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *GenerictypeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGenerictype(s) + } +} + +func (s *GenerictypeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGenerictype(s) + } +} + +func (s *GenerictypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGenerictype(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Generictype() (localctx IGenerictypeContext) { + localctx = NewGenerictypeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1136, PostgreSQLParserRULE_generictype) + p.EnterOuterAlt(localctx, 1) + p.SetState(9197) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserREPLACE, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserREVERSE, PostgreSQLParserLOG, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER: + { + p.SetState(9193) + p.Builtin_function_name() + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserPARAMETER, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserCOLUMNS, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(9194) + p.Type_function_name() + } + + case PostgreSQLParserLEFT: + { + p.SetState(9195) + p.Match(PostgreSQLParserLEFT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserRIGHT: + { + p.SetState(9196) + p.Match(PostgreSQLParserRIGHT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.SetState(9200) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 853, p.GetParserRuleContext()) == 1 { + { + p.SetState(9199) + p.Attrs() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(9203) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 854, p.GetParserRuleContext()) == 1 { + { + p.SetState(9202) + p.Opt_type_modifiers() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_type_modifiersContext is an interface to support dynamic dispatch. +type IOpt_type_modifiersContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_type_modifiersContext differentiates from other interfaces. + IsOpt_type_modifiersContext() +} + +type Opt_type_modifiersContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_type_modifiersContext() *Opt_type_modifiersContext { + var p = new(Opt_type_modifiersContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_type_modifiers + return p +} + +func InitEmptyOpt_type_modifiersContext(p *Opt_type_modifiersContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_type_modifiers +} + +func (*Opt_type_modifiersContext) IsOpt_type_modifiersContext() {} + +func NewOpt_type_modifiersContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_type_modifiersContext { + var p = new(Opt_type_modifiersContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_type_modifiers + + return p +} + +func (s *Opt_type_modifiersContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_type_modifiersContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_type_modifiersContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Opt_type_modifiersContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_type_modifiersContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_type_modifiersContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_type_modifiersContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_type_modifiers(s) + } +} + +func (s *Opt_type_modifiersContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_type_modifiers(s) + } +} + +func (s *Opt_type_modifiersContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_type_modifiers(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_type_modifiers() (localctx IOpt_type_modifiersContext) { + localctx = NewOpt_type_modifiersContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1138, PostgreSQLParserRULE_opt_type_modifiers) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9205) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9206) + p.Expr_list() + } + { + p.SetState(9207) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INumericContext is an interface to support dynamic dispatch. +type INumericContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INT_P() antlr.TerminalNode + INTEGER() antlr.TerminalNode + SMALLINT() antlr.TerminalNode + BIGINT() antlr.TerminalNode + REAL() antlr.TerminalNode + FLOAT_P() antlr.TerminalNode + Opt_float() IOpt_floatContext + DOUBLE_P() antlr.TerminalNode + PRECISION() antlr.TerminalNode + DECIMAL_P() antlr.TerminalNode + Opt_type_modifiers() IOpt_type_modifiersContext + DEC() antlr.TerminalNode + NUMERIC() antlr.TerminalNode + BOOLEAN_P() antlr.TerminalNode + + // IsNumericContext differentiates from other interfaces. + IsNumericContext() +} + +type NumericContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNumericContext() *NumericContext { + var p = new(NumericContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_numeric + return p +} + +func InitEmptyNumericContext(p *NumericContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_numeric +} + +func (*NumericContext) IsNumericContext() {} + +func NewNumericContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NumericContext { + var p = new(NumericContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_numeric + + return p +} + +func (s *NumericContext) GetParser() antlr.Parser { return s.parser } + +func (s *NumericContext) INT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINT_P, 0) +} + +func (s *NumericContext) INTEGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTEGER, 0) +} + +func (s *NumericContext) SMALLINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSMALLINT, 0) +} + +func (s *NumericContext) BIGINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBIGINT, 0) +} + +func (s *NumericContext) REAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREAL, 0) +} + +func (s *NumericContext) FLOAT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFLOAT_P, 0) +} + +func (s *NumericContext) Opt_float() IOpt_floatContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_floatContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_floatContext) +} + +func (s *NumericContext) DOUBLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOUBLE_P, 0) +} + +func (s *NumericContext) PRECISION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRECISION, 0) +} + +func (s *NumericContext) DECIMAL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDECIMAL_P, 0) +} + +func (s *NumericContext) Opt_type_modifiers() IOpt_type_modifiersContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_type_modifiersContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_type_modifiersContext) +} + +func (s *NumericContext) DEC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEC, 0) +} + +func (s *NumericContext) NUMERIC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNUMERIC, 0) +} + +func (s *NumericContext) BOOLEAN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBOOLEAN_P, 0) +} + +func (s *NumericContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *NumericContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *NumericContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterNumeric(s) + } +} + +func (s *NumericContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitNumeric(s) + } +} + +func (s *NumericContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitNumeric(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Numeric() (localctx INumericContext) { + localctx = NewNumericContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1140, PostgreSQLParserRULE_numeric) + p.SetState(9233) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserINT_P: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9209) + p.Match(PostgreSQLParserINT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserINTEGER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9210) + p.Match(PostgreSQLParserINTEGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSMALLINT: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9211) + p.Match(PostgreSQLParserSMALLINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserBIGINT: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(9212) + p.Match(PostgreSQLParserBIGINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserREAL: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(9213) + p.Match(PostgreSQLParserREAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserFLOAT_P: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(9214) + p.Match(PostgreSQLParserFLOAT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9216) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 855, p.GetParserRuleContext()) == 1 { + { + p.SetState(9215) + p.Opt_float() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserDOUBLE_P: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(9218) + p.Match(PostgreSQLParserDOUBLE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9219) + p.Match(PostgreSQLParserPRECISION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDECIMAL_P: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(9220) + p.Match(PostgreSQLParserDECIMAL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9222) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 856, p.GetParserRuleContext()) == 1 { + { + p.SetState(9221) + p.Opt_type_modifiers() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserDEC: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(9224) + p.Match(PostgreSQLParserDEC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9226) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 857, p.GetParserRuleContext()) == 1 { + { + p.SetState(9225) + p.Opt_type_modifiers() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserNUMERIC: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(9228) + p.Match(PostgreSQLParserNUMERIC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9230) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 858, p.GetParserRuleContext()) == 1 { + { + p.SetState(9229) + p.Opt_type_modifiers() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserBOOLEAN_P: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(9232) + p.Match(PostgreSQLParserBOOLEAN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_floatContext is an interface to support dynamic dispatch. +type IOpt_floatContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Iconst() IIconstContext + CLOSE_PAREN() antlr.TerminalNode + + // IsOpt_floatContext differentiates from other interfaces. + IsOpt_floatContext() +} + +type Opt_floatContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_floatContext() *Opt_floatContext { + var p = new(Opt_floatContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_float + return p +} + +func InitEmptyOpt_floatContext(p *Opt_floatContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_float +} + +func (*Opt_floatContext) IsOpt_floatContext() {} + +func NewOpt_floatContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_floatContext { + var p = new(Opt_floatContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_float + + return p +} + +func (s *Opt_floatContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_floatContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_floatContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Opt_floatContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_floatContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_floatContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_floatContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_float(s) + } +} + +func (s *Opt_floatContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_float(s) + } +} + +func (s *Opt_floatContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_float(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_float() (localctx IOpt_floatContext) { + localctx = NewOpt_floatContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1142, PostgreSQLParserRULE_opt_float) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9235) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9236) + p.Iconst() + } + { + p.SetState(9237) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IBitContext is an interface to support dynamic dispatch. +type IBitContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Bitwithlength() IBitwithlengthContext + Bitwithoutlength() IBitwithoutlengthContext + + // IsBitContext differentiates from other interfaces. + IsBitContext() +} + +type BitContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBitContext() *BitContext { + var p = new(BitContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_bit + return p +} + +func InitEmptyBitContext(p *BitContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_bit +} + +func (*BitContext) IsBitContext() {} + +func NewBitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BitContext { + var p = new(BitContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_bit + + return p +} + +func (s *BitContext) GetParser() antlr.Parser { return s.parser } + +func (s *BitContext) Bitwithlength() IBitwithlengthContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBitwithlengthContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBitwithlengthContext) +} + +func (s *BitContext) Bitwithoutlength() IBitwithoutlengthContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBitwithoutlengthContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBitwithoutlengthContext) +} + +func (s *BitContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *BitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *BitContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterBit(s) + } +} + +func (s *BitContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitBit(s) + } +} + +func (s *BitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitBit(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Bit() (localctx IBitContext) { + localctx = NewBitContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1144, PostgreSQLParserRULE_bit) + p.SetState(9241) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 860, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9239) + p.Bitwithlength() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9240) + p.Bitwithoutlength() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstbitContext is an interface to support dynamic dispatch. +type IConstbitContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Bitwithlength() IBitwithlengthContext + Bitwithoutlength() IBitwithoutlengthContext + + // IsConstbitContext differentiates from other interfaces. + IsConstbitContext() +} + +type ConstbitContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstbitContext() *ConstbitContext { + var p = new(ConstbitContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constbit + return p +} + +func InitEmptyConstbitContext(p *ConstbitContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constbit +} + +func (*ConstbitContext) IsConstbitContext() {} + +func NewConstbitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstbitContext { + var p = new(ConstbitContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constbit + + return p +} + +func (s *ConstbitContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstbitContext) Bitwithlength() IBitwithlengthContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBitwithlengthContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBitwithlengthContext) +} + +func (s *ConstbitContext) Bitwithoutlength() IBitwithoutlengthContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBitwithoutlengthContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBitwithoutlengthContext) +} + +func (s *ConstbitContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstbitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstbitContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstbit(s) + } +} + +func (s *ConstbitContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstbit(s) + } +} + +func (s *ConstbitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstbit(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constbit() (localctx IConstbitContext) { + localctx = NewConstbitContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1146, PostgreSQLParserRULE_constbit) + p.SetState(9245) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 861, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9243) + p.Bitwithlength() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9244) + p.Bitwithoutlength() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IBitwithlengthContext is an interface to support dynamic dispatch. +type IBitwithlengthContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BIT() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + CLOSE_PAREN() antlr.TerminalNode + Opt_varying() IOpt_varyingContext + + // IsBitwithlengthContext differentiates from other interfaces. + IsBitwithlengthContext() +} + +type BitwithlengthContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBitwithlengthContext() *BitwithlengthContext { + var p = new(BitwithlengthContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_bitwithlength + return p +} + +func InitEmptyBitwithlengthContext(p *BitwithlengthContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_bitwithlength +} + +func (*BitwithlengthContext) IsBitwithlengthContext() {} + +func NewBitwithlengthContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BitwithlengthContext { + var p = new(BitwithlengthContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_bitwithlength + + return p +} + +func (s *BitwithlengthContext) GetParser() antlr.Parser { return s.parser } + +func (s *BitwithlengthContext) BIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBIT, 0) +} + +func (s *BitwithlengthContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *BitwithlengthContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *BitwithlengthContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *BitwithlengthContext) Opt_varying() IOpt_varyingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_varyingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_varyingContext) +} + +func (s *BitwithlengthContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *BitwithlengthContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *BitwithlengthContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterBitwithlength(s) + } +} + +func (s *BitwithlengthContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitBitwithlength(s) + } +} + +func (s *BitwithlengthContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitBitwithlength(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Bitwithlength() (localctx IBitwithlengthContext) { + localctx = NewBitwithlengthContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1148, PostgreSQLParserRULE_bitwithlength) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9247) + p.Match(PostgreSQLParserBIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9249) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserVARYING { + { + p.SetState(9248) + p.Opt_varying() + } + + } + { + p.SetState(9251) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9252) + p.Expr_list() + } + { + p.SetState(9253) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IBitwithoutlengthContext is an interface to support dynamic dispatch. +type IBitwithoutlengthContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BIT() antlr.TerminalNode + Opt_varying() IOpt_varyingContext + + // IsBitwithoutlengthContext differentiates from other interfaces. + IsBitwithoutlengthContext() +} + +type BitwithoutlengthContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBitwithoutlengthContext() *BitwithoutlengthContext { + var p = new(BitwithoutlengthContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_bitwithoutlength + return p +} + +func InitEmptyBitwithoutlengthContext(p *BitwithoutlengthContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_bitwithoutlength +} + +func (*BitwithoutlengthContext) IsBitwithoutlengthContext() {} + +func NewBitwithoutlengthContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BitwithoutlengthContext { + var p = new(BitwithoutlengthContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_bitwithoutlength + + return p +} + +func (s *BitwithoutlengthContext) GetParser() antlr.Parser { return s.parser } + +func (s *BitwithoutlengthContext) BIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBIT, 0) +} + +func (s *BitwithoutlengthContext) Opt_varying() IOpt_varyingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_varyingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_varyingContext) +} + +func (s *BitwithoutlengthContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *BitwithoutlengthContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *BitwithoutlengthContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterBitwithoutlength(s) + } +} + +func (s *BitwithoutlengthContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitBitwithoutlength(s) + } +} + +func (s *BitwithoutlengthContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitBitwithoutlength(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Bitwithoutlength() (localctx IBitwithoutlengthContext) { + localctx = NewBitwithoutlengthContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1150, PostgreSQLParserRULE_bitwithoutlength) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9255) + p.Match(PostgreSQLParserBIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9257) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 863, p.GetParserRuleContext()) == 1 { + { + p.SetState(9256) + p.Opt_varying() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICharacterContext is an interface to support dynamic dispatch. +type ICharacterContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Character_c() ICharacter_cContext + OPEN_PAREN() antlr.TerminalNode + Iconst() IIconstContext + CLOSE_PAREN() antlr.TerminalNode + + // IsCharacterContext differentiates from other interfaces. + IsCharacterContext() +} + +type CharacterContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCharacterContext() *CharacterContext { + var p = new(CharacterContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_character + return p +} + +func InitEmptyCharacterContext(p *CharacterContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_character +} + +func (*CharacterContext) IsCharacterContext() {} + +func NewCharacterContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CharacterContext { + var p = new(CharacterContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_character + + return p +} + +func (s *CharacterContext) GetParser() antlr.Parser { return s.parser } + +func (s *CharacterContext) Character_c() ICharacter_cContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICharacter_cContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICharacter_cContext) +} + +func (s *CharacterContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *CharacterContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *CharacterContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *CharacterContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CharacterContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CharacterContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCharacter(s) + } +} + +func (s *CharacterContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCharacter(s) + } +} + +func (s *CharacterContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCharacter(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Character() (localctx ICharacterContext) { + localctx = NewCharacterContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1152, PostgreSQLParserRULE_character) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9259) + p.Character_c() + } + p.SetState(9264) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 864, p.GetParserRuleContext()) == 1 { + { + p.SetState(9260) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9261) + p.Iconst() + } + { + p.SetState(9262) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstcharacterContext is an interface to support dynamic dispatch. +type IConstcharacterContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Character_c() ICharacter_cContext + OPEN_PAREN() antlr.TerminalNode + Iconst() IIconstContext + CLOSE_PAREN() antlr.TerminalNode + + // IsConstcharacterContext differentiates from other interfaces. + IsConstcharacterContext() +} + +type ConstcharacterContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstcharacterContext() *ConstcharacterContext { + var p = new(ConstcharacterContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constcharacter + return p +} + +func InitEmptyConstcharacterContext(p *ConstcharacterContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constcharacter +} + +func (*ConstcharacterContext) IsConstcharacterContext() {} + +func NewConstcharacterContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstcharacterContext { + var p = new(ConstcharacterContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constcharacter + + return p +} + +func (s *ConstcharacterContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstcharacterContext) Character_c() ICharacter_cContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICharacter_cContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICharacter_cContext) +} + +func (s *ConstcharacterContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ConstcharacterContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *ConstcharacterContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ConstcharacterContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstcharacterContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstcharacterContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstcharacter(s) + } +} + +func (s *ConstcharacterContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstcharacter(s) + } +} + +func (s *ConstcharacterContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstcharacter(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constcharacter() (localctx IConstcharacterContext) { + localctx = NewConstcharacterContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1154, PostgreSQLParserRULE_constcharacter) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9266) + p.Character_c() + } + p.SetState(9271) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(9267) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9268) + p.Iconst() + } + { + p.SetState(9269) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICharacter_cContext is an interface to support dynamic dispatch. +type ICharacter_cContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CHARACTER() antlr.TerminalNode + CHAR_P() antlr.TerminalNode + NCHAR() antlr.TerminalNode + Opt_varying() IOpt_varyingContext + VARCHAR() antlr.TerminalNode + NATIONAL() antlr.TerminalNode + + // IsCharacter_cContext differentiates from other interfaces. + IsCharacter_cContext() +} + +type Character_cContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCharacter_cContext() *Character_cContext { + var p = new(Character_cContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_character_c + return p +} + +func InitEmptyCharacter_cContext(p *Character_cContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_character_c +} + +func (*Character_cContext) IsCharacter_cContext() {} + +func NewCharacter_cContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Character_cContext { + var p = new(Character_cContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_character_c + + return p +} + +func (s *Character_cContext) GetParser() antlr.Parser { return s.parser } + +func (s *Character_cContext) CHARACTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHARACTER, 0) +} + +func (s *Character_cContext) CHAR_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHAR_P, 0) +} + +func (s *Character_cContext) NCHAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNCHAR, 0) +} + +func (s *Character_cContext) Opt_varying() IOpt_varyingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_varyingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_varyingContext) +} + +func (s *Character_cContext) VARCHAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARCHAR, 0) +} + +func (s *Character_cContext) NATIONAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNATIONAL, 0) +} + +func (s *Character_cContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Character_cContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Character_cContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCharacter_c(s) + } +} + +func (s *Character_cContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCharacter_c(s) + } +} + +func (s *Character_cContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCharacter_c(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Character_c() (localctx ICharacter_cContext) { + localctx = NewCharacter_cContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1156, PostgreSQLParserRULE_character_c) + var _la int + + p.SetState(9283) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserNCHAR: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9273) + _la = p.GetTokenStream().LA(1) + + if !((int64((_la-385)) & ^0x3f) == 0 && ((int64(1)<<(_la-385))&32771) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(9275) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 866, p.GetParserRuleContext()) == 1 { + { + p.SetState(9274) + p.Opt_varying() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserVARCHAR: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9277) + p.Match(PostgreSQLParserVARCHAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNATIONAL: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9278) + p.Match(PostgreSQLParserNATIONAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9279) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCHAR_P || _la == PostgreSQLParserCHARACTER) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(9281) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 867, p.GetParserRuleContext()) == 1 { + { + p.SetState(9280) + p.Opt_varying() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_varyingContext is an interface to support dynamic dispatch. +type IOpt_varyingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + VARYING() antlr.TerminalNode + + // IsOpt_varyingContext differentiates from other interfaces. + IsOpt_varyingContext() +} + +type Opt_varyingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_varyingContext() *Opt_varyingContext { + var p = new(Opt_varyingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_varying + return p +} + +func InitEmptyOpt_varyingContext(p *Opt_varyingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_varying +} + +func (*Opt_varyingContext) IsOpt_varyingContext() {} + +func NewOpt_varyingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_varyingContext { + var p = new(Opt_varyingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_varying + + return p +} + +func (s *Opt_varyingContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_varyingContext) VARYING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARYING, 0) +} + +func (s *Opt_varyingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_varyingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_varyingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_varying(s) + } +} + +func (s *Opt_varyingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_varying(s) + } +} + +func (s *Opt_varyingContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_varying(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_varying() (localctx IOpt_varyingContext) { + localctx = NewOpt_varyingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1158, PostgreSQLParserRULE_opt_varying) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9285) + p.Match(PostgreSQLParserVARYING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstdatetimeContext is an interface to support dynamic dispatch. +type IConstdatetimeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TIMESTAMP() antlr.TerminalNode + TIME() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Iconst() IIconstContext + CLOSE_PAREN() antlr.TerminalNode + Opt_timezone() IOpt_timezoneContext + + // IsConstdatetimeContext differentiates from other interfaces. + IsConstdatetimeContext() +} + +type ConstdatetimeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstdatetimeContext() *ConstdatetimeContext { + var p = new(ConstdatetimeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constdatetime + return p +} + +func InitEmptyConstdatetimeContext(p *ConstdatetimeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constdatetime +} + +func (*ConstdatetimeContext) IsConstdatetimeContext() {} + +func NewConstdatetimeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstdatetimeContext { + var p = new(ConstdatetimeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constdatetime + + return p +} + +func (s *ConstdatetimeContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstdatetimeContext) TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIMESTAMP, 0) +} + +func (s *ConstdatetimeContext) TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIME, 0) +} + +func (s *ConstdatetimeContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *ConstdatetimeContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *ConstdatetimeContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *ConstdatetimeContext) Opt_timezone() IOpt_timezoneContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_timezoneContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_timezoneContext) +} + +func (s *ConstdatetimeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstdatetimeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstdatetimeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstdatetime(s) + } +} + +func (s *ConstdatetimeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstdatetime(s) + } +} + +func (s *ConstdatetimeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstdatetime(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constdatetime() (localctx IConstdatetimeContext) { + localctx = NewConstdatetimeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1160, PostgreSQLParserRULE_constdatetime) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9287) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserTIME || _la == PostgreSQLParserTIMESTAMP) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(9292) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 869, p.GetParserRuleContext()) == 1 { + { + p.SetState(9288) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9289) + p.Iconst() + } + { + p.SetState(9290) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(9295) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 870, p.GetParserRuleContext()) == 1 { + { + p.SetState(9294) + p.Opt_timezone() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IConstintervalContext is an interface to support dynamic dispatch. +type IConstintervalContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INTERVAL() antlr.TerminalNode + + // IsConstintervalContext differentiates from other interfaces. + IsConstintervalContext() +} + +type ConstintervalContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstintervalContext() *ConstintervalContext { + var p = new(ConstintervalContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constinterval + return p +} + +func InitEmptyConstintervalContext(p *ConstintervalContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_constinterval +} + +func (*ConstintervalContext) IsConstintervalContext() {} + +func NewConstintervalContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstintervalContext { + var p = new(ConstintervalContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_constinterval + + return p +} + +func (s *ConstintervalContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstintervalContext) INTERVAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTERVAL, 0) +} + +func (s *ConstintervalContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstintervalContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstintervalContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterConstinterval(s) + } +} + +func (s *ConstintervalContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitConstinterval(s) + } +} + +func (s *ConstintervalContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitConstinterval(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Constinterval() (localctx IConstintervalContext) { + localctx = NewConstintervalContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1162, PostgreSQLParserRULE_constinterval) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9297) + p.Match(PostgreSQLParserINTERVAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_timezoneContext is an interface to support dynamic dispatch. +type IOpt_timezoneContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITH() antlr.TerminalNode + TIME() antlr.TerminalNode + ZONE() antlr.TerminalNode + WITHOUT() antlr.TerminalNode + + // IsOpt_timezoneContext differentiates from other interfaces. + IsOpt_timezoneContext() +} + +type Opt_timezoneContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_timezoneContext() *Opt_timezoneContext { + var p = new(Opt_timezoneContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_timezone + return p +} + +func InitEmptyOpt_timezoneContext(p *Opt_timezoneContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_timezone +} + +func (*Opt_timezoneContext) IsOpt_timezoneContext() {} + +func NewOpt_timezoneContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_timezoneContext { + var p = new(Opt_timezoneContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_timezone + + return p +} + +func (s *Opt_timezoneContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_timezoneContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Opt_timezoneContext) TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIME, 0) +} + +func (s *Opt_timezoneContext) ZONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserZONE, 0) +} + +func (s *Opt_timezoneContext) WITHOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITHOUT, 0) +} + +func (s *Opt_timezoneContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_timezoneContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_timezoneContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_timezone(s) + } +} + +func (s *Opt_timezoneContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_timezone(s) + } +} + +func (s *Opt_timezoneContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_timezone(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_timezone() (localctx IOpt_timezoneContext) { + localctx = NewOpt_timezoneContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1164, PostgreSQLParserRULE_opt_timezone) + p.SetState(9305) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserWITH: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9299) + p.Match(PostgreSQLParserWITH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9300) + p.Match(PostgreSQLParserTIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9301) + p.Match(PostgreSQLParserZONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserWITHOUT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9302) + p.Match(PostgreSQLParserWITHOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9303) + p.Match(PostgreSQLParserTIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9304) + p.Match(PostgreSQLParserZONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_intervalContext is an interface to support dynamic dispatch. +type IOpt_intervalContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + YEAR_P() antlr.TerminalNode + MONTH_P() antlr.TerminalNode + DAY_P() antlr.TerminalNode + HOUR_P() antlr.TerminalNode + MINUTE_P() antlr.TerminalNode + Interval_second() IInterval_secondContext + TO() antlr.TerminalNode + + // IsOpt_intervalContext differentiates from other interfaces. + IsOpt_intervalContext() +} + +type Opt_intervalContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_intervalContext() *Opt_intervalContext { + var p = new(Opt_intervalContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_interval + return p +} + +func InitEmptyOpt_intervalContext(p *Opt_intervalContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_interval +} + +func (*Opt_intervalContext) IsOpt_intervalContext() {} + +func NewOpt_intervalContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_intervalContext { + var p = new(Opt_intervalContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_interval + + return p +} + +func (s *Opt_intervalContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_intervalContext) YEAR_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserYEAR_P, 0) +} + +func (s *Opt_intervalContext) MONTH_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMONTH_P, 0) +} + +func (s *Opt_intervalContext) DAY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDAY_P, 0) +} + +func (s *Opt_intervalContext) HOUR_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHOUR_P, 0) +} + +func (s *Opt_intervalContext) MINUTE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUTE_P, 0) +} + +func (s *Opt_intervalContext) Interval_second() IInterval_secondContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInterval_secondContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInterval_secondContext) +} + +func (s *Opt_intervalContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Opt_intervalContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_intervalContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_intervalContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_interval(s) + } +} + +func (s *Opt_intervalContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_interval(s) + } +} + +func (s *Opt_intervalContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_interval(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_interval() (localctx IOpt_intervalContext) { + localctx = NewOpt_intervalContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1166, PostgreSQLParserRULE_opt_interval) + p.SetState(9332) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 874, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9307) + p.Match(PostgreSQLParserYEAR_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9308) + p.Match(PostgreSQLParserMONTH_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9309) + p.Match(PostgreSQLParserDAY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(9310) + p.Match(PostgreSQLParserHOUR_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(9311) + p.Match(PostgreSQLParserMINUTE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(9312) + p.Interval_second() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(9313) + p.Match(PostgreSQLParserYEAR_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9314) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9315) + p.Match(PostgreSQLParserMONTH_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(9316) + p.Match(PostgreSQLParserDAY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9317) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9321) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserHOUR_P: + { + p.SetState(9318) + p.Match(PostgreSQLParserHOUR_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserMINUTE_P: + { + p.SetState(9319) + p.Match(PostgreSQLParserMINUTE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSECOND_P: + { + p.SetState(9320) + p.Interval_second() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(9323) + p.Match(PostgreSQLParserHOUR_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9324) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9327) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserMINUTE_P: + { + p.SetState(9325) + p.Match(PostgreSQLParserMINUTE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSECOND_P: + { + p.SetState(9326) + p.Interval_second() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(9329) + p.Match(PostgreSQLParserMINUTE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9330) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9331) + p.Interval_second() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IInterval_secondContext is an interface to support dynamic dispatch. +type IInterval_secondContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SECOND_P() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Iconst() IIconstContext + CLOSE_PAREN() antlr.TerminalNode + + // IsInterval_secondContext differentiates from other interfaces. + IsInterval_secondContext() +} + +type Interval_secondContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInterval_secondContext() *Interval_secondContext { + var p = new(Interval_secondContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_interval_second + return p +} + +func InitEmptyInterval_secondContext(p *Interval_secondContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_interval_second +} + +func (*Interval_secondContext) IsInterval_secondContext() {} + +func NewInterval_secondContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Interval_secondContext { + var p = new(Interval_secondContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_interval_second + + return p +} + +func (s *Interval_secondContext) GetParser() antlr.Parser { return s.parser } + +func (s *Interval_secondContext) SECOND_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSECOND_P, 0) +} + +func (s *Interval_secondContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Interval_secondContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Interval_secondContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Interval_secondContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Interval_secondContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Interval_secondContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterInterval_second(s) + } +} + +func (s *Interval_secondContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitInterval_second(s) + } +} + +func (s *Interval_secondContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitInterval_second(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Interval_second() (localctx IInterval_secondContext) { + localctx = NewInterval_secondContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1168, PostgreSQLParserRULE_interval_second) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9334) + p.Match(PostgreSQLParserSECOND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9339) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 875, p.GetParserRuleContext()) == 1 { + { + p.SetState(9335) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9336) + p.Iconst() + } + { + p.SetState(9337) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_escapeContext is an interface to support dynamic dispatch. +type IOpt_escapeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ESCAPE() antlr.TerminalNode + A_expr() IA_exprContext + + // IsOpt_escapeContext differentiates from other interfaces. + IsOpt_escapeContext() +} + +type Opt_escapeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_escapeContext() *Opt_escapeContext { + var p = new(Opt_escapeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_escape + return p +} + +func InitEmptyOpt_escapeContext(p *Opt_escapeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_escape +} + +func (*Opt_escapeContext) IsOpt_escapeContext() {} + +func NewOpt_escapeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_escapeContext { + var p = new(Opt_escapeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_escape + + return p +} + +func (s *Opt_escapeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_escapeContext) ESCAPE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserESCAPE, 0) +} + +func (s *Opt_escapeContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_escapeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_escapeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_escapeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_escape(s) + } +} + +func (s *Opt_escapeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_escape(s) + } +} + +func (s *Opt_escapeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_escape(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_escape() (localctx IOpt_escapeContext) { + localctx = NewOpt_escapeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1170, PostgreSQLParserRULE_opt_escape) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9341) + p.Match(PostgreSQLParserESCAPE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9342) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_exprContext is an interface to support dynamic dispatch. +type IA_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_qual() IA_expr_qualContext + + // IsA_exprContext differentiates from other interfaces. + IsA_exprContext() +} + +type A_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_exprContext() *A_exprContext { + var p = new(A_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr + return p +} + +func InitEmptyA_exprContext(p *A_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr +} + +func (*A_exprContext) IsA_exprContext() {} + +func NewA_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_exprContext { + var p = new(A_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr + + return p +} + +func (s *A_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_exprContext) A_expr_qual() IA_expr_qualContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_qualContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_qualContext) +} + +func (s *A_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr(s) + } +} + +func (s *A_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr(s) + } +} + +func (s *A_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr() (localctx IA_exprContext) { + localctx = NewA_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1172, PostgreSQLParserRULE_a_expr) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9344) + p.A_expr_qual() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_qualContext is an interface to support dynamic dispatch. +type IA_expr_qualContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_lessless() IA_expr_lesslessContext + Qual_op() IQual_opContext + + // IsA_expr_qualContext differentiates from other interfaces. + IsA_expr_qualContext() +} + +type A_expr_qualContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_qualContext() *A_expr_qualContext { + var p = new(A_expr_qualContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_qual + return p +} + +func InitEmptyA_expr_qualContext(p *A_expr_qualContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_qual +} + +func (*A_expr_qualContext) IsA_expr_qualContext() {} + +func NewA_expr_qualContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_qualContext { + var p = new(A_expr_qualContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_qual + + return p +} + +func (s *A_expr_qualContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_qualContext) A_expr_lessless() IA_expr_lesslessContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_lesslessContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_lesslessContext) +} + +func (s *A_expr_qualContext) Qual_op() IQual_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQual_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQual_opContext) +} + +func (s *A_expr_qualContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_qualContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_qualContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_qual(s) + } +} + +func (s *A_expr_qualContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_qual(s) + } +} + +func (s *A_expr_qualContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_qual(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_qual() (localctx IA_expr_qualContext) { + localctx = NewA_expr_qualContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1174, PostgreSQLParserRULE_a_expr_qual) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9346) + p.A_expr_lessless() + } + p.SetState(9348) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 876, p.GetParserRuleContext()) == 1 { + { + p.SetState(9347) + p.Qual_op() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_lesslessContext is an interface to support dynamic dispatch. +type IA_expr_lesslessContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_or() []IA_expr_orContext + A_expr_or(i int) IA_expr_orContext + AllLESS_LESS() []antlr.TerminalNode + LESS_LESS(i int) antlr.TerminalNode + AllGREATER_GREATER() []antlr.TerminalNode + GREATER_GREATER(i int) antlr.TerminalNode + + // IsA_expr_lesslessContext differentiates from other interfaces. + IsA_expr_lesslessContext() +} + +type A_expr_lesslessContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_lesslessContext() *A_expr_lesslessContext { + var p = new(A_expr_lesslessContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_lessless + return p +} + +func InitEmptyA_expr_lesslessContext(p *A_expr_lesslessContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_lessless +} + +func (*A_expr_lesslessContext) IsA_expr_lesslessContext() {} + +func NewA_expr_lesslessContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_lesslessContext { + var p = new(A_expr_lesslessContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_lessless + + return p +} + +func (s *A_expr_lesslessContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_lesslessContext) AllA_expr_or() []IA_expr_orContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_orContext); ok { + len++ + } + } + + tst := make([]IA_expr_orContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_orContext); ok { + tst[i] = t.(IA_expr_orContext) + i++ + } + } + + return tst +} + +func (s *A_expr_lesslessContext) A_expr_or(i int) IA_expr_orContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_orContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_orContext) +} + +func (s *A_expr_lesslessContext) AllLESS_LESS() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserLESS_LESS) +} + +func (s *A_expr_lesslessContext) LESS_LESS(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLESS_LESS, i) +} + +func (s *A_expr_lesslessContext) AllGREATER_GREATER() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserGREATER_GREATER) +} + +func (s *A_expr_lesslessContext) GREATER_GREATER(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGREATER_GREATER, i) +} + +func (s *A_expr_lesslessContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_lesslessContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_lesslessContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_lessless(s) + } +} + +func (s *A_expr_lesslessContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_lessless(s) + } +} + +func (s *A_expr_lesslessContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_lessless(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_lessless() (localctx IA_expr_lesslessContext) { + localctx = NewA_expr_lesslessContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1176, PostgreSQLParserRULE_a_expr_lessless) + var _la int + + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9350) + p.A_expr_or() + } + p.SetState(9355) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 877, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(9351) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserLESS_LESS || _la == PostgreSQLParserGREATER_GREATER) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9352) + p.A_expr_or() + } + + } + p.SetState(9357) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 877, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_orContext is an interface to support dynamic dispatch. +type IA_expr_orContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_and() []IA_expr_andContext + A_expr_and(i int) IA_expr_andContext + AllOR() []antlr.TerminalNode + OR(i int) antlr.TerminalNode + + // IsA_expr_orContext differentiates from other interfaces. + IsA_expr_orContext() +} + +type A_expr_orContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_orContext() *A_expr_orContext { + var p = new(A_expr_orContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_or + return p +} + +func InitEmptyA_expr_orContext(p *A_expr_orContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_or +} + +func (*A_expr_orContext) IsA_expr_orContext() {} + +func NewA_expr_orContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_orContext { + var p = new(A_expr_orContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_or + + return p +} + +func (s *A_expr_orContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_orContext) AllA_expr_and() []IA_expr_andContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_andContext); ok { + len++ + } + } + + tst := make([]IA_expr_andContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_andContext); ok { + tst[i] = t.(IA_expr_andContext) + i++ + } + } + + return tst +} + +func (s *A_expr_orContext) A_expr_and(i int) IA_expr_andContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_andContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_andContext) +} + +func (s *A_expr_orContext) AllOR() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserOR) +} + +func (s *A_expr_orContext) OR(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOR, i) +} + +func (s *A_expr_orContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_orContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_orContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_or(s) + } +} + +func (s *A_expr_orContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_or(s) + } +} + +func (s *A_expr_orContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_or(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_or() (localctx IA_expr_orContext) { + localctx = NewA_expr_orContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1178, PostgreSQLParserRULE_a_expr_or) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9358) + p.A_expr_and() + } + p.SetState(9363) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 878, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(9359) + p.Match(PostgreSQLParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9360) + p.A_expr_and() + } + + } + p.SetState(9365) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 878, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_andContext is an interface to support dynamic dispatch. +type IA_expr_andContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_between() []IA_expr_betweenContext + A_expr_between(i int) IA_expr_betweenContext + AllAND() []antlr.TerminalNode + AND(i int) antlr.TerminalNode + + // IsA_expr_andContext differentiates from other interfaces. + IsA_expr_andContext() +} + +type A_expr_andContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_andContext() *A_expr_andContext { + var p = new(A_expr_andContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_and + return p +} + +func InitEmptyA_expr_andContext(p *A_expr_andContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_and +} + +func (*A_expr_andContext) IsA_expr_andContext() {} + +func NewA_expr_andContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_andContext { + var p = new(A_expr_andContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_and + + return p +} + +func (s *A_expr_andContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_andContext) AllA_expr_between() []IA_expr_betweenContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_betweenContext); ok { + len++ + } + } + + tst := make([]IA_expr_betweenContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_betweenContext); ok { + tst[i] = t.(IA_expr_betweenContext) + i++ + } + } + + return tst +} + +func (s *A_expr_andContext) A_expr_between(i int) IA_expr_betweenContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_betweenContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_betweenContext) +} + +func (s *A_expr_andContext) AllAND() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserAND) +} + +func (s *A_expr_andContext) AND(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, i) +} + +func (s *A_expr_andContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_andContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_andContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_and(s) + } +} + +func (s *A_expr_andContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_and(s) + } +} + +func (s *A_expr_andContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_and(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_and() (localctx IA_expr_andContext) { + localctx = NewA_expr_andContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1180, PostgreSQLParserRULE_a_expr_and) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9366) + p.A_expr_between() + } + p.SetState(9371) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 879, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(9367) + p.Match(PostgreSQLParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9368) + p.A_expr_between() + } + + } + p.SetState(9373) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 879, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_betweenContext is an interface to support dynamic dispatch. +type IA_expr_betweenContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_in() []IA_expr_inContext + A_expr_in(i int) IA_expr_inContext + BETWEEN() antlr.TerminalNode + AND() antlr.TerminalNode + NOT() antlr.TerminalNode + SYMMETRIC() antlr.TerminalNode + + // IsA_expr_betweenContext differentiates from other interfaces. + IsA_expr_betweenContext() +} + +type A_expr_betweenContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_betweenContext() *A_expr_betweenContext { + var p = new(A_expr_betweenContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_between + return p +} + +func InitEmptyA_expr_betweenContext(p *A_expr_betweenContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_between +} + +func (*A_expr_betweenContext) IsA_expr_betweenContext() {} + +func NewA_expr_betweenContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_betweenContext { + var p = new(A_expr_betweenContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_between + + return p +} + +func (s *A_expr_betweenContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_betweenContext) AllA_expr_in() []IA_expr_inContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_inContext); ok { + len++ + } + } + + tst := make([]IA_expr_inContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_inContext); ok { + tst[i] = t.(IA_expr_inContext) + i++ + } + } + + return tst +} + +func (s *A_expr_betweenContext) A_expr_in(i int) IA_expr_inContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_inContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_inContext) +} + +func (s *A_expr_betweenContext) BETWEEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBETWEEN, 0) +} + +func (s *A_expr_betweenContext) AND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, 0) +} + +func (s *A_expr_betweenContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *A_expr_betweenContext) SYMMETRIC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYMMETRIC, 0) +} + +func (s *A_expr_betweenContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_betweenContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_betweenContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_between(s) + } +} + +func (s *A_expr_betweenContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_between(s) + } +} + +func (s *A_expr_betweenContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_between(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_between() (localctx IA_expr_betweenContext) { + localctx = NewA_expr_betweenContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1182, PostgreSQLParserRULE_a_expr_between) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9374) + p.A_expr_in() + } + p.SetState(9386) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 882, p.GetParserRuleContext()) == 1 { + p.SetState(9376) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT { + { + p.SetState(9375) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(9378) + p.Match(PostgreSQLParserBETWEEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9380) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSYMMETRIC { + { + p.SetState(9379) + p.Match(PostgreSQLParserSYMMETRIC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(9382) + p.A_expr_in() + } + { + p.SetState(9383) + p.Match(PostgreSQLParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9384) + p.A_expr_in() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_inContext is an interface to support dynamic dispatch. +type IA_expr_inContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_unary_not() IA_expr_unary_notContext + IN_P() antlr.TerminalNode + In_expr() IIn_exprContext + NOT() antlr.TerminalNode + + // IsA_expr_inContext differentiates from other interfaces. + IsA_expr_inContext() +} + +type A_expr_inContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_inContext() *A_expr_inContext { + var p = new(A_expr_inContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_in + return p +} + +func InitEmptyA_expr_inContext(p *A_expr_inContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_in +} + +func (*A_expr_inContext) IsA_expr_inContext() {} + +func NewA_expr_inContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_inContext { + var p = new(A_expr_inContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_in + + return p +} + +func (s *A_expr_inContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_inContext) A_expr_unary_not() IA_expr_unary_notContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_unary_notContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_unary_notContext) +} + +func (s *A_expr_inContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *A_expr_inContext) In_expr() IIn_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIn_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIn_exprContext) +} + +func (s *A_expr_inContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *A_expr_inContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_inContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_inContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_in(s) + } +} + +func (s *A_expr_inContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_in(s) + } +} + +func (s *A_expr_inContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_in(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_in() (localctx IA_expr_inContext) { + localctx = NewA_expr_inContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1184, PostgreSQLParserRULE_a_expr_in) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9388) + p.A_expr_unary_not() + } + p.SetState(9394) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 884, p.GetParserRuleContext()) == 1 { + p.SetState(9390) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT { + { + p.SetState(9389) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(9392) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9393) + p.In_expr() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_unary_notContext is an interface to support dynamic dispatch. +type IA_expr_unary_notContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_isnull() IA_expr_isnullContext + NOT() antlr.TerminalNode + + // IsA_expr_unary_notContext differentiates from other interfaces. + IsA_expr_unary_notContext() +} + +type A_expr_unary_notContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_unary_notContext() *A_expr_unary_notContext { + var p = new(A_expr_unary_notContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_not + return p +} + +func InitEmptyA_expr_unary_notContext(p *A_expr_unary_notContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_not +} + +func (*A_expr_unary_notContext) IsA_expr_unary_notContext() {} + +func NewA_expr_unary_notContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_unary_notContext { + var p = new(A_expr_unary_notContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_not + + return p +} + +func (s *A_expr_unary_notContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_unary_notContext) A_expr_isnull() IA_expr_isnullContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_isnullContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_isnullContext) +} + +func (s *A_expr_unary_notContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *A_expr_unary_notContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_unary_notContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_unary_notContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_unary_not(s) + } +} + +func (s *A_expr_unary_notContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_unary_not(s) + } +} + +func (s *A_expr_unary_notContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_unary_not(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_unary_not() (localctx IA_expr_unary_notContext) { + localctx = NewA_expr_unary_notContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1186, PostgreSQLParserRULE_a_expr_unary_not) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(9397) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT { + { + p.SetState(9396) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(9399) + p.A_expr_isnull() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_isnullContext is an interface to support dynamic dispatch. +type IA_expr_isnullContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_is_not() IA_expr_is_notContext + ISNULL() antlr.TerminalNode + NOTNULL() antlr.TerminalNode + + // IsA_expr_isnullContext differentiates from other interfaces. + IsA_expr_isnullContext() +} + +type A_expr_isnullContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_isnullContext() *A_expr_isnullContext { + var p = new(A_expr_isnullContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_isnull + return p +} + +func InitEmptyA_expr_isnullContext(p *A_expr_isnullContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_isnull +} + +func (*A_expr_isnullContext) IsA_expr_isnullContext() {} + +func NewA_expr_isnullContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_isnullContext { + var p = new(A_expr_isnullContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_isnull + + return p +} + +func (s *A_expr_isnullContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_isnullContext) A_expr_is_not() IA_expr_is_notContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_is_notContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_is_notContext) +} + +func (s *A_expr_isnullContext) ISNULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserISNULL, 0) +} + +func (s *A_expr_isnullContext) NOTNULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTNULL, 0) +} + +func (s *A_expr_isnullContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_isnullContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_isnullContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_isnull(s) + } +} + +func (s *A_expr_isnullContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_isnull(s) + } +} + +func (s *A_expr_isnullContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_isnull(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_isnull() (localctx IA_expr_isnullContext) { + localctx = NewA_expr_isnullContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1188, PostgreSQLParserRULE_a_expr_isnull) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9401) + p.A_expr_is_not() + } + p.SetState(9403) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 886, p.GetParserRuleContext()) == 1 { + { + p.SetState(9402) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserISNULL || _la == PostgreSQLParserNOTNULL) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_is_notContext is an interface to support dynamic dispatch. +type IA_expr_is_notContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_compare() IA_expr_compareContext + IS() antlr.TerminalNode + NULL_P() antlr.TerminalNode + TRUE_P() antlr.TerminalNode + FALSE_P() antlr.TerminalNode + UNKNOWN() antlr.TerminalNode + DISTINCT() antlr.TerminalNode + FROM() antlr.TerminalNode + A_expr() IA_exprContext + OF() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Type_list() IType_listContext + CLOSE_PAREN() antlr.TerminalNode + DOCUMENT_P() antlr.TerminalNode + NORMALIZED() antlr.TerminalNode + NOT() antlr.TerminalNode + Unicode_normal_form() IUnicode_normal_formContext + + // IsA_expr_is_notContext differentiates from other interfaces. + IsA_expr_is_notContext() +} + +type A_expr_is_notContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_is_notContext() *A_expr_is_notContext { + var p = new(A_expr_is_notContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_is_not + return p +} + +func InitEmptyA_expr_is_notContext(p *A_expr_is_notContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_is_not +} + +func (*A_expr_is_notContext) IsA_expr_is_notContext() {} + +func NewA_expr_is_notContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_is_notContext { + var p = new(A_expr_is_notContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_is_not + + return p +} + +func (s *A_expr_is_notContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_is_notContext) A_expr_compare() IA_expr_compareContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_compareContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_compareContext) +} + +func (s *A_expr_is_notContext) IS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIS, 0) +} + +func (s *A_expr_is_notContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *A_expr_is_notContext) TRUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUE_P, 0) +} + +func (s *A_expr_is_notContext) FALSE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFALSE_P, 0) +} + +func (s *A_expr_is_notContext) UNKNOWN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNKNOWN, 0) +} + +func (s *A_expr_is_notContext) DISTINCT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISTINCT, 0) +} + +func (s *A_expr_is_notContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *A_expr_is_notContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *A_expr_is_notContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *A_expr_is_notContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *A_expr_is_notContext) Type_list() IType_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_listContext) +} + +func (s *A_expr_is_notContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *A_expr_is_notContext) DOCUMENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOCUMENT_P, 0) +} + +func (s *A_expr_is_notContext) NORMALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNORMALIZED, 0) +} + +func (s *A_expr_is_notContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *A_expr_is_notContext) Unicode_normal_form() IUnicode_normal_formContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnicode_normal_formContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnicode_normal_formContext) +} + +func (s *A_expr_is_notContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_is_notContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_is_notContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_is_not(s) + } +} + +func (s *A_expr_is_notContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_is_not(s) + } +} + +func (s *A_expr_is_notContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_is_not(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_is_not() (localctx IA_expr_is_notContext) { + localctx = NewA_expr_is_notContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1190, PostgreSQLParserRULE_a_expr_is_not) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9405) + p.A_expr_compare() + } + p.SetState(9429) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 890, p.GetParserRuleContext()) == 1 { + { + p.SetState(9406) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9408) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT { + { + p.SetState(9407) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(9427) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNULL_P: + { + p.SetState(9410) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserTRUE_P: + { + p.SetState(9411) + p.Match(PostgreSQLParserTRUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserFALSE_P: + { + p.SetState(9412) + p.Match(PostgreSQLParserFALSE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserUNKNOWN: + { + p.SetState(9413) + p.Match(PostgreSQLParserUNKNOWN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDISTINCT: + { + p.SetState(9414) + p.Match(PostgreSQLParserDISTINCT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9415) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9416) + p.A_expr() + } + + case PostgreSQLParserOF: + { + p.SetState(9417) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9418) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9419) + p.Type_list() + } + { + p.SetState(9420) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDOCUMENT_P: + { + p.SetState(9422) + p.Match(PostgreSQLParserDOCUMENT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNORMALIZED, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD: + p.SetState(9424) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-485)) & ^0x3f) == 0 && ((int64(1)<<(_la-485))&15) != 0 { + { + p.SetState(9423) + p.Unicode_normal_form() + } + + } + { + p.SetState(9426) + p.Match(PostgreSQLParserNORMALIZED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_compareContext is an interface to support dynamic dispatch. +type IA_expr_compareContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_like() []IA_expr_likeContext + A_expr_like(i int) IA_expr_likeContext + Subquery_Op() ISubquery_OpContext + Sub_type() ISub_typeContext + LT() antlr.TerminalNode + GT() antlr.TerminalNode + EQUAL() antlr.TerminalNode + LESS_EQUALS() antlr.TerminalNode + GREATER_EQUALS() antlr.TerminalNode + NOT_EQUALS() antlr.TerminalNode + Select_with_parens() ISelect_with_parensContext + OPEN_PAREN() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsA_expr_compareContext differentiates from other interfaces. + IsA_expr_compareContext() +} + +type A_expr_compareContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_compareContext() *A_expr_compareContext { + var p = new(A_expr_compareContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_compare + return p +} + +func InitEmptyA_expr_compareContext(p *A_expr_compareContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_compare +} + +func (*A_expr_compareContext) IsA_expr_compareContext() {} + +func NewA_expr_compareContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_compareContext { + var p = new(A_expr_compareContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_compare + + return p +} + +func (s *A_expr_compareContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_compareContext) AllA_expr_like() []IA_expr_likeContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_likeContext); ok { + len++ + } + } + + tst := make([]IA_expr_likeContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_likeContext); ok { + tst[i] = t.(IA_expr_likeContext) + i++ + } + } + + return tst +} + +func (s *A_expr_compareContext) A_expr_like(i int) IA_expr_likeContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_likeContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_likeContext) +} + +func (s *A_expr_compareContext) Subquery_Op() ISubquery_OpContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISubquery_OpContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISubquery_OpContext) +} + +func (s *A_expr_compareContext) Sub_type() ISub_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISub_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISub_typeContext) +} + +func (s *A_expr_compareContext) LT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLT, 0) +} + +func (s *A_expr_compareContext) GT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGT, 0) +} + +func (s *A_expr_compareContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *A_expr_compareContext) LESS_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLESS_EQUALS, 0) +} + +func (s *A_expr_compareContext) GREATER_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGREATER_EQUALS, 0) +} + +func (s *A_expr_compareContext) NOT_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT_EQUALS, 0) +} + +func (s *A_expr_compareContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *A_expr_compareContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *A_expr_compareContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *A_expr_compareContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *A_expr_compareContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_compareContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_compareContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_compare(s) + } +} + +func (s *A_expr_compareContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_compare(s) + } +} + +func (s *A_expr_compareContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_compare(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_compare() (localctx IA_expr_compareContext) { + localctx = NewA_expr_compareContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1192, PostgreSQLParserRULE_a_expr_compare) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9431) + p.A_expr_like() + } + p.SetState(9443) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 892, p.GetParserRuleContext()) == 1 { + { + p.SetState(9432) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&44237824) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9433) + p.A_expr_like() + } + + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 892, p.GetParserRuleContext()) == 2 { + { + p.SetState(9434) + p.Subquery_Op() + } + { + p.SetState(9435) + p.Sub_type() + } + p.SetState(9441) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 891, p.GetParserRuleContext()) { + case 1: + { + p.SetState(9436) + p.Select_with_parens() + } + + case 2: + { + p.SetState(9437) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9438) + p.A_expr() + } + { + p.SetState(9439) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_likeContext is an interface to support dynamic dispatch. +type IA_expr_likeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_qual_op() []IA_expr_qual_opContext + A_expr_qual_op(i int) IA_expr_qual_opContext + LIKE() antlr.TerminalNode + ILIKE() antlr.TerminalNode + SIMILAR() antlr.TerminalNode + TO() antlr.TerminalNode + NOT() antlr.TerminalNode + Opt_escape() IOpt_escapeContext + + // IsA_expr_likeContext differentiates from other interfaces. + IsA_expr_likeContext() +} + +type A_expr_likeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_likeContext() *A_expr_likeContext { + var p = new(A_expr_likeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_like + return p +} + +func InitEmptyA_expr_likeContext(p *A_expr_likeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_like +} + +func (*A_expr_likeContext) IsA_expr_likeContext() {} + +func NewA_expr_likeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_likeContext { + var p = new(A_expr_likeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_like + + return p +} + +func (s *A_expr_likeContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_likeContext) AllA_expr_qual_op() []IA_expr_qual_opContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_qual_opContext); ok { + len++ + } + } + + tst := make([]IA_expr_qual_opContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_qual_opContext); ok { + tst[i] = t.(IA_expr_qual_opContext) + i++ + } + } + + return tst +} + +func (s *A_expr_likeContext) A_expr_qual_op(i int) IA_expr_qual_opContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_qual_opContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_qual_opContext) +} + +func (s *A_expr_likeContext) LIKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIKE, 0) +} + +func (s *A_expr_likeContext) ILIKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserILIKE, 0) +} + +func (s *A_expr_likeContext) SIMILAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSIMILAR, 0) +} + +func (s *A_expr_likeContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *A_expr_likeContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *A_expr_likeContext) Opt_escape() IOpt_escapeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_escapeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_escapeContext) +} + +func (s *A_expr_likeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_likeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_likeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_like(s) + } +} + +func (s *A_expr_likeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_like(s) + } +} + +func (s *A_expr_likeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_like(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_like() (localctx IA_expr_likeContext) { + localctx = NewA_expr_likeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1194, PostgreSQLParserRULE_a_expr_like) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9445) + p.A_expr_qual_op() + } + p.SetState(9459) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 896, p.GetParserRuleContext()) == 1 { + p.SetState(9447) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT { + { + p.SetState(9446) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(9453) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserLIKE: + { + p.SetState(9449) + p.Match(PostgreSQLParserLIKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserILIKE: + { + p.SetState(9450) + p.Match(PostgreSQLParserILIKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSIMILAR: + { + p.SetState(9451) + p.Match(PostgreSQLParserSIMILAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9452) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(9455) + p.A_expr_qual_op() + } + p.SetState(9457) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 895, p.GetParserRuleContext()) == 1 { + { + p.SetState(9456) + p.Opt_escape() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_qual_opContext is an interface to support dynamic dispatch. +type IA_expr_qual_opContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_unary_qualop() []IA_expr_unary_qualopContext + A_expr_unary_qualop(i int) IA_expr_unary_qualopContext + AllQual_op() []IQual_opContext + Qual_op(i int) IQual_opContext + + // IsA_expr_qual_opContext differentiates from other interfaces. + IsA_expr_qual_opContext() +} + +type A_expr_qual_opContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_qual_opContext() *A_expr_qual_opContext { + var p = new(A_expr_qual_opContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_qual_op + return p +} + +func InitEmptyA_expr_qual_opContext(p *A_expr_qual_opContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_qual_op +} + +func (*A_expr_qual_opContext) IsA_expr_qual_opContext() {} + +func NewA_expr_qual_opContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_qual_opContext { + var p = new(A_expr_qual_opContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_qual_op + + return p +} + +func (s *A_expr_qual_opContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_qual_opContext) AllA_expr_unary_qualop() []IA_expr_unary_qualopContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_unary_qualopContext); ok { + len++ + } + } + + tst := make([]IA_expr_unary_qualopContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_unary_qualopContext); ok { + tst[i] = t.(IA_expr_unary_qualopContext) + i++ + } + } + + return tst +} + +func (s *A_expr_qual_opContext) A_expr_unary_qualop(i int) IA_expr_unary_qualopContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_unary_qualopContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_unary_qualopContext) +} + +func (s *A_expr_qual_opContext) AllQual_op() []IQual_opContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IQual_opContext); ok { + len++ + } + } + + tst := make([]IQual_opContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IQual_opContext); ok { + tst[i] = t.(IQual_opContext) + i++ + } + } + + return tst +} + +func (s *A_expr_qual_opContext) Qual_op(i int) IQual_opContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQual_opContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IQual_opContext) +} + +func (s *A_expr_qual_opContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_qual_opContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_qual_opContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_qual_op(s) + } +} + +func (s *A_expr_qual_opContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_qual_op(s) + } +} + +func (s *A_expr_qual_opContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_qual_op(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_qual_op() (localctx IA_expr_qual_opContext) { + localctx = NewA_expr_qual_opContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1196, PostgreSQLParserRULE_a_expr_qual_op) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9461) + p.A_expr_unary_qualop() + } + p.SetState(9467) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 897, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(9462) + p.Qual_op() + } + { + p.SetState(9463) + p.A_expr_unary_qualop() + } + + } + p.SetState(9469) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 897, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_unary_qualopContext is an interface to support dynamic dispatch. +type IA_expr_unary_qualopContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_add() IA_expr_addContext + Qual_op() IQual_opContext + + // IsA_expr_unary_qualopContext differentiates from other interfaces. + IsA_expr_unary_qualopContext() +} + +type A_expr_unary_qualopContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_unary_qualopContext() *A_expr_unary_qualopContext { + var p = new(A_expr_unary_qualopContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_qualop + return p +} + +func InitEmptyA_expr_unary_qualopContext(p *A_expr_unary_qualopContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_qualop +} + +func (*A_expr_unary_qualopContext) IsA_expr_unary_qualopContext() {} + +func NewA_expr_unary_qualopContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_unary_qualopContext { + var p = new(A_expr_unary_qualopContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_qualop + + return p +} + +func (s *A_expr_unary_qualopContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_unary_qualopContext) A_expr_add() IA_expr_addContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_addContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_addContext) +} + +func (s *A_expr_unary_qualopContext) Qual_op() IQual_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQual_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQual_opContext) +} + +func (s *A_expr_unary_qualopContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_unary_qualopContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_unary_qualopContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_unary_qualop(s) + } +} + +func (s *A_expr_unary_qualopContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_unary_qualop(s) + } +} + +func (s *A_expr_unary_qualopContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_unary_qualop(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_unary_qualop() (localctx IA_expr_unary_qualopContext) { + localctx = NewA_expr_unary_qualopContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1198, PostgreSQLParserRULE_a_expr_unary_qualop) + p.EnterOuterAlt(localctx, 1) + p.SetState(9471) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 898, p.GetParserRuleContext()) == 1 { + { + p.SetState(9470) + p.Qual_op() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(9473) + p.A_expr_add() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_addContext is an interface to support dynamic dispatch. +type IA_expr_addContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_mul() []IA_expr_mulContext + A_expr_mul(i int) IA_expr_mulContext + AllMINUS() []antlr.TerminalNode + MINUS(i int) antlr.TerminalNode + AllPLUS() []antlr.TerminalNode + PLUS(i int) antlr.TerminalNode + + // IsA_expr_addContext differentiates from other interfaces. + IsA_expr_addContext() +} + +type A_expr_addContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_addContext() *A_expr_addContext { + var p = new(A_expr_addContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_add + return p +} + +func InitEmptyA_expr_addContext(p *A_expr_addContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_add +} + +func (*A_expr_addContext) IsA_expr_addContext() {} + +func NewA_expr_addContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_addContext { + var p = new(A_expr_addContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_add + + return p +} + +func (s *A_expr_addContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_addContext) AllA_expr_mul() []IA_expr_mulContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_mulContext); ok { + len++ + } + } + + tst := make([]IA_expr_mulContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_mulContext); ok { + tst[i] = t.(IA_expr_mulContext) + i++ + } + } + + return tst +} + +func (s *A_expr_addContext) A_expr_mul(i int) IA_expr_mulContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_mulContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_mulContext) +} + +func (s *A_expr_addContext) AllMINUS() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserMINUS) +} + +func (s *A_expr_addContext) MINUS(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUS, i) +} + +func (s *A_expr_addContext) AllPLUS() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserPLUS) +} + +func (s *A_expr_addContext) PLUS(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLUS, i) +} + +func (s *A_expr_addContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_addContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_addContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_add(s) + } +} + +func (s *A_expr_addContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_add(s) + } +} + +func (s *A_expr_addContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_add(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_add() (localctx IA_expr_addContext) { + localctx = NewA_expr_addContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1200, PostgreSQLParserRULE_a_expr_add) + var _la int + + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9475) + p.A_expr_mul() + } + p.SetState(9480) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 899, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(9476) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserPLUS || _la == PostgreSQLParserMINUS) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9477) + p.A_expr_mul() + } + + } + p.SetState(9482) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 899, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_mulContext is an interface to support dynamic dispatch. +type IA_expr_mulContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr_caret() []IA_expr_caretContext + A_expr_caret(i int) IA_expr_caretContext + AllSTAR() []antlr.TerminalNode + STAR(i int) antlr.TerminalNode + AllSLASH() []antlr.TerminalNode + SLASH(i int) antlr.TerminalNode + AllPERCENT() []antlr.TerminalNode + PERCENT(i int) antlr.TerminalNode + + // IsA_expr_mulContext differentiates from other interfaces. + IsA_expr_mulContext() +} + +type A_expr_mulContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_mulContext() *A_expr_mulContext { + var p = new(A_expr_mulContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_mul + return p +} + +func InitEmptyA_expr_mulContext(p *A_expr_mulContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_mul +} + +func (*A_expr_mulContext) IsA_expr_mulContext() {} + +func NewA_expr_mulContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_mulContext { + var p = new(A_expr_mulContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_mul + + return p +} + +func (s *A_expr_mulContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_mulContext) AllA_expr_caret() []IA_expr_caretContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_expr_caretContext); ok { + len++ + } + } + + tst := make([]IA_expr_caretContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_expr_caretContext); ok { + tst[i] = t.(IA_expr_caretContext) + i++ + } + } + + return tst +} + +func (s *A_expr_mulContext) A_expr_caret(i int) IA_expr_caretContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_caretContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_caretContext) +} + +func (s *A_expr_mulContext) AllSTAR() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserSTAR) +} + +func (s *A_expr_mulContext) STAR(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, i) +} + +func (s *A_expr_mulContext) AllSLASH() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserSLASH) +} + +func (s *A_expr_mulContext) SLASH(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSLASH, i) +} + +func (s *A_expr_mulContext) AllPERCENT() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserPERCENT) +} + +func (s *A_expr_mulContext) PERCENT(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPERCENT, i) +} + +func (s *A_expr_mulContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_mulContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_mulContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_mul(s) + } +} + +func (s *A_expr_mulContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_mul(s) + } +} + +func (s *A_expr_mulContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_mul(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_mul() (localctx IA_expr_mulContext) { + localctx = NewA_expr_mulContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1202, PostgreSQLParserRULE_a_expr_mul) + var _la int + + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9483) + p.A_expr_caret() + } + p.SetState(9488) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 900, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(9484) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&134234624) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9485) + p.A_expr_caret() + } + + } + p.SetState(9490) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 900, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_caretContext is an interface to support dynamic dispatch. +type IA_expr_caretContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_unary_sign() IA_expr_unary_signContext + CARET() antlr.TerminalNode + A_expr() IA_exprContext + + // IsA_expr_caretContext differentiates from other interfaces. + IsA_expr_caretContext() +} + +type A_expr_caretContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_caretContext() *A_expr_caretContext { + var p = new(A_expr_caretContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_caret + return p +} + +func InitEmptyA_expr_caretContext(p *A_expr_caretContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_caret +} + +func (*A_expr_caretContext) IsA_expr_caretContext() {} + +func NewA_expr_caretContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_caretContext { + var p = new(A_expr_caretContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_caret + + return p +} + +func (s *A_expr_caretContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_caretContext) A_expr_unary_sign() IA_expr_unary_signContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_unary_signContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_unary_signContext) +} + +func (s *A_expr_caretContext) CARET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCARET, 0) +} + +func (s *A_expr_caretContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *A_expr_caretContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_caretContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_caretContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_caret(s) + } +} + +func (s *A_expr_caretContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_caret(s) + } +} + +func (s *A_expr_caretContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_caret(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_caret() (localctx IA_expr_caretContext) { + localctx = NewA_expr_caretContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1204, PostgreSQLParserRULE_a_expr_caret) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9491) + p.A_expr_unary_sign() + } + p.SetState(9494) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 901, p.GetParserRuleContext()) == 1 { + { + p.SetState(9492) + p.Match(PostgreSQLParserCARET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9493) + p.A_expr() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_unary_signContext is an interface to support dynamic dispatch. +type IA_expr_unary_signContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_at_time_zone() IA_expr_at_time_zoneContext + MINUS() antlr.TerminalNode + PLUS() antlr.TerminalNode + + // IsA_expr_unary_signContext differentiates from other interfaces. + IsA_expr_unary_signContext() +} + +type A_expr_unary_signContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_unary_signContext() *A_expr_unary_signContext { + var p = new(A_expr_unary_signContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_sign + return p +} + +func InitEmptyA_expr_unary_signContext(p *A_expr_unary_signContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_sign +} + +func (*A_expr_unary_signContext) IsA_expr_unary_signContext() {} + +func NewA_expr_unary_signContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_unary_signContext { + var p = new(A_expr_unary_signContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_unary_sign + + return p +} + +func (s *A_expr_unary_signContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_unary_signContext) A_expr_at_time_zone() IA_expr_at_time_zoneContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_at_time_zoneContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_at_time_zoneContext) +} + +func (s *A_expr_unary_signContext) MINUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUS, 0) +} + +func (s *A_expr_unary_signContext) PLUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLUS, 0) +} + +func (s *A_expr_unary_signContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_unary_signContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_unary_signContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_unary_sign(s) + } +} + +func (s *A_expr_unary_signContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_unary_sign(s) + } +} + +func (s *A_expr_unary_signContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_unary_sign(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_unary_sign() (localctx IA_expr_unary_signContext) { + localctx = NewA_expr_unary_signContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1206, PostgreSQLParserRULE_a_expr_unary_sign) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(9497) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPLUS || _la == PostgreSQLParserMINUS { + { + p.SetState(9496) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserPLUS || _la == PostgreSQLParserMINUS) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + } + { + p.SetState(9499) + p.A_expr_at_time_zone() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_at_time_zoneContext is an interface to support dynamic dispatch. +type IA_expr_at_time_zoneContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_collate() IA_expr_collateContext + AT() antlr.TerminalNode + TIME() antlr.TerminalNode + ZONE() antlr.TerminalNode + A_expr() IA_exprContext + + // IsA_expr_at_time_zoneContext differentiates from other interfaces. + IsA_expr_at_time_zoneContext() +} + +type A_expr_at_time_zoneContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_at_time_zoneContext() *A_expr_at_time_zoneContext { + var p = new(A_expr_at_time_zoneContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_at_time_zone + return p +} + +func InitEmptyA_expr_at_time_zoneContext(p *A_expr_at_time_zoneContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_at_time_zone +} + +func (*A_expr_at_time_zoneContext) IsA_expr_at_time_zoneContext() {} + +func NewA_expr_at_time_zoneContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_at_time_zoneContext { + var p = new(A_expr_at_time_zoneContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_at_time_zone + + return p +} + +func (s *A_expr_at_time_zoneContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_at_time_zoneContext) A_expr_collate() IA_expr_collateContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_collateContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_collateContext) +} + +func (s *A_expr_at_time_zoneContext) AT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAT, 0) +} + +func (s *A_expr_at_time_zoneContext) TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIME, 0) +} + +func (s *A_expr_at_time_zoneContext) ZONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserZONE, 0) +} + +func (s *A_expr_at_time_zoneContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *A_expr_at_time_zoneContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_at_time_zoneContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_at_time_zoneContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_at_time_zone(s) + } +} + +func (s *A_expr_at_time_zoneContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_at_time_zone(s) + } +} + +func (s *A_expr_at_time_zoneContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_at_time_zone(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_at_time_zone() (localctx IA_expr_at_time_zoneContext) { + localctx = NewA_expr_at_time_zoneContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1208, PostgreSQLParserRULE_a_expr_at_time_zone) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9501) + p.A_expr_collate() + } + p.SetState(9506) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 903, p.GetParserRuleContext()) == 1 { + { + p.SetState(9502) + p.Match(PostgreSQLParserAT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9503) + p.Match(PostgreSQLParserTIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9504) + p.Match(PostgreSQLParserZONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9505) + p.A_expr() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_collateContext is an interface to support dynamic dispatch. +type IA_expr_collateContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr_typecast() IA_expr_typecastContext + COLLATE() antlr.TerminalNode + Any_name() IAny_nameContext + + // IsA_expr_collateContext differentiates from other interfaces. + IsA_expr_collateContext() +} + +type A_expr_collateContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_collateContext() *A_expr_collateContext { + var p = new(A_expr_collateContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_collate + return p +} + +func InitEmptyA_expr_collateContext(p *A_expr_collateContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_collate +} + +func (*A_expr_collateContext) IsA_expr_collateContext() {} + +func NewA_expr_collateContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_collateContext { + var p = new(A_expr_collateContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_collate + + return p +} + +func (s *A_expr_collateContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_collateContext) A_expr_typecast() IA_expr_typecastContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_expr_typecastContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_expr_typecastContext) +} + +func (s *A_expr_collateContext) COLLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATE, 0) +} + +func (s *A_expr_collateContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *A_expr_collateContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_collateContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_collateContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_collate(s) + } +} + +func (s *A_expr_collateContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_collate(s) + } +} + +func (s *A_expr_collateContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_collate(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_collate() (localctx IA_expr_collateContext) { + localctx = NewA_expr_collateContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1210, PostgreSQLParserRULE_a_expr_collate) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9508) + p.A_expr_typecast() + } + p.SetState(9511) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 904, p.GetParserRuleContext()) == 1 { + { + p.SetState(9509) + p.Match(PostgreSQLParserCOLLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9510) + p.Any_name() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IA_expr_typecastContext is an interface to support dynamic dispatch. +type IA_expr_typecastContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + C_expr() IC_exprContext + AllTYPECAST() []antlr.TerminalNode + TYPECAST(i int) antlr.TerminalNode + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + + // IsA_expr_typecastContext differentiates from other interfaces. + IsA_expr_typecastContext() +} + +type A_expr_typecastContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyA_expr_typecastContext() *A_expr_typecastContext { + var p = new(A_expr_typecastContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_typecast + return p +} + +func InitEmptyA_expr_typecastContext(p *A_expr_typecastContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_a_expr_typecast +} + +func (*A_expr_typecastContext) IsA_expr_typecastContext() {} + +func NewA_expr_typecastContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *A_expr_typecastContext { + var p = new(A_expr_typecastContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_a_expr_typecast + + return p +} + +func (s *A_expr_typecastContext) GetParser() antlr.Parser { return s.parser } + +func (s *A_expr_typecastContext) C_expr() IC_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IC_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IC_exprContext) +} + +func (s *A_expr_typecastContext) AllTYPECAST() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserTYPECAST) +} + +func (s *A_expr_typecastContext) TYPECAST(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPECAST, i) +} + +func (s *A_expr_typecastContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *A_expr_typecastContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *A_expr_typecastContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *A_expr_typecastContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *A_expr_typecastContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterA_expr_typecast(s) + } +} + +func (s *A_expr_typecastContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitA_expr_typecast(s) + } +} + +func (s *A_expr_typecastContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitA_expr_typecast(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) A_expr_typecast() (localctx IA_expr_typecastContext) { + localctx = NewA_expr_typecastContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1212, PostgreSQLParserRULE_a_expr_typecast) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9513) + p.C_expr() + } + p.SetState(9518) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserTYPECAST { + { + p.SetState(9514) + p.Match(PostgreSQLParserTYPECAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9515) + p.Typename() + } + + p.SetState(9520) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IB_exprContext is an interface to support dynamic dispatch. +type IB_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + C_expr() IC_exprContext + AllB_expr() []IB_exprContext + B_expr(i int) IB_exprContext + PLUS() antlr.TerminalNode + MINUS() antlr.TerminalNode + Qual_op() IQual_opContext + CARET() antlr.TerminalNode + STAR() antlr.TerminalNode + SLASH() antlr.TerminalNode + PERCENT() antlr.TerminalNode + LT() antlr.TerminalNode + GT() antlr.TerminalNode + EQUAL() antlr.TerminalNode + LESS_EQUALS() antlr.TerminalNode + GREATER_EQUALS() antlr.TerminalNode + NOT_EQUALS() antlr.TerminalNode + TYPECAST() antlr.TerminalNode + Typename() ITypenameContext + IS() antlr.TerminalNode + DISTINCT() antlr.TerminalNode + FROM() antlr.TerminalNode + OF() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Type_list() IType_listContext + CLOSE_PAREN() antlr.TerminalNode + DOCUMENT_P() antlr.TerminalNode + NOT() antlr.TerminalNode + + // IsB_exprContext differentiates from other interfaces. + IsB_exprContext() +} + +type B_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyB_exprContext() *B_exprContext { + var p = new(B_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_b_expr + return p +} + +func InitEmptyB_exprContext(p *B_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_b_expr +} + +func (*B_exprContext) IsB_exprContext() {} + +func NewB_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *B_exprContext { + var p = new(B_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_b_expr + + return p +} + +func (s *B_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *B_exprContext) C_expr() IC_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IC_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IC_exprContext) +} + +func (s *B_exprContext) AllB_expr() []IB_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IB_exprContext); ok { + len++ + } + } + + tst := make([]IB_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IB_exprContext); ok { + tst[i] = t.(IB_exprContext) + i++ + } + } + + return tst +} + +func (s *B_exprContext) B_expr(i int) IB_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IB_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IB_exprContext) +} + +func (s *B_exprContext) PLUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLUS, 0) +} + +func (s *B_exprContext) MINUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUS, 0) +} + +func (s *B_exprContext) Qual_op() IQual_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQual_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IQual_opContext) +} + +func (s *B_exprContext) CARET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCARET, 0) +} + +func (s *B_exprContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *B_exprContext) SLASH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSLASH, 0) +} + +func (s *B_exprContext) PERCENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPERCENT, 0) +} + +func (s *B_exprContext) LT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLT, 0) +} + +func (s *B_exprContext) GT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGT, 0) +} + +func (s *B_exprContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *B_exprContext) LESS_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLESS_EQUALS, 0) +} + +func (s *B_exprContext) GREATER_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGREATER_EQUALS, 0) +} + +func (s *B_exprContext) NOT_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT_EQUALS, 0) +} + +func (s *B_exprContext) TYPECAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPECAST, 0) +} + +func (s *B_exprContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *B_exprContext) IS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIS, 0) +} + +func (s *B_exprContext) DISTINCT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISTINCT, 0) +} + +func (s *B_exprContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *B_exprContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *B_exprContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *B_exprContext) Type_list() IType_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_listContext) +} + +func (s *B_exprContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *B_exprContext) DOCUMENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOCUMENT_P, 0) +} + +func (s *B_exprContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *B_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *B_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *B_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterB_expr(s) + } +} + +func (s *B_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitB_expr(s) + } +} + +func (s *B_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitB_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) B_expr() (localctx IB_exprContext) { + return p.b_expr(0) +} + +func (p *PostgreSQLParser) b_expr(_p int) (localctx IB_exprContext) { + var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() + + _parentState := p.GetState() + localctx = NewB_exprContext(p, p.GetParserRuleContext(), _parentState) + var _prevctx IB_exprContext = localctx + var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. + _startState := 1214 + p.EnterRecursionRule(localctx, 1214, PostgreSQLParserRULE_b_expr, _p) + var _la int + + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(9528) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 906, p.GetParserRuleContext()) { + case 1: + { + p.SetState(9522) + p.C_expr() + } + + case 2: + { + p.SetState(9523) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserPLUS || _la == PostgreSQLParserMINUS) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9524) + p.b_expr(9) + } + + case 3: + { + p.SetState(9525) + p.Qual_op() + } + { + p.SetState(9526) + p.b_expr(3) + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) + p.SetState(9569) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 910, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + if p.GetParseListeners() != nil { + p.TriggerExitRuleEvent() + } + _prevctx = localctx + p.SetState(9567) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 909, p.GetParserRuleContext()) { + case 1: + localctx = NewB_exprContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, PostgreSQLParserRULE_b_expr) + p.SetState(9530) + + if !(p.Precpred(p.GetParserRuleContext(), 8)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 8)", "")) + goto errorExit + } + { + p.SetState(9531) + p.Match(PostgreSQLParserCARET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9532) + p.b_expr(9) + } + + case 2: + localctx = NewB_exprContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, PostgreSQLParserRULE_b_expr) + p.SetState(9533) + + if !(p.Precpred(p.GetParserRuleContext(), 7)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 7)", "")) + goto errorExit + } + { + p.SetState(9534) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&134234624) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9535) + p.b_expr(8) + } + + case 3: + localctx = NewB_exprContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, PostgreSQLParserRULE_b_expr) + p.SetState(9536) + + if !(p.Precpred(p.GetParserRuleContext(), 6)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", "")) + goto errorExit + } + { + p.SetState(9537) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserPLUS || _la == PostgreSQLParserMINUS) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9538) + p.b_expr(7) + } + + case 4: + localctx = NewB_exprContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, PostgreSQLParserRULE_b_expr) + p.SetState(9539) + + if !(p.Precpred(p.GetParserRuleContext(), 5)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", "")) + goto errorExit + } + { + p.SetState(9540) + p.Qual_op() + } + { + p.SetState(9541) + p.b_expr(6) + } + + case 5: + localctx = NewB_exprContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, PostgreSQLParserRULE_b_expr) + p.SetState(9543) + + if !(p.Precpred(p.GetParserRuleContext(), 4)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 4)", "")) + goto errorExit + } + { + p.SetState(9544) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&44237824) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9545) + p.b_expr(5) + } + + case 6: + localctx = NewB_exprContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, PostgreSQLParserRULE_b_expr) + p.SetState(9546) + + if !(p.Precpred(p.GetParserRuleContext(), 10)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 10)", "")) + goto errorExit + } + { + p.SetState(9547) + p.Match(PostgreSQLParserTYPECAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9548) + p.Typename() + } + + case 7: + localctx = NewB_exprContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, PostgreSQLParserRULE_b_expr) + p.SetState(9549) + + if !(p.Precpred(p.GetParserRuleContext(), 2)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", "")) + goto errorExit + } + { + p.SetState(9550) + p.Qual_op() + } + + case 8: + localctx = NewB_exprContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, PostgreSQLParserRULE_b_expr) + p.SetState(9551) + + if !(p.Precpred(p.GetParserRuleContext(), 1)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 1)", "")) + goto errorExit + } + { + p.SetState(9552) + p.Match(PostgreSQLParserIS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9554) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT { + { + p.SetState(9553) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + p.SetState(9565) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserDISTINCT: + { + p.SetState(9556) + p.Match(PostgreSQLParserDISTINCT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9557) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9558) + p.b_expr(0) + } + + case PostgreSQLParserOF: + { + p.SetState(9559) + p.Match(PostgreSQLParserOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9560) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9561) + p.Type_list() + } + { + p.SetState(9562) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDOCUMENT_P: + { + p.SetState(9564) + p.Match(PostgreSQLParserDOCUMENT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + } + p.SetState(9571) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 910, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.UnrollRecursionContexts(_parentctx) + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IC_exprContext is an interface to support dynamic dispatch. +type IC_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + // IsC_exprContext differentiates from other interfaces. + IsC_exprContext() +} + +type C_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyC_exprContext() *C_exprContext { + var p = new(C_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_c_expr + return p +} + +func InitEmptyC_exprContext(p *C_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_c_expr +} + +func (*C_exprContext) IsC_exprContext() {} + +func NewC_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *C_exprContext { + var p = new(C_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_c_expr + + return p +} + +func (s *C_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *C_exprContext) CopyAll(ctx *C_exprContext) { + s.CopyFrom(&ctx.BaseParserRuleContext) +} + +func (s *C_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *C_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +type C_expr_existsContext struct { + C_exprContext +} + +func NewC_expr_existsContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *C_expr_existsContext { + var p = new(C_expr_existsContext) + + InitEmptyC_exprContext(&p.C_exprContext) + p.parser = parser + p.CopyAll(ctx.(*C_exprContext)) + + return p +} + +func (s *C_expr_existsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *C_expr_existsContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *C_expr_existsContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *C_expr_existsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterC_expr_exists(s) + } +} + +func (s *C_expr_existsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitC_expr_exists(s) + } +} + +func (s *C_expr_existsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitC_expr_exists(s) + + default: + return t.VisitChildren(s) + } +} + +type C_expr_caseContext struct { + C_exprContext +} + +func NewC_expr_caseContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *C_expr_caseContext { + var p = new(C_expr_caseContext) + + InitEmptyC_exprContext(&p.C_exprContext) + p.parser = parser + p.CopyAll(ctx.(*C_exprContext)) + + return p +} + +func (s *C_expr_caseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *C_expr_caseContext) Case_expr() ICase_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICase_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICase_exprContext) +} + +func (s *C_expr_caseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterC_expr_case(s) + } +} + +func (s *C_expr_caseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitC_expr_case(s) + } +} + +func (s *C_expr_caseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitC_expr_case(s) + + default: + return t.VisitChildren(s) + } +} + +type C_expr_exprContext struct { + C_exprContext + a_expr_in_parens IA_exprContext +} + +func NewC_expr_exprContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *C_expr_exprContext { + var p = new(C_expr_exprContext) + + InitEmptyC_exprContext(&p.C_exprContext) + p.parser = parser + p.CopyAll(ctx.(*C_exprContext)) + + return p +} + +func (s *C_expr_exprContext) GetA_expr_in_parens() IA_exprContext { return s.a_expr_in_parens } + +func (s *C_expr_exprContext) SetA_expr_in_parens(v IA_exprContext) { s.a_expr_in_parens = v } + +func (s *C_expr_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *C_expr_exprContext) ARRAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserARRAY, 0) +} + +func (s *C_expr_exprContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *C_expr_exprContext) Array_expr() IArray_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArray_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArray_exprContext) +} + +func (s *C_expr_exprContext) PARAM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARAM, 0) +} + +func (s *C_expr_exprContext) Opt_indirection() IOpt_indirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_indirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_indirectionContext) +} + +func (s *C_expr_exprContext) GROUPING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUPING, 0) +} + +func (s *C_expr_exprContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *C_expr_exprContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *C_expr_exprContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *C_expr_exprContext) UNIQUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNIQUE, 0) +} + +func (s *C_expr_exprContext) Columnref() IColumnrefContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColumnrefContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColumnrefContext) +} + +func (s *C_expr_exprContext) Aexprconst() IAexprconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAexprconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAexprconstContext) +} + +func (s *C_expr_exprContext) Plsqlvariablename() IPlsqlvariablenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsqlvariablenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsqlvariablenameContext) +} + +func (s *C_expr_exprContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *C_expr_exprContext) Func_expr() IFunc_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_exprContext) +} + +func (s *C_expr_exprContext) Indirection() IIndirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndirectionContext) +} + +func (s *C_expr_exprContext) Explicit_row() IExplicit_rowContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExplicit_rowContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExplicit_rowContext) +} + +func (s *C_expr_exprContext) Implicit_row() IImplicit_rowContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IImplicit_rowContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IImplicit_rowContext) +} + +func (s *C_expr_exprContext) AllRow() []IRowContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRowContext); ok { + len++ + } + } + + tst := make([]IRowContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRowContext); ok { + tst[i] = t.(IRowContext) + i++ + } + } + + return tst +} + +func (s *C_expr_exprContext) Row(i int) IRowContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRowContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRowContext) +} + +func (s *C_expr_exprContext) OVERLAPS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOVERLAPS, 0) +} + +func (s *C_expr_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterC_expr_expr(s) + } +} + +func (s *C_expr_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitC_expr_expr(s) + } +} + +func (s *C_expr_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitC_expr_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) C_expr() (localctx IC_exprContext) { + localctx = NewC_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1216, PostgreSQLParserRULE_c_expr) + p.SetState(9608) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 913, p.GetParserRuleContext()) { + case 1: + localctx = NewC_expr_existsContext(p, localctx) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9572) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9573) + p.Select_with_parens() + } + + case 2: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9574) + p.Match(PostgreSQLParserARRAY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9577) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(9575) + p.Select_with_parens() + } + + case PostgreSQLParserOPEN_BRACKET: + { + p.SetState(9576) + p.Array_expr() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 3: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9579) + p.Match(PostgreSQLParserPARAM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9580) + p.Opt_indirection() + } + + case 4: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 4) + { + p.SetState(9581) + p.Match(PostgreSQLParserGROUPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9582) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9583) + p.Expr_list() + } + { + p.SetState(9584) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 5) + { + p.SetState(9586) + p.Match(PostgreSQLParserUNIQUE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9587) + p.Select_with_parens() + } + + case 6: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 6) + { + p.SetState(9588) + p.Columnref() + } + + case 7: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 7) + { + p.SetState(9589) + p.Aexprconst() + } + + case 8: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 8) + { + p.SetState(9590) + p.Plsqlvariablename() + } + + case 9: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 9) + { + p.SetState(9591) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9592) + + var _x = p.A_expr() + + localctx.(*C_expr_exprContext).a_expr_in_parens = _x + } + { + p.SetState(9593) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9594) + p.Opt_indirection() + } + + case 10: + localctx = NewC_expr_caseContext(p, localctx) + p.EnterOuterAlt(localctx, 10) + { + p.SetState(9596) + p.Case_expr() + } + + case 11: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 11) + { + p.SetState(9597) + p.Func_expr() + } + + case 12: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 12) + { + p.SetState(9598) + p.Select_with_parens() + } + p.SetState(9600) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 912, p.GetParserRuleContext()) == 1 { + { + p.SetState(9599) + p.Indirection() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 13: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 13) + { + p.SetState(9602) + p.Explicit_row() + } + + case 14: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 14) + { + p.SetState(9603) + p.Implicit_row() + } + + case 15: + localctx = NewC_expr_exprContext(p, localctx) + p.EnterOuterAlt(localctx, 15) + { + p.SetState(9604) + p.Row() + } + { + p.SetState(9605) + p.Match(PostgreSQLParserOVERLAPS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9606) + p.Row() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPlsqlvariablenameContext is an interface to support dynamic dispatch. +type IPlsqlvariablenameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PLSQLVARIABLENAME() antlr.TerminalNode + + // IsPlsqlvariablenameContext differentiates from other interfaces. + IsPlsqlvariablenameContext() +} + +type PlsqlvariablenameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPlsqlvariablenameContext() *PlsqlvariablenameContext { + var p = new(PlsqlvariablenameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsqlvariablename + return p +} + +func InitEmptyPlsqlvariablenameContext(p *PlsqlvariablenameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsqlvariablename +} + +func (*PlsqlvariablenameContext) IsPlsqlvariablenameContext() {} + +func NewPlsqlvariablenameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PlsqlvariablenameContext { + var p = new(PlsqlvariablenameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_plsqlvariablename + + return p +} + +func (s *PlsqlvariablenameContext) GetParser() antlr.Parser { return s.parser } + +func (s *PlsqlvariablenameContext) PLSQLVARIABLENAME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLSQLVARIABLENAME, 0) +} + +func (s *PlsqlvariablenameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PlsqlvariablenameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PlsqlvariablenameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPlsqlvariablename(s) + } +} + +func (s *PlsqlvariablenameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPlsqlvariablename(s) + } +} + +func (s *PlsqlvariablenameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPlsqlvariablename(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Plsqlvariablename() (localctx IPlsqlvariablenameContext) { + localctx = NewPlsqlvariablenameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1218, PostgreSQLParserRULE_plsqlvariablename) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9610) + p.Match(PostgreSQLParserPLSQLVARIABLENAME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_applicationContext is an interface to support dynamic dispatch. +type IFunc_applicationContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_name() IFunc_nameContext + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + Func_arg_list() IFunc_arg_listContext + VARIADIC() antlr.TerminalNode + Func_arg_expr() IFunc_arg_exprContext + STAR() antlr.TerminalNode + ALL() antlr.TerminalNode + DISTINCT() antlr.TerminalNode + COMMA() antlr.TerminalNode + Opt_sort_clause() IOpt_sort_clauseContext + + // IsFunc_applicationContext differentiates from other interfaces. + IsFunc_applicationContext() +} + +type Func_applicationContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_applicationContext() *Func_applicationContext { + var p = new(Func_applicationContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_application + return p +} + +func InitEmptyFunc_applicationContext(p *Func_applicationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_application +} + +func (*Func_applicationContext) IsFunc_applicationContext() {} + +func NewFunc_applicationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_applicationContext { + var p = new(Func_applicationContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_application + + return p +} + +func (s *Func_applicationContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_applicationContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *Func_applicationContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Func_applicationContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Func_applicationContext) Func_arg_list() IFunc_arg_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_arg_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_arg_listContext) +} + +func (s *Func_applicationContext) VARIADIC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARIADIC, 0) +} + +func (s *Func_applicationContext) Func_arg_expr() IFunc_arg_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_arg_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_arg_exprContext) +} + +func (s *Func_applicationContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *Func_applicationContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Func_applicationContext) DISTINCT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISTINCT, 0) +} + +func (s *Func_applicationContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Func_applicationContext) Opt_sort_clause() IOpt_sort_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_sort_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_sort_clauseContext) +} + +func (s *Func_applicationContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_applicationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_applicationContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_application(s) + } +} + +func (s *Func_applicationContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_application(s) + } +} + +func (s *Func_applicationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_application(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_application() (localctx IFunc_applicationContext) { + localctx = NewFunc_applicationContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1220, PostgreSQLParserRULE_func_application) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9612) + p.Func_name() + } + { + p.SetState(9613) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9635) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN, PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserPARAM, PostgreSQLParserOperator, PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNOT, PostgreSQLParserNULL_P, PostgreSQLParserSESSION_USER, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserRIGHT, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserBinaryStringConstant, PostgreSQLParserHexadecimalStringConstant, PostgreSQLParserIntegral, PostgreSQLParserNumeric, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + { + p.SetState(9614) + p.Func_arg_list() + } + p.SetState(9618) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(9615) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9616) + p.Match(PostgreSQLParserVARIADIC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9617) + p.Func_arg_expr() + } + + } + p.SetState(9621) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserORDER { + { + p.SetState(9620) + p.Opt_sort_clause() + } + + } + + case PostgreSQLParserVARIADIC: + { + p.SetState(9623) + p.Match(PostgreSQLParserVARIADIC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9624) + p.Func_arg_expr() + } + p.SetState(9626) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserORDER { + { + p.SetState(9625) + p.Opt_sort_clause() + } + + } + + case PostgreSQLParserALL, PostgreSQLParserDISTINCT: + { + p.SetState(9628) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserALL || _la == PostgreSQLParserDISTINCT) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(9629) + p.Func_arg_list() + } + p.SetState(9631) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserORDER { + { + p.SetState(9630) + p.Opt_sort_clause() + } + + } + + case PostgreSQLParserSTAR: + { + p.SetState(9633) + p.Match(PostgreSQLParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCLOSE_PAREN: + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(9637) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_exprContext is an interface to support dynamic dispatch. +type IFunc_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_application() IFunc_applicationContext + Within_group_clause() IWithin_group_clauseContext + Filter_clause() IFilter_clauseContext + Over_clause() IOver_clauseContext + Func_expr_common_subexpr() IFunc_expr_common_subexprContext + + // IsFunc_exprContext differentiates from other interfaces. + IsFunc_exprContext() +} + +type Func_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_exprContext() *Func_exprContext { + var p = new(Func_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_expr + return p +} + +func InitEmptyFunc_exprContext(p *Func_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_expr +} + +func (*Func_exprContext) IsFunc_exprContext() {} + +func NewFunc_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_exprContext { + var p = new(Func_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_expr + + return p +} + +func (s *Func_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_exprContext) Func_application() IFunc_applicationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_applicationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_applicationContext) +} + +func (s *Func_exprContext) Within_group_clause() IWithin_group_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWithin_group_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWithin_group_clauseContext) +} + +func (s *Func_exprContext) Filter_clause() IFilter_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFilter_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFilter_clauseContext) +} + +func (s *Func_exprContext) Over_clause() IOver_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOver_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOver_clauseContext) +} + +func (s *Func_exprContext) Func_expr_common_subexpr() IFunc_expr_common_subexprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_expr_common_subexprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_expr_common_subexprContext) +} + +func (s *Func_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_expr(s) + } +} + +func (s *Func_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_expr(s) + } +} + +func (s *Func_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_expr() (localctx IFunc_exprContext) { + localctx = NewFunc_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1222, PostgreSQLParserRULE_func_expr) + p.SetState(9650) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 922, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9639) + p.Func_application() + } + p.SetState(9641) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 919, p.GetParserRuleContext()) == 1 { + { + p.SetState(9640) + p.Within_group_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(9644) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 920, p.GetParserRuleContext()) == 1 { + { + p.SetState(9643) + p.Filter_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(9647) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 921, p.GetParserRuleContext()) == 1 { + { + p.SetState(9646) + p.Over_clause() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9649) + p.Func_expr_common_subexpr() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_expr_windowlessContext is an interface to support dynamic dispatch. +type IFunc_expr_windowlessContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Func_application() IFunc_applicationContext + Func_expr_common_subexpr() IFunc_expr_common_subexprContext + + // IsFunc_expr_windowlessContext differentiates from other interfaces. + IsFunc_expr_windowlessContext() +} + +type Func_expr_windowlessContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_expr_windowlessContext() *Func_expr_windowlessContext { + var p = new(Func_expr_windowlessContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_expr_windowless + return p +} + +func InitEmptyFunc_expr_windowlessContext(p *Func_expr_windowlessContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_expr_windowless +} + +func (*Func_expr_windowlessContext) IsFunc_expr_windowlessContext() {} + +func NewFunc_expr_windowlessContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_expr_windowlessContext { + var p = new(Func_expr_windowlessContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_expr_windowless + + return p +} + +func (s *Func_expr_windowlessContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_expr_windowlessContext) Func_application() IFunc_applicationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_applicationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_applicationContext) +} + +func (s *Func_expr_windowlessContext) Func_expr_common_subexpr() IFunc_expr_common_subexprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_expr_common_subexprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_expr_common_subexprContext) +} + +func (s *Func_expr_windowlessContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_expr_windowlessContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_expr_windowlessContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_expr_windowless(s) + } +} + +func (s *Func_expr_windowlessContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_expr_windowless(s) + } +} + +func (s *Func_expr_windowlessContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_expr_windowless(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_expr_windowless() (localctx IFunc_expr_windowlessContext) { + localctx = NewFunc_expr_windowlessContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1224, PostgreSQLParserRULE_func_expr_windowless) + p.SetState(9654) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 923, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9652) + p.Func_application() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9653) + p.Func_expr_common_subexpr() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_expr_common_subexprContext is an interface to support dynamic dispatch. +type IFunc_expr_common_subexprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COLLATION() antlr.TerminalNode + FOR() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + CURRENT_DATE() antlr.TerminalNode + CURRENT_TIME() antlr.TerminalNode + Iconst() IIconstContext + CURRENT_TIMESTAMP() antlr.TerminalNode + LOCALTIME() antlr.TerminalNode + LOCALTIMESTAMP() antlr.TerminalNode + CURRENT_ROLE() antlr.TerminalNode + CURRENT_USER() antlr.TerminalNode + SESSION_USER() antlr.TerminalNode + USER() antlr.TerminalNode + CURRENT_CATALOG() antlr.TerminalNode + CURRENT_SCHEMA() antlr.TerminalNode + CAST() antlr.TerminalNode + AS() antlr.TerminalNode + Typename() ITypenameContext + EXTRACT() antlr.TerminalNode + Extract_list() IExtract_listContext + NORMALIZE() antlr.TerminalNode + COMMA() antlr.TerminalNode + Unicode_normal_form() IUnicode_normal_formContext + OVERLAY() antlr.TerminalNode + Overlay_list() IOverlay_listContext + POSITION() antlr.TerminalNode + Position_list() IPosition_listContext + SUBSTRING() antlr.TerminalNode + Substr_list() ISubstr_listContext + TREAT() antlr.TerminalNode + TRIM() antlr.TerminalNode + Trim_list() ITrim_listContext + BOTH() antlr.TerminalNode + LEADING() antlr.TerminalNode + TRAILING() antlr.TerminalNode + NULLIF() antlr.TerminalNode + COALESCE() antlr.TerminalNode + Expr_list() IExpr_listContext + GREATEST() antlr.TerminalNode + LEAST() antlr.TerminalNode + XMLCONCAT() antlr.TerminalNode + XMLELEMENT() antlr.TerminalNode + NAME_P() antlr.TerminalNode + Collabel() ICollabelContext + Xml_attributes() IXml_attributesContext + XMLEXISTS() antlr.TerminalNode + C_expr() IC_exprContext + Xmlexists_argument() IXmlexists_argumentContext + XMLFOREST() antlr.TerminalNode + Xml_attribute_list() IXml_attribute_listContext + XMLPARSE() antlr.TerminalNode + Document_or_content() IDocument_or_contentContext + Xml_whitespace_option() IXml_whitespace_optionContext + XMLPI() antlr.TerminalNode + XMLROOT() antlr.TerminalNode + XML_P() antlr.TerminalNode + Xml_root_version() IXml_root_versionContext + Opt_xml_root_standalone() IOpt_xml_root_standaloneContext + XMLSERIALIZE() antlr.TerminalNode + Simpletypename() ISimpletypenameContext + + // IsFunc_expr_common_subexprContext differentiates from other interfaces. + IsFunc_expr_common_subexprContext() +} + +type Func_expr_common_subexprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_expr_common_subexprContext() *Func_expr_common_subexprContext { + var p = new(Func_expr_common_subexprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_expr_common_subexpr + return p +} + +func InitEmptyFunc_expr_common_subexprContext(p *Func_expr_common_subexprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_expr_common_subexpr +} + +func (*Func_expr_common_subexprContext) IsFunc_expr_common_subexprContext() {} + +func NewFunc_expr_common_subexprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_expr_common_subexprContext { + var p = new(Func_expr_common_subexprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_expr_common_subexpr + + return p +} + +func (s *Func_expr_common_subexprContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_expr_common_subexprContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *Func_expr_common_subexprContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Func_expr_common_subexprContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Func_expr_common_subexprContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *Func_expr_common_subexprContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Func_expr_common_subexprContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Func_expr_common_subexprContext) CURRENT_DATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_DATE, 0) +} + +func (s *Func_expr_common_subexprContext) CURRENT_TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_TIME, 0) +} + +func (s *Func_expr_common_subexprContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Func_expr_common_subexprContext) CURRENT_TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_TIMESTAMP, 0) +} + +func (s *Func_expr_common_subexprContext) LOCALTIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCALTIME, 0) +} + +func (s *Func_expr_common_subexprContext) LOCALTIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCALTIMESTAMP, 0) +} + +func (s *Func_expr_common_subexprContext) CURRENT_ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_ROLE, 0) +} + +func (s *Func_expr_common_subexprContext) CURRENT_USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_USER, 0) +} + +func (s *Func_expr_common_subexprContext) SESSION_USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION_USER, 0) +} + +func (s *Func_expr_common_subexprContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *Func_expr_common_subexprContext) CURRENT_CATALOG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_CATALOG, 0) +} + +func (s *Func_expr_common_subexprContext) CURRENT_SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_SCHEMA, 0) +} + +func (s *Func_expr_common_subexprContext) CAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCAST, 0) +} + +func (s *Func_expr_common_subexprContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Func_expr_common_subexprContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Func_expr_common_subexprContext) EXTRACT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTRACT, 0) +} + +func (s *Func_expr_common_subexprContext) Extract_list() IExtract_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExtract_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExtract_listContext) +} + +func (s *Func_expr_common_subexprContext) NORMALIZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNORMALIZE, 0) +} + +func (s *Func_expr_common_subexprContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Func_expr_common_subexprContext) Unicode_normal_form() IUnicode_normal_formContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnicode_normal_formContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnicode_normal_formContext) +} + +func (s *Func_expr_common_subexprContext) OVERLAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOVERLAY, 0) +} + +func (s *Func_expr_common_subexprContext) Overlay_list() IOverlay_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOverlay_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOverlay_listContext) +} + +func (s *Func_expr_common_subexprContext) POSITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPOSITION, 0) +} + +func (s *Func_expr_common_subexprContext) Position_list() IPosition_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPosition_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPosition_listContext) +} + +func (s *Func_expr_common_subexprContext) SUBSTRING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSTRING, 0) +} + +func (s *Func_expr_common_subexprContext) Substr_list() ISubstr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISubstr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISubstr_listContext) +} + +func (s *Func_expr_common_subexprContext) TREAT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTREAT, 0) +} + +func (s *Func_expr_common_subexprContext) TRIM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIM, 0) +} + +func (s *Func_expr_common_subexprContext) Trim_list() ITrim_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITrim_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITrim_listContext) +} + +func (s *Func_expr_common_subexprContext) BOTH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBOTH, 0) +} + +func (s *Func_expr_common_subexprContext) LEADING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEADING, 0) +} + +func (s *Func_expr_common_subexprContext) TRAILING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRAILING, 0) +} + +func (s *Func_expr_common_subexprContext) NULLIF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULLIF, 0) +} + +func (s *Func_expr_common_subexprContext) COALESCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOALESCE, 0) +} + +func (s *Func_expr_common_subexprContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Func_expr_common_subexprContext) GREATEST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGREATEST, 0) +} + +func (s *Func_expr_common_subexprContext) LEAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEAST, 0) +} + +func (s *Func_expr_common_subexprContext) XMLCONCAT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLCONCAT, 0) +} + +func (s *Func_expr_common_subexprContext) XMLELEMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLELEMENT, 0) +} + +func (s *Func_expr_common_subexprContext) NAME_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNAME_P, 0) +} + +func (s *Func_expr_common_subexprContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Func_expr_common_subexprContext) Xml_attributes() IXml_attributesContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_attributesContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXml_attributesContext) +} + +func (s *Func_expr_common_subexprContext) XMLEXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLEXISTS, 0) +} + +func (s *Func_expr_common_subexprContext) C_expr() IC_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IC_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IC_exprContext) +} + +func (s *Func_expr_common_subexprContext) Xmlexists_argument() IXmlexists_argumentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXmlexists_argumentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXmlexists_argumentContext) +} + +func (s *Func_expr_common_subexprContext) XMLFOREST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLFOREST, 0) +} + +func (s *Func_expr_common_subexprContext) Xml_attribute_list() IXml_attribute_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_attribute_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXml_attribute_listContext) +} + +func (s *Func_expr_common_subexprContext) XMLPARSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLPARSE, 0) +} + +func (s *Func_expr_common_subexprContext) Document_or_content() IDocument_or_contentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDocument_or_contentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDocument_or_contentContext) +} + +func (s *Func_expr_common_subexprContext) Xml_whitespace_option() IXml_whitespace_optionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_whitespace_optionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXml_whitespace_optionContext) +} + +func (s *Func_expr_common_subexprContext) XMLPI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLPI, 0) +} + +func (s *Func_expr_common_subexprContext) XMLROOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLROOT, 0) +} + +func (s *Func_expr_common_subexprContext) XML_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXML_P, 0) +} + +func (s *Func_expr_common_subexprContext) Xml_root_version() IXml_root_versionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_root_versionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXml_root_versionContext) +} + +func (s *Func_expr_common_subexprContext) Opt_xml_root_standalone() IOpt_xml_root_standaloneContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_xml_root_standaloneContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_xml_root_standaloneContext) +} + +func (s *Func_expr_common_subexprContext) XMLSERIALIZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLSERIALIZE, 0) +} + +func (s *Func_expr_common_subexprContext) Simpletypename() ISimpletypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISimpletypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISimpletypenameContext) +} + +func (s *Func_expr_common_subexprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_expr_common_subexprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_expr_common_subexprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_expr_common_subexpr(s) + } +} + +func (s *Func_expr_common_subexprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_expr_common_subexpr(s) + } +} + +func (s *Func_expr_common_subexprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_expr_common_subexpr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_expr_common_subexpr() (localctx IFunc_expr_common_subexprContext) { + localctx = NewFunc_expr_common_subexprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1226, PostgreSQLParserRULE_func_expr_common_subexpr) + var _la int + + p.SetState(9839) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserCOLLATION: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9656) + p.Match(PostgreSQLParserCOLLATION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9657) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9658) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9659) + p.A_expr() + } + { + p.SetState(9660) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCURRENT_DATE: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9662) + p.Match(PostgreSQLParserCURRENT_DATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCURRENT_TIME: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9663) + p.Match(PostgreSQLParserCURRENT_TIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9668) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 924, p.GetParserRuleContext()) == 1 { + { + p.SetState(9664) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9665) + p.Iconst() + } + { + p.SetState(9666) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserCURRENT_TIMESTAMP: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(9670) + p.Match(PostgreSQLParserCURRENT_TIMESTAMP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9675) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 925, p.GetParserRuleContext()) == 1 { + { + p.SetState(9671) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9672) + p.Iconst() + } + { + p.SetState(9673) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserLOCALTIME: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(9677) + p.Match(PostgreSQLParserLOCALTIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9682) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 926, p.GetParserRuleContext()) == 1 { + { + p.SetState(9678) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9679) + p.Iconst() + } + { + p.SetState(9680) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserLOCALTIMESTAMP: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(9684) + p.Match(PostgreSQLParserLOCALTIMESTAMP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9689) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 927, p.GetParserRuleContext()) == 1 { + { + p.SetState(9685) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9686) + p.Iconst() + } + { + p.SetState(9687) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserCURRENT_ROLE: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(9691) + p.Match(PostgreSQLParserCURRENT_ROLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCURRENT_USER: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(9692) + p.Match(PostgreSQLParserCURRENT_USER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSESSION_USER: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(9693) + p.Match(PostgreSQLParserSESSION_USER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserUSER: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(9694) + p.Match(PostgreSQLParserUSER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCURRENT_CATALOG: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(9695) + p.Match(PostgreSQLParserCURRENT_CATALOG) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCURRENT_SCHEMA: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(9696) + p.Match(PostgreSQLParserCURRENT_SCHEMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCAST: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(9697) + p.Match(PostgreSQLParserCAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9698) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9699) + p.A_expr() + } + { + p.SetState(9700) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9701) + p.Typename() + } + { + p.SetState(9702) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserEXTRACT: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(9704) + p.Match(PostgreSQLParserEXTRACT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9705) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9707) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2459027012145119232) != 0) || ((int64((_la-92)) & ^0x3f) == 0 && ((int64(1)<<(_la-92))&2310346885883232257) != 0) || ((int64((_la-157)) & ^0x3f) == 0 && ((int64(1)<<(_la-157))&2315976108375835665) != 0) || ((int64((_la-232)) & ^0x3f) == 0 && ((int64(1)<<(_la-232))&18015499736580353) != 0) || ((int64((_la-300)) & ^0x3f) == 0 && ((int64(1)<<(_la-300))&9007199322574913) != 0) || ((int64((_la-377)) & ^0x3f) == 0 && ((int64(1)<<(_la-377))&864691128455135233) != 0) || ((int64((_la-479)) & ^0x3f) == 0 && ((int64(1)<<(_la-479))&13124950286337) != 0) || ((int64((_la-643)) & ^0x3f) == 0 && ((int64(1)<<(_la-643))&34460412451) != 0) { + { + p.SetState(9706) + p.Extract_list() + } + + } + { + p.SetState(9709) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNORMALIZE: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(9710) + p.Match(PostgreSQLParserNORMALIZE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9711) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9712) + p.A_expr() + } + p.SetState(9715) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(9713) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9714) + p.Unicode_normal_form() + } + + } + { + p.SetState(9717) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserOVERLAY: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(9719) + p.Match(PostgreSQLParserOVERLAY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9720) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9721) + p.Overlay_list() + } + { + p.SetState(9722) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserPOSITION: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(9724) + p.Match(PostgreSQLParserPOSITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9725) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9727) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858553860) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073205) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(9726) + p.Position_list() + } + + } + { + p.SetState(9729) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSUBSTRING: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(9730) + p.Match(PostgreSQLParserSUBSTRING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9731) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9732) + p.Substr_list() + } + { + p.SetState(9733) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserTREAT: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(9735) + p.Match(PostgreSQLParserTREAT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9736) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9737) + p.A_expr() + } + { + p.SetState(9738) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9739) + p.Typename() + } + { + p.SetState(9740) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserTRIM: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(9742) + p.Match(PostgreSQLParserTRIM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9743) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9745) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-39)) & ^0x3f) == 0 && ((int64(1)<<(_la-39))&72057611217797121) != 0 { + { + p.SetState(9744) + _la = p.GetTokenStream().LA(1) + + if !((int64((_la-39)) & ^0x3f) == 0 && ((int64(1)<<(_la-39))&72057611217797121) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + } + { + p.SetState(9747) + p.Trim_list() + } + { + p.SetState(9748) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNULLIF: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(9750) + p.Match(PostgreSQLParserNULLIF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9751) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9752) + p.A_expr() + } + { + p.SetState(9753) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9754) + p.A_expr() + } + { + p.SetState(9755) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserCOALESCE: + p.EnterOuterAlt(localctx, 22) + { + p.SetState(9757) + p.Match(PostgreSQLParserCOALESCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9758) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9759) + p.Expr_list() + } + { + p.SetState(9760) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserGREATEST: + p.EnterOuterAlt(localctx, 23) + { + p.SetState(9762) + p.Match(PostgreSQLParserGREATEST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9763) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9764) + p.Expr_list() + } + { + p.SetState(9765) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserLEAST: + p.EnterOuterAlt(localctx, 24) + { + p.SetState(9767) + p.Match(PostgreSQLParserLEAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9768) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9769) + p.Expr_list() + } + { + p.SetState(9770) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserXMLCONCAT: + p.EnterOuterAlt(localctx, 25) + { + p.SetState(9772) + p.Match(PostgreSQLParserXMLCONCAT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9773) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9774) + p.Expr_list() + } + { + p.SetState(9775) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserXMLELEMENT: + p.EnterOuterAlt(localctx, 26) + { + p.SetState(9777) + p.Match(PostgreSQLParserXMLELEMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9778) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9779) + p.Match(PostgreSQLParserNAME_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9780) + p.Collabel() + } + p.SetState(9786) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(9781) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9784) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 932, p.GetParserRuleContext()) { + case 1: + { + p.SetState(9782) + p.Xml_attributes() + } + + case 2: + { + p.SetState(9783) + p.Expr_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + } + { + p.SetState(9788) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserXMLEXISTS: + p.EnterOuterAlt(localctx, 27) + { + p.SetState(9790) + p.Match(PostgreSQLParserXMLEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9791) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9792) + p.C_expr() + } + { + p.SetState(9793) + p.Xmlexists_argument() + } + { + p.SetState(9794) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserXMLFOREST: + p.EnterOuterAlt(localctx, 28) + { + p.SetState(9796) + p.Match(PostgreSQLParserXMLFOREST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9797) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9798) + p.Xml_attribute_list() + } + { + p.SetState(9799) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserXMLPARSE: + p.EnterOuterAlt(localctx, 29) + { + p.SetState(9801) + p.Match(PostgreSQLParserXMLPARSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9802) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9803) + p.Document_or_content() + } + { + p.SetState(9804) + p.A_expr() + } + p.SetState(9806) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPRESERVE || _la == PostgreSQLParserSTRIP_P { + { + p.SetState(9805) + p.Xml_whitespace_option() + } + + } + { + p.SetState(9808) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserXMLPI: + p.EnterOuterAlt(localctx, 30) + { + p.SetState(9810) + p.Match(PostgreSQLParserXMLPI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9811) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9812) + p.Match(PostgreSQLParserNAME_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9813) + p.Collabel() + } + p.SetState(9816) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(9814) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9815) + p.A_expr() + } + + } + { + p.SetState(9818) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserXMLROOT: + p.EnterOuterAlt(localctx, 31) + { + p.SetState(9820) + p.Match(PostgreSQLParserXMLROOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9821) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9822) + p.Match(PostgreSQLParserXML_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9823) + p.A_expr() + } + { + p.SetState(9824) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9825) + p.Xml_root_version() + } + p.SetState(9827) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(9826) + p.Opt_xml_root_standalone() + } + + } + { + p.SetState(9829) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserXMLSERIALIZE: + p.EnterOuterAlt(localctx, 32) + { + p.SetState(9831) + p.Match(PostgreSQLParserXMLSERIALIZE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9832) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9833) + p.Document_or_content() + } + { + p.SetState(9834) + p.A_expr() + } + { + p.SetState(9835) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9836) + p.Simpletypename() + } + { + p.SetState(9837) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXml_root_versionContext is an interface to support dynamic dispatch. +type IXml_root_versionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + VERSION_P() antlr.TerminalNode + A_expr() IA_exprContext + NO() antlr.TerminalNode + VALUE_P() antlr.TerminalNode + + // IsXml_root_versionContext differentiates from other interfaces. + IsXml_root_versionContext() +} + +type Xml_root_versionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXml_root_versionContext() *Xml_root_versionContext { + var p = new(Xml_root_versionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_root_version + return p +} + +func InitEmptyXml_root_versionContext(p *Xml_root_versionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_root_version +} + +func (*Xml_root_versionContext) IsXml_root_versionContext() {} + +func NewXml_root_versionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xml_root_versionContext { + var p = new(Xml_root_versionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xml_root_version + + return p +} + +func (s *Xml_root_versionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xml_root_versionContext) VERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERSION_P, 0) +} + +func (s *Xml_root_versionContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Xml_root_versionContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Xml_root_versionContext) VALUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUE_P, 0) +} + +func (s *Xml_root_versionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xml_root_versionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xml_root_versionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXml_root_version(s) + } +} + +func (s *Xml_root_versionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXml_root_version(s) + } +} + +func (s *Xml_root_versionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXml_root_version(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xml_root_version() (localctx IXml_root_versionContext) { + localctx = NewXml_root_versionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1228, PostgreSQLParserRULE_xml_root_version) + p.SetState(9846) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 938, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9841) + p.Match(PostgreSQLParserVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9842) + p.A_expr() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9843) + p.Match(PostgreSQLParserVERSION_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9844) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9845) + p.Match(PostgreSQLParserVALUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_xml_root_standaloneContext is an interface to support dynamic dispatch. +type IOpt_xml_root_standaloneContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COMMA() antlr.TerminalNode + STANDALONE_P() antlr.TerminalNode + YES_P() antlr.TerminalNode + NO() antlr.TerminalNode + VALUE_P() antlr.TerminalNode + + // IsOpt_xml_root_standaloneContext differentiates from other interfaces. + IsOpt_xml_root_standaloneContext() +} + +type Opt_xml_root_standaloneContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_xml_root_standaloneContext() *Opt_xml_root_standaloneContext { + var p = new(Opt_xml_root_standaloneContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_xml_root_standalone + return p +} + +func InitEmptyOpt_xml_root_standaloneContext(p *Opt_xml_root_standaloneContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_xml_root_standalone +} + +func (*Opt_xml_root_standaloneContext) IsOpt_xml_root_standaloneContext() {} + +func NewOpt_xml_root_standaloneContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_xml_root_standaloneContext { + var p = new(Opt_xml_root_standaloneContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_xml_root_standalone + + return p +} + +func (s *Opt_xml_root_standaloneContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_xml_root_standaloneContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Opt_xml_root_standaloneContext) STANDALONE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTANDALONE_P, 0) +} + +func (s *Opt_xml_root_standaloneContext) YES_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserYES_P, 0) +} + +func (s *Opt_xml_root_standaloneContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Opt_xml_root_standaloneContext) VALUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUE_P, 0) +} + +func (s *Opt_xml_root_standaloneContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_xml_root_standaloneContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_xml_root_standaloneContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_xml_root_standalone(s) + } +} + +func (s *Opt_xml_root_standaloneContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_xml_root_standalone(s) + } +} + +func (s *Opt_xml_root_standaloneContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_xml_root_standalone(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_xml_root_standalone() (localctx IOpt_xml_root_standaloneContext) { + localctx = NewOpt_xml_root_standaloneContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1230, PostgreSQLParserRULE_opt_xml_root_standalone) + p.SetState(9858) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 939, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9848) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9849) + p.Match(PostgreSQLParserSTANDALONE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9850) + p.Match(PostgreSQLParserYES_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9851) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9852) + p.Match(PostgreSQLParserSTANDALONE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9853) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9854) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9855) + p.Match(PostgreSQLParserSTANDALONE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9856) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9857) + p.Match(PostgreSQLParserVALUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXml_attributesContext is an interface to support dynamic dispatch. +type IXml_attributesContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + XMLATTRIBUTES() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Xml_attribute_list() IXml_attribute_listContext + CLOSE_PAREN() antlr.TerminalNode + + // IsXml_attributesContext differentiates from other interfaces. + IsXml_attributesContext() +} + +type Xml_attributesContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXml_attributesContext() *Xml_attributesContext { + var p = new(Xml_attributesContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_attributes + return p +} + +func InitEmptyXml_attributesContext(p *Xml_attributesContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_attributes +} + +func (*Xml_attributesContext) IsXml_attributesContext() {} + +func NewXml_attributesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xml_attributesContext { + var p = new(Xml_attributesContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xml_attributes + + return p +} + +func (s *Xml_attributesContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xml_attributesContext) XMLATTRIBUTES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLATTRIBUTES, 0) +} + +func (s *Xml_attributesContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Xml_attributesContext) Xml_attribute_list() IXml_attribute_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_attribute_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXml_attribute_listContext) +} + +func (s *Xml_attributesContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Xml_attributesContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xml_attributesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xml_attributesContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXml_attributes(s) + } +} + +func (s *Xml_attributesContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXml_attributes(s) + } +} + +func (s *Xml_attributesContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXml_attributes(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xml_attributes() (localctx IXml_attributesContext) { + localctx = NewXml_attributesContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1232, PostgreSQLParserRULE_xml_attributes) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9860) + p.Match(PostgreSQLParserXMLATTRIBUTES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9861) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9862) + p.Xml_attribute_list() + } + { + p.SetState(9863) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXml_attribute_listContext is an interface to support dynamic dispatch. +type IXml_attribute_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllXml_attribute_el() []IXml_attribute_elContext + Xml_attribute_el(i int) IXml_attribute_elContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsXml_attribute_listContext differentiates from other interfaces. + IsXml_attribute_listContext() +} + +type Xml_attribute_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXml_attribute_listContext() *Xml_attribute_listContext { + var p = new(Xml_attribute_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_attribute_list + return p +} + +func InitEmptyXml_attribute_listContext(p *Xml_attribute_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_attribute_list +} + +func (*Xml_attribute_listContext) IsXml_attribute_listContext() {} + +func NewXml_attribute_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xml_attribute_listContext { + var p = new(Xml_attribute_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xml_attribute_list + + return p +} + +func (s *Xml_attribute_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xml_attribute_listContext) AllXml_attribute_el() []IXml_attribute_elContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IXml_attribute_elContext); ok { + len++ + } + } + + tst := make([]IXml_attribute_elContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IXml_attribute_elContext); ok { + tst[i] = t.(IXml_attribute_elContext) + i++ + } + } + + return tst +} + +func (s *Xml_attribute_listContext) Xml_attribute_el(i int) IXml_attribute_elContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_attribute_elContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IXml_attribute_elContext) +} + +func (s *Xml_attribute_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Xml_attribute_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Xml_attribute_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xml_attribute_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xml_attribute_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXml_attribute_list(s) + } +} + +func (s *Xml_attribute_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXml_attribute_list(s) + } +} + +func (s *Xml_attribute_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXml_attribute_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xml_attribute_list() (localctx IXml_attribute_listContext) { + localctx = NewXml_attribute_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1234, PostgreSQLParserRULE_xml_attribute_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9865) + p.Xml_attribute_el() + } + p.SetState(9870) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(9866) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9867) + p.Xml_attribute_el() + } + + p.SetState(9872) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXml_attribute_elContext is an interface to support dynamic dispatch. +type IXml_attribute_elContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + AS() antlr.TerminalNode + Collabel() ICollabelContext + + // IsXml_attribute_elContext differentiates from other interfaces. + IsXml_attribute_elContext() +} + +type Xml_attribute_elContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXml_attribute_elContext() *Xml_attribute_elContext { + var p = new(Xml_attribute_elContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_attribute_el + return p +} + +func InitEmptyXml_attribute_elContext(p *Xml_attribute_elContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_attribute_el +} + +func (*Xml_attribute_elContext) IsXml_attribute_elContext() {} + +func NewXml_attribute_elContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xml_attribute_elContext { + var p = new(Xml_attribute_elContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xml_attribute_el + + return p +} + +func (s *Xml_attribute_elContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xml_attribute_elContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Xml_attribute_elContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Xml_attribute_elContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Xml_attribute_elContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xml_attribute_elContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xml_attribute_elContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXml_attribute_el(s) + } +} + +func (s *Xml_attribute_elContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXml_attribute_el(s) + } +} + +func (s *Xml_attribute_elContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXml_attribute_el(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xml_attribute_el() (localctx IXml_attribute_elContext) { + localctx = NewXml_attribute_elContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1236, PostgreSQLParserRULE_xml_attribute_el) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9873) + p.A_expr() + } + p.SetState(9876) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAS { + { + p.SetState(9874) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9875) + p.Collabel() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDocument_or_contentContext is an interface to support dynamic dispatch. +type IDocument_or_contentContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DOCUMENT_P() antlr.TerminalNode + CONTENT_P() antlr.TerminalNode + + // IsDocument_or_contentContext differentiates from other interfaces. + IsDocument_or_contentContext() +} + +type Document_or_contentContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDocument_or_contentContext() *Document_or_contentContext { + var p = new(Document_or_contentContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_document_or_content + return p +} + +func InitEmptyDocument_or_contentContext(p *Document_or_contentContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_document_or_content +} + +func (*Document_or_contentContext) IsDocument_or_contentContext() {} + +func NewDocument_or_contentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Document_or_contentContext { + var p = new(Document_or_contentContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_document_or_content + + return p +} + +func (s *Document_or_contentContext) GetParser() antlr.Parser { return s.parser } + +func (s *Document_or_contentContext) DOCUMENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOCUMENT_P, 0) +} + +func (s *Document_or_contentContext) CONTENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONTENT_P, 0) +} + +func (s *Document_or_contentContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Document_or_contentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Document_or_contentContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDocument_or_content(s) + } +} + +func (s *Document_or_contentContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDocument_or_content(s) + } +} + +func (s *Document_or_contentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDocument_or_content(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Document_or_content() (localctx IDocument_or_contentContext) { + localctx = NewDocument_or_contentContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1238, PostgreSQLParserRULE_document_or_content) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9878) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCONTENT_P || _la == PostgreSQLParserDOCUMENT_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXml_whitespace_optionContext is an interface to support dynamic dispatch. +type IXml_whitespace_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PRESERVE() antlr.TerminalNode + WHITESPACE_P() antlr.TerminalNode + STRIP_P() antlr.TerminalNode + + // IsXml_whitespace_optionContext differentiates from other interfaces. + IsXml_whitespace_optionContext() +} + +type Xml_whitespace_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXml_whitespace_optionContext() *Xml_whitespace_optionContext { + var p = new(Xml_whitespace_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_whitespace_option + return p +} + +func InitEmptyXml_whitespace_optionContext(p *Xml_whitespace_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_whitespace_option +} + +func (*Xml_whitespace_optionContext) IsXml_whitespace_optionContext() {} + +func NewXml_whitespace_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xml_whitespace_optionContext { + var p = new(Xml_whitespace_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xml_whitespace_option + + return p +} + +func (s *Xml_whitespace_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xml_whitespace_optionContext) PRESERVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRESERVE, 0) +} + +func (s *Xml_whitespace_optionContext) WHITESPACE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHITESPACE_P, 0) +} + +func (s *Xml_whitespace_optionContext) STRIP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRIP_P, 0) +} + +func (s *Xml_whitespace_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xml_whitespace_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xml_whitespace_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXml_whitespace_option(s) + } +} + +func (s *Xml_whitespace_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXml_whitespace_option(s) + } +} + +func (s *Xml_whitespace_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXml_whitespace_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xml_whitespace_option() (localctx IXml_whitespace_optionContext) { + localctx = NewXml_whitespace_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1240, PostgreSQLParserRULE_xml_whitespace_option) + p.SetState(9884) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserPRESERVE: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9880) + p.Match(PostgreSQLParserPRESERVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9881) + p.Match(PostgreSQLParserWHITESPACE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSTRIP_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9882) + p.Match(PostgreSQLParserSTRIP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9883) + p.Match(PostgreSQLParserWHITESPACE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXmlexists_argumentContext is an interface to support dynamic dispatch. +type IXmlexists_argumentContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PASSING() antlr.TerminalNode + C_expr() IC_exprContext + AllXml_passing_mech() []IXml_passing_mechContext + Xml_passing_mech(i int) IXml_passing_mechContext + + // IsXmlexists_argumentContext differentiates from other interfaces. + IsXmlexists_argumentContext() +} + +type Xmlexists_argumentContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXmlexists_argumentContext() *Xmlexists_argumentContext { + var p = new(Xmlexists_argumentContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmlexists_argument + return p +} + +func InitEmptyXmlexists_argumentContext(p *Xmlexists_argumentContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xmlexists_argument +} + +func (*Xmlexists_argumentContext) IsXmlexists_argumentContext() {} + +func NewXmlexists_argumentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xmlexists_argumentContext { + var p = new(Xmlexists_argumentContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xmlexists_argument + + return p +} + +func (s *Xmlexists_argumentContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xmlexists_argumentContext) PASSING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPASSING, 0) +} + +func (s *Xmlexists_argumentContext) C_expr() IC_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IC_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IC_exprContext) +} + +func (s *Xmlexists_argumentContext) AllXml_passing_mech() []IXml_passing_mechContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IXml_passing_mechContext); ok { + len++ + } + } + + tst := make([]IXml_passing_mechContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IXml_passing_mechContext); ok { + tst[i] = t.(IXml_passing_mechContext) + i++ + } + } + + return tst +} + +func (s *Xmlexists_argumentContext) Xml_passing_mech(i int) IXml_passing_mechContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXml_passing_mechContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IXml_passing_mechContext) +} + +func (s *Xmlexists_argumentContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xmlexists_argumentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xmlexists_argumentContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXmlexists_argument(s) + } +} + +func (s *Xmlexists_argumentContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXmlexists_argument(s) + } +} + +func (s *Xmlexists_argumentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXmlexists_argument(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xmlexists_argument() (localctx IXmlexists_argumentContext) { + localctx = NewXmlexists_argumentContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1242, PostgreSQLParserRULE_xmlexists_argument) + p.SetState(9901) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 943, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9886) + p.Match(PostgreSQLParserPASSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9887) + p.C_expr() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9888) + p.Match(PostgreSQLParserPASSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9889) + p.C_expr() + } + { + p.SetState(9890) + p.Xml_passing_mech() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9892) + p.Match(PostgreSQLParserPASSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9893) + p.Xml_passing_mech() + } + { + p.SetState(9894) + p.C_expr() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(9896) + p.Match(PostgreSQLParserPASSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9897) + p.Xml_passing_mech() + } + { + p.SetState(9898) + p.C_expr() + } + { + p.SetState(9899) + p.Xml_passing_mech() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXml_passing_mechContext is an interface to support dynamic dispatch. +type IXml_passing_mechContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BY() antlr.TerminalNode + REF() antlr.TerminalNode + VALUE_P() antlr.TerminalNode + + // IsXml_passing_mechContext differentiates from other interfaces. + IsXml_passing_mechContext() +} + +type Xml_passing_mechContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXml_passing_mechContext() *Xml_passing_mechContext { + var p = new(Xml_passing_mechContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_passing_mech + return p +} + +func InitEmptyXml_passing_mechContext(p *Xml_passing_mechContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xml_passing_mech +} + +func (*Xml_passing_mechContext) IsXml_passing_mechContext() {} + +func NewXml_passing_mechContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Xml_passing_mechContext { + var p = new(Xml_passing_mechContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xml_passing_mech + + return p +} + +func (s *Xml_passing_mechContext) GetParser() antlr.Parser { return s.parser } + +func (s *Xml_passing_mechContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Xml_passing_mechContext) REF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREF, 0) +} + +func (s *Xml_passing_mechContext) VALUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUE_P, 0) +} + +func (s *Xml_passing_mechContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Xml_passing_mechContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Xml_passing_mechContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXml_passing_mech(s) + } +} + +func (s *Xml_passing_mechContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXml_passing_mech(s) + } +} + +func (s *Xml_passing_mechContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXml_passing_mech(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xml_passing_mech() (localctx IXml_passing_mechContext) { + localctx = NewXml_passing_mechContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1244, PostgreSQLParserRULE_xml_passing_mech) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9903) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9904) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserREF || _la == PostgreSQLParserVALUE_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWithin_group_clauseContext is an interface to support dynamic dispatch. +type IWithin_group_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WITHIN() antlr.TerminalNode + GROUP_P() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Sort_clause() ISort_clauseContext + CLOSE_PAREN() antlr.TerminalNode + + // IsWithin_group_clauseContext differentiates from other interfaces. + IsWithin_group_clauseContext() +} + +type Within_group_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWithin_group_clauseContext() *Within_group_clauseContext { + var p = new(Within_group_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_within_group_clause + return p +} + +func InitEmptyWithin_group_clauseContext(p *Within_group_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_within_group_clause +} + +func (*Within_group_clauseContext) IsWithin_group_clauseContext() {} + +func NewWithin_group_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Within_group_clauseContext { + var p = new(Within_group_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_within_group_clause + + return p +} + +func (s *Within_group_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Within_group_clauseContext) WITHIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITHIN, 0) +} + +func (s *Within_group_clauseContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *Within_group_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Within_group_clauseContext) Sort_clause() ISort_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISort_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISort_clauseContext) +} + +func (s *Within_group_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Within_group_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Within_group_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Within_group_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWithin_group_clause(s) + } +} + +func (s *Within_group_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWithin_group_clause(s) + } +} + +func (s *Within_group_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWithin_group_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Within_group_clause() (localctx IWithin_group_clauseContext) { + localctx = NewWithin_group_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1246, PostgreSQLParserRULE_within_group_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9906) + p.Match(PostgreSQLParserWITHIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9907) + p.Match(PostgreSQLParserGROUP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9908) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9909) + p.Sort_clause() + } + { + p.SetState(9910) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFilter_clauseContext is an interface to support dynamic dispatch. +type IFilter_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FILTER() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + WHERE() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsFilter_clauseContext differentiates from other interfaces. + IsFilter_clauseContext() +} + +type Filter_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFilter_clauseContext() *Filter_clauseContext { + var p = new(Filter_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_filter_clause + return p +} + +func InitEmptyFilter_clauseContext(p *Filter_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_filter_clause +} + +func (*Filter_clauseContext) IsFilter_clauseContext() {} + +func NewFilter_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Filter_clauseContext { + var p = new(Filter_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_filter_clause + + return p +} + +func (s *Filter_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Filter_clauseContext) FILTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFILTER, 0) +} + +func (s *Filter_clauseContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Filter_clauseContext) WHERE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHERE, 0) +} + +func (s *Filter_clauseContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Filter_clauseContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Filter_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Filter_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Filter_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFilter_clause(s) + } +} + +func (s *Filter_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFilter_clause(s) + } +} + +func (s *Filter_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFilter_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Filter_clause() (localctx IFilter_clauseContext) { + localctx = NewFilter_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1248, PostgreSQLParserRULE_filter_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9912) + p.Match(PostgreSQLParserFILTER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9913) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9914) + p.Match(PostgreSQLParserWHERE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9915) + p.A_expr() + } + { + p.SetState(9916) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWindow_clauseContext is an interface to support dynamic dispatch. +type IWindow_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WINDOW() antlr.TerminalNode + Window_definition_list() IWindow_definition_listContext + + // IsWindow_clauseContext differentiates from other interfaces. + IsWindow_clauseContext() +} + +type Window_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWindow_clauseContext() *Window_clauseContext { + var p = new(Window_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_window_clause + return p +} + +func InitEmptyWindow_clauseContext(p *Window_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_window_clause +} + +func (*Window_clauseContext) IsWindow_clauseContext() {} + +func NewWindow_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_clauseContext { + var p = new(Window_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_window_clause + + return p +} + +func (s *Window_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Window_clauseContext) WINDOW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWINDOW, 0) +} + +func (s *Window_clauseContext) Window_definition_list() IWindow_definition_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWindow_definition_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWindow_definition_listContext) +} + +func (s *Window_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Window_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Window_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWindow_clause(s) + } +} + +func (s *Window_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWindow_clause(s) + } +} + +func (s *Window_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWindow_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Window_clause() (localctx IWindow_clauseContext) { + localctx = NewWindow_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1250, PostgreSQLParserRULE_window_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9918) + p.Match(PostgreSQLParserWINDOW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9919) + p.Window_definition_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWindow_definition_listContext is an interface to support dynamic dispatch. +type IWindow_definition_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllWindow_definition() []IWindow_definitionContext + Window_definition(i int) IWindow_definitionContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsWindow_definition_listContext differentiates from other interfaces. + IsWindow_definition_listContext() +} + +type Window_definition_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWindow_definition_listContext() *Window_definition_listContext { + var p = new(Window_definition_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_window_definition_list + return p +} + +func InitEmptyWindow_definition_listContext(p *Window_definition_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_window_definition_list +} + +func (*Window_definition_listContext) IsWindow_definition_listContext() {} + +func NewWindow_definition_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_definition_listContext { + var p = new(Window_definition_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_window_definition_list + + return p +} + +func (s *Window_definition_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Window_definition_listContext) AllWindow_definition() []IWindow_definitionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IWindow_definitionContext); ok { + len++ + } + } + + tst := make([]IWindow_definitionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IWindow_definitionContext); ok { + tst[i] = t.(IWindow_definitionContext) + i++ + } + } + + return tst +} + +func (s *Window_definition_listContext) Window_definition(i int) IWindow_definitionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWindow_definitionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IWindow_definitionContext) +} + +func (s *Window_definition_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Window_definition_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Window_definition_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Window_definition_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Window_definition_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWindow_definition_list(s) + } +} + +func (s *Window_definition_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWindow_definition_list(s) + } +} + +func (s *Window_definition_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWindow_definition_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Window_definition_list() (localctx IWindow_definition_listContext) { + localctx = NewWindow_definition_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1252, PostgreSQLParserRULE_window_definition_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9921) + p.Window_definition() + } + p.SetState(9926) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 944, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(9922) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9923) + p.Window_definition() + } + + } + p.SetState(9928) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 944, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWindow_definitionContext is an interface to support dynamic dispatch. +type IWindow_definitionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + AS() antlr.TerminalNode + Window_specification() IWindow_specificationContext + + // IsWindow_definitionContext differentiates from other interfaces. + IsWindow_definitionContext() +} + +type Window_definitionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWindow_definitionContext() *Window_definitionContext { + var p = new(Window_definitionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_window_definition + return p +} + +func InitEmptyWindow_definitionContext(p *Window_definitionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_window_definition +} + +func (*Window_definitionContext) IsWindow_definitionContext() {} + +func NewWindow_definitionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_definitionContext { + var p = new(Window_definitionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_window_definition + + return p +} + +func (s *Window_definitionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Window_definitionContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Window_definitionContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Window_definitionContext) Window_specification() IWindow_specificationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWindow_specificationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWindow_specificationContext) +} + +func (s *Window_definitionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Window_definitionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Window_definitionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWindow_definition(s) + } +} + +func (s *Window_definitionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWindow_definition(s) + } +} + +func (s *Window_definitionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWindow_definition(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Window_definition() (localctx IWindow_definitionContext) { + localctx = NewWindow_definitionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1254, PostgreSQLParserRULE_window_definition) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9929) + p.Colid() + } + { + p.SetState(9930) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9931) + p.Window_specification() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOver_clauseContext is an interface to support dynamic dispatch. +type IOver_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OVER() antlr.TerminalNode + Window_specification() IWindow_specificationContext + Colid() IColidContext + + // IsOver_clauseContext differentiates from other interfaces. + IsOver_clauseContext() +} + +type Over_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOver_clauseContext() *Over_clauseContext { + var p = new(Over_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_over_clause + return p +} + +func InitEmptyOver_clauseContext(p *Over_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_over_clause +} + +func (*Over_clauseContext) IsOver_clauseContext() {} + +func NewOver_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Over_clauseContext { + var p = new(Over_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_over_clause + + return p +} + +func (s *Over_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Over_clauseContext) OVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOVER, 0) +} + +func (s *Over_clauseContext) Window_specification() IWindow_specificationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWindow_specificationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWindow_specificationContext) +} + +func (s *Over_clauseContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Over_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Over_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Over_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOver_clause(s) + } +} + +func (s *Over_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOver_clause(s) + } +} + +func (s *Over_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOver_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Over_clause() (localctx IOver_clauseContext) { + localctx = NewOver_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1256, PostgreSQLParserRULE_over_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9933) + p.Match(PostgreSQLParserOVER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9936) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(9934) + p.Window_specification() + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(9935) + p.Colid() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWindow_specificationContext is an interface to support dynamic dispatch. +type IWindow_specificationContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + Opt_existing_window_name() IOpt_existing_window_nameContext + Opt_partition_clause() IOpt_partition_clauseContext + Opt_sort_clause() IOpt_sort_clauseContext + Opt_frame_clause() IOpt_frame_clauseContext + + // IsWindow_specificationContext differentiates from other interfaces. + IsWindow_specificationContext() +} + +type Window_specificationContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWindow_specificationContext() *Window_specificationContext { + var p = new(Window_specificationContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_window_specification + return p +} + +func InitEmptyWindow_specificationContext(p *Window_specificationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_window_specification +} + +func (*Window_specificationContext) IsWindow_specificationContext() {} + +func NewWindow_specificationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Window_specificationContext { + var p = new(Window_specificationContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_window_specification + + return p +} + +func (s *Window_specificationContext) GetParser() antlr.Parser { return s.parser } + +func (s *Window_specificationContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Window_specificationContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Window_specificationContext) Opt_existing_window_name() IOpt_existing_window_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_existing_window_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_existing_window_nameContext) +} + +func (s *Window_specificationContext) Opt_partition_clause() IOpt_partition_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_partition_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_partition_clauseContext) +} + +func (s *Window_specificationContext) Opt_sort_clause() IOpt_sort_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_sort_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_sort_clauseContext) +} + +func (s *Window_specificationContext) Opt_frame_clause() IOpt_frame_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_frame_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_frame_clauseContext) +} + +func (s *Window_specificationContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Window_specificationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Window_specificationContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWindow_specification(s) + } +} + +func (s *Window_specificationContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWindow_specification(s) + } +} + +func (s *Window_specificationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWindow_specification(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Window_specification() (localctx IWindow_specificationContext) { + localctx = NewWindow_specificationContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1258, PostgreSQLParserRULE_window_specification) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9938) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(9940) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 946, p.GetParserRuleContext()) == 1 { + { + p.SetState(9939) + p.Opt_existing_window_name() + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(9943) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserPARTITION { + { + p.SetState(9942) + p.Opt_partition_clause() + } + + } + p.SetState(9946) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserORDER { + { + p.SetState(9945) + p.Opt_sort_clause() + } + + } + p.SetState(9949) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserRANGE || _la == PostgreSQLParserROWS || _la == PostgreSQLParserGROUPS { + { + p.SetState(9948) + p.Opt_frame_clause() + } + + } + { + p.SetState(9951) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_existing_window_nameContext is an interface to support dynamic dispatch. +type IOpt_existing_window_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + + // IsOpt_existing_window_nameContext differentiates from other interfaces. + IsOpt_existing_window_nameContext() +} + +type Opt_existing_window_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_existing_window_nameContext() *Opt_existing_window_nameContext { + var p = new(Opt_existing_window_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_existing_window_name + return p +} + +func InitEmptyOpt_existing_window_nameContext(p *Opt_existing_window_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_existing_window_name +} + +func (*Opt_existing_window_nameContext) IsOpt_existing_window_nameContext() {} + +func NewOpt_existing_window_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_existing_window_nameContext { + var p = new(Opt_existing_window_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_existing_window_name + + return p +} + +func (s *Opt_existing_window_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_existing_window_nameContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Opt_existing_window_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_existing_window_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_existing_window_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_existing_window_name(s) + } +} + +func (s *Opt_existing_window_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_existing_window_name(s) + } +} + +func (s *Opt_existing_window_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_existing_window_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_existing_window_name() (localctx IOpt_existing_window_nameContext) { + localctx = NewOpt_existing_window_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1260, PostgreSQLParserRULE_opt_existing_window_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9953) + p.Colid() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_partition_clauseContext is an interface to support dynamic dispatch. +type IOpt_partition_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PARTITION() antlr.TerminalNode + BY() antlr.TerminalNode + Expr_list() IExpr_listContext + + // IsOpt_partition_clauseContext differentiates from other interfaces. + IsOpt_partition_clauseContext() +} + +type Opt_partition_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_partition_clauseContext() *Opt_partition_clauseContext { + var p = new(Opt_partition_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_partition_clause + return p +} + +func InitEmptyOpt_partition_clauseContext(p *Opt_partition_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_partition_clause +} + +func (*Opt_partition_clauseContext) IsOpt_partition_clauseContext() {} + +func NewOpt_partition_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_partition_clauseContext { + var p = new(Opt_partition_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_partition_clause + + return p +} + +func (s *Opt_partition_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_partition_clauseContext) PARTITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTITION, 0) +} + +func (s *Opt_partition_clauseContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Opt_partition_clauseContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Opt_partition_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_partition_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_partition_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_partition_clause(s) + } +} + +func (s *Opt_partition_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_partition_clause(s) + } +} + +func (s *Opt_partition_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_partition_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_partition_clause() (localctx IOpt_partition_clauseContext) { + localctx = NewOpt_partition_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1262, PostgreSQLParserRULE_opt_partition_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9955) + p.Match(PostgreSQLParserPARTITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9956) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9957) + p.Expr_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_frame_clauseContext is an interface to support dynamic dispatch. +type IOpt_frame_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RANGE() antlr.TerminalNode + Frame_extent() IFrame_extentContext + Opt_window_exclusion_clause() IOpt_window_exclusion_clauseContext + ROWS() antlr.TerminalNode + GROUPS() antlr.TerminalNode + + // IsOpt_frame_clauseContext differentiates from other interfaces. + IsOpt_frame_clauseContext() +} + +type Opt_frame_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_frame_clauseContext() *Opt_frame_clauseContext { + var p = new(Opt_frame_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_frame_clause + return p +} + +func InitEmptyOpt_frame_clauseContext(p *Opt_frame_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_frame_clause +} + +func (*Opt_frame_clauseContext) IsOpt_frame_clauseContext() {} + +func NewOpt_frame_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_frame_clauseContext { + var p = new(Opt_frame_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_frame_clause + + return p +} + +func (s *Opt_frame_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_frame_clauseContext) RANGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRANGE, 0) +} + +func (s *Opt_frame_clauseContext) Frame_extent() IFrame_extentContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrame_extentContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrame_extentContext) +} + +func (s *Opt_frame_clauseContext) Opt_window_exclusion_clause() IOpt_window_exclusion_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_window_exclusion_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_window_exclusion_clauseContext) +} + +func (s *Opt_frame_clauseContext) ROWS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROWS, 0) +} + +func (s *Opt_frame_clauseContext) GROUPS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUPS, 0) +} + +func (s *Opt_frame_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_frame_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_frame_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_frame_clause(s) + } +} + +func (s *Opt_frame_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_frame_clause(s) + } +} + +func (s *Opt_frame_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_frame_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_frame_clause() (localctx IOpt_frame_clauseContext) { + localctx = NewOpt_frame_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1264, PostgreSQLParserRULE_opt_frame_clause) + var _la int + + p.SetState(9974) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserRANGE: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9959) + p.Match(PostgreSQLParserRANGE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9960) + p.Frame_extent() + } + p.SetState(9962) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEXCLUDE { + { + p.SetState(9961) + p.Opt_window_exclusion_clause() + } + + } + + case PostgreSQLParserROWS: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9964) + p.Match(PostgreSQLParserROWS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9965) + p.Frame_extent() + } + p.SetState(9967) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEXCLUDE { + { + p.SetState(9966) + p.Opt_window_exclusion_clause() + } + + } + + case PostgreSQLParserGROUPS: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9969) + p.Match(PostgreSQLParserGROUPS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9970) + p.Frame_extent() + } + p.SetState(9972) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEXCLUDE { + { + p.SetState(9971) + p.Opt_window_exclusion_clause() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFrame_extentContext is an interface to support dynamic dispatch. +type IFrame_extentContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllFrame_bound() []IFrame_boundContext + Frame_bound(i int) IFrame_boundContext + BETWEEN() antlr.TerminalNode + AND() antlr.TerminalNode + + // IsFrame_extentContext differentiates from other interfaces. + IsFrame_extentContext() +} + +type Frame_extentContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFrame_extentContext() *Frame_extentContext { + var p = new(Frame_extentContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_frame_extent + return p +} + +func InitEmptyFrame_extentContext(p *Frame_extentContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_frame_extent +} + +func (*Frame_extentContext) IsFrame_extentContext() {} + +func NewFrame_extentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_extentContext { + var p = new(Frame_extentContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_frame_extent + + return p +} + +func (s *Frame_extentContext) GetParser() antlr.Parser { return s.parser } + +func (s *Frame_extentContext) AllFrame_bound() []IFrame_boundContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFrame_boundContext); ok { + len++ + } + } + + tst := make([]IFrame_boundContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFrame_boundContext); ok { + tst[i] = t.(IFrame_boundContext) + i++ + } + } + + return tst +} + +func (s *Frame_extentContext) Frame_bound(i int) IFrame_boundContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrame_boundContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFrame_boundContext) +} + +func (s *Frame_extentContext) BETWEEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBETWEEN, 0) +} + +func (s *Frame_extentContext) AND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, 0) +} + +func (s *Frame_extentContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Frame_extentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Frame_extentContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFrame_extent(s) + } +} + +func (s *Frame_extentContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFrame_extent(s) + } +} + +func (s *Frame_extentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFrame_extent(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Frame_extent() (localctx IFrame_extentContext) { + localctx = NewFrame_extentContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1266, PostgreSQLParserRULE_frame_extent) + p.SetState(9982) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 954, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9976) + p.Frame_bound() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9977) + p.Match(PostgreSQLParserBETWEEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9978) + p.Frame_bound() + } + { + p.SetState(9979) + p.Match(PostgreSQLParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9980) + p.Frame_bound() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFrame_boundContext is an interface to support dynamic dispatch. +type IFrame_boundContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + UNBOUNDED() antlr.TerminalNode + PRECEDING() antlr.TerminalNode + FOLLOWING() antlr.TerminalNode + CURRENT_P() antlr.TerminalNode + ROW() antlr.TerminalNode + A_expr() IA_exprContext + + // IsFrame_boundContext differentiates from other interfaces. + IsFrame_boundContext() +} + +type Frame_boundContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFrame_boundContext() *Frame_boundContext { + var p = new(Frame_boundContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_frame_bound + return p +} + +func InitEmptyFrame_boundContext(p *Frame_boundContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_frame_bound +} + +func (*Frame_boundContext) IsFrame_boundContext() {} + +func NewFrame_boundContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Frame_boundContext { + var p = new(Frame_boundContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_frame_bound + + return p +} + +func (s *Frame_boundContext) GetParser() antlr.Parser { return s.parser } + +func (s *Frame_boundContext) UNBOUNDED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNBOUNDED, 0) +} + +func (s *Frame_boundContext) PRECEDING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRECEDING, 0) +} + +func (s *Frame_boundContext) FOLLOWING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOLLOWING, 0) +} + +func (s *Frame_boundContext) CURRENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_P, 0) +} + +func (s *Frame_boundContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *Frame_boundContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Frame_boundContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Frame_boundContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Frame_boundContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFrame_bound(s) + } +} + +func (s *Frame_boundContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFrame_bound(s) + } +} + +func (s *Frame_boundContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFrame_bound(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Frame_bound() (localctx IFrame_boundContext) { + localctx = NewFrame_boundContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1268, PostgreSQLParserRULE_frame_bound) + var _la int + + p.SetState(9991) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 955, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9984) + p.Match(PostgreSQLParserUNBOUNDED) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9985) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFOLLOWING || _la == PostgreSQLParserPRECEDING) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(9986) + p.Match(PostgreSQLParserCURRENT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9987) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(9988) + p.A_expr() + } + { + p.SetState(9989) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFOLLOWING || _la == PostgreSQLParserPRECEDING) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_window_exclusion_clauseContext is an interface to support dynamic dispatch. +type IOpt_window_exclusion_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EXCLUDE() antlr.TerminalNode + CURRENT_P() antlr.TerminalNode + ROW() antlr.TerminalNode + GROUP_P() antlr.TerminalNode + TIES() antlr.TerminalNode + NO() antlr.TerminalNode + OTHERS() antlr.TerminalNode + + // IsOpt_window_exclusion_clauseContext differentiates from other interfaces. + IsOpt_window_exclusion_clauseContext() +} + +type Opt_window_exclusion_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_window_exclusion_clauseContext() *Opt_window_exclusion_clauseContext { + var p = new(Opt_window_exclusion_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_window_exclusion_clause + return p +} + +func InitEmptyOpt_window_exclusion_clauseContext(p *Opt_window_exclusion_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_window_exclusion_clause +} + +func (*Opt_window_exclusion_clauseContext) IsOpt_window_exclusion_clauseContext() {} + +func NewOpt_window_exclusion_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_window_exclusion_clauseContext { + var p = new(Opt_window_exclusion_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_window_exclusion_clause + + return p +} + +func (s *Opt_window_exclusion_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_window_exclusion_clauseContext) EXCLUDE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCLUDE, 0) +} + +func (s *Opt_window_exclusion_clauseContext) CURRENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_P, 0) +} + +func (s *Opt_window_exclusion_clauseContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *Opt_window_exclusion_clauseContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *Opt_window_exclusion_clauseContext) TIES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIES, 0) +} + +func (s *Opt_window_exclusion_clauseContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Opt_window_exclusion_clauseContext) OTHERS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOTHERS, 0) +} + +func (s *Opt_window_exclusion_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_window_exclusion_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_window_exclusion_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_window_exclusion_clause(s) + } +} + +func (s *Opt_window_exclusion_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_window_exclusion_clause(s) + } +} + +func (s *Opt_window_exclusion_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_window_exclusion_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_window_exclusion_clause() (localctx IOpt_window_exclusion_clauseContext) { + localctx = NewOpt_window_exclusion_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1270, PostgreSQLParserRULE_opt_window_exclusion_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(9993) + p.Match(PostgreSQLParserEXCLUDE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10000) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserCURRENT_P: + { + p.SetState(9994) + p.Match(PostgreSQLParserCURRENT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9995) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserGROUP_P: + { + p.SetState(9996) + p.Match(PostgreSQLParserGROUP_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserTIES: + { + p.SetState(9997) + p.Match(PostgreSQLParserTIES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserNO: + { + p.SetState(9998) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(9999) + p.Match(PostgreSQLParserOTHERS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRowContext is an interface to support dynamic dispatch. +type IRowContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ROW() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + COMMA() antlr.TerminalNode + A_expr() IA_exprContext + + // IsRowContext differentiates from other interfaces. + IsRowContext() +} + +type RowContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRowContext() *RowContext { + var p = new(RowContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_row + return p +} + +func InitEmptyRowContext(p *RowContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_row +} + +func (*RowContext) IsRowContext() {} + +func NewRowContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RowContext { + var p = new(RowContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_row + + return p +} + +func (s *RowContext) GetParser() antlr.Parser { return s.parser } + +func (s *RowContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *RowContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *RowContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *RowContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *RowContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *RowContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *RowContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RowContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RowContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRow(s) + } +} + +func (s *RowContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRow(s) + } +} + +func (s *RowContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRow(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Row() (localctx IRowContext) { + localctx = NewRowContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1272, PostgreSQLParserRULE_row) + var _la int + + p.SetState(10014) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserROW: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10002) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10003) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10005) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858553860) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073201) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(10004) + p.Expr_list() + } + + } + { + p.SetState(10007) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserOPEN_PAREN: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10008) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10009) + p.Expr_list() + } + { + p.SetState(10010) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10011) + p.A_expr() + } + { + p.SetState(10012) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExplicit_rowContext is an interface to support dynamic dispatch. +type IExplicit_rowContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ROW() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + + // IsExplicit_rowContext differentiates from other interfaces. + IsExplicit_rowContext() +} + +type Explicit_rowContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExplicit_rowContext() *Explicit_rowContext { + var p = new(Explicit_rowContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explicit_row + return p +} + +func InitEmptyExplicit_rowContext(p *Explicit_rowContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_explicit_row +} + +func (*Explicit_rowContext) IsExplicit_rowContext() {} + +func NewExplicit_rowContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Explicit_rowContext { + var p = new(Explicit_rowContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_explicit_row + + return p +} + +func (s *Explicit_rowContext) GetParser() antlr.Parser { return s.parser } + +func (s *Explicit_rowContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *Explicit_rowContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Explicit_rowContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Explicit_rowContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Explicit_rowContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Explicit_rowContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Explicit_rowContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExplicit_row(s) + } +} + +func (s *Explicit_rowContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExplicit_row(s) + } +} + +func (s *Explicit_rowContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExplicit_row(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Explicit_row() (localctx IExplicit_rowContext) { + localctx = NewExplicit_rowContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1274, PostgreSQLParserRULE_explicit_row) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10016) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10017) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10019) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858553860) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073201) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(10018) + p.Expr_list() + } + + } + { + p.SetState(10021) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IImplicit_rowContext is an interface to support dynamic dispatch. +type IImplicit_rowContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Expr_list() IExpr_listContext + COMMA() antlr.TerminalNode + A_expr() IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + + // IsImplicit_rowContext differentiates from other interfaces. + IsImplicit_rowContext() +} + +type Implicit_rowContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyImplicit_rowContext() *Implicit_rowContext { + var p = new(Implicit_rowContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_implicit_row + return p +} + +func InitEmptyImplicit_rowContext(p *Implicit_rowContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_implicit_row +} + +func (*Implicit_rowContext) IsImplicit_rowContext() {} + +func NewImplicit_rowContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Implicit_rowContext { + var p = new(Implicit_rowContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_implicit_row + + return p +} + +func (s *Implicit_rowContext) GetParser() antlr.Parser { return s.parser } + +func (s *Implicit_rowContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Implicit_rowContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Implicit_rowContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Implicit_rowContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Implicit_rowContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Implicit_rowContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Implicit_rowContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Implicit_rowContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterImplicit_row(s) + } +} + +func (s *Implicit_rowContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitImplicit_row(s) + } +} + +func (s *Implicit_rowContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitImplicit_row(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Implicit_row() (localctx IImplicit_rowContext) { + localctx = NewImplicit_rowContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1276, PostgreSQLParserRULE_implicit_row) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10023) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10024) + p.Expr_list() + } + { + p.SetState(10025) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10026) + p.A_expr() + } + { + p.SetState(10027) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISub_typeContext is an interface to support dynamic dispatch. +type ISub_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ANY() antlr.TerminalNode + SOME() antlr.TerminalNode + ALL() antlr.TerminalNode + + // IsSub_typeContext differentiates from other interfaces. + IsSub_typeContext() +} + +type Sub_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySub_typeContext() *Sub_typeContext { + var p = new(Sub_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sub_type + return p +} + +func InitEmptySub_typeContext(p *Sub_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sub_type +} + +func (*Sub_typeContext) IsSub_typeContext() {} + +func NewSub_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Sub_typeContext { + var p = new(Sub_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_sub_type + + return p +} + +func (s *Sub_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Sub_typeContext) ANY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserANY, 0) +} + +func (s *Sub_typeContext) SOME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSOME, 0) +} + +func (s *Sub_typeContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Sub_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Sub_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Sub_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSub_type(s) + } +} + +func (s *Sub_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSub_type(s) + } +} + +func (s *Sub_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSub_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Sub_type() (localctx ISub_typeContext) { + localctx = NewSub_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1278, PostgreSQLParserRULE_sub_type) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10029) + _la = p.GetTokenStream().LA(1) + + if !((int64((_la-30)) & ^0x3f) == 0 && ((int64(1)<<(_la-30))&1152921504606846993) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAll_opContext is an interface to support dynamic dispatch. +type IAll_opContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Operator() antlr.TerminalNode + Mathop() IMathopContext + + // IsAll_opContext differentiates from other interfaces. + IsAll_opContext() +} + +type All_opContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAll_opContext() *All_opContext { + var p = new(All_opContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_all_op + return p +} + +func InitEmptyAll_opContext(p *All_opContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_all_op +} + +func (*All_opContext) IsAll_opContext() {} + +func NewAll_opContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *All_opContext { + var p = new(All_opContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_all_op + + return p +} + +func (s *All_opContext) GetParser() antlr.Parser { return s.parser } + +func (s *All_opContext) Operator() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOperator, 0) +} + +func (s *All_opContext) Mathop() IMathopContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IMathopContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IMathopContext) +} + +func (s *All_opContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *All_opContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *All_opContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAll_op(s) + } +} + +func (s *All_opContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAll_op(s) + } +} + +func (s *All_opContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAll_op(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) All_op() (localctx IAll_opContext) { + localctx = NewAll_opContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1280, PostgreSQLParserRULE_all_op) + p.SetState(10033) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOperator: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10031) + p.Match(PostgreSQLParserOperator) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSTAR, PostgreSQLParserEQUAL, PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserSLASH, PostgreSQLParserCARET, PostgreSQLParserLT, PostgreSQLParserGT, PostgreSQLParserLESS_EQUALS, PostgreSQLParserGREATER_EQUALS, PostgreSQLParserNOT_EQUALS, PostgreSQLParserPERCENT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10032) + p.Mathop() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IMathopContext is an interface to support dynamic dispatch. +type IMathopContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PLUS() antlr.TerminalNode + MINUS() antlr.TerminalNode + STAR() antlr.TerminalNode + SLASH() antlr.TerminalNode + PERCENT() antlr.TerminalNode + CARET() antlr.TerminalNode + LT() antlr.TerminalNode + GT() antlr.TerminalNode + EQUAL() antlr.TerminalNode + LESS_EQUALS() antlr.TerminalNode + GREATER_EQUALS() antlr.TerminalNode + NOT_EQUALS() antlr.TerminalNode + + // IsMathopContext differentiates from other interfaces. + IsMathopContext() +} + +type MathopContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyMathopContext() *MathopContext { + var p = new(MathopContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_mathop + return p +} + +func InitEmptyMathopContext(p *MathopContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_mathop +} + +func (*MathopContext) IsMathopContext() {} + +func NewMathopContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MathopContext { + var p = new(MathopContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_mathop + + return p +} + +func (s *MathopContext) GetParser() antlr.Parser { return s.parser } + +func (s *MathopContext) PLUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLUS, 0) +} + +func (s *MathopContext) MINUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUS, 0) +} + +func (s *MathopContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *MathopContext) SLASH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSLASH, 0) +} + +func (s *MathopContext) PERCENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPERCENT, 0) +} + +func (s *MathopContext) CARET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCARET, 0) +} + +func (s *MathopContext) LT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLT, 0) +} + +func (s *MathopContext) GT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGT, 0) +} + +func (s *MathopContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *MathopContext) LESS_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLESS_EQUALS, 0) +} + +func (s *MathopContext) GREATER_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGREATER_EQUALS, 0) +} + +func (s *MathopContext) NOT_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT_EQUALS, 0) +} + +func (s *MathopContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *MathopContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *MathopContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterMathop(s) + } +} + +func (s *MathopContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitMathop(s) + } +} + +func (s *MathopContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitMathop(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Mathop() (localctx IMathopContext) { + localctx = NewMathopContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1282, PostgreSQLParserRULE_mathop) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10035) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&178517504) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IQual_opContext is an interface to support dynamic dispatch. +type IQual_opContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Operator() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Any_operator() IAny_operatorContext + CLOSE_PAREN() antlr.TerminalNode + + // IsQual_opContext differentiates from other interfaces. + IsQual_opContext() +} + +type Qual_opContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyQual_opContext() *Qual_opContext { + var p = new(Qual_opContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_qual_op + return p +} + +func InitEmptyQual_opContext(p *Qual_opContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_qual_op +} + +func (*Qual_opContext) IsQual_opContext() {} + +func NewQual_opContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Qual_opContext { + var p = new(Qual_opContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_qual_op + + return p +} + +func (s *Qual_opContext) GetParser() antlr.Parser { return s.parser } + +func (s *Qual_opContext) Operator() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOperator, 0) +} + +func (s *Qual_opContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *Qual_opContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Qual_opContext) Any_operator() IAny_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_operatorContext) +} + +func (s *Qual_opContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Qual_opContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Qual_opContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Qual_opContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterQual_op(s) + } +} + +func (s *Qual_opContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitQual_op(s) + } +} + +func (s *Qual_opContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitQual_op(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Qual_op() (localctx IQual_opContext) { + localctx = NewQual_opContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1284, PostgreSQLParserRULE_qual_op) + p.SetState(10043) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOperator: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10037) + p.Match(PostgreSQLParserOperator) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserOPERATOR: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10038) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10039) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10040) + p.Any_operator() + } + { + p.SetState(10041) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IQual_all_opContext is an interface to support dynamic dispatch. +type IQual_all_opContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + All_op() IAll_opContext + OPERATOR() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Any_operator() IAny_operatorContext + CLOSE_PAREN() antlr.TerminalNode + + // IsQual_all_opContext differentiates from other interfaces. + IsQual_all_opContext() +} + +type Qual_all_opContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyQual_all_opContext() *Qual_all_opContext { + var p = new(Qual_all_opContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_qual_all_op + return p +} + +func InitEmptyQual_all_opContext(p *Qual_all_opContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_qual_all_op +} + +func (*Qual_all_opContext) IsQual_all_opContext() {} + +func NewQual_all_opContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Qual_all_opContext { + var p = new(Qual_all_opContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_qual_all_op + + return p +} + +func (s *Qual_all_opContext) GetParser() antlr.Parser { return s.parser } + +func (s *Qual_all_opContext) All_op() IAll_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAll_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAll_opContext) +} + +func (s *Qual_all_opContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *Qual_all_opContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Qual_all_opContext) Any_operator() IAny_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_operatorContext) +} + +func (s *Qual_all_opContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Qual_all_opContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Qual_all_opContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Qual_all_opContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterQual_all_op(s) + } +} + +func (s *Qual_all_opContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitQual_all_op(s) + } +} + +func (s *Qual_all_opContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitQual_all_op(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Qual_all_op() (localctx IQual_all_opContext) { + localctx = NewQual_all_opContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1286, PostgreSQLParserRULE_qual_all_op) + p.SetState(10051) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserSTAR, PostgreSQLParserEQUAL, PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserSLASH, PostgreSQLParserCARET, PostgreSQLParserLT, PostgreSQLParserGT, PostgreSQLParserLESS_EQUALS, PostgreSQLParserGREATER_EQUALS, PostgreSQLParserNOT_EQUALS, PostgreSQLParserPERCENT, PostgreSQLParserOperator: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10045) + p.All_op() + } + + case PostgreSQLParserOPERATOR: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10046) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10047) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10048) + p.Any_operator() + } + { + p.SetState(10049) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISubquery_OpContext is an interface to support dynamic dispatch. +type ISubquery_OpContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + All_op() IAll_opContext + OPERATOR() antlr.TerminalNode + OPEN_PAREN() antlr.TerminalNode + Any_operator() IAny_operatorContext + CLOSE_PAREN() antlr.TerminalNode + LIKE() antlr.TerminalNode + NOT() antlr.TerminalNode + ILIKE() antlr.TerminalNode + + // IsSubquery_OpContext differentiates from other interfaces. + IsSubquery_OpContext() +} + +type Subquery_OpContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySubquery_OpContext() *Subquery_OpContext { + var p = new(Subquery_OpContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_subquery_Op + return p +} + +func InitEmptySubquery_OpContext(p *Subquery_OpContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_subquery_Op +} + +func (*Subquery_OpContext) IsSubquery_OpContext() {} + +func NewSubquery_OpContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Subquery_OpContext { + var p = new(Subquery_OpContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_subquery_Op + + return p +} + +func (s *Subquery_OpContext) GetParser() antlr.Parser { return s.parser } + +func (s *Subquery_OpContext) All_op() IAll_opContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAll_opContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAll_opContext) +} + +func (s *Subquery_OpContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *Subquery_OpContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Subquery_OpContext) Any_operator() IAny_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_operatorContext) +} + +func (s *Subquery_OpContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Subquery_OpContext) LIKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIKE, 0) +} + +func (s *Subquery_OpContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Subquery_OpContext) ILIKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserILIKE, 0) +} + +func (s *Subquery_OpContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Subquery_OpContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Subquery_OpContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSubquery_Op(s) + } +} + +func (s *Subquery_OpContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSubquery_Op(s) + } +} + +func (s *Subquery_OpContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSubquery_Op(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Subquery_Op() (localctx ISubquery_OpContext) { + localctx = NewSubquery_OpContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1288, PostgreSQLParserRULE_subquery_Op) + p.SetState(10065) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 963, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10053) + p.All_op() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10054) + p.Match(PostgreSQLParserOPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10055) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10056) + p.Any_operator() + } + { + p.SetState(10057) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10059) + p.Match(PostgreSQLParserLIKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10060) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10061) + p.Match(PostgreSQLParserLIKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10062) + p.Match(PostgreSQLParserILIKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10063) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10064) + p.Match(PostgreSQLParserILIKE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExpr_listContext is an interface to support dynamic dispatch. +type IExpr_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsExpr_listContext differentiates from other interfaces. + IsExpr_listContext() +} + +type Expr_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExpr_listContext() *Expr_listContext { + var p = new(Expr_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_list + return p +} + +func InitEmptyExpr_listContext(p *Expr_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_list +} + +func (*Expr_listContext) IsExpr_listContext() {} + +func NewExpr_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Expr_listContext { + var p = new(Expr_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_expr_list + + return p +} + +func (s *Expr_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Expr_listContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *Expr_listContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Expr_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Expr_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Expr_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Expr_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Expr_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExpr_list(s) + } +} + +func (s *Expr_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExpr_list(s) + } +} + +func (s *Expr_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExpr_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Expr_list() (localctx IExpr_listContext) { + localctx = NewExpr_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1290, PostgreSQLParserRULE_expr_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10067) + p.A_expr() + } + p.SetState(10072) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 964, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(10068) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10069) + p.A_expr() + } + + } + p.SetState(10074) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 964, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_arg_listContext is an interface to support dynamic dispatch. +type IFunc_arg_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllFunc_arg_expr() []IFunc_arg_exprContext + Func_arg_expr(i int) IFunc_arg_exprContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsFunc_arg_listContext differentiates from other interfaces. + IsFunc_arg_listContext() +} + +type Func_arg_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_arg_listContext() *Func_arg_listContext { + var p = new(Func_arg_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_arg_list + return p +} + +func InitEmptyFunc_arg_listContext(p *Func_arg_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_arg_list +} + +func (*Func_arg_listContext) IsFunc_arg_listContext() {} + +func NewFunc_arg_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_arg_listContext { + var p = new(Func_arg_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_arg_list + + return p +} + +func (s *Func_arg_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_arg_listContext) AllFunc_arg_expr() []IFunc_arg_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IFunc_arg_exprContext); ok { + len++ + } + } + + tst := make([]IFunc_arg_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IFunc_arg_exprContext); ok { + tst[i] = t.(IFunc_arg_exprContext) + i++ + } + } + + return tst +} + +func (s *Func_arg_listContext) Func_arg_expr(i int) IFunc_arg_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_arg_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IFunc_arg_exprContext) +} + +func (s *Func_arg_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Func_arg_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Func_arg_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_arg_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_arg_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_arg_list(s) + } +} + +func (s *Func_arg_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_arg_list(s) + } +} + +func (s *Func_arg_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_arg_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_arg_list() (localctx IFunc_arg_listContext) { + localctx = NewFunc_arg_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1292, PostgreSQLParserRULE_func_arg_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10075) + p.Func_arg_expr() + } + p.SetState(10080) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 965, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(10076) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10077) + p.Func_arg_expr() + } + + } + p.SetState(10082) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 965, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_arg_exprContext is an interface to support dynamic dispatch. +type IFunc_arg_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + Param_name() IParam_nameContext + COLON_EQUALS() antlr.TerminalNode + EQUALS_GREATER() antlr.TerminalNode + + // IsFunc_arg_exprContext differentiates from other interfaces. + IsFunc_arg_exprContext() +} + +type Func_arg_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_arg_exprContext() *Func_arg_exprContext { + var p = new(Func_arg_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_arg_expr + return p +} + +func InitEmptyFunc_arg_exprContext(p *Func_arg_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_arg_expr +} + +func (*Func_arg_exprContext) IsFunc_arg_exprContext() {} + +func NewFunc_arg_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_arg_exprContext { + var p = new(Func_arg_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_arg_expr + + return p +} + +func (s *Func_arg_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_arg_exprContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Func_arg_exprContext) Param_name() IParam_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IParam_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IParam_nameContext) +} + +func (s *Func_arg_exprContext) COLON_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLON_EQUALS, 0) +} + +func (s *Func_arg_exprContext) EQUALS_GREATER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUALS_GREATER, 0) +} + +func (s *Func_arg_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_arg_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_arg_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_arg_expr(s) + } +} + +func (s *Func_arg_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_arg_expr(s) + } +} + +func (s *Func_arg_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_arg_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_arg_expr() (localctx IFunc_arg_exprContext) { + localctx = NewFunc_arg_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1294, PostgreSQLParserRULE_func_arg_expr) + var _la int + + p.SetState(10088) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 966, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10083) + p.A_expr() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10084) + p.Param_name() + } + { + p.SetState(10085) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCOLON_EQUALS || _la == PostgreSQLParserEQUALS_GREATER) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + { + p.SetState(10086) + p.A_expr() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IType_listContext is an interface to support dynamic dispatch. +type IType_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTypename() []ITypenameContext + Typename(i int) ITypenameContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsType_listContext differentiates from other interfaces. + IsType_listContext() +} + +type Type_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyType_listContext() *Type_listContext { + var p = new(Type_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_type_list + return p +} + +func InitEmptyType_listContext(p *Type_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_type_list +} + +func (*Type_listContext) IsType_listContext() {} + +func NewType_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_listContext { + var p = new(Type_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_type_list + + return p +} + +func (s *Type_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Type_listContext) AllTypename() []ITypenameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITypenameContext); ok { + len++ + } + } + + tst := make([]ITypenameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITypenameContext); ok { + tst[i] = t.(ITypenameContext) + i++ + } + } + + return tst +} + +func (s *Type_listContext) Typename(i int) ITypenameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Type_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Type_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Type_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Type_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Type_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterType_list(s) + } +} + +func (s *Type_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitType_list(s) + } +} + +func (s *Type_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitType_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Type_list() (localctx IType_listContext) { + localctx = NewType_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1296, PostgreSQLParserRULE_type_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10090) + p.Typename() + } + p.SetState(10095) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10091) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10092) + p.Typename() + } + + p.SetState(10097) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IArray_exprContext is an interface to support dynamic dispatch. +type IArray_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_BRACKET() antlr.TerminalNode + CLOSE_BRACKET() antlr.TerminalNode + Expr_list() IExpr_listContext + Array_expr_list() IArray_expr_listContext + + // IsArray_exprContext differentiates from other interfaces. + IsArray_exprContext() +} + +type Array_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyArray_exprContext() *Array_exprContext { + var p = new(Array_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_array_expr + return p +} + +func InitEmptyArray_exprContext(p *Array_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_array_expr +} + +func (*Array_exprContext) IsArray_exprContext() {} + +func NewArray_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Array_exprContext { + var p = new(Array_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_array_expr + + return p +} + +func (s *Array_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *Array_exprContext) OPEN_BRACKET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_BRACKET, 0) +} + +func (s *Array_exprContext) CLOSE_BRACKET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_BRACKET, 0) +} + +func (s *Array_exprContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Array_exprContext) Array_expr_list() IArray_expr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArray_expr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArray_expr_listContext) +} + +func (s *Array_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Array_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Array_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterArray_expr(s) + } +} + +func (s *Array_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitArray_expr(s) + } +} + +func (s *Array_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitArray_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Array_expr() (localctx IArray_exprContext) { + localctx = NewArray_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1298, PostgreSQLParserRULE_array_expr) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10098) + p.Match(PostgreSQLParserOPEN_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10101) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN, PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserPARAM, PostgreSQLParserOperator, PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNOT, PostgreSQLParserNULL_P, PostgreSQLParserSESSION_USER, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserRIGHT, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserBinaryStringConstant, PostgreSQLParserHexadecimalStringConstant, PostgreSQLParserIntegral, PostgreSQLParserNumeric, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + { + p.SetState(10099) + p.Expr_list() + } + + case PostgreSQLParserOPEN_BRACKET: + { + p.SetState(10100) + p.Array_expr_list() + } + + case PostgreSQLParserCLOSE_BRACKET: + + default: + } + { + p.SetState(10103) + p.Match(PostgreSQLParserCLOSE_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IArray_expr_listContext is an interface to support dynamic dispatch. +type IArray_expr_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllArray_expr() []IArray_exprContext + Array_expr(i int) IArray_exprContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsArray_expr_listContext differentiates from other interfaces. + IsArray_expr_listContext() +} + +type Array_expr_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyArray_expr_listContext() *Array_expr_listContext { + var p = new(Array_expr_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_array_expr_list + return p +} + +func InitEmptyArray_expr_listContext(p *Array_expr_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_array_expr_list +} + +func (*Array_expr_listContext) IsArray_expr_listContext() {} + +func NewArray_expr_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Array_expr_listContext { + var p = new(Array_expr_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_array_expr_list + + return p +} + +func (s *Array_expr_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Array_expr_listContext) AllArray_expr() []IArray_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IArray_exprContext); ok { + len++ + } + } + + tst := make([]IArray_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IArray_exprContext); ok { + tst[i] = t.(IArray_exprContext) + i++ + } + } + + return tst +} + +func (s *Array_expr_listContext) Array_expr(i int) IArray_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArray_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IArray_exprContext) +} + +func (s *Array_expr_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Array_expr_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Array_expr_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Array_expr_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Array_expr_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterArray_expr_list(s) + } +} + +func (s *Array_expr_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitArray_expr_list(s) + } +} + +func (s *Array_expr_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitArray_expr_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Array_expr_list() (localctx IArray_expr_listContext) { + localctx = NewArray_expr_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1300, PostgreSQLParserRULE_array_expr_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10105) + p.Array_expr() + } + p.SetState(10110) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10106) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10107) + p.Array_expr() + } + + p.SetState(10112) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExtract_listContext is an interface to support dynamic dispatch. +type IExtract_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Extract_arg() IExtract_argContext + FROM() antlr.TerminalNode + A_expr() IA_exprContext + + // IsExtract_listContext differentiates from other interfaces. + IsExtract_listContext() +} + +type Extract_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExtract_listContext() *Extract_listContext { + var p = new(Extract_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_extract_list + return p +} + +func InitEmptyExtract_listContext(p *Extract_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_extract_list +} + +func (*Extract_listContext) IsExtract_listContext() {} + +func NewExtract_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Extract_listContext { + var p = new(Extract_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_extract_list + + return p +} + +func (s *Extract_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Extract_listContext) Extract_arg() IExtract_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExtract_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExtract_argContext) +} + +func (s *Extract_listContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Extract_listContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Extract_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Extract_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Extract_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExtract_list(s) + } +} + +func (s *Extract_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExtract_list(s) + } +} + +func (s *Extract_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExtract_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Extract_list() (localctx IExtract_listContext) { + localctx = NewExtract_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1302, PostgreSQLParserRULE_extract_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10113) + p.Extract_arg() + } + { + p.SetState(10114) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10115) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExtract_argContext is an interface to support dynamic dispatch. +type IExtract_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + YEAR_P() antlr.TerminalNode + MONTH_P() antlr.TerminalNode + DAY_P() antlr.TerminalNode + HOUR_P() antlr.TerminalNode + MINUTE_P() antlr.TerminalNode + SECOND_P() antlr.TerminalNode + Sconst() ISconstContext + + // IsExtract_argContext differentiates from other interfaces. + IsExtract_argContext() +} + +type Extract_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExtract_argContext() *Extract_argContext { + var p = new(Extract_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_extract_arg + return p +} + +func InitEmptyExtract_argContext(p *Extract_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_extract_arg +} + +func (*Extract_argContext) IsExtract_argContext() {} + +func NewExtract_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Extract_argContext { + var p = new(Extract_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_extract_arg + + return p +} + +func (s *Extract_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Extract_argContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Extract_argContext) YEAR_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserYEAR_P, 0) +} + +func (s *Extract_argContext) MONTH_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMONTH_P, 0) +} + +func (s *Extract_argContext) DAY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDAY_P, 0) +} + +func (s *Extract_argContext) HOUR_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHOUR_P, 0) +} + +func (s *Extract_argContext) MINUTE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUTE_P, 0) +} + +func (s *Extract_argContext) SECOND_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSECOND_P, 0) +} + +func (s *Extract_argContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Extract_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Extract_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Extract_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExtract_arg(s) + } +} + +func (s *Extract_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExtract_arg(s) + } +} + +func (s *Extract_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExtract_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Extract_arg() (localctx IExtract_argContext) { + localctx = NewExtract_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1304, PostgreSQLParserRULE_extract_arg) + p.SetState(10125) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserOUTER_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserBACKWARD, PostgreSQLParserCHAIN, PostgreSQLParserCLOSE, PostgreSQLParserCOMMIT, PostgreSQLParserCONTINUE_P, PostgreSQLParserCURSOR, PostgreSQLParserFIRST_P, PostgreSQLParserFORWARD, PostgreSQLParserINSERT, PostgreSQLParserLAST_P, PostgreSQLParserMOVE, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserOPTION, PostgreSQLParserPRIOR, PostgreSQLParserRELATIVE_P, PostgreSQLParserRESET, PostgreSQLParserROLLBACK, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSET, PostgreSQLParserTYPE_P, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserROWTYPE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10117) + p.Identifier() + } + + case PostgreSQLParserYEAR_P: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10118) + p.Match(PostgreSQLParserYEAR_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserMONTH_P: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10119) + p.Match(PostgreSQLParserMONTH_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDAY_P: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10120) + p.Match(PostgreSQLParserDAY_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserHOUR_P: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10121) + p.Match(PostgreSQLParserHOUR_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserMINUTE_P: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10122) + p.Match(PostgreSQLParserMINUTE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSECOND_P: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(10123) + p.Match(PostgreSQLParserSECOND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(10124) + p.Sconst() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IUnicode_normal_formContext is an interface to support dynamic dispatch. +type IUnicode_normal_formContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NFC() antlr.TerminalNode + NFD() antlr.TerminalNode + NFKC() antlr.TerminalNode + NFKD() antlr.TerminalNode + + // IsUnicode_normal_formContext differentiates from other interfaces. + IsUnicode_normal_formContext() +} + +type Unicode_normal_formContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyUnicode_normal_formContext() *Unicode_normal_formContext { + var p = new(Unicode_normal_formContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_unicode_normal_form + return p +} + +func InitEmptyUnicode_normal_formContext(p *Unicode_normal_formContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_unicode_normal_form +} + +func (*Unicode_normal_formContext) IsUnicode_normal_formContext() {} + +func NewUnicode_normal_formContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Unicode_normal_formContext { + var p = new(Unicode_normal_formContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_unicode_normal_form + + return p +} + +func (s *Unicode_normal_formContext) GetParser() antlr.Parser { return s.parser } + +func (s *Unicode_normal_formContext) NFC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNFC, 0) +} + +func (s *Unicode_normal_formContext) NFD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNFD, 0) +} + +func (s *Unicode_normal_formContext) NFKC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNFKC, 0) +} + +func (s *Unicode_normal_formContext) NFKD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNFKD, 0) +} + +func (s *Unicode_normal_formContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Unicode_normal_formContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Unicode_normal_formContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterUnicode_normal_form(s) + } +} + +func (s *Unicode_normal_formContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitUnicode_normal_form(s) + } +} + +func (s *Unicode_normal_formContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitUnicode_normal_form(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Unicode_normal_form() (localctx IUnicode_normal_formContext) { + localctx = NewUnicode_normal_formContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1306, PostgreSQLParserRULE_unicode_normal_form) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10127) + _la = p.GetTokenStream().LA(1) + + if !((int64((_la-485)) & ^0x3f) == 0 && ((int64(1)<<(_la-485))&15) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOverlay_listContext is an interface to support dynamic dispatch. +type IOverlay_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + PLACING() antlr.TerminalNode + FROM() antlr.TerminalNode + FOR() antlr.TerminalNode + + // IsOverlay_listContext differentiates from other interfaces. + IsOverlay_listContext() +} + +type Overlay_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOverlay_listContext() *Overlay_listContext { + var p = new(Overlay_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_overlay_list + return p +} + +func InitEmptyOverlay_listContext(p *Overlay_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_overlay_list +} + +func (*Overlay_listContext) IsOverlay_listContext() {} + +func NewOverlay_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Overlay_listContext { + var p = new(Overlay_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_overlay_list + + return p +} + +func (s *Overlay_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Overlay_listContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *Overlay_listContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Overlay_listContext) PLACING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLACING, 0) +} + +func (s *Overlay_listContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Overlay_listContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Overlay_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Overlay_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Overlay_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOverlay_list(s) + } +} + +func (s *Overlay_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOverlay_list(s) + } +} + +func (s *Overlay_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOverlay_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Overlay_list() (localctx IOverlay_listContext) { + localctx = NewOverlay_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1308, PostgreSQLParserRULE_overlay_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10129) + p.A_expr() + } + { + p.SetState(10130) + p.Match(PostgreSQLParserPLACING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10131) + p.A_expr() + } + { + p.SetState(10132) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10133) + p.A_expr() + } + p.SetState(10136) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFOR { + { + p.SetState(10134) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10135) + p.A_expr() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPosition_listContext is an interface to support dynamic dispatch. +type IPosition_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllB_expr() []IB_exprContext + B_expr(i int) IB_exprContext + IN_P() antlr.TerminalNode + + // IsPosition_listContext differentiates from other interfaces. + IsPosition_listContext() +} + +type Position_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPosition_listContext() *Position_listContext { + var p = new(Position_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_position_list + return p +} + +func InitEmptyPosition_listContext(p *Position_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_position_list +} + +func (*Position_listContext) IsPosition_listContext() {} + +func NewPosition_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Position_listContext { + var p = new(Position_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_position_list + + return p +} + +func (s *Position_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Position_listContext) AllB_expr() []IB_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IB_exprContext); ok { + len++ + } + } + + tst := make([]IB_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IB_exprContext); ok { + tst[i] = t.(IB_exprContext) + i++ + } + } + + return tst +} + +func (s *Position_listContext) B_expr(i int) IB_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IB_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IB_exprContext) +} + +func (s *Position_listContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Position_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Position_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Position_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPosition_list(s) + } +} + +func (s *Position_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPosition_list(s) + } +} + +func (s *Position_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPosition_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Position_list() (localctx IPosition_listContext) { + localctx = NewPosition_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1310, PostgreSQLParserRULE_position_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10138) + p.b_expr(0) + } + { + p.SetState(10139) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10140) + p.b_expr(0) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISubstr_listContext is an interface to support dynamic dispatch. +type ISubstr_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + FROM() antlr.TerminalNode + FOR() antlr.TerminalNode + SIMILAR() antlr.TerminalNode + ESCAPE() antlr.TerminalNode + Expr_list() IExpr_listContext + + // IsSubstr_listContext differentiates from other interfaces. + IsSubstr_listContext() +} + +type Substr_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySubstr_listContext() *Substr_listContext { + var p = new(Substr_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_substr_list + return p +} + +func InitEmptySubstr_listContext(p *Substr_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_substr_list +} + +func (*Substr_listContext) IsSubstr_listContext() {} + +func NewSubstr_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Substr_listContext { + var p = new(Substr_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_substr_list + + return p +} + +func (s *Substr_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Substr_listContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *Substr_listContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Substr_listContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Substr_listContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Substr_listContext) SIMILAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSIMILAR, 0) +} + +func (s *Substr_listContext) ESCAPE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserESCAPE, 0) +} + +func (s *Substr_listContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Substr_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Substr_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Substr_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSubstr_list(s) + } +} + +func (s *Substr_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSubstr_list(s) + } +} + +func (s *Substr_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSubstr_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Substr_list() (localctx ISubstr_listContext) { + localctx = NewSubstr_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1312, PostgreSQLParserRULE_substr_list) + p.SetState(10169) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 972, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10142) + p.A_expr() + } + { + p.SetState(10143) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10144) + p.A_expr() + } + { + p.SetState(10145) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10146) + p.A_expr() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10148) + p.A_expr() + } + { + p.SetState(10149) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10150) + p.A_expr() + } + { + p.SetState(10151) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10152) + p.A_expr() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10154) + p.A_expr() + } + { + p.SetState(10155) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10156) + p.A_expr() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10158) + p.A_expr() + } + { + p.SetState(10159) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10160) + p.A_expr() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10162) + p.A_expr() + } + { + p.SetState(10163) + p.Match(PostgreSQLParserSIMILAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10164) + p.A_expr() + } + { + p.SetState(10165) + p.Match(PostgreSQLParserESCAPE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10166) + p.A_expr() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10168) + p.Expr_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITrim_listContext is an interface to support dynamic dispatch. +type ITrim_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + FROM() antlr.TerminalNode + Expr_list() IExpr_listContext + + // IsTrim_listContext differentiates from other interfaces. + IsTrim_listContext() +} + +type Trim_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTrim_listContext() *Trim_listContext { + var p = new(Trim_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_trim_list + return p +} + +func InitEmptyTrim_listContext(p *Trim_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_trim_list +} + +func (*Trim_listContext) IsTrim_listContext() {} + +func NewTrim_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Trim_listContext { + var p = new(Trim_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_trim_list + + return p +} + +func (s *Trim_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Trim_listContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Trim_listContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Trim_listContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Trim_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Trim_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Trim_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTrim_list(s) + } +} + +func (s *Trim_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTrim_list(s) + } +} + +func (s *Trim_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTrim_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Trim_list() (localctx ITrim_listContext) { + localctx = NewTrim_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1314, PostgreSQLParserRULE_trim_list) + p.SetState(10178) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 973, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10171) + p.A_expr() + } + { + p.SetState(10172) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10173) + p.Expr_list() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10175) + p.Match(PostgreSQLParserFROM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10176) + p.Expr_list() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10177) + p.Expr_list() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIn_exprContext is an interface to support dynamic dispatch. +type IIn_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + // IsIn_exprContext differentiates from other interfaces. + IsIn_exprContext() +} + +type In_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIn_exprContext() *In_exprContext { + var p = new(In_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_in_expr + return p +} + +func InitEmptyIn_exprContext(p *In_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_in_expr +} + +func (*In_exprContext) IsIn_exprContext() {} + +func NewIn_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *In_exprContext { + var p = new(In_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_in_expr + + return p +} + +func (s *In_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *In_exprContext) CopyAll(ctx *In_exprContext) { + s.CopyFrom(&ctx.BaseParserRuleContext) +} + +func (s *In_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *In_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +type In_expr_listContext struct { + In_exprContext +} + +func NewIn_expr_listContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *In_expr_listContext { + var p = new(In_expr_listContext) + + InitEmptyIn_exprContext(&p.In_exprContext) + p.parser = parser + p.CopyAll(ctx.(*In_exprContext)) + + return p +} + +func (s *In_expr_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *In_expr_listContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *In_expr_listContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *In_expr_listContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *In_expr_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIn_expr_list(s) + } +} + +func (s *In_expr_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIn_expr_list(s) + } +} + +func (s *In_expr_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIn_expr_list(s) + + default: + return t.VisitChildren(s) + } +} + +type In_expr_selectContext struct { + In_exprContext +} + +func NewIn_expr_selectContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *In_expr_selectContext { + var p = new(In_expr_selectContext) + + InitEmptyIn_exprContext(&p.In_exprContext) + p.parser = parser + p.CopyAll(ctx.(*In_exprContext)) + + return p +} + +func (s *In_expr_selectContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *In_expr_selectContext) Select_with_parens() ISelect_with_parensContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_with_parensContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_with_parensContext) +} + +func (s *In_expr_selectContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIn_expr_select(s) + } +} + +func (s *In_expr_selectContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIn_expr_select(s) + } +} + +func (s *In_expr_selectContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIn_expr_select(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) In_expr() (localctx IIn_exprContext) { + localctx = NewIn_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1316, PostgreSQLParserRULE_in_expr) + p.SetState(10185) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 974, p.GetParserRuleContext()) { + case 1: + localctx = NewIn_expr_selectContext(p, localctx) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10180) + p.Select_with_parens() + } + + case 2: + localctx = NewIn_expr_listContext(p, localctx) + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10181) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10182) + p.Expr_list() + } + { + p.SetState(10183) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICase_exprContext is an interface to support dynamic dispatch. +type ICase_exprContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CASE() antlr.TerminalNode + When_clause_list() IWhen_clause_listContext + END_P() antlr.TerminalNode + Case_arg() ICase_argContext + Case_default() ICase_defaultContext + + // IsCase_exprContext differentiates from other interfaces. + IsCase_exprContext() +} + +type Case_exprContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCase_exprContext() *Case_exprContext { + var p = new(Case_exprContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_expr + return p +} + +func InitEmptyCase_exprContext(p *Case_exprContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_expr +} + +func (*Case_exprContext) IsCase_exprContext() {} + +func NewCase_exprContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Case_exprContext { + var p = new(Case_exprContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_case_expr + + return p +} + +func (s *Case_exprContext) GetParser() antlr.Parser { return s.parser } + +func (s *Case_exprContext) CASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASE, 0) +} + +func (s *Case_exprContext) When_clause_list() IWhen_clause_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhen_clause_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhen_clause_listContext) +} + +func (s *Case_exprContext) END_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEND_P, 0) +} + +func (s *Case_exprContext) Case_arg() ICase_argContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICase_argContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICase_argContext) +} + +func (s *Case_exprContext) Case_default() ICase_defaultContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICase_defaultContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICase_defaultContext) +} + +func (s *Case_exprContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Case_exprContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Case_exprContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCase_expr(s) + } +} + +func (s *Case_exprContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCase_expr(s) + } +} + +func (s *Case_exprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCase_expr(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Case_expr() (localctx ICase_exprContext) { + localctx = NewCase_exprContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1318, PostgreSQLParserRULE_case_expr) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10187) + p.Match(PostgreSQLParserCASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10189) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858553860) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073201) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(10188) + p.Case_arg() + } + + } + { + p.SetState(10191) + p.When_clause_list() + } + p.SetState(10193) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserELSE { + { + p.SetState(10192) + p.Case_default() + } + + } + { + p.SetState(10195) + p.Match(PostgreSQLParserEND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWhen_clause_listContext is an interface to support dynamic dispatch. +type IWhen_clause_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllWhen_clause() []IWhen_clauseContext + When_clause(i int) IWhen_clauseContext + + // IsWhen_clause_listContext differentiates from other interfaces. + IsWhen_clause_listContext() +} + +type When_clause_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWhen_clause_listContext() *When_clause_listContext { + var p = new(When_clause_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_when_clause_list + return p +} + +func InitEmptyWhen_clause_listContext(p *When_clause_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_when_clause_list +} + +func (*When_clause_listContext) IsWhen_clause_listContext() {} + +func NewWhen_clause_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *When_clause_listContext { + var p = new(When_clause_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_when_clause_list + + return p +} + +func (s *When_clause_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *When_clause_listContext) AllWhen_clause() []IWhen_clauseContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IWhen_clauseContext); ok { + len++ + } + } + + tst := make([]IWhen_clauseContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IWhen_clauseContext); ok { + tst[i] = t.(IWhen_clauseContext) + i++ + } + } + + return tst +} + +func (s *When_clause_listContext) When_clause(i int) IWhen_clauseContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhen_clauseContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IWhen_clauseContext) +} + +func (s *When_clause_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *When_clause_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *When_clause_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWhen_clause_list(s) + } +} + +func (s *When_clause_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWhen_clause_list(s) + } +} + +func (s *When_clause_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWhen_clause_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) When_clause_list() (localctx IWhen_clause_listContext) { + localctx = NewWhen_clause_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1320, PostgreSQLParserRULE_when_clause_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10198) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == PostgreSQLParserWHEN { + { + p.SetState(10197) + p.When_clause() + } + + p.SetState(10200) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IWhen_clauseContext is an interface to support dynamic dispatch. +type IWhen_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHEN() antlr.TerminalNode + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + THEN() antlr.TerminalNode + + // IsWhen_clauseContext differentiates from other interfaces. + IsWhen_clauseContext() +} + +type When_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWhen_clauseContext() *When_clauseContext { + var p = new(When_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_when_clause + return p +} + +func InitEmptyWhen_clauseContext(p *When_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_when_clause +} + +func (*When_clauseContext) IsWhen_clauseContext() {} + +func NewWhen_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *When_clauseContext { + var p = new(When_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_when_clause + + return p +} + +func (s *When_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *When_clauseContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *When_clauseContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *When_clauseContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *When_clauseContext) THEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, 0) +} + +func (s *When_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *When_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *When_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterWhen_clause(s) + } +} + +func (s *When_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitWhen_clause(s) + } +} + +func (s *When_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitWhen_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) When_clause() (localctx IWhen_clauseContext) { + localctx = NewWhen_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1322, PostgreSQLParserRULE_when_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10202) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10203) + p.A_expr() + } + { + p.SetState(10204) + p.Match(PostgreSQLParserTHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10205) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICase_defaultContext is an interface to support dynamic dispatch. +type ICase_defaultContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ELSE() antlr.TerminalNode + A_expr() IA_exprContext + + // IsCase_defaultContext differentiates from other interfaces. + IsCase_defaultContext() +} + +type Case_defaultContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCase_defaultContext() *Case_defaultContext { + var p = new(Case_defaultContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_default + return p +} + +func InitEmptyCase_defaultContext(p *Case_defaultContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_default +} + +func (*Case_defaultContext) IsCase_defaultContext() {} + +func NewCase_defaultContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Case_defaultContext { + var p = new(Case_defaultContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_case_default + + return p +} + +func (s *Case_defaultContext) GetParser() antlr.Parser { return s.parser } + +func (s *Case_defaultContext) ELSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserELSE, 0) +} + +func (s *Case_defaultContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Case_defaultContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Case_defaultContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Case_defaultContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCase_default(s) + } +} + +func (s *Case_defaultContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCase_default(s) + } +} + +func (s *Case_defaultContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCase_default(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Case_default() (localctx ICase_defaultContext) { + localctx = NewCase_defaultContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1324, PostgreSQLParserRULE_case_default) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10207) + p.Match(PostgreSQLParserELSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10208) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICase_argContext is an interface to support dynamic dispatch. +type ICase_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + + // IsCase_argContext differentiates from other interfaces. + IsCase_argContext() +} + +type Case_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCase_argContext() *Case_argContext { + var p = new(Case_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_arg + return p +} + +func InitEmptyCase_argContext(p *Case_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_arg +} + +func (*Case_argContext) IsCase_argContext() {} + +func NewCase_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Case_argContext { + var p = new(Case_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_case_arg + + return p +} + +func (s *Case_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Case_argContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Case_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Case_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Case_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCase_arg(s) + } +} + +func (s *Case_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCase_arg(s) + } +} + +func (s *Case_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCase_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Case_arg() (localctx ICase_argContext) { + localctx = NewCase_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1326, PostgreSQLParserRULE_case_arg) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10210) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColumnrefContext is an interface to support dynamic dispatch. +type IColumnrefContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Indirection() IIndirectionContext + + // IsColumnrefContext differentiates from other interfaces. + IsColumnrefContext() +} + +type ColumnrefContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColumnrefContext() *ColumnrefContext { + var p = new(ColumnrefContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnref + return p +} + +func InitEmptyColumnrefContext(p *ColumnrefContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_columnref +} + +func (*ColumnrefContext) IsColumnrefContext() {} + +func NewColumnrefContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColumnrefContext { + var p = new(ColumnrefContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_columnref + + return p +} + +func (s *ColumnrefContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColumnrefContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *ColumnrefContext) Indirection() IIndirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndirectionContext) +} + +func (s *ColumnrefContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColumnrefContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColumnrefContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColumnref(s) + } +} + +func (s *ColumnrefContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColumnref(s) + } +} + +func (s *ColumnrefContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColumnref(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Columnref() (localctx IColumnrefContext) { + localctx = NewColumnrefContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1328, PostgreSQLParserRULE_columnref) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10212) + p.Colid() + } + p.SetState(10214) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 978, p.GetParserRuleContext()) == 1 { + { + p.SetState(10213) + p.Indirection() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIndirection_elContext is an interface to support dynamic dispatch. +type IIndirection_elContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DOT() antlr.TerminalNode + Attr_name() IAttr_nameContext + STAR() antlr.TerminalNode + OPEN_BRACKET() antlr.TerminalNode + CLOSE_BRACKET() antlr.TerminalNode + A_expr() IA_exprContext + COLON() antlr.TerminalNode + AllOpt_slice_bound() []IOpt_slice_boundContext + Opt_slice_bound(i int) IOpt_slice_boundContext + + // IsIndirection_elContext differentiates from other interfaces. + IsIndirection_elContext() +} + +type Indirection_elContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIndirection_elContext() *Indirection_elContext { + var p = new(Indirection_elContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_indirection_el + return p +} + +func InitEmptyIndirection_elContext(p *Indirection_elContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_indirection_el +} + +func (*Indirection_elContext) IsIndirection_elContext() {} + +func NewIndirection_elContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Indirection_elContext { + var p = new(Indirection_elContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_indirection_el + + return p +} + +func (s *Indirection_elContext) GetParser() antlr.Parser { return s.parser } + +func (s *Indirection_elContext) DOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOT, 0) +} + +func (s *Indirection_elContext) Attr_name() IAttr_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAttr_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAttr_nameContext) +} + +func (s *Indirection_elContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *Indirection_elContext) OPEN_BRACKET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_BRACKET, 0) +} + +func (s *Indirection_elContext) CLOSE_BRACKET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_BRACKET, 0) +} + +func (s *Indirection_elContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Indirection_elContext) COLON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLON, 0) +} + +func (s *Indirection_elContext) AllOpt_slice_bound() []IOpt_slice_boundContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOpt_slice_boundContext); ok { + len++ + } + } + + tst := make([]IOpt_slice_boundContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOpt_slice_boundContext); ok { + tst[i] = t.(IOpt_slice_boundContext) + i++ + } + } + + return tst +} + +func (s *Indirection_elContext) Opt_slice_bound(i int) IOpt_slice_boundContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_slice_boundContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOpt_slice_boundContext) +} + +func (s *Indirection_elContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Indirection_elContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Indirection_elContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIndirection_el(s) + } +} + +func (s *Indirection_elContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIndirection_el(s) + } +} + +func (s *Indirection_elContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIndirection_el(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Indirection_el() (localctx IIndirection_elContext) { + localctx = NewIndirection_elContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1330, PostgreSQLParserRULE_indirection_el) + var _la int + + p.SetState(10233) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserDOT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10216) + p.Match(PostgreSQLParserDOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10219) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserALL, PostgreSQLParserANALYSE, PostgreSQLParserANALYZE, PostgreSQLParserAND, PostgreSQLParserANY, PostgreSQLParserARRAY, PostgreSQLParserAS, PostgreSQLParserASC, PostgreSQLParserASYMMETRIC, PostgreSQLParserBOTH, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCHECK, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCREATE, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDEFERRABLE, PostgreSQLParserDESC, PostgreSQLParserDISTINCT, PostgreSQLParserDO, PostgreSQLParserELSE, PostgreSQLParserEXCEPT, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserFOR, PostgreSQLParserFOREIGN, PostgreSQLParserFROM, PostgreSQLParserGRANT, PostgreSQLParserGROUP_P, PostgreSQLParserHAVING, PostgreSQLParserIN_P, PostgreSQLParserINITIALLY, PostgreSQLParserINTERSECT, PostgreSQLParserLATERAL_P, PostgreSQLParserLEADING, PostgreSQLParserLIMIT, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNOT, PostgreSQLParserNULL_P, PostgreSQLParserOFFSET, PostgreSQLParserON, PostgreSQLParserONLY, PostgreSQLParserOR, PostgreSQLParserORDER, PostgreSQLParserPLACING, PostgreSQLParserPRIMARY, PostgreSQLParserREFERENCES, PostgreSQLParserRETURNING, PostgreSQLParserSELECT, PostgreSQLParserSESSION_USER, PostgreSQLParserSOME, PostgreSQLParserSYMMETRIC, PostgreSQLParserTABLE, PostgreSQLParserTHEN, PostgreSQLParserTO, PostgreSQLParserTRAILING, PostgreSQLParserTRUE_P, PostgreSQLParserUNION, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserUSING, PostgreSQLParserVARIADIC, PostgreSQLParserWHEN, PostgreSQLParserWHERE, PostgreSQLParserWINDOW, PostgreSQLParserWITH, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserEND_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(10217) + p.Attr_name() + } + + case PostgreSQLParserSTAR: + { + p.SetState(10218) + p.Match(PostgreSQLParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case PostgreSQLParserOPEN_BRACKET: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10221) + p.Match(PostgreSQLParserOPEN_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10230) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 982, p.GetParserRuleContext()) { + case 1: + { + p.SetState(10222) + p.A_expr() + } + + case 2: + p.SetState(10224) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858553860) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073201) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(10223) + p.Opt_slice_bound() + } + + } + { + p.SetState(10226) + p.Match(PostgreSQLParserCOLON) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10228) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858553860) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073201) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(10227) + p.Opt_slice_bound() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(10232) + p.Match(PostgreSQLParserCLOSE_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_slice_boundContext is an interface to support dynamic dispatch. +type IOpt_slice_boundContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + + // IsOpt_slice_boundContext differentiates from other interfaces. + IsOpt_slice_boundContext() +} + +type Opt_slice_boundContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_slice_boundContext() *Opt_slice_boundContext { + var p = new(Opt_slice_boundContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_slice_bound + return p +} + +func InitEmptyOpt_slice_boundContext(p *Opt_slice_boundContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_slice_bound +} + +func (*Opt_slice_boundContext) IsOpt_slice_boundContext() {} + +func NewOpt_slice_boundContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_slice_boundContext { + var p = new(Opt_slice_boundContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_slice_bound + + return p +} + +func (s *Opt_slice_boundContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_slice_boundContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_slice_boundContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_slice_boundContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_slice_boundContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_slice_bound(s) + } +} + +func (s *Opt_slice_boundContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_slice_bound(s) + } +} + +func (s *Opt_slice_boundContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_slice_bound(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_slice_bound() (localctx IOpt_slice_boundContext) { + localctx = NewOpt_slice_boundContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1332, PostgreSQLParserRULE_opt_slice_bound) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10235) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIndirectionContext is an interface to support dynamic dispatch. +type IIndirectionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIndirection_el() []IIndirection_elContext + Indirection_el(i int) IIndirection_elContext + + // IsIndirectionContext differentiates from other interfaces. + IsIndirectionContext() +} + +type IndirectionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIndirectionContext() *IndirectionContext { + var p = new(IndirectionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_indirection + return p +} + +func InitEmptyIndirectionContext(p *IndirectionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_indirection +} + +func (*IndirectionContext) IsIndirectionContext() {} + +func NewIndirectionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IndirectionContext { + var p = new(IndirectionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_indirection + + return p +} + +func (s *IndirectionContext) GetParser() antlr.Parser { return s.parser } + +func (s *IndirectionContext) AllIndirection_el() []IIndirection_elContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIndirection_elContext); ok { + len++ + } + } + + tst := make([]IIndirection_elContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIndirection_elContext); ok { + tst[i] = t.(IIndirection_elContext) + i++ + } + } + + return tst +} + +func (s *IndirectionContext) Indirection_el(i int) IIndirection_elContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndirection_elContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIndirection_elContext) +} + +func (s *IndirectionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *IndirectionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *IndirectionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIndirection(s) + } +} + +func (s *IndirectionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIndirection(s) + } +} + +func (s *IndirectionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIndirection(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Indirection() (localctx IIndirectionContext) { + localctx = NewIndirectionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1334, PostgreSQLParserRULE_indirection) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10238) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(10237) + p.Indirection_el() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(10240) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 984, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_indirectionContext is an interface to support dynamic dispatch. +type IOpt_indirectionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIndirection_el() []IIndirection_elContext + Indirection_el(i int) IIndirection_elContext + + // IsOpt_indirectionContext differentiates from other interfaces. + IsOpt_indirectionContext() +} + +type Opt_indirectionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_indirectionContext() *Opt_indirectionContext { + var p = new(Opt_indirectionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_indirection + return p +} + +func InitEmptyOpt_indirectionContext(p *Opt_indirectionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_indirection +} + +func (*Opt_indirectionContext) IsOpt_indirectionContext() {} + +func NewOpt_indirectionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_indirectionContext { + var p = new(Opt_indirectionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_indirection + + return p +} + +func (s *Opt_indirectionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_indirectionContext) AllIndirection_el() []IIndirection_elContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IIndirection_elContext); ok { + len++ + } + } + + tst := make([]IIndirection_elContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IIndirection_elContext); ok { + tst[i] = t.(IIndirection_elContext) + i++ + } + } + + return tst +} + +func (s *Opt_indirectionContext) Indirection_el(i int) IIndirection_elContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndirection_elContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IIndirection_elContext) +} + +func (s *Opt_indirectionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_indirectionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_indirectionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_indirection(s) + } +} + +func (s *Opt_indirectionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_indirection(s) + } +} + +func (s *Opt_indirectionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_indirection(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_indirection() (localctx IOpt_indirectionContext) { + localctx = NewOpt_indirectionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1336, PostgreSQLParserRULE_opt_indirection) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10245) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 985, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(10242) + p.Indirection_el() + } + + } + p.SetState(10247) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 985, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_target_listContext is an interface to support dynamic dispatch. +type IOpt_target_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Target_list() ITarget_listContext + + // IsOpt_target_listContext differentiates from other interfaces. + IsOpt_target_listContext() +} + +type Opt_target_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_target_listContext() *Opt_target_listContext { + var p = new(Opt_target_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_target_list + return p +} + +func InitEmptyOpt_target_listContext(p *Opt_target_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_target_list +} + +func (*Opt_target_listContext) IsOpt_target_listContext() {} + +func NewOpt_target_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_target_listContext { + var p = new(Opt_target_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_target_list + + return p +} + +func (s *Opt_target_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_target_listContext) Target_list() ITarget_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITarget_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITarget_listContext) +} + +func (s *Opt_target_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_target_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_target_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_target_list(s) + } +} + +func (s *Opt_target_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_target_list(s) + } +} + +func (s *Opt_target_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_target_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_target_list() (localctx IOpt_target_listContext) { + localctx = NewOpt_target_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1338, PostgreSQLParserRULE_opt_target_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10248) + p.Target_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITarget_listContext is an interface to support dynamic dispatch. +type ITarget_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllTarget_el() []ITarget_elContext + Target_el(i int) ITarget_elContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsTarget_listContext differentiates from other interfaces. + IsTarget_listContext() +} + +type Target_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTarget_listContext() *Target_listContext { + var p = new(Target_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_target_list + return p +} + +func InitEmptyTarget_listContext(p *Target_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_target_list +} + +func (*Target_listContext) IsTarget_listContext() {} + +func NewTarget_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Target_listContext { + var p = new(Target_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_target_list + + return p +} + +func (s *Target_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Target_listContext) AllTarget_el() []ITarget_elContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ITarget_elContext); ok { + len++ + } + } + + tst := make([]ITarget_elContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ITarget_elContext); ok { + tst[i] = t.(ITarget_elContext) + i++ + } + } + + return tst +} + +func (s *Target_listContext) Target_el(i int) ITarget_elContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITarget_elContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ITarget_elContext) +} + +func (s *Target_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Target_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Target_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Target_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Target_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTarget_list(s) + } +} + +func (s *Target_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTarget_list(s) + } +} + +func (s *Target_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTarget_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Target_list() (localctx ITarget_listContext) { + localctx = NewTarget_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1340, PostgreSQLParserRULE_target_list) + var _alt int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10250) + p.Target_el() + } + p.SetState(10255) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 986, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(10251) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10252) + p.Target_el() + } + + } + p.SetState(10257) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 986, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITarget_elContext is an interface to support dynamic dispatch. +type ITarget_elContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + // IsTarget_elContext differentiates from other interfaces. + IsTarget_elContext() +} + +type Target_elContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTarget_elContext() *Target_elContext { + var p = new(Target_elContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_target_el + return p +} + +func InitEmptyTarget_elContext(p *Target_elContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_target_el +} + +func (*Target_elContext) IsTarget_elContext() {} + +func NewTarget_elContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Target_elContext { + var p = new(Target_elContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_target_el + + return p +} + +func (s *Target_elContext) GetParser() antlr.Parser { return s.parser } + +func (s *Target_elContext) CopyAll(ctx *Target_elContext) { + s.CopyFrom(&ctx.BaseParserRuleContext) +} + +func (s *Target_elContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Target_elContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +type Target_labelContext struct { + Target_elContext +} + +func NewTarget_labelContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Target_labelContext { + var p = new(Target_labelContext) + + InitEmptyTarget_elContext(&p.Target_elContext) + p.parser = parser + p.CopyAll(ctx.(*Target_elContext)) + + return p +} + +func (s *Target_labelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Target_labelContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Target_labelContext) Target_alias() ITarget_aliasContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITarget_aliasContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITarget_aliasContext) +} + +func (s *Target_labelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTarget_label(s) + } +} + +func (s *Target_labelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTarget_label(s) + } +} + +func (s *Target_labelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTarget_label(s) + + default: + return t.VisitChildren(s) + } +} + +type Target_starContext struct { + Target_elContext +} + +func NewTarget_starContext(parser antlr.Parser, ctx antlr.ParserRuleContext) *Target_starContext { + var p = new(Target_starContext) + + InitEmptyTarget_elContext(&p.Target_elContext) + p.parser = parser + p.CopyAll(ctx.(*Target_elContext)) + + return p +} + +func (s *Target_starContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Target_starContext) STAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTAR, 0) +} + +func (s *Target_starContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTarget_star(s) + } +} + +func (s *Target_starContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTarget_star(s) + } +} + +func (s *Target_starContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTarget_star(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Target_el() (localctx ITarget_elContext) { + localctx = NewTarget_elContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1342, PostgreSQLParserRULE_target_el) + p.SetState(10263) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN, PostgreSQLParserPLUS, PostgreSQLParserMINUS, PostgreSQLParserPARAM, PostgreSQLParserOperator, PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCASE, PostgreSQLParserCAST, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserCURRENT_CATALOG, PostgreSQLParserCURRENT_DATE, PostgreSQLParserCURRENT_ROLE, PostgreSQLParserCURRENT_TIME, PostgreSQLParserCURRENT_TIMESTAMP, PostgreSQLParserCURRENT_USER, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFALSE_P, PostgreSQLParserFETCH, PostgreSQLParserLOCALTIME, PostgreSQLParserLOCALTIMESTAMP, PostgreSQLParserNOT, PostgreSQLParserNULL_P, PostgreSQLParserSESSION_USER, PostgreSQLParserTABLE, PostgreSQLParserTRUE_P, PostgreSQLParserUNIQUE, PostgreSQLParserUSER, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLEFT, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserRIGHT, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserBinaryStringConstant, PostgreSQLParserHexadecimalStringConstant, PostgreSQLParserIntegral, PostgreSQLParserNumeric, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER, PostgreSQLParserEscapeStringConstant: + localctx = NewTarget_labelContext(p, localctx) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10258) + p.A_expr() + } + p.SetState(10260) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 987, p.GetParserRuleContext()) == 1 { + { + p.SetState(10259) + p.Target_alias() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserSTAR: + localctx = NewTarget_starContext(p, localctx) + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10262) + p.Match(PostgreSQLParserSTAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITarget_aliasContext is an interface to support dynamic dispatch. +type ITarget_aliasContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AS() antlr.TerminalNode + Collabel() ICollabelContext + Identifier() IIdentifierContext + + // IsTarget_aliasContext differentiates from other interfaces. + IsTarget_aliasContext() +} + +type Target_aliasContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTarget_aliasContext() *Target_aliasContext { + var p = new(Target_aliasContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_target_alias + return p +} + +func InitEmptyTarget_aliasContext(p *Target_aliasContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_target_alias +} + +func (*Target_aliasContext) IsTarget_aliasContext() {} + +func NewTarget_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Target_aliasContext { + var p = new(Target_aliasContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_target_alias + + return p +} + +func (s *Target_aliasContext) GetParser() antlr.Parser { return s.parser } + +func (s *Target_aliasContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Target_aliasContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Target_aliasContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Target_aliasContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Target_aliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Target_aliasContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTarget_alias(s) + } +} + +func (s *Target_aliasContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTarget_alias(s) + } +} + +func (s *Target_aliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTarget_alias(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Target_alias() (localctx ITarget_aliasContext) { + localctx = NewTarget_aliasContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1344, PostgreSQLParserRULE_target_alias) + p.SetState(10268) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10265) + p.Match(PostgreSQLParserAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10266) + p.Collabel() + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserOUTER_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserBACKWARD, PostgreSQLParserCHAIN, PostgreSQLParserCLOSE, PostgreSQLParserCOMMIT, PostgreSQLParserCONTINUE_P, PostgreSQLParserCURSOR, PostgreSQLParserFIRST_P, PostgreSQLParserFORWARD, PostgreSQLParserINSERT, PostgreSQLParserLAST_P, PostgreSQLParserMOVE, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserOPTION, PostgreSQLParserPRIOR, PostgreSQLParserRELATIVE_P, PostgreSQLParserRESET, PostgreSQLParserROLLBACK, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSET, PostgreSQLParserTYPE_P, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserROWTYPE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10267) + p.Identifier() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IQualified_name_listContext is an interface to support dynamic dispatch. +type IQualified_name_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllQualified_name() []IQualified_nameContext + Qualified_name(i int) IQualified_nameContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsQualified_name_listContext differentiates from other interfaces. + IsQualified_name_listContext() +} + +type Qualified_name_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyQualified_name_listContext() *Qualified_name_listContext { + var p = new(Qualified_name_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_qualified_name_list + return p +} + +func InitEmptyQualified_name_listContext(p *Qualified_name_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_qualified_name_list +} + +func (*Qualified_name_listContext) IsQualified_name_listContext() {} + +func NewQualified_name_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Qualified_name_listContext { + var p = new(Qualified_name_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_qualified_name_list + + return p +} + +func (s *Qualified_name_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Qualified_name_listContext) AllQualified_name() []IQualified_nameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IQualified_nameContext); ok { + len++ + } + } + + tst := make([]IQualified_nameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IQualified_nameContext); ok { + tst[i] = t.(IQualified_nameContext) + i++ + } + } + + return tst +} + +func (s *Qualified_name_listContext) Qualified_name(i int) IQualified_nameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IQualified_nameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IQualified_nameContext) +} + +func (s *Qualified_name_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Qualified_name_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Qualified_name_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Qualified_name_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Qualified_name_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterQualified_name_list(s) + } +} + +func (s *Qualified_name_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitQualified_name_list(s) + } +} + +func (s *Qualified_name_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitQualified_name_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Qualified_name_list() (localctx IQualified_name_listContext) { + localctx = NewQualified_name_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1346, PostgreSQLParserRULE_qualified_name_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10270) + p.Qualified_name() + } + p.SetState(10275) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10271) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10272) + p.Qualified_name() + } + + p.SetState(10277) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IQualified_nameContext is an interface to support dynamic dispatch. +type IQualified_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Indirection() IIndirectionContext + + // IsQualified_nameContext differentiates from other interfaces. + IsQualified_nameContext() +} + +type Qualified_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyQualified_nameContext() *Qualified_nameContext { + var p = new(Qualified_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_qualified_name + return p +} + +func InitEmptyQualified_nameContext(p *Qualified_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_qualified_name +} + +func (*Qualified_nameContext) IsQualified_nameContext() {} + +func NewQualified_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Qualified_nameContext { + var p = new(Qualified_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_qualified_name + + return p +} + +func (s *Qualified_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Qualified_nameContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Qualified_nameContext) Indirection() IIndirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndirectionContext) +} + +func (s *Qualified_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Qualified_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Qualified_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterQualified_name(s) + } +} + +func (s *Qualified_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitQualified_name(s) + } +} + +func (s *Qualified_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitQualified_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Qualified_name() (localctx IQualified_nameContext) { + localctx = NewQualified_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1348, PostgreSQLParserRULE_qualified_name) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10278) + p.Colid() + } + p.SetState(10280) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_BRACKET || _la == PostgreSQLParserDOT { + { + p.SetState(10279) + p.Indirection() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IName_listContext is an interface to support dynamic dispatch. +type IName_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllName() []INameContext + Name(i int) INameContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsName_listContext differentiates from other interfaces. + IsName_listContext() +} + +type Name_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyName_listContext() *Name_listContext { + var p = new(Name_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_name_list + return p +} + +func InitEmptyName_listContext(p *Name_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_name_list +} + +func (*Name_listContext) IsName_listContext() {} + +func NewName_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Name_listContext { + var p = new(Name_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_name_list + + return p +} + +func (s *Name_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Name_listContext) AllName() []INameContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(INameContext); ok { + len++ + } + } + + tst := make([]INameContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(INameContext); ok { + tst[i] = t.(INameContext) + i++ + } + } + + return tst +} + +func (s *Name_listContext) Name(i int) INameContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INameContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(INameContext) +} + +func (s *Name_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Name_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Name_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Name_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Name_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterName_list(s) + } +} + +func (s *Name_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitName_list(s) + } +} + +func (s *Name_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitName_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Name_list() (localctx IName_listContext) { + localctx = NewName_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1350, PostgreSQLParserRULE_name_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10282) + p.Name() + } + p.SetState(10287) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10283) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10284) + p.Name() + } + + p.SetState(10289) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INameContext is an interface to support dynamic dispatch. +type INameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + + // IsNameContext differentiates from other interfaces. + IsNameContext() +} + +type NameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNameContext() *NameContext { + var p = new(NameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_name + return p +} + +func InitEmptyNameContext(p *NameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_name +} + +func (*NameContext) IsNameContext() {} + +func NewNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NameContext { + var p = new(NameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_name + + return p +} + +func (s *NameContext) GetParser() antlr.Parser { return s.parser } + +func (s *NameContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *NameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *NameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *NameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterName(s) + } +} + +func (s *NameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitName(s) + } +} + +func (s *NameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitName(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Name() (localctx INameContext) { + localctx = NewNameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1352, PostgreSQLParserRULE_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10290) + p.Colid() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAttr_nameContext is an interface to support dynamic dispatch. +type IAttr_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Collabel() ICollabelContext + + // IsAttr_nameContext differentiates from other interfaces. + IsAttr_nameContext() +} + +type Attr_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAttr_nameContext() *Attr_nameContext { + var p = new(Attr_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_attr_name + return p +} + +func InitEmptyAttr_nameContext(p *Attr_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_attr_name +} + +func (*Attr_nameContext) IsAttr_nameContext() {} + +func NewAttr_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Attr_nameContext { + var p = new(Attr_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_attr_name + + return p +} + +func (s *Attr_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Attr_nameContext) Collabel() ICollabelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICollabelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICollabelContext) +} + +func (s *Attr_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Attr_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Attr_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAttr_name(s) + } +} + +func (s *Attr_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAttr_name(s) + } +} + +func (s *Attr_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAttr_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Attr_name() (localctx IAttr_nameContext) { + localctx = NewAttr_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1354, PostgreSQLParserRULE_attr_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10292) + p.Collabel() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFile_nameContext is an interface to support dynamic dispatch. +type IFile_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + + // IsFile_nameContext differentiates from other interfaces. + IsFile_nameContext() +} + +type File_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFile_nameContext() *File_nameContext { + var p = new(File_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_file_name + return p +} + +func InitEmptyFile_nameContext(p *File_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_file_name +} + +func (*File_nameContext) IsFile_nameContext() {} + +func NewFile_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *File_nameContext { + var p = new(File_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_file_name + + return p +} + +func (s *File_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *File_nameContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *File_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *File_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *File_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFile_name(s) + } +} + +func (s *File_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFile_name(s) + } +} + +func (s *File_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFile_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) File_name() (localctx IFile_nameContext) { + localctx = NewFile_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1356, PostgreSQLParserRULE_file_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10294) + p.Sconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFunc_nameContext is an interface to support dynamic dispatch. +type IFunc_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Builtin_function_name() IBuiltin_function_nameContext + Type_function_name() IType_function_nameContext + Colid() IColidContext + Indirection() IIndirectionContext + LEFT() antlr.TerminalNode + RIGHT() antlr.TerminalNode + + // IsFunc_nameContext differentiates from other interfaces. + IsFunc_nameContext() +} + +type Func_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFunc_nameContext() *Func_nameContext { + var p = new(Func_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_name + return p +} + +func InitEmptyFunc_nameContext(p *Func_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_func_name +} + +func (*Func_nameContext) IsFunc_nameContext() {} + +func NewFunc_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Func_nameContext { + var p = new(Func_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_func_name + + return p +} + +func (s *Func_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Func_nameContext) Builtin_function_name() IBuiltin_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBuiltin_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBuiltin_function_nameContext) +} + +func (s *Func_nameContext) Type_function_name() IType_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_function_nameContext) +} + +func (s *Func_nameContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Func_nameContext) Indirection() IIndirectionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIndirectionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIndirectionContext) +} + +func (s *Func_nameContext) LEFT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEFT, 0) +} + +func (s *Func_nameContext) RIGHT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRIGHT, 0) +} + +func (s *Func_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Func_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Func_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFunc_name(s) + } +} + +func (s *Func_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFunc_name(s) + } +} + +func (s *Func_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFunc_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Func_name() (localctx IFunc_nameContext) { + localctx = NewFunc_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1358, PostgreSQLParserRULE_func_name) + p.SetState(10303) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 993, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10296) + p.Builtin_function_name() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10297) + p.Type_function_name() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10298) + p.Colid() + } + { + p.SetState(10299) + p.Indirection() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10301) + p.Match(PostgreSQLParserLEFT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10302) + p.Match(PostgreSQLParserRIGHT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAexprconstContext is an interface to support dynamic dispatch. +type IAexprconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Iconst() IIconstContext + Fconst() IFconstContext + Sconst() ISconstContext + Bconst() IBconstContext + Xconst() IXconstContext + Func_name() IFunc_nameContext + OPEN_PAREN() antlr.TerminalNode + Func_arg_list() IFunc_arg_listContext + CLOSE_PAREN() antlr.TerminalNode + Opt_sort_clause() IOpt_sort_clauseContext + Consttypename() IConsttypenameContext + Constinterval() IConstintervalContext + Opt_interval() IOpt_intervalContext + TRUE_P() antlr.TerminalNode + FALSE_P() antlr.TerminalNode + NULL_P() antlr.TerminalNode + + // IsAexprconstContext differentiates from other interfaces. + IsAexprconstContext() +} + +type AexprconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAexprconstContext() *AexprconstContext { + var p = new(AexprconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aexprconst + return p +} + +func InitEmptyAexprconstContext(p *AexprconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_aexprconst +} + +func (*AexprconstContext) IsAexprconstContext() {} + +func NewAexprconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AexprconstContext { + var p = new(AexprconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_aexprconst + + return p +} + +func (s *AexprconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *AexprconstContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *AexprconstContext) Fconst() IFconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFconstContext) +} + +func (s *AexprconstContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *AexprconstContext) Bconst() IBconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBconstContext) +} + +func (s *AexprconstContext) Xconst() IXconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IXconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IXconstContext) +} + +func (s *AexprconstContext) Func_name() IFunc_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_nameContext) +} + +func (s *AexprconstContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *AexprconstContext) Func_arg_list() IFunc_arg_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFunc_arg_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFunc_arg_listContext) +} + +func (s *AexprconstContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *AexprconstContext) Opt_sort_clause() IOpt_sort_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_sort_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_sort_clauseContext) +} + +func (s *AexprconstContext) Consttypename() IConsttypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConsttypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConsttypenameContext) +} + +func (s *AexprconstContext) Constinterval() IConstintervalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstintervalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstintervalContext) +} + +func (s *AexprconstContext) Opt_interval() IOpt_intervalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_intervalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_intervalContext) +} + +func (s *AexprconstContext) TRUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUE_P, 0) +} + +func (s *AexprconstContext) FALSE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFALSE_P, 0) +} + +func (s *AexprconstContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *AexprconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AexprconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AexprconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAexprconst(s) + } +} + +func (s *AexprconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAexprconst(s) + } +} + +func (s *AexprconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAexprconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Aexprconst() (localctx IAexprconstContext) { + localctx = NewAexprconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1360, PostgreSQLParserRULE_aexprconst) + var _la int + + p.SetState(10340) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 998, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10305) + p.Iconst() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10306) + p.Fconst() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10307) + p.Sconst() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10308) + p.Bconst() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10309) + p.Xconst() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10310) + p.Func_name() + } + p.SetState(10320) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + { + p.SetState(10311) + p.Sconst() + } + + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(10312) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10313) + p.Func_arg_list() + } + p.SetState(10315) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserORDER { + { + p.SetState(10314) + p.Opt_sort_clause() + } + + } + { + p.SetState(10317) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10318) + p.Sconst() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(10322) + p.Consttypename() + } + { + p.SetState(10323) + p.Sconst() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(10325) + p.Constinterval() + } + p.SetState(10335) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant, PostgreSQLParserUnicodeEscapeStringConstant, PostgreSQLParserBeginDollarStringConstant, PostgreSQLParserEscapeStringConstant: + { + p.SetState(10326) + p.Sconst() + } + p.SetState(10328) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 996, p.GetParserRuleContext()) == 1 { + { + p.SetState(10327) + p.Opt_interval() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserOPEN_PAREN: + { + p.SetState(10330) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10331) + p.Iconst() + } + { + p.SetState(10332) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10333) + p.Sconst() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(10337) + p.Match(PostgreSQLParserTRUE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(10338) + p.Match(PostgreSQLParserFALSE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(10339) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IXconstContext is an interface to support dynamic dispatch. +type IXconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + HexadecimalStringConstant() antlr.TerminalNode + + // IsXconstContext differentiates from other interfaces. + IsXconstContext() +} + +type XconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyXconstContext() *XconstContext { + var p = new(XconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xconst + return p +} + +func InitEmptyXconstContext(p *XconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_xconst +} + +func (*XconstContext) IsXconstContext() {} + +func NewXconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *XconstContext { + var p = new(XconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_xconst + + return p +} + +func (s *XconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *XconstContext) HexadecimalStringConstant() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHexadecimalStringConstant, 0) +} + +func (s *XconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *XconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *XconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterXconst(s) + } +} + +func (s *XconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitXconst(s) + } +} + +func (s *XconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitXconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Xconst() (localctx IXconstContext) { + localctx = NewXconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1362, PostgreSQLParserRULE_xconst) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10342) + p.Match(PostgreSQLParserHexadecimalStringConstant) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IBconstContext is an interface to support dynamic dispatch. +type IBconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BinaryStringConstant() antlr.TerminalNode + + // IsBconstContext differentiates from other interfaces. + IsBconstContext() +} + +type BconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBconstContext() *BconstContext { + var p = new(BconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_bconst + return p +} + +func InitEmptyBconstContext(p *BconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_bconst +} + +func (*BconstContext) IsBconstContext() {} + +func NewBconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BconstContext { + var p = new(BconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_bconst + + return p +} + +func (s *BconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *BconstContext) BinaryStringConstant() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBinaryStringConstant, 0) +} + +func (s *BconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *BconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *BconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterBconst(s) + } +} + +func (s *BconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitBconst(s) + } +} + +func (s *BconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitBconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Bconst() (localctx IBconstContext) { + localctx = NewBconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1364, PostgreSQLParserRULE_bconst) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10344) + p.Match(PostgreSQLParserBinaryStringConstant) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFconstContext is an interface to support dynamic dispatch. +type IFconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Numeric() antlr.TerminalNode + + // IsFconstContext differentiates from other interfaces. + IsFconstContext() +} + +type FconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFconstContext() *FconstContext { + var p = new(FconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fconst + return p +} + +func InitEmptyFconstContext(p *FconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_fconst +} + +func (*FconstContext) IsFconstContext() {} + +func NewFconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FconstContext { + var p = new(FconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_fconst + + return p +} + +func (s *FconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *FconstContext) Numeric() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNumeric, 0) +} + +func (s *FconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *FconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *FconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFconst(s) + } +} + +func (s *FconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFconst(s) + } +} + +func (s *FconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Fconst() (localctx IFconstContext) { + localctx = NewFconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1366, PostgreSQLParserRULE_fconst) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10346) + p.Match(PostgreSQLParserNumeric) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIconstContext is an interface to support dynamic dispatch. +type IIconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Integral() antlr.TerminalNode + + // IsIconstContext differentiates from other interfaces. + IsIconstContext() +} + +type IconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIconstContext() *IconstContext { + var p = new(IconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_iconst + return p +} + +func InitEmptyIconstContext(p *IconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_iconst +} + +func (*IconstContext) IsIconstContext() {} + +func NewIconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IconstContext { + var p = new(IconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_iconst + + return p +} + +func (s *IconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *IconstContext) Integral() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIntegral, 0) +} + +func (s *IconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *IconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *IconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIconst(s) + } +} + +func (s *IconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIconst(s) + } +} + +func (s *IconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Iconst() (localctx IIconstContext) { + localctx = NewIconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1368, PostgreSQLParserRULE_iconst) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10348) + p.Match(PostgreSQLParserIntegral) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISconstContext is an interface to support dynamic dispatch. +type ISconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Anysconst() IAnysconstContext + Opt_uescape() IOpt_uescapeContext + + // IsSconstContext differentiates from other interfaces. + IsSconstContext() +} + +type SconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySconstContext() *SconstContext { + var p = new(SconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sconst + return p +} + +func InitEmptySconstContext(p *SconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sconst +} + +func (*SconstContext) IsSconstContext() {} + +func NewSconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SconstContext { + var p = new(SconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_sconst + + return p +} + +func (s *SconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *SconstContext) Anysconst() IAnysconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAnysconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAnysconstContext) +} + +func (s *SconstContext) Opt_uescape() IOpt_uescapeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_uescapeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_uescapeContext) +} + +func (s *SconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSconst(s) + } +} + +func (s *SconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSconst(s) + } +} + +func (s *SconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Sconst() (localctx ISconstContext) { + localctx = NewSconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1370, PostgreSQLParserRULE_sconst) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10350) + p.Anysconst() + } + p.SetState(10352) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 999, p.GetParserRuleContext()) == 1 { + { + p.SetState(10351) + p.Opt_uescape() + } + + } else if p.HasError() { // JIM + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAnysconstContext is an interface to support dynamic dispatch. +type IAnysconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + StringConstant() antlr.TerminalNode + UnicodeEscapeStringConstant() antlr.TerminalNode + BeginDollarStringConstant() antlr.TerminalNode + EndDollarStringConstant() antlr.TerminalNode + AllDollarText() []antlr.TerminalNode + DollarText(i int) antlr.TerminalNode + EscapeStringConstant() antlr.TerminalNode + + // IsAnysconstContext differentiates from other interfaces. + IsAnysconstContext() +} + +type AnysconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAnysconstContext() *AnysconstContext { + var p = new(AnysconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_anysconst + return p +} + +func InitEmptyAnysconstContext(p *AnysconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_anysconst +} + +func (*AnysconstContext) IsAnysconstContext() {} + +func NewAnysconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnysconstContext { + var p = new(AnysconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_anysconst + + return p +} + +func (s *AnysconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *AnysconstContext) StringConstant() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserStringConstant, 0) +} + +func (s *AnysconstContext) UnicodeEscapeStringConstant() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUnicodeEscapeStringConstant, 0) +} + +func (s *AnysconstContext) BeginDollarStringConstant() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBeginDollarStringConstant, 0) +} + +func (s *AnysconstContext) EndDollarStringConstant() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEndDollarStringConstant, 0) +} + +func (s *AnysconstContext) AllDollarText() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserDollarText) +} + +func (s *AnysconstContext) DollarText(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDollarText, i) +} + +func (s *AnysconstContext) EscapeStringConstant() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEscapeStringConstant, 0) +} + +func (s *AnysconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *AnysconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *AnysconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAnysconst(s) + } +} + +func (s *AnysconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAnysconst(s) + } +} + +func (s *AnysconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAnysconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Anysconst() (localctx IAnysconstContext) { + localctx = NewAnysconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1372, PostgreSQLParserRULE_anysconst) + var _la int + + p.SetState(10365) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserStringConstant: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10354) + p.Match(PostgreSQLParserStringConstant) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserUnicodeEscapeStringConstant: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10355) + p.Match(PostgreSQLParserUnicodeEscapeStringConstant) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserBeginDollarStringConstant: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10356) + p.Match(PostgreSQLParserBeginDollarStringConstant) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10360) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserDollarText { + { + p.SetState(10357) + p.Match(PostgreSQLParserDollarText) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + p.SetState(10362) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(10363) + p.Match(PostgreSQLParserEndDollarStringConstant) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserEscapeStringConstant: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10364) + p.Match(PostgreSQLParserEscapeStringConstant) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_uescapeContext is an interface to support dynamic dispatch. +type IOpt_uescapeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + UESCAPE() antlr.TerminalNode + Anysconst() IAnysconstContext + + // IsOpt_uescapeContext differentiates from other interfaces. + IsOpt_uescapeContext() +} + +type Opt_uescapeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_uescapeContext() *Opt_uescapeContext { + var p = new(Opt_uescapeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_uescape + return p +} + +func InitEmptyOpt_uescapeContext(p *Opt_uescapeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_uescape +} + +func (*Opt_uescapeContext) IsOpt_uescapeContext() {} + +func NewOpt_uescapeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_uescapeContext { + var p = new(Opt_uescapeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_uescape + + return p +} + +func (s *Opt_uescapeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_uescapeContext) UESCAPE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUESCAPE, 0) +} + +func (s *Opt_uescapeContext) Anysconst() IAnysconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAnysconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAnysconstContext) +} + +func (s *Opt_uescapeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_uescapeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_uescapeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_uescape(s) + } +} + +func (s *Opt_uescapeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_uescape(s) + } +} + +func (s *Opt_uescapeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_uescape(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_uescape() (localctx IOpt_uescapeContext) { + localctx = NewOpt_uescapeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1374, PostgreSQLParserRULE_opt_uescape) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10367) + p.Match(PostgreSQLParserUESCAPE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10368) + p.Anysconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISignediconstContext is an interface to support dynamic dispatch. +type ISignediconstContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Iconst() IIconstContext + PLUS() antlr.TerminalNode + MINUS() antlr.TerminalNode + + // IsSignediconstContext differentiates from other interfaces. + IsSignediconstContext() +} + +type SignediconstContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySignediconstContext() *SignediconstContext { + var p = new(SignediconstContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_signediconst + return p +} + +func InitEmptySignediconstContext(p *SignediconstContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_signediconst +} + +func (*SignediconstContext) IsSignediconstContext() {} + +func NewSignediconstContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SignediconstContext { + var p = new(SignediconstContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_signediconst + + return p +} + +func (s *SignediconstContext) GetParser() antlr.Parser { return s.parser } + +func (s *SignediconstContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *SignediconstContext) PLUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLUS, 0) +} + +func (s *SignediconstContext) MINUS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUS, 0) +} + +func (s *SignediconstContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SignediconstContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SignediconstContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSignediconst(s) + } +} + +func (s *SignediconstContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSignediconst(s) + } +} + +func (s *SignediconstContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSignediconst(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Signediconst() (localctx ISignediconstContext) { + localctx = NewSignediconstContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1376, PostgreSQLParserRULE_signediconst) + p.SetState(10375) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserIntegral: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10370) + p.Iconst() + } + + case PostgreSQLParserPLUS: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10371) + p.Match(PostgreSQLParserPLUS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10372) + p.Iconst() + } + + case PostgreSQLParserMINUS: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10373) + p.Match(PostgreSQLParserMINUS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10374) + p.Iconst() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRoleidContext is an interface to support dynamic dispatch. +type IRoleidContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Rolespec() IRolespecContext + + // IsRoleidContext differentiates from other interfaces. + IsRoleidContext() +} + +type RoleidContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRoleidContext() *RoleidContext { + var p = new(RoleidContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_roleid + return p +} + +func InitEmptyRoleidContext(p *RoleidContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_roleid +} + +func (*RoleidContext) IsRoleidContext() {} + +func NewRoleidContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RoleidContext { + var p = new(RoleidContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_roleid + + return p +} + +func (s *RoleidContext) GetParser() antlr.Parser { return s.parser } + +func (s *RoleidContext) Rolespec() IRolespecContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *RoleidContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RoleidContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RoleidContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRoleid(s) + } +} + +func (s *RoleidContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRoleid(s) + } +} + +func (s *RoleidContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRoleid(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Roleid() (localctx IRoleidContext) { + localctx = NewRoleidContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1378, PostgreSQLParserRULE_roleid) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10377) + p.Rolespec() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRolespecContext is an interface to support dynamic dispatch. +type IRolespecContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Nonreservedword() INonreservedwordContext + CURRENT_USER() antlr.TerminalNode + SESSION_USER() antlr.TerminalNode + + // IsRolespecContext differentiates from other interfaces. + IsRolespecContext() +} + +type RolespecContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRolespecContext() *RolespecContext { + var p = new(RolespecContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rolespec + return p +} + +func InitEmptyRolespecContext(p *RolespecContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_rolespec +} + +func (*RolespecContext) IsRolespecContext() {} + +func NewRolespecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RolespecContext { + var p = new(RolespecContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_rolespec + + return p +} + +func (s *RolespecContext) GetParser() antlr.Parser { return s.parser } + +func (s *RolespecContext) Nonreservedword() INonreservedwordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INonreservedwordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INonreservedwordContext) +} + +func (s *RolespecContext) CURRENT_USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_USER, 0) +} + +func (s *RolespecContext) SESSION_USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION_USER, 0) +} + +func (s *RolespecContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RolespecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RolespecContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRolespec(s) + } +} + +func (s *RolespecContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRolespec(s) + } +} + +func (s *RolespecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRolespec(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Rolespec() (localctx IRolespecContext) { + localctx = NewRolespecContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1380, PostgreSQLParserRULE_rolespec) + p.SetState(10382) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserAUTHORIZATION, PostgreSQLParserBINARY, PostgreSQLParserCOLLATION, PostgreSQLParserCONCURRENTLY, PostgreSQLParserCROSS, PostgreSQLParserCURRENT_SCHEMA, PostgreSQLParserFREEZE, PostgreSQLParserFULL, PostgreSQLParserILIKE, PostgreSQLParserINNER_P, PostgreSQLParserIS, PostgreSQLParserISNULL, PostgreSQLParserJOIN, PostgreSQLParserLIKE, PostgreSQLParserNATURAL, PostgreSQLParserNOTNULL, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserOVERLAPS, PostgreSQLParserSIMILAR, PostgreSQLParserVERBOSE, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserTABLESAMPLE, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10379) + p.Nonreservedword() + } + + case PostgreSQLParserCURRENT_USER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10380) + p.Match(PostgreSQLParserCURRENT_USER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSESSION_USER: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10381) + p.Match(PostgreSQLParserSESSION_USER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IRole_listContext is an interface to support dynamic dispatch. +type IRole_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllRolespec() []IRolespecContext + Rolespec(i int) IRolespecContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsRole_listContext differentiates from other interfaces. + IsRole_listContext() +} + +type Role_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRole_listContext() *Role_listContext { + var p = new(Role_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_role_list + return p +} + +func InitEmptyRole_listContext(p *Role_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_role_list +} + +func (*Role_listContext) IsRole_listContext() {} + +func NewRole_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Role_listContext { + var p = new(Role_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_role_list + + return p +} + +func (s *Role_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Role_listContext) AllRolespec() []IRolespecContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRolespecContext); ok { + len++ + } + } + + tst := make([]IRolespecContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRolespecContext); ok { + tst[i] = t.(IRolespecContext) + i++ + } + } + + return tst +} + +func (s *Role_listContext) Rolespec(i int) IRolespecContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRolespecContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRolespecContext) +} + +func (s *Role_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Role_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Role_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Role_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Role_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterRole_list(s) + } +} + +func (s *Role_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitRole_list(s) + } +} + +func (s *Role_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitRole_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Role_list() (localctx IRole_listContext) { + localctx = NewRole_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1382, PostgreSQLParserRULE_role_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10384) + p.Rolespec() + } + p.SetState(10389) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10385) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10386) + p.Rolespec() + } + + p.SetState(10391) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IColidContext is an interface to support dynamic dispatch. +type IColidContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + Unreserved_keyword() IUnreserved_keywordContext + Col_name_keyword() ICol_name_keywordContext + Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext + LEFT() antlr.TerminalNode + RIGHT() antlr.TerminalNode + + // IsColidContext differentiates from other interfaces. + IsColidContext() +} + +type ColidContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyColidContext() *ColidContext { + var p = new(ColidContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_colid + return p +} + +func InitEmptyColidContext(p *ColidContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_colid +} + +func (*ColidContext) IsColidContext() {} + +func NewColidContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ColidContext { + var p = new(ColidContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_colid + + return p +} + +func (s *ColidContext) GetParser() antlr.Parser { return s.parser } + +func (s *ColidContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *ColidContext) Unreserved_keyword() IUnreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnreserved_keywordContext) +} + +func (s *ColidContext) Col_name_keyword() ICol_name_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICol_name_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICol_name_keywordContext) +} + +func (s *ColidContext) Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_unreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_unreserved_keywordContext) +} + +func (s *ColidContext) LEFT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEFT, 0) +} + +func (s *ColidContext) RIGHT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRIGHT, 0) +} + +func (s *ColidContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ColidContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ColidContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterColid(s) + } +} + +func (s *ColidContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitColid(s) + } +} + +func (s *ColidContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitColid(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Colid() (localctx IColidContext) { + localctx = NewColidContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1384, PostgreSQLParserRULE_colid) + p.SetState(10398) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1005, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10392) + p.Identifier() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10393) + p.Unreserved_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10394) + p.Col_name_keyword() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10395) + p.Plsql_unreserved_keyword() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10396) + p.Match(PostgreSQLParserLEFT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10397) + p.Match(PostgreSQLParserRIGHT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ITable_aliasContext is an interface to support dynamic dispatch. +type ITable_aliasContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + Unreserved_keyword() IUnreserved_keywordContext + Col_name_keyword() ICol_name_keywordContext + Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext + + // IsTable_aliasContext differentiates from other interfaces. + IsTable_aliasContext() +} + +type Table_aliasContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyTable_aliasContext() *Table_aliasContext { + var p = new(Table_aliasContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_alias + return p +} + +func InitEmptyTable_aliasContext(p *Table_aliasContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_table_alias +} + +func (*Table_aliasContext) IsTable_aliasContext() {} + +func NewTable_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Table_aliasContext { + var p = new(Table_aliasContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_table_alias + + return p +} + +func (s *Table_aliasContext) GetParser() antlr.Parser { return s.parser } + +func (s *Table_aliasContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Table_aliasContext) Unreserved_keyword() IUnreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnreserved_keywordContext) +} + +func (s *Table_aliasContext) Col_name_keyword() ICol_name_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICol_name_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICol_name_keywordContext) +} + +func (s *Table_aliasContext) Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_unreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_unreserved_keywordContext) +} + +func (s *Table_aliasContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Table_aliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Table_aliasContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterTable_alias(s) + } +} + +func (s *Table_aliasContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitTable_alias(s) + } +} + +func (s *Table_aliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitTable_alias(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Table_alias() (localctx ITable_aliasContext) { + localctx = NewTable_aliasContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1386, PostgreSQLParserRULE_table_alias) + p.SetState(10404) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1006, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10400) + p.Identifier() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10401) + p.Unreserved_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10402) + p.Col_name_keyword() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10403) + p.Plsql_unreserved_keyword() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IType_function_nameContext is an interface to support dynamic dispatch. +type IType_function_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + Unreserved_keyword() IUnreserved_keywordContext + Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext + Type_func_name_keyword() IType_func_name_keywordContext + + // IsType_function_nameContext differentiates from other interfaces. + IsType_function_nameContext() +} + +type Type_function_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyType_function_nameContext() *Type_function_nameContext { + var p = new(Type_function_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_type_function_name + return p +} + +func InitEmptyType_function_nameContext(p *Type_function_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_type_function_name +} + +func (*Type_function_nameContext) IsType_function_nameContext() {} + +func NewType_function_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_function_nameContext { + var p = new(Type_function_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_type_function_name + + return p +} + +func (s *Type_function_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Type_function_nameContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Type_function_nameContext) Unreserved_keyword() IUnreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnreserved_keywordContext) +} + +func (s *Type_function_nameContext) Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_unreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_unreserved_keywordContext) +} + +func (s *Type_function_nameContext) Type_func_name_keyword() IType_func_name_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_func_name_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_func_name_keywordContext) +} + +func (s *Type_function_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Type_function_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Type_function_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterType_function_name(s) + } +} + +func (s *Type_function_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitType_function_name(s) + } +} + +func (s *Type_function_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitType_function_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Type_function_name() (localctx IType_function_nameContext) { + localctx = NewType_function_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1388, PostgreSQLParserRULE_type_function_name) + p.SetState(10410) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1007, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10406) + p.Identifier() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10407) + p.Unreserved_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10408) + p.Plsql_unreserved_keyword() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10409) + p.Type_func_name_keyword() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// INonreservedwordContext is an interface to support dynamic dispatch. +type INonreservedwordContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + Unreserved_keyword() IUnreserved_keywordContext + Col_name_keyword() ICol_name_keywordContext + Type_func_name_keyword() IType_func_name_keywordContext + + // IsNonreservedwordContext differentiates from other interfaces. + IsNonreservedwordContext() +} + +type NonreservedwordContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNonreservedwordContext() *NonreservedwordContext { + var p = new(NonreservedwordContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_nonreservedword + return p +} + +func InitEmptyNonreservedwordContext(p *NonreservedwordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_nonreservedword +} + +func (*NonreservedwordContext) IsNonreservedwordContext() {} + +func NewNonreservedwordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NonreservedwordContext { + var p = new(NonreservedwordContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_nonreservedword + + return p +} + +func (s *NonreservedwordContext) GetParser() antlr.Parser { return s.parser } + +func (s *NonreservedwordContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *NonreservedwordContext) Unreserved_keyword() IUnreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnreserved_keywordContext) +} + +func (s *NonreservedwordContext) Col_name_keyword() ICol_name_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICol_name_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICol_name_keywordContext) +} + +func (s *NonreservedwordContext) Type_func_name_keyword() IType_func_name_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_func_name_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_func_name_keywordContext) +} + +func (s *NonreservedwordContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *NonreservedwordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *NonreservedwordContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterNonreservedword(s) + } +} + +func (s *NonreservedwordContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitNonreservedword(s) + } +} + +func (s *NonreservedwordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitNonreservedword(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Nonreservedword() (localctx INonreservedwordContext) { + localctx = NewNonreservedwordContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1390, PostgreSQLParserRULE_nonreservedword) + p.SetState(10416) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1008, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10412) + p.Identifier() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10413) + p.Unreserved_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10414) + p.Col_name_keyword() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10415) + p.Type_func_name_keyword() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICollabelContext is an interface to support dynamic dispatch. +type ICollabelContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext + Unreserved_keyword() IUnreserved_keywordContext + Col_name_keyword() ICol_name_keywordContext + Type_func_name_keyword() IType_func_name_keywordContext + Reserved_keyword() IReserved_keywordContext + + // IsCollabelContext differentiates from other interfaces. + IsCollabelContext() +} + +type CollabelContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCollabelContext() *CollabelContext { + var p = new(CollabelContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_collabel + return p +} + +func InitEmptyCollabelContext(p *CollabelContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_collabel +} + +func (*CollabelContext) IsCollabelContext() {} + +func NewCollabelContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CollabelContext { + var p = new(CollabelContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_collabel + + return p +} + +func (s *CollabelContext) GetParser() antlr.Parser { return s.parser } + +func (s *CollabelContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *CollabelContext) Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_unreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_unreserved_keywordContext) +} + +func (s *CollabelContext) Unreserved_keyword() IUnreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnreserved_keywordContext) +} + +func (s *CollabelContext) Col_name_keyword() ICol_name_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICol_name_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICol_name_keywordContext) +} + +func (s *CollabelContext) Type_func_name_keyword() IType_func_name_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IType_func_name_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IType_func_name_keywordContext) +} + +func (s *CollabelContext) Reserved_keyword() IReserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReserved_keywordContext) +} + +func (s *CollabelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *CollabelContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *CollabelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCollabel(s) + } +} + +func (s *CollabelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCollabel(s) + } +} + +func (s *CollabelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCollabel(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Collabel() (localctx ICollabelContext) { + localctx = NewCollabelContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1392, PostgreSQLParserRULE_collabel) + p.SetState(10424) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1009, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10418) + p.Identifier() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10419) + p.Plsql_unreserved_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10420) + p.Unreserved_keyword() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10421) + p.Col_name_keyword() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10422) + p.Type_func_name_keyword() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10423) + p.Reserved_keyword() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IIdentifierContext is an interface to support dynamic dispatch. +type IIdentifierContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() antlr.TerminalNode + Opt_uescape() IOpt_uescapeContext + QuotedIdentifier() antlr.TerminalNode + UnicodeQuotedIdentifier() antlr.TerminalNode + Plsqlvariablename() IPlsqlvariablenameContext + Plsqlidentifier() IPlsqlidentifierContext + Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext + + // IsIdentifierContext differentiates from other interfaces. + IsIdentifierContext() +} + +type IdentifierContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyIdentifierContext() *IdentifierContext { + var p = new(IdentifierContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_identifier + return p +} + +func InitEmptyIdentifierContext(p *IdentifierContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_identifier +} + +func (*IdentifierContext) IsIdentifierContext() {} + +func NewIdentifierContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IdentifierContext { + var p = new(IdentifierContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_identifier + + return p +} + +func (s *IdentifierContext) GetParser() antlr.Parser { return s.parser } + +func (s *IdentifierContext) Identifier() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIdentifier, 0) +} + +func (s *IdentifierContext) Opt_uescape() IOpt_uescapeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_uescapeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_uescapeContext) +} + +func (s *IdentifierContext) QuotedIdentifier() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserQuotedIdentifier, 0) +} + +func (s *IdentifierContext) UnicodeQuotedIdentifier() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUnicodeQuotedIdentifier, 0) +} + +func (s *IdentifierContext) Plsqlvariablename() IPlsqlvariablenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsqlvariablenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsqlvariablenameContext) +} + +func (s *IdentifierContext) Plsqlidentifier() IPlsqlidentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsqlidentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsqlidentifierContext) +} + +func (s *IdentifierContext) Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_unreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_unreserved_keywordContext) +} + +func (s *IdentifierContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *IdentifierContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *IdentifierContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterIdentifier(s) + } +} + +func (s *IdentifierContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitIdentifier(s) + } +} + +func (s *IdentifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitIdentifier(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Identifier() (localctx IIdentifierContext) { + localctx = NewIdentifierContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1394, PostgreSQLParserRULE_identifier) + p.SetState(10435) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserIdentifier: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10426) + p.Match(PostgreSQLParserIdentifier) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10428) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1010, p.GetParserRuleContext()) == 1 { + { + p.SetState(10427) + p.Opt_uescape() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case PostgreSQLParserQuotedIdentifier: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10430) + p.Match(PostgreSQLParserQuotedIdentifier) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserUnicodeQuotedIdentifier: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10431) + p.Match(PostgreSQLParserUnicodeQuotedIdentifier) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserPLSQLVARIABLENAME: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10432) + p.Plsqlvariablename() + } + + case PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10433) + p.Plsqlidentifier() + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserOUTER_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserBACKWARD, PostgreSQLParserCHAIN, PostgreSQLParserCLOSE, PostgreSQLParserCOMMIT, PostgreSQLParserCONTINUE_P, PostgreSQLParserCURSOR, PostgreSQLParserFIRST_P, PostgreSQLParserFORWARD, PostgreSQLParserINSERT, PostgreSQLParserLAST_P, PostgreSQLParserMOVE, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserOPTION, PostgreSQLParserPRIOR, PostgreSQLParserRELATIVE_P, PostgreSQLParserRESET, PostgreSQLParserROLLBACK, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSET, PostgreSQLParserTYPE_P, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserROWTYPE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10434) + p.Plsql_unreserved_keyword() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPlsqlidentifierContext is an interface to support dynamic dispatch. +type IPlsqlidentifierContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PLSQLIDENTIFIER() antlr.TerminalNode + + // IsPlsqlidentifierContext differentiates from other interfaces. + IsPlsqlidentifierContext() +} + +type PlsqlidentifierContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPlsqlidentifierContext() *PlsqlidentifierContext { + var p = new(PlsqlidentifierContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsqlidentifier + return p +} + +func InitEmptyPlsqlidentifierContext(p *PlsqlidentifierContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsqlidentifier +} + +func (*PlsqlidentifierContext) IsPlsqlidentifierContext() {} + +func NewPlsqlidentifierContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PlsqlidentifierContext { + var p = new(PlsqlidentifierContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_plsqlidentifier + + return p +} + +func (s *PlsqlidentifierContext) GetParser() antlr.Parser { return s.parser } + +func (s *PlsqlidentifierContext) PLSQLIDENTIFIER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLSQLIDENTIFIER, 0) +} + +func (s *PlsqlidentifierContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *PlsqlidentifierContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *PlsqlidentifierContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPlsqlidentifier(s) + } +} + +func (s *PlsqlidentifierContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPlsqlidentifier(s) + } +} + +func (s *PlsqlidentifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPlsqlidentifier(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Plsqlidentifier() (localctx IPlsqlidentifierContext) { + localctx = NewPlsqlidentifierContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1396, PostgreSQLParserRULE_plsqlidentifier) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10437) + p.Match(PostgreSQLParserPLSQLIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IUnreserved_keywordContext is an interface to support dynamic dispatch. +type IUnreserved_keywordContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ABORT_P() antlr.TerminalNode + ABSOLUTE_P() antlr.TerminalNode + ACCESS() antlr.TerminalNode + ACTION() antlr.TerminalNode + ADD_P() antlr.TerminalNode + ADMIN() antlr.TerminalNode + AFTER() antlr.TerminalNode + AGGREGATE() antlr.TerminalNode + ALSO() antlr.TerminalNode + ALTER() antlr.TerminalNode + ALWAYS() antlr.TerminalNode + ASSERTION() antlr.TerminalNode + ASSIGNMENT() antlr.TerminalNode + AT() antlr.TerminalNode + ATOMIC_P() antlr.TerminalNode + ATTACH() antlr.TerminalNode + ATTRIBUTE() antlr.TerminalNode + BACKWARD() antlr.TerminalNode + BEFORE() antlr.TerminalNode + BEGIN_P() antlr.TerminalNode + BY() antlr.TerminalNode + CACHE() antlr.TerminalNode + CALL() antlr.TerminalNode + CALLED() antlr.TerminalNode + CASCADE() antlr.TerminalNode + CASCADED() antlr.TerminalNode + CATALOG() antlr.TerminalNode + CHAIN() antlr.TerminalNode + CHARACTERISTICS() antlr.TerminalNode + CHECKPOINT() antlr.TerminalNode + CLASS() antlr.TerminalNode + CLOSE() antlr.TerminalNode + CLUSTER() antlr.TerminalNode + COLUMNS() antlr.TerminalNode + COMMENT() antlr.TerminalNode + COMMENTS() antlr.TerminalNode + COMMIT() antlr.TerminalNode + COMMITTED() antlr.TerminalNode + CONFIGURATION() antlr.TerminalNode + CONFLICT() antlr.TerminalNode + CONNECTION() antlr.TerminalNode + CONSTRAINTS() antlr.TerminalNode + CONTENT_P() antlr.TerminalNode + CONTINUE_P() antlr.TerminalNode + CONVERSION_P() antlr.TerminalNode + COPY() antlr.TerminalNode + COST() antlr.TerminalNode + CSV() antlr.TerminalNode + CUBE() antlr.TerminalNode + CURRENT_P() antlr.TerminalNode + CURSOR() antlr.TerminalNode + CYCLE() antlr.TerminalNode + DATA_P() antlr.TerminalNode + DATABASE() antlr.TerminalNode + DAY_P() antlr.TerminalNode + DEALLOCATE() antlr.TerminalNode + DECLARE() antlr.TerminalNode + DEFAULTS() antlr.TerminalNode + DEFERRED() antlr.TerminalNode + DEFINER() antlr.TerminalNode + DELETE_P() antlr.TerminalNode + DELIMITER() antlr.TerminalNode + DELIMITERS() antlr.TerminalNode + DEPENDS() antlr.TerminalNode + DETACH() antlr.TerminalNode + DICTIONARY() antlr.TerminalNode + DISABLE_P() antlr.TerminalNode + DISCARD() antlr.TerminalNode + DOCUMENT_P() antlr.TerminalNode + DOMAIN_P() antlr.TerminalNode + DOUBLE_P() antlr.TerminalNode + DROP() antlr.TerminalNode + EACH() antlr.TerminalNode + ENABLE_P() antlr.TerminalNode + ENCODING() antlr.TerminalNode + ENCRYPTED() antlr.TerminalNode + ENUM_P() antlr.TerminalNode + ESCAPE() antlr.TerminalNode + EVENT() antlr.TerminalNode + EXCLUDE() antlr.TerminalNode + EXCLUDING() antlr.TerminalNode + EXCLUSIVE() antlr.TerminalNode + EXECUTE() antlr.TerminalNode + EXPLAIN() antlr.TerminalNode + EXPRESSION() antlr.TerminalNode + EXTENSION() antlr.TerminalNode + EXTERNAL() antlr.TerminalNode + FAMILY() antlr.TerminalNode + FILTER() antlr.TerminalNode + FIRST_P() antlr.TerminalNode + FOLLOWING() antlr.TerminalNode + FORCE() antlr.TerminalNode + FORWARD() antlr.TerminalNode + FUNCTION() antlr.TerminalNode + FUNCTIONS() antlr.TerminalNode + GENERATED() antlr.TerminalNode + GLOBAL() antlr.TerminalNode + GRANTED() antlr.TerminalNode + GROUPS() antlr.TerminalNode + HANDLER() antlr.TerminalNode + HEADER_P() antlr.TerminalNode + HOLD() antlr.TerminalNode + HOUR_P() antlr.TerminalNode + IDENTITY_P() antlr.TerminalNode + IF_P() antlr.TerminalNode + IMMEDIATE() antlr.TerminalNode + IMMUTABLE() antlr.TerminalNode + IMPLICIT_P() antlr.TerminalNode + IMPORT_P() antlr.TerminalNode + INCLUDE() antlr.TerminalNode + INCLUDING() antlr.TerminalNode + INCREMENT() antlr.TerminalNode + INDEX() antlr.TerminalNode + INDEXES() antlr.TerminalNode + INHERIT() antlr.TerminalNode + INHERITS() antlr.TerminalNode + INLINE_P() antlr.TerminalNode + INPUT_P() antlr.TerminalNode + INSENSITIVE() antlr.TerminalNode + INSERT() antlr.TerminalNode + INSTEAD() antlr.TerminalNode + INVOKER() antlr.TerminalNode + ISOLATION() antlr.TerminalNode + KEY() antlr.TerminalNode + LABEL() antlr.TerminalNode + LANGUAGE() antlr.TerminalNode + LARGE_P() antlr.TerminalNode + LAST_P() antlr.TerminalNode + LEAKPROOF() antlr.TerminalNode + LEVEL() antlr.TerminalNode + LISTEN() antlr.TerminalNode + LOAD() antlr.TerminalNode + LOCAL() antlr.TerminalNode + LOCATION() antlr.TerminalNode + LOCK_P() antlr.TerminalNode + LOCKED() antlr.TerminalNode + LOGGED() antlr.TerminalNode + MAPPING() antlr.TerminalNode + MATCH() antlr.TerminalNode + MATERIALIZED() antlr.TerminalNode + MAXVALUE() antlr.TerminalNode + METHOD() antlr.TerminalNode + MINUTE_P() antlr.TerminalNode + MINVALUE() antlr.TerminalNode + MODE() antlr.TerminalNode + MONTH_P() antlr.TerminalNode + MOVE() antlr.TerminalNode + NAME_P() antlr.TerminalNode + NAMES() antlr.TerminalNode + NEW() antlr.TerminalNode + NEXT() antlr.TerminalNode + NFC() antlr.TerminalNode + NFD() antlr.TerminalNode + NFKC() antlr.TerminalNode + NFKD() antlr.TerminalNode + NO() antlr.TerminalNode + NORMALIZED() antlr.TerminalNode + NOTHING() antlr.TerminalNode + NOTIFY() antlr.TerminalNode + NOWAIT() antlr.TerminalNode + NULLS_P() antlr.TerminalNode + OBJECT_P() antlr.TerminalNode + OF() antlr.TerminalNode + OFF() antlr.TerminalNode + OIDS() antlr.TerminalNode + OLD() antlr.TerminalNode + OPERATOR() antlr.TerminalNode + OPTION() antlr.TerminalNode + OPTIONS() antlr.TerminalNode + ORDINALITY() antlr.TerminalNode + OTHERS() antlr.TerminalNode + OVER() antlr.TerminalNode + OVERRIDING() antlr.TerminalNode + OWNED() antlr.TerminalNode + OWNER() antlr.TerminalNode + PARALLEL() antlr.TerminalNode + PARAMETER() antlr.TerminalNode + PARSER() antlr.TerminalNode + PARTIAL() antlr.TerminalNode + PARTITION() antlr.TerminalNode + PASSING() antlr.TerminalNode + PASSWORD() antlr.TerminalNode + PLANS() antlr.TerminalNode + POLICY() antlr.TerminalNode + PRECEDING() antlr.TerminalNode + PREPARE() antlr.TerminalNode + PREPARED() antlr.TerminalNode + PRESERVE() antlr.TerminalNode + PRIOR() antlr.TerminalNode + PRIVILEGES() antlr.TerminalNode + PROCEDURAL() antlr.TerminalNode + PROCEDURE() antlr.TerminalNode + PROCEDURES() antlr.TerminalNode + PROGRAM() antlr.TerminalNode + PUBLICATION() antlr.TerminalNode + QUOTE() antlr.TerminalNode + RANGE() antlr.TerminalNode + READ() antlr.TerminalNode + REASSIGN() antlr.TerminalNode + RECHECK() antlr.TerminalNode + RECURSIVE() antlr.TerminalNode + REF() antlr.TerminalNode + REFERENCING() antlr.TerminalNode + REFRESH() antlr.TerminalNode + REINDEX() antlr.TerminalNode + RELATIVE_P() antlr.TerminalNode + RELEASE() antlr.TerminalNode + RENAME() antlr.TerminalNode + REPEATABLE() antlr.TerminalNode + REPLICA() antlr.TerminalNode + RESET() antlr.TerminalNode + RESTART() antlr.TerminalNode + RESTRICT() antlr.TerminalNode + RETURNS() antlr.TerminalNode + REVOKE() antlr.TerminalNode + ROLE() antlr.TerminalNode + ROLLBACK() antlr.TerminalNode + ROLLUP() antlr.TerminalNode + ROUTINE() antlr.TerminalNode + ROUTINES() antlr.TerminalNode + ROWS() antlr.TerminalNode + RULE() antlr.TerminalNode + SAVEPOINT() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + SCHEMAS() antlr.TerminalNode + SCROLL() antlr.TerminalNode + SEARCH() antlr.TerminalNode + SECOND_P() antlr.TerminalNode + SECURITY() antlr.TerminalNode + SEQUENCE() antlr.TerminalNode + SEQUENCES() antlr.TerminalNode + SERIALIZABLE() antlr.TerminalNode + SERVER() antlr.TerminalNode + SESSION() antlr.TerminalNode + SET() antlr.TerminalNode + SETS() antlr.TerminalNode + SHARE() antlr.TerminalNode + SHOW() antlr.TerminalNode + SIMPLE() antlr.TerminalNode + SKIP_P() antlr.TerminalNode + SNAPSHOT() antlr.TerminalNode + SQL_P() antlr.TerminalNode + STABLE() antlr.TerminalNode + STANDALONE_P() antlr.TerminalNode + START() antlr.TerminalNode + STATEMENT() antlr.TerminalNode + STATISTICS() antlr.TerminalNode + STDIN() antlr.TerminalNode + STDOUT() antlr.TerminalNode + STORAGE() antlr.TerminalNode + STORED() antlr.TerminalNode + STRICT_P() antlr.TerminalNode + STRIP_P() antlr.TerminalNode + SUBSCRIPTION() antlr.TerminalNode + SUPPORT() antlr.TerminalNode + SYSID() antlr.TerminalNode + SYSTEM_P() antlr.TerminalNode + TABLES() antlr.TerminalNode + TABLESPACE() antlr.TerminalNode + TEMP() antlr.TerminalNode + TEMPLATE() antlr.TerminalNode + TEMPORARY() antlr.TerminalNode + TEXT_P() antlr.TerminalNode + TIES() antlr.TerminalNode + TRANSACTION() antlr.TerminalNode + TRANSFORM() antlr.TerminalNode + TRIGGER() antlr.TerminalNode + TRUNCATE() antlr.TerminalNode + TRUSTED() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + TYPES_P() antlr.TerminalNode + UESCAPE() antlr.TerminalNode + UNBOUNDED() antlr.TerminalNode + UNCOMMITTED() antlr.TerminalNode + UNENCRYPTED() antlr.TerminalNode + UNKNOWN() antlr.TerminalNode + UNLISTEN() antlr.TerminalNode + UNLOGGED() antlr.TerminalNode + UNTIL() antlr.TerminalNode + UPDATE() antlr.TerminalNode + VACUUM() antlr.TerminalNode + VALID() antlr.TerminalNode + VALIDATE() antlr.TerminalNode + VALIDATOR() antlr.TerminalNode + VALUE_P() antlr.TerminalNode + VARYING() antlr.TerminalNode + VERSION_P() antlr.TerminalNode + VIEW() antlr.TerminalNode + VIEWS() antlr.TerminalNode + VOLATILE() antlr.TerminalNode + WHITESPACE_P() antlr.TerminalNode + WITHIN() antlr.TerminalNode + WITHOUT() antlr.TerminalNode + WORK() antlr.TerminalNode + WRAPPER() antlr.TerminalNode + WRITE() antlr.TerminalNode + XML_P() antlr.TerminalNode + YEAR_P() antlr.TerminalNode + YES_P() antlr.TerminalNode + ZONE() antlr.TerminalNode + + // IsUnreserved_keywordContext differentiates from other interfaces. + IsUnreserved_keywordContext() +} + +type Unreserved_keywordContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyUnreserved_keywordContext() *Unreserved_keywordContext { + var p = new(Unreserved_keywordContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_unreserved_keyword + return p +} + +func InitEmptyUnreserved_keywordContext(p *Unreserved_keywordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_unreserved_keyword +} + +func (*Unreserved_keywordContext) IsUnreserved_keywordContext() {} + +func NewUnreserved_keywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Unreserved_keywordContext { + var p = new(Unreserved_keywordContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_unreserved_keyword + + return p +} + +func (s *Unreserved_keywordContext) GetParser() antlr.Parser { return s.parser } + +func (s *Unreserved_keywordContext) ABORT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserABORT_P, 0) +} + +func (s *Unreserved_keywordContext) ABSOLUTE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserABSOLUTE_P, 0) +} + +func (s *Unreserved_keywordContext) ACCESS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACCESS, 0) +} + +func (s *Unreserved_keywordContext) ACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACTION, 0) +} + +func (s *Unreserved_keywordContext) ADD_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADD_P, 0) +} + +func (s *Unreserved_keywordContext) ADMIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserADMIN, 0) +} + +func (s *Unreserved_keywordContext) AFTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAFTER, 0) +} + +func (s *Unreserved_keywordContext) AGGREGATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGGREGATE, 0) +} + +func (s *Unreserved_keywordContext) ALSO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALSO, 0) +} + +func (s *Unreserved_keywordContext) ALTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALTER, 0) +} + +func (s *Unreserved_keywordContext) ALWAYS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALWAYS, 0) +} + +func (s *Unreserved_keywordContext) ASSERTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASSERTION, 0) +} + +func (s *Unreserved_keywordContext) ASSIGNMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASSIGNMENT, 0) +} + +func (s *Unreserved_keywordContext) AT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAT, 0) +} + +func (s *Unreserved_keywordContext) ATOMIC_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATOMIC_P, 0) +} + +func (s *Unreserved_keywordContext) ATTACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATTACH, 0) +} + +func (s *Unreserved_keywordContext) ATTRIBUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATTRIBUTE, 0) +} + +func (s *Unreserved_keywordContext) BACKWARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBACKWARD, 0) +} + +func (s *Unreserved_keywordContext) BEFORE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBEFORE, 0) +} + +func (s *Unreserved_keywordContext) BEGIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBEGIN_P, 0) +} + +func (s *Unreserved_keywordContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Unreserved_keywordContext) CACHE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCACHE, 0) +} + +func (s *Unreserved_keywordContext) CALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCALL, 0) +} + +func (s *Unreserved_keywordContext) CALLED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCALLED, 0) +} + +func (s *Unreserved_keywordContext) CASCADE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASCADE, 0) +} + +func (s *Unreserved_keywordContext) CASCADED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASCADED, 0) +} + +func (s *Unreserved_keywordContext) CATALOG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCATALOG, 0) +} + +func (s *Unreserved_keywordContext) CHAIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHAIN, 0) +} + +func (s *Unreserved_keywordContext) CHARACTERISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHARACTERISTICS, 0) +} + +func (s *Unreserved_keywordContext) CHECKPOINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHECKPOINT, 0) +} + +func (s *Unreserved_keywordContext) CLASS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLASS, 0) +} + +func (s *Unreserved_keywordContext) CLOSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE, 0) +} + +func (s *Unreserved_keywordContext) CLUSTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLUSTER, 0) +} + +func (s *Unreserved_keywordContext) COLUMNS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLUMNS, 0) +} + +func (s *Unreserved_keywordContext) COMMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMENT, 0) +} + +func (s *Unreserved_keywordContext) COMMENTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMENTS, 0) +} + +func (s *Unreserved_keywordContext) COMMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMIT, 0) +} + +func (s *Unreserved_keywordContext) COMMITTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMITTED, 0) +} + +func (s *Unreserved_keywordContext) CONFIGURATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFIGURATION, 0) +} + +func (s *Unreserved_keywordContext) CONFLICT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONFLICT, 0) +} + +func (s *Unreserved_keywordContext) CONNECTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONNECTION, 0) +} + +func (s *Unreserved_keywordContext) CONSTRAINTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINTS, 0) +} + +func (s *Unreserved_keywordContext) CONTENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONTENT_P, 0) +} + +func (s *Unreserved_keywordContext) CONTINUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONTINUE_P, 0) +} + +func (s *Unreserved_keywordContext) CONVERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONVERSION_P, 0) +} + +func (s *Unreserved_keywordContext) COPY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOPY, 0) +} + +func (s *Unreserved_keywordContext) COST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOST, 0) +} + +func (s *Unreserved_keywordContext) CSV() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCSV, 0) +} + +func (s *Unreserved_keywordContext) CUBE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCUBE, 0) +} + +func (s *Unreserved_keywordContext) CURRENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_P, 0) +} + +func (s *Unreserved_keywordContext) CURSOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURSOR, 0) +} + +func (s *Unreserved_keywordContext) CYCLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCYCLE, 0) +} + +func (s *Unreserved_keywordContext) DATA_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATA_P, 0) +} + +func (s *Unreserved_keywordContext) DATABASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATABASE, 0) +} + +func (s *Unreserved_keywordContext) DAY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDAY_P, 0) +} + +func (s *Unreserved_keywordContext) DEALLOCATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEALLOCATE, 0) +} + +func (s *Unreserved_keywordContext) DECLARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDECLARE, 0) +} + +func (s *Unreserved_keywordContext) DEFAULTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULTS, 0) +} + +func (s *Unreserved_keywordContext) DEFERRED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFERRED, 0) +} + +func (s *Unreserved_keywordContext) DEFINER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFINER, 0) +} + +func (s *Unreserved_keywordContext) DELETE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELETE_P, 0) +} + +func (s *Unreserved_keywordContext) DELIMITER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELIMITER, 0) +} + +func (s *Unreserved_keywordContext) DELIMITERS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDELIMITERS, 0) +} + +func (s *Unreserved_keywordContext) DEPENDS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEPENDS, 0) +} + +func (s *Unreserved_keywordContext) DETACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDETACH, 0) +} + +func (s *Unreserved_keywordContext) DICTIONARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDICTIONARY, 0) +} + +func (s *Unreserved_keywordContext) DISABLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISABLE_P, 0) +} + +func (s *Unreserved_keywordContext) DISCARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISCARD, 0) +} + +func (s *Unreserved_keywordContext) DOCUMENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOCUMENT_P, 0) +} + +func (s *Unreserved_keywordContext) DOMAIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOMAIN_P, 0) +} + +func (s *Unreserved_keywordContext) DOUBLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOUBLE_P, 0) +} + +func (s *Unreserved_keywordContext) DROP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDROP, 0) +} + +func (s *Unreserved_keywordContext) EACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEACH, 0) +} + +func (s *Unreserved_keywordContext) ENABLE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENABLE_P, 0) +} + +func (s *Unreserved_keywordContext) ENCODING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENCODING, 0) +} + +func (s *Unreserved_keywordContext) ENCRYPTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENCRYPTED, 0) +} + +func (s *Unreserved_keywordContext) ENUM_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserENUM_P, 0) +} + +func (s *Unreserved_keywordContext) ESCAPE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserESCAPE, 0) +} + +func (s *Unreserved_keywordContext) EVENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEVENT, 0) +} + +func (s *Unreserved_keywordContext) EXCLUDE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCLUDE, 0) +} + +func (s *Unreserved_keywordContext) EXCLUDING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCLUDING, 0) +} + +func (s *Unreserved_keywordContext) EXCLUSIVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCLUSIVE, 0) +} + +func (s *Unreserved_keywordContext) EXECUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXECUTE, 0) +} + +func (s *Unreserved_keywordContext) EXPLAIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXPLAIN, 0) +} + +func (s *Unreserved_keywordContext) EXPRESSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXPRESSION, 0) +} + +func (s *Unreserved_keywordContext) EXTENSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTENSION, 0) +} + +func (s *Unreserved_keywordContext) EXTERNAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTERNAL, 0) +} + +func (s *Unreserved_keywordContext) FAMILY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFAMILY, 0) +} + +func (s *Unreserved_keywordContext) FILTER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFILTER, 0) +} + +func (s *Unreserved_keywordContext) FIRST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFIRST_P, 0) +} + +func (s *Unreserved_keywordContext) FOLLOWING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOLLOWING, 0) +} + +func (s *Unreserved_keywordContext) FORCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORCE, 0) +} + +func (s *Unreserved_keywordContext) FORWARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORWARD, 0) +} + +func (s *Unreserved_keywordContext) FUNCTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTION, 0) +} + +func (s *Unreserved_keywordContext) FUNCTIONS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFUNCTIONS, 0) +} + +func (s *Unreserved_keywordContext) GENERATED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGENERATED, 0) +} + +func (s *Unreserved_keywordContext) GLOBAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGLOBAL, 0) +} + +func (s *Unreserved_keywordContext) GRANTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGRANTED, 0) +} + +func (s *Unreserved_keywordContext) GROUPS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUPS, 0) +} + +func (s *Unreserved_keywordContext) HANDLER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHANDLER, 0) +} + +func (s *Unreserved_keywordContext) HEADER_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHEADER_P, 0) +} + +func (s *Unreserved_keywordContext) HOLD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHOLD, 0) +} + +func (s *Unreserved_keywordContext) HOUR_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHOUR_P, 0) +} + +func (s *Unreserved_keywordContext) IDENTITY_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIDENTITY_P, 0) +} + +func (s *Unreserved_keywordContext) IF_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, 0) +} + +func (s *Unreserved_keywordContext) IMMEDIATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMMEDIATE, 0) +} + +func (s *Unreserved_keywordContext) IMMUTABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMMUTABLE, 0) +} + +func (s *Unreserved_keywordContext) IMPLICIT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMPLICIT_P, 0) +} + +func (s *Unreserved_keywordContext) IMPORT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIMPORT_P, 0) +} + +func (s *Unreserved_keywordContext) INCLUDE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINCLUDE, 0) +} + +func (s *Unreserved_keywordContext) INCLUDING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINCLUDING, 0) +} + +func (s *Unreserved_keywordContext) INCREMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINCREMENT, 0) +} + +func (s *Unreserved_keywordContext) INDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEX, 0) +} + +func (s *Unreserved_keywordContext) INDEXES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINDEXES, 0) +} + +func (s *Unreserved_keywordContext) INHERIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINHERIT, 0) +} + +func (s *Unreserved_keywordContext) INHERITS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINHERITS, 0) +} + +func (s *Unreserved_keywordContext) INLINE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINLINE_P, 0) +} + +func (s *Unreserved_keywordContext) INPUT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINPUT_P, 0) +} + +func (s *Unreserved_keywordContext) INSENSITIVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSENSITIVE, 0) +} + +func (s *Unreserved_keywordContext) INSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSERT, 0) +} + +func (s *Unreserved_keywordContext) INSTEAD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSTEAD, 0) +} + +func (s *Unreserved_keywordContext) INVOKER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINVOKER, 0) +} + +func (s *Unreserved_keywordContext) ISOLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserISOLATION, 0) +} + +func (s *Unreserved_keywordContext) KEY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserKEY, 0) +} + +func (s *Unreserved_keywordContext) LABEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLABEL, 0) +} + +func (s *Unreserved_keywordContext) LANGUAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLANGUAGE, 0) +} + +func (s *Unreserved_keywordContext) LARGE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLARGE_P, 0) +} + +func (s *Unreserved_keywordContext) LAST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLAST_P, 0) +} + +func (s *Unreserved_keywordContext) LEAKPROOF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEAKPROOF, 0) +} + +func (s *Unreserved_keywordContext) LEVEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEVEL, 0) +} + +func (s *Unreserved_keywordContext) LISTEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLISTEN, 0) +} + +func (s *Unreserved_keywordContext) LOAD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOAD, 0) +} + +func (s *Unreserved_keywordContext) LOCAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCAL, 0) +} + +func (s *Unreserved_keywordContext) LOCATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCATION, 0) +} + +func (s *Unreserved_keywordContext) LOCK_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCK_P, 0) +} + +func (s *Unreserved_keywordContext) LOCKED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCKED, 0) +} + +func (s *Unreserved_keywordContext) LOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOGGED, 0) +} + +func (s *Unreserved_keywordContext) MAPPING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAPPING, 0) +} + +func (s *Unreserved_keywordContext) MATCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATCH, 0) +} + +func (s *Unreserved_keywordContext) MATERIALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMATERIALIZED, 0) +} + +func (s *Unreserved_keywordContext) MAXVALUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAXVALUE, 0) +} + +func (s *Unreserved_keywordContext) METHOD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMETHOD, 0) +} + +func (s *Unreserved_keywordContext) MINUTE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINUTE_P, 0) +} + +func (s *Unreserved_keywordContext) MINVALUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMINVALUE, 0) +} + +func (s *Unreserved_keywordContext) MODE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMODE, 0) +} + +func (s *Unreserved_keywordContext) MONTH_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMONTH_P, 0) +} + +func (s *Unreserved_keywordContext) MOVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMOVE, 0) +} + +func (s *Unreserved_keywordContext) NAME_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNAME_P, 0) +} + +func (s *Unreserved_keywordContext) NAMES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNAMES, 0) +} + +func (s *Unreserved_keywordContext) NEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNEW, 0) +} + +func (s *Unreserved_keywordContext) NEXT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNEXT, 0) +} + +func (s *Unreserved_keywordContext) NFC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNFC, 0) +} + +func (s *Unreserved_keywordContext) NFD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNFD, 0) +} + +func (s *Unreserved_keywordContext) NFKC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNFKC, 0) +} + +func (s *Unreserved_keywordContext) NFKD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNFKD, 0) +} + +func (s *Unreserved_keywordContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Unreserved_keywordContext) NORMALIZED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNORMALIZED, 0) +} + +func (s *Unreserved_keywordContext) NOTHING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTHING, 0) +} + +func (s *Unreserved_keywordContext) NOTIFY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTIFY, 0) +} + +func (s *Unreserved_keywordContext) NOWAIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOWAIT, 0) +} + +func (s *Unreserved_keywordContext) NULLS_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULLS_P, 0) +} + +func (s *Unreserved_keywordContext) OBJECT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOBJECT_P, 0) +} + +func (s *Unreserved_keywordContext) OF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOF, 0) +} + +func (s *Unreserved_keywordContext) OFF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOFF, 0) +} + +func (s *Unreserved_keywordContext) OIDS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOIDS, 0) +} + +func (s *Unreserved_keywordContext) OLD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOLD, 0) +} + +func (s *Unreserved_keywordContext) OPERATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPERATOR, 0) +} + +func (s *Unreserved_keywordContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *Unreserved_keywordContext) OPTIONS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTIONS, 0) +} + +func (s *Unreserved_keywordContext) ORDINALITY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserORDINALITY, 0) +} + +func (s *Unreserved_keywordContext) OTHERS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOTHERS, 0) +} + +func (s *Unreserved_keywordContext) OVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOVER, 0) +} + +func (s *Unreserved_keywordContext) OVERRIDING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOVERRIDING, 0) +} + +func (s *Unreserved_keywordContext) OWNED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNED, 0) +} + +func (s *Unreserved_keywordContext) OWNER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOWNER, 0) +} + +func (s *Unreserved_keywordContext) PARALLEL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARALLEL, 0) +} + +func (s *Unreserved_keywordContext) PARAMETER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARAMETER, 0) +} + +func (s *Unreserved_keywordContext) PARSER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARSER, 0) +} + +func (s *Unreserved_keywordContext) PARTIAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTIAL, 0) +} + +func (s *Unreserved_keywordContext) PARTITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARTITION, 0) +} + +func (s *Unreserved_keywordContext) PASSING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPASSING, 0) +} + +func (s *Unreserved_keywordContext) PASSWORD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPASSWORD, 0) +} + +func (s *Unreserved_keywordContext) PLANS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLANS, 0) +} + +func (s *Unreserved_keywordContext) POLICY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPOLICY, 0) +} + +func (s *Unreserved_keywordContext) PRECEDING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRECEDING, 0) +} + +func (s *Unreserved_keywordContext) PREPARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPREPARE, 0) +} + +func (s *Unreserved_keywordContext) PREPARED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPREPARED, 0) +} + +func (s *Unreserved_keywordContext) PRESERVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRESERVE, 0) +} + +func (s *Unreserved_keywordContext) PRIOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIOR, 0) +} + +func (s *Unreserved_keywordContext) PRIVILEGES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIVILEGES, 0) +} + +func (s *Unreserved_keywordContext) PROCEDURAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURAL, 0) +} + +func (s *Unreserved_keywordContext) PROCEDURE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURE, 0) +} + +func (s *Unreserved_keywordContext) PROCEDURES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROCEDURES, 0) +} + +func (s *Unreserved_keywordContext) PROGRAM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPROGRAM, 0) +} + +func (s *Unreserved_keywordContext) PUBLICATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPUBLICATION, 0) +} + +func (s *Unreserved_keywordContext) QUOTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserQUOTE, 0) +} + +func (s *Unreserved_keywordContext) RANGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRANGE, 0) +} + +func (s *Unreserved_keywordContext) READ() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREAD, 0) +} + +func (s *Unreserved_keywordContext) REASSIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREASSIGN, 0) +} + +func (s *Unreserved_keywordContext) RECHECK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRECHECK, 0) +} + +func (s *Unreserved_keywordContext) RECURSIVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRECURSIVE, 0) +} + +func (s *Unreserved_keywordContext) REF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREF, 0) +} + +func (s *Unreserved_keywordContext) REFERENCING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFERENCING, 0) +} + +func (s *Unreserved_keywordContext) REFRESH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFRESH, 0) +} + +func (s *Unreserved_keywordContext) REINDEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREINDEX, 0) +} + +func (s *Unreserved_keywordContext) RELATIVE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRELATIVE_P, 0) +} + +func (s *Unreserved_keywordContext) RELEASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRELEASE, 0) +} + +func (s *Unreserved_keywordContext) RENAME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRENAME, 0) +} + +func (s *Unreserved_keywordContext) REPEATABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPEATABLE, 0) +} + +func (s *Unreserved_keywordContext) REPLICA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPLICA, 0) +} + +func (s *Unreserved_keywordContext) RESET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESET, 0) +} + +func (s *Unreserved_keywordContext) RESTART() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESTART, 0) +} + +func (s *Unreserved_keywordContext) RESTRICT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESTRICT, 0) +} + +func (s *Unreserved_keywordContext) RETURNS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRETURNS, 0) +} + +func (s *Unreserved_keywordContext) REVOKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREVOKE, 0) +} + +func (s *Unreserved_keywordContext) ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLE, 0) +} + +func (s *Unreserved_keywordContext) ROLLBACK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLLBACK, 0) +} + +func (s *Unreserved_keywordContext) ROLLUP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLLUP, 0) +} + +func (s *Unreserved_keywordContext) ROUTINE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINE, 0) +} + +func (s *Unreserved_keywordContext) ROUTINES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUTINES, 0) +} + +func (s *Unreserved_keywordContext) ROWS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROWS, 0) +} + +func (s *Unreserved_keywordContext) RULE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRULE, 0) +} + +func (s *Unreserved_keywordContext) SAVEPOINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSAVEPOINT, 0) +} + +func (s *Unreserved_keywordContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Unreserved_keywordContext) SCHEMAS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMAS, 0) +} + +func (s *Unreserved_keywordContext) SCROLL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCROLL, 0) +} + +func (s *Unreserved_keywordContext) SEARCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEARCH, 0) +} + +func (s *Unreserved_keywordContext) SECOND_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSECOND_P, 0) +} + +func (s *Unreserved_keywordContext) SECURITY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSECURITY, 0) +} + +func (s *Unreserved_keywordContext) SEQUENCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCE, 0) +} + +func (s *Unreserved_keywordContext) SEQUENCES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEQUENCES, 0) +} + +func (s *Unreserved_keywordContext) SERIALIZABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERIALIZABLE, 0) +} + +func (s *Unreserved_keywordContext) SERVER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSERVER, 0) +} + +func (s *Unreserved_keywordContext) SESSION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION, 0) +} + +func (s *Unreserved_keywordContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Unreserved_keywordContext) SETS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSETS, 0) +} + +func (s *Unreserved_keywordContext) SHARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSHARE, 0) +} + +func (s *Unreserved_keywordContext) SHOW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSHOW, 0) +} + +func (s *Unreserved_keywordContext) SIMPLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSIMPLE, 0) +} + +func (s *Unreserved_keywordContext) SKIP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSKIP_P, 0) +} + +func (s *Unreserved_keywordContext) SNAPSHOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSNAPSHOT, 0) +} + +func (s *Unreserved_keywordContext) SQL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSQL_P, 0) +} + +func (s *Unreserved_keywordContext) STABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTABLE, 0) +} + +func (s *Unreserved_keywordContext) STANDALONE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTANDALONE_P, 0) +} + +func (s *Unreserved_keywordContext) START() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTART, 0) +} + +func (s *Unreserved_keywordContext) STATEMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATEMENT, 0) +} + +func (s *Unreserved_keywordContext) STATISTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATISTICS, 0) +} + +func (s *Unreserved_keywordContext) STDIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTDIN, 0) +} + +func (s *Unreserved_keywordContext) STDOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTDOUT, 0) +} + +func (s *Unreserved_keywordContext) STORAGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTORAGE, 0) +} + +func (s *Unreserved_keywordContext) STORED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTORED, 0) +} + +func (s *Unreserved_keywordContext) STRICT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRICT_P, 0) +} + +func (s *Unreserved_keywordContext) STRIP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRIP_P, 0) +} + +func (s *Unreserved_keywordContext) SUBSCRIPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSCRIPTION, 0) +} + +func (s *Unreserved_keywordContext) SUPPORT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUPPORT, 0) +} + +func (s *Unreserved_keywordContext) SYSID() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYSID, 0) +} + +func (s *Unreserved_keywordContext) SYSTEM_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYSTEM_P, 0) +} + +func (s *Unreserved_keywordContext) TABLES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLES, 0) +} + +func (s *Unreserved_keywordContext) TABLESPACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESPACE, 0) +} + +func (s *Unreserved_keywordContext) TEMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMP, 0) +} + +func (s *Unreserved_keywordContext) TEMPLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPLATE, 0) +} + +func (s *Unreserved_keywordContext) TEMPORARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEMPORARY, 0) +} + +func (s *Unreserved_keywordContext) TEXT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTEXT_P, 0) +} + +func (s *Unreserved_keywordContext) TIES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIES, 0) +} + +func (s *Unreserved_keywordContext) TRANSACTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSACTION, 0) +} + +func (s *Unreserved_keywordContext) TRANSFORM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSFORM, 0) +} + +func (s *Unreserved_keywordContext) TRIGGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIGGER, 0) +} + +func (s *Unreserved_keywordContext) TRUNCATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUNCATE, 0) +} + +func (s *Unreserved_keywordContext) TRUSTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUSTED, 0) +} + +func (s *Unreserved_keywordContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *Unreserved_keywordContext) TYPES_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPES_P, 0) +} + +func (s *Unreserved_keywordContext) UESCAPE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUESCAPE, 0) +} + +func (s *Unreserved_keywordContext) UNBOUNDED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNBOUNDED, 0) +} + +func (s *Unreserved_keywordContext) UNCOMMITTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNCOMMITTED, 0) +} + +func (s *Unreserved_keywordContext) UNENCRYPTED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNENCRYPTED, 0) +} + +func (s *Unreserved_keywordContext) UNKNOWN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNKNOWN, 0) +} + +func (s *Unreserved_keywordContext) UNLISTEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNLISTEN, 0) +} + +func (s *Unreserved_keywordContext) UNLOGGED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNLOGGED, 0) +} + +func (s *Unreserved_keywordContext) UNTIL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNTIL, 0) +} + +func (s *Unreserved_keywordContext) UPDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPDATE, 0) +} + +func (s *Unreserved_keywordContext) VACUUM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVACUUM, 0) +} + +func (s *Unreserved_keywordContext) VALID() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALID, 0) +} + +func (s *Unreserved_keywordContext) VALIDATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALIDATE, 0) +} + +func (s *Unreserved_keywordContext) VALIDATOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALIDATOR, 0) +} + +func (s *Unreserved_keywordContext) VALUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUE_P, 0) +} + +func (s *Unreserved_keywordContext) VARYING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARYING, 0) +} + +func (s *Unreserved_keywordContext) VERSION_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERSION_P, 0) +} + +func (s *Unreserved_keywordContext) VIEW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEW, 0) +} + +func (s *Unreserved_keywordContext) VIEWS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVIEWS, 0) +} + +func (s *Unreserved_keywordContext) VOLATILE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVOLATILE, 0) +} + +func (s *Unreserved_keywordContext) WHITESPACE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHITESPACE_P, 0) +} + +func (s *Unreserved_keywordContext) WITHIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITHIN, 0) +} + +func (s *Unreserved_keywordContext) WITHOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITHOUT, 0) +} + +func (s *Unreserved_keywordContext) WORK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWORK, 0) +} + +func (s *Unreserved_keywordContext) WRAPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRAPPER, 0) +} + +func (s *Unreserved_keywordContext) WRITE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWRITE, 0) +} + +func (s *Unreserved_keywordContext) XML_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXML_P, 0) +} + +func (s *Unreserved_keywordContext) YEAR_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserYEAR_P, 0) +} + +func (s *Unreserved_keywordContext) YES_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserYES_P, 0) +} + +func (s *Unreserved_keywordContext) ZONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserZONE, 0) +} + +func (s *Unreserved_keywordContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Unreserved_keywordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Unreserved_keywordContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterUnreserved_keyword(s) + } +} + +func (s *Unreserved_keywordContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitUnreserved_keyword(s) + } +} + +func (s *Unreserved_keywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitUnreserved_keyword(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Unreserved_keyword() (localctx IUnreserved_keywordContext) { + localctx = NewUnreserved_keywordContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1398, PostgreSQLParserRULE_unreserved_keyword) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10439) + _la = p.GetTokenStream().LA(1) + + if !(((int64((_la-124)) & ^0x3f) == 0 && ((int64(1)<<(_la-124))&-31) != 0) || ((int64((_la-188)) & ^0x3f) == 0 && ((int64(1)<<(_la-188))&-4611686018427387905) != 0) || ((int64((_la-252)) & ^0x3f) == 0 && ((int64(1)<<(_la-252))&-4503599627370499) != 0) || ((int64((_la-316)) & ^0x3f) == 0 && ((int64(1)<<(_la-316))&-1) != 0) || ((int64((_la-380)) & ^0x3f) == 0 && ((int64(1)<<(_la-380))&-36028796985409535) != 0) || ((int64((_la-444)) & ^0x3f) == 0 && ((int64(1)<<(_la-444))&140680311597055) != 0)) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICol_name_keywordContext is an interface to support dynamic dispatch. +type ICol_name_keywordContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BETWEEN() antlr.TerminalNode + BIGINT() antlr.TerminalNode + Bit() IBitContext + BOOLEAN_P() antlr.TerminalNode + CHAR_P() antlr.TerminalNode + Character() ICharacterContext + COALESCE() antlr.TerminalNode + DEC() antlr.TerminalNode + DECIMAL_P() antlr.TerminalNode + EXISTS() antlr.TerminalNode + EXTRACT() antlr.TerminalNode + FLOAT_P() antlr.TerminalNode + GREATEST() antlr.TerminalNode + GROUPING() antlr.TerminalNode + INOUT() antlr.TerminalNode + INT_P() antlr.TerminalNode + INTEGER() antlr.TerminalNode + INTERVAL() antlr.TerminalNode + LEAST() antlr.TerminalNode + NATIONAL() antlr.TerminalNode + NCHAR() antlr.TerminalNode + NONE() antlr.TerminalNode + NORMALIZE() antlr.TerminalNode + NULLIF() antlr.TerminalNode + Numeric() INumericContext + OUT_P() antlr.TerminalNode + OVERLAY() antlr.TerminalNode + POSITION() antlr.TerminalNode + PRECISION() antlr.TerminalNode + REAL() antlr.TerminalNode + ROW() antlr.TerminalNode + SETOF() antlr.TerminalNode + SMALLINT() antlr.TerminalNode + SUBSTRING() antlr.TerminalNode + TIME() antlr.TerminalNode + TIMESTAMP() antlr.TerminalNode + TREAT() antlr.TerminalNode + TRIM() antlr.TerminalNode + VALUES() antlr.TerminalNode + VARCHAR() antlr.TerminalNode + XMLATTRIBUTES() antlr.TerminalNode + XMLCONCAT() antlr.TerminalNode + XMLELEMENT() antlr.TerminalNode + XMLEXISTS() antlr.TerminalNode + XMLFOREST() antlr.TerminalNode + XMLNAMESPACES() antlr.TerminalNode + XMLPARSE() antlr.TerminalNode + XMLPI() antlr.TerminalNode + XMLROOT() antlr.TerminalNode + XMLSERIALIZE() antlr.TerminalNode + XMLTABLE() antlr.TerminalNode + Builtin_function_name() IBuiltin_function_nameContext + + // IsCol_name_keywordContext differentiates from other interfaces. + IsCol_name_keywordContext() +} + +type Col_name_keywordContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCol_name_keywordContext() *Col_name_keywordContext { + var p = new(Col_name_keywordContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_col_name_keyword + return p +} + +func InitEmptyCol_name_keywordContext(p *Col_name_keywordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_col_name_keyword +} + +func (*Col_name_keywordContext) IsCol_name_keywordContext() {} + +func NewCol_name_keywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Col_name_keywordContext { + var p = new(Col_name_keywordContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_col_name_keyword + + return p +} + +func (s *Col_name_keywordContext) GetParser() antlr.Parser { return s.parser } + +func (s *Col_name_keywordContext) BETWEEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBETWEEN, 0) +} + +func (s *Col_name_keywordContext) BIGINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBIGINT, 0) +} + +func (s *Col_name_keywordContext) Bit() IBitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBitContext) +} + +func (s *Col_name_keywordContext) BOOLEAN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBOOLEAN_P, 0) +} + +func (s *Col_name_keywordContext) CHAR_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHAR_P, 0) +} + +func (s *Col_name_keywordContext) Character() ICharacterContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICharacterContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICharacterContext) +} + +func (s *Col_name_keywordContext) COALESCE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOALESCE, 0) +} + +func (s *Col_name_keywordContext) DEC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEC, 0) +} + +func (s *Col_name_keywordContext) DECIMAL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDECIMAL_P, 0) +} + +func (s *Col_name_keywordContext) EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXISTS, 0) +} + +func (s *Col_name_keywordContext) EXTRACT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXTRACT, 0) +} + +func (s *Col_name_keywordContext) FLOAT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFLOAT_P, 0) +} + +func (s *Col_name_keywordContext) GREATEST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGREATEST, 0) +} + +func (s *Col_name_keywordContext) GROUPING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUPING, 0) +} + +func (s *Col_name_keywordContext) INOUT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINOUT, 0) +} + +func (s *Col_name_keywordContext) INT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINT_P, 0) +} + +func (s *Col_name_keywordContext) INTEGER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTEGER, 0) +} + +func (s *Col_name_keywordContext) INTERVAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTERVAL, 0) +} + +func (s *Col_name_keywordContext) LEAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEAST, 0) +} + +func (s *Col_name_keywordContext) NATIONAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNATIONAL, 0) +} + +func (s *Col_name_keywordContext) NCHAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNCHAR, 0) +} + +func (s *Col_name_keywordContext) NONE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNONE, 0) +} + +func (s *Col_name_keywordContext) NORMALIZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNORMALIZE, 0) +} + +func (s *Col_name_keywordContext) NULLIF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULLIF, 0) +} + +func (s *Col_name_keywordContext) Numeric() INumericContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumericContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumericContext) +} + +func (s *Col_name_keywordContext) OUT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOUT_P, 0) +} + +func (s *Col_name_keywordContext) OVERLAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOVERLAY, 0) +} + +func (s *Col_name_keywordContext) POSITION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPOSITION, 0) +} + +func (s *Col_name_keywordContext) PRECISION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRECISION, 0) +} + +func (s *Col_name_keywordContext) REAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREAL, 0) +} + +func (s *Col_name_keywordContext) ROW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROW, 0) +} + +func (s *Col_name_keywordContext) SETOF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSETOF, 0) +} + +func (s *Col_name_keywordContext) SMALLINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSMALLINT, 0) +} + +func (s *Col_name_keywordContext) SUBSTRING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSTRING, 0) +} + +func (s *Col_name_keywordContext) TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIME, 0) +} + +func (s *Col_name_keywordContext) TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIMESTAMP, 0) +} + +func (s *Col_name_keywordContext) TREAT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTREAT, 0) +} + +func (s *Col_name_keywordContext) TRIM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIM, 0) +} + +func (s *Col_name_keywordContext) VALUES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVALUES, 0) +} + +func (s *Col_name_keywordContext) VARCHAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARCHAR, 0) +} + +func (s *Col_name_keywordContext) XMLATTRIBUTES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLATTRIBUTES, 0) +} + +func (s *Col_name_keywordContext) XMLCONCAT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLCONCAT, 0) +} + +func (s *Col_name_keywordContext) XMLELEMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLELEMENT, 0) +} + +func (s *Col_name_keywordContext) XMLEXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLEXISTS, 0) +} + +func (s *Col_name_keywordContext) XMLFOREST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLFOREST, 0) +} + +func (s *Col_name_keywordContext) XMLNAMESPACES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLNAMESPACES, 0) +} + +func (s *Col_name_keywordContext) XMLPARSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLPARSE, 0) +} + +func (s *Col_name_keywordContext) XMLPI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLPI, 0) +} + +func (s *Col_name_keywordContext) XMLROOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLROOT, 0) +} + +func (s *Col_name_keywordContext) XMLSERIALIZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLSERIALIZE, 0) +} + +func (s *Col_name_keywordContext) XMLTABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLTABLE, 0) +} + +func (s *Col_name_keywordContext) Builtin_function_name() IBuiltin_function_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBuiltin_function_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBuiltin_function_nameContext) +} + +func (s *Col_name_keywordContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Col_name_keywordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Col_name_keywordContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCol_name_keyword(s) + } +} + +func (s *Col_name_keywordContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCol_name_keyword(s) + } +} + +func (s *Col_name_keywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCol_name_keyword(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Col_name_keyword() (localctx ICol_name_keywordContext) { + localctx = NewCol_name_keywordContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1400, PostgreSQLParserRULE_col_name_keyword) + p.SetState(10493) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1012, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10441) + p.Match(PostgreSQLParserBETWEEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10442) + p.Match(PostgreSQLParserBIGINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10443) + p.Bit() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10444) + p.Match(PostgreSQLParserBOOLEAN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10445) + p.Match(PostgreSQLParserCHAR_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10446) + p.Character() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(10447) + p.Match(PostgreSQLParserCOALESCE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(10448) + p.Match(PostgreSQLParserDEC) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(10449) + p.Match(PostgreSQLParserDECIMAL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(10450) + p.Match(PostgreSQLParserEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(10451) + p.Match(PostgreSQLParserEXTRACT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(10452) + p.Match(PostgreSQLParserFLOAT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(10453) + p.Match(PostgreSQLParserGREATEST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(10454) + p.Match(PostgreSQLParserGROUPING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(10455) + p.Match(PostgreSQLParserINOUT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(10456) + p.Match(PostgreSQLParserINT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(10457) + p.Match(PostgreSQLParserINTEGER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(10458) + p.Match(PostgreSQLParserINTERVAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 19: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(10459) + p.Match(PostgreSQLParserLEAST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 20: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(10460) + p.Match(PostgreSQLParserNATIONAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 21: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(10461) + p.Match(PostgreSQLParserNCHAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 22: + p.EnterOuterAlt(localctx, 22) + { + p.SetState(10462) + p.Match(PostgreSQLParserNONE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 23: + p.EnterOuterAlt(localctx, 23) + { + p.SetState(10463) + p.Match(PostgreSQLParserNORMALIZE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 24: + p.EnterOuterAlt(localctx, 24) + { + p.SetState(10464) + p.Match(PostgreSQLParserNULLIF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 25: + p.EnterOuterAlt(localctx, 25) + { + p.SetState(10465) + p.Numeric() + } + + case 26: + p.EnterOuterAlt(localctx, 26) + { + p.SetState(10466) + p.Match(PostgreSQLParserOUT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 27: + p.EnterOuterAlt(localctx, 27) + { + p.SetState(10467) + p.Match(PostgreSQLParserOVERLAY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 28: + p.EnterOuterAlt(localctx, 28) + { + p.SetState(10468) + p.Match(PostgreSQLParserPOSITION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 29: + p.EnterOuterAlt(localctx, 29) + { + p.SetState(10469) + p.Match(PostgreSQLParserPRECISION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 30: + p.EnterOuterAlt(localctx, 30) + { + p.SetState(10470) + p.Match(PostgreSQLParserREAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 31: + p.EnterOuterAlt(localctx, 31) + { + p.SetState(10471) + p.Match(PostgreSQLParserROW) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 32: + p.EnterOuterAlt(localctx, 32) + { + p.SetState(10472) + p.Match(PostgreSQLParserSETOF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 33: + p.EnterOuterAlt(localctx, 33) + { + p.SetState(10473) + p.Match(PostgreSQLParserSMALLINT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 34: + p.EnterOuterAlt(localctx, 34) + { + p.SetState(10474) + p.Match(PostgreSQLParserSUBSTRING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 35: + p.EnterOuterAlt(localctx, 35) + { + p.SetState(10475) + p.Match(PostgreSQLParserTIME) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 36: + p.EnterOuterAlt(localctx, 36) + { + p.SetState(10476) + p.Match(PostgreSQLParserTIMESTAMP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 37: + p.EnterOuterAlt(localctx, 37) + { + p.SetState(10477) + p.Match(PostgreSQLParserTREAT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 38: + p.EnterOuterAlt(localctx, 38) + { + p.SetState(10478) + p.Match(PostgreSQLParserTRIM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 39: + p.EnterOuterAlt(localctx, 39) + { + p.SetState(10479) + p.Match(PostgreSQLParserVALUES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 40: + p.EnterOuterAlt(localctx, 40) + { + p.SetState(10480) + p.Match(PostgreSQLParserVARCHAR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 41: + p.EnterOuterAlt(localctx, 41) + { + p.SetState(10481) + p.Match(PostgreSQLParserXMLATTRIBUTES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 42: + p.EnterOuterAlt(localctx, 42) + { + p.SetState(10482) + p.Match(PostgreSQLParserXMLCONCAT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 43: + p.EnterOuterAlt(localctx, 43) + { + p.SetState(10483) + p.Match(PostgreSQLParserXMLELEMENT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 44: + p.EnterOuterAlt(localctx, 44) + { + p.SetState(10484) + p.Match(PostgreSQLParserXMLEXISTS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 45: + p.EnterOuterAlt(localctx, 45) + { + p.SetState(10485) + p.Match(PostgreSQLParserXMLFOREST) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 46: + p.EnterOuterAlt(localctx, 46) + { + p.SetState(10486) + p.Match(PostgreSQLParserXMLNAMESPACES) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 47: + p.EnterOuterAlt(localctx, 47) + { + p.SetState(10487) + p.Match(PostgreSQLParserXMLPARSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 48: + p.EnterOuterAlt(localctx, 48) + { + p.SetState(10488) + p.Match(PostgreSQLParserXMLPI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 49: + p.EnterOuterAlt(localctx, 49) + { + p.SetState(10489) + p.Match(PostgreSQLParserXMLROOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 50: + p.EnterOuterAlt(localctx, 50) + { + p.SetState(10490) + p.Match(PostgreSQLParserXMLSERIALIZE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 51: + p.EnterOuterAlt(localctx, 51) + { + p.SetState(10491) + p.Match(PostgreSQLParserXMLTABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 52: + p.EnterOuterAlt(localctx, 52) + { + p.SetState(10492) + p.Builtin_function_name() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IType_func_name_keywordContext is an interface to support dynamic dispatch. +type IType_func_name_keywordContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AUTHORIZATION() antlr.TerminalNode + BINARY() antlr.TerminalNode + COLLATION() antlr.TerminalNode + CONCURRENTLY() antlr.TerminalNode + CROSS() antlr.TerminalNode + CURRENT_SCHEMA() antlr.TerminalNode + FREEZE() antlr.TerminalNode + FULL() antlr.TerminalNode + ILIKE() antlr.TerminalNode + INNER_P() antlr.TerminalNode + IS() antlr.TerminalNode + ISNULL() antlr.TerminalNode + JOIN() antlr.TerminalNode + LIKE() antlr.TerminalNode + NATURAL() antlr.TerminalNode + NOTNULL() antlr.TerminalNode + OUTER_P() antlr.TerminalNode + OVERLAPS() antlr.TerminalNode + SIMILAR() antlr.TerminalNode + TABLESAMPLE() antlr.TerminalNode + VERBOSE() antlr.TerminalNode + + // IsType_func_name_keywordContext differentiates from other interfaces. + IsType_func_name_keywordContext() +} + +type Type_func_name_keywordContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyType_func_name_keywordContext() *Type_func_name_keywordContext { + var p = new(Type_func_name_keywordContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_type_func_name_keyword + return p +} + +func InitEmptyType_func_name_keywordContext(p *Type_func_name_keywordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_type_func_name_keyword +} + +func (*Type_func_name_keywordContext) IsType_func_name_keywordContext() {} + +func NewType_func_name_keywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Type_func_name_keywordContext { + var p = new(Type_func_name_keywordContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_type_func_name_keyword + + return p +} + +func (s *Type_func_name_keywordContext) GetParser() antlr.Parser { return s.parser } + +func (s *Type_func_name_keywordContext) AUTHORIZATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAUTHORIZATION, 0) +} + +func (s *Type_func_name_keywordContext) BINARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBINARY, 0) +} + +func (s *Type_func_name_keywordContext) COLLATION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATION, 0) +} + +func (s *Type_func_name_keywordContext) CONCURRENTLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONCURRENTLY, 0) +} + +func (s *Type_func_name_keywordContext) CROSS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCROSS, 0) +} + +func (s *Type_func_name_keywordContext) CURRENT_SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_SCHEMA, 0) +} + +func (s *Type_func_name_keywordContext) FREEZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFREEZE, 0) +} + +func (s *Type_func_name_keywordContext) FULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFULL, 0) +} + +func (s *Type_func_name_keywordContext) ILIKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserILIKE, 0) +} + +func (s *Type_func_name_keywordContext) INNER_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINNER_P, 0) +} + +func (s *Type_func_name_keywordContext) IS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIS, 0) +} + +func (s *Type_func_name_keywordContext) ISNULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserISNULL, 0) +} + +func (s *Type_func_name_keywordContext) JOIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserJOIN, 0) +} + +func (s *Type_func_name_keywordContext) LIKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIKE, 0) +} + +func (s *Type_func_name_keywordContext) NATURAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNATURAL, 0) +} + +func (s *Type_func_name_keywordContext) NOTNULL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTNULL, 0) +} + +func (s *Type_func_name_keywordContext) OUTER_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOUTER_P, 0) +} + +func (s *Type_func_name_keywordContext) OVERLAPS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOVERLAPS, 0) +} + +func (s *Type_func_name_keywordContext) SIMILAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSIMILAR, 0) +} + +func (s *Type_func_name_keywordContext) TABLESAMPLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLESAMPLE, 0) +} + +func (s *Type_func_name_keywordContext) VERBOSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVERBOSE, 0) +} + +func (s *Type_func_name_keywordContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Type_func_name_keywordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Type_func_name_keywordContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterType_func_name_keyword(s) + } +} + +func (s *Type_func_name_keywordContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitType_func_name_keyword(s) + } +} + +func (s *Type_func_name_keywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitType_func_name_keyword(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Type_func_name_keyword() (localctx IType_func_name_keywordContext) { + localctx = NewType_func_name_keywordContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1402, PostgreSQLParserRULE_type_func_name_keyword) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10495) + _la = p.GetTokenStream().LA(1) + + if !(((int64((_la-106)) & ^0x3f) == 0 && ((int64(1)<<(_la-106))&7069695) != 0) || _la == PostgreSQLParserTABLESAMPLE) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IReserved_keywordContext is an interface to support dynamic dispatch. +type IReserved_keywordContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ALL() antlr.TerminalNode + ANALYSE() antlr.TerminalNode + ANALYZE() antlr.TerminalNode + AND() antlr.TerminalNode + ANY() antlr.TerminalNode + ARRAY() antlr.TerminalNode + AS() antlr.TerminalNode + ASC() antlr.TerminalNode + ASYMMETRIC() antlr.TerminalNode + BOTH() antlr.TerminalNode + CASE() antlr.TerminalNode + CAST() antlr.TerminalNode + CHECK() antlr.TerminalNode + COLLATE() antlr.TerminalNode + COLUMN() antlr.TerminalNode + CONSTRAINT() antlr.TerminalNode + CREATE() antlr.TerminalNode + CURRENT_CATALOG() antlr.TerminalNode + CURRENT_DATE() antlr.TerminalNode + CURRENT_ROLE() antlr.TerminalNode + CURRENT_TIME() antlr.TerminalNode + CURRENT_TIMESTAMP() antlr.TerminalNode + CURRENT_USER() antlr.TerminalNode + DEFERRABLE() antlr.TerminalNode + DESC() antlr.TerminalNode + DISTINCT() antlr.TerminalNode + DO() antlr.TerminalNode + ELSE() antlr.TerminalNode + END_P() antlr.TerminalNode + EXCEPT() antlr.TerminalNode + FALSE_P() antlr.TerminalNode + FETCH() antlr.TerminalNode + FOR() antlr.TerminalNode + FOREIGN() antlr.TerminalNode + FROM() antlr.TerminalNode + GRANT() antlr.TerminalNode + GROUP_P() antlr.TerminalNode + HAVING() antlr.TerminalNode + IN_P() antlr.TerminalNode + INITIALLY() antlr.TerminalNode + INTERSECT() antlr.TerminalNode + LATERAL_P() antlr.TerminalNode + LEADING() antlr.TerminalNode + LIMIT() antlr.TerminalNode + LOCALTIME() antlr.TerminalNode + LOCALTIMESTAMP() antlr.TerminalNode + NOT() antlr.TerminalNode + NULL_P() antlr.TerminalNode + OFFSET() antlr.TerminalNode + ON() antlr.TerminalNode + ONLY() antlr.TerminalNode + OR() antlr.TerminalNode + ORDER() antlr.TerminalNode + PLACING() antlr.TerminalNode + PRIMARY() antlr.TerminalNode + REFERENCES() antlr.TerminalNode + RETURNING() antlr.TerminalNode + SELECT() antlr.TerminalNode + SESSION_USER() antlr.TerminalNode + SOME() antlr.TerminalNode + SYMMETRIC() antlr.TerminalNode + TABLE() antlr.TerminalNode + THEN() antlr.TerminalNode + TO() antlr.TerminalNode + TRAILING() antlr.TerminalNode + TRUE_P() antlr.TerminalNode + UNION() antlr.TerminalNode + UNIQUE() antlr.TerminalNode + USER() antlr.TerminalNode + USING() antlr.TerminalNode + VARIADIC() antlr.TerminalNode + WHEN() antlr.TerminalNode + WHERE() antlr.TerminalNode + WINDOW() antlr.TerminalNode + WITH() antlr.TerminalNode + + // IsReserved_keywordContext differentiates from other interfaces. + IsReserved_keywordContext() +} + +type Reserved_keywordContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyReserved_keywordContext() *Reserved_keywordContext { + var p = new(Reserved_keywordContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reserved_keyword + return p +} + +func InitEmptyReserved_keywordContext(p *Reserved_keywordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_reserved_keyword +} + +func (*Reserved_keywordContext) IsReserved_keywordContext() {} + +func NewReserved_keywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Reserved_keywordContext { + var p = new(Reserved_keywordContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_reserved_keyword + + return p +} + +func (s *Reserved_keywordContext) GetParser() antlr.Parser { return s.parser } + +func (s *Reserved_keywordContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Reserved_keywordContext) ANALYSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserANALYSE, 0) +} + +func (s *Reserved_keywordContext) ANALYZE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserANALYZE, 0) +} + +func (s *Reserved_keywordContext) AND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, 0) +} + +func (s *Reserved_keywordContext) ANY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserANY, 0) +} + +func (s *Reserved_keywordContext) ARRAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserARRAY, 0) +} + +func (s *Reserved_keywordContext) AS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAS, 0) +} + +func (s *Reserved_keywordContext) ASC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASC, 0) +} + +func (s *Reserved_keywordContext) ASYMMETRIC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASYMMETRIC, 0) +} + +func (s *Reserved_keywordContext) BOTH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBOTH, 0) +} + +func (s *Reserved_keywordContext) CASE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASE, 0) +} + +func (s *Reserved_keywordContext) CAST() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCAST, 0) +} + +func (s *Reserved_keywordContext) CHECK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHECK, 0) +} + +func (s *Reserved_keywordContext) COLLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATE, 0) +} + +func (s *Reserved_keywordContext) COLUMN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLUMN, 0) +} + +func (s *Reserved_keywordContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *Reserved_keywordContext) CREATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCREATE, 0) +} + +func (s *Reserved_keywordContext) CURRENT_CATALOG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_CATALOG, 0) +} + +func (s *Reserved_keywordContext) CURRENT_DATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_DATE, 0) +} + +func (s *Reserved_keywordContext) CURRENT_ROLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_ROLE, 0) +} + +func (s *Reserved_keywordContext) CURRENT_TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_TIME, 0) +} + +func (s *Reserved_keywordContext) CURRENT_TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_TIMESTAMP, 0) +} + +func (s *Reserved_keywordContext) CURRENT_USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_USER, 0) +} + +func (s *Reserved_keywordContext) DEFERRABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFERRABLE, 0) +} + +func (s *Reserved_keywordContext) DESC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDESC, 0) +} + +func (s *Reserved_keywordContext) DISTINCT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDISTINCT, 0) +} + +func (s *Reserved_keywordContext) DO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDO, 0) +} + +func (s *Reserved_keywordContext) ELSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserELSE, 0) +} + +func (s *Reserved_keywordContext) END_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEND_P, 0) +} + +func (s *Reserved_keywordContext) EXCEPT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCEPT, 0) +} + +func (s *Reserved_keywordContext) FALSE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFALSE_P, 0) +} + +func (s *Reserved_keywordContext) FETCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFETCH, 0) +} + +func (s *Reserved_keywordContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Reserved_keywordContext) FOREIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREIGN, 0) +} + +func (s *Reserved_keywordContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Reserved_keywordContext) GRANT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGRANT, 0) +} + +func (s *Reserved_keywordContext) GROUP_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGROUP_P, 0) +} + +func (s *Reserved_keywordContext) HAVING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserHAVING, 0) +} + +func (s *Reserved_keywordContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Reserved_keywordContext) INITIALLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINITIALLY, 0) +} + +func (s *Reserved_keywordContext) INTERSECT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTERSECT, 0) +} + +func (s *Reserved_keywordContext) LATERAL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLATERAL_P, 0) +} + +func (s *Reserved_keywordContext) LEADING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLEADING, 0) +} + +func (s *Reserved_keywordContext) LIMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLIMIT, 0) +} + +func (s *Reserved_keywordContext) LOCALTIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCALTIME, 0) +} + +func (s *Reserved_keywordContext) LOCALTIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOCALTIMESTAMP, 0) +} + +func (s *Reserved_keywordContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Reserved_keywordContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Reserved_keywordContext) OFFSET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOFFSET, 0) +} + +func (s *Reserved_keywordContext) ON() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserON, 0) +} + +func (s *Reserved_keywordContext) ONLY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserONLY, 0) +} + +func (s *Reserved_keywordContext) OR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOR, 0) +} + +func (s *Reserved_keywordContext) ORDER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserORDER, 0) +} + +func (s *Reserved_keywordContext) PLACING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPLACING, 0) +} + +func (s *Reserved_keywordContext) PRIMARY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIMARY, 0) +} + +func (s *Reserved_keywordContext) REFERENCES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREFERENCES, 0) +} + +func (s *Reserved_keywordContext) RETURNING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRETURNING, 0) +} + +func (s *Reserved_keywordContext) SELECT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSELECT, 0) +} + +func (s *Reserved_keywordContext) SESSION_USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSESSION_USER, 0) +} + +func (s *Reserved_keywordContext) SOME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSOME, 0) +} + +func (s *Reserved_keywordContext) SYMMETRIC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSYMMETRIC, 0) +} + +func (s *Reserved_keywordContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Reserved_keywordContext) THEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, 0) +} + +func (s *Reserved_keywordContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Reserved_keywordContext) TRAILING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRAILING, 0) +} + +func (s *Reserved_keywordContext) TRUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUE_P, 0) +} + +func (s *Reserved_keywordContext) UNION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNION, 0) +} + +func (s *Reserved_keywordContext) UNIQUE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNIQUE, 0) +} + +func (s *Reserved_keywordContext) USER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSER, 0) +} + +func (s *Reserved_keywordContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Reserved_keywordContext) VARIADIC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARIADIC, 0) +} + +func (s *Reserved_keywordContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *Reserved_keywordContext) WHERE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHERE, 0) +} + +func (s *Reserved_keywordContext) WINDOW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWINDOW, 0) +} + +func (s *Reserved_keywordContext) WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWITH, 0) +} + +func (s *Reserved_keywordContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Reserved_keywordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Reserved_keywordContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterReserved_keyword(s) + } +} + +func (s *Reserved_keywordContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitReserved_keyword(s) + } +} + +func (s *Reserved_keywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitReserved_keyword(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Reserved_keyword() (localctx IReserved_keywordContext) { + localctx = NewReserved_keywordContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1404, PostgreSQLParserRULE_reserved_keyword) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10497) + _la = p.GetTokenStream().LA(1) + + if !(((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&-9007200328482816) != 0) || ((int64((_la-64)) & ^0x3f) == 0 && ((int64(1)<<(_la-64))&4398046510975) != 0) || _la == PostgreSQLParserEND_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IBuiltin_function_nameContext is an interface to support dynamic dispatch. +type IBuiltin_function_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + XMLCOMMENT() antlr.TerminalNode + XML_IS_WELL_FORMED() antlr.TerminalNode + XML_IS_WELL_FORMED_DOCUMENT() antlr.TerminalNode + XML_IS_WELL_FORMED_CONTENT() antlr.TerminalNode + XMLAGG() antlr.TerminalNode + XPATH() antlr.TerminalNode + XPATH_EXISTS() antlr.TerminalNode + ABS() antlr.TerminalNode + CBRT() antlr.TerminalNode + CEIL() antlr.TerminalNode + CEILING() antlr.TerminalNode + DEGREES() antlr.TerminalNode + DIV() antlr.TerminalNode + EXP() antlr.TerminalNode + FACTORIAL() antlr.TerminalNode + FLOOR() antlr.TerminalNode + GCD() antlr.TerminalNode + LCM() antlr.TerminalNode + LN() antlr.TerminalNode + LOG() antlr.TerminalNode + LOG10() antlr.TerminalNode + MIN_SCALE() antlr.TerminalNode + MOD() antlr.TerminalNode + PI() antlr.TerminalNode + POWER() antlr.TerminalNode + RADIANS() antlr.TerminalNode + ROUND() antlr.TerminalNode + SCALE() antlr.TerminalNode + SIGN() antlr.TerminalNode + SQRT() antlr.TerminalNode + TRIM_SCALE() antlr.TerminalNode + TRUNC() antlr.TerminalNode + WIDTH_BUCKET() antlr.TerminalNode + RANDOM() antlr.TerminalNode + SETSEED() antlr.TerminalNode + ACOS() antlr.TerminalNode + ACOSD() antlr.TerminalNode + ACOSH() antlr.TerminalNode + ASIN() antlr.TerminalNode + ASIND() antlr.TerminalNode + ASINH() antlr.TerminalNode + ATAN() antlr.TerminalNode + ATAND() antlr.TerminalNode + ATANH() antlr.TerminalNode + ATAN2() antlr.TerminalNode + ATAN2D() antlr.TerminalNode + COS() antlr.TerminalNode + COSD() antlr.TerminalNode + COSH() antlr.TerminalNode + COT() antlr.TerminalNode + COTD() antlr.TerminalNode + SIN() antlr.TerminalNode + SIND() antlr.TerminalNode + SINH() antlr.TerminalNode + TAN() antlr.TerminalNode + TAND() antlr.TerminalNode + TANH() antlr.TerminalNode + BIT_LENGTH() antlr.TerminalNode + CHAR_LENGTH() antlr.TerminalNode + CHARACTER_LENGTH() antlr.TerminalNode + LOWER() antlr.TerminalNode + OCTET_LENGTH() antlr.TerminalNode + UPPER() antlr.TerminalNode + ASCII() antlr.TerminalNode + BTRIM() antlr.TerminalNode + CHR() antlr.TerminalNode + CONCAT() antlr.TerminalNode + CONCAT_WS() antlr.TerminalNode + FORMAT() antlr.TerminalNode + INITCAP() antlr.TerminalNode + LENGTH() antlr.TerminalNode + LPAD() antlr.TerminalNode + LTRIM() antlr.TerminalNode + MD5() antlr.TerminalNode + PARSE_IDENT() antlr.TerminalNode + PG_CLIENT_ENCODING() antlr.TerminalNode + QUOTE_IDENT() antlr.TerminalNode + QUOTE_LITERAL() antlr.TerminalNode + QUOTE_NULLABLE() antlr.TerminalNode + REGEXP_COUNT() antlr.TerminalNode + REGEXP_INSTR() antlr.TerminalNode + REGEXP_LIKE() antlr.TerminalNode + REGEXP_MATCH() antlr.TerminalNode + REGEXP_MATCHES() antlr.TerminalNode + REGEXP_REPLACE() antlr.TerminalNode + REGEXP_SPLIT_TO_ARRAY() antlr.TerminalNode + REGEXP_SPLIT_TO_TABLE() antlr.TerminalNode + REGEXP_SUBSTR() antlr.TerminalNode + REPEAT() antlr.TerminalNode + REPLACE() antlr.TerminalNode + REVERSE() antlr.TerminalNode + RPAD() antlr.TerminalNode + RTRIM() antlr.TerminalNode + SPLIT_PART() antlr.TerminalNode + STARTS_WITH() antlr.TerminalNode + STRING_TO_ARRAY() antlr.TerminalNode + STRING_TO_TABLE() antlr.TerminalNode + STRPOS() antlr.TerminalNode + SUBSTR() antlr.TerminalNode + TO_ASCII() antlr.TerminalNode + TO_HEX() antlr.TerminalNode + TRANSLATE() antlr.TerminalNode + UNISTR() antlr.TerminalNode + AGE() antlr.TerminalNode + DATE_BIN() antlr.TerminalNode + DATE_PART() antlr.TerminalNode + DATE_TRUNC() antlr.TerminalNode + ISFINITE() antlr.TerminalNode + JUSTIFY_DAYS() antlr.TerminalNode + JUSTIFY_HOURS() antlr.TerminalNode + JUSTIFY_INTERVAL() antlr.TerminalNode + MAKE_DATE() antlr.TerminalNode + MAKE_INTERVAL() antlr.TerminalNode + MAKE_TIME() antlr.TerminalNode + MAKE_TIMESTAMP() antlr.TerminalNode + MAKE_TIMESTAMPTZ() antlr.TerminalNode + CLOCK_TIMESTAMP() antlr.TerminalNode + NOW() antlr.TerminalNode + STATEMENT_TIMESTAMP() antlr.TerminalNode + TIMEOFDAY() antlr.TerminalNode + TRANSACTION_TIMESTAMP() antlr.TerminalNode + TO_TIMESTAMP() antlr.TerminalNode + TO_CHAR() antlr.TerminalNode + TO_DATE() antlr.TerminalNode + TO_NUMBER() antlr.TerminalNode + + // IsBuiltin_function_nameContext differentiates from other interfaces. + IsBuiltin_function_nameContext() +} + +type Builtin_function_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBuiltin_function_nameContext() *Builtin_function_nameContext { + var p = new(Builtin_function_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_builtin_function_name + return p +} + +func InitEmptyBuiltin_function_nameContext(p *Builtin_function_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_builtin_function_name +} + +func (*Builtin_function_nameContext) IsBuiltin_function_nameContext() {} + +func NewBuiltin_function_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Builtin_function_nameContext { + var p = new(Builtin_function_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_builtin_function_name + + return p +} + +func (s *Builtin_function_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Builtin_function_nameContext) XMLCOMMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLCOMMENT, 0) +} + +func (s *Builtin_function_nameContext) XML_IS_WELL_FORMED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXML_IS_WELL_FORMED, 0) +} + +func (s *Builtin_function_nameContext) XML_IS_WELL_FORMED_DOCUMENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, 0) +} + +func (s *Builtin_function_nameContext) XML_IS_WELL_FORMED_CONTENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, 0) +} + +func (s *Builtin_function_nameContext) XMLAGG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXMLAGG, 0) +} + +func (s *Builtin_function_nameContext) XPATH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXPATH, 0) +} + +func (s *Builtin_function_nameContext) XPATH_EXISTS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserXPATH_EXISTS, 0) +} + +func (s *Builtin_function_nameContext) ABS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserABS, 0) +} + +func (s *Builtin_function_nameContext) CBRT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCBRT, 0) +} + +func (s *Builtin_function_nameContext) CEIL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCEIL, 0) +} + +func (s *Builtin_function_nameContext) CEILING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCEILING, 0) +} + +func (s *Builtin_function_nameContext) DEGREES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEGREES, 0) +} + +func (s *Builtin_function_nameContext) DIV() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDIV, 0) +} + +func (s *Builtin_function_nameContext) EXP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXP, 0) +} + +func (s *Builtin_function_nameContext) FACTORIAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFACTORIAL, 0) +} + +func (s *Builtin_function_nameContext) FLOOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFLOOR, 0) +} + +func (s *Builtin_function_nameContext) GCD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGCD, 0) +} + +func (s *Builtin_function_nameContext) LCM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLCM, 0) +} + +func (s *Builtin_function_nameContext) LN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLN, 0) +} + +func (s *Builtin_function_nameContext) LOG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOG, 0) +} + +func (s *Builtin_function_nameContext) LOG10() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOG10, 0) +} + +func (s *Builtin_function_nameContext) MIN_SCALE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMIN_SCALE, 0) +} + +func (s *Builtin_function_nameContext) MOD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMOD, 0) +} + +func (s *Builtin_function_nameContext) PI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPI, 0) +} + +func (s *Builtin_function_nameContext) POWER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPOWER, 0) +} + +func (s *Builtin_function_nameContext) RADIANS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRADIANS, 0) +} + +func (s *Builtin_function_nameContext) ROUND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROUND, 0) +} + +func (s *Builtin_function_nameContext) SCALE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCALE, 0) +} + +func (s *Builtin_function_nameContext) SIGN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSIGN, 0) +} + +func (s *Builtin_function_nameContext) SQRT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSQRT, 0) +} + +func (s *Builtin_function_nameContext) TRIM_SCALE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRIM_SCALE, 0) +} + +func (s *Builtin_function_nameContext) TRUNC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRUNC, 0) +} + +func (s *Builtin_function_nameContext) WIDTH_BUCKET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWIDTH_BUCKET, 0) +} + +func (s *Builtin_function_nameContext) RANDOM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRANDOM, 0) +} + +func (s *Builtin_function_nameContext) SETSEED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSETSEED, 0) +} + +func (s *Builtin_function_nameContext) ACOS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACOS, 0) +} + +func (s *Builtin_function_nameContext) ACOSD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACOSD, 0) +} + +func (s *Builtin_function_nameContext) ACOSH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserACOSH, 0) +} + +func (s *Builtin_function_nameContext) ASIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASIN, 0) +} + +func (s *Builtin_function_nameContext) ASIND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASIND, 0) +} + +func (s *Builtin_function_nameContext) ASINH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASINH, 0) +} + +func (s *Builtin_function_nameContext) ATAN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATAN, 0) +} + +func (s *Builtin_function_nameContext) ATAND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATAND, 0) +} + +func (s *Builtin_function_nameContext) ATANH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATANH, 0) +} + +func (s *Builtin_function_nameContext) ATAN2() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATAN2, 0) +} + +func (s *Builtin_function_nameContext) ATAN2D() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserATAN2D, 0) +} + +func (s *Builtin_function_nameContext) COS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOS, 0) +} + +func (s *Builtin_function_nameContext) COSD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOSD, 0) +} + +func (s *Builtin_function_nameContext) COSH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOSH, 0) +} + +func (s *Builtin_function_nameContext) COT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOT, 0) +} + +func (s *Builtin_function_nameContext) COTD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOTD, 0) +} + +func (s *Builtin_function_nameContext) SIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSIN, 0) +} + +func (s *Builtin_function_nameContext) SIND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSIND, 0) +} + +func (s *Builtin_function_nameContext) SINH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSINH, 0) +} + +func (s *Builtin_function_nameContext) TAN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTAN, 0) +} + +func (s *Builtin_function_nameContext) TAND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTAND, 0) +} + +func (s *Builtin_function_nameContext) TANH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTANH, 0) +} + +func (s *Builtin_function_nameContext) BIT_LENGTH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBIT_LENGTH, 0) +} + +func (s *Builtin_function_nameContext) CHAR_LENGTH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHAR_LENGTH, 0) +} + +func (s *Builtin_function_nameContext) CHARACTER_LENGTH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHARACTER_LENGTH, 0) +} + +func (s *Builtin_function_nameContext) LOWER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOWER, 0) +} + +func (s *Builtin_function_nameContext) OCTET_LENGTH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOCTET_LENGTH, 0) +} + +func (s *Builtin_function_nameContext) UPPER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUPPER, 0) +} + +func (s *Builtin_function_nameContext) ASCII() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASCII, 0) +} + +func (s *Builtin_function_nameContext) BTRIM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBTRIM, 0) +} + +func (s *Builtin_function_nameContext) CHR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHR, 0) +} + +func (s *Builtin_function_nameContext) CONCAT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONCAT, 0) +} + +func (s *Builtin_function_nameContext) CONCAT_WS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONCAT_WS, 0) +} + +func (s *Builtin_function_nameContext) FORMAT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORMAT, 0) +} + +func (s *Builtin_function_nameContext) INITCAP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINITCAP, 0) +} + +func (s *Builtin_function_nameContext) LENGTH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLENGTH, 0) +} + +func (s *Builtin_function_nameContext) LPAD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLPAD, 0) +} + +func (s *Builtin_function_nameContext) LTRIM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLTRIM, 0) +} + +func (s *Builtin_function_nameContext) MD5() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMD5, 0) +} + +func (s *Builtin_function_nameContext) PARSE_IDENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARSE_IDENT, 0) +} + +func (s *Builtin_function_nameContext) PG_CLIENT_ENCODING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPG_CLIENT_ENCODING, 0) +} + +func (s *Builtin_function_nameContext) QUOTE_IDENT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserQUOTE_IDENT, 0) +} + +func (s *Builtin_function_nameContext) QUOTE_LITERAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserQUOTE_LITERAL, 0) +} + +func (s *Builtin_function_nameContext) QUOTE_NULLABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserQUOTE_NULLABLE, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_COUNT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_COUNT, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_INSTR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_INSTR, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_LIKE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_LIKE, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_MATCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_MATCH, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_MATCHES() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_MATCHES, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_REPLACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_REPLACE, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_SPLIT_TO_ARRAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_SPLIT_TO_TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_SPLIT_TO_TABLE, 0) +} + +func (s *Builtin_function_nameContext) REGEXP_SUBSTR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREGEXP_SUBSTR, 0) +} + +func (s *Builtin_function_nameContext) REPEAT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPEAT, 0) +} + +func (s *Builtin_function_nameContext) REPLACE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREPLACE, 0) +} + +func (s *Builtin_function_nameContext) REVERSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREVERSE, 0) +} + +func (s *Builtin_function_nameContext) RPAD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRPAD, 0) +} + +func (s *Builtin_function_nameContext) RTRIM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRTRIM, 0) +} + +func (s *Builtin_function_nameContext) SPLIT_PART() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSPLIT_PART, 0) +} + +func (s *Builtin_function_nameContext) STARTS_WITH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTARTS_WITH, 0) +} + +func (s *Builtin_function_nameContext) STRING_TO_ARRAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRING_TO_ARRAY, 0) +} + +func (s *Builtin_function_nameContext) STRING_TO_TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRING_TO_TABLE, 0) +} + +func (s *Builtin_function_nameContext) STRPOS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRPOS, 0) +} + +func (s *Builtin_function_nameContext) SUBSTR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSUBSTR, 0) +} + +func (s *Builtin_function_nameContext) TO_ASCII() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO_ASCII, 0) +} + +func (s *Builtin_function_nameContext) TO_HEX() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO_HEX, 0) +} + +func (s *Builtin_function_nameContext) TRANSLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSLATE, 0) +} + +func (s *Builtin_function_nameContext) UNISTR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUNISTR, 0) +} + +func (s *Builtin_function_nameContext) AGE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAGE, 0) +} + +func (s *Builtin_function_nameContext) DATE_BIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATE_BIN, 0) +} + +func (s *Builtin_function_nameContext) DATE_PART() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATE_PART, 0) +} + +func (s *Builtin_function_nameContext) DATE_TRUNC() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDATE_TRUNC, 0) +} + +func (s *Builtin_function_nameContext) ISFINITE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserISFINITE, 0) +} + +func (s *Builtin_function_nameContext) JUSTIFY_DAYS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserJUSTIFY_DAYS, 0) +} + +func (s *Builtin_function_nameContext) JUSTIFY_HOURS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserJUSTIFY_HOURS, 0) +} + +func (s *Builtin_function_nameContext) JUSTIFY_INTERVAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserJUSTIFY_INTERVAL, 0) +} + +func (s *Builtin_function_nameContext) MAKE_DATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAKE_DATE, 0) +} + +func (s *Builtin_function_nameContext) MAKE_INTERVAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAKE_INTERVAL, 0) +} + +func (s *Builtin_function_nameContext) MAKE_TIME() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAKE_TIME, 0) +} + +func (s *Builtin_function_nameContext) MAKE_TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAKE_TIMESTAMP, 0) +} + +func (s *Builtin_function_nameContext) MAKE_TIMESTAMPTZ() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMAKE_TIMESTAMPTZ, 0) +} + +func (s *Builtin_function_nameContext) CLOCK_TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOCK_TIMESTAMP, 0) +} + +func (s *Builtin_function_nameContext) NOW() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOW, 0) +} + +func (s *Builtin_function_nameContext) STATEMENT_TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTATEMENT_TIMESTAMP, 0) +} + +func (s *Builtin_function_nameContext) TIMEOFDAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTIMEOFDAY, 0) +} + +func (s *Builtin_function_nameContext) TRANSACTION_TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTRANSACTION_TIMESTAMP, 0) +} + +func (s *Builtin_function_nameContext) TO_TIMESTAMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO_TIMESTAMP, 0) +} + +func (s *Builtin_function_nameContext) TO_CHAR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO_CHAR, 0) +} + +func (s *Builtin_function_nameContext) TO_DATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO_DATE, 0) +} + +func (s *Builtin_function_nameContext) TO_NUMBER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO_NUMBER, 0) +} + +func (s *Builtin_function_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Builtin_function_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Builtin_function_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterBuiltin_function_name(s) + } +} + +func (s *Builtin_function_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitBuiltin_function_name(s) + } +} + +func (s *Builtin_function_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitBuiltin_function_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Builtin_function_name() (localctx IBuiltin_function_nameContext) { + localctx = NewBuiltin_function_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1406, PostgreSQLParserRULE_builtin_function_name) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10499) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserREPLACE || ((int64((_la-420)) & ^0x3f) == 0 && ((int64(1)<<(_la-420))&127) != 0) || ((int64((_la-506)) & ^0x3f) == 0 && ((int64(1)<<(_la-506))&-130559) != 0) || ((int64((_la-570)) & ^0x3f) == 0 && ((int64(1)<<(_la-570))&-1) != 0) || ((int64((_la-634)) & ^0x3f) == 0 && ((int64(1)<<(_la-634))&15) != 0)) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPl_functionContext is an interface to support dynamic dispatch. +type IPl_functionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Comp_options() IComp_optionsContext + Pl_block() IPl_blockContext + Opt_semi() IOpt_semiContext + + // IsPl_functionContext differentiates from other interfaces. + IsPl_functionContext() +} + +type Pl_functionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPl_functionContext() *Pl_functionContext { + var p = new(Pl_functionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_pl_function + return p +} + +func InitEmptyPl_functionContext(p *Pl_functionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_pl_function +} + +func (*Pl_functionContext) IsPl_functionContext() {} + +func NewPl_functionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pl_functionContext { + var p = new(Pl_functionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_pl_function + + return p +} + +func (s *Pl_functionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Pl_functionContext) Comp_options() IComp_optionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IComp_optionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IComp_optionsContext) +} + +func (s *Pl_functionContext) Pl_block() IPl_blockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPl_blockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPl_blockContext) +} + +func (s *Pl_functionContext) Opt_semi() IOpt_semiContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_semiContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_semiContext) +} + +func (s *Pl_functionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Pl_functionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Pl_functionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPl_function(s) + } +} + +func (s *Pl_functionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPl_function(s) + } +} + +func (s *Pl_functionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPl_function(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Pl_function() (localctx IPl_functionContext) { + localctx = NewPl_functionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1408, PostgreSQLParserRULE_pl_function) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10501) + p.Comp_options() + } + { + p.SetState(10502) + p.Pl_block() + } + p.SetState(10504) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSEMI { + { + p.SetState(10503) + p.Opt_semi() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IComp_optionsContext is an interface to support dynamic dispatch. +type IComp_optionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllComp_option() []IComp_optionContext + Comp_option(i int) IComp_optionContext + + // IsComp_optionsContext differentiates from other interfaces. + IsComp_optionsContext() +} + +type Comp_optionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyComp_optionsContext() *Comp_optionsContext { + var p = new(Comp_optionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_comp_options + return p +} + +func InitEmptyComp_optionsContext(p *Comp_optionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_comp_options +} + +func (*Comp_optionsContext) IsComp_optionsContext() {} + +func NewComp_optionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Comp_optionsContext { + var p = new(Comp_optionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_comp_options + + return p +} + +func (s *Comp_optionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Comp_optionsContext) AllComp_option() []IComp_optionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IComp_optionContext); ok { + len++ + } + } + + tst := make([]IComp_optionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IComp_optionContext); ok { + tst[i] = t.(IComp_optionContext) + i++ + } + } + + return tst +} + +func (s *Comp_optionsContext) Comp_option(i int) IComp_optionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IComp_optionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IComp_optionContext) +} + +func (s *Comp_optionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Comp_optionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Comp_optionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterComp_options(s) + } +} + +func (s *Comp_optionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitComp_options(s) + } +} + +func (s *Comp_optionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitComp_options(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Comp_options() (localctx IComp_optionsContext) { + localctx = NewComp_optionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1410, PostgreSQLParserRULE_comp_options) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10509) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserOperator { + { + p.SetState(10506) + p.Comp_option() + } + + p.SetState(10511) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IComp_optionContext is an interface to support dynamic dispatch. +type IComp_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sharp() ISharpContext + OPTION() antlr.TerminalNode + DUMP() antlr.TerminalNode + PRINT_STRICT_PARAMS() antlr.TerminalNode + Option_value() IOption_valueContext + VARIABLE_CONFLICT() antlr.TerminalNode + ERROR() antlr.TerminalNode + USE_VARIABLE() antlr.TerminalNode + USE_COLUMN() antlr.TerminalNode + + // IsComp_optionContext differentiates from other interfaces. + IsComp_optionContext() +} + +type Comp_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyComp_optionContext() *Comp_optionContext { + var p = new(Comp_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_comp_option + return p +} + +func InitEmptyComp_optionContext(p *Comp_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_comp_option +} + +func (*Comp_optionContext) IsComp_optionContext() {} + +func NewComp_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Comp_optionContext { + var p = new(Comp_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_comp_option + + return p +} + +func (s *Comp_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Comp_optionContext) Sharp() ISharpContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISharpContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISharpContext) +} + +func (s *Comp_optionContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *Comp_optionContext) DUMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDUMP, 0) +} + +func (s *Comp_optionContext) PRINT_STRICT_PARAMS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRINT_STRICT_PARAMS, 0) +} + +func (s *Comp_optionContext) Option_value() IOption_valueContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOption_valueContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOption_valueContext) +} + +func (s *Comp_optionContext) VARIABLE_CONFLICT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARIABLE_CONFLICT, 0) +} + +func (s *Comp_optionContext) ERROR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserERROR, 0) +} + +func (s *Comp_optionContext) USE_VARIABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSE_VARIABLE, 0) +} + +func (s *Comp_optionContext) USE_COLUMN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSE_COLUMN, 0) +} + +func (s *Comp_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Comp_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Comp_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterComp_option(s) + } +} + +func (s *Comp_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitComp_option(s) + } +} + +func (s *Comp_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitComp_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Comp_option() (localctx IComp_optionContext) { + localctx = NewComp_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1412, PostgreSQLParserRULE_comp_option) + p.SetState(10532) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1015, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10512) + p.Sharp() + } + { + p.SetState(10513) + p.Match(PostgreSQLParserOPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10514) + p.Match(PostgreSQLParserDUMP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10516) + p.Sharp() + } + { + p.SetState(10517) + p.Match(PostgreSQLParserPRINT_STRICT_PARAMS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10518) + p.Option_value() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10520) + p.Sharp() + } + { + p.SetState(10521) + p.Match(PostgreSQLParserVARIABLE_CONFLICT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10522) + p.Match(PostgreSQLParserERROR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10524) + p.Sharp() + } + { + p.SetState(10525) + p.Match(PostgreSQLParserVARIABLE_CONFLICT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10526) + p.Match(PostgreSQLParserUSE_VARIABLE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10528) + p.Sharp() + } + { + p.SetState(10529) + p.Match(PostgreSQLParserVARIABLE_CONFLICT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10530) + p.Match(PostgreSQLParserUSE_COLUMN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISharpContext is an interface to support dynamic dispatch. +type ISharpContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Operator() antlr.TerminalNode + + // IsSharpContext differentiates from other interfaces. + IsSharpContext() +} + +type SharpContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySharpContext() *SharpContext { + var p = new(SharpContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sharp + return p +} + +func InitEmptySharpContext(p *SharpContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sharp +} + +func (*SharpContext) IsSharpContext() {} + +func NewSharpContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SharpContext { + var p = new(SharpContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_sharp + + return p +} + +func (s *SharpContext) GetParser() antlr.Parser { return s.parser } + +func (s *SharpContext) Operator() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOperator, 0) +} + +func (s *SharpContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SharpContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SharpContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSharp(s) + } +} + +func (s *SharpContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSharp(s) + } +} + +func (s *SharpContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSharp(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Sharp() (localctx ISharpContext) { + localctx = NewSharpContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1414, PostgreSQLParserRULE_sharp) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10534) + p.Match(PostgreSQLParserOperator) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOption_valueContext is an interface to support dynamic dispatch. +type IOption_valueContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sconst() ISconstContext + Reserved_keyword() IReserved_keywordContext + Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext + Unreserved_keyword() IUnreserved_keywordContext + + // IsOption_valueContext differentiates from other interfaces. + IsOption_valueContext() +} + +type Option_valueContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOption_valueContext() *Option_valueContext { + var p = new(Option_valueContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_option_value + return p +} + +func InitEmptyOption_valueContext(p *Option_valueContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_option_value +} + +func (*Option_valueContext) IsOption_valueContext() {} + +func NewOption_valueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Option_valueContext { + var p = new(Option_valueContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_option_value + + return p +} + +func (s *Option_valueContext) GetParser() antlr.Parser { return s.parser } + +func (s *Option_valueContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Option_valueContext) Reserved_keyword() IReserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IReserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IReserved_keywordContext) +} + +func (s *Option_valueContext) Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_unreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_unreserved_keywordContext) +} + +func (s *Option_valueContext) Unreserved_keyword() IUnreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnreserved_keywordContext) +} + +func (s *Option_valueContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Option_valueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Option_valueContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOption_value(s) + } +} + +func (s *Option_valueContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOption_value(s) + } +} + +func (s *Option_valueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOption_value(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Option_value() (localctx IOption_valueContext) { + localctx = NewOption_valueContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1416, PostgreSQLParserRULE_option_value) + p.SetState(10540) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1016, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10536) + p.Sconst() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10537) + p.Reserved_keyword() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10538) + p.Plsql_unreserved_keyword() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10539) + p.Unreserved_keyword() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_semiContext is an interface to support dynamic dispatch. +type IOpt_semiContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SEMI() antlr.TerminalNode + + // IsOpt_semiContext differentiates from other interfaces. + IsOpt_semiContext() +} + +type Opt_semiContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_semiContext() *Opt_semiContext { + var p = new(Opt_semiContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_semi + return p +} + +func InitEmptyOpt_semiContext(p *Opt_semiContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_semi +} + +func (*Opt_semiContext) IsOpt_semiContext() {} + +func NewOpt_semiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_semiContext { + var p = new(Opt_semiContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_semi + + return p +} + +func (s *Opt_semiContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_semiContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Opt_semiContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_semiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_semiContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_semi(s) + } +} + +func (s *Opt_semiContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_semi(s) + } +} + +func (s *Opt_semiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_semi(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_semi() (localctx IOpt_semiContext) { + localctx = NewOpt_semiContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1418, PostgreSQLParserRULE_opt_semi) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10542) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPl_blockContext is an interface to support dynamic dispatch. +type IPl_blockContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Decl_sect() IDecl_sectContext + BEGIN_P() antlr.TerminalNode + Proc_sect() IProc_sectContext + END_P() antlr.TerminalNode + Exception_sect() IException_sectContext + Opt_label() IOpt_labelContext + + // IsPl_blockContext differentiates from other interfaces. + IsPl_blockContext() +} + +type Pl_blockContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPl_blockContext() *Pl_blockContext { + var p = new(Pl_blockContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_pl_block + return p +} + +func InitEmptyPl_blockContext(p *Pl_blockContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_pl_block +} + +func (*Pl_blockContext) IsPl_blockContext() {} + +func NewPl_blockContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Pl_blockContext { + var p = new(Pl_blockContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_pl_block + + return p +} + +func (s *Pl_blockContext) GetParser() antlr.Parser { return s.parser } + +func (s *Pl_blockContext) Decl_sect() IDecl_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_sectContext) +} + +func (s *Pl_blockContext) BEGIN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBEGIN_P, 0) +} + +func (s *Pl_blockContext) Proc_sect() IProc_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_sectContext) +} + +func (s *Pl_blockContext) END_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEND_P, 0) +} + +func (s *Pl_blockContext) Exception_sect() IException_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IException_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IException_sectContext) +} + +func (s *Pl_blockContext) Opt_label() IOpt_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_labelContext) +} + +func (s *Pl_blockContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Pl_blockContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Pl_blockContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPl_block(s) + } +} + +func (s *Pl_blockContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPl_block(s) + } +} + +func (s *Pl_blockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPl_block(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Pl_block() (localctx IPl_blockContext) { + localctx = NewPl_blockContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1420, PostgreSQLParserRULE_pl_block) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10544) + p.Decl_sect() + } + { + p.SetState(10545) + p.Match(PostgreSQLParserBEGIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10546) + p.Proc_sect() + } + p.SetState(10548) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserEXCEPTION { + { + p.SetState(10547) + p.Exception_sect() + } + + } + { + p.SetState(10550) + p.Match(PostgreSQLParserEND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10552) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(10551) + p.Opt_label() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_sectContext is an interface to support dynamic dispatch. +type IDecl_sectContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Opt_block_label() IOpt_block_labelContext + Decl_start() IDecl_startContext + Decl_stmts() IDecl_stmtsContext + + // IsDecl_sectContext differentiates from other interfaces. + IsDecl_sectContext() +} + +type Decl_sectContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_sectContext() *Decl_sectContext { + var p = new(Decl_sectContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_sect + return p +} + +func InitEmptyDecl_sectContext(p *Decl_sectContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_sect +} + +func (*Decl_sectContext) IsDecl_sectContext() {} + +func NewDecl_sectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_sectContext { + var p = new(Decl_sectContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_sect + + return p +} + +func (s *Decl_sectContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_sectContext) Opt_block_label() IOpt_block_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_block_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_block_labelContext) +} + +func (s *Decl_sectContext) Decl_start() IDecl_startContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_startContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_startContext) +} + +func (s *Decl_sectContext) Decl_stmts() IDecl_stmtsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_stmtsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_stmtsContext) +} + +func (s *Decl_sectContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_sectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_sectContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_sect(s) + } +} + +func (s *Decl_sectContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_sect(s) + } +} + +func (s *Decl_sectContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_sect(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_sect() (localctx IDecl_sectContext) { + localctx = NewDecl_sectContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1422, PostgreSQLParserRULE_decl_sect) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10555) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserLESS_LESS { + { + p.SetState(10554) + p.Opt_block_label() + } + + } + p.SetState(10561) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserDECLARE { + { + p.SetState(10557) + p.Decl_start() + } + p.SetState(10559) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1020, p.GetParserRuleContext()) == 1 { + { + p.SetState(10558) + p.Decl_stmts() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_startContext is an interface to support dynamic dispatch. +type IDecl_startContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DECLARE() antlr.TerminalNode + + // IsDecl_startContext differentiates from other interfaces. + IsDecl_startContext() +} + +type Decl_startContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_startContext() *Decl_startContext { + var p = new(Decl_startContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_start + return p +} + +func InitEmptyDecl_startContext(p *Decl_startContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_start +} + +func (*Decl_startContext) IsDecl_startContext() {} + +func NewDecl_startContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_startContext { + var p = new(Decl_startContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_start + + return p +} + +func (s *Decl_startContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_startContext) DECLARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDECLARE, 0) +} + +func (s *Decl_startContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_startContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_startContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_start(s) + } +} + +func (s *Decl_startContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_start(s) + } +} + +func (s *Decl_startContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_start(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_start() (localctx IDecl_startContext) { + localctx = NewDecl_startContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1424, PostgreSQLParserRULE_decl_start) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10563) + p.Match(PostgreSQLParserDECLARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_stmtsContext is an interface to support dynamic dispatch. +type IDecl_stmtsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllDecl_stmt() []IDecl_stmtContext + Decl_stmt(i int) IDecl_stmtContext + + // IsDecl_stmtsContext differentiates from other interfaces. + IsDecl_stmtsContext() +} + +type Decl_stmtsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_stmtsContext() *Decl_stmtsContext { + var p = new(Decl_stmtsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_stmts + return p +} + +func InitEmptyDecl_stmtsContext(p *Decl_stmtsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_stmts +} + +func (*Decl_stmtsContext) IsDecl_stmtsContext() {} + +func NewDecl_stmtsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_stmtsContext { + var p = new(Decl_stmtsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_stmts + + return p +} + +func (s *Decl_stmtsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_stmtsContext) AllDecl_stmt() []IDecl_stmtContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IDecl_stmtContext); ok { + len++ + } + } + + tst := make([]IDecl_stmtContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IDecl_stmtContext); ok { + tst[i] = t.(IDecl_stmtContext) + i++ + } + } + + return tst +} + +func (s *Decl_stmtsContext) Decl_stmt(i int) IDecl_stmtContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_stmtContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IDecl_stmtContext) +} + +func (s *Decl_stmtsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_stmtsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_stmtsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_stmts(s) + } +} + +func (s *Decl_stmtsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_stmts(s) + } +} + +func (s *Decl_stmtsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_stmts(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_stmts() (localctx IDecl_stmtsContext) { + localctx = NewDecl_stmtsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1426, PostgreSQLParserRULE_decl_stmts) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10566) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(10565) + p.Decl_stmt() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(10568) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1022, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILabel_declContext is an interface to support dynamic dispatch. +type ILabel_declContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LESS_LESS() antlr.TerminalNode + Any_identifier() IAny_identifierContext + GREATER_GREATER() antlr.TerminalNode + + // IsLabel_declContext differentiates from other interfaces. + IsLabel_declContext() +} + +type Label_declContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLabel_declContext() *Label_declContext { + var p = new(Label_declContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_label_decl + return p +} + +func InitEmptyLabel_declContext(p *Label_declContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_label_decl +} + +func (*Label_declContext) IsLabel_declContext() {} + +func NewLabel_declContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Label_declContext { + var p = new(Label_declContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_label_decl + + return p +} + +func (s *Label_declContext) GetParser() antlr.Parser { return s.parser } + +func (s *Label_declContext) LESS_LESS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLESS_LESS, 0) +} + +func (s *Label_declContext) Any_identifier() IAny_identifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_identifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_identifierContext) +} + +func (s *Label_declContext) GREATER_GREATER() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGREATER_GREATER, 0) +} + +func (s *Label_declContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Label_declContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Label_declContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterLabel_decl(s) + } +} + +func (s *Label_declContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitLabel_decl(s) + } +} + +func (s *Label_declContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitLabel_decl(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Label_decl() (localctx ILabel_declContext) { + localctx = NewLabel_declContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1428, PostgreSQLParserRULE_label_decl) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10570) + p.Match(PostgreSQLParserLESS_LESS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10571) + p.Any_identifier() + } + { + p.SetState(10572) + p.Match(PostgreSQLParserGREATER_GREATER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_stmtContext is an interface to support dynamic dispatch. +type IDecl_stmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Decl_statement() IDecl_statementContext + DECLARE() antlr.TerminalNode + Label_decl() ILabel_declContext + + // IsDecl_stmtContext differentiates from other interfaces. + IsDecl_stmtContext() +} + +type Decl_stmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_stmtContext() *Decl_stmtContext { + var p = new(Decl_stmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_stmt + return p +} + +func InitEmptyDecl_stmtContext(p *Decl_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_stmt +} + +func (*Decl_stmtContext) IsDecl_stmtContext() {} + +func NewDecl_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_stmtContext { + var p = new(Decl_stmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_stmt + + return p +} + +func (s *Decl_stmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_stmtContext) Decl_statement() IDecl_statementContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_statementContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_statementContext) +} + +func (s *Decl_stmtContext) DECLARE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDECLARE, 0) +} + +func (s *Decl_stmtContext) Label_decl() ILabel_declContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILabel_declContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILabel_declContext) +} + +func (s *Decl_stmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_stmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_stmt(s) + } +} + +func (s *Decl_stmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_stmt(s) + } +} + +func (s *Decl_stmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_stmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_stmt() (localctx IDecl_stmtContext) { + localctx = NewDecl_stmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1430, PostgreSQLParserRULE_decl_stmt) + p.SetState(10577) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1023, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10574) + p.Decl_statement() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10575) + p.Match(PostgreSQLParserDECLARE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10576) + p.Label_decl() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_statementContext is an interface to support dynamic dispatch. +type IDecl_statementContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Decl_varname() IDecl_varnameContext + SEMI() antlr.TerminalNode + ALIAS() antlr.TerminalNode + FOR() antlr.TerminalNode + Decl_aliasitem() IDecl_aliasitemContext + Decl_datatype() IDecl_datatypeContext + CURSOR() antlr.TerminalNode + Decl_is_for() IDecl_is_forContext + Decl_cursor_query() IDecl_cursor_queryContext + Decl_const() IDecl_constContext + Decl_collate() IDecl_collateContext + Decl_notnull() IDecl_notnullContext + Decl_defval() IDecl_defvalContext + Opt_scrollable() IOpt_scrollableContext + Decl_cursor_args() IDecl_cursor_argsContext + + // IsDecl_statementContext differentiates from other interfaces. + IsDecl_statementContext() +} + +type Decl_statementContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_statementContext() *Decl_statementContext { + var p = new(Decl_statementContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_statement + return p +} + +func InitEmptyDecl_statementContext(p *Decl_statementContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_statement +} + +func (*Decl_statementContext) IsDecl_statementContext() {} + +func NewDecl_statementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_statementContext { + var p = new(Decl_statementContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_statement + + return p +} + +func (s *Decl_statementContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_statementContext) Decl_varname() IDecl_varnameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_varnameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_varnameContext) +} + +func (s *Decl_statementContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Decl_statementContext) ALIAS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALIAS, 0) +} + +func (s *Decl_statementContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Decl_statementContext) Decl_aliasitem() IDecl_aliasitemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_aliasitemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_aliasitemContext) +} + +func (s *Decl_statementContext) Decl_datatype() IDecl_datatypeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_datatypeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_datatypeContext) +} + +func (s *Decl_statementContext) CURSOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURSOR, 0) +} + +func (s *Decl_statementContext) Decl_is_for() IDecl_is_forContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_is_forContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_is_forContext) +} + +func (s *Decl_statementContext) Decl_cursor_query() IDecl_cursor_queryContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_cursor_queryContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_cursor_queryContext) +} + +func (s *Decl_statementContext) Decl_const() IDecl_constContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_constContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_constContext) +} + +func (s *Decl_statementContext) Decl_collate() IDecl_collateContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_collateContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_collateContext) +} + +func (s *Decl_statementContext) Decl_notnull() IDecl_notnullContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_notnullContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_notnullContext) +} + +func (s *Decl_statementContext) Decl_defval() IDecl_defvalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_defvalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_defvalContext) +} + +func (s *Decl_statementContext) Opt_scrollable() IOpt_scrollableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_scrollableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_scrollableContext) +} + +func (s *Decl_statementContext) Decl_cursor_args() IDecl_cursor_argsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_cursor_argsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_cursor_argsContext) +} + +func (s *Decl_statementContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_statementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_statementContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_statement(s) + } +} + +func (s *Decl_statementContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_statement(s) + } +} + +func (s *Decl_statementContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_statement(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_statement() (localctx IDecl_statementContext) { + localctx = NewDecl_statementContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1432, PostgreSQLParserRULE_decl_statement) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10579) + p.Decl_varname() + } + p.SetState(10606) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1030, p.GetParserRuleContext()) { + case 1: + { + p.SetState(10580) + p.Match(PostgreSQLParserALIAS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10581) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10582) + p.Decl_aliasitem() + } + + case 2: + p.SetState(10584) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1024, p.GetParserRuleContext()) == 1 { + { + p.SetState(10583) + p.Decl_const() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(10586) + p.Decl_datatype() + } + p.SetState(10588) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOLLATE { + { + p.SetState(10587) + p.Decl_collate() + } + + } + p.SetState(10591) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNOT { + { + p.SetState(10590) + p.Decl_notnull() + } + + } + p.SetState(10594) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&9007199255790592) != 0 { + { + p.SetState(10593) + p.Decl_defval() + } + + } + + case 3: + p.SetState(10597) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO || _la == PostgreSQLParserSCROLL { + { + p.SetState(10596) + p.Opt_scrollable() + } + + } + { + p.SetState(10599) + p.Match(PostgreSQLParserCURSOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10601) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(10600) + p.Decl_cursor_args() + } + + } + { + p.SetState(10603) + p.Decl_is_for() + } + { + p.SetState(10604) + p.Decl_cursor_query() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(10608) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_scrollableContext is an interface to support dynamic dispatch. +type IOpt_scrollableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NO() antlr.TerminalNode + SCROLL() antlr.TerminalNode + + // IsOpt_scrollableContext differentiates from other interfaces. + IsOpt_scrollableContext() +} + +type Opt_scrollableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_scrollableContext() *Opt_scrollableContext { + var p = new(Opt_scrollableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_scrollable + return p +} + +func InitEmptyOpt_scrollableContext(p *Opt_scrollableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_scrollable +} + +func (*Opt_scrollableContext) IsOpt_scrollableContext() {} + +func NewOpt_scrollableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_scrollableContext { + var p = new(Opt_scrollableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_scrollable + + return p +} + +func (s *Opt_scrollableContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_scrollableContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Opt_scrollableContext) SCROLL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCROLL, 0) +} + +func (s *Opt_scrollableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_scrollableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_scrollableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_scrollable(s) + } +} + +func (s *Opt_scrollableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_scrollable(s) + } +} + +func (s *Opt_scrollableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_scrollable(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_scrollable() (localctx IOpt_scrollableContext) { + localctx = NewOpt_scrollableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1434, PostgreSQLParserRULE_opt_scrollable) + p.SetState(10613) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserNO: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10610) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10611) + p.Match(PostgreSQLParserSCROLL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserSCROLL: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10612) + p.Match(PostgreSQLParserSCROLL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_cursor_queryContext is an interface to support dynamic dispatch. +type IDecl_cursor_queryContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Selectstmt() ISelectstmtContext + + // IsDecl_cursor_queryContext differentiates from other interfaces. + IsDecl_cursor_queryContext() +} + +type Decl_cursor_queryContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_cursor_queryContext() *Decl_cursor_queryContext { + var p = new(Decl_cursor_queryContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_query + return p +} + +func InitEmptyDecl_cursor_queryContext(p *Decl_cursor_queryContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_query +} + +func (*Decl_cursor_queryContext) IsDecl_cursor_queryContext() {} + +func NewDecl_cursor_queryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_cursor_queryContext { + var p = new(Decl_cursor_queryContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_query + + return p +} + +func (s *Decl_cursor_queryContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_cursor_queryContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *Decl_cursor_queryContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_cursor_queryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_cursor_queryContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_cursor_query(s) + } +} + +func (s *Decl_cursor_queryContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_cursor_query(s) + } +} + +func (s *Decl_cursor_queryContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_cursor_query(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_cursor_query() (localctx IDecl_cursor_queryContext) { + localctx = NewDecl_cursor_queryContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1436, PostgreSQLParserRULE_decl_cursor_query) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10615) + p.Selectstmt() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_cursor_argsContext is an interface to support dynamic dispatch. +type IDecl_cursor_argsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + Decl_cursor_arglist() IDecl_cursor_arglistContext + CLOSE_PAREN() antlr.TerminalNode + + // IsDecl_cursor_argsContext differentiates from other interfaces. + IsDecl_cursor_argsContext() +} + +type Decl_cursor_argsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_cursor_argsContext() *Decl_cursor_argsContext { + var p = new(Decl_cursor_argsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_args + return p +} + +func InitEmptyDecl_cursor_argsContext(p *Decl_cursor_argsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_args +} + +func (*Decl_cursor_argsContext) IsDecl_cursor_argsContext() {} + +func NewDecl_cursor_argsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_cursor_argsContext { + var p = new(Decl_cursor_argsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_args + + return p +} + +func (s *Decl_cursor_argsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_cursor_argsContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Decl_cursor_argsContext) Decl_cursor_arglist() IDecl_cursor_arglistContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_cursor_arglistContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_cursor_arglistContext) +} + +func (s *Decl_cursor_argsContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Decl_cursor_argsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_cursor_argsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_cursor_argsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_cursor_args(s) + } +} + +func (s *Decl_cursor_argsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_cursor_args(s) + } +} + +func (s *Decl_cursor_argsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_cursor_args(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_cursor_args() (localctx IDecl_cursor_argsContext) { + localctx = NewDecl_cursor_argsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1438, PostgreSQLParserRULE_decl_cursor_args) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10617) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10618) + p.Decl_cursor_arglist() + } + { + p.SetState(10619) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_cursor_arglistContext is an interface to support dynamic dispatch. +type IDecl_cursor_arglistContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllDecl_cursor_arg() []IDecl_cursor_argContext + Decl_cursor_arg(i int) IDecl_cursor_argContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsDecl_cursor_arglistContext differentiates from other interfaces. + IsDecl_cursor_arglistContext() +} + +type Decl_cursor_arglistContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_cursor_arglistContext() *Decl_cursor_arglistContext { + var p = new(Decl_cursor_arglistContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_arglist + return p +} + +func InitEmptyDecl_cursor_arglistContext(p *Decl_cursor_arglistContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_arglist +} + +func (*Decl_cursor_arglistContext) IsDecl_cursor_arglistContext() {} + +func NewDecl_cursor_arglistContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_cursor_arglistContext { + var p = new(Decl_cursor_arglistContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_arglist + + return p +} + +func (s *Decl_cursor_arglistContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_cursor_arglistContext) AllDecl_cursor_arg() []IDecl_cursor_argContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IDecl_cursor_argContext); ok { + len++ + } + } + + tst := make([]IDecl_cursor_argContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IDecl_cursor_argContext); ok { + tst[i] = t.(IDecl_cursor_argContext) + i++ + } + } + + return tst +} + +func (s *Decl_cursor_arglistContext) Decl_cursor_arg(i int) IDecl_cursor_argContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_cursor_argContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IDecl_cursor_argContext) +} + +func (s *Decl_cursor_arglistContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Decl_cursor_arglistContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Decl_cursor_arglistContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_cursor_arglistContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_cursor_arglistContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_cursor_arglist(s) + } +} + +func (s *Decl_cursor_arglistContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_cursor_arglist(s) + } +} + +func (s *Decl_cursor_arglistContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_cursor_arglist(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_cursor_arglist() (localctx IDecl_cursor_arglistContext) { + localctx = NewDecl_cursor_arglistContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1440, PostgreSQLParserRULE_decl_cursor_arglist) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10621) + p.Decl_cursor_arg() + } + p.SetState(10626) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10622) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10623) + p.Decl_cursor_arg() + } + + p.SetState(10628) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_cursor_argContext is an interface to support dynamic dispatch. +type IDecl_cursor_argContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Decl_varname() IDecl_varnameContext + Decl_datatype() IDecl_datatypeContext + + // IsDecl_cursor_argContext differentiates from other interfaces. + IsDecl_cursor_argContext() +} + +type Decl_cursor_argContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_cursor_argContext() *Decl_cursor_argContext { + var p = new(Decl_cursor_argContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_arg + return p +} + +func InitEmptyDecl_cursor_argContext(p *Decl_cursor_argContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_arg +} + +func (*Decl_cursor_argContext) IsDecl_cursor_argContext() {} + +func NewDecl_cursor_argContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_cursor_argContext { + var p = new(Decl_cursor_argContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_cursor_arg + + return p +} + +func (s *Decl_cursor_argContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_cursor_argContext) Decl_varname() IDecl_varnameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_varnameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_varnameContext) +} + +func (s *Decl_cursor_argContext) Decl_datatype() IDecl_datatypeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_datatypeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_datatypeContext) +} + +func (s *Decl_cursor_argContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_cursor_argContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_cursor_argContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_cursor_arg(s) + } +} + +func (s *Decl_cursor_argContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_cursor_arg(s) + } +} + +func (s *Decl_cursor_argContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_cursor_arg(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_cursor_arg() (localctx IDecl_cursor_argContext) { + localctx = NewDecl_cursor_argContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1442, PostgreSQLParserRULE_decl_cursor_arg) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10629) + p.Decl_varname() + } + { + p.SetState(10630) + p.Decl_datatype() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_is_forContext is an interface to support dynamic dispatch. +type IDecl_is_forContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IS() antlr.TerminalNode + FOR() antlr.TerminalNode + + // IsDecl_is_forContext differentiates from other interfaces. + IsDecl_is_forContext() +} + +type Decl_is_forContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_is_forContext() *Decl_is_forContext { + var p = new(Decl_is_forContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_is_for + return p +} + +func InitEmptyDecl_is_forContext(p *Decl_is_forContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_is_for +} + +func (*Decl_is_forContext) IsDecl_is_forContext() {} + +func NewDecl_is_forContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_is_forContext { + var p = new(Decl_is_forContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_is_for + + return p +} + +func (s *Decl_is_forContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_is_forContext) IS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIS, 0) +} + +func (s *Decl_is_forContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Decl_is_forContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_is_forContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_is_forContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_is_for(s) + } +} + +func (s *Decl_is_forContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_is_for(s) + } +} + +func (s *Decl_is_forContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_is_for(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_is_for() (localctx IDecl_is_forContext) { + localctx = NewDecl_is_forContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1444, PostgreSQLParserRULE_decl_is_for) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10632) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFOR || _la == PostgreSQLParserIS) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_aliasitemContext is an interface to support dynamic dispatch. +type IDecl_aliasitemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PARAM() antlr.TerminalNode + Colid() IColidContext + + // IsDecl_aliasitemContext differentiates from other interfaces. + IsDecl_aliasitemContext() +} + +type Decl_aliasitemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_aliasitemContext() *Decl_aliasitemContext { + var p = new(Decl_aliasitemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_aliasitem + return p +} + +func InitEmptyDecl_aliasitemContext(p *Decl_aliasitemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_aliasitem +} + +func (*Decl_aliasitemContext) IsDecl_aliasitemContext() {} + +func NewDecl_aliasitemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_aliasitemContext { + var p = new(Decl_aliasitemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_aliasitem + + return p +} + +func (s *Decl_aliasitemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_aliasitemContext) PARAM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARAM, 0) +} + +func (s *Decl_aliasitemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Decl_aliasitemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_aliasitemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_aliasitemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_aliasitem(s) + } +} + +func (s *Decl_aliasitemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_aliasitem(s) + } +} + +func (s *Decl_aliasitemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_aliasitem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_aliasitem() (localctx IDecl_aliasitemContext) { + localctx = NewDecl_aliasitemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1446, PostgreSQLParserRULE_decl_aliasitem) + p.SetState(10636) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserPARAM: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10634) + p.Match(PostgreSQLParserPARAM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10635) + p.Colid() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_varnameContext is an interface to support dynamic dispatch. +type IDecl_varnameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Any_identifier() IAny_identifierContext + + // IsDecl_varnameContext differentiates from other interfaces. + IsDecl_varnameContext() +} + +type Decl_varnameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_varnameContext() *Decl_varnameContext { + var p = new(Decl_varnameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_varname + return p +} + +func InitEmptyDecl_varnameContext(p *Decl_varnameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_varname +} + +func (*Decl_varnameContext) IsDecl_varnameContext() {} + +func NewDecl_varnameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_varnameContext { + var p = new(Decl_varnameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_varname + + return p +} + +func (s *Decl_varnameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_varnameContext) Any_identifier() IAny_identifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_identifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_identifierContext) +} + +func (s *Decl_varnameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_varnameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_varnameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_varname(s) + } +} + +func (s *Decl_varnameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_varname(s) + } +} + +func (s *Decl_varnameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_varname(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_varname() (localctx IDecl_varnameContext) { + localctx = NewDecl_varnameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1448, PostgreSQLParserRULE_decl_varname) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10638) + p.Any_identifier() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_constContext is an interface to support dynamic dispatch. +type IDecl_constContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CONSTANT() antlr.TerminalNode + + // IsDecl_constContext differentiates from other interfaces. + IsDecl_constContext() +} + +type Decl_constContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_constContext() *Decl_constContext { + var p = new(Decl_constContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_const + return p +} + +func InitEmptyDecl_constContext(p *Decl_constContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_const +} + +func (*Decl_constContext) IsDecl_constContext() {} + +func NewDecl_constContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_constContext { + var p = new(Decl_constContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_const + + return p +} + +func (s *Decl_constContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_constContext) CONSTANT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTANT, 0) +} + +func (s *Decl_constContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_constContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_constContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_const(s) + } +} + +func (s *Decl_constContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_const(s) + } +} + +func (s *Decl_constContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_const(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_const() (localctx IDecl_constContext) { + localctx = NewDecl_constContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1450, PostgreSQLParserRULE_decl_const) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10640) + p.Match(PostgreSQLParserCONSTANT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_datatypeContext is an interface to support dynamic dispatch. +type IDecl_datatypeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Typename() ITypenameContext + + // IsDecl_datatypeContext differentiates from other interfaces. + IsDecl_datatypeContext() +} + +type Decl_datatypeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_datatypeContext() *Decl_datatypeContext { + var p = new(Decl_datatypeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_datatype + return p +} + +func InitEmptyDecl_datatypeContext(p *Decl_datatypeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_datatype +} + +func (*Decl_datatypeContext) IsDecl_datatypeContext() {} + +func NewDecl_datatypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_datatypeContext { + var p = new(Decl_datatypeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_datatype + + return p +} + +func (s *Decl_datatypeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_datatypeContext) Typename() ITypenameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ITypenameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ITypenameContext) +} + +func (s *Decl_datatypeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_datatypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_datatypeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_datatype(s) + } +} + +func (s *Decl_datatypeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_datatype(s) + } +} + +func (s *Decl_datatypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_datatype(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_datatype() (localctx IDecl_datatypeContext) { + localctx = NewDecl_datatypeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1452, PostgreSQLParserRULE_decl_datatype) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10642) + p.Typename() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_collateContext is an interface to support dynamic dispatch. +type IDecl_collateContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COLLATE() antlr.TerminalNode + Any_name() IAny_nameContext + + // IsDecl_collateContext differentiates from other interfaces. + IsDecl_collateContext() +} + +type Decl_collateContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_collateContext() *Decl_collateContext { + var p = new(Decl_collateContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_collate + return p +} + +func InitEmptyDecl_collateContext(p *Decl_collateContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_collate +} + +func (*Decl_collateContext) IsDecl_collateContext() {} + +func NewDecl_collateContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_collateContext { + var p = new(Decl_collateContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_collate + + return p +} + +func (s *Decl_collateContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_collateContext) COLLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATE, 0) +} + +func (s *Decl_collateContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Decl_collateContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_collateContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_collateContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_collate(s) + } +} + +func (s *Decl_collateContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_collate(s) + } +} + +func (s *Decl_collateContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_collate(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_collate() (localctx IDecl_collateContext) { + localctx = NewDecl_collateContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1454, PostgreSQLParserRULE_decl_collate) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10644) + p.Match(PostgreSQLParserCOLLATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10645) + p.Any_name() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_notnullContext is an interface to support dynamic dispatch. +type IDecl_notnullContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NOT() antlr.TerminalNode + NULL_P() antlr.TerminalNode + + // IsDecl_notnullContext differentiates from other interfaces. + IsDecl_notnullContext() +} + +type Decl_notnullContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_notnullContext() *Decl_notnullContext { + var p = new(Decl_notnullContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_notnull + return p +} + +func InitEmptyDecl_notnullContext(p *Decl_notnullContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_notnull +} + +func (*Decl_notnullContext) IsDecl_notnullContext() {} + +func NewDecl_notnullContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_notnullContext { + var p = new(Decl_notnullContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_notnull + + return p +} + +func (s *Decl_notnullContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_notnullContext) NOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOT, 0) +} + +func (s *Decl_notnullContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Decl_notnullContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_notnullContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_notnullContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_notnull(s) + } +} + +func (s *Decl_notnullContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_notnull(s) + } +} + +func (s *Decl_notnullContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_notnull(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_notnull() (localctx IDecl_notnullContext) { + localctx = NewDecl_notnullContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1456, PostgreSQLParserRULE_decl_notnull) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10647) + p.Match(PostgreSQLParserNOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10648) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_defvalContext is an interface to support dynamic dispatch. +type IDecl_defvalContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Decl_defkey() IDecl_defkeyContext + Sql_expression() ISql_expressionContext + + // IsDecl_defvalContext differentiates from other interfaces. + IsDecl_defvalContext() +} + +type Decl_defvalContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_defvalContext() *Decl_defvalContext { + var p = new(Decl_defvalContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_defval + return p +} + +func InitEmptyDecl_defvalContext(p *Decl_defvalContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_defval +} + +func (*Decl_defvalContext) IsDecl_defvalContext() {} + +func NewDecl_defvalContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_defvalContext { + var p = new(Decl_defvalContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_defval + + return p +} + +func (s *Decl_defvalContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_defvalContext) Decl_defkey() IDecl_defkeyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecl_defkeyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecl_defkeyContext) +} + +func (s *Decl_defvalContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Decl_defvalContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_defvalContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_defvalContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_defval(s) + } +} + +func (s *Decl_defvalContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_defval(s) + } +} + +func (s *Decl_defvalContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_defval(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_defval() (localctx IDecl_defvalContext) { + localctx = NewDecl_defvalContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1458, PostgreSQLParserRULE_decl_defval) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10650) + p.Decl_defkey() + } + { + p.SetState(10651) + p.Sql_expression() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IDecl_defkeyContext is an interface to support dynamic dispatch. +type IDecl_defkeyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Assign_operator() IAssign_operatorContext + DEFAULT() antlr.TerminalNode + + // IsDecl_defkeyContext differentiates from other interfaces. + IsDecl_defkeyContext() +} + +type Decl_defkeyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecl_defkeyContext() *Decl_defkeyContext { + var p = new(Decl_defkeyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_defkey + return p +} + +func InitEmptyDecl_defkeyContext(p *Decl_defkeyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_decl_defkey +} + +func (*Decl_defkeyContext) IsDecl_defkeyContext() {} + +func NewDecl_defkeyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decl_defkeyContext { + var p = new(Decl_defkeyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_decl_defkey + + return p +} + +func (s *Decl_defkeyContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decl_defkeyContext) Assign_operator() IAssign_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAssign_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAssign_operatorContext) +} + +func (s *Decl_defkeyContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Decl_defkeyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decl_defkeyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decl_defkeyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterDecl_defkey(s) + } +} + +func (s *Decl_defkeyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitDecl_defkey(s) + } +} + +func (s *Decl_defkeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitDecl_defkey(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Decl_defkey() (localctx IDecl_defkeyContext) { + localctx = NewDecl_defkeyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1460, PostgreSQLParserRULE_decl_defkey) + p.SetState(10655) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserEQUAL, PostgreSQLParserCOLON_EQUALS: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10653) + p.Assign_operator() + } + + case PostgreSQLParserDEFAULT: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10654) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAssign_operatorContext is an interface to support dynamic dispatch. +type IAssign_operatorContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EQUAL() antlr.TerminalNode + COLON_EQUALS() antlr.TerminalNode + + // IsAssign_operatorContext differentiates from other interfaces. + IsAssign_operatorContext() +} + +type Assign_operatorContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAssign_operatorContext() *Assign_operatorContext { + var p = new(Assign_operatorContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_assign_operator + return p +} + +func InitEmptyAssign_operatorContext(p *Assign_operatorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_assign_operator +} + +func (*Assign_operatorContext) IsAssign_operatorContext() {} + +func NewAssign_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Assign_operatorContext { + var p = new(Assign_operatorContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_assign_operator + + return p +} + +func (s *Assign_operatorContext) GetParser() antlr.Parser { return s.parser } + +func (s *Assign_operatorContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Assign_operatorContext) COLON_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLON_EQUALS, 0) +} + +func (s *Assign_operatorContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Assign_operatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Assign_operatorContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAssign_operator(s) + } +} + +func (s *Assign_operatorContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAssign_operator(s) + } +} + +func (s *Assign_operatorContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAssign_operator(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Assign_operator() (localctx IAssign_operatorContext) { + localctx = NewAssign_operatorContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1462, PostgreSQLParserRULE_assign_operator) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10657) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserEQUAL || _la == PostgreSQLParserCOLON_EQUALS) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IProc_sectContext is an interface to support dynamic dispatch. +type IProc_sectContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllProc_stmt() []IProc_stmtContext + Proc_stmt(i int) IProc_stmtContext + + // IsProc_sectContext differentiates from other interfaces. + IsProc_sectContext() +} + +type Proc_sectContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyProc_sectContext() *Proc_sectContext { + var p = new(Proc_sectContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_sect + return p +} + +func InitEmptyProc_sectContext(p *Proc_sectContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_sect +} + +func (*Proc_sectContext) IsProc_sectContext() {} + +func NewProc_sectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Proc_sectContext { + var p = new(Proc_sectContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_proc_sect + + return p +} + +func (s *Proc_sectContext) GetParser() antlr.Parser { return s.parser } + +func (s *Proc_sectContext) AllProc_stmt() []IProc_stmtContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IProc_stmtContext); ok { + len++ + } + } + + tst := make([]IProc_stmtContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IProc_stmtContext); ok { + tst[i] = t.(IProc_stmtContext) + i++ + } + } + + return tst +} + +func (s *Proc_sectContext) Proc_stmt(i int) IProc_stmtContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_stmtContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IProc_stmtContext) +} + +func (s *Proc_sectContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Proc_sectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Proc_sectContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterProc_sect(s) + } +} + +func (s *Proc_sectContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitProc_sect(s) + } +} + +func (s *Proc_sectContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitProc_sect(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Proc_sect() (localctx IProc_sectContext) { + localctx = NewProc_sectContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1464, PostgreSQLParserRULE_proc_sect) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10662) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1035, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + { + p.SetState(10659) + p.Proc_stmt() + } + + } + p.SetState(10664) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1035, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IProc_stmtContext is an interface to support dynamic dispatch. +type IProc_stmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Pl_block() IPl_blockContext + SEMI() antlr.TerminalNode + Stmt_return() IStmt_returnContext + Stmt_raise() IStmt_raiseContext + Stmt_assign() IStmt_assignContext + Stmt_if() IStmt_ifContext + Stmt_case() IStmt_caseContext + Stmt_loop() IStmt_loopContext + Stmt_while() IStmt_whileContext + Stmt_for() IStmt_forContext + Stmt_foreach_a() IStmt_foreach_aContext + Stmt_exit() IStmt_exitContext + Stmt_assert() IStmt_assertContext + Stmt_execsql() IStmt_execsqlContext + Stmt_dynexecute() IStmt_dynexecuteContext + Stmt_perform() IStmt_performContext + Stmt_call() IStmt_callContext + Stmt_getdiag() IStmt_getdiagContext + Stmt_open() IStmt_openContext + Stmt_fetch() IStmt_fetchContext + Stmt_move() IStmt_moveContext + Stmt_close() IStmt_closeContext + Stmt_null() IStmt_nullContext + Stmt_commit() IStmt_commitContext + Stmt_rollback() IStmt_rollbackContext + Stmt_set() IStmt_setContext + + // IsProc_stmtContext differentiates from other interfaces. + IsProc_stmtContext() +} + +type Proc_stmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyProc_stmtContext() *Proc_stmtContext { + var p = new(Proc_stmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_stmt + return p +} + +func InitEmptyProc_stmtContext(p *Proc_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_stmt +} + +func (*Proc_stmtContext) IsProc_stmtContext() {} + +func NewProc_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Proc_stmtContext { + var p = new(Proc_stmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_proc_stmt + + return p +} + +func (s *Proc_stmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *Proc_stmtContext) Pl_block() IPl_blockContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPl_blockContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPl_blockContext) +} + +func (s *Proc_stmtContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Proc_stmtContext) Stmt_return() IStmt_returnContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_returnContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_returnContext) +} + +func (s *Proc_stmtContext) Stmt_raise() IStmt_raiseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_raiseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_raiseContext) +} + +func (s *Proc_stmtContext) Stmt_assign() IStmt_assignContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_assignContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_assignContext) +} + +func (s *Proc_stmtContext) Stmt_if() IStmt_ifContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_ifContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_ifContext) +} + +func (s *Proc_stmtContext) Stmt_case() IStmt_caseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_caseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_caseContext) +} + +func (s *Proc_stmtContext) Stmt_loop() IStmt_loopContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_loopContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_loopContext) +} + +func (s *Proc_stmtContext) Stmt_while() IStmt_whileContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_whileContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_whileContext) +} + +func (s *Proc_stmtContext) Stmt_for() IStmt_forContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_forContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_forContext) +} + +func (s *Proc_stmtContext) Stmt_foreach_a() IStmt_foreach_aContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_foreach_aContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_foreach_aContext) +} + +func (s *Proc_stmtContext) Stmt_exit() IStmt_exitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_exitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_exitContext) +} + +func (s *Proc_stmtContext) Stmt_assert() IStmt_assertContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_assertContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_assertContext) +} + +func (s *Proc_stmtContext) Stmt_execsql() IStmt_execsqlContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_execsqlContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_execsqlContext) +} + +func (s *Proc_stmtContext) Stmt_dynexecute() IStmt_dynexecuteContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_dynexecuteContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_dynexecuteContext) +} + +func (s *Proc_stmtContext) Stmt_perform() IStmt_performContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_performContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_performContext) +} + +func (s *Proc_stmtContext) Stmt_call() IStmt_callContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_callContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_callContext) +} + +func (s *Proc_stmtContext) Stmt_getdiag() IStmt_getdiagContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_getdiagContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_getdiagContext) +} + +func (s *Proc_stmtContext) Stmt_open() IStmt_openContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_openContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_openContext) +} + +func (s *Proc_stmtContext) Stmt_fetch() IStmt_fetchContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_fetchContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_fetchContext) +} + +func (s *Proc_stmtContext) Stmt_move() IStmt_moveContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_moveContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_moveContext) +} + +func (s *Proc_stmtContext) Stmt_close() IStmt_closeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_closeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_closeContext) +} + +func (s *Proc_stmtContext) Stmt_null() IStmt_nullContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_nullContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_nullContext) +} + +func (s *Proc_stmtContext) Stmt_commit() IStmt_commitContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_commitContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_commitContext) +} + +func (s *Proc_stmtContext) Stmt_rollback() IStmt_rollbackContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_rollbackContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_rollbackContext) +} + +func (s *Proc_stmtContext) Stmt_set() IStmt_setContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_setContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_setContext) +} + +func (s *Proc_stmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Proc_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Proc_stmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterProc_stmt(s) + } +} + +func (s *Proc_stmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitProc_stmt(s) + } +} + +func (s *Proc_stmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitProc_stmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Proc_stmt() (localctx IProc_stmtContext) { + localctx = NewProc_stmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1466, PostgreSQLParserRULE_proc_stmt) + p.SetState(10692) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1036, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10665) + p.Pl_block() + } + { + p.SetState(10666) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10668) + p.Stmt_return() + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10669) + p.Stmt_raise() + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10670) + p.Stmt_assign() + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10671) + p.Stmt_if() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(10672) + p.Stmt_case() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(10673) + p.Stmt_loop() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(10674) + p.Stmt_while() + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(10675) + p.Stmt_for() + } + + case 10: + p.EnterOuterAlt(localctx, 10) + { + p.SetState(10676) + p.Stmt_foreach_a() + } + + case 11: + p.EnterOuterAlt(localctx, 11) + { + p.SetState(10677) + p.Stmt_exit() + } + + case 12: + p.EnterOuterAlt(localctx, 12) + { + p.SetState(10678) + p.Stmt_assert() + } + + case 13: + p.EnterOuterAlt(localctx, 13) + { + p.SetState(10679) + p.Stmt_execsql() + } + + case 14: + p.EnterOuterAlt(localctx, 14) + { + p.SetState(10680) + p.Stmt_dynexecute() + } + + case 15: + p.EnterOuterAlt(localctx, 15) + { + p.SetState(10681) + p.Stmt_perform() + } + + case 16: + p.EnterOuterAlt(localctx, 16) + { + p.SetState(10682) + p.Stmt_call() + } + + case 17: + p.EnterOuterAlt(localctx, 17) + { + p.SetState(10683) + p.Stmt_getdiag() + } + + case 18: + p.EnterOuterAlt(localctx, 18) + { + p.SetState(10684) + p.Stmt_open() + } + + case 19: + p.EnterOuterAlt(localctx, 19) + { + p.SetState(10685) + p.Stmt_fetch() + } + + case 20: + p.EnterOuterAlt(localctx, 20) + { + p.SetState(10686) + p.Stmt_move() + } + + case 21: + p.EnterOuterAlt(localctx, 21) + { + p.SetState(10687) + p.Stmt_close() + } + + case 22: + p.EnterOuterAlt(localctx, 22) + { + p.SetState(10688) + p.Stmt_null() + } + + case 23: + p.EnterOuterAlt(localctx, 23) + { + p.SetState(10689) + p.Stmt_commit() + } + + case 24: + p.EnterOuterAlt(localctx, 24) + { + p.SetState(10690) + p.Stmt_rollback() + } + + case 25: + p.EnterOuterAlt(localctx, 25) + { + p.SetState(10691) + p.Stmt_set() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_performContext is an interface to support dynamic dispatch. +type IStmt_performContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + PERFORM() antlr.TerminalNode + Expr_until_semi() IExpr_until_semiContext + SEMI() antlr.TerminalNode + + // IsStmt_performContext differentiates from other interfaces. + IsStmt_performContext() +} + +type Stmt_performContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_performContext() *Stmt_performContext { + var p = new(Stmt_performContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_perform + return p +} + +func InitEmptyStmt_performContext(p *Stmt_performContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_perform +} + +func (*Stmt_performContext) IsStmt_performContext() {} + +func NewStmt_performContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_performContext { + var p = new(Stmt_performContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_perform + + return p +} + +func (s *Stmt_performContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_performContext) PERFORM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPERFORM, 0) +} + +func (s *Stmt_performContext) Expr_until_semi() IExpr_until_semiContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_until_semiContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_until_semiContext) +} + +func (s *Stmt_performContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_performContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_performContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_performContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_perform(s) + } +} + +func (s *Stmt_performContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_perform(s) + } +} + +func (s *Stmt_performContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_perform(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_perform() (localctx IStmt_performContext) { + localctx = NewStmt_performContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1468, PostgreSQLParserRULE_stmt_perform) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10694) + p.Match(PostgreSQLParserPERFORM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10695) + p.Expr_until_semi() + } + { + p.SetState(10696) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_callContext is an interface to support dynamic dispatch. +type IStmt_callContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CALL() antlr.TerminalNode + Any_identifier() IAny_identifierContext + OPEN_PAREN() antlr.TerminalNode + CLOSE_PAREN() antlr.TerminalNode + SEMI() antlr.TerminalNode + Opt_expr_list() IOpt_expr_listContext + DO() antlr.TerminalNode + + // IsStmt_callContext differentiates from other interfaces. + IsStmt_callContext() +} + +type Stmt_callContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_callContext() *Stmt_callContext { + var p = new(Stmt_callContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_call + return p +} + +func InitEmptyStmt_callContext(p *Stmt_callContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_call +} + +func (*Stmt_callContext) IsStmt_callContext() {} + +func NewStmt_callContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_callContext { + var p = new(Stmt_callContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_call + + return p +} + +func (s *Stmt_callContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_callContext) CALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCALL, 0) +} + +func (s *Stmt_callContext) Any_identifier() IAny_identifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_identifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_identifierContext) +} + +func (s *Stmt_callContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Stmt_callContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Stmt_callContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_callContext) Opt_expr_list() IOpt_expr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_expr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_expr_listContext) +} + +func (s *Stmt_callContext) DO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDO, 0) +} + +func (s *Stmt_callContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_callContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_callContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_call(s) + } +} + +func (s *Stmt_callContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_call(s) + } +} + +func (s *Stmt_callContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_call(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_call() (localctx IStmt_callContext) { + localctx = NewStmt_callContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1470, PostgreSQLParserRULE_stmt_call) + var _la int + + p.SetState(10716) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserCALL: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10698) + p.Match(PostgreSQLParserCALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10699) + p.Any_identifier() + } + { + p.SetState(10700) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10702) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858553860) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073201) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(10701) + p.Opt_expr_list() + } + + } + { + p.SetState(10704) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10705) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserDO: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10707) + p.Match(PostgreSQLParserDO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10708) + p.Any_identifier() + } + { + p.SetState(10709) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10711) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858553860) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073201) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(10710) + p.Opt_expr_list() + } + + } + { + p.SetState(10713) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10714) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_expr_listContext is an interface to support dynamic dispatch. +type IOpt_expr_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Expr_list() IExpr_listContext + + // IsOpt_expr_listContext differentiates from other interfaces. + IsOpt_expr_listContext() +} + +type Opt_expr_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_expr_listContext() *Opt_expr_listContext { + var p = new(Opt_expr_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_expr_list + return p +} + +func InitEmptyOpt_expr_listContext(p *Opt_expr_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_expr_list +} + +func (*Opt_expr_listContext) IsOpt_expr_listContext() {} + +func NewOpt_expr_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_expr_listContext { + var p = new(Opt_expr_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_expr_list + + return p +} + +func (s *Opt_expr_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_expr_listContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Opt_expr_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_expr_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_expr_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_expr_list(s) + } +} + +func (s *Opt_expr_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_expr_list(s) + } +} + +func (s *Opt_expr_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_expr_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_expr_list() (localctx IOpt_expr_listContext) { + localctx = NewOpt_expr_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1472, PostgreSQLParserRULE_opt_expr_list) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10718) + p.Expr_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_assignContext is an interface to support dynamic dispatch. +type IStmt_assignContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Assign_var() IAssign_varContext + Assign_operator() IAssign_operatorContext + Sql_expression() ISql_expressionContext + SEMI() antlr.TerminalNode + + // IsStmt_assignContext differentiates from other interfaces. + IsStmt_assignContext() +} + +type Stmt_assignContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_assignContext() *Stmt_assignContext { + var p = new(Stmt_assignContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_assign + return p +} + +func InitEmptyStmt_assignContext(p *Stmt_assignContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_assign +} + +func (*Stmt_assignContext) IsStmt_assignContext() {} + +func NewStmt_assignContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_assignContext { + var p = new(Stmt_assignContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_assign + + return p +} + +func (s *Stmt_assignContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_assignContext) Assign_var() IAssign_varContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAssign_varContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAssign_varContext) +} + +func (s *Stmt_assignContext) Assign_operator() IAssign_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAssign_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAssign_operatorContext) +} + +func (s *Stmt_assignContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Stmt_assignContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_assignContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_assignContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_assignContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_assign(s) + } +} + +func (s *Stmt_assignContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_assign(s) + } +} + +func (s *Stmt_assignContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_assign(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_assign() (localctx IStmt_assignContext) { + localctx = NewStmt_assignContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1474, PostgreSQLParserRULE_stmt_assign) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10720) + p.Assign_var() + } + { + p.SetState(10721) + p.Assign_operator() + } + { + p.SetState(10722) + p.Sql_expression() + } + { + p.SetState(10723) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_getdiagContext is an interface to support dynamic dispatch. +type IStmt_getdiagContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + GET() antlr.TerminalNode + DIAGNOSTICS() antlr.TerminalNode + Getdiag_list() IGetdiag_listContext + SEMI() antlr.TerminalNode + Getdiag_area_opt() IGetdiag_area_optContext + + // IsStmt_getdiagContext differentiates from other interfaces. + IsStmt_getdiagContext() +} + +type Stmt_getdiagContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_getdiagContext() *Stmt_getdiagContext { + var p = new(Stmt_getdiagContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_getdiag + return p +} + +func InitEmptyStmt_getdiagContext(p *Stmt_getdiagContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_getdiag +} + +func (*Stmt_getdiagContext) IsStmt_getdiagContext() {} + +func NewStmt_getdiagContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_getdiagContext { + var p = new(Stmt_getdiagContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_getdiag + + return p +} + +func (s *Stmt_getdiagContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_getdiagContext) GET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGET, 0) +} + +func (s *Stmt_getdiagContext) DIAGNOSTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDIAGNOSTICS, 0) +} + +func (s *Stmt_getdiagContext) Getdiag_list() IGetdiag_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGetdiag_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGetdiag_listContext) +} + +func (s *Stmt_getdiagContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_getdiagContext) Getdiag_area_opt() IGetdiag_area_optContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGetdiag_area_optContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGetdiag_area_optContext) +} + +func (s *Stmt_getdiagContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_getdiagContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_getdiagContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_getdiag(s) + } +} + +func (s *Stmt_getdiagContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_getdiag(s) + } +} + +func (s *Stmt_getdiagContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_getdiag(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_getdiag() (localctx IStmt_getdiagContext) { + localctx = NewStmt_getdiagContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1476, PostgreSQLParserRULE_stmt_getdiag) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10725) + p.Match(PostgreSQLParserGET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10727) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCURRENT_P || _la == PostgreSQLParserSTACKED { + { + p.SetState(10726) + p.Getdiag_area_opt() + } + + } + { + p.SetState(10729) + p.Match(PostgreSQLParserDIAGNOSTICS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10730) + p.Getdiag_list() + } + { + p.SetState(10731) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGetdiag_area_optContext is an interface to support dynamic dispatch. +type IGetdiag_area_optContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CURRENT_P() antlr.TerminalNode + STACKED() antlr.TerminalNode + + // IsGetdiag_area_optContext differentiates from other interfaces. + IsGetdiag_area_optContext() +} + +type Getdiag_area_optContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGetdiag_area_optContext() *Getdiag_area_optContext { + var p = new(Getdiag_area_optContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_area_opt + return p +} + +func InitEmptyGetdiag_area_optContext(p *Getdiag_area_optContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_area_opt +} + +func (*Getdiag_area_optContext) IsGetdiag_area_optContext() {} + +func NewGetdiag_area_optContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Getdiag_area_optContext { + var p = new(Getdiag_area_optContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_getdiag_area_opt + + return p +} + +func (s *Getdiag_area_optContext) GetParser() antlr.Parser { return s.parser } + +func (s *Getdiag_area_optContext) CURRENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_P, 0) +} + +func (s *Getdiag_area_optContext) STACKED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTACKED, 0) +} + +func (s *Getdiag_area_optContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Getdiag_area_optContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Getdiag_area_optContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGetdiag_area_opt(s) + } +} + +func (s *Getdiag_area_optContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGetdiag_area_opt(s) + } +} + +func (s *Getdiag_area_optContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGetdiag_area_opt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Getdiag_area_opt() (localctx IGetdiag_area_optContext) { + localctx = NewGetdiag_area_optContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1478, PostgreSQLParserRULE_getdiag_area_opt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10733) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCURRENT_P || _la == PostgreSQLParserSTACKED) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGetdiag_listContext is an interface to support dynamic dispatch. +type IGetdiag_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllGetdiag_list_item() []IGetdiag_list_itemContext + Getdiag_list_item(i int) IGetdiag_list_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsGetdiag_listContext differentiates from other interfaces. + IsGetdiag_listContext() +} + +type Getdiag_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGetdiag_listContext() *Getdiag_listContext { + var p = new(Getdiag_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_list + return p +} + +func InitEmptyGetdiag_listContext(p *Getdiag_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_list +} + +func (*Getdiag_listContext) IsGetdiag_listContext() {} + +func NewGetdiag_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Getdiag_listContext { + var p = new(Getdiag_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_getdiag_list + + return p +} + +func (s *Getdiag_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Getdiag_listContext) AllGetdiag_list_item() []IGetdiag_list_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IGetdiag_list_itemContext); ok { + len++ + } + } + + tst := make([]IGetdiag_list_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IGetdiag_list_itemContext); ok { + tst[i] = t.(IGetdiag_list_itemContext) + i++ + } + } + + return tst +} + +func (s *Getdiag_listContext) Getdiag_list_item(i int) IGetdiag_list_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGetdiag_list_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IGetdiag_list_itemContext) +} + +func (s *Getdiag_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Getdiag_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Getdiag_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Getdiag_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Getdiag_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGetdiag_list(s) + } +} + +func (s *Getdiag_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGetdiag_list(s) + } +} + +func (s *Getdiag_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGetdiag_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Getdiag_list() (localctx IGetdiag_listContext) { + localctx = NewGetdiag_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1480, PostgreSQLParserRULE_getdiag_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10735) + p.Getdiag_list_item() + } + p.SetState(10740) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10736) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10737) + p.Getdiag_list_item() + } + + p.SetState(10742) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGetdiag_list_itemContext is an interface to support dynamic dispatch. +type IGetdiag_list_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Getdiag_target() IGetdiag_targetContext + Assign_operator() IAssign_operatorContext + Getdiag_item() IGetdiag_itemContext + + // IsGetdiag_list_itemContext differentiates from other interfaces. + IsGetdiag_list_itemContext() +} + +type Getdiag_list_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGetdiag_list_itemContext() *Getdiag_list_itemContext { + var p = new(Getdiag_list_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_list_item + return p +} + +func InitEmptyGetdiag_list_itemContext(p *Getdiag_list_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_list_item +} + +func (*Getdiag_list_itemContext) IsGetdiag_list_itemContext() {} + +func NewGetdiag_list_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Getdiag_list_itemContext { + var p = new(Getdiag_list_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_getdiag_list_item + + return p +} + +func (s *Getdiag_list_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Getdiag_list_itemContext) Getdiag_target() IGetdiag_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGetdiag_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGetdiag_targetContext) +} + +func (s *Getdiag_list_itemContext) Assign_operator() IAssign_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAssign_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAssign_operatorContext) +} + +func (s *Getdiag_list_itemContext) Getdiag_item() IGetdiag_itemContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGetdiag_itemContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGetdiag_itemContext) +} + +func (s *Getdiag_list_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Getdiag_list_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Getdiag_list_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGetdiag_list_item(s) + } +} + +func (s *Getdiag_list_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGetdiag_list_item(s) + } +} + +func (s *Getdiag_list_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGetdiag_list_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Getdiag_list_item() (localctx IGetdiag_list_itemContext) { + localctx = NewGetdiag_list_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1482, PostgreSQLParserRULE_getdiag_list_item) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10743) + p.Getdiag_target() + } + { + p.SetState(10744) + p.Assign_operator() + } + { + p.SetState(10745) + p.Getdiag_item() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGetdiag_itemContext is an interface to support dynamic dispatch. +type IGetdiag_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + + // IsGetdiag_itemContext differentiates from other interfaces. + IsGetdiag_itemContext() +} + +type Getdiag_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGetdiag_itemContext() *Getdiag_itemContext { + var p = new(Getdiag_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_item + return p +} + +func InitEmptyGetdiag_itemContext(p *Getdiag_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_item +} + +func (*Getdiag_itemContext) IsGetdiag_itemContext() {} + +func NewGetdiag_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Getdiag_itemContext { + var p = new(Getdiag_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_getdiag_item + + return p +} + +func (s *Getdiag_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Getdiag_itemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Getdiag_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Getdiag_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Getdiag_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGetdiag_item(s) + } +} + +func (s *Getdiag_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGetdiag_item(s) + } +} + +func (s *Getdiag_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGetdiag_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Getdiag_item() (localctx IGetdiag_itemContext) { + localctx = NewGetdiag_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1484, PostgreSQLParserRULE_getdiag_item) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10747) + p.Colid() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IGetdiag_targetContext is an interface to support dynamic dispatch. +type IGetdiag_targetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Assign_var() IAssign_varContext + + // IsGetdiag_targetContext differentiates from other interfaces. + IsGetdiag_targetContext() +} + +type Getdiag_targetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyGetdiag_targetContext() *Getdiag_targetContext { + var p = new(Getdiag_targetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_target + return p +} + +func InitEmptyGetdiag_targetContext(p *Getdiag_targetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_getdiag_target +} + +func (*Getdiag_targetContext) IsGetdiag_targetContext() {} + +func NewGetdiag_targetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Getdiag_targetContext { + var p = new(Getdiag_targetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_getdiag_target + + return p +} + +func (s *Getdiag_targetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Getdiag_targetContext) Assign_var() IAssign_varContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAssign_varContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAssign_varContext) +} + +func (s *Getdiag_targetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Getdiag_targetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Getdiag_targetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterGetdiag_target(s) + } +} + +func (s *Getdiag_targetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitGetdiag_target(s) + } +} + +func (s *Getdiag_targetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitGetdiag_target(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Getdiag_target() (localctx IGetdiag_targetContext) { + localctx = NewGetdiag_targetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1486, PostgreSQLParserRULE_getdiag_target) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10749) + p.Assign_var() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAssign_varContext is an interface to support dynamic dispatch. +type IAssign_varContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Any_name() IAny_nameContext + PARAM() antlr.TerminalNode + AllOPEN_BRACKET() []antlr.TerminalNode + OPEN_BRACKET(i int) antlr.TerminalNode + AllExpr_until_rightbracket() []IExpr_until_rightbracketContext + Expr_until_rightbracket(i int) IExpr_until_rightbracketContext + AllCLOSE_BRACKET() []antlr.TerminalNode + CLOSE_BRACKET(i int) antlr.TerminalNode + + // IsAssign_varContext differentiates from other interfaces. + IsAssign_varContext() +} + +type Assign_varContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAssign_varContext() *Assign_varContext { + var p = new(Assign_varContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_assign_var + return p +} + +func InitEmptyAssign_varContext(p *Assign_varContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_assign_var +} + +func (*Assign_varContext) IsAssign_varContext() {} + +func NewAssign_varContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Assign_varContext { + var p = new(Assign_varContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_assign_var + + return p +} + +func (s *Assign_varContext) GetParser() antlr.Parser { return s.parser } + +func (s *Assign_varContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Assign_varContext) PARAM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARAM, 0) +} + +func (s *Assign_varContext) AllOPEN_BRACKET() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserOPEN_BRACKET) +} + +func (s *Assign_varContext) OPEN_BRACKET(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_BRACKET, i) +} + +func (s *Assign_varContext) AllExpr_until_rightbracket() []IExpr_until_rightbracketContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IExpr_until_rightbracketContext); ok { + len++ + } + } + + tst := make([]IExpr_until_rightbracketContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IExpr_until_rightbracketContext); ok { + tst[i] = t.(IExpr_until_rightbracketContext) + i++ + } + } + + return tst +} + +func (s *Assign_varContext) Expr_until_rightbracket(i int) IExpr_until_rightbracketContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_until_rightbracketContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IExpr_until_rightbracketContext) +} + +func (s *Assign_varContext) AllCLOSE_BRACKET() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCLOSE_BRACKET) +} + +func (s *Assign_varContext) CLOSE_BRACKET(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_BRACKET, i) +} + +func (s *Assign_varContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Assign_varContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Assign_varContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAssign_var(s) + } +} + +func (s *Assign_varContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAssign_var(s) + } +} + +func (s *Assign_varContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAssign_var(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Assign_var() (localctx IAssign_varContext) { + localctx = NewAssign_varContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1488, PostgreSQLParserRULE_assign_var) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10753) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(10751) + p.Any_name() + } + + case PostgreSQLParserPARAM: + { + p.SetState(10752) + p.Match(PostgreSQLParserPARAM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.SetState(10761) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserOPEN_BRACKET { + { + p.SetState(10755) + p.Match(PostgreSQLParserOPEN_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10756) + p.Expr_until_rightbracket() + } + { + p.SetState(10757) + p.Match(PostgreSQLParserCLOSE_BRACKET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + p.SetState(10763) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_ifContext is an interface to support dynamic dispatch. +type IStmt_ifContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllIF_P() []antlr.TerminalNode + IF_P(i int) antlr.TerminalNode + Expr_until_then() IExpr_until_thenContext + THEN() antlr.TerminalNode + Proc_sect() IProc_sectContext + Stmt_elsifs() IStmt_elsifsContext + END_P() antlr.TerminalNode + SEMI() antlr.TerminalNode + Stmt_else() IStmt_elseContext + + // IsStmt_ifContext differentiates from other interfaces. + IsStmt_ifContext() +} + +type Stmt_ifContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_ifContext() *Stmt_ifContext { + var p = new(Stmt_ifContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_if + return p +} + +func InitEmptyStmt_ifContext(p *Stmt_ifContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_if +} + +func (*Stmt_ifContext) IsStmt_ifContext() {} + +func NewStmt_ifContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_ifContext { + var p = new(Stmt_ifContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_if + + return p +} + +func (s *Stmt_ifContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_ifContext) AllIF_P() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserIF_P) +} + +func (s *Stmt_ifContext) IF_P(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIF_P, i) +} + +func (s *Stmt_ifContext) Expr_until_then() IExpr_until_thenContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_until_thenContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_until_thenContext) +} + +func (s *Stmt_ifContext) THEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, 0) +} + +func (s *Stmt_ifContext) Proc_sect() IProc_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_sectContext) +} + +func (s *Stmt_ifContext) Stmt_elsifs() IStmt_elsifsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_elsifsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_elsifsContext) +} + +func (s *Stmt_ifContext) END_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEND_P, 0) +} + +func (s *Stmt_ifContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_ifContext) Stmt_else() IStmt_elseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmt_elseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmt_elseContext) +} + +func (s *Stmt_ifContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_ifContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_ifContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_if(s) + } +} + +func (s *Stmt_ifContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_if(s) + } +} + +func (s *Stmt_ifContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_if(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_if() (localctx IStmt_ifContext) { + localctx = NewStmt_ifContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1490, PostgreSQLParserRULE_stmt_if) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10764) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10765) + p.Expr_until_then() + } + { + p.SetState(10766) + p.Match(PostgreSQLParserTHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10767) + p.Proc_sect() + } + { + p.SetState(10768) + p.Stmt_elsifs() + } + p.SetState(10770) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserELSE { + { + p.SetState(10769) + p.Stmt_else() + } + + } + { + p.SetState(10772) + p.Match(PostgreSQLParserEND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10773) + p.Match(PostgreSQLParserIF_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10774) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_elsifsContext is an interface to support dynamic dispatch. +type IStmt_elsifsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllELSIF() []antlr.TerminalNode + ELSIF(i int) antlr.TerminalNode + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + AllTHEN() []antlr.TerminalNode + THEN(i int) antlr.TerminalNode + AllProc_sect() []IProc_sectContext + Proc_sect(i int) IProc_sectContext + + // IsStmt_elsifsContext differentiates from other interfaces. + IsStmt_elsifsContext() +} + +type Stmt_elsifsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_elsifsContext() *Stmt_elsifsContext { + var p = new(Stmt_elsifsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_elsifs + return p +} + +func InitEmptyStmt_elsifsContext(p *Stmt_elsifsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_elsifs +} + +func (*Stmt_elsifsContext) IsStmt_elsifsContext() {} + +func NewStmt_elsifsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_elsifsContext { + var p = new(Stmt_elsifsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_elsifs + + return p +} + +func (s *Stmt_elsifsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_elsifsContext) AllELSIF() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserELSIF) +} + +func (s *Stmt_elsifsContext) ELSIF(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserELSIF, i) +} + +func (s *Stmt_elsifsContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *Stmt_elsifsContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Stmt_elsifsContext) AllTHEN() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserTHEN) +} + +func (s *Stmt_elsifsContext) THEN(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, i) +} + +func (s *Stmt_elsifsContext) AllProc_sect() []IProc_sectContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IProc_sectContext); ok { + len++ + } + } + + tst := make([]IProc_sectContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IProc_sectContext); ok { + tst[i] = t.(IProc_sectContext) + i++ + } + } + + return tst +} + +func (s *Stmt_elsifsContext) Proc_sect(i int) IProc_sectContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_sectContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IProc_sectContext) +} + +func (s *Stmt_elsifsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_elsifsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_elsifsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_elsifs(s) + } +} + +func (s *Stmt_elsifsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_elsifs(s) + } +} + +func (s *Stmt_elsifsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_elsifs(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_elsifs() (localctx IStmt_elsifsContext) { + localctx = NewStmt_elsifsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1492, PostgreSQLParserRULE_stmt_elsifs) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10783) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserELSIF { + { + p.SetState(10776) + p.Match(PostgreSQLParserELSIF) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10777) + p.A_expr() + } + { + p.SetState(10778) + p.Match(PostgreSQLParserTHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10779) + p.Proc_sect() + } + + p.SetState(10785) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_elseContext is an interface to support dynamic dispatch. +type IStmt_elseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ELSE() antlr.TerminalNode + Proc_sect() IProc_sectContext + + // IsStmt_elseContext differentiates from other interfaces. + IsStmt_elseContext() +} + +type Stmt_elseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_elseContext() *Stmt_elseContext { + var p = new(Stmt_elseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_else + return p +} + +func InitEmptyStmt_elseContext(p *Stmt_elseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_else +} + +func (*Stmt_elseContext) IsStmt_elseContext() {} + +func NewStmt_elseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_elseContext { + var p = new(Stmt_elseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_else + + return p +} + +func (s *Stmt_elseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_elseContext) ELSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserELSE, 0) +} + +func (s *Stmt_elseContext) Proc_sect() IProc_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_sectContext) +} + +func (s *Stmt_elseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_elseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_elseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_else(s) + } +} + +func (s *Stmt_elseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_else(s) + } +} + +func (s *Stmt_elseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_else(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_else() (localctx IStmt_elseContext) { + localctx = NewStmt_elseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1494, PostgreSQLParserRULE_stmt_else) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10786) + p.Match(PostgreSQLParserELSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10787) + p.Proc_sect() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_caseContext is an interface to support dynamic dispatch. +type IStmt_caseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCASE() []antlr.TerminalNode + CASE(i int) antlr.TerminalNode + Case_when_list() ICase_when_listContext + END_P() antlr.TerminalNode + SEMI() antlr.TerminalNode + Opt_expr_until_when() IOpt_expr_until_whenContext + Opt_case_else() IOpt_case_elseContext + + // IsStmt_caseContext differentiates from other interfaces. + IsStmt_caseContext() +} + +type Stmt_caseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_caseContext() *Stmt_caseContext { + var p = new(Stmt_caseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_case + return p +} + +func InitEmptyStmt_caseContext(p *Stmt_caseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_case +} + +func (*Stmt_caseContext) IsStmt_caseContext() {} + +func NewStmt_caseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_caseContext { + var p = new(Stmt_caseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_case + + return p +} + +func (s *Stmt_caseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_caseContext) AllCASE() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCASE) +} + +func (s *Stmt_caseContext) CASE(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCASE, i) +} + +func (s *Stmt_caseContext) Case_when_list() ICase_when_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICase_when_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICase_when_listContext) +} + +func (s *Stmt_caseContext) END_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEND_P, 0) +} + +func (s *Stmt_caseContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_caseContext) Opt_expr_until_when() IOpt_expr_until_whenContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_expr_until_whenContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_expr_until_whenContext) +} + +func (s *Stmt_caseContext) Opt_case_else() IOpt_case_elseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_case_elseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_case_elseContext) +} + +func (s *Stmt_caseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_caseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_caseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_case(s) + } +} + +func (s *Stmt_caseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_case(s) + } +} + +func (s *Stmt_caseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_case(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_case() (localctx IStmt_caseContext) { + localctx = NewStmt_caseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1496, PostgreSQLParserRULE_stmt_case) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10789) + p.Match(PostgreSQLParserCASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10791) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1046, p.GetParserRuleContext()) == 1 { + { + p.SetState(10790) + p.Opt_expr_until_when() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(10793) + p.Case_when_list() + } + p.SetState(10795) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserELSE { + { + p.SetState(10794) + p.Opt_case_else() + } + + } + { + p.SetState(10797) + p.Match(PostgreSQLParserEND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10798) + p.Match(PostgreSQLParserCASE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10799) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_expr_until_whenContext is an interface to support dynamic dispatch. +type IOpt_expr_until_whenContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sql_expression() ISql_expressionContext + + // IsOpt_expr_until_whenContext differentiates from other interfaces. + IsOpt_expr_until_whenContext() +} + +type Opt_expr_until_whenContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_expr_until_whenContext() *Opt_expr_until_whenContext { + var p = new(Opt_expr_until_whenContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_expr_until_when + return p +} + +func InitEmptyOpt_expr_until_whenContext(p *Opt_expr_until_whenContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_expr_until_when +} + +func (*Opt_expr_until_whenContext) IsOpt_expr_until_whenContext() {} + +func NewOpt_expr_until_whenContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_expr_until_whenContext { + var p = new(Opt_expr_until_whenContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_expr_until_when + + return p +} + +func (s *Opt_expr_until_whenContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_expr_until_whenContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Opt_expr_until_whenContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_expr_until_whenContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_expr_until_whenContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_expr_until_when(s) + } +} + +func (s *Opt_expr_until_whenContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_expr_until_when(s) + } +} + +func (s *Opt_expr_until_whenContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_expr_until_when(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_expr_until_when() (localctx IOpt_expr_until_whenContext) { + localctx = NewOpt_expr_until_whenContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1498, PostgreSQLParserRULE_opt_expr_until_when) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10801) + p.Sql_expression() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICase_when_listContext is an interface to support dynamic dispatch. +type ICase_when_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCase_when() []ICase_whenContext + Case_when(i int) ICase_whenContext + + // IsCase_when_listContext differentiates from other interfaces. + IsCase_when_listContext() +} + +type Case_when_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCase_when_listContext() *Case_when_listContext { + var p = new(Case_when_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_when_list + return p +} + +func InitEmptyCase_when_listContext(p *Case_when_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_when_list +} + +func (*Case_when_listContext) IsCase_when_listContext() {} + +func NewCase_when_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Case_when_listContext { + var p = new(Case_when_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_case_when_list + + return p +} + +func (s *Case_when_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Case_when_listContext) AllCase_when() []ICase_whenContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(ICase_whenContext); ok { + len++ + } + } + + tst := make([]ICase_whenContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(ICase_whenContext); ok { + tst[i] = t.(ICase_whenContext) + i++ + } + } + + return tst +} + +func (s *Case_when_listContext) Case_when(i int) ICase_whenContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICase_whenContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(ICase_whenContext) +} + +func (s *Case_when_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Case_when_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Case_when_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCase_when_list(s) + } +} + +func (s *Case_when_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCase_when_list(s) + } +} + +func (s *Case_when_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCase_when_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Case_when_list() (localctx ICase_when_listContext) { + localctx = NewCase_when_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1500, PostgreSQLParserRULE_case_when_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10804) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == PostgreSQLParserWHEN { + { + p.SetState(10803) + p.Case_when() + } + + p.SetState(10806) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICase_whenContext is an interface to support dynamic dispatch. +type ICase_whenContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHEN() antlr.TerminalNode + Expr_list() IExpr_listContext + THEN() antlr.TerminalNode + Proc_sect() IProc_sectContext + + // IsCase_whenContext differentiates from other interfaces. + IsCase_whenContext() +} + +type Case_whenContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCase_whenContext() *Case_whenContext { + var p = new(Case_whenContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_when + return p +} + +func InitEmptyCase_whenContext(p *Case_whenContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_case_when +} + +func (*Case_whenContext) IsCase_whenContext() {} + +func NewCase_whenContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Case_whenContext { + var p = new(Case_whenContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_case_when + + return p +} + +func (s *Case_whenContext) GetParser() antlr.Parser { return s.parser } + +func (s *Case_whenContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *Case_whenContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Case_whenContext) THEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, 0) +} + +func (s *Case_whenContext) Proc_sect() IProc_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_sectContext) +} + +func (s *Case_whenContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Case_whenContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Case_whenContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCase_when(s) + } +} + +func (s *Case_whenContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCase_when(s) + } +} + +func (s *Case_whenContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCase_when(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Case_when() (localctx ICase_whenContext) { + localctx = NewCase_whenContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1502, PostgreSQLParserRULE_case_when) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10808) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10809) + p.Expr_list() + } + { + p.SetState(10810) + p.Match(PostgreSQLParserTHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10811) + p.Proc_sect() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_case_elseContext is an interface to support dynamic dispatch. +type IOpt_case_elseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ELSE() antlr.TerminalNode + Proc_sect() IProc_sectContext + + // IsOpt_case_elseContext differentiates from other interfaces. + IsOpt_case_elseContext() +} + +type Opt_case_elseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_case_elseContext() *Opt_case_elseContext { + var p = new(Opt_case_elseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_case_else + return p +} + +func InitEmptyOpt_case_elseContext(p *Opt_case_elseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_case_else +} + +func (*Opt_case_elseContext) IsOpt_case_elseContext() {} + +func NewOpt_case_elseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_case_elseContext { + var p = new(Opt_case_elseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_case_else + + return p +} + +func (s *Opt_case_elseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_case_elseContext) ELSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserELSE, 0) +} + +func (s *Opt_case_elseContext) Proc_sect() IProc_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_sectContext) +} + +func (s *Opt_case_elseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_case_elseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_case_elseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_case_else(s) + } +} + +func (s *Opt_case_elseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_case_else(s) + } +} + +func (s *Opt_case_elseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_case_else(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_case_else() (localctx IOpt_case_elseContext) { + localctx = NewOpt_case_elseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1504, PostgreSQLParserRULE_opt_case_else) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10813) + p.Match(PostgreSQLParserELSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10814) + p.Proc_sect() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_loopContext is an interface to support dynamic dispatch. +type IStmt_loopContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Loop_body() ILoop_bodyContext + Opt_loop_label() IOpt_loop_labelContext + + // IsStmt_loopContext differentiates from other interfaces. + IsStmt_loopContext() +} + +type Stmt_loopContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_loopContext() *Stmt_loopContext { + var p = new(Stmt_loopContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_loop + return p +} + +func InitEmptyStmt_loopContext(p *Stmt_loopContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_loop +} + +func (*Stmt_loopContext) IsStmt_loopContext() {} + +func NewStmt_loopContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_loopContext { + var p = new(Stmt_loopContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_loop + + return p +} + +func (s *Stmt_loopContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_loopContext) Loop_body() ILoop_bodyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILoop_bodyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILoop_bodyContext) +} + +func (s *Stmt_loopContext) Opt_loop_label() IOpt_loop_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_loop_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_loop_labelContext) +} + +func (s *Stmt_loopContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_loopContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_loopContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_loop(s) + } +} + +func (s *Stmt_loopContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_loop(s) + } +} + +func (s *Stmt_loopContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_loop(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_loop() (localctx IStmt_loopContext) { + localctx = NewStmt_loopContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1506, PostgreSQLParserRULE_stmt_loop) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10817) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserLESS_LESS { + { + p.SetState(10816) + p.Opt_loop_label() + } + + } + { + p.SetState(10819) + p.Loop_body() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_whileContext is an interface to support dynamic dispatch. +type IStmt_whileContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHILE() antlr.TerminalNode + Expr_until_loop() IExpr_until_loopContext + Loop_body() ILoop_bodyContext + Opt_loop_label() IOpt_loop_labelContext + + // IsStmt_whileContext differentiates from other interfaces. + IsStmt_whileContext() +} + +type Stmt_whileContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_whileContext() *Stmt_whileContext { + var p = new(Stmt_whileContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_while + return p +} + +func InitEmptyStmt_whileContext(p *Stmt_whileContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_while +} + +func (*Stmt_whileContext) IsStmt_whileContext() {} + +func NewStmt_whileContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_whileContext { + var p = new(Stmt_whileContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_while + + return p +} + +func (s *Stmt_whileContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_whileContext) WHILE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHILE, 0) +} + +func (s *Stmt_whileContext) Expr_until_loop() IExpr_until_loopContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_until_loopContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_until_loopContext) +} + +func (s *Stmt_whileContext) Loop_body() ILoop_bodyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILoop_bodyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILoop_bodyContext) +} + +func (s *Stmt_whileContext) Opt_loop_label() IOpt_loop_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_loop_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_loop_labelContext) +} + +func (s *Stmt_whileContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_whileContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_whileContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_while(s) + } +} + +func (s *Stmt_whileContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_while(s) + } +} + +func (s *Stmt_whileContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_while(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_while() (localctx IStmt_whileContext) { + localctx = NewStmt_whileContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1508, PostgreSQLParserRULE_stmt_while) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10822) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserLESS_LESS { + { + p.SetState(10821) + p.Opt_loop_label() + } + + } + { + p.SetState(10824) + p.Match(PostgreSQLParserWHILE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10825) + p.Expr_until_loop() + } + { + p.SetState(10826) + p.Loop_body() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_forContext is an interface to support dynamic dispatch. +type IStmt_forContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FOR() antlr.TerminalNode + For_control() IFor_controlContext + Loop_body() ILoop_bodyContext + Opt_loop_label() IOpt_loop_labelContext + + // IsStmt_forContext differentiates from other interfaces. + IsStmt_forContext() +} + +type Stmt_forContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_forContext() *Stmt_forContext { + var p = new(Stmt_forContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_for + return p +} + +func InitEmptyStmt_forContext(p *Stmt_forContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_for +} + +func (*Stmt_forContext) IsStmt_forContext() {} + +func NewStmt_forContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_forContext { + var p = new(Stmt_forContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_for + + return p +} + +func (s *Stmt_forContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_forContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Stmt_forContext) For_control() IFor_controlContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFor_controlContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFor_controlContext) +} + +func (s *Stmt_forContext) Loop_body() ILoop_bodyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILoop_bodyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILoop_bodyContext) +} + +func (s *Stmt_forContext) Opt_loop_label() IOpt_loop_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_loop_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_loop_labelContext) +} + +func (s *Stmt_forContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_forContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_forContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_for(s) + } +} + +func (s *Stmt_forContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_for(s) + } +} + +func (s *Stmt_forContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_for(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_for() (localctx IStmt_forContext) { + localctx = NewStmt_forContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1510, PostgreSQLParserRULE_stmt_for) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10829) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserLESS_LESS { + { + p.SetState(10828) + p.Opt_loop_label() + } + + } + { + p.SetState(10831) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10832) + p.For_control() + } + { + p.SetState(10833) + p.Loop_body() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFor_controlContext is an interface to support dynamic dispatch. +type IFor_controlContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + For_variable() IFor_variableContext + IN_P() antlr.TerminalNode + Cursor_name() ICursor_nameContext + Selectstmt() ISelectstmtContext + Explainstmt() IExplainstmtContext + EXECUTE() antlr.TerminalNode + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + DOT_DOT() antlr.TerminalNode + Opt_cursor_parameters() IOpt_cursor_parametersContext + Opt_for_using_expression() IOpt_for_using_expressionContext + Opt_reverse() IOpt_reverseContext + Opt_by_expression() IOpt_by_expressionContext + + // IsFor_controlContext differentiates from other interfaces. + IsFor_controlContext() +} + +type For_controlContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFor_controlContext() *For_controlContext { + var p = new(For_controlContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_control + return p +} + +func InitEmptyFor_controlContext(p *For_controlContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_control +} + +func (*For_controlContext) IsFor_controlContext() {} + +func NewFor_controlContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *For_controlContext { + var p = new(For_controlContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_for_control + + return p +} + +func (s *For_controlContext) GetParser() antlr.Parser { return s.parser } + +func (s *For_controlContext) For_variable() IFor_variableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFor_variableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFor_variableContext) +} + +func (s *For_controlContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *For_controlContext) Cursor_name() ICursor_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_nameContext) +} + +func (s *For_controlContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *For_controlContext) Explainstmt() IExplainstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExplainstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExplainstmtContext) +} + +func (s *For_controlContext) EXECUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXECUTE, 0) +} + +func (s *For_controlContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *For_controlContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *For_controlContext) DOT_DOT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDOT_DOT, 0) +} + +func (s *For_controlContext) Opt_cursor_parameters() IOpt_cursor_parametersContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_cursor_parametersContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_cursor_parametersContext) +} + +func (s *For_controlContext) Opt_for_using_expression() IOpt_for_using_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_for_using_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_for_using_expressionContext) +} + +func (s *For_controlContext) Opt_reverse() IOpt_reverseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_reverseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_reverseContext) +} + +func (s *For_controlContext) Opt_by_expression() IOpt_by_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_by_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_by_expressionContext) +} + +func (s *For_controlContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *For_controlContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *For_controlContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFor_control(s) + } +} + +func (s *For_controlContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFor_control(s) + } +} + +func (s *For_controlContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFor_control(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) For_control() (localctx IFor_controlContext) { + localctx = NewFor_controlContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1512, PostgreSQLParserRULE_for_control) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10835) + p.For_variable() + } + { + p.SetState(10836) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10857) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1056, p.GetParserRuleContext()) { + case 1: + { + p.SetState(10837) + p.Cursor_name() + } + p.SetState(10839) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(10838) + p.Opt_cursor_parameters() + } + + } + + case 2: + { + p.SetState(10841) + p.Selectstmt() + } + + case 3: + { + p.SetState(10842) + p.Explainstmt() + } + + case 4: + { + p.SetState(10843) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10844) + p.A_expr() + } + p.SetState(10846) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(10845) + p.Opt_for_using_expression() + } + + } + + case 5: + p.SetState(10849) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1054, p.GetParserRuleContext()) == 1 { + { + p.SetState(10848) + p.Opt_reverse() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(10851) + p.A_expr() + } + { + p.SetState(10852) + p.Match(PostgreSQLParserDOT_DOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10853) + p.A_expr() + } + p.SetState(10855) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserBY { + { + p.SetState(10854) + p.Opt_by_expression() + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_for_using_expressionContext is an interface to support dynamic dispatch. +type IOpt_for_using_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + Expr_list() IExpr_listContext + + // IsOpt_for_using_expressionContext differentiates from other interfaces. + IsOpt_for_using_expressionContext() +} + +type Opt_for_using_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_for_using_expressionContext() *Opt_for_using_expressionContext { + var p = new(Opt_for_using_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_for_using_expression + return p +} + +func InitEmptyOpt_for_using_expressionContext(p *Opt_for_using_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_for_using_expression +} + +func (*Opt_for_using_expressionContext) IsOpt_for_using_expressionContext() {} + +func NewOpt_for_using_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_for_using_expressionContext { + var p = new(Opt_for_using_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_for_using_expression + + return p +} + +func (s *Opt_for_using_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_for_using_expressionContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Opt_for_using_expressionContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Opt_for_using_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_for_using_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_for_using_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_for_using_expression(s) + } +} + +func (s *Opt_for_using_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_for_using_expression(s) + } +} + +func (s *Opt_for_using_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_for_using_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_for_using_expression() (localctx IOpt_for_using_expressionContext) { + localctx = NewOpt_for_using_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1514, PostgreSQLParserRULE_opt_for_using_expression) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10859) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10860) + p.Expr_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_cursor_parametersContext is an interface to support dynamic dispatch. +type IOpt_cursor_parametersContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN_PAREN() antlr.TerminalNode + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + CLOSE_PAREN() antlr.TerminalNode + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOpt_cursor_parametersContext differentiates from other interfaces. + IsOpt_cursor_parametersContext() +} + +type Opt_cursor_parametersContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_cursor_parametersContext() *Opt_cursor_parametersContext { + var p = new(Opt_cursor_parametersContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_cursor_parameters + return p +} + +func InitEmptyOpt_cursor_parametersContext(p *Opt_cursor_parametersContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_cursor_parameters +} + +func (*Opt_cursor_parametersContext) IsOpt_cursor_parametersContext() {} + +func NewOpt_cursor_parametersContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_cursor_parametersContext { + var p = new(Opt_cursor_parametersContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_cursor_parameters + + return p +} + +func (s *Opt_cursor_parametersContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_cursor_parametersContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Opt_cursor_parametersContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *Opt_cursor_parametersContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_cursor_parametersContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Opt_cursor_parametersContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Opt_cursor_parametersContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Opt_cursor_parametersContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_cursor_parametersContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_cursor_parametersContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_cursor_parameters(s) + } +} + +func (s *Opt_cursor_parametersContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_cursor_parameters(s) + } +} + +func (s *Opt_cursor_parametersContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_cursor_parameters(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_cursor_parameters() (localctx IOpt_cursor_parametersContext) { + localctx = NewOpt_cursor_parametersContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1516, PostgreSQLParserRULE_opt_cursor_parameters) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10862) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10863) + p.A_expr() + } + p.SetState(10868) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10864) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10865) + p.A_expr() + } + + p.SetState(10870) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(10871) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_reverseContext is an interface to support dynamic dispatch. +type IOpt_reverseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + REVERSE() antlr.TerminalNode + + // IsOpt_reverseContext differentiates from other interfaces. + IsOpt_reverseContext() +} + +type Opt_reverseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_reverseContext() *Opt_reverseContext { + var p = new(Opt_reverseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_reverse + return p +} + +func InitEmptyOpt_reverseContext(p *Opt_reverseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_reverse +} + +func (*Opt_reverseContext) IsOpt_reverseContext() {} + +func NewOpt_reverseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_reverseContext { + var p = new(Opt_reverseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_reverse + + return p +} + +func (s *Opt_reverseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_reverseContext) REVERSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserREVERSE, 0) +} + +func (s *Opt_reverseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_reverseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_reverseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_reverse(s) + } +} + +func (s *Opt_reverseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_reverse(s) + } +} + +func (s *Opt_reverseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_reverse(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_reverse() (localctx IOpt_reverseContext) { + localctx = NewOpt_reverseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1518, PostgreSQLParserRULE_opt_reverse) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10873) + p.Match(PostgreSQLParserREVERSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_by_expressionContext is an interface to support dynamic dispatch. +type IOpt_by_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BY() antlr.TerminalNode + A_expr() IA_exprContext + + // IsOpt_by_expressionContext differentiates from other interfaces. + IsOpt_by_expressionContext() +} + +type Opt_by_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_by_expressionContext() *Opt_by_expressionContext { + var p = new(Opt_by_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_by_expression + return p +} + +func InitEmptyOpt_by_expressionContext(p *Opt_by_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_by_expression +} + +func (*Opt_by_expressionContext) IsOpt_by_expressionContext() {} + +func NewOpt_by_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_by_expressionContext { + var p = new(Opt_by_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_by_expression + + return p +} + +func (s *Opt_by_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_by_expressionContext) BY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBY, 0) +} + +func (s *Opt_by_expressionContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_by_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_by_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_by_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_by_expression(s) + } +} + +func (s *Opt_by_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_by_expression(s) + } +} + +func (s *Opt_by_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_by_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_by_expression() (localctx IOpt_by_expressionContext) { + localctx = NewOpt_by_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1520, PostgreSQLParserRULE_opt_by_expression) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10875) + p.Match(PostgreSQLParserBY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10876) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IFor_variableContext is an interface to support dynamic dispatch. +type IFor_variableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Any_name_list() IAny_name_listContext + + // IsFor_variableContext differentiates from other interfaces. + IsFor_variableContext() +} + +type For_variableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFor_variableContext() *For_variableContext { + var p = new(For_variableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_variable + return p +} + +func InitEmptyFor_variableContext(p *For_variableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_for_variable +} + +func (*For_variableContext) IsFor_variableContext() {} + +func NewFor_variableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *For_variableContext { + var p = new(For_variableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_for_variable + + return p +} + +func (s *For_variableContext) GetParser() antlr.Parser { return s.parser } + +func (s *For_variableContext) Any_name_list() IAny_name_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_name_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_name_listContext) +} + +func (s *For_variableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *For_variableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *For_variableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterFor_variable(s) + } +} + +func (s *For_variableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitFor_variable(s) + } +} + +func (s *For_variableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitFor_variable(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) For_variable() (localctx IFor_variableContext) { + localctx = NewFor_variableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1522, PostgreSQLParserRULE_for_variable) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10878) + p.Any_name_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_foreach_aContext is an interface to support dynamic dispatch. +type IStmt_foreach_aContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FOREACH() antlr.TerminalNode + For_variable() IFor_variableContext + IN_P() antlr.TerminalNode + ARRAY() antlr.TerminalNode + A_expr() IA_exprContext + Loop_body() ILoop_bodyContext + Opt_loop_label() IOpt_loop_labelContext + Foreach_slice() IForeach_sliceContext + + // IsStmt_foreach_aContext differentiates from other interfaces. + IsStmt_foreach_aContext() +} + +type Stmt_foreach_aContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_foreach_aContext() *Stmt_foreach_aContext { + var p = new(Stmt_foreach_aContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_foreach_a + return p +} + +func InitEmptyStmt_foreach_aContext(p *Stmt_foreach_aContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_foreach_a +} + +func (*Stmt_foreach_aContext) IsStmt_foreach_aContext() {} + +func NewStmt_foreach_aContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_foreach_aContext { + var p = new(Stmt_foreach_aContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_foreach_a + + return p +} + +func (s *Stmt_foreach_aContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_foreach_aContext) FOREACH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOREACH, 0) +} + +func (s *Stmt_foreach_aContext) For_variable() IFor_variableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFor_variableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFor_variableContext) +} + +func (s *Stmt_foreach_aContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Stmt_foreach_aContext) ARRAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserARRAY, 0) +} + +func (s *Stmt_foreach_aContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Stmt_foreach_aContext) Loop_body() ILoop_bodyContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILoop_bodyContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILoop_bodyContext) +} + +func (s *Stmt_foreach_aContext) Opt_loop_label() IOpt_loop_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_loop_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_loop_labelContext) +} + +func (s *Stmt_foreach_aContext) Foreach_slice() IForeach_sliceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IForeach_sliceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IForeach_sliceContext) +} + +func (s *Stmt_foreach_aContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_foreach_aContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_foreach_aContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_foreach_a(s) + } +} + +func (s *Stmt_foreach_aContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_foreach_a(s) + } +} + +func (s *Stmt_foreach_aContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_foreach_a(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_foreach_a() (localctx IStmt_foreach_aContext) { + localctx = NewStmt_foreach_aContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1524, PostgreSQLParserRULE_stmt_foreach_a) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10881) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserLESS_LESS { + { + p.SetState(10880) + p.Opt_loop_label() + } + + } + { + p.SetState(10883) + p.Match(PostgreSQLParserFOREACH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10884) + p.For_variable() + } + p.SetState(10886) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserSLICE { + { + p.SetState(10885) + p.Foreach_slice() + } + + } + { + p.SetState(10888) + p.Match(PostgreSQLParserIN_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10889) + p.Match(PostgreSQLParserARRAY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10890) + p.A_expr() + } + { + p.SetState(10891) + p.Loop_body() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IForeach_sliceContext is an interface to support dynamic dispatch. +type IForeach_sliceContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SLICE() antlr.TerminalNode + Iconst() IIconstContext + + // IsForeach_sliceContext differentiates from other interfaces. + IsForeach_sliceContext() +} + +type Foreach_sliceContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyForeach_sliceContext() *Foreach_sliceContext { + var p = new(Foreach_sliceContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_foreach_slice + return p +} + +func InitEmptyForeach_sliceContext(p *Foreach_sliceContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_foreach_slice +} + +func (*Foreach_sliceContext) IsForeach_sliceContext() {} + +func NewForeach_sliceContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Foreach_sliceContext { + var p = new(Foreach_sliceContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_foreach_slice + + return p +} + +func (s *Foreach_sliceContext) GetParser() antlr.Parser { return s.parser } + +func (s *Foreach_sliceContext) SLICE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSLICE, 0) +} + +func (s *Foreach_sliceContext) Iconst() IIconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIconstContext) +} + +func (s *Foreach_sliceContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Foreach_sliceContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Foreach_sliceContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterForeach_slice(s) + } +} + +func (s *Foreach_sliceContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitForeach_slice(s) + } +} + +func (s *Foreach_sliceContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitForeach_slice(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Foreach_slice() (localctx IForeach_sliceContext) { + localctx = NewForeach_sliceContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1526, PostgreSQLParserRULE_foreach_slice) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10893) + p.Match(PostgreSQLParserSLICE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10894) + p.Iconst() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_exitContext is an interface to support dynamic dispatch. +type IStmt_exitContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Exit_type() IExit_typeContext + SEMI() antlr.TerminalNode + Opt_label() IOpt_labelContext + Opt_exitcond() IOpt_exitcondContext + + // IsStmt_exitContext differentiates from other interfaces. + IsStmt_exitContext() +} + +type Stmt_exitContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_exitContext() *Stmt_exitContext { + var p = new(Stmt_exitContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_exit + return p +} + +func InitEmptyStmt_exitContext(p *Stmt_exitContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_exit +} + +func (*Stmt_exitContext) IsStmt_exitContext() {} + +func NewStmt_exitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_exitContext { + var p = new(Stmt_exitContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_exit + + return p +} + +func (s *Stmt_exitContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_exitContext) Exit_type() IExit_typeContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExit_typeContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExit_typeContext) +} + +func (s *Stmt_exitContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_exitContext) Opt_label() IOpt_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_labelContext) +} + +func (s *Stmt_exitContext) Opt_exitcond() IOpt_exitcondContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_exitcondContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_exitcondContext) +} + +func (s *Stmt_exitContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_exitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_exitContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_exit(s) + } +} + +func (s *Stmt_exitContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_exit(s) + } +} + +func (s *Stmt_exitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_exit(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_exit() (localctx IStmt_exitContext) { + localctx = NewStmt_exitContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1528, PostgreSQLParserRULE_stmt_exit) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10896) + p.Exit_type() + } + p.SetState(10898) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(10897) + p.Opt_label() + } + + } + p.SetState(10901) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHEN { + { + p.SetState(10900) + p.Opt_exitcond() + } + + } + { + p.SetState(10903) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExit_typeContext is an interface to support dynamic dispatch. +type IExit_typeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EXIT() antlr.TerminalNode + CONTINUE_P() antlr.TerminalNode + + // IsExit_typeContext differentiates from other interfaces. + IsExit_typeContext() +} + +type Exit_typeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExit_typeContext() *Exit_typeContext { + var p = new(Exit_typeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exit_type + return p +} + +func InitEmptyExit_typeContext(p *Exit_typeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exit_type +} + +func (*Exit_typeContext) IsExit_typeContext() {} + +func NewExit_typeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Exit_typeContext { + var p = new(Exit_typeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_exit_type + + return p +} + +func (s *Exit_typeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Exit_typeContext) EXIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXIT, 0) +} + +func (s *Exit_typeContext) CONTINUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONTINUE_P, 0) +} + +func (s *Exit_typeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Exit_typeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Exit_typeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExit_type(s) + } +} + +func (s *Exit_typeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExit_type(s) + } +} + +func (s *Exit_typeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExit_type(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Exit_type() (localctx IExit_typeContext) { + localctx = NewExit_typeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1530, PostgreSQLParserRULE_exit_type) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10905) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserCONTINUE_P || _la == PostgreSQLParserEXIT) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_returnContext is an interface to support dynamic dispatch. +type IStmt_returnContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RETURN() antlr.TerminalNode + SEMI() antlr.TerminalNode + NEXT() antlr.TerminalNode + Sql_expression() ISql_expressionContext + QUERY() antlr.TerminalNode + EXECUTE() antlr.TerminalNode + A_expr() IA_exprContext + Selectstmt() ISelectstmtContext + Opt_return_result() IOpt_return_resultContext + Opt_for_using_expression() IOpt_for_using_expressionContext + + // IsStmt_returnContext differentiates from other interfaces. + IsStmt_returnContext() +} + +type Stmt_returnContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_returnContext() *Stmt_returnContext { + var p = new(Stmt_returnContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_return + return p +} + +func InitEmptyStmt_returnContext(p *Stmt_returnContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_return +} + +func (*Stmt_returnContext) IsStmt_returnContext() {} + +func NewStmt_returnContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_returnContext { + var p = new(Stmt_returnContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_return + + return p +} + +func (s *Stmt_returnContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_returnContext) RETURN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRETURN, 0) +} + +func (s *Stmt_returnContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_returnContext) NEXT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNEXT, 0) +} + +func (s *Stmt_returnContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Stmt_returnContext) QUERY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserQUERY, 0) +} + +func (s *Stmt_returnContext) EXECUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXECUTE, 0) +} + +func (s *Stmt_returnContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Stmt_returnContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *Stmt_returnContext) Opt_return_result() IOpt_return_resultContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_return_resultContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_return_resultContext) +} + +func (s *Stmt_returnContext) Opt_for_using_expression() IOpt_for_using_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_for_using_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_for_using_expressionContext) +} + +func (s *Stmt_returnContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_returnContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_returnContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_return(s) + } +} + +func (s *Stmt_returnContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_return(s) + } +} + +func (s *Stmt_returnContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_return(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_return() (localctx IStmt_returnContext) { + localctx = NewStmt_returnContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1532, PostgreSQLParserRULE_stmt_return) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10907) + p.Match(PostgreSQLParserRETURN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10922) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1065, p.GetParserRuleContext()) { + case 1: + { + p.SetState(10908) + p.Match(PostgreSQLParserNEXT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10909) + p.Sql_expression() + } + + case 2: + { + p.SetState(10910) + p.Match(PostgreSQLParserQUERY) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10917) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserEXECUTE: + { + p.SetState(10911) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10912) + p.A_expr() + } + p.SetState(10914) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(10913) + p.Opt_for_using_expression() + } + + } + + case PostgreSQLParserOPEN_PAREN, PostgreSQLParserSELECT, PostgreSQLParserTABLE, PostgreSQLParserWITH, PostgreSQLParserVALUES: + { + p.SetState(10916) + p.Selectstmt() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 3: + p.SetState(10920) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1064, p.GetParserRuleContext()) == 1 { + { + p.SetState(10919) + p.Opt_return_result() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(10924) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_return_resultContext is an interface to support dynamic dispatch. +type IOpt_return_resultContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sql_expression() ISql_expressionContext + + // IsOpt_return_resultContext differentiates from other interfaces. + IsOpt_return_resultContext() +} + +type Opt_return_resultContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_return_resultContext() *Opt_return_resultContext { + var p = new(Opt_return_resultContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_return_result + return p +} + +func InitEmptyOpt_return_resultContext(p *Opt_return_resultContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_return_result +} + +func (*Opt_return_resultContext) IsOpt_return_resultContext() {} + +func NewOpt_return_resultContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_return_resultContext { + var p = new(Opt_return_resultContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_return_result + + return p +} + +func (s *Opt_return_resultContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_return_resultContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Opt_return_resultContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_return_resultContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_return_resultContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_return_result(s) + } +} + +func (s *Opt_return_resultContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_return_result(s) + } +} + +func (s *Opt_return_resultContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_return_result(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_return_result() (localctx IOpt_return_resultContext) { + localctx = NewOpt_return_resultContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1534, PostgreSQLParserRULE_opt_return_result) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10926) + p.Sql_expression() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_raiseContext is an interface to support dynamic dispatch. +type IStmt_raiseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RAISE() antlr.TerminalNode + Sconst() ISconstContext + SEMI() antlr.TerminalNode + Opt_stmt_raise_level() IOpt_stmt_raise_levelContext + Opt_raise_list() IOpt_raise_listContext + Opt_raise_using() IOpt_raise_usingContext + Identifier() IIdentifierContext + SQLSTATE() antlr.TerminalNode + + // IsStmt_raiseContext differentiates from other interfaces. + IsStmt_raiseContext() +} + +type Stmt_raiseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_raiseContext() *Stmt_raiseContext { + var p = new(Stmt_raiseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_raise + return p +} + +func InitEmptyStmt_raiseContext(p *Stmt_raiseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_raise +} + +func (*Stmt_raiseContext) IsStmt_raiseContext() {} + +func NewStmt_raiseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_raiseContext { + var p = new(Stmt_raiseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_raise + + return p +} + +func (s *Stmt_raiseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_raiseContext) RAISE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRAISE, 0) +} + +func (s *Stmt_raiseContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Stmt_raiseContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_raiseContext) Opt_stmt_raise_level() IOpt_stmt_raise_levelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_stmt_raise_levelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_stmt_raise_levelContext) +} + +func (s *Stmt_raiseContext) Opt_raise_list() IOpt_raise_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_raise_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_raise_listContext) +} + +func (s *Stmt_raiseContext) Opt_raise_using() IOpt_raise_usingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_raise_usingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_raise_usingContext) +} + +func (s *Stmt_raiseContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Stmt_raiseContext) SQLSTATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSQLSTATE, 0) +} + +func (s *Stmt_raiseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_raiseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_raiseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_raise(s) + } +} + +func (s *Stmt_raiseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_raise(s) + } +} + +func (s *Stmt_raiseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_raise(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_raise() (localctx IStmt_raiseContext) { + localctx = NewStmt_raiseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1536, PostgreSQLParserRULE_stmt_raise) + var _la int + + p.SetState(10971) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1075, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10928) + p.Match(PostgreSQLParserRAISE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10930) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-514)) & ^0x3f) == 0 && ((int64(1)<<(_la-514))&63) != 0 { + { + p.SetState(10929) + p.Opt_stmt_raise_level() + } + + } + { + p.SetState(10932) + p.Sconst() + } + p.SetState(10934) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(10933) + p.Opt_raise_list() + } + + } + p.SetState(10937) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(10936) + p.Opt_raise_using() + } + + } + { + p.SetState(10939) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(10941) + p.Match(PostgreSQLParserRAISE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10943) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1069, p.GetParserRuleContext()) == 1 { + { + p.SetState(10942) + p.Opt_stmt_raise_level() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(10945) + p.Identifier() + } + p.SetState(10947) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(10946) + p.Opt_raise_using() + } + + } + { + p.SetState(10949) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(10951) + p.Match(PostgreSQLParserRAISE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10953) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-514)) & ^0x3f) == 0 && ((int64(1)<<(_la-514))&63) != 0 { + { + p.SetState(10952) + p.Opt_stmt_raise_level() + } + + } + { + p.SetState(10955) + p.Match(PostgreSQLParserSQLSTATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10956) + p.Sconst() + } + p.SetState(10958) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(10957) + p.Opt_raise_using() + } + + } + { + p.SetState(10960) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(10962) + p.Match(PostgreSQLParserRAISE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(10964) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64((_la-514)) & ^0x3f) == 0 && ((int64(1)<<(_la-514))&63) != 0 { + { + p.SetState(10963) + p.Opt_stmt_raise_level() + } + + } + p.SetState(10967) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(10966) + p.Opt_raise_using() + } + + } + { + p.SetState(10969) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(10970) + p.Match(PostgreSQLParserRAISE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_stmt_raise_levelContext is an interface to support dynamic dispatch. +type IOpt_stmt_raise_levelContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DEBUG() antlr.TerminalNode + LOG() antlr.TerminalNode + INFO() antlr.TerminalNode + NOTICE() antlr.TerminalNode + WARNING() antlr.TerminalNode + EXCEPTION() antlr.TerminalNode + + // IsOpt_stmt_raise_levelContext differentiates from other interfaces. + IsOpt_stmt_raise_levelContext() +} + +type Opt_stmt_raise_levelContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_stmt_raise_levelContext() *Opt_stmt_raise_levelContext { + var p = new(Opt_stmt_raise_levelContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_stmt_raise_level + return p +} + +func InitEmptyOpt_stmt_raise_levelContext(p *Opt_stmt_raise_levelContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_stmt_raise_level +} + +func (*Opt_stmt_raise_levelContext) IsOpt_stmt_raise_levelContext() {} + +func NewOpt_stmt_raise_levelContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_stmt_raise_levelContext { + var p = new(Opt_stmt_raise_levelContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_stmt_raise_level + + return p +} + +func (s *Opt_stmt_raise_levelContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_stmt_raise_levelContext) DEBUG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEBUG, 0) +} + +func (s *Opt_stmt_raise_levelContext) LOG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOG, 0) +} + +func (s *Opt_stmt_raise_levelContext) INFO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINFO, 0) +} + +func (s *Opt_stmt_raise_levelContext) NOTICE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTICE, 0) +} + +func (s *Opt_stmt_raise_levelContext) WARNING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWARNING, 0) +} + +func (s *Opt_stmt_raise_levelContext) EXCEPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCEPTION, 0) +} + +func (s *Opt_stmt_raise_levelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_stmt_raise_levelContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_stmt_raise_levelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_stmt_raise_level(s) + } +} + +func (s *Opt_stmt_raise_levelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_stmt_raise_level(s) + } +} + +func (s *Opt_stmt_raise_levelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_stmt_raise_level(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_stmt_raise_level() (localctx IOpt_stmt_raise_levelContext) { + localctx = NewOpt_stmt_raise_levelContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1538, PostgreSQLParserRULE_opt_stmt_raise_level) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10973) + _la = p.GetTokenStream().LA(1) + + if !((int64((_la-514)) & ^0x3f) == 0 && ((int64(1)<<(_la-514))&63) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_raise_listContext is an interface to support dynamic dispatch. +type IOpt_raise_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + + // IsOpt_raise_listContext differentiates from other interfaces. + IsOpt_raise_listContext() +} + +type Opt_raise_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_raise_listContext() *Opt_raise_listContext { + var p = new(Opt_raise_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_raise_list + return p +} + +func InitEmptyOpt_raise_listContext(p *Opt_raise_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_raise_list +} + +func (*Opt_raise_listContext) IsOpt_raise_listContext() {} + +func NewOpt_raise_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_raise_listContext { + var p = new(Opt_raise_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_raise_list + + return p +} + +func (s *Opt_raise_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_raise_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Opt_raise_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Opt_raise_listContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *Opt_raise_listContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_raise_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_raise_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_raise_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_raise_list(s) + } +} + +func (s *Opt_raise_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_raise_list(s) + } +} + +func (s *Opt_raise_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_raise_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_raise_list() (localctx IOpt_raise_listContext) { + localctx = NewOpt_raise_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1540, PostgreSQLParserRULE_opt_raise_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(10977) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == PostgreSQLParserCOMMA { + { + p.SetState(10975) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10976) + p.A_expr() + } + + p.SetState(10979) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_raise_usingContext is an interface to support dynamic dispatch. +type IOpt_raise_usingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + Opt_raise_using_elem_list() IOpt_raise_using_elem_listContext + + // IsOpt_raise_usingContext differentiates from other interfaces. + IsOpt_raise_usingContext() +} + +type Opt_raise_usingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_raise_usingContext() *Opt_raise_usingContext { + var p = new(Opt_raise_usingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using + return p +} + +func InitEmptyOpt_raise_usingContext(p *Opt_raise_usingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using +} + +func (*Opt_raise_usingContext) IsOpt_raise_usingContext() {} + +func NewOpt_raise_usingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_raise_usingContext { + var p = new(Opt_raise_usingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using + + return p +} + +func (s *Opt_raise_usingContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_raise_usingContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Opt_raise_usingContext) Opt_raise_using_elem_list() IOpt_raise_using_elem_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_raise_using_elem_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_raise_using_elem_listContext) +} + +func (s *Opt_raise_usingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_raise_usingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_raise_usingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_raise_using(s) + } +} + +func (s *Opt_raise_usingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_raise_using(s) + } +} + +func (s *Opt_raise_usingContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_raise_using(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_raise_using() (localctx IOpt_raise_usingContext) { + localctx = NewOpt_raise_usingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1542, PostgreSQLParserRULE_opt_raise_using) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10981) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10982) + p.Opt_raise_using_elem_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_raise_using_elemContext is an interface to support dynamic dispatch. +type IOpt_raise_using_elemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Identifier() IIdentifierContext + EQUAL() antlr.TerminalNode + A_expr() IA_exprContext + + // IsOpt_raise_using_elemContext differentiates from other interfaces. + IsOpt_raise_using_elemContext() +} + +type Opt_raise_using_elemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_raise_using_elemContext() *Opt_raise_using_elemContext { + var p = new(Opt_raise_using_elemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using_elem + return p +} + +func InitEmptyOpt_raise_using_elemContext(p *Opt_raise_using_elemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using_elem +} + +func (*Opt_raise_using_elemContext) IsOpt_raise_using_elemContext() {} + +func NewOpt_raise_using_elemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_raise_using_elemContext { + var p = new(Opt_raise_using_elemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using_elem + + return p +} + +func (s *Opt_raise_using_elemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_raise_using_elemContext) Identifier() IIdentifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IIdentifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IIdentifierContext) +} + +func (s *Opt_raise_using_elemContext) EQUAL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEQUAL, 0) +} + +func (s *Opt_raise_using_elemContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_raise_using_elemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_raise_using_elemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_raise_using_elemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_raise_using_elem(s) + } +} + +func (s *Opt_raise_using_elemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_raise_using_elem(s) + } +} + +func (s *Opt_raise_using_elemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_raise_using_elem(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_raise_using_elem() (localctx IOpt_raise_using_elemContext) { + localctx = NewOpt_raise_using_elemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1544, PostgreSQLParserRULE_opt_raise_using_elem) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10984) + p.Identifier() + } + { + p.SetState(10985) + p.Match(PostgreSQLParserEQUAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10986) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_raise_using_elem_listContext is an interface to support dynamic dispatch. +type IOpt_raise_using_elem_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllOpt_raise_using_elem() []IOpt_raise_using_elemContext + Opt_raise_using_elem(i int) IOpt_raise_using_elemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOpt_raise_using_elem_listContext differentiates from other interfaces. + IsOpt_raise_using_elem_listContext() +} + +type Opt_raise_using_elem_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_raise_using_elem_listContext() *Opt_raise_using_elem_listContext { + var p = new(Opt_raise_using_elem_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using_elem_list + return p +} + +func InitEmptyOpt_raise_using_elem_listContext(p *Opt_raise_using_elem_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using_elem_list +} + +func (*Opt_raise_using_elem_listContext) IsOpt_raise_using_elem_listContext() {} + +func NewOpt_raise_using_elem_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_raise_using_elem_listContext { + var p = new(Opt_raise_using_elem_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_raise_using_elem_list + + return p +} + +func (s *Opt_raise_using_elem_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_raise_using_elem_listContext) AllOpt_raise_using_elem() []IOpt_raise_using_elemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOpt_raise_using_elemContext); ok { + len++ + } + } + + tst := make([]IOpt_raise_using_elemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOpt_raise_using_elemContext); ok { + tst[i] = t.(IOpt_raise_using_elemContext) + i++ + } + } + + return tst +} + +func (s *Opt_raise_using_elem_listContext) Opt_raise_using_elem(i int) IOpt_raise_using_elemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_raise_using_elemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOpt_raise_using_elemContext) +} + +func (s *Opt_raise_using_elem_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Opt_raise_using_elem_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Opt_raise_using_elem_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_raise_using_elem_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_raise_using_elem_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_raise_using_elem_list(s) + } +} + +func (s *Opt_raise_using_elem_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_raise_using_elem_list(s) + } +} + +func (s *Opt_raise_using_elem_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_raise_using_elem_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_raise_using_elem_list() (localctx IOpt_raise_using_elem_listContext) { + localctx = NewOpt_raise_using_elem_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1546, PostgreSQLParserRULE_opt_raise_using_elem_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10988) + p.Opt_raise_using_elem() + } + p.SetState(10993) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(10989) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10990) + p.Opt_raise_using_elem() + } + + p.SetState(10995) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_assertContext is an interface to support dynamic dispatch. +type IStmt_assertContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ASSERT() antlr.TerminalNode + Sql_expression() ISql_expressionContext + SEMI() antlr.TerminalNode + Opt_stmt_assert_message() IOpt_stmt_assert_messageContext + + // IsStmt_assertContext differentiates from other interfaces. + IsStmt_assertContext() +} + +type Stmt_assertContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_assertContext() *Stmt_assertContext { + var p = new(Stmt_assertContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_assert + return p +} + +func InitEmptyStmt_assertContext(p *Stmt_assertContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_assert +} + +func (*Stmt_assertContext) IsStmt_assertContext() {} + +func NewStmt_assertContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_assertContext { + var p = new(Stmt_assertContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_assert + + return p +} + +func (s *Stmt_assertContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_assertContext) ASSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASSERT, 0) +} + +func (s *Stmt_assertContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Stmt_assertContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_assertContext) Opt_stmt_assert_message() IOpt_stmt_assert_messageContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_stmt_assert_messageContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_stmt_assert_messageContext) +} + +func (s *Stmt_assertContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_assertContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_assertContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_assert(s) + } +} + +func (s *Stmt_assertContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_assert(s) + } +} + +func (s *Stmt_assertContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_assert(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_assert() (localctx IStmt_assertContext) { + localctx = NewStmt_assertContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1548, PostgreSQLParserRULE_stmt_assert) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(10996) + p.Match(PostgreSQLParserASSERT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(10997) + p.Sql_expression() + } + p.SetState(10999) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserCOMMA { + { + p.SetState(10998) + p.Opt_stmt_assert_message() + } + + } + { + p.SetState(11001) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_stmt_assert_messageContext is an interface to support dynamic dispatch. +type IOpt_stmt_assert_messageContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COMMA() antlr.TerminalNode + Sql_expression() ISql_expressionContext + + // IsOpt_stmt_assert_messageContext differentiates from other interfaces. + IsOpt_stmt_assert_messageContext() +} + +type Opt_stmt_assert_messageContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_stmt_assert_messageContext() *Opt_stmt_assert_messageContext { + var p = new(Opt_stmt_assert_messageContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_stmt_assert_message + return p +} + +func InitEmptyOpt_stmt_assert_messageContext(p *Opt_stmt_assert_messageContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_stmt_assert_message +} + +func (*Opt_stmt_assert_messageContext) IsOpt_stmt_assert_messageContext() {} + +func NewOpt_stmt_assert_messageContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_stmt_assert_messageContext { + var p = new(Opt_stmt_assert_messageContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_stmt_assert_message + + return p +} + +func (s *Opt_stmt_assert_messageContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_stmt_assert_messageContext) COMMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, 0) +} + +func (s *Opt_stmt_assert_messageContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Opt_stmt_assert_messageContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_stmt_assert_messageContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_stmt_assert_messageContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_stmt_assert_message(s) + } +} + +func (s *Opt_stmt_assert_messageContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_stmt_assert_message(s) + } +} + +func (s *Opt_stmt_assert_messageContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_stmt_assert_message(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_stmt_assert_message() (localctx IOpt_stmt_assert_messageContext) { + localctx = NewOpt_stmt_assert_messageContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1550, PostgreSQLParserRULE_opt_stmt_assert_message) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11003) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11004) + p.Sql_expression() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ILoop_bodyContext is an interface to support dynamic dispatch. +type ILoop_bodyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllLOOP() []antlr.TerminalNode + LOOP(i int) antlr.TerminalNode + Proc_sect() IProc_sectContext + END_P() antlr.TerminalNode + SEMI() antlr.TerminalNode + Opt_label() IOpt_labelContext + + // IsLoop_bodyContext differentiates from other interfaces. + IsLoop_bodyContext() +} + +type Loop_bodyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyLoop_bodyContext() *Loop_bodyContext { + var p = new(Loop_bodyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_loop_body + return p +} + +func InitEmptyLoop_bodyContext(p *Loop_bodyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_loop_body +} + +func (*Loop_bodyContext) IsLoop_bodyContext() {} + +func NewLoop_bodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Loop_bodyContext { + var p = new(Loop_bodyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_loop_body + + return p +} + +func (s *Loop_bodyContext) GetParser() antlr.Parser { return s.parser } + +func (s *Loop_bodyContext) AllLOOP() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserLOOP) +} + +func (s *Loop_bodyContext) LOOP(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLOOP, i) +} + +func (s *Loop_bodyContext) Proc_sect() IProc_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_sectContext) +} + +func (s *Loop_bodyContext) END_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEND_P, 0) +} + +func (s *Loop_bodyContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Loop_bodyContext) Opt_label() IOpt_labelContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_labelContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_labelContext) +} + +func (s *Loop_bodyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Loop_bodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Loop_bodyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterLoop_body(s) + } +} + +func (s *Loop_bodyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitLoop_body(s) + } +} + +func (s *Loop_bodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitLoop_body(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Loop_body() (localctx ILoop_bodyContext) { + localctx = NewLoop_bodyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1552, PostgreSQLParserRULE_loop_body) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11006) + p.Match(PostgreSQLParserLOOP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11007) + p.Proc_sect() + } + { + p.SetState(11008) + p.Match(PostgreSQLParserEND_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11009) + p.Match(PostgreSQLParserLOOP) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11011) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64((_la-33)) & ^0x3f) == 0 && ((int64(1)<<(_la-33))&576460752589691909) != 0) || ((int64((_la-116)) & ^0x3f) == 0 && ((int64(1)<<(_la-116))&-6775) != 0) || ((int64((_la-180)) & ^0x3f) == 0 && ((int64(1)<<(_la-180))&-1) != 0) || ((int64((_la-244)) & ^0x3f) == 0 && ((int64(1)<<(_la-244))&-577) != 0) || ((int64((_la-308)) & ^0x3f) == 0 && ((int64(1)<<(_la-308))&-1) != 0) || ((int64((_la-372)) & ^0x3f) == 0 && ((int64(1)<<(_la-372))&-1) != 0) || ((int64((_la-436)) & ^0x3f) == 0 && ((int64(1)<<(_la-436))&-274878955521) != 0) || ((int64((_la-500)) & ^0x3f) == 0 && ((int64(1)<<(_la-500))&-2097313) != 0) || ((int64((_la-564)) & ^0x3f) == 0 && ((int64(1)<<(_la-564))&-1) != 0) || ((int64((_la-628)) & ^0x3f) == 0 && ((int64(1)<<(_la-628))&3298536031231) != 0) { + { + p.SetState(11010) + p.Opt_label() + } + + } + { + p.SetState(11013) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_execsqlContext is an interface to support dynamic dispatch. +type IStmt_execsqlContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Make_execsql_stmt() IMake_execsql_stmtContext + SEMI() antlr.TerminalNode + + // IsStmt_execsqlContext differentiates from other interfaces. + IsStmt_execsqlContext() +} + +type Stmt_execsqlContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_execsqlContext() *Stmt_execsqlContext { + var p = new(Stmt_execsqlContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_execsql + return p +} + +func InitEmptyStmt_execsqlContext(p *Stmt_execsqlContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_execsql +} + +func (*Stmt_execsqlContext) IsStmt_execsqlContext() {} + +func NewStmt_execsqlContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_execsqlContext { + var p = new(Stmt_execsqlContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_execsql + + return p +} + +func (s *Stmt_execsqlContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_execsqlContext) Make_execsql_stmt() IMake_execsql_stmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IMake_execsql_stmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IMake_execsql_stmtContext) +} + +func (s *Stmt_execsqlContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_execsqlContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_execsqlContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_execsqlContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_execsql(s) + } +} + +func (s *Stmt_execsqlContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_execsql(s) + } +} + +func (s *Stmt_execsqlContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_execsql(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_execsql() (localctx IStmt_execsqlContext) { + localctx = NewStmt_execsqlContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1554, PostgreSQLParserRULE_stmt_execsql) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11015) + p.Make_execsql_stmt() + } + { + p.SetState(11016) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_dynexecuteContext is an interface to support dynamic dispatch. +type IStmt_dynexecuteContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EXECUTE() antlr.TerminalNode + A_expr() IA_exprContext + SEMI() antlr.TerminalNode + Opt_execute_into() IOpt_execute_intoContext + Opt_execute_using() IOpt_execute_usingContext + + // IsStmt_dynexecuteContext differentiates from other interfaces. + IsStmt_dynexecuteContext() +} + +type Stmt_dynexecuteContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_dynexecuteContext() *Stmt_dynexecuteContext { + var p = new(Stmt_dynexecuteContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_dynexecute + return p +} + +func InitEmptyStmt_dynexecuteContext(p *Stmt_dynexecuteContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_dynexecute +} + +func (*Stmt_dynexecuteContext) IsStmt_dynexecuteContext() {} + +func NewStmt_dynexecuteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_dynexecuteContext { + var p = new(Stmt_dynexecuteContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_dynexecute + + return p +} + +func (s *Stmt_dynexecuteContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_dynexecuteContext) EXECUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXECUTE, 0) +} + +func (s *Stmt_dynexecuteContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Stmt_dynexecuteContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_dynexecuteContext) Opt_execute_into() IOpt_execute_intoContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_execute_intoContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_execute_intoContext) +} + +func (s *Stmt_dynexecuteContext) Opt_execute_using() IOpt_execute_usingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_execute_usingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_execute_usingContext) +} + +func (s *Stmt_dynexecuteContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_dynexecuteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_dynexecuteContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_dynexecute(s) + } +} + +func (s *Stmt_dynexecuteContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_dynexecute(s) + } +} + +func (s *Stmt_dynexecuteContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_dynexecute(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_dynexecute() (localctx IStmt_dynexecuteContext) { + localctx = NewStmt_dynexecuteContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1556, PostgreSQLParserRULE_stmt_dynexecute) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11018) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11019) + p.A_expr() + } + p.SetState(11033) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1084, p.GetParserRuleContext()) { + case 1: + p.SetState(11021) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINTO { + { + p.SetState(11020) + p.Opt_execute_into() + } + + } + p.SetState(11024) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(11023) + p.Opt_execute_using() + } + + } + + case 2: + p.SetState(11027) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(11026) + p.Opt_execute_using() + } + + } + p.SetState(11030) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINTO { + { + p.SetState(11029) + p.Opt_execute_into() + } + + } + + case 3: + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(11035) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_execute_usingContext is an interface to support dynamic dispatch. +type IOpt_execute_usingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + Opt_execute_using_list() IOpt_execute_using_listContext + + // IsOpt_execute_usingContext differentiates from other interfaces. + IsOpt_execute_usingContext() +} + +type Opt_execute_usingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_execute_usingContext() *Opt_execute_usingContext { + var p = new(Opt_execute_usingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_execute_using + return p +} + +func InitEmptyOpt_execute_usingContext(p *Opt_execute_usingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_execute_using +} + +func (*Opt_execute_usingContext) IsOpt_execute_usingContext() {} + +func NewOpt_execute_usingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_execute_usingContext { + var p = new(Opt_execute_usingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_execute_using + + return p +} + +func (s *Opt_execute_usingContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_execute_usingContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Opt_execute_usingContext) Opt_execute_using_list() IOpt_execute_using_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_execute_using_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_execute_using_listContext) +} + +func (s *Opt_execute_usingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_execute_usingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_execute_usingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_execute_using(s) + } +} + +func (s *Opt_execute_usingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_execute_using(s) + } +} + +func (s *Opt_execute_usingContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_execute_using(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_execute_using() (localctx IOpt_execute_usingContext) { + localctx = NewOpt_execute_usingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1558, PostgreSQLParserRULE_opt_execute_using) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11037) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11038) + p.Opt_execute_using_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_execute_using_listContext is an interface to support dynamic dispatch. +type IOpt_execute_using_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllA_expr() []IA_exprContext + A_expr(i int) IA_exprContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOpt_execute_using_listContext differentiates from other interfaces. + IsOpt_execute_using_listContext() +} + +type Opt_execute_using_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_execute_using_listContext() *Opt_execute_using_listContext { + var p = new(Opt_execute_using_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_execute_using_list + return p +} + +func InitEmptyOpt_execute_using_listContext(p *Opt_execute_using_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_execute_using_list +} + +func (*Opt_execute_using_listContext) IsOpt_execute_using_listContext() {} + +func NewOpt_execute_using_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_execute_using_listContext { + var p = new(Opt_execute_using_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_execute_using_list + + return p +} + +func (s *Opt_execute_using_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_execute_using_listContext) AllA_expr() []IA_exprContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IA_exprContext); ok { + len++ + } + } + + tst := make([]IA_exprContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IA_exprContext); ok { + tst[i] = t.(IA_exprContext) + i++ + } + } + + return tst +} + +func (s *Opt_execute_using_listContext) A_expr(i int) IA_exprContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_execute_using_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Opt_execute_using_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Opt_execute_using_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_execute_using_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_execute_using_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_execute_using_list(s) + } +} + +func (s *Opt_execute_using_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_execute_using_list(s) + } +} + +func (s *Opt_execute_using_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_execute_using_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_execute_using_list() (localctx IOpt_execute_using_listContext) { + localctx = NewOpt_execute_using_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1560, PostgreSQLParserRULE_opt_execute_using_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11040) + p.A_expr() + } + p.SetState(11045) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(11041) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11042) + p.A_expr() + } + + p.SetState(11047) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_execute_intoContext is an interface to support dynamic dispatch. +type IOpt_execute_intoContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INTO() antlr.TerminalNode + Into_target() IInto_targetContext + STRICT_P() antlr.TerminalNode + + // IsOpt_execute_intoContext differentiates from other interfaces. + IsOpt_execute_intoContext() +} + +type Opt_execute_intoContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_execute_intoContext() *Opt_execute_intoContext { + var p = new(Opt_execute_intoContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_execute_into + return p +} + +func InitEmptyOpt_execute_intoContext(p *Opt_execute_intoContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_execute_into +} + +func (*Opt_execute_intoContext) IsOpt_execute_intoContext() {} + +func NewOpt_execute_intoContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_execute_intoContext { + var p = new(Opt_execute_intoContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_execute_into + + return p +} + +func (s *Opt_execute_intoContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_execute_intoContext) INTO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTO, 0) +} + +func (s *Opt_execute_intoContext) Into_target() IInto_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInto_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInto_targetContext) +} + +func (s *Opt_execute_intoContext) STRICT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTRICT_P, 0) +} + +func (s *Opt_execute_intoContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_execute_intoContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_execute_intoContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_execute_into(s) + } +} + +func (s *Opt_execute_intoContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_execute_into(s) + } +} + +func (s *Opt_execute_intoContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_execute_into(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_execute_into() (localctx IOpt_execute_intoContext) { + localctx = NewOpt_execute_intoContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1562, PostgreSQLParserRULE_opt_execute_into) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11048) + p.Match(PostgreSQLParserINTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11050) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1086, p.GetParserRuleContext()) == 1 { + { + p.SetState(11049) + p.Match(PostgreSQLParserSTRICT_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(11052) + p.Into_target() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_openContext is an interface to support dynamic dispatch. +type IStmt_openContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + OPEN() antlr.TerminalNode + SEMI() antlr.TerminalNode + Cursor_variable() ICursor_variableContext + FOR() antlr.TerminalNode + Colid() IColidContext + Selectstmt() ISelectstmtContext + EXECUTE() antlr.TerminalNode + Sql_expression() ISql_expressionContext + Opt_scroll_option() IOpt_scroll_optionContext + OPEN_PAREN() antlr.TerminalNode + Opt_open_bound_list() IOpt_open_bound_listContext + CLOSE_PAREN() antlr.TerminalNode + Opt_open_using() IOpt_open_usingContext + + // IsStmt_openContext differentiates from other interfaces. + IsStmt_openContext() +} + +type Stmt_openContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_openContext() *Stmt_openContext { + var p = new(Stmt_openContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_open + return p +} + +func InitEmptyStmt_openContext(p *Stmt_openContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_open +} + +func (*Stmt_openContext) IsStmt_openContext() {} + +func NewStmt_openContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_openContext { + var p = new(Stmt_openContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_open + + return p +} + +func (s *Stmt_openContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_openContext) OPEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN, 0) +} + +func (s *Stmt_openContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_openContext) Cursor_variable() ICursor_variableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_variableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_variableContext) +} + +func (s *Stmt_openContext) FOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFOR, 0) +} + +func (s *Stmt_openContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Stmt_openContext) Selectstmt() ISelectstmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectstmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectstmtContext) +} + +func (s *Stmt_openContext) EXECUTE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXECUTE, 0) +} + +func (s *Stmt_openContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Stmt_openContext) Opt_scroll_option() IOpt_scroll_optionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_scroll_optionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_scroll_optionContext) +} + +func (s *Stmt_openContext) OPEN_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN_PAREN, 0) +} + +func (s *Stmt_openContext) Opt_open_bound_list() IOpt_open_bound_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_open_bound_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_open_bound_listContext) +} + +func (s *Stmt_openContext) CLOSE_PAREN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE_PAREN, 0) +} + +func (s *Stmt_openContext) Opt_open_using() IOpt_open_usingContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_open_usingContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_open_usingContext) +} + +func (s *Stmt_openContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_openContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_openContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_open(s) + } +} + +func (s *Stmt_openContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_open(s) + } +} + +func (s *Stmt_openContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_open(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_open() (localctx IStmt_openContext) { + localctx = NewStmt_openContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1564, PostgreSQLParserRULE_stmt_open) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11054) + p.Match(PostgreSQLParserOPEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11075) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1091, p.GetParserRuleContext()) { + case 1: + { + p.SetState(11055) + p.Cursor_variable() + } + p.SetState(11057) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO || _la == PostgreSQLParserSCROLL { + { + p.SetState(11056) + p.Opt_scroll_option() + } + + } + { + p.SetState(11059) + p.Match(PostgreSQLParserFOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11066) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserOPEN_PAREN, PostgreSQLParserSELECT, PostgreSQLParserTABLE, PostgreSQLParserWITH, PostgreSQLParserVALUES: + { + p.SetState(11060) + p.Selectstmt() + } + + case PostgreSQLParserEXECUTE: + { + p.SetState(11061) + p.Match(PostgreSQLParserEXECUTE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11062) + p.Sql_expression() + } + p.SetState(11064) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserUSING { + { + p.SetState(11063) + p.Opt_open_using() + } + + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + case 2: + { + p.SetState(11068) + p.Colid() + } + p.SetState(11073) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserOPEN_PAREN { + { + p.SetState(11069) + p.Match(PostgreSQLParserOPEN_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11070) + p.Opt_open_bound_list() + } + { + p.SetState(11071) + p.Match(PostgreSQLParserCLOSE_PAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + { + p.SetState(11077) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_open_bound_list_itemContext is an interface to support dynamic dispatch. +type IOpt_open_bound_list_itemContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + COLON_EQUALS() antlr.TerminalNode + A_expr() IA_exprContext + + // IsOpt_open_bound_list_itemContext differentiates from other interfaces. + IsOpt_open_bound_list_itemContext() +} + +type Opt_open_bound_list_itemContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_open_bound_list_itemContext() *Opt_open_bound_list_itemContext { + var p = new(Opt_open_bound_list_itemContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_open_bound_list_item + return p +} + +func InitEmptyOpt_open_bound_list_itemContext(p *Opt_open_bound_list_itemContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_open_bound_list_item +} + +func (*Opt_open_bound_list_itemContext) IsOpt_open_bound_list_itemContext() {} + +func NewOpt_open_bound_list_itemContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_open_bound_list_itemContext { + var p = new(Opt_open_bound_list_itemContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_open_bound_list_item + + return p +} + +func (s *Opt_open_bound_list_itemContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_open_bound_list_itemContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Opt_open_bound_list_itemContext) COLON_EQUALS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLON_EQUALS, 0) +} + +func (s *Opt_open_bound_list_itemContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_open_bound_list_itemContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_open_bound_list_itemContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_open_bound_list_itemContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_open_bound_list_item(s) + } +} + +func (s *Opt_open_bound_list_itemContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_open_bound_list_item(s) + } +} + +func (s *Opt_open_bound_list_itemContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_open_bound_list_item(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_open_bound_list_item() (localctx IOpt_open_bound_list_itemContext) { + localctx = NewOpt_open_bound_list_itemContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1566, PostgreSQLParserRULE_opt_open_bound_list_item) + p.SetState(11084) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1092, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11079) + p.Colid() + } + { + p.SetState(11080) + p.Match(PostgreSQLParserCOLON_EQUALS) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11081) + p.A_expr() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(11083) + p.A_expr() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_open_bound_listContext is an interface to support dynamic dispatch. +type IOpt_open_bound_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllOpt_open_bound_list_item() []IOpt_open_bound_list_itemContext + Opt_open_bound_list_item(i int) IOpt_open_bound_list_itemContext + AllCOMMA() []antlr.TerminalNode + COMMA(i int) antlr.TerminalNode + + // IsOpt_open_bound_listContext differentiates from other interfaces. + IsOpt_open_bound_listContext() +} + +type Opt_open_bound_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_open_bound_listContext() *Opt_open_bound_listContext { + var p = new(Opt_open_bound_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_open_bound_list + return p +} + +func InitEmptyOpt_open_bound_listContext(p *Opt_open_bound_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_open_bound_list +} + +func (*Opt_open_bound_listContext) IsOpt_open_bound_listContext() {} + +func NewOpt_open_bound_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_open_bound_listContext { + var p = new(Opt_open_bound_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_open_bound_list + + return p +} + +func (s *Opt_open_bound_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_open_bound_listContext) AllOpt_open_bound_list_item() []IOpt_open_bound_list_itemContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IOpt_open_bound_list_itemContext); ok { + len++ + } + } + + tst := make([]IOpt_open_bound_list_itemContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IOpt_open_bound_list_itemContext); ok { + tst[i] = t.(IOpt_open_bound_list_itemContext) + i++ + } + } + + return tst +} + +func (s *Opt_open_bound_listContext) Opt_open_bound_list_item(i int) IOpt_open_bound_list_itemContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_open_bound_list_itemContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IOpt_open_bound_list_itemContext) +} + +func (s *Opt_open_bound_listContext) AllCOMMA() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserCOMMA) +} + +func (s *Opt_open_bound_listContext) COMMA(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMA, i) +} + +func (s *Opt_open_bound_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_open_bound_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_open_bound_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_open_bound_list(s) + } +} + +func (s *Opt_open_bound_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_open_bound_list(s) + } +} + +func (s *Opt_open_bound_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_open_bound_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_open_bound_list() (localctx IOpt_open_bound_listContext) { + localctx = NewOpt_open_bound_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1568, PostgreSQLParserRULE_opt_open_bound_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11086) + p.Opt_open_bound_list_item() + } + p.SetState(11091) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserCOMMA { + { + p.SetState(11087) + p.Match(PostgreSQLParserCOMMA) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11088) + p.Opt_open_bound_list_item() + } + + p.SetState(11093) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_open_usingContext is an interface to support dynamic dispatch. +type IOpt_open_usingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + USING() antlr.TerminalNode + Expr_list() IExpr_listContext + + // IsOpt_open_usingContext differentiates from other interfaces. + IsOpt_open_usingContext() +} + +type Opt_open_usingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_open_usingContext() *Opt_open_usingContext { + var p = new(Opt_open_usingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_open_using + return p +} + +func InitEmptyOpt_open_usingContext(p *Opt_open_usingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_open_using +} + +func (*Opt_open_usingContext) IsOpt_open_usingContext() {} + +func NewOpt_open_usingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_open_usingContext { + var p = new(Opt_open_usingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_open_using + + return p +} + +func (s *Opt_open_usingContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_open_usingContext) USING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSING, 0) +} + +func (s *Opt_open_usingContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Opt_open_usingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_open_usingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_open_usingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_open_using(s) + } +} + +func (s *Opt_open_usingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_open_using(s) + } +} + +func (s *Opt_open_usingContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_open_using(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_open_using() (localctx IOpt_open_usingContext) { + localctx = NewOpt_open_usingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1570, PostgreSQLParserRULE_opt_open_using) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11094) + p.Match(PostgreSQLParserUSING) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11095) + p.Expr_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_scroll_optionContext is an interface to support dynamic dispatch. +type IOpt_scroll_optionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SCROLL() antlr.TerminalNode + Opt_scroll_option_no() IOpt_scroll_option_noContext + + // IsOpt_scroll_optionContext differentiates from other interfaces. + IsOpt_scroll_optionContext() +} + +type Opt_scroll_optionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_scroll_optionContext() *Opt_scroll_optionContext { + var p = new(Opt_scroll_optionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_scroll_option + return p +} + +func InitEmptyOpt_scroll_optionContext(p *Opt_scroll_optionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_scroll_option +} + +func (*Opt_scroll_optionContext) IsOpt_scroll_optionContext() {} + +func NewOpt_scroll_optionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_scroll_optionContext { + var p = new(Opt_scroll_optionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_scroll_option + + return p +} + +func (s *Opt_scroll_optionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_scroll_optionContext) SCROLL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCROLL, 0) +} + +func (s *Opt_scroll_optionContext) Opt_scroll_option_no() IOpt_scroll_option_noContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_scroll_option_noContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_scroll_option_noContext) +} + +func (s *Opt_scroll_optionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_scroll_optionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_scroll_optionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_scroll_option(s) + } +} + +func (s *Opt_scroll_optionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_scroll_option(s) + } +} + +func (s *Opt_scroll_optionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_scroll_option(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_scroll_option() (localctx IOpt_scroll_optionContext) { + localctx = NewOpt_scroll_optionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1572, PostgreSQLParserRULE_opt_scroll_option) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(11098) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(11097) + p.Opt_scroll_option_no() + } + + } + { + p.SetState(11100) + p.Match(PostgreSQLParserSCROLL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_scroll_option_noContext is an interface to support dynamic dispatch. +type IOpt_scroll_option_noContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NO() antlr.TerminalNode + + // IsOpt_scroll_option_noContext differentiates from other interfaces. + IsOpt_scroll_option_noContext() +} + +type Opt_scroll_option_noContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_scroll_option_noContext() *Opt_scroll_option_noContext { + var p = new(Opt_scroll_option_noContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_scroll_option_no + return p +} + +func InitEmptyOpt_scroll_option_noContext(p *Opt_scroll_option_noContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_scroll_option_no +} + +func (*Opt_scroll_option_noContext) IsOpt_scroll_option_noContext() {} + +func NewOpt_scroll_option_noContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_scroll_option_noContext { + var p = new(Opt_scroll_option_noContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_scroll_option_no + + return p +} + +func (s *Opt_scroll_option_noContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_scroll_option_noContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Opt_scroll_option_noContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_scroll_option_noContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_scroll_option_noContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_scroll_option_no(s) + } +} + +func (s *Opt_scroll_option_noContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_scroll_option_no(s) + } +} + +func (s *Opt_scroll_option_noContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_scroll_option_no(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_scroll_option_no() (localctx IOpt_scroll_option_noContext) { + localctx = NewOpt_scroll_option_noContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1574, PostgreSQLParserRULE_opt_scroll_option_no) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11102) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_fetchContext is an interface to support dynamic dispatch. +type IStmt_fetchContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // GetDirection returns the direction rule contexts. + GetDirection() IOpt_fetch_directionContext + + // SetDirection sets the direction rule contexts. + SetDirection(IOpt_fetch_directionContext) + + // Getter signatures + FETCH() antlr.TerminalNode + Cursor_variable() ICursor_variableContext + INTO() antlr.TerminalNode + Into_target() IInto_targetContext + SEMI() antlr.TerminalNode + Opt_cursor_from() IOpt_cursor_fromContext + Opt_fetch_direction() IOpt_fetch_directionContext + + // IsStmt_fetchContext differentiates from other interfaces. + IsStmt_fetchContext() +} + +type Stmt_fetchContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser + direction IOpt_fetch_directionContext +} + +func NewEmptyStmt_fetchContext() *Stmt_fetchContext { + var p = new(Stmt_fetchContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_fetch + return p +} + +func InitEmptyStmt_fetchContext(p *Stmt_fetchContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_fetch +} + +func (*Stmt_fetchContext) IsStmt_fetchContext() {} + +func NewStmt_fetchContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_fetchContext { + var p = new(Stmt_fetchContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_fetch + + return p +} + +func (s *Stmt_fetchContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_fetchContext) GetDirection() IOpt_fetch_directionContext { return s.direction } + +func (s *Stmt_fetchContext) SetDirection(v IOpt_fetch_directionContext) { s.direction = v } + +func (s *Stmt_fetchContext) FETCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFETCH, 0) +} + +func (s *Stmt_fetchContext) Cursor_variable() ICursor_variableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_variableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_variableContext) +} + +func (s *Stmt_fetchContext) INTO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTO, 0) +} + +func (s *Stmt_fetchContext) Into_target() IInto_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInto_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInto_targetContext) +} + +func (s *Stmt_fetchContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_fetchContext) Opt_cursor_from() IOpt_cursor_fromContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_cursor_fromContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_cursor_fromContext) +} + +func (s *Stmt_fetchContext) Opt_fetch_direction() IOpt_fetch_directionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_fetch_directionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_fetch_directionContext) +} + +func (s *Stmt_fetchContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_fetchContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_fetchContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_fetch(s) + } +} + +func (s *Stmt_fetchContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_fetch(s) + } +} + +func (s *Stmt_fetchContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_fetch(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_fetch() (localctx IStmt_fetchContext) { + localctx = NewStmt_fetchContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1576, PostgreSQLParserRULE_stmt_fetch) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11104) + p.Match(PostgreSQLParserFETCH) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11106) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1095, p.GetParserRuleContext()) == 1 { + { + p.SetState(11105) + + var _x = p.Opt_fetch_direction() + + localctx.(*Stmt_fetchContext).direction = _x + } + + } else if p.HasError() { // JIM + goto errorExit + } + p.SetState(11109) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P { + { + p.SetState(11108) + p.Opt_cursor_from() + } + + } + { + p.SetState(11111) + p.Cursor_variable() + } + { + p.SetState(11112) + p.Match(PostgreSQLParserINTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11113) + p.Into_target() + } + { + p.SetState(11114) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IInto_targetContext is an interface to support dynamic dispatch. +type IInto_targetContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Expr_list() IExpr_listContext + + // IsInto_targetContext differentiates from other interfaces. + IsInto_targetContext() +} + +type Into_targetContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInto_targetContext() *Into_targetContext { + var p = new(Into_targetContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_into_target + return p +} + +func InitEmptyInto_targetContext(p *Into_targetContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_into_target +} + +func (*Into_targetContext) IsInto_targetContext() {} + +func NewInto_targetContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Into_targetContext { + var p = new(Into_targetContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_into_target + + return p +} + +func (s *Into_targetContext) GetParser() antlr.Parser { return s.parser } + +func (s *Into_targetContext) Expr_list() IExpr_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_listContext) +} + +func (s *Into_targetContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Into_targetContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Into_targetContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterInto_target(s) + } +} + +func (s *Into_targetContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitInto_target(s) + } +} + +func (s *Into_targetContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitInto_target(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Into_target() (localctx IInto_targetContext) { + localctx = NewInto_targetContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1578, PostgreSQLParserRULE_into_target) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11116) + p.Expr_list() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_cursor_fromContext is an interface to support dynamic dispatch. +type IOpt_cursor_fromContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FROM() antlr.TerminalNode + IN_P() antlr.TerminalNode + + // IsOpt_cursor_fromContext differentiates from other interfaces. + IsOpt_cursor_fromContext() +} + +type Opt_cursor_fromContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_cursor_fromContext() *Opt_cursor_fromContext { + var p = new(Opt_cursor_fromContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_cursor_from + return p +} + +func InitEmptyOpt_cursor_fromContext(p *Opt_cursor_fromContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_cursor_from +} + +func (*Opt_cursor_fromContext) IsOpt_cursor_fromContext() {} + +func NewOpt_cursor_fromContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_cursor_fromContext { + var p = new(Opt_cursor_fromContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_cursor_from + + return p +} + +func (s *Opt_cursor_fromContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_cursor_fromContext) FROM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFROM, 0) +} + +func (s *Opt_cursor_fromContext) IN_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIN_P, 0) +} + +func (s *Opt_cursor_fromContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_cursor_fromContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_cursor_fromContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_cursor_from(s) + } +} + +func (s *Opt_cursor_fromContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_cursor_from(s) + } +} + +func (s *Opt_cursor_fromContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_cursor_from(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_cursor_from() (localctx IOpt_cursor_fromContext) { + localctx = NewOpt_cursor_fromContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1580, PostgreSQLParserRULE_opt_cursor_from) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11118) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserFROM || _la == PostgreSQLParserIN_P) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_fetch_directionContext is an interface to support dynamic dispatch. +type IOpt_fetch_directionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NEXT() antlr.TerminalNode + PRIOR() antlr.TerminalNode + FIRST_P() antlr.TerminalNode + LAST_P() antlr.TerminalNode + ABSOLUTE_P() antlr.TerminalNode + A_expr() IA_exprContext + RELATIVE_P() antlr.TerminalNode + ALL() antlr.TerminalNode + FORWARD() antlr.TerminalNode + BACKWARD() antlr.TerminalNode + + // IsOpt_fetch_directionContext differentiates from other interfaces. + IsOpt_fetch_directionContext() +} + +type Opt_fetch_directionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_fetch_directionContext() *Opt_fetch_directionContext { + var p = new(Opt_fetch_directionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_fetch_direction + return p +} + +func InitEmptyOpt_fetch_directionContext(p *Opt_fetch_directionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_fetch_direction +} + +func (*Opt_fetch_directionContext) IsOpt_fetch_directionContext() {} + +func NewOpt_fetch_directionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_fetch_directionContext { + var p = new(Opt_fetch_directionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_fetch_direction + + return p +} + +func (s *Opt_fetch_directionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_fetch_directionContext) NEXT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNEXT, 0) +} + +func (s *Opt_fetch_directionContext) PRIOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIOR, 0) +} + +func (s *Opt_fetch_directionContext) FIRST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFIRST_P, 0) +} + +func (s *Opt_fetch_directionContext) LAST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLAST_P, 0) +} + +func (s *Opt_fetch_directionContext) ABSOLUTE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserABSOLUTE_P, 0) +} + +func (s *Opt_fetch_directionContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Opt_fetch_directionContext) RELATIVE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRELATIVE_P, 0) +} + +func (s *Opt_fetch_directionContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Opt_fetch_directionContext) FORWARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORWARD, 0) +} + +func (s *Opt_fetch_directionContext) BACKWARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBACKWARD, 0) +} + +func (s *Opt_fetch_directionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_fetch_directionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_fetch_directionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_fetch_direction(s) + } +} + +func (s *Opt_fetch_directionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_fetch_direction(s) + } +} + +func (s *Opt_fetch_directionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_fetch_direction(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_fetch_direction() (localctx IOpt_fetch_directionContext) { + localctx = NewOpt_fetch_directionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1582, PostgreSQLParserRULE_opt_fetch_direction) + var _la int + + p.SetState(11135) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1098, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11120) + p.Match(PostgreSQLParserNEXT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(11121) + p.Match(PostgreSQLParserPRIOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(11122) + p.Match(PostgreSQLParserFIRST_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 4: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(11123) + p.Match(PostgreSQLParserLAST_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 5: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(11124) + p.Match(PostgreSQLParserABSOLUTE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11125) + p.A_expr() + } + + case 6: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(11126) + p.Match(PostgreSQLParserRELATIVE_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11127) + p.A_expr() + } + + case 7: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(11128) + p.A_expr() + } + + case 8: + p.EnterOuterAlt(localctx, 8) + { + p.SetState(11129) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case 9: + p.EnterOuterAlt(localctx, 9) + { + p.SetState(11130) + _la = p.GetTokenStream().LA(1) + + if !(_la == PostgreSQLParserBACKWARD || _la == PostgreSQLParserFORWARD) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + p.SetState(11133) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1097, p.GetParserRuleContext()) == 1 { + { + p.SetState(11131) + p.A_expr() + } + + } else if p.HasError() { // JIM + goto errorExit + } else if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1097, p.GetParserRuleContext()) == 2 { + { + p.SetState(11132) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } else if p.HasError() { // JIM + goto errorExit + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_moveContext is an interface to support dynamic dispatch. +type IStmt_moveContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + MOVE() antlr.TerminalNode + Cursor_variable() ICursor_variableContext + SEMI() antlr.TerminalNode + Opt_fetch_direction() IOpt_fetch_directionContext + + // IsStmt_moveContext differentiates from other interfaces. + IsStmt_moveContext() +} + +type Stmt_moveContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_moveContext() *Stmt_moveContext { + var p = new(Stmt_moveContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_move + return p +} + +func InitEmptyStmt_moveContext(p *Stmt_moveContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_move +} + +func (*Stmt_moveContext) IsStmt_moveContext() {} + +func NewStmt_moveContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_moveContext { + var p = new(Stmt_moveContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_move + + return p +} + +func (s *Stmt_moveContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_moveContext) MOVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMOVE, 0) +} + +func (s *Stmt_moveContext) Cursor_variable() ICursor_variableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_variableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_variableContext) +} + +func (s *Stmt_moveContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_moveContext) Opt_fetch_direction() IOpt_fetch_directionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_fetch_directionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_fetch_directionContext) +} + +func (s *Stmt_moveContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_moveContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_moveContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_move(s) + } +} + +func (s *Stmt_moveContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_move(s) + } +} + +func (s *Stmt_moveContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_move(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_move() (localctx IStmt_moveContext) { + localctx = NewStmt_moveContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1584, PostgreSQLParserRULE_stmt_move) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11137) + p.Match(PostgreSQLParserMOVE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11139) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1099, p.GetParserRuleContext()) == 1 { + { + p.SetState(11138) + p.Opt_fetch_direction() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(11141) + p.Cursor_variable() + } + { + p.SetState(11142) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_closeContext is an interface to support dynamic dispatch. +type IStmt_closeContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + CLOSE() antlr.TerminalNode + Cursor_variable() ICursor_variableContext + SEMI() antlr.TerminalNode + + // IsStmt_closeContext differentiates from other interfaces. + IsStmt_closeContext() +} + +type Stmt_closeContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_closeContext() *Stmt_closeContext { + var p = new(Stmt_closeContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_close + return p +} + +func InitEmptyStmt_closeContext(p *Stmt_closeContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_close +} + +func (*Stmt_closeContext) IsStmt_closeContext() {} + +func NewStmt_closeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_closeContext { + var p = new(Stmt_closeContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_close + + return p +} + +func (s *Stmt_closeContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_closeContext) CLOSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE, 0) +} + +func (s *Stmt_closeContext) Cursor_variable() ICursor_variableContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICursor_variableContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICursor_variableContext) +} + +func (s *Stmt_closeContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_closeContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_closeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_closeContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_close(s) + } +} + +func (s *Stmt_closeContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_close(s) + } +} + +func (s *Stmt_closeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_close(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_close() (localctx IStmt_closeContext) { + localctx = NewStmt_closeContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1586, PostgreSQLParserRULE_stmt_close) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11144) + p.Match(PostgreSQLParserCLOSE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11145) + p.Cursor_variable() + } + { + p.SetState(11146) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_nullContext is an interface to support dynamic dispatch. +type IStmt_nullContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NULL_P() antlr.TerminalNode + SEMI() antlr.TerminalNode + + // IsStmt_nullContext differentiates from other interfaces. + IsStmt_nullContext() +} + +type Stmt_nullContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_nullContext() *Stmt_nullContext { + var p = new(Stmt_nullContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_null + return p +} + +func InitEmptyStmt_nullContext(p *Stmt_nullContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_null +} + +func (*Stmt_nullContext) IsStmt_nullContext() {} + +func NewStmt_nullContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_nullContext { + var p = new(Stmt_nullContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_null + + return p +} + +func (s *Stmt_nullContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_nullContext) NULL_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNULL_P, 0) +} + +func (s *Stmt_nullContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_nullContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_nullContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_nullContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_null(s) + } +} + +func (s *Stmt_nullContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_null(s) + } +} + +func (s *Stmt_nullContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_null(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_null() (localctx IStmt_nullContext) { + localctx = NewStmt_nullContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1588, PostgreSQLParserRULE_stmt_null) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11148) + p.Match(PostgreSQLParserNULL_P) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11149) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_commitContext is an interface to support dynamic dispatch. +type IStmt_commitContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COMMIT() antlr.TerminalNode + SEMI() antlr.TerminalNode + Plsql_opt_transaction_chain() IPlsql_opt_transaction_chainContext + + // IsStmt_commitContext differentiates from other interfaces. + IsStmt_commitContext() +} + +type Stmt_commitContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_commitContext() *Stmt_commitContext { + var p = new(Stmt_commitContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_commit + return p +} + +func InitEmptyStmt_commitContext(p *Stmt_commitContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_commit +} + +func (*Stmt_commitContext) IsStmt_commitContext() {} + +func NewStmt_commitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_commitContext { + var p = new(Stmt_commitContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_commit + + return p +} + +func (s *Stmt_commitContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_commitContext) COMMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMIT, 0) +} + +func (s *Stmt_commitContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_commitContext) Plsql_opt_transaction_chain() IPlsql_opt_transaction_chainContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_opt_transaction_chainContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_opt_transaction_chainContext) +} + +func (s *Stmt_commitContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_commitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_commitContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_commit(s) + } +} + +func (s *Stmt_commitContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_commit(s) + } +} + +func (s *Stmt_commitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_commit(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_commit() (localctx IStmt_commitContext) { + localctx = NewStmt_commitContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1590, PostgreSQLParserRULE_stmt_commit) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11151) + p.Match(PostgreSQLParserCOMMIT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11153) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAND { + { + p.SetState(11152) + p.Plsql_opt_transaction_chain() + } + + } + { + p.SetState(11155) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_rollbackContext is an interface to support dynamic dispatch. +type IStmt_rollbackContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ROLLBACK() antlr.TerminalNode + SEMI() antlr.TerminalNode + Plsql_opt_transaction_chain() IPlsql_opt_transaction_chainContext + + // IsStmt_rollbackContext differentiates from other interfaces. + IsStmt_rollbackContext() +} + +type Stmt_rollbackContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_rollbackContext() *Stmt_rollbackContext { + var p = new(Stmt_rollbackContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_rollback + return p +} + +func InitEmptyStmt_rollbackContext(p *Stmt_rollbackContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_rollback +} + +func (*Stmt_rollbackContext) IsStmt_rollbackContext() {} + +func NewStmt_rollbackContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_rollbackContext { + var p = new(Stmt_rollbackContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_rollback + + return p +} + +func (s *Stmt_rollbackContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_rollbackContext) ROLLBACK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLLBACK, 0) +} + +func (s *Stmt_rollbackContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_rollbackContext) Plsql_opt_transaction_chain() IPlsql_opt_transaction_chainContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_opt_transaction_chainContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_opt_transaction_chainContext) +} + +func (s *Stmt_rollbackContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_rollbackContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_rollbackContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_rollback(s) + } +} + +func (s *Stmt_rollbackContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_rollback(s) + } +} + +func (s *Stmt_rollbackContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_rollback(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_rollback() (localctx IStmt_rollbackContext) { + localctx = NewStmt_rollbackContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1592, PostgreSQLParserRULE_stmt_rollback) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11157) + p.Match(PostgreSQLParserROLLBACK) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11159) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserAND { + { + p.SetState(11158) + p.Plsql_opt_transaction_chain() + } + + } + { + p.SetState(11161) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPlsql_opt_transaction_chainContext is an interface to support dynamic dispatch. +type IPlsql_opt_transaction_chainContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AND() antlr.TerminalNode + CHAIN() antlr.TerminalNode + NO() antlr.TerminalNode + + // IsPlsql_opt_transaction_chainContext differentiates from other interfaces. + IsPlsql_opt_transaction_chainContext() +} + +type Plsql_opt_transaction_chainContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPlsql_opt_transaction_chainContext() *Plsql_opt_transaction_chainContext { + var p = new(Plsql_opt_transaction_chainContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsql_opt_transaction_chain + return p +} + +func InitEmptyPlsql_opt_transaction_chainContext(p *Plsql_opt_transaction_chainContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsql_opt_transaction_chain +} + +func (*Plsql_opt_transaction_chainContext) IsPlsql_opt_transaction_chainContext() {} + +func NewPlsql_opt_transaction_chainContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Plsql_opt_transaction_chainContext { + var p = new(Plsql_opt_transaction_chainContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_plsql_opt_transaction_chain + + return p +} + +func (s *Plsql_opt_transaction_chainContext) GetParser() antlr.Parser { return s.parser } + +func (s *Plsql_opt_transaction_chainContext) AND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, 0) +} + +func (s *Plsql_opt_transaction_chainContext) CHAIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHAIN, 0) +} + +func (s *Plsql_opt_transaction_chainContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Plsql_opt_transaction_chainContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Plsql_opt_transaction_chainContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Plsql_opt_transaction_chainContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPlsql_opt_transaction_chain(s) + } +} + +func (s *Plsql_opt_transaction_chainContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPlsql_opt_transaction_chain(s) + } +} + +func (s *Plsql_opt_transaction_chainContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPlsql_opt_transaction_chain(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Plsql_opt_transaction_chain() (localctx IPlsql_opt_transaction_chainContext) { + localctx = NewPlsql_opt_transaction_chainContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1594, PostgreSQLParserRULE_plsql_opt_transaction_chain) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11163) + p.Match(PostgreSQLParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11165) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserNO { + { + p.SetState(11164) + p.Match(PostgreSQLParserNO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(11167) + p.Match(PostgreSQLParserCHAIN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IStmt_setContext is an interface to support dynamic dispatch. +type IStmt_setContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SET() antlr.TerminalNode + Any_name() IAny_nameContext + TO() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + SEMI() antlr.TerminalNode + RESET() antlr.TerminalNode + ALL() antlr.TerminalNode + + // IsStmt_setContext differentiates from other interfaces. + IsStmt_setContext() +} + +type Stmt_setContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyStmt_setContext() *Stmt_setContext { + var p = new(Stmt_setContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_set + return p +} + +func InitEmptyStmt_setContext(p *Stmt_setContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_stmt_set +} + +func (*Stmt_setContext) IsStmt_setContext() {} + +func NewStmt_setContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Stmt_setContext { + var p = new(Stmt_setContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_stmt_set + + return p +} + +func (s *Stmt_setContext) GetParser() antlr.Parser { return s.parser } + +func (s *Stmt_setContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Stmt_setContext) Any_name() IAny_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_nameContext) +} + +func (s *Stmt_setContext) TO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTO, 0) +} + +func (s *Stmt_setContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Stmt_setContext) SEMI() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSEMI, 0) +} + +func (s *Stmt_setContext) RESET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESET, 0) +} + +func (s *Stmt_setContext) ALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALL, 0) +} + +func (s *Stmt_setContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Stmt_setContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Stmt_setContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterStmt_set(s) + } +} + +func (s *Stmt_setContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitStmt_set(s) + } +} + +func (s *Stmt_setContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitStmt_set(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Stmt_set() (localctx IStmt_setContext) { + localctx = NewStmt_setContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1596, PostgreSQLParserRULE_stmt_set) + p.SetState(11181) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserSET: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11169) + p.Match(PostgreSQLParserSET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11170) + p.Any_name() + } + { + p.SetState(11171) + p.Match(PostgreSQLParserTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11172) + p.Match(PostgreSQLParserDEFAULT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11173) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case PostgreSQLParserRESET: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(11175) + p.Match(PostgreSQLParserRESET) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11178) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + { + p.SetState(11176) + p.Any_name() + } + + case PostgreSQLParserALL: + { + p.SetState(11177) + p.Match(PostgreSQLParserALL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(11180) + p.Match(PostgreSQLParserSEMI) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICursor_variableContext is an interface to support dynamic dispatch. +type ICursor_variableContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + PARAM() antlr.TerminalNode + + // IsCursor_variableContext differentiates from other interfaces. + IsCursor_variableContext() +} + +type Cursor_variableContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCursor_variableContext() *Cursor_variableContext { + var p = new(Cursor_variableContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cursor_variable + return p +} + +func InitEmptyCursor_variableContext(p *Cursor_variableContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_cursor_variable +} + +func (*Cursor_variableContext) IsCursor_variableContext() {} + +func NewCursor_variableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Cursor_variableContext { + var p = new(Cursor_variableContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_cursor_variable + + return p +} + +func (s *Cursor_variableContext) GetParser() antlr.Parser { return s.parser } + +func (s *Cursor_variableContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Cursor_variableContext) PARAM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPARAM, 0) +} + +func (s *Cursor_variableContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Cursor_variableContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Cursor_variableContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterCursor_variable(s) + } +} + +func (s *Cursor_variableContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitCursor_variable(s) + } +} + +func (s *Cursor_variableContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitCursor_variable(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Cursor_variable() (localctx ICursor_variableContext) { + localctx = NewCursor_variableContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1598, PostgreSQLParserRULE_cursor_variable) + p.SetState(11185) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case PostgreSQLParserAND, PostgreSQLParserARRAY, PostgreSQLParserCOLLATE, PostgreSQLParserCOLUMN, PostgreSQLParserCONSTRAINT, PostgreSQLParserDEFAULT, PostgreSQLParserDO, PostgreSQLParserFETCH, PostgreSQLParserTABLE, PostgreSQLParserIS, PostgreSQLParserLEFT, PostgreSQLParserOUTER_P, PostgreSQLParserOVER, PostgreSQLParserRIGHT, PostgreSQLParserABORT_P, PostgreSQLParserABSOLUTE_P, PostgreSQLParserACCESS, PostgreSQLParserACTION, PostgreSQLParserADD_P, PostgreSQLParserADMIN, PostgreSQLParserAFTER, PostgreSQLParserAGGREGATE, PostgreSQLParserALSO, PostgreSQLParserALTER, PostgreSQLParserALWAYS, PostgreSQLParserASSERTION, PostgreSQLParserASSIGNMENT, PostgreSQLParserAT, PostgreSQLParserATTRIBUTE, PostgreSQLParserBACKWARD, PostgreSQLParserBEFORE, PostgreSQLParserBEGIN_P, PostgreSQLParserBY, PostgreSQLParserCACHE, PostgreSQLParserCALLED, PostgreSQLParserCASCADE, PostgreSQLParserCASCADED, PostgreSQLParserCATALOG, PostgreSQLParserCHAIN, PostgreSQLParserCHARACTERISTICS, PostgreSQLParserCHECKPOINT, PostgreSQLParserCLASS, PostgreSQLParserCLOSE, PostgreSQLParserCLUSTER, PostgreSQLParserCOMMENT, PostgreSQLParserCOMMENTS, PostgreSQLParserCOMMIT, PostgreSQLParserCOMMITTED, PostgreSQLParserCONFIGURATION, PostgreSQLParserCONNECTION, PostgreSQLParserCONSTRAINTS, PostgreSQLParserCONTENT_P, PostgreSQLParserCONTINUE_P, PostgreSQLParserCONVERSION_P, PostgreSQLParserCOPY, PostgreSQLParserCOST, PostgreSQLParserCSV, PostgreSQLParserCURSOR, PostgreSQLParserCYCLE, PostgreSQLParserDATA_P, PostgreSQLParserDATABASE, PostgreSQLParserDAY_P, PostgreSQLParserDEALLOCATE, PostgreSQLParserDECLARE, PostgreSQLParserDEFAULTS, PostgreSQLParserDEFERRED, PostgreSQLParserDEFINER, PostgreSQLParserDELETE_P, PostgreSQLParserDELIMITER, PostgreSQLParserDELIMITERS, PostgreSQLParserDICTIONARY, PostgreSQLParserDISABLE_P, PostgreSQLParserDISCARD, PostgreSQLParserDOCUMENT_P, PostgreSQLParserDOMAIN_P, PostgreSQLParserDOUBLE_P, PostgreSQLParserDROP, PostgreSQLParserEACH, PostgreSQLParserENABLE_P, PostgreSQLParserENCODING, PostgreSQLParserENCRYPTED, PostgreSQLParserENUM_P, PostgreSQLParserESCAPE, PostgreSQLParserEVENT, PostgreSQLParserEXCLUDE, PostgreSQLParserEXCLUDING, PostgreSQLParserEXCLUSIVE, PostgreSQLParserEXECUTE, PostgreSQLParserEXPLAIN, PostgreSQLParserEXTENSION, PostgreSQLParserEXTERNAL, PostgreSQLParserFAMILY, PostgreSQLParserFIRST_P, PostgreSQLParserFOLLOWING, PostgreSQLParserFORCE, PostgreSQLParserFORWARD, PostgreSQLParserFUNCTION, PostgreSQLParserFUNCTIONS, PostgreSQLParserGLOBAL, PostgreSQLParserGRANTED, PostgreSQLParserHANDLER, PostgreSQLParserHEADER_P, PostgreSQLParserHOLD, PostgreSQLParserHOUR_P, PostgreSQLParserIDENTITY_P, PostgreSQLParserIF_P, PostgreSQLParserIMMEDIATE, PostgreSQLParserIMMUTABLE, PostgreSQLParserIMPLICIT_P, PostgreSQLParserINCLUDING, PostgreSQLParserINCREMENT, PostgreSQLParserINDEX, PostgreSQLParserINDEXES, PostgreSQLParserINHERIT, PostgreSQLParserINHERITS, PostgreSQLParserINLINE_P, PostgreSQLParserINSENSITIVE, PostgreSQLParserINSERT, PostgreSQLParserINSTEAD, PostgreSQLParserINVOKER, PostgreSQLParserISOLATION, PostgreSQLParserKEY, PostgreSQLParserLABEL, PostgreSQLParserLANGUAGE, PostgreSQLParserLARGE_P, PostgreSQLParserLAST_P, PostgreSQLParserLEAKPROOF, PostgreSQLParserLEVEL, PostgreSQLParserLISTEN, PostgreSQLParserLOAD, PostgreSQLParserLOCAL, PostgreSQLParserLOCATION, PostgreSQLParserLOCK_P, PostgreSQLParserMAPPING, PostgreSQLParserMATCH, PostgreSQLParserMATERIALIZED, PostgreSQLParserMAXVALUE, PostgreSQLParserMINUTE_P, PostgreSQLParserMINVALUE, PostgreSQLParserMODE, PostgreSQLParserMONTH_P, PostgreSQLParserMOVE, PostgreSQLParserNAME_P, PostgreSQLParserNAMES, PostgreSQLParserNEXT, PostgreSQLParserNO, PostgreSQLParserNOTHING, PostgreSQLParserNOTIFY, PostgreSQLParserNOWAIT, PostgreSQLParserNULLS_P, PostgreSQLParserOBJECT_P, PostgreSQLParserOF, PostgreSQLParserOFF, PostgreSQLParserOIDS, PostgreSQLParserOPERATOR, PostgreSQLParserOPTION, PostgreSQLParserOPTIONS, PostgreSQLParserOWNED, PostgreSQLParserOWNER, PostgreSQLParserPARSER, PostgreSQLParserPARTIAL, PostgreSQLParserPARTITION, PostgreSQLParserPASSING, PostgreSQLParserPASSWORD, PostgreSQLParserPLANS, PostgreSQLParserPRECEDING, PostgreSQLParserPREPARE, PostgreSQLParserPREPARED, PostgreSQLParserPRESERVE, PostgreSQLParserPRIOR, PostgreSQLParserPRIVILEGES, PostgreSQLParserPROCEDURAL, PostgreSQLParserPROCEDURE, PostgreSQLParserPROGRAM, PostgreSQLParserQUOTE, PostgreSQLParserRANGE, PostgreSQLParserREAD, PostgreSQLParserREASSIGN, PostgreSQLParserRECHECK, PostgreSQLParserRECURSIVE, PostgreSQLParserREF, PostgreSQLParserREFRESH, PostgreSQLParserREINDEX, PostgreSQLParserRELATIVE_P, PostgreSQLParserRELEASE, PostgreSQLParserRENAME, PostgreSQLParserREPEATABLE, PostgreSQLParserREPLACE, PostgreSQLParserREPLICA, PostgreSQLParserRESET, PostgreSQLParserRESTART, PostgreSQLParserRESTRICT, PostgreSQLParserRETURNS, PostgreSQLParserREVOKE, PostgreSQLParserROLE, PostgreSQLParserROLLBACK, PostgreSQLParserROWS, PostgreSQLParserRULE, PostgreSQLParserSAVEPOINT, PostgreSQLParserSCHEMA, PostgreSQLParserSCROLL, PostgreSQLParserSEARCH, PostgreSQLParserSECOND_P, PostgreSQLParserSECURITY, PostgreSQLParserSEQUENCE, PostgreSQLParserSEQUENCES, PostgreSQLParserSERIALIZABLE, PostgreSQLParserSERVER, PostgreSQLParserSESSION, PostgreSQLParserSET, PostgreSQLParserSHARE, PostgreSQLParserSHOW, PostgreSQLParserSIMPLE, PostgreSQLParserSNAPSHOT, PostgreSQLParserSTABLE, PostgreSQLParserSTANDALONE_P, PostgreSQLParserSTART, PostgreSQLParserSTATEMENT, PostgreSQLParserSTATISTICS, PostgreSQLParserSTDIN, PostgreSQLParserSTDOUT, PostgreSQLParserSTORAGE, PostgreSQLParserSTRICT_P, PostgreSQLParserSTRIP_P, PostgreSQLParserSYSID, PostgreSQLParserSYSTEM_P, PostgreSQLParserTABLES, PostgreSQLParserTABLESPACE, PostgreSQLParserTEMP, PostgreSQLParserTEMPLATE, PostgreSQLParserTEMPORARY, PostgreSQLParserTEXT_P, PostgreSQLParserTRANSACTION, PostgreSQLParserTRIGGER, PostgreSQLParserTRUNCATE, PostgreSQLParserTRUSTED, PostgreSQLParserTYPE_P, PostgreSQLParserTYPES_P, PostgreSQLParserUNBOUNDED, PostgreSQLParserUNCOMMITTED, PostgreSQLParserUNENCRYPTED, PostgreSQLParserUNKNOWN, PostgreSQLParserUNLISTEN, PostgreSQLParserUNLOGGED, PostgreSQLParserUNTIL, PostgreSQLParserUPDATE, PostgreSQLParserVACUUM, PostgreSQLParserVALID, PostgreSQLParserVALIDATE, PostgreSQLParserVALIDATOR, PostgreSQLParserVARYING, PostgreSQLParserVERSION_P, PostgreSQLParserVIEW, PostgreSQLParserVOLATILE, PostgreSQLParserWHITESPACE_P, PostgreSQLParserWITHOUT, PostgreSQLParserWORK, PostgreSQLParserWRAPPER, PostgreSQLParserWRITE, PostgreSQLParserXML_P, PostgreSQLParserYEAR_P, PostgreSQLParserYES_P, PostgreSQLParserZONE, PostgreSQLParserATOMIC_P, PostgreSQLParserBETWEEN, PostgreSQLParserBIGINT, PostgreSQLParserBIT, PostgreSQLParserBOOLEAN_P, PostgreSQLParserCHAR_P, PostgreSQLParserCHARACTER, PostgreSQLParserCOALESCE, PostgreSQLParserDEC, PostgreSQLParserDECIMAL_P, PostgreSQLParserEXISTS, PostgreSQLParserEXTRACT, PostgreSQLParserFLOAT_P, PostgreSQLParserGREATEST, PostgreSQLParserINOUT, PostgreSQLParserINT_P, PostgreSQLParserINTEGER, PostgreSQLParserINTERVAL, PostgreSQLParserLEAST, PostgreSQLParserNATIONAL, PostgreSQLParserNCHAR, PostgreSQLParserNONE, PostgreSQLParserNULLIF, PostgreSQLParserNUMERIC, PostgreSQLParserOVERLAY, PostgreSQLParserPARAMETER, PostgreSQLParserPOSITION, PostgreSQLParserPRECISION, PostgreSQLParserREAL, PostgreSQLParserROW, PostgreSQLParserSETOF, PostgreSQLParserSMALLINT, PostgreSQLParserSUBSTRING, PostgreSQLParserTIME, PostgreSQLParserTIMESTAMP, PostgreSQLParserTREAT, PostgreSQLParserTRIM, PostgreSQLParserVALUES, PostgreSQLParserVARCHAR, PostgreSQLParserXMLATTRIBUTES, PostgreSQLParserXMLCOMMENT, PostgreSQLParserXMLAGG, PostgreSQLParserXML_IS_WELL_FORMED, PostgreSQLParserXML_IS_WELL_FORMED_DOCUMENT, PostgreSQLParserXML_IS_WELL_FORMED_CONTENT, PostgreSQLParserXPATH, PostgreSQLParserXPATH_EXISTS, PostgreSQLParserXMLCONCAT, PostgreSQLParserXMLELEMENT, PostgreSQLParserXMLEXISTS, PostgreSQLParserXMLFOREST, PostgreSQLParserXMLPARSE, PostgreSQLParserXMLPI, PostgreSQLParserXMLROOT, PostgreSQLParserXMLSERIALIZE, PostgreSQLParserCALL, PostgreSQLParserCURRENT_P, PostgreSQLParserATTACH, PostgreSQLParserDETACH, PostgreSQLParserEXPRESSION, PostgreSQLParserGENERATED, PostgreSQLParserLOGGED, PostgreSQLParserSTORED, PostgreSQLParserINCLUDE, PostgreSQLParserROUTINE, PostgreSQLParserTRANSFORM, PostgreSQLParserIMPORT_P, PostgreSQLParserPOLICY, PostgreSQLParserMETHOD, PostgreSQLParserREFERENCING, PostgreSQLParserNEW, PostgreSQLParserOLD, PostgreSQLParserVALUE_P, PostgreSQLParserSUBSCRIPTION, PostgreSQLParserPUBLICATION, PostgreSQLParserOUT_P, PostgreSQLParserROUTINES, PostgreSQLParserSCHEMAS, PostgreSQLParserPROCEDURES, PostgreSQLParserINPUT_P, PostgreSQLParserSUPPORT, PostgreSQLParserPARALLEL, PostgreSQLParserSQL_P, PostgreSQLParserDEPENDS, PostgreSQLParserOVERRIDING, PostgreSQLParserCONFLICT, PostgreSQLParserSKIP_P, PostgreSQLParserLOCKED, PostgreSQLParserTIES, PostgreSQLParserROLLUP, PostgreSQLParserCUBE, PostgreSQLParserGROUPING, PostgreSQLParserSETS, PostgreSQLParserORDINALITY, PostgreSQLParserXMLTABLE, PostgreSQLParserCOLUMNS, PostgreSQLParserXMLNAMESPACES, PostgreSQLParserROWTYPE, PostgreSQLParserNORMALIZED, PostgreSQLParserWITHIN, PostgreSQLParserFILTER, PostgreSQLParserGROUPS, PostgreSQLParserOTHERS, PostgreSQLParserNFC, PostgreSQLParserNFD, PostgreSQLParserNFKC, PostgreSQLParserNFKD, PostgreSQLParserUESCAPE, PostgreSQLParserVIEWS, PostgreSQLParserNORMALIZE, PostgreSQLParserDUMP, PostgreSQLParserPRINT_STRICT_PARAMS, PostgreSQLParserVARIABLE_CONFLICT, PostgreSQLParserERROR, PostgreSQLParserUSE_VARIABLE, PostgreSQLParserUSE_COLUMN, PostgreSQLParserALIAS, PostgreSQLParserCONSTANT, PostgreSQLParserPERFORM, PostgreSQLParserGET, PostgreSQLParserDIAGNOSTICS, PostgreSQLParserSTACKED, PostgreSQLParserELSIF, PostgreSQLParserREVERSE, PostgreSQLParserSLICE, PostgreSQLParserEXIT, PostgreSQLParserRETURN, PostgreSQLParserQUERY, PostgreSQLParserRAISE, PostgreSQLParserSQLSTATE, PostgreSQLParserDEBUG, PostgreSQLParserLOG, PostgreSQLParserINFO, PostgreSQLParserNOTICE, PostgreSQLParserWARNING, PostgreSQLParserEXCEPTION, PostgreSQLParserASSERT, PostgreSQLParserOPEN, PostgreSQLParserABS, PostgreSQLParserCBRT, PostgreSQLParserCEIL, PostgreSQLParserCEILING, PostgreSQLParserDEGREES, PostgreSQLParserDIV, PostgreSQLParserEXP, PostgreSQLParserFACTORIAL, PostgreSQLParserFLOOR, PostgreSQLParserGCD, PostgreSQLParserLCM, PostgreSQLParserLN, PostgreSQLParserLOG10, PostgreSQLParserMIN_SCALE, PostgreSQLParserMOD, PostgreSQLParserPI, PostgreSQLParserPOWER, PostgreSQLParserRADIANS, PostgreSQLParserROUND, PostgreSQLParserSCALE, PostgreSQLParserSIGN, PostgreSQLParserSQRT, PostgreSQLParserTRIM_SCALE, PostgreSQLParserTRUNC, PostgreSQLParserWIDTH_BUCKET, PostgreSQLParserRANDOM, PostgreSQLParserSETSEED, PostgreSQLParserACOS, PostgreSQLParserACOSD, PostgreSQLParserASIN, PostgreSQLParserASIND, PostgreSQLParserATAN, PostgreSQLParserATAND, PostgreSQLParserATAN2, PostgreSQLParserATAN2D, PostgreSQLParserCOS, PostgreSQLParserCOSD, PostgreSQLParserCOT, PostgreSQLParserCOTD, PostgreSQLParserSIN, PostgreSQLParserSIND, PostgreSQLParserTAN, PostgreSQLParserTAND, PostgreSQLParserSINH, PostgreSQLParserCOSH, PostgreSQLParserTANH, PostgreSQLParserASINH, PostgreSQLParserACOSH, PostgreSQLParserATANH, PostgreSQLParserBIT_LENGTH, PostgreSQLParserCHAR_LENGTH, PostgreSQLParserCHARACTER_LENGTH, PostgreSQLParserLOWER, PostgreSQLParserOCTET_LENGTH, PostgreSQLParserUPPER, PostgreSQLParserASCII, PostgreSQLParserBTRIM, PostgreSQLParserCHR, PostgreSQLParserCONCAT, PostgreSQLParserCONCAT_WS, PostgreSQLParserFORMAT, PostgreSQLParserINITCAP, PostgreSQLParserLENGTH, PostgreSQLParserLPAD, PostgreSQLParserLTRIM, PostgreSQLParserMD5, PostgreSQLParserPARSE_IDENT, PostgreSQLParserPG_CLIENT_ENCODING, PostgreSQLParserQUOTE_IDENT, PostgreSQLParserQUOTE_LITERAL, PostgreSQLParserQUOTE_NULLABLE, PostgreSQLParserREGEXP_COUNT, PostgreSQLParserREGEXP_INSTR, PostgreSQLParserREGEXP_LIKE, PostgreSQLParserREGEXP_MATCH, PostgreSQLParserREGEXP_MATCHES, PostgreSQLParserREGEXP_REPLACE, PostgreSQLParserREGEXP_SPLIT_TO_ARRAY, PostgreSQLParserREGEXP_SPLIT_TO_TABLE, PostgreSQLParserREGEXP_SUBSTR, PostgreSQLParserREPEAT, PostgreSQLParserRPAD, PostgreSQLParserRTRIM, PostgreSQLParserSPLIT_PART, PostgreSQLParserSTARTS_WITH, PostgreSQLParserSTRING_TO_ARRAY, PostgreSQLParserSTRING_TO_TABLE, PostgreSQLParserSTRPOS, PostgreSQLParserSUBSTR, PostgreSQLParserTO_ASCII, PostgreSQLParserTO_HEX, PostgreSQLParserTRANSLATE, PostgreSQLParserUNISTR, PostgreSQLParserAGE, PostgreSQLParserCLOCK_TIMESTAMP, PostgreSQLParserDATE_BIN, PostgreSQLParserDATE_PART, PostgreSQLParserDATE_TRUNC, PostgreSQLParserISFINITE, PostgreSQLParserJUSTIFY_DAYS, PostgreSQLParserJUSTIFY_HOURS, PostgreSQLParserJUSTIFY_INTERVAL, PostgreSQLParserMAKE_DATE, PostgreSQLParserMAKE_INTERVAL, PostgreSQLParserMAKE_TIME, PostgreSQLParserMAKE_TIMESTAMP, PostgreSQLParserMAKE_TIMESTAMPTZ, PostgreSQLParserNOW, PostgreSQLParserSTATEMENT_TIMESTAMP, PostgreSQLParserTIMEOFDAY, PostgreSQLParserTRANSACTION_TIMESTAMP, PostgreSQLParserTO_TIMESTAMP, PostgreSQLParserTO_CHAR, PostgreSQLParserTO_DATE, PostgreSQLParserTO_NUMBER, PostgreSQLParserIdentifier, PostgreSQLParserQuotedIdentifier, PostgreSQLParserUnicodeQuotedIdentifier, PostgreSQLParserPLSQLVARIABLENAME, PostgreSQLParserPLSQLIDENTIFIER: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11183) + p.Colid() + } + + case PostgreSQLParserPARAM: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(11184) + p.Match(PostgreSQLParserPARAM) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IException_sectContext is an interface to support dynamic dispatch. +type IException_sectContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + EXCEPTION() antlr.TerminalNode + Proc_exceptions() IProc_exceptionsContext + + // IsException_sectContext differentiates from other interfaces. + IsException_sectContext() +} + +type Exception_sectContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyException_sectContext() *Exception_sectContext { + var p = new(Exception_sectContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exception_sect + return p +} + +func InitEmptyException_sectContext(p *Exception_sectContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_exception_sect +} + +func (*Exception_sectContext) IsException_sectContext() {} + +func NewException_sectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Exception_sectContext { + var p = new(Exception_sectContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_exception_sect + + return p +} + +func (s *Exception_sectContext) GetParser() antlr.Parser { return s.parser } + +func (s *Exception_sectContext) EXCEPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCEPTION, 0) +} + +func (s *Exception_sectContext) Proc_exceptions() IProc_exceptionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_exceptionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_exceptionsContext) +} + +func (s *Exception_sectContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Exception_sectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Exception_sectContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterException_sect(s) + } +} + +func (s *Exception_sectContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitException_sect(s) + } +} + +func (s *Exception_sectContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitException_sect(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Exception_sect() (localctx IException_sectContext) { + localctx = NewException_sectContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1600, PostgreSQLParserRULE_exception_sect) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11187) + p.Match(PostgreSQLParserEXCEPTION) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11188) + p.Proc_exceptions() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IProc_exceptionsContext is an interface to support dynamic dispatch. +type IProc_exceptionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllProc_exception() []IProc_exceptionContext + Proc_exception(i int) IProc_exceptionContext + + // IsProc_exceptionsContext differentiates from other interfaces. + IsProc_exceptionsContext() +} + +type Proc_exceptionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyProc_exceptionsContext() *Proc_exceptionsContext { + var p = new(Proc_exceptionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_exceptions + return p +} + +func InitEmptyProc_exceptionsContext(p *Proc_exceptionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_exceptions +} + +func (*Proc_exceptionsContext) IsProc_exceptionsContext() {} + +func NewProc_exceptionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Proc_exceptionsContext { + var p = new(Proc_exceptionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_proc_exceptions + + return p +} + +func (s *Proc_exceptionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Proc_exceptionsContext) AllProc_exception() []IProc_exceptionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IProc_exceptionContext); ok { + len++ + } + } + + tst := make([]IProc_exceptionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IProc_exceptionContext); ok { + tst[i] = t.(IProc_exceptionContext) + i++ + } + } + + return tst +} + +func (s *Proc_exceptionsContext) Proc_exception(i int) IProc_exceptionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_exceptionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IProc_exceptionContext) +} + +func (s *Proc_exceptionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Proc_exceptionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Proc_exceptionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterProc_exceptions(s) + } +} + +func (s *Proc_exceptionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitProc_exceptions(s) + } +} + +func (s *Proc_exceptionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitProc_exceptions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Proc_exceptions() (localctx IProc_exceptionsContext) { + localctx = NewProc_exceptionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1602, PostgreSQLParserRULE_proc_exceptions) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(11191) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for ok := true; ok; ok = _la == PostgreSQLParserWHEN { + { + p.SetState(11190) + p.Proc_exception() + } + + p.SetState(11193) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IProc_exceptionContext is an interface to support dynamic dispatch. +type IProc_exceptionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHEN() antlr.TerminalNode + Proc_conditions() IProc_conditionsContext + THEN() antlr.TerminalNode + Proc_sect() IProc_sectContext + + // IsProc_exceptionContext differentiates from other interfaces. + IsProc_exceptionContext() +} + +type Proc_exceptionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyProc_exceptionContext() *Proc_exceptionContext { + var p = new(Proc_exceptionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_exception + return p +} + +func InitEmptyProc_exceptionContext(p *Proc_exceptionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_exception +} + +func (*Proc_exceptionContext) IsProc_exceptionContext() {} + +func NewProc_exceptionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Proc_exceptionContext { + var p = new(Proc_exceptionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_proc_exception + + return p +} + +func (s *Proc_exceptionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Proc_exceptionContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *Proc_exceptionContext) Proc_conditions() IProc_conditionsContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_conditionsContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_conditionsContext) +} + +func (s *Proc_exceptionContext) THEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTHEN, 0) +} + +func (s *Proc_exceptionContext) Proc_sect() IProc_sectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_sectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProc_sectContext) +} + +func (s *Proc_exceptionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Proc_exceptionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Proc_exceptionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterProc_exception(s) + } +} + +func (s *Proc_exceptionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitProc_exception(s) + } +} + +func (s *Proc_exceptionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitProc_exception(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Proc_exception() (localctx IProc_exceptionContext) { + localctx = NewProc_exceptionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1604, PostgreSQLParserRULE_proc_exception) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11195) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11196) + p.Proc_conditions() + } + { + p.SetState(11197) + p.Match(PostgreSQLParserTHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11198) + p.Proc_sect() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IProc_conditionsContext is an interface to support dynamic dispatch. +type IProc_conditionsContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllProc_condition() []IProc_conditionContext + Proc_condition(i int) IProc_conditionContext + AllOR() []antlr.TerminalNode + OR(i int) antlr.TerminalNode + + // IsProc_conditionsContext differentiates from other interfaces. + IsProc_conditionsContext() +} + +type Proc_conditionsContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyProc_conditionsContext() *Proc_conditionsContext { + var p = new(Proc_conditionsContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_conditions + return p +} + +func InitEmptyProc_conditionsContext(p *Proc_conditionsContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_conditions +} + +func (*Proc_conditionsContext) IsProc_conditionsContext() {} + +func NewProc_conditionsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Proc_conditionsContext { + var p = new(Proc_conditionsContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_proc_conditions + + return p +} + +func (s *Proc_conditionsContext) GetParser() antlr.Parser { return s.parser } + +func (s *Proc_conditionsContext) AllProc_condition() []IProc_conditionContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IProc_conditionContext); ok { + len++ + } + } + + tst := make([]IProc_conditionContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IProc_conditionContext); ok { + tst[i] = t.(IProc_conditionContext) + i++ + } + } + + return tst +} + +func (s *Proc_conditionsContext) Proc_condition(i int) IProc_conditionContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProc_conditionContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IProc_conditionContext) +} + +func (s *Proc_conditionsContext) AllOR() []antlr.TerminalNode { + return s.GetTokens(PostgreSQLParserOR) +} + +func (s *Proc_conditionsContext) OR(i int) antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOR, i) +} + +func (s *Proc_conditionsContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Proc_conditionsContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Proc_conditionsContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterProc_conditions(s) + } +} + +func (s *Proc_conditionsContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitProc_conditions(s) + } +} + +func (s *Proc_conditionsContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitProc_conditions(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Proc_conditions() (localctx IProc_conditionsContext) { + localctx = NewProc_conditionsContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1606, PostgreSQLParserRULE_proc_conditions) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11200) + p.Proc_condition() + } + p.SetState(11205) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == PostgreSQLParserOR { + { + p.SetState(11201) + p.Match(PostgreSQLParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11202) + p.Proc_condition() + } + + p.SetState(11207) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IProc_conditionContext is an interface to support dynamic dispatch. +type IProc_conditionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Any_identifier() IAny_identifierContext + SQLSTATE() antlr.TerminalNode + Sconst() ISconstContext + + // IsProc_conditionContext differentiates from other interfaces. + IsProc_conditionContext() +} + +type Proc_conditionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyProc_conditionContext() *Proc_conditionContext { + var p = new(Proc_conditionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_condition + return p +} + +func InitEmptyProc_conditionContext(p *Proc_conditionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_proc_condition +} + +func (*Proc_conditionContext) IsProc_conditionContext() {} + +func NewProc_conditionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Proc_conditionContext { + var p = new(Proc_conditionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_proc_condition + + return p +} + +func (s *Proc_conditionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Proc_conditionContext) Any_identifier() IAny_identifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_identifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_identifierContext) +} + +func (s *Proc_conditionContext) SQLSTATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSQLSTATE, 0) +} + +func (s *Proc_conditionContext) Sconst() ISconstContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISconstContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISconstContext) +} + +func (s *Proc_conditionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Proc_conditionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Proc_conditionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterProc_condition(s) + } +} + +func (s *Proc_conditionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitProc_condition(s) + } +} + +func (s *Proc_conditionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitProc_condition(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Proc_condition() (localctx IProc_conditionContext) { + localctx = NewProc_conditionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1608, PostgreSQLParserRULE_proc_condition) + p.SetState(11211) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1108, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11208) + p.Any_identifier() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(11209) + p.Match(PostgreSQLParserSQLSTATE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11210) + p.Sconst() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_block_labelContext is an interface to support dynamic dispatch. +type IOpt_block_labelContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Label_decl() ILabel_declContext + + // IsOpt_block_labelContext differentiates from other interfaces. + IsOpt_block_labelContext() +} + +type Opt_block_labelContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_block_labelContext() *Opt_block_labelContext { + var p = new(Opt_block_labelContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_block_label + return p +} + +func InitEmptyOpt_block_labelContext(p *Opt_block_labelContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_block_label +} + +func (*Opt_block_labelContext) IsOpt_block_labelContext() {} + +func NewOpt_block_labelContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_block_labelContext { + var p = new(Opt_block_labelContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_block_label + + return p +} + +func (s *Opt_block_labelContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_block_labelContext) Label_decl() ILabel_declContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILabel_declContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILabel_declContext) +} + +func (s *Opt_block_labelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_block_labelContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_block_labelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_block_label(s) + } +} + +func (s *Opt_block_labelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_block_label(s) + } +} + +func (s *Opt_block_labelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_block_label(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_block_label() (localctx IOpt_block_labelContext) { + localctx = NewOpt_block_labelContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1610, PostgreSQLParserRULE_opt_block_label) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11213) + p.Label_decl() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_loop_labelContext is an interface to support dynamic dispatch. +type IOpt_loop_labelContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Label_decl() ILabel_declContext + + // IsOpt_loop_labelContext differentiates from other interfaces. + IsOpt_loop_labelContext() +} + +type Opt_loop_labelContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_loop_labelContext() *Opt_loop_labelContext { + var p = new(Opt_loop_labelContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_loop_label + return p +} + +func InitEmptyOpt_loop_labelContext(p *Opt_loop_labelContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_loop_label +} + +func (*Opt_loop_labelContext) IsOpt_loop_labelContext() {} + +func NewOpt_loop_labelContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_loop_labelContext { + var p = new(Opt_loop_labelContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_loop_label + + return p +} + +func (s *Opt_loop_labelContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_loop_labelContext) Label_decl() ILabel_declContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ILabel_declContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ILabel_declContext) +} + +func (s *Opt_loop_labelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_loop_labelContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_loop_labelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_loop_label(s) + } +} + +func (s *Opt_loop_labelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_loop_label(s) + } +} + +func (s *Opt_loop_labelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_loop_label(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_loop_label() (localctx IOpt_loop_labelContext) { + localctx = NewOpt_loop_labelContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1612, PostgreSQLParserRULE_opt_loop_label) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11215) + p.Label_decl() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_labelContext is an interface to support dynamic dispatch. +type IOpt_labelContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Any_identifier() IAny_identifierContext + + // IsOpt_labelContext differentiates from other interfaces. + IsOpt_labelContext() +} + +type Opt_labelContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_labelContext() *Opt_labelContext { + var p = new(Opt_labelContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_label + return p +} + +func InitEmptyOpt_labelContext(p *Opt_labelContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_label +} + +func (*Opt_labelContext) IsOpt_labelContext() {} + +func NewOpt_labelContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_labelContext { + var p = new(Opt_labelContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_label + + return p +} + +func (s *Opt_labelContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_labelContext) Any_identifier() IAny_identifierContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IAny_identifierContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IAny_identifierContext) +} + +func (s *Opt_labelContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_labelContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_labelContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_label(s) + } +} + +func (s *Opt_labelContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_label(s) + } +} + +func (s *Opt_labelContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_label(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_label() (localctx IOpt_labelContext) { + localctx = NewOpt_labelContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1614, PostgreSQLParserRULE_opt_label) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11217) + p.Any_identifier() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_exitcondContext is an interface to support dynamic dispatch. +type IOpt_exitcondContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHEN() antlr.TerminalNode + Expr_until_semi() IExpr_until_semiContext + + // IsOpt_exitcondContext differentiates from other interfaces. + IsOpt_exitcondContext() +} + +type Opt_exitcondContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_exitcondContext() *Opt_exitcondContext { + var p = new(Opt_exitcondContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_exitcond + return p +} + +func InitEmptyOpt_exitcondContext(p *Opt_exitcondContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_exitcond +} + +func (*Opt_exitcondContext) IsOpt_exitcondContext() {} + +func NewOpt_exitcondContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_exitcondContext { + var p = new(Opt_exitcondContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_exitcond + + return p +} + +func (s *Opt_exitcondContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_exitcondContext) WHEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWHEN, 0) +} + +func (s *Opt_exitcondContext) Expr_until_semi() IExpr_until_semiContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IExpr_until_semiContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IExpr_until_semiContext) +} + +func (s *Opt_exitcondContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_exitcondContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_exitcondContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_exitcond(s) + } +} + +func (s *Opt_exitcondContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_exitcond(s) + } +} + +func (s *Opt_exitcondContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_exitcond(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_exitcond() (localctx IOpt_exitcondContext) { + localctx = NewOpt_exitcondContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1616, PostgreSQLParserRULE_opt_exitcond) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11219) + p.Match(PostgreSQLParserWHEN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(11220) + p.Expr_until_semi() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IAny_identifierContext is an interface to support dynamic dispatch. +type IAny_identifierContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Colid() IColidContext + Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext + + // IsAny_identifierContext differentiates from other interfaces. + IsAny_identifierContext() +} + +type Any_identifierContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyAny_identifierContext() *Any_identifierContext { + var p = new(Any_identifierContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_identifier + return p +} + +func InitEmptyAny_identifierContext(p *Any_identifierContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_any_identifier +} + +func (*Any_identifierContext) IsAny_identifierContext() {} + +func NewAny_identifierContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Any_identifierContext { + var p = new(Any_identifierContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_any_identifier + + return p +} + +func (s *Any_identifierContext) GetParser() antlr.Parser { return s.parser } + +func (s *Any_identifierContext) Colid() IColidContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IColidContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IColidContext) +} + +func (s *Any_identifierContext) Plsql_unreserved_keyword() IPlsql_unreserved_keywordContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IPlsql_unreserved_keywordContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IPlsql_unreserved_keywordContext) +} + +func (s *Any_identifierContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Any_identifierContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Any_identifierContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterAny_identifier(s) + } +} + +func (s *Any_identifierContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitAny_identifier(s) + } +} + +func (s *Any_identifierContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitAny_identifier(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Any_identifier() (localctx IAny_identifierContext) { + localctx = NewAny_identifierContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1618, PostgreSQLParserRULE_any_identifier) + p.SetState(11224) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1109, p.GetParserRuleContext()) { + case 1: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11222) + p.Colid() + } + + case 2: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(11223) + p.Plsql_unreserved_keyword() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IPlsql_unreserved_keywordContext is an interface to support dynamic dispatch. +type IPlsql_unreserved_keywordContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + ABSOLUTE_P() antlr.TerminalNode + ALIAS() antlr.TerminalNode + AND() antlr.TerminalNode + ARRAY() antlr.TerminalNode + ASSERT() antlr.TerminalNode + BACKWARD() antlr.TerminalNode + CALL() antlr.TerminalNode + CHAIN() antlr.TerminalNode + CLOSE() antlr.TerminalNode + COLLATE() antlr.TerminalNode + COLUMN() antlr.TerminalNode + COMMIT() antlr.TerminalNode + CONSTANT() antlr.TerminalNode + CONSTRAINT() antlr.TerminalNode + CONTINUE_P() antlr.TerminalNode + CURRENT_P() antlr.TerminalNode + CURSOR() antlr.TerminalNode + DEBUG() antlr.TerminalNode + DEFAULT() antlr.TerminalNode + DIAGNOSTICS() antlr.TerminalNode + DO() antlr.TerminalNode + DUMP() antlr.TerminalNode + ELSIF() antlr.TerminalNode + ERROR() antlr.TerminalNode + EXCEPTION() antlr.TerminalNode + EXIT() antlr.TerminalNode + FETCH() antlr.TerminalNode + FIRST_P() antlr.TerminalNode + FORWARD() antlr.TerminalNode + GET() antlr.TerminalNode + INFO() antlr.TerminalNode + INSERT() antlr.TerminalNode + IS() antlr.TerminalNode + LAST_P() antlr.TerminalNode + MOVE() antlr.TerminalNode + NEXT() antlr.TerminalNode + NO() antlr.TerminalNode + NOTICE() antlr.TerminalNode + OPEN() antlr.TerminalNode + OPTION() antlr.TerminalNode + PERFORM() antlr.TerminalNode + PRINT_STRICT_PARAMS() antlr.TerminalNode + PRIOR() antlr.TerminalNode + QUERY() antlr.TerminalNode + RAISE() antlr.TerminalNode + RELATIVE_P() antlr.TerminalNode + RESET() antlr.TerminalNode + RETURN() antlr.TerminalNode + ROLLBACK() antlr.TerminalNode + ROWTYPE() antlr.TerminalNode + SCHEMA() antlr.TerminalNode + SCROLL() antlr.TerminalNode + SET() antlr.TerminalNode + SLICE() antlr.TerminalNode + SQLSTATE() antlr.TerminalNode + STACKED() antlr.TerminalNode + TABLE() antlr.TerminalNode + TYPE_P() antlr.TerminalNode + USE_COLUMN() antlr.TerminalNode + USE_VARIABLE() antlr.TerminalNode + VARIABLE_CONFLICT() antlr.TerminalNode + WARNING() antlr.TerminalNode + OUTER_P() antlr.TerminalNode + + // IsPlsql_unreserved_keywordContext differentiates from other interfaces. + IsPlsql_unreserved_keywordContext() +} + +type Plsql_unreserved_keywordContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyPlsql_unreserved_keywordContext() *Plsql_unreserved_keywordContext { + var p = new(Plsql_unreserved_keywordContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsql_unreserved_keyword + return p +} + +func InitEmptyPlsql_unreserved_keywordContext(p *Plsql_unreserved_keywordContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_plsql_unreserved_keyword +} + +func (*Plsql_unreserved_keywordContext) IsPlsql_unreserved_keywordContext() {} + +func NewPlsql_unreserved_keywordContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Plsql_unreserved_keywordContext { + var p = new(Plsql_unreserved_keywordContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_plsql_unreserved_keyword + + return p +} + +func (s *Plsql_unreserved_keywordContext) GetParser() antlr.Parser { return s.parser } + +func (s *Plsql_unreserved_keywordContext) ABSOLUTE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserABSOLUTE_P, 0) +} + +func (s *Plsql_unreserved_keywordContext) ALIAS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserALIAS, 0) +} + +func (s *Plsql_unreserved_keywordContext) AND() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserAND, 0) +} + +func (s *Plsql_unreserved_keywordContext) ARRAY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserARRAY, 0) +} + +func (s *Plsql_unreserved_keywordContext) ASSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserASSERT, 0) +} + +func (s *Plsql_unreserved_keywordContext) BACKWARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserBACKWARD, 0) +} + +func (s *Plsql_unreserved_keywordContext) CALL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCALL, 0) +} + +func (s *Plsql_unreserved_keywordContext) CHAIN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCHAIN, 0) +} + +func (s *Plsql_unreserved_keywordContext) CLOSE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCLOSE, 0) +} + +func (s *Plsql_unreserved_keywordContext) COLLATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLLATE, 0) +} + +func (s *Plsql_unreserved_keywordContext) COLUMN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOLUMN, 0) +} + +func (s *Plsql_unreserved_keywordContext) COMMIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCOMMIT, 0) +} + +func (s *Plsql_unreserved_keywordContext) CONSTANT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTANT, 0) +} + +func (s *Plsql_unreserved_keywordContext) CONSTRAINT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONSTRAINT, 0) +} + +func (s *Plsql_unreserved_keywordContext) CONTINUE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCONTINUE_P, 0) +} + +func (s *Plsql_unreserved_keywordContext) CURRENT_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURRENT_P, 0) +} + +func (s *Plsql_unreserved_keywordContext) CURSOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserCURSOR, 0) +} + +func (s *Plsql_unreserved_keywordContext) DEBUG() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEBUG, 0) +} + +func (s *Plsql_unreserved_keywordContext) DEFAULT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDEFAULT, 0) +} + +func (s *Plsql_unreserved_keywordContext) DIAGNOSTICS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDIAGNOSTICS, 0) +} + +func (s *Plsql_unreserved_keywordContext) DO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDO, 0) +} + +func (s *Plsql_unreserved_keywordContext) DUMP() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserDUMP, 0) +} + +func (s *Plsql_unreserved_keywordContext) ELSIF() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserELSIF, 0) +} + +func (s *Plsql_unreserved_keywordContext) ERROR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserERROR, 0) +} + +func (s *Plsql_unreserved_keywordContext) EXCEPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXCEPTION, 0) +} + +func (s *Plsql_unreserved_keywordContext) EXIT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserEXIT, 0) +} + +func (s *Plsql_unreserved_keywordContext) FETCH() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFETCH, 0) +} + +func (s *Plsql_unreserved_keywordContext) FIRST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFIRST_P, 0) +} + +func (s *Plsql_unreserved_keywordContext) FORWARD() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserFORWARD, 0) +} + +func (s *Plsql_unreserved_keywordContext) GET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserGET, 0) +} + +func (s *Plsql_unreserved_keywordContext) INFO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINFO, 0) +} + +func (s *Plsql_unreserved_keywordContext) INSERT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINSERT, 0) +} + +func (s *Plsql_unreserved_keywordContext) IS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserIS, 0) +} + +func (s *Plsql_unreserved_keywordContext) LAST_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserLAST_P, 0) +} + +func (s *Plsql_unreserved_keywordContext) MOVE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserMOVE, 0) +} + +func (s *Plsql_unreserved_keywordContext) NEXT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNEXT, 0) +} + +func (s *Plsql_unreserved_keywordContext) NO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNO, 0) +} + +func (s *Plsql_unreserved_keywordContext) NOTICE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserNOTICE, 0) +} + +func (s *Plsql_unreserved_keywordContext) OPEN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPEN, 0) +} + +func (s *Plsql_unreserved_keywordContext) OPTION() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOPTION, 0) +} + +func (s *Plsql_unreserved_keywordContext) PERFORM() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPERFORM, 0) +} + +func (s *Plsql_unreserved_keywordContext) PRINT_STRICT_PARAMS() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRINT_STRICT_PARAMS, 0) +} + +func (s *Plsql_unreserved_keywordContext) PRIOR() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserPRIOR, 0) +} + +func (s *Plsql_unreserved_keywordContext) QUERY() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserQUERY, 0) +} + +func (s *Plsql_unreserved_keywordContext) RAISE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRAISE, 0) +} + +func (s *Plsql_unreserved_keywordContext) RELATIVE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRELATIVE_P, 0) +} + +func (s *Plsql_unreserved_keywordContext) RESET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRESET, 0) +} + +func (s *Plsql_unreserved_keywordContext) RETURN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserRETURN, 0) +} + +func (s *Plsql_unreserved_keywordContext) ROLLBACK() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROLLBACK, 0) +} + +func (s *Plsql_unreserved_keywordContext) ROWTYPE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserROWTYPE, 0) +} + +func (s *Plsql_unreserved_keywordContext) SCHEMA() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCHEMA, 0) +} + +func (s *Plsql_unreserved_keywordContext) SCROLL() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSCROLL, 0) +} + +func (s *Plsql_unreserved_keywordContext) SET() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSET, 0) +} + +func (s *Plsql_unreserved_keywordContext) SLICE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSLICE, 0) +} + +func (s *Plsql_unreserved_keywordContext) SQLSTATE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSQLSTATE, 0) +} + +func (s *Plsql_unreserved_keywordContext) STACKED() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserSTACKED, 0) +} + +func (s *Plsql_unreserved_keywordContext) TABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTABLE, 0) +} + +func (s *Plsql_unreserved_keywordContext) TYPE_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserTYPE_P, 0) +} + +func (s *Plsql_unreserved_keywordContext) USE_COLUMN() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSE_COLUMN, 0) +} + +func (s *Plsql_unreserved_keywordContext) USE_VARIABLE() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserUSE_VARIABLE, 0) +} + +func (s *Plsql_unreserved_keywordContext) VARIABLE_CONFLICT() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserVARIABLE_CONFLICT, 0) +} + +func (s *Plsql_unreserved_keywordContext) WARNING() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserWARNING, 0) +} + +func (s *Plsql_unreserved_keywordContext) OUTER_P() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserOUTER_P, 0) +} + +func (s *Plsql_unreserved_keywordContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Plsql_unreserved_keywordContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Plsql_unreserved_keywordContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterPlsql_unreserved_keyword(s) + } +} + +func (s *Plsql_unreserved_keywordContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitPlsql_unreserved_keyword(s) + } +} + +func (s *Plsql_unreserved_keywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitPlsql_unreserved_keyword(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Plsql_unreserved_keyword() (localctx IPlsql_unreserved_keywordContext) { + localctx = NewPlsql_unreserved_keywordContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1620, PostgreSQLParserRULE_plsql_unreserved_keyword) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11226) + _la = p.GetTokenStream().LA(1) + + if !(((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&2459027012145119232) != 0) || ((int64((_la-92)) & ^0x3f) == 0 && ((int64(1)<<(_la-92))&2310346885883232257) != 0) || ((int64((_la-157)) & ^0x3f) == 0 && ((int64(1)<<(_la-157))&10133099161617425) != 0) || ((int64((_la-232)) & ^0x3f) == 0 && ((int64(1)<<(_la-232))&18015499698831617) != 0) || ((int64((_la-300)) & ^0x3f) == 0 && ((int64(1)<<(_la-300))&9007199322050625) != 0) || ((int64((_la-435)) & ^0x3f) == 0 && ((int64(1)<<(_la-435))&-144097595889811453) != 0) || ((int64((_la-499)) & ^0x3f) == 0 && ((int64(1)<<(_la-499))&12516927) != 0)) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ISql_expressionContext is an interface to support dynamic dispatch. +type ISql_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Opt_target_list() IOpt_target_listContext + Into_clause() IInto_clauseContext + From_clause() IFrom_clauseContext + Where_clause() IWhere_clauseContext + Group_clause() IGroup_clauseContext + Having_clause() IHaving_clauseContext + Window_clause() IWindow_clauseContext + + // IsSql_expressionContext differentiates from other interfaces. + IsSql_expressionContext() +} + +type Sql_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySql_expressionContext() *Sql_expressionContext { + var p = new(Sql_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sql_expression + return p +} + +func InitEmptySql_expressionContext(p *Sql_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_sql_expression +} + +func (*Sql_expressionContext) IsSql_expressionContext() {} + +func NewSql_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Sql_expressionContext { + var p = new(Sql_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_sql_expression + + return p +} + +func (s *Sql_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Sql_expressionContext) Opt_target_list() IOpt_target_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_target_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_target_listContext) +} + +func (s *Sql_expressionContext) Into_clause() IInto_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInto_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInto_clauseContext) +} + +func (s *Sql_expressionContext) From_clause() IFrom_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_clauseContext) +} + +func (s *Sql_expressionContext) Where_clause() IWhere_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_clauseContext) +} + +func (s *Sql_expressionContext) Group_clause() IGroup_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IGroup_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IGroup_clauseContext) +} + +func (s *Sql_expressionContext) Having_clause() IHaving_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHaving_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHaving_clauseContext) +} + +func (s *Sql_expressionContext) Window_clause() IWindow_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWindow_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWindow_clauseContext) +} + +func (s *Sql_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Sql_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Sql_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterSql_expression(s) + } +} + +func (s *Sql_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitSql_expression(s) + } +} + +func (s *Sql_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitSql_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Sql_expression() (localctx ISql_expressionContext) { + localctx = NewSql_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1622, PostgreSQLParserRULE_sql_expression) + var _la int + + p.EnterOuterAlt(localctx, 1) + p.SetState(11229) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if ((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&3620818277858554372) != 0) || ((int64((_la-75)) & ^0x3f) == 0 && ((int64(1)<<(_la-75))&-2120073201) != 0) || ((int64((_la-139)) & ^0x3f) == 0 && ((int64(1)<<(_la-139))&-1) != 0) || ((int64((_la-203)) & ^0x3f) == 0 && ((int64(1)<<(_la-203))&-1266637395197953) != 0) || ((int64((_la-267)) & ^0x3f) == 0 && ((int64(1)<<(_la-267))&-1) != 0) || ((int64((_la-331)) & ^0x3f) == 0 && ((int64(1)<<(_la-331))&-1) != 0) || ((int64((_la-395)) & ^0x3f) == 0 && ((int64(1)<<(_la-395))&-2305843009213693953) != 0) || ((int64((_la-459)) & ^0x3f) == 0 && ((int64(1)<<(_la-459))&-4612037862148276225) != 0) || ((int64((_la-523)) & ^0x3f) == 0 && ((int64(1)<<(_la-523))&-1) != 0) || ((int64((_la-587)) & ^0x3f) == 0 && ((int64(1)<<(_la-587))&2524267591141163007) != 0) || ((int64((_la-652)) & ^0x3f) == 0 && ((int64(1)<<(_la-652))&67346997) != 0) { + { + p.SetState(11228) + p.Opt_target_list() + } + + } + p.SetState(11232) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINTO { + { + p.SetState(11231) + p.Into_clause() + } + + } + p.SetState(11235) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserFROM { + { + p.SetState(11234) + p.From_clause() + } + + } + p.SetState(11238) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWHERE { + { + p.SetState(11237) + p.Where_clause() + } + + } + p.SetState(11241) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserGROUP_P { + { + p.SetState(11240) + p.Group_clause() + } + + } + p.SetState(11244) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserHAVING { + { + p.SetState(11243) + p.Having_clause() + } + + } + p.SetState(11247) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserWINDOW { + { + p.SetState(11246) + p.Window_clause() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExpr_until_thenContext is an interface to support dynamic dispatch. +type IExpr_until_thenContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sql_expression() ISql_expressionContext + + // IsExpr_until_thenContext differentiates from other interfaces. + IsExpr_until_thenContext() +} + +type Expr_until_thenContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExpr_until_thenContext() *Expr_until_thenContext { + var p = new(Expr_until_thenContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_until_then + return p +} + +func InitEmptyExpr_until_thenContext(p *Expr_until_thenContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_until_then +} + +func (*Expr_until_thenContext) IsExpr_until_thenContext() {} + +func NewExpr_until_thenContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Expr_until_thenContext { + var p = new(Expr_until_thenContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_expr_until_then + + return p +} + +func (s *Expr_until_thenContext) GetParser() antlr.Parser { return s.parser } + +func (s *Expr_until_thenContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Expr_until_thenContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Expr_until_thenContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Expr_until_thenContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExpr_until_then(s) + } +} + +func (s *Expr_until_thenContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExpr_until_then(s) + } +} + +func (s *Expr_until_thenContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExpr_until_then(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Expr_until_then() (localctx IExpr_until_thenContext) { + localctx = NewExpr_until_thenContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1624, PostgreSQLParserRULE_expr_until_then) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11249) + p.Sql_expression() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExpr_until_semiContext is an interface to support dynamic dispatch. +type IExpr_until_semiContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Sql_expression() ISql_expressionContext + + // IsExpr_until_semiContext differentiates from other interfaces. + IsExpr_until_semiContext() +} + +type Expr_until_semiContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExpr_until_semiContext() *Expr_until_semiContext { + var p = new(Expr_until_semiContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_until_semi + return p +} + +func InitEmptyExpr_until_semiContext(p *Expr_until_semiContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_until_semi +} + +func (*Expr_until_semiContext) IsExpr_until_semiContext() {} + +func NewExpr_until_semiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Expr_until_semiContext { + var p = new(Expr_until_semiContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_expr_until_semi + + return p +} + +func (s *Expr_until_semiContext) GetParser() antlr.Parser { return s.parser } + +func (s *Expr_until_semiContext) Sql_expression() ISql_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISql_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISql_expressionContext) +} + +func (s *Expr_until_semiContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Expr_until_semiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Expr_until_semiContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExpr_until_semi(s) + } +} + +func (s *Expr_until_semiContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExpr_until_semi(s) + } +} + +func (s *Expr_until_semiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExpr_until_semi(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Expr_until_semi() (localctx IExpr_until_semiContext) { + localctx = NewExpr_until_semiContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1626, PostgreSQLParserRULE_expr_until_semi) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11251) + p.Sql_expression() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExpr_until_rightbracketContext is an interface to support dynamic dispatch. +type IExpr_until_rightbracketContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + + // IsExpr_until_rightbracketContext differentiates from other interfaces. + IsExpr_until_rightbracketContext() +} + +type Expr_until_rightbracketContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExpr_until_rightbracketContext() *Expr_until_rightbracketContext { + var p = new(Expr_until_rightbracketContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_until_rightbracket + return p +} + +func InitEmptyExpr_until_rightbracketContext(p *Expr_until_rightbracketContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_until_rightbracket +} + +func (*Expr_until_rightbracketContext) IsExpr_until_rightbracketContext() {} + +func NewExpr_until_rightbracketContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Expr_until_rightbracketContext { + var p = new(Expr_until_rightbracketContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_expr_until_rightbracket + + return p +} + +func (s *Expr_until_rightbracketContext) GetParser() antlr.Parser { return s.parser } + +func (s *Expr_until_rightbracketContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Expr_until_rightbracketContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Expr_until_rightbracketContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Expr_until_rightbracketContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExpr_until_rightbracket(s) + } +} + +func (s *Expr_until_rightbracketContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExpr_until_rightbracket(s) + } +} + +func (s *Expr_until_rightbracketContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExpr_until_rightbracket(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Expr_until_rightbracket() (localctx IExpr_until_rightbracketContext) { + localctx = NewExpr_until_rightbracketContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1628, PostgreSQLParserRULE_expr_until_rightbracket) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11253) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IExpr_until_loopContext is an interface to support dynamic dispatch. +type IExpr_until_loopContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + A_expr() IA_exprContext + + // IsExpr_until_loopContext differentiates from other interfaces. + IsExpr_until_loopContext() +} + +type Expr_until_loopContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyExpr_until_loopContext() *Expr_until_loopContext { + var p = new(Expr_until_loopContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_until_loop + return p +} + +func InitEmptyExpr_until_loopContext(p *Expr_until_loopContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_expr_until_loop +} + +func (*Expr_until_loopContext) IsExpr_until_loopContext() {} + +func NewExpr_until_loopContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Expr_until_loopContext { + var p = new(Expr_until_loopContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_expr_until_loop + + return p +} + +func (s *Expr_until_loopContext) GetParser() antlr.Parser { return s.parser } + +func (s *Expr_until_loopContext) A_expr() IA_exprContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IA_exprContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IA_exprContext) +} + +func (s *Expr_until_loopContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Expr_until_loopContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Expr_until_loopContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterExpr_until_loop(s) + } +} + +func (s *Expr_until_loopContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitExpr_until_loop(s) + } +} + +func (s *Expr_until_loopContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitExpr_until_loop(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Expr_until_loop() (localctx IExpr_until_loopContext) { + localctx = NewExpr_until_loopContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1630, PostgreSQLParserRULE_expr_until_loop) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11255) + p.A_expr() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IMake_execsql_stmtContext is an interface to support dynamic dispatch. +type IMake_execsql_stmtContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Stmt() IStmtContext + Opt_returning_clause_into() IOpt_returning_clause_intoContext + + // IsMake_execsql_stmtContext differentiates from other interfaces. + IsMake_execsql_stmtContext() +} + +type Make_execsql_stmtContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyMake_execsql_stmtContext() *Make_execsql_stmtContext { + var p = new(Make_execsql_stmtContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_make_execsql_stmt + return p +} + +func InitEmptyMake_execsql_stmtContext(p *Make_execsql_stmtContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_make_execsql_stmt +} + +func (*Make_execsql_stmtContext) IsMake_execsql_stmtContext() {} + +func NewMake_execsql_stmtContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Make_execsql_stmtContext { + var p = new(Make_execsql_stmtContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_make_execsql_stmt + + return p +} + +func (s *Make_execsql_stmtContext) GetParser() antlr.Parser { return s.parser } + +func (s *Make_execsql_stmtContext) Stmt() IStmtContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IStmtContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IStmtContext) +} + +func (s *Make_execsql_stmtContext) Opt_returning_clause_into() IOpt_returning_clause_intoContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_returning_clause_intoContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_returning_clause_intoContext) +} + +func (s *Make_execsql_stmtContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Make_execsql_stmtContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Make_execsql_stmtContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterMake_execsql_stmt(s) + } +} + +func (s *Make_execsql_stmtContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitMake_execsql_stmt(s) + } +} + +func (s *Make_execsql_stmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitMake_execsql_stmt(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Make_execsql_stmt() (localctx IMake_execsql_stmtContext) { + localctx = NewMake_execsql_stmtContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1632, PostgreSQLParserRULE_make_execsql_stmt) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11257) + p.Stmt() + } + p.SetState(11259) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == PostgreSQLParserINTO { + { + p.SetState(11258) + p.Opt_returning_clause_into() + } + + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IOpt_returning_clause_intoContext is an interface to support dynamic dispatch. +type IOpt_returning_clause_intoContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + INTO() antlr.TerminalNode + Into_target() IInto_targetContext + Opt_strict() IOpt_strictContext + + // IsOpt_returning_clause_intoContext differentiates from other interfaces. + IsOpt_returning_clause_intoContext() +} + +type Opt_returning_clause_intoContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyOpt_returning_clause_intoContext() *Opt_returning_clause_intoContext { + var p = new(Opt_returning_clause_intoContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_returning_clause_into + return p +} + +func InitEmptyOpt_returning_clause_intoContext(p *Opt_returning_clause_intoContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = PostgreSQLParserRULE_opt_returning_clause_into +} + +func (*Opt_returning_clause_intoContext) IsOpt_returning_clause_intoContext() {} + +func NewOpt_returning_clause_intoContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Opt_returning_clause_intoContext { + var p = new(Opt_returning_clause_intoContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = PostgreSQLParserRULE_opt_returning_clause_into + + return p +} + +func (s *Opt_returning_clause_intoContext) GetParser() antlr.Parser { return s.parser } + +func (s *Opt_returning_clause_intoContext) INTO() antlr.TerminalNode { + return s.GetToken(PostgreSQLParserINTO, 0) +} + +func (s *Opt_returning_clause_intoContext) Into_target() IInto_targetContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInto_targetContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInto_targetContext) +} + +func (s *Opt_returning_clause_intoContext) Opt_strict() IOpt_strictContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IOpt_strictContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IOpt_strictContext) +} + +func (s *Opt_returning_clause_intoContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Opt_returning_clause_intoContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Opt_returning_clause_intoContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.EnterOpt_returning_clause_into(s) + } +} + +func (s *Opt_returning_clause_intoContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(PostgreSQLParserListener); ok { + listenerT.ExitOpt_returning_clause_into(s) + } +} + +func (s *Opt_returning_clause_intoContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case PostgreSQLParserVisitor: + return t.VisitOpt_returning_clause_into(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *PostgreSQLParser) Opt_returning_clause_into() (localctx IOpt_returning_clause_intoContext) { + localctx = NewOpt_returning_clause_intoContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 1634, PostgreSQLParserRULE_opt_returning_clause_into) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(11261) + p.Match(PostgreSQLParserINTO) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(11263) + p.GetErrorHandler().Sync(p) + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 1118, p.GetParserRuleContext()) == 1 { + { + p.SetState(11262) + p.Opt_strict() + } + + } else if p.HasError() { // JIM + goto errorExit + } + { + p.SetState(11265) + p.Into_target() + } + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +func (p *PostgreSQLParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { + switch ruleIndex { + case 94: + var t *ColumnDefContext = nil + if localctx != nil { + t = localctx.(*ColumnDefContext) + } + return p.ColumnDef_Sempred(t, predIndex) + + case 607: + var t *B_exprContext = nil + if localctx != nil { + t = localctx.(*B_exprContext) + } + return p.B_expr_Sempred(t, predIndex) + + default: + panic("No predicate with index: " + fmt.Sprint(ruleIndex)) + } +} + +func (p *PostgreSQLParser) ColumnDef_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 0: + return p.Engine != EngineRedshift + + case 1: + return p.Engine == EngineRedshift + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} + +func (p *PostgreSQLParser) B_expr_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 2: + return p.Precpred(p.GetParserRuleContext(), 8) + + case 3: + return p.Precpred(p.GetParserRuleContext(), 7) + + case 4: + return p.Precpred(p.GetParserRuleContext(), 6) + + case 5: + return p.Precpred(p.GetParserRuleContext(), 5) + + case 6: + return p.Precpred(p.GetParserRuleContext(), 4) + + case 7: + return p.Precpred(p.GetParserRuleContext(), 10) + + case 8: + return p.Precpred(p.GetParserRuleContext(), 2) + + case 9: + return p.Precpred(p.GetParserRuleContext(), 1) + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} diff --git a/postgresql/postgresql_parser_base.go b/postgresql/postgresql_parser_base.go new file mode 100644 index 0000000..4a9a981 --- /dev/null +++ b/postgresql/postgresql_parser_base.go @@ -0,0 +1,203 @@ +package postgresql + +import ( + "strings" + + "github.com/antlr4-go/antlr/v4" +) + +type Engine int + +const ( + EnginePostgreSQL Engine = iota + EngineRedshift +) + +type PostgreSQLParserBase struct { + *antlr.BaseParser + + Engine Engine + parseErrors []*PostgreSQLParseError +} + +func NewPostgreSQLParserBase(input antlr.TokenStream) *PostgreSQLParserBase { + return &PostgreSQLParserBase{ + BaseParser: antlr.NewBaseParser(input), + Engine: EnginePostgreSQL, + } +} + +func (receiver *PostgreSQLParserBase) GetParsedSqlTree(script string, line int) antlr.ParserRuleContext { + parser := getPostgreSQLParser(script) + result := parser.Root() + for _, err := range parser.parseErrors { + receiver.parseErrors = append(receiver.parseErrors, &PostgreSQLParseError{ + Number: err.Number, + Offset: err.Offset, + Line: err.Line + line, + Column: err.Column, + Message: err.Message, + }) + } + return result +} + +func (receiver *PostgreSQLParserBase) ParseRoutineBody(localContextInterface ICreatefunc_opt_listContext) { + localContext, ok := localContextInterface.(*Createfunc_opt_listContext) + if !ok { + return + } + + var lang string + for _, coi := range localContext.AllCreatefunc_opt_item() { + createFuncOptItemContext, ok := coi.(*Createfunc_opt_itemContext) + if !ok || createFuncOptItemContext.LANGUAGE() == nil { + continue + } + nonReservedWordOrSConstContextInterface := createFuncOptItemContext.Nonreservedword_or_sconst() + if nonReservedWordOrSConstContextInterface == nil { + continue + } + nonReservedWordOrSConstContext, ok := nonReservedWordOrSConstContextInterface.(*Nonreservedword_or_sconstContext) + if !ok { + continue + } + nonReservedWordContextInterface := nonReservedWordOrSConstContext.Nonreservedword() + if nonReservedWordContextInterface == nil { + continue + } + nonReservedWordContext, ok := nonReservedWordContextInterface.(*NonreservedwordContext) + if !ok { + continue + } + identifierInterface := nonReservedWordContext.Identifier() + if identifierInterface == nil { + continue + } + identifier, ok := identifierInterface.(*IdentifierContext) + if !ok { + continue + } + node := identifier.Identifier() + if node == nil { + continue + } + lang = node.GetText() + break + } + if lang == "" { + return + } + + var funcAs *Createfunc_opt_itemContext + for _, coi := range localContext.AllCreatefunc_opt_item() { + ctx, ok := coi.(*Createfunc_opt_itemContext) + if !ok || ctx.AS() == nil { + continue + } + as := ctx.Func_as() + if as != nil { + funcAs = ctx + break + } + } + if funcAs == nil { + return + } + + funcAsContextInterface := funcAs.Func_as() + if funcAsContextInterface == nil { + return + } + funcAsContext, ok := funcAsContextInterface.(*Func_asContext) + if !ok { + return + } + sConstContextInterface := funcAsContext.Sconst(0) + if sConstContextInterface == nil { + return + } + sConstContext, ok := sConstContextInterface.(*SconstContext) + if !ok { + return + } + text := GetRoutineBodyString(sConstContext) + line := sConstContext.GetStart().GetLine() + parser := getPostgreSQLParser(text) + switch lang { + case "plpgsql": + funcAs.Func_as().(*Func_asContext).Definition = parser.Plsqlroot() + case "sql": + funcAs.Func_as().(*Func_asContext).Definition = parser.Root() + } + for _, err := range parser.parseErrors { + receiver.parseErrors = append(receiver.parseErrors, &PostgreSQLParseError{ + Number: err.Number, + Offset: err.Offset, + Line: err.Line + line, + Column: err.Column, + Message: err.Message, + }) + } +} + +func TrimQuotes(s string) string { + if s == "" { + return s + } + return s[1 : len(s)-2] +} + +func unquote(s string) string { + result := strings.Builder{} + length := len(s) + index := 0 + for index < length { + c := s[index] + result.WriteByte(c) + if c == '\'' && index < length-1 && (s[index+1] == '\'') { + index++ + } + index++ + } + return result.String() +} + +func GetRoutineBodyString(rule *SconstContext) string { + if rule.Anysconst() == nil { + return "" + } + anySConstContext := rule.Anysconst().(*AnysconstContext) + + stringConstant := anySConstContext.StringConstant() + if stringConstant != nil { + return unquote(TrimQuotes(stringConstant.GetText())) + } + + unicodeEscapeStringConstant := anySConstContext.UnicodeEscapeStringConstant() + if unicodeEscapeStringConstant != nil { + return TrimQuotes(unicodeEscapeStringConstant.GetText()) + } + + escapeStringConstant := anySConstContext.EscapeStringConstant() + if escapeStringConstant != nil { + return TrimQuotes(escapeStringConstant.GetText()) + } + + result := strings.Builder{} + for _, node := range anySConstContext.AllDollarText() { + result.WriteString(node.GetText()) + } + return result.String() +} + +func getPostgreSQLParser(script string) *PostgreSQLParser { + stream := antlr.NewInputStream(script) + lexer := NewPostgreSQLLexer(stream) + tokenStream := antlr.NewCommonTokenStream(lexer, 0) + parser := NewPostgreSQLParser(tokenStream) + errorListener := new(PostgreSQLParserErrorListener) + errorListener.grammar = parser + parser.AddErrorListener(errorListener) + return parser +} diff --git a/postgresql/postgresql_parser_error_listener.go b/postgresql/postgresql_parser_error_listener.go new file mode 100644 index 0000000..b7d794d --- /dev/null +++ b/postgresql/postgresql_parser_error_listener.go @@ -0,0 +1,31 @@ +package postgresql + +import "github.com/antlr4-go/antlr/v4" + +type PostgreSQLParserErrorListener struct { + grammar *PostgreSQLParser +} + +var _ antlr.ErrorListener = &PostgreSQLParserErrorListener{} + +func (receiver PostgreSQLParserErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException) { + receiver.grammar.parseErrors = append(receiver.grammar.parseErrors, &PostgreSQLParseError{ + Number: 0, + Offset: 0, + Line: line, + Column: column, + Message: msg, + }) +} + +func (receiver PostgreSQLParserErrorListener) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { + // ignore +} + +func (receiver PostgreSQLParserErrorListener) ReportAttemptingFullContext(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, conflictingAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { + // ignore +} + +func (receiver PostgreSQLParserErrorListener) ReportContextSensitivity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex, prediction int, configs *antlr.ATNConfigSet) { + // ignore +} diff --git a/postgresql/postgresqlparser_base_listener.go b/postgresql/postgresqlparser_base_listener.go new file mode 100644 index 0000000..46d1599 --- /dev/null +++ b/postgresql/postgresqlparser_base_listener.go @@ -0,0 +1,5154 @@ +// Code generated from PostgreSQLParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package postgresql // PostgreSQLParser +import "github.com/antlr4-go/antlr/v4" + +// BasePostgreSQLParserListener is a complete listener for a parse tree produced by PostgreSQLParser. +type BasePostgreSQLParserListener struct{} + +var _ PostgreSQLParserListener = &BasePostgreSQLParserListener{} + +// VisitTerminal is called when a terminal node is visited. +func (s *BasePostgreSQLParserListener) VisitTerminal(node antlr.TerminalNode) {} + +// VisitErrorNode is called when an error node is visited. +func (s *BasePostgreSQLParserListener) VisitErrorNode(node antlr.ErrorNode) {} + +// EnterEveryRule is called when any rule is entered. +func (s *BasePostgreSQLParserListener) EnterEveryRule(ctx antlr.ParserRuleContext) {} + +// ExitEveryRule is called when any rule is exited. +func (s *BasePostgreSQLParserListener) ExitEveryRule(ctx antlr.ParserRuleContext) {} + +// EnterRoot is called when production root is entered. +func (s *BasePostgreSQLParserListener) EnterRoot(ctx *RootContext) {} + +// ExitRoot is called when production root is exited. +func (s *BasePostgreSQLParserListener) ExitRoot(ctx *RootContext) {} + +// EnterPlsqlroot is called when production plsqlroot is entered. +func (s *BasePostgreSQLParserListener) EnterPlsqlroot(ctx *PlsqlrootContext) {} + +// ExitPlsqlroot is called when production plsqlroot is exited. +func (s *BasePostgreSQLParserListener) ExitPlsqlroot(ctx *PlsqlrootContext) {} + +// EnterStmtblock is called when production stmtblock is entered. +func (s *BasePostgreSQLParserListener) EnterStmtblock(ctx *StmtblockContext) {} + +// ExitStmtblock is called when production stmtblock is exited. +func (s *BasePostgreSQLParserListener) ExitStmtblock(ctx *StmtblockContext) {} + +// EnterStmtmulti is called when production stmtmulti is entered. +func (s *BasePostgreSQLParserListener) EnterStmtmulti(ctx *StmtmultiContext) {} + +// ExitStmtmulti is called when production stmtmulti is exited. +func (s *BasePostgreSQLParserListener) ExitStmtmulti(ctx *StmtmultiContext) {} + +// EnterStmt is called when production stmt is entered. +func (s *BasePostgreSQLParserListener) EnterStmt(ctx *StmtContext) {} + +// ExitStmt is called when production stmt is exited. +func (s *BasePostgreSQLParserListener) ExitStmt(ctx *StmtContext) {} + +// EnterPlsqlconsolecommand is called when production plsqlconsolecommand is entered. +func (s *BasePostgreSQLParserListener) EnterPlsqlconsolecommand(ctx *PlsqlconsolecommandContext) {} + +// ExitPlsqlconsolecommand is called when production plsqlconsolecommand is exited. +func (s *BasePostgreSQLParserListener) ExitPlsqlconsolecommand(ctx *PlsqlconsolecommandContext) {} + +// EnterCallstmt is called when production callstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCallstmt(ctx *CallstmtContext) {} + +// ExitCallstmt is called when production callstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCallstmt(ctx *CallstmtContext) {} + +// EnterCreaterolestmt is called when production createrolestmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreaterolestmt(ctx *CreaterolestmtContext) {} + +// ExitCreaterolestmt is called when production createrolestmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreaterolestmt(ctx *CreaterolestmtContext) {} + +// EnterOpt_with is called when production opt_with is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_with(ctx *Opt_withContext) {} + +// ExitOpt_with is called when production opt_with is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_with(ctx *Opt_withContext) {} + +// EnterOptrolelist is called when production optrolelist is entered. +func (s *BasePostgreSQLParserListener) EnterOptrolelist(ctx *OptrolelistContext) {} + +// ExitOptrolelist is called when production optrolelist is exited. +func (s *BasePostgreSQLParserListener) ExitOptrolelist(ctx *OptrolelistContext) {} + +// EnterAlteroptrolelist is called when production alteroptrolelist is entered. +func (s *BasePostgreSQLParserListener) EnterAlteroptrolelist(ctx *AlteroptrolelistContext) {} + +// ExitAlteroptrolelist is called when production alteroptrolelist is exited. +func (s *BasePostgreSQLParserListener) ExitAlteroptrolelist(ctx *AlteroptrolelistContext) {} + +// EnterAlteroptroleelem is called when production alteroptroleelem is entered. +func (s *BasePostgreSQLParserListener) EnterAlteroptroleelem(ctx *AlteroptroleelemContext) {} + +// ExitAlteroptroleelem is called when production alteroptroleelem is exited. +func (s *BasePostgreSQLParserListener) ExitAlteroptroleelem(ctx *AlteroptroleelemContext) {} + +// EnterCreateoptroleelem is called when production createoptroleelem is entered. +func (s *BasePostgreSQLParserListener) EnterCreateoptroleelem(ctx *CreateoptroleelemContext) {} + +// ExitCreateoptroleelem is called when production createoptroleelem is exited. +func (s *BasePostgreSQLParserListener) ExitCreateoptroleelem(ctx *CreateoptroleelemContext) {} + +// EnterCreateuserstmt is called when production createuserstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateuserstmt(ctx *CreateuserstmtContext) {} + +// ExitCreateuserstmt is called when production createuserstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateuserstmt(ctx *CreateuserstmtContext) {} + +// EnterAlterrolestmt is called when production alterrolestmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterrolestmt(ctx *AlterrolestmtContext) {} + +// ExitAlterrolestmt is called when production alterrolestmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterrolestmt(ctx *AlterrolestmtContext) {} + +// EnterOpt_in_database is called when production opt_in_database is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_in_database(ctx *Opt_in_databaseContext) {} + +// ExitOpt_in_database is called when production opt_in_database is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_in_database(ctx *Opt_in_databaseContext) {} + +// EnterAlterrolesetstmt is called when production alterrolesetstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterrolesetstmt(ctx *AlterrolesetstmtContext) {} + +// ExitAlterrolesetstmt is called when production alterrolesetstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterrolesetstmt(ctx *AlterrolesetstmtContext) {} + +// EnterDroprolestmt is called when production droprolestmt is entered. +func (s *BasePostgreSQLParserListener) EnterDroprolestmt(ctx *DroprolestmtContext) {} + +// ExitDroprolestmt is called when production droprolestmt is exited. +func (s *BasePostgreSQLParserListener) ExitDroprolestmt(ctx *DroprolestmtContext) {} + +// EnterCreategroupstmt is called when production creategroupstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreategroupstmt(ctx *CreategroupstmtContext) {} + +// ExitCreategroupstmt is called when production creategroupstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreategroupstmt(ctx *CreategroupstmtContext) {} + +// EnterAltergroupstmt is called when production altergroupstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltergroupstmt(ctx *AltergroupstmtContext) {} + +// ExitAltergroupstmt is called when production altergroupstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltergroupstmt(ctx *AltergroupstmtContext) {} + +// EnterAdd_drop is called when production add_drop is entered. +func (s *BasePostgreSQLParserListener) EnterAdd_drop(ctx *Add_dropContext) {} + +// ExitAdd_drop is called when production add_drop is exited. +func (s *BasePostgreSQLParserListener) ExitAdd_drop(ctx *Add_dropContext) {} + +// EnterCreateschemastmt is called when production createschemastmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateschemastmt(ctx *CreateschemastmtContext) {} + +// ExitCreateschemastmt is called when production createschemastmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateschemastmt(ctx *CreateschemastmtContext) {} + +// EnterOptschemaname is called when production optschemaname is entered. +func (s *BasePostgreSQLParserListener) EnterOptschemaname(ctx *OptschemanameContext) {} + +// ExitOptschemaname is called when production optschemaname is exited. +func (s *BasePostgreSQLParserListener) ExitOptschemaname(ctx *OptschemanameContext) {} + +// EnterOptschemaeltlist is called when production optschemaeltlist is entered. +func (s *BasePostgreSQLParserListener) EnterOptschemaeltlist(ctx *OptschemaeltlistContext) {} + +// ExitOptschemaeltlist is called when production optschemaeltlist is exited. +func (s *BasePostgreSQLParserListener) ExitOptschemaeltlist(ctx *OptschemaeltlistContext) {} + +// EnterSchema_stmt is called when production schema_stmt is entered. +func (s *BasePostgreSQLParserListener) EnterSchema_stmt(ctx *Schema_stmtContext) {} + +// ExitSchema_stmt is called when production schema_stmt is exited. +func (s *BasePostgreSQLParserListener) ExitSchema_stmt(ctx *Schema_stmtContext) {} + +// EnterVariablesetstmt is called when production variablesetstmt is entered. +func (s *BasePostgreSQLParserListener) EnterVariablesetstmt(ctx *VariablesetstmtContext) {} + +// ExitVariablesetstmt is called when production variablesetstmt is exited. +func (s *BasePostgreSQLParserListener) ExitVariablesetstmt(ctx *VariablesetstmtContext) {} + +// EnterSet_rest is called when production set_rest is entered. +func (s *BasePostgreSQLParserListener) EnterSet_rest(ctx *Set_restContext) {} + +// ExitSet_rest is called when production set_rest is exited. +func (s *BasePostgreSQLParserListener) ExitSet_rest(ctx *Set_restContext) {} + +// EnterGeneric_set is called when production generic_set is entered. +func (s *BasePostgreSQLParserListener) EnterGeneric_set(ctx *Generic_setContext) {} + +// ExitGeneric_set is called when production generic_set is exited. +func (s *BasePostgreSQLParserListener) ExitGeneric_set(ctx *Generic_setContext) {} + +// EnterSet_rest_more is called when production set_rest_more is entered. +func (s *BasePostgreSQLParserListener) EnterSet_rest_more(ctx *Set_rest_moreContext) {} + +// ExitSet_rest_more is called when production set_rest_more is exited. +func (s *BasePostgreSQLParserListener) ExitSet_rest_more(ctx *Set_rest_moreContext) {} + +// EnterVar_name is called when production var_name is entered. +func (s *BasePostgreSQLParserListener) EnterVar_name(ctx *Var_nameContext) {} + +// ExitVar_name is called when production var_name is exited. +func (s *BasePostgreSQLParserListener) ExitVar_name(ctx *Var_nameContext) {} + +// EnterVar_list is called when production var_list is entered. +func (s *BasePostgreSQLParserListener) EnterVar_list(ctx *Var_listContext) {} + +// ExitVar_list is called when production var_list is exited. +func (s *BasePostgreSQLParserListener) ExitVar_list(ctx *Var_listContext) {} + +// EnterVar_value is called when production var_value is entered. +func (s *BasePostgreSQLParserListener) EnterVar_value(ctx *Var_valueContext) {} + +// ExitVar_value is called when production var_value is exited. +func (s *BasePostgreSQLParserListener) ExitVar_value(ctx *Var_valueContext) {} + +// EnterIso_level is called when production iso_level is entered. +func (s *BasePostgreSQLParserListener) EnterIso_level(ctx *Iso_levelContext) {} + +// ExitIso_level is called when production iso_level is exited. +func (s *BasePostgreSQLParserListener) ExitIso_level(ctx *Iso_levelContext) {} + +// EnterOpt_boolean_or_string is called when production opt_boolean_or_string is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_boolean_or_string(ctx *Opt_boolean_or_stringContext) { +} + +// ExitOpt_boolean_or_string is called when production opt_boolean_or_string is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_boolean_or_string(ctx *Opt_boolean_or_stringContext) {} + +// EnterZone_value is called when production zone_value is entered. +func (s *BasePostgreSQLParserListener) EnterZone_value(ctx *Zone_valueContext) {} + +// ExitZone_value is called when production zone_value is exited. +func (s *BasePostgreSQLParserListener) ExitZone_value(ctx *Zone_valueContext) {} + +// EnterOpt_encoding is called when production opt_encoding is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_encoding(ctx *Opt_encodingContext) {} + +// ExitOpt_encoding is called when production opt_encoding is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_encoding(ctx *Opt_encodingContext) {} + +// EnterNonreservedword_or_sconst is called when production nonreservedword_or_sconst is entered. +func (s *BasePostgreSQLParserListener) EnterNonreservedword_or_sconst(ctx *Nonreservedword_or_sconstContext) { +} + +// ExitNonreservedword_or_sconst is called when production nonreservedword_or_sconst is exited. +func (s *BasePostgreSQLParserListener) ExitNonreservedword_or_sconst(ctx *Nonreservedword_or_sconstContext) { +} + +// EnterVariableresetstmt is called when production variableresetstmt is entered. +func (s *BasePostgreSQLParserListener) EnterVariableresetstmt(ctx *VariableresetstmtContext) {} + +// ExitVariableresetstmt is called when production variableresetstmt is exited. +func (s *BasePostgreSQLParserListener) ExitVariableresetstmt(ctx *VariableresetstmtContext) {} + +// EnterReset_rest is called when production reset_rest is entered. +func (s *BasePostgreSQLParserListener) EnterReset_rest(ctx *Reset_restContext) {} + +// ExitReset_rest is called when production reset_rest is exited. +func (s *BasePostgreSQLParserListener) ExitReset_rest(ctx *Reset_restContext) {} + +// EnterGeneric_reset is called when production generic_reset is entered. +func (s *BasePostgreSQLParserListener) EnterGeneric_reset(ctx *Generic_resetContext) {} + +// ExitGeneric_reset is called when production generic_reset is exited. +func (s *BasePostgreSQLParserListener) ExitGeneric_reset(ctx *Generic_resetContext) {} + +// EnterSetresetclause is called when production setresetclause is entered. +func (s *BasePostgreSQLParserListener) EnterSetresetclause(ctx *SetresetclauseContext) {} + +// ExitSetresetclause is called when production setresetclause is exited. +func (s *BasePostgreSQLParserListener) ExitSetresetclause(ctx *SetresetclauseContext) {} + +// EnterFunctionsetresetclause is called when production functionsetresetclause is entered. +func (s *BasePostgreSQLParserListener) EnterFunctionsetresetclause(ctx *FunctionsetresetclauseContext) { +} + +// ExitFunctionsetresetclause is called when production functionsetresetclause is exited. +func (s *BasePostgreSQLParserListener) ExitFunctionsetresetclause(ctx *FunctionsetresetclauseContext) { +} + +// EnterVariableshowstmt is called when production variableshowstmt is entered. +func (s *BasePostgreSQLParserListener) EnterVariableshowstmt(ctx *VariableshowstmtContext) {} + +// ExitVariableshowstmt is called when production variableshowstmt is exited. +func (s *BasePostgreSQLParserListener) ExitVariableshowstmt(ctx *VariableshowstmtContext) {} + +// EnterConstraintssetstmt is called when production constraintssetstmt is entered. +func (s *BasePostgreSQLParserListener) EnterConstraintssetstmt(ctx *ConstraintssetstmtContext) {} + +// ExitConstraintssetstmt is called when production constraintssetstmt is exited. +func (s *BasePostgreSQLParserListener) ExitConstraintssetstmt(ctx *ConstraintssetstmtContext) {} + +// EnterConstraints_set_list is called when production constraints_set_list is entered. +func (s *BasePostgreSQLParserListener) EnterConstraints_set_list(ctx *Constraints_set_listContext) {} + +// ExitConstraints_set_list is called when production constraints_set_list is exited. +func (s *BasePostgreSQLParserListener) ExitConstraints_set_list(ctx *Constraints_set_listContext) {} + +// EnterConstraints_set_mode is called when production constraints_set_mode is entered. +func (s *BasePostgreSQLParserListener) EnterConstraints_set_mode(ctx *Constraints_set_modeContext) {} + +// ExitConstraints_set_mode is called when production constraints_set_mode is exited. +func (s *BasePostgreSQLParserListener) ExitConstraints_set_mode(ctx *Constraints_set_modeContext) {} + +// EnterCheckpointstmt is called when production checkpointstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCheckpointstmt(ctx *CheckpointstmtContext) {} + +// ExitCheckpointstmt is called when production checkpointstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCheckpointstmt(ctx *CheckpointstmtContext) {} + +// EnterDiscardstmt is called when production discardstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDiscardstmt(ctx *DiscardstmtContext) {} + +// ExitDiscardstmt is called when production discardstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDiscardstmt(ctx *DiscardstmtContext) {} + +// EnterAltertablestmt is called when production altertablestmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltertablestmt(ctx *AltertablestmtContext) {} + +// ExitAltertablestmt is called when production altertablestmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltertablestmt(ctx *AltertablestmtContext) {} + +// EnterAlter_table_cmds is called when production alter_table_cmds is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_table_cmds(ctx *Alter_table_cmdsContext) {} + +// ExitAlter_table_cmds is called when production alter_table_cmds is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_table_cmds(ctx *Alter_table_cmdsContext) {} + +// EnterPartition_cmd is called when production partition_cmd is entered. +func (s *BasePostgreSQLParserListener) EnterPartition_cmd(ctx *Partition_cmdContext) {} + +// ExitPartition_cmd is called when production partition_cmd is exited. +func (s *BasePostgreSQLParserListener) ExitPartition_cmd(ctx *Partition_cmdContext) {} + +// EnterIndex_partition_cmd is called when production index_partition_cmd is entered. +func (s *BasePostgreSQLParserListener) EnterIndex_partition_cmd(ctx *Index_partition_cmdContext) {} + +// ExitIndex_partition_cmd is called when production index_partition_cmd is exited. +func (s *BasePostgreSQLParserListener) ExitIndex_partition_cmd(ctx *Index_partition_cmdContext) {} + +// EnterAlter_table_cmd is called when production alter_table_cmd is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_table_cmd(ctx *Alter_table_cmdContext) {} + +// ExitAlter_table_cmd is called when production alter_table_cmd is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_table_cmd(ctx *Alter_table_cmdContext) {} + +// EnterAlter_column_default is called when production alter_column_default is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_column_default(ctx *Alter_column_defaultContext) {} + +// ExitAlter_column_default is called when production alter_column_default is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_column_default(ctx *Alter_column_defaultContext) {} + +// EnterOpt_drop_behavior is called when production opt_drop_behavior is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_drop_behavior(ctx *Opt_drop_behaviorContext) {} + +// ExitOpt_drop_behavior is called when production opt_drop_behavior is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_drop_behavior(ctx *Opt_drop_behaviorContext) {} + +// EnterOpt_collate_clause is called when production opt_collate_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_collate_clause(ctx *Opt_collate_clauseContext) {} + +// ExitOpt_collate_clause is called when production opt_collate_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_collate_clause(ctx *Opt_collate_clauseContext) {} + +// EnterAlter_using is called when production alter_using is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_using(ctx *Alter_usingContext) {} + +// ExitAlter_using is called when production alter_using is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_using(ctx *Alter_usingContext) {} + +// EnterReplica_identity is called when production replica_identity is entered. +func (s *BasePostgreSQLParserListener) EnterReplica_identity(ctx *Replica_identityContext) {} + +// ExitReplica_identity is called when production replica_identity is exited. +func (s *BasePostgreSQLParserListener) ExitReplica_identity(ctx *Replica_identityContext) {} + +// EnterReloptions is called when production reloptions is entered. +func (s *BasePostgreSQLParserListener) EnterReloptions(ctx *ReloptionsContext) {} + +// ExitReloptions is called when production reloptions is exited. +func (s *BasePostgreSQLParserListener) ExitReloptions(ctx *ReloptionsContext) {} + +// EnterOpt_reloptions is called when production opt_reloptions is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_reloptions(ctx *Opt_reloptionsContext) {} + +// ExitOpt_reloptions is called when production opt_reloptions is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_reloptions(ctx *Opt_reloptionsContext) {} + +// EnterReloption_list is called when production reloption_list is entered. +func (s *BasePostgreSQLParserListener) EnterReloption_list(ctx *Reloption_listContext) {} + +// ExitReloption_list is called when production reloption_list is exited. +func (s *BasePostgreSQLParserListener) ExitReloption_list(ctx *Reloption_listContext) {} + +// EnterReloption_elem is called when production reloption_elem is entered. +func (s *BasePostgreSQLParserListener) EnterReloption_elem(ctx *Reloption_elemContext) {} + +// ExitReloption_elem is called when production reloption_elem is exited. +func (s *BasePostgreSQLParserListener) ExitReloption_elem(ctx *Reloption_elemContext) {} + +// EnterAlter_identity_column_option_list is called when production alter_identity_column_option_list is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_identity_column_option_list(ctx *Alter_identity_column_option_listContext) { +} + +// ExitAlter_identity_column_option_list is called when production alter_identity_column_option_list is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_identity_column_option_list(ctx *Alter_identity_column_option_listContext) { +} + +// EnterAlter_identity_column_option is called when production alter_identity_column_option is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_identity_column_option(ctx *Alter_identity_column_optionContext) { +} + +// ExitAlter_identity_column_option is called when production alter_identity_column_option is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_identity_column_option(ctx *Alter_identity_column_optionContext) { +} + +// EnterPartitionboundspec is called when production partitionboundspec is entered. +func (s *BasePostgreSQLParserListener) EnterPartitionboundspec(ctx *PartitionboundspecContext) {} + +// ExitPartitionboundspec is called when production partitionboundspec is exited. +func (s *BasePostgreSQLParserListener) ExitPartitionboundspec(ctx *PartitionboundspecContext) {} + +// EnterHash_partbound_elem is called when production hash_partbound_elem is entered. +func (s *BasePostgreSQLParserListener) EnterHash_partbound_elem(ctx *Hash_partbound_elemContext) {} + +// ExitHash_partbound_elem is called when production hash_partbound_elem is exited. +func (s *BasePostgreSQLParserListener) ExitHash_partbound_elem(ctx *Hash_partbound_elemContext) {} + +// EnterHash_partbound is called when production hash_partbound is entered. +func (s *BasePostgreSQLParserListener) EnterHash_partbound(ctx *Hash_partboundContext) {} + +// ExitHash_partbound is called when production hash_partbound is exited. +func (s *BasePostgreSQLParserListener) ExitHash_partbound(ctx *Hash_partboundContext) {} + +// EnterAltercompositetypestmt is called when production altercompositetypestmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltercompositetypestmt(ctx *AltercompositetypestmtContext) { +} + +// ExitAltercompositetypestmt is called when production altercompositetypestmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltercompositetypestmt(ctx *AltercompositetypestmtContext) { +} + +// EnterAlter_type_cmds is called when production alter_type_cmds is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_type_cmds(ctx *Alter_type_cmdsContext) {} + +// ExitAlter_type_cmds is called when production alter_type_cmds is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_type_cmds(ctx *Alter_type_cmdsContext) {} + +// EnterAlter_type_cmd is called when production alter_type_cmd is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_type_cmd(ctx *Alter_type_cmdContext) {} + +// ExitAlter_type_cmd is called when production alter_type_cmd is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_type_cmd(ctx *Alter_type_cmdContext) {} + +// EnterCloseportalstmt is called when production closeportalstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCloseportalstmt(ctx *CloseportalstmtContext) {} + +// ExitCloseportalstmt is called when production closeportalstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCloseportalstmt(ctx *CloseportalstmtContext) {} + +// EnterCopystmt is called when production copystmt is entered. +func (s *BasePostgreSQLParserListener) EnterCopystmt(ctx *CopystmtContext) {} + +// ExitCopystmt is called when production copystmt is exited. +func (s *BasePostgreSQLParserListener) ExitCopystmt(ctx *CopystmtContext) {} + +// EnterCopy_from is called when production copy_from is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_from(ctx *Copy_fromContext) {} + +// ExitCopy_from is called when production copy_from is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_from(ctx *Copy_fromContext) {} + +// EnterOpt_program is called when production opt_program is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_program(ctx *Opt_programContext) {} + +// ExitOpt_program is called when production opt_program is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_program(ctx *Opt_programContext) {} + +// EnterCopy_file_name is called when production copy_file_name is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_file_name(ctx *Copy_file_nameContext) {} + +// ExitCopy_file_name is called when production copy_file_name is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_file_name(ctx *Copy_file_nameContext) {} + +// EnterCopy_options is called when production copy_options is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_options(ctx *Copy_optionsContext) {} + +// ExitCopy_options is called when production copy_options is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_options(ctx *Copy_optionsContext) {} + +// EnterCopy_opt_list is called when production copy_opt_list is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_opt_list(ctx *Copy_opt_listContext) {} + +// ExitCopy_opt_list is called when production copy_opt_list is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_opt_list(ctx *Copy_opt_listContext) {} + +// EnterCopy_opt_item is called when production copy_opt_item is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_opt_item(ctx *Copy_opt_itemContext) {} + +// ExitCopy_opt_item is called when production copy_opt_item is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_opt_item(ctx *Copy_opt_itemContext) {} + +// EnterOpt_binary is called when production opt_binary is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_binary(ctx *Opt_binaryContext) {} + +// ExitOpt_binary is called when production opt_binary is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_binary(ctx *Opt_binaryContext) {} + +// EnterCopy_delimiter is called when production copy_delimiter is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_delimiter(ctx *Copy_delimiterContext) {} + +// ExitCopy_delimiter is called when production copy_delimiter is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_delimiter(ctx *Copy_delimiterContext) {} + +// EnterOpt_using is called when production opt_using is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_using(ctx *Opt_usingContext) {} + +// ExitOpt_using is called when production opt_using is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_using(ctx *Opt_usingContext) {} + +// EnterCopy_generic_opt_list is called when production copy_generic_opt_list is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_generic_opt_list(ctx *Copy_generic_opt_listContext) { +} + +// ExitCopy_generic_opt_list is called when production copy_generic_opt_list is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_generic_opt_list(ctx *Copy_generic_opt_listContext) {} + +// EnterCopy_generic_opt_elem is called when production copy_generic_opt_elem is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_generic_opt_elem(ctx *Copy_generic_opt_elemContext) { +} + +// ExitCopy_generic_opt_elem is called when production copy_generic_opt_elem is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_generic_opt_elem(ctx *Copy_generic_opt_elemContext) {} + +// EnterCopy_generic_opt_arg is called when production copy_generic_opt_arg is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_generic_opt_arg(ctx *Copy_generic_opt_argContext) {} + +// ExitCopy_generic_opt_arg is called when production copy_generic_opt_arg is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_generic_opt_arg(ctx *Copy_generic_opt_argContext) {} + +// EnterCopy_generic_opt_arg_list is called when production copy_generic_opt_arg_list is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_generic_opt_arg_list(ctx *Copy_generic_opt_arg_listContext) { +} + +// ExitCopy_generic_opt_arg_list is called when production copy_generic_opt_arg_list is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_generic_opt_arg_list(ctx *Copy_generic_opt_arg_listContext) { +} + +// EnterCopy_generic_opt_arg_list_item is called when production copy_generic_opt_arg_list_item is entered. +func (s *BasePostgreSQLParserListener) EnterCopy_generic_opt_arg_list_item(ctx *Copy_generic_opt_arg_list_itemContext) { +} + +// ExitCopy_generic_opt_arg_list_item is called when production copy_generic_opt_arg_list_item is exited. +func (s *BasePostgreSQLParserListener) ExitCopy_generic_opt_arg_list_item(ctx *Copy_generic_opt_arg_list_itemContext) { +} + +// EnterCreatestmt is called when production createstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatestmt(ctx *CreatestmtContext) {} + +// ExitCreatestmt is called when production createstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatestmt(ctx *CreatestmtContext) {} + +// EnterOpttemp is called when production opttemp is entered. +func (s *BasePostgreSQLParserListener) EnterOpttemp(ctx *OpttempContext) {} + +// ExitOpttemp is called when production opttemp is exited. +func (s *BasePostgreSQLParserListener) ExitOpttemp(ctx *OpttempContext) {} + +// EnterOpttableelementlist is called when production opttableelementlist is entered. +func (s *BasePostgreSQLParserListener) EnterOpttableelementlist(ctx *OpttableelementlistContext) {} + +// ExitOpttableelementlist is called when production opttableelementlist is exited. +func (s *BasePostgreSQLParserListener) ExitOpttableelementlist(ctx *OpttableelementlistContext) {} + +// EnterOpttypedtableelementlist is called when production opttypedtableelementlist is entered. +func (s *BasePostgreSQLParserListener) EnterOpttypedtableelementlist(ctx *OpttypedtableelementlistContext) { +} + +// ExitOpttypedtableelementlist is called when production opttypedtableelementlist is exited. +func (s *BasePostgreSQLParserListener) ExitOpttypedtableelementlist(ctx *OpttypedtableelementlistContext) { +} + +// EnterTableelementlist is called when production tableelementlist is entered. +func (s *BasePostgreSQLParserListener) EnterTableelementlist(ctx *TableelementlistContext) {} + +// ExitTableelementlist is called when production tableelementlist is exited. +func (s *BasePostgreSQLParserListener) ExitTableelementlist(ctx *TableelementlistContext) {} + +// EnterTypedtableelementlist is called when production typedtableelementlist is entered. +func (s *BasePostgreSQLParserListener) EnterTypedtableelementlist(ctx *TypedtableelementlistContext) { +} + +// ExitTypedtableelementlist is called when production typedtableelementlist is exited. +func (s *BasePostgreSQLParserListener) ExitTypedtableelementlist(ctx *TypedtableelementlistContext) {} + +// EnterTableelement is called when production tableelement is entered. +func (s *BasePostgreSQLParserListener) EnterTableelement(ctx *TableelementContext) {} + +// ExitTableelement is called when production tableelement is exited. +func (s *BasePostgreSQLParserListener) ExitTableelement(ctx *TableelementContext) {} + +// EnterTypedtableelement is called when production typedtableelement is entered. +func (s *BasePostgreSQLParserListener) EnterTypedtableelement(ctx *TypedtableelementContext) {} + +// ExitTypedtableelement is called when production typedtableelement is exited. +func (s *BasePostgreSQLParserListener) ExitTypedtableelement(ctx *TypedtableelementContext) {} + +// EnterColumnDef is called when production columnDef is entered. +func (s *BasePostgreSQLParserListener) EnterColumnDef(ctx *ColumnDefContext) {} + +// ExitColumnDef is called when production columnDef is exited. +func (s *BasePostgreSQLParserListener) ExitColumnDef(ctx *ColumnDefContext) {} + +// EnterRs_colattributes is called when production rs_colattributes is entered. +func (s *BasePostgreSQLParserListener) EnterRs_colattributes(ctx *Rs_colattributesContext) {} + +// ExitRs_colattributes is called when production rs_colattributes is exited. +func (s *BasePostgreSQLParserListener) ExitRs_colattributes(ctx *Rs_colattributesContext) {} + +// EnterColumnOptions is called when production columnOptions is entered. +func (s *BasePostgreSQLParserListener) EnterColumnOptions(ctx *ColumnOptionsContext) {} + +// ExitColumnOptions is called when production columnOptions is exited. +func (s *BasePostgreSQLParserListener) ExitColumnOptions(ctx *ColumnOptionsContext) {} + +// EnterColquallist is called when production colquallist is entered. +func (s *BasePostgreSQLParserListener) EnterColquallist(ctx *ColquallistContext) {} + +// ExitColquallist is called when production colquallist is exited. +func (s *BasePostgreSQLParserListener) ExitColquallist(ctx *ColquallistContext) {} + +// EnterColconstraint is called when production colconstraint is entered. +func (s *BasePostgreSQLParserListener) EnterColconstraint(ctx *ColconstraintContext) {} + +// ExitColconstraint is called when production colconstraint is exited. +func (s *BasePostgreSQLParserListener) ExitColconstraint(ctx *ColconstraintContext) {} + +// EnterColconstraintelem is called when production colconstraintelem is entered. +func (s *BasePostgreSQLParserListener) EnterColconstraintelem(ctx *ColconstraintelemContext) {} + +// ExitColconstraintelem is called when production colconstraintelem is exited. +func (s *BasePostgreSQLParserListener) ExitColconstraintelem(ctx *ColconstraintelemContext) {} + +// EnterOpt_unique_null_treatment is called when production opt_unique_null_treatment is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_unique_null_treatment(ctx *Opt_unique_null_treatmentContext) { +} + +// ExitOpt_unique_null_treatment is called when production opt_unique_null_treatment is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_unique_null_treatment(ctx *Opt_unique_null_treatmentContext) { +} + +// EnterGenerated_when is called when production generated_when is entered. +func (s *BasePostgreSQLParserListener) EnterGenerated_when(ctx *Generated_whenContext) {} + +// ExitGenerated_when is called when production generated_when is exited. +func (s *BasePostgreSQLParserListener) ExitGenerated_when(ctx *Generated_whenContext) {} + +// EnterConstraintattr is called when production constraintattr is entered. +func (s *BasePostgreSQLParserListener) EnterConstraintattr(ctx *ConstraintattrContext) {} + +// ExitConstraintattr is called when production constraintattr is exited. +func (s *BasePostgreSQLParserListener) ExitConstraintattr(ctx *ConstraintattrContext) {} + +// EnterTablelikeclause is called when production tablelikeclause is entered. +func (s *BasePostgreSQLParserListener) EnterTablelikeclause(ctx *TablelikeclauseContext) {} + +// ExitTablelikeclause is called when production tablelikeclause is exited. +func (s *BasePostgreSQLParserListener) ExitTablelikeclause(ctx *TablelikeclauseContext) {} + +// EnterTablelikeoptionlist is called when production tablelikeoptionlist is entered. +func (s *BasePostgreSQLParserListener) EnterTablelikeoptionlist(ctx *TablelikeoptionlistContext) {} + +// ExitTablelikeoptionlist is called when production tablelikeoptionlist is exited. +func (s *BasePostgreSQLParserListener) ExitTablelikeoptionlist(ctx *TablelikeoptionlistContext) {} + +// EnterTablelikeoption is called when production tablelikeoption is entered. +func (s *BasePostgreSQLParserListener) EnterTablelikeoption(ctx *TablelikeoptionContext) {} + +// ExitTablelikeoption is called when production tablelikeoption is exited. +func (s *BasePostgreSQLParserListener) ExitTablelikeoption(ctx *TablelikeoptionContext) {} + +// EnterTableconstraint is called when production tableconstraint is entered. +func (s *BasePostgreSQLParserListener) EnterTableconstraint(ctx *TableconstraintContext) {} + +// ExitTableconstraint is called when production tableconstraint is exited. +func (s *BasePostgreSQLParserListener) ExitTableconstraint(ctx *TableconstraintContext) {} + +// EnterConstraintelem is called when production constraintelem is entered. +func (s *BasePostgreSQLParserListener) EnterConstraintelem(ctx *ConstraintelemContext) {} + +// ExitConstraintelem is called when production constraintelem is exited. +func (s *BasePostgreSQLParserListener) ExitConstraintelem(ctx *ConstraintelemContext) {} + +// EnterOpt_no_inherit is called when production opt_no_inherit is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_no_inherit(ctx *Opt_no_inheritContext) {} + +// ExitOpt_no_inherit is called when production opt_no_inherit is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_no_inherit(ctx *Opt_no_inheritContext) {} + +// EnterOpt_column_list is called when production opt_column_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_column_list(ctx *Opt_column_listContext) {} + +// ExitOpt_column_list is called when production opt_column_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_column_list(ctx *Opt_column_listContext) {} + +// EnterColumnlist is called when production columnlist is entered. +func (s *BasePostgreSQLParserListener) EnterColumnlist(ctx *ColumnlistContext) {} + +// ExitColumnlist is called when production columnlist is exited. +func (s *BasePostgreSQLParserListener) ExitColumnlist(ctx *ColumnlistContext) {} + +// EnterColumnElem is called when production columnElem is entered. +func (s *BasePostgreSQLParserListener) EnterColumnElem(ctx *ColumnElemContext) {} + +// ExitColumnElem is called when production columnElem is exited. +func (s *BasePostgreSQLParserListener) ExitColumnElem(ctx *ColumnElemContext) {} + +// EnterOpt_c_include is called when production opt_c_include is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_c_include(ctx *Opt_c_includeContext) {} + +// ExitOpt_c_include is called when production opt_c_include is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_c_include(ctx *Opt_c_includeContext) {} + +// EnterKey_match is called when production key_match is entered. +func (s *BasePostgreSQLParserListener) EnterKey_match(ctx *Key_matchContext) {} + +// ExitKey_match is called when production key_match is exited. +func (s *BasePostgreSQLParserListener) ExitKey_match(ctx *Key_matchContext) {} + +// EnterExclusionconstraintlist is called when production exclusionconstraintlist is entered. +func (s *BasePostgreSQLParserListener) EnterExclusionconstraintlist(ctx *ExclusionconstraintlistContext) { +} + +// ExitExclusionconstraintlist is called when production exclusionconstraintlist is exited. +func (s *BasePostgreSQLParserListener) ExitExclusionconstraintlist(ctx *ExclusionconstraintlistContext) { +} + +// EnterExclusionconstraintelem is called when production exclusionconstraintelem is entered. +func (s *BasePostgreSQLParserListener) EnterExclusionconstraintelem(ctx *ExclusionconstraintelemContext) { +} + +// ExitExclusionconstraintelem is called when production exclusionconstraintelem is exited. +func (s *BasePostgreSQLParserListener) ExitExclusionconstraintelem(ctx *ExclusionconstraintelemContext) { +} + +// EnterExclusionwhereclause is called when production exclusionwhereclause is entered. +func (s *BasePostgreSQLParserListener) EnterExclusionwhereclause(ctx *ExclusionwhereclauseContext) {} + +// ExitExclusionwhereclause is called when production exclusionwhereclause is exited. +func (s *BasePostgreSQLParserListener) ExitExclusionwhereclause(ctx *ExclusionwhereclauseContext) {} + +// EnterKey_actions is called when production key_actions is entered. +func (s *BasePostgreSQLParserListener) EnterKey_actions(ctx *Key_actionsContext) {} + +// ExitKey_actions is called when production key_actions is exited. +func (s *BasePostgreSQLParserListener) ExitKey_actions(ctx *Key_actionsContext) {} + +// EnterKey_update is called when production key_update is entered. +func (s *BasePostgreSQLParserListener) EnterKey_update(ctx *Key_updateContext) {} + +// ExitKey_update is called when production key_update is exited. +func (s *BasePostgreSQLParserListener) ExitKey_update(ctx *Key_updateContext) {} + +// EnterKey_delete is called when production key_delete is entered. +func (s *BasePostgreSQLParserListener) EnterKey_delete(ctx *Key_deleteContext) {} + +// ExitKey_delete is called when production key_delete is exited. +func (s *BasePostgreSQLParserListener) ExitKey_delete(ctx *Key_deleteContext) {} + +// EnterKey_action is called when production key_action is entered. +func (s *BasePostgreSQLParserListener) EnterKey_action(ctx *Key_actionContext) {} + +// ExitKey_action is called when production key_action is exited. +func (s *BasePostgreSQLParserListener) ExitKey_action(ctx *Key_actionContext) {} + +// EnterOptinherit is called when production optinherit is entered. +func (s *BasePostgreSQLParserListener) EnterOptinherit(ctx *OptinheritContext) {} + +// ExitOptinherit is called when production optinherit is exited. +func (s *BasePostgreSQLParserListener) ExitOptinherit(ctx *OptinheritContext) {} + +// EnterOptpartitionspec is called when production optpartitionspec is entered. +func (s *BasePostgreSQLParserListener) EnterOptpartitionspec(ctx *OptpartitionspecContext) {} + +// ExitOptpartitionspec is called when production optpartitionspec is exited. +func (s *BasePostgreSQLParserListener) ExitOptpartitionspec(ctx *OptpartitionspecContext) {} + +// EnterPartitionspec is called when production partitionspec is entered. +func (s *BasePostgreSQLParserListener) EnterPartitionspec(ctx *PartitionspecContext) {} + +// ExitPartitionspec is called when production partitionspec is exited. +func (s *BasePostgreSQLParserListener) ExitPartitionspec(ctx *PartitionspecContext) {} + +// EnterPart_params is called when production part_params is entered. +func (s *BasePostgreSQLParserListener) EnterPart_params(ctx *Part_paramsContext) {} + +// ExitPart_params is called when production part_params is exited. +func (s *BasePostgreSQLParserListener) ExitPart_params(ctx *Part_paramsContext) {} + +// EnterPart_elem is called when production part_elem is entered. +func (s *BasePostgreSQLParserListener) EnterPart_elem(ctx *Part_elemContext) {} + +// ExitPart_elem is called when production part_elem is exited. +func (s *BasePostgreSQLParserListener) ExitPart_elem(ctx *Part_elemContext) {} + +// EnterTable_access_method_clause is called when production table_access_method_clause is entered. +func (s *BasePostgreSQLParserListener) EnterTable_access_method_clause(ctx *Table_access_method_clauseContext) { +} + +// ExitTable_access_method_clause is called when production table_access_method_clause is exited. +func (s *BasePostgreSQLParserListener) ExitTable_access_method_clause(ctx *Table_access_method_clauseContext) { +} + +// EnterOptwith is called when production optwith is entered. +func (s *BasePostgreSQLParserListener) EnterOptwith(ctx *OptwithContext) {} + +// ExitOptwith is called when production optwith is exited. +func (s *BasePostgreSQLParserListener) ExitOptwith(ctx *OptwithContext) {} + +// EnterOncommitoption is called when production oncommitoption is entered. +func (s *BasePostgreSQLParserListener) EnterOncommitoption(ctx *OncommitoptionContext) {} + +// ExitOncommitoption is called when production oncommitoption is exited. +func (s *BasePostgreSQLParserListener) ExitOncommitoption(ctx *OncommitoptionContext) {} + +// EnterOpttablespace is called when production opttablespace is entered. +func (s *BasePostgreSQLParserListener) EnterOpttablespace(ctx *OpttablespaceContext) {} + +// ExitOpttablespace is called when production opttablespace is exited. +func (s *BasePostgreSQLParserListener) ExitOpttablespace(ctx *OpttablespaceContext) {} + +// EnterOptconstablespace is called when production optconstablespace is entered. +func (s *BasePostgreSQLParserListener) EnterOptconstablespace(ctx *OptconstablespaceContext) {} + +// ExitOptconstablespace is called when production optconstablespace is exited. +func (s *BasePostgreSQLParserListener) ExitOptconstablespace(ctx *OptconstablespaceContext) {} + +// EnterExistingindex is called when production existingindex is entered. +func (s *BasePostgreSQLParserListener) EnterExistingindex(ctx *ExistingindexContext) {} + +// ExitExistingindex is called when production existingindex is exited. +func (s *BasePostgreSQLParserListener) ExitExistingindex(ctx *ExistingindexContext) {} + +// EnterCreatestatsstmt is called when production createstatsstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatestatsstmt(ctx *CreatestatsstmtContext) {} + +// ExitCreatestatsstmt is called when production createstatsstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatestatsstmt(ctx *CreatestatsstmtContext) {} + +// EnterAlterstatsstmt is called when production alterstatsstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterstatsstmt(ctx *AlterstatsstmtContext) {} + +// ExitAlterstatsstmt is called when production alterstatsstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterstatsstmt(ctx *AlterstatsstmtContext) {} + +// EnterCreateasstmt is called when production createasstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateasstmt(ctx *CreateasstmtContext) {} + +// ExitCreateasstmt is called when production createasstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateasstmt(ctx *CreateasstmtContext) {} + +// EnterCreate_as_target is called when production create_as_target is entered. +func (s *BasePostgreSQLParserListener) EnterCreate_as_target(ctx *Create_as_targetContext) {} + +// ExitCreate_as_target is called when production create_as_target is exited. +func (s *BasePostgreSQLParserListener) ExitCreate_as_target(ctx *Create_as_targetContext) {} + +// EnterOpt_with_data is called when production opt_with_data is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_with_data(ctx *Opt_with_dataContext) {} + +// ExitOpt_with_data is called when production opt_with_data is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_with_data(ctx *Opt_with_dataContext) {} + +// EnterCreatematviewstmt is called when production creatematviewstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatematviewstmt(ctx *CreatematviewstmtContext) {} + +// ExitCreatematviewstmt is called when production creatematviewstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatematviewstmt(ctx *CreatematviewstmtContext) {} + +// EnterCreate_mv_target is called when production create_mv_target is entered. +func (s *BasePostgreSQLParserListener) EnterCreate_mv_target(ctx *Create_mv_targetContext) {} + +// ExitCreate_mv_target is called when production create_mv_target is exited. +func (s *BasePostgreSQLParserListener) ExitCreate_mv_target(ctx *Create_mv_targetContext) {} + +// EnterOptnolog is called when production optnolog is entered. +func (s *BasePostgreSQLParserListener) EnterOptnolog(ctx *OptnologContext) {} + +// ExitOptnolog is called when production optnolog is exited. +func (s *BasePostgreSQLParserListener) ExitOptnolog(ctx *OptnologContext) {} + +// EnterRefreshmatviewstmt is called when production refreshmatviewstmt is entered. +func (s *BasePostgreSQLParserListener) EnterRefreshmatviewstmt(ctx *RefreshmatviewstmtContext) {} + +// ExitRefreshmatviewstmt is called when production refreshmatviewstmt is exited. +func (s *BasePostgreSQLParserListener) ExitRefreshmatviewstmt(ctx *RefreshmatviewstmtContext) {} + +// EnterCreateseqstmt is called when production createseqstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateseqstmt(ctx *CreateseqstmtContext) {} + +// ExitCreateseqstmt is called when production createseqstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateseqstmt(ctx *CreateseqstmtContext) {} + +// EnterAlterseqstmt is called when production alterseqstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterseqstmt(ctx *AlterseqstmtContext) {} + +// ExitAlterseqstmt is called when production alterseqstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterseqstmt(ctx *AlterseqstmtContext) {} + +// EnterOptseqoptlist is called when production optseqoptlist is entered. +func (s *BasePostgreSQLParserListener) EnterOptseqoptlist(ctx *OptseqoptlistContext) {} + +// ExitOptseqoptlist is called when production optseqoptlist is exited. +func (s *BasePostgreSQLParserListener) ExitOptseqoptlist(ctx *OptseqoptlistContext) {} + +// EnterOptparenthesizedseqoptlist is called when production optparenthesizedseqoptlist is entered. +func (s *BasePostgreSQLParserListener) EnterOptparenthesizedseqoptlist(ctx *OptparenthesizedseqoptlistContext) { +} + +// ExitOptparenthesizedseqoptlist is called when production optparenthesizedseqoptlist is exited. +func (s *BasePostgreSQLParserListener) ExitOptparenthesizedseqoptlist(ctx *OptparenthesizedseqoptlistContext) { +} + +// EnterSeqoptlist is called when production seqoptlist is entered. +func (s *BasePostgreSQLParserListener) EnterSeqoptlist(ctx *SeqoptlistContext) {} + +// ExitSeqoptlist is called when production seqoptlist is exited. +func (s *BasePostgreSQLParserListener) ExitSeqoptlist(ctx *SeqoptlistContext) {} + +// EnterSeqoptelem is called when production seqoptelem is entered. +func (s *BasePostgreSQLParserListener) EnterSeqoptelem(ctx *SeqoptelemContext) {} + +// ExitSeqoptelem is called when production seqoptelem is exited. +func (s *BasePostgreSQLParserListener) ExitSeqoptelem(ctx *SeqoptelemContext) {} + +// EnterOpt_by is called when production opt_by is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_by(ctx *Opt_byContext) {} + +// ExitOpt_by is called when production opt_by is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_by(ctx *Opt_byContext) {} + +// EnterNumericonly is called when production numericonly is entered. +func (s *BasePostgreSQLParserListener) EnterNumericonly(ctx *NumericonlyContext) {} + +// ExitNumericonly is called when production numericonly is exited. +func (s *BasePostgreSQLParserListener) ExitNumericonly(ctx *NumericonlyContext) {} + +// EnterNumericonly_list is called when production numericonly_list is entered. +func (s *BasePostgreSQLParserListener) EnterNumericonly_list(ctx *Numericonly_listContext) {} + +// ExitNumericonly_list is called when production numericonly_list is exited. +func (s *BasePostgreSQLParserListener) ExitNumericonly_list(ctx *Numericonly_listContext) {} + +// EnterCreateplangstmt is called when production createplangstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateplangstmt(ctx *CreateplangstmtContext) {} + +// ExitCreateplangstmt is called when production createplangstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateplangstmt(ctx *CreateplangstmtContext) {} + +// EnterOpt_trusted is called when production opt_trusted is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_trusted(ctx *Opt_trustedContext) {} + +// ExitOpt_trusted is called when production opt_trusted is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_trusted(ctx *Opt_trustedContext) {} + +// EnterHandler_name is called when production handler_name is entered. +func (s *BasePostgreSQLParserListener) EnterHandler_name(ctx *Handler_nameContext) {} + +// ExitHandler_name is called when production handler_name is exited. +func (s *BasePostgreSQLParserListener) ExitHandler_name(ctx *Handler_nameContext) {} + +// EnterOpt_inline_handler is called when production opt_inline_handler is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_inline_handler(ctx *Opt_inline_handlerContext) {} + +// ExitOpt_inline_handler is called when production opt_inline_handler is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_inline_handler(ctx *Opt_inline_handlerContext) {} + +// EnterValidator_clause is called when production validator_clause is entered. +func (s *BasePostgreSQLParserListener) EnterValidator_clause(ctx *Validator_clauseContext) {} + +// ExitValidator_clause is called when production validator_clause is exited. +func (s *BasePostgreSQLParserListener) ExitValidator_clause(ctx *Validator_clauseContext) {} + +// EnterOpt_validator is called when production opt_validator is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_validator(ctx *Opt_validatorContext) {} + +// ExitOpt_validator is called when production opt_validator is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_validator(ctx *Opt_validatorContext) {} + +// EnterOpt_procedural is called when production opt_procedural is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_procedural(ctx *Opt_proceduralContext) {} + +// ExitOpt_procedural is called when production opt_procedural is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_procedural(ctx *Opt_proceduralContext) {} + +// EnterCreatetablespacestmt is called when production createtablespacestmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatetablespacestmt(ctx *CreatetablespacestmtContext) {} + +// ExitCreatetablespacestmt is called when production createtablespacestmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatetablespacestmt(ctx *CreatetablespacestmtContext) {} + +// EnterOpttablespaceowner is called when production opttablespaceowner is entered. +func (s *BasePostgreSQLParserListener) EnterOpttablespaceowner(ctx *OpttablespaceownerContext) {} + +// ExitOpttablespaceowner is called when production opttablespaceowner is exited. +func (s *BasePostgreSQLParserListener) ExitOpttablespaceowner(ctx *OpttablespaceownerContext) {} + +// EnterDroptablespacestmt is called when production droptablespacestmt is entered. +func (s *BasePostgreSQLParserListener) EnterDroptablespacestmt(ctx *DroptablespacestmtContext) {} + +// ExitDroptablespacestmt is called when production droptablespacestmt is exited. +func (s *BasePostgreSQLParserListener) ExitDroptablespacestmt(ctx *DroptablespacestmtContext) {} + +// EnterCreateextensionstmt is called when production createextensionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateextensionstmt(ctx *CreateextensionstmtContext) {} + +// ExitCreateextensionstmt is called when production createextensionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateextensionstmt(ctx *CreateextensionstmtContext) {} + +// EnterCreate_extension_opt_list is called when production create_extension_opt_list is entered. +func (s *BasePostgreSQLParserListener) EnterCreate_extension_opt_list(ctx *Create_extension_opt_listContext) { +} + +// ExitCreate_extension_opt_list is called when production create_extension_opt_list is exited. +func (s *BasePostgreSQLParserListener) ExitCreate_extension_opt_list(ctx *Create_extension_opt_listContext) { +} + +// EnterCreate_extension_opt_item is called when production create_extension_opt_item is entered. +func (s *BasePostgreSQLParserListener) EnterCreate_extension_opt_item(ctx *Create_extension_opt_itemContext) { +} + +// ExitCreate_extension_opt_item is called when production create_extension_opt_item is exited. +func (s *BasePostgreSQLParserListener) ExitCreate_extension_opt_item(ctx *Create_extension_opt_itemContext) { +} + +// EnterAlterextensionstmt is called when production alterextensionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterextensionstmt(ctx *AlterextensionstmtContext) {} + +// ExitAlterextensionstmt is called when production alterextensionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterextensionstmt(ctx *AlterextensionstmtContext) {} + +// EnterAlter_extension_opt_list is called when production alter_extension_opt_list is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_extension_opt_list(ctx *Alter_extension_opt_listContext) { +} + +// ExitAlter_extension_opt_list is called when production alter_extension_opt_list is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_extension_opt_list(ctx *Alter_extension_opt_listContext) { +} + +// EnterAlter_extension_opt_item is called when production alter_extension_opt_item is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_extension_opt_item(ctx *Alter_extension_opt_itemContext) { +} + +// ExitAlter_extension_opt_item is called when production alter_extension_opt_item is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_extension_opt_item(ctx *Alter_extension_opt_itemContext) { +} + +// EnterAlterextensioncontentsstmt is called when production alterextensioncontentsstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterextensioncontentsstmt(ctx *AlterextensioncontentsstmtContext) { +} + +// ExitAlterextensioncontentsstmt is called when production alterextensioncontentsstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterextensioncontentsstmt(ctx *AlterextensioncontentsstmtContext) { +} + +// EnterCreatefdwstmt is called when production createfdwstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatefdwstmt(ctx *CreatefdwstmtContext) {} + +// ExitCreatefdwstmt is called when production createfdwstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatefdwstmt(ctx *CreatefdwstmtContext) {} + +// EnterFdw_option is called when production fdw_option is entered. +func (s *BasePostgreSQLParserListener) EnterFdw_option(ctx *Fdw_optionContext) {} + +// ExitFdw_option is called when production fdw_option is exited. +func (s *BasePostgreSQLParserListener) ExitFdw_option(ctx *Fdw_optionContext) {} + +// EnterFdw_options is called when production fdw_options is entered. +func (s *BasePostgreSQLParserListener) EnterFdw_options(ctx *Fdw_optionsContext) {} + +// ExitFdw_options is called when production fdw_options is exited. +func (s *BasePostgreSQLParserListener) ExitFdw_options(ctx *Fdw_optionsContext) {} + +// EnterOpt_fdw_options is called when production opt_fdw_options is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_fdw_options(ctx *Opt_fdw_optionsContext) {} + +// ExitOpt_fdw_options is called when production opt_fdw_options is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_fdw_options(ctx *Opt_fdw_optionsContext) {} + +// EnterAlterfdwstmt is called when production alterfdwstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterfdwstmt(ctx *AlterfdwstmtContext) {} + +// ExitAlterfdwstmt is called when production alterfdwstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterfdwstmt(ctx *AlterfdwstmtContext) {} + +// EnterCreate_generic_options is called when production create_generic_options is entered. +func (s *BasePostgreSQLParserListener) EnterCreate_generic_options(ctx *Create_generic_optionsContext) { +} + +// ExitCreate_generic_options is called when production create_generic_options is exited. +func (s *BasePostgreSQLParserListener) ExitCreate_generic_options(ctx *Create_generic_optionsContext) { +} + +// EnterGeneric_option_list is called when production generic_option_list is entered. +func (s *BasePostgreSQLParserListener) EnterGeneric_option_list(ctx *Generic_option_listContext) {} + +// ExitGeneric_option_list is called when production generic_option_list is exited. +func (s *BasePostgreSQLParserListener) ExitGeneric_option_list(ctx *Generic_option_listContext) {} + +// EnterAlter_generic_options is called when production alter_generic_options is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_generic_options(ctx *Alter_generic_optionsContext) { +} + +// ExitAlter_generic_options is called when production alter_generic_options is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_generic_options(ctx *Alter_generic_optionsContext) {} + +// EnterAlter_generic_option_list is called when production alter_generic_option_list is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_generic_option_list(ctx *Alter_generic_option_listContext) { +} + +// ExitAlter_generic_option_list is called when production alter_generic_option_list is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_generic_option_list(ctx *Alter_generic_option_listContext) { +} + +// EnterAlter_generic_option_elem is called when production alter_generic_option_elem is entered. +func (s *BasePostgreSQLParserListener) EnterAlter_generic_option_elem(ctx *Alter_generic_option_elemContext) { +} + +// ExitAlter_generic_option_elem is called when production alter_generic_option_elem is exited. +func (s *BasePostgreSQLParserListener) ExitAlter_generic_option_elem(ctx *Alter_generic_option_elemContext) { +} + +// EnterGeneric_option_elem is called when production generic_option_elem is entered. +func (s *BasePostgreSQLParserListener) EnterGeneric_option_elem(ctx *Generic_option_elemContext) {} + +// ExitGeneric_option_elem is called when production generic_option_elem is exited. +func (s *BasePostgreSQLParserListener) ExitGeneric_option_elem(ctx *Generic_option_elemContext) {} + +// EnterGeneric_option_name is called when production generic_option_name is entered. +func (s *BasePostgreSQLParserListener) EnterGeneric_option_name(ctx *Generic_option_nameContext) {} + +// ExitGeneric_option_name is called when production generic_option_name is exited. +func (s *BasePostgreSQLParserListener) ExitGeneric_option_name(ctx *Generic_option_nameContext) {} + +// EnterGeneric_option_arg is called when production generic_option_arg is entered. +func (s *BasePostgreSQLParserListener) EnterGeneric_option_arg(ctx *Generic_option_argContext) {} + +// ExitGeneric_option_arg is called when production generic_option_arg is exited. +func (s *BasePostgreSQLParserListener) ExitGeneric_option_arg(ctx *Generic_option_argContext) {} + +// EnterCreateforeignserverstmt is called when production createforeignserverstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateforeignserverstmt(ctx *CreateforeignserverstmtContext) { +} + +// ExitCreateforeignserverstmt is called when production createforeignserverstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateforeignserverstmt(ctx *CreateforeignserverstmtContext) { +} + +// EnterOpt_type is called when production opt_type is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_type(ctx *Opt_typeContext) {} + +// ExitOpt_type is called when production opt_type is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_type(ctx *Opt_typeContext) {} + +// EnterForeign_server_version is called when production foreign_server_version is entered. +func (s *BasePostgreSQLParserListener) EnterForeign_server_version(ctx *Foreign_server_versionContext) { +} + +// ExitForeign_server_version is called when production foreign_server_version is exited. +func (s *BasePostgreSQLParserListener) ExitForeign_server_version(ctx *Foreign_server_versionContext) { +} + +// EnterOpt_foreign_server_version is called when production opt_foreign_server_version is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_foreign_server_version(ctx *Opt_foreign_server_versionContext) { +} + +// ExitOpt_foreign_server_version is called when production opt_foreign_server_version is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_foreign_server_version(ctx *Opt_foreign_server_versionContext) { +} + +// EnterAlterforeignserverstmt is called when production alterforeignserverstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterforeignserverstmt(ctx *AlterforeignserverstmtContext) { +} + +// ExitAlterforeignserverstmt is called when production alterforeignserverstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterforeignserverstmt(ctx *AlterforeignserverstmtContext) { +} + +// EnterCreateforeigntablestmt is called when production createforeigntablestmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateforeigntablestmt(ctx *CreateforeigntablestmtContext) { +} + +// ExitCreateforeigntablestmt is called when production createforeigntablestmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateforeigntablestmt(ctx *CreateforeigntablestmtContext) { +} + +// EnterImportforeignschemastmt is called when production importforeignschemastmt is entered. +func (s *BasePostgreSQLParserListener) EnterImportforeignschemastmt(ctx *ImportforeignschemastmtContext) { +} + +// ExitImportforeignschemastmt is called when production importforeignschemastmt is exited. +func (s *BasePostgreSQLParserListener) ExitImportforeignschemastmt(ctx *ImportforeignschemastmtContext) { +} + +// EnterImport_qualification_type is called when production import_qualification_type is entered. +func (s *BasePostgreSQLParserListener) EnterImport_qualification_type(ctx *Import_qualification_typeContext) { +} + +// ExitImport_qualification_type is called when production import_qualification_type is exited. +func (s *BasePostgreSQLParserListener) ExitImport_qualification_type(ctx *Import_qualification_typeContext) { +} + +// EnterImport_qualification is called when production import_qualification is entered. +func (s *BasePostgreSQLParserListener) EnterImport_qualification(ctx *Import_qualificationContext) {} + +// ExitImport_qualification is called when production import_qualification is exited. +func (s *BasePostgreSQLParserListener) ExitImport_qualification(ctx *Import_qualificationContext) {} + +// EnterCreateusermappingstmt is called when production createusermappingstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateusermappingstmt(ctx *CreateusermappingstmtContext) { +} + +// ExitCreateusermappingstmt is called when production createusermappingstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateusermappingstmt(ctx *CreateusermappingstmtContext) {} + +// EnterAuth_ident is called when production auth_ident is entered. +func (s *BasePostgreSQLParserListener) EnterAuth_ident(ctx *Auth_identContext) {} + +// ExitAuth_ident is called when production auth_ident is exited. +func (s *BasePostgreSQLParserListener) ExitAuth_ident(ctx *Auth_identContext) {} + +// EnterDropusermappingstmt is called when production dropusermappingstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDropusermappingstmt(ctx *DropusermappingstmtContext) {} + +// ExitDropusermappingstmt is called when production dropusermappingstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDropusermappingstmt(ctx *DropusermappingstmtContext) {} + +// EnterAlterusermappingstmt is called when production alterusermappingstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterusermappingstmt(ctx *AlterusermappingstmtContext) {} + +// ExitAlterusermappingstmt is called when production alterusermappingstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterusermappingstmt(ctx *AlterusermappingstmtContext) {} + +// EnterCreatepolicystmt is called when production createpolicystmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatepolicystmt(ctx *CreatepolicystmtContext) {} + +// ExitCreatepolicystmt is called when production createpolicystmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatepolicystmt(ctx *CreatepolicystmtContext) {} + +// EnterAlterpolicystmt is called when production alterpolicystmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterpolicystmt(ctx *AlterpolicystmtContext) {} + +// ExitAlterpolicystmt is called when production alterpolicystmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterpolicystmt(ctx *AlterpolicystmtContext) {} + +// EnterRowsecurityoptionalexpr is called when production rowsecurityoptionalexpr is entered. +func (s *BasePostgreSQLParserListener) EnterRowsecurityoptionalexpr(ctx *RowsecurityoptionalexprContext) { +} + +// ExitRowsecurityoptionalexpr is called when production rowsecurityoptionalexpr is exited. +func (s *BasePostgreSQLParserListener) ExitRowsecurityoptionalexpr(ctx *RowsecurityoptionalexprContext) { +} + +// EnterRowsecurityoptionalwithcheck is called when production rowsecurityoptionalwithcheck is entered. +func (s *BasePostgreSQLParserListener) EnterRowsecurityoptionalwithcheck(ctx *RowsecurityoptionalwithcheckContext) { +} + +// ExitRowsecurityoptionalwithcheck is called when production rowsecurityoptionalwithcheck is exited. +func (s *BasePostgreSQLParserListener) ExitRowsecurityoptionalwithcheck(ctx *RowsecurityoptionalwithcheckContext) { +} + +// EnterRowsecuritydefaulttorole is called when production rowsecuritydefaulttorole is entered. +func (s *BasePostgreSQLParserListener) EnterRowsecuritydefaulttorole(ctx *RowsecuritydefaulttoroleContext) { +} + +// ExitRowsecuritydefaulttorole is called when production rowsecuritydefaulttorole is exited. +func (s *BasePostgreSQLParserListener) ExitRowsecuritydefaulttorole(ctx *RowsecuritydefaulttoroleContext) { +} + +// EnterRowsecurityoptionaltorole is called when production rowsecurityoptionaltorole is entered. +func (s *BasePostgreSQLParserListener) EnterRowsecurityoptionaltorole(ctx *RowsecurityoptionaltoroleContext) { +} + +// ExitRowsecurityoptionaltorole is called when production rowsecurityoptionaltorole is exited. +func (s *BasePostgreSQLParserListener) ExitRowsecurityoptionaltorole(ctx *RowsecurityoptionaltoroleContext) { +} + +// EnterRowsecuritydefaultpermissive is called when production rowsecuritydefaultpermissive is entered. +func (s *BasePostgreSQLParserListener) EnterRowsecuritydefaultpermissive(ctx *RowsecuritydefaultpermissiveContext) { +} + +// ExitRowsecuritydefaultpermissive is called when production rowsecuritydefaultpermissive is exited. +func (s *BasePostgreSQLParserListener) ExitRowsecuritydefaultpermissive(ctx *RowsecuritydefaultpermissiveContext) { +} + +// EnterRowsecuritydefaultforcmd is called when production rowsecuritydefaultforcmd is entered. +func (s *BasePostgreSQLParserListener) EnterRowsecuritydefaultforcmd(ctx *RowsecuritydefaultforcmdContext) { +} + +// ExitRowsecuritydefaultforcmd is called when production rowsecuritydefaultforcmd is exited. +func (s *BasePostgreSQLParserListener) ExitRowsecuritydefaultforcmd(ctx *RowsecuritydefaultforcmdContext) { +} + +// EnterRow_security_cmd is called when production row_security_cmd is entered. +func (s *BasePostgreSQLParserListener) EnterRow_security_cmd(ctx *Row_security_cmdContext) {} + +// ExitRow_security_cmd is called when production row_security_cmd is exited. +func (s *BasePostgreSQLParserListener) ExitRow_security_cmd(ctx *Row_security_cmdContext) {} + +// EnterCreateamstmt is called when production createamstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateamstmt(ctx *CreateamstmtContext) {} + +// ExitCreateamstmt is called when production createamstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateamstmt(ctx *CreateamstmtContext) {} + +// EnterAm_type is called when production am_type is entered. +func (s *BasePostgreSQLParserListener) EnterAm_type(ctx *Am_typeContext) {} + +// ExitAm_type is called when production am_type is exited. +func (s *BasePostgreSQLParserListener) ExitAm_type(ctx *Am_typeContext) {} + +// EnterCreatetrigstmt is called when production createtrigstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatetrigstmt(ctx *CreatetrigstmtContext) {} + +// ExitCreatetrigstmt is called when production createtrigstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatetrigstmt(ctx *CreatetrigstmtContext) {} + +// EnterTriggeractiontime is called when production triggeractiontime is entered. +func (s *BasePostgreSQLParserListener) EnterTriggeractiontime(ctx *TriggeractiontimeContext) {} + +// ExitTriggeractiontime is called when production triggeractiontime is exited. +func (s *BasePostgreSQLParserListener) ExitTriggeractiontime(ctx *TriggeractiontimeContext) {} + +// EnterTriggerevents is called when production triggerevents is entered. +func (s *BasePostgreSQLParserListener) EnterTriggerevents(ctx *TriggereventsContext) {} + +// ExitTriggerevents is called when production triggerevents is exited. +func (s *BasePostgreSQLParserListener) ExitTriggerevents(ctx *TriggereventsContext) {} + +// EnterTriggeroneevent is called when production triggeroneevent is entered. +func (s *BasePostgreSQLParserListener) EnterTriggeroneevent(ctx *TriggeroneeventContext) {} + +// ExitTriggeroneevent is called when production triggeroneevent is exited. +func (s *BasePostgreSQLParserListener) ExitTriggeroneevent(ctx *TriggeroneeventContext) {} + +// EnterTriggerreferencing is called when production triggerreferencing is entered. +func (s *BasePostgreSQLParserListener) EnterTriggerreferencing(ctx *TriggerreferencingContext) {} + +// ExitTriggerreferencing is called when production triggerreferencing is exited. +func (s *BasePostgreSQLParserListener) ExitTriggerreferencing(ctx *TriggerreferencingContext) {} + +// EnterTriggertransitions is called when production triggertransitions is entered. +func (s *BasePostgreSQLParserListener) EnterTriggertransitions(ctx *TriggertransitionsContext) {} + +// ExitTriggertransitions is called when production triggertransitions is exited. +func (s *BasePostgreSQLParserListener) ExitTriggertransitions(ctx *TriggertransitionsContext) {} + +// EnterTriggertransition is called when production triggertransition is entered. +func (s *BasePostgreSQLParserListener) EnterTriggertransition(ctx *TriggertransitionContext) {} + +// ExitTriggertransition is called when production triggertransition is exited. +func (s *BasePostgreSQLParserListener) ExitTriggertransition(ctx *TriggertransitionContext) {} + +// EnterTransitionoldornew is called when production transitionoldornew is entered. +func (s *BasePostgreSQLParserListener) EnterTransitionoldornew(ctx *TransitionoldornewContext) {} + +// ExitTransitionoldornew is called when production transitionoldornew is exited. +func (s *BasePostgreSQLParserListener) ExitTransitionoldornew(ctx *TransitionoldornewContext) {} + +// EnterTransitionrowortable is called when production transitionrowortable is entered. +func (s *BasePostgreSQLParserListener) EnterTransitionrowortable(ctx *TransitionrowortableContext) {} + +// ExitTransitionrowortable is called when production transitionrowortable is exited. +func (s *BasePostgreSQLParserListener) ExitTransitionrowortable(ctx *TransitionrowortableContext) {} + +// EnterTransitionrelname is called when production transitionrelname is entered. +func (s *BasePostgreSQLParserListener) EnterTransitionrelname(ctx *TransitionrelnameContext) {} + +// ExitTransitionrelname is called when production transitionrelname is exited. +func (s *BasePostgreSQLParserListener) ExitTransitionrelname(ctx *TransitionrelnameContext) {} + +// EnterTriggerforspec is called when production triggerforspec is entered. +func (s *BasePostgreSQLParserListener) EnterTriggerforspec(ctx *TriggerforspecContext) {} + +// ExitTriggerforspec is called when production triggerforspec is exited. +func (s *BasePostgreSQLParserListener) ExitTriggerforspec(ctx *TriggerforspecContext) {} + +// EnterTriggerforopteach is called when production triggerforopteach is entered. +func (s *BasePostgreSQLParserListener) EnterTriggerforopteach(ctx *TriggerforopteachContext) {} + +// ExitTriggerforopteach is called when production triggerforopteach is exited. +func (s *BasePostgreSQLParserListener) ExitTriggerforopteach(ctx *TriggerforopteachContext) {} + +// EnterTriggerfortype is called when production triggerfortype is entered. +func (s *BasePostgreSQLParserListener) EnterTriggerfortype(ctx *TriggerfortypeContext) {} + +// ExitTriggerfortype is called when production triggerfortype is exited. +func (s *BasePostgreSQLParserListener) ExitTriggerfortype(ctx *TriggerfortypeContext) {} + +// EnterTriggerwhen is called when production triggerwhen is entered. +func (s *BasePostgreSQLParserListener) EnterTriggerwhen(ctx *TriggerwhenContext) {} + +// ExitTriggerwhen is called when production triggerwhen is exited. +func (s *BasePostgreSQLParserListener) ExitTriggerwhen(ctx *TriggerwhenContext) {} + +// EnterFunction_or_procedure is called when production function_or_procedure is entered. +func (s *BasePostgreSQLParserListener) EnterFunction_or_procedure(ctx *Function_or_procedureContext) { +} + +// ExitFunction_or_procedure is called when production function_or_procedure is exited. +func (s *BasePostgreSQLParserListener) ExitFunction_or_procedure(ctx *Function_or_procedureContext) {} + +// EnterTriggerfuncargs is called when production triggerfuncargs is entered. +func (s *BasePostgreSQLParserListener) EnterTriggerfuncargs(ctx *TriggerfuncargsContext) {} + +// ExitTriggerfuncargs is called when production triggerfuncargs is exited. +func (s *BasePostgreSQLParserListener) ExitTriggerfuncargs(ctx *TriggerfuncargsContext) {} + +// EnterTriggerfuncarg is called when production triggerfuncarg is entered. +func (s *BasePostgreSQLParserListener) EnterTriggerfuncarg(ctx *TriggerfuncargContext) {} + +// ExitTriggerfuncarg is called when production triggerfuncarg is exited. +func (s *BasePostgreSQLParserListener) ExitTriggerfuncarg(ctx *TriggerfuncargContext) {} + +// EnterOptconstrfromtable is called when production optconstrfromtable is entered. +func (s *BasePostgreSQLParserListener) EnterOptconstrfromtable(ctx *OptconstrfromtableContext) {} + +// ExitOptconstrfromtable is called when production optconstrfromtable is exited. +func (s *BasePostgreSQLParserListener) ExitOptconstrfromtable(ctx *OptconstrfromtableContext) {} + +// EnterConstraintattributespec is called when production constraintattributespec is entered. +func (s *BasePostgreSQLParserListener) EnterConstraintattributespec(ctx *ConstraintattributespecContext) { +} + +// ExitConstraintattributespec is called when production constraintattributespec is exited. +func (s *BasePostgreSQLParserListener) ExitConstraintattributespec(ctx *ConstraintattributespecContext) { +} + +// EnterConstraintattributeElem is called when production constraintattributeElem is entered. +func (s *BasePostgreSQLParserListener) EnterConstraintattributeElem(ctx *ConstraintattributeElemContext) { +} + +// ExitConstraintattributeElem is called when production constraintattributeElem is exited. +func (s *BasePostgreSQLParserListener) ExitConstraintattributeElem(ctx *ConstraintattributeElemContext) { +} + +// EnterCreateeventtrigstmt is called when production createeventtrigstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateeventtrigstmt(ctx *CreateeventtrigstmtContext) {} + +// ExitCreateeventtrigstmt is called when production createeventtrigstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateeventtrigstmt(ctx *CreateeventtrigstmtContext) {} + +// EnterEvent_trigger_when_list is called when production event_trigger_when_list is entered. +func (s *BasePostgreSQLParserListener) EnterEvent_trigger_when_list(ctx *Event_trigger_when_listContext) { +} + +// ExitEvent_trigger_when_list is called when production event_trigger_when_list is exited. +func (s *BasePostgreSQLParserListener) ExitEvent_trigger_when_list(ctx *Event_trigger_when_listContext) { +} + +// EnterEvent_trigger_when_item is called when production event_trigger_when_item is entered. +func (s *BasePostgreSQLParserListener) EnterEvent_trigger_when_item(ctx *Event_trigger_when_itemContext) { +} + +// ExitEvent_trigger_when_item is called when production event_trigger_when_item is exited. +func (s *BasePostgreSQLParserListener) ExitEvent_trigger_when_item(ctx *Event_trigger_when_itemContext) { +} + +// EnterEvent_trigger_value_list is called when production event_trigger_value_list is entered. +func (s *BasePostgreSQLParserListener) EnterEvent_trigger_value_list(ctx *Event_trigger_value_listContext) { +} + +// ExitEvent_trigger_value_list is called when production event_trigger_value_list is exited. +func (s *BasePostgreSQLParserListener) ExitEvent_trigger_value_list(ctx *Event_trigger_value_listContext) { +} + +// EnterAltereventtrigstmt is called when production altereventtrigstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltereventtrigstmt(ctx *AltereventtrigstmtContext) {} + +// ExitAltereventtrigstmt is called when production altereventtrigstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltereventtrigstmt(ctx *AltereventtrigstmtContext) {} + +// EnterEnable_trigger is called when production enable_trigger is entered. +func (s *BasePostgreSQLParserListener) EnterEnable_trigger(ctx *Enable_triggerContext) {} + +// ExitEnable_trigger is called when production enable_trigger is exited. +func (s *BasePostgreSQLParserListener) ExitEnable_trigger(ctx *Enable_triggerContext) {} + +// EnterCreateassertionstmt is called when production createassertionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateassertionstmt(ctx *CreateassertionstmtContext) {} + +// ExitCreateassertionstmt is called when production createassertionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateassertionstmt(ctx *CreateassertionstmtContext) {} + +// EnterDefinestmt is called when production definestmt is entered. +func (s *BasePostgreSQLParserListener) EnterDefinestmt(ctx *DefinestmtContext) {} + +// ExitDefinestmt is called when production definestmt is exited. +func (s *BasePostgreSQLParserListener) ExitDefinestmt(ctx *DefinestmtContext) {} + +// EnterDefinition is called when production definition is entered. +func (s *BasePostgreSQLParserListener) EnterDefinition(ctx *DefinitionContext) {} + +// ExitDefinition is called when production definition is exited. +func (s *BasePostgreSQLParserListener) ExitDefinition(ctx *DefinitionContext) {} + +// EnterDef_list is called when production def_list is entered. +func (s *BasePostgreSQLParserListener) EnterDef_list(ctx *Def_listContext) {} + +// ExitDef_list is called when production def_list is exited. +func (s *BasePostgreSQLParserListener) ExitDef_list(ctx *Def_listContext) {} + +// EnterDef_elem is called when production def_elem is entered. +func (s *BasePostgreSQLParserListener) EnterDef_elem(ctx *Def_elemContext) {} + +// ExitDef_elem is called when production def_elem is exited. +func (s *BasePostgreSQLParserListener) ExitDef_elem(ctx *Def_elemContext) {} + +// EnterDef_arg is called when production def_arg is entered. +func (s *BasePostgreSQLParserListener) EnterDef_arg(ctx *Def_argContext) {} + +// ExitDef_arg is called when production def_arg is exited. +func (s *BasePostgreSQLParserListener) ExitDef_arg(ctx *Def_argContext) {} + +// EnterOld_aggr_definition is called when production old_aggr_definition is entered. +func (s *BasePostgreSQLParserListener) EnterOld_aggr_definition(ctx *Old_aggr_definitionContext) {} + +// ExitOld_aggr_definition is called when production old_aggr_definition is exited. +func (s *BasePostgreSQLParserListener) ExitOld_aggr_definition(ctx *Old_aggr_definitionContext) {} + +// EnterOld_aggr_list is called when production old_aggr_list is entered. +func (s *BasePostgreSQLParserListener) EnterOld_aggr_list(ctx *Old_aggr_listContext) {} + +// ExitOld_aggr_list is called when production old_aggr_list is exited. +func (s *BasePostgreSQLParserListener) ExitOld_aggr_list(ctx *Old_aggr_listContext) {} + +// EnterOld_aggr_elem is called when production old_aggr_elem is entered. +func (s *BasePostgreSQLParserListener) EnterOld_aggr_elem(ctx *Old_aggr_elemContext) {} + +// ExitOld_aggr_elem is called when production old_aggr_elem is exited. +func (s *BasePostgreSQLParserListener) ExitOld_aggr_elem(ctx *Old_aggr_elemContext) {} + +// EnterOpt_enum_val_list is called when production opt_enum_val_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_enum_val_list(ctx *Opt_enum_val_listContext) {} + +// ExitOpt_enum_val_list is called when production opt_enum_val_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_enum_val_list(ctx *Opt_enum_val_listContext) {} + +// EnterEnum_val_list is called when production enum_val_list is entered. +func (s *BasePostgreSQLParserListener) EnterEnum_val_list(ctx *Enum_val_listContext) {} + +// ExitEnum_val_list is called when production enum_val_list is exited. +func (s *BasePostgreSQLParserListener) ExitEnum_val_list(ctx *Enum_val_listContext) {} + +// EnterAlterenumstmt is called when production alterenumstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterenumstmt(ctx *AlterenumstmtContext) {} + +// ExitAlterenumstmt is called when production alterenumstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterenumstmt(ctx *AlterenumstmtContext) {} + +// EnterOpt_if_not_exists is called when production opt_if_not_exists is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_if_not_exists(ctx *Opt_if_not_existsContext) {} + +// ExitOpt_if_not_exists is called when production opt_if_not_exists is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_if_not_exists(ctx *Opt_if_not_existsContext) {} + +// EnterCreateopclassstmt is called when production createopclassstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateopclassstmt(ctx *CreateopclassstmtContext) {} + +// ExitCreateopclassstmt is called when production createopclassstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateopclassstmt(ctx *CreateopclassstmtContext) {} + +// EnterOpclass_item_list is called when production opclass_item_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpclass_item_list(ctx *Opclass_item_listContext) {} + +// ExitOpclass_item_list is called when production opclass_item_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpclass_item_list(ctx *Opclass_item_listContext) {} + +// EnterOpclass_item is called when production opclass_item is entered. +func (s *BasePostgreSQLParserListener) EnterOpclass_item(ctx *Opclass_itemContext) {} + +// ExitOpclass_item is called when production opclass_item is exited. +func (s *BasePostgreSQLParserListener) ExitOpclass_item(ctx *Opclass_itemContext) {} + +// EnterOpt_default is called when production opt_default is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_default(ctx *Opt_defaultContext) {} + +// ExitOpt_default is called when production opt_default is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_default(ctx *Opt_defaultContext) {} + +// EnterOpt_opfamily is called when production opt_opfamily is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_opfamily(ctx *Opt_opfamilyContext) {} + +// ExitOpt_opfamily is called when production opt_opfamily is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_opfamily(ctx *Opt_opfamilyContext) {} + +// EnterOpclass_purpose is called when production opclass_purpose is entered. +func (s *BasePostgreSQLParserListener) EnterOpclass_purpose(ctx *Opclass_purposeContext) {} + +// ExitOpclass_purpose is called when production opclass_purpose is exited. +func (s *BasePostgreSQLParserListener) ExitOpclass_purpose(ctx *Opclass_purposeContext) {} + +// EnterOpt_recheck is called when production opt_recheck is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_recheck(ctx *Opt_recheckContext) {} + +// ExitOpt_recheck is called when production opt_recheck is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_recheck(ctx *Opt_recheckContext) {} + +// EnterCreateopfamilystmt is called when production createopfamilystmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateopfamilystmt(ctx *CreateopfamilystmtContext) {} + +// ExitCreateopfamilystmt is called when production createopfamilystmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateopfamilystmt(ctx *CreateopfamilystmtContext) {} + +// EnterAlteropfamilystmt is called when production alteropfamilystmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlteropfamilystmt(ctx *AlteropfamilystmtContext) {} + +// ExitAlteropfamilystmt is called when production alteropfamilystmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlteropfamilystmt(ctx *AlteropfamilystmtContext) {} + +// EnterOpclass_drop_list is called when production opclass_drop_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpclass_drop_list(ctx *Opclass_drop_listContext) {} + +// ExitOpclass_drop_list is called when production opclass_drop_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpclass_drop_list(ctx *Opclass_drop_listContext) {} + +// EnterOpclass_drop is called when production opclass_drop is entered. +func (s *BasePostgreSQLParserListener) EnterOpclass_drop(ctx *Opclass_dropContext) {} + +// ExitOpclass_drop is called when production opclass_drop is exited. +func (s *BasePostgreSQLParserListener) ExitOpclass_drop(ctx *Opclass_dropContext) {} + +// EnterDropopclassstmt is called when production dropopclassstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDropopclassstmt(ctx *DropopclassstmtContext) {} + +// ExitDropopclassstmt is called when production dropopclassstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDropopclassstmt(ctx *DropopclassstmtContext) {} + +// EnterDropopfamilystmt is called when production dropopfamilystmt is entered. +func (s *BasePostgreSQLParserListener) EnterDropopfamilystmt(ctx *DropopfamilystmtContext) {} + +// ExitDropopfamilystmt is called when production dropopfamilystmt is exited. +func (s *BasePostgreSQLParserListener) ExitDropopfamilystmt(ctx *DropopfamilystmtContext) {} + +// EnterDropownedstmt is called when production dropownedstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDropownedstmt(ctx *DropownedstmtContext) {} + +// ExitDropownedstmt is called when production dropownedstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDropownedstmt(ctx *DropownedstmtContext) {} + +// EnterReassignownedstmt is called when production reassignownedstmt is entered. +func (s *BasePostgreSQLParserListener) EnterReassignownedstmt(ctx *ReassignownedstmtContext) {} + +// ExitReassignownedstmt is called when production reassignownedstmt is exited. +func (s *BasePostgreSQLParserListener) ExitReassignownedstmt(ctx *ReassignownedstmtContext) {} + +// EnterDropstmt is called when production dropstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDropstmt(ctx *DropstmtContext) {} + +// ExitDropstmt is called when production dropstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDropstmt(ctx *DropstmtContext) {} + +// EnterObject_type_any_name is called when production object_type_any_name is entered. +func (s *BasePostgreSQLParserListener) EnterObject_type_any_name(ctx *Object_type_any_nameContext) {} + +// ExitObject_type_any_name is called when production object_type_any_name is exited. +func (s *BasePostgreSQLParserListener) ExitObject_type_any_name(ctx *Object_type_any_nameContext) {} + +// EnterObject_type_name is called when production object_type_name is entered. +func (s *BasePostgreSQLParserListener) EnterObject_type_name(ctx *Object_type_nameContext) {} + +// ExitObject_type_name is called when production object_type_name is exited. +func (s *BasePostgreSQLParserListener) ExitObject_type_name(ctx *Object_type_nameContext) {} + +// EnterDrop_type_name is called when production drop_type_name is entered. +func (s *BasePostgreSQLParserListener) EnterDrop_type_name(ctx *Drop_type_nameContext) {} + +// ExitDrop_type_name is called when production drop_type_name is exited. +func (s *BasePostgreSQLParserListener) ExitDrop_type_name(ctx *Drop_type_nameContext) {} + +// EnterObject_type_name_on_any_name is called when production object_type_name_on_any_name is entered. +func (s *BasePostgreSQLParserListener) EnterObject_type_name_on_any_name(ctx *Object_type_name_on_any_nameContext) { +} + +// ExitObject_type_name_on_any_name is called when production object_type_name_on_any_name is exited. +func (s *BasePostgreSQLParserListener) ExitObject_type_name_on_any_name(ctx *Object_type_name_on_any_nameContext) { +} + +// EnterAny_name_list is called when production any_name_list is entered. +func (s *BasePostgreSQLParserListener) EnterAny_name_list(ctx *Any_name_listContext) {} + +// ExitAny_name_list is called when production any_name_list is exited. +func (s *BasePostgreSQLParserListener) ExitAny_name_list(ctx *Any_name_listContext) {} + +// EnterAny_name is called when production any_name is entered. +func (s *BasePostgreSQLParserListener) EnterAny_name(ctx *Any_nameContext) {} + +// ExitAny_name is called when production any_name is exited. +func (s *BasePostgreSQLParserListener) ExitAny_name(ctx *Any_nameContext) {} + +// EnterAttrs is called when production attrs is entered. +func (s *BasePostgreSQLParserListener) EnterAttrs(ctx *AttrsContext) {} + +// ExitAttrs is called when production attrs is exited. +func (s *BasePostgreSQLParserListener) ExitAttrs(ctx *AttrsContext) {} + +// EnterType_name_list is called when production type_name_list is entered. +func (s *BasePostgreSQLParserListener) EnterType_name_list(ctx *Type_name_listContext) {} + +// ExitType_name_list is called when production type_name_list is exited. +func (s *BasePostgreSQLParserListener) ExitType_name_list(ctx *Type_name_listContext) {} + +// EnterTruncatestmt is called when production truncatestmt is entered. +func (s *BasePostgreSQLParserListener) EnterTruncatestmt(ctx *TruncatestmtContext) {} + +// ExitTruncatestmt is called when production truncatestmt is exited. +func (s *BasePostgreSQLParserListener) ExitTruncatestmt(ctx *TruncatestmtContext) {} + +// EnterOpt_restart_seqs is called when production opt_restart_seqs is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_restart_seqs(ctx *Opt_restart_seqsContext) {} + +// ExitOpt_restart_seqs is called when production opt_restart_seqs is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_restart_seqs(ctx *Opt_restart_seqsContext) {} + +// EnterCommentstmt is called when production commentstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCommentstmt(ctx *CommentstmtContext) {} + +// ExitCommentstmt is called when production commentstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCommentstmt(ctx *CommentstmtContext) {} + +// EnterComment_text is called when production comment_text is entered. +func (s *BasePostgreSQLParserListener) EnterComment_text(ctx *Comment_textContext) {} + +// ExitComment_text is called when production comment_text is exited. +func (s *BasePostgreSQLParserListener) ExitComment_text(ctx *Comment_textContext) {} + +// EnterSeclabelstmt is called when production seclabelstmt is entered. +func (s *BasePostgreSQLParserListener) EnterSeclabelstmt(ctx *SeclabelstmtContext) {} + +// ExitSeclabelstmt is called when production seclabelstmt is exited. +func (s *BasePostgreSQLParserListener) ExitSeclabelstmt(ctx *SeclabelstmtContext) {} + +// EnterOpt_provider is called when production opt_provider is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_provider(ctx *Opt_providerContext) {} + +// ExitOpt_provider is called when production opt_provider is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_provider(ctx *Opt_providerContext) {} + +// EnterSecurity_label is called when production security_label is entered. +func (s *BasePostgreSQLParserListener) EnterSecurity_label(ctx *Security_labelContext) {} + +// ExitSecurity_label is called when production security_label is exited. +func (s *BasePostgreSQLParserListener) ExitSecurity_label(ctx *Security_labelContext) {} + +// EnterFetchstmt is called when production fetchstmt is entered. +func (s *BasePostgreSQLParserListener) EnterFetchstmt(ctx *FetchstmtContext) {} + +// ExitFetchstmt is called when production fetchstmt is exited. +func (s *BasePostgreSQLParserListener) ExitFetchstmt(ctx *FetchstmtContext) {} + +// EnterFetch_args is called when production fetch_args is entered. +func (s *BasePostgreSQLParserListener) EnterFetch_args(ctx *Fetch_argsContext) {} + +// ExitFetch_args is called when production fetch_args is exited. +func (s *BasePostgreSQLParserListener) ExitFetch_args(ctx *Fetch_argsContext) {} + +// EnterFrom_in is called when production from_in is entered. +func (s *BasePostgreSQLParserListener) EnterFrom_in(ctx *From_inContext) {} + +// ExitFrom_in is called when production from_in is exited. +func (s *BasePostgreSQLParserListener) ExitFrom_in(ctx *From_inContext) {} + +// EnterOpt_from_in is called when production opt_from_in is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_from_in(ctx *Opt_from_inContext) {} + +// ExitOpt_from_in is called when production opt_from_in is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_from_in(ctx *Opt_from_inContext) {} + +// EnterGrantstmt is called when production grantstmt is entered. +func (s *BasePostgreSQLParserListener) EnterGrantstmt(ctx *GrantstmtContext) {} + +// ExitGrantstmt is called when production grantstmt is exited. +func (s *BasePostgreSQLParserListener) ExitGrantstmt(ctx *GrantstmtContext) {} + +// EnterRevokestmt is called when production revokestmt is entered. +func (s *BasePostgreSQLParserListener) EnterRevokestmt(ctx *RevokestmtContext) {} + +// ExitRevokestmt is called when production revokestmt is exited. +func (s *BasePostgreSQLParserListener) ExitRevokestmt(ctx *RevokestmtContext) {} + +// EnterPrivileges is called when production privileges is entered. +func (s *BasePostgreSQLParserListener) EnterPrivileges(ctx *PrivilegesContext) {} + +// ExitPrivileges is called when production privileges is exited. +func (s *BasePostgreSQLParserListener) ExitPrivileges(ctx *PrivilegesContext) {} + +// EnterPrivilege_list is called when production privilege_list is entered. +func (s *BasePostgreSQLParserListener) EnterPrivilege_list(ctx *Privilege_listContext) {} + +// ExitPrivilege_list is called when production privilege_list is exited. +func (s *BasePostgreSQLParserListener) ExitPrivilege_list(ctx *Privilege_listContext) {} + +// EnterPrivilege is called when production privilege is entered. +func (s *BasePostgreSQLParserListener) EnterPrivilege(ctx *PrivilegeContext) {} + +// ExitPrivilege is called when production privilege is exited. +func (s *BasePostgreSQLParserListener) ExitPrivilege(ctx *PrivilegeContext) {} + +// EnterPrivilege_target is called when production privilege_target is entered. +func (s *BasePostgreSQLParserListener) EnterPrivilege_target(ctx *Privilege_targetContext) {} + +// ExitPrivilege_target is called when production privilege_target is exited. +func (s *BasePostgreSQLParserListener) ExitPrivilege_target(ctx *Privilege_targetContext) {} + +// EnterParameter_name_list is called when production parameter_name_list is entered. +func (s *BasePostgreSQLParserListener) EnterParameter_name_list(ctx *Parameter_name_listContext) {} + +// ExitParameter_name_list is called when production parameter_name_list is exited. +func (s *BasePostgreSQLParserListener) ExitParameter_name_list(ctx *Parameter_name_listContext) {} + +// EnterParameter_name is called when production parameter_name is entered. +func (s *BasePostgreSQLParserListener) EnterParameter_name(ctx *Parameter_nameContext) {} + +// ExitParameter_name is called when production parameter_name is exited. +func (s *BasePostgreSQLParserListener) ExitParameter_name(ctx *Parameter_nameContext) {} + +// EnterGrantee_list is called when production grantee_list is entered. +func (s *BasePostgreSQLParserListener) EnterGrantee_list(ctx *Grantee_listContext) {} + +// ExitGrantee_list is called when production grantee_list is exited. +func (s *BasePostgreSQLParserListener) ExitGrantee_list(ctx *Grantee_listContext) {} + +// EnterGrantee is called when production grantee is entered. +func (s *BasePostgreSQLParserListener) EnterGrantee(ctx *GranteeContext) {} + +// ExitGrantee is called when production grantee is exited. +func (s *BasePostgreSQLParserListener) ExitGrantee(ctx *GranteeContext) {} + +// EnterOpt_grant_grant_option is called when production opt_grant_grant_option is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_grant_grant_option(ctx *Opt_grant_grant_optionContext) { +} + +// ExitOpt_grant_grant_option is called when production opt_grant_grant_option is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_grant_grant_option(ctx *Opt_grant_grant_optionContext) { +} + +// EnterGrantrolestmt is called when production grantrolestmt is entered. +func (s *BasePostgreSQLParserListener) EnterGrantrolestmt(ctx *GrantrolestmtContext) {} + +// ExitGrantrolestmt is called when production grantrolestmt is exited. +func (s *BasePostgreSQLParserListener) ExitGrantrolestmt(ctx *GrantrolestmtContext) {} + +// EnterRevokerolestmt is called when production revokerolestmt is entered. +func (s *BasePostgreSQLParserListener) EnterRevokerolestmt(ctx *RevokerolestmtContext) {} + +// ExitRevokerolestmt is called when production revokerolestmt is exited. +func (s *BasePostgreSQLParserListener) ExitRevokerolestmt(ctx *RevokerolestmtContext) {} + +// EnterOpt_grant_admin_option is called when production opt_grant_admin_option is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_grant_admin_option(ctx *Opt_grant_admin_optionContext) { +} + +// ExitOpt_grant_admin_option is called when production opt_grant_admin_option is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_grant_admin_option(ctx *Opt_grant_admin_optionContext) { +} + +// EnterOpt_granted_by is called when production opt_granted_by is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_granted_by(ctx *Opt_granted_byContext) {} + +// ExitOpt_granted_by is called when production opt_granted_by is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_granted_by(ctx *Opt_granted_byContext) {} + +// EnterAlterdefaultprivilegesstmt is called when production alterdefaultprivilegesstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterdefaultprivilegesstmt(ctx *AlterdefaultprivilegesstmtContext) { +} + +// ExitAlterdefaultprivilegesstmt is called when production alterdefaultprivilegesstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterdefaultprivilegesstmt(ctx *AlterdefaultprivilegesstmtContext) { +} + +// EnterDefacloptionlist is called when production defacloptionlist is entered. +func (s *BasePostgreSQLParserListener) EnterDefacloptionlist(ctx *DefacloptionlistContext) {} + +// ExitDefacloptionlist is called when production defacloptionlist is exited. +func (s *BasePostgreSQLParserListener) ExitDefacloptionlist(ctx *DefacloptionlistContext) {} + +// EnterDefacloption is called when production defacloption is entered. +func (s *BasePostgreSQLParserListener) EnterDefacloption(ctx *DefacloptionContext) {} + +// ExitDefacloption is called when production defacloption is exited. +func (s *BasePostgreSQLParserListener) ExitDefacloption(ctx *DefacloptionContext) {} + +// EnterDefaclaction is called when production defaclaction is entered. +func (s *BasePostgreSQLParserListener) EnterDefaclaction(ctx *DefaclactionContext) {} + +// ExitDefaclaction is called when production defaclaction is exited. +func (s *BasePostgreSQLParserListener) ExitDefaclaction(ctx *DefaclactionContext) {} + +// EnterDefacl_privilege_target is called when production defacl_privilege_target is entered. +func (s *BasePostgreSQLParserListener) EnterDefacl_privilege_target(ctx *Defacl_privilege_targetContext) { +} + +// ExitDefacl_privilege_target is called when production defacl_privilege_target is exited. +func (s *BasePostgreSQLParserListener) ExitDefacl_privilege_target(ctx *Defacl_privilege_targetContext) { +} + +// EnterIndexstmt is called when production indexstmt is entered. +func (s *BasePostgreSQLParserListener) EnterIndexstmt(ctx *IndexstmtContext) {} + +// ExitIndexstmt is called when production indexstmt is exited. +func (s *BasePostgreSQLParserListener) ExitIndexstmt(ctx *IndexstmtContext) {} + +// EnterOpt_unique is called when production opt_unique is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_unique(ctx *Opt_uniqueContext) {} + +// ExitOpt_unique is called when production opt_unique is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_unique(ctx *Opt_uniqueContext) {} + +// EnterOpt_concurrently is called when production opt_concurrently is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_concurrently(ctx *Opt_concurrentlyContext) {} + +// ExitOpt_concurrently is called when production opt_concurrently is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_concurrently(ctx *Opt_concurrentlyContext) {} + +// EnterOpt_index_name is called when production opt_index_name is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_index_name(ctx *Opt_index_nameContext) {} + +// ExitOpt_index_name is called when production opt_index_name is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_index_name(ctx *Opt_index_nameContext) {} + +// EnterAccess_method_clause is called when production access_method_clause is entered. +func (s *BasePostgreSQLParserListener) EnterAccess_method_clause(ctx *Access_method_clauseContext) {} + +// ExitAccess_method_clause is called when production access_method_clause is exited. +func (s *BasePostgreSQLParserListener) ExitAccess_method_clause(ctx *Access_method_clauseContext) {} + +// EnterIndex_params is called when production index_params is entered. +func (s *BasePostgreSQLParserListener) EnterIndex_params(ctx *Index_paramsContext) {} + +// ExitIndex_params is called when production index_params is exited. +func (s *BasePostgreSQLParserListener) ExitIndex_params(ctx *Index_paramsContext) {} + +// EnterIndex_elem_options is called when production index_elem_options is entered. +func (s *BasePostgreSQLParserListener) EnterIndex_elem_options(ctx *Index_elem_optionsContext) {} + +// ExitIndex_elem_options is called when production index_elem_options is exited. +func (s *BasePostgreSQLParserListener) ExitIndex_elem_options(ctx *Index_elem_optionsContext) {} + +// EnterIndex_elem is called when production index_elem is entered. +func (s *BasePostgreSQLParserListener) EnterIndex_elem(ctx *Index_elemContext) {} + +// ExitIndex_elem is called when production index_elem is exited. +func (s *BasePostgreSQLParserListener) ExitIndex_elem(ctx *Index_elemContext) {} + +// EnterOpt_include is called when production opt_include is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_include(ctx *Opt_includeContext) {} + +// ExitOpt_include is called when production opt_include is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_include(ctx *Opt_includeContext) {} + +// EnterIndex_including_params is called when production index_including_params is entered. +func (s *BasePostgreSQLParserListener) EnterIndex_including_params(ctx *Index_including_paramsContext) { +} + +// ExitIndex_including_params is called when production index_including_params is exited. +func (s *BasePostgreSQLParserListener) ExitIndex_including_params(ctx *Index_including_paramsContext) { +} + +// EnterOpt_collate is called when production opt_collate is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_collate(ctx *Opt_collateContext) {} + +// ExitOpt_collate is called when production opt_collate is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_collate(ctx *Opt_collateContext) {} + +// EnterOpt_class is called when production opt_class is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_class(ctx *Opt_classContext) {} + +// ExitOpt_class is called when production opt_class is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_class(ctx *Opt_classContext) {} + +// EnterOpt_asc_desc is called when production opt_asc_desc is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_asc_desc(ctx *Opt_asc_descContext) {} + +// ExitOpt_asc_desc is called when production opt_asc_desc is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_asc_desc(ctx *Opt_asc_descContext) {} + +// EnterOpt_nulls_order is called when production opt_nulls_order is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_nulls_order(ctx *Opt_nulls_orderContext) {} + +// ExitOpt_nulls_order is called when production opt_nulls_order is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_nulls_order(ctx *Opt_nulls_orderContext) {} + +// EnterCreatefunctionstmt is called when production createfunctionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatefunctionstmt(ctx *CreatefunctionstmtContext) {} + +// ExitCreatefunctionstmt is called when production createfunctionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatefunctionstmt(ctx *CreatefunctionstmtContext) {} + +// EnterOpt_or_replace is called when production opt_or_replace is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_or_replace(ctx *Opt_or_replaceContext) {} + +// ExitOpt_or_replace is called when production opt_or_replace is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_or_replace(ctx *Opt_or_replaceContext) {} + +// EnterFunc_args is called when production func_args is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_args(ctx *Func_argsContext) {} + +// ExitFunc_args is called when production func_args is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_args(ctx *Func_argsContext) {} + +// EnterFunc_args_list is called when production func_args_list is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_args_list(ctx *Func_args_listContext) {} + +// ExitFunc_args_list is called when production func_args_list is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_args_list(ctx *Func_args_listContext) {} + +// EnterFunction_with_argtypes_list is called when production function_with_argtypes_list is entered. +func (s *BasePostgreSQLParserListener) EnterFunction_with_argtypes_list(ctx *Function_with_argtypes_listContext) { +} + +// ExitFunction_with_argtypes_list is called when production function_with_argtypes_list is exited. +func (s *BasePostgreSQLParserListener) ExitFunction_with_argtypes_list(ctx *Function_with_argtypes_listContext) { +} + +// EnterFunction_with_argtypes is called when production function_with_argtypes is entered. +func (s *BasePostgreSQLParserListener) EnterFunction_with_argtypes(ctx *Function_with_argtypesContext) { +} + +// ExitFunction_with_argtypes is called when production function_with_argtypes is exited. +func (s *BasePostgreSQLParserListener) ExitFunction_with_argtypes(ctx *Function_with_argtypesContext) { +} + +// EnterFunc_args_with_defaults is called when production func_args_with_defaults is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_args_with_defaults(ctx *Func_args_with_defaultsContext) { +} + +// ExitFunc_args_with_defaults is called when production func_args_with_defaults is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_args_with_defaults(ctx *Func_args_with_defaultsContext) { +} + +// EnterFunc_args_with_defaults_list is called when production func_args_with_defaults_list is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_args_with_defaults_list(ctx *Func_args_with_defaults_listContext) { +} + +// ExitFunc_args_with_defaults_list is called when production func_args_with_defaults_list is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_args_with_defaults_list(ctx *Func_args_with_defaults_listContext) { +} + +// EnterFunc_arg is called when production func_arg is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_arg(ctx *Func_argContext) {} + +// ExitFunc_arg is called when production func_arg is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_arg(ctx *Func_argContext) {} + +// EnterArg_class is called when production arg_class is entered. +func (s *BasePostgreSQLParserListener) EnterArg_class(ctx *Arg_classContext) {} + +// ExitArg_class is called when production arg_class is exited. +func (s *BasePostgreSQLParserListener) ExitArg_class(ctx *Arg_classContext) {} + +// EnterParam_name is called when production param_name is entered. +func (s *BasePostgreSQLParserListener) EnterParam_name(ctx *Param_nameContext) {} + +// ExitParam_name is called when production param_name is exited. +func (s *BasePostgreSQLParserListener) ExitParam_name(ctx *Param_nameContext) {} + +// EnterFunc_return is called when production func_return is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_return(ctx *Func_returnContext) {} + +// ExitFunc_return is called when production func_return is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_return(ctx *Func_returnContext) {} + +// EnterFunc_type is called when production func_type is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_type(ctx *Func_typeContext) {} + +// ExitFunc_type is called when production func_type is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_type(ctx *Func_typeContext) {} + +// EnterFunc_arg_with_default is called when production func_arg_with_default is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_arg_with_default(ctx *Func_arg_with_defaultContext) { +} + +// ExitFunc_arg_with_default is called when production func_arg_with_default is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_arg_with_default(ctx *Func_arg_with_defaultContext) {} + +// EnterAggr_arg is called when production aggr_arg is entered. +func (s *BasePostgreSQLParserListener) EnterAggr_arg(ctx *Aggr_argContext) {} + +// ExitAggr_arg is called when production aggr_arg is exited. +func (s *BasePostgreSQLParserListener) ExitAggr_arg(ctx *Aggr_argContext) {} + +// EnterAggr_args is called when production aggr_args is entered. +func (s *BasePostgreSQLParserListener) EnterAggr_args(ctx *Aggr_argsContext) {} + +// ExitAggr_args is called when production aggr_args is exited. +func (s *BasePostgreSQLParserListener) ExitAggr_args(ctx *Aggr_argsContext) {} + +// EnterAggr_args_list is called when production aggr_args_list is entered. +func (s *BasePostgreSQLParserListener) EnterAggr_args_list(ctx *Aggr_args_listContext) {} + +// ExitAggr_args_list is called when production aggr_args_list is exited. +func (s *BasePostgreSQLParserListener) ExitAggr_args_list(ctx *Aggr_args_listContext) {} + +// EnterAggregate_with_argtypes is called when production aggregate_with_argtypes is entered. +func (s *BasePostgreSQLParserListener) EnterAggregate_with_argtypes(ctx *Aggregate_with_argtypesContext) { +} + +// ExitAggregate_with_argtypes is called when production aggregate_with_argtypes is exited. +func (s *BasePostgreSQLParserListener) ExitAggregate_with_argtypes(ctx *Aggregate_with_argtypesContext) { +} + +// EnterAggregate_with_argtypes_list is called when production aggregate_with_argtypes_list is entered. +func (s *BasePostgreSQLParserListener) EnterAggregate_with_argtypes_list(ctx *Aggregate_with_argtypes_listContext) { +} + +// ExitAggregate_with_argtypes_list is called when production aggregate_with_argtypes_list is exited. +func (s *BasePostgreSQLParserListener) ExitAggregate_with_argtypes_list(ctx *Aggregate_with_argtypes_listContext) { +} + +// EnterCreatefunc_opt_list is called when production createfunc_opt_list is entered. +func (s *BasePostgreSQLParserListener) EnterCreatefunc_opt_list(ctx *Createfunc_opt_listContext) {} + +// ExitCreatefunc_opt_list is called when production createfunc_opt_list is exited. +func (s *BasePostgreSQLParserListener) ExitCreatefunc_opt_list(ctx *Createfunc_opt_listContext) {} + +// EnterCommon_func_opt_item is called when production common_func_opt_item is entered. +func (s *BasePostgreSQLParserListener) EnterCommon_func_opt_item(ctx *Common_func_opt_itemContext) {} + +// ExitCommon_func_opt_item is called when production common_func_opt_item is exited. +func (s *BasePostgreSQLParserListener) ExitCommon_func_opt_item(ctx *Common_func_opt_itemContext) {} + +// EnterCreatefunc_opt_item is called when production createfunc_opt_item is entered. +func (s *BasePostgreSQLParserListener) EnterCreatefunc_opt_item(ctx *Createfunc_opt_itemContext) {} + +// ExitCreatefunc_opt_item is called when production createfunc_opt_item is exited. +func (s *BasePostgreSQLParserListener) ExitCreatefunc_opt_item(ctx *Createfunc_opt_itemContext) {} + +// EnterFunc_as is called when production func_as is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_as(ctx *Func_asContext) {} + +// ExitFunc_as is called when production func_as is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_as(ctx *Func_asContext) {} + +// EnterTransform_type_list is called when production transform_type_list is entered. +func (s *BasePostgreSQLParserListener) EnterTransform_type_list(ctx *Transform_type_listContext) {} + +// ExitTransform_type_list is called when production transform_type_list is exited. +func (s *BasePostgreSQLParserListener) ExitTransform_type_list(ctx *Transform_type_listContext) {} + +// EnterOpt_definition is called when production opt_definition is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_definition(ctx *Opt_definitionContext) {} + +// ExitOpt_definition is called when production opt_definition is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_definition(ctx *Opt_definitionContext) {} + +// EnterTable_func_column is called when production table_func_column is entered. +func (s *BasePostgreSQLParserListener) EnterTable_func_column(ctx *Table_func_columnContext) {} + +// ExitTable_func_column is called when production table_func_column is exited. +func (s *BasePostgreSQLParserListener) ExitTable_func_column(ctx *Table_func_columnContext) {} + +// EnterTable_func_column_list is called when production table_func_column_list is entered. +func (s *BasePostgreSQLParserListener) EnterTable_func_column_list(ctx *Table_func_column_listContext) { +} + +// ExitTable_func_column_list is called when production table_func_column_list is exited. +func (s *BasePostgreSQLParserListener) ExitTable_func_column_list(ctx *Table_func_column_listContext) { +} + +// EnterAlterfunctionstmt is called when production alterfunctionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterfunctionstmt(ctx *AlterfunctionstmtContext) {} + +// ExitAlterfunctionstmt is called when production alterfunctionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterfunctionstmt(ctx *AlterfunctionstmtContext) {} + +// EnterAlterfunc_opt_list is called when production alterfunc_opt_list is entered. +func (s *BasePostgreSQLParserListener) EnterAlterfunc_opt_list(ctx *Alterfunc_opt_listContext) {} + +// ExitAlterfunc_opt_list is called when production alterfunc_opt_list is exited. +func (s *BasePostgreSQLParserListener) ExitAlterfunc_opt_list(ctx *Alterfunc_opt_listContext) {} + +// EnterOpt_restrict is called when production opt_restrict is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_restrict(ctx *Opt_restrictContext) {} + +// ExitOpt_restrict is called when production opt_restrict is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_restrict(ctx *Opt_restrictContext) {} + +// EnterRemovefuncstmt is called when production removefuncstmt is entered. +func (s *BasePostgreSQLParserListener) EnterRemovefuncstmt(ctx *RemovefuncstmtContext) {} + +// ExitRemovefuncstmt is called when production removefuncstmt is exited. +func (s *BasePostgreSQLParserListener) ExitRemovefuncstmt(ctx *RemovefuncstmtContext) {} + +// EnterRemoveaggrstmt is called when production removeaggrstmt is entered. +func (s *BasePostgreSQLParserListener) EnterRemoveaggrstmt(ctx *RemoveaggrstmtContext) {} + +// ExitRemoveaggrstmt is called when production removeaggrstmt is exited. +func (s *BasePostgreSQLParserListener) ExitRemoveaggrstmt(ctx *RemoveaggrstmtContext) {} + +// EnterRemoveoperstmt is called when production removeoperstmt is entered. +func (s *BasePostgreSQLParserListener) EnterRemoveoperstmt(ctx *RemoveoperstmtContext) {} + +// ExitRemoveoperstmt is called when production removeoperstmt is exited. +func (s *BasePostgreSQLParserListener) ExitRemoveoperstmt(ctx *RemoveoperstmtContext) {} + +// EnterOper_argtypes is called when production oper_argtypes is entered. +func (s *BasePostgreSQLParserListener) EnterOper_argtypes(ctx *Oper_argtypesContext) {} + +// ExitOper_argtypes is called when production oper_argtypes is exited. +func (s *BasePostgreSQLParserListener) ExitOper_argtypes(ctx *Oper_argtypesContext) {} + +// EnterAny_operator is called when production any_operator is entered. +func (s *BasePostgreSQLParserListener) EnterAny_operator(ctx *Any_operatorContext) {} + +// ExitAny_operator is called when production any_operator is exited. +func (s *BasePostgreSQLParserListener) ExitAny_operator(ctx *Any_operatorContext) {} + +// EnterOperator_with_argtypes_list is called when production operator_with_argtypes_list is entered. +func (s *BasePostgreSQLParserListener) EnterOperator_with_argtypes_list(ctx *Operator_with_argtypes_listContext) { +} + +// ExitOperator_with_argtypes_list is called when production operator_with_argtypes_list is exited. +func (s *BasePostgreSQLParserListener) ExitOperator_with_argtypes_list(ctx *Operator_with_argtypes_listContext) { +} + +// EnterOperator_with_argtypes is called when production operator_with_argtypes is entered. +func (s *BasePostgreSQLParserListener) EnterOperator_with_argtypes(ctx *Operator_with_argtypesContext) { +} + +// ExitOperator_with_argtypes is called when production operator_with_argtypes is exited. +func (s *BasePostgreSQLParserListener) ExitOperator_with_argtypes(ctx *Operator_with_argtypesContext) { +} + +// EnterDostmt is called when production dostmt is entered. +func (s *BasePostgreSQLParserListener) EnterDostmt(ctx *DostmtContext) {} + +// ExitDostmt is called when production dostmt is exited. +func (s *BasePostgreSQLParserListener) ExitDostmt(ctx *DostmtContext) {} + +// EnterDostmt_opt_list is called when production dostmt_opt_list is entered. +func (s *BasePostgreSQLParserListener) EnterDostmt_opt_list(ctx *Dostmt_opt_listContext) {} + +// ExitDostmt_opt_list is called when production dostmt_opt_list is exited. +func (s *BasePostgreSQLParserListener) ExitDostmt_opt_list(ctx *Dostmt_opt_listContext) {} + +// EnterDostmt_opt_item is called when production dostmt_opt_item is entered. +func (s *BasePostgreSQLParserListener) EnterDostmt_opt_item(ctx *Dostmt_opt_itemContext) {} + +// ExitDostmt_opt_item is called when production dostmt_opt_item is exited. +func (s *BasePostgreSQLParserListener) ExitDostmt_opt_item(ctx *Dostmt_opt_itemContext) {} + +// EnterCreatecaststmt is called when production createcaststmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatecaststmt(ctx *CreatecaststmtContext) {} + +// ExitCreatecaststmt is called when production createcaststmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatecaststmt(ctx *CreatecaststmtContext) {} + +// EnterCast_context is called when production cast_context is entered. +func (s *BasePostgreSQLParserListener) EnterCast_context(ctx *Cast_contextContext) {} + +// ExitCast_context is called when production cast_context is exited. +func (s *BasePostgreSQLParserListener) ExitCast_context(ctx *Cast_contextContext) {} + +// EnterDropcaststmt is called when production dropcaststmt is entered. +func (s *BasePostgreSQLParserListener) EnterDropcaststmt(ctx *DropcaststmtContext) {} + +// ExitDropcaststmt is called when production dropcaststmt is exited. +func (s *BasePostgreSQLParserListener) ExitDropcaststmt(ctx *DropcaststmtContext) {} + +// EnterOpt_if_exists is called when production opt_if_exists is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_if_exists(ctx *Opt_if_existsContext) {} + +// ExitOpt_if_exists is called when production opt_if_exists is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_if_exists(ctx *Opt_if_existsContext) {} + +// EnterCreatetransformstmt is called when production createtransformstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatetransformstmt(ctx *CreatetransformstmtContext) {} + +// ExitCreatetransformstmt is called when production createtransformstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatetransformstmt(ctx *CreatetransformstmtContext) {} + +// EnterTransform_element_list is called when production transform_element_list is entered. +func (s *BasePostgreSQLParserListener) EnterTransform_element_list(ctx *Transform_element_listContext) { +} + +// ExitTransform_element_list is called when production transform_element_list is exited. +func (s *BasePostgreSQLParserListener) ExitTransform_element_list(ctx *Transform_element_listContext) { +} + +// EnterDroptransformstmt is called when production droptransformstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDroptransformstmt(ctx *DroptransformstmtContext) {} + +// ExitDroptransformstmt is called when production droptransformstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDroptransformstmt(ctx *DroptransformstmtContext) {} + +// EnterReindexstmt is called when production reindexstmt is entered. +func (s *BasePostgreSQLParserListener) EnterReindexstmt(ctx *ReindexstmtContext) {} + +// ExitReindexstmt is called when production reindexstmt is exited. +func (s *BasePostgreSQLParserListener) ExitReindexstmt(ctx *ReindexstmtContext) {} + +// EnterReindex_target_type is called when production reindex_target_type is entered. +func (s *BasePostgreSQLParserListener) EnterReindex_target_type(ctx *Reindex_target_typeContext) {} + +// ExitReindex_target_type is called when production reindex_target_type is exited. +func (s *BasePostgreSQLParserListener) ExitReindex_target_type(ctx *Reindex_target_typeContext) {} + +// EnterReindex_target_multitable is called when production reindex_target_multitable is entered. +func (s *BasePostgreSQLParserListener) EnterReindex_target_multitable(ctx *Reindex_target_multitableContext) { +} + +// ExitReindex_target_multitable is called when production reindex_target_multitable is exited. +func (s *BasePostgreSQLParserListener) ExitReindex_target_multitable(ctx *Reindex_target_multitableContext) { +} + +// EnterReindex_option_list is called when production reindex_option_list is entered. +func (s *BasePostgreSQLParserListener) EnterReindex_option_list(ctx *Reindex_option_listContext) {} + +// ExitReindex_option_list is called when production reindex_option_list is exited. +func (s *BasePostgreSQLParserListener) ExitReindex_option_list(ctx *Reindex_option_listContext) {} + +// EnterReindex_option_elem is called when production reindex_option_elem is entered. +func (s *BasePostgreSQLParserListener) EnterReindex_option_elem(ctx *Reindex_option_elemContext) {} + +// ExitReindex_option_elem is called when production reindex_option_elem is exited. +func (s *BasePostgreSQLParserListener) ExitReindex_option_elem(ctx *Reindex_option_elemContext) {} + +// EnterAltertblspcstmt is called when production altertblspcstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltertblspcstmt(ctx *AltertblspcstmtContext) {} + +// ExitAltertblspcstmt is called when production altertblspcstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltertblspcstmt(ctx *AltertblspcstmtContext) {} + +// EnterRenamestmt is called when production renamestmt is entered. +func (s *BasePostgreSQLParserListener) EnterRenamestmt(ctx *RenamestmtContext) {} + +// ExitRenamestmt is called when production renamestmt is exited. +func (s *BasePostgreSQLParserListener) ExitRenamestmt(ctx *RenamestmtContext) {} + +// EnterOpt_column is called when production opt_column is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_column(ctx *Opt_columnContext) {} + +// ExitOpt_column is called when production opt_column is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_column(ctx *Opt_columnContext) {} + +// EnterOpt_set_data is called when production opt_set_data is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_set_data(ctx *Opt_set_dataContext) {} + +// ExitOpt_set_data is called when production opt_set_data is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_set_data(ctx *Opt_set_dataContext) {} + +// EnterAlterobjectdependsstmt is called when production alterobjectdependsstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterobjectdependsstmt(ctx *AlterobjectdependsstmtContext) { +} + +// ExitAlterobjectdependsstmt is called when production alterobjectdependsstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterobjectdependsstmt(ctx *AlterobjectdependsstmtContext) { +} + +// EnterOpt_no is called when production opt_no is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_no(ctx *Opt_noContext) {} + +// ExitOpt_no is called when production opt_no is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_no(ctx *Opt_noContext) {} + +// EnterAlterobjectschemastmt is called when production alterobjectschemastmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterobjectschemastmt(ctx *AlterobjectschemastmtContext) { +} + +// ExitAlterobjectschemastmt is called when production alterobjectschemastmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterobjectschemastmt(ctx *AlterobjectschemastmtContext) {} + +// EnterAlteroperatorstmt is called when production alteroperatorstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlteroperatorstmt(ctx *AlteroperatorstmtContext) {} + +// ExitAlteroperatorstmt is called when production alteroperatorstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlteroperatorstmt(ctx *AlteroperatorstmtContext) {} + +// EnterOperator_def_list is called when production operator_def_list is entered. +func (s *BasePostgreSQLParserListener) EnterOperator_def_list(ctx *Operator_def_listContext) {} + +// ExitOperator_def_list is called when production operator_def_list is exited. +func (s *BasePostgreSQLParserListener) ExitOperator_def_list(ctx *Operator_def_listContext) {} + +// EnterOperator_def_elem is called when production operator_def_elem is entered. +func (s *BasePostgreSQLParserListener) EnterOperator_def_elem(ctx *Operator_def_elemContext) {} + +// ExitOperator_def_elem is called when production operator_def_elem is exited. +func (s *BasePostgreSQLParserListener) ExitOperator_def_elem(ctx *Operator_def_elemContext) {} + +// EnterOperator_def_arg is called when production operator_def_arg is entered. +func (s *BasePostgreSQLParserListener) EnterOperator_def_arg(ctx *Operator_def_argContext) {} + +// ExitOperator_def_arg is called when production operator_def_arg is exited. +func (s *BasePostgreSQLParserListener) ExitOperator_def_arg(ctx *Operator_def_argContext) {} + +// EnterAltertypestmt is called when production altertypestmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltertypestmt(ctx *AltertypestmtContext) {} + +// ExitAltertypestmt is called when production altertypestmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltertypestmt(ctx *AltertypestmtContext) {} + +// EnterAlterownerstmt is called when production alterownerstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterownerstmt(ctx *AlterownerstmtContext) {} + +// ExitAlterownerstmt is called when production alterownerstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterownerstmt(ctx *AlterownerstmtContext) {} + +// EnterCreatepublicationstmt is called when production createpublicationstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatepublicationstmt(ctx *CreatepublicationstmtContext) { +} + +// ExitCreatepublicationstmt is called when production createpublicationstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatepublicationstmt(ctx *CreatepublicationstmtContext) {} + +// EnterPub_obj_list is called when production pub_obj_list is entered. +func (s *BasePostgreSQLParserListener) EnterPub_obj_list(ctx *Pub_obj_listContext) {} + +// ExitPub_obj_list is called when production pub_obj_list is exited. +func (s *BasePostgreSQLParserListener) ExitPub_obj_list(ctx *Pub_obj_listContext) {} + +// EnterPublication_obj_spec is called when production publication_obj_spec is entered. +func (s *BasePostgreSQLParserListener) EnterPublication_obj_spec(ctx *Publication_obj_specContext) {} + +// ExitPublication_obj_spec is called when production publication_obj_spec is exited. +func (s *BasePostgreSQLParserListener) ExitPublication_obj_spec(ctx *Publication_obj_specContext) {} + +// EnterOpt_where_clause is called when production opt_where_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_where_clause(ctx *Opt_where_clauseContext) {} + +// ExitOpt_where_clause is called when production opt_where_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_where_clause(ctx *Opt_where_clauseContext) {} + +// EnterAlterpublicationstmt is called when production alterpublicationstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterpublicationstmt(ctx *AlterpublicationstmtContext) {} + +// ExitAlterpublicationstmt is called when production alterpublicationstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterpublicationstmt(ctx *AlterpublicationstmtContext) {} + +// EnterCreatesubscriptionstmt is called when production createsubscriptionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatesubscriptionstmt(ctx *CreatesubscriptionstmtContext) { +} + +// ExitCreatesubscriptionstmt is called when production createsubscriptionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatesubscriptionstmt(ctx *CreatesubscriptionstmtContext) { +} + +// EnterPublication_name_list is called when production publication_name_list is entered. +func (s *BasePostgreSQLParserListener) EnterPublication_name_list(ctx *Publication_name_listContext) { +} + +// ExitPublication_name_list is called when production publication_name_list is exited. +func (s *BasePostgreSQLParserListener) ExitPublication_name_list(ctx *Publication_name_listContext) {} + +// EnterPublication_name_item is called when production publication_name_item is entered. +func (s *BasePostgreSQLParserListener) EnterPublication_name_item(ctx *Publication_name_itemContext) { +} + +// ExitPublication_name_item is called when production publication_name_item is exited. +func (s *BasePostgreSQLParserListener) ExitPublication_name_item(ctx *Publication_name_itemContext) {} + +// EnterAltersubscriptionstmt is called when production altersubscriptionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltersubscriptionstmt(ctx *AltersubscriptionstmtContext) { +} + +// ExitAltersubscriptionstmt is called when production altersubscriptionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltersubscriptionstmt(ctx *AltersubscriptionstmtContext) {} + +// EnterDropsubscriptionstmt is called when production dropsubscriptionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDropsubscriptionstmt(ctx *DropsubscriptionstmtContext) {} + +// ExitDropsubscriptionstmt is called when production dropsubscriptionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDropsubscriptionstmt(ctx *DropsubscriptionstmtContext) {} + +// EnterRulestmt is called when production rulestmt is entered. +func (s *BasePostgreSQLParserListener) EnterRulestmt(ctx *RulestmtContext) {} + +// ExitRulestmt is called when production rulestmt is exited. +func (s *BasePostgreSQLParserListener) ExitRulestmt(ctx *RulestmtContext) {} + +// EnterRuleactionlist is called when production ruleactionlist is entered. +func (s *BasePostgreSQLParserListener) EnterRuleactionlist(ctx *RuleactionlistContext) {} + +// ExitRuleactionlist is called when production ruleactionlist is exited. +func (s *BasePostgreSQLParserListener) ExitRuleactionlist(ctx *RuleactionlistContext) {} + +// EnterRuleactionmulti is called when production ruleactionmulti is entered. +func (s *BasePostgreSQLParserListener) EnterRuleactionmulti(ctx *RuleactionmultiContext) {} + +// ExitRuleactionmulti is called when production ruleactionmulti is exited. +func (s *BasePostgreSQLParserListener) ExitRuleactionmulti(ctx *RuleactionmultiContext) {} + +// EnterRuleactionstmt is called when production ruleactionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterRuleactionstmt(ctx *RuleactionstmtContext) {} + +// ExitRuleactionstmt is called when production ruleactionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitRuleactionstmt(ctx *RuleactionstmtContext) {} + +// EnterRuleactionstmtOrEmpty is called when production ruleactionstmtOrEmpty is entered. +func (s *BasePostgreSQLParserListener) EnterRuleactionstmtOrEmpty(ctx *RuleactionstmtOrEmptyContext) { +} + +// ExitRuleactionstmtOrEmpty is called when production ruleactionstmtOrEmpty is exited. +func (s *BasePostgreSQLParserListener) ExitRuleactionstmtOrEmpty(ctx *RuleactionstmtOrEmptyContext) {} + +// EnterEvent is called when production event is entered. +func (s *BasePostgreSQLParserListener) EnterEvent(ctx *EventContext) {} + +// ExitEvent is called when production event is exited. +func (s *BasePostgreSQLParserListener) ExitEvent(ctx *EventContext) {} + +// EnterOpt_instead is called when production opt_instead is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_instead(ctx *Opt_insteadContext) {} + +// ExitOpt_instead is called when production opt_instead is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_instead(ctx *Opt_insteadContext) {} + +// EnterNotifystmt is called when production notifystmt is entered. +func (s *BasePostgreSQLParserListener) EnterNotifystmt(ctx *NotifystmtContext) {} + +// ExitNotifystmt is called when production notifystmt is exited. +func (s *BasePostgreSQLParserListener) ExitNotifystmt(ctx *NotifystmtContext) {} + +// EnterNotify_payload is called when production notify_payload is entered. +func (s *BasePostgreSQLParserListener) EnterNotify_payload(ctx *Notify_payloadContext) {} + +// ExitNotify_payload is called when production notify_payload is exited. +func (s *BasePostgreSQLParserListener) ExitNotify_payload(ctx *Notify_payloadContext) {} + +// EnterListenstmt is called when production listenstmt is entered. +func (s *BasePostgreSQLParserListener) EnterListenstmt(ctx *ListenstmtContext) {} + +// ExitListenstmt is called when production listenstmt is exited. +func (s *BasePostgreSQLParserListener) ExitListenstmt(ctx *ListenstmtContext) {} + +// EnterUnlistenstmt is called when production unlistenstmt is entered. +func (s *BasePostgreSQLParserListener) EnterUnlistenstmt(ctx *UnlistenstmtContext) {} + +// ExitUnlistenstmt is called when production unlistenstmt is exited. +func (s *BasePostgreSQLParserListener) ExitUnlistenstmt(ctx *UnlistenstmtContext) {} + +// EnterTransactionstmt is called when production transactionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterTransactionstmt(ctx *TransactionstmtContext) {} + +// ExitTransactionstmt is called when production transactionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitTransactionstmt(ctx *TransactionstmtContext) {} + +// EnterOpt_transaction is called when production opt_transaction is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_transaction(ctx *Opt_transactionContext) {} + +// ExitOpt_transaction is called when production opt_transaction is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_transaction(ctx *Opt_transactionContext) {} + +// EnterTransaction_mode_item is called when production transaction_mode_item is entered. +func (s *BasePostgreSQLParserListener) EnterTransaction_mode_item(ctx *Transaction_mode_itemContext) { +} + +// ExitTransaction_mode_item is called when production transaction_mode_item is exited. +func (s *BasePostgreSQLParserListener) ExitTransaction_mode_item(ctx *Transaction_mode_itemContext) {} + +// EnterTransaction_mode_list is called when production transaction_mode_list is entered. +func (s *BasePostgreSQLParserListener) EnterTransaction_mode_list(ctx *Transaction_mode_listContext) { +} + +// ExitTransaction_mode_list is called when production transaction_mode_list is exited. +func (s *BasePostgreSQLParserListener) ExitTransaction_mode_list(ctx *Transaction_mode_listContext) {} + +// EnterTransaction_mode_list_or_empty is called when production transaction_mode_list_or_empty is entered. +func (s *BasePostgreSQLParserListener) EnterTransaction_mode_list_or_empty(ctx *Transaction_mode_list_or_emptyContext) { +} + +// ExitTransaction_mode_list_or_empty is called when production transaction_mode_list_or_empty is exited. +func (s *BasePostgreSQLParserListener) ExitTransaction_mode_list_or_empty(ctx *Transaction_mode_list_or_emptyContext) { +} + +// EnterOpt_transaction_chain is called when production opt_transaction_chain is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_transaction_chain(ctx *Opt_transaction_chainContext) { +} + +// ExitOpt_transaction_chain is called when production opt_transaction_chain is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_transaction_chain(ctx *Opt_transaction_chainContext) {} + +// EnterViewstmt is called when production viewstmt is entered. +func (s *BasePostgreSQLParserListener) EnterViewstmt(ctx *ViewstmtContext) {} + +// ExitViewstmt is called when production viewstmt is exited. +func (s *BasePostgreSQLParserListener) ExitViewstmt(ctx *ViewstmtContext) {} + +// EnterOpt_check_option is called when production opt_check_option is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_check_option(ctx *Opt_check_optionContext) {} + +// ExitOpt_check_option is called when production opt_check_option is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_check_option(ctx *Opt_check_optionContext) {} + +// EnterLoadstmt is called when production loadstmt is entered. +func (s *BasePostgreSQLParserListener) EnterLoadstmt(ctx *LoadstmtContext) {} + +// ExitLoadstmt is called when production loadstmt is exited. +func (s *BasePostgreSQLParserListener) ExitLoadstmt(ctx *LoadstmtContext) {} + +// EnterCreatedbstmt is called when production createdbstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatedbstmt(ctx *CreatedbstmtContext) {} + +// ExitCreatedbstmt is called when production createdbstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatedbstmt(ctx *CreatedbstmtContext) {} + +// EnterCreatedb_opt_list is called when production createdb_opt_list is entered. +func (s *BasePostgreSQLParserListener) EnterCreatedb_opt_list(ctx *Createdb_opt_listContext) {} + +// ExitCreatedb_opt_list is called when production createdb_opt_list is exited. +func (s *BasePostgreSQLParserListener) ExitCreatedb_opt_list(ctx *Createdb_opt_listContext) {} + +// EnterCreatedb_opt_items is called when production createdb_opt_items is entered. +func (s *BasePostgreSQLParserListener) EnterCreatedb_opt_items(ctx *Createdb_opt_itemsContext) {} + +// ExitCreatedb_opt_items is called when production createdb_opt_items is exited. +func (s *BasePostgreSQLParserListener) ExitCreatedb_opt_items(ctx *Createdb_opt_itemsContext) {} + +// EnterCreatedb_opt_item is called when production createdb_opt_item is entered. +func (s *BasePostgreSQLParserListener) EnterCreatedb_opt_item(ctx *Createdb_opt_itemContext) {} + +// ExitCreatedb_opt_item is called when production createdb_opt_item is exited. +func (s *BasePostgreSQLParserListener) ExitCreatedb_opt_item(ctx *Createdb_opt_itemContext) {} + +// EnterCreatedb_opt_name is called when production createdb_opt_name is entered. +func (s *BasePostgreSQLParserListener) EnterCreatedb_opt_name(ctx *Createdb_opt_nameContext) {} + +// ExitCreatedb_opt_name is called when production createdb_opt_name is exited. +func (s *BasePostgreSQLParserListener) ExitCreatedb_opt_name(ctx *Createdb_opt_nameContext) {} + +// EnterOpt_equal is called when production opt_equal is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_equal(ctx *Opt_equalContext) {} + +// ExitOpt_equal is called when production opt_equal is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_equal(ctx *Opt_equalContext) {} + +// EnterAlterdatabasestmt is called when production alterdatabasestmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterdatabasestmt(ctx *AlterdatabasestmtContext) {} + +// ExitAlterdatabasestmt is called when production alterdatabasestmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterdatabasestmt(ctx *AlterdatabasestmtContext) {} + +// EnterAlterdatabasesetstmt is called when production alterdatabasesetstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterdatabasesetstmt(ctx *AlterdatabasesetstmtContext) {} + +// ExitAlterdatabasesetstmt is called when production alterdatabasesetstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterdatabasesetstmt(ctx *AlterdatabasesetstmtContext) {} + +// EnterDropdbstmt is called when production dropdbstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDropdbstmt(ctx *DropdbstmtContext) {} + +// ExitDropdbstmt is called when production dropdbstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDropdbstmt(ctx *DropdbstmtContext) {} + +// EnterDrop_option_list is called when production drop_option_list is entered. +func (s *BasePostgreSQLParserListener) EnterDrop_option_list(ctx *Drop_option_listContext) {} + +// ExitDrop_option_list is called when production drop_option_list is exited. +func (s *BasePostgreSQLParserListener) ExitDrop_option_list(ctx *Drop_option_listContext) {} + +// EnterDrop_option is called when production drop_option is entered. +func (s *BasePostgreSQLParserListener) EnterDrop_option(ctx *Drop_optionContext) {} + +// ExitDrop_option is called when production drop_option is exited. +func (s *BasePostgreSQLParserListener) ExitDrop_option(ctx *Drop_optionContext) {} + +// EnterAltercollationstmt is called when production altercollationstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltercollationstmt(ctx *AltercollationstmtContext) {} + +// ExitAltercollationstmt is called when production altercollationstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltercollationstmt(ctx *AltercollationstmtContext) {} + +// EnterAltersystemstmt is called when production altersystemstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltersystemstmt(ctx *AltersystemstmtContext) {} + +// ExitAltersystemstmt is called when production altersystemstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltersystemstmt(ctx *AltersystemstmtContext) {} + +// EnterCreatedomainstmt is called when production createdomainstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreatedomainstmt(ctx *CreatedomainstmtContext) {} + +// ExitCreatedomainstmt is called when production createdomainstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreatedomainstmt(ctx *CreatedomainstmtContext) {} + +// EnterAlterdomainstmt is called when production alterdomainstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAlterdomainstmt(ctx *AlterdomainstmtContext) {} + +// ExitAlterdomainstmt is called when production alterdomainstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAlterdomainstmt(ctx *AlterdomainstmtContext) {} + +// EnterOpt_as is called when production opt_as is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_as(ctx *Opt_asContext) {} + +// ExitOpt_as is called when production opt_as is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_as(ctx *Opt_asContext) {} + +// EnterAltertsdictionarystmt is called when production altertsdictionarystmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltertsdictionarystmt(ctx *AltertsdictionarystmtContext) { +} + +// ExitAltertsdictionarystmt is called when production altertsdictionarystmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltertsdictionarystmt(ctx *AltertsdictionarystmtContext) {} + +// EnterAltertsconfigurationstmt is called when production altertsconfigurationstmt is entered. +func (s *BasePostgreSQLParserListener) EnterAltertsconfigurationstmt(ctx *AltertsconfigurationstmtContext) { +} + +// ExitAltertsconfigurationstmt is called when production altertsconfigurationstmt is exited. +func (s *BasePostgreSQLParserListener) ExitAltertsconfigurationstmt(ctx *AltertsconfigurationstmtContext) { +} + +// EnterAny_with is called when production any_with is entered. +func (s *BasePostgreSQLParserListener) EnterAny_with(ctx *Any_withContext) {} + +// ExitAny_with is called when production any_with is exited. +func (s *BasePostgreSQLParserListener) ExitAny_with(ctx *Any_withContext) {} + +// EnterCreateconversionstmt is called when production createconversionstmt is entered. +func (s *BasePostgreSQLParserListener) EnterCreateconversionstmt(ctx *CreateconversionstmtContext) {} + +// ExitCreateconversionstmt is called when production createconversionstmt is exited. +func (s *BasePostgreSQLParserListener) ExitCreateconversionstmt(ctx *CreateconversionstmtContext) {} + +// EnterClusterstmt is called when production clusterstmt is entered. +func (s *BasePostgreSQLParserListener) EnterClusterstmt(ctx *ClusterstmtContext) {} + +// ExitClusterstmt is called when production clusterstmt is exited. +func (s *BasePostgreSQLParserListener) ExitClusterstmt(ctx *ClusterstmtContext) {} + +// EnterCluster_index_specification is called when production cluster_index_specification is entered. +func (s *BasePostgreSQLParserListener) EnterCluster_index_specification(ctx *Cluster_index_specificationContext) { +} + +// ExitCluster_index_specification is called when production cluster_index_specification is exited. +func (s *BasePostgreSQLParserListener) ExitCluster_index_specification(ctx *Cluster_index_specificationContext) { +} + +// EnterVacuumstmt is called when production vacuumstmt is entered. +func (s *BasePostgreSQLParserListener) EnterVacuumstmt(ctx *VacuumstmtContext) {} + +// ExitVacuumstmt is called when production vacuumstmt is exited. +func (s *BasePostgreSQLParserListener) ExitVacuumstmt(ctx *VacuumstmtContext) {} + +// EnterAnalyzestmt is called when production analyzestmt is entered. +func (s *BasePostgreSQLParserListener) EnterAnalyzestmt(ctx *AnalyzestmtContext) {} + +// ExitAnalyzestmt is called when production analyzestmt is exited. +func (s *BasePostgreSQLParserListener) ExitAnalyzestmt(ctx *AnalyzestmtContext) {} + +// EnterVac_analyze_option_list is called when production vac_analyze_option_list is entered. +func (s *BasePostgreSQLParserListener) EnterVac_analyze_option_list(ctx *Vac_analyze_option_listContext) { +} + +// ExitVac_analyze_option_list is called when production vac_analyze_option_list is exited. +func (s *BasePostgreSQLParserListener) ExitVac_analyze_option_list(ctx *Vac_analyze_option_listContext) { +} + +// EnterAnalyze_keyword is called when production analyze_keyword is entered. +func (s *BasePostgreSQLParserListener) EnterAnalyze_keyword(ctx *Analyze_keywordContext) {} + +// ExitAnalyze_keyword is called when production analyze_keyword is exited. +func (s *BasePostgreSQLParserListener) ExitAnalyze_keyword(ctx *Analyze_keywordContext) {} + +// EnterVac_analyze_option_elem is called when production vac_analyze_option_elem is entered. +func (s *BasePostgreSQLParserListener) EnterVac_analyze_option_elem(ctx *Vac_analyze_option_elemContext) { +} + +// ExitVac_analyze_option_elem is called when production vac_analyze_option_elem is exited. +func (s *BasePostgreSQLParserListener) ExitVac_analyze_option_elem(ctx *Vac_analyze_option_elemContext) { +} + +// EnterVac_analyze_option_name is called when production vac_analyze_option_name is entered. +func (s *BasePostgreSQLParserListener) EnterVac_analyze_option_name(ctx *Vac_analyze_option_nameContext) { +} + +// ExitVac_analyze_option_name is called when production vac_analyze_option_name is exited. +func (s *BasePostgreSQLParserListener) ExitVac_analyze_option_name(ctx *Vac_analyze_option_nameContext) { +} + +// EnterVac_analyze_option_arg is called when production vac_analyze_option_arg is entered. +func (s *BasePostgreSQLParserListener) EnterVac_analyze_option_arg(ctx *Vac_analyze_option_argContext) { +} + +// ExitVac_analyze_option_arg is called when production vac_analyze_option_arg is exited. +func (s *BasePostgreSQLParserListener) ExitVac_analyze_option_arg(ctx *Vac_analyze_option_argContext) { +} + +// EnterOpt_analyze is called when production opt_analyze is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_analyze(ctx *Opt_analyzeContext) {} + +// ExitOpt_analyze is called when production opt_analyze is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_analyze(ctx *Opt_analyzeContext) {} + +// EnterOpt_verbose is called when production opt_verbose is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_verbose(ctx *Opt_verboseContext) {} + +// ExitOpt_verbose is called when production opt_verbose is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_verbose(ctx *Opt_verboseContext) {} + +// EnterOpt_full is called when production opt_full is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_full(ctx *Opt_fullContext) {} + +// ExitOpt_full is called when production opt_full is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_full(ctx *Opt_fullContext) {} + +// EnterOpt_freeze is called when production opt_freeze is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_freeze(ctx *Opt_freezeContext) {} + +// ExitOpt_freeze is called when production opt_freeze is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_freeze(ctx *Opt_freezeContext) {} + +// EnterOpt_name_list is called when production opt_name_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_name_list(ctx *Opt_name_listContext) {} + +// ExitOpt_name_list is called when production opt_name_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_name_list(ctx *Opt_name_listContext) {} + +// EnterVacuum_relation is called when production vacuum_relation is entered. +func (s *BasePostgreSQLParserListener) EnterVacuum_relation(ctx *Vacuum_relationContext) {} + +// ExitVacuum_relation is called when production vacuum_relation is exited. +func (s *BasePostgreSQLParserListener) ExitVacuum_relation(ctx *Vacuum_relationContext) {} + +// EnterVacuum_relation_list is called when production vacuum_relation_list is entered. +func (s *BasePostgreSQLParserListener) EnterVacuum_relation_list(ctx *Vacuum_relation_listContext) {} + +// ExitVacuum_relation_list is called when production vacuum_relation_list is exited. +func (s *BasePostgreSQLParserListener) ExitVacuum_relation_list(ctx *Vacuum_relation_listContext) {} + +// EnterOpt_vacuum_relation_list is called when production opt_vacuum_relation_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_vacuum_relation_list(ctx *Opt_vacuum_relation_listContext) { +} + +// ExitOpt_vacuum_relation_list is called when production opt_vacuum_relation_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_vacuum_relation_list(ctx *Opt_vacuum_relation_listContext) { +} + +// EnterExplainstmt is called when production explainstmt is entered. +func (s *BasePostgreSQLParserListener) EnterExplainstmt(ctx *ExplainstmtContext) {} + +// ExitExplainstmt is called when production explainstmt is exited. +func (s *BasePostgreSQLParserListener) ExitExplainstmt(ctx *ExplainstmtContext) {} + +// EnterExplainablestmt is called when production explainablestmt is entered. +func (s *BasePostgreSQLParserListener) EnterExplainablestmt(ctx *ExplainablestmtContext) {} + +// ExitExplainablestmt is called when production explainablestmt is exited. +func (s *BasePostgreSQLParserListener) ExitExplainablestmt(ctx *ExplainablestmtContext) {} + +// EnterExplain_option_list is called when production explain_option_list is entered. +func (s *BasePostgreSQLParserListener) EnterExplain_option_list(ctx *Explain_option_listContext) {} + +// ExitExplain_option_list is called when production explain_option_list is exited. +func (s *BasePostgreSQLParserListener) ExitExplain_option_list(ctx *Explain_option_listContext) {} + +// EnterExplain_option_elem is called when production explain_option_elem is entered. +func (s *BasePostgreSQLParserListener) EnterExplain_option_elem(ctx *Explain_option_elemContext) {} + +// ExitExplain_option_elem is called when production explain_option_elem is exited. +func (s *BasePostgreSQLParserListener) ExitExplain_option_elem(ctx *Explain_option_elemContext) {} + +// EnterExplain_option_name is called when production explain_option_name is entered. +func (s *BasePostgreSQLParserListener) EnterExplain_option_name(ctx *Explain_option_nameContext) {} + +// ExitExplain_option_name is called when production explain_option_name is exited. +func (s *BasePostgreSQLParserListener) ExitExplain_option_name(ctx *Explain_option_nameContext) {} + +// EnterExplain_option_arg is called when production explain_option_arg is entered. +func (s *BasePostgreSQLParserListener) EnterExplain_option_arg(ctx *Explain_option_argContext) {} + +// ExitExplain_option_arg is called when production explain_option_arg is exited. +func (s *BasePostgreSQLParserListener) ExitExplain_option_arg(ctx *Explain_option_argContext) {} + +// EnterPreparestmt is called when production preparestmt is entered. +func (s *BasePostgreSQLParserListener) EnterPreparestmt(ctx *PreparestmtContext) {} + +// ExitPreparestmt is called when production preparestmt is exited. +func (s *BasePostgreSQLParserListener) ExitPreparestmt(ctx *PreparestmtContext) {} + +// EnterPrep_type_clause is called when production prep_type_clause is entered. +func (s *BasePostgreSQLParserListener) EnterPrep_type_clause(ctx *Prep_type_clauseContext) {} + +// ExitPrep_type_clause is called when production prep_type_clause is exited. +func (s *BasePostgreSQLParserListener) ExitPrep_type_clause(ctx *Prep_type_clauseContext) {} + +// EnterPreparablestmt is called when production preparablestmt is entered. +func (s *BasePostgreSQLParserListener) EnterPreparablestmt(ctx *PreparablestmtContext) {} + +// ExitPreparablestmt is called when production preparablestmt is exited. +func (s *BasePostgreSQLParserListener) ExitPreparablestmt(ctx *PreparablestmtContext) {} + +// EnterExecutestmt is called when production executestmt is entered. +func (s *BasePostgreSQLParserListener) EnterExecutestmt(ctx *ExecutestmtContext) {} + +// ExitExecutestmt is called when production executestmt is exited. +func (s *BasePostgreSQLParserListener) ExitExecutestmt(ctx *ExecutestmtContext) {} + +// EnterExecute_param_clause is called when production execute_param_clause is entered. +func (s *BasePostgreSQLParserListener) EnterExecute_param_clause(ctx *Execute_param_clauseContext) {} + +// ExitExecute_param_clause is called when production execute_param_clause is exited. +func (s *BasePostgreSQLParserListener) ExitExecute_param_clause(ctx *Execute_param_clauseContext) {} + +// EnterDeallocatestmt is called when production deallocatestmt is entered. +func (s *BasePostgreSQLParserListener) EnterDeallocatestmt(ctx *DeallocatestmtContext) {} + +// ExitDeallocatestmt is called when production deallocatestmt is exited. +func (s *BasePostgreSQLParserListener) ExitDeallocatestmt(ctx *DeallocatestmtContext) {} + +// EnterInsertstmt is called when production insertstmt is entered. +func (s *BasePostgreSQLParserListener) EnterInsertstmt(ctx *InsertstmtContext) {} + +// ExitInsertstmt is called when production insertstmt is exited. +func (s *BasePostgreSQLParserListener) ExitInsertstmt(ctx *InsertstmtContext) {} + +// EnterInsert_target is called when production insert_target is entered. +func (s *BasePostgreSQLParserListener) EnterInsert_target(ctx *Insert_targetContext) {} + +// ExitInsert_target is called when production insert_target is exited. +func (s *BasePostgreSQLParserListener) ExitInsert_target(ctx *Insert_targetContext) {} + +// EnterInsert_rest is called when production insert_rest is entered. +func (s *BasePostgreSQLParserListener) EnterInsert_rest(ctx *Insert_restContext) {} + +// ExitInsert_rest is called when production insert_rest is exited. +func (s *BasePostgreSQLParserListener) ExitInsert_rest(ctx *Insert_restContext) {} + +// EnterOverride_kind is called when production override_kind is entered. +func (s *BasePostgreSQLParserListener) EnterOverride_kind(ctx *Override_kindContext) {} + +// ExitOverride_kind is called when production override_kind is exited. +func (s *BasePostgreSQLParserListener) ExitOverride_kind(ctx *Override_kindContext) {} + +// EnterInsert_column_list is called when production insert_column_list is entered. +func (s *BasePostgreSQLParserListener) EnterInsert_column_list(ctx *Insert_column_listContext) {} + +// ExitInsert_column_list is called when production insert_column_list is exited. +func (s *BasePostgreSQLParserListener) ExitInsert_column_list(ctx *Insert_column_listContext) {} + +// EnterInsert_column_item is called when production insert_column_item is entered. +func (s *BasePostgreSQLParserListener) EnterInsert_column_item(ctx *Insert_column_itemContext) {} + +// ExitInsert_column_item is called when production insert_column_item is exited. +func (s *BasePostgreSQLParserListener) ExitInsert_column_item(ctx *Insert_column_itemContext) {} + +// EnterOpt_on_conflict is called when production opt_on_conflict is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_on_conflict(ctx *Opt_on_conflictContext) {} + +// ExitOpt_on_conflict is called when production opt_on_conflict is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_on_conflict(ctx *Opt_on_conflictContext) {} + +// EnterOpt_conf_expr is called when production opt_conf_expr is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_conf_expr(ctx *Opt_conf_exprContext) {} + +// ExitOpt_conf_expr is called when production opt_conf_expr is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_conf_expr(ctx *Opt_conf_exprContext) {} + +// EnterReturning_clause is called when production returning_clause is entered. +func (s *BasePostgreSQLParserListener) EnterReturning_clause(ctx *Returning_clauseContext) {} + +// ExitReturning_clause is called when production returning_clause is exited. +func (s *BasePostgreSQLParserListener) ExitReturning_clause(ctx *Returning_clauseContext) {} + +// EnterMergestmt is called when production mergestmt is entered. +func (s *BasePostgreSQLParserListener) EnterMergestmt(ctx *MergestmtContext) {} + +// ExitMergestmt is called when production mergestmt is exited. +func (s *BasePostgreSQLParserListener) ExitMergestmt(ctx *MergestmtContext) {} + +// EnterMerge_insert_clause is called when production merge_insert_clause is entered. +func (s *BasePostgreSQLParserListener) EnterMerge_insert_clause(ctx *Merge_insert_clauseContext) {} + +// ExitMerge_insert_clause is called when production merge_insert_clause is exited. +func (s *BasePostgreSQLParserListener) ExitMerge_insert_clause(ctx *Merge_insert_clauseContext) {} + +// EnterMerge_update_clause is called when production merge_update_clause is entered. +func (s *BasePostgreSQLParserListener) EnterMerge_update_clause(ctx *Merge_update_clauseContext) {} + +// ExitMerge_update_clause is called when production merge_update_clause is exited. +func (s *BasePostgreSQLParserListener) ExitMerge_update_clause(ctx *Merge_update_clauseContext) {} + +// EnterMerge_delete_clause is called when production merge_delete_clause is entered. +func (s *BasePostgreSQLParserListener) EnterMerge_delete_clause(ctx *Merge_delete_clauseContext) {} + +// ExitMerge_delete_clause is called when production merge_delete_clause is exited. +func (s *BasePostgreSQLParserListener) ExitMerge_delete_clause(ctx *Merge_delete_clauseContext) {} + +// EnterDeletestmt is called when production deletestmt is entered. +func (s *BasePostgreSQLParserListener) EnterDeletestmt(ctx *DeletestmtContext) {} + +// ExitDeletestmt is called when production deletestmt is exited. +func (s *BasePostgreSQLParserListener) ExitDeletestmt(ctx *DeletestmtContext) {} + +// EnterUsing_clause is called when production using_clause is entered. +func (s *BasePostgreSQLParserListener) EnterUsing_clause(ctx *Using_clauseContext) {} + +// ExitUsing_clause is called when production using_clause is exited. +func (s *BasePostgreSQLParserListener) ExitUsing_clause(ctx *Using_clauseContext) {} + +// EnterLockstmt is called when production lockstmt is entered. +func (s *BasePostgreSQLParserListener) EnterLockstmt(ctx *LockstmtContext) {} + +// ExitLockstmt is called when production lockstmt is exited. +func (s *BasePostgreSQLParserListener) ExitLockstmt(ctx *LockstmtContext) {} + +// EnterOpt_lock is called when production opt_lock is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_lock(ctx *Opt_lockContext) {} + +// ExitOpt_lock is called when production opt_lock is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_lock(ctx *Opt_lockContext) {} + +// EnterLock_type is called when production lock_type is entered. +func (s *BasePostgreSQLParserListener) EnterLock_type(ctx *Lock_typeContext) {} + +// ExitLock_type is called when production lock_type is exited. +func (s *BasePostgreSQLParserListener) ExitLock_type(ctx *Lock_typeContext) {} + +// EnterOpt_nowait is called when production opt_nowait is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_nowait(ctx *Opt_nowaitContext) {} + +// ExitOpt_nowait is called when production opt_nowait is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_nowait(ctx *Opt_nowaitContext) {} + +// EnterOpt_nowait_or_skip is called when production opt_nowait_or_skip is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_nowait_or_skip(ctx *Opt_nowait_or_skipContext) {} + +// ExitOpt_nowait_or_skip is called when production opt_nowait_or_skip is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_nowait_or_skip(ctx *Opt_nowait_or_skipContext) {} + +// EnterUpdatestmt is called when production updatestmt is entered. +func (s *BasePostgreSQLParserListener) EnterUpdatestmt(ctx *UpdatestmtContext) {} + +// ExitUpdatestmt is called when production updatestmt is exited. +func (s *BasePostgreSQLParserListener) ExitUpdatestmt(ctx *UpdatestmtContext) {} + +// EnterSet_clause_list is called when production set_clause_list is entered. +func (s *BasePostgreSQLParserListener) EnterSet_clause_list(ctx *Set_clause_listContext) {} + +// ExitSet_clause_list is called when production set_clause_list is exited. +func (s *BasePostgreSQLParserListener) ExitSet_clause_list(ctx *Set_clause_listContext) {} + +// EnterSet_clause is called when production set_clause is entered. +func (s *BasePostgreSQLParserListener) EnterSet_clause(ctx *Set_clauseContext) {} + +// ExitSet_clause is called when production set_clause is exited. +func (s *BasePostgreSQLParserListener) ExitSet_clause(ctx *Set_clauseContext) {} + +// EnterSet_target is called when production set_target is entered. +func (s *BasePostgreSQLParserListener) EnterSet_target(ctx *Set_targetContext) {} + +// ExitSet_target is called when production set_target is exited. +func (s *BasePostgreSQLParserListener) ExitSet_target(ctx *Set_targetContext) {} + +// EnterSet_target_list is called when production set_target_list is entered. +func (s *BasePostgreSQLParserListener) EnterSet_target_list(ctx *Set_target_listContext) {} + +// ExitSet_target_list is called when production set_target_list is exited. +func (s *BasePostgreSQLParserListener) ExitSet_target_list(ctx *Set_target_listContext) {} + +// EnterDeclarecursorstmt is called when production declarecursorstmt is entered. +func (s *BasePostgreSQLParserListener) EnterDeclarecursorstmt(ctx *DeclarecursorstmtContext) {} + +// ExitDeclarecursorstmt is called when production declarecursorstmt is exited. +func (s *BasePostgreSQLParserListener) ExitDeclarecursorstmt(ctx *DeclarecursorstmtContext) {} + +// EnterCursor_name is called when production cursor_name is entered. +func (s *BasePostgreSQLParserListener) EnterCursor_name(ctx *Cursor_nameContext) {} + +// ExitCursor_name is called when production cursor_name is exited. +func (s *BasePostgreSQLParserListener) ExitCursor_name(ctx *Cursor_nameContext) {} + +// EnterCursor_options is called when production cursor_options is entered. +func (s *BasePostgreSQLParserListener) EnterCursor_options(ctx *Cursor_optionsContext) {} + +// ExitCursor_options is called when production cursor_options is exited. +func (s *BasePostgreSQLParserListener) ExitCursor_options(ctx *Cursor_optionsContext) {} + +// EnterOpt_hold is called when production opt_hold is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_hold(ctx *Opt_holdContext) {} + +// ExitOpt_hold is called when production opt_hold is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_hold(ctx *Opt_holdContext) {} + +// EnterSelectstmt is called when production selectstmt is entered. +func (s *BasePostgreSQLParserListener) EnterSelectstmt(ctx *SelectstmtContext) {} + +// ExitSelectstmt is called when production selectstmt is exited. +func (s *BasePostgreSQLParserListener) ExitSelectstmt(ctx *SelectstmtContext) {} + +// EnterSelect_with_parens is called when production select_with_parens is entered. +func (s *BasePostgreSQLParserListener) EnterSelect_with_parens(ctx *Select_with_parensContext) {} + +// ExitSelect_with_parens is called when production select_with_parens is exited. +func (s *BasePostgreSQLParserListener) ExitSelect_with_parens(ctx *Select_with_parensContext) {} + +// EnterSelect_no_parens is called when production select_no_parens is entered. +func (s *BasePostgreSQLParserListener) EnterSelect_no_parens(ctx *Select_no_parensContext) {} + +// ExitSelect_no_parens is called when production select_no_parens is exited. +func (s *BasePostgreSQLParserListener) ExitSelect_no_parens(ctx *Select_no_parensContext) {} + +// EnterSelect_clause is called when production select_clause is entered. +func (s *BasePostgreSQLParserListener) EnterSelect_clause(ctx *Select_clauseContext) {} + +// ExitSelect_clause is called when production select_clause is exited. +func (s *BasePostgreSQLParserListener) ExitSelect_clause(ctx *Select_clauseContext) {} + +// EnterSimple_select_intersect is called when production simple_select_intersect is entered. +func (s *BasePostgreSQLParserListener) EnterSimple_select_intersect(ctx *Simple_select_intersectContext) { +} + +// ExitSimple_select_intersect is called when production simple_select_intersect is exited. +func (s *BasePostgreSQLParserListener) ExitSimple_select_intersect(ctx *Simple_select_intersectContext) { +} + +// EnterSimple_select_pramary is called when production simple_select_pramary is entered. +func (s *BasePostgreSQLParserListener) EnterSimple_select_pramary(ctx *Simple_select_pramaryContext) { +} + +// ExitSimple_select_pramary is called when production simple_select_pramary is exited. +func (s *BasePostgreSQLParserListener) ExitSimple_select_pramary(ctx *Simple_select_pramaryContext) {} + +// EnterWith_clause is called when production with_clause is entered. +func (s *BasePostgreSQLParserListener) EnterWith_clause(ctx *With_clauseContext) {} + +// ExitWith_clause is called when production with_clause is exited. +func (s *BasePostgreSQLParserListener) ExitWith_clause(ctx *With_clauseContext) {} + +// EnterCte_list is called when production cte_list is entered. +func (s *BasePostgreSQLParserListener) EnterCte_list(ctx *Cte_listContext) {} + +// ExitCte_list is called when production cte_list is exited. +func (s *BasePostgreSQLParserListener) ExitCte_list(ctx *Cte_listContext) {} + +// EnterCommon_table_expr is called when production common_table_expr is entered. +func (s *BasePostgreSQLParserListener) EnterCommon_table_expr(ctx *Common_table_exprContext) {} + +// ExitCommon_table_expr is called when production common_table_expr is exited. +func (s *BasePostgreSQLParserListener) ExitCommon_table_expr(ctx *Common_table_exprContext) {} + +// EnterOpt_materialized is called when production opt_materialized is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_materialized(ctx *Opt_materializedContext) {} + +// ExitOpt_materialized is called when production opt_materialized is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_materialized(ctx *Opt_materializedContext) {} + +// EnterOpt_with_clause is called when production opt_with_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_with_clause(ctx *Opt_with_clauseContext) {} + +// ExitOpt_with_clause is called when production opt_with_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_with_clause(ctx *Opt_with_clauseContext) {} + +// EnterInto_clause is called when production into_clause is entered. +func (s *BasePostgreSQLParserListener) EnterInto_clause(ctx *Into_clauseContext) {} + +// ExitInto_clause is called when production into_clause is exited. +func (s *BasePostgreSQLParserListener) ExitInto_clause(ctx *Into_clauseContext) {} + +// EnterOpt_strict is called when production opt_strict is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_strict(ctx *Opt_strictContext) {} + +// ExitOpt_strict is called when production opt_strict is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_strict(ctx *Opt_strictContext) {} + +// EnterOpttempTableName is called when production opttempTableName is entered. +func (s *BasePostgreSQLParserListener) EnterOpttempTableName(ctx *OpttempTableNameContext) {} + +// ExitOpttempTableName is called when production opttempTableName is exited. +func (s *BasePostgreSQLParserListener) ExitOpttempTableName(ctx *OpttempTableNameContext) {} + +// EnterOpt_table is called when production opt_table is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_table(ctx *Opt_tableContext) {} + +// ExitOpt_table is called when production opt_table is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_table(ctx *Opt_tableContext) {} + +// EnterAll_or_distinct is called when production all_or_distinct is entered. +func (s *BasePostgreSQLParserListener) EnterAll_or_distinct(ctx *All_or_distinctContext) {} + +// ExitAll_or_distinct is called when production all_or_distinct is exited. +func (s *BasePostgreSQLParserListener) ExitAll_or_distinct(ctx *All_or_distinctContext) {} + +// EnterDistinct_clause is called when production distinct_clause is entered. +func (s *BasePostgreSQLParserListener) EnterDistinct_clause(ctx *Distinct_clauseContext) {} + +// ExitDistinct_clause is called when production distinct_clause is exited. +func (s *BasePostgreSQLParserListener) ExitDistinct_clause(ctx *Distinct_clauseContext) {} + +// EnterOpt_all_clause is called when production opt_all_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_all_clause(ctx *Opt_all_clauseContext) {} + +// ExitOpt_all_clause is called when production opt_all_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_all_clause(ctx *Opt_all_clauseContext) {} + +// EnterOpt_sort_clause is called when production opt_sort_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_sort_clause(ctx *Opt_sort_clauseContext) {} + +// ExitOpt_sort_clause is called when production opt_sort_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_sort_clause(ctx *Opt_sort_clauseContext) {} + +// EnterSort_clause is called when production sort_clause is entered. +func (s *BasePostgreSQLParserListener) EnterSort_clause(ctx *Sort_clauseContext) {} + +// ExitSort_clause is called when production sort_clause is exited. +func (s *BasePostgreSQLParserListener) ExitSort_clause(ctx *Sort_clauseContext) {} + +// EnterSortby_list is called when production sortby_list is entered. +func (s *BasePostgreSQLParserListener) EnterSortby_list(ctx *Sortby_listContext) {} + +// ExitSortby_list is called when production sortby_list is exited. +func (s *BasePostgreSQLParserListener) ExitSortby_list(ctx *Sortby_listContext) {} + +// EnterSortby is called when production sortby is entered. +func (s *BasePostgreSQLParserListener) EnterSortby(ctx *SortbyContext) {} + +// ExitSortby is called when production sortby is exited. +func (s *BasePostgreSQLParserListener) ExitSortby(ctx *SortbyContext) {} + +// EnterSelect_limit is called when production select_limit is entered. +func (s *BasePostgreSQLParserListener) EnterSelect_limit(ctx *Select_limitContext) {} + +// ExitSelect_limit is called when production select_limit is exited. +func (s *BasePostgreSQLParserListener) ExitSelect_limit(ctx *Select_limitContext) {} + +// EnterOpt_select_limit is called when production opt_select_limit is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_select_limit(ctx *Opt_select_limitContext) {} + +// ExitOpt_select_limit is called when production opt_select_limit is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_select_limit(ctx *Opt_select_limitContext) {} + +// EnterLimit_clause is called when production limit_clause is entered. +func (s *BasePostgreSQLParserListener) EnterLimit_clause(ctx *Limit_clauseContext) {} + +// ExitLimit_clause is called when production limit_clause is exited. +func (s *BasePostgreSQLParserListener) ExitLimit_clause(ctx *Limit_clauseContext) {} + +// EnterOffset_clause is called when production offset_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOffset_clause(ctx *Offset_clauseContext) {} + +// ExitOffset_clause is called when production offset_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOffset_clause(ctx *Offset_clauseContext) {} + +// EnterSelect_limit_value is called when production select_limit_value is entered. +func (s *BasePostgreSQLParserListener) EnterSelect_limit_value(ctx *Select_limit_valueContext) {} + +// ExitSelect_limit_value is called when production select_limit_value is exited. +func (s *BasePostgreSQLParserListener) ExitSelect_limit_value(ctx *Select_limit_valueContext) {} + +// EnterSelect_offset_value is called when production select_offset_value is entered. +func (s *BasePostgreSQLParserListener) EnterSelect_offset_value(ctx *Select_offset_valueContext) {} + +// ExitSelect_offset_value is called when production select_offset_value is exited. +func (s *BasePostgreSQLParserListener) ExitSelect_offset_value(ctx *Select_offset_valueContext) {} + +// EnterSelect_fetch_first_value is called when production select_fetch_first_value is entered. +func (s *BasePostgreSQLParserListener) EnterSelect_fetch_first_value(ctx *Select_fetch_first_valueContext) { +} + +// ExitSelect_fetch_first_value is called when production select_fetch_first_value is exited. +func (s *BasePostgreSQLParserListener) ExitSelect_fetch_first_value(ctx *Select_fetch_first_valueContext) { +} + +// EnterI_or_f_const is called when production i_or_f_const is entered. +func (s *BasePostgreSQLParserListener) EnterI_or_f_const(ctx *I_or_f_constContext) {} + +// ExitI_or_f_const is called when production i_or_f_const is exited. +func (s *BasePostgreSQLParserListener) ExitI_or_f_const(ctx *I_or_f_constContext) {} + +// EnterRow_or_rows is called when production row_or_rows is entered. +func (s *BasePostgreSQLParserListener) EnterRow_or_rows(ctx *Row_or_rowsContext) {} + +// ExitRow_or_rows is called when production row_or_rows is exited. +func (s *BasePostgreSQLParserListener) ExitRow_or_rows(ctx *Row_or_rowsContext) {} + +// EnterFirst_or_next is called when production first_or_next is entered. +func (s *BasePostgreSQLParserListener) EnterFirst_or_next(ctx *First_or_nextContext) {} + +// ExitFirst_or_next is called when production first_or_next is exited. +func (s *BasePostgreSQLParserListener) ExitFirst_or_next(ctx *First_or_nextContext) {} + +// EnterGroup_clause is called when production group_clause is entered. +func (s *BasePostgreSQLParserListener) EnterGroup_clause(ctx *Group_clauseContext) {} + +// ExitGroup_clause is called when production group_clause is exited. +func (s *BasePostgreSQLParserListener) ExitGroup_clause(ctx *Group_clauseContext) {} + +// EnterGroup_by_list is called when production group_by_list is entered. +func (s *BasePostgreSQLParserListener) EnterGroup_by_list(ctx *Group_by_listContext) {} + +// ExitGroup_by_list is called when production group_by_list is exited. +func (s *BasePostgreSQLParserListener) ExitGroup_by_list(ctx *Group_by_listContext) {} + +// EnterGroup_by_item is called when production group_by_item is entered. +func (s *BasePostgreSQLParserListener) EnterGroup_by_item(ctx *Group_by_itemContext) {} + +// ExitGroup_by_item is called when production group_by_item is exited. +func (s *BasePostgreSQLParserListener) ExitGroup_by_item(ctx *Group_by_itemContext) {} + +// EnterEmpty_grouping_set is called when production empty_grouping_set is entered. +func (s *BasePostgreSQLParserListener) EnterEmpty_grouping_set(ctx *Empty_grouping_setContext) {} + +// ExitEmpty_grouping_set is called when production empty_grouping_set is exited. +func (s *BasePostgreSQLParserListener) ExitEmpty_grouping_set(ctx *Empty_grouping_setContext) {} + +// EnterRollup_clause is called when production rollup_clause is entered. +func (s *BasePostgreSQLParserListener) EnterRollup_clause(ctx *Rollup_clauseContext) {} + +// ExitRollup_clause is called when production rollup_clause is exited. +func (s *BasePostgreSQLParserListener) ExitRollup_clause(ctx *Rollup_clauseContext) {} + +// EnterCube_clause is called when production cube_clause is entered. +func (s *BasePostgreSQLParserListener) EnterCube_clause(ctx *Cube_clauseContext) {} + +// ExitCube_clause is called when production cube_clause is exited. +func (s *BasePostgreSQLParserListener) ExitCube_clause(ctx *Cube_clauseContext) {} + +// EnterGrouping_sets_clause is called when production grouping_sets_clause is entered. +func (s *BasePostgreSQLParserListener) EnterGrouping_sets_clause(ctx *Grouping_sets_clauseContext) {} + +// ExitGrouping_sets_clause is called when production grouping_sets_clause is exited. +func (s *BasePostgreSQLParserListener) ExitGrouping_sets_clause(ctx *Grouping_sets_clauseContext) {} + +// EnterHaving_clause is called when production having_clause is entered. +func (s *BasePostgreSQLParserListener) EnterHaving_clause(ctx *Having_clauseContext) {} + +// ExitHaving_clause is called when production having_clause is exited. +func (s *BasePostgreSQLParserListener) ExitHaving_clause(ctx *Having_clauseContext) {} + +// EnterFor_locking_clause is called when production for_locking_clause is entered. +func (s *BasePostgreSQLParserListener) EnterFor_locking_clause(ctx *For_locking_clauseContext) {} + +// ExitFor_locking_clause is called when production for_locking_clause is exited. +func (s *BasePostgreSQLParserListener) ExitFor_locking_clause(ctx *For_locking_clauseContext) {} + +// EnterOpt_for_locking_clause is called when production opt_for_locking_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_for_locking_clause(ctx *Opt_for_locking_clauseContext) { +} + +// ExitOpt_for_locking_clause is called when production opt_for_locking_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_for_locking_clause(ctx *Opt_for_locking_clauseContext) { +} + +// EnterFor_locking_items is called when production for_locking_items is entered. +func (s *BasePostgreSQLParserListener) EnterFor_locking_items(ctx *For_locking_itemsContext) {} + +// ExitFor_locking_items is called when production for_locking_items is exited. +func (s *BasePostgreSQLParserListener) ExitFor_locking_items(ctx *For_locking_itemsContext) {} + +// EnterFor_locking_item is called when production for_locking_item is entered. +func (s *BasePostgreSQLParserListener) EnterFor_locking_item(ctx *For_locking_itemContext) {} + +// ExitFor_locking_item is called when production for_locking_item is exited. +func (s *BasePostgreSQLParserListener) ExitFor_locking_item(ctx *For_locking_itemContext) {} + +// EnterFor_locking_strength is called when production for_locking_strength is entered. +func (s *BasePostgreSQLParserListener) EnterFor_locking_strength(ctx *For_locking_strengthContext) {} + +// ExitFor_locking_strength is called when production for_locking_strength is exited. +func (s *BasePostgreSQLParserListener) ExitFor_locking_strength(ctx *For_locking_strengthContext) {} + +// EnterLocked_rels_list is called when production locked_rels_list is entered. +func (s *BasePostgreSQLParserListener) EnterLocked_rels_list(ctx *Locked_rels_listContext) {} + +// ExitLocked_rels_list is called when production locked_rels_list is exited. +func (s *BasePostgreSQLParserListener) ExitLocked_rels_list(ctx *Locked_rels_listContext) {} + +// EnterValues_clause is called when production values_clause is entered. +func (s *BasePostgreSQLParserListener) EnterValues_clause(ctx *Values_clauseContext) {} + +// ExitValues_clause is called when production values_clause is exited. +func (s *BasePostgreSQLParserListener) ExitValues_clause(ctx *Values_clauseContext) {} + +// EnterFrom_clause is called when production from_clause is entered. +func (s *BasePostgreSQLParserListener) EnterFrom_clause(ctx *From_clauseContext) {} + +// ExitFrom_clause is called when production from_clause is exited. +func (s *BasePostgreSQLParserListener) ExitFrom_clause(ctx *From_clauseContext) {} + +// EnterFrom_list is called when production from_list is entered. +func (s *BasePostgreSQLParserListener) EnterFrom_list(ctx *From_listContext) {} + +// ExitFrom_list is called when production from_list is exited. +func (s *BasePostgreSQLParserListener) ExitFrom_list(ctx *From_listContext) {} + +// EnterTable_ref is called when production table_ref is entered. +func (s *BasePostgreSQLParserListener) EnterTable_ref(ctx *Table_refContext) {} + +// ExitTable_ref is called when production table_ref is exited. +func (s *BasePostgreSQLParserListener) ExitTable_ref(ctx *Table_refContext) {} + +// EnterJoined_table is called when production joined_table is entered. +func (s *BasePostgreSQLParserListener) EnterJoined_table(ctx *Joined_tableContext) {} + +// ExitJoined_table is called when production joined_table is exited. +func (s *BasePostgreSQLParserListener) ExitJoined_table(ctx *Joined_tableContext) {} + +// EnterAlias_clause is called when production alias_clause is entered. +func (s *BasePostgreSQLParserListener) EnterAlias_clause(ctx *Alias_clauseContext) {} + +// ExitAlias_clause is called when production alias_clause is exited. +func (s *BasePostgreSQLParserListener) ExitAlias_clause(ctx *Alias_clauseContext) {} + +// EnterOpt_alias_clause is called when production opt_alias_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_alias_clause(ctx *Opt_alias_clauseContext) {} + +// ExitOpt_alias_clause is called when production opt_alias_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_alias_clause(ctx *Opt_alias_clauseContext) {} + +// EnterTable_alias_clause is called when production table_alias_clause is entered. +func (s *BasePostgreSQLParserListener) EnterTable_alias_clause(ctx *Table_alias_clauseContext) {} + +// ExitTable_alias_clause is called when production table_alias_clause is exited. +func (s *BasePostgreSQLParserListener) ExitTable_alias_clause(ctx *Table_alias_clauseContext) {} + +// EnterFunc_alias_clause is called when production func_alias_clause is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_alias_clause(ctx *Func_alias_clauseContext) {} + +// ExitFunc_alias_clause is called when production func_alias_clause is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_alias_clause(ctx *Func_alias_clauseContext) {} + +// EnterJoin_type is called when production join_type is entered. +func (s *BasePostgreSQLParserListener) EnterJoin_type(ctx *Join_typeContext) {} + +// ExitJoin_type is called when production join_type is exited. +func (s *BasePostgreSQLParserListener) ExitJoin_type(ctx *Join_typeContext) {} + +// EnterJoin_qual is called when production join_qual is entered. +func (s *BasePostgreSQLParserListener) EnterJoin_qual(ctx *Join_qualContext) {} + +// ExitJoin_qual is called when production join_qual is exited. +func (s *BasePostgreSQLParserListener) ExitJoin_qual(ctx *Join_qualContext) {} + +// EnterRelation_expr is called when production relation_expr is entered. +func (s *BasePostgreSQLParserListener) EnterRelation_expr(ctx *Relation_exprContext) {} + +// ExitRelation_expr is called when production relation_expr is exited. +func (s *BasePostgreSQLParserListener) ExitRelation_expr(ctx *Relation_exprContext) {} + +// EnterRelation_expr_list is called when production relation_expr_list is entered. +func (s *BasePostgreSQLParserListener) EnterRelation_expr_list(ctx *Relation_expr_listContext) {} + +// ExitRelation_expr_list is called when production relation_expr_list is exited. +func (s *BasePostgreSQLParserListener) ExitRelation_expr_list(ctx *Relation_expr_listContext) {} + +// EnterRelation_expr_opt_alias is called when production relation_expr_opt_alias is entered. +func (s *BasePostgreSQLParserListener) EnterRelation_expr_opt_alias(ctx *Relation_expr_opt_aliasContext) { +} + +// ExitRelation_expr_opt_alias is called when production relation_expr_opt_alias is exited. +func (s *BasePostgreSQLParserListener) ExitRelation_expr_opt_alias(ctx *Relation_expr_opt_aliasContext) { +} + +// EnterTablesample_clause is called when production tablesample_clause is entered. +func (s *BasePostgreSQLParserListener) EnterTablesample_clause(ctx *Tablesample_clauseContext) {} + +// ExitTablesample_clause is called when production tablesample_clause is exited. +func (s *BasePostgreSQLParserListener) ExitTablesample_clause(ctx *Tablesample_clauseContext) {} + +// EnterOpt_repeatable_clause is called when production opt_repeatable_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_repeatable_clause(ctx *Opt_repeatable_clauseContext) { +} + +// ExitOpt_repeatable_clause is called when production opt_repeatable_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_repeatable_clause(ctx *Opt_repeatable_clauseContext) {} + +// EnterFunc_table is called when production func_table is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_table(ctx *Func_tableContext) {} + +// ExitFunc_table is called when production func_table is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_table(ctx *Func_tableContext) {} + +// EnterRowsfrom_item is called when production rowsfrom_item is entered. +func (s *BasePostgreSQLParserListener) EnterRowsfrom_item(ctx *Rowsfrom_itemContext) {} + +// ExitRowsfrom_item is called when production rowsfrom_item is exited. +func (s *BasePostgreSQLParserListener) ExitRowsfrom_item(ctx *Rowsfrom_itemContext) {} + +// EnterRowsfrom_list is called when production rowsfrom_list is entered. +func (s *BasePostgreSQLParserListener) EnterRowsfrom_list(ctx *Rowsfrom_listContext) {} + +// ExitRowsfrom_list is called when production rowsfrom_list is exited. +func (s *BasePostgreSQLParserListener) ExitRowsfrom_list(ctx *Rowsfrom_listContext) {} + +// EnterOpt_col_def_list is called when production opt_col_def_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_col_def_list(ctx *Opt_col_def_listContext) {} + +// ExitOpt_col_def_list is called when production opt_col_def_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_col_def_list(ctx *Opt_col_def_listContext) {} + +// EnterOpt_ordinality is called when production opt_ordinality is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_ordinality(ctx *Opt_ordinalityContext) {} + +// ExitOpt_ordinality is called when production opt_ordinality is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_ordinality(ctx *Opt_ordinalityContext) {} + +// EnterWhere_clause is called when production where_clause is entered. +func (s *BasePostgreSQLParserListener) EnterWhere_clause(ctx *Where_clauseContext) {} + +// ExitWhere_clause is called when production where_clause is exited. +func (s *BasePostgreSQLParserListener) ExitWhere_clause(ctx *Where_clauseContext) {} + +// EnterWhere_or_current_clause is called when production where_or_current_clause is entered. +func (s *BasePostgreSQLParserListener) EnterWhere_or_current_clause(ctx *Where_or_current_clauseContext) { +} + +// ExitWhere_or_current_clause is called when production where_or_current_clause is exited. +func (s *BasePostgreSQLParserListener) ExitWhere_or_current_clause(ctx *Where_or_current_clauseContext) { +} + +// EnterOpttablefuncelementlist is called when production opttablefuncelementlist is entered. +func (s *BasePostgreSQLParserListener) EnterOpttablefuncelementlist(ctx *OpttablefuncelementlistContext) { +} + +// ExitOpttablefuncelementlist is called when production opttablefuncelementlist is exited. +func (s *BasePostgreSQLParserListener) ExitOpttablefuncelementlist(ctx *OpttablefuncelementlistContext) { +} + +// EnterTablefuncelementlist is called when production tablefuncelementlist is entered. +func (s *BasePostgreSQLParserListener) EnterTablefuncelementlist(ctx *TablefuncelementlistContext) {} + +// ExitTablefuncelementlist is called when production tablefuncelementlist is exited. +func (s *BasePostgreSQLParserListener) ExitTablefuncelementlist(ctx *TablefuncelementlistContext) {} + +// EnterTablefuncelement is called when production tablefuncelement is entered. +func (s *BasePostgreSQLParserListener) EnterTablefuncelement(ctx *TablefuncelementContext) {} + +// ExitTablefuncelement is called when production tablefuncelement is exited. +func (s *BasePostgreSQLParserListener) ExitTablefuncelement(ctx *TablefuncelementContext) {} + +// EnterXmltable is called when production xmltable is entered. +func (s *BasePostgreSQLParserListener) EnterXmltable(ctx *XmltableContext) {} + +// ExitXmltable is called when production xmltable is exited. +func (s *BasePostgreSQLParserListener) ExitXmltable(ctx *XmltableContext) {} + +// EnterXmltable_column_list is called when production xmltable_column_list is entered. +func (s *BasePostgreSQLParserListener) EnterXmltable_column_list(ctx *Xmltable_column_listContext) {} + +// ExitXmltable_column_list is called when production xmltable_column_list is exited. +func (s *BasePostgreSQLParserListener) ExitXmltable_column_list(ctx *Xmltable_column_listContext) {} + +// EnterXmltable_column_el is called when production xmltable_column_el is entered. +func (s *BasePostgreSQLParserListener) EnterXmltable_column_el(ctx *Xmltable_column_elContext) {} + +// ExitXmltable_column_el is called when production xmltable_column_el is exited. +func (s *BasePostgreSQLParserListener) ExitXmltable_column_el(ctx *Xmltable_column_elContext) {} + +// EnterXmltable_column_option_list is called when production xmltable_column_option_list is entered. +func (s *BasePostgreSQLParserListener) EnterXmltable_column_option_list(ctx *Xmltable_column_option_listContext) { +} + +// ExitXmltable_column_option_list is called when production xmltable_column_option_list is exited. +func (s *BasePostgreSQLParserListener) ExitXmltable_column_option_list(ctx *Xmltable_column_option_listContext) { +} + +// EnterXmltable_column_option_el is called when production xmltable_column_option_el is entered. +func (s *BasePostgreSQLParserListener) EnterXmltable_column_option_el(ctx *Xmltable_column_option_elContext) { +} + +// ExitXmltable_column_option_el is called when production xmltable_column_option_el is exited. +func (s *BasePostgreSQLParserListener) ExitXmltable_column_option_el(ctx *Xmltable_column_option_elContext) { +} + +// EnterXml_namespace_list is called when production xml_namespace_list is entered. +func (s *BasePostgreSQLParserListener) EnterXml_namespace_list(ctx *Xml_namespace_listContext) {} + +// ExitXml_namespace_list is called when production xml_namespace_list is exited. +func (s *BasePostgreSQLParserListener) ExitXml_namespace_list(ctx *Xml_namespace_listContext) {} + +// EnterXml_namespace_el is called when production xml_namespace_el is entered. +func (s *BasePostgreSQLParserListener) EnterXml_namespace_el(ctx *Xml_namespace_elContext) {} + +// ExitXml_namespace_el is called when production xml_namespace_el is exited. +func (s *BasePostgreSQLParserListener) ExitXml_namespace_el(ctx *Xml_namespace_elContext) {} + +// EnterTypename is called when production typename is entered. +func (s *BasePostgreSQLParserListener) EnterTypename(ctx *TypenameContext) {} + +// ExitTypename is called when production typename is exited. +func (s *BasePostgreSQLParserListener) ExitTypename(ctx *TypenameContext) {} + +// EnterOpt_array_bounds is called when production opt_array_bounds is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_array_bounds(ctx *Opt_array_boundsContext) {} + +// ExitOpt_array_bounds is called when production opt_array_bounds is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_array_bounds(ctx *Opt_array_boundsContext) {} + +// EnterSimpletypename is called when production simpletypename is entered. +func (s *BasePostgreSQLParserListener) EnterSimpletypename(ctx *SimpletypenameContext) {} + +// ExitSimpletypename is called when production simpletypename is exited. +func (s *BasePostgreSQLParserListener) ExitSimpletypename(ctx *SimpletypenameContext) {} + +// EnterConsttypename is called when production consttypename is entered. +func (s *BasePostgreSQLParserListener) EnterConsttypename(ctx *ConsttypenameContext) {} + +// ExitConsttypename is called when production consttypename is exited. +func (s *BasePostgreSQLParserListener) ExitConsttypename(ctx *ConsttypenameContext) {} + +// EnterGenerictype is called when production generictype is entered. +func (s *BasePostgreSQLParserListener) EnterGenerictype(ctx *GenerictypeContext) {} + +// ExitGenerictype is called when production generictype is exited. +func (s *BasePostgreSQLParserListener) ExitGenerictype(ctx *GenerictypeContext) {} + +// EnterOpt_type_modifiers is called when production opt_type_modifiers is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_type_modifiers(ctx *Opt_type_modifiersContext) {} + +// ExitOpt_type_modifiers is called when production opt_type_modifiers is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_type_modifiers(ctx *Opt_type_modifiersContext) {} + +// EnterNumeric is called when production numeric is entered. +func (s *BasePostgreSQLParserListener) EnterNumeric(ctx *NumericContext) {} + +// ExitNumeric is called when production numeric is exited. +func (s *BasePostgreSQLParserListener) ExitNumeric(ctx *NumericContext) {} + +// EnterOpt_float is called when production opt_float is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_float(ctx *Opt_floatContext) {} + +// ExitOpt_float is called when production opt_float is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_float(ctx *Opt_floatContext) {} + +// EnterBit is called when production bit is entered. +func (s *BasePostgreSQLParserListener) EnterBit(ctx *BitContext) {} + +// ExitBit is called when production bit is exited. +func (s *BasePostgreSQLParserListener) ExitBit(ctx *BitContext) {} + +// EnterConstbit is called when production constbit is entered. +func (s *BasePostgreSQLParserListener) EnterConstbit(ctx *ConstbitContext) {} + +// ExitConstbit is called when production constbit is exited. +func (s *BasePostgreSQLParserListener) ExitConstbit(ctx *ConstbitContext) {} + +// EnterBitwithlength is called when production bitwithlength is entered. +func (s *BasePostgreSQLParserListener) EnterBitwithlength(ctx *BitwithlengthContext) {} + +// ExitBitwithlength is called when production bitwithlength is exited. +func (s *BasePostgreSQLParserListener) ExitBitwithlength(ctx *BitwithlengthContext) {} + +// EnterBitwithoutlength is called when production bitwithoutlength is entered. +func (s *BasePostgreSQLParserListener) EnterBitwithoutlength(ctx *BitwithoutlengthContext) {} + +// ExitBitwithoutlength is called when production bitwithoutlength is exited. +func (s *BasePostgreSQLParserListener) ExitBitwithoutlength(ctx *BitwithoutlengthContext) {} + +// EnterCharacter is called when production character is entered. +func (s *BasePostgreSQLParserListener) EnterCharacter(ctx *CharacterContext) {} + +// ExitCharacter is called when production character is exited. +func (s *BasePostgreSQLParserListener) ExitCharacter(ctx *CharacterContext) {} + +// EnterConstcharacter is called when production constcharacter is entered. +func (s *BasePostgreSQLParserListener) EnterConstcharacter(ctx *ConstcharacterContext) {} + +// ExitConstcharacter is called when production constcharacter is exited. +func (s *BasePostgreSQLParserListener) ExitConstcharacter(ctx *ConstcharacterContext) {} + +// EnterCharacter_c is called when production character_c is entered. +func (s *BasePostgreSQLParserListener) EnterCharacter_c(ctx *Character_cContext) {} + +// ExitCharacter_c is called when production character_c is exited. +func (s *BasePostgreSQLParserListener) ExitCharacter_c(ctx *Character_cContext) {} + +// EnterOpt_varying is called when production opt_varying is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_varying(ctx *Opt_varyingContext) {} + +// ExitOpt_varying is called when production opt_varying is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_varying(ctx *Opt_varyingContext) {} + +// EnterConstdatetime is called when production constdatetime is entered. +func (s *BasePostgreSQLParserListener) EnterConstdatetime(ctx *ConstdatetimeContext) {} + +// ExitConstdatetime is called when production constdatetime is exited. +func (s *BasePostgreSQLParserListener) ExitConstdatetime(ctx *ConstdatetimeContext) {} + +// EnterConstinterval is called when production constinterval is entered. +func (s *BasePostgreSQLParserListener) EnterConstinterval(ctx *ConstintervalContext) {} + +// ExitConstinterval is called when production constinterval is exited. +func (s *BasePostgreSQLParserListener) ExitConstinterval(ctx *ConstintervalContext) {} + +// EnterOpt_timezone is called when production opt_timezone is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_timezone(ctx *Opt_timezoneContext) {} + +// ExitOpt_timezone is called when production opt_timezone is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_timezone(ctx *Opt_timezoneContext) {} + +// EnterOpt_interval is called when production opt_interval is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_interval(ctx *Opt_intervalContext) {} + +// ExitOpt_interval is called when production opt_interval is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_interval(ctx *Opt_intervalContext) {} + +// EnterInterval_second is called when production interval_second is entered. +func (s *BasePostgreSQLParserListener) EnterInterval_second(ctx *Interval_secondContext) {} + +// ExitInterval_second is called when production interval_second is exited. +func (s *BasePostgreSQLParserListener) ExitInterval_second(ctx *Interval_secondContext) {} + +// EnterOpt_escape is called when production opt_escape is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_escape(ctx *Opt_escapeContext) {} + +// ExitOpt_escape is called when production opt_escape is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_escape(ctx *Opt_escapeContext) {} + +// EnterA_expr is called when production a_expr is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr(ctx *A_exprContext) {} + +// ExitA_expr is called when production a_expr is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr(ctx *A_exprContext) {} + +// EnterA_expr_qual is called when production a_expr_qual is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_qual(ctx *A_expr_qualContext) {} + +// ExitA_expr_qual is called when production a_expr_qual is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_qual(ctx *A_expr_qualContext) {} + +// EnterA_expr_lessless is called when production a_expr_lessless is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_lessless(ctx *A_expr_lesslessContext) {} + +// ExitA_expr_lessless is called when production a_expr_lessless is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_lessless(ctx *A_expr_lesslessContext) {} + +// EnterA_expr_or is called when production a_expr_or is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_or(ctx *A_expr_orContext) {} + +// ExitA_expr_or is called when production a_expr_or is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_or(ctx *A_expr_orContext) {} + +// EnterA_expr_and is called when production a_expr_and is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_and(ctx *A_expr_andContext) {} + +// ExitA_expr_and is called when production a_expr_and is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_and(ctx *A_expr_andContext) {} + +// EnterA_expr_between is called when production a_expr_between is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_between(ctx *A_expr_betweenContext) {} + +// ExitA_expr_between is called when production a_expr_between is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_between(ctx *A_expr_betweenContext) {} + +// EnterA_expr_in is called when production a_expr_in is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_in(ctx *A_expr_inContext) {} + +// ExitA_expr_in is called when production a_expr_in is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_in(ctx *A_expr_inContext) {} + +// EnterA_expr_unary_not is called when production a_expr_unary_not is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_unary_not(ctx *A_expr_unary_notContext) {} + +// ExitA_expr_unary_not is called when production a_expr_unary_not is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_unary_not(ctx *A_expr_unary_notContext) {} + +// EnterA_expr_isnull is called when production a_expr_isnull is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_isnull(ctx *A_expr_isnullContext) {} + +// ExitA_expr_isnull is called when production a_expr_isnull is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_isnull(ctx *A_expr_isnullContext) {} + +// EnterA_expr_is_not is called when production a_expr_is_not is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_is_not(ctx *A_expr_is_notContext) {} + +// ExitA_expr_is_not is called when production a_expr_is_not is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_is_not(ctx *A_expr_is_notContext) {} + +// EnterA_expr_compare is called when production a_expr_compare is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_compare(ctx *A_expr_compareContext) {} + +// ExitA_expr_compare is called when production a_expr_compare is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_compare(ctx *A_expr_compareContext) {} + +// EnterA_expr_like is called when production a_expr_like is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_like(ctx *A_expr_likeContext) {} + +// ExitA_expr_like is called when production a_expr_like is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_like(ctx *A_expr_likeContext) {} + +// EnterA_expr_qual_op is called when production a_expr_qual_op is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_qual_op(ctx *A_expr_qual_opContext) {} + +// ExitA_expr_qual_op is called when production a_expr_qual_op is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_qual_op(ctx *A_expr_qual_opContext) {} + +// EnterA_expr_unary_qualop is called when production a_expr_unary_qualop is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_unary_qualop(ctx *A_expr_unary_qualopContext) {} + +// ExitA_expr_unary_qualop is called when production a_expr_unary_qualop is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_unary_qualop(ctx *A_expr_unary_qualopContext) {} + +// EnterA_expr_add is called when production a_expr_add is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_add(ctx *A_expr_addContext) {} + +// ExitA_expr_add is called when production a_expr_add is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_add(ctx *A_expr_addContext) {} + +// EnterA_expr_mul is called when production a_expr_mul is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_mul(ctx *A_expr_mulContext) {} + +// ExitA_expr_mul is called when production a_expr_mul is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_mul(ctx *A_expr_mulContext) {} + +// EnterA_expr_caret is called when production a_expr_caret is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_caret(ctx *A_expr_caretContext) {} + +// ExitA_expr_caret is called when production a_expr_caret is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_caret(ctx *A_expr_caretContext) {} + +// EnterA_expr_unary_sign is called when production a_expr_unary_sign is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_unary_sign(ctx *A_expr_unary_signContext) {} + +// ExitA_expr_unary_sign is called when production a_expr_unary_sign is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_unary_sign(ctx *A_expr_unary_signContext) {} + +// EnterA_expr_at_time_zone is called when production a_expr_at_time_zone is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_at_time_zone(ctx *A_expr_at_time_zoneContext) {} + +// ExitA_expr_at_time_zone is called when production a_expr_at_time_zone is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_at_time_zone(ctx *A_expr_at_time_zoneContext) {} + +// EnterA_expr_collate is called when production a_expr_collate is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_collate(ctx *A_expr_collateContext) {} + +// ExitA_expr_collate is called when production a_expr_collate is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_collate(ctx *A_expr_collateContext) {} + +// EnterA_expr_typecast is called when production a_expr_typecast is entered. +func (s *BasePostgreSQLParserListener) EnterA_expr_typecast(ctx *A_expr_typecastContext) {} + +// ExitA_expr_typecast is called when production a_expr_typecast is exited. +func (s *BasePostgreSQLParserListener) ExitA_expr_typecast(ctx *A_expr_typecastContext) {} + +// EnterB_expr is called when production b_expr is entered. +func (s *BasePostgreSQLParserListener) EnterB_expr(ctx *B_exprContext) {} + +// ExitB_expr is called when production b_expr is exited. +func (s *BasePostgreSQLParserListener) ExitB_expr(ctx *B_exprContext) {} + +// EnterC_expr_exists is called when production c_expr_exists is entered. +func (s *BasePostgreSQLParserListener) EnterC_expr_exists(ctx *C_expr_existsContext) {} + +// ExitC_expr_exists is called when production c_expr_exists is exited. +func (s *BasePostgreSQLParserListener) ExitC_expr_exists(ctx *C_expr_existsContext) {} + +// EnterC_expr_expr is called when production c_expr_expr is entered. +func (s *BasePostgreSQLParserListener) EnterC_expr_expr(ctx *C_expr_exprContext) {} + +// ExitC_expr_expr is called when production c_expr_expr is exited. +func (s *BasePostgreSQLParserListener) ExitC_expr_expr(ctx *C_expr_exprContext) {} + +// EnterC_expr_case is called when production c_expr_case is entered. +func (s *BasePostgreSQLParserListener) EnterC_expr_case(ctx *C_expr_caseContext) {} + +// ExitC_expr_case is called when production c_expr_case is exited. +func (s *BasePostgreSQLParserListener) ExitC_expr_case(ctx *C_expr_caseContext) {} + +// EnterPlsqlvariablename is called when production plsqlvariablename is entered. +func (s *BasePostgreSQLParserListener) EnterPlsqlvariablename(ctx *PlsqlvariablenameContext) {} + +// ExitPlsqlvariablename is called when production plsqlvariablename is exited. +func (s *BasePostgreSQLParserListener) ExitPlsqlvariablename(ctx *PlsqlvariablenameContext) {} + +// EnterFunc_application is called when production func_application is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_application(ctx *Func_applicationContext) {} + +// ExitFunc_application is called when production func_application is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_application(ctx *Func_applicationContext) {} + +// EnterFunc_expr is called when production func_expr is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_expr(ctx *Func_exprContext) {} + +// ExitFunc_expr is called when production func_expr is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_expr(ctx *Func_exprContext) {} + +// EnterFunc_expr_windowless is called when production func_expr_windowless is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_expr_windowless(ctx *Func_expr_windowlessContext) {} + +// ExitFunc_expr_windowless is called when production func_expr_windowless is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_expr_windowless(ctx *Func_expr_windowlessContext) {} + +// EnterFunc_expr_common_subexpr is called when production func_expr_common_subexpr is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_expr_common_subexpr(ctx *Func_expr_common_subexprContext) { +} + +// ExitFunc_expr_common_subexpr is called when production func_expr_common_subexpr is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_expr_common_subexpr(ctx *Func_expr_common_subexprContext) { +} + +// EnterXml_root_version is called when production xml_root_version is entered. +func (s *BasePostgreSQLParserListener) EnterXml_root_version(ctx *Xml_root_versionContext) {} + +// ExitXml_root_version is called when production xml_root_version is exited. +func (s *BasePostgreSQLParserListener) ExitXml_root_version(ctx *Xml_root_versionContext) {} + +// EnterOpt_xml_root_standalone is called when production opt_xml_root_standalone is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_xml_root_standalone(ctx *Opt_xml_root_standaloneContext) { +} + +// ExitOpt_xml_root_standalone is called when production opt_xml_root_standalone is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_xml_root_standalone(ctx *Opt_xml_root_standaloneContext) { +} + +// EnterXml_attributes is called when production xml_attributes is entered. +func (s *BasePostgreSQLParserListener) EnterXml_attributes(ctx *Xml_attributesContext) {} + +// ExitXml_attributes is called when production xml_attributes is exited. +func (s *BasePostgreSQLParserListener) ExitXml_attributes(ctx *Xml_attributesContext) {} + +// EnterXml_attribute_list is called when production xml_attribute_list is entered. +func (s *BasePostgreSQLParserListener) EnterXml_attribute_list(ctx *Xml_attribute_listContext) {} + +// ExitXml_attribute_list is called when production xml_attribute_list is exited. +func (s *BasePostgreSQLParserListener) ExitXml_attribute_list(ctx *Xml_attribute_listContext) {} + +// EnterXml_attribute_el is called when production xml_attribute_el is entered. +func (s *BasePostgreSQLParserListener) EnterXml_attribute_el(ctx *Xml_attribute_elContext) {} + +// ExitXml_attribute_el is called when production xml_attribute_el is exited. +func (s *BasePostgreSQLParserListener) ExitXml_attribute_el(ctx *Xml_attribute_elContext) {} + +// EnterDocument_or_content is called when production document_or_content is entered. +func (s *BasePostgreSQLParserListener) EnterDocument_or_content(ctx *Document_or_contentContext) {} + +// ExitDocument_or_content is called when production document_or_content is exited. +func (s *BasePostgreSQLParserListener) ExitDocument_or_content(ctx *Document_or_contentContext) {} + +// EnterXml_whitespace_option is called when production xml_whitespace_option is entered. +func (s *BasePostgreSQLParserListener) EnterXml_whitespace_option(ctx *Xml_whitespace_optionContext) { +} + +// ExitXml_whitespace_option is called when production xml_whitespace_option is exited. +func (s *BasePostgreSQLParserListener) ExitXml_whitespace_option(ctx *Xml_whitespace_optionContext) {} + +// EnterXmlexists_argument is called when production xmlexists_argument is entered. +func (s *BasePostgreSQLParserListener) EnterXmlexists_argument(ctx *Xmlexists_argumentContext) {} + +// ExitXmlexists_argument is called when production xmlexists_argument is exited. +func (s *BasePostgreSQLParserListener) ExitXmlexists_argument(ctx *Xmlexists_argumentContext) {} + +// EnterXml_passing_mech is called when production xml_passing_mech is entered. +func (s *BasePostgreSQLParserListener) EnterXml_passing_mech(ctx *Xml_passing_mechContext) {} + +// ExitXml_passing_mech is called when production xml_passing_mech is exited. +func (s *BasePostgreSQLParserListener) ExitXml_passing_mech(ctx *Xml_passing_mechContext) {} + +// EnterWithin_group_clause is called when production within_group_clause is entered. +func (s *BasePostgreSQLParserListener) EnterWithin_group_clause(ctx *Within_group_clauseContext) {} + +// ExitWithin_group_clause is called when production within_group_clause is exited. +func (s *BasePostgreSQLParserListener) ExitWithin_group_clause(ctx *Within_group_clauseContext) {} + +// EnterFilter_clause is called when production filter_clause is entered. +func (s *BasePostgreSQLParserListener) EnterFilter_clause(ctx *Filter_clauseContext) {} + +// ExitFilter_clause is called when production filter_clause is exited. +func (s *BasePostgreSQLParserListener) ExitFilter_clause(ctx *Filter_clauseContext) {} + +// EnterWindow_clause is called when production window_clause is entered. +func (s *BasePostgreSQLParserListener) EnterWindow_clause(ctx *Window_clauseContext) {} + +// ExitWindow_clause is called when production window_clause is exited. +func (s *BasePostgreSQLParserListener) ExitWindow_clause(ctx *Window_clauseContext) {} + +// EnterWindow_definition_list is called when production window_definition_list is entered. +func (s *BasePostgreSQLParserListener) EnterWindow_definition_list(ctx *Window_definition_listContext) { +} + +// ExitWindow_definition_list is called when production window_definition_list is exited. +func (s *BasePostgreSQLParserListener) ExitWindow_definition_list(ctx *Window_definition_listContext) { +} + +// EnterWindow_definition is called when production window_definition is entered. +func (s *BasePostgreSQLParserListener) EnterWindow_definition(ctx *Window_definitionContext) {} + +// ExitWindow_definition is called when production window_definition is exited. +func (s *BasePostgreSQLParserListener) ExitWindow_definition(ctx *Window_definitionContext) {} + +// EnterOver_clause is called when production over_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOver_clause(ctx *Over_clauseContext) {} + +// ExitOver_clause is called when production over_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOver_clause(ctx *Over_clauseContext) {} + +// EnterWindow_specification is called when production window_specification is entered. +func (s *BasePostgreSQLParserListener) EnterWindow_specification(ctx *Window_specificationContext) {} + +// ExitWindow_specification is called when production window_specification is exited. +func (s *BasePostgreSQLParserListener) ExitWindow_specification(ctx *Window_specificationContext) {} + +// EnterOpt_existing_window_name is called when production opt_existing_window_name is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_existing_window_name(ctx *Opt_existing_window_nameContext) { +} + +// ExitOpt_existing_window_name is called when production opt_existing_window_name is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_existing_window_name(ctx *Opt_existing_window_nameContext) { +} + +// EnterOpt_partition_clause is called when production opt_partition_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_partition_clause(ctx *Opt_partition_clauseContext) {} + +// ExitOpt_partition_clause is called when production opt_partition_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_partition_clause(ctx *Opt_partition_clauseContext) {} + +// EnterOpt_frame_clause is called when production opt_frame_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_frame_clause(ctx *Opt_frame_clauseContext) {} + +// ExitOpt_frame_clause is called when production opt_frame_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_frame_clause(ctx *Opt_frame_clauseContext) {} + +// EnterFrame_extent is called when production frame_extent is entered. +func (s *BasePostgreSQLParserListener) EnterFrame_extent(ctx *Frame_extentContext) {} + +// ExitFrame_extent is called when production frame_extent is exited. +func (s *BasePostgreSQLParserListener) ExitFrame_extent(ctx *Frame_extentContext) {} + +// EnterFrame_bound is called when production frame_bound is entered. +func (s *BasePostgreSQLParserListener) EnterFrame_bound(ctx *Frame_boundContext) {} + +// ExitFrame_bound is called when production frame_bound is exited. +func (s *BasePostgreSQLParserListener) ExitFrame_bound(ctx *Frame_boundContext) {} + +// EnterOpt_window_exclusion_clause is called when production opt_window_exclusion_clause is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_window_exclusion_clause(ctx *Opt_window_exclusion_clauseContext) { +} + +// ExitOpt_window_exclusion_clause is called when production opt_window_exclusion_clause is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_window_exclusion_clause(ctx *Opt_window_exclusion_clauseContext) { +} + +// EnterRow is called when production row is entered. +func (s *BasePostgreSQLParserListener) EnterRow(ctx *RowContext) {} + +// ExitRow is called when production row is exited. +func (s *BasePostgreSQLParserListener) ExitRow(ctx *RowContext) {} + +// EnterExplicit_row is called when production explicit_row is entered. +func (s *BasePostgreSQLParserListener) EnterExplicit_row(ctx *Explicit_rowContext) {} + +// ExitExplicit_row is called when production explicit_row is exited. +func (s *BasePostgreSQLParserListener) ExitExplicit_row(ctx *Explicit_rowContext) {} + +// EnterImplicit_row is called when production implicit_row is entered. +func (s *BasePostgreSQLParserListener) EnterImplicit_row(ctx *Implicit_rowContext) {} + +// ExitImplicit_row is called when production implicit_row is exited. +func (s *BasePostgreSQLParserListener) ExitImplicit_row(ctx *Implicit_rowContext) {} + +// EnterSub_type is called when production sub_type is entered. +func (s *BasePostgreSQLParserListener) EnterSub_type(ctx *Sub_typeContext) {} + +// ExitSub_type is called when production sub_type is exited. +func (s *BasePostgreSQLParserListener) ExitSub_type(ctx *Sub_typeContext) {} + +// EnterAll_op is called when production all_op is entered. +func (s *BasePostgreSQLParserListener) EnterAll_op(ctx *All_opContext) {} + +// ExitAll_op is called when production all_op is exited. +func (s *BasePostgreSQLParserListener) ExitAll_op(ctx *All_opContext) {} + +// EnterMathop is called when production mathop is entered. +func (s *BasePostgreSQLParserListener) EnterMathop(ctx *MathopContext) {} + +// ExitMathop is called when production mathop is exited. +func (s *BasePostgreSQLParserListener) ExitMathop(ctx *MathopContext) {} + +// EnterQual_op is called when production qual_op is entered. +func (s *BasePostgreSQLParserListener) EnterQual_op(ctx *Qual_opContext) {} + +// ExitQual_op is called when production qual_op is exited. +func (s *BasePostgreSQLParserListener) ExitQual_op(ctx *Qual_opContext) {} + +// EnterQual_all_op is called when production qual_all_op is entered. +func (s *BasePostgreSQLParserListener) EnterQual_all_op(ctx *Qual_all_opContext) {} + +// ExitQual_all_op is called when production qual_all_op is exited. +func (s *BasePostgreSQLParserListener) ExitQual_all_op(ctx *Qual_all_opContext) {} + +// EnterSubquery_Op is called when production subquery_Op is entered. +func (s *BasePostgreSQLParserListener) EnterSubquery_Op(ctx *Subquery_OpContext) {} + +// ExitSubquery_Op is called when production subquery_Op is exited. +func (s *BasePostgreSQLParserListener) ExitSubquery_Op(ctx *Subquery_OpContext) {} + +// EnterExpr_list is called when production expr_list is entered. +func (s *BasePostgreSQLParserListener) EnterExpr_list(ctx *Expr_listContext) {} + +// ExitExpr_list is called when production expr_list is exited. +func (s *BasePostgreSQLParserListener) ExitExpr_list(ctx *Expr_listContext) {} + +// EnterFunc_arg_list is called when production func_arg_list is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_arg_list(ctx *Func_arg_listContext) {} + +// ExitFunc_arg_list is called when production func_arg_list is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_arg_list(ctx *Func_arg_listContext) {} + +// EnterFunc_arg_expr is called when production func_arg_expr is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_arg_expr(ctx *Func_arg_exprContext) {} + +// ExitFunc_arg_expr is called when production func_arg_expr is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_arg_expr(ctx *Func_arg_exprContext) {} + +// EnterType_list is called when production type_list is entered. +func (s *BasePostgreSQLParserListener) EnterType_list(ctx *Type_listContext) {} + +// ExitType_list is called when production type_list is exited. +func (s *BasePostgreSQLParserListener) ExitType_list(ctx *Type_listContext) {} + +// EnterArray_expr is called when production array_expr is entered. +func (s *BasePostgreSQLParserListener) EnterArray_expr(ctx *Array_exprContext) {} + +// ExitArray_expr is called when production array_expr is exited. +func (s *BasePostgreSQLParserListener) ExitArray_expr(ctx *Array_exprContext) {} + +// EnterArray_expr_list is called when production array_expr_list is entered. +func (s *BasePostgreSQLParserListener) EnterArray_expr_list(ctx *Array_expr_listContext) {} + +// ExitArray_expr_list is called when production array_expr_list is exited. +func (s *BasePostgreSQLParserListener) ExitArray_expr_list(ctx *Array_expr_listContext) {} + +// EnterExtract_list is called when production extract_list is entered. +func (s *BasePostgreSQLParserListener) EnterExtract_list(ctx *Extract_listContext) {} + +// ExitExtract_list is called when production extract_list is exited. +func (s *BasePostgreSQLParserListener) ExitExtract_list(ctx *Extract_listContext) {} + +// EnterExtract_arg is called when production extract_arg is entered. +func (s *BasePostgreSQLParserListener) EnterExtract_arg(ctx *Extract_argContext) {} + +// ExitExtract_arg is called when production extract_arg is exited. +func (s *BasePostgreSQLParserListener) ExitExtract_arg(ctx *Extract_argContext) {} + +// EnterUnicode_normal_form is called when production unicode_normal_form is entered. +func (s *BasePostgreSQLParserListener) EnterUnicode_normal_form(ctx *Unicode_normal_formContext) {} + +// ExitUnicode_normal_form is called when production unicode_normal_form is exited. +func (s *BasePostgreSQLParserListener) ExitUnicode_normal_form(ctx *Unicode_normal_formContext) {} + +// EnterOverlay_list is called when production overlay_list is entered. +func (s *BasePostgreSQLParserListener) EnterOverlay_list(ctx *Overlay_listContext) {} + +// ExitOverlay_list is called when production overlay_list is exited. +func (s *BasePostgreSQLParserListener) ExitOverlay_list(ctx *Overlay_listContext) {} + +// EnterPosition_list is called when production position_list is entered. +func (s *BasePostgreSQLParserListener) EnterPosition_list(ctx *Position_listContext) {} + +// ExitPosition_list is called when production position_list is exited. +func (s *BasePostgreSQLParserListener) ExitPosition_list(ctx *Position_listContext) {} + +// EnterSubstr_list is called when production substr_list is entered. +func (s *BasePostgreSQLParserListener) EnterSubstr_list(ctx *Substr_listContext) {} + +// ExitSubstr_list is called when production substr_list is exited. +func (s *BasePostgreSQLParserListener) ExitSubstr_list(ctx *Substr_listContext) {} + +// EnterTrim_list is called when production trim_list is entered. +func (s *BasePostgreSQLParserListener) EnterTrim_list(ctx *Trim_listContext) {} + +// ExitTrim_list is called when production trim_list is exited. +func (s *BasePostgreSQLParserListener) ExitTrim_list(ctx *Trim_listContext) {} + +// EnterIn_expr_select is called when production in_expr_select is entered. +func (s *BasePostgreSQLParserListener) EnterIn_expr_select(ctx *In_expr_selectContext) {} + +// ExitIn_expr_select is called when production in_expr_select is exited. +func (s *BasePostgreSQLParserListener) ExitIn_expr_select(ctx *In_expr_selectContext) {} + +// EnterIn_expr_list is called when production in_expr_list is entered. +func (s *BasePostgreSQLParserListener) EnterIn_expr_list(ctx *In_expr_listContext) {} + +// ExitIn_expr_list is called when production in_expr_list is exited. +func (s *BasePostgreSQLParserListener) ExitIn_expr_list(ctx *In_expr_listContext) {} + +// EnterCase_expr is called when production case_expr is entered. +func (s *BasePostgreSQLParserListener) EnterCase_expr(ctx *Case_exprContext) {} + +// ExitCase_expr is called when production case_expr is exited. +func (s *BasePostgreSQLParserListener) ExitCase_expr(ctx *Case_exprContext) {} + +// EnterWhen_clause_list is called when production when_clause_list is entered. +func (s *BasePostgreSQLParserListener) EnterWhen_clause_list(ctx *When_clause_listContext) {} + +// ExitWhen_clause_list is called when production when_clause_list is exited. +func (s *BasePostgreSQLParserListener) ExitWhen_clause_list(ctx *When_clause_listContext) {} + +// EnterWhen_clause is called when production when_clause is entered. +func (s *BasePostgreSQLParserListener) EnterWhen_clause(ctx *When_clauseContext) {} + +// ExitWhen_clause is called when production when_clause is exited. +func (s *BasePostgreSQLParserListener) ExitWhen_clause(ctx *When_clauseContext) {} + +// EnterCase_default is called when production case_default is entered. +func (s *BasePostgreSQLParserListener) EnterCase_default(ctx *Case_defaultContext) {} + +// ExitCase_default is called when production case_default is exited. +func (s *BasePostgreSQLParserListener) ExitCase_default(ctx *Case_defaultContext) {} + +// EnterCase_arg is called when production case_arg is entered. +func (s *BasePostgreSQLParserListener) EnterCase_arg(ctx *Case_argContext) {} + +// ExitCase_arg is called when production case_arg is exited. +func (s *BasePostgreSQLParserListener) ExitCase_arg(ctx *Case_argContext) {} + +// EnterColumnref is called when production columnref is entered. +func (s *BasePostgreSQLParserListener) EnterColumnref(ctx *ColumnrefContext) {} + +// ExitColumnref is called when production columnref is exited. +func (s *BasePostgreSQLParserListener) ExitColumnref(ctx *ColumnrefContext) {} + +// EnterIndirection_el is called when production indirection_el is entered. +func (s *BasePostgreSQLParserListener) EnterIndirection_el(ctx *Indirection_elContext) {} + +// ExitIndirection_el is called when production indirection_el is exited. +func (s *BasePostgreSQLParserListener) ExitIndirection_el(ctx *Indirection_elContext) {} + +// EnterOpt_slice_bound is called when production opt_slice_bound is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_slice_bound(ctx *Opt_slice_boundContext) {} + +// ExitOpt_slice_bound is called when production opt_slice_bound is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_slice_bound(ctx *Opt_slice_boundContext) {} + +// EnterIndirection is called when production indirection is entered. +func (s *BasePostgreSQLParserListener) EnterIndirection(ctx *IndirectionContext) {} + +// ExitIndirection is called when production indirection is exited. +func (s *BasePostgreSQLParserListener) ExitIndirection(ctx *IndirectionContext) {} + +// EnterOpt_indirection is called when production opt_indirection is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_indirection(ctx *Opt_indirectionContext) {} + +// ExitOpt_indirection is called when production opt_indirection is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_indirection(ctx *Opt_indirectionContext) {} + +// EnterOpt_target_list is called when production opt_target_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_target_list(ctx *Opt_target_listContext) {} + +// ExitOpt_target_list is called when production opt_target_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_target_list(ctx *Opt_target_listContext) {} + +// EnterTarget_list is called when production target_list is entered. +func (s *BasePostgreSQLParserListener) EnterTarget_list(ctx *Target_listContext) {} + +// ExitTarget_list is called when production target_list is exited. +func (s *BasePostgreSQLParserListener) ExitTarget_list(ctx *Target_listContext) {} + +// EnterTarget_label is called when production target_label is entered. +func (s *BasePostgreSQLParserListener) EnterTarget_label(ctx *Target_labelContext) {} + +// ExitTarget_label is called when production target_label is exited. +func (s *BasePostgreSQLParserListener) ExitTarget_label(ctx *Target_labelContext) {} + +// EnterTarget_star is called when production target_star is entered. +func (s *BasePostgreSQLParserListener) EnterTarget_star(ctx *Target_starContext) {} + +// ExitTarget_star is called when production target_star is exited. +func (s *BasePostgreSQLParserListener) ExitTarget_star(ctx *Target_starContext) {} + +// EnterTarget_alias is called when production target_alias is entered. +func (s *BasePostgreSQLParserListener) EnterTarget_alias(ctx *Target_aliasContext) {} + +// ExitTarget_alias is called when production target_alias is exited. +func (s *BasePostgreSQLParserListener) ExitTarget_alias(ctx *Target_aliasContext) {} + +// EnterQualified_name_list is called when production qualified_name_list is entered. +func (s *BasePostgreSQLParserListener) EnterQualified_name_list(ctx *Qualified_name_listContext) {} + +// ExitQualified_name_list is called when production qualified_name_list is exited. +func (s *BasePostgreSQLParserListener) ExitQualified_name_list(ctx *Qualified_name_listContext) {} + +// EnterQualified_name is called when production qualified_name is entered. +func (s *BasePostgreSQLParserListener) EnterQualified_name(ctx *Qualified_nameContext) {} + +// ExitQualified_name is called when production qualified_name is exited. +func (s *BasePostgreSQLParserListener) ExitQualified_name(ctx *Qualified_nameContext) {} + +// EnterName_list is called when production name_list is entered. +func (s *BasePostgreSQLParserListener) EnterName_list(ctx *Name_listContext) {} + +// ExitName_list is called when production name_list is exited. +func (s *BasePostgreSQLParserListener) ExitName_list(ctx *Name_listContext) {} + +// EnterName is called when production name is entered. +func (s *BasePostgreSQLParserListener) EnterName(ctx *NameContext) {} + +// ExitName is called when production name is exited. +func (s *BasePostgreSQLParserListener) ExitName(ctx *NameContext) {} + +// EnterAttr_name is called when production attr_name is entered. +func (s *BasePostgreSQLParserListener) EnterAttr_name(ctx *Attr_nameContext) {} + +// ExitAttr_name is called when production attr_name is exited. +func (s *BasePostgreSQLParserListener) ExitAttr_name(ctx *Attr_nameContext) {} + +// EnterFile_name is called when production file_name is entered. +func (s *BasePostgreSQLParserListener) EnterFile_name(ctx *File_nameContext) {} + +// ExitFile_name is called when production file_name is exited. +func (s *BasePostgreSQLParserListener) ExitFile_name(ctx *File_nameContext) {} + +// EnterFunc_name is called when production func_name is entered. +func (s *BasePostgreSQLParserListener) EnterFunc_name(ctx *Func_nameContext) {} + +// ExitFunc_name is called when production func_name is exited. +func (s *BasePostgreSQLParserListener) ExitFunc_name(ctx *Func_nameContext) {} + +// EnterAexprconst is called when production aexprconst is entered. +func (s *BasePostgreSQLParserListener) EnterAexprconst(ctx *AexprconstContext) {} + +// ExitAexprconst is called when production aexprconst is exited. +func (s *BasePostgreSQLParserListener) ExitAexprconst(ctx *AexprconstContext) {} + +// EnterXconst is called when production xconst is entered. +func (s *BasePostgreSQLParserListener) EnterXconst(ctx *XconstContext) {} + +// ExitXconst is called when production xconst is exited. +func (s *BasePostgreSQLParserListener) ExitXconst(ctx *XconstContext) {} + +// EnterBconst is called when production bconst is entered. +func (s *BasePostgreSQLParserListener) EnterBconst(ctx *BconstContext) {} + +// ExitBconst is called when production bconst is exited. +func (s *BasePostgreSQLParserListener) ExitBconst(ctx *BconstContext) {} + +// EnterFconst is called when production fconst is entered. +func (s *BasePostgreSQLParserListener) EnterFconst(ctx *FconstContext) {} + +// ExitFconst is called when production fconst is exited. +func (s *BasePostgreSQLParserListener) ExitFconst(ctx *FconstContext) {} + +// EnterIconst is called when production iconst is entered. +func (s *BasePostgreSQLParserListener) EnterIconst(ctx *IconstContext) {} + +// ExitIconst is called when production iconst is exited. +func (s *BasePostgreSQLParserListener) ExitIconst(ctx *IconstContext) {} + +// EnterSconst is called when production sconst is entered. +func (s *BasePostgreSQLParserListener) EnterSconst(ctx *SconstContext) {} + +// ExitSconst is called when production sconst is exited. +func (s *BasePostgreSQLParserListener) ExitSconst(ctx *SconstContext) {} + +// EnterAnysconst is called when production anysconst is entered. +func (s *BasePostgreSQLParserListener) EnterAnysconst(ctx *AnysconstContext) {} + +// ExitAnysconst is called when production anysconst is exited. +func (s *BasePostgreSQLParserListener) ExitAnysconst(ctx *AnysconstContext) {} + +// EnterOpt_uescape is called when production opt_uescape is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_uescape(ctx *Opt_uescapeContext) {} + +// ExitOpt_uescape is called when production opt_uescape is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_uescape(ctx *Opt_uescapeContext) {} + +// EnterSignediconst is called when production signediconst is entered. +func (s *BasePostgreSQLParserListener) EnterSignediconst(ctx *SignediconstContext) {} + +// ExitSignediconst is called when production signediconst is exited. +func (s *BasePostgreSQLParserListener) ExitSignediconst(ctx *SignediconstContext) {} + +// EnterRoleid is called when production roleid is entered. +func (s *BasePostgreSQLParserListener) EnterRoleid(ctx *RoleidContext) {} + +// ExitRoleid is called when production roleid is exited. +func (s *BasePostgreSQLParserListener) ExitRoleid(ctx *RoleidContext) {} + +// EnterRolespec is called when production rolespec is entered. +func (s *BasePostgreSQLParserListener) EnterRolespec(ctx *RolespecContext) {} + +// ExitRolespec is called when production rolespec is exited. +func (s *BasePostgreSQLParserListener) ExitRolespec(ctx *RolespecContext) {} + +// EnterRole_list is called when production role_list is entered. +func (s *BasePostgreSQLParserListener) EnterRole_list(ctx *Role_listContext) {} + +// ExitRole_list is called when production role_list is exited. +func (s *BasePostgreSQLParserListener) ExitRole_list(ctx *Role_listContext) {} + +// EnterColid is called when production colid is entered. +func (s *BasePostgreSQLParserListener) EnterColid(ctx *ColidContext) {} + +// ExitColid is called when production colid is exited. +func (s *BasePostgreSQLParserListener) ExitColid(ctx *ColidContext) {} + +// EnterTable_alias is called when production table_alias is entered. +func (s *BasePostgreSQLParserListener) EnterTable_alias(ctx *Table_aliasContext) {} + +// ExitTable_alias is called when production table_alias is exited. +func (s *BasePostgreSQLParserListener) ExitTable_alias(ctx *Table_aliasContext) {} + +// EnterType_function_name is called when production type_function_name is entered. +func (s *BasePostgreSQLParserListener) EnterType_function_name(ctx *Type_function_nameContext) {} + +// ExitType_function_name is called when production type_function_name is exited. +func (s *BasePostgreSQLParserListener) ExitType_function_name(ctx *Type_function_nameContext) {} + +// EnterNonreservedword is called when production nonreservedword is entered. +func (s *BasePostgreSQLParserListener) EnterNonreservedword(ctx *NonreservedwordContext) {} + +// ExitNonreservedword is called when production nonreservedword is exited. +func (s *BasePostgreSQLParserListener) ExitNonreservedword(ctx *NonreservedwordContext) {} + +// EnterCollabel is called when production collabel is entered. +func (s *BasePostgreSQLParserListener) EnterCollabel(ctx *CollabelContext) {} + +// ExitCollabel is called when production collabel is exited. +func (s *BasePostgreSQLParserListener) ExitCollabel(ctx *CollabelContext) {} + +// EnterIdentifier is called when production identifier is entered. +func (s *BasePostgreSQLParserListener) EnterIdentifier(ctx *IdentifierContext) {} + +// ExitIdentifier is called when production identifier is exited. +func (s *BasePostgreSQLParserListener) ExitIdentifier(ctx *IdentifierContext) {} + +// EnterPlsqlidentifier is called when production plsqlidentifier is entered. +func (s *BasePostgreSQLParserListener) EnterPlsqlidentifier(ctx *PlsqlidentifierContext) {} + +// ExitPlsqlidentifier is called when production plsqlidentifier is exited. +func (s *BasePostgreSQLParserListener) ExitPlsqlidentifier(ctx *PlsqlidentifierContext) {} + +// EnterUnreserved_keyword is called when production unreserved_keyword is entered. +func (s *BasePostgreSQLParserListener) EnterUnreserved_keyword(ctx *Unreserved_keywordContext) {} + +// ExitUnreserved_keyword is called when production unreserved_keyword is exited. +func (s *BasePostgreSQLParserListener) ExitUnreserved_keyword(ctx *Unreserved_keywordContext) {} + +// EnterCol_name_keyword is called when production col_name_keyword is entered. +func (s *BasePostgreSQLParserListener) EnterCol_name_keyword(ctx *Col_name_keywordContext) {} + +// ExitCol_name_keyword is called when production col_name_keyword is exited. +func (s *BasePostgreSQLParserListener) ExitCol_name_keyword(ctx *Col_name_keywordContext) {} + +// EnterType_func_name_keyword is called when production type_func_name_keyword is entered. +func (s *BasePostgreSQLParserListener) EnterType_func_name_keyword(ctx *Type_func_name_keywordContext) { +} + +// ExitType_func_name_keyword is called when production type_func_name_keyword is exited. +func (s *BasePostgreSQLParserListener) ExitType_func_name_keyword(ctx *Type_func_name_keywordContext) { +} + +// EnterReserved_keyword is called when production reserved_keyword is entered. +func (s *BasePostgreSQLParserListener) EnterReserved_keyword(ctx *Reserved_keywordContext) {} + +// ExitReserved_keyword is called when production reserved_keyword is exited. +func (s *BasePostgreSQLParserListener) ExitReserved_keyword(ctx *Reserved_keywordContext) {} + +// EnterBuiltin_function_name is called when production builtin_function_name is entered. +func (s *BasePostgreSQLParserListener) EnterBuiltin_function_name(ctx *Builtin_function_nameContext) { +} + +// ExitBuiltin_function_name is called when production builtin_function_name is exited. +func (s *BasePostgreSQLParserListener) ExitBuiltin_function_name(ctx *Builtin_function_nameContext) {} + +// EnterPl_function is called when production pl_function is entered. +func (s *BasePostgreSQLParserListener) EnterPl_function(ctx *Pl_functionContext) {} + +// ExitPl_function is called when production pl_function is exited. +func (s *BasePostgreSQLParserListener) ExitPl_function(ctx *Pl_functionContext) {} + +// EnterComp_options is called when production comp_options is entered. +func (s *BasePostgreSQLParserListener) EnterComp_options(ctx *Comp_optionsContext) {} + +// ExitComp_options is called when production comp_options is exited. +func (s *BasePostgreSQLParserListener) ExitComp_options(ctx *Comp_optionsContext) {} + +// EnterComp_option is called when production comp_option is entered. +func (s *BasePostgreSQLParserListener) EnterComp_option(ctx *Comp_optionContext) {} + +// ExitComp_option is called when production comp_option is exited. +func (s *BasePostgreSQLParserListener) ExitComp_option(ctx *Comp_optionContext) {} + +// EnterSharp is called when production sharp is entered. +func (s *BasePostgreSQLParserListener) EnterSharp(ctx *SharpContext) {} + +// ExitSharp is called when production sharp is exited. +func (s *BasePostgreSQLParserListener) ExitSharp(ctx *SharpContext) {} + +// EnterOption_value is called when production option_value is entered. +func (s *BasePostgreSQLParserListener) EnterOption_value(ctx *Option_valueContext) {} + +// ExitOption_value is called when production option_value is exited. +func (s *BasePostgreSQLParserListener) ExitOption_value(ctx *Option_valueContext) {} + +// EnterOpt_semi is called when production opt_semi is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_semi(ctx *Opt_semiContext) {} + +// ExitOpt_semi is called when production opt_semi is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_semi(ctx *Opt_semiContext) {} + +// EnterPl_block is called when production pl_block is entered. +func (s *BasePostgreSQLParserListener) EnterPl_block(ctx *Pl_blockContext) {} + +// ExitPl_block is called when production pl_block is exited. +func (s *BasePostgreSQLParserListener) ExitPl_block(ctx *Pl_blockContext) {} + +// EnterDecl_sect is called when production decl_sect is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_sect(ctx *Decl_sectContext) {} + +// ExitDecl_sect is called when production decl_sect is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_sect(ctx *Decl_sectContext) {} + +// EnterDecl_start is called when production decl_start is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_start(ctx *Decl_startContext) {} + +// ExitDecl_start is called when production decl_start is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_start(ctx *Decl_startContext) {} + +// EnterDecl_stmts is called when production decl_stmts is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_stmts(ctx *Decl_stmtsContext) {} + +// ExitDecl_stmts is called when production decl_stmts is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_stmts(ctx *Decl_stmtsContext) {} + +// EnterLabel_decl is called when production label_decl is entered. +func (s *BasePostgreSQLParserListener) EnterLabel_decl(ctx *Label_declContext) {} + +// ExitLabel_decl is called when production label_decl is exited. +func (s *BasePostgreSQLParserListener) ExitLabel_decl(ctx *Label_declContext) {} + +// EnterDecl_stmt is called when production decl_stmt is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_stmt(ctx *Decl_stmtContext) {} + +// ExitDecl_stmt is called when production decl_stmt is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_stmt(ctx *Decl_stmtContext) {} + +// EnterDecl_statement is called when production decl_statement is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_statement(ctx *Decl_statementContext) {} + +// ExitDecl_statement is called when production decl_statement is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_statement(ctx *Decl_statementContext) {} + +// EnterOpt_scrollable is called when production opt_scrollable is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_scrollable(ctx *Opt_scrollableContext) {} + +// ExitOpt_scrollable is called when production opt_scrollable is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_scrollable(ctx *Opt_scrollableContext) {} + +// EnterDecl_cursor_query is called when production decl_cursor_query is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_cursor_query(ctx *Decl_cursor_queryContext) {} + +// ExitDecl_cursor_query is called when production decl_cursor_query is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_cursor_query(ctx *Decl_cursor_queryContext) {} + +// EnterDecl_cursor_args is called when production decl_cursor_args is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_cursor_args(ctx *Decl_cursor_argsContext) {} + +// ExitDecl_cursor_args is called when production decl_cursor_args is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_cursor_args(ctx *Decl_cursor_argsContext) {} + +// EnterDecl_cursor_arglist is called when production decl_cursor_arglist is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_cursor_arglist(ctx *Decl_cursor_arglistContext) {} + +// ExitDecl_cursor_arglist is called when production decl_cursor_arglist is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_cursor_arglist(ctx *Decl_cursor_arglistContext) {} + +// EnterDecl_cursor_arg is called when production decl_cursor_arg is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_cursor_arg(ctx *Decl_cursor_argContext) {} + +// ExitDecl_cursor_arg is called when production decl_cursor_arg is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_cursor_arg(ctx *Decl_cursor_argContext) {} + +// EnterDecl_is_for is called when production decl_is_for is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_is_for(ctx *Decl_is_forContext) {} + +// ExitDecl_is_for is called when production decl_is_for is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_is_for(ctx *Decl_is_forContext) {} + +// EnterDecl_aliasitem is called when production decl_aliasitem is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_aliasitem(ctx *Decl_aliasitemContext) {} + +// ExitDecl_aliasitem is called when production decl_aliasitem is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_aliasitem(ctx *Decl_aliasitemContext) {} + +// EnterDecl_varname is called when production decl_varname is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_varname(ctx *Decl_varnameContext) {} + +// ExitDecl_varname is called when production decl_varname is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_varname(ctx *Decl_varnameContext) {} + +// EnterDecl_const is called when production decl_const is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_const(ctx *Decl_constContext) {} + +// ExitDecl_const is called when production decl_const is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_const(ctx *Decl_constContext) {} + +// EnterDecl_datatype is called when production decl_datatype is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_datatype(ctx *Decl_datatypeContext) {} + +// ExitDecl_datatype is called when production decl_datatype is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_datatype(ctx *Decl_datatypeContext) {} + +// EnterDecl_collate is called when production decl_collate is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_collate(ctx *Decl_collateContext) {} + +// ExitDecl_collate is called when production decl_collate is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_collate(ctx *Decl_collateContext) {} + +// EnterDecl_notnull is called when production decl_notnull is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_notnull(ctx *Decl_notnullContext) {} + +// ExitDecl_notnull is called when production decl_notnull is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_notnull(ctx *Decl_notnullContext) {} + +// EnterDecl_defval is called when production decl_defval is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_defval(ctx *Decl_defvalContext) {} + +// ExitDecl_defval is called when production decl_defval is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_defval(ctx *Decl_defvalContext) {} + +// EnterDecl_defkey is called when production decl_defkey is entered. +func (s *BasePostgreSQLParserListener) EnterDecl_defkey(ctx *Decl_defkeyContext) {} + +// ExitDecl_defkey is called when production decl_defkey is exited. +func (s *BasePostgreSQLParserListener) ExitDecl_defkey(ctx *Decl_defkeyContext) {} + +// EnterAssign_operator is called when production assign_operator is entered. +func (s *BasePostgreSQLParserListener) EnterAssign_operator(ctx *Assign_operatorContext) {} + +// ExitAssign_operator is called when production assign_operator is exited. +func (s *BasePostgreSQLParserListener) ExitAssign_operator(ctx *Assign_operatorContext) {} + +// EnterProc_sect is called when production proc_sect is entered. +func (s *BasePostgreSQLParserListener) EnterProc_sect(ctx *Proc_sectContext) {} + +// ExitProc_sect is called when production proc_sect is exited. +func (s *BasePostgreSQLParserListener) ExitProc_sect(ctx *Proc_sectContext) {} + +// EnterProc_stmt is called when production proc_stmt is entered. +func (s *BasePostgreSQLParserListener) EnterProc_stmt(ctx *Proc_stmtContext) {} + +// ExitProc_stmt is called when production proc_stmt is exited. +func (s *BasePostgreSQLParserListener) ExitProc_stmt(ctx *Proc_stmtContext) {} + +// EnterStmt_perform is called when production stmt_perform is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_perform(ctx *Stmt_performContext) {} + +// ExitStmt_perform is called when production stmt_perform is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_perform(ctx *Stmt_performContext) {} + +// EnterStmt_call is called when production stmt_call is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_call(ctx *Stmt_callContext) {} + +// ExitStmt_call is called when production stmt_call is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_call(ctx *Stmt_callContext) {} + +// EnterOpt_expr_list is called when production opt_expr_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_expr_list(ctx *Opt_expr_listContext) {} + +// ExitOpt_expr_list is called when production opt_expr_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_expr_list(ctx *Opt_expr_listContext) {} + +// EnterStmt_assign is called when production stmt_assign is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_assign(ctx *Stmt_assignContext) {} + +// ExitStmt_assign is called when production stmt_assign is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_assign(ctx *Stmt_assignContext) {} + +// EnterStmt_getdiag is called when production stmt_getdiag is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_getdiag(ctx *Stmt_getdiagContext) {} + +// ExitStmt_getdiag is called when production stmt_getdiag is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_getdiag(ctx *Stmt_getdiagContext) {} + +// EnterGetdiag_area_opt is called when production getdiag_area_opt is entered. +func (s *BasePostgreSQLParserListener) EnterGetdiag_area_opt(ctx *Getdiag_area_optContext) {} + +// ExitGetdiag_area_opt is called when production getdiag_area_opt is exited. +func (s *BasePostgreSQLParserListener) ExitGetdiag_area_opt(ctx *Getdiag_area_optContext) {} + +// EnterGetdiag_list is called when production getdiag_list is entered. +func (s *BasePostgreSQLParserListener) EnterGetdiag_list(ctx *Getdiag_listContext) {} + +// ExitGetdiag_list is called when production getdiag_list is exited. +func (s *BasePostgreSQLParserListener) ExitGetdiag_list(ctx *Getdiag_listContext) {} + +// EnterGetdiag_list_item is called when production getdiag_list_item is entered. +func (s *BasePostgreSQLParserListener) EnterGetdiag_list_item(ctx *Getdiag_list_itemContext) {} + +// ExitGetdiag_list_item is called when production getdiag_list_item is exited. +func (s *BasePostgreSQLParserListener) ExitGetdiag_list_item(ctx *Getdiag_list_itemContext) {} + +// EnterGetdiag_item is called when production getdiag_item is entered. +func (s *BasePostgreSQLParserListener) EnterGetdiag_item(ctx *Getdiag_itemContext) {} + +// ExitGetdiag_item is called when production getdiag_item is exited. +func (s *BasePostgreSQLParserListener) ExitGetdiag_item(ctx *Getdiag_itemContext) {} + +// EnterGetdiag_target is called when production getdiag_target is entered. +func (s *BasePostgreSQLParserListener) EnterGetdiag_target(ctx *Getdiag_targetContext) {} + +// ExitGetdiag_target is called when production getdiag_target is exited. +func (s *BasePostgreSQLParserListener) ExitGetdiag_target(ctx *Getdiag_targetContext) {} + +// EnterAssign_var is called when production assign_var is entered. +func (s *BasePostgreSQLParserListener) EnterAssign_var(ctx *Assign_varContext) {} + +// ExitAssign_var is called when production assign_var is exited. +func (s *BasePostgreSQLParserListener) ExitAssign_var(ctx *Assign_varContext) {} + +// EnterStmt_if is called when production stmt_if is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_if(ctx *Stmt_ifContext) {} + +// ExitStmt_if is called when production stmt_if is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_if(ctx *Stmt_ifContext) {} + +// EnterStmt_elsifs is called when production stmt_elsifs is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_elsifs(ctx *Stmt_elsifsContext) {} + +// ExitStmt_elsifs is called when production stmt_elsifs is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_elsifs(ctx *Stmt_elsifsContext) {} + +// EnterStmt_else is called when production stmt_else is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_else(ctx *Stmt_elseContext) {} + +// ExitStmt_else is called when production stmt_else is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_else(ctx *Stmt_elseContext) {} + +// EnterStmt_case is called when production stmt_case is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_case(ctx *Stmt_caseContext) {} + +// ExitStmt_case is called when production stmt_case is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_case(ctx *Stmt_caseContext) {} + +// EnterOpt_expr_until_when is called when production opt_expr_until_when is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_expr_until_when(ctx *Opt_expr_until_whenContext) {} + +// ExitOpt_expr_until_when is called when production opt_expr_until_when is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_expr_until_when(ctx *Opt_expr_until_whenContext) {} + +// EnterCase_when_list is called when production case_when_list is entered. +func (s *BasePostgreSQLParserListener) EnterCase_when_list(ctx *Case_when_listContext) {} + +// ExitCase_when_list is called when production case_when_list is exited. +func (s *BasePostgreSQLParserListener) ExitCase_when_list(ctx *Case_when_listContext) {} + +// EnterCase_when is called when production case_when is entered. +func (s *BasePostgreSQLParserListener) EnterCase_when(ctx *Case_whenContext) {} + +// ExitCase_when is called when production case_when is exited. +func (s *BasePostgreSQLParserListener) ExitCase_when(ctx *Case_whenContext) {} + +// EnterOpt_case_else is called when production opt_case_else is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_case_else(ctx *Opt_case_elseContext) {} + +// ExitOpt_case_else is called when production opt_case_else is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_case_else(ctx *Opt_case_elseContext) {} + +// EnterStmt_loop is called when production stmt_loop is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_loop(ctx *Stmt_loopContext) {} + +// ExitStmt_loop is called when production stmt_loop is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_loop(ctx *Stmt_loopContext) {} + +// EnterStmt_while is called when production stmt_while is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_while(ctx *Stmt_whileContext) {} + +// ExitStmt_while is called when production stmt_while is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_while(ctx *Stmt_whileContext) {} + +// EnterStmt_for is called when production stmt_for is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_for(ctx *Stmt_forContext) {} + +// ExitStmt_for is called when production stmt_for is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_for(ctx *Stmt_forContext) {} + +// EnterFor_control is called when production for_control is entered. +func (s *BasePostgreSQLParserListener) EnterFor_control(ctx *For_controlContext) {} + +// ExitFor_control is called when production for_control is exited. +func (s *BasePostgreSQLParserListener) ExitFor_control(ctx *For_controlContext) {} + +// EnterOpt_for_using_expression is called when production opt_for_using_expression is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_for_using_expression(ctx *Opt_for_using_expressionContext) { +} + +// ExitOpt_for_using_expression is called when production opt_for_using_expression is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_for_using_expression(ctx *Opt_for_using_expressionContext) { +} + +// EnterOpt_cursor_parameters is called when production opt_cursor_parameters is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_cursor_parameters(ctx *Opt_cursor_parametersContext) { +} + +// ExitOpt_cursor_parameters is called when production opt_cursor_parameters is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_cursor_parameters(ctx *Opt_cursor_parametersContext) {} + +// EnterOpt_reverse is called when production opt_reverse is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_reverse(ctx *Opt_reverseContext) {} + +// ExitOpt_reverse is called when production opt_reverse is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_reverse(ctx *Opt_reverseContext) {} + +// EnterOpt_by_expression is called when production opt_by_expression is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_by_expression(ctx *Opt_by_expressionContext) {} + +// ExitOpt_by_expression is called when production opt_by_expression is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_by_expression(ctx *Opt_by_expressionContext) {} + +// EnterFor_variable is called when production for_variable is entered. +func (s *BasePostgreSQLParserListener) EnterFor_variable(ctx *For_variableContext) {} + +// ExitFor_variable is called when production for_variable is exited. +func (s *BasePostgreSQLParserListener) ExitFor_variable(ctx *For_variableContext) {} + +// EnterStmt_foreach_a is called when production stmt_foreach_a is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_foreach_a(ctx *Stmt_foreach_aContext) {} + +// ExitStmt_foreach_a is called when production stmt_foreach_a is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_foreach_a(ctx *Stmt_foreach_aContext) {} + +// EnterForeach_slice is called when production foreach_slice is entered. +func (s *BasePostgreSQLParserListener) EnterForeach_slice(ctx *Foreach_sliceContext) {} + +// ExitForeach_slice is called when production foreach_slice is exited. +func (s *BasePostgreSQLParserListener) ExitForeach_slice(ctx *Foreach_sliceContext) {} + +// EnterStmt_exit is called when production stmt_exit is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_exit(ctx *Stmt_exitContext) {} + +// ExitStmt_exit is called when production stmt_exit is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_exit(ctx *Stmt_exitContext) {} + +// EnterExit_type is called when production exit_type is entered. +func (s *BasePostgreSQLParserListener) EnterExit_type(ctx *Exit_typeContext) {} + +// ExitExit_type is called when production exit_type is exited. +func (s *BasePostgreSQLParserListener) ExitExit_type(ctx *Exit_typeContext) {} + +// EnterStmt_return is called when production stmt_return is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_return(ctx *Stmt_returnContext) {} + +// ExitStmt_return is called when production stmt_return is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_return(ctx *Stmt_returnContext) {} + +// EnterOpt_return_result is called when production opt_return_result is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_return_result(ctx *Opt_return_resultContext) {} + +// ExitOpt_return_result is called when production opt_return_result is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_return_result(ctx *Opt_return_resultContext) {} + +// EnterStmt_raise is called when production stmt_raise is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_raise(ctx *Stmt_raiseContext) {} + +// ExitStmt_raise is called when production stmt_raise is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_raise(ctx *Stmt_raiseContext) {} + +// EnterOpt_stmt_raise_level is called when production opt_stmt_raise_level is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_stmt_raise_level(ctx *Opt_stmt_raise_levelContext) {} + +// ExitOpt_stmt_raise_level is called when production opt_stmt_raise_level is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_stmt_raise_level(ctx *Opt_stmt_raise_levelContext) {} + +// EnterOpt_raise_list is called when production opt_raise_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_raise_list(ctx *Opt_raise_listContext) {} + +// ExitOpt_raise_list is called when production opt_raise_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_raise_list(ctx *Opt_raise_listContext) {} + +// EnterOpt_raise_using is called when production opt_raise_using is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_raise_using(ctx *Opt_raise_usingContext) {} + +// ExitOpt_raise_using is called when production opt_raise_using is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_raise_using(ctx *Opt_raise_usingContext) {} + +// EnterOpt_raise_using_elem is called when production opt_raise_using_elem is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_raise_using_elem(ctx *Opt_raise_using_elemContext) {} + +// ExitOpt_raise_using_elem is called when production opt_raise_using_elem is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_raise_using_elem(ctx *Opt_raise_using_elemContext) {} + +// EnterOpt_raise_using_elem_list is called when production opt_raise_using_elem_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_raise_using_elem_list(ctx *Opt_raise_using_elem_listContext) { +} + +// ExitOpt_raise_using_elem_list is called when production opt_raise_using_elem_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_raise_using_elem_list(ctx *Opt_raise_using_elem_listContext) { +} + +// EnterStmt_assert is called when production stmt_assert is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_assert(ctx *Stmt_assertContext) {} + +// ExitStmt_assert is called when production stmt_assert is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_assert(ctx *Stmt_assertContext) {} + +// EnterOpt_stmt_assert_message is called when production opt_stmt_assert_message is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_stmt_assert_message(ctx *Opt_stmt_assert_messageContext) { +} + +// ExitOpt_stmt_assert_message is called when production opt_stmt_assert_message is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_stmt_assert_message(ctx *Opt_stmt_assert_messageContext) { +} + +// EnterLoop_body is called when production loop_body is entered. +func (s *BasePostgreSQLParserListener) EnterLoop_body(ctx *Loop_bodyContext) {} + +// ExitLoop_body is called when production loop_body is exited. +func (s *BasePostgreSQLParserListener) ExitLoop_body(ctx *Loop_bodyContext) {} + +// EnterStmt_execsql is called when production stmt_execsql is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_execsql(ctx *Stmt_execsqlContext) {} + +// ExitStmt_execsql is called when production stmt_execsql is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_execsql(ctx *Stmt_execsqlContext) {} + +// EnterStmt_dynexecute is called when production stmt_dynexecute is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_dynexecute(ctx *Stmt_dynexecuteContext) {} + +// ExitStmt_dynexecute is called when production stmt_dynexecute is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_dynexecute(ctx *Stmt_dynexecuteContext) {} + +// EnterOpt_execute_using is called when production opt_execute_using is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_execute_using(ctx *Opt_execute_usingContext) {} + +// ExitOpt_execute_using is called when production opt_execute_using is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_execute_using(ctx *Opt_execute_usingContext) {} + +// EnterOpt_execute_using_list is called when production opt_execute_using_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_execute_using_list(ctx *Opt_execute_using_listContext) { +} + +// ExitOpt_execute_using_list is called when production opt_execute_using_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_execute_using_list(ctx *Opt_execute_using_listContext) { +} + +// EnterOpt_execute_into is called when production opt_execute_into is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_execute_into(ctx *Opt_execute_intoContext) {} + +// ExitOpt_execute_into is called when production opt_execute_into is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_execute_into(ctx *Opt_execute_intoContext) {} + +// EnterStmt_open is called when production stmt_open is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_open(ctx *Stmt_openContext) {} + +// ExitStmt_open is called when production stmt_open is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_open(ctx *Stmt_openContext) {} + +// EnterOpt_open_bound_list_item is called when production opt_open_bound_list_item is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_open_bound_list_item(ctx *Opt_open_bound_list_itemContext) { +} + +// ExitOpt_open_bound_list_item is called when production opt_open_bound_list_item is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_open_bound_list_item(ctx *Opt_open_bound_list_itemContext) { +} + +// EnterOpt_open_bound_list is called when production opt_open_bound_list is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_open_bound_list(ctx *Opt_open_bound_listContext) {} + +// ExitOpt_open_bound_list is called when production opt_open_bound_list is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_open_bound_list(ctx *Opt_open_bound_listContext) {} + +// EnterOpt_open_using is called when production opt_open_using is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_open_using(ctx *Opt_open_usingContext) {} + +// ExitOpt_open_using is called when production opt_open_using is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_open_using(ctx *Opt_open_usingContext) {} + +// EnterOpt_scroll_option is called when production opt_scroll_option is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_scroll_option(ctx *Opt_scroll_optionContext) {} + +// ExitOpt_scroll_option is called when production opt_scroll_option is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_scroll_option(ctx *Opt_scroll_optionContext) {} + +// EnterOpt_scroll_option_no is called when production opt_scroll_option_no is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_scroll_option_no(ctx *Opt_scroll_option_noContext) {} + +// ExitOpt_scroll_option_no is called when production opt_scroll_option_no is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_scroll_option_no(ctx *Opt_scroll_option_noContext) {} + +// EnterStmt_fetch is called when production stmt_fetch is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_fetch(ctx *Stmt_fetchContext) {} + +// ExitStmt_fetch is called when production stmt_fetch is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_fetch(ctx *Stmt_fetchContext) {} + +// EnterInto_target is called when production into_target is entered. +func (s *BasePostgreSQLParserListener) EnterInto_target(ctx *Into_targetContext) {} + +// ExitInto_target is called when production into_target is exited. +func (s *BasePostgreSQLParserListener) ExitInto_target(ctx *Into_targetContext) {} + +// EnterOpt_cursor_from is called when production opt_cursor_from is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_cursor_from(ctx *Opt_cursor_fromContext) {} + +// ExitOpt_cursor_from is called when production opt_cursor_from is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_cursor_from(ctx *Opt_cursor_fromContext) {} + +// EnterOpt_fetch_direction is called when production opt_fetch_direction is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_fetch_direction(ctx *Opt_fetch_directionContext) {} + +// ExitOpt_fetch_direction is called when production opt_fetch_direction is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_fetch_direction(ctx *Opt_fetch_directionContext) {} + +// EnterStmt_move is called when production stmt_move is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_move(ctx *Stmt_moveContext) {} + +// ExitStmt_move is called when production stmt_move is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_move(ctx *Stmt_moveContext) {} + +// EnterStmt_close is called when production stmt_close is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_close(ctx *Stmt_closeContext) {} + +// ExitStmt_close is called when production stmt_close is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_close(ctx *Stmt_closeContext) {} + +// EnterStmt_null is called when production stmt_null is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_null(ctx *Stmt_nullContext) {} + +// ExitStmt_null is called when production stmt_null is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_null(ctx *Stmt_nullContext) {} + +// EnterStmt_commit is called when production stmt_commit is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_commit(ctx *Stmt_commitContext) {} + +// ExitStmt_commit is called when production stmt_commit is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_commit(ctx *Stmt_commitContext) {} + +// EnterStmt_rollback is called when production stmt_rollback is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_rollback(ctx *Stmt_rollbackContext) {} + +// ExitStmt_rollback is called when production stmt_rollback is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_rollback(ctx *Stmt_rollbackContext) {} + +// EnterPlsql_opt_transaction_chain is called when production plsql_opt_transaction_chain is entered. +func (s *BasePostgreSQLParserListener) EnterPlsql_opt_transaction_chain(ctx *Plsql_opt_transaction_chainContext) { +} + +// ExitPlsql_opt_transaction_chain is called when production plsql_opt_transaction_chain is exited. +func (s *BasePostgreSQLParserListener) ExitPlsql_opt_transaction_chain(ctx *Plsql_opt_transaction_chainContext) { +} + +// EnterStmt_set is called when production stmt_set is entered. +func (s *BasePostgreSQLParserListener) EnterStmt_set(ctx *Stmt_setContext) {} + +// ExitStmt_set is called when production stmt_set is exited. +func (s *BasePostgreSQLParserListener) ExitStmt_set(ctx *Stmt_setContext) {} + +// EnterCursor_variable is called when production cursor_variable is entered. +func (s *BasePostgreSQLParserListener) EnterCursor_variable(ctx *Cursor_variableContext) {} + +// ExitCursor_variable is called when production cursor_variable is exited. +func (s *BasePostgreSQLParserListener) ExitCursor_variable(ctx *Cursor_variableContext) {} + +// EnterException_sect is called when production exception_sect is entered. +func (s *BasePostgreSQLParserListener) EnterException_sect(ctx *Exception_sectContext) {} + +// ExitException_sect is called when production exception_sect is exited. +func (s *BasePostgreSQLParserListener) ExitException_sect(ctx *Exception_sectContext) {} + +// EnterProc_exceptions is called when production proc_exceptions is entered. +func (s *BasePostgreSQLParserListener) EnterProc_exceptions(ctx *Proc_exceptionsContext) {} + +// ExitProc_exceptions is called when production proc_exceptions is exited. +func (s *BasePostgreSQLParserListener) ExitProc_exceptions(ctx *Proc_exceptionsContext) {} + +// EnterProc_exception is called when production proc_exception is entered. +func (s *BasePostgreSQLParserListener) EnterProc_exception(ctx *Proc_exceptionContext) {} + +// ExitProc_exception is called when production proc_exception is exited. +func (s *BasePostgreSQLParserListener) ExitProc_exception(ctx *Proc_exceptionContext) {} + +// EnterProc_conditions is called when production proc_conditions is entered. +func (s *BasePostgreSQLParserListener) EnterProc_conditions(ctx *Proc_conditionsContext) {} + +// ExitProc_conditions is called when production proc_conditions is exited. +func (s *BasePostgreSQLParserListener) ExitProc_conditions(ctx *Proc_conditionsContext) {} + +// EnterProc_condition is called when production proc_condition is entered. +func (s *BasePostgreSQLParserListener) EnterProc_condition(ctx *Proc_conditionContext) {} + +// ExitProc_condition is called when production proc_condition is exited. +func (s *BasePostgreSQLParserListener) ExitProc_condition(ctx *Proc_conditionContext) {} + +// EnterOpt_block_label is called when production opt_block_label is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_block_label(ctx *Opt_block_labelContext) {} + +// ExitOpt_block_label is called when production opt_block_label is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_block_label(ctx *Opt_block_labelContext) {} + +// EnterOpt_loop_label is called when production opt_loop_label is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_loop_label(ctx *Opt_loop_labelContext) {} + +// ExitOpt_loop_label is called when production opt_loop_label is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_loop_label(ctx *Opt_loop_labelContext) {} + +// EnterOpt_label is called when production opt_label is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_label(ctx *Opt_labelContext) {} + +// ExitOpt_label is called when production opt_label is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_label(ctx *Opt_labelContext) {} + +// EnterOpt_exitcond is called when production opt_exitcond is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_exitcond(ctx *Opt_exitcondContext) {} + +// ExitOpt_exitcond is called when production opt_exitcond is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_exitcond(ctx *Opt_exitcondContext) {} + +// EnterAny_identifier is called when production any_identifier is entered. +func (s *BasePostgreSQLParserListener) EnterAny_identifier(ctx *Any_identifierContext) {} + +// ExitAny_identifier is called when production any_identifier is exited. +func (s *BasePostgreSQLParserListener) ExitAny_identifier(ctx *Any_identifierContext) {} + +// EnterPlsql_unreserved_keyword is called when production plsql_unreserved_keyword is entered. +func (s *BasePostgreSQLParserListener) EnterPlsql_unreserved_keyword(ctx *Plsql_unreserved_keywordContext) { +} + +// ExitPlsql_unreserved_keyword is called when production plsql_unreserved_keyword is exited. +func (s *BasePostgreSQLParserListener) ExitPlsql_unreserved_keyword(ctx *Plsql_unreserved_keywordContext) { +} + +// EnterSql_expression is called when production sql_expression is entered. +func (s *BasePostgreSQLParserListener) EnterSql_expression(ctx *Sql_expressionContext) {} + +// ExitSql_expression is called when production sql_expression is exited. +func (s *BasePostgreSQLParserListener) ExitSql_expression(ctx *Sql_expressionContext) {} + +// EnterExpr_until_then is called when production expr_until_then is entered. +func (s *BasePostgreSQLParserListener) EnterExpr_until_then(ctx *Expr_until_thenContext) {} + +// ExitExpr_until_then is called when production expr_until_then is exited. +func (s *BasePostgreSQLParserListener) ExitExpr_until_then(ctx *Expr_until_thenContext) {} + +// EnterExpr_until_semi is called when production expr_until_semi is entered. +func (s *BasePostgreSQLParserListener) EnterExpr_until_semi(ctx *Expr_until_semiContext) {} + +// ExitExpr_until_semi is called when production expr_until_semi is exited. +func (s *BasePostgreSQLParserListener) ExitExpr_until_semi(ctx *Expr_until_semiContext) {} + +// EnterExpr_until_rightbracket is called when production expr_until_rightbracket is entered. +func (s *BasePostgreSQLParserListener) EnterExpr_until_rightbracket(ctx *Expr_until_rightbracketContext) { +} + +// ExitExpr_until_rightbracket is called when production expr_until_rightbracket is exited. +func (s *BasePostgreSQLParserListener) ExitExpr_until_rightbracket(ctx *Expr_until_rightbracketContext) { +} + +// EnterExpr_until_loop is called when production expr_until_loop is entered. +func (s *BasePostgreSQLParserListener) EnterExpr_until_loop(ctx *Expr_until_loopContext) {} + +// ExitExpr_until_loop is called when production expr_until_loop is exited. +func (s *BasePostgreSQLParserListener) ExitExpr_until_loop(ctx *Expr_until_loopContext) {} + +// EnterMake_execsql_stmt is called when production make_execsql_stmt is entered. +func (s *BasePostgreSQLParserListener) EnterMake_execsql_stmt(ctx *Make_execsql_stmtContext) {} + +// ExitMake_execsql_stmt is called when production make_execsql_stmt is exited. +func (s *BasePostgreSQLParserListener) ExitMake_execsql_stmt(ctx *Make_execsql_stmtContext) {} + +// EnterOpt_returning_clause_into is called when production opt_returning_clause_into is entered. +func (s *BasePostgreSQLParserListener) EnterOpt_returning_clause_into(ctx *Opt_returning_clause_intoContext) { +} + +// ExitOpt_returning_clause_into is called when production opt_returning_clause_into is exited. +func (s *BasePostgreSQLParserListener) ExitOpt_returning_clause_into(ctx *Opt_returning_clause_intoContext) { +} diff --git a/postgresql/postgresqlparser_base_visitor.go b/postgresql/postgresqlparser_base_visitor.go new file mode 100644 index 0000000..946aea6 --- /dev/null +++ b/postgresql/postgresqlparser_base_visitor.go @@ -0,0 +1,3296 @@ +// Code generated from PostgreSQLParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package postgresql // PostgreSQLParser +import "github.com/antlr4-go/antlr/v4" + +type BasePostgreSQLParserVisitor struct { + *antlr.BaseParseTreeVisitor +} + +func (v *BasePostgreSQLParserVisitor) VisitRoot(ctx *RootContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPlsqlroot(ctx *PlsqlrootContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmtblock(ctx *StmtblockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmtmulti(ctx *StmtmultiContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt(ctx *StmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPlsqlconsolecommand(ctx *PlsqlconsolecommandContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCallstmt(ctx *CallstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreaterolestmt(ctx *CreaterolestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_with(ctx *Opt_withContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptrolelist(ctx *OptrolelistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlteroptrolelist(ctx *AlteroptrolelistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlteroptroleelem(ctx *AlteroptroleelemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateoptroleelem(ctx *CreateoptroleelemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateuserstmt(ctx *CreateuserstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterrolestmt(ctx *AlterrolestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_in_database(ctx *Opt_in_databaseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterrolesetstmt(ctx *AlterrolesetstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDroprolestmt(ctx *DroprolestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreategroupstmt(ctx *CreategroupstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltergroupstmt(ctx *AltergroupstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAdd_drop(ctx *Add_dropContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateschemastmt(ctx *CreateschemastmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptschemaname(ctx *OptschemanameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptschemaeltlist(ctx *OptschemaeltlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSchema_stmt(ctx *Schema_stmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVariablesetstmt(ctx *VariablesetstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSet_rest(ctx *Set_restContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGeneric_set(ctx *Generic_setContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSet_rest_more(ctx *Set_rest_moreContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVar_name(ctx *Var_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVar_list(ctx *Var_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVar_value(ctx *Var_valueContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIso_level(ctx *Iso_levelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_boolean_or_string(ctx *Opt_boolean_or_stringContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitZone_value(ctx *Zone_valueContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_encoding(ctx *Opt_encodingContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitNonreservedword_or_sconst(ctx *Nonreservedword_or_sconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVariableresetstmt(ctx *VariableresetstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReset_rest(ctx *Reset_restContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGeneric_reset(ctx *Generic_resetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSetresetclause(ctx *SetresetclauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunctionsetresetclause(ctx *FunctionsetresetclauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVariableshowstmt(ctx *VariableshowstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstraintssetstmt(ctx *ConstraintssetstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstraints_set_list(ctx *Constraints_set_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstraints_set_mode(ctx *Constraints_set_modeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCheckpointstmt(ctx *CheckpointstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDiscardstmt(ctx *DiscardstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltertablestmt(ctx *AltertablestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_table_cmds(ctx *Alter_table_cmdsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPartition_cmd(ctx *Partition_cmdContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIndex_partition_cmd(ctx *Index_partition_cmdContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_table_cmd(ctx *Alter_table_cmdContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_column_default(ctx *Alter_column_defaultContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_drop_behavior(ctx *Opt_drop_behaviorContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_collate_clause(ctx *Opt_collate_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_using(ctx *Alter_usingContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReplica_identity(ctx *Replica_identityContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReloptions(ctx *ReloptionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_reloptions(ctx *Opt_reloptionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReloption_list(ctx *Reloption_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReloption_elem(ctx *Reloption_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_identity_column_option_list(ctx *Alter_identity_column_option_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_identity_column_option(ctx *Alter_identity_column_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPartitionboundspec(ctx *PartitionboundspecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitHash_partbound_elem(ctx *Hash_partbound_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitHash_partbound(ctx *Hash_partboundContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltercompositetypestmt(ctx *AltercompositetypestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_type_cmds(ctx *Alter_type_cmdsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_type_cmd(ctx *Alter_type_cmdContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCloseportalstmt(ctx *CloseportalstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopystmt(ctx *CopystmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_from(ctx *Copy_fromContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_program(ctx *Opt_programContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_file_name(ctx *Copy_file_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_options(ctx *Copy_optionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_opt_list(ctx *Copy_opt_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_opt_item(ctx *Copy_opt_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_binary(ctx *Opt_binaryContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_delimiter(ctx *Copy_delimiterContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_using(ctx *Opt_usingContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_generic_opt_list(ctx *Copy_generic_opt_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_generic_opt_elem(ctx *Copy_generic_opt_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_generic_opt_arg(ctx *Copy_generic_opt_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_generic_opt_arg_list(ctx *Copy_generic_opt_arg_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCopy_generic_opt_arg_list_item(ctx *Copy_generic_opt_arg_list_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatestmt(ctx *CreatestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpttemp(ctx *OpttempContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpttableelementlist(ctx *OpttableelementlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpttypedtableelementlist(ctx *OpttypedtableelementlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTableelementlist(ctx *TableelementlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTypedtableelementlist(ctx *TypedtableelementlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTableelement(ctx *TableelementContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTypedtableelement(ctx *TypedtableelementContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColumnDef(ctx *ColumnDefContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRs_colattributes(ctx *Rs_colattributesContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColumnOptions(ctx *ColumnOptionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColquallist(ctx *ColquallistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColconstraint(ctx *ColconstraintContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColconstraintelem(ctx *ColconstraintelemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_unique_null_treatment(ctx *Opt_unique_null_treatmentContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGenerated_when(ctx *Generated_whenContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstraintattr(ctx *ConstraintattrContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTablelikeclause(ctx *TablelikeclauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTablelikeoptionlist(ctx *TablelikeoptionlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTablelikeoption(ctx *TablelikeoptionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTableconstraint(ctx *TableconstraintContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstraintelem(ctx *ConstraintelemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_no_inherit(ctx *Opt_no_inheritContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_column_list(ctx *Opt_column_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColumnlist(ctx *ColumnlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColumnElem(ctx *ColumnElemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_c_include(ctx *Opt_c_includeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitKey_match(ctx *Key_matchContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExclusionconstraintlist(ctx *ExclusionconstraintlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExclusionconstraintelem(ctx *ExclusionconstraintelemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExclusionwhereclause(ctx *ExclusionwhereclauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitKey_actions(ctx *Key_actionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitKey_update(ctx *Key_updateContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitKey_delete(ctx *Key_deleteContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitKey_action(ctx *Key_actionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptinherit(ctx *OptinheritContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptpartitionspec(ctx *OptpartitionspecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPartitionspec(ctx *PartitionspecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPart_params(ctx *Part_paramsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPart_elem(ctx *Part_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTable_access_method_clause(ctx *Table_access_method_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptwith(ctx *OptwithContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOncommitoption(ctx *OncommitoptionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpttablespace(ctx *OpttablespaceContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptconstablespace(ctx *OptconstablespaceContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExistingindex(ctx *ExistingindexContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatestatsstmt(ctx *CreatestatsstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterstatsstmt(ctx *AlterstatsstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateasstmt(ctx *CreateasstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreate_as_target(ctx *Create_as_targetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_with_data(ctx *Opt_with_dataContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatematviewstmt(ctx *CreatematviewstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreate_mv_target(ctx *Create_mv_targetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptnolog(ctx *OptnologContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRefreshmatviewstmt(ctx *RefreshmatviewstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateseqstmt(ctx *CreateseqstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterseqstmt(ctx *AlterseqstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptseqoptlist(ctx *OptseqoptlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptparenthesizedseqoptlist(ctx *OptparenthesizedseqoptlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSeqoptlist(ctx *SeqoptlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSeqoptelem(ctx *SeqoptelemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_by(ctx *Opt_byContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitNumericonly(ctx *NumericonlyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitNumericonly_list(ctx *Numericonly_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateplangstmt(ctx *CreateplangstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_trusted(ctx *Opt_trustedContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitHandler_name(ctx *Handler_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_inline_handler(ctx *Opt_inline_handlerContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitValidator_clause(ctx *Validator_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_validator(ctx *Opt_validatorContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_procedural(ctx *Opt_proceduralContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatetablespacestmt(ctx *CreatetablespacestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpttablespaceowner(ctx *OpttablespaceownerContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDroptablespacestmt(ctx *DroptablespacestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateextensionstmt(ctx *CreateextensionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreate_extension_opt_list(ctx *Create_extension_opt_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreate_extension_opt_item(ctx *Create_extension_opt_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterextensionstmt(ctx *AlterextensionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_extension_opt_list(ctx *Alter_extension_opt_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_extension_opt_item(ctx *Alter_extension_opt_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterextensioncontentsstmt(ctx *AlterextensioncontentsstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatefdwstmt(ctx *CreatefdwstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFdw_option(ctx *Fdw_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFdw_options(ctx *Fdw_optionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_fdw_options(ctx *Opt_fdw_optionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterfdwstmt(ctx *AlterfdwstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreate_generic_options(ctx *Create_generic_optionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGeneric_option_list(ctx *Generic_option_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_generic_options(ctx *Alter_generic_optionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_generic_option_list(ctx *Alter_generic_option_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlter_generic_option_elem(ctx *Alter_generic_option_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGeneric_option_elem(ctx *Generic_option_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGeneric_option_name(ctx *Generic_option_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGeneric_option_arg(ctx *Generic_option_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateforeignserverstmt(ctx *CreateforeignserverstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_type(ctx *Opt_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitForeign_server_version(ctx *Foreign_server_versionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_foreign_server_version(ctx *Opt_foreign_server_versionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterforeignserverstmt(ctx *AlterforeignserverstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateforeigntablestmt(ctx *CreateforeigntablestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitImportforeignschemastmt(ctx *ImportforeignschemastmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitImport_qualification_type(ctx *Import_qualification_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitImport_qualification(ctx *Import_qualificationContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateusermappingstmt(ctx *CreateusermappingstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAuth_ident(ctx *Auth_identContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDropusermappingstmt(ctx *DropusermappingstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterusermappingstmt(ctx *AlterusermappingstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatepolicystmt(ctx *CreatepolicystmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterpolicystmt(ctx *AlterpolicystmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRowsecurityoptionalexpr(ctx *RowsecurityoptionalexprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRowsecurityoptionalwithcheck(ctx *RowsecurityoptionalwithcheckContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRowsecuritydefaulttorole(ctx *RowsecuritydefaulttoroleContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRowsecurityoptionaltorole(ctx *RowsecurityoptionaltoroleContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRowsecuritydefaultpermissive(ctx *RowsecuritydefaultpermissiveContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRowsecuritydefaultforcmd(ctx *RowsecuritydefaultforcmdContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRow_security_cmd(ctx *Row_security_cmdContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateamstmt(ctx *CreateamstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAm_type(ctx *Am_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatetrigstmt(ctx *CreatetrigstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggeractiontime(ctx *TriggeractiontimeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggerevents(ctx *TriggereventsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggeroneevent(ctx *TriggeroneeventContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggerreferencing(ctx *TriggerreferencingContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggertransitions(ctx *TriggertransitionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggertransition(ctx *TriggertransitionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransitionoldornew(ctx *TransitionoldornewContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransitionrowortable(ctx *TransitionrowortableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransitionrelname(ctx *TransitionrelnameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggerforspec(ctx *TriggerforspecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggerforopteach(ctx *TriggerforopteachContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggerfortype(ctx *TriggerfortypeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggerwhen(ctx *TriggerwhenContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunction_or_procedure(ctx *Function_or_procedureContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggerfuncargs(ctx *TriggerfuncargsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTriggerfuncarg(ctx *TriggerfuncargContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOptconstrfromtable(ctx *OptconstrfromtableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstraintattributespec(ctx *ConstraintattributespecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstraintattributeElem(ctx *ConstraintattributeElemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateeventtrigstmt(ctx *CreateeventtrigstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitEvent_trigger_when_list(ctx *Event_trigger_when_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitEvent_trigger_when_item(ctx *Event_trigger_when_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitEvent_trigger_value_list(ctx *Event_trigger_value_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltereventtrigstmt(ctx *AltereventtrigstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitEnable_trigger(ctx *Enable_triggerContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateassertionstmt(ctx *CreateassertionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDefinestmt(ctx *DefinestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDefinition(ctx *DefinitionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDef_list(ctx *Def_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDef_elem(ctx *Def_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDef_arg(ctx *Def_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOld_aggr_definition(ctx *Old_aggr_definitionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOld_aggr_list(ctx *Old_aggr_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOld_aggr_elem(ctx *Old_aggr_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_enum_val_list(ctx *Opt_enum_val_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitEnum_val_list(ctx *Enum_val_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterenumstmt(ctx *AlterenumstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_if_not_exists(ctx *Opt_if_not_existsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateopclassstmt(ctx *CreateopclassstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpclass_item_list(ctx *Opclass_item_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpclass_item(ctx *Opclass_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_default(ctx *Opt_defaultContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_opfamily(ctx *Opt_opfamilyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpclass_purpose(ctx *Opclass_purposeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_recheck(ctx *Opt_recheckContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateopfamilystmt(ctx *CreateopfamilystmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlteropfamilystmt(ctx *AlteropfamilystmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpclass_drop_list(ctx *Opclass_drop_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpclass_drop(ctx *Opclass_dropContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDropopclassstmt(ctx *DropopclassstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDropopfamilystmt(ctx *DropopfamilystmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDropownedstmt(ctx *DropownedstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReassignownedstmt(ctx *ReassignownedstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDropstmt(ctx *DropstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitObject_type_any_name(ctx *Object_type_any_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitObject_type_name(ctx *Object_type_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDrop_type_name(ctx *Drop_type_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitObject_type_name_on_any_name(ctx *Object_type_name_on_any_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAny_name_list(ctx *Any_name_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAny_name(ctx *Any_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAttrs(ctx *AttrsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitType_name_list(ctx *Type_name_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTruncatestmt(ctx *TruncatestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_restart_seqs(ctx *Opt_restart_seqsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCommentstmt(ctx *CommentstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitComment_text(ctx *Comment_textContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSeclabelstmt(ctx *SeclabelstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_provider(ctx *Opt_providerContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSecurity_label(ctx *Security_labelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFetchstmt(ctx *FetchstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFetch_args(ctx *Fetch_argsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFrom_in(ctx *From_inContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_from_in(ctx *Opt_from_inContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGrantstmt(ctx *GrantstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRevokestmt(ctx *RevokestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPrivileges(ctx *PrivilegesContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPrivilege_list(ctx *Privilege_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPrivilege(ctx *PrivilegeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPrivilege_target(ctx *Privilege_targetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitParameter_name_list(ctx *Parameter_name_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitParameter_name(ctx *Parameter_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGrantee_list(ctx *Grantee_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGrantee(ctx *GranteeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_grant_grant_option(ctx *Opt_grant_grant_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGrantrolestmt(ctx *GrantrolestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRevokerolestmt(ctx *RevokerolestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_grant_admin_option(ctx *Opt_grant_admin_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_granted_by(ctx *Opt_granted_byContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterdefaultprivilegesstmt(ctx *AlterdefaultprivilegesstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDefacloptionlist(ctx *DefacloptionlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDefacloption(ctx *DefacloptionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDefaclaction(ctx *DefaclactionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDefacl_privilege_target(ctx *Defacl_privilege_targetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIndexstmt(ctx *IndexstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_unique(ctx *Opt_uniqueContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_concurrently(ctx *Opt_concurrentlyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_index_name(ctx *Opt_index_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAccess_method_clause(ctx *Access_method_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIndex_params(ctx *Index_paramsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIndex_elem_options(ctx *Index_elem_optionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIndex_elem(ctx *Index_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_include(ctx *Opt_includeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIndex_including_params(ctx *Index_including_paramsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_collate(ctx *Opt_collateContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_class(ctx *Opt_classContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_asc_desc(ctx *Opt_asc_descContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_nulls_order(ctx *Opt_nulls_orderContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatefunctionstmt(ctx *CreatefunctionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_or_replace(ctx *Opt_or_replaceContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_args(ctx *Func_argsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_args_list(ctx *Func_args_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunction_with_argtypes_list(ctx *Function_with_argtypes_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunction_with_argtypes(ctx *Function_with_argtypesContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_args_with_defaults(ctx *Func_args_with_defaultsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_args_with_defaults_list(ctx *Func_args_with_defaults_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_arg(ctx *Func_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitArg_class(ctx *Arg_classContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitParam_name(ctx *Param_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_return(ctx *Func_returnContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_type(ctx *Func_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_arg_with_default(ctx *Func_arg_with_defaultContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAggr_arg(ctx *Aggr_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAggr_args(ctx *Aggr_argsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAggr_args_list(ctx *Aggr_args_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAggregate_with_argtypes(ctx *Aggregate_with_argtypesContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAggregate_with_argtypes_list(ctx *Aggregate_with_argtypes_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatefunc_opt_list(ctx *Createfunc_opt_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCommon_func_opt_item(ctx *Common_func_opt_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatefunc_opt_item(ctx *Createfunc_opt_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_as(ctx *Func_asContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransform_type_list(ctx *Transform_type_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_definition(ctx *Opt_definitionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTable_func_column(ctx *Table_func_columnContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTable_func_column_list(ctx *Table_func_column_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterfunctionstmt(ctx *AlterfunctionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterfunc_opt_list(ctx *Alterfunc_opt_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_restrict(ctx *Opt_restrictContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRemovefuncstmt(ctx *RemovefuncstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRemoveaggrstmt(ctx *RemoveaggrstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRemoveoperstmt(ctx *RemoveoperstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOper_argtypes(ctx *Oper_argtypesContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAny_operator(ctx *Any_operatorContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOperator_with_argtypes_list(ctx *Operator_with_argtypes_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOperator_with_argtypes(ctx *Operator_with_argtypesContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDostmt(ctx *DostmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDostmt_opt_list(ctx *Dostmt_opt_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDostmt_opt_item(ctx *Dostmt_opt_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatecaststmt(ctx *CreatecaststmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCast_context(ctx *Cast_contextContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDropcaststmt(ctx *DropcaststmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_if_exists(ctx *Opt_if_existsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatetransformstmt(ctx *CreatetransformstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransform_element_list(ctx *Transform_element_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDroptransformstmt(ctx *DroptransformstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReindexstmt(ctx *ReindexstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReindex_target_type(ctx *Reindex_target_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReindex_target_multitable(ctx *Reindex_target_multitableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReindex_option_list(ctx *Reindex_option_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReindex_option_elem(ctx *Reindex_option_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltertblspcstmt(ctx *AltertblspcstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRenamestmt(ctx *RenamestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_column(ctx *Opt_columnContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_set_data(ctx *Opt_set_dataContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterobjectdependsstmt(ctx *AlterobjectdependsstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_no(ctx *Opt_noContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterobjectschemastmt(ctx *AlterobjectschemastmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlteroperatorstmt(ctx *AlteroperatorstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOperator_def_list(ctx *Operator_def_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOperator_def_elem(ctx *Operator_def_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOperator_def_arg(ctx *Operator_def_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltertypestmt(ctx *AltertypestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterownerstmt(ctx *AlterownerstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatepublicationstmt(ctx *CreatepublicationstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPub_obj_list(ctx *Pub_obj_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPublication_obj_spec(ctx *Publication_obj_specContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_where_clause(ctx *Opt_where_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterpublicationstmt(ctx *AlterpublicationstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatesubscriptionstmt(ctx *CreatesubscriptionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPublication_name_list(ctx *Publication_name_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPublication_name_item(ctx *Publication_name_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltersubscriptionstmt(ctx *AltersubscriptionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDropsubscriptionstmt(ctx *DropsubscriptionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRulestmt(ctx *RulestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRuleactionlist(ctx *RuleactionlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRuleactionmulti(ctx *RuleactionmultiContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRuleactionstmt(ctx *RuleactionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRuleactionstmtOrEmpty(ctx *RuleactionstmtOrEmptyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitEvent(ctx *EventContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_instead(ctx *Opt_insteadContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitNotifystmt(ctx *NotifystmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitNotify_payload(ctx *Notify_payloadContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitListenstmt(ctx *ListenstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitUnlistenstmt(ctx *UnlistenstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransactionstmt(ctx *TransactionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_transaction(ctx *Opt_transactionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransaction_mode_item(ctx *Transaction_mode_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransaction_mode_list(ctx *Transaction_mode_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTransaction_mode_list_or_empty(ctx *Transaction_mode_list_or_emptyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_transaction_chain(ctx *Opt_transaction_chainContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitViewstmt(ctx *ViewstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_check_option(ctx *Opt_check_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitLoadstmt(ctx *LoadstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatedbstmt(ctx *CreatedbstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatedb_opt_list(ctx *Createdb_opt_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatedb_opt_items(ctx *Createdb_opt_itemsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatedb_opt_item(ctx *Createdb_opt_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatedb_opt_name(ctx *Createdb_opt_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_equal(ctx *Opt_equalContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterdatabasestmt(ctx *AlterdatabasestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterdatabasesetstmt(ctx *AlterdatabasesetstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDropdbstmt(ctx *DropdbstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDrop_option_list(ctx *Drop_option_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDrop_option(ctx *Drop_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltercollationstmt(ctx *AltercollationstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltersystemstmt(ctx *AltersystemstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreatedomainstmt(ctx *CreatedomainstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlterdomainstmt(ctx *AlterdomainstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_as(ctx *Opt_asContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltertsdictionarystmt(ctx *AltertsdictionarystmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAltertsconfigurationstmt(ctx *AltertsconfigurationstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAny_with(ctx *Any_withContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCreateconversionstmt(ctx *CreateconversionstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitClusterstmt(ctx *ClusterstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCluster_index_specification(ctx *Cluster_index_specificationContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVacuumstmt(ctx *VacuumstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAnalyzestmt(ctx *AnalyzestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVac_analyze_option_list(ctx *Vac_analyze_option_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAnalyze_keyword(ctx *Analyze_keywordContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVac_analyze_option_elem(ctx *Vac_analyze_option_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVac_analyze_option_name(ctx *Vac_analyze_option_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVac_analyze_option_arg(ctx *Vac_analyze_option_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_analyze(ctx *Opt_analyzeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_verbose(ctx *Opt_verboseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_full(ctx *Opt_fullContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_freeze(ctx *Opt_freezeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_name_list(ctx *Opt_name_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVacuum_relation(ctx *Vacuum_relationContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitVacuum_relation_list(ctx *Vacuum_relation_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_vacuum_relation_list(ctx *Opt_vacuum_relation_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExplainstmt(ctx *ExplainstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExplainablestmt(ctx *ExplainablestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExplain_option_list(ctx *Explain_option_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExplain_option_elem(ctx *Explain_option_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExplain_option_name(ctx *Explain_option_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExplain_option_arg(ctx *Explain_option_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPreparestmt(ctx *PreparestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPrep_type_clause(ctx *Prep_type_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPreparablestmt(ctx *PreparablestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExecutestmt(ctx *ExecutestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExecute_param_clause(ctx *Execute_param_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDeallocatestmt(ctx *DeallocatestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitInsertstmt(ctx *InsertstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitInsert_target(ctx *Insert_targetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitInsert_rest(ctx *Insert_restContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOverride_kind(ctx *Override_kindContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitInsert_column_list(ctx *Insert_column_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitInsert_column_item(ctx *Insert_column_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_on_conflict(ctx *Opt_on_conflictContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_conf_expr(ctx *Opt_conf_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReturning_clause(ctx *Returning_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitMergestmt(ctx *MergestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitMerge_insert_clause(ctx *Merge_insert_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitMerge_update_clause(ctx *Merge_update_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitMerge_delete_clause(ctx *Merge_delete_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDeletestmt(ctx *DeletestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitUsing_clause(ctx *Using_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitLockstmt(ctx *LockstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_lock(ctx *Opt_lockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitLock_type(ctx *Lock_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_nowait(ctx *Opt_nowaitContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_nowait_or_skip(ctx *Opt_nowait_or_skipContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitUpdatestmt(ctx *UpdatestmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSet_clause_list(ctx *Set_clause_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSet_clause(ctx *Set_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSet_target(ctx *Set_targetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSet_target_list(ctx *Set_target_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDeclarecursorstmt(ctx *DeclarecursorstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCursor_name(ctx *Cursor_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCursor_options(ctx *Cursor_optionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_hold(ctx *Opt_holdContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSelectstmt(ctx *SelectstmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSelect_with_parens(ctx *Select_with_parensContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSelect_no_parens(ctx *Select_no_parensContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSelect_clause(ctx *Select_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSimple_select_intersect(ctx *Simple_select_intersectContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSimple_select_pramary(ctx *Simple_select_pramaryContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWith_clause(ctx *With_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCte_list(ctx *Cte_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCommon_table_expr(ctx *Common_table_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_materialized(ctx *Opt_materializedContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_with_clause(ctx *Opt_with_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitInto_clause(ctx *Into_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_strict(ctx *Opt_strictContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpttempTableName(ctx *OpttempTableNameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_table(ctx *Opt_tableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAll_or_distinct(ctx *All_or_distinctContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDistinct_clause(ctx *Distinct_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_all_clause(ctx *Opt_all_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_sort_clause(ctx *Opt_sort_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSort_clause(ctx *Sort_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSortby_list(ctx *Sortby_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSortby(ctx *SortbyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSelect_limit(ctx *Select_limitContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_select_limit(ctx *Opt_select_limitContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitLimit_clause(ctx *Limit_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOffset_clause(ctx *Offset_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSelect_limit_value(ctx *Select_limit_valueContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSelect_offset_value(ctx *Select_offset_valueContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSelect_fetch_first_value(ctx *Select_fetch_first_valueContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitI_or_f_const(ctx *I_or_f_constContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRow_or_rows(ctx *Row_or_rowsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFirst_or_next(ctx *First_or_nextContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGroup_clause(ctx *Group_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGroup_by_list(ctx *Group_by_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGroup_by_item(ctx *Group_by_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitEmpty_grouping_set(ctx *Empty_grouping_setContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRollup_clause(ctx *Rollup_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCube_clause(ctx *Cube_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGrouping_sets_clause(ctx *Grouping_sets_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitHaving_clause(ctx *Having_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFor_locking_clause(ctx *For_locking_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_for_locking_clause(ctx *Opt_for_locking_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFor_locking_items(ctx *For_locking_itemsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFor_locking_item(ctx *For_locking_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFor_locking_strength(ctx *For_locking_strengthContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitLocked_rels_list(ctx *Locked_rels_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitValues_clause(ctx *Values_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFrom_clause(ctx *From_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFrom_list(ctx *From_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTable_ref(ctx *Table_refContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitJoined_table(ctx *Joined_tableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAlias_clause(ctx *Alias_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_alias_clause(ctx *Opt_alias_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTable_alias_clause(ctx *Table_alias_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_alias_clause(ctx *Func_alias_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitJoin_type(ctx *Join_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitJoin_qual(ctx *Join_qualContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRelation_expr(ctx *Relation_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRelation_expr_list(ctx *Relation_expr_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRelation_expr_opt_alias(ctx *Relation_expr_opt_aliasContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTablesample_clause(ctx *Tablesample_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_repeatable_clause(ctx *Opt_repeatable_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_table(ctx *Func_tableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRowsfrom_item(ctx *Rowsfrom_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRowsfrom_list(ctx *Rowsfrom_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_col_def_list(ctx *Opt_col_def_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_ordinality(ctx *Opt_ordinalityContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWhere_clause(ctx *Where_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWhere_or_current_clause(ctx *Where_or_current_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpttablefuncelementlist(ctx *OpttablefuncelementlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTablefuncelementlist(ctx *TablefuncelementlistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTablefuncelement(ctx *TablefuncelementContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXmltable(ctx *XmltableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXmltable_column_list(ctx *Xmltable_column_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXmltable_column_el(ctx *Xmltable_column_elContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXmltable_column_option_list(ctx *Xmltable_column_option_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXmltable_column_option_el(ctx *Xmltable_column_option_elContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXml_namespace_list(ctx *Xml_namespace_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXml_namespace_el(ctx *Xml_namespace_elContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTypename(ctx *TypenameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_array_bounds(ctx *Opt_array_boundsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSimpletypename(ctx *SimpletypenameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConsttypename(ctx *ConsttypenameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGenerictype(ctx *GenerictypeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_type_modifiers(ctx *Opt_type_modifiersContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitNumeric(ctx *NumericContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_float(ctx *Opt_floatContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitBit(ctx *BitContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstbit(ctx *ConstbitContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitBitwithlength(ctx *BitwithlengthContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitBitwithoutlength(ctx *BitwithoutlengthContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCharacter(ctx *CharacterContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstcharacter(ctx *ConstcharacterContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCharacter_c(ctx *Character_cContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_varying(ctx *Opt_varyingContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstdatetime(ctx *ConstdatetimeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitConstinterval(ctx *ConstintervalContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_timezone(ctx *Opt_timezoneContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_interval(ctx *Opt_intervalContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitInterval_second(ctx *Interval_secondContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_escape(ctx *Opt_escapeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr(ctx *A_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_qual(ctx *A_expr_qualContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_lessless(ctx *A_expr_lesslessContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_or(ctx *A_expr_orContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_and(ctx *A_expr_andContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_between(ctx *A_expr_betweenContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_in(ctx *A_expr_inContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_unary_not(ctx *A_expr_unary_notContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_isnull(ctx *A_expr_isnullContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_is_not(ctx *A_expr_is_notContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_compare(ctx *A_expr_compareContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_like(ctx *A_expr_likeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_qual_op(ctx *A_expr_qual_opContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_unary_qualop(ctx *A_expr_unary_qualopContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_add(ctx *A_expr_addContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_mul(ctx *A_expr_mulContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_caret(ctx *A_expr_caretContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_unary_sign(ctx *A_expr_unary_signContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_at_time_zone(ctx *A_expr_at_time_zoneContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_collate(ctx *A_expr_collateContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitA_expr_typecast(ctx *A_expr_typecastContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitB_expr(ctx *B_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitC_expr_exists(ctx *C_expr_existsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitC_expr_expr(ctx *C_expr_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitC_expr_case(ctx *C_expr_caseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPlsqlvariablename(ctx *PlsqlvariablenameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_application(ctx *Func_applicationContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_expr(ctx *Func_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_expr_windowless(ctx *Func_expr_windowlessContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_expr_common_subexpr(ctx *Func_expr_common_subexprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXml_root_version(ctx *Xml_root_versionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_xml_root_standalone(ctx *Opt_xml_root_standaloneContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXml_attributes(ctx *Xml_attributesContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXml_attribute_list(ctx *Xml_attribute_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXml_attribute_el(ctx *Xml_attribute_elContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDocument_or_content(ctx *Document_or_contentContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXml_whitespace_option(ctx *Xml_whitespace_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXmlexists_argument(ctx *Xmlexists_argumentContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXml_passing_mech(ctx *Xml_passing_mechContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWithin_group_clause(ctx *Within_group_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFilter_clause(ctx *Filter_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWindow_clause(ctx *Window_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWindow_definition_list(ctx *Window_definition_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWindow_definition(ctx *Window_definitionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOver_clause(ctx *Over_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWindow_specification(ctx *Window_specificationContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_existing_window_name(ctx *Opt_existing_window_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_partition_clause(ctx *Opt_partition_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_frame_clause(ctx *Opt_frame_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFrame_extent(ctx *Frame_extentContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFrame_bound(ctx *Frame_boundContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_window_exclusion_clause(ctx *Opt_window_exclusion_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRow(ctx *RowContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExplicit_row(ctx *Explicit_rowContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitImplicit_row(ctx *Implicit_rowContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSub_type(ctx *Sub_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAll_op(ctx *All_opContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitMathop(ctx *MathopContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitQual_op(ctx *Qual_opContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitQual_all_op(ctx *Qual_all_opContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSubquery_Op(ctx *Subquery_OpContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExpr_list(ctx *Expr_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_arg_list(ctx *Func_arg_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_arg_expr(ctx *Func_arg_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitType_list(ctx *Type_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitArray_expr(ctx *Array_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitArray_expr_list(ctx *Array_expr_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExtract_list(ctx *Extract_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExtract_arg(ctx *Extract_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitUnicode_normal_form(ctx *Unicode_normal_formContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOverlay_list(ctx *Overlay_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPosition_list(ctx *Position_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSubstr_list(ctx *Substr_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTrim_list(ctx *Trim_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIn_expr_select(ctx *In_expr_selectContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIn_expr_list(ctx *In_expr_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCase_expr(ctx *Case_exprContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWhen_clause_list(ctx *When_clause_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitWhen_clause(ctx *When_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCase_default(ctx *Case_defaultContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCase_arg(ctx *Case_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColumnref(ctx *ColumnrefContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIndirection_el(ctx *Indirection_elContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_slice_bound(ctx *Opt_slice_boundContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIndirection(ctx *IndirectionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_indirection(ctx *Opt_indirectionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_target_list(ctx *Opt_target_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTarget_list(ctx *Target_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTarget_label(ctx *Target_labelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTarget_star(ctx *Target_starContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTarget_alias(ctx *Target_aliasContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitQualified_name_list(ctx *Qualified_name_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitQualified_name(ctx *Qualified_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitName_list(ctx *Name_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitName(ctx *NameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAttr_name(ctx *Attr_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFile_name(ctx *File_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFunc_name(ctx *Func_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAexprconst(ctx *AexprconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitXconst(ctx *XconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitBconst(ctx *BconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFconst(ctx *FconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIconst(ctx *IconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSconst(ctx *SconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAnysconst(ctx *AnysconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_uescape(ctx *Opt_uescapeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSignediconst(ctx *SignediconstContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRoleid(ctx *RoleidContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRolespec(ctx *RolespecContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitRole_list(ctx *Role_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitColid(ctx *ColidContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitTable_alias(ctx *Table_aliasContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitType_function_name(ctx *Type_function_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitNonreservedword(ctx *NonreservedwordContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCollabel(ctx *CollabelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitIdentifier(ctx *IdentifierContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPlsqlidentifier(ctx *PlsqlidentifierContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitUnreserved_keyword(ctx *Unreserved_keywordContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCol_name_keyword(ctx *Col_name_keywordContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitType_func_name_keyword(ctx *Type_func_name_keywordContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitReserved_keyword(ctx *Reserved_keywordContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitBuiltin_function_name(ctx *Builtin_function_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPl_function(ctx *Pl_functionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitComp_options(ctx *Comp_optionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitComp_option(ctx *Comp_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSharp(ctx *SharpContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOption_value(ctx *Option_valueContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_semi(ctx *Opt_semiContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPl_block(ctx *Pl_blockContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_sect(ctx *Decl_sectContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_start(ctx *Decl_startContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_stmts(ctx *Decl_stmtsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitLabel_decl(ctx *Label_declContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_stmt(ctx *Decl_stmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_statement(ctx *Decl_statementContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_scrollable(ctx *Opt_scrollableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_cursor_query(ctx *Decl_cursor_queryContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_cursor_args(ctx *Decl_cursor_argsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_cursor_arglist(ctx *Decl_cursor_arglistContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_cursor_arg(ctx *Decl_cursor_argContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_is_for(ctx *Decl_is_forContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_aliasitem(ctx *Decl_aliasitemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_varname(ctx *Decl_varnameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_const(ctx *Decl_constContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_datatype(ctx *Decl_datatypeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_collate(ctx *Decl_collateContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_notnull(ctx *Decl_notnullContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_defval(ctx *Decl_defvalContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitDecl_defkey(ctx *Decl_defkeyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAssign_operator(ctx *Assign_operatorContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitProc_sect(ctx *Proc_sectContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitProc_stmt(ctx *Proc_stmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_perform(ctx *Stmt_performContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_call(ctx *Stmt_callContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_expr_list(ctx *Opt_expr_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_assign(ctx *Stmt_assignContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_getdiag(ctx *Stmt_getdiagContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGetdiag_area_opt(ctx *Getdiag_area_optContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGetdiag_list(ctx *Getdiag_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGetdiag_list_item(ctx *Getdiag_list_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGetdiag_item(ctx *Getdiag_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitGetdiag_target(ctx *Getdiag_targetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAssign_var(ctx *Assign_varContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_if(ctx *Stmt_ifContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_elsifs(ctx *Stmt_elsifsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_else(ctx *Stmt_elseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_case(ctx *Stmt_caseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_expr_until_when(ctx *Opt_expr_until_whenContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCase_when_list(ctx *Case_when_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCase_when(ctx *Case_whenContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_case_else(ctx *Opt_case_elseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_loop(ctx *Stmt_loopContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_while(ctx *Stmt_whileContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_for(ctx *Stmt_forContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFor_control(ctx *For_controlContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_for_using_expression(ctx *Opt_for_using_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_cursor_parameters(ctx *Opt_cursor_parametersContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_reverse(ctx *Opt_reverseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_by_expression(ctx *Opt_by_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitFor_variable(ctx *For_variableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_foreach_a(ctx *Stmt_foreach_aContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitForeach_slice(ctx *Foreach_sliceContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_exit(ctx *Stmt_exitContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExit_type(ctx *Exit_typeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_return(ctx *Stmt_returnContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_return_result(ctx *Opt_return_resultContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_raise(ctx *Stmt_raiseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_stmt_raise_level(ctx *Opt_stmt_raise_levelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_raise_list(ctx *Opt_raise_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_raise_using(ctx *Opt_raise_usingContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_raise_using_elem(ctx *Opt_raise_using_elemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_raise_using_elem_list(ctx *Opt_raise_using_elem_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_assert(ctx *Stmt_assertContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_stmt_assert_message(ctx *Opt_stmt_assert_messageContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitLoop_body(ctx *Loop_bodyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_execsql(ctx *Stmt_execsqlContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_dynexecute(ctx *Stmt_dynexecuteContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_execute_using(ctx *Opt_execute_usingContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_execute_using_list(ctx *Opt_execute_using_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_execute_into(ctx *Opt_execute_intoContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_open(ctx *Stmt_openContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_open_bound_list_item(ctx *Opt_open_bound_list_itemContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_open_bound_list(ctx *Opt_open_bound_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_open_using(ctx *Opt_open_usingContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_scroll_option(ctx *Opt_scroll_optionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_scroll_option_no(ctx *Opt_scroll_option_noContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_fetch(ctx *Stmt_fetchContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitInto_target(ctx *Into_targetContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_cursor_from(ctx *Opt_cursor_fromContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_fetch_direction(ctx *Opt_fetch_directionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_move(ctx *Stmt_moveContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_close(ctx *Stmt_closeContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_null(ctx *Stmt_nullContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_commit(ctx *Stmt_commitContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_rollback(ctx *Stmt_rollbackContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPlsql_opt_transaction_chain(ctx *Plsql_opt_transaction_chainContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitStmt_set(ctx *Stmt_setContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitCursor_variable(ctx *Cursor_variableContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitException_sect(ctx *Exception_sectContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitProc_exceptions(ctx *Proc_exceptionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitProc_exception(ctx *Proc_exceptionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitProc_conditions(ctx *Proc_conditionsContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitProc_condition(ctx *Proc_conditionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_block_label(ctx *Opt_block_labelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_loop_label(ctx *Opt_loop_labelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_label(ctx *Opt_labelContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_exitcond(ctx *Opt_exitcondContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitAny_identifier(ctx *Any_identifierContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitPlsql_unreserved_keyword(ctx *Plsql_unreserved_keywordContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitSql_expression(ctx *Sql_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExpr_until_then(ctx *Expr_until_thenContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExpr_until_semi(ctx *Expr_until_semiContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExpr_until_rightbracket(ctx *Expr_until_rightbracketContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitExpr_until_loop(ctx *Expr_until_loopContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitMake_execsql_stmt(ctx *Make_execsql_stmtContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BasePostgreSQLParserVisitor) VisitOpt_returning_clause_into(ctx *Opt_returning_clause_intoContext) interface{} { + return v.VisitChildren(ctx) +} diff --git a/postgresql/postgresqlparser_listener.go b/postgresql/postgresqlparser_listener.go new file mode 100644 index 0000000..5ac791c --- /dev/null +++ b/postgresql/postgresqlparser_listener.go @@ -0,0 +1,4941 @@ +// Code generated from PostgreSQLParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package postgresql // PostgreSQLParser +import "github.com/antlr4-go/antlr/v4" + +// PostgreSQLParserListener is a complete listener for a parse tree produced by PostgreSQLParser. +type PostgreSQLParserListener interface { + antlr.ParseTreeListener + + // EnterRoot is called when entering the root production. + EnterRoot(c *RootContext) + + // EnterPlsqlroot is called when entering the plsqlroot production. + EnterPlsqlroot(c *PlsqlrootContext) + + // EnterStmtblock is called when entering the stmtblock production. + EnterStmtblock(c *StmtblockContext) + + // EnterStmtmulti is called when entering the stmtmulti production. + EnterStmtmulti(c *StmtmultiContext) + + // EnterStmt is called when entering the stmt production. + EnterStmt(c *StmtContext) + + // EnterPlsqlconsolecommand is called when entering the plsqlconsolecommand production. + EnterPlsqlconsolecommand(c *PlsqlconsolecommandContext) + + // EnterCallstmt is called when entering the callstmt production. + EnterCallstmt(c *CallstmtContext) + + // EnterCreaterolestmt is called when entering the createrolestmt production. + EnterCreaterolestmt(c *CreaterolestmtContext) + + // EnterOpt_with is called when entering the opt_with production. + EnterOpt_with(c *Opt_withContext) + + // EnterOptrolelist is called when entering the optrolelist production. + EnterOptrolelist(c *OptrolelistContext) + + // EnterAlteroptrolelist is called when entering the alteroptrolelist production. + EnterAlteroptrolelist(c *AlteroptrolelistContext) + + // EnterAlteroptroleelem is called when entering the alteroptroleelem production. + EnterAlteroptroleelem(c *AlteroptroleelemContext) + + // EnterCreateoptroleelem is called when entering the createoptroleelem production. + EnterCreateoptroleelem(c *CreateoptroleelemContext) + + // EnterCreateuserstmt is called when entering the createuserstmt production. + EnterCreateuserstmt(c *CreateuserstmtContext) + + // EnterAlterrolestmt is called when entering the alterrolestmt production. + EnterAlterrolestmt(c *AlterrolestmtContext) + + // EnterOpt_in_database is called when entering the opt_in_database production. + EnterOpt_in_database(c *Opt_in_databaseContext) + + // EnterAlterrolesetstmt is called when entering the alterrolesetstmt production. + EnterAlterrolesetstmt(c *AlterrolesetstmtContext) + + // EnterDroprolestmt is called when entering the droprolestmt production. + EnterDroprolestmt(c *DroprolestmtContext) + + // EnterCreategroupstmt is called when entering the creategroupstmt production. + EnterCreategroupstmt(c *CreategroupstmtContext) + + // EnterAltergroupstmt is called when entering the altergroupstmt production. + EnterAltergroupstmt(c *AltergroupstmtContext) + + // EnterAdd_drop is called when entering the add_drop production. + EnterAdd_drop(c *Add_dropContext) + + // EnterCreateschemastmt is called when entering the createschemastmt production. + EnterCreateschemastmt(c *CreateschemastmtContext) + + // EnterOptschemaname is called when entering the optschemaname production. + EnterOptschemaname(c *OptschemanameContext) + + // EnterOptschemaeltlist is called when entering the optschemaeltlist production. + EnterOptschemaeltlist(c *OptschemaeltlistContext) + + // EnterSchema_stmt is called when entering the schema_stmt production. + EnterSchema_stmt(c *Schema_stmtContext) + + // EnterVariablesetstmt is called when entering the variablesetstmt production. + EnterVariablesetstmt(c *VariablesetstmtContext) + + // EnterSet_rest is called when entering the set_rest production. + EnterSet_rest(c *Set_restContext) + + // EnterGeneric_set is called when entering the generic_set production. + EnterGeneric_set(c *Generic_setContext) + + // EnterSet_rest_more is called when entering the set_rest_more production. + EnterSet_rest_more(c *Set_rest_moreContext) + + // EnterVar_name is called when entering the var_name production. + EnterVar_name(c *Var_nameContext) + + // EnterVar_list is called when entering the var_list production. + EnterVar_list(c *Var_listContext) + + // EnterVar_value is called when entering the var_value production. + EnterVar_value(c *Var_valueContext) + + // EnterIso_level is called when entering the iso_level production. + EnterIso_level(c *Iso_levelContext) + + // EnterOpt_boolean_or_string is called when entering the opt_boolean_or_string production. + EnterOpt_boolean_or_string(c *Opt_boolean_or_stringContext) + + // EnterZone_value is called when entering the zone_value production. + EnterZone_value(c *Zone_valueContext) + + // EnterOpt_encoding is called when entering the opt_encoding production. + EnterOpt_encoding(c *Opt_encodingContext) + + // EnterNonreservedword_or_sconst is called when entering the nonreservedword_or_sconst production. + EnterNonreservedword_or_sconst(c *Nonreservedword_or_sconstContext) + + // EnterVariableresetstmt is called when entering the variableresetstmt production. + EnterVariableresetstmt(c *VariableresetstmtContext) + + // EnterReset_rest is called when entering the reset_rest production. + EnterReset_rest(c *Reset_restContext) + + // EnterGeneric_reset is called when entering the generic_reset production. + EnterGeneric_reset(c *Generic_resetContext) + + // EnterSetresetclause is called when entering the setresetclause production. + EnterSetresetclause(c *SetresetclauseContext) + + // EnterFunctionsetresetclause is called when entering the functionsetresetclause production. + EnterFunctionsetresetclause(c *FunctionsetresetclauseContext) + + // EnterVariableshowstmt is called when entering the variableshowstmt production. + EnterVariableshowstmt(c *VariableshowstmtContext) + + // EnterConstraintssetstmt is called when entering the constraintssetstmt production. + EnterConstraintssetstmt(c *ConstraintssetstmtContext) + + // EnterConstraints_set_list is called when entering the constraints_set_list production. + EnterConstraints_set_list(c *Constraints_set_listContext) + + // EnterConstraints_set_mode is called when entering the constraints_set_mode production. + EnterConstraints_set_mode(c *Constraints_set_modeContext) + + // EnterCheckpointstmt is called when entering the checkpointstmt production. + EnterCheckpointstmt(c *CheckpointstmtContext) + + // EnterDiscardstmt is called when entering the discardstmt production. + EnterDiscardstmt(c *DiscardstmtContext) + + // EnterAltertablestmt is called when entering the altertablestmt production. + EnterAltertablestmt(c *AltertablestmtContext) + + // EnterAlter_table_cmds is called when entering the alter_table_cmds production. + EnterAlter_table_cmds(c *Alter_table_cmdsContext) + + // EnterPartition_cmd is called when entering the partition_cmd production. + EnterPartition_cmd(c *Partition_cmdContext) + + // EnterIndex_partition_cmd is called when entering the index_partition_cmd production. + EnterIndex_partition_cmd(c *Index_partition_cmdContext) + + // EnterAlter_table_cmd is called when entering the alter_table_cmd production. + EnterAlter_table_cmd(c *Alter_table_cmdContext) + + // EnterAlter_column_default is called when entering the alter_column_default production. + EnterAlter_column_default(c *Alter_column_defaultContext) + + // EnterOpt_drop_behavior is called when entering the opt_drop_behavior production. + EnterOpt_drop_behavior(c *Opt_drop_behaviorContext) + + // EnterOpt_collate_clause is called when entering the opt_collate_clause production. + EnterOpt_collate_clause(c *Opt_collate_clauseContext) + + // EnterAlter_using is called when entering the alter_using production. + EnterAlter_using(c *Alter_usingContext) + + // EnterReplica_identity is called when entering the replica_identity production. + EnterReplica_identity(c *Replica_identityContext) + + // EnterReloptions is called when entering the reloptions production. + EnterReloptions(c *ReloptionsContext) + + // EnterOpt_reloptions is called when entering the opt_reloptions production. + EnterOpt_reloptions(c *Opt_reloptionsContext) + + // EnterReloption_list is called when entering the reloption_list production. + EnterReloption_list(c *Reloption_listContext) + + // EnterReloption_elem is called when entering the reloption_elem production. + EnterReloption_elem(c *Reloption_elemContext) + + // EnterAlter_identity_column_option_list is called when entering the alter_identity_column_option_list production. + EnterAlter_identity_column_option_list(c *Alter_identity_column_option_listContext) + + // EnterAlter_identity_column_option is called when entering the alter_identity_column_option production. + EnterAlter_identity_column_option(c *Alter_identity_column_optionContext) + + // EnterPartitionboundspec is called when entering the partitionboundspec production. + EnterPartitionboundspec(c *PartitionboundspecContext) + + // EnterHash_partbound_elem is called when entering the hash_partbound_elem production. + EnterHash_partbound_elem(c *Hash_partbound_elemContext) + + // EnterHash_partbound is called when entering the hash_partbound production. + EnterHash_partbound(c *Hash_partboundContext) + + // EnterAltercompositetypestmt is called when entering the altercompositetypestmt production. + EnterAltercompositetypestmt(c *AltercompositetypestmtContext) + + // EnterAlter_type_cmds is called when entering the alter_type_cmds production. + EnterAlter_type_cmds(c *Alter_type_cmdsContext) + + // EnterAlter_type_cmd is called when entering the alter_type_cmd production. + EnterAlter_type_cmd(c *Alter_type_cmdContext) + + // EnterCloseportalstmt is called when entering the closeportalstmt production. + EnterCloseportalstmt(c *CloseportalstmtContext) + + // EnterCopystmt is called when entering the copystmt production. + EnterCopystmt(c *CopystmtContext) + + // EnterCopy_from is called when entering the copy_from production. + EnterCopy_from(c *Copy_fromContext) + + // EnterOpt_program is called when entering the opt_program production. + EnterOpt_program(c *Opt_programContext) + + // EnterCopy_file_name is called when entering the copy_file_name production. + EnterCopy_file_name(c *Copy_file_nameContext) + + // EnterCopy_options is called when entering the copy_options production. + EnterCopy_options(c *Copy_optionsContext) + + // EnterCopy_opt_list is called when entering the copy_opt_list production. + EnterCopy_opt_list(c *Copy_opt_listContext) + + // EnterCopy_opt_item is called when entering the copy_opt_item production. + EnterCopy_opt_item(c *Copy_opt_itemContext) + + // EnterOpt_binary is called when entering the opt_binary production. + EnterOpt_binary(c *Opt_binaryContext) + + // EnterCopy_delimiter is called when entering the copy_delimiter production. + EnterCopy_delimiter(c *Copy_delimiterContext) + + // EnterOpt_using is called when entering the opt_using production. + EnterOpt_using(c *Opt_usingContext) + + // EnterCopy_generic_opt_list is called when entering the copy_generic_opt_list production. + EnterCopy_generic_opt_list(c *Copy_generic_opt_listContext) + + // EnterCopy_generic_opt_elem is called when entering the copy_generic_opt_elem production. + EnterCopy_generic_opt_elem(c *Copy_generic_opt_elemContext) + + // EnterCopy_generic_opt_arg is called when entering the copy_generic_opt_arg production. + EnterCopy_generic_opt_arg(c *Copy_generic_opt_argContext) + + // EnterCopy_generic_opt_arg_list is called when entering the copy_generic_opt_arg_list production. + EnterCopy_generic_opt_arg_list(c *Copy_generic_opt_arg_listContext) + + // EnterCopy_generic_opt_arg_list_item is called when entering the copy_generic_opt_arg_list_item production. + EnterCopy_generic_opt_arg_list_item(c *Copy_generic_opt_arg_list_itemContext) + + // EnterCreatestmt is called when entering the createstmt production. + EnterCreatestmt(c *CreatestmtContext) + + // EnterOpttemp is called when entering the opttemp production. + EnterOpttemp(c *OpttempContext) + + // EnterOpttableelementlist is called when entering the opttableelementlist production. + EnterOpttableelementlist(c *OpttableelementlistContext) + + // EnterOpttypedtableelementlist is called when entering the opttypedtableelementlist production. + EnterOpttypedtableelementlist(c *OpttypedtableelementlistContext) + + // EnterTableelementlist is called when entering the tableelementlist production. + EnterTableelementlist(c *TableelementlistContext) + + // EnterTypedtableelementlist is called when entering the typedtableelementlist production. + EnterTypedtableelementlist(c *TypedtableelementlistContext) + + // EnterTableelement is called when entering the tableelement production. + EnterTableelement(c *TableelementContext) + + // EnterTypedtableelement is called when entering the typedtableelement production. + EnterTypedtableelement(c *TypedtableelementContext) + + // EnterColumnDef is called when entering the columnDef production. + EnterColumnDef(c *ColumnDefContext) + + // EnterRs_colattributes is called when entering the rs_colattributes production. + EnterRs_colattributes(c *Rs_colattributesContext) + + // EnterColumnOptions is called when entering the columnOptions production. + EnterColumnOptions(c *ColumnOptionsContext) + + // EnterColquallist is called when entering the colquallist production. + EnterColquallist(c *ColquallistContext) + + // EnterColconstraint is called when entering the colconstraint production. + EnterColconstraint(c *ColconstraintContext) + + // EnterColconstraintelem is called when entering the colconstraintelem production. + EnterColconstraintelem(c *ColconstraintelemContext) + + // EnterOpt_unique_null_treatment is called when entering the opt_unique_null_treatment production. + EnterOpt_unique_null_treatment(c *Opt_unique_null_treatmentContext) + + // EnterGenerated_when is called when entering the generated_when production. + EnterGenerated_when(c *Generated_whenContext) + + // EnterConstraintattr is called when entering the constraintattr production. + EnterConstraintattr(c *ConstraintattrContext) + + // EnterTablelikeclause is called when entering the tablelikeclause production. + EnterTablelikeclause(c *TablelikeclauseContext) + + // EnterTablelikeoptionlist is called when entering the tablelikeoptionlist production. + EnterTablelikeoptionlist(c *TablelikeoptionlistContext) + + // EnterTablelikeoption is called when entering the tablelikeoption production. + EnterTablelikeoption(c *TablelikeoptionContext) + + // EnterTableconstraint is called when entering the tableconstraint production. + EnterTableconstraint(c *TableconstraintContext) + + // EnterConstraintelem is called when entering the constraintelem production. + EnterConstraintelem(c *ConstraintelemContext) + + // EnterOpt_no_inherit is called when entering the opt_no_inherit production. + EnterOpt_no_inherit(c *Opt_no_inheritContext) + + // EnterOpt_column_list is called when entering the opt_column_list production. + EnterOpt_column_list(c *Opt_column_listContext) + + // EnterColumnlist is called when entering the columnlist production. + EnterColumnlist(c *ColumnlistContext) + + // EnterColumnElem is called when entering the columnElem production. + EnterColumnElem(c *ColumnElemContext) + + // EnterOpt_c_include is called when entering the opt_c_include production. + EnterOpt_c_include(c *Opt_c_includeContext) + + // EnterKey_match is called when entering the key_match production. + EnterKey_match(c *Key_matchContext) + + // EnterExclusionconstraintlist is called when entering the exclusionconstraintlist production. + EnterExclusionconstraintlist(c *ExclusionconstraintlistContext) + + // EnterExclusionconstraintelem is called when entering the exclusionconstraintelem production. + EnterExclusionconstraintelem(c *ExclusionconstraintelemContext) + + // EnterExclusionwhereclause is called when entering the exclusionwhereclause production. + EnterExclusionwhereclause(c *ExclusionwhereclauseContext) + + // EnterKey_actions is called when entering the key_actions production. + EnterKey_actions(c *Key_actionsContext) + + // EnterKey_update is called when entering the key_update production. + EnterKey_update(c *Key_updateContext) + + // EnterKey_delete is called when entering the key_delete production. + EnterKey_delete(c *Key_deleteContext) + + // EnterKey_action is called when entering the key_action production. + EnterKey_action(c *Key_actionContext) + + // EnterOptinherit is called when entering the optinherit production. + EnterOptinherit(c *OptinheritContext) + + // EnterOptpartitionspec is called when entering the optpartitionspec production. + EnterOptpartitionspec(c *OptpartitionspecContext) + + // EnterPartitionspec is called when entering the partitionspec production. + EnterPartitionspec(c *PartitionspecContext) + + // EnterPart_params is called when entering the part_params production. + EnterPart_params(c *Part_paramsContext) + + // EnterPart_elem is called when entering the part_elem production. + EnterPart_elem(c *Part_elemContext) + + // EnterTable_access_method_clause is called when entering the table_access_method_clause production. + EnterTable_access_method_clause(c *Table_access_method_clauseContext) + + // EnterOptwith is called when entering the optwith production. + EnterOptwith(c *OptwithContext) + + // EnterOncommitoption is called when entering the oncommitoption production. + EnterOncommitoption(c *OncommitoptionContext) + + // EnterOpttablespace is called when entering the opttablespace production. + EnterOpttablespace(c *OpttablespaceContext) + + // EnterOptconstablespace is called when entering the optconstablespace production. + EnterOptconstablespace(c *OptconstablespaceContext) + + // EnterExistingindex is called when entering the existingindex production. + EnterExistingindex(c *ExistingindexContext) + + // EnterCreatestatsstmt is called when entering the createstatsstmt production. + EnterCreatestatsstmt(c *CreatestatsstmtContext) + + // EnterAlterstatsstmt is called when entering the alterstatsstmt production. + EnterAlterstatsstmt(c *AlterstatsstmtContext) + + // EnterCreateasstmt is called when entering the createasstmt production. + EnterCreateasstmt(c *CreateasstmtContext) + + // EnterCreate_as_target is called when entering the create_as_target production. + EnterCreate_as_target(c *Create_as_targetContext) + + // EnterOpt_with_data is called when entering the opt_with_data production. + EnterOpt_with_data(c *Opt_with_dataContext) + + // EnterCreatematviewstmt is called when entering the creatematviewstmt production. + EnterCreatematviewstmt(c *CreatematviewstmtContext) + + // EnterCreate_mv_target is called when entering the create_mv_target production. + EnterCreate_mv_target(c *Create_mv_targetContext) + + // EnterOptnolog is called when entering the optnolog production. + EnterOptnolog(c *OptnologContext) + + // EnterRefreshmatviewstmt is called when entering the refreshmatviewstmt production. + EnterRefreshmatviewstmt(c *RefreshmatviewstmtContext) + + // EnterCreateseqstmt is called when entering the createseqstmt production. + EnterCreateseqstmt(c *CreateseqstmtContext) + + // EnterAlterseqstmt is called when entering the alterseqstmt production. + EnterAlterseqstmt(c *AlterseqstmtContext) + + // EnterOptseqoptlist is called when entering the optseqoptlist production. + EnterOptseqoptlist(c *OptseqoptlistContext) + + // EnterOptparenthesizedseqoptlist is called when entering the optparenthesizedseqoptlist production. + EnterOptparenthesizedseqoptlist(c *OptparenthesizedseqoptlistContext) + + // EnterSeqoptlist is called when entering the seqoptlist production. + EnterSeqoptlist(c *SeqoptlistContext) + + // EnterSeqoptelem is called when entering the seqoptelem production. + EnterSeqoptelem(c *SeqoptelemContext) + + // EnterOpt_by is called when entering the opt_by production. + EnterOpt_by(c *Opt_byContext) + + // EnterNumericonly is called when entering the numericonly production. + EnterNumericonly(c *NumericonlyContext) + + // EnterNumericonly_list is called when entering the numericonly_list production. + EnterNumericonly_list(c *Numericonly_listContext) + + // EnterCreateplangstmt is called when entering the createplangstmt production. + EnterCreateplangstmt(c *CreateplangstmtContext) + + // EnterOpt_trusted is called when entering the opt_trusted production. + EnterOpt_trusted(c *Opt_trustedContext) + + // EnterHandler_name is called when entering the handler_name production. + EnterHandler_name(c *Handler_nameContext) + + // EnterOpt_inline_handler is called when entering the opt_inline_handler production. + EnterOpt_inline_handler(c *Opt_inline_handlerContext) + + // EnterValidator_clause is called when entering the validator_clause production. + EnterValidator_clause(c *Validator_clauseContext) + + // EnterOpt_validator is called when entering the opt_validator production. + EnterOpt_validator(c *Opt_validatorContext) + + // EnterOpt_procedural is called when entering the opt_procedural production. + EnterOpt_procedural(c *Opt_proceduralContext) + + // EnterCreatetablespacestmt is called when entering the createtablespacestmt production. + EnterCreatetablespacestmt(c *CreatetablespacestmtContext) + + // EnterOpttablespaceowner is called when entering the opttablespaceowner production. + EnterOpttablespaceowner(c *OpttablespaceownerContext) + + // EnterDroptablespacestmt is called when entering the droptablespacestmt production. + EnterDroptablespacestmt(c *DroptablespacestmtContext) + + // EnterCreateextensionstmt is called when entering the createextensionstmt production. + EnterCreateextensionstmt(c *CreateextensionstmtContext) + + // EnterCreate_extension_opt_list is called when entering the create_extension_opt_list production. + EnterCreate_extension_opt_list(c *Create_extension_opt_listContext) + + // EnterCreate_extension_opt_item is called when entering the create_extension_opt_item production. + EnterCreate_extension_opt_item(c *Create_extension_opt_itemContext) + + // EnterAlterextensionstmt is called when entering the alterextensionstmt production. + EnterAlterextensionstmt(c *AlterextensionstmtContext) + + // EnterAlter_extension_opt_list is called when entering the alter_extension_opt_list production. + EnterAlter_extension_opt_list(c *Alter_extension_opt_listContext) + + // EnterAlter_extension_opt_item is called when entering the alter_extension_opt_item production. + EnterAlter_extension_opt_item(c *Alter_extension_opt_itemContext) + + // EnterAlterextensioncontentsstmt is called when entering the alterextensioncontentsstmt production. + EnterAlterextensioncontentsstmt(c *AlterextensioncontentsstmtContext) + + // EnterCreatefdwstmt is called when entering the createfdwstmt production. + EnterCreatefdwstmt(c *CreatefdwstmtContext) + + // EnterFdw_option is called when entering the fdw_option production. + EnterFdw_option(c *Fdw_optionContext) + + // EnterFdw_options is called when entering the fdw_options production. + EnterFdw_options(c *Fdw_optionsContext) + + // EnterOpt_fdw_options is called when entering the opt_fdw_options production. + EnterOpt_fdw_options(c *Opt_fdw_optionsContext) + + // EnterAlterfdwstmt is called when entering the alterfdwstmt production. + EnterAlterfdwstmt(c *AlterfdwstmtContext) + + // EnterCreate_generic_options is called when entering the create_generic_options production. + EnterCreate_generic_options(c *Create_generic_optionsContext) + + // EnterGeneric_option_list is called when entering the generic_option_list production. + EnterGeneric_option_list(c *Generic_option_listContext) + + // EnterAlter_generic_options is called when entering the alter_generic_options production. + EnterAlter_generic_options(c *Alter_generic_optionsContext) + + // EnterAlter_generic_option_list is called when entering the alter_generic_option_list production. + EnterAlter_generic_option_list(c *Alter_generic_option_listContext) + + // EnterAlter_generic_option_elem is called when entering the alter_generic_option_elem production. + EnterAlter_generic_option_elem(c *Alter_generic_option_elemContext) + + // EnterGeneric_option_elem is called when entering the generic_option_elem production. + EnterGeneric_option_elem(c *Generic_option_elemContext) + + // EnterGeneric_option_name is called when entering the generic_option_name production. + EnterGeneric_option_name(c *Generic_option_nameContext) + + // EnterGeneric_option_arg is called when entering the generic_option_arg production. + EnterGeneric_option_arg(c *Generic_option_argContext) + + // EnterCreateforeignserverstmt is called when entering the createforeignserverstmt production. + EnterCreateforeignserverstmt(c *CreateforeignserverstmtContext) + + // EnterOpt_type is called when entering the opt_type production. + EnterOpt_type(c *Opt_typeContext) + + // EnterForeign_server_version is called when entering the foreign_server_version production. + EnterForeign_server_version(c *Foreign_server_versionContext) + + // EnterOpt_foreign_server_version is called when entering the opt_foreign_server_version production. + EnterOpt_foreign_server_version(c *Opt_foreign_server_versionContext) + + // EnterAlterforeignserverstmt is called when entering the alterforeignserverstmt production. + EnterAlterforeignserverstmt(c *AlterforeignserverstmtContext) + + // EnterCreateforeigntablestmt is called when entering the createforeigntablestmt production. + EnterCreateforeigntablestmt(c *CreateforeigntablestmtContext) + + // EnterImportforeignschemastmt is called when entering the importforeignschemastmt production. + EnterImportforeignschemastmt(c *ImportforeignschemastmtContext) + + // EnterImport_qualification_type is called when entering the import_qualification_type production. + EnterImport_qualification_type(c *Import_qualification_typeContext) + + // EnterImport_qualification is called when entering the import_qualification production. + EnterImport_qualification(c *Import_qualificationContext) + + // EnterCreateusermappingstmt is called when entering the createusermappingstmt production. + EnterCreateusermappingstmt(c *CreateusermappingstmtContext) + + // EnterAuth_ident is called when entering the auth_ident production. + EnterAuth_ident(c *Auth_identContext) + + // EnterDropusermappingstmt is called when entering the dropusermappingstmt production. + EnterDropusermappingstmt(c *DropusermappingstmtContext) + + // EnterAlterusermappingstmt is called when entering the alterusermappingstmt production. + EnterAlterusermappingstmt(c *AlterusermappingstmtContext) + + // EnterCreatepolicystmt is called when entering the createpolicystmt production. + EnterCreatepolicystmt(c *CreatepolicystmtContext) + + // EnterAlterpolicystmt is called when entering the alterpolicystmt production. + EnterAlterpolicystmt(c *AlterpolicystmtContext) + + // EnterRowsecurityoptionalexpr is called when entering the rowsecurityoptionalexpr production. + EnterRowsecurityoptionalexpr(c *RowsecurityoptionalexprContext) + + // EnterRowsecurityoptionalwithcheck is called when entering the rowsecurityoptionalwithcheck production. + EnterRowsecurityoptionalwithcheck(c *RowsecurityoptionalwithcheckContext) + + // EnterRowsecuritydefaulttorole is called when entering the rowsecuritydefaulttorole production. + EnterRowsecuritydefaulttorole(c *RowsecuritydefaulttoroleContext) + + // EnterRowsecurityoptionaltorole is called when entering the rowsecurityoptionaltorole production. + EnterRowsecurityoptionaltorole(c *RowsecurityoptionaltoroleContext) + + // EnterRowsecuritydefaultpermissive is called when entering the rowsecuritydefaultpermissive production. + EnterRowsecuritydefaultpermissive(c *RowsecuritydefaultpermissiveContext) + + // EnterRowsecuritydefaultforcmd is called when entering the rowsecuritydefaultforcmd production. + EnterRowsecuritydefaultforcmd(c *RowsecuritydefaultforcmdContext) + + // EnterRow_security_cmd is called when entering the row_security_cmd production. + EnterRow_security_cmd(c *Row_security_cmdContext) + + // EnterCreateamstmt is called when entering the createamstmt production. + EnterCreateamstmt(c *CreateamstmtContext) + + // EnterAm_type is called when entering the am_type production. + EnterAm_type(c *Am_typeContext) + + // EnterCreatetrigstmt is called when entering the createtrigstmt production. + EnterCreatetrigstmt(c *CreatetrigstmtContext) + + // EnterTriggeractiontime is called when entering the triggeractiontime production. + EnterTriggeractiontime(c *TriggeractiontimeContext) + + // EnterTriggerevents is called when entering the triggerevents production. + EnterTriggerevents(c *TriggereventsContext) + + // EnterTriggeroneevent is called when entering the triggeroneevent production. + EnterTriggeroneevent(c *TriggeroneeventContext) + + // EnterTriggerreferencing is called when entering the triggerreferencing production. + EnterTriggerreferencing(c *TriggerreferencingContext) + + // EnterTriggertransitions is called when entering the triggertransitions production. + EnterTriggertransitions(c *TriggertransitionsContext) + + // EnterTriggertransition is called when entering the triggertransition production. + EnterTriggertransition(c *TriggertransitionContext) + + // EnterTransitionoldornew is called when entering the transitionoldornew production. + EnterTransitionoldornew(c *TransitionoldornewContext) + + // EnterTransitionrowortable is called when entering the transitionrowortable production. + EnterTransitionrowortable(c *TransitionrowortableContext) + + // EnterTransitionrelname is called when entering the transitionrelname production. + EnterTransitionrelname(c *TransitionrelnameContext) + + // EnterTriggerforspec is called when entering the triggerforspec production. + EnterTriggerforspec(c *TriggerforspecContext) + + // EnterTriggerforopteach is called when entering the triggerforopteach production. + EnterTriggerforopteach(c *TriggerforopteachContext) + + // EnterTriggerfortype is called when entering the triggerfortype production. + EnterTriggerfortype(c *TriggerfortypeContext) + + // EnterTriggerwhen is called when entering the triggerwhen production. + EnterTriggerwhen(c *TriggerwhenContext) + + // EnterFunction_or_procedure is called when entering the function_or_procedure production. + EnterFunction_or_procedure(c *Function_or_procedureContext) + + // EnterTriggerfuncargs is called when entering the triggerfuncargs production. + EnterTriggerfuncargs(c *TriggerfuncargsContext) + + // EnterTriggerfuncarg is called when entering the triggerfuncarg production. + EnterTriggerfuncarg(c *TriggerfuncargContext) + + // EnterOptconstrfromtable is called when entering the optconstrfromtable production. + EnterOptconstrfromtable(c *OptconstrfromtableContext) + + // EnterConstraintattributespec is called when entering the constraintattributespec production. + EnterConstraintattributespec(c *ConstraintattributespecContext) + + // EnterConstraintattributeElem is called when entering the constraintattributeElem production. + EnterConstraintattributeElem(c *ConstraintattributeElemContext) + + // EnterCreateeventtrigstmt is called when entering the createeventtrigstmt production. + EnterCreateeventtrigstmt(c *CreateeventtrigstmtContext) + + // EnterEvent_trigger_when_list is called when entering the event_trigger_when_list production. + EnterEvent_trigger_when_list(c *Event_trigger_when_listContext) + + // EnterEvent_trigger_when_item is called when entering the event_trigger_when_item production. + EnterEvent_trigger_when_item(c *Event_trigger_when_itemContext) + + // EnterEvent_trigger_value_list is called when entering the event_trigger_value_list production. + EnterEvent_trigger_value_list(c *Event_trigger_value_listContext) + + // EnterAltereventtrigstmt is called when entering the altereventtrigstmt production. + EnterAltereventtrigstmt(c *AltereventtrigstmtContext) + + // EnterEnable_trigger is called when entering the enable_trigger production. + EnterEnable_trigger(c *Enable_triggerContext) + + // EnterCreateassertionstmt is called when entering the createassertionstmt production. + EnterCreateassertionstmt(c *CreateassertionstmtContext) + + // EnterDefinestmt is called when entering the definestmt production. + EnterDefinestmt(c *DefinestmtContext) + + // EnterDefinition is called when entering the definition production. + EnterDefinition(c *DefinitionContext) + + // EnterDef_list is called when entering the def_list production. + EnterDef_list(c *Def_listContext) + + // EnterDef_elem is called when entering the def_elem production. + EnterDef_elem(c *Def_elemContext) + + // EnterDef_arg is called when entering the def_arg production. + EnterDef_arg(c *Def_argContext) + + // EnterOld_aggr_definition is called when entering the old_aggr_definition production. + EnterOld_aggr_definition(c *Old_aggr_definitionContext) + + // EnterOld_aggr_list is called when entering the old_aggr_list production. + EnterOld_aggr_list(c *Old_aggr_listContext) + + // EnterOld_aggr_elem is called when entering the old_aggr_elem production. + EnterOld_aggr_elem(c *Old_aggr_elemContext) + + // EnterOpt_enum_val_list is called when entering the opt_enum_val_list production. + EnterOpt_enum_val_list(c *Opt_enum_val_listContext) + + // EnterEnum_val_list is called when entering the enum_val_list production. + EnterEnum_val_list(c *Enum_val_listContext) + + // EnterAlterenumstmt is called when entering the alterenumstmt production. + EnterAlterenumstmt(c *AlterenumstmtContext) + + // EnterOpt_if_not_exists is called when entering the opt_if_not_exists production. + EnterOpt_if_not_exists(c *Opt_if_not_existsContext) + + // EnterCreateopclassstmt is called when entering the createopclassstmt production. + EnterCreateopclassstmt(c *CreateopclassstmtContext) + + // EnterOpclass_item_list is called when entering the opclass_item_list production. + EnterOpclass_item_list(c *Opclass_item_listContext) + + // EnterOpclass_item is called when entering the opclass_item production. + EnterOpclass_item(c *Opclass_itemContext) + + // EnterOpt_default is called when entering the opt_default production. + EnterOpt_default(c *Opt_defaultContext) + + // EnterOpt_opfamily is called when entering the opt_opfamily production. + EnterOpt_opfamily(c *Opt_opfamilyContext) + + // EnterOpclass_purpose is called when entering the opclass_purpose production. + EnterOpclass_purpose(c *Opclass_purposeContext) + + // EnterOpt_recheck is called when entering the opt_recheck production. + EnterOpt_recheck(c *Opt_recheckContext) + + // EnterCreateopfamilystmt is called when entering the createopfamilystmt production. + EnterCreateopfamilystmt(c *CreateopfamilystmtContext) + + // EnterAlteropfamilystmt is called when entering the alteropfamilystmt production. + EnterAlteropfamilystmt(c *AlteropfamilystmtContext) + + // EnterOpclass_drop_list is called when entering the opclass_drop_list production. + EnterOpclass_drop_list(c *Opclass_drop_listContext) + + // EnterOpclass_drop is called when entering the opclass_drop production. + EnterOpclass_drop(c *Opclass_dropContext) + + // EnterDropopclassstmt is called when entering the dropopclassstmt production. + EnterDropopclassstmt(c *DropopclassstmtContext) + + // EnterDropopfamilystmt is called when entering the dropopfamilystmt production. + EnterDropopfamilystmt(c *DropopfamilystmtContext) + + // EnterDropownedstmt is called when entering the dropownedstmt production. + EnterDropownedstmt(c *DropownedstmtContext) + + // EnterReassignownedstmt is called when entering the reassignownedstmt production. + EnterReassignownedstmt(c *ReassignownedstmtContext) + + // EnterDropstmt is called when entering the dropstmt production. + EnterDropstmt(c *DropstmtContext) + + // EnterObject_type_any_name is called when entering the object_type_any_name production. + EnterObject_type_any_name(c *Object_type_any_nameContext) + + // EnterObject_type_name is called when entering the object_type_name production. + EnterObject_type_name(c *Object_type_nameContext) + + // EnterDrop_type_name is called when entering the drop_type_name production. + EnterDrop_type_name(c *Drop_type_nameContext) + + // EnterObject_type_name_on_any_name is called when entering the object_type_name_on_any_name production. + EnterObject_type_name_on_any_name(c *Object_type_name_on_any_nameContext) + + // EnterAny_name_list is called when entering the any_name_list production. + EnterAny_name_list(c *Any_name_listContext) + + // EnterAny_name is called when entering the any_name production. + EnterAny_name(c *Any_nameContext) + + // EnterAttrs is called when entering the attrs production. + EnterAttrs(c *AttrsContext) + + // EnterType_name_list is called when entering the type_name_list production. + EnterType_name_list(c *Type_name_listContext) + + // EnterTruncatestmt is called when entering the truncatestmt production. + EnterTruncatestmt(c *TruncatestmtContext) + + // EnterOpt_restart_seqs is called when entering the opt_restart_seqs production. + EnterOpt_restart_seqs(c *Opt_restart_seqsContext) + + // EnterCommentstmt is called when entering the commentstmt production. + EnterCommentstmt(c *CommentstmtContext) + + // EnterComment_text is called when entering the comment_text production. + EnterComment_text(c *Comment_textContext) + + // EnterSeclabelstmt is called when entering the seclabelstmt production. + EnterSeclabelstmt(c *SeclabelstmtContext) + + // EnterOpt_provider is called when entering the opt_provider production. + EnterOpt_provider(c *Opt_providerContext) + + // EnterSecurity_label is called when entering the security_label production. + EnterSecurity_label(c *Security_labelContext) + + // EnterFetchstmt is called when entering the fetchstmt production. + EnterFetchstmt(c *FetchstmtContext) + + // EnterFetch_args is called when entering the fetch_args production. + EnterFetch_args(c *Fetch_argsContext) + + // EnterFrom_in is called when entering the from_in production. + EnterFrom_in(c *From_inContext) + + // EnterOpt_from_in is called when entering the opt_from_in production. + EnterOpt_from_in(c *Opt_from_inContext) + + // EnterGrantstmt is called when entering the grantstmt production. + EnterGrantstmt(c *GrantstmtContext) + + // EnterRevokestmt is called when entering the revokestmt production. + EnterRevokestmt(c *RevokestmtContext) + + // EnterPrivileges is called when entering the privileges production. + EnterPrivileges(c *PrivilegesContext) + + // EnterPrivilege_list is called when entering the privilege_list production. + EnterPrivilege_list(c *Privilege_listContext) + + // EnterPrivilege is called when entering the privilege production. + EnterPrivilege(c *PrivilegeContext) + + // EnterPrivilege_target is called when entering the privilege_target production. + EnterPrivilege_target(c *Privilege_targetContext) + + // EnterParameter_name_list is called when entering the parameter_name_list production. + EnterParameter_name_list(c *Parameter_name_listContext) + + // EnterParameter_name is called when entering the parameter_name production. + EnterParameter_name(c *Parameter_nameContext) + + // EnterGrantee_list is called when entering the grantee_list production. + EnterGrantee_list(c *Grantee_listContext) + + // EnterGrantee is called when entering the grantee production. + EnterGrantee(c *GranteeContext) + + // EnterOpt_grant_grant_option is called when entering the opt_grant_grant_option production. + EnterOpt_grant_grant_option(c *Opt_grant_grant_optionContext) + + // EnterGrantrolestmt is called when entering the grantrolestmt production. + EnterGrantrolestmt(c *GrantrolestmtContext) + + // EnterRevokerolestmt is called when entering the revokerolestmt production. + EnterRevokerolestmt(c *RevokerolestmtContext) + + // EnterOpt_grant_admin_option is called when entering the opt_grant_admin_option production. + EnterOpt_grant_admin_option(c *Opt_grant_admin_optionContext) + + // EnterOpt_granted_by is called when entering the opt_granted_by production. + EnterOpt_granted_by(c *Opt_granted_byContext) + + // EnterAlterdefaultprivilegesstmt is called when entering the alterdefaultprivilegesstmt production. + EnterAlterdefaultprivilegesstmt(c *AlterdefaultprivilegesstmtContext) + + // EnterDefacloptionlist is called when entering the defacloptionlist production. + EnterDefacloptionlist(c *DefacloptionlistContext) + + // EnterDefacloption is called when entering the defacloption production. + EnterDefacloption(c *DefacloptionContext) + + // EnterDefaclaction is called when entering the defaclaction production. + EnterDefaclaction(c *DefaclactionContext) + + // EnterDefacl_privilege_target is called when entering the defacl_privilege_target production. + EnterDefacl_privilege_target(c *Defacl_privilege_targetContext) + + // EnterIndexstmt is called when entering the indexstmt production. + EnterIndexstmt(c *IndexstmtContext) + + // EnterOpt_unique is called when entering the opt_unique production. + EnterOpt_unique(c *Opt_uniqueContext) + + // EnterOpt_concurrently is called when entering the opt_concurrently production. + EnterOpt_concurrently(c *Opt_concurrentlyContext) + + // EnterOpt_index_name is called when entering the opt_index_name production. + EnterOpt_index_name(c *Opt_index_nameContext) + + // EnterAccess_method_clause is called when entering the access_method_clause production. + EnterAccess_method_clause(c *Access_method_clauseContext) + + // EnterIndex_params is called when entering the index_params production. + EnterIndex_params(c *Index_paramsContext) + + // EnterIndex_elem_options is called when entering the index_elem_options production. + EnterIndex_elem_options(c *Index_elem_optionsContext) + + // EnterIndex_elem is called when entering the index_elem production. + EnterIndex_elem(c *Index_elemContext) + + // EnterOpt_include is called when entering the opt_include production. + EnterOpt_include(c *Opt_includeContext) + + // EnterIndex_including_params is called when entering the index_including_params production. + EnterIndex_including_params(c *Index_including_paramsContext) + + // EnterOpt_collate is called when entering the opt_collate production. + EnterOpt_collate(c *Opt_collateContext) + + // EnterOpt_class is called when entering the opt_class production. + EnterOpt_class(c *Opt_classContext) + + // EnterOpt_asc_desc is called when entering the opt_asc_desc production. + EnterOpt_asc_desc(c *Opt_asc_descContext) + + // EnterOpt_nulls_order is called when entering the opt_nulls_order production. + EnterOpt_nulls_order(c *Opt_nulls_orderContext) + + // EnterCreatefunctionstmt is called when entering the createfunctionstmt production. + EnterCreatefunctionstmt(c *CreatefunctionstmtContext) + + // EnterOpt_or_replace is called when entering the opt_or_replace production. + EnterOpt_or_replace(c *Opt_or_replaceContext) + + // EnterFunc_args is called when entering the func_args production. + EnterFunc_args(c *Func_argsContext) + + // EnterFunc_args_list is called when entering the func_args_list production. + EnterFunc_args_list(c *Func_args_listContext) + + // EnterFunction_with_argtypes_list is called when entering the function_with_argtypes_list production. + EnterFunction_with_argtypes_list(c *Function_with_argtypes_listContext) + + // EnterFunction_with_argtypes is called when entering the function_with_argtypes production. + EnterFunction_with_argtypes(c *Function_with_argtypesContext) + + // EnterFunc_args_with_defaults is called when entering the func_args_with_defaults production. + EnterFunc_args_with_defaults(c *Func_args_with_defaultsContext) + + // EnterFunc_args_with_defaults_list is called when entering the func_args_with_defaults_list production. + EnterFunc_args_with_defaults_list(c *Func_args_with_defaults_listContext) + + // EnterFunc_arg is called when entering the func_arg production. + EnterFunc_arg(c *Func_argContext) + + // EnterArg_class is called when entering the arg_class production. + EnterArg_class(c *Arg_classContext) + + // EnterParam_name is called when entering the param_name production. + EnterParam_name(c *Param_nameContext) + + // EnterFunc_return is called when entering the func_return production. + EnterFunc_return(c *Func_returnContext) + + // EnterFunc_type is called when entering the func_type production. + EnterFunc_type(c *Func_typeContext) + + // EnterFunc_arg_with_default is called when entering the func_arg_with_default production. + EnterFunc_arg_with_default(c *Func_arg_with_defaultContext) + + // EnterAggr_arg is called when entering the aggr_arg production. + EnterAggr_arg(c *Aggr_argContext) + + // EnterAggr_args is called when entering the aggr_args production. + EnterAggr_args(c *Aggr_argsContext) + + // EnterAggr_args_list is called when entering the aggr_args_list production. + EnterAggr_args_list(c *Aggr_args_listContext) + + // EnterAggregate_with_argtypes is called when entering the aggregate_with_argtypes production. + EnterAggregate_with_argtypes(c *Aggregate_with_argtypesContext) + + // EnterAggregate_with_argtypes_list is called when entering the aggregate_with_argtypes_list production. + EnterAggregate_with_argtypes_list(c *Aggregate_with_argtypes_listContext) + + // EnterCreatefunc_opt_list is called when entering the createfunc_opt_list production. + EnterCreatefunc_opt_list(c *Createfunc_opt_listContext) + + // EnterCommon_func_opt_item is called when entering the common_func_opt_item production. + EnterCommon_func_opt_item(c *Common_func_opt_itemContext) + + // EnterCreatefunc_opt_item is called when entering the createfunc_opt_item production. + EnterCreatefunc_opt_item(c *Createfunc_opt_itemContext) + + // EnterFunc_as is called when entering the func_as production. + EnterFunc_as(c *Func_asContext) + + // EnterTransform_type_list is called when entering the transform_type_list production. + EnterTransform_type_list(c *Transform_type_listContext) + + // EnterOpt_definition is called when entering the opt_definition production. + EnterOpt_definition(c *Opt_definitionContext) + + // EnterTable_func_column is called when entering the table_func_column production. + EnterTable_func_column(c *Table_func_columnContext) + + // EnterTable_func_column_list is called when entering the table_func_column_list production. + EnterTable_func_column_list(c *Table_func_column_listContext) + + // EnterAlterfunctionstmt is called when entering the alterfunctionstmt production. + EnterAlterfunctionstmt(c *AlterfunctionstmtContext) + + // EnterAlterfunc_opt_list is called when entering the alterfunc_opt_list production. + EnterAlterfunc_opt_list(c *Alterfunc_opt_listContext) + + // EnterOpt_restrict is called when entering the opt_restrict production. + EnterOpt_restrict(c *Opt_restrictContext) + + // EnterRemovefuncstmt is called when entering the removefuncstmt production. + EnterRemovefuncstmt(c *RemovefuncstmtContext) + + // EnterRemoveaggrstmt is called when entering the removeaggrstmt production. + EnterRemoveaggrstmt(c *RemoveaggrstmtContext) + + // EnterRemoveoperstmt is called when entering the removeoperstmt production. + EnterRemoveoperstmt(c *RemoveoperstmtContext) + + // EnterOper_argtypes is called when entering the oper_argtypes production. + EnterOper_argtypes(c *Oper_argtypesContext) + + // EnterAny_operator is called when entering the any_operator production. + EnterAny_operator(c *Any_operatorContext) + + // EnterOperator_with_argtypes_list is called when entering the operator_with_argtypes_list production. + EnterOperator_with_argtypes_list(c *Operator_with_argtypes_listContext) + + // EnterOperator_with_argtypes is called when entering the operator_with_argtypes production. + EnterOperator_with_argtypes(c *Operator_with_argtypesContext) + + // EnterDostmt is called when entering the dostmt production. + EnterDostmt(c *DostmtContext) + + // EnterDostmt_opt_list is called when entering the dostmt_opt_list production. + EnterDostmt_opt_list(c *Dostmt_opt_listContext) + + // EnterDostmt_opt_item is called when entering the dostmt_opt_item production. + EnterDostmt_opt_item(c *Dostmt_opt_itemContext) + + // EnterCreatecaststmt is called when entering the createcaststmt production. + EnterCreatecaststmt(c *CreatecaststmtContext) + + // EnterCast_context is called when entering the cast_context production. + EnterCast_context(c *Cast_contextContext) + + // EnterDropcaststmt is called when entering the dropcaststmt production. + EnterDropcaststmt(c *DropcaststmtContext) + + // EnterOpt_if_exists is called when entering the opt_if_exists production. + EnterOpt_if_exists(c *Opt_if_existsContext) + + // EnterCreatetransformstmt is called when entering the createtransformstmt production. + EnterCreatetransformstmt(c *CreatetransformstmtContext) + + // EnterTransform_element_list is called when entering the transform_element_list production. + EnterTransform_element_list(c *Transform_element_listContext) + + // EnterDroptransformstmt is called when entering the droptransformstmt production. + EnterDroptransformstmt(c *DroptransformstmtContext) + + // EnterReindexstmt is called when entering the reindexstmt production. + EnterReindexstmt(c *ReindexstmtContext) + + // EnterReindex_target_type is called when entering the reindex_target_type production. + EnterReindex_target_type(c *Reindex_target_typeContext) + + // EnterReindex_target_multitable is called when entering the reindex_target_multitable production. + EnterReindex_target_multitable(c *Reindex_target_multitableContext) + + // EnterReindex_option_list is called when entering the reindex_option_list production. + EnterReindex_option_list(c *Reindex_option_listContext) + + // EnterReindex_option_elem is called when entering the reindex_option_elem production. + EnterReindex_option_elem(c *Reindex_option_elemContext) + + // EnterAltertblspcstmt is called when entering the altertblspcstmt production. + EnterAltertblspcstmt(c *AltertblspcstmtContext) + + // EnterRenamestmt is called when entering the renamestmt production. + EnterRenamestmt(c *RenamestmtContext) + + // EnterOpt_column is called when entering the opt_column production. + EnterOpt_column(c *Opt_columnContext) + + // EnterOpt_set_data is called when entering the opt_set_data production. + EnterOpt_set_data(c *Opt_set_dataContext) + + // EnterAlterobjectdependsstmt is called when entering the alterobjectdependsstmt production. + EnterAlterobjectdependsstmt(c *AlterobjectdependsstmtContext) + + // EnterOpt_no is called when entering the opt_no production. + EnterOpt_no(c *Opt_noContext) + + // EnterAlterobjectschemastmt is called when entering the alterobjectschemastmt production. + EnterAlterobjectschemastmt(c *AlterobjectschemastmtContext) + + // EnterAlteroperatorstmt is called when entering the alteroperatorstmt production. + EnterAlteroperatorstmt(c *AlteroperatorstmtContext) + + // EnterOperator_def_list is called when entering the operator_def_list production. + EnterOperator_def_list(c *Operator_def_listContext) + + // EnterOperator_def_elem is called when entering the operator_def_elem production. + EnterOperator_def_elem(c *Operator_def_elemContext) + + // EnterOperator_def_arg is called when entering the operator_def_arg production. + EnterOperator_def_arg(c *Operator_def_argContext) + + // EnterAltertypestmt is called when entering the altertypestmt production. + EnterAltertypestmt(c *AltertypestmtContext) + + // EnterAlterownerstmt is called when entering the alterownerstmt production. + EnterAlterownerstmt(c *AlterownerstmtContext) + + // EnterCreatepublicationstmt is called when entering the createpublicationstmt production. + EnterCreatepublicationstmt(c *CreatepublicationstmtContext) + + // EnterPub_obj_list is called when entering the pub_obj_list production. + EnterPub_obj_list(c *Pub_obj_listContext) + + // EnterPublication_obj_spec is called when entering the publication_obj_spec production. + EnterPublication_obj_spec(c *Publication_obj_specContext) + + // EnterOpt_where_clause is called when entering the opt_where_clause production. + EnterOpt_where_clause(c *Opt_where_clauseContext) + + // EnterAlterpublicationstmt is called when entering the alterpublicationstmt production. + EnterAlterpublicationstmt(c *AlterpublicationstmtContext) + + // EnterCreatesubscriptionstmt is called when entering the createsubscriptionstmt production. + EnterCreatesubscriptionstmt(c *CreatesubscriptionstmtContext) + + // EnterPublication_name_list is called when entering the publication_name_list production. + EnterPublication_name_list(c *Publication_name_listContext) + + // EnterPublication_name_item is called when entering the publication_name_item production. + EnterPublication_name_item(c *Publication_name_itemContext) + + // EnterAltersubscriptionstmt is called when entering the altersubscriptionstmt production. + EnterAltersubscriptionstmt(c *AltersubscriptionstmtContext) + + // EnterDropsubscriptionstmt is called when entering the dropsubscriptionstmt production. + EnterDropsubscriptionstmt(c *DropsubscriptionstmtContext) + + // EnterRulestmt is called when entering the rulestmt production. + EnterRulestmt(c *RulestmtContext) + + // EnterRuleactionlist is called when entering the ruleactionlist production. + EnterRuleactionlist(c *RuleactionlistContext) + + // EnterRuleactionmulti is called when entering the ruleactionmulti production. + EnterRuleactionmulti(c *RuleactionmultiContext) + + // EnterRuleactionstmt is called when entering the ruleactionstmt production. + EnterRuleactionstmt(c *RuleactionstmtContext) + + // EnterRuleactionstmtOrEmpty is called when entering the ruleactionstmtOrEmpty production. + EnterRuleactionstmtOrEmpty(c *RuleactionstmtOrEmptyContext) + + // EnterEvent is called when entering the event production. + EnterEvent(c *EventContext) + + // EnterOpt_instead is called when entering the opt_instead production. + EnterOpt_instead(c *Opt_insteadContext) + + // EnterNotifystmt is called when entering the notifystmt production. + EnterNotifystmt(c *NotifystmtContext) + + // EnterNotify_payload is called when entering the notify_payload production. + EnterNotify_payload(c *Notify_payloadContext) + + // EnterListenstmt is called when entering the listenstmt production. + EnterListenstmt(c *ListenstmtContext) + + // EnterUnlistenstmt is called when entering the unlistenstmt production. + EnterUnlistenstmt(c *UnlistenstmtContext) + + // EnterTransactionstmt is called when entering the transactionstmt production. + EnterTransactionstmt(c *TransactionstmtContext) + + // EnterOpt_transaction is called when entering the opt_transaction production. + EnterOpt_transaction(c *Opt_transactionContext) + + // EnterTransaction_mode_item is called when entering the transaction_mode_item production. + EnterTransaction_mode_item(c *Transaction_mode_itemContext) + + // EnterTransaction_mode_list is called when entering the transaction_mode_list production. + EnterTransaction_mode_list(c *Transaction_mode_listContext) + + // EnterTransaction_mode_list_or_empty is called when entering the transaction_mode_list_or_empty production. + EnterTransaction_mode_list_or_empty(c *Transaction_mode_list_or_emptyContext) + + // EnterOpt_transaction_chain is called when entering the opt_transaction_chain production. + EnterOpt_transaction_chain(c *Opt_transaction_chainContext) + + // EnterViewstmt is called when entering the viewstmt production. + EnterViewstmt(c *ViewstmtContext) + + // EnterOpt_check_option is called when entering the opt_check_option production. + EnterOpt_check_option(c *Opt_check_optionContext) + + // EnterLoadstmt is called when entering the loadstmt production. + EnterLoadstmt(c *LoadstmtContext) + + // EnterCreatedbstmt is called when entering the createdbstmt production. + EnterCreatedbstmt(c *CreatedbstmtContext) + + // EnterCreatedb_opt_list is called when entering the createdb_opt_list production. + EnterCreatedb_opt_list(c *Createdb_opt_listContext) + + // EnterCreatedb_opt_items is called when entering the createdb_opt_items production. + EnterCreatedb_opt_items(c *Createdb_opt_itemsContext) + + // EnterCreatedb_opt_item is called when entering the createdb_opt_item production. + EnterCreatedb_opt_item(c *Createdb_opt_itemContext) + + // EnterCreatedb_opt_name is called when entering the createdb_opt_name production. + EnterCreatedb_opt_name(c *Createdb_opt_nameContext) + + // EnterOpt_equal is called when entering the opt_equal production. + EnterOpt_equal(c *Opt_equalContext) + + // EnterAlterdatabasestmt is called when entering the alterdatabasestmt production. + EnterAlterdatabasestmt(c *AlterdatabasestmtContext) + + // EnterAlterdatabasesetstmt is called when entering the alterdatabasesetstmt production. + EnterAlterdatabasesetstmt(c *AlterdatabasesetstmtContext) + + // EnterDropdbstmt is called when entering the dropdbstmt production. + EnterDropdbstmt(c *DropdbstmtContext) + + // EnterDrop_option_list is called when entering the drop_option_list production. + EnterDrop_option_list(c *Drop_option_listContext) + + // EnterDrop_option is called when entering the drop_option production. + EnterDrop_option(c *Drop_optionContext) + + // EnterAltercollationstmt is called when entering the altercollationstmt production. + EnterAltercollationstmt(c *AltercollationstmtContext) + + // EnterAltersystemstmt is called when entering the altersystemstmt production. + EnterAltersystemstmt(c *AltersystemstmtContext) + + // EnterCreatedomainstmt is called when entering the createdomainstmt production. + EnterCreatedomainstmt(c *CreatedomainstmtContext) + + // EnterAlterdomainstmt is called when entering the alterdomainstmt production. + EnterAlterdomainstmt(c *AlterdomainstmtContext) + + // EnterOpt_as is called when entering the opt_as production. + EnterOpt_as(c *Opt_asContext) + + // EnterAltertsdictionarystmt is called when entering the altertsdictionarystmt production. + EnterAltertsdictionarystmt(c *AltertsdictionarystmtContext) + + // EnterAltertsconfigurationstmt is called when entering the altertsconfigurationstmt production. + EnterAltertsconfigurationstmt(c *AltertsconfigurationstmtContext) + + // EnterAny_with is called when entering the any_with production. + EnterAny_with(c *Any_withContext) + + // EnterCreateconversionstmt is called when entering the createconversionstmt production. + EnterCreateconversionstmt(c *CreateconversionstmtContext) + + // EnterClusterstmt is called when entering the clusterstmt production. + EnterClusterstmt(c *ClusterstmtContext) + + // EnterCluster_index_specification is called when entering the cluster_index_specification production. + EnterCluster_index_specification(c *Cluster_index_specificationContext) + + // EnterVacuumstmt is called when entering the vacuumstmt production. + EnterVacuumstmt(c *VacuumstmtContext) + + // EnterAnalyzestmt is called when entering the analyzestmt production. + EnterAnalyzestmt(c *AnalyzestmtContext) + + // EnterVac_analyze_option_list is called when entering the vac_analyze_option_list production. + EnterVac_analyze_option_list(c *Vac_analyze_option_listContext) + + // EnterAnalyze_keyword is called when entering the analyze_keyword production. + EnterAnalyze_keyword(c *Analyze_keywordContext) + + // EnterVac_analyze_option_elem is called when entering the vac_analyze_option_elem production. + EnterVac_analyze_option_elem(c *Vac_analyze_option_elemContext) + + // EnterVac_analyze_option_name is called when entering the vac_analyze_option_name production. + EnterVac_analyze_option_name(c *Vac_analyze_option_nameContext) + + // EnterVac_analyze_option_arg is called when entering the vac_analyze_option_arg production. + EnterVac_analyze_option_arg(c *Vac_analyze_option_argContext) + + // EnterOpt_analyze is called when entering the opt_analyze production. + EnterOpt_analyze(c *Opt_analyzeContext) + + // EnterOpt_verbose is called when entering the opt_verbose production. + EnterOpt_verbose(c *Opt_verboseContext) + + // EnterOpt_full is called when entering the opt_full production. + EnterOpt_full(c *Opt_fullContext) + + // EnterOpt_freeze is called when entering the opt_freeze production. + EnterOpt_freeze(c *Opt_freezeContext) + + // EnterOpt_name_list is called when entering the opt_name_list production. + EnterOpt_name_list(c *Opt_name_listContext) + + // EnterVacuum_relation is called when entering the vacuum_relation production. + EnterVacuum_relation(c *Vacuum_relationContext) + + // EnterVacuum_relation_list is called when entering the vacuum_relation_list production. + EnterVacuum_relation_list(c *Vacuum_relation_listContext) + + // EnterOpt_vacuum_relation_list is called when entering the opt_vacuum_relation_list production. + EnterOpt_vacuum_relation_list(c *Opt_vacuum_relation_listContext) + + // EnterExplainstmt is called when entering the explainstmt production. + EnterExplainstmt(c *ExplainstmtContext) + + // EnterExplainablestmt is called when entering the explainablestmt production. + EnterExplainablestmt(c *ExplainablestmtContext) + + // EnterExplain_option_list is called when entering the explain_option_list production. + EnterExplain_option_list(c *Explain_option_listContext) + + // EnterExplain_option_elem is called when entering the explain_option_elem production. + EnterExplain_option_elem(c *Explain_option_elemContext) + + // EnterExplain_option_name is called when entering the explain_option_name production. + EnterExplain_option_name(c *Explain_option_nameContext) + + // EnterExplain_option_arg is called when entering the explain_option_arg production. + EnterExplain_option_arg(c *Explain_option_argContext) + + // EnterPreparestmt is called when entering the preparestmt production. + EnterPreparestmt(c *PreparestmtContext) + + // EnterPrep_type_clause is called when entering the prep_type_clause production. + EnterPrep_type_clause(c *Prep_type_clauseContext) + + // EnterPreparablestmt is called when entering the preparablestmt production. + EnterPreparablestmt(c *PreparablestmtContext) + + // EnterExecutestmt is called when entering the executestmt production. + EnterExecutestmt(c *ExecutestmtContext) + + // EnterExecute_param_clause is called when entering the execute_param_clause production. + EnterExecute_param_clause(c *Execute_param_clauseContext) + + // EnterDeallocatestmt is called when entering the deallocatestmt production. + EnterDeallocatestmt(c *DeallocatestmtContext) + + // EnterInsertstmt is called when entering the insertstmt production. + EnterInsertstmt(c *InsertstmtContext) + + // EnterInsert_target is called when entering the insert_target production. + EnterInsert_target(c *Insert_targetContext) + + // EnterInsert_rest is called when entering the insert_rest production. + EnterInsert_rest(c *Insert_restContext) + + // EnterOverride_kind is called when entering the override_kind production. + EnterOverride_kind(c *Override_kindContext) + + // EnterInsert_column_list is called when entering the insert_column_list production. + EnterInsert_column_list(c *Insert_column_listContext) + + // EnterInsert_column_item is called when entering the insert_column_item production. + EnterInsert_column_item(c *Insert_column_itemContext) + + // EnterOpt_on_conflict is called when entering the opt_on_conflict production. + EnterOpt_on_conflict(c *Opt_on_conflictContext) + + // EnterOpt_conf_expr is called when entering the opt_conf_expr production. + EnterOpt_conf_expr(c *Opt_conf_exprContext) + + // EnterReturning_clause is called when entering the returning_clause production. + EnterReturning_clause(c *Returning_clauseContext) + + // EnterMergestmt is called when entering the mergestmt production. + EnterMergestmt(c *MergestmtContext) + + // EnterMerge_insert_clause is called when entering the merge_insert_clause production. + EnterMerge_insert_clause(c *Merge_insert_clauseContext) + + // EnterMerge_update_clause is called when entering the merge_update_clause production. + EnterMerge_update_clause(c *Merge_update_clauseContext) + + // EnterMerge_delete_clause is called when entering the merge_delete_clause production. + EnterMerge_delete_clause(c *Merge_delete_clauseContext) + + // EnterDeletestmt is called when entering the deletestmt production. + EnterDeletestmt(c *DeletestmtContext) + + // EnterUsing_clause is called when entering the using_clause production. + EnterUsing_clause(c *Using_clauseContext) + + // EnterLockstmt is called when entering the lockstmt production. + EnterLockstmt(c *LockstmtContext) + + // EnterOpt_lock is called when entering the opt_lock production. + EnterOpt_lock(c *Opt_lockContext) + + // EnterLock_type is called when entering the lock_type production. + EnterLock_type(c *Lock_typeContext) + + // EnterOpt_nowait is called when entering the opt_nowait production. + EnterOpt_nowait(c *Opt_nowaitContext) + + // EnterOpt_nowait_or_skip is called when entering the opt_nowait_or_skip production. + EnterOpt_nowait_or_skip(c *Opt_nowait_or_skipContext) + + // EnterUpdatestmt is called when entering the updatestmt production. + EnterUpdatestmt(c *UpdatestmtContext) + + // EnterSet_clause_list is called when entering the set_clause_list production. + EnterSet_clause_list(c *Set_clause_listContext) + + // EnterSet_clause is called when entering the set_clause production. + EnterSet_clause(c *Set_clauseContext) + + // EnterSet_target is called when entering the set_target production. + EnterSet_target(c *Set_targetContext) + + // EnterSet_target_list is called when entering the set_target_list production. + EnterSet_target_list(c *Set_target_listContext) + + // EnterDeclarecursorstmt is called when entering the declarecursorstmt production. + EnterDeclarecursorstmt(c *DeclarecursorstmtContext) + + // EnterCursor_name is called when entering the cursor_name production. + EnterCursor_name(c *Cursor_nameContext) + + // EnterCursor_options is called when entering the cursor_options production. + EnterCursor_options(c *Cursor_optionsContext) + + // EnterOpt_hold is called when entering the opt_hold production. + EnterOpt_hold(c *Opt_holdContext) + + // EnterSelectstmt is called when entering the selectstmt production. + EnterSelectstmt(c *SelectstmtContext) + + // EnterSelect_with_parens is called when entering the select_with_parens production. + EnterSelect_with_parens(c *Select_with_parensContext) + + // EnterSelect_no_parens is called when entering the select_no_parens production. + EnterSelect_no_parens(c *Select_no_parensContext) + + // EnterSelect_clause is called when entering the select_clause production. + EnterSelect_clause(c *Select_clauseContext) + + // EnterSimple_select_intersect is called when entering the simple_select_intersect production. + EnterSimple_select_intersect(c *Simple_select_intersectContext) + + // EnterSimple_select_pramary is called when entering the simple_select_pramary production. + EnterSimple_select_pramary(c *Simple_select_pramaryContext) + + // EnterWith_clause is called when entering the with_clause production. + EnterWith_clause(c *With_clauseContext) + + // EnterCte_list is called when entering the cte_list production. + EnterCte_list(c *Cte_listContext) + + // EnterCommon_table_expr is called when entering the common_table_expr production. + EnterCommon_table_expr(c *Common_table_exprContext) + + // EnterOpt_materialized is called when entering the opt_materialized production. + EnterOpt_materialized(c *Opt_materializedContext) + + // EnterOpt_with_clause is called when entering the opt_with_clause production. + EnterOpt_with_clause(c *Opt_with_clauseContext) + + // EnterInto_clause is called when entering the into_clause production. + EnterInto_clause(c *Into_clauseContext) + + // EnterOpt_strict is called when entering the opt_strict production. + EnterOpt_strict(c *Opt_strictContext) + + // EnterOpttempTableName is called when entering the opttempTableName production. + EnterOpttempTableName(c *OpttempTableNameContext) + + // EnterOpt_table is called when entering the opt_table production. + EnterOpt_table(c *Opt_tableContext) + + // EnterAll_or_distinct is called when entering the all_or_distinct production. + EnterAll_or_distinct(c *All_or_distinctContext) + + // EnterDistinct_clause is called when entering the distinct_clause production. + EnterDistinct_clause(c *Distinct_clauseContext) + + // EnterOpt_all_clause is called when entering the opt_all_clause production. + EnterOpt_all_clause(c *Opt_all_clauseContext) + + // EnterOpt_sort_clause is called when entering the opt_sort_clause production. + EnterOpt_sort_clause(c *Opt_sort_clauseContext) + + // EnterSort_clause is called when entering the sort_clause production. + EnterSort_clause(c *Sort_clauseContext) + + // EnterSortby_list is called when entering the sortby_list production. + EnterSortby_list(c *Sortby_listContext) + + // EnterSortby is called when entering the sortby production. + EnterSortby(c *SortbyContext) + + // EnterSelect_limit is called when entering the select_limit production. + EnterSelect_limit(c *Select_limitContext) + + // EnterOpt_select_limit is called when entering the opt_select_limit production. + EnterOpt_select_limit(c *Opt_select_limitContext) + + // EnterLimit_clause is called when entering the limit_clause production. + EnterLimit_clause(c *Limit_clauseContext) + + // EnterOffset_clause is called when entering the offset_clause production. + EnterOffset_clause(c *Offset_clauseContext) + + // EnterSelect_limit_value is called when entering the select_limit_value production. + EnterSelect_limit_value(c *Select_limit_valueContext) + + // EnterSelect_offset_value is called when entering the select_offset_value production. + EnterSelect_offset_value(c *Select_offset_valueContext) + + // EnterSelect_fetch_first_value is called when entering the select_fetch_first_value production. + EnterSelect_fetch_first_value(c *Select_fetch_first_valueContext) + + // EnterI_or_f_const is called when entering the i_or_f_const production. + EnterI_or_f_const(c *I_or_f_constContext) + + // EnterRow_or_rows is called when entering the row_or_rows production. + EnterRow_or_rows(c *Row_or_rowsContext) + + // EnterFirst_or_next is called when entering the first_or_next production. + EnterFirst_or_next(c *First_or_nextContext) + + // EnterGroup_clause is called when entering the group_clause production. + EnterGroup_clause(c *Group_clauseContext) + + // EnterGroup_by_list is called when entering the group_by_list production. + EnterGroup_by_list(c *Group_by_listContext) + + // EnterGroup_by_item is called when entering the group_by_item production. + EnterGroup_by_item(c *Group_by_itemContext) + + // EnterEmpty_grouping_set is called when entering the empty_grouping_set production. + EnterEmpty_grouping_set(c *Empty_grouping_setContext) + + // EnterRollup_clause is called when entering the rollup_clause production. + EnterRollup_clause(c *Rollup_clauseContext) + + // EnterCube_clause is called when entering the cube_clause production. + EnterCube_clause(c *Cube_clauseContext) + + // EnterGrouping_sets_clause is called when entering the grouping_sets_clause production. + EnterGrouping_sets_clause(c *Grouping_sets_clauseContext) + + // EnterHaving_clause is called when entering the having_clause production. + EnterHaving_clause(c *Having_clauseContext) + + // EnterFor_locking_clause is called when entering the for_locking_clause production. + EnterFor_locking_clause(c *For_locking_clauseContext) + + // EnterOpt_for_locking_clause is called when entering the opt_for_locking_clause production. + EnterOpt_for_locking_clause(c *Opt_for_locking_clauseContext) + + // EnterFor_locking_items is called when entering the for_locking_items production. + EnterFor_locking_items(c *For_locking_itemsContext) + + // EnterFor_locking_item is called when entering the for_locking_item production. + EnterFor_locking_item(c *For_locking_itemContext) + + // EnterFor_locking_strength is called when entering the for_locking_strength production. + EnterFor_locking_strength(c *For_locking_strengthContext) + + // EnterLocked_rels_list is called when entering the locked_rels_list production. + EnterLocked_rels_list(c *Locked_rels_listContext) + + // EnterValues_clause is called when entering the values_clause production. + EnterValues_clause(c *Values_clauseContext) + + // EnterFrom_clause is called when entering the from_clause production. + EnterFrom_clause(c *From_clauseContext) + + // EnterFrom_list is called when entering the from_list production. + EnterFrom_list(c *From_listContext) + + // EnterTable_ref is called when entering the table_ref production. + EnterTable_ref(c *Table_refContext) + + // EnterJoined_table is called when entering the joined_table production. + EnterJoined_table(c *Joined_tableContext) + + // EnterAlias_clause is called when entering the alias_clause production. + EnterAlias_clause(c *Alias_clauseContext) + + // EnterOpt_alias_clause is called when entering the opt_alias_clause production. + EnterOpt_alias_clause(c *Opt_alias_clauseContext) + + // EnterTable_alias_clause is called when entering the table_alias_clause production. + EnterTable_alias_clause(c *Table_alias_clauseContext) + + // EnterFunc_alias_clause is called when entering the func_alias_clause production. + EnterFunc_alias_clause(c *Func_alias_clauseContext) + + // EnterJoin_type is called when entering the join_type production. + EnterJoin_type(c *Join_typeContext) + + // EnterJoin_qual is called when entering the join_qual production. + EnterJoin_qual(c *Join_qualContext) + + // EnterRelation_expr is called when entering the relation_expr production. + EnterRelation_expr(c *Relation_exprContext) + + // EnterRelation_expr_list is called when entering the relation_expr_list production. + EnterRelation_expr_list(c *Relation_expr_listContext) + + // EnterRelation_expr_opt_alias is called when entering the relation_expr_opt_alias production. + EnterRelation_expr_opt_alias(c *Relation_expr_opt_aliasContext) + + // EnterTablesample_clause is called when entering the tablesample_clause production. + EnterTablesample_clause(c *Tablesample_clauseContext) + + // EnterOpt_repeatable_clause is called when entering the opt_repeatable_clause production. + EnterOpt_repeatable_clause(c *Opt_repeatable_clauseContext) + + // EnterFunc_table is called when entering the func_table production. + EnterFunc_table(c *Func_tableContext) + + // EnterRowsfrom_item is called when entering the rowsfrom_item production. + EnterRowsfrom_item(c *Rowsfrom_itemContext) + + // EnterRowsfrom_list is called when entering the rowsfrom_list production. + EnterRowsfrom_list(c *Rowsfrom_listContext) + + // EnterOpt_col_def_list is called when entering the opt_col_def_list production. + EnterOpt_col_def_list(c *Opt_col_def_listContext) + + // EnterOpt_ordinality is called when entering the opt_ordinality production. + EnterOpt_ordinality(c *Opt_ordinalityContext) + + // EnterWhere_clause is called when entering the where_clause production. + EnterWhere_clause(c *Where_clauseContext) + + // EnterWhere_or_current_clause is called when entering the where_or_current_clause production. + EnterWhere_or_current_clause(c *Where_or_current_clauseContext) + + // EnterOpttablefuncelementlist is called when entering the opttablefuncelementlist production. + EnterOpttablefuncelementlist(c *OpttablefuncelementlistContext) + + // EnterTablefuncelementlist is called when entering the tablefuncelementlist production. + EnterTablefuncelementlist(c *TablefuncelementlistContext) + + // EnterTablefuncelement is called when entering the tablefuncelement production. + EnterTablefuncelement(c *TablefuncelementContext) + + // EnterXmltable is called when entering the xmltable production. + EnterXmltable(c *XmltableContext) + + // EnterXmltable_column_list is called when entering the xmltable_column_list production. + EnterXmltable_column_list(c *Xmltable_column_listContext) + + // EnterXmltable_column_el is called when entering the xmltable_column_el production. + EnterXmltable_column_el(c *Xmltable_column_elContext) + + // EnterXmltable_column_option_list is called when entering the xmltable_column_option_list production. + EnterXmltable_column_option_list(c *Xmltable_column_option_listContext) + + // EnterXmltable_column_option_el is called when entering the xmltable_column_option_el production. + EnterXmltable_column_option_el(c *Xmltable_column_option_elContext) + + // EnterXml_namespace_list is called when entering the xml_namespace_list production. + EnterXml_namespace_list(c *Xml_namespace_listContext) + + // EnterXml_namespace_el is called when entering the xml_namespace_el production. + EnterXml_namespace_el(c *Xml_namespace_elContext) + + // EnterTypename is called when entering the typename production. + EnterTypename(c *TypenameContext) + + // EnterOpt_array_bounds is called when entering the opt_array_bounds production. + EnterOpt_array_bounds(c *Opt_array_boundsContext) + + // EnterSimpletypename is called when entering the simpletypename production. + EnterSimpletypename(c *SimpletypenameContext) + + // EnterConsttypename is called when entering the consttypename production. + EnterConsttypename(c *ConsttypenameContext) + + // EnterGenerictype is called when entering the generictype production. + EnterGenerictype(c *GenerictypeContext) + + // EnterOpt_type_modifiers is called when entering the opt_type_modifiers production. + EnterOpt_type_modifiers(c *Opt_type_modifiersContext) + + // EnterNumeric is called when entering the numeric production. + EnterNumeric(c *NumericContext) + + // EnterOpt_float is called when entering the opt_float production. + EnterOpt_float(c *Opt_floatContext) + + // EnterBit is called when entering the bit production. + EnterBit(c *BitContext) + + // EnterConstbit is called when entering the constbit production. + EnterConstbit(c *ConstbitContext) + + // EnterBitwithlength is called when entering the bitwithlength production. + EnterBitwithlength(c *BitwithlengthContext) + + // EnterBitwithoutlength is called when entering the bitwithoutlength production. + EnterBitwithoutlength(c *BitwithoutlengthContext) + + // EnterCharacter is called when entering the character production. + EnterCharacter(c *CharacterContext) + + // EnterConstcharacter is called when entering the constcharacter production. + EnterConstcharacter(c *ConstcharacterContext) + + // EnterCharacter_c is called when entering the character_c production. + EnterCharacter_c(c *Character_cContext) + + // EnterOpt_varying is called when entering the opt_varying production. + EnterOpt_varying(c *Opt_varyingContext) + + // EnterConstdatetime is called when entering the constdatetime production. + EnterConstdatetime(c *ConstdatetimeContext) + + // EnterConstinterval is called when entering the constinterval production. + EnterConstinterval(c *ConstintervalContext) + + // EnterOpt_timezone is called when entering the opt_timezone production. + EnterOpt_timezone(c *Opt_timezoneContext) + + // EnterOpt_interval is called when entering the opt_interval production. + EnterOpt_interval(c *Opt_intervalContext) + + // EnterInterval_second is called when entering the interval_second production. + EnterInterval_second(c *Interval_secondContext) + + // EnterOpt_escape is called when entering the opt_escape production. + EnterOpt_escape(c *Opt_escapeContext) + + // EnterA_expr is called when entering the a_expr production. + EnterA_expr(c *A_exprContext) + + // EnterA_expr_qual is called when entering the a_expr_qual production. + EnterA_expr_qual(c *A_expr_qualContext) + + // EnterA_expr_lessless is called when entering the a_expr_lessless production. + EnterA_expr_lessless(c *A_expr_lesslessContext) + + // EnterA_expr_or is called when entering the a_expr_or production. + EnterA_expr_or(c *A_expr_orContext) + + // EnterA_expr_and is called when entering the a_expr_and production. + EnterA_expr_and(c *A_expr_andContext) + + // EnterA_expr_between is called when entering the a_expr_between production. + EnterA_expr_between(c *A_expr_betweenContext) + + // EnterA_expr_in is called when entering the a_expr_in production. + EnterA_expr_in(c *A_expr_inContext) + + // EnterA_expr_unary_not is called when entering the a_expr_unary_not production. + EnterA_expr_unary_not(c *A_expr_unary_notContext) + + // EnterA_expr_isnull is called when entering the a_expr_isnull production. + EnterA_expr_isnull(c *A_expr_isnullContext) + + // EnterA_expr_is_not is called when entering the a_expr_is_not production. + EnterA_expr_is_not(c *A_expr_is_notContext) + + // EnterA_expr_compare is called when entering the a_expr_compare production. + EnterA_expr_compare(c *A_expr_compareContext) + + // EnterA_expr_like is called when entering the a_expr_like production. + EnterA_expr_like(c *A_expr_likeContext) + + // EnterA_expr_qual_op is called when entering the a_expr_qual_op production. + EnterA_expr_qual_op(c *A_expr_qual_opContext) + + // EnterA_expr_unary_qualop is called when entering the a_expr_unary_qualop production. + EnterA_expr_unary_qualop(c *A_expr_unary_qualopContext) + + // EnterA_expr_add is called when entering the a_expr_add production. + EnterA_expr_add(c *A_expr_addContext) + + // EnterA_expr_mul is called when entering the a_expr_mul production. + EnterA_expr_mul(c *A_expr_mulContext) + + // EnterA_expr_caret is called when entering the a_expr_caret production. + EnterA_expr_caret(c *A_expr_caretContext) + + // EnterA_expr_unary_sign is called when entering the a_expr_unary_sign production. + EnterA_expr_unary_sign(c *A_expr_unary_signContext) + + // EnterA_expr_at_time_zone is called when entering the a_expr_at_time_zone production. + EnterA_expr_at_time_zone(c *A_expr_at_time_zoneContext) + + // EnterA_expr_collate is called when entering the a_expr_collate production. + EnterA_expr_collate(c *A_expr_collateContext) + + // EnterA_expr_typecast is called when entering the a_expr_typecast production. + EnterA_expr_typecast(c *A_expr_typecastContext) + + // EnterB_expr is called when entering the b_expr production. + EnterB_expr(c *B_exprContext) + + // EnterC_expr_exists is called when entering the c_expr_exists production. + EnterC_expr_exists(c *C_expr_existsContext) + + // EnterC_expr_expr is called when entering the c_expr_expr production. + EnterC_expr_expr(c *C_expr_exprContext) + + // EnterC_expr_case is called when entering the c_expr_case production. + EnterC_expr_case(c *C_expr_caseContext) + + // EnterPlsqlvariablename is called when entering the plsqlvariablename production. + EnterPlsqlvariablename(c *PlsqlvariablenameContext) + + // EnterFunc_application is called when entering the func_application production. + EnterFunc_application(c *Func_applicationContext) + + // EnterFunc_expr is called when entering the func_expr production. + EnterFunc_expr(c *Func_exprContext) + + // EnterFunc_expr_windowless is called when entering the func_expr_windowless production. + EnterFunc_expr_windowless(c *Func_expr_windowlessContext) + + // EnterFunc_expr_common_subexpr is called when entering the func_expr_common_subexpr production. + EnterFunc_expr_common_subexpr(c *Func_expr_common_subexprContext) + + // EnterXml_root_version is called when entering the xml_root_version production. + EnterXml_root_version(c *Xml_root_versionContext) + + // EnterOpt_xml_root_standalone is called when entering the opt_xml_root_standalone production. + EnterOpt_xml_root_standalone(c *Opt_xml_root_standaloneContext) + + // EnterXml_attributes is called when entering the xml_attributes production. + EnterXml_attributes(c *Xml_attributesContext) + + // EnterXml_attribute_list is called when entering the xml_attribute_list production. + EnterXml_attribute_list(c *Xml_attribute_listContext) + + // EnterXml_attribute_el is called when entering the xml_attribute_el production. + EnterXml_attribute_el(c *Xml_attribute_elContext) + + // EnterDocument_or_content is called when entering the document_or_content production. + EnterDocument_or_content(c *Document_or_contentContext) + + // EnterXml_whitespace_option is called when entering the xml_whitespace_option production. + EnterXml_whitespace_option(c *Xml_whitespace_optionContext) + + // EnterXmlexists_argument is called when entering the xmlexists_argument production. + EnterXmlexists_argument(c *Xmlexists_argumentContext) + + // EnterXml_passing_mech is called when entering the xml_passing_mech production. + EnterXml_passing_mech(c *Xml_passing_mechContext) + + // EnterWithin_group_clause is called when entering the within_group_clause production. + EnterWithin_group_clause(c *Within_group_clauseContext) + + // EnterFilter_clause is called when entering the filter_clause production. + EnterFilter_clause(c *Filter_clauseContext) + + // EnterWindow_clause is called when entering the window_clause production. + EnterWindow_clause(c *Window_clauseContext) + + // EnterWindow_definition_list is called when entering the window_definition_list production. + EnterWindow_definition_list(c *Window_definition_listContext) + + // EnterWindow_definition is called when entering the window_definition production. + EnterWindow_definition(c *Window_definitionContext) + + // EnterOver_clause is called when entering the over_clause production. + EnterOver_clause(c *Over_clauseContext) + + // EnterWindow_specification is called when entering the window_specification production. + EnterWindow_specification(c *Window_specificationContext) + + // EnterOpt_existing_window_name is called when entering the opt_existing_window_name production. + EnterOpt_existing_window_name(c *Opt_existing_window_nameContext) + + // EnterOpt_partition_clause is called when entering the opt_partition_clause production. + EnterOpt_partition_clause(c *Opt_partition_clauseContext) + + // EnterOpt_frame_clause is called when entering the opt_frame_clause production. + EnterOpt_frame_clause(c *Opt_frame_clauseContext) + + // EnterFrame_extent is called when entering the frame_extent production. + EnterFrame_extent(c *Frame_extentContext) + + // EnterFrame_bound is called when entering the frame_bound production. + EnterFrame_bound(c *Frame_boundContext) + + // EnterOpt_window_exclusion_clause is called when entering the opt_window_exclusion_clause production. + EnterOpt_window_exclusion_clause(c *Opt_window_exclusion_clauseContext) + + // EnterRow is called when entering the row production. + EnterRow(c *RowContext) + + // EnterExplicit_row is called when entering the explicit_row production. + EnterExplicit_row(c *Explicit_rowContext) + + // EnterImplicit_row is called when entering the implicit_row production. + EnterImplicit_row(c *Implicit_rowContext) + + // EnterSub_type is called when entering the sub_type production. + EnterSub_type(c *Sub_typeContext) + + // EnterAll_op is called when entering the all_op production. + EnterAll_op(c *All_opContext) + + // EnterMathop is called when entering the mathop production. + EnterMathop(c *MathopContext) + + // EnterQual_op is called when entering the qual_op production. + EnterQual_op(c *Qual_opContext) + + // EnterQual_all_op is called when entering the qual_all_op production. + EnterQual_all_op(c *Qual_all_opContext) + + // EnterSubquery_Op is called when entering the subquery_Op production. + EnterSubquery_Op(c *Subquery_OpContext) + + // EnterExpr_list is called when entering the expr_list production. + EnterExpr_list(c *Expr_listContext) + + // EnterFunc_arg_list is called when entering the func_arg_list production. + EnterFunc_arg_list(c *Func_arg_listContext) + + // EnterFunc_arg_expr is called when entering the func_arg_expr production. + EnterFunc_arg_expr(c *Func_arg_exprContext) + + // EnterType_list is called when entering the type_list production. + EnterType_list(c *Type_listContext) + + // EnterArray_expr is called when entering the array_expr production. + EnterArray_expr(c *Array_exprContext) + + // EnterArray_expr_list is called when entering the array_expr_list production. + EnterArray_expr_list(c *Array_expr_listContext) + + // EnterExtract_list is called when entering the extract_list production. + EnterExtract_list(c *Extract_listContext) + + // EnterExtract_arg is called when entering the extract_arg production. + EnterExtract_arg(c *Extract_argContext) + + // EnterUnicode_normal_form is called when entering the unicode_normal_form production. + EnterUnicode_normal_form(c *Unicode_normal_formContext) + + // EnterOverlay_list is called when entering the overlay_list production. + EnterOverlay_list(c *Overlay_listContext) + + // EnterPosition_list is called when entering the position_list production. + EnterPosition_list(c *Position_listContext) + + // EnterSubstr_list is called when entering the substr_list production. + EnterSubstr_list(c *Substr_listContext) + + // EnterTrim_list is called when entering the trim_list production. + EnterTrim_list(c *Trim_listContext) + + // EnterIn_expr_select is called when entering the in_expr_select production. + EnterIn_expr_select(c *In_expr_selectContext) + + // EnterIn_expr_list is called when entering the in_expr_list production. + EnterIn_expr_list(c *In_expr_listContext) + + // EnterCase_expr is called when entering the case_expr production. + EnterCase_expr(c *Case_exprContext) + + // EnterWhen_clause_list is called when entering the when_clause_list production. + EnterWhen_clause_list(c *When_clause_listContext) + + // EnterWhen_clause is called when entering the when_clause production. + EnterWhen_clause(c *When_clauseContext) + + // EnterCase_default is called when entering the case_default production. + EnterCase_default(c *Case_defaultContext) + + // EnterCase_arg is called when entering the case_arg production. + EnterCase_arg(c *Case_argContext) + + // EnterColumnref is called when entering the columnref production. + EnterColumnref(c *ColumnrefContext) + + // EnterIndirection_el is called when entering the indirection_el production. + EnterIndirection_el(c *Indirection_elContext) + + // EnterOpt_slice_bound is called when entering the opt_slice_bound production. + EnterOpt_slice_bound(c *Opt_slice_boundContext) + + // EnterIndirection is called when entering the indirection production. + EnterIndirection(c *IndirectionContext) + + // EnterOpt_indirection is called when entering the opt_indirection production. + EnterOpt_indirection(c *Opt_indirectionContext) + + // EnterOpt_target_list is called when entering the opt_target_list production. + EnterOpt_target_list(c *Opt_target_listContext) + + // EnterTarget_list is called when entering the target_list production. + EnterTarget_list(c *Target_listContext) + + // EnterTarget_label is called when entering the target_label production. + EnterTarget_label(c *Target_labelContext) + + // EnterTarget_star is called when entering the target_star production. + EnterTarget_star(c *Target_starContext) + + // EnterTarget_alias is called when entering the target_alias production. + EnterTarget_alias(c *Target_aliasContext) + + // EnterQualified_name_list is called when entering the qualified_name_list production. + EnterQualified_name_list(c *Qualified_name_listContext) + + // EnterQualified_name is called when entering the qualified_name production. + EnterQualified_name(c *Qualified_nameContext) + + // EnterName_list is called when entering the name_list production. + EnterName_list(c *Name_listContext) + + // EnterName is called when entering the name production. + EnterName(c *NameContext) + + // EnterAttr_name is called when entering the attr_name production. + EnterAttr_name(c *Attr_nameContext) + + // EnterFile_name is called when entering the file_name production. + EnterFile_name(c *File_nameContext) + + // EnterFunc_name is called when entering the func_name production. + EnterFunc_name(c *Func_nameContext) + + // EnterAexprconst is called when entering the aexprconst production. + EnterAexprconst(c *AexprconstContext) + + // EnterXconst is called when entering the xconst production. + EnterXconst(c *XconstContext) + + // EnterBconst is called when entering the bconst production. + EnterBconst(c *BconstContext) + + // EnterFconst is called when entering the fconst production. + EnterFconst(c *FconstContext) + + // EnterIconst is called when entering the iconst production. + EnterIconst(c *IconstContext) + + // EnterSconst is called when entering the sconst production. + EnterSconst(c *SconstContext) + + // EnterAnysconst is called when entering the anysconst production. + EnterAnysconst(c *AnysconstContext) + + // EnterOpt_uescape is called when entering the opt_uescape production. + EnterOpt_uescape(c *Opt_uescapeContext) + + // EnterSignediconst is called when entering the signediconst production. + EnterSignediconst(c *SignediconstContext) + + // EnterRoleid is called when entering the roleid production. + EnterRoleid(c *RoleidContext) + + // EnterRolespec is called when entering the rolespec production. + EnterRolespec(c *RolespecContext) + + // EnterRole_list is called when entering the role_list production. + EnterRole_list(c *Role_listContext) + + // EnterColid is called when entering the colid production. + EnterColid(c *ColidContext) + + // EnterTable_alias is called when entering the table_alias production. + EnterTable_alias(c *Table_aliasContext) + + // EnterType_function_name is called when entering the type_function_name production. + EnterType_function_name(c *Type_function_nameContext) + + // EnterNonreservedword is called when entering the nonreservedword production. + EnterNonreservedword(c *NonreservedwordContext) + + // EnterCollabel is called when entering the collabel production. + EnterCollabel(c *CollabelContext) + + // EnterIdentifier is called when entering the identifier production. + EnterIdentifier(c *IdentifierContext) + + // EnterPlsqlidentifier is called when entering the plsqlidentifier production. + EnterPlsqlidentifier(c *PlsqlidentifierContext) + + // EnterUnreserved_keyword is called when entering the unreserved_keyword production. + EnterUnreserved_keyword(c *Unreserved_keywordContext) + + // EnterCol_name_keyword is called when entering the col_name_keyword production. + EnterCol_name_keyword(c *Col_name_keywordContext) + + // EnterType_func_name_keyword is called when entering the type_func_name_keyword production. + EnterType_func_name_keyword(c *Type_func_name_keywordContext) + + // EnterReserved_keyword is called when entering the reserved_keyword production. + EnterReserved_keyword(c *Reserved_keywordContext) + + // EnterBuiltin_function_name is called when entering the builtin_function_name production. + EnterBuiltin_function_name(c *Builtin_function_nameContext) + + // EnterPl_function is called when entering the pl_function production. + EnterPl_function(c *Pl_functionContext) + + // EnterComp_options is called when entering the comp_options production. + EnterComp_options(c *Comp_optionsContext) + + // EnterComp_option is called when entering the comp_option production. + EnterComp_option(c *Comp_optionContext) + + // EnterSharp is called when entering the sharp production. + EnterSharp(c *SharpContext) + + // EnterOption_value is called when entering the option_value production. + EnterOption_value(c *Option_valueContext) + + // EnterOpt_semi is called when entering the opt_semi production. + EnterOpt_semi(c *Opt_semiContext) + + // EnterPl_block is called when entering the pl_block production. + EnterPl_block(c *Pl_blockContext) + + // EnterDecl_sect is called when entering the decl_sect production. + EnterDecl_sect(c *Decl_sectContext) + + // EnterDecl_start is called when entering the decl_start production. + EnterDecl_start(c *Decl_startContext) + + // EnterDecl_stmts is called when entering the decl_stmts production. + EnterDecl_stmts(c *Decl_stmtsContext) + + // EnterLabel_decl is called when entering the label_decl production. + EnterLabel_decl(c *Label_declContext) + + // EnterDecl_stmt is called when entering the decl_stmt production. + EnterDecl_stmt(c *Decl_stmtContext) + + // EnterDecl_statement is called when entering the decl_statement production. + EnterDecl_statement(c *Decl_statementContext) + + // EnterOpt_scrollable is called when entering the opt_scrollable production. + EnterOpt_scrollable(c *Opt_scrollableContext) + + // EnterDecl_cursor_query is called when entering the decl_cursor_query production. + EnterDecl_cursor_query(c *Decl_cursor_queryContext) + + // EnterDecl_cursor_args is called when entering the decl_cursor_args production. + EnterDecl_cursor_args(c *Decl_cursor_argsContext) + + // EnterDecl_cursor_arglist is called when entering the decl_cursor_arglist production. + EnterDecl_cursor_arglist(c *Decl_cursor_arglistContext) + + // EnterDecl_cursor_arg is called when entering the decl_cursor_arg production. + EnterDecl_cursor_arg(c *Decl_cursor_argContext) + + // EnterDecl_is_for is called when entering the decl_is_for production. + EnterDecl_is_for(c *Decl_is_forContext) + + // EnterDecl_aliasitem is called when entering the decl_aliasitem production. + EnterDecl_aliasitem(c *Decl_aliasitemContext) + + // EnterDecl_varname is called when entering the decl_varname production. + EnterDecl_varname(c *Decl_varnameContext) + + // EnterDecl_const is called when entering the decl_const production. + EnterDecl_const(c *Decl_constContext) + + // EnterDecl_datatype is called when entering the decl_datatype production. + EnterDecl_datatype(c *Decl_datatypeContext) + + // EnterDecl_collate is called when entering the decl_collate production. + EnterDecl_collate(c *Decl_collateContext) + + // EnterDecl_notnull is called when entering the decl_notnull production. + EnterDecl_notnull(c *Decl_notnullContext) + + // EnterDecl_defval is called when entering the decl_defval production. + EnterDecl_defval(c *Decl_defvalContext) + + // EnterDecl_defkey is called when entering the decl_defkey production. + EnterDecl_defkey(c *Decl_defkeyContext) + + // EnterAssign_operator is called when entering the assign_operator production. + EnterAssign_operator(c *Assign_operatorContext) + + // EnterProc_sect is called when entering the proc_sect production. + EnterProc_sect(c *Proc_sectContext) + + // EnterProc_stmt is called when entering the proc_stmt production. + EnterProc_stmt(c *Proc_stmtContext) + + // EnterStmt_perform is called when entering the stmt_perform production. + EnterStmt_perform(c *Stmt_performContext) + + // EnterStmt_call is called when entering the stmt_call production. + EnterStmt_call(c *Stmt_callContext) + + // EnterOpt_expr_list is called when entering the opt_expr_list production. + EnterOpt_expr_list(c *Opt_expr_listContext) + + // EnterStmt_assign is called when entering the stmt_assign production. + EnterStmt_assign(c *Stmt_assignContext) + + // EnterStmt_getdiag is called when entering the stmt_getdiag production. + EnterStmt_getdiag(c *Stmt_getdiagContext) + + // EnterGetdiag_area_opt is called when entering the getdiag_area_opt production. + EnterGetdiag_area_opt(c *Getdiag_area_optContext) + + // EnterGetdiag_list is called when entering the getdiag_list production. + EnterGetdiag_list(c *Getdiag_listContext) + + // EnterGetdiag_list_item is called when entering the getdiag_list_item production. + EnterGetdiag_list_item(c *Getdiag_list_itemContext) + + // EnterGetdiag_item is called when entering the getdiag_item production. + EnterGetdiag_item(c *Getdiag_itemContext) + + // EnterGetdiag_target is called when entering the getdiag_target production. + EnterGetdiag_target(c *Getdiag_targetContext) + + // EnterAssign_var is called when entering the assign_var production. + EnterAssign_var(c *Assign_varContext) + + // EnterStmt_if is called when entering the stmt_if production. + EnterStmt_if(c *Stmt_ifContext) + + // EnterStmt_elsifs is called when entering the stmt_elsifs production. + EnterStmt_elsifs(c *Stmt_elsifsContext) + + // EnterStmt_else is called when entering the stmt_else production. + EnterStmt_else(c *Stmt_elseContext) + + // EnterStmt_case is called when entering the stmt_case production. + EnterStmt_case(c *Stmt_caseContext) + + // EnterOpt_expr_until_when is called when entering the opt_expr_until_when production. + EnterOpt_expr_until_when(c *Opt_expr_until_whenContext) + + // EnterCase_when_list is called when entering the case_when_list production. + EnterCase_when_list(c *Case_when_listContext) + + // EnterCase_when is called when entering the case_when production. + EnterCase_when(c *Case_whenContext) + + // EnterOpt_case_else is called when entering the opt_case_else production. + EnterOpt_case_else(c *Opt_case_elseContext) + + // EnterStmt_loop is called when entering the stmt_loop production. + EnterStmt_loop(c *Stmt_loopContext) + + // EnterStmt_while is called when entering the stmt_while production. + EnterStmt_while(c *Stmt_whileContext) + + // EnterStmt_for is called when entering the stmt_for production. + EnterStmt_for(c *Stmt_forContext) + + // EnterFor_control is called when entering the for_control production. + EnterFor_control(c *For_controlContext) + + // EnterOpt_for_using_expression is called when entering the opt_for_using_expression production. + EnterOpt_for_using_expression(c *Opt_for_using_expressionContext) + + // EnterOpt_cursor_parameters is called when entering the opt_cursor_parameters production. + EnterOpt_cursor_parameters(c *Opt_cursor_parametersContext) + + // EnterOpt_reverse is called when entering the opt_reverse production. + EnterOpt_reverse(c *Opt_reverseContext) + + // EnterOpt_by_expression is called when entering the opt_by_expression production. + EnterOpt_by_expression(c *Opt_by_expressionContext) + + // EnterFor_variable is called when entering the for_variable production. + EnterFor_variable(c *For_variableContext) + + // EnterStmt_foreach_a is called when entering the stmt_foreach_a production. + EnterStmt_foreach_a(c *Stmt_foreach_aContext) + + // EnterForeach_slice is called when entering the foreach_slice production. + EnterForeach_slice(c *Foreach_sliceContext) + + // EnterStmt_exit is called when entering the stmt_exit production. + EnterStmt_exit(c *Stmt_exitContext) + + // EnterExit_type is called when entering the exit_type production. + EnterExit_type(c *Exit_typeContext) + + // EnterStmt_return is called when entering the stmt_return production. + EnterStmt_return(c *Stmt_returnContext) + + // EnterOpt_return_result is called when entering the opt_return_result production. + EnterOpt_return_result(c *Opt_return_resultContext) + + // EnterStmt_raise is called when entering the stmt_raise production. + EnterStmt_raise(c *Stmt_raiseContext) + + // EnterOpt_stmt_raise_level is called when entering the opt_stmt_raise_level production. + EnterOpt_stmt_raise_level(c *Opt_stmt_raise_levelContext) + + // EnterOpt_raise_list is called when entering the opt_raise_list production. + EnterOpt_raise_list(c *Opt_raise_listContext) + + // EnterOpt_raise_using is called when entering the opt_raise_using production. + EnterOpt_raise_using(c *Opt_raise_usingContext) + + // EnterOpt_raise_using_elem is called when entering the opt_raise_using_elem production. + EnterOpt_raise_using_elem(c *Opt_raise_using_elemContext) + + // EnterOpt_raise_using_elem_list is called when entering the opt_raise_using_elem_list production. + EnterOpt_raise_using_elem_list(c *Opt_raise_using_elem_listContext) + + // EnterStmt_assert is called when entering the stmt_assert production. + EnterStmt_assert(c *Stmt_assertContext) + + // EnterOpt_stmt_assert_message is called when entering the opt_stmt_assert_message production. + EnterOpt_stmt_assert_message(c *Opt_stmt_assert_messageContext) + + // EnterLoop_body is called when entering the loop_body production. + EnterLoop_body(c *Loop_bodyContext) + + // EnterStmt_execsql is called when entering the stmt_execsql production. + EnterStmt_execsql(c *Stmt_execsqlContext) + + // EnterStmt_dynexecute is called when entering the stmt_dynexecute production. + EnterStmt_dynexecute(c *Stmt_dynexecuteContext) + + // EnterOpt_execute_using is called when entering the opt_execute_using production. + EnterOpt_execute_using(c *Opt_execute_usingContext) + + // EnterOpt_execute_using_list is called when entering the opt_execute_using_list production. + EnterOpt_execute_using_list(c *Opt_execute_using_listContext) + + // EnterOpt_execute_into is called when entering the opt_execute_into production. + EnterOpt_execute_into(c *Opt_execute_intoContext) + + // EnterStmt_open is called when entering the stmt_open production. + EnterStmt_open(c *Stmt_openContext) + + // EnterOpt_open_bound_list_item is called when entering the opt_open_bound_list_item production. + EnterOpt_open_bound_list_item(c *Opt_open_bound_list_itemContext) + + // EnterOpt_open_bound_list is called when entering the opt_open_bound_list production. + EnterOpt_open_bound_list(c *Opt_open_bound_listContext) + + // EnterOpt_open_using is called when entering the opt_open_using production. + EnterOpt_open_using(c *Opt_open_usingContext) + + // EnterOpt_scroll_option is called when entering the opt_scroll_option production. + EnterOpt_scroll_option(c *Opt_scroll_optionContext) + + // EnterOpt_scroll_option_no is called when entering the opt_scroll_option_no production. + EnterOpt_scroll_option_no(c *Opt_scroll_option_noContext) + + // EnterStmt_fetch is called when entering the stmt_fetch production. + EnterStmt_fetch(c *Stmt_fetchContext) + + // EnterInto_target is called when entering the into_target production. + EnterInto_target(c *Into_targetContext) + + // EnterOpt_cursor_from is called when entering the opt_cursor_from production. + EnterOpt_cursor_from(c *Opt_cursor_fromContext) + + // EnterOpt_fetch_direction is called when entering the opt_fetch_direction production. + EnterOpt_fetch_direction(c *Opt_fetch_directionContext) + + // EnterStmt_move is called when entering the stmt_move production. + EnterStmt_move(c *Stmt_moveContext) + + // EnterStmt_close is called when entering the stmt_close production. + EnterStmt_close(c *Stmt_closeContext) + + // EnterStmt_null is called when entering the stmt_null production. + EnterStmt_null(c *Stmt_nullContext) + + // EnterStmt_commit is called when entering the stmt_commit production. + EnterStmt_commit(c *Stmt_commitContext) + + // EnterStmt_rollback is called when entering the stmt_rollback production. + EnterStmt_rollback(c *Stmt_rollbackContext) + + // EnterPlsql_opt_transaction_chain is called when entering the plsql_opt_transaction_chain production. + EnterPlsql_opt_transaction_chain(c *Plsql_opt_transaction_chainContext) + + // EnterStmt_set is called when entering the stmt_set production. + EnterStmt_set(c *Stmt_setContext) + + // EnterCursor_variable is called when entering the cursor_variable production. + EnterCursor_variable(c *Cursor_variableContext) + + // EnterException_sect is called when entering the exception_sect production. + EnterException_sect(c *Exception_sectContext) + + // EnterProc_exceptions is called when entering the proc_exceptions production. + EnterProc_exceptions(c *Proc_exceptionsContext) + + // EnterProc_exception is called when entering the proc_exception production. + EnterProc_exception(c *Proc_exceptionContext) + + // EnterProc_conditions is called when entering the proc_conditions production. + EnterProc_conditions(c *Proc_conditionsContext) + + // EnterProc_condition is called when entering the proc_condition production. + EnterProc_condition(c *Proc_conditionContext) + + // EnterOpt_block_label is called when entering the opt_block_label production. + EnterOpt_block_label(c *Opt_block_labelContext) + + // EnterOpt_loop_label is called when entering the opt_loop_label production. + EnterOpt_loop_label(c *Opt_loop_labelContext) + + // EnterOpt_label is called when entering the opt_label production. + EnterOpt_label(c *Opt_labelContext) + + // EnterOpt_exitcond is called when entering the opt_exitcond production. + EnterOpt_exitcond(c *Opt_exitcondContext) + + // EnterAny_identifier is called when entering the any_identifier production. + EnterAny_identifier(c *Any_identifierContext) + + // EnterPlsql_unreserved_keyword is called when entering the plsql_unreserved_keyword production. + EnterPlsql_unreserved_keyword(c *Plsql_unreserved_keywordContext) + + // EnterSql_expression is called when entering the sql_expression production. + EnterSql_expression(c *Sql_expressionContext) + + // EnterExpr_until_then is called when entering the expr_until_then production. + EnterExpr_until_then(c *Expr_until_thenContext) + + // EnterExpr_until_semi is called when entering the expr_until_semi production. + EnterExpr_until_semi(c *Expr_until_semiContext) + + // EnterExpr_until_rightbracket is called when entering the expr_until_rightbracket production. + EnterExpr_until_rightbracket(c *Expr_until_rightbracketContext) + + // EnterExpr_until_loop is called when entering the expr_until_loop production. + EnterExpr_until_loop(c *Expr_until_loopContext) + + // EnterMake_execsql_stmt is called when entering the make_execsql_stmt production. + EnterMake_execsql_stmt(c *Make_execsql_stmtContext) + + // EnterOpt_returning_clause_into is called when entering the opt_returning_clause_into production. + EnterOpt_returning_clause_into(c *Opt_returning_clause_intoContext) + + // ExitRoot is called when exiting the root production. + ExitRoot(c *RootContext) + + // ExitPlsqlroot is called when exiting the plsqlroot production. + ExitPlsqlroot(c *PlsqlrootContext) + + // ExitStmtblock is called when exiting the stmtblock production. + ExitStmtblock(c *StmtblockContext) + + // ExitStmtmulti is called when exiting the stmtmulti production. + ExitStmtmulti(c *StmtmultiContext) + + // ExitStmt is called when exiting the stmt production. + ExitStmt(c *StmtContext) + + // ExitPlsqlconsolecommand is called when exiting the plsqlconsolecommand production. + ExitPlsqlconsolecommand(c *PlsqlconsolecommandContext) + + // ExitCallstmt is called when exiting the callstmt production. + ExitCallstmt(c *CallstmtContext) + + // ExitCreaterolestmt is called when exiting the createrolestmt production. + ExitCreaterolestmt(c *CreaterolestmtContext) + + // ExitOpt_with is called when exiting the opt_with production. + ExitOpt_with(c *Opt_withContext) + + // ExitOptrolelist is called when exiting the optrolelist production. + ExitOptrolelist(c *OptrolelistContext) + + // ExitAlteroptrolelist is called when exiting the alteroptrolelist production. + ExitAlteroptrolelist(c *AlteroptrolelistContext) + + // ExitAlteroptroleelem is called when exiting the alteroptroleelem production. + ExitAlteroptroleelem(c *AlteroptroleelemContext) + + // ExitCreateoptroleelem is called when exiting the createoptroleelem production. + ExitCreateoptroleelem(c *CreateoptroleelemContext) + + // ExitCreateuserstmt is called when exiting the createuserstmt production. + ExitCreateuserstmt(c *CreateuserstmtContext) + + // ExitAlterrolestmt is called when exiting the alterrolestmt production. + ExitAlterrolestmt(c *AlterrolestmtContext) + + // ExitOpt_in_database is called when exiting the opt_in_database production. + ExitOpt_in_database(c *Opt_in_databaseContext) + + // ExitAlterrolesetstmt is called when exiting the alterrolesetstmt production. + ExitAlterrolesetstmt(c *AlterrolesetstmtContext) + + // ExitDroprolestmt is called when exiting the droprolestmt production. + ExitDroprolestmt(c *DroprolestmtContext) + + // ExitCreategroupstmt is called when exiting the creategroupstmt production. + ExitCreategroupstmt(c *CreategroupstmtContext) + + // ExitAltergroupstmt is called when exiting the altergroupstmt production. + ExitAltergroupstmt(c *AltergroupstmtContext) + + // ExitAdd_drop is called when exiting the add_drop production. + ExitAdd_drop(c *Add_dropContext) + + // ExitCreateschemastmt is called when exiting the createschemastmt production. + ExitCreateschemastmt(c *CreateschemastmtContext) + + // ExitOptschemaname is called when exiting the optschemaname production. + ExitOptschemaname(c *OptschemanameContext) + + // ExitOptschemaeltlist is called when exiting the optschemaeltlist production. + ExitOptschemaeltlist(c *OptschemaeltlistContext) + + // ExitSchema_stmt is called when exiting the schema_stmt production. + ExitSchema_stmt(c *Schema_stmtContext) + + // ExitVariablesetstmt is called when exiting the variablesetstmt production. + ExitVariablesetstmt(c *VariablesetstmtContext) + + // ExitSet_rest is called when exiting the set_rest production. + ExitSet_rest(c *Set_restContext) + + // ExitGeneric_set is called when exiting the generic_set production. + ExitGeneric_set(c *Generic_setContext) + + // ExitSet_rest_more is called when exiting the set_rest_more production. + ExitSet_rest_more(c *Set_rest_moreContext) + + // ExitVar_name is called when exiting the var_name production. + ExitVar_name(c *Var_nameContext) + + // ExitVar_list is called when exiting the var_list production. + ExitVar_list(c *Var_listContext) + + // ExitVar_value is called when exiting the var_value production. + ExitVar_value(c *Var_valueContext) + + // ExitIso_level is called when exiting the iso_level production. + ExitIso_level(c *Iso_levelContext) + + // ExitOpt_boolean_or_string is called when exiting the opt_boolean_or_string production. + ExitOpt_boolean_or_string(c *Opt_boolean_or_stringContext) + + // ExitZone_value is called when exiting the zone_value production. + ExitZone_value(c *Zone_valueContext) + + // ExitOpt_encoding is called when exiting the opt_encoding production. + ExitOpt_encoding(c *Opt_encodingContext) + + // ExitNonreservedword_or_sconst is called when exiting the nonreservedword_or_sconst production. + ExitNonreservedword_or_sconst(c *Nonreservedword_or_sconstContext) + + // ExitVariableresetstmt is called when exiting the variableresetstmt production. + ExitVariableresetstmt(c *VariableresetstmtContext) + + // ExitReset_rest is called when exiting the reset_rest production. + ExitReset_rest(c *Reset_restContext) + + // ExitGeneric_reset is called when exiting the generic_reset production. + ExitGeneric_reset(c *Generic_resetContext) + + // ExitSetresetclause is called when exiting the setresetclause production. + ExitSetresetclause(c *SetresetclauseContext) + + // ExitFunctionsetresetclause is called when exiting the functionsetresetclause production. + ExitFunctionsetresetclause(c *FunctionsetresetclauseContext) + + // ExitVariableshowstmt is called when exiting the variableshowstmt production. + ExitVariableshowstmt(c *VariableshowstmtContext) + + // ExitConstraintssetstmt is called when exiting the constraintssetstmt production. + ExitConstraintssetstmt(c *ConstraintssetstmtContext) + + // ExitConstraints_set_list is called when exiting the constraints_set_list production. + ExitConstraints_set_list(c *Constraints_set_listContext) + + // ExitConstraints_set_mode is called when exiting the constraints_set_mode production. + ExitConstraints_set_mode(c *Constraints_set_modeContext) + + // ExitCheckpointstmt is called when exiting the checkpointstmt production. + ExitCheckpointstmt(c *CheckpointstmtContext) + + // ExitDiscardstmt is called when exiting the discardstmt production. + ExitDiscardstmt(c *DiscardstmtContext) + + // ExitAltertablestmt is called when exiting the altertablestmt production. + ExitAltertablestmt(c *AltertablestmtContext) + + // ExitAlter_table_cmds is called when exiting the alter_table_cmds production. + ExitAlter_table_cmds(c *Alter_table_cmdsContext) + + // ExitPartition_cmd is called when exiting the partition_cmd production. + ExitPartition_cmd(c *Partition_cmdContext) + + // ExitIndex_partition_cmd is called when exiting the index_partition_cmd production. + ExitIndex_partition_cmd(c *Index_partition_cmdContext) + + // ExitAlter_table_cmd is called when exiting the alter_table_cmd production. + ExitAlter_table_cmd(c *Alter_table_cmdContext) + + // ExitAlter_column_default is called when exiting the alter_column_default production. + ExitAlter_column_default(c *Alter_column_defaultContext) + + // ExitOpt_drop_behavior is called when exiting the opt_drop_behavior production. + ExitOpt_drop_behavior(c *Opt_drop_behaviorContext) + + // ExitOpt_collate_clause is called when exiting the opt_collate_clause production. + ExitOpt_collate_clause(c *Opt_collate_clauseContext) + + // ExitAlter_using is called when exiting the alter_using production. + ExitAlter_using(c *Alter_usingContext) + + // ExitReplica_identity is called when exiting the replica_identity production. + ExitReplica_identity(c *Replica_identityContext) + + // ExitReloptions is called when exiting the reloptions production. + ExitReloptions(c *ReloptionsContext) + + // ExitOpt_reloptions is called when exiting the opt_reloptions production. + ExitOpt_reloptions(c *Opt_reloptionsContext) + + // ExitReloption_list is called when exiting the reloption_list production. + ExitReloption_list(c *Reloption_listContext) + + // ExitReloption_elem is called when exiting the reloption_elem production. + ExitReloption_elem(c *Reloption_elemContext) + + // ExitAlter_identity_column_option_list is called when exiting the alter_identity_column_option_list production. + ExitAlter_identity_column_option_list(c *Alter_identity_column_option_listContext) + + // ExitAlter_identity_column_option is called when exiting the alter_identity_column_option production. + ExitAlter_identity_column_option(c *Alter_identity_column_optionContext) + + // ExitPartitionboundspec is called when exiting the partitionboundspec production. + ExitPartitionboundspec(c *PartitionboundspecContext) + + // ExitHash_partbound_elem is called when exiting the hash_partbound_elem production. + ExitHash_partbound_elem(c *Hash_partbound_elemContext) + + // ExitHash_partbound is called when exiting the hash_partbound production. + ExitHash_partbound(c *Hash_partboundContext) + + // ExitAltercompositetypestmt is called when exiting the altercompositetypestmt production. + ExitAltercompositetypestmt(c *AltercompositetypestmtContext) + + // ExitAlter_type_cmds is called when exiting the alter_type_cmds production. + ExitAlter_type_cmds(c *Alter_type_cmdsContext) + + // ExitAlter_type_cmd is called when exiting the alter_type_cmd production. + ExitAlter_type_cmd(c *Alter_type_cmdContext) + + // ExitCloseportalstmt is called when exiting the closeportalstmt production. + ExitCloseportalstmt(c *CloseportalstmtContext) + + // ExitCopystmt is called when exiting the copystmt production. + ExitCopystmt(c *CopystmtContext) + + // ExitCopy_from is called when exiting the copy_from production. + ExitCopy_from(c *Copy_fromContext) + + // ExitOpt_program is called when exiting the opt_program production. + ExitOpt_program(c *Opt_programContext) + + // ExitCopy_file_name is called when exiting the copy_file_name production. + ExitCopy_file_name(c *Copy_file_nameContext) + + // ExitCopy_options is called when exiting the copy_options production. + ExitCopy_options(c *Copy_optionsContext) + + // ExitCopy_opt_list is called when exiting the copy_opt_list production. + ExitCopy_opt_list(c *Copy_opt_listContext) + + // ExitCopy_opt_item is called when exiting the copy_opt_item production. + ExitCopy_opt_item(c *Copy_opt_itemContext) + + // ExitOpt_binary is called when exiting the opt_binary production. + ExitOpt_binary(c *Opt_binaryContext) + + // ExitCopy_delimiter is called when exiting the copy_delimiter production. + ExitCopy_delimiter(c *Copy_delimiterContext) + + // ExitOpt_using is called when exiting the opt_using production. + ExitOpt_using(c *Opt_usingContext) + + // ExitCopy_generic_opt_list is called when exiting the copy_generic_opt_list production. + ExitCopy_generic_opt_list(c *Copy_generic_opt_listContext) + + // ExitCopy_generic_opt_elem is called when exiting the copy_generic_opt_elem production. + ExitCopy_generic_opt_elem(c *Copy_generic_opt_elemContext) + + // ExitCopy_generic_opt_arg is called when exiting the copy_generic_opt_arg production. + ExitCopy_generic_opt_arg(c *Copy_generic_opt_argContext) + + // ExitCopy_generic_opt_arg_list is called when exiting the copy_generic_opt_arg_list production. + ExitCopy_generic_opt_arg_list(c *Copy_generic_opt_arg_listContext) + + // ExitCopy_generic_opt_arg_list_item is called when exiting the copy_generic_opt_arg_list_item production. + ExitCopy_generic_opt_arg_list_item(c *Copy_generic_opt_arg_list_itemContext) + + // ExitCreatestmt is called when exiting the createstmt production. + ExitCreatestmt(c *CreatestmtContext) + + // ExitOpttemp is called when exiting the opttemp production. + ExitOpttemp(c *OpttempContext) + + // ExitOpttableelementlist is called when exiting the opttableelementlist production. + ExitOpttableelementlist(c *OpttableelementlistContext) + + // ExitOpttypedtableelementlist is called when exiting the opttypedtableelementlist production. + ExitOpttypedtableelementlist(c *OpttypedtableelementlistContext) + + // ExitTableelementlist is called when exiting the tableelementlist production. + ExitTableelementlist(c *TableelementlistContext) + + // ExitTypedtableelementlist is called when exiting the typedtableelementlist production. + ExitTypedtableelementlist(c *TypedtableelementlistContext) + + // ExitTableelement is called when exiting the tableelement production. + ExitTableelement(c *TableelementContext) + + // ExitTypedtableelement is called when exiting the typedtableelement production. + ExitTypedtableelement(c *TypedtableelementContext) + + // ExitColumnDef is called when exiting the columnDef production. + ExitColumnDef(c *ColumnDefContext) + + // ExitRs_colattributes is called when exiting the rs_colattributes production. + ExitRs_colattributes(c *Rs_colattributesContext) + + // ExitColumnOptions is called when exiting the columnOptions production. + ExitColumnOptions(c *ColumnOptionsContext) + + // ExitColquallist is called when exiting the colquallist production. + ExitColquallist(c *ColquallistContext) + + // ExitColconstraint is called when exiting the colconstraint production. + ExitColconstraint(c *ColconstraintContext) + + // ExitColconstraintelem is called when exiting the colconstraintelem production. + ExitColconstraintelem(c *ColconstraintelemContext) + + // ExitOpt_unique_null_treatment is called when exiting the opt_unique_null_treatment production. + ExitOpt_unique_null_treatment(c *Opt_unique_null_treatmentContext) + + // ExitGenerated_when is called when exiting the generated_when production. + ExitGenerated_when(c *Generated_whenContext) + + // ExitConstraintattr is called when exiting the constraintattr production. + ExitConstraintattr(c *ConstraintattrContext) + + // ExitTablelikeclause is called when exiting the tablelikeclause production. + ExitTablelikeclause(c *TablelikeclauseContext) + + // ExitTablelikeoptionlist is called when exiting the tablelikeoptionlist production. + ExitTablelikeoptionlist(c *TablelikeoptionlistContext) + + // ExitTablelikeoption is called when exiting the tablelikeoption production. + ExitTablelikeoption(c *TablelikeoptionContext) + + // ExitTableconstraint is called when exiting the tableconstraint production. + ExitTableconstraint(c *TableconstraintContext) + + // ExitConstraintelem is called when exiting the constraintelem production. + ExitConstraintelem(c *ConstraintelemContext) + + // ExitOpt_no_inherit is called when exiting the opt_no_inherit production. + ExitOpt_no_inherit(c *Opt_no_inheritContext) + + // ExitOpt_column_list is called when exiting the opt_column_list production. + ExitOpt_column_list(c *Opt_column_listContext) + + // ExitColumnlist is called when exiting the columnlist production. + ExitColumnlist(c *ColumnlistContext) + + // ExitColumnElem is called when exiting the columnElem production. + ExitColumnElem(c *ColumnElemContext) + + // ExitOpt_c_include is called when exiting the opt_c_include production. + ExitOpt_c_include(c *Opt_c_includeContext) + + // ExitKey_match is called when exiting the key_match production. + ExitKey_match(c *Key_matchContext) + + // ExitExclusionconstraintlist is called when exiting the exclusionconstraintlist production. + ExitExclusionconstraintlist(c *ExclusionconstraintlistContext) + + // ExitExclusionconstraintelem is called when exiting the exclusionconstraintelem production. + ExitExclusionconstraintelem(c *ExclusionconstraintelemContext) + + // ExitExclusionwhereclause is called when exiting the exclusionwhereclause production. + ExitExclusionwhereclause(c *ExclusionwhereclauseContext) + + // ExitKey_actions is called when exiting the key_actions production. + ExitKey_actions(c *Key_actionsContext) + + // ExitKey_update is called when exiting the key_update production. + ExitKey_update(c *Key_updateContext) + + // ExitKey_delete is called when exiting the key_delete production. + ExitKey_delete(c *Key_deleteContext) + + // ExitKey_action is called when exiting the key_action production. + ExitKey_action(c *Key_actionContext) + + // ExitOptinherit is called when exiting the optinherit production. + ExitOptinherit(c *OptinheritContext) + + // ExitOptpartitionspec is called when exiting the optpartitionspec production. + ExitOptpartitionspec(c *OptpartitionspecContext) + + // ExitPartitionspec is called when exiting the partitionspec production. + ExitPartitionspec(c *PartitionspecContext) + + // ExitPart_params is called when exiting the part_params production. + ExitPart_params(c *Part_paramsContext) + + // ExitPart_elem is called when exiting the part_elem production. + ExitPart_elem(c *Part_elemContext) + + // ExitTable_access_method_clause is called when exiting the table_access_method_clause production. + ExitTable_access_method_clause(c *Table_access_method_clauseContext) + + // ExitOptwith is called when exiting the optwith production. + ExitOptwith(c *OptwithContext) + + // ExitOncommitoption is called when exiting the oncommitoption production. + ExitOncommitoption(c *OncommitoptionContext) + + // ExitOpttablespace is called when exiting the opttablespace production. + ExitOpttablespace(c *OpttablespaceContext) + + // ExitOptconstablespace is called when exiting the optconstablespace production. + ExitOptconstablespace(c *OptconstablespaceContext) + + // ExitExistingindex is called when exiting the existingindex production. + ExitExistingindex(c *ExistingindexContext) + + // ExitCreatestatsstmt is called when exiting the createstatsstmt production. + ExitCreatestatsstmt(c *CreatestatsstmtContext) + + // ExitAlterstatsstmt is called when exiting the alterstatsstmt production. + ExitAlterstatsstmt(c *AlterstatsstmtContext) + + // ExitCreateasstmt is called when exiting the createasstmt production. + ExitCreateasstmt(c *CreateasstmtContext) + + // ExitCreate_as_target is called when exiting the create_as_target production. + ExitCreate_as_target(c *Create_as_targetContext) + + // ExitOpt_with_data is called when exiting the opt_with_data production. + ExitOpt_with_data(c *Opt_with_dataContext) + + // ExitCreatematviewstmt is called when exiting the creatematviewstmt production. + ExitCreatematviewstmt(c *CreatematviewstmtContext) + + // ExitCreate_mv_target is called when exiting the create_mv_target production. + ExitCreate_mv_target(c *Create_mv_targetContext) + + // ExitOptnolog is called when exiting the optnolog production. + ExitOptnolog(c *OptnologContext) + + // ExitRefreshmatviewstmt is called when exiting the refreshmatviewstmt production. + ExitRefreshmatviewstmt(c *RefreshmatviewstmtContext) + + // ExitCreateseqstmt is called when exiting the createseqstmt production. + ExitCreateseqstmt(c *CreateseqstmtContext) + + // ExitAlterseqstmt is called when exiting the alterseqstmt production. + ExitAlterseqstmt(c *AlterseqstmtContext) + + // ExitOptseqoptlist is called when exiting the optseqoptlist production. + ExitOptseqoptlist(c *OptseqoptlistContext) + + // ExitOptparenthesizedseqoptlist is called when exiting the optparenthesizedseqoptlist production. + ExitOptparenthesizedseqoptlist(c *OptparenthesizedseqoptlistContext) + + // ExitSeqoptlist is called when exiting the seqoptlist production. + ExitSeqoptlist(c *SeqoptlistContext) + + // ExitSeqoptelem is called when exiting the seqoptelem production. + ExitSeqoptelem(c *SeqoptelemContext) + + // ExitOpt_by is called when exiting the opt_by production. + ExitOpt_by(c *Opt_byContext) + + // ExitNumericonly is called when exiting the numericonly production. + ExitNumericonly(c *NumericonlyContext) + + // ExitNumericonly_list is called when exiting the numericonly_list production. + ExitNumericonly_list(c *Numericonly_listContext) + + // ExitCreateplangstmt is called when exiting the createplangstmt production. + ExitCreateplangstmt(c *CreateplangstmtContext) + + // ExitOpt_trusted is called when exiting the opt_trusted production. + ExitOpt_trusted(c *Opt_trustedContext) + + // ExitHandler_name is called when exiting the handler_name production. + ExitHandler_name(c *Handler_nameContext) + + // ExitOpt_inline_handler is called when exiting the opt_inline_handler production. + ExitOpt_inline_handler(c *Opt_inline_handlerContext) + + // ExitValidator_clause is called when exiting the validator_clause production. + ExitValidator_clause(c *Validator_clauseContext) + + // ExitOpt_validator is called when exiting the opt_validator production. + ExitOpt_validator(c *Opt_validatorContext) + + // ExitOpt_procedural is called when exiting the opt_procedural production. + ExitOpt_procedural(c *Opt_proceduralContext) + + // ExitCreatetablespacestmt is called when exiting the createtablespacestmt production. + ExitCreatetablespacestmt(c *CreatetablespacestmtContext) + + // ExitOpttablespaceowner is called when exiting the opttablespaceowner production. + ExitOpttablespaceowner(c *OpttablespaceownerContext) + + // ExitDroptablespacestmt is called when exiting the droptablespacestmt production. + ExitDroptablespacestmt(c *DroptablespacestmtContext) + + // ExitCreateextensionstmt is called when exiting the createextensionstmt production. + ExitCreateextensionstmt(c *CreateextensionstmtContext) + + // ExitCreate_extension_opt_list is called when exiting the create_extension_opt_list production. + ExitCreate_extension_opt_list(c *Create_extension_opt_listContext) + + // ExitCreate_extension_opt_item is called when exiting the create_extension_opt_item production. + ExitCreate_extension_opt_item(c *Create_extension_opt_itemContext) + + // ExitAlterextensionstmt is called when exiting the alterextensionstmt production. + ExitAlterextensionstmt(c *AlterextensionstmtContext) + + // ExitAlter_extension_opt_list is called when exiting the alter_extension_opt_list production. + ExitAlter_extension_opt_list(c *Alter_extension_opt_listContext) + + // ExitAlter_extension_opt_item is called when exiting the alter_extension_opt_item production. + ExitAlter_extension_opt_item(c *Alter_extension_opt_itemContext) + + // ExitAlterextensioncontentsstmt is called when exiting the alterextensioncontentsstmt production. + ExitAlterextensioncontentsstmt(c *AlterextensioncontentsstmtContext) + + // ExitCreatefdwstmt is called when exiting the createfdwstmt production. + ExitCreatefdwstmt(c *CreatefdwstmtContext) + + // ExitFdw_option is called when exiting the fdw_option production. + ExitFdw_option(c *Fdw_optionContext) + + // ExitFdw_options is called when exiting the fdw_options production. + ExitFdw_options(c *Fdw_optionsContext) + + // ExitOpt_fdw_options is called when exiting the opt_fdw_options production. + ExitOpt_fdw_options(c *Opt_fdw_optionsContext) + + // ExitAlterfdwstmt is called when exiting the alterfdwstmt production. + ExitAlterfdwstmt(c *AlterfdwstmtContext) + + // ExitCreate_generic_options is called when exiting the create_generic_options production. + ExitCreate_generic_options(c *Create_generic_optionsContext) + + // ExitGeneric_option_list is called when exiting the generic_option_list production. + ExitGeneric_option_list(c *Generic_option_listContext) + + // ExitAlter_generic_options is called when exiting the alter_generic_options production. + ExitAlter_generic_options(c *Alter_generic_optionsContext) + + // ExitAlter_generic_option_list is called when exiting the alter_generic_option_list production. + ExitAlter_generic_option_list(c *Alter_generic_option_listContext) + + // ExitAlter_generic_option_elem is called when exiting the alter_generic_option_elem production. + ExitAlter_generic_option_elem(c *Alter_generic_option_elemContext) + + // ExitGeneric_option_elem is called when exiting the generic_option_elem production. + ExitGeneric_option_elem(c *Generic_option_elemContext) + + // ExitGeneric_option_name is called when exiting the generic_option_name production. + ExitGeneric_option_name(c *Generic_option_nameContext) + + // ExitGeneric_option_arg is called when exiting the generic_option_arg production. + ExitGeneric_option_arg(c *Generic_option_argContext) + + // ExitCreateforeignserverstmt is called when exiting the createforeignserverstmt production. + ExitCreateforeignserverstmt(c *CreateforeignserverstmtContext) + + // ExitOpt_type is called when exiting the opt_type production. + ExitOpt_type(c *Opt_typeContext) + + // ExitForeign_server_version is called when exiting the foreign_server_version production. + ExitForeign_server_version(c *Foreign_server_versionContext) + + // ExitOpt_foreign_server_version is called when exiting the opt_foreign_server_version production. + ExitOpt_foreign_server_version(c *Opt_foreign_server_versionContext) + + // ExitAlterforeignserverstmt is called when exiting the alterforeignserverstmt production. + ExitAlterforeignserverstmt(c *AlterforeignserverstmtContext) + + // ExitCreateforeigntablestmt is called when exiting the createforeigntablestmt production. + ExitCreateforeigntablestmt(c *CreateforeigntablestmtContext) + + // ExitImportforeignschemastmt is called when exiting the importforeignschemastmt production. + ExitImportforeignschemastmt(c *ImportforeignschemastmtContext) + + // ExitImport_qualification_type is called when exiting the import_qualification_type production. + ExitImport_qualification_type(c *Import_qualification_typeContext) + + // ExitImport_qualification is called when exiting the import_qualification production. + ExitImport_qualification(c *Import_qualificationContext) + + // ExitCreateusermappingstmt is called when exiting the createusermappingstmt production. + ExitCreateusermappingstmt(c *CreateusermappingstmtContext) + + // ExitAuth_ident is called when exiting the auth_ident production. + ExitAuth_ident(c *Auth_identContext) + + // ExitDropusermappingstmt is called when exiting the dropusermappingstmt production. + ExitDropusermappingstmt(c *DropusermappingstmtContext) + + // ExitAlterusermappingstmt is called when exiting the alterusermappingstmt production. + ExitAlterusermappingstmt(c *AlterusermappingstmtContext) + + // ExitCreatepolicystmt is called when exiting the createpolicystmt production. + ExitCreatepolicystmt(c *CreatepolicystmtContext) + + // ExitAlterpolicystmt is called when exiting the alterpolicystmt production. + ExitAlterpolicystmt(c *AlterpolicystmtContext) + + // ExitRowsecurityoptionalexpr is called when exiting the rowsecurityoptionalexpr production. + ExitRowsecurityoptionalexpr(c *RowsecurityoptionalexprContext) + + // ExitRowsecurityoptionalwithcheck is called when exiting the rowsecurityoptionalwithcheck production. + ExitRowsecurityoptionalwithcheck(c *RowsecurityoptionalwithcheckContext) + + // ExitRowsecuritydefaulttorole is called when exiting the rowsecuritydefaulttorole production. + ExitRowsecuritydefaulttorole(c *RowsecuritydefaulttoroleContext) + + // ExitRowsecurityoptionaltorole is called when exiting the rowsecurityoptionaltorole production. + ExitRowsecurityoptionaltorole(c *RowsecurityoptionaltoroleContext) + + // ExitRowsecuritydefaultpermissive is called when exiting the rowsecuritydefaultpermissive production. + ExitRowsecuritydefaultpermissive(c *RowsecuritydefaultpermissiveContext) + + // ExitRowsecuritydefaultforcmd is called when exiting the rowsecuritydefaultforcmd production. + ExitRowsecuritydefaultforcmd(c *RowsecuritydefaultforcmdContext) + + // ExitRow_security_cmd is called when exiting the row_security_cmd production. + ExitRow_security_cmd(c *Row_security_cmdContext) + + // ExitCreateamstmt is called when exiting the createamstmt production. + ExitCreateamstmt(c *CreateamstmtContext) + + // ExitAm_type is called when exiting the am_type production. + ExitAm_type(c *Am_typeContext) + + // ExitCreatetrigstmt is called when exiting the createtrigstmt production. + ExitCreatetrigstmt(c *CreatetrigstmtContext) + + // ExitTriggeractiontime is called when exiting the triggeractiontime production. + ExitTriggeractiontime(c *TriggeractiontimeContext) + + // ExitTriggerevents is called when exiting the triggerevents production. + ExitTriggerevents(c *TriggereventsContext) + + // ExitTriggeroneevent is called when exiting the triggeroneevent production. + ExitTriggeroneevent(c *TriggeroneeventContext) + + // ExitTriggerreferencing is called when exiting the triggerreferencing production. + ExitTriggerreferencing(c *TriggerreferencingContext) + + // ExitTriggertransitions is called when exiting the triggertransitions production. + ExitTriggertransitions(c *TriggertransitionsContext) + + // ExitTriggertransition is called when exiting the triggertransition production. + ExitTriggertransition(c *TriggertransitionContext) + + // ExitTransitionoldornew is called when exiting the transitionoldornew production. + ExitTransitionoldornew(c *TransitionoldornewContext) + + // ExitTransitionrowortable is called when exiting the transitionrowortable production. + ExitTransitionrowortable(c *TransitionrowortableContext) + + // ExitTransitionrelname is called when exiting the transitionrelname production. + ExitTransitionrelname(c *TransitionrelnameContext) + + // ExitTriggerforspec is called when exiting the triggerforspec production. + ExitTriggerforspec(c *TriggerforspecContext) + + // ExitTriggerforopteach is called when exiting the triggerforopteach production. + ExitTriggerforopteach(c *TriggerforopteachContext) + + // ExitTriggerfortype is called when exiting the triggerfortype production. + ExitTriggerfortype(c *TriggerfortypeContext) + + // ExitTriggerwhen is called when exiting the triggerwhen production. + ExitTriggerwhen(c *TriggerwhenContext) + + // ExitFunction_or_procedure is called when exiting the function_or_procedure production. + ExitFunction_or_procedure(c *Function_or_procedureContext) + + // ExitTriggerfuncargs is called when exiting the triggerfuncargs production. + ExitTriggerfuncargs(c *TriggerfuncargsContext) + + // ExitTriggerfuncarg is called when exiting the triggerfuncarg production. + ExitTriggerfuncarg(c *TriggerfuncargContext) + + // ExitOptconstrfromtable is called when exiting the optconstrfromtable production. + ExitOptconstrfromtable(c *OptconstrfromtableContext) + + // ExitConstraintattributespec is called when exiting the constraintattributespec production. + ExitConstraintattributespec(c *ConstraintattributespecContext) + + // ExitConstraintattributeElem is called when exiting the constraintattributeElem production. + ExitConstraintattributeElem(c *ConstraintattributeElemContext) + + // ExitCreateeventtrigstmt is called when exiting the createeventtrigstmt production. + ExitCreateeventtrigstmt(c *CreateeventtrigstmtContext) + + // ExitEvent_trigger_when_list is called when exiting the event_trigger_when_list production. + ExitEvent_trigger_when_list(c *Event_trigger_when_listContext) + + // ExitEvent_trigger_when_item is called when exiting the event_trigger_when_item production. + ExitEvent_trigger_when_item(c *Event_trigger_when_itemContext) + + // ExitEvent_trigger_value_list is called when exiting the event_trigger_value_list production. + ExitEvent_trigger_value_list(c *Event_trigger_value_listContext) + + // ExitAltereventtrigstmt is called when exiting the altereventtrigstmt production. + ExitAltereventtrigstmt(c *AltereventtrigstmtContext) + + // ExitEnable_trigger is called when exiting the enable_trigger production. + ExitEnable_trigger(c *Enable_triggerContext) + + // ExitCreateassertionstmt is called when exiting the createassertionstmt production. + ExitCreateassertionstmt(c *CreateassertionstmtContext) + + // ExitDefinestmt is called when exiting the definestmt production. + ExitDefinestmt(c *DefinestmtContext) + + // ExitDefinition is called when exiting the definition production. + ExitDefinition(c *DefinitionContext) + + // ExitDef_list is called when exiting the def_list production. + ExitDef_list(c *Def_listContext) + + // ExitDef_elem is called when exiting the def_elem production. + ExitDef_elem(c *Def_elemContext) + + // ExitDef_arg is called when exiting the def_arg production. + ExitDef_arg(c *Def_argContext) + + // ExitOld_aggr_definition is called when exiting the old_aggr_definition production. + ExitOld_aggr_definition(c *Old_aggr_definitionContext) + + // ExitOld_aggr_list is called when exiting the old_aggr_list production. + ExitOld_aggr_list(c *Old_aggr_listContext) + + // ExitOld_aggr_elem is called when exiting the old_aggr_elem production. + ExitOld_aggr_elem(c *Old_aggr_elemContext) + + // ExitOpt_enum_val_list is called when exiting the opt_enum_val_list production. + ExitOpt_enum_val_list(c *Opt_enum_val_listContext) + + // ExitEnum_val_list is called when exiting the enum_val_list production. + ExitEnum_val_list(c *Enum_val_listContext) + + // ExitAlterenumstmt is called when exiting the alterenumstmt production. + ExitAlterenumstmt(c *AlterenumstmtContext) + + // ExitOpt_if_not_exists is called when exiting the opt_if_not_exists production. + ExitOpt_if_not_exists(c *Opt_if_not_existsContext) + + // ExitCreateopclassstmt is called when exiting the createopclassstmt production. + ExitCreateopclassstmt(c *CreateopclassstmtContext) + + // ExitOpclass_item_list is called when exiting the opclass_item_list production. + ExitOpclass_item_list(c *Opclass_item_listContext) + + // ExitOpclass_item is called when exiting the opclass_item production. + ExitOpclass_item(c *Opclass_itemContext) + + // ExitOpt_default is called when exiting the opt_default production. + ExitOpt_default(c *Opt_defaultContext) + + // ExitOpt_opfamily is called when exiting the opt_opfamily production. + ExitOpt_opfamily(c *Opt_opfamilyContext) + + // ExitOpclass_purpose is called when exiting the opclass_purpose production. + ExitOpclass_purpose(c *Opclass_purposeContext) + + // ExitOpt_recheck is called when exiting the opt_recheck production. + ExitOpt_recheck(c *Opt_recheckContext) + + // ExitCreateopfamilystmt is called when exiting the createopfamilystmt production. + ExitCreateopfamilystmt(c *CreateopfamilystmtContext) + + // ExitAlteropfamilystmt is called when exiting the alteropfamilystmt production. + ExitAlteropfamilystmt(c *AlteropfamilystmtContext) + + // ExitOpclass_drop_list is called when exiting the opclass_drop_list production. + ExitOpclass_drop_list(c *Opclass_drop_listContext) + + // ExitOpclass_drop is called when exiting the opclass_drop production. + ExitOpclass_drop(c *Opclass_dropContext) + + // ExitDropopclassstmt is called when exiting the dropopclassstmt production. + ExitDropopclassstmt(c *DropopclassstmtContext) + + // ExitDropopfamilystmt is called when exiting the dropopfamilystmt production. + ExitDropopfamilystmt(c *DropopfamilystmtContext) + + // ExitDropownedstmt is called when exiting the dropownedstmt production. + ExitDropownedstmt(c *DropownedstmtContext) + + // ExitReassignownedstmt is called when exiting the reassignownedstmt production. + ExitReassignownedstmt(c *ReassignownedstmtContext) + + // ExitDropstmt is called when exiting the dropstmt production. + ExitDropstmt(c *DropstmtContext) + + // ExitObject_type_any_name is called when exiting the object_type_any_name production. + ExitObject_type_any_name(c *Object_type_any_nameContext) + + // ExitObject_type_name is called when exiting the object_type_name production. + ExitObject_type_name(c *Object_type_nameContext) + + // ExitDrop_type_name is called when exiting the drop_type_name production. + ExitDrop_type_name(c *Drop_type_nameContext) + + // ExitObject_type_name_on_any_name is called when exiting the object_type_name_on_any_name production. + ExitObject_type_name_on_any_name(c *Object_type_name_on_any_nameContext) + + // ExitAny_name_list is called when exiting the any_name_list production. + ExitAny_name_list(c *Any_name_listContext) + + // ExitAny_name is called when exiting the any_name production. + ExitAny_name(c *Any_nameContext) + + // ExitAttrs is called when exiting the attrs production. + ExitAttrs(c *AttrsContext) + + // ExitType_name_list is called when exiting the type_name_list production. + ExitType_name_list(c *Type_name_listContext) + + // ExitTruncatestmt is called when exiting the truncatestmt production. + ExitTruncatestmt(c *TruncatestmtContext) + + // ExitOpt_restart_seqs is called when exiting the opt_restart_seqs production. + ExitOpt_restart_seqs(c *Opt_restart_seqsContext) + + // ExitCommentstmt is called when exiting the commentstmt production. + ExitCommentstmt(c *CommentstmtContext) + + // ExitComment_text is called when exiting the comment_text production. + ExitComment_text(c *Comment_textContext) + + // ExitSeclabelstmt is called when exiting the seclabelstmt production. + ExitSeclabelstmt(c *SeclabelstmtContext) + + // ExitOpt_provider is called when exiting the opt_provider production. + ExitOpt_provider(c *Opt_providerContext) + + // ExitSecurity_label is called when exiting the security_label production. + ExitSecurity_label(c *Security_labelContext) + + // ExitFetchstmt is called when exiting the fetchstmt production. + ExitFetchstmt(c *FetchstmtContext) + + // ExitFetch_args is called when exiting the fetch_args production. + ExitFetch_args(c *Fetch_argsContext) + + // ExitFrom_in is called when exiting the from_in production. + ExitFrom_in(c *From_inContext) + + // ExitOpt_from_in is called when exiting the opt_from_in production. + ExitOpt_from_in(c *Opt_from_inContext) + + // ExitGrantstmt is called when exiting the grantstmt production. + ExitGrantstmt(c *GrantstmtContext) + + // ExitRevokestmt is called when exiting the revokestmt production. + ExitRevokestmt(c *RevokestmtContext) + + // ExitPrivileges is called when exiting the privileges production. + ExitPrivileges(c *PrivilegesContext) + + // ExitPrivilege_list is called when exiting the privilege_list production. + ExitPrivilege_list(c *Privilege_listContext) + + // ExitPrivilege is called when exiting the privilege production. + ExitPrivilege(c *PrivilegeContext) + + // ExitPrivilege_target is called when exiting the privilege_target production. + ExitPrivilege_target(c *Privilege_targetContext) + + // ExitParameter_name_list is called when exiting the parameter_name_list production. + ExitParameter_name_list(c *Parameter_name_listContext) + + // ExitParameter_name is called when exiting the parameter_name production. + ExitParameter_name(c *Parameter_nameContext) + + // ExitGrantee_list is called when exiting the grantee_list production. + ExitGrantee_list(c *Grantee_listContext) + + // ExitGrantee is called when exiting the grantee production. + ExitGrantee(c *GranteeContext) + + // ExitOpt_grant_grant_option is called when exiting the opt_grant_grant_option production. + ExitOpt_grant_grant_option(c *Opt_grant_grant_optionContext) + + // ExitGrantrolestmt is called when exiting the grantrolestmt production. + ExitGrantrolestmt(c *GrantrolestmtContext) + + // ExitRevokerolestmt is called when exiting the revokerolestmt production. + ExitRevokerolestmt(c *RevokerolestmtContext) + + // ExitOpt_grant_admin_option is called when exiting the opt_grant_admin_option production. + ExitOpt_grant_admin_option(c *Opt_grant_admin_optionContext) + + // ExitOpt_granted_by is called when exiting the opt_granted_by production. + ExitOpt_granted_by(c *Opt_granted_byContext) + + // ExitAlterdefaultprivilegesstmt is called when exiting the alterdefaultprivilegesstmt production. + ExitAlterdefaultprivilegesstmt(c *AlterdefaultprivilegesstmtContext) + + // ExitDefacloptionlist is called when exiting the defacloptionlist production. + ExitDefacloptionlist(c *DefacloptionlistContext) + + // ExitDefacloption is called when exiting the defacloption production. + ExitDefacloption(c *DefacloptionContext) + + // ExitDefaclaction is called when exiting the defaclaction production. + ExitDefaclaction(c *DefaclactionContext) + + // ExitDefacl_privilege_target is called when exiting the defacl_privilege_target production. + ExitDefacl_privilege_target(c *Defacl_privilege_targetContext) + + // ExitIndexstmt is called when exiting the indexstmt production. + ExitIndexstmt(c *IndexstmtContext) + + // ExitOpt_unique is called when exiting the opt_unique production. + ExitOpt_unique(c *Opt_uniqueContext) + + // ExitOpt_concurrently is called when exiting the opt_concurrently production. + ExitOpt_concurrently(c *Opt_concurrentlyContext) + + // ExitOpt_index_name is called when exiting the opt_index_name production. + ExitOpt_index_name(c *Opt_index_nameContext) + + // ExitAccess_method_clause is called when exiting the access_method_clause production. + ExitAccess_method_clause(c *Access_method_clauseContext) + + // ExitIndex_params is called when exiting the index_params production. + ExitIndex_params(c *Index_paramsContext) + + // ExitIndex_elem_options is called when exiting the index_elem_options production. + ExitIndex_elem_options(c *Index_elem_optionsContext) + + // ExitIndex_elem is called when exiting the index_elem production. + ExitIndex_elem(c *Index_elemContext) + + // ExitOpt_include is called when exiting the opt_include production. + ExitOpt_include(c *Opt_includeContext) + + // ExitIndex_including_params is called when exiting the index_including_params production. + ExitIndex_including_params(c *Index_including_paramsContext) + + // ExitOpt_collate is called when exiting the opt_collate production. + ExitOpt_collate(c *Opt_collateContext) + + // ExitOpt_class is called when exiting the opt_class production. + ExitOpt_class(c *Opt_classContext) + + // ExitOpt_asc_desc is called when exiting the opt_asc_desc production. + ExitOpt_asc_desc(c *Opt_asc_descContext) + + // ExitOpt_nulls_order is called when exiting the opt_nulls_order production. + ExitOpt_nulls_order(c *Opt_nulls_orderContext) + + // ExitCreatefunctionstmt is called when exiting the createfunctionstmt production. + ExitCreatefunctionstmt(c *CreatefunctionstmtContext) + + // ExitOpt_or_replace is called when exiting the opt_or_replace production. + ExitOpt_or_replace(c *Opt_or_replaceContext) + + // ExitFunc_args is called when exiting the func_args production. + ExitFunc_args(c *Func_argsContext) + + // ExitFunc_args_list is called when exiting the func_args_list production. + ExitFunc_args_list(c *Func_args_listContext) + + // ExitFunction_with_argtypes_list is called when exiting the function_with_argtypes_list production. + ExitFunction_with_argtypes_list(c *Function_with_argtypes_listContext) + + // ExitFunction_with_argtypes is called when exiting the function_with_argtypes production. + ExitFunction_with_argtypes(c *Function_with_argtypesContext) + + // ExitFunc_args_with_defaults is called when exiting the func_args_with_defaults production. + ExitFunc_args_with_defaults(c *Func_args_with_defaultsContext) + + // ExitFunc_args_with_defaults_list is called when exiting the func_args_with_defaults_list production. + ExitFunc_args_with_defaults_list(c *Func_args_with_defaults_listContext) + + // ExitFunc_arg is called when exiting the func_arg production. + ExitFunc_arg(c *Func_argContext) + + // ExitArg_class is called when exiting the arg_class production. + ExitArg_class(c *Arg_classContext) + + // ExitParam_name is called when exiting the param_name production. + ExitParam_name(c *Param_nameContext) + + // ExitFunc_return is called when exiting the func_return production. + ExitFunc_return(c *Func_returnContext) + + // ExitFunc_type is called when exiting the func_type production. + ExitFunc_type(c *Func_typeContext) + + // ExitFunc_arg_with_default is called when exiting the func_arg_with_default production. + ExitFunc_arg_with_default(c *Func_arg_with_defaultContext) + + // ExitAggr_arg is called when exiting the aggr_arg production. + ExitAggr_arg(c *Aggr_argContext) + + // ExitAggr_args is called when exiting the aggr_args production. + ExitAggr_args(c *Aggr_argsContext) + + // ExitAggr_args_list is called when exiting the aggr_args_list production. + ExitAggr_args_list(c *Aggr_args_listContext) + + // ExitAggregate_with_argtypes is called when exiting the aggregate_with_argtypes production. + ExitAggregate_with_argtypes(c *Aggregate_with_argtypesContext) + + // ExitAggregate_with_argtypes_list is called when exiting the aggregate_with_argtypes_list production. + ExitAggregate_with_argtypes_list(c *Aggregate_with_argtypes_listContext) + + // ExitCreatefunc_opt_list is called when exiting the createfunc_opt_list production. + ExitCreatefunc_opt_list(c *Createfunc_opt_listContext) + + // ExitCommon_func_opt_item is called when exiting the common_func_opt_item production. + ExitCommon_func_opt_item(c *Common_func_opt_itemContext) + + // ExitCreatefunc_opt_item is called when exiting the createfunc_opt_item production. + ExitCreatefunc_opt_item(c *Createfunc_opt_itemContext) + + // ExitFunc_as is called when exiting the func_as production. + ExitFunc_as(c *Func_asContext) + + // ExitTransform_type_list is called when exiting the transform_type_list production. + ExitTransform_type_list(c *Transform_type_listContext) + + // ExitOpt_definition is called when exiting the opt_definition production. + ExitOpt_definition(c *Opt_definitionContext) + + // ExitTable_func_column is called when exiting the table_func_column production. + ExitTable_func_column(c *Table_func_columnContext) + + // ExitTable_func_column_list is called when exiting the table_func_column_list production. + ExitTable_func_column_list(c *Table_func_column_listContext) + + // ExitAlterfunctionstmt is called when exiting the alterfunctionstmt production. + ExitAlterfunctionstmt(c *AlterfunctionstmtContext) + + // ExitAlterfunc_opt_list is called when exiting the alterfunc_opt_list production. + ExitAlterfunc_opt_list(c *Alterfunc_opt_listContext) + + // ExitOpt_restrict is called when exiting the opt_restrict production. + ExitOpt_restrict(c *Opt_restrictContext) + + // ExitRemovefuncstmt is called when exiting the removefuncstmt production. + ExitRemovefuncstmt(c *RemovefuncstmtContext) + + // ExitRemoveaggrstmt is called when exiting the removeaggrstmt production. + ExitRemoveaggrstmt(c *RemoveaggrstmtContext) + + // ExitRemoveoperstmt is called when exiting the removeoperstmt production. + ExitRemoveoperstmt(c *RemoveoperstmtContext) + + // ExitOper_argtypes is called when exiting the oper_argtypes production. + ExitOper_argtypes(c *Oper_argtypesContext) + + // ExitAny_operator is called when exiting the any_operator production. + ExitAny_operator(c *Any_operatorContext) + + // ExitOperator_with_argtypes_list is called when exiting the operator_with_argtypes_list production. + ExitOperator_with_argtypes_list(c *Operator_with_argtypes_listContext) + + // ExitOperator_with_argtypes is called when exiting the operator_with_argtypes production. + ExitOperator_with_argtypes(c *Operator_with_argtypesContext) + + // ExitDostmt is called when exiting the dostmt production. + ExitDostmt(c *DostmtContext) + + // ExitDostmt_opt_list is called when exiting the dostmt_opt_list production. + ExitDostmt_opt_list(c *Dostmt_opt_listContext) + + // ExitDostmt_opt_item is called when exiting the dostmt_opt_item production. + ExitDostmt_opt_item(c *Dostmt_opt_itemContext) + + // ExitCreatecaststmt is called when exiting the createcaststmt production. + ExitCreatecaststmt(c *CreatecaststmtContext) + + // ExitCast_context is called when exiting the cast_context production. + ExitCast_context(c *Cast_contextContext) + + // ExitDropcaststmt is called when exiting the dropcaststmt production. + ExitDropcaststmt(c *DropcaststmtContext) + + // ExitOpt_if_exists is called when exiting the opt_if_exists production. + ExitOpt_if_exists(c *Opt_if_existsContext) + + // ExitCreatetransformstmt is called when exiting the createtransformstmt production. + ExitCreatetransformstmt(c *CreatetransformstmtContext) + + // ExitTransform_element_list is called when exiting the transform_element_list production. + ExitTransform_element_list(c *Transform_element_listContext) + + // ExitDroptransformstmt is called when exiting the droptransformstmt production. + ExitDroptransformstmt(c *DroptransformstmtContext) + + // ExitReindexstmt is called when exiting the reindexstmt production. + ExitReindexstmt(c *ReindexstmtContext) + + // ExitReindex_target_type is called when exiting the reindex_target_type production. + ExitReindex_target_type(c *Reindex_target_typeContext) + + // ExitReindex_target_multitable is called when exiting the reindex_target_multitable production. + ExitReindex_target_multitable(c *Reindex_target_multitableContext) + + // ExitReindex_option_list is called when exiting the reindex_option_list production. + ExitReindex_option_list(c *Reindex_option_listContext) + + // ExitReindex_option_elem is called when exiting the reindex_option_elem production. + ExitReindex_option_elem(c *Reindex_option_elemContext) + + // ExitAltertblspcstmt is called when exiting the altertblspcstmt production. + ExitAltertblspcstmt(c *AltertblspcstmtContext) + + // ExitRenamestmt is called when exiting the renamestmt production. + ExitRenamestmt(c *RenamestmtContext) + + // ExitOpt_column is called when exiting the opt_column production. + ExitOpt_column(c *Opt_columnContext) + + // ExitOpt_set_data is called when exiting the opt_set_data production. + ExitOpt_set_data(c *Opt_set_dataContext) + + // ExitAlterobjectdependsstmt is called when exiting the alterobjectdependsstmt production. + ExitAlterobjectdependsstmt(c *AlterobjectdependsstmtContext) + + // ExitOpt_no is called when exiting the opt_no production. + ExitOpt_no(c *Opt_noContext) + + // ExitAlterobjectschemastmt is called when exiting the alterobjectschemastmt production. + ExitAlterobjectschemastmt(c *AlterobjectschemastmtContext) + + // ExitAlteroperatorstmt is called when exiting the alteroperatorstmt production. + ExitAlteroperatorstmt(c *AlteroperatorstmtContext) + + // ExitOperator_def_list is called when exiting the operator_def_list production. + ExitOperator_def_list(c *Operator_def_listContext) + + // ExitOperator_def_elem is called when exiting the operator_def_elem production. + ExitOperator_def_elem(c *Operator_def_elemContext) + + // ExitOperator_def_arg is called when exiting the operator_def_arg production. + ExitOperator_def_arg(c *Operator_def_argContext) + + // ExitAltertypestmt is called when exiting the altertypestmt production. + ExitAltertypestmt(c *AltertypestmtContext) + + // ExitAlterownerstmt is called when exiting the alterownerstmt production. + ExitAlterownerstmt(c *AlterownerstmtContext) + + // ExitCreatepublicationstmt is called when exiting the createpublicationstmt production. + ExitCreatepublicationstmt(c *CreatepublicationstmtContext) + + // ExitPub_obj_list is called when exiting the pub_obj_list production. + ExitPub_obj_list(c *Pub_obj_listContext) + + // ExitPublication_obj_spec is called when exiting the publication_obj_spec production. + ExitPublication_obj_spec(c *Publication_obj_specContext) + + // ExitOpt_where_clause is called when exiting the opt_where_clause production. + ExitOpt_where_clause(c *Opt_where_clauseContext) + + // ExitAlterpublicationstmt is called when exiting the alterpublicationstmt production. + ExitAlterpublicationstmt(c *AlterpublicationstmtContext) + + // ExitCreatesubscriptionstmt is called when exiting the createsubscriptionstmt production. + ExitCreatesubscriptionstmt(c *CreatesubscriptionstmtContext) + + // ExitPublication_name_list is called when exiting the publication_name_list production. + ExitPublication_name_list(c *Publication_name_listContext) + + // ExitPublication_name_item is called when exiting the publication_name_item production. + ExitPublication_name_item(c *Publication_name_itemContext) + + // ExitAltersubscriptionstmt is called when exiting the altersubscriptionstmt production. + ExitAltersubscriptionstmt(c *AltersubscriptionstmtContext) + + // ExitDropsubscriptionstmt is called when exiting the dropsubscriptionstmt production. + ExitDropsubscriptionstmt(c *DropsubscriptionstmtContext) + + // ExitRulestmt is called when exiting the rulestmt production. + ExitRulestmt(c *RulestmtContext) + + // ExitRuleactionlist is called when exiting the ruleactionlist production. + ExitRuleactionlist(c *RuleactionlistContext) + + // ExitRuleactionmulti is called when exiting the ruleactionmulti production. + ExitRuleactionmulti(c *RuleactionmultiContext) + + // ExitRuleactionstmt is called when exiting the ruleactionstmt production. + ExitRuleactionstmt(c *RuleactionstmtContext) + + // ExitRuleactionstmtOrEmpty is called when exiting the ruleactionstmtOrEmpty production. + ExitRuleactionstmtOrEmpty(c *RuleactionstmtOrEmptyContext) + + // ExitEvent is called when exiting the event production. + ExitEvent(c *EventContext) + + // ExitOpt_instead is called when exiting the opt_instead production. + ExitOpt_instead(c *Opt_insteadContext) + + // ExitNotifystmt is called when exiting the notifystmt production. + ExitNotifystmt(c *NotifystmtContext) + + // ExitNotify_payload is called when exiting the notify_payload production. + ExitNotify_payload(c *Notify_payloadContext) + + // ExitListenstmt is called when exiting the listenstmt production. + ExitListenstmt(c *ListenstmtContext) + + // ExitUnlistenstmt is called when exiting the unlistenstmt production. + ExitUnlistenstmt(c *UnlistenstmtContext) + + // ExitTransactionstmt is called when exiting the transactionstmt production. + ExitTransactionstmt(c *TransactionstmtContext) + + // ExitOpt_transaction is called when exiting the opt_transaction production. + ExitOpt_transaction(c *Opt_transactionContext) + + // ExitTransaction_mode_item is called when exiting the transaction_mode_item production. + ExitTransaction_mode_item(c *Transaction_mode_itemContext) + + // ExitTransaction_mode_list is called when exiting the transaction_mode_list production. + ExitTransaction_mode_list(c *Transaction_mode_listContext) + + // ExitTransaction_mode_list_or_empty is called when exiting the transaction_mode_list_or_empty production. + ExitTransaction_mode_list_or_empty(c *Transaction_mode_list_or_emptyContext) + + // ExitOpt_transaction_chain is called when exiting the opt_transaction_chain production. + ExitOpt_transaction_chain(c *Opt_transaction_chainContext) + + // ExitViewstmt is called when exiting the viewstmt production. + ExitViewstmt(c *ViewstmtContext) + + // ExitOpt_check_option is called when exiting the opt_check_option production. + ExitOpt_check_option(c *Opt_check_optionContext) + + // ExitLoadstmt is called when exiting the loadstmt production. + ExitLoadstmt(c *LoadstmtContext) + + // ExitCreatedbstmt is called when exiting the createdbstmt production. + ExitCreatedbstmt(c *CreatedbstmtContext) + + // ExitCreatedb_opt_list is called when exiting the createdb_opt_list production. + ExitCreatedb_opt_list(c *Createdb_opt_listContext) + + // ExitCreatedb_opt_items is called when exiting the createdb_opt_items production. + ExitCreatedb_opt_items(c *Createdb_opt_itemsContext) + + // ExitCreatedb_opt_item is called when exiting the createdb_opt_item production. + ExitCreatedb_opt_item(c *Createdb_opt_itemContext) + + // ExitCreatedb_opt_name is called when exiting the createdb_opt_name production. + ExitCreatedb_opt_name(c *Createdb_opt_nameContext) + + // ExitOpt_equal is called when exiting the opt_equal production. + ExitOpt_equal(c *Opt_equalContext) + + // ExitAlterdatabasestmt is called when exiting the alterdatabasestmt production. + ExitAlterdatabasestmt(c *AlterdatabasestmtContext) + + // ExitAlterdatabasesetstmt is called when exiting the alterdatabasesetstmt production. + ExitAlterdatabasesetstmt(c *AlterdatabasesetstmtContext) + + // ExitDropdbstmt is called when exiting the dropdbstmt production. + ExitDropdbstmt(c *DropdbstmtContext) + + // ExitDrop_option_list is called when exiting the drop_option_list production. + ExitDrop_option_list(c *Drop_option_listContext) + + // ExitDrop_option is called when exiting the drop_option production. + ExitDrop_option(c *Drop_optionContext) + + // ExitAltercollationstmt is called when exiting the altercollationstmt production. + ExitAltercollationstmt(c *AltercollationstmtContext) + + // ExitAltersystemstmt is called when exiting the altersystemstmt production. + ExitAltersystemstmt(c *AltersystemstmtContext) + + // ExitCreatedomainstmt is called when exiting the createdomainstmt production. + ExitCreatedomainstmt(c *CreatedomainstmtContext) + + // ExitAlterdomainstmt is called when exiting the alterdomainstmt production. + ExitAlterdomainstmt(c *AlterdomainstmtContext) + + // ExitOpt_as is called when exiting the opt_as production. + ExitOpt_as(c *Opt_asContext) + + // ExitAltertsdictionarystmt is called when exiting the altertsdictionarystmt production. + ExitAltertsdictionarystmt(c *AltertsdictionarystmtContext) + + // ExitAltertsconfigurationstmt is called when exiting the altertsconfigurationstmt production. + ExitAltertsconfigurationstmt(c *AltertsconfigurationstmtContext) + + // ExitAny_with is called when exiting the any_with production. + ExitAny_with(c *Any_withContext) + + // ExitCreateconversionstmt is called when exiting the createconversionstmt production. + ExitCreateconversionstmt(c *CreateconversionstmtContext) + + // ExitClusterstmt is called when exiting the clusterstmt production. + ExitClusterstmt(c *ClusterstmtContext) + + // ExitCluster_index_specification is called when exiting the cluster_index_specification production. + ExitCluster_index_specification(c *Cluster_index_specificationContext) + + // ExitVacuumstmt is called when exiting the vacuumstmt production. + ExitVacuumstmt(c *VacuumstmtContext) + + // ExitAnalyzestmt is called when exiting the analyzestmt production. + ExitAnalyzestmt(c *AnalyzestmtContext) + + // ExitVac_analyze_option_list is called when exiting the vac_analyze_option_list production. + ExitVac_analyze_option_list(c *Vac_analyze_option_listContext) + + // ExitAnalyze_keyword is called when exiting the analyze_keyword production. + ExitAnalyze_keyword(c *Analyze_keywordContext) + + // ExitVac_analyze_option_elem is called when exiting the vac_analyze_option_elem production. + ExitVac_analyze_option_elem(c *Vac_analyze_option_elemContext) + + // ExitVac_analyze_option_name is called when exiting the vac_analyze_option_name production. + ExitVac_analyze_option_name(c *Vac_analyze_option_nameContext) + + // ExitVac_analyze_option_arg is called when exiting the vac_analyze_option_arg production. + ExitVac_analyze_option_arg(c *Vac_analyze_option_argContext) + + // ExitOpt_analyze is called when exiting the opt_analyze production. + ExitOpt_analyze(c *Opt_analyzeContext) + + // ExitOpt_verbose is called when exiting the opt_verbose production. + ExitOpt_verbose(c *Opt_verboseContext) + + // ExitOpt_full is called when exiting the opt_full production. + ExitOpt_full(c *Opt_fullContext) + + // ExitOpt_freeze is called when exiting the opt_freeze production. + ExitOpt_freeze(c *Opt_freezeContext) + + // ExitOpt_name_list is called when exiting the opt_name_list production. + ExitOpt_name_list(c *Opt_name_listContext) + + // ExitVacuum_relation is called when exiting the vacuum_relation production. + ExitVacuum_relation(c *Vacuum_relationContext) + + // ExitVacuum_relation_list is called when exiting the vacuum_relation_list production. + ExitVacuum_relation_list(c *Vacuum_relation_listContext) + + // ExitOpt_vacuum_relation_list is called when exiting the opt_vacuum_relation_list production. + ExitOpt_vacuum_relation_list(c *Opt_vacuum_relation_listContext) + + // ExitExplainstmt is called when exiting the explainstmt production. + ExitExplainstmt(c *ExplainstmtContext) + + // ExitExplainablestmt is called when exiting the explainablestmt production. + ExitExplainablestmt(c *ExplainablestmtContext) + + // ExitExplain_option_list is called when exiting the explain_option_list production. + ExitExplain_option_list(c *Explain_option_listContext) + + // ExitExplain_option_elem is called when exiting the explain_option_elem production. + ExitExplain_option_elem(c *Explain_option_elemContext) + + // ExitExplain_option_name is called when exiting the explain_option_name production. + ExitExplain_option_name(c *Explain_option_nameContext) + + // ExitExplain_option_arg is called when exiting the explain_option_arg production. + ExitExplain_option_arg(c *Explain_option_argContext) + + // ExitPreparestmt is called when exiting the preparestmt production. + ExitPreparestmt(c *PreparestmtContext) + + // ExitPrep_type_clause is called when exiting the prep_type_clause production. + ExitPrep_type_clause(c *Prep_type_clauseContext) + + // ExitPreparablestmt is called when exiting the preparablestmt production. + ExitPreparablestmt(c *PreparablestmtContext) + + // ExitExecutestmt is called when exiting the executestmt production. + ExitExecutestmt(c *ExecutestmtContext) + + // ExitExecute_param_clause is called when exiting the execute_param_clause production. + ExitExecute_param_clause(c *Execute_param_clauseContext) + + // ExitDeallocatestmt is called when exiting the deallocatestmt production. + ExitDeallocatestmt(c *DeallocatestmtContext) + + // ExitInsertstmt is called when exiting the insertstmt production. + ExitInsertstmt(c *InsertstmtContext) + + // ExitInsert_target is called when exiting the insert_target production. + ExitInsert_target(c *Insert_targetContext) + + // ExitInsert_rest is called when exiting the insert_rest production. + ExitInsert_rest(c *Insert_restContext) + + // ExitOverride_kind is called when exiting the override_kind production. + ExitOverride_kind(c *Override_kindContext) + + // ExitInsert_column_list is called when exiting the insert_column_list production. + ExitInsert_column_list(c *Insert_column_listContext) + + // ExitInsert_column_item is called when exiting the insert_column_item production. + ExitInsert_column_item(c *Insert_column_itemContext) + + // ExitOpt_on_conflict is called when exiting the opt_on_conflict production. + ExitOpt_on_conflict(c *Opt_on_conflictContext) + + // ExitOpt_conf_expr is called when exiting the opt_conf_expr production. + ExitOpt_conf_expr(c *Opt_conf_exprContext) + + // ExitReturning_clause is called when exiting the returning_clause production. + ExitReturning_clause(c *Returning_clauseContext) + + // ExitMergestmt is called when exiting the mergestmt production. + ExitMergestmt(c *MergestmtContext) + + // ExitMerge_insert_clause is called when exiting the merge_insert_clause production. + ExitMerge_insert_clause(c *Merge_insert_clauseContext) + + // ExitMerge_update_clause is called when exiting the merge_update_clause production. + ExitMerge_update_clause(c *Merge_update_clauseContext) + + // ExitMerge_delete_clause is called when exiting the merge_delete_clause production. + ExitMerge_delete_clause(c *Merge_delete_clauseContext) + + // ExitDeletestmt is called when exiting the deletestmt production. + ExitDeletestmt(c *DeletestmtContext) + + // ExitUsing_clause is called when exiting the using_clause production. + ExitUsing_clause(c *Using_clauseContext) + + // ExitLockstmt is called when exiting the lockstmt production. + ExitLockstmt(c *LockstmtContext) + + // ExitOpt_lock is called when exiting the opt_lock production. + ExitOpt_lock(c *Opt_lockContext) + + // ExitLock_type is called when exiting the lock_type production. + ExitLock_type(c *Lock_typeContext) + + // ExitOpt_nowait is called when exiting the opt_nowait production. + ExitOpt_nowait(c *Opt_nowaitContext) + + // ExitOpt_nowait_or_skip is called when exiting the opt_nowait_or_skip production. + ExitOpt_nowait_or_skip(c *Opt_nowait_or_skipContext) + + // ExitUpdatestmt is called when exiting the updatestmt production. + ExitUpdatestmt(c *UpdatestmtContext) + + // ExitSet_clause_list is called when exiting the set_clause_list production. + ExitSet_clause_list(c *Set_clause_listContext) + + // ExitSet_clause is called when exiting the set_clause production. + ExitSet_clause(c *Set_clauseContext) + + // ExitSet_target is called when exiting the set_target production. + ExitSet_target(c *Set_targetContext) + + // ExitSet_target_list is called when exiting the set_target_list production. + ExitSet_target_list(c *Set_target_listContext) + + // ExitDeclarecursorstmt is called when exiting the declarecursorstmt production. + ExitDeclarecursorstmt(c *DeclarecursorstmtContext) + + // ExitCursor_name is called when exiting the cursor_name production. + ExitCursor_name(c *Cursor_nameContext) + + // ExitCursor_options is called when exiting the cursor_options production. + ExitCursor_options(c *Cursor_optionsContext) + + // ExitOpt_hold is called when exiting the opt_hold production. + ExitOpt_hold(c *Opt_holdContext) + + // ExitSelectstmt is called when exiting the selectstmt production. + ExitSelectstmt(c *SelectstmtContext) + + // ExitSelect_with_parens is called when exiting the select_with_parens production. + ExitSelect_with_parens(c *Select_with_parensContext) + + // ExitSelect_no_parens is called when exiting the select_no_parens production. + ExitSelect_no_parens(c *Select_no_parensContext) + + // ExitSelect_clause is called when exiting the select_clause production. + ExitSelect_clause(c *Select_clauseContext) + + // ExitSimple_select_intersect is called when exiting the simple_select_intersect production. + ExitSimple_select_intersect(c *Simple_select_intersectContext) + + // ExitSimple_select_pramary is called when exiting the simple_select_pramary production. + ExitSimple_select_pramary(c *Simple_select_pramaryContext) + + // ExitWith_clause is called when exiting the with_clause production. + ExitWith_clause(c *With_clauseContext) + + // ExitCte_list is called when exiting the cte_list production. + ExitCte_list(c *Cte_listContext) + + // ExitCommon_table_expr is called when exiting the common_table_expr production. + ExitCommon_table_expr(c *Common_table_exprContext) + + // ExitOpt_materialized is called when exiting the opt_materialized production. + ExitOpt_materialized(c *Opt_materializedContext) + + // ExitOpt_with_clause is called when exiting the opt_with_clause production. + ExitOpt_with_clause(c *Opt_with_clauseContext) + + // ExitInto_clause is called when exiting the into_clause production. + ExitInto_clause(c *Into_clauseContext) + + // ExitOpt_strict is called when exiting the opt_strict production. + ExitOpt_strict(c *Opt_strictContext) + + // ExitOpttempTableName is called when exiting the opttempTableName production. + ExitOpttempTableName(c *OpttempTableNameContext) + + // ExitOpt_table is called when exiting the opt_table production. + ExitOpt_table(c *Opt_tableContext) + + // ExitAll_or_distinct is called when exiting the all_or_distinct production. + ExitAll_or_distinct(c *All_or_distinctContext) + + // ExitDistinct_clause is called when exiting the distinct_clause production. + ExitDistinct_clause(c *Distinct_clauseContext) + + // ExitOpt_all_clause is called when exiting the opt_all_clause production. + ExitOpt_all_clause(c *Opt_all_clauseContext) + + // ExitOpt_sort_clause is called when exiting the opt_sort_clause production. + ExitOpt_sort_clause(c *Opt_sort_clauseContext) + + // ExitSort_clause is called when exiting the sort_clause production. + ExitSort_clause(c *Sort_clauseContext) + + // ExitSortby_list is called when exiting the sortby_list production. + ExitSortby_list(c *Sortby_listContext) + + // ExitSortby is called when exiting the sortby production. + ExitSortby(c *SortbyContext) + + // ExitSelect_limit is called when exiting the select_limit production. + ExitSelect_limit(c *Select_limitContext) + + // ExitOpt_select_limit is called when exiting the opt_select_limit production. + ExitOpt_select_limit(c *Opt_select_limitContext) + + // ExitLimit_clause is called when exiting the limit_clause production. + ExitLimit_clause(c *Limit_clauseContext) + + // ExitOffset_clause is called when exiting the offset_clause production. + ExitOffset_clause(c *Offset_clauseContext) + + // ExitSelect_limit_value is called when exiting the select_limit_value production. + ExitSelect_limit_value(c *Select_limit_valueContext) + + // ExitSelect_offset_value is called when exiting the select_offset_value production. + ExitSelect_offset_value(c *Select_offset_valueContext) + + // ExitSelect_fetch_first_value is called when exiting the select_fetch_first_value production. + ExitSelect_fetch_first_value(c *Select_fetch_first_valueContext) + + // ExitI_or_f_const is called when exiting the i_or_f_const production. + ExitI_or_f_const(c *I_or_f_constContext) + + // ExitRow_or_rows is called when exiting the row_or_rows production. + ExitRow_or_rows(c *Row_or_rowsContext) + + // ExitFirst_or_next is called when exiting the first_or_next production. + ExitFirst_or_next(c *First_or_nextContext) + + // ExitGroup_clause is called when exiting the group_clause production. + ExitGroup_clause(c *Group_clauseContext) + + // ExitGroup_by_list is called when exiting the group_by_list production. + ExitGroup_by_list(c *Group_by_listContext) + + // ExitGroup_by_item is called when exiting the group_by_item production. + ExitGroup_by_item(c *Group_by_itemContext) + + // ExitEmpty_grouping_set is called when exiting the empty_grouping_set production. + ExitEmpty_grouping_set(c *Empty_grouping_setContext) + + // ExitRollup_clause is called when exiting the rollup_clause production. + ExitRollup_clause(c *Rollup_clauseContext) + + // ExitCube_clause is called when exiting the cube_clause production. + ExitCube_clause(c *Cube_clauseContext) + + // ExitGrouping_sets_clause is called when exiting the grouping_sets_clause production. + ExitGrouping_sets_clause(c *Grouping_sets_clauseContext) + + // ExitHaving_clause is called when exiting the having_clause production. + ExitHaving_clause(c *Having_clauseContext) + + // ExitFor_locking_clause is called when exiting the for_locking_clause production. + ExitFor_locking_clause(c *For_locking_clauseContext) + + // ExitOpt_for_locking_clause is called when exiting the opt_for_locking_clause production. + ExitOpt_for_locking_clause(c *Opt_for_locking_clauseContext) + + // ExitFor_locking_items is called when exiting the for_locking_items production. + ExitFor_locking_items(c *For_locking_itemsContext) + + // ExitFor_locking_item is called when exiting the for_locking_item production. + ExitFor_locking_item(c *For_locking_itemContext) + + // ExitFor_locking_strength is called when exiting the for_locking_strength production. + ExitFor_locking_strength(c *For_locking_strengthContext) + + // ExitLocked_rels_list is called when exiting the locked_rels_list production. + ExitLocked_rels_list(c *Locked_rels_listContext) + + // ExitValues_clause is called when exiting the values_clause production. + ExitValues_clause(c *Values_clauseContext) + + // ExitFrom_clause is called when exiting the from_clause production. + ExitFrom_clause(c *From_clauseContext) + + // ExitFrom_list is called when exiting the from_list production. + ExitFrom_list(c *From_listContext) + + // ExitTable_ref is called when exiting the table_ref production. + ExitTable_ref(c *Table_refContext) + + // ExitJoined_table is called when exiting the joined_table production. + ExitJoined_table(c *Joined_tableContext) + + // ExitAlias_clause is called when exiting the alias_clause production. + ExitAlias_clause(c *Alias_clauseContext) + + // ExitOpt_alias_clause is called when exiting the opt_alias_clause production. + ExitOpt_alias_clause(c *Opt_alias_clauseContext) + + // ExitTable_alias_clause is called when exiting the table_alias_clause production. + ExitTable_alias_clause(c *Table_alias_clauseContext) + + // ExitFunc_alias_clause is called when exiting the func_alias_clause production. + ExitFunc_alias_clause(c *Func_alias_clauseContext) + + // ExitJoin_type is called when exiting the join_type production. + ExitJoin_type(c *Join_typeContext) + + // ExitJoin_qual is called when exiting the join_qual production. + ExitJoin_qual(c *Join_qualContext) + + // ExitRelation_expr is called when exiting the relation_expr production. + ExitRelation_expr(c *Relation_exprContext) + + // ExitRelation_expr_list is called when exiting the relation_expr_list production. + ExitRelation_expr_list(c *Relation_expr_listContext) + + // ExitRelation_expr_opt_alias is called when exiting the relation_expr_opt_alias production. + ExitRelation_expr_opt_alias(c *Relation_expr_opt_aliasContext) + + // ExitTablesample_clause is called when exiting the tablesample_clause production. + ExitTablesample_clause(c *Tablesample_clauseContext) + + // ExitOpt_repeatable_clause is called when exiting the opt_repeatable_clause production. + ExitOpt_repeatable_clause(c *Opt_repeatable_clauseContext) + + // ExitFunc_table is called when exiting the func_table production. + ExitFunc_table(c *Func_tableContext) + + // ExitRowsfrom_item is called when exiting the rowsfrom_item production. + ExitRowsfrom_item(c *Rowsfrom_itemContext) + + // ExitRowsfrom_list is called when exiting the rowsfrom_list production. + ExitRowsfrom_list(c *Rowsfrom_listContext) + + // ExitOpt_col_def_list is called when exiting the opt_col_def_list production. + ExitOpt_col_def_list(c *Opt_col_def_listContext) + + // ExitOpt_ordinality is called when exiting the opt_ordinality production. + ExitOpt_ordinality(c *Opt_ordinalityContext) + + // ExitWhere_clause is called when exiting the where_clause production. + ExitWhere_clause(c *Where_clauseContext) + + // ExitWhere_or_current_clause is called when exiting the where_or_current_clause production. + ExitWhere_or_current_clause(c *Where_or_current_clauseContext) + + // ExitOpttablefuncelementlist is called when exiting the opttablefuncelementlist production. + ExitOpttablefuncelementlist(c *OpttablefuncelementlistContext) + + // ExitTablefuncelementlist is called when exiting the tablefuncelementlist production. + ExitTablefuncelementlist(c *TablefuncelementlistContext) + + // ExitTablefuncelement is called when exiting the tablefuncelement production. + ExitTablefuncelement(c *TablefuncelementContext) + + // ExitXmltable is called when exiting the xmltable production. + ExitXmltable(c *XmltableContext) + + // ExitXmltable_column_list is called when exiting the xmltable_column_list production. + ExitXmltable_column_list(c *Xmltable_column_listContext) + + // ExitXmltable_column_el is called when exiting the xmltable_column_el production. + ExitXmltable_column_el(c *Xmltable_column_elContext) + + // ExitXmltable_column_option_list is called when exiting the xmltable_column_option_list production. + ExitXmltable_column_option_list(c *Xmltable_column_option_listContext) + + // ExitXmltable_column_option_el is called when exiting the xmltable_column_option_el production. + ExitXmltable_column_option_el(c *Xmltable_column_option_elContext) + + // ExitXml_namespace_list is called when exiting the xml_namespace_list production. + ExitXml_namespace_list(c *Xml_namespace_listContext) + + // ExitXml_namespace_el is called when exiting the xml_namespace_el production. + ExitXml_namespace_el(c *Xml_namespace_elContext) + + // ExitTypename is called when exiting the typename production. + ExitTypename(c *TypenameContext) + + // ExitOpt_array_bounds is called when exiting the opt_array_bounds production. + ExitOpt_array_bounds(c *Opt_array_boundsContext) + + // ExitSimpletypename is called when exiting the simpletypename production. + ExitSimpletypename(c *SimpletypenameContext) + + // ExitConsttypename is called when exiting the consttypename production. + ExitConsttypename(c *ConsttypenameContext) + + // ExitGenerictype is called when exiting the generictype production. + ExitGenerictype(c *GenerictypeContext) + + // ExitOpt_type_modifiers is called when exiting the opt_type_modifiers production. + ExitOpt_type_modifiers(c *Opt_type_modifiersContext) + + // ExitNumeric is called when exiting the numeric production. + ExitNumeric(c *NumericContext) + + // ExitOpt_float is called when exiting the opt_float production. + ExitOpt_float(c *Opt_floatContext) + + // ExitBit is called when exiting the bit production. + ExitBit(c *BitContext) + + // ExitConstbit is called when exiting the constbit production. + ExitConstbit(c *ConstbitContext) + + // ExitBitwithlength is called when exiting the bitwithlength production. + ExitBitwithlength(c *BitwithlengthContext) + + // ExitBitwithoutlength is called when exiting the bitwithoutlength production. + ExitBitwithoutlength(c *BitwithoutlengthContext) + + // ExitCharacter is called when exiting the character production. + ExitCharacter(c *CharacterContext) + + // ExitConstcharacter is called when exiting the constcharacter production. + ExitConstcharacter(c *ConstcharacterContext) + + // ExitCharacter_c is called when exiting the character_c production. + ExitCharacter_c(c *Character_cContext) + + // ExitOpt_varying is called when exiting the opt_varying production. + ExitOpt_varying(c *Opt_varyingContext) + + // ExitConstdatetime is called when exiting the constdatetime production. + ExitConstdatetime(c *ConstdatetimeContext) + + // ExitConstinterval is called when exiting the constinterval production. + ExitConstinterval(c *ConstintervalContext) + + // ExitOpt_timezone is called when exiting the opt_timezone production. + ExitOpt_timezone(c *Opt_timezoneContext) + + // ExitOpt_interval is called when exiting the opt_interval production. + ExitOpt_interval(c *Opt_intervalContext) + + // ExitInterval_second is called when exiting the interval_second production. + ExitInterval_second(c *Interval_secondContext) + + // ExitOpt_escape is called when exiting the opt_escape production. + ExitOpt_escape(c *Opt_escapeContext) + + // ExitA_expr is called when exiting the a_expr production. + ExitA_expr(c *A_exprContext) + + // ExitA_expr_qual is called when exiting the a_expr_qual production. + ExitA_expr_qual(c *A_expr_qualContext) + + // ExitA_expr_lessless is called when exiting the a_expr_lessless production. + ExitA_expr_lessless(c *A_expr_lesslessContext) + + // ExitA_expr_or is called when exiting the a_expr_or production. + ExitA_expr_or(c *A_expr_orContext) + + // ExitA_expr_and is called when exiting the a_expr_and production. + ExitA_expr_and(c *A_expr_andContext) + + // ExitA_expr_between is called when exiting the a_expr_between production. + ExitA_expr_between(c *A_expr_betweenContext) + + // ExitA_expr_in is called when exiting the a_expr_in production. + ExitA_expr_in(c *A_expr_inContext) + + // ExitA_expr_unary_not is called when exiting the a_expr_unary_not production. + ExitA_expr_unary_not(c *A_expr_unary_notContext) + + // ExitA_expr_isnull is called when exiting the a_expr_isnull production. + ExitA_expr_isnull(c *A_expr_isnullContext) + + // ExitA_expr_is_not is called when exiting the a_expr_is_not production. + ExitA_expr_is_not(c *A_expr_is_notContext) + + // ExitA_expr_compare is called when exiting the a_expr_compare production. + ExitA_expr_compare(c *A_expr_compareContext) + + // ExitA_expr_like is called when exiting the a_expr_like production. + ExitA_expr_like(c *A_expr_likeContext) + + // ExitA_expr_qual_op is called when exiting the a_expr_qual_op production. + ExitA_expr_qual_op(c *A_expr_qual_opContext) + + // ExitA_expr_unary_qualop is called when exiting the a_expr_unary_qualop production. + ExitA_expr_unary_qualop(c *A_expr_unary_qualopContext) + + // ExitA_expr_add is called when exiting the a_expr_add production. + ExitA_expr_add(c *A_expr_addContext) + + // ExitA_expr_mul is called when exiting the a_expr_mul production. + ExitA_expr_mul(c *A_expr_mulContext) + + // ExitA_expr_caret is called when exiting the a_expr_caret production. + ExitA_expr_caret(c *A_expr_caretContext) + + // ExitA_expr_unary_sign is called when exiting the a_expr_unary_sign production. + ExitA_expr_unary_sign(c *A_expr_unary_signContext) + + // ExitA_expr_at_time_zone is called when exiting the a_expr_at_time_zone production. + ExitA_expr_at_time_zone(c *A_expr_at_time_zoneContext) + + // ExitA_expr_collate is called when exiting the a_expr_collate production. + ExitA_expr_collate(c *A_expr_collateContext) + + // ExitA_expr_typecast is called when exiting the a_expr_typecast production. + ExitA_expr_typecast(c *A_expr_typecastContext) + + // ExitB_expr is called when exiting the b_expr production. + ExitB_expr(c *B_exprContext) + + // ExitC_expr_exists is called when exiting the c_expr_exists production. + ExitC_expr_exists(c *C_expr_existsContext) + + // ExitC_expr_expr is called when exiting the c_expr_expr production. + ExitC_expr_expr(c *C_expr_exprContext) + + // ExitC_expr_case is called when exiting the c_expr_case production. + ExitC_expr_case(c *C_expr_caseContext) + + // ExitPlsqlvariablename is called when exiting the plsqlvariablename production. + ExitPlsqlvariablename(c *PlsqlvariablenameContext) + + // ExitFunc_application is called when exiting the func_application production. + ExitFunc_application(c *Func_applicationContext) + + // ExitFunc_expr is called when exiting the func_expr production. + ExitFunc_expr(c *Func_exprContext) + + // ExitFunc_expr_windowless is called when exiting the func_expr_windowless production. + ExitFunc_expr_windowless(c *Func_expr_windowlessContext) + + // ExitFunc_expr_common_subexpr is called when exiting the func_expr_common_subexpr production. + ExitFunc_expr_common_subexpr(c *Func_expr_common_subexprContext) + + // ExitXml_root_version is called when exiting the xml_root_version production. + ExitXml_root_version(c *Xml_root_versionContext) + + // ExitOpt_xml_root_standalone is called when exiting the opt_xml_root_standalone production. + ExitOpt_xml_root_standalone(c *Opt_xml_root_standaloneContext) + + // ExitXml_attributes is called when exiting the xml_attributes production. + ExitXml_attributes(c *Xml_attributesContext) + + // ExitXml_attribute_list is called when exiting the xml_attribute_list production. + ExitXml_attribute_list(c *Xml_attribute_listContext) + + // ExitXml_attribute_el is called when exiting the xml_attribute_el production. + ExitXml_attribute_el(c *Xml_attribute_elContext) + + // ExitDocument_or_content is called when exiting the document_or_content production. + ExitDocument_or_content(c *Document_or_contentContext) + + // ExitXml_whitespace_option is called when exiting the xml_whitespace_option production. + ExitXml_whitespace_option(c *Xml_whitespace_optionContext) + + // ExitXmlexists_argument is called when exiting the xmlexists_argument production. + ExitXmlexists_argument(c *Xmlexists_argumentContext) + + // ExitXml_passing_mech is called when exiting the xml_passing_mech production. + ExitXml_passing_mech(c *Xml_passing_mechContext) + + // ExitWithin_group_clause is called when exiting the within_group_clause production. + ExitWithin_group_clause(c *Within_group_clauseContext) + + // ExitFilter_clause is called when exiting the filter_clause production. + ExitFilter_clause(c *Filter_clauseContext) + + // ExitWindow_clause is called when exiting the window_clause production. + ExitWindow_clause(c *Window_clauseContext) + + // ExitWindow_definition_list is called when exiting the window_definition_list production. + ExitWindow_definition_list(c *Window_definition_listContext) + + // ExitWindow_definition is called when exiting the window_definition production. + ExitWindow_definition(c *Window_definitionContext) + + // ExitOver_clause is called when exiting the over_clause production. + ExitOver_clause(c *Over_clauseContext) + + // ExitWindow_specification is called when exiting the window_specification production. + ExitWindow_specification(c *Window_specificationContext) + + // ExitOpt_existing_window_name is called when exiting the opt_existing_window_name production. + ExitOpt_existing_window_name(c *Opt_existing_window_nameContext) + + // ExitOpt_partition_clause is called when exiting the opt_partition_clause production. + ExitOpt_partition_clause(c *Opt_partition_clauseContext) + + // ExitOpt_frame_clause is called when exiting the opt_frame_clause production. + ExitOpt_frame_clause(c *Opt_frame_clauseContext) + + // ExitFrame_extent is called when exiting the frame_extent production. + ExitFrame_extent(c *Frame_extentContext) + + // ExitFrame_bound is called when exiting the frame_bound production. + ExitFrame_bound(c *Frame_boundContext) + + // ExitOpt_window_exclusion_clause is called when exiting the opt_window_exclusion_clause production. + ExitOpt_window_exclusion_clause(c *Opt_window_exclusion_clauseContext) + + // ExitRow is called when exiting the row production. + ExitRow(c *RowContext) + + // ExitExplicit_row is called when exiting the explicit_row production. + ExitExplicit_row(c *Explicit_rowContext) + + // ExitImplicit_row is called when exiting the implicit_row production. + ExitImplicit_row(c *Implicit_rowContext) + + // ExitSub_type is called when exiting the sub_type production. + ExitSub_type(c *Sub_typeContext) + + // ExitAll_op is called when exiting the all_op production. + ExitAll_op(c *All_opContext) + + // ExitMathop is called when exiting the mathop production. + ExitMathop(c *MathopContext) + + // ExitQual_op is called when exiting the qual_op production. + ExitQual_op(c *Qual_opContext) + + // ExitQual_all_op is called when exiting the qual_all_op production. + ExitQual_all_op(c *Qual_all_opContext) + + // ExitSubquery_Op is called when exiting the subquery_Op production. + ExitSubquery_Op(c *Subquery_OpContext) + + // ExitExpr_list is called when exiting the expr_list production. + ExitExpr_list(c *Expr_listContext) + + // ExitFunc_arg_list is called when exiting the func_arg_list production. + ExitFunc_arg_list(c *Func_arg_listContext) + + // ExitFunc_arg_expr is called when exiting the func_arg_expr production. + ExitFunc_arg_expr(c *Func_arg_exprContext) + + // ExitType_list is called when exiting the type_list production. + ExitType_list(c *Type_listContext) + + // ExitArray_expr is called when exiting the array_expr production. + ExitArray_expr(c *Array_exprContext) + + // ExitArray_expr_list is called when exiting the array_expr_list production. + ExitArray_expr_list(c *Array_expr_listContext) + + // ExitExtract_list is called when exiting the extract_list production. + ExitExtract_list(c *Extract_listContext) + + // ExitExtract_arg is called when exiting the extract_arg production. + ExitExtract_arg(c *Extract_argContext) + + // ExitUnicode_normal_form is called when exiting the unicode_normal_form production. + ExitUnicode_normal_form(c *Unicode_normal_formContext) + + // ExitOverlay_list is called when exiting the overlay_list production. + ExitOverlay_list(c *Overlay_listContext) + + // ExitPosition_list is called when exiting the position_list production. + ExitPosition_list(c *Position_listContext) + + // ExitSubstr_list is called when exiting the substr_list production. + ExitSubstr_list(c *Substr_listContext) + + // ExitTrim_list is called when exiting the trim_list production. + ExitTrim_list(c *Trim_listContext) + + // ExitIn_expr_select is called when exiting the in_expr_select production. + ExitIn_expr_select(c *In_expr_selectContext) + + // ExitIn_expr_list is called when exiting the in_expr_list production. + ExitIn_expr_list(c *In_expr_listContext) + + // ExitCase_expr is called when exiting the case_expr production. + ExitCase_expr(c *Case_exprContext) + + // ExitWhen_clause_list is called when exiting the when_clause_list production. + ExitWhen_clause_list(c *When_clause_listContext) + + // ExitWhen_clause is called when exiting the when_clause production. + ExitWhen_clause(c *When_clauseContext) + + // ExitCase_default is called when exiting the case_default production. + ExitCase_default(c *Case_defaultContext) + + // ExitCase_arg is called when exiting the case_arg production. + ExitCase_arg(c *Case_argContext) + + // ExitColumnref is called when exiting the columnref production. + ExitColumnref(c *ColumnrefContext) + + // ExitIndirection_el is called when exiting the indirection_el production. + ExitIndirection_el(c *Indirection_elContext) + + // ExitOpt_slice_bound is called when exiting the opt_slice_bound production. + ExitOpt_slice_bound(c *Opt_slice_boundContext) + + // ExitIndirection is called when exiting the indirection production. + ExitIndirection(c *IndirectionContext) + + // ExitOpt_indirection is called when exiting the opt_indirection production. + ExitOpt_indirection(c *Opt_indirectionContext) + + // ExitOpt_target_list is called when exiting the opt_target_list production. + ExitOpt_target_list(c *Opt_target_listContext) + + // ExitTarget_list is called when exiting the target_list production. + ExitTarget_list(c *Target_listContext) + + // ExitTarget_label is called when exiting the target_label production. + ExitTarget_label(c *Target_labelContext) + + // ExitTarget_star is called when exiting the target_star production. + ExitTarget_star(c *Target_starContext) + + // ExitTarget_alias is called when exiting the target_alias production. + ExitTarget_alias(c *Target_aliasContext) + + // ExitQualified_name_list is called when exiting the qualified_name_list production. + ExitQualified_name_list(c *Qualified_name_listContext) + + // ExitQualified_name is called when exiting the qualified_name production. + ExitQualified_name(c *Qualified_nameContext) + + // ExitName_list is called when exiting the name_list production. + ExitName_list(c *Name_listContext) + + // ExitName is called when exiting the name production. + ExitName(c *NameContext) + + // ExitAttr_name is called when exiting the attr_name production. + ExitAttr_name(c *Attr_nameContext) + + // ExitFile_name is called when exiting the file_name production. + ExitFile_name(c *File_nameContext) + + // ExitFunc_name is called when exiting the func_name production. + ExitFunc_name(c *Func_nameContext) + + // ExitAexprconst is called when exiting the aexprconst production. + ExitAexprconst(c *AexprconstContext) + + // ExitXconst is called when exiting the xconst production. + ExitXconst(c *XconstContext) + + // ExitBconst is called when exiting the bconst production. + ExitBconst(c *BconstContext) + + // ExitFconst is called when exiting the fconst production. + ExitFconst(c *FconstContext) + + // ExitIconst is called when exiting the iconst production. + ExitIconst(c *IconstContext) + + // ExitSconst is called when exiting the sconst production. + ExitSconst(c *SconstContext) + + // ExitAnysconst is called when exiting the anysconst production. + ExitAnysconst(c *AnysconstContext) + + // ExitOpt_uescape is called when exiting the opt_uescape production. + ExitOpt_uescape(c *Opt_uescapeContext) + + // ExitSignediconst is called when exiting the signediconst production. + ExitSignediconst(c *SignediconstContext) + + // ExitRoleid is called when exiting the roleid production. + ExitRoleid(c *RoleidContext) + + // ExitRolespec is called when exiting the rolespec production. + ExitRolespec(c *RolespecContext) + + // ExitRole_list is called when exiting the role_list production. + ExitRole_list(c *Role_listContext) + + // ExitColid is called when exiting the colid production. + ExitColid(c *ColidContext) + + // ExitTable_alias is called when exiting the table_alias production. + ExitTable_alias(c *Table_aliasContext) + + // ExitType_function_name is called when exiting the type_function_name production. + ExitType_function_name(c *Type_function_nameContext) + + // ExitNonreservedword is called when exiting the nonreservedword production. + ExitNonreservedword(c *NonreservedwordContext) + + // ExitCollabel is called when exiting the collabel production. + ExitCollabel(c *CollabelContext) + + // ExitIdentifier is called when exiting the identifier production. + ExitIdentifier(c *IdentifierContext) + + // ExitPlsqlidentifier is called when exiting the plsqlidentifier production. + ExitPlsqlidentifier(c *PlsqlidentifierContext) + + // ExitUnreserved_keyword is called when exiting the unreserved_keyword production. + ExitUnreserved_keyword(c *Unreserved_keywordContext) + + // ExitCol_name_keyword is called when exiting the col_name_keyword production. + ExitCol_name_keyword(c *Col_name_keywordContext) + + // ExitType_func_name_keyword is called when exiting the type_func_name_keyword production. + ExitType_func_name_keyword(c *Type_func_name_keywordContext) + + // ExitReserved_keyword is called when exiting the reserved_keyword production. + ExitReserved_keyword(c *Reserved_keywordContext) + + // ExitBuiltin_function_name is called when exiting the builtin_function_name production. + ExitBuiltin_function_name(c *Builtin_function_nameContext) + + // ExitPl_function is called when exiting the pl_function production. + ExitPl_function(c *Pl_functionContext) + + // ExitComp_options is called when exiting the comp_options production. + ExitComp_options(c *Comp_optionsContext) + + // ExitComp_option is called when exiting the comp_option production. + ExitComp_option(c *Comp_optionContext) + + // ExitSharp is called when exiting the sharp production. + ExitSharp(c *SharpContext) + + // ExitOption_value is called when exiting the option_value production. + ExitOption_value(c *Option_valueContext) + + // ExitOpt_semi is called when exiting the opt_semi production. + ExitOpt_semi(c *Opt_semiContext) + + // ExitPl_block is called when exiting the pl_block production. + ExitPl_block(c *Pl_blockContext) + + // ExitDecl_sect is called when exiting the decl_sect production. + ExitDecl_sect(c *Decl_sectContext) + + // ExitDecl_start is called when exiting the decl_start production. + ExitDecl_start(c *Decl_startContext) + + // ExitDecl_stmts is called when exiting the decl_stmts production. + ExitDecl_stmts(c *Decl_stmtsContext) + + // ExitLabel_decl is called when exiting the label_decl production. + ExitLabel_decl(c *Label_declContext) + + // ExitDecl_stmt is called when exiting the decl_stmt production. + ExitDecl_stmt(c *Decl_stmtContext) + + // ExitDecl_statement is called when exiting the decl_statement production. + ExitDecl_statement(c *Decl_statementContext) + + // ExitOpt_scrollable is called when exiting the opt_scrollable production. + ExitOpt_scrollable(c *Opt_scrollableContext) + + // ExitDecl_cursor_query is called when exiting the decl_cursor_query production. + ExitDecl_cursor_query(c *Decl_cursor_queryContext) + + // ExitDecl_cursor_args is called when exiting the decl_cursor_args production. + ExitDecl_cursor_args(c *Decl_cursor_argsContext) + + // ExitDecl_cursor_arglist is called when exiting the decl_cursor_arglist production. + ExitDecl_cursor_arglist(c *Decl_cursor_arglistContext) + + // ExitDecl_cursor_arg is called when exiting the decl_cursor_arg production. + ExitDecl_cursor_arg(c *Decl_cursor_argContext) + + // ExitDecl_is_for is called when exiting the decl_is_for production. + ExitDecl_is_for(c *Decl_is_forContext) + + // ExitDecl_aliasitem is called when exiting the decl_aliasitem production. + ExitDecl_aliasitem(c *Decl_aliasitemContext) + + // ExitDecl_varname is called when exiting the decl_varname production. + ExitDecl_varname(c *Decl_varnameContext) + + // ExitDecl_const is called when exiting the decl_const production. + ExitDecl_const(c *Decl_constContext) + + // ExitDecl_datatype is called when exiting the decl_datatype production. + ExitDecl_datatype(c *Decl_datatypeContext) + + // ExitDecl_collate is called when exiting the decl_collate production. + ExitDecl_collate(c *Decl_collateContext) + + // ExitDecl_notnull is called when exiting the decl_notnull production. + ExitDecl_notnull(c *Decl_notnullContext) + + // ExitDecl_defval is called when exiting the decl_defval production. + ExitDecl_defval(c *Decl_defvalContext) + + // ExitDecl_defkey is called when exiting the decl_defkey production. + ExitDecl_defkey(c *Decl_defkeyContext) + + // ExitAssign_operator is called when exiting the assign_operator production. + ExitAssign_operator(c *Assign_operatorContext) + + // ExitProc_sect is called when exiting the proc_sect production. + ExitProc_sect(c *Proc_sectContext) + + // ExitProc_stmt is called when exiting the proc_stmt production. + ExitProc_stmt(c *Proc_stmtContext) + + // ExitStmt_perform is called when exiting the stmt_perform production. + ExitStmt_perform(c *Stmt_performContext) + + // ExitStmt_call is called when exiting the stmt_call production. + ExitStmt_call(c *Stmt_callContext) + + // ExitOpt_expr_list is called when exiting the opt_expr_list production. + ExitOpt_expr_list(c *Opt_expr_listContext) + + // ExitStmt_assign is called when exiting the stmt_assign production. + ExitStmt_assign(c *Stmt_assignContext) + + // ExitStmt_getdiag is called when exiting the stmt_getdiag production. + ExitStmt_getdiag(c *Stmt_getdiagContext) + + // ExitGetdiag_area_opt is called when exiting the getdiag_area_opt production. + ExitGetdiag_area_opt(c *Getdiag_area_optContext) + + // ExitGetdiag_list is called when exiting the getdiag_list production. + ExitGetdiag_list(c *Getdiag_listContext) + + // ExitGetdiag_list_item is called when exiting the getdiag_list_item production. + ExitGetdiag_list_item(c *Getdiag_list_itemContext) + + // ExitGetdiag_item is called when exiting the getdiag_item production. + ExitGetdiag_item(c *Getdiag_itemContext) + + // ExitGetdiag_target is called when exiting the getdiag_target production. + ExitGetdiag_target(c *Getdiag_targetContext) + + // ExitAssign_var is called when exiting the assign_var production. + ExitAssign_var(c *Assign_varContext) + + // ExitStmt_if is called when exiting the stmt_if production. + ExitStmt_if(c *Stmt_ifContext) + + // ExitStmt_elsifs is called when exiting the stmt_elsifs production. + ExitStmt_elsifs(c *Stmt_elsifsContext) + + // ExitStmt_else is called when exiting the stmt_else production. + ExitStmt_else(c *Stmt_elseContext) + + // ExitStmt_case is called when exiting the stmt_case production. + ExitStmt_case(c *Stmt_caseContext) + + // ExitOpt_expr_until_when is called when exiting the opt_expr_until_when production. + ExitOpt_expr_until_when(c *Opt_expr_until_whenContext) + + // ExitCase_when_list is called when exiting the case_when_list production. + ExitCase_when_list(c *Case_when_listContext) + + // ExitCase_when is called when exiting the case_when production. + ExitCase_when(c *Case_whenContext) + + // ExitOpt_case_else is called when exiting the opt_case_else production. + ExitOpt_case_else(c *Opt_case_elseContext) + + // ExitStmt_loop is called when exiting the stmt_loop production. + ExitStmt_loop(c *Stmt_loopContext) + + // ExitStmt_while is called when exiting the stmt_while production. + ExitStmt_while(c *Stmt_whileContext) + + // ExitStmt_for is called when exiting the stmt_for production. + ExitStmt_for(c *Stmt_forContext) + + // ExitFor_control is called when exiting the for_control production. + ExitFor_control(c *For_controlContext) + + // ExitOpt_for_using_expression is called when exiting the opt_for_using_expression production. + ExitOpt_for_using_expression(c *Opt_for_using_expressionContext) + + // ExitOpt_cursor_parameters is called when exiting the opt_cursor_parameters production. + ExitOpt_cursor_parameters(c *Opt_cursor_parametersContext) + + // ExitOpt_reverse is called when exiting the opt_reverse production. + ExitOpt_reverse(c *Opt_reverseContext) + + // ExitOpt_by_expression is called when exiting the opt_by_expression production. + ExitOpt_by_expression(c *Opt_by_expressionContext) + + // ExitFor_variable is called when exiting the for_variable production. + ExitFor_variable(c *For_variableContext) + + // ExitStmt_foreach_a is called when exiting the stmt_foreach_a production. + ExitStmt_foreach_a(c *Stmt_foreach_aContext) + + // ExitForeach_slice is called when exiting the foreach_slice production. + ExitForeach_slice(c *Foreach_sliceContext) + + // ExitStmt_exit is called when exiting the stmt_exit production. + ExitStmt_exit(c *Stmt_exitContext) + + // ExitExit_type is called when exiting the exit_type production. + ExitExit_type(c *Exit_typeContext) + + // ExitStmt_return is called when exiting the stmt_return production. + ExitStmt_return(c *Stmt_returnContext) + + // ExitOpt_return_result is called when exiting the opt_return_result production. + ExitOpt_return_result(c *Opt_return_resultContext) + + // ExitStmt_raise is called when exiting the stmt_raise production. + ExitStmt_raise(c *Stmt_raiseContext) + + // ExitOpt_stmt_raise_level is called when exiting the opt_stmt_raise_level production. + ExitOpt_stmt_raise_level(c *Opt_stmt_raise_levelContext) + + // ExitOpt_raise_list is called when exiting the opt_raise_list production. + ExitOpt_raise_list(c *Opt_raise_listContext) + + // ExitOpt_raise_using is called when exiting the opt_raise_using production. + ExitOpt_raise_using(c *Opt_raise_usingContext) + + // ExitOpt_raise_using_elem is called when exiting the opt_raise_using_elem production. + ExitOpt_raise_using_elem(c *Opt_raise_using_elemContext) + + // ExitOpt_raise_using_elem_list is called when exiting the opt_raise_using_elem_list production. + ExitOpt_raise_using_elem_list(c *Opt_raise_using_elem_listContext) + + // ExitStmt_assert is called when exiting the stmt_assert production. + ExitStmt_assert(c *Stmt_assertContext) + + // ExitOpt_stmt_assert_message is called when exiting the opt_stmt_assert_message production. + ExitOpt_stmt_assert_message(c *Opt_stmt_assert_messageContext) + + // ExitLoop_body is called when exiting the loop_body production. + ExitLoop_body(c *Loop_bodyContext) + + // ExitStmt_execsql is called when exiting the stmt_execsql production. + ExitStmt_execsql(c *Stmt_execsqlContext) + + // ExitStmt_dynexecute is called when exiting the stmt_dynexecute production. + ExitStmt_dynexecute(c *Stmt_dynexecuteContext) + + // ExitOpt_execute_using is called when exiting the opt_execute_using production. + ExitOpt_execute_using(c *Opt_execute_usingContext) + + // ExitOpt_execute_using_list is called when exiting the opt_execute_using_list production. + ExitOpt_execute_using_list(c *Opt_execute_using_listContext) + + // ExitOpt_execute_into is called when exiting the opt_execute_into production. + ExitOpt_execute_into(c *Opt_execute_intoContext) + + // ExitStmt_open is called when exiting the stmt_open production. + ExitStmt_open(c *Stmt_openContext) + + // ExitOpt_open_bound_list_item is called when exiting the opt_open_bound_list_item production. + ExitOpt_open_bound_list_item(c *Opt_open_bound_list_itemContext) + + // ExitOpt_open_bound_list is called when exiting the opt_open_bound_list production. + ExitOpt_open_bound_list(c *Opt_open_bound_listContext) + + // ExitOpt_open_using is called when exiting the opt_open_using production. + ExitOpt_open_using(c *Opt_open_usingContext) + + // ExitOpt_scroll_option is called when exiting the opt_scroll_option production. + ExitOpt_scroll_option(c *Opt_scroll_optionContext) + + // ExitOpt_scroll_option_no is called when exiting the opt_scroll_option_no production. + ExitOpt_scroll_option_no(c *Opt_scroll_option_noContext) + + // ExitStmt_fetch is called when exiting the stmt_fetch production. + ExitStmt_fetch(c *Stmt_fetchContext) + + // ExitInto_target is called when exiting the into_target production. + ExitInto_target(c *Into_targetContext) + + // ExitOpt_cursor_from is called when exiting the opt_cursor_from production. + ExitOpt_cursor_from(c *Opt_cursor_fromContext) + + // ExitOpt_fetch_direction is called when exiting the opt_fetch_direction production. + ExitOpt_fetch_direction(c *Opt_fetch_directionContext) + + // ExitStmt_move is called when exiting the stmt_move production. + ExitStmt_move(c *Stmt_moveContext) + + // ExitStmt_close is called when exiting the stmt_close production. + ExitStmt_close(c *Stmt_closeContext) + + // ExitStmt_null is called when exiting the stmt_null production. + ExitStmt_null(c *Stmt_nullContext) + + // ExitStmt_commit is called when exiting the stmt_commit production. + ExitStmt_commit(c *Stmt_commitContext) + + // ExitStmt_rollback is called when exiting the stmt_rollback production. + ExitStmt_rollback(c *Stmt_rollbackContext) + + // ExitPlsql_opt_transaction_chain is called when exiting the plsql_opt_transaction_chain production. + ExitPlsql_opt_transaction_chain(c *Plsql_opt_transaction_chainContext) + + // ExitStmt_set is called when exiting the stmt_set production. + ExitStmt_set(c *Stmt_setContext) + + // ExitCursor_variable is called when exiting the cursor_variable production. + ExitCursor_variable(c *Cursor_variableContext) + + // ExitException_sect is called when exiting the exception_sect production. + ExitException_sect(c *Exception_sectContext) + + // ExitProc_exceptions is called when exiting the proc_exceptions production. + ExitProc_exceptions(c *Proc_exceptionsContext) + + // ExitProc_exception is called when exiting the proc_exception production. + ExitProc_exception(c *Proc_exceptionContext) + + // ExitProc_conditions is called when exiting the proc_conditions production. + ExitProc_conditions(c *Proc_conditionsContext) + + // ExitProc_condition is called when exiting the proc_condition production. + ExitProc_condition(c *Proc_conditionContext) + + // ExitOpt_block_label is called when exiting the opt_block_label production. + ExitOpt_block_label(c *Opt_block_labelContext) + + // ExitOpt_loop_label is called when exiting the opt_loop_label production. + ExitOpt_loop_label(c *Opt_loop_labelContext) + + // ExitOpt_label is called when exiting the opt_label production. + ExitOpt_label(c *Opt_labelContext) + + // ExitOpt_exitcond is called when exiting the opt_exitcond production. + ExitOpt_exitcond(c *Opt_exitcondContext) + + // ExitAny_identifier is called when exiting the any_identifier production. + ExitAny_identifier(c *Any_identifierContext) + + // ExitPlsql_unreserved_keyword is called when exiting the plsql_unreserved_keyword production. + ExitPlsql_unreserved_keyword(c *Plsql_unreserved_keywordContext) + + // ExitSql_expression is called when exiting the sql_expression production. + ExitSql_expression(c *Sql_expressionContext) + + // ExitExpr_until_then is called when exiting the expr_until_then production. + ExitExpr_until_then(c *Expr_until_thenContext) + + // ExitExpr_until_semi is called when exiting the expr_until_semi production. + ExitExpr_until_semi(c *Expr_until_semiContext) + + // ExitExpr_until_rightbracket is called when exiting the expr_until_rightbracket production. + ExitExpr_until_rightbracket(c *Expr_until_rightbracketContext) + + // ExitExpr_until_loop is called when exiting the expr_until_loop production. + ExitExpr_until_loop(c *Expr_until_loopContext) + + // ExitMake_execsql_stmt is called when exiting the make_execsql_stmt production. + ExitMake_execsql_stmt(c *Make_execsql_stmtContext) + + // ExitOpt_returning_clause_into is called when exiting the opt_returning_clause_into production. + ExitOpt_returning_clause_into(c *Opt_returning_clause_intoContext) +} diff --git a/postgresql/postgresqlparser_visitor.go b/postgresql/postgresqlparser_visitor.go new file mode 100644 index 0000000..2ff577f --- /dev/null +++ b/postgresql/postgresqlparser_visitor.go @@ -0,0 +1,2475 @@ +// Code generated from PostgreSQLParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package postgresql // PostgreSQLParser +import "github.com/antlr4-go/antlr/v4" + +// A complete Visitor for a parse tree produced by PostgreSQLParser. +type PostgreSQLParserVisitor interface { + antlr.ParseTreeVisitor + + // Visit a parse tree produced by PostgreSQLParser#root. + VisitRoot(ctx *RootContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#plsqlroot. + VisitPlsqlroot(ctx *PlsqlrootContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmtblock. + VisitStmtblock(ctx *StmtblockContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmtmulti. + VisitStmtmulti(ctx *StmtmultiContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt. + VisitStmt(ctx *StmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#plsqlconsolecommand. + VisitPlsqlconsolecommand(ctx *PlsqlconsolecommandContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#callstmt. + VisitCallstmt(ctx *CallstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createrolestmt. + VisitCreaterolestmt(ctx *CreaterolestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_with. + VisitOpt_with(ctx *Opt_withContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optrolelist. + VisitOptrolelist(ctx *OptrolelistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alteroptrolelist. + VisitAlteroptrolelist(ctx *AlteroptrolelistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alteroptroleelem. + VisitAlteroptroleelem(ctx *AlteroptroleelemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createoptroleelem. + VisitCreateoptroleelem(ctx *CreateoptroleelemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createuserstmt. + VisitCreateuserstmt(ctx *CreateuserstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterrolestmt. + VisitAlterrolestmt(ctx *AlterrolestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_in_database. + VisitOpt_in_database(ctx *Opt_in_databaseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterrolesetstmt. + VisitAlterrolesetstmt(ctx *AlterrolesetstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#droprolestmt. + VisitDroprolestmt(ctx *DroprolestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#creategroupstmt. + VisitCreategroupstmt(ctx *CreategroupstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altergroupstmt. + VisitAltergroupstmt(ctx *AltergroupstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#add_drop. + VisitAdd_drop(ctx *Add_dropContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createschemastmt. + VisitCreateschemastmt(ctx *CreateschemastmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optschemaname. + VisitOptschemaname(ctx *OptschemanameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optschemaeltlist. + VisitOptschemaeltlist(ctx *OptschemaeltlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#schema_stmt. + VisitSchema_stmt(ctx *Schema_stmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#variablesetstmt. + VisitVariablesetstmt(ctx *VariablesetstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#set_rest. + VisitSet_rest(ctx *Set_restContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#generic_set. + VisitGeneric_set(ctx *Generic_setContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#set_rest_more. + VisitSet_rest_more(ctx *Set_rest_moreContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#var_name. + VisitVar_name(ctx *Var_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#var_list. + VisitVar_list(ctx *Var_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#var_value. + VisitVar_value(ctx *Var_valueContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#iso_level. + VisitIso_level(ctx *Iso_levelContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_boolean_or_string. + VisitOpt_boolean_or_string(ctx *Opt_boolean_or_stringContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#zone_value. + VisitZone_value(ctx *Zone_valueContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_encoding. + VisitOpt_encoding(ctx *Opt_encodingContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#nonreservedword_or_sconst. + VisitNonreservedword_or_sconst(ctx *Nonreservedword_or_sconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#variableresetstmt. + VisitVariableresetstmt(ctx *VariableresetstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reset_rest. + VisitReset_rest(ctx *Reset_restContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#generic_reset. + VisitGeneric_reset(ctx *Generic_resetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#setresetclause. + VisitSetresetclause(ctx *SetresetclauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#functionsetresetclause. + VisitFunctionsetresetclause(ctx *FunctionsetresetclauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#variableshowstmt. + VisitVariableshowstmt(ctx *VariableshowstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constraintssetstmt. + VisitConstraintssetstmt(ctx *ConstraintssetstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constraints_set_list. + VisitConstraints_set_list(ctx *Constraints_set_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constraints_set_mode. + VisitConstraints_set_mode(ctx *Constraints_set_modeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#checkpointstmt. + VisitCheckpointstmt(ctx *CheckpointstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#discardstmt. + VisitDiscardstmt(ctx *DiscardstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altertablestmt. + VisitAltertablestmt(ctx *AltertablestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_table_cmds. + VisitAlter_table_cmds(ctx *Alter_table_cmdsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#partition_cmd. + VisitPartition_cmd(ctx *Partition_cmdContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#index_partition_cmd. + VisitIndex_partition_cmd(ctx *Index_partition_cmdContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_table_cmd. + VisitAlter_table_cmd(ctx *Alter_table_cmdContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_column_default. + VisitAlter_column_default(ctx *Alter_column_defaultContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_drop_behavior. + VisitOpt_drop_behavior(ctx *Opt_drop_behaviorContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_collate_clause. + VisitOpt_collate_clause(ctx *Opt_collate_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_using. + VisitAlter_using(ctx *Alter_usingContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#replica_identity. + VisitReplica_identity(ctx *Replica_identityContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reloptions. + VisitReloptions(ctx *ReloptionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_reloptions. + VisitOpt_reloptions(ctx *Opt_reloptionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reloption_list. + VisitReloption_list(ctx *Reloption_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reloption_elem. + VisitReloption_elem(ctx *Reloption_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_identity_column_option_list. + VisitAlter_identity_column_option_list(ctx *Alter_identity_column_option_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_identity_column_option. + VisitAlter_identity_column_option(ctx *Alter_identity_column_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#partitionboundspec. + VisitPartitionboundspec(ctx *PartitionboundspecContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#hash_partbound_elem. + VisitHash_partbound_elem(ctx *Hash_partbound_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#hash_partbound. + VisitHash_partbound(ctx *Hash_partboundContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altercompositetypestmt. + VisitAltercompositetypestmt(ctx *AltercompositetypestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_type_cmds. + VisitAlter_type_cmds(ctx *Alter_type_cmdsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_type_cmd. + VisitAlter_type_cmd(ctx *Alter_type_cmdContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#closeportalstmt. + VisitCloseportalstmt(ctx *CloseportalstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copystmt. + VisitCopystmt(ctx *CopystmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_from. + VisitCopy_from(ctx *Copy_fromContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_program. + VisitOpt_program(ctx *Opt_programContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_file_name. + VisitCopy_file_name(ctx *Copy_file_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_options. + VisitCopy_options(ctx *Copy_optionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_opt_list. + VisitCopy_opt_list(ctx *Copy_opt_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_opt_item. + VisitCopy_opt_item(ctx *Copy_opt_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_binary. + VisitOpt_binary(ctx *Opt_binaryContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_delimiter. + VisitCopy_delimiter(ctx *Copy_delimiterContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_using. + VisitOpt_using(ctx *Opt_usingContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_generic_opt_list. + VisitCopy_generic_opt_list(ctx *Copy_generic_opt_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_generic_opt_elem. + VisitCopy_generic_opt_elem(ctx *Copy_generic_opt_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_generic_opt_arg. + VisitCopy_generic_opt_arg(ctx *Copy_generic_opt_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_generic_opt_arg_list. + VisitCopy_generic_opt_arg_list(ctx *Copy_generic_opt_arg_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#copy_generic_opt_arg_list_item. + VisitCopy_generic_opt_arg_list_item(ctx *Copy_generic_opt_arg_list_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createstmt. + VisitCreatestmt(ctx *CreatestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opttemp. + VisitOpttemp(ctx *OpttempContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opttableelementlist. + VisitOpttableelementlist(ctx *OpttableelementlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opttypedtableelementlist. + VisitOpttypedtableelementlist(ctx *OpttypedtableelementlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tableelementlist. + VisitTableelementlist(ctx *TableelementlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#typedtableelementlist. + VisitTypedtableelementlist(ctx *TypedtableelementlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tableelement. + VisitTableelement(ctx *TableelementContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#typedtableelement. + VisitTypedtableelement(ctx *TypedtableelementContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#columnDef. + VisitColumnDef(ctx *ColumnDefContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rs_colattributes. + VisitRs_colattributes(ctx *Rs_colattributesContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#columnOptions. + VisitColumnOptions(ctx *ColumnOptionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#colquallist. + VisitColquallist(ctx *ColquallistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#colconstraint. + VisitColconstraint(ctx *ColconstraintContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#colconstraintelem. + VisitColconstraintelem(ctx *ColconstraintelemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_unique_null_treatment. + VisitOpt_unique_null_treatment(ctx *Opt_unique_null_treatmentContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#generated_when. + VisitGenerated_when(ctx *Generated_whenContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constraintattr. + VisitConstraintattr(ctx *ConstraintattrContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tablelikeclause. + VisitTablelikeclause(ctx *TablelikeclauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tablelikeoptionlist. + VisitTablelikeoptionlist(ctx *TablelikeoptionlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tablelikeoption. + VisitTablelikeoption(ctx *TablelikeoptionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tableconstraint. + VisitTableconstraint(ctx *TableconstraintContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constraintelem. + VisitConstraintelem(ctx *ConstraintelemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_no_inherit. + VisitOpt_no_inherit(ctx *Opt_no_inheritContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_column_list. + VisitOpt_column_list(ctx *Opt_column_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#columnlist. + VisitColumnlist(ctx *ColumnlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#columnElem. + VisitColumnElem(ctx *ColumnElemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_c_include. + VisitOpt_c_include(ctx *Opt_c_includeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#key_match. + VisitKey_match(ctx *Key_matchContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#exclusionconstraintlist. + VisitExclusionconstraintlist(ctx *ExclusionconstraintlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#exclusionconstraintelem. + VisitExclusionconstraintelem(ctx *ExclusionconstraintelemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#exclusionwhereclause. + VisitExclusionwhereclause(ctx *ExclusionwhereclauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#key_actions. + VisitKey_actions(ctx *Key_actionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#key_update. + VisitKey_update(ctx *Key_updateContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#key_delete. + VisitKey_delete(ctx *Key_deleteContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#key_action. + VisitKey_action(ctx *Key_actionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optinherit. + VisitOptinherit(ctx *OptinheritContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optpartitionspec. + VisitOptpartitionspec(ctx *OptpartitionspecContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#partitionspec. + VisitPartitionspec(ctx *PartitionspecContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#part_params. + VisitPart_params(ctx *Part_paramsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#part_elem. + VisitPart_elem(ctx *Part_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#table_access_method_clause. + VisitTable_access_method_clause(ctx *Table_access_method_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optwith. + VisitOptwith(ctx *OptwithContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#oncommitoption. + VisitOncommitoption(ctx *OncommitoptionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opttablespace. + VisitOpttablespace(ctx *OpttablespaceContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optconstablespace. + VisitOptconstablespace(ctx *OptconstablespaceContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#existingindex. + VisitExistingindex(ctx *ExistingindexContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createstatsstmt. + VisitCreatestatsstmt(ctx *CreatestatsstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterstatsstmt. + VisitAlterstatsstmt(ctx *AlterstatsstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createasstmt. + VisitCreateasstmt(ctx *CreateasstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#create_as_target. + VisitCreate_as_target(ctx *Create_as_targetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_with_data. + VisitOpt_with_data(ctx *Opt_with_dataContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#creatematviewstmt. + VisitCreatematviewstmt(ctx *CreatematviewstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#create_mv_target. + VisitCreate_mv_target(ctx *Create_mv_targetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optnolog. + VisitOptnolog(ctx *OptnologContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#refreshmatviewstmt. + VisitRefreshmatviewstmt(ctx *RefreshmatviewstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createseqstmt. + VisitCreateseqstmt(ctx *CreateseqstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterseqstmt. + VisitAlterseqstmt(ctx *AlterseqstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optseqoptlist. + VisitOptseqoptlist(ctx *OptseqoptlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optparenthesizedseqoptlist. + VisitOptparenthesizedseqoptlist(ctx *OptparenthesizedseqoptlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#seqoptlist. + VisitSeqoptlist(ctx *SeqoptlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#seqoptelem. + VisitSeqoptelem(ctx *SeqoptelemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_by. + VisitOpt_by(ctx *Opt_byContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#numericonly. + VisitNumericonly(ctx *NumericonlyContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#numericonly_list. + VisitNumericonly_list(ctx *Numericonly_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createplangstmt. + VisitCreateplangstmt(ctx *CreateplangstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_trusted. + VisitOpt_trusted(ctx *Opt_trustedContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#handler_name. + VisitHandler_name(ctx *Handler_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_inline_handler. + VisitOpt_inline_handler(ctx *Opt_inline_handlerContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#validator_clause. + VisitValidator_clause(ctx *Validator_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_validator. + VisitOpt_validator(ctx *Opt_validatorContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_procedural. + VisitOpt_procedural(ctx *Opt_proceduralContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createtablespacestmt. + VisitCreatetablespacestmt(ctx *CreatetablespacestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opttablespaceowner. + VisitOpttablespaceowner(ctx *OpttablespaceownerContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#droptablespacestmt. + VisitDroptablespacestmt(ctx *DroptablespacestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createextensionstmt. + VisitCreateextensionstmt(ctx *CreateextensionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#create_extension_opt_list. + VisitCreate_extension_opt_list(ctx *Create_extension_opt_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#create_extension_opt_item. + VisitCreate_extension_opt_item(ctx *Create_extension_opt_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterextensionstmt. + VisitAlterextensionstmt(ctx *AlterextensionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_extension_opt_list. + VisitAlter_extension_opt_list(ctx *Alter_extension_opt_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_extension_opt_item. + VisitAlter_extension_opt_item(ctx *Alter_extension_opt_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterextensioncontentsstmt. + VisitAlterextensioncontentsstmt(ctx *AlterextensioncontentsstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createfdwstmt. + VisitCreatefdwstmt(ctx *CreatefdwstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#fdw_option. + VisitFdw_option(ctx *Fdw_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#fdw_options. + VisitFdw_options(ctx *Fdw_optionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_fdw_options. + VisitOpt_fdw_options(ctx *Opt_fdw_optionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterfdwstmt. + VisitAlterfdwstmt(ctx *AlterfdwstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#create_generic_options. + VisitCreate_generic_options(ctx *Create_generic_optionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#generic_option_list. + VisitGeneric_option_list(ctx *Generic_option_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_generic_options. + VisitAlter_generic_options(ctx *Alter_generic_optionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_generic_option_list. + VisitAlter_generic_option_list(ctx *Alter_generic_option_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alter_generic_option_elem. + VisitAlter_generic_option_elem(ctx *Alter_generic_option_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#generic_option_elem. + VisitGeneric_option_elem(ctx *Generic_option_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#generic_option_name. + VisitGeneric_option_name(ctx *Generic_option_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#generic_option_arg. + VisitGeneric_option_arg(ctx *Generic_option_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createforeignserverstmt. + VisitCreateforeignserverstmt(ctx *CreateforeignserverstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_type. + VisitOpt_type(ctx *Opt_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#foreign_server_version. + VisitForeign_server_version(ctx *Foreign_server_versionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_foreign_server_version. + VisitOpt_foreign_server_version(ctx *Opt_foreign_server_versionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterforeignserverstmt. + VisitAlterforeignserverstmt(ctx *AlterforeignserverstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createforeigntablestmt. + VisitCreateforeigntablestmt(ctx *CreateforeigntablestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#importforeignschemastmt. + VisitImportforeignschemastmt(ctx *ImportforeignschemastmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#import_qualification_type. + VisitImport_qualification_type(ctx *Import_qualification_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#import_qualification. + VisitImport_qualification(ctx *Import_qualificationContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createusermappingstmt. + VisitCreateusermappingstmt(ctx *CreateusermappingstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#auth_ident. + VisitAuth_ident(ctx *Auth_identContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dropusermappingstmt. + VisitDropusermappingstmt(ctx *DropusermappingstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterusermappingstmt. + VisitAlterusermappingstmt(ctx *AlterusermappingstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createpolicystmt. + VisitCreatepolicystmt(ctx *CreatepolicystmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterpolicystmt. + VisitAlterpolicystmt(ctx *AlterpolicystmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rowsecurityoptionalexpr. + VisitRowsecurityoptionalexpr(ctx *RowsecurityoptionalexprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rowsecurityoptionalwithcheck. + VisitRowsecurityoptionalwithcheck(ctx *RowsecurityoptionalwithcheckContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rowsecuritydefaulttorole. + VisitRowsecuritydefaulttorole(ctx *RowsecuritydefaulttoroleContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rowsecurityoptionaltorole. + VisitRowsecurityoptionaltorole(ctx *RowsecurityoptionaltoroleContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rowsecuritydefaultpermissive. + VisitRowsecuritydefaultpermissive(ctx *RowsecuritydefaultpermissiveContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rowsecuritydefaultforcmd. + VisitRowsecuritydefaultforcmd(ctx *RowsecuritydefaultforcmdContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#row_security_cmd. + VisitRow_security_cmd(ctx *Row_security_cmdContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createamstmt. + VisitCreateamstmt(ctx *CreateamstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#am_type. + VisitAm_type(ctx *Am_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createtrigstmt. + VisitCreatetrigstmt(ctx *CreatetrigstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggeractiontime. + VisitTriggeractiontime(ctx *TriggeractiontimeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggerevents. + VisitTriggerevents(ctx *TriggereventsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggeroneevent. + VisitTriggeroneevent(ctx *TriggeroneeventContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggerreferencing. + VisitTriggerreferencing(ctx *TriggerreferencingContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggertransitions. + VisitTriggertransitions(ctx *TriggertransitionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggertransition. + VisitTriggertransition(ctx *TriggertransitionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transitionoldornew. + VisitTransitionoldornew(ctx *TransitionoldornewContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transitionrowortable. + VisitTransitionrowortable(ctx *TransitionrowortableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transitionrelname. + VisitTransitionrelname(ctx *TransitionrelnameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggerforspec. + VisitTriggerforspec(ctx *TriggerforspecContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggerforopteach. + VisitTriggerforopteach(ctx *TriggerforopteachContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggerfortype. + VisitTriggerfortype(ctx *TriggerfortypeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggerwhen. + VisitTriggerwhen(ctx *TriggerwhenContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#function_or_procedure. + VisitFunction_or_procedure(ctx *Function_or_procedureContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggerfuncargs. + VisitTriggerfuncargs(ctx *TriggerfuncargsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#triggerfuncarg. + VisitTriggerfuncarg(ctx *TriggerfuncargContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#optconstrfromtable. + VisitOptconstrfromtable(ctx *OptconstrfromtableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constraintattributespec. + VisitConstraintattributespec(ctx *ConstraintattributespecContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constraintattributeElem. + VisitConstraintattributeElem(ctx *ConstraintattributeElemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createeventtrigstmt. + VisitCreateeventtrigstmt(ctx *CreateeventtrigstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#event_trigger_when_list. + VisitEvent_trigger_when_list(ctx *Event_trigger_when_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#event_trigger_when_item. + VisitEvent_trigger_when_item(ctx *Event_trigger_when_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#event_trigger_value_list. + VisitEvent_trigger_value_list(ctx *Event_trigger_value_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altereventtrigstmt. + VisitAltereventtrigstmt(ctx *AltereventtrigstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#enable_trigger. + VisitEnable_trigger(ctx *Enable_triggerContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createassertionstmt. + VisitCreateassertionstmt(ctx *CreateassertionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#definestmt. + VisitDefinestmt(ctx *DefinestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#definition. + VisitDefinition(ctx *DefinitionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#def_list. + VisitDef_list(ctx *Def_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#def_elem. + VisitDef_elem(ctx *Def_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#def_arg. + VisitDef_arg(ctx *Def_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#old_aggr_definition. + VisitOld_aggr_definition(ctx *Old_aggr_definitionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#old_aggr_list. + VisitOld_aggr_list(ctx *Old_aggr_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#old_aggr_elem. + VisitOld_aggr_elem(ctx *Old_aggr_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_enum_val_list. + VisitOpt_enum_val_list(ctx *Opt_enum_val_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#enum_val_list. + VisitEnum_val_list(ctx *Enum_val_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterenumstmt. + VisitAlterenumstmt(ctx *AlterenumstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_if_not_exists. + VisitOpt_if_not_exists(ctx *Opt_if_not_existsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createopclassstmt. + VisitCreateopclassstmt(ctx *CreateopclassstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opclass_item_list. + VisitOpclass_item_list(ctx *Opclass_item_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opclass_item. + VisitOpclass_item(ctx *Opclass_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_default. + VisitOpt_default(ctx *Opt_defaultContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_opfamily. + VisitOpt_opfamily(ctx *Opt_opfamilyContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opclass_purpose. + VisitOpclass_purpose(ctx *Opclass_purposeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_recheck. + VisitOpt_recheck(ctx *Opt_recheckContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createopfamilystmt. + VisitCreateopfamilystmt(ctx *CreateopfamilystmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alteropfamilystmt. + VisitAlteropfamilystmt(ctx *AlteropfamilystmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opclass_drop_list. + VisitOpclass_drop_list(ctx *Opclass_drop_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opclass_drop. + VisitOpclass_drop(ctx *Opclass_dropContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dropopclassstmt. + VisitDropopclassstmt(ctx *DropopclassstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dropopfamilystmt. + VisitDropopfamilystmt(ctx *DropopfamilystmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dropownedstmt. + VisitDropownedstmt(ctx *DropownedstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reassignownedstmt. + VisitReassignownedstmt(ctx *ReassignownedstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dropstmt. + VisitDropstmt(ctx *DropstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#object_type_any_name. + VisitObject_type_any_name(ctx *Object_type_any_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#object_type_name. + VisitObject_type_name(ctx *Object_type_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#drop_type_name. + VisitDrop_type_name(ctx *Drop_type_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#object_type_name_on_any_name. + VisitObject_type_name_on_any_name(ctx *Object_type_name_on_any_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#any_name_list. + VisitAny_name_list(ctx *Any_name_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#any_name. + VisitAny_name(ctx *Any_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#attrs. + VisitAttrs(ctx *AttrsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#type_name_list. + VisitType_name_list(ctx *Type_name_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#truncatestmt. + VisitTruncatestmt(ctx *TruncatestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_restart_seqs. + VisitOpt_restart_seqs(ctx *Opt_restart_seqsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#commentstmt. + VisitCommentstmt(ctx *CommentstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#comment_text. + VisitComment_text(ctx *Comment_textContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#seclabelstmt. + VisitSeclabelstmt(ctx *SeclabelstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_provider. + VisitOpt_provider(ctx *Opt_providerContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#security_label. + VisitSecurity_label(ctx *Security_labelContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#fetchstmt. + VisitFetchstmt(ctx *FetchstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#fetch_args. + VisitFetch_args(ctx *Fetch_argsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#from_in. + VisitFrom_in(ctx *From_inContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_from_in. + VisitOpt_from_in(ctx *Opt_from_inContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#grantstmt. + VisitGrantstmt(ctx *GrantstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#revokestmt. + VisitRevokestmt(ctx *RevokestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#privileges. + VisitPrivileges(ctx *PrivilegesContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#privilege_list. + VisitPrivilege_list(ctx *Privilege_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#privilege. + VisitPrivilege(ctx *PrivilegeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#privilege_target. + VisitPrivilege_target(ctx *Privilege_targetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#parameter_name_list. + VisitParameter_name_list(ctx *Parameter_name_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#parameter_name. + VisitParameter_name(ctx *Parameter_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#grantee_list. + VisitGrantee_list(ctx *Grantee_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#grantee. + VisitGrantee(ctx *GranteeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_grant_grant_option. + VisitOpt_grant_grant_option(ctx *Opt_grant_grant_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#grantrolestmt. + VisitGrantrolestmt(ctx *GrantrolestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#revokerolestmt. + VisitRevokerolestmt(ctx *RevokerolestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_grant_admin_option. + VisitOpt_grant_admin_option(ctx *Opt_grant_admin_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_granted_by. + VisitOpt_granted_by(ctx *Opt_granted_byContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterdefaultprivilegesstmt. + VisitAlterdefaultprivilegesstmt(ctx *AlterdefaultprivilegesstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#defacloptionlist. + VisitDefacloptionlist(ctx *DefacloptionlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#defacloption. + VisitDefacloption(ctx *DefacloptionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#defaclaction. + VisitDefaclaction(ctx *DefaclactionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#defacl_privilege_target. + VisitDefacl_privilege_target(ctx *Defacl_privilege_targetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#indexstmt. + VisitIndexstmt(ctx *IndexstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_unique. + VisitOpt_unique(ctx *Opt_uniqueContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_concurrently. + VisitOpt_concurrently(ctx *Opt_concurrentlyContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_index_name. + VisitOpt_index_name(ctx *Opt_index_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#access_method_clause. + VisitAccess_method_clause(ctx *Access_method_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#index_params. + VisitIndex_params(ctx *Index_paramsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#index_elem_options. + VisitIndex_elem_options(ctx *Index_elem_optionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#index_elem. + VisitIndex_elem(ctx *Index_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_include. + VisitOpt_include(ctx *Opt_includeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#index_including_params. + VisitIndex_including_params(ctx *Index_including_paramsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_collate. + VisitOpt_collate(ctx *Opt_collateContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_class. + VisitOpt_class(ctx *Opt_classContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_asc_desc. + VisitOpt_asc_desc(ctx *Opt_asc_descContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_nulls_order. + VisitOpt_nulls_order(ctx *Opt_nulls_orderContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createfunctionstmt. + VisitCreatefunctionstmt(ctx *CreatefunctionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_or_replace. + VisitOpt_or_replace(ctx *Opt_or_replaceContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_args. + VisitFunc_args(ctx *Func_argsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_args_list. + VisitFunc_args_list(ctx *Func_args_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#function_with_argtypes_list. + VisitFunction_with_argtypes_list(ctx *Function_with_argtypes_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#function_with_argtypes. + VisitFunction_with_argtypes(ctx *Function_with_argtypesContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_args_with_defaults. + VisitFunc_args_with_defaults(ctx *Func_args_with_defaultsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_args_with_defaults_list. + VisitFunc_args_with_defaults_list(ctx *Func_args_with_defaults_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_arg. + VisitFunc_arg(ctx *Func_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#arg_class. + VisitArg_class(ctx *Arg_classContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#param_name. + VisitParam_name(ctx *Param_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_return. + VisitFunc_return(ctx *Func_returnContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_type. + VisitFunc_type(ctx *Func_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_arg_with_default. + VisitFunc_arg_with_default(ctx *Func_arg_with_defaultContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#aggr_arg. + VisitAggr_arg(ctx *Aggr_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#aggr_args. + VisitAggr_args(ctx *Aggr_argsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#aggr_args_list. + VisitAggr_args_list(ctx *Aggr_args_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#aggregate_with_argtypes. + VisitAggregate_with_argtypes(ctx *Aggregate_with_argtypesContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#aggregate_with_argtypes_list. + VisitAggregate_with_argtypes_list(ctx *Aggregate_with_argtypes_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createfunc_opt_list. + VisitCreatefunc_opt_list(ctx *Createfunc_opt_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#common_func_opt_item. + VisitCommon_func_opt_item(ctx *Common_func_opt_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createfunc_opt_item. + VisitCreatefunc_opt_item(ctx *Createfunc_opt_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_as. + VisitFunc_as(ctx *Func_asContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transform_type_list. + VisitTransform_type_list(ctx *Transform_type_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_definition. + VisitOpt_definition(ctx *Opt_definitionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#table_func_column. + VisitTable_func_column(ctx *Table_func_columnContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#table_func_column_list. + VisitTable_func_column_list(ctx *Table_func_column_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterfunctionstmt. + VisitAlterfunctionstmt(ctx *AlterfunctionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterfunc_opt_list. + VisitAlterfunc_opt_list(ctx *Alterfunc_opt_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_restrict. + VisitOpt_restrict(ctx *Opt_restrictContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#removefuncstmt. + VisitRemovefuncstmt(ctx *RemovefuncstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#removeaggrstmt. + VisitRemoveaggrstmt(ctx *RemoveaggrstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#removeoperstmt. + VisitRemoveoperstmt(ctx *RemoveoperstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#oper_argtypes. + VisitOper_argtypes(ctx *Oper_argtypesContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#any_operator. + VisitAny_operator(ctx *Any_operatorContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#operator_with_argtypes_list. + VisitOperator_with_argtypes_list(ctx *Operator_with_argtypes_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#operator_with_argtypes. + VisitOperator_with_argtypes(ctx *Operator_with_argtypesContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dostmt. + VisitDostmt(ctx *DostmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dostmt_opt_list. + VisitDostmt_opt_list(ctx *Dostmt_opt_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dostmt_opt_item. + VisitDostmt_opt_item(ctx *Dostmt_opt_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createcaststmt. + VisitCreatecaststmt(ctx *CreatecaststmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#cast_context. + VisitCast_context(ctx *Cast_contextContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dropcaststmt. + VisitDropcaststmt(ctx *DropcaststmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_if_exists. + VisitOpt_if_exists(ctx *Opt_if_existsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createtransformstmt. + VisitCreatetransformstmt(ctx *CreatetransformstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transform_element_list. + VisitTransform_element_list(ctx *Transform_element_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#droptransformstmt. + VisitDroptransformstmt(ctx *DroptransformstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reindexstmt. + VisitReindexstmt(ctx *ReindexstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reindex_target_type. + VisitReindex_target_type(ctx *Reindex_target_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reindex_target_multitable. + VisitReindex_target_multitable(ctx *Reindex_target_multitableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reindex_option_list. + VisitReindex_option_list(ctx *Reindex_option_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reindex_option_elem. + VisitReindex_option_elem(ctx *Reindex_option_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altertblspcstmt. + VisitAltertblspcstmt(ctx *AltertblspcstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#renamestmt. + VisitRenamestmt(ctx *RenamestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_column. + VisitOpt_column(ctx *Opt_columnContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_set_data. + VisitOpt_set_data(ctx *Opt_set_dataContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterobjectdependsstmt. + VisitAlterobjectdependsstmt(ctx *AlterobjectdependsstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_no. + VisitOpt_no(ctx *Opt_noContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterobjectschemastmt. + VisitAlterobjectschemastmt(ctx *AlterobjectschemastmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alteroperatorstmt. + VisitAlteroperatorstmt(ctx *AlteroperatorstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#operator_def_list. + VisitOperator_def_list(ctx *Operator_def_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#operator_def_elem. + VisitOperator_def_elem(ctx *Operator_def_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#operator_def_arg. + VisitOperator_def_arg(ctx *Operator_def_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altertypestmt. + VisitAltertypestmt(ctx *AltertypestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterownerstmt. + VisitAlterownerstmt(ctx *AlterownerstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createpublicationstmt. + VisitCreatepublicationstmt(ctx *CreatepublicationstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#pub_obj_list. + VisitPub_obj_list(ctx *Pub_obj_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#publication_obj_spec. + VisitPublication_obj_spec(ctx *Publication_obj_specContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_where_clause. + VisitOpt_where_clause(ctx *Opt_where_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterpublicationstmt. + VisitAlterpublicationstmt(ctx *AlterpublicationstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createsubscriptionstmt. + VisitCreatesubscriptionstmt(ctx *CreatesubscriptionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#publication_name_list. + VisitPublication_name_list(ctx *Publication_name_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#publication_name_item. + VisitPublication_name_item(ctx *Publication_name_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altersubscriptionstmt. + VisitAltersubscriptionstmt(ctx *AltersubscriptionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dropsubscriptionstmt. + VisitDropsubscriptionstmt(ctx *DropsubscriptionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rulestmt. + VisitRulestmt(ctx *RulestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#ruleactionlist. + VisitRuleactionlist(ctx *RuleactionlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#ruleactionmulti. + VisitRuleactionmulti(ctx *RuleactionmultiContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#ruleactionstmt. + VisitRuleactionstmt(ctx *RuleactionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#ruleactionstmtOrEmpty. + VisitRuleactionstmtOrEmpty(ctx *RuleactionstmtOrEmptyContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#event. + VisitEvent(ctx *EventContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_instead. + VisitOpt_instead(ctx *Opt_insteadContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#notifystmt. + VisitNotifystmt(ctx *NotifystmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#notify_payload. + VisitNotify_payload(ctx *Notify_payloadContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#listenstmt. + VisitListenstmt(ctx *ListenstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#unlistenstmt. + VisitUnlistenstmt(ctx *UnlistenstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transactionstmt. + VisitTransactionstmt(ctx *TransactionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_transaction. + VisitOpt_transaction(ctx *Opt_transactionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transaction_mode_item. + VisitTransaction_mode_item(ctx *Transaction_mode_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transaction_mode_list. + VisitTransaction_mode_list(ctx *Transaction_mode_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#transaction_mode_list_or_empty. + VisitTransaction_mode_list_or_empty(ctx *Transaction_mode_list_or_emptyContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_transaction_chain. + VisitOpt_transaction_chain(ctx *Opt_transaction_chainContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#viewstmt. + VisitViewstmt(ctx *ViewstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_check_option. + VisitOpt_check_option(ctx *Opt_check_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#loadstmt. + VisitLoadstmt(ctx *LoadstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createdbstmt. + VisitCreatedbstmt(ctx *CreatedbstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createdb_opt_list. + VisitCreatedb_opt_list(ctx *Createdb_opt_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createdb_opt_items. + VisitCreatedb_opt_items(ctx *Createdb_opt_itemsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createdb_opt_item. + VisitCreatedb_opt_item(ctx *Createdb_opt_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createdb_opt_name. + VisitCreatedb_opt_name(ctx *Createdb_opt_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_equal. + VisitOpt_equal(ctx *Opt_equalContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterdatabasestmt. + VisitAlterdatabasestmt(ctx *AlterdatabasestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterdatabasesetstmt. + VisitAlterdatabasesetstmt(ctx *AlterdatabasesetstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#dropdbstmt. + VisitDropdbstmt(ctx *DropdbstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#drop_option_list. + VisitDrop_option_list(ctx *Drop_option_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#drop_option. + VisitDrop_option(ctx *Drop_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altercollationstmt. + VisitAltercollationstmt(ctx *AltercollationstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altersystemstmt. + VisitAltersystemstmt(ctx *AltersystemstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createdomainstmt. + VisitCreatedomainstmt(ctx *CreatedomainstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alterdomainstmt. + VisitAlterdomainstmt(ctx *AlterdomainstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_as. + VisitOpt_as(ctx *Opt_asContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altertsdictionarystmt. + VisitAltertsdictionarystmt(ctx *AltertsdictionarystmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#altertsconfigurationstmt. + VisitAltertsconfigurationstmt(ctx *AltertsconfigurationstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#any_with. + VisitAny_with(ctx *Any_withContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#createconversionstmt. + VisitCreateconversionstmt(ctx *CreateconversionstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#clusterstmt. + VisitClusterstmt(ctx *ClusterstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#cluster_index_specification. + VisitCluster_index_specification(ctx *Cluster_index_specificationContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#vacuumstmt. + VisitVacuumstmt(ctx *VacuumstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#analyzestmt. + VisitAnalyzestmt(ctx *AnalyzestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#vac_analyze_option_list. + VisitVac_analyze_option_list(ctx *Vac_analyze_option_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#analyze_keyword. + VisitAnalyze_keyword(ctx *Analyze_keywordContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#vac_analyze_option_elem. + VisitVac_analyze_option_elem(ctx *Vac_analyze_option_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#vac_analyze_option_name. + VisitVac_analyze_option_name(ctx *Vac_analyze_option_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#vac_analyze_option_arg. + VisitVac_analyze_option_arg(ctx *Vac_analyze_option_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_analyze. + VisitOpt_analyze(ctx *Opt_analyzeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_verbose. + VisitOpt_verbose(ctx *Opt_verboseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_full. + VisitOpt_full(ctx *Opt_fullContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_freeze. + VisitOpt_freeze(ctx *Opt_freezeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_name_list. + VisitOpt_name_list(ctx *Opt_name_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#vacuum_relation. + VisitVacuum_relation(ctx *Vacuum_relationContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#vacuum_relation_list. + VisitVacuum_relation_list(ctx *Vacuum_relation_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_vacuum_relation_list. + VisitOpt_vacuum_relation_list(ctx *Opt_vacuum_relation_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#explainstmt. + VisitExplainstmt(ctx *ExplainstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#explainablestmt. + VisitExplainablestmt(ctx *ExplainablestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#explain_option_list. + VisitExplain_option_list(ctx *Explain_option_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#explain_option_elem. + VisitExplain_option_elem(ctx *Explain_option_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#explain_option_name. + VisitExplain_option_name(ctx *Explain_option_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#explain_option_arg. + VisitExplain_option_arg(ctx *Explain_option_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#preparestmt. + VisitPreparestmt(ctx *PreparestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#prep_type_clause. + VisitPrep_type_clause(ctx *Prep_type_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#preparablestmt. + VisitPreparablestmt(ctx *PreparablestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#executestmt. + VisitExecutestmt(ctx *ExecutestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#execute_param_clause. + VisitExecute_param_clause(ctx *Execute_param_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#deallocatestmt. + VisitDeallocatestmt(ctx *DeallocatestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#insertstmt. + VisitInsertstmt(ctx *InsertstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#insert_target. + VisitInsert_target(ctx *Insert_targetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#insert_rest. + VisitInsert_rest(ctx *Insert_restContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#override_kind. + VisitOverride_kind(ctx *Override_kindContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#insert_column_list. + VisitInsert_column_list(ctx *Insert_column_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#insert_column_item. + VisitInsert_column_item(ctx *Insert_column_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_on_conflict. + VisitOpt_on_conflict(ctx *Opt_on_conflictContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_conf_expr. + VisitOpt_conf_expr(ctx *Opt_conf_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#returning_clause. + VisitReturning_clause(ctx *Returning_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#mergestmt. + VisitMergestmt(ctx *MergestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#merge_insert_clause. + VisitMerge_insert_clause(ctx *Merge_insert_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#merge_update_clause. + VisitMerge_update_clause(ctx *Merge_update_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#merge_delete_clause. + VisitMerge_delete_clause(ctx *Merge_delete_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#deletestmt. + VisitDeletestmt(ctx *DeletestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#using_clause. + VisitUsing_clause(ctx *Using_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#lockstmt. + VisitLockstmt(ctx *LockstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_lock. + VisitOpt_lock(ctx *Opt_lockContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#lock_type. + VisitLock_type(ctx *Lock_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_nowait. + VisitOpt_nowait(ctx *Opt_nowaitContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_nowait_or_skip. + VisitOpt_nowait_or_skip(ctx *Opt_nowait_or_skipContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#updatestmt. + VisitUpdatestmt(ctx *UpdatestmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#set_clause_list. + VisitSet_clause_list(ctx *Set_clause_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#set_clause. + VisitSet_clause(ctx *Set_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#set_target. + VisitSet_target(ctx *Set_targetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#set_target_list. + VisitSet_target_list(ctx *Set_target_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#declarecursorstmt. + VisitDeclarecursorstmt(ctx *DeclarecursorstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#cursor_name. + VisitCursor_name(ctx *Cursor_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#cursor_options. + VisitCursor_options(ctx *Cursor_optionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_hold. + VisitOpt_hold(ctx *Opt_holdContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#selectstmt. + VisitSelectstmt(ctx *SelectstmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#select_with_parens. + VisitSelect_with_parens(ctx *Select_with_parensContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#select_no_parens. + VisitSelect_no_parens(ctx *Select_no_parensContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#select_clause. + VisitSelect_clause(ctx *Select_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#simple_select_intersect. + VisitSimple_select_intersect(ctx *Simple_select_intersectContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#simple_select_pramary. + VisitSimple_select_pramary(ctx *Simple_select_pramaryContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#with_clause. + VisitWith_clause(ctx *With_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#cte_list. + VisitCte_list(ctx *Cte_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#common_table_expr. + VisitCommon_table_expr(ctx *Common_table_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_materialized. + VisitOpt_materialized(ctx *Opt_materializedContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_with_clause. + VisitOpt_with_clause(ctx *Opt_with_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#into_clause. + VisitInto_clause(ctx *Into_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_strict. + VisitOpt_strict(ctx *Opt_strictContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opttempTableName. + VisitOpttempTableName(ctx *OpttempTableNameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_table. + VisitOpt_table(ctx *Opt_tableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#all_or_distinct. + VisitAll_or_distinct(ctx *All_or_distinctContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#distinct_clause. + VisitDistinct_clause(ctx *Distinct_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_all_clause. + VisitOpt_all_clause(ctx *Opt_all_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_sort_clause. + VisitOpt_sort_clause(ctx *Opt_sort_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#sort_clause. + VisitSort_clause(ctx *Sort_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#sortby_list. + VisitSortby_list(ctx *Sortby_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#sortby. + VisitSortby(ctx *SortbyContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#select_limit. + VisitSelect_limit(ctx *Select_limitContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_select_limit. + VisitOpt_select_limit(ctx *Opt_select_limitContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#limit_clause. + VisitLimit_clause(ctx *Limit_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#offset_clause. + VisitOffset_clause(ctx *Offset_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#select_limit_value. + VisitSelect_limit_value(ctx *Select_limit_valueContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#select_offset_value. + VisitSelect_offset_value(ctx *Select_offset_valueContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#select_fetch_first_value. + VisitSelect_fetch_first_value(ctx *Select_fetch_first_valueContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#i_or_f_const. + VisitI_or_f_const(ctx *I_or_f_constContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#row_or_rows. + VisitRow_or_rows(ctx *Row_or_rowsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#first_or_next. + VisitFirst_or_next(ctx *First_or_nextContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#group_clause. + VisitGroup_clause(ctx *Group_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#group_by_list. + VisitGroup_by_list(ctx *Group_by_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#group_by_item. + VisitGroup_by_item(ctx *Group_by_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#empty_grouping_set. + VisitEmpty_grouping_set(ctx *Empty_grouping_setContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rollup_clause. + VisitRollup_clause(ctx *Rollup_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#cube_clause. + VisitCube_clause(ctx *Cube_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#grouping_sets_clause. + VisitGrouping_sets_clause(ctx *Grouping_sets_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#having_clause. + VisitHaving_clause(ctx *Having_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#for_locking_clause. + VisitFor_locking_clause(ctx *For_locking_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_for_locking_clause. + VisitOpt_for_locking_clause(ctx *Opt_for_locking_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#for_locking_items. + VisitFor_locking_items(ctx *For_locking_itemsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#for_locking_item. + VisitFor_locking_item(ctx *For_locking_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#for_locking_strength. + VisitFor_locking_strength(ctx *For_locking_strengthContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#locked_rels_list. + VisitLocked_rels_list(ctx *Locked_rels_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#values_clause. + VisitValues_clause(ctx *Values_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#from_clause. + VisitFrom_clause(ctx *From_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#from_list. + VisitFrom_list(ctx *From_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#table_ref. + VisitTable_ref(ctx *Table_refContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#joined_table. + VisitJoined_table(ctx *Joined_tableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#alias_clause. + VisitAlias_clause(ctx *Alias_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_alias_clause. + VisitOpt_alias_clause(ctx *Opt_alias_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#table_alias_clause. + VisitTable_alias_clause(ctx *Table_alias_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_alias_clause. + VisitFunc_alias_clause(ctx *Func_alias_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#join_type. + VisitJoin_type(ctx *Join_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#join_qual. + VisitJoin_qual(ctx *Join_qualContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#relation_expr. + VisitRelation_expr(ctx *Relation_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#relation_expr_list. + VisitRelation_expr_list(ctx *Relation_expr_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#relation_expr_opt_alias. + VisitRelation_expr_opt_alias(ctx *Relation_expr_opt_aliasContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tablesample_clause. + VisitTablesample_clause(ctx *Tablesample_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_repeatable_clause. + VisitOpt_repeatable_clause(ctx *Opt_repeatable_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_table. + VisitFunc_table(ctx *Func_tableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rowsfrom_item. + VisitRowsfrom_item(ctx *Rowsfrom_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rowsfrom_list. + VisitRowsfrom_list(ctx *Rowsfrom_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_col_def_list. + VisitOpt_col_def_list(ctx *Opt_col_def_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_ordinality. + VisitOpt_ordinality(ctx *Opt_ordinalityContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#where_clause. + VisitWhere_clause(ctx *Where_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#where_or_current_clause. + VisitWhere_or_current_clause(ctx *Where_or_current_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opttablefuncelementlist. + VisitOpttablefuncelementlist(ctx *OpttablefuncelementlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tablefuncelementlist. + VisitTablefuncelementlist(ctx *TablefuncelementlistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#tablefuncelement. + VisitTablefuncelement(ctx *TablefuncelementContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xmltable. + VisitXmltable(ctx *XmltableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xmltable_column_list. + VisitXmltable_column_list(ctx *Xmltable_column_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xmltable_column_el. + VisitXmltable_column_el(ctx *Xmltable_column_elContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xmltable_column_option_list. + VisitXmltable_column_option_list(ctx *Xmltable_column_option_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xmltable_column_option_el. + VisitXmltable_column_option_el(ctx *Xmltable_column_option_elContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xml_namespace_list. + VisitXml_namespace_list(ctx *Xml_namespace_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xml_namespace_el. + VisitXml_namespace_el(ctx *Xml_namespace_elContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#typename. + VisitTypename(ctx *TypenameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_array_bounds. + VisitOpt_array_bounds(ctx *Opt_array_boundsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#simpletypename. + VisitSimpletypename(ctx *SimpletypenameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#consttypename. + VisitConsttypename(ctx *ConsttypenameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#generictype. + VisitGenerictype(ctx *GenerictypeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_type_modifiers. + VisitOpt_type_modifiers(ctx *Opt_type_modifiersContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#numeric. + VisitNumeric(ctx *NumericContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_float. + VisitOpt_float(ctx *Opt_floatContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#bit. + VisitBit(ctx *BitContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constbit. + VisitConstbit(ctx *ConstbitContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#bitwithlength. + VisitBitwithlength(ctx *BitwithlengthContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#bitwithoutlength. + VisitBitwithoutlength(ctx *BitwithoutlengthContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#character. + VisitCharacter(ctx *CharacterContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constcharacter. + VisitConstcharacter(ctx *ConstcharacterContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#character_c. + VisitCharacter_c(ctx *Character_cContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_varying. + VisitOpt_varying(ctx *Opt_varyingContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constdatetime. + VisitConstdatetime(ctx *ConstdatetimeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#constinterval. + VisitConstinterval(ctx *ConstintervalContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_timezone. + VisitOpt_timezone(ctx *Opt_timezoneContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_interval. + VisitOpt_interval(ctx *Opt_intervalContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#interval_second. + VisitInterval_second(ctx *Interval_secondContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_escape. + VisitOpt_escape(ctx *Opt_escapeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr. + VisitA_expr(ctx *A_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_qual. + VisitA_expr_qual(ctx *A_expr_qualContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_lessless. + VisitA_expr_lessless(ctx *A_expr_lesslessContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_or. + VisitA_expr_or(ctx *A_expr_orContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_and. + VisitA_expr_and(ctx *A_expr_andContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_between. + VisitA_expr_between(ctx *A_expr_betweenContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_in. + VisitA_expr_in(ctx *A_expr_inContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_unary_not. + VisitA_expr_unary_not(ctx *A_expr_unary_notContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_isnull. + VisitA_expr_isnull(ctx *A_expr_isnullContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_is_not. + VisitA_expr_is_not(ctx *A_expr_is_notContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_compare. + VisitA_expr_compare(ctx *A_expr_compareContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_like. + VisitA_expr_like(ctx *A_expr_likeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_qual_op. + VisitA_expr_qual_op(ctx *A_expr_qual_opContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_unary_qualop. + VisitA_expr_unary_qualop(ctx *A_expr_unary_qualopContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_add. + VisitA_expr_add(ctx *A_expr_addContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_mul. + VisitA_expr_mul(ctx *A_expr_mulContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_caret. + VisitA_expr_caret(ctx *A_expr_caretContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_unary_sign. + VisitA_expr_unary_sign(ctx *A_expr_unary_signContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_at_time_zone. + VisitA_expr_at_time_zone(ctx *A_expr_at_time_zoneContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_collate. + VisitA_expr_collate(ctx *A_expr_collateContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#a_expr_typecast. + VisitA_expr_typecast(ctx *A_expr_typecastContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#b_expr. + VisitB_expr(ctx *B_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#c_expr_exists. + VisitC_expr_exists(ctx *C_expr_existsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#c_expr_expr. + VisitC_expr_expr(ctx *C_expr_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#c_expr_case. + VisitC_expr_case(ctx *C_expr_caseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#plsqlvariablename. + VisitPlsqlvariablename(ctx *PlsqlvariablenameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_application. + VisitFunc_application(ctx *Func_applicationContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_expr. + VisitFunc_expr(ctx *Func_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_expr_windowless. + VisitFunc_expr_windowless(ctx *Func_expr_windowlessContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_expr_common_subexpr. + VisitFunc_expr_common_subexpr(ctx *Func_expr_common_subexprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xml_root_version. + VisitXml_root_version(ctx *Xml_root_versionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_xml_root_standalone. + VisitOpt_xml_root_standalone(ctx *Opt_xml_root_standaloneContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xml_attributes. + VisitXml_attributes(ctx *Xml_attributesContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xml_attribute_list. + VisitXml_attribute_list(ctx *Xml_attribute_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xml_attribute_el. + VisitXml_attribute_el(ctx *Xml_attribute_elContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#document_or_content. + VisitDocument_or_content(ctx *Document_or_contentContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xml_whitespace_option. + VisitXml_whitespace_option(ctx *Xml_whitespace_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xmlexists_argument. + VisitXmlexists_argument(ctx *Xmlexists_argumentContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xml_passing_mech. + VisitXml_passing_mech(ctx *Xml_passing_mechContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#within_group_clause. + VisitWithin_group_clause(ctx *Within_group_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#filter_clause. + VisitFilter_clause(ctx *Filter_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#window_clause. + VisitWindow_clause(ctx *Window_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#window_definition_list. + VisitWindow_definition_list(ctx *Window_definition_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#window_definition. + VisitWindow_definition(ctx *Window_definitionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#over_clause. + VisitOver_clause(ctx *Over_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#window_specification. + VisitWindow_specification(ctx *Window_specificationContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_existing_window_name. + VisitOpt_existing_window_name(ctx *Opt_existing_window_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_partition_clause. + VisitOpt_partition_clause(ctx *Opt_partition_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_frame_clause. + VisitOpt_frame_clause(ctx *Opt_frame_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#frame_extent. + VisitFrame_extent(ctx *Frame_extentContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#frame_bound. + VisitFrame_bound(ctx *Frame_boundContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_window_exclusion_clause. + VisitOpt_window_exclusion_clause(ctx *Opt_window_exclusion_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#row. + VisitRow(ctx *RowContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#explicit_row. + VisitExplicit_row(ctx *Explicit_rowContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#implicit_row. + VisitImplicit_row(ctx *Implicit_rowContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#sub_type. + VisitSub_type(ctx *Sub_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#all_op. + VisitAll_op(ctx *All_opContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#mathop. + VisitMathop(ctx *MathopContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#qual_op. + VisitQual_op(ctx *Qual_opContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#qual_all_op. + VisitQual_all_op(ctx *Qual_all_opContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#subquery_Op. + VisitSubquery_Op(ctx *Subquery_OpContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#expr_list. + VisitExpr_list(ctx *Expr_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_arg_list. + VisitFunc_arg_list(ctx *Func_arg_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_arg_expr. + VisitFunc_arg_expr(ctx *Func_arg_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#type_list. + VisitType_list(ctx *Type_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#array_expr. + VisitArray_expr(ctx *Array_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#array_expr_list. + VisitArray_expr_list(ctx *Array_expr_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#extract_list. + VisitExtract_list(ctx *Extract_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#extract_arg. + VisitExtract_arg(ctx *Extract_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#unicode_normal_form. + VisitUnicode_normal_form(ctx *Unicode_normal_formContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#overlay_list. + VisitOverlay_list(ctx *Overlay_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#position_list. + VisitPosition_list(ctx *Position_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#substr_list. + VisitSubstr_list(ctx *Substr_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#trim_list. + VisitTrim_list(ctx *Trim_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#in_expr_select. + VisitIn_expr_select(ctx *In_expr_selectContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#in_expr_list. + VisitIn_expr_list(ctx *In_expr_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#case_expr. + VisitCase_expr(ctx *Case_exprContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#when_clause_list. + VisitWhen_clause_list(ctx *When_clause_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#when_clause. + VisitWhen_clause(ctx *When_clauseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#case_default. + VisitCase_default(ctx *Case_defaultContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#case_arg. + VisitCase_arg(ctx *Case_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#columnref. + VisitColumnref(ctx *ColumnrefContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#indirection_el. + VisitIndirection_el(ctx *Indirection_elContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_slice_bound. + VisitOpt_slice_bound(ctx *Opt_slice_boundContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#indirection. + VisitIndirection(ctx *IndirectionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_indirection. + VisitOpt_indirection(ctx *Opt_indirectionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_target_list. + VisitOpt_target_list(ctx *Opt_target_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#target_list. + VisitTarget_list(ctx *Target_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#target_label. + VisitTarget_label(ctx *Target_labelContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#target_star. + VisitTarget_star(ctx *Target_starContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#target_alias. + VisitTarget_alias(ctx *Target_aliasContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#qualified_name_list. + VisitQualified_name_list(ctx *Qualified_name_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#qualified_name. + VisitQualified_name(ctx *Qualified_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#name_list. + VisitName_list(ctx *Name_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#name. + VisitName(ctx *NameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#attr_name. + VisitAttr_name(ctx *Attr_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#file_name. + VisitFile_name(ctx *File_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#func_name. + VisitFunc_name(ctx *Func_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#aexprconst. + VisitAexprconst(ctx *AexprconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#xconst. + VisitXconst(ctx *XconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#bconst. + VisitBconst(ctx *BconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#fconst. + VisitFconst(ctx *FconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#iconst. + VisitIconst(ctx *IconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#sconst. + VisitSconst(ctx *SconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#anysconst. + VisitAnysconst(ctx *AnysconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_uescape. + VisitOpt_uescape(ctx *Opt_uescapeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#signediconst. + VisitSignediconst(ctx *SignediconstContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#roleid. + VisitRoleid(ctx *RoleidContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#rolespec. + VisitRolespec(ctx *RolespecContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#role_list. + VisitRole_list(ctx *Role_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#colid. + VisitColid(ctx *ColidContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#table_alias. + VisitTable_alias(ctx *Table_aliasContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#type_function_name. + VisitType_function_name(ctx *Type_function_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#nonreservedword. + VisitNonreservedword(ctx *NonreservedwordContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#collabel. + VisitCollabel(ctx *CollabelContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#identifier. + VisitIdentifier(ctx *IdentifierContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#plsqlidentifier. + VisitPlsqlidentifier(ctx *PlsqlidentifierContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#unreserved_keyword. + VisitUnreserved_keyword(ctx *Unreserved_keywordContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#col_name_keyword. + VisitCol_name_keyword(ctx *Col_name_keywordContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#type_func_name_keyword. + VisitType_func_name_keyword(ctx *Type_func_name_keywordContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#reserved_keyword. + VisitReserved_keyword(ctx *Reserved_keywordContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#builtin_function_name. + VisitBuiltin_function_name(ctx *Builtin_function_nameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#pl_function. + VisitPl_function(ctx *Pl_functionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#comp_options. + VisitComp_options(ctx *Comp_optionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#comp_option. + VisitComp_option(ctx *Comp_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#sharp. + VisitSharp(ctx *SharpContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#option_value. + VisitOption_value(ctx *Option_valueContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_semi. + VisitOpt_semi(ctx *Opt_semiContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#pl_block. + VisitPl_block(ctx *Pl_blockContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_sect. + VisitDecl_sect(ctx *Decl_sectContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_start. + VisitDecl_start(ctx *Decl_startContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_stmts. + VisitDecl_stmts(ctx *Decl_stmtsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#label_decl. + VisitLabel_decl(ctx *Label_declContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_stmt. + VisitDecl_stmt(ctx *Decl_stmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_statement. + VisitDecl_statement(ctx *Decl_statementContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_scrollable. + VisitOpt_scrollable(ctx *Opt_scrollableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_cursor_query. + VisitDecl_cursor_query(ctx *Decl_cursor_queryContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_cursor_args. + VisitDecl_cursor_args(ctx *Decl_cursor_argsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_cursor_arglist. + VisitDecl_cursor_arglist(ctx *Decl_cursor_arglistContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_cursor_arg. + VisitDecl_cursor_arg(ctx *Decl_cursor_argContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_is_for. + VisitDecl_is_for(ctx *Decl_is_forContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_aliasitem. + VisitDecl_aliasitem(ctx *Decl_aliasitemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_varname. + VisitDecl_varname(ctx *Decl_varnameContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_const. + VisitDecl_const(ctx *Decl_constContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_datatype. + VisitDecl_datatype(ctx *Decl_datatypeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_collate. + VisitDecl_collate(ctx *Decl_collateContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_notnull. + VisitDecl_notnull(ctx *Decl_notnullContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_defval. + VisitDecl_defval(ctx *Decl_defvalContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#decl_defkey. + VisitDecl_defkey(ctx *Decl_defkeyContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#assign_operator. + VisitAssign_operator(ctx *Assign_operatorContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#proc_sect. + VisitProc_sect(ctx *Proc_sectContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#proc_stmt. + VisitProc_stmt(ctx *Proc_stmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_perform. + VisitStmt_perform(ctx *Stmt_performContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_call. + VisitStmt_call(ctx *Stmt_callContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_expr_list. + VisitOpt_expr_list(ctx *Opt_expr_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_assign. + VisitStmt_assign(ctx *Stmt_assignContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_getdiag. + VisitStmt_getdiag(ctx *Stmt_getdiagContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#getdiag_area_opt. + VisitGetdiag_area_opt(ctx *Getdiag_area_optContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#getdiag_list. + VisitGetdiag_list(ctx *Getdiag_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#getdiag_list_item. + VisitGetdiag_list_item(ctx *Getdiag_list_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#getdiag_item. + VisitGetdiag_item(ctx *Getdiag_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#getdiag_target. + VisitGetdiag_target(ctx *Getdiag_targetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#assign_var. + VisitAssign_var(ctx *Assign_varContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_if. + VisitStmt_if(ctx *Stmt_ifContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_elsifs. + VisitStmt_elsifs(ctx *Stmt_elsifsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_else. + VisitStmt_else(ctx *Stmt_elseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_case. + VisitStmt_case(ctx *Stmt_caseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_expr_until_when. + VisitOpt_expr_until_when(ctx *Opt_expr_until_whenContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#case_when_list. + VisitCase_when_list(ctx *Case_when_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#case_when. + VisitCase_when(ctx *Case_whenContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_case_else. + VisitOpt_case_else(ctx *Opt_case_elseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_loop. + VisitStmt_loop(ctx *Stmt_loopContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_while. + VisitStmt_while(ctx *Stmt_whileContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_for. + VisitStmt_for(ctx *Stmt_forContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#for_control. + VisitFor_control(ctx *For_controlContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_for_using_expression. + VisitOpt_for_using_expression(ctx *Opt_for_using_expressionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_cursor_parameters. + VisitOpt_cursor_parameters(ctx *Opt_cursor_parametersContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_reverse. + VisitOpt_reverse(ctx *Opt_reverseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_by_expression. + VisitOpt_by_expression(ctx *Opt_by_expressionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#for_variable. + VisitFor_variable(ctx *For_variableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_foreach_a. + VisitStmt_foreach_a(ctx *Stmt_foreach_aContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#foreach_slice. + VisitForeach_slice(ctx *Foreach_sliceContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_exit. + VisitStmt_exit(ctx *Stmt_exitContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#exit_type. + VisitExit_type(ctx *Exit_typeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_return. + VisitStmt_return(ctx *Stmt_returnContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_return_result. + VisitOpt_return_result(ctx *Opt_return_resultContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_raise. + VisitStmt_raise(ctx *Stmt_raiseContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_stmt_raise_level. + VisitOpt_stmt_raise_level(ctx *Opt_stmt_raise_levelContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_raise_list. + VisitOpt_raise_list(ctx *Opt_raise_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_raise_using. + VisitOpt_raise_using(ctx *Opt_raise_usingContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_raise_using_elem. + VisitOpt_raise_using_elem(ctx *Opt_raise_using_elemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_raise_using_elem_list. + VisitOpt_raise_using_elem_list(ctx *Opt_raise_using_elem_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_assert. + VisitStmt_assert(ctx *Stmt_assertContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_stmt_assert_message. + VisitOpt_stmt_assert_message(ctx *Opt_stmt_assert_messageContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#loop_body. + VisitLoop_body(ctx *Loop_bodyContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_execsql. + VisitStmt_execsql(ctx *Stmt_execsqlContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_dynexecute. + VisitStmt_dynexecute(ctx *Stmt_dynexecuteContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_execute_using. + VisitOpt_execute_using(ctx *Opt_execute_usingContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_execute_using_list. + VisitOpt_execute_using_list(ctx *Opt_execute_using_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_execute_into. + VisitOpt_execute_into(ctx *Opt_execute_intoContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_open. + VisitStmt_open(ctx *Stmt_openContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_open_bound_list_item. + VisitOpt_open_bound_list_item(ctx *Opt_open_bound_list_itemContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_open_bound_list. + VisitOpt_open_bound_list(ctx *Opt_open_bound_listContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_open_using. + VisitOpt_open_using(ctx *Opt_open_usingContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_scroll_option. + VisitOpt_scroll_option(ctx *Opt_scroll_optionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_scroll_option_no. + VisitOpt_scroll_option_no(ctx *Opt_scroll_option_noContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_fetch. + VisitStmt_fetch(ctx *Stmt_fetchContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#into_target. + VisitInto_target(ctx *Into_targetContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_cursor_from. + VisitOpt_cursor_from(ctx *Opt_cursor_fromContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_fetch_direction. + VisitOpt_fetch_direction(ctx *Opt_fetch_directionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_move. + VisitStmt_move(ctx *Stmt_moveContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_close. + VisitStmt_close(ctx *Stmt_closeContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_null. + VisitStmt_null(ctx *Stmt_nullContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_commit. + VisitStmt_commit(ctx *Stmt_commitContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_rollback. + VisitStmt_rollback(ctx *Stmt_rollbackContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#plsql_opt_transaction_chain. + VisitPlsql_opt_transaction_chain(ctx *Plsql_opt_transaction_chainContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#stmt_set. + VisitStmt_set(ctx *Stmt_setContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#cursor_variable. + VisitCursor_variable(ctx *Cursor_variableContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#exception_sect. + VisitException_sect(ctx *Exception_sectContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#proc_exceptions. + VisitProc_exceptions(ctx *Proc_exceptionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#proc_exception. + VisitProc_exception(ctx *Proc_exceptionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#proc_conditions. + VisitProc_conditions(ctx *Proc_conditionsContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#proc_condition. + VisitProc_condition(ctx *Proc_conditionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_block_label. + VisitOpt_block_label(ctx *Opt_block_labelContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_loop_label. + VisitOpt_loop_label(ctx *Opt_loop_labelContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_label. + VisitOpt_label(ctx *Opt_labelContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_exitcond. + VisitOpt_exitcond(ctx *Opt_exitcondContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#any_identifier. + VisitAny_identifier(ctx *Any_identifierContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#plsql_unreserved_keyword. + VisitPlsql_unreserved_keyword(ctx *Plsql_unreserved_keywordContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#sql_expression. + VisitSql_expression(ctx *Sql_expressionContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#expr_until_then. + VisitExpr_until_then(ctx *Expr_until_thenContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#expr_until_semi. + VisitExpr_until_semi(ctx *Expr_until_semiContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#expr_until_rightbracket. + VisitExpr_until_rightbracket(ctx *Expr_until_rightbracketContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#expr_until_loop. + VisitExpr_until_loop(ctx *Expr_until_loopContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#make_execsql_stmt. + VisitMake_execsql_stmt(ctx *Make_execsql_stmtContext) interface{} + + // Visit a parse tree produced by PostgreSQLParser#opt_returning_clause_into. + VisitOpt_returning_clause_into(ctx *Opt_returning_clause_intoContext) interface{} +} diff --git a/postgresql/string_stack.go b/postgresql/string_stack.go new file mode 100644 index 0000000..87bdbd2 --- /dev/null +++ b/postgresql/string_stack.go @@ -0,0 +1,57 @@ +package postgresql + +import ( + "errors" +) + +var ( + ErrorStackEmpty = errors.New("stack empty") +) + +type StringStack struct { + items []string +} + +func (receiver *StringStack) Push(value string) { + receiver.items = append(receiver.items, value) +} + +func (receiver *StringStack) Pop() (string, error) { + if receiver.IsEmpty() { + return "", ErrorStackEmpty + } + value := receiver.items[0] + receiver.items = receiver.items[1:] + return value, nil +} + +func (receiver *StringStack) PopOrEmpty() string { + value, err := receiver.Pop() + if err != nil { + return "" + } + return value +} + +func (receiver *StringStack) Peek() (string, error) { + if receiver.IsEmpty() { + return "", ErrorStackEmpty + } + return receiver.items[0], nil +} + +func (receiver *StringStack) PeekOrEmpty() string { + value, err := receiver.Peek() + if err != nil { + return "" + } + return value +} + +func (receiver *StringStack) Size() int { + return len(receiver.items) +} + +func (receiver *StringStack) IsEmpty() bool { + return receiver.Size() == 0 +}